tuain-ng-forms-lib 0.12.23 → 0.12.30

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,12 +146,41 @@
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
+ };
149
163
  var FieldComponent = /** @class */ (function () {
150
164
  function FieldComponent() {
151
165
  this.componentConstants = Object.assign({}, componentConstants);
152
166
  }
153
167
  FieldComponent.prototype.ngOnInit = function () {
154
- this.fieldObject.widget = this;
168
+ var _this = this;
169
+ if (this.fieldObject) {
170
+ // Atributos estáticos
171
+ this.fieldCode = 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
+ }
155
184
  this.start();
156
185
  };
157
186
  FieldComponent.prototype.start = function () { };
@@ -657,9 +686,9 @@
657
686
  this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
658
687
  this.widget = null;
659
688
  }
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; };
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; };
663
692
  FormElement.prototype.setVisibleStates = function (newStates) {
664
693
  var visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
665
694
  ? newStates.split(',').map(function (state) { return state.trim(); }).filter(function (state) { return state.length > 0; })
@@ -986,7 +1015,7 @@
986
1015
  _this._tableColumnObj = {};
987
1016
  _this._actionsObj = {};
988
1017
  _this.allSelected = false;
989
- _this.type = componentConstants.ELEMENTTYPE_TABLE;
1018
+ _this.elementType = componentConstants.ELEMENTTYPE_TABLE;
990
1019
  _this.waiting = false;
991
1020
  _this.complexFilter = false;
992
1021
  _this.currentPage = 1;
@@ -1679,7 +1708,7 @@
1679
1708
  break;
1680
1709
  }
