tuain-ng-forms-lib 12.0.23 → 12.0.27
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 +1530 -1700
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/action.js +3 -4
- package/esm2015/lib/classes/forms/element.js +14 -2
- package/esm2015/lib/classes/forms/field.js +14 -22
- package/esm2015/lib/classes/forms/form.js +243 -393
- package/esm2015/lib/classes/forms/section.js +7 -1
- package/esm2015/lib/classes/forms/table/row-data.js +6 -26
- package/esm2015/lib/classes/forms/table/table.js +3 -4
- package/esm2015/lib/components/forms/basic-form.js +522 -398
- package/fesm2015/tuain-ng-forms-lib.js +996 -1086
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/action.d.ts +0 -2
- package/lib/classes/forms/element.d.ts +16 -6
- package/lib/classes/forms/field.d.ts +4 -3
- package/lib/classes/forms/form.d.ts +105 -92
- package/lib/classes/forms/section.d.ts +5 -0
- package/lib/classes/forms/table/row-data.d.ts +0 -1
- package/lib/classes/forms/table/table.d.ts +0 -1
- package/lib/components/forms/basic-form.d.ts +188 -159
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
- package/esm2015/lib/classes/utilities.js +0 -54
- package/lib/classes/utilities.d.ts +0 -1
|
@@ -285,7 +285,7 @@ const operators = {
|
|
|
285
285
|
|
|
286
286
|
class FormElement {
|
|
287
287
|
constructor(elementDefinition, formConfig) {
|
|
288
|
-
var _a, _b;
|
|
288
|
+
var _a, _b, _c;
|
|
289
289
|
this._formConfig = formConfig;
|
|
290
290
|
this._isForced = false;
|
|
291
291
|
this.setVisibleStates(elementDefinition.visibleStates);
|
|
@@ -294,7 +294,13 @@ class FormElement {
|
|
|
294
294
|
this.disabled = (_a = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.disabled) !== null && _a !== void 0 ? _a : false;
|
|
295
295
|
this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
|
|
296
296
|
this.widget = null;
|
|
297
|
+
this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : null;
|
|
297
298
|
}
|
|
299
|
+
getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
|
|
300
|
+
setCustomAttribute(name, value) { if (name) {
|
|
301
|
+
this.customAttributes[name] = value;
|
|
302
|
+
} }
|
|
303
|
+
matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
|
|
298
304
|
isField() { return this.elementType === elementTypes.field; }
|
|
299
305
|
isAction() { return this.elementType === elementTypes.action; }
|
|
300
306
|
isTable() { return this.elementType === elementTypes.table; }
|
|
@@ -312,7 +318,13 @@ class FormElement {
|
|
|
312
318
|
}
|
|
313
319
|
viewOnState(state) { return (this.visibleStates && state) ? this.visibleStates.includes(state) : false; }
|
|
314
320
|
enabledOnState(state) { return (this.enabledStates && state) ? this.enabledStates.includes(state) : false; }
|
|
321
|
+
/**
|
|
322
|
+
* @deprecated Utilizar viewOnState
|
|
323
|
+
*/
|
|
315
324
|
supportState(state) { return this.viewOnState(state); }
|
|
325
|
+
/**
|
|
326
|
+
* @deprecated Utilizar viewOnState
|
|
327
|
+
*/
|
|
316
328
|
supportMode(state) { return this.viewOnState(state); }
|
|
317
329
|
get visible() { return (this._isForced) ? this._visibleForced : this._visible; }
|
|
318
330
|
set visible(visible) { this.setVisibility(visible); }
|
|
@@ -389,62 +401,6 @@ class TableAction {
|
|
|
389
401
|
enabledOnState(state) { return this.enabledStates.includes(state); }
|
|
390
402
|
}
|
|
391
403
|
|
|
392
|
-
function formatCurrency(inputValue) {
|
|
393
|
-
if (!inputValue) {
|
|
394
|
-
return null;
|
|
395
|
-
}
|
|
396
|
-
const numeralDecimalMark = '.';
|
|
397
|
-
const numeralPositiveOnly = false;
|
|
398
|
-
const stripLeadingZeroes = true;
|
|
399
|
-
const numeralIntegerScale = 12;
|
|
400
|
-
const numeralDecimalScale = 2;
|
|
401
|
-
const delimiter = ',';
|
|
402
|
-
let parts;
|
|
403
|
-
let partInteger;
|
|
404
|
-
let partDecimal = '';
|
|
405
|
-
// Se eliminan los caracteres alfabéticos
|
|
406
|
-
let outputValue = inputValue.toString();
|
|
407
|
-
if (!outputValue) {
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Se remplaza el primer caracter de marca decimal con el marcador reservado
|
|
412
|
-
* Se eliminan los caractertes no numéricos excepto el signo menos y 'M'
|
|
413
|
-
* utilizado como separador decimal en este punto, eliminando los prefijos
|
|
414
|
-
* Se remplaza el caracter menos por un marcador resertvado
|
|
415
|
-
* Se eliminan todos los demás caracteres menos en caso de estar presentes
|
|
416
|
-
* Se remplaza el marcador de caracter menos (si está presente)
|
|
417
|
-
* Se remplaza el marcador de separación decimal
|
|
418
|
-
*/
|
|
419
|
-
let value = outputValue.replace(/[A-Za-z]/g, '')
|
|
420
|
-
.replace(numeralDecimalMark, 'M')
|
|
421
|
-
.replace(/[^\dM-]/g, '')
|
|
422
|
-
.replace(/^\-/, 'N')
|
|
423
|
-
.replace(/\-/g, '')
|
|
424
|
-
.replace('N', numeralPositiveOnly ? '' : '-')
|
|
425
|
-
.replace('M', numeralDecimalMark);
|
|
426
|
-
// Se eliminan los ceros a la izquierda
|
|
427
|
-
if (stripLeadingZeroes) {
|
|
428
|
-
value = value.replace(/^(-)?0+(?=\d)/, '$1');
|
|
429
|
-
}
|
|
430
|
-
// Se separa la parte entera de la parte decimal
|
|
431
|
-
partInteger = value;
|
|
432
|
-
if (value.indexOf(numeralDecimalMark) >= 0) {
|
|
433
|
-
parts = value.split(numeralDecimalMark);
|
|
434
|
-
partInteger = parts[0];
|
|
435
|
-
partDecimal = numeralDecimalMark + parts[1].slice(0, numeralDecimalScale);
|
|
436
|
-
}
|
|
437
|
-
if (numeralIntegerScale > 0) {
|
|
438
|
-
partInteger = partInteger.slice(0, numeralIntegerScale + (value.slice(0, 1) === '-' ? 1 : 0));
|
|
439
|
-
}
|
|
440
|
-
// Se separan los digitos de acuerdo a la configuraciñon de agrupación
|
|
441
|
-
partInteger = partInteger.replace(/(\d)(?=(\d{3})+$)/g, '$1' + delimiter);
|
|
442
|
-
outputValue = partInteger.toString() + (numeralDecimalScale > 0 ? partDecimal.toString() : '');
|
|
443
|
-
return outputValue;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
const DATE_TYPE = 'DATE';
|
|
447
|
-
const CURRENCY_TYPE = 'CURRENCY';
|
|
448
404
|
class TableRecordData {
|
|
449
405
|
constructor(recordReceived, recordDefinition, selectionFieldName = null) {
|
|
450
406
|
this.recordData = {};
|
|
@@ -461,8 +417,7 @@ class TableRecordData {
|
|
|
461
417
|
rawRecordData.forEach(fieldData => {
|
|
462
418
|
const { fieldCode, fieldValue } = fieldData;
|
|
463
419
|
const fieldDef = recordDefinition.find(column => column.fieldCode === fieldCode);
|
|
464
|
-
|
|
465
|
-
this.recordData[fieldCode] = formattedFieldValue;
|
|
420
|
+
this.recordData[fieldCode] = fieldValue !== null && fieldValue !== void 0 ? fieldValue : '';
|
|
466
421
|
if (fieldCode === selectionFieldName) {
|
|
467
422
|
this.selected = fieldValue;
|
|
468
423
|
}
|
|
@@ -473,29 +428,13 @@ class TableRecordData {
|
|
|
473
428
|
fields.forEach(fieldCode => {
|
|
474
429
|
const fieldValue = recordData[fieldCode];
|
|
475
430
|
const fieldDef = recordDefinition.find(column => column.fieldCode === fieldCode);
|
|
476
|
-
|
|
477
|
-
this.recordData[fieldCode] = formattedFieldValue;
|
|
431
|
+
this.recordData[fieldCode] = fieldValue !== null && fieldValue !== void 0 ? fieldValue : '';
|
|
478
432
|
});
|
|
479
433
|
}
|
|
480
434
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
else if (fieldType === DATE_TYPE && fieldValue) {
|
|
486
|
-
return new Date(fieldValue).toISOString().split('T')[0];
|
|
487
|
-
}
|
|
488
|
-
return fieldValue || '';
|
|
489
|
-
}
|
|
490
|
-
toggleSelect() {
|
|
491
|
-
this.selected = !this.selected;
|
|
492
|
-
}
|
|
493
|
-
select() {
|
|
494
|
-
this.selected = true;
|
|
495
|
-
}
|
|
496
|
-
unselect() {
|
|
497
|
-
this.selected = false;
|
|
498
|
-
}
|
|
435
|
+
toggleSelect() { this.selected = !this.selected; }
|
|
436
|
+
select() { this.selected = true; }
|
|
437
|
+
unselect() { this.selected = false; }
|
|
499
438
|
get recordIdKey() {
|
|
500
439
|
return (typeof this.recordId === 'object')
|
|
501
440
|
? JSON.stringify(this.recordId) : this.recordId;
|
|
@@ -576,7 +515,7 @@ const TABLE_FILTER_TYPES = {
|
|
|
576
515
|
};
|
|
577
516
|
class RecordTable extends FormElement {
|
|
578
517
|
constructor(tableReceived, formConfig) {
|
|
579
|
-
var _a, _b, _c, _d, _e, _f
|
|
518
|
+
var _a, _b, _c, _d, _e, _f;
|
|
580
519
|
super(tableReceived, formConfig);
|
|
581
520
|
this._inlineActionTrigger = new Subject();
|
|
582
521
|
this._globalActionTrigger = new Subject();
|
|
@@ -609,8 +548,7 @@ class RecordTable extends FormElement {
|
|
|
609
548
|
this._appendPages = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.append) !== null && _c !== void 0 ? _c : false;
|
|
610
549
|
this.selectable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _d !== void 0 ? _d : false;
|
|
611
550
|
this.setAttr('selectionBackend', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _e !== void 0 ? _e : false);
|
|
612
|
-
this.
|
|
613
|
-
this.setAttr('sortable', (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false);
|
|
551
|
+
this.setAttr('sortable', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _f !== void 0 ? _f : false);
|
|
614
552
|
this.setAttr('sorting', { columnName: '', direction: '' });
|
|
615
553
|
this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
|
|
616
554
|
if (tableReceived.fields) {
|
|
@@ -1166,176 +1104,10 @@ LibTableComponent.propDecorators = {
|
|
|
1166
1104
|
waiting: [{ type: Input }]
|
|
1167
1105
|
};
|
|
1168
1106
|
|
|
1169
|
-
class RecordFormSubSection {
|
|
1170
|
-
constructor(subsectionReceived, formObject) {
|
|
1171
|
-
if (!subsectionReceived) {
|
|
1172
|
-
return;
|
|
1173
|
-
}
|
|
1174
|
-
this._customRender = null;
|
|
1175
|
-
this.visible = true;
|
|
1176
|
-
this.subSectionElements = [];
|
|
1177
|
-
this.subSectionFields = [];
|
|
1178
|
-
this.subSectionTables = [];
|
|
1179
|
-
this.subSectionActions = [];
|
|
1180
|
-
this.elementsArray = {};
|
|
1181
|
-
this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
|
|
1182
|
-
this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
|
|
1183
|
-
this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
|
|
1184
|
-
this.visibleStates = subsectionReceived.visibleStates || [];
|
|
1185
|
-
if (subsectionReceived.elements) {
|
|
1186
|
-
for (const receivedElement of subsectionReceived.elements) {
|
|
1187
|
-
let elementObject = null;
|
|
1188
|
-
let arrayToAdd = null;
|
|
1189
|
-
const { type, code } = receivedElement;
|
|
1190
|
-
switch (type) {
|
|
1191
|
-
case elementTypes.field:
|
|
1192
|
-
elementObject = formObject.getFieldObject(code);
|
|
1193
|
-
arrayToAdd = this.subSectionFields;
|
|
1194
|
-
break;
|
|
1195
|
-
case elementTypes.table:
|
|
1196
|
-
elementObject = formObject.getTableObject(code);
|
|
1197
|
-
arrayToAdd = this.subSectionTables;
|
|
1198
|
-
break;
|
|
1199
|
-
case elementTypes.action:
|
|
1200
|
-
elementObject = formObject.getActionObject(code);
|
|
1201
|
-
arrayToAdd = this.subSectionActions;
|
|
1202
|
-
break;
|
|
1203
|
-
}
|
|
1204
|
-
if (elementObject) {
|
|
1205
|
-
elementObject.elementType = type;
|
|
1206
|
-
arrayToAdd.push(elementObject);
|
|
1207
|
-
this.subSectionElements.push(elementObject);
|
|
1208
|
-
this.elementsArray[code] = elementObject;
|
|
1209
|
-
}
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
show() { this.visible = true; }
|
|
1214
|
-
hide() { this.visible = false; }
|
|
1215
|
-
get customRender() { return this._customRender; }
|
|
1216
|
-
set customRender(customRenderName) { this._customRender = customRenderName; }
|
|
1217
|
-
getField(name) {
|
|
1218
|
-
return this.subSectionFields.find(fld => fld.name === name);
|
|
1219
|
-
}
|
|
1220
|
-
getFields() {
|
|
1221
|
-
return this.subSectionFields;
|
|
1222
|
-
}
|
|
1223
|
-
getFieldNames() {
|
|
1224
|
-
return this.subSectionFields.map(field => field.fieldCode);
|
|
1225
|
-
}
|
|
1226
|
-
viewOnState(state) {
|
|
1227
|
-
return this.visibleStates.includes(state);
|
|
1228
|
-
}
|
|
1229
|
-
supportMode(state) { return this.viewOnState(state); }
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
class RecordFormSection {
|
|
1233
|
-
constructor(sectionReceived, formObject) {
|
|
1234
|
-
this._activation = new Subject();
|
|
1235
|
-
this._inactivation = new Subject();
|
|
1236
|
-
this.active = false;
|
|
1237
|
-
if (!sectionReceived) {
|
|
1238
|
-
return;
|
|
1239
|
-
}
|
|
1240
|
-
this.visible = true;
|
|
1241
|
-
this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
|
|
1242
|
-
this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
|
|
1243
|
-
this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
|
|
1244
|
-
this.visibleStates = sectionReceived.visibleStates || [];
|
|
1245
|
-
this.subSections = [];
|
|
1246
|
-
this.subSectionsObj = {};
|
|
1247
|
-
if (sectionReceived.subsections) {
|
|
1248
|
-
const subsections = sectionReceived.subsections.map(objDef => {
|
|
1249
|
-
let visibleStates = objDef.visibleStates;
|
|
1250
|
-
if (!visibleStates) {
|
|
1251
|
-
visibleStates = (objDef.subsectionModes || '').split(',')
|
|
1252
|
-
.map(state => state.trim())
|
|
1253
|
-
.filter(state => state.length > 0);
|
|
1254
|
-
}
|
|
1255
|
-
if (!visibleStates || visibleStates.length === 0) {
|
|
1256
|
-
visibleStates = this.visibleStates;
|
|
1257
|
-
}
|
|
1258
|
-
if (objDef.elements && Array.isArray(objDef.elements)) {
|
|
1259
|
-
objDef.elements = objDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
|
|
1260
|
-
}
|
|
1261
|
-
return Object.assign(Object.assign({}, objDef), { visibleStates });
|
|
1262
|
-
});
|
|
1263
|
-
for (const subsectionReceived of subsections) {
|
|
1264
|
-
const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
|
|
1265
|
-
const subsectionCode = subSectionToAdd.subsectionCode;
|
|
1266
|
-
if (subsectionCode) {
|
|
1267
|
-
this.subSections.push(subSectionToAdd);
|
|
1268
|
-
this.subSectionsObj[subsectionCode] = subSectionToAdd;
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
get activation() { return this._activation; }
|
|
1274
|
-
get inactivation() { return this._inactivation; }
|
|
1275
|
-
activate() {
|
|
1276
|
-
if (!this.active) {
|
|
1277
|
-
this.active = true;
|
|
1278
|
-
this._activation.next(this.sectionCode);
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
inactivate() {
|
|
1282
|
-
if (this.active) {
|
|
1283
|
-
this.active = false;
|
|
1284
|
-
this._inactivation.next(this.sectionCode);
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
show() { this.visible = true; }
|
|
1288
|
-
hide() { this.visible = false; }
|
|
1289
|
-
get title() { return this.sectionTitle; }
|
|
1290
|
-
set title(title) { this.sectionTitle = title; }
|
|
1291
|
-
getVisibleSubsections(state) {
|
|
1292
|
-
return this.subSections.filter(subSection => {
|
|
1293
|
-
return subSection.visible && subSection.viewOnState(state);
|
|
1294
|
-
});
|
|
1295
|
-
}
|
|
1296
|
-
getSubsection(subSectionCode) {
|
|
1297
|
-
return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
|
|
1298
|
-
? this.subSectionsObj[subSectionCode] : null;
|
|
1299
|
-
}
|
|
1300
|
-
getFields() {
|
|
1301
|
-
let fieldsArray = [];
|
|
1302
|
-
if (this.subSections && this.subSections.length > 0) {
|
|
1303
|
-
for (const subSection of this.subSections) {
|
|
1304
|
-
fieldsArray = fieldsArray.concat(subSection.getFields());
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
return fieldsArray;
|
|
1308
|
-
}
|
|
1309
|
-
getFieldNames() {
|
|
1310
|
-
let fieldsArray = [];
|
|
1311
|
-
if (this.subSections && this.subSections.length > 0) {
|
|
1312
|
-
for (const subSection of this.subSections) {
|
|
1313
|
-
fieldsArray = fieldsArray.concat(subSection.getFieldNames());
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
return fieldsArray;
|
|
1317
|
-
}
|
|
1318
|
-
getField(name) {
|
|
1319
|
-
let field = null;
|
|
1320
|
-
if (this.subSections && this.subSections.length > 0) {
|
|
1321
|
-
for (const subSection of this.subSections) {
|
|
1322
|
-
field = subSection.getField(name);
|
|
1323
|
-
if (field) {
|
|
1324
|
-
return field;
|
|
1325
|
-
}
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
|
-
return null;
|
|
1329
|
-
}
|
|
1330
|
-
supportState(state) { return this.viewOnState(state); }
|
|
1331
|
-
viewOnState(state) { return this.visibleStates.includes(state); }
|
|
1332
|
-
supportMode(state) { return this.viewOnState(state); }
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
1107
|
const HEADER = 'HEADER';
|
|
1336
1108
|
class FormAction extends FormElement {
|
|
1337
1109
|
constructor(actionDefinition, formConfig) {
|
|
1338
|
-
var _a
|
|
1110
|
+
var _a;
|
|
1339
1111
|
super(actionDefinition, formConfig);
|
|
1340
1112
|
this._actionActivated = new Subject();
|
|
1341
1113
|
this.inProgress = false;
|
|
@@ -1343,10 +1115,9 @@ class FormAction extends FormElement {
|
|
|
1343
1115
|
this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
|
|
1344
1116
|
this.actionName = actionDefinition.actionTitle;
|
|
1345
1117
|
this.iconName = actionDefinition.iconName || this.actionCode;
|
|
1346
|
-
this.location
|
|
1118
|
+
this.setCustomAttribute('location', actionDefinition.position || HEADER);
|
|
1347
1119
|
this.backend = (_a = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _a !== void 0 ? _a : false;
|
|
1348
1120
|
this.newState = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.newState;
|
|
1349
|
-
this.customAttributes = (_b = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.customAttributes) !== null && _b !== void 0 ? _b : null;
|
|
1350
1121
|
this.restrictedOnField = actionDefinition.fieldRestrictedCode ? actionDefinition.fieldRestrictedCode.toString() : '';
|
|
1351
1122
|
this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
|
|
1352
1123
|
this.restrictedOnValue = actionDefinition.valueRestricted || '';
|
|
@@ -1384,7 +1155,6 @@ const fldAttr = {
|
|
|
1384
1155
|
info: 'fieldInfo',
|
|
1385
1156
|
defaultValue: 'defaultValue',
|
|
1386
1157
|
defaultEditable: 'defaultEditable',
|
|
1387
|
-
customAttributes: 'customAttributes',
|
|
1388
1158
|
visibleLabel: 'visibleLabel',
|
|
1389
1159
|
required: 'fieldRequired',
|
|
1390
1160
|
hasChanged: 'hasChanged',
|
|
@@ -1403,7 +1173,7 @@ const fldAttr = {
|
|
|
1403
1173
|
};
|
|
1404
1174
|
class FieldDescriptor extends FormElement {
|
|
1405
1175
|
constructor(inputFieldReceived, formConfig) {
|
|
1406
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
1176
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1407
1177
|
super(inputFieldReceived, formConfig);
|
|
1408
1178
|
this._editionFinish = new Subject();
|
|
1409
1179
|
this._editionPartial = new Subject();
|
|
@@ -1429,18 +1199,17 @@ class FieldDescriptor extends FormElement {
|
|
|
1429
1199
|
}
|
|
1430
1200
|
this.setAttr(fldAttr.format, fieldFormat);
|
|
1431
1201
|
this.setAttr(fldAttr.validateOnServer, (_d = fld.serverAction) !== null && _d !== void 0 ? _d : false);
|
|
1432
|
-
this.setAttr(fldAttr.customAttributes, (_e = fld.customAttributes) !== null && _e !== void 0 ? _e : {});
|
|
1433
1202
|
this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
|
|
1434
1203
|
this.setAttr(fldAttr.defaultEditable, this.enabled);
|
|
1435
|
-
this.setAttr(fldAttr.required, (
|
|
1436
|
-
this.setError(fld.errorCode, fld.errorMessage, (
|
|
1437
|
-
this.setAttr(fldAttr.outputOnly, (
|
|
1438
|
-
const maxLength = (
|
|
1204
|
+
this.setAttr(fldAttr.required, (_e = fld.required) !== null && _e !== void 0 ? _e : false);
|
|
1205
|
+
this.setError(fld.errorCode, fld.errorMessage, (_f = fld.errorType) !== null && _f !== void 0 ? _f : DEFAULT_ERROR_TYPE);
|
|
1206
|
+
this.setAttr(fldAttr.outputOnly, (_g = fld.outputOnly) !== null && _g !== void 0 ? _g : false);
|
|
1207
|
+
const maxLength = (_h = fld.maxLength) !== null && _h !== void 0 ? _h : (this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
1439
1208
|
this.setAttr(fldAttr.maxLength, maxLength);
|
|
1440
|
-
this.setAttr(fldAttr.intrinsicErrorMessage, (
|
|
1209
|
+
this.setAttr(fldAttr.intrinsicErrorMessage, (_j = this._formConfig.fieldTypeErrMsg[this.fieldType]) !== null && _j !== void 0 ? _j : this._formConfig.fieldTypeErrMsg.DEFAULT);
|
|
1441
1210
|
this.setFieldType(fld.fieldTypeCode);
|
|
1442
|
-
this.setEditable((
|
|
1443
|
-
this.setVisibleLabel((
|
|
1211
|
+
this.setEditable((_k = fld.editable) !== null && _k !== void 0 ? _k : true);
|
|
1212
|
+
this.setVisibleLabel((_l = fld.visibleLabel) !== null && _l !== void 0 ? _l : true);
|
|
1444
1213
|
this.setVisibility(fld.visible);
|
|
1445
1214
|
this.setFieldOptions(fld.fieldOptions);
|
|
1446
1215
|
this.setValue(fld.fieldValue || this.defaultValue || '');
|
|
@@ -1450,11 +1219,14 @@ class FieldDescriptor extends FormElement {
|
|
|
1450
1219
|
get attributeChange() { return this._attributeChange; }
|
|
1451
1220
|
get editionPartial() { return this._editionPartial; }
|
|
1452
1221
|
get detailRequest() { return this._detailRequest; }
|
|
1222
|
+
get info() { return this.fieldInfo; }
|
|
1453
1223
|
get validating() { return this._onValidation; }
|
|
1454
1224
|
set validating(isValidating) { this.setAttr(fldAttr.onValidation, isValidating); }
|
|
1455
1225
|
setIntrinsicErrorMessage(message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); }
|
|
1456
1226
|
set intrinsicErrorMessage(message) { this.setIntrinsicErrorMessage(message); }
|
|
1457
1227
|
get fieldValue() { return this.getValue(); }
|
|
1228
|
+
getRequired() { return this.required; }
|
|
1229
|
+
setRequired(required) { this.required = required; }
|
|
1458
1230
|
get required() { return this.fieldRequired; }
|
|
1459
1231
|
set required(required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); }
|
|
1460
1232
|
get maxLength() { return (this._maxLength > 0) ? this._maxLength.toString() : ''; }
|
|
@@ -1495,7 +1267,6 @@ class FieldDescriptor extends FormElement {
|
|
|
1495
1267
|
notifyEditionDetailRequest() {
|
|
1496
1268
|
this._detailRequest.next(this.fieldCode);
|
|
1497
1269
|
}
|
|
1498
|
-
getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
|
|
1499
1270
|
setVisibleLabel(visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); }
|
|
1500
1271
|
showLabel() { this.setVisibleLabel(true); }
|
|
1501
1272
|
hideLabel() { this.setVisibleLabel(false); }
|
|
@@ -1503,7 +1274,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1503
1274
|
changed() { this.setChanged(true); }
|
|
1504
1275
|
getRawValue() { return this._fieldValue; }
|
|
1505
1276
|
setLabel(label) { this.setAttr(fldAttr.title, label); }
|
|
1506
|
-
clean() { this.setValue(this.defaultValue || ''); }
|
|
1277
|
+
clean() { this.setValue(this.defaultValue || ''); this.resetError(); }
|
|
1507
1278
|
get backend() { return this.validateOnServer; }
|
|
1508
1279
|
setEditable(editable = true) { (editable) ? this.enable() : this.disable(); }
|
|
1509
1280
|
hasError() { return this.errorCode !== NO_ERROR; }
|
|
@@ -1520,6 +1291,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1520
1291
|
setErrorCode(code) { this.setError(code, this.errorMessage); }
|
|
1521
1292
|
getErrorMessage() { return this.getError().message; }
|
|
1522
1293
|
setErrorMessage(msg) { this.setError(this.errorCode, msg); }
|
|
1294
|
+
get empty() { return this.isEmpty(); }
|
|
1523
1295
|
isEmpty() {
|
|
1524
1296
|
const fieldCurrentValue = this.getValue();
|
|
1525
1297
|
if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
|
|
@@ -1575,11 +1347,6 @@ class FieldDescriptor extends FormElement {
|
|
|
1575
1347
|
setFieldType(inputFieldType) {
|
|
1576
1348
|
this.setAttr(fldAttr.type, inputFieldType);
|
|
1577
1349
|
}
|
|
1578
|
-
format() {
|
|
1579
|
-
if (this.fieldType === this._formConfig.fieldTypes.currency) {
|
|
1580
|
-
this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
1350
|
setMinValue(minValue) {
|
|
1584
1351
|
var _a, _b, _c;
|
|
1585
1352
|
if (this.fieldType === this._formConfig.fieldTypes.date
|
|
@@ -1689,9 +1456,6 @@ class FieldDescriptor extends FormElement {
|
|
|
1689
1456
|
(_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
|
|
1690
1457
|
}
|
|
1691
1458
|
break;
|
|
1692
|
-
case this._formConfig.fieldTypes.currency:
|
|
1693
|
-
newFinalValue = formatCurrency(newValue);
|
|
1694
|
-
break;
|
|
1695
1459
|
default:
|
|
1696
1460
|
newFinalValue = newValue;
|
|
1697
1461
|
break;
|
|
@@ -1704,44 +1468,223 @@ class FieldDescriptor extends FormElement {
|
|
|
1704
1468
|
}
|
|
1705
1469
|
}
|
|
1706
1470
|
|
|
1707
|
-
class
|
|
1708
|
-
constructor(
|
|
1709
|
-
|
|
1710
|
-
this._actionsObj = {};
|
|
1711
|
-
this._tableObj = {};
|
|
1712
|
-
this._sectionsObj = {};
|
|
1713
|
-
this._immutableData = {};
|
|
1714
|
-
this._extraInfo = {};
|
|
1715
|
-
this._formConfig = formConfig;
|
|
1716
|
-
this.state = '';
|
|
1717
|
-
this._actions = [];
|
|
1718
|
-
this._fields = [];
|
|
1719
|
-
this._tables = [];
|
|
1720
|
-
this._sections = [];
|
|
1721
|
-
this._stateFlow = {
|
|
1722
|
-
defaultState: '',
|
|
1723
|
-
states: [],
|
|
1724
|
-
transitions: [],
|
|
1725
|
-
};
|
|
1726
|
-
if (!definitionReceived) {
|
|
1471
|
+
class RecordFormSubSection {
|
|
1472
|
+
constructor(subsectionReceived, formObject) {
|
|
1473
|
+
if (!subsectionReceived) {
|
|
1727
1474
|
return;
|
|
1728
1475
|
}
|
|
1729
|
-
this.
|
|
1730
|
-
|
|
1731
|
-
this.
|
|
1732
|
-
|
|
1733
|
-
this.
|
|
1734
|
-
this.
|
|
1735
|
-
this.
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1476
|
+
this._customRender = null;
|
|
1477
|
+
this.visible = true;
|
|
1478
|
+
this.subSectionElements = [];
|
|
1479
|
+
this.subSectionFields = [];
|
|
1480
|
+
this.subSectionTables = [];
|
|
1481
|
+
this.subSectionActions = [];
|
|
1482
|
+
this.elementsArray = {};
|
|
1483
|
+
this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
|
|
1484
|
+
this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
|
|
1485
|
+
this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
|
|
1486
|
+
this.visibleStates = subsectionReceived.visibleStates || [];
|
|
1487
|
+
if (subsectionReceived.elements) {
|
|
1488
|
+
for (const receivedElement of subsectionReceived.elements) {
|
|
1489
|
+
let elementObject = null;
|
|
1490
|
+
let arrayToAdd = null;
|
|
1491
|
+
const { type, code } = receivedElement;
|
|
1492
|
+
switch (type) {
|
|
1493
|
+
case elementTypes.field:
|
|
1494
|
+
elementObject = formObject.getFieldObject(code);
|
|
1495
|
+
arrayToAdd = this.subSectionFields;
|
|
1496
|
+
break;
|
|
1497
|
+
case elementTypes.table:
|
|
1498
|
+
elementObject = formObject.getTableObject(code);
|
|
1499
|
+
arrayToAdd = this.subSectionTables;
|
|
1500
|
+
break;
|
|
1501
|
+
case elementTypes.action:
|
|
1502
|
+
elementObject = formObject.getActionObject(code);
|
|
1503
|
+
arrayToAdd = this.subSectionActions;
|
|
1504
|
+
break;
|
|
1505
|
+
}
|
|
1506
|
+
if (elementObject) {
|
|
1507
|
+
elementObject.elementType = type;
|
|
1508
|
+
arrayToAdd.push(elementObject);
|
|
1509
|
+
this.subSectionElements.push(elementObject);
|
|
1510
|
+
this.elementsArray[code] = elementObject;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
show() { this.visible = true; }
|
|
1516
|
+
hide() { this.visible = false; }
|
|
1517
|
+
get customRender() { return this._customRender; }
|
|
1518
|
+
set customRender(customRenderName) { this._customRender = customRenderName; }
|
|
1519
|
+
getField(name) {
|
|
1520
|
+
return this.subSectionFields.find(fld => fld.name === name);
|
|
1521
|
+
}
|
|
1522
|
+
getFields() {
|
|
1523
|
+
return this.subSectionFields;
|
|
1524
|
+
}
|
|
1525
|
+
getFieldNames() {
|
|
1526
|
+
return this.subSectionFields.map(field => field.fieldCode);
|
|
1527
|
+
}
|
|
1528
|
+
viewOnState(state) {
|
|
1529
|
+
return this.visibleStates.includes(state);
|
|
1530
|
+
}
|
|
1531
|
+
supportMode(state) { return this.viewOnState(state); }
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
class RecordFormSection {
|
|
1535
|
+
constructor(sectionReceived, formObject) {
|
|
1536
|
+
var _a;
|
|
1537
|
+
this._activation = new Subject();
|
|
1538
|
+
this._inactivation = new Subject();
|
|
1539
|
+
this.active = false;
|
|
1540
|
+
if (!sectionReceived) {
|
|
1541
|
+
return;
|
|
1542
|
+
}
|
|
1543
|
+
this.visible = true;
|
|
1544
|
+
this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
|
|
1545
|
+
this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
|
|
1546
|
+
this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
|
|
1547
|
+
this.visibleStates = sectionReceived.visibleStates || [];
|
|
1548
|
+
this.subSections = [];
|
|
1549
|
+
this.subSectionsObj = {};
|
|
1550
|
+
if (sectionReceived.subsections) {
|
|
1551
|
+
const subsections = sectionReceived.subsections.map(objDef => {
|
|
1552
|
+
let visibleStates = objDef.visibleStates;
|
|
1553
|
+
if (!visibleStates) {
|
|
1554
|
+
visibleStates = (objDef.subsectionModes || '').split(',')
|
|
1555
|
+
.map(state => state.trim())
|
|
1556
|
+
.filter(state => state.length > 0);
|
|
1557
|
+
}
|
|
1558
|
+
if (!visibleStates || visibleStates.length === 0) {
|
|
1559
|
+
visibleStates = this.visibleStates;
|
|
1560
|
+
}
|
|
1561
|
+
if (objDef.elements && Array.isArray(objDef.elements)) {
|
|
1562
|
+
objDef.elements = objDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
|
|
1563
|
+
}
|
|
1564
|
+
return Object.assign(Object.assign({}, objDef), { visibleStates });
|
|
1565
|
+
});
|
|
1566
|
+
for (const subsectionReceived of subsections) {
|
|
1567
|
+
const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
|
|
1568
|
+
const subsectionCode = subSectionToAdd.subsectionCode;
|
|
1569
|
+
if (subsectionCode) {
|
|
1570
|
+
this.subSections.push(subSectionToAdd);
|
|
1571
|
+
this.subSectionsObj[subsectionCode] = subSectionToAdd;
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
this.customAttributes = (_a = sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes) !== null && _a !== void 0 ? _a : null;
|
|
1576
|
+
}
|
|
1577
|
+
getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
|
|
1578
|
+
setCustomAttribute(name, value) { return name && (this.customAttributes[name] = value); }
|
|
1579
|
+
matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
|
|
1580
|
+
get code() { return this.sectionCode; }
|
|
1581
|
+
get activation() { return this._activation; }
|
|
1582
|
+
get inactivation() { return this._inactivation; }
|
|
1583
|
+
activate() {
|
|
1584
|
+
if (!this.active) {
|
|
1585
|
+
this.active = true;
|
|
1586
|
+
this._activation.next(this.sectionCode);
|
|
1587
|
+
}
|
|
1588
|
+
}
|
|
1589
|
+
inactivate() {
|
|
1590
|
+
if (this.active) {
|
|
1591
|
+
this.active = false;
|
|
1592
|
+
this._inactivation.next(this.sectionCode);
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
show() { this.visible = true; }
|
|
1596
|
+
hide() { this.visible = false; }
|
|
1597
|
+
get title() { return this.sectionTitle; }
|
|
1598
|
+
set title(title) { this.sectionTitle = title; }
|
|
1599
|
+
getVisibleSubsections(state) {
|
|
1600
|
+
return this.subSections.filter(subSection => {
|
|
1601
|
+
return subSection.visible && subSection.viewOnState(state);
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
getSubsection(subSectionCode) {
|
|
1605
|
+
return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
|
|
1606
|
+
? this.subSectionsObj[subSectionCode] : null;
|
|
1607
|
+
}
|
|
1608
|
+
getFields() {
|
|
1609
|
+
let fieldsArray = [];
|
|
1610
|
+
if (this.subSections && this.subSections.length > 0) {
|
|
1611
|
+
for (const subSection of this.subSections) {
|
|
1612
|
+
fieldsArray = fieldsArray.concat(subSection.getFields());
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
return fieldsArray;
|
|
1616
|
+
}
|
|
1617
|
+
getFieldNames() {
|
|
1618
|
+
let fieldsArray = [];
|
|
1619
|
+
if (this.subSections && this.subSections.length > 0) {
|
|
1620
|
+
for (const subSection of this.subSections) {
|
|
1621
|
+
fieldsArray = fieldsArray.concat(subSection.getFieldNames());
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
return fieldsArray;
|
|
1625
|
+
}
|
|
1626
|
+
getField(name) {
|
|
1627
|
+
let field = null;
|
|
1628
|
+
if (this.subSections && this.subSections.length > 0) {
|
|
1629
|
+
for (const subSection of this.subSections) {
|
|
1630
|
+
field = subSection.getField(name);
|
|
1631
|
+
if (field) {
|
|
1632
|
+
return field;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
return null;
|
|
1637
|
+
}
|
|
1638
|
+
supportState(state) { return this.viewOnState(state); }
|
|
1639
|
+
viewOnState(state) { return this.visibleStates.includes(state); }
|
|
1640
|
+
supportMode(state) { return this.viewOnState(state); }
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
const ACTIVE = 'active';
|
|
1644
|
+
const SHOW = 'show';
|
|
1645
|
+
const HIDE = 'hide';
|
|
1646
|
+
const ENABLE = 'enable';
|
|
1647
|
+
const DISABLE = 'disable';
|
|
1648
|
+
const CLEAN = 'clean';
|
|
1649
|
+
class FormStructureAndData {
|
|
1650
|
+
constructor(definitionReceived, formConfig) {
|
|
1651
|
+
this._fields = {};
|
|
1652
|
+
this._actions = {};
|
|
1653
|
+
this._tables = {};
|
|
1654
|
+
this._sections = {};
|
|
1655
|
+
this._immutableData = {};
|
|
1656
|
+
this._extraInfo = {};
|
|
1657
|
+
this._exclusiveSectionsByAttr = {};
|
|
1658
|
+
this._formConfig = formConfig;
|
|
1659
|
+
this.state = '';
|
|
1660
|
+
this._actionArray = [];
|
|
1661
|
+
this._fieldArray = [];
|
|
1662
|
+
this._tableArray = [];
|
|
1663
|
+
this._sectionArray = [];
|
|
1664
|
+
this._stateFlow = {
|
|
1665
|
+
defaultState: '',
|
|
1666
|
+
states: [],
|
|
1667
|
+
transitions: [],
|
|
1668
|
+
};
|
|
1669
|
+
if (!definitionReceived) {
|
|
1670
|
+
return;
|
|
1671
|
+
}
|
|
1672
|
+
this._name = (definitionReceived.form && definitionReceived.form.formCode)
|
|
1673
|
+
? definitionReceived.form.formCode : this._name;
|
|
1674
|
+
this._title = (definitionReceived.form && definitionReceived.form.formTitle)
|
|
1675
|
+
? definitionReceived.form.formTitle : '';
|
|
1676
|
+
this.setStateFlow(definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.states, definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.transitions, definitionReceived === null || definitionReceived === void 0 ? void 0 : definitionReceived.defaultState);
|
|
1677
|
+
this.immutableData = definitionReceived.immutableData;
|
|
1678
|
+
this.extraInfo = definitionReceived.extraInfo;
|
|
1679
|
+
if (definitionReceived.actions) {
|
|
1680
|
+
const formActions = definitionReceived.actions.map(objDef => {
|
|
1681
|
+
let visibleStates = objDef.visibleStates;
|
|
1682
|
+
let enabledStates = objDef.enabledStates;
|
|
1683
|
+
if (!visibleStates) {
|
|
1684
|
+
visibleStates = (objDef.actionModes || '').split(',')
|
|
1685
|
+
.map(state => state.trim())
|
|
1686
|
+
.filter(state => state.length > 0) || [];
|
|
1687
|
+
enabledStates = [...visibleStates];
|
|
1745
1688
|
}
|
|
1746
1689
|
return Object.assign(Object.assign({}, objDef), { visibleStates, enabledStates });
|
|
1747
1690
|
});
|
|
@@ -1749,8 +1692,8 @@ class FormStructureAndData {
|
|
|
1749
1692
|
const globalAction = new FormAction(actionReceived, this._formConfig);
|
|
1750
1693
|
const globalActionCode = globalAction.actionCode;
|
|
1751
1694
|
if (globalActionCode) {
|
|
1752
|
-
this.
|
|
1753
|
-
this.
|
|
1695
|
+
this._actionArray.push(globalAction);
|
|
1696
|
+
this._actions[globalActionCode] = globalAction;
|
|
1754
1697
|
}
|
|
1755
1698
|
}
|
|
1756
1699
|
}
|
|
@@ -1770,8 +1713,8 @@ class FormStructureAndData {
|
|
|
1770
1713
|
const fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
|
|
1771
1714
|
const fieldCode = fieldToAdd.fieldCode;
|
|
1772
1715
|
if (fieldCode) {
|
|
1773
|
-
this.
|
|
1774
|
-
this.
|
|
1716
|
+
this._fieldArray.push(fieldToAdd);
|
|
1717
|
+
this._fields[fieldCode] = fieldToAdd;
|
|
1775
1718
|
}
|
|
1776
1719
|
}
|
|
1777
1720
|
}
|
|
@@ -1794,8 +1737,8 @@ class FormStructureAndData {
|
|
|
1794
1737
|
const tableToAdd = new RecordTable(tableReceived, this._formConfig);
|
|
1795
1738
|
const tableCode = tableToAdd.tableCode;
|
|
1796
1739
|
if (tableCode) {
|
|
1797
|
-
this.
|
|
1798
|
-
this.
|
|
1740
|
+
this._tableArray.push(tableToAdd);
|
|
1741
|
+
this._tables[tableCode] = tableToAdd;
|
|
1799
1742
|
}
|
|
1800
1743
|
}
|
|
1801
1744
|
}
|
|
@@ -1813,19 +1756,22 @@ class FormStructureAndData {
|
|
|
1813
1756
|
const sectionToAdd = new RecordFormSection(sectionReceived, this);
|
|
1814
1757
|
const sectionCode = sectionToAdd.sectionCode;
|
|
1815
1758
|
if (sectionCode) {
|
|
1816
|
-
this.
|
|
1817
|
-
this.
|
|
1759
|
+
this._sectionArray.push(sectionToAdd);
|
|
1760
|
+
this._sections[sectionCode] = sectionToAdd;
|
|
1818
1761
|
}
|
|
1819
1762
|
}
|
|
1820
1763
|
}
|
|
1821
1764
|
}
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
get defaultState() { return this._stateFlow.defaultState; }
|
|
1825
|
-
get title() { return this._title; }
|
|
1826
|
-
set title(title) { this._title = title; }
|
|
1765
|
+
getTitle() { return this._title; }
|
|
1766
|
+
setTitle(title) { this._title = title; }
|
|
1827
1767
|
get name() { return this._name; }
|
|
1828
1768
|
set name(name) { this._name = name; }
|
|
1769
|
+
// Estados
|
|
1770
|
+
get defaultState() { return this._stateFlow.defaultState; }
|
|
1771
|
+
supportState(state) { var _a; return (_a = this._stateFlow.states) === null || _a === void 0 ? void 0 : _a.includes(state); }
|
|
1772
|
+
supportMode(state) { return this.supportState(state); }
|
|
1773
|
+
get states() { return this._stateFlow.states; }
|
|
1774
|
+
getCurrentState() { return this.state; }
|
|
1829
1775
|
changeState(newState) {
|
|
1830
1776
|
if (!newState || !this.supportState(newState)) {
|
|
1831
1777
|
return false;
|
|
@@ -1855,420 +1801,260 @@ class FormStructureAndData {
|
|
|
1855
1801
|
return { name, source, destination };
|
|
1856
1802
|
}).filter(item => item.name && item.source && item.destination);
|
|
1857
1803
|
}
|
|
1858
|
-
|
|
1859
|
-
supportMode(state) { return this.supportState(state); }
|
|
1860
|
-
get immutableData() {
|
|
1861
|
-
const data = {};
|
|
1862
|
-
const objectNames = Object.keys(this._immutableData);
|
|
1863
|
-
for (let index = 0; index < objectNames.length; index++) {
|
|
1864
|
-
const name = objectNames[index];
|
|
1865
|
-
data[name] = this.getImmutableElement(name);
|
|
1866
|
-
}
|
|
1867
|
-
return data;
|
|
1868
|
-
}
|
|
1804
|
+
// immutable Data
|
|
1869
1805
|
getImmutableElement(name) { var _a, _b, _c; return (_c = (_b = (_a = this._immutableData) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null; }
|
|
1806
|
+
set immutableData(immutableData) { Object.assign(this._immutableData, immutableData); }
|
|
1807
|
+
get immutableData() { return JSON.parse(JSON.stringify(this._immutableData)); }
|
|
1808
|
+
// extra Info
|
|
1870
1809
|
getExtraInfo(name) { var _a, _b, _c; return (_c = (_b = (_a = this._extraInfo) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null; }
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1810
|
+
set extraInfo(extraInfo) { Object.assign(this._extraInfo, extraInfo); }
|
|
1811
|
+
get extraInfo() { return JSON.parse(JSON.stringify(this._extraInfo)); }
|
|
1812
|
+
// Fields
|
|
1813
|
+
get fields() { return this._fields; }
|
|
1814
|
+
get fieldNames() { return this.getFieldNames(); }
|
|
1815
|
+
getFields() { return this._fieldArray; }
|
|
1816
|
+
getFieldNames() { return this._fieldArray.map(field => field.fieldCode); }
|
|
1817
|
+
getField(code) { var _a; return (code && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[code])) ? this._fields[code] : null; }
|
|
1818
|
+
enableField(code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.enable(); }
|
|
1819
|
+
disableField(code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.disable(); }
|
|
1820
|
+
getFieldValue(code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getValue(); }
|
|
1821
|
+
getFieldOptions(code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getFieldOptions(); }
|
|
1822
|
+
setFieldValue(code, value) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setValue(value); }
|
|
1823
|
+
setFieldError(code, message, type = 'error') { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setError(code, message, type); }
|
|
1824
|
+
setFieldIntrinsicErrorMessage(code, message) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setIntrinsicErrorMessage(message); }
|
|
1825
|
+
setFieldRequired(code, required) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setRequired(required); }
|
|
1826
|
+
setFieldErrorMessage(code, message) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setErrorMessage(message); }
|
|
1827
|
+
setFieldOptions(code, optionsArray, idAttribute, nameAttribute) {
|
|
1828
|
+
const field = this.getField(code);
|
|
1829
|
+
if (field && (optionsArray === null || optionsArray === void 0 ? void 0 : optionsArray.length) > 0) {
|
|
1830
|
+
const fieldOptions = optionsArray.map(item => ({
|
|
1831
|
+
fieldOptionId: item[idAttribute],
|
|
1832
|
+
fieldOptionValue: item[nameAttribute]
|
|
1833
|
+
}));
|
|
1834
|
+
field.setFieldOptions(fieldOptions);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
getFieldSet(filter, inputCodes, secCode, subCode) {
|
|
1838
|
+
var _a, _b, _c, _d;
|
|
1839
|
+
let codes = null;
|
|
1840
|
+
if (typeof inputCodes === 'string' && inputCodes) {
|
|
1841
|
+
codes = [inputCodes];
|
|
1877
1842
|
}
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
getFields() { return this._fields; }
|
|
1881
|
-
getStates() {
|
|
1882
|
-
return this._stateFlow.states;
|
|
1883
|
-
}
|
|
1884
|
-
getFieldNames() {
|
|
1885
|
-
return this._fields.map(field => field.fieldCode);
|
|
1886
|
-
}
|
|
1887
|
-
getActions() {
|
|
1888
|
-
return this._actions;
|
|
1889
|
-
}
|
|
1890
|
-
getHeaderActions() {
|
|
1891
|
-
return this._actions.filter(actionItem => actionItem.location === HEADER$1);
|
|
1892
|
-
}
|
|
1893
|
-
getFieldObject(elementId) {
|
|
1894
|
-
return (this._fieldsObj && elementId && this._fieldsObj[elementId])
|
|
1895
|
-
? this._fieldsObj[elementId] : null;
|
|
1896
|
-
}
|
|
1897
|
-
getTableObject(elementId) {
|
|
1898
|
-
return (this._tableObj && elementId && this._tableObj[elementId])
|
|
1899
|
-
? this._tableObj[elementId] : null;
|
|
1900
|
-
}
|
|
1901
|
-
getActionObject(elementId) {
|
|
1902
|
-
return (this._actionsObj && elementId && this._actionsObj[elementId])
|
|
1903
|
-
? this._actionsObj[elementId] : null;
|
|
1904
|
-
}
|
|
1905
|
-
getSubSection(sectionCode, subsectionCode) {
|
|
1906
|
-
const section = (this._sectionsObj && this._sectionsObj[sectionCode])
|
|
1907
|
-
? this._sectionsObj[sectionCode] : null;
|
|
1908
|
-
return (section) ? section.getSubsection(subsectionCode) : null;
|
|
1909
|
-
}
|
|
1910
|
-
get actions() { return this._actionsObj; }
|
|
1911
|
-
getSection(sectionCode) {
|
|
1912
|
-
return (this._sectionsObj && this._sectionsObj[sectionCode])
|
|
1913
|
-
? this._sectionsObj[sectionCode] : null;
|
|
1914
|
-
}
|
|
1915
|
-
sections() { return this.getSections(); }
|
|
1916
|
-
sectionTitles() { return this.getSectionsTitles(); }
|
|
1917
|
-
getSections() {
|
|
1918
|
-
return this._sections;
|
|
1919
|
-
}
|
|
1920
|
-
get visibleSections() {
|
|
1921
|
-
return this._sections.filter(sec => sec.visible);
|
|
1922
|
-
}
|
|
1923
|
-
numSections() {
|
|
1924
|
-
return this._sections.length;
|
|
1925
|
-
}
|
|
1926
|
-
getSectionsTitles() {
|
|
1927
|
-
return this._sections.map(formSection => formSection.sectionTitle);
|
|
1928
|
-
}
|
|
1929
|
-
getSectionObject(elementId) {
|
|
1930
|
-
return (this._sectionsObj && elementId && this._sectionsObj[elementId])
|
|
1931
|
-
? this._sectionsObj[elementId] : null;
|
|
1932
|
-
}
|
|
1933
|
-
tables() { return this.getTables(); }
|
|
1934
|
-
getTables() {
|
|
1935
|
-
return this._tables;
|
|
1936
|
-
}
|
|
1937
|
-
cleanData() {
|
|
1938
|
-
if (this._fields) {
|
|
1939
|
-
for (const recordField of this._fields) {
|
|
1940
|
-
recordField.setValue(recordField.defaultValue);
|
|
1941
|
-
}
|
|
1843
|
+
else if (Array.isArray(inputCodes) && inputCodes.length > 0) {
|
|
1844
|
+
codes = inputCodes;
|
|
1942
1845
|
}
|
|
1943
|
-
if (
|
|
1944
|
-
|
|
1945
|
-
formTable.clean();
|
|
1946
|
-
}
|
|
1846
|
+
else if (secCode && !subCode) {
|
|
1847
|
+
codes = (_b = (_a = this.getSection(secCode)) === null || _a === void 0 ? void 0 : _a.getFieldNames()) !== null && _b !== void 0 ? _b : [];
|
|
1947
1848
|
}
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
hideSection(sectionCode) {
|
|
1954
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1955
|
-
return (sectionObject) ? sectionObject.hide() : null;
|
|
1956
|
-
}
|
|
1957
|
-
activeSection() {
|
|
1958
|
-
const activeSection = this._sections.find(sectionObj => sectionObj.active);
|
|
1959
|
-
return activeSection.sectionCode;
|
|
1960
|
-
}
|
|
1961
|
-
activateSection(sectionCode) {
|
|
1962
|
-
this._sections.forEach(sectionObj => {
|
|
1963
|
-
if (sectionObj) {
|
|
1964
|
-
sectionObj.inactivate();
|
|
1965
|
-
}
|
|
1966
|
-
});
|
|
1967
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1968
|
-
return (sectionObject) ? sectionObject.activate() : null;
|
|
1969
|
-
}
|
|
1970
|
-
showSections(sectionArray) {
|
|
1971
|
-
const sectionNames = (Array.isArray(sectionArray)) ? sectionArray : [sectionArray];
|
|
1972
|
-
sectionNames.forEach(sectionCode => this.showSection(sectionCode));
|
|
1973
|
-
}
|
|
1974
|
-
hideSections(sectionArray) {
|
|
1975
|
-
const sectionNames = (Array.isArray(sectionArray)) ? sectionArray : [sectionArray];
|
|
1976
|
-
sectionNames.forEach(sectionCode => this.hideSection(sectionCode));
|
|
1977
|
-
}
|
|
1978
|
-
showSubSection(sectionCode, subSectionCode) {
|
|
1979
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1980
|
-
const subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
|
|
1981
|
-
return (subSectionObject) ? subSectionObject.show() : null;
|
|
1982
|
-
}
|
|
1983
|
-
hideSubSection(sectionCode, subSectionCode) {
|
|
1984
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1985
|
-
const subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
|
|
1986
|
-
return (subSectionObject) ? subSectionObject.hide() : null;
|
|
1987
|
-
}
|
|
1988
|
-
showSubSections(sectionCode, subSectionArray) {
|
|
1989
|
-
if (subSectionArray && subSectionArray.length > 0) {
|
|
1990
|
-
const sectionObject = this.getSectionObject(sectionCode);
|
|
1991
|
-
for (const subSectionCode of subSectionArray) {
|
|
1992
|
-
const subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
|
|
1993
|
-
if (subSectionObject) {
|
|
1994
|
-
subSectionObject.show();
|
|
1995
|
-
}
|
|
1996
|
-
}
|
|
1849
|
+
else if (secCode && subCode) {
|
|
1850
|
+
codes = (_d = (_c = this.getSubSection(secCode, subCode)) === null || _c === void 0 ? void 0 : _c.getFieldNames()) !== null && _d !== void 0 ? _d : [];
|
|
1851
|
+
}
|
|
1852
|
+
else {
|
|
1853
|
+
codes = this.getFieldNames();
|
|
1997
1854
|
}
|
|
1855
|
+
return (filter) ? codes.filter(fld => filter(this.getField(fld))) : codes;
|
|
1998
1856
|
}
|
|
1999
|
-
|
|
2000
|
-
if (
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
1857
|
+
applyOnFields(processFunc, inputCodes, secCode, subCode) {
|
|
1858
|
+
if (!processFunc) {
|
|
1859
|
+
return 0;
|
|
1860
|
+
}
|
|
1861
|
+
const codes = this.getFieldSet(null, inputCodes, secCode, subCode);
|
|
1862
|
+
let processedFields = 0;
|
|
1863
|
+
for (const code of codes) {
|
|
1864
|
+
const field = this.getField(code);
|
|
1865
|
+
if (field) {
|
|
1866
|
+
try {
|
|
1867
|
+
processFunc(field);
|
|
1868
|
+
processedFields += 1;
|
|
1869
|
+
}
|
|
1870
|
+
catch (e) {
|
|
1871
|
+
console.log(`Error procesando funcion en campo ${field}: ${e}`);
|
|
2006
1872
|
}
|
|
2007
1873
|
}
|
|
2008
1874
|
}
|
|
1875
|
+
return processedFields;
|
|
2009
1876
|
}
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
return (actionObject) ? actionObject.show() : null;
|
|
1877
|
+
enableFields(codes, secCode, subCode) {
|
|
1878
|
+
return this.applyOnFields(fld => fld.enable(), codes, secCode, subCode);
|
|
2013
1879
|
}
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
return (actionObject) ? actionObject.hide() : null;
|
|
1880
|
+
showFields(codes, secCode, subCode) {
|
|
1881
|
+
return this.applyOnFields(fld => fld.show(), codes, secCode, subCode);
|
|
2017
1882
|
}
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
actionNames.forEach(actionCode => this.showAction(actionCode));
|
|
1883
|
+
hideFields(codes, secCode, subCode) {
|
|
1884
|
+
return this.applyOnFields(fld => fld.hide(), codes, secCode, subCode);
|
|
2021
1885
|
}
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
actionNames.forEach(actionCode => this.hideAction(actionCode));
|
|
1886
|
+
showLabelFields(codes, secCode, subCode) {
|
|
1887
|
+
return this.applyOnFields(fld => fld.showLablel(), codes, secCode, subCode);
|
|
2025
1888
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
return (actionObject) ? actionObject.enable() : null;
|
|
1889
|
+
hideLabelFields(codes, secCode, subCode) {
|
|
1890
|
+
return this.applyOnFields(fld => fld.hideLabel(), codes, secCode, subCode);
|
|
2029
1891
|
}
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
return (actionObject) ? actionObject.disable() : null;
|
|
1892
|
+
disableFields(codes, secCode, subCode) {
|
|
1893
|
+
return this.applyOnFields(fld => fld.disable(), codes, secCode, subCode);
|
|
2033
1894
|
}
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
actionNames.forEach(actionCode => this.enableAction(actionCode));
|
|
1895
|
+
cleanFields(codes, secCode, subCode) {
|
|
1896
|
+
return this.applyOnFields(fld => fld.clean(), codes, secCode, subCode);
|
|
2037
1897
|
}
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
actionNames.forEach(actionCode => this.disableAction(actionCode));
|
|
1898
|
+
tagFieldsWithError(message, codes, secCode, subCode) {
|
|
1899
|
+
return this.applyOnFields(fld => fld.setErrorMessage(message), codes, secCode, subCode);
|
|
2041
1900
|
}
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
const fieldObject = this.getFieldObject(fieldCode);
|
|
2045
|
-
return (fieldObject) ? fieldObject.enable() : null;
|
|
1901
|
+
cleanErrorFields(codes, secCode, subCode) {
|
|
1902
|
+
this.tagFieldsWithError('', codes, secCode, subCode);
|
|
2046
1903
|
}
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
return (fieldObject) ? fieldObject.disable() : null;
|
|
1904
|
+
tagEmptyRequiredFields(message, codes = null, secCode, subCode) {
|
|
1905
|
+
return this.tagFieldsWithError(message, this.getRequiredEmptyFields(codes, secCode, subCode)) > 0;
|
|
2050
1906
|
}
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
1907
|
+
getRequiredFields(codes, secCode, subCode) {
|
|
1908
|
+
return this.getFieldSet(fld => fld.required, codes, secCode, subCode);
|
|
1909
|
+
}
|
|
1910
|
+
getRequiredEmptyFields(codes, secCode, subCode) {
|
|
1911
|
+
return this.getFieldSet(fld => fld.required && fld.empty, codes, secCode, subCode);
|
|
1912
|
+
}
|
|
1913
|
+
getChangedFields(codes, secCode, subCode) {
|
|
1914
|
+
return this.getFieldSet(fld => !fld.outputOnly && fld.hasChanged(), codes, secCode, subCode);
|
|
1915
|
+
}
|
|
1916
|
+
getFieldsWithValidationIssues(codes, secCode, subCode) {
|
|
1917
|
+
return this.getFieldSet(fld => fld.errorCode !== NO_ERROR, codes, secCode, subCode);
|
|
2054
1918
|
}
|
|
2055
|
-
getFieldsValues(
|
|
1919
|
+
getFieldsValues(inputCodes, secCode, subCode) {
|
|
2056
1920
|
var _a, _b, _c;
|
|
2057
|
-
|
|
2058
|
-
return null;
|
|
2059
|
-
}
|
|
1921
|
+
const codes = this.getFieldSet(null, inputCodes, secCode, subCode);
|
|
2060
1922
|
const resultObject = {};
|
|
2061
|
-
for (let index = 0; index <
|
|
2062
|
-
const
|
|
2063
|
-
if (
|
|
2064
|
-
resultObject[
|
|
1923
|
+
for (let index = 0; index < codes.length; index++) {
|
|
1924
|
+
const code = codes[index];
|
|
1925
|
+
if (code) {
|
|
1926
|
+
resultObject[code] = (_c = (_b = (_a = this._fields) === null || _a === void 0 ? void 0 : _a[code]) === null || _b === void 0 ? void 0 : _b.getValue()) !== null && _c !== void 0 ? _c : null;
|
|
2065
1927
|
}
|
|
2066
1928
|
}
|
|
2067
1929
|
return resultObject;
|
|
2068
1930
|
}
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
}
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
}
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
const fieldObject = this.getFieldObject(code);
|
|
2083
|
-
return (fieldObject) ? fieldObject.setIntrinsicErrorMessage(message) : null;
|
|
2084
|
-
}
|
|
2085
|
-
setFieldRequired(fieldCode, required) {
|
|
2086
|
-
const fieldObject = this.getFieldObject(fieldCode);
|
|
2087
|
-
return (fieldObject) ? fieldObject.required = required : null;
|
|
2088
|
-
}
|
|
2089
|
-
setFieldErrorMessage(fieldCode, errorMessage) {
|
|
2090
|
-
const fieldObject = this.getFieldObject(fieldCode);
|
|
2091
|
-
return (fieldObject) ? fieldObject.setErrorMessage(errorMessage) : null;
|
|
2092
|
-
}
|
|
2093
|
-
setFieldOptions(fieldCode, optionsArray, idAttribute, nameAttribute) {
|
|
2094
|
-
const fieldObject = this.getFieldObject(fieldCode);
|
|
2095
|
-
if (fieldObject && optionsArray && optionsArray.length > 0) {
|
|
2096
|
-
const fieldOptions = [];
|
|
2097
|
-
for (const optionItem of optionsArray) {
|
|
2098
|
-
const fieldOption = {
|
|
2099
|
-
fieldOptionId: optionItem[idAttribute],
|
|
2100
|
-
fieldOptionValue: optionItem[nameAttribute]
|
|
2101
|
-
};
|
|
2102
|
-
fieldOptions.push(fieldOption);
|
|
2103
|
-
}
|
|
2104
|
-
fieldObject.setFieldOptions(fieldOptions);
|
|
1931
|
+
// Acciones
|
|
1932
|
+
get actions() { return this._actions; }
|
|
1933
|
+
getActionsByAttribute(name, value) { return this._actionArray.filter(actionItem => actionItem.matchAttribute(name, value)); }
|
|
1934
|
+
getActions() { return this._actionArray; }
|
|
1935
|
+
getAction(code) { var _a; return (code && ((_a = this._actions) === null || _a === void 0 ? void 0 : _a[code])) ? this._actions[code] : null; }
|
|
1936
|
+
showActions(codes) { return this.execOnActions(codes, SHOW); }
|
|
1937
|
+
hideActions(codes) { return this.execOnActions(codes, HIDE); }
|
|
1938
|
+
enableActions(codes) { return this.execOnActions(codes, ENABLE); }
|
|
1939
|
+
disableActions(codes) { return this.execOnActions(codes, DISABLE); }
|
|
1940
|
+
execOnActions(codes, functionName) {
|
|
1941
|
+
const actionCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
1942
|
+
if (!functionName || actionCodes.length === 0) {
|
|
1943
|
+
return;
|
|
2105
1944
|
}
|
|
1945
|
+
actionCodes.forEach(code => {
|
|
1946
|
+
var _a;
|
|
1947
|
+
const action = this.getAction(code);
|
|
1948
|
+
(_a = action === null || action === void 0 ? void 0 : action[functionName]) === null || _a === void 0 ? void 0 : _a.call(action);
|
|
1949
|
+
});
|
|
2106
1950
|
}
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
fieldUniverse = this.getFieldNames();
|
|
2122
|
-
}
|
|
2123
|
-
if (!filterFunc) {
|
|
2124
|
-
return fieldUniverse;
|
|
1951
|
+
// Tablas
|
|
1952
|
+
get tables() { return this.tables; }
|
|
1953
|
+
getTables() { return this._tableArray; }
|
|
1954
|
+
getTable(code) { var _a; return (code && ((_a = this._tables) === null || _a === void 0 ? void 0 : _a[code])) ? this._tables[code] : null; }
|
|
1955
|
+
getTableRecord(code, id) { var _a; return (_a = this.getTable(code)) === null || _a === void 0 ? void 0 : _a.getTableRecord(id); }
|
|
1956
|
+
enableTables(codes) { return this.execOnTables(codes, ENABLE); }
|
|
1957
|
+
disableTables(codes) { return this.execOnTables(codes, DISABLE); }
|
|
1958
|
+
showTables(codes) { return this.execOnTables(codes, SHOW); }
|
|
1959
|
+
hideTables(codes) { return this.execOnTables(codes, HIDE); }
|
|
1960
|
+
cleanTables(codes) { return this.execOnTables(codes, CLEAN); }
|
|
1961
|
+
execOnTables(codes, functionName) {
|
|
1962
|
+
const tableCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
1963
|
+
if (!functionName || tableCodes.length === 0) {
|
|
1964
|
+
return;
|
|
2125
1965
|
}
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
1966
|
+
tableCodes.forEach(code => {
|
|
1967
|
+
var _a;
|
|
1968
|
+
const table = this.getTable(code);
|
|
1969
|
+
(_a = table === null || table === void 0 ? void 0 : table[functionName]) === null || _a === void 0 ? void 0 : _a.call(table);
|
|
2129
1970
|
});
|
|
2130
1971
|
}
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
1972
|
+
// Secciones
|
|
1973
|
+
get sections() { return this._sectionArray; }
|
|
1974
|
+
getSections() { return this.sections; }
|
|
1975
|
+
getSectionsByAttribute(name, value) { return this._sectionArray.filter(item => item.matchAttribute(name, value)); }
|
|
1976
|
+
get sectionTitles() { return this._sectionArray.map(formSection => formSection.sectionTitle); }
|
|
1977
|
+
get visibleSections() { return this._sectionArray.filter(sec => sec.visible); }
|
|
1978
|
+
getSection(code) { var _a; return (code && ((_a = this._sections) === null || _a === void 0 ? void 0 : _a[code])) ? this._sections[code] : null; }
|
|
1979
|
+
showSections(codes) { this.execOnSections(codes, SHOW); }
|
|
1980
|
+
hideSections(codes) { this.execOnSections(codes, HIDE); }
|
|
1981
|
+
activeSection() { return this._exclusiveSectionsByAttr[ACTIVE]; }
|
|
1982
|
+
getSubSection(code, subCode) { var _a, _b; return (_b = (_a = this.getSection(code)) === null || _a === void 0 ? void 0 : _a.getSubsection(subCode)) !== null && _b !== void 0 ? _b : null; }
|
|
1983
|
+
showSubSections(code, subCodes) { return this.execOnSubSections(code, subCodes, SHOW); }
|
|
1984
|
+
hideSubSections(code, subCodes) { return this.execOnSubSections(code, subCodes, HIDE); }
|
|
1985
|
+
activateSection(code) {
|
|
1986
|
+
var _a, _b;
|
|
1987
|
+
if (code === this._exclusiveSectionsByAttr[ACTIVE]) {
|
|
1988
|
+
return;
|
|
2147
1989
|
}
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
return this.applyProcessToFieldSet(fld => fld.show(), fieldArray, sectionCode, subSectionCode);
|
|
2152
|
-
}
|
|
2153
|
-
hideFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2154
|
-
return this.applyProcessToFieldSet(fld => fld.hide(), fieldArray, sectionCode, subSectionCode);
|
|
2155
|
-
}
|
|
2156
|
-
showLabelFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2157
|
-
return this.applyProcessToFieldSet(fld => fld.showLablel(), fieldArray, sectionCode, subSectionCode);
|
|
2158
|
-
}
|
|
2159
|
-
hideLabelFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2160
|
-
return this.applyProcessToFieldSet(fld => fld.hideLabel(), fieldArray, sectionCode, subSectionCode);
|
|
2161
|
-
}
|
|
2162
|
-
// Para deprecar
|
|
2163
|
-
enableEditFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2164
|
-
return this.enableFields(fieldArray, sectionCode, subSectionCode);
|
|
2165
|
-
}
|
|
2166
|
-
// Para deprecar
|
|
2167
|
-
disableEditFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2168
|
-
return this.disableFields(fieldArray, sectionCode, subSectionCode);
|
|
2169
|
-
}
|
|
2170
|
-
enableFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2171
|
-
return this.applyProcessToFieldSet(fld => fld.enable(), fieldArray, sectionCode, subSectionCode);
|
|
2172
|
-
}
|
|
2173
|
-
disableFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2174
|
-
return this.applyProcessToFieldSet(fld => fld.disable(), fieldArray, sectionCode, subSectionCode);
|
|
2175
|
-
}
|
|
2176
|
-
cleanFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2177
|
-
return this.applyProcessToFieldSet(fieldObject => {
|
|
2178
|
-
fieldObject.clean('');
|
|
2179
|
-
fieldObject.setErrorMessage('');
|
|
2180
|
-
}, fieldArray, sectionCode, subSectionCode);
|
|
2181
|
-
}
|
|
2182
|
-
getRequiredFields(fieldArray, sectionCode = null, subSectionCode = null) {
|
|
2183
|
-
return this.getFieldSet(fld => fld.fieldRequired, fieldArray, sectionCode, subSectionCode);
|
|
2184
|
-
}
|
|
2185
|
-
getRequiredEmptyFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2186
|
-
return this.getFieldSet(fld => fld.fieldRequired && fld.isEmpty(), fieldArray, sectionCode, subSectionCode);
|
|
1990
|
+
(_a = this.getSection(this.activeSection())) === null || _a === void 0 ? void 0 : _a.inactivate();
|
|
1991
|
+
(_b = this.getSection(code)) === null || _b === void 0 ? void 0 : _b.activate();
|
|
1992
|
+
this._exclusiveSectionsByAttr[ACTIVE] = code;
|
|
2187
1993
|
}
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
return this.getFieldSet(fld => fld.errorCode !== NO_ERROR, fieldArray, sectionCode, subSectionCode);
|
|
2193
|
-
}
|
|
2194
|
-
tagFieldsWithError(errorMessage, fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2195
|
-
return this.applyProcessToFieldSet(fieldObject => {
|
|
2196
|
-
fieldObject.setErrorMessage(errorMessage);
|
|
2197
|
-
}, fieldArray, sectionCode, subSectionCode);
|
|
2198
|
-
}
|
|
2199
|
-
cleanErrorFields(fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2200
|
-
this.tagFieldsWithError('', fieldArray, sectionCode, subSectionCode);
|
|
2201
|
-
}
|
|
2202
|
-
tagEmptyRequiredFields(errorMessage, fieldArray = null, sectionCode = null, subSectionCode = null) {
|
|
2203
|
-
const pendingFields = this.getRequiredEmptyFields(fieldArray, sectionCode, subSectionCode);
|
|
2204
|
-
if (pendingFields && pendingFields.length > 0) {
|
|
2205
|
-
this.tagFieldsWithError(errorMessage, pendingFields);
|
|
2206
|
-
return true;
|
|
1994
|
+
execOnSections(codes, functionName) {
|
|
1995
|
+
const sectionCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
1996
|
+
if (!functionName || sectionCodes.length === 0) {
|
|
1997
|
+
return;
|
|
2207
1998
|
}
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
}
|
|
2214
|
-
getTableRecord(tableCode, recordId) {
|
|
2215
|
-
const tableObject = this.getTableObject(tableCode);
|
|
2216
|
-
return (tableObject) ? tableObject.getTableRecord(recordId) : null;
|
|
2217
|
-
}
|
|
2218
|
-
hideTable(tableCode) {
|
|
2219
|
-
const tableObject = this.getTableObject(tableCode);
|
|
2220
|
-
return (tableObject) ? tableObject.hide() : null;
|
|
2221
|
-
}
|
|
2222
|
-
showTable(tableCode) {
|
|
2223
|
-
const tableObject = this.getTableObject(tableCode);
|
|
2224
|
-
return (tableObject) ? tableObject.show() : null;
|
|
1999
|
+
sectionCodes.forEach(code => {
|
|
2000
|
+
var _a;
|
|
2001
|
+
const section = this.getSection(code);
|
|
2002
|
+
(_a = section === null || section === void 0 ? void 0 : section[functionName]) === null || _a === void 0 ? void 0 : _a.call(section);
|
|
2003
|
+
});
|
|
2225
2004
|
}
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2005
|
+
execOnSubSections(code, subNames, functionName) {
|
|
2006
|
+
var _a;
|
|
2007
|
+
const subCodes = (Array.isArray(subNames)) ? subNames : (subNames ? [subNames] : []);
|
|
2008
|
+
const section = this.getSection(code);
|
|
2009
|
+
if (!functionName || !section || subCodes.length === 0) {
|
|
2010
|
+
return;
|
|
2011
|
+
}
|
|
2012
|
+
for (const subCode of subCodes) {
|
|
2013
|
+
const subSection = this.getSubSection(code, subCode);
|
|
2014
|
+
(_a = subSection === null || subSection === void 0 ? void 0 : subSection[functionName]) === null || _a === void 0 ? void 0 : _a.call(subSection);
|
|
2015
|
+
}
|
|
2229
2016
|
}
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2017
|
+
/**
|
|
2018
|
+
* Métodos propios de gestión del formulario
|
|
2019
|
+
*/
|
|
2020
|
+
cleanData() {
|
|
2021
|
+
for (const field of this._fieldArray) {
|
|
2022
|
+
field.setValue(field.defaultValue);
|
|
2023
|
+
}
|
|
2024
|
+
for (const table of this._tableArray) {
|
|
2025
|
+
table.clean();
|
|
2026
|
+
}
|
|
2233
2027
|
}
|
|
2234
|
-
/** payload para servicios Tuain */
|
|
2235
2028
|
getPayload() {
|
|
2236
2029
|
const formData = {
|
|
2237
2030
|
fields: [],
|
|
2238
2031
|
tables: [],
|
|
2239
2032
|
};
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
currentFilter: tableDescriptor.currentFilter,
|
|
2266
|
-
sortingColumn: tableDescriptor.sorting.columnName,
|
|
2267
|
-
sortingDirection: tableDescriptor.sorting.direction,
|
|
2268
|
-
};
|
|
2269
|
-
formData.tables.push(formTable);
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2033
|
+
formData.fields = this.getFields().filter(fld => !fld.outputOnly)
|
|
2034
|
+
.map(fld => {
|
|
2035
|
+
const fieldPayload = {
|
|
2036
|
+
fieldCode: fld.fieldCode,
|
|
2037
|
+
fieldValue: fld.getValue(),
|
|
2038
|
+
editable: !fld.disabled,
|
|
2039
|
+
visible: fld.visible,
|
|
2040
|
+
required: fld.required,
|
|
2041
|
+
fieldOptions: '',
|
|
2042
|
+
};
|
|
2043
|
+
return fieldPayload;
|
|
2044
|
+
});
|
|
2045
|
+
formData.tables = this.getTables().map(tbl => {
|
|
2046
|
+
const tablePayload = {
|
|
2047
|
+
tableCode: tbl.tableCode,
|
|
2048
|
+
visible: tbl.visible,
|
|
2049
|
+
currentPage: tbl.currentPage,
|
|
2050
|
+
requestedPage: tbl.requestedPage,
|
|
2051
|
+
recordsPerPage: tbl.recordsPerPage,
|
|
2052
|
+
currentFilter: tbl.currentFilter,
|
|
2053
|
+
sortingColumn: tbl.sorting.columnName,
|
|
2054
|
+
sortingDirection: tbl.sorting.direction,
|
|
2055
|
+
};
|
|
2056
|
+
return tablePayload;
|
|
2057
|
+
});
|
|
2272
2058
|
return formData;
|
|
2273
2059
|
}
|
|
2274
2060
|
}
|
|
@@ -2383,35 +2169,336 @@ class BasicFormComponent {
|
|
|
2383
2169
|
this.formManagerService = formManagerService;
|
|
2384
2170
|
this._eventManager = _eventManager;
|
|
2385
2171
|
this.fileMgmtServices = fileMgmtServices;
|
|
2172
|
+
this._formStructure = null;
|
|
2173
|
+
this._controlToken = null;
|
|
2174
|
+
this._definitionObtained = false;
|
|
2175
|
+
// Eventos de acciones y campos
|
|
2176
|
+
this._formSectionsActivate = {};
|
|
2177
|
+
this._formSectionsInactivate = {};
|
|
2178
|
+
this._formActionsStart = {};
|
|
2179
|
+
this._formActionsFinish = {};
|
|
2180
|
+
this._fieldInputValidation = {};
|
|
2181
|
+
this._fieldValidationsStart = {};
|
|
2182
|
+
this._fieldValidationsFinish = {};
|
|
2183
|
+
// Callback de acciones de tablas
|
|
2184
|
+
this._tableSelectionsStart = {};
|
|
2185
|
+
this._tableSelectionsFinish = {};
|
|
2186
|
+
this._tableActionsStart = {};
|
|
2187
|
+
this._tableActionsFinish = {};
|
|
2188
|
+
this._tableGetDataStart = {};
|
|
2189
|
+
this._tableGetDataFinish = {};
|
|
2190
|
+
this.inputDataFields = {};
|
|
2191
|
+
this.extraData = {};
|
|
2192
|
+
this._errorType = '';
|
|
2386
2193
|
this.errorCode = '';
|
|
2387
2194
|
this.errorMessage = '';
|
|
2388
2195
|
this.errorDetail = '';
|
|
2389
|
-
this.
|
|
2390
|
-
this.controlToken = null;
|
|
2391
|
-
this.inputDataFields = {};
|
|
2392
|
-
this.extraData = {};
|
|
2393
|
-
this.definitionObtained = false;
|
|
2394
|
-
this.formVisible = false;
|
|
2196
|
+
this.visible = false;
|
|
2395
2197
|
this.busy = false;
|
|
2396
|
-
this.formSectionsActivate = {};
|
|
2397
|
-
this.formSectionsInactivate = {};
|
|
2398
|
-
this.formActionsStart = {};
|
|
2399
|
-
this.formActionsFinish = {};
|
|
2400
|
-
this.fieldInputValidation = {};
|
|
2401
|
-
this.fieldValidationsStart = {};
|
|
2402
|
-
this.fieldValidationsFinish = {};
|
|
2403
|
-
// Callback de acciones de tablas
|
|
2404
|
-
this.tableSelectionsStart = {};
|
|
2405
|
-
this.tableSelectionsFinish = {};
|
|
2406
|
-
this.tableActionsStart = {};
|
|
2407
|
-
this.tableActionsFinish = {};
|
|
2408
|
-
this.tableGetDataStart = {};
|
|
2409
|
-
this.tableGetDataFinish = {};
|
|
2410
2198
|
this._eventEmiter = this._eventManager;
|
|
2411
2199
|
this.cleanStart();
|
|
2412
2200
|
this.customPreProcessing();
|
|
2413
2201
|
}
|
|
2414
|
-
|
|
2202
|
+
getTitle() {
|
|
2203
|
+
var _a;
|
|
2204
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTitle();
|
|
2205
|
+
}
|
|
2206
|
+
setTitle(title) {
|
|
2207
|
+
var _a;
|
|
2208
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setTitle(title);
|
|
2209
|
+
}
|
|
2210
|
+
cleanData() {
|
|
2211
|
+
var _a;
|
|
2212
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanData();
|
|
2213
|
+
}
|
|
2214
|
+
getCurrentState() {
|
|
2215
|
+
var _a;
|
|
2216
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getCurrentState();
|
|
2217
|
+
}
|
|
2218
|
+
supportState(state) {
|
|
2219
|
+
var _a;
|
|
2220
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.supportState(state);
|
|
2221
|
+
}
|
|
2222
|
+
changeState(state) {
|
|
2223
|
+
var _a;
|
|
2224
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.changeState(state);
|
|
2225
|
+
}
|
|
2226
|
+
getStates() {
|
|
2227
|
+
var _a;
|
|
2228
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.states;
|
|
2229
|
+
}
|
|
2230
|
+
getImmutableElement(name) {
|
|
2231
|
+
var _a;
|
|
2232
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getImmutableElement(name);
|
|
2233
|
+
}
|
|
2234
|
+
getExtraInfo(name) {
|
|
2235
|
+
var _a;
|
|
2236
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getExtraInfo(name);
|
|
2237
|
+
}
|
|
2238
|
+
getFields() {
|
|
2239
|
+
var _a;
|
|
2240
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields();
|
|
2241
|
+
}
|
|
2242
|
+
getFieldNames() {
|
|
2243
|
+
var _a;
|
|
2244
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldNames();
|
|
2245
|
+
}
|
|
2246
|
+
getField(code) {
|
|
2247
|
+
var _a;
|
|
2248
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getField(code);
|
|
2249
|
+
}
|
|
2250
|
+
enableField(code) {
|
|
2251
|
+
var _a;
|
|
2252
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableField(code);
|
|
2253
|
+
}
|
|
2254
|
+
disableField(code) {
|
|
2255
|
+
var _a;
|
|
2256
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableField(code);
|
|
2257
|
+
}
|
|
2258
|
+
getFieldValue(code) {
|
|
2259
|
+
var _a;
|
|
2260
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldValue(code);
|
|
2261
|
+
}
|
|
2262
|
+
getFieldsValues(codes) {
|
|
2263
|
+
var _a;
|
|
2264
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsValues(codes);
|
|
2265
|
+
}
|
|
2266
|
+
getFieldOptions(code) {
|
|
2267
|
+
var _a;
|
|
2268
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldOptions(code);
|
|
2269
|
+
}
|
|
2270
|
+
setFieldValue(code, value) {
|
|
2271
|
+
var _a;
|
|
2272
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldValue(code, value);
|
|
2273
|
+
}
|
|
2274
|
+
setFieldRequired(code, required) {
|
|
2275
|
+
var _a;
|
|
2276
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldRequired(code, required);
|
|
2277
|
+
}
|
|
2278
|
+
setFieldErrorMessage(code, errorMessage) {
|
|
2279
|
+
var _a;
|
|
2280
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldErrorMessage(code, errorMessage);
|
|
2281
|
+
}
|
|
2282
|
+
setFieldError(code, message, type) {
|
|
2283
|
+
var _a;
|
|
2284
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldError(code, message, type);
|
|
2285
|
+
}
|
|
2286
|
+
setFieldIntrinsicErrorMessage(code, message) {
|
|
2287
|
+
var _a;
|
|
2288
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldIntrinsicErrorMessage(code, message);
|
|
2289
|
+
}
|
|
2290
|
+
setFieldOptions(code, optionsArray, idAttribute, nameAttribute) {
|
|
2291
|
+
var _a;
|
|
2292
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setFieldOptions(code, optionsArray, idAttribute, nameAttribute);
|
|
2293
|
+
}
|
|
2294
|
+
getFieldSet(filterFunc, codes, secCode, subCode) {
|
|
2295
|
+
var _a;
|
|
2296
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldSet(filterFunc, codes, secCode, subCode);
|
|
2297
|
+
}
|
|
2298
|
+
applyOnFields(processFunc, codes, secCode, subCode) {
|
|
2299
|
+
var _a;
|
|
2300
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.applyOnFields(processFunc, codes, secCode, subCode);
|
|
2301
|
+
}
|
|
2302
|
+
applyProcessToAllFields(processFunc) {
|
|
2303
|
+
var _a;
|
|
2304
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.applyOnFields(processFunc);
|
|
2305
|
+
}
|
|
2306
|
+
cleanFields(codes, secCode, subCode) {
|
|
2307
|
+
var _a;
|
|
2308
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanFields(codes, secCode, subCode);
|
|
2309
|
+
}
|
|
2310
|
+
getRequiredFields(codes, secCode, subCode) {
|
|
2311
|
+
var _a;
|
|
2312
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredFields(codes, secCode, subCode);
|
|
2313
|
+
}
|
|
2314
|
+
getRequiredEmptyFields(codes, secCode, subCode) {
|
|
2315
|
+
var _a;
|
|
2316
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getRequiredEmptyFields(codes, secCode, subCode);
|
|
2317
|
+
}
|
|
2318
|
+
getChangedFields(codes, secCode, subCode) {
|
|
2319
|
+
var _a;
|
|
2320
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getChangedFields(codes, secCode, subCode);
|
|
2321
|
+
}
|
|
2322
|
+
getFieldsWithValidationIssues(codes, secCode, subCode) {
|
|
2323
|
+
var _a;
|
|
2324
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFieldsWithValidationIssues(codes, secCode, subCode);
|
|
2325
|
+
}
|
|
2326
|
+
tagFieldsWithError(errorMessage, codes, secCode, subCode) {
|
|
2327
|
+
var _a;
|
|
2328
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.tagFieldsWithError(errorMessage, codes, secCode, subCode);
|
|
2329
|
+
}
|
|
2330
|
+
cleanErrorFields(codes, secCode, subCode) {
|
|
2331
|
+
var _a;
|
|
2332
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanErrorFields(codes, secCode, subCode);
|
|
2333
|
+
}
|
|
2334
|
+
showLabelFields(codes, secCode, subCode) {
|
|
2335
|
+
var _a;
|
|
2336
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showLabelFields(codes, secCode, subCode);
|
|
2337
|
+
}
|
|
2338
|
+
hideLabelFields(codes, secCode, subCode) {
|
|
2339
|
+
var _a;
|
|
2340
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideLabelFields(codes, secCode, subCode);
|
|
2341
|
+
}
|
|
2342
|
+
enableFields(codes, secCode, subCode) {
|
|
2343
|
+
var _a;
|
|
2344
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableFields(codes, secCode, subCode);
|
|
2345
|
+
}
|
|
2346
|
+
disableFields(codes, secCode, subCode) {
|
|
2347
|
+
var _a;
|
|
2348
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableFields(codes, secCode, subCode);
|
|
2349
|
+
}
|
|
2350
|
+
/**
|
|
2351
|
+
* @deprecated Use enableFields
|
|
2352
|
+
*/
|
|
2353
|
+
enableEditFields(codes, secCode, subCode) {
|
|
2354
|
+
return this.enableFields(codes, secCode, subCode);
|
|
2355
|
+
}
|
|
2356
|
+
/**
|
|
2357
|
+
* @deprecated Use disableFields
|
|
2358
|
+
*/
|
|
2359
|
+
disableEditFields(codes, secCode, subCode) {
|
|
2360
|
+
return this.disableFields(codes, secCode, subCode);
|
|
2361
|
+
}
|
|
2362
|
+
showFields(codes, secCode, subCode) {
|
|
2363
|
+
var _a;
|
|
2364
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showFields(codes, secCode, subCode);
|
|
2365
|
+
}
|
|
2366
|
+
hideFields(codes, secCode, subCode) {
|
|
2367
|
+
var _a;
|
|
2368
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideFields(codes, secCode, subCode);
|
|
2369
|
+
}
|
|
2370
|
+
getActionsByAttribute(name, value) {
|
|
2371
|
+
var _a;
|
|
2372
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActionsByAttribute(name, value);
|
|
2373
|
+
}
|
|
2374
|
+
getHeaderActions() {
|
|
2375
|
+
var _a;
|
|
2376
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActionsByAttribute('location', HEADER$1);
|
|
2377
|
+
}
|
|
2378
|
+
getAction(actionCode) {
|
|
2379
|
+
var _a;
|
|
2380
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getAction(actionCode);
|
|
2381
|
+
}
|
|
2382
|
+
showActions(actionArray) {
|
|
2383
|
+
var _a;
|
|
2384
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showActions(actionArray);
|
|
2385
|
+
}
|
|
2386
|
+
hideActions(actionArray) {
|
|
2387
|
+
var _a;
|
|
2388
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideActions(actionArray);
|
|
2389
|
+
}
|
|
2390
|
+
enableActions(actionArray) {
|
|
2391
|
+
var _a;
|
|
2392
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableActions(actionArray);
|
|
2393
|
+
}
|
|
2394
|
+
disableActions(actionArray) {
|
|
2395
|
+
var _a;
|
|
2396
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableActions(actionArray);
|
|
2397
|
+
}
|
|
2398
|
+
showAction(code) {
|
|
2399
|
+
var _a;
|
|
2400
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showActions(code);
|
|
2401
|
+
}
|
|
2402
|
+
hideAction(code) {
|
|
2403
|
+
var _a;
|
|
2404
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideActions(code);
|
|
2405
|
+
}
|
|
2406
|
+
enableAction(code) {
|
|
2407
|
+
var _a;
|
|
2408
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.enableActions(code);
|
|
2409
|
+
}
|
|
2410
|
+
disableAction(code) {
|
|
2411
|
+
var _a;
|
|
2412
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.disableActions(code);
|
|
2413
|
+
}
|
|
2414
|
+
getSections() {
|
|
2415
|
+
var _a;
|
|
2416
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections();
|
|
2417
|
+
}
|
|
2418
|
+
activateSection(code) {
|
|
2419
|
+
var _a;
|
|
2420
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.activateSection(code);
|
|
2421
|
+
}
|
|
2422
|
+
getSectionsTitles() {
|
|
2423
|
+
var _a;
|
|
2424
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSections().map(sec => sec.title);
|
|
2425
|
+
}
|
|
2426
|
+
getSection(code) {
|
|
2427
|
+
var _a;
|
|
2428
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
|
|
2429
|
+
}
|
|
2430
|
+
showSection(code) {
|
|
2431
|
+
var _a;
|
|
2432
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSections(code);
|
|
2433
|
+
}
|
|
2434
|
+
hideSection(code) {
|
|
2435
|
+
var _a;
|
|
2436
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSections(code);
|
|
2437
|
+
}
|
|
2438
|
+
showSections(codes) {
|
|
2439
|
+
var _a;
|
|
2440
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSections(codes);
|
|
2441
|
+
}
|
|
2442
|
+
hideSections(codes) {
|
|
2443
|
+
var _a;
|
|
2444
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSections(codes);
|
|
2445
|
+
}
|
|
2446
|
+
getSubSection(code, subCode) {
|
|
2447
|
+
var _a;
|
|
2448
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSubSection(code, subCode);
|
|
2449
|
+
}
|
|
2450
|
+
showSubSection(code, subCode) {
|
|
2451
|
+
var _a;
|
|
2452
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSubSections(code, subCode);
|
|
2453
|
+
}
|
|
2454
|
+
hideSubSection(code, subCode) {
|
|
2455
|
+
var _a;
|
|
2456
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSubSections(code, subCode);
|
|
2457
|
+
}
|
|
2458
|
+
showSubSections(code, subCodes) {
|
|
2459
|
+
var _a;
|
|
2460
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showSubSections(code, subCodes);
|
|
2461
|
+
}
|
|
2462
|
+
hideSubSections(code, subCodes) {
|
|
2463
|
+
var _a;
|
|
2464
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideSubSections(code, subCodes);
|
|
2465
|
+
}
|
|
2466
|
+
getTables() {
|
|
2467
|
+
var _a;
|
|
2468
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTables();
|
|
2469
|
+
}
|
|
2470
|
+
showTables(codes) {
|
|
2471
|
+
var _a;
|
|
2472
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showTables(codes);
|
|
2473
|
+
}
|
|
2474
|
+
hideTables(codes) {
|
|
2475
|
+
var _a;
|
|
2476
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideTables(codes);
|
|
2477
|
+
}
|
|
2478
|
+
cleanTables(codes) {
|
|
2479
|
+
var _a;
|
|
2480
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanTables(codes);
|
|
2481
|
+
}
|
|
2482
|
+
getTable(code) {
|
|
2483
|
+
var _a;
|
|
2484
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTable(code);
|
|
2485
|
+
}
|
|
2486
|
+
showTable(code) {
|
|
2487
|
+
var _a;
|
|
2488
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.showTables(code);
|
|
2489
|
+
}
|
|
2490
|
+
hideTable(code) {
|
|
2491
|
+
var _a;
|
|
2492
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.hideTables(code);
|
|
2493
|
+
}
|
|
2494
|
+
cleanTable(code) {
|
|
2495
|
+
var _a, _b;
|
|
2496
|
+
return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTable(code)) === null || _b === void 0 ? void 0 : _b.clean();
|
|
2497
|
+
}
|
|
2498
|
+
getTableRecord(code, recordId) {
|
|
2499
|
+
var _a;
|
|
2500
|
+
return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTableRecord(code, recordId);
|
|
2501
|
+
}
|
|
2415
2502
|
setConfig(formConfig) {
|
|
2416
2503
|
this.formConfig = formConfig;
|
|
2417
2504
|
}
|
|
@@ -2420,150 +2507,46 @@ class BasicFormComponent {
|
|
|
2420
2507
|
this.errorCode = '';
|
|
2421
2508
|
this.errorMessage = '';
|
|
2422
2509
|
this.errorDetail = '';
|
|
2423
|
-
this.
|
|
2510
|
+
this._formStructure = null;
|
|
2424
2511
|
this.fields = null;
|
|
2425
2512
|
this.actions = null;
|
|
2426
|
-
this.
|
|
2513
|
+
this._controlToken = null;
|
|
2427
2514
|
this.inputDataFields = {};
|
|
2428
|
-
this.
|
|
2515
|
+
this._definitionObtained = false;
|
|
2429
2516
|
// Se limpian los manejadores de eventos
|
|
2430
|
-
this.
|
|
2517
|
+
this.visible = false;
|
|
2431
2518
|
this.busy = false;
|
|
2432
|
-
this.
|
|
2433
|
-
this.
|
|
2434
|
-
this.
|
|
2435
|
-
this.
|
|
2436
|
-
this.
|
|
2437
|
-
this.
|
|
2438
|
-
this.
|
|
2439
|
-
this.
|
|
2440
|
-
this.
|
|
2441
|
-
this.
|
|
2442
|
-
this.
|
|
2443
|
-
this.
|
|
2444
|
-
this.
|
|
2445
|
-
}
|
|
2446
|
-
get
|
|
2447
|
-
get
|
|
2448
|
-
|
|
2519
|
+
this._formSectionsActivate = {};
|
|
2520
|
+
this._formSectionsInactivate = {};
|
|
2521
|
+
this._formActionsStart = {};
|
|
2522
|
+
this._formActionsFinish = {};
|
|
2523
|
+
this._fieldInputValidation = {};
|
|
2524
|
+
this._fieldValidationsStart = {};
|
|
2525
|
+
this._fieldValidationsFinish = {};
|
|
2526
|
+
this._tableSelectionsStart = {};
|
|
2527
|
+
this._tableSelectionsFinish = {};
|
|
2528
|
+
this._tableActionsStart = {};
|
|
2529
|
+
this._tableActionsFinish = {};
|
|
2530
|
+
this._tableGetDataStart = {};
|
|
2531
|
+
this._tableGetDataFinish = {};
|
|
2532
|
+
}
|
|
2533
|
+
get formVisible() { return this.visible; }
|
|
2534
|
+
get formManager() { return this; }
|
|
2535
|
+
get formCode() { return this.name; }
|
|
2536
|
+
set formCode(name) { this.name = name; }
|
|
2537
|
+
get inServerProcess() { return this.busy; }
|
|
2538
|
+
get form() { return this._formStructure; }
|
|
2539
|
+
get state() { return this.getCurrentState(); }
|
|
2540
|
+
get currentState() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state; }
|
|
2541
|
+
set currentState(state) { this._formStructure.changeState(state); }
|
|
2449
2542
|
get currentMode() { return this.currentState; }
|
|
2450
|
-
get immutableData() { return this.
|
|
2451
|
-
get extraInfo() { return this.
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
getImmutableElement(name) { return this.formStructure.getImmutableElement(name); }
|
|
2458
|
-
getExtraInfo(name) { return this.formStructure.getExtraInfo(name); }
|
|
2459
|
-
cleanData() { return this.formStructure.cleanData(); }
|
|
2460
|
-
getFields() { return this.formStructure.getFields(); }
|
|
2461
|
-
getFieldNames() { return this.formStructure.getFieldNames(); }
|
|
2462
|
-
getFieldObject(elementId) { return this.formStructure.getFieldObject(elementId); }
|
|
2463
|
-
getField(fieldCode) { return this.getFieldObject(fieldCode); }
|
|
2464
|
-
enableField(fieldCode) { return this.formStructure.enableField(fieldCode); }
|
|
2465
|
-
disableField(fieldCode) { return this.formStructure.disableField(fieldCode); }
|
|
2466
|
-
getFieldValue(fieldCode) { return this.formStructure.getFieldValue(fieldCode); }
|
|
2467
|
-
getFieldsValues(fieldCodesArray) { return this.formStructure.getFieldsValues(fieldCodesArray); }
|
|
2468
|
-
getFieldOptions(fieldCode) { return this.formStructure.getFieldOptions(fieldCode); }
|
|
2469
|
-
setFieldValue(fieldCode, fieldValue) { return this.formStructure.setFieldValue(fieldCode, fieldValue); }
|
|
2470
|
-
setFieldRequired(fieldCode, required) { return this.formStructure.setFieldRequired(fieldCode, required); }
|
|
2471
|
-
setFieldErrorMessage(fieldCode, errorMessage) { return this.formStructure.setFieldErrorMessage(fieldCode, errorMessage); }
|
|
2472
|
-
setFieldError(code, message, type = 'error') { return this.formStructure.setFieldError(code, message, type); }
|
|
2473
|
-
setFieldIntrinsicErrorMessage(code, message) { return this.formStructure.setFieldIntrinsicErrorMessage(code, message); }
|
|
2474
|
-
setFieldOptions(fieldCode, optionsArray, idAttribute, nameAttribute) {
|
|
2475
|
-
return this.formStructure.setFieldOptions(fieldCode, optionsArray, idAttribute, nameAttribute);
|
|
2476
|
-
}
|
|
2477
|
-
getFieldSet(filterFunc, fieldArray, sectionCode, subSectionCode) {
|
|
2478
|
-
return this.formStructure.getFieldSet(filterFunc, fieldArray, sectionCode, subSectionCode);
|
|
2479
|
-
}
|
|
2480
|
-
applyProcessToFieldSet(processFunc, fieldArray, sectionCode, subSectionCode) {
|
|
2481
|
-
return this.formStructure.applyProcessToFieldSet(processFunc, fieldArray, sectionCode, subSectionCode);
|
|
2482
|
-
}
|
|
2483
|
-
applyProcessToAllFields(processFunc) { return this.formStructure.applyProcessToFieldSet(processFunc); }
|
|
2484
|
-
cleanFields(fieldArray, sectionCode, subSectionCode) {
|
|
2485
|
-
return this.formStructure.cleanFields(fieldArray, sectionCode, subSectionCode);
|
|
2486
|
-
}
|
|
2487
|
-
getRequiredFields(fieldArray, sectionCode, subSectionCode) {
|
|
2488
|
-
return this.formStructure.getRequiredFields(fieldArray, sectionCode, subSectionCode);
|
|
2489
|
-
}
|
|
2490
|
-
getRequiredEmptyFields(fieldArray, sectionCode, subSectionCode) {
|
|
2491
|
-
return this.formStructure.getRequiredEmptyFields(fieldArray, sectionCode, subSectionCode);
|
|
2492
|
-
}
|
|
2493
|
-
getChangedFields(fieldArray, sectionCode, subSectionCode) {
|
|
2494
|
-
return this.formStructure.getChangedFields(fieldArray, sectionCode, subSectionCode);
|
|
2495
|
-
}
|
|
2496
|
-
getFieldsWithValidationIssues(fieldArray, sectionCode, subSectionCode) {
|
|
2497
|
-
return this.formStructure.getFieldsWithValidationIssues(fieldArray, sectionCode, subSectionCode);
|
|
2498
|
-
}
|
|
2499
|
-
tagFieldsWithError(errorMessage, fieldArray, sectionCode, subSectionCode) {
|
|
2500
|
-
return this.formStructure.tagFieldsWithError(errorMessage, fieldArray, sectionCode, subSectionCode);
|
|
2501
|
-
}
|
|
2502
|
-
cleanErrorFields(fieldArray, sectionCode, subSectionCode) {
|
|
2503
|
-
return this.formStructure.cleanErrorFields(fieldArray, sectionCode, subSectionCode);
|
|
2504
|
-
}
|
|
2505
|
-
showLabelFields(fieldArray, sectionCode, subSectionCode) {
|
|
2506
|
-
return this.formStructure.showLabelFields(fieldArray, sectionCode, subSectionCode);
|
|
2507
|
-
}
|
|
2508
|
-
hideLabelFields(fieldArray, sectionCode, subSectionCode) {
|
|
2509
|
-
return this.formStructure.hideLabelFields(fieldArray, sectionCode, subSectionCode);
|
|
2510
|
-
}
|
|
2511
|
-
enableFields(fieldArray, sectionCode, subSectionCode) {
|
|
2512
|
-
return this.formStructure.enableFields(fieldArray, sectionCode, subSectionCode);
|
|
2513
|
-
}
|
|
2514
|
-
disableFields(fieldArray, sectionCode, subSectionCode) {
|
|
2515
|
-
return this.formStructure.disableFields(fieldArray, sectionCode, subSectionCode);
|
|
2516
|
-
}
|
|
2517
|
-
enableEditFields(fieldArray, sectionCode, subSectionCode) {
|
|
2518
|
-
return this.formStructure.enableEditFields(fieldArray, sectionCode, subSectionCode);
|
|
2519
|
-
}
|
|
2520
|
-
disableEditFields(fieldArray, sectionCode, subSectionCode) {
|
|
2521
|
-
return this.formStructure.disableEditFields(fieldArray, sectionCode, subSectionCode);
|
|
2522
|
-
}
|
|
2523
|
-
showFields(fieldArray, sectionCode, subSectionCode) {
|
|
2524
|
-
return this.formStructure.showFields(fieldArray, sectionCode, subSectionCode);
|
|
2525
|
-
}
|
|
2526
|
-
hideFields(fieldArray, sectionCode, subSectionCode) {
|
|
2527
|
-
return this.formStructure.hideFields(fieldArray, sectionCode, subSectionCode);
|
|
2528
|
-
}
|
|
2529
|
-
getHeaderActions() { return this.formStructure.getHeaderActions(); }
|
|
2530
|
-
getActionObject(elementId) { return this.formStructure.getActionObject(elementId); }
|
|
2531
|
-
getAction(actionCode) { return this.getActionObject(actionCode); }
|
|
2532
|
-
getActionDefinition(actionCode) { return this.getActionObject(actionCode); }
|
|
2533
|
-
showAction(actionCode) { return this.formStructure.showAction(actionCode); }
|
|
2534
|
-
hideAction(actionCode) { return this.formStructure.hideAction(actionCode); }
|
|
2535
|
-
showActions(actionArray) { return this.formStructure.showActions(actionArray); }
|
|
2536
|
-
hideActions(actionArray) { return this.formStructure.hideActions(actionArray); }
|
|
2537
|
-
enableAction(actionCode) { return this.formStructure.enableAction(actionCode); }
|
|
2538
|
-
disableAction(actionCode) { return this.formStructure.disableAction(actionCode); }
|
|
2539
|
-
enableActions(actionArray) { return this.formStructure.enableActions(actionArray); }
|
|
2540
|
-
disableActions(actionArray) { return this.formStructure.disableActions(actionArray); }
|
|
2541
|
-
getStates() { return this.formStructure.getStates(); }
|
|
2542
|
-
getSections() { return this.formStructure.getSections(); }
|
|
2543
|
-
get visibleSections() { return this.formStructure.visibleSections; }
|
|
2544
|
-
getSection(sectionCode) { return this.formStructure.getSection(sectionCode); }
|
|
2545
|
-
activateSection(sectionCode) { return this.formStructure.activateSection(sectionCode); }
|
|
2546
|
-
getSubSection(sectionCode, subsectionCode) { return this.formStructure.getSubSection(sectionCode, subsectionCode); }
|
|
2547
|
-
numSections() { return this.formStructure.numSections(); }
|
|
2548
|
-
getSectionsTitles() { return this.formStructure.getSectionsTitles(); }
|
|
2549
|
-
getSectionObject(elementId) { return this.formStructure.getSectionObject(elementId); }
|
|
2550
|
-
showSection(sectionCode) { return this.formStructure.showSection(sectionCode); }
|
|
2551
|
-
hideSection(sectionCode) { return this.formStructure.hideSection(sectionCode); }
|
|
2552
|
-
showSections(sectionArray) { return this.formStructure.showSections(sectionArray); }
|
|
2553
|
-
hideSections(sectionArray) { return this.formStructure.hideSections(sectionArray); }
|
|
2554
|
-
showSubSection(sectionCode, subSectionCode) { return this.formStructure.showSubSection(sectionCode, subSectionCode); }
|
|
2555
|
-
hideSubSection(sectionCode, subSectionCode) { return this.formStructure.hideSubSection(sectionCode, subSectionCode); }
|
|
2556
|
-
showSubSections(sectionCode, subSectionArray) { return this.formStructure.showSubSections(sectionCode, subSectionArray); }
|
|
2557
|
-
hideSubSections(sectionCode, subSectionArray) { return this.formStructure.hideSubSections(sectionCode, subSectionArray); }
|
|
2558
|
-
getTables() { return this.formStructure.getTables(); }
|
|
2559
|
-
getTableObject(elementId) { return this.formStructure.getTableObject(elementId); }
|
|
2560
|
-
getTable(tableName) { return this.getTableObject(tableName); }
|
|
2561
|
-
showTable(tableName) { return this.formStructure.showTable(tableName); }
|
|
2562
|
-
hideTable(tableName) { return this.formStructure.hideTable(tableName); }
|
|
2563
|
-
showTables(tableArray) { return this.formStructure.showTables(tableArray); }
|
|
2564
|
-
hideTables(tableArray) { return this.formStructure.hideTables(tableArray); }
|
|
2565
|
-
cleanTable(tableName) { return this.formStructure.cleanTable(tableName); }
|
|
2566
|
-
getTableRecord(tableName, recordId) { return this.formStructure.getTableRecord(tableName, recordId); }
|
|
2543
|
+
get immutableData() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.immutableData; }
|
|
2544
|
+
get extraInfo() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.extraInfo; }
|
|
2545
|
+
get visibleSections() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.visibleSections; }
|
|
2546
|
+
get formRoute() { return this._formRoute; }
|
|
2547
|
+
set formRoute(route) { this._formRoute = route; }
|
|
2548
|
+
get subject() { return this.formSubject; }
|
|
2549
|
+
// Métodos virtuales
|
|
2567
2550
|
customPreProcessing() { }
|
|
2568
2551
|
customFormStart() { }
|
|
2569
2552
|
displayActionServerError() { }
|
|
@@ -2572,6 +2555,43 @@ class BasicFormComponent {
|
|
|
2572
2555
|
showFieldInfo(fieldCode) { }
|
|
2573
2556
|
showModalDialog(title, body, options, callback, params) { }
|
|
2574
2557
|
openUploadDialog(title, body, options, callback, params) { }
|
|
2558
|
+
/**
|
|
2559
|
+
* @deprecated Use supportState
|
|
2560
|
+
*/
|
|
2561
|
+
supportMode(state) { return this.supportState(state); }
|
|
2562
|
+
/**
|
|
2563
|
+
* @deprecated Use getField
|
|
2564
|
+
*/
|
|
2565
|
+
getFieldObject(code) { return this.getField(code); }
|
|
2566
|
+
/**
|
|
2567
|
+
* @deprecated Use getAction
|
|
2568
|
+
*/
|
|
2569
|
+
getActionObject(code) { return this.getAction(code); }
|
|
2570
|
+
/**
|
|
2571
|
+
* @deprecated Use getTable
|
|
2572
|
+
*/
|
|
2573
|
+
getTableObject(code) { return this.getTable(code); }
|
|
2574
|
+
/**
|
|
2575
|
+
* @deprecated Use getSection
|
|
2576
|
+
*/
|
|
2577
|
+
getSectionObject(code) { return this.getSection(code); }
|
|
2578
|
+
/**
|
|
2579
|
+
* @deprecated Use changeState
|
|
2580
|
+
*/
|
|
2581
|
+
changeFormMode(state) { return this.changeState(state); }
|
|
2582
|
+
/**
|
|
2583
|
+
* @deprecated Use subject
|
|
2584
|
+
*/
|
|
2585
|
+
getFormSubject() { return this.subject; }
|
|
2586
|
+
/**
|
|
2587
|
+
* @deprecated Use subject
|
|
2588
|
+
*/
|
|
2589
|
+
getSubject() { return this.formSubject; }
|
|
2590
|
+
/**
|
|
2591
|
+
* @deprecated Use subject
|
|
2592
|
+
*/
|
|
2593
|
+
getformSubject() { return this.getSubject(); }
|
|
2594
|
+
numSections() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.sections.length; }
|
|
2575
2595
|
subscribeAppEvent(eventName, callback) {
|
|
2576
2596
|
this._eventEmiter.subscribe(eventName, callback);
|
|
2577
2597
|
}
|
|
@@ -2579,7 +2599,7 @@ class BasicFormComponent {
|
|
|
2579
2599
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2580
2600
|
let origin = null;
|
|
2581
2601
|
if (!cleanStack) {
|
|
2582
|
-
origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this.
|
|
2602
|
+
origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this._controlToken });
|
|
2583
2603
|
origin.subject = (_a = origin === null || origin === void 0 ? void 0 : origin.subject) !== null && _a !== void 0 ? _a : this.formSubject;
|
|
2584
2604
|
origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.currentState;
|
|
2585
2605
|
origin.fields = (_c = origin === null || origin === void 0 ? void 0 : origin.fields) !== null && _c !== void 0 ? _c : {};
|
|
@@ -2592,49 +2612,39 @@ class BasicFormComponent {
|
|
|
2592
2612
|
target.extra = (_h = target === null || target === void 0 ? void 0 : target.extra) !== null && _h !== void 0 ? _h : {};
|
|
2593
2613
|
this.formManagerService.openForm(origin, target);
|
|
2594
2614
|
}
|
|
2595
|
-
canGoBack() { return this.
|
|
2615
|
+
canGoBack() { return this._originToken !== null; }
|
|
2596
2616
|
goBack() { return this.formManagerService.backTo(); }
|
|
2597
2617
|
goBackForm() { return this.goBack(); }
|
|
2598
|
-
getOriginDetail() { return this.formManagerService.getFormInfo(this.
|
|
2618
|
+
getOriginDetail() { return this.formManagerService.getFormInfo(this._originToken); }
|
|
2599
2619
|
setError(errorType, errorMessage, errorDetail) {
|
|
2600
2620
|
this._errorType = errorType || '';
|
|
2601
2621
|
this.errorMessage = errorMessage || '';
|
|
2602
2622
|
this.errorDetail = errorDetail || '';
|
|
2603
2623
|
}
|
|
2604
|
-
get formManager() { return this; }
|
|
2605
2624
|
resetError() { this.setError(null, null, null); }
|
|
2606
2625
|
getErrorType() { return this._errorType; }
|
|
2607
2626
|
getErrorMessage() { return this.errorMessage; }
|
|
2608
2627
|
getErrorDetail() { return this.errorDetail; }
|
|
2609
2628
|
getErrorCode() { return this._errorType; }
|
|
2610
|
-
get formRoute() { return this._formRoute; }
|
|
2611
|
-
set formRoute(route) { this._formRoute = route; }
|
|
2612
|
-
defineFormCode(name) { this.name = name; }
|
|
2613
|
-
getCurrentState() { return this.formStructure.state; }
|
|
2614
|
-
getCurrentMode() { return this.formStructure.state; }
|
|
2615
|
-
get formCode() { return this.name; }
|
|
2616
|
-
set formCode(name) { this.name = name; }
|
|
2617
2629
|
getFormParameter(name) {
|
|
2618
2630
|
var _a, _b;
|
|
2619
2631
|
return (name) ? ((_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null) : null;
|
|
2620
2632
|
}
|
|
2621
|
-
getSubject() { return this.formSubject; }
|
|
2622
|
-
getformSubject() { return this.getSubject(); }
|
|
2623
2633
|
preocessInputParams(params) {
|
|
2624
2634
|
var _a, _b, _c;
|
|
2625
|
-
this.
|
|
2626
|
-
const { token, subject, state, fields, extra, originToken } = this.formManagerService.getFormInfo(this.
|
|
2627
|
-
if (!this.
|
|
2628
|
-
return;
|
|
2635
|
+
this._controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
|
|
2636
|
+
const { token, subject, state, fields, extra, originToken } = this.formManagerService.getFormInfo(this._controlToken);
|
|
2637
|
+
if (!this._controlToken || this._controlToken !== token) {
|
|
2638
|
+
return null;
|
|
2629
2639
|
}
|
|
2630
2640
|
this.formSubject = (_c = (_b = params === null || params === void 0 ? void 0 : params[SUBJECT]) !== null && _b !== void 0 ? _b : subject) !== null && _c !== void 0 ? _c : null;
|
|
2631
2641
|
this.inputDataFields = fields;
|
|
2632
2642
|
this.extraData = extra;
|
|
2633
|
-
this.
|
|
2643
|
+
this._originToken = originToken;
|
|
2634
2644
|
return state;
|
|
2635
2645
|
}
|
|
2636
2646
|
subscribeSectionActivation() {
|
|
2637
|
-
const formSections = this.
|
|
2647
|
+
const formSections = this._formStructure.sections;
|
|
2638
2648
|
if (Array.isArray(formSections)) {
|
|
2639
2649
|
formSections.forEach(section => {
|
|
2640
2650
|
section.activation.subscribe(code => this.launchSectionActivation(code));
|
|
@@ -2643,7 +2653,7 @@ class BasicFormComponent {
|
|
|
2643
2653
|
}
|
|
2644
2654
|
}
|
|
2645
2655
|
subscribeFieldsSubjects() {
|
|
2646
|
-
const formFields = this.
|
|
2656
|
+
const formFields = this._formStructure.getFields();
|
|
2647
2657
|
if (Array.isArray(formFields)) {
|
|
2648
2658
|
formFields.forEach(field => {
|
|
2649
2659
|
field.editionFinish.subscribe(event => {
|
|
@@ -2659,7 +2669,7 @@ class BasicFormComponent {
|
|
|
2659
2669
|
}
|
|
2660
2670
|
}
|
|
2661
2671
|
subscribeActionSubjects() {
|
|
2662
|
-
const formActions = this.
|
|
2672
|
+
const formActions = this._formStructure.getActions();
|
|
2663
2673
|
if (Array.isArray(formActions)) {
|
|
2664
2674
|
formActions.forEach(action => {
|
|
2665
2675
|
action.actionActivated.subscribe(code => this.startAction(code));
|
|
@@ -2667,7 +2677,7 @@ class BasicFormComponent {
|
|
|
2667
2677
|
}
|
|
2668
2678
|
}
|
|
2669
2679
|
subscribeTableSubjects() {
|
|
2670
|
-
const formTables = this.
|
|
2680
|
+
const formTables = this._formStructure.getTables();
|
|
2671
2681
|
if (Array.isArray(formTables)) {
|
|
2672
2682
|
formTables.forEach(table => {
|
|
2673
2683
|
table.inlineActionTrigger.subscribe(event => this.startTableAction(event));
|
|
@@ -2684,22 +2694,22 @@ class BasicFormComponent {
|
|
|
2684
2694
|
if (!this.name) {
|
|
2685
2695
|
return;
|
|
2686
2696
|
}
|
|
2687
|
-
if (!this.
|
|
2697
|
+
if (!this._definitionObtained) {
|
|
2688
2698
|
this.busy = true;
|
|
2689
2699
|
const formDefinition = yield this.formManagerService.getFormDefinition(this.name);
|
|
2690
2700
|
this.busy = false;
|
|
2691
|
-
this.
|
|
2692
|
-
this.fields = this.
|
|
2693
|
-
this.actions = this.
|
|
2694
|
-
this.
|
|
2701
|
+
this._formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
2702
|
+
this.fields = this._formStructure.fields;
|
|
2703
|
+
this.actions = this._formStructure.actions;
|
|
2704
|
+
this._definitionObtained = true;
|
|
2695
2705
|
}
|
|
2696
2706
|
else {
|
|
2697
2707
|
this.cleanData();
|
|
2698
2708
|
}
|
|
2699
2709
|
if (!this.supportState(initialState)) {
|
|
2700
|
-
initialState = this.
|
|
2710
|
+
initialState = this._formStructure.defaultState;
|
|
2701
2711
|
}
|
|
2702
|
-
this.
|
|
2712
|
+
this._formStructure.changeState(initialState || this._formStructure.defaultState);
|
|
2703
2713
|
const inputFieldNames = Object.keys(this.inputDataFields);
|
|
2704
2714
|
for (let index = 0; index < inputFieldNames.length; index++) {
|
|
2705
2715
|
const fieldCode = inputFieldNames[index];
|
|
@@ -2708,7 +2718,7 @@ class BasicFormComponent {
|
|
|
2708
2718
|
}
|
|
2709
2719
|
const recordResponse = yield this.requestFormAction(formActions.getData);
|
|
2710
2720
|
this.checkErrorRecordReceived(recordResponse);
|
|
2711
|
-
this.
|
|
2721
|
+
this.visible = true;
|
|
2712
2722
|
this.subscribeSectionActivation();
|
|
2713
2723
|
this.subscribeFieldsSubjects();
|
|
2714
2724
|
this.subscribeActionSubjects();
|
|
@@ -2724,23 +2734,25 @@ class BasicFormComponent {
|
|
|
2724
2734
|
this.errorCode = recordResponse.errorCode;
|
|
2725
2735
|
this.errorMessage = recordResponse.errorMessage;
|
|
2726
2736
|
this.errorDetail = recordResponse.errorDetail;
|
|
2737
|
+
return true;
|
|
2727
2738
|
}
|
|
2728
2739
|
errorOccured() {
|
|
2729
2740
|
return (this.errorCode !== NO_ERROR);
|
|
2730
2741
|
}
|
|
2731
|
-
|
|
2732
|
-
|
|
2742
|
+
/**
|
|
2743
|
+
* Soporte manejo de eventos de formulario
|
|
2744
|
+
*/
|
|
2733
2745
|
requestFormAction(actionCode, actionSubject = {}) {
|
|
2734
2746
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2735
2747
|
const actionDetail = {
|
|
2736
2748
|
formCode: this.name,
|
|
2737
2749
|
formSubject: this.formSubject,
|
|
2738
|
-
currentMode: this.
|
|
2750
|
+
currentMode: this._formStructure.state,
|
|
2739
2751
|
actionCode,
|
|
2740
2752
|
actionSubject,
|
|
2741
2753
|
version: PAYLOAD_VERSION,
|
|
2742
|
-
formData: this.
|
|
2743
|
-
immutableData: this.
|
|
2754
|
+
formData: this._formStructure.getPayload(),
|
|
2755
|
+
immutableData: this._formStructure.immutableData,
|
|
2744
2756
|
};
|
|
2745
2757
|
this.errorCode = NO_ERROR;
|
|
2746
2758
|
this.errorMessage = '';
|
|
@@ -2770,7 +2782,7 @@ class BasicFormComponent {
|
|
|
2770
2782
|
}
|
|
2771
2783
|
if (actions && actions.length > 0) {
|
|
2772
2784
|
for (const changedAction of actions) {
|
|
2773
|
-
const actionObject = this.
|
|
2785
|
+
const actionObject = this.getAction(changedAction.actionCode);
|
|
2774
2786
|
if (actionObject) {
|
|
2775
2787
|
actionObject.updateFromServer(changedAction);
|
|
2776
2788
|
}
|
|
@@ -2778,7 +2790,7 @@ class BasicFormComponent {
|
|
|
2778
2790
|
}
|
|
2779
2791
|
if (fields && fields.length > 0) {
|
|
2780
2792
|
for (const changedField of fields) {
|
|
2781
|
-
const fieldObject = this.
|
|
2793
|
+
const fieldObject = this.getField(changedField.fieldCode);
|
|
2782
2794
|
if (fieldObject) {
|
|
2783
2795
|
fieldObject.updateFromServer(changedField);
|
|
2784
2796
|
}
|
|
@@ -2786,7 +2798,7 @@ class BasicFormComponent {
|
|
|
2786
2798
|
}
|
|
2787
2799
|
if (recordTables && recordTables.length > 0) {
|
|
2788
2800
|
for (const changedTable of recordTables) {
|
|
2789
|
-
const tableObject = this.
|
|
2801
|
+
const tableObject = this.getTable(changedTable.tableCode);
|
|
2790
2802
|
if (tableObject) {
|
|
2791
2803
|
tableObject.updateFromServer(changedTable);
|
|
2792
2804
|
}
|
|
@@ -2795,55 +2807,55 @@ class BasicFormComponent {
|
|
|
2795
2807
|
if (returnedFile && returnedFile.file) {
|
|
2796
2808
|
this.fileMgmtServices.saveFile(returnedFile.file, returnedFile.name, returnedFile.type);
|
|
2797
2809
|
}
|
|
2798
|
-
this.
|
|
2799
|
-
this.
|
|
2810
|
+
this._formStructure.immutableData = immutableData;
|
|
2811
|
+
this._formStructure.extraInfo = extraInfo;
|
|
2800
2812
|
}
|
|
2801
2813
|
/**
|
|
2802
2814
|
* Manejo de event handlers para acciones sobre el formulario
|
|
2803
2815
|
*/
|
|
2804
|
-
addSectionActivation(
|
|
2805
|
-
const sectionSet = (Array.isArray(
|
|
2816
|
+
addSectionActivation(codes, callbackMethod) {
|
|
2817
|
+
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2806
2818
|
sectionSet.forEach((sectionName) => {
|
|
2807
|
-
if (!this.
|
|
2808
|
-
this.
|
|
2819
|
+
if (!this._formSectionsActivate[sectionName]) {
|
|
2820
|
+
this._formSectionsActivate[sectionName] = [];
|
|
2809
2821
|
}
|
|
2810
|
-
this.
|
|
2822
|
+
this._formSectionsActivate[sectionName].push(callbackMethod);
|
|
2811
2823
|
});
|
|
2812
2824
|
}
|
|
2813
|
-
addSectionInactivation(
|
|
2814
|
-
const sectionSet = (Array.isArray(
|
|
2825
|
+
addSectionInactivation(codes, callbackMethod) {
|
|
2826
|
+
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2815
2827
|
sectionSet.forEach((sectionName) => {
|
|
2816
|
-
if (!this.
|
|
2817
|
-
this.
|
|
2828
|
+
if (!this._formSectionsInactivate[sectionName]) {
|
|
2829
|
+
this._formSectionsInactivate[sectionName] = [];
|
|
2818
2830
|
}
|
|
2819
|
-
this.
|
|
2831
|
+
this._formSectionsInactivate[sectionName].push(callbackMethod);
|
|
2820
2832
|
});
|
|
2821
2833
|
}
|
|
2822
|
-
addActionMethodStart(
|
|
2823
|
-
const actionSet = (Array.isArray(
|
|
2834
|
+
addActionMethodStart(codes, callbackMethod) {
|
|
2835
|
+
const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2824
2836
|
actionSet.forEach((actionName) => {
|
|
2825
|
-
if (!this.
|
|
2826
|
-
this.
|
|
2837
|
+
if (!this._formActionsStart[actionName]) {
|
|
2838
|
+
this._formActionsStart[actionName] = [];
|
|
2827
2839
|
}
|
|
2828
|
-
this.
|
|
2840
|
+
this._formActionsStart[actionName].push(callbackMethod);
|
|
2829
2841
|
});
|
|
2830
2842
|
}
|
|
2831
|
-
addActionMethodFinish(
|
|
2832
|
-
const actionSet = (Array.isArray(
|
|
2843
|
+
addActionMethodFinish(codes, callbackMethod) {
|
|
2844
|
+
const actionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2833
2845
|
actionSet.forEach((actionName) => {
|
|
2834
|
-
if (!this.
|
|
2835
|
-
this.
|
|
2846
|
+
if (!this._formActionsFinish[actionName]) {
|
|
2847
|
+
this._formActionsFinish[actionName] = [];
|
|
2836
2848
|
}
|
|
2837
|
-
this.
|
|
2849
|
+
this._formActionsFinish[actionName].push(callbackMethod);
|
|
2838
2850
|
});
|
|
2839
2851
|
}
|
|
2840
|
-
launchSectionActivation(
|
|
2852
|
+
launchSectionActivation(code) {
|
|
2841
2853
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2842
|
-
const sectionObject = this.
|
|
2854
|
+
const sectionObject = this._formStructure.getSection(code);
|
|
2843
2855
|
if (!sectionObject) {
|
|
2844
2856
|
return;
|
|
2845
2857
|
}
|
|
2846
|
-
const clientSectionMethods = this.
|
|
2858
|
+
const clientSectionMethods = this._formSectionsActivate[code];
|
|
2847
2859
|
if (clientSectionMethods) {
|
|
2848
2860
|
for (const clientSectionMethod of clientSectionMethods) {
|
|
2849
2861
|
clientSectionMethod(sectionObject);
|
|
@@ -2851,13 +2863,13 @@ class BasicFormComponent {
|
|
|
2851
2863
|
}
|
|
2852
2864
|
});
|
|
2853
2865
|
}
|
|
2854
|
-
launchSectionInactivation(
|
|
2866
|
+
launchSectionInactivation(code) {
|
|
2855
2867
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2856
|
-
const sectionObject = this.
|
|
2868
|
+
const sectionObject = this._formStructure.getSection(code);
|
|
2857
2869
|
if (!sectionObject) {
|
|
2858
2870
|
return;
|
|
2859
2871
|
}
|
|
2860
|
-
const clientSectionMethods = this.
|
|
2872
|
+
const clientSectionMethods = this._formSectionsInactivate[code];
|
|
2861
2873
|
if (clientSectionMethods) {
|
|
2862
2874
|
for (const clientSectionMethod of clientSectionMethods) {
|
|
2863
2875
|
clientSectionMethod(sectionObject);
|
|
@@ -2865,15 +2877,15 @@ class BasicFormComponent {
|
|
|
2865
2877
|
}
|
|
2866
2878
|
});
|
|
2867
2879
|
}
|
|
2868
|
-
startAction(
|
|
2880
|
+
startAction(code) {
|
|
2869
2881
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2870
|
-
const actionObject = this.getAction(
|
|
2882
|
+
const actionObject = this.getAction(code);
|
|
2871
2883
|
if (!actionObject) {
|
|
2872
2884
|
return;
|
|
2873
2885
|
}
|
|
2874
2886
|
this.resetError();
|
|
2875
2887
|
actionObject.start();
|
|
2876
|
-
const clientActionMethods = this.
|
|
2888
|
+
const clientActionMethods = this._formActionsStart[code];
|
|
2877
2889
|
if (clientActionMethods) {
|
|
2878
2890
|
const clientActionPromises = [];
|
|
2879
2891
|
for (const clientActionMethod of clientActionMethods) {
|
|
@@ -2910,59 +2922,59 @@ class BasicFormComponent {
|
|
|
2910
2922
|
action.stop();
|
|
2911
2923
|
});
|
|
2912
2924
|
}
|
|
2913
|
-
finishAction(
|
|
2925
|
+
finishAction(action, actionResult) {
|
|
2914
2926
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2915
|
-
const finishActionMethods = this.
|
|
2927
|
+
const finishActionMethods = this._formActionsFinish[action.actionCode];
|
|
2916
2928
|
if (finishActionMethods) {
|
|
2917
2929
|
const clientActionPromises = [];
|
|
2918
2930
|
for (const clientActionMethod of finishActionMethods) {
|
|
2919
|
-
clientActionPromises.push(clientActionMethod(
|
|
2931
|
+
clientActionPromises.push(clientActionMethod(action, actionResult));
|
|
2920
2932
|
}
|
|
2921
2933
|
yield Promise.all(clientActionPromises);
|
|
2922
2934
|
}
|
|
2923
2935
|
});
|
|
2924
2936
|
}
|
|
2925
|
-
completeGlobalAction(
|
|
2926
|
-
return this.startServerAction(
|
|
2937
|
+
completeGlobalAction(action) {
|
|
2938
|
+
return this.startServerAction(action);
|
|
2927
2939
|
}
|
|
2928
2940
|
/**
|
|
2929
2941
|
* Manejadores de eventos para validaciones sobre campos
|
|
2930
2942
|
*/
|
|
2931
|
-
addFieldInputValidation(
|
|
2932
|
-
const fieldSet = (Array.isArray(
|
|
2943
|
+
addFieldInputValidation(codes, callbackMethod) {
|
|
2944
|
+
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2933
2945
|
fieldSet.forEach((fieldCode) => {
|
|
2934
|
-
if (!this.
|
|
2935
|
-
this.
|
|
2946
|
+
if (!this._fieldInputValidation[fieldCode]) {
|
|
2947
|
+
this._fieldInputValidation[fieldCode] = [];
|
|
2936
2948
|
}
|
|
2937
|
-
this.
|
|
2949
|
+
this._fieldInputValidation[fieldCode].push(callbackMethod);
|
|
2938
2950
|
});
|
|
2939
2951
|
}
|
|
2940
|
-
addFieldValidationStart(
|
|
2941
|
-
const fieldSet = (Array.isArray(
|
|
2952
|
+
addFieldValidationStart(codes, callbackMethod) {
|
|
2953
|
+
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2942
2954
|
fieldSet.forEach((fieldCode) => {
|
|
2943
|
-
if (!this.
|
|
2944
|
-
this.
|
|
2955
|
+
if (!this._fieldValidationsStart[fieldCode]) {
|
|
2956
|
+
this._fieldValidationsStart[fieldCode] = [];
|
|
2945
2957
|
}
|
|
2946
|
-
this.
|
|
2958
|
+
this._fieldValidationsStart[fieldCode].push(callbackMethod);
|
|
2947
2959
|
});
|
|
2948
2960
|
}
|
|
2949
|
-
addFieldValidationFinish(
|
|
2950
|
-
const fieldSet = (Array.isArray(
|
|
2961
|
+
addFieldValidationFinish(codes, callbackMethod) {
|
|
2962
|
+
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2951
2963
|
fieldSet.forEach((fieldCode) => {
|
|
2952
|
-
if (!this.
|
|
2953
|
-
this.
|
|
2964
|
+
if (!this._fieldValidationsFinish[fieldCode]) {
|
|
2965
|
+
this._fieldValidationsFinish[fieldCode] = [];
|
|
2954
2966
|
}
|
|
2955
|
-
this.
|
|
2967
|
+
this._fieldValidationsFinish[fieldCode].push(callbackMethod);
|
|
2956
2968
|
});
|
|
2957
2969
|
}
|
|
2958
2970
|
startFieldInputValidation(fieldCode, intrinsicValidation = true) {
|
|
2959
2971
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2960
|
-
const fieldToValidate = this.
|
|
2972
|
+
const fieldToValidate = this.getField(fieldCode);
|
|
2961
2973
|
if (!fieldToValidate) {
|
|
2962
2974
|
return false;
|
|
2963
2975
|
}
|
|
2964
2976
|
fieldToValidate.resetError();
|
|
2965
|
-
const validationCallbacks = this.
|
|
2977
|
+
const validationCallbacks = this._fieldInputValidation[fieldCode];
|
|
2966
2978
|
if (validationCallbacks) {
|
|
2967
2979
|
const clientValidationPromises = [];
|
|
2968
2980
|
for (const validationMethod of validationCallbacks) {
|
|
@@ -2980,7 +2992,7 @@ class BasicFormComponent {
|
|
|
2980
2992
|
return;
|
|
2981
2993
|
}
|
|
2982
2994
|
fieldToValidate.resetError();
|
|
2983
|
-
const validationCallbacks = this.
|
|
2995
|
+
const validationCallbacks = this._fieldValidationsStart[fieldCode];
|
|
2984
2996
|
if (validationCallbacks) {
|
|
2985
2997
|
const clientValidationPromises = [];
|
|
2986
2998
|
for (const validationMethod of validationCallbacks) {
|
|
@@ -3021,7 +3033,7 @@ class BasicFormComponent {
|
|
|
3021
3033
|
}
|
|
3022
3034
|
finishFieldValidation(fieldObject, validationResult) {
|
|
3023
3035
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3024
|
-
const validationCallbacks = this.
|
|
3036
|
+
const validationCallbacks = this._fieldValidationsFinish[fieldObject.fieldCode];
|
|
3025
3037
|
if (validationCallbacks) {
|
|
3026
3038
|
const clientActionPromises = [];
|
|
3027
3039
|
for (const validationMethod of validationCallbacks) {
|
|
@@ -3039,107 +3051,107 @@ class BasicFormComponent {
|
|
|
3039
3051
|
/**
|
|
3040
3052
|
* Manejadores de eventos para acciones sobre Tablas
|
|
3041
3053
|
*/
|
|
3042
|
-
addTableActionStart(
|
|
3043
|
-
const tableObject = this.getTable(
|
|
3054
|
+
addTableActionStart(code, actionCode, callbackMethod) {
|
|
3055
|
+
const tableObject = this.getTable(code);
|
|
3044
3056
|
if (!tableObject) {
|
|
3045
3057
|
return;
|
|
3046
3058
|
}
|
|
3047
|
-
const inlineActionObject = tableObject.
|
|
3059
|
+
const inlineActionObject = tableObject.getAction(actionCode);
|
|
3048
3060
|
if (!inlineActionObject) {
|
|
3049
3061
|
return;
|
|
3050
3062
|
}
|
|
3051
3063
|
let tableEventHandlers = null;
|
|
3052
|
-
if (this.
|
|
3053
|
-
tableEventHandlers = this.
|
|
3064
|
+
if (this._tableActionsStart[code]) {
|
|
3065
|
+
tableEventHandlers = this._tableActionsStart[code];
|
|
3054
3066
|
}
|
|
3055
3067
|
else {
|
|
3056
3068
|
tableEventHandlers = {};
|
|
3057
|
-
this.
|
|
3069
|
+
this._tableActionsStart[code] = tableEventHandlers;
|
|
3058
3070
|
}
|
|
3059
3071
|
if (!tableEventHandlers[actionCode]) {
|
|
3060
3072
|
tableEventHandlers[actionCode] = [];
|
|
3061
3073
|
}
|
|
3062
3074
|
tableEventHandlers[actionCode].push(callbackMethod);
|
|
3063
3075
|
}
|
|
3064
|
-
addTableActionFinish(
|
|
3065
|
-
const tableObject = this.getTable(
|
|
3076
|
+
addTableActionFinish(code, actionCode, callbackMethod) {
|
|
3077
|
+
const tableObject = this.getTable(code);
|
|
3066
3078
|
if (!tableObject) {
|
|
3067
3079
|
return;
|
|
3068
3080
|
}
|
|
3069
|
-
const inlineActionObject = tableObject.
|
|
3081
|
+
const inlineActionObject = tableObject.getAction(actionCode);
|
|
3070
3082
|
if (!inlineActionObject) {
|
|
3071
3083
|
return;
|
|
3072
3084
|
}
|
|
3073
3085
|
let tableEventHandlers = null;
|
|
3074
|
-
if (this.
|
|
3075
|
-
tableEventHandlers = this.
|
|
3086
|
+
if (this._tableActionsFinish[code]) {
|
|
3087
|
+
tableEventHandlers = this._tableActionsFinish[code];
|
|
3076
3088
|
}
|
|
3077
3089
|
else {
|
|
3078
3090
|
tableEventHandlers = {};
|
|
3079
|
-
this.
|
|
3091
|
+
this._tableActionsFinish[code] = tableEventHandlers;
|
|
3080
3092
|
}
|
|
3081
3093
|
if (!tableEventHandlers[actionCode]) {
|
|
3082
3094
|
tableEventHandlers[actionCode] = [];
|
|
3083
3095
|
}
|
|
3084
3096
|
tableEventHandlers[actionCode].push(callbackMethod);
|
|
3085
3097
|
}
|
|
3086
|
-
addTableSelectionStart(
|
|
3087
|
-
const tableObject = this.getTable(
|
|
3098
|
+
addTableSelectionStart(code, callbackMethod) {
|
|
3099
|
+
const tableObject = this.getTable(code);
|
|
3088
3100
|
if (!tableObject) {
|
|
3089
3101
|
return;
|
|
3090
3102
|
}
|
|
3091
3103
|
let tableEventHandlers = null;
|
|
3092
|
-
if (this.
|
|
3093
|
-
tableEventHandlers = this.
|
|
3104
|
+
if (this._tableSelectionsStart[code]) {
|
|
3105
|
+
tableEventHandlers = this._tableSelectionsStart[code];
|
|
3094
3106
|
}
|
|
3095
3107
|
else {
|
|
3096
3108
|
tableEventHandlers = [];
|
|
3097
|
-
this.
|
|
3109
|
+
this._tableSelectionsStart[code] = tableEventHandlers;
|
|
3098
3110
|
}
|
|
3099
3111
|
tableEventHandlers.push(callbackMethod);
|
|
3100
3112
|
}
|
|
3101
|
-
addTableSelectionFinish(
|
|
3102
|
-
const tableObject = this.getTable(
|
|
3113
|
+
addTableSelectionFinish(code, callbackMethod) {
|
|
3114
|
+
const tableObject = this.getTable(code);
|
|
3103
3115
|
if (!tableObject) {
|
|
3104
3116
|
return;
|
|
3105
3117
|
}
|
|
3106
3118
|
let tableEventHandlers = null;
|
|
3107
|
-
if (this.
|
|
3108
|
-
tableEventHandlers = this.
|
|
3119
|
+
if (this._tableSelectionsFinish[code]) {
|
|
3120
|
+
tableEventHandlers = this._tableSelectionsFinish[code];
|
|
3109
3121
|
}
|
|
3110
3122
|
else {
|
|
3111
3123
|
tableEventHandlers = [];
|
|
3112
|
-
this.
|
|
3124
|
+
this._tableSelectionsFinish[code] = tableEventHandlers;
|
|
3113
3125
|
}
|
|
3114
3126
|
tableEventHandlers.push(callbackMethod);
|
|
3115
3127
|
}
|
|
3116
|
-
addTableGetDataStart(
|
|
3117
|
-
const tableObject = this.getTable(
|
|
3128
|
+
addTableGetDataStart(code, callbackMethod) {
|
|
3129
|
+
const tableObject = this.getTable(code);
|
|
3118
3130
|
if (!tableObject) {
|
|
3119
3131
|
return;
|
|
3120
3132
|
}
|
|
3121
3133
|
let tableEventHandlers = null;
|
|
3122
|
-
if (this.
|
|
3123
|
-
tableEventHandlers = this.
|
|
3134
|
+
if (this._tableGetDataStart[code]) {
|
|
3135
|
+
tableEventHandlers = this._tableGetDataStart[code];
|
|
3124
3136
|
}
|
|
3125
3137
|
else {
|
|
3126
3138
|
tableEventHandlers = [];
|
|
3127
|
-
this.
|
|
3139
|
+
this._tableGetDataStart[code] = tableEventHandlers;
|
|
3128
3140
|
}
|
|
3129
3141
|
tableEventHandlers.push(callbackMethod);
|
|
3130
3142
|
}
|
|
3131
|
-
addTableGetDataFinish(
|
|
3132
|
-
const tableObject = this.getTable(
|
|
3143
|
+
addTableGetDataFinish(code, callbackMethod) {
|
|
3144
|
+
const tableObject = this.getTable(code);
|
|
3133
3145
|
if (!tableObject) {
|
|
3134
3146
|
return;
|
|
3135
3147
|
}
|
|
3136
3148
|
let tableEventHandlers = null;
|
|
3137
|
-
if (this.
|
|
3138
|
-
tableEventHandlers = this.
|
|
3149
|
+
if (this._tableGetDataFinish[code]) {
|
|
3150
|
+
tableEventHandlers = this._tableGetDataFinish[code];
|
|
3139
3151
|
}
|
|
3140
3152
|
else {
|
|
3141
3153
|
tableEventHandlers = {};
|
|
3142
|
-
this.
|
|
3154
|
+
this._tableGetDataFinish[code] = tableEventHandlers;
|
|
3143
3155
|
}
|
|
3144
3156
|
tableEventHandlers[GET_DATA_ACTION] = callbackMethod;
|
|
3145
3157
|
}
|
|
@@ -3161,7 +3173,7 @@ class BasicFormComponent {
|
|
|
3161
3173
|
tableCode,
|
|
3162
3174
|
actionCode,
|
|
3163
3175
|
};
|
|
3164
|
-
const tableEventHandlers = this.
|
|
3176
|
+
const tableEventHandlers = this._tableActionsStart[tableCode];
|
|
3165
3177
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3166
3178
|
if (tableActionMethods) {
|
|
3167
3179
|
const clientActionPromises = [];
|
|
@@ -3210,7 +3222,7 @@ class BasicFormComponent {
|
|
|
3210
3222
|
finishTableGlobalAction(tableActionDetail, actionResult) {
|
|
3211
3223
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3212
3224
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3213
|
-
const tableEventHandlers = this.
|
|
3225
|
+
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3214
3226
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3215
3227
|
if (tableActionMethods) {
|
|
3216
3228
|
const clientActionPromises = [];
|
|
@@ -3242,7 +3254,7 @@ class BasicFormComponent {
|
|
|
3242
3254
|
recordId,
|
|
3243
3255
|
recordData
|
|
3244
3256
|
};
|
|
3245
|
-
const tableEventHandlers = this.
|
|
3257
|
+
const tableEventHandlers = this._tableActionsStart[tableCode];
|
|
3246
3258
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3247
3259
|
if (tableActionMethods) {
|
|
3248
3260
|
const clientActionPromises = [];
|
|
@@ -3296,7 +3308,7 @@ class BasicFormComponent {
|
|
|
3296
3308
|
finishTableAction(tableActionDetail, actionResult) {
|
|
3297
3309
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3298
3310
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3299
|
-
const tableEventHandlers = this.
|
|
3311
|
+
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3300
3312
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3301
3313
|
if (tableActionMethods) {
|
|
3302
3314
|
const clientActionPromises = [];
|
|
@@ -3322,7 +3334,7 @@ class BasicFormComponent {
|
|
|
3322
3334
|
recordId,
|
|
3323
3335
|
recordData
|
|
3324
3336
|
};
|
|
3325
|
-
const tableEventHandlers = this.
|
|
3337
|
+
const tableEventHandlers = this._tableSelectionsStart[tableCode];
|
|
3326
3338
|
if (tableEventHandlers) {
|
|
3327
3339
|
const clientActionPromises = [];
|
|
3328
3340
|
for (const tableSelectionMethod of tableEventHandlers) {
|
|
@@ -3371,7 +3383,7 @@ class BasicFormComponent {
|
|
|
3371
3383
|
finishTableRecordSelection(tableSelectionDetail, actionResult) {
|
|
3372
3384
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3373
3385
|
const { tableCode } = tableSelectionDetail;
|
|
3374
|
-
const tableEventHandlers = this.
|
|
3386
|
+
const tableEventHandlers = this._tableSelectionsFinish[tableCode];
|
|
3375
3387
|
if (tableEventHandlers) {
|
|
3376
3388
|
const clientActionPromises = [];
|
|
3377
3389
|
for (const tableSelectionMethod of tableEventHandlers) {
|
|
@@ -3401,7 +3413,7 @@ class BasicFormComponent {
|
|
|
3401
3413
|
actionCode,
|
|
3402
3414
|
selectedRecords
|
|
3403
3415
|
};
|
|
3404
|
-
const tableEventHandlers = this.
|
|
3416
|
+
const tableEventHandlers = this._tableActionsStart[tableCode];
|
|
3405
3417
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3406
3418
|
if (tableActionMethods) {
|
|
3407
3419
|
const clientActionPromises = [];
|
|
@@ -3451,7 +3463,7 @@ class BasicFormComponent {
|
|
|
3451
3463
|
finishTableSelectionAction(tableActionDetail, actionResult) {
|
|
3452
3464
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3453
3465
|
const { tableCode, actionCode } = tableActionDetail;
|
|
3454
|
-
const tableEventHandlers = this.
|
|
3466
|
+
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3455
3467
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[actionCode] : null;
|
|
3456
3468
|
if (tableActionMethods) {
|
|
3457
3469
|
const clientActionPromises = [];
|
|
@@ -3471,7 +3483,7 @@ class BasicFormComponent {
|
|
|
3471
3483
|
tableCode
|
|
3472
3484
|
};
|
|
3473
3485
|
this.resetError();
|
|
3474
|
-
const tableEventHandlers = this.
|
|
3486
|
+
const tableEventHandlers = this._tableGetDataStart[tableCode];
|
|
3475
3487
|
if (tableEventHandlers) {
|
|
3476
3488
|
const clientActionPromises = [];
|
|
3477
3489
|
for (const tableActionMethod of tableEventHandlers) {
|
|
@@ -3506,7 +3518,7 @@ class BasicFormComponent {
|
|
|
3506
3518
|
finishTableGetData(tableActionDetail, actionResult) {
|
|
3507
3519
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3508
3520
|
const { tableCode, tableActionCode } = tableActionDetail;
|
|
3509
|
-
const tableEventHandlers = this.
|
|
3521
|
+
const tableEventHandlers = this._tableActionsFinish[tableCode];
|
|
3510
3522
|
const tableActionMethods = (tableEventHandlers) ? tableEventHandlers[tableActionCode] : null;
|
|
3511
3523
|
if (tableActionMethods) {
|
|
3512
3524
|
const clientActionPromises = [];
|
|
@@ -3572,108 +3584,6 @@ class BasicFormComponent {
|
|
|
3572
3584
|
}
|
|
3573
3585
|
return true;
|
|
3574
3586
|
}
|
|
3575
|
-
/**
|
|
3576
|
-
* Soporte registros en tablas que se editan en campos del formulario
|
|
3577
|
-
*/
|
|
3578
|
-
defineEditionTable(tableEditionDef) {
|
|
3579
|
-
const { columnFieldMapping, recordCaptureFields, startCollapsed } = tableEditionDef;
|
|
3580
|
-
tableEditionDef.startCollapsed = (typeof startCollapsed !== 'undefined')
|
|
3581
|
-
? startCollapsed : true;
|
|
3582
|
-
const fieldsMappingTable = {};
|
|
3583
|
-
const fieldsToClear = [];
|
|
3584
|
-
for (const columnMap of columnFieldMapping) {
|
|
3585
|
-
const [columnName, formField] = columnMap;
|
|
3586
|
-
fieldsMappingTable[columnName] = formField;
|
|
3587
|
-
fieldsToClear.push(formField);
|
|
3588
|
-
}
|
|
3589
|
-
tableEditionDef.fieldsMappingTable = fieldsMappingTable;
|
|
3590
|
-
tableEditionDef.fieldsToClear = fieldsToClear;
|
|
3591
|
-
const { tableName, newRecordActionName, saveRecordActionName, cancelSaveRecordActionName, tableEditRecordActionName, enableRecordEdition } = tableEditionDef;
|
|
3592
|
-
this.addActionMethodStart(newRecordActionName, () => {
|
|
3593
|
-
this.cleanFields(fieldsToClear, null);
|
|
3594
|
-
this.showFields(recordCaptureFields);
|
|
3595
|
-
if (!enableRecordEdition) {
|
|
3596
|
-
this.enableRecordEdition(tableEditionDef);
|
|
3597
|
-
}
|
|
3598
|
-
else {
|
|
3599
|
-
enableRecordEdition(tableEditionDef);
|
|
3600
|
-
}
|
|
3601
|
-
this.hideAction(newRecordActionName);
|
|
3602
|
-
this.showAction(cancelSaveRecordActionName);
|
|
3603
|
-
this.showAction(saveRecordActionName);
|
|
3604
|
-
return true;
|
|
3605
|
-
});
|
|
3606
|
-
const { recordEditionValidate, disableRecordEdition } = tableEditionDef;
|
|
3607
|
-
this.addActionMethodStart(saveRecordActionName, () => {
|
|
3608
|
-
return (!recordEditionValidate) ? this.recordEditionValidate(tableEditionDef)
|
|
3609
|
-
: recordEditionValidate(tableEditionDef);
|
|
3610
|
-
});
|
|
3611
|
-
this.addActionMethodFinish(saveRecordActionName, () => {
|
|
3612
|
-
if (!this.errorOccured()) {
|
|
3613
|
-
return (!disableRecordEdition) ? this.disableRecordEdition(tableEditionDef)
|
|
3614
|
-
: disableRecordEdition(tableEditionDef);
|
|
3615
|
-
}
|
|
3616
|
-
});
|
|
3617
|
-
this.addActionMethodStart(cancelSaveRecordActionName, () => {
|
|
3618
|
-
return (!disableRecordEdition) ? this.disableRecordEdition(tableEditionDef)
|
|
3619
|
-
: disableRecordEdition(tableEditionDef);
|
|
3620
|
-
});
|
|
3621
|
-
this.addTableActionStart(tableName, tableEditRecordActionName, (tblActObj) => {
|
|
3622
|
-
return (!enableRecordEdition)
|
|
3623
|
-
? this.enableRecordEdition(tableEditionDef, tblActObj)
|
|
3624
|
-
: enableRecordEdition(tableEditionDef, tblActObj);
|
|
3625
|
-
});
|
|
3626
|
-
if (tableEditionDef.startCollapsed) {
|
|
3627
|
-
return (!tableEditionDef.disableRecordEdition)
|
|
3628
|
-
? this.disableRecordEdition(tableEditionDef)
|
|
3629
|
-
: tableEditionDef.disableRecordEdition(tableEditionDef);
|
|
3630
|
-
}
|
|
3631
|
-
else {
|
|
3632
|
-
return (!tableEditionDef.enableRecordEdition)
|
|
3633
|
-
? this.enableRecordEdition(tableEditionDef)
|
|
3634
|
-
: tableEditionDef.enableRecordEdition(tableEditionDef, null);
|
|
3635
|
-
}
|
|
3636
|
-
}
|
|
3637
|
-
enableRecordEdition(tableEditionDef, tableActionObject = null) {
|
|
3638
|
-
if (tableActionObject) {
|
|
3639
|
-
this.copyTableRecordToFields(tableActionObject, tableEditionDef.fieldsMappingTable);
|
|
3640
|
-
}
|
|
3641
|
-
this.showFields(tableEditionDef.recordCaptureFields);
|
|
3642
|
-
this.hideAction(tableEditionDef.newRecordActionName);
|
|
3643
|
-
this.showAction(tableEditionDef.cancelSaveRecordActionName);
|
|
3644
|
-
this.showAction(tableEditionDef.saveRecordActionName);
|
|
3645
|
-
if (tableEditionDef.fieldsToTriggerValidation
|
|
3646
|
-
&& tableEditionDef.fieldsToTriggerValidation.length > 0) {
|
|
3647
|
-
for (const fieldName of tableEditionDef.fieldsToTriggerValidation) {
|
|
3648
|
-
this.startFieldValidation(fieldName);
|
|
3649
|
-
}
|
|
3650
|
-
}
|
|
3651
|
-
return true;
|
|
3652
|
-
}
|
|
3653
|
-
disableRecordEdition(tableDefinition) {
|
|
3654
|
-
this.cleanFields(tableDefinition.fieldsToClear, null);
|
|
3655
|
-
this.hideFields(tableDefinition.recordCaptureFields);
|
|
3656
|
-
this.showAction(tableDefinition.newRecordActionName);
|
|
3657
|
-
this.hideAction(tableDefinition.cancelSaveRecordActionName);
|
|
3658
|
-
this.hideAction(tableDefinition.saveRecordActionName);
|
|
3659
|
-
return true;
|
|
3660
|
-
}
|
|
3661
|
-
recordEditionValidate(tableEditionDef) {
|
|
3662
|
-
const { recordCaptureFields } = tableEditionDef;
|
|
3663
|
-
let validationOk = true;
|
|
3664
|
-
const requiredEmptyFields = this.getRequiredEmptyFields(recordCaptureFields, null);
|
|
3665
|
-
if (requiredEmptyFields.length > 0) {
|
|
3666
|
-
validationOk = false;
|
|
3667
|
-
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
3668
|
-
this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
|
|
3669
|
-
}
|
|
3670
|
-
const validationIssueFields = this.getFieldsWithValidationIssues(recordCaptureFields, null);
|
|
3671
|
-
if (validationIssueFields.length > 0) {
|
|
3672
|
-
validationOk = false;
|
|
3673
|
-
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
3674
|
-
}
|
|
3675
|
-
return validationOk;
|
|
3676
|
-
}
|
|
3677
3587
|
}
|
|
3678
3588
|
BasicFormComponent.decorators = [
|
|
3679
3589
|
{ type: Component, args: [{
|