tuain-ng-forms-lib 0.12.23 → 0.12.33

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 +285 -319
  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 +142 -165
  6. package/esm2015/lib/classes/forms/form.constants.js +11 -82
  7. package/esm2015/lib/classes/forms/form.js +10 -10
  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 +280 -324
  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 +19 -13
  23. package/lib/classes/forms/form.constants.d.ts +10 -74
  24. package/lib/classes/forms/form.d.ts +3 -2
  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 +2 -2
  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,92 +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: new RegExp('^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$'),
1967
- };
1907
+ var DEFAULT_ERROR_TYPE = 'error';
1908
+ var DEFAULT_CAPTURE_TYPE = 'INPUT';
1909
+ var DEFAULT_ALIGNMENT = 'left';
1968
1910
  var STD_MAX_LENGTH = 50;
1969
1911
  var BIG_MAX_LENGTH = 500;
1912
+ var fldAttr = {
1913
+ validateOnServer: 'validateOnServer',
1914
+ value: '_fieldValue',
1915
+ minValue: '_minValue',
1916
+ maxValue: '_maxValue',
1917
+ maxLength: '_maxLength',
1918
+ onValidation: '_onValidation',
1919
+ intrinsicErrorMessage: '_intrinsicErrorMessage',
1920
+ code: 'fieldCode',
1921
+ info: 'fieldInfo',
1922
+ defaultValue: 'defaultValue',
1923
+ defaultEditable: 'defaultEditable',
1924
+ customAttributes: 'customAttributes',
1925
+ visibleLabel: 'visibleLabel',
1926
+ required: 'fieldRequired',
1927
+ hasChanged: 'hasChanged',
1928
+ outputOnly: 'outputOnly',
1929
+ captureType: 'captureType',
1930
+ title: 'fieldTitle',
1931
+ type: 'fieldType',
1932
+ alignment: 'fieldAlignment',
1933
+ format: 'fieldFormat',
1934
+ externalValue: 'externalValue',
1935
+ tooltipText: 'tooltipText',
1936
+ errorType: 'errorType',
1937
+ errorCode: 'errorCode',
1938
+ errorMessage: 'errorMessage',
1939
+ options: 'fieldOptions',
1940
+ };
1970
1941
  var FieldDescriptor = /** @class */ (function (_super) {
1971
1942
  __extends(FieldDescriptor, _super);
1972
- function FieldDescriptor(inputFieldReceived) {
1943
+ function FieldDescriptor(inputFieldReceived, formConfig) {
1973
1944
  var _this = this;
1974
- var _a, _b, _c, _d, _e, _f, _g, _h;
1975
- _this = _super.call(this, inputFieldReceived) || this;
1945
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1946
+ _this = _super.call(this, inputFieldReceived, formConfig) || this;
1976
1947
  _this._editionFinish = new rxjs.Subject();
1977
1948
  _this._editionPartial = new rxjs.Subject();
1978
1949
  _this._detailRequest = new rxjs.Subject();
1979
- _this.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 || '';
1950
+ _this._attributeChange = new rxjs.Subject();
1951
+ _this.elementType = elementTypes.field;
1952
+ var fld = (inputFieldReceived) ? inputFieldReceived : {};
1953
+ _this.setAttr(fldAttr.code, fld.fieldCode);
1954
+ _this.setAttr(fldAttr.title, (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : _this.fieldCode);
1955
+ _this.setAttr(fldAttr.captureType, (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE);
1956
+ _this.setAttr(fldAttr.defaultValue, (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null);
1957
+ var defaultTypeAlignment = (_this._formConfig.tableFieldStyles[_this.fieldType] != null)
1958
+ ? _this._formConfig.tableFieldStyles[_this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
1959
+ var fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
1960
+ _this.setAttr(fldAttr.alignment, fieldAlignment);
1961
+ _this.setAttr(fldAttr.info, fld.info || '');
1962
+ var fieldFormat;
1992
1963
  try {
1993
- _this.fieldFormat = (fieldReceived.format) ? new RegExp(fieldReceived.format) : null;
1964
+ fieldFormat = (fld.format) ? new RegExp(fld.format) : null;
1994
1965
  }
1995
1966
  catch (e) {
1996
- _this.fieldFormat = null;
1997
- }
1998
- _this.validateOnServer = (_c = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.serverAction) !== null && _c !== void 0 ? _c : false;
1999
- _this.customAttributes = (_d = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.customAttributes) !== null && _d !== void 0 ? _d : null;
2000
- _this.setVisibility(fieldReceived.visible);
2001
- _this.visibleLabel = (_e = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.visibleLabel) !== null && _e !== void 0 ? _e : true;
2002
- _this.tooltipText = fieldReceived.tooltip || '';
2003
- _this.defaultEditable = _this.enabled;
2004
- _this.fieldRequired = (_f = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.required) !== null && _f !== void 0 ? _f : false;
2005
- _this.errorMessage = fieldReceived.errorMessage || '';
2006
- _this.errorCode = (_g = fieldReceived.errorCode) !== null && _g !== void 0 ? _g : '00';
2007
- _this.outputOnly = (_h = fieldReceived === null || fieldReceived === void 0 ? void 0 : fieldReceived.outputOnly) !== null && _h !== void 0 ? _h : false;
2008
- _this.setFieldOptions(fieldReceived.fieldOptions);
2009
- _this._intrinsicErrorMessage = (_this.fieldType === FIELD_TYPES.email)
2010
- ? "El valor de " + _this.fieldTitle + " no corresponde a un correo v\u00E1lido"
2011
- : "El valor de " + _this.fieldTitle + " no se ajusta al formato establecido";
1967
+ fieldFormat = null;
1968
+ }
1969
+ _this.setAttr(fldAttr.format, fieldFormat);
1970
+ _this.setAttr(fldAttr.validateOnServer, (_d = fld.serverAction) !== null && _d !== void 0 ? _d : false);
1971
+ _this.setAttr(fldAttr.customAttributes, (_e = fld.customAttributes) !== null && _e !== void 0 ? _e : {});
1972
+ _this.setAttr(fldAttr.tooltipText, fld.tooltip || '');
1973
+ _this.setAttr(fldAttr.defaultEditable, _this.enabled);
1974
+ _this.setAttr(fldAttr.required, (_f = fld.required) !== null && _f !== void 0 ? _f : false);
1975
+ _this.setError(fld.errorCode, fld.errorMessage, (_g = fld.errorType) !== null && _g !== void 0 ? _g : DEFAULT_ERROR_TYPE);
1976
+ _this.setAttr(fldAttr.outputOnly, (_h = fld.outputOnly) !== null && _h !== void 0 ? _h : false);
1977
+ var maxLength = (_j = fld.maxLength) !== null && _j !== void 0 ? _j : (_this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
1978
+ _this.setAttr(fldAttr.maxLength, maxLength);
1979
+ _this.setAttr(fldAttr.intrinsicErrorMessage, (_k = _this._formConfig.fieldTypeErrMsg[_this.fieldType]) !== null && _k !== void 0 ? _k : _this._formConfig.fieldTypeErrMsg.DEFAULT);
1980
+ _this.setFieldType(fld.fieldTypeCode);
1981
+ _this.setEditable((_l = fld.editable) !== null && _l !== void 0 ? _l : true);
1982
+ _this.setVisibleLabel((_m = fld.visibleLabel) !== null && _m !== void 0 ? _m : true);
1983
+ _this.setVisibility(fld.visible);
1984
+ _this.setFieldOptions(fld.fieldOptions);
1985
+ _this.setValue(fld.fieldValue || _this.defaultValue || '');
2012
1986
  return _this;
2013
1987
  }
2014
1988
  Object.defineProperty(FieldDescriptor.prototype, "name", {
@@ -2021,6 +1995,11 @@
2021
1995
  enumerable: false,
2022
1996
  configurable: true
2023
1997
  });
1998
+ Object.defineProperty(FieldDescriptor.prototype, "attributeChange", {
1999
+ get: function () { return this._attributeChange; },
2000
+ enumerable: false,
2001
+ configurable: true
2002
+ });
2024
2003
  Object.defineProperty(FieldDescriptor.prototype, "editionPartial", {
2025
2004
  get: function () { return this._editionPartial; },
2026
2005
  enumerable: false,
@@ -2033,11 +2012,11 @@
2033
2012
  });
2034
2013
  Object.defineProperty(FieldDescriptor.prototype, "validating", {
2035
2014
  get: function () { return this._onValidation; },
2036
- set: function (isValidating) { this._onValidation = isValidating; },
2015
+ set: function (isValidating) { this.setAttr(fldAttr.onValidation, isValidating); },
2037
2016
  enumerable: false,
2038
2017
  configurable: true
2039
2018
  });
2040
- FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this._intrinsicErrorMessage = message; };
2019
+ FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); };
2041
2020
  Object.defineProperty(FieldDescriptor.prototype, "intrinsicErrorMessage", {
2042
2021
  set: function (message) { this.setIntrinsicErrorMessage(message); },
2043
2022
  enumerable: false,
@@ -2050,7 +2029,7 @@
2050
2029
  });
2051
2030
  Object.defineProperty(FieldDescriptor.prototype, "required", {
2052
2031
  get: function () { return this.fieldRequired; },
2053
- set: function (required) { this.fieldRequired = required !== null && required !== void 0 ? required : false; },
2032
+ set: function (required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); },
2054
2033
  enumerable: false,
2055
2034
  configurable: true
2056
2035
  });
@@ -2058,10 +2037,10 @@
2058
2037
  get: function () { return (this._maxLength > 0) ? this._maxLength.toString() : ''; },
2059
2038
  set: function (requiredMaxLength) {
2060
2039
  if (typeof requiredMaxLength === 'string') {
2061
- this._maxLength = parseInt(requiredMaxLength, 10);
2040
+ this.setAttr(fldAttr.maxLength, parseInt(requiredMaxLength, 10));
2062
2041
  }
2063
2042
  else if (typeof requiredMaxLength === 'number') {
2064
- this._maxLength = requiredMaxLength;
2043
+ this.setAttr(fldAttr.maxLength, requiredMaxLength);
2065
2044
  }
2066
2045
  },
2067
2046
  enumerable: false,
@@ -2078,48 +2057,57 @@
2078
2057
  this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
2079
2058
  };
2080
2059
  FieldDescriptor.prototype.notifyEditionFinish = function () {
2081
- var _a, _b, _c, _d;
2060
+ var _a, _b, _c, _d, _e;
2082
2061
  var intrinsicValidation = true;
2083
- var fieldDefaultFormat = (_a = FIELD_TYPES_FORMATS === null || FIELD_TYPES_FORMATS === void 0 ? void 0 : FIELD_TYPES_FORMATS[this.fieldType]) !== null && _a !== void 0 ? _a : null;
2062
+ var fieldDefaultFormat = (_b = (_a = this._formConfig.fieldTypesPatterns) === null || _a === void 0 ? void 0 : _a[this.fieldType]) !== null && _b !== void 0 ? _b : null;
2084
2063
  var fieldValue = this.getValue();
2085
2064
  if (fieldValue && (fieldDefaultFormat || this.fieldFormat)) {
2086
- intrinsicValidation = ((_b = fieldDefaultFormat === null || fieldDefaultFormat === void 0 ? void 0 : fieldDefaultFormat.test(fieldValue)) !== null && _b !== void 0 ? _b : true)
2087
- && ((_d = (_c = this.fieldFormat) === null || _c === void 0 ? void 0 : _c.test(fieldValue)) !== null && _d !== void 0 ? _d : true);
2065
+ intrinsicValidation = ((_c = fieldDefaultFormat === null || fieldDefaultFormat === void 0 ? void 0 : fieldDefaultFormat.test(fieldValue)) !== null && _c !== void 0 ? _c : true)
2066
+ && ((_e = (_d = this.fieldFormat) === null || _d === void 0 ? void 0 : _d.test(fieldValue)) !== null && _e !== void 0 ? _e : true);
2088
2067
  if (!intrinsicValidation) {
2089
2068
  this.setError('99', this._intrinsicErrorMessage);
2090
2069
  }
2091
2070
  }
2092
2071
  this._editionFinish.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
2093
2072
  };
2073
+ FieldDescriptor.prototype.setAttr = function (name, value) {
2074
+ this[name] = value;
2075
+ if (this._formConfig.monitoredFieldAttributes.includes(name)) {
2076
+ this._attributeChange.next({ name: name, value: value });
2077
+ }
2078
+ };
2094
2079
  FieldDescriptor.prototype.notifyEditionDetailRequest = function () {
2095
2080
  this._detailRequest.next(this.fieldCode);
2096
2081
  };
2097
- FieldDescriptor.prototype.showLabel = function () { this.visibleLabel = true; };
2098
- FieldDescriptor.prototype.hideLabel = function () { this.visibleLabel = false; };
2099
- 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); };
2100
2088
  FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
