tuain-ng-forms-lib 0.12.31 → 0.12.35

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.
@@ -146,41 +146,12 @@
146
146
  ]
147
147
  };
148
148
 
149
- var MONITORED_ATTRIBUTES$1 = {
150
- _maxLength: 'maxLength',
151
- _onValidation: '_onValidation',
152
- _fieldValue: 'value',
153
- captureType: 'captureType',
154
- fieldTitle: 'fieldTitle',
155
- fieldType: 'fieldType',
156
- errorMessage: 'errorMessage',
157
- errorType: 'errorType',
158
- errorCode: 'errorCode',
159
- visibleLabel: 'visibleLabel',
160
- fieldRequired: 'fieldRequired',
161
- fieldOptions: 'fieldOptions',
162
- };
163
149
  var FieldComponent = /** @class */ (function () {
164
150
  function FieldComponent() {
165
151
  this.componentConstants = Object.assign({}, componentConstants);
166
152
  }
167
153
  FieldComponent.prototype.ngOnInit = function () {
168
- var _this = this;
169
- if (this.fieldObject) {
170
- // Atributos estáticos
171
- this.code = this.fieldObject.fieldCode;
172
- this.fieldInfo = this.fieldObject.fieldInfo;
173
- this.fieldAlignment = this.fieldObject.fieldAlignment;
174
- this.tooltipText = this.fieldObject.tooltipText;
175
- this.fieldObject.widget = this;
176
- // Atributos dinámicos
177
- this.fieldObject.attributeChange.subscribe(function (event) {
178
- var name = event.name, value = event.value;
179
- if (_this[MONITORED_ATTRIBUTES$1[name]]) {
180
- _this[MONITORED_ATTRIBUTES$1[name]] = value;
181
- }
182
- });
183
- }
154
+ this.fieldObject.widget = this;
184
155
  this.start();
185
156
  };
186
157
  FieldComponent.prototype.start = function () { };
@@ -686,9 +657,9 @@
686
657
  this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
687
658
  this.widget = null;
688
659
  }
689
- FormElement.prototype.isField = function () { return this.elementType === componentConstants.ELEMENTTYPE_FIELD; };
690
- FormElement.prototype.isAction = function () { return this.elementType === componentConstants.ELEMENTTYPE_ACTION; };
691
- FormElement.prototype.isTable = function () { return this.elementType === componentConstants.ELEMENTTYPE_TABLE; };
660
+ FormElement.prototype.isField = function () { return this.type === componentConstants.ELEMENTTYPE_FIELD; };
661
+ FormElement.prototype.isAction = function () { return this.type === componentConstants.ELEMENTTYPE_ACTION; };
662
+ FormElement.prototype.isTable = function () { return this.type === componentConstants.ELEMENTTYPE_TABLE; };
692
663
  FormElement.prototype.setVisibleStates = function (newStates) {
693
664
  var visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
694
665
  ? newStates.split(',').map(function (state) { return state.trim(); }).filter(function (state) { return state.length > 0; })
@@ -1015,7 +986,7 @@
1015
986
  _this._tableColumnObj = {};
1016
987
  _this._actionsObj = {};
1017
988
  _this.allSelected = false;
1018
- _this.elementType = componentConstants.ELEMENTTYPE_TABLE;
989
+ _this.type = componentConstants.ELEMENTTYPE_TABLE;
1019
990
  _this.waiting = false;
1020
991
  _this.complexFilter = false;
1021
992
  _this.currentPage = 1;
@@ -1708,7 +1679,7 @@
1708
1679
  break;
1709
1680
  }
1710
1681
  if (elementObject) {
1711
- elementObject.elementType = type;
1682
+ elementObject.type = type;
1712
1683
  arrayToAdd.push(elementObject);
1713
1684
  this.subSectionElements.push(elementObject);
1714
1685
  this.elementsArray[code] = elementObject;
@@ -1918,7 +1889,7 @@
1918
1889
  _this = _super.call(this, actionDefinition) || this;
1919
1890
  _this._actionActivated = new rxjs.Subject();
1920
1891
  _this.inProgress = false;
1921
- _this.elementType = componentConstants.ELEMENTTYPE_ACTION;
1892
+ _this.type = componentConstants.ELEMENTTYPE_ACTION;
1922
1893
  _this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
1923
1894
  _this.actionName = actionDefinition.actionTitle;
1924
1895
  _this.iconName = actionDefinition.iconName || _this.actionCode;
@@ -1967,7 +1938,6 @@
1967
1938
  var FIELD_INFO = 'info';
1968
1939
  var FIELD_EDITABLE = 'editable';
1969
1940
  var FIELD_TYPES = {
1970
- boolean: 'BOOLEAN',
1971
1941
  array: 'ARRAY',
1972
1942
  check: 'CHECK',
1973
1943
  date: 'DATE',
@@ -1993,93 +1963,47 @@
1993
1963
  phone: 'PHONE',
1994
1964
  };
1995
1965
  var FIELD_TYPES_FORMATS = {
1996
- EMAIL: new RegExp('^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$'),
1966
+ EMAIL: '^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$',
1997
1967
  };
1998
- var INTRINSIC_ERROR_MESSAGES = {
1999
- EMAIL: "El valor no corresponde a un correo v\u00E1lido",
2000
- DEFAULT: "El valor no se ajusta al formato establecido",
2001
- };
2002
- var DEFAULT_ERROR_TYPE = 'error';
2003
- var DEFAULT_CAPTURE_TYPE = 'INPUT';
2004
- var DEFAULT_ALIGNMENT = 'left';
2005
- var MONITORED_ATTRIBUTES = ['_maxLength', '_onValidation', 'captureType', 'fieldTitle', 'fieldType',
2006
- 'errorMessage', 'errorType', 'errorCode', 'visibleLabel', 'fieldRequired', 'fieldOptions', '_fieldValue'];
2007
1968
  var STD_MAX_LENGTH = 50;
2008
1969
  var BIG_MAX_LENGTH = 500;
2009
- var fldAttr = {
2010
- validateOnServer: 'validateOnServer',
2011
- value: '_fieldValue',
2012
- minValue: '_minValue',
2013
- maxValue: '_maxValue',
2014
- maxLength: '_maxLength',
2015
- onValidation: '_onValidation',
2016
- intrinsicErrorMessage: '_intrinsicErrorMessage',
2017
- code: 'fieldCode',
2018
- info: 'fieldInfo',
2019
- defaultValue: 'defaultValue',
2020
- defaultEditable: 'defaultEditable',
2021
- customAttributes: 'customAttributes',
2022
- visibleLabel: 'visibleLabel',
2023
- required: 'fieldRequired',
2024
- hasChanged: 'hasChanged',
2025
- outputOnly: 'outputOnly',
2026
- captureType: 'captureType',
2027
- title: 'fieldTitle',
2028
- type: 'fieldType',
2029
- alignment: 'fieldAlignment',
2030
- format: 'fieldFormat',
2031
- externalValue: 'externalValue',
2032
- tooltipText: 'tooltipText',
2033
- errorType: 'errorType',
2034
- errorCode: 'errorCode',
2035
- errorMessage: 'errorMessage',
2036
- options: 'fieldOptions',
2037
- };
2038
1970
  var FieldDescriptor = /** @class */ (function (_super) {
2039
1971
  __extends(FieldDescriptor, _super);
2040
1972
  function FieldDescriptor(inputFieldReceived) {
2041
1973
  var _this = this;
2042
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1974
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2043
1975
  _this = _super.call(this, inputFieldReceived) || this;
2044
1976
  _this._editionFinish = new rxjs.Subject();
2045
1977
  _this._editionPartial = new rxjs.Subject();
2046
1978
  _this._detailRequest = new rxjs.Subject();
2047
- _this._attributeChange = new rxjs.Subject();
2048
- _this.elementType = componentConstants.ELEMENTTYPE_FIELD;
2049
- var fld = (inputFieldReceived) ? inputFieldReceived : {};
2050
- _this.setAttr(fldAttr.code, fld.fieldCode);
2051
- _this.setAttr(fldAttr.title, (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : _this.fieldCode);
2052
- _this.setAttr(fldAttr.captureType, (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE);
2053
- _this.setAttr(fldAttr.defaultValue, (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null);
2054
- var defaultTypeAlignment = (tableFieldStyles[_this.fieldType] != null)
2055
- ? tableFieldStyles[_this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
2056
- var fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
2057
- _this.setAttr(fldAttr.alignment, fieldAlignment);
2058
- _this.setAttr(fldAttr.info, fld.info || '');
2059
- var fieldFormat;
2060
- try {
2061
- fieldFormat = (fld.format) ? new RegExp(fld.format) : null;
2062
- }
2063
- catch (e) {
2064
- fieldFormat = null;
2065
- }
2066
- _this.setAttr(fldAttr.format, fieldFormat);
2067
- _this.setAttr(fldAttr.validateOnServer, (_d = fld.serverAction) !== null && _d !== void 0 ? _d : false);
2068
- _this.setAttr(fldAttr.customAttributes, (_e = fld.customAttributes) !== null && _e !== void 0 ? _e : {});
2069
- _this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
2070
- _this.setAttr(fldAttr.defaultEditable, _this.enabled);
2071
- _this.setAttr(fldAttr.required, (_f = fld.required) !== null && _f !== void 0 ? _f : false);
2072
- _this.setError(fld.errorCode, fld.errorMessage, (_g = fld.errorType) !== null && _g !== void 0 ? _g : DEFAULT_ERROR_TYPE);
2073
- _this.setAttr(fldAttr.outputOnly, (_h = fld.outputOnly) !== null && _h !== void 0 ? _h : false);
2074
- var maxLength = (_j = fld.maxLength) !== null && _j !== void 0 ? _j : (_this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
2075
- _this.setAttr(fldAttr.maxLength, maxLength);
2076
- _this.setAttr(fldAttr.intrinsicErrorMessage, (_k = INTRINSIC_ERROR_MESSAGES[_this.fieldType]) !== null && _k !== void 0 ? _k : INTRINSIC_ERROR_MESSAGES.DEFAULT);
2077
- _this.setFieldType(fld.fieldTypeCode);
2078
- _this.setEditable((_l = fld.editable) !== null && _l !== void 0 ? _l : true);
2079
- _this.setVisibleLabel((_m = fld.visibleLabel) !== null && _m !== void 0 ? _m : true);
2080
- _this.setVisibility(fld.visible);
2081
- _this.setFieldOptions(fld.fieldOptions);
2082
- _this.setValue(fld.fieldValue || _this.defaultValue || '');
1979
+ _this.type = componentConstants.ELEMENTTYPE_FIELD;
1980
+ var fieldReceived = (inputFieldReceived) ? inputFieldReceived : {};
1981
+ _this.setEditable((_a = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.editable) !== null && _a !== void 0 ? _a : true);
1982
+ _this.fieldCode = fieldReceived.fieldCode;
1983
+ _this.fieldTitle = fieldReceived.fieldTitle || _this.fieldCode;
1984
+ _this.captureType = fieldReceived.captureType || 'INPUT';
1985
+ _this.setFieldType(fieldReceived.fieldTypeCode);
1986
+ _this.defaultValue = fieldReceived.defaultValue || null;
1987
+ _this._maxLength = (_b = fieldReceived.maxLength) !== null && _b !== void 0 ? _b : (_this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
1988
+ _this.setValue(fieldReceived.fieldValue || _this.defaultValue || '');
1989
+ var defaultTypeAlignment = (tableFieldStyles[_this.fieldType] != null) ? tableFieldStyles[_this.fieldType]['text-align'] : 'left';
1990
+ _this.fieldAlignment = (fieldReceived.alignment != null) ? fieldReceived.alignment.toLowerCase() : defaultTypeAlignment;
1991
+ _this.fieldInfo = fieldReceived.info || '';
1992
+ _this.fieldFormat = fieldReceived.format || null;
1993
+ _this.validateOnServer = (_c = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.serverAction) !== null && _c !== void 0 ? _c : false;
1994
+ _this.customAttributes = (_d = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.customAttributes) !== null && _d !== void 0 ? _d : null;
1995
+ _this.setVisibility(fieldReceived.visible);
1996
+ _this.visibleLabel = (_e = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.visibleLabel) !== null && _e !== void 0 ? _e : true;
1997
+ _this.tooltipText = fieldReceived.tooltip || '';
1998
+ _this.defaultEditable = _this.enabled;
1999
+ _this.fieldRequired = (_f = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.required) !== null && _f !== void 0 ? _f : false;
2000
+ _this.errorMessage = fieldReceived.errorMessage || '';
2001
+ _this.errorCode = (_g = fieldReceived.errorCode) !== null && _g !== void 0 ? _g : '00';
2002
+ _this.outputOnly = (_h = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.outputOnly) !== null && _h !== void 0 ? _h : false;
2003
+ _this.setFieldOptions(fieldReceived.fieldOptions);
2004
+ _this._intrinsicErrorMessage = (_this.fieldType === FIELD_TYPES.email)
2005
+ ? "El valor de " + _this.fieldTitle + " no corresponde a un correo v\u00E1lido"
2006
+ : "El valor de " + _this.fieldTitle + " no se ajusta al formato establecido";
2083
2007
  return _this;
2084
2008
  }
2085
2009
  Object.defineProperty(FieldDescriptor.prototype, "name", {
@@ -2092,11 +2016,6 @@
2092
2016
  enumerable: false,
2093
2017
  configurable: true
2094
2018
  });
2095
- Object.defineProperty(FieldDescriptor.prototype, "attributeChange", {
2096
- get: function () { return this._attributeChange; },
2097
- enumerable: false,
2098
- configurable: true
2099
- });
2100
2019
  Object.defineProperty(FieldDescriptor.prototype, "editionPartial", {
2101
2020
  get: function () { return this._editionPartial; },
2102
2021
  enumerable: false,
@@ -2109,11 +2028,11 @@
2109
2028
  });
2110
2029
  Object.defineProperty(FieldDescriptor.prototype, "validating", {
2111
2030
  get: function () { return this._onValidation; },
2112
- set: function (isValidating) { this.setAttr(fldAttr.onValidation, isValidating); },
2031
+ set: function (isValidating) { this._onValidation = isValidating; },
2113
2032
  enumerable: false,
2114
2033
  configurable: true
2115
2034
  });
2116
- FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); };
2035
+ FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this._intrinsicErrorMessage = message; };
2117
2036
  Object.defineProperty(FieldDescriptor.prototype, "intrinsicErrorMessage", {
2118
2037
  set: function (message) { this.setIntrinsicErrorMessage(message); },
2119
2038
  enumerable: false,
@@ -2126,7 +2045,7 @@
2126
2045
  });
2127
2046
  Object.defineProperty(FieldDescriptor.prototype, "required", {
2128
2047
  get: function () { return this.fieldRequired; },
2129
- set: function (required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); },
2048
+ set: function (required) { this.fieldRequired = required !== null && required !== void 0 ? required : false; },
2130
2049
  enumerable: false,
2131
2050
  configurable: true
2132
2051
  });
@@ -2134,10 +2053,10 @@
2134
2053
  get: function () { return (this._maxLength > 0) ? this._maxLength.toString() : ''; },
2135
2054
  set: function (requiredMaxLength) {
2136
2055
  if (typeof requiredMaxLength === 'string') {
2137
- this.setAttr(fldAttr.maxLength, parseInt(requiredMaxLength, 10));
2056
+ this._maxLength = parseInt(requiredMaxLength, 10);
2138
2057
  }
2139
2058
  else if (typeof requiredMaxLength === 'number') {
2140
- this.setAttr(fldAttr.maxLength, requiredMaxLength);
2059
+ this._maxLength = requiredMaxLength;
2141
2060
  }
2142
2061
  },
2143
2062
  enumerable: false,
@@ -2154,58 +2073,50 @@
2154
2073
  this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
2155
2074
  };
2156
2075
  FieldDescriptor.prototype.notifyEditionFinish = function () {
2157
- var _a, _b, _c, _d;
2076
+ var _a, _b;
2158
2077
  var intrinsicValidation = true;
2159
- 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;
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;
2160
2081
  var fieldValue = this.getValue();
2161
- if (fieldValue && (fieldDefaultFormat || this.fieldFormat)) {
2162
- intrinsicValidation = ((_b = fieldDefaultFormat === null || fieldDefaultFormat === void 0 ? void 0 : fieldDefaultFormat.test(fieldValue)) !== null && _b !== void 0 ? _b : true)
2163
- && ((_d = (_c = this.fieldFormat) === null || _c === void 0 ? void 0 : _c.test(fieldValue)) !== null && _d !== void 0 ? _d : true);
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);
2164
2085
  if (!intrinsicValidation) {
2165
2086
  this.setError('99', this._intrinsicErrorMessage);
2166
2087
  }
2167
2088
  }
2168
2089
  this._editionFinish.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
2169
2090
  };
2170
- FieldDescriptor.prototype.setAttr = function (name, value) {
2171
- if (this[name]) {
2172
- this[name] = value;
2173
- }
2174
- if (MONITORED_ATTRIBUTES.includes(name)) {
2175
- this._attributeChange.next({ name: name, value: value });
2176
- }
2177
- };
2178
2091
  FieldDescriptor.prototype.notifyEditionDetailRequest = function () {
2179
2092
  this._detailRequest.next(this.fieldCode);
2180
2093
  };
2181
- FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); };
2182
- FieldDescriptor.prototype.showLabel = function () { this.setVisibleLabel(true); };
2183
- FieldDescriptor.prototype.hideLabel = function () { this.setVisibleLabel(false); };
2184
- FieldDescriptor.prototype.setChanged = function (hasChanged) { this.setAttr(fldAttr.hasChanged, hasChanged); };
2185
- FieldDescriptor.prototype.changed = function () { this.setChanged(true); };
2094
+ FieldDescriptor.prototype.showLabel = function () { this.visibleLabel = true; };
2095
+ FieldDescriptor.prototype.hideLabel = function () { this.visibleLabel = false; };
2096
+ FieldDescriptor.prototype.changed = function () { this.hasChanged = true; };
2186
2097
  FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
2187
- FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
2098
+ FieldDescriptor.prototype.setLabel = function (label) { this.fieldTitle = label; };
2188
2099
  FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); };
