tuain-ng-forms-lib 12.0.24 → 12.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/tuain-ng-forms-lib.umd.js +905 -800
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/element.js +4 -2
- package/esm2015/lib/classes/forms/field.js +6 -2
- package/esm2015/lib/classes/forms/form.js +123 -190
- package/esm2015/lib/components/forms/basic-form.js +446 -223
- package/fesm2015/tuain-ng-forms-lib.js +798 -636
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/element.d.ts +9 -9
- package/lib/classes/forms/field.d.ts +4 -0
- package/lib/classes/forms/form.d.ts +84 -69
- package/lib/components/forms/basic-form.d.ts +145 -146
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -297,7 +297,9 @@ class FormElement {
|
|
|
297
297
|
this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : null;
|
|
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) {
|
|
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) {
|
|
@@ -1634,60 +1468,232 @@ class FieldDescriptor extends FormElement {
|
|
|
1634
1468
|
}
|
|
1635
1469
|
}
|
|
1636
1470
|
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
const ENABLE = 'enable';
|
|
1641
|
-
const DISABLE = 'disable';
|
|
1642
|
-
const CLEAN = 'clean';
|
|
1643
|
-
class FormStructureAndData {
|
|
1644
|
-
constructor(definitionReceived, formConfig) {
|
|
1645
|
-
this._fields = {};
|
|
1646
|
-
this._actions = {};
|
|
1647
|
-
this._tables = {};
|
|
1648
|
-
this._sections = {};
|
|
1649
|
-
this._immutableData = {};
|
|
1650
|
-
this._extraInfo = {};
|
|
1651
|
-
this._exclusiveSectionsByAttr = {};
|
|
1652
|
-
this._formConfig = formConfig;
|
|
1653
|
-
this.state = '';
|
|
1654
|
-
this._actionArray = [];
|
|
1655
|
-
this._fieldArray = [];
|
|
1656
|
-
this._tableArray = [];
|
|
1657
|
-
this._sectionArray = [];
|
|
1658
|
-
this._stateFlow = {
|
|
1659
|
-
defaultState: '',
|
|
1660
|
-
states: [],
|
|
1661
|
-
transitions: [],
|
|
1662
|
-
};
|
|
1663
|
-
if (!definitionReceived) {
|
|
1471
|
+
class RecordFormSubSection {
|
|
1472
|
+
constructor(subsectionReceived, formObject) {
|
|
1473
|
+
if (!subsectionReceived) {
|
|
1664
1474
|
return;
|
|
1665
1475
|
}
|
|
1666
|
-
this.
|
|
1667
|
-
|
|
1668
|
-
this.
|
|
1669
|
-
|
|
1670
|
-
this.
|
|
1671
|
-
this.
|
|
1672
|
-
this.
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
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;
|
|
1682
1505
|
}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
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;
|
|
1637
|
+
}
|
|
1638
|
+
supportState(state) { return this.viewOnState(state); }
|
|
1639
|
+
viewOnState(state) { return this.visibleStates.includes(state); }
|
|
1640
|
+
supportMode(state) { return this.viewOnState(state); }
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
const ACTIVE = 'active';
|
|
1644
|
+
const SHOW = 'show';
|
|
1645
|
+
const HIDE = 'hide';
|
|
1646
|
+
const ENABLE = 'enable';
|
|
1647
|
+
const DISABLE = 'disable';
|
|
1648
|
+
const CLEAN = 'clean';
|
|
1649
|
+
class FormStructureAndData {
|
|
1650
|
+
constructor(definitionReceived, formConfig) {
|
|
1651
|
+
this._fields = {};
|
|
1652
|
+
this._actions = {};
|
|
1653
|
+
this._tables = {};
|
|
1654
|
+
this._sections = {};
|
|
1655
|
+
this._immutableData = {};
|
|
1656
|
+
this._extraInfo = {};
|
|
1657
|
+
this._exclusiveSectionsByAttr = {};
|
|
1658
|
+
this._formConfig = formConfig;
|
|
1659
|
+
this.state = '';
|
|
1660
|
+
this._actionArray = [];
|
|
1661
|
+
this._fieldArray = [];
|
|
1662
|
+
this._tableArray = [];
|
|
1663
|
+
this._sectionArray = [];
|
|
1664
|
+
this._stateFlow = {
|
|
1665
|
+
defaultState: '',
|
|
1666
|
+
states: [],
|
|
1667
|
+
transitions: [],
|
|
1668
|
+
};
|
|
1669
|
+
if (!definitionReceived) {
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
this._name = (definitionReceived.form && definitionReceived.form.formCode)
|
|
1673
|
+
? definitionReceived.form.formCode : this._name;
|
|
1674
|
+
this._title = (definitionReceived.form && definitionReceived.form.formTitle)
|
|
1675
|
+
? definitionReceived.form.formTitle : '';
|
|
1676
|
+
this.setStateFlow(definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.states, definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.transitions, definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.defaultState);
|
|
1677
|
+
this.immutableData = definitionReceived.immutableData;
|
|
1678
|
+
this.extraInfo = definitionReceived.extraInfo;
|
|
1679
|
+
if (definitionReceived.actions) {
|
|
1680
|
+
const formActions = definitionReceived.actions.map(objDef => {
|
|
1681
|
+
let visibleStates = objDef.visibleStates;
|
|
1682
|
+
let enabledStates = objDef.enabledStates;
|
|
1683
|
+
if (!visibleStates) {
|
|
1684
|
+
visibleStates = (objDef.actionModes || '').split(',')
|
|
1685
|
+
.map(state => state.trim())
|
|
1686
|
+
.filter(state => state.length > 0) || [];
|
|
1687
|
+
enabledStates = [...visibleStates];
|
|
1688
|
+
}
|
|
1689
|
+
return Object.assign(Object.assign({}, objDef), { visibleStates, enabledStates });
|
|
1690
|
+
});
|
|
1691
|
+
for (const actionReceived of formActions) {
|
|
1692
|
+
const globalAction = new FormAction(actionReceived, this._formConfig);
|
|
1693
|
+
const globalActionCode = globalAction.actionCode;
|
|
1694
|
+
if (globalActionCode) {
|
|
1695
|
+
this._actionArray.push(globalAction);
|
|
1696
|
+
this._actions[globalActionCode] = globalAction;
|
|
1691
1697
|
}
|
|
1692
1698
|
}
|
|
1693
1699
|
}
|
|
@@ -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(
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
const
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
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
|
-
|
|
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 (
|
|
1881
|
-
|
|
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 (
|
|
1885
|
-
|
|
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
|
-
|
|
1853
|
+
codes = this.getFieldNames();
|
|
1890
1854
|
}
|
|
1891
|
-
|
|
1892
|
-
return fieldUniverse;
|
|
1893
|
-
}
|
|
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
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
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
|
|
1875
|
+
return processedFields;
|
|
1917
1876
|
}
|
|
1918
|
-
|
|
1919
|
-
return this.
|
|
1877
|
+
enableFields(codes, secCode, subCode) {
|
|
1878
|
+
return this.applyOnFields(fld => fld.enable(), codes, secCode, subCode);
|
|
1920
1879
|
}
|
|
1921
|
-
|
|
1922
|
-
return this.
|
|
1880
|
+
showFields(codes, secCode, subCode) {
|
|
1881
|
+
return this.applyOnFields(fld => fld.show(), codes, secCode, subCode);
|
|
1923
1882
|
}
|
|
1924
|
-
|
|
1925
|
-
return this.
|
|
1883
|
+
hideFields(codes, secCode, subCode) {
|
|
1884
|
+
return this.applyOnFields(fld => fld.hide(), codes, secCode, subCode);
|
|
1926
1885
|
}
|
|
1927
|
-
|
|
1928
|
-
return this.
|
|
1886
|
+
showLabelFields(codes, secCode, subCode) {
|
|
1887
|
+
return this.applyOnFields(fld => fld.showLablel(), codes, secCode, subCode);
|
|
1929
1888
|
}
|
|
1930
|
-
|
|
1931
|
-
|
|
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
|
-
|
|
1935
|
-
|
|
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
|
-
|
|
1939
|
-
return this.
|
|
1895
|
+
cleanFields(codes, secCode, subCode) {
|
|
1896
|
+
return this.applyOnFields(fld => fld.clean(), codes, secCode, subCode);
|
|
1940
1897
|
}
|
|
1941
|
-
|
|
1942
|
-
return this.
|
|
1898
|
+
tagFieldsWithError(message, codes, secCode, subCode) {
|
|
1899
|
+
return this.applyOnFields(fld => fld.setErrorMessage(message), codes, secCode, subCode);
|
|
1943
1900
|
}
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
fieldObject.clean('');
|
|
1947
|
-
fieldObject.setErrorMessage('');
|
|
1948
|
-
}, fieldArray, sectionCode, subSectionCode);
|
|
1901
|
+
cleanErrorFields(codes, secCode, subCode) {
|
|
1902
|
+
this.tagFieldsWithError('', codes, secCode, subCode);
|
|
1949
1903
|
}
|
|
1950
|
-
|
|
1951
|
-
return this.
|
|
1904
|
+
tagEmptyRequiredFields(message, codes = null, secCode, subCode) {
|
|
1905
|
+
return this.tagFieldsWithError(message, this.getRequiredEmptyFields(codes, secCode, subCode)) > 0;
|
|
1952
1906
|
}
|
|
1953
|
-
|
|
1954
|
-
return this.getFieldSet(fld => fld.
|
|
1907
|
+
getRequiredFields(codes, secCode, subCode) {
|
|
1908
|
+
return this.getFieldSet(fld => fld.required, codes, secCode, subCode);
|
|
1955
1909
|
}
|
|
1956
|
-
|
|
1957
|
-
return this.getFieldSet(fld =>
|
|
1910
|
+
getRequiredEmptyFields(codes, secCode, subCode) {
|
|
1911
|
+
return this.getFieldSet(fld => fld.required && fld.empty, codes, secCode, subCode);
|
|
1958
1912
|
}
|
|
1959
|
-
|
|
1960
|
-
return this.getFieldSet(fld => fld.
|
|
1913
|
+
getChangedFields(codes, secCode, subCode) {
|
|
1914
|
+
return this.getFieldSet(fld => !fld.outputOnly && fld.hasChanged(), codes, secCode, subCode);
|
|
1961
1915
|
}
|
|
1962
|
-
|
|
1963
|
-
return this.
|
|
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
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
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
|
|
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.
|
|
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(
|
|
2029
|
-
hideSections(
|
|
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
|
-
|
|
2071
|
-
|
|
2072
|
-
recordField.setValue(recordField.defaultValue);
|
|
2073
|
-
}
|
|
2021
|
+
for (const field of this._fieldArray) {
|
|
2022
|
+
field.setValue(field.defaultValue);
|
|
2074
2023
|
}
|
|
2075
|
-
|
|
2076
|
-
|
|
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
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
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.
|
|
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
|
-
|
|
2262
|
-
var _a;
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
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.
|
|
2510
|
+
this._formStructure = null;
|
|
2351
2511
|
this.fields = null;
|
|
2352
2512
|
this.actions = null;
|
|
2353
|
-
this.
|
|
2513
|
+
this._controlToken = null;
|
|
2354
2514
|
this.inputDataFields = {};
|
|
2355
|
-
this.
|
|
2515
|
+
this._definitionObtained = false;
|
|
2356
2516
|
// Se limpian los manejadores de eventos
|
|
2357
|
-
this.
|
|
2517
|
+
this.visible = false;
|
|
2358
2518
|
this.busy = false;
|
|
2359
|
-
this.
|
|
2360
|
-
this.
|
|
2361
|
-
this.
|
|
2362
|
-
this.
|
|
2363
|
-
this.
|
|
2364
|
-
this.
|
|
2365
|
-
this.
|
|
2366
|
-
this.
|
|
2367
|
-
this.
|
|
2368
|
-
this.
|
|
2369
|
-
this.
|
|
2370
|
-
this.
|
|
2371
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
2475
|
-
const { token, subject, state, fields, extra, originToken } = this.formManagerService.getFormInfo(this.
|
|
2476
|
-
if (!this.
|
|
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.
|
|
2643
|
+
this._originToken = originToken;
|
|
2483
2644
|
return state;
|
|
2484
2645
|
}
|
|
2485
2646
|
subscribeSectionActivation() {
|
|
2486
|
-
const formSections = this.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
2541
|
-
this.fields = this.
|
|
2542
|
-
this.actions = this.
|
|
2543
|
-
this.
|
|
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.
|
|
2710
|
+
initialState = this._formStructure.defaultState;
|
|
2550
2711
|
}
|
|
2551
|
-
this.
|
|
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.
|
|
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.
|
|
2750
|
+
currentMode: this._formStructure.state,
|
|
2589
2751
|
actionCode,
|
|
2590
2752
|
actionSubject,
|
|
2591
2753
|
version: PAYLOAD_VERSION,
|
|
2592
|
-
formData: this.
|
|
2593
|
-
immutableData: this.
|
|
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.
|
|
2649
|
-
this.
|
|
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(
|
|
2655
|
-
const sectionSet = (Array.isArray(
|
|
2816
|
+
addSectionActivation(sectionCodes, callbackMethod) {
|
|
2817
|
+
const sectionSet = (Array.isArray(sectionCodes)) ? sectionCodes : [sectionCodes];
|
|
2656
2818
|
sectionSet.forEach((sectionName) => {
|
|
2657
|
-
if (!this.
|
|
2658
|
-
this.
|
|
2819
|
+
if (!this._formSectionsActivate[sectionName]) {
|
|
2820
|
+
this._formSectionsActivate[sectionName] = [];
|
|
2659
2821
|
}
|
|
2660
|
-
this.
|
|
2822
|
+
this._formSectionsActivate[sectionName].push(callbackMethod);
|
|
2661
2823
|
});
|
|
2662
2824
|
}
|
|
2663
|
-
addSectionInactivation(
|
|
2664
|
-
const sectionSet = (Array.isArray(
|
|
2825
|
+
addSectionInactivation(sectionCodes, callbackMethod) {
|
|
2826
|
+
const sectionSet = (Array.isArray(sectionCodes)) ? sectionCodes : [sectionCodes];
|
|
2665
2827
|
sectionSet.forEach((sectionName) => {
|
|
2666
|
-
if (!this.
|
|
2667
|
-
this.
|
|
2828
|
+
if (!this._formSectionsInactivate[sectionName]) {
|
|
2829
|
+
this._formSectionsInactivate[sectionName] = [];
|
|
2668
2830
|
}
|
|
2669
|
-
this.
|
|
2831
|
+
this._formSectionsInactivate[sectionName].push(callbackMethod);
|
|
2670
2832
|
});
|
|
2671
2833
|
}
|
|
2672
2834
|
addActionMethodStart(actions, callbackMethod) {
|
|
2673
2835
|
const actionSet = (Array.isArray(actions)) ? actions : [actions];
|
|
2674
2836
|
actionSet.forEach((actionName) => {
|
|
2675
|
-
if (!this.
|
|
2676
|
-
this.
|
|
2837
|
+
if (!this._formActionsStart[actionName]) {
|
|
2838
|
+
this._formActionsStart[actionName] = [];
|
|
2677
2839
|
}
|
|
2678
|
-
this.
|
|
2840
|
+
this._formActionsStart[actionName].push(callbackMethod);
|
|
2679
2841
|
});
|
|
2680
2842
|
}
|
|
2681
2843
|
addActionMethodFinish(actions, callbackMethod) {
|
|
2682
2844
|
const actionSet = (Array.isArray(actions)) ? actions : [actions];
|
|
2683
2845
|
actionSet.forEach((actionName) => {
|
|
2684
|
-
if (!this.
|
|
2685
|
-
this.
|
|
2846
|
+
if (!this._formActionsFinish[actionName]) {
|
|
2847
|
+
this._formActionsFinish[actionName] = [];
|
|
2686
2848
|
}
|
|
2687
|
-
this.
|
|
2849
|
+
this._formActionsFinish[actionName].push(callbackMethod);
|
|
2688
2850
|
});
|
|
2689
2851
|
}
|
|
2690
|
-
launchSectionActivation(
|
|
2852
|
+
launchSectionActivation(code) {
|
|
2691
2853
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2692
|
-
const sectionObject = this.
|
|
2854
|
+
const sectionObject = this._formStructure.getSection(code);
|
|
2693
2855
|
if (!sectionObject) {
|
|
2694
2856
|
return;
|
|
2695
2857
|
}
|
|
2696
|
-
const clientSectionMethods = this.
|
|
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(
|
|
2866
|
+
launchSectionInactivation(code) {
|
|
2705
2867
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2706
|
-
const sectionObject = this.
|
|
2868
|
+
const sectionObject = this._formStructure.getSection(code);
|
|
2707
2869
|
if (!sectionObject) {
|
|
2708
2870
|
return;
|
|
2709
2871
|
}
|
|
2710
|
-
const clientSectionMethods = this.
|
|
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(
|
|
2880
|
+
startAction(code) {
|
|
2719
2881
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2720
|
-
const actionObject = this.getAction(
|
|
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.
|
|
2888
|
+
const clientActionMethods = this._formActionsStart[code];
|
|
2727
2889
|
if (clientActionMethods) {
|
|
2728
2890
|
const clientActionPromises = [];
|
|
2729
2891
|
for (const clientActionMethod of clientActionMethods) {
|
|
@@ -2760,20 +2922,20 @@ class BasicFormComponent {
|
|
|
2760
2922
|
action.stop();
|
|
2761
2923
|
});
|
|
2762
2924
|
}
|
|
2763
|
-
finishAction(
|
|
2925
|
+
finishAction(action, actionResult) {
|
|
2764
2926
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2765
|
-
const finishActionMethods = this.
|
|
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(
|
|
2931
|
+
clientActionPromises.push(clientActionMethod(action, actionResult));
|
|
2770
2932
|
}
|
|
2771
2933
|
yield Promise.all(clientActionPromises);
|
|
2772
2934
|
}
|
|
2773
2935
|
});
|
|
2774
2936
|
}
|
|
2775
|
-
completeGlobalAction(
|
|
2776
|
-
return this.startServerAction(
|
|
2937
|
+
completeGlobalAction(action) {
|
|
2938
|
+
return this.startServerAction(action);
|
|
2777
2939
|
}
|
|
2778
2940
|
/**
|
|
2779
2941
|
* Manejadores de eventos para validaciones sobre campos
|
|
@@ -2781,28 +2943,28 @@ class BasicFormComponent {
|
|
|
2781
2943
|
addFieldInputValidation(fields, callbackMethod) {
|
|
2782
2944
|
const fieldSet = (Array.isArray(fields)) ? fields : [fields];
|
|
2783
2945
|
fieldSet.forEach((fieldCode) => {
|
|
2784
|
-
if (!this.
|
|
2785
|
-
this.
|
|
2946
|
+
if (!this._fieldInputValidation[fieldCode]) {
|
|
2947
|
+
this._fieldInputValidation[fieldCode] = [];
|
|
2786
2948
|
}
|
|
2787
|
-
this.
|
|
2949
|
+
this._fieldInputValidation[fieldCode].push(callbackMethod);
|
|
2788
2950
|
});
|
|
2789
2951
|
}
|
|
2790
2952
|
addFieldValidationStart(fields, callbackMethod) {
|
|
2791
2953
|
const fieldSet = (Array.isArray(fields)) ? fields : [fields];
|
|
2792
2954
|
fieldSet.forEach((fieldCode) => {
|
|
2793
|
-
if (!this.
|
|
2794
|
-
this.
|
|
2955
|
+
if (!this._fieldValidationsStart[fieldCode]) {
|
|
2956
|
+
this._fieldValidationsStart[fieldCode] = [];
|
|
2795
2957
|
}
|
|
2796
|
-
this.
|
|
2958
|
+
this._fieldValidationsStart[fieldCode].push(callbackMethod);
|
|
2797
2959
|
});
|
|
2798
2960
|
}
|
|
2799
2961
|
addFieldValidationFinish(fields, callbackMethod) {
|
|
2800
2962
|
const fieldSet = (Array.isArray(fields)) ? fields : [fields];
|
|
2801
2963
|
fieldSet.forEach((fieldCode) => {
|
|
2802
|
-
if (!this.
|
|
2803
|
-
this.
|
|
2964
|
+
if (!this._fieldValidationsFinish[fieldCode]) {
|
|
2965
|
+
this._fieldValidationsFinish[fieldCode] = [];
|
|
2804
2966
|
}
|
|
2805
|
-
this.
|
|
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.
|
|
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.
|
|
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.
|
|
3036
|
+
const validationCallbacks = this._fieldValidationsFinish[fieldObject.fieldCode];
|
|
2875
3037
|
if (validationCallbacks) {
|
|
2876
3038
|
const clientActionPromises = [];
|
|
2877
3039
|
for (const validationMethod of validationCallbacks) {
|
|
@@ -2899,12 +3061,12 @@ class BasicFormComponent {
|
|
|
2899
3061
|
return;
|
|
2900
3062
|
}
|
|
2901
3063
|
let tableEventHandlers = null;
|
|
2902
|
-
if (this.
|
|
2903
|
-
tableEventHandlers = this.
|
|
3064
|
+
if (this._tableActionsStart[tableName]) {
|
|
3065
|
+
tableEventHandlers = this._tableActionsStart[tableName];
|
|
2904
3066
|
}
|
|
2905
3067
|
else {
|
|
2906
3068
|
tableEventHandlers = {};
|
|
2907
|
-
this.
|
|
3069
|
+
this._tableActionsStart[tableName] = tableEventHandlers;
|
|
2908
3070
|
}
|
|
2909
3071
|
if (!tableEventHandlers[actionCode]) {
|
|
2910
3072
|
tableEventHandlers[actionCode] = [];
|
|
@@ -2921,12 +3083,12 @@ class BasicFormComponent {
|
|
|
2921
3083
|
return;
|
|
2922
3084
|
}
|
|
2923
3085
|
let tableEventHandlers = null;
|
|
2924
|
-
if (this.
|
|
2925
|
-
tableEventHandlers = this.
|
|
3086
|
+
if (this._tableActionsFinish[tableName]) {
|
|
3087
|
+
tableEventHandlers = this._tableActionsFinish[tableName];
|
|
2926
3088
|
}
|
|
2927
3089
|
else {
|
|
2928
3090
|
tableEventHandlers = {};
|
|
2929
|
-
this.
|
|
3091
|
+
this._tableActionsFinish[tableName] = tableEventHandlers;
|
|
2930
3092
|
}
|
|
2931
3093
|
if (!tableEventHandlers[actionCode]) {
|
|
2932
3094
|
tableEventHandlers[actionCode] = [];
|
|
@@ -2939,12 +3101,12 @@ class BasicFormComponent {
|
|
|
2939
3101
|
return;
|
|
2940
3102
|
}
|
|
2941
3103
|
let tableEventHandlers = null;
|
|
2942
|
-
if (this.
|
|
2943
|
-
tableEventHandlers = this.
|
|
3104
|
+
if (this._tableSelectionsStart[tableName]) {
|
|
3105
|
+
tableEventHandlers = this._tableSelectionsStart[tableName];
|
|
2944
3106
|
}
|
|
2945
3107
|
else {
|
|
2946
3108
|
tableEventHandlers = [];
|
|
2947
|
-
this.
|
|
3109
|
+
this._tableSelectionsStart[tableName] = tableEventHandlers;
|
|
2948
3110
|
}
|
|
2949
3111
|
tableEventHandlers.push(callbackMethod);
|
|
2950
3112
|
}
|
|
@@ -2954,12 +3116,12 @@ class BasicFormComponent {
|
|
|
2954
3116
|
return;
|
|
2955
3117
|
}
|
|
2956
3118
|
let tableEventHandlers = null;
|
|
2957
|
-
if (this.
|
|
2958
|
-
tableEventHandlers = this.
|
|
3119
|
+
if (this._tableSelectionsFinish[tableName]) {
|
|
3120
|
+
tableEventHandlers = this._tableSelectionsFinish[tableName];
|
|
2959
3121
|
}
|
|
2960
3122
|
else {
|
|
2961
3123
|
tableEventHandlers = [];
|
|
2962
|
-
this.
|
|
3124
|
+
this._tableSelectionsFinish[tableName] = tableEventHandlers;
|
|
2963
3125
|
}
|
|
2964
3126
|
tableEventHandlers.push(callbackMethod);
|
|
2965
3127
|
}
|
|
@@ -2969,12 +3131,12 @@ class BasicFormComponent {
|
|
|
2969
3131
|
return;
|
|
2970
3132
|
}
|
|
2971
3133
|
let tableEventHandlers = null;
|
|
2972
|
-
if (this.
|
|
2973
|
-
tableEventHandlers = this.
|
|
3134
|
+
if (this._tableGetDataStart[tableName]) {
|
|
3135
|
+
tableEventHandlers = this._tableGetDataStart[tableName];
|
|
2974
3136
|
}
|
|
2975
3137
|
else {
|
|
2976
3138
|
tableEventHandlers = [];
|
|
2977
|
-
this.
|
|
3139
|
+
this._tableGetDataStart[tableName] = tableEventHandlers;
|
|
2978
3140
|
}
|
|
2979
3141
|
tableEventHandlers.push(callbackMethod);
|
|
2980
3142
|
}
|
|
@@ -2984,12 +3146,12 @@ class BasicFormComponent {
|
|
|
2984
3146
|
return;
|
|
2985
3147
|
}
|
|
2986
3148
|
let tableEventHandlers = null;
|
|
2987
|
-
if (this.
|
|
2988
|
-
tableEventHandlers = this.
|
|
3149
|
+
if (this._tableGetDataFinish[tableName]) {
|
|
3150
|
+
tableEventHandlers = this._tableGetDataFinish[tableName];
|
|
2989
3151
|
}
|
|
2990
3152
|
else {
|
|
2991
3153
|
tableEventHandlers = {};
|
|
2992
|
-
this.
|
|
3154
|
+
this._tableGetDataFinish[tableName] = 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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
3521
|
+
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3360
3522
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[tableActionCode] : null;
|
|
3361
3523
|
if (tableActionMethods) {
|
|
3362
3524
|
const clientActionPromises = [];
|