ngx-mask 21.0.0 → 21.0.1
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/fesm2022/ngx-mask.mjs +27 -12
- package/fesm2022/ngx-mask.mjs.map +1 -1
- package/package.json +4 -4
package/fesm2022/ngx-mask.mjs
CHANGED
|
@@ -636,6 +636,12 @@ class NgxMaskApplierService {
|
|
|
636
636
|
}
|
|
637
637
|
else if (this.patterns[maskExpression[cursor] ?? MaskExpression.EMPTY_STRING] &&
|
|
638
638
|
this.patterns[maskExpression[cursor] ?? MaskExpression.EMPTY_STRING]?.optional) {
|
|
639
|
+
// If the input symbol is whitespace or doesn't match the pattern,
|
|
640
|
+
// skip it without consuming the mask position
|
|
641
|
+
if (inputSymbol.trim() === MaskExpression.EMPTY_STRING) {
|
|
642
|
+
// Skip whitespace input, don't advance mask cursor
|
|
643
|
+
continue;
|
|
644
|
+
}
|
|
639
645
|
if (!!inputArray[cursor] &&
|
|
640
646
|
maskExpression !== '099.099.099.099' &&
|
|
641
647
|
maskExpression !== '000.000.000-00' &&
|
|
@@ -906,10 +912,10 @@ class NgxMaskApplierService {
|
|
|
906
912
|
nonZeroIndex,
|
|
907
913
|
};
|
|
908
914
|
}
|
|
909
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.
|
|
910
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.
|
|
915
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskApplierService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
916
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskApplierService });
|
|
911
917
|
}
|
|
912
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.
|
|
918
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskApplierService, decorators: [{
|
|
913
919
|
type: Injectable
|
|
914
920
|
}] });
|
|
915
921
|
|
|
@@ -1579,10 +1585,10 @@ class NgxMaskService extends NgxMaskApplierService {
|
|
|
1579
1585
|
currentLocaleDecimalMarker() {
|
|
1580
1586
|
return (1.1).toLocaleString().substring(1, 2);
|
|
1581
1587
|
}
|
|
1582
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.
|
|
1583
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.
|
|
1588
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
1589
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskService });
|
|
1584
1590
|
}
|
|
1585
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.
|
|
1591
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskService, decorators: [{
|
|
1586
1592
|
type: Injectable
|
|
1587
1593
|
}] });
|
|
1588
1594
|
|
|
@@ -2380,8 +2386,17 @@ class NgxMaskDirective {
|
|
|
2380
2386
|
.replace(MaskExpression.DOT, MaskExpression.COMMA);
|
|
2381
2387
|
}
|
|
2382
2388
|
if (this.mask()?.startsWith(MaskExpression.SEPARATOR) && this.leadZero()) {
|
|
2389
|
+
const isFirstWrite = !this._maskService.isInitialized;
|
|
2383
2390
|
requestAnimationFrame(() => {
|
|
2391
|
+
// On initial load, temporarily set isInitialized to false
|
|
2392
|
+
// so formControlResult returns early and doesn't mark form as dirty
|
|
2393
|
+
if (isFirstWrite) {
|
|
2394
|
+
this._maskService.isInitialized = false;
|
|
2395
|
+
}
|
|
2384
2396
|
this._maskService.applyMask(inputValue?.toString() ?? '', this._maskService.maskExpression);
|
|
2397
|
+
if (isFirstWrite) {
|
|
2398
|
+
this._maskService.isInitialized = true;
|
|
2399
|
+
}
|
|
2385
2400
|
});
|
|
2386
2401
|
}
|
|
2387
2402
|
this._maskService.isNumberValue = true;
|
|
@@ -2555,8 +2570,8 @@ class NgxMaskDirective {
|
|
|
2555
2570
|
return uniqueCharacters.size === 1;
|
|
2556
2571
|
});
|
|
2557
2572
|
}
|
|
2558
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.
|
|
2559
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.
|
|
2573
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
2574
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.1.2", type: NgxMaskDirective, isStandalone: true, selector: "input[mask], textarea[mask]", inputs: { mask: { classPropertyName: "mask", publicName: "mask", isSignal: true, isRequired: false, transformFunction: null }, specialCharacters: { classPropertyName: "specialCharacters", publicName: "specialCharacters", isSignal: true, isRequired: false, transformFunction: null }, patterns: { classPropertyName: "patterns", publicName: "patterns", isSignal: true, isRequired: false, transformFunction: null }, prefix: { classPropertyName: "prefix", publicName: "prefix", isSignal: true, isRequired: false, transformFunction: null }, suffix: { classPropertyName: "suffix", publicName: "suffix", isSignal: true, isRequired: false, transformFunction: null }, thousandSeparator: { classPropertyName: "thousandSeparator", publicName: "thousandSeparator", isSignal: true, isRequired: false, transformFunction: null }, decimalMarker: { classPropertyName: "decimalMarker", publicName: "decimalMarker", isSignal: true, isRequired: false, transformFunction: null }, dropSpecialCharacters: { classPropertyName: "dropSpecialCharacters", publicName: "dropSpecialCharacters", isSignal: true, isRequired: false, transformFunction: null }, hiddenInput: { classPropertyName: "hiddenInput", publicName: "hiddenInput", isSignal: true, isRequired: false, transformFunction: null }, showMaskTyped: { classPropertyName: "showMaskTyped", publicName: "showMaskTyped", isSignal: true, isRequired: false, transformFunction: null }, placeHolderCharacter: { classPropertyName: "placeHolderCharacter", publicName: "placeHolderCharacter", isSignal: true, isRequired: false, transformFunction: null }, shownMaskExpression: { classPropertyName: "shownMaskExpression", publicName: "shownMaskExpression", isSignal: true, isRequired: false, transformFunction: null }, clearIfNotMatch: { classPropertyName: "clearIfNotMatch", publicName: "clearIfNotMatch", isSignal: true, isRequired: false, transformFunction: null }, validation: { classPropertyName: "validation", publicName: "validation", isSignal: true, isRequired: false, transformFunction: null }, separatorLimit: { classPropertyName: "separatorLimit", publicName: "separatorLimit", isSignal: true, isRequired: false, transformFunction: null }, allowNegativeNumbers: { classPropertyName: "allowNegativeNumbers", publicName: "allowNegativeNumbers", isSignal: true, isRequired: false, transformFunction: null }, leadZeroDateTime: { classPropertyName: "leadZeroDateTime", publicName: "leadZeroDateTime", isSignal: true, isRequired: false, transformFunction: null }, leadZero: { classPropertyName: "leadZero", publicName: "leadZero", isSignal: true, isRequired: false, transformFunction: null }, triggerOnMaskChange: { classPropertyName: "triggerOnMaskChange", publicName: "triggerOnMaskChange", isSignal: true, isRequired: false, transformFunction: null }, apm: { classPropertyName: "apm", publicName: "apm", isSignal: true, isRequired: false, transformFunction: null }, inputTransformFn: { classPropertyName: "inputTransformFn", publicName: "inputTransformFn", isSignal: true, isRequired: false, transformFunction: null }, outputTransformFn: { classPropertyName: "outputTransformFn", publicName: "outputTransformFn", isSignal: true, isRequired: false, transformFunction: null }, keepCharacterPositions: { classPropertyName: "keepCharacterPositions", publicName: "keepCharacterPositions", isSignal: true, isRequired: false, transformFunction: null }, instantPrefix: { classPropertyName: "instantPrefix", publicName: "instantPrefix", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, pending: { classPropertyName: "pending", publicName: "pending", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touched: "touchedChange", maskFilled: "maskFilled" }, host: { listeners: { "paste": "onPaste()", "focus": "onFocus()", "ngModelChange": "onModelChange($event)", "input": "onInput($event)", "compositionstart": "onCompositionStart()", "compositionend": "onCompositionEnd($event)", "blur": "onBlur($event)", "click": "onClick($event)", "keydown": "onKeyDown($event)" } }, providers: [
|
|
2560
2575
|
{
|
|
2561
2576
|
provide: NG_VALUE_ACCESSOR,
|
|
2562
2577
|
useExisting: NgxMaskDirective,
|
|
@@ -2570,7 +2585,7 @@ class NgxMaskDirective {
|
|
|
2570
2585
|
NgxMaskService,
|
|
2571
2586
|
], exportAs: ["mask", "ngxMask"], usesOnChanges: true, ngImport: i0 });
|
|
2572
2587
|
}
|
|
2573
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.
|
|
2588
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskDirective, decorators: [{
|
|
2574
2589
|
type: Directive,
|
|
2575
2590
|
args: [{
|
|
2576
2591
|
selector: 'input[mask], textarea[mask]',
|
|
@@ -2703,10 +2718,10 @@ class NgxMaskPipe {
|
|
|
2703
2718
|
});
|
|
2704
2719
|
}
|
|
2705
2720
|
}
|
|
2706
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.
|
|
2707
|
-
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.
|
|
2721
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
2722
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskPipe, isStandalone: true, name: "mask" });
|
|
2708
2723
|
}
|
|
2709
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.
|
|
2724
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NgxMaskPipe, decorators: [{
|
|
2710
2725
|
type: Pipe,
|
|
2711
2726
|
args: [{
|
|
2712
2727
|
name: 'mask',
|