1681
1710
  if (elementObject) {
1682
- elementObject.type = type;
1711
+ elementObject.elementType = type;
1683
1712
  arrayToAdd.push(elementObject);
1684
1713
  this.subSectionElements.push(elementObject);
1685
1714
  this.elementsArray[code] = elementObject;
@@ -1889,7 +1918,7 @@
1889
1918
  _this = _super.call(this, actionDefinition) || this;
1890
1919
  _this._actionActivated = new rxjs.Subject();
1891
1920
  _this.inProgress = false;
1892
- _this.type = componentConstants.ELEMENTTYPE_ACTION;
1921
+ _this.elementType = componentConstants.ELEMENTTYPE_ACTION;
1893
1922
  _this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
1894
1923
  _this.actionName = actionDefinition.actionTitle;
1895
1924
  _this.iconName = actionDefinition.iconName || _this.actionCode;
@@ -1938,6 +1967,7 @@
1938
1967
  var FIELD_INFO = 'info';
1939
1968
  var FIELD_EDITABLE = 'editable';
1940
1969
  var FIELD_TYPES = {
1970
+ boolean: 'BOOLEAN',
1941
1971
  array: 'ARRAY',
1942
1972
  check: 'CHECK',
1943
1973
  date: 'DATE',
@@ -1965,50 +1995,91 @@
1965
1995
  var FIELD_TYPES_FORMATS = {
1966
1996
  EMAIL: new RegExp('^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$'),
1967
1997
  };
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'];
1968
2007
  var STD_MAX_LENGTH = 50;
1969
2008
  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
+ };
1970
2038
  var FieldDescriptor = /** @class */ (function (_super) {
1971
2039
  __extends(FieldDescriptor, _super);
1972
2040
  function FieldDescriptor(inputFieldReceived) {
1973
2041
  var _this = this;
1974
- var _a, _b, _c, _d, _e, _f, _g, _h;
2042
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1975
2043
  _this = _super.call(this, inputFieldReceived) || this;
1976
2044
  _this._editionFinish = new rxjs.Subject();
1977
2045
  _this._editionPartial = new rxjs.Subject();
1978
2046
  _this._detailRequest = new rxjs.Subject();
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 || '';
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;
1992
2060
  try {
1993
- _this.fieldFormat = (fieldReceived.format) ? new RegExp(fieldReceived.format) : null;
2061
+ fieldFormat = (fld.format) ? new RegExp(fld.format) : null;
1994
2062
  }
1995
2063
  catch (e) {
1996
- _this.fieldFormat = null;
1997
- }
1998
- _this.validateOnServer = (_c = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.serverAction) !== null && _c !== void 0 ? _c : false;
1999
- _this.customAttributes = (_d = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.customAttributes) !== null && _d !== void 0 ? _d : null;
2000
- _this.setVisibility(fieldReceived.visible);
2001
- _this.visibleLabel = (_e = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.visibleLabel) !== null && _e !== void 0 ? _e : true;
2002
- _this.tooltipText = fieldReceived.tooltip || '';
2003
- _this.defaultEditable = _this.enabled;
2004
- _this.fieldRequired = (_f = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.required) !== null && _f !== void 0 ? _f : false;
2005
- _this.errorMessage = fieldReceived.errorMessage || '';
2006
- _this.errorCode = (_g = fieldReceived.errorCode) !== null && _g !== void 0 ? _g : '00';
2007
- _this.outputOnly = (_h = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.outputOnly) !== null && _h !== void 0 ? _h : false;
2008
- _this.setFieldOptions(fieldReceived.fieldOptions);
2009
- _this._intrinsicErrorMessage = (_this.fieldType === FIELD_TYPES.email)
2010
- ? "El valor de " + _this.fieldTitle + " no corresponde a un correo v\u00E1lido"
2011
- : "El valor de " + _this.fieldTitle + " no se ajusta al formato establecido";
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 || '');
2012
2083
  return _this;
2013
2084
  }
2014
2085
  Object.defineProperty(FieldDescriptor.prototype, "name", {
@@ -2021,6 +2092,11 @@
2021
2092
  enumerable: false,
2022
2093
  configurable: true
2023
2094
  });
2095
+ Object.defineProperty(FieldDescriptor.prototype, "attributeChange", {
2096
+ get: function () { return this._attributeChange; },
2097
+ enumerable: false,
2098
+ configurable: true
2099
+ });
2024
2100
  Object.defineProperty(FieldDescriptor.prototype, "editionPartial", {
2025
2101
  get: function () { return this._editionPartial; },
2026
2102
  enumerable: false,
@@ -2033,11 +2109,11 @@
2033
2109
  });
2034
2110
  Object.defineProperty(FieldDescriptor.prototype, "validating", {
2035
2111
  get: function () { return this._onValidation; },
2036
- set: function (isValidating) { this._onValidation = isValidating; },
2112
+ set: function (isValidating) { this.setAttr(fldAttr.onValidation, isValidating); },
2037
2113
  enumerable: false,
2038
2114
  configurable: true
2039
2115
  });
2040
- FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this._intrinsicErrorMessage = message; };
2116
+ FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); };
2041
2117
  Object.defineProperty(FieldDescriptor.prototype, "intrinsicErrorMessage", {
2042
2118
  set: function (message) { this.setIntrinsicErrorMessage(message); },
2043
2119
  enumerable: false,
@@ -2050,7 +2126,7 @@
2050
2126
  });
2051
2127
  Object.defineProperty(FieldDescriptor.prototype, "required", {
2052
2128
  get: function () { return this.fieldRequired; },
2053
- set: function (required) { this.fieldRequired = required !== null && required !== void 0 ? required : false; },
2129
+ set: function (required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); },
2054
2130
  enumerable: false,
2055
2131
  configurable: true
2056
2132
  });
@@ -2058,10 +2134,10 @@
2058
2134
  get: function () { return (this._maxLength > 0) ? this._maxLength.toString() : ''; },
2059
2135
  set: function (requiredMaxLength) {
2060
2136
  if (typeof requiredMaxLength === 'string') {
2061
- this._maxLength = parseInt(requiredMaxLength, 10);
2137
+ this.setAttr(fldAttr.maxLength, parseInt(requiredMaxLength, 10));
2062
2138
  }
2063
2139
  else if (typeof requiredMaxLength === 'number') {
2064
- this._maxLength = requiredMaxLength;
2140
+ this.setAttr(fldAttr.maxLength, requiredMaxLength);
2065
2141
  }
2066
2142
  },
