tuain-ng-forms-lib 0.12.23 → 12.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/tuain-ng-forms-lib.umd.js +624 -662
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/action.js +5 -5
- package/esm2015/lib/classes/forms/element.js +7 -6
- package/esm2015/lib/classes/forms/field.js +149 -166
- package/esm2015/lib/classes/forms/form.constants.js +11 -82
- package/esm2015/lib/classes/forms/form.js +8 -8
- package/esm2015/lib/classes/forms/subsection.js +6 -6
- package/esm2015/lib/classes/forms/table/column.js +5 -5
- package/esm2015/lib/classes/forms/table/row-data.js +6 -4
- package/esm2015/lib/classes/forms/table/table.js +15 -13
- package/esm2015/lib/components/elements/action.component.js +3 -1
- package/esm2015/lib/components/elements/field.component.js +45 -7
- package/esm2015/lib/components/elements/layout/element.component.js +3 -6
- package/esm2015/lib/components/elements/layout/form-error.component.js +1 -1
- package/esm2015/lib/components/elements/tables/table.component.js +7 -7
- package/esm2015/lib/components/forms/basic-form.js +89 -85
- package/esm2015/lib/services/form-manager.service.js +60 -54
- package/fesm2015/tuain-ng-forms-lib.js +410 -440
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/action.d.ts +1 -1
- package/lib/classes/forms/element.d.ts +3 -2
- package/lib/classes/forms/field.d.ts +19 -13
- package/lib/classes/forms/form.constants.d.ts +10 -74
- package/lib/classes/forms/form.d.ts +2 -1
- package/lib/classes/forms/table/column.d.ts +2 -1
- package/lib/classes/forms/table/table.d.ts +1 -1
- package/lib/components/elements/action.component.d.ts +1 -0
- package/lib/components/elements/field.component.d.ts +17 -2
- package/lib/components/elements/layout/element.component.d.ts +1 -2
- package/lib/components/elements/layout/form-error.component.d.ts +0 -1
- package/lib/components/elements/tables/table.component.d.ts +1 -0
- package/lib/components/forms/basic-form.d.ts +23 -4
- package/lib/services/form-manager.service.d.ts +22 -15
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
this.showLabel = true;
|
|
11
11
|
}
|
|
12
12
|
ActionComponent.prototype.ngOnInit = function () {
|
|
13
|
+
var _a;
|
|
14
|
+
this.formConfig = (_a = this.actionObject) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
13
15
|
this.start();
|
|
14
16
|
};
|
|
15
17
|
ActionComponent.prototype.start = function () { };
|
|
@@ -52,106 +54,55 @@
|
|
|
52
54
|
showLabel: [{ type: core.Input }]
|
|
53
55
|
};
|
|
54
56
|
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
FORMERROR_TYPE_WARNING: 'WARNING',
|
|
69
|
-
FORMERROR_REQUIRED_FIELDS: 'Todos los campos requeridos deben ser diligenciados',
|
|
70
|
-
FORMERROR_VALIDATION_TITLE: 'Advertencia',
|
|
71
|
-
FORMERROR_VALIDATION_FIELDS: 'Existen campos con problemas de validación',
|
|
72
|
-
// Valores para los controles de navegació
|
|
73
|
-
FORMNAVIGATION_FIRST: 'first',
|
|
74
|
-
FORMNAVIGATION_PREVGROUP: 'prevgroup',
|
|
75
|
-
FORMNAVIGATION_NEXTGROUP: 'nextgroup',
|
|
76
|
-
FORMNAVIGATION_LAST: 'last',
|
|
77
|
-
FIELDTYPE_ARRAY: 'ARRAY',
|
|
78
|
-
FIELDTYPE_CHECK: 'CHECK',
|
|
79
|
-
FIELDTYPE_DATE: 'DATE',
|
|
80
|
-
FIELDTYPE_MAP: 'MAP',
|
|
81
|
-
FIELDTYPE_CURRENCY: 'CURRENCY',
|
|
82
|
-
FIELDTYPE_SELECT: 'SELECT',
|
|
83
|
-
FIELDTYPE_TEXT: 'TEXT',
|
|
84
|
-
FIELD_REQUIRED_MESSAGE: 'Campo requerido',
|
|
85
|
-
FORMTABLEACTION_SORT: 'SORT',
|
|
86
|
-
FORMTABLEACTION_REFRESH: 'REFRESH',
|
|
87
|
-
FORMTABLEACTION_NAVIGATE: 'NAVIGATE',
|
|
88
|
-
FORMTABLEACTION_INLINE: 'INLINE',
|
|
89
|
-
FORMTABLEACTION_GLOBAL: 'GLOBAL',
|
|
90
|
-
FORMTABLEACTION_ROWSELECTION: 'ROWSELECTION',
|
|
91
|
-
FORMTABLEACTION_SELECTION: 'SELECTION',
|
|
92
|
-
TABLE_SORT_ASCENDING: 'asc',
|
|
93
|
-
TABLE_SORT_DESCENDING: 'desc',
|
|
94
|
-
SERVICE_ERRORCODE_NOERROR: '00',
|
|
95
|
-
};
|
|
96
|
-
var operators = {
|
|
97
|
-
G: '>',
|
|
98
|
-
L: '<',
|
|
99
|
-
GE: '>=',
|
|
100
|
-
LE: '<=',
|
|
101
|
-
EQ: '==',
|
|
102
|
-
NOT_EQ: '!=',
|
|
103
|
-
CONTENT: 'Contiene',
|
|
104
|
-
NOT_CONTENT: 'No Contiene',
|
|
105
|
-
BETWEEN: 'Entre',
|
|
106
|
-
};
|
|
107
|
-
var tableFieldStyles = {
|
|
108
|
-
TEXT: {
|
|
109
|
-
'text-align': 'left'
|
|
110
|
-
},
|
|
111
|
-
TITLE: {
|
|
112
|
-
'text-align': 'left'
|
|
113
|
-
},
|
|
114
|
-
LABEL: {
|
|
115
|
-
'text-align': 'left'
|
|
116
|
-
},
|
|
117
|
-
MESSAGE: {
|
|
118
|
-
'text-align': 'left'
|
|
119
|
-
},
|
|
120
|
-
NUMBER: {
|
|
121
|
-
'text-align': 'right'
|
|
122
|
-
},
|
|
123
|
-
DATE: {
|
|
124
|
-
'text-align': 'right'
|
|
125
|
-
},
|
|
126
|
-
CHECK: {
|
|
127
|
-
'text-align': 'center'
|
|
128
|
-
},
|
|
129
|
-
ARRAY: {
|
|
130
|
-
'text-align': 'left'
|
|
131
|
-
},
|
|
132
|
-
SELECT: {
|
|
133
|
-
'text-align': 'left'
|
|
134
|
-
}
|
|
57
|
+
var MONITORED_ATTRIBUTES = {
|
|
58
|
+
_maxLength: 'maxLength',
|
|
59
|
+
_onValidation: 'onValidation',
|
|
60
|
+
_fieldValue: 'value',
|
|
61
|
+
captureType: 'captureType',
|
|
62
|
+
fieldTitle: 'title',
|
|
63
|
+
fieldType: 'type',
|
|
64
|
+
errorMessage: 'errorMessage',
|
|
65
|
+
errorType: 'errorType',
|
|
66
|
+
errorCode: 'errorCode',
|
|
67
|
+
visibleLabel: 'visibleLabel',
|
|
68
|
+
fieldRequired: 'required',
|
|
69
|
+
fieldOptions: 'options',
|
|
135
70
|
};
|
|
136
|
-
var DEFAULT_STATE_FLOW = {
|
|
137
|
-
defaultState: 'CREATE',
|
|
138
|
-
states: ['CREATE', 'EDIT', 'VIEW'],
|
|
139
|
-
transitions: [
|
|
140
|
-
{ name: 'VIEW1', origin: 'CREATE', destination: 'VIEW' },
|
|
141
|
-
{ name: 'VIEW2', origin: 'EDIT', destination: 'VIEW' },
|
|
142
|
-
{ name: 'EDIT1', origin: 'CREATE', destination: 'EDIT' },
|
|
143
|
-
{ name: 'EDIT2', origin: 'VIEW', destination: 'EDIT' },
|
|
144
|
-
{ name: 'CREATE1', origin: 'EDIT', destination: 'CREATE' },
|
|
145
|
-
{ name: 'CREATE2', origin: 'VIEW', destination: 'CREATE' },
|
|
146
|
-
]
|
|
147
|
-
};
|
|
148
|
-
|
|
149
71
|
var FieldComponent = /** @class */ (function () {
|
|
150
72
|
function FieldComponent() {
|
|
151
|
-
this.componentConstants = Object.assign({}, componentConstants);
|
|
152
73
|
}
|
|
153
74
|
FieldComponent.prototype.ngOnInit = function () {
|
|
154
|
-
|
|
75
|
+
var _this = this;
|
|
76
|
+
var _a;
|
|
77
|
+
if (this.fieldObject) {
|
|
78
|
+
this.formConfig = (_a = this.fieldObject) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
79
|
+
// Atributos estáticos
|
|
80
|
+
this.code = this.fieldObject.fieldCode;
|
|
81
|
+
this.fieldInfo = this.fieldObject.fieldInfo;
|
|
82
|
+
this.fieldAlignment = this.fieldObject.fieldAlignment;
|
|
83
|
+
this.tooltipText = this.fieldObject.tooltipText;
|
|
84
|
+
// Cargue inicial
|
|
85
|
+
this.maxLength = this.fieldObject._maxLength;
|
|
86
|
+
this.onValidation = this.fieldObject._onValidation;
|
|
87
|
+
this.value = this.fieldObject._fieldValue;
|
|
88
|
+
this.captureType = this.fieldObject.captureType;
|
|
89
|
+
this.title = this.fieldObject.fieldTitle;
|
|
90
|
+
this.type = this.fieldObject.fieldType;
|
|
91
|
+
this.errorMessage = this.fieldObject.errorMessage;
|
|
92
|
+
this.errorType = this.fieldObject.errorType;
|
|
93
|
+
this.errorCode = this.fieldObject.errorCode;
|
|
94
|
+
this.visibleLabel = this.fieldObject.visibleLabel;
|
|
95
|
+
this.required = this.fieldObject.fieldRequired;
|
|
96
|
+
this.options = this.fieldObject.fieldOptions;
|
|
97
|
+
this.fieldObject.widget = this;
|
|
98
|
+
// Atributos dinámicos
|
|
99
|
+
this.fieldObject.attributeChange.subscribe(function (event) {
|
|
100
|
+
var name = event.name, value = event.value;
|
|
101
|
+
if (_this[MONITORED_ATTRIBUTES[name]]) {
|
|
102
|
+
_this[MONITORED_ATTRIBUTES[name]] = value;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
155
106
|
this.start();
|
|
156
107
|
};
|
|
157
108
|
FieldComponent.prototype.start = function () { };
|
|
@@ -180,7 +131,6 @@
|
|
|
180
131
|
template: "<ng-content></ng-content>"
|
|
181
132
|
},] }
|
|
182
133
|
];
|
|
183
|
-
FieldComponent.ctorParameters = function () { return []; };
|
|
184
134
|
FieldComponent.propDecorators = {
|
|
185
135
|
fieldObject: [{ type: core.Input }],
|
|
186
136
|
disabled: [{ type: core.Input }]
|
|
@@ -188,9 +138,10 @@
|
|
|
188
138
|
|
|
189
139
|
var ElementComponent = /** @class */ (function () {
|
|
190
140
|
function ElementComponent() {
|
|
191
|
-
this.componentConstants = Object.assign({}, componentConstants);
|
|
192
141
|
}
|
|
193
142
|
ElementComponent.prototype.ngOnInit = function () {
|
|
143
|
+
var _a;
|
|
144
|
+
this.formConfig = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
194
145
|
this.start();
|
|
195
146
|
};
|
|
196
147
|
ElementComponent.prototype.start = function () { };
|
|
@@ -220,7 +171,6 @@
|
|
|
220
171
|
template: "<ng-content></ng-content>"
|
|
221
172
|
},] }
|
|
222
173
|
];
|
|
223
|
-
ElementComponent.ctorParameters = function () { return []; };
|
|
224
174
|
ElementComponent.propDecorators = {
|
|
225
175
|
formElement: [{ type: core.Input }],
|
|
226
176
|
formManager: [{ type: core.Input }]
|
|
@@ -646,9 +596,33 @@
|
|
|
646
596
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
647
597
|
}
|
|
648
598
|
|
|
599
|
+
var elementTypes = {
|
|
600
|
+
action: 'ACTION',
|
|
601
|
+
field: 'FIELD',
|
|
602
|
+
table: 'TABLE',
|
|
603
|
+
};
|
|
604
|
+
var formActions = {
|
|
605
|
+
tableAction: 'TABLEACTION',
|
|
606
|
+
getData: 'GETDATA',
|
|
607
|
+
getTableData: 'GETTABLEDATA',
|
|
608
|
+
validate: 'VALIDATE',
|
|
609
|
+
};
|
|
610
|
+
var operators = {
|
|
611
|
+
G: '>',
|
|
612
|
+
L: '<',
|
|
613
|
+
GE: '>=',
|
|
614
|
+
LE: '<=',
|
|
615
|
+
EQ: '==',
|
|
616
|
+
NOT_EQ: '!=',
|
|
617
|
+
CONTENT: 'Contiene',
|
|
618
|
+
NOT_CONTENT: 'No Contiene',
|
|
619
|
+
BETWEEN: 'Entre',
|
|
620
|
+
};
|
|
621
|
+
|
|
649
622
|
var FormElement = /** @class */ (function () {
|
|
650
|
-
function FormElement(elementDefinition) {
|
|
623
|
+
function FormElement(elementDefinition, formConfig) {
|
|
651
624
|
var _a, _b;
|
|
625
|
+
this._formConfig = formConfig;
|
|
652
626
|
this._isForced = false;
|
|
653
627
|
this.setVisibleStates(elementDefinition.visibleStates);
|
|
654
628
|
this.setEnabledStates(elementDefinition.enabledStates);
|
|
@@ -657,9 +631,9 @@
|
|
|
657
631
|
this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
|
|
658
632
|
this.widget = null;
|
|
659
633
|
}
|
|
660
|
-
FormElement.prototype.isField = function () { return this.
|
|
661
|
-
FormElement.prototype.isAction = function () { return this.
|
|
662
|
-
FormElement.prototype.isTable = function () { return this.
|
|
634
|
+
FormElement.prototype.isField = function () { return this.elementType === elementTypes.field; };
|
|
635
|
+
FormElement.prototype.isAction = function () { return this.elementType === elementTypes.action; };
|
|
636
|
+
FormElement.prototype.isTable = function () { return this.elementType === elementTypes.table; };
|
|
663
637
|
FormElement.prototype.setVisibleStates = function (newStates) {
|
|
664
638
|
var visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
|
|
665
639
|
? newStates.split(',').map(function (state) { return state.trim(); }).filter(function (state) { return state.length > 0; })
|
|
@@ -719,13 +693,14 @@
|
|
|
719
693
|
}());
|
|
720
694
|
|
|
721
695
|
var RecordTableColumn = /** @class */ (function () {
|
|
722
|
-
function RecordTableColumn(recTableColReceived) {
|
|
696
|
+
function RecordTableColumn(recTableColReceived, formConfig) {
|
|
723
697
|
var _a, _b, _c;
|
|
698
|
+
this._formConfig = formConfig;
|
|
724
699
|
if (recTableColReceived) {
|
|
725
700
|
this.fieldCode = recTableColReceived.fieldCode;
|
|
726
701
|
this.fieldTitle = recTableColReceived.fieldTitle;
|
|
727
|
-
this.fieldType = recTableColReceived.fieldTypeCode ||
|
|
728
|
-
var defaultTypeAlignment = (tableFieldStyles[this.fieldType] != null) ? tableFieldStyles[this.fieldType]['text-align'] : 'left';
|
|
702
|
+
this.fieldType = recTableColReceived.fieldTypeCode || this._formConfig.fieldTypes.text;
|
|
703
|
+
var defaultTypeAlignment = (this._formConfig.tableFieldStyles[this.fieldType] != null) ? this._formConfig.tableFieldStyles[this.fieldType]['text-align'] : 'left';
|
|
729
704
|
this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
|
|
730
705
|
this.visible = (_a = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.visible) !== null && _a !== void 0 ? _a : true;
|
|
731
706
|
this.sortable = (_b = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.sortable) !== null && _b !== void 0 ? _b : false;
|
|
@@ -814,6 +789,8 @@
|
|
|
814
789
|
return outputValue;
|
|
815
790
|
}
|
|
816
791
|
|
|
792
|
+
var DATE_TYPE = 'DATE';
|
|
793
|
+
var CURRENCY_TYPE = 'CURRENCY';
|
|
817
794
|
var TableRecordData = /** @class */ (function () {
|
|
818
795
|
function TableRecordData(recordReceived, recordDefinition, selectionFieldName) {
|
|
819
796
|
var _this = this;
|
|
@@ -850,10 +827,10 @@
|
|
|
850
827
|
}
|
|
851
828
|
}
|
|
852
829
|
TableRecordData.prototype.formatFieldValue = function (fieldType, fieldValue) {
|
|
853
|
-
if (fieldType ===
|
|
830
|
+
if (fieldType === CURRENCY_TYPE) {
|
|
854
831
|
return formatCurrency(fieldValue);
|
|
855
832
|
}
|
|
856
|
-
else if (fieldType ===
|
|
833
|
+
else if (fieldType === DATE_TYPE && fieldValue) {
|
|
857
834
|
return new Date(fieldValue).toISOString().split('T')[0];
|
|
858
835
|
}
|
|
859
836
|
return fieldValue || '';
|
|
@@ -964,6 +941,8 @@
|
|
|
964
941
|
return TableRecordData;
|
|
965
942
|
}());
|
|
966
943
|
|
|
944
|
+
var TABLE_SORT_ASCENDING = 'asc';
|
|
945
|
+
var TABLE_SORT_DESCENDING = 'desc';
|
|
967
946
|
var TABLE_FILTER_TYPES = {
|
|
968
947
|
simpleFilterChange: 'SIMPLE_CHANGE',
|
|
969
948
|
simpleFilterFinish: 'SIMPLE_FINISH',
|
|
@@ -972,11 +951,11 @@
|
|
|
972
951
|
};
|
|
973
952
|
var RecordTable = /** @class */ (function (_super) {
|
|
974
953
|
__extends(RecordTable, _super);
|
|
975
|
-
function RecordTable(tableReceived) {
|
|
954
|
+
function RecordTable(tableReceived, formConfig) {
|
|
976
955
|
var e_1, _h, e_2, _j, e_3, _k;
|
|
977
956
|
var _this = this;
|
|
978
957
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
979
|
-
_this = _super.call(this, tableReceived) || this;
|
|
958
|
+
_this = _super.call(this, tableReceived, formConfig) || this;
|
|
980
959
|
_this._inlineActionTrigger = new rxjs.Subject();
|
|
981
960
|
_this._globalActionTrigger = new rxjs.Subject();
|
|
982
961
|
_this._recordSelectionTrigger = new rxjs.Subject();
|
|
@@ -986,7 +965,7 @@
|
|
|
986
965
|
_this._tableColumnObj = {};
|
|
987
966
|
_this._actionsObj = {};
|
|
988
967
|
_this.allSelected = false;
|
|
989
|
-
_this.
|
|
968
|
+
_this.elementType = elementTypes.table;
|
|
990
969
|
_this.waiting = false;
|
|
991
970
|
_this.complexFilter = false;
|
|
992
971
|
_this.currentPage = 1;
|
|
@@ -1009,12 +988,12 @@
|
|
|
1009
988
|
_this.customAttributes = (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.customAttributes) !== null && _f !== void 0 ? _f : {};
|
|
1010
989
|
_this.sortable = (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false;
|
|
1011
990
|
_this.sorting = { columnName: '', direction: '' };
|
|
1012
|
-
_this.recordsPerPage =
|
|
991
|
+
_this.recordsPerPage = formConfig.defaultRecordsPerPage;
|
|
1013
992
|
if (tableReceived.fields) {
|
|
1014
993
|
try {
|
|
1015
994
|
for (var _l = __values(tableReceived.fields), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
1016
995
|
var columnReceived = _m.value;
|
|
1017
|
-
var columnDefinition = new RecordTableColumn(columnReceived);
|
|
996
|
+
var columnDefinition = new RecordTableColumn(columnReceived, _this._formConfig);
|
|
1018
997
|
_this.columns.push(columnDefinition);
|
|
1019
998
|
_this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
|
|
1020
999
|
}
|
|
@@ -1274,7 +1253,7 @@
|
|
|
1274
1253
|
? this._actionsObj[actionCode] : null;
|
|
1275
1254
|
};
|
|
1276
1255
|
RecordTable.prototype.getActions = function (actionClass, actionTypes) {
|
|
1277
|
-
if (actionClass === void 0) { actionClass =
|
|
1256
|
+
if (actionClass === void 0) { actionClass = this._formConfig.tableActions.inline; }
|
|
1278
1257
|
if (actionTypes === void 0) { actionTypes = null; }
|
|
1279
1258
|
return this._actions.filter(function (actionDef) {
|
|
1280
1259
|
var typeIncluded = (actionTypes) ? actionTypes.includes(actionDef.actionType) : true;
|
|
@@ -1349,14 +1328,14 @@
|
|
|
1349
1328
|
RecordTable.prototype.setRequiredOrder = function (columnField) {
|
|
1350
1329
|
if (columnField !== this.sorting.columnName) {
|
|
1351
1330
|
this.sorting.columnName = columnField;
|
|
1352
|
-
this.sorting.direction =
|
|
1331
|
+
this.sorting.direction = TABLE_SORT_ASCENDING;
|
|
1353
1332
|
}
|
|
1354
1333
|
else {
|
|
1355
|
-
if (this.sorting.direction ===
|
|
1356
|
-
this.sorting.direction =
|
|
1334
|
+
if (this.sorting.direction === TABLE_SORT_ASCENDING) {
|
|
1335
|
+
this.sorting.direction = TABLE_SORT_DESCENDING;
|
|
1357
1336
|
}
|
|
1358
1337
|
else {
|
|
1359
|
-
this.sorting.direction =
|
|
1338
|
+
this.sorting.direction = TABLE_SORT_ASCENDING;
|
|
1360
1339
|
}
|
|
1361
1340
|
}
|
|
1362
1341
|
};
|
|
@@ -1378,7 +1357,7 @@
|
|
|
1378
1357
|
else if (recordAColumn > recordBColumn) {
|
|
1379
1358
|
result = 1;
|
|
1380
1359
|
}
|
|
1381
|
-
return direction ===
|
|
1360
|
+
return direction === TABLE_SORT_ASCENDING ? result : -result;
|
|
1382
1361
|
};
|
|
1383
1362
|
return RecordTable;
|
|
1384
1363
|
}(FormElement));
|
|
@@ -1541,13 +1520,15 @@
|
|
|
1541
1520
|
this.hasActions = false;
|
|
1542
1521
|
}
|
|
1543
1522
|
LibTableComponent.prototype.ngOnInit = function () {
|
|
1544
|
-
|
|
1523
|
+
var _a;
|
|
1524
|
+
this.formConfig = (_a = this.tableObject) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
1525
|
+
this.tableFieldStyles = this.formConfig.tableFieldStyles;
|
|
1545
1526
|
this.selectable = this.tableObject.selectable;
|
|
1546
1527
|
this.hasActions = this.tableObject.hasActions;
|
|
1547
1528
|
this.tableObject.widget = this;
|
|
1548
|
-
this.inlineActions = this.tableObject.getActions(
|
|
1549
|
-
this.globalActions = this.tableObject.getActions(
|
|
1550
|
-
this.selectionActions = this.tableObject.getActions(
|
|
1529
|
+
this.inlineActions = this.tableObject.getActions(this.formConfig.tableActions.inline);
|
|
1530
|
+
this.globalActions = this.tableObject.getActions(this.formConfig.tableActions.global);
|
|
1531
|
+
this.selectionActions = this.tableObject.getActions(this.formConfig.tableActions.selection);
|
|
1551
1532
|
this.start();
|
|
1552
1533
|
};
|
|
1553
1534
|
LibTableComponent.prototype.start = function () { };
|
|
@@ -1665,21 +1646,21 @@
|
|
|
1665
1646
|
var arrayToAdd = null;
|
|
1666
1647
|
var type = receivedElement.type, code = receivedElement.code;
|
|
1667
1648
|
switch (type) {
|
|
1668
|
-
case
|
|
1649
|
+
case elementTypes.field:
|
|
1669
1650
|
elementObject = formObject.getFieldObject(code);
|
|
1670
1651
|
arrayToAdd = this.subSectionFields;
|
|
1671
1652
|
break;
|
|
1672
|
-
case
|
|
1653
|
+
case elementTypes.table:
|
|
1673
1654
|
elementObject = formObject.getTableObject(code);
|
|
1674
1655
|
arrayToAdd = this.subSectionTables;
|
|
1675
1656
|
break;
|
|
1676
|
-
case
|
|
1657
|
+
case elementTypes.action:
|
|
1677
1658
|
elementObject = formObject.getActionObject(code);
|
|
1678
1659
|
arrayToAdd = this.subSectionActions;
|
|
1679
1660
|
break;
|
|
1680
1661
|
}
|
|
1681
1662
|
if (elementObject) {
|
|
1682
|
-
elementObject.
|
|
1663
|
+
elementObject.elementType = type;
|
|
1683
1664
|
arrayToAdd.push(elementObject);
|
|
1684
1665
|
this.subSectionElements.push(elementObject);
|
|
1685
1666
|
this.elementsArray[code] = elementObject;
|
|
@@ -1883,13 +1864,13 @@
|
|
|
1883
1864
|
var HEADER$1 = 'HEADER';
|
|
1884
1865
|
var FormAction = /** @class */ (function (_super) {
|
|
1885
1866
|
__extends(FormAction, _super);
|
|
1886
|
-
function FormAction(actionDefinition) {
|
|
1867
|
+
function FormAction(actionDefinition, formConfig) {
|
|
1887
1868
|
var _this = this;
|
|
1888
1869
|
var _a, _b;
|
|
1889
|
-
_this = _super.call(this, actionDefinition) || this;
|
|
1870
|
+
_this = _super.call(this, actionDefinition, formConfig) || this;
|
|
1890
1871
|
_this._actionActivated = new rxjs.Subject();
|
|
1891
1872
|
_this.inProgress = false;
|
|
1892
|
-
_this.
|
|
1873
|
+
_this.elementType = elementTypes.action;
|
|
1893
1874
|
_this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
|
|
1894
1875
|
_this.actionName = actionDefinition.actionTitle;
|
|
1895
1876
|
_this.iconName = actionDefinition.iconName || _this.actionCode;
|
|
@@ -1923,92 +1904,85 @@
|
|
|
1923
1904
|
}(FormElement));
|
|
1924
1905
|
|
|
1925
1906
|
var UNDEFINED = 'undefined';
|
|
1926
|
-
var
|
|
1927
|
-
var
|
|
1928
|
-
var
|
|
1929
|
-
var FIELD_CAPTURE_TYPE = 'captureType';
|
|
1930
|
-
var FIELD_TYPE = 'fieldTypeCode';
|
|
1931
|
-
var FIELD_MAX_LENGTH = 'maxLength';
|
|
1932
|
-
var FIELD_VISIBLE = 'visible';
|
|
1933
|
-
var FIELD_LABEL_VISIBLE = 'visibleLabel';
|
|
1934
|
-
var FIELD_REQUIRED = 'required';
|
|
1935
|
-
var FIELD_ERR_CODE = 'errorCode';
|
|
1936
|
-
var FIELD_ERR_MSG = 'errorMessage';
|
|
1937
|
-
var FIELD_TOOLTIP = 'tooltipText';
|
|
1938
|
-
var FIELD_INFO = 'info';
|
|
1939
|
-
var FIELD_EDITABLE = 'editable';
|
|
1940
|
-
var FIELD_TYPES = {
|
|
1941
|
-
array: 'ARRAY',
|
|
1942
|
-
check: 'CHECK',
|
|
1943
|
-
date: 'DATE',
|
|
1944
|
-
daterange: 'DATERANGE',
|
|
1945
|
-
time: 'TIME',
|
|
1946
|
-
timerange: 'TIMERANGE',
|
|
1947
|
-
map: 'MAP',
|
|
1948
|
-
number: 'NUMBER',
|
|
1949
|
-
decimal: 'DECIMAL',
|
|
1950
|
-
currency: 'CURRENCY',
|
|
1951
|
-
select: 'SELECT',
|
|
1952
|
-
typeahead: 'TYPEAHEAD',
|
|
1953
|
-
text: 'TEXT',
|
|
1954
|
-
password: 'PASSWORD',
|
|
1955
|
-
label: 'LABEL',
|
|
1956
|
-
html: 'HTML',
|
|
1957
|
-
title: 'TITLE',
|
|
1958
|
-
message: 'MESSAGE',
|
|
1959
|
-
link: 'LINK',
|
|
1960
|
-
warning: 'WARNING',
|
|
1961
|
-
avatar: 'AVATAR',
|
|
1962
|
-
email: 'EMAIL',
|
|
1963
|
-
phone: 'PHONE',
|
|
1964
|
-
};
|
|
1965
|
-
var FIELD_TYPES_FORMATS = {
|
|
1966
|
-
EMAIL: new RegExp('^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$'),
|
|
1967
|
-
};
|
|
1907
|
+
var DEFAULT_ERROR_TYPE = 'error';
|
|
1908
|
+
var DEFAULT_CAPTURE_TYPE = 'INPUT';
|
|
1909
|
+
var DEFAULT_ALIGNMENT = 'left';
|
|
1968
1910
|
var STD_MAX_LENGTH = 50;
|
|
1969
1911
|
var BIG_MAX_LENGTH = 500;
|
|
1912
|
+
var fldAttr = {
|
|
1913
|
+
validateOnServer: 'validateOnServer',
|
|
1914
|
+
value: '_fieldValue',
|
|
1915
|
+
minValue: '_minValue',
|
|
1916
|
+
maxValue: '_maxValue',
|
|
1917
|
+
maxLength: '_maxLength',
|
|
1918
|
+
onValidation: '_onValidation',
|
|
1919
|
+
intrinsicErrorMessage: '_intrinsicErrorMessage',
|
|
1920
|
+
code: 'fieldCode',
|
|
1921
|
+
info: 'fieldInfo',
|
|
1922
|
+
defaultValue: 'defaultValue',
|
|
1923
|
+
defaultEditable: 'defaultEditable',
|
|
1924
|
+
customAttributes: 'customAttributes',
|
|
1925
|
+
visibleLabel: 'visibleLabel',
|
|
1926
|
+
required: 'fieldRequired',
|
|
1927
|
+
hasChanged: 'hasChanged',
|
|
1928
|
+
outputOnly: 'outputOnly',
|
|
1929
|
+
captureType: 'captureType',
|
|
1930
|
+
title: 'fieldTitle',
|
|
1931
|
+
type: 'fieldType',
|
|
1932
|
+
alignment: 'fieldAlignment',
|
|
1933
|
+
format: 'fieldFormat',
|
|
1934
|
+
externalValue: 'externalValue',
|
|
1935
|
+
tooltipText: 'tooltipText',
|
|
1936
|
+
errorType: 'errorType',
|
|
1937
|
+
errorCode: 'errorCode',
|
|
1938
|
+
errorMessage: 'errorMessage',
|
|
1939
|
+
options: 'fieldOptions',
|
|
1940
|
+
};
|
|
1970
1941
|
var FieldDescriptor = /** @class */ (function (_super) {
|
|
1971
1942
|
__extends(FieldDescriptor, _super);
|
|
1972
|
-
function FieldDescriptor(inputFieldReceived) {
|
|
1943
|
+
function FieldDescriptor(inputFieldReceived, formConfig) {
|
|
1973
1944
|
var _this = this;
|
|
1974
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1975
|
-
_this = _super.call(this, inputFieldReceived) || this;
|
|
1945
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1946
|
+
_this = _super.call(this, inputFieldReceived, formConfig) || this;
|
|
1976
1947
|
_this._editionFinish = new rxjs.Subject();
|
|
1977
1948
|
_this._editionPartial = new rxjs.Subject();
|
|
1978
1949
|
_this._detailRequest = new rxjs.Subject();
|
|
1979
|
-
_this.
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
_this.
|
|
1983
|
-
_this.
|
|
1984
|
-
_this.captureType =
|
|
1985
|
-
_this.
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
_this.
|
|
1991
|
-
|
|
1950
|
+
_this._attributeChange = new rxjs.Subject();
|
|
1951
|
+
_this.elementType = elementTypes.field;
|
|
1952
|
+
var fld = (inputFieldReceived) ? inputFieldReceived : {};
|
|
1953
|
+
_this.setAttr(fldAttr.code, fld.fieldCode);
|
|
1954
|
+
_this.setAttr(fldAttr.title, (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : _this.fieldCode);
|
|
1955
|
+
_this.setAttr(fldAttr.captureType, (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE);
|
|
1956
|
+
_this.setAttr(fldAttr.defaultValue, (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null);
|
|
1957
|
+
var defaultTypeAlignment = (_this._formConfig.tableFieldStyles[_this.fieldType] != null)
|
|
1958
|
+
? _this._formConfig.tableFieldStyles[_this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
|
|
1959
|
+
var fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
|
|
1960
|
+
_this.setAttr(fldAttr.alignment, fieldAlignment);
|
|
1961
|
+
_this.setAttr(fldAttr.info, fld.info || '');
|
|
1962
|
+
var fieldFormat;
|
|
1992
1963
|
try {
|
|
1993
|
-
|
|
1964
|
+
fieldFormat = (fld.format) ? new RegExp(fld.format) : null;
|
|
1994
1965
|
}
|
|
1995
1966
|
catch (e) {
|
|
1996
|
-
|
|
1997
|
-
}
|
|
1998
|
-
_this.
|
|
1999
|
-
_this.
|
|
2000
|
-
_this.
|
|
2001
|
-
_this.
|
|
2002
|
-
_this.
|
|
2003
|
-
_this.
|
|
2004
|
-
_this.
|
|
2005
|
-
_this.
|
|
2006
|
-
|
|
2007
|
-
_this.
|
|
2008
|
-
_this.
|
|
2009
|
-
_this.
|
|
2010
|
-
|
|
2011
|
-
|
|
1967
|
+
fieldFormat = null;
|
|
1968
|
+
}
|
|
1969
|
+
_this.setAttr(fldAttr.format, fieldFormat);
|
|
1970
|
+
_this.setAttr(fldAttr.validateOnServer, (_d = fld.serverAction) !== null && _d !== void 0 ? _d : false);
|
|
1971
|
+
_this.setAttr(fldAttr.customAttributes, (_e = fld.customAttributes) !== null && _e !== void 0 ? _e : {});
|
|
1972
|
+
_this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
|
|
1973
|
+
_this.setAttr(fldAttr.defaultEditable, _this.enabled);
|
|
1974
|
+
_this.setAttr(fldAttr.required, (_f = fld.required) !== null && _f !== void 0 ? _f : false);
|
|
1975
|
+
_this.setError(fld.errorCode, fld.errorMessage, (_g = fld.errorType) !== null && _g !== void 0 ? _g : DEFAULT_ERROR_TYPE);
|
|
1976
|
+
_this.setAttr(fldAttr.outputOnly, (_h = fld.outputOnly) !== null && _h !== void 0 ? _h : false);
|
|
1977
|
+
var maxLength = (_j = fld.maxLength) !== null && _j !== void 0 ? _j : (_this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
1978
|
+
_this.setAttr(fldAttr.maxLength, maxLength);
|
|
1979
|
+
_this.setAttr(fldAttr.intrinsicErrorMessage, (_k = _this._formConfig.fieldTypeErrMsg[_this.fieldType]) !== null && _k !== void 0 ? _k : _this._formConfig.fieldTypeErrMsg.DEFAULT);
|
|
1980
|
+
_this.setFieldType(fld.fieldTypeCode);
|
|
1981
|
+
_this.setEditable((_l = fld.editable) !== null && _l !== void 0 ? _l : true);
|
|
1982
|
+
_this.setVisibleLabel((_m = fld.visibleLabel) !== null && _m !== void 0 ? _m : true);
|
|
1983
|
+
_this.setVisibility(fld.visible);
|
|
1984
|
+
_this.setFieldOptions(fld.fieldOptions);
|
|
1985
|
+
_this.setValue(fld.fieldValue || _this.defaultValue || '');
|
|
2012
1986
|
return _this;
|
|
2013
1987
|
}
|
|
2014
1988
|
Object.defineProperty(FieldDescriptor.prototype, "name", {
|
|
@@ -2021,6 +1995,11 @@
|
|
|
2021
1995
|
enumerable: false,
|
|
2022
1996
|
configurable: true
|
|
2023
1997
|
});
|
|
1998
|
+
Object.defineProperty(FieldDescriptor.prototype, "attributeChange", {
|
|
1999
|
+
get: function () { return this._attributeChange; },
|
|
2000
|
+
enumerable: false,
|
|
2001
|
+
configurable: true
|
|
2002
|
+
});
|
|
2024
2003
|
Object.defineProperty(FieldDescriptor.prototype, "editionPartial", {
|
|
2025
2004
|
get: function () { return this._editionPartial; },
|
|
2026
2005
|
enumerable: false,
|
|
@@ -2033,11 +2012,11 @@
|
|
|
2033
2012
|
});
|
|
2034
2013
|
Object.defineProperty(FieldDescriptor.prototype, "validating", {
|
|
2035
2014
|
get: function () { return this._onValidation; },
|
|
2036
|
-
set: function (isValidating) { this.
|
|
2015
|
+
set: function (isValidating) { this.setAttr(fldAttr.onValidation, isValidating); },
|
|
2037
2016
|
enumerable: false,
|
|
2038
2017
|
configurable: true
|
|
2039
2018
|
});
|
|
2040
|
-
FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this.
|
|
2019
|
+
FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); };
|
|
2041
2020
|
Object.defineProperty(FieldDescriptor.prototype, "intrinsicErrorMessage", {
|
|
2042
2021
|
set: function (message) { this.setIntrinsicErrorMessage(message); },
|
|
2043
2022
|
enumerable: false,
|
|
@@ -2050,7 +2029,7 @@
|
|
|
2050
2029
|
});
|
|
2051
2030
|
Object.defineProperty(FieldDescriptor.prototype, "required", {
|
|
2052
2031
|
get: function () { return this.fieldRequired; },
|
|
2053
|
-
set: function (required) { this.
|
|
2032
|
+
set: function (required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); },
|
|
2054
2033
|
enumerable: false,
|
|
2055
2034
|
configurable: true
|
|
2056
2035
|
});
|
|
@@ -2058,10 +2037,10 @@
|
|
|
2058
2037
|
get: function () { return (this._maxLength > 0) ? this._maxLength.toString() : ''; },
|
|
2059
2038
|
set: function (requiredMaxLength) {
|
|
2060
2039
|
if (typeof requiredMaxLength === 'string') {
|
|
2061
|
-
this.
|
|
2040
|
+
this.setAttr(fldAttr.maxLength, parseInt(requiredMaxLength, 10));
|
|
2062
2041
|
}
|
|
2063
2042
|
else if (typeof requiredMaxLength === 'number') {
|
|
2064
|
-
this.
|
|
2043
|
+
this.setAttr(fldAttr.maxLength, requiredMaxLength);
|
|
2065
2044
|
}
|
|
2066
2045
|
},
|
|
2067
2046
|
enumerable: false,
|
|
@@ -2078,48 +2057,57 @@
|
|
|
2078
2057
|
this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
|
|
2079
2058
|
};
|
|
2080
2059
|
FieldDescriptor.prototype.notifyEditionFinish = function () {
|
|
2081
|
-
var _a, _b, _c, _d;
|
|
2060
|
+
var _a, _b, _c, _d, _e;
|
|
2082
2061
|
var intrinsicValidation = true;
|
|
2083
|
-
var fieldDefaultFormat = (_a =
|
|
2062
|
+
var fieldDefaultFormat = (_b = (_a = this._formConfig.fieldTypesPatterns) === null || _a === void 0 ? void 0 : _a[this.fieldType]) !== null && _b !== void 0 ? _b : null;
|
|
2084
2063
|
var fieldValue = this.getValue();
|
|
2085
2064
|
if (fieldValue && (fieldDefaultFormat || this.fieldFormat)) {
|
|
2086
|
-
intrinsicValidation = ((
|
|
2087
|
-
&& ((
|
|
2065
|
+
intrinsicValidation = ((_c = fieldDefaultFormat === null || fieldDefaultFormat === void 0 ? void 0 : fieldDefaultFormat.test(fieldValue)) !== null && _c !== void 0 ? _c : true)
|
|
2066
|
+
&& ((_e = (_d = this.fieldFormat) === null || _d === void 0 ? void 0 : _d.test(fieldValue)) !== null && _e !== void 0 ? _e : true);
|
|
2088
2067
|
if (!intrinsicValidation) {
|
|
2089
2068
|
this.setError('99', this._intrinsicErrorMessage);
|
|
2090
2069
|
}
|
|
2091
2070
|
}
|
|
2092
2071
|
this._editionFinish.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
|
|
2093
2072
|
};
|
|
2073
|
+
FieldDescriptor.prototype.setAttr = function (name, value) {
|
|
2074
|
+
this[name] = value;
|
|
2075
|
+
if (this._formConfig.monitoredFieldAttributes.includes(name)) {
|
|
2076
|
+
this._attributeChange.next({ name: name, value: value });
|
|
2077
|
+
}
|
|
2078
|
+
};
|
|
2094
2079
|
FieldDescriptor.prototype.notifyEditionDetailRequest = function () {
|
|
2095
2080
|
this._detailRequest.next(this.fieldCode);
|
|
2096
2081
|
};
|
|
2097
|
-
FieldDescriptor.prototype.
|
|
2098
|
-
FieldDescriptor.prototype.
|
|
2099
|
-
FieldDescriptor.prototype.
|
|
2082
|
+
FieldDescriptor.prototype.getCustomAttribute = function (name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; };
|
|
2083
|
+
FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); };
|
|
2084
|
+
FieldDescriptor.prototype.showLabel = function () { this.setVisibleLabel(true); };
|
|
2085
|
+
FieldDescriptor.prototype.hideLabel = function () { this.setVisibleLabel(false); };
|
|
2086
|
+
FieldDescriptor.prototype.setChanged = function (hasChanged) { this.setAttr(fldAttr.hasChanged, hasChanged); };
|
|
2087
|
+
FieldDescriptor.prototype.changed = function () { this.setChanged(true); };
|
|
2100
2088
|
FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
|
|
2101
|
-
FieldDescriptor.prototype.setLabel = function (label) { this.
|
|
2089
|
+
FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
|
|
2102
2090
|
FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); };
|
|
2103
2091
|
Object.defineProperty(FieldDescriptor.prototype, "backend", {
|
|
2104
2092
|
get: function () { return this.validateOnServer; },
|
|
2105
2093
|
enumerable: false,
|
|
2106
2094
|
configurable: true
|
|
2107
2095
|
});
|
|
2108
|
-
FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.visibleLabel = visibleLabel; };
|
|
2109
2096
|
FieldDescriptor.prototype.setEditable = function (editable) {
|
|
2110
2097
|
if (editable === void 0) { editable = true; }
|
|
2111
2098
|
(editable) ? this.enable() : this.disable();
|
|
2112
2099
|
};
|
|
2100
|
+
FieldDescriptor.prototype.hasError = function () { return this.errorCode !== '00'; };
|
|
2113
2101
|
FieldDescriptor.prototype.setError = function (code, message, type) {
|
|
2114
|
-
if (type === void 0) { type =
|
|
2115
|
-
this.
|
|
2116
|
-
this.errorCode
|
|
2117
|
-
this.errorMessage
|
|
2102
|
+
if (type === void 0) { type = DEFAULT_ERROR_TYPE; }
|
|
2103
|
+
this.setAttr(fldAttr.errorCode, code !== null && code !== void 0 ? code : '00');
|
|
2104
|
+
this.setAttr(fldAttr.errorType, (this.errorCode === '00') ? '' : type);
|
|
2105
|
+
this.setAttr(fldAttr.errorMessage, message !== null && message !== void 0 ? message : '');
|
|
2118
2106
|
};
|
|
2119
2107
|
FieldDescriptor.prototype.getError = function () { return { type: this.errorType, code: this.errorCode, message: this.errorMessage }; };
|
|
2120
2108
|
Object.defineProperty(FieldDescriptor.prototype, "error", {
|
|
2121
2109
|
get: function () { return this.getError(); },
|
|
2122
|
-
set: function (errorObj) { this.setError(errorObj.code, errorObj.message, errorObj.type); },
|
|
2110
|
+
set: function (errorObj) { var _a; this.setError(errorObj.code, errorObj.message, (_a = errorObj.type) !== null && _a !== void 0 ? _a : DEFAULT_ERROR_TYPE); },
|
|
2123
2111
|
enumerable: false,
|
|
2124
2112
|
configurable: true
|
|
2125
2113
|
});
|
|
@@ -2132,7 +2120,7 @@
|
|
|
2132
2120
|
if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
|
|
2133
2121
|
return true;
|
|
2134
2122
|
}
|
|
2135
|
-
if ((this.fieldType ===
|
|
2123
|
+
if ((this.fieldType === this._formConfig.fieldTypes.array || this.fieldType === this._formConfig.fieldTypes.phone)
|
|
2136
2124
|
&& Array.isArray(fieldCurrentValue) && fieldCurrentValue.length === 0) {
|
|
2137
2125
|
return true;
|
|
2138
2126
|
}
|
|
@@ -2140,12 +2128,15 @@
|
|
|
2140
2128
|
return fieldCurrentValue === '';
|
|
2141
2129
|
};
|
|
2142
2130
|
FieldDescriptor.prototype.getValue = function () {
|
|
2143
|
-
var _a;
|
|
2131
|
+
var _a, _b;
|
|
2144
2132
|
switch (this.fieldType) {
|
|
2145
|
-
case
|
|
2133
|
+
case this._formConfig.fieldTypes.boolean:
|
|
2146
2134
|
return (_a = this._fieldValue) !== null && _a !== void 0 ? _a : false;
|
|
2147
2135
|
break;
|
|
2148
|
-
case
|
|
2136
|
+
case this._formConfig.fieldTypes.check:
|
|
2137
|
+
return (_b = this._fieldValue) !== null && _b !== void 0 ? _b : false;
|
|
2138
|
+
break;
|
|
2139
|
+
case this._formConfig.fieldTypes.currency:
|
|
2149
2140
|
return this._fieldValue.replace(',', '');
|
|
2150
2141
|
break;
|
|
2151
2142
|
default:
|
|
@@ -2155,68 +2146,39 @@
|
|
|
2155
2146
|
};
|
|
2156
2147
|
FieldDescriptor.prototype.updateFromServer = function (fld) {
|
|
2157
2148
|
var _a;
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
this.
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
this.
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
(this.
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
(this.
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
(this.
|
|
2175
|
-
|
|
2176
|
-
if (FIELD_INFO in fld) {
|
|
2177
|
-
(this.fieldInfo = fld.info);
|
|
2178
|
-
}
|
|
2179
|
-
if (FIELD_EDITABLE in fld) {
|
|
2180
|
-
this.setEditable(fld.editable);
|
|
2181
|
-
}
|
|
2182
|
-
if (FIELD_TITLE in fld) {
|
|
2183
|
-
this.setLabel(fld.fieldTitle.toString());
|
|
2184
|
-
}
|
|
2185
|
-
if (FIELD_VALUE in fld) {
|
|
2186
|
-
this.hasChanged = false;
|
|
2187
|
-
this.setValue(fld.fieldValue);
|
|
2188
|
-
}
|
|
2189
|
-
if (FIELD_OPTIONS in fld) {
|
|
2190
|
-
this.setFieldOptions(fld.fieldOptions);
|
|
2191
|
-
}
|
|
2192
|
-
if (FIELD_CAPTURE_TYPE in fld) {
|
|
2193
|
-
this.captureType = fld.captureType || 'INPUT';
|
|
2194
|
-
}
|
|
2195
|
-
if (FIELD_TYPE in fld) {
|
|
2196
|
-
this.setFieldType(fld.fieldTypeCode);
|
|
2197
|
-
}
|
|
2198
|
-
if (FIELD_MAX_LENGTH in fld) {
|
|
2199
|
-
this.maxLength = fld.maxLength;
|
|
2149
|
+
var fieldKeys = Object.keys(fld);
|
|
2150
|
+
for (var index = 0; index < fieldKeys.length; index++) {
|
|
2151
|
+
var attrName = fieldKeys[index];
|
|
2152
|
+
var attrValue = fld[attrName];
|
|
2153
|
+
(attrName === this._formConfig.apifieldattrs.visible) && this.setVisibility(attrValue);
|
|
2154
|
+
(attrName === this._formConfig.apifieldattrs.labelVisible) && this.setVisibleLabel(fld.visibleLabel);
|
|
2155
|
+
(attrName === this._formConfig.apifieldattrs.required) && this.setAttr(fldAttr.required, (_a = fld.required) !== null && _a !== void 0 ? _a : false);
|
|
2156
|
+
(attrName === this._formConfig.apifieldattrs.errorCode) && this.setAttr(fldAttr.errorCode, fld.errorCode);
|
|
2157
|
+
(attrName === this._formConfig.apifieldattrs.errorMessage) && this.setAttr(fldAttr.errorMessage, fld.errorMessage);
|
|
2158
|
+
(attrName === this._formConfig.apifieldattrs.tooltip) && this.setAttr(fldAttr.tooltipText, fld.tooltip);
|
|
2159
|
+
(attrName === this._formConfig.apifieldattrs.info) && this.setAttr(fldAttr.info, fld.info);
|
|
2160
|
+
(attrName === this._formConfig.apifieldattrs.editable) && this.setEditable(fld.editable);
|
|
2161
|
+
(attrName === this._formConfig.apifieldattrs.title) && this.setLabel(fld.fieldTitle.toString());
|
|
2162
|
+
(attrName === this._formConfig.apifieldattrs.value) && (this.setValue(fld._fieldValue) && this.setChanged(false));
|
|
2163
|
+
(attrName === this._formConfig.apifieldattrs.options) && this.setFieldOptions(fld.fieldOptions);
|
|
2164
|
+
(attrName === this._formConfig.apifieldattrs.captureType) && this.setAttr(fldAttr.captureType, fld.captureType || 'INPUT');
|
|
2165
|
+
(attrName === this._formConfig.apifieldattrs.type) && this.setFieldType(fld.fieldTypeCode);
|
|
2166
|
+
(attrName === this._formConfig.apifieldattrs.maxLength) && this.setAttr(fldAttr.maxLength, fld.maxLength);
|
|
2200
2167
|
}
|
|
2201
2168
|
};
|
|
2202
2169
|
FieldDescriptor.prototype.setFieldType = function (inputFieldType) {
|
|
2203
|
-
this.
|
|
2204
|
-
/**
|
|
2205
|
-
* Se elimina la validación de que sea un tipo conocido
|
|
2206
|
-
* this.fieldType = (inputFieldType && FIELDTYPES.includes(inputFieldType))
|
|
2207
|
-
* ? inputFieldType : componentConstants.FIELDTYPE_TEXT;
|
|
2208
|
-
*/
|
|
2170
|
+
this.setAttr(fldAttr.type, inputFieldType);
|
|
2209
2171
|
};
|
|
2210
2172
|
FieldDescriptor.prototype.format = function () {
|
|
2211
|
-
if (this.fieldType ===
|
|
2212
|
-
this.
|
|
2173
|
+
if (this.fieldType === this._formConfig.fieldTypes.currency) {
|
|
2174
|
+
this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
|
|
2213
2175
|
}
|
|
2214
2176
|
};
|
|
2215
2177
|
FieldDescriptor.prototype.setMinValue = function (minValue) {
|
|
2216
2178
|
var _a, _b, _c;
|
|
2217
|
-
if (this.fieldType ===
|
|
2179
|
+
if (this.fieldType === this._formConfig.fieldTypes.date
|
|
2218
2180
|
&& ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMinValue)) {
|
|
2219
|
-
this.
|
|
2181
|
+
this.setAttr(fldAttr.minValue, minValue);
|
|
2220
2182
|
if (!minValue) {
|
|
2221
2183
|
(_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMinValue(false);
|
|
2222
2184
|
}
|
|
@@ -2228,9 +2190,9 @@
|
|
|
2228
2190
|
};
|
|
2229
2191
|
FieldDescriptor.prototype.setMaxValue = function (maxValue) {
|
|
2230
2192
|
var _a, _b, _c;
|
|
2231
|
-
if (this.fieldType ===
|
|
2193
|
+
if (this.fieldType === this._formConfig.fieldTypes.date
|
|
2232
2194
|
&& ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMaxValue)) {
|
|
2233
|
-
this.
|
|
2195
|
+
this.setAttr(fldAttr.maxValue, maxValue);
|
|
2234
2196
|
if (!maxValue) {
|
|
2235
2197
|
(_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMaxValue(false);
|
|
2236
2198
|
}
|
|
@@ -2258,14 +2220,16 @@
|
|
|
2258
2220
|
}
|
|
2259
2221
|
return Object.assign({}, option);
|
|
2260
2222
|
});
|
|
2261
|
-
|
|
2223
|
+
fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
|
|
2262
2224
|
&& fieldOptions.length > 0) ? fieldOptions : [];
|
|
2263
|
-
|
|
2225
|
+
this.setAttr(fldAttr.options, fieldOptions);
|
|
2226
|
+
if (this.fieldType === this._formConfig.fieldTypes.array && this.widget) {
|
|
2264
2227
|
return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
|
|
2265
2228
|
}
|
|
2266
2229
|
if (this._fieldValue) {
|
|
2267
|
-
if (this.fieldType ===
|
|
2268
|
-
|
|
2230
|
+
if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._fieldValue)) {
|
|
2231
|
+
var fieldValue = (_b = this._fieldValue) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return _this.fieldOptions.find(function (opt) { return opt.fieldOptionId === item; }); });
|
|
2232
|
+
this.setAttr(fldAttr.value, fieldValue);
|
|
2269
2233
|
}
|
|
2270
2234
|
else {
|
|
2271
2235
|
var valInOptions = this.fieldOptions
|
|
@@ -2286,17 +2250,20 @@
|
|
|
2286
2250
|
if (widgetUpdate === void 0) { widgetUpdate = true; }
|
|
2287
2251
|
var _a;
|
|
2288
2252
|
if (typeof newValue === UNDEFINED || newValue === null) {
|
|
2289
|
-
return;
|
|
2253
|
+
return true;
|
|
2290
2254
|
}
|
|
2291
2255
|
var newFinalValue;
|
|
2292
2256
|
switch (this.fieldType) {
|
|
2293
2257
|
case 'BOOLEAN':
|
|
2294
2258
|
newFinalValue = !!newValue;
|
|
2295
2259
|
break;
|
|
2296
|
-
case
|
|
2260
|
+
case this._formConfig.fieldTypes.boolean:
|
|
2297
2261
|
newFinalValue = !!newValue;
|
|
2298
2262
|
break;
|
|
2299
|
-
case
|
|
2263
|
+
case this._formConfig.fieldTypes.check:
|
|
2264
|
+
newFinalValue = !!newValue;
|
|
2265
|
+
break;
|
|
2266
|
+
case this._formConfig.fieldTypes.array:
|
|
2300
2267
|
if (newValue === null || newValue === '') {
|
|
2301
2268
|
newFinalValue = [];
|
|
2302
2269
|
}
|
|
@@ -2310,7 +2277,7 @@
|
|
|
2310
2277
|
newFinalValue = newValue;
|
|
2311
2278
|
}
|
|
2312
2279
|
break;
|
|
2313
|
-
case
|
|
2280
|
+
case this._formConfig.fieldTypes.map:
|
|
2314
2281
|
newFinalValue = newValue;
|
|
2315
2282
|
if (newFinalValue && this.widget && widgetUpdate) {
|
|
2316
2283
|
var latitude = parseFloat(newFinalValue[0]);
|
|
@@ -2318,7 +2285,7 @@
|
|
|
2318
2285
|
(_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
|
|
2319
2286
|
}
|
|
2320
2287
|
break;
|
|
2321
|
-
case
|
|
2288
|
+
case this._formConfig.fieldTypes.currency:
|
|
2322
2289
|
newFinalValue = formatCurrency(this._fieldValue);
|
|
2323
2290
|
break;
|
|
2324
2291
|
default:
|
|
@@ -2326,9 +2293,10 @@
|
|
|
2326
2293
|
break;
|
|
2327
2294
|
}
|
|
2328
2295
|
if (this._fieldValue !== newFinalValue) {
|
|
2329
|
-
this.
|
|
2330
|
-
this.
|
|
2296
|
+
this.setChanged(true);
|
|
2297
|
+
this.setAttr(fldAttr.value, newFinalValue);
|
|
2331
2298
|
}
|
|
2299
|
+
return true;
|
|
2332
2300
|
};
|
|
2333
2301
|
return FieldDescriptor;
|
|
2334
2302
|
}(FormElement));
|
|
@@ -2336,14 +2304,16 @@
|
|
|
2336
2304
|
var HEADER = 'HEADER';
|
|
2337
2305
|
var NO_ERROR = '00';
|
|
2338
2306
|
var FormStructureAndData = /** @class */ (function () {
|
|
2339
|
-
function FormStructureAndData(definitionReceived) {
|
|
2307
|
+
function FormStructureAndData(definitionReceived, formConfig) {
|
|
2340
2308
|
var e_1, _d, e_2, _e, e_3, _f, e_4, _g;
|
|
2309
|
+
var _this = this;
|
|
2341
2310
|
this._fieldsObj = {};
|
|
2342
2311
|
this._actionsObj = {};
|
|
2343
2312
|
this._tableObj = {};
|
|
2344
2313
|
this._sectionsObj = {};
|
|
2345
2314
|
this._immutableData = {};
|
|
2346
2315
|
this._extraInfo = {};
|
|
2316
|
+
this._formConfig = formConfig;
|
|
2347
2317
|
this.state = '';
|
|
2348
2318
|
this._actions = [];
|
|
2349
2319
|
this._fields = [];
|
|
@@ -2379,7 +2349,7 @@
|
|
|
2379
2349
|
try {
|
|
2380
2350
|
for (var formActions_1 = __values(formActions), formActions_1_1 = formActions_1.next(); !formActions_1_1.done; formActions_1_1 = formActions_1.next()) {
|
|
2381
2351
|
var actionReceived = formActions_1_1.value;
|
|
2382
|
-
var globalAction = new FormAction(actionReceived);
|
|
2352
|
+
var globalAction = new FormAction(actionReceived, this._formConfig);
|
|
2383
2353
|
var globalActionCode = globalAction.actionCode;
|
|
2384
2354
|
if (globalActionCode) {
|
|
2385
2355
|
this._actions.push(globalAction);
|
|
@@ -2410,7 +2380,7 @@
|
|
|
2410
2380
|
try {
|
|
2411
2381
|
for (var formFields_1 = __values(formFields), formFields_1_1 = formFields_1.next(); !formFields_1_1.done; formFields_1_1 = formFields_1.next()) {
|
|
2412
2382
|
var fieldReceived = formFields_1_1.value;
|
|
2413
|
-
var fieldToAdd = new FieldDescriptor(fieldReceived);
|
|
2383
|
+
var fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
|
|
2414
2384
|
var fieldCode = fieldToAdd.fieldCode;
|
|
2415
2385
|
if (fieldCode) {
|
|
2416
2386
|
this._fields.push(fieldToAdd);
|
|
@@ -2437,14 +2407,14 @@
|
|
|
2437
2407
|
enabledStates = __spreadArray([], __read(visibleStates));
|
|
2438
2408
|
}
|
|
2439
2409
|
if (!visibleStates || visibleStates.length === 0) {
|
|
2440
|
-
visibleStates =
|
|
2410
|
+
visibleStates = _this._formConfig.defaultStateFlow.states;
|
|
2441
2411
|
}
|
|
2442
2412
|
return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
|
|
2443
2413
|
});
|
|
2444
2414
|
try {
|
|
2445
2415
|
for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
|
|
2446
2416
|
var tableReceived = tables_1_1.value;
|
|
2447
|
-
var tableToAdd = new RecordTable(tableReceived);
|
|
2417
|
+
var tableToAdd = new RecordTable(tableReceived, this._formConfig);
|
|
2448
2418
|
var tableCode = tableToAdd.tableCode;
|
|
2449
2419
|
if (tableCode) {
|
|
2450
2420
|
this._tables.push(tableToAdd);
|
|
@@ -2554,7 +2524,7 @@
|
|
|
2554
2524
|
FormStructureAndData.prototype.setStateFlow = function (states, transitions, defaultState) {
|
|
2555
2525
|
var _this = this;
|
|
2556
2526
|
if (!states || !transitions) {
|
|
2557
|
-
this._stateFlow = JSON.parse(JSON.stringify(
|
|
2527
|
+
this._stateFlow = JSON.parse(JSON.stringify(this._formConfig.defaultStateFlow));
|
|
2558
2528
|
return;
|
|
2559
2529
|
}
|
|
2560
2530
|
this._stateFlow.states = states;
|
|
@@ -3113,71 +3083,79 @@
|
|
|
3113
3083
|
function LibFormManagerService() {
|
|
3114
3084
|
this.cleanStack();
|
|
3115
3085
|
}
|
|
3116
|
-
|
|
3117
|
-
* Métodos virtuales de manejo de formularios
|
|
3118
|
-
*/
|
|
3086
|
+
// Métodos virtuales para las aplicaciones
|
|
3119
3087
|
LibFormManagerService.prototype.getFormDefinition = function (formCode) { };
|
|
3088
|
+
LibFormManagerService.prototype.getFormRoute = function (formCode) { };
|
|
3089
|
+
LibFormManagerService.prototype.getRouteForm = function (path) { };
|
|
3120
3090
|
LibFormManagerService.prototype.execServerAction = function (actionDetail) { };
|
|
3121
|
-
LibFormManagerService.prototype.
|
|
3122
|
-
/**
|
|
3123
|
-
* Manejo del stack de navegación con atributos estados y parámetros
|
|
3124
|
-
*/
|
|
3125
|
-
LibFormManagerService.prototype.resetPageStack = function () { this.cleanStack(); };
|
|
3126
|
-
LibFormManagerService.prototype.cleanStack = function () {
|
|
3127
|
-
this.pageStack = [];
|
|
3128
|
-
};
|
|
3091
|
+
LibFormManagerService.prototype.goToForm = function (formCode, token, subject) { };
|
|
3129
3092
|
LibFormManagerService.prototype.loadStack = function () { };
|
|
3130
3093
|
LibFormManagerService.prototype.saveStack = function () { };
|
|
3131
|
-
LibFormManagerService.prototype.
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
this.
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3094
|
+
LibFormManagerService.prototype.cleanStack = function () { this.pageStack = []; };
|
|
3095
|
+
LibFormManagerService.prototype.resetPageStack = function () { this.cleanStack(); };
|
|
3096
|
+
LibFormManagerService.prototype.findFormInStack = function (token) {
|
|
3097
|
+
var index = this.pageStack.findIndex(function (item) { return (item === null || item === void 0 ? void 0 : item.token) === token; });
|
|
3098
|
+
var data = (index >= 0) ? this.pageStack[index] : null;
|
|
3099
|
+
return { index: index, data: data };
|
|
3100
|
+
};
|
|
3101
|
+
LibFormManagerService.prototype.replaceItem = function (token, formInfo) {
|
|
3102
|
+
var _a, _b;
|
|
3103
|
+
if (!token || !formInfo) {
|
|
3104
|
+
return;
|
|
3105
|
+
}
|
|
3106
|
+
var _c = this.findFormInStack(token), index = _c.index, storedForm = _c.data;
|
|
3107
|
+
var updatedForm = null;
|
|
3108
|
+
if (index >= 0) {
|
|
3109
|
+
updatedForm = Object.assign({}, storedForm);
|
|
3110
|
+
updatedForm.subject = (_a = formInfo === null || formInfo === void 0 ? void 0 : formInfo.subject) !== null && _a !== void 0 ? _a : storedForm.subject;
|
|
3111
|
+
updatedForm.state = (_b = formInfo === null || formInfo === void 0 ? void 0 : formInfo.state) !== null && _b !== void 0 ? _b : storedForm.state;
|
|
3112
|
+
Object.assign(updatedForm.fields, formInfo.fields);
|
|
3113
|
+
Object.assign(updatedForm.extra, formInfo.extra);
|
|
3114
|
+
this.pageStack[index] = updatedForm;
|
|
3143
3115
|
this.saveStack();
|
|
3144
|
-
return formData;
|
|
3145
3116
|
}
|
|
3146
3117
|
};
|
|
3147
|
-
LibFormManagerService.prototype.
|
|
3148
|
-
var
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3118
|
+
LibFormManagerService.prototype.stack = function (origin, target) {
|
|
3119
|
+
var token = nanoid.nanoid(6);
|
|
3120
|
+
this.replaceItem(target.originToken, origin);
|
|
3121
|
+
this.pageStack.push(Object.assign({ token: token }, target));
|
|
3122
|
+
this.saveStack();
|
|
3123
|
+
return token;
|
|
3124
|
+
};
|
|
3125
|
+
LibFormManagerService.prototype.unstack = function (token) {
|
|
3126
|
+
if (token === void 0) { token = null; }
|
|
3127
|
+
var index = (token) ? this.findFormInStack(token).index : this.pageStack.length - 2;
|
|
3128
|
+
var formInfo = null;
|
|
3129
|
+
if (index >= 0) {
|
|
3130
|
+
formInfo = this.pageStack[index];
|
|
3131
|
+
this.pageStack.splice(index + 1);
|
|
3132
|
+
this.saveStack();
|
|
3152
3133
|
}
|
|
3153
|
-
return
|
|
3134
|
+
return formInfo;
|
|
3154
3135
|
};
|
|
3155
|
-
LibFormManagerService.prototype.
|
|
3156
|
-
var
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3136
|
+
LibFormManagerService.prototype.getFormInfo = function (token) {
|
|
3137
|
+
var _a, _b;
|
|
3138
|
+
var data = this.findFormInStack(token).data;
|
|
3139
|
+
return {
|
|
3140
|
+
token: data === null || data === void 0 ? void 0 : data.token,
|
|
3141
|
+
subject: data === null || data === void 0 ? void 0 : data.subject,
|
|
3142
|
+
state: data === null || data === void 0 ? void 0 : data.state,
|
|
3143
|
+
originToken: data === null || data === void 0 ? void 0 : data.originToken,
|
|
3144
|
+
fields: (_a = data === null || data === void 0 ? void 0 : data.fields) !== null && _a !== void 0 ? _a : {},
|
|
3145
|
+
extra: (_b = data === null || data === void 0 ? void 0 : data.extra) !== null && _b !== void 0 ? _b : {}
|
|
3146
|
+
};
|
|
3162
3147
|
};
|
|
3163
|
-
LibFormManagerService.prototype.
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
var
|
|
3168
|
-
|
|
3169
|
-
var navigationArray = __spreadArray(__spreadArray([url], __read(params)), [newToken]);
|
|
3170
|
-
this.goToRoute(navigationArray);
|
|
3148
|
+
LibFormManagerService.prototype.openForm = function (origin, target) {
|
|
3149
|
+
var _a;
|
|
3150
|
+
(!origin) && this.cleanStack();
|
|
3151
|
+
target.originToken = (_a = origin === null || origin === void 0 ? void 0 : origin.token) !== null && _a !== void 0 ? _a : null;
|
|
3152
|
+
var token = this.stack(origin, target);
|
|
3153
|
+
this.goToForm(target.name, token, target.subject);
|
|
3171
3154
|
};
|
|
3172
|
-
LibFormManagerService.prototype.
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
}
|
|
3177
|
-
var _a = prevForm.origin, url = _a.url, params = _a.params, token = _a.token;
|
|
3178
|
-
var navigationArray = __spreadArray([url], __read(params));
|
|
3179
|
-
token && navigationArray.push(token);
|
|
3180
|
-
this.goToRoute(navigationArray);
|
|
3155
|
+
LibFormManagerService.prototype.backTo = function (targetToken) {
|
|
3156
|
+
if (targetToken === void 0) { targetToken = null; }
|
|
3157
|
+
var formInfo = this.unstack(targetToken);
|
|
3158
|
+
formInfo && formInfo.name && this.goToForm(formInfo.name, formInfo.token, formInfo.subject);
|
|
3181
3159
|
};
|
|
3182
3160
|
return LibFormManagerService;
|
|
3183
3161
|
}());
|
|
@@ -3216,11 +3194,8 @@
|
|
|
3216
3194
|
var INLINE_ACTION = 'INLINE';
|
|
3217
3195
|
var GLOBAL_ACTION = 'GLOBAL';
|
|
3218
3196
|
var GET_DATA_ACTION = 'GETDATA';
|
|
3219
|
-
var
|
|
3220
|
-
var
|
|
3221
|
-
var ORIGIN_PARAM = 'origin';
|
|
3222
|
-
var STATE_PARAM = 'mode';
|
|
3223
|
-
var REQUIRED_FIELD_MESSAGE = 'Campo requerido';
|
|
3197
|
+
var SUBJECT = 'subject';
|
|
3198
|
+
var TOKEN = 'token';
|
|
3224
3199
|
var BasicFormComponent = /** @class */ (function () {
|
|
3225
3200
|
function BasicFormComponent(formManagerService, _eventManager, fileMgmtServices) {
|
|
3226
3201
|
this.formManagerService = formManagerService;
|
|
@@ -3230,10 +3205,9 @@
|
|
|
3230
3205
|
this.errorMessage = '';
|
|
3231
3206
|
this.errorDetail = '';
|
|
3232
3207
|
this.formStructure = null;
|
|
3233
|
-
this.
|
|
3234
|
-
this.inputDataFields =
|
|
3235
|
-
this.extraData =
|
|
3236
|
-
this.componentConstants = componentConstants;
|
|
3208
|
+
this.controlToken = null;
|
|
3209
|
+
this.inputDataFields = {};
|
|
3210
|
+
this.extraData = {};
|
|
3237
3211
|
this.definitionObtained = false;
|
|
3238
3212
|
this.formVisible = false;
|
|
3239
3213
|
this.inServerProcess = false;
|
|
@@ -3255,14 +3229,17 @@
|
|
|
3255
3229
|
this.cleanStart();
|
|
3256
3230
|
this.customPreProcessing();
|
|
3257
3231
|
}
|
|
3232
|
+
BasicFormComponent.prototype.setConfig = function (formConfig) {
|
|
3233
|
+
this.formConfig = formConfig;
|
|
3234
|
+
};
|
|
3258
3235
|
BasicFormComponent.prototype.cleanStart = function () {
|
|
3259
3236
|
this._errorType = '';
|
|
3260
3237
|
this.errorCode = '';
|
|
3261
3238
|
this.errorMessage = '';
|
|
3262
3239
|
this.errorDetail = '';
|
|
3263
3240
|
this.formStructure = null;
|
|
3264
|
-
this.
|
|
3265
|
-
this.inputDataFields =
|
|
3241
|
+
this.controlToken = null;
|
|
3242
|
+
this.inputDataFields = {};
|
|
3266
3243
|
this.definitionObtained = false;
|
|
3267
3244
|
// Se limpian los manejadores de eventos
|
|
3268
3245
|
this.formVisible = false;
|
|
@@ -3430,36 +3407,64 @@
|
|
|
3430
3407
|
BasicFormComponent.prototype.subscribeAppEvent = function (eventName, callback) {
|
|
3431
3408
|
this._eventEmiter.subscribe(eventName, callback);
|
|
3432
3409
|
};
|
|
3410
|
+
BasicFormComponent.prototype.openForm = function (name, data, backData, cleanStack) {
|
|
3411
|
+
if (backData === void 0) { backData = null; }
|
|
3412
|
+
if (cleanStack === void 0) { cleanStack = false; }
|
|
3413
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3414
|
+
var origin = null;
|
|
3415
|
+
if (!cleanStack) {
|
|
3416
|
+
origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this.controlToken });
|
|
3417
|
+
origin.subject = (_a = origin === null || origin === void 0 ? void 0 : origin.subject) !== null && _a !== void 0 ? _a : this.formSubject;
|
|
3418
|
+
origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.currentState;
|
|
3419
|
+
origin.fields = (_c = origin === null || origin === void 0 ? void 0 : origin.fields) !== null && _c !== void 0 ? _c : {};
|
|
3420
|
+
origin.extra = (_d = origin === null || origin === void 0 ? void 0 : origin.extra) !== null && _d !== void 0 ? _d : {};
|
|
3421
|
+
}
|
|
3422
|
+
var target = Object.assign(Object.assign({}, data), { name: name });
|
|
3423
|
+
target.subject = (_e = target === null || target === void 0 ? void 0 : target.subject) !== null && _e !== void 0 ? _e : null;
|
|
3424
|
+
target.state = (_f = target === null || target === void 0 ? void 0 : target.state) !== null && _f !== void 0 ? _f : null;
|
|
3425
|
+
target.fields = (_g = target === null || target === void 0 ? void 0 : target.fields) !== null && _g !== void 0 ? _g : {};
|
|
3426
|
+
target.extra = (_h = target === null || target === void 0 ? void 0 : target.extra) !== null && _h !== void 0 ? _h : {};
|
|
3427
|
+
this.formManagerService.openForm(origin, target);
|
|
3428
|
+
};
|
|
3429
|
+
/**
|
|
3430
|
+
* @deprecated Este método ya no debería ser utilizado. Use openForm con el nombre del formulario
|
|
3431
|
+
*/
|
|
3433
3432
|
BasicFormComponent.prototype.goToPage = function (navigationArray, predefinedFields, options) {
|
|
3434
3433
|
if (options === void 0) { options = null; }
|
|
3435
|
-
var _a
|
|
3434
|
+
var _a;
|
|
3436
3435
|
var origin = null;
|
|
3437
3436
|
var cleanStack = (_a = options === null || options === void 0 ? void 0 : options.cleanStack) !== null && _a !== void 0 ? _a : false;
|
|
3438
|
-
var params = [];
|
|
3439
|
-
this.currentState && params.push(this.currentState);
|
|
3440
|
-
this.formSubject && params.push(this.formSubject);
|
|
3441
3437
|
if (!cleanStack) {
|
|
3442
3438
|
origin = {
|
|
3443
|
-
|
|
3439
|
+
name: this.name,
|
|
3444
3440
|
url: this._formRoute,
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3441
|
+
token: this.controlToken,
|
|
3442
|
+
fields: this.inputDataFields,
|
|
3443
|
+
extra: this.extraData
|
|
3448
3444
|
};
|
|
3449
3445
|
}
|
|
3450
3446
|
var target = {
|
|
3447
|
+
name: this.formManagerService.getRouteForm(navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[0]),
|
|
3451
3448
|
url: navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[0],
|
|
3452
|
-
|
|
3453
|
-
|
|
3449
|
+
state: navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[1],
|
|
3450
|
+
subject: navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[2],
|
|
3451
|
+
fields: predefinedFields,
|
|
3452
|
+
extra: null,
|
|
3454
3453
|
};
|
|
3455
|
-
this.formManagerService.
|
|
3454
|
+
this.formManagerService.openForm(origin, target);
|
|
3456
3455
|
};
|
|
3456
|
+
/**
|
|
3457
|
+
* @deprecated Este método ya no debería ser utilizado. Use openForm con el nombre del formulario
|
|
3458
|
+
*/
|
|
3457
3459
|
BasicFormComponent.prototype.goToNewPage = function (nav, flds) { return this.goToPage(nav, flds, { cleanStack: true }); };
|
|
3460
|
+
/**
|
|
3461
|
+
* @deprecated Este método ya no debería ser utilizado. Use openForm con el nombre del formulario
|
|
3462
|
+
*/
|
|
3458
3463
|
BasicFormComponent.prototype.goToSubPage = function (nav, flds) { return this.goToPage(nav, flds, { cleanStack: false }); };
|
|
3459
|
-
BasicFormComponent.prototype.canGoBack = function () { return this.
|
|
3460
|
-
BasicFormComponent.prototype.goBack = function () { return this.formManagerService.
|
|
3464
|
+
BasicFormComponent.prototype.canGoBack = function () { return this.originToken !== null; };
|
|
3465
|
+
BasicFormComponent.prototype.goBack = function () { return this.formManagerService.backTo(); };
|
|
3461
3466
|
BasicFormComponent.prototype.goBackForm = function () { return this.goBack(); };
|
|
3462
|
-
BasicFormComponent.prototype.getOriginDetail = function () { return this.formManagerService.
|
|
3467
|
+
BasicFormComponent.prototype.getOriginDetail = function () { return this.formManagerService.getFormInfo(this.originToken); };
|
|
3463
3468
|
BasicFormComponent.prototype.setError = function (errorType, errorMessage, errorDetail) {
|
|
3464
3469
|
this._errorType = errorType || '';
|
|
3465
3470
|
this.errorMessage = errorMessage || '';
|
|
@@ -3491,44 +3496,23 @@
|
|
|
3491
3496
|
configurable: true
|
|
3492
3497
|
});
|
|
3493
3498
|
BasicFormComponent.prototype.getFormParameter = function (name) {
|
|
3494
|
-
|
|
3499
|
+
var _a, _b;
|
|
3500
|
+
return (name) ? ((_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null) : null;
|
|
3495
3501
|
};
|
|
3496
3502
|
BasicFormComponent.prototype.getSubject = function () { return this.formSubject; };
|
|
3497
3503
|
BasicFormComponent.prototype.getformSubject = function () { return this.getSubject(); };
|
|
3498
3504
|
BasicFormComponent.prototype.preocessInputParams = function (params) {
|
|
3499
|
-
var
|
|
3500
|
-
|
|
3501
|
-
var
|
|
3502
|
-
if (!
|
|
3503
|
-
|
|
3504
|
-
}
|
|
3505
|
-
this.extraData = [];
|
|
3506
|
-
try {
|
|
3507
|
-
for (var allParams_1 = __values(allParams), allParams_1_1 = allParams_1.next(); !allParams_1_1.done; allParams_1_1 = allParams_1.next()) {
|
|
3508
|
-
var paramName = allParams_1_1.value;
|
|
3509
|
-
this.extraData[paramName] = params[paramName].toString();
|
|
3510
|
-
}
|
|
3511
|
-
}
|
|
3512
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3513
|
-
finally {
|
|
3514
|
-
try {
|
|
3515
|
-
if (allParams_1_1 && !allParams_1_1.done && (_g = allParams_1.return)) _g.call(allParams_1);
|
|
3516
|
-
}
|
|
3517
|
-
finally { if (e_1) throw e_1.error; }
|
|
3518
|
-
}
|
|
3519
|
-
var formName = (_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[FORM_CODE]) !== null && _b !== void 0 ? _b : this.name;
|
|
3520
|
-
if (formName !== this.name) {
|
|
3521
|
-
this.cleanStart();
|
|
3522
|
-
this.name = formName;
|
|
3523
|
-
}
|
|
3524
|
-
this.formSubject = (_d = (_c = this.extraData) === null || _c === void 0 ? void 0 : _c[FORM_SUBJECT]) !== null && _d !== void 0 ? _d : null;
|
|
3525
|
-
var initialState = this.extraData[STATE_PARAM];
|
|
3526
|
-
this.transitionToken = (_e = this.extraData[ORIGIN_PARAM]) !== null && _e !== void 0 ? _e : null;
|
|
3527
|
-
this.inputDataFields = (_f = this.formManagerService.getInputData(this.transitionToken)) !== null && _f !== void 0 ? _f : [];
|
|
3528
|
-
if (!this.transitionToken) {
|
|
3529
|
-
this.formManagerService.cleanStack();
|
|
3505
|
+
var _a, _b;
|
|
3506
|
+
this.controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN].toString()) !== null && _a !== void 0 ? _a : null;
|
|
3507
|
+
var _j = this.formManagerService.getFormInfo(this.controlToken), token = _j.token, subject = _j.subject, state = _j.state, fields = _j.fields, extra = _j.extra, originToken = _j.originToken;
|
|
3508
|
+
if (!this.controlToken || this.controlToken !== token) {
|
|
3509
|
+
console.log("No se obtuvo un token v\u00E1lido para abrir el formulario " + this.controlToken + "->" + token);
|
|
3530
3510
|
}
|
|
3531
|
-
|
|
3511
|
+
this.formSubject = (_b = params === null || params === void 0 ? void 0 : params[SUBJECT].toString()) !== null && _b !== void 0 ? _b : subject;
|
|
3512
|
+
this.inputDataFields = fields;
|
|
3513
|
+
this.extraData = extra;
|
|
3514
|
+
this.originToken = originToken;
|
|
3515
|
+
return state;
|
|
3532
3516
|
};
|
|
3533
3517
|
BasicFormComponent.prototype.subscribeSectionActivation = function () {
|
|
3534
3518
|
var _this = this;
|
|
@@ -3580,12 +3564,10 @@
|
|
|
3580
3564
|
}
|
|
3581
3565
|
};
|
|
3582
3566
|
BasicFormComponent.prototype.formInit = function (params) {
|
|
3583
|
-
var _a;
|
|
3584
3567
|
return __awaiter(this, void 0, void 0, function () {
|
|
3585
|
-
var initialState, formDefinition,
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
switch (_k.label) {
|
|
3568
|
+
var initialState, formDefinition, inputFieldNames, index, fieldCode, fieldValue, recordResponse;
|
|
3569
|
+
return __generator(this, function (_j) {
|
|
3570
|
+
switch (_j.label) {
|
|
3589
3571
|
case 0:
|
|
3590
3572
|
initialState = this.preocessInputParams(params);
|
|
3591
3573
|
if (!this.name) {
|
|
@@ -3595,48 +3577,28 @@
|
|
|
3595
3577
|
this.inServerProcess = true;
|
|
3596
3578
|
return [4 /*yield*/, this.formManagerService.getFormDefinition(this.name)];
|
|
3597
3579
|
case 1:
|
|
3598
|
-
formDefinition =
|
|
3580
|
+
formDefinition = _j.sent();
|
|
3599
3581
|
this.inServerProcess = false;
|
|
3600
|
-
this.formStructure = new FormStructureAndData(formDefinition);
|
|
3582
|
+
this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
3601
3583
|
this.definitionObtained = true;
|
|
3602
3584
|
return [3 /*break*/, 3];
|
|
3603
3585
|
case 2:
|
|
3604
3586
|
this.cleanData();
|
|
3605
|
-
|
|
3587
|
+
_j.label = 3;
|
|
3606
3588
|
case 3:
|
|
3607
3589
|
if (!this.supportState(initialState)) {
|
|
3608
3590
|
initialState = this.formStructure.defaultState;
|
|
3609
3591
|
}
|
|
3610
3592
|
this.formStructure.changeState(initialState || this.formStructure.defaultState);
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
if (fieldCode) {
|
|
3617
|
-
this.setFieldValue(fieldCode, fieldValue);
|
|
3618
|
-
}
|
|
3619
|
-
}
|
|
3620
|
-
}
|
|
3621
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3622
|
-
finally {
|
|
3623
|
-
try {
|
|
3624
|
-
if (_h && !_h.done && (_j = _g.return)) _j.call(_g);
|
|
3625
|
-
}
|
|
3626
|
-
finally { if (e_2) throw e_2.error; }
|
|
3627
|
-
}
|
|
3628
|
-
}
|
|
3629
|
-
else {
|
|
3630
|
-
fieldCodes = Object.keys((_a = this.inputDataFields) !== null && _a !== void 0 ? _a : {});
|
|
3631
|
-
for (index = 0; index < fieldCodes.length; index++) {
|
|
3632
|
-
fieldCode = fieldCodes[index];
|
|
3633
|
-
fieldValue = this.inputDataFields[fieldCode];
|
|
3634
|
-
this.setFieldValue(fieldCode, fieldValue);
|
|
3635
|
-
}
|
|
3593
|
+
inputFieldNames = Object.keys(this.inputDataFields);
|
|
3594
|
+
for (index = 0; index < inputFieldNames.length; index++) {
|
|
3595
|
+
fieldCode = inputFieldNames[index];
|
|
3596
|
+
fieldValue = this.inputDataFields[fieldCode];
|
|
3597
|
+
this.setFieldValue(fieldCode, fieldValue);
|
|
3636
3598
|
}
|
|
3637
|
-
return [4 /*yield*/, this.requestFormAction(
|
|
3599
|
+
return [4 /*yield*/, this.requestFormAction(formActions.getData)];
|
|
3638
3600
|
case 4:
|
|
3639
|
-
recordResponse =
|
|
3601
|
+
recordResponse = _j.sent();
|
|
3640
3602
|
this.checkErrorRecordReceived(recordResponse);
|
|
3641
3603
|
this.formVisible = true;
|
|
3642
3604
|
this.subscribeSectionActivation();
|
|
@@ -3659,7 +3621,7 @@
|
|
|
3659
3621
|
this.errorDetail = recordResponse.errorDetail;
|
|
3660
3622
|
};
|
|
3661
3623
|
BasicFormComponent.prototype.errorOccured = function () {
|
|
3662
|
-
return (this.errorCode !==
|
|
3624
|
+
return (this.errorCode !== '00');
|
|
3663
3625
|
};
|
|
3664
3626
|
BasicFormComponent.prototype.changeState = function (state) { return this.formStructure.changeState(state); };
|
|
3665
3627
|
BasicFormComponent.prototype.changeFormMode = function (state) { return this.changeState(state); };
|
|
@@ -3667,8 +3629,8 @@
|
|
|
3667
3629
|
if (actionSubject === void 0) { actionSubject = {}; }
|
|
3668
3630
|
return __awaiter(this, void 0, void 0, function () {
|
|
3669
3631
|
var actionDetail, formActionResponse, error, formResponseData;
|
|
3670
|
-
return __generator(this, function (
|
|
3671
|
-
switch (
|
|
3632
|
+
return __generator(this, function (_j) {
|
|
3633
|
+
switch (_j.label) {
|
|
3672
3634
|
case 0:
|
|
3673
3635
|
actionDetail = {
|
|
3674
3636
|
formCode: this.name,
|
|
@@ -3686,7 +3648,7 @@
|
|
|
3686
3648
|
this.inServerProcess = true;
|
|
3687
3649
|
return [4 /*yield*/, this.formManagerService.execServerAction(actionDetail)];
|
|
3688
3650
|
case 1:
|
|
3689
|
-
formActionResponse =
|
|
3651
|
+
formActionResponse = _j.sent();
|
|
3690
3652
|
this.inServerProcess = false;
|
|
3691
3653
|
if (formActionResponse && formActionResponse.error.errorType) {
|
|
3692
3654
|
console.log('Excepción no soportada');
|
|
@@ -3705,7 +3667,7 @@
|
|
|
3705
3667
|
});
|
|
3706
3668
|
};
|
|
3707
3669
|
BasicFormComponent.prototype.updateFormWithServerData = function (formContent) {
|
|
3708
|
-
var
|
|
3670
|
+
var e_1, _j, e_2, _k, e_3, _l;
|
|
3709
3671
|
var currentMode = formContent.currentMode, formSubject = formContent.formSubject, actions = formContent.actions, fields = formContent.fields, recordTables = formContent.recordTables, returnedFile = formContent.returnedFile, immutableData = formContent.immutableData, extraInfo = formContent.extraInfo;
|
|
3710
3672
|
this.changeState(currentMode !== null && currentMode !== void 0 ? currentMode : this.formStructure.state);
|
|
3711
3673
|
if (formSubject) {
|
|
@@ -3721,12 +3683,12 @@
|
|
|
3721
3683
|
}
|
|
3722
3684
|
}
|
|
3723
3685
|
}
|
|
3724
|
-
catch (
|
|
3686
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
3725
3687
|
finally {
|
|
3726
3688
|
try {
|
|
3727
|
-
if (actions_1_1 && !actions_1_1.done && (
|
|
3689
|
+
if (actions_1_1 && !actions_1_1.done && (_j = actions_1.return)) _j.call(actions_1);
|
|
3728
3690
|
}
|
|
3729
|
-
finally { if (
|
|
3691
|
+
finally { if (e_1) throw e_1.error; }
|
|
3730
3692
|
}
|
|
3731
3693
|
}
|
|
3732
3694
|
if (fields && fields.length > 0) {
|
|
@@ -3739,12 +3701,12 @@
|
|
|
3739
3701
|
}
|
|
3740
3702
|
}
|
|
3741
3703
|
}
|
|
3742
|
-
catch (
|
|
3704
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
3743
3705
|
finally {
|
|
3744
3706
|
try {
|
|
3745
|
-
if (fields_1_1 && !fields_1_1.done && (
|
|
3707
|
+
if (fields_1_1 && !fields_1_1.done && (_k = fields_1.return)) _k.call(fields_1);
|
|
3746
3708
|
}
|
|
3747
|
-
finally { if (
|
|
3709
|
+
finally { if (e_2) throw e_2.error; }
|
|
3748
3710
|
}
|
|
3749
3711
|
}
|
|
3750
3712
|
if (recordTables && recordTables.length > 0) {
|
|
@@ -3757,12 +3719,12 @@
|
|
|
3757
3719
|
}
|
|
3758
3720
|
}
|
|
3759
3721
|
}
|
|
3760
|
-
catch (
|
|
3722
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
3761
3723
|
finally {
|
|
3762
3724
|
try {
|
|
3763
|
-
if (recordTables_1_1 && !recordTables_1_1.done && (
|
|
3725
|
+
if (recordTables_1_1 && !recordTables_1_1.done && (_l = recordTables_1.return)) _l.call(recordTables_1);
|
|
3764
3726
|
}
|
|
3765
|
-
finally { if (
|
|
3727
|
+
finally { if (e_3) throw e_3.error; }
|
|
3766
3728
|
}
|
|
3767
3729
|
}
|
|
3768
3730
|
if (returnedFile && returnedFile.file) {
|
|
@@ -3817,8 +3779,8 @@
|
|
|
3817
3779
|
BasicFormComponent.prototype.launchSectionActivation = function (sectionCode) {
|
|
3818
3780
|
return __awaiter(this, void 0, void 0, function () {
|
|
3819
3781
|
var sectionObject, clientSectionMethods, clientSectionMethods_1, clientSectionMethods_1_1, clientSectionMethod;
|
|
3820
|
-
var
|
|
3821
|
-
return __generator(this, function (
|
|
3782
|
+
var e_4, _j;
|
|
3783
|
+
return __generator(this, function (_k) {
|
|
3822
3784
|
sectionObject = this.formStructure.getSectionObject(sectionCode);
|
|
3823
3785
|
if (!sectionObject) {
|
|
3824
3786
|
return [2 /*return*/];
|
|
@@ -3831,12 +3793,12 @@
|
|
|
3831
3793
|
clientSectionMethod(sectionObject);
|
|
3832
3794
|
}
|
|
3833
3795
|
}
|
|
3834
|
-
catch (
|
|
3796
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
3835
3797
|
finally {
|
|
3836
3798
|
try {
|
|
3837
|
-
if (clientSectionMethods_1_1 && !clientSectionMethods_1_1.done && (
|
|
3799
|
+
if (clientSectionMethods_1_1 && !clientSectionMethods_1_1.done && (_j = clientSectionMethods_1.return)) _j.call(clientSectionMethods_1);
|
|
3838
3800
|
}
|
|
3839
|
-
finally { if (
|
|
3801
|
+
finally { if (e_4) throw e_4.error; }
|
|
3840
3802
|
}
|
|
3841
3803
|
}
|
|
3842
3804
|
return [2 /*return*/];
|
|
@@ -3846,8 +3808,8 @@
|
|
|
3846
3808
|
BasicFormComponent.prototype.launchSectionInactivation = function (sectionCode) {
|
|
3847
3809
|
return __awaiter(this, void 0, void 0, function () {
|
|
3848
3810
|
var sectionObject, clientSectionMethods, clientSectionMethods_2, clientSectionMethods_2_1, clientSectionMethod;
|
|
3849
|
-
var
|
|
3850
|
-
return __generator(this, function (
|
|
3811
|
+
var e_5, _j;
|
|
3812
|
+
return __generator(this, function (_k) {
|
|
3851
3813
|
sectionObject = this.formStructure.getSectionObject(sectionCode);
|
|
3852
3814
|
if (!sectionObject) {
|
|
3853
3815
|
return [2 /*return*/];
|
|
@@ -3860,12 +3822,12 @@
|
|
|
3860
3822
|
clientSectionMethod(sectionObject);
|
|
3861
3823
|
}
|
|
3862
3824
|
}
|
|
3863
|
-
catch (
|
|
3825
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
3864
3826
|
finally {
|
|
3865
3827
|
try {
|
|
3866
|
-
if (clientSectionMethods_2_1 && !clientSectionMethods_2_1.done && (
|
|
3828
|
+
if (clientSectionMethods_2_1 && !clientSectionMethods_2_1.done && (_j = clientSectionMethods_2.return)) _j.call(clientSectionMethods_2);
|
|
3867
3829
|
}
|
|
3868
|
-
finally { if (
|
|
3830
|
+
finally { if (e_5) throw e_5.error; }
|
|
3869
3831
|
}
|
|
3870
3832
|
}
|
|
3871
3833
|
return [2 /*return*/];
|
|
@@ -3875,9 +3837,9 @@
|
|
|
3875
3837
|
BasicFormComponent.prototype.startAction = function (actionCode) {
|
|
3876
3838
|
return __awaiter(this, void 0, void 0, function () {
|
|
3877
3839
|
var actionObject, clientActionMethods, clientActionPromises, clientActionMethods_1, clientActionMethods_1_1, clientActionMethod, continueActionPromise, clientActionResults, continueAction;
|
|
3878
|
-
var
|
|
3879
|
-
return __generator(this, function (
|
|
3880
|
-
switch (
|
|
3840
|
+
var e_6, _j;
|
|
3841
|
+
return __generator(this, function (_k) {
|
|
3842
|
+
switch (_k.label) {
|
|
3881
3843
|
case 0:
|
|
3882
3844
|
actionObject = this.getAction(actionCode);
|
|
3883
3845
|
if (!actionObject) {
|
|
@@ -3895,22 +3857,22 @@
|
|
|
3895
3857
|
clientActionPromises.push(continueActionPromise);
|
|
3896
3858
|
}
|
|
3897
3859
|
}
|
|
3898
|
-
catch (
|
|
3860
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
3899
3861
|
finally {
|
|
3900
3862
|
try {
|
|
3901
|
-
if (clientActionMethods_1_1 && !clientActionMethods_1_1.done && (
|
|
3863
|
+
if (clientActionMethods_1_1 && !clientActionMethods_1_1.done && (_j = clientActionMethods_1.return)) _j.call(clientActionMethods_1);
|
|
3902
3864
|
}
|
|
3903
|
-
finally { if (
|
|
3865
|
+
finally { if (e_6) throw e_6.error; }
|
|
3904
3866
|
}
|
|
3905
3867
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
3906
3868
|
case 1:
|
|
3907
|
-
clientActionResults =
|
|
3869
|
+
clientActionResults = _k.sent();
|
|
3908
3870
|
continueAction = clientActionResults.reduce(function (total, curr) { return (total && curr); }, true);
|
|
3909
3871
|
if (!continueAction) {
|
|
3910
3872
|
actionObject.stop();
|
|
3911
3873
|
return [2 /*return*/];
|
|
3912
3874
|
}
|
|
3913
|
-
|
|
3875
|
+
_k.label = 2;
|
|
3914
3876
|
case 2:
|
|
3915
3877
|
this.startServerAction(actionObject);
|
|
3916
3878
|
return [2 /*return*/];
|
|
@@ -3921,8 +3883,8 @@
|
|
|
3921
3883
|
BasicFormComponent.prototype.startServerAction = function (actionInput) {
|
|
3922
3884
|
return __awaiter(this, void 0, void 0, function () {
|
|
3923
3885
|
var action, finish, actionResult;
|
|
3924
|
-
return __generator(this, function (
|
|
3925
|
-
switch (
|
|
3886
|
+
return __generator(this, function (_j) {
|
|
3887
|
+
switch (_j.label) {
|
|
3926
3888
|
case 0:
|
|
3927
3889
|
action = (typeof actionInput === 'string')
|
|
3928
3890
|
? this.getAction(actionInput) : actionInput;
|
|
@@ -3931,19 +3893,19 @@
|
|
|
3931
3893
|
if (!action.backend) return [3 /*break*/, 2];
|
|
3932
3894
|
return [4 /*yield*/, this.requestFormAction(action.actionCode)];
|
|
3933
3895
|
case 1:
|
|
3934
|
-
actionResult =
|
|
3896
|
+
actionResult = _j.sent();
|
|
3935
3897
|
finish = !this.errorOccured();
|
|
3936
|
-
|
|
3898
|
+
_j.label = 2;
|
|
3937
3899
|
case 2:
|
|
3938
3900
|
if (!finish) return [3 /*break*/, 4];
|
|
3939
3901
|
return [4 /*yield*/, this.finishAction(action, actionResult)];
|
|
3940
3902
|
case 3:
|
|
3941
|
-
|
|
3903
|
+
_j.sent();
|
|
3942
3904
|
this.changeState(action.newState);
|
|
3943
3905
|
return [3 /*break*/, 5];
|
|
3944
3906
|
case 4:
|
|
3945
3907
|
this.displayActionServerError();
|
|
3946
|
-
|
|
3908
|
+
_j.label = 5;
|
|
3947
3909
|
case 5:
|
|
3948
3910
|
action.stop();
|
|
3949
3911
|
return [2 /*return*/];
|
|
@@ -3954,9 +3916,9 @@
|
|
|
3954
3916
|
BasicFormComponent.prototype.finishAction = function (actionObject, actionResult) {
|
|
3955
3917
|
return __awaiter(this, void 0, void 0, function () {
|
|
3956
3918
|
var finishActionMethods, clientActionPromises, finishActionMethods_1, finishActionMethods_1_1, clientActionMethod;
|
|
3957
|
-
var
|
|
3958
|
-
return __generator(this, function (
|
|
3959
|
-
switch (
|
|
3919
|
+
var e_7, _j;
|
|
3920
|
+
return __generator(this, function (_k) {
|
|
3921
|
+
switch (_k.label) {
|
|
3960
3922
|
case 0:
|
|
3961
3923
|
finishActionMethods = this.formActionsFinish[actionObject.actionCode];
|
|
3962
3924
|
if (!finishActionMethods) return [3 /*break*/, 2];
|
|
@@ -3967,17 +3929,17 @@
|
|
|
3967
3929
|
clientActionPromises.push(clientActionMethod(actionObject, actionResult));
|
|
3968
3930
|
}
|
|
3969
3931
|
}
|
|
3970
|
-
catch (
|
|
3932
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
3971
3933
|
finally {
|
|
3972
3934
|
try {
|
|
3973
|
-
if (finishActionMethods_1_1 && !finishActionMethods_1_1.done && (
|
|
3935
|
+
if (finishActionMethods_1_1 && !finishActionMethods_1_1.done && (_j = finishActionMethods_1.return)) _j.call(finishActionMethods_1);
|
|
3974
3936
|
}
|
|
3975
|
-
finally { if (
|
|
3937
|
+
finally { if (e_7) throw e_7.error; }
|
|
3976
3938
|
}
|
|
3977
3939
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
3978
3940
|
case 1:
|
|
3979
|
-
|
|
3980
|
-
|
|
3941
|
+
_k.sent();
|
|
3942
|
+
_k.label = 2;
|
|
3981
3943
|
case 2: return [2 /*return*/];
|
|
3982
3944
|
}
|
|
3983
3945
|
});
|
|
@@ -4023,9 +3985,9 @@
|
|
|
4023
3985
|
if (intrinsicValidation === void 0) { intrinsicValidation = true; }
|
|
4024
3986
|
return __awaiter(this, void 0, void 0, function () {
|
|
4025
3987
|
var fieldToValidate, validationCallbacks, clientValidationPromises, validationCallbacks_1, validationCallbacks_1_1, validationMethod, continueValidationPromise;
|
|
4026
|
-
var
|
|
4027
|
-
return __generator(this, function (
|
|
4028
|
-
switch (
|
|
3988
|
+
var e_8, _j;
|
|
3989
|
+
return __generator(this, function (_k) {
|
|
3990
|
+
switch (_k.label) {
|
|
4029
3991
|
case 0:
|
|
4030
3992
|
fieldToValidate = this.getFieldObject(fieldCode);
|
|
4031
3993
|
if (!fieldToValidate) {
|
|
@@ -4043,17 +4005,17 @@
|
|
|
4043
4005
|
clientValidationPromises.push(continueValidationPromise);
|
|
4044
4006
|
}
|
|
4045
4007
|
}
|
|
4046
|
-
catch (
|
|
4008
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
4047
4009
|
finally {
|
|
4048
4010
|
try {
|
|
4049
|
-
if (validationCallbacks_1_1 && !validationCallbacks_1_1.done && (
|
|
4011
|
+
if (validationCallbacks_1_1 && !validationCallbacks_1_1.done && (_j = validationCallbacks_1.return)) _j.call(validationCallbacks_1);
|
|
4050
4012
|
}
|
|
4051
|
-
finally { if (
|
|
4013
|
+
finally { if (e_8) throw e_8.error; }
|
|
4052
4014
|
}
|
|
4053
4015
|
return [4 /*yield*/, Promise.all(clientValidationPromises)];
|
|
4054
4016
|
case 1:
|
|
4055
|
-
|
|
4056
|
-
|
|
4017
|
+
_k.sent();
|
|
4018
|
+
_k.label = 2;
|
|
4057
4019
|
case 2: return [2 /*return*/];
|
|
4058
4020
|
}
|
|
4059
4021
|
});
|
|
@@ -4063,9 +4025,9 @@
|
|
|
4063
4025
|
if (intrinsicValidation === void 0) { intrinsicValidation = true; }
|
|
4064
4026
|
return __awaiter(this, void 0, void 0, function () {
|
|
4065
4027
|
var fieldToValidate, validationCallbacks, clientValidationPromises, validationCallbacks_2, validationCallbacks_2_1, validationMethod, clientValidationPromise, clientValidationResults, continueValidation;
|
|
4066
|
-
var
|
|
4067
|
-
return __generator(this, function (
|
|
4068
|
-
switch (
|
|
4028
|
+
var e_9, _j;
|
|
4029
|
+
return __generator(this, function (_k) {
|
|
4030
|
+
switch (_k.label) {
|
|
4069
4031
|
case 0:
|
|
4070
4032
|
fieldToValidate = this.getField(fieldCode);
|
|
4071
4033
|
if (!fieldToValidate || !intrinsicValidation) {
|
|
@@ -4083,21 +4045,21 @@
|
|
|
4083
4045
|
clientValidationPromises.push(clientValidationPromise);
|
|
4084
4046
|
}
|
|
4085
4047
|
}
|
|
4086
|
-
catch (
|
|
4048
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
4087
4049
|
finally {
|
|
4088
4050
|
try {
|
|
4089
|
-
if (validationCallbacks_2_1 && !validationCallbacks_2_1.done && (
|
|
4051
|
+
if (validationCallbacks_2_1 && !validationCallbacks_2_1.done && (_j = validationCallbacks_2.return)) _j.call(validationCallbacks_2);
|
|
4090
4052
|
}
|
|
4091
|
-
finally { if (
|
|
4053
|
+
finally { if (e_9) throw e_9.error; }
|
|
4092
4054
|
}
|
|
4093
4055
|
return [4 /*yield*/, Promise.all(clientValidationPromises)];
|
|
4094
4056
|
case 1:
|
|
4095
|
-
clientValidationResults =
|
|
4057
|
+
clientValidationResults = _k.sent();
|
|
4096
4058
|
continueValidation = clientValidationResults.reduce(function (total, curr) { return (total && curr); }, true);
|
|
4097
4059
|
if (!continueValidation) {
|
|
4098
4060
|
return [2 /*return*/];
|
|
4099
4061
|
}
|
|
4100
|
-
|
|
4062
|
+
_k.label = 2;
|
|
4101
4063
|
case 2:
|
|
4102
4064
|
this.startServerFieldValidation(fieldToValidate);
|
|
4103
4065
|
return [2 /*return*/];
|
|
@@ -4108,8 +4070,8 @@
|
|
|
4108
4070
|
BasicFormComponent.prototype.startServerFieldValidation = function (inputField) {
|
|
4109
4071
|
return __awaiter(this, void 0, void 0, function () {
|
|
4110
4072
|
var fieldObj, finish, validationResult;
|
|
4111
|
-
return __generator(this, function (
|
|
4112
|
-
switch (
|
|
4073
|
+
return __generator(this, function (_j) {
|
|
4074
|
+
switch (_j.label) {
|
|
4113
4075
|
case 0:
|
|
4114
4076
|
fieldObj = (typeof inputField === 'string')
|
|
4115
4077
|
? this.getField(inputField) : inputField;
|
|
@@ -4118,22 +4080,22 @@
|
|
|
4118
4080
|
if (!fieldObj.backend) return [3 /*break*/, 2];
|
|
4119
4081
|
fieldObj.validating = true;
|
|
4120
4082
|
return [4 /*yield*/, this
|
|
4121
|
-
.requestFormAction(
|
|
4083
|
+
.requestFormAction(formActions.validate, fieldObj.fieldCode)];
|
|
4122
4084
|
case 1:
|
|
4123
|
-
validationResult =
|
|
4085
|
+
validationResult = _j.sent();
|
|
4124
4086
|
finish = !this.errorOccured();
|
|
4125
|
-
|
|
4087
|
+
_j.label = 2;
|
|
4126
4088
|
case 2:
|
|
4127
4089
|
if (!finish) return [3 /*break*/, 4];
|
|
4128
4090
|
return [4 /*yield*/, this.finishFieldValidation(fieldObj, validationResult)];
|
|
4129
4091
|
case 3:
|
|
4130
|
-
|
|
4092
|
+
_j.sent();
|
|
4131
4093
|
return [3 /*break*/, 5];
|
|
4132
4094
|
case 4:
|
|
4133
4095
|
fieldObj.setErrorCode(this.errorCode);
|
|
4134
4096
|
fieldObj.setErrorMessage(this.errorMessage);
|
|
4135
4097
|
this.displayValidationServerError();
|
|
4136
|
-
|
|
4098
|
+
_j.label = 5;
|
|
4137
4099
|
case 5:
|
|
4138
4100
|
fieldObj.validating = false;
|
|
4139
4101
|
return [2 /*return*/];
|
|
@@ -4144,9 +4106,9 @@
|
|
|
4144
4106
|
BasicFormComponent.prototype.finishFieldValidation = function (fieldObject, validationResult) {
|
|
4145
4107
|
return __awaiter(this, void 0, void 0, function () {
|
|
4146
4108
|
var validationCallbacks, clientActionPromises, validationCallbacks_3, validationCallbacks_3_1, validationMethod;
|
|
4147
|
-
var
|
|
4148
|
-
return __generator(this, function (
|
|
4149
|
-
switch (
|
|
4109
|
+
var e_10, _j;
|
|
4110
|
+
return __generator(this, function (_k) {
|
|
4111
|
+
switch (_k.label) {
|
|
4150
4112
|
case 0:
|
|
4151
4113
|
validationCallbacks = this.fieldValidationsFinish[fieldObject.fieldCode];
|
|
4152
4114
|
if (!validationCallbacks) return [3 /*break*/, 2];
|
|
@@ -4157,17 +4119,17 @@
|
|
|
4157
4119
|
clientActionPromises.push(validationMethod(fieldObject, validationResult));
|
|
4158
4120
|
}
|
|
4159
4121
|
}
|
|
4160
|
-
catch (
|
|
4122
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
4161
4123
|
finally {
|
|
4162
4124
|
try {
|
|
4163
|
-
if (validationCallbacks_3_1 && !validationCallbacks_3_1.done && (
|
|
4125
|
+
if (validationCallbacks_3_1 && !validationCallbacks_3_1.done && (_j = validationCallbacks_3.return)) _j.call(validationCallbacks_3);
|
|
4164
4126
|
}
|
|
4165
|
-
finally { if (
|
|
4127
|
+
finally { if (e_10) throw e_10.error; }
|
|
4166
4128
|
}
|
|
4167
4129
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4168
4130
|
case 1:
|
|
4169
|
-
|
|
4170
|
-
|
|
4131
|
+
_k.sent();
|
|
4132
|
+
_k.label = 2;
|
|
4171
4133
|
case 2: return [2 /*return*/];
|
|
4172
4134
|
}
|
|
4173
4135
|
});
|
|
@@ -4175,7 +4137,7 @@
|
|
|
4175
4137
|
};
|
|
4176
4138
|
BasicFormComponent.prototype.continueFieldValidation = function (fieldCode) {
|
|
4177
4139
|
return __awaiter(this, void 0, void 0, function () {
|
|
4178
|
-
return __generator(this, function (
|
|
4140
|
+
return __generator(this, function (_j) {
|
|
4179
4141
|
return [2 /*return*/, this.startServerFieldValidation(fieldCode)];
|
|
4180
4142
|
});
|
|
4181
4143
|
});
|
|
@@ -4290,9 +4252,9 @@
|
|
|
4290
4252
|
BasicFormComponent.prototype.startTableGlobalAction = function (tableActionEvent) {
|
|
4291
4253
|
return __awaiter(this, void 0, void 0, function () {
|
|
4292
4254
|
var tableCode, actionCode, tableObject, action, tableActionDetail, tableEventHandlers, tableActionMethods, clientActionPromises, tableActionMethods_1, tableActionMethods_1_1, tableActionMethod, clientActionPromise, clientActionResults, continueAction;
|
|
4293
|
-
var
|
|
4294
|
-
return __generator(this, function (
|
|
4295
|
-
switch (
|
|
4255
|
+
var e_11, _j;
|
|
4256
|
+
return __generator(this, function (_k) {
|
|
4257
|
+
switch (_k.label) {
|
|
4296
4258
|
case 0:
|
|
4297
4259
|
tableCode = tableActionEvent.tableCode, actionCode = tableActionEvent.actionCode;
|
|
4298
4260
|
tableObject = this.getTable(tableCode);
|
|
@@ -4321,21 +4283,21 @@
|
|
|
4321
4283
|
clientActionPromises.push(clientActionPromise);
|
|
4322
4284
|
}
|
|
4323
4285
|
}
|
|
4324
|
-
catch (
|
|
4286
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
4325
4287
|
finally {
|
|
4326
4288
|
try {
|
|
4327
|
-
if (tableActionMethods_1_1 && !tableActionMethods_1_1.done && (
|
|
4289
|
+
if (tableActionMethods_1_1 && !tableActionMethods_1_1.done && (_j = tableActionMethods_1.return)) _j.call(tableActionMethods_1);
|
|
4328
4290
|
}
|
|
4329
|
-
finally { if (
|
|
4291
|
+
finally { if (e_11) throw e_11.error; }
|
|
4330
4292
|
}
|
|
4331
4293
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4332
4294
|
case 1:
|
|
4333
|
-
clientActionResults =
|
|
4295
|
+
clientActionResults = _k.sent();
|
|
4334
4296
|
continueAction = clientActionResults.reduce(function (total, curr) { return (total && curr); }, true);
|
|
4335
4297
|
if (!continueAction) {
|
|
4336
4298
|
return [2 /*return*/];
|
|
4337
4299
|
}
|
|
4338
|
-
|
|
4300
|
+
_k.label = 2;
|
|
4339
4301
|
case 2:
|
|
4340
4302
|
this.startTableServerGlobalAction(tableActionDetail);
|
|
4341
4303
|
return [2 /*return*/];
|
|
@@ -4346,8 +4308,8 @@
|
|
|
4346
4308
|
BasicFormComponent.prototype.startTableServerGlobalAction = function (tableActionDetail) {
|
|
4347
4309
|
return __awaiter(this, void 0, void 0, function () {
|
|
4348
4310
|
var tableObject, action, tableCode, actionCode, finish, actionResult, actionSubject;
|
|
4349
|
-
return __generator(this, function (
|
|
4350
|
-
switch (
|
|
4311
|
+
return __generator(this, function (_j) {
|
|
4312
|
+
switch (_j.label) {
|
|
4351
4313
|
case 0:
|
|
4352
4314
|
tableObject = tableActionDetail.tableObject, action = tableActionDetail.action, tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode;
|
|
4353
4315
|
if (!tableObject || !action) {
|
|
@@ -4363,21 +4325,21 @@
|
|
|
4363
4325
|
actionCode: actionCode
|
|
4364
4326
|
};
|
|
4365
4327
|
return [4 /*yield*/, this
|
|
4366
|
-
.requestFormAction(
|
|
4328
|
+
.requestFormAction(formActions.tableAction, actionSubject)];
|
|
4367
4329
|
case 1:
|
|
4368
|
-
actionResult =
|
|
4330
|
+
actionResult = _j.sent();
|
|
4369
4331
|
finish = !this.errorOccured();
|
|
4370
|
-
|
|
4332
|
+
_j.label = 2;
|
|
4371
4333
|
case 2:
|
|
4372
4334
|
if (!finish) return [3 /*break*/, 4];
|
|
4373
4335
|
return [4 /*yield*/, this.finishTableGlobalAction(tableActionDetail, actionResult)];
|
|
4374
4336
|
case 3:
|
|
4375
|
-
|
|
4337
|
+
_j.sent();
|
|
4376
4338
|
this.changeState(action.newState);
|
|
4377
4339
|
return [3 /*break*/, 5];
|
|
4378
4340
|
case 4:
|
|
4379
4341
|
this.displayTableServerError();
|
|
4380
|
-
|
|
4342
|
+
_j.label = 5;
|
|
4381
4343
|
case 5:
|
|
4382
4344
|
tableObject.freeWaiting();
|
|
4383
4345
|
return [2 /*return*/];
|
|
@@ -4388,9 +4350,9 @@
|
|
|
4388
4350
|
BasicFormComponent.prototype.finishTableGlobalAction = function (tableActionDetail, actionResult) {
|
|
4389
4351
|
return __awaiter(this, void 0, void 0, function () {
|
|
4390
4352
|
var tableCode, actionCode, tableEventHandlers, tableActionMethods, clientActionPromises, tableActionMethods_2, tableActionMethods_2_1, tableActionMethod;
|
|
4391
|
-
var
|
|
4392
|
-
return __generator(this, function (
|
|
4393
|
-
switch (
|
|
4353
|
+
var e_12, _j;
|
|
4354
|
+
return __generator(this, function (_k) {
|
|
4355
|
+
switch (_k.label) {
|
|
4394
4356
|
case 0:
|
|
4395
4357
|
tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode;
|
|
4396
4358
|
tableEventHandlers = this.tableActionsFinish[tableCode];
|
|
@@ -4403,17 +4365,17 @@
|
|
|
4403
4365
|
clientActionPromises.push(tableActionMethod(tableActionDetail, actionResult));
|
|
4404
4366
|
}
|
|
4405
4367
|
}
|
|
4406
|
-
catch (
|
|
4368
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
4407
4369
|
finally {
|
|
4408
4370
|
try {
|
|
4409
|
-
if (tableActionMethods_2_1 && !tableActionMethods_2_1.done && (
|
|
4371
|
+
if (tableActionMethods_2_1 && !tableActionMethods_2_1.done && (_j = tableActionMethods_2.return)) _j.call(tableActionMethods_2);
|
|
4410
4372
|
}
|
|
4411
|
-
finally { if (
|
|
4373
|
+
finally { if (e_12) throw e_12.error; }
|
|
4412
4374
|
}
|
|
4413
4375
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4414
4376
|
case 1:
|
|
4415
|
-
|
|
4416
|
-
|
|
4377
|
+
_k.sent();
|
|
4378
|
+
_k.label = 2;
|
|
4417
4379
|
case 2: return [2 /*return*/];
|
|
4418
4380
|
}
|
|
4419
4381
|
});
|
|
@@ -4422,9 +4384,9 @@
|
|
|
4422
4384
|
BasicFormComponent.prototype.startTableAction = function (tableActionEvent) {
|
|
4423
4385
|
return __awaiter(this, void 0, void 0, function () {
|
|
4424
4386
|
var tableCode, actionCode, actionDetail, tableObject, recordId, recordData, action, tableActionDetail, tableEventHandlers, tableActionMethods, clientActionPromises, tableActionMethods_3, tableActionMethods_3_1, tableActionMethod, clientActionPromise, clientActionResults, continueAction;
|
|
4425
|
-
var
|
|
4426
|
-
return __generator(this, function (
|
|
4427
|
-
switch (
|
|
4387
|
+
var e_13, _j;
|
|
4388
|
+
return __generator(this, function (_k) {
|
|
4389
|
+
switch (_k.label) {
|
|
4428
4390
|
case 0:
|
|
4429
4391
|
tableCode = tableActionEvent.tableCode, actionCode = tableActionEvent.actionCode, actionDetail = tableActionEvent.actionDetail;
|
|
4430
4392
|
tableObject = this.getTable(tableCode);
|
|
@@ -4456,21 +4418,21 @@
|
|
|
4456
4418
|
clientActionPromises.push(clientActionPromise);
|
|
4457
4419
|
}
|
|
4458
4420
|
}
|
|
4459
|
-
catch (
|
|
4421
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
4460
4422
|
finally {
|
|
4461
4423
|
try {
|
|
4462
|
-
if (tableActionMethods_3_1 && !tableActionMethods_3_1.done && (
|
|
4424
|
+
if (tableActionMethods_3_1 && !tableActionMethods_3_1.done && (_j = tableActionMethods_3.return)) _j.call(tableActionMethods_3);
|
|
4463
4425
|
}
|
|
4464
|
-
finally { if (
|
|
4426
|
+
finally { if (e_13) throw e_13.error; }
|
|
4465
4427
|
}
|
|
4466
4428
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4467
4429
|
case 1:
|
|
4468
|
-
clientActionResults =
|
|
4430
|
+
clientActionResults = _k.sent();
|
|
4469
4431
|
continueAction = clientActionResults.reduce(function (total, curr) { return (total && curr); }, true);
|
|
4470
4432
|
if (!continueAction) {
|
|
4471
4433
|
return [2 /*return*/];
|
|
4472
4434
|
}
|
|
4473
|
-
|
|
4435
|
+
_k.label = 2;
|
|
4474
4436
|
case 2:
|
|
4475
4437
|
this.startTableServerAction(tableActionDetail);
|
|
4476
4438
|
return [2 /*return*/];
|
|
@@ -4481,8 +4443,8 @@
|
|
|
4481
4443
|
BasicFormComponent.prototype.startTableServerAction = function (tableActionDetail) {
|
|
4482
4444
|
return __awaiter(this, void 0, void 0, function () {
|
|
4483
4445
|
var tableObject, action, tableCode, actionCode, recordId, recordData, finish, actionResult, actionSubject;
|
|
4484
|
-
return __generator(this, function (
|
|
4485
|
-
switch (
|
|
4446
|
+
return __generator(this, function (_j) {
|
|
4447
|
+
switch (_j.label) {
|
|
4486
4448
|
case 0:
|
|
4487
4449
|
tableObject = tableActionDetail.tableObject, action = tableActionDetail.action, tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode, recordId = tableActionDetail.recordId, recordData = tableActionDetail.recordData;
|
|
4488
4450
|
if (!tableObject || !action) {
|
|
@@ -4494,17 +4456,17 @@
|
|
|
4494
4456
|
if (!action.backend) return [3 /*break*/, 2];
|
|
4495
4457
|
actionSubject = {
|
|
4496
4458
|
tableCode: tableCode,
|
|
4497
|
-
actionType:
|
|
4459
|
+
actionType: this.formConfig.tableActions.inline,
|
|
4498
4460
|
actionCode: actionCode,
|
|
4499
4461
|
tableRecordId: recordId,
|
|
4500
4462
|
tableRecordData: recordData
|
|
4501
4463
|
};
|
|
4502
4464
|
return [4 /*yield*/, this
|
|
4503
|
-
.requestFormAction(
|
|
4465
|
+
.requestFormAction(formActions.tableAction, actionSubject)];
|
|
4504
4466
|
case 1:
|
|
4505
|
-
actionResult =
|
|
4467
|
+
actionResult = _j.sent();
|
|
4506
4468
|
finish = !this.errorOccured();
|
|
4507
|
-
|
|
4469
|
+
_j.label = 2;
|
|
4508
4470
|
case 2:
|
|
4509
4471
|
if (finish) {
|
|
4510
4472
|
this.finishTableAction(tableActionDetail, actionResult);
|
|
@@ -4525,9 +4487,9 @@
|
|
|
4525
4487
|
BasicFormComponent.prototype.finishTableAction = function (tableActionDetail, actionResult) {
|
|
4526
4488
|
return __awaiter(this, void 0, void 0, function () {
|
|
4527
4489
|
var tableCode, actionCode, tableEventHandlers, tableActionMethods, clientActionPromises, tableActionMethods_4, tableActionMethods_4_1, tableActionMethod;
|
|
4528
|
-
var
|
|
4529
|
-
return __generator(this, function (
|
|
4530
|
-
switch (
|
|
4490
|
+
var e_14, _j;
|
|
4491
|
+
return __generator(this, function (_k) {
|
|
4492
|
+
switch (_k.label) {
|
|
4531
4493
|
case 0:
|
|
4532
4494
|
tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode;
|
|
4533
4495
|
tableEventHandlers = this.tableActionsFinish[tableCode];
|
|
@@ -4540,17 +4502,17 @@
|
|
|
4540
4502
|
clientActionPromises.push(tableActionMethod(tableActionDetail, actionResult));
|
|
4541
4503
|
}
|
|
4542
4504
|
}
|
|
4543
|
-
catch (
|
|
4505
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
4544
4506
|
finally {
|
|
4545
4507
|
try {
|
|
4546
|
-
if (tableActionMethods_4_1 && !tableActionMethods_4_1.done && (
|
|
4508
|
+
if (tableActionMethods_4_1 && !tableActionMethods_4_1.done && (_j = tableActionMethods_4.return)) _j.call(tableActionMethods_4);
|
|
4547
4509
|
}
|
|
4548
|
-
finally { if (
|
|
4510
|
+
finally { if (e_14) throw e_14.error; }
|
|
4549
4511
|
}
|
|
4550
4512
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4551
4513
|
case 1:
|
|
4552
|
-
|
|
4553
|
-
|
|
4514
|
+
_k.sent();
|
|
4515
|
+
_k.label = 2;
|
|
4554
4516
|
case 2: return [2 /*return*/];
|
|
4555
4517
|
}
|
|
4556
4518
|
});
|
|
@@ -4559,9 +4521,9 @@
|
|
|
4559
4521
|
BasicFormComponent.prototype.startTableRecordSelection = function (tableActionEvent) {
|
|
4560
4522
|
return __awaiter(this, void 0, void 0, function () {
|
|
4561
4523
|
var tableCode, actionDetail, tableObject, recordId, recordData, tableSelectionDetail, tableEventHandlers, clientActionPromises, tableEventHandlers_1, tableEventHandlers_1_1, tableSelectionMethod, clientActionPromise, clientActionResults, continueAction;
|
|
4562
|
-
var
|
|
4563
|
-
return __generator(this, function (
|
|
4564
|
-
switch (
|
|
4524
|
+
var e_15, _j;
|
|
4525
|
+
return __generator(this, function (_k) {
|
|
4526
|
+
switch (_k.label) {
|
|
4565
4527
|
case 0:
|
|
4566
4528
|
tableCode = tableActionEvent.tableCode, actionDetail = tableActionEvent.actionDetail;
|
|
4567
4529
|
tableObject = this.getTable(tableCode);
|
|
@@ -4586,21 +4548,21 @@
|
|
|
4586
4548
|
clientActionPromises.push(clientActionPromise);
|
|
4587
4549
|
}
|
|
4588
4550
|
}
|
|
4589
|
-
catch (
|
|
4551
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
4590
4552
|
finally {
|
|
4591
4553
|
try {
|
|
4592
|
-
if (tableEventHandlers_1_1 && !tableEventHandlers_1_1.done && (
|
|
4554
|
+
if (tableEventHandlers_1_1 && !tableEventHandlers_1_1.done && (_j = tableEventHandlers_1.return)) _j.call(tableEventHandlers_1);
|
|
4593
4555
|
}
|
|
4594
|
-
finally { if (
|
|
4556
|
+
finally { if (e_15) throw e_15.error; }
|
|
4595
4557
|
}
|
|
4596
4558
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4597
4559
|
case 1:
|
|
4598
|
-
clientActionResults =
|
|
4560
|
+
clientActionResults = _k.sent();
|
|
4599
4561
|
continueAction = clientActionResults.reduce(function (total, curr) { return (total && curr); }, true);
|
|
4600
4562
|
if (!continueAction) {
|
|
4601
4563
|
return [2 /*return*/];
|
|
4602
4564
|
}
|
|
4603
|
-
|
|
4565
|
+
_k.label = 2;
|
|
4604
4566
|
case 2:
|
|
4605
4567
|
this.startTableServerRecordSelection(tableSelectionDetail);
|
|
4606
4568
|
return [2 /*return*/];
|
|
@@ -4611,8 +4573,8 @@
|
|
|
4611
4573
|
BasicFormComponent.prototype.startTableServerRecordSelection = function (tableSelectionDetail) {
|
|
4612
4574
|
return __awaiter(this, void 0, void 0, function () {
|
|
4613
4575
|
var tableObject, tableCode, recordId, recordData, finish, actionResult, actionSubject;
|
|
4614
|
-
return __generator(this, function (
|
|
4615
|
-
switch (
|
|
4576
|
+
return __generator(this, function (_j) {
|
|
4577
|
+
switch (_j.label) {
|
|
4616
4578
|
case 0:
|
|
4617
4579
|
tableObject = tableSelectionDetail.tableObject, tableCode = tableSelectionDetail.tableCode, recordId = tableSelectionDetail.recordId, recordData = tableSelectionDetail.recordData;
|
|
4618
4580
|
if (!tableObject) {
|
|
@@ -4624,17 +4586,17 @@
|
|
|
4624
4586
|
if (!tableObject.selectionBackend) return [3 /*break*/, 2];
|
|
4625
4587
|
actionSubject = {
|
|
4626
4588
|
tableCode: tableCode,
|
|
4627
|
-
actionType:
|
|
4589
|
+
actionType: this.formConfig.tableActions.rowSelection,
|
|
4628
4590
|
actionCode: null,
|
|
4629
4591
|
tableRecordId: recordId,
|
|
4630
4592
|
tableRecordData: recordData
|
|
4631
4593
|
};
|
|
4632
4594
|
return [4 /*yield*/, this
|
|
4633
|
-
.requestFormAction(
|
|
4595
|
+
.requestFormAction(formActions.tableAction, actionSubject)];
|
|
4634
4596
|
case 1:
|
|
4635
|
-
actionResult =
|
|
4597
|
+
actionResult = _j.sent();
|
|
4636
4598
|
finish = !this.errorOccured();
|
|
4637
|
-
|
|
4599
|
+
_j.label = 2;
|
|
4638
4600
|
case 2:
|
|
4639
4601
|
if (finish) {
|
|
4640
4602
|
this.finishTableRecordSelection(tableSelectionDetail, actionResult);
|
|
@@ -4651,9 +4613,9 @@
|
|
|
4651
4613
|
BasicFormComponent.prototype.finishTableRecordSelection = function (tableSelectionDetail, actionResult) {
|
|
4652
4614
|
return __awaiter(this, void 0, void 0, function () {
|
|
4653
4615
|
var tableCode, tableEventHandlers, clientActionPromises, tableEventHandlers_2, tableEventHandlers_2_1, tableSelectionMethod;
|
|
4654
|
-
var
|
|
4655
|
-
return __generator(this, function (
|
|
4656
|
-
switch (
|
|
4616
|
+
var e_16, _j;
|
|
4617
|
+
return __generator(this, function (_k) {
|
|
4618
|
+
switch (_k.label) {
|
|
4657
4619
|
case 0:
|
|
4658
4620
|
tableCode = tableSelectionDetail.tableCode;
|
|
4659
4621
|
tableEventHandlers = this.tableSelectionsFinish[tableCode];
|
|
@@ -4665,17 +4627,17 @@
|
|
|
4665
4627
|
clientActionPromises.push(tableSelectionMethod(tableSelectionDetail, actionResult));
|
|
4666
4628
|
}
|
|
4667
4629
|
}
|
|
4668
|
-
catch (
|
|
4630
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
4669
4631
|
finally {
|
|
4670
4632
|
try {
|
|
4671
|
-
if (tableEventHandlers_2_1 && !tableEventHandlers_2_1.done && (
|
|
4633
|
+
if (tableEventHandlers_2_1 && !tableEventHandlers_2_1.done && (_j = tableEventHandlers_2.return)) _j.call(tableEventHandlers_2);
|
|
4672
4634
|
}
|
|
4673
|
-
finally { if (
|
|
4635
|
+
finally { if (e_16) throw e_16.error; }
|
|
4674
4636
|
}
|
|
4675
4637
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4676
4638
|
case 1:
|
|
4677
|
-
|
|
4678
|
-
|
|
4639
|
+
_k.sent();
|
|
4640
|
+
_k.label = 2;
|
|
4679
4641
|
case 2: return [2 /*return*/];
|
|
4680
4642
|
}
|
|
4681
4643
|
});
|
|
@@ -4684,9 +4646,9 @@
|
|
|
4684
4646
|
BasicFormComponent.prototype.startTableSelectionAction = function (tableActionEvent) {
|
|
4685
4647
|
return __awaiter(this, void 0, void 0, function () {
|
|
4686
4648
|
var tableCode, actionCode, actionDetail, tableObject, selectedRecords, action, tableActionDetail, tableEventHandlers, tableActionMethods, clientActionPromises, tableActionMethods_5, tableActionMethods_5_1, tableActionMethod, clientActionPromise, clientActionResults, continueAction;
|
|
4687
|
-
var
|
|
4688
|
-
return __generator(this, function (
|
|
4689
|
-
switch (
|
|
4649
|
+
var e_17, _j;
|
|
4650
|
+
return __generator(this, function (_k) {
|
|
4651
|
+
switch (_k.label) {
|
|
4690
4652
|
case 0:
|
|
4691
4653
|
tableCode = tableActionEvent.tableCode, actionCode = tableActionEvent.actionCode, actionDetail = tableActionEvent.actionDetail;
|
|
4692
4654
|
tableObject = this.getTable(tableCode);
|
|
@@ -4717,21 +4679,21 @@
|
|
|
4717
4679
|
clientActionPromises.push(clientActionPromise);
|
|
4718
4680
|
}
|
|
4719
4681
|
}
|
|
4720
|
-
catch (
|
|
4682
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
4721
4683
|
finally {
|
|
4722
4684
|
try {
|
|
4723
|
-
if (tableActionMethods_5_1 && !tableActionMethods_5_1.done && (
|
|
4685
|
+
if (tableActionMethods_5_1 && !tableActionMethods_5_1.done && (_j = tableActionMethods_5.return)) _j.call(tableActionMethods_5);
|
|
4724
4686
|
}
|
|
4725
|
-
finally { if (
|
|
4687
|
+
finally { if (e_17) throw e_17.error; }
|
|
4726
4688
|
}
|
|
4727
4689
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4728
4690
|
case 1:
|
|
4729
|
-
clientActionResults =
|
|
4691
|
+
clientActionResults = _k.sent();
|
|
4730
4692
|
continueAction = clientActionResults.reduce(function (total, curr) { return (total && curr); }, true);
|
|
4731
4693
|
if (!continueAction) {
|
|
4732
4694
|
return [2 /*return*/];
|
|
4733
4695
|
}
|
|
4734
|
-
|
|
4696
|
+
_k.label = 2;
|
|
4735
4697
|
case 2:
|
|
4736
4698
|
this.startTableServerSelectionAction(tableActionDetail);
|
|
4737
4699
|
return [2 /*return*/];
|
|
@@ -4742,8 +4704,8 @@
|
|
|
4742
4704
|
BasicFormComponent.prototype.startTableServerSelectionAction = function (tableActionDetail) {
|
|
4743
4705
|
return __awaiter(this, void 0, void 0, function () {
|
|
4744
4706
|
var tableObject, action, tableCode, actionCode, selectedRecords, finish, actionResult, actionSubject;
|
|
4745
|
-
return __generator(this, function (
|
|
4746
|
-
switch (
|
|
4707
|
+
return __generator(this, function (_j) {
|
|
4708
|
+
switch (_j.label) {
|
|
4747
4709
|
case 0:
|
|
4748
4710
|
tableObject = tableActionDetail.tableObject, action = tableActionDetail.action, tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode, selectedRecords = tableActionDetail.selectedRecords;
|
|
4749
4711
|
if (!tableObject || !action) {
|
|
@@ -4755,16 +4717,16 @@
|
|
|
4755
4717
|
if (!action.backend) return [3 /*break*/, 2];
|
|
4756
4718
|
actionSubject = {
|
|
4757
4719
|
tableCode: tableCode,
|
|
4758
|
-
actionType:
|
|
4720
|
+
actionType: this.formConfig.tableActions.selection,
|
|
4759
4721
|
actionCode: actionCode,
|
|
4760
4722
|
selectedRecords: selectedRecords
|
|
4761
4723
|
};
|
|
4762
4724
|
return [4 /*yield*/, this
|
|
4763
|
-
.requestFormAction(
|
|
4725
|
+
.requestFormAction(formActions.tableAction, actionSubject)];
|
|
4764
4726
|
case 1:
|
|
4765
|
-
actionResult =
|
|
4727
|
+
actionResult = _j.sent();
|
|
4766
4728
|
finish = !this.errorOccured();
|
|
4767
|
-
|
|
4729
|
+
_j.label = 2;
|
|
4768
4730
|
case 2:
|
|
4769
4731
|
if (finish) {
|
|
4770
4732
|
this.finishTableSelectionAction(tableActionDetail, actionResult);
|
|
@@ -4782,9 +4744,9 @@
|
|
|
4782
4744
|
BasicFormComponent.prototype.finishTableSelectionAction = function (tableActionDetail, actionResult) {
|
|
4783
4745
|
return __awaiter(this, void 0, void 0, function () {
|
|
4784
4746
|
var tableCode, actionCode, tableEventHandlers, tableActionMethods, clientActionPromises, tableActionMethods_6, tableActionMethods_6_1, tableActionMethod;
|
|
4785
|
-
var
|
|
4786
|
-
return __generator(this, function (
|
|
4787
|
-
switch (
|
|
4747
|
+
var e_18, _j;
|
|
4748
|
+
return __generator(this, function (_k) {
|
|
4749
|
+
switch (_k.label) {
|
|
4788
4750
|
case 0:
|
|
4789
4751
|
tableCode = tableActionDetail.tableCode, actionCode = tableActionDetail.actionCode;
|
|
4790
4752
|
tableEventHandlers = this.tableActionsFinish[tableCode];
|
|
@@ -4797,17 +4759,17 @@
|
|
|
4797
4759
|
clientActionPromises.push(tableActionMethod(tableActionDetail, actionResult));
|
|
4798
4760
|
}
|
|
4799
4761
|
}
|
|
4800
|
-
catch (
|
|
4762
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
4801
4763
|
finally {
|
|
4802
4764
|
try {
|
|
4803
|
-
if (tableActionMethods_6_1 && !tableActionMethods_6_1.done && (
|
|
4765
|
+
if (tableActionMethods_6_1 && !tableActionMethods_6_1.done && (_j = tableActionMethods_6.return)) _j.call(tableActionMethods_6);
|
|
4804
4766
|
}
|
|
4805
|
-
finally { if (
|
|
4767
|
+
finally { if (e_18) throw e_18.error; }
|
|
4806
4768
|
}
|
|
4807
4769
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4808
4770
|
case 1:
|
|
4809
|
-
|
|
4810
|
-
|
|
4771
|
+
_k.sent();
|
|
4772
|
+
_k.label = 2;
|
|
4811
4773
|
case 2: return [2 /*return*/];
|
|
4812
4774
|
}
|
|
4813
4775
|
});
|
|
@@ -4816,9 +4778,9 @@
|
|
|
4816
4778
|
BasicFormComponent.prototype.startTableGetData = function (tableActionEvent) {
|
|
4817
4779
|
return __awaiter(this, void 0, void 0, function () {
|
|
4818
4780
|
var tableCode, tableObject, tableActionDetail, tableEventHandlers, clientActionPromises, tableEventHandlers_3, tableEventHandlers_3_1, tableActionMethod, clientActionPromise, clientActionResults, continueAction;
|
|
4819
|
-
var
|
|
4820
|
-
return __generator(this, function (
|
|
4821
|
-
switch (
|
|
4781
|
+
var e_19, _j;
|
|
4782
|
+
return __generator(this, function (_k) {
|
|
4783
|
+
switch (_k.label) {
|
|
4822
4784
|
case 0:
|
|
4823
4785
|
tableCode = tableActionEvent.tableCode;
|
|
4824
4786
|
tableObject = this.getTable(tableCode);
|
|
@@ -4837,21 +4799,21 @@
|
|
|
4837
4799
|
clientActionPromises.push(clientActionPromise);
|
|
4838
4800
|
}
|
|
4839
4801
|
}
|
|
4840
|
-
catch (
|
|
4802
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
4841
4803
|
finally {
|
|
4842
4804
|
try {
|
|
4843
|
-
if (tableEventHandlers_3_1 && !tableEventHandlers_3_1.done && (
|
|
4805
|
+
if (tableEventHandlers_3_1 && !tableEventHandlers_3_1.done && (_j = tableEventHandlers_3.return)) _j.call(tableEventHandlers_3);
|
|
4844
4806
|
}
|
|
4845
|
-
finally { if (
|
|
4807
|
+
finally { if (e_19) throw e_19.error; }
|
|
4846
4808
|
}
|
|
4847
4809
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4848
4810
|
case 1:
|
|
4849
|
-
clientActionResults =
|
|
4811
|
+
clientActionResults = _k.sent();
|
|
4850
4812
|
continueAction = clientActionResults.reduce(function (total, curr) { return (total && curr); }, true);
|
|
4851
4813
|
if (!continueAction) {
|
|
4852
4814
|
return [2 /*return*/];
|
|
4853
4815
|
}
|
|
4854
|
-
|
|
4816
|
+
_k.label = 2;
|
|
4855
4817
|
case 2:
|
|
4856
4818
|
this.startTableServerGetData(tableActionDetail);
|
|
4857
4819
|
return [2 /*return*/];
|
|
@@ -4862,16 +4824,16 @@
|
|
|
4862
4824
|
BasicFormComponent.prototype.startTableServerGetData = function (tableActionDetail) {
|
|
4863
4825
|
return __awaiter(this, void 0, void 0, function () {
|
|
4864
4826
|
var tableObject, tableCode, actionSubject, actionResult;
|
|
4865
|
-
return __generator(this, function (
|
|
4866
|
-
switch (
|
|
4827
|
+
return __generator(this, function (_j) {
|
|
4828
|
+
switch (_j.label) {
|
|
4867
4829
|
case 0:
|
|
4868
4830
|
tableObject = tableActionDetail.tableObject, tableCode = tableActionDetail.tableCode;
|
|
4869
4831
|
tableObject.putOnWait();
|
|
4870
4832
|
actionSubject = { tableCode: tableCode };
|
|
4871
4833
|
return [4 /*yield*/, this
|
|
4872
|
-
.requestFormAction(
|
|
4834
|
+
.requestFormAction(formActions.getTableData, actionSubject)];
|
|
4873
4835
|
case 1:
|
|
4874
|
-
actionResult =
|
|
4836
|
+
actionResult = _j.sent();
|
|
4875
4837
|
if (this.errorOccured()) {
|
|
4876
4838
|
this.displayTableServerError();
|
|
4877
4839
|
}
|
|
@@ -4887,9 +4849,9 @@
|
|
|
4887
4849
|
BasicFormComponent.prototype.finishTableGetData = function (tableActionDetail, actionResult) {
|
|
4888
4850
|
return __awaiter(this, void 0, void 0, function () {
|
|
4889
4851
|
var tableCode, tableActionCode, tableEventHandlers, tableActionMethods, clientActionPromises, tableActionMethods_7, tableActionMethods_7_1, tableActionMethod;
|
|
4890
|
-
var
|
|
4891
|
-
return __generator(this, function (
|
|
4892
|
-
switch (
|
|
4852
|
+
var e_20, _j;
|
|
4853
|
+
return __generator(this, function (_k) {
|
|
4854
|
+
switch (_k.label) {
|
|
4893
4855
|
case 0:
|
|
4894
4856
|
tableCode = tableActionDetail.tableCode, tableActionCode = tableActionDetail.tableActionCode;
|
|
4895
4857
|
tableEventHandlers = this.tableActionsFinish[tableCode];
|
|
@@ -4902,17 +4864,17 @@
|
|
|
4902
4864
|
clientActionPromises.push(tableActionMethod(tableActionDetail, actionResult));
|
|
4903
4865
|
}
|
|
4904
4866
|
}
|
|
4905
|
-
catch (
|
|
4867
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
4906
4868
|
finally {
|
|
4907
4869
|
try {
|
|
4908
|
-
if (tableActionMethods_7_1 && !tableActionMethods_7_1.done && (
|
|
4870
|
+
if (tableActionMethods_7_1 && !tableActionMethods_7_1.done && (_j = tableActionMethods_7.return)) _j.call(tableActionMethods_7);
|
|
4909
4871
|
}
|
|
4910
|
-
finally { if (
|
|
4872
|
+
finally { if (e_20) throw e_20.error; }
|
|
4911
4873
|
}
|
|
4912
4874
|
return [4 /*yield*/, Promise.all(clientActionPromises)];
|
|
4913
4875
|
case 1:
|
|
4914
|
-
|
|
4915
|
-
|
|
4876
|
+
_k.sent();
|
|
4877
|
+
_k.label = 2;
|
|
4916
4878
|
case 2: return [2 /*return*/];
|
|
4917
4879
|
}
|
|
4918
4880
|
});
|
|
@@ -4920,24 +4882,24 @@
|
|
|
4920
4882
|
};
|
|
4921
4883
|
BasicFormComponent.prototype.checkSectionRequiredFields = function (sectionCode, reqFieldMessage) {
|
|
4922
4884
|
this.cleanErrorFields(null, sectionCode);
|
|
4923
|
-
var requiredFieldMessage = reqFieldMessage
|
|
4885
|
+
var requiredFieldMessage = reqFieldMessage !== null && reqFieldMessage !== void 0 ? reqFieldMessage : this.formConfig.formStandardErrors.requiredField;
|
|
4924
4886
|
var numErrors = this.tagFieldsWithError(this.getRequiredEmptyFields(null, sectionCode), null, requiredFieldMessage);
|
|
4925
4887
|
return (numErrors === 0);
|
|
4926
4888
|
};
|
|
4927
4889
|
BasicFormComponent.prototype.validateSectionConsistency = function (sectionCode, reqFieldMessage) {
|
|
4928
|
-
var
|
|
4890
|
+
var e_21, _j, e_22, _k;
|
|
4929
4891
|
this.resetError();
|
|
4930
4892
|
var completeFields = this.checkSectionRequiredFields(sectionCode, reqFieldMessage);
|
|
4931
4893
|
if (!completeFields) {
|
|
4932
|
-
this.setError(
|
|
4894
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
4933
4895
|
return;
|
|
4934
4896
|
}
|
|
4935
4897
|
var validationError = false;
|
|
4936
4898
|
var requiredEmptyFields = this.getRequiredEmptyFields(null, sectionCode);
|
|
4937
4899
|
if (requiredEmptyFields.length > 0) {
|
|
4938
4900
|
validationError = true;
|
|
4939
|
-
this.setError(
|
|
4940
|
-
this.tagFieldsWithError(requiredEmptyFields, null,
|
|
4901
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
4902
|
+
this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
|
|
4941
4903
|
try {
|
|
4942
4904
|
for (var requiredEmptyFields_1 = __values(requiredEmptyFields), requiredEmptyFields_1_1 = requiredEmptyFields_1.next(); !requiredEmptyFields_1_1.done; requiredEmptyFields_1_1 = requiredEmptyFields_1.next()) {
|
|
4943
4905
|
var fieldCode = requiredEmptyFields_1_1.value;
|
|
@@ -4949,18 +4911,18 @@
|
|
|
4949
4911
|
}
|
|
4950
4912
|
}
|
|
4951
4913
|
}
|
|
4952
|
-
catch (
|
|
4914
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
4953
4915
|
finally {
|
|
4954
4916
|
try {
|
|
4955
|
-
if (requiredEmptyFields_1_1 && !requiredEmptyFields_1_1.done && (
|
|
4917
|
+
if (requiredEmptyFields_1_1 && !requiredEmptyFields_1_1.done && (_j = requiredEmptyFields_1.return)) _j.call(requiredEmptyFields_1);
|
|
4956
4918
|
}
|
|
4957
|
-
finally { if (
|
|
4919
|
+
finally { if (e_21) throw e_21.error; }
|
|
4958
4920
|
}
|
|
4959
4921
|
}
|
|
4960
4922
|
var validationIssueFields = this.getFieldsWithValidationIssues(null, sectionCode);
|
|
4961
4923
|
if (!validationError && validationIssueFields.length > 0) {
|
|
4962
4924
|
validationError = true;
|
|
4963
|
-
this.setError(
|
|
4925
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
4964
4926
|
try {
|
|
4965
4927
|
for (var validationIssueFields_1 = __values(validationIssueFields), validationIssueFields_1_1 = validationIssueFields_1.next(); !validationIssueFields_1_1.done; validationIssueFields_1_1 = validationIssueFields_1.next()) {
|
|
4966
4928
|
var fieldCode = validationIssueFields_1_1.value;
|
|
@@ -4972,18 +4934,18 @@
|
|
|
4972
4934
|
}
|
|
4973
4935
|
}
|
|
4974
4936
|
}
|
|
4975
|
-
catch (
|
|
4937
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
4976
4938
|
finally {
|
|
4977
4939
|
try {
|
|
4978
|
-
if (validationIssueFields_1_1 && !validationIssueFields_1_1.done && (
|
|
4940
|
+
if (validationIssueFields_1_1 && !validationIssueFields_1_1.done && (_k = validationIssueFields_1.return)) _k.call(validationIssueFields_1);
|
|
4979
4941
|
}
|
|
4980
|
-
finally { if (
|
|
4942
|
+
finally { if (e_22) throw e_22.error; }
|
|
4981
4943
|
}
|
|
4982
4944
|
}
|
|
4983
4945
|
return validationError;
|
|
4984
4946
|
};
|
|
4985
4947
|
BasicFormComponent.prototype.copyTableRecordToFields = function (tableObj, mappingTable) {
|
|
4986
|
-
var
|
|
4948
|
+
var e_23, _j;
|
|
4987
4949
|
if (mappingTable === void 0) { mappingTable = null; }
|
|
4988
4950
|
var _a, _b;
|
|
4989
4951
|
var tableObject = this.getTable(tableObj.tableCode);
|
|
@@ -4997,12 +4959,12 @@
|
|
|
4997
4959
|
this.setFieldValue(fieldCode, columnValue);
|
|
4998
4960
|
}
|
|
4999
4961
|
}
|
|
5000
|
-
catch (
|
|
4962
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
5001
4963
|
finally {
|
|
5002
4964
|
try {
|
|
5003
|
-
if (columnNames_1_1 && !columnNames_1_1.done && (
|
|
4965
|
+
if (columnNames_1_1 && !columnNames_1_1.done && (_j = columnNames_1.return)) _j.call(columnNames_1);
|
|
5004
4966
|
}
|
|
5005
|
-
finally { if (
|
|
4967
|
+
finally { if (e_23) throw e_23.error; }
|
|
5006
4968
|
}
|
|
5007
4969
|
return true;
|
|
5008
4970
|
};
|
|
@@ -5010,7 +4972,7 @@
|
|
|
5010
4972
|
* Soporte registros en tablas que se editan en campos del formulario
|
|
5011
4973
|
*/
|
|
5012
4974
|
BasicFormComponent.prototype.defineEditionTable = function (tableEditionDef) {
|
|
5013
|
-
var
|
|
4975
|
+
var e_24, _j;
|
|
5014
4976
|
var _this = this;
|
|
5015
4977
|
var columnFieldMapping = tableEditionDef.columnFieldMapping, recordCaptureFields = tableEditionDef.recordCaptureFields, startCollapsed = tableEditionDef.startCollapsed;
|
|
5016
4978
|
tableEditionDef.startCollapsed = (typeof startCollapsed !== 'undefined')
|
|
@@ -5020,17 +4982,17 @@
|
|
|
5020
4982
|
try {
|
|
5021
4983
|
for (var columnFieldMapping_1 = __values(columnFieldMapping), columnFieldMapping_1_1 = columnFieldMapping_1.next(); !columnFieldMapping_1_1.done; columnFieldMapping_1_1 = columnFieldMapping_1.next()) {
|
|
5022
4984
|
var columnMap = columnFieldMapping_1_1.value;
|
|
5023
|
-
var
|
|
4985
|
+
var _k = __read(columnMap, 2), columnName = _k[0], formField = _k[1];
|
|
5024
4986
|
fieldsMappingTable[columnName] = formField;
|
|
5025
4987
|
fieldsToClear.push(formField);
|
|
5026
4988
|
}
|
|
5027
4989
|
}
|
|
5028
|
-
catch (
|
|
4990
|
+
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
5029
4991
|
finally {
|
|
5030
4992
|
try {
|
|
5031
|
-
if (columnFieldMapping_1_1 && !columnFieldMapping_1_1.done && (
|
|
4993
|
+
if (columnFieldMapping_1_1 && !columnFieldMapping_1_1.done && (_j = columnFieldMapping_1.return)) _j.call(columnFieldMapping_1);
|
|
5032
4994
|
}
|
|
5033
|
-
finally { if (
|
|
4995
|
+
finally { if (e_24) throw e_24.error; }
|
|
5034
4996
|
}
|
|
5035
4997
|
tableEditionDef.fieldsMappingTable = fieldsMappingTable;
|
|
5036
4998
|
tableEditionDef.fieldsToClear = fieldsToClear;
|
|
@@ -5081,7 +5043,7 @@
|
|
|
5081
5043
|
}
|
|
5082
5044
|
};
|
|
5083
5045
|
BasicFormComponent.prototype.enableRecordEdition = function (tableEditionDef, tableActionObject) {
|
|
5084
|
-
var
|
|
5046
|
+
var e_25, _j;
|
|
5085
5047
|
if (tableActionObject === void 0) { tableActionObject = null; }
|
|
5086
5048
|
if (tableActionObject) {
|
|
5087
5049
|
this.copyTableRecordToFields(tableActionObject, tableEditionDef.fieldsMappingTable);
|
|
@@ -5093,17 +5055,17 @@
|
|
|
5093
5055
|
if (tableEditionDef.fieldsToTriggerValidation
|
|
5094
5056
|
&& tableEditionDef.fieldsToTriggerValidation.length > 0) {
|
|
5095
5057
|
try {
|
|
5096
|
-
for (var
|
|
5097
|
-
var fieldName =
|
|
5058
|
+
for (var _k = __values(tableEditionDef.fieldsToTriggerValidation), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
5059
|
+
var fieldName = _l.value;
|
|
5098
5060
|
this.startFieldValidation(fieldName);
|
|
5099
5061
|
}
|
|
5100
5062
|
}
|
|
5101
|
-
catch (
|
|
5063
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
5102
5064
|
finally {
|
|
5103
5065
|
try {
|
|
5104
|
-
if (
|
|
5066
|
+
if (_l && !_l.done && (_j = _k.return)) _j.call(_k);
|
|
5105
5067
|
}
|
|
5106
|
-
finally { if (
|
|
5068
|
+
finally { if (e_25) throw e_25.error; }
|
|
5107
5069
|
}
|
|
5108
5070
|
}
|
|
5109
5071
|
return true;
|
|
@@ -5122,13 +5084,13 @@
|
|
|
5122
5084
|
var requiredEmptyFields = this.getRequiredEmptyFields(recordCaptureFields, null);
|
|
5123
5085
|
if (requiredEmptyFields.length > 0) {
|
|
5124
5086
|
validationOk = false;
|
|
5125
|
-
this.setError(
|
|
5126
|
-
this.tagFieldsWithError(requiredEmptyFields, null,
|
|
5087
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
5088
|
+
this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
|
|
5127
5089
|
}
|
|
5128
5090
|
var validationIssueFields = this.getFieldsWithValidationIssues(recordCaptureFields, null);
|
|
5129
5091
|
if (validationIssueFields.length > 0) {
|
|
5130
5092
|
validationOk = false;
|
|
5131
|
-
this.setError(
|
|
5093
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
5132
5094
|
}
|
|
5133
5095
|
return validationOk;
|
|
5134
5096
|
};
|