tuain-ng-forms-lib 0.12.30 → 12.0.2
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 +500 -597
- 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 +48 -92
- 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 +5 -5
- 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 +22 -12
- 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 +289 -374
- 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 +2 -1
- package/lib/classes/forms/field.d.ts +2 -1
- 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 +2 -3
- 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
|
@@ -12,6 +12,8 @@ class ActionComponent {
|
|
|
12
12
|
this.showLabel = true;
|
|
13
13
|
}
|
|
14
14
|
ngOnInit() {
|
|
15
|
+
var _a;
|
|
16
|
+
this.formConfig = (_a = this.actionObject) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
15
17
|
this.start();
|
|
16
18
|
}
|
|
17
19
|
start() { }
|
|
@@ -49,131 +51,49 @@ ActionComponent.propDecorators = {
|
|
|
49
51
|
showLabel: [{ type: Input }]
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
const
|
|
53
|
-
recordsPerPage: 10,
|
|
54
|
-
// Constantes para el despliegue de formularios
|
|
55
|
-
ELEMENTTYPE_ACTION: 'ACTION',
|
|
56
|
-
ELEMENTTYPE_FIELD: 'FIELD',
|
|
57
|
-
ELEMENTTYPE_TABLE: 'TABLE',
|
|
58
|
-
// Acciones de formularios
|
|
59
|
-
FORMACTION_TABLEACTION: 'TABLEACTION',
|
|
60
|
-
FORMACTION_GETDATA: 'GETDATA',
|
|
61
|
-
FORMACTION_GETTABLEDATA: 'GETTABLEDATA',
|
|
62
|
-
FORMACTION_VALIDATE: 'VALIDATE',
|
|
63
|
-
// Errores etándar de formularios
|
|
64
|
-
FORMERROR_VALIDATION_CODE: '13',
|
|
65
|
-
FORMERROR_TYPE_WARNING: 'WARNING',
|
|
66
|
-
FORMERROR_REQUIRED_FIELDS: 'Todos los campos requeridos deben ser diligenciados',
|
|
67
|
-
FORMERROR_VALIDATION_TITLE: 'Advertencia',
|
|
68
|
-
FORMERROR_VALIDATION_FIELDS: 'Existen campos con problemas de validación',
|
|
69
|
-
// Valores para los controles de navegació
|
|
70
|
-
FORMNAVIGATION_FIRST: 'first',
|
|
71
|
-
FORMNAVIGATION_PREVGROUP: 'prevgroup',
|
|
72
|
-
FORMNAVIGATION_NEXTGROUP: 'nextgroup',
|
|
73
|
-
FORMNAVIGATION_LAST: 'last',
|
|
74
|
-
FIELDTYPE_ARRAY: 'ARRAY',
|
|
75
|
-
FIELDTYPE_CHECK: 'CHECK',
|
|
76
|
-
FIELDTYPE_DATE: 'DATE',
|
|
77
|
-
FIELDTYPE_MAP: 'MAP',
|
|
78
|
-
FIELDTYPE_CURRENCY: 'CURRENCY',
|
|
79
|
-
FIELDTYPE_SELECT: 'SELECT',
|
|
80
|
-
FIELDTYPE_TEXT: 'TEXT',
|
|
81
|
-
FIELD_REQUIRED_MESSAGE: 'Campo requerido',
|
|
82
|
-
FORMTABLEACTION_SORT: 'SORT',
|
|
83
|
-
FORMTABLEACTION_REFRESH: 'REFRESH',
|
|
84
|
-
FORMTABLEACTION_NAVIGATE: 'NAVIGATE',
|
|
85
|
-
FORMTABLEACTION_INLINE: 'INLINE',
|
|
86
|
-
FORMTABLEACTION_GLOBAL: 'GLOBAL',
|
|
87
|
-
FORMTABLEACTION_ROWSELECTION: 'ROWSELECTION',
|
|
88
|
-
FORMTABLEACTION_SELECTION: 'SELECTION',
|
|
89
|
-
TABLE_SORT_ASCENDING: 'asc',
|
|
90
|
-
TABLE_SORT_DESCENDING: 'desc',
|
|
91
|
-
SERVICE_ERRORCODE_NOERROR: '00',
|
|
92
|
-
};
|
|
93
|
-
const operators = {
|
|
94
|
-
G: '>',
|
|
95
|
-
L: '<',
|
|
96
|
-
GE: '>=',
|
|
97
|
-
LE: '<=',
|
|
98
|
-
EQ: '==',
|
|
99
|
-
NOT_EQ: '!=',
|
|
100
|
-
CONTENT: 'Contiene',
|
|
101
|
-
NOT_CONTENT: 'No Contiene',
|
|
102
|
-
BETWEEN: 'Entre',
|
|
103
|
-
};
|
|
104
|
-
const tableFieldStyles = {
|
|
105
|
-
TEXT: {
|
|
106
|
-
'text-align': 'left'
|
|
107
|
-
},
|
|
108
|
-
TITLE: {
|
|
109
|
-
'text-align': 'left'
|
|
110
|
-
},
|
|
111
|
-
LABEL: {
|
|
112
|
-
'text-align': 'left'
|
|
113
|
-
},
|
|
114
|
-
MESSAGE: {
|
|
115
|
-
'text-align': 'left'
|
|
116
|
-
},
|
|
117
|
-
NUMBER: {
|
|
118
|
-
'text-align': 'right'
|
|
119
|
-
},
|
|
120
|
-
DATE: {
|
|
121
|
-
'text-align': 'right'
|
|
122
|
-
},
|
|
123
|
-
CHECK: {
|
|
124
|
-
'text-align': 'center'
|
|
125
|
-
},
|
|
126
|
-
ARRAY: {
|
|
127
|
-
'text-align': 'left'
|
|
128
|
-
},
|
|
129
|
-
SELECT: {
|
|
130
|
-
'text-align': 'left'
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
const DEFAULT_STATE_FLOW = {
|
|
134
|
-
defaultState: 'CREATE',
|
|
135
|
-
states: ['CREATE', 'EDIT', 'VIEW'],
|
|
136
|
-
transitions: [
|
|
137
|
-
{ name: 'VIEW1', origin: 'CREATE', destination: 'VIEW' },
|
|
138
|
-
{ name: 'VIEW2', origin: 'EDIT', destination: 'VIEW' },
|
|
139
|
-
{ name: 'EDIT1', origin: 'CREATE', destination: 'EDIT' },
|
|
140
|
-
{ name: 'EDIT2', origin: 'VIEW', destination: 'EDIT' },
|
|
141
|
-
{ name: 'CREATE1', origin: 'EDIT', destination: 'CREATE' },
|
|
142
|
-
{ name: 'CREATE2', origin: 'VIEW', destination: 'CREATE' },
|
|
143
|
-
]
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
const MONITORED_ATTRIBUTES$1 = {
|
|
54
|
+
const MONITORED_ATTRIBUTES = {
|
|
147
55
|
_maxLength: 'maxLength',
|
|
148
|
-
_onValidation: '
|
|
56
|
+
_onValidation: 'onValidation',
|
|
149
57
|
_fieldValue: 'value',
|
|
150
58
|
captureType: 'captureType',
|
|
151
|
-
fieldTitle: '
|
|
152
|
-
fieldType: '
|
|
59
|
+
fieldTitle: 'title',
|
|
60
|
+
fieldType: 'type',
|
|
153
61
|
errorMessage: 'errorMessage',
|
|
154
62
|
errorType: 'errorType',
|
|
155
63
|
errorCode: 'errorCode',
|
|
156
64
|
visibleLabel: 'visibleLabel',
|
|
157
|
-
fieldRequired: '
|
|
158
|
-
fieldOptions: '
|
|
65
|
+
fieldRequired: 'required',
|
|
66
|
+
fieldOptions: 'options',
|
|
159
67
|
};
|
|
160
68
|
class FieldComponent {
|
|
161
|
-
constructor() {
|
|
162
|
-
this.componentConstants = Object.assign({}, componentConstants);
|
|
163
|
-
}
|
|
164
69
|
ngOnInit() {
|
|
70
|
+
var _a;
|
|
165
71
|
if (this.fieldObject) {
|
|
72
|
+
this.formConfig = (_a = this.fieldObject) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
166
73
|
// Atributos estáticos
|
|
167
|
-
this.
|
|
74
|
+
this.code = this.fieldObject.fieldCode;
|
|
168
75
|
this.fieldInfo = this.fieldObject.fieldInfo;
|
|
169
76
|
this.fieldAlignment = this.fieldObject.fieldAlignment;
|
|
170
77
|
this.tooltipText = this.fieldObject.tooltipText;
|
|
78
|
+
// Cargue inicial
|
|
79
|
+
this.maxLength = this.fieldObject._maxLength;
|
|
80
|
+
this.onValidation = this.fieldObject._onValidation;
|
|
81
|
+
this.value = this.fieldObject._fieldValue;
|
|
82
|
+
this.captureType = this.fieldObject.captureType;
|
|
83
|
+
this.title = this.fieldObject.fieldTitle;
|
|
84
|
+
this.type = this.fieldObject.fieldType;
|
|
85
|
+
this.errorMessage = this.fieldObject.errorMessage;
|
|
86
|
+
this.errorType = this.fieldObject.errorType;
|
|
87
|
+
this.errorCode = this.fieldObject.errorCode;
|
|
88
|
+
this.visibleLabel = this.fieldObject.visibleLabel;
|
|
89
|
+
this.required = this.fieldObject.fieldRequired;
|
|
90
|
+
this.options = this.fieldObject.fieldOptions;
|
|
171
91
|
this.fieldObject.widget = this;
|
|
172
92
|
// Atributos dinámicos
|
|
173
93
|
this.fieldObject.attributeChange.subscribe(event => {
|
|
174
94
|
const { name, value } = event;
|
|
175
|
-
if (this[MONITORED_ATTRIBUTES
|
|
176
|
-
this[MONITORED_ATTRIBUTES
|
|
95
|
+
if (this[MONITORED_ATTRIBUTES[name]]) {
|
|
96
|
+
this[MONITORED_ATTRIBUTES[name]] = value;
|
|
177
97
|
}
|
|
178
98
|
});
|
|
179
99
|
}
|
|
@@ -201,17 +121,15 @@ FieldComponent.decorators = [
|
|
|
201
121
|
template: `<ng-content></ng-content>`
|
|
202
122
|
},] }
|
|
203
123
|
];
|
|
204
|
-
FieldComponent.ctorParameters = () => [];
|
|
205
124
|
FieldComponent.propDecorators = {
|
|
206
125
|
fieldObject: [{ type: Input }],
|
|
207
126
|
disabled: [{ type: Input }]
|
|
208
127
|
};
|
|
209
128
|
|
|
210
129
|
class ElementComponent {
|
|
211
|
-
constructor() {
|
|
212
|
-
this.componentConstants = Object.assign({}, componentConstants);
|
|
213
|
-
}
|
|
214
130
|
ngOnInit() {
|
|
131
|
+
var _a;
|
|
132
|
+
this.formConfig = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
215
133
|
this.start();
|
|
216
134
|
}
|
|
217
135
|
start() { }
|
|
@@ -232,7 +150,6 @@ ElementComponent.decorators = [
|
|
|
232
150
|
template: `<ng-content></ng-content>`
|
|
233
151
|
},] }
|
|
234
152
|
];
|
|
235
|
-
ElementComponent.ctorParameters = () => [];
|
|
236
153
|
ElementComponent.propDecorators = {
|
|
237
154
|
formElement: [{ type: Input }],
|
|
238
155
|
formManager: [{ type: Input }]
|
|
@@ -328,9 +245,33 @@ class Filter {
|
|
|
328
245
|
}
|
|
329
246
|
}
|
|
330
247
|
|
|
248
|
+
const elementTypes = {
|
|
249
|
+
action: 'ACTION',
|
|
250
|
+
field: 'FIELD',
|
|
251
|
+
table: 'TABLE',
|
|
252
|
+
};
|
|
253
|
+
const formActions = {
|
|
254
|
+
tableAction: 'TABLEACTION',
|
|
255
|
+
getData: 'GETDATA',
|
|
256
|
+
getTableData: 'GETTABLEDATA',
|
|
257
|
+
validate: 'VALIDATE',
|
|
258
|
+
};
|
|
259
|
+
const operators = {
|
|
260
|
+
G: '>',
|
|
261
|
+
L: '<',
|
|
262
|
+
GE: '>=',
|
|
263
|
+
LE: '<=',
|
|
264
|
+
EQ: '==',
|
|
265
|
+
NOT_EQ: '!=',
|
|
266
|
+
CONTENT: 'Contiene',
|
|
267
|
+
NOT_CONTENT: 'No Contiene',
|
|
268
|
+
BETWEEN: 'Entre',
|
|
269
|
+
};
|
|
270
|
+
|
|
331
271
|
class FormElement {
|
|
332
|
-
constructor(elementDefinition) {
|
|
272
|
+
constructor(elementDefinition, formConfig) {
|
|
333
273
|
var _a, _b;
|
|
274
|
+
this._formConfig = formConfig;
|
|
334
275
|
this._isForced = false;
|
|
335
276
|
this.setVisibleStates(elementDefinition.visibleStates);
|
|
336
277
|
this.setEnabledStates(elementDefinition.enabledStates);
|
|
@@ -339,9 +280,9 @@ class FormElement {
|
|
|
339
280
|
this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
|
|
340
281
|
this.widget = null;
|
|
341
282
|
}
|
|
342
|
-
isField() { return this.elementType ===
|
|
343
|
-
isAction() { return this.elementType ===
|
|
344
|
-
isTable() { return this.elementType ===
|
|
283
|
+
isField() { return this.elementType === elementTypes.field; }
|
|
284
|
+
isAction() { return this.elementType === elementTypes.action; }
|
|
285
|
+
isTable() { return this.elementType === elementTypes.table; }
|
|
345
286
|
setVisibleStates(newStates) {
|
|
346
287
|
const visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
|
|
347
288
|
? newStates.split(',').map(state => state.trim()).filter(state => state.length > 0)
|
|
@@ -387,13 +328,14 @@ class FormElement {
|
|
|
387
328
|
}
|
|
388
329
|
|
|
389
330
|
class RecordTableColumn {
|
|
390
|
-
constructor(recTableColReceived) {
|
|
331
|
+
constructor(recTableColReceived, formConfig) {
|
|
391
332
|
var _a, _b, _c;
|
|
333
|
+
this._formConfig = formConfig;
|
|
392
334
|
if (recTableColReceived) {
|
|
393
335
|
this.fieldCode = recTableColReceived.fieldCode;
|
|
394
336
|
this.fieldTitle = recTableColReceived.fieldTitle;
|
|
395
|
-
this.fieldType = recTableColReceived.fieldTypeCode ||
|
|
396
|
-
const defaultTypeAlignment = (tableFieldStyles[this.fieldType] != null) ? tableFieldStyles[this.fieldType]['text-align'] : 'left';
|
|
337
|
+
this.fieldType = recTableColReceived.fieldTypeCode || this._formConfig.fieldTypes.text;
|
|
338
|
+
const defaultTypeAlignment = (this._formConfig.tableFieldStyles[this.fieldType] != null) ? this._formConfig.tableFieldStyles[this.fieldType]['text-align'] : 'left';
|
|
397
339
|
this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
|
|
398
340
|
this.visible = (_a = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.visible) !== null && _a !== void 0 ? _a : true;
|
|
399
341
|
this.sortable = (_b = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.sortable) !== null && _b !== void 0 ? _b : false;
|
|
@@ -480,6 +422,8 @@ function formatCurrency(inputValue) {
|
|
|
480
422
|
return outputValue;
|
|
481
423
|
}
|
|
482
424
|
|
|
425
|
+
const DATE_TYPE = 'DATE';
|
|
426
|
+
const CURRENCY_TYPE = 'CURRENCY';
|
|
483
427
|
class TableRecordData {
|
|
484
428
|
constructor(recordReceived, recordDefinition, selectionFieldName = null) {
|
|
485
429
|
this.recordData = {};
|
|
@@ -514,10 +458,10 @@ class TableRecordData {
|
|
|
514
458
|
}
|
|
515
459
|
}
|
|
516
460
|
formatFieldValue(fieldType, fieldValue) {
|
|
517
|
-
if (fieldType ===
|
|
461
|
+
if (fieldType === CURRENCY_TYPE) {
|
|
518
462
|
return formatCurrency(fieldValue);
|
|
519
463
|
}
|
|
520
|
-
else if (fieldType ===
|
|
464
|
+
else if (fieldType === DATE_TYPE && fieldValue) {
|
|
521
465
|
return new Date(fieldValue).toISOString().split('T')[0];
|
|
522
466
|
}
|
|
523
467
|
return fieldValue || '';
|
|
@@ -601,6 +545,8 @@ class TableRecordData {
|
|
|
601
545
|
}
|
|
602
546
|
}
|
|
603
547
|
|
|
548
|
+
const TABLE_SORT_ASCENDING = 'asc';
|
|
549
|
+
const TABLE_SORT_DESCENDING = 'desc';
|
|
604
550
|
const TABLE_FILTER_TYPES = {
|
|
605
551
|
simpleFilterChange: 'SIMPLE_CHANGE',
|
|
606
552
|
simpleFilterFinish: 'SIMPLE_FINISH',
|
|
@@ -608,9 +554,9 @@ const TABLE_FILTER_TYPES = {
|
|
|
608
554
|
complexFilterRemove: 'COMPLEX_REMOVE',
|
|
609
555
|
};
|
|
610
556
|
class RecordTable extends FormElement {
|
|
611
|
-
constructor(tableReceived) {
|
|
557
|
+
constructor(tableReceived, formConfig) {
|
|
612
558
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
613
|
-
super(tableReceived);
|
|
559
|
+
super(tableReceived, formConfig);
|
|
614
560
|
this._inlineActionTrigger = new Subject();
|
|
615
561
|
this._globalActionTrigger = new Subject();
|
|
616
562
|
this._recordSelectionTrigger = new Subject();
|
|
@@ -620,7 +566,7 @@ class RecordTable extends FormElement {
|
|
|
620
566
|
this._tableColumnObj = {};
|
|
621
567
|
this._actionsObj = {};
|
|
622
568
|
this.allSelected = false;
|
|
623
|
-
this.elementType =
|
|
569
|
+
this.elementType = elementTypes.table;
|
|
624
570
|
this.waiting = false;
|
|
625
571
|
this.complexFilter = false;
|
|
626
572
|
this.currentPage = 1;
|
|
@@ -643,10 +589,10 @@ class RecordTable extends FormElement {
|
|
|
643
589
|
this.customAttributes = (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.customAttributes) !== null && _f !== void 0 ? _f : {};
|
|
644
590
|
this.sortable = (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false;
|
|
645
591
|
this.sorting = { columnName: '', direction: '' };
|
|
646
|
-
this.recordsPerPage =
|
|
592
|
+
this.recordsPerPage = formConfig.defaultRecordsPerPage;
|
|
647
593
|
if (tableReceived.fields) {
|
|
648
594
|
for (const columnReceived of tableReceived.fields) {
|
|
649
|
-
const columnDefinition = new RecordTableColumn(columnReceived);
|
|
595
|
+
const columnDefinition = new RecordTableColumn(columnReceived, this._formConfig);
|
|
650
596
|
this.columns.push(columnDefinition);
|
|
651
597
|
this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
|
|
652
598
|
}
|
|
@@ -823,7 +769,7 @@ class RecordTable extends FormElement {
|
|
|
823
769
|
return (this._actionsObj && actionCode && this._actionsObj[actionCode])
|
|
824
770
|
? this._actionsObj[actionCode] : null;
|
|
825
771
|
}
|
|
826
|
-
getActions(actionClass =
|
|
772
|
+
getActions(actionClass = this._formConfig.tableActions.inline, actionTypes = null) {
|
|
827
773
|
return this._actions.filter(actionDef => {
|
|
828
774
|
const typeIncluded = (actionTypes) ? actionTypes.includes(actionDef.actionType) : true;
|
|
829
775
|
return actionDef.actionClass === actionClass && typeIncluded;
|
|
@@ -884,14 +830,14 @@ class RecordTable extends FormElement {
|
|
|
884
830
|
setRequiredOrder(columnField) {
|
|
885
831
|
if (columnField !== this.sorting.columnName) {
|
|
886
832
|
this.sorting.columnName = columnField;
|
|
887
|
-
this.sorting.direction =
|
|
833
|
+
this.sorting.direction = TABLE_SORT_ASCENDING;
|
|
888
834
|
}
|
|
889
835
|
else {
|
|
890
|
-
if (this.sorting.direction ===
|
|
891
|
-
this.sorting.direction =
|
|
836
|
+
if (this.sorting.direction === TABLE_SORT_ASCENDING) {
|
|
837
|
+
this.sorting.direction = TABLE_SORT_DESCENDING;
|
|
892
838
|
}
|
|
893
839
|
else {
|
|
894
|
-
this.sorting.direction =
|
|
840
|
+
this.sorting.direction = TABLE_SORT_ASCENDING;
|
|
895
841
|
}
|
|
896
842
|
}
|
|
897
843
|
}
|
|
@@ -912,7 +858,7 @@ class RecordTable extends FormElement {
|
|
|
912
858
|
else if (recordAColumn > recordBColumn) {
|
|
913
859
|
result = 1;
|
|
914
860
|
}
|
|
915
|
-
return direction ===
|
|
861
|
+
return direction === TABLE_SORT_ASCENDING ? result : -result;
|
|
916
862
|
}
|
|
917
863
|
}
|
|
918
864
|
|
|
@@ -1068,13 +1014,15 @@ class LibTableComponent {
|
|
|
1068
1014
|
this.hasActions = false;
|
|
1069
1015
|
}
|
|
1070
1016
|
ngOnInit() {
|
|
1071
|
-
|
|
1017
|
+
var _a;
|
|
1018
|
+
this.formConfig = (_a = this.tableObject) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
1019
|
+
this.tableFieldStyles = this.formConfig.tableFieldStyles;
|
|
1072
1020
|
this.selectable = this.tableObject.selectable;
|
|
1073
1021
|
this.hasActions = this.tableObject.hasActions;
|
|
1074
1022
|
this.tableObject.widget = this;
|
|
1075
|
-
this.inlineActions = this.tableObject.getActions(
|
|
1076
|
-
this.globalActions = this.tableObject.getActions(
|
|
1077
|
-
this.selectionActions = this.tableObject.getActions(
|
|
1023
|
+
this.inlineActions = this.tableObject.getActions(this.formConfig.tableActions.inline);
|
|
1024
|
+
this.globalActions = this.tableObject.getActions(this.formConfig.tableActions.global);
|
|
1025
|
+
this.selectionActions = this.tableObject.getActions(this.formConfig.tableActions.selection);
|
|
1078
1026
|
this.start();
|
|
1079
1027
|
}
|
|
1080
1028
|
start() { }
|
|
@@ -1184,15 +1132,15 @@ class RecordFormSubSection {
|
|
|
1184
1132
|
let arrayToAdd = null;
|
|
1185
1133
|
const { type, code } = receivedElement;
|
|
1186
1134
|
switch (type) {
|
|
1187
|
-
case
|
|
1135
|
+
case elementTypes.field:
|
|
1188
1136
|
elementObject = formObject.getFieldObject(code);
|
|
1189
1137
|
arrayToAdd = this.subSectionFields;
|
|
1190
1138
|
break;
|
|
1191
|
-
case
|
|
1139
|
+
case elementTypes.table:
|
|
1192
1140
|
elementObject = formObject.getTableObject(code);
|
|
1193
1141
|
arrayToAdd = this.subSectionTables;
|
|
1194
1142
|
break;
|
|
1195
|
-
case
|
|
1143
|
+
case elementTypes.action:
|
|
1196
1144
|
elementObject = formObject.getActionObject(code);
|
|
1197
1145
|
arrayToAdd = this.subSectionActions;
|
|
1198
1146
|
break;
|
|
@@ -1330,12 +1278,12 @@ class RecordFormSection {
|
|
|
1330
1278
|
|
|
1331
1279
|
const HEADER$1 = 'HEADER';
|
|
1332
1280
|
class FormAction extends FormElement {
|
|
1333
|
-
constructor(actionDefinition) {
|
|
1281
|
+
constructor(actionDefinition, formConfig) {
|
|
1334
1282
|
var _a, _b;
|
|
1335
|
-
super(actionDefinition);
|
|
1283
|
+
super(actionDefinition, formConfig);
|
|
1336
1284
|
this._actionActivated = new Subject();
|
|
1337
1285
|
this.inProgress = false;
|
|
1338
|
-
this.elementType =
|
|
1286
|
+
this.elementType = elementTypes.action;
|
|
1339
1287
|
this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
|
|
1340
1288
|
this.actionName = actionDefinition.actionTitle;
|
|
1341
1289
|
this.iconName = actionDefinition.iconName || this.actionCode;
|
|
@@ -1363,58 +1311,9 @@ class FormAction extends FormElement {
|
|
|
1363
1311
|
}
|
|
1364
1312
|
|
|
1365
1313
|
const UNDEFINED = 'undefined';
|
|
1366
|
-
const FIELD_VALUE = 'fieldValue';
|
|
1367
|
-
const FIELD_OPTIONS = 'fieldOptions';
|
|
1368
|
-
const FIELD_TITLE = 'fieldTitle';
|
|
1369
|
-
const FIELD_CAPTURE_TYPE = 'captureType';
|
|
1370
|
-
const FIELD_TYPE = 'fieldTypeCode';
|
|
1371
|
-
const FIELD_MAX_LENGTH = 'maxLength';
|
|
1372
|
-
const FIELD_VISIBLE = 'visible';
|
|
1373
|
-
const FIELD_LABEL_VISIBLE = 'visibleLabel';
|
|
1374
|
-
const FIELD_REQUIRED = 'required';
|
|
1375
|
-
const FIELD_ERR_CODE = 'errorCode';
|
|
1376
|
-
const FIELD_ERR_MSG = 'errorMessage';
|
|
1377
|
-
const FIELD_TOOLTIP = 'tooltipText';
|
|
1378
|
-
const FIELD_INFO = 'info';
|
|
1379
|
-
const FIELD_EDITABLE = 'editable';
|
|
1380
|
-
const FIELD_TYPES = {
|
|
1381
|
-
boolean: 'BOOLEAN',
|
|
1382
|
-
array: 'ARRAY',
|
|
1383
|
-
check: 'CHECK',
|
|
1384
|
-
date: 'DATE',
|
|
1385
|
-
daterange: 'DATERANGE',
|
|
1386
|
-
time: 'TIME',
|
|
1387
|
-
timerange: 'TIMERANGE',
|
|
1388
|
-
map: 'MAP',
|
|
1389
|
-
number: 'NUMBER',
|
|
1390
|
-
decimal: 'DECIMAL',
|
|
1391
|
-
currency: 'CURRENCY',
|
|
1392
|
-
select: 'SELECT',
|
|
1393
|
-
typeahead: 'TYPEAHEAD',
|
|
1394
|
-
text: 'TEXT',
|
|
1395
|
-
password: 'PASSWORD',
|
|
1396
|
-
label: 'LABEL',
|
|
1397
|
-
html: 'HTML',
|
|
1398
|
-
title: 'TITLE',
|
|
1399
|
-
message: 'MESSAGE',
|
|
1400
|
-
link: 'LINK',
|
|
1401
|
-
warning: 'WARNING',
|
|
1402
|
-
avatar: 'AVATAR',
|
|
1403
|
-
email: 'EMAIL',
|
|
1404
|
-
phone: 'PHONE',
|
|
1405
|
-
};
|
|
1406
|
-
const FIELD_TYPES_FORMATS = {
|
|
1407
|
-
EMAIL: new RegExp('^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$'),
|
|
1408
|
-
};
|
|
1409
|
-
const INTRINSIC_ERROR_MESSAGES = {
|
|
1410
|
-
EMAIL: `El valor no corresponde a un correo válido`,
|
|
1411
|
-
DEFAULT: `El valor no se ajusta al formato establecido`,
|
|
1412
|
-
};
|
|
1413
1314
|
const DEFAULT_ERROR_TYPE = 'error';
|
|
1414
1315
|
const DEFAULT_CAPTURE_TYPE = 'INPUT';
|
|
1415
1316
|
const DEFAULT_ALIGNMENT = 'left';
|
|
1416
|
-
const MONITORED_ATTRIBUTES = ['_maxLength', '_onValidation', 'captureType', 'fieldTitle', 'fieldType',
|
|
1417
|
-
'errorMessage', 'errorType', 'errorCode', 'visibleLabel', 'fieldRequired', 'fieldOptions', '_fieldValue'];
|
|
1418
1317
|
const STD_MAX_LENGTH = 50;
|
|
1419
1318
|
const BIG_MAX_LENGTH = 500;
|
|
1420
1319
|
const fldAttr = {
|
|
@@ -1447,21 +1346,21 @@ const fldAttr = {
|
|
|
1447
1346
|
options: 'fieldOptions',
|
|
1448
1347
|
};
|
|
1449
1348
|
class FieldDescriptor extends FormElement {
|
|
1450
|
-
constructor(inputFieldReceived) {
|
|
1349
|
+
constructor(inputFieldReceived, formConfig) {
|
|
1451
1350
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1452
|
-
super(inputFieldReceived);
|
|
1351
|
+
super(inputFieldReceived, formConfig);
|
|
1453
1352
|
this._editionFinish = new Subject();
|
|
1454
1353
|
this._editionPartial = new Subject();
|
|
1455
1354
|
this._detailRequest = new Subject();
|
|
1456
1355
|
this._attributeChange = new Subject();
|
|
1457
|
-
this.elementType =
|
|
1356
|
+
this.elementType = elementTypes.field;
|
|
1458
1357
|
const fld = (inputFieldReceived) ? inputFieldReceived : {};
|
|
1459
1358
|
this.setAttr(fldAttr.code, fld.fieldCode);
|
|
1460
1359
|
this.setAttr(fldAttr.title, (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : this.fieldCode);
|
|
1461
1360
|
this.setAttr(fldAttr.captureType, (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE);
|
|
1462
1361
|
this.setAttr(fldAttr.defaultValue, (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null);
|
|
1463
|
-
const defaultTypeAlignment = (tableFieldStyles[this.fieldType] != null)
|
|
1464
|
-
? tableFieldStyles[this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
|
|
1362
|
+
const defaultTypeAlignment = (this._formConfig.tableFieldStyles[this.fieldType] != null)
|
|
1363
|
+
? this._formConfig.tableFieldStyles[this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
|
|
1465
1364
|
const fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
|
|
1466
1365
|
this.setAttr(fldAttr.alignment, fieldAlignment);
|
|
1467
1366
|
this.setAttr(fldAttr.info, fld.info || '');
|
|
@@ -1482,7 +1381,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1482
1381
|
this.setAttr(fldAttr.outputOnly, (_h = fld.outputOnly) !== null && _h !== void 0 ? _h : false);
|
|
1483
1382
|
const maxLength = (_j = fld.maxLength) !== null && _j !== void 0 ? _j : (this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
1484
1383
|
this.setAttr(fldAttr.maxLength, maxLength);
|
|
1485
|
-
this.setAttr(fldAttr.intrinsicErrorMessage, (_k =
|
|
1384
|
+
this.setAttr(fldAttr.intrinsicErrorMessage, (_k = this._formConfig.fieldTypeErrMsg[this.fieldType]) !== null && _k !== void 0 ? _k : this._formConfig.fieldTypeErrMsg.DEFAULT);
|
|
1486
1385
|
this.setFieldType(fld.fieldTypeCode);
|
|
1487
1386
|
this.setEditable((_l = fld.editable) !== null && _l !== void 0 ? _l : true);
|
|
1488
1387
|
this.setVisibleLabel((_m = fld.visibleLabel) !== null && _m !== void 0 ? _m : true);
|
|
@@ -1518,13 +1417,13 @@ class FieldDescriptor extends FormElement {
|
|
|
1518
1417
|
this._editionPartial.next({ code: this.fieldCode, intrinsicValidation });
|
|
1519
1418
|
}
|
|
1520
1419
|
notifyEditionFinish() {
|
|
1521
|
-
var _a, _b, _c, _d;
|
|
1420
|
+
var _a, _b, _c, _d, _e;
|
|
1522
1421
|
let intrinsicValidation = true;
|
|
1523
|
-
const fieldDefaultFormat = (_a =
|
|
1422
|
+
const fieldDefaultFormat = (_b = (_a = this._formConfig.fieldTypesPatterns) === null || _a === void 0 ? void 0 : _a[this.fieldType]) !== null && _b !== void 0 ? _b : null;
|
|
1524
1423
|
const fieldValue = this.getValue();
|
|
1525
1424
|
if (fieldValue && (fieldDefaultFormat || this.fieldFormat)) {
|
|
1526
|
-
intrinsicValidation = ((
|
|
1527
|
-
&& ((
|
|
1425
|
+
intrinsicValidation = ((_c = fieldDefaultFormat === null || fieldDefaultFormat === void 0 ? void 0 : fieldDefaultFormat.test(fieldValue)) !== null && _c !== void 0 ? _c : true)
|
|
1426
|
+
&& ((_e = (_d = this.fieldFormat) === null || _d === void 0 ? void 0 : _d.test(fieldValue)) !== null && _e !== void 0 ? _e : true);
|
|
1528
1427
|
if (!intrinsicValidation) {
|
|
1529
1428
|
this.setError('99', this._intrinsicErrorMessage);
|
|
1530
1429
|
}
|
|
@@ -1532,16 +1431,15 @@ class FieldDescriptor extends FormElement {
|
|
|
1532
1431
|
this._editionFinish.next({ code: this.fieldCode, intrinsicValidation });
|
|
1533
1432
|
}
|
|
1534
1433
|
setAttr(name, value) {
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
}
|
|
1538
|
-
if (MONITORED_ATTRIBUTES.includes(name)) {
|
|
1434
|
+
this[name] = value;
|
|
1435
|
+
if (this._formConfig.monitoredFieldAttributes.includes(name)) {
|
|
1539
1436
|
this._attributeChange.next({ name, value });
|
|
1540
1437
|
}
|
|
1541
1438
|
}
|
|
1542
1439
|
notifyEditionDetailRequest() {
|
|
1543
1440
|
this._detailRequest.next(this.fieldCode);
|
|
1544
1441
|
}
|
|
1442
|
+
getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
|
|
1545
1443
|
setVisibleLabel(visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); }
|
|
1546
1444
|
showLabel() { this.setVisibleLabel(true); }
|
|
1547
1445
|
hideLabel() { this.setVisibleLabel(false); }
|
|
@@ -1570,7 +1468,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1570
1468
|
if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
|
|
1571
1469
|
return true;
|
|
1572
1470
|
}
|
|
1573
|
-
if ((this.fieldType ===
|
|
1471
|
+
if ((this.fieldType === this._formConfig.fieldTypes.array || this.fieldType === this._formConfig.fieldTypes.phone)
|
|
1574
1472
|
&& Array.isArray(fieldCurrentValue) && fieldCurrentValue.length === 0) {
|
|
1575
1473
|
return true;
|
|
1576
1474
|
}
|
|
@@ -1578,12 +1476,15 @@ class FieldDescriptor extends FormElement {
|
|
|
1578
1476
|
return fieldCurrentValue === '';
|
|
1579
1477
|
}
|
|
1580
1478
|
getValue() {
|
|
1581
|
-
var _a;
|
|
1479
|
+
var _a, _b;
|
|
1582
1480
|
switch (this.fieldType) {
|
|
1583
|
-
case
|
|
1481
|
+
case this._formConfig.fieldTypes.boolean:
|
|
1584
1482
|
return (_a = this._fieldValue) !== null && _a !== void 0 ? _a : false;
|
|
1585
1483
|
break;
|
|
1586
|
-
case
|
|
1484
|
+
case this._formConfig.fieldTypes.check:
|
|
1485
|
+
return (_b = this._fieldValue) !== null && _b !== void 0 ? _b : false;
|
|
1486
|
+
break;
|
|
1487
|
+
case this._formConfig.fieldTypes.currency:
|
|
1587
1488
|
return this._fieldValue.replace(',', '');
|
|
1588
1489
|
break;
|
|
1589
1490
|
default:
|
|
@@ -1597,33 +1498,33 @@ class FieldDescriptor extends FormElement {
|
|
|
1597
1498
|
for (let index = 0; index < fieldKeys.length; index++) {
|
|
1598
1499
|
const attrName = fieldKeys[index];
|
|
1599
1500
|
const attrValue = fld[attrName];
|
|
1600
|
-
(attrName ===
|
|
1601
|
-
(attrName ===
|
|
1602
|
-
(attrName ===
|
|
1603
|
-
(attrName ===
|
|
1604
|
-
(attrName ===
|
|
1605
|
-
(attrName ===
|
|
1606
|
-
(attrName ===
|
|
1607
|
-
(attrName ===
|
|
1608
|
-
(attrName ===
|
|
1609
|
-
(attrName ===
|
|
1610
|
-
(attrName ===
|
|
1611
|
-
(attrName ===
|
|
1612
|
-
(attrName ===
|
|
1613
|
-
(attrName ===
|
|
1501
|
+
(attrName === this._formConfig.apifieldattrs.visible) && this.setVisibility(attrValue);
|
|
1502
|
+
(attrName === this._formConfig.apifieldattrs.labelVisible) && this.setVisibleLabel(fld.visibleLabel);
|
|
1503
|
+
(attrName === this._formConfig.apifieldattrs.required) && this.setAttr(fldAttr.required, (_a = fld.required) !== null && _a !== void 0 ? _a : false);
|
|
1504
|
+
(attrName === this._formConfig.apifieldattrs.errorCode) && this.setAttr(fldAttr.errorCode, fld.errorCode);
|
|
1505
|
+
(attrName === this._formConfig.apifieldattrs.errorMessage) && this.setAttr(fldAttr.errorMessage, fld.errorMessage);
|
|
1506
|
+
(attrName === this._formConfig.apifieldattrs.tooltip) && this.setAttr(fldAttr.tooltipText, fld.tooltip);
|
|
1507
|
+
(attrName === this._formConfig.apifieldattrs.info) && this.setAttr(fldAttr.info, fld.info);
|
|
1508
|
+
(attrName === this._formConfig.apifieldattrs.editable) && this.setEditable(fld.editable);
|
|
1509
|
+
(attrName === this._formConfig.apifieldattrs.title) && this.setLabel(fld.fieldTitle.toString());
|
|
1510
|
+
(attrName === this._formConfig.apifieldattrs.value) && (this.setValue(fld._fieldValue) && this.setChanged(false));
|
|
1511
|
+
(attrName === this._formConfig.apifieldattrs.options) && this.setFieldOptions(fld.fieldOptions);
|
|
1512
|
+
(attrName === this._formConfig.apifieldattrs.captureType) && this.setAttr(fldAttr.captureType, fld.captureType || 'INPUT');
|
|
1513
|
+
(attrName === this._formConfig.apifieldattrs.type) && this.setFieldType(fld.fieldTypeCode);
|
|
1514
|
+
(attrName === this._formConfig.apifieldattrs.maxLength) && this.setAttr(fldAttr.maxLength, fld.maxLength);
|
|
1614
1515
|
}
|
|
1615
1516
|
}
|
|
1616
1517
|
setFieldType(inputFieldType) {
|
|
1617
1518
|
this.setAttr(fldAttr.type, inputFieldType);
|
|
1618
1519
|
}
|
|
1619
1520
|
format() {
|
|
1620
|
-
if (this.fieldType ===
|
|
1521
|
+
if (this.fieldType === this._formConfig.fieldTypes.currency) {
|
|
1621
1522
|
this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
|
|
1622
1523
|
}
|
|
1623
1524
|
}
|
|
1624
1525
|
setMinValue(minValue) {
|
|
1625
1526
|
var _a, _b, _c;
|
|
1626
|
-
if (this.fieldType ===
|
|
1527
|
+
if (this.fieldType === this._formConfig.fieldTypes.date
|
|
1627
1528
|
&& ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMinValue)) {
|
|
1628
1529
|
this.setAttr(fldAttr.minValue, minValue);
|
|
1629
1530
|
if (!minValue) {
|
|
@@ -1637,7 +1538,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1637
1538
|
}
|
|
1638
1539
|
setMaxValue(maxValue) {
|
|
1639
1540
|
var _a, _b, _c;
|
|
1640
|
-
if (this.fieldType ===
|
|
1541
|
+
if (this.fieldType === this._formConfig.fieldTypes.date
|
|
1641
1542
|
&& ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMaxValue)) {
|
|
1642
1543
|
this.setAttr(fldAttr.maxValue, maxValue);
|
|
1643
1544
|
if (!maxValue) {
|
|
@@ -1669,11 +1570,11 @@ class FieldDescriptor extends FormElement {
|
|
|
1669
1570
|
fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
|
|
1670
1571
|
&& fieldOptions.length > 0) ? fieldOptions : [];
|
|
1671
1572
|
this.setAttr(fldAttr.options, fieldOptions);
|
|
1672
|
-
if (this.fieldType ===
|
|
1573
|
+
if (this.fieldType === this._formConfig.fieldTypes.array && this.widget) {
|
|
1673
1574
|
return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
|
|
1674
1575
|
}
|
|
1675
1576
|
if (this._fieldValue) {
|
|
1676
|
-
if (this.fieldType ===
|
|
1577
|
+
if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._fieldValue)) {
|
|
1677
1578
|
const fieldValue = (_b = this._fieldValue) === null || _b === void 0 ? void 0 : _b.filter(item => this.fieldOptions.find(opt => opt.fieldOptionId === item));
|
|
1678
1579
|
this.setAttr(fldAttr.value, fieldValue);
|
|
1679
1580
|
}
|
|
@@ -1702,10 +1603,13 @@ class FieldDescriptor extends FormElement {
|
|
|
1702
1603
|
case 'BOOLEAN':
|
|
1703
1604
|
newFinalValue = !!newValue;
|
|
1704
1605
|
break;
|
|
1705
|
-
case
|
|
1606
|
+
case this._formConfig.fieldTypes.boolean:
|
|
1706
1607
|
newFinalValue = !!newValue;
|
|
1707
1608
|
break;
|
|
1708
|
-
case
|
|
1609
|
+
case this._formConfig.fieldTypes.check:
|
|
1610
|
+
newFinalValue = !!newValue;
|
|
1611
|
+
break;
|
|
1612
|
+
case this._formConfig.fieldTypes.array:
|
|
1709
1613
|
if (newValue === null || newValue === '') {
|
|
1710
1614
|
newFinalValue = [];
|
|
1711
1615
|
}
|
|
@@ -1719,7 +1623,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1719
1623
|
newFinalValue = newValue;
|
|
1720
1624
|
}
|
|
1721
1625
|
break;
|
|
1722
|
-
case
|
|
1626
|
+
case this._formConfig.fieldTypes.map:
|
|
1723
1627
|
newFinalValue = newValue;
|
|
1724
1628
|
if (newFinalValue && this.widget && widgetUpdate) {
|
|
1725
1629
|
const latitude = parseFloat(newFinalValue[0]);
|
|
@@ -1727,7 +1631,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1727
1631
|
(_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
|
|
1728
1632
|
}
|
|
1729
1633
|
break;
|
|
1730
|
-
case
|
|
1634
|
+
case this._formConfig.fieldTypes.currency:
|
|
1731
1635
|
newFinalValue = formatCurrency(this._fieldValue);
|
|
1732
1636
|
break;
|
|
1733
1637
|
default:
|
|
@@ -1745,13 +1649,14 @@ class FieldDescriptor extends FormElement {
|
|
|
1745
1649
|
const HEADER = 'HEADER';
|
|
1746
1650
|
const NO_ERROR = '00';
|
|
1747
1651
|
class FormStructureAndData {
|
|
1748
|
-
constructor(definitionReceived) {
|
|
1652
|
+
constructor(definitionReceived, formConfig) {
|
|
1749
1653
|
this._fieldsObj = {};
|
|
1750
1654
|
this._actionsObj = {};
|
|
1751
1655
|
this._tableObj = {};
|
|
1752
1656
|
this._sectionsObj = {};
|
|
1753
1657
|
this._immutableData = {};
|
|
1754
1658
|
this._extraInfo = {};
|
|
1659
|
+
this._formConfig = formConfig;
|
|
1755
1660
|
this.state = '';
|
|
1756
1661
|
this._actions = [];
|
|
1757
1662
|
this._fields = [];
|
|
@@ -1785,7 +1690,7 @@ class FormStructureAndData {
|
|
|
1785
1690
|
return Object.assign(Object.assign({}, objDef), { visibleStates, enabledStates });
|
|
1786
1691
|
});
|
|
1787
1692
|
for (const actionReceived of formActions) {
|
|
1788
|
-
const globalAction = new FormAction(actionReceived);
|
|
1693
|
+
const globalAction = new FormAction(actionReceived, this._formConfig);
|
|
1789
1694
|
const globalActionCode = globalAction.actionCode;
|
|
1790
1695
|
if (globalActionCode) {
|
|
1791
1696
|
this._actions.push(globalAction);
|
|
@@ -1806,7 +1711,7 @@ class FormStructureAndData {
|
|
|
1806
1711
|
return Object.assign(Object.assign({}, objDef), { visibleStates, enabledStates });
|
|
1807
1712
|
});
|
|
1808
1713
|
for (const fieldReceived of formFields) {
|
|
1809
|
-
const fieldToAdd = new FieldDescriptor(fieldReceived);
|
|
1714
|
+
const fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
|
|
1810
1715
|
const fieldCode = fieldToAdd.fieldCode;
|
|
1811
1716
|
if (fieldCode) {
|
|
1812
1717
|
this._fields.push(fieldToAdd);
|
|
@@ -1825,12 +1730,12 @@ class FormStructureAndData {
|
|
|
1825
1730
|
enabledStates = [...visibleStates];
|
|
1826
1731
|
}
|
|
1827
1732
|
if (!visibleStates || visibleStates.length === 0) {
|
|
1828
|
-
visibleStates =
|
|
1733
|
+
visibleStates = this._formConfig.defaultStateFlow.states;
|
|
1829
1734
|
}
|
|
1830
1735
|
return Object.assign(Object.assign({}, objDef), { visibleStates, enabledStates });
|
|
1831
1736
|
});
|
|
1832
1737
|
for (const tableReceived of tables) {
|
|
1833
|
-
const tableToAdd = new RecordTable(tableReceived);
|
|
1738
|
+
const tableToAdd = new RecordTable(tableReceived, this._formConfig);
|
|
1834
1739
|
const tableCode = tableToAdd.tableCode;
|
|
1835
1740
|
if (tableCode) {
|
|
1836
1741
|
this._tables.push(tableToAdd);
|
|
@@ -1882,7 +1787,7 @@ class FormStructureAndData {
|
|
|
1882
1787
|
}
|
|
1883
1788
|
setStateFlow(states, transitions, defaultState) {
|
|
1884
1789
|
if (!states || !transitions) {
|
|
1885
|
-
this._stateFlow = JSON.parse(JSON.stringify(
|
|
1790
|
+
this._stateFlow = JSON.parse(JSON.stringify(this._formConfig.defaultStateFlow));
|
|
1886
1791
|
return;
|
|
1887
1792
|
}
|
|
1888
1793
|
this._stateFlow.states = states;
|
|
@@ -2311,71 +2216,77 @@ class LibFormManagerService {
|
|
|
2311
2216
|
constructor() {
|
|
2312
2217
|
this.cleanStack();
|
|
2313
2218
|
}
|
|
2314
|
-
|
|
2315
|
-
* Métodos virtuales de manejo de formularios
|
|
2316
|
-
*/
|
|
2219
|
+
// Métodos virtuales para las aplicaciones
|
|
2317
2220
|
getFormDefinition(formCode) { }
|
|
2221
|
+
getFormRoute(formCode) { }
|
|
2222
|
+
getRouteForm(path) { }
|
|
2318
2223
|
execServerAction(actionDetail) { }
|
|
2319
|
-
|
|
2320
|
-
/**
|
|
2321
|
-
* Manejo del stack de navegación con atributos estados y parámetros
|
|
2322
|
-
*/
|
|
2323
|
-
resetPageStack() { this.cleanStack(); }
|
|
2324
|
-
cleanStack() {
|
|
2325
|
-
this.pageStack = [];
|
|
2326
|
-
}
|
|
2224
|
+
goToForm(formCode, token, subject) { }
|
|
2327
2225
|
loadStack() { }
|
|
2328
2226
|
saveStack() { }
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
this.
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2227
|
+
cleanStack() { this.pageStack = []; }
|
|
2228
|
+
resetPageStack() { this.cleanStack(); }
|
|
2229
|
+
findFormInStack(token) {
|
|
2230
|
+
const index = this.pageStack.findIndex(item => (item === null || item === void 0 ? void 0 : item.token) === token);
|
|
2231
|
+
const data = (index >= 0) ? this.pageStack[index] : null;
|
|
2232
|
+
return { index, data };
|
|
2233
|
+
}
|
|
2234
|
+
replaceItem(token, formInfo) {
|
|
2235
|
+
var _a, _b;
|
|
2236
|
+
if (!token || !formInfo) {
|
|
2237
|
+
return;
|
|
2238
|
+
}
|
|
2239
|
+
const { index, data: storedForm } = this.findFormInStack(token);
|
|
2240
|
+
let updatedForm = null;
|
|
2241
|
+
if (index >= 0) {
|
|
2242
|
+
updatedForm = Object.assign({}, storedForm);
|
|
2243
|
+
updatedForm.subject = (_a = formInfo === null || formInfo === void 0 ? void 0 : formInfo.subject) !== null && _a !== void 0 ? _a : storedForm.subject;
|
|
2244
|
+
updatedForm.state = (_b = formInfo === null || formInfo === void 0 ? void 0 : formInfo.state) !== null && _b !== void 0 ? _b : storedForm.state;
|
|
2245
|
+
Object.assign(updatedForm.fields, formInfo.fields);
|
|
2246
|
+
Object.assign(updatedForm.extra, formInfo.extra);
|
|
2247
|
+
this.pageStack[index] = updatedForm;
|
|
2341
2248
|
this.saveStack();
|
|
2342
|
-
return formData;
|
|
2343
2249
|
}
|
|
2344
2250
|
}
|
|
2345
|
-
|
|
2346
|
-
const
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2251
|
+
stack(origin, target) {
|
|
2252
|
+
const token = nanoid(6);
|
|
2253
|
+
this.replaceItem(target.originToken, origin);
|
|
2254
|
+
this.pageStack.push(Object.assign({ token }, target));
|
|
2255
|
+
this.saveStack();
|
|
2256
|
+
return token;
|
|
2257
|
+
}
|
|
2258
|
+
unstack(token = null) {
|
|
2259
|
+
let index = (token) ? this.findFormInStack(token).index : this.pageStack.length - 2;
|
|
2260
|
+
let formInfo = null;
|
|
2261
|
+
if (index >= 0) {
|
|
2262
|
+
formInfo = this.pageStack[index];
|
|
2263
|
+
this.pageStack.splice(index + 1);
|
|
2264
|
+
this.saveStack();
|
|
2350
2265
|
}
|
|
2351
|
-
return
|
|
2266
|
+
return formInfo;
|
|
2352
2267
|
}
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2268
|
+
getFormInfo(token) {
|
|
2269
|
+
var _a, _b;
|
|
2270
|
+
const { data } = this.findFormInStack(token);
|
|
2271
|
+
return {
|
|
2272
|
+
token: data === null || data === void 0 ? void 0 : data.token,
|
|
2273
|
+
subject: data === null || data === void 0 ? void 0 : data.subject,
|
|
2274
|
+
state: data === null || data === void 0 ? void 0 : data.state,
|
|
2275
|
+
originToken: data === null || data === void 0 ? void 0 : data.originToken,
|
|
2276
|
+
fields: (_a = data === null || data === void 0 ? void 0 : data.fields) !== null && _a !== void 0 ? _a : {},
|
|
2277
|
+
extra: (_b = data === null || data === void 0 ? void 0 : data.extra) !== null && _b !== void 0 ? _b : {}
|
|
2278
|
+
};
|
|
2360
2279
|
}
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
const
|
|
2366
|
-
|
|
2367
|
-
const navigationArray = [url, ...params, newToken];
|
|
2368
|
-
this.goToRoute(navigationArray);
|
|
2280
|
+
openForm(origin, target) {
|
|
2281
|
+
var _a;
|
|
2282
|
+
(!origin) && this.cleanStack();
|
|
2283
|
+
target.originToken = (_a = origin === null || origin === void 0 ? void 0 : origin.token) !== null && _a !== void 0 ? _a : null;
|
|
2284
|
+
const token = this.stack(origin, target);
|
|
2285
|
+
this.goToForm(target.name, token, target.subject);
|
|
2369
2286
|
}
|
|
2370
|
-
|
|
2371
|
-
const
|
|
2372
|
-
|
|
2373
|
-
return;
|
|
2374
|
-
}
|
|
2375
|
-
const { origin: { url, params, token } } = prevForm;
|
|
2376
|
-
const navigationArray = [url, ...params];
|
|
2377
|
-
token && navigationArray.push(token);
|
|
2378
|
-
this.goToRoute(navigationArray);
|
|
2287
|
+
backTo(targetToken = null) {
|
|
2288
|
+
const formInfo = this.unstack(targetToken);
|
|
2289
|
+
formInfo && formInfo.name && this.goToForm(formInfo.name, formInfo.token, formInfo.subject);
|
|
2379
2290
|
}
|
|
2380
2291
|
}
|
|
2381
2292
|
|
|
@@ -2406,11 +2317,8 @@ const PAYLOAD_VERSION = 'TUAINEXCHANGE_1.0';
|
|
|
2406
2317
|
const INLINE_ACTION = 'INLINE';
|
|
2407
2318
|
const GLOBAL_ACTION = 'GLOBAL';
|
|
2408
2319
|
const GET_DATA_ACTION = 'GETDATA';
|
|
2409
|
-
const
|
|
2410
|
-
const
|
|
2411
|
-
const ORIGIN_PARAM = 'origin';
|
|
2412
|
-
const STATE_PARAM = 'mode';
|
|
2413
|
-
const REQUIRED_FIELD_MESSAGE = 'Campo requerido';
|
|
2320
|
+
const SUBJECT = 'subject';
|
|
2321
|
+
const TOKEN = 'token';
|
|
2414
2322
|
class BasicFormComponent {
|
|
2415
2323
|
constructor(formManagerService, _eventManager, fileMgmtServices) {
|
|
2416
2324
|
this.formManagerService = formManagerService;
|
|
@@ -2420,10 +2328,9 @@ class BasicFormComponent {
|
|
|
2420
2328
|
this.errorMessage = '';
|
|
2421
2329
|
this.errorDetail = '';
|
|
2422
2330
|
this.formStructure = null;
|
|
2423
|
-
this.
|
|
2424
|
-
this.inputDataFields =
|
|
2425
|
-
this.extraData =
|
|
2426
|
-
this.componentConstants = componentConstants;
|
|
2331
|
+
this.controlToken = null;
|
|
2332
|
+
this.inputDataFields = {};
|
|
2333
|
+
this.extraData = {};
|
|
2427
2334
|
this.definitionObtained = false;
|
|
2428
2335
|
this.formVisible = false;
|
|
2429
2336
|
this.inServerProcess = false;
|
|
@@ -2445,14 +2352,17 @@ class BasicFormComponent {
|
|
|
2445
2352
|
this.cleanStart();
|
|
2446
2353
|
this.customPreProcessing();
|
|
2447
2354
|
}
|
|
2355
|
+
setConfig(formConfig) {
|
|
2356
|
+
this.formConfig = formConfig;
|
|
2357
|
+
}
|
|
2448
2358
|
cleanStart() {
|
|
2449
2359
|
this._errorType = '';
|
|
2450
2360
|
this.errorCode = '';
|
|
2451
2361
|
this.errorMessage = '';
|
|
2452
2362
|
this.errorDetail = '';
|
|
2453
2363
|
this.formStructure = null;
|
|
2454
|
-
this.
|
|
2455
|
-
this.inputDataFields =
|
|
2364
|
+
this.controlToken = null;
|
|
2365
|
+
this.inputDataFields = {};
|
|
2456
2366
|
this.definitionObtained = false;
|
|
2457
2367
|
// Se limpian los manejadores de eventos
|
|
2458
2368
|
this.formVisible = false;
|
|
@@ -2601,35 +2511,61 @@ class BasicFormComponent {
|
|
|
2601
2511
|
subscribeAppEvent(eventName, callback) {
|
|
2602
2512
|
this._eventEmiter.subscribe(eventName, callback);
|
|
2603
2513
|
}
|
|
2514
|
+
openForm(name, data = null, backData = null, cleanStack = false) {
|
|
2515
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2516
|
+
let origin = null;
|
|
2517
|
+
if (!cleanStack) {
|
|
2518
|
+
origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this.controlToken });
|
|
2519
|
+
origin.subject = (_a = origin === null || origin === void 0 ? void 0 : origin.subject) !== null && _a !== void 0 ? _a : this.formSubject;
|
|
2520
|
+
origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.currentState;
|
|
2521
|
+
origin.fields = (_c = origin === null || origin === void 0 ? void 0 : origin.fields) !== null && _c !== void 0 ? _c : {};
|
|
2522
|
+
origin.extra = (_d = origin === null || origin === void 0 ? void 0 : origin.extra) !== null && _d !== void 0 ? _d : {};
|
|
2523
|
+
}
|
|
2524
|
+
const target = Object.assign(Object.assign({}, data), { name });
|
|
2525
|
+
target.subject = (_e = target === null || target === void 0 ? void 0 : target.subject) !== null && _e !== void 0 ? _e : null;
|
|
2526
|
+
target.state = (_f = target === null || target === void 0 ? void 0 : target.state) !== null && _f !== void 0 ? _f : null;
|
|
2527
|
+
target.fields = (_g = target === null || target === void 0 ? void 0 : target.fields) !== null && _g !== void 0 ? _g : {};
|
|
2528
|
+
target.extra = (_h = target === null || target === void 0 ? void 0 : target.extra) !== null && _h !== void 0 ? _h : {};
|
|
2529
|
+
this.formManagerService.openForm(origin, target);
|
|
2530
|
+
}
|
|
2531
|
+
/**
|
|
2532
|
+
* @deprecated Este método ya no debería ser utilizado. Use openForm con el nombre del formulario
|
|
2533
|
+
*/
|
|
2604
2534
|
goToPage(navigationArray, predefinedFields, options = null) {
|
|
2605
|
-
var _a
|
|
2535
|
+
var _a;
|
|
2606
2536
|
let origin = null;
|
|
2607
2537
|
const cleanStack = (_a = options === null || options === void 0 ? void 0 : options.cleanStack) !== null && _a !== void 0 ? _a : false;
|
|
2608
|
-
const params = [];
|
|
2609
|
-
this.currentState && params.push(this.currentState);
|
|
2610
|
-
this.formSubject && params.push(this.formSubject);
|
|
2611
2538
|
if (!cleanStack) {
|
|
2612
2539
|
origin = {
|
|
2613
|
-
|
|
2540
|
+
name: this.name,
|
|
2614
2541
|
url: this._formRoute,
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2542
|
+
token: this.controlToken,
|
|
2543
|
+
fields: this.inputDataFields,
|
|
2544
|
+
extra: this.extraData
|
|
2618
2545
|
};
|
|
2619
2546
|
}
|
|
2620
2547
|
const target = {
|
|
2548
|
+
name: this.formManagerService.getRouteForm(navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[0]),
|
|
2621
2549
|
url: navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[0],
|
|
2622
|
-
|
|
2623
|
-
|
|
2550
|
+
state: navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[1],
|
|
2551
|
+
subject: navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[2],
|
|
2552
|
+
fields: predefinedFields,
|
|
2553
|
+
extra: null,
|
|
2624
2554
|
};
|
|
2625
|
-
this.formManagerService.
|
|
2555
|
+
this.formManagerService.openForm(origin, target);
|
|
2626
2556
|
}
|
|
2557
|
+
/**
|
|
2558
|
+
* @deprecated Este método ya no debería ser utilizado. Use openForm con el nombre del formulario
|
|
2559
|
+
*/
|
|
2627
2560
|
goToNewPage(nav, flds) { return this.goToPage(nav, flds, { cleanStack: true }); }
|
|
2561
|
+
/**
|
|
2562
|
+
* @deprecated Este método ya no debería ser utilizado. Use openForm con el nombre del formulario
|
|
2563
|
+
*/
|
|
2628
2564
|
goToSubPage(nav, flds) { return this.goToPage(nav, flds, { cleanStack: false }); }
|
|
2629
|
-
canGoBack() { return this.
|
|
2630
|
-
goBack() { return this.formManagerService.
|
|
2565
|
+
canGoBack() { return this.originToken !== null; }
|
|
2566
|
+
goBack() { return this.formManagerService.backTo(); }
|
|
2631
2567
|
goBackForm() { return this.goBack(); }
|
|
2632
|
-
getOriginDetail() { return this.formManagerService.
|
|
2568
|
+
getOriginDetail() { return this.formManagerService.getFormInfo(this.originToken); }
|
|
2633
2569
|
setError(errorType, errorMessage, errorDetail) {
|
|
2634
2570
|
this._errorType = errorType || '';
|
|
2635
2571
|
this.errorMessage = errorMessage || '';
|
|
@@ -2649,33 +2585,23 @@ class BasicFormComponent {
|
|
|
2649
2585
|
get formCode() { return this.name; }
|
|
2650
2586
|
set formCode(name) { this.name = name; }
|
|
2651
2587
|
getFormParameter(name) {
|
|
2652
|
-
|
|
2588
|
+
var _a, _b;
|
|
2589
|
+
return (name) ? ((_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null) : null;
|
|
2653
2590
|
}
|
|
2654
2591
|
getSubject() { return this.formSubject; }
|
|
2655
2592
|
getformSubject() { return this.getSubject(); }
|
|
2656
2593
|
preocessInputParams(params) {
|
|
2657
|
-
var _a, _b, _c
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
this.extraData = [];
|
|
2663
|
-
for (const paramName of allParams) {
|
|
2664
|
-
this.extraData[paramName] = params[paramName].toString();
|
|
2665
|
-
}
|
|
2666
|
-
const formName = (_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[FORM_CODE]) !== null && _b !== void 0 ? _b : this.name;
|
|
2667
|
-
if (formName !== this.name) {
|
|
2668
|
-
this.cleanStart();
|
|
2669
|
-
this.name = formName;
|
|
2670
|
-
}
|
|
2671
|
-
this.formSubject = (_d = (_c = this.extraData) === null || _c === void 0 ? void 0 : _c[FORM_SUBJECT]) !== null && _d !== void 0 ? _d : null;
|
|
2672
|
-
const initialState = this.extraData[STATE_PARAM];
|
|
2673
|
-
this.transitionToken = (_e = this.extraData[ORIGIN_PARAM]) !== null && _e !== void 0 ? _e : null;
|
|
2674
|
-
this.inputDataFields = (_f = this.formManagerService.getInputData(this.transitionToken)) !== null && _f !== void 0 ? _f : [];
|
|
2675
|
-
if (!this.transitionToken) {
|
|
2676
|
-
this.formManagerService.cleanStack();
|
|
2594
|
+
var _a, _b, _c;
|
|
2595
|
+
this.controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
|
|
2596
|
+
const { token, subject, state, fields, extra, originToken } = this.formManagerService.getFormInfo(this.controlToken);
|
|
2597
|
+
if (!this.controlToken || this.controlToken !== token) {
|
|
2598
|
+
console.log(`No se obtuvo un token válido para abrir el formulario ${this.controlToken}->${token}`);
|
|
2677
2599
|
}
|
|
2678
|
-
|
|
2600
|
+
this.formSubject = (_c = (_b = params === null || params === void 0 ? void 0 : params[SUBJECT]) !== null && _b !== void 0 ? _b : subject) !== null && _c !== void 0 ? _c : null;
|
|
2601
|
+
this.inputDataFields = fields;
|
|
2602
|
+
this.extraData = extra;
|
|
2603
|
+
this.originToken = originToken;
|
|
2604
|
+
return state;
|
|
2679
2605
|
}
|
|
2680
2606
|
subscribeSectionActivation() {
|
|
2681
2607
|
const formSections = this.formStructure.getSections();
|
|
@@ -2723,7 +2649,6 @@ class BasicFormComponent {
|
|
|
2723
2649
|
}
|
|
2724
2650
|
}
|
|
2725
2651
|
formInit(params) {
|
|
2726
|
-
var _a;
|
|
2727
2652
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2728
2653
|
let initialState = this.preocessInputParams(params);
|
|
2729
2654
|
if (!this.name) {
|
|
@@ -2733,7 +2658,7 @@ class BasicFormComponent {
|
|
|
2733
2658
|
this.inServerProcess = true;
|
|
2734
2659
|
const formDefinition = yield this.formManagerService.getFormDefinition(this.name);
|
|
2735
2660
|
this.inServerProcess = false;
|
|
2736
|
-
this.formStructure = new FormStructureAndData(formDefinition);
|
|
2661
|
+
this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
2737
2662
|
this.definitionObtained = true;
|
|
2738
2663
|
}
|
|
2739
2664
|
else {
|
|
@@ -2743,23 +2668,13 @@ class BasicFormComponent {
|
|
|
2743
2668
|
initialState = this.formStructure.defaultState;
|
|
2744
2669
|
}
|
|
2745
2670
|
this.formStructure.changeState(initialState || this.formStructure.defaultState);
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
}
|
|
2752
|
-
}
|
|
2753
|
-
}
|
|
2754
|
-
else {
|
|
2755
|
-
const fieldCodes = Object.keys((_a = this.inputDataFields) !== null && _a !== void 0 ? _a : {});
|
|
2756
|
-
for (let index = 0; index < fieldCodes.length; index++) {
|
|
2757
|
-
const fieldCode = fieldCodes[index];
|
|
2758
|
-
const fieldValue = this.inputDataFields[fieldCode];
|
|
2759
|
-
this.setFieldValue(fieldCode, fieldValue);
|
|
2760
|
-
}
|
|
2671
|
+
const inputFieldNames = Object.keys(this.inputDataFields);
|
|
2672
|
+
for (let index = 0; index < inputFieldNames.length; index++) {
|
|
2673
|
+
const fieldCode = inputFieldNames[index];
|
|
2674
|
+
const fieldValue = this.inputDataFields[fieldCode];
|
|
2675
|
+
this.setFieldValue(fieldCode, fieldValue);
|
|
2761
2676
|
}
|
|
2762
|
-
const recordResponse = yield this.requestFormAction(
|
|
2677
|
+
const recordResponse = yield this.requestFormAction(formActions.getData);
|
|
2763
2678
|
this.checkErrorRecordReceived(recordResponse);
|
|
2764
2679
|
this.formVisible = true;
|
|
2765
2680
|
this.subscribeSectionActivation();
|
|
@@ -2779,7 +2694,7 @@ class BasicFormComponent {
|
|
|
2779
2694
|
this.errorDetail = recordResponse.errorDetail;
|
|
2780
2695
|
}
|
|
2781
2696
|
errorOccured() {
|
|
2782
|
-
return (this.errorCode !==
|
|
2697
|
+
return (this.errorCode !== '00');
|
|
2783
2698
|
}
|
|
2784
2699
|
changeState(state) { return this.formStructure.changeState(state); }
|
|
2785
2700
|
changeFormMode(state) { return this.changeState(state); }
|
|
@@ -3060,7 +2975,7 @@ class BasicFormComponent {
|
|
|
3060
2975
|
if (fieldObj.backend) {
|
|
3061
2976
|
fieldObj.validating = true;
|
|
3062
2977
|
validationResult = yield this
|
|
3063
|
-
.requestFormAction(
|
|
2978
|
+
.requestFormAction(formActions.validate, fieldObj.fieldCode);
|
|
3064
2979
|
finish = !this.errorOccured();
|
|
3065
2980
|
}
|
|
3066
2981
|
if (finish) {
|
|
@@ -3249,7 +3164,7 @@ class BasicFormComponent {
|
|
|
3249
3164
|
actionCode
|
|
3250
3165
|
};
|
|
3251
3166
|
actionResult = yield this
|
|
3252
|
-
.requestFormAction(
|
|
3167
|
+
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3253
3168
|
finish = !this.errorOccured();
|
|
3254
3169
|
}
|
|
3255
3170
|
if (finish) {
|
|
@@ -3326,13 +3241,13 @@ class BasicFormComponent {
|
|
|
3326
3241
|
if (action.backend) {
|
|
3327
3242
|
const actionSubject = {
|
|
3328
3243
|
tableCode,
|
|
3329
|
-
actionType:
|
|
3244
|
+
actionType: this.formConfig.tableActions.inline,
|
|
3330
3245
|
actionCode,
|
|
3331
3246
|
tableRecordId: recordId,
|
|
3332
3247
|
tableRecordData: recordData
|
|
3333
3248
|
};
|
|
3334
3249
|
actionResult = yield this
|
|
3335
|
-
.requestFormAction(
|
|
3250
|
+
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3336
3251
|
finish = !this.errorOccured();
|
|
3337
3252
|
}
|
|
3338
3253
|
if (finish) {
|
|
@@ -3405,13 +3320,13 @@ class BasicFormComponent {
|
|
|
3405
3320
|
if (tableObject.selectionBackend) {
|
|
3406
3321
|
const actionSubject = {
|
|
3407
3322
|
tableCode,
|
|
3408
|
-
actionType:
|
|
3323
|
+
actionType: this.formConfig.tableActions.rowSelection,
|
|
3409
3324
|
actionCode: null,
|
|
3410
3325
|
tableRecordId: recordId,
|
|
3411
3326
|
tableRecordData: recordData
|
|
3412
3327
|
};
|
|
3413
3328
|
actionResult = yield this
|
|
3414
|
-
.requestFormAction(
|
|
3329
|
+
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3415
3330
|
finish = !this.errorOccured();
|
|
3416
3331
|
}
|
|
3417
3332
|
if (finish) {
|
|
@@ -3485,12 +3400,12 @@ class BasicFormComponent {
|
|
|
3485
3400
|
if (action.backend) {
|
|
3486
3401
|
const actionSubject = {
|
|
3487
3402
|
tableCode,
|
|
3488
|
-
actionType:
|
|
3403
|
+
actionType: this.formConfig.tableActions.selection,
|
|
3489
3404
|
actionCode,
|
|
3490
3405
|
selectedRecords
|
|
3491
3406
|
};
|
|
3492
3407
|
actionResult = yield this
|
|
3493
|
-
.requestFormAction(
|
|
3408
|
+
.requestFormAction(formActions.tableAction, actionSubject);
|
|
3494
3409
|
finish = !this.errorOccured();
|
|
3495
3410
|
}
|
|
3496
3411
|
if (finish) {
|
|
@@ -3548,7 +3463,7 @@ class BasicFormComponent {
|
|
|
3548
3463
|
tableObject.putOnWait();
|
|
3549
3464
|
const actionSubject = { tableCode };
|
|
3550
3465
|
const actionResult = yield this
|
|
3551
|
-
.requestFormAction(
|
|
3466
|
+
.requestFormAction(formActions.getTableData, actionSubject);
|
|
3552
3467
|
if (this.errorOccured()) {
|
|
3553
3468
|
this.displayTableServerError();
|
|
3554
3469
|
}
|
|
@@ -3574,7 +3489,7 @@ class BasicFormComponent {
|
|
|
3574
3489
|
}
|
|
3575
3490
|
checkSectionRequiredFields(sectionCode, reqFieldMessage) {
|
|
3576
3491
|
this.cleanErrorFields(null, sectionCode);
|
|
3577
|
-
const requiredFieldMessage = reqFieldMessage
|
|
3492
|
+
const requiredFieldMessage = reqFieldMessage !== null && reqFieldMessage !== void 0 ? reqFieldMessage : this.formConfig.formStandardErrors.requiredField;
|
|
3578
3493
|
const numErrors = this.tagFieldsWithError(this.getRequiredEmptyFields(null, sectionCode), null, requiredFieldMessage);
|
|
3579
3494
|
return (numErrors === 0);
|
|
3580
3495
|
}
|
|
@@ -3582,15 +3497,15 @@ class BasicFormComponent {
|
|
|
3582
3497
|
this.resetError();
|
|
3583
3498
|
const completeFields = this.checkSectionRequiredFields(sectionCode, reqFieldMessage);
|
|
3584
3499
|
if (!completeFields) {
|
|
3585
|
-
this.setError(
|
|
3500
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
3586
3501
|
return;
|
|
3587
3502
|
}
|
|
3588
3503
|
let validationError = false;
|
|
3589
3504
|
const requiredEmptyFields = this.getRequiredEmptyFields(null, sectionCode);
|
|
3590
3505
|
if (requiredEmptyFields.length > 0) {
|
|
3591
3506
|
validationError = true;
|
|
3592
|
-
this.setError(
|
|
3593
|
-
this.tagFieldsWithError(requiredEmptyFields, null,
|
|
3507
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
3508
|
+
this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
|
|
3594
3509
|
for (const fieldCode of requiredEmptyFields) {
|
|
3595
3510
|
const requiredEmptyField = this.getField(fieldCode);
|
|
3596
3511
|
if (requiredEmptyField && requiredEmptyField.widget
|
|
@@ -3603,7 +3518,7 @@ class BasicFormComponent {
|
|
|
3603
3518
|
const validationIssueFields = this.getFieldsWithValidationIssues(null, sectionCode);
|
|
3604
3519
|
if (!validationError && validationIssueFields.length > 0) {
|
|
3605
3520
|
validationError = true;
|
|
3606
|
-
this.setError(
|
|
3521
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
3607
3522
|
for (const fieldCode of validationIssueFields) {
|
|
3608
3523
|
const validationIssueField = this.getField(fieldCode);
|
|
3609
3524
|
if (validationIssueField && validationIssueField.widget
|
|
@@ -3719,13 +3634,13 @@ class BasicFormComponent {
|
|
|
3719
3634
|
const requiredEmptyFields = this.getRequiredEmptyFields(recordCaptureFields, null);
|
|
3720
3635
|
if (requiredEmptyFields.length > 0) {
|
|
3721
3636
|
validationOk = false;
|
|
3722
|
-
this.setError(
|
|
3723
|
-
this.tagFieldsWithError(requiredEmptyFields, null,
|
|
3637
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
3638
|
+
this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
|
|
3724
3639
|
}
|
|
3725
3640
|
const validationIssueFields = this.getFieldsWithValidationIssues(recordCaptureFields, null);
|
|
3726
3641
|
if (validationIssueFields.length > 0) {
|
|
3727
3642
|
validationOk = false;
|
|
3728
|
-
this.setError(
|
|
3643
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
3729
3644
|
}
|
|
3730
3645
|
return validationOk;
|
|
3731
3646
|
}
|