tuain-ng-forms-lib 0.12.22 → 0.12.32

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.
Files changed (34) hide show
  1. package/bundles/tuain-ng-forms-lib.umd.js +287 -318
  2. package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
  3. package/esm2015/lib/classes/forms/action.js +5 -5
  4. package/esm2015/lib/classes/forms/element.js +7 -6
  5. package/esm2015/lib/classes/forms/field.js +146 -166
  6. package/esm2015/lib/classes/forms/form.constants.js +11 -82
  7. package/esm2015/lib/classes/forms/form.js +8 -8
  8. package/esm2015/lib/classes/forms/subsection.js +6 -6
  9. package/esm2015/lib/classes/forms/table/column.js +5 -5
  10. package/esm2015/lib/classes/forms/table/row-data.js +6 -4
  11. package/esm2015/lib/classes/forms/table/table.js +15 -13
  12. package/esm2015/lib/components/elements/action.component.js +3 -1
  13. package/esm2015/lib/components/elements/field.component.js +45 -7
  14. package/esm2015/lib/components/elements/layout/element.component.js +3 -6
  15. package/esm2015/lib/components/elements/layout/form-error.component.js +1 -1
  16. package/esm2015/lib/components/elements/tables/table.component.js +7 -7
  17. package/esm2015/lib/components/forms/basic-form.js +24 -22
  18. package/fesm2015/tuain-ng-forms-lib.js +282 -323
  19. package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
  20. package/lib/classes/forms/action.d.ts +1 -1
  21. package/lib/classes/forms/element.d.ts +3 -2
  22. package/lib/classes/forms/field.d.ts +20 -14
  23. package/lib/classes/forms/form.constants.d.ts +10 -74
  24. package/lib/classes/forms/form.d.ts +2 -1
  25. package/lib/classes/forms/table/column.d.ts +2 -1
  26. package/lib/classes/forms/table/table.d.ts +1 -1
  27. package/lib/components/elements/action.component.d.ts +1 -0
  28. package/lib/components/elements/field.component.d.ts +17 -2
  29. package/lib/components/elements/layout/element.component.d.ts +1 -2
  30. package/lib/components/elements/layout/form-error.component.d.ts +0 -1
  31. package/lib/components/elements/tables/table.component.d.ts +1 -0
  32. package/lib/components/forms/basic-form.d.ts +2 -1
  33. package/package.json +1 -1
  34. package/tuain-ng-forms-lib.metadata.json +1 -1
@@ -10,6 +10,8 @@
10
10
  this.showLabel = true;
11
11
  }
12
12
  ActionComponent.prototype.ngOnInit = function () {
13
+ var _a;
14
+ this.formConfig = (_a = this.actionObject) === null || _a === void 0 ? void 0 : _a._formConfig;
13
15
  this.start();
14
16
  };
15
17
  ActionComponent.prototype.start = function () { };
@@ -52,106 +54,55 @@
52
54
  showLabel: [{ type: core.Input }]
53
55
  };
54
56
 
55
- var componentConstants = {
56
- recordsPerPage: 10,
57
- // Constantes para el despliegue de formularios
58
- ELEMENTTYPE_ACTION: 'ACTION',
59
- ELEMENTTYPE_FIELD: 'FIELD',
60
- ELEMENTTYPE_TABLE: 'TABLE',
61
- // Acciones de formularios
62
- FORMACTION_TABLEACTION: 'TABLEACTION',
63
- FORMACTION_GETDATA: 'GETDATA',
64
- FORMACTION_GETTABLEDATA: 'GETTABLEDATA',
65
- FORMACTION_VALIDATE: 'VALIDATE',
66
- // Errores etándar de formularios
67
- FORMERROR_VALIDATION_CODE: '13',
68
- FORMERROR_TYPE_WARNING: 'WARNING',
69
- FORMERROR_REQUIRED_FIELDS: 'Todos los campos requeridos deben ser diligenciados',
70
- FORMERROR_VALIDATION_TITLE: 'Advertencia',
71
- FORMERROR_VALIDATION_FIELDS: 'Existen campos con problemas de validación',
72
- // Valores para los controles de navegació
73
- FORMNAVIGATION_FIRST: 'first',
74
- FORMNAVIGATION_PREVGROUP: 'prevgroup',
75
- FORMNAVIGATION_NEXTGROUP: 'nextgroup',
76
- FORMNAVIGATION_LAST: 'last',
77
- FIELDTYPE_ARRAY: 'ARRAY',
78
- FIELDTYPE_CHECK: 'CHECK',
79
- FIELDTYPE_DATE: 'DATE',
80
- FIELDTYPE_MAP: 'MAP',
81
- FIELDTYPE_CURRENCY: 'CURRENCY',
82
- FIELDTYPE_SELECT: 'SELECT',
83
- FIELDTYPE_TEXT: 'TEXT',
84
- FIELD_REQUIRED_MESSAGE: 'Campo requerido',
85
- FORMTABLEACTION_SORT: 'SORT',
86
- FORMTABLEACTION_REFRESH: 'REFRESH',
87
- FORMTABLEACTION_NAVIGATE: 'NAVIGATE',
88
- FORMTABLEACTION_INLINE: 'INLINE',
89
- FORMTABLEACTION_GLOBAL: 'GLOBAL',
90
- FORMTABLEACTION_ROWSELECTION: 'ROWSELECTION',
91
- FORMTABLEACTION_SELECTION: 'SELECTION',
92
- TABLE_SORT_ASCENDING: 'asc',
93
- TABLE_SORT_DESCENDING: 'desc',
94
- SERVICE_ERRORCODE_NOERROR: '00',
57
+ var MONITORED_ATTRIBUTES = {
58
+ _maxLength: 'maxLength',
59
+ _onValidation: 'onValidation',
60
+ _fieldValue: 'value',
61
+ captureType: 'captureType',
62
+ fieldTitle: 'title',
63
+ fieldType: 'type',
64
+ errorMessage: 'errorMessage',
65
+ errorType: 'errorType',
66
+ errorCode: 'errorCode',
67
+ visibleLabel: 'visibleLabel',
68
+ fieldRequired: 'required',
69
+ fieldOptions: 'options',
95
70
  };
96
- var operators = {
97
- G: '>',
98
- L: '<',
99
- GE: '>=',
100
- LE: '<=',
101
- EQ: '==',
102
- NOT_EQ: '!=',
103
- CONTENT: 'Contiene',
104
- NOT_CONTENT: 'No Contiene',
105
- BETWEEN: 'Entre',
106
- };
107
- var tableFieldStyles = {
108
- TEXT: {
109
- 'text-align': 'left'
110
- },
111
- TITLE: {
112
- 'text-align': 'left'
113
- },
114
- LABEL: {
115
- 'text-align': 'left'
116
- },
117
- MESSAGE: {
118
- 'text-align': 'left'
119
- },
120
- NUMBER: {
121
- 'text-align': 'right'
122
- },
123
- DATE: {
124
- 'text-align': 'right'
125
- },
126
- CHECK: {
127
- 'text-align': 'center'
128
- },
129
- ARRAY: {
130
- 'text-align': 'left'
131
- },
132
- SELECT: {
133
- 'text-align': 'left'
134
- }
135
- };
136
- var DEFAULT_STATE_FLOW = {
137
- defaultState: 'CREATE',
138
- states: ['CREATE', 'EDIT', 'VIEW'],
139
- transitions: [
140
- { name: 'VIEW1', origin: 'CREATE', destination: 'VIEW' },
141
- { name: 'VIEW2', origin: 'EDIT', destination: 'VIEW' },
142
- { name: 'EDIT1', origin: 'CREATE', destination: 'EDIT' },
143
- { name: 'EDIT2', origin: 'VIEW', destination: 'EDIT' },
144
- { name: 'CREATE1', origin: 'EDIT', destination: 'CREATE' },
145
- { name: 'CREATE2', origin: 'VIEW', destination: 'CREATE' },
146
- ]
147
- };
148
-
149
71
  var FieldComponent = /** @class */ (function () {
150
72
  function FieldComponent() {
151
- this.componentConstants = Object.assign({}, componentConstants);
152
73
  }
153
74
  FieldComponent.prototype.ngOnInit = function () {
154
- this.fieldObject.widget = this;
75
+ var _this = this;
76
+ var _a;
77
+ if (this.fieldObject) {
78
+ this.formConfig = (_a = this.fieldObject) === null || _a === void 0 ? void 0 : _a._formConfig;
79
+ // Atributos estáticos
80
+ this.code = this.fieldObject.fieldCode;
81
+ this.fieldInfo = this.fieldObject.fieldInfo;
82
+ this.fieldAlignment = this.fieldObject.fieldAlignment;
83
+ this.tooltipText = this.fieldObject.tooltipText;
84
+ // Cargue inicial
85
+ this.maxLength = this.fieldObject._maxLength;
86
+ this.onValidation = this.fieldObject._onValidation;
87
+ this.value = this.fieldObject._fieldValue;
88
+ this.captureType = this.fieldObject.captureType;
89
+ this.title = this.fieldObject.fieldTitle;
90
+ this.type = this.fieldObject.fieldType;
91
+ this.errorMessage = this.fieldObject.errorMessage;
92
+ this.errorType = this.fieldObject.errorType;
93
+ this.errorCode = this.fieldObject.errorCode;
94
+ this.visibleLabel = this.fieldObject.visibleLabel;
95
+ this.required = this.fieldObject.fieldRequired;
96
+ this.options = this.fieldObject.fieldOptions;
97
+ this.fieldObject.widget = this;
98
+ // Atributos dinámicos
99
+ this.fieldObject.attributeChange.subscribe(function (event) {
100
+ var name = event.name, value = event.value;
101
+ if (_this[MONITORED_ATTRIBUTES[name]]) {
102
+ _this[MONITORED_ATTRIBUTES[name]] = value;
103
+ }
104
+ });
105
+ }
155
106
  this.start();
156
107
  };
157
108
  FieldComponent.prototype.start = function () { };
@@ -180,7 +131,6 @@
180
131
  template: "<ng-content></ng-content>"
181
132
  },] }
