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.
- package/bundles/ng-smn-ui.umd.js +18 -3
- package/bundles/ng-smn-ui.umd.js.map +1 -1
- package/bundles/ng-smn-ui.umd.min.js +1 -1
- package/bundles/ng-smn-ui.umd.min.js.map +1 -1
- package/esm2015/lib/utils/masks/cnpj-novo/mask-cnpj-novo.directive.js +18 -4
- package/esm5/lib/utils/masks/cnpj-novo/mask-cnpj-novo.directive.js +19 -4
- package/fesm2015/ng-smn-ui.js +17 -3
- package/fesm2015/ng-smn-ui.js.map +1 -1
- package/fesm5/ng-smn-ui.js +18 -3
- package/fesm5/ng-smn-ui.js.map +1 -1
- package/ng-smn-ui.metadata.json +1 -1
- package/package.json +1 -1
package/fesm5/ng-smn-ui.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
4121
|
-
|
|
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;
|