2189
2100
  Object.defineProperty(FieldDescriptor.prototype, "backend", {
2190
2101
  get: function () { return this.validateOnServer; },
2191
2102
  enumerable: false,
2192
2103
  configurable: true
2193
2104
  });
2105
+ FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.visibleLabel = visibleLabel; };
2194
2106
  FieldDescriptor.prototype.setEditable = function (editable) {
2195
2107
  if (editable === void 0) { editable = true; }
2196
2108
  (editable) ? this.enable() : this.disable();
2197
2109
  };
2198
- FieldDescriptor.prototype.hasError = function () { return this.errorCode !== '00'; };
2199
2110
  FieldDescriptor.prototype.setError = function (code, message, type) {
2200
- if (type === void 0) { type = DEFAULT_ERROR_TYPE; }
2201
- this.setAttr(fldAttr.errorCode, code !== null && code !== void 0 ? code : '00');
2202
- this.setAttr(fldAttr.errorType, (this.errorCode === '00') ? '' : type);
2203
- this.setAttr(fldAttr.errorMessage, message !== null && message !== void 0 ? message : '');
2111
+ if (type === void 0) { type = 'error'; }
2112
+ this.errorType = (code === '00') ? '' : type;
2113
+ this.errorCode = code;
2114
+ this.errorMessage = message;
2204
2115
  };
