tuain-ng-forms-lib 12.0.24 → 12.0.28

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.
@@ -294,10 +294,12 @@ class FormElement {
294
294
  this.disabled = (_a = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.disabled) !== null && _a !== void 0 ? _a : false;
295
295
  this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
296
296
  this.widget = null;
297
- this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : null;
297
+ this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : {};
298
298
  }
299
299
  getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
300
- setCustomAttribute(name, value) { return name && (this.customAttributes[name] = value); }
300
+ setCustomAttribute(name, value) { if (name) {
301
+ this.customAttributes[name] = value;
302
+ } }
301
303
  matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
302
304
  isField() { return this.elementType === elementTypes.field; }
303
305
  isAction() { return this.elementType === elementTypes.action; }
@@ -1102,178 +1104,6 @@ LibTableComponent.propDecorators = {
1102
1104
  waiting: [{ type: Input }]
1103
1105
  };
1104
1106
 
1105
- class RecordFormSubSection {
1106
- constructor(subsectionReceived, formObject) {
1107
- if (!subsectionReceived) {
1108
- return;
1109
- }
1110
- this._customRender = null;
1111
- this.visible = true;
1112
- this.subSectionElements = [];
1113
- this.subSectionFields = [];
1114
- this.subSectionTables = [];
1115
- this.subSectionActions = [];
1116
- this.elementsArray = {};
1117
- this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
1118
- this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
1119
- this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
1120
- this.visibleStates = subsectionReceived.visibleStates || [];
1121
- if (subsectionReceived.elements) {
1122
- for (const receivedElement of subsectionReceived.elements) {
1123
- let elementObject = null;
1124
- let arrayToAdd = null;
1125
- const { type, code } = receivedElement;
1126
- switch (type) {
1127
- case elementTypes.field:
1128
- elementObject = formObject.getFieldObject(code);
1129
- arrayToAdd = this.subSectionFields;
1130
- break;
1131
- case elementTypes.table:
1132
- elementObject = formObject.getTableObject(code);
1133
- arrayToAdd = this.subSectionTables;
1134
- break;
1135
- case elementTypes.action:
1136
- elementObject = formObject.getActionObject(code);
1137
- arrayToAdd = this.subSectionActions;
1138
- break;
1139
- }
1140
- if (elementObject) {
1141
- elementObject.elementType = type;
1142
- arrayToAdd.push(elementObject);
1143
- this.subSectionElements.push(elementObject);
1144
- this.elementsArray[code] = elementObject;
1145
- }
1146
- }
1147
- }
1148
- }
1149
- show() { this.visible = true; }
1150
- hide() { this.visible = false; }
1151
- get customRender() { return this._customRender; }
1152
- set customRender(customRenderName) { this._customRender = customRenderName; }
1153
- getField(name) {
1154
- return this.subSectionFields.find(fld => fld.name === name);
1155
- }
1156
- getFields() {
1157
- return this.subSectionFields;
1158
- }
1159
- getFieldNames() {
1160
- return this.subSectionFields.map(field => field.fieldCode);
1161
- }
1162
- viewOnState(state) {
1163
- return this.visibleStates.includes(state);
1164
- }
1165
- supportMode(state) { return this.viewOnState(state); }
1166
- }
1167
-
1168
- class RecordFormSection {
1169
- constructor(sectionReceived, formObject) {
1170
- var _a;
1171
- this._activation = new Subject();
1172
- this._inactivation = new Subject();
1173
- this.active = false;
1174
- if (!sectionReceived) {
1175
- return;
1176
- }
1177
- this.visible = true;
1178
- this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
1179
- this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
1180
- this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
1181
- this.visibleStates = sectionReceived.visibleStates || [];
1182
- this.subSections = [];
1183
- this.subSectionsObj = {};
1184
- if (sectionReceived.subsections) {
1185
- const subsections = sectionReceived.subsections.map(objDef => {
1186
- let visibleStates = objDef.visibleStates;
1187
- if (!visibleStates) {
1188
- visibleStates = (objDef.subsectionModes || '').split(',')
1189
- .map(state => state.trim())
1190
- .filter(state => state.length > 0);
1191
- }
1192
- if (!visibleStates || visibleStates.length === 0) {
1193
- visibleStates = this.visibleStates;
1194
- }
1195
- if (objDef.elements && Array.isArray(objDef.elements)) {
1196
- objDef.elements = objDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
1197
- }
1198
- return Object.assign(Object.assign({}, objDef), { visibleStates });
1199
- });
1200
- for (const subsectionReceived of subsections) {
1201
- const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
1202
- const subsectionCode = subSectionToAdd.subsectionCode;
1203
- if (subsectionCode) {
1204
- this.subSections.push(subSectionToAdd);
1205
- this.subSectionsObj[subsectionCode] = subSectionToAdd;
1206
- }
1207
- }
1208
- }
1209
- this.customAttributes = (_a = sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes) !== null && _a !== void 0 ? _a : null;
1210
- }
1211
- getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
1212
- setCustomAttribute(name, value) { return name && (this.customAttributes[name] = value); }
1213
- matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
1214
- get code() { return this.sectionCode; }
1215
- get activation() { return this._activation; }
1216
- get inactivation() { return this._inactivation; }
1217
- activate() {
1218
- if (!this.active) {
1219
- this.active = true;
1220
- this._activation.next(this.sectionCode);
1221
- }
1222
- }
1223
- inactivate() {
1224
- if (this.active) {
1225
- this.active = false;
1226
- this._inactivation.next(this.sectionCode);
1227
- }
1228
- }
1229
- show() { this.visible = true; }
1230
- hide() { this.visible = false; }
1231
- get title() { return this.sectionTitle; }
1232
- set title(title) { this.sectionTitle = title; }
1233
- getVisibleSubsections(state) {
1234
- return this.subSections.filter(subSection => {
1235
- return subSection.visible && subSection.viewOnState(state);
1236
- });
1237
- }
1238
- getSubsection(subSectionCode) {
1239
- return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
1240
- ? this.subSectionsObj[subSectionCode] : null;
1241
- }
1242
- getFields() {
1243
- let fieldsArray = [];
1244
- if (this.subSections && this.subSections.length > 0) {
1245
- for (const subSection of this.subSections) {
1246
- fieldsArray = fieldsArray.concat(subSection.getFields());
1247
- }
1248
- }
1249
- return fieldsArray;
1250
- }
1251
- getFieldNames() {
1252
- let fieldsArray = [];
1253
- if (this.subSections && this.subSections.length > 0) {
1254
- for (const subSection of this.subSections) {
1255
- fieldsArray = fieldsArray.concat(subSection.getFieldNames());
1256
- }
1257
- }
1258
- return fieldsArray;
1259
- }
1260
- getField(name) {
1261
- let field = null;
1262
- if (this.subSections && this.subSections.length > 0) {
1263
- for (const subSection of this.subSections) {
1264
- field = subSection.getField(name);
1265
- if (field) {
1266
- return field;
1267
- }
1268
- }
1269
- }
1270
- return null;
1271
- }
1272
- supportState(state) { return this.viewOnState(state); }
1273
- viewOnState(state) { return this.visibleStates.includes(state); }
1274
- supportMode(state) { return this.viewOnState(state); }
1275
- }
1276
-
1277
1107
  const HEADER = 'HEADER';
