tuain-ng-forms-lib 12.0.20 → 12.0.24
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 +3 -3
- package/bundles/tuain-ng-forms-lib.umd.js +484 -632
- 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 +12 -2
- package/esm2015/lib/classes/forms/field.js +9 -21
- package/esm2015/lib/classes/forms/form.js +153 -236
- 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 +9 -8
- package/esm2015/lib/components/elements/tables/table.component.js +31 -31
- package/esm2015/lib/components/forms/basic-form.js +141 -138
- package/fesm2015/tuain-ng-forms-lib.js +363 -512
- 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 +10 -0
- package/lib/classes/forms/field.d.ts +0 -3
- package/lib/classes/forms/form.d.ts +53 -55
- 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 +3 -2
- package/lib/components/elements/tables/table.component.d.ts +1 -1
- package/lib/components/forms/basic-form.d.ts +130 -93
- 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
|
@@ -143,17 +143,17 @@ FieldComponent.propDecorators = {
|
|
|
143
143
|
class ElementComponent {
|
|
144
144
|
ngOnInit() {
|
|
145
145
|
var _a;
|
|
146
|
-
this.formConfig = (_a = this.
|
|
146
|
+
this.formConfig = (_a = this.element) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
147
147
|
this.start();
|
|
148
148
|
}
|
|
149
149
|
start() { }
|
|
150
150
|
get visible() {
|
|
151
|
-
var _a
|
|
152
|
-
return (_a = this.
|
|
151
|
+
var _a;
|
|
152
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState);
|
|
153
153
|
}
|
|
154
154
|
get disabled() {
|
|
155
|
-
var _a
|
|
156
|
-
return !((_a = this.
|
|
155
|
+
var _a;
|
|
156
|
+
return !((_a = this.element) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
ElementComponent.decorators = [
|
|
@@ -163,8 +163,9 @@ ElementComponent.decorators = [
|
|
|
163
163
|
},] }
|
|
164
164
|
];
|
|
165
165
|
ElementComponent.propDecorators = {
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
element: [{ type: Input }],
|
|
167
|
+
form: [{ type: Input }],
|
|
168
|
+
currentState: [{ type: Input }]
|
|
168
169
|
};
|
|
169
170
|
|
|
170
171
|
class FormErrorComponent {
|
|
@@ -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,11 @@ 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) { return name && (this.customAttributes[name] = value); }
|
|
301
|
+
matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
|
|
297
302
|
isField() { return this.elementType === elementTypes.field; }
|
|
298
303
|
isAction() { return this.elementType === elementTypes.action; }
|
|
299
304
|
isTable() { return this.elementType === elementTypes.table; }
|
|
@@ -311,7 +316,13 @@ class FormElement {
|
|
|
311
316
|
}
|
|
312
317
|
viewOnState(state) { return (this.visibleStates && state) ? this.visibleStates.includes(state) : false; }
|
|
313
318
|
enabledOnState(state) { return (this.enabledStates && state) ? this.enabledStates.includes(state) : false; }
|
|
319
|
+
/**
|
|
320
|
+
* @deprecated Utilizar viewOnState
|
|
321
|
+
*/
|
|
314
322
|
supportState(state) { return this.viewOnState(state); }
|
|
323
|
+
/**
|
|
324
|
+
* @deprecated Utilizar viewOnState
|
|
325
|
+
*/
|
|
315
326
|
supportMode(state) { return this.viewOnState(state); }
|
|
316
327
|
get visible() { return (this._isForced) ? this._visibleForced : this._visible; }
|
|
317
328
|
set visible(visible) { this.setVisibility(visible); }
|
|
@@ -388,62 +399,6 @@ class TableAction {
|
|
|
388
399
|
enabledOnState(state) { return this.enabledStates.includes(state); }
|
|
389
400
|
}
|
|
390
401
|
|
|
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
402
|
class TableRecordData {
|
|
448
403
|
constructor(recordReceived, recordDefinition, selectionFieldName = null) {
|
|
449
404
|
this.recordData = {};
|
|
@@ -460,8 +415,7 @@ class TableRecordData {
|
|
|
460
415
|
rawRecordData.forEach(fieldData => {
|
|
461
416
|
const { fieldCode, fieldValue } = fieldData;
|
|
462
417
|
const fieldDef = recordDefinition.find(column => column.fieldCode === fieldCode);
|
|
463
|
-
|
|
464
|
-
this.recordData[fieldCode] = formattedFieldValue;
|
|
418
|
+
this.recordData[fieldCode] = fieldValue !== null && fieldValue !== void 0 ? fieldValue : '';
|
|
465
419
|
if (fieldCode === selectionFieldName) {
|
|
466
420
|
this.selected = fieldValue;
|
|
467
421
|
}
|
|
@@ -472,29 +426,13 @@ class TableRecordData {
|
|
|
472
426
|
fields.forEach(fieldCode => {
|
|
473
427
|
const fieldValue = recordData[fieldCode];
|
|
474
428
|
const fieldDef = recordDefinition.find(column => column.fieldCode === fieldCode);
|
|
475
|
-
|
|
476
|
-
this.recordData[fieldCode] = formattedFieldValue;
|
|
429
|
+
this.recordData[fieldCode] = fieldValue !== null && fieldValue !== void 0 ? fieldValue : '';
|
|
477
430
|
});
|
|
478
431
|
}
|
|
479
432
|
}
|
|
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
|
-
}
|
|
433
|
+
toggleSelect() { this.selected = !this.selected; }
|
|
434
|
+
select() { this.selected = true; }
|
|
435
|
+
unselect() { this.selected = false; }
|
|
498
436
|
get recordIdKey() {
|
|
499
437
|
return (typeof this.recordId === 'object')
|
|
500
438
|
? JSON.stringify(this.recordId) : this.recordId;
|
|
@@ -575,7 +513,7 @@ const TABLE_FILTER_TYPES = {
|
|
|
575
513
|
};
|
|
576
514
|
class RecordTable extends FormElement {
|
|
577
515
|
constructor(tableReceived, formConfig) {
|
|
578
|
-
var _a, _b, _c, _d, _e, _f
|
|
516
|
+
var _a, _b, _c, _d, _e, _f;
|
|
579
517
|
super(tableReceived, formConfig);
|
|
580
518
|
this._inlineActionTrigger = new Subject();
|
|
581
519
|
this._globalActionTrigger = new Subject();
|
|
@@ -608,8 +546,7 @@ class RecordTable extends FormElement {
|
|
|
608
546
|
this._appendPages = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.append) !== null && _c !== void 0 ? _c : false;
|
|
609
547
|
this.selectable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _d !== void 0 ? _d : false;
|
|
610
548
|
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);
|
|
549
|
+
this.setAttr('sortable', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _f !== void 0 ? _f : false);
|
|
613
550
|
this.setAttr('sorting', { columnName: '', direction: '' });
|
|
614
551
|
this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
|
|
615
552
|
if (tableReceived.fields) {
|
|
@@ -1050,23 +987,23 @@ class LibTableComponent {
|
|
|
1050
987
|
}
|
|
1051
988
|
ngOnInit() {
|
|
1052
989
|
var _a, _b;
|
|
1053
|
-
if (this.
|
|
1054
|
-
this.formConfig = (_a = this.
|
|
990
|
+
if (this.table) {
|
|
991
|
+
this.formConfig = (_a = this.table) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
1055
992
|
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.
|
|
993
|
+
this.selectable = this.table.selectable;
|
|
994
|
+
this.hasActions = this.table.hasActions;
|
|
995
|
+
this.table.widget = this;
|
|
996
|
+
this.inlineActions = this.table.getActions(this.formConfig.tableActions.inline);
|
|
997
|
+
this.globalActions = this.table.getActions(this.formConfig.tableActions.global);
|
|
998
|
+
this.selectionActions = this.table.getActions(this.formConfig.tableActions.selection);
|
|
1062
999
|
// Inicialización de campos mapeados del objeto
|
|
1063
1000
|
const mapping = Object.entries(this.formConfig.componentTableAttrMap);
|
|
1064
1001
|
for (let index = 0; index < mapping.length; index++) {
|
|
1065
1002
|
const [tableAttr, compAttr] = mapping[index];
|
|
1066
|
-
this[compAttr.toString()] = (_b = this.
|
|
1003
|
+
this[compAttr.toString()] = (_b = this.table) === null || _b === void 0 ? void 0 : _b[tableAttr.toString()];
|
|
1067
1004
|
}
|
|
1068
1005
|
// Subscripción a cambios en atributos
|
|
1069
|
-
this.
|
|
1006
|
+
this.table.attributeChange.subscribe(event => {
|
|
1070
1007
|
const { name: tableAttr, value } = event;
|
|
1071
1008
|
const compAttr = this.formConfig.componentTableAttrMap[tableAttr];
|
|
1072
1009
|
this.hasOwnProperty(compAttr) && (this[compAttr] = value);
|
|
@@ -1076,24 +1013,24 @@ class LibTableComponent {
|
|
|
1076
1013
|
}
|
|
1077
1014
|
start() { }
|
|
1078
1015
|
tableGlobalAction(actionCode) {
|
|
1079
|
-
this.
|
|
1016
|
+
this.table.notifyGlobalAction(actionCode);
|
|
1080
1017
|
}
|
|
1081
1018
|
tableSelectionAction(actionCode) {
|
|
1082
|
-
this.
|
|
1019
|
+
this.table.notifySelectionAction(actionCode);
|
|
1083
1020
|
}
|
|
1084
1021
|
tableActionSelected(actionEvent) {
|
|
1085
|
-
this.
|
|
1022
|
+
this.table.notifyInlineAction(actionEvent);
|
|
1086
1023
|
}
|
|
1087
1024
|
tableColumnSort(columnFieldCode) {
|
|
1088
|
-
this.
|
|
1025
|
+
this.table.setRequiredOrder(columnFieldCode);
|
|
1089
1026
|
if (this.clientPaging) {
|
|
1090
|
-
return this.
|
|
1027
|
+
return this.table.localSortData();
|
|
1091
1028
|
}
|
|
1092
|
-
this.
|
|
1029
|
+
this.table.notifyGetDataAction();
|
|
1093
1030
|
}
|
|
1094
1031
|
changePage(requestedPage) {
|
|
1095
1032
|
if (!this.clientPaging) {
|
|
1096
|
-
this.
|
|
1033
|
+
this.table.notifyGetDataAction(requestedPage);
|
|
1097
1034
|
}
|
|
1098
1035
|
}
|
|
1099
1036
|
get records() {
|
|
@@ -1109,45 +1046,45 @@ class LibTableComponent {
|
|
|
1109
1046
|
const { eventType } = tableFilterEvent;
|
|
1110
1047
|
let triggerDataUpdate = false;
|
|
1111
1048
|
if (eventType === TABLE_FILTER_TYPES.simpleFilterChange || eventType === TABLE_FILTER_TYPES.simpleFilterFinish) {
|
|
1112
|
-
this.
|
|
1049
|
+
this.table.simpleFilterText = tableFilterEvent.simpleFilterString.trim();
|
|
1113
1050
|
if (this.clientPaging) {
|
|
1114
|
-
this.
|
|
1115
|
-
this.
|
|
1051
|
+
this.table.setAttr('currentPage', 1);
|
|
1052
|
+
this.table.updateVisibleRecords();
|
|
1116
1053
|
}
|
|
1117
1054
|
else if (eventType === TABLE_FILTER_TYPES.simpleFilterFinish) {
|
|
1118
1055
|
triggerDataUpdate = true;
|
|
1119
1056
|
}
|
|
1120
1057
|
}
|
|
1121
1058
|
if (eventType === TABLE_FILTER_TYPES.complexFilterAdd) {
|
|
1122
|
-
this.
|
|
1059
|
+
this.table.addFilterRestriction(tableFilterEvent.complexFilterItem);
|
|
1123
1060
|
}
|
|
1124
1061
|
if (eventType === TABLE_FILTER_TYPES.complexFilterRemove) {
|
|
1125
|
-
this.
|
|
1062
|
+
this.table.removeFilterRestriction(tableFilterEvent.itemName);
|
|
1126
1063
|
}
|
|
1127
1064
|
if (triggerDataUpdate) {
|
|
1128
1065
|
const tableGetDataEvent = {
|
|
1129
|
-
tableCode: this.
|
|
1066
|
+
tableCode: this.table.tableCode,
|
|
1130
1067
|
requestedPage: 1,
|
|
1131
1068
|
};
|
|
1132
|
-
this.
|
|
1069
|
+
this.table.notifyGetDataAction(tableGetDataEvent);
|
|
1133
1070
|
}
|
|
1134
1071
|
}
|
|
1135
1072
|
tableSelectionToggle(recordId) {
|
|
1136
|
-
this.
|
|
1073
|
+
this.table.notifyRecordSelection(recordId);
|
|
1137
1074
|
}
|
|
1138
1075
|
toggleSelectAll() {
|
|
1139
1076
|
if (this.allSelected) {
|
|
1140
|
-
this.
|
|
1077
|
+
this.table.unSelectAll();
|
|
1141
1078
|
}
|
|
1142
1079
|
else {
|
|
1143
|
-
this.
|
|
1080
|
+
this.table.selectAll();
|
|
1144
1081
|
}
|
|
1145
1082
|
}
|
|
1146
1083
|
get availableFilters() {
|
|
1147
|
-
return this.
|
|
1084
|
+
return this.table.availableFilters;
|
|
1148
1085
|
}
|
|
1149
1086
|
get selectedRecords() {
|
|
1150
|
-
return this.
|
|
1087
|
+
return this.table.selectedRecords;
|
|
1151
1088
|
}
|
|
1152
1089
|
}
|
|
1153
1090
|
LibTableComponent.decorators = [
|
|
@@ -1158,7 +1095,7 @@ LibTableComponent.decorators = [
|
|
|
1158
1095
|
},] }
|
|
1159
1096
|
];
|
|
1160
1097
|
LibTableComponent.propDecorators = {
|
|
1161
|
-
|
|
1098
|
+
table: [{ type: Input }],
|
|
1162
1099
|
tableRecords: [{ type: Input }],
|
|
1163
1100
|
disabled: [{ type: Input }],
|
|
1164
1101
|
currentState: [{ type: Input }],
|
|
@@ -1230,6 +1167,7 @@ class RecordFormSubSection {
|
|
|
1230
1167
|
|
|
1231
1168
|
class RecordFormSection {
|
|
1232
1169
|
constructor(sectionReceived, formObject) {
|
|
1170
|
+
var _a;
|
|
1233
1171
|
this._activation = new Subject();
|
|
1234
1172
|
this._inactivation = new Subject();
|
|
1235
1173
|
this.active = false;
|
|
@@ -1268,7 +1206,12 @@ class RecordFormSection {
|
|
|
1268
1206
|
}
|
|
1269
1207
|
}
|
|
1270
1208
|
}
|
|
1209
|
+
this.customAttributes = (_a = sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes) !== null && _a !== void 0 ? _a : null;
|
|
1271
1210
|
}
|
|
1211
|
+
getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
|
|
1212
|
+
setCustomAttribute(name, value) { return name && (this.customAttributes[name] = value); }
|
|
1213
|
+
matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
|
|
1214
|
+
get code() { return this.sectionCode; }
|
|
1272
1215
|
get activation() { return this._activation; }
|
|
1273
1216
|
get inactivation() { return this._inactivation; }
|
|
1274
1217
|
activate() {
|
|
@@ -1334,7 +1277,7 @@ class RecordFormSection {
|
|
|
1334
1277
|
const HEADER = 'HEADER';
|
|
1335
1278
|
class FormAction extends FormElement {
|
|
1336
1279
|
constructor(actionDefinition, formConfig) {
|
|
1337
|
-
var _a
|
|
1280
|
+
var _a;
|
|
1338
1281
|
super(actionDefinition, formConfig);
|
|
1339
1282
|
this._actionActivated = new Subject();
|
|
1340
1283
|
this.inProgress = false;
|
|
@@ -1342,10 +1285,9 @@ class FormAction extends FormElement {
|
|
|
1342
1285
|
this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
|
|
1343
1286
|
this.actionName = actionDefinition.actionTitle;
|
|
1344
1287
|
this.iconName = actionDefinition.iconName || this.actionCode;
|
|
1345
|
-
this.location
|
|
1288
|
+
this.setCustomAttribute('location', actionDefinition.position || HEADER);
|
|
1346
1289
|
this.backend = (_a = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _a !== void 0 ? _a : false;
|
|
1347
1290
|
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
1291
|
this.restrictedOnField = actionDefinition.fieldRestrictedCode ? actionDefinition.fieldRestrictedCode.toString() : '';
|
|
1350
1292
|
this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
|
|
1351
1293
|
this.restrictedOnValue = actionDefinition.valueRestricted || '';
|
|
@@ -1383,7 +1325,6 @@ const fldAttr = {
|
|
|
1383
1325
|
info: 'fieldInfo',
|
|
1384
1326
|
defaultValue: 'defaultValue',
|
|
1385
1327
|
defaultEditable: 'defaultEditable',
|
|
1386
|
-
customAttributes: 'customAttributes',
|
|
1387
1328
|
visibleLabel: 'visibleLabel',
|
|
1388
1329
|
required: 'fieldRequired',
|
|
1389
1330
|
hasChanged: 'hasChanged',
|
|
@@ -1402,7 +1343,7 @@ const fldAttr = {
|
|
|
1402
1343
|
};
|
|
1403
1344
|
class FieldDescriptor extends FormElement {
|
|
1404
1345
|
constructor(inputFieldReceived, formConfig) {
|
|
1405
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
1346
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1406
1347
|
super(inputFieldReceived, formConfig);
|
|
1407
1348
|
this._editionFinish = new Subject();
|
|
1408
1349
|
this._editionPartial = new Subject();
|
|
@@ -1428,18 +1369,17 @@ class FieldDescriptor extends FormElement {
|
|
|
1428
1369
|
}
|
|
1429
1370
|
this.setAttr(fldAttr.format, fieldFormat);
|
|
1430
1371
|
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
1372
|
this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
|
|
1433
1373
|
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 = (
|
|
1374
|
+
this.setAttr(fldAttr.required, (_e = fld.required) !== null && _e !== void 0 ? _e : false);
|
|
1375
|
+
this.setError(fld.errorCode, fld.errorMessage, (_f = fld.errorType) !== null && _f !== void 0 ? _f : DEFAULT_ERROR_TYPE);
|
|
1376
|
+
this.setAttr(fldAttr.outputOnly, (_g = fld.outputOnly) !== null && _g !== void 0 ? _g : false);
|
|
1377
|
+
const maxLength = (_h = fld.maxLength) !== null && _h !== void 0 ? _h : (this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
1438
1378
|
this.setAttr(fldAttr.maxLength, maxLength);
|
|
1439
|
-
this.setAttr(fldAttr.intrinsicErrorMessage, (
|
|
1379
|
+
this.setAttr(fldAttr.intrinsicErrorMessage, (_j = this._formConfig.fieldTypeErrMsg[this.fieldType]) !== null && _j !== void 0 ? _j : this._formConfig.fieldTypeErrMsg.DEFAULT);
|
|
1440
1380
|
this.setFieldType(fld.fieldTypeCode);
|
|
1441
|
-
this.setEditable((
|
|
1442
|
-
this.setVisibleLabel((
|
|
1381
|
+
this.setEditable((_k = fld.editable) !== null && _k !== void 0 ? _k : true);
|
|
1382
|
+
this.setVisibleLabel((_l = fld.visibleLabel) !== null && _l !== void 0 ? _l : true);
|
|
1443
1383
|
this.setVisibility(fld.visible);
|
|
1444
1384
|
this.setFieldOptions(fld.fieldOptions);
|
|
1445
1385
|
this.setValue(fld.fieldValue || this.defaultValue || '');
|
|
@@ -1494,7 +1434,6 @@ class FieldDescriptor extends FormElement {
|
|
|
1494
1434
|
notifyEditionDetailRequest() {
|
|
1495
1435
|
this._detailRequest.next(this.fieldCode);
|
|
1496
1436
|
}
|
|
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
1437
|
setVisibleLabel(visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); }
|
|
1499
1438
|
showLabel() { this.setVisibleLabel(true); }
|
|
1500
1439
|
hideLabel() { this.setVisibleLabel(false); }
|
|
@@ -1574,11 +1513,6 @@ class FieldDescriptor extends FormElement {
|
|
|
1574
1513
|
setFieldType(inputFieldType) {
|
|
1575
1514
|
this.setAttr(fldAttr.type, inputFieldType);
|
|
1576
1515
|
}
|
|
1577
|
-
format() {
|
|
1578
|
-
if (this.fieldType === this._formConfig.fieldTypes.currency) {
|
|
1579
|
-
this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
1516
|
setMinValue(minValue) {
|
|
1583
1517
|
var _a, _b, _c;
|
|
1584
1518
|
if (this.fieldType === this._formConfig.fieldTypes.date
|
|
@@ -1688,9 +1622,6 @@ class FieldDescriptor extends FormElement {
|
|
|
1688
1622
|
(_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
|
|
1689
1623
|
}
|
|
1690
1624
|
break;
|
|
1691
|
-
case this._formConfig.fieldTypes.currency:
|
|
1692
|
-
newFinalValue = formatCurrency(newValue);
|
|
1693
|
-
break;
|
|
1694
1625
|
default:
|
|
1695
1626
|
newFinalValue = newValue;
|
|
1696
1627
|
break;
|
|
@@ -1703,20 +1634,27 @@ class FieldDescriptor extends FormElement {
|
|
|
1703
1634
|
}
|
|
1704
1635
|
}
|
|
1705
1636
|
|
|
1637
|
+
const ACTIVE = 'active';
|
|
1638
|
+
const SHOW = 'show';
|
|
1639
|
+
const HIDE = 'hide';
|
|
1640
|
+
const ENABLE = 'enable';
|
|
1641
|
+
const DISABLE = 'disable';
|
|
1642
|
+
const CLEAN = 'clean';
|
|
1706
1643
|
class FormStructureAndData {
|
|
1707
1644
|
constructor(definitionReceived, formConfig) {
|
|
1708
|
-
this.
|
|
1709
|
-
this.
|
|
1710
|
-
this.
|
|
1711
|
-
this.
|
|
1645
|
+
this._fields = {};
|
|
1646
|
+
this._actions = {};
|
|
1647
|
+
this._tables = {};
|
|
1648
|
+
this._sections = {};
|
|
1712
1649
|
this._immutableData = {};
|
|
1713
1650
|
this._extraInfo = {};
|
|
1651
|
+
this._exclusiveSectionsByAttr = {};
|
|
1714
1652
|
this._formConfig = formConfig;
|
|
1715
1653
|
this.state = '';
|
|
1716
|
-
this.
|
|
1717
|
-
this.
|
|
1718
|
-
this.
|
|
1719
|
-
this.
|
|
1654
|
+
this._actionArray = [];
|
|
1655
|
+
this._fieldArray = [];
|
|
1656
|
+
this._tableArray = [];
|
|
1657
|
+
this._sectionArray = [];
|
|
1720
1658
|
this._stateFlow = {
|
|
1721
1659
|
defaultState: '',
|
|
1722
1660
|
states: [],
|
|
@@ -1748,8 +1686,8 @@ class FormStructureAndData {
|
|
|
1748
1686
|
const globalAction = new FormAction(actionReceived, this._formConfig);
|
|
1749
1687
|
const globalActionCode = globalAction.actionCode;
|
|
1750
1688
|
if (globalActionCode) {
|
|
1751
|
-
this.
|
|
1752
|
-
this.
|
|
1689
|
+
this._actionArray.push(globalAction);
|
|
1690
|
+
this._actions[globalActionCode] = globalAction;
|
|
1753
1691
|
}
|
|
1754
1692
|
}
|
|
1755
1693
|
}
|
|
@@ -1769,8 +1707,8 @@ class FormStructureAndData {
|
|
|
1769
1707
|
const fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
|
|
1770
1708
|
const fieldCode = fieldToAdd.fieldCode;
|
|
1771
1709
|
if (fieldCode) {
|
|
1772
|
-
this.
|
|
1773
|
-
this.
|
|
1710
|
+
this._fieldArray.push(fieldToAdd);
|
|
1711
|
+
this._fields[fieldCode] = fieldToAdd;
|
|
1774
1712
|
}
|
|
1775
1713
|
}
|
|
1776
1714
|
}
|
|
@@ -1793,8 +1731,8 @@ class FormStructureAndData {
|
|
|
1793
1731
|
const tableToAdd = new RecordTable(tableReceived, this._formConfig);
|
|
1794
1732
|
const tableCode = tableToAdd.tableCode;
|
|
1795
1733
|
if (tableCode) {
|
|
1796
|
-
this.
|
|
1797
|
-
this.
|
|
1734
|
+
this._tableArray.push(tableToAdd);
|
|
1735
|
+
this._tables[tableCode] = tableToAdd;
|
|
1798
1736
|
}
|
|
1799
1737
|
}
|
|
1800
1738
|
}
|
|
@@ -1812,19 +1750,22 @@ class FormStructureAndData {
|
|
|
1812
1750
|
const sectionToAdd = new RecordFormSection(sectionReceived, this);
|
|
1813
1751
|
const sectionCode = sectionToAdd.sectionCode;
|
|
1814
1752
|
if (sectionCode) {
|
|
1815
|
-
this.
|
|
1816
|
-
this.
|
|
1753
|
+
this._sectionArray.push(sectionToAdd);
|
|
1754
|
+
this._sections[sectionCode] = sectionToAdd;
|
|
1817
1755
|
}
|
|
1818
1756
|
}
|
|
1819
1757
|
}
|
|
1820
1758
|
}
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
get defaultState() { return this._stateFlow.defaultState; }
|
|
1824
|
-
get title() { return this._title; }
|
|
1825
|
-
set title(title) { this._title = title; }
|
|
1759
|
+
getTitle() { return this._title; }
|
|
1760
|
+
setTitle(title) { this._title = title; }
|
|
1826
1761
|
get name() { return this._name; }
|
|
1827
1762
|
set name(name) { this._name = name; }
|
|
1763
|
+
// Estados
|
|
1764
|
+
get defaultState() { return this._stateFlow.defaultState; }
|
|
1765
|
+
supportState(state) { var _a; return (_a = this._stateFlow.states) === null || _a === void 0 ? void 0 : _a.includes(state); }
|
|
1766
|
+
supportMode(state) { return this.supportState(state); }
|
|
1767
|
+
get states() { return this._stateFlow.states; }
|
|
1768
|
+
getCurrentState() { return this.state; }
|
|
1828
1769
|
changeState(newState) {
|
|
1829
1770
|
if (!newState || !this.supportState(newState)) {
|
|
1830
1771
|
return false;
|
|
@@ -1854,201 +1795,29 @@ class FormStructureAndData {
|
|
|
1854
1795
|
return { name, source, destination };
|
|
1855
1796
|
}).filter(item => item.name && item.source && item.destination);
|
|
1856
1797
|
}
|
|
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
|
-
}
|
|
1798
|
+
// immutable Data
|
|
1868
1799
|
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; }
|
|
1800
|
+
set immutableData(immutableData) { Object.assign(this._immutableData, immutableData); }
|
|
1801
|
+
get immutableData() { return JSON.parse(JSON.stringify(this._immutableData)); }
|
|
1802
|
+
// extra Info
|
|
1869
1803
|
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
|
-
|
|
1876
|
-
|
|
1877
|
-
return data;
|
|
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
|
-
}
|
|
1941
|
-
}
|
|
1942
|
-
if (this._tables) {
|
|
1943
|
-
for (const formTable of this._tables) {
|
|
1944
|
-
formTable.clean();
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1948
|
-
showSection(sectionCode) {
|
|
1949
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1950
|
-
return (sectionObject) ? sectionObject.show() : null;
|
|
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
|
-
}
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
|
-
hideSubSections(sectionCode, subSectionArray) {
|
|
1999
|
-
if (subSectionArray && subSectionArray.length > 0) {
|
|
2000
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
2001
|
-
for (const subSectionCode of subSectionArray) {
|
|
2002
|
-
const subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
|
|
2003
|
-
if (subSectionObject) {
|
|
2004
|
-
subSectionObject.hide();
|
|
2005
|
-
}
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
showAction(actionCode) {
|
|
2010
|
-
const actionObject = this.getActionObject(actionCode);
|
|
2011
|
-
return (actionObject) ? actionObject.show() : null;
|
|
2012
|
-
}
|
|
2013
|
-
hideAction(actionCode) {
|
|
2014
|
-
const actionObject = this.getActionObject(actionCode);
|
|
2015
|
-
return (actionObject) ? actionObject.hide() : null;
|
|
2016
|
-
}
|
|
2017
|
-
showActions(actionArray) {
|
|
2018
|
-
const actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
|
|
2019
|
-
actionNames.forEach(actionCode => this.showAction(actionCode));
|
|
2020
|
-
}
|
|
2021
|
-
hideActions(actionArray) {
|
|
2022
|
-
const actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
|
|
2023
|
-
actionNames.forEach(actionCode => this.hideAction(actionCode));
|
|
2024
|
-
}
|
|
2025
|
-
enableAction(actionCode) {
|
|
2026
|
-
const actionObject = this.getActionObject(actionCode);
|
|
2027
|
-
return (actionObject) ? actionObject.enable() : null;
|
|
2028
|
-
}
|
|
2029
|
-
disableAction(actionCode) {
|
|
2030
|
-
const actionObject = this.getActionObject(actionCode);
|
|
2031
|
-
return (actionObject) ? actionObject.disable() : null;
|
|
2032
|
-
}
|
|
2033
|
-
enableActions(actionArray) {
|
|
2034
|
-
const actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
|
|
2035
|
-
actionNames.forEach(actionCode => this.enableAction(actionCode));
|
|
2036
|
-
}
|
|
2037
|
-
disableActions(actionArray) {
|
|
2038
|
-
const actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
|
|
2039
|
-
actionNames.forEach(actionCode => this.disableAction(actionCode));
|
|
2040
|
-
}
|
|
2041
|
-
get fields() { return this._fieldsObj; }
|
|
1804
|
+
set extraInfo(extraInfo) { Object.assign(this._extraInfo, extraInfo); }
|
|
1805
|
+
get extraInfo() { return JSON.parse(JSON.stringify(this._extraInfo)); }
|
|
1806
|
+
// Fields
|
|
1807
|
+
getFields() { return this._fieldArray; }
|
|
1808
|
+
getFieldNames() { return this._fieldArray.map(field => field.fieldCode); }
|
|
1809
|
+
getField(elementId) { var _a; return (elementId && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[elementId])) ? this._fields[elementId] : null; }
|
|
1810
|
+
get fields() { return this._fields; }
|
|
2042
1811
|
enableField(fieldCode) {
|
|
2043
|
-
const fieldObject = this.
|
|
1812
|
+
const fieldObject = this.getField(fieldCode);
|
|
2044
1813
|
return (fieldObject) ? fieldObject.enable() : null;
|
|
2045
1814
|
}
|
|
2046
1815
|
disableField(fieldCode) {
|
|
2047
|
-
const fieldObject = this.
|
|
1816
|
+
const fieldObject = this.getField(fieldCode);
|
|
2048
1817
|
return (fieldObject) ? fieldObject.disable() : null;
|
|
2049
1818
|
}
|
|
2050
1819
|
getFieldValue(fieldCode) {
|
|
2051
|
-
const fieldObject = this.
|
|
1820
|
+
const fieldObject = this.getField(fieldCode);
|
|
2052
1821
|
return (fieldObject) ? fieldObject.getValue() : null;
|
|
2053
1822
|
}
|
|
2054
1823
|
getFieldsValues(fieldCodesArray) {
|
|
@@ -2060,37 +1829,37 @@ class FormStructureAndData {
|
|
|
2060
1829
|
for (let index = 0; index < fieldCodesArray.length; index++) {
|
|
2061
1830
|
const fieldCode = fieldCodesArray[index];
|
|
2062
1831
|
if (fieldCode) {
|
|
2063
|
-
resultObject[fieldCode] = (_c = (_b = (_a = this.
|
|
1832
|
+
resultObject[fieldCode] = (_c = (_b = (_a = this._fields) === null || _a === void 0 ? void 0 : _a[fieldCode]) === null || _b === void 0 ? void 0 : _b.getValue()) !== null && _c !== void 0 ? _c : null;
|
|
2064
1833
|
}
|
|
2065
1834
|
}
|
|
2066
1835
|
return resultObject;
|
|
2067
1836
|
}
|
|
2068
1837
|
getFieldOptions(fieldCode) {
|
|
2069
|
-
const fieldObject = this.
|
|
1838
|
+
const fieldObject = this.getField(fieldCode);
|
|
2070
1839
|
return (fieldObject) ? fieldObject.getFieldOptions() : null;
|
|
2071
1840
|
}
|
|
2072
1841
|
setFieldValue(fieldCode, fieldValue) {
|
|
2073
|
-
const fieldObject = this.
|
|
1842
|
+
const fieldObject = this.getField(fieldCode);
|
|
2074
1843
|
return (fieldObject) ? fieldObject.setValue(fieldValue) : null;
|
|
2075
1844
|
}
|
|
2076
1845
|
setFieldError(code, message, type = 'error') {
|
|
2077
|
-
const fieldObject = this.
|
|
1846
|
+
const fieldObject = this.getField(code);
|
|
2078
1847
|
return (fieldObject) ? fieldObject.setError(code, message, type) : null;
|
|
2079
1848
|
}
|
|
2080
1849
|
setFieldIntrinsicErrorMessage(code, message) {
|
|
2081
|
-
const fieldObject = this.
|
|
1850
|
+
const fieldObject = this.getField(code);
|
|
2082
1851
|
return (fieldObject) ? fieldObject.setIntrinsicErrorMessage(message) : null;
|
|
2083
1852
|
}
|
|
2084
1853
|
setFieldRequired(fieldCode, required) {
|
|
2085
|
-
const fieldObject = this.
|
|
1854
|
+
const fieldObject = this.getField(fieldCode);
|
|
2086
1855
|
return (fieldObject) ? fieldObject.required = required : null;
|
|
2087
1856
|
}
|
|
2088
1857
|
setFieldErrorMessage(fieldCode, errorMessage) {
|
|
2089
|
-
const fieldObject = this.
|
|
1858
|
+
const fieldObject = this.getField(fieldCode);
|
|
2090
1859
|
return (fieldObject) ? fieldObject.setErrorMessage(errorMessage) : null;
|
|
2091
1860
|
}
|
|
2092
1861
|
setFieldOptions(fieldCode, optionsArray, idAttribute, nameAttribute) {
|
|
2093
|
-
const fieldObject = this.
|
|
1862
|
+
const fieldObject = this.getField(fieldCode);
|
|
2094
1863
|
if (fieldObject && optionsArray && optionsArray.length > 0) {
|
|
2095
1864
|
const fieldOptions = [];
|
|
2096
1865
|
for (const optionItem of optionsArray) {
|
|
@@ -2109,7 +1878,7 @@ class FormStructureAndData {
|
|
|
2109
1878
|
fieldUniverse = fieldArray;
|
|
2110
1879
|
}
|
|
2111
1880
|
else if (sectionCode && !subSectionCode) {
|
|
2112
|
-
const sectionObject = this.
|
|
1881
|
+
const sectionObject = this.getSection(sectionCode);
|
|
2113
1882
|
fieldUniverse = sectionObject === null || sectionObject === void 0 ? void 0 : sectionObject.getFieldNames();
|
|
2114
1883
|
}
|
|
2115
1884
|
else if (sectionCode && subSectionCode) {
|
|
@@ -2123,7 +1892,7 @@ class FormStructureAndData {
|
|
|
2123
1892
|
return fieldUniverse;
|
|
2124
1893
|
}
|
|
2125
1894
|
return fieldUniverse.filter(fld => {
|
|
2126
|
-
const fieldObject = this.
|
|
1895
|
+
const fieldObject = this.getField(fld);
|
|
2127
1896
|
return (fieldObject && filterFunc(fieldObject));
|
|
2128
1897
|
});
|
|
2129
1898
|
}
|
|
@@ -2132,7 +1901,7 @@ class FormStructureAndData {
|
|
|
2132
1901
|
let fieldSetSize = 0;
|
|
2133
1902
|
if (fieldUniverse && processFunc) {
|
|
2134
1903
|
for (const fieldCode of fieldUniverse) {
|
|
2135
|
-
const fieldObject = this.
|
|
1904
|
+
const fieldObject = this.getField(fieldCode);
|
|
2136
1905
|
if (fieldObject) {
|
|
2137
1906
|
try {
|
|
2138
1907
|
processFunc(fieldObject);
|
|
@@ -2206,29 +1975,108 @@ class FormStructureAndData {
|
|
|
2206
1975
|
}
|
|
2207
1976
|
return false;
|
|
2208
1977
|
}
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
1978
|
+
// Acciones
|
|
1979
|
+
get actions() { return this._actions; }
|
|
1980
|
+
getActionsByAttribute(name, value) { return this._actionArray.filter(actionItem => actionItem.matchAttribute(name, value)); }
|
|
1981
|
+
getActions() { return this._actionArray; }
|
|
1982
|
+
getAction(code) { var _a; return (code && ((_a = this._actions) === null || _a === void 0 ? void 0 : _a[code])) ? this._actions[code] : null; }
|
|
1983
|
+
showActions(codes) { return this.execOnActions(codes, SHOW); }
|
|
1984
|
+
hideActions(codes) { return this.execOnActions(codes, HIDE); }
|
|
1985
|
+
enableActions(codes) { return this.execOnActions(codes, ENABLE); }
|
|
1986
|
+
disableActions(codes) { return this.execOnActions(codes, DISABLE); }
|
|
1987
|
+
execOnActions(codes, functionName) {
|
|
1988
|
+
const actionCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
1989
|
+
if (!functionName || actionCodes.length === 0) {
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
actionCodes.forEach(code => {
|
|
1993
|
+
var _a;
|
|
1994
|
+
const action = this.getAction(code);
|
|
1995
|
+
(_a = action === null || action === void 0 ? void 0 : action[functionName]) === null || _a === void 0 ? void 0 : _a.call(action);
|
|
1996
|
+
});
|
|
1997
|
+
}
|
|
1998
|
+
// Tablas
|
|
1999
|
+
tables() { return this.getTables(); }
|
|
2000
|
+
getTables() { return this._tableArray; }
|
|
2001
|
+
getTable(code) { var _a; return (code && ((_a = this._tables) === null || _a === void 0 ? void 0 : _a[code])) ? this._tables[code] : null; }
|
|
2002
|
+
enableTables(codes) { return this.execOnTables(codes, ENABLE); }
|
|
2003
|
+
disableTables(codes) { return this.execOnTables(codes, DISABLE); }
|
|
2004
|
+
showTables(codes) { return this.execOnTables(codes, SHOW); }
|
|
2005
|
+
hideTables(codes) { return this.execOnTables(codes, HIDE); }
|
|
2006
|
+
cleanTables(codes) { return this.execOnTables(codes, CLEAN); }
|
|
2007
|
+
execOnTables(codes, functionName) {
|
|
2008
|
+
const tableCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2009
|
+
if (!functionName || tableCodes.length === 0) {
|
|
2010
|
+
return;
|
|
2011
|
+
}
|
|
2012
|
+
tableCodes.forEach(code => {
|
|
2013
|
+
var _a;
|
|
2014
|
+
const table = this.getTable(code);
|
|
2015
|
+
(_a = table === null || table === void 0 ? void 0 : table[functionName]) === null || _a === void 0 ? void 0 : _a.call(table);
|
|
2016
|
+
});
|
|
2212
2017
|
}
|
|
2213
2018
|
getTableRecord(tableCode, recordId) {
|
|
2214
|
-
const tableObject = this.
|
|
2019
|
+
const tableObject = this.getTable(tableCode);
|
|
2215
2020
|
return (tableObject) ? tableObject.getTableRecord(recordId) : null;
|
|
2216
2021
|
}
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2022
|
+
// Secciones
|
|
2023
|
+
get sections() { return this._sectionArray; }
|
|
2024
|
+
getSectionsByAttribute(name, value) { return this._sectionArray.filter(item => item.matchAttribute(name, value)); }
|
|
2025
|
+
get sectionTitles() { return this._sectionArray.map(formSection => formSection.sectionTitle); }
|
|
2026
|
+
get visibleSections() { return this._sectionArray.filter(sec => sec.visible); }
|
|
2027
|
+
getSection(code) { var _a; return (code && ((_a = this._sections) === null || _a === void 0 ? void 0 : _a[code])) ? this._sections[code] : null; }
|
|
2028
|
+
showSections(names) { this.execOnSections(names, SHOW); }
|
|
2029
|
+
hideSections(names) { this.execOnSections(names, HIDE); }
|
|
2030
|
+
activeSection() { return this._exclusiveSectionsByAttr[ACTIVE]; }
|
|
2031
|
+
getSubSection(code, subCode) { var _a, _b; return (_b = (_a = this.getSection(code)) === null || _a === void 0 ? void 0 : _a.getSubsection(subCode)) !== null && _b !== void 0 ? _b : null; }
|
|
2032
|
+
showSubSections(code, subCodes) { return this.execOnSubSections(code, subCodes, SHOW); }
|
|
2033
|
+
hideSubSections(code, subCodes) { return this.execOnSubSections(code, subCodes, HIDE); }
|
|
2034
|
+
activateSection(code) {
|
|
2035
|
+
var _a, _b;
|
|
2036
|
+
if (code === this._exclusiveSectionsByAttr[ACTIVE]) {
|
|
2037
|
+
return;
|
|
2038
|
+
}
|
|
2039
|
+
(_a = this.getSection(this.activeSection())) === null || _a === void 0 ? void 0 : _a.inactivate();
|
|
2040
|
+
(_b = this.getSection(code)) === null || _b === void 0 ? void 0 : _b.activate();
|
|
2041
|
+
this._exclusiveSectionsByAttr[ACTIVE] = code;
|
|
2220
2042
|
}
|
|
2221
|
-
|
|
2222
|
-
const
|
|
2223
|
-
|
|
2043
|
+
execOnSections(codes, functionName) {
|
|
2044
|
+
const sectionCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2045
|
+
if (!functionName || sectionCodes.length === 0) {
|
|
2046
|
+
return;
|
|
2047
|
+
}
|
|
2048
|
+
sectionCodes.forEach(code => {
|
|
2049
|
+
var _a;
|
|
2050
|
+
const section = this.getSection(code);
|
|
2051
|
+
(_a = section === null || section === void 0 ? void 0 : section[functionName]) === null || _a === void 0 ? void 0 : _a.call(section);
|
|
2052
|
+
});
|
|
2224
2053
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2054
|
+
execOnSubSections(code, subNames, functionName) {
|
|
2055
|
+
var _a;
|
|
2056
|
+
const subCodes = (Array.isArray(subNames)) ? subNames : (subNames ? [subNames] : []);
|
|
2057
|
+
const section = this.getSection(code);
|
|
2058
|
+
if (!functionName || !section || subCodes.length === 0) {
|
|
2059
|
+
return;
|
|
2060
|
+
}
|
|
2061
|
+
for (const subCode of subCodes) {
|
|
2062
|
+
const subSection = this.getSubSection(code, subCode);
|
|
2063
|
+
(_a = subSection === null || subSection === void 0 ? void 0 : subSection[functionName]) === null || _a === void 0 ? void 0 : _a.call(subSection);
|
|
2064
|
+
}
|
|
2228
2065
|
}
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2066
|
+
/**
|
|
2067
|
+
* Métodos propios de gestión del formulario
|
|
2068
|
+
*/
|
|
2069
|
+
cleanData() {
|
|
2070
|
+
if (this._fieldArray) {
|
|
2071
|
+
for (const recordField of this._fieldArray) {
|
|
2072
|
+
recordField.setValue(recordField.defaultValue);
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
if (this._tableArray) {
|
|
2076
|
+
for (const formTable of this._tableArray) {
|
|
2077
|
+
formTable.clean();
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2232
2080
|
}
|
|
2233
2081
|
/** payload para servicios Tuain */
|
|
2234
2082
|
getPayload() {
|
|
@@ -2410,7 +2258,87 @@ class BasicFormComponent {
|
|
|
2410
2258
|
this.cleanStart();
|
|
2411
2259
|
this.customPreProcessing();
|
|
2412
2260
|
}
|
|
2413
|
-
|
|
2261
|
+
assignFunctions() {
|
|
2262
|
+
var _a;
|
|
2263
|
+
const functionsMapped = [
|
|
2264
|
+
['getCurrentState', 'getCurrentState'],
|
|
2265
|
+
['getCurrentMode', 'getCurrentState'],
|
|
2266
|
+
['getTitle', 'getTitle'],
|
|
2267
|
+
['setTitle', 'setTitle'],
|
|
2268
|
+
['getAction', 'getAction'],
|
|
2269
|
+
['supportState', 'supportState'],
|
|
2270
|
+
['getImmutableElement', 'getImmutableElement'],
|
|
2271
|
+
['getExtraInfo', 'getExtraInfo'],
|
|
2272
|
+
['cleanData', 'cleanData'],
|
|
2273
|
+
['getFields', 'getFields'],
|
|
2274
|
+
['getFieldNames', 'getFieldNames'],
|
|
2275
|
+
['getField', 'getField'],
|
|
2276
|
+
['enableField', 'enableField'],
|
|
2277
|
+
['disableField', 'disableField'],
|
|
2278
|
+
['getFieldValue', 'getFieldValue'],
|
|
2279
|
+
['getFieldsValues', 'getFieldsValues'],
|
|
2280
|
+
['getFieldOptions', 'getFieldOptions'],
|
|
2281
|
+
['setFieldValue', 'setFieldValue'],
|
|
2282
|
+
['setFieldRequired', 'setFieldRequired'],
|
|
2283
|
+
['setFieldErrorMessage', 'setFieldErrorMessage'],
|
|
2284
|
+
['setFieldError', 'setFieldError'],
|
|
2285
|
+
['setFieldIntrinsicErrorMessage', 'setFieldIntrinsicErrorMessage'],
|
|
2286
|
+
['setFieldOptions', 'setFieldOptions'],
|
|
2287
|
+
['getFieldSet', 'getFieldSet'],
|
|
2288
|
+
['applyProcessToFieldSet', 'applyProcessToFieldSet'],
|
|
2289
|
+
['applyProcessToAllFields', 'applyProcessToFieldSet'],
|
|
2290
|
+
['cleanFields', 'cleanFields'],
|
|
2291
|
+
['getRequiredFields', 'getRequiredFields'],
|
|
2292
|
+
['getRequiredEmptyFields', 'getRequiredEmptyFields'],
|
|
2293
|
+
['getChangedFields', 'getChangedFields'],
|
|
2294
|
+
['getFieldsWithValidationIssues', 'getFieldsWithValidationIssues'],
|
|
2295
|
+
['tagFieldsWithError', 'tagFieldsWithError'],
|
|
2296
|
+
['cleanErrorFields', 'cleanErrorFields'],
|
|
2297
|
+
['showLabelFields', 'showLabelFields'],
|
|
2298
|
+
['hideLabelFields', 'hideLabelFields'],
|
|
2299
|
+
['enableFields', 'enableFields'],
|
|
2300
|
+
['disableFields', 'disableFields'],
|
|
2301
|
+
['enableEditFields', 'enableEditFields'],
|
|
2302
|
+
['disableEditFields', 'disableEditFields'],
|
|
2303
|
+
['showFields', 'showFields'],
|
|
2304
|
+
['hideFields', 'hideFields'],
|
|
2305
|
+
['getActionsByAttribute', 'getActionsByAttribute'],
|
|
2306
|
+
['getAction', 'getAction'],
|
|
2307
|
+
['showActions', 'showActions'],
|
|
2308
|
+
['hideActions', 'hideActions'],
|
|
2309
|
+
['enableActions', 'enableActions'],
|
|
2310
|
+
['disableActions', 'disableActions'],
|
|
2311
|
+
['showAction', 'showActions'],
|
|
2312
|
+
['hideAction', 'hideActions'],
|
|
2313
|
+
['enableAction', 'enableActions'],
|
|
2314
|
+
['disableAction', 'disableActions'],
|
|
2315
|
+
['activateSection', 'activateSection'],
|
|
2316
|
+
['getSubSection', 'getSubSection'],
|
|
2317
|
+
['getSection', 'getSection'],
|
|
2318
|
+
['showSection', 'showSections'],
|
|
2319
|
+
['hideSection', 'hideSections'],
|
|
2320
|
+
['showSections', 'showSections'],
|
|
2321
|
+
['hideSections', 'hideSections'],
|
|
2322
|
+
['showSubSection', 'showSubSections'],
|
|
2323
|
+
['hideSubSection', 'hideSubSections'],
|
|
2324
|
+
['showSubSections', 'showSubSections'],
|
|
2325
|
+
['hideSubSections', 'hideSubSections'],
|
|
2326
|
+
['getTables', 'getTables'],
|
|
2327
|
+
['getTable', 'getTable'],
|
|
2328
|
+
['showTables', 'showTables'],
|
|
2329
|
+
['hideTables', 'hideTables'],
|
|
2330
|
+
['showTable', 'showTables'],
|
|
2331
|
+
['hideTable', 'hideTables'],
|
|
2332
|
+
['cleanTables', 'cleanTables'],
|
|
2333
|
+
['cleanTable', 'cleanTables'],
|
|
2334
|
+
['getTableRecord', 'getTableRecord'],
|
|
2335
|
+
['changeState', 'changeState'],
|
|
2336
|
+
];
|
|
2337
|
+
for (let index = 0; index < functionsMapped.length; index++) {
|
|
2338
|
+
const [name, structureName] = functionsMapped[index];
|
|
2339
|
+
this[name] = (_a = this.formStructure) === null || _a === void 0 ? void 0 : _a[structureName];
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2414
2342
|
setConfig(formConfig) {
|
|
2415
2343
|
this.formConfig = formConfig;
|
|
2416
2344
|
}
|
|
@@ -2442,127 +2370,22 @@ class BasicFormComponent {
|
|
|
2442
2370
|
this.tableGetDataStart = {};
|
|
2443
2371
|
this.tableGetDataFinish = {};
|
|
2444
2372
|
}
|
|
2373
|
+
get formManager() { return this; }
|
|
2374
|
+
get formCode() { return this.name; }
|
|
2375
|
+
set formCode(name) { this.name = name; }
|
|
2376
|
+
get inServerProcess() { return this.busy; }
|
|
2445
2377
|
get form() { return this.formStructure; }
|
|
2378
|
+
get visibleSections() { return this.formStructure.visibleSections; }
|
|
2446
2379
|
get currentState() { return this.formStructure.state; }
|
|
2447
2380
|
set currentState(state) { this.formStructure.changeState(state); }
|
|
2448
2381
|
get currentMode() { return this.currentState; }
|
|
2449
2382
|
get immutableData() { return this.formStructure.immutableData; }
|
|
2450
2383
|
get extraInfo() { return this.formStructure.extraInfo; }
|
|
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); }
|
|
2384
|
+
get state() { return this.getCurrentState(); }
|
|
2385
|
+
get formRoute() { return this._formRoute; }
|
|
2386
|
+
set formRoute(route) { this._formRoute = route; }
|
|
2387
|
+
get subject() { return this.formSubject; }
|
|
2388
|
+
// Métodos virtuales
|
|
2566
2389
|
customPreProcessing() { }
|
|
2567
2390
|
customFormStart() { }
|
|
2568
2391
|
displayActionServerError() { }
|
|
@@ -2571,6 +2394,43 @@ class BasicFormComponent {
|
|
|
2571
2394
|
showFieldInfo(fieldCode) { }
|
|
2572
2395
|
showModalDialog(title, body, options, callback, params) { }
|
|
2573
2396
|
openUploadDialog(title, body, options, callback, params) { }
|
|
2397
|
+
/**
|
|
2398
|
+
* @deprecated Use supportState
|
|
2399
|
+
*/
|
|
2400
|
+
supportMode(state) { return this.supportState(state); }
|
|
2401
|
+
/**
|
|
2402
|
+
* @deprecated Use getField
|
|
2403
|
+
*/
|
|
2404
|
+
getFieldObject(code) { return this.getField(code); }
|
|
2405
|
+
/**
|
|
2406
|
+
* @deprecated Use getAction
|
|
2407
|
+
*/
|
|
2408
|
+
getActionObject(code) { return this.getAction(code); }
|
|
2409
|
+
/**
|
|
2410
|
+
* @deprecated Use getTable
|
|
2411
|
+
*/
|
|
2412
|
+
getTableObject(code) { return this.getTable(code); }
|
|
2413
|
+
/**
|
|
2414
|
+
* @deprecated Use getSection
|
|
2415
|
+
*/
|
|
2416
|
+
getSectionObject(code) { return this.getSection(code); }
|
|
2417
|
+
/**
|
|
2418
|
+
* @deprecated Use changeState
|
|
2419
|
+
*/
|
|
2420
|
+
changeFormMode(state) { return this.changeState(state); }
|
|
2421
|
+
/**
|
|
2422
|
+
* @deprecated Use subject
|
|
2423
|
+
*/
|
|
2424
|
+
getFormSubject() { return this.subject; }
|
|
2425
|
+
/**
|
|
2426
|
+
* @deprecated Use subject
|
|
2427
|
+
*/
|
|
2428
|
+
getSubject() { return this.formSubject; }
|
|
2429
|
+
/**
|
|
2430
|
+
* @deprecated Use subject
|
|
2431
|
+
*/
|
|
2432
|
+
getformSubject() { return this.getSubject(); }
|
|
2433
|
+
numSections() { return this.formStructure.sections.length; }
|
|
2574
2434
|
subscribeAppEvent(eventName, callback) {
|
|
2575
2435
|
this._eventEmiter.subscribe(eventName, callback);
|
|
2576
2436
|
}
|
|
@@ -2600,25 +2460,15 @@ class BasicFormComponent {
|
|
|
2600
2460
|
this.errorMessage = errorMessage || '';
|
|
2601
2461
|
this.errorDetail = errorDetail || '';
|
|
2602
2462
|
}
|
|
2603
|
-
get formManager() { return this; }
|
|
2604
2463
|
resetError() { this.setError(null, null, null); }
|
|
2605
2464
|
getErrorType() { return this._errorType; }
|
|
2606
2465
|
getErrorMessage() { return this.errorMessage; }
|
|
2607
2466
|
getErrorDetail() { return this.errorDetail; }
|
|
2608
2467
|
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
2468
|
getFormParameter(name) {
|
|
2617
2469
|
var _a, _b;
|
|
2618
2470
|
return (name) ? ((_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null) : null;
|
|
2619
2471
|
}
|
|
2620
|
-
getSubject() { return this.formSubject; }
|
|
2621
|
-
getformSubject() { return this.getSubject(); }
|
|
2622
2472
|
preocessInputParams(params) {
|
|
2623
2473
|
var _a, _b, _c;
|
|
2624
2474
|
this.controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
|
|
@@ -2633,7 +2483,7 @@ class BasicFormComponent {
|
|
|
2633
2483
|
return state;
|
|
2634
2484
|
}
|
|
2635
2485
|
subscribeSectionActivation() {
|
|
2636
|
-
const formSections = this.formStructure.
|
|
2486
|
+
const formSections = this.formStructure.sections;
|
|
2637
2487
|
if (Array.isArray(formSections)) {
|
|
2638
2488
|
formSections.forEach(section => {
|
|
2639
2489
|
section.activation.subscribe(code => this.launchSectionActivation(code));
|
|
@@ -2727,8 +2577,9 @@ class BasicFormComponent {
|
|
|
2727
2577
|
errorOccured() {
|
|
2728
2578
|
return (this.errorCode !== NO_ERROR);
|
|
2729
2579
|
}
|
|
2730
|
-
|
|
2731
|
-
|
|
2580
|
+
/**
|
|
2581
|
+
* Soporte manejo de eventos de formulario
|
|
2582
|
+
*/
|
|
2732
2583
|
requestFormAction(actionCode, actionSubject = {}) {
|
|
2733
2584
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2734
2585
|
const actionDetail = {
|
|
@@ -2769,7 +2620,7 @@ class BasicFormComponent {
|
|
|
2769
2620
|
}
|
|
2770
2621
|
if (actions && actions.length > 0) {
|
|
2771
2622
|
for (const changedAction of actions) {
|
|
2772
|
-
const actionObject = this.
|
|
2623
|
+
const actionObject = this.getAction(changedAction.actionCode);
|
|
2773
2624
|
if (actionObject) {
|
|
2774
2625
|
actionObject.updateFromServer(changedAction);
|
|
2775
2626
|
}
|
|
@@ -2777,7 +2628,7 @@ class BasicFormComponent {
|
|
|
2777
2628
|
}
|
|
2778
2629
|
if (fields && fields.length > 0) {
|
|
2779
2630
|
for (const changedField of fields) {
|
|
2780
|
-
const fieldObject = this.
|
|
2631
|
+
const fieldObject = this.getField(changedField.fieldCode);
|
|
2781
2632
|
if (fieldObject) {
|
|
2782
2633
|
fieldObject.updateFromServer(changedField);
|
|
2783
2634
|
}
|
|
@@ -2785,7 +2636,7 @@ class BasicFormComponent {
|
|
|
2785
2636
|
}
|
|
2786
2637
|
if (recordTables && recordTables.length > 0) {
|
|
2787
2638
|
for (const changedTable of recordTables) {
|
|
2788
|
-
const tableObject = this.
|
|
2639
|
+
const tableObject = this.getTable(changedTable.tableCode);
|
|
2789
2640
|
if (tableObject) {
|
|
2790
2641
|
tableObject.updateFromServer(changedTable);
|
|
2791
2642
|
}
|
|
@@ -2838,7 +2689,7 @@ class BasicFormComponent {
|
|
|
2838
2689
|
}
|
|
2839
2690
|
launchSectionActivation(sectionCode) {
|
|
2840
2691
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2841
|
-
const sectionObject = this.formStructure.
|
|
2692
|
+
const sectionObject = this.formStructure.getSection(sectionCode);
|
|
2842
2693
|
if (!sectionObject) {
|
|
2843
2694
|
return;
|
|
2844
2695
|
}
|
|
@@ -2852,7 +2703,7 @@ class BasicFormComponent {
|
|
|
2852
2703
|
}
|
|
2853
2704
|
launchSectionInactivation(sectionCode) {
|
|
2854
2705
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2855
|
-
const sectionObject = this.formStructure.
|
|
2706
|
+
const sectionObject = this.formStructure.getSection(sectionCode);
|
|
2856
2707
|
if (!sectionObject) {
|
|
2857
2708
|
return;
|
|
2858
2709
|
}
|
|
@@ -2956,7 +2807,7 @@ class BasicFormComponent {
|
|
|
2956
2807
|
}
|
|
2957
2808
|
startFieldInputValidation(fieldCode, intrinsicValidation = true) {
|
|
2958
2809
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2959
|
-
const fieldToValidate = this.
|
|
2810
|
+
const fieldToValidate = this.getField(fieldCode);
|
|
2960
2811
|
if (!fieldToValidate) {
|
|
2961
2812
|
return false;
|
|
2962
2813
|
}
|
|
@@ -3043,7 +2894,7 @@ class BasicFormComponent {
|
|
|
3043
2894
|
if (!tableObject) {
|
|
3044
2895
|
return;
|
|
3045
2896
|
}
|
|
3046
|
-
const inlineActionObject = tableObject.
|
|
2897
|
+
const inlineActionObject = tableObject.getAction(actionCode);
|
|
3047
2898
|
if (!inlineActionObject) {
|
|
3048
2899
|
return;
|
|
3049
2900
|
}
|
|
@@ -3065,7 +2916,7 @@ class BasicFormComponent {
|
|
|
3065
2916
|
if (!tableObject) {
|
|
3066
2917
|
return;
|
|
3067
2918
|
}
|
|
3068
|
-
const inlineActionObject = tableObject.
|
|
2919
|
+
const inlineActionObject = tableObject.getAction(actionCode);
|
|
3069
2920
|
if (!inlineActionObject) {
|
|
3070
2921
|
return;
|
|
3071
2922
|
}
|