@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.
@@ -3371,15 +3371,15 @@
3371
3371
  }
3372
3372
  SharedValidators.getDoubleRegexp = function (maxDecimals) {
3373
3373
  if (isNil(maxDecimals))
3374
- return this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS.NO_LIMIT;
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._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[maxDecimals];
3377
+ var regexp = this._DOUBLE_REGEXP_CACHE[maxDecimals];
3378
3378
  if (regexp)
3379
3379
  return regexp;
3380
- // New regexp: add it to cache
3381
- this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[maxDecimals] = new RegExp("^[-]?[0-9]+([.,][0-9]{1," + maxDecimals + "})?$");
3382
- return this._REGEXP_CACHE.DOUBLE_BY_MAX_DECIMALS[maxDecimals];
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._REGEXP_CACHE = {
3555
- DOUBLE_BY_MAX_DECIMALS: {
3556
- NO_LIMIT: /^[-]?[0-9]+([.,][0-9]*)?$/,
3557
- 1: /^[-]?[0-9]+([.,][0-9])?$/,
3558
- 2: /^[-]?[0-9]+([.,][0-9]{1,2})?$/,
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',