tuain-ng-forms-lib 12.0.21 → 12.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bundles/tuain-ng-forms-lib.umd.js +1533 -1576
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/action.js +3 -4
- package/esm2015/lib/classes/forms/element.js +14 -2
- package/esm2015/lib/classes/forms/field.js +14 -22
- package/esm2015/lib/classes/forms/form.js +243 -393
- package/esm2015/lib/classes/forms/section.js +7 -1
- package/esm2015/lib/classes/forms/table/row-data.js +6 -26
- package/esm2015/lib/classes/forms/table/table.js +3 -4
- package/esm2015/lib/components/elements/layout/element.component.js +2 -1
- package/esm2015/lib/components/elements/tables/table.component.js +31 -31
- package/esm2015/lib/components/forms/basic-form.js +500 -274
- package/fesm2015/tuain-ng-forms-lib.js +1005 -992
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/action.d.ts +0 -2
- package/lib/classes/forms/element.d.ts +16 -6
- package/lib/classes/forms/field.d.ts +4 -3
- package/lib/classes/forms/form.d.ts +105 -92
- package/lib/classes/forms/section.d.ts +5 -0
- package/lib/classes/forms/table/row-data.d.ts +0 -1
- package/lib/classes/forms/table/table.d.ts +0 -1
- package/lib/components/elements/layout/element.component.d.ts +1 -0
- package/lib/components/elements/tables/table.component.d.ts +1 -1
- package/lib/components/forms/basic-form.d.ts +188 -152
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
- package/esm2015/lib/classes/utilities.js +0 -54
- package/lib/classes/utilities.d.ts +0 -1
|
@@ -164,6 +164,7 @@ ElementComponent.decorators = [
|
|
|
164
164
|
];
|
|
165
165
|
ElementComponent.propDecorators = {
|
|
166
166
|
element: [{ type: Input }],
|
|
167
|
+
form: [{ type: Input }],
|
|
167
168
|
currentState: [{ type: Input }]
|
|
168
169
|
};
|
|
169
170
|
|
|
@@ -284,7 +285,7 @@ const operators = {
|
|
|
284
285
|
|
|
285
286
|
class FormElement {
|
|
286
287
|
constructor(elementDefinition, formConfig) {
|
|
287
|
-
var _a, _b;
|
|
288
|
+
var _a, _b, _c;
|
|
288
289
|
this._formConfig = formConfig;
|
|
289
290
|
this._isForced = false;
|
|
290
291
|
this.setVisibleStates(elementDefinition.visibleStates);
|
|
@@ -293,7 +294,13 @@ class FormElement {
|
|
|
293
294
|
this.disabled = (_a = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.disabled) !== null && _a !== void 0 ? _a : false;
|
|
294
295
|
this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
|
|
295
296
|
this.widget = null;
|
|
297
|
+
this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : null;
|
|
296
298
|
}
|
|
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) { if (name) {
|
|
301
|
+
this.customAttributes[name] = value;
|
|
302
|
+
} }
|
|
303
|
+
matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
|
|
297
304
|
isField() { return this.elementType === elementTypes.field; }
|
|
298
305
|
isAction() { return this.elementType === elementTypes.action; }
|
|
299
306
|
isTable() { return this.elementType === elementTypes.table; }
|
|
@@ -311,7 +318,13 @@ class FormElement {
|
|
|
311
318
|
}
|
|
312
319
|
viewOnState(state) { return (this.visibleStates && state) ? this.visibleStates.includes(state) : false; }
|
|
313
320
|
enabledOnState(state) { return (this.enabledStates && state) ? this.enabledStates.includes(state) : false; }
|
|
321
|
+
/**
|
|
322
|
+
* @deprecated Utilizar viewOnState
|
|
323
|
+
*/
|
|
314
324
|
supportState(state) { return this.viewOnState(state); }
|
|
325
|
+
/**
|
|
326
|
+
* @deprecated Utilizar viewOnState
|
|
327
|
+
*/
|
|
315
328
|
supportMode(state) { return this.viewOnState(state); }
|
|
316
329
|
get visible() { return (this._isForced) ? this._visibleForced : this._visible; }
|
|
317
330
|
set visible(visible) { this.setVisibility(visible); }
|
|
@@ -388,62 +401,6 @@ class TableAction {
|
|
|
388
401
|
enabledOnState(state) { return this.enabledStates.includes(state); }
|
|
389
402
|
}
|
|
390
403
|
|
|
391
|
-
function formatCurrency(inputValue) {
|
|
392
|
-
if (!inputValue) {
|
|
393
|
-
return null;
|
|
394
|
-
}
|
|
395
|
-
const numeralDecimalMark = '.';
|
|
396
|
-
const numeralPositiveOnly = false;
|
|
397
|
-
const stripLeadingZeroes = true;
|
|
398
|
-
const numeralIntegerScale = 12;
|
|
399
|
-
const numeralDecimalScale = 2;
|
|
400
|
-
const delimiter = ',';
|
|
401
|
-
let parts;
|
|
402
|
-
let partInteger;
|
|
403
|
-
let partDecimal = '';
|
|
404
|
-
// Se eliminan los caracteres alfabéticos
|
|
405
|
-
let outputValue = inputValue.toString();
|
|
406
|
-
if (!outputValue) {
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Se remplaza el primer caracter de marca decimal con el marcador reservado
|
|
411
|
-
* Se eliminan los caractertes no numéricos excepto el signo menos y 'M'
|
|
412
|
-
* utilizado como separador decimal en este punto, eliminando los prefijos
|
|
413
|
-
* Se remplaza el caracter menos por un marcador resertvado
|
|
414
|
-
* Se eliminan todos los demás caracteres menos en caso de estar presentes
|
|
415
|
-
* Se remplaza el marcador de caracter menos (si está presente)
|
|
416
|
-
* Se remplaza el marcador de separación decimal
|
|
417
|
-
*/
|
|
418
|
-
let value = outputValue.replace(/[A-Za-z]/g, '')
|
|
419
|
-
.replace(numeralDecimalMark, 'M')
|
|
420
|
-
.replace(/[^\dM-]/g, '')
|
|
421
|
-
.replace(/^\-/, 'N')
|
|
422
|
-
.replace(/\-/g, '')
|
|
423
|
-
.replace('N', numeralPositiveOnly ? '' : '-')
|
|
424
|
-
.replace('M', numeralDecimalMark);
|
|
425
|
-
// Se eliminan los ceros a la izquierda
|
|
426
|
-
if (stripLeadingZeroes) {
|
|
427
|
-
value = value.replace(/^(-)?0+(?=\d)/, '$1');
|
|
428
|
-
}
|
|
429
|
-
// Se separa la parte entera de la parte decimal
|
|
430
|
-
partInteger = value;
|
|
431
|
-
if (value.indexOf(numeralDecimalMark) >= 0) {
|
|
432
|
-
parts = value.split(numeralDecimalMark);
|
|
433
|
-
partInteger = parts[0];
|
|
434
|
-
partDecimal = numeralDecimalMark + parts[1].slice(0, numeralDecimalScale);
|
|
435
|
-
}
|
|
436
|
-
if (numeralIntegerScale > 0) {
|
|
437
|
-
partInteger = partInteger.slice(0, numeralIntegerScale + (value.slice(0, 1) === '-' ? 1 : 0));
|
|
438
|
-
}
|
|
439
|
-
// Se separan los digitos de acuerdo a la configuraciñon de agrupación
|
|
440
|
-
partInteger = partInteger.replace(/(\d)(?=(\d{3})+$)/g, '$1' + delimiter);
|
|
441
|
-
outputValue = partInteger.toString() + (numeralDecimalScale > 0 ? partDecimal.toString() : '');
|
|
442
|
-
return outputValue;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
const DATE_TYPE = 'DATE';
|
|
446
|
-
const CURRENCY_TYPE = 'CURRENCY';
|
|
447
404
|
class TableRecordData {
|
|
448
405
|
constructor(recordReceived, recordDefinition, selectionFieldName = null) {
|
|
449
406
|
this.recordData = {};
|
|
@@ -460,8 +417,7 @@ class TableRecordData {
|
|
|
460
417
|
rawRecordData.forEach(fieldData => {
|
|
461
418
|
const { fieldCode, fieldValue } = fieldData;
|
|
462
419
|
const fieldDef = recordDefinition.find(column => column.fieldCode === fieldCode);
|
|
463
|
-
|
|
464
|
-
this.recordData[fieldCode] = formattedFieldValue;
|
|
420
|
+
this.recordData[fieldCode] = fieldValue !== null && fieldValue !== void 0 ? fieldValue : '';
|
|
465
421
|
if (fieldCode === selectionFieldName) {
|
|
466
422
|
this.selected = fieldValue;
|
|
467
423
|
}
|
|
@@ -472,29 +428,13 @@ class TableRecordData {
|
|
|
472
428
|
fields.forEach(fieldCode => {
|
|
473
429
|
const fieldValue = recordData[fieldCode];
|
|
474
430
|
const fieldDef = recordDefinition.find(column => column.fieldCode === fieldCode);
|
|
475
|
-
|
|
476
|
-
this.recordData[fieldCode] = formattedFieldValue;
|
|
431
|
+
this.recordData[fieldCode] = fieldValue !== null && fieldValue !== void 0 ? fieldValue : '';
|
|
477
432
|
});
|
|
478
433
|
}
|
|
479
434
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
}
|
|
484
|
-
else if (fieldType === DATE_TYPE && fieldValue) {
|
|
485
|
-
return new Date(fieldValue).toISOString().split('T')[0];
|
|
486
|
-
}
|
|
487
|
-
return fieldValue || '';
|
|
488
|
-
}
|
|
489
|
-
toggleSelect() {
|
|
490
|
-
this.selected = !this.selected;
|
|
491
|
-
}
|
|
492
|
-
select() {
|
|
493
|
-
this.selected = true;
|
|
494
|
-
}
|
|
495
|
-
unselect() {
|
|
496
|
-
this.selected = false;
|
|
497
|
-
}
|
|
435
|
+
toggleSelect() { this.selected = !this.selected; }
|
|
436
|
+
select() { this.selected = true; }
|
|
437
|
+
unselect() { this.selected = false; }
|
|
498
438
|
get recordIdKey() {
|
|
499
439
|
return (typeof this.recordId === 'object')
|
|
500
440
|
? JSON.stringify(this.recordId) : this.recordId;
|
|
@@ -575,7 +515,7 @@ const TABLE_FILTER_TYPES = {
|
|
|
575
515
|
};
|
|
576
516
|
class RecordTable extends FormElement {
|
|
577
517
|
constructor(tableReceived, formConfig) {
|
|
578
|
-
var _a, _b, _c, _d, _e, _f
|
|
518
|
+
var _a, _b, _c, _d, _e, _f;
|
|
579
519
|
super(tableReceived, formConfig);
|
|
580
520
|
this._inlineActionTrigger = new Subject();
|
|
581
521
|
this._globalActionTrigger = new Subject();
|
|
@@ -608,8 +548,7 @@ class RecordTable extends FormElement {
|
|
|
608
548
|
this._appendPages = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.append) !== null && _c !== void 0 ? _c : false;
|
|
609
549
|
this.selectable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _d !== void 0 ? _d : false;
|
|
610
550
|
this.setAttr('selectionBackend', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _e !== void 0 ? _e : false);
|
|
611
|
-
this.
|
|
612
|
-
this.setAttr('sortable', (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false);
|
|
551
|
+
this.setAttr('sortable', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _f !== void 0 ? _f : false);
|
|
613
552
|
this.setAttr('sorting', { columnName: '', direction: '' });
|
|
614
553
|
this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
|
|
615
554
|
if (tableReceived.fields) {
|
|
@@ -1050,23 +989,23 @@ class LibTableComponent {
|
|
|
1050
989
|
}
|
|
1051
990
|
ngOnInit() {
|
|
1052
991
|
var _a, _b;
|
|
1053
|
-
if (this.
|
|
1054
|
-
this.formConfig = (_a = this.
|
|
992
|
+
if (this.table) {
|
|
993
|
+
this.formConfig = (_a = this.table) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
1055
994
|
this.tableFieldStyles = this.formConfig.tableFieldStyles;
|
|
1056
|
-
this.selectable = this.
|
|
1057
|
-
this.hasActions = this.
|
|
1058
|
-
this.
|
|
1059
|
-
this.inlineActions = this.
|
|
1060
|
-
this.globalActions = this.
|
|
1061
|
-
this.selectionActions = this.
|
|
995
|
+
this.selectable = this.table.selectable;
|
|
996
|
+
this.hasActions = this.table.hasActions;
|
|
997
|
+
this.table.widget = this;
|
|
998
|
+
this.inlineActions = this.table.getActions(this.formConfig.tableActions.inline);
|
|
999
|
+
this.globalActions = this.table.getActions(this.formConfig.tableActions.global);
|
|
1000
|
+
this.selectionActions = this.table.getActions(this.formConfig.tableActions.selection);
|
|
1062
1001
|
// Inicialización de campos mapeados del objeto
|
|
1063
1002
|
const mapping = Object.entries(this.formConfig.componentTableAttrMap);
|
|
1064
1003
|
for (let index = 0; index < mapping.length; index++) {
|
|
1065
1004
|
const [tableAttr, compAttr] = mapping[index];
|
|
1066
|
-
this[compAttr.toString()] = (_b = this.
|
|
1005
|
+
this[compAttr.toString()] = (_b = this.table) === null || _b === void 0 ? void 0 : _b[tableAttr.toString()];
|
|
1067
1006
|
}
|
|
1068
1007
|
// Subscripción a cambios en atributos
|
|
1069
|
-
this.
|
|
1008
|
+
this.table.attributeChange.subscribe(event => {
|
|
1070
1009
|
const { name: tableAttr, value } = event;
|
|
1071
1010
|
const compAttr = this.formConfig.componentTableAttrMap[tableAttr];
|
|
1072
1011
|
this.hasOwnProperty(compAttr) && (this[compAttr] = value);
|
|
@@ -1076,24 +1015,24 @@ class LibTableComponent {
|
|
|
1076
1015
|
}
|
|
1077
1016
|
start() { }
|
|
1078
1017
|
tableGlobalAction(actionCode) {
|
|
1079
|
-
this.
|
|
1018
|
+
this.table.notifyGlobalAction(actionCode);
|
|
1080
1019
|
}
|
|
1081
1020
|
tableSelectionAction(actionCode) {
|
|
1082
|
-
this.
|
|
1021
|
+
this.table.notifySelectionAction(actionCode);
|
|
1083
1022
|
}
|
|
1084
1023
|
tableActionSelected(actionEvent) {
|
|
1085
|
-
this.
|
|
1024
|
+
this.table.notifyInlineAction(actionEvent);
|
|
1086
1025
|
}
|
|
1087
1026
|
tableColumnSort(columnFieldCode) {
|
|
1088
|
-
this.
|
|
1027
|
+
this.table.setRequiredOrder(columnFieldCode);
|
|
1089
1028
|
if (this.clientPaging) {
|
|
1090
|
-
return this.
|
|
1029
|
+
return this.table.localSortData();
|
|
1091
1030
|
}
|
|
1092
|
-
this.
|
|
1031
|
+
this.table.notifyGetDataAction();
|
|
1093
1032
|
}
|
|
1094
1033
|
changePage(requestedPage) {
|
|
1095
1034
|
if (!this.clientPaging) {
|
|
1096
|
-
this.
|
|
1035
|
+
this.table.notifyGetDataAction(requestedPage);
|
|
1097
1036
|
}
|
|
1098
1037
|
}
|
|
1099
1038
|
get records() {
|
|
@@ -1109,45 +1048,45 @@ class LibTableComponent {
|
|
|
1109
1048
|
const { eventType } = tableFilterEvent;
|
|
1110
1049
|
let triggerDataUpdate = false;
|
|
1111
1050
|
if (eventType === TABLE_FILTER_TYPES.simpleFilterChange || eventType === TABLE_FILTER_TYPES.simpleFilterFinish) {
|
|
1112
|
-
this.
|
|
1051
|
+
this.table.simpleFilterText = tableFilterEvent.simpleFilterString.trim();
|
|
1113
1052
|
if (this.clientPaging) {
|
|
1114
|
-
this.
|
|
1115
|
-
this.
|
|
1053
|
+
this.table.setAttr('currentPage', 1);
|
|
1054
|
+
this.table.updateVisibleRecords();
|
|
1116
1055
|
}
|
|
1117
1056
|
else if (eventType === TABLE_FILTER_TYPES.simpleFilterFinish) {
|
|
1118
1057
|
triggerDataUpdate = true;
|
|
1119
1058
|
}
|
|
1120
1059
|
}
|
|
1121
1060
|
if (eventType === TABLE_FILTER_TYPES.complexFilterAdd) {
|
|
1122
|
-
this.
|
|
1061
|
+
this.table.addFilterRestriction(tableFilterEvent.complexFilterItem);
|
|
1123
1062
|
}
|
|
1124
1063
|
if (eventType === TABLE_FILTER_TYPES.complexFilterRemove) {
|
|
1125
|
-
this.
|
|
1064
|
+
this.table.removeFilterRestriction(tableFilterEvent.itemName);
|
|
1126
1065
|
}
|
|
1127
1066
|
if (triggerDataUpdate) {
|
|
1128
1067
|
const tableGetDataEvent = {
|
|
1129
|
-
tableCode: this.
|
|
1068
|
+
tableCode: this.table.tableCode,
|
|
1130
1069
|
requestedPage: 1,
|
|
1131
1070
|
};
|
|
1132
|
-
this.
|
|
1071
|
+
this.table.notifyGetDataAction(tableGetDataEvent);
|
|
1133
1072
|
}
|
|
1134
1073
|
}
|
|
1135
1074
|
tableSelectionToggle(recordId) {
|
|
1136
|
-
this.
|
|
1075
|
+
this.table.notifyRecordSelection(recordId);
|
|
1137
1076
|
}
|
|
1138
1077
|
toggleSelectAll() {
|
|
1139
1078
|
if (this.allSelected) {
|
|
1140
|
-
this.
|
|
1079
|
+
this.table.unSelectAll();
|
|
1141
1080
|
}
|
|
1142
1081
|
else {
|
|
1143
|
-
this.
|
|
1082
|
+
this.table.selectAll();
|
|
1144
1083
|
}
|
|
1145
1084
|
}
|
|
1146
1085
|
get availableFilters() {
|
|
1147
|
-
return this.
|
|
1086
|
+
return this.table.availableFilters;
|
|
1148
1087
|
}
|
|
1149
1088
|
get selectedRecords() {
|
|
1150
|
-
return this.
|
|
1089
|
+
return this.table.selectedRecords;
|
|
1151
1090
|
}
|
|
1152
1091
|
}
|
|
1153
1092
|
LibTableComponent.decorators = [
|
|
@@ -1158,183 +1097,17 @@ LibTableComponent.decorators = [
|
|
|
1158
1097
|
},] }
|
|
1159
1098
|
];
|
|
1160
1099
|
LibTableComponent.propDecorators = {
|
|
1161
|
-
|
|
1100
|
+
table: [{ type: Input }],
|
|
1162
1101
|
tableRecords: [{ type: Input }],
|
|
1163
1102
|
disabled: [{ type: Input }],
|
|
1164
1103
|
currentState: [{ type: Input }],
|
|
1165
1104
|
waiting: [{ type: Input }]
|
|
1166
1105
|
};
|
|
1167
1106
|
|
|
1168
|
-
class RecordFormSubSection {
|
|
1169
|
-
constructor(subsectionReceived, formObject) {
|
|
1170
|
-
if (!subsectionReceived) {
|
|
1171
|
-
return;
|
|
1172
|
-
}
|
|
1173
|
-
this._customRender = null;
|
|
1174
|
-
this.visible = true;
|
|
1175
|
-
this.subSectionElements = [];
|
|
1176
|
-
this.subSectionFields = [];
|
|
1177
|
-
this.subSectionTables = [];
|
|
1178
|
-
this.subSectionActions = [];
|
|
1179
|
-
this.elementsArray = {};
|
|
1180
|
-
this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
|
|
1181
|
-
this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
|
|
1182
|
-
this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
|
|
1183
|
-
this.visibleStates = subsectionReceived.visibleStates || [];
|
|
1184
|
-
if (subsectionReceived.elements) {
|
|
1185
|
-
for (const receivedElement of subsectionReceived.elements) {
|
|
1186
|
-
let elementObject = null;
|
|
1187
|
-
let arrayToAdd = null;
|
|
1188
|
-
const { type, code } = receivedElement;
|
|
1189
|
-
switch (type) {
|
|
1190
|
-
case elementTypes.field:
|
|
1191
|
-
elementObject = formObject.getFieldObject(code);
|
|
1192
|
-
arrayToAdd = this.subSectionFields;
|
|
1193
|
-
break;
|
|
1194
|
-
case elementTypes.table:
|
|
1195
|
-
elementObject = formObject.getTableObject(code);
|
|
1196
|
-
arrayToAdd = this.subSectionTables;
|
|
1197
|
-
break;
|
|
1198
|
-
case elementTypes.action:
|
|
1199
|
-
elementObject = formObject.getActionObject(code);
|
|
1200
|
-
arrayToAdd = this.subSectionActions;
|
|
1201
|
-
break;
|
|
1202
|
-
}
|
|
1203
|
-
if (elementObject) {
|
|
1204
|
-
elementObject.elementType = type;
|
|
1205
|
-
arrayToAdd.push(elementObject);
|
|
1206
|
-
this.subSectionElements.push(elementObject);
|
|
1207
|
-
this.elementsArray[code] = elementObject;
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
show() { this.visible = true; }
|
|
1213
|
-
hide() { this.visible = false; }
|
|
1214
|
-
get customRender() { return this._customRender; }
|
|
1215
|
-
set customRender(customRenderName) { this._customRender = customRenderName; }
|
|
1216
|
-
getField(name) {
|
|
1217
|
-
return this.subSectionFields.find(fld => fld.name === name);
|
|
1218
|
-
}
|
|
1219
|
-
getFields() {
|
|
1220
|
-
return this.subSectionFields;
|
|
1221
|
-
}
|
|
1222
|
-
getFieldNames() {
|
|
1223
|
-
return this.subSectionFields.map(field => field.fieldCode);
|
|
1224
|
-
}
|
|
1225
|
-
viewOnState(state) {
|
|
1226
|
-
return this.visibleStates.includes(state);
|
|
1227
|
-
}
|
|
1228
|
-
supportMode(state) { return this.viewOnState(state); }
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
class RecordFormSection {
|
|
1232
|
-
constructor(sectionReceived, formObject) {
|
|
1233
|
-
this._activation = new Subject();
|
|
1234
|
-
this._inactivation = new Subject();
|
|
1235
|
-
this.active = false;
|
|
1236
|
-
if (!sectionReceived) {
|
|
1237
|
-
return;
|
|
1238
|
-
}
|
|
1239
|
-
this.visible = true;
|
|
1240
|
-
this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
|
|
1241
|
-
this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
|
|
1242
|
-
this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
|
|
1243
|
-
this.visibleStates = sectionReceived.visibleStates || [];
|
|
1244
|
-
this.subSections = [];
|
|
1245
|
-
this.subSectionsObj = {};
|
|
1246
|
-
if (sectionReceived.subsections) {
|
|
1247
|
-
const subsections = sectionReceived.subsections.map(objDef => {
|
|
1248
|
-
let visibleStates = objDef.visibleStates;
|
|
1249
|
-
if (!visibleStates) {
|
|
1250
|
-
visibleStates = (objDef.subsectionModes || '').split(',')
|
|
1251
|
-
.map(state => state.trim())
|
|
1252
|
-
.filter(state => state.length > 0);
|
|
1253
|
-
}
|
|
1254
|
-
if (!visibleStates || visibleStates.length === 0) {
|
|
1255
|
-
visibleStates = this.visibleStates;
|
|
1256
|
-
}
|
|
1257
|
-
if (objDef.elements && Array.isArray(objDef.elements)) {
|
|
1258
|
-
objDef.elements = objDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
|
|
1259
|
-
}
|
|
1260
|
-
return Object.assign(Object.assign({}, objDef), { visibleStates });
|
|
1261
|
-
});
|
|
1262
|
-
for (const subsectionReceived of subsections) {
|
|
1263
|
-
const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
|
|
1264
|
-
const subsectionCode = subSectionToAdd.subsectionCode;
|
|
1265
|
-
if (subsectionCode) {
|
|
1266
|
-
this.subSections.push(subSectionToAdd);
|
|
1267
|
-
this.subSectionsObj[subsectionCode] = subSectionToAdd;
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
get activation() { return this._activation; }
|
|
1273
|
-
get inactivation() { return this._inactivation; }
|
|
1274
|
-
activate() {
|
|
1275
|
-
if (!this.active) {
|
|
1276
|
-
this.active = true;
|
|
1277
|
-
this._activation.next(this.sectionCode);
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
inactivate() {
|
|
1281
|
-
if (this.active) {
|
|
1282
|
-
this.active = false;
|
|
1283
|
-
this._inactivation.next(this.sectionCode);
|
|
1284
|
-
}
|
|
1285
|
-
}
|
|
1286
|
-
show() { this.visible = true; }
|
|
1287
|
-
hide() { this.visible = false; }
|
|
1288
|
-
get title() { return this.sectionTitle; }
|
|
1289
|
-
set title(title) { this.sectionTitle = title; }
|
|
1290
|
-
getVisibleSubsections(state) {
|
|
1291
|
-
return this.subSections.filter(subSection => {
|
|
1292
|
-
return subSection.visible && subSection.viewOnState(state);
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
getSubsection(subSectionCode) {
|
|
1296
|
-
return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
|
|
1297
|
-
? this.subSectionsObj[subSectionCode] : null;
|
|
1298
|
-
}
|
|
1299
|
-
getFields() {
|
|
1300
|
-
let fieldsArray = [];
|
|
1301
|
-
if (this.subSections && this.subSections.length > 0) {
|
|
1302
|
-
for (const subSection of this.subSections) {
|
|
1303
|
-
fieldsArray = fieldsArray.concat(subSection.getFields());
|
|
1304
|
-
}
|
|
1305
|
-
}
|
|
1306
|
-
return fieldsArray;
|
|
1307
|
-
}
|
|
1308
|
-
getFieldNames() {
|
|
1309
|
-
let fieldsArray = [];
|
|
1310
|
-
if (this.subSections && this.subSections.length > 0) {
|
|
1311
|
-
for (const subSection of this.subSections) {
|
|
1312
|
-
fieldsArray = fieldsArray.concat(subSection.getFieldNames());
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
return fieldsArray;
|
|
1316
|
-
}
|
|
1317
|
-
getField(name) {
|
|
1318
|
-
let field = null;
|
|
1319
|
-
if (this.subSections && this.subSections.length > 0) {
|
|
1320
|
-
for (const subSection of this.subSections) {
|
|
1321
|
-
field = subSection.getField(name);
|
|
1322
|
-
if (field) {
|
|
1323
|
-
return field;
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
return null;
|
|
1328
|
-
}
|
|
1329
|
-
supportState(state) { return this.viewOnState(state); }
|
|
1330
|
-
viewOnState(state) { return this.visibleStates.includes(state); }
|
|
1331
|
-
supportMode(state) { return this.viewOnState(state); }
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
1107
|
const HEADER = 'HEADER';
|
|
1335
1108
|
class FormAction extends FormElement {
|
|
1336
1109
|
constructor(actionDefinition, formConfig) {
|
|
1337
|
-
var _a
|
|
1110
|
+
var _a;
|
|
1338
1111
|
super(actionDefinition, formConfig);
|
|
1339
1112
|
this._actionActivated = new Subject();
|
|
1340
1113
|
this.inProgress = false;
|
|
@@ -1342,10 +1115,9 @@ class FormAction extends FormElement {
|
|
|
1342
1115
|
this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
|
|
1343
1116
|
this.actionName = actionDefinition.actionTitle;
|
|
1344
1117
|
this.iconName = actionDefinition.iconName || this.actionCode;
|
|
1345
|
-
this.location
|
|
1118
|
+
this.setCustomAttribute('location', actionDefinition.position || HEADER);
|
|
1346
1119
|
this.backend = (_a = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _a !== void 0 ? _a : false;
|
|
1347
1120
|
this.newState = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.newState;
|
|
1348
|
-
this.customAttributes = (_b = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.customAttributes) !== null && _b !== void 0 ? _b : null;
|
|
1349
1121
|
this.restrictedOnField = actionDefinition.fieldRestrictedCode ? actionDefinition.fieldRestrictedCode.toString() : '';
|
|
1350
1122
|
this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
|
|
1351
1123
|
this.restrictedOnValue = actionDefinition.valueRestricted || '';
|
|
@@ -1383,7 +1155,6 @@ const fldAttr = {
|
|
|
1383
1155
|
info: 'fieldInfo',
|
|
1384
1156
|
defaultValue: 'defaultValue',
|
|
1385
1157
|
defaultEditable: 'defaultEditable',
|
|
1386
|
-
customAttributes: 'customAttributes',
|
|
1387
1158
|
visibleLabel: 'visibleLabel',
|
|
1388
1159
|
required: 'fieldRequired',
|
|
1389
1160
|
hasChanged: 'hasChanged',
|
|
@@ -1402,7 +1173,7 @@ const fldAttr = {
|
|
|
1402
1173
|
};
|
|
1403
1174
|
class FieldDescriptor extends FormElement {
|
|
1404
1175
|
constructor(inputFieldReceived, formConfig) {
|
|
1405
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
1176
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1406
1177
|
super(inputFieldReceived, formConfig);
|
|
1407
1178
|
this._editionFinish = new Subject();
|
|
1408
1179
|
this._editionPartial = new Subject();
|
|
@@ -1428,18 +1199,17 @@ class FieldDescriptor extends FormElement {
|
|
|
1428
1199
|
}
|
|
1429
1200
|
this.setAttr(fldAttr.format, fieldFormat);
|
|
1430
1201
|
this.setAttr(fldAttr.validateOnServer, (_d = fld.serverAction) !== null && _d !== void 0 ? _d : false);
|
|
1431
|
-
this.setAttr(fldAttr.customAttributes, (_e = fld.customAttributes) !== null && _e !== void 0 ? _e : {});
|
|
1432
1202
|
this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
|
|
1433
1203
|
this.setAttr(fldAttr.defaultEditable, this.enabled);
|
|
1434
|
-
this.setAttr(fldAttr.required, (
|
|
1435
|
-
this.setError(fld.errorCode, fld.errorMessage, (
|
|
1436
|
-
this.setAttr(fldAttr.outputOnly, (
|
|
1437
|
-
const maxLength = (
|
|
1204
|
+
this.setAttr(fldAttr.required, (_e = fld.required) !== null && _e !== void 0 ? _e : false);
|
|
1205
|
+
this.setError(fld.errorCode, fld.errorMessage, (_f = fld.errorType) !== null && _f !== void 0 ? _f : DEFAULT_ERROR_TYPE);
|
|
1206
|
+
this.setAttr(fldAttr.outputOnly, (_g = fld.outputOnly) !== null && _g !== void 0 ? _g : false);
|
|
1207
|
+
const maxLength = (_h = fld.maxLength) !== null && _h !== void 0 ? _h : (this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
1438
1208
|
this.setAttr(fldAttr.maxLength, maxLength);
|
|
1439
|
-
this.setAttr(fldAttr.intrinsicErrorMessage, (
|
|
1209
|
+
this.setAttr(fldAttr.intrinsicErrorMessage, (_j = this._formConfig.fieldTypeErrMsg[this.fieldType]) !== null && _j !== void 0 ? _j : this._formConfig.fieldTypeErrMsg.DEFAULT);
|
|
1440
1210
|
this.setFieldType(fld.fieldTypeCode);
|
|
1441
|
-
this.setEditable((
|
|
1442
|
-
this.setVisibleLabel((
|
|
1211
|
+
this.setEditable((_k = fld.editable) !== null && _k !== void 0 ? _k : true);
|
|
1212
|
+
this.setVisibleLabel((_l = fld.visibleLabel) !== null && _l !== void 0 ? _l : true);
|
|
1443
1213
|
this.setVisibility(fld.visible);
|
|
1444
1214
|
this.setFieldOptions(fld.fieldOptions);
|
|
1445
1215
|
this.setValue(fld.fieldValue || this.defaultValue || '');
|
|
@@ -1449,11 +1219,14 @@ class FieldDescriptor extends FormElement {
|
|
|
1449
1219
|
get attributeChange() { return this._attributeChange; }
|
|
1450
1220
|
get editionPartial() { return this._editionPartial; }
|
|
1451
1221
|
get detailRequest() { return this._detailRequest; }
|
|
1222
|
+
get info() { return this.fieldInfo; }
|
|
1452
1223
|
get validating() { return this._onValidation; }
|
|
1453
1224
|
set validating(isValidating) { this.setAttr(fldAttr.onValidation, isValidating); }
|
|
1454
1225
|
setIntrinsicErrorMessage(message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); }
|
|
1455
1226
|
set intrinsicErrorMessage(message) { this.setIntrinsicErrorMessage(message); }
|
|
1456
1227
|
get fieldValue() { return this.getValue(); }
|
|
1228
|
+
getRequired() { return this.required; }
|
|
1229
|
+
setRequired(required) { this.required = required; }
|
|
1457
1230
|
get required() { return this.fieldRequired; }
|
|
1458
1231
|
set required(required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); }
|
|
1459
1232
|
get maxLength() { return (this._maxLength > 0) ? this._maxLength.toString() : ''; }
|
|
@@ -1494,7 +1267,6 @@ class FieldDescriptor extends FormElement {
|
|
|
1494
1267
|
notifyEditionDetailRequest() {
|
|
1495
1268
|
this._detailRequest.next(this.fieldCode);
|
|
1496
1269
|
}
|
|
1497
|
-
getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
|
|
1498
1270
|
setVisibleLabel(visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); }
|
|
1499
1271
|
showLabel() { this.setVisibleLabel(true); }
|
|
1500
1272
|
hideLabel() { this.setVisibleLabel(false); }
|
|
@@ -1502,7 +1274,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1502
1274
|
changed() { this.setChanged(true); }
|
|
1503
1275
|
getRawValue() { return this._fieldValue; }
|
|
1504
1276
|
setLabel(label) { this.setAttr(fldAttr.title, label); }
|
|
1505
|
-
clean() { this.setValue(this.defaultValue || ''); }
|
|
1277
|
+
clean() { this.setValue(this.defaultValue || ''); this.resetError(); }
|
|
1506
1278
|
get backend() { return this.validateOnServer; }
|
|
1507
1279
|
setEditable(editable = true) { (editable) ? this.enable() : this.disable(); }
|
|
1508
1280
|
hasError() { return this.errorCode !== NO_ERROR; }
|
|
@@ -1519,6 +1291,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1519
1291
|
setErrorCode(code) { this.setError(code, this.errorMessage); }
|
|
1520
1292
|
getErrorMessage() { return this.getError().message; }
|
|
1521
1293
|
setErrorMessage(msg) { this.setError(this.errorCode, msg); }
|
|
1294
|
+
get empty() { return this.isEmpty(); }
|
|
1522
1295
|
isEmpty() {
|
|
1523
1296
|
const fieldCurrentValue = this.getValue();
|
|
1524
1297
|
if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
|
|
@@ -1574,11 +1347,6 @@ class FieldDescriptor extends FormElement {
|
|
|
1574
1347
|
setFieldType(inputFieldType) {
|
|
1575
1348
|
this.setAttr(fldAttr.type, inputFieldType);
|
|
1576
1349
|
}
|
|
1577
|
-
format() {
|
|
1578
|
-
if (this.fieldType === this._formConfig.fieldTypes.currency) {
|
|
1579
|
-
this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
1350
|
setMinValue(minValue) {
|
|
1583
1351
|
var _a, _b, _c;
|
|
1584
1352
|
if (this.fieldType === this._formConfig.fieldTypes.date
|
|
@@ -1688,9 +1456,6 @@ class FieldDescriptor extends FormElement {
|
|
|
1688
1456
|
(_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
|
|
1689
1457
|
}
|
|
1690
1458
|
break;
|
|
1691
|
-
case this._formConfig.fieldTypes.currency:
|
|
1692
|
-
newFinalValue = formatCurrency(newValue);
|
|
1693
|
-
break;
|
|
1694
1459
|
default:
|
|
1695
1460
|
newFinalValue = newValue;
|
|
1696
1461
|
break;
|
|
@@ -1703,44 +1468,223 @@ class FieldDescriptor extends FormElement {
|
|
|
1703
1468
|
}
|
|
1704
1469
|
}
|
|
1705
1470
|
|
|
1706
|
-
class
|
|
1707
|
-
constructor(
|
|
1708
|
-
|
|
1709
|
-
this._actionsObj = {};
|
|
1710
|
-
this._tableObj = {};
|
|
1711
|
-
this._sectionsObj = {};
|
|
1712
|
-
this._immutableData = {};
|
|
1713
|
-
this._extraInfo = {};
|
|
1714
|
-
this._formConfig = formConfig;
|
|
1715
|
-
this.state = '';
|
|
1716
|
-
this._actions = [];
|
|
1717
|
-
this._fields = [];
|
|
1718
|
-
this._tables = [];
|
|
1719
|
-
this._sections = [];
|
|
1720
|
-
this._stateFlow = {
|
|
1721
|
-
defaultState: '',
|
|
1722
|
-
states: [],
|
|
1723
|
-
transitions: [],
|
|
1724
|
-
};
|
|
1725
|
-
if (!definitionReceived) {
|
|
1471
|
+
class RecordFormSubSection {
|
|
1472
|
+
constructor(subsectionReceived, formObject) {
|
|
1473
|
+
if (!subsectionReceived) {
|
|
1726
1474
|
return;
|
|
1727
1475
|
}
|
|
1728
|
-
this.
|
|
1729
|
-
|
|
1730
|
-
this.
|
|
1731
|
-
|
|
1732
|
-
this.
|
|
1733
|
-
this.
|
|
1734
|
-
this.
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
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;
|
|
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];
|
|
1744
1688
|
}
|
|
1745
1689
|
return Object.assign(Object.assign({}, objDef), { visibleStates, enabledStates });
|
|
1746
1690
|
});
|
|
@@ -1748,8 +1692,8 @@ class FormStructureAndData {
|
|
|
1748
1692
|
const globalAction = new FormAction(actionReceived, this._formConfig);
|
|
1749
1693
|
const globalActionCode = globalAction.actionCode;
|
|
1750
1694
|
if (globalActionCode) {
|
|
1751
|
-
this.
|
|
1752
|
-
this.
|
|
1695
|
+
this._actionArray.push(globalAction);
|
|
1696
|
+
this._actions[globalActionCode] = globalAction;
|
|
1753
1697
|
}
|
|
1754
1698
|
}
|
|
1755
1699
|
}
|
|
@@ -1769,8 +1713,8 @@ class FormStructureAndData {
|
|
|
1769
1713
|
const fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
|
|
1770
1714
|
const fieldCode = fieldToAdd.fieldCode;
|
|
1771
1715
|
if (fieldCode) {
|
|
1772
|
-
this.
|
|
1773
|
-
this.
|
|
1716
|
+
this._fieldArray.push(fieldToAdd);
|
|
1717
|
+
this._fields[fieldCode] = fieldToAdd;
|
|
1774
1718
|
}
|
|
1775
1719
|
}
|
|
1776
1720
|
}
|
|
@@ -1793,8 +1737,8 @@ class FormStructureAndData {
|
|
|
1793
1737
|
const tableToAdd = new RecordTable(tableReceived, this._formConfig);
|
|
1794
1738
|
const tableCode = tableToAdd.tableCode;
|
|
1795
1739
|
if (tableCode) {
|
|
1796
|
-
this.
|
|
1797
|
-
this.
|
|
1740
|
+
this._tableArray.push(tableToAdd);
|
|
1741
|
+
this._tables[tableCode] = tableToAdd;
|
|
1798
1742
|
}
|
|
1799
1743
|
}
|
|
1800
1744
|
}
|
|
@@ -1812,19 +1756,22 @@ class FormStructureAndData {
|
|
|
1812
1756
|
const sectionToAdd = new RecordFormSection(sectionReceived, this);
|
|
1813
1757
|
const sectionCode = sectionToAdd.sectionCode;
|
|
1814
1758
|
if (sectionCode) {
|
|
1815
|
-
this.
|
|
1816
|
-
this.
|
|
1759
|
+
this._sectionArray.push(sectionToAdd);
|
|
1760
|
+
this._sections[sectionCode] = sectionToAdd;
|
|
1817
1761
|
}
|
|
1818
1762
|
}
|
|
1819
1763
|
}
|
|
1820
1764
|
}
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
get defaultState() { return this._stateFlow.defaultState; }
|
|
1824
|
-
get title() { return this._title; }
|
|
1825
|
-
set title(title) { this._title = title; }
|
|
1765
|
+
getTitle() { return this._title; }
|
|
1766
|
+
setTitle(title) { this._title = title; }
|
|
1826
1767
|
get name() { return this._name; }
|
|
1827
1768
|
set name(name) { this._name = name; }
|
|
1769
|
+
// Estados
|
|
1770
|
+
get defaultState() { return this._stateFlow.defaultState; }
|
|
1771
|
+
supportState(state) { var _a; return (_a = this._stateFlow.states) === null || _a === void 0 ? void 0 : _a.includes(state); }
|
|
1772
|
+
supportMode(state) { return this.supportState(state); }
|
|
1773
|
+
get states() { return this._stateFlow.states; }
|
|
1774
|
+
getCurrentState() { return this.state; }
|
|
1828
1775
|
changeState(newState) {
|
|
1829
1776
|
if (!newState || !this.supportState(newState)) {
|
|
1830
1777
|
return false;
|
|
@@ -1854,420 +1801,260 @@ class FormStructureAndData {
|
|
|
1854
1801
|
return { name, source, destination };
|
|
1855
1802
|
}).filter(item => item.name && item.source && item.destination);
|
|
1856
1803
|
}
|
|
1857
|
-
|
|
1858
|
-
supportMode(state) { return this.supportState(state); }
|
|
1859
|
-
get immutableData() {
|
|
1860
|
-
const data = {};
|
|
1861
|
-
const objectNames = Object.keys(this._immutableData);
|
|
1862
|
-
for (let index = 0; index < objectNames.length; index++) {
|
|
1863
|
-
const name = objectNames[index];
|
|
1864
|
-
data[name] = this.getImmutableElement(name);
|
|
1865
|
-
}
|
|
1866
|
-
return data;
|
|
1867
|
-
}
|
|
1804
|
+
// immutable Data
|
|
1868
1805
|
getImmutableElement(name) { var _a, _b, _c; return (_c = (_b = (_a = this._immutableData) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null; }
|
|
1806
|
+
set immutableData(immutableData) { Object.assign(this._immutableData, immutableData); }
|
|
1807
|
+
get immutableData() { return JSON.parse(JSON.stringify(this._immutableData)); }
|
|
1808
|
+
// extra Info
|
|
1869
1809
|
getExtraInfo(name) { var _a, _b, _c; return (_c = (_b = (_a = this._extraInfo) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null; }
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1810
|
+
set extraInfo(extraInfo) { Object.assign(this._extraInfo, extraInfo); }
|
|
1811
|
+
get extraInfo() { return JSON.parse(JSON.stringify(this._extraInfo)); }
|
|
1812
|
+
// Fields
|
|
1813
|
+
get fields() { return this._fields; }
|
|
1814
|
+
get fieldNames() { return this.getFieldNames(); }
|
|
1815
|
+
getFields() { return this._fieldArray; }
|
|
1816
|
+
getFieldNames() { return this._fieldArray.map(field => field.fieldCode); }
|
|
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];
|
|
1876
1842
|
}
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
getFields() { return this._fields; }
|
|
1880
|
-
getStates() {
|
|
1881
|
-
return this._stateFlow.states;
|
|
1882
|
-
}
|
|
1883
|
-
getFieldNames() {
|
|
1884
|
-
return this._fields.map(field => field.fieldCode);
|
|
1885
|
-
}
|
|
1886
|
-
getActions() {
|
|
1887
|
-
return this._actions;
|
|
1888
|
-
}
|
|
1889
|
-
getHeaderActions() {
|
|
1890
|
-
return this._actions.filter(actionItem => actionItem.location === HEADER$1);
|
|
1891
|
-
}
|
|
1892
|
-
getFieldObject(elementId) {
|
|
1893
|
-
return (this._fieldsObj && elementId && this._fieldsObj[elementId])
|
|
1894
|
-
? this._fieldsObj[elementId] : null;
|
|
1895
|
-
}
|
|
1896
|
-
getTableObject(elementId) {
|
|
1897
|
-
return (this._tableObj && elementId && this._tableObj[elementId])
|
|
1898
|
-
? this._tableObj[elementId] : null;
|
|
1899
|
-
}
|
|
1900
|
-
getActionObject(elementId) {
|
|
1901
|
-
return (this._actionsObj && elementId && this._actionsObj[elementId])
|
|
1902
|
-
? this._actionsObj[elementId] : null;
|
|
1903
|
-
}
|
|
1904
|
-
getSubSection(sectionCode, subsectionCode) {
|
|
1905
|
-
const section = (this._sectionsObj && this._sectionsObj[sectionCode])
|
|
1906
|
-
? this._sectionsObj[sectionCode] : null;
|
|
1907
|
-
return (section) ? section.getSubsection(subsectionCode) : null;
|
|
1908
|
-
}
|
|
1909
|
-
get actions() { return this._actionsObj; }
|
|
1910
|
-
getSection(sectionCode) {
|
|
1911
|
-
return (this._sectionsObj && this._sectionsObj[sectionCode])
|
|
1912
|
-
? this._sectionsObj[sectionCode] : null;
|
|
1913
|
-
}
|
|
1914
|
-
sections() { return this.getSections(); }
|
|
1915
|
-
sectionTitles() { return this.getSectionsTitles(); }
|
|
1916
|
-
getSections() {
|
|
1917
|
-
return this._sections;
|
|
1918
|
-
}
|
|
1919
|
-
get visibleSections() {
|
|
1920
|
-
return this._sections.filter(sec => sec.visible);
|
|
1921
|
-
}
|
|
1922
|
-
numSections() {
|
|
1923
|
-
return this._sections.length;
|
|
1924
|
-
}
|
|
1925
|
-
getSectionsTitles() {
|
|
1926
|
-
return this._sections.map(formSection => formSection.sectionTitle);
|
|
1927
|
-
}
|
|
1928
|
-
getSectionObject(elementId) {
|
|
1929
|
-
return (this._sectionsObj && elementId && this._sectionsObj[elementId])
|
|
1930
|
-
? this._sectionsObj[elementId] : null;
|
|
1931
|
-
}
|
|
1932
|
-
tables() { return this.getTables(); }
|
|
1933
|
-
getTables() {
|
|
1934
|
-
return this._tables;
|
|
1935
|
-
}
|
|
1936
|
-
cleanData() {
|
|
1937
|
-
if (this._fields) {
|
|
1938
|
-
for (const recordField of this._fields) {
|
|
1939
|
-
recordField.setValue(recordField.defaultValue);
|
|
1940
|
-
}
|
|
1843
|
+
else if (Array.isArray(inputCodes) && inputCodes.length > 0) {
|
|
1844
|
+
codes = inputCodes;
|
|
1941
1845
|
}
|
|
1942
|
-
if (
|
|
1943
|
-
|
|
1944
|
-
formTable.clean();
|
|
1945
|
-
}
|
|
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 : [];
|
|
1946
1848
|
}
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
hideSection(sectionCode) {
|
|
1953
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1954
|
-
return (sectionObject) ? sectionObject.hide() : null;
|
|
1955
|
-
}
|
|
1956
|
-
activeSection() {
|
|
1957
|
-
const activeSection = this._sections.find(sectionObj => sectionObj.active);
|
|
1958
|
-
return activeSection.sectionCode;
|
|
1959
|
-
}
|
|
1960
|
-
activateSection(sectionCode) {
|
|
1961
|
-
this._sections.forEach(sectionObj => {
|
|
1962
|
-
if (sectionObj) {
|
|
1963
|
-
sectionObj.inactivate();
|
|
1964
|
-
}
|
|
1965
|
-
});
|
|
1966
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1967
|
-
return (sectionObject) ? sectionObject.activate() : null;
|
|
1968
|
-
}
|
|
1969
|
-
showSections(sectionArray) {
|
|
1970
|
-
const sectionNames = (Array.isArray(sectionArray)) ? sectionArray : [sectionArray];
|
|
1971
|
-
sectionNames.forEach(sectionCode => this.showSection(sectionCode));
|
|
1972
|
-
}
|
|
1973
|
-
hideSections(sectionArray) {
|
|
1974
|
-
const sectionNames = (Array.isArray(sectionArray)) ? sectionArray : [sectionArray];
|
|
1975
|
-
sectionNames.forEach(sectionCode => this.hideSection(sectionCode));
|
|
1976
|
-
}
|
|
1977
|
-
showSubSection(sectionCode, subSectionCode) {
|
|
1978
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1979
|
-
const subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
|
|
1980
|
-
return (subSectionObject) ? subSectionObject.show() : null;
|
|
1981
|
-
}
|
|
1982
|
-
hideSubSection(sectionCode, subSectionCode) {
|
|
1983
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1984
|
-
const subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
|
|
1985
|
-
return (subSectionObject) ? subSectionObject.hide() : null;
|
|
1986
|
-
}
|
|
1987
|
-
showSubSections(sectionCode, subSectionArray) {
|
|
1988
|
-
if (subSectionArray && subSectionArray.length > 0) {
|
|
1989
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1990
|
-
for (const subSectionCode of subSectionArray) {
|
|
1991
|
-
const subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
|
|
1992
|
-
if (subSectionObject) {
|
|
1993
|
-
subSectionObject.show();
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
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 : [];
|
|
1851
|
+
}
|
|
1852
|
+
else {
|
|
1853
|
+
codes = this.getFieldNames();
|
|
1996
1854
|
}
|
|
1855
|
+
return (filter) ? codes.filter(fld => filter(this.getField(fld))) : codes;
|
|
1997
1856
|
}
|
|
1998
|
-
|
|
1999
|
-
if (
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
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}`);
|
|
2005
1872
|
}
|
|
2006
1873
|
}
|
|
2007
1874
|
}
|
|
1875
|
+
return processedFields;
|
|
2008
1876
|
}
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
return (actionObject) ? actionObject.show() : null;
|
|
1877
|
+
enableFields(codes, secCode, subCode) {
|
|
1878
|
+
return this.applyOnFields(fld => fld.enable(), codes, secCode, subCode);
|
|
2012
1879
|
}
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
return (actionObject) ? actionObject.hide() : null;
|
|
1880
|
+
showFields(codes, secCode, subCode) {
|
|
1881
|
+
return this.applyOnFields(fld => fld.show(), codes, secCode, subCode);
|
|
2016
1882
|
}
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
actionNames.forEach(actionCode => this.showAction(actionCode));
|
|
1883
|
+
hideFields(codes, secCode, subCode) {
|
|
1884
|
+
return this.applyOnFields(fld => fld.hide(), codes, secCode, subCode);
|
|
2020
1885
|
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
actionNames.forEach(actionCode => this.hideAction(actionCode));
|
|
1886
|
+
showLabelFields(codes, secCode, subCode) {
|
|
1887
|
+
return this.applyOnFields(fld => fld.showLablel(), codes, secCode, subCode);
|
|
2024
1888
|
}
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
return (actionObject) ? actionObject.enable() : null;
|
|
1889
|
+
hideLabelFields(codes, secCode, subCode) {
|
|
1890
|
+
return this.applyOnFields(fld => fld.hideLabel(), codes, secCode, subCode);
|
|
2028
1891
|
}
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
return (actionObject) ? actionObject.disable() : null;
|
|
1892
|
+
disableFields(codes, secCode, subCode) {
|
|
1893
|
+
return this.applyOnFields(fld => fld.disable(), codes, secCode, subCode);
|
|
2032
1894
|
}
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
actionNames.forEach(actionCode => this.enableAction(actionCode));
|
|
1895
|
+
cleanFields(codes, secCode, subCode) {
|
|
1896
|
+
return this.applyOnFields(fld => fld.clean(), codes, secCode, subCode);
|
|
2036
1897
|
}
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
actionNames.forEach(actionCode => this.disableAction(actionCode));
|
|
1898
|
+
tagFieldsWithError(message, codes, secCode, subCode) {
|
|
1899
|
+
return this.applyOnFields(fld => fld.setErrorMessage(message), codes, secCode, subCode);
|
|
2040
1900
|
}
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
const fieldObject = this.getFieldObject(fieldCode);
|
|
2044
|
-
return (fieldObject) ? fieldObject.enable() : null;
|
|
1901
|
+
cleanErrorFields(codes, secCode, subCode) {
|
|
1902
|
+
this.tagFieldsWithError('', codes, secCode, subCode);
|
|
2045
1903
|
}
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
return (fieldObject) ? fieldObject.disable() : null;
|
|
1904
|
+
tagEmptyRequiredFields(message, codes = null, secCode, subCode) {
|
|
1905
|
+
return this.tagFieldsWithError(message, this.getRequiredEmptyFields(codes, secCode, subCode)) > 0;
|
|
2049
1906
|
}
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
1907
|
+
getRequiredFields(codes, secCode, subCode) {
|
|
1908
|
+
return this.getFieldSet(fld => fld.required, codes, secCode, subCode);
|
|
1909
|
+
}
|
|
1910
|
+
getRequiredEmptyFields(codes, secCode, subCode) {
|
|
1911
|
+
return this.getFieldSet(fld => fld.required && fld.empty, codes, secCode, subCode);
|
|
2053
1912
|
}
|
|
2054
|
-
|
|
1913
|
+
getChangedFields(codes, secCode, subCode) {
|
|
1914
|
+
return this.getFieldSet(fld => !fld.outputOnly && fld.hasChanged(), codes, secCode, subCode);
|
|
1915
|
+
}
|
|
1916
|
+
getFieldsWithValidationIssues(codes, secCode, subCode) {
|
|
1917
|
+
return this.getFieldSet(fld => fld.errorCode !== NO_ERROR, codes, secCode, subCode);
|
|
1918
|
+
}
|
|
1919
|
+
getFieldsValues(inputCodes, secCode, subCode) {
|
|
2055
1920
|
var _a, _b, _c;
|
|
2056
|
-
|
|
2057
|
-
return null;
|
|
2058
|
-
}
|
|
1921
|
+
const codes = this.getFieldSet(null, inputCodes, secCode, subCode);
|
|
2059
1922
|
const resultObject = {};
|
|
2060
|
-
for (let index = 0; index <
|
|
2061
|
-
const
|
|
2062
|
-
if (
|
|
2063
|
-
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;
|
|
2064
1927
|
}
|
|
2065
1928
|
}
|
|
2066
1929
|
return resultObject;
|
|
2067
1930
|
}
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
const fieldObject = this.getFieldObject(code);
|
|
2082
|
-
return (fieldObject) ? fieldObject.setIntrinsicErrorMessage(message) : null;
|
|
2083
|
-
}
|
|
2084
|
-
setFieldRequired(fieldCode, required) {
|
|
2085
|
-
const fieldObject = this.getFieldObject(fieldCode);
|
|
2086
|
-
return (fieldObject) ? fieldObject.required = required : null;
|
|
2087
|
-
}
|
|
2088
|
-
setFieldErrorMessage(fieldCode, errorMessage) {
|
|
2089
|
-
const fieldObject = this.getFieldObject(fieldCode);
|
|
2090
|
-
return (fieldObject) ? fieldObject.setErrorMessage(errorMessage) : null;
|
|
2091
|
-
}
|
|
2092
|
-
setFieldOptions(fieldCode, optionsArray, idAttribute, nameAttribute) {
|
|
2093
|
-
const fieldObject = this.getFieldObject(fieldCode);
|
|
2094
|
-
if (fieldObject && optionsArray && optionsArray.length > 0) {
|
|
2095
|
-
const fieldOptions = [];
|
|
2096
|
-
for (const optionItem of optionsArray) {
|
|
2097
|
-
const fieldOption = {
|
|
2098
|
-
fieldOptionId: optionItem[idAttribute],
|
|
2099
|
-
fieldOptionValue: optionItem[nameAttribute]
|
|
2100
|
-
};
|
|
2101
|
-
fieldOptions.push(fieldOption);
|
|
2102
|
-
}
|
|
2103
|
-
fieldObject.setFieldOptions(fieldOptions);
|
|
1931
|
+
// Acciones
|
|
1932
|
+
get actions() { return this._actions; }
|
|
1933
|
+
getActionsByAttribute(name, value) { return this._actionArray.filter(actionItem => actionItem.matchAttribute(name, value)); }
|
|
1934
|
+
getActions() { return this._actionArray; }
|
|
1935
|
+
getAction(code) { var _a; return (code && ((_a = this._actions) === null || _a === void 0 ? void 0 : _a[code])) ? this._actions[code] : null; }
|
|
1936
|
+
showActions(codes) { return this.execOnActions(codes, SHOW); }
|
|
1937
|
+
hideActions(codes) { return this.execOnActions(codes, HIDE); }
|
|
1938
|
+
enableActions(codes) { return this.execOnActions(codes, ENABLE); }
|
|
1939
|
+
disableActions(codes) { return this.execOnActions(codes, DISABLE); }
|
|
1940
|
+
execOnActions(codes, functionName) {
|
|
1941
|
+
const actionCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
1942
|
+
if (!functionName || actionCodes.length === 0) {
|
|
1943
|
+
return;
|
|
2104
1944
|
}
|
|
1945
|
+
actionCodes.forEach(code => {
|
|
1946
|
+
var _a;
|
|
1947
|
+
const action = this.getAction(code);
|
|
1948
|
+
(_a = action === null || action === void 0 ? void 0 : action[functionName]) === null || _a === void 0 ? void 0 : _a.call(action);
|
|
1949
|
+
});
|
|
2105
1950
|
}
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
fieldUniverse = this.getFieldNames();
|
|
2121
|
-
}
|
|
2122
|
-
if (!filterFunc) {
|
|
2123
|
-
return fieldUniverse;
|
|
1951
|
+
// Tablas
|
|
1952
|
+
get tables() { return this.tables; }
|
|
1953
|
+
getTables() { return this._tableArray; }
|
|
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); }
|
|
1956
|
+
enableTables(codes) { return this.execOnTables(codes, ENABLE); }
|
|
1957
|
+
disableTables(codes) { return this.execOnTables(codes, DISABLE); }
|
|
1958
|
+
showTables(codes) { return this.execOnTables(codes, SHOW); }
|
|
1959
|
+
hideTables(codes) { return this.execOnTables(codes, HIDE); }
|
|
1960
|
+
cleanTables(codes) { return this.execOnTables(codes, CLEAN); }
|
|
1961
|
+
execOnTables(codes, functionName) {
|
|
1962
|
+
const tableCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
1963
|
+
if (!functionName || tableCodes.length === 0) {
|
|
1964
|
+
return;
|
|
2124
1965
|
}
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
1966
|
+
tableCodes.forEach(code => {
|
|
1967
|
+
var _a;
|
|
1968
|
+
const table = this.getTable(code);
|
|
1969
|
+
(_a = table === null || table === void 0 ? void 0 : table[functionName]) === null || _a === void 0 ? void 0 : _a.call(table);
|
|
2128
1970
|
});
|
|
2129
1971
|
}
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
1972
|
+
// Secciones
|
|
1973
|
+
get sections() { return this._sectionArray; }
|
|
1974
|
+
getSections() { return this.sections; }
|
|
1975
|
+
getSectionsByAttribute(name, value) { return this._sectionArray.filter(item => item.matchAttribute(name, value)); }
|
|
1976
|
+
get sectionTitles() { return this._sectionArray.map(formSection => formSection.sectionTitle); }
|
|
1977
|
+
get visibleSections() { return this._sectionArray.filter(sec => sec.visible); }
|
|
1978
|
+
getSection(code) { var _a; return (code && ((_a = this._sections) === null || _a === void 0 ? void 0 : _a[code])) ? this._sections[code] : null; }
|
|
1979
|
+
showSections(codes) { this.execOnSections(codes, SHOW); }
|
|
1980
|
+
hideSections(codes) { this.execOnSections(codes, HIDE); }
|
|
1981
|
+
activeSection() { return this._exclusiveSectionsByAttr[ACTIVE]; }
|
|
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; }
|
|
1983
|
+
showSubSections(code, subCodes) { return this.execOnSubSections(code, subCodes, SHOW); }
|
|
1984
|
+
hideSubSections(code, subCodes) { return this.execOnSubSections(code, subCodes, HIDE); }
|
|
1985
|
+
activateSection(code) {
|
|
1986
|
+
var _a, _b;
|
|
1987
|
+
if (code === this._exclusiveSectionsByAttr[ACTIVE]) {
|
|
1988
|
+
return;
|
|
2146
1989
|
}
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
return this.applyProcessToFieldSet(fld => fld.show(), fieldArray, sectionCode, subSectionCode);
|
|
2151
|
-
}
|
|
2152
|
-
hideFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2153
|
-
return this.applyProcessToFieldSet(fld => fld.hide(), fieldArray, sectionCode, subSectionCode);
|
|
1990
|
+
(_a = this.getSection(this.activeSection())) === null || _a === void 0 ? void 0 : _a.inactivate();
|
|
1991
|
+
(_b = this.getSection(code)) === null || _b === void 0 ? void 0 : _b.activate();
|
|
1992
|
+
this._exclusiveSectionsByAttr[ACTIVE] = code;
|
|
2154
1993
|
}
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
return this.applyProcessToFieldSet(fld => fld.hideLabel(), fieldArray, sectionCode, subSectionCode);
|
|
2160
|
-
}
|
|
2161
|
-
// Para deprecar
|
|
2162
|
-
enableEditFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2163
|
-
return this.enableFields(fieldArray, sectionCode, subSectionCode);
|
|
2164
|
-
}
|
|
2165
|
-
// Para deprecar
|
|
2166
|
-
disableEditFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2167
|
-
return this.disableFields(fieldArray, sectionCode, subSectionCode);
|
|
2168
|
-
}
|
|
2169
|
-
enableFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2170
|
-
return this.applyProcessToFieldSet(fld => fld.enable(), fieldArray, sectionCode, subSectionCode);
|
|
2171
|
-
}
|
|
2172
|
-
disableFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2173
|
-
return this.applyProcessToFieldSet(fld => fld.disable(), fieldArray, sectionCode, subSectionCode);
|
|
2174
|
-
}
|
|
2175
|
-
cleanFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2176
|
-
return this.applyProcessToFieldSet(fieldObject => {
|
|
2177
|
-
fieldObject.clean('');
|
|
2178
|
-
fieldObject.setErrorMessage('');
|
|
2179
|
-
}, fieldArray, sectionCode, subSectionCode);
|
|
2180
|
-
}
|
|
2181
|
-
getRequiredFields(fieldArray, sectionCode = null, subSectionCode = null) {
|
|
2182
|
-
return this.getFieldSet(fld => fld.fieldRequired, fieldArray, sectionCode, subSectionCode);
|
|
2183
|
-
}
|
|
2184
|
-
getRequiredEmptyFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2185
|
-
return this.getFieldSet(fld => fld.fieldRequired && fld.isEmpty(), fieldArray, sectionCode, subSectionCode);
|
|
2186
|
-
}
|
|
2187
|
-
getChangedFields(fieldArray, sectionCode = null, subSectionCode = null) {
|
|
2188
|
-
return this.getFieldSet(fld => !fld.outputOnly && fld.hasChanged(), fieldArray, sectionCode, subSectionCode);
|
|
2189
|
-
}
|
|
2190
|
-
getFieldsWithValidationIssues(fieldArray, sectionCode = null, subSectionCode = null) {
|
|
2191
|
-
return this.getFieldSet(fld => fld.errorCode !== NO_ERROR, fieldArray, sectionCode, subSectionCode);
|
|
2192
|
-
}
|
|
2193
|
-
tagFieldsWithError(errorMessage, fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2194
|
-
return this.applyProcessToFieldSet(fieldObject => {
|
|
2195
|
-
fieldObject.setErrorMessage(errorMessage);
|
|
2196
|
-
}, fieldArray, sectionCode, subSectionCode);
|
|
2197
|
-
}
|
|
2198
|
-
cleanErrorFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2199
|
-
this.tagFieldsWithError('', fieldArray, sectionCode, subSectionCode);
|
|
2200
|
-
}
|
|
2201
|
-
tagEmptyRequiredFields(errorMessage, fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2202
|
-
const pendingFields = this.getRequiredEmptyFields(fieldArray, sectionCode, subSectionCode);
|
|
2203
|
-
if (pendingFields && pendingFields.length > 0) {
|
|
2204
|
-
this.tagFieldsWithError(errorMessage, pendingFields);
|
|
2205
|
-
return true;
|
|
1994
|
+
execOnSections(codes, functionName) {
|
|
1995
|
+
const sectionCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
1996
|
+
if (!functionName || sectionCodes.length === 0) {
|
|
1997
|
+
return;
|
|
2206
1998
|
}
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
}
|
|
2213
|
-
getTableRecord(tableCode, recordId) {
|
|
2214
|
-
const tableObject = this.getTableObject(tableCode);
|
|
2215
|
-
return (tableObject) ? tableObject.getTableRecord(recordId) : null;
|
|
2216
|
-
}
|
|
2217
|
-
hideTable(tableCode) {
|
|
2218
|
-
const tableObject = this.getTableObject(tableCode);
|
|
2219
|
-
return (tableObject) ? tableObject.hide() : null;
|
|
2220
|
-
}
|
|
2221
|
-
showTable(tableCode) {
|
|
2222
|
-
const tableObject = this.getTableObject(tableCode);
|
|
2223
|
-
return (tableObject) ? tableObject.show() : null;
|
|
1999
|
+
sectionCodes.forEach(code => {
|
|
2000
|
+
var _a;
|
|
2001
|
+
const section = this.getSection(code);
|
|
2002
|
+
(_a = section === null || section === void 0 ? void 0 : section[functionName]) === null || _a === void 0 ? void 0 : _a.call(section);
|
|
2003
|
+
});
|
|
2224
2004
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2005
|
+
execOnSubSections(code, subNames, functionName) {
|
|
2006
|
+
var _a;
|
|
2007
|
+
const subCodes = (Array.isArray(subNames)) ? subNames : (subNames ? [subNames] : []);
|
|
2008
|
+
const section = this.getSection(code);
|
|
2009
|
+
if (!functionName || !section || subCodes.length === 0) {
|
|
2010
|
+
return;
|
|
2011
|
+
}
|
|
2012
|
+
for (const subCode of subCodes) {
|
|
2013
|
+
const subSection = this.getSubSection(code, subCode);
|
|
2014
|
+
(_a = subSection === null || subSection === void 0 ? void 0 : subSection[functionName]) === null || _a === void 0 ? void 0 : _a.call(subSection);
|
|
2015
|
+
}
|
|
2228
2016
|
}
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2017
|
+
/**
|
|
2018
|
+
* Métodos propios de gestión del formulario
|
|
2019
|
+
*/
|
|
2020
|
+
cleanData() {
|
|
2021
|
+
for (const field of this._fieldArray) {
|
|
2022
|
+
field.setValue(field.defaultValue);
|
|
2023
|
+
}
|
|
2024
|
+
for (const table of this._tableArray) {
|
|
2025
|
+
table.clean();
|
|
2026
|
+
}
|
|
2232
2027
|
}
|
|
2233
|
-
/** payload para servicios Tuain */
|
|
2234
2028
|
getPayload() {
|
|
2235
2029
|
const formData = {
|
|
2236
2030
|
fields: [],
|
|
2237
2031
|
tables: [],
|
|
2238
2032
|
};
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
currentFilter: tableDescriptor.currentFilter,
|
|
2265
|
-
sortingColumn: tableDescriptor.sorting.columnName,
|
|
2266
|
-
sortingDirection: tableDescriptor.sorting.direction,
|
|
2267
|
-
};
|
|
2268
|
-
formData.tables.push(formTable);
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
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
|
+
});
|
|
2271
2058
|
return formData;
|
|
2272
2059
|
}
|
|
2273
2060
|
}
|
|
@@ -2382,35 +2169,336 @@ class BasicFormComponent {
|
|
|
2382
2169
|
this.formManagerService = formManagerService;
|
|
2383
2170
|
this._eventManager = _eventManager;
|
|
2384
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 = '';
|
|
2385
2193
|
this.errorCode = '';
|
|
2386
2194
|
this.errorMessage = '';
|
|
2387
2195
|
this.errorDetail = '';
|
|
2388
|
-
this.
|
|
2389
|
-
this.controlToken = null;
|
|
2390
|
-
this.inputDataFields = {};
|
|
2391
|
-
this.extraData = {};
|
|
2392
|
-
this.definitionObtained = false;
|
|
2393
|
-
this.formVisible = false;
|
|
2196
|
+
this.visible = false;
|
|
2394
2197
|
this.busy = false;
|
|
2395
|
-
this.formSectionsActivate = {};
|
|
2396
|
-
this.formSectionsInactivate = {};
|
|
2397
|
-
this.formActionsStart = {};
|
|
2398
|
-
this.formActionsFinish = {};
|
|
2399
|
-
this.fieldInputValidation = {};
|
|
2400
|
-
this.fieldValidationsStart = {};
|
|
2401
|
-
this.fieldValidationsFinish = {};
|
|
2402
|
-
// Callback de acciones de tablas
|
|
2403
|
-
this.tableSelectionsStart = {};
|
|
2404
|
-
this.tableSelectionsFinish = {};
|
|
2405
|
-
this.tableActionsStart = {};
|
|
2406
|
-
this.tableActionsFinish = {};
|
|
2407
|
-
this.tableGetDataStart = {};
|
|
2408
|
-
this.tableGetDataFinish = {};
|
|
2409
2198
|
this._eventEmiter = this._eventManager;
|
|
2410
2199
|
this.cleanStart();
|
|
2411
2200
|
this.customPreProcessing();
|
|
2412
2201
|
}
|
|
2413
|
-
|
|
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);
|
|
2501
|
+
}
|
|
2414
2502
|
setConfig(formConfig) {
|
|
2415
2503
|
this.formConfig = formConfig;
|
|
2416
2504
|
}
|
|
@@ -2419,150 +2507,46 @@ class BasicFormComponent {
|
|
|
2419
2507
|
this.errorCode = '';
|
|
2420
2508
|
this.errorMessage = '';
|
|
2421
2509
|
this.errorDetail = '';
|
|
2422
|
-
this.
|
|
2510
|
+
this._formStructure = null;
|
|
2423
2511
|
this.fields = null;
|
|
2424
2512
|
this.actions = null;
|
|
2425
|
-
this.
|
|
2513
|
+
this._controlToken = null;
|
|
2426
2514
|
this.inputDataFields = {};
|
|
2427
|
-
this.
|
|
2515
|
+
this._definitionObtained = false;
|
|
2428
2516
|
// Se limpian los manejadores de eventos
|
|
2429
|
-
this.
|
|
2517
|
+
this.visible = false;
|
|
2430
2518
|
this.busy = false;
|
|
2431
|
-
this.
|
|
2432
|
-
this.
|
|
2433
|
-
this.
|
|
2434
|
-
this.
|
|
2435
|
-
this.
|
|
2436
|
-
this.
|
|
2437
|
-
this.
|
|
2438
|
-
this.
|
|
2439
|
-
this.
|
|
2440
|
-
this.
|
|
2441
|
-
this.
|
|
2442
|
-
this.
|
|
2443
|
-
this.
|
|
2444
|
-
}
|
|
2445
|
-
get
|
|
2446
|
-
get
|
|
2447
|
-
|
|
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; }
|
|
2534
|
+
get formManager() { return this; }
|
|
2535
|
+
get formCode() { return this.name; }
|
|
2536
|
+
set formCode(name) { this.name = name; }
|
|
2537
|
+
get inServerProcess() { return this.busy; }
|
|
2538
|
+
get form() { return this._formStructure; }
|
|
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); }
|
|
2448
2542
|
get currentMode() { return this.currentState; }
|
|
2449
|
-
get immutableData() { return this.
|
|
2450
|
-
get extraInfo() { return this.
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
getImmutableElement(name) { return this.formStructure.getImmutableElement(name); }
|
|
2457
|
-
getExtraInfo(name) { return this.formStructure.getExtraInfo(name); }
|
|
2458
|
-
cleanData() { return this.formStructure.cleanData(); }
|
|
2459
|
-
getFields() { return this.formStructure.getFields(); }
|
|
2460
|
-
getFieldNames() { return this.formStructure.getFieldNames(); }
|
|
2461
|
-
getFieldObject(elementId) { return this.formStructure.getFieldObject(elementId); }
|
|
2462
|
-
getField(fieldCode) { return this.getFieldObject(fieldCode); }
|
|
2463
|
-
enableField(fieldCode) { return this.formStructure.enableField(fieldCode); }
|
|
2464
|
-
disableField(fieldCode) { return this.formStructure.disableField(fieldCode); }
|
|
2465
|
-
getFieldValue(fieldCode) { return this.formStructure.getFieldValue(fieldCode); }
|
|
2466
|
-
getFieldsValues(fieldCodesArray) { return this.formStructure.getFieldsValues(fieldCodesArray); }
|
|
2467
|
-
getFieldOptions(fieldCode) { return this.formStructure.getFieldOptions(fieldCode); }
|
|
2468
|
-
setFieldValue(fieldCode, fieldValue) { return this.formStructure.setFieldValue(fieldCode, fieldValue); }
|
|
2469
|
-
setFieldRequired(fieldCode, required) { return this.formStructure.setFieldRequired(fieldCode, required); }
|
|
2470
|
-
setFieldErrorMessage(fieldCode, errorMessage) { return this.formStructure.setFieldErrorMessage(fieldCode, errorMessage); }
|
|
2471
|
-
setFieldError(code, message, type = 'error') { return this.formStructure.setFieldError(code, message, type); }
|
|
2472
|
-
setFieldIntrinsicErrorMessage(code, message) { return this.formStructure.setFieldIntrinsicErrorMessage(code, message); }
|
|
2473
|
-
setFieldOptions(fieldCode, optionsArray, idAttribute, nameAttribute) {
|
|
2474
|
-
return this.formStructure.setFieldOptions(fieldCode, optionsArray, idAttribute, nameAttribute);
|
|
2475
|
-
}
|
|
2476
|
-
getFieldSet(filterFunc, fieldArray, sectionCode, subSectionCode) {
|
|
2477
|
-
return this.formStructure.getFieldSet(filterFunc, fieldArray, sectionCode, subSectionCode);
|
|
2478
|
-
}
|
|
2479
|
-
applyProcessToFieldSet(processFunc, fieldArray, sectionCode, subSectionCode) {
|
|
2480
|
-
return this.formStructure.applyProcessToFieldSet(processFunc, fieldArray, sectionCode, subSectionCode);
|
|
2481
|
-
}
|
|
2482
|
-
applyProcessToAllFields(processFunc) { return this.formStructure.applyProcessToFieldSet(processFunc); }
|
|
2483
|
-
cleanFields(fieldArray, sectionCode, subSectionCode) {
|
|
2484
|
-
return this.formStructure.cleanFields(fieldArray, sectionCode, subSectionCode);
|
|
2485
|
-
}
|
|
2486
|
-
getRequiredFields(fieldArray, sectionCode, subSectionCode) {
|
|
2487
|
-
return this.formStructure.getRequiredFields(fieldArray, sectionCode, subSectionCode);
|
|
2488
|
-
}
|
|
2489
|
-
getRequiredEmptyFields(fieldArray, sectionCode, subSectionCode) {
|
|
2490
|
-
return this.formStructure.getRequiredEmptyFields(fieldArray, sectionCode, subSectionCode);
|
|
2491
|
-
}
|
|
2492
|
-
getChangedFields(fieldArray, sectionCode, subSectionCode) {
|
|
2493
|
-
return this.formStructure.getChangedFields(fieldArray, sectionCode, subSectionCode);
|
|
2494
|
-
}
|
|
2495
|
-
getFieldsWithValidationIssues(fieldArray, sectionCode, subSectionCode) {
|
|
2496
|
-
return this.formStructure.getFieldsWithValidationIssues(fieldArray, sectionCode, subSectionCode);
|
|
2497
|
-
}
|
|
2498
|
-
tagFieldsWithError(errorMessage, fieldArray, sectionCode, subSectionCode) {
|
|
2499
|
-
return this.formStructure.tagFieldsWithError(errorMessage, fieldArray, sectionCode, subSectionCode);
|
|
2500
|
-
}
|
|
2501
|
-
cleanErrorFields(fieldArray, sectionCode, subSectionCode) {
|
|
2502
|
-
return this.formStructure.cleanErrorFields(fieldArray, sectionCode, subSectionCode);
|
|
2503
|
-
}
|
|
2504
|
-
showLabelFields(fieldArray, sectionCode, subSectionCode) {
|
|
2505
|
-
return this.formStructure.showLabelFields(fieldArray, sectionCode, subSectionCode);
|
|
2506
|
-
}
|
|
2507
|
-
hideLabelFields(fieldArray, sectionCode, subSectionCode) {
|
|
2508
|
-
return this.formStructure.hideLabelFields(fieldArray, sectionCode, subSectionCode);
|
|
2509
|
-
}
|
|
2510
|
-
enableFields(fieldArray, sectionCode, subSectionCode) {
|
|
2511
|
-
return this.formStructure.enableFields(fieldArray, sectionCode, subSectionCode);
|
|
2512
|
-
}
|
|
2513
|
-
disableFields(fieldArray, sectionCode, subSectionCode) {
|
|
2514
|
-
return this.formStructure.disableFields(fieldArray, sectionCode, subSectionCode);
|
|
2515
|
-
}
|
|
2516
|
-
enableEditFields(fieldArray, sectionCode, subSectionCode) {
|
|
2517
|
-
return this.formStructure.enableEditFields(fieldArray, sectionCode, subSectionCode);
|
|
2518
|
-
}
|
|
2519
|
-
disableEditFields(fieldArray, sectionCode, subSectionCode) {
|
|
2520
|
-
return this.formStructure.disableEditFields(fieldArray, sectionCode, subSectionCode);
|
|
2521
|
-
}
|
|
2522
|
-
showFields(fieldArray, sectionCode, subSectionCode) {
|
|
2523
|
-
return this.formStructure.showFields(fieldArray, sectionCode, subSectionCode);
|
|
2524
|
-
}
|
|
2525
|
-
hideFields(fieldArray, sectionCode, subSectionCode) {
|
|
2526
|
-
return this.formStructure.hideFields(fieldArray, sectionCode, subSectionCode);
|
|
2527
|
-
}
|
|
2528
|
-
getHeaderActions() { return this.formStructure.getHeaderActions(); }
|
|
2529
|
-
getActionObject(elementId) { return this.formStructure.getActionObject(elementId); }
|
|
2530
|
-
getAction(actionCode) { return this.getActionObject(actionCode); }
|
|
2531
|
-
getActionDefinition(actionCode) { return this.getActionObject(actionCode); }
|
|
2532
|
-
showAction(actionCode) { return this.formStructure.showAction(actionCode); }
|
|
2533
|
-
hideAction(actionCode) { return this.formStructure.hideAction(actionCode); }
|
|
2534
|
-
showActions(actionArray) { return this.formStructure.showActions(actionArray); }
|
|
2535
|
-
hideActions(actionArray) { return this.formStructure.hideActions(actionArray); }
|
|
2536
|
-
enableAction(actionCode) { return this.formStructure.enableAction(actionCode); }
|
|
2537
|
-
disableAction(actionCode) { return this.formStructure.disableAction(actionCode); }
|
|
2538
|
-
enableActions(actionArray) { return this.formStructure.enableActions(actionArray); }
|
|
2539
|
-
disableActions(actionArray) { return this.formStructure.disableActions(actionArray); }
|
|
2540
|
-
getStates() { return this.formStructure.getStates(); }
|
|
2541
|
-
getSections() { return this.formStructure.getSections(); }
|
|
2542
|
-
get visibleSections() { return this.formStructure.visibleSections; }
|
|
2543
|
-
getSection(sectionCode) { return this.formStructure.getSection(sectionCode); }
|
|
2544
|
-
activateSection(sectionCode) { return this.formStructure.activateSection(sectionCode); }
|
|
2545
|
-
getSubSection(sectionCode, subsectionCode) { return this.formStructure.getSubSection(sectionCode, subsectionCode); }
|
|
2546
|
-
numSections() { return this.formStructure.numSections(); }
|
|
2547
|
-
getSectionsTitles() { return this.formStructure.getSectionsTitles(); }
|
|
2548
|
-
getSectionObject(elementId) { return this.formStructure.getSectionObject(elementId); }
|
|
2549
|
-
showSection(sectionCode) { return this.formStructure.showSection(sectionCode); }
|
|
2550
|
-
hideSection(sectionCode) { return this.formStructure.hideSection(sectionCode); }
|
|
2551
|
-
showSections(sectionArray) { return this.formStructure.showSections(sectionArray); }
|
|
2552
|
-
hideSections(sectionArray) { return this.formStructure.hideSections(sectionArray); }
|
|
2553
|
-
showSubSection(sectionCode, subSectionCode) { return this.formStructure.showSubSection(sectionCode, subSectionCode); }
|
|
2554
|
-
hideSubSection(sectionCode, subSectionCode) { return this.formStructure.hideSubSection(sectionCode, subSectionCode); }
|
|
2555
|
-
showSubSections(sectionCode, subSectionArray) { return this.formStructure.showSubSections(sectionCode, subSectionArray); }
|
|
2556
|
-
hideSubSections(sectionCode, subSectionArray) { return this.formStructure.hideSubSections(sectionCode, subSectionArray); }
|
|
2557
|
-
getTables() { return this.formStructure.getTables(); }
|
|
2558
|
-
getTableObject(elementId) { return this.formStructure.getTableObject(elementId); }
|
|
2559
|
-
getTable(tableName) { return this.getTableObject(tableName); }
|
|
2560
|
-
showTable(tableName) { return this.formStructure.showTable(tableName); }
|
|
2561
|
-
hideTable(tableName) { return this.formStructure.hideTable(tableName); }
|
|
2562
|
-
showTables(tableArray) { return this.formStructure.showTables(tableArray); }
|
|
2563
|
-
hideTables(tableArray) { return this.formStructure.hideTables(tableArray); }
|
|
2564
|
-
cleanTable(tableName) { return this.formStructure.cleanTable(tableName); }
|
|
2565
|
-
getTableRecord(tableName, recordId) { return this.formStructure.getTableRecord(tableName, recordId); }
|
|
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; }
|
|
2546
|
+
get formRoute() { return this._formRoute; }
|
|
2547
|
+
set formRoute(route) { this._formRoute = route; }
|
|
2548
|
+
get subject() { return this.formSubject; }
|
|
2549
|
+
// Métodos virtuales
|
|
2566
2550
|
customPreProcessing() { }
|
|
2567
2551
|
customFormStart() { }
|
|
2568
2552
|
displayActionServerError() { }
|
|
@@ -2571,6 +2555,43 @@ class BasicFormComponent {
|
|
|
2571
2555
|
showFieldInfo(fieldCode) { }
|
|
2572
2556
|
showModalDialog(title, body, options, callback, params) { }
|
|
2573
2557
|
openUploadDialog(title, body, options, callback, params) { }
|
|
2558
|
+
/**
|
|
2559
|
+
* @deprecated Use supportState
|
|
2560
|
+
*/
|
|
2561
|
+
supportMode(state) { return this.supportState(state); }
|
|
2562
|
+
/**
|
|
2563
|
+
* @deprecated Use getField
|
|
2564
|
+
*/
|
|
2565
|
+
getFieldObject(code) { return this.getField(code); }
|
|
2566
|
+
/**
|
|
2567
|
+
* @deprecated Use getAction
|
|
2568
|
+
*/
|
|
2569
|
+
getActionObject(code) { return this.getAction(code); }
|
|
2570
|
+
/**
|
|
2571
|
+
* @deprecated Use getTable
|
|
2572
|
+
*/
|
|
2573
|
+
getTableObject(code) { return this.getTable(code); }
|
|
2574
|
+
/**
|
|
2575
|
+
* @deprecated Use getSection
|
|
2576
|
+
*/
|
|
2577
|
+
getSectionObject(code) { return this.getSection(code); }
|
|
2578
|
+
/**
|
|
2579
|
+
* @deprecated Use changeState
|
|
2580
|
+
*/
|
|
2581
|
+
changeFormMode(state) { return this.changeState(state); }
|
|
2582
|
+
/**
|
|
2583
|
+
* @deprecated Use subject
|
|
2584
|
+
*/
|
|
2585
|
+
getFormSubject() { return this.subject; }
|
|
2586
|
+
/**
|
|
2587
|
+
* @deprecated Use subject
|
|
2588
|
+
*/
|
|
2589
|
+
getSubject() { return this.formSubject; }
|
|
2590
|
+
/**
|
|
2591
|
+
* @deprecated Use subject
|
|
2592
|
+
*/
|
|
2593
|
+
getformSubject() { return this.getSubject(); }
|
|
2594
|
+
numSections() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.sections.length; }
|
|
2574
2595
|
subscribeAppEvent(eventName, callback) {
|
|
2575
2596
|
this._eventEmiter.subscribe(eventName, callback);
|
|
2576
2597
|
}
|
|
@@ -2578,7 +2599,7 @@ class BasicFormComponent {
|
|
|
2578
2599
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2579
2600
|
let origin = null;
|
|
2580
2601
|
if (!cleanStack) {
|
|
2581
|
-
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 });
|
|
2582
2603
|
origin.subject = (_a = origin === null || origin === void 0 ? void 0 : origin.subject) !== null && _a !== void 0 ? _a : this.formSubject;
|
|
2583
2604
|
origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.currentState;
|
|
2584
2605
|
origin.fields = (_c = origin === null || origin === void 0 ? void 0 : origin.fields) !== null && _c !== void 0 ? _c : {};
|
|
@@ -2591,49 +2612,39 @@ class BasicFormComponent {
|
|
|
2591
2612
|
target.extra = (_h = target === null || target === void 0 ? void 0 : target.extra) !== null && _h !== void 0 ? _h : {};
|
|
2592
2613
|
this.formManagerService.openForm(origin, target);
|
|
2593
2614
|
}
|
|
2594
|
-
canGoBack() { return this.
|
|
2615
|
+
canGoBack() { return this._originToken !== null; }
|
|
2595
2616
|
goBack() { return this.formManagerService.backTo(); }
|
|
2596
2617
|
goBackForm() { return this.goBack(); }
|
|
2597
|
-
getOriginDetail() { return this.formManagerService.getFormInfo(this.
|
|
2618
|
+
getOriginDetail() { return this.formManagerService.getFormInfo(this._originToken); }
|
|
2598
2619
|
setError(errorType, errorMessage, errorDetail) {
|
|
2599
2620
|
this._errorType = errorType || '';
|
|
2600
2621
|
this.errorMessage = errorMessage || '';
|
|
2601
2622
|
this.errorDetail = errorDetail || '';
|
|
2602
2623
|
}
|
|
2603
|
-
get formManager() { return this; }
|
|
2604
2624
|
resetError() { this.setError(null, null, null); }
|
|
2605
2625
|
getErrorType() { return this._errorType; }
|
|
2606
2626
|
getErrorMessage() { return this.errorMessage; }
|
|
2607
2627
|
getErrorDetail() { return this.errorDetail; }
|
|
2608
2628
|
getErrorCode() { return this._errorType; }
|
|
2609
|
-
get formRoute() { return this._formRoute; }
|
|
2610
|
-
set formRoute(route) { this._formRoute = route; }
|
|
2611
|
-
defineFormCode(name) { this.name = name; }
|
|
2612
|
-
getCurrentState() { return this.formStructure.state; }
|
|
2613
|
-
getCurrentMode() { return this.formStructure.state; }
|
|
2614
|
-
get formCode() { return this.name; }
|
|
2615
|
-
set formCode(name) { this.name = name; }
|
|
2616
2629
|
getFormParameter(name) {
|
|
2617
2630
|
var _a, _b;
|
|
2618
2631
|
return (name) ? ((_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null) : null;
|
|
2619
2632
|
}
|
|
2620
|
-
getSubject() { return this.formSubject; }
|
|
2621
|
-
getformSubject() { return this.getSubject(); }
|
|
2622
2633
|
preocessInputParams(params) {
|
|
2623
2634
|
var _a, _b, _c;
|
|
2624
|
-
this.
|
|
2625
|
-
const { token, subject, state, fields, extra, originToken } = this.formManagerService.getFormInfo(this.
|
|
2626
|
-
if (!this.
|
|
2627
|
-
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;
|
|
2628
2639
|
}
|
|
2629
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;
|
|
2630
2641
|
this.inputDataFields = fields;
|
|
2631
2642
|
this.extraData = extra;
|
|
2632
|
-
this.
|
|
2643
|
+
this._originToken = originToken;
|
|
2633
2644
|
return state;
|
|
2634
2645
|
}
|
|
2635
2646
|
subscribeSectionActivation() {
|
|
2636
|
-
const formSections = this.
|
|
2647
|
+
const formSections = this._formStructure.sections;
|
|
2637
2648
|
if (Array.isArray(formSections)) {
|
|
2638
2649
|
formSections.forEach(section => {
|
|
2639
2650
|
section.activation.subscribe(code => this.launchSectionActivation(code));
|
|
@@ -2642,7 +2653,7 @@ class BasicFormComponent {
|
|
|
2642
2653
|
}
|
|
2643
2654
|
}
|
|
2644
2655
|
subscribeFieldsSubjects() {
|
|
2645
|
-
const formFields = this.
|
|
2656
|
+
const formFields = this._formStructure.getFields();
|
|
2646
2657
|
if (Array.isArray(formFields)) {
|
|
2647
2658
|
formFields.forEach(field => {
|
|
2648
2659
|
field.editionFinish.subscribe(event => {
|
|
@@ -2658,7 +2669,7 @@ class BasicFormComponent {
|
|
|
2658
2669
|
}
|
|
2659
2670
|
}
|
|
2660
2671
|
subscribeActionSubjects() {
|
|
2661
|
-
const formActions = this.
|
|
2672
|
+
const formActions = this._formStructure.getActions();
|
|
2662
2673
|
if (Array.isArray(formActions)) {
|
|
2663
2674
|
formActions.forEach(action => {
|
|
2664
2675
|
action.actionActivated.subscribe(code => this.startAction(code));
|
|
@@ -2666,7 +2677,7 @@ class BasicFormComponent {
|
|
|
2666
2677
|
}
|
|
2667
2678
|
}
|
|
2668
2679
|
subscribeTableSubjects() {
|
|
2669
|
-
const formTables = this.
|
|
2680
|
+
const formTables = this._formStructure.getTables();
|
|
2670
2681
|
if (Array.isArray(formTables)) {
|
|
2671
2682
|
formTables.forEach(table => {
|
|
2672
2683
|
table.inlineActionTrigger.subscribe(event => this.startTableAction(event));
|
|
@@ -2683,22 +2694,22 @@ class BasicFormComponent {
|
|
|
2683
2694
|
if (!this.name) {
|
|
2684
2695
|
return;
|
|
2685
2696
|
}
|
|
2686
|
-
if (!this.
|
|
2697
|
+
if (!this._definitionObtained) {
|
|
2687
2698
|
this.busy = true;
|
|
2688
2699
|
const formDefinition = yield this.formManagerService.getFormDefinition(this.name);
|
|
2689
2700
|
this.busy = false;
|
|
2690
|
-
this.
|
|
2691
|
-
this.fields = this.
|
|
2692
|
-
this.actions = this.
|
|
2693
|
-
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;
|
|
2694
2705
|
}
|
|
2695
2706
|
else {
|
|
2696
2707
|
this.cleanData();
|
|
2697
2708
|
}
|
|
2698
2709
|
if (!this.supportState(initialState)) {
|
|
2699
|
-
initialState = this.
|
|
2710
|
+
initialState = this._formStructure.defaultState;
|
|
2700
2711
|
}
|
|
2701
|
-
this.
|
|
2712
|
+
this._formStructure.changeState(initialState || this._formStructure.defaultState);
|
|
2702
2713
|
const inputFieldNames = Object.keys(this.inputDataFields);
|
|
2703
2714
|
for (let index = 0; index < inputFieldNames.length; index++) {
|
|
2704
2715
|
const fieldCode = inputFieldNames[index];
|
|
@@ -2707,7 +2718,7 @@ class BasicFormComponent {
|
|
|
2707
2718
|
}
|
|
2708
2719
|
const recordResponse = yield this.requestFormAction(formActions.getData);
|
|
2709
2720
|
this.checkErrorRecordReceived(recordResponse);
|
|
2710
|
-
this.
|
|
2721
|
+
this.visible = true;
|
|
2711
2722
|
this.subscribeSectionActivation();
|
|
2712
2723
|
this.subscribeFieldsSubjects();
|
|
2713
2724
|
this.subscribeActionSubjects();
|
|
@@ -2723,23 +2734,25 @@ class BasicFormComponent {
|
|
|
2723
2734
|
this.errorCode = recordResponse.errorCode;
|
|
2724
2735
|
this.errorMessage = recordResponse.errorMessage;
|
|
2725
2736
|
this.errorDetail = recordResponse.errorDetail;
|
|
2737
|
+
return true;
|
|
2726
2738
|
}
|
|
2727
2739
|
errorOccured() {
|
|
2728
2740
|
return (this.errorCode !== NO_ERROR);
|
|
2729
2741
|
}
|
|
2730
|
-
|
|
2731
|
-
|
|
2742
|
+
/**
|
|
2743
|
+
* Soporte manejo de eventos de formulario
|
|
2744
|
+
*/
|
|
2732
2745
|
requestFormAction(actionCode, actionSubject = {}) {
|
|
2733
2746
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2734
2747
|
const actionDetail = {
|
|
2735
2748
|
formCode: this.name,
|
|
2736
2749
|
formSubject: this.formSubject,
|
|
2737
|
-
currentMode: this.
|
|
2750
|
+
currentMode: this._formStructure.state,
|
|
2738
2751
|
actionCode,
|
|
2739
2752
|
actionSubject,
|
|
2740
2753
|
version: PAYLOAD_VERSION,
|
|
2741
|
-
formData: this.
|
|
2742
|
-
immutableData: this.
|
|
2754
|
+
formData: this._formStructure.getPayload(),
|
|
2755
|
+
immutableData: this._formStructure.immutableData,
|
|
2743
2756
|
};
|
|
2744
2757
|
this.errorCode = NO_ERROR;
|
|
2745
2758
|
this.errorMessage = '';
|
|
@@ -2769,7 +2782,7 @@ class BasicFormComponent {
|
|
|
2769
2782
|
}
|
|
2770
2783
|
if (actions && actions.length > 0) {
|
|
2771
2784
|
for (const changedAction of actions) {
|
|
2772
|
-
const actionObject = this.
|
|
2785
|
+
const actionObject = this.getAction(changedAction.actionCode);
|
|
2773
2786
|
if (actionObject) {
|
|
2774
2787
|
actionObject.updateFromServer(changedAction);
|
|
2775
2788
|
}
|
|
@@ -2777,7 +2790,7 @@ class BasicFormComponent {
|
|
|
2777
2790
|
}
|
|
2778
2791
|
if (fields && fields.length > 0) {
|
|
2779
2792
|
for (const changedField of fields) {
|
|
2780
|
-
const fieldObject = this.
|
|
2793
|
+
const fieldObject = this.getField(changedField.fieldCode);
|
|
2781
2794
|
if (fieldObject) {
|
|
2782
2795
|
fieldObject.updateFromServer(changedField);
|
|
2783
2796
|
}
|
|
@@ -2785,7 +2798,7 @@ class BasicFormComponent {
|
|
|
2785
2798
|
}
|
|
2786
2799
|
if (recordTables && recordTables.length > 0) {
|
|
2787
2800
|
for (const changedTable of recordTables) {
|
|
2788
|
-
const tableObject = this.
|
|
2801
|
+
const tableObject = this.getTable(changedTable.tableCode);
|
|
2789
2802
|
if (tableObject) {
|
|
2790
2803
|
tableObject.updateFromServer(changedTable);
|
|
2791
2804
|
}
|
|
@@ -2794,55 +2807,55 @@ class BasicFormComponent {
|
|
|
2794
2807
|
if (returnedFile && returnedFile.file) {
|
|
2795
2808
|
this.fileMgmtServices.saveFile(returnedFile.file, returnedFile.name, returnedFile.type);
|
|
2796
2809
|
}
|
|
2797
|
-
this.
|
|
2798
|
-
this.
|
|
2810
|
+
this._formStructure.immutableData = immutableData;
|
|
2811
|
+
this._formStructure.extraInfo = extraInfo;
|
|
2799
2812
|
}
|
|
2800
2813
|
/**
|
|
2801
2814
|
* Manejo de event handlers para acciones sobre el formulario
|
|
2802
2815
|
*/
|
|
2803
|
-
addSectionActivation(
|
|
2804
|
-
const sectionSet = (Array.isArray(
|
|
2816
|
+
addSectionActivation(sectionCodes, callbackMethod) {
|
|
2817
|
+
const sectionSet = (Array.isArray(sectionCodes)) ? sectionCodes : [sectionCodes];
|
|
2805
2818
|
sectionSet.forEach((sectionName) => {
|
|
2806
|
-
if (!this.
|
|
2807
|
-
this.
|
|
2819
|
+
if (!this._formSectionsActivate[sectionName]) {
|
|
2820
|
+
this._formSectionsActivate[sectionName] = [];
|
|
2808
2821
|
}
|
|
2809
|
-
this.
|
|
2822
|
+
this._formSectionsActivate[sectionName].push(callbackMethod);
|
|
2810
2823
|
});
|
|
2811
2824
|
}
|
|
2812
|
-
addSectionInactivation(
|
|
2813
|
-
const sectionSet = (Array.isArray(
|
|
2825
|
+
addSectionInactivation(sectionCodes, callbackMethod) {
|
|
2826
|
+
const sectionSet = (Array.isArray(sectionCodes)) ? sectionCodes : [sectionCodes];
|
|
2814
2827
|
sectionSet.forEach((sectionName) => {
|
|
2815
|
-
if (!this.
|
|
2816
|
-
this.
|
|
2828
|
+
if (!this._formSectionsInactivate[sectionName]) {
|
|
2829
|
+
this._formSectionsInactivate[sectionName] = [];
|
|
2817
2830
|
}
|
|
2818
|
-
this.
|
|
2831
|
+
this._formSectionsInactivate[sectionName].push(callbackMethod);
|
|
2819
2832
|
});
|
|
2820
2833
|
}
|
|
2821
2834
|
addActionMethodStart(actions, callbackMethod) {
|
|
2822
2835
|
const actionSet = (Array.isArray(actions)) ? actions : [actions];
|
|
2823
2836
|
actionSet.forEach((actionName) => {
|
|
2824
|
-
if (!this.
|
|
2825
|
-
this.
|
|
2837
|
+
if (!this._formActionsStart[actionName]) {
|
|
2838
|
+
this._formActionsStart[actionName] = [];
|
|
2826
2839
|
}
|
|
2827
|
-
this.
|
|
2840
|
+
this._formActionsStart[actionName].push(callbackMethod);
|
|
2828
2841
|
});
|
|
2829
2842
|
}
|
|
2830
2843
|
addActionMethodFinish(actions, callbackMethod) {
|
|
2831
2844
|
const actionSet = (Array.isArray(actions)) ? actions : [actions];
|
|
2832
2845
|
actionSet.forEach((actionName) => {
|
|
2833
|
-
if (!this.
|
|
2834
|
-
this.
|
|
2846
|
+
if (!this._formActionsFinish[actionName]) {
|
|
2847
|
+
this._formActionsFinish[actionName] = [];
|
|
2835
2848
|
}
|
|
2836
|
-
this.
|
|
2849
|
+
this._formActionsFinish[actionName].push(callbackMethod);
|
|
2837
2850
|
});
|
|
2838
2851
|
}
|
|
2839
|
-
launchSectionActivation(
|
|
2852
|
+
launchSectionActivation(code) {
|
|
2840
2853
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2841
|
-
const sectionObject = this.
|
|
2854
|
+
const sectionObject = this._formStructure.getSection(code);
|
|
2842
2855
|
if (!sectionObject) {
|
|
2843
2856
|
return;
|
|
2844
2857
|
}
|
|
2845
|
-
const clientSectionMethods = this.
|
|
2858
|
+
const clientSectionMethods = this._formSectionsActivate[code];
|
|
2846
2859
|
if (clientSectionMethods) {
|
|
2847
2860
|
for (const clientSectionMethod of clientSectionMethods) {
|
|
2848
2861
|
clientSectionMethod(sectionObject);
|
|
@@ -2850,13 +2863,13 @@ class BasicFormComponent {
|
|
|
2850
2863
|
}
|
|
2851
2864
|
});
|
|
2852
2865
|
}
|
|
2853
|
-
launchSectionInactivation(
|
|
2866
|
+
launchSectionInactivation(code) {
|
|
2854
2867
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2855
|
-
const sectionObject = this.
|
|
2868
|
+
const sectionObject = this._formStructure.getSection(code);
|
|
2856
2869
|
if (!sectionObject) {
|
|
2857
2870
|
return;
|
|
2858
2871
|
}
|
|
2859
|
-
const clientSectionMethods = this.
|
|
2872
|
+
const clientSectionMethods = this._formSectionsInactivate[code];
|
|
2860
2873
|
if (clientSectionMethods) {
|
|
2861
2874
|
for (const clientSectionMethod of clientSectionMethods) {
|
|
2862
2875
|
clientSectionMethod(sectionObject);
|
|
@@ -2864,15 +2877,15 @@ class BasicFormComponent {
|
|
|
2864
2877
|
}
|
|
2865
2878
|
});
|
|
2866
2879
|
}
|
|
2867
|
-
startAction(
|
|
2880
|
+
startAction(code) {
|
|
2868
2881
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2869
|
-
const actionObject = this.getAction(
|
|
2882
|
+
const actionObject = this.getAction(code);
|
|
2870
2883
|
if (!actionObject) {
|
|
2871
2884
|
return;
|
|
2872
2885
|
}
|
|
2873
2886
|
this.resetError();
|
|
2874
2887
|
actionObject.start();
|
|
2875
|
-
const clientActionMethods = this.
|
|
2888
|
+
const clientActionMethods = this._formActionsStart[code];
|
|
2876
2889
|
if (clientActionMethods) {
|
|
2877
2890
|
const clientActionPromises = [];
|
|
2878
2891
|
for (const clientActionMethod of clientActionMethods) {
|
|
@@ -2909,20 +2922,20 @@ class BasicFormComponent {
|
|
|
2909
2922
|
action.stop();
|
|
2910
2923
|
});
|
|
2911
2924
|
}
|
|
2912
|
-
finishAction(
|
|
2925
|
+
finishAction(action, actionResult) {
|
|
2913
2926
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2914
|
-
const finishActionMethods = this.
|
|
2927
|
+
const finishActionMethods = this._formActionsFinish[action.actionCode];
|
|
2915
2928
|
if (finishActionMethods) {
|
|
2916
2929
|
const clientActionPromises = [];
|
|
2917
2930
|
for (const clientActionMethod of finishActionMethods) {
|
|
2918
|
-
clientActionPromises.push(clientActionMethod(
|
|
2931
|
+
clientActionPromises.push(clientActionMethod(action, actionResult));
|
|
2919
2932
|
}
|
|
2920
2933
|
yield Promise.all(clientActionPromises);
|
|
2921
2934
|
}
|
|
2922
2935
|
});
|
|
2923
2936
|
}
|
|
2924
|
-
completeGlobalAction(
|
|
2925
|
-
return this.startServerAction(
|
|
2937
|
+
completeGlobalAction(action) {
|
|
2938
|
+
return this.startServerAction(action);
|
|
2926
2939
|
}
|
|
2927
2940
|
/**
|
|
2928
2941
|
* Manejadores de eventos para validaciones sobre campos
|
|
@@ -2930,38 +2943,38 @@ class BasicFormComponent {
|
|
|
2930
2943
|
addFieldInputValidation(fields, callbackMethod) {
|
|
2931
2944
|
const fieldSet = (Array.isArray(fields)) ? fields : [fields];
|
|
2932
2945
|
fieldSet.forEach((fieldCode) => {
|
|
2933
|
-
if (!this.
|
|
2934
|
-
this.
|
|
2946
|
+
if (!this._fieldInputValidation[fieldCode]) {
|
|
2947
|
+
this._fieldInputValidation[fieldCode] = [];
|
|
2935
2948
|
}
|
|
2936
|
-
this.
|
|
2949
|
+
this._fieldInputValidation[fieldCode].push(callbackMethod);
|
|
2937
2950
|
});
|
|
2938
2951
|
}
|
|
2939
2952
|
addFieldValidationStart(fields, callbackMethod) {
|
|
2940
2953
|
const fieldSet = (Array.isArray(fields)) ? fields : [fields];
|
|
2941
2954
|
fieldSet.forEach((fieldCode) => {
|
|
2942
|
-
if (!this.
|
|
2943
|
-
this.
|
|
2955
|
+
if (!this._fieldValidationsStart[fieldCode]) {
|
|
2956
|
+
this._fieldValidationsStart[fieldCode] = [];
|
|
2944
2957
|
}
|
|
2945
|
-
this.
|
|
2958
|
+
this._fieldValidationsStart[fieldCode].push(callbackMethod);
|
|
2946
2959
|
});
|
|
2947
2960
|
}
|
|
2948
2961
|
addFieldValidationFinish(fields, callbackMethod) {
|
|
2949
2962
|
const fieldSet = (Array.isArray(fields)) ? fields : [fields];
|
|
2950
2963
|
fieldSet.forEach((fieldCode) => {
|
|
2951
|
-
if (!this.
|
|
2952
|
-
this.
|
|
2964
|
+
if (!this._fieldValidationsFinish[fieldCode]) {
|
|
2965
|
+
this._fieldValidationsFinish[fieldCode] = [];
|
|
2953
2966
|
}
|
|
2954
|
-
this.
|
|
2967
|
+
this._fieldValidationsFinish[fieldCode].push(callbackMethod);
|
|
2955
2968
|
});
|
|
2956
2969
|
}
|
|
2957
2970
|
startFieldInputValidation(fieldCode, intrinsicValidation = true) {
|
|
2958
2971
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2959
|
-
const fieldToValidate = this.
|
|
2972
|
+
const fieldToValidate = this.getField(fieldCode);
|
|
2960
2973
|
if (!fieldToValidate) {
|
|
2961
2974
|
return false;
|
|
2962
2975
|
}
|
|
2963
2976
|
fieldToValidate.resetError();
|
|
2964
|
-
const validationCallbacks = this.
|
|
2977
|
+
const validationCallbacks = this._fieldInputValidation[fieldCode];
|
|
2965
2978
|
if (validationCallbacks) {
|
|
2966
2979
|
const clientValidationPromises = [];
|
|
2967
2980
|
for (const validationMethod of validationCallbacks) {
|
|
@@ -2979,7 +2992,7 @@ class BasicFormComponent {
|
|
|
2979
2992
|
return;
|
|
2980
2993
|
}
|
|
2981
2994
|
fieldToValidate.resetError();
|
|
2982
|
-
const validationCallbacks = this.
|
|
2995
|
+
const validationCallbacks = this._fieldValidationsStart[fieldCode];
|
|
2983
2996
|
if (validationCallbacks) {
|
|
2984
2997
|
const clientValidationPromises = [];
|
|
2985
2998
|
for (const validationMethod of validationCallbacks) {
|
|
@@ -3020,7 +3033,7 @@ class BasicFormComponent {
|
|
|
3020
3033
|
}
|
|
3021
3034
|
finishFieldValidation(fieldObject, validationResult) {
|
|
3022
3035
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3023
|
-
const validationCallbacks = this.
|
|
3036
|
+
const validationCallbacks = this._fieldValidationsFinish[fieldObject.fieldCode];
|
|
3024
3037
|
if (validationCallbacks) {
|
|
3025
3038
|
const clientActionPromises = [];
|
|
3026
3039
|
for (const validationMethod of validationCallbacks) {
|
|
@@ -3043,17 +3056,17 @@ class BasicFormComponent {
|
|
|
3043
3056
|
if (!tableObject) {
|
|
3044
3057
|
return;
|
|
3045
3058
|
}
|
|
3046
|
-
const inlineActionObject = tableObject.
|
|
3059
|
+
const inlineActionObject = tableObject.getAction(actionCode);
|
|
3047
3060
|
if (!inlineActionObject) {
|
|
3048
3061
|
return;
|
|
3049
3062
|
}
|
|
3050
3063
|
let tableEventHandlers = null;
|
|
3051
|
-
if (this.
|
|
3052
|
-
tableEventHandlers = this.
|
|
3064
|
+
if (this._tableActionsStart[tableName]) {
|
|
3065
|
+
tableEventHandlers = this._tableActionsStart[tableName];
|
|
3053
3066
|
}
|
|
3054
3067
|
else {
|
|
3055
3068
|
tableEventHandlers = {};
|
|
3056
|
-
this.
|
|
3069
|
+
this._tableActionsStart[tableName] = tableEventHandlers;
|
|
3057
3070
|
}
|
|
3058
3071
|
if (!tableEventHandlers[actionCode]) {
|
|
3059
3072
|
tableEventHandlers[actionCode] = [];
|
|
@@ -3065,17 +3078,17 @@ class BasicFormComponent {
|
|
|
3065
3078
|
if (!tableObject) {
|
|
3066
3079
|
return;
|
|
3067
3080
|
}
|
|
3068
|
-
const inlineActionObject = tableObject.
|
|
3081
|
+
const inlineActionObject = tableObject.getAction(actionCode);
|
|
3069
3082
|
if (!inlineActionObject) {
|
|
3070
3083
|
return;
|
|
3071
3084
|
}
|
|
3072
3085
|
let tableEventHandlers = null;
|
|
3073
|
-
if (this.
|
|
3074
|
-
tableEventHandlers = this.
|
|
3086
|
+
if (this._tableActionsFinish[tableName]) {
|
|
3087
|
+
tableEventHandlers = this._tableActionsFinish[tableName];
|
|
3075
3088
|
}
|
|
3076
3089
|
else {
|
|
3077
3090
|
tableEventHandlers = {};
|
|
3078
|
-
this.
|
|
3091
|
+
this._tableActionsFinish[tableName] = tableEventHandlers;
|
|
3079
3092
|
}
|
|
3080
3093
|
if (!tableEventHandlers[actionCode]) {
|
|
3081
3094
|
tableEventHandlers[actionCode] = [];
|
|
@@ -3088,12 +3101,12 @@ class BasicFormComponent {
|
|
|
3088
3101
|
return;
|
|
3089
3102
|
}
|
|
3090
3103
|
let tableEventHandlers = null;
|
|
3091
|
-
if (this.
|
|
3092
|
-
tableEventHandlers = this.
|
|
3104
|
+
if (this._tableSelectionsStart[tableName]) {
|
|
3105
|
+
tableEventHandlers = this._tableSelectionsStart[tableName];
|
|
3093
3106
|
}
|
|
3094
3107
|
else {
|
|
3095
3108
|
tableEventHandlers = [];
|
|
3096
|
-
this.
|
|
3109
|
+
this._tableSelectionsStart[tableName] = tableEventHandlers;
|
|
3097
3110
|
}
|
|
3098
3111
|
tableEventHandlers.push(callbackMethod);
|
|
3099
3112
|
}
|
|
@@ -3103,12 +3116,12 @@ class BasicFormComponent {
|
|
|
3103
3116
|
return;
|
|
3104
3117
|
}
|
|
3105
3118
|
let tableEventHandlers = null;
|
|
3106
|
-
if (this.
|
|
3107
|
-
tableEventHandlers = this.
|
|
3119
|
+
if (this._tableSelectionsFinish[tableName]) {
|
|
3120
|
+
tableEventHandlers = this._tableSelectionsFinish[tableName];
|
|
3108
3121
|
}
|
|
3109
3122
|
else {
|
|
3110
3123
|
tableEventHandlers = [];
|
|
3111
|
-
this.
|
|
3124
|
+
this._tableSelectionsFinish[tableName] = tableEventHandlers;
|
|
3112
3125
|
}
|
|
3113
3126
|
tableEventHandlers.push(callbackMethod);
|
|
3114
3127
|
}
|
|
@@ -3118,12 +3131,12 @@ class BasicFormComponent {
|
|
|
3118
3131
|
return;
|
|
3119
3132
|
}
|
|
3120
3133
|
let tableEventHandlers = null;
|
|
3121
|
-
if (this.
|
|
3122
|
-
tableEventHandlers = this.
|
|
3134
|
+
if (this._tableGetDataStart[tableName]) {
|
|
3135
|
+
tableEventHandlers = this._tableGetDataStart[tableName];
|
|
3123
3136
|
}
|
|
3124
3137
|
else {
|
|
3125
3138
|
tableEventHandlers = [];
|
|
3126
|
-
this.
|
|
3139
|
+
this._tableGetDataStart[tableName] = tableEventHandlers;
|
|
3127
3140
|
}
|
|
3128
3141
|
tableEventHandlers.push(callbackMethod);
|
|
3129
3142
|
}
|
|
@@ -3133,12 +3146,12 @@ class BasicFormComponent {
|
|
|
3133
3146
|
return;
|
|
3134
3147
|
}
|
|
3135
3148
|
let tableEventHandlers = null;
|
|
3136
|
-
if (this.
|
|
3137
|
-
tableEventHandlers = this.
|
|
3149
|
+
if (this._tableGetDataFinish[tableName]) {
|
|
3150
|
+
tableEventHandlers = this._tableGetDataFinish[tableName];
|
|
3138
3151
|
}
|
|
3139
3152
|
else {
|
|
3140
3153
|
tableEventHandlers = {};
|
|
3141
|
-
this.
|
|
3154
|
+
this._tableGetDataFinish[tableName] = tableEventHandlers;
|
|
3142
3155
|
}
|
|
3143
3156
|
tableEventHandlers[GET_DATA_ACTION] = callbackMethod;
|
|
3144
3157
|
}
|
|
@@ -3160,7 +3173,7 @@ class BasicFormComponent {
|
|
|
3160
3173
|
tableCode,
|
|
3161
3174
|
actionCode,
|
|
3162
3175
|
};
|
|
3163
|
-
const tableEventHandlers = this.
|
|
3176
|
+
const tableEventHandlers = this._tableActionsStart[tableCode];
|
|
3164
3177
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3165
3178
|
if (tableActionMethods) {
|
|
3166
3179
|
const clientActionPromises = [];
|
|
@@ -3209,7 +3222,7 @@ class BasicFormComponent {
|
|
|
3209
3222
|
finishTableGlobalAction(tableActionDetail, actionResult) {
|
|
3210
3223
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3211
3224
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3212
|
-
const tableEventHandlers = this.
|
|
3225
|
+
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3213
3226
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3214
3227
|
if (tableActionMethods) {
|
|
3215
3228
|
const clientActionPromises = [];
|
|
@@ -3241,7 +3254,7 @@ class BasicFormComponent {
|
|
|
3241
3254
|
recordId,
|
|
3242
3255
|
recordData
|
|
3243
3256
|
};
|
|
3244
|
-
const tableEventHandlers = this.
|
|
3257
|
+
const tableEventHandlers = this._tableActionsStart[tableCode];
|
|
3245
3258
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3246
3259
|
if (tableActionMethods) {
|
|
3247
3260
|
const clientActionPromises = [];
|
|
@@ -3295,7 +3308,7 @@ class BasicFormComponent {
|
|
|
3295
3308
|
finishTableAction(tableActionDetail, actionResult) {
|
|
3296
3309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3297
3310
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3298
|
-
const tableEventHandlers = this.
|
|
3311
|
+
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3299
3312
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3300
3313
|
if (tableActionMethods) {
|
|
3301
3314
|
const clientActionPromises = [];
|
|
@@ -3321,7 +3334,7 @@ class BasicFormComponent {
|
|
|
3321
3334
|
recordId,
|
|
3322
3335
|
recordData
|
|
3323
3336
|
};
|
|
3324
|
-
const tableEventHandlers = this.
|
|
3337
|
+
const tableEventHandlers = this._tableSelectionsStart[tableCode];
|
|
3325
3338
|
if (tableEventHandlers) {
|
|
3326
3339
|
const clientActionPromises = [];
|
|
3327
3340
|
for (const tableSelectionMethod of tableEventHandlers) {
|
|
@@ -3370,7 +3383,7 @@ class BasicFormComponent {
|
|
|
3370
3383
|
finishTableRecordSelection(tableSelectionDetail, actionResult) {
|
|
3371
3384
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3372
3385
|
const { tableCode } = tableSelectionDetail;
|
|
3373
|
-
const tableEventHandlers = this.
|
|
3386
|
+
const tableEventHandlers = this._tableSelectionsFinish[tableCode];
|
|
3374
3387
|
if (tableEventHandlers) {
|
|
3375
3388
|
const clientActionPromises = [];
|
|
3376
3389
|
for (const tableSelectionMethod of tableEventHandlers) {
|
|
@@ -3400,7 +3413,7 @@ class BasicFormComponent {
|
|
|
3400
3413
|
actionCode,
|
|
3401
3414
|
selectedRecords
|
|
3402
3415
|
};
|
|
3403
|
-
const tableEventHandlers = this.
|
|
3416
|
+
const tableEventHandlers = this._tableActionsStart[tableCode];
|
|
3404
3417
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3405
3418
|
if (tableActionMethods) {
|
|
3406
3419
|
const clientActionPromises = [];
|
|
@@ -3450,7 +3463,7 @@ class BasicFormComponent {
|
|
|
3450
3463
|
finishTableSelectionAction(tableActionDetail, actionResult) {
|
|
3451
3464
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3452
3465
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3453
|
-
const tableEventHandlers = this.
|
|
3466
|
+
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3454
3467
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3455
3468
|
if (tableActionMethods) {
|
|
3456
3469
|
const clientActionPromises = [];
|
|
@@ -3470,7 +3483,7 @@ class BasicFormComponent {
|
|
|
3470
3483
|
tableCode
|
|
3471
3484
|
};
|
|
3472
3485
|
this.resetError();
|
|
3473
|
-
const tableEventHandlers = this.
|
|
3486
|
+
const tableEventHandlers = this._tableGetDataStart[tableCode];
|
|
3474
3487
|
if (tableEventHandlers) {
|
|
3475
3488
|
const clientActionPromises = [];
|
|
3476
3489
|
for (const tableActionMethod of tableEventHandlers) {
|
|
@@ -3505,7 +3518,7 @@ class BasicFormComponent {
|
|
|
3505
3518
|
finishTableGetData(tableActionDetail, actionResult) {
|
|
3506
3519
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3507
3520
|
const { tableCode, tableActionCode } = tableActionDetail;
|
|
3508
|
-
const tableEventHandlers = this.
|
|
3521
|
+
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3509
3522
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[tableActionCode] : null;
|
|
3510
3523
|
if (tableActionMethods) {
|
|
3511
3524
|
const clientActionPromises = [];
|