{"version":3,"file":"primeng-autofocus.mjs","sources":["../../src/app/components/autofocus/autofocus.ts","../../src/app/components/autofocus/primeng-autofocus.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { AfterViewInit, Directive, ElementRef, Input, NgModule } from '@angular/core';\nimport { LicenseManager } from 'primeng/api';\nimport { DomHandler } from 'primeng/dom';\n\n@Directive({\n selector: '[pAutoFocus]',\n host: {\n class: 'p-element'\n }\n})\nexport class AutoFocus implements AfterViewInit {\n constructor(private host: ElementRef) {}\n\n @Input() autofocus: boolean;\n\n focused: boolean = false;\n\n ngAfterContentChecked() {\n if (!this.focused) {\n if (this.autofocus) {\n const focusableElements = DomHandler.getFocusableElements(this.host.nativeElement);\n\n if (focusableElements.length === 0) {\n this.host.nativeElement.focus();\n }\n if (focusableElements.length > 0) {\n focusableElements[0].focus();\n }\n\n this.focused = true;\n }\n }\n }\n\n ngAfterViewInit() {\n LicenseManager.check();\n }\n}\n\n@NgModule({\n imports: [CommonModule],\n exports: [AutoFocus],\n declarations: [AutoFocus]\n})\nexport class AutoFocusModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;;MAWa,SAAS,CAAA;AAClB,IAAA,WAAA,CAAoB,IAAgB,EAAA;AAAhB,QAAA,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;AAIpC,QAAA,IAAO,CAAA,OAAA,GAAY,KAAK,CAAC;KAJe;IAMxC,qBAAqB,GAAA;AACjB,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;YACf,IAAI,IAAI,CAAC,SAAS,EAAE;AAChB,gBAAA,MAAM,iBAAiB,GAAG,UAAU,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;AAEnF,gBAAA,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;AAChC,oBAAA,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;A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