ngx-mask 14.2.2 → 14.2.3
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/fesm2015/ngx-mask.mjs
CHANGED
|
@@ -270,9 +270,10 @@ class MaskApplierService {
|
|
|
270
270
|
inputValue =
|
|
271
271
|
inputValue.length > 1 &&
|
|
272
272
|
inputValue[0] === '0' &&
|
|
273
|
+
inputValue[1] !== this.thousandSeparator &&
|
|
273
274
|
!this._compareOrIncludes(inputValue[1], this.decimalMarker, this.thousandSeparator) &&
|
|
274
275
|
!backspaced
|
|
275
|
-
? inputValue.slice(
|
|
276
|
+
? inputValue.slice(0, inputValue.length - 1)
|
|
276
277
|
: inputValue;
|
|
277
278
|
if (backspaced) {
|
|
278
279
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -553,10 +554,13 @@ class MaskApplierService {
|
|
|
553
554
|
return str
|
|
554
555
|
.split('')
|
|
555
556
|
.filter((i, idx) => {
|
|
557
|
+
const isDecimalMarker = typeof this.decimalMarker === 'string'
|
|
558
|
+
? i === this.decimalMarker
|
|
559
|
+
: // TODO (inepipenko) use utility type
|
|
560
|
+
this.decimalMarker.includes(i);
|
|
556
561
|
return (i.match('^-?\\d') ||
|
|
557
|
-
i.
|
|
558
|
-
|
|
559
|
-
i === ',' ||
|
|
562
|
+
i === this.thousandSeparator ||
|
|
563
|
+
isDecimalMarker ||
|
|
560
564
|
(i === '-' && idx === 0 && this.allowNegativeNumbers));
|
|
561
565
|
})
|
|
562
566
|
.join('');
|
|
@@ -1409,8 +1413,7 @@ class MaskDirective {
|
|
|
1409
1413
|
});
|
|
1410
1414
|
}
|
|
1411
1415
|
registerOnChange(fn) {
|
|
1412
|
-
this.onChange = fn;
|
|
1413
|
-
this._maskService.onChange = this.onChange;
|
|
1416
|
+
this._maskService.onChange = this.onChange = fn;
|
|
1414
1417
|
}
|
|
1415
1418
|
registerOnTouched(fn) {
|
|
1416
1419
|
this.onTouch = fn;
|