nmce-directives 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/_directives/autofocus.d.ts +20 -20
- package/_directives/currencyFormatter.directive.d.ts +16 -16
- package/_directives/dataComponent.directive.d.ts +8 -8
- package/_directives/directives.module.d.ts +16 -16
- package/_directives/index.d.ts +4 -4
- package/_directives/scrollInto.directive.d.ts +13 -13
- package/esm2022/_directives/autofocus.mjs +47 -0
- package/esm2022/_directives/currencyFormatter.directive.mjs +37 -0
- package/esm2022/_directives/dataComponent.directive.mjs +17 -0
- package/{esm2020 → esm2022}/_directives/directives.module.mjs +44 -44
- package/{esm2020 → esm2022}/_directives/index.mjs +4 -4
- package/esm2022/_directives/scrollInto.directive.mjs +29 -0
- package/{esm2020 → esm2022}/nmce-directives.mjs +4 -4
- package/{esm2020 → esm2022}/public-api.mjs +6 -6
- package/{fesm2015 → fesm2022}/nmce-directives.mjs +154 -149
- package/{fesm2020 → fesm2022}/nmce-directives.mjs.map +1 -1
- package/index.d.ts +5 -5
- package/package.json +5 -15
- package/public-api.d.ts +2 -2
- package/esm2020/_directives/autofocus.mjs +0 -46
- package/esm2020/_directives/currencyFormatter.directive.mjs +0 -35
- package/esm2020/_directives/dataComponent.directive.mjs +0 -16
- package/esm2020/_directives/scrollInto.directive.mjs +0 -28
- package/fesm2015/nmce-directives.mjs.map +0 -1
- package/fesm2020/nmce-directives.mjs +0 -171
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Input, HostListener, NgModule } from '@angular/core';
|
|
3
|
-
import { CurrencyFunc } from 'nmce-func';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import { FormsModule } from '@angular/forms';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Use as a parametered input parameter in html element.
|
|
9
|
-
* When used inside a material dialog, this directive may be at odd against the autofocus config parameter of MatDialogConfig,
|
|
10
|
-
* if the autofocus config is not false. Generally speaking, no need to use this directive in a component presented in a mateiral dialog.
|
|
11
|
-
*/
|
|
12
|
-
class AutofocusDirective {
|
|
13
|
-
constructor(el) {
|
|
14
|
-
this.el = el;
|
|
15
|
-
this.toFocus = false;
|
|
16
|
-
this.focused = false;
|
|
17
|
-
this.initialised = false;
|
|
18
|
-
this.everFocused = false;
|
|
19
|
-
//console.debug('autofocusDirective created.');
|
|
20
|
-
}
|
|
21
|
-
ngAfterViewInit() {
|
|
22
|
-
this.initialised = true;
|
|
23
|
-
this.ngDoCheck();
|
|
24
|
-
}
|
|
25
|
-
ngDoCheck() {
|
|
26
|
-
if (!this.initialised) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
if (this.toFocus && !this.everFocused && !this.focused) {
|
|
30
|
-
this.el.nativeElement.focus();
|
|
31
|
-
this.focused = true;
|
|
32
|
-
this.everFocused = true;
|
|
33
|
-
console.debug('focused now.');
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
set autofocus(condition) {
|
|
37
|
-
this.toFocus = condition !== false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
AutofocusDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AutofocusDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
41
|
-
AutofocusDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: AutofocusDirective, selector: "[autofocus]", inputs: { autofocus: "autofocus" }, ngImport: i0 });
|
|
42
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AutofocusDirective, decorators: [{
|
|
43
|
-
type: Directive,
|
|
44
|
-
args: [{
|
|
45
|
-
selector: '[autofocus]'
|
|
46
|
-
}]
|
|
47
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { autofocus: [{
|
|
48
|
-
type: Input
|
|
49
|
-
}] } });
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Decorate HTML input for inputing and displaying currency. The input type must not be number and should be text only.
|
|
53
|
-
* If the input type is number, the built-in validator will be fighting against this directive.
|
|
54
|
-
*/
|
|
55
|
-
class CurrencyFormatterDirective {
|
|
56
|
-
constructor(elementRef) {
|
|
57
|
-
this.elementRef = elementRef;
|
|
58
|
-
this.el = this.elementRef.nativeElement;
|
|
59
|
-
}
|
|
60
|
-
ngOnInit() {
|
|
61
|
-
this.el.value = CurrencyFunc.transformCurrency(this.el.value);
|
|
62
|
-
}
|
|
63
|
-
onFocus(value) {
|
|
64
|
-
this.el.value = CurrencyFunc.parseCurrency(value); // opossite of transform
|
|
65
|
-
}
|
|
66
|
-
onBlur(value) {
|
|
67
|
-
this.el.value = CurrencyFunc.transformCurrency(value);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
CurrencyFormatterDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CurrencyFormatterDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
71
|
-
CurrencyFormatterDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: CurrencyFormatterDirective, selector: "[currencyFormatter]", host: { listeners: { "focus": "onFocus($event.target.value)", "blur": "onBlur($event.target.value)" } }, ngImport: i0 });
|
|
72
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CurrencyFormatterDirective, decorators: [{
|
|
73
|
-
type: Directive,
|
|
74
|
-
args: [{ selector: '[currencyFormatter]' }]
|
|
75
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { onFocus: [{
|
|
76
|
-
type: HostListener,
|
|
77
|
-
args: ['focus', ['$event.target.value']]
|
|
78
|
-
}], onBlur: [{
|
|
79
|
-
type: HostListener,
|
|
80
|
-
args: ['blur', ['$event.target.value']]
|
|
81
|
-
}] } });
|
|
82
|
-
|
|
83
|
-
class DataComponentDirective {
|
|
84
|
-
constructor(viewContainerRef) {
|
|
85
|
-
this.viewContainerRef = viewContainerRef;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
DataComponentDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DataComponentDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
89
|
-
DataComponentDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: DataComponentDirective, selector: "[dataComponentHost]", ngImport: i0 });
|
|
90
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DataComponentDirective, decorators: [{
|
|
91
|
-
type: Directive,
|
|
92
|
-
args: [{
|
|
93
|
-
selector: '[dataComponentHost]',
|
|
94
|
-
}]
|
|
95
|
-
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Scroll to element attached. And the element may be an Angular Material component too.
|
|
99
|
-
*/
|
|
100
|
-
class ScrollIntoDirective {
|
|
101
|
-
constructor(el) {
|
|
102
|
-
this.el = el;
|
|
103
|
-
this.scrollInto = false;
|
|
104
|
-
// console.debug('ScrollIntoDirective created.');
|
|
105
|
-
}
|
|
106
|
-
ngAfterViewInit() {
|
|
107
|
-
if (this.scrollInto) {
|
|
108
|
-
this.el.nativeElement.scrollIntoView();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
ScrollIntoDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ScrollIntoDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
113
|
-
ScrollIntoDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: ScrollIntoDirective, selector: "[scrollInto]", inputs: { scrollInto: "scrollInto" }, ngImport: i0 });
|
|
114
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ScrollIntoDirective, decorators: [{
|
|
115
|
-
type: Directive,
|
|
116
|
-
args: [{
|
|
117
|
-
selector: '[scrollInto]'
|
|
118
|
-
}]
|
|
119
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { scrollInto: [{
|
|
120
|
-
type: Input
|
|
121
|
-
}] } });
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Contain components. Other feature/lazy modules that need to access custom html element of components like my-datetimepicker still need to import this module explicitly.
|
|
125
|
-
*
|
|
126
|
-
*/
|
|
127
|
-
class NmceDirectivesModule {
|
|
128
|
-
}
|
|
129
|
-
NmceDirectivesModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NmceDirectivesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
130
|
-
NmceDirectivesModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: NmceDirectivesModule, declarations: [AutofocusDirective,
|
|
131
|
-
CurrencyFormatterDirective,
|
|
132
|
-
ScrollIntoDirective,
|
|
133
|
-
DataComponentDirective], imports: [CommonModule,
|
|
134
|
-
FormsModule], exports: [AutofocusDirective,
|
|
135
|
-
CurrencyFormatterDirective,
|
|
136
|
-
ScrollIntoDirective,
|
|
137
|
-
DataComponentDirective] });
|
|
138
|
-
NmceDirectivesModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NmceDirectivesModule, imports: [CommonModule,
|
|
139
|
-
FormsModule] });
|
|
140
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: NmceDirectivesModule, decorators: [{
|
|
141
|
-
type: NgModule,
|
|
142
|
-
args: [{
|
|
143
|
-
imports: [
|
|
144
|
-
CommonModule,
|
|
145
|
-
FormsModule,
|
|
146
|
-
],
|
|
147
|
-
declarations: [
|
|
148
|
-
AutofocusDirective,
|
|
149
|
-
CurrencyFormatterDirective,
|
|
150
|
-
ScrollIntoDirective,
|
|
151
|
-
DataComponentDirective,
|
|
152
|
-
],
|
|
153
|
-
exports: [
|
|
154
|
-
AutofocusDirective,
|
|
155
|
-
CurrencyFormatterDirective,
|
|
156
|
-
ScrollIntoDirective,
|
|
157
|
-
DataComponentDirective,
|
|
158
|
-
]
|
|
159
|
-
}]
|
|
160
|
-
}] });
|
|
161
|
-
|
|
162
|
-
/*
|
|
163
|
-
* Public API Surface of nmce-directives
|
|
164
|
-
*/
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Generated bundle index. Do not edit.
|
|
168
|
-
*/
|
|
169
|
-
|
|
170
|
-
export { AutofocusDirective, CurrencyFormatterDirective, DataComponentDirective, NmceDirectivesModule, ScrollIntoDirective };
|
|
171
|
-
//# sourceMappingURL=nmce-directives.mjs.map
|