1278
1108
  class FormAction extends FormElement {
1279
1109
  constructor(actionDefinition, formConfig) {
@@ -1389,11 +1219,14 @@ class FieldDescriptor extends FormElement {
1389
1219
  get attributeChange() { return this._attributeChange; }
1390
1220
  get editionPartial() { return this._editionPartial; }
1391
1221
  get detailRequest() { return this._detailRequest; }
1222
+ get info() { return this.fieldInfo; }
1392
1223
  get validating() { return this._onValidation; }
1393
1224
  set validating(isValidating) { this.setAttr(fldAttr.onValidation, isValidating); }
1394
1225
  setIntrinsicErrorMessage(message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); }
1395
1226
  set intrinsicErrorMessage(message) { this.setIntrinsicErrorMessage(message); }
1396
1227
  get fieldValue() { return this.getValue(); }
1228
+ getRequired() { return this.required; }
1229
+ setRequired(required) { this.required = required; }
1397
1230
  get required() { return this.fieldRequired; }
1398
1231
  set required(required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); }
1399
1232
  get maxLength() { return (this._maxLength > 0) ? this._maxLength.toString() : ''; }
@@ -1441,7 +1274,7 @@ class FieldDescriptor extends FormElement {
1441
1274
  changed() { this.setChanged(true); }
1442
1275
  getRawValue() { return this._fieldValue; }
1443
1276
  setLabel(label) { this.setAttr(fldAttr.title, label); }
1444
- clean() { this.setValue(this.defaultValue || ''); }
1277
+ clean() { this.setValue(this.defaultValue || ''); this.resetError(); }
1445
1278
  get backend() { return this.validateOnServer; }
1446
1279
  setEditable(editable = true) { (editable) ? this.enable() : this.disable(); }
1447
1280
  hasError() { return this.errorCode !== NO_ERROR; }
@@ -1458,6 +1291,7 @@ class FieldDescriptor extends FormElement {
1458
1291
  setErrorCode(code) { this.setError(code, this.errorMessage); }
1459
1292
  getErrorMessage() { return this.getError().message; }
1460
1293
  setErrorMessage(msg) { this.setError(this.errorCode, msg); }
1294
+ get empty() { return this.isEmpty(); }
1461
1295
  isEmpty() {
1462
1296
  const fieldCurrentValue = this.getValue();
1463
1297
  if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
@@ -1630,8 +1464,180 @@ class FieldDescriptor extends FormElement {
1630
1464
  this.setChanged(true);
1631
1465
  this.setAttr(fldAttr.value, newFinalValue);
1632
1466
  }
1633
- return true;
1467
+ return true;
1468
+ }
1469
+ }
1470
+
1471
+ class RecordFormSubSection {
1472
+ constructor(subsectionReceived, formObject) {
1473
+ if (!subsectionReceived) {
1474
+ return;
1475
+ }
1476
+ this._customRender = null;
1477
+ this.visible = true;
1478
+ this.subSectionElements = [];
1479
+ this.subSectionFields = [];
1480
+ this.subSectionTables = [];
1481
+ this.subSectionActions = [];
1482
+ this.elementsArray = {};
1483
+ this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
1484
+ this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
1485
+ this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
1486
+ this.visibleStates = subsectionReceived.visibleStates || [];
1487
+ if (subsectionReceived.elements) {
1488
+ for (const receivedElement of subsectionReceived.elements) {
1489
+ let elementObject = null;
1490
+ let arrayToAdd = null;
1491
+ const { type, code } = receivedElement;
1492
+ switch (type) {
1493
+ case elementTypes.field:
1494
+ elementObject = formObject.getFieldObject(code);
1495
+ arrayToAdd = this.subSectionFields;
1496
+ break;
1497
+ case elementTypes.table:
1498
+ elementObject = formObject.getTableObject(code);
1499
+ arrayToAdd = this.subSectionTables;
1500
+ break;
1501
+ case elementTypes.action:
1502
+ elementObject = formObject.getActionObject(code);
1503
+ arrayToAdd = this.subSectionActions;
1504
+ break;
1505
+ }
1506
+ if (elementObject) {
1507
+ elementObject.elementType = type;
1508
+ arrayToAdd.push(elementObject);
1509
+ this.subSectionElements.push(elementObject);
1510
+ this.elementsArray[code] = elementObject;
1511
+ }
1512
+ }
1513
+ }
1514
+ }
1515
+ show() { this.visible = true; }
1516
+ hide() { this.visible = false; }
1517
+ get customRender() { return this._customRender; }
1518
+ set customRender(customRenderName) { this._customRender = customRenderName; }
1519
+ getField(name) {
1520
+ return this.subSectionFields.find(fld => fld.name === name);
1521
+ }
1522
+ getFields() {
1523
+ return this.subSectionFields;
1524
+ }
1525
+ getFieldNames() {
1526
+ return this.subSectionFields.map(field => field.fieldCode);
1527
+ }
1528
+ viewOnState(state) {
1529
+ return this.visibleStates.includes(state);
1530
+ }
1531
+ supportMode(state) { return this.viewOnState(state); }
1532
+ }
1533
+
1534
+ class RecordFormSection {
1535
+ constructor(sectionReceived, formObject) {
1536
+ var _a;
1537
+ this._activation = new Subject();
1538
+ this._inactivation = new Subject();
1539
+ this.active = false;
1540
+ if (!sectionReceived) {
1541
+ return;
1542
+ }
1543
+ this.visible = true;
1544
+ this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
1545
+ this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
1546
+ this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
1547
+ this.visibleStates = sectionReceived.visibleStates || [];
1548
+ this.subSections = [];
1549
+ this.subSectionsObj = {};
1550
+ if (sectionReceived.subsections) {
1551
+ const subsections = sectionReceived.subsections.map(objDef => {
1552
+ let visibleStates = objDef.visibleStates;
1553
+ if (!visibleStates) {
1554
+ visibleStates = (objDef.subsectionModes || '').split(',')
1555
+ .map(state => state.trim())
1556
+ .filter(state => state.length > 0);
1557
+ }
1558
+ if (!visibleStates || visibleStates.length === 0) {
1559
+ visibleStates = this.visibleStates;
1560
+ }
1561
+ if (objDef.elements && Array.isArray(objDef.elements)) {
1562
+ objDef.elements = objDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
1563
+ }
1564
+ return Object.assign(Object.assign({}, objDef), { visibleStates });
1565
+ });
1566
+ for (const subsectionReceived of subsections) {
1567
+ const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
1568
+ const subsectionCode = subSectionToAdd.subsectionCode;
1569
+ if (subsectionCode) {
1570
+ this.subSections.push(subSectionToAdd);
1571
+ this.subSectionsObj[subsectionCode] = subSectionToAdd;
1572
+ }
1573
+ }
1574
+ }
1575
+ this.customAttributes = (_a = sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes) !== null && _a !== void 0 ? _a : null;
1576
+ }
1577
+ getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
1578
+ setCustomAttribute(name, value) { return name && (this.customAttributes[name] = value); }
1579
+ matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
1580
+ get code() { return this.sectionCode; }
1581
+ get activation() { return this._activation; }
1582
+ get inactivation() { return this._inactivation; }
1583
+ activate() {
1584
+ if (!this.active) {
1585
+ this.active = true;
1586
+ this._activation.next(this.sectionCode);
1587
+ }
1588
+ }
1589
+ inactivate() {
1590
+ if (this.active) {
1591
+ this.active = false;
1592
+ this._inactivation.next(this.sectionCode);
1593
+ }
1594
+ }
1595
+ show() { this.visible = true; }
1596
+ hide() { this.visible = false; }
1597
+ get title() { return this.sectionTitle; }
1598
+ set title(title) { this.sectionTitle = title; }
1599
+ getVisibleSubsections(state) {
1600
+ return this.subSections.filter(subSection => {
1601
+ return subSection.visible && subSection.viewOnState(state);
1602
+ });
1603
+ }
1604
+ getSubsection(subSectionCode) {
1605
+ return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
1606
+ ? this.subSectionsObj[subSectionCode] : null;
1607
+ }
1608
+ getFields() {
1609
+ let fieldsArray = [];
1610
+ if (this.subSections && this.subSections.length > 0) {
1611
+ for (const subSection of this.subSections) {
1612
+ fieldsArray = fieldsArray.concat(subSection.getFields());
1613
+ }
1614
+ }
1615
+ return fieldsArray;
1616
+ }
1617
+ getFieldNames() {
1618
+ let fieldsArray = [];
1619
+ if (this.subSections && this.subSections.length > 0) {
1620
+ for (const subSection of this.subSections) {
1621
+ fieldsArray = fieldsArray.concat(subSection.getFieldNames());
1622
+ }
1623
+ }
1624
+ return fieldsArray;
1625
+ }
1626
+ getField(name) {
1627
+ let field = null;
1628
+ if (this.subSections && this.subSections.length > 0) {
1629
+ for (const subSection of this.subSections) {
1630
+ field = subSection.getField(name);
1631
+ if (field) {
1632
+ return field;
1633
+ }
1634
+ }
1635
+ }
1636
+ return null;
1634
1637
  }
1638
+ supportState(state) { return this.viewOnState(state); }
1639
+ viewOnState(state) { return this.visibleStates.includes(state); }
1640
+ supportMode(state) { return this.viewOnState(state); }
1635
1641
  }
1636
1642
 
1637
1643
  const ACTIVE = 'active';
@@ -1804,176 +1810,123 @@ class FormStructureAndData {
1804
1810
  set extraInfo(extraInfo) { Object.assign(this._extraInfo, extraInfo); }
1805
1811
  get extraInfo() { return JSON.parse(JSON.stringify(this._extraInfo)); }
1806
1812
  // Fields
1813
+ get fields() { return this._fields; }
1814
+ get fieldNames() { return this.getFieldNames(); }
1807
1815
  getFields() { return this._fieldArray; }
1808
1816
  getFieldNames() { return this._fieldArray.map(field => field.fieldCode); }
1809
- getField(elementId) { var _a; return (elementId && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[elementId])) ? this._fields[elementId] : null; }
1810
- get fields() { return this._fields; }
1811
- enableField(fieldCode) {
1812
- const fieldObject = this.getField(fieldCode);
1813
- return (fieldObject) ? fieldObject.enable() : null;
1814
- }
1815
- disableField(fieldCode) {
1816
- const fieldObject = this.getField(fieldCode);
1817
- return (fieldObject) ? fieldObject.disable() : null;
1818
- }
1819
- getFieldValue(fieldCode) {
1820
- const fieldObject = this.getField(fieldCode);
1821
- return (fieldObject) ? fieldObject.getValue() : null;
1822
- }
1823
- getFieldsValues(fieldCodesArray) {
1824
- var _a, _b, _c;
1825
- if (!fieldCodesArray || !Array.isArray(fieldCodesArray) || fieldCodesArray.length === 0) {
1826
- return null;
1827
- }
1828
- const resultObject = {};
1829
- for (let index = 0; index < fieldCodesArray.length; index++) {
1830
- const fieldCode = fieldCodesArray[index];
1831
- if (fieldCode) {
1832
- resultObject[fieldCode] = (_c = (_b = (_a = this._fields) === null || _a === void 0 ? void 0 : _a[fieldCode]) === null || _b === void 0 ? void 0 : _b.getValue()) !== null && _c !== void 0 ? _c : null;
1833
- }
1834
- }
1835
- return resultObject;
1836
- }
1837
- getFieldOptions(fieldCode) {
1838
- const fieldObject = this.getField(fieldCode);
1839
- return (fieldObject) ? fieldObject.getFieldOptions() : null;
1840
- }
1841
- setFieldValue(fieldCode, fieldValue) {
1842
- const fieldObject = this.getField(fieldCode);
1843
- return (fieldObject) ? fieldObject.setValue(fieldValue) : null;
1844
- }
1845
- setFieldError(code, message, type = 'error') {
1846
- const fieldObject = this.getField(code);
1847
- return (fieldObject) ? fieldObject.setError(code, message, type) : null;
1848
- }
1849
- setFieldIntrinsicErrorMessage(code, message) {
1850
- const fieldObject = this.getField(code);
1851
- return (fieldObject) ? fieldObject.setIntrinsicErrorMessage(message) : null;
1852
- }
1853
- setFieldRequired(fieldCode, required) {
1854
- const fieldObject = this.getField(fieldCode);
1855
- return (fieldObject) ? fieldObject.required = required : null;
1856
- }
1857
- setFieldErrorMessage(fieldCode, errorMessage) {
1858
- const fieldObject = this.getField(fieldCode);
1859
- return (fieldObject) ? fieldObject.setErrorMessage(errorMessage) : null;
1860
- }
1861
- setFieldOptions(fieldCode, optionsArray, idAttribute, nameAttribute) {
1862
- const fieldObject = this.getField(fieldCode);
1863
- if (fieldObject && optionsArray && optionsArray.length > 0) {
1864
- const fieldOptions = [];
1865
- for (const optionItem of optionsArray) {
1866
- const fieldOption = {
1867
- fieldOptionId: optionItem[idAttribute],
1868
- fieldOptionValue: optionItem[nameAttribute]
1869
- };
1870
- fieldOptions.push(fieldOption);
1871
- }
1872
- fieldObject.setFieldOptions(fieldOptions);
1817
+ getField(code) { var _a; return (code && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[code])) ? this._fields[code] : null; }
1818
+ enableField(code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.enable(); }
1819
+ disableField(code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.disable(); }
1820
+ getFieldValue(code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getValue(); }
1821
+ getFieldOptions(code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getFieldOptions(); }
1822
+ setFieldValue(code, value) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setValue(value); }
1823
+ setFieldError(code, message, type = 'error') { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setError(code, message, type); }
1824
+ setFieldIntrinsicErrorMessage(code, message) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setIntrinsicErrorMessage(message); }
1825
+ setFieldRequired(code, required) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setRequired(required); }
1826
+ setFieldErrorMessage(code, message) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setErrorMessage(message); }
1827
+ setFieldOptions(code, optionsArray, idAttribute, nameAttribute) {
1828
+ const field = this.getField(code);
1829
+ if (field && (optionsArray === null || optionsArray === void 0 ? void 0 : optionsArray.length) > 0) {
1830
+ const fieldOptions = optionsArray.map(item => ({
1831
+ fieldOptionId: item[idAttribute],
1832
+ fieldOptionValue: item[nameAttribute]
1833
+ }));
1834
+ field.setFieldOptions(fieldOptions);
1835
+ }
1836
+ }
1837
+ getFieldSet(filter, inputCodes, secCode, subCode) {
1838
+ var _a, _b, _c, _d;
1839
+ let codes = null;
1840
+ if (typeof inputCodes === 'string' && inputCodes) {
1841
+ codes = [inputCodes];
1873
1842
  }
1874
- }
1875
- getFieldSet(filterFunc, fieldArray = null, sectionCode = null, subSectionCode = null) {
1876
- let fieldUniverse = null;
1877
- if (fieldArray && Array.isArray(fieldArray) && fieldArray.length > 0) {
1878
- fieldUniverse = fieldArray;
1843
+ else if (Array.isArray(inputCodes) && inputCodes.length > 0) {
1844
+ codes = inputCodes;
1879
1845
  }
1880
- else if (sectionCode && !subSectionCode) {
1881
- const sectionObject = this.getSection(sectionCode);
1882
- fieldUniverse = sectionObject === null || sectionObject === void 0 ? void 0 : sectionObject.getFieldNames();
1846
+ else if (secCode && !subCode) {
1847
+ codes = (_b = (_a = this.getSection(secCode)) === null || _a === void 0 ? void 0 : _a.getFieldNames()) !== null && _b !== void 0 ? _b : [];
1883
1848
  }
1884
- else if (sectionCode && subSectionCode) {
1885
- const subSectionObject = this.getSubSection(sectionCode, subSectionCode);
1886
- fieldUniverse = subSectionObject === null || subSectionObject === void 0 ? void 0 : subSectionObject.getFieldNames();
1849
+ else if (secCode && subCode) {
1850
+ codes = (_d = (_c = this.getSubSection(secCode, subCode)) === null || _c === void 0 ? void 0 : _c.getFieldNames()) !== null && _d !== void 0 ? _d : [];
1887
1851
  }
1888
1852
  else {
1889
- fieldUniverse = this.getFieldNames();
1890
- }
1891
- if (!filterFunc) {
1892
- return fieldUniverse;
1853
+ codes = this.getFieldNames();
1893
1854
  }
1894
- return fieldUniverse.filter(fld => {
1895
- const fieldObject = this.getField(fld);
1896
- return (fieldObject && filterFunc(fieldObject));
1897
- });
1855
+ return (filter) ? codes.filter(fld => filter(this.getField(fld))) : codes;
1898
1856
  }
1899
- applyProcessToFieldSet(processFunc, fieldArray = null, sectionCode = null, subSectionCode = null) {
1900
- const fieldUniverse = this.getFieldSet(null, fieldArray, sectionCode, subSectionCode);
1901
- let fieldSetSize = 0;
1902
- if (fieldUniverse && processFunc) {
1903
- for (const fieldCode of fieldUniverse) {
1904
- const fieldObject = this.getField(fieldCode);
1905
- if (fieldObject) {
1906
- try {
1907
- processFunc(fieldObject);
1908
- fieldSetSize += 1;
1909
- }
1910
- catch (e) {
1911
- console.log(`Error procesando funcion en campo ${fieldObject}: ${e}`);
1912
- }
1857
+ applyOnFields(processFunc, inputCodes, secCode, subCode) {
1858
+ if (!processFunc) {
1859
+ return 0;
1860
+ }
1861
+ const codes = this.getFieldSet(null, inputCodes, secCode, subCode);
1862
+ let processedFields = 0;
1863
+ for (const code of codes) {
1864
+ const field = this.getField(code);
1865
+ if (field) {
1866
+ try {
1867
+ processFunc(field);
1868
+ processedFields += 1;
1869
+ }
1870
+ catch (e) {
1871
+ console.log(`Error procesando funcion en campo ${field}: ${e}`);
1913
1872
  }
1914
1873
  }
1915
1874
  }
1916
- return fieldSetSize;
1875
+ return processedFields;
1917
1876
  }
1918
- showFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1919
- return this.applyProcessToFieldSet(fld => fld.show(), fieldArray, sectionCode, subSectionCode);
1877
+ enableFields(codes, secCode, subCode) {
1878
+ return this.applyOnFields(fld => fld.enable(), codes, secCode, subCode);
1920
1879
  }
1921
- hideFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1922
- return this.applyProcessToFieldSet(fld => fld.hide(), fieldArray, sectionCode, subSectionCode);
1880
+ showFields(codes, secCode, subCode) {
1881
+ return this.applyOnFields(fld => fld.show(), codes, secCode, subCode);
1923
1882
  }
1924
- showLabelFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1925
- return this.applyProcessToFieldSet(fld => fld.showLablel(), fieldArray, sectionCode, subSectionCode);
1883
+ hideFields(codes, secCode, subCode) {
1884
+ return this.applyOnFields(fld => fld.hide(), codes, secCode, subCode);
1926
1885
  }
1927
- hideLabelFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1928
- return this.applyProcessToFieldSet(fld => fld.hideLabel(), fieldArray, sectionCode, subSectionCode);
1886
+ showLabelFields(codes, secCode, subCode) {
1887
+ return this.applyOnFields(fld => fld.showLablel(), codes, secCode, subCode);
1929
1888
  }
1930
- // Para deprecar
1931
- enableEditFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1932
- return this.enableFields(fieldArray, sectionCode, subSectionCode);
1889
+ hideLabelFields(codes, secCode, subCode) {
1890
+ return this.applyOnFields(fld => fld.hideLabel(), codes, secCode, subCode);
1933
1891
  }
1934
- // Para deprecar
1935
- disableEditFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1936
- return this.disableFields(fieldArray, sectionCode, subSectionCode);
1892
+ disableFields(codes, secCode, subCode) {
1893
+ return this.applyOnFields(fld => fld.disable(), codes, secCode, subCode);
1937
1894
  }
1938
- enableFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1939
- return this.applyProcessToFieldSet(fld => fld.enable(), fieldArray, sectionCode, subSectionCode);
1895
+ cleanFields(codes, secCode, subCode) {
1896
+ return this.applyOnFields(fld => fld.clean(), codes, secCode, subCode);
1940
1897
  }
1941
- disableFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1942
- return this.applyProcessToFieldSet(fld => fld.disable(), fieldArray, sectionCode, subSectionCode);
1898
+ tagFieldsWithError(message, codes, secCode, subCode) {
1899
+ return this.applyOnFields(fld => fld.setErrorMessage(message), codes, secCode, subCode);
1943
1900
  }
1944
- cleanFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1945
- return this.applyProcessToFieldSet(fieldObject => {
1946
- fieldObject.clean('');
1947
- fieldObject.setErrorMessage('');
1948
- }, fieldArray, sectionCode, subSectionCode);
1901
+ cleanErrorFields(codes, secCode, subCode) {
1902
+ this.tagFieldsWithError('', codes, secCode, subCode);
1949
1903
  }
1950
- getRequiredFields(fieldArray, sectionCode = null, subSectionCode = null) {
1951
- return this.getFieldSet(fld => fld.fieldRequired, fieldArray, sectionCode, subSectionCode);
1904
+ tagEmptyRequiredFields(message, codes = null, secCode, subCode) {
1905
+ return this.tagFieldsWithError(message, this.getRequiredEmptyFields(codes, secCode, subCode)) > 0;
1952
1906
  }
1953
- getRequiredEmptyFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1954
- return this.getFieldSet(fld => fld.fieldRequired && fld.isEmpty(), fieldArray, sectionCode, subSectionCode);
1907
+ getRequiredFields(codes, secCode, subCode) {
1908
+ return this.getFieldSet(fld => fld.required, codes, secCode, subCode);
1955
1909
  }
1956
- getChangedFields(fieldArray, sectionCode = null, subSectionCode = null) {
1957
- return this.getFieldSet(fld => !fld.outputOnly && fld.hasChanged(), fieldArray, sectionCode, subSectionCode);
1910
+ getRequiredEmptyFields(codes, secCode, subCode) {
1911
+ return this.getFieldSet(fld => fld.required && fld.empty, codes, secCode, subCode);
1958
1912
  }
1959
- getFieldsWithValidationIssues(fieldArray, sectionCode = null, subSectionCode = null) {
1960
- return this.getFieldSet(fld => fld.errorCode !== NO_ERROR, fieldArray, sectionCode, subSectionCode);
1913
+ getChangedFields(codes, secCode, subCode) {
1914
+ return this.getFieldSet(fld => !fld.outputOnly && fld.hasChanged(), codes, secCode, subCode);
1961
1915
  }
1962
- tagFieldsWithError(errorMessage, fieldArray = null, sectionCode = null, subSectionCode = null) {
1963
- return this.applyProcessToFieldSet(fieldObject => {
1964
- fieldObject.setErrorMessage(errorMessage);
1965
- }, fieldArray, sectionCode, subSectionCode);
1916
+ getFieldsWithValidationIssues(codes, secCode, subCode) {
1917
+ return this.getFieldSet(fld => fld.errorCode !== NO_ERROR, codes, secCode, subCode);
1966
1918
  }
1967
- cleanErrorFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
1968
- this.tagFieldsWithError('', fieldArray, sectionCode, subSectionCode);
1969
- }
1970
- tagEmptyRequiredFields(errorMessage, fieldArray = null, sectionCode = null, subSectionCode = null) {
1971
- const pendingFields = this.getRequiredEmptyFields(fieldArray, sectionCode, subSectionCode);
1972
- if (pendingFields && pendingFields.length > 0) {
1973
- this.tagFieldsWithError(errorMessage, pendingFields);
1974
- return true;
1919
+ getFieldsValues(inputCodes, secCode, subCode) {
1920
+ var _a, _b, _c;
1921
+ const codes = this.getFieldSet(null, inputCodes, secCode, subCode);
1922
+ const resultObject = {};
1923
+ for (let index = 0; index < codes.length; index++) {
1924
+ const code = codes[index];
1925
+ if (code) {
1926
+ 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;
1927
+ }
1975
1928
  }
1976
- return false;
1929
+ return resultObject;
1977
1930
  }
1978
1931
  // Acciones
1979
1932
  get actions() { return this._actions; }
@@ -1996,9 +1949,10 @@ class FormStructureAndData {
1996
1949
  });
1997
1950
  }
1998
1951
  // Tablas
1999
- tables() { return this.getTables(); }
1952
+ get tables() { return this.tables; }
2000
1953
  getTables() { return this._tableArray; }
2001
1954
  getTable(code) { var _a; return (code && ((_a = this._tables) === null || _a === void 0 ? void 0 : _a[code])) ? this._tables[code] : null; }
1955
+ getTableRecord(code, id) { var _a; return (_a = this.getTable(code)) === null || _a === void 0 ? void 0 : _a.getTableRecord(id); }
2002
1956
  enableTables(codes) { return this.execOnTables(codes, ENABLE); }
2003
1957
  disableTables(codes) { return this.execOnTables(codes, DISABLE); }
2004
1958
  showTables(codes) { return this.execOnTables(codes, SHOW); }
@@ -2015,18 +1969,15 @@ class FormStructureAndData {
2015
1969
  (_a = table === null || table === void 0 ? void 0 : table[functionName]) === null || _a === void 0 ? void 0 : _a.call(table);
2016
1970
  });
2017
1971
  }
2018
- getTableRecord(tableCode, recordId) {
2019
- const tableObject = this.getTable(tableCode);
2020
- return (tableObject) ? tableObject.getTableRecord(recordId) : null;
2021
- }
2022
1972
  // Secciones
2023
1973
  get sections() { return this._sectionArray; }
1974
+ getSections() { return this.sections; }
2024
1975
  getSectionsByAttribute(name, value) { return this._sectionArray.filter(item => item.matchAttribute(name, value)); }
2025
1976
  get sectionTitles() { return this._sectionArray.map(formSection => formSection.sectionTitle); }
2026
1977
  get visibleSections() { return this._sectionArray.filter(sec => sec.visible); }
2027
1978
  getSection(code) { var _a; return (code && ((_a = this._sections) === null || _a === void 0 ? void 0 : _a[code])) ? this._sections[code] : null; }
2028
- showSections(names) { this.execOnSections(names, SHOW); }
2029
- hideSections(names) { this.execOnSections(names, HIDE); }
1979
+ showSections(codes) { this.execOnSections(codes, SHOW); }
1980
+ hideSections(codes) { this.execOnSections(codes, HIDE); }
2030
1981
  activeSection() { return this._exclusiveSectionsByAttr[ACTIVE]; }
2031
1982
  getSubSection(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; }
2032
1983
  showSubSections(code, subCodes) { return this.execOnSubSections(code, subCodes, SHOW); }
@@ -2067,55 +2018,43 @@ class FormStructureAndData {
2067
2018
  * Métodos propios de gestión del formulario
2068
2019
  */
2069
2020
  cleanData() {
2070
- if (this._fieldArray) {
2071
- for (const recordField of this._fieldArray) {
2072
- recordField.setValue(recordField.defaultValue);
2073
- }
2021
+ for (const field of this._fieldArray) {
2022
+ field.setValue(field.defaultValue);
2074
2023
  }
2075
- if (this._tableArray) {
2076
- for (const formTable of this._tableArray) {
2077
- formTable.clean();
2078
- }
2024
+ for (const table of this._tableArray) {
2025
+ table.clean();
2079
2026
  }
2080
2027
  }
2081
- /** payload para servicios Tuain */
2082
2028
  getPayload() {
2083
2029
  const formData = {
2084
2030
  fields: [],
2085
2031
  tables: [],
2086
2032
  };
2087
- const formFields = this.getFields();
2088
- if (formFields && formFields.length > 0) {
2089
- for (const fieldDescriptor of formFields) {
2090
- if (!fieldDescriptor.outputOnly) {
2091
- const formField = {
2092
- fieldCode: fieldDescriptor.fieldCode,
2093
- fieldValue: fieldDescriptor.getValue(),
2094
- editable: !fieldDescriptor.disabled,
2095
- visible: fieldDescriptor.visible,
2096
- required: fieldDescriptor.fieldRequired,
2097
- fieldOptions: '',
2098
- };
2099
- formData.fields.push(formField);
2100
- }
2101
- }
2102
- }
2103
- const tables = this.getTables();
2104
- if (tables && tables.length > 0) {
2105
- for (const tableDescriptor of tables) {
2106
- const formTable = {
2107
- tableCode: tableDescriptor.tableCode,
2108
- visible: tableDescriptor.visible,
2109
- currentPage: tableDescriptor.currentPage,
2110
- requestedPage: tableDescriptor.requestedPage,
2111
- recordsPerPage: tableDescriptor.recordsPerPage,
2112
- currentFilter: tableDescriptor.currentFilter,
2113
- sortingColumn: tableDescriptor.sorting.columnName,
2114
- sortingDirection: tableDescriptor.sorting.direction,
2115
- };
2116
- formData.tables.push(formTable);
2117
- }
2118
- }
2033
+ formData.fields = this.getFields().filter(fld => !fld.outputOnly)
2034
+ .map(fld => {
2035
+ const fieldPayload = {
2036
+ fieldCode: fld.fieldCode,
2037
+ fieldValue: fld.getValue(),
2038
+ editable: !fld.disabled,
2039
+ visible: fld.visible,
2040
+ required: fld.required,
2041
+ fieldOptions: '',
2042
+ };
2043
+ return fieldPayload;
2044
+ });
2045
+ formData.tables = this.getTables().map(tbl => {
2046
+ const tablePayload = {
2047
+ tableCode: tbl.tableCode,
2048
+ visible: tbl.visible,
2049
+ currentPage: tbl.currentPage,
2050
+ requestedPage: tbl.requestedPage,
2051
+ recordsPerPage: tbl.recordsPerPage,
2052
+ currentFilter: tbl.currentFilter,
2053
+ sortingColumn: tbl.sorting.columnName,
2054
+ sortingDirection: tbl.sorting.direction,
2055
+ };
2056
+ return tablePayload;
2057
+ });
2119
2058
  return formData;
2120
2059
  }
2121
2060
  }
@@ -2230,114 +2169,335 @@ class BasicFormComponent {
2230
2169
  this.formManagerService = formManagerService;
2231
2170
  this._eventManager = _eventManager;
2232
2171
  this.fileMgmtServices = fileMgmtServices;
2172
+ this._formStructure = null;
2173
+ this._controlToken = null;
2174
+ this._definitionObtained = false;
2175
+ // Eventos de acciones y campos
2176
+ this._formSectionsActivate = {};
2177
+ this._formSectionsInactivate = {};
2178
+ this._formActionsStart = {};
2179
+ this._formActionsFinish = {};
2180
+ this._fieldInputValidation = {};
2181
+ this._fieldValidationsStart = {};
2182
+ this._fieldValidationsFinish = {};
2183
+ // Callback de acciones de tablas
2184
+ this._tableSelectionsStart = {};
2185
+ this._tableSelectionsFinish = {};
2186
+ this._tableActionsStart = {};
2187
+ this._tableActionsFinish = {};
2188
+ this._tableGetDataStart = {};
2189
+ this._tableGetDataFinish = {};
2190
+ this.inputDataFields = {};
2191
+ this.extraData = {};
2192
+ this._errorType = '';
2233
2193
  this.errorCode = '';
2234
2194
  this.errorMessage = '';
2235
2195
  this.errorDetail = '';
2236
- this.formStructure = null;
2237
- this.controlToken = null;
2238
- this.inputDataFields = {};
2239
- this.extraData = {};
2240
- this.definitionObtained = false;
2241
- this.formVisible = false;
2196
+ this.visible = false;
2242
2197
  this.busy = false;
2243
- this.formSectionsActivate = {};
2244
- this.formSectionsInactivate = {};
2245
- this.formActionsStart = {};
2246
- this.formActionsFinish = {};
2247
- this.fieldInputValidation = {};
2248
- this.fieldValidationsStart = {};
2249
- this.fieldValidationsFinish = {};
2250
- // Callback de acciones de tablas
2251
- this.tableSelectionsStart = {};
2252
- this.tableSelectionsFinish = {};
2253
- this.tableActionsStart = {};
2254
- this.tableActionsFinish = {};
2255
- this.tableGetDataStart = {};
2256
- this.tableGetDataFinish = {};
2257
2198
  this._eventEmiter = this._eventManager;
2258
2199
  this.cleanStart();
2259
2200
  this.customPreProcessing();
2260
2201
  }
2261
- assignFunctions() {
2262
- var _a;
2263
- const functionsMapped = [
2264
- ['getCurrentState', 'getCurrentState'],
2265
- ['getCurrentMode', 'getCurrentState'],
2266
- ['getTitle', 'getTitle'],
2267
- ['setTitle', 'setTitle'],
2268
- ['getAction', 'getAction'],
2269
- ['supportState', 'supportState'],
2270
- ['getImmutableElement', 'getImmutableElement'],
2271
- ['getExtraInfo', 'getExtraInfo'],
2272
- ['cleanData', 'cleanData'],
2273
- ['getFields', 'getFields'],
2274
- ['getFieldNames', 'getFieldNames'],
2275
- ['getField', 'getField'],
2276
- ['enableField', 'enableField'],
2277
- ['disableField', 'disableField'],
2278
- ['getFieldValue', 'getFieldValue'],
2279
- ['getFieldsValues', 'getFieldsValues'],
2280
- ['getFieldOptions', 'getFieldOptions'],
2281
- ['setFieldValue', 'setFieldValue'],
2282
- ['setFieldRequired', 'setFieldRequired'],
2283
- ['setFieldErrorMessage', 'setFieldErrorMessage'],
2284
- ['setFieldError', 'setFieldError'],
2285
- ['setFieldIntrinsicErrorMessage', 'setFieldIntrinsicErrorMessage'],
2286
- ['setFieldOptions', 'setFieldOptions'],
2287
- ['getFieldSet', 'getFieldSet'],
2288
- ['applyProcessToFieldSet', 'applyProcessToFieldSet'],
2289
- ['applyProcessToAllFields', 'applyProcessToFieldSet'],
2290
- ['cleanFields', 'cleanFields'],
2291
- ['getRequiredFields', 'getRequiredFields'],
2292
- ['getRequiredEmptyFields', 'getRequiredEmptyFields'],
2293
- ['getChangedFields', 'getChangedFields'],
2294
- ['getFieldsWithValidationIssues', 'getFieldsWithValidationIssues'],
2295
- ['tagFieldsWithError', 'tagFieldsWithError'],
2296
- ['cleanErrorFields', 'cleanErrorFields'],
2297
- ['showLabelFields', 'showLabelFields'],
2298
- ['hideLabelFields', 'hideLabelFields'],
2299
- ['enableFields', 'enableFields'],
2300
- ['disableFields', 'disableFields'],
2301
- ['enableEditFields', 'enableEditFields'],
2302
- ['disableEditFields', 'disableEditFields'],
2303
- ['showFields', 'showFields'],
2304
- ['hideFields', 'hideFields'],
2305
- ['getActionsByAttribute', 'getActionsByAttribute'],
2306
- ['getAction', 'getAction'],
2307
- ['showActions', 'showActions'],
2308
- ['hideActions', 'hideActions'],
2309
- ['enableActions', 'enableActions'],
2310
- ['disableActions', 'disableActions'],
2311
- ['showAction', 'showActions'],
2312
- ['hideAction', 'hideActions'],
2313
- ['enableAction', 'enableActions'],
2314
- ['disableAction', 'disableActions'],
2315
- ['activateSection', 'activateSection'],
2316
- ['getSubSection', 'getSubSection'],
2317
- ['getSection', 'getSection'],
2318
- ['showSection', 'showSections'],
2319
- ['hideSection', 'hideSections'],
2320
- ['showSections', 'showSections'],
2321
- ['hideSections', 'hideSections'],
2322
- ['showSubSection', 'showSubSections'],
2323
- ['hideSubSection', 'hideSubSections'],
2324
- ['showSubSections', 'showSubSections'],
2325
- ['hideSubSections', 'hideSubSections'],
2326
- ['getTables', 'getTables'],
2327
- ['getTable', 'getTable'],
2328
- ['showTables', 'showTables'],
2329
- ['hideTables', 'hideTables'],
2330
- ['showTable', 'showTables'],
2331
- ['hideTable', 'hideTables'],
2332
- ['cleanTables', 'cleanTables'],
2333
- ['cleanTable', 'cleanTables'],
2334
- ['getTableRecord', 'getTableRecord'],
2335
- ['changeState', 'changeState'],
2336
- ];
2337
- for (let index = 0; index < functionsMapped.length; index++) {
2338
- const [name, structureName] = functionsMapped[index];
2339
- this[name] = (_a = this.formStructure) === null || _a === void 0 ? void 0 : _a[structureName];
2340
- }
2202
+ getTitle() {
2203
+ var _a;
2204
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTitle();
2205
+ }
2206
+ setTitle(title) {
2207
+ var _a;
2208
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setTitle(title);
2209
+ }
2210
+ cleanData() {
2211
+ var _a;
2212
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanData();
2213
+ }
2214
+ getCurrentState() {
2215
+ var _a;
2216
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getCurrentState();
2217
+ }
2218
+ supportState(state) {
2219
+ var _a;
2220
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.supportState(state);
2221
+ }
2222
+ changeState(state) {
2223
+ var _a;
2224
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state);
2225
+ }
2226
+ getStates() {
2227
+ var _a;
2228
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.states;
2229
+ }
2230
+ getImmutableElement(name) {
2231
+ var _a;
2232
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getImmutableElement(name);
2233
+ }
2234
+ getExtraInfo(name) {
2235
+ var _a;
2236
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getExtraInfo(name);
2237
+ }
2238
+ getFields() {
2239
+ var _a;
2240
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields();
2241
+ }
2242
+ getFieldNames() {
2243
+ var _a;
2244
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldNames();
2245
+ }
2246
+ getField(code) {
2247
+ var _a;
2248
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getField(code);
2249
+ }
2250
+ enableField(code) {
2251
+ var _a;
2252
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableField(code);
2253
+ }
2254
+ disableField(code) {
2255
+ var _a;
2256
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableField(code);
2257
+ }
2258
+ getFieldValue(code) {
2259
+ var _a;
2260
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldValue(code);
2261
+ }
2262
+ getFieldsValues(codes) {
2263
+ var _a;
2264
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsValues(codes);
2265
+ }
2266
+ getFieldOptions(code) {
2267
+ var _a;
2268
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldOptions(code);
2269
+ }
2270
+ setFieldValue(code, value) {
2271
+ var _a;
2272
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldValue(code, value);
2273
+ }
2274
+ setFieldRequired(code, required) {
2275
+ var _a;
2276
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldRequired(code, required);
2277
+ }
2278
+ setFieldErrorMessage(code, errorMessage) {
2279
+ var _a;
2280
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldErrorMessage(code, errorMessage);
2281
+ }
2282
+ setFieldError(code, message, type) {
2283
+ var _a;
2284
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldError(code, message, type);
2285
+ }
2286
+ setFieldIntrinsicErrorMessage(code, message) {
2287
+ var _a;
2288
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldIntrinsicErrorMessage(code, message);
2289
+ }
2290
+ setFieldOptions(code, optionsArray, idAttribute, nameAttribute) {
2291
+ var _a;
2292
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldOptions(code, optionsArray, idAttribute, nameAttribute);
2293
+ }
2294
+ getFieldSet(filterFunc, codes, secCode, subCode) {
2295
+ var _a;
2296
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldSet(filterFunc, codes, secCode, subCode);
2297
+ }
2298
+ applyOnFields(processFunc, codes, secCode, subCode) {
2299
+ var _a;
2300
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.applyOnFields(processFunc, codes, secCode, subCode);
2301
+ }
2302
+ applyProcessToAllFields(processFunc) {
2303
+ var _a;
2304
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.applyOnFields(processFunc);
2305
+ }
2306
+ cleanFields(codes, secCode, subCode) {
2307
+ var _a;
2308
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanFields(codes, secCode, subCode);
2309
+ }
2310
+ getRequiredFields(codes, secCode, subCode) {
2311
+ var _a;
2312
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredFields(codes, secCode, subCode);
2313
+ }
2314
+ getRequiredEmptyFields(codes, secCode, subCode) {
2315
+ var _a;
2316
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredEmptyFields(codes, secCode, subCode);
2317
+ }
2318
+ getChangedFields(codes, secCode, subCode) {
2319
+ var _a;
2320
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getChangedFields(codes, secCode, subCode);
2321
+ }
2322
+ getFieldsWithValidationIssues(codes, secCode, subCode) {
2323
+ var _a;
2324
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsWithValidationIssues(codes, secCode, subCode);
2325
+ }
2326
+ tagFieldsWithError(errorMessage, codes, secCode, subCode) {
2327
+ var _a;
2328
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.tagFieldsWithError(errorMessage, codes, secCode, subCode);
2329
+ }
2330
+ cleanErrorFields(codes, secCode, subCode) {
2331
+ var _a;
2332
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanErrorFields(codes, secCode, subCode);
2333
+ }
2334
+ showLabelFields(codes, secCode, subCode) {
2335
+ var _a;
2336
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showLabelFields(codes, secCode, subCode);
2337
+ }
2338
+ hideLabelFields(codes, secCode, subCode) {
2339
+ var _a;
2340
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideLabelFields(codes, secCode, subCode);
2341
+ }
2342
+ enableFields(codes, secCode, subCode) {
2343
+ var _a;
2344
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableFields(codes, secCode, subCode);
2345
+ }
2346
+ disableFields(codes, secCode, subCode) {
2347
+ var _a;
2348
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableFields(codes, secCode, subCode);
2349
+ }
2350
+ /**
2351
+ * @deprecated Use enableFields
2352
+ */
2353
+ enableEditFields(codes, secCode, subCode) {
2354
+ return this.enableFields(codes, secCode, subCode);
2355
+ }
2356
+ /**
2357
+ * @deprecated Use disableFields
2358
+ */
2359
+ disableEditFields(codes, secCode, subCode) {
2360
+ return this.disableFields(codes, secCode, subCode);
2361
+ }
2362
+ showFields(codes, secCode, subCode) {
2363
+ var _a;
2364
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showFields(codes, secCode, subCode);
2365
+ }
2366
+ hideFields(codes, secCode, subCode) {
2367
+ var _a;
2368
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideFields(codes, secCode, subCode);
2369
+ }
2370
+ getActionsByAttribute(name, value) {
2371
+ var _a;
2372
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActionsByAttribute(name, value);
2373
+ }
2374
+ getHeaderActions() {
2375
+ var _a;
2376
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActionsByAttribute('location', HEADER$1);
2377
+ }
2378
+ getAction(actionCode) {
2379
+ var _a;
2380
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getAction(actionCode);
2381
+ }
2382
+ showActions(actionArray) {
2383
+ var _a;
2384
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showActions(actionArray);
2385
+ }
2386
+ hideActions(actionArray) {
2387
+ var _a;
2388
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideActions(actionArray);
2389
+ }
2390
+ enableActions(actionArray) {
2391
+ var _a;
2392
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableActions(actionArray);
2393
+ }
2394
+ disableActions(actionArray) {
2395
+ var _a;
2396
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableActions(actionArray);
2397
+ }
2398
+ showAction(code) {
2399
+ var _a;
2400
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showActions(code);
2401
+ }
2402
+ hideAction(code) {
2403
+ var _a;
2404
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideActions(code);
2405
+ }
2406
+ enableAction(code) {
2407
+ var _a;
2408
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableActions(code);
2409
+ }
2410
+ disableAction(code) {
2411
+ var _a;
2412
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableActions(code);
2413
+ }
2414
+ getSections() {
2415
+ var _a;
2416
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections();
2417
+ }
2418
+ activateSection(code) {
2419
+ var _a;
2420
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.activateSection(code);
2421
+ }
2422
+ getSectionsTitles() {
2423
+ var _a;
2424
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections().map(sec => sec.title);
2425
+ }
2426
+ getSection(code) {
2427
+ var _a;
2428
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
2429
+ }
2430
+ showSection(code) {
2431
+ var _a;
2432
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSections(code);
2433
+ }
2434
+ hideSection(code) {
2435
+ var _a;
2436
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSections(code);
2437
+ }
2438
+ showSections(codes) {
2439
+ var _a;
2440
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSections(codes);
2441
+ }
2442
+ hideSections(codes) {
2443
+ var _a;
2444
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSections(codes);
2445
+ }
2446
+ getSubSection(code, subCode) {
2447
+ var _a;
2448
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSubSection(code, subCode);
2449
+ }
2450
+ showSubSection(code, subCode) {
2451
+ var _a;
2452
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSubSections(code, subCode);
2453
+ }
2454
+ hideSubSection(code, subCode) {
2455
+ var _a;
2456
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSubSections(code, subCode);
2457
+ }
2458
+ showSubSections(code, subCodes) {
2459
+ var _a;
2460
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSubSections(code, subCodes);
2461
+ }
2462
+ hideSubSections(code, subCodes) {
2463
+ var _a;
2464
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSubSections(code, subCodes);
2465
+ }
2466
+ getTables() {
2467
+ var _a;
2468
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTables();
2469
+ }
2470
+ showTables(codes) {
2471
+ var _a;
2472
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showTables(codes);
2473
+ }
2474
+ hideTables(codes) {
2475
+ var _a;
2476
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideTables(codes);
2477
+ }
2478
+ cleanTables(codes) {
2479
+ var _a;
2480
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanTables(codes);
2481
+ }
2482
+ getTable(code) {
2483
+ var _a;
2484
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTable(code);
2485
+ }
2486
+ showTable(code) {
2487
+ var _a;
2488
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showTables(code);
2489
+ }
2490
+ hideTable(code) {
2491
+ var _a;
2492
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideTables(code);
2493
+ }
2494
+ cleanTable(code) {
2495
+ var _a, _b;
2496
+ return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTable(code)) === null || _b === void 0 ? void 0 : _b.clean();
2497
+ }
2498
+ getTableRecord(code, recordId) {
2499
+ var _a;
2500
+ return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTableRecord(code, recordId);
2341
2501
  }
2342
2502
  setConfig(formConfig) {
2343
2503
  this.formConfig = formConfig;
@@ -2347,41 +2507,42 @@ class BasicFormComponent {
2347
2507
  this.errorCode = '';
2348
2508
  this.errorMessage = '';
2349
2509
  this.errorDetail = '';
2350
- this.formStructure = null;
2510
+ this._formStructure = null;
2351
2511
  this.fields = null;
2352
2512
  this.actions = null;
2353
- this.controlToken = null;
2513
+ this._controlToken = null;
2354
2514
  this.inputDataFields = {};
2355
- this.definitionObtained = false;
2515
+ this._definitionObtained = false;
2356
2516
  // Se limpian los manejadores de eventos
2357
- this.formVisible = false;
2517
+ this.visible = false;
2358
2518
  this.busy = false;
2359
- this.formSectionsActivate = {};
2360
- this.formSectionsInactivate = {};
2361
- this.formActionsStart = {};
2362
- this.formActionsFinish = {};
2363
- this.fieldInputValidation = {};
2364
- this.fieldValidationsStart = {};
2365
- this.fieldValidationsFinish = {};
2366
- this.tableSelectionsStart = {};
2367
- this.tableSelectionsFinish = {};
2368
- this.tableActionsStart = {};
2369
- this.tableActionsFinish = {};
2370
- this.tableGetDataStart = {};
2371
- this.tableGetDataFinish = {};
2372
- }
2519
+ this._formSectionsActivate = {};
2520
+ this._formSectionsInactivate = {};
2521
+ this._formActionsStart = {};
2522
+ this._formActionsFinish = {};
2523
+ this._fieldInputValidation = {};
2524
+ this._fieldValidationsStart = {};
2525
+ this._fieldValidationsFinish = {};
2526
+ this._tableSelectionsStart = {};
2527
+ this._tableSelectionsFinish = {};
2528
+ this._tableActionsStart = {};
2529
+ this._tableActionsFinish = {};
2530
+ this._tableGetDataStart = {};
2531
+ this._tableGetDataFinish = {};
2532
+ }
2533
+ get formVisible() { return this.visible; }
2373
2534
  get formManager() { return this; }
2374
2535
  get formCode() { return this.name; }
2375
2536
  set formCode(name) { this.name = name; }
2376
2537
  get inServerProcess() { return this.busy; }
2377
- get form() { return this.formStructure; }
2378
- get visibleSections() { return this.formStructure.visibleSections; }
2379
- get currentState() { return this.formStructure.state; }
2380
- set currentState(state) { this.formStructure.changeState(state); }
2381
- get currentMode() { return this.currentState; }
2382
- get immutableData() { return this.formStructure.immutableData; }
2383
- get extraInfo() { return this.formStructure.extraInfo; }
2538
+ get form() { return this._formStructure; }
2384
2539
  get state() { return this.getCurrentState(); }
2540
+ get currentState() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state; }
2541
+ set currentState(state) { this._formStructure.changeState(state); }
2542
+ get currentMode() { return this.currentState; }
2543
+ get immutableData() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.immutableData; }
2544
+ get extraInfo() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.extraInfo; }
2545
+ get visibleSections() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.visibleSections; }
2385
2546
  get formRoute() { return this._formRoute; }
2386
2547
  set formRoute(route) { this._formRoute = route; }
2387
2548
  get subject() { return this.formSubject; }
@@ -2430,7 +2591,7 @@ class BasicFormComponent {
2430
2591
  * @deprecated Use subject
2431
2592
  */
2432
2593
  getformSubject() { return this.getSubject(); }
2433
- numSections() { return this.formStructure.sections.length; }
2594
+ numSections() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.sections.length; }
2434
2595
  subscribeAppEvent(eventName, callback) {
2435
2596
  this._eventEmiter.subscribe(eventName, callback);
2436
2597
  }
@@ -2438,7 +2599,7 @@ class BasicFormComponent {
2438
2599
  var _a, _b, _c, _d, _e, _f, _g, _h;
2439
2600
  let origin = null;
2440
2601
  if (!cleanStack) {
2441
- origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this.controlToken });
2602
+ origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this._controlToken });
2442
2603
  origin.subject = (_a = origin === null || origin === void 0 ? void 0 : origin.subject) !== null && _a !== void 0 ? _a : this.formSubject;
2443
2604
  origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.currentState;
2444
2605
  origin.fields = (_c = origin === null || origin === void 0 ? void 0 : origin.fields) !== null && _c !== void 0 ? _c : {};
@@ -2451,10 +2612,10 @@ class BasicFormComponent {
2451
2612
  target.extra = (_h = target === null || target === void 0 ? void 0 : target.extra) !== null && _h !== void 0 ? _h : {};
2452
2613
  this.formManagerService.openForm(origin, target);
2453
2614
  }
2454
- canGoBack() { return this.originToken !== null; }
2615
+ canGoBack() { return this._originToken !== null; }
2455
2616
  goBack() { return this.formManagerService.backTo(); }
2456
2617
  goBackForm() { return this.goBack(); }
2457
- getOriginDetail() { return this.formManagerService.getFormInfo(this.originToken); }
2618
+ getOriginDetail() { return this.formManagerService.getFormInfo(this._originToken); }
2458
2619
  setError(errorType, errorMessage, errorDetail) {
2459
2620
  this._errorType = errorType || '';
2460
2621
  this.errorMessage = errorMessage || '';
@@ -2471,19 +2632,19 @@ class BasicFormComponent {
2471
2632
  }
2472
2633
  preocessInputParams(params) {
2473
2634
  var _a, _b, _c;
2474
- this.controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
2475
- const { token, subject, state, fields, extra, originToken } = this.formManagerService.getFormInfo(this.controlToken);
2476
- if (!this.controlToken || this.controlToken !== token) {
2477
- return;
2635
+ this._controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
2636
+ const { token, subject, state, fields, extra, originToken } = this.formManagerService.getFormInfo(this._controlToken);
2637
+ if (!this._controlToken || this._controlToken !== token) {
2638
+ return null;
2478
2639
  }
2479
2640
  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;
2480
2641
  this.inputDataFields = fields;
2481
2642
  this.extraData = extra;
2482
- this.originToken = originToken;
2643
+ this._originToken = originToken;
2483
2644
  return state;
2484
2645
  }
2485
2646
  subscribeSectionActivation() {
2486
- const formSections = this.formStructure.sections;
2647
+ const formSections = this._formStructure.sections;
2487
2648
  if (Array.isArray(formSections)) {
2488
2649
  formSections.forEach(section => {
2489
2650
  section.activation.subscribe(code => this.launchSectionActivation(code));
@@ -2492,7 +2653,7 @@ class BasicFormComponent {
2492
2653
  }
2493
2654
  }
2494
2655
  subscribeFieldsSubjects() {
2495
- const formFields = this.formStructure.getFields();
2656
+ const formFields = this._formStructure.getFields();
2496
2657
  if (Array.isArray(formFields)) {
2497
2658
  formFields.forEach(field => {
2498
2659
  field.editionFinish.subscribe(event => {
@@ -2508,7 +2669,7 @@ class BasicFormComponent {
2508
2669
  }
2509
2670
  }
2510
2671
  subscribeActionSubjects() {
2511
- const formActions = this.formStructure.getActions();
2672
+ const formActions = this._formStructure.getActions();
2512
2673
  if (Array.isArray(formActions)) {
2513
2674
  formActions.forEach(action => {
2514
2675
  action.actionActivated.subscribe(code => this.startAction(code));
@@ -2516,7 +2677,7 @@ class BasicFormComponent {
2516
2677
  }
2517
2678
  }
2518
2679
  subscribeTableSubjects() {
2519
- const formTables = this.formStructure.getTables();
2680
+ const formTables = this._formStructure.getTables();
2520
2681
  if (Array.isArray(formTables)) {
2521
2682
  formTables.forEach(table => {
2522
2683
  table.inlineActionTrigger.subscribe(event => this.startTableAction(event));
@@ -2533,22 +2694,22 @@ class BasicFormComponent {
2533
2694
  if (!this.name) {
2534
2695
  return;
2535
2696
  }
2536
- if (!this.definitionObtained) {
2697
+ if (!this._definitionObtained) {
2537
2698
  this.busy = true;
2538
2699
  const formDefinition = yield this.formManagerService.getFormDefinition(this.name);
2539
2700
  this.busy = false;
2540
- this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
2541
- this.fields = this.formStructure.fields;
2542
- this.actions = this.formStructure.actions;
2543
- this.definitionObtained = true;
2701
+ this._formStructure = new FormStructureAndData(formDefinition, this.formConfig);
2702
+ this.fields = this._formStructure.fields;
2703
+ this.actions = this._formStructure.actions;
2704
+ this._definitionObtained = true;
2544
2705
  }
2545
2706
  else {
2546
2707
  this.cleanData();
2547
2708
  }
2548
2709
  if (!this.supportState(initialState)) {
2549
- initialState = this.formStructure.defaultState;
2710
+ initialState = this._formStructure.defaultState;
2550
2711
  }
2551
- this.formStructure.changeState(initialState || this.formStructure.defaultState);
2712
+ this._formStructure.changeState(initialState || this._formStructure.defaultState);
2552
2713
  const inputFieldNames = Object.keys(this.inputDataFields);
2553
2714
  for (let index = 0; index < inputFieldNames.length; index++) {
2554
2715
  const fieldCode = inputFieldNames[index];
@@ -2557,7 +2718,7 @@ class BasicFormComponent {
2557
2718
  }
2558
2719
  const recordResponse = yield this.requestFormAction(formActions.getData);
2559
2720
  this.checkErrorRecordReceived(recordResponse);
2560
- this.formVisible = true;
2721
+ this.visible = true;
2561
2722
  this.subscribeSectionActivation();
2562
2723
  this.subscribeFieldsSubjects();
2563
2724
  this.subscribeActionSubjects();
@@ -2573,6 +2734,7 @@ class BasicFormComponent {
2573
2734
  this.errorCode = recordResponse.errorCode;
2574
2735
  this.errorMessage = recordResponse.errorMessage;
2575
2736
  this.errorDetail = recordResponse.errorDetail;
2737
+ return true;
2576
2738
  }
2577
2739
  errorOccured() {
2578
2740
  return (this.errorCode !== NO_ERROR);
@@ -2585,12 +2747,12 @@ class BasicFormComponent {
2585
2747
  const actionDetail = {
2586
2748
  formCode: this.name,
2587
2749
  formSubject: this.formSubject,
2588
- currentMode: this.formStructure.state,
2750
+ currentMode: this._formStructure.state,
2589
2751
  actionCode,
2590
2752
  actionSubject,
2591
2753
  version: PAYLOAD_VERSION,
2592
- formData: this.formStructure.getPayload(),
2593
- immutableData: this.formStructure.immutableData,
2754
+ formData: this._formStructure.getPayload(),
2755
+ immutableData: this._formStructure.immutableData,
2594
2756
  };
2595
2757
  this.errorCode = NO_ERROR;
2596
2758
  this.errorMessage = '';
@@ -2645,55 +2807,55 @@ class BasicFormComponent {
2645
2807
  if (returnedFile && returnedFile.file) {
2646
2808
  this.fileMgmtServices.saveFile(returnedFile.file, returnedFile.name, returnedFile.type);
2647
2809
  }
2648
- this.formStructure.immutableData = immutableData;
2649
- this.formStructure.extraInfo = extraInfo;
2810
+ this._formStructure.immutableData = immutableData;
2811
+ this._formStructure.extraInfo = extraInfo;
2650
2812
  }
2651
2813
  /**
2652
2814
  * Manejo de event handlers para acciones sobre el formulario
2653
2815
  */
2654
- addSectionActivation(sections, callbackMethod) {
2655
- const sectionSet = (Array.isArray(sections)) ? sections : [sections];
2816
+ addSectionActivation(codes, callbackMethod) {
2817
+ const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2656
2818
  sectionSet.forEach((sectionName) => {
2657
- if (!this.formSectionsActivate[sectionName]) {
2658
- this.formSectionsActivate[sectionName] = [];
2819
+ if (!this._formSectionsActivate[sectionName]) {
2820
+ this._formSectionsActivate[sectionName] = [];
2659
2821
  }
2660
- this.formSectionsActivate[sectionName].push(callbackMethod);
2822
+ this._formSectionsActivate[sectionName].push(callbackMethod);
2661
2823
  });
2662
2824
  }
2663
- addSectionInactivation(sections, callbackMethod) {
2664
- const sectionSet = (Array.isArray(sections)) ? sections : [sections];
2825
+ addSectionInactivation(codes, callbackMethod) {
2826
+ const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2665
2827
  sectionSet.forEach((sectionName) => {
2666
- if (!this.formSectionsInactivate[sectionName]) {
2667
- this.formSectionsInactivate[sectionName] = [];
2828
+ if (!this._formSectionsInactivate[sectionName]) {
2829
+ this._formSectionsInactivate[sectionName] = [];
2668
2830
  }
2669
- this.formSectionsInactivate[sectionName].push(callbackMethod);
2831
+ this._formSectionsInactivate[sectionName].push(callbackMethod);
2670
2832
  });
2671
2833
  }
2672
- addActionMethodStart(actions, callbackMethod) {
2673
- const actionSet = (Array.isArray(actions)) ? actions : [actions];
2834
+ addActionMethodStart(codes, callbackMethod) {
2835
+ const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2674
2836
  actionSet.forEach((actionName) => {
2675
- if (!this.formActionsStart[actionName]) {
2676
- this.formActionsStart[actionName] = [];
2837
+ if (!this._formActionsStart[actionName]) {
2838
+ this._formActionsStart[actionName] = [];
2677
2839
  }
2678
- this.formActionsStart[actionName].push(callbackMethod);
2840
+ this._formActionsStart[actionName].push(callbackMethod);
2679
2841
  });
2680
2842
  }
2681
- addActionMethodFinish(actions, callbackMethod) {
2682
- const actionSet = (Array.isArray(actions)) ? actions : [actions];
2843
+ addActionMethodFinish(codes, callbackMethod) {
2844
+ const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2683
2845
  actionSet.forEach((actionName) => {
2684
- if (!this.formActionsFinish[actionName]) {
2685
- this.formActionsFinish[actionName] = [];
2846
+ if (!this._formActionsFinish[actionName]) {
2847
+ this._formActionsFinish[actionName] = [];
2686
2848
  }
2687
- this.formActionsFinish[actionName].push(callbackMethod);
2849
+ this._formActionsFinish[actionName].push(callbackMethod);
2688
2850
  });
2689
2851
  }
2690
- launchSectionActivation(sectionCode) {
2852
+ launchSectionActivation(code) {
2691
2853
  return __awaiter(this, void 0, void 0, function* () {
2692
- const sectionObject = this.formStructure.getSection(sectionCode);
2854
+ const sectionObject = this._formStructure.getSection(code);
2693
2855
  if (!sectionObject) {
2694
2856
  return;
2695
2857
  }
2696
- const clientSectionMethods = this.formSectionsActivate[sectionCode];
2858
+ const clientSectionMethods = this._formSectionsActivate[code];
2697
2859
  if (clientSectionMethods) {
2698
2860
  for (const clientSectionMethod of clientSectionMethods) {
2699
2861
  clientSectionMethod(sectionObject);
@@ -2701,13 +2863,13 @@ class BasicFormComponent {
2701
2863
  }
2702
2864
  });
2703
2865
  }
2704
- launchSectionInactivation(sectionCode) {
2866
+ launchSectionInactivation(code) {
2705
2867
  return __awaiter(this, void 0, void 0, function* () {
2706
- const sectionObject = this.formStructure.getSection(sectionCode);
2868
+ const sectionObject = this._formStructure.getSection(code);
2707
2869
  if (!sectionObject) {
2708
2870
  return;
2709
2871
  }
2710
- const clientSectionMethods = this.formSectionsInactivate[sectionCode];
2872
+ const clientSectionMethods = this._formSectionsInactivate[code];
2711
2873
  if (clientSectionMethods) {
2712
2874
  for (const clientSectionMethod of clientSectionMethods) {
2713
2875
  clientSectionMethod(sectionObject);
@@ -2715,15 +2877,15 @@ class BasicFormComponent {
2715
2877
  }
2716
2878
  });
2717
2879
  }
2718
- startAction(actionCode) {
2880
+ startAction(code) {
2719
2881
  return __awaiter(this, void 0, void 0, function* () {
2720
- const actionObject = this.getAction(actionCode);
2882
+ const actionObject = this.getAction(code);
2721
2883
  if (!actionObject) {
2722
2884
  return;
2723
2885
  }
2724
2886
  this.resetError();
2725
2887
  actionObject.start();
2726
- const clientActionMethods = this.formActionsStart[actionCode];
2888
+ const clientActionMethods = this._formActionsStart[code];
2727
2889
  if (clientActionMethods) {
2728
2890
  const clientActionPromises = [];
2729
2891
  for (const clientActionMethod of clientActionMethods) {
@@ -2760,49 +2922,49 @@ class BasicFormComponent {
2760
2922
  action.stop();
2761
2923
  });
2762
2924
  }
2763
- finishAction(actionObject, actionResult) {
2925
+ finishAction(action, actionResult) {
2764
2926
  return __awaiter(this, void 0, void 0, function* () {
2765
- const finishActionMethods = this.formActionsFinish[actionObject.actionCode];
2927
+ const finishActionMethods = this._formActionsFinish[action.actionCode];
2766
2928
  if (finishActionMethods) {
2767
2929
  const clientActionPromises = [];
2768
2930
  for (const clientActionMethod of finishActionMethods) {
2769
- clientActionPromises.push(clientActionMethod(actionObject, actionResult));
2931
+ clientActionPromises.push(clientActionMethod(action, actionResult));
2770
2932
  }
2771
2933
  yield Promise.all(clientActionPromises);
2772
2934
  }
2773
2935
  });
2774
2936
  }
2775
- completeGlobalAction(actionObject) {
2776
- return this.startServerAction(actionObject);
2937
+ completeGlobalAction(action) {
2938
+ return this.startServerAction(action);
2777
2939
  }
2778
2940
  /**
2779
2941
  * Manejadores de eventos para validaciones sobre campos
2780
2942
  */
2781
- addFieldInputValidation(fields, callbackMethod) {
2782
- const fieldSet = (Array.isArray(fields)) ? fields : [fields];
2943
+ addFieldInputValidation(codes, callbackMethod) {
2944
+ const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2783
2945
  fieldSet.forEach((fieldCode) => {
2784
- if (!this.fieldInputValidation[fieldCode]) {
2785
- this.fieldInputValidation[fieldCode] = [];
2946
+ if (!this._fieldInputValidation[fieldCode]) {
2947
+ this._fieldInputValidation[fieldCode] = [];
2786
2948
  }
2787
- this.fieldInputValidation[fieldCode].push(callbackMethod);
2949
+ this._fieldInputValidation[fieldCode].push(callbackMethod);
2788
2950
  });
2789
2951
  }
2790
- addFieldValidationStart(fields, callbackMethod) {
2791
- const fieldSet = (Array.isArray(fields)) ? fields : [fields];
2952
+ addFieldValidationStart(codes, callbackMethod) {
2953
+ const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2792
2954
  fieldSet.forEach((fieldCode) => {
2793
- if (!this.fieldValidationsStart[fieldCode]) {
2794
- this.fieldValidationsStart[fieldCode] = [];
2955
+ if (!this._fieldValidationsStart[fieldCode]) {
2956
+ this._fieldValidationsStart[fieldCode] = [];
2795
2957
  }
2796
- this.fieldValidationsStart[fieldCode].push(callbackMethod);
2958
+ this._fieldValidationsStart[fieldCode].push(callbackMethod);
2797
2959
  });
2798
2960
  }
2799
- addFieldValidationFinish(fields, callbackMethod) {
2800
- const fieldSet = (Array.isArray(fields)) ? fields : [fields];
2961
+ addFieldValidationFinish(codes, callbackMethod) {
2962
+ const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2801
2963
  fieldSet.forEach((fieldCode) => {
2802
- if (!this.fieldValidationsFinish[fieldCode]) {
2803
- this.fieldValidationsFinish[fieldCode] = [];
2964
+ if (!this._fieldValidationsFinish[fieldCode]) {
2965
+ this._fieldValidationsFinish[fieldCode] = [];
2804
2966
  }
2805
- this.fieldValidationsFinish[fieldCode].push(callbackMethod);
2967
+ this._fieldValidationsFinish[fieldCode].push(callbackMethod);
2806
2968
  });
2807
2969
  }
2808
2970
  startFieldInputValidation(fieldCode, intrinsicValidation = true) {
@@ -2812,7 +2974,7 @@ class BasicFormComponent {
2812
2974
  return false;
2813
2975
  }
2814
2976
  fieldToValidate.resetError();
2815
- const validationCallbacks = this.fieldInputValidation[fieldCode];
2977
+ const validationCallbacks = this._fieldInputValidation[fieldCode];
2816
2978
  if (validationCallbacks) {
2817
2979
  const clientValidationPromises = [];
2818
2980
  for (const validationMethod of validationCallbacks) {
@@ -2830,7 +2992,7 @@ class BasicFormComponent {
2830
2992
  return;
2831
2993
  }
2832
2994
  fieldToValidate.resetError();
2833
- const validationCallbacks = this.fieldValidationsStart[fieldCode];
2995
+ const validationCallbacks = this._fieldValidationsStart[fieldCode];
2834
2996
  if (validationCallbacks) {
2835
2997
  const clientValidationPromises = [];
2836
2998
  for (const validationMethod of validationCallbacks) {
@@ -2871,7 +3033,7 @@ class BasicFormComponent {
2871
3033
  }
2872
3034
  finishFieldValidation(fieldObject, validationResult) {
2873
3035
  return __awaiter(this, void 0, void 0, function* () {
2874
- const validationCallbacks = this.fieldValidationsFinish[fieldObject.fieldCode];
3036
+ const validationCallbacks = this._fieldValidationsFinish[fieldObject.fieldCode];
2875
3037
  if (validationCallbacks) {
2876
3038
  const clientActionPromises = [];
2877
3039
  for (const validationMethod of validationCallbacks) {
@@ -2889,8 +3051,8 @@ class BasicFormComponent {
2889
3051
  /**
2890
3052
  * Manejadores de eventos para acciones sobre Tablas
2891
3053
  */
2892
- addTableActionStart(tableName, actionCode, callbackMethod) {
2893
- const tableObject = this.getTable(tableName);
3054
+ addTableActionStart(code, actionCode, callbackMethod) {
3055
+ const tableObject = this.getTable(code);
2894
3056
  if (!tableObject) {
2895
3057
  return;
2896
3058
  }
@@ -2899,20 +3061,20 @@ class BasicFormComponent {
2899
3061
  return;
2900
3062
  }
2901
3063
  let tableEventHandlers = null;
2902
- if (this.tableActionsStart[tableName]) {
2903
- tableEventHandlers = this.tableActionsStart[tableName];
3064
+ if (this._tableActionsStart[code]) {
3065
+ tableEventHandlers = this._tableActionsStart[code];
2904
3066
  }
2905
3067
  else {
2906
3068
  tableEventHandlers = {};
2907
- this.tableActionsStart[tableName] = tableEventHandlers;
3069
+ this._tableActionsStart[code] = tableEventHandlers;
2908
3070
  }
2909
3071
  if (!tableEventHandlers[actionCode]) {
2910
3072
  tableEventHandlers[actionCode] = [];
2911
3073
  }
2912
3074
  tableEventHandlers[actionCode].push(callbackMethod);
2913
3075
  }
2914
- addTableActionFinish(tableName, actionCode, callbackMethod) {
2915
- const tableObject = this.getTable(tableName);
3076
+ addTableActionFinish(code, actionCode, callbackMethod) {
3077
+ const tableObject = this.getTable(code);
2916
3078
  if (!tableObject) {
2917
3079
  return;
2918
3080
  }
@@ -2921,75 +3083,75 @@ class BasicFormComponent {
2921
3083
  return;
2922
3084
  }
2923
3085
  let tableEventHandlers = null;
2924
- if (this.tableActionsFinish[tableName]) {
2925
- tableEventHandlers = this.tableActionsFinish[tableName];
3086
+ if (this._tableActionsFinish[code]) {
3087
+ tableEventHandlers = this._tableActionsFinish[code];
2926
3088
  }
2927
3089
  else {
2928
3090
  tableEventHandlers = {};
2929
- this.tableActionsFinish[tableName] = tableEventHandlers;
3091
+ this._tableActionsFinish[code] = tableEventHandlers;
2930
3092
  }
2931
3093
  if (!tableEventHandlers[actionCode]) {
2932
3094
  tableEventHandlers[actionCode] = [];
2933
3095
  }
2934
3096
  tableEventHandlers[actionCode].push(callbackMethod);
2935
3097
  }
2936
- addTableSelectionStart(tableName, callbackMethod) {
2937
- const tableObject = this.getTable(tableName);
3098
+ addTableSelectionStart(code, callbackMethod) {
3099
+ const tableObject = this.getTable(code);
2938
3100
  if (!tableObject) {
2939
3101
  return;
2940
3102
  }
2941
3103
  let tableEventHandlers = null;
2942
- if (this.tableSelectionsStart[tableName]) {
2943
- tableEventHandlers = this.tableSelectionsStart[tableName];
3104
+ if (this._tableSelectionsStart[code]) {
3105
+ tableEventHandlers = this._tableSelectionsStart[code];
2944
3106
  }
2945
3107
  else {
2946
3108
  tableEventHandlers = [];
2947
- this.tableSelectionsStart[tableName] = tableEventHandlers;
3109
+ this._tableSelectionsStart[code] = tableEventHandlers;
2948
3110
  }
2949
3111
  tableEventHandlers.push(callbackMethod);
2950
3112
  }
2951
- addTableSelectionFinish(tableName, callbackMethod) {
2952
- const tableObject = this.getTable(tableName);
3113
+ addTableSelectionFinish(code, callbackMethod) {
3114
+ const tableObject = this.getTable(code);
2953
3115
  if (!tableObject) {
2954
3116
  return;
2955
3117
  }
2956
3118
  let tableEventHandlers = null;
2957
- if (this.tableSelectionsFinish[tableName]) {
2958
- tableEventHandlers = this.tableSelectionsFinish[tableName];
3119
+ if (this._tableSelectionsFinish[code]) {
3120
+ tableEventHandlers = this._tableSelectionsFinish[code];
2959
3121
  }
2960
3122
  else {
2961
3123
  tableEventHandlers = [];
2962
- this.tableSelectionsFinish[tableName] = tableEventHandlers;
3124
+ this._tableSelectionsFinish[code] = tableEventHandlers;
2963
3125
  }
2964
3126
  tableEventHandlers.push(callbackMethod);
2965
3127
  }
2966
- addTableGetDataStart(tableName, callbackMethod) {
2967
- const tableObject = this.getTable(tableName);
3128
+ addTableGetDataStart(code, callbackMethod) {
3129
+ const tableObject = this.getTable(code);
2968
3130
  if (!tableObject) {
2969
3131
  return;
2970
3132
  }
2971
3133
  let tableEventHandlers = null;
2972
- if (this.tableGetDataStart[tableName]) {
2973
- tableEventHandlers = this.tableGetDataStart[tableName];
3134
+ if (this._tableGetDataStart[code]) {
3135
+ tableEventHandlers = this._tableGetDataStart[code];
2974
3136
  }
2975
3137
  else {
2976
3138
  tableEventHandlers = [];
2977
- this.tableGetDataStart[tableName] = tableEventHandlers;
3139
+ this._tableGetDataStart[code] = tableEventHandlers;
2978
3140
  }
2979
3141
  tableEventHandlers.push(callbackMethod);
2980
3142
  }
2981
- addTableGetDataFinish(tableName, callbackMethod) {
2982
- const tableObject = this.getTable(tableName);
3143
+ addTableGetDataFinish(code, callbackMethod) {
3144
+ const tableObject = this.getTable(code);
2983
3145
  if (!tableObject) {
2984
3146
  return;
2985
3147
  }
2986
3148
  let tableEventHandlers = null;
2987
- if (this.tableGetDataFinish[tableName]) {
2988
- tableEventHandlers = this.tableGetDataFinish[tableName];
3149
+ if (this._tableGetDataFinish[code]) {
3150
+ tableEventHandlers = this._tableGetDataFinish[code];
2989
3151
  }
2990
3152
  else {
2991
3153
  tableEventHandlers = {};
2992
- this.tableGetDataFinish[tableName] = tableEventHandlers;
3154
+ this._tableGetDataFinish[code] = tableEventHandlers;
2993
3155
  }
2994
3156
  tableEventHandlers[GET_DATA_ACTION] = callbackMethod;
2995
3157
  }
@@ -3011,7 +3173,7 @@ class BasicFormComponent {
3011
3173
  tableCode,
3012
3174
  actionCode,
3013
3175
  };
3014
- const tableEventHandlers = this.tableActionsStart[tableCode];
3176
+ const tableEventHandlers = this._tableActionsStart[tableCode];
3015
3177
  const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
3016
3178
  if (tableActionMethods) {
3017
3179
  const clientActionPromises = [];
@@ -3060,7 +3222,7 @@ class BasicFormComponent {
3060
3222
  finishTableGlobalAction(tableActionDetail, actionResult) {
3061
3223
  return __awaiter(this, void 0, void 0, function* () {
3062
3224
  const { tableCode, actionCode } = tableActionDetail;
3063
- const tableEventHandlers = this.tableActionsFinish[tableCode];
3225
+ const tableEventHandlers = this._tableActionsFinish[tableCode];
3064
3226
  const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
3065
3227
  if (tableActionMethods) {
3066
3228
  const clientActionPromises = [];
@@ -3092,7 +3254,7 @@ class BasicFormComponent {
3092
3254
  recordId,
3093
3255
  recordData
3094
3256
  };
3095
- const tableEventHandlers = this.tableActionsStart[tableCode];
3257
+ const tableEventHandlers = this._tableActionsStart[tableCode];
3096
3258
  const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
3097
3259
  if (tableActionMethods) {
3098
3260
  const clientActionPromises = [];
@@ -3146,7 +3308,7 @@ class BasicFormComponent {
3146
3308
  finishTableAction(tableActionDetail, actionResult) {
3147
3309
  return __awaiter(this, void 0, void 0, function* () {
3148
3310
  const { tableCode, actionCode } = tableActionDetail;
3149
- const tableEventHandlers = this.tableActionsFinish[tableCode];
3311
+ const tableEventHandlers = this._tableActionsFinish[tableCode];
3150
3312
  const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
3151
3313
  if (tableActionMethods) {
3152
3314
  const clientActionPromises = [];
@@ -3172,7 +3334,7 @@ class BasicFormComponent {
3172
3334
  recordId,
3173
3335
  recordData
3174
3336
  };
3175
- const tableEventHandlers = this.tableSelectionsStart[tableCode];
3337
+ const tableEventHandlers = this._tableSelectionsStart[tableCode];
3176
3338
  if (tableEventHandlers) {
3177
3339
  const clientActionPromises = [];
3178
3340
  for (const tableSelectionMethod of tableEventHandlers) {
@@ -3221,7 +3383,7 @@ class BasicFormComponent {
3221
3383
  finishTableRecordSelection(tableSelectionDetail, actionResult) {
3222
3384
  return __awaiter(this, void 0, void 0, function* () {
3223
3385
  const { tableCode } = tableSelectionDetail;
3224
- const tableEventHandlers = this.tableSelectionsFinish[tableCode];
3386
+ const tableEventHandlers = this._tableSelectionsFinish[tableCode];
3225
3387
  if (tableEventHandlers) {
3226
3388
  const clientActionPromises = [];
3227
3389
  for (const tableSelectionMethod of tableEventHandlers) {
@@ -3251,7 +3413,7 @@ class BasicFormComponent {
3251
3413
  actionCode,
3252
3414
  selectedRecords
3253
3415
  };
3254
- const tableEventHandlers = this.tableActionsStart[tableCode];
3416
+ const tableEventHandlers = this._tableActionsStart[tableCode];
3255
3417
  const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
3256
3418
  if (tableActionMethods) {
3257
3419
  const clientActionPromises = [];
@@ -3301,7 +3463,7 @@ class BasicFormComponent {
3301
3463
  finishTableSelectionAction(tableActionDetail, actionResult) {
3302
3464
  return __awaiter(this, void 0, void 0, function* () {
3303
3465
  const { tableCode, actionCode } = tableActionDetail;
3304
- const tableEventHandlers = this.tableActionsFinish[tableCode];
3466
+ const tableEventHandlers = this._tableActionsFinish[tableCode];
3305
3467
  const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
3306
3468
  if (tableActionMethods) {
3307
3469
  const clientActionPromises = [];
@@ -3321,7 +3483,7 @@ class BasicFormComponent {
3321
3483
  tableCode
3322
3484
  };
3323
3485
  this.resetError();
3324
- const tableEventHandlers = this.tableGetDataStart[tableCode];
3486
+ const tableEventHandlers = this._tableGetDataStart[tableCode];
3325
3487
  if (tableEventHandlers) {
3326
3488
  const clientActionPromises = [];
3327
3489
  for (const tableActionMethod of tableEventHandlers) {
@@ -3356,7 +3518,7 @@ class BasicFormComponent {
3356
3518
  finishTableGetData(tableActionDetail, actionResult) {
3357
3519
  return __awaiter(this, void 0, void 0, function* () {
3358
3520
  const { tableCode, tableActionCode } = tableActionDetail;
3359
- const tableEventHandlers = this.tableActionsFinish[tableCode];
3521
+ const tableEventHandlers = this._tableActionsFinish[tableCode];
3360
3522
  const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[tableActionCode] : null;
3361
3523
  if (tableActionMethods) {
3362
3524
  const clientActionPromises = [];
@@ -3422,108 +3584,6 @@ class BasicFormComponent {
3422
3584
  }
3423
3585
  return true;
3424
3586
  }
3425
- /**
3426
- * Soporte registros en tablas que se editan en campos del formulario
3427
- */
3428
- defineEditionTable(tableEditionDef) {
3429
- const { columnFieldMapping, recordCaptureFields, startCollapsed } = tableEditionDef;
3430
- tableEditionDef.startCollapsed = (typeof startCollapsed !== 'undefined')
3431
- ? startCollapsed : true;
3432
- const fieldsMappingTable = {};
3433
- const fieldsToClear = [];
3434
- for (const columnMap of columnFieldMapping) {
3435
- const [columnName, formField] = columnMap;
3436
- fieldsMappingTable[columnName] = formField;
3437
- fieldsToClear.push(formField);
3438
- }
3439
- tableEditionDef.fieldsMappingTable = fieldsMappingTable;
3440
- tableEditionDef.fieldsToClear = fieldsToClear;
3441
- const { tableName, newRecordActionName, saveRecordActionName, cancelSaveRecordActionName, tableEditRecordActionName, enableRecordEdition } = tableEditionDef;
3442
- this.addActionMethodStart(newRecordActionName, () => {
3443
- this.cleanFields(fieldsToClear, null);
3444
- this.showFields(recordCaptureFields);
3445
- if (!enableRecordEdition) {
3446
- this.enableRecordEdition(tableEditionDef);
3447
- }
3448
- else {
3449
- enableRecordEdition(tableEditionDef);
3450
- }
3451
- this.hideAction(newRecordActionName);
3452
- this.showAction(cancelSaveRecordActionName);
3453
- this.showAction(saveRecordActionName);
3454
- return true;
3455
- });
3456
- const { recordEditionValidate, disableRecordEdition } = tableEditionDef;
3457
- this.addActionMethodStart(saveRecordActionName, () => {
3458
- return (!recordEditionValidate) ? this.recordEditionValidate(tableEditionDef)
3459
- : recordEditionValidate(tableEditionDef);
3460
- });
3461
- this.addActionMethodFinish(saveRecordActionName, () => {
3462
- if (!this.errorOccured()) {
3463
- return (!disableRecordEdition) ? this.disableRecordEdition(tableEditionDef)
3464
- : disableRecordEdition(tableEditionDef);
3465
- }
3466
- });
3467
- this.addActionMethodStart(cancelSaveRecordActionName, () => {
3468
- return (!disableRecordEdition) ? this.disableRecordEdition(tableEditionDef)
3469
- : disableRecordEdition(tableEditionDef);
3470
- });
3471
- this.addTableActionStart(tableName, tableEditRecordActionName, (tblActObj) => {
3472
- return (!enableRecordEdition)
3473
- ? this.enableRecordEdition(tableEditionDef, tblActObj)
3474
- : enableRecordEdition(tableEditionDef, tblActObj);
3475
- });
3476
- if (tableEditionDef.startCollapsed) {
3477
- return (!tableEditionDef.disableRecordEdition)
3478
- ? this.disableRecordEdition(tableEditionDef)
3479
- : tableEditionDef.disableRecordEdition(tableEditionDef);
3480
- }
3481
- else {
3482
- return (!tableEditionDef.enableRecordEdition)
3483
- ? this.enableRecordEdition(tableEditionDef)
3484
- : tableEditionDef.enableRecordEdition(tableEditionDef, null);
3485
- }
3486
- }
3487
- enableRecordEdition(tableEditionDef, tableActionObject = null) {
3488
- if (tableActionObject) {
3489
- this.copyTableRecordToFields(tableActionObject, tableEditionDef.fieldsMappingTable);
3490
- }
3491
- this.showFields(tableEditionDef.recordCaptureFields);
3492
- this.hideAction(tableEditionDef.newRecordActionName);
3493
- this.showAction(tableEditionDef.cancelSaveRecordActionName);
3494
- this.showAction(tableEditionDef.saveRecordActionName);
3495
- if (tableEditionDef.fieldsToTriggerValidation
3496
- && tableEditionDef.fieldsToTriggerValidation.length > 0) {
3497
- for (const fieldName of tableEditionDef.fieldsToTriggerValidation) {
3498
- this.startFieldValidation(fieldName);
3499
- }
3500
- }
3501
- return true;
3502
- }
3503
- disableRecordEdition(tableDefinition) {
3504
- this.cleanFields(tableDefinition.fieldsToClear, null);
3505
- this.hideFields(tableDefinition.recordCaptureFields);
3506
- this.showAction(tableDefinition.newRecordActionName);
3507
- this.hideAction(tableDefinition.cancelSaveRecordActionName);
3508
- this.hideAction(tableDefinition.saveRecordActionName);
3509
- return true;
3510
- }
3511
- recordEditionValidate(tableEditionDef) {
3512
- const { recordCaptureFields } = tableEditionDef;
3513
- let validationOk = true;
3514
- const requiredEmptyFields = this.getRequiredEmptyFields(recordCaptureFields, null);
3515
- if (requiredEmptyFields.length > 0) {
3516
- validationOk = false;
3517
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
3518
- this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
3519
- }
3520
- const validationIssueFields = this.getFieldsWithValidationIssues(recordCaptureFields, null);
3521
- if (validationIssueFields.length > 0) {
3522
- validationOk = false;
3523
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
3524
- }
3525
- return validationOk;
3526
- }
3527
3587
  }
3528
3588
  BasicFormComponent.decorators = [
3529
3589
  { type: Component, args: [{