2205
2116
  FieldDescriptor.prototype.getError = function () { return { type: this.errorType, code: this.errorCode, message: this.errorMessage }; };
2206
2117
  Object.defineProperty(FieldDescriptor.prototype, "error", {
2207
2118
  get: function () { return this.getError(); },
2208
- set: function (errorObj) { var _a; this.setError(errorObj.code, errorObj.message, (_a = errorObj.type) !== null && _a !== void 0 ? _a : DEFAULT_ERROR_TYPE); },
2119
+ set: function (errorObj) { this.setError(errorObj.code, errorObj.message, errorObj.type); },
2209
2120
  enumerable: false,
2210
2121
  configurable: true
2211
2122
  });
@@ -2241,39 +2152,68 @@
2241
2152
  };
2242
2153
  FieldDescriptor.prototype.updateFromServer = function (fld) {
2243
2154
  var _a;
2244
- var fieldKeys = Object.keys(fld);
2245
- for (var index = 0; index < fieldKeys.length; index++) {
2246
- var attrName = fieldKeys[index];
2247
- var attrValue = fld[attrName];
2248
- (attrName === FIELD_VISIBLE) && this.setVisibility(attrValue);
2249
- (attrName === FIELD_LABEL_VISIBLE) && this.setVisibleLabel(fld.visibleLabel);
2250
- (attrName === FIELD_REQUIRED) && this.setAttr(fldAttr.required, (_a = fld.required) !== null && _a !== void 0 ? _a : false);
2251
- (attrName === FIELD_ERR_CODE) && this.setAttr(fldAttr.errorCode, fld.errorCode);
2252
- (attrName === FIELD_ERR_MSG) && this.setAttr(fldAttr.errorMessage, fld.errorMessage);
2253
- (attrName === FIELD_TOOLTIP) && this.setAttr(fldAttr.tooltipText, fld.tooltip);
2254
- (attrName === FIELD_INFO) && this.setAttr(fldAttr.info, fld.info);
2255
- (attrName === FIELD_EDITABLE) && this.setEditable(fld.editable);
2256
- (attrName === FIELD_TITLE) && this.setLabel(fld.fieldTitle.toString());
2257
- (attrName === FIELD_VALUE) && (this.setValue(fld._fieldValue) && this.setChanged(false));
2258
- (attrName === FIELD_OPTIONS) && this.setFieldOptions(fld.fieldOptions);
2259
- (attrName === FIELD_CAPTURE_TYPE) && this.setAttr(fldAttr.captureType, fld.captureType || 'INPUT');
2260
- (attrName === FIELD_TYPE) && this.setFieldType(fld.fieldTypeCode);
2261
- (attrName === FIELD_MAX_LENGTH) && this.setAttr(fldAttr.maxLength, fld.maxLength);
2155
+ if (FIELD_VISIBLE in fld) {
2156
+ this.setVisibility(fld.visible);
2157
+ }
2158
+ if (FIELD_LABEL_VISIBLE in fld) {
2159
+ this.setVisibleLabel(fld.visibleLabel);
2160
+ }
2161
+ if (FIELD_REQUIRED in fld) {
2162
+ this.fieldRequired = (_a = fld.required) !== null && _a !== void 0 ? _a : false;
2163
+ }
2164
+ if (FIELD_ERR_CODE in fld) {
2165
+ (this.errorCode = fld.errorCode);
2166
+ }
2167
+ if (FIELD_ERR_MSG in fld) {
2168
+ (this.errorMessage = fld.errorMessage);
2169
+ }
2170
+ if (FIELD_TOOLTIP in fld) {
2171
+ (this.tooltipText = fld.tooltip);
2172
+ }
2173
+ if (FIELD_INFO in fld) {
2174
+ (this.fieldInfo = fld.info);
2175
+ }
2176
+ if (FIELD_EDITABLE in fld) {
2177
+ this.setEditable(fld.editable);
2178
+ }
2179
+ if (FIELD_TITLE in fld) {
2180
+ this.setLabel(fld.fieldTitle.toString());
2181
+ }
2182
+ if (FIELD_VALUE in fld) {
2183
+ this.hasChanged = false;
2184
+ this.setValue(fld.fieldValue);
2185
+ }
2186
+ if (FIELD_OPTIONS in fld) {
2187
+ this.setFieldOptions(fld.fieldOptions);
2188
+ }
2189
+ if (FIELD_CAPTURE_TYPE in fld) {
2190
+ this.captureType = fld.captureType || 'INPUT';
2191
+ }
2192
+ if (FIELD_TYPE in fld) {
2193
+ this.setFieldType(fld.fieldTypeCode);
2194
+ }
2195
+ if (FIELD_MAX_LENGTH in fld) {
2196
+ this.maxLength = fld.maxLength;
2262
2197
  }
2263
2198
  };
2264
2199
  FieldDescriptor.prototype.setFieldType = function (inputFieldType) {
2265
- this.setAttr(fldAttr.type, inputFieldType);
2200
+ this.fieldType = inputFieldType;
2201
+ /**
2202
+ * Se elimina la validación de que sea un tipo conocido
2203
+ * this.fieldType = (inputFieldType && FIELDTYPES.includes(inputFieldType))
2204
+ * ? inputFieldType : componentConstants.FIELDTYPE_TEXT;
2205
+ */
2266
2206
  };
2267
2207
  FieldDescriptor.prototype.format = function () {
2268
2208
  if (this.fieldType === componentConstants.FIELDTYPE_CURRENCY) {
2269
- this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
2209
+ this._fieldValue = formatCurrency(this._fieldValue);
2270
2210
  }
2271
2211
  };
2272
2212
  FieldDescriptor.prototype.setMinValue = function (minValue) {
2273
2213
  var _a, _b, _c;
2274
2214
  if (this.fieldType === componentConstants.FIELDTYPE_DATE
2275
2215
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMinValue)) {
2276
- this.setAttr(fldAttr.minValue, minValue);
2216
+ this._minValue = minValue;
2277
2217
  if (!minValue) {
2278
2218
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMinValue(false);
2279
2219
  }
@@ -2287,7 +2227,7 @@
2287
2227
  var _a, _b, _c;
2288
2228
  if (this.fieldType === componentConstants.FIELDTYPE_DATE
2289
2229
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMaxValue)) {
2290
- this.setAttr(fldAttr.maxValue, maxValue);
2230
+ this._maxValue = maxValue;
2291
2231
  if (!maxValue) {
2292
2232
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMaxValue(false);
2293
2233
  }
@@ -2315,16 +2255,14 @@
2315
2255
  }
2316
2256
  return Object.assign({}, option);
2317
2257
  });
