tuain-ng-forms-lib 12.0.21 → 12.0.25

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.
Files changed (29) hide show
  1. package/README.md +2 -2
  2. package/bundles/tuain-ng-forms-lib.umd.js +1533 -1576
  3. package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
  4. package/esm2015/lib/classes/forms/action.js +3 -4
  5. package/esm2015/lib/classes/forms/element.js +14 -2
  6. package/esm2015/lib/classes/forms/field.js +14 -22
  7. package/esm2015/lib/classes/forms/form.js +243 -393
  8. package/esm2015/lib/classes/forms/section.js +7 -1
  9. package/esm2015/lib/classes/forms/table/row-data.js +6 -26
  10. package/esm2015/lib/classes/forms/table/table.js +3 -4
  11. package/esm2015/lib/components/elements/layout/element.component.js +2 -1
  12. package/esm2015/lib/components/elements/tables/table.component.js +31 -31
  13. package/esm2015/lib/components/forms/basic-form.js +500 -274
  14. package/fesm2015/tuain-ng-forms-lib.js +1005 -992
  15. package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
  16. package/lib/classes/forms/action.d.ts +0 -2
  17. package/lib/classes/forms/element.d.ts +16 -6
  18. package/lib/classes/forms/field.d.ts +4 -3
  19. package/lib/classes/forms/form.d.ts +105 -92
  20. package/lib/classes/forms/section.d.ts +5 -0
  21. package/lib/classes/forms/table/row-data.d.ts +0 -1
  22. package/lib/classes/forms/table/table.d.ts +0 -1
  23. package/lib/components/elements/layout/element.component.d.ts +1 -0
  24. package/lib/components/elements/tables/table.component.d.ts +1 -1
  25. package/lib/components/forms/basic-form.d.ts +188 -152
  26. package/package.json +1 -1
  27. package/tuain-ng-forms-lib.metadata.json +1 -1
  28. package/esm2015/lib/classes/utilities.js +0 -54
  29. package/lib/classes/utilities.d.ts +0 -1
@@ -515,6 +515,7 @@
515
515
  ];
516
516
  ElementComponent.propDecorators = {
517
517
  element: [{ type: core.Input }],
518
+ form: [{ type: core.Input }],
518
519
  currentState: [{ type: core.Input }]
519
520
  };
520
521
 
@@ -647,7 +648,7 @@
647
648
 
