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 CHANGED
@@ -1,4 +1,7 @@
1
- # NmceDirectives
1
+ # [Nmce-Directives](https://www.npmjs.com/package/nmce-directives)
2
+
3
+ * autofocus
4
+ * scrollInto
2
5
 
3
6
  This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 11.2.5.
4
7
 
@@ -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 mateiral dialog.
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
- toFocus = false;
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.initialized = true;
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, DataComponentDirective, ScrollIntoDirective };
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/dataComponent.directive.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, DoCheck, 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 mateiral dialog.\r\n */\r\n@Directive({\r\n selector: '[autofocus]',\r\n standalone: true\r\n})\r\nexport class AutofocusDirective implements AfterViewInit, DoCheck {\r\n\tprivate toFocus = false;\r\n\tprivate focused = false;\r\n\tprivate initialized = false;\r\n\tprivate everFocused = false;\r\n\tconstructor(private el: ElementRef) {\r\n\t\t//console.debug('autofocusDirective created.');\r\n\t}\r\n\r\n\tngAfterViewInit() {\r\n\t\tthis.initialized = true;\r\n\t\tthis.ngDoCheck();\r\n\t}\r\n\r\n\tngDoCheck() {\r\n\t\tif (!this.initialized) { return; }\r\n\t\tif (this.toFocus && !this.everFocused && !this.focused) {\r\n\t\t\tthis.el.nativeElement.focus();\r\n\t\t\tthis.focused = true;\r\n\t\t\tthis.everFocused = true;\r\n\t\t\tconsole.debug('focused now.');\r\n\t\t}\r\n\t}\r\n\r\n\t@Input() \r\n\tget autofocus(){\r\n\t\treturn this.focused;\r\n\t}\r\n\tset autofocus(condition: boolean) {\r\n\t\tthis.toFocus = condition !== false;\r\n\t}\r\n}\r\n","import { Directive, ViewContainerRef } from '@angular/core';\r\n\r\n@Directive({\r\n selector: '[dataComponentHost]',\r\n standalone: true\r\n})\r\nexport class DataComponentDirective {\r\n\tconstructor(public viewContainerRef: ViewContainerRef) { }\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/dataComponent.directive';\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;AAKV,IAAA,EAAA;IAJZ,OAAO,GAAG,KAAK;IACf,OAAO,GAAG,KAAK;IACf,WAAW,GAAG,KAAK;IACnB,WAAW,GAAG,KAAK;AAC3B,IAAA,WAAA,CAAoB,EAAc,EAAA;QAAd,IAAA,CAAA,EAAE,GAAF,EAAE;;IAEtB;IAEA,eAAe,GAAA;AACd,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI;QACvB,IAAI,CAAC,SAAS,EAAE;IACjB;IAEA,SAAS,GAAA;AACR,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YAAE;QAAQ;AACjC,QAAA,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AACvD,YAAA,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE;AAC7B,YAAA,IAAI,CAAC,OAAO,GAAG,IAAI;AACnB,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI;AACvB,YAAA,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC;QAC9B;IACD;AAEA,IAAA,IACI,SAAS,GAAA;QACZ,OAAO,IAAI,CAAC,OAAO;IACpB;IACA,IAAI,SAAS,CAAC,SAAkB,EAAA;AAC/B,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Ae,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;;;;"}
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, DoCheck, ElementRef, ViewContainerRef } from '@angular/core';
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 mateiral dialog.
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, DoCheck {
9
+ declare class AutofocusDirective implements AfterViewInit {
10
10
  private el;
11
- private toFocus;
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, DataComponentDirective, ScrollIntoDirective };
30
+ export { AutofocusDirective, ScrollIntoDirective };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nmce-directives",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "author": {
5
5
  "name": "Z"
6
6
  },