nmce-directives 0.0.2 → 0.0.7

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,8 +1,15 @@
1
- import { AfterViewInit, ElementRef, DoCheck } from '@angular/core';
1
+ import { AfterViewInit, DoCheck, ElementRef } from '@angular/core';
2
+ /**
3
+ * Use as a parametered input parameter in html element.
4
+ * When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig,
5
+ * if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a mateiral dialog.
6
+ */
2
7
  export declare class AutofocusDirective implements AfterViewInit, DoCheck {
3
8
  private el;
4
- private lastVisible;
9
+ private toFocus;
10
+ private focused;
5
11
  private initialised;
12
+ private everFocused;
6
13
  constructor(el: ElementRef);
7
14
  ngAfterViewInit(): void;
8
15
  ngDoCheck(): void;
@@ -1,6 +1,7 @@
1
1
  import { ElementRef, OnInit } from '@angular/core';
2
2
  /**
3
- *
3
+ * Decorate HTML input for inputing and displaying currency. The input type must not be number and should be text only.
4
+ * If the input type is number, the built-in validator will be fighting against this directive.
4
5
  */
5
6
  export declare class CurrencyFormatterDirective implements OnInit {
6
7
  private elementRef;
@@ -1,6 +1,4 @@
1
1
  export * from './autofocus';
2
- export * from './highlight.directive';
3
2
  export * from './currencyFormatter.directive';
4
- export * from './datetimeFormatter.directive';
5
- export * from './scrollInto.directive';
6
3
  export * from './dataComponent.directive';
4
+ export * from './scrollInto.directive';
@@ -1,4 +1,7 @@
1
1
  import { AfterViewInit, ElementRef } from '@angular/core';
2
+ /**
3
+ * Scroll to element attached. And the element may be an Angular Material component too.
4
+ */
2
5
  export declare class ScrollIntoDirective implements AfterViewInit {
3
6
  private el;
4
7
  constructor(el: ElementRef);
@@ -1,39 +1,41 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('nmce-func'), require('moment'), require('@angular/common'), require('@angular/forms')) :
3
- typeof define === 'function' && define.amd ? define('nmce-directives', ['exports', '@angular/core', 'nmce-func', 'moment', '@angular/common', '@angular/forms'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['nmce-directives'] = {}, global.ng.core, global['nmce-func'], global.moment, global.ng.common, global.ng.forms));
5
- }(this, (function (exports, core, nmceFunc, moment, common, forms) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('nmce-func'), require('@angular/common'), require('@angular/forms')) :
3
+ typeof define === 'function' && define.amd ? define('nmce-directives', ['exports', '@angular/core', 'nmce-func', '@angular/common', '@angular/forms'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['nmce-directives'] = {}, global.ng.core, global['nmce-func'], global.ng.common, global.ng.forms));
5
+ }(this, (function (exports, core, nmceFunc, common, forms) { 'use strict';
6
6
 
7
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
-
9
- var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
10
-
11
- // Simple example directive that fixes autofocus problem with multiple views, source: https://www.picnet.com.au/blogs/guido/post/2016/09/20/angular2-ng2-focus-directive/
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
12
  var AutofocusDirective = /** @class */ (function () {
13
13
  function AutofocusDirective(el) {
14
14
  this.el = el;
15
- this.lastVisible = false;
15
+ this.toFocus = false;
16
+ this.focused = false;
16
17
  this.initialised = false;
17
- console.debug('autofocusDirective created.');
18
+ this.everFocused = false;
19
+ //console.debug('autofocusDirective created.');
18
20
  }
19
21
  AutofocusDirective.prototype.ngAfterViewInit = function () {
20
22
  this.initialised = true;
21
23
  this.ngDoCheck();
22
24
  };
23
25
  AutofocusDirective.prototype.ngDoCheck = function () {
24
- var _this = this;
25
26
  if (!this.initialised) {
26
27
  return;
27
28
  }
28
- var visible = !!this.el.nativeElement.offsetParent;
29
- if (visible && !this.lastVisible) {
30
- setTimeout(function () { _this.el.nativeElement.focus(); }, 2); //no need to clearTimeout
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.');
31
34
  }
32
- this.lastVisible = visible;
33
35
  };
34
36
  Object.defineProperty(AutofocusDirective.prototype, "autofocus", {
35
37
  set: function (condition) {
36
- this.lastVisible = condition !== false;
38
+ this.toFocus = condition !== false;
37
39
  },
38
40
  enumerable: false,
39
41
  configurable: true
@@ -42,7 +44,7 @@
42
44
  }());
43
45
  AutofocusDirective.decorators = [
44
46
  { type: core.Directive, args: [{
45
- selector: '[autofocus]' // using [ ] means selecting attributes
47
+ selector: '[autofocus]'
46
48
  },] }
47
49
  ];
48
50
  AutofocusDirective.ctorParameters = function () { return [
@@ -52,39 +54,9 @@
52
54
  autofocus: [{ type: core.Input }]
53
55
  };
54
56
 
55
- var HighlightDirective = /** @class */ (function () {
56
- function HighlightDirective(el) {
57
- this.el = el;
58
- console.debug('HighlightDirective created.');
59
- }
60
- HighlightDirective.prototype.onMouseEnter = function () {
61
- this.highlight(this.highlightColor || this.defaultColor || 'red');
62
- };
63
- HighlightDirective.prototype.onMouseLeave = function () {
64
- this.highlight(undefined);
65
- };
66
- HighlightDirective.prototype.highlight = function (color) {
67
- this.el.nativeElement.style.backgroundColor = color;
68
- };
69
- return HighlightDirective;
70
- }());
71
- HighlightDirective.decorators = [
72
- { type: core.Directive, args: [{
73
- selector: '[myHighlight]'
74
- },] }
75
- ];
76
- HighlightDirective.ctorParameters = function () { return [
77
- { type: core.ElementRef }
78
- ]; };
79
- HighlightDirective.propDecorators = {
80
- defaultColor: [{ type: core.Input }],
81
- highlightColor: [{ type: core.Input, args: ['myHighlight',] }],
82
- onMouseEnter: [{ type: core.HostListener, args: ['mouseenter',] }],
83
- onMouseLeave: [{ type: core.HostListener, args: ['mouseleave',] }]
84
- };
85
-
86
57
  /**
87
- *
58
+ * Decorate HTML input for inputing and displaying currency. The input type must not be number and should be text only.
59
+ * If the input type is number, the built-in validator will be fighting against this directive.
88
60
  */
89
61
  var CurrencyFormatterDirective = /** @class */ (function () {
90
62
  function CurrencyFormatterDirective(elementRef) {
@@ -103,7 +75,8 @@
103
75
  return CurrencyFormatterDirective;
104
76
  }());
105
77
  CurrencyFormatterDirective.decorators = [
106
- { type: core.Directive, args: [{ selector: '[currencyFormatter]' },] }
78
+ { type: core.Directive, args: [{ selector: '[currencyFormatter]' }, //inspired by https://blog.ngconsultant.io/custom-input-formatting-with-simple-directives-for-angular-2-ec792082976
79
+ ] }
107
80
  ];
108
81
  CurrencyFormatterDirective.ctorParameters = function () { return [
109
82
  { type: core.ElementRef }
@@ -113,57 +86,24 @@
113
86
  onBlur: [{ type: core.HostListener, args: ['blur', ['$event.target.value'],] }]
114
87
  };
115
88
 
116
- /**
117
- *
118
- */
119
- var DatetimeFormatterDirective = /** @class */ (function () {
120
- function DatetimeFormatterDirective(elementRef) {
121
- this.elementRef = elementRef;
122
- //@Input('datetimeFormatter')
123
- this.format = 'DD/MM/YYYY HH:mm';
124
- this.formats = ['', 'DD/MM/YYYY HH:mm'];
125
- this.el = this.elementRef.nativeElement;
89
+ var DataComponentDirective = /** @class */ (function () {
90
+ function DataComponentDirective(viewContainerRef) {
91
+ this.viewContainerRef = viewContainerRef;
126
92
  }
127
- DatetimeFormatterDirective.prototype.ngOnInit = function () {
128
- var s = this.parse(this.el.value);
129
- this.el.value = this.transform(s);
130
- };
131
- DatetimeFormatterDirective.prototype.onFocus = function () {
132
- var s = this.parse(this.el.value);
133
- this.el.value = this.transform(s);
134
- };
135
- DatetimeFormatterDirective.prototype.onBlur = function () {
136
- this.el.value = this.transform(this.el.value);
137
- };
138
- DatetimeFormatterDirective.prototype.transform = function (value) {
139
- if (!value) {
140
- return '';
141
- }
142
- var s = moment__default['default'](value).format(this.format);
143
- console.debug("With format " + this.format + " transform to " + s);
144
- return s;
145
- };
146
- DatetimeFormatterDirective.prototype.parse = function (value) {
147
- if (!value) {
148
- return null;
149
- }
150
- var d = moment__default['default'](value, this.formats).toDate();
151
- console.debug("parse " + value + " to " + d);
152
- return d;
153
- };
154
- return DatetimeFormatterDirective;
93
+ return DataComponentDirective;
155
94
  }());
156
- DatetimeFormatterDirective.decorators = [
157
- { type: core.Directive, args: [{ selector: '[datetimeFormatter]' },] }
95
+ DataComponentDirective.decorators = [
96
+ { type: core.Directive, args: [{
97
+ selector: '[dataComponentHost]',
98
+ },] }
158
99
  ];
159
- DatetimeFormatterDirective.ctorParameters = function () { return [
160
- { type: core.ElementRef }
161
- ]; };
162
- DatetimeFormatterDirective.propDecorators = {
163
- onFocus: [{ type: core.HostListener, args: ['focus', ['$event.target.value'],] }],
164
- onBlur: [{ type: core.HostListener, args: ['blur', ['$event.target.value'],] }]
165
- };
100
+ DataComponentDirective.ctorParameters = function () { return [
101
+ { type: core.ViewContainerRef }
102
+ ]; };
166
103
 
104
+ /**
105
+ * Scroll to element attached. And the element may be an Angular Material component too.
106
+ */
167
107
  var ScrollIntoDirective = /** @class */ (function () {
168
108
  function ScrollIntoDirective(el) {
169
109
  this.el = el;
@@ -189,21 +129,6 @@
189
129
  scrollInto: [{ type: core.Input }]
190
130
  };
191
131
 
192
- var DataComponentDirective = /** @class */ (function () {
193
- function DataComponentDirective(viewContainerRef) {
194
- this.viewContainerRef = viewContainerRef;
195
- }
196
- return DataComponentDirective;
197
- }());
198
- DataComponentDirective.decorators = [
199
- { type: core.Directive, args: [{
200
- selector: '[dataComponentHost]',
201
- },] }
202
- ];
203
- DataComponentDirective.ctorParameters = function () { return [
204
- { type: core.ViewContainerRef }
205
- ]; };
206
-
207
132
  /**
208
133
  * 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.
209
134
  *
@@ -221,17 +146,13 @@
221
146
  ],
222
147
  declarations: [
223
148
  AutofocusDirective,
224
- HighlightDirective,
225
149
  CurrencyFormatterDirective,
226
- DatetimeFormatterDirective,
227
150
  ScrollIntoDirective,
228
151
  DataComponentDirective,
229
152
  ],
230
153
  exports: [
231
154
  AutofocusDirective,
232
- HighlightDirective,
233
155
  CurrencyFormatterDirective,
234
- DatetimeFormatterDirective,
235
156
  ScrollIntoDirective,
236
157
  DataComponentDirective,
237
158
  ]
@@ -249,8 +170,6 @@
249
170
  exports.AutofocusDirective = AutofocusDirective;
250
171
  exports.CurrencyFormatterDirective = CurrencyFormatterDirective;
251
172
  exports.DataComponentDirective = DataComponentDirective;
252
- exports.DatetimeFormatterDirective = DatetimeFormatterDirective;
253
- exports.HighlightDirective = HighlightDirective;
254
173
  exports.NmceDirectivesModule = NmceDirectivesModule;
255
174
  exports.ScrollIntoDirective = ScrollIntoDirective;
256
175
 
@@ -1 +1 @@
1
- {"version":3,"file":"nmce-directives.umd.js","sources":["../../../projects/nmce-directives/src/_directives/autofocus.ts","../../../projects/nmce-directives/src/_directives/highlight.directive.ts","../../../projects/nmce-directives/src/_directives/currencyFormatter.directive.ts","../../../projects/nmce-directives/src/_directives/datetimeFormatter.directive.ts","../../../projects/nmce-directives/src/_directives/scrollInto.directive.ts","../../../projects/nmce-directives/src/_directives/dataComponent.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 { Directive, AfterViewInit, ElementRef, DoCheck, Input } from '@angular/core';\r\n\r\n\r\n// Simple example directive that fixes autofocus problem with multiple views, source: https://www.picnet.com.au/blogs/guido/post/2016/09/20/angular2-ng2-focus-directive/\r\n@Directive({\r\n\tselector: '[autofocus]' // using [ ] means selecting attributes\r\n})\r\n\r\nexport class AutofocusDirective implements AfterViewInit, DoCheck {\r\n\tprivate lastVisible = false;\r\n\tprivate initialised = false;\r\n\tconstructor(private el: ElementRef) {\r\n\t\tconsole.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\tconst visible = !!this.el.nativeElement.offsetParent;\r\n\t\tif (visible && !this.lastVisible) {\r\n\t\t\tsetTimeout(() => { this.el.nativeElement.focus(); }, 2); //no need to clearTimeout\r\n\t\t}\r\n\t\tthis.lastVisible = visible;\r\n\t}\r\n\r\n\t@Input() set autofocus(condition: boolean) {\r\n\t\tthis.lastVisible = condition !== false;\r\n\t}\r\n}\r\n","import { Directive, ElementRef, HostListener, Input } from '@angular/core';\r\n@Directive({\r\n\tselector: '[myHighlight]'\r\n})\r\nexport class HighlightDirective {\r\n\tconstructor(private el: ElementRef) {\r\n\t\tconsole.debug('HighlightDirective created.');\r\n\t}\r\n\r\n\t@Input() defaultColor?: string;\r\n\t@Input('myHighlight') highlightColor?: string;\r\n\t@HostListener('mouseenter') onMouseEnter() {\r\n\t\tthis.highlight(this.highlightColor || this.defaultColor || 'red');\r\n\t}\r\n\t@HostListener('mouseleave') onMouseLeave() {\r\n\t\tthis.highlight(undefined);\r\n\t}\r\n\tprivate highlight(color: string | undefined) {\r\n\t\tthis.el.nativeElement.style.backgroundColor = color;\r\n\t}\r\n}\r\n","import { Directive, HostListener, ElementRef, OnInit } from '@angular/core';\r\nimport { CurrencyFunc } from 'nmce-func';\r\n\r\n/**\r\n *\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, HostListener, ElementRef, OnInit } from '@angular/core';\r\nimport moment from 'moment';\r\n\r\n/**\r\n *\r\n */\r\n@Directive({ selector: '[datetimeFormatter]' })//inspired by https://blog.ngconsultant.io/custom-input-formatting-with-simple-directives-for-angular-2-ec792082976\r\nexport class DatetimeFormatterDirective implements OnInit {\r\n\r\n\tprivate el: HTMLInputElement;\r\n\r\n\t//@Input('datetimeFormatter')\r\n\tformat = 'DD/MM/YYYY HH:mm';\r\n\r\n\tformats = ['', 'DD/MM/YYYY HH:mm'];\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\tconst s = this.parse(this.el.value);\r\n\t\tthis.el.value = this.transform(s);\r\n\t}\r\n\r\n\t@HostListener('focus', ['$event.target.value'])\r\n\tonFocus() {\r\n\t\tconst s = this.parse(this.el.value);\r\n\t\tthis.el.value = this.transform(s);\r\n\t}\r\n\r\n\t@HostListener('blur', ['$event.target.value'])\r\n\tonBlur() {\r\n\t\tthis.el.value = this.transform(this.el.value);\r\n\t}\r\n\r\n\ttransform(value: Date | string | null): string {\r\n\t\tif (!value) {\r\n\t\t\treturn '';\r\n\t\t}\r\n\r\n\t\tconst s = moment(value).format(this.format);\r\n\t\tconsole.debug(`With format ${this.format} transform to ${s}`);\r\n\t\treturn s;\r\n\t}\r\n\r\n\tparse(value: string): Date | null {\r\n\t\tif (!value) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tconst d = moment(value, this.formats).toDate();\r\n\t\tconsole.debug(`parse ${value} to ${d}`);\r\n\t\treturn d;\r\n\t}\r\n\r\n}\r\n\r\n","import { AfterViewInit, Directive, ElementRef, Input } from '@angular/core';\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 { 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 { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule } from '@angular/forms';\r\n\r\n\r\nimport {\r\n\tAutofocusDirective, HighlightDirective, CurrencyFormatterDirective, DatetimeFormatterDirective, ScrollIntoDirective, DataComponentDirective,\r\n} from './index';\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\tHighlightDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tDatetimeFormatterDirective,\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\tHighlightDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tDatetimeFormatterDirective,\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":["Directive","ElementRef","Input","HostListener","CurrencyFunc","moment","ViewContainerRef","NgModule","CommonModule","FormsModule"],"mappings":";;;;;;;;;;IAGA;;QAQC,4BAAoB,EAAc;YAAd,OAAE,GAAF,EAAE,CAAY;YAF1B,gBAAW,GAAG,KAAK,CAAC;YACpB,gBAAW,GAAG,KAAK,CAAC;YAE3B,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAC7C;QAED,4CAAe,GAAf;YACC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,IAAI,CAAC,SAAS,EAAE,CAAC;SACjB;QAED,sCAAS,GAAT;YAAA,iBAOC;YANA,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;gBAAE,OAAO;aAAE;YAClC,IAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC;YACrD,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;gBACjC,UAAU,CAAC,cAAQ,KAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;aACxD;YACD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;SAC3B;QAED,sBAAa,yCAAS;iBAAtB,UAAuB,SAAkB;gBACxC,IAAI,CAAC,WAAW,GAAG,SAAS,KAAK,KAAK,CAAC;aACvC;;;WAAA;;;;gBA3BDA,cAAS,SAAC;oBACV,QAAQ,EAAE,aAAa;iBACvB;;;gBANkCC,eAAU;;;4BA6B3CC,UAAK;;;;QCxBN,4BAAoB,EAAc;YAAd,OAAE,GAAF,EAAE,CAAY;YACjC,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;SAC7C;QAI2B,yCAAY,GAAZ;YAC3B,IAAI,CAAC,SAAS,CAAC,IAAI,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AAC,CAAC;YACxC,OAAO,CAAC,CAAC;SACT;;;;gBAhDDL,cAAS,SAAC,EAAE,QAAQ,EAAE,qBAAqB,EAAE;;;gBANZC,eAAU;;;0BAyB1CE,iBAAY,SAAC,OAAO,EAAE,CAAC,qBAAqB,CAAC;yBAM7CA,iBAAY,SAAC,MAAM,EAAE,CAAC,qBAAqB,CAAC;;;;QC1B7C,6BAAoB,EAAc;YAAd,OAAE,GAAF,EAAE,CAAY;YAKlC,eAAU,GAAY,KAAK,CAAC;;SAH3B;QAKD,6CAAe,GAAf;YACC,IAAI,IAAI,CAAC,UAAU,EAAE;gBACpB,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;aACvC;SACD;;;;gBAfDH,cAAS,SAAC;oBACV,QAAQ,EAAE,cAAc;iBACxB;;;gBAHkCC,eAAU;;;6BAS3CC,UAAK;;;;QCHN,gCAAmB,gBAAkC;YAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;SAAK;;;;gBAJ1DF,cAAS,SAAC;oBACV,QAAQ,EAAE,qBAAqB;iBAC/B;;;gBAJmBM,qBAAgB;;;ICSpC;;;;;QA6BA;;;;;gBAzBCC,aAAQ,SAAC;oBACT,OAAO,EAAE;wBACRC,mBAAY;wBACZC,iBAAW;qBACX;oBAED,YAAY,EAAE;wBACb,kBAAkB;wBAClB,kBAAkB;wBAClB,0BAA0B;wBAC1B,0BAA0B;wBAC1B,mBAAmB;wBACnB,sBAAsB;qBACtB;oBAGD,OAAO,EAAE;wBACR,kBAAkB;wBAClB,kBAAkB;wBAClB,0BAA0B;wBAC1B,0BAA0B;wBAC1B,mBAAmB;wBACnB,sBAAsB;qBACtB;iBACD;;;ICrCD;;;;ICAA;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"nmce-directives.umd.js","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":["Directive","ElementRef","Input","CurrencyFunc","HostListener","ViewContainerRef","NgModule","CommonModule","FormsModule"],"mappings":";;;;;;IAEA;;;;;;QAaC,4BAAoB,EAAc;YAAd,OAAE,GAAF,EAAE,CAAY;YAJ1B,YAAO,GAAG,KAAK,CAAC;YAChB,YAAO,GAAG,KAAK,CAAC;YAChB,gBAAW,GAAG,KAAK,CAAC;YACpB,gBAAW,GAAG,KAAK,CAAC;;SAG3B;QAED,4CAAe,GAAf;YACC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,IAAI,CAAC,SAAS,EAAE,CAAC;SACjB;QAED,sCAAS,GAAT;YACC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;gBAAE,OAAO;aAAE;YAClC,IAAI,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACvD,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;gBAC9B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;gBACpB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;gBACxB,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;aAC9B;SACD;QAED,sBAAa,yCAAS;iBAAtB,UAAuB,SAAkB;gBACxC,IAAI,CAAC,OAAO,GAAG,SAAS,KAAK,KAAK,CAAC;aACnC;;;WAAA;;;;gB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,EAAE,cAAc;iBACxB;;;gBAPkCC,eAAU;;;6BAa3CC,UAAK;;;ICJP;;;;;QAyBA;;;;;gBArBCI,aAAQ,SAAC;oBACT,OAAO,EAAE;wBACRC,mBAAY;wBACZC,iBAAW;qBACX;oBAED,YAAY,EAAE;wBACb,kBAAkB;wBAClB,0BAA0B;wBAC1B,mBAAmB;wBACnB,sBAAsB;qBACtB;oBAGD,OAAO,EAAE;wBACR,kBAAkB;wBAClB,0BAA0B;wBAC1B,mBAAmB;wBACnB,sBAAsB;qBACtB;iBACD;;;ICjCD;;;;ICAA;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("nmce-func"),require("moment"),require("@angular/common"),require("@angular/forms")):"function"==typeof define&&define.amd?define("nmce-directives",["exports","@angular/core","nmce-func","moment","@angular/common","@angular/forms"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["nmce-directives"]={},e.ng.core,e["nmce-func"],e.moment,e.ng.common,e.ng.forms)}(this,(function(e,t,r,o,n,i){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=s(o),u=function(){function e(e){this.el=e,this.lastVisible=!1,this.initialised=!1,console.debug("autofocusDirective created.")}return e.prototype.ngAfterViewInit=function(){this.initialised=!0,this.ngDoCheck()},e.prototype.ngDoCheck=function(){var e=this;if(this.initialised){var t=!!this.el.nativeElement.offsetParent;t&&!this.lastVisible&&setTimeout((function(){e.el.nativeElement.focus()}),2),this.lastVisible=t}},Object.defineProperty(e.prototype,"autofocus",{set:function(e){this.lastVisible=!1!==e},enumerable:!1,configurable:!0}),e}();u.decorators=[{type:t.Directive,args:[{selector:"[autofocus]"}]}],u.ctorParameters=function(){return[{type:t.ElementRef}]},u.propDecorators={autofocus:[{type:t.Input}]};var c=function(){function e(e){this.el=e,console.debug("HighlightDirective created.")}return e.prototype.onMouseEnter=function(){this.highlight(this.highlightColor||this.defaultColor||"red")},e.prototype.onMouseLeave=function(){this.highlight(void 0)},e.prototype.highlight=function(e){this.el.nativeElement.style.backgroundColor=e},e}();c.decorators=[{type:t.Directive,args:[{selector:"[myHighlight]"}]}],c.ctorParameters=function(){return[{type:t.ElementRef}]},c.propDecorators={defaultColor:[{type:t.Input}],highlightColor:[{type:t.Input,args:["myHighlight"]}],onMouseEnter:[{type:t.HostListener,args:["mouseenter"]}],onMouseLeave:[{type:t.HostListener,args:["mouseleave"]}]};var l=function(){function e(e){this.elementRef=e,this.el=this.elementRef.nativeElement}return e.prototype.ngOnInit=function(){this.el.value=r.CurrencyFunc.transformCurrency(this.el.value)},e.prototype.onFocus=function(e){this.el.value=r.CurrencyFunc.parseCurrency(e)},e.prototype.onBlur=function(e){this.el.value=r.CurrencyFunc.transformCurrency(e)},e}();l.decorators=[{type:t.Directive,args:[{selector:"[currencyFormatter]"}]}],l.ctorParameters=function(){return[{type:t.ElementRef}]},l.propDecorators={onFocus:[{type:t.HostListener,args:["focus",["$event.target.value"]]}],onBlur:[{type:t.HostListener,args:["blur",["$event.target.value"]]}]};var f=function(){function e(e){this.elementRef=e,this.format="DD/MM/YYYY HH:mm",this.formats=["","DD/MM/YYYY HH:mm"],this.el=this.elementRef.nativeElement}return e.prototype.ngOnInit=function(){var e=this.parse(this.el.value);this.el.value=this.transform(e)},e.prototype.onFocus=function(){var e=this.parse(this.el.value);this.el.value=this.transform(e)},e.prototype.onBlur=function(){this.el.value=this.transform(this.el.value)},e.prototype.transform=function(e){if(!e)return"";var t=a.default(e).format(this.format);return console.debug("With format "+this.format+" transform to "+t),t},e.prototype.parse=function(e){if(!e)return null;var t=a.default(e,this.formats).toDate();return console.debug("parse "+e+" to "+t),t},e}();f.decorators=[{type:t.Directive,args:[{selector:"[datetimeFormatter]"}]}],f.ctorParameters=function(){return[{type:t.ElementRef}]},f.propDecorators={onFocus:[{type:t.HostListener,args:["focus",["$event.target.value"]]}],onBlur:[{type:t.HostListener,args:["blur",["$event.target.value"]]}]};var p=function(){function e(e){this.el=e,this.scrollInto=!1}return e.prototype.ngAfterViewInit=function(){this.scrollInto&&this.el.nativeElement.scrollIntoView()},e}();p.decorators=[{type:t.Directive,args:[{selector:"[scrollInto]"}]}],p.ctorParameters=function(){return[{type:t.ElementRef}]},p.propDecorators={scrollInto:[{type:t.Input}]};var m=function(e){this.viewContainerRef=e};m.decorators=[{type:t.Directive,args:[{selector:"[dataComponentHost]"}]}],m.ctorParameters=function(){return[{type:t.ViewContainerRef}]};var h=function(){};h.decorators=[{type:t.NgModule,args:[{imports:[n.CommonModule,i.FormsModule],declarations:[u,c,l,f,p,m],exports:[u,c,l,f,p,m]}]}],e.AutofocusDirective=u,e.CurrencyFormatterDirective=l,e.DataComponentDirective=m,e.DatetimeFormatterDirective=f,e.HighlightDirective=c,e.NmceDirectivesModule=h,e.ScrollIntoDirective=p,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("nmce-func"),require("@angular/common"),require("@angular/forms")):"function"==typeof define&&define.amd?define("nmce-directives",["exports","@angular/core","nmce-func","@angular/common","@angular/forms"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["nmce-directives"]={},e.ng.core,e["nmce-func"],e.ng.common,e.ng.forms)}(this,(function(e,t,o,r,n){"use strict";var i=function(){function e(e){this.el=e,this.toFocus=!1,this.focused=!1,this.initialised=!1,this.everFocused=!1}return e.prototype.ngAfterViewInit=function(){this.initialised=!0,this.ngDoCheck()},e.prototype.ngDoCheck=function(){this.initialised&&(!this.toFocus||this.everFocused||this.focused||(this.el.nativeElement.focus(),this.focused=!0,this.everFocused=!0,console.debug("focused now.")))},Object.defineProperty(e.prototype,"autofocus",{set:function(e){this.toFocus=!1!==e},enumerable:!1,configurable:!0}),e}();i.decorators=[{type:t.Directive,args:[{selector:"[autofocus]"}]}],i.ctorParameters=function(){return[{type:t.ElementRef}]},i.propDecorators={autofocus:[{type:t.Input}]};var c=function(){function e(e){this.elementRef=e,this.el=this.elementRef.nativeElement}return e.prototype.ngOnInit=function(){this.el.value=o.CurrencyFunc.transformCurrency(this.el.value)},e.prototype.onFocus=function(e){this.el.value=o.CurrencyFunc.parseCurrency(e)},e.prototype.onBlur=function(e){this.el.value=o.CurrencyFunc.transformCurrency(e)},e}();c.decorators=[{type:t.Directive,args:[{selector:"[currencyFormatter]"}]}],c.ctorParameters=function(){return[{type:t.ElementRef}]},c.propDecorators={onFocus:[{type:t.HostListener,args:["focus",["$event.target.value"]]}],onBlur:[{type:t.HostListener,args:["blur",["$event.target.value"]]}]};var s=function(e){this.viewContainerRef=e};s.decorators=[{type:t.Directive,args:[{selector:"[dataComponentHost]"}]}],s.ctorParameters=function(){return[{type:t.ViewContainerRef}]};var u=function(){function e(e){this.el=e,this.scrollInto=!1}return e.prototype.ngAfterViewInit=function(){this.scrollInto&&this.el.nativeElement.scrollIntoView()},e}();u.decorators=[{type:t.Directive,args:[{selector:"[scrollInto]"}]}],u.ctorParameters=function(){return[{type:t.ElementRef}]},u.propDecorators={scrollInto:[{type:t.Input}]};var a=function(){};a.decorators=[{type:t.NgModule,args:[{imports:[r.CommonModule,n.FormsModule],declarations:[i,c,u,s],exports:[i,c,u,s]}]}],e.AutofocusDirective=i,e.CurrencyFormatterDirective=c,e.DataComponentDirective=s,e.NmceDirectivesModule=a,e.ScrollIntoDirective=u,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=nmce-directives.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../projects/nmce-directives/src/_directives/autofocus.ts","../../../projects/nmce-directives/src/_directives/highlight.directive.ts","../../../projects/nmce-directives/src/_directives/currencyFormatter.directive.ts","../../../projects/nmce-directives/src/_directives/datetimeFormatter.directive.ts","../../../projects/nmce-directives/src/_directives/scrollInto.directive.ts","../../../projects/nmce-directives/src/_directives/dataComponent.directive.ts","../../../projects/nmce-directives/src/_directives/directives.module.ts"],"names":["AutofocusDirective","el","this","lastVisible","initialised","console","debug","prototype","ngAfterViewInit","ngDoCheck","_this","visible","nativeElement","offsetParent","setTimeout","focus","Object","defineProperty","condition","Directive","args","selector","ElementRef","Input","HighlightDirective","onMouseEnter","highlight","highlightColor","defaultColor","onMouseLeave","undefined","color","style","backgroundColor","HostListener","CurrencyFormatterDirective","elementRef","ngOnInit","value","CurrencyFunc","transformCurrency","onFocus","parseCurrency","onBlur","DatetimeFormatterDirective","format","formats","s","parse","transform","moment","d","toDate","ScrollIntoDirective","scrollInto","scrollIntoView","viewContainerRef","ViewContainerRef","NgModule","imports","CommonModule","FormsModule","declarations","DataComponentDirective","exports"],"mappings":"4mBAWC,SAAAA,EAAoBC,GAAAC,KAAAD,GAAAA,EAFZC,KAAAC,aAAc,EACdD,KAAAE,aAAc,EAErBC,QAAQC,MAAM,sCAGfN,EAAAO,UAAAC,gBAAA,WACCN,KAAKE,aAAc,EACnBF,KAAKO,aAGNT,EAAAO,UAAAE,UAAA,WAAA,IAAAC,EAAAR,KACC,GAAKA,KAAKE,YAAV,CACA,IAAMO,IAAYT,KAAKD,GAAGW,cAAcC,aACpCF,IAAYT,KAAKC,aACpBW,YAAW,WAAQJ,EAAKT,GAAGW,cAAcG,UAAY,GAEtDb,KAAKC,YAAcQ,IAGpBK,OAAAC,eAAajB,EAAAO,UAAA,YAAS,KAAtB,SAAuBW,GACtBhB,KAAKC,aAA4B,IAAde,4DA1BpBC,EAAAA,UAASC,KAAA,CAAC,CACVC,SAAU,2DALwBC,EAAAA,iDA6BjCC,EAAAA,0BCxBD,SAAAC,EAAoBvB,GAAAC,KAAAD,GAAAA,EACnBI,QAAQC,MAAM,sCAKakB,EAAAjB,UAAAkB,aAAA,WAC3BvB,KAAKwB,UAAUxB,KAAKyB,gBAAkBzB,KAAK0B,cAAgB,QAEhCJ,EAAAjB,UAAAsB,aAAA,WAC3B3B,KAAKwB,eAAUI,IAERN,EAAAjB,UAAAmB,UAAA,SAAUK,GACjB7B,KAAKD,GAAGW,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UAAU/C,KAAKD,GAAGqC,QAGxCM,EAAArC,UAAA0C,UAAA,SAAUX,GACT,IAAKA,EACJ,MAAO,GAGR,IAAMS,EAAIG,EAAAA,QAAOZ,GAAOO,OAAO3C,KAAK2C,QAEpC,OADAxC,QAAQC,MAAM,eAAeJ,KAAK2C,OAAM,iBAAiBE,GAClDA,GAGRH,EAAArC,UAAAyC,MAAA,SAAMV,GACL,IAAKA,EACJ,OAAO,KAGR,IAAMa,EAAID,EAAAA,QAAOZ,EAAOpC,KAAK4C,SAASM,SAEtC,OADA/C,QAAQC,MAAM,SAASgC,EAAK,OAAOa,GAC5BA,4BA/CRhC,EAAAA,UAASC,KAAA,CAAC,CAAEC,SAAU,mEANWC,EAAAA,+CAyBhCY,EAAAA,aAAYd,KAAA,CAAC,QAAS,CAAC,wCAMvBc,EAAAA,aAAYd,KAAA,CAAC,OAAQ,CAAC,4CC1BvB,SAAAiC,EAAoBpD,GAAAC,KAAAD,GAAAA,EAKpBC,KAAAoD,YAAsB,SAEtBD,EAAA9C,UAAAC,gBAAA,WACKN,KAAKoD,YACRpD,KAAKD,GAAGW,cAAc2C,2CAbxBpC,EAAAA,UAASC,KAAA,CAAC,CACVC,SAAU,4DAFwBC,EAAAA,kDASjCC,EAAAA,eCHD,SAAmBiC,GAAAtD,KAAAsD,iBAAAA,uBAJnBrC,EAAAA,UAASC,KAAA,CAAC,CACVC,SAAU,mEAHSoC,EAAAA,0BCsCpB,iCAzBCC,EAAAA,SAAQtC,KAAA,CAAC,CACTuC,QAAS,CACRC,EAAAA,aACAC,EAAAA,aAGDC,aAAc,CACb9D,EACAwB,EACAW,EACAS,EACAS,EACAU,GAIDC,QAAS,CACRhE,EACAwB,EACAW,EACAS,EACAS,EACAU","sourcesContent":["import { Directive, AfterViewInit, ElementRef, DoCheck, Input } from '@angular/core';\r\n\r\n\r\n// Simple example directive that fixes autofocus problem with multiple views, source: https://www.picnet.com.au/blogs/guido/post/2016/09/20/angular2-ng2-focus-directive/\r\n@Directive({\r\n\tselector: '[autofocus]' // using [ ] means selecting attributes\r\n})\r\n\r\nexport class AutofocusDirective implements AfterViewInit, DoCheck {\r\n\tprivate lastVisible = false;\r\n\tprivate initialised = false;\r\n\tconstructor(private el: ElementRef) {\r\n\t\tconsole.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\tconst visible = !!this.el.nativeElement.offsetParent;\r\n\t\tif (visible && !this.lastVisible) {\r\n\t\t\tsetTimeout(() => { this.el.nativeElement.focus(); }, 2); //no need to clearTimeout\r\n\t\t}\r\n\t\tthis.lastVisible = visible;\r\n\t}\r\n\r\n\t@Input() set autofocus(condition: boolean) {\r\n\t\tthis.lastVisible = condition !== false;\r\n\t}\r\n}\r\n","import { Directive, ElementRef, HostListener, Input } from '@angular/core';\r\n@Directive({\r\n\tselector: '[myHighlight]'\r\n})\r\nexport class HighlightDirective {\r\n\tconstructor(private el: ElementRef) {\r\n\t\tconsole.debug('HighlightDirective created.');\r\n\t}\r\n\r\n\t@Input() defaultColor?: string;\r\n\t@Input('myHighlight') highlightColor?: string;\r\n\t@HostListener('mouseenter') onMouseEnter() {\r\n\t\tthis.highlight(this.highlightColor || this.defaultColor || 'red');\r\n\t}\r\n\t@HostListener('mouseleave') onMouseLeave() {\r\n\t\tthis.highlight(undefined);\r\n\t}\r\n\tprivate highlight(color: string | undefined) {\r\n\t\tthis.el.nativeElement.style.backgroundColor = color;\r\n\t}\r\n}\r\n","import { Directive, HostListener, ElementRef, OnInit } from '@angular/core';\r\nimport { CurrencyFunc } from 'nmce-func';\r\n\r\n/**\r\n *\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, HostListener, ElementRef, OnInit } from '@angular/core';\r\nimport moment from 'moment';\r\n\r\n/**\r\n *\r\n */\r\n@Directive({ selector: '[datetimeFormatter]' })//inspired by https://blog.ngconsultant.io/custom-input-formatting-with-simple-directives-for-angular-2-ec792082976\r\nexport class DatetimeFormatterDirective implements OnInit {\r\n\r\n\tprivate el: HTMLInputElement;\r\n\r\n\t//@Input('datetimeFormatter')\r\n\tformat = 'DD/MM/YYYY HH:mm';\r\n\r\n\tformats = ['', 'DD/MM/YYYY HH:mm'];\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\tconst s = this.parse(this.el.value);\r\n\t\tthis.el.value = this.transform(s);\r\n\t}\r\n\r\n\t@HostListener('focus', ['$event.target.value'])\r\n\tonFocus() {\r\n\t\tconst s = this.parse(this.el.value);\r\n\t\tthis.el.value = this.transform(s);\r\n\t}\r\n\r\n\t@HostListener('blur', ['$event.target.value'])\r\n\tonBlur() {\r\n\t\tthis.el.value = this.transform(this.el.value);\r\n\t}\r\n\r\n\ttransform(value: Date | string | null): string {\r\n\t\tif (!value) {\r\n\t\t\treturn '';\r\n\t\t}\r\n\r\n\t\tconst s = moment(value).format(this.format);\r\n\t\tconsole.debug(`With format ${this.format} transform to ${s}`);\r\n\t\treturn s;\r\n\t}\r\n\r\n\tparse(value: string): Date | null {\r\n\t\tif (!value) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tconst d = moment(value, this.formats).toDate();\r\n\t\tconsole.debug(`parse ${value} to ${d}`);\r\n\t\treturn d;\r\n\t}\r\n\r\n}\r\n\r\n","import { AfterViewInit, Directive, ElementRef, Input } from '@angular/core';\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 { 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 { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule } from '@angular/forms';\r\n\r\n\r\nimport {\r\n\tAutofocusDirective, HighlightDirective, CurrencyFormatterDirective, DatetimeFormatterDirective, ScrollIntoDirective, DataComponentDirective,\r\n} from './index';\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\tHighlightDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tDatetimeFormatterDirective,\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\tHighlightDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tDatetimeFormatterDirective,\r\n\t\tScrollIntoDirective,\r\n\t\tDataComponentDirective,\r\n\t]\r\n})\r\nexport class NmceDirectivesModule { }\r\n"]}
1
+ {"version":3,"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"],"names":["AutofocusDirective","el","this","toFocus","focused","initialised","everFocused","prototype","ngAfterViewInit","ngDoCheck","nativeElement","focus","console","debug","Object","defineProperty","condition","Directive","args","selector","ElementRef","Input","CurrencyFormatterDirective","elementRef","ngOnInit","value","CurrencyFunc","transformCurrency","onFocus","parseCurrency","onBlur","HostListener","viewContainerRef","ViewContainerRef","ScrollIntoDirective","scrollInto","scrollIntoView","NgModule","imports","CommonModule","FormsModule","declarations","DataComponentDirective","exports"],"mappings":"ufAeC,SAAAA,EAAoBC,GAAAC,KAAAD,GAAAA,EAJZC,KAAAC,SAAU,EACVD,KAAAE,SAAU,EACVF,KAAAG,aAAc,EACdH,KAAAI,aAAc,SAKtBN,EAAAO,UAAAC,gBAAA,WACCN,KAAKG,aAAc,EACnBH,KAAKO,aAGNT,EAAAO,UAAAE,UAAA,WACMP,KAAKG,eACNH,KAAKC,SAAYD,KAAKI,aAAgBJ,KAAKE,UAC9CF,KAAKD,GAAGS,cAAcC,QACtBT,KAAKE,SAAU,EACfF,KAAKI,aAAc,EACnBM,QAAQC,MAAM,mBAIhBC,OAAAC,eAAaf,EAAAO,UAAA,YAAS,KAAtB,SAAuBS,GACtBd,KAAKC,SAAwB,IAAda,4DA5BhBC,EAAAA,UAASC,KAAA,CAAC,CACVC,SAAU,2DARiCC,EAAAA,iDAkC1CC,EAAAA,0BCtBD,SAAAC,EAAoBC,GAAArB,KAAAqB,WAAAA,EACnBrB,KAAKD,GAAKC,KAAKqB,WAAWb,qBAG3BY,EAAAf,UAAAiB,SAAA,WACCtB,KAAKD,GAAGwB,MAAQC,EAAAA,aAAaC,kBAAkBzB,KAAKD,GAAGwB,QAIxDH,EAAAf,UAAAqB,QAAA,SAAQH,GACPvB,KAAKD,GAAGwB,MAAQC,EAAAA,aAAaG,cAAcJ,IAI5CH,EAAAf,UAAAuB,OAAA,SAAOL,GACNvB,KAAKD,GAAGwB,MAAQC,EAAAA,aAAaC,kBAAkBF,6BApBhDR,EAAAA,UAASC,KAAA,CAAC,CAAEC,SAAU,mEAPHC,EAAAA,+CAoBlBW,EAAAA,aAAYb,KAAA,CAAC,QAAS,CAAC,wCAKvBa,EAAAA,aAAYb,KAAA,CAAC,OAAQ,CAAC,iCCnBvB,SAAmBc,GAAA9B,KAAA8B,iBAAAA,uBAJnBf,EAAAA,UAASC,KAAA,CAAC,CACVC,SAAU,mEAHSc,EAAAA,qCCSnB,SAAAC,EAAoBjC,GAAAC,KAAAD,GAAAA,EAKpBC,KAAAiC,YAAsB,SAEtBD,EAAA3B,UAAAC,gBAAA,WACKN,KAAKiC,YACRjC,KAAKD,GAAGS,cAAc0B,2CAbxBnB,EAAAA,UAASC,KAAA,CAAC,CACVC,SAAU,4DANwBC,EAAAA,kDAajCC,EAAAA,eCqBF,iCArBCgB,EAAAA,SAAQnB,KAAA,CAAC,CACToB,QAAS,CACRC,EAAAA,aACAC,EAAAA,aAGDC,aAAc,CACbzC,EACAsB,EACAY,EACAQ,GAIDC,QAAS,CACR3C,EACAsB,EACAY,EACAQ","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"]}
@@ -1,11 +1,17 @@
1
1
  import { Directive, ElementRef, Input } from '@angular/core';
2
- // Simple example directive that fixes autofocus problem with multiple views, source: https://www.picnet.com.au/blogs/guido/post/2016/09/20/angular2-ng2-focus-directive/
2
+ /**
3
+ * Use as a parametered input parameter in html element.
4
+ * When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig,
5
+ * if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a mateiral dialog.
6
+ */
3
7
  export class AutofocusDirective {
4
8
  constructor(el) {
5
9
  this.el = el;
6
- this.lastVisible = false;
10
+ this.toFocus = false;
11
+ this.focused = false;
7
12
  this.initialised = false;
8
- console.debug('autofocusDirective created.');
13
+ this.everFocused = false;
14
+ //console.debug('autofocusDirective created.');
9
15
  }
10
16
  ngAfterViewInit() {
11
17
  this.initialised = true;
@@ -15,19 +21,20 @@ export class AutofocusDirective {
15
21
  if (!this.initialised) {
16
22
  return;
17
23
  }
18
- const visible = !!this.el.nativeElement.offsetParent;
19
- if (visible && !this.lastVisible) {
20
- setTimeout(() => { this.el.nativeElement.focus(); }, 2); //no need to clearTimeout
24
+ if (this.toFocus && !this.everFocused && !this.focused) {
25
+ this.el.nativeElement.focus();
26
+ this.focused = true;
27
+ this.everFocused = true;
28
+ console.debug('focused now.');
21
29
  }
22
- this.lastVisible = visible;
23
30
  }
24
31
  set autofocus(condition) {
25
- this.lastVisible = condition !== false;
32
+ this.toFocus = condition !== false;
26
33
  }
27
34
  }
28
35
  AutofocusDirective.decorators = [
29
36
  { type: Directive, args: [{
30
- selector: '[autofocus]' // using [ ] means selecting attributes
37
+ selector: '[autofocus]'
31
38
  },] }
32
39
  ];
33
40
  AutofocusDirective.ctorParameters = () => [
@@ -36,4 +43,4 @@ AutofocusDirective.ctorParameters = () => [
36
43
  AutofocusDirective.propDecorators = {
37
44
  autofocus: [{ type: Input }]
38
45
  };
39
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b2ZvY3VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbm1jZS1kaXJlY3RpdmVzL3NyYy9fZGlyZWN0aXZlcy9hdXRvZm9jdXMudHMiXSwibmFt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dGhpcy5pbml0aWFsaXNlZCkgeyByZXR1cm47IH1cclxuXHRcdGlmICh0aGlzLnRvRm9jdXMgJiYgIXRoaXMuZXZlckZvY3VzZWQgJiYgIXRoaXMuZm9jdXNlZCkge1xyXG5cdFx0XHR0aGlzLmVsLm5hdGl2ZUVsZW1lbnQuZm9jdXMoKTtcclxuXHRcdFx0dGhpcy5mb2N1c2VkID0gdHJ1ZTtcclxuXHRcdFx0dGhpcy5ldmVyRm9jdXNlZCA9IHRydWU7XHJcblx0XHRcdGNvbnNvbGUuZGVidWcoJ2ZvY3VzZWQgbm93LicpO1xyXG5cdFx0fVxyXG5cdH1cclxuXHJcblx0QElucHV0KCkgc2V0IGF1dG9mb2N1cyhjb25kaXRpb246IGJvb2xlYW4pIHtcclxuXHRcdHRoaXMudG9Gb2N1cyA9IGNvbmRpdGlvbiAhPT0gZmFsc2U7XHJcblx0fVxyXG59XHJcbiJdfQ==
@@ -1,7 +1,8 @@
1
- import { Directive, HostListener, ElementRef } from '@angular/core';
1
+ import { Directive, ElementRef, HostListener } from '@angular/core';
2
2
  import { CurrencyFunc } from 'nmce-func';
3
3
  /**
4
- *
4
+ * Decorate HTML input for inputing and displaying currency. The input type must not be number and should be text only.
5
+ * If the input type is number, the built-in validator will be fighting against this directive.
5
6
  */
6
7
  export class CurrencyFormatterDirective {
7
8
  constructor(elementRef) {
@@ -19,7 +20,8 @@ export class CurrencyFormatterDirective {
19
20
  }
20
21
  }
21
22
  CurrencyFormatterDirective.decorators = [
22
- { type: Directive, args: [{ selector: '[currencyFormatter]' },] }
23
+ { type: Directive, args: [{ selector: '[currencyFormatter]' }, //inspired by https://blog.ngconsultant.io/custom-input-formatting-with-simple-directives-for-angular-2-ec792082976
24
+ ] }
23
25
  ];
24
26
  CurrencyFormatterDirective.ctorParameters = () => [
25
27
  { type: ElementRef }
@@ -28,4 +30,4 @@ CurrencyFormatterDirective.propDecorators = {
28
30
  onFocus: [{ type: HostListener, args: ['focus', ['$event.target.value'],] }],
29
31
  onBlur: [{ type: HostListener, args: ['blur', ['$event.target.value'],] }]
30
32
  };
31
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3VycmVuY3lGb3JtYXR0ZXIuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbm1jZS1kaXJlY3RpdmVzL3NyYy9fZGlyZWN0aXZlcy9jdXJyZW5jeUZvcm1hdHRlci5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxZQUFZLEVBQUUsVUFBVSxFQUFVLE1BQU0sZUFBZSxDQUFDO0FBQzVFLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxXQUFXLENBQUM7QUFFekM7O0dBRUc7QUFFSCxNQUFNLE9BQU8sMEJBQTBCO0lBSXRDLFlBQW9CLFVBQXNCO1FBQXRCLGVBQVUsR0FBVixVQUFVLENBQVk7UUFDekMsSUFBSSxDQUFDLEVBQUUsR0FBRyxJQUFJLENBQUMsVUFBVSxDQUFDLGFBQWEsQ0FBQztJQUN6QyxDQUFDO0lBRUQsUUFBUTtRQUNQLElBQUksQ0FBQyxFQUFFLENBQUMsS0FBSyxHQUFHLFlBQVksQ0FBQyxpQkFBaUIsQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQy9ELENBQUM7SUFHRCxPQUFPLENBQUMsS0FBYTtRQUNwQixJQUFJLENBQUMsRUFBRSxDQUFDLEtBQUssR0FBRyxZQUFZLENBQUMsYUFBYSxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsd0JBQXdCO0lBQzVFLENBQUM7SUFHRCxNQUFNLENBQUMsS0FBYTtRQUNuQixJQUFJLENBQUMsRUFBRSxDQUFDLEtBQUssR0FBRyxZQUFZLENBQUMsaUJBQWlCLEN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3N0TGlzdGVuZXIoJ2JsdXInLCBbJyRldmVudC50YXJnZXQudmFsdWUnXSlcclxuXHRvbkJsdXIodmFsdWU6IHN0cmluZykge1xyXG5cdFx0dGhpcy5lbC52YWx1ZSA9IEN1cnJlbmN5RnVuYy50cmFuc2Zvcm1DdXJyZW5jeSh2YWx1ZSk7XHJcblx0fVxyXG5cclxufVxyXG5cclxuIl19
@@ -1,7 +1,7 @@
1
- import { NgModule } from '@angular/core';
2
1
  import { CommonModule } from '@angular/common';
2
+ import { NgModule } from '@angular/core';
3
3
  import { FormsModule } from '@angular/forms';
4
- import { AutofocusDirective, HighlightDirective, CurrencyFormatterDirective, DatetimeFormatterDirective, ScrollIntoDirective, DataComponentDirective, } from './index';
4
+ import { AutofocusDirective, CurrencyFormatterDirective, DataComponentDirective, ScrollIntoDirective } from './index';
5
5
  /**
6
6
  * 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.
7
7
  *
@@ -16,20 +16,16 @@ NmceDirectivesModule.decorators = [
16
16
  ],
17
17
  declarations: [
18
18
  AutofocusDirective,
19
- HighlightDirective,
20
19
  CurrencyFormatterDirective,
21
- DatetimeFormatterDirective,
22
20
  ScrollIntoDirective,
23
21
  DataComponentDirective,
24
22
  ],
25
23
  exports: [
26
24
  AutofocusDirective,
27
- HighlightDirective,
28
25
  CurrencyFormatterDirective,
29
- DatetimeFormatterDirective,
30
26
  ScrollIntoDirective,
31
27
  DataComponentDirective,
32
28
  ]
33
29
  },] }
34
30
  ];
35
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlcy5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9ubWNlLWRpcmVjdGl2ZXMvc3JjL19kaXJlY3RpdmVzL2RpcmVjdGl2ZXMubW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiO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RhQ29tcG9uZW50RGlyZWN0aXZlLFxyXG5cdF1cclxufSlcclxuZXhwb3J0IGNsYXNzIE5tY2VEaXJlY3RpdmVzTW9kdWxlIHsgfVxyXG4iXX0=
@@ -1,7 +1,5 @@
1
1
  export * from './autofocus';
2
- export * from './highlight.directive';
3
2
  export * from './currencyFormatter.directive';
4
- export * from './datetimeFormatter.directive';
5
- export * from './scrollInto.directive';
6
3
  export * from './dataComponent.directive';
7
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9ubWNlLWRpcmVjdGl2ZXMvc3JjL19kaXJlY3RpdmVzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsdUJBQXVCLENBQUM7QUFDdEMsY0FBYywrQkFBK0IsQ0FBQztBQUM5QyxjQUFjLCtCQUErQixDQUFDO0FBQzlDLGNBQWMsd0JBQXdCLENBQUM7QUFDdkMsY0FBYywyQkFBMkIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vYXV0b2ZvY3VzJztcclxuZXhwb3J0ICogZnJvbSAnLi9oaWdobGlnaHQuZGlyZWN0aXZlJztcclxuZXhwb3J0ICogZnJvbSAnLi9jdXJyZW5jeUZvcm1hdHRlci5kaXJlY3RpdmUnO1xyXG5leHBvcnQgKiBmcm9tICcuL2RhdGV0aW1lRm9ybWF0dGVyLmRpcmVjdGl2ZSc7XHJcbmV4cG9ydCAqIGZyb20gJy4vc2Nyb2xsSW50by5kaXJlY3RpdmUnO1xyXG5leHBvcnQgKiBmcm9tICcuL2RhdGFDb21wb25lbnQuZGlyZWN0aXZlJzsiXX0=
4
+ export * from './scrollInto.directive';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9ubWNlLWRpcmVjdGl2ZXMvc3JjL19kaXJlY3RpdmVzL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsK0JBQStCLENBQUM7QUFDOUMsY0FBYywyQkFBMkIsQ0FBQztBQUMxQyxjQUFjLHdCQUF3QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0ICogZnJvbSAnLi9hdXRvZm9jdXMnO1xyXG5leHBvcnQgKiBmcm9tICcuL2N1cnJlbmN5Rm9ybWF0dGVyLmRpcmVjdGl2ZSc7XHJcbmV4cG9ydCAqIGZyb20gJy4vZGF0YUNvbXBvbmVudC5kaXJlY3RpdmUnO1xyXG5leHBvcnQgKiBmcm9tICcuL3Njcm9sbEludG8uZGlyZWN0aXZlJztcclxuIl19
@@ -1,4 +1,7 @@
1
1
  import { Directive, ElementRef, Input } from '@angular/core';
2
+ /**
3
+ * Scroll to element attached. And the element may be an Angular Material component too.
4
+ */
2
5
  export class ScrollIntoDirective {
3
6
  constructor(el) {
4
7
  this.el = el;
@@ -22,4 +25,4 @@ ScrollIntoDirective.ctorParameters = () => [
22
25
  ScrollIntoDirective.propDecorators = {
23
26
  scrollInto: [{ type: Input }]
24
27
  };
25
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsSW50by5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9ubWNlLWRpcmVjdGl2ZXMvc3JjL19kaXJlY3RpdmVzL3Njcm9sbEludG8uZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRU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3VsYXIgTWF0ZXJpYWwgY29tcG9uZW50IHRvby5cclxuICovXHJcbkBEaXJlY3RpdmUoe1xyXG5cdHNlbGVjdG9yOiAnW3Njcm9sbEludG9dJ1xyXG59KVxyXG5leHBvcnQgY2xhc3MgU2Nyb2xsSW50b0RpcmVjdGl2ZSBpbXBsZW1lbnRzIEFmdGVyVmlld0luaXQge1xyXG5cdGNvbnN0cnVjdG9yKHByaXZhdGUgZWw6IEVsZW1lbnRSZWYpIHtcclxuXHRcdC8vXHRjb25zb2xlLmRlYnVnKCdTY3JvbGxJbnRvRGlyZWN0aXZlIGNyZWF0ZWQuJyk7XHJcblx0fVxyXG5cclxuXHRASW5wdXQoKVxyXG5cdHNjcm9sbEludG86IGJvb2xlYW4gPSBmYWxzZTtcclxuXHJcblx0bmdBZnRlclZpZXdJbml0KCkge1xyXG5cdFx0aWYgKHRoaXMuc2Nyb2xsSW50bykge1xyXG5cdFx0XHR0aGlzLmVsLm5hdGl2ZUVsZW1lbnQuc2Nyb2xsSW50b1ZpZXcoKTtcclxuXHRcdH1cclxuXHR9XHJcbn1cclxuIl19
@@ -1,16 +1,21 @@
1
1
  import { Directive, ElementRef, Input, HostListener, ViewContainerRef, NgModule } from '@angular/core';
2
2
  import { CurrencyFunc } from 'nmce-func';
3
- import moment from 'moment';
4
3
  import { CommonModule } from '@angular/common';
5
4
  import { FormsModule } from '@angular/forms';
6
5
 
7
- // Simple example directive that fixes autofocus problem with multiple views, source: https://www.picnet.com.au/blogs/guido/post/2016/09/20/angular2-ng2-focus-directive/
6
+ /**
7
+ * Use as a parametered input parameter in html element.
8
+ * 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 mateiral dialog.
10
+ */
8
11
  class AutofocusDirective {
9
12
  constructor(el) {
10
13
  this.el = el;
11
- this.lastVisible = false;
14
+ this.toFocus = false;
15
+ this.focused = false;
12
16
  this.initialised = false;
13
- console.debug('autofocusDirective created.');
17
+ this.everFocused = false;
18
+ //console.debug('autofocusDirective created.');
14
19
  }
15
20
  ngAfterViewInit() {
16
21
  this.initialised = true;
@@ -20,19 +25,20 @@ class AutofocusDirective {
20
25
  if (!this.initialised) {
21
26
  return;
22
27
  }
23
- const visible = !!this.el.nativeElement.offsetParent;
24
- if (visible && !this.lastVisible) {
25
- setTimeout(() => { this.el.nativeElement.focus(); }, 2); //no need to clearTimeout
28
+ if (this.toFocus && !this.everFocused && !this.focused) {
29
+ this.el.nativeElement.focus();
30
+ this.focused = true;
31
+ this.everFocused = true;
32
+ console.debug('focused now.');
26
33
  }
27
- this.lastVisible = visible;
28
34
  }
29
35
  set autofocus(condition) {
30
- this.lastVisible = condition !== false;
36
+ this.toFocus = condition !== false;
31
37
  }
32
38
  }
33
39
  AutofocusDirective.decorators = [
34
40
  { type: Directive, args: [{
35
- selector: '[autofocus]' // using [ ] means selecting attributes
41
+ selector: '[autofocus]'
36
42
  },] }
37
43
  ];
38
44
  AutofocusDirective.ctorParameters = () => [
@@ -42,38 +48,9 @@ AutofocusDirective.propDecorators = {
42
48
  autofocus: [{ type: Input }]
43
49
  };
44
50
 
45
- class HighlightDirective {
46
- constructor(el) {
47
- this.el = el;
48
- console.debug('HighlightDirective created.');
49
- }
50
- onMouseEnter() {
51
- this.highlight(this.highlightColor || this.defaultColor || 'red');
52
- }
53
- onMouseLeave() {
54
- this.highlight(undefined);
55
- }
56
- highlight(color) {
57
- this.el.nativeElement.style.backgroundColor = color;
58
- }
59
- }
60
- HighlightDirective.decorators = [
61
- { type: Directive, args: [{
62
- selector: '[myHighlight]'
63
- },] }
64
- ];
65
- HighlightDirective.ctorParameters = () => [
66
- { type: ElementRef }
67
- ];
68
- HighlightDirective.propDecorators = {
69
- defaultColor: [{ type: Input }],
70
- highlightColor: [{ type: Input, args: ['myHighlight',] }],
71
- onMouseEnter: [{ type: HostListener, args: ['mouseenter',] }],
72
- onMouseLeave: [{ type: HostListener, args: ['mouseleave',] }]
73
- };
74
-
75
51
  /**
76
- *
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.
77
54
  */
78
55
  class CurrencyFormatterDirective {
79
56
  constructor(elementRef) {
@@ -91,7 +68,8 @@ class CurrencyFormatterDirective {
91
68
  }
92
69
  }
93
70
  CurrencyFormatterDirective.decorators = [
94
- { type: Directive, args: [{ selector: '[currencyFormatter]' },] }
71
+ { type: Directive, args: [{ selector: '[currencyFormatter]' }, //inspired by https://blog.ngconsultant.io/custom-input-formatting-with-simple-directives-for-angular-2-ec792082976
72
+ ] }
95
73
  ];
96
74
  CurrencyFormatterDirective.ctorParameters = () => [
97
75
  { type: ElementRef }
@@ -101,56 +79,23 @@ CurrencyFormatterDirective.propDecorators = {
101
79
  onBlur: [{ type: HostListener, args: ['blur', ['$event.target.value'],] }]
102
80
  };
103
81
 
104
- /**
105
- *
106
- */
107
- class DatetimeFormatterDirective {
108
- constructor(elementRef) {
109
- this.elementRef = elementRef;
110
- //@Input('datetimeFormatter')
111
- this.format = 'DD/MM/YYYY HH:mm';
112
- this.formats = ['', 'DD/MM/YYYY HH:mm'];
113
- this.el = this.elementRef.nativeElement;
114
- }
115
- ngOnInit() {
116
- const s = this.parse(this.el.value);
117
- this.el.value = this.transform(s);
118
- }
119
- onFocus() {
120
- const s = this.parse(this.el.value);
121
- this.el.value = this.transform(s);
122
- }
123
- onBlur() {
124
- this.el.value = this.transform(this.el.value);
125
- }
126
- transform(value) {
127
- if (!value) {
128
- return '';
129
- }
130
- const s = moment(value).format(this.format);
131
- console.debug(`With format ${this.format} transform to ${s}`);
132
- return s;
133
- }
134
- parse(value) {
135
- if (!value) {
136
- return null;
137
- }
138
- const d = moment(value, this.formats).toDate();
139
- console.debug(`parse ${value} to ${d}`);
140
- return d;
82
+ class DataComponentDirective {
83
+ constructor(viewContainerRef) {
84
+ this.viewContainerRef = viewContainerRef;
141
85
  }
142
86
  }
143
- DatetimeFormatterDirective.decorators = [
144
- { type: Directive, args: [{ selector: '[datetimeFormatter]' },] }
145
- ];
146
- DatetimeFormatterDirective.ctorParameters = () => [
147
- { type: ElementRef }
87
+ DataComponentDirective.decorators = [
88
+ { type: Directive, args: [{
89
+ selector: '[dataComponentHost]',
90
+ },] }
148
91
  ];
149
- DatetimeFormatterDirective.propDecorators = {
150
- onFocus: [{ type: HostListener, args: ['focus', ['$event.target.value'],] }],
151
- onBlur: [{ type: HostListener, args: ['blur', ['$event.target.value'],] }]
152
- };
92
+ DataComponentDirective.ctorParameters = () => [
93
+ { type: ViewContainerRef }
94
+ ];
153
95
 
96
+ /**
97
+ * Scroll to element attached. And the element may be an Angular Material component too.
98
+ */
154
99
  class ScrollIntoDirective {
155
100
  constructor(el) {
156
101
  this.el = el;
@@ -175,20 +120,6 @@ ScrollIntoDirective.propDecorators = {
175
120
  scrollInto: [{ type: Input }]
176
121
  };
177
122
 
178
- class DataComponentDirective {
179
- constructor(viewContainerRef) {
180
- this.viewContainerRef = viewContainerRef;
181
- }
182
- }
183
- DataComponentDirective.decorators = [
184
- { type: Directive, args: [{
185
- selector: '[dataComponentHost]',
186
- },] }
187
- ];
188
- DataComponentDirective.ctorParameters = () => [
189
- { type: ViewContainerRef }
190
- ];
191
-
192
123
  /**
193
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.
194
125
  *
@@ -203,17 +134,13 @@ NmceDirectivesModule.decorators = [
203
134
  ],
204
135
  declarations: [
205
136
  AutofocusDirective,
206
- HighlightDirective,
207
137
  CurrencyFormatterDirective,
208
- DatetimeFormatterDirective,
209
138
  ScrollIntoDirective,
210
139
  DataComponentDirective,
211
140
  ],
212
141
  exports: [
213
142
  AutofocusDirective,
214
- HighlightDirective,
215
143
  CurrencyFormatterDirective,
216
- DatetimeFormatterDirective,
217
144
  ScrollIntoDirective,
218
145
  DataComponentDirective,
219
146
  ]
@@ -228,5 +155,5 @@ NmceDirectivesModule.decorators = [
228
155
  * Generated bundle index. Do not edit.
229
156
  */
230
157
 
231
- export { AutofocusDirective, CurrencyFormatterDirective, DataComponentDirective, DatetimeFormatterDirective, HighlightDirective, NmceDirectivesModule, ScrollIntoDirective };
158
+ export { AutofocusDirective, CurrencyFormatterDirective, DataComponentDirective, NmceDirectivesModule, ScrollIntoDirective };
232
159
  //# sourceMappingURL=nmce-directives.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nmce-directives.js","sources":["../../../projects/nmce-directives/src/_directives/autofocus.ts","../../../projects/nmce-directives/src/_directives/highlight.directive.ts","../../../projects/nmce-directives/src/_directives/currencyFormatter.directive.ts","../../../projects/nmce-directives/src/_directives/datetimeFormatter.directive.ts","../../../projects/nmce-directives/src/_directives/scrollInto.directive.ts","../../../projects/nmce-directives/src/_directives/dataComponent.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 { Directive, AfterViewInit, ElementRef, DoCheck, Input } from '@angular/core';\r\n\r\n\r\n// Simple example directive that fixes autofocus problem with multiple views, source: https://www.picnet.com.au/blogs/guido/post/2016/09/20/angular2-ng2-focus-directive/\r\n@Directive({\r\n\tselector: '[autofocus]' // using [ ] means selecting attributes\r\n})\r\n\r\nexport class AutofocusDirective implements AfterViewInit, DoCheck {\r\n\tprivate lastVisible = false;\r\n\tprivate initialised = false;\r\n\tconstructor(private el: ElementRef) {\r\n\t\tconsole.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\tconst visible = !!this.el.nativeElement.offsetParent;\r\n\t\tif (visible && !this.lastVisible) {\r\n\t\t\tsetTimeout(() => { this.el.nativeElement.focus(); }, 2); //no need to clearTimeout\r\n\t\t}\r\n\t\tthis.lastVisible = visible;\r\n\t}\r\n\r\n\t@Input() set autofocus(condition: boolean) {\r\n\t\tthis.lastVisible = condition !== false;\r\n\t}\r\n}\r\n","import { Directive, ElementRef, HostListener, Input } from '@angular/core';\r\n@Directive({\r\n\tselector: '[myHighlight]'\r\n})\r\nexport class HighlightDirective {\r\n\tconstructor(private el: ElementRef) {\r\n\t\tconsole.debug('HighlightDirective created.');\r\n\t}\r\n\r\n\t@Input() defaultColor?: string;\r\n\t@Input('myHighlight') highlightColor?: string;\r\n\t@HostListener('mouseenter') onMouseEnter() {\r\n\t\tthis.highlight(this.highlightColor || this.defaultColor || 'red');\r\n\t}\r\n\t@HostListener('mouseleave') onMouseLeave() {\r\n\t\tthis.highlight(undefined);\r\n\t}\r\n\tprivate highlight(color: string | undefined) {\r\n\t\tthis.el.nativeElement.style.backgroundColor = color;\r\n\t}\r\n}\r\n","import { Directive, HostListener, ElementRef, OnInit } from '@angular/core';\r\nimport { CurrencyFunc } from 'nmce-func';\r\n\r\n/**\r\n *\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, HostListener, ElementRef, OnInit } from '@angular/core';\r\nimport moment from 'moment';\r\n\r\n/**\r\n *\r\n */\r\n@Directive({ selector: '[datetimeFormatter]' })//inspired by https://blog.ngconsultant.io/custom-input-formatting-with-simple-directives-for-angular-2-ec792082976\r\nexport class DatetimeFormatterDirective implements OnInit {\r\n\r\n\tprivate el: HTMLInputElement;\r\n\r\n\t//@Input('datetimeFormatter')\r\n\tformat = 'DD/MM/YYYY HH:mm';\r\n\r\n\tformats = ['', 'DD/MM/YYYY HH:mm'];\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\tconst s = this.parse(this.el.value);\r\n\t\tthis.el.value = this.transform(s);\r\n\t}\r\n\r\n\t@HostListener('focus', ['$event.target.value'])\r\n\tonFocus() {\r\n\t\tconst s = this.parse(this.el.value);\r\n\t\tthis.el.value = this.transform(s);\r\n\t}\r\n\r\n\t@HostListener('blur', ['$event.target.value'])\r\n\tonBlur() {\r\n\t\tthis.el.value = this.transform(this.el.value);\r\n\t}\r\n\r\n\ttransform(value: Date | string | null): string {\r\n\t\tif (!value) {\r\n\t\t\treturn '';\r\n\t\t}\r\n\r\n\t\tconst s = moment(value).format(this.format);\r\n\t\tconsole.debug(`With format ${this.format} transform to ${s}`);\r\n\t\treturn s;\r\n\t}\r\n\r\n\tparse(value: string): Date | null {\r\n\t\tif (!value) {\r\n\t\t\treturn null;\r\n\t\t}\r\n\r\n\t\tconst d = moment(value, this.formats).toDate();\r\n\t\tconsole.debug(`parse ${value} to ${d}`);\r\n\t\treturn d;\r\n\t}\r\n\r\n}\r\n\r\n","import { AfterViewInit, Directive, ElementRef, Input } from '@angular/core';\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 { 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 { NgModule } from '@angular/core';\r\nimport { CommonModule } from '@angular/common';\r\nimport { FormsModule } from '@angular/forms';\r\n\r\n\r\nimport {\r\n\tAutofocusDirective, HighlightDirective, CurrencyFormatterDirective, DatetimeFormatterDirective, ScrollIntoDirective, DataComponentDirective,\r\n} from './index';\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\tHighlightDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tDatetimeFormatterDirective,\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\tHighlightDirective,\r\n\t\tCurrencyFormatterDirective,\r\n\t\tDatetimeFormatterDirective,\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":";;;;;;AAGA;MAKa,kBAAkB;IAG9B,YAAoB,EAAc;QAAd,OAAE,GAAF,EAAE,CAAY;QAF1B,gBAAW,GAAG,KAAK,CAAC;QACpB,gBAAW,GAAG,KAAK,CAAC;QAE3B,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;KAC7C;IAED,eAAe;QACd,IAAI,C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AS3C,KAAK;;;MCJM,sBAAsB;IAClC,YAAmB,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;KAAK;;;YAJ1D,SAAS,SAAC;gBACV,QAAQ,EAAE,qBAAqB;aAC/B;;;YAJmB,gBAAgB;;;ACSpC;;;;MA6Ba,oBAAoB;;;YAzBhC,QAAQ,SAAC;gBACT,OAAO,EAAE;oBACR,YAAY;oBACZ,WAAW;iBACX;gBAED,YAAY,EAAE;oBACb,kBAAkB;oBAClB,kBAAkB;oBAClB,0BAA0B;oBAC1B,0BAA0B;oBAC1B,mBAAmB;oBACnB,sBAAsB;iBACtB;gBAGD,OAAO,EAAE;oBACR,kBAAkB;oBAClB,kBAAkB;oBAClB,0BAA0B;oBAC1B,0BAA0B;oBAC1B,mBAAmB;oBACnB,sBAAsB;iBACtB;aACD;;;ACrCD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"nmce-directives.js","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;;;;;MAQa,kBAAkB;IAK9B,YAAoB,EAAc;QAAd,OAAE,GAAF,EAAE,CAAY;QAJ1B,YAAO,GAAG,KAAK,CAAC;QAChB,YAAO,GAAG,KAAK,CAAC;QAChB,gBAAW,GAAG,KAAK,CAAC;QACpB,gB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,EAAE;;;;YAP1B,UAAU;;;sBAoB5B,YAAY,SAAC,OAAO,EAAE,CAAC,qBAAqB,CAAC;qBAK7C,YAAY,SAAC,MAAM,EAAE,CAAC,qBAAqB,CAAC;;;MCpBjC,sBAAsB;IAClC,YAAmB,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;KAAK;;;YAJ1D,SAAS,SAAC;gBACV,QAAQ,EAAE,qBAAqB;aAC/B;;;YAJmB,gBAAgB;;;ACEpC;;;MAMa,mBAAmB;IAC/B,YAAoB,EAAc;QAAd,OAAE,GAAF,EAAE,CAAY;QAKlC,eAAU,GAAY,KAAK,CAAC;;KAH3B;IAKD,eAAe;QACd,IAAI,IAAI,CAAC,UAAU,EAAE;YACpB,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;SACvC;KACD;;;YAfD,SAAS,SAAC;gBACV,QAAQ,EAAE,cAAc;aACxB;;;YAPkC,UAAU;;;yBAa3C,KAAK;;;ACJP;;;;MAyBa,oBAAoB;;;YArBhC,QAAQ,SAAC;gBACT,OAAO,EAAE;oBACR,YAAY;oBACZ,WAAW;iBACX;gBAED,YAAY,EAAE;oBACb,kBAAkB;oBAClB,0BAA0B;oBAC1B,mBAAmB;oBACnB,sBAAsB;iBACtB;gBAGD,OAAO,EAAE;oBACR,kBAAkB;oBAClB,0BAA0B;oBAC1B,mBAAmB;oBACnB,sBAAsB;iBACtB;aACD;;;ACjCD;;;;ACAA;;;;;;"}
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"AutofocusDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":4,"character":1},"arguments":[{"selector":"[autofocus]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":11,"character":25}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"autofocus":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":29,"character":2}}]}]}},"HighlightDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":1,"character":1},"arguments":[{"selector":"[myHighlight]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":5,"character":25}]}],"defaultColor":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":9,"character":2}}]}],"highlightColor":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":2},"arguments":["myHighlight"]}]}],"onMouseEnter":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":11,"character":2},"arguments":["mouseenter"]}]}],"onMouseLeave":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":14,"character":2},"arguments":["mouseleave"]}]}],"highlight":[{"__symbolic":"method"}]}},"CurrencyFormatterDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":6,"character":1},"arguments":[{"selector":"[currencyFormatter]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":11,"character":33}]}],"ngOnInit":[{"__symbolic":"method"}],"onFocus":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":19,"character":2},"arguments":["focus",["$event.target.value"]]}]}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":24,"character":2},"arguments":["blur",["$event.target.value"]]}]}]}},"DatetimeFormatterDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":6,"character":1},"arguments":[{"selector":"[datetimeFormatter]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":16,"character":33}]}],"ngOnInit":[{"__symbolic":"method"}],"onFocus":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":25,"character":2},"arguments":["focus",["$event.target.value"]]}]}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":31,"character":2},"arguments":["blur",["$event.target.value"]]}]}],"transform":[{"__symbolic":"method"}],"parse":[{"__symbolic":"method"}]}},"ScrollIntoDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":1,"character":1},"arguments":[{"selector":"[scrollInto]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":5,"character":25}]}],"scrollInto":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":9,"character":2}}]}],"ngAfterViewInit":[{"__symbolic":"method"}]}},"DataComponentDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":2,"character":1},"arguments":[{"selector":"[dataComponentHost]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":6,"character":38}]}]}},"NmceDirectivesModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":13,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":15,"character":2},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":16,"character":2}],"declarations":[{"__symbolic":"reference","name":"AutofocusDirective"},{"__symbolic":"reference","name":"HighlightDirective"},{"__symbolic":"reference","name":"CurrencyFormatterDirective"},{"__symbolic":"reference","name":"DatetimeFormatterDirective"},{"__symbolic":"reference","name":"ScrollIntoDirective"},{"__symbolic":"reference","name":"DataComponentDirective"}],"exports":[{"__symbolic":"reference","name":"AutofocusDirective"},{"__symbolic":"reference","name":"HighlightDirective"},{"__symbolic":"reference","name":"CurrencyFormatterDirective"},{"__symbolic":"reference","name":"DatetimeFormatterDirective"},{"__symbolic":"reference","name":"ScrollIntoDirective"},{"__symbolic":"reference","name":"DataComponentDirective"}]}]}],"members":{}}},"origins":{"AutofocusDirective":"./_directives/autofocus","HighlightDirective":"./_directives/highlight.directive","CurrencyFormatterDirective":"./_directives/currencyFormatter.directive","DatetimeFormatterDirective":"./_directives/datetimeFormatter.directive","ScrollIntoDirective":"./_directives/scrollInto.directive","DataComponentDirective":"./_directives/dataComponent.directive","NmceDirectivesModule":"./_directives/directives.module"},"importAs":"nmce-directives"}
1
+ {"__symbolic":"module","version":4,"metadata":{"AutofocusDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":7,"character":1},"arguments":[{"selector":"[autofocus]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":15,"character":25}]}],"ngAfterViewInit":[{"__symbolic":"method"}],"ngDoCheck":[{"__symbolic":"method"}],"autofocus":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":2}}]}]}},"CurrencyFormatterDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":7,"character":1},"arguments":[{"selector":"[currencyFormatter]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":12,"character":33}]}],"ngOnInit":[{"__symbolic":"method"}],"onFocus":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":20,"character":2},"arguments":["focus",["$event.target.value"]]}]}],"onBlur":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":25,"character":2},"arguments":["blur",["$event.target.value"]]}]}]}},"DataComponentDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":2,"character":1},"arguments":[{"selector":"[dataComponentHost]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ViewContainerRef","line":6,"character":38}]}]}},"ScrollIntoDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":5,"character":1},"arguments":[{"selector":"[scrollInto]"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":9,"character":25}]}],"scrollInto":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":2}}]}],"ngAfterViewInit":[{"__symbolic":"method"}]}},"NmceDirectivesModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":13,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":15,"character":2},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":16,"character":2}],"declarations":[{"__symbolic":"reference","name":"AutofocusDirective"},{"__symbolic":"reference","name":"CurrencyFormatterDirective"},{"__symbolic":"reference","name":"ScrollIntoDirective"},{"__symbolic":"reference","name":"DataComponentDirective"}],"exports":[{"__symbolic":"reference","name":"AutofocusDirective"},{"__symbolic":"reference","name":"CurrencyFormatterDirective"},{"__symbolic":"reference","name":"ScrollIntoDirective"},{"__symbolic":"reference","name":"DataComponentDirective"}]}]}],"members":{}}},"origins":{"AutofocusDirective":"./_directives/autofocus","CurrencyFormatterDirective":"./_directives/currencyFormatter.directive","DataComponentDirective":"./_directives/dataComponent.directive","ScrollIntoDirective":"./_directives/scrollInto.directive","NmceDirectivesModule":"./_directives/directives.module"},"importAs":"nmce-directives"}
package/package.json CHANGED
@@ -1,12 +1,20 @@
1
1
  {
2
2
  "name": "nmce-directives",
3
- "version": "0.0.2",
3
+ "version": "0.0.7",
4
+ "author": {
5
+ "name": "Z"
6
+ },
7
+ "description": "Common simple Angular directives used in business applications.",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "url": "https://github.com/zijianhuang/nmce"
11
+ },
4
12
  "peerDependencies": {
5
- "@angular/common": "^11.2.5",
6
- "@angular/core": "^11.2.5"
13
+ "@angular/common": "^12.0.1",
14
+ "@angular/core": "^12.0.1"
7
15
  },
