@sumaris-net/ngx-components 1.20.12 → 1.20.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/sumaris-net.ngx-components.umd.js +10 -12
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +3 -0
- package/esm2015/src/app/shared/validator/validators.js +11 -13
- package/fesm2015/sumaris-net.ngx-components.js +10 -12
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/validator/validators.d.ts +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -3371,15 +3371,15 @@
|
|
|
3371
3371
|
}
|
|
3372
3372
|
SharedValidators.getDoubleRegexp = function (maxDecimals) {
|
|
3373
3373
|
if (isNil(maxDecimals))
|
|
3374
|
-
return this.
|
|
3374
|
+
return this._DOUBLE_REGEXP_CACHE.NO_LIMIT;
|
|
3375
3375
|
if (maxDecimals < 0)
|
|
3376
3376
|
throw new Error("Invalid maxDecimals value: " + maxDecimals);
|
|
3377
|
-
var regexp = this.
|
|
3377
|
+
var regexp = this._DOUBLE_REGEXP_CACHE[maxDecimals];
|
|
3378
3378
|
if (regexp)
|
|
3379
3379
|
return regexp;
|
|
3380
|
-
// New
|
|
3381
|
-
this.
|
|
3382
|
-
return this.
|
|
3380
|
+
// New: add to cache
|
|
3381
|
+
this._DOUBLE_REGEXP_CACHE[maxDecimals] = new RegExp("^-?\\d+([.,]\\d{1," + maxDecimals + "})?$");
|
|
3382
|
+
return this._DOUBLE_REGEXP_CACHE[maxDecimals];
|
|
3383
3383
|
};
|
|
3384
3384
|
SharedValidators.latitude = function (control) {
|
|
3385
3385
|
var value = control.value;
|
|
@@ -3551,13 +3551,11 @@
|
|
|
3551
3551
|
};
|
|
3552
3552
|
return SharedValidators;
|
|
3553
3553
|
}());
|
|
3554
|
-
SharedValidators.
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
3: /^[-]?[0-9]+([.,][0-9]{1,2})?$/,
|
|
3560
|
-
}
|
|
3554
|
+
SharedValidators._DOUBLE_REGEXP_CACHE = {
|
|
3555
|
+
NO_LIMIT: /^-?\d+([.,]\d*)?$/,
|
|
3556
|
+
1: /^-?\d+([.,]\d)?$/,
|
|
3557
|
+
2: /^-?\d+([.,]\d{1,2})?$/,
|
|
3558
|
+
3: /^-?\d+([.,]\d{1,3})?$/ // 3 decimals max
|
|
3561
3559
|
};
|
|
3562
3560
|
SharedValidators.I18N_ERROR_KEYS = {
|
|
3563
3561
|
required: 'ERROR.FIELD_REQUIRED',
|