ngx-mask 20.0.2 → 20.0.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.
@@ -927,6 +927,7 @@ class NgxMaskService extends NgxMaskApplierService {
927
927
  * since writeValue should be a one way only process of writing the DOM value based on the Angular model value.
928
928
  */
929
929
  writingValue = false;
930
+ isInitialized = false;
930
931
  _emitValue = false;
931
932
  _start;
932
933
  _end;
@@ -1113,7 +1114,6 @@ class NgxMaskService extends NgxMaskApplierService {
1113
1114
  this.currentValue = result;
1114
1115
  this._emitValue =
1115
1116
  this.previousValue !== this.currentValue ||
1116
- (newInputValue !== this.currentValue && this.writingValue) ||
1117
1117
  (this.previousValue === this.currentValue && justPasted);
1118
1118
  }
1119
1119
  // Propagate the input value back to the Angular model
@@ -1391,6 +1391,9 @@ class NgxMaskService extends NgxMaskApplierService {
1391
1391
  : (v) => v;
1392
1392
  this.writingValue = false;
1393
1393
  this.maskChanged = false;
1394
+ if (!this.isInitialized && this._emitValue) {
1395
+ return;
1396
+ }
1394
1397
  if (Array.isArray(this.dropSpecialCharacters)) {
1395
1398
  this.onChange(outputTransformFn(this._toNumber(this._checkSymbols(this._removeMask(this._removeSuffix(this._removePrefix(inputValue)), this.dropSpecialCharacters)))));
1396
1399
  }
@@ -1901,6 +1904,7 @@ class NgxMaskDirective {
1901
1904
  }
1902
1905
  }
1903
1906
  onInput(e) {
1907
+ this._maskService.isInitialized = true;
1904
1908
  // If IME is composing text, we wait for the composed text.
1905
1909
  if (this._isComposing()) {
1906
1910
  return;
@@ -2340,9 +2344,11 @@ class NgxMaskDirective {
2340
2344
  ];
2341
2345
  // Let the service know we've finished writing value
2342
2346
  this._maskService.writingValue = false;
2347
+ this._maskService.isInitialized = true;
2343
2348
  }
2344
2349
  else {
2345
2350
  this._maskService.formElementProperty = ['value', inputValue];
2351
+ this._maskService.isInitialized = true;
2346
2352
  }
2347
2353
  this._inputValue.set(inputValue);
2348
2354
  }