@mintplayer/ng-focus-on-load 21.1.0 → 21.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, computed, Directive } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
class FocusOnLoadDirective {
|
|
5
5
|
constructor(viewContainer) {
|
|
6
6
|
this.viewContainer = viewContainer;
|
|
7
|
-
this.
|
|
7
|
+
this.autofocus = input(true, ...(ngDevMode ? [{ debugName: "autofocus" }] : []));
|
|
8
|
+
this._autofocusResolved = computed(() => {
|
|
9
|
+
const value = this.autofocus();
|
|
10
|
+
return value === '' ? true : value;
|
|
11
|
+
}, ...(ngDevMode ? [{ debugName: "_autofocusResolved" }] : []));
|
|
8
12
|
const container = this.viewContainer['_lContainer'][0];
|
|
9
13
|
if (container instanceof HTMLElement) {
|
|
10
14
|
this.inputBox = container;
|
|
@@ -13,32 +17,22 @@ class FocusOnLoadDirective {
|
|
|
13
17
|
this.inputBox = container[8];
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
|
-
set autofocus(value) {
|
|
17
|
-
if (value === '') {
|
|
18
|
-
// <bs-select2 ... autofocus></bs-select2>
|
|
19
|
-
value = true;
|
|
20
|
-
}
|
|
21
|
-
this._autofocus = value;
|
|
22
|
-
}
|
|
23
20
|
ngAfterViewInit() {
|
|
24
21
|
setTimeout(() => {
|
|
25
|
-
if (this.
|
|
22
|
+
if (this._autofocusResolved()) {
|
|
26
23
|
this.inputBox.focus();
|
|
27
24
|
}
|
|
28
25
|
}, 10);
|
|
29
26
|
}
|
|
30
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
31
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
27
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: FocusOnLoadDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
28
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.6", type: FocusOnLoadDirective, isStandalone: true, selector: "*[autofocus]", inputs: { autofocus: { classPropertyName: "autofocus", publicName: "autofocus", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 }); }
|
|
32
29
|
}
|
|
33
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.6", ngImport: i0, type: FocusOnLoadDirective, decorators: [{
|
|
34
31
|
type: Directive,
|
|
35
32
|
args: [{
|
|
36
33
|
selector: '*[autofocus]',
|
|
37
|
-
standalone: true,
|
|
38
34
|
}]
|
|
39
|
-
}], ctorParameters: () => [{ type: i0.ViewContainerRef }], propDecorators: { autofocus: [{
|
|
40
|
-
type: Input
|
|
41
|
-
}] } });
|
|
35
|
+
}], ctorParameters: () => [{ type: i0.ViewContainerRef }], propDecorators: { autofocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "autofocus", required: false }] }] } });
|
|
42
36
|
|
|
43
37
|
/**
|
|
44
38
|
* Generated bundle index. Do not edit.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mintplayer-ng-focus-on-load.mjs","sources":["../../../../libs/mintplayer-ng-focus-on-load/src/lib/directives/focus-on-load/focus-on-load.directive.ts","../../../../libs/mintplayer-ng-focus-on-load/src/mintplayer-ng-focus-on-load.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"mintplayer-ng-focus-on-load.mjs","sources":["../../../../libs/mintplayer-ng-focus-on-load/src/lib/directives/focus-on-load/focus-on-load.directive.ts","../../../../libs/mintplayer-ng-focus-on-load/src/mintplayer-ng-focus-on-load.ts"],"sourcesContent":["import { computed, input, ViewContainerRef, Directive, AfterViewInit } from '@angular/core';\n\n@Directive({\n selector: '*[autofocus]',\n})\nexport class FocusOnLoadDirective implements AfterViewInit {\n\n constructor(\n private viewContainer: ViewContainerRef\n ) {\n const container = (<any>this.viewContainer)['_lContainer'][0]\n if (container instanceof HTMLElement) {\n this.inputBox = <HTMLInputElement>container;\n } else {\n this.inputBox = container[8];\n }\n }\n\n private readonly inputBox!: any;\n\n readonly autofocus = input<any>(true);\n\n private readonly _autofocusResolved = computed(() => {\n const value = this.autofocus();\n return value === '' ? true : value;\n });\n\n ngAfterViewInit() {\n setTimeout(() => {\n if (this._autofocusResolved()) {\n this.inputBox.focus();\n }\n }, 10);\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAKa,oBAAoB,CAAA;AAE/B,IAAA,WAAA,CACU,aAA+B,EAAA;QAA/B,IAAA,CAAA,aAAa,GAAb,aAAa;AAYd,QAAA,IAAA,CAAA,SAAS,GAAG,KAAK,CAAM,IAAI,qDAAC;AAEpB,QAAA,IAAA,CAAA,kBAAkB,GAAG,QAAQ,CAAC,MAAK;AAClD,YAAA,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE;YAC9B,OAAO,KAAK,KAAK,EAAE,GAAG,IAAI,GAAG,KAAK;AACpC,QAAA,CAAC,8DAAC;QAfA,MAAM,SAAS,GAAS,IAAI,CAAC,aAAc,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AAC7D,QAAA,IAAI,SAAS,YAAY,WAAW,EAAE;AACpC,YAAA,IAAI,CAAC,QAAQ,GAAqB,SAAS;QAC7C;aAAO;AACL,YAAA,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC;QAC9B;IACF;IAWA,eAAe,GAAA;QACb,UAAU,CAAC,MAAK;AACd,YAAA,IAAI,IAAI,CAAC,kBAAkB,EAAE,EAAE;AAC7B,gBAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE;YACvB;QACF,CAAC,EAAE,EAAE,CAAC;IACR;8GA5BW,oBAAoB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,gBAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAApB,oBAAoB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,WAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA;;2FAApB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAHhC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,cAAc;AACzB,iBAAA;;;ACJD;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -5,11 +5,11 @@ declare class FocusOnLoadDirective implements AfterViewInit {
|
|
|
5
5
|
private viewContainer;
|
|
6
6
|
constructor(viewContainer: ViewContainerRef);
|
|
7
7
|
private readonly inputBox;
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
readonly autofocus: i0.InputSignal<any>;
|
|
9
|
+
private readonly _autofocusResolved;
|
|
10
10
|
ngAfterViewInit(): void;
|
|
11
11
|
static ɵfac: i0.ɵɵFactoryDeclaration<FocusOnLoadDirective, never>;
|
|
12
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<FocusOnLoadDirective, "*[autofocus]", never, { "autofocus": { "alias": "autofocus"; "required": false; }; }, {}, never, never, true, never>;
|
|
12
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<FocusOnLoadDirective, "*[autofocus]", never, { "autofocus": { "alias": "autofocus"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { FocusOnLoadDirective };
|