2101
- FieldDescriptor.prototype.setLabel = function (label) { this.fieldTitle = label; };
2089
+ FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
2102
2090
  FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); };
2103
2091
  Object.defineProperty(FieldDescriptor.prototype, "backend", {
2104
2092
  get: function () { return this.validateOnServer; },
2105
2093
  enumerable: false,
2106
2094
  configurable: true
2107
2095
  });
2108
- FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.visibleLabel = visibleLabel; };
2109
2096
  FieldDescriptor.prototype.setEditable = function (editable) {
2110
2097
  if (editable === void 0) { editable = true; }
2111
2098
  (editable) ? this.enable() : this.disable();
2112
2099
  };
2100
+ FieldDescriptor.prototype.hasError = function () { return this.errorCode !== '00'; };
2113
2101
  FieldDescriptor.prototype.setError = function (code, message, type) {
2114
- if (type === void 0) { type = 'error'; }
2115
- this.errorType = (code === '00') ? '' : type;
2116
- this.errorCode = code;
2117
- 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 : '');
2118
2106
  };
2119
2107
  FieldDescriptor.prototype.getError = function () { return { type: this.errorType, code: this.errorCode, message: this.errorMessage }; };
2120
2108
  Object.defineProperty(FieldDescriptor.prototype, "error", {
2121
2109
  get: function () { return this.getError(); },
2122
- set: function (errorObj) { this.setError(errorObj.code, errorObj.message, errorObj.type); },
2110
+ set: function (errorObj) { var _a; this.setError(errorObj.code, errorObj.message, (_a = errorObj.type) !== null && _a !== void 0 ? _a : DEFAULT_ERROR_TYPE); },
2123
2111
  enumerable: false,
2124
2112
  configurable: true
2125
2113
  });
