ng-smn-ui 4.2.11 → 4.2.13

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.
@@ -4074,6 +4074,7 @@ var UiMaskCnpjNovoDirective = /** @class */ (function () {
4074
4074
  });
4075
4075
  };
4076
4076
  UiMaskCnpjNovoDirective.prototype.writeValue = function (rawValue) {
4077
+ var _this = this;
4077
4078
  if (this.control && this.loaded && rawValue) {
4078
4079
  this.control.markAsDirty();
4079
4080
  }
@@ -4082,7 +4083,14 @@ var UiMaskCnpjNovoDirective = /** @class */ (function () {
4082
4083
  var value = this.ngModel.toString().toUpperCase();
4083
4084
  var cleanValue = value.replace(/[^0-9A-Z]+/g, '');
4084
4085
  var isNumericOnly = /^[0-9]*$/.test(cleanValue);
4085
- this.ngModel = isNumericOnly ? cleanValue.padStart(14, '0') : cleanValue;
4086
+ var paddedValue = isNumericOnly ? cleanValue.padStart(14, '0') : cleanValue;
4087
+ if (paddedValue !== cleanValue) {
4088
+ this.ngModel = paddedValue;
4089
+ setTimeout(function () { return _this.ngModelChange.emit(_this.ngModel); });
4090
+ }
4091
+ else {
4092
+ this.ngModel = paddedValue;
4093
+ }
4086
4094
  }
4087
4095
  else {
4088
4096
  this.ngModel = '';
@@ -4117,8 +4125,15 @@ var UiMaskCnpjNovoDirective = /** @class */ (function () {
4117
4125
  return { parse: true };
4118
4126
  }
4119
4127
  }
4120
- if (this.uiMaskCnpjNovo === true && control.value && !this.cnpjIsValid(control.value)) {
4121
- return { parse: true };
4128
+ if (this.uiMaskCnpjNovo === true && control.value) {
4129
+ var value = control.value.toString().toUpperCase().replace(/[^0-9A-Z]+/g, '');
4130
+ var isNumericOnly = /^[0-9]*$/.test(value);
4131
+ if (isNumericOnly) {
4132
+ value = value.padStart(14, '0');
4133
+ }
4134
+ if (!this.cnpjIsValid(value)) {
4135
+ return { parse: true };
4136
+ }
4122
4137
  }
4123
4138
  this.input = false;
4124
4139
  return null;