nmce-directives 1.1.0 → 1.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.
@@ -4,167 +4,172 @@ import { CurrencyFunc } from 'nmce-func';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import { FormsModule } from '@angular/forms';
6
6
 
7
- /**
8
- * Use as a parametered input parameter in html element.
9
- * When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig,
10
- * if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a mateiral dialog.
11
- */
12
- class AutofocusDirective {
13
- constructor(el) {
14
- this.el = el;
15
- this.toFocus = false;
16
- this.focused = false;
17
- this.initialised = false;
18
- this.everFocused = false;
19
- //console.debug('autofocusDirective created.');
20
- }
21
- ngAfterViewInit() {
22
- this.initialised = true;
23
- this.ngDoCheck();
24
- }
25
- ngDoCheck() {
26
- if (!this.initialised) {
27
- return;
28
- }
29
- if (this.toFocus && !this.everFocused && !this.focused) {
30
- this.el.nativeElement.focus();
31
- this.focused = true;
32
- this.everFocused = true;
33
- console.debug('focused now.');
34
- }
35
- }
36
- set autofocus(condition) {
37
- this.toFocus = condition !== false;
38
- }
39
- }
40
- AutofocusDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
41
- AutofocusDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: AutofocusDirective, selector: "[autofocus]", inputs: { autofocus: "autofocus" }, ngImport: i0 });
42
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AutofocusDirective, decorators: [{
43
- type: Directive,
44
- args: [{
45
- selector: '[autofocus]'
46
- }]
47
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { autofocus: [{
48
- type: Input
7
+ /**
8
+ * Use as a parametered input parameter in html element.
9
+ * When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig,
10
+ * if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a mateiral dialog.
11
+ */
12
+ class AutofocusDirective {
13
+ el;
14
+ toFocus = false;
15
+ focused = false;
16
+ initialised = false;
17
+ everFocused = false;
18
+ constructor(el) {
19
+ this.el = el;
20
+ //console.debug('autofocusDirective created.');
21
+ }
22
+ ngAfterViewInit() {
23
+ this.initialised = true;
24
+ this.ngDoCheck();
25
+ }
26
+ ngDoCheck() {
27
+ if (!this.initialised) {
28
+ return;
29
+ }
30
+ if (this.toFocus && !this.everFocused && !this.focused) {
31
+ this.el.nativeElement.focus();
32
+ this.focused = true;
33
+ this.everFocused = true;
34
+ console.debug('focused now.');
35
+ }
36
+ }
37
+ set autofocus(condition) {
38
+ this.toFocus = condition !== false;
39
+ }
40
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
41
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.3", type: AutofocusDirective, selector: "[autofocus]", inputs: { autofocus: "autofocus" }, ngImport: i0 });
42
+ }
43
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: AutofocusDirective, decorators: [{
44
+ type: Directive,
45
+ args: [{
46
+ selector: '[autofocus]'
47
+ }]
48
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { autofocus: [{
49
+ type: Input
49
50
  }] } });
50
51
 
51
- /**
52
- * Decorate HTML input for inputing and displaying currency. The input type must not be number and should be text only.
53
- * If the input type is number, the built-in validator will be fighting against this directive.
54
- */
55
- class CurrencyFormatterDirective {
56
- constructor(elementRef) {
57
- this.elementRef = elementRef;
58
- this.el = this.elementRef.nativeElement;
59
- }
60
- ngOnInit() {
61
- this.el.value = CurrencyFunc.transformCurrency(this.el.value);
62
- }
63
- onFocus(value) {
64
- this.el.value = CurrencyFunc.parseCurrency(value); // opossite of transform
65
- }
66
- onBlur(value) {
67
- this.el.value = CurrencyFunc.transformCurrency(value);
68
- }
69
- }
70
- CurrencyFormatterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CurrencyFormatterDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
71
- CurrencyFormatterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: CurrencyFormatterDirective, selector: "[currencyFormatter]", host: { listeners: { "focus": "onFocus($event.target.value)", "blur": "onBlur($event.target.value)" } }, ngImport: i0 });
72
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CurrencyFormatterDirective, decorators: [{
73
- type: Directive,
74
- args: [{ selector: '[currencyFormatter]' }]
75
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onFocus: [{
76
- type: HostListener,
77
- args: ['focus', ['$event.target.value']]
78
- }], onBlur: [{
79
- type: HostListener,
80
- args: ['blur', ['$event.target.value']]
52
+ /**
53
+ * Decorate HTML input for inputing and displaying currency. The input type must not be number and should be text only.
54
+ * If the input type is number, the built-in validator will be fighting against this directive.
55
+ */
56
+ class CurrencyFormatterDirective {
57
+ elementRef;
58
+ el;
59
+ constructor(elementRef) {
60
+ this.elementRef = elementRef;
61
+ this.el = this.elementRef.nativeElement;
62
+ }
63
+ ngOnInit() {
64
+ this.el.value = CurrencyFunc.transformCurrency(this.el.value);
65
+ }
66
+ onFocus(value) {
67
+ this.el.value = CurrencyFunc.parseCurrency(value); // opossite of transform
68
+ }
69
+ onBlur(value) {
70
+ this.el.value = CurrencyFunc.transformCurrency(value);
71
+ }
72
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CurrencyFormatterDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
73
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.3", type: CurrencyFormatterDirective, selector: "[currencyFormatter]", host: { listeners: { "focus": "onFocus($event.target.value)", "blur": "onBlur($event.target.value)" } }, ngImport: i0 });
74
+ }
75
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: CurrencyFormatterDirective, decorators: [{
76
+ type: Directive,
77
+ args: [{ selector: '[currencyFormatter]' }]
78
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onFocus: [{
79
+ type: HostListener,
80
+ args: ['focus', ['$event.target.value']]
81
+ }], onBlur: [{
82
+ type: HostListener,
83
+ args: ['blur', ['$event.target.value']]
81
84
  }] } });
82
85
 
83
- class DataComponentDirective {
84
- constructor(viewContainerRef) {
85
- this.viewContainerRef = viewContainerRef;
86
- }
87
- }
88
- DataComponentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DataComponentDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
89
- DataComponentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: DataComponentDirective, selector: "[dataComponentHost]", ngImport: i0 });
90
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DataComponentDirective, decorators: [{
91
- type: Directive,
92
- args: [{
93
- selector: '[dataComponentHost]',
94
- }]
86
+ class DataComponentDirective {
87
+ viewContainerRef;
88
+ constructor(viewContainerRef) {
89
+ this.viewContainerRef = viewContainerRef;
90
+ }
91
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: DataComponentDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
92
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.3", type: DataComponentDirective, selector: "[dataComponentHost]", ngImport: i0 });
93
+ }
94
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: DataComponentDirective, decorators: [{
95
+ type: Directive,
96
+ args: [{
97
+ selector: '[dataComponentHost]',
98
+ }]
95
99
  }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
96
100
 
97
- /**
98
- * Scroll to element attached. And the element may be an Angular Material component too.
99
- */
100
- class ScrollIntoDirective {
101
- constructor(el) {
102
- this.el = el;
103
- this.scrollInto = false;
104
- // console.debug('ScrollIntoDirective created.');
105
- }
106
- ngAfterViewInit() {
107
- if (this.scrollInto) {
108
- this.el.nativeElement.scrollIntoView();
109
- }
110
- }
111
- }
112
- ScrollIntoDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ScrollIntoDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
113
- ScrollIntoDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: ScrollIntoDirective, selector: "[scrollInto]", inputs: { scrollInto: "scrollInto" }, ngImport: i0 });
114
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ScrollIntoDirective, decorators: [{
115
- type: Directive,
116
- args: [{
117
- selector: '[scrollInto]'
118
- }]
119
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { scrollInto: [{
120
- type: Input
101
+ /**
102
+ * Scroll to element attached. And the element may be an Angular Material component too.
103
+ */
104
+ class ScrollIntoDirective {
105
+ el;
106
+ constructor(el) {
107
+ this.el = el;
108
+ // console.debug('ScrollIntoDirective created.');
109
+ }
110
+ scrollInto = false;
111
+ ngAfterViewInit() {
112
+ if (this.scrollInto) {
113
+ this.el.nativeElement.scrollIntoView();
114
+ }
115
+ }
116
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ScrollIntoDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
117
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.3", type: ScrollIntoDirective, selector: "[scrollInto]", inputs: { scrollInto: "scrollInto" }, ngImport: i0 });
118
+ }
119
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ScrollIntoDirective, decorators: [{
120
+ type: Directive,
121
+ args: [{
122
+ selector: '[scrollInto]'
123
+ }]
124
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { scrollInto: [{
125
+ type: Input
121
126
  }] } });
122
127
 
123
- /**
124
- * 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.
125
- *
126
- */
127
- class NmceDirectivesModule {
128
- }
129
- NmceDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NmceDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
130
- NmceDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: NmceDirectivesModule, declarations: [AutofocusDirective,
131
- CurrencyFormatterDirective,
132
- ScrollIntoDirective,
133
- DataComponentDirective], imports: [CommonModule,
134
- FormsModule], exports: [AutofocusDirective,
135
- CurrencyFormatterDirective,
136
- ScrollIntoDirective,
137
- DataComponentDirective] });
138
- NmceDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NmceDirectivesModule, imports: [CommonModule,
139
- FormsModule] });
140
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NmceDirectivesModule, decorators: [{
141
- type: NgModule,
142
- args: [{
143
- imports: [
144
- CommonModule,
145
- FormsModule,
146
- ],
147
- declarations: [
148
- AutofocusDirective,
149
- CurrencyFormatterDirective,
150
- ScrollIntoDirective,
151
- DataComponentDirective,
152
- ],
153
- exports: [
154
- AutofocusDirective,
155
- CurrencyFormatterDirective,
156
- ScrollIntoDirective,
157
- DataComponentDirective,
158
- ]
159
- }]
128
+ /**
129
+ * 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.
130
+ *
131
+ */
132
+ class NmceDirectivesModule {
133
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: NmceDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
134
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.1.3", ngImport: i0, type: NmceDirectivesModule, declarations: [AutofocusDirective,
135
+ CurrencyFormatterDirective,
136
+ ScrollIntoDirective,
137
+ DataComponentDirective], imports: [CommonModule,
138
+ FormsModule], exports: [AutofocusDirective,
139
+ CurrencyFormatterDirective,
140
+ ScrollIntoDirective,
141
+ DataComponentDirective] });
142
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: NmceDirectivesModule, imports: [CommonModule,
143
+ FormsModule] });
144
+ }
145
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: NmceDirectivesModule, decorators: [{
146
+ type: NgModule,
147
+ args: [{
148
+ imports: [
149
+ CommonModule,
150
+ FormsModule,
151
+ ],
152
+ declarations: [
153
+ AutofocusDirective,
154
+ CurrencyFormatterDirective,
155
+ ScrollIntoDirective,
156
+ DataComponentDirective,
157
+ ],
158
+ exports: [
159
+ AutofocusDirective,
160
+ CurrencyFormatterDirective,
161
+ ScrollIntoDirective,
162
+ DataComponentDirective,
163
+ ]
164
+ }]
160
165
  }] });
161
166
 
162
- /*
163
- * Public API Surface of nmce-directives
167
+ /*
168
+ * Public API Surface of nmce-directives
164
169
  */
165
170
 
166
- /**
167
- * Generated bundle index. Do not edit.
171
+ /**
172
+ * Generated bundle index. Do not edit.
168
173
  */
169
174
 
170
175
  export { AutofocusDirective, CurrencyFormatterDirective, DataComponentDirective, NmceDirectivesModule, ScrollIntoDirective };
@@ -1 +1 @@
1
- {"version":3,"file":"nmce-directives.mjs","sources":["../../../projects/nmce-directives/src/_directives/autofocus.ts","../../../projects/nmce-directives/src/_directives/currencyFormatter.directive.ts","../../../projects/nmce-directives/src/_directives/dataComponent.directive.ts","../../../projects/nmce-directives/src/_directives/scrollInto.directive.ts","../../../projects/nmce-directives/src/_directives/directives.module.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 parametered 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\tselector: '[autofocus]'\r\n})\r\nexport class AutofocusDirective implements AfterViewInit, DoCheck {\r\n\tprivate toFocus = false;\r\n\tprivate focused = false;\r\n\tprivate initialised = 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.initialised = true;\r\n\t\tthis.ngDoCheck();\r\n\t}\r\n\r\n\tngDoCheck() {\r\n\t\tif (!this.initialised) { 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() set autofocus(condition: boolean) {\r\n\t\tthis.toFocus = condition !== false;\r\n\t}\r\n}\r\n","import { Directive, ElementRef, HostListener, OnInit } from '@angular/core';\r\nimport { CurrencyFunc } from 'nmce-func';\r\n\r\n/**\r\n * Decorate HTML input for inputing and displaying currency. The input type must not be number and should be text only.\r\n * If the input type is number, the built-in validator will be fighting against this directive.\r\n */\r\n@Directive({ selector: '[currencyFormatter]' })//inspired by https://blog.ngconsultant.io/custom-input-formatting-with-simple-directives-for-angular-2-ec792082976\r\nexport class CurrencyFormatterDirective implements OnInit {\r\n\r\n\tprivate el: HTMLInputElement;\r\n\r\n\tconstructor(private elementRef: ElementRef) {\r\n\t\tthis.el = this.elementRef.nativeElement;\r\n\t}\r\n\r\n\tngOnInit() {\r\n\t\tthis.el.value = CurrencyFunc.transformCurrency(this.el.value);\r\n\t}\r\n\r\n\t@HostListener('focus', ['$event.target.value'])\r\n\tonFocus(value: string) {\r\n\t\tthis.el.value = CurrencyFunc.parseCurrency(value); // opossite of transform\r\n\t}\r\n\r\n\t@HostListener('blur', ['$event.target.value'])\r\n\tonBlur(value: string) {\r\n\t\tthis.el.value = CurrencyFunc.transformCurrency(value);\r\n\t}\r\n\r\n}\r\n\r\n","import { Directive, ViewContainerRef } from '@angular/core';\r\n\r\n@Directive({\r\n\tselector: '[dataComponentHost]',\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\tselector: '[scrollInto]'\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","import { CommonModule } from '@angular/common';\r\nimport { NgModule } from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport {\r\n\tAutofocusDirective, CurrencyFormatterDirective, DataComponentDirective, ScrollIntoDirective\r\n} from './index';\r\n\r\n\r\n\r\n/**\r\n * 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.\r\n *\r\n */\r\n@NgModule({\r\n\timports: [\r\n\t\tCommonModule,\r\n\t\tFormsModule,\r\n\t],\r\n\r\n\tdeclarations: [\r\n\t\tAutofocusDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tScrollIntoDirective,\r\n\t\tDataComponentDirective,\r\n\t],\r\n\r\n\r\n\texports: [\r\n\t\tAutofocusDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tScrollIntoDirective,\r\n\t\tDataComponentDirective,\r\n\t]\r\n})\r\nexport class NmceDirectivesModule { }\r\n","/*\n * Public API Surface of nmce-directives\n */\n\nexport * from './_directives/index';\nexport * from './_directives/directives.module';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAEA;;;;AAIG;MAIU,kBAAkB,CAAA;AAK9B,IAAA,WAAA,CAAoB,EAAc,EAAA;QAAd,IAAE,CAAA,EAAA,GAAF,EAAE,CAAY;QAJ1B,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;QAChB,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;QAChB,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;QACpB,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;KAG3B;IAED,eAAe,GAAA;AACd,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,SAAS,EAAE,CAAC;KACjB;IAED,SAAS,GAAA;AACR,QAAA,IAAI,CAAC,IAAI,CA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A,EAAA,oBAAoB,iBAd/B,kBAAkB;QAClB,0BAA0B;QAC1B,mBAAmB;AACnB,QAAA,sBAAsB,aARtB,YAAY;AACZ,QAAA,WAAW,aAYX,kBAAkB;QAClB,0BAA0B;QAC1B,mBAAmB;QACnB,sBAAsB,CAAA,EAAA,CAAA,CAAA;AAGX,oBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,YAnB/B,YAAY;QACZ,WAAW,CAAA,EAAA,CAAA,CAAA;2FAkBA,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBArBhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,OAAO,EAAE;wBACR,YAAY;wBACZ,WAAW;AACX,qBAAA;AAED,oBAAA,YAAY,EAAE;wBACb,kBAAkB;wBAClB,0BAA0B;wBAC1B,mBAAmB;wBACnB,sBAAsB;AACtB,qBAAA;AAGD,oBAAA,OAAO,EAAE;wBACR,kBAAkB;wBAClB,0BAA0B;wBAC1B,mBAAmB;wBACnB,sBAAsB;AACtB,qBAAA;AACD,iBAAA,CAAA;;;ACjCD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"nmce-directives.mjs","sources":["../../../projects/nmce-directives/src/_directives/autofocus.ts","../../../projects/nmce-directives/src/_directives/currencyFormatter.directive.ts","../../../projects/nmce-directives/src/_directives/dataComponent.directive.ts","../../../projects/nmce-directives/src/_directives/scrollInto.directive.ts","../../../projects/nmce-directives/src/_directives/directives.module.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 parametered 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\tselector: '[autofocus]'\r\n})\r\nexport class AutofocusDirective implements AfterViewInit, DoCheck {\r\n\tprivate toFocus = false;\r\n\tprivate focused = false;\r\n\tprivate initialised = 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.initialised = true;\r\n\t\tthis.ngDoCheck();\r\n\t}\r\n\r\n\tngDoCheck() {\r\n\t\tif (!this.initialised) { 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() set autofocus(condition: boolean) {\r\n\t\tthis.toFocus = condition !== false;\r\n\t}\r\n}\r\n","import { Directive, ElementRef, HostListener, OnInit } from '@angular/core';\r\nimport { CurrencyFunc } from 'nmce-func';\r\n\r\n/**\r\n * Decorate HTML input for inputing and displaying currency. The input type must not be number and should be text only.\r\n * If the input type is number, the built-in validator will be fighting against this directive.\r\n */\r\n@Directive({ selector: '[currencyFormatter]' })//inspired by https://blog.ngconsultant.io/custom-input-formatting-with-simple-directives-for-angular-2-ec792082976\r\nexport class CurrencyFormatterDirective implements OnInit {\r\n\r\n\tprivate el: HTMLInputElement;\r\n\r\n\tconstructor(private elementRef: ElementRef) {\r\n\t\tthis.el = this.elementRef.nativeElement;\r\n\t}\r\n\r\n\tngOnInit() {\r\n\t\tthis.el.value = CurrencyFunc.transformCurrency(this.el.value);\r\n\t}\r\n\r\n\t@HostListener('focus', ['$event.target.value'])\r\n\tonFocus(value: string) {\r\n\t\tthis.el.value = CurrencyFunc.parseCurrency(value); // opossite of transform\r\n\t}\r\n\r\n\t@HostListener('blur', ['$event.target.value'])\r\n\tonBlur(value: string) {\r\n\t\tthis.el.value = CurrencyFunc.transformCurrency(value);\r\n\t}\r\n\r\n}\r\n\r\n","import { Directive, ViewContainerRef } from '@angular/core';\r\n\r\n@Directive({\r\n\tselector: '[dataComponentHost]',\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\tselector: '[scrollInto]'\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","import { CommonModule } from '@angular/common';\r\nimport { NgModule } from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport {\r\n\tAutofocusDirective, CurrencyFormatterDirective, DataComponentDirective, ScrollIntoDirective\r\n} from './index';\r\n\r\n\r\n\r\n/**\r\n * 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.\r\n *\r\n */\r\n@NgModule({\r\n\timports: [\r\n\t\tCommonModule,\r\n\t\tFormsModule,\r\n\t],\r\n\r\n\tdeclarations: [\r\n\t\tAutofocusDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tScrollIntoDirective,\r\n\t\tDataComponentDirective,\r\n\t],\r\n\r\n\r\n\texports: [\r\n\t\tAutofocusDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tScrollIntoDirective,\r\n\t\tDataComponentDirective,\r\n\t]\r\n})\r\nexport class NmceDirectivesModule { }\r\n","/*\r\n * Public API Surface of nmce-directives\r\n */\r\n\r\nexport * from './_directives/index';\r\nexport * from './_directives/directives.module';\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAEA;;;;AAIG;MAIU,kBAAkB,CAAA;AAKV,IAAA,EAAA,CAAA;IAJZ,OAAO,GAAG,KAAK,CAAC;IAChB,OAAO,GAAG,KAAK,CAAC;IAChB,WAAW,GAAG,KAAK,CAAC;IACpB,WAAW,GAAG,KAAK,CAAC;AAC5B,IAAA,WAAA,CAAoB,EAAc,EAAA;QAAd,IAAE,CAAA,EAAA,GAAF,EAAE,CAAY;;KAEjC;IAED,eAAe,GAAA;AACd,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,SAAS,EAAE,CAAC;KACjB;IAED,SAAS,GAAA;AACR,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YAAE,OAAO;AAAE,SAAA;AAClC,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,CAAC;AAC9B,YAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;AACpB,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;AACxB,YAAA,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;AAC9B,SAAA;KACD;IAED,IAAa,SAAS,CAAC,SAAkB,EAAA;AACxC,QAAA,IAAI,CAAC,OAAO,GAAG,SAAS,KAAK,KAAK,CAAC;KACnC;uGA1BW,kBAAkB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,UAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;2FAAlB,kBAAkB,EAAA,QAAA,EAAA,aAAA,EAAA,MAAA,EAAA,EAAA,SAAA,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;wBACnB,sBAAsB;AACtB,qBAAA;AAGD,oBAAA,OAAO,EAAE;wBACR,kBAAkB;wBAClB,0BAA0B;wBAC1B,mBAAmB;wBACnB,sBAAsB;AACtB,qBAAA;AACD,iBAAA,CAAA;;;ACjCD;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="nmce-directives" />
5
- export * from './public-api';
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="nmce-directives" />
5
+ export * from './public-api';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nmce-directives",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "author": {
5
5
  "name": "Z"
6
6
  },
@@ -9,15 +9,7 @@
9
9
  "repository": {
10
10
  "url": "https://github.com/zijianhuang/nmce"
11
11
  },
12
- "peerDependencies": {
13
- "@angular/common": "^15.0.1",
14
- "@angular/core": "^15.0.1"
15
- },
16
- "module": "fesm2015/nmce-directives.mjs",
17
- "es2020": "fesm2020/nmce-directives.mjs",
18
- "esm2020": "esm2020/nmce-directives.mjs",
19
- "fesm2020": "fesm2020/nmce-directives.mjs",
20
- "fesm2015": "fesm2015/nmce-directives.mjs",
12
+ "module": "fesm2022/nmce-directives.mjs",
21
13
  "typings": "index.d.ts",
22
14
  "exports": {
23
15
  "./package.json": {
@@ -25,11 +17,9 @@
25
17
  },
26
18
  ".": {
27
19
  "types": "./index.d.ts",
28
- "esm2020": "./esm2020/nmce-directives.mjs",
29
- "es2020": "./fesm2020/nmce-directives.mjs",
30
- "es2015": "./fesm2015/nmce-directives.mjs",
31
- "node": "./fesm2015/nmce-directives.mjs",
32
- "default": "./fesm2020/nmce-directives.mjs"
20
+ "esm2022": "./esm2022/nmce-directives.mjs",
21
+ "esm": "./esm2022/nmce-directives.mjs",
22
+ "default": "./fesm2022/nmce-directives.mjs"
33
23
  }
34
24
  },
35
25
  "sideEffects": false,
package/public-api.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './_directives/index';
2
- export * from './_directives/directives.module';
1
+ export * from './_directives/index';
2
+ export * from './_directives/directives.module';
@@ -1,46 +0,0 @@
1
- import { Directive, Input } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * Use as a parametered input parameter in html element.
5
- * When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig,
6
- * if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a mateiral dialog.
7
- */
8
- export class AutofocusDirective {
9
- constructor(el) {
10
- this.el = el;
11
- this.toFocus = false;
12
- this.focused = false;
13
- this.initialised = false;
14
- this.everFocused = false;
15
- //console.debug('autofocusDirective created.');
16
- }
17
- ngAfterViewInit() {
18
- this.initialised = true;
19
- this.ngDoCheck();
20
- }
21
- ngDoCheck() {
22
- if (!this.initialised) {
23
- return;
24
- }
25
- if (this.toFocus && !this.everFocused && !this.focused) {
26
- this.el.nativeElement.focus();
27
- this.focused = true;
28
- this.everFocused = true;
29
- console.debug('focused now.');
30
- }
31
- }
32
- set autofocus(condition) {
33
- this.toFocus = condition !== false;
34
- }
35
- }
36
- AutofocusDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
37
- AutofocusDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: AutofocusDirective, selector: "[autofocus]", inputs: { autofocus: "autofocus" }, ngImport: i0 });
38
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AutofocusDirective, decorators: [{
39
- type: Directive,
40
- args: [{
41
- selector: '[autofocus]'
42
- }]
43
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { autofocus: [{
44
- type: Input
45
- }] } });
46
-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- import { CurrencyFunc } from 'nmce-func';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * Decorate HTML input for inputing and displaying currency. The input type must not be number and should be text only.
6
- * If the input type is number, the built-in validator will be fighting against this directive.
7
- */
8
- export class CurrencyFormatterDirective {
9
- constructor(elementRef) {
10
- this.elementRef = elementRef;
11
- this.el = this.elementRef.nativeElement;
12
- }
13
- ngOnInit() {
14
- this.el.value = CurrencyFunc.transformCurrency(this.el.value);
15
- }
16
- onFocus(value) {
17
- this.el.value = CurrencyFunc.parseCurrency(value); // opossite of transform
18
- }
19
- onBlur(value) {
20
- this.el.value = CurrencyFunc.transformCurrency(value);
21
- }
22
- }
23
- CurrencyFormatterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CurrencyFormatterDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
24
- CurrencyFormatterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: CurrencyFormatterDirective, selector: "[currencyFormatter]", host: { listeners: { "focus": "onFocus($event.target.value)", "blur": "onBlur($event.target.value)" } }, ngImport: i0 });
25
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CurrencyFormatterDirective, decorators: [{
26
- type: Directive,
27
- args: [{ selector: '[currencyFormatter]' }]
28
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onFocus: [{
29
- type: HostListener,
30
- args: ['focus', ['$event.target.value']]
31
- }], onBlur: [{
32
- type: HostListener,
33
- args: ['blur', ['$event.target.value']]
34
- }] } });
35
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVuY3lGb3JtYXR0ZXIuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbm1jZS1kaXJlY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lbWVudFJlZi5uYXRpdmVFbGVtZW50O1xyXG5cdH1cclxuXHJcblx0bmdPbkluaXQoKSB7XHJcblx0XHR0aGlzLmVsLnZhbHVlID0gQ3VycmVuY3lGdW5jLnRyYW5zZm9ybUN1cnJlbmN5KHRoaXMuZWwudmFsdWUpO1xyXG5cdH1cclxuXHJcblx0QEhvc3RMaXN0ZW5lcignZm9jdXMnLCBbJyRldmVudC50YXJnZXQudmFsdWUnXSlcclxuXHRvbkZvY3VzKHZhbHVlOiBzdHJpbmcpIHtcclxuXHRcdHRoaXMuZWwudmFsdWUgPSBDdXJyZW5jeUZ1bmMucGFyc2VDdXJyZW5jeSh2YWx1ZSk7IC8vIG9wb3NzaXRlIG9mIHRyYW5zZm9ybVxyXG5cdH1cclxuXHJcblx0QEhvc3RMaXN0ZW5lcignYmx1cicsIFsnJGV2ZW50LnRhcmdldC52YWx1ZSddKVxyXG5cdG9uQmx1cih2YWx1ZTogc3RyaW5nKSB7XHJcblx0XHR0aGlzLmVsLnZhbHVlID0gQ3VycmVuY3lGdW5jLnRyYW5zZm9ybUN1cnJlbmN5KHZhbHVlKTtcclxuXHR9XHJcblxyXG59XHJcblxyXG4iXX0=
@@ -1,16 +0,0 @@
1
- import { Directive } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- export class DataComponentDirective {
4
- constructor(viewContainerRef) {
5
- this.viewContainerRef = viewContainerRef;
6
- }
7
- }
8
- DataComponentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DataComponentDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
9
- DataComponentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: DataComponentDirective, selector: "[dataComponentHost]", ngImport: i0 });
10
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DataComponentDirective, decorators: [{
11
- type: Directive,
12
- args: [{
13
- selector: '[dataComponentHost]',
14
- }]
15
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
16
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0YUNvbXBvbmVudC5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9ubWNlLWRpcmVjdGl2ZXMvc3JjL19kaXJlY3RpdmVzL2RhdGFDb21wb25lbnQuZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQW9CLE1BQU0sZUFBZSxDQUFDOztBQUs1RCxNQUFNLE9BQU8sc0JBQXNCO0lBQ2xDLFlBQW1CLGdCQUFrQztRQUFsQyxxQkFBZ0IsR0FBaEIsZ0JBQWdCLENBQWtCO0lBQUksQ0FBQzs7bUhBRDlDLHNCQUFzQjt1R0FBdEIsc0JBQXNCOzJGQUF0QixzQkFBc0I7a0JBSGxDLFNBQVM7bUJBQUM7b0JBQ1YsUUFBUSxFQUFFLHFCQUFxQjtpQkFDL0IiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEaXJlY3RpdmUsIFZpZXdDb250YWluZXJSZWYgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcclxuXHJcbkBEaXJlY3RpdmUoe1xyXG5cdHNlbGVjdG9yOiAnW2RhdGFDb21wb25lbnRIb3N0XScsXHJcbn0pXHJcbmV4cG9ydCBjbGFzcyBEYXRhQ29tcG9uZW50RGlyZWN0aXZlIHtcclxuXHRjb25zdHJ1Y3RvcihwdWJsaWMgdmlld0NvbnRhaW5lclJlZjogVmlld0NvbnRhaW5lclJlZikgeyB9XHJcbn1cclxuIl19
@@ -1,28 +0,0 @@
1
- import { Directive, Input } from '@angular/core';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * Scroll to element attached. And the element may be an Angular Material component too.
5
- */
6
- export class ScrollIntoDirective {
7
- constructor(el) {
8
- this.el = el;
9
- this.scrollInto = false;
10
- // console.debug('ScrollIntoDirective created.');
11
- }
12
- ngAfterViewInit() {
13
- if (this.scrollInto) {
14
- this.el.nativeElement.scrollIntoView();
15
- }
16
- }
17
- }
18
- ScrollIntoDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ScrollIntoDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
19
- ScrollIntoDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: ScrollIntoDirective, selector: "[scrollInto]", inputs: { scrollInto: "scrollInto" }, ngImport: i0 });
20
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ScrollIntoDirective, decorators: [{
21
- type: Directive,
22
- args: [{
23
- selector: '[scrollInto]'
24
- }]
25
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { scrollInto: [{
26
- type: Input
27
- }] } });
28
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsSW50by5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9ubWNlLWRpcmVjdGl2ZXMvc3JjL19kaXJlY3RpdmVzL3Njcm9sbEludG8uZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBaUIsU0FBUyxFQUFjLEtBQUssRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFFNUU7O0dBRUc7QUFJSCxNQUFNLE9BQU8sbUJBQW1CO0lBQy9CLFlBQW9CLEVBQWM7UUFBZCxPQUFFLEdBQUYsRUFBRSxDQUFZO1FBS2xDLGVBQVUsR0FBWSxLQUFLLENBQUM7U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GlzLmVsLm5hdGl2ZUVsZW1lbnQuc2Nyb2xsSW50b1ZpZXcoKTtcclxuXHRcdH1cclxuXHR9XHJcbn1cclxuIl19
@@ -1 +0,0 @@
1
- {"version":3,"file":"nmce-directives.mjs","sources":["../../../projects/nmce-directives/src/_directives/autofocus.ts","../../../projects/nmce-directives/src/_directives/currencyFormatter.directive.ts","../../../projects/nmce-directives/src/_directives/dataComponent.directive.ts","../../../projects/nmce-directives/src/_directives/scrollInto.directive.ts","../../../projects/nmce-directives/src/_directives/directives.module.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 parametered 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\tselector: '[autofocus]'\r\n})\r\nexport class AutofocusDirective implements AfterViewInit, DoCheck {\r\n\tprivate toFocus = false;\r\n\tprivate focused = false;\r\n\tprivate initialised = 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.initialised = true;\r\n\t\tthis.ngDoCheck();\r\n\t}\r\n\r\n\tngDoCheck() {\r\n\t\tif (!this.initialised) { 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() set autofocus(condition: boolean) {\r\n\t\tthis.toFocus = condition !== false;\r\n\t}\r\n}\r\n","import { Directive, ElementRef, HostListener, OnInit } from '@angular/core';\r\nimport { CurrencyFunc } from 'nmce-func';\r\n\r\n/**\r\n * Decorate HTML input for inputing and displaying currency. The input type must not be number and should be text only.\r\n * If the input type is number, the built-in validator will be fighting against this directive.\r\n */\r\n@Directive({ selector: '[currencyFormatter]' })//inspired by https://blog.ngconsultant.io/custom-input-formatting-with-simple-directives-for-angular-2-ec792082976\r\nexport class CurrencyFormatterDirective implements OnInit {\r\n\r\n\tprivate el: HTMLInputElement;\r\n\r\n\tconstructor(private elementRef: ElementRef) {\r\n\t\tthis.el = this.elementRef.nativeElement;\r\n\t}\r\n\r\n\tngOnInit() {\r\n\t\tthis.el.value = CurrencyFunc.transformCurrency(this.el.value);\r\n\t}\r\n\r\n\t@HostListener('focus', ['$event.target.value'])\r\n\tonFocus(value: string) {\r\n\t\tthis.el.value = CurrencyFunc.parseCurrency(value); // opossite of transform\r\n\t}\r\n\r\n\t@HostListener('blur', ['$event.target.value'])\r\n\tonBlur(value: string) {\r\n\t\tthis.el.value = CurrencyFunc.transformCurrency(value);\r\n\t}\r\n\r\n}\r\n\r\n","import { Directive, ViewContainerRef } from '@angular/core';\r\n\r\n@Directive({\r\n\tselector: '[dataComponentHost]',\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\tselector: '[scrollInto]'\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","import { CommonModule } from '@angular/common';\r\nimport { NgModule } from '@angular/core';\r\nimport { FormsModule } from '@angular/forms';\r\nimport {\r\n\tAutofocusDirective, CurrencyFormatterDirective, DataComponentDirective, ScrollIntoDirective\r\n} from './index';\r\n\r\n\r\n\r\n/**\r\n * 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.\r\n *\r\n */\r\n@NgModule({\r\n\timports: [\r\n\t\tCommonModule,\r\n\t\tFormsModule,\r\n\t],\r\n\r\n\tdeclarations: [\r\n\t\tAutofocusDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tScrollIntoDirective,\r\n\t\tDataComponentDirective,\r\n\t],\r\n\r\n\r\n\texports: [\r\n\t\tAutofocusDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tScrollIntoDirective,\r\n\t\tDataComponentDirective,\r\n\t]\r\n})\r\nexport class NmceDirectivesModule { }\r\n","/*\n * Public API Surface of nmce-directives\n */\n\nexport * from './_directives/index';\nexport * from './_directives/directives.module';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAEA;;;;AAIG;MAIU,kBAAkB,CAAA;AAK9B,IAAA,WAAA,CAAoB,EAAc,EAAA;AAAd,QAAA,IAAE,CAAA,EAAA,GAAF,EAAE,CAAY;AAJ1B,QAAA,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;AAChB,QAAA,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;AAChB,QAAA,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;AACpB,QAAA,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;KAG3B;IAED,eAAe,GAAA;AACd,QAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,SAAS,EAAE,CAAC;KACjB;IAED,SAAS,GAAA;AACR,QAAA,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YAAE,OAAO;AAAE,SAAA;AAClC,QAAA,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,C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