tuain-ng-forms-lib 12.0.23 → 12.0.27

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