@@ -2132,7 +2120,7 @@
2132
2120
  if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
2133
2121
  return true;
2134
2122
  }
2135
- if ((this.fieldType === FIELD_TYPES.array || this.fieldType === FIELD_TYPES.phone)
2123
+ if ((this.fieldType === this._formConfig.fieldTypes.array || this.fieldType === this._formConfig.fieldTypes.phone)
2136
2124
  && Array.isArray(fieldCurrentValue) && fieldCurrentValue.length === 0) {
2137
2125
  return true;
2138
2126
  }
@@ -2142,10 +2130,10 @@
2142
2130
  FieldDescriptor.prototype.getValue = function () {
2143
2131
  var _a;
2144
2132
  switch (this.fieldType) {
2145
- case componentConstants.FIELDTYPE_CHECK:
2133
+ case this._formConfig.fieldTypes.check:
2146
2134
  return (_a = this._fieldValue) !== null && _a !== void 0 ? _a : false;
2147
2135
  break;
2148
- case componentConstants.FIELDTYPE_CURRENCY:
2136
+ case this._formConfig.fieldTypes.currency:
2149
2137
  return this._fieldValue.replace(',', '');
2150
2138
  break;
2151
2139
  default:
@@ -2155,68 +2143,39 @@
2155
2143
  };
2156
2144
  FieldDescriptor.prototype.updateFromServer = function (fld) {
2157
2145
  var _a;
2158
- if (FIELD_VISIBLE in fld) {
2159
- this.setVisibility(fld.visible);
2160
- }
2161
- if (FIELD_LABEL_VISIBLE in fld) {
2162
- this.setVisibleLabel(fld.visibleLabel);
2163
- }
2164
- if (FIELD_REQUIRED in fld) {
2165
- this.fieldRequired = (_a = fld.required) !== null && _a !== void 0 ? _a : false;
2166
- }
2167
- if (FIELD_ERR_CODE in fld) {
2168
- (this.errorCode = fld.errorCode);
2169
- }
2170
- if (FIELD_ERR_MSG in fld) {
2171
- (this.errorMessage = fld.errorMessage);
2172
- }
2173
- if (FIELD_TOOLTIP in fld) {
2174
- (this.tooltipText = fld.tooltip);
2175
- }
2176
- if (FIELD_INFO in fld) {
2177
- (this.fieldInfo = fld.info);
2178
- }
2179
- if (FIELD_EDITABLE in fld) {
2180
- this.setEditable(fld.editable);
2181
- }
2182
- if (FIELD_TITLE in fld) {
2183
- this.setLabel(fld.fieldTitle.toString());
2184
- }
2185
- if (FIELD_VALUE in fld) {
2186
- this.hasChanged = false;
2187
- this.setValue(fld.fieldValue);
2188
- }
2189
- if (FIELD_OPTIONS in fld) {
2190
- this.setFieldOptions(fld.fieldOptions);
2191
- }
2192
- if (FIELD_CAPTURE_TYPE in fld) {
2193
- this.captureType = fld.captureType || 'INPUT';
2194
- }
2195
- if (FIELD_TYPE in fld) {
2196
- this.setFieldType(fld.fieldTypeCode);
2197
- }
2198
- if (FIELD_MAX_LENGTH in fld) {
2199
- this.maxLength = fld.maxLength;
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);
2200
2164
  }
2201
2165
  };
2202
2166
  FieldDescriptor.prototype.setFieldType = function (inputFieldType) {
2203
- this.fieldType = inputFieldType;
2204
- /**
2205
- * Se elimina la validación de que sea un tipo conocido
2206
- * this.fieldType = (inputFieldType && FIELDTYPES.includes(inputFieldType))
2207
- * ? inputFieldType : componentConstants.FIELDTYPE_TEXT;
2208
- */
2167
+ this.setAttr(fldAttr.type, inputFieldType);
2209
2168
  };
2210
2169
  FieldDescriptor.prototype.format = function () {
2211
- if (this.fieldType === componentConstants.FIELDTYPE_CURRENCY) {
2212
- this._fieldValue = formatCurrency(this._fieldValue);
2170
+ if (this.fieldType === this._formConfig.fieldTypes.currency) {
2171
+ this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
2213
2172
  }
2214
2173
  };
2215
2174
  FieldDescriptor.prototype.setMinValue = function (minValue) {
2216
2175
  var _a, _b, _c;
2217
- if (this.fieldType === componentConstants.FIELDTYPE_DATE
2176
+ if (this.fieldType === this._formConfig.fieldTypes.date
2218
2177
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMinValue)) {
2219
- this._minValue = minValue;
2178
+ this.setAttr(fldAttr.minValue, minValue);
2220
2179
  if (!minValue) {
2221
2180
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMinValue(false);
2222
2181
  }
@@ -2228,9 +2187,9 @@
2228
2187
  };
2229
2188
  FieldDescriptor.prototype.setMaxValue = function (maxValue) {
2230
2189
  var _a, _b, _c;
2231
- if (this.fieldType === componentConstants.FIELDTYPE_DATE
2190
+ if (this.fieldType === this._formConfig.fieldTypes.date
2232
2191
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMaxValue)) {
2233
- this._maxValue = maxValue;
2192
+ this.setAttr(fldAttr.maxValue, maxValue);
2234
2193
  if (!maxValue) {
2235
2194
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMaxValue(false);
2236
2195
  }
@@ -2258,14 +2217,16 @@
2258
2217
  }
2259
2218
  return Object.assign({}, option);
2260
2219
  });
2261
- this.fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
2220
+ fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
2262
2221
  && fieldOptions.length > 0) ? fieldOptions : [];
2263
- if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && this.widget) {
2222
+ this.setAttr(fldAttr.options, fieldOptions);
2223
+ if (this.fieldType === this._formConfig.fieldTypes.array && this.widget) {
2264
2224
  return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
2265
2225
  }
2266
2226
  if (this._fieldValue) {
2267
- if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && Array.isArray(this._fieldValue)) {
2268
- 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);
2269
2230
  }
