tuain-ng-forms-lib 0.12.22 → 0.12.23

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.
@@ -1963,7 +1963,7 @@
1963
1963
  phone: 'PHONE',
1964
1964
  };
1965
1965
  var FIELD_TYPES_FORMATS = {
1966
- EMAIL: '^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$',
1966
+ EMAIL: new RegExp('^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$'),
1967
1967
  };
1968
1968
  var STD_MAX_LENGTH = 50;
1969
1969
  var BIG_MAX_LENGTH = 500;
@@ -1989,7 +1989,12 @@
1989
1989
  var defaultTypeAlignment = (tableFieldStyles[_this.fieldType] != null) ? tableFieldStyles[_this.fieldType]['text-align'] : 'left';
1990
1990
  _this.fieldAlignment = (fieldReceived.alignment != null) ? fieldReceived.alignment.toLowerCase() : defaultTypeAlignment;
1991
1991
  _this.fieldInfo = fieldReceived.info || '';
1992
- _this.fieldFormat = fieldReceived.format || null;
1992
+ try {
1993
+ _this.fieldFormat = (fieldReceived.format) ? new RegExp(fieldReceived.format) : null;
1994
+ }
1995
+ catch (e) {
1996
+ _this.fieldFormat = null;
1997
+ }
1993
1998
  _this.validateOnServer = (_c = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.serverAction) !== null && _c !== void 0 ? _c : false;
1994
1999
  _this.customAttributes = (_d = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.customAttributes) !== null && _d !== void 0 ? _d : null;
1995
2000
  _this.setVisibility(fieldReceived.visible);
@@ -2073,15 +2078,13 @@
2073
2078
  this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
2074
2079
  };
2075
2080
  FieldDescriptor.prototype.notifyEditionFinish = function () {
2076
- var _a, _b;
2081
+ var _a, _b, _c, _d;
2077
2082
  var intrinsicValidation = true;
2078
- var fieldDefaultFormat = (FIELD_TYPES_FORMATS === null || FIELD_TYPES_FORMATS === void 0 ? void 0 : FIELD_TYPES_FORMATS[this.fieldType])
2079
- ? new RegExp(FIELD_TYPES_FORMATS === null || FIELD_TYPES_FORMATS === void 0 ? void 0 : FIELD_TYPES_FORMATS[this.fieldType]) : null;
2080
- var fieldFormat = (this.fieldFormat) ? new RegExp(this.fieldFormat) : null;
2083
+ var fieldDefaultFormat = (_a = FIELD_TYPES_FORMATS === null || FIELD_TYPES_FORMATS === void 0 ? void 0 : FIELD_TYPES_FORMATS[this.fieldType]) !== null && _a !== void 0 ? _a : null;
2081
2084
  var fieldValue = this.getValue();
2082
- if (fieldValue && (fieldDefaultFormat || fieldFormat)) {
2083
- intrinsicValidation = ((_a = fieldDefaultFormat === null || fieldDefaultFormat === void 0 ? void 0 : fieldDefaultFormat.test(fieldValue)) !== null && _a !== void 0 ? _a : true)
2084
- && ((_b = fieldFormat === null || fieldFormat === void 0 ? void 0 : fieldFormat.test(fieldValue)) !== null && _b !== void 0 ? _b : true);
2085
+ if (fieldValue && (fieldDefaultFormat || this.fieldFormat)) {
2086
+ intrinsicValidation = ((_b = fieldDefaultFormat === null || fieldDefaultFormat === void 0 ? void 0 : fieldDefaultFormat.test(fieldValue)) !== null && _b !== void 0 ? _b : true)
2087
+ && ((_d = (_c = this.fieldFormat) === null || _c === void 0 ? void 0 : _c.test(fieldValue)) !== null && _d !== void 0 ? _d : true);
2085
2088
  if (!intrinsicValidation) {
2086
2089
  this.setError('99', this._intrinsicErrorMessage);
2087
2090
  }