2318
- fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
2258
+ this.fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
2319
2259
  && fieldOptions.length > 0) ? fieldOptions : [];
2320
- this.setAttr(fldAttr.options, fieldOptions);
2321
2260
  if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && this.widget) {
2322
2261
  return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
2323
2262
  }
2324
2263
  if (this._fieldValue) {
2325
2264
  if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && Array.isArray(this._fieldValue)) {
2326
- var fieldValue = (_b = this._fieldValue) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return _this.fieldOptions.find(function (opt) { return opt.fieldOptionId === item; }); });
2327
- this.setAttr(fldAttr.value, fieldValue);
2265
+ this._fieldValue = (_b = this._fieldValue) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return _this.fieldOptions.find(function (opt) { return opt.fieldOptionId === item; }); });
2328
2266
  }
2329
2267
  else {
2330
2268
  var valInOptions = this.fieldOptions
@@ -2345,7 +2283,7 @@
2345
2283
  if (widgetUpdate === void 0) { widgetUpdate = true; }
2346
2284
  var _a;
2347
2285
  if (typeof newValue === UNDEFINED || newValue === null) {
2348
- return true;
2286
+ return;
2349
2287
  }
2350
2288
  var newFinalValue;
2351
2289
  switch (this.fieldType) {
@@ -2385,10 +2323,9 @@
2385
2323
  break;
2386
2324
  }
2387
2325
  if (this._fieldValue !== newFinalValue) {
2388
- this.setChanged(true);
2389
- this.setAttr(fldAttr.value, newFinalValue);
2326
+ this.hasChanged = true;
2327
+ this._fieldValue = newFinalValue;
2390
2328
  }
2391
- return true;
2392
2329
  };