2270
2231
  else {
2271
2232
  var valInOptions = this.fieldOptions
@@ -2286,17 +2247,17 @@
2286
2247
  if (widgetUpdate === void 0) { widgetUpdate = true; }
2287
2248
  var _a;
2288
2249
  if (typeof newValue === UNDEFINED || newValue === null) {
2289
- return;
2250
+ return true;
2290
2251
  }
2291
2252
  var newFinalValue;
2292
2253
  switch (this.fieldType) {
2293
2254
  case 'BOOLEAN':
2294
2255
  newFinalValue = !!newValue;
2295
2256
  break;
2296
- case componentConstants.FIELDTYPE_CHECK:
2257
+ case this._formConfig.fieldTypes.check:
2297
2258
  newFinalValue = !!newValue;
2298
2259
  break;
2299
- case componentConstants.FIELDTYPE_ARRAY:
2260
+ case this._formConfig.fieldTypes.array:
2300
2261
  if (newValue === null || newValue === '') {
2301
2262
  newFinalValue = [];
2302
2263
  }
@@ -2310,7 +2271,7 @@
2310
2271
  newFinalValue = newValue;
2311
2272
  }
2312
2273
  break;
2313
- case componentConstants.FIELDTYPE_MAP:
2274
+ case this._formConfig.fieldTypes.map:
2314
2275
  newFinalValue = newValue;
2315
2276
  if (newFinalValue && this.widget && widgetUpdate) {
2316
2277
  var latitude = parseFloat(newFinalValue[0]);
@@ -2318,7 +2279,7 @@
2318
2279
  (_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
2319
2280
  }
2320
2281
  break;
2321
- case componentConstants.FIELDTYPE_CURRENCY:
2282
+ case this._formConfig.fieldTypes.currency:
2322
2283
  newFinalValue = formatCurrency(this._fieldValue);
2323
2284
  break;
2324
2285
  default:
@@ -2326,9 +2287,10 @@
2326
2287
  break;
2327
2288
  }
2328
2289
  if (this._fieldValue !== newFinalValue) {
2329
- this.hasChanged = true;
2330
- this._fieldValue = newFinalValue;
2290
+ this.setChanged(true);
2291
+ this.setAttr(fldAttr.value, newFinalValue);
2331
2292
  }
2293
+ return true;
2332
2294
  };
