@experteam-mx/ngx-input-number 20.0.1 → 22.0.0-dev2.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.
|
@@ -1,337 +1,435 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { Injectable, InjectionToken,
|
|
3
|
-
import { BehaviorSubject } from
|
|
4
|
-
import * as
|
|
5
|
-
import { IMaskDirective, IMaskModule } from
|
|
6
|
-
import * as
|
|
7
|
-
import { FormsModule, ReactiveFormsModule } from
|
|
8
|
-
import { CommonModule } from
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
radixPoint;
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectorRef, Component, Inject, Injectable, InjectionToken, Input, NgModule, Optional, ViewChild, inject } from "@angular/core";
|
|
3
|
+
import { BehaviorSubject } from "rxjs";
|
|
4
|
+
import * as i2 from "angular-imask";
|
|
5
|
+
import { IMaskDirective, IMaskModule } from "angular-imask";
|
|
6
|
+
import * as i1 from "@angular/forms";
|
|
7
|
+
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
|
|
8
|
+
import { CommonModule } from "@angular/common";
|
|
9
|
+
var inputConfigs = class {
|
|
10
|
+
groupSeparator;
|
|
11
|
+
radixPoint;
|
|
13
12
|
};
|
|
14
|
-
class typesProvider {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: defaultTypesProvider, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
31
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: defaultTypesProvider, providedIn: 'root' });
|
|
32
|
-
}
|
|
33
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: defaultTypesProvider, decorators: [{
|
|
34
|
-
type: Injectable,
|
|
35
|
-
args: [{ providedIn: 'root' }]
|
|
36
|
-
}] });
|
|
37
|
-
let inputConfigsHelp$1 = class inputConfigsHelp {
|
|
38
|
-
config;
|
|
13
|
+
var typesProvider = class typesProvider {
|
|
14
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
15
|
+
minVersion: "12.0.0",
|
|
16
|
+
version: "22.2.3",
|
|
17
|
+
ngImport: i0,
|
|
18
|
+
type: typesProvider,
|
|
19
|
+
deps: [],
|
|
20
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
21
|
+
});
|
|
22
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
23
|
+
minVersion: "12.0.0",
|
|
24
|
+
version: "22.2.3",
|
|
25
|
+
ngImport: i0,
|
|
26
|
+
type: typesProvider,
|
|
27
|
+
providedIn: "root"
|
|
28
|
+
});
|
|
39
29
|
};
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
31
|
+
minVersion: "12.0.0",
|
|
32
|
+
version: "22.2.3",
|
|
33
|
+
ngImport: i0,
|
|
34
|
+
type: typesProvider,
|
|
35
|
+
decorators: [{
|
|
36
|
+
type: Injectable,
|
|
37
|
+
args: [{ providedIn: "root" }]
|
|
38
|
+
}]
|
|
39
|
+
});
|
|
40
|
+
var defaultTypesProvider = class defaultTypesProvider extends typesProvider {
|
|
41
|
+
get config() {
|
|
42
|
+
return {
|
|
43
|
+
groupSeparator: ",",
|
|
44
|
+
radixPoint: "."
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
48
|
+
minVersion: "12.0.0",
|
|
49
|
+
version: "22.2.3",
|
|
50
|
+
ngImport: i0,
|
|
51
|
+
type: defaultTypesProvider,
|
|
52
|
+
deps: null,
|
|
53
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
54
|
+
});
|
|
55
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
56
|
+
minVersion: "12.0.0",
|
|
57
|
+
version: "22.2.3",
|
|
58
|
+
ngImport: i0,
|
|
59
|
+
type: defaultTypesProvider,
|
|
60
|
+
providedIn: "root"
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
64
|
+
minVersion: "12.0.0",
|
|
65
|
+
version: "22.2.3",
|
|
66
|
+
ngImport: i0,
|
|
67
|
+
type: defaultTypesProvider,
|
|
68
|
+
decorators: [{
|
|
69
|
+
type: Injectable,
|
|
70
|
+
args: [{ providedIn: "root" }]
|
|
71
|
+
}]
|
|
72
|
+
});
|
|
73
|
+
var inputConfigsHelp = class {
|
|
74
|
+
config;
|
|
75
|
+
};
|
|
76
|
+
const INPUT_CONFIG_TOKEN = new InjectionToken("INPUT_CONFIG");
|
|
77
|
+
var NgxInputNumberService = class NgxInputNumberService {
|
|
78
|
+
config;
|
|
79
|
+
changeEvent = new BehaviorSubject(false);
|
|
80
|
+
groupSeparator = ",";
|
|
81
|
+
radixPoint = ".";
|
|
82
|
+
lblKeyInvalid = "Please enter a valid amount";
|
|
83
|
+
negative = true;
|
|
84
|
+
max = 1e33;
|
|
85
|
+
decimals = 2;
|
|
86
|
+
constructor(config) {
|
|
87
|
+
this.config = config;
|
|
88
|
+
if (config != null) {
|
|
89
|
+
this.groupSeparator = config.groupSeparator;
|
|
90
|
+
this.radixPoint = config.radixPoint;
|
|
91
|
+
this.lblKeyInvalid = config.lblKeyInvalid;
|
|
92
|
+
this.negative = config.negative;
|
|
93
|
+
this.max = config.max;
|
|
94
|
+
this.decimals = config.decimals;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
onChangeParams(config) {
|
|
98
|
+
if (config.groupSeparator) this.groupSeparator = config.groupSeparator;
|
|
99
|
+
if (config.radixPoint) this.radixPoint = config.radixPoint;
|
|
100
|
+
if (config.lblKeyInvalid) this.lblKeyInvalid = config.lblKeyInvalid;
|
|
101
|
+
if (config.negative !== void 0) this.negative = config.negative;
|
|
102
|
+
if (config.max) this.max = config.max;
|
|
103
|
+
this.decimals = config.decimals ?? 2;
|
|
104
|
+
this.changeEvent.next(true);
|
|
105
|
+
}
|
|
106
|
+
getChangeEvent() {
|
|
107
|
+
return this.changeEvent;
|
|
108
|
+
}
|
|
109
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
110
|
+
minVersion: "12.0.0",
|
|
111
|
+
version: "22.2.3",
|
|
112
|
+
ngImport: i0,
|
|
113
|
+
type: NgxInputNumberService,
|
|
114
|
+
deps: [{
|
|
115
|
+
token: INPUT_CONFIG_TOKEN,
|
|
116
|
+
optional: true
|
|
117
|
+
}],
|
|
118
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
119
|
+
});
|
|
120
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
121
|
+
minVersion: "12.0.0",
|
|
122
|
+
version: "22.2.3",
|
|
123
|
+
ngImport: i0,
|
|
124
|
+
type: NgxInputNumberService,
|
|
125
|
+
providedIn: "root"
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
129
|
+
minVersion: "12.0.0",
|
|
130
|
+
version: "22.2.3",
|
|
131
|
+
ngImport: i0,
|
|
132
|
+
type: NgxInputNumberService,
|
|
133
|
+
decorators: [{
|
|
134
|
+
type: Injectable,
|
|
135
|
+
args: [{ providedIn: "root" }]
|
|
136
|
+
}],
|
|
137
|
+
ctorParameters: () => [{
|
|
138
|
+
type: void 0,
|
|
139
|
+
decorators: [{ type: Optional }, {
|
|
140
|
+
type: Inject,
|
|
141
|
+
args: [INPUT_CONFIG_TOKEN]
|
|
142
|
+
}]
|
|
143
|
+
}]
|
|
144
|
+
});
|
|
145
|
+
var NgxInputNumberComponent = class NgxInputNumberComponent {
|
|
146
|
+
inputElement;
|
|
147
|
+
iMaskDir;
|
|
148
|
+
control;
|
|
149
|
+
negative;
|
|
150
|
+
autofocus = false;
|
|
151
|
+
decimals;
|
|
152
|
+
max;
|
|
153
|
+
idForLabel = "";
|
|
154
|
+
tabIndex;
|
|
155
|
+
addClass = "form-control-sm";
|
|
156
|
+
groupSeparator;
|
|
157
|
+
radixPoint;
|
|
158
|
+
lblKeyInvalid;
|
|
159
|
+
lblKeyInvalidRender;
|
|
160
|
+
imask;
|
|
161
|
+
placeholder = "0";
|
|
162
|
+
resetControl = false;
|
|
163
|
+
prevValue = "";
|
|
164
|
+
validateError = false;
|
|
165
|
+
_ChangeDetectorRef = inject(ChangeDetectorRef);
|
|
166
|
+
_NgxInputNumberService = inject(NgxInputNumberService);
|
|
167
|
+
ngAfterViewInit() {
|
|
168
|
+
this.iMaskDir.maskRef?.updateValue();
|
|
169
|
+
if (this.autofocus) setTimeout(() => {
|
|
170
|
+
this.inputElement.nativeElement.focus();
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
render() {
|
|
174
|
+
this._ChangeDetectorRef.detectChanges();
|
|
175
|
+
this.lblKeyInvalidRender = this._NgxInputNumberService.lblKeyInvalid;
|
|
176
|
+
this.imask = {
|
|
177
|
+
mask: Number,
|
|
178
|
+
scale: this._NgxInputNumberService.decimals,
|
|
179
|
+
thousandsSeparator: this._NgxInputNumberService.groupSeparator,
|
|
180
|
+
padFractionalZeros: true,
|
|
181
|
+
normalizeZeros: true,
|
|
182
|
+
radix: this._NgxInputNumberService.radixPoint,
|
|
183
|
+
max: this._NgxInputNumberService.max,
|
|
184
|
+
min: this._NgxInputNumberService.negative ? -1e33 : 0,
|
|
185
|
+
format: (x) => {
|
|
186
|
+
if (typeof x !== "string" && x === null && !this.resetControl) {
|
|
187
|
+
this.resetControl = true;
|
|
188
|
+
this.inputElement.nativeElement.value = null;
|
|
189
|
+
this.iMaskDir.maskRef?.updateValue();
|
|
190
|
+
setTimeout(() => {
|
|
191
|
+
this.iMaskDir.maskRef?.updateControl();
|
|
192
|
+
this.control.setValue(null);
|
|
193
|
+
this.resetControl = false;
|
|
194
|
+
});
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
return Number(x).toFixed(this.imask.scale);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
if (this.lblKeyInvalid !== void 0) this.lblKeyInvalidRender = this.lblKeyInvalid;
|
|
201
|
+
if (this.negative !== void 0) this.imask.min = this.negative ? -1e33 : 0;
|
|
202
|
+
if (this.max !== void 0) this.imask.max = this.max;
|
|
203
|
+
if (this.groupSeparator !== void 0) this.imask.thousandsSeparator = this.groupSeparator;
|
|
204
|
+
if (this.radixPoint !== void 0) this.imask.radix = this.radixPoint;
|
|
205
|
+
if (this.decimals !== void 0) this.imask.scale = this.decimals;
|
|
206
|
+
setTimeout(() => {
|
|
207
|
+
if (this.inputElement.nativeElement.value === "" && (this.control.value === null || this.control.value === "" || this.control.value === 0)) this.control.setValue("");
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
ngOnInit() {
|
|
211
|
+
this._NgxInputNumberService.getChangeEvent().subscribe((configs) => {
|
|
212
|
+
if (configs) this.render();
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
ngOnChanges() {
|
|
216
|
+
this.render();
|
|
217
|
+
}
|
|
218
|
+
onKeydown(e) {
|
|
219
|
+
this.prevValue = e.target.value;
|
|
220
|
+
}
|
|
221
|
+
onBlur() {
|
|
222
|
+
this.validateError = false;
|
|
223
|
+
}
|
|
224
|
+
onFocus() {
|
|
225
|
+
setTimeout(() => {
|
|
226
|
+
this.validateError = true;
|
|
227
|
+
}, 1e3);
|
|
228
|
+
}
|
|
229
|
+
onKeyup(e) {
|
|
230
|
+
if (!this.validateError) return;
|
|
231
|
+
const scapeKeys = [
|
|
232
|
+
"ArrowLeft",
|
|
233
|
+
"ArrowRight",
|
|
234
|
+
"ArrowUp",
|
|
235
|
+
"ArrowDown",
|
|
236
|
+
"Escape",
|
|
237
|
+
"Backspace",
|
|
238
|
+
"Delete",
|
|
239
|
+
".",
|
|
240
|
+
",",
|
|
241
|
+
"-",
|
|
242
|
+
"Tab"
|
|
243
|
+
];
|
|
244
|
+
if (e.target.value === "" && !scapeKeys.includes(e.key)) this.control.setValue("");
|
|
245
|
+
if (!scapeKeys.includes(e.key) && this.prevValue === e.target.value && e.key !== this.prevValue) {
|
|
246
|
+
this.inputElement.nativeElement.classList.add("key-invalid");
|
|
247
|
+
setTimeout(() => {
|
|
248
|
+
this.inputElement.nativeElement.classList.remove("key-invalid");
|
|
249
|
+
}, 1e3);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
253
|
+
minVersion: "12.0.0",
|
|
254
|
+
version: "22.2.3",
|
|
255
|
+
ngImport: i0,
|
|
256
|
+
type: NgxInputNumberComponent,
|
|
257
|
+
deps: [],
|
|
258
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
259
|
+
});
|
|
260
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
261
|
+
minVersion: "14.0.0",
|
|
262
|
+
version: "22.2.3",
|
|
263
|
+
type: NgxInputNumberComponent,
|
|
264
|
+
isStandalone: false,
|
|
265
|
+
selector: "app-input-number",
|
|
266
|
+
inputs: {
|
|
267
|
+
control: "control",
|
|
268
|
+
negative: "negative",
|
|
269
|
+
autofocus: "autofocus",
|
|
270
|
+
decimals: "decimals",
|
|
271
|
+
max: "max",
|
|
272
|
+
idForLabel: "idForLabel",
|
|
273
|
+
tabIndex: "tabIndex",
|
|
274
|
+
addClass: "addClass",
|
|
275
|
+
groupSeparator: "groupSeparator",
|
|
276
|
+
radixPoint: "radixPoint",
|
|
277
|
+
lblKeyInvalid: "lblKeyInvalid"
|
|
278
|
+
},
|
|
279
|
+
viewQueries: [{
|
|
280
|
+
propertyName: "inputElement",
|
|
281
|
+
first: true,
|
|
282
|
+
predicate: ["inputElement"],
|
|
283
|
+
descendants: true
|
|
284
|
+
}, {
|
|
285
|
+
propertyName: "iMaskDir",
|
|
286
|
+
first: true,
|
|
287
|
+
predicate: IMaskDirective,
|
|
288
|
+
descendants: true
|
|
289
|
+
}],
|
|
290
|
+
usesOnChanges: true,
|
|
291
|
+
ngImport: i0,
|
|
292
|
+
template: "<div class=\"position-relative\">\n <input\n #inputElement\n type=\"text\"\n class=\"text-end form-control {{ addClass }}\"\n [class.is-invalid]=\"control.touched && control.invalid\"\n [formControl]=\"control\"\n [tabindex]=\"tabIndex\"\n [id]=\"idForLabel\"\n [imask]=\"imask\"\n [unmask]=\"'typed'\"\n (keyup)=\"onKeyup($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n (focus)=\"onFocus()\"\n >\n <label class=\"lbl-key-invalid position-absolute top-100 end-0 p-2 d-none\" [innerHTML]=\"lblKeyInvalidRender\"></label>\n</div>\n",
|
|
293
|
+
styles: ["input.key-invalid{border-color:#dc3545!important;box-shadow:0 0 0 .25rem #dc354540!important}input.key-invalid+.lbl-key-invalid{background-color:#dc3545;color:#fff;display:block!important;z-index:1}\n"],
|
|
294
|
+
dependencies: [
|
|
295
|
+
{
|
|
296
|
+
kind: "directive",
|
|
297
|
+
type: i1.DefaultValueAccessor,
|
|
298
|
+
selector: "input:not([type=checkbox]):not([ngNoCva])[formControlName],textarea:not([ngNoCva])[formControlName],input:not([type=checkbox]):not([ngNoCva])[formControl],textarea:not([ngNoCva])[formControl],input:not([type=checkbox]):not([ngNoCva])[ngModel],textarea:not([ngNoCva])[ngModel],[ngDefaultControl]"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
kind: "directive",
|
|
302
|
+
type: i1.NgControlStatus,
|
|
303
|
+
selector: "[formControlName],[ngModel],[formControl]"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
kind: "directive",
|
|
307
|
+
type: i1.FormControlDirective,
|
|
308
|
+
selector: "[formControl]",
|
|
309
|
+
inputs: [
|
|
310
|
+
"formControl",
|
|
311
|
+
"disabled",
|
|
312
|
+
"ngModel"
|
|
313
|
+
],
|
|
314
|
+
outputs: ["ngModelChange"],
|
|
315
|
+
exportAs: ["ngForm"]
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
kind: "directive",
|
|
319
|
+
type: i2.IMaskDirective,
|
|
320
|
+
selector: "[imask]",
|
|
321
|
+
inputs: [
|
|
322
|
+
"imask",
|
|
323
|
+
"unmask",
|
|
324
|
+
"imaskElement"
|
|
325
|
+
],
|
|
326
|
+
outputs: ["accept", "complete"],
|
|
327
|
+
exportAs: ["imask"]
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
});
|
|
331
|
+
};
|
|
332
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
333
|
+
minVersion: "12.0.0",
|
|
334
|
+
version: "22.2.3",
|
|
335
|
+
ngImport: i0,
|
|
336
|
+
type: NgxInputNumberComponent,
|
|
337
|
+
decorators: [{
|
|
338
|
+
type: Component,
|
|
339
|
+
args: [{
|
|
340
|
+
selector: "app-input-number",
|
|
341
|
+
standalone: false,
|
|
342
|
+
template: "<div class=\"position-relative\">\n <input\n #inputElement\n type=\"text\"\n class=\"text-end form-control {{ addClass }}\"\n [class.is-invalid]=\"control.touched && control.invalid\"\n [formControl]=\"control\"\n [tabindex]=\"tabIndex\"\n [id]=\"idForLabel\"\n [imask]=\"imask\"\n [unmask]=\"'typed'\"\n (keyup)=\"onKeyup($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n (focus)=\"onFocus()\"\n >\n <label class=\"lbl-key-invalid position-absolute top-100 end-0 p-2 d-none\" [innerHTML]=\"lblKeyInvalidRender\"></label>\n</div>\n",
|
|
343
|
+
styles: ["input.key-invalid{border-color:#dc3545!important;box-shadow:0 0 0 .25rem #dc354540!important}input.key-invalid+.lbl-key-invalid{background-color:#dc3545;color:#fff;display:block!important;z-index:1}\n"]
|
|
344
|
+
}]
|
|
345
|
+
}],
|
|
346
|
+
propDecorators: {
|
|
347
|
+
inputElement: [{
|
|
348
|
+
type: ViewChild,
|
|
349
|
+
args: ["inputElement"]
|
|
350
|
+
}],
|
|
351
|
+
iMaskDir: [{
|
|
352
|
+
type: ViewChild,
|
|
353
|
+
args: [IMaskDirective, { static: false }]
|
|
354
|
+
}],
|
|
355
|
+
control: [{ type: Input }],
|
|
356
|
+
negative: [{ type: Input }],
|
|
357
|
+
autofocus: [{ type: Input }],
|
|
358
|
+
decimals: [{ type: Input }],
|
|
359
|
+
max: [{ type: Input }],
|
|
360
|
+
idForLabel: [{ type: Input }],
|
|
361
|
+
tabIndex: [{ type: Input }],
|
|
362
|
+
addClass: [{ type: Input }],
|
|
363
|
+
groupSeparator: [{ type: Input }],
|
|
364
|
+
radixPoint: [{ type: Input }],
|
|
365
|
+
lblKeyInvalid: [{ type: Input }]
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
var NgxInputNumberModule = class NgxInputNumberModule {
|
|
369
|
+
static forRoot(config = {}) {
|
|
370
|
+
return {
|
|
371
|
+
ngModule: NgxInputNumberModule,
|
|
372
|
+
providers: [config.config || {
|
|
373
|
+
provide: typesProvider,
|
|
374
|
+
useClass: defaultTypesProvider
|
|
375
|
+
}]
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
379
|
+
minVersion: "12.0.0",
|
|
380
|
+
version: "22.2.3",
|
|
381
|
+
ngImport: i0,
|
|
382
|
+
type: NgxInputNumberModule,
|
|
383
|
+
deps: [],
|
|
384
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
385
|
+
});
|
|
386
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
387
|
+
minVersion: "14.0.0",
|
|
388
|
+
version: "22.2.3",
|
|
389
|
+
ngImport: i0,
|
|
390
|
+
type: NgxInputNumberModule,
|
|
391
|
+
declarations: [NgxInputNumberComponent],
|
|
392
|
+
imports: [
|
|
393
|
+
CommonModule,
|
|
394
|
+
FormsModule,
|
|
395
|
+
ReactiveFormsModule,
|
|
396
|
+
IMaskModule
|
|
397
|
+
],
|
|
398
|
+
exports: [NgxInputNumberComponent]
|
|
399
|
+
});
|
|
400
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
401
|
+
minVersion: "12.0.0",
|
|
402
|
+
version: "22.2.3",
|
|
403
|
+
ngImport: i0,
|
|
404
|
+
type: NgxInputNumberModule,
|
|
405
|
+
imports: [
|
|
406
|
+
CommonModule,
|
|
407
|
+
FormsModule,
|
|
408
|
+
ReactiveFormsModule,
|
|
409
|
+
IMaskModule
|
|
410
|
+
]
|
|
411
|
+
});
|
|
412
|
+
};
|
|
413
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
414
|
+
minVersion: "12.0.0",
|
|
415
|
+
version: "22.2.3",
|
|
416
|
+
ngImport: i0,
|
|
417
|
+
type: NgxInputNumberModule,
|
|
418
|
+
decorators: [{
|
|
419
|
+
type: NgModule,
|
|
420
|
+
args: [{
|
|
421
|
+
declarations: [NgxInputNumberComponent],
|
|
422
|
+
imports: [
|
|
423
|
+
CommonModule,
|
|
424
|
+
FormsModule,
|
|
425
|
+
ReactiveFormsModule,
|
|
426
|
+
IMaskModule
|
|
427
|
+
],
|
|
428
|
+
exports: [NgxInputNumberComponent],
|
|
429
|
+
providers: []
|
|
430
|
+
}]
|
|
431
|
+
}]
|
|
432
|
+
});
|
|
433
|
+
export { NgxInputNumberComponent, NgxInputNumberModule, NgxInputNumberService, defaultTypesProvider, inputConfigs, inputConfigsHelp, typesProvider };
|
|
40
434
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class inputConfigs {
|
|
44
|
-
groupSeparator;
|
|
45
|
-
radixPoint;
|
|
46
|
-
lblKeyInvalid;
|
|
47
|
-
max;
|
|
48
|
-
decimals;
|
|
49
|
-
negative;
|
|
50
|
-
}
|
|
51
|
-
class inputConfigsHelp {
|
|
52
|
-
config;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
class NgxInputNumberService {
|
|
56
|
-
config;
|
|
57
|
-
changeEvent = new BehaviorSubject(false);
|
|
58
|
-
groupSeparator = ',';
|
|
59
|
-
radixPoint = '.';
|
|
60
|
-
lblKeyInvalid = 'Please enter a valid amount';
|
|
61
|
-
negative = true;
|
|
62
|
-
max = 999999999999999999999999999999999;
|
|
63
|
-
decimals = 2;
|
|
64
|
-
constructor(config) {
|
|
65
|
-
this.config = config;
|
|
66
|
-
if (config != null) {
|
|
67
|
-
this.groupSeparator = config.groupSeparator;
|
|
68
|
-
this.radixPoint = config.radixPoint;
|
|
69
|
-
this.lblKeyInvalid = config.lblKeyInvalid;
|
|
70
|
-
this.negative = config.negative;
|
|
71
|
-
this.max = config.max;
|
|
72
|
-
this.decimals = config.decimals;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
onChangeParams(config) {
|
|
76
|
-
if (config.groupSeparator) {
|
|
77
|
-
this.groupSeparator = config.groupSeparator;
|
|
78
|
-
}
|
|
79
|
-
if (config.radixPoint) {
|
|
80
|
-
this.radixPoint = config.radixPoint;
|
|
81
|
-
}
|
|
82
|
-
if (config.lblKeyInvalid) {
|
|
83
|
-
this.lblKeyInvalid = config.lblKeyInvalid;
|
|
84
|
-
}
|
|
85
|
-
if (config.negative !== undefined) {
|
|
86
|
-
this.negative = config.negative;
|
|
87
|
-
}
|
|
88
|
-
if (config.max) {
|
|
89
|
-
this.max = config.max;
|
|
90
|
-
}
|
|
91
|
-
this.decimals = config.decimals ?? 2;
|
|
92
|
-
this.changeEvent.next(true);
|
|
93
|
-
}
|
|
94
|
-
getChangeEvent() {
|
|
95
|
-
return this.changeEvent;
|
|
96
|
-
}
|
|
97
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxInputNumberService, deps: [{ token: INPUT_CONFIG_TOKEN, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
98
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxInputNumberService, providedIn: 'root' });
|
|
99
|
-
}
|
|
100
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxInputNumberService, decorators: [{
|
|
101
|
-
type: Injectable,
|
|
102
|
-
args: [{
|
|
103
|
-
providedIn: 'root'
|
|
104
|
-
}]
|
|
105
|
-
}], ctorParameters: () => [{ type: inputConfigs, decorators: [{
|
|
106
|
-
type: Optional
|
|
107
|
-
}, {
|
|
108
|
-
type: Inject,
|
|
109
|
-
args: [INPUT_CONFIG_TOKEN]
|
|
110
|
-
}] }] });
|
|
111
|
-
|
|
112
|
-
class NgxInputNumberComponent {
|
|
113
|
-
_ChangeDetectorRef;
|
|
114
|
-
_NgxInputNumberService;
|
|
115
|
-
inputElement;
|
|
116
|
-
iMaskDir;
|
|
117
|
-
control;
|
|
118
|
-
negative;
|
|
119
|
-
autofocus = false;
|
|
120
|
-
decimals;
|
|
121
|
-
max;
|
|
122
|
-
idForLabel = '';
|
|
123
|
-
tabIndex;
|
|
124
|
-
addClass = 'form-control-sm';
|
|
125
|
-
groupSeparator;
|
|
126
|
-
radixPoint;
|
|
127
|
-
lblKeyInvalid;
|
|
128
|
-
lblKeyInvalidRender;
|
|
129
|
-
imask;
|
|
130
|
-
placeholder = '0';
|
|
131
|
-
resetControl = false;
|
|
132
|
-
prevValue = '';
|
|
133
|
-
validateError = false;
|
|
134
|
-
constructor(_ChangeDetectorRef, _NgxInputNumberService) {
|
|
135
|
-
this._ChangeDetectorRef = _ChangeDetectorRef;
|
|
136
|
-
this._NgxInputNumberService = _NgxInputNumberService;
|
|
137
|
-
}
|
|
138
|
-
ngAfterViewInit() {
|
|
139
|
-
this.iMaskDir.maskRef?.updateValue();
|
|
140
|
-
if (this.autofocus) {
|
|
141
|
-
setTimeout(() => {
|
|
142
|
-
this.inputElement.nativeElement.focus();
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
render() {
|
|
147
|
-
this._ChangeDetectorRef.detectChanges();
|
|
148
|
-
this.lblKeyInvalidRender = this._NgxInputNumberService.lblKeyInvalid;
|
|
149
|
-
this.imask = {
|
|
150
|
-
mask: Number,
|
|
151
|
-
scale: this._NgxInputNumberService.decimals,
|
|
152
|
-
thousandsSeparator: this._NgxInputNumberService.groupSeparator,
|
|
153
|
-
padFractionalZeros: true,
|
|
154
|
-
normalizeZeros: true,
|
|
155
|
-
radix: this._NgxInputNumberService.radixPoint,
|
|
156
|
-
max: this._NgxInputNumberService.max,
|
|
157
|
-
min: this._NgxInputNumberService.negative ? -999999999999999999999999999999999 : 0,
|
|
158
|
-
format: (x) => {
|
|
159
|
-
if (typeof x !== 'string' && x === null && !this.resetControl) {
|
|
160
|
-
this.resetControl = true;
|
|
161
|
-
this.inputElement.nativeElement.value = null;
|
|
162
|
-
this.iMaskDir.maskRef?.updateValue();
|
|
163
|
-
setTimeout(() => {
|
|
164
|
-
this.iMaskDir.maskRef?.updateControl();
|
|
165
|
-
this.control.setValue(null);
|
|
166
|
-
this.resetControl = false;
|
|
167
|
-
});
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
return Number(x).toFixed(this.imask.scale);
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
if (this.lblKeyInvalid !== undefined) {
|
|
174
|
-
this.lblKeyInvalidRender = this.lblKeyInvalid;
|
|
175
|
-
}
|
|
176
|
-
if (this.negative !== undefined) {
|
|
177
|
-
this.imask.min = this.negative ? -999999999999999999999999999999999 : 0;
|
|
178
|
-
}
|
|
179
|
-
if (this.max !== undefined) {
|
|
180
|
-
this.imask.max = this.max;
|
|
181
|
-
}
|
|
182
|
-
if (this.groupSeparator !== undefined) {
|
|
183
|
-
this.imask.thousandsSeparator = this.groupSeparator;
|
|
184
|
-
}
|
|
185
|
-
if (this.radixPoint !== undefined) {
|
|
186
|
-
this.imask.radix = this.radixPoint;
|
|
187
|
-
}
|
|
188
|
-
if (this.decimals !== undefined) {
|
|
189
|
-
this.imask.scale = this.decimals;
|
|
190
|
-
}
|
|
191
|
-
setTimeout(() => {
|
|
192
|
-
if (this.inputElement.nativeElement.value == '' && (this.control.value === null || this.control.value === '' || this.control.value === 0)) {
|
|
193
|
-
this.control.setValue('');
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
ngOnInit() {
|
|
198
|
-
this._NgxInputNumberService.getChangeEvent().subscribe((configs) => {
|
|
199
|
-
if (configs) {
|
|
200
|
-
this.render();
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
ngOnChanges() {
|
|
205
|
-
this.render();
|
|
206
|
-
}
|
|
207
|
-
onKeydown(e) {
|
|
208
|
-
this.prevValue = e.target.value;
|
|
209
|
-
}
|
|
210
|
-
onBlur() {
|
|
211
|
-
this.validateError = false;
|
|
212
|
-
}
|
|
213
|
-
onFocus() {
|
|
214
|
-
setTimeout(() => {
|
|
215
|
-
this.validateError = true;
|
|
216
|
-
}, 1000);
|
|
217
|
-
}
|
|
218
|
-
onKeyup(e) {
|
|
219
|
-
if (!this.validateError)
|
|
220
|
-
return;
|
|
221
|
-
let scapeKeys = [
|
|
222
|
-
'ArrowLeft',
|
|
223
|
-
'ArrowRight',
|
|
224
|
-
'ArrowUp',
|
|
225
|
-
'ArrowDown',
|
|
226
|
-
'Escape',
|
|
227
|
-
'Backspace',
|
|
228
|
-
'Delete',
|
|
229
|
-
'.',
|
|
230
|
-
',',
|
|
231
|
-
'-',
|
|
232
|
-
'Tab',
|
|
233
|
-
];
|
|
234
|
-
if (e.target.value == ''
|
|
235
|
-
&&
|
|
236
|
-
!scapeKeys.includes(e.key)) {
|
|
237
|
-
this.control.setValue('');
|
|
238
|
-
}
|
|
239
|
-
if (!scapeKeys.includes(e.key)
|
|
240
|
-
&&
|
|
241
|
-
this.prevValue === e.target.value
|
|
242
|
-
&&
|
|
243
|
-
e.key != this.prevValue) {
|
|
244
|
-
this.inputElement.nativeElement.classList.add('key-invalid');
|
|
245
|
-
setTimeout(() => {
|
|
246
|
-
this.inputElement.nativeElement.classList.remove('key-invalid');
|
|
247
|
-
}, 1000);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxInputNumberComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: NgxInputNumberService }], target: i0.ɵɵFactoryTarget.Component });
|
|
251
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.25", type: NgxInputNumberComponent, isStandalone: false, selector: "app-input-number", inputs: { control: "control", negative: "negative", autofocus: "autofocus", decimals: "decimals", max: "max", idForLabel: "idForLabel", tabIndex: "tabIndex", addClass: "addClass", groupSeparator: "groupSeparator", radixPoint: "radixPoint", lblKeyInvalid: "lblKeyInvalid" }, viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }, { propertyName: "iMaskDir", first: true, predicate: IMaskDirective, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"position-relative\">\n <input\n #inputElement\n type=\"text\"\n class=\"text-end form-control {{ addClass }}\"\n [class.is-invalid]=\"control.touched && control.invalid\"\n [formControl]=\"control\"\n [tabindex]=\"tabIndex\"\n [id]=\"idForLabel\"\n [imask]=\"imask\"\n [unmask]=\"'typed'\"\n (keyup)=\"onKeyup($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n (focus)=\"onFocus()\"\n >\n <label class=\"lbl-key-invalid position-absolute top-100 end-0 p-2 d-none\" [innerHTML]=\"lblKeyInvalidRender\"></label>\n</div>\n", styles: ["input.key-invalid{border-color:#dc3545!important;box-shadow:0 0 0 .25rem #dc354540!important}input.key-invalid+.lbl-key-invalid{background-color:#dc3545;color:#fff;display:block!important;z-index:1}\n"], dependencies: [{ kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3.IMaskDirective, selector: "[imask]", inputs: ["imask", "unmask", "imaskElement"], outputs: ["accept", "complete"], exportAs: ["imask"] }] });
|
|
252
|
-
}
|
|
253
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxInputNumberComponent, decorators: [{
|
|
254
|
-
type: Component,
|
|
255
|
-
args: [{ selector: 'app-input-number', standalone: false, template: "<div class=\"position-relative\">\n <input\n #inputElement\n type=\"text\"\n class=\"text-end form-control {{ addClass }}\"\n [class.is-invalid]=\"control.touched && control.invalid\"\n [formControl]=\"control\"\n [tabindex]=\"tabIndex\"\n [id]=\"idForLabel\"\n [imask]=\"imask\"\n [unmask]=\"'typed'\"\n (keyup)=\"onKeyup($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n (focus)=\"onFocus()\"\n >\n <label class=\"lbl-key-invalid position-absolute top-100 end-0 p-2 d-none\" [innerHTML]=\"lblKeyInvalidRender\"></label>\n</div>\n", styles: ["input.key-invalid{border-color:#dc3545!important;box-shadow:0 0 0 .25rem #dc354540!important}input.key-invalid+.lbl-key-invalid{background-color:#dc3545;color:#fff;display:block!important;z-index:1}\n"] }]
|
|
256
|
-
}], ctorParameters: () => [{ type: i0.ChangeDetectorRef }, { type: NgxInputNumberService }], propDecorators: { inputElement: [{
|
|
257
|
-
type: ViewChild,
|
|
258
|
-
args: ['inputElement']
|
|
259
|
-
}], iMaskDir: [{
|
|
260
|
-
type: ViewChild,
|
|
261
|
-
args: [IMaskDirective, { static: false }]
|
|
262
|
-
}], control: [{
|
|
263
|
-
type: Input
|
|
264
|
-
}], negative: [{
|
|
265
|
-
type: Input
|
|
266
|
-
}], autofocus: [{
|
|
267
|
-
type: Input
|
|
268
|
-
}], decimals: [{
|
|
269
|
-
type: Input
|
|
270
|
-
}], max: [{
|
|
271
|
-
type: Input
|
|
272
|
-
}], idForLabel: [{
|
|
273
|
-
type: Input
|
|
274
|
-
}], tabIndex: [{
|
|
275
|
-
type: Input
|
|
276
|
-
}], addClass: [{
|
|
277
|
-
type: Input
|
|
278
|
-
}], groupSeparator: [{
|
|
279
|
-
type: Input
|
|
280
|
-
}], radixPoint: [{
|
|
281
|
-
type: Input
|
|
282
|
-
}], lblKeyInvalid: [{
|
|
283
|
-
type: Input
|
|
284
|
-
}] } });
|
|
285
|
-
|
|
286
|
-
class NgxInputNumberModule {
|
|
287
|
-
static forRoot(config = {}) {
|
|
288
|
-
return {
|
|
289
|
-
ngModule: NgxInputNumberModule,
|
|
290
|
-
providers: [
|
|
291
|
-
config.config || {
|
|
292
|
-
provide: typesProvider,
|
|
293
|
-
useClass: defaultTypesProvider
|
|
294
|
-
}
|
|
295
|
-
],
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxInputNumberModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
299
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.25", ngImport: i0, type: NgxInputNumberModule, declarations: [NgxInputNumberComponent], imports: [CommonModule,
|
|
300
|
-
FormsModule,
|
|
301
|
-
ReactiveFormsModule,
|
|
302
|
-
IMaskModule], exports: [NgxInputNumberComponent] });
|
|
303
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxInputNumberModule, imports: [CommonModule,
|
|
304
|
-
FormsModule,
|
|
305
|
-
ReactiveFormsModule,
|
|
306
|
-
IMaskModule] });
|
|
307
|
-
}
|
|
308
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: NgxInputNumberModule, decorators: [{
|
|
309
|
-
type: NgModule,
|
|
310
|
-
args: [{
|
|
311
|
-
declarations: [
|
|
312
|
-
NgxInputNumberComponent
|
|
313
|
-
],
|
|
314
|
-
imports: [
|
|
315
|
-
CommonModule,
|
|
316
|
-
FormsModule,
|
|
317
|
-
ReactiveFormsModule,
|
|
318
|
-
IMaskModule
|
|
319
|
-
],
|
|
320
|
-
exports: [
|
|
321
|
-
NgxInputNumberComponent
|
|
322
|
-
],
|
|
323
|
-
providers: []
|
|
324
|
-
}]
|
|
325
|
-
}] });
|
|
326
|
-
|
|
327
|
-
/*
|
|
328
|
-
* Public API Surface of ngx-input-number
|
|
329
|
-
*/
|
|
330
|
-
// export * from 'ngx-mask';
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Generated bundle index. Do not edit.
|
|
334
|
-
*/
|
|
335
|
-
|
|
336
|
-
export { NgxInputNumberComponent, NgxInputNumberModule, NgxInputNumberService, defaultTypesProvider, inputConfigs$1 as inputConfigs, inputConfigsHelp$1 as inputConfigsHelp, typesProvider };
|
|
337
|
-
//# sourceMappingURL=experteam-mx-ngx-input-number.mjs.map
|
|
435
|
+
//# sourceMappingURL=experteam-mx-ngx-input-number.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experteam-mx-ngx-input-number.mjs","sources":["../../../../projects/experteam-mx/ngx-input-number/src/lib/typesProvider.ts","../../../../projects/experteam-mx/ngx-input-number/src/lib/di.ts","../../../../projects/experteam-mx/ngx-input-number/src/lib/types.ts","../../../../projects/experteam-mx/ngx-input-number/src/lib/ngx-input-number.service.ts","../../../../projects/experteam-mx/ngx-input-number/src/lib/ngx-input-number.component.ts","../../../../projects/experteam-mx/ngx-input-number/src/lib/ngx-input-number.component.html","../../../../projects/experteam-mx/ngx-input-number/src/lib/ngx-input-number.module.ts","../../../../projects/experteam-mx/ngx-input-number/src/public-api.ts","../../../../projects/experteam-mx/ngx-input-number/src/experteam-mx-ngx-input-number.ts"],"sourcesContent":["import { Injectable, Provider } from '@angular/core'\n\nexport class inputConfigs {\n groupSeparator?: string\n radixPoint?: string\n}\n\n@Injectable({ providedIn: 'root' })\nexport abstract class typesProvider {\n abstract get config (): inputConfigs;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class defaultTypesProvider extends typesProvider {\n get config (): inputConfigs {\n // return default config\n return {\n groupSeparator: ',',\n radixPoint: '.'\n }\n }\n}\n\nexport class inputConfigsHelp {\n config?: Provider\n}\n","import { InjectionToken } from '@angular/core';\nimport { inputConfigs } from './types';\n\nexport const INPUT_CONFIG_TOKEN = new InjectionToken<inputConfigs>('INPUT_CONFIG');\n","import { Provider } from '@angular/core'\n\nexport class inputConfigs {\n groupSeparator?: string\n radixPoint?: string\n lblKeyInvalid?: string\n max?: number\n decimals?: number\n negative?: boolean\n}\n\nexport class inputConfigsHelp {\n config?: Provider\n}\n","import { Inject, Injectable, Optional } from '@angular/core'\nimport { INPUT_CONFIG_TOKEN } from './di'\nimport { inputConfigs } from './types'\nimport { BehaviorSubject } from 'rxjs'\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxInputNumberService {\n\n changeEvent = new BehaviorSubject<boolean>(false)\n groupSeparator = ','\n radixPoint = '.'\n lblKeyInvalid = 'Please enter a valid amount'\n negative: any = true\n max: number = 999999999999999999999999999999999\n decimals = 2\n\n constructor (\n @Optional() @Inject(INPUT_CONFIG_TOKEN)\n private readonly config: inputConfigs | null,\n ) {\n if (config != null) {\n this.groupSeparator = config.groupSeparator!\n this.radixPoint = config.radixPoint!\n this.lblKeyInvalid = config.lblKeyInvalid!\n this.negative = config.negative!\n this.max = config.max!\n this.decimals = config.decimals!\n }\n }\n\n onChangeParams (config: inputConfigs) {\n if (config.groupSeparator) {\n this.groupSeparator = config.groupSeparator\n }\n if (config.radixPoint) {\n this.radixPoint = config.radixPoint\n }\n if (config.lblKeyInvalid) {\n this.lblKeyInvalid = config.lblKeyInvalid\n }\n if (config.negative !== undefined) {\n this.negative = config.negative\n }\n if (config.max) {\n this.max = config.max!\n }\n\n this.decimals = config.decimals ?? 2\n\n this.changeEvent.next(true)\n }\n\n getChangeEvent () {\n return this.changeEvent\n }\n}\n","import {\n AfterViewInit,\n ChangeDetectorRef,\n Component,\n ElementRef,\n Input,\n OnChanges,\n OnInit,\n ViewChild\n} from '@angular/core'\nimport { FormControl } from '@angular/forms'\nimport { NgxInputNumberService } from './ngx-input-number.service'\nimport { IMaskDirective } from 'angular-imask'\nimport { MaskedNumber } from 'imask'\n\n@Component({\n selector: 'app-input-number',\n templateUrl: './ngx-input-number.component.html',\n styleUrls: ['./ngx-input-number.component.css'],\n standalone: false\n})\nexport class NgxInputNumberComponent implements OnInit, OnChanges, AfterViewInit {\n\n @ViewChild('inputElement') inputElement!: ElementRef\n @ViewChild(IMaskDirective, { static: false }) iMaskDir!: IMaskDirective<MaskedNumber>\n @Input() control!: FormControl\n @Input() negative!: any\n @Input() autofocus: any = false\n @Input() decimals: any\n @Input() max: any\n @Input() idForLabel: any = ''\n @Input() tabIndex: any\n @Input() addClass: any = 'form-control-sm'\n @Input() groupSeparator: any\n @Input() radixPoint: any\n @Input() lblKeyInvalid: any\n lblKeyInvalidRender: any\n imask: any\n placeholder = '0'\n resetControl = false\n prevValue: any = ''\n validateError: boolean = false\n\n constructor (\n private _ChangeDetectorRef: ChangeDetectorRef,\n private _NgxInputNumberService: NgxInputNumberService,\n ) { }\n\n ngAfterViewInit (): void {\n this.iMaskDir.maskRef?.updateValue()\n\n if (this.autofocus) {\n setTimeout(() => {\n this.inputElement.nativeElement.focus()\n })\n }\n }\n\n render () {\n this._ChangeDetectorRef.detectChanges()\n\n this.lblKeyInvalidRender = this._NgxInputNumberService.lblKeyInvalid\n\n this.imask = {\n mask: Number,\n scale: this._NgxInputNumberService.decimals,\n thousandsSeparator: this._NgxInputNumberService.groupSeparator,\n padFractionalZeros: true,\n normalizeZeros: true,\n radix: this._NgxInputNumberService.radixPoint,\n max: this._NgxInputNumberService.max,\n min: this._NgxInputNumberService.negative ? -999999999999999999999999999999999 : 0,\n format: (x: any) => {\n if (typeof x !== 'string' && x === null && !this.resetControl) {\n this.resetControl = true\n this.inputElement.nativeElement.value = null\n this.iMaskDir.maskRef?.updateValue()\n setTimeout(\n () => {\n this.iMaskDir.maskRef?.updateControl()\n this.control.setValue(null)\n this.resetControl = false\n }\n )\n\n return null\n }\n\n return Number(x).toFixed(this.imask.scale)\n }\n }\n\n if (this.lblKeyInvalid !== undefined) {\n this.lblKeyInvalidRender = this.lblKeyInvalid\n }\n\n if (this.negative !== undefined) {\n this.imask.min = this.negative ? -999999999999999999999999999999999 : 0\n }\n\n if (this.max !== undefined) {\n this.imask.max = this.max\n }\n\n if (this.groupSeparator !== undefined) {\n this.imask.thousandsSeparator = this.groupSeparator\n }\n if (this.radixPoint !== undefined) {\n this.imask.radix = this.radixPoint\n }\n\n if (this.decimals !== undefined) {\n this.imask.scale = this.decimals\n }\n\n setTimeout(\n () => {\n if (this.inputElement.nativeElement.value == '' && (this.control.value === null || this.control.value === '' || this.control.value === 0)) {\n this.control.setValue('')\n }\n }\n )\n }\n\n ngOnInit (): void {\n this._NgxInputNumberService.getChangeEvent().subscribe(\n (configs) => {\n if (configs) {\n this.render()\n }\n }\n )\n }\n\n ngOnChanges (): void {\n this.render()\n }\n\n onKeydown (e: any) {\n this.prevValue = e.target.value\n }\n\n onBlur () {\n this.validateError = false\n }\n\n onFocus () {\n setTimeout(\n () => {\n this.validateError = true\n },\n 1000\n )\n }\n\n onKeyup (e: any) {\n if (!this.validateError) return\n\n let scapeKeys: any[] = [\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Escape',\n 'Backspace',\n 'Delete',\n '.',\n ',',\n '-',\n 'Tab',\n ]\n\n if(\n e.target.value == ''\n &&\n !scapeKeys.includes(e.key)\n ){\n this.control.setValue('')\n }\n\n if(\n !scapeKeys.includes(e.key)\n &&\n this.prevValue === e.target.value\n &&\n e.key != this.prevValue\n ){\n this.inputElement.nativeElement.classList.add('key-invalid')\n setTimeout(\n () => {\n this.inputElement.nativeElement.classList.remove('key-invalid')\n },\n 1000\n )\n }\n }\n}\n","<div class=\"position-relative\">\n <input\n #inputElement\n type=\"text\"\n class=\"text-end form-control {{ addClass }}\"\n [class.is-invalid]=\"control.touched && control.invalid\"\n [formControl]=\"control\"\n [tabindex]=\"tabIndex\"\n [id]=\"idForLabel\"\n [imask]=\"imask\"\n [unmask]=\"'typed'\"\n (keyup)=\"onKeyup($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n (focus)=\"onFocus()\"\n >\n <label class=\"lbl-key-invalid position-absolute top-100 end-0 p-2 d-none\" [innerHTML]=\"lblKeyInvalidRender\"></label>\n</div>\n","import { ModuleWithProviders, NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms'\nimport { NgxInputNumberComponent } from './ngx-input-number.component'\nimport { defaultTypesProvider, inputConfigsHelp, typesProvider } from './typesProvider'\nimport { IMaskModule } from 'angular-imask'\n\n@NgModule({\n declarations: [\n NgxInputNumberComponent\n ],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n IMaskModule\n ],\n exports: [\n NgxInputNumberComponent\n ],\n providers: []\n})\nexport class NgxInputNumberModule {\n static forRoot (config: inputConfigsHelp = {}): ModuleWithProviders<NgxInputNumberModule> {\n return {\n ngModule: NgxInputNumberModule,\n providers: [\n config.config || {\n provide: typesProvider,\n useClass: defaultTypesProvider\n }\n ],\n }\n }\n}\n","/*\n * Public API Surface of ngx-input-number\n */\n\nexport * from './lib/typesProvider';\nexport * from './lib/ngx-input-number.service';\nexport * from './lib/ngx-input-number.component';\nexport * from './lib/ngx-input-number.module';\n// export * from 'ngx-mask';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.NgxInputNumberService"],"mappings":";;;;;;;;;2BAEa,YAAY,CAAA;AACvB,IAAA,cAAc;AACd,IAAA,UAAU;AACX;MAGqB,aAAa,CAAA;wGAAb,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAb,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,cADT,MAAM,EAAA,CAAA;;4FACV,aAAa,EAAA,UAAA,EAAA,CAAA;kBADlC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;AAM5B,MAAO,oBAAqB,SAAQ,aAAa,CAAA;AACrD,IAAA,IAAI,MAAM,GAAA;;QAER,OAAO;AACL,YAAA,cAAc,EAAE,GAAG;AACnB,YAAA,UAAU,EAAE;SACb;IACH;wGAPW,oBAAoB,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAApB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cADP,MAAM,EAAA,CAAA;;4FACnB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;+BAWrB,gBAAgB,CAAA;AAC3B,IAAA,MAAM;AACP;;ACtBM,MAAM,kBAAkB,GAAG,IAAI,cAAc,CAAe,cAAc,CAAC;;MCDrE,YAAY,CAAA;AAC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;;;"}
|
|
1
|
+
{"version":3,"file":"experteam-mx-ngx-input-number.mjs","names":[],"sources":["../../../../projects/experteam-mx/ngx-input-number/src/lib/typesProvider.ts","../../../../projects/experteam-mx/ngx-input-number/src/lib/di.ts","../../../../projects/experteam-mx/ngx-input-number/src/lib/ngx-input-number.service.ts","../../../../projects/experteam-mx/ngx-input-number/src/lib/ngx-input-number.component.ts","../../../../projects/experteam-mx/ngx-input-number/src/lib/ngx-input-number.component.html","../../../../projects/experteam-mx/ngx-input-number/src/lib/ngx-input-number.module.ts"],"sourcesContent":["import type { Provider } from '@angular/core'\nimport { Injectable } from '@angular/core'\n\nexport class inputConfigs {\n groupSeparator?: string\n radixPoint?: string\n}\n\n@Injectable({ providedIn: 'root' })\nexport abstract class typesProvider {\n abstract get config (): inputConfigs\n}\n\n@Injectable({ providedIn: 'root' })\nexport class defaultTypesProvider extends typesProvider {\n get config (): inputConfigs {\n // return default config\n return {\n groupSeparator: ',',\n radixPoint: '.'\n }\n }\n}\n\nexport class inputConfigsHelp {\n config?: Provider\n}\n","import { InjectionToken } from '@angular/core'\nimport type { inputConfigs } from './types'\n\nexport const INPUT_CONFIG_TOKEN = new InjectionToken<inputConfigs>('INPUT_CONFIG')\n","import { Inject, Injectable, Optional } from '@angular/core'\nimport { INPUT_CONFIG_TOKEN } from './di'\nimport type { inputConfigs } from './types'\nimport { BehaviorSubject } from 'rxjs'\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxInputNumberService {\n changeEvent = new BehaviorSubject<boolean>(false)\n groupSeparator = ','\n radixPoint = '.'\n lblKeyInvalid = 'Please enter a valid amount'\n negative: any = true\n max: number = 1e33\n decimals = 2\n\n constructor (\n @Optional() @Inject(INPUT_CONFIG_TOKEN)\n private readonly config: inputConfigs | null\n ) {\n if (config != null) {\n this.groupSeparator = config.groupSeparator!\n this.radixPoint = config.radixPoint!\n this.lblKeyInvalid = config.lblKeyInvalid!\n this.negative = config.negative!\n this.max = config.max!\n this.decimals = config.decimals!\n }\n }\n\n onChangeParams (config: inputConfigs) {\n if (config.groupSeparator) {\n this.groupSeparator = config.groupSeparator\n }\n if (config.radixPoint) {\n this.radixPoint = config.radixPoint\n }\n if (config.lblKeyInvalid) {\n this.lblKeyInvalid = config.lblKeyInvalid\n }\n if (config.negative !== undefined) {\n this.negative = config.negative\n }\n if (config.max) {\n this.max = config.max!\n }\n\n this.decimals = config.decimals ?? 2\n\n this.changeEvent.next(true)\n }\n\n getChangeEvent () {\n return this.changeEvent\n }\n}\n","import type {\n AfterViewInit,\n ElementRef,\n OnChanges,\n OnInit\n} from '@angular/core'\nimport {\n ChangeDetectorRef,\n Component,\n inject,\n Input,\n ViewChild\n} from '@angular/core'\nimport type { FormControl } from '@angular/forms'\nimport { NgxInputNumberService } from './ngx-input-number.service'\nimport { IMaskDirective } from 'angular-imask'\nimport type { MaskedNumber } from 'imask'\n\n@Component({\n selector: 'app-input-number',\n templateUrl: './ngx-input-number.component.html',\n styleUrls: ['./ngx-input-number.component.css'],\n standalone: false\n})\nexport class NgxInputNumberComponent implements OnInit, OnChanges, AfterViewInit {\n @ViewChild('inputElement') inputElement!: ElementRef\n @ViewChild(IMaskDirective, { static: false }) iMaskDir!: IMaskDirective<MaskedNumber>\n @Input() control!: FormControl\n @Input() negative!: any\n @Input() autofocus: any = false\n @Input() decimals: any\n @Input() max: any\n @Input() idForLabel: any = ''\n @Input() tabIndex: any\n @Input() addClass: any = 'form-control-sm'\n @Input() groupSeparator: any\n @Input() radixPoint: any\n @Input() lblKeyInvalid: any\n lblKeyInvalidRender: any\n imask: any\n placeholder = '0'\n resetControl = false\n prevValue: any = ''\n validateError: boolean = false\n private _ChangeDetectorRef = inject(ChangeDetectorRef)\n private _NgxInputNumberService = inject(NgxInputNumberService)\n\n ngAfterViewInit (): void {\n this.iMaskDir.maskRef?.updateValue()\n\n if (this.autofocus) {\n setTimeout(() => {\n this.inputElement.nativeElement.focus()\n })\n }\n }\n\n render () {\n this._ChangeDetectorRef.detectChanges()\n\n this.lblKeyInvalidRender = this._NgxInputNumberService.lblKeyInvalid\n\n this.imask = {\n mask: Number,\n scale: this._NgxInputNumberService.decimals,\n thousandsSeparator: this._NgxInputNumberService.groupSeparator,\n padFractionalZeros: true,\n normalizeZeros: true,\n radix: this._NgxInputNumberService.radixPoint,\n max: this._NgxInputNumberService.max,\n min: this._NgxInputNumberService.negative ? -1e33 : 0,\n format: (x: any) => {\n if (typeof x !== 'string' && x === null && !this.resetControl) {\n this.resetControl = true\n this.inputElement.nativeElement.value = null\n this.iMaskDir.maskRef?.updateValue()\n setTimeout(\n () => {\n this.iMaskDir.maskRef?.updateControl()\n this.control.setValue(null)\n this.resetControl = false\n }\n )\n\n return null\n }\n\n return Number(x).toFixed(this.imask.scale)\n }\n }\n\n if (this.lblKeyInvalid !== undefined) {\n this.lblKeyInvalidRender = this.lblKeyInvalid\n }\n\n if (this.negative !== undefined) {\n this.imask.min = this.negative ? -1e33 : 0\n }\n\n if (this.max !== undefined) {\n this.imask.max = this.max\n }\n\n if (this.groupSeparator !== undefined) {\n this.imask.thousandsSeparator = this.groupSeparator\n }\n if (this.radixPoint !== undefined) {\n this.imask.radix = this.radixPoint\n }\n\n if (this.decimals !== undefined) {\n this.imask.scale = this.decimals\n }\n\n setTimeout(\n () => {\n if (this.inputElement.nativeElement.value === '' && (this.control.value === null || this.control.value === '' || this.control.value === 0)) {\n this.control.setValue('')\n }\n }\n )\n }\n\n ngOnInit (): void {\n this._NgxInputNumberService.getChangeEvent().subscribe(\n (configs) => {\n if (configs) {\n this.render()\n }\n }\n )\n }\n\n ngOnChanges (): void {\n this.render()\n }\n\n onKeydown (e: any) {\n this.prevValue = e.target.value\n }\n\n onBlur () {\n this.validateError = false\n }\n\n onFocus () {\n setTimeout(\n () => {\n this.validateError = true\n },\n 1000\n )\n }\n\n onKeyup (e: any) {\n if (!this.validateError) return\n\n const scapeKeys: any[] = [\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Escape',\n 'Backspace',\n 'Delete',\n '.',\n ',',\n '-',\n 'Tab',\n ]\n\n if (\n e.target.value === '' &&\n !scapeKeys.includes(e.key)\n ) {\n this.control.setValue('')\n }\n\n if (\n !scapeKeys.includes(e.key) &&\n this.prevValue === e.target.value &&\n e.key !== this.prevValue\n ) {\n this.inputElement.nativeElement.classList.add('key-invalid')\n setTimeout(\n () => {\n this.inputElement.nativeElement.classList.remove('key-invalid')\n },\n 1000\n )\n }\n }\n}\n","<div class=\"position-relative\">\n <input\n #inputElement\n type=\"text\"\n class=\"text-end form-control {{ addClass }}\"\n [class.is-invalid]=\"control.touched && control.invalid\"\n [formControl]=\"control\"\n [tabindex]=\"tabIndex\"\n [id]=\"idForLabel\"\n [imask]=\"imask\"\n [unmask]=\"'typed'\"\n (keyup)=\"onKeyup($event)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"onBlur()\"\n (focus)=\"onFocus()\"\n >\n <label class=\"lbl-key-invalid position-absolute top-100 end-0 p-2 d-none\" [innerHTML]=\"lblKeyInvalidRender\"></label>\n</div>\n","import type { ModuleWithProviders } from '@angular/core'\nimport { NgModule } from '@angular/core'\nimport { CommonModule } from '@angular/common'\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms'\nimport { NgxInputNumberComponent } from './ngx-input-number.component'\nimport type { inputConfigsHelp } from './typesProvider'\nimport { defaultTypesProvider, typesProvider } from './typesProvider'\nimport { IMaskModule } from 'angular-imask'\n\n@NgModule({\n declarations: [\n NgxInputNumberComponent\n ],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n IMaskModule\n ],\n exports: [\n NgxInputNumberComponent\n ],\n providers: []\n})\nexport class NgxInputNumberModule {\n static forRoot (config: inputConfigsHelp = {}): ModuleWithProviders<NgxInputNumberModule> {\n return {\n ngModule: NgxInputNumberModule,\n providers: [\n config.config || {\n provide: typesProvider,\n useClass: defaultTypesProvider\n }\n ],\n }\n }\n}\n"],"mappings":";;;;;;;;AAGA,IAAa,eAAb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OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAoB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAApB,OAAA,OAAA,GAAA,oBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAoB,cAAA,CAb7B,uBAAuB;EAAA,SAAA;GAGvB;GACA;GACA;GACA;EAAW;EAAA,SAAA,CAGX,uBAAuB;CAAA,CAAA;CAId,OAAA,OAAA,GAAA,oBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAoB,SAAA;GAV7B;GACA;GACA;GACA;EAAW;CAAA,CAAA;;AAOF,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EAfhC,MAAA;EAAS,MAAA,CAAA;GACR,cAAc,CACZ,uBACD;GACD,SAAS;IACP;IACA;IACA;IACA;GACD;GACD,SAAS,CACP,uBACD;GACD,WAAW,CAAA;EACZ,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@experteam-mx/ngx-input-number",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "22.0.0-dev2.0",
|
|
4
4
|
"description": "Angular input number for Experteam apps",
|
|
5
5
|
"author": "Experteam Cía. Ltda.",
|
|
6
6
|
"keywords": [
|
|
@@ -29,28 +29,28 @@
|
|
|
29
29
|
"tslib": ">=2.3.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@angular/cli": ">=
|
|
33
|
-
"@angular/common": ">=
|
|
34
|
-
"@angular/core": ">=
|
|
32
|
+
"@angular/cli": ">=22.0.0",
|
|
33
|
+
"@angular/common": ">=22.0.0",
|
|
34
|
+
"@angular/core": ">=22.0.0",
|
|
35
35
|
"@ngneat/input-mask": ">=6.1.0",
|
|
36
36
|
"@popperjs/core": ">=2.11.8",
|
|
37
37
|
"angular-imask": ">=7.6.1",
|
|
38
38
|
"bootstrap": ">=5.3.3",
|
|
39
39
|
"imask": ">=7.6.1",
|
|
40
40
|
"inputmask": ">=5.0.9",
|
|
41
|
-
"ngx-mask": ">=18.0.0",
|
|
42
41
|
"zone.js": ">=0.14.10"
|
|
43
42
|
},
|
|
44
43
|
"sideEffects": false,
|
|
45
44
|
"module": "fesm2022/experteam-mx-ngx-input-number.mjs",
|
|
46
|
-
"typings": "
|
|
45
|
+
"typings": "types/experteam-mx-ngx-input-number.d.ts",
|
|
47
46
|
"exports": {
|
|
48
47
|
"./package.json": {
|
|
49
48
|
"default": "./package.json"
|
|
50
49
|
},
|
|
51
50
|
".": {
|
|
52
|
-
"types": "./
|
|
51
|
+
"types": "./types/experteam-mx-ngx-input-number.d.ts",
|
|
53
52
|
"default": "./fesm2022/experteam-mx-ngx-input-number.mjs"
|
|
54
53
|
}
|
|
55
|
-
}
|
|
54
|
+
},
|
|
55
|
+
"type": "module"
|
|
56
56
|
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { AfterViewInit, ElementRef, ModuleWithProviders, OnChanges, OnInit, Provider } from "@angular/core";
|
|
3
|
+
import { BehaviorSubject } from "rxjs";
|
|
4
|
+
import * as i3 from "@angular/forms";
|
|
5
|
+
import { FormControl } from "@angular/forms";
|
|
6
|
+
import * as i4 from "angular-imask";
|
|
7
|
+
import { IMaskDirective } from "angular-imask";
|
|
8
|
+
import { MaskedNumber } from "imask";
|
|
9
|
+
import * as i2 from "@angular/common";
|
|
10
|
+
export declare class inputConfigs {
|
|
11
|
+
groupSeparator?: string;
|
|
12
|
+
radixPoint?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare abstract class typesProvider {
|
|
15
|
+
abstract get config(): inputConfigs;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<typesProvider, never>;
|
|
17
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
18
|
+
}
|
|
19
|
+
export declare class defaultTypesProvider extends typesProvider {
|
|
20
|
+
get config(): inputConfigs;
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<defaultTypesProvider, never>;
|
|
22
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
23
|
+
}
|
|
24
|
+
export declare class inputConfigsHelp {
|
|
25
|
+
config?: Provider;
|
|
26
|
+
}
|
|
27
|
+
declare class inputConfigs$1 {
|
|
28
|
+
groupSeparator?: string;
|
|
29
|
+
radixPoint?: string;
|
|
30
|
+
lblKeyInvalid?: string;
|
|
31
|
+
max?: number;
|
|
32
|
+
decimals?: number;
|
|
33
|
+
negative?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare class NgxInputNumberService {
|
|
36
|
+
private readonly config;
|
|
37
|
+
changeEvent: BehaviorSubject<boolean>;
|
|
38
|
+
groupSeparator: string;
|
|
39
|
+
radixPoint: string;
|
|
40
|
+
lblKeyInvalid: string;
|
|
41
|
+
negative: any;
|
|
42
|
+
max: number;
|
|
43
|
+
decimals: number;
|
|
44
|
+
constructor(config: inputConfigs$1 | null);
|
|
45
|
+
onChangeParams(config: inputConfigs$1): void;
|
|
46
|
+
getChangeEvent(): BehaviorSubject<boolean>;
|
|
47
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberService, [{
|
|
48
|
+
optional: true;
|
|
49
|
+
}]>;
|
|
50
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
51
|
+
}
|
|
52
|
+
export declare class NgxInputNumberComponent implements OnInit, OnChanges, AfterViewInit {
|
|
53
|
+
inputElement: ElementRef;
|
|
54
|
+
iMaskDir: IMaskDirective<MaskedNumber>;
|
|
55
|
+
control: FormControl;
|
|
56
|
+
negative: any;
|
|
57
|
+
autofocus: any;
|
|
58
|
+
decimals: any;
|
|
59
|
+
max: any;
|
|
60
|
+
idForLabel: any;
|
|
61
|
+
tabIndex: any;
|
|
62
|
+
addClass: any;
|
|
63
|
+
groupSeparator: any;
|
|
64
|
+
radixPoint: any;
|
|
65
|
+
lblKeyInvalid: any;
|
|
66
|
+
lblKeyInvalidRender: any;
|
|
67
|
+
imask: any;
|
|
68
|
+
placeholder: string;
|
|
69
|
+
resetControl: boolean;
|
|
70
|
+
prevValue: any;
|
|
71
|
+
validateError: boolean;
|
|
72
|
+
private _ChangeDetectorRef;
|
|
73
|
+
private _NgxInputNumberService;
|
|
74
|
+
ngAfterViewInit(): void;
|
|
75
|
+
render(): void;
|
|
76
|
+
ngOnInit(): void;
|
|
77
|
+
ngOnChanges(): void;
|
|
78
|
+
onKeydown(e: any): void;
|
|
79
|
+
onBlur(): void;
|
|
80
|
+
onFocus(): void;
|
|
81
|
+
onKeyup(e: any): void;
|
|
82
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberComponent, never>;
|
|
83
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgxInputNumberComponent, "app-input-number", never, {
|
|
84
|
+
"control": {
|
|
85
|
+
"alias": "control";
|
|
86
|
+
"required": false;
|
|
87
|
+
};
|
|
88
|
+
"negative": {
|
|
89
|
+
"alias": "negative";
|
|
90
|
+
"required": false;
|
|
91
|
+
};
|
|
92
|
+
"autofocus": {
|
|
93
|
+
"alias": "autofocus";
|
|
94
|
+
"required": false;
|
|
95
|
+
};
|
|
96
|
+
"decimals": {
|
|
97
|
+
"alias": "decimals";
|
|
98
|
+
"required": false;
|
|
99
|
+
};
|
|
100
|
+
"max": {
|
|
101
|
+
"alias": "max";
|
|
102
|
+
"required": false;
|
|
103
|
+
};
|
|
104
|
+
"idForLabel": {
|
|
105
|
+
"alias": "idForLabel";
|
|
106
|
+
"required": false;
|
|
107
|
+
};
|
|
108
|
+
"tabIndex": {
|
|
109
|
+
"alias": "tabIndex";
|
|
110
|
+
"required": false;
|
|
111
|
+
};
|
|
112
|
+
"addClass": {
|
|
113
|
+
"alias": "addClass";
|
|
114
|
+
"required": false;
|
|
115
|
+
};
|
|
116
|
+
"groupSeparator": {
|
|
117
|
+
"alias": "groupSeparator";
|
|
118
|
+
"required": false;
|
|
119
|
+
};
|
|
120
|
+
"radixPoint": {
|
|
121
|
+
"alias": "radixPoint";
|
|
122
|
+
"required": false;
|
|
123
|
+
};
|
|
124
|
+
"lblKeyInvalid": {
|
|
125
|
+
"alias": "lblKeyInvalid";
|
|
126
|
+
"required": false;
|
|
127
|
+
};
|
|
128
|
+
}, {}, never, never, false, never>;
|
|
129
|
+
}
|
|
130
|
+
export declare class NgxInputNumberModule {
|
|
131
|
+
static forRoot(config?: inputConfigsHelp): ModuleWithProviders<NgxInputNumberModule>;
|
|
132
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberModule, never>;
|
|
133
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxInputNumberModule, [typeof NgxInputNumberComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.IMaskModule], [typeof NgxInputNumberComponent]>;
|
|
134
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<NgxInputNumberModule>;
|
|
135
|
+
}
|
|
136
|
+
export {};
|
package/index.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Provider, OnInit, OnChanges, AfterViewInit, ElementRef, ChangeDetectorRef, ModuleWithProviders } from '@angular/core';
|
|
3
|
-
import { BehaviorSubject } from 'rxjs';
|
|
4
|
-
import * as i3 from '@angular/forms';
|
|
5
|
-
import { FormControl } from '@angular/forms';
|
|
6
|
-
import * as i4 from 'angular-imask';
|
|
7
|
-
import { IMaskDirective } from 'angular-imask';
|
|
8
|
-
import { MaskedNumber } from 'imask';
|
|
9
|
-
import * as i2 from '@angular/common';
|
|
10
|
-
|
|
11
|
-
declare class inputConfigs$1 {
|
|
12
|
-
groupSeparator?: string;
|
|
13
|
-
radixPoint?: string;
|
|
14
|
-
}
|
|
15
|
-
declare abstract class typesProvider {
|
|
16
|
-
abstract get config(): inputConfigs$1;
|
|
17
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<typesProvider, never>;
|
|
18
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<typesProvider>;
|
|
19
|
-
}
|
|
20
|
-
declare class defaultTypesProvider extends typesProvider {
|
|
21
|
-
get config(): inputConfigs$1;
|
|
22
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<defaultTypesProvider, never>;
|
|
23
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<defaultTypesProvider>;
|
|
24
|
-
}
|
|
25
|
-
declare class inputConfigsHelp {
|
|
26
|
-
config?: Provider;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare class inputConfigs {
|
|
30
|
-
groupSeparator?: string;
|
|
31
|
-
radixPoint?: string;
|
|
32
|
-
lblKeyInvalid?: string;
|
|
33
|
-
max?: number;
|
|
34
|
-
decimals?: number;
|
|
35
|
-
negative?: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
declare class NgxInputNumberService {
|
|
39
|
-
private readonly config;
|
|
40
|
-
changeEvent: BehaviorSubject<boolean>;
|
|
41
|
-
groupSeparator: string;
|
|
42
|
-
radixPoint: string;
|
|
43
|
-
lblKeyInvalid: string;
|
|
44
|
-
negative: any;
|
|
45
|
-
max: number;
|
|
46
|
-
decimals: number;
|
|
47
|
-
constructor(config: inputConfigs | null);
|
|
48
|
-
onChangeParams(config: inputConfigs): void;
|
|
49
|
-
getChangeEvent(): BehaviorSubject<boolean>;
|
|
50
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberService, [{ optional: true; }]>;
|
|
51
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<NgxInputNumberService>;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
declare class NgxInputNumberComponent implements OnInit, OnChanges, AfterViewInit {
|
|
55
|
-
private _ChangeDetectorRef;
|
|
56
|
-
private _NgxInputNumberService;
|
|
57
|
-
inputElement: ElementRef;
|
|
58
|
-
iMaskDir: IMaskDirective<MaskedNumber>;
|
|
59
|
-
control: FormControl;
|
|
60
|
-
negative: any;
|
|
61
|
-
autofocus: any;
|
|
62
|
-
decimals: any;
|
|
63
|
-
max: any;
|
|
64
|
-
idForLabel: any;
|
|
65
|
-
tabIndex: any;
|
|
66
|
-
addClass: any;
|
|
67
|
-
groupSeparator: any;
|
|
68
|
-
radixPoint: any;
|
|
69
|
-
lblKeyInvalid: any;
|
|
70
|
-
lblKeyInvalidRender: any;
|
|
71
|
-
imask: any;
|
|
72
|
-
placeholder: string;
|
|
73
|
-
resetControl: boolean;
|
|
74
|
-
prevValue: any;
|
|
75
|
-
validateError: boolean;
|
|
76
|
-
constructor(_ChangeDetectorRef: ChangeDetectorRef, _NgxInputNumberService: NgxInputNumberService);
|
|
77
|
-
ngAfterViewInit(): void;
|
|
78
|
-
render(): void;
|
|
79
|
-
ngOnInit(): void;
|
|
80
|
-
ngOnChanges(): void;
|
|
81
|
-
onKeydown(e: any): void;
|
|
82
|
-
onBlur(): void;
|
|
83
|
-
onFocus(): void;
|
|
84
|
-
onKeyup(e: any): void;
|
|
85
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberComponent, never>;
|
|
86
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<NgxInputNumberComponent, "app-input-number", never, { "control": { "alias": "control"; "required": false; }; "negative": { "alias": "negative"; "required": false; }; "autofocus": { "alias": "autofocus"; "required": false; }; "decimals": { "alias": "decimals"; "required": false; }; "max": { "alias": "max"; "required": false; }; "idForLabel": { "alias": "idForLabel"; "required": false; }; "tabIndex": { "alias": "tabIndex"; "required": false; }; "addClass": { "alias": "addClass"; "required": false; }; "groupSeparator": { "alias": "groupSeparator"; "required": false; }; "radixPoint": { "alias": "radixPoint"; "required": false; }; "lblKeyInvalid": { "alias": "lblKeyInvalid"; "required": false; }; }, {}, never, never, false, never>;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
declare class NgxInputNumberModule {
|
|
90
|
-
static forRoot(config?: inputConfigsHelp): ModuleWithProviders<NgxInputNumberModule>;
|
|
91
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NgxInputNumberModule, never>;
|
|
92
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<NgxInputNumberModule, [typeof NgxInputNumberComponent], [typeof i2.CommonModule, typeof i3.FormsModule, typeof i3.ReactiveFormsModule, typeof i4.IMaskModule], [typeof NgxInputNumberComponent]>;
|
|
93
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<NgxInputNumberModule>;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export { NgxInputNumberComponent, NgxInputNumberModule, NgxInputNumberService, defaultTypesProvider, inputConfigs$1 as inputConfigs, inputConfigsHelp, typesProvider };
|