2393
2330
  return FieldDescriptor;
2394
2331
  }(FormElement));
@@ -2871,9 +2808,9 @@
2871
2808
  var fieldObject = this.getFieldObject(fieldCode);
2872
2809
  return (fieldObject) ? fieldObject.setValue(fieldValue) : null;
2873
2810
  };
2874
- FormStructureAndData.prototype.setFieldError = function (code, message, type) {
2811
+ FormStructureAndData.prototype.setFieldError = function (fieldCode, code, message, type) {
2875
2812
  if (type === void 0) { type = 'error'; }
2876
- var fieldObject = this.getFieldObject(code);
2813
+ var fieldObject = this.getFieldObject(fieldCode);
2877
2814
  return (fieldObject) ? fieldObject.setError(code, message, type) : null;
2878
2815
  };
2879
2816
  FormStructureAndData.prototype.setFieldIntrinsicErrorMessage = function (code, message) {
@@ -3382,9 +3319,9 @@
3382
3319
  BasicFormComponent.prototype.setFieldValue = function (fieldCode, fieldValue) { return this.formStructure.setFieldValue(fieldCode, fieldValue); };
3383
3320
  BasicFormComponent.prototype.setFieldRequired = function (fieldCode, required) { return this.formStructure.setFieldRequired(fieldCode, required); };
3384
3321
  BasicFormComponent.prototype.setFieldErrorMessage = function (fieldCode, errorMessage) { return this.formStructure.setFieldErrorMessage(fieldCode, errorMessage); };
3385
- BasicFormComponent.prototype.setFieldError = function (code, message, type) {
3322
+ BasicFormComponent.prototype.setFieldError = function (fieldCode, code, message, type) {
3386
3323
  if (type === void 0) { type = 'error'; }
3387
- return this.formStructure.setFieldError(code, message, type);
3324
+ return this.formStructure.setFieldError(fieldCode, code, message, type);
3388
3325
  };
3389
3326
  BasicFormComponent.prototype.setFieldIntrinsicErrorMessage = function (code, message) { return this.formStructure.setFieldIntrinsicErrorMessage(code, message); };
3390
3327
  BasicFormComponent.prototype.setFieldOptions = function (fieldCode, optionsArray, idAttribute, nameAttribute) {