2333
2295
  return FieldDescriptor;
2334
2296
  }(FormElement));
@@ -2336,14 +2298,16 @@
2336
2298
  var HEADER = 'HEADER';
2337
2299
  var NO_ERROR = '00';
2338
2300
  var FormStructureAndData = /** @class */ (function () {
2339
- function FormStructureAndData(definitionReceived) {
2301
+ function FormStructureAndData(definitionReceived, formConfig) {
2340
2302
  var e_1, _d, e_2, _e, e_3, _f, e_4, _g;
2303
+ var _this = this;
2341
2304
  this._fieldsObj = {};
2342
2305
  this._actionsObj = {};
2343
2306
  this._tableObj = {};
2344
2307
  this._sectionsObj = {};
2345
2308
  this._immutableData = {};
2346
2309
  this._extraInfo = {};
2310
+ this._formConfig = formConfig;
2347
2311
  this.state = '';
2348
2312
  this._actions = [];
2349
2313
  this._fields = [];
@@ -2379,7 +2343,7 @@
2379
2343
  try {
2380
2344
  for (var formActions_1 = __values(formActions), formActions_1_1 = formActions_1.next(); !formActions_1_1.done; formActions_1_1 = formActions_1.next()) {
2381
2345
  var actionReceived = formActions_1_1.value;
2382
- var globalAction = new FormAction(actionReceived);
2346
+ var globalAction = new FormAction(actionReceived, this._formConfig);
2383
2347
  var globalActionCode = globalAction.actionCode;
2384
2348
  if (globalActionCode) {
2385
2349
  this._actions.push(globalAction);
@@ -2410,7 +2374,7 @@
2410
2374
  try {
2411
2375
  for (var formFields_1 = __values(formFields), formFields_1_1 = formFields_1.next(); !formFields_1_1.done; formFields_1_1 = formFields_1.next()) {
2412
2376
  var fieldReceived = formFields_1_1.value;
2413
- var fieldToAdd = new FieldDescriptor(fieldReceived);
2377
+ var fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
2414
2378
  var fieldCode = fieldToAdd.fieldCode;
2415
2379
  if (fieldCode) {
2416
2380
  this._fields.push(fieldToAdd);
@@ -2437,14 +2401,14 @@
2437
2401
  enabledStates = __spreadArray([], __read(visibleStates));
2438
2402
  }
2439
2403
  if (!visibleStates || visibleStates.length === 0) {
2440
- visibleStates = DEFAULT_STATE_FLOW.states;
2404
+ visibleStates = _this._formConfig.defaultStateFlow.states;
2441
2405
  }
2442
2406
  return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
2443
2407
  });
2444
2408
  try {
2445
2409
  for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
2446
2410
  var tableReceived = tables_1_1.value;
2447
- var tableToAdd = new RecordTable(tableReceived);
2411
+ var tableToAdd = new RecordTable(tableReceived, this._formConfig);
2448
2412
  var tableCode = tableToAdd.tableCode;
2449
2413
  if (tableCode) {
2450
2414
  this._tables.push(tableToAdd);
@@ -2554,7 +2518,7 @@
2554
2518
  FormStructureAndData.prototype.setStateFlow = function (states, transitions, defaultState) {
2555
2519
  var _this = this;
2556
2520
  if (!states || !transitions) {
2557
- this._stateFlow = JSON.parse(JSON.stringify(DEFAULT_STATE_FLOW));
2521
+ this._stateFlow = JSON.parse(JSON.stringify(this._formConfig.defaultStateFlow));
2558
2522
  return;
2559
2523
  }
2560
2524
  this._stateFlow.states = states;
@@ -2811,9 +2775,9 @@
2811
2775
  var fieldObject = this.getFieldObject(fieldCode);
2812
2776
  return (fieldObject) ? fieldObject.setValue(fieldValue) : null;
2813
2777
  };
2814
- FormStructureAndData.prototype.setFieldError = function (code, message, type) {
2778
+ FormStructureAndData.prototype.setFieldError = function (fieldCode, code, message, type) {
2815
2779
  if (type === void 0) { type = 'error'; }
2816
- var fieldObject = this.getFieldObject(code);
2780
+ var fieldObject = this.getFieldObject(fieldCode);
2817
2781
  return (fieldObject) ? fieldObject.setError(code, message, type) : null;
2818
2782
  };
2819
2783
  FormStructureAndData.prototype.setFieldIntrinsicErrorMessage = function (code, message) {
@@ -3233,7 +3197,6 @@
3233
3197
  this.transitionToken = null;
3234
3198
  this.inputDataFields = [];
3235
3199
  this.extraData = null;
3236
- this.componentConstants = componentConstants;
3237
3200
  this.definitionObtained = false;
3238
3201
  this.formVisible = false;
3239
3202
  this.inServerProcess = false;
@@ -3255,6 +3218,9 @@
3255
3218
  this.cleanStart();
3256
3219
  this.customPreProcessing();
3257
3220
  }
3221
+ BasicFormComponent.prototype.setConfig = function (formConfig) {
3222
+ this.formConfig = formConfig;
3223
+ };
3258
3224
  BasicFormComponent.prototype.cleanStart = function () {
3259
3225
  this._errorType = '';
3260
3226
  this.errorCode = '';
@@ -3597,7 +3563,7 @@
3597
3563
  case 1:
3598
3564
  formDefinition = _k.sent();
3599
3565
  this.inServerProcess = false;
3600
- this.formStructure = new FormStructureAndData(formDefinition);
3566
+ this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
3601
3567
  this.definitionObtained = true;
3602
3568
  return [3 /*break*/, 3];
3603
3569
  case 2:
@@ -3634,7 +3600,7 @@
3634
3600
  this.setFieldValue(fieldCode, fieldValue);
3635
3601
  }
3636
3602
  }
3637
- return [4 /*yield*/, this.requestFormAction(componentConstants.FORMACTION_GETDATA)];
3603
+ return [4 /*yield*/, this.requestFormAction(formActions.getData)];
3638
3604
  case 4:
3639
3605
  recordResponse = _k.sent();
3640
3606
  this.checkErrorRecordReceived(recordResponse);
@@ -3659,7 +3625,7 @@
3659
3625
  this.errorDetail = recordResponse.errorDetail;
3660
3626
  };
3661
3627
  BasicFormComponent.prototype.errorOccured = function () {
3662
- return (this.errorCode !== componentConstants.SERVICE_ERRORCODE_NOERROR);
3628
+ return (this.errorCode !== '00');
3663
3629
  };
3664
3630
  BasicFormComponent.prototype.changeState = function (state) { return this.formStructure.changeState(state); };
3665
3631
  BasicFormComponent.prototype.changeFormMode = function (state) { return this.changeState(state); };
@@ -4118,7 +4084,7 @@
4118
4084
  if (!fieldObj.backend) return [3 /*break*/, 2];
4119
4085
  fieldObj.validating = true;
4120
4086
  return [4 /*yield*/, this
4121
- .requestFormAction(componentConstants.FORMACTION_VALIDATE, fieldObj.fieldCode)];
4087
+ .requestFormAction(formActions.validate, fieldObj.fieldCode)];
4122
4088
  case 1:
4123
4089
  validationResult = _g.sent();
4124
4090
  finish = !this.errorOccured();
@@ -4363,7 +4329,7 @@
4363
4329
  actionCode: actionCode
4364
4330
  };
4365
4331
  return [4 /*yield*/, this
4366
- .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4332
+ .requestFormAction(formActions.tableAction, actionSubject)];
4367
4333
  case 1:
4368
4334
  actionResult = _g.sent();
4369
4335
  finish = !this.errorOccured();
@@ -4494,13 +4460,13 @@
4494
4460
  if (!action.backend) return [3 /*break*/, 2];
4495
4461
  actionSubject = {
4496
4462
  tableCode: tableCode,
4497
- actionType: componentConstants.FORMTABLEACTION_INLINE,
4463
+ actionType: this.formConfig.tableActions.inline,
4498
4464
  actionCode: actionCode,
4499
4465
  tableRecordId: recordId,
4500
4466
  tableRecordData: recordData
4501
4467
  };
4502
4468
  return [4 /*yield*/, this
4503
- .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4469
+ .requestFormAction(formActions.tableAction, actionSubject)];
4504
4470
  case 1:
4505
4471
  actionResult = _g.sent();
4506
4472
  finish = !this.errorOccured();
@@ -4624,13 +4590,13 @@
4624
4590
  if (!tableObject.selectionBackend) return [3 /*break*/, 2];
4625
4591
  actionSubject = {
4626
4592
  tableCode: tableCode,
4627
- actionType: componentConstants.FORMTABLEACTION_ROWSELECTION,
4593
+ actionType: this.formConfig.tableActions.rowSelection,
4628
4594
  actionCode: null,
4629
4595
  tableRecordId: recordId,
4630
4596
  tableRecordData: recordData
4631
4597
  };
4632
4598
  return [4 /*yield*/, this
4633
- .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4599
+ .requestFormAction(formActions.tableAction, actionSubject)];
4634
4600
  case 1:
4635
4601
  actionResult = _g.sent();
4636
4602
  finish = !this.errorOccured();
@@ -4755,12 +4721,12 @@
4755
4721
  if (!action.backend) return [3 /*break*/, 2];
4756
4722
  actionSubject = {
4757
4723
  tableCode: tableCode,
4758
- actionType: componentConstants.FORMTABLEACTION_SELECTION,
4724
+ actionType: this.formConfig.tableActions.selection,
4759
4725
  actionCode: actionCode,
4760
4726
  selectedRecords: selectedRecords
4761
4727
  };
4762
4728
  return [4 /*yield*/, this
4763
- .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4729
+ .requestFormAction(formActions.tableAction, actionSubject)];
4764
4730
  case 1:
4765
4731
  actionResult = _g.sent();
4766
4732
  finish = !this.errorOccured();
@@ -4869,7 +4835,7 @@
4869
4835
  tableObject.putOnWait();
4870
4836
  actionSubject = { tableCode: tableCode };
4871
4837
  return [4 /*yield*/, this
4872
- .requestFormAction(componentConstants.FORMACTION_GETTABLEDATA, actionSubject)];
4838
+ .requestFormAction(formActions.getTableData, actionSubject)];
4873
4839
  case 1:
4874
4840
  actionResult = _g.sent();
4875
4841
  if (this.errorOccured()) {
@@ -4929,15 +4895,15 @@
4929
4895
  this.resetError();
4930
4896
  var completeFields = this.checkSectionRequiredFields(sectionCode, reqFieldMessage);
4931
4897
  if (!completeFields) {
4932
- 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);
4933
4899
  return;
4934
4900
  }
4935
4901
  var validationError = false;
4936
4902
  var requiredEmptyFields = this.getRequiredEmptyFields(null, sectionCode);
4937
4903
  if (requiredEmptyFields.length > 0) {
4938
4904
  validationError = true;
4939
- this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_REQUIRED_FIELDS);
4940
- 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);
4941
4907
  try {
4942
4908
  for (var requiredEmptyFields_1 = __values(requiredEmptyFields), requiredEmptyFields_1_1 = requiredEmptyFields_1.next(); !requiredEmptyFields_1_1.done; requiredEmptyFields_1_1 = requiredEmptyFields_1.next()) {
4943
4909
  var fieldCode = requiredEmptyFields_1_1.value;
@@ -4960,7 +4926,7 @@
4960
4926
  var validationIssueFields = this.getFieldsWithValidationIssues(null, sectionCode);
4961
4927
  if (!validationError && validationIssueFields.length > 0) {
4962
4928
  validationError = true;
4963
- 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);
4964
4930
  try {
4965
4931
  for (var validationIssueFields_1 = __values(validationIssueFields), validationIssueFields_1_1 = validationIssueFields_1.next(); !validationIssueFields_1_1.done; validationIssueFields_1_1 = validationIssueFields_1.next()) {
4966
4932
  var fieldCode = validationIssueFields_1_1.value;
@@ -5122,13 +5088,13 @@
5122
5088
  var requiredEmptyFields = this.getRequiredEmptyFields(recordCaptureFields, null);
5123
5089
  if (requiredEmptyFields.length > 0) {
5124
5090
  validationOk = false;
5125
- this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_REQUIRED_FIELDS);
5126
- 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);
5127
5093
  }
5128
5094
  var validationIssueFields = this.getFieldsWithValidationIssues(recordCaptureFields, null);
5129
5095
  if (validationIssueFields.length > 0) {
5130
5096
  validationOk = false;
5131
- 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);
5132
5098
  }
5133
5099
  return validationOk;
5134
5100
  };