tuain-ng-forms-lib 12.0.23 → 12.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,11 @@ 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) { return name && (this.customAttributes[name] = value); }
301
+ matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
298
302
  isField() { return this.elementType === elementTypes.field; }
299
303
  isAction() { return this.elementType === elementTypes.action; }
300
304
  isTable() { return this.elementType === elementTypes.table; }
@@ -312,7 +316,13 @@ class FormElement {
312
316
  }
313
317
  viewOnState(state) { return (this.visibleStates && state) ? this.visibleStates.includes(state) : false; }
314
318
  enabledOnState(state) { return (this.enabledStates && state) ? this.enabledStates.includes(state) : false; }
319
+ /**
320
+ * @deprecated Utilizar viewOnState
321
+ */
315
322
  supportState(state) { return this.viewOnState(state); }
323
+ /**
324
+ * @deprecated Utilizar viewOnState
325
+ */
316
326
  supportMode(state) { return this.viewOnState(state); }
317
327
  get visible() { return (this._isForced) ? this._visibleForced : this._visible; }
318
328
  set visible(visible) { this.setVisibility(visible); }
@@ -389,62 +399,6 @@ class TableAction {
389
399
  enabledOnState(state) { return this.enabledStates.includes(state); }
390
400
  }
391
401
 
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
402
  class TableRecordData {
449
403
  constructor(recordReceived, recordDefinition, selectionFieldName = null) {
450
404
  this.recordData = {};
@@ -461,8 +415,7 @@ class TableRecordData {
461
415
  rawRecordData.forEach(fieldData => {
462
416
  const { fieldCode, fieldValue } = fieldData;
463
417
  const fieldDef = recordDefinition.find(column => column.fieldCode === fieldCode);
464
- const formattedFieldValue = this.formatFieldValue(fieldDef.fieldType, fieldValue);
465
- this.recordData[fieldCode] = formattedFieldValue;
418
+ this.recordData[fieldCode] = fieldValue !== null && fieldValue !== void 0 ? fieldValue : '';
466
419
  if (fieldCode === selectionFieldName) {
467
420
  this.selected = fieldValue;
468
421
  }
@@ -473,29 +426,13 @@ class TableRecordData {
473
426
  fields.forEach(fieldCode => {
474
427
  const fieldValue = recordData[fieldCode];
475
428
  const fieldDef = recordDefinition.find(column => column.fieldCode === fieldCode);
476
- const formattedFieldValue = this.formatFieldValue(fieldDef.fieldType, fieldValue);
477
- this.recordData[fieldCode] = formattedFieldValue;
429
+ this.recordData[fieldCode] = fieldValue !== null && fieldValue !== void 0 ? fieldValue : '';
478
430
  });
479
431
  }
480
432
  }
481
- formatFieldValue(fieldType, fieldValue) {
482
- if (fieldType === CURRENCY_TYPE) {
483
- return formatCurrency(fieldValue);
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
- }
433
+ toggleSelect() { this.selected = !this.selected; }
434
+ select() { this.selected = true; }
435
+ unselect() { this.selected = false; }
499
436
  get recordIdKey() {
500
437
  return (typeof this.recordId === 'object')
501
438
  ? JSON.stringify(this.recordId) : this.recordId;
@@ -576,7 +513,7 @@ const TABLE_FILTER_TYPES = {
576
513
  };
577
514
  class RecordTable extends FormElement {
578
515
  constructor(tableReceived, formConfig) {
579
- var _a, _b, _c, _d, _e, _f, _g;
516
+ var _a, _b, _c, _d, _e, _f;
580
517
  super(tableReceived, formConfig);
581
518
  this._inlineActionTrigger = new Subject();
582
519
  this._globalActionTrigger = new Subject();
@@ -609,8 +546,7 @@ class RecordTable extends FormElement {
609
546
  this._appendPages = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.append) !== null && _c !== void 0 ? _c : false;
610
547
  this.selectable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _d !== void 0 ? _d : false;
611
548
  this.setAttr('selectionBackend', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _e !== void 0 ? _e : false);
612
- this.customAttributes = (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.customAttributes) !== null && _f !== void 0 ? _f : {};
613
- this.setAttr('sortable', (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false);
549
+ this.setAttr('sortable', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _f !== void 0 ? _f : false);
614
550
  this.setAttr('sorting', { columnName: '', direction: '' });
615
551
  this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
616
552
  if (tableReceived.fields) {
@@ -1231,6 +1167,7 @@ class RecordFormSubSection {
1231
1167
 
1232
1168
  class RecordFormSection {
1233
1169
  constructor(sectionReceived, formObject) {
1170
+ var _a;
1234
1171
  this._activation = new Subject();
1235
1172
  this._inactivation = new Subject();
1236
1173
  this.active = false;
@@ -1269,7 +1206,12 @@ class RecordFormSection {
1269
1206
  }
1270
1207
  }
1271
1208
  }
1209
+ this.customAttributes = (_a = sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes) !== null && _a !== void 0 ? _a : null;
1272
1210
  }
1211
+ getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
1212
+ setCustomAttribute(name, value) { return name && (this.customAttributes[name] = value); }
1213
+ matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
1214
+ get code() { return this.sectionCode; }
1273
1215
  get activation() { return this._activation; }
1274
1216
  get inactivation() { return this._inactivation; }
1275
1217
  activate() {
@@ -1335,7 +1277,7 @@ class RecordFormSection {
1335
1277
  const HEADER = 'HEADER';
1336
1278
  class FormAction extends FormElement {
1337
1279
  constructor(actionDefinition, formConfig) {
1338
- var _a, _b;
1280
+ var _a;
1339
1281
  super(actionDefinition, formConfig);
1340
1282
  this._actionActivated = new Subject();
1341
1283
  this.inProgress = false;
@@ -1343,10 +1285,9 @@ class FormAction extends FormElement {
1343
1285
  this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
1344
1286
  this.actionName = actionDefinition.actionTitle;
1345
1287
  this.iconName = actionDefinition.iconName || this.actionCode;
1346
- this.location = actionDefinition.position || HEADER;
1288
+ this.setCustomAttribute('location', actionDefinition.position || HEADER);
1347
1289
  this.backend = (_a = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _a !== void 0 ? _a : false;
1348
1290
  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
1291
  this.restrictedOnField = actionDefinition.fieldRestrictedCode ? actionDefinition.fieldRestrictedCode.toString() : '';
1351
1292
  this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
1352
1293
  this.restrictedOnValue = actionDefinition.valueRestricted || '';
@@ -1384,7 +1325,6 @@ const fldAttr = {
1384
1325
  info: 'fieldInfo',
1385
1326
  defaultValue: 'defaultValue',
1386
1327
  defaultEditable: 'defaultEditable',
1387
- customAttributes: 'customAttributes',
1388
1328
  visibleLabel: 'visibleLabel',
1389
1329
  required: 'fieldRequired',
1390
1330
  hasChanged: 'hasChanged',
@@ -1403,7 +1343,7 @@ const fldAttr = {
1403
1343
  };
1404
1344
  class FieldDescriptor extends FormElement {
1405
1345
  constructor(inputFieldReceived, formConfig) {
1406
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1346
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1407
1347
  super(inputFieldReceived, formConfig);
1408
1348
  this._editionFinish = new Subject();
1409
1349
  this._editionPartial = new Subject();
@@ -1429,18 +1369,17 @@ class FieldDescriptor extends FormElement {
1429
1369
  }
1430
1370
  this.setAttr(fldAttr.format, fieldFormat);
1431
1371
  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
1372
  this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
1434
1373
  this.setAttr(fldAttr.defaultEditable, this.enabled);
1435
- this.setAttr(fldAttr.required, (_f = fld.required) !== null && _f !== void 0 ? _f : false);
1436
- this.setError(fld.errorCode, fld.errorMessage, (_g = fld.errorType) !== null && _g !== void 0 ? _g : DEFAULT_ERROR_TYPE);
1437
- this.setAttr(fldAttr.outputOnly, (_h = fld.outputOnly) !== null && _h !== void 0 ? _h : false);
1438
- const maxLength = (_j = fld.maxLength) !== null && _j !== void 0 ? _j : (this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
1374
+ this.setAttr(fldAttr.required, (_e = fld.required) !== null && _e !== void 0 ? _e : false);
1375
+ this.setError(fld.errorCode, fld.errorMessage, (_f = fld.errorType) !== null && _f !== void 0 ? _f : DEFAULT_ERROR_TYPE);
1376
+ this.setAttr(fldAttr.outputOnly, (_g = fld.outputOnly) !== null && _g !== void 0 ? _g : false);
1377
+ const maxLength = (_h = fld.maxLength) !== null && _h !== void 0 ? _h : (this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
1439
1378
  this.setAttr(fldAttr.maxLength, maxLength);
1440
- this.setAttr(fldAttr.intrinsicErrorMessage, (_k = this._formConfig.fieldTypeErrMsg[this.fieldType]) !== null && _k !== void 0 ? _k : this._formConfig.fieldTypeErrMsg.DEFAULT);
1379
+ this.setAttr(fldAttr.intrinsicErrorMessage, (_j = this._formConfig.fieldTypeErrMsg[this.fieldType]) !== null && _j !== void 0 ? _j : this._formConfig.fieldTypeErrMsg.DEFAULT);
1441
1380
  this.setFieldType(fld.fieldTypeCode);
1442
- this.setEditable((_l = fld.editable) !== null && _l !== void 0 ? _l : true);
1443
- this.setVisibleLabel((_m = fld.visibleLabel) !== null && _m !== void 0 ? _m : true);
1381
+ this.setEditable((_k = fld.editable) !== null && _k !== void 0 ? _k : true);
1382
+ this.setVisibleLabel((_l = fld.visibleLabel) !== null && _l !== void 0 ? _l : true);
1444
1383
  this.setVisibility(fld.visible);
1445
1384
  this.setFieldOptions(fld.fieldOptions);
1446
1385
  this.setValue(fld.fieldValue || this.defaultValue || '');
@@ -1495,7 +1434,6 @@ class FieldDescriptor extends FormElement {
1495
1434
  notifyEditionDetailRequest() {
1496
1435
  this._detailRequest.next(this.fieldCode);
1497
1436
  }
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
1437
  setVisibleLabel(visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); }
1500
1438
  showLabel() { this.setVisibleLabel(true); }
1501
1439
  hideLabel() { this.setVisibleLabel(false); }
@@ -1575,11 +1513,6 @@ class FieldDescriptor extends FormElement {
1575
1513
  setFieldType(inputFieldType) {
1576
1514
  this.setAttr(fldAttr.type, inputFieldType);
1577
1515
  }
1578
- format() {
1579
- if (this.fieldType === this._formConfig.fieldTypes.currency) {
1580
- this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
1581
- }
1582
- }
1583
1516
  setMinValue(minValue) {
1584
1517
  var _a, _b, _c;
1585
1518
  if (this.fieldType === this._formConfig.fieldTypes.date
@@ -1689,9 +1622,6 @@ class FieldDescriptor extends FormElement {
1689
1622
  (_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
1690
1623
  }
1691
1624
  break;
1692
- case this._formConfig.fieldTypes.currency:
1693
- newFinalValue = formatCurrency(newValue);
1694
- break;
1695
1625
  default:
1696
1626
  newFinalValue = newValue;
1697
1627
  break;
@@ -1704,20 +1634,27 @@ class FieldDescriptor extends FormElement {
1704
1634
  }
1705
1635
  }
1706
1636
 
1637
+ const ACTIVE = 'active';
1638
+ const SHOW = 'show';
1639
+ const HIDE = 'hide';
1640
+ const ENABLE = 'enable';
1641
+ const DISABLE = 'disable';
1642
+ const CLEAN = 'clean';
1707
1643
  class FormStructureAndData {
1708
1644
  constructor(definitionReceived, formConfig) {
1709
- this._fieldsObj = {};
1710
- this._actionsObj = {};
1711
- this._tableObj = {};
1712
- this._sectionsObj = {};
1645
+ this._fields = {};
1646
+ this._actions = {};
1647
+ this._tables = {};
1648
+ this._sections = {};
1713
1649
  this._immutableData = {};
1714
1650
  this._extraInfo = {};
1651
+ this._exclusiveSectionsByAttr = {};
1715
1652
  this._formConfig = formConfig;
1716
1653
  this.state = '';
1717
- this._actions = [];
1718
- this._fields = [];
1719
- this._tables = [];
1720
- this._sections = [];
1654
+ this._actionArray = [];
1655
+ this._fieldArray = [];
1656
+ this._tableArray = [];
1657
+ this._sectionArray = [];
1721
1658
  this._stateFlow = {
1722
1659
  defaultState: '',
1723
1660
  states: [],
@@ -1749,8 +1686,8 @@ class FormStructureAndData {
1749
1686
  const globalAction = new FormAction(actionReceived, this._formConfig);
1750
1687
  const globalActionCode = globalAction.actionCode;
1751
1688
  if (globalActionCode) {
1752
- this._actions.push(globalAction);
1753
- this._actionsObj[globalActionCode] = globalAction;
1689
+ this._actionArray.push(globalAction);
1690
+ this._actions[globalActionCode] = globalAction;
1754
1691
  }
1755
1692
  }
1756
1693
  }
@@ -1770,8 +1707,8 @@ class FormStructureAndData {
1770
1707
  const fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
1771
1708
  const fieldCode = fieldToAdd.fieldCode;
1772
1709
  if (fieldCode) {
1773
- this._fields.push(fieldToAdd);
1774
- this._fieldsObj[fieldCode] = fieldToAdd;
1710
+ this._fieldArray.push(fieldToAdd);
1711
+ this._fields[fieldCode] = fieldToAdd;
1775
1712
  }
1776
1713
  }
1777
1714
  }
@@ -1794,8 +1731,8 @@ class FormStructureAndData {
1794
1731
  const tableToAdd = new RecordTable(tableReceived, this._formConfig);
1795
1732
  const tableCode = tableToAdd.tableCode;
1796
1733
  if (tableCode) {
1797
- this._tables.push(tableToAdd);
1798
- this._tableObj[tableCode] = tableToAdd;
1734
+ this._tableArray.push(tableToAdd);
1735
+ this._tables[tableCode] = tableToAdd;
1799
1736
  }
1800
1737
  }
1801
1738
  }
@@ -1813,19 +1750,22 @@ class FormStructureAndData {
1813
1750
  const sectionToAdd = new RecordFormSection(sectionReceived, this);
1814
1751
  const sectionCode = sectionToAdd.sectionCode;
1815
1752
  if (sectionCode) {
1816
- this._sections.push(sectionToAdd);
1817
- this._sectionsObj[sectionCode] = sectionToAdd;
1753
+ this._sectionArray.push(sectionToAdd);
1754
+ this._sections[sectionCode] = sectionToAdd;
1818
1755
  }
1819
1756
  }
1820
1757
  }
1821
1758
  }
1822
- set immutableData(immutableData) { Object.assign(this._immutableData, immutableData); }
1823
- set extraInfo(extraInfo) { Object.assign(this._extraInfo, extraInfo); }
1824
- get defaultState() { return this._stateFlow.defaultState; }
1825
- get title() { return this._title; }
1826
- set title(title) { this._title = title; }
1759
+ getTitle() { return this._title; }
1760
+ setTitle(title) { this._title = title; }
1827
1761
  get name() { return this._name; }
1828
1762
  set name(name) { this._name = name; }
1763
+ // Estados
1764
+ get defaultState() { return this._stateFlow.defaultState; }
1765
+ supportState(state) { var _a; return (_a = this._stateFlow.states) === null || _a === void 0 ? void 0 : _a.includes(state); }
1766
+ supportMode(state) { return this.supportState(state); }
1767
+ get states() { return this._stateFlow.states; }
1768
+ getCurrentState() { return this.state; }
1829
1769
  changeState(newState) {
1830
1770
  if (!newState || !this.supportState(newState)) {
1831
1771
  return false;
@@ -1855,201 +1795,29 @@ class FormStructureAndData {
1855
1795
  return { name, source, destination };
1856
1796
  }).filter(item => item.name && item.source && item.destination);
1857
1797
  }
1858
- supportState(state) { var _a; return (_a = this._stateFlow.states) === null || _a === void 0 ? void 0 : _a.includes(state); }
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
- }
1798
+ // immutable Data
1869
1799
  getImmutableElement(name) { var _a, _b, _c; return (_c = (_b = (_a = this._immutableData) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null; }
1800
+ set immutableData(immutableData) { Object.assign(this._immutableData, immutableData); }
1801
+ get immutableData() { return JSON.parse(JSON.stringify(this._immutableData)); }
1802
+ // extra Info
1870
1803
  getExtraInfo(name) { var _a, _b, _c; return (_c = (_b = (_a = this._extraInfo) === null || _a === void 0 ? void 0 : _a[name]) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : null; }
1871
- get extraInfo() {
1872
- const data = {};
1873
- const objectNames = Object.keys(this._extraInfo);
1874
- for (let index = 0; index < objectNames.length; index++) {
1875
- const name = objectNames[index];
1876
- data[name] = this.getExtraInfo(name);
1877
- }
1878
- return data;
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
- }
1942
- }
1943
- if (this._tables) {
1944
- for (const formTable of this._tables) {
1945
- formTable.clean();
1946
- }
1947
- }
1948
- }
1949
- showSection(sectionCode) {
1950
- const sectionObject = this.getSectionObject(sectionCode);
1951
- return (sectionObject) ? sectionObject.show() : null;
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
- }
1997
- }
1998
- }
1999
- hideSubSections(sectionCode, subSectionArray) {
2000
- if (subSectionArray && subSectionArray.length > 0) {
2001
- const sectionObject = this.getSectionObject(sectionCode);
2002
- for (const subSectionCode of subSectionArray) {
2003
- const subSectionObject = (sectionObject) ? sectionObject.getSubsection(subSectionCode) : null;
2004
- if (subSectionObject) {
2005
- subSectionObject.hide();
2006
- }
2007
- }
2008
- }
2009
- }
2010
- showAction(actionCode) {
2011
- const actionObject = this.getActionObject(actionCode);
2012
- return (actionObject) ? actionObject.show() : null;
2013
- }
2014
- hideAction(actionCode) {
2015
- const actionObject = this.getActionObject(actionCode);
2016
- return (actionObject) ? actionObject.hide() : null;
2017
- }
2018
- showActions(actionArray) {
2019
- const actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
2020
- actionNames.forEach(actionCode => this.showAction(actionCode));
2021
- }
2022
- hideActions(actionArray) {
2023
- const actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
2024
- actionNames.forEach(actionCode => this.hideAction(actionCode));
2025
- }
2026
- enableAction(actionCode) {
2027
- const actionObject = this.getActionObject(actionCode);
2028
- return (actionObject) ? actionObject.enable() : null;
2029
- }
2030
- disableAction(actionCode) {
2031
- const actionObject = this.getActionObject(actionCode);
2032
- return (actionObject) ? actionObject.disable() : null;
2033
- }
2034
- enableActions(actionArray) {
2035
- const actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
2036
- actionNames.forEach(actionCode => this.enableAction(actionCode));
2037
- }
2038
- disableActions(actionArray) {
2039
- const actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
2040
- actionNames.forEach(actionCode => this.disableAction(actionCode));
2041
- }
2042
- get fields() { return this._fieldsObj; }
1804
+ set extraInfo(extraInfo) { Object.assign(this._extraInfo, extraInfo); }
1805
+ get extraInfo() { return JSON.parse(JSON.stringify(this._extraInfo)); }
1806
+ // Fields
1807
+ getFields() { return this._fieldArray; }
1808
+ getFieldNames() { return this._fieldArray.map(field => field.fieldCode); }
1809
+ getField(elementId) { var _a; return (elementId && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[elementId])) ? this._fields[elementId] : null; }
1810
+ get fields() { return this._fields; }
2043
1811
  enableField(fieldCode) {
2044
- const fieldObject = this.getFieldObject(fieldCode);
1812
+ const fieldObject = this.getField(fieldCode);
2045
1813
  return (fieldObject) ? fieldObject.enable() : null;
2046
1814
  }
2047
1815
  disableField(fieldCode) {
2048
- const fieldObject = this.getFieldObject(fieldCode);
1816
+ const fieldObject = this.getField(fieldCode);
2049
1817
  return (fieldObject) ? fieldObject.disable() : null;
2050
1818
  }
2051
1819
  getFieldValue(fieldCode) {
2052
- const fieldObject = this.getFieldObject(fieldCode);
1820
+ const fieldObject = this.getField(fieldCode);
2053
1821
  return (fieldObject) ? fieldObject.getValue() : null;
2054
1822
  }
2055
1823
  getFieldsValues(fieldCodesArray) {
@@ -2061,37 +1829,37 @@ class FormStructureAndData {
2061
1829
  for (let index = 0; index < fieldCodesArray.length; index++) {
2062
1830
  const fieldCode = fieldCodesArray[index];
2063
1831
  if (fieldCode) {
2064
- resultObject[fieldCode] = (_c = (_b = (_a = this._fieldsObj) === null || _a === void 0 ? void 0 : _a[fieldCode]) === null || _b === void 0 ? void 0 : _b.getValue()) !== null && _c !== void 0 ? _c : null;
1832
+ resultObject[fieldCode] = (_c = (_b = (_a = this._fields) === null || _a === void 0 ? void 0 : _a[fieldCode]) === null || _b === void 0 ? void 0 : _b.getValue()) !== null && _c !== void 0 ? _c : null;
2065
1833
  }
2066
1834
  }
2067
1835
  return resultObject;
2068
1836
  }
2069
1837
  getFieldOptions(fieldCode) {
2070
- const fieldObject = this.getFieldObject(fieldCode);
1838
+ const fieldObject = this.getField(fieldCode);
2071
1839
  return (fieldObject) ? fieldObject.getFieldOptions() : null;
2072
1840
  }
2073
1841
  setFieldValue(fieldCode, fieldValue) {
2074
- const fieldObject = this.getFieldObject(fieldCode);
1842
+ const fieldObject = this.getField(fieldCode);
2075
1843
  return (fieldObject) ? fieldObject.setValue(fieldValue) : null;
2076
1844
  }
2077
1845
  setFieldError(code, message, type = 'error') {
2078
- const fieldObject = this.getFieldObject(code);
1846
+ const fieldObject = this.getField(code);
2079
1847
  return (fieldObject) ? fieldObject.setError(code, message, type) : null;
2080
1848
  }
2081
1849
  setFieldIntrinsicErrorMessage(code, message) {
2082
- const fieldObject = this.getFieldObject(code);
1850
+ const fieldObject = this.getField(code);
2083
1851
  return (fieldObject) ? fieldObject.setIntrinsicErrorMessage(message) : null;
2084
1852
  }
2085
1853
  setFieldRequired(fieldCode, required) {
2086
- const fieldObject = this.getFieldObject(fieldCode);
1854
+ const fieldObject = this.getField(fieldCode);
2087
1855
  return (fieldObject) ? fieldObject.required = required : null;
2088
1856
  }
2089
1857
  setFieldErrorMessage(fieldCode, errorMessage) {
2090
- const fieldObject = this.getFieldObject(fieldCode);
1858
+ const fieldObject = this.getField(fieldCode);
2091
1859
  return (fieldObject) ? fieldObject.setErrorMessage(errorMessage) : null;
2092
1860
  }
2093
1861
  setFieldOptions(fieldCode, optionsArray, idAttribute, nameAttribute) {
2094
- const fieldObject = this.getFieldObject(fieldCode);
1862
+ const fieldObject = this.getField(fieldCode);
2095
1863
  if (fieldObject && optionsArray && optionsArray.length > 0) {
2096
1864
  const fieldOptions = [];
2097
1865
  for (const optionItem of optionsArray) {
@@ -2110,7 +1878,7 @@ class FormStructureAndData {
2110
1878
  fieldUniverse = fieldArray;
2111
1879
  }
2112
1880
  else if (sectionCode && !subSectionCode) {
2113
- const sectionObject = this.getSectionObject(sectionCode);
1881
+ const sectionObject = this.getSection(sectionCode);
2114
1882
  fieldUniverse = sectionObject === null || sectionObject === void 0 ? void 0 : sectionObject.getFieldNames();
2115
1883
  }
2116
1884
  else if (sectionCode && subSectionCode) {
@@ -2124,7 +1892,7 @@ class FormStructureAndData {
2124
1892
  return fieldUniverse;
2125
1893
  }
2126
1894
  return fieldUniverse.filter(fld => {
2127
- const fieldObject = this.getFieldObject(fld);
1895
+ const fieldObject = this.getField(fld);
2128
1896
  return (fieldObject && filterFunc(fieldObject));
2129
1897
  });
2130
1898
  }
@@ -2133,7 +1901,7 @@ class FormStructureAndData {
2133
1901
  let fieldSetSize = 0;
2134
1902
  if (fieldUniverse && processFunc) {
2135
1903
  for (const fieldCode of fieldUniverse) {
2136
- const fieldObject = this.getFieldObject(fieldCode);
1904
+ const fieldObject = this.getField(fieldCode);
2137
1905
  if (fieldObject) {
2138
1906
  try {
2139
1907
  processFunc(fieldObject);
@@ -2207,29 +1975,108 @@ class FormStructureAndData {
2207
1975
  }
2208
1976
  return false;
2209
1977
  }
2210
- cleanTable(tableCode) {
2211
- const tableObject = this.getTableObject(tableCode);
2212
- return (tableObject) ? tableObject.clean() : null;
1978
+ // Acciones
1979
+ get actions() { return this._actions; }
1980
+ getActionsByAttribute(name, value) { return this._actionArray.filter(actionItem => actionItem.matchAttribute(name, value)); }
1981
+ getActions() { return this._actionArray; }
1982
+ getAction(code) { var _a; return (code && ((_a = this._actions) === null || _a === void 0 ? void 0 : _a[code])) ? this._actions[code] : null; }
1983
+ showActions(codes) { return this.execOnActions(codes, SHOW); }
1984
+ hideActions(codes) { return this.execOnActions(codes, HIDE); }
1985
+ enableActions(codes) { return this.execOnActions(codes, ENABLE); }
1986
+ disableActions(codes) { return this.execOnActions(codes, DISABLE); }
1987
+ execOnActions(codes, functionName) {
1988
+ const actionCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
1989
+ if (!functionName || actionCodes.length === 0) {
1990
+ return;
1991
+ }
1992
+ actionCodes.forEach(code => {
1993
+ var _a;
1994
+ const action = this.getAction(code);
1995
+ (_a = action === null || action === void 0 ? void 0 : action[functionName]) === null || _a === void 0 ? void 0 : _a.call(action);
1996
+ });
1997
+ }
1998
+ // Tablas
1999
+ tables() { return this.getTables(); }
2000
+ getTables() { return this._tableArray; }
2001
+ getTable(code) { var _a; return (code && ((_a = this._tables) === null || _a === void 0 ? void 0 : _a[code])) ? this._tables[code] : null; }
2002
+ enableTables(codes) { return this.execOnTables(codes, ENABLE); }
2003
+ disableTables(codes) { return this.execOnTables(codes, DISABLE); }
2004
+ showTables(codes) { return this.execOnTables(codes, SHOW); }
2005
+ hideTables(codes) { return this.execOnTables(codes, HIDE); }
2006
+ cleanTables(codes) { return this.execOnTables(codes, CLEAN); }
2007
+ execOnTables(codes, functionName) {
2008
+ const tableCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2009
+ if (!functionName || tableCodes.length === 0) {
2010
+ return;
2011
+ }
2012
+ tableCodes.forEach(code => {
2013
+ var _a;
2014
+ const table = this.getTable(code);
2015
+ (_a = table === null || table === void 0 ? void 0 : table[functionName]) === null || _a === void 0 ? void 0 : _a.call(table);
2016
+ });
2213
2017
  }
2214
2018
  getTableRecord(tableCode, recordId) {
2215
- const tableObject = this.getTableObject(tableCode);
2019
+ const tableObject = this.getTable(tableCode);
2216
2020
  return (tableObject) ? tableObject.getTableRecord(recordId) : null;
2217
2021
  }
2218
- hideTable(tableCode) {
2219
- const tableObject = this.getTableObject(tableCode);
2220
- return (tableObject) ? tableObject.hide() : null;
2022
+ // Secciones
2023
+ get sections() { return this._sectionArray; }
2024
+ getSectionsByAttribute(name, value) { return this._sectionArray.filter(item => item.matchAttribute(name, value)); }
2025
+ get sectionTitles() { return this._sectionArray.map(formSection => formSection.sectionTitle); }
2026
+ get visibleSections() { return this._sectionArray.filter(sec => sec.visible); }
2027
+ getSection(code) { var _a; return (code && ((_a = this._sections) === null || _a === void 0 ? void 0 : _a[code])) ? this._sections[code] : null; }
2028
+ showSections(names) { this.execOnSections(names, SHOW); }
2029
+ hideSections(names) { this.execOnSections(names, HIDE); }
2030
+ activeSection() { return this._exclusiveSectionsByAttr[ACTIVE]; }
2031
+ getSubSection(code, subCode) { var _a, _b; return (_b = (_a = this.getSection(code)) === null || _a === void 0 ? void 0 : _a.getSubsection(subCode)) !== null && _b !== void 0 ? _b : null; }
2032
+ showSubSections(code, subCodes) { return this.execOnSubSections(code, subCodes, SHOW); }
2033
+ hideSubSections(code, subCodes) { return this.execOnSubSections(code, subCodes, HIDE); }
2034
+ activateSection(code) {
2035
+ var _a, _b;
2036
+ if (code === this._exclusiveSectionsByAttr[ACTIVE]) {
2037
+ return;
2038
+ }
2039
+ (_a = this.getSection(this.activeSection())) === null || _a === void 0 ? void 0 : _a.inactivate();
2040
+ (_b = this.getSection(code)) === null || _b === void 0 ? void 0 : _b.activate();
2041
+ this._exclusiveSectionsByAttr[ACTIVE] = code;
2221
2042
  }
2222
- showTable(tableCode) {
2223
- const tableObject = this.getTableObject(tableCode);
2224
- return (tableObject) ? tableObject.show() : null;
2043
+ execOnSections(codes, functionName) {
2044
+ const sectionCodes = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
2045
+ if (!functionName || sectionCodes.length === 0) {
2046
+ return;
2047
+ }
2048
+ sectionCodes.forEach(code => {
2049
+ var _a;
2050
+ const section = this.getSection(code);
2051
+ (_a = section === null || section === void 0 ? void 0 : section[functionName]) === null || _a === void 0 ? void 0 : _a.call(section);
2052
+ });
2225
2053
  }
2226
- showTables(tableArray) {
2227
- const tableNames = (Array.isArray(tableArray)) ? tableArray : [tableArray];
2228
- tableNames.forEach(tableCode => this.showTable(tableCode));
2054
+ execOnSubSections(code, subNames, functionName) {
2055
+ var _a;
2056
+ const subCodes = (Array.isArray(subNames)) ? subNames : (subNames ? [subNames] : []);
2057
+ const section = this.getSection(code);
2058
+ if (!functionName || !section || subCodes.length === 0) {
2059
+ return;
2060
+ }
2061
+ for (const subCode of subCodes) {
2062
+ const subSection = this.getSubSection(code, subCode);
2063
+ (_a = subSection === null || subSection === void 0 ? void 0 : subSection[functionName]) === null || _a === void 0 ? void 0 : _a.call(subSection);
2064
+ }
2229
2065
  }
2230
- hideTables(tableArray) {
2231
- const tableNames = (Array.isArray(tableArray)) ? tableArray : [tableArray];
2232
- tableNames.forEach(tableCode => this.hideTable(tableCode));
2066
+ /**
2067
+ * Métodos propios de gestión del formulario
2068
+ */
2069
+ cleanData() {
2070
+ if (this._fieldArray) {
2071
+ for (const recordField of this._fieldArray) {
2072
+ recordField.setValue(recordField.defaultValue);
2073
+ }
2074
+ }
2075
+ if (this._tableArray) {
2076
+ for (const formTable of this._tableArray) {
2077
+ formTable.clean();
2078
+ }
2079
+ }
2233
2080
  }
2234
2081
  /** payload para servicios Tuain */
2235
2082
  getPayload() {
@@ -2411,7 +2258,87 @@ class BasicFormComponent {
2411
2258
  this.cleanStart();
2412
2259
  this.customPreProcessing();
2413
2260
  }
2414
- get inServerProcess() { return this.busy; }
2261
+ assignFunctions() {
2262
+ var _a;
2263
+ const functionsMapped = [
2264
+ ['getCurrentState', 'getCurrentState'],
2265
+ ['getCurrentMode', 'getCurrentState'],
2266
+ ['getTitle', 'getTitle'],
2267
+ ['setTitle', 'setTitle'],
2268
+ ['getAction', 'getAction'],
2269
+ ['supportState', 'supportState'],
2270
+ ['getImmutableElement', 'getImmutableElement'],
2271
+ ['getExtraInfo', 'getExtraInfo'],
2272
+ ['cleanData', 'cleanData'],
2273
+ ['getFields', 'getFields'],
2274
+ ['getFieldNames', 'getFieldNames'],
2275
+ ['getField', 'getField'],
2276
+ ['enableField', 'enableField'],
2277
+ ['disableField', 'disableField'],
2278
+ ['getFieldValue', 'getFieldValue'],
2279
+ ['getFieldsValues', 'getFieldsValues'],
2280
+ ['getFieldOptions', 'getFieldOptions'],
2281
+ ['setFieldValue', 'setFieldValue'],
2282
+ ['setFieldRequired', 'setFieldRequired'],
2283
+ ['setFieldErrorMessage', 'setFieldErrorMessage'],
2284
+ ['setFieldError', 'setFieldError'],
2285
+ ['setFieldIntrinsicErrorMessage', 'setFieldIntrinsicErrorMessage'],
2286
+ ['setFieldOptions', 'setFieldOptions'],
2287
+ ['getFieldSet', 'getFieldSet'],
2288
+ ['applyProcessToFieldSet', 'applyProcessToFieldSet'],
2289
+ ['applyProcessToAllFields', 'applyProcessToFieldSet'],
2290
+ ['cleanFields', 'cleanFields'],
2291
+ ['getRequiredFields', 'getRequiredFields'],
2292
+ ['getRequiredEmptyFields', 'getRequiredEmptyFields'],
2293
+ ['getChangedFields', 'getChangedFields'],
2294
+ ['getFieldsWithValidationIssues', 'getFieldsWithValidationIssues'],
2295
+ ['tagFieldsWithError', 'tagFieldsWithError'],
2296
+ ['cleanErrorFields', 'cleanErrorFields'],
2297
+ ['showLabelFields', 'showLabelFields'],
2298
+ ['hideLabelFields', 'hideLabelFields'],
2299
+ ['enableFields', 'enableFields'],
2300
+ ['disableFields', 'disableFields'],
2301
+ ['enableEditFields', 'enableEditFields'],
2302
+ ['disableEditFields', 'disableEditFields'],
2303
+ ['showFields', 'showFields'],
2304
+ ['hideFields', 'hideFields'],
2305
+ ['getActionsByAttribute', 'getActionsByAttribute'],
2306
+ ['getAction', 'getAction'],
2307
+ ['showActions', 'showActions'],
2308
+ ['hideActions', 'hideActions'],
2309
+ ['enableActions', 'enableActions'],
2310
+ ['disableActions', 'disableActions'],
2311
+ ['showAction', 'showActions'],
2312
+ ['hideAction', 'hideActions'],
2313
+ ['enableAction', 'enableActions'],
2314
+ ['disableAction', 'disableActions'],
2315
+ ['activateSection', 'activateSection'],
2316
+ ['getSubSection', 'getSubSection'],
2317
+ ['getSection', 'getSection'],
2318
+ ['showSection', 'showSections'],
2319
+ ['hideSection', 'hideSections'],
2320
+ ['showSections', 'showSections'],
2321
+ ['hideSections', 'hideSections'],
2322
+ ['showSubSection', 'showSubSections'],
2323
+ ['hideSubSection', 'hideSubSections'],
2324
+ ['showSubSections', 'showSubSections'],
2325
+ ['hideSubSections', 'hideSubSections'],
2326
+ ['getTables', 'getTables'],
2327
+ ['getTable', 'getTable'],
2328
+ ['showTables', 'showTables'],
2329
+ ['hideTables', 'hideTables'],
2330
+ ['showTable', 'showTables'],
2331
+ ['hideTable', 'hideTables'],
2332
+ ['cleanTables', 'cleanTables'],
2333
+ ['cleanTable', 'cleanTables'],
2334
+ ['getTableRecord', 'getTableRecord'],
2335
+ ['changeState', 'changeState'],
2336
+ ];
2337
+ for (let index = 0; index < functionsMapped.length; index++) {
2338
+ const [name, structureName] = functionsMapped[index];
2339
+ this[name] = (_a = this.formStructure) === null || _a === void 0 ? void 0 : _a[structureName];
2340
+ }
2341
+ }
2415
2342
  setConfig(formConfig) {
2416
2343
  this.formConfig = formConfig;
2417
2344
  }
@@ -2443,127 +2370,22 @@ class BasicFormComponent {
2443
2370
  this.tableGetDataStart = {};
2444
2371
  this.tableGetDataFinish = {};
2445
2372
  }
2373
+ get formManager() { return this; }
2374
+ get formCode() { return this.name; }
2375
+ set formCode(name) { this.name = name; }
2376
+ get inServerProcess() { return this.busy; }
2446
2377
  get form() { return this.formStructure; }
2378
+ get visibleSections() { return this.formStructure.visibleSections; }
2447
2379
  get currentState() { return this.formStructure.state; }
2448
2380
  set currentState(state) { this.formStructure.changeState(state); }
2449
2381
  get currentMode() { return this.currentState; }
2450
2382
  get immutableData() { return this.formStructure.immutableData; }
2451
2383
  get extraInfo() { return this.formStructure.extraInfo; }
2452
- // Métodos Pass-through hacia el contenido y estructura del formulario
2453
- supportState(state) { return this.formStructure.supportState(state); }
2454
- supportMode(state) { return this.supportState(state); }
2455
- getTitle() { return this.formStructure.title; }
2456
- setTitle(title) { this.formStructure.title = title; }
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); }
2384
+ get state() { return this.getCurrentState(); }
2385
+ get formRoute() { return this._formRoute; }
2386
+ set formRoute(route) { this._formRoute = route; }
2387
+ get subject() { return this.formSubject; }
2388
+ // Métodos virtuales
2567
2389
  customPreProcessing() { }
2568
2390
  customFormStart() { }
2569
2391
  displayActionServerError() { }
@@ -2572,6 +2394,43 @@ class BasicFormComponent {
2572
2394
  showFieldInfo(fieldCode) { }
2573
2395
  showModalDialog(title, body, options, callback, params) { }
2574
2396
  openUploadDialog(title, body, options, callback, params) { }
2397
+ /**
2398
+ * @deprecated Use supportState
2399
+ */
2400
+ supportMode(state) { return this.supportState(state); }
2401
+ /**
2402
+ * @deprecated Use getField
2403
+ */
2404
+ getFieldObject(code) { return this.getField(code); }
2405
+ /**
2406
+ * @deprecated Use getAction
2407
+ */
2408
+ getActionObject(code) { return this.getAction(code); }
2409
+ /**
2410
+ * @deprecated Use getTable
2411
+ */
2412
+ getTableObject(code) { return this.getTable(code); }
2413
+ /**
2414
+ * @deprecated Use getSection
2415
+ */
2416
+ getSectionObject(code) { return this.getSection(code); }
2417
+ /**
2418
+ * @deprecated Use changeState
2419
+ */
2420
+ changeFormMode(state) { return this.changeState(state); }
2421
+ /**
2422
+ * @deprecated Use subject
2423
+ */
2424
+ getFormSubject() { return this.subject; }
2425
+ /**
2426
+ * @deprecated Use subject
2427
+ */
2428
+ getSubject() { return this.formSubject; }
2429
+ /**
2430
+ * @deprecated Use subject
2431
+ */
2432
+ getformSubject() { return this.getSubject(); }
2433
+ numSections() { return this.formStructure.sections.length; }
2575
2434
  subscribeAppEvent(eventName, callback) {
2576
2435
  this._eventEmiter.subscribe(eventName, callback);
2577
2436
  }
@@ -2601,25 +2460,15 @@ class BasicFormComponent {
2601
2460
  this.errorMessage = errorMessage || '';
2602
2461
  this.errorDetail = errorDetail || '';
2603
2462
  }
2604
- get formManager() { return this; }
2605
2463
  resetError() { this.setError(null, null, null); }
2606
2464
  getErrorType() { return this._errorType; }
2607
2465
  getErrorMessage() { return this.errorMessage; }
2608
2466
  getErrorDetail() { return this.errorDetail; }
2609
2467
  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
2468
  getFormParameter(name) {
2618
2469
  var _a, _b;
2619
2470
  return (name) ? ((_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null) : null;
2620
2471
  }
2621
- getSubject() { return this.formSubject; }
2622
- getformSubject() { return this.getSubject(); }
2623
2472
  preocessInputParams(params) {
2624
2473
  var _a, _b, _c;
2625
2474
  this.controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
@@ -2634,7 +2483,7 @@ class BasicFormComponent {
2634
2483
  return state;
2635
2484
  }
2636
2485
  subscribeSectionActivation() {
2637
- const formSections = this.formStructure.getSections();
2486
+ const formSections = this.formStructure.sections;
2638
2487
  if (Array.isArray(formSections)) {
2639
2488
  formSections.forEach(section => {
2640
2489
  section.activation.subscribe(code => this.launchSectionActivation(code));
@@ -2728,8 +2577,9 @@ class BasicFormComponent {
2728
2577
  errorOccured() {
2729
2578
  return (this.errorCode !== NO_ERROR);
2730
2579
  }
2731
- changeState(state) { return this.formStructure.changeState(state); }
2732
- changeFormMode(state) { return this.changeState(state); }
2580
+ /**
2581
+ * Soporte manejo de eventos de formulario
2582
+ */
2733
2583
  requestFormAction(actionCode, actionSubject = {}) {
2734
2584
  return __awaiter(this, void 0, void 0, function* () {
2735
2585
  const actionDetail = {
@@ -2770,7 +2620,7 @@ class BasicFormComponent {
2770
2620
  }
2771
2621
  if (actions && actions.length > 0) {
2772
2622
  for (const changedAction of actions) {
2773
- const actionObject = this.getActionObject(changedAction.actionCode);
2623
+ const actionObject = this.getAction(changedAction.actionCode);
2774
2624
  if (actionObject) {
2775
2625
  actionObject.updateFromServer(changedAction);
2776
2626
  }
@@ -2778,7 +2628,7 @@ class BasicFormComponent {
2778
2628
  }
2779
2629
  if (fields && fields.length > 0) {
2780
2630
  for (const changedField of fields) {
2781
- const fieldObject = this.getFieldObject(changedField.fieldCode);
2631
+ const fieldObject = this.getField(changedField.fieldCode);
2782
2632
  if (fieldObject) {
2783
2633
  fieldObject.updateFromServer(changedField);
2784
2634
  }
@@ -2786,7 +2636,7 @@ class BasicFormComponent {
2786
2636
  }
2787
2637
  if (recordTables && recordTables.length > 0) {
2788
2638
  for (const changedTable of recordTables) {
2789
- const tableObject = this.getTableObject(changedTable.tableCode);
2639
+ const tableObject = this.getTable(changedTable.tableCode);
2790
2640
  if (tableObject) {
2791
2641
  tableObject.updateFromServer(changedTable);
2792
2642
  }
@@ -2839,7 +2689,7 @@ class BasicFormComponent {
2839
2689
  }
2840
2690
  launchSectionActivation(sectionCode) {
2841
2691
  return __awaiter(this, void 0, void 0, function* () {
2842
- const sectionObject = this.formStructure.getSectionObject(sectionCode);
2692
+ const sectionObject = this.formStructure.getSection(sectionCode);
2843
2693
  if (!sectionObject) {
2844
2694
  return;
2845
2695
  }
@@ -2853,7 +2703,7 @@ class BasicFormComponent {
2853
2703
  }
2854
2704
  launchSectionInactivation(sectionCode) {
2855
2705
  return __awaiter(this, void 0, void 0, function* () {
2856
- const sectionObject = this.formStructure.getSectionObject(sectionCode);
2706
+ const sectionObject = this.formStructure.getSection(sectionCode);
2857
2707
  if (!sectionObject) {
2858
2708
  return;
2859
2709
  }
@@ -2957,7 +2807,7 @@ class BasicFormComponent {
2957
2807
  }
2958
2808
  startFieldInputValidation(fieldCode, intrinsicValidation = true) {
2959
2809
  return __awaiter(this, void 0, void 0, function* () {
2960
- const fieldToValidate = this.getFieldObject(fieldCode);
2810
+ const fieldToValidate = this.getField(fieldCode);
2961
2811
  if (!fieldToValidate) {
2962
2812
  return false;
2963
2813
  }
@@ -3044,7 +2894,7 @@ class BasicFormComponent {
3044
2894
  if (!tableObject) {
3045
2895
  return;
3046
2896
  }
3047
- const inlineActionObject = tableObject.getActionObject(actionCode);
2897
+ const inlineActionObject = tableObject.getAction(actionCode);
3048
2898
  if (!inlineActionObject) {
3049
2899
  return;
3050
2900
  }
@@ -3066,7 +2916,7 @@ class BasicFormComponent {
3066
2916
  if (!tableObject) {
3067
2917
  return;
3068
2918
  }
3069
- const inlineActionObject = tableObject.getActionObject(actionCode);
2919
+ const inlineActionObject = tableObject.getAction(actionCode);
3070
2920
  if (!inlineActionObject) {
3071
2921
  return;
3072
2922
  }