nmce-directives 1.4.4 → 1.5.1
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.
- package/README.md +4 -1
- package/fesm2022/nmce-directives.mjs +18 -85
- package/fesm2022/nmce-directives.mjs.map +1 -1
- package/index.d.ts +7 -32
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,73 +1,36 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Input, Directive
|
|
3
|
-
import { CommonModule } from '@angular/common';
|
|
4
|
-
import { FormsModule } from '@angular/forms';
|
|
2
|
+
import { Input, Directive } from '@angular/core';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Use as a parameterized input parameter in html element.
|
|
8
6
|
* When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig,
|
|
9
|
-
* if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a
|
|
7
|
+
* if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a material dialog.
|
|
10
8
|
*/
|
|
11
9
|
class AutofocusDirective {
|
|
12
10
|
el;
|
|
13
|
-
|
|
14
|
-
focused = false;
|
|
15
|
-
initialized = false;
|
|
16
|
-
everFocused = false;
|
|
11
|
+
autofocus = false;
|
|
17
12
|
constructor(el) {
|
|
18
13
|
this.el = el;
|
|
19
|
-
//console.debug('autofocusDirective created.');
|
|
20
14
|
}
|
|
21
15
|
ngAfterViewInit() {
|
|
22
|
-
this.
|
|
23
|
-
this.ngDoCheck();
|
|
24
|
-
}
|
|
25
|
-
ngDoCheck() {
|
|
26
|
-
if (!this.initialized) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (this.toFocus && !this.everFocused && !this.focused) {
|
|
16
|
+
if (this.autofocus) {
|
|
30
17
|
this.el.nativeElement.focus();
|
|
31
|
-
this.focused = true;
|
|
32
|
-
this.everFocused = true;
|
|
33
|
-
console.debug('focused now.');
|
|
34
18
|
}
|
|
35
19
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
set autofocus(condition) {
|
|
40
|
-
this.toFocus = condition !== false;
|
|
41
|
-
}
|
|
42
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
43
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.3", type: AutofocusDirective, isStandalone: false, selector: "[autofocus]", inputs: { autofocus: "autofocus" }, ngImport: i0 });
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
21
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.10", type: AutofocusDirective, isStandalone: true, selector: "[autofocus]", inputs: { autofocus: "autofocus" }, ngImport: i0 });
|
|
44
22
|
}
|
|
45
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: AutofocusDirective, decorators: [{
|
|
46
24
|
type: Directive,
|
|
47
25
|
args: [{
|
|
48
26
|
selector: '[autofocus]',
|
|
49
|
-
standalone:
|
|
27
|
+
standalone: true
|
|
50
28
|
}]
|
|
51
29
|
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { autofocus: [{
|
|
52
|
-
type: Input
|
|
30
|
+
type: Input,
|
|
31
|
+
args: ['autofocus']
|
|
53
32
|
}] } });
|
|
54
33
|
|
|
55
|
-
class DataComponentDirective {
|
|
56
|
-
viewContainerRef;
|
|
57
|
-
constructor(viewContainerRef) {
|
|
58
|
-
this.viewContainerRef = viewContainerRef;
|
|
59
|
-
}
|
|
60
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: DataComponentDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
61
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.3", type: DataComponentDirective, isStandalone: false, selector: "[dataComponentHost]", ngImport: i0 });
|
|
62
|
-
}
|
|
63
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: DataComponentDirective, decorators: [{
|
|
64
|
-
type: Directive,
|
|
65
|
-
args: [{
|
|
66
|
-
selector: '[dataComponentHost]',
|
|
67
|
-
standalone: false
|
|
68
|
-
}]
|
|
69
|
-
}], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
|
|
70
|
-
|
|
71
34
|
/**
|
|
72
35
|
* Scroll to element attached. And the element may be an Angular Material component too.
|
|
73
36
|
*/
|
|
@@ -83,57 +46,27 @@ class ScrollIntoDirective {
|
|
|
83
46
|
this.el.nativeElement.scrollIntoView();
|
|
84
47
|
}
|
|
85
48
|
}
|
|
86
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.
|
|
87
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.
|
|
49
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: ScrollIntoDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
50
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.10", type: ScrollIntoDirective, isStandalone: true, selector: "[scrollInto]", inputs: { scrollInto: "scrollInto" }, ngImport: i0 });
|
|
88
51
|
}
|
|
89
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: ScrollIntoDirective, decorators: [{
|
|
90
53
|
type: Directive,
|
|
91
54
|
args: [{
|
|
92
55
|
selector: '[scrollInto]',
|
|
93
|
-
standalone:
|
|
56
|
+
standalone: true
|
|
94
57
|
}]
|
|
95
58
|
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { scrollInto: [{
|
|
96
59
|
type: Input
|
|
97
60
|
}] } });
|
|
98
61
|
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
*
|
|
62
|
+
/*
|
|
63
|
+
* Public API Surface of nmce-directives
|
|
102
64
|
*/
|
|
103
|
-
|
|
104
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NmceDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
105
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.3", ngImport: i0, type: NmceDirectivesModule, declarations: [AutofocusDirective,
|
|
106
|
-
ScrollIntoDirective,
|
|
107
|
-
DataComponentDirective], imports: [CommonModule,
|
|
108
|
-
FormsModule], exports: [AutofocusDirective,
|
|
109
|
-
ScrollIntoDirective,
|
|
110
|
-
DataComponentDirective] });
|
|
111
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NmceDirectivesModule, imports: [CommonModule,
|
|
112
|
-
FormsModule] });
|
|
113
|
-
}
|
|
114
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.3", ngImport: i0, type: NmceDirectivesModule, decorators: [{
|
|
115
|
-
type: NgModule,
|
|
116
|
-
args: [{
|
|
117
|
-
imports: [
|
|
118
|
-
CommonModule,
|
|
119
|
-
FormsModule,
|
|
120
|
-
],
|
|
121
|
-
declarations: [
|
|
122
|
-
AutofocusDirective,
|
|
123
|
-
ScrollIntoDirective,
|
|
124
|
-
DataComponentDirective,
|
|
125
|
-
],
|
|
126
|
-
exports: [
|
|
127
|
-
AutofocusDirective,
|
|
128
|
-
ScrollIntoDirective,
|
|
129
|
-
DataComponentDirective,
|
|
130
|
-
]
|
|
131
|
-
}]
|
|
132
|
-
}] });
|
|
65
|
+
/// <reference types="@angular/localize" />
|
|
133
66
|
|
|
134
67
|
/**
|
|
135
68
|
* Generated bundle index. Do not edit.
|
|
136
69
|
*/
|
|
137
70
|
|
|
138
|
-
export { AutofocusDirective,
|
|
71
|
+
export { AutofocusDirective, ScrollIntoDirective };
|
|
139
72
|
//# sourceMappingURL=nmce-directives.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nmce-directives.mjs","sources":["../../../projects/nmce-directives/src/_directives/autofocus.ts","../../../projects/nmce-directives/src/_directives/
|
|
1
|
+
{"version":3,"file":"nmce-directives.mjs","sources":["../../../projects/nmce-directives/src/_directives/autofocus.ts","../../../projects/nmce-directives/src/_directives/scrollInto.directive.ts","../../../projects/nmce-directives/src/public-api.ts","../../../projects/nmce-directives/src/nmce-directives.ts"],"sourcesContent":["import { AfterViewInit, Directive, ElementRef, Input } from '@angular/core';\r\n\r\n/**\r\n * Use as a parameterized input parameter in html element.\r\n * When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig, \r\n * if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a material dialog.\r\n */\r\n@Directive({\r\n\tselector: '[autofocus]',\r\n\tstandalone: true\r\n})\r\nexport class AutofocusDirective implements AfterViewInit {\r\n\t@Input('autofocus') autofocus = false;\r\n\r\n\tconstructor(private el: ElementRef) {\r\n\t}\r\n\r\n\tngAfterViewInit() {\r\n\t\tif (this.autofocus) {\r\n\t\t\tthis.el.nativeElement.focus();\r\n\t\t}\r\n\t}\r\n}\r\n","import { AfterViewInit, Directive, ElementRef, Input } from '@angular/core';\r\n\r\n/**\r\n * Scroll to element attached. And the element may be an Angular Material component too.\r\n */\r\n@Directive({\r\n selector: '[scrollInto]',\r\n standalone: true\r\n})\r\nexport class ScrollIntoDirective implements AfterViewInit {\r\n\tconstructor(private el: ElementRef) {\r\n\t\t//\tconsole.debug('ScrollIntoDirective created.');\r\n\t}\r\n\r\n\t@Input()\r\n\tscrollInto: boolean = false;\r\n\r\n\tngAfterViewInit() {\r\n\t\tif (this.scrollInto) {\r\n\t\t\tthis.el.nativeElement.scrollIntoView();\r\n\t\t}\r\n\t}\r\n}\r\n","/*\r\n * Public API Surface of nmce-directives\r\n */\r\n/// <reference types=\"@angular/localize\" />\r\n\r\nexport * from './_directives/autofocus';\r\nexport * from './_directives/scrollInto.directive';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAEA;;;;AAIG;MAKU,kBAAkB,CAAA;AAGV,IAAA,EAAA;IAFA,SAAS,GAAG,KAAK;AAErC,IAAA,WAAA,CAAoB,EAAc,EAAA;QAAd,IAAA,CAAA,EAAE,GAAF,EAAE;IACtB;IAEA,eAAe,GAAA;AACd,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;AACnB,YAAA,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE;QAC9B;IACD;wGAVY,kBAAkB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAlB,kBAAkB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,WAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAlB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAJ9B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,QAAQ,EAAE,aAAa;AACvB,oBAAA,UAAU,EAAE;AACZ,iBAAA;;sBAEC,KAAK;uBAAC,WAAW;;;ACVnB;;AAEG;MAKU,mBAAmB,CAAA;AACX,IAAA,EAAA;AAApB,IAAA,WAAA,CAAoB,EAAc,EAAA;QAAd,IAAA,CAAA,EAAE,GAAF,EAAE;;IAEtB;IAGA,UAAU,GAAY,KAAK;IAE3B,eAAe,GAAA;AACd,QAAA,IAAI,IAAI,CAAC,UAAU,EAAE;AACpB,YAAA,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE;QACvC;IACD;wGAZY,mBAAmB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAnB,mBAAmB,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,EAAA,UAAA,EAAA,YAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAJ/B,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,cAAc;AACxB,oBAAA,UAAU,EAAE;AACf,iBAAA;;sBAMC;;;ACdF;;AAEG;AACH;;ACHA;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,33 +1,18 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { AfterViewInit,
|
|
3
|
-
import * as i4 from '@angular/common';
|
|
4
|
-
import * as i5 from '@angular/forms';
|
|
2
|
+
import { AfterViewInit, ElementRef } from '@angular/core';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Use as a parameterized input parameter in html element.
|
|
8
6
|
* When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig,
|
|
9
|
-
* if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a
|
|
7
|
+
* if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a material dialog.
|
|
10
8
|
*/
|
|
11
|
-
declare class AutofocusDirective implements AfterViewInit
|
|
9
|
+
declare class AutofocusDirective implements AfterViewInit {
|
|
12
10
|
private el;
|
|
13
|
-
|
|
14
|
-
private focused;
|
|
15
|
-
private initialized;
|
|
16
|
-
private everFocused;
|
|
11
|
+
autofocus: boolean;
|
|
17
12
|
constructor(el: ElementRef);
|
|
18
13
|
ngAfterViewInit(): void;
|
|
19
|
-
ngDoCheck(): void;
|
|
20
|
-
get autofocus(): boolean;
|
|
21
|
-
set autofocus(condition: boolean);
|
|
22
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<AutofocusDirective, never>;
|
|
23
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<AutofocusDirective, "[autofocus]", never, { "autofocus": { "alias": "autofocus"; "required": false; }; }, {}, never, never,
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
declare class DataComponentDirective {
|
|
27
|
-
viewContainerRef: ViewContainerRef;
|
|
28
|
-
constructor(viewContainerRef: ViewContainerRef);
|
|
29
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DataComponentDirective, never>;
|
|
30
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<DataComponentDirective, "[dataComponentHost]", never, {}, {}, never, never, false, never>;
|
|
15
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AutofocusDirective, "[autofocus]", never, { "autofocus": { "alias": "autofocus"; "required": false; }; }, {}, never, never, true, never>;
|
|
31
16
|
}
|
|
32
17
|
|
|
33
18
|
/**
|
|
@@ -39,17 +24,7 @@ declare class ScrollIntoDirective implements AfterViewInit {
|
|
|
39
24
|
scrollInto: boolean;
|
|
40
25
|
ngAfterViewInit(): void;
|
|
41
26
|
static ɵfac: i0.ɵɵFactoryDeclaration<ScrollIntoDirective, never>;
|
|
42
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<ScrollIntoDirective, "[scrollInto]", never, { "scrollInto": { "alias": "scrollInto"; "required": false; }; }, {}, never, never,
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Contain components. Other feature/lazy modules that need to access custom html element of components like my-datetimepicker still need to import this module explicitly.
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
declare class NmceDirectivesModule {
|
|
50
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NmceDirectivesModule, never>;
|
|
51
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<NmceDirectivesModule, [typeof AutofocusDirective, typeof ScrollIntoDirective, typeof DataComponentDirective], [typeof i4.CommonModule, typeof i5.FormsModule], [typeof AutofocusDirective, typeof ScrollIntoDirective, typeof DataComponentDirective]>;
|
|
52
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<NmceDirectivesModule>;
|
|
27
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ScrollIntoDirective, "[scrollInto]", never, { "scrollInto": { "alias": "scrollInto"; "required": false; }; }, {}, never, never, true, never>;
|
|
53
28
|
}
|
|
54
29
|
|
|
55
|
-
export { AutofocusDirective,
|
|
30
|
+
export { AutofocusDirective, ScrollIntoDirective };
|