2067
2143
  enumerable: false,
@@ -2091,35 +2167,45 @@
2091
2167
  }
2092
2168
  this._editionFinish.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
2093
2169
  };
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
+ };
2094
2178
  FieldDescriptor.prototype.notifyEditionDetailRequest = function () {
2095
2179
  this._detailRequest.next(this.fieldCode);
2096
2180
  };
2097
- FieldDescriptor.prototype.showLabel = function () { this.visibleLabel = true; };
2098
- FieldDescriptor.prototype.hideLabel = function () { this.visibleLabel = false; };
2099
- FieldDescriptor.prototype.changed = function () { this.hasChanged = true; };
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); };
2100
2186
  FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
2101
- FieldDescriptor.prototype.setLabel = function (label) { this.fieldTitle = label; };
2187
+ FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
2102
2188
  FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); };
2103
2189
  Object.defineProperty(FieldDescriptor.prototype, "backend", {
2104
2190
  get: function () { return this.validateOnServer; },
2105
2191
  enumerable: false,
2106
2192
  configurable: true
2107
2193
  });
2108
- FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.visibleLabel = visibleLabel; };
2109
2194
  FieldDescriptor.prototype.setEditable = function (editable) {
2110
2195
  if (editable === void 0) { editable = true; }
2111
2196
  (editable) ? this.enable() : this.disable();
2112
2197
  };
2198
+ FieldDescriptor.prototype.hasError = function () { return this.errorCode !== '00'; };
2113
2199
  FieldDescriptor.prototype.setError = function (code, message, type) {
2114
- if (type === void 0) { type = 'error'; }
2115
- this.errorType = (code === '00') ? '' : type;
2116
- this.errorCode = code;
2117
- this.errorMessage = message;
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 : '');
2118
2204
  };
2119
2205
  FieldDescriptor.prototype.getError = function () { return { type: this.errorType, code: this.errorCode, message: this.errorMessage }; };
2120
2206
  Object.defineProperty(FieldDescriptor.prototype, "error", {
2121
2207
  get: function () { return this.getError(); },
2122
- set: function (errorObj) { this.setError(errorObj.code, errorObj.message, errorObj.type); },
2208
+ set: function (errorObj) { var _a; this.setError(errorObj.code, errorObj.message, (_a = errorObj.type) !== null && _a !== void 0 ? _a : DEFAULT_ERROR_TYPE); },
2123
2209
  enumerable: false,
2124
2210
  configurable: true
2125
2211
  });
@@ -2155,68 +2241,39 @@
2155
2241
  };
2156
2242
  FieldDescriptor.prototype.updateFromServer = function (fld) {
2157
2243
  var _a;
2158
- if (FIELD_VISIBLE in fld) {
2159
- this.setVisibility(fld.visible);
2160
- }
2161
- if (FIELD_LABEL_VISIBLE in fld) {
2162
- this.setVisibleLabel(fld.visibleLabel);
2163
- }
2164
- if (FIELD_REQUIRED in fld) {
2165
- this.fieldRequired = (_a = fld.required) !== null && _a !== void 0 ? _a : false;
2166
- }
2167
- if (FIELD_ERR_CODE in fld) {
2168
- (this.errorCode = fld.errorCode);
2169
- }
2170
- if (FIELD_ERR_MSG in fld) {
2171
- (this.errorMessage = fld.errorMessage);
2172
- }
2173
- if (FIELD_TOOLTIP in fld) {
2174
- (this.tooltipText = fld.tooltip);
2175
- }
2176
- if (FIELD_INFO in fld) {
2177
- (this.fieldInfo = fld.info);
2178
- }
2179
- if (FIELD_EDITABLE in fld) {
2180
- this.setEditable(fld.editable);
2181
- }
2182
- if (FIELD_TITLE in fld) {
2183
- this.setLabel(fld.fieldTitle.toString());
2184
- }
2185
- if (FIELD_VALUE in fld) {
2186
- this.hasChanged = false;
2187
- this.setValue(fld.fieldValue);
2188
- }
2189
- if (FIELD_OPTIONS in fld) {
2190
- this.setFieldOptions(fld.fieldOptions);
2191
- }
2192
- if (FIELD_CAPTURE_TYPE in fld) {
2193
- this.captureType = fld.captureType || 'INPUT';
2194
- }
2195
- if (FIELD_TYPE in fld) {
2196
- this.setFieldType(fld.fieldTypeCode);
2197
- }
2198
- if (FIELD_MAX_LENGTH in fld) {
2199
- this.maxLength = fld.maxLength;
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);
2200
2262
  }