182
133
  ];
183
- FieldComponent.ctorParameters = function () { return []; };
184
134
  FieldComponent.propDecorators = {
185
135
  fieldObject: [{ type: core.Input }],
186
136
  disabled: [{ type: core.Input }]
@@ -188,9 +138,10 @@
188
138
 
189
139
  var ElementComponent = /** @class */ (function () {
190
140
  function ElementComponent() {
191
- this.componentConstants = Object.assign({}, componentConstants);
192
141
  }
193
142
  ElementComponent.prototype.ngOnInit = function () {
143
+ var _a;
144
+ this.formConfig = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a._formConfig;
194
145
  this.start();
195
146
  };
196
147
  ElementComponent.prototype.start = function () { };
@@ -220,7 +171,6 @@
220
171
  template: "<ng-content></ng-content>"
221
172
  },] }
222
173
  ];
223
- ElementComponent.ctorParameters = function () { return []; };
224
174
  ElementComponent.propDecorators = {
225
175
  formElement: [{ type: core.Input }],
226
176
  formManager: [{ type: core.Input }]
@@ -646,9 +596,33 @@
646
596
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
647
597
  }
648
598
 
599
+ var elementTypes = {
600
+ action: 'ACTION',
601
+ field: 'FIELD',
602
+ table: 'TABLE',
603
+ };
604
+ var formActions = {
605
+ tableAction: 'TABLEACTION',
606
+ getData: 'GETDATA',
607
+ getTableData: 'GETTABLEDATA',
608
+ validate: 'VALIDATE',
609
+ };
610
+ var operators = {
611
+ G: '>',
612
+ L: '<',
613
+ GE: '>=',
614
+ LE: '<=',
615
+ EQ: '==',
616
+ NOT_EQ: '!=',
617
+ CONTENT: 'Contiene',
618
+ NOT_CONTENT: 'No Contiene',
619
+ BETWEEN: 'Entre',
620
+ };
621
+
649
622
  var FormElement = /** @class */ (function () {
650
- function FormElement(elementDefinition) {
623
+ function FormElement(elementDefinition, formConfig) {
651
624
  var _a, _b;
625
+ this._formConfig = formConfig;
652
626
  this._isForced = false;
653
627
  this.setVisibleStates(elementDefinition.visibleStates);
654
628
  this.setEnabledStates(elementDefinition.enabledStates);
@@ -657,9 +631,9 @@
657
631
  this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
658
632
  this.widget = null;
659
633
  }
660
- FormElement.prototype.isField = function () { return this.type === componentConstants.ELEMENTTYPE_FIELD; };
661
- FormElement.prototype.isAction = function () { return this.type === componentConstants.ELEMENTTYPE_ACTION; };
662
- FormElement.prototype.isTable = function () { return this.type === componentConstants.ELEMENTTYPE_TABLE; };
634
+ FormElement.prototype.isField = function () { return this.elementType === elementTypes.field; };
635
+ FormElement.prototype.isAction = function () { return this.elementType === elementTypes.action; };
636
+ FormElement.prototype.isTable = function () { return this.elementType === elementTypes.table; };
663
637
  FormElement.prototype.setVisibleStates = function (newStates) {
664
638
  var visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
665
639
  ? newStates.split(',').map(function (state) { return state.trim(); }).filter(function (state) { return state.length > 0; })
@@ -719,13 +693,14 @@
719
693
  }());
720
694
 
721
695
  var RecordTableColumn = /** @class */ (function () {
722
- function RecordTableColumn(recTableColReceived) {
696
+ function RecordTableColumn(recTableColReceived, formConfig) {
723
697
  var _a, _b, _c;
698
+ this._formConfig = formConfig;
724
699
  if (recTableColReceived) {
725
700
  this.fieldCode = recTableColReceived.fieldCode;
726
701
  this.fieldTitle = recTableColReceived.fieldTitle;
727
- this.fieldType = recTableColReceived.fieldTypeCode || componentConstants.FIELDTYPE_TEXT;
728
- var defaultTypeAlignment = (tableFieldStyles[this.fieldType] != null) ? tableFieldStyles[this.fieldType]['text-align'] : 'left';
702
+ this.fieldType = recTableColReceived.fieldTypeCode || this._formConfig.fieldTypes.text;
703
+ var defaultTypeAlignment = (this._formConfig.tableFieldStyles[this.fieldType] != null) ? this._formConfig.tableFieldStyles[this.fieldType]['text-align'] : 'left';
729
704
  this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
730
705
  this.visible = (_a = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.visible) !== null && _a !== void 0 ? _a : true;
731
706
  this.sortable = (_b = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.sortable) !== null && _b !== void 0 ? _b : false;
@@ -814,6 +789,8 @@
814
789
  return outputValue;
815
790
  }
816
791
 
792
+ var DATE_TYPE = 'DATE';
793
+ var CURRENCY_TYPE = 'CURRENCY';
817
794
  var TableRecordData = /** @class */ (function () {
818
795
  function TableRecordData(recordReceived, recordDefinition, selectionFieldName) {
819
796
  var _this = this;
@@ -850,10 +827,10 @@
850
827
  }
851
828
  }
852
829
  TableRecordData.prototype.formatFieldValue = function (fieldType, fieldValue) {
853
- if (fieldType === componentConstants.FIELDTYPE_CURRENCY) {
830
+ if (fieldType === CURRENCY_TYPE) {
854
831
  return formatCurrency(fieldValue);
855
832
  }
856
- else if (fieldType === componentConstants.FIELDTYPE_DATE && fieldValue) {
833
+ else if (fieldType === DATE_TYPE && fieldValue) {
857
834
  return new Date(fieldValue).toISOString().split('T')[0];
858
835
  }
859
836
  return fieldValue || '';
@@ -964,6 +941,8 @@
964
941
  return TableRecordData;
965
942
  }());
966
943
 
944
+ var TABLE_SORT_ASCENDING = 'asc';
945
+ var TABLE_SORT_DESCENDING = 'desc';
967
946
  var TABLE_FILTER_TYPES = {
968
947
  simpleFilterChange: 'SIMPLE_CHANGE',
969
948
  simpleFilterFinish: 'SIMPLE_FINISH',
@@ -972,11 +951,11 @@
972
951
  };
973
952
  var RecordTable = /** @class */ (function (_super) {
974
953
  __extends(RecordTable, _super);
975
- function RecordTable(tableReceived) {
954
+ function RecordTable(tableReceived, formConfig) {
976
955
  var e_1, _h, e_2, _j, e_3, _k;
977
956
  var _this = this;
978
957
  var _a, _b, _c, _d, _e, _f, _g;
979
- _this = _super.call(this, tableReceived) || this;
958
+ _this = _super.call(this, tableReceived, formConfig) || this;
980
959
  _this._inlineActionTrigger = new rxjs.Subject();
981
960
  _this._globalActionTrigger = new rxjs.Subject();
982
961
  _this._recordSelectionTrigger = new rxjs.Subject();
@@ -986,7 +965,7 @@
986
965
  _this._tableColumnObj = {};
987
966
  _this._actionsObj = {};
988
967
  _this.allSelected = false;
989
- _this.type = componentConstants.ELEMENTTYPE_TABLE;
968
+ _this.elementType = elementTypes.table;
990
969
  _this.waiting = false;
991
970
  _this.complexFilter = false;
992
971
  _this.currentPage = 1;
@@ -1009,12 +988,12 @@
1009
988
  _this.customAttributes = (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.customAttributes) !== null && _f !== void 0 ? _f : {};
1010
989
  _this.sortable = (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false;
1011
990
  _this.sorting = { columnName: '', direction: '' };
1012
- _this.recordsPerPage = componentConstants.recordsPerPage;
991
+ _this.recordsPerPage = formConfig.defaultRecordsPerPage;
1013
992
  if (tableReceived.fields) {
1014
993
  try {
1015
994
  for (var _l = __values(tableReceived.fields), _m = _l.next(); !_m.done; _m = _l.next()) {
1016
995
  var columnReceived = _m.value;
1017
- var columnDefinition = new RecordTableColumn(columnReceived);
996
+ var columnDefinition = new RecordTableColumn(columnReceived, _this._formConfig);
1018
997
  _this.columns.push(columnDefinition);
1019
998
  _this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
1020
999
  }
@@ -1274,7 +1253,7 @@
1274
1253
  ? this._actionsObj[actionCode] : null;
1275
1254
  };
1276
1255
  RecordTable.prototype.getActions = function (actionClass, actionTypes) {
1277
- if (actionClass === void 0) { actionClass = componentConstants.FORMTABLEACTION_INLINE; }
1256
+ if (actionClass === void 0) { actionClass = this._formConfig.tableActions.inline; }
1278
1257
  if (actionTypes === void 0) { actionTypes = null; }
1279
1258
  return this._actions.filter(function (actionDef) {
1280
1259
  var typeIncluded = (actionTypes) ? actionTypes.includes(actionDef.actionType) : true;
@@ -1349,14 +1328,14 @@
1349
1328
  RecordTable.prototype.setRequiredOrder = function (columnField) {
1350
1329
  if (columnField !== this.sorting.columnName) {
1351
1330
  this.sorting.columnName = columnField;
1352
- this.sorting.direction = componentConstants.TABLE_SORT_ASCENDING;
1331
+ this.sorting.direction = TABLE_SORT_ASCENDING;
1353
1332
  }
1354
1333
  else {
1355
- if (this.sorting.direction === componentConstants.TABLE_SORT_ASCENDING) {
1356
- this.sorting.direction = componentConstants.TABLE_SORT_DESCENDING;
1334
+ if (this.sorting.direction === TABLE_SORT_ASCENDING) {
1335
+ this.sorting.direction = TABLE_SORT_DESCENDING;
1357
1336
  }
1358
1337
  else {
1359
- this.sorting.direction = componentConstants.TABLE_SORT_ASCENDING;
1338
+ this.sorting.direction = TABLE_SORT_ASCENDING;
1360
1339
  }
1361
1340
  }
1362
1341
  };
@@ -1378,7 +1357,7 @@
1378
1357
  else if (recordAColumn > recordBColumn) {
1379
1358
  result = 1;
1380
1359
  }
1381
- return direction === componentConstants.TABLE_SORT_ASCENDING ? result : -result;
1360
+ return direction === TABLE_SORT_ASCENDING ? result : -result;
1382
1361
  };
1383
1362
  return RecordTable;
1384
1363
  }(FormElement));
@@ -1541,13 +1520,15 @@
1541
1520
  this.hasActions = false;
1542
1521
  }
1543
1522
  LibTableComponent.prototype.ngOnInit = function () {
1544
- this.tableFieldStyles = tableFieldStyles;
1523
+ var _a;
1524
+ this.formConfig = (_a = this.tableObject) === null || _a === void 0 ? void 0 : _a._formConfig;
1525
+ this.tableFieldStyles = this.formConfig.tableFieldStyles;
1545
1526
  this.selectable = this.tableObject.selectable;
1546
1527
  this.hasActions = this.tableObject.hasActions;
1547
1528
  this.tableObject.widget = this;
1548
- this.inlineActions = this.tableObject.getActions(componentConstants.FORMTABLEACTION_INLINE);
1549
- this.globalActions = this.tableObject.getActions(componentConstants.FORMTABLEACTION_GLOBAL);
1550
- this.selectionActions = this.tableObject.getActions(componentConstants.FORMTABLEACTION_SELECTION);
1529
+ this.inlineActions = this.tableObject.getActions(this.formConfig.tableActions.inline);
1530
+ this.globalActions = this.tableObject.getActions(this.formConfig.tableActions.global);
1531
+ this.selectionActions = this.tableObject.getActions(this.formConfig.tableActions.selection);
1551
1532
  this.start();
1552
1533
  };
1553
1534
  LibTableComponent.prototype.start = function () { };
@@ -1665,21 +1646,21 @@
1665
1646
  var arrayToAdd = null;
1666
1647
  var type = receivedElement.type, code = receivedElement.code;
1667
1648
  switch (type) {
1668
- case componentConstants.ELEMENTTYPE_FIELD:
1649
+ case elementTypes.field:
1669
1650
  elementObject = formObject.getFieldObject(code);
1670
1651
  arrayToAdd = this.subSectionFields;
1671
1652
  break;
1672
- case componentConstants.ELEMENTTYPE_TABLE:
1653
+ case elementTypes.table:
1673
1654
  elementObject = formObject.getTableObject(code);
1674
1655
  arrayToAdd = this.subSectionTables;
1675
1656
  break;
1676
- case componentConstants.ELEMENTTYPE_ACTION:
1657
+ case elementTypes.action:
1677
1658
  elementObject = formObject.getActionObject(code);
1678
1659
  arrayToAdd = this.subSectionActions;
1679
1660
  break;
1680
1661
  }
1681
1662
  if (elementObject) {
1682
- elementObject.type = type;
1663
+ elementObject.elementType = type;
1683
1664
  arrayToAdd.push(elementObject);
1684
1665
  this.subSectionElements.push(elementObject);
1685
1666
  this.elementsArray[code] = elementObject;
@@ -1883,13 +1864,13 @@
1883
1864
  var HEADER$1 = 'HEADER';
1884
1865
  var FormAction = /** @class */ (function (_super) {
1885
1866
  __extends(FormAction, _super);
1886
- function FormAction(actionDefinition) {
1867
+ function FormAction(actionDefinition, formConfig) {
1887
1868
  var _this = this;
1888
1869
  var _a, _b;
1889
- _this = _super.call(this, actionDefinition) || this;
1870
+ _this = _super.call(this, actionDefinition, formConfig) || this;
1890
1871
  _this._actionActivated = new rxjs.Subject();
1891
1872
  _this.inProgress = false;
1892
- _this.type = componentConstants.ELEMENTTYPE_ACTION;
1873
+ _this.elementType = elementTypes.action;
1893
1874
  _this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
1894
1875
  _this.actionName = actionDefinition.actionTitle;
1895
1876
  _this.iconName = actionDefinition.iconName || _this.actionCode;
@@ -1923,87 +1904,85 @@
1923
1904
  }(FormElement));
1924
1905
 
1925
1906
  var UNDEFINED = 'undefined';
1926
- var FIELD_VALUE = 'fieldValue';
1927
- var FIELD_OPTIONS = 'fieldOptions';
1928
- var FIELD_TITLE = 'fieldTitle';
1929
- var FIELD_CAPTURE_TYPE = 'captureType';
1930
- var FIELD_TYPE = 'fieldTypeCode';
1931
- var FIELD_MAX_LENGTH = 'maxLength';
1932
- var FIELD_VISIBLE = 'visible';
1933
- var FIELD_LABEL_VISIBLE = 'visibleLabel';
1934
- var FIELD_REQUIRED = 'required';
1935
- var FIELD_ERR_CODE = 'errorCode';
1936
- var FIELD_ERR_MSG = 'errorMessage';
1937
- var FIELD_TOOLTIP = 'tooltipText';
1938
- var FIELD_INFO = 'info';
1939
- var FIELD_EDITABLE = 'editable';
1940
- var FIELD_TYPES = {
1941
- array: 'ARRAY',
1942
- check: 'CHECK',
1943
- date: 'DATE',
1944
- daterange: 'DATERANGE',
1945
- time: 'TIME',
1946
- timerange: 'TIMERANGE',
1947
- map: 'MAP',
1948
- number: 'NUMBER',
1949
- decimal: 'DECIMAL',
1950
- currency: 'CURRENCY',
1951
- select: 'SELECT',
1952
- typeahead: 'TYPEAHEAD',
1953
- text: 'TEXT',
1954
- password: 'PASSWORD',
1955
- label: 'LABEL',
1956
- html: 'HTML',
1957
- title: 'TITLE',
1958
- message: 'MESSAGE',
1959
- link: 'LINK',
1960
- warning: 'WARNING',
1961
- avatar: 'AVATAR',
1962
- email: 'EMAIL',
1963
- phone: 'PHONE',
1964
- };
1965
- var FIELD_TYPES_FORMATS = {
1966
- EMAIL: '^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$',
1967
- };
1907
+ var DEFAULT_ERROR_TYPE = 'error';
1908
+ var DEFAULT_CAPTURE_TYPE = 'INPUT';
1909
+ var DEFAULT_ALIGNMENT = 'left';
1968
1910
  var STD_MAX_LENGTH = 50;
1969
1911
  var BIG_MAX_LENGTH = 500;
1912
+ var fldAttr = {
1913
+ validateOnServer: 'validateOnServer',
1914
+ value: '_fieldValue',
1915
+ minValue: '_minValue',
1916
+ maxValue: '_maxValue',
1917
+ maxLength: '_maxLength',
1918
+ onValidation: '_onValidation',
1919
+ intrinsicErrorMessage: '_intrinsicErrorMessage',
1920
+ code: 'fieldCode',
1921
+ info: 'fieldInfo',
1922
+ defaultValue: 'defaultValue',
1923
+ defaultEditable: 'defaultEditable',
1924
+ customAttributes: 'customAttributes',
1925
+ visibleLabel: 'visibleLabel',
1926
+ required: 'fieldRequired',
1927
+ hasChanged: 'hasChanged',
1928
+ outputOnly: 'outputOnly',
1929
+ captureType: 'captureType',
1930
+ title: 'fieldTitle',
1931
+ type: 'fieldType',
1932
+ alignment: 'fieldAlignment',
1933
+ format: 'fieldFormat',
1934
+ externalValue: 'externalValue',
1935
+ tooltipText: 'tooltipText',
1936
+ errorType: 'errorType',
1937
+ errorCode: 'errorCode',
1938
+ errorMessage: 'errorMessage',
1939
+ options: 'fieldOptions',
1940
+ };
1970
1941
  var FieldDescriptor = /** @class */ (function (_super) {
1971
1942
  __extends(FieldDescriptor, _super);
1972
- function FieldDescriptor(inputFieldReceived) {
1943
+ function FieldDescriptor(inputFieldReceived, formConfig) {
1973
1944
  var _this = this;
1974
- var _a, _b, _c, _d, _e, _f, _g, _h;
1975
- _this = _super.call(this, inputFieldReceived) || this;
1945
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1946
+ _this = _super.call(this, inputFieldReceived, formConfig) || this;
1976
1947
  _this._editionFinish = new rxjs.Subject();
1977
1948
  _this._editionPartial = new rxjs.Subject();
1978
1949
  _this._detailRequest = new rxjs.Subject();
1979
- _this.type = componentConstants.ELEMENTTYPE_FIELD;
1980
- var fieldReceived = (inputFieldReceived) ? inputFieldReceived : {};
1981
- _this.setEditable((_a = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.editable) !== null && _a !== void 0 ? _a : true);
1982
- _this.fieldCode = fieldReceived.fieldCode;
1983
- _this.fieldTitle = fieldReceived.fieldTitle || _this.fieldCode;
1984
- _this.captureType = fieldReceived.captureType || 'INPUT';
1985
- _this.setFieldType(fieldReceived.fieldTypeCode);
1986
- _this.defaultValue = fieldReceived.defaultValue || null;
1987
- _this._maxLength = (_b = fieldReceived.maxLength) !== null && _b !== void 0 ? _b : (_this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
1988
- _this.setValue(fieldReceived.fieldValue || _this.defaultValue || '');
1989
- var defaultTypeAlignment = (tableFieldStyles[_this.fieldType] != null) ? tableFieldStyles[_this.fieldType]['text-align'] : 'left';
1990
- _this.fieldAlignment = (fieldReceived.alignment != null) ? fieldReceived.alignment.toLowerCase() : defaultTypeAlignment;
1991
- _this.fieldInfo = fieldReceived.info || '';
1992
- _this.fieldFormat = fieldReceived.format || null;
1993
- _this.validateOnServer = (_c = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.serverAction) !== null && _c !== void 0 ? _c : false;
1994
- _this.customAttributes = (_d = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.customAttributes) !== null && _d !== void 0 ? _d : null;
1995
- _this.setVisibility(fieldReceived.visible);
1996
- _this.visibleLabel = (_e = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.visibleLabel) !== null && _e !== void 0 ? _e : true;
1997
- _this.tooltipText = fieldReceived.tooltip || '';
1998
- _this.defaultEditable = _this.enabled;
1999
- _this.fieldRequired = (_f = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.required) !== null && _f !== void 0 ? _f : false;
2000
- _this.errorMessage = fieldReceived.errorMessage || '';
2001
- _this.errorCode = (_g = fieldReceived.errorCode) !== null && _g !== void 0 ? _g : '00';
2002
- _this.outputOnly = (_h = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.outputOnly) !== null && _h !== void 0 ? _h : false;
2003
- _this.setFieldOptions(fieldReceived.fieldOptions);
2004
- _this._intrinsicErrorMessage = (_this.fieldType === FIELD_TYPES.email)
2005
- ? "El valor de " + _this.fieldTitle + " no corresponde a un correo v\u00E1lido"
2006
- : "El valor de " + _this.fieldTitle + " no se ajusta al formato establecido";
1950
+ _this._attributeChange = new rxjs.Subject();
1951
+ _this.elementType = elementTypes.field;
1952
+ var fld = (inputFieldReceived) ? inputFieldReceived : {};
1953
+ _this.setAttr(fldAttr.code, fld.fieldCode);
1954
+ _this.setAttr(fldAttr.title, (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : _this.fieldCode);
1955
+ _this.setAttr(fldAttr.captureType, (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE);
1956
+ _this.setAttr(fldAttr.defaultValue, (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null);
1957
+ var defaultTypeAlignment = (_this._formConfig.tableFieldStyles[_this.fieldType] != null)
1958
+ ? _this._formConfig.tableFieldStyles[_this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
1959
+ var fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
1960
+ _this.setAttr(fldAttr.alignment, fieldAlignment);
1961
+ _this.setAttr(fldAttr.info, fld.info || '');
1962
+ var fieldFormat;
1963
+ try {
1964
+ fieldFormat = (fld.format) ? new RegExp(fld.format) : null;
1965
+ }
1966
+ catch (e) {
1967
+ fieldFormat = null;
1968
+ }
1969
+ _this.setAttr(fldAttr.format, fieldFormat);
1970
+ _this.setAttr(fldAttr.validateOnServer, (_d = fld.serverAction) !== null && _d !== void 0 ? _d : false);
1971
+ _this.setAttr(fldAttr.customAttributes, (_e = fld.customAttributes) !== null && _e !== void 0 ? _e : {});
1972
+ _this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
1973
+ _this.setAttr(fldAttr.defaultEditable, _this.enabled);
1974
+ _this.setAttr(fldAttr.required, (_f = fld.required) !== null && _f !== void 0 ? _f : false);
1975
+ _this.setError(fld.errorCode, fld.errorMessage, (_g = fld.errorType) !== null && _g !== void 0 ? _g : DEFAULT_ERROR_TYPE);
1976
+ _this.setAttr(fldAttr.outputOnly, (_h = fld.outputOnly) !== null && _h !== void 0 ? _h : false);
1977
+ var maxLength = (_j = fld.maxLength) !== null && _j !== void 0 ? _j : (_this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
1978
+ _this.setAttr(fldAttr.maxLength, maxLength);
1979
+ _this.setAttr(fldAttr.intrinsicErrorMessage, (_k = _this._formConfig.fieldTypeErrMsg[_this.fieldType]) !== null && _k !== void 0 ? _k : _this._formConfig.fieldTypeErrMsg.DEFAULT);
1980
+ _this.setFieldType(fld.fieldTypeCode);
1981
+ _this.setEditable((_l = fld.editable) !== null && _l !== void 0 ? _l : true);
1982
+ _this.setVisibleLabel((_m = fld.visibleLabel) !== null && _m !== void 0 ? _m : true);
1983
+ _this.setVisibility(fld.visible);
1984
+ _this.setFieldOptions(fld.fieldOptions);
1985
+ _this.setValue(fld.fieldValue || _this.defaultValue || '');
2007
1986
  return _this;
2008
1987
  }
2009
1988
  Object.defineProperty(FieldDescriptor.prototype, "name", {
@@ -2016,6 +1995,11 @@
2016
1995
  enumerable: false,
2017
1996
  configurable: true
2018
1997
  });
1998
+ Object.defineProperty(FieldDescriptor.prototype, "attributeChange", {
1999
+ get: function () { return this._attributeChange; },
2000
+ enumerable: false,
2001
+ configurable: true
2002
+ });
2019
2003
  Object.defineProperty(FieldDescriptor.prototype, "editionPartial", {
2020
2004
  get: function () { return this._editionPartial; },
2021
2005
  enumerable: false,
@@ -2028,11 +2012,11 @@
2028
2012
  });
2029
2013
  Object.defineProperty(FieldDescriptor.prototype, "validating", {
2030
2014
  get: function () { return this._onValidation; },
2031
- set: function (isValidating) { this._onValidation = isValidating; },
2015
+ set: function (isValidating) { this.setAttr(fldAttr.onValidation, isValidating); },
2032
2016
  enumerable: false,
2033
2017
  configurable: true
2034
2018
  });
2035
- FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this._intrinsicErrorMessage = message; };
2019
+ FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); };
2036
2020
  Object.defineProperty(FieldDescriptor.prototype, "intrinsicErrorMessage", {
2037
2021
  set: function (message) { this.setIntrinsicErrorMessage(message); },
2038
2022
  enumerable: false,
@@ -2045,7 +2029,7 @@
2045
2029
  });
2046
2030
  Object.defineProperty(FieldDescriptor.prototype, "required", {
2047
2031
  get: function () { return this.fieldRequired; },
2048
- set: function (required) { this.fieldRequired = required !== null && required !== void 0 ? required : false; },
2032
+ set: function (required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); },
2049
2033
  enumerable: false,
2050
2034
  configurable: true
2051
2035
  });
@@ -2053,10 +2037,10 @@
2053
2037
  get: function () { return (this._maxLength > 0) ? this._maxLength.toString() : ''; },
2054
2038
  set: function (requiredMaxLength) {
2055
2039
  if (typeof requiredMaxLength === 'string') {
2056
- this._maxLength = parseInt(requiredMaxLength, 10);
2040
+ this.setAttr(fldAttr.maxLength, parseInt(requiredMaxLength, 10));
2057
2041
  }
2058
2042
  else if (typeof requiredMaxLength === 'number') {
2059
- this._maxLength = requiredMaxLength;
2043
+ this.setAttr(fldAttr.maxLength, requiredMaxLength);
2060
2044
  }
2061
2045
  },
2062
2046
  enumerable: false,
@@ -2073,50 +2057,57 @@
2073
2057
  this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
2074
2058
  };
2075
2059
  FieldDescriptor.prototype.notifyEditionFinish = function () {
2076
- var _a, _b;
2060
+ var _a, _b, _c, _d, _e;
2077
2061
  var intrinsicValidation = true;
2078
- var fieldDefaultFormat = (FIELD_TYPES_FORMATS === null || FIELD_TYPES_FORMATS === void 0 ? void 0 : FIELD_TYPES_FORMATS[this.fieldType])
2079
- ? new RegExp(FIELD_TYPES_FORMATS === null || FIELD_TYPES_FORMATS === void 0 ? void 0 : FIELD_TYPES_FORMATS[this.fieldType]) : null;
2080
- var fieldFormat = (this.fieldFormat) ? new RegExp(this.fieldFormat) : null;
2062
+ var fieldDefaultFormat = (_b = (_a = this._formConfig.fieldTypesPatterns) === null || _a === void 0 ? void 0 : _a[this.fieldType]) !== null && _b !== void 0 ? _b : null;
2081
2063
  var fieldValue = this.getValue();
2082
- if (fieldValue && (fieldDefaultFormat || fieldFormat)) {
2083
- intrinsicValidation = ((_a = fieldDefaultFormat === null || fieldDefaultFormat === void 0 ? void 0 : fieldDefaultFormat.test(fieldValue)) !== null && _a !== void 0 ? _a : true)
2084
- && ((_b = fieldFormat === null || fieldFormat === void 0 ? void 0 : fieldFormat.test(fieldValue)) !== null && _b !== void 0 ? _b : true);
2064
+ if (fieldValue && (fieldDefaultFormat || this.fieldFormat)) {
2065
+ intrinsicValidation = ((_c = fieldDefaultFormat === null || fieldDefaultFormat === void 0 ? void 0 : fieldDefaultFormat.test(fieldValue)) !== null && _c !== void 0 ? _c : true)
2066
+ && ((_e = (_d = this.fieldFormat) === null || _d === void 0 ? void 0 : _d.test(fieldValue)) !== null && _e !== void 0 ? _e : true);
2085
2067
  if (!intrinsicValidation) {
2086
2068
  this.setError('99', this._intrinsicErrorMessage);
2087
2069
  }
2088
2070
  }
2089
2071
  this._editionFinish.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
2090
2072
  };
2073
+ FieldDescriptor.prototype.setAttr = function (name, value) {
2074
+ this[name] = value;
2075
+ if (this._formConfig.monitoredFieldAttributes.includes(name)) {
2076
+ this._attributeChange.next({ name: name, value: value });
2077
+ }
2078
+ };
2091
2079
  FieldDescriptor.prototype.notifyEditionDetailRequest = function () {
2092
2080
  this._detailRequest.next(this.fieldCode);
2093
2081
  };
2094
- FieldDescriptor.prototype.showLabel = function () { this.visibleLabel = true; };
2095
- FieldDescriptor.prototype.hideLabel = function () { this.visibleLabel = false; };
2096
- FieldDescriptor.prototype.changed = function () { this.hasChanged = true; };
2082
+ FieldDescriptor.prototype.getCustomAttribute = function (name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; };
2083
+ FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); };
2084
+ FieldDescriptor.prototype.showLabel = function () { this.setVisibleLabel(true); };
2085
+ FieldDescriptor.prototype.hideLabel = function () { this.setVisibleLabel(false); };
2086
+ FieldDescriptor.prototype.setChanged = function (hasChanged) { this.setAttr(fldAttr.hasChanged, hasChanged); };
2087
+ FieldDescriptor.prototype.changed = function () { this.setChanged(true); };
2097
2088
  FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
2098
- FieldDescriptor.prototype.setLabel = function (label) { this.fieldTitle = label; };
2089
+ FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
2099
2090
  FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); };
2100
2091
  Object.defineProperty(FieldDescriptor.prototype, "backend", {
2101
2092
  get: function () { return this.validateOnServer; },
2102
2093
  enumerable: false,
2103
2094
  configurable: true
2104
2095
  });
2105
- FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.visibleLabel = visibleLabel; };
2106
2096
  FieldDescriptor.prototype.setEditable = function (editable) {
2107
2097
  if (editable === void 0) { editable = true; }
2108
2098
  (editable) ? this.enable() : this.disable();
2109
2099
  };
2100
+ FieldDescriptor.prototype.hasError = function () { return this.errorCode !== '00'; };
2110
2101
  FieldDescriptor.prototype.setError = function (code, message, type) {
2111
- if (type === void 0) { type = 'error'; }
2112
- this.errorType = (code === '00') ? '' : type;
2113
- this.errorCode = code;
2114
- this.errorMessage = message;
2102
+ if (type === void 0) { type = DEFAULT_ERROR_TYPE; }
2103
+ this.setAttr(fldAttr.errorCode, code !== null && code !== void 0 ? code : '00');
2104
+ this.setAttr(fldAttr.errorType, (this.errorCode === '00') ? '' : type);
2105
+ this.setAttr(fldAttr.errorMessage, message !== null && message !== void 0 ? message : '');
2115
2106
  };
2116
2107
  FieldDescriptor.prototype.getError = function () { return { type: this.errorType, code: this.errorCode, message: this.errorMessage }; };
2117
2108
  Object.defineProperty(FieldDescriptor.prototype, "error", {
2118
2109
  get: function () { return this.getError(); },
2119
- set: function (errorObj) { this.setError(errorObj.code, errorObj.message, errorObj.type); },
2110
+ set: function (errorObj) { var _a; this.setError(errorObj.code, errorObj.message, (_a = errorObj.type) !== null && _a !== void 0 ? _a : DEFAULT_ERROR_TYPE); },
2120
2111
  enumerable: false,
2121
2112
  configurable: true
2122
2113
  });
@@ -2129,7 +2120,7 @@
2129
2120
  if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
2130
2121
  return true;
2131
2122
  }
2132
- if ((this.fieldType === FIELD_TYPES.array || this.fieldType === FIELD_TYPES.phone)
2123
+ if ((this.fieldType === this._formConfig.fieldTypes.array || this.fieldType === this._formConfig.fieldTypes.phone)
2133
2124
  && Array.isArray(fieldCurrentValue) && fieldCurrentValue.length === 0) {
2134
2125
  return true;
2135
2126
  }
@@ -2139,10 +2130,10 @@
2139
2130
  FieldDescriptor.prototype.getValue = function () {
2140
2131
  var _a;
2141
2132
  switch (this.fieldType) {
2142
- case componentConstants.FIELDTYPE_CHECK:
2133
+ case this._formConfig.fieldTypes.check:
2143
2134
  return (_a = this._fieldValue) !== null && _a !== void 0 ? _a : false;
2144
2135
  break;
2145
- case componentConstants.FIELDTYPE_CURRENCY:
2136
+ case this._formConfig.fieldTypes.currency:
2146
2137
  return this._fieldValue.replace(',', '');
2147
2138
  break;
2148
2139
  default:
@@ -2152,68 +2143,39 @@
2152
2143
  };
2153
2144
  FieldDescriptor.prototype.updateFromServer = function (fld) {
2154
2145
  var _a;
2155
- if (FIELD_VISIBLE in fld) {
2156
- this.setVisibility(fld.visible);
2157
- }
2158
- if (FIELD_LABEL_VISIBLE in fld) {
2159
- this.setVisibleLabel(fld.visibleLabel);
2160
- }
2161
- if (FIELD_REQUIRED in fld) {
2162
- this.fieldRequired = (_a = fld.required) !== null && _a !== void 0 ? _a : false;
2163
- }
2164
- if (FIELD_ERR_CODE in fld) {
2165
- (this.errorCode = fld.errorCode);
2166
- }
2167
- if (FIELD_ERR_MSG in fld) {
2168
- (this.errorMessage = fld.errorMessage);
2169
- }
2170
- if (FIELD_TOOLTIP in fld) {
2171
- (this.tooltipText = fld.tooltip);
2172
- }
2173
- if (FIELD_INFO in fld) {
2174
- (this.fieldInfo = fld.info);
2175
- }
2176
- if (FIELD_EDITABLE in fld) {
2177
- this.setEditable(fld.editable);
2178
- }
2179
- if (FIELD_TITLE in fld) {
2180
- this.setLabel(fld.fieldTitle.toString());
2181
- }
2182
- if (FIELD_VALUE in fld) {
2183
- this.hasChanged = false;
2184
- this.setValue(fld.fieldValue);
2185
- }
2186
- if (FIELD_OPTIONS in fld) {
2187
- this.setFieldOptions(fld.fieldOptions);
2188
- }
2189
- if (FIELD_CAPTURE_TYPE in fld) {
2190
- this.captureType = fld.captureType || 'INPUT';
2191
- }
2192
- if (FIELD_TYPE in fld) {
2193
- this.setFieldType(fld.fieldTypeCode);
2194
- }
2195
- if (FIELD_MAX_LENGTH in fld) {
2196
- this.maxLength = fld.maxLength;
2146
+ var fieldKeys = Object.keys(fld);
2147
+ for (var index = 0; index < fieldKeys.length; index++) {
2148
+ var attrName = fieldKeys[index];
2149
+ var attrValue = fld[attrName];
2150
+ (attrName === this._formConfig.apifieldattrs.visible) && this.setVisibility(attrValue);
2151
+ (attrName === this._formConfig.apifieldattrs.labelVisible) && this.setVisibleLabel(fld.visibleLabel);
2152
+ (attrName === this._formConfig.apifieldattrs.required) && this.setAttr(fldAttr.required, (_a = fld.required) !== null && _a !== void 0 ? _a : false);
2153
+ (attrName === this._formConfig.apifieldattrs.errorCode) && this.setAttr(fldAttr.errorCode, fld.errorCode);
2154
+ (attrName === this._formConfig.apifieldattrs.errorMessage) && this.setAttr(fldAttr.errorMessage, fld.errorMessage);
2155
+ (attrName === this._formConfig.apifieldattrs.tooltip) && this.setAttr(fldAttr.tooltipText, fld.tooltip);
2156
+ (attrName === this._formConfig.apifieldattrs.info) && this.setAttr(fldAttr.info, fld.info);
2157
+ (attrName === this._formConfig.apifieldattrs.editable) && this.setEditable(fld.editable);
2158
+ (attrName === this._formConfig.apifieldattrs.title) && this.setLabel(fld.fieldTitle.toString());
2159
+ (attrName === this._formConfig.apifieldattrs.value) && (this.setValue(fld._fieldValue) && this.setChanged(false));
2160
+ (attrName === this._formConfig.apifieldattrs.options) && this.setFieldOptions(fld.fieldOptions);
2161
+ (attrName === this._formConfig.apifieldattrs.captureType) && this.setAttr(fldAttr.captureType, fld.captureType || 'INPUT');
2162
+ (attrName === this._formConfig.apifieldattrs.type) && this.setFieldType(fld.fieldTypeCode);
2163
+ (attrName === this._formConfig.apifieldattrs.maxLength) && this.setAttr(fldAttr.maxLength, fld.maxLength);
2197
2164
  }
2198
2165
  };
2199
2166
  FieldDescriptor.prototype.setFieldType = function (inputFieldType) {
2200
- this.fieldType = inputFieldType;
2201
- /**
2202
- * Se elimina la validación de que sea un tipo conocido
2203
- * this.fieldType = (inputFieldType && FIELDTYPES.includes(inputFieldType))
2204
- * ? inputFieldType : componentConstants.FIELDTYPE_TEXT;
2205
- */
2167
+ this.setAttr(fldAttr.type, inputFieldType);
2206
2168
  };
2207
2169
  FieldDescriptor.prototype.format = function () {
2208
- if (this.fieldType === componentConstants.FIELDTYPE_CURRENCY) {
2209
- this._fieldValue = formatCurrency(this._fieldValue);
2170
+ if (this.fieldType === this._formConfig.fieldTypes.currency) {
2171
+ this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
2210
2172
  }
2211
2173
  };
2212
2174
  FieldDescriptor.prototype.setMinValue = function (minValue) {
2213
2175
  var _a, _b, _c;
2214
- if (this.fieldType === componentConstants.FIELDTYPE_DATE
2176
+ if (this.fieldType === this._formConfig.fieldTypes.date
2215
2177
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMinValue)) {
2216
- this._minValue = minValue;
2178
+ this.setAttr(fldAttr.minValue, minValue);
2217
2179
  if (!minValue) {
2218
2180
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMinValue(false);
2219
2181
  }
@@ -2225,9 +2187,9 @@
2225
2187
  };
2226
2188
  FieldDescriptor.prototype.setMaxValue = function (maxValue) {
2227
2189
  var _a, _b, _c;
2228
- if (this.fieldType === componentConstants.FIELDTYPE_DATE
2190
+ if (this.fieldType === this._formConfig.fieldTypes.date
2229
2191
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMaxValue)) {
2230
- this._maxValue = maxValue;
2192
+ this.setAttr(fldAttr.maxValue, maxValue);
2231
2193
  if (!maxValue) {
2232
2194
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMaxValue(false);
2233
2195
  }
@@ -2255,14 +2217,16 @@
2255
2217
  }
2256
2218
  return Object.assign({}, option);
2257
2219
  });
2258
- this.fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
2220
+ fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
2259
2221
  && fieldOptions.length > 0) ? fieldOptions : [];
2260
- if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && this.widget) {
2222
+ this.setAttr(fldAttr.options, fieldOptions);
2223
+ if (this.fieldType === this._formConfig.fieldTypes.array && this.widget) {
2261
2224
  return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
2262
2225
  }
2263
2226
  if (this._fieldValue) {
2264
- if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && Array.isArray(this._fieldValue)) {
2265
- this._fieldValue = (_b = this._fieldValue) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return _this.fieldOptions.find(function (opt) { return opt.fieldOptionId === item; }); });
2227
+ if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._fieldValue)) {
2228
+ var fieldValue = (_b = this._fieldValue) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return _this.fieldOptions.find(function (opt) { return opt.fieldOptionId === item; }); });
2229
+ this.setAttr(fldAttr.value, fieldValue);
2266
2230
  }
2267
2231
  else {
2268
2232
  var valInOptions = this.fieldOptions
@@ -2283,17 +2247,17 @@
2283
2247
  if (widgetUpdate === void 0) { widgetUpdate = true; }
2284
2248
  var _a;
2285
2249
  if (typeof newValue === UNDEFINED || newValue === null) {
2286
- return;
2250
+ return true;
2287
2251
  }
2288
2252
  var newFinalValue;
2289
2253
  switch (this.fieldType) {
2290
2254
  case 'BOOLEAN':
2291
2255
  newFinalValue = !!newValue;
2292
2256
  break;
2293
- case componentConstants.FIELDTYPE_CHECK:
2257
+ case this._formConfig.fieldTypes.check:
2294
2258
  newFinalValue = !!newValue;
2295
2259
  break;
2296
- case componentConstants.FIELDTYPE_ARRAY:
2260
+ case this._formConfig.fieldTypes.array:
2297
2261
  if (newValue === null || newValue === '') {
2298
2262
  newFinalValue = [];
2299
2263
  }
@@ -2307,7 +2271,7 @@
2307
2271
  newFinalValue = newValue;
2308
2272
  }
2309
2273
  break;
2310
- case componentConstants.FIELDTYPE_MAP:
2274
+ case this._formConfig.fieldTypes.map:
2311
2275
  newFinalValue = newValue;
2312
2276
  if (newFinalValue && this.widget && widgetUpdate) {
2313
2277
  var latitude = parseFloat(newFinalValue[0]);
@@ -2315,7 +2279,7 @@
2315
2279
  (_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
2316
2280
  }
2317
2281
  break;
2318
- case componentConstants.FIELDTYPE_CURRENCY:
2282
+ case this._formConfig.fieldTypes.currency:
2319
2283
  newFinalValue = formatCurrency(this._fieldValue);
2320
2284
  break;
2321
2285
  default:
@@ -2323,9 +2287,10 @@
2323
2287
  break;
2324
2288
  }
2325
2289
  if (this._fieldValue !== newFinalValue) {
2326
- this.hasChanged = true;
2327
- this._fieldValue = newFinalValue;
2290
+ this.setChanged(true);
2291
+ this.setAttr(fldAttr.value, newFinalValue);
2328
2292
  }
2293
+ return true;
2329
2294
  };
2330
2295
  return FieldDescriptor;
2331
2296
  }(FormElement));
@@ -2333,14 +2298,16 @@
2333
2298
  var HEADER = 'HEADER';
2334
2299
  var NO_ERROR = '00';
2335
2300
  var FormStructureAndData = /** @class */ (function () {
2336
- function FormStructureAndData(definitionReceived) {
2301
+ function FormStructureAndData(definitionReceived, formConfig) {
2337
2302
  var e_1, _d, e_2, _e, e_3, _f, e_4, _g;
2303
+ var _this = this;
2338
2304
  this._fieldsObj = {};
2339
2305
  this._actionsObj = {};
2340
2306
  this._tableObj = {};
2341
2307
  this._sectionsObj = {};
2342
2308
  this._immutableData = {};
2343
2309
  this._extraInfo = {};
2310
+ this._formConfig = formConfig;
2344
2311
  this.state = '';
2345
2312
  this._actions = [];
2346
2313
  this._fields = [];
@@ -2376,7 +2343,7 @@
2376
2343
  try {
2377
2344
  for (var formActions_1 = __values(formActions), formActions_1_1 = formActions_1.next(); !formActions_1_1.done; formActions_1_1 = formActions_1.next()) {
2378
2345
  var actionReceived = formActions_1_1.value;
2379
- var globalAction = new FormAction(actionReceived);
2346
+ var globalAction = new FormAction(actionReceived, this._formConfig);
2380
2347
  var globalActionCode = globalAction.actionCode;
2381
2348
  if (globalActionCode) {
2382
2349
  this._actions.push(globalAction);
@@ -2407,7 +2374,7 @@
2407
2374
  try {
2408
2375
  for (var formFields_1 = __values(formFields), formFields_1_1 = formFields_1.next(); !formFields_1_1.done; formFields_1_1 = formFields_1.next()) {
2409
2376
  var fieldReceived = formFields_1_1.value;
2410
- var fieldToAdd = new FieldDescriptor(fieldReceived);
2377
+ var fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
2411
2378
  var fieldCode = fieldToAdd.fieldCode;
2412
2379
  if (fieldCode) {
2413
2380
  this._fields.push(fieldToAdd);
@@ -2434,14 +2401,14 @@
2434
2401
  enabledStates = __spreadArray([], __read(visibleStates));
2435
2402
  }
2436
2403
  if (!visibleStates || visibleStates.length === 0) {
2437
- visibleStates = DEFAULT_STATE_FLOW.states;
2404
+ visibleStates = _this._formConfig.defaultStateFlow.states;
2438
2405
  }
2439
2406
  return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
2440
2407
  });
2441
2408
  try {
2442
2409
  for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
2443
2410
  var tableReceived = tables_1_1.value;
2444
- var tableToAdd = new RecordTable(tableReceived);
2411
+ var tableToAdd = new RecordTable(tableReceived, this._formConfig);
2445
2412
  var tableCode = tableToAdd.tableCode;
2446
2413
  if (tableCode) {
2447
2414
  this._tables.push(tableToAdd);
@@ -2551,7 +2518,7 @@
2551
2518
  FormStructureAndData.prototype.setStateFlow = function (states, transitions, defaultState) {
2552
2519
  var _this = this;
2553
2520
  if (!states || !transitions) {
2554
- this._stateFlow = JSON.parse(JSON.stringify(DEFAULT_STATE_FLOW));
2521
+ this._stateFlow = JSON.parse(JSON.stringify(this._formConfig.defaultStateFlow));
2555
2522
  return;
2556
2523
  }
2557
2524
  this._stateFlow.states = states;
@@ -3230,7 +3197,6 @@
3230
3197
  this.transitionToken = null;
3231
3198
  this.inputDataFields = [];
3232
3199
  this.extraData = null;
3233
- this.componentConstants = componentConstants;
3234
3200
  this.definitionObtained = false;
3235
3201
  this.formVisible = false;
3236
3202
  this.inServerProcess = false;
@@ -3252,6 +3218,9 @@
3252
3218
  this.cleanStart();
3253
3219
  this.customPreProcessing();
3254
3220
  }
3221
+ BasicFormComponent.prototype.setConfig = function (formConfig) {
3222
+ this.formConfig = formConfig;
3223
+ };
3255
3224
  BasicFormComponent.prototype.cleanStart = function () {
3256
3225
  this._errorType = '';
3257
3226
  this.errorCode = '';
@@ -3594,7 +3563,7 @@
3594
3563
  case 1:
3595
3564
  formDefinition = _k.sent();
3596
3565
  this.inServerProcess = false;
3597
- this.formStructure = new FormStructureAndData(formDefinition);
3566
+ this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
3598
3567
  this.definitionObtained = true;
3599
3568
  return [3 /*break*/, 3];
3600
3569
  case 2:
@@ -3631,7 +3600,7 @@
3631
3600
  this.setFieldValue(fieldCode, fieldValue);
3632
3601
  }
3633
3602
  }
3634
- return [4 /*yield*/, this.requestFormAction(componentConstants.FORMACTION_GETDATA)];
3603
+ return [4 /*yield*/, this.requestFormAction(formActions.getData)];
3635
3604
  case 4:
3636
3605
  recordResponse = _k.sent();
3637
3606
  this.checkErrorRecordReceived(recordResponse);
@@ -3656,7 +3625,7 @@
3656
3625
  this.errorDetail = recordResponse.errorDetail;
3657
3626
  };
3658
3627
  BasicFormComponent.prototype.errorOccured = function () {
3659
- return (this.errorCode !== componentConstants.SERVICE_ERRORCODE_NOERROR);
3628
+ return (this.errorCode !== '00');
3660
3629
  };
3661
3630
  BasicFormComponent.prototype.changeState = function (state) { return this.formStructure.changeState(state); };
3662
3631
  BasicFormComponent.prototype.changeFormMode = function (state) { return this.changeState(state); };
@@ -4115,7 +4084,7 @@
4115
4084
  if (!fieldObj.backend) return [3 /*break*/, 2];
4116
4085
  fieldObj.validating = true;
4117
4086
  return [4 /*yield*/, this
4118
- .requestFormAction(componentConstants.FORMACTION_VALIDATE, fieldObj.fieldCode)];
4087
+ .requestFormAction(formActions.validate, fieldObj.fieldCode)];
4119
4088
  case 1:
4120
4089
  validationResult = _g.sent();
4121
4090
  finish = !this.errorOccured();
@@ -4360,7 +4329,7 @@
4360
4329
  actionCode: actionCode
4361
4330
  };
4362
4331
  return [4 /*yield*/, this
4363
- .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4332
+ .requestFormAction(formActions.tableAction, actionSubject)];
4364
4333
  case 1:
4365
4334
  actionResult = _g.sent();
4366
4335
  finish = !this.errorOccured();
@@ -4491,13 +4460,13 @@
4491
4460
  if (!action.backend) return [3 /*break*/, 2];
4492
4461
  actionSubject = {
4493
4462
  tableCode: tableCode,
4494
- actionType: componentConstants.FORMTABLEACTION_INLINE,
4463
+ actionType: this.formConfig.tableActions.inline,
4495
4464
  actionCode: actionCode,
4496
4465
  tableRecordId: recordId,
4497
4466
  tableRecordData: recordData
4498
4467
  };
4499
4468
  return [4 /*yield*/, this
4500
- .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4469
+ .requestFormAction(formActions.tableAction, actionSubject)];
4501
4470
  case 1:
4502
4471
  actionResult = _g.sent();
4503
4472
  finish = !this.errorOccured();
@@ -4621,13 +4590,13 @@
4621
4590
  if (!tableObject.selectionBackend) return [3 /*break*/, 2];
4622
4591
  actionSubject = {
4623
4592
  tableCode: tableCode,
4624
- actionType: componentConstants.FORMTABLEACTION_ROWSELECTION,
4593
+ actionType: this.formConfig.tableActions.rowSelection,
4625
4594
  actionCode: null,
4626
4595
  tableRecordId: recordId,
4627
4596
  tableRecordData: recordData
4628
4597
  };
4629
4598
  return [4 /*yield*/, this
4630
- .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4599
+ .requestFormAction(formActions.tableAction, actionSubject)];
4631
4600
  case 1:
4632
4601
  actionResult = _g.sent();
4633
4602
  finish = !this.errorOccured();
@@ -4752,12 +4721,12 @@
4752
4721
  if (!action.backend) return [3 /*break*/, 2];
4753
4722
  actionSubject = {
4754
4723
  tableCode: tableCode,
4755
- actionType: componentConstants.FORMTABLEACTION_SELECTION,
4724
+ actionType: this.formConfig.tableActions.selection,
4756
4725
  actionCode: actionCode,
4757
4726
  selectedRecords: selectedRecords
4758
4727
  };
4759
4728
  return [4 /*yield*/, this
4760
- .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4729
+ .requestFormAction(formActions.tableAction, actionSubject)];
4761
4730
  case 1:
4762
4731
  actionResult = _g.sent();
4763
4732
  finish = !this.errorOccured();
@@ -4866,7 +4835,7 @@
4866
4835
  tableObject.putOnWait();
4867
4836
  actionSubject = { tableCode: tableCode };
4868
4837
  return [4 /*yield*/, this
4869
- .requestFormAction(componentConstants.FORMACTION_GETTABLEDATA, actionSubject)];
4838
+ .requestFormAction(formActions.getTableData, actionSubject)];
4870
4839
  case 1:
4871
4840
  actionResult = _g.sent();
4872
4841
  if (this.errorOccured()) {
@@ -4926,15 +4895,15 @@
4926
4895
  this.resetError();
4927
4896
  var completeFields = this.checkSectionRequiredFields(sectionCode, reqFieldMessage);
4928
4897
  if (!completeFields) {
4929
- this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_REQUIRED_FIELDS);
4898
+ this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
4930
4899
  return;
4931
4900
  }
4932
4901
  var validationError = false;
4933
4902
  var requiredEmptyFields = this.getRequiredEmptyFields(null, sectionCode);
4934
4903
  if (requiredEmptyFields.length > 0) {
4935
4904
  validationError = true;
4936
- this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_REQUIRED_FIELDS);
4937
- this.tagFieldsWithError(requiredEmptyFields, null, componentConstants.FIELD_REQUIRED_MESSAGE);
4905
+ this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
4906
+ this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
4938
4907
  try {
4939
4908
  for (var requiredEmptyFields_1 = __values(requiredEmptyFields), requiredEmptyFields_1_1 = requiredEmptyFields_1.next(); !requiredEmptyFields_1_1.done; requiredEmptyFields_1_1 = requiredEmptyFields_1.next()) {
4940
4909
  var fieldCode = requiredEmptyFields_1_1.value;
@@ -4957,7 +4926,7 @@
4957
4926
  var validationIssueFields = this.getFieldsWithValidationIssues(null, sectionCode);
4958
4927
  if (!validationError && validationIssueFields.length > 0) {
4959
4928
  validationError = true;
4960
- this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_VALIDATION_FIELDS);
4929
+ this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
4961
4930
  try {
4962
4931
  for (var validationIssueFields_1 = __values(validationIssueFields), validationIssueFields_1_1 = validationIssueFields_1.next(); !validationIssueFields_1_1.done; validationIssueFields_1_1 = validationIssueFields_1.next()) {
4963
4932
  var fieldCode = validationIssueFields_1_1.value;
@@ -5119,13 +5088,13 @@
5119
5088
  var requiredEmptyFields = this.getRequiredEmptyFields(recordCaptureFields, null);
5120
5089
  if (requiredEmptyFields.length > 0) {
5121
5090
  validationOk = false;
5122
- this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_REQUIRED_FIELDS);
5123
- this.tagFieldsWithError(requiredEmptyFields, null, componentConstants.FIELD_REQUIRED_MESSAGE);
5091
+ this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
5092
+ this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
5124
5093
  }
5125
5094
  var validationIssueFields = this.getFieldsWithValidationIssues(recordCaptureFields, null);
5126
5095
  if (validationIssueFields.length > 0) {
5127
5096
  validationOk = false;
5128
- this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_VALIDATION_FIELDS);
5097
+ this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
5129
5098
  }
5130
5099
  return validationOk;
5131
5100
  };