@yelon/abc
Version:
Common business components of ng-yunzai.
1 lines • 3.18 kB
Source Map (JSON)
{"version":3,"file":"auto-focus.mjs","sources":["../../../../packages/abc/auto-focus/auto-focus.directive.ts","../../../../packages/abc/auto-focus/auto-focus.module.ts","../../../../packages/abc/auto-focus/auto-focus.ts"],"sourcesContent":["import {\n Directive,\n ElementRef,\n afterNextRender,\n booleanAttribute,\n inject,\n input,\n numberAttribute,\n output\n} from '@angular/core';\nimport { take, timer } from 'rxjs';\n\n@Directive({\n selector: '[auto-focus], input[autofocus=\"autofocus\"], textarea[autofocus=\"autofocus\"]',\n exportAs: 'autoFocus'\n})\nexport class AutoFocusDirective {\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n enabled = input(true, { transform: booleanAttribute });\n delay = input(25, { transform: numberAttribute });\n readonly focus = output();\n\n constructor() {\n afterNextRender(() => {\n if (this.enabled()) {\n timer(this.delay())\n .pipe(take(1))\n .subscribe(() => {\n this.el.focus({ preventScroll: false });\n this.focus.emit();\n });\n }\n });\n }\n}\n","import { NgModule } from '@angular/core';\n\nimport { AutoFocusDirective } from './auto-focus.directive';\n\nconst COMPONENTS = [AutoFocusDirective];\n\n@NgModule({\n imports: COMPONENTS,\n exports: COMPONENTS\n})\nexport class AutoFocusModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAgBa,kBAAkB,CAAA;AACZ,IAAA,EAAE,GAAG,MAAM,CAA0B,UAAU,CAAC,CAAC,aAAa;AAC/E,IAAA,OAAO,GAAG,KAAK,CAAC,IAAI,2CAAI,SAAS,EAAE,gBAAgB,EAAA,CAAA,GAAA,CAA7B,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAC;AACtD,IAAA,KAAK,GAAG,KAAK,CAAC,EAAE,yCAAI,SAAS,EAAE,eAAe,EAAA,CAAA,GAAA,CAA5B,EAAE,SAAS,EAAE,eAAe,EAAE,GAAC;IACxC,KAAK,GAAG,MAAM,EA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