2201
2263
  };
2202
2264
  FieldDescriptor.prototype.setFieldType = function (inputFieldType) {
2203
- this.fieldType = inputFieldType;
2204
- /**
2205
- * Se elimina la validación de que sea un tipo conocido
2206
- * this.fieldType = (inputFieldType && FIELDTYPES.includes(inputFieldType))
2207
- * ? inputFieldType : componentConstants.FIELDTYPE_TEXT;
2208
- */
2265
+ this.setAttr(fldAttr.type, inputFieldType);
2209
2266
  };
2210
2267
  FieldDescriptor.prototype.format = function () {
2211
2268
  if (this.fieldType === componentConstants.FIELDTYPE_CURRENCY) {
2212
- this._fieldValue = formatCurrency(this._fieldValue);
2269
+ this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
2213
2270
  }
2214
2271
  };
2215
2272
  FieldDescriptor.prototype.setMinValue = function (minValue) {
2216
2273
  var _a, _b, _c;
2217
2274
  if (this.fieldType === componentConstants.FIELDTYPE_DATE
2218
2275
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMinValue)) {
2219
- this._minValue = minValue;
2276
+ this.setAttr(fldAttr.minValue, minValue);
2220
2277
  if (!minValue) {
2221
2278
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMinValue(false);
2222
2279
  }
@@ -2230,7 +2287,7 @@
2230
2287
  var _a, _b, _c;
2231
2288
  if (this.fieldType === componentConstants.FIELDTYPE_DATE
2232
2289
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMaxValue)) {
2233
- this._maxValue = maxValue;
2290
+ this.setAttr(fldAttr.maxValue, maxValue);
2234
2291
  if (!maxValue) {
2235
2292
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMaxValue(false);
2236
2293
  }
@@ -2258,14 +2315,16 @@
2258
2315
  }
2259
2316
  return Object.assign({}, option);
2260
2317
  });
2261
- this.fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
2318
+ fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
2262
2319
  && fieldOptions.length > 0) ? fieldOptions : [];
2320
+ this.setAttr(fldAttr.options, fieldOptions);
2263
2321
  if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && this.widget) {
2264
2322
  return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
2265
2323
  }
2266
2324
  if (this._fieldValue) {
2267
2325
  if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && Array.isArray(this._fieldValue)) {
2268
- 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; }); });
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);
2269
2328
  }
2270
2329
  else {
2271
2330
  var valInOptions = this.fieldOptions
@@ -2286,7 +2345,7 @@
2286
2345
  if (widgetUpdate === void 0) { widgetUpdate = true; }
2287
2346
  var _a;
2288
2347
  if (typeof newValue === UNDEFINED || newValue === null) {
2289
- return;
2348
+ return true;
2290
2349
  }
2291
2350
  var newFinalValue;
2292
2351
  switch (this.fieldType) {
@@ -2326,9 +2385,10 @@
2326
2385
  break;
2327
2386
  }
2328
2387
  if (this._fieldValue !== newFinalValue) {
2329
- this.hasChanged = true;
2330
- this._fieldValue = newFinalValue;
2388
+ this.setChanged(true);
2389
+ this.setAttr(fldAttr.value, newFinalValue);
2331
2390
  }
2391
+ return true;
2332
2392
  };
2333
2393
  return FieldDescriptor;
2334
2394
  }(FormElement));