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.
@@ -143,12 +143,40 @@ const DEFAULT_STATE_FLOW = {
143
143
  ]
144
144
  };
145
145
 
146
+ const MONITORED_ATTRIBUTES$1 = {
147
+ _maxLength: 'maxLength',
148
+ _onValidation: '_onValidation',
149
+ _fieldValue: 'value',
150
+ captureType: 'captureType',
151
+ fieldTitle: 'fieldTitle',
152
+ fieldType: 'fieldType',
153
+ errorMessage: 'errorMessage',
154
+ errorType: 'errorType',
155
+ errorCode: 'errorCode',
156
+ visibleLabel: 'visibleLabel',
157
+ fieldRequired: 'fieldRequired',
158
+ fieldOptions: 'fieldOptions',
159
+ };
146
160
  class FieldComponent {
147
161
  constructor() {
148
162
  this.componentConstants = Object.assign({}, componentConstants);
149
163
  }
150
164
  ngOnInit() {
151
- this.fieldObject.widget = this;
165
+ if (this.fieldObject) {
166
+ // Atributos estáticos
167
+ this.fieldCode = this.fieldObject.fieldCode;
168
+ this.fieldInfo = this.fieldObject.fieldInfo;
169
+ this.fieldAlignment = this.fieldObject.fieldAlignment;
170
+ this.tooltipText = this.fieldObject.tooltipText;
171
+ this.fieldObject.widget = this;
172
+ // Atributos dinámicos
173
+ this.fieldObject.attributeChange.subscribe(event => {
174
+ const { name, value } = event;
175
+ if (this[MONITORED_ATTRIBUTES$1[name]]) {
176
+ this[MONITORED_ATTRIBUTES$1[name]] = value;
177
+ }
178
+ });
179
+ }
152
180
  this.start();
153
181
  }
154
182
  start() { }
@@ -311,9 +339,9 @@ class FormElement {
311
339
  this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
312
340
  this.widget = null;
313
341
  }
314
- isField() { return this.type === componentConstants.ELEMENTTYPE_FIELD; }
315
- isAction() { return this.type === componentConstants.ELEMENTTYPE_ACTION; }
316
- isTable() { return this.type === componentConstants.ELEMENTTYPE_TABLE; }
342
+ isField() { return this.elementType === componentConstants.ELEMENTTYPE_FIELD; }
343
+ isAction() { return this.elementType === componentConstants.ELEMENTTYPE_ACTION; }
344
+ isTable() { return this.elementType === componentConstants.ELEMENTTYPE_TABLE; }
317
345
  setVisibleStates(newStates) {
318
346
  const visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
319
347
  ? newStates.split(',').map(state => state.trim()).filter(state => state.length > 0)
@@ -592,7 +620,7 @@ class RecordTable extends FormElement {
592
620
  this._tableColumnObj = {};
593
621
  this._actionsObj = {};
594
622
  this.allSelected = false;
595
- this.type = componentConstants.ELEMENTTYPE_TABLE;
623
+ this.elementType = componentConstants.ELEMENTTYPE_TABLE;
596
624
  this.waiting = false;
597
625
  this.complexFilter = false;
598
626
  this.currentPage = 1;
@@ -1170,7 +1198,7 @@ class RecordFormSubSection {
1170
1198
  break;
1171
1199
  }
1172
1200
  if (elementObject) {
1173
- elementObject.type = type;
1201
+ elementObject.elementType = type;
1174
1202
  arrayToAdd.push(elementObject);
1175
1203
  this.subSectionElements.push(elementObject);
1176
1204
  this.elementsArray[code] = elementObject;
@@ -1307,7 +1335,7 @@ class FormAction extends FormElement {
1307
1335
  super(actionDefinition);
1308
1336
  this._actionActivated = new Subject();
1309
1337
  this.inProgress = false;
1310
- this.type = componentConstants.ELEMENTTYPE_ACTION;
1338
+ this.elementType = componentConstants.ELEMENTTYPE_ACTION;
1311
1339
  this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
1312
1340
  this.actionName = actionDefinition.actionTitle;
1313
1341
  this.iconName = actionDefinition.iconName || this.actionCode;
@@ -1350,6 +1378,7 @@ const FIELD_TOOLTIP = 'tooltipText';
1350
1378
  const FIELD_INFO = 'info';
1351
1379
  const FIELD_EDITABLE = 'editable';
1352
1380
  const FIELD_TYPES = {
1381
+ boolean: 'BOOLEAN',
1353
1382
  array: 'ARRAY',
1354
1383
  check: 'CHECK',
1355
1384
  date: 'DATE',
@@ -1377,67 +1406,109 @@ const FIELD_TYPES = {
1377
1406
  const FIELD_TYPES_FORMATS = {
1378
1407
  EMAIL: new RegExp('^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$'),
1379
1408
  };
1409
+ const INTRINSIC_ERROR_MESSAGES = {
1410
+ EMAIL: `El valor no corresponde a un correo válido`,
1411
+ DEFAULT: `El valor no se ajusta al formato establecido`,
1412
+ };
1413
+ const DEFAULT_ERROR_TYPE = 'error';
1414
+ const DEFAULT_CAPTURE_TYPE = 'INPUT';
1415
+ const DEFAULT_ALIGNMENT = 'left';
1416
+ const MONITORED_ATTRIBUTES = ['_maxLength', '_onValidation', 'captureType', 'fieldTitle', 'fieldType',
1417
+ 'errorMessage', 'errorType', 'errorCode', 'visibleLabel', 'fieldRequired', 'fieldOptions', '_fieldValue'];
1380
1418
  const STD_MAX_LENGTH = 50;
1381
1419
  const BIG_MAX_LENGTH = 500;
1420
+ const fldAttr = {
1421
+ validateOnServer: 'validateOnServer',
1422
+ value: '_fieldValue',
1423
+ minValue: '_minValue',
1424
+ maxValue: '_maxValue',
1425
+ maxLength: '_maxLength',
1426
+ onValidation: '_onValidation',
1427
+ intrinsicErrorMessage: '_intrinsicErrorMessage',
1428
+ code: 'fieldCode',
1429
+ info: 'fieldInfo',
1430
+ defaultValue: 'defaultValue',
1431
+ defaultEditable: 'defaultEditable',
1432
+ customAttributes: 'customAttributes',
1433
+ visibleLabel: 'visibleLabel',
1434
+ required: 'fieldRequired',
1435
+ hasChanged: 'hasChanged',
1436
+ outputOnly: 'outputOnly',
1437
+ captureType: 'captureType',
1438
+ title: 'fieldTitle',
1439
+ type: 'fieldType',
1440
+ alignment: 'fieldAlignment',
1441
+ format: 'fieldFormat',
1442
+ externalValue: 'externalValue',
1443
+ tooltipText: 'tooltipText',
1444
+ errorType: 'errorType',
1445
+ errorCode: 'errorCode',
1446
+ errorMessage: 'errorMessage',
1447
+ options: 'fieldOptions',
1448
+ };
1382
1449
  class FieldDescriptor extends FormElement {
1383
1450
  constructor(inputFieldReceived) {
1384
- var _a, _b, _c, _d, _e, _f, _g, _h;
1451
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1385
1452
  super(inputFieldReceived);
1386
1453
  this._editionFinish = new Subject();
1387
1454
  this._editionPartial = new Subject();
1388
1455
  this._detailRequest = new Subject();
1389
- this.type = componentConstants.ELEMENTTYPE_FIELD;
1390
- const fieldReceived = (inputFieldReceived) ? inputFieldReceived : {};
1391
- this.setEditable((_a = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.editable) !== null && _a !== void 0 ? _a : true);
1392
- this.fieldCode = fieldReceived.fieldCode;
1393
- this.fieldTitle = fieldReceived.fieldTitle || this.fieldCode;
1394
- this.captureType = fieldReceived.captureType || 'INPUT';
1395
- this.setFieldType(fieldReceived.fieldTypeCode);
1396
- this.defaultValue = fieldReceived.defaultValue || null;
1397
- this._maxLength = (_b = fieldReceived.maxLength) !== null && _b !== void 0 ? _b : (this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
1398
- this.setValue(fieldReceived.fieldValue || this.defaultValue || '');
1399
- const defaultTypeAlignment = (tableFieldStyles[this.fieldType] != null) ? tableFieldStyles[this.fieldType]['text-align'] : 'left';
1400
- this.fieldAlignment = (fieldReceived.alignment != null) ? fieldReceived.alignment.toLowerCase() : defaultTypeAlignment;
1401
- this.fieldInfo = fieldReceived.info || '';
1456
+ this._attributeChange = new Subject();
1457
+ this.elementType = componentConstants.ELEMENTTYPE_FIELD;
1458
+ const fld = (inputFieldReceived) ? inputFieldReceived : {};
1459
+ this.setAttr(fldAttr.code, fld.fieldCode);
1460
+ this.setAttr(fldAttr.title, (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : this.fieldCode);
1461
+ this.setAttr(fldAttr.captureType, (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE);
1462
+ this.setAttr(fldAttr.defaultValue, (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null);
1463
+ const defaultTypeAlignment = (tableFieldStyles[this.fieldType] != null)
1464
+ ? tableFieldStyles[this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
1465
+ const fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
1466
+ this.setAttr(fldAttr.alignment, fieldAlignment);
1467
+ this.setAttr(fldAttr.info, fld.info || '');
1468
+ let fieldFormat;
1402
1469
  try {
1403
- this.fieldFormat = (fieldReceived.format) ? new RegExp(fieldReceived.format) : null;
1470
+ fieldFormat = (fld.format) ? new RegExp(fld.format) : null;
1404
1471
  }
1405
1472
  catch (e) {
1406
- this.fieldFormat = null;
1407
- }
1408
- this.validateOnServer = (_c = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.serverAction) !== null && _c !== void 0 ? _c : false;
1409
- this.customAttributes = (_d = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.customAttributes) !== null && _d !== void 0 ? _d : null;
1410
- this.setVisibility(fieldReceived.visible);
1411
- this.visibleLabel = (_e = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.visibleLabel) !== null && _e !== void 0 ? _e : true;
1412
- this.tooltipText = fieldReceived.tooltip || '';
1413
- this.defaultEditable = this.enabled;
1414
- this.fieldRequired = (_f = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.required) !== null && _f !== void 0 ? _f : false;
1415
- this.errorMessage = fieldReceived.errorMessage || '';
1416
- this.errorCode = (_g = fieldReceived.errorCode) !== null && _g !== void 0 ? _g : '00';
1417
- this.outputOnly = (_h = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.outputOnly) !== null && _h !== void 0 ? _h : false;
1418
- this.setFieldOptions(fieldReceived.fieldOptions);
1419
- this._intrinsicErrorMessage = (this.fieldType === FIELD_TYPES.email)
1420
- ? `El valor de ${this.fieldTitle} no corresponde a un correo válido`
1421
- : `El valor de ${this.fieldTitle} no se ajusta al formato establecido`;
1473
+ fieldFormat = null;
1474
+ }
1475
+ this.setAttr(fldAttr.format, fieldFormat);
1476
+ this.setAttr(fldAttr.validateOnServer, (_d = fld.serverAction) !== null && _d !== void 0 ? _d : false);
1477
+ this.setAttr(fldAttr.customAttributes, (_e = fld.customAttributes) !== null && _e !== void 0 ? _e : {});
1478
+ this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
1479
+ this.setAttr(fldAttr.defaultEditable, this.enabled);
1480
+ this.setAttr(fldAttr.required, (_f = fld.required) !== null && _f !== void 0 ? _f : false);
1481
+ this.setError(fld.errorCode, fld.errorMessage, (_g = fld.errorType) !== null && _g !== void 0 ? _g : DEFAULT_ERROR_TYPE);
1482
+ this.setAttr(fldAttr.outputOnly, (_h = fld.outputOnly) !== null && _h !== void 0 ? _h : false);
1483
+ const maxLength = (_j = fld.maxLength) !== null && _j !== void 0 ? _j : (this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
1484
+ this.setAttr(fldAttr.maxLength, maxLength);
1485
+ this.setAttr(fldAttr.intrinsicErrorMessage, (_k = INTRINSIC_ERROR_MESSAGES[this.fieldType]) !== null && _k !== void 0 ? _k : INTRINSIC_ERROR_MESSAGES.DEFAULT);
1486
+ this.setFieldType(fld.fieldTypeCode);
1487
+ this.setEditable((_l = fld.editable) !== null && _l !== void 0 ? _l : true);
1488
+ this.setVisibleLabel((_m = fld.visibleLabel) !== null && _m !== void 0 ? _m : true);
1489
+ this.setVisibility(fld.visible);
1490
+ this.setFieldOptions(fld.fieldOptions);
1491
+ this.setValue(fld.fieldValue || this.defaultValue || '');
1422
1492
  }
1423
1493
  get name() { return this.fieldCode; }
1424
1494
  get editionFinish() { return this._editionFinish; }
1495
+ get attributeChange() { return this._attributeChange; }
1425
1496
  get editionPartial() { return this._editionPartial; }
1426
1497
  get detailRequest() { return this._detailRequest; }
1427
1498
  get validating() { return this._onValidation; }
1428
- set validating(isValidating) { this._onValidation = isValidating; }
1429
- setIntrinsicErrorMessage(message) { this._intrinsicErrorMessage = message; }
1499
+ set validating(isValidating) { this.setAttr(fldAttr.onValidation, isValidating); }
1500
+ setIntrinsicErrorMessage(message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); }
1430
1501
  set intrinsicErrorMessage(message) { this.setIntrinsicErrorMessage(message); }
1431
1502
  get fieldValue() { return this.getValue(); }
1432
1503
  get required() { return this.fieldRequired; }
1433
- set required(required) { this.fieldRequired = required !== null && required !== void 0 ? required : false; }
1504
+ set required(required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); }
1434
1505
  get maxLength() { return (this._maxLength > 0) ? this._maxLength.toString() : ''; }
1435
1506
  set maxLength(requiredMaxLength) {
1436
1507
  if (typeof requiredMaxLength === 'string') {
1437
- this._maxLength = parseInt(requiredMaxLength, 10);
1508
+ this.setAttr(fldAttr.maxLength, parseInt(requiredMaxLength, 10));
1438
1509
  }
1439
1510
  else if (typeof requiredMaxLength === 'number') {
1440
- this._maxLength = requiredMaxLength;
1511
+ this.setAttr(fldAttr.maxLength, requiredMaxLength);
1441
1512
  }
1442
1513
  }
1443
1514
  get value() { return this.getValue(); }
@@ -1460,26 +1531,36 @@ class FieldDescriptor extends FormElement {
1460
1531
  }
1461
1532
  this._editionFinish.next({ code: this.fieldCode, intrinsicValidation });
1462
1533
  }
1534
+ setAttr(name, value) {
1535
+ if (this[name]) {
1536
+ this[name] = value;
1537
+ }
1538
+ if (MONITORED_ATTRIBUTES.includes(name)) {
1539
+ this._attributeChange.next({ name, value });
1540
+ }
1541
+ }
1463
1542
  notifyEditionDetailRequest() {
1464
1543
  this._detailRequest.next(this.fieldCode);
1465
1544
  }
1466
- showLabel() { this.visibleLabel = true; }
1467
- hideLabel() { this.visibleLabel = false; }
1468
- changed() { this.hasChanged = true; }
1545
+ setVisibleLabel(visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); }
1546
+ showLabel() { this.setVisibleLabel(true); }
1547
+ hideLabel() { this.setVisibleLabel(false); }
1548
+ setChanged(hasChanged) { this.setAttr(fldAttr.hasChanged, hasChanged); }
1549
+ changed() { this.setChanged(true); }
1469
1550
  getRawValue() { return this._fieldValue; }
1470
- setLabel(label) { this.fieldTitle = label; }
1551
+ setLabel(label) { this.setAttr(fldAttr.title, label); }
1471
1552
  clean() { this.setValue(this.defaultValue || ''); }
1472
1553
  get backend() { return this.validateOnServer; }
1473
- setVisibleLabel(visibleLabel) { this.visibleLabel = visibleLabel; }
1474
1554
  setEditable(editable = true) { (editable) ? this.enable() : this.disable(); }
1475
- setError(code, message, type = 'error') {
1476
- this.errorType = (code === '00') ? '' : type;
1477
- this.errorCode = code;
1478
- this.errorMessage = message;
1555
+ hasError() { return this.errorCode !== '00'; }
1556
+ setError(code, message, type = DEFAULT_ERROR_TYPE) {
1557
+ this.setAttr(fldAttr.errorCode, code !== null && code !== void 0 ? code : '00');
1558
+ this.setAttr(fldAttr.errorType, (this.errorCode === '00') ? '' : type);
1559
+ this.setAttr(fldAttr.errorMessage, message !== null && message !== void 0 ? message : '');
1479
1560
  }
1480
1561
  getError() { return { type: this.errorType, code: this.errorCode, message: this.errorMessage }; }
1481
1562
  get error() { return this.getError(); }
1482
- set error(errorObj) { this.setError(errorObj.code, errorObj.message, errorObj.type); }
1563
+ set error(errorObj) { var _a; this.setError(errorObj.code, errorObj.message, (_a = errorObj.type) !== null && _a !== void 0 ? _a : DEFAULT_ERROR_TYPE); }
1483
1564
  getErrorCode() { return this.getError().code; }
1484
1565
  setErrorCode(code) { this.setError(code, this.errorMessage); }
1485
1566
  getErrorMessage() { return this.getError().message; }
@@ -1512,68 +1593,39 @@ class FieldDescriptor extends FormElement {
1512
1593
  }
1513
1594
  updateFromServer(fld) {
1514
1595
  var _a;
1515
- if (FIELD_VISIBLE in fld) {
1516
- this.setVisibility(fld.visible);
1517
- }
1518
- if (FIELD_LABEL_VISIBLE in fld) {
1519
- this.setVisibleLabel(fld.visibleLabel);
1520
- }
1521
- if (FIELD_REQUIRED in fld) {
1522
- this.fieldRequired = (_a = fld.required) !== null && _a !== void 0 ? _a : false;
1523
- }
1524
- if (FIELD_ERR_CODE in fld) {
1525
- (this.errorCode = fld.errorCode);
1526
- }
1527
- if (FIELD_ERR_MSG in fld) {
1528
- (this.errorMessage = fld.errorMessage);
1529
- }
1530
- if (FIELD_TOOLTIP in fld) {
1531
- (this.tooltipText = fld.tooltip);
1532
- }
1533
- if (FIELD_INFO in fld) {
1534
- (this.fieldInfo = fld.info);
1535
- }
1536
- if (FIELD_EDITABLE in fld) {
1537
- this.setEditable(fld.editable);
1538
- }
1539
- if (FIELD_TITLE in fld) {
1540
- this.setLabel(fld.fieldTitle.toString());
1541
- }
1542
- if (FIELD_VALUE in fld) {
1543
- this.hasChanged = false;
1544
- this.setValue(fld.fieldValue);
1545
- }
1546
- if (FIELD_OPTIONS in fld) {
1547
- this.setFieldOptions(fld.fieldOptions);
1548
- }
1549
- if (FIELD_CAPTURE_TYPE in fld) {
1550
- this.captureType = fld.captureType || 'INPUT';
1551
- }
1552
- if (FIELD_TYPE in fld) {
1553
- this.setFieldType(fld.fieldTypeCode);
1554
- }
1555
- if (FIELD_MAX_LENGTH in fld) {
1556
- this.maxLength = fld.maxLength;
1596
+ const fieldKeys = Object.keys(fld);
1597
+ for (let index = 0; index < fieldKeys.length; index++) {
1598
+ const attrName = fieldKeys[index];
1599
+ const attrValue = fld[attrName];
1600
+ (attrName === FIELD_VISIBLE) && this.setVisibility(attrValue);
1601
+ (attrName === FIELD_LABEL_VISIBLE) && this.setVisibleLabel(fld.visibleLabel);
1602
+ (attrName === FIELD_REQUIRED) && this.setAttr(fldAttr.required, (_a = fld.required) !== null && _a !== void 0 ? _a : false);
1603
+ (attrName === FIELD_ERR_CODE) && this.setAttr(fldAttr.errorCode, fld.errorCode);
1604
+ (attrName === FIELD_ERR_MSG) && this.setAttr(fldAttr.errorMessage, fld.errorMessage);
1605
+ (attrName === FIELD_TOOLTIP) && this.setAttr(fldAttr.tooltipText, fld.tooltip);
1606
+ (attrName === FIELD_INFO) && this.setAttr(fldAttr.info, fld.info);
1607
+ (attrName === FIELD_EDITABLE) && this.setEditable(fld.editable);
1608
+ (attrName === FIELD_TITLE) && this.setLabel(fld.fieldTitle.toString());
1609
+ (attrName === FIELD_VALUE) && (this.setValue(fld._fieldValue) && this.setChanged(false));
1610
+ (attrName === FIELD_OPTIONS) && this.setFieldOptions(fld.fieldOptions);
1611
+ (attrName === FIELD_CAPTURE_TYPE) && this.setAttr(fldAttr.captureType, fld.captureType || 'INPUT');
1612
+ (attrName === FIELD_TYPE) && this.setFieldType(fld.fieldTypeCode);
1613
+ (attrName === FIELD_MAX_LENGTH) && this.setAttr(fldAttr.maxLength, fld.maxLength);
1557
1614
  }
1558
1615
  }
1559
1616
  setFieldType(inputFieldType) {
1560
- this.fieldType = inputFieldType;
1561
- /**
1562
- * Se elimina la validación de que sea un tipo conocido
1563
- * this.fieldType = (inputFieldType && FIELDTYPES.includes(inputFieldType))
1564
- * ? inputFieldType : componentConstants.FIELDTYPE_TEXT;
1565
- */
1617
+ this.setAttr(fldAttr.type, inputFieldType);
1566
1618
  }
1567
1619
  format() {
1568
1620
  if (this.fieldType === componentConstants.FIELDTYPE_CURRENCY) {
1569
- this._fieldValue = formatCurrency(this._fieldValue);
1621
+ this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
1570
1622
  }
1571
1623
  }
1572
1624
  setMinValue(minValue) {
1573
1625
  var _a, _b, _c;
1574
1626
  if (this.fieldType === componentConstants.FIELDTYPE_DATE
1575
1627
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMinValue)) {
1576
- this._minValue = minValue;
1628
+ this.setAttr(fldAttr.minValue, minValue);
1577
1629
  if (!minValue) {
1578
1630
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMinValue(false);
1579
1631
  }
@@ -1587,7 +1639,7 @@ class FieldDescriptor extends FormElement {
1587
1639
  var _a, _b, _c;
1588
1640
  if (this.fieldType === componentConstants.FIELDTYPE_DATE
1589
1641
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMaxValue)) {
1590
- this._maxValue = maxValue;
1642
+ this.setAttr(fldAttr.maxValue, maxValue);
1591
1643
  if (!maxValue) {
1592
1644
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMaxValue(false);
1593
1645
  }
@@ -1607,21 +1659,23 @@ class FieldDescriptor extends FormElement {
1607
1659
  || !Array.isArray(newOptions)) {
1608
1660
  return;
1609
1661
  }
1610
- const fieldOptions = newOptions.map(option => {
1662
+ let fieldOptions = newOptions.map(option => {
1611
1663
  if (option.text !== undefined && option.text !== null
1612
1664
  && option.value !== undefined && option.value !== null) {
1613
1665
  return { fieldOptionValue: option.text, fieldOptionId: option.value };
1614
1666
  }
1615
1667
  return Object.assign({}, option);
1616
1668
  });
1617
- this.fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
1669
+ fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
1618
1670
  && fieldOptions.length > 0) ? fieldOptions : [];
1671
+ this.setAttr(fldAttr.options, fieldOptions);
1619
1672
  if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && this.widget) {
1620
1673
  return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
1621
1674
  }
1622
1675
  if (this._fieldValue) {
1623
1676
  if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && Array.isArray(this._fieldValue)) {
1624
- this._fieldValue = (_b = this._fieldValue) === null || _b === void 0 ? void 0 : _b.filter(item => this.fieldOptions.find(opt => opt.fieldOptionId === item));
1677
+ const fieldValue = (_b = this._fieldValue) === null || _b === void 0 ? void 0 : _b.filter(item => this.fieldOptions.find(opt => opt.fieldOptionId === item));
1678
+ this.setAttr(fldAttr.value, fieldValue);
1625
1679
  }
1626
1680
  else {
1627
1681
  const valInOptions = this.fieldOptions
@@ -1641,7 +1695,7 @@ class FieldDescriptor extends FormElement {
1641
1695
  setValue(newValue, widgetUpdate = true) {
1642
1696
  var _a;
1643
1697
  if (typeof newValue === UNDEFINED || newValue === null) {
1644
- return;
1698
+ return true;
1645
1699
  }
1646
1700
  let newFinalValue;
1647
1701
  switch (this.fieldType) {
@@ -1681,9 +1735,10 @@ class FieldDescriptor extends FormElement {
1681
1735
  break;
1682
1736
  }
1683
1737
  if (this._fieldValue !== newFinalValue) {
1684
- this.hasChanged = true;
1685
- this._fieldValue = newFinalValue;
1738
+ this.setChanged(true);
1739
+ this.setAttr(fldAttr.value, newFinalValue);
1686
1740
  }
1741
+ return true;
1687
1742
  }
1688
1743
  }
1689
1744