648
649
  var FormElement = /** @class */ (function () {
649
650
  function FormElement(elementDefinition, formConfig) {
650
- var _a, _b;
651
+ var _a, _b, _c;
651
652
  this._formConfig = formConfig;
652
653
  this._isForced = false;
653
654
  this.setVisibleStates(elementDefinition.visibleStates);
@@ -656,7 +657,15 @@
656
657
  this.disabled = (_a = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.disabled) !== null && _a !== void 0 ? _a : false;
657
658
  this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
658
659
  this.widget = null;
660
+ this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : null;
659
661
  }
662
+ FormElement.prototype.getCustomAttribute = function (name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; };
663
+ FormElement.prototype.setCustomAttribute = function (name, value) {
664
+ if (name) {
665
+ this.customAttributes[name] = value;
666
+ }
667
+ };
668
+ FormElement.prototype.matchAttribute = function (name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; };
660
669
  FormElement.prototype.isField = function () { return this.elementType === elementTypes.field; };
661
670
  FormElement.prototype.isAction = function () { return this.elementType === elementTypes.action; };
662
671
  FormElement.prototype.isTable = function () { return this.elementType === elementTypes.table; };
@@ -674,7 +683,13 @@
674
683
  };
675
684
  FormElement.prototype.viewOnState = function (state) { return (this.visibleStates && state) ? this.visibleStates.includes(state) : false; };
676
685
  FormElement.prototype.enabledOnState = function (state) { return (this.enabledStates && state) ? this.enabledStates.includes(state) : false; };
686
+ /**
687
+ * @deprecated Utilizar viewOnState
688
+ */
677
689
  FormElement.prototype.supportState = function (state) { return this.viewOnState(state); };
690
+ /**
691
+ * @deprecated Utilizar viewOnState
692
+ */
678
693
  FormElement.prototype.supportMode = function (state) { return this.viewOnState(state); };
679
694
  Object.defineProperty(FormElement.prototype, "visible", {
680
695
  get: function () { return (this._isForced) ? this._visibleForced : this._visible; },
@@ -767,62 +782,6 @@
767
782
  return TableAction;
768
783
  }());
769
784
 
770
- function formatCurrency(inputValue) {
771
- if (!inputValue) {
772
- return null;
773
- }
774
- var numeralDecimalMark = '.';
775
- var numeralPositiveOnly = false;
776
- var stripLeadingZeroes = true;
777
- var numeralIntegerScale = 12;
778
- var numeralDecimalScale = 2;
779
- var delimiter = ',';
780
- var parts;
781
- var partInteger;
782
- var partDecimal = '';
783
- // Se eliminan los caracteres alfabéticos
784
- var outputValue = inputValue.toString();
785
- if (!outputValue) {
786
- return;
787
- }
788
- /**
789
- * Se remplaza el primer caracter de marca decimal con el marcador reservado
790
- * Se eliminan los caractertes no numéricos excepto el signo menos y 'M'
791
- * utilizado como separador decimal en este punto, eliminando los prefijos
792
- * Se remplaza el caracter menos por un marcador resertvado
793
- * Se eliminan todos los demás caracteres menos en caso de estar presentes
794
- * Se remplaza el marcador de caracter menos (si está presente)
795
- * Se remplaza el marcador de separación decimal
796
- */
797
- var value = outputValue.replace(/[A-Za-z]/g, '')
798
- .replace(numeralDecimalMark, 'M')
799
- .replace(/[^\dM-]/g, '')
800
- .replace(/^\-/, 'N')
801
- .replace(/\-/g, '')
802
- .replace('N', numeralPositiveOnly ? '' : '-')
803
- .replace('M', numeralDecimalMark);
804
- // Se eliminan los ceros a la izquierda
805
- if (stripLeadingZeroes) {
806
- value = value.replace(/^(-)?0+(?=\d)/, '$1');
807
- }
808
- // Se separa la parte entera de la parte decimal
809
- partInteger = value;
810
- if (value.indexOf(numeralDecimalMark) >= 0) {
811
- parts = value.split(numeralDecimalMark);
812
- partInteger = parts[0];
813
- partDecimal = numeralDecimalMark + parts[1].slice(0, numeralDecimalScale);
814
- }
815
- if (numeralIntegerScale > 0) {
816
- partInteger = partInteger.slice(0, numeralIntegerScale + (value.slice(0, 1) === '-' ? 1 : 0));
817
- }
818
- // Se separan los digitos de acuerdo a la configuraciñon de agrupación
819
- partInteger = partInteger.replace(/(\d)(?=(\d{3})+$)/g, '$1' + delimiter);
820
- outputValue = partInteger.toString() + (numeralDecimalScale > 0 ? partDecimal.toString() : '');
821
- return outputValue;
822
- }
823
-
824
- var DATE_TYPE = 'DATE';
825
- var CURRENCY_TYPE = 'CURRENCY';
826
785
  var TableRecordData = /** @class */ (function () {
827
786
  function TableRecordData(recordReceived, recordDefinition, selectionFieldName) {
828
787
  var _this = this;
@@ -841,8 +800,7 @@
841
800
  rawRecordData.forEach(function (fieldData) {
842
801
  var fieldCode = fieldData.fieldCode, fieldValue = fieldData.fieldValue;
843
802
  var fieldDef = recordDefinition.find(function (column) { return column.fieldCode === fieldCode; });
844
- var formattedFieldValue = _this.formatFieldValue(fieldDef.fieldType, fieldValue);
845
- _this.recordData[fieldCode] = formattedFieldValue;
803
+ _this.recordData[fieldCode] = fieldValue !== null && fieldValue !== void 0 ? fieldValue : '';
846
804
  if (fieldCode === selectionFieldName) {
847
805
  _this.selected = fieldValue;
848
806
  }
@@ -853,29 +811,13 @@
853
811
  fields.forEach(function (fieldCode) {
854
812
  var fieldValue = recordData[fieldCode];
855
813
  var fieldDef = recordDefinition.find(function (column) { return column.fieldCode === fieldCode; });
856
- var formattedFieldValue = _this.formatFieldValue(fieldDef.fieldType, fieldValue);
857
- _this.recordData[fieldCode] = formattedFieldValue;
814
+ _this.recordData[fieldCode] = fieldValue !== null && fieldValue !== void 0 ? fieldValue : '';
858
815
  });
859
816
  }
860
817
  }
861
- TableRecordData.prototype.formatFieldValue = function (fieldType, fieldValue) {
862
- if (fieldType === CURRENCY_TYPE) {
863
- return formatCurrency(fieldValue);
864
- }
865
- else if (fieldType === DATE_TYPE && fieldValue) {
866
- return new Date(fieldValue).toISOString().split('T')[0];
867
- }
868
- return fieldValue || '';
869
- };
870
- TableRecordData.prototype.toggleSelect = function () {
871
- this.selected = !this.selected;
872
- };
873
- TableRecordData.prototype.select = function () {
874
- this.selected = true;
875
- };
876
- TableRecordData.prototype.unselect = function () {
877
- this.selected = false;
878
- };
818
+ TableRecordData.prototype.toggleSelect = function () { this.selected = !this.selected; };
819
+ TableRecordData.prototype.select = function () { this.selected = true; };
820
+ TableRecordData.prototype.unselect = function () { this.selected = false; };
879
821
  Object.defineProperty(TableRecordData.prototype, "recordIdKey", {
880
822
  get: function () {
881
823
  return (typeof this.recordId === 'object')
@@ -984,9 +926,9 @@
984
926
  var RecordTable = /** @class */ (function (_super) {
985
927
  __extends(RecordTable, _super);
986
928
  function RecordTable(tableReceived, formConfig) {
987
- var e_1, _h, e_2, _j, e_3, _k;
929
+ var e_1, _g, e_2, _h, e_3, _j;
988
930
  var _this = this;
989
- var _a, _b, _c, _d, _e, _f, _g;
931
+ var _a, _b, _c, _d, _e, _f;
990
932
  _this = _super.call(this, tableReceived, formConfig) || this;
991
933
  _this._inlineActionTrigger = new rxjs.Subject();
992
934
  _this._globalActionTrigger = new rxjs.Subject();
@@ -1019,15 +961,14 @@
1019
961
  _this._appendPages = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.append) !== null && _c !== void 0 ? _c : false;
1020
962
  _this.selectable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _d !== void 0 ? _d : false;
1021
963
  _this.setAttr('selectionBackend', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _e !== void 0 ? _e : false);
1022
- _this.customAttributes = (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.customAttributes) !== null && _f !== void 0 ? _f : {};
1023
- _this.setAttr('sortable', (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false);
964
+ _this.setAttr('sortable', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _f !== void 0 ? _f : false);
1024
965
  _this.setAttr('sorting', { columnName: '', direction: '' });
1025
966
  _this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
1026
967
  if (tableReceived.fields) {
1027
968
  var columns = [];
1028
969
  try {
1029
- for (var _l = __values(tableReceived.fields), _m = _l.next(); !_m.done; _m = _l.next()) {
1030
- var columnReceived = _m.value;
970
+ for (var _k = __values(tableReceived.fields), _l = _k.next(); !_l.done; _l = _k.next()) {
971
+ var columnReceived = _l.value;
1031
972
  var columnDefinition = new RecordTableColumn(columnReceived, _this._formConfig);
1032
973
  columns.push(columnDefinition);
1033
974
  _this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
@@ -1036,7 +977,7 @@
1036
977
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
1037
978
  finally {
1038
979
  try {
1039
- if (_m && !_m.done && (_h = _l.return)) _h.call(_l);
980
+ if (_l && !_l.done && (_g = _k.return)) _g.call(_k);
1040
981
  }
1041
982
  finally { if (e_1) throw e_1.error; }
1042
983
  }
@@ -1067,7 +1008,7 @@
1067
1008
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
1068
1009
  finally {
1069
1010
  try {
1070
- if (tableActions_1_1 && !tableActions_1_1.done && (_j = tableActions_1.return)) _j.call(tableActions_1);
1011
+ if (tableActions_1_1 && !tableActions_1_1.done && (_h = tableActions_1.return)) _h.call(tableActions_1);
1071
1012
  }
1072
1013
  finally { if (e_2) throw e_2.error; }
1073
1014
  }
@@ -1076,8 +1017,8 @@
1076
1017
  _this.setAttr('complexFilter', true);
1077
1018
  var filterConfig = _this.filterConfig;
1078
1019
  try {
1079
- for (var _o = __values(tableReceived.filters), _p = _o.next(); !_p.done; _p = _o.next()) {
1080
- var filterReceived = _p.value;
1020
+ for (var _m = __values(tableReceived.filters), _o = _m.next(); !_o.done; _o = _m.next()) {
1021
+ var filterReceived = _o.value;
1081
1022
  var filterItem = new FieldSearch(filterReceived);
1082
1023
  filterConfig.push(filterItem);
1083
1024
  }
@@ -1085,7 +1026,7 @@
1085
1026
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
1086
1027
  finally {
1087
1028
  try {
1088
- if (_p && !_p.done && (_k = _o.return)) _k.call(_o);
1029
+ if (_o && !_o.done && (_j = _m.return)) _j.call(_m);
1089
1030
  }
1090
1031
  finally { if (e_3) throw e_3.error; }
1091
1032
  }
@@ -1237,7 +1178,7 @@
1237
1178
  this.tableRecords.forEach(function (record) { return record.unselect(); });
1238
1179
  };
1239
1180
  RecordTable.prototype.setTableRecords = function (tableRecords, append) {
1240
- var e_4, _h;
1181
+ var e_4, _g;
1241
1182
  var _a;
1242
1183
  if (!append) {
1243
1184
  this.clean();
@@ -1256,7 +1197,7 @@
1256
1197
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
1257
1198
  finally {
1258
1199
  try {
1259
- if (tableRecords_1_1 && !tableRecords_1_1.done && (_h = tableRecords_1.return)) _h.call(tableRecords_1);
1200
+ if (tableRecords_1_1 && !tableRecords_1_1.done && (_g = tableRecords_1.return)) _g.call(tableRecords_1);
1260
1201
  }
1261
1202
  finally { if (e_4) throw e_4.error; }
1262
1203
  }
@@ -1573,23 +1514,23 @@
1573
1514
  LibTableComponent.prototype.ngOnInit = function () {
1574
1515
  var _this = this;
1575
1516
  var _a, _b;
1576
- if (this.tableObject) {
1577
- this.formConfig = (_a = this.tableObject) === null || _a === void 0 ? void 0 : _a._formConfig;
1517
+ if (this.table) {
1518
+ this.formConfig = (_a = this.table) === null || _a === void 0 ? void 0 : _a._formConfig;
1578
1519
  this.tableFieldStyles = this.formConfig.tableFieldStyles;
1579
- this.selectable = this.tableObject.selectable;
1580
- this.hasActions = this.tableObject.hasActions;
1581
- this.tableObject.widget = this;
1582
- this.inlineActions = this.tableObject.getActions(this.formConfig.tableActions.inline);
1583
- this.globalActions = this.tableObject.getActions(this.formConfig.tableActions.global);
1584
- this.selectionActions = this.tableObject.getActions(this.formConfig.tableActions.selection);
1520
+ this.selectable = this.table.selectable;
1521
+ this.hasActions = this.table.hasActions;
1522
+ this.table.widget = this;
1523
+ this.inlineActions = this.table.getActions(this.formConfig.tableActions.inline);
1524
+ this.globalActions = this.table.getActions(this.formConfig.tableActions.global);
1525
+ this.selectionActions = this.table.getActions(this.formConfig.tableActions.selection);
1585
1526
  // Inicialización de campos mapeados del objeto
1586
1527
  var mapping = Object.entries(this.formConfig.componentTableAttrMap);
1587
1528
  for (var index = 0; index < mapping.length; index++) {
1588
1529
  var _c = __read(mapping[index], 2), tableAttr = _c[0], compAttr = _c[1];
1589
- this[compAttr.toString()] = (_b = this.tableObject) === null || _b === void 0 ? void 0 : _b[tableAttr.toString()];
1530
+ this[compAttr.toString()] = (_b = this.table) === null || _b === void 0 ? void 0 : _b[tableAttr.toString()];
1590
1531
  }
1591
1532
  // Subscripción a cambios en atributos
1592
- this.tableObject.attributeChange.subscribe(function (event) {
1533
+ this.table.attributeChange.subscribe(function (event) {
1593
1534
  var tableAttr = event.name, value = event.value;
1594
1535
  var compAttr = _this.formConfig.componentTableAttrMap[tableAttr];
1595
1536
  _this.hasOwnProperty(compAttr) && (_this[compAttr] = value);
@@ -1599,24 +1540,24 @@
1599
1540
  };
1600
1541
  LibTableComponent.prototype.start = function () { };
1601
1542
  LibTableComponent.prototype.tableGlobalAction = function (actionCode) {
1602
- this.tableObject.notifyGlobalAction(actionCode);
1543
+ this.table.notifyGlobalAction(actionCode);
1603
1544
  };
1604
1545
  LibTableComponent.prototype.tableSelectionAction = function (actionCode) {
1605
- this.tableObject.notifySelectionAction(actionCode);
1546
+ this.table.notifySelectionAction(actionCode);
1606
1547
  };
1607
1548
  LibTableComponent.prototype.tableActionSelected = function (actionEvent) {
1608
- this.tableObject.notifyInlineAction(actionEvent);
1549
+ this.table.notifyInlineAction(actionEvent);
1609
1550
  };
1610
1551
  LibTableComponent.prototype.tableColumnSort = function (columnFieldCode) {
1611
- this.tableObject.setRequiredOrder(columnFieldCode);
1552
+ this.table.setRequiredOrder(columnFieldCode);
1612
1553
  if (this.clientPaging) {
1613
- return this.tableObject.localSortData();
1554
+ return this.table.localSortData();
1614
1555
  }
1615
- this.tableObject.notifyGetDataAction();
1556
+ this.table.notifyGetDataAction();
1616
1557
  };
1617
1558
  LibTableComponent.prototype.changePage = function (requestedPage) {
1618
1559
  if (!this.clientPaging) {
1619
- this.tableObject.notifyGetDataAction(requestedPage);
1560
+ this.table.notifyGetDataAction(requestedPage);
1620
1561
  }
1621
1562
  };
1622
1563
  Object.defineProperty(LibTableComponent.prototype, "records", {
@@ -1636,50 +1577,50 @@
1636
1577
  var eventType = tableFilterEvent.eventType;
1637
1578
  var triggerDataUpdate = false;
1638
1579
  if (eventType === TABLE_FILTER_TYPES.simpleFilterChange || eventType === TABLE_FILTER_TYPES.simpleFilterFinish) {
1639
- this.tableObject.simpleFilterText = tableFilterEvent.simpleFilterString.trim();
1580
+ this.table.simpleFilterText = tableFilterEvent.simpleFilterString.trim();
1640
1581
  if (this.clientPaging) {
1641
- this.tableObject.setAttr('currentPage', 1);
1642
- this.tableObject.updateVisibleRecords();
1582
+ this.table.setAttr('currentPage', 1);
1583
+ this.table.updateVisibleRecords();
1643
1584
  }
1644
1585
  else if (eventType === TABLE_FILTER_TYPES.simpleFilterFinish) {
1645
1586
  triggerDataUpdate = true;
1646
1587
  }
1647
1588
  }
1648
1589
  if (eventType === TABLE_FILTER_TYPES.complexFilterAdd) {
1649
- this.tableObject.addFilterRestriction(tableFilterEvent.complexFilterItem);
1590
+ this.table.addFilterRestriction(tableFilterEvent.complexFilterItem);
1650
1591
  }
1651
1592
  if (eventType === TABLE_FILTER_TYPES.complexFilterRemove) {
1652
- this.tableObject.removeFilterRestriction(tableFilterEvent.itemName);
1593
+ this.table.removeFilterRestriction(tableFilterEvent.itemName);
1653
1594
  }
1654
1595
  if (triggerDataUpdate) {
1655
1596
  var tableGetDataEvent = {
1656
- tableCode: this.tableObject.tableCode,
1597
+ tableCode: this.table.tableCode,
1657
1598
  requestedPage: 1,
1658
1599
  };
1659
- this.tableObject.notifyGetDataAction(tableGetDataEvent);
1600
+ this.table.notifyGetDataAction(tableGetDataEvent);
1660
1601
  }
1661
1602
  };
1662
1603
  LibTableComponent.prototype.tableSelectionToggle = function (recordId) {
1663
- this.tableObject.notifyRecordSelection(recordId);
1604
+ this.table.notifyRecordSelection(recordId);
1664
1605
  };
1665
1606
  LibTableComponent.prototype.toggleSelectAll = function () {
1666
1607
  if (this.allSelected) {
1667
- this.tableObject.unSelectAll();
1608
+ this.table.unSelectAll();
1668
1609
  }
1669
1610
  else {
1670
- this.tableObject.selectAll();
1611
+ this.table.selectAll();
1671
1612
  }
1672
1613
  };
1673
1614
  Object.defineProperty(LibTableComponent.prototype, "availableFilters", {
1674
1615
  get: function () {
1675
- return this.tableObject.availableFilters;
1616
+ return this.table.availableFilters;
1676
1617
  },
1677
1618
  enumerable: false,
1678
1619
  configurable: true
1679
1620
  });
1680
1621
  Object.defineProperty(LibTableComponent.prototype, "selectedRecords", {
1681
1622
  get: function () {
1682
- return this.tableObject.selectedRecords;
1623
+ return this.table.selectedRecords;
1683
1624
  },
1684
1625
  enumerable: false,
1685
1626
  configurable: true
@@ -1694,384 +1635,141 @@
1694
1635
  },] }
1695
1636
  ];
1696
1637
  LibTableComponent.propDecorators = {
1697
- tableObject: [{ type: core.Input }],
1638
+ table: [{ type: core.Input }],
1698
1639
  tableRecords: [{ type: core.Input }],
1699
1640
  disabled: [{ type: core.Input }],
1700
1641
  currentState: [{ type: core.Input }],
1701
1642
  waiting: [{ type: core.Input }]
1702
1643
  };
1703
1644
 
1704
- var RecordFormSubSection = /** @class */ (function () {
1705
- function RecordFormSubSection(subsectionReceived, formObject) {
1706
- var e_1, _a;
1707
- if (!subsectionReceived) {
1708
- return;
1709
- }
1710
- this._customRender = null;
1711
- this.visible = true;
1712
- this.subSectionElements = [];
1713
- this.subSectionFields = [];
1714
- this.subSectionTables = [];
1715
- this.subSectionActions = [];
1716
- this.elementsArray = {};
1717
- this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
1718
- this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
1719
- this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
1720
- this.visibleStates = subsectionReceived.visibleStates || [];
1721
- if (subsectionReceived.elements) {
1722
- try {
1723
- for (var _b = __values(subsectionReceived.elements), _c = _b.next(); !_c.done; _c = _b.next()) {
1724
- var receivedElement = _c.value;
1725
- var elementObject = null;
1726
- var arrayToAdd = null;
1727
- var type = receivedElement.type, code = receivedElement.code;
1728
- switch (type) {
1729
- case elementTypes.field:
1730
- elementObject = formObject.getFieldObject(code);
1731
- arrayToAdd = this.subSectionFields;
1732
- break;
1733
- case elementTypes.table:
1734
- elementObject = formObject.getTableObject(code);
1735
- arrayToAdd = this.subSectionTables;
1736
- break;
1737
- case elementTypes.action:
1738
- elementObject = formObject.getActionObject(code);
1739
- arrayToAdd = this.subSectionActions;
1740
- break;
1741
- }
1742
- if (elementObject) {
1743
- elementObject.elementType = type;
1744
- arrayToAdd.push(elementObject);
1745
- this.subSectionElements.push(elementObject);
1746
- this.elementsArray[code] = elementObject;
1747
- }
1748
- }
1749
- }
1750
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1751
- finally {
1752
- try {
1753
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1754
- }
1755
- finally { if (e_1) throw e_1.error; }
1756
- }
1757
- }
1645
+ var HEADER = 'HEADER';
1646
+ var FormAction = /** @class */ (function (_super) {
1647
+ __extends(FormAction, _super);
1648
+ function FormAction(actionDefinition, formConfig) {
1649
+ var _this = this;
1650
+ var _a;
1651
+ _this = _super.call(this, actionDefinition, formConfig) || this;
1652
+ _this._actionActivated = new rxjs.Subject();
1653
+ _this.inProgress = false;
1654
+ _this.elementType = elementTypes.action;
1655
+ _this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
1656
+ _this.actionName = actionDefinition.actionTitle;
1657
+ _this.iconName = actionDefinition.iconName || _this.actionCode;
1658
+ _this.setCustomAttribute('location', actionDefinition.position || HEADER);
1659
+ _this.backend = (_a = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _a !== void 0 ? _a : false;
1660
+ _this.newState = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.newState;
1661
+ _this.restrictedOnField = actionDefinition.fieldRestrictedCode ? actionDefinition.fieldRestrictedCode.toString() : '';
1662
+ _this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
1663
+ _this.restrictedOnValue = actionDefinition.valueRestricted || '';
1664
+ _this.customValidation = function () { return true; };
1665
+ return _this;
1758
1666
  }
1759
- RecordFormSubSection.prototype.show = function () { this.visible = true; };
1760
- RecordFormSubSection.prototype.hide = function () { this.visible = false; };
1761
- Object.defineProperty(RecordFormSubSection.prototype, "customRender", {
1762
- get: function () { return this._customRender; },
1763
- set: function (customRenderName) { this._customRender = customRenderName; },
1667
+ Object.defineProperty(FormAction.prototype, "actionActivated", {
1668
+ get: function () { return this._actionActivated; },
1764
1669
  enumerable: false,
1765
1670
  configurable: true
1766
1671
  });
1767
- RecordFormSubSection.prototype.getField = function (name) {
1768
- return this.subSectionFields.find(function (fld) { return fld.name === name; });
1769
- };
1770
- RecordFormSubSection.prototype.getFields = function () {
1771
- return this.subSectionFields;
1772
- };
1773
- RecordFormSubSection.prototype.getFieldNames = function () {
1774
- return this.subSectionFields.map(function (field) { return field.fieldCode; });
1775
- };
1776
- RecordFormSubSection.prototype.viewOnState = function (state) {
1777
- return this.visibleStates.includes(state);
1672
+ FormAction.prototype.start = function () { this.inProgress = true; };
1673
+ FormAction.prototype.stop = function () { this.inProgress = false; };
1674
+ FormAction.prototype.notifyActivation = function () { this._actionActivated.next(this.actionCode); };
1675
+ FormAction.prototype.updateFromServer = function (receivedAction) {
1676
+ for (var propertyName in receivedAction) {
1677
+ if (propertyName !== 'actionCode' && propertyName !== 'actionId') {
1678
+ this[propertyName] = receivedAction[propertyName];
1679
+ }
1680
+ }
1778
1681
  };
1779
- RecordFormSubSection.prototype.supportMode = function (state) { return this.viewOnState(state); };
1780
- return RecordFormSubSection;
1781
- }());
1682
+ FormAction.prototype.setCustomValidation = function (callback) { this.customValidation = function () { return callback(); }; };
1683
+ return FormAction;
1684
+ }(FormElement));
1782
1685
 
1783
- var RecordFormSection = /** @class */ (function () {
1784
- function RecordFormSection(sectionReceived, formObject) {
1785
- var e_1, _a;
1686
+ var UNDEFINED = 'undefined';
1687
+ var DEFAULT_ERROR_TYPE = 'error';
1688
+ var DEFAULT_CAPTURE_TYPE = 'INPUT';
1689
+ var DEFAULT_ALIGNMENT = 'left';
1690
+ var STD_MAX_LENGTH = 50;
1691
+ var BIG_MAX_LENGTH = 500;
1692
+ var fldAttr = {
1693
+ validateOnServer: 'validateOnServer',
1694
+ value: '_fieldValue',
1695
+ minValue: '_minValue',
1696
+ maxValue: '_maxValue',
1697
+ maxLength: '_maxLength',
1698
+ onValidation: '_onValidation',
1699
+ intrinsicErrorMessage: '_intrinsicErrorMessage',
1700
+ code: 'fieldCode',
1701
+ info: 'fieldInfo',
1702
+ defaultValue: 'defaultValue',
1703
+ defaultEditable: 'defaultEditable',
1704
+ visibleLabel: 'visibleLabel',
1705
+ required: 'fieldRequired',
1706
+ hasChanged: 'hasChanged',
1707
+ outputOnly: 'outputOnly',
1708
+ captureType: 'captureType',
1709
+ title: 'fieldTitle',
1710
+ type: 'fieldType',
1711
+ alignment: 'fieldAlignment',
1712
+ format: 'fieldFormat',
1713
+ externalValue: 'externalValue',
1714
+ tooltipText: 'tooltipText',
1715
+ errorType: 'errorType',
1716
+ errorCode: 'errorCode',
1717
+ errorMessage: 'errorMessage',
1718
+ options: 'fieldOptions',
1719
+ };
1720
+ var FieldDescriptor = /** @class */ (function (_super) {
1721
+ __extends(FieldDescriptor, _super);
1722
+ function FieldDescriptor(inputFieldReceived, formConfig) {
1786
1723
  var _this = this;
1787
- this._activation = new rxjs.Subject();
1788
- this._inactivation = new rxjs.Subject();
1789
- this.active = false;
1790
- if (!sectionReceived) {
1791
- return;
1724
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1725
+ _this = _super.call(this, inputFieldReceived, formConfig) || this;
1726
+ _this._editionFinish = new rxjs.Subject();
1727
+ _this._editionPartial = new rxjs.Subject();
1728
+ _this._detailRequest = new rxjs.Subject();
1729
+ _this._attributeChange = new rxjs.Subject();
1730
+ _this.elementType = elementTypes.field;
1731
+ var fld = (inputFieldReceived) ? inputFieldReceived : {};
1732
+ _this.setAttr(fldAttr.code, fld.fieldCode);
1733
+ _this.setAttr(fldAttr.title, (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : _this.fieldCode);
1734
+ _this.setAttr(fldAttr.captureType, (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE);
1735
+ _this.setAttr(fldAttr.defaultValue, (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null);
1736
+ var defaultTypeAlignment = (_this._formConfig.tableFieldStyles[_this.fieldType] != null)
1737
+ ? _this._formConfig.tableFieldStyles[_this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
1738
+ var fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
1739
+ _this.setAttr(fldAttr.alignment, fieldAlignment);
1740
+ _this.setAttr(fldAttr.info, fld.info || '');
1741
+ var fieldFormat;
1742
+ try {
1743
+ fieldFormat = (fld.format) ? new RegExp(fld.format) : null;
1792
1744
  }
1793
- this.visible = true;
1794
- this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
1795
- this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
1796
- this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
1797
- this.visibleStates = sectionReceived.visibleStates || [];
1798
- this.subSections = [];
1799
- this.subSectionsObj = {};
1800
- if (sectionReceived.subsections) {
1801
- var subsections = sectionReceived.subsections.map(function (objDef) {
1802
- var visibleStates = objDef.visibleStates;
1803
- if (!visibleStates) {
1804
- visibleStates = (objDef.subsectionModes || '').split(',')
1805
- .map(function (state) { return state.trim(); })
1806
- .filter(function (state) { return state.length > 0; });
1807
- }
1808
- if (!visibleStates || visibleStates.length === 0) {
1809
- visibleStates = _this.visibleStates;
1810
- }
1811
- if (objDef.elements && Array.isArray(objDef.elements)) {
1812
- objDef.elements = objDef.elements.map(function (elm) { return ({ code: elm.elementCode, type: elm.elementTypeName }); });
1813
- }
1814
- return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates });
1815
- });
1816
- try {
1817
- for (var subsections_1 = __values(subsections), subsections_1_1 = subsections_1.next(); !subsections_1_1.done; subsections_1_1 = subsections_1.next()) {
1818
- var subsectionReceived = subsections_1_1.value;
1819
- var subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
1820
- var subsectionCode = subSectionToAdd.subsectionCode;
1821
- if (subsectionCode) {
1822
- this.subSections.push(subSectionToAdd);
1823
- this.subSectionsObj[subsectionCode] = subSectionToAdd;
1824
- }
1825
- }
1826
- }
1827
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1828
- finally {
1829
- try {
1830
- if (subsections_1_1 && !subsections_1_1.done && (_a = subsections_1.return)) _a.call(subsections_1);
1831
- }
1832
- finally { if (e_1) throw e_1.error; }
1833
- }
1745
+ catch (e) {
1746
+ fieldFormat = null;
1834
1747
  }
1748
+ _this.setAttr(fldAttr.format, fieldFormat);
1749
+ _this.setAttr(fldAttr.validateOnServer, (_d = fld.serverAction) !== null && _d !== void 0 ? _d : false);
1750
+ _this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
1751
+ _this.setAttr(fldAttr.defaultEditable, _this.enabled);
1752
+ _this.setAttr(fldAttr.required, (_e = fld.required) !== null && _e !== void 0 ? _e : false);
1753
+ _this.setError(fld.errorCode, fld.errorMessage, (_f = fld.errorType) !== null && _f !== void 0 ? _f : DEFAULT_ERROR_TYPE);
1754
+ _this.setAttr(fldAttr.outputOnly, (_g = fld.outputOnly) !== null && _g !== void 0 ? _g : false);
1755
+ var maxLength = (_h = fld.maxLength) !== null && _h !== void 0 ? _h : (_this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
1756
+ _this.setAttr(fldAttr.maxLength, maxLength);
1757
+ _this.setAttr(fldAttr.intrinsicErrorMessage, (_j = _this._formConfig.fieldTypeErrMsg[_this.fieldType]) !== null && _j !== void 0 ? _j : _this._formConfig.fieldTypeErrMsg.DEFAULT);
1758
+ _this.setFieldType(fld.fieldTypeCode);
1759
+ _this.setEditable((_k = fld.editable) !== null && _k !== void 0 ? _k : true);
1760
+ _this.setVisibleLabel((_l = fld.visibleLabel) !== null && _l !== void 0 ? _l : true);
1761
+ _this.setVisibility(fld.visible);
1762
+ _this.setFieldOptions(fld.fieldOptions);
1763
+ _this.setValue(fld.fieldValue || _this.defaultValue || '');
1764
+ return _this;
1835
1765
  }
1836
- Object.defineProperty(RecordFormSection.prototype, "activation", {
1837
- get: function () { return this._activation; },
1766
+ Object.defineProperty(FieldDescriptor.prototype, "name", {
1767
+ get: function () { return this.fieldCode; },
1838
1768
  enumerable: false,
1839
1769
  configurable: true
1840
1770
  });
1841
- Object.defineProperty(RecordFormSection.prototype, "inactivation", {
1842
- get: function () { return this._inactivation; },
1843
- enumerable: false,
1844
- configurable: true
1845
- });
1846
- RecordFormSection.prototype.activate = function () {
1847
- if (!this.active) {
1848
- this.active = true;
1849
- this._activation.next(this.sectionCode);
1850
- }
1851
- };
1852
- RecordFormSection.prototype.inactivate = function () {
1853
- if (this.active) {
1854
- this.active = false;
1855
- this._inactivation.next(this.sectionCode);
1856
- }
1857
- };
1858
- RecordFormSection.prototype.show = function () { this.visible = true; };
1859
- RecordFormSection.prototype.hide = function () { this.visible = false; };
1860
- Object.defineProperty(RecordFormSection.prototype, "title", {
1861
- get: function () { return this.sectionTitle; },
1862
- set: function (title) { this.sectionTitle = title; },
1863
- enumerable: false,
1864
- configurable: true
1865
- });
1866
- RecordFormSection.prototype.getVisibleSubsections = function (state) {
1867
- return this.subSections.filter(function (subSection) {
1868
- return subSection.visible && subSection.viewOnState(state);
1869
- });
1870
- };
1871
- RecordFormSection.prototype.getSubsection = function (subSectionCode) {
1872
- return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
1873
- ? this.subSectionsObj[subSectionCode] : null;
1874
- };
1875
- RecordFormSection.prototype.getFields = function () {
1876
- var e_2, _a;
1877
- var fieldsArray = [];
1878
- if (this.subSections && this.subSections.length > 0) {
1879
- try {
1880
- for (var _b = __values(this.subSections), _c = _b.next(); !_c.done; _c = _b.next()) {
1881
- var subSection = _c.value;
1882
- fieldsArray = fieldsArray.concat(subSection.getFields());
1883
- }
1884
- }
1885
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1886
- finally {
1887
- try {
1888
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1889
- }
1890
- finally { if (e_2) throw e_2.error; }
1891
- }
1892
- }
1893
- return fieldsArray;
1894
- };
1895
- RecordFormSection.prototype.getFieldNames = function () {
1896
- var e_3, _a;
1897
- var fieldsArray = [];
1898
- if (this.subSections && this.subSections.length > 0) {
1899
- try {
1900
- for (var _b = __values(this.subSections), _c = _b.next(); !_c.done; _c = _b.next()) {
1901
- var subSection = _c.value;
1902
- fieldsArray = fieldsArray.concat(subSection.getFieldNames());
1903
- }
1904
- }
1905
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
1906
- finally {
1907
- try {
1908
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1909
- }
1910
- finally { if (e_3) throw e_3.error; }
1911
- }
1912
- }
1913
- return fieldsArray;
1914
- };
1915
- RecordFormSection.prototype.getField = function (name) {
1916
- var e_4, _a;
1917
- var field = null;
1918
- if (this.subSections && this.subSections.length > 0) {
1919
- try {
1920
- for (var _b = __values(this.subSections), _c = _b.next(); !_c.done; _c = _b.next()) {
1921
- var subSection = _c.value;
1922
- field = subSection.getField(name);
1923
- if (field) {
1924
- return field;
1925
- }
1926
- }
1927
- }
1928
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
1929
- finally {
1930
- try {
1931
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1932
- }
1933
- finally { if (e_4) throw e_4.error; }
1934
- }
1935
- }
1936
- return null;
1937
- };
1938
- RecordFormSection.prototype.supportState = function (state) { return this.viewOnState(state); };
1939
- RecordFormSection.prototype.viewOnState = function (state) { return this.visibleStates.includes(state); };
1940
- RecordFormSection.prototype.supportMode = function (state) { return this.viewOnState(state); };
1941
- return RecordFormSection;
1942
- }());
1943
-
1944
- var HEADER = 'HEADER';
1945
- var FormAction = /** @class */ (function (_super) {
1946
- __extends(FormAction, _super);
1947
- function FormAction(actionDefinition, formConfig) {
1948
- var _this = this;
1949
- var _a, _b;
1950
- _this = _super.call(this, actionDefinition, formConfig) || this;
1951
- _this._actionActivated = new rxjs.Subject();
1952
- _this.inProgress = false;
1953
- _this.elementType = elementTypes.action;
1954
- _this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
1955
- _this.actionName = actionDefinition.actionTitle;
1956
- _this.iconName = actionDefinition.iconName || _this.actionCode;
1957
- _this.location = actionDefinition.position || HEADER;
1958
- _this.backend = (_a = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _a !== void 0 ? _a : false;
1959
- _this.newState = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.newState;
1960
- _this.customAttributes = (_b = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.customAttributes) !== null && _b !== void 0 ? _b : null;
1961
- _this.restrictedOnField = actionDefinition.fieldRestrictedCode ? actionDefinition.fieldRestrictedCode.toString() : '';
1962
- _this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
1963
- _this.restrictedOnValue = actionDefinition.valueRestricted || '';
1964
- _this.customValidation = function () { return true; };
1965
- return _this;
1966
- }
1967
- Object.defineProperty(FormAction.prototype, "actionActivated", {
1968
- get: function () { return this._actionActivated; },
1969
- enumerable: false,
1970
- configurable: true
1971
- });
1972
- FormAction.prototype.start = function () { this.inProgress = true; };
1973
- FormAction.prototype.stop = function () { this.inProgress = false; };
1974
- FormAction.prototype.notifyActivation = function () { this._actionActivated.next(this.actionCode); };
1975
- FormAction.prototype.updateFromServer = function (receivedAction) {
1976
- for (var propertyName in receivedAction) {
1977
- if (propertyName !== 'actionCode' && propertyName !== 'actionId') {
1978
- this[propertyName] = receivedAction[propertyName];
1979
- }
1980
- }
1981
- };
1982
- FormAction.prototype.setCustomValidation = function (callback) { this.customValidation = function () { return callback(); }; };
1983
- return FormAction;
1984
- }(FormElement));
1985
-
1986
- var UNDEFINED = 'undefined';
1987
- var DEFAULT_ERROR_TYPE = 'error';
1988
- var DEFAULT_CAPTURE_TYPE = 'INPUT';
1989
- var DEFAULT_ALIGNMENT = 'left';
1990
- var STD_MAX_LENGTH = 50;
1991
- var BIG_MAX_LENGTH = 500;
1992
- var fldAttr = {
1993
- validateOnServer: 'validateOnServer',
1994
- value: '_fieldValue',
1995
- minValue: '_minValue',
1996
- maxValue: '_maxValue',
1997
- maxLength: '_maxLength',
1998
- onValidation: '_onValidation',
1999
- intrinsicErrorMessage: '_intrinsicErrorMessage',
2000
- code: 'fieldCode',
2001
- info: 'fieldInfo',
2002
- defaultValue: 'defaultValue',
2003
- defaultEditable: 'defaultEditable',
2004
- customAttributes: 'customAttributes',
2005
- visibleLabel: 'visibleLabel',
2006
- required: 'fieldRequired',
2007
- hasChanged: 'hasChanged',
2008
- outputOnly: 'outputOnly',
2009
- captureType: 'captureType',
2010
- title: 'fieldTitle',
2011
- type: 'fieldType',
2012
- alignment: 'fieldAlignment',
2013
- format: 'fieldFormat',
2014
- externalValue: 'externalValue',
2015
- tooltipText: 'tooltipText',
2016
- errorType: 'errorType',
2017
- errorCode: 'errorCode',
2018
- errorMessage: 'errorMessage',
2019
- options: 'fieldOptions',
2020
- };
2021
- var FieldDescriptor = /** @class */ (function (_super) {
2022
- __extends(FieldDescriptor, _super);
2023
- function FieldDescriptor(inputFieldReceived, formConfig) {
2024
- var _this = this;
2025
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
2026
- _this = _super.call(this, inputFieldReceived, formConfig) || this;
2027
- _this._editionFinish = new rxjs.Subject();
2028
- _this._editionPartial = new rxjs.Subject();
2029
- _this._detailRequest = new rxjs.Subject();
2030
- _this._attributeChange = new rxjs.Subject();
2031
- _this.elementType = elementTypes.field;
2032
- var fld = (inputFieldReceived) ? inputFieldReceived : {};
2033
- _this.setAttr(fldAttr.code, fld.fieldCode);
2034
- _this.setAttr(fldAttr.title, (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : _this.fieldCode);
2035
- _this.setAttr(fldAttr.captureType, (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE);
2036
- _this.setAttr(fldAttr.defaultValue, (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null);
2037
- var defaultTypeAlignment = (_this._formConfig.tableFieldStyles[_this.fieldType] != null)
2038
- ? _this._formConfig.tableFieldStyles[_this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
2039
- var fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
2040
- _this.setAttr(fldAttr.alignment, fieldAlignment);
2041
- _this.setAttr(fldAttr.info, fld.info || '');
2042
- var fieldFormat;
2043
- try {
2044
- fieldFormat = (fld.format) ? new RegExp(fld.format) : null;
2045
- }
2046
- catch (e) {
2047
- fieldFormat = null;
2048
- }
2049
- _this.setAttr(fldAttr.format, fieldFormat);
2050
- _this.setAttr(fldAttr.validateOnServer, (_d = fld.serverAction) !== null && _d !== void 0 ? _d : false);
2051
- _this.setAttr(fldAttr.customAttributes, (_e = fld.customAttributes) !== null && _e !== void 0 ? _e : {});
2052
- _this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
2053
- _this.setAttr(fldAttr.defaultEditable, _this.enabled);
2054
- _this.setAttr(fldAttr.required, (_f = fld.required) !== null && _f !== void 0 ? _f : false);
2055
- _this.setError(fld.errorCode, fld.errorMessage, (_g = fld.errorType) !== null && _g !== void 0 ? _g : DEFAULT_ERROR_TYPE);
2056
- _this.setAttr(fldAttr.outputOnly, (_h = fld.outputOnly) !== null && _h !== void 0 ? _h : false);
2057
- var maxLength = (_j = fld.maxLength) !== null && _j !== void 0 ? _j : (_this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
2058
- _this.setAttr(fldAttr.maxLength, maxLength);
2059
- _this.setAttr(fldAttr.intrinsicErrorMessage, (_k = _this._formConfig.fieldTypeErrMsg[_this.fieldType]) !== null && _k !== void 0 ? _k : _this._formConfig.fieldTypeErrMsg.DEFAULT);
2060
- _this.setFieldType(fld.fieldTypeCode);
2061
- _this.setEditable((_l = fld.editable) !== null && _l !== void 0 ? _l : true);
2062
- _this.setVisibleLabel((_m = fld.visibleLabel) !== null && _m !== void 0 ? _m : true);
2063
- _this.setVisibility(fld.visible);
2064
- _this.setFieldOptions(fld.fieldOptions);
2065
- _this.setValue(fld.fieldValue || _this.defaultValue || '');
2066
- return _this;
2067
- }
2068
- Object.defineProperty(FieldDescriptor.prototype, "name", {
2069
- get: function () { return this.fieldCode; },
2070
- enumerable: false,
2071
- configurable: true
2072
- });
2073
- Object.defineProperty(FieldDescriptor.prototype, "editionFinish", {
2074
- get: function () { return this._editionFinish; },
1771
+ Object.defineProperty(FieldDescriptor.prototype, "editionFinish", {
1772
+ get: function () { return this._editionFinish; },
2075
1773
  enumerable: false,
2076
1774
  configurable: true
2077
1775
  });
@@ -2090,6 +1788,11 @@
2090
1788
  enumerable: false,
2091
1789
  configurable: true
2092
1790
  });
1791
+ Object.defineProperty(FieldDescriptor.prototype, "info", {
1792
+ get: function () { return this.fieldInfo; },
1793
+ enumerable: false,
1794
+ configurable: true
1795
+ });
2093
1796
  Object.defineProperty(FieldDescriptor.prototype, "validating", {
2094
1797
  get: function () { return this._onValidation; },
2095
1798
  set: function (isValidating) { this.setAttr(fldAttr.onValidation, isValidating); },
@@ -2107,6 +1810,8 @@
2107
1810
  enumerable: false,
2108
1811
  configurable: true
2109
1812
  });
1813
+ FieldDescriptor.prototype.getRequired = function () { return this.required; };
1814
+ FieldDescriptor.prototype.setRequired = function (required) { this.required = required; };
2110
1815
  Object.defineProperty(FieldDescriptor.prototype, "required", {
2111
1816
  get: function () { return this.fieldRequired; },
2112
1817
  set: function (required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); },
@@ -2159,7 +1864,6 @@
2159
1864
  FieldDescriptor.prototype.notifyEditionDetailRequest = function () {
2160
1865
  this._detailRequest.next(this.fieldCode);
2161
1866
  };
2162
- FieldDescriptor.prototype.getCustomAttribute = function (name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; };
2163
1867
  FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); };
2164
1868
  FieldDescriptor.prototype.showLabel = function () { this.setVisibleLabel(true); };
2165
1869
  FieldDescriptor.prototype.hideLabel = function () { this.setVisibleLabel(false); };
@@ -2167,7 +1871,7 @@
2167
1871
  FieldDescriptor.prototype.changed = function () { this.setChanged(true); };
2168
1872
  FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
2169
1873
  FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
2170
- FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); };
1874
+ FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); this.resetError(); };
2171
1875
  Object.defineProperty(FieldDescriptor.prototype, "backend", {
2172
1876
  get: function () { return this.validateOnServer; },
2173
1877
  enumerable: false,
@@ -2196,6 +1900,11 @@
2196
1900
  FieldDescriptor.prototype.setErrorCode = function (code) { this.setError(code, this.errorMessage); };
2197
1901
  FieldDescriptor.prototype.getErrorMessage = function () { return this.getError().message; };
2198
1902
  FieldDescriptor.prototype.setErrorMessage = function (msg) { this.setError(this.errorCode, msg); };
1903
+ Object.defineProperty(FieldDescriptor.prototype, "empty", {
1904
+ get: function () { return this.isEmpty(); },
1905
+ enumerable: false,
1906
+ configurable: true
1907
+ });
2199
1908
  FieldDescriptor.prototype.isEmpty = function () {
2200
1909
  var fieldCurrentValue = this.getValue();
2201
1910
  if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
@@ -2251,11 +1960,6 @@
2251
1960
  FieldDescriptor.prototype.setFieldType = function (inputFieldType) {
2252
1961
  this.setAttr(fldAttr.type, inputFieldType);
2253
1962
  };
2254
- FieldDescriptor.prototype.format = function () {
2255
- if (this.fieldType === this._formConfig.fieldTypes.currency) {
2256
- this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
2257
- }
2258
- };
2259
1963
  FieldDescriptor.prototype.setMinValue = function (minValue) {
2260
1964
  var _a, _b, _c;
2261
1965
  if (this.fieldType === this._formConfig.fieldTypes.date
@@ -2367,9 +2071,6 @@
2367
2071
  (_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
2368
2072
  }
2369
2073
  break;
2370
- case this._formConfig.fieldTypes.currency:
2371
- newFinalValue = formatCurrency(newValue);
2372
- break;
2373
2074
  default:
2374
2075
  newFinalValue = newValue;
2375
2076
  break;
@@ -2383,952 +2084,1270 @@
2383
2084
  return FieldDescriptor;
2384
2085
  }(FormElement));
2385
2086
 
2386
- var FormStructureAndData = /** @class */ (function () {
2387
- function FormStructureAndData(definitionReceived, formConfig) {
2388
- var e_1, _d, e_2, _e, e_3, _f, e_4, _g;
2389
- var _this = this;
2390
- this._fieldsObj = {};
2391
- this._actionsObj = {};
2392
- this._tableObj = {};
2393
- this._sectionsObj = {};
2394
- this._immutableData = {};
2395
- this._extraInfo = {};
2396
- this._formConfig = formConfig;
2397
- this.state = '';
2398
- this._actions = [];
2399
- this._fields = [];
2400
- this._tables = [];
2401
- this._sections = [];
2402
- this._stateFlow = {
2403
- defaultState: '',
2404
- states: [],
2405
- transitions: [],
2406
- };
2407
- if (!definitionReceived) {
2087
+ var RecordFormSubSection = /** @class */ (function () {
2088
+ function RecordFormSubSection(subsectionReceived, formObject) {
2089
+ var e_1, _a;
2090
+ if (!subsectionReceived) {
2408
2091
  return;
2409
2092
  }
2410
- this._name = (definitionReceived.form && definitionReceived.form.formCode)
2411
- ? definitionReceived.form.formCode : this._name;
2412
- this._title = (definitionReceived.form && definitionReceived.form.formTitle)
2413
- ? definitionReceived.form.formTitle : '';
2414
- this.setStateFlow(definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.states, definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.transitions, definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.defaultState);
2415
- this.immutableData = definitionReceived.immutableData;
2416
- this.extraInfo = definitionReceived.extraInfo;
2417
- if (definitionReceived.actions) {
2418
- var formActions = definitionReceived.actions.map(function (objDef) {
2419
- var visibleStates = objDef.visibleStates;
2420
- var enabledStates = objDef.enabledStates;
2421
- if (!visibleStates) {
2422
- visibleStates = (objDef.actionModes || '').split(',')
2423
- .map(function (state) { return state.trim(); })
2424
- .filter(function (state) { return state.length > 0; }) || [];
2425
- enabledStates = __spreadArray([], __read(visibleStates));
2426
- }
2427
- return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
2428
- });
2093
+ this._customRender = null;
2094
+ this.visible = true;
2095
+ this.subSectionElements = [];
2096
+ this.subSectionFields = [];
2097
+ this.subSectionTables = [];
2098
+ this.subSectionActions = [];
2099
+ this.elementsArray = {};
2100
+ this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
2101
+ this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
2102
+ this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
2103
+ this.visibleStates = subsectionReceived.visibleStates || [];
2104
+ if (subsectionReceived.elements) {
2429
2105
  try {
2430
- for (var formActions_1 = __values(formActions), formActions_1_1 = formActions_1.next(); !formActions_1_1.done; formActions_1_1 = formActions_1.next()) {
2431
- var actionReceived = formActions_1_1.value;
2432
- var globalAction = new FormAction(actionReceived, this._formConfig);
2433
- var globalActionCode = globalAction.actionCode;
2434
- if (globalActionCode) {
2435
- this._actions.push(globalAction);
2436
- this._actionsObj[globalActionCode] = globalAction;
2106
+ for (var _b = __values(subsectionReceived.elements), _c = _b.next(); !_c.done; _c = _b.next()) {
2107
+ var receivedElement = _c.value;
2108
+ var elementObject = null;
2109
+ var arrayToAdd = null;
2110
+ var type = receivedElement.type, code = receivedElement.code;
2111
+ switch (type) {
2112
+ case elementTypes.field:
2113
+ elementObject = formObject.getFieldObject(code);
2114
+ arrayToAdd = this.subSectionFields;
2115
+ break;
2116
+ case elementTypes.table:
2117
+ elementObject = formObject.getTableObject(code);
2118
+ arrayToAdd = this.subSectionTables;
2119
+ break;
2120
+ case elementTypes.action:
2121
+ elementObject = formObject.getActionObject(code);
2122
+ arrayToAdd = this.subSectionActions;
2123
+ break;
2124
+ }
2125
+ if (elementObject) {
2126
+ elementObject.elementType = type;
2127
+ arrayToAdd.push(elementObject);
2128
+ this.subSectionElements.push(elementObject);
2129
+ this.elementsArray[code] = elementObject;
2437
2130
  }
2438
2131
  }
2439
2132
  }
2440
2133
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
2441
2134
  finally {
2442
2135
  try {
2443
- if (formActions_1_1 && !formActions_1_1.done && (_d = formActions_1.return)) _d.call(formActions_1);
2136
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2444
2137
  }
2445
2138
  finally { if (e_1) throw e_1.error; }
2446
2139
  }
2447
2140
  }
2448
- if (definitionReceived.fields) {
2449
- var formFields = definitionReceived.fields.map(function (objDef) {
2450
- var visibleStates = objDef.visibleStates;
2451
- var enabledStates = objDef.enabledStates || objDef.editableStates;
2452
- if (!visibleStates) {
2453
- visibleStates = (objDef.fieldModes || '').split(',')
2454
- .map(function (state) { return state.trim(); })
2455
- .filter(function (state) { return state.length > 0; }) || [];
2456
- enabledStates = __spreadArray([], __read(visibleStates));
2457
- }
2458
- return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
2459
- });
2460
- try {
2461
- for (var formFields_1 = __values(formFields), formFields_1_1 = formFields_1.next(); !formFields_1_1.done; formFields_1_1 = formFields_1.next()) {
2462
- var fieldReceived = formFields_1_1.value;
2463
- var fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
2464
- var fieldCode = fieldToAdd.fieldCode;
2465
- if (fieldCode) {
2466
- this._fields.push(fieldToAdd);
2467
- this._fieldsObj[fieldCode] = fieldToAdd;
2468
- }
2469
- }
2470
- }
2471
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
2472
- finally {
2473
- try {
2474
- if (formFields_1_1 && !formFields_1_1.done && (_e = formFields_1.return)) _e.call(formFields_1);
2475
- }
2476
- finally { if (e_2) throw e_2.error; }
2477
- }
2141
+ }
2142
+ RecordFormSubSection.prototype.show = function () { this.visible = true; };
2143
+ RecordFormSubSection.prototype.hide = function () { this.visible = false; };
2144
+ Object.defineProperty(RecordFormSubSection.prototype, "customRender", {
2145
+ get: function () { return this._customRender; },
2146
+ set: function (customRenderName) { this._customRender = customRenderName; },
2147
+ enumerable: false,
2148
+ configurable: true
2149
+ });
2150
+ RecordFormSubSection.prototype.getField = function (name) {
2151
+ return this.subSectionFields.find(function (fld) { return fld.name === name; });
2152
+ };
2153
+ RecordFormSubSection.prototype.getFields = function () {
2154
+ return this.subSectionFields;
2155
+ };
2156
+ RecordFormSubSection.prototype.getFieldNames = function () {
2157
+ return this.subSectionFields.map(function (field) { return field.fieldCode; });
2158
+ };
2159
+ RecordFormSubSection.prototype.viewOnState = function (state) {
2160
+ return this.visibleStates.includes(state);
2161
+ };
2162
+ RecordFormSubSection.prototype.supportMode = function (state) { return this.viewOnState(state); };
2163
+ return RecordFormSubSection;
2164
+ }());
2165
+
2166
+ var RecordFormSection = /** @class */ (function () {
2167
+ function RecordFormSection(sectionReceived, formObject) {
2168
+ var e_1, _c;
2169
+ var _this = this;
2170
+ var _a;
2171
+ this._activation = new rxjs.Subject();
2172
+ this._inactivation = new rxjs.Subject();
2173
+ this.active = false;
2174
+ if (!sectionReceived) {
2175
+ return;
2478
2176
  }
2479
- if (definitionReceived.tables) {
2480
- var tables = definitionReceived.tables.map(function (objDef) {
2177
+ this.visible = true;
2178
+ this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
2179
+ this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
2180
+ this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
2181
+ this.visibleStates = sectionReceived.visibleStates || [];
2182
+ this.subSections = [];
2183
+ this.subSectionsObj = {};
2184
+ if (sectionReceived.subsections) {
2185
+ var subsections = sectionReceived.subsections.map(function (objDef) {
2481
2186
  var visibleStates = objDef.visibleStates;
2482
- var enabledStates = objDef.enabledStates || objDef.editableStates;
2483
2187
  if (!visibleStates) {
2484
- visibleStates = (objDef.tableModes || '').split(',')
2188
+ visibleStates = (objDef.subsectionModes || '').split(',')
2485
2189
  .map(function (state) { return state.trim(); })
2486
- .filter(function (state) { return state.length > 0; }) || [];
2487
- enabledStates = __spreadArray([], __read(visibleStates));
2190
+ .filter(function (state) { return state.length > 0; });
2488
2191
  }
2489
2192
  if (!visibleStates || visibleStates.length === 0) {
2490
- visibleStates = _this._formConfig.defaultStateFlow.states;
2491
- }
2492
- return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
2493
- });
2494
- try {
2495
- for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
2496
- var tableReceived = tables_1_1.value;
2497
- var tableToAdd = new RecordTable(tableReceived, this._formConfig);
2498
- var tableCode = tableToAdd.tableCode;
2499
- if (tableCode) {
2500
- this._tables.push(tableToAdd);
2501
- this._tableObj[tableCode] = tableToAdd;
2502
- }
2503
- }
2504
- }
2505
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
2506
- finally {
2507
- try {
2508
- if (tables_1_1 && !tables_1_1.done && (_f = tables_1.return)) _f.call(tables_1);
2193
+ visibleStates = _this.visibleStates;
2509
2194
  }
2510
- finally { if (e_3) throw e_3.error; }
2511
- }
2512
- }
2513
- if (definitionReceived.sections) {
2514
- var formSections = definitionReceived.sections.map(function (objDef) {
2515
- var visibleStates = objDef.visibleStates;
2516
- if (!visibleStates) {
2517
- visibleStates = (objDef.sectionModes || '').split(',')
2518
- .map(function (state) { return state.trim(); })
2519
- .filter(function (state) { return state.length > 0; }) || [];
2195
+ if (objDef.elements && Array.isArray(objDef.elements)) {
2196
+ objDef.elements = objDef.elements.map(function (elm) { return ({ code: elm.elementCode, type: elm.elementTypeName }); });
2520
2197
  }
2521
2198
  return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates });
2522
2199
  });
2523
2200
  try {
2524
- for (var formSections_1 = __values(formSections), formSections_1_1 = formSections_1.next(); !formSections_1_1.done; formSections_1_1 = formSections_1.next()) {
2525
- var sectionReceived = formSections_1_1.value;
2526
- var sectionToAdd = new RecordFormSection(sectionReceived, this);
2527
- var sectionCode = sectionToAdd.sectionCode;
2528
- if (sectionCode) {
2529
- this._sections.push(sectionToAdd);
2530
- this._sectionsObj[sectionCode] = sectionToAdd;
2201
+ for (var subsections_1 = __values(subsections), subsections_1_1 = subsections_1.next(); !subsections_1_1.done; subsections_1_1 = subsections_1.next()) {
2202
+ var subsectionReceived = subsections_1_1.value;
2203
+ var subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
2204
+ var subsectionCode = subSectionToAdd.subsectionCode;
2205
+ if (subsectionCode) {
2206
+ this.subSections.push(subSectionToAdd);
2207
+ this.subSectionsObj[subsectionCode] = subSectionToAdd;
2531
2208
  }
2532
2209
  }
2533
2210
  }
2534
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
2211
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2535
2212
  finally {
2536
2213
  try {
2537
- if (formSections_1_1 && !formSections_1_1.done && (_g = formSections_1.return)) _g.call(formSections_1);
2214
+ if (subsections_1_1 && !subsections_1_1.done && (_c = subsections_1.return)) _c.call(subsections_1);
2538
2215
  }
2539
- finally { if (e_4) throw e_4.error; }
2216
+ finally { if (e_1) throw e_1.error; }
2540
2217
  }
2541
2218
  }
2219
+ this.customAttributes = (_a = sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes) !== null && _a !== void 0 ? _a : null;
2542
2220
  }
2543
- Object.defineProperty(FormStructureAndData.prototype, "immutableData", {
2544
- get: function () {
2545
- var data = {};
2546
- var objectNames = Object.keys(this._immutableData);
2547
- for (var index = 0; index < objectNames.length; index++) {
2548
- var name = objectNames[index];
2549
- data[name] = this.getImmutableElement(name);
2550
- }
2551
- return data;
2552
- },
2553
- set: function (immutableData) { Object.assign(this._immutableData, immutableData); },
2554
- enumerable: false,
2555
- configurable: true
2556
- });
2557
- Object.defineProperty(FormStructureAndData.prototype, "extraInfo", {
2558
- get: function () {
2559
- var data = {};
2560
- var objectNames = Object.keys(this._extraInfo);
2561
- for (var index = 0; index < objectNames.length; index++) {
2562
- var name = objectNames[index];
2563
- data[name] = this.getExtraInfo(name);
2564
- }
2565
- return data;
2566
- },
2567
- set: function (extraInfo) { Object.assign(this._extraInfo, extraInfo); },
2568
- enumerable: false,
2569
- configurable: true
2570
- });
2571
- Object.defineProperty(FormStructureAndData.prototype, "defaultState", {
2572
- get: function () { return this._stateFlow.defaultState; },
2221
+ RecordFormSection.prototype.getCustomAttribute = function (name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; };
2222
+ RecordFormSection.prototype.setCustomAttribute = function (name, value) { return name && (this.customAttributes[name] = value); };
2223
+ RecordFormSection.prototype.matchAttribute = function (name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; };
2224
+ Object.defineProperty(RecordFormSection.prototype, "code", {
2225
+ get: function () { return this.sectionCode; },
2573
2226
  enumerable: false,
2574
2227
  configurable: true
2575
2228
  });
2576
- Object.defineProperty(FormStructureAndData.prototype, "title", {
2577
- get: function () { return this._title; },
2578
- set: function (title) { this._title = title; },
2229
+ Object.defineProperty(RecordFormSection.prototype, "activation", {
2230
+ get: function () { return this._activation; },
2579
2231
  enumerable: false,
2580
2232
  configurable: true
2581
2233
  });
2582
- Object.defineProperty(FormStructureAndData.prototype, "name", {
2583
- get: function () { return this._name; },
2584
- set: function (name) { this._name = name; },
2234
+ Object.defineProperty(RecordFormSection.prototype, "inactivation", {
2235
+ get: function () { return this._inactivation; },
2585
2236
  enumerable: false,
2586
2237
  configurable: true
2587
2238
  });
2588
- FormStructureAndData.prototype.changeState = function (newState) {
2589
- var _this = this;
2590
- if (!newState || !this.supportState(newState)) {
2591
- return false;
2592
- }
2593
- if (!this.state) {
2594
- this.state = newState;
2595
- }
2596
- else {
2597
- var transitionToChange = this._stateFlow.transitions.find(function (trns) { return trns.source === _this.state && trns.destination === newState; });
2598
- if (transitionToChange) {
2599
- this.state = newState;
2600
- }
2239
+ RecordFormSection.prototype.activate = function () {
2240
+ if (!this.active) {
2241
+ this.active = true;
2242
+ this._activation.next(this.sectionCode);
2601
2243
  }
2602
- return (this.state === newState);
2603
2244
  };
2604
- FormStructureAndData.prototype.setStateFlow = function (states, transitions, defaultState) {
2605
- var _this = this;
2606
- if (!states || !transitions) {
2607
- this._stateFlow = JSON.parse(JSON.stringify(this._formConfig.defaultStateFlow));
2608
- return;
2245
+ RecordFormSection.prototype.inactivate = function () {
2246
+ if (this.active) {
2247
+ this.active = false;
2248
+ this._inactivation.next(this.sectionCode);
2609
2249
  }
2610
- this._stateFlow.states = states;
2611
- this._stateFlow.defaultState = defaultState || this._stateFlow.states[0];
2612
- this._stateFlow.transitions = transitions.map(function (transition) {
2613
- var name = transition.name;
2614
- var source = (_this._stateFlow.states.includes(transition.source)) ? transition.source : '';
2615
- var destination = (_this._stateFlow.states.includes(transition.destination)) ? transition.destination : '';
2616
- return { name: name, source: source, destination: destination };
2617
- }).filter(function (item) { return item.name && item.source && item.destination; });
2618
- };
2619
- FormStructureAndData.prototype.supportState = function (state) { var _a; return (_a = this._stateFlow.states) === null || _a === void 0 ? void 0 : _a.includes(state); };
2620
- FormStructureAndData.prototype.supportMode = function (state) { return this.supportState(state); };
2621
- FormStructureAndData.prototype.getImmutableElement = function (name) { var _a, _b, _c; return (_c = (_b = (_a = this._immutableData) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null; };
2622
- FormStructureAndData.prototype.getExtraInfo = function (name) { var _a, _b, _c; return (_c = (_b = (_a = this._extraInfo) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null; };
2623
- FormStructureAndData.prototype.getFields = function () { return this._fields; };
2624
- FormStructureAndData.prototype.getStates = function () {
2625
- return this._stateFlow.states;
2626
- };
2627
- FormStructureAndData.prototype.getFieldNames = function () {
2628
- return this._fields.map(function (field) { return field.fieldCode; });
2629
2250
  };
2630
- FormStructureAndData.prototype.getActions = function () {
2631
- return this._actions;
2632
- };
2633
- FormStructureAndData.prototype.getHeaderActions = function () {
2634
- return this._actions.filter(function (actionItem) { return actionItem.location === HEADER$1; });
2635
- };
2636
- FormStructureAndData.prototype.getFieldObject = function (elementId) {
2637
- return (this._fieldsObj && elementId && this._fieldsObj[elementId])
2638
- ? this._fieldsObj[elementId] : null;
2639
- };
2640
- FormStructureAndData.prototype.getTableObject = function (elementId) {
2641
- return (this._tableObj && elementId && this._tableObj[elementId])
2642
- ? this._tableObj[elementId] : null;
2643
- };
2644
- FormStructureAndData.prototype.getActionObject = function (elementId) {
2645
- return (this._actionsObj && elementId && this._actionsObj[elementId])
2646
- ? this._actionsObj[elementId] : null;
2647
- };
2648
- FormStructureAndData.prototype.getSubSection = function (sectionCode, subsectionCode) {
2649
- var section = (this._sectionsObj && this._sectionsObj[sectionCode])
2650
- ? this._sectionsObj[sectionCode] : null;
2651
- return (section) ? section.getSubsection(subsectionCode) : null;
2652
- };
2653
- Object.defineProperty(FormStructureAndData.prototype, "actions", {
2654
- get: function () { return this._actionsObj; },
2251
+ RecordFormSection.prototype.show = function () { this.visible = true; };
2252
+ RecordFormSection.prototype.hide = function () { this.visible = false; };
2253
+ Object.defineProperty(RecordFormSection.prototype, "title", {
2254
+ get: function () { return this.sectionTitle; },
2255
+ set: function (title) { this.sectionTitle = title; },
2655
2256
  enumerable: false,
2656
2257
  configurable: true
2657
2258
  });
2658
- FormStructureAndData.prototype.getSection = function (sectionCode) {
2659
- return (this._sectionsObj && this._sectionsObj[sectionCode])
2660
- ? this._sectionsObj[sectionCode] : null;
2259
+ RecordFormSection.prototype.getVisibleSubsections = function (state) {
2260
+ return this.subSections.filter(function (subSection) {
2261
+ return subSection.visible && subSection.viewOnState(state);
2262
+ });
2661
2263
  };
2662
- FormStructureAndData.prototype.sections = function () { return this.getSections(); };
2663
- FormStructureAndData.prototype.sectionTitles = function () { return this.getSectionsTitles(); };
2664
- FormStructureAndData.prototype.getSections = function () {
2665
- return this._sections;
2264
+ RecordFormSection.prototype.getSubsection = function (subSectionCode) {
2265
+ return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
2266
+ ? this.subSectionsObj[subSectionCode] : null;
2666
2267
  };
2667
- Object.defineProperty(FormStructureAndData.prototype, "visibleSections", {
2668
- get: function () {
2669
- return this._sections.filter(function (sec) { return sec.visible; });
2670
- },
2671
- enumerable: false,
2672
- configurable: true
2673
- });
2674
- FormStructureAndData.prototype.numSections = function () {
2675
- return this._sections.length;
2676
- };
2677
- FormStructureAndData.prototype.getSectionsTitles = function () {
2678
- return this._sections.map(function (formSection) { return formSection.sectionTitle; });
2679
- };
2680
- FormStructureAndData.prototype.getSectionObject = function (elementId) {
2681
- return (this._sectionsObj && elementId && this._sectionsObj[elementId])
2682
- ? this._sectionsObj[elementId] : null;
2683
- };
2684
- FormStructureAndData.prototype.tables = function () { return this.getTables(); };
2685
- FormStructureAndData.prototype.getTables = function () {
2686
- return this._tables;
2687
- };
2688
- FormStructureAndData.prototype.cleanData = function () {
2689
- var e_5, _d, e_6, _e;
2690
- if (this._fields) {
2691
- try {
2692
- for (var _f = __values(this._fields), _g = _f.next(); !_g.done; _g = _f.next()) {
2693
- var recordField = _g.value;
2694
- recordField.setValue(recordField.defaultValue);
2695
- }
2696
- }
2697
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
2698
- finally {
2699
- try {
2700
- if (_g && !_g.done && (_d = _f.return)) _d.call(_f);
2701
- }
2702
- finally { if (e_5) throw e_5.error; }
2703
- }
2704
- }
2705
- if (this._tables) {
2268
+ RecordFormSection.prototype.getFields = function () {
2269
+ var e_2, _c;
2270
+ var fieldsArray = [];
2271
+ if (this.subSections && this.subSections.length > 0) {
2706
2272
  try {
2707
- for (var _h = __values(this._tables), _j = _h.next(); !_j.done; _j = _h.next()) {
2708
- var formTable = _j.value;
2709
- formTable.clean();
2273
+ for (var _d = __values(this.subSections), _e = _d.next(); !_e.done; _e = _d.next()) {
2274
+ var subSection = _e.value;
2275
+ fieldsArray = fieldsArray.concat(subSection.getFields());
2710
2276
  }
2711
2277
  }
2712
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
2278
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2713
2279
  finally {
2714
2280
  try {
2715
- if (_j && !_j.done && (_e = _h.return)) _e.call(_h);
2281
+ if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
2716
2282
  }
2717
- finally { if (e_6) throw e_6.error; }
2283
+ finally { if (e_2) throw e_2.error; }
2718
2284
  }
2719
2285
  }
2286
+ return fieldsArray;
2720
2287
  };
2721
- FormStructureAndData.prototype.showSection = function (sectionCode) {
2722
- var sectionObject = this.getSectionObject(sectionCode);
2723
- return (sectionObject) ? sectionObject.show() : null;
2724
- };
2725
- FormStructureAndData.prototype.hideSection = function (sectionCode) {
2726
- var sectionObject = this.getSectionObject(sectionCode);
2727
- return (sectionObject) ? sectionObject.hide() : null;
2728
- };
2729
- FormStructureAndData.prototype.activeSection = function () {
2730
- var activeSection = this._sections.find(function (sectionObj) { return sectionObj.active; });
2731
- return activeSection.sectionCode;
2732
- };
2733
- FormStructureAndData.prototype.activateSection = function (sectionCode) {
2734
- this._sections.forEach(function (sectionObj) {
2735
- if (sectionObj) {
2736
- sectionObj.inactivate();
2737
- }
2738
- });
2739
- var sectionObject = this.getSectionObject(sectionCode);
2740
- return (sectionObject) ? sectionObject.activate() : null;
2741
- };
2742
- FormStructureAndData.prototype.showSections = function (sectionArray) {
2743
- var _this = this;
2744
- var sectionNames = (Array.isArray(sectionArray)) ? sectionArray : [sectionArray];
2745
- sectionNames.forEach(function (sectionCode) { return _this.showSection(sectionCode); });
2746
- };
2747
- FormStructureAndData.prototype.hideSections = function (sectionArray) {
2748
- var _this = this;
2749
- var sectionNames = (Array.isArray(sectionArray)) ? sectionArray : [sectionArray];
2750
- sectionNames.forEach(function (sectionCode) { return _this.hideSection(sectionCode); });
2751
- };
2752
- FormStructureAndData.prototype.showSubSection = function (sectionCode, subSectionCode) {
2753
- var sectionObject = this.getSectionObject(sectionCode);
2754
- var subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
2755
- return (subSectionObject) ? subSectionObject.show() : null;
2756
- };
2757
- FormStructureAndData.prototype.hideSubSection = function (sectionCode, subSectionCode) {
2758
- var sectionObject = this.getSectionObject(sectionCode);
2759
- var subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
2760
- return (subSectionObject) ? subSectionObject.hide() : null;
2761
- };
2762
- FormStructureAndData.prototype.showSubSections = function (sectionCode, subSectionArray) {
2763
- var e_7, _d;
2764
- if (subSectionArray && subSectionArray.length > 0) {
2765
- var sectionObject = this.getSectionObject(sectionCode);
2288
+ RecordFormSection.prototype.getFieldNames = function () {
2289
+ var e_3, _c;
2290
+ var fieldsArray = [];
2291
+ if (this.subSections && this.subSections.length > 0) {
2766
2292
  try {
2767
- for (var subSectionArray_1 = __values(subSectionArray), subSectionArray_1_1 = subSectionArray_1.next(); !subSectionArray_1_1.done; subSectionArray_1_1 = subSectionArray_1.next()) {
2768
- var subSectionCode = subSectionArray_1_1.value;
2769
- var subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
2770
- if (subSectionObject) {
2771
- subSectionObject.show();
2772
- }
2293
+ for (var _d = __values(this.subSections), _e = _d.next(); !_e.done; _e = _d.next()) {
2294
+ var subSection = _e.value;
2295
+ fieldsArray = fieldsArray.concat(subSection.getFieldNames());
2773
2296
  }
2774
2297
  }
2775
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
2298
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
2776
2299
  finally {
2777
2300
  try {
2778
- if (subSectionArray_1_1 && !subSectionArray_1_1.done && (_d = subSectionArray_1.return)) _d.call(subSectionArray_1);
2301
+ if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
2779
2302
  }
2780
- finally { if (e_7) throw e_7.error; }
2303
+ finally { if (e_3) throw e_3.error; }
2781
2304
  }
2782
2305
  }
2306
+ return fieldsArray;
2783
2307
  };
2784
- FormStructureAndData.prototype.hideSubSections = function (sectionCode, subSectionArray) {
2785
- var e_8, _d;
2786
- if (subSectionArray && subSectionArray.length > 0) {
2787
- var sectionObject = this.getSectionObject(sectionCode);
2308
+ RecordFormSection.prototype.getField = function (name) {
2309
+ var e_4, _c;
2310
+ var field = null;
2311
+ if (this.subSections && this.subSections.length > 0) {
2788
2312
  try {
2789
- for (var subSectionArray_2 = __values(subSectionArray), subSectionArray_2_1 = subSectionArray_2.next(); !subSectionArray_2_1.done; subSectionArray_2_1 = subSectionArray_2.next()) {
2790
- var subSectionCode = subSectionArray_2_1.value;
2791
- var subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
2792
- if (subSectionObject) {
2793
- subSectionObject.hide();
2313
+ for (var _d = __values(this.subSections), _e = _d.next(); !_e.done; _e = _d.next()) {
2314
+ var subSection = _e.value;
2315
+ field = subSection.getField(name);
2316
+ if (field) {
2317
+ return field;
2794
2318
  }
2795
2319
  }
2796
2320
  }
2797
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
2321
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
2798
2322
  finally {
2799
2323
  try {
2800
- if (subSectionArray_2_1 && !subSectionArray_2_1.done && (_d = subSectionArray_2.return)) _d.call(subSectionArray_2);
2324
+ if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
2801
2325
  }
2802
- finally { if (e_8) throw e_8.error; }
2326
+ finally { if (e_4) throw e_4.error; }
2803
2327
  }
2804
2328
  }
2329
+ return null;
2805
2330
  };
2806
- FormStructureAndData.prototype.showAction = function (actionCode) {
2807
- var actionObject = this.getActionObject(actionCode);
2808
- return (actionObject) ? actionObject.show() : null;
2809
- };
2810
- FormStructureAndData.prototype.hideAction = function (actionCode) {
2811
- var actionObject = this.getActionObject(actionCode);
2812
- return (actionObject) ? actionObject.hide() : null;
2813
- };
2814
- FormStructureAndData.prototype.showActions = function (actionArray) {
2815
- var _this = this;
2816
- var actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
2817
- actionNames.forEach(function (actionCode) { return _this.showAction(actionCode); });
2818
- };
2819
- FormStructureAndData.prototype.hideActions = function (actionArray) {
2820
- var _this = this;
2821
- var actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
2822
- actionNames.forEach(function (actionCode) { return _this.hideAction(actionCode); });
2823
- };
2824
- FormStructureAndData.prototype.enableAction = function (actionCode) {
2825
- var actionObject = this.getActionObject(actionCode);
2826
- return (actionObject) ? actionObject.enable() : null;
2827
- };
2828
- FormStructureAndData.prototype.disableAction = function (actionCode) {
2829
- var actionObject = this.getActionObject(actionCode);
2830
- return (actionObject) ? actionObject.disable() : null;
2831
- };
2832
- FormStructureAndData.prototype.enableActions = function (actionArray) {
2833
- var _this = this;
2834
- var actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
2835
- actionNames.forEach(function (actionCode) { return _this.enableAction(actionCode); });
2836
- };
2837
- FormStructureAndData.prototype.disableActions = function (actionArray) {
2331
+ RecordFormSection.prototype.supportState = function (state) { return this.viewOnState(state); };
2332
+ RecordFormSection.prototype.viewOnState = function (state) { return this.visibleStates.includes(state); };
2333
+ RecordFormSection.prototype.supportMode = function (state) { return this.viewOnState(state); };
2334
+ return RecordFormSection;
2335
+ }());
2336
+
2337
+ var ACTIVE = 'active';
2338
+ var SHOW = 'show';
2339
+ var HIDE = 'hide';
2340
+ var ENABLE = 'enable';
2341
+ var DISABLE = 'disable';
2342
+ var CLEAN = 'clean';
2343
+ var FormStructureAndData = /** @class */ (function () {
2344
+ function FormStructureAndData(definitionReceived, formConfig) {
2345
+ var e_1, _e, e_2, _f, e_3, _g, e_4, _h;
2838
2346
  var _this = this;
2839
- var actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
2840
- actionNames.forEach(function (actionCode) { return _this.disableAction(actionCode); });
2841
- };
2842
- Object.defineProperty(FormStructureAndData.prototype, "fields", {
2843
- get: function () { return this._fieldsObj; },
2844
- enumerable: false,
2845
- configurable: true
2846
- });
2847
- FormStructureAndData.prototype.enableField = function (fieldCode) {
2848
- var fieldObject = this.getFieldObject(fieldCode);
2849
- return (fieldObject) ? fieldObject.enable() : null;
2850
- };
2851
- FormStructureAndData.prototype.disableField = function (fieldCode) {
2852
- var fieldObject = this.getFieldObject(fieldCode);
2853
- return (fieldObject) ? fieldObject.disable() : null;
2854
- };
2855
- FormStructureAndData.prototype.getFieldValue = function (fieldCode) {
2856
- var fieldObject = this.getFieldObject(fieldCode);
2857
- return (fieldObject) ? fieldObject.getValue() : null;
2858
- };
2859
- FormStructureAndData.prototype.getFieldsValues = function (fieldCodesArray) {
2860
- var _a, _b, _c;
2861
- if (!fieldCodesArray || !Array.isArray(fieldCodesArray) || fieldCodesArray.length === 0) {
2862
- return null;
2863
- }
2864
- var resultObject = {};
2865
- for (var index = 0; index < fieldCodesArray.length; index++) {
2866
- var fieldCode = fieldCodesArray[index];
2867
- if (fieldCode) {
2868
- resultObject[fieldCode] = (_c = (_b = (_a = this._fieldsObj) === null || _a === void 0 ? void 0 : _a[fieldCode]) === null || _b === void 0 ? void 0 : _b.getValue()) !== null && _c !== void 0 ? _c : null;
2869
- }
2347
+ this._fields = {};
2348
+ this._actions = {};
2349
+ this._tables = {};
2350
+ this._sections = {};
2351
+ this._immutableData = {};
2352
+ this._extraInfo = {};
2353
+ this._exclusiveSectionsByAttr = {};
2354
+ this._formConfig = formConfig;
2355
+ this.state = '';
2356
+ this._actionArray = [];
2357
+ this._fieldArray = [];
2358
+ this._tableArray = [];
2359
+ this._sectionArray = [];
2360
+ this._stateFlow = {
2361
+ defaultState: '',
2362
+ states: [],
2363
+ transitions: [],
2364
+ };
2365
+ if (!definitionReceived) {
2366
+ return;
2870
2367
  }
2871
- return resultObject;
2872
- };
2873
- FormStructureAndData.prototype.getFieldOptions = function (fieldCode) {
2874
- var fieldObject = this.getFieldObject(fieldCode);
2875
- return (fieldObject) ? fieldObject.getFieldOptions() : null;
2876
- };
2877
- FormStructureAndData.prototype.setFieldValue = function (fieldCode, fieldValue) {
2878
- var fieldObject = this.getFieldObject(fieldCode);
2879
- return (fieldObject) ? fieldObject.setValue(fieldValue) : null;
2880
- };
2881
- FormStructureAndData.prototype.setFieldError = function (code, message, type) {
2882
- if (type === void 0) { type = 'error'; }
2883
- var fieldObject = this.getFieldObject(code);
2884
- return (fieldObject) ? fieldObject.setError(code, message, type) : null;
2885
- };
2886
- FormStructureAndData.prototype.setFieldIntrinsicErrorMessage = function (code, message) {
2887
- var fieldObject = this.getFieldObject(code);
2888
- return (fieldObject) ? fieldObject.setIntrinsicErrorMessage(message) : null;
2889
- };
2890
- FormStructureAndData.prototype.setFieldRequired = function (fieldCode, required) {
2891
- var fieldObject = this.getFieldObject(fieldCode);
2892
- return (fieldObject) ? fieldObject.required = required : null;
2893
- };
2894
- FormStructureAndData.prototype.setFieldErrorMessage = function (fieldCode, errorMessage) {
2895
- var fieldObject = this.getFieldObject(fieldCode);
2896
- return (fieldObject) ? fieldObject.setErrorMessage(errorMessage) : null;
2897
- };
2898
- FormStructureAndData.prototype.setFieldOptions = function (fieldCode, optionsArray, idAttribute, nameAttribute) {
2899
- var e_9, _d;
2900
- var fieldObject = this.getFieldObject(fieldCode);
2901
- if (fieldObject && optionsArray && optionsArray.length > 0) {
2902
- var fieldOptions = [];
2368
+ this._name = (definitionReceived.form && definitionReceived.form.formCode)
2369
+ ? definitionReceived.form.formCode : this._name;
2370
+ this._title = (definitionReceived.form && definitionReceived.form.formTitle)
2371
+ ? definitionReceived.form.formTitle : '';
2372
+ this.setStateFlow(definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.states, definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.transitions, definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.defaultState);
2373
+ this.immutableData = definitionReceived.immutableData;
2374
+ this.extraInfo = definitionReceived.extraInfo;
2375
+ if (definitionReceived.actions) {
2376
+ var formActions = definitionReceived.actions.map(function (objDef) {
2377
+ var visibleStates = objDef.visibleStates;
2378
+ var enabledStates = objDef.enabledStates;
2379
+ if (!visibleStates) {
2380
+ visibleStates = (objDef.actionModes || '').split(',')
2381
+ .map(function (state) { return state.trim(); })
2382
+ .filter(function (state) { return state.length > 0; }) || [];
2383
+ enabledStates = __spreadArray([], __read(visibleStates));
2384
+ }
2385
+ return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
2386
+ });
2903
2387
  try {
2904
- for (var optionsArray_1 = __values(optionsArray), optionsArray_1_1 = optionsArray_1.next(); !optionsArray_1_1.done; optionsArray_1_1 = optionsArray_1.next()) {
2905
- var optionItem = optionsArray_1_1.value;
2906
- var fieldOption = {
2907
- fieldOptionId: optionItem[idAttribute],
2908
- fieldOptionValue: optionItem[nameAttribute]
2909
- };
2910
- fieldOptions.push(fieldOption);
2388
+ for (var formActions_1 = __values(formActions), formActions_1_1 = formActions_1.next(); !formActions_1_1.done; formActions_1_1 = formActions_1.next()) {
2389
+ var actionReceived = formActions_1_1.value;
2390
+ var globalAction = new FormAction(actionReceived, this._formConfig);
2391
+ var globalActionCode = globalAction.actionCode;
2392
+ if (globalActionCode) {
2393
+ this._actionArray.push(globalAction);
2394
+ this._actions[globalActionCode] = globalAction;
2395
+ }
2911
2396
  }
2912
2397
  }
2913
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
2398
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2914
2399
  finally {
2915
2400
  try {
2916
- if (optionsArray_1_1 && !optionsArray_1_1.done && (_d = optionsArray_1.return)) _d.call(optionsArray_1);
2401
+ if (formActions_1_1 && !formActions_1_1.done && (_e = formActions_1.return)) _e.call(formActions_1);
2917
2402
  }
2918
- finally { if (e_9) throw e_9.error; }
2403
+ finally { if (e_1) throw e_1.error; }
2919
2404
  }
2920
- fieldObject.setFieldOptions(fieldOptions);
2921
- }
2922
- };
2923
- FormStructureAndData.prototype.getFieldSet = function (filterFunc, fieldArray, sectionCode, subSectionCode) {
2924
- var _this = this;
2925
- if (fieldArray === void 0) { fieldArray = null; }
2926
- if (sectionCode === void 0) { sectionCode = null; }
2927
- if (subSectionCode === void 0) { subSectionCode = null; }
2928
- var fieldUniverse = null;
2929
- if (fieldArray && Array.isArray(fieldArray) && fieldArray.length > 0) {
2930
- fieldUniverse = fieldArray;
2931
- }
2932
- else if (sectionCode && !subSectionCode) {
2933
- var sectionObject = this.getSectionObject(sectionCode);
2934
- fieldUniverse = sectionObject === null || sectionObject === void 0 ? void 0 : sectionObject.getFieldNames();
2935
- }
2936
- else if (sectionCode && subSectionCode) {
2937
- var subSectionObject = this.getSubSection(sectionCode, subSectionCode);
2938
- fieldUniverse = subSectionObject === null || subSectionObject === void 0 ? void 0 : subSectionObject.getFieldNames();
2939
2405
  }
2940
- else {
2941
- fieldUniverse = this.getFieldNames();
2942
- }
2943
- if (!filterFunc) {
2944
- return fieldUniverse;
2945
- }
2946
- return fieldUniverse.filter(function (fld) {
2947
- var fieldObject = _this.getFieldObject(fld);
2948
- return (fieldObject && filterFunc(fieldObject));
2949
- });
2950
- };
2951
- FormStructureAndData.prototype.applyProcessToFieldSet = function (processFunc, fieldArray, sectionCode, subSectionCode) {
2952
- var e_10, _d;
2953
- if (fieldArray === void 0) { fieldArray = null; }
2954
- if (sectionCode === void 0) { sectionCode = null; }
2955
- if (subSectionCode === void 0) { subSectionCode = null; }
2956
- var fieldUniverse = this.getFieldSet(null, fieldArray, sectionCode, subSectionCode);
2957
- var fieldSetSize = 0;
2958
- if (fieldUniverse && processFunc) {
2406
+ if (definitionReceived.fields) {
2407
+ var formFields = definitionReceived.fields.map(function (objDef) {
2408
+ var visibleStates = objDef.visibleStates;
2409
+ var enabledStates = objDef.enabledStates || objDef.editableStates;
2410
+ if (!visibleStates) {
2411
+ visibleStates = (objDef.fieldModes || '').split(',')
2412
+ .map(function (state) { return state.trim(); })
2413
+ .filter(function (state) { return state.length > 0; }) || [];
2414
+ enabledStates = __spreadArray([], __read(visibleStates));
2415
+ }
2416
+ return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
2417
+ });
2959
2418
  try {
2960
- for (var fieldUniverse_1 = __values(fieldUniverse), fieldUniverse_1_1 = fieldUniverse_1.next(); !fieldUniverse_1_1.done; fieldUniverse_1_1 = fieldUniverse_1.next()) {
2961
- var fieldCode = fieldUniverse_1_1.value;
2962
- var fieldObject = this.getFieldObject(fieldCode);
2963
- if (fieldObject) {
2964
- try {
2965
- processFunc(fieldObject);
2966
- fieldSetSize += 1;
2967
- }
2968
- catch (e) {
2969
- console.log("Error procesando funcion en campo " + fieldObject + ": " + e);
2970
- }
2419
+ for (var formFields_1 = __values(formFields), formFields_1_1 = formFields_1.next(); !formFields_1_1.done; formFields_1_1 = formFields_1.next()) {
2420
+ var fieldReceived = formFields_1_1.value;
2421
+ var fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
2422
+ var fieldCode = fieldToAdd.fieldCode;
2423
+ if (fieldCode) {
2424
+ this._fieldArray.push(fieldToAdd);
2425
+ this._fields[fieldCode] = fieldToAdd;
2971
2426
  }
2972
2427
  }
2973
2428
  }
2974
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
2429
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
2975
2430
  finally {
2976
2431
  try {
2977
- if (fieldUniverse_1_1 && !fieldUniverse_1_1.done && (_d = fieldUniverse_1.return)) _d.call(fieldUniverse_1);
2432
+ if (formFields_1_1 && !formFields_1_1.done && (_f = formFields_1.return)) _f.call(formFields_1);
2978
2433
  }
2979
- finally { if (e_10) throw e_10.error; }
2434
+ finally { if (e_2) throw e_2.error; }
2980
2435
  }
2981
2436
  }
2982
- return fieldSetSize;
2983
- };
2984
- FormStructureAndData.prototype.showFields = function (fieldArray, sectionCode, subSectionCode) {
2985
- if (fieldArray === void 0) { fieldArray = null; }
2986
- if (sectionCode === void 0) { sectionCode = null; }
2987
- if (subSectionCode === void 0) { subSectionCode = null; }
2988
- return this.applyProcessToFieldSet(function (fld) { return fld.show(); }, fieldArray, sectionCode, subSectionCode);
2989
- };
2990
- FormStructureAndData.prototype.hideFields = function (fieldArray, sectionCode, subSectionCode) {
2991
- if (fieldArray === void 0) { fieldArray = null; }
2992
- if (sectionCode === void 0) { sectionCode = null; }
2993
- if (subSectionCode === void 0) { subSectionCode = null; }
2994
- return this.applyProcessToFieldSet(function (fld) { return fld.hide(); }, fieldArray, sectionCode, subSectionCode);
2995
- };
2996
- FormStructureAndData.prototype.showLabelFields = function (fieldArray, sectionCode, subSectionCode) {
2997
- if (fieldArray === void 0) { fieldArray = null; }
2998
- if (sectionCode === void 0) { sectionCode = null; }
2999
- if (subSectionCode === void 0) { subSectionCode = null; }
3000
- return this.applyProcessToFieldSet(function (fld) { return fld.showLablel(); }, fieldArray, sectionCode, subSectionCode);
3001
- };
3002
- FormStructureAndData.prototype.hideLabelFields = function (fieldArray, sectionCode, subSectionCode) {
3003
- if (fieldArray === void 0) { fieldArray = null; }
3004
- if (sectionCode === void 0) { sectionCode = null; }
3005
- if (subSectionCode === void 0) { subSectionCode = null; }
3006
- return this.applyProcessToFieldSet(function (fld) { return fld.hideLabel(); }, fieldArray, sectionCode, subSectionCode);
3007
- };
3008
- // Para deprecar
3009
- FormStructureAndData.prototype.enableEditFields = function (fieldArray, sectionCode, subSectionCode) {
3010
- if (fieldArray === void 0) { fieldArray = null; }
3011
- if (sectionCode === void 0) { sectionCode = null; }
3012
- if (subSectionCode === void 0) { subSectionCode = null; }
3013
- return this.enableFields(fieldArray, sectionCode, subSectionCode);
3014
- };
3015
- // Para deprecar
3016
- FormStructureAndData.prototype.disableEditFields = function (fieldArray, sectionCode, subSectionCode) {
3017
- if (fieldArray === void 0) { fieldArray = null; }
3018
- if (sectionCode === void 0) { sectionCode = null; }
3019
- if (subSectionCode === void 0) { subSectionCode = null; }
3020
- return this.disableFields(fieldArray, sectionCode, subSectionCode);
3021
- };
3022
- FormStructureAndData.prototype.enableFields = function (fieldArray, sectionCode, subSectionCode) {
3023
- if (fieldArray === void 0) { fieldArray = null; }
3024
- if (sectionCode === void 0) { sectionCode = null; }
3025
- if (subSectionCode === void 0) { subSectionCode = null; }
3026
- return this.applyProcessToFieldSet(function (fld) { return fld.enable(); }, fieldArray, sectionCode, subSectionCode);
3027
- };
3028
- FormStructureAndData.prototype.disableFields = function (fieldArray, sectionCode, subSectionCode) {
3029
- if (fieldArray === void 0) { fieldArray = null; }
3030
- if (sectionCode === void 0) { sectionCode = null; }
3031
- if (subSectionCode === void 0) { subSectionCode = null; }
3032
- return this.applyProcessToFieldSet(function (fld) { return fld.disable(); }, fieldArray, sectionCode, subSectionCode);
3033
- };
3034
- FormStructureAndData.prototype.cleanFields = function (fieldArray, sectionCode, subSectionCode) {
3035
- if (fieldArray === void 0) { fieldArray = null; }
3036
- if (sectionCode === void 0) { sectionCode = null; }
3037
- if (subSectionCode === void 0) { subSectionCode = null; }
3038
- return this.applyProcessToFieldSet(function (fieldObject) {
3039
- fieldObject.clean('');
3040
- fieldObject.setErrorMessage('');
3041
- }, fieldArray, sectionCode, subSectionCode);
3042
- };
3043
- FormStructureAndData.prototype.getRequiredFields = function (fieldArray, sectionCode, subSectionCode) {
3044
- if (sectionCode === void 0) { sectionCode = null; }
3045
- if (subSectionCode === void 0) { subSectionCode = null; }
3046
- return this.getFieldSet(function (fld) { return fld.fieldRequired; }, fieldArray, sectionCode, subSectionCode);
3047
- };
3048
- FormStructureAndData.prototype.getRequiredEmptyFields = function (fieldArray, sectionCode, subSectionCode) {
3049
- if (fieldArray === void 0) { fieldArray = null; }
3050
- if (sectionCode === void 0) { sectionCode = null; }
3051
- if (subSectionCode === void 0) { subSectionCode = null; }
3052
- return this.getFieldSet(function (fld) { return fld.fieldRequired && fld.isEmpty(); }, fieldArray, sectionCode, subSectionCode);
3053
- };
3054
- FormStructureAndData.prototype.getChangedFields = function (fieldArray, sectionCode, subSectionCode) {
3055
- if (sectionCode === void 0) { sectionCode = null; }
3056
- if (subSectionCode === void 0) { subSectionCode = null; }
3057
- return this.getFieldSet(function (fld) { return !fld.outputOnly && fld.hasChanged(); }, fieldArray, sectionCode, subSectionCode);
3058
- };
3059
- FormStructureAndData.prototype.getFieldsWithValidationIssues = function (fieldArray, sectionCode, subSectionCode) {
3060
- if (sectionCode === void 0) { sectionCode = null; }
3061
- if (subSectionCode === void 0) { subSectionCode = null; }
3062
- return this.getFieldSet(function (fld) { return fld.errorCode !== NO_ERROR; }, fieldArray, sectionCode, subSectionCode);
3063
- };
3064
- FormStructureAndData.prototype.tagFieldsWithError = function (errorMessage, fieldArray, sectionCode, subSectionCode) {
3065
- if (fieldArray === void 0) { fieldArray = null; }
3066
- if (sectionCode === void 0) { sectionCode = null; }
3067
- if (subSectionCode === void 0) { subSectionCode = null; }
3068
- return this.applyProcessToFieldSet(function (fieldObject) {
3069
- fieldObject.setErrorMessage(errorMessage);
3070
- }, fieldArray, sectionCode, subSectionCode);
3071
- };
3072
- FormStructureAndData.prototype.cleanErrorFields = function (fieldArray, sectionCode, subSectionCode) {
3073
- if (fieldArray === void 0) { fieldArray = null; }
3074
- if (sectionCode === void 0) { sectionCode = null; }
3075
- if (subSectionCode === void 0) { subSectionCode = null; }
3076
- this.tagFieldsWithError('', fieldArray, sectionCode, subSectionCode);
3077
- };
3078
- FormStructureAndData.prototype.tagEmptyRequiredFields = function (errorMessage, fieldArray, sectionCode, subSectionCode) {
3079
- if (fieldArray === void 0) { fieldArray = null; }
3080
- if (sectionCode === void 0) { sectionCode = null; }
3081
- if (subSectionCode === void 0) { subSectionCode = null; }
3082
- var pendingFields = this.getRequiredEmptyFields(fieldArray, sectionCode, subSectionCode);
3083
- if (pendingFields && pendingFields.length > 0) {
3084
- this.tagFieldsWithError(errorMessage, pendingFields);
3085
- return true;
3086
- }
3087
- return false;
3088
- };
3089
- FormStructureAndData.prototype.cleanTable = function (tableCode) {
3090
- var tableObject = this.getTableObject(tableCode);
3091
- return (tableObject) ? tableObject.clean() : null;
3092
- };
3093
- FormStructureAndData.prototype.getTableRecord = function (tableCode, recordId) {
3094
- var tableObject = this.getTableObject(tableCode);
3095
- return (tableObject) ? tableObject.getTableRecord(recordId) : null;
3096
- };
3097
- FormStructureAndData.prototype.hideTable = function (tableCode) {
3098
- var tableObject = this.getTableObject(tableCode);
3099
- return (tableObject) ? tableObject.hide() : null;
3100
- };
3101
- FormStructureAndData.prototype.showTable = function (tableCode) {
3102
- var tableObject = this.getTableObject(tableCode);
3103
- return (tableObject) ? tableObject.show() : null;
3104
- };
3105
- FormStructureAndData.prototype.showTables = function (tableArray) {
3106
- var _this = this;
3107
- var tableNames = (Array.isArray(tableArray)) ? tableArray : [tableArray];
3108
- tableNames.forEach(function (tableCode) { return _this.showTable(tableCode); });
3109
- };
3110
- FormStructureAndData.prototype.hideTables = function (tableArray) {
3111
- var _this = this;
3112
- var tableNames = (Array.isArray(tableArray)) ? tableArray : [tableArray];
3113
- tableNames.forEach(function (tableCode) { return _this.hideTable(tableCode); });
3114
- };
3115
- /** payload para servicios Tuain */
3116
- FormStructureAndData.prototype.getPayload = function () {
3117
- var e_11, _d, e_12, _e;
3118
- var formData = {
3119
- fields: [],
3120
- tables: [],
3121
- };
3122
- var formFields = this.getFields();
3123
- if (formFields && formFields.length > 0) {
2437
+ if (definitionReceived.tables) {
2438
+ var tables = definitionReceived.tables.map(function (objDef) {
2439
+ var visibleStates = objDef.visibleStates;
2440
+ var enabledStates = objDef.enabledStates || objDef.editableStates;
2441
+ if (!visibleStates) {
2442
+ visibleStates = (objDef.tableModes || '').split(',')
2443
+ .map(function (state) { return state.trim(); })
2444
+ .filter(function (state) { return state.length > 0; }) || [];
2445
+ enabledStates = __spreadArray([], __read(visibleStates));
2446
+ }
2447
+ if (!visibleStates || visibleStates.length === 0) {
2448
+ visibleStates = _this._formConfig.defaultStateFlow.states;
2449
+ }
2450
+ return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
2451
+ });
3124
2452
  try {
3125
- for (var formFields_2 = __values(formFields), formFields_2_1 = formFields_2.next(); !formFields_2_1.done; formFields_2_1 = formFields_2.next()) {
3126
- var fieldDescriptor = formFields_2_1.value;
3127
- if (!fieldDescriptor.outputOnly) {
3128
- var formField = {
3129
- fieldCode: fieldDescriptor.fieldCode,
3130
- fieldValue: fieldDescriptor.getValue(),
3131
- editable: !fieldDescriptor.disabled,
3132
- visible: fieldDescriptor.visible,
3133
- required: fieldDescriptor.fieldRequired,
3134
- fieldOptions: '',
3135
- };
3136
- formData.fields.push(formField);
2453
+ for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
2454
+ var tableReceived = tables_1_1.value;
2455
+ var tableToAdd = new RecordTable(tableReceived, this._formConfig);
2456
+ var tableCode = tableToAdd.tableCode;
2457
+ if (tableCode) {
2458
+ this._tableArray.push(tableToAdd);
2459
+ this._tables[tableCode] = tableToAdd;
3137
2460
  }
3138
2461
  }
3139
2462
  }
3140
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
2463
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
3141
2464
  finally {
3142
2465
  try {
3143
- if (formFields_2_1 && !formFields_2_1.done && (_d = formFields_2.return)) _d.call(formFields_2);
2466
+ if (tables_1_1 && !tables_1_1.done && (_g = tables_1.return)) _g.call(tables_1);
3144
2467
  }
3145
- finally { if (e_11) throw e_11.error; }
2468
+ finally { if (e_3) throw e_3.error; }
3146
2469
  }
3147
2470
  }
3148
- var tables = this.getTables();
3149
- if (tables && tables.length > 0) {
2471
+ if (definitionReceived.sections) {
2472
+ var formSections = definitionReceived.sections.map(function (objDef) {
2473
+ var visibleStates = objDef.visibleStates;
2474
+ if (!visibleStates) {
2475
+ visibleStates = (objDef.sectionModes || '').split(',')
2476
+ .map(function (state) { return state.trim(); })
2477
+ .filter(function (state) { return state.length > 0; }) || [];
2478
+ }
2479
+ return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates });
2480
+ });
3150
2481
  try {
3151
- for (var tables_2 = __values(tables), tables_2_1 = tables_2.next(); !tables_2_1.done; tables_2_1 = tables_2.next()) {
3152
- var tableDescriptor = tables_2_1.value;
3153
- var formTable = {
3154
- tableCode: tableDescriptor.tableCode,
3155
- visible: tableDescriptor.visible,
3156
- currentPage: tableDescriptor.currentPage,
3157
- requestedPage: tableDescriptor.requestedPage,
3158
- recordsPerPage: tableDescriptor.recordsPerPage,
3159
- currentFilter: tableDescriptor.currentFilter,
3160
- sortingColumn: tableDescriptor.sorting.columnName,
3161
- sortingDirection: tableDescriptor.sorting.direction,
3162
- };
3163
- formData.tables.push(formTable);
2482
+ for (var formSections_1 = __values(formSections), formSections_1_1 = formSections_1.next(); !formSections_1_1.done; formSections_1_1 = formSections_1.next()) {
2483
+ var sectionReceived = formSections_1_1.value;
2484
+ var sectionToAdd = new RecordFormSection(sectionReceived, this);
2485
+ var sectionCode = sectionToAdd.sectionCode;
2486
+ if (sectionCode) {
2487
+ this._sectionArray.push(sectionToAdd);
2488
+ this._sections[sectionCode] = sectionToAdd;
2489
+ }
3164
2490
  }
3165
2491
  }
3166
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
2492
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
3167
2493
  finally {
3168
2494
  try {
3169
- if (tables_2_1 && !tables_2_1.done && (_e = tables_2.return)) _e.call(tables_2);
2495
+ if (formSections_1_1 && !formSections_1_1.done && (_h = formSections_1.return)) _h.call(formSections_1);
3170
2496
  }
3171
- finally { if (e_12) throw e_12.error; }
2497
+ finally { if (e_4) throw e_4.error; }
3172
2498
  }
3173
2499
  }
3174
- return formData;
2500
+ }
2501
+ FormStructureAndData.prototype.getTitle = function () { return this._title; };
2502
+ FormStructureAndData.prototype.setTitle = function (title) { this._title = title; };
2503
+ Object.defineProperty(FormStructureAndData.prototype, "name", {
2504
+ get: function () { return this._name; },
2505
+ set: function (name) { this._name = name; },
2506
+ enumerable: false,
2507
+ configurable: true
2508
+ });
2509
+ Object.defineProperty(FormStructureAndData.prototype, "defaultState", {
2510
+ // Estados
2511
+ get: function () { return this._stateFlow.defaultState; },
2512
+ enumerable: false,
2513
+ configurable: true
2514
+ });
2515
+ FormStructureAndData.prototype.supportState = function (state) { var _a; return (_a = this._stateFlow.states) === null || _a === void 0 ? void 0 : _a.includes(state); };
2516
+ FormStructureAndData.prototype.supportMode = function (state) { return this.supportState(state); };
2517
+ Object.defineProperty(FormStructureAndData.prototype, "states", {
2518
+ get: function () { return this._stateFlow.states; },
2519
+ enumerable: false,
2520
+ configurable: true
2521
+ });
2522
+ FormStructureAndData.prototype.getCurrentState = function () { return this.state; };
2523
+ FormStructureAndData.prototype.changeState = function (newState) {
2524
+ var _this = this;
2525
+ if (!newState || !this.supportState(newState)) {
2526
+ return false;
2527
+ }
2528
+ if (!this.state) {
2529
+ this.state = newState;
2530
+ }
2531
+ else {
2532
+ var transitionToChange = this._stateFlow.transitions.find(function (trns) { return trns.source === _this.state && trns.destination === newState; });
2533
+ if (transitionToChange) {
2534
+ this.state = newState;
2535
+ }
2536
+ }
2537
+ return (this.state === newState);
2538
+ };
2539
+ FormStructureAndData.prototype.setStateFlow = function (states, transitions, defaultState) {
2540
+ var _this = this;
2541
+ if (!states || !transitions) {
2542
+ this._stateFlow = JSON.parse(JSON.stringify(this._formConfig.defaultStateFlow));
2543
+ return;
2544
+ }
2545
+ this._stateFlow.states = states;
2546
+ this._stateFlow.defaultState = defaultState || this._stateFlow.states[0];
2547
+ this._stateFlow.transitions = transitions.map(function (transition) {
2548
+ var name = transition.name;
2549
+ var source = (_this._stateFlow.states.includes(transition.source)) ? transition.source : '';
2550
+ var destination = (_this._stateFlow.states.includes(transition.destination)) ? transition.destination : '';
2551
+ return { name: name, source: source, destination: destination };
2552
+ }).filter(function (item) { return item.name && item.source && item.destination; });
2553
+ };
2554
+ // immutable Data
2555
+ FormStructureAndData.prototype.getImmutableElement = function (name) { var _a, _b, _c; return (_c = (_b = (_a = this._immutableData) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null; };
2556
+ Object.defineProperty(FormStructureAndData.prototype, "immutableData", {
2557
+ get: function () { return JSON.parse(JSON.stringify(this._immutableData)); },
2558
+ set: function (immutableData) { Object.assign(this._immutableData, immutableData); },
2559
+ enumerable: false,
2560
+ configurable: true
2561
+ });
2562
+ // extra Info
2563
+ FormStructureAndData.prototype.getExtraInfo = function (name) { var _a, _b, _c; return (_c = (_b = (_a = this._extraInfo) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null; };
2564
+ Object.defineProperty(FormStructureAndData.prototype, "extraInfo", {
2565
+ get: function () { return JSON.parse(JSON.stringify(this._extraInfo)); },
2566
+ set: function (extraInfo) { Object.assign(this._extraInfo, extraInfo); },
2567
+ enumerable: false,
2568
+ configurable: true
2569
+ });
2570
+ Object.defineProperty(FormStructureAndData.prototype, "fields", {
2571
+ // Fields
2572
+ get: function () { return this._fields; },
2573
+ enumerable: false,
2574
+ configurable: true
2575
+ });
2576
+ Object.defineProperty(FormStructureAndData.prototype, "fieldNames", {
2577
+ get: function () { return this.getFieldNames(); },
2578
+ enumerable: false,
2579
+ configurable: true
2580
+ });
2581
+ FormStructureAndData.prototype.getFields = function () { return this._fieldArray; };
2582
+ FormStructureAndData.prototype.getFieldNames = function () { return this._fieldArray.map(function (field) { return field.fieldCode; }); };
2583
+ FormStructureAndData.prototype.getField = function (code) { var _a; return (code && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[code])) ? this._fields[code] : null; };
2584
+ FormStructureAndData.prototype.enableField = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.enable(); };
2585
+ FormStructureAndData.prototype.disableField = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.disable(); };
2586
+ FormStructureAndData.prototype.getFieldValue = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getValue(); };
2587
+ FormStructureAndData.prototype.getFieldOptions = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getFieldOptions(); };
2588
+ FormStructureAndData.prototype.setFieldValue = function (code, value) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setValue(value); };
2589
+ FormStructureAndData.prototype.setFieldError = function (code, message, type) {
2590
+ if (type === void 0) { type = 'error'; }
2591
+ var _a;
2592
+ (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setError(code, message, type);
2593
+ };
2594
+ FormStructureAndData.prototype.setFieldIntrinsicErrorMessage = function (code, message) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setIntrinsicErrorMessage(message); };
2595
+ FormStructureAndData.prototype.setFieldRequired = function (code, required) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setRequired(required); };
2596
+ FormStructureAndData.prototype.setFieldErrorMessage = function (code, message) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setErrorMessage(message); };
2597
+ FormStructureAndData.prototype.setFieldOptions = function (code, optionsArray, idAttribute, nameAttribute) {
2598
+ var field = this.getField(code);
2599
+ if (field && (optionsArray === null || optionsArray === void 0 ? void 0 : optionsArray.length) > 0) {
2600
+ var fieldOptions = optionsArray.map(function (item) { return ({
2601
+ fieldOptionId: item[idAttribute],
2602
+ fieldOptionValue: item[nameAttribute]
2603
+ }); });
2604
+ field.setFieldOptions(fieldOptions);
2605
+ }
2606
+ };
2607
+ FormStructureAndData.prototype.getFieldSet = function (filter, inputCodes, secCode, subCode) {
2608
+ var _this = this;
2609
+ var _a, _b, _c, _d;
2610
+ var codes = null;
2611
+ if (typeof inputCodes === 'string' && inputCodes) {
2612
+ codes = [inputCodes];
2613
+ }
2614
+ else if (Array.isArray(inputCodes) && inputCodes.length > 0) {
2615
+ codes = inputCodes;
2616
+ }
2617
+ else if (secCode && !subCode) {
2618
+ codes = (_b = (_a = this.getSection(secCode)) === null || _a === void 0 ? void 0 : _a.getFieldNames()) !== null && _b !== void 0 ? _b : [];
2619
+ }
2620
+ else if (secCode && subCode) {
2621
+ codes = (_d = (_c = this.getSubSection(secCode, subCode)) === null || _c === void 0 ? void 0 : _c.getFieldNames()) !== null && _d !== void 0 ? _d : [];
2622
+ }
2623
+ else {
2624
+ codes = this.getFieldNames();
2625
+ }
2626
+ return (filter) ? codes.filter(function (fld) { return filter(_this.getField(fld)); }) : codes;
2627
+ };
2628
+ FormStructureAndData.prototype.applyOnFields = function (processFunc, inputCodes, secCode, subCode) {
2629
+ var e_5, _e;
2630
+ if (!processFunc) {
2631
+ return 0;
2632
+ }
2633
+ var codes = this.getFieldSet(null, inputCodes, secCode, subCode);
2634
+ var processedFields = 0;
2635
+ try {
2636
+ for (var codes_1 = __values(codes), codes_1_1 = codes_1.next(); !codes_1_1.done; codes_1_1 = codes_1.next()) {
2637
+ var code = codes_1_1.value;
2638
+ var field = this.getField(code);
2639
+ if (field) {
2640
+ try {
2641
+ processFunc(field);
2642
+ processedFields += 1;
2643
+ }
2644
+ catch (e) {
2645
+ console.log("Error procesando funcion en campo " + field + ": " + e);
2646
+ }
2647
+ }
2648
+ }
2649
+ }
2650
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
2651
+ finally {
2652
+ try {
2653
+ if (codes_1_1 && !codes_1_1.done && (_e = codes_1.return)) _e.call(codes_1);
2654
+ }
2655
+ finally { if (e_5) throw e_5.error; }
2656
+ }
2657
+ return processedFields;
2658
+ };
2659
+ FormStructureAndData.prototype.enableFields = function (codes, secCode, subCode) {
2660
+ return this.applyOnFields(function (fld) { return fld.enable(); }, codes, secCode, subCode);
2661
+ };
2662
+ FormStructureAndData.prototype.showFields = function (codes, secCode, subCode) {
2663
+ return this.applyOnFields(function (fld) { return fld.show(); }, codes, secCode, subCode);
2664
+ };
2665
+ FormStructureAndData.prototype.hideFields = function (codes, secCode, subCode) {
2666
+ return this.applyOnFields(function (fld) { return fld.hide(); }, codes, secCode, subCode);
2667
+ };
2668
+ FormStructureAndData.prototype.showLabelFields = function (codes, secCode, subCode) {
2669
+ return this.applyOnFields(function (fld) { return fld.showLablel(); }, codes, secCode, subCode);
2670
+ };
2671
+ FormStructureAndData.prototype.hideLabelFields = function (codes, secCode, subCode) {
2672
+ return this.applyOnFields(function (fld) { return fld.hideLabel(); }, codes, secCode, subCode);
2673
+ };
2674
+ FormStructureAndData.prototype.disableFields = function (codes, secCode, subCode) {
2675
+ return this.applyOnFields(function (fld) { return fld.disable(); }, codes, secCode, subCode);
2676
+ };
2677
+ FormStructureAndData.prototype.cleanFields = function (codes, secCode, subCode) {
2678
+ return this.applyOnFields(function (fld) { return fld.clean(); }, codes, secCode, subCode);
2679
+ };
2680
+ FormStructureAndData.prototype.tagFieldsWithError = function (message, codes, secCode, subCode) {
2681
+ return this.applyOnFields(function (fld) { return fld.setErrorMessage(message); }, codes, secCode, subCode);
2682
+ };
2683
+ FormStructureAndData.prototype.cleanErrorFields = function (codes, secCode, subCode) {
2684
+ this.tagFieldsWithError('', codes, secCode, subCode);
2685
+ };
2686
+ FormStructureAndData.prototype.tagEmptyRequiredFields = function (message, codes, secCode, subCode) {
2687
+ if (codes === void 0) { codes = null; }
2688
+ return this.tagFieldsWithError(message, this.getRequiredEmptyFields(codes, secCode, subCode)) > 0;
2689
+ };
2690
+ FormStructureAndData.prototype.getRequiredFields = function (codes, secCode, subCode) {
2691
+ return this.getFieldSet(function (fld) { return fld.required; }, codes, secCode, subCode);
2692
+ };
2693
+ FormStructureAndData.prototype.getRequiredEmptyFields = function (codes, secCode, subCode) {
2694
+ return this.getFieldSet(function (fld) { return fld.required && fld.empty; }, codes, secCode, subCode);
2695
+ };
2696
+ FormStructureAndData.prototype.getChangedFields = function (codes, secCode, subCode) {
2697
+ return this.getFieldSet(function (fld) { return !fld.outputOnly && fld.hasChanged(); }, codes, secCode, subCode);
2698
+ };
2699
+ FormStructureAndData.prototype.getFieldsWithValidationIssues = function (codes, secCode, subCode) {
2700
+ return this.getFieldSet(function (fld) { return fld.errorCode !== NO_ERROR; }, codes, secCode, subCode);
2701
+ };
2702
+ FormStructureAndData.prototype.getFieldsValues = function (inputCodes, secCode, subCode) {
2703
+ var _a, _b, _c;
2704
+ var codes = this.getFieldSet(null, inputCodes, secCode, subCode);
2705
+ var resultObject = {};
2706
+ for (var index = 0; index < codes.length; index++) {
2707
+ var code = codes[index];
2708
+ if (code) {
2709
+ resultObject[code] = (_c = (_b = (_a = this._fields) === null || _a === void 0 ? void 0 : _a[code]) === null || _b === void 0 ? void 0 : _b.getValue()) !== null && _c !== void 0 ? _c : null;
2710
+ }
2711
+ }
2712
+ return resultObject;
2713
+ };
2714
+ Object.defineProperty(FormStructureAndData.prototype, "actions", {
2715
+ // Acciones
2716
+ get: function () { return this._actions; },
2717
+ enumerable: false,
2718
+ configurable: true
2719
+ });
2720
+ FormStructureAndData.prototype.getActionsByAttribute = function (name, value) { return this._actionArray.filter(function (actionItem) { return actionItem.matchAttribute(name, value); }); };
2721
+ FormStructureAndData.prototype.getActions = function () { return this._actionArray; };
2722
+ FormStructureAndData.prototype.getAction = function (code) { var _a; return (code && ((_a = this._actions) === null || _a === void 0 ? void 0 : _a[code])) ? this._actions[code] : null; };
2723
+ FormStructureAndData.prototype.showActions = function (codes) { return this.execOnActions(codes, SHOW); };
2724
+ FormStructureAndData.prototype.hideActions = function (codes) { return this.execOnActions(codes, HIDE); };
2725
+ FormStructureAndData.prototype.enableActions = function (codes) { return this.execOnActions(codes, ENABLE); };
2726
+ FormStructureAndData.prototype.disableActions = function (codes) { return this.execOnActions(codes, DISABLE); };
2727
+ FormStructureAndData.prototype.execOnActions = function (codes, functionName) {
2728
+ var _this = this;
2729
+ var actionCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2730
+ if (!functionName || actionCodes.length === 0) {
2731
+ return;
2732
+ }
2733
+ actionCodes.forEach(function (code) {
2734
+ var _a;
2735
+ var action = _this.getAction(code);
2736
+ (_a = action === null || action === void 0 ? void 0 : action[functionName]) === null || _a === void 0 ? void 0 : _a.call(action);
2737
+ });
2738
+ };
2739
+ Object.defineProperty(FormStructureAndData.prototype, "tables", {
2740
+ // Tablas
2741
+ get: function () { return this.tables; },
2742
+ enumerable: false,
2743
+ configurable: true
2744
+ });
2745
+ FormStructureAndData.prototype.getTables = function () { return this._tableArray; };
2746
+ FormStructureAndData.prototype.getTable = function (code) { var _a; return (code && ((_a = this._tables) === null || _a === void 0 ? void 0 : _a[code])) ? this._tables[code] : null; };
2747
+ FormStructureAndData.prototype.getTableRecord = function (code, id) { var _a; return (_a = this.getTable(code)) === null || _a === void 0 ? void 0 : _a.getTableRecord(id); };
2748
+ FormStructureAndData.prototype.enableTables = function (codes) { return this.execOnTables(codes, ENABLE); };
2749
+ FormStructureAndData.prototype.disableTables = function (codes) { return this.execOnTables(codes, DISABLE); };
2750
+ FormStructureAndData.prototype.showTables = function (codes) { return this.execOnTables(codes, SHOW); };
2751
+ FormStructureAndData.prototype.hideTables = function (codes) { return this.execOnTables(codes, HIDE); };
2752
+ FormStructureAndData.prototype.cleanTables = function (codes) { return this.execOnTables(codes, CLEAN); };
2753
+ FormStructureAndData.prototype.execOnTables = function (codes, functionName) {
2754
+ var _this = this;
2755
+ var tableCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2756
+ if (!functionName || tableCodes.length === 0) {
2757
+ return;
2758
+ }
2759
+ tableCodes.forEach(function (code) {
2760
+ var _a;
2761
+ var table = _this.getTable(code);
2762
+ (_a = table === null || table === void 0 ? void 0 : table[functionName]) === null || _a === void 0 ? void 0 : _a.call(table);
2763
+ });
2764
+ };
2765
+ Object.defineProperty(FormStructureAndData.prototype, "sections", {
2766
+ // Secciones
2767
+ get: function () { return this._sectionArray; },
2768
+ enumerable: false,
2769
+ configurable: true
2770
+ });
2771
+ FormStructureAndData.prototype.getSections = function () { return this.sections; };
2772
+ FormStructureAndData.prototype.getSectionsByAttribute = function (name, value) { return this._sectionArray.filter(function (item) { return item.matchAttribute(name, value); }); };
2773
+ Object.defineProperty(FormStructureAndData.prototype, "sectionTitles", {
2774
+ get: function () { return this._sectionArray.map(function (formSection) { return formSection.sectionTitle; }); },
2775
+ enumerable: false,
2776
+ configurable: true
2777
+ });
2778
+ Object.defineProperty(FormStructureAndData.prototype, "visibleSections", {
2779
+ get: function () { return this._sectionArray.filter(function (sec) { return sec.visible; }); },
2780
+ enumerable: false,
2781
+ configurable: true
2782
+ });
2783
+ FormStructureAndData.prototype.getSection = function (code) { var _a; return (code && ((_a = this._sections) === null || _a === void 0 ? void 0 : _a[code])) ? this._sections[code] : null; };
2784
+ FormStructureAndData.prototype.showSections = function (codes) { this.execOnSections(codes, SHOW); };
2785
+ FormStructureAndData.prototype.hideSections = function (codes) { this.execOnSections(codes, HIDE); };
2786
+ FormStructureAndData.prototype.activeSection = function () { return this._exclusiveSectionsByAttr[ACTIVE]; };
2787
+ FormStructureAndData.prototype.getSubSection = function (code, subCode) { var _a, _b; return (_b = (_a = this.getSection(code)) === null || _a === void 0 ? void 0 : _a.getSubsection(subCode)) !== null && _b !== void 0 ? _b : null; };
2788
+ FormStructureAndData.prototype.showSubSections = function (code, subCodes) { return this.execOnSubSections(code, subCodes, SHOW); };
2789
+ FormStructureAndData.prototype.hideSubSections = function (code, subCodes) { return this.execOnSubSections(code, subCodes, HIDE); };
2790
+ FormStructureAndData.prototype.activateSection = function (code) {
2791
+ var _a, _b;
2792
+ if (code === this._exclusiveSectionsByAttr[ACTIVE]) {
2793
+ return;
2794
+ }
2795
+ (_a = this.getSection(this.activeSection())) === null || _a === void 0 ? void 0 : _a.inactivate();
2796
+ (_b = this.getSection(code)) === null || _b === void 0 ? void 0 : _b.activate();
2797
+ this._exclusiveSectionsByAttr[ACTIVE] = code;
2798
+ };
2799
+ FormStructureAndData.prototype.execOnSections = function (codes, functionName) {
2800
+ var _this = this;
2801
+ var sectionCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2802
+ if (!functionName || sectionCodes.length === 0) {
2803
+ return;
2804
+ }
2805
+ sectionCodes.forEach(function (code) {
2806
+ var _a;
2807
+ var section = _this.getSection(code);
2808
+ (_a = section === null || section === void 0 ? void 0 : section[functionName]) === null || _a === void 0 ? void 0 : _a.call(section);
2809
+ });
2810
+ };
2811
+ FormStructureAndData.prototype.execOnSubSections = function (code, subNames, functionName) {
2812
+ var e_6, _e;
2813
+ var _a;
2814
+ var subCodes = (Array.isArray(subNames)) ? subNames : (subNames ? [subNames] : []);
2815
+ var section = this.getSection(code);
2816
+ if (!functionName || !section || subCodes.length === 0) {
2817
+ return;
2818
+ }
2819
+ try {
2820
+ for (var subCodes_1 = __values(subCodes), subCodes_1_1 = subCodes_1.next(); !subCodes_1_1.done; subCodes_1_1 = subCodes_1.next()) {
2821
+ var subCode = subCodes_1_1.value;
2822
+ var subSection = this.getSubSection(code, subCode);
2823
+ (_a = subSection === null || subSection === void 0 ? void 0 : subSection[functionName]) === null || _a === void 0 ? void 0 : _a.call(subSection);
2824
+ }
2825
+ }
2826
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
2827
+ finally {
2828
+ try {
2829
+ if (subCodes_1_1 && !subCodes_1_1.done && (_e = subCodes_1.return)) _e.call(subCodes_1);
2830
+ }
2831
+ finally { if (e_6) throw e_6.error; }
2832
+ }
2833
+ };
2834
+ /**
2835
+ * Métodos propios de gestión del formulario
2836
+ */
2837
+ FormStructureAndData.prototype.cleanData = function () {
2838
+ var e_7, _e, e_8, _f;
2839
+ try {
2840
+ for (var _g = __values(this._fieldArray), _h = _g.next(); !_h.done; _h = _g.next()) {
2841
+ var field = _h.value;
2842
+ field.setValue(field.defaultValue);
2843
+ }
2844
+ }
2845
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
2846
+ finally {
2847
+ try {
2848
+ if (_h && !_h.done && (_e = _g.return)) _e.call(_g);
2849
+ }
2850
+ finally { if (e_7) throw e_7.error; }
2851
+ }
2852
+ try {
2853
+ for (var _j = __values(this._tableArray), _k = _j.next(); !_k.done; _k = _j.next()) {
2854
+ var table = _k.value;
2855
+ table.clean();
2856
+ }
2857
+ }
2858
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
2859
+ finally {
2860
+ try {
2861
+ if (_k && !_k.done && (_f = _j.return)) _f.call(_j);
2862
+ }
2863
+ finally { if (e_8) throw e_8.error; }
2864
+ }
2865
+ };
2866
+ FormStructureAndData.prototype.getPayload = function () {
2867
+ var formData = {
2868
+ fields: [],
2869
+ tables: [],
2870
+ };
2871
+ formData.fields = this.getFields().filter(function (fld) { return !fld.outputOnly; })
2872
+ .map(function (fld) {
2873
+ var fieldPayload = {
2874
+ fieldCode: fld.fieldCode,
2875
+ fieldValue: fld.getValue(),
2876
+ editable: !fld.disabled,
2877
+ visible: fld.visible,
2878
+ required: fld.required,
2879
+ fieldOptions: '',
2880
+ };
2881
+ return fieldPayload;
2882
+ });
2883
+ formData.tables = this.getTables().map(function (tbl) {
2884
+ var tablePayload = {
2885
+ tableCode: tbl.tableCode,
2886
+ visible: tbl.visible,
2887
+ currentPage: tbl.currentPage,
2888
+ requestedPage: tbl.requestedPage,
2889
+ recordsPerPage: tbl.recordsPerPage,
2890
+ currentFilter: tbl.currentFilter,
2891
+ sortingColumn: tbl.sorting.columnName,
2892
+ sortingDirection: tbl.sorting.direction,
2893
+ };
2894
+ return tablePayload;
2895
+ });
2896
+ return formData;
2897
+ };
2898
+ return FormStructureAndData;
2899
+ }());
2900
+
2901
+ var LibFormManagerService = /** @class */ (function () {
2902
+ function LibFormManagerService() {
2903
+ this.cleanStack();
2904
+ }
2905
+ // Métodos virtuales para las aplicaciones
2906
+ LibFormManagerService.prototype.getFormDefinition = function (formCode) { };
2907
+ LibFormManagerService.prototype.execServerAction = function (actionDetail) { };
2908
+ LibFormManagerService.prototype.goToForm = function (formCode, token, subject) { };
2909
+ LibFormManagerService.prototype.loadStack = function () { };
2910
+ LibFormManagerService.prototype.saveStack = function () { };
2911
+ LibFormManagerService.prototype.cleanStack = function () { this.pageStack = []; };
2912
+ LibFormManagerService.prototype.resetPageStack = function () { this.cleanStack(); };
2913
+ LibFormManagerService.prototype.findFormInStack = function (token) {
2914
+ var index = this.pageStack.findIndex(function (item) { return (item === null || item === void 0 ? void 0 : item.token) === token; });
2915
+ var data = (index >= 0) ? this.pageStack[index] : null;
2916
+ return { index: index, data: data };
2917
+ };
2918
+ LibFormManagerService.prototype.replaceItem = function (token, formInfo) {
2919
+ var _a, _b;
2920
+ if (!token || !formInfo) {
2921
+ return;
2922
+ }
2923
+ var _c = this.findFormInStack(token), index = _c.index, storedForm = _c.data;
2924
+ var updatedForm = null;
2925
+ if (index >= 0) {
2926
+ updatedForm = Object.assign({}, storedForm);
2927
+ updatedForm.subject = (_a = formInfo === null || formInfo === void 0 ? void 0 : formInfo.subject) !== null && _a !== void 0 ? _a : storedForm.subject;
2928
+ updatedForm.state = (_b = formInfo === null || formInfo === void 0 ? void 0 : formInfo.state) !== null && _b !== void 0 ? _b : storedForm.state;
2929
+ Object.assign(updatedForm.fields, formInfo.fields);
2930
+ Object.assign(updatedForm.extra, formInfo.extra);
2931
+ this.pageStack[index] = updatedForm;
2932
+ this.saveStack();
2933
+ }
2934
+ };
2935
+ LibFormManagerService.prototype.stack = function (origin, target) {
2936
+ var token = nanoid.nanoid(6);
2937
+ this.replaceItem(target.originToken, origin);
2938
+ this.pageStack.push(Object.assign({ token: token }, target));
2939
+ this.saveStack();
2940
+ return token;
2941
+ };
2942
+ LibFormManagerService.prototype.unstack = function (token) {
2943
+ if (token === void 0) { token = null; }
2944
+ var index = (token) ? this.findFormInStack(token).index : this.pageStack.length - 2;
2945
+ var formInfo = null;
2946
+ if (index >= 0) {
2947
+ formInfo = this.pageStack[index];
2948
+ this.pageStack.splice(index + 1);
2949
+ this.saveStack();
2950
+ }
2951
+ return formInfo;
2952
+ };
2953
+ LibFormManagerService.prototype.getFormInfo = function (token) {
2954
+ var _a, _b;
2955
+ var data = this.findFormInStack(token).data;
2956
+ return {
2957
+ token: data === null || data === void 0 ? void 0 : data.token,
2958
+ subject: data === null || data === void 0 ? void 0 : data.subject,
2959
+ state: data === null || data === void 0 ? void 0 : data.state,
2960
+ originToken: data === null || data === void 0 ? void 0 : data.originToken,
2961
+ fields: (_a = data === null || data === void 0 ? void 0 : data.fields) !== null && _a !== void 0 ? _a : {},
2962
+ extra: (_b = data === null || data === void 0 ? void 0 : data.extra) !== null && _b !== void 0 ? _b : {}
2963
+ };
2964
+ };
2965
+ LibFormManagerService.prototype.openForm = function (origin, target) {
2966
+ var _a;
2967
+ (!origin) && this.cleanStack();
2968
+ target.originToken = (_a = origin === null || origin === void 0 ? void 0 : origin.token) !== null && _a !== void 0 ? _a : null;
2969
+ var token = this.stack(origin, target);
2970
+ this.goToForm(target.name, token, target.subject);
2971
+ };
2972
+ LibFormManagerService.prototype.backTo = function (targetToken) {
2973
+ if (targetToken === void 0) { targetToken = null; }
2974
+ var formInfo = this.unstack(targetToken);
2975
+ formInfo && formInfo.name && this.goToForm(formInfo.name, formInfo.token, formInfo.subject);
2976
+ };
2977
+ return LibFormManagerService;
2978
+ }());
2979
+
2980
+ var LibEventManagerService = /** @class */ (function () {
2981
+ function LibEventManagerService(eventNames) {
2982
+ var _this = this;
2983
+ this.eventSubjects = {};
2984
+ eventNames.forEach(function (name) { _this.addEventName(name); });
2985
+ }
2986
+ LibEventManagerService.prototype.addEventName = function (name) {
2987
+ if (!this.eventSubjects[name]) {
2988
+ var newEventSubject = new rxjs.ReplaySubject(1);
2989
+ this.eventSubjects[name] = newEventSubject;
2990
+ }
2991
+ };
2992
+ LibEventManagerService.prototype.getEventNames = function () { return Object.keys(this.eventSubjects); };
2993
+ LibEventManagerService.prototype.getSubject = function (eventClassName) { return eventClassName ? this.eventSubjects[eventClassName] : null; };
2994
+ LibEventManagerService.prototype.subscribe = function (eventClassName, callback) { this.getSubject(eventClassName).subscribe(callback); };
2995
+ LibEventManagerService.prototype.next = function (eventClassName, data) { this.getSubject(eventClassName).next(data); };
2996
+ return LibEventManagerService;
2997
+ }());
2998
+
2999
+ var LibFileManagementService = /** @class */ (function () {
3000
+ function LibFileManagementService() {
3001
+ }
3002
+ LibFileManagementService.prototype.openFile = function (fileBase64Data, fileName, fileType) { };
3003
+ LibFileManagementService.prototype.saveFileFromURL = function (fileUrl, fullFileName) {
3004
+ if (fullFileName === void 0) { fullFileName = null; }
3005
+ };
3006
+ LibFileManagementService.prototype.saveFile = function (fileBase64Data, fileName, fileType) { };
3007
+ return LibFileManagementService;
3008
+ }());
3009
+
3010
+ var PAYLOAD_VERSION = 'TUAINEXCHANGE_1.0';
3011
+ var INLINE_ACTION = 'INLINE';
3012
+ var GLOBAL_ACTION = 'GLOBAL';
3013
+ var GET_DATA_ACTION = 'GETDATA';
3014
+ var SUBJECT = 'subject';
3015
+ var TOKEN = 'token';
3016
+ var BasicFormComponent = /** @class */ (function () {
3017
+ function BasicFormComponent(formManagerService, _eventManager, fileMgmtServices) {
3018
+ this.formManagerService = formManagerService;
3019
+ this._eventManager = _eventManager;
3020
+ this.fileMgmtServices = fileMgmtServices;
3021
+ this._formStructure = null;
3022
+ this._controlToken = null;
3023
+ this._definitionObtained = false;
3024
+ // Eventos de acciones y campos
3025
+ this._formSectionsActivate = {};
3026
+ this._formSectionsInactivate = {};
3027
+ this._formActionsStart = {};
3028
+ this._formActionsFinish = {};
3029
+ this._fieldInputValidation = {};
3030
+ this._fieldValidationsStart = {};
3031
+ this._fieldValidationsFinish = {};
3032
+ // Callback de acciones de tablas
3033
+ this._tableSelectionsStart = {};
3034
+ this._tableSelectionsFinish = {};
3035
+ this._tableActionsStart = {};
3036
+ this._tableActionsFinish = {};
3037
+ this._tableGetDataStart = {};
3038
+ this._tableGetDataFinish = {};
3039
+ this.inputDataFields = {};
3040
+ this.extraData = {};
3041
+ this._errorType = '';
3042
+ this.errorCode = '';
3043
+ this.errorMessage = '';
3044
+ this.errorDetail = '';
3045
+ this.visible = false;
3046
+ this.busy = false;
3047
+ this._eventEmiter = this._eventManager;
3048
+ this.cleanStart();
3049
+ this.customPreProcessing();
3050
+ }
3051
+ BasicFormComponent.prototype.getTitle = function () {
3052
+ var _a;
3053
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTitle();
3054
+ };
3055
+ BasicFormComponent.prototype.setTitle = function (title) {
3056
+ var _a;
3057
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setTitle(title);
3058
+ };
3059
+ BasicFormComponent.prototype.cleanData = function () {
3060
+ var _a;
3061
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanData();
3062
+ };
3063
+ BasicFormComponent.prototype.getCurrentState = function () {
3064
+ var _a;
3065
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getCurrentState();
3066
+ };
3067
+ BasicFormComponent.prototype.supportState = function (state) {
3068
+ var _a;
3069
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.supportState(state);
3070
+ };
3071
+ BasicFormComponent.prototype.changeState = function (state) {
3072
+ var _a;
3073
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state);
3074
+ };
3075
+ BasicFormComponent.prototype.getStates = function () {
3076
+ var _a;
3077
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.states;
3078
+ };
3079
+ BasicFormComponent.prototype.getImmutableElement = function (name) {
3080
+ var _a;
3081
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getImmutableElement(name);
3082
+ };
3083
+ BasicFormComponent.prototype.getExtraInfo = function (name) {
3084
+ var _a;
3085
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getExtraInfo(name);
3086
+ };
3087
+ BasicFormComponent.prototype.getFields = function () {
3088
+ var _a;
3089
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields();
3090
+ };
3091
+ BasicFormComponent.prototype.getFieldNames = function () {
3092
+ var _a;
3093
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldNames();
3094
+ };
3095
+ BasicFormComponent.prototype.getField = function (code) {
3096
+ var _a;
3097
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getField(code);
3098
+ };
3099
+ BasicFormComponent.prototype.enableField = function (code) {
3100
+ var _a;
3101
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableField(code);
3102
+ };
3103
+ BasicFormComponent.prototype.disableField = function (code) {
3104
+ var _a;
3105
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableField(code);
3106
+ };
3107
+ BasicFormComponent.prototype.getFieldValue = function (code) {
3108
+ var _a;
3109
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldValue(code);
3110
+ };
3111
+ BasicFormComponent.prototype.getFieldsValues = function (codes) {
3112
+ var _a;
3113
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsValues(codes);
3114
+ };
3115
+ BasicFormComponent.prototype.getFieldOptions = function (code) {
3116
+ var _a;
3117
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldOptions(code);
3118
+ };
3119
+ BasicFormComponent.prototype.setFieldValue = function (code, value) {
3120
+ var _a;
3121
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldValue(code, value);
3122
+ };
3123
+ BasicFormComponent.prototype.setFieldRequired = function (code, required) {
3124
+ var _a;
3125
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldRequired(code, required);
3126
+ };
3127
+ BasicFormComponent.prototype.setFieldErrorMessage = function (code, errorMessage) {
3128
+ var _a;
3129
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldErrorMessage(code, errorMessage);
3130
+ };
3131
+ BasicFormComponent.prototype.setFieldError = function (code, message, type) {
3132
+ var _a;
3133
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldError(code, message, type);
3134
+ };
3135
+ BasicFormComponent.prototype.setFieldIntrinsicErrorMessage = function (code, message) {
3136
+ var _a;
3137
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldIntrinsicErrorMessage(code, message);
3138
+ };
3139
+ BasicFormComponent.prototype.setFieldOptions = function (code, optionsArray, idAttribute, nameAttribute) {
3140
+ var _a;
3141
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldOptions(code, optionsArray, idAttribute, nameAttribute);
3142
+ };
3143
+ BasicFormComponent.prototype.getFieldSet = function (filterFunc, codes, secCode, subCode) {
3144
+ var _a;
3145
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldSet(filterFunc, codes, secCode, subCode);
3146
+ };
3147
+ BasicFormComponent.prototype.applyOnFields = function (processFunc, codes, secCode, subCode) {
3148
+ var _a;
3149
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.applyOnFields(processFunc, codes, secCode, subCode);
3150
+ };
3151
+ BasicFormComponent.prototype.applyProcessToAllFields = function (processFunc) {
3152
+ var _a;
3153
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.applyOnFields(processFunc);
3154
+ };
3155
+ BasicFormComponent.prototype.cleanFields = function (codes, secCode, subCode) {
3156
+ var _a;
3157
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanFields(codes, secCode, subCode);
3158
+ };
3159
+ BasicFormComponent.prototype.getRequiredFields = function (codes, secCode, subCode) {
3160
+ var _a;
3161
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredFields(codes, secCode, subCode);
3162
+ };
3163
+ BasicFormComponent.prototype.getRequiredEmptyFields = function (codes, secCode, subCode) {
3164
+ var _a;
3165
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredEmptyFields(codes, secCode, subCode);
3166
+ };
3167
+ BasicFormComponent.prototype.getChangedFields = function (codes, secCode, subCode) {
3168
+ var _a;
3169
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getChangedFields(codes, secCode, subCode);
3170
+ };
3171
+ BasicFormComponent.prototype.getFieldsWithValidationIssues = function (codes, secCode, subCode) {
3172
+ var _a;
3173
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsWithValidationIssues(codes, secCode, subCode);
3174
+ };
3175
+ BasicFormComponent.prototype.tagFieldsWithError = function (errorMessage, codes, secCode, subCode) {
3176
+ var _a;
3177
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.tagFieldsWithError(errorMessage, codes, secCode, subCode);
3178
+ };
3179
+ BasicFormComponent.prototype.cleanErrorFields = function (codes, secCode, subCode) {
3180
+ var _a;
3181
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanErrorFields(codes, secCode, subCode);
3182
+ };
3183
+ BasicFormComponent.prototype.showLabelFields = function (codes, secCode, subCode) {
3184
+ var _a;
3185
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showLabelFields(codes, secCode, subCode);
3186
+ };
3187
+ BasicFormComponent.prototype.hideLabelFields = function (codes, secCode, subCode) {
3188
+ var _a;
3189
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideLabelFields(codes, secCode, subCode);
3190
+ };
3191
+ BasicFormComponent.prototype.enableFields = function (codes, secCode, subCode) {
3192
+ var _a;
3193
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableFields(codes, secCode, subCode);
3194
+ };
3195
+ BasicFormComponent.prototype.disableFields = function (codes, secCode, subCode) {
3196
+ var _a;
3197
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableFields(codes, secCode, subCode);
3198
+ };
3199
+ /**
3200
+ * @deprecated Use enableFields
3201
+ */
3202
+ BasicFormComponent.prototype.enableEditFields = function (codes, secCode, subCode) {
3203
+ return this.enableFields(codes, secCode, subCode);
3204
+ };
3205
+ /**
3206
+ * @deprecated Use disableFields
3207
+ */
3208
+ BasicFormComponent.prototype.disableEditFields = function (codes, secCode, subCode) {
3209
+ return this.disableFields(codes, secCode, subCode);
3210
+ };
3211
+ BasicFormComponent.prototype.showFields = function (codes, secCode, subCode) {
3212
+ var _a;
3213
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showFields(codes, secCode, subCode);
3214
+ };
3215
+ BasicFormComponent.prototype.hideFields = function (codes, secCode, subCode) {
3216
+ var _a;
3217
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideFields(codes, secCode, subCode);
3218
+ };
3219
+ BasicFormComponent.prototype.getActionsByAttribute = function (name, value) {
3220
+ var _a;
3221
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActionsByAttribute(name, value);
3222
+ };
3223
+ BasicFormComponent.prototype.getHeaderActions = function () {
3224
+ var _a;
3225
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActionsByAttribute('location', HEADER$1);
3226
+ };
3227
+ BasicFormComponent.prototype.getAction = function (actionCode) {
3228
+ var _a;
3229
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getAction(actionCode);
3230
+ };
3231
+ BasicFormComponent.prototype.showActions = function (actionArray) {
3232
+ var _a;
3233
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showActions(actionArray);
3234
+ };
3235
+ BasicFormComponent.prototype.hideActions = function (actionArray) {
3236
+ var _a;
3237
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideActions(actionArray);
3238
+ };
3239
+ BasicFormComponent.prototype.enableActions = function (actionArray) {
3240
+ var _a;
3241
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableActions(actionArray);
3242
+ };
3243
+ BasicFormComponent.prototype.disableActions = function (actionArray) {
3244
+ var _a;
3245
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableActions(actionArray);
3246
+ };
3247
+ BasicFormComponent.prototype.showAction = function (code) {
3248
+ var _a;
3249
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showActions(code);
3250
+ };
3251
+ BasicFormComponent.prototype.hideAction = function (code) {
3252
+ var _a;
3253
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideActions(code);
3254
+ };
3255
+ BasicFormComponent.prototype.enableAction = function (code) {
3256
+ var _a;
3257
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableActions(code);
3258
+ };
3259
+ BasicFormComponent.prototype.disableAction = function (code) {
3260
+ var _a;
3261
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableActions(code);
3262
+ };
3263
+ BasicFormComponent.prototype.getSections = function () {
3264
+ var _a;
3265
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections();
3266
+ };
3267
+ BasicFormComponent.prototype.activateSection = function (code) {
3268
+ var _a;
3269
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.activateSection(code);
3270
+ };
3271
+ BasicFormComponent.prototype.getSectionsTitles = function () {
3272
+ var _a;
3273
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections().map(function (sec) { return sec.title; });
3274
+ };
3275
+ BasicFormComponent.prototype.getSection = function (code) {
3276
+ var _a;
3277
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
3278
+ };
3279
+ BasicFormComponent.prototype.showSection = function (code) {
3280
+ var _a;
3281
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSections(code);
3175
3282
  };
3176
- return FormStructureAndData;
3177
- }());
3178
-
3179
- var LibFormManagerService = /** @class */ (function () {
3180
- function LibFormManagerService() {
3181
- this.cleanStack();
3182
- }
3183
- // Métodos virtuales para las aplicaciones
3184
- LibFormManagerService.prototype.getFormDefinition = function (formCode) { };
3185
- LibFormManagerService.prototype.execServerAction = function (actionDetail) { };
3186
- LibFormManagerService.prototype.goToForm = function (formCode, token, subject) { };
3187
- LibFormManagerService.prototype.loadStack = function () { };
3188
- LibFormManagerService.prototype.saveStack = function () { };
3189
- LibFormManagerService.prototype.cleanStack = function () { this.pageStack = []; };
3190
- LibFormManagerService.prototype.resetPageStack = function () { this.cleanStack(); };
3191
- LibFormManagerService.prototype.findFormInStack = function (token) {
3192
- var index = this.pageStack.findIndex(function (item) { return (item === null || item === void 0 ? void 0 : item.token) === token; });
3193
- var data = (index >= 0) ? this.pageStack[index] : null;
3194
- return { index: index, data: data };
3283
+ BasicFormComponent.prototype.hideSection = function (code) {
3284
+ var _a;
3285
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSections(code);
3195
3286
  };
3196
- LibFormManagerService.prototype.replaceItem = function (token, formInfo) {
3197
- var _a, _b;
3198
- if (!token || !formInfo) {
3199
- return;
3200
- }
3201
- var _c = this.findFormInStack(token), index = _c.index, storedForm = _c.data;
3202
- var updatedForm = null;
3203
- if (index >= 0) {
3204
- updatedForm = Object.assign({}, storedForm);
3205
- updatedForm.subject = (_a = formInfo === null || formInfo === void 0 ? void 0 : formInfo.subject) !== null && _a !== void 0 ? _a : storedForm.subject;
3206
- updatedForm.state = (_b = formInfo === null || formInfo === void 0 ? void 0 : formInfo.state) !== null && _b !== void 0 ? _b : storedForm.state;
3207
- Object.assign(updatedForm.fields, formInfo.fields);
3208
- Object.assign(updatedForm.extra, formInfo.extra);
3209
- this.pageStack[index] = updatedForm;
3210
- this.saveStack();
3211
- }
3287
+ BasicFormComponent.prototype.showSections = function (codes) {
3288
+ var _a;
3289
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSections(codes);
3212
3290
  };
3213
- LibFormManagerService.prototype.stack = function (origin, target) {
3214
- var token = nanoid.nanoid(6);
3215
- this.replaceItem(target.originToken, origin);
3216
- this.pageStack.push(Object.assign({ token: token }, target));
3217
- this.saveStack();
3218
- return token;
3291
+ BasicFormComponent.prototype.hideSections = function (codes) {
3292
+ var _a;
3293
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSections(codes);
3219
3294
  };
3220
- LibFormManagerService.prototype.unstack = function (token) {
3221
- if (token === void 0) { token = null; }
3222
- var index = (token) ? this.findFormInStack(token).index : this.pageStack.length - 2;
3223
- var formInfo = null;
3224
- if (index >= 0) {
3225
- formInfo = this.pageStack[index];
3226
- this.pageStack.splice(index + 1);
3227
- this.saveStack();
3228
- }
3229
- return formInfo;
3295
+ BasicFormComponent.prototype.getSubSection = function (code, subCode) {
3296
+ var _a;
3297
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSubSection(code, subCode);
3230
3298
  };
3231
- LibFormManagerService.prototype.getFormInfo = function (token) {
3232
- var _a, _b;
3233
- var data = this.findFormInStack(token).data;
3234
- return {
3235
- token: data === null || data === void 0 ? void 0 : data.token,
3236
- subject: data === null || data === void 0 ? void 0 : data.subject,
3237
- state: data === null || data === void 0 ? void 0 : data.state,
3238
- originToken: data === null || data === void 0 ? void 0 : data.originToken,
3239
- fields: (_a = data === null || data === void 0 ? void 0 : data.fields) !== null && _a !== void 0 ? _a : {},
3240
- extra: (_b = data === null || data === void 0 ? void 0 : data.extra) !== null && _b !== void 0 ? _b : {}
3241
- };
3299
+ BasicFormComponent.prototype.showSubSection = function (code, subCode) {
3300
+ var _a;
3301
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSubSections(code, subCode);
3242
3302
  };
3243
- LibFormManagerService.prototype.openForm = function (origin, target) {
3303
+ BasicFormComponent.prototype.hideSubSection = function (code, subCode) {
3244
3304
  var _a;
3245
- (!origin) && this.cleanStack();
3246
- target.originToken = (_a = origin === null || origin === void 0 ? void 0 : origin.token) !== null && _a !== void 0 ? _a : null;
3247
- var token = this.stack(origin, target);
3248
- this.goToForm(target.name, token, target.subject);
3305
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSubSections(code, subCode);
3249
3306
  };
3250
- LibFormManagerService.prototype.backTo = function (targetToken) {
3251
- if (targetToken === void 0) { targetToken = null; }
3252
- var formInfo = this.unstack(targetToken);
3253
- formInfo && formInfo.name && this.goToForm(formInfo.name, formInfo.token, formInfo.subject);
3307
+ BasicFormComponent.prototype.showSubSections = function (code, subCodes) {
3308
+ var _a;
3309
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSubSections(code, subCodes);
3254
3310
  };
3255
- return LibFormManagerService;
3256
- }());
3257
-
3258
- var LibEventManagerService = /** @class */ (function () {
3259
- function LibEventManagerService(eventNames) {
3260
- var _this = this;
3261
- this.eventSubjects = {};
3262
- eventNames.forEach(function (name) { _this.addEventName(name); });
3263
- }
3264
- LibEventManagerService.prototype.addEventName = function (name) {
3265
- if (!this.eventSubjects[name]) {
3266
- var newEventSubject = new rxjs.ReplaySubject(1);
3267
- this.eventSubjects[name] = newEventSubject;
3268
- }
3311
+ BasicFormComponent.prototype.hideSubSections = function (code, subCodes) {
3312
+ var _a;
3313
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSubSections(code, subCodes);
3269
3314
  };
3270
- LibEventManagerService.prototype.getEventNames = function () { return Object.keys(this.eventSubjects); };
3271
- LibEventManagerService.prototype.getSubject = function (eventClassName) { return eventClassName ? this.eventSubjects[eventClassName] : null; };
3272
- LibEventManagerService.prototype.subscribe = function (eventClassName, callback) { this.getSubject(eventClassName).subscribe(callback); };
3273
- LibEventManagerService.prototype.next = function (eventClassName, data) { this.getSubject(eventClassName).next(data); };
3274
- return LibEventManagerService;
3275
- }());
3276
-
3277
- var LibFileManagementService = /** @class */ (function () {
3278
- function LibFileManagementService() {
3279
- }
3280
- LibFileManagementService.prototype.openFile = function (fileBase64Data, fileName, fileType) { };
3281
- LibFileManagementService.prototype.saveFileFromURL = function (fileUrl, fullFileName) {
3282
- if (fullFileName === void 0) { fullFileName = null; }
3315
+ BasicFormComponent.prototype.getTables = function () {
3316
+ var _a;
3317
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTables();
3318
+ };
3319
+ BasicFormComponent.prototype.showTables = function (codes) {
3320
+ var _a;
3321
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showTables(codes);
3322
+ };
3323
+ BasicFormComponent.prototype.hideTables = function (codes) {
3324
+ var _a;
3325
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideTables(codes);
3326
+ };
3327
+ BasicFormComponent.prototype.cleanTables = function (codes) {
3328
+ var _a;
3329
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanTables(codes);
3330
+ };
3331
+ BasicFormComponent.prototype.getTable = function (code) {
3332
+ var _a;
3333
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTable(code);
3334
+ };
3335
+ BasicFormComponent.prototype.showTable = function (code) {
3336
+ var _a;
3337
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showTables(code);
3338
+ };
3339
+ BasicFormComponent.prototype.hideTable = function (code) {
3340
+ var _a;
3341
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideTables(code);
3342
+ };
3343
+ BasicFormComponent.prototype.cleanTable = function (code) {
3344
+ var _a, _b;
3345
+ return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTable(code)) === null || _b === void 0 ? void 0 : _b.clean();
3346
+ };
3347
+ BasicFormComponent.prototype.getTableRecord = function (code, recordId) {
3348
+ var _a;
3349
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTableRecord(code, recordId);
3283
3350
  };
3284
- LibFileManagementService.prototype.saveFile = function (fileBase64Data, fileName, fileType) { };
3285
- return LibFileManagementService;
3286
- }());
3287
-
3288
- var PAYLOAD_VERSION = 'TUAINEXCHANGE_1.0';
3289
- var INLINE_ACTION = 'INLINE';
3290
- var GLOBAL_ACTION = 'GLOBAL';
3291
- var GET_DATA_ACTION = 'GETDATA';
3292
- var SUBJECT = 'subject';
3293
- var TOKEN = 'token';
3294
- var BasicFormComponent = /** @class */ (function () {
3295
- function BasicFormComponent(formManagerService, _eventManager, fileMgmtServices) {
3296
- this.formManagerService = formManagerService;
3297
- this._eventManager = _eventManager;
3298
- this.fileMgmtServices = fileMgmtServices;
3299
- this.errorCode = '';
3300
- this.errorMessage = '';
3301
- this.errorDetail = '';
3302
- this.formStructure = null;
3303
- this.controlToken = null;
3304
- this.inputDataFields = {};
3305
- this.extraData = {};
3306
- this.definitionObtained = false;
3307
- this.formVisible = false;
3308
- this.busy = false;
3309
- this.formSectionsActivate = {};
3310
- this.formSectionsInactivate = {};
3311
- this.formActionsStart = {};
3312
- this.formActionsFinish = {};
3313
- this.fieldInputValidation = {};
3314
- this.fieldValidationsStart = {};
3315
- this.fieldValidationsFinish = {};
3316
- // Callback de acciones de tablas
3317
- this.tableSelectionsStart = {};
3318
- this.tableSelectionsFinish = {};
3319
- this.tableActionsStart = {};
3320
- this.tableActionsFinish = {};
3321
- this.tableGetDataStart = {};
3322
- this.tableGetDataFinish = {};
3323
- this._eventEmiter = this._eventManager;
3324
- this.cleanStart();
3325
- this.customPreProcessing();
3326
- }
3327
- Object.defineProperty(BasicFormComponent.prototype, "inServerProcess", {
3328
- get: function () { return this.busy; },
3329
- enumerable: false,
3330
- configurable: true
3331
- });
3332
3351
  BasicFormComponent.prototype.setConfig = function (formConfig) {
3333
3352
  this.formConfig = formConfig;
3334
3353
  };
@@ -3337,37 +3356,63 @@
3337
3356
  this.errorCode = '';
3338
3357
  this.errorMessage = '';
3339
3358
  this.errorDetail = '';
3340
- this.formStructure = null;
3359
+ this._formStructure = null;
3341
3360
  this.fields = null;
3342
3361
  this.actions = null;
3343
- this.controlToken = null;
3362
+ this._controlToken = null;
3344
3363
  this.inputDataFields = {};
3345
- this.definitionObtained = false;
3364
+ this._definitionObtained = false;
3346
3365
  // Se limpian los manejadores de eventos
3347
- this.formVisible = false;
3366
+ this.visible = false;
3348
3367
  this.busy = false;
3349
- this.formSectionsActivate = {};
3350
- this.formSectionsInactivate = {};
3351
- this.formActionsStart = {};
3352
- this.formActionsFinish = {};
3353
- this.fieldInputValidation = {};
3354
- this.fieldValidationsStart = {};
3355
- this.fieldValidationsFinish = {};
3356
- this.tableSelectionsStart = {};
3357
- this.tableSelectionsFinish = {};
3358
- this.tableActionsStart = {};
3359
- this.tableActionsFinish = {};
3360
- this.tableGetDataStart = {};
3361
- this.tableGetDataFinish = {};
3362
- };
3368
+ this._formSectionsActivate = {};
3369
+ this._formSectionsInactivate = {};
3370
+ this._formActionsStart = {};
3371
+ this._formActionsFinish = {};
3372
+ this._fieldInputValidation = {};
3373
+ this._fieldValidationsStart = {};
3374
+ this._fieldValidationsFinish = {};
3375
+ this._tableSelectionsStart = {};
3376
+ this._tableSelectionsFinish = {};
3377
+ this._tableActionsStart = {};
3378
+ this._tableActionsFinish = {};
3379
+ this._tableGetDataStart = {};
3380
+ this._tableGetDataFinish = {};
3381
+ };
3382
+ Object.defineProperty(BasicFormComponent.prototype, "formVisible", {
3383
+ get: function () { return this.visible; },
3384
+ enumerable: false,
3385
+ configurable: true
3386
+ });
3387
+ Object.defineProperty(BasicFormComponent.prototype, "formManager", {
3388
+ get: function () { return this; },
3389
+ enumerable: false,
3390
+ configurable: true
3391
+ });
3392
+ Object.defineProperty(BasicFormComponent.prototype, "formCode", {
3393
+ get: function () { return this.name; },
3394
+ set: function (name) { this.name = name; },
3395
+ enumerable: false,
3396
+ configurable: true
3397
+ });
3398
+ Object.defineProperty(BasicFormComponent.prototype, "inServerProcess", {
3399
+ get: function () { return this.busy; },
3400
+ enumerable: false,
3401
+ configurable: true
3402
+ });
3363
3403
  Object.defineProperty(BasicFormComponent.prototype, "form", {
3364
- get: function () { return this.formStructure; },
3404
+ get: function () { return this._formStructure; },
3405
+ enumerable: false,
3406
+ configurable: true
3407
+ });
3408
+ Object.defineProperty(BasicFormComponent.prototype, "state", {
3409
+ get: function () { return this.getCurrentState(); },
3365
3410
  enumerable: false,
3366
3411
  configurable: true
3367
3412
  });
3368
3413
  Object.defineProperty(BasicFormComponent.prototype, "currentState", {
3369
- get: function () { return this.formStructure.state; },
3370
- set: function (state) { this.formStructure.changeState(state); },
3414
+ get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state; },
3415
+ set: function (state) { this._formStructure.changeState(state); },
3371
3416
  enumerable: false,
3372
3417
  configurable: true
3373
3418
  });
@@ -3377,137 +3422,32 @@
3377
3422
  configurable: true
3378
3423
  });
3379
3424
  Object.defineProperty(BasicFormComponent.prototype, "immutableData", {
3380
- get: function () { return this.formStructure.immutableData; },
3425
+ get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.immutableData; },
3381
3426
  enumerable: false,
3382
3427
  configurable: true
3383
3428
  });
3384
3429
  Object.defineProperty(BasicFormComponent.prototype, "extraInfo", {
3385
- get: function () { return this.formStructure.extraInfo; },
3430
+ get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.extraInfo; },
3386
3431
  enumerable: false,
3387
3432
  configurable: true
3388
3433
  });
3389
- // Métodos Pass-through hacia el contenido y estructura del formulario
3390
- BasicFormComponent.prototype.supportState = function (state) { return this.formStructure.supportState(state); };
3391
- BasicFormComponent.prototype.supportMode = function (state) { return this.supportState(state); };
3392
- BasicFormComponent.prototype.getTitle = function () { return this.formStructure.title; };
3393
- BasicFormComponent.prototype.setTitle = function (title) { this.formStructure.title = title; };
3394
- BasicFormComponent.prototype.getImmutableElement = function (name) { return this.formStructure.getImmutableElement(name); };
3395
- BasicFormComponent.prototype.getExtraInfo = function (name) { return this.formStructure.getExtraInfo(name); };
3396
- BasicFormComponent.prototype.cleanData = function () { return this.formStructure.cleanData(); };
3397
- BasicFormComponent.prototype.getFields = function () { return this.formStructure.getFields(); };
3398
- BasicFormComponent.prototype.getFieldNames = function () { return this.formStructure.getFieldNames(); };
3399
- BasicFormComponent.prototype.getFieldObject = function (elementId) { return this.formStructure.getFieldObject(elementId); };
3400
- BasicFormComponent.prototype.getField = function (fieldCode) { return this.getFieldObject(fieldCode); };
3401
- BasicFormComponent.prototype.enableField = function (fieldCode) { return this.formStructure.enableField(fieldCode); };
3402
- BasicFormComponent.prototype.disableField = function (fieldCode) { return this.formStructure.disableField(fieldCode); };
3403
- BasicFormComponent.prototype.getFieldValue = function (fieldCode) { return this.formStructure.getFieldValue(fieldCode); };
3404
- BasicFormComponent.prototype.getFieldsValues = function (fieldCodesArray) { return this.formStructure.getFieldsValues(fieldCodesArray); };
3405
- BasicFormComponent.prototype.getFieldOptions = function (fieldCode) { return this.formStructure.getFieldOptions(fieldCode); };
3406
- BasicFormComponent.prototype.setFieldValue = function (fieldCode, fieldValue) { return this.formStructure.setFieldValue(fieldCode, fieldValue); };
3407
- BasicFormComponent.prototype.setFieldRequired = function (fieldCode, required) { return this.formStructure.setFieldRequired(fieldCode, required); };
3408
- BasicFormComponent.prototype.setFieldErrorMessage = function (fieldCode, errorMessage) { return this.formStructure.setFieldErrorMessage(fieldCode, errorMessage); };
3409
- BasicFormComponent.prototype.setFieldError = function (code, message, type) {
3410
- if (type === void 0) { type = 'error'; }
3411
- return this.formStructure.setFieldError(code, message, type);
3412
- };
3413
- BasicFormComponent.prototype.setFieldIntrinsicErrorMessage = function (code, message) { return this.formStructure.setFieldIntrinsicErrorMessage(code, message); };
3414
- BasicFormComponent.prototype.setFieldOptions = function (fieldCode, optionsArray, idAttribute, nameAttribute) {
3415
- return this.formStructure.setFieldOptions(fieldCode, optionsArray, idAttribute, nameAttribute);
3416
- };
3417
- BasicFormComponent.prototype.getFieldSet = function (filterFunc, fieldArray, sectionCode, subSectionCode) {
3418
- return this.formStructure.getFieldSet(filterFunc, fieldArray, sectionCode, subSectionCode);
3419
- };
3420
- BasicFormComponent.prototype.applyProcessToFieldSet = function (processFunc, fieldArray, sectionCode, subSectionCode) {
3421
- return this.formStructure.applyProcessToFieldSet(processFunc, fieldArray, sectionCode, subSectionCode);
3422
- };
3423
- BasicFormComponent.prototype.applyProcessToAllFields = function (processFunc) { return this.formStructure.applyProcessToFieldSet(processFunc); };
3424
- BasicFormComponent.prototype.cleanFields = function (fieldArray, sectionCode, subSectionCode) {
3425
- return this.formStructure.cleanFields(fieldArray, sectionCode, subSectionCode);
3426
- };
3427
- BasicFormComponent.prototype.getRequiredFields = function (fieldArray, sectionCode, subSectionCode) {
3428
- return this.formStructure.getRequiredFields(fieldArray, sectionCode, subSectionCode);
3429
- };
3430
- BasicFormComponent.prototype.getRequiredEmptyFields = function (fieldArray, sectionCode, subSectionCode) {
3431
- return this.formStructure.getRequiredEmptyFields(fieldArray, sectionCode, subSectionCode);
3432
- };
3433
- BasicFormComponent.prototype.getChangedFields = function (fieldArray, sectionCode, subSectionCode) {
3434
- return this.formStructure.getChangedFields(fieldArray, sectionCode, subSectionCode);
3435
- };
3436
- BasicFormComponent.prototype.getFieldsWithValidationIssues = function (fieldArray, sectionCode, subSectionCode) {
3437
- return this.formStructure.getFieldsWithValidationIssues(fieldArray, sectionCode, subSectionCode);
3438
- };
3439
- BasicFormComponent.prototype.tagFieldsWithError = function (errorMessage, fieldArray, sectionCode, subSectionCode) {
3440
- return this.formStructure.tagFieldsWithError(errorMessage, fieldArray, sectionCode, subSectionCode);
3441
- };
3442
- BasicFormComponent.prototype.cleanErrorFields = function (fieldArray, sectionCode, subSectionCode) {
3443
- return this.formStructure.cleanErrorFields(fieldArray, sectionCode, subSectionCode);
3444
- };
3445
- BasicFormComponent.prototype.showLabelFields = function (fieldArray, sectionCode, subSectionCode) {
3446
- return this.formStructure.showLabelFields(fieldArray, sectionCode, subSectionCode);
3447
- };
3448
- BasicFormComponent.prototype.hideLabelFields = function (fieldArray, sectionCode, subSectionCode) {
3449
- return this.formStructure.hideLabelFields(fieldArray, sectionCode, subSectionCode);
3450
- };
3451
- BasicFormComponent.prototype.enableFields = function (fieldArray, sectionCode, subSectionCode) {
3452
- return this.formStructure.enableFields(fieldArray, sectionCode, subSectionCode);
3453
- };
3454
- BasicFormComponent.prototype.disableFields = function (fieldArray, sectionCode, subSectionCode) {
3455
- return this.formStructure.disableFields(fieldArray, sectionCode, subSectionCode);
3456
- };
3457
- BasicFormComponent.prototype.enableEditFields = function (fieldArray, sectionCode, subSectionCode) {
3458
- return this.formStructure.enableEditFields(fieldArray, sectionCode, subSectionCode);
3459
- };
3460
- BasicFormComponent.prototype.disableEditFields = function (fieldArray, sectionCode, subSectionCode) {
3461
- return this.formStructure.disableEditFields(fieldArray, sectionCode, subSectionCode);
3462
- };
3463
- BasicFormComponent.prototype.showFields = function (fieldArray, sectionCode, subSectionCode) {
3464
- return this.formStructure.showFields(fieldArray, sectionCode, subSectionCode);
3465
- };
3466
- BasicFormComponent.prototype.hideFields = function (fieldArray, sectionCode, subSectionCode) {
3467
- return this.formStructure.hideFields(fieldArray, sectionCode, subSectionCode);
3468
- };
3469
- BasicFormComponent.prototype.getHeaderActions = function () { return this.formStructure.getHeaderActions(); };
3470
- BasicFormComponent.prototype.getActionObject = function (elementId) { return this.formStructure.getActionObject(elementId); };
3471
- BasicFormComponent.prototype.getAction = function (actionCode) { return this.getActionObject(actionCode); };
3472
- BasicFormComponent.prototype.getActionDefinition = function (actionCode) { return this.getActionObject(actionCode); };
3473
- BasicFormComponent.prototype.showAction = function (actionCode) { return this.formStructure.showAction(actionCode); };
3474
- BasicFormComponent.prototype.hideAction = function (actionCode) { return this.formStructure.hideAction(actionCode); };
3475
- BasicFormComponent.prototype.showActions = function (actionArray) { return this.formStructure.showActions(actionArray); };
3476
- BasicFormComponent.prototype.hideActions = function (actionArray) { return this.formStructure.hideActions(actionArray); };
3477
- BasicFormComponent.prototype.enableAction = function (actionCode) { return this.formStructure.enableAction(actionCode); };
3478
- BasicFormComponent.prototype.disableAction = function (actionCode) { return this.formStructure.disableAction(actionCode); };
3479
- BasicFormComponent.prototype.enableActions = function (actionArray) { return this.formStructure.enableActions(actionArray); };
3480
- BasicFormComponent.prototype.disableActions = function (actionArray) { return this.formStructure.disableActions(actionArray); };
3481
- BasicFormComponent.prototype.getStates = function () { return this.formStructure.getStates(); };
3482
- BasicFormComponent.prototype.getSections = function () { return this.formStructure.getSections(); };
3483
3434
  Object.defineProperty(BasicFormComponent.prototype, "visibleSections", {
3484
- get: function () { return this.formStructure.visibleSections; },
3435
+ get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.visibleSections; },
3436
+ enumerable: false,
3437
+ configurable: true
3438
+ });
3439
+ Object.defineProperty(BasicFormComponent.prototype, "formRoute", {
3440
+ get: function () { return this._formRoute; },
3441
+ set: function (route) { this._formRoute = route; },
3442
+ enumerable: false,
3443
+ configurable: true
3444
+ });
3445
+ Object.defineProperty(BasicFormComponent.prototype, "subject", {
3446
+ get: function () { return this.formSubject; },
3485
3447
  enumerable: false,
3486
3448
  configurable: true
3487
3449
  });
3488
- BasicFormComponent.prototype.getSection = function (sectionCode) { return this.formStructure.getSection(sectionCode); };
3489
- BasicFormComponent.prototype.activateSection = function (sectionCode) { return this.formStructure.activateSection(sectionCode); };
3490
- BasicFormComponent.prototype.getSubSection = function (sectionCode, subsectionCode) { return this.formStructure.getSubSection(sectionCode, subsectionCode); };
3491
- BasicFormComponent.prototype.numSections = function () { return this.formStructure.numSections(); };
3492
- BasicFormComponent.prototype.getSectionsTitles = function () { return this.formStructure.getSectionsTitles(); };
3493
- BasicFormComponent.prototype.getSectionObject = function (elementId) { return this.formStructure.getSectionObject(elementId); };
3494
- BasicFormComponent.prototype.showSection = function (sectionCode) { return this.formStructure.showSection(sectionCode); };
3495
- BasicFormComponent.prototype.hideSection = function (sectionCode) { return this.formStructure.hideSection(sectionCode); };
3496
- BasicFormComponent.prototype.showSections = function (sectionArray) { return this.formStructure.showSections(sectionArray); };
3497
- BasicFormComponent.prototype.hideSections = function (sectionArray) { return this.formStructure.hideSections(sectionArray); };
3498
- BasicFormComponent.prototype.showSubSection = function (sectionCode, subSectionCode) { return this.formStructure.showSubSection(sectionCode, subSectionCode); };
3499
- BasicFormComponent.prototype.hideSubSection = function (sectionCode, subSectionCode) { return this.formStructure.hideSubSection(sectionCode, subSectionCode); };
3500
- BasicFormComponent.prototype.showSubSections = function (sectionCode, subSectionArray) { return this.formStructure.showSubSections(sectionCode, subSectionArray); };
3501
- BasicFormComponent.prototype.hideSubSections = function (sectionCode, subSectionArray) { return this.formStructure.hideSubSections(sectionCode, subSectionArray); };
3502
- BasicFormComponent.prototype.getTables = function () { return this.formStructure.getTables(); };
3503
- BasicFormComponent.prototype.getTableObject = function (elementId) { return this.formStructure.getTableObject(elementId); };
3504
- BasicFormComponent.prototype.getTable = function (tableName) { return this.getTableObject(tableName); };
3505
- BasicFormComponent.prototype.showTable = function (tableName) { return this.formStructure.showTable(tableName); };
3506
- BasicFormComponent.prototype.hideTable = function (tableName) { return this.formStructure.hideTable(tableName); };
3507
- BasicFormComponent.prototype.showTables = function (tableArray) { return this.formStructure.showTables(tableArray); };
3508
- BasicFormComponent.prototype.hideTables = function (tableArray) { return this.formStructure.hideTables(tableArray); };
3509
- BasicFormComponent.prototype.cleanTable = function (tableName) { return this.formStructure.cleanTable(tableName); };
3510
- BasicFormComponent.prototype.getTableRecord = function (tableName, recordId) { return this.formStructure.getTableRecord(tableName, recordId); };
3450
+ // Métodos virtuales
3511
3451
  BasicFormComponent.prototype.customPreProcessing = function () { };
3512
3452
  BasicFormComponent.prototype.customFormStart = function () { };
3513
3453
  BasicFormComponent.prototype.displayActionServerError = function () { };
@@ -3516,6 +3456,43 @@
3516
3456
  BasicFormComponent.prototype.showFieldInfo = function (fieldCode) { };
3517
3457
  BasicFormComponent.prototype.showModalDialog = function (title, body, options, callback, params) { };
3518
3458
  BasicFormComponent.prototype.openUploadDialog = function (title, body, options, callback, params) { };
3459
+ /**
3460
+ * @deprecated Use supportState
3461
+ */
3462
+ BasicFormComponent.prototype.supportMode = function (state) { return this.supportState(state); };
3463
+ /**
3464
+ * @deprecated Use getField
3465
+ */
3466
+ BasicFormComponent.prototype.getFieldObject = function (code) { return this.getField(code); };
3467
+ /**
3468
+ * @deprecated Use getAction
3469
+ */
3470
+ BasicFormComponent.prototype.getActionObject = function (code) { return this.getAction(code); };
3471
+ /**
3472
+ * @deprecated Use getTable
3473
+ */
3474
+ BasicFormComponent.prototype.getTableObject = function (code) { return this.getTable(code); };
3475
+ /**
3476
+ * @deprecated Use getSection
3477
+ */
3478
+ BasicFormComponent.prototype.getSectionObject = function (code) { return this.getSection(code); };
3479
+ /**
3480
+ * @deprecated Use changeState
3481
+ */
3482
+ BasicFormComponent.prototype.changeFormMode = function (state) { return this.changeState(state); };
3483
+ /**
3484
+ * @deprecated Use subject
3485
+ */
3486
+ BasicFormComponent.prototype.getFormSubject = function () { return this.subject; };
3487
+ /**
3488
+ * @deprecated Use subject
3489
+ */
3490
+ BasicFormComponent.prototype.getSubject = function () { return this.formSubject; };
3491
+ /**
3492
+ * @deprecated Use subject
3493
+ */
3494
+ BasicFormComponent.prototype.getformSubject = function () { return this.getSubject(); };
3495
+ BasicFormComponent.prototype.numSections = function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.sections.length; };
3519
3496
  BasicFormComponent.prototype.subscribeAppEvent = function (eventName, callback) {
3520
3497
  this._eventEmiter.subscribe(eventName, callback);
3521
3498
  };
@@ -3526,7 +3503,7 @@
3526
3503
  var _a, _b, _c, _d, _e, _f, _g, _h;
3527
3504
  var origin = null;
3528
3505
  if (!cleanStack) {
3529
- origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this.controlToken });
3506
+ origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this._controlToken });
3530
3507
  origin.subject = (_a = origin === null || origin === void 0 ? void 0 : origin.subject) !== null && _a !== void 0 ? _a : this.formSubject;
3531
3508
  origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.currentState;
3532
3509
  origin.fields = (_c = origin === null || origin === void 0 ? void 0 : origin.fields) !== null && _c !== void 0 ? _c : {};
@@ -3539,62 +3516,40 @@
3539
3516
  target.extra = (_h = target === null || target === void 0 ? void 0 : target.extra) !== null && _h !== void 0 ? _h : {};
3540
3517
  this.formManagerService.openForm(origin, target);
3541
3518
  };
3542
- BasicFormComponent.prototype.canGoBack = function () { return this.originToken !== null; };
3519
+ BasicFormComponent.prototype.canGoBack = function () { return this._originToken !== null; };
3543
3520
  BasicFormComponent.prototype.goBack = function () { return this.formManagerService.backTo(); };
3544
3521
  BasicFormComponent.prototype.goBackForm = function () { return this.goBack(); };
3545
- BasicFormComponent.prototype.getOriginDetail = function () { return this.formManagerService.getFormInfo(this.originToken); };
3522
+ BasicFormComponent.prototype.getOriginDetail = function () { return this.formManagerService.getFormInfo(this._originToken); };
3546
3523
  BasicFormComponent.prototype.setError = function (errorType, errorMessage, errorDetail) {
3547
3524
  this._errorType = errorType || '';
3548
3525
  this.errorMessage = errorMessage || '';
3549
3526
  this.errorDetail = errorDetail || '';
3550
3527
  };
3551
- Object.defineProperty(BasicFormComponent.prototype, "formManager", {
3552
- get: function () { return this; },
3553
- enumerable: false,
3554
- configurable: true
3555
- });
3556
3528
  BasicFormComponent.prototype.resetError = function () { this.setError(null, null, null); };
3557
3529
  BasicFormComponent.prototype.getErrorType = function () { return this._errorType; };
3558
3530
  BasicFormComponent.prototype.getErrorMessage = function () { return this.errorMessage; };
3559
3531
  BasicFormComponent.prototype.getErrorDetail = function () { return this.errorDetail; };
3560
3532
  BasicFormComponent.prototype.getErrorCode = function () { return this._errorType; };
3561
- Object.defineProperty(BasicFormComponent.prototype, "formRoute", {
3562
- get: function () { return this._formRoute; },
3563
- set: function (route) { this._formRoute = route; },
3564
- enumerable: false,
3565
- configurable: true
3566
- });
3567
- BasicFormComponent.prototype.defineFormCode = function (name) { this.name = name; };
3568
- BasicFormComponent.prototype.getCurrentState = function () { return this.formStructure.state; };
3569
- BasicFormComponent.prototype.getCurrentMode = function () { return this.formStructure.state; };
3570
- Object.defineProperty(BasicFormComponent.prototype, "formCode", {
3571
- get: function () { return this.name; },
3572
- set: function (name) { this.name = name; },
3573
- enumerable: false,
3574
- configurable: true
3575
- });
3576
3533
  BasicFormComponent.prototype.getFormParameter = function (name) {
3577
3534
  var _a, _b;
3578
3535
  return (name) ? ((_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null) : null;
3579
3536
  };
3580
- BasicFormComponent.prototype.getSubject = function () { return this.formSubject; };
3581
- BasicFormComponent.prototype.getformSubject = function () { return this.getSubject(); };
3582
3537
  BasicFormComponent.prototype.preocessInputParams = function (params) {
3583
3538
  var _a, _b, _c;
3584
- this.controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
3585
- var _j = this.formManagerService.getFormInfo(this.controlToken), token = _j.token, subject = _j.subject, state = _j.state, fields = _j.fields, extra = _j.extra, originToken = _j.originToken;
3586
- if (!this.controlToken || this.controlToken !== token) {
3587
- return;
3539
+ this._controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
3540
+ var _j = this.formManagerService.getFormInfo(this._controlToken), token = _j.token, subject = _j.subject, state = _j.state, fields = _j.fields, extra = _j.extra, originToken = _j.originToken;
3541
+ if (!this._controlToken || this._controlToken !== token) {
3542
+ return null;
3588
3543
  }
3589
3544
  this.formSubject = (_c = (_b = params === null || params === void 0 ? void 0 : params[SUBJECT]) !== null && _b !== void 0 ? _b : subject) !== null && _c !== void 0 ? _c : null;
3590
3545
  this.inputDataFields = fields;
3591
3546
  this.extraData = extra;
3592
- this.originToken = originToken;
3547
+ this._originToken = originToken;
3593
3548
  return state;
3594
3549
  };
3595
3550
  BasicFormComponent.prototype.subscribeSectionActivation = function () {
3596
3551
  var _this = this;
3597
- var formSections = this.formStructure.getSections();
3552
+ var formSections = this._formStructure.sections;
3598
3553
  if (Array.isArray(formSections)) {
3599
3554
  formSections.forEach(function (section) {
3600
3555
  section.activation.subscribe(function (code) { return _this.launchSectionActivation(code); });
@@ -3604,7 +3559,7 @@
3604
3559
  };
3605
3560
  BasicFormComponent.prototype.subscribeFieldsSubjects = function () {
3606
3561
  var _this = this;
3607
- var formFields = this.formStructure.getFields();
3562
+ var formFields = this._formStructure.getFields();
3608
3563
  if (Array.isArray(formFields)) {
3609
3564
  formFields.forEach(function (field) {
3610
3565
  field.editionFinish.subscribe(function (event) {
@@ -3621,7 +3576,7 @@
3621
3576
  };
3622
3577
  BasicFormComponent.prototype.subscribeActionSubjects = function () {
3623
3578
  var _this = this;
3624
- var formActions = this.formStructure.getActions();
3579
+ var formActions = this._formStructure.getActions();
3625
3580
  if (Array.isArray(formActions)) {
3626
3581
  formActions.forEach(function (action) {
3627
3582
  action.actionActivated.subscribe(function (code) { return _this.startAction(code); });
@@ -3630,7 +3585,7 @@
3630
3585
  };
3631
3586
  BasicFormComponent.prototype.subscribeTableSubjects = function () {
3632
3587
  var _this = this;
3633
- var formTables = this.formStructure.getTables();
3588
+ var formTables = this._formStructure.getTables();
3634
3589
  if (Array.isArray(formTables)) {
3635
3590
  formTables.forEach(function (table) {
3636
3591
  table.inlineActionTrigger.subscribe(function (event) { return _this.startTableAction(event); });
@@ -3651,25 +3606,25 @@
3651
3606
  if (!this.name) {
3652
3607
  return [2 /*return*/];
3653
3608
  }
3654
- if (!!this.definitionObtained) return [3 /*break*/, 2];
3609
+ if (!!this._definitionObtained) return [3 /*break*/, 2];
3655
3610
  this.busy = true;
3656
3611
  return [4 /*yield*/, this.formManagerService.getFormDefinition(this.name)];
3657
3612
  case 1:
3658
3613
  formDefinition = _j.sent();
3659
3614
  this.busy = false;
3660
- this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
3661
- this.fields = this.formStructure.fields;
3662
- this.actions = this.formStructure.actions;
3663
- this.definitionObtained = true;
3615
+ this._formStructure = new FormStructureAndData(formDefinition, this.formConfig);
3616
+ this.fields = this._formStructure.fields;
3617
+ this.actions = this._formStructure.actions;
3618
+ this._definitionObtained = true;
3664
3619
  return [3 /*break*/, 3];
3665
3620
  case 2:
3666
3621
  this.cleanData();
3667
3622
  _j.label = 3;
3668
3623
  case 3:
3669
3624
  if (!this.supportState(initialState)) {
3670
- initialState = this.formStructure.defaultState;
3625
+ initialState = this._formStructure.defaultState;
3671
3626
  }
3672
- this.formStructure.changeState(initialState || this.formStructure.defaultState);
3627
+ this._formStructure.changeState(initialState || this._formStructure.defaultState);
3673
3628
  inputFieldNames = Object.keys(this.inputDataFields);
3674
3629
  for (index = 0; index < inputFieldNames.length; index++) {
3675
3630
  fieldCode = inputFieldNames[index];
@@ -3680,7 +3635,7 @@
3680
3635
  case 4:
3681
3636
  recordResponse = _j.sent();
3682
3637
  this.checkErrorRecordReceived(recordResponse);
3683
- this.formVisible = true;
3638
+ this.visible = true;
3684
3639
  this.subscribeSectionActivation();
3685
3640
  this.subscribeFieldsSubjects();
3686
3641
  this.subscribeActionSubjects();
@@ -3699,12 +3654,14 @@
3699
3654
  this.errorCode = recordResponse.errorCode;
3700
3655
  this.errorMessage = recordResponse.errorMessage;
3701
3656
  this.errorDetail = recordResponse.errorDetail;
3657
+ return true;
3702
3658
  };
3703
3659
  BasicFormComponent.prototype.errorOccured = function () {
3704
3660
  return (this.errorCode !== NO_ERROR);
3705
3661
  };
3706
- BasicFormComponent.prototype.changeState = function (state) { return this.formStructure.changeState(state); };
3707
- BasicFormComponent.prototype.changeFormMode = function (state) { return this.changeState(state); };
3662
+ /**
3663
+ * Soporte manejo de eventos de formulario
3664
+ */
3708
3665
  BasicFormComponent.prototype.requestFormAction = function (actionCode, actionSubject) {
3709
3666
  if (actionSubject === void 0) { actionSubject = {}; }
3710
3667
  return __awaiter(this, void 0, void 0, function () {
@@ -3715,12 +3672,12 @@
3715
3672
  actionDetail = {
3716
3673
  formCode: this.name,
3717
3674
  formSubject: this.formSubject,
3718
- currentMode: this.formStructure.state,
3675
+ currentMode: this._formStructure.state,
3719
3676
  actionCode: actionCode,
3720
3677
  actionSubject: actionSubject,
3721
3678
  version: PAYLOAD_VERSION,
3722
- formData: this.formStructure.getPayload(),
3723
- immutableData: this.formStructure.immutableData,
3679
+ formData: this._formStructure.getPayload(),
3680
+ immutableData: this._formStructure.immutableData,
3724
3681
  };
3725
3682
  this.errorCode = NO_ERROR;
3726
3683
  this.errorMessage = '';
@@ -3757,7 +3714,7 @@
3757
3714
  try {
3758
3715
  for (var actions_1 = __values(actions), actions_1_1 = actions_1.next(); !actions_1_1.done; actions_1_1 = actions_1.next()) {
3759
3716
  var changedAction = actions_1_1.value;
3760
- var actionObject = this.getActionObject(changedAction.actionCode);
3717
+ var actionObject = this.getAction(changedAction.actionCode);
3761
3718
  if (actionObject) {
3762
3719
  actionObject.updateFromServer(changedAction);
3763
3720
  }
@@ -3775,7 +3732,7 @@
3775
3732
  try {
3776
3733
  for (var fields_1 = __values(fields), fields_1_1 = fields_1.next(); !fields_1_1.done; fields_1_1 = fields_1.next()) {
3777
3734
  var changedField = fields_1_1.value;
3778
- var fieldObject = this.getFieldObject(changedField.fieldCode);
3735
+ var fieldObject = this.getField(changedField.fieldCode);
3779
3736
  if (fieldObject) {
3780
3737
  fieldObject.updateFromServer(changedField);
3781
3738
  }
@@ -3793,7 +3750,7 @@
3793
3750
  try {
3794
3751
  for (var recordTables_1 = __values(recordTables), recordTables_1_1 = recordTables_1.next(); !recordTables_1_1.done; recordTables_1_1 = recordTables_1.next()) {
3795
3752
  var changedTable = recordTables_1_1.value;
3796
- var tableObject = this.getTableObject(changedTable.tableCode);
3753
+ var tableObject = this.getTable(changedTable.tableCode);
3797
3754
  if (tableObject) {
3798
3755
  tableObject.updateFromServer(changedTable);
3799
3756
  }
@@ -3810,62 +3767,62 @@
3810
3767
  if (returnedFile && returnedFile.file) {
3811
3768
  this.fileMgmtServices.saveFile(returnedFile.file, returnedFile.name, returnedFile.type);
3812
3769
  }
3813
- this.formStructure.immutableData = immutableData;
3814
- this.formStructure.extraInfo = extraInfo;
3770
+ this._formStructure.immutableData = immutableData;
3771
+ this._formStructure.extraInfo = extraInfo;
3815
3772
  };
3816
3773
  /**
3817
3774
  * Manejo de event handlers para acciones sobre el formulario
3818
3775
  */
3819
- BasicFormComponent.prototype.addSectionActivation = function (sections, callbackMethod) {
3776
+ BasicFormComponent.prototype.addSectionActivation = function (sectionCodes, callbackMethod) {
3820
3777
  var _this = this;
3821
- var sectionSet = (Array.isArray(sections)) ? sections : [sections];
3778
+ var sectionSet = (Array.isArray(sectionCodes)) ? sectionCodes : [sectionCodes];
3822
3779
  sectionSet.forEach(function (sectionName) {
3823
- if (!_this.formSectionsActivate[sectionName]) {
3824
- _this.formSectionsActivate[sectionName] = [];
3780
+ if (!_this._formSectionsActivate[sectionName]) {
3781
+ _this._formSectionsActivate[sectionName] = [];
3825
3782
  }
3826
- _this.formSectionsActivate[sectionName].push(callbackMethod);
3783
+ _this._formSectionsActivate[sectionName].push(callbackMethod);
3827
3784
  });
3828
3785
  };
3829
- BasicFormComponent.prototype.addSectionInactivation = function (sections, callbackMethod) {
3786
+ BasicFormComponent.prototype.addSectionInactivation = function (sectionCodes, callbackMethod) {
3830
3787
  var _this = this;
3831
- var sectionSet = (Array.isArray(sections)) ? sections : [sections];
3788
+ var sectionSet = (Array.isArray(sectionCodes)) ? sectionCodes : [sectionCodes];
3832
3789
  sectionSet.forEach(function (sectionName) {
3833
- if (!_this.formSectionsInactivate[sectionName]) {
3834
- _this.formSectionsInactivate[sectionName] = [];
3790
+ if (!_this._formSectionsInactivate[sectionName]) {
3791
+ _this._formSectionsInactivate[sectionName] = [];
3835
3792
  }
3836
- _this.formSectionsInactivate[sectionName].push(callbackMethod);
3793
+ _this._formSectionsInactivate[sectionName].push(callbackMethod);
3837
3794
  });
3838
3795
  };
3839
3796
  BasicFormComponent.prototype.addActionMethodStart = function (actions, callbackMethod) {
3840
3797
  var _this = this;
3841
3798
  var actionSet = (Array.isArray(actions)) ? actions : [actions];
3842
3799
  actionSet.forEach(function (actionName) {
3843
- if (!_this.formActionsStart[actionName]) {
3844
- _this.formActionsStart[actionName] = [];
3800
+ if (!_this._formActionsStart[actionName]) {
3801
+ _this._formActionsStart[actionName] = [];
3845
3802
  }
3846
- _this.formActionsStart[actionName].push(callbackMethod);
3803
+ _this._formActionsStart[actionName].push(callbackMethod);
3847
3804
  });
3848
3805
  };
3849
3806
  BasicFormComponent.prototype.addActionMethodFinish = function (actions, callbackMethod) {
3850
3807
  var _this = this;
3851
3808
  var actionSet = (Array.isArray(actions)) ? actions : [actions];
3852
3809
  actionSet.forEach(function (actionName) {
3853
- if (!_this.formActionsFinish[actionName]) {
3854
- _this.formActionsFinish[actionName] = [];
3810
+ if (!_this._formActionsFinish[actionName]) {
3811
+ _this._formActionsFinish[actionName] = [];
3855
3812
  }
3856
- _this.formActionsFinish[actionName].push(callbackMethod);
3813
+ _this._formActionsFinish[actionName].push(callbackMethod);
3857
3814
  });
3858
3815
  };
3859
- BasicFormComponent.prototype.launchSectionActivation = function (sectionCode) {
3816
+ BasicFormComponent.prototype.launchSectionActivation = function (code) {
3860
3817
  return __awaiter(this, void 0, void 0, function () {
3861
3818
  var sectionObject, clientSectionMethods, clientSectionMethods_1, clientSectionMethods_1_1, clientSectionMethod;
3862
3819
  var e_4, _j;
3863
3820
  return __generator(this, function (_k) {
3864
- sectionObject = this.formStructure.getSectionObject(sectionCode);
3821
+ sectionObject = this._formStructure.getSection(code);
3865
3822
  if (!sectionObject) {
3866
3823
  return [2 /*return*/];
3867
3824
  }
3868
- clientSectionMethods = this.formSectionsActivate[sectionCode];
3825
+ clientSectionMethods = this._formSectionsActivate[code];
3869
3826
  if (clientSectionMethods) {
3870
3827
  try {
3871
3828
  for (clientSectionMethods_1 = __values(clientSectionMethods), clientSectionMethods_1_1 = clientSectionMethods_1.next(); !clientSectionMethods_1_1.done; clientSectionMethods_1_1 = clientSectionMethods_1.next()) {
@@ -3885,16 +3842,16 @@
3885
3842
  });
3886
3843
  });
3887
3844
  };
3888
- BasicFormComponent.prototype.launchSectionInactivation = function (sectionCode) {
3845
+ BasicFormComponent.prototype.launchSectionInactivation = function (code) {
3889
3846
  return __awaiter(this, void 0, void 0, function () {
3890
3847
  var sectionObject, clientSectionMethods, clientSectionMethods_2, clientSectionMethods_2_1, clientSectionMethod;
3891
3848
  var e_5, _j;
3892
3849
  return __generator(this, function (_k) {
3893
- sectionObject = this.formStructure.getSectionObject(sectionCode);
3850
+ sectionObject = this._formStructure.getSection(code);
3894
3851
  if (!sectionObject) {
3895
3852
  return [2 /*return*/];
3896
3853
  }
3897
- clientSectionMethods = this.formSectionsInactivate[sectionCode];
3854
+ clientSectionMethods = this._formSectionsInactivate[code];
3898
3855
  if (clientSectionMethods) {
3899
3856
  try {
3900
3857
  for (clientSectionMethods_2 = __values(clientSectionMethods), clientSectionMethods_2_1 = clientSectionMethods_2.next(); !clientSectionMethods_2_1.done; clientSectionMethods_2_1 = clientSectionMethods_2.next()) {
@@ -3914,20 +3871,20 @@
3914
3871
  });
3915
3872
  });
3916
3873
  };
3917
- BasicFormComponent.prototype.startAction = function (actionCode) {
3874
+ BasicFormComponent.prototype.startAction = function (code) {
3918
3875
  return __awaiter(this, void 0, void 0, function () {
3919
3876
  var actionObject, clientActionMethods, clientActionPromises, clientActionMethods_1, clientActionMethods_1_1, clientActionMethod, continueActionPromise, clientActionResults, continueAction;
3920
3877
  var e_6, _j;
3921
3878
  return __generator(this, function (_k) {
3922
3879
  switch (_k.label) {
3923
3880
  case 0:
3924
- actionObject = this.getAction(actionCode);
3881
+ actionObject = this.getAction(code);
3925
3882
  if (!actionObject) {
3926
3883
  return [2 /*return*/];
3927
3884
  }
3928
3885
  this.resetError();
3929
3886
  actionObject.start();
3930
- clientActionMethods = this.formActionsStart[actionCode];
3887
+ clientActionMethods = this._formActionsStart[code];
3931
3888
  if (!clientActionMethods) return [3 /*break*/, 2];
3932
3889
  clientActionPromises = [];
3933
3890
  try {
@@ -3993,20 +3950,20 @@
3993
3950
  });
3994
3951
  });
3995
3952
  };
3996
- BasicFormComponent.prototype.finishAction = function (actionObject, actionResult) {
3953
+ BasicFormComponent.prototype.finishAction = function (action, actionResult) {
3997
3954
  return __awaiter(this, void 0, void 0, function () {
3998
3955
  var finishActionMethods, clientActionPromises, finishActionMethods_1, finishActionMethods_1_1, clientActionMethod;
3999
3956
  var e_7, _j;
4000
3957
  return __generator(this, function (_k) {
4001
3958
  switch (_k.label) {
4002
3959
  case 0:
4003
- finishActionMethods = this.formActionsFinish[actionObject.actionCode];
3960
+ finishActionMethods = this._formActionsFinish[action.actionCode];
4004
3961
  if (!finishActionMethods) return [3 /*break*/, 2];
4005
3962
  clientActionPromises = [];
4006
3963
  try {
4007
3964
  for (finishActionMethods_1 = __values(finishActionMethods), finishActionMethods_1_1 = finishActionMethods_1.next(); !finishActionMethods_1_1.done; finishActionMethods_1_1 = finishActionMethods_1.next()) {
4008
3965
  clientActionMethod = finishActionMethods_1_1.value;
4009
- clientActionPromises.push(clientActionMethod(actionObject, actionResult));
3966
+ clientActionPromises.push(clientActionMethod(action, actionResult));
4010
3967
  }
4011
3968
  }
4012
3969
  catch (e_7_1) { e_7 = { error: e_7_1 }; }
@@ -4025,8 +3982,8 @@
4025
3982
  });
4026
3983
  });
4027
3984
  };
4028
- BasicFormComponent.prototype.completeGlobalAction = function (actionObject) {
4029
- return this.startServerAction(actionObject);
3985
+ BasicFormComponent.prototype.completeGlobalAction = function (action) {
3986
+ return this.startServerAction(action);
4030
3987
  };
4031
3988
  /**
4032
3989
  * Manejadores de eventos para validaciones sobre campos
@@ -4035,30 +3992,30 @@
4035
3992
  var _this = this;
4036
3993
  var fieldSet = (Array.isArray(fields)) ? fields : [fields];
4037
3994
  fieldSet.forEach(function (fieldCode) {
4038
- if (!_this.fieldInputValidation[fieldCode]) {
4039
- _this.fieldInputValidation[fieldCode] = [];
3995
+ if (!_this._fieldInputValidation[fieldCode]) {
3996
+ _this._fieldInputValidation[fieldCode] = [];
4040
3997
  }
4041
- _this.fieldInputValidation[fieldCode].push(callbackMethod);
3998
+ _this._fieldInputValidation[fieldCode].push(callbackMethod);
4042
3999
  });
4043
4000
  };
4044
4001
  BasicFormComponent.prototype.addFieldValidationStart = function (fields, callbackMethod) {
4045
4002
  var _this = this;
4046
4003
  var fieldSet = (Array.isArray(fields)) ? fields : [fields];
4047
4004
  fieldSet.forEach(function (fieldCode) {
4048
- if (!_this.fieldValidationsStart[fieldCode]) {
4049
- _this.fieldValidationsStart[fieldCode] = [];
4005
+ if (!_this._fieldValidationsStart[fieldCode]) {
4006
+ _this._fieldValidationsStart[fieldCode] = [];
4050
4007
  }
4051
- _this.fieldValidationsStart[fieldCode].push(callbackMethod);
4008
+ _this._fieldValidationsStart[fieldCode].push(callbackMethod);
4052
4009
  });
4053
4010
  };
4054
4011
  BasicFormComponent.prototype.addFieldValidationFinish = function (fields, callbackMethod) {
4055
4012
  var _this = this;
4056
4013
  var fieldSet = (Array.isArray(fields)) ? fields : [fields];
4057
4014
  fieldSet.forEach(function (fieldCode) {
4058
- if (!_this.fieldValidationsFinish[fieldCode]) {
4059
- _this.fieldValidationsFinish[fieldCode] = [];
4015
+ if (!_this._fieldValidationsFinish[fieldCode]) {
4016
+ _this._fieldValidationsFinish[fieldCode] = [];
4060
4017
  }
4061
- _this.fieldValidationsFinish[fieldCode].push(callbackMethod);
4018
+ _this._fieldValidationsFinish[fieldCode].push(callbackMethod);
4062
4019
  });
4063
4020
  };
4064
4021
  BasicFormComponent.prototype.startFieldInputValidation = function (fieldCode, intrinsicValidation) {
@@ -4069,12 +4026,12 @@
4069
4026
  return __generator(this, function (_k) {
4070
4027
  switch (_k.label) {
4071
4028
  case 0:
4072
- fieldToValidate = this.getFieldObject(fieldCode);
4029
+ fieldToValidate = this.getField(fieldCode);
4073
4030
  if (!fieldToValidate) {
4074
4031
  return [2 /*return*/, false];
4075
4032
  }
4076
4033
  fieldToValidate.resetError();
4077
- validationCallbacks = this.fieldInputValidation[fieldCode];
4034
+ validationCallbacks = this._fieldInputValidation[fieldCode];
4078
4035
  if (!validationCallbacks) return [3 /*break*/, 2];
4079
4036
  clientValidationPromises = [];
4080
4037
  try {
@@ -4113,7 +4070,7 @@
4113
4070
  return [2 /*return*/];
4114
4071
  }
4115
4072
  fieldToValidate.resetError();
4116
- validationCallbacks = this.fieldValidationsStart[fieldCode];
4073
+ validationCallbacks = this._fieldValidationsStart[fieldCode];
4117
4074
  if (!validationCallbacks) return [3 /*break*/, 2];
4118
4075
  clientValidationPromises = [];
4119
4076
  try {
@@ -4188,7 +4145,7 @@
4188
4145
  return __generator(this, function (_k) {
4189
4146
  switch (_k.label) {
4190
4147
  case 0:
4191
- validationCallbacks = this.fieldValidationsFinish[fieldObject.fieldCode];
4148
+ validationCallbacks = this._fieldValidationsFinish[fieldObject.fieldCode];
4192
4149
  if (!validationCallbacks) return [3 /*break*/, 2];
4193
4150
  clientActionPromises = [];
4194
4151
  try {
@@ -4228,17 +4185,17 @@
4228
4185
  if (!tableObject) {
4229
4186
  return;
4230
4187
  }
4231
- var inlineActionObject = tableObject.getActionObject(actionCode);
4188
+ var inlineActionObject = tableObject.getAction(actionCode);
4232
4189
  if (!inlineActionObject) {
4233
4190
  return;
4234
4191
  }
4235
4192
  var tableEventHandlers = null;
4236
- if (this.tableActionsStart[tableName]) {
4237
- tableEventHandlers = this.tableActionsStart[tableName];
4193
+ if (this._tableActionsStart[tableName]) {
4194
+ tableEventHandlers = this._tableActionsStart[tableName];
4238
4195
  }
4239
4196
  else {
4240
4197
  tableEventHandlers = {};
4241
- this.tableActionsStart[tableName] = tableEventHandlers;
4198
+ this._tableActionsStart[tableName] = tableEventHandlers;
4242
4199
  }
4243
4200
  if (!tableEventHandlers[actionCode]) {
4244
4201
  tableEventHandlers[actionCode] = [];
@@ -4250,17 +4207,17 @@
4250
4207
  if (!tableObject) {
4251
4208
  return;
4252
4209
  }
4253
- var inlineActionObject = tableObject.getActionObject(actionCode);
4210
+ var inlineActionObject = tableObject.getAction(actionCode);
4254
4211
  if (!inlineActionObject) {
4255
4212
  return;
4256
4213
  }
4257
4214
  var tableEventHandlers = null;
4258
- if (this.tableActionsFinish[tableName]) {
4259
- tableEventHandlers = this.tableActionsFinish[tableName];
4215
+ if (this._tableActionsFinish[tableName]) {
4216
+ tableEventHandlers = this._tableActionsFinish[tableName];
4260
4217
  }
4261
4218
  else {
4262
4219
  tableEventHandlers = {};
4263
- this.tableActionsFinish[tableName] = tableEventHandlers;
4220
+ this._tableActionsFinish[tableName] = tableEventHandlers;
4264
4221
  }
4265
4222
  if (!tableEventHandlers[actionCode]) {
4266
4223
  tableEventHandlers[actionCode] = [];
@@ -4273,12 +4230,12 @@
4273
4230
  return;
4274
4231
  }
4275
4232
  var tableEventHandlers = null;
4276
- if (this.tableSelectionsStart[tableName]) {
4277
- tableEventHandlers = this.tableSelectionsStart[tableName];
4233
+ if (this._tableSelectionsStart[tableName]) {
4234
+ tableEventHandlers = this._tableSelectionsStart[tableName];
4278
4235
  }
4279
4236
  else {
4280
4237
  tableEventHandlers = [];
4281
- this.tableSelectionsStart[tableName] = tableEventHandlers;
4238
+ this._tableSelectionsStart[tableName] = tableEventHandlers;
4282
4239
  }
4283
4240
  tableEventHandlers.push(callbackMethod);
4284
4241
  };
@@ -4288,12 +4245,12 @@
4288
4245
  return;
4289
4246
  }
4290
4247
  var tableEventHandlers = null;
4291
- if (this.tableSelectionsFinish[tableName]) {
4292
- tableEventHandlers = this.tableSelectionsFinish[tableName];
4248
+ if (this._tableSelectionsFinish[tableName]) {
4249
+ tableEventHandlers = this._tableSelectionsFinish[tableName];
4293
4250
  }
4294
4251
  else {
4295
4252
  tableEventHandlers = [];
4296
- this.tableSelectionsFinish[tableName] = tableEventHandlers;
4253
+ this._tableSelectionsFinish[tableName] = tableEventHandlers;
4297
4254
  }
4298
4255
  tableEventHandlers.push(callbackMethod);
4299
4256
  };
@@ -4303,12 +4260,12 @@
4303
4260
  return;
4304
4261
  }
4305
4262
  var tableEventHandlers = null;
4306
- if (this.tableGetDataStart[tableName]) {
4307
- tableEventHandlers = this.tableGetDataStart[tableName];
4263
+ if (this._tableGetDataStart[tableName]) {
4264
+ tableEventHandlers = this._tableGetDataStart[tableName];
4308
4265
  }
4309
4266
  else {
4310
4267
  tableEventHandlers = [];
4311
- this.tableGetDataStart[tableName] = tableEventHandlers;
4268
+ this._tableGetDataStart[tableName] = tableEventHandlers;
4312
4269
  }
4313
4270
  tableEventHandlers.push(callbackMethod);
4314
4271
  };
@@ -4318,12 +4275,12 @@
4318
4275
  return;
4319
4276
  }
4320
4277
  var tableEventHandlers = null;
4321
- if (this.tableGetDataFinish[tableName]) {
4322
- tableEventHandlers = this.tableGetDataFinish[tableName];
4278
+ if (this._tableGetDataFinish[tableName]) {
4279
+ tableEventHandlers = this._tableGetDataFinish[tableName];
4323
4280
  }
4324
4281
  else {
4325
4282
  tableEventHandlers = {};
4326
- this.tableGetDataFinish[tableName] = tableEventHandlers;
4283
+ this._tableGetDataFinish[tableName] = tableEventHandlers;
4327
4284
  }
4328
4285
  tableEventHandlers[GET_DATA_ACTION] = callbackMethod;
4329
4286
  };
@@ -4350,7 +4307,7 @@
4350
4307
  tableCode: tableCode,
4351
4308
  actionCode: actionCode,
4352
4309
  };
4353
- tableEventHandlers = this.tableActionsStart[tableCode];
4310
+ tableEventHandlers = this._tableActionsStart[tableCode];
4354
4311
  tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
4355
4312
  if (!tableActionMethods) return [3 /*break*/, 2];
4356
4313
  clientActionPromises = [];
@@ -4433,7 +4390,7 @@
4433
4390
  switch (_k.label) {
4434
4391
  case 0:
4435
4392
  tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode;
4436
- tableEventHandlers = this.tableActionsFinish[tableCode];
4393
+ tableEventHandlers = this._tableActionsFinish[tableCode];
4437
4394
  tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
4438
4395
  if (!tableActionMethods) return [3 /*break*/, 2];
4439
4396
  clientActionPromises = [];
@@ -4485,7 +4442,7 @@
4485
4442
  recordId: recordId,
4486
4443
  recordData: recordData
4487
4444
  };
4488
- tableEventHandlers = this.tableActionsStart[tableCode];
4445
+ tableEventHandlers = this._tableActionsStart[tableCode];
4489
4446
  tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
4490
4447
  if (!tableActionMethods) return [3 /*break*/, 2];
4491
4448
  clientActionPromises = [];
@@ -4570,7 +4527,7 @@
4570
4527
  switch (_k.label) {
4571
4528
  case 0:
4572
4529
  tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode;
4573
- tableEventHandlers = this.tableActionsFinish[tableCode];
4530
+ tableEventHandlers = this._tableActionsFinish[tableCode];
4574
4531
  tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
4575
4532
  if (!tableActionMethods) return [3 /*break*/, 2];
4576
4533
  clientActionPromises = [];
@@ -4616,7 +4573,7 @@
4616
4573
  recordId: recordId,
4617
4574
  recordData: recordData
4618
4575
  };
4619
- tableEventHandlers = this.tableSelectionsStart[tableCode];
4576
+ tableEventHandlers = this._tableSelectionsStart[tableCode];
4620
4577
  if (!tableEventHandlers) return [3 /*break*/, 2];
4621
4578
  clientActionPromises = [];
4622
4579
  try {
@@ -4696,7 +4653,7 @@
4696
4653
  switch (_k.label) {
4697
4654
  case 0:
4698
4655
  tableCode = tableSelectionDetail.tableCode;
4699
- tableEventHandlers = this.tableSelectionsFinish[tableCode];
4656
+ tableEventHandlers = this._tableSelectionsFinish[tableCode];
4700
4657
  if (!tableEventHandlers) return [3 /*break*/, 2];
4701
4658
  clientActionPromises = [];
4702
4659
  try {
@@ -4746,7 +4703,7 @@
4746
4703
  actionCode: actionCode,
4747
4704
  selectedRecords: selectedRecords
4748
4705
  };
4749
- tableEventHandlers = this.tableActionsStart[tableCode];
4706
+ tableEventHandlers = this._tableActionsStart[tableCode];
4750
4707
  tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
4751
4708
  if (!tableActionMethods) return [3 /*break*/, 2];
4752
4709
  clientActionPromises = [];
@@ -4827,7 +4784,7 @@
4827
4784
  switch (_k.label) {
4828
4785
  case 0:
4829
4786
  tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode;
4830
- tableEventHandlers = this.tableActionsFinish[tableCode];
4787
+ tableEventHandlers = this._tableActionsFinish[tableCode];
4831
4788
  tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
4832
4789
  if (!tableActionMethods) return [3 /*break*/, 2];
4833
4790
  clientActionPromises = [];
@@ -4867,7 +4824,7 @@
4867
4824
  tableCode: tableCode
4868
4825
  };
4869
4826
  this.resetError();
4870
- tableEventHandlers = this.tableGetDataStart[tableCode];
4827
+ tableEventHandlers = this._tableGetDataStart[tableCode];
4871
4828
  if (!tableEventHandlers) return [3 /*break*/, 2];
4872
4829
  clientActionPromises = [];
4873
4830
  try {
@@ -4932,7 +4889,7 @@
4932
4889
  switch (_k.label) {
4933
4890
  case 0:
4934
4891
  tableCode = tableActionDetail.tableCode, tableActionCode = tableActionDetail.tableActionCode;
4935
- tableEventHandlers = this.tableActionsFinish[tableCode];
4892
+ tableEventHandlers = this._tableActionsFinish[tableCode];
4936
4893
  tableActionMethods = (tableEventHandlers) ? tableEventHandlers[tableActionCode] : null;
4937
4894
  if (!tableActionMethods) return [3 /*break*/, 2];
4938
4895
  clientActionPromises = [];