8
16
  "dependencies": {
9
- "tslib": "^2.0.0"
17
+ "tslib": "^2.2.0"
10
18
  },
11
19
  "main": "bundles/nmce-directives.umd.js",
12
20
  "module": "fesm2015/nmce-directives.js",
@@ -1,16 +0,0 @@
1
- import { ElementRef, OnInit } from '@angular/core';
2
- /**
3
- *
4
- */
5
- export declare class DatetimeFormatterDirective implements OnInit {
6
- private elementRef;
7
- private el;
8
- format: string;
9
- formats: string[];
10
- constructor(elementRef: ElementRef);
11
- ngOnInit(): void;
12
- onFocus(): void;
13
- onBlur(): void;
14
- transform(value: Date | string | null): string;
15
- parse(value: string): Date | null;
16
- }
@@ -1,10 +0,0 @@
1
- import { ElementRef } from '@angular/core';
2
- export declare class HighlightDirective {
3
- private el;
4
- constructor(el: ElementRef);
5
- defaultColor?: string;
6
- highlightColor?: string;
7
- onMouseEnter(): void;
8
- onMouseLeave(): void;
9
- private highlight;
10
- }
@@ -1,52 +0,0 @@
1
- import { Directive, HostListener, ElementRef } from '@angular/core';
2
- import moment from 'moment';
3
- /**
4
- *
5
- */
6
- export class DatetimeFormatterDirective {
7
- constructor(elementRef) {
8
- this.elementRef = elementRef;
9
- //@Input('datetimeFormatter')
10
- this.format = 'DD/MM/YYYY HH:mm';
11
- this.formats = ['', 'DD/MM/YYYY HH:mm'];
12
- this.el = this.elementRef.nativeElement;
13
- }
14
- ngOnInit() {
15
- const s = this.parse(this.el.value);
16
- this.el.value = this.transform(s);
17
- }
18
- onFocus() {
19
- const s = this.parse(this.el.value);
20
- this.el.value = this.transform(s);
21
- }
22
- onBlur() {
23
- this.el.value = this.transform(this.el.value);
24
- }
25
- transform(value) {
26
- if (!value) {
27
- return '';
28
- }
29
- const s = moment(value).format(this.format);
30
- console.debug(`With format ${this.format} transform to ${s}`);
31
- return s;
32
- }
33
- parse(value) {
34
- if (!value) {
35
- return null;
36
- }
37
- const d = moment(value, this.formats).toDate();
38
- console.debug(`parse ${value} to ${d}`);
39
- return d;
40
- }
41
- }
42
- DatetimeFormatterDirective.decorators = [
43
- { type: Directive, args: [{ selector: '[datetimeFormatter]' },] }
44
- ];
45
- DatetimeFormatterDirective.ctorParameters = () => [
46
- { type: ElementRef }
47
- ];
48
- DatetimeFormatterDirective.propDecorators = {
49
- onFocus: [{ type: HostListener, args: ['focus', ['$event.target.value'],] }],
50
- onBlur: [{ type: HostListener, args: ['blur', ['$event.target.value'],] }]
51
- };
52
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGF0ZXRpbWVGb3JtYXR0ZXIuZGlyZWN0aXZlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbm1jZS1kaXJlY3RpdmVzL3NyYy9fZGlyZWN0aXZlcy9kYXRldGltZUZvcm1hdHRlci5kaXJlY3RpdmUudHMiXSwibmFtZXMiOltdLCJtYXBwaW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snJGV2ZW50LnRhcmdldC52YWx1ZSddKVxyXG5cdG9uQmx1cigpIHtcclxuXHRcdHRoaXMuZWwudmFsdWUgPSB0aGlzLnRyYW5zZm9ybSh0aGlzLmVsLnZhbHVlKTtcclxuXHR9XHJcblxyXG5cdHRyYW5zZm9ybSh2YWx1ZTogRGF0ZSB8IHN0cmluZyB8IG51bGwpOiBzdHJpbmcge1xyXG5cdFx0aWYgKCF2YWx1ZSkge1xyXG5cdFx0XHRyZXR1cm4gJyc7XHJcblx0XHR9XHJcblxyXG5cdFx0Y29uc3QgcyA9IG1vbWVudCh2YWx1ZSkuZm9ybWF0KHRoaXMuZm9ybWF0KTtcclxuXHRcdGNvbnNvbGUuZGVidWcoYFdpdGggZm9ybWF0ICR7dGhpcy5mb3JtYXR9IHRyYW5zZm9ybSB0byAke3N9YCk7XHJcblx0XHRyZXR1cm4gcztcclxuXHR9XHJcblxyXG5cdHBhcnNlKHZhbHVlOiBzdHJpbmcpOiBEYXRlIHwgbnVsbCB7XHJcblx0XHRpZiAoIXZhbHVlKSB7XHJcblx0XHRcdHJldHVybiBudWxsO1xyXG5cdFx0fVxyXG5cclxuXHRcdGNvbnN0IGQgPSBtb21lbnQodmFsdWUsIHRoaXMuZm9ybWF0cykudG9EYXRlKCk7XHJcblx0XHRjb25zb2xlLmRlYnVnKGBwYXJzZSAke3ZhbHVlfSB0byAke2R9YCk7XHJcblx0XHRyZXR1cm4gZDtcclxuXHR9XHJcblxyXG59XHJcblxyXG4iXX0=
@@ -1,31 +0,0 @@
1
- import { Directive, ElementRef, HostListener, Input } from '@angular/core';
2
- export class HighlightDirective {
3
- constructor(el) {
4
- this.el = el;
5
- console.debug('HighlightDirective created.');
6
- }
7
- onMouseEnter() {
8
- this.highlight(this.highlightColor || this.defaultColor || 'red');
9
- }
10
- onMouseLeave() {
11
- this.highlight(undefined);
12
- }
13
- highlight(color) {
14
- this.el.nativeElement.style.backgroundColor = color;
15
- }
16
- }
17
- HighlightDirective.decorators = [
18
- { type: Directive, args: [{
19
- selector: '[myHighlight]'
20
- },] }
21
- ];
22
- HighlightDirective.ctorParameters = () => [
23
- { type: ElementRef }
24
- ];
25
- HighlightDirective.propDecorators = {
26
- defaultColor: [{ type: Input }],
27
- highlightColor: [{ type: Input, args: ['myHighlight',] }],
28
- onMouseEnter: [{ type: HostListener, args: ['mouseenter',] }],
29
- onMouseLeave: [{ type: HostListener, args: ['mouseleave',] }]
30
- };
31
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGlnaGxpZ2h0LmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL25tY2UtZGlyZWN0aXZlcy9zcmMvX2RpcmVjdGl2ZXMvaGlnaGxpZ2h0LmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLFVBQVUsRUFBRSxZQUFZLEVBQUUsS0FBSyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBSTNFLE1BQU0sT0FBTyxrQkFBa0I7SUFDOUIsWUFBb0IsRUFBYztRQUFkLE9BQUUsR0FBRixFQUFFLENBQVk7UUFDakMsT0FBTyxDQUFDLEtBQUssQ0FBQyw2QkFBNkIsQ0FBQyxDQUFDO0lBQzlDLENBQUM7SUFJMkIsWUFBWTtRQUN2QyxJQUFJLENBQUMsU0FBUyxDQUFDLElBQUksQ0FBQyxjQUFjLElBQUksSUFBSSxDQUFDLFlBQVksSUFBSSxLQUFLLENBQUMsQ0FBQztJQUNuRSxDQUFDO0lBQzJCLFlBQVk7UUFDdkMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxTQUFTLENBQUMsQ0FBQztJQUMzQixDQUFDO0lBQ08sU0FBUyxDQUFDLEtBQXlCO1FBQzFDLElBQUksQ0FBQyxFQUFFLENBQUMsYUFBYSxDQUFDLEtBQU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