nmce-directives 1.5.0 → 1.5.2
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 +6 -41
- package/fesm2022/nmce-directives.mjs.map +1 -1
- package/index.d.ts +5 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,39 +4,19 @@ import { Input, Directive } from '@angular/core';
|
|
|
4
4
|
/**
|
|
5
5
|
* Use as a parameterized input parameter in html element.
|
|
6
6
|
* When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig,
|
|
7
|
-
* 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.
|
|
8
8
|
*/
|
|
9
9
|
class AutofocusDirective {
|
|
10
10
|
el;
|
|
11
|
-
|
|
12
|
-
focused = false;
|
|
13
|
-
initialized = false;
|
|
14
|
-
everFocused = false;
|
|
11
|
+
autofocus = false;
|
|
15
12
|
constructor(el) {
|
|
16
13
|
this.el = el;
|
|
17
|
-
//console.debug('autofocusDirective created.');
|
|
18
14
|
}
|
|
19
15
|
ngAfterViewInit() {
|
|
20
|
-
this.
|
|
21
|
-
this.ngDoCheck();
|
|
22
|
-
}
|
|
23
|
-
ngDoCheck() {
|
|
24
|
-
if (!this.initialized) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (this.toFocus && !this.everFocused && !this.focused) {
|
|
16
|
+
if (this.autofocus) {
|
|
28
17
|
this.el.nativeElement.focus();
|
|
29
|
-
this.focused = true;
|
|
30
|
-
this.everFocused = true;
|
|
31
|
-
console.debug('focused now.');
|
|
32
18
|
}
|
|
33
19
|
}
|
|
34
|
-
get autofocus() {
|
|
35
|
-
return this.focused;
|
|
36
|
-
}
|
|
37
|
-
set autofocus(condition) {
|
|
38
|
-
this.toFocus = condition !== false;
|
|
39
|
-
}
|
|
40
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 });
|
|
41
21
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.10", type: AutofocusDirective, isStandalone: true, selector: "[autofocus]", inputs: { autofocus: "autofocus" }, ngImport: i0 });
|
|
42
22
|
}
|
|
@@ -47,25 +27,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
47
27
|
standalone: true
|
|
48
28
|
}]
|
|
49
29
|
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { autofocus: [{
|
|
50
|
-
type: Input
|
|
30
|
+
type: Input,
|
|
31
|
+
args: ['autofocus']
|
|
51
32
|
}] } });
|
|
52
33
|
|
|
53
|
-
class DataComponentDirective {
|
|
54
|
-
viewContainerRef;
|
|
55
|
-
constructor(viewContainerRef) {
|
|
56
|
-
this.viewContainerRef = viewContainerRef;
|
|
57
|
-
}
|
|
58
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: DataComponentDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
59
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.10", type: DataComponentDirective, isStandalone: true, selector: "[dataComponentHost]", ngImport: i0 });
|
|
60
|
-
}
|
|
61
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImport: i0, type: DataComponentDirective, decorators: [{
|
|
62
|
-
type: Directive,
|
|
63
|
-
args: [{
|
|
64
|
-
selector: '[dataComponentHost]',
|
|
65
|
-
standalone: true
|
|
66
|
-
}]
|
|
67
|
-
}], ctorParameters: () => [{ type: i0.ViewContainerRef }] });
|
|
68
|
-
|
|
69
34
|
/**
|
|
70
35
|
* Scroll to element attached. And the element may be an Angular Material component too.
|
|
71
36
|
*/
|
|
@@ -103,5 +68,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.10", ngImpo
|
|
|
103
68
|
* Generated bundle index. Do not edit.
|
|
104
69
|
*/
|
|
105
70
|
|
|
106
|
-
export { AutofocusDirective,
|
|
71
|
+
export { AutofocusDirective, ScrollIntoDirective };
|
|
107
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,20 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { AfterViewInit,
|
|
2
|
+
import { AfterViewInit, ElementRef } from '@angular/core';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Use as a parameterized input parameter in html element.
|
|
6
6
|
* When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig,
|
|
7
|
-
* 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.
|
|
8
8
|
*/
|
|
9
|
-
declare class AutofocusDirective implements AfterViewInit
|
|
9
|
+
declare class AutofocusDirective implements AfterViewInit {
|
|
10
10
|
private el;
|
|
11
|
-
|
|
12
|
-
private focused;
|
|
13
|
-
private initialized;
|
|
14
|
-
private everFocused;
|
|
11
|
+
autofocus: boolean;
|
|
15
12
|
constructor(el: ElementRef);
|
|
16
13
|
ngAfterViewInit(): void;
|
|
17
|
-
ngDoCheck(): void;
|
|
18
|
-
get autofocus(): boolean;
|
|
19
|
-
set autofocus(condition: boolean);
|
|
20
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<AutofocusDirective, never>;
|
|
21
15
|
static ɵdir: i0.ɵɵDirectiveDeclaration<AutofocusDirective, "[autofocus]", never, { "autofocus": { "alias": "autofocus"; "required": false; }; }, {}, never, never, true, never>;
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
declare class DataComponentDirective {
|
|
25
|
-
viewContainerRef: ViewContainerRef;
|
|
26
|
-
constructor(viewContainerRef: ViewContainerRef);
|
|
27
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DataComponentDirective, never>;
|
|
28
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<DataComponentDirective, "[dataComponentHost]", never, {}, {}, never, never, true, never>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
18
|
/**
|
|
32
19
|
* Scroll to element attached. And the element may be an Angular Material component too.
|
|
33
20
|
*/
|
|
@@ -40,4 +27,4 @@ declare class ScrollIntoDirective implements AfterViewInit {
|
|
|
40
27
|
static ɵdir: i0.ɵɵDirectiveDeclaration<ScrollIntoDirective, "[scrollInto]", never, { "scrollInto": { "alias": "scrollInto"; "required": false; }; }, {}, never, never, true, never>;
|
|
41
28
|
}
|
|
42
29
|
|
|
43
|
-
export { AutofocusDirective,
|
|
30
|
+
export { AutofocusDirective, ScrollIntoDirective };
|