tuain-ng-forms-lib 0.12.34 → 0.12.35

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 +318 -287
  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 +6 -7
  5. package/esm2015/lib/classes/forms/field.js +166 -146
  6. package/esm2015/lib/classes/forms/form.constants.js +82 -11
  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 +4 -6
  11. package/esm2015/lib/classes/forms/table/table.js +13 -15
  12. package/esm2015/lib/components/elements/action.component.js +1 -3
  13. package/esm2015/lib/components/elements/field.component.js +7 -45
  14. package/esm2015/lib/components/elements/layout/element.component.js +6 -3
  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 +22 -24
  18. package/fesm2015/tuain-ng-forms-lib.js +323 -282
  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 +2 -3
  22. package/lib/classes/forms/field.d.ts +14 -20
  23. package/lib/classes/forms/form.constants.d.ts +74 -10
  24. package/lib/classes/forms/form.d.ts +1 -2
  25. package/lib/classes/forms/table/column.d.ts +1 -2
  26. package/lib/classes/forms/table/table.d.ts +1 -1
  27. package/lib/components/elements/action.component.d.ts +0 -1
  28. package/lib/components/elements/field.component.d.ts +2 -17
  29. package/lib/components/elements/layout/element.component.d.ts +2 -1
  30. package/lib/components/elements/layout/form-error.component.d.ts +1 -0
  31. package/lib/components/elements/tables/table.component.d.ts +0 -1
  32. package/lib/components/forms/basic-form.d.ts +1 -2
  33. package/package.json +1 -1
  34. package/tuain-ng-forms-lib.metadata.json +1 -1
@@ -10,8 +10,6 @@
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;
15
13
  this.start();
16
14
  };
17
15
  ActionComponent.prototype.start = function () { };
@@ -54,55 +52,106 @@
54
52
  showLabel: [{ type: core.Input }]
55
53
  };
56
54
 
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',
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',
70
95
  };
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
+
71
149
  var FieldComponent = /** @class */ (function () {
72
150
  function FieldComponent() {
151
+ this.componentConstants = Object.assign({}, componentConstants);
73
152
  }
74
153
  FieldComponent.prototype.ngOnInit = function () {
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
- }
154
+ this.fieldObject.widget = this;
106
155
  this.start();
107
156
  };
108
157
  FieldComponent.prototype.start = function () { };
@@ -131,6 +180,7 @@
131
180
  template: "<ng-content></ng-content>"
132
181
  },] }
133
182
  ];
183
+ FieldComponent.ctorParameters = function () { return []; };
134
184
  FieldComponent.propDecorators = {
135
185
  fieldObject: [{ type: core.Input }],
136
186
  disabled: [{ type: core.Input }]
@@ -138,10 +188,9 @@
138
188
 
139
189
  var ElementComponent = /** @class */ (function () {
140
190
  function ElementComponent() {
191
+ this.componentConstants = Object.assign({}, componentConstants);
141
192
  }
142
193
  ElementComponent.prototype.ngOnInit = function () {
143
- var _a;
144
- this.formConfig = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a._formConfig;
145
194
  this.start();
146
195
  };
147
196
  ElementComponent.prototype.start = function () { };
@@ -171,6 +220,7 @@
171
220
  template: "<ng-content></ng-content>"
172
221
  },] }
173
222
  ];
223
+ ElementComponent.ctorParameters = function () { return []; };
174
224
  ElementComponent.propDecorators = {
175
225
  formElement: [{ type: core.Input }],
176
226
  formManager: [{ type: core.Input }]
@@ -596,33 +646,9 @@
596
646
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
597
647
  }
598
648
 
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
-
622
649
  var FormElement = /** @class */ (function () {
623
- function FormElement(elementDefinition, formConfig) {
650
+ function FormElement(elementDefinition) {
624
651
  var _a, _b;
625
- this._formConfig = formConfig;
626
652
  this._isForced = false;
627
653
  this.setVisibleStates(elementDefinition.visibleStates);
628
654
  this.setEnabledStates(elementDefinition.enabledStates);
@@ -631,9 +657,9 @@
631
657
  this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
632
658
  this.widget = null;
633
659
  }
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; };
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; };
637
663
  FormElement.prototype.setVisibleStates = function (newStates) {
638
664
  var visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
639
665
  ? newStates.split(',').map(function (state) { return state.trim(); }).filter(function (state) { return state.length > 0; })
@@ -693,14 +719,13 @@
693
719
  }());
694
720
 
695
721
  var RecordTableColumn = /** @class */ (function () {
696
- function RecordTableColumn(recTableColReceived, formConfig) {
722
+ function RecordTableColumn(recTableColReceived) {
697
723
  var _a, _b, _c;
698
- this._formConfig = formConfig;
699
724
  if (recTableColReceived) {
700
725
  this.fieldCode = recTableColReceived.fieldCode;
701
726
  this.fieldTitle = recTableColReceived.fieldTitle;
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';
727
+ this.fieldType = recTableColReceived.fieldTypeCode || componentConstants.FIELDTYPE_TEXT;
728
+ var defaultTypeAlignment = (tableFieldStyles[this.fieldType] != null) ? tableFieldStyles[this.fieldType]['text-align'] : 'left';
704
729
  this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
705
730
  this.visible = (_a = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.visible) !== null && _a !== void 0 ? _a : true;
706
731
  this.sortable = (_b = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.sortable) !== null && _b !== void 0 ? _b : false;
@@ -789,8 +814,6 @@
789
814
  return outputValue;
790
815
  }
791
816
 
792
- var DATE_TYPE = 'DATE';
793
- var CURRENCY_TYPE = 'CURRENCY';
794
817
  var TableRecordData = /** @class */ (function () {
795
818
  function TableRecordData(recordReceived, recordDefinition, selectionFieldName) {
796
819
  var _this = this;
@@ -827,10 +850,10 @@
827
850
  }
828
851
  }
829
852
  TableRecordData.prototype.formatFieldValue = function (fieldType, fieldValue) {
830
- if (fieldType === CURRENCY_TYPE) {
853
+ if (fieldType === componentConstants.FIELDTYPE_CURRENCY) {
831
854
  return formatCurrency(fieldValue);
832
855
  }
833
- else if (fieldType === DATE_TYPE && fieldValue) {
856
+ else if (fieldType === componentConstants.FIELDTYPE_DATE && fieldValue) {
834
857
  return new Date(fieldValue).toISOString().split('T')[0];
835
858
  }
836
859
  return fieldValue || '';
@@ -941,8 +964,6 @@
941
964
  return TableRecordData;
942
965
  }());
943
966
 
944
- var TABLE_SORT_ASCENDING = 'asc';
945
- var TABLE_SORT_DESCENDING = 'desc';
946
967
  var TABLE_FILTER_TYPES = {
947
968
  simpleFilterChange: 'SIMPLE_CHANGE',
948
969
  simpleFilterFinish: 'SIMPLE_FINISH',
@@ -951,11 +972,11 @@
951
972
  };
952
973
  var RecordTable = /** @class */ (function (_super) {
953
974
  __extends(RecordTable, _super);
954
- function RecordTable(tableReceived, formConfig) {
975
+ function RecordTable(tableReceived) {
955
976
  var e_1, _h, e_2, _j, e_3, _k;
956
977
  var _this = this;
957
978
  var _a, _b, _c, _d, _e, _f, _g;
958
- _this = _super.call(this, tableReceived, formConfig) || this;
979
+ _this = _super.call(this, tableReceived) || this;
959
980
  _this._inlineActionTrigger = new rxjs.Subject();
960
981
  _this._globalActionTrigger = new rxjs.Subject();
961
982
  _this._recordSelectionTrigger = new rxjs.Subject();
@@ -965,7 +986,7 @@
965
986
  _this._tableColumnObj = {};
966
987
  _this._actionsObj = {};
967
988
  _this.allSelected = false;
968
- _this.elementType = elementTypes.table;
989
+ _this.type = componentConstants.ELEMENTTYPE_TABLE;
969
990
  _this.waiting = false;
970
991
  _this.complexFilter = false;
971
992
  _this.currentPage = 1;
@@ -988,12 +1009,12 @@
988
1009
  _this.customAttributes = (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.customAttributes) !== null && _f !== void 0 ? _f : {};
989
1010
  _this.sortable = (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false;
990
1011
  _this.sorting = { columnName: '', direction: '' };
991
- _this.recordsPerPage = formConfig.defaultRecordsPerPage;
1012
+ _this.recordsPerPage = componentConstants.recordsPerPage;
992
1013
  if (tableReceived.fields) {
993
1014
  try {
994
1015
  for (var _l = __values(tableReceived.fields), _m = _l.next(); !_m.done; _m = _l.next()) {
995
1016
  var columnReceived = _m.value;
996
- var columnDefinition = new RecordTableColumn(columnReceived, _this._formConfig);
1017
+ var columnDefinition = new RecordTableColumn(columnReceived);
997
1018
  _this.columns.push(columnDefinition);
998
1019
  _this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
999
1020
  }
@@ -1253,7 +1274,7 @@
1253
1274
  ? this._actionsObj[actionCode] : null;
1254
1275
  };
1255
1276
  RecordTable.prototype.getActions = function (actionClass, actionTypes) {
1256
- if (actionClass === void 0) { actionClass = this._formConfig.tableActions.inline; }
1277
+ if (actionClass === void 0) { actionClass = componentConstants.FORMTABLEACTION_INLINE; }
1257
1278
  if (actionTypes === void 0) { actionTypes = null; }
1258
1279
  return this._actions.filter(function (actionDef) {
1259
1280
  var typeIncluded = (actionTypes) ? actionTypes.includes(actionDef.actionType) : true;
@@ -1328,14 +1349,14 @@
1328
1349
  RecordTable.prototype.setRequiredOrder = function (columnField) {
1329
1350
  if (columnField !== this.sorting.columnName) {
1330
1351
  this.sorting.columnName = columnField;
1331
- this.sorting.direction = TABLE_SORT_ASCENDING;
1352
+ this.sorting.direction = componentConstants.TABLE_SORT_ASCENDING;
1332
1353
  }
1333
1354
  else {
1334
- if (this.sorting.direction === TABLE_SORT_ASCENDING) {
1335
- this.sorting.direction = TABLE_SORT_DESCENDING;
1355
+ if (this.sorting.direction === componentConstants.TABLE_SORT_ASCENDING) {
1356
+ this.sorting.direction = componentConstants.TABLE_SORT_DESCENDING;
1336
1357
  }
1337
1358
  else {
1338
- this.sorting.direction = TABLE_SORT_ASCENDING;
1359
+ this.sorting.direction = componentConstants.TABLE_SORT_ASCENDING;
1339
1360
  }
1340
1361
  }
1341
1362
  };
@@ -1357,7 +1378,7 @@
1357
1378
  else if (recordAColumn > recordBColumn) {
1358
1379
  result = 1;
1359
1380
  }
1360
- return direction === TABLE_SORT_ASCENDING ? result : -result;
1381
+ return direction === componentConstants.TABLE_SORT_ASCENDING ? result : -result;
1361
1382
  };
1362
1383
  return RecordTable;
1363
1384
  }(FormElement));
@@ -1520,15 +1541,13 @@
1520
1541
  this.hasActions = false;
1521
1542
  }
1522
1543
  LibTableComponent.prototype.ngOnInit = function () {
1523
- var _a;
1524
- this.formConfig = (_a = this.tableObject) === null || _a === void 0 ? void 0 : _a._formConfig;
1525
- this.tableFieldStyles = this.formConfig.tableFieldStyles;
1544
+ this.tableFieldStyles = tableFieldStyles;
1526
1545
  this.selectable = this.tableObject.selectable;
1527
1546
  this.hasActions = this.tableObject.hasActions;
1528
1547
  this.tableObject.widget = this;
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);
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);
1532
1551
  this.start();
1533
1552
  };
1534
1553
  LibTableComponent.prototype.start = function () { };
@@ -1646,21 +1665,21 @@
1646
1665
  var arrayToAdd = null;
1647
1666
  var type = receivedElement.type, code = receivedElement.code;
1648
1667
  switch (type) {
1649
- case elementTypes.field:
1668
+ case componentConstants.ELEMENTTYPE_FIELD:
1650
1669
  elementObject = formObject.getFieldObject(code);
1651
1670
  arrayToAdd = this.subSectionFields;
1652
1671
  break;
1653
- case elementTypes.table:
1672
+ case componentConstants.ELEMENTTYPE_TABLE:
1654
1673
  elementObject = formObject.getTableObject(code);
1655
1674
  arrayToAdd = this.subSectionTables;
1656
1675
  break;
1657
- case elementTypes.action:
1676
+ case componentConstants.ELEMENTTYPE_ACTION:
1658
1677
  elementObject = formObject.getActionObject(code);
1659
1678
  arrayToAdd = this.subSectionActions;
1660
1679
  break;
1661
1680
  }
1662
1681
  if (elementObject) {
1663
- elementObject.elementType = type;
1682
+ elementObject.type = type;
1664
1683
  arrayToAdd.push(elementObject);
1665
1684
  this.subSectionElements.push(elementObject);
1666
1685
  this.elementsArray[code] = elementObject;
@@ -1864,13 +1883,13 @@
1864
1883
  var HEADER$1 = 'HEADER';
1865
1884
  var FormAction = /** @class */ (function (_super) {
1866
1885
  __extends(FormAction, _super);
1867
- function FormAction(actionDefinition, formConfig) {
1886
+ function FormAction(actionDefinition) {
1868
1887
  var _this = this;
1869
1888
  var _a, _b;
1870
- _this = _super.call(this, actionDefinition, formConfig) || this;
1889
+ _this = _super.call(this, actionDefinition) || this;
1871
1890
  _this._actionActivated = new rxjs.Subject();
1872
1891
  _this.inProgress = false;
1873
- _this.elementType = elementTypes.action;
1892
+ _this.type = componentConstants.ELEMENTTYPE_ACTION;
1874
1893
  _this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
1875
1894
  _this.actionName = actionDefinition.actionTitle;
1876
1895
  _this.iconName = actionDefinition.iconName || _this.actionCode;
@@ -1904,85 +1923,87 @@
1904
1923
  }(FormElement));
1905
1924
 
1906
1925
  var UNDEFINED = 'undefined';
1907
- var DEFAULT_ERROR_TYPE = 'error';
1908
- var DEFAULT_CAPTURE_TYPE = 'INPUT';
1909
- var DEFAULT_ALIGNMENT = 'left';
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
+ };
1910
1968
  var STD_MAX_LENGTH = 50;
1911
1969
  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
- };
1941
1970
  var FieldDescriptor = /** @class */ (function (_super) {
1942
1971
  __extends(FieldDescriptor, _super);
1943
- function FieldDescriptor(inputFieldReceived, formConfig) {
1972
+ function FieldDescriptor(inputFieldReceived) {
1944
1973
  var _this = this;
1945
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1946
- _this = _super.call(this, inputFieldReceived, formConfig) || this;
1974
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1975
+ _this = _super.call(this, inputFieldReceived) || this;
1947
1976
  _this._editionFinish = new rxjs.Subject();
1948
1977
  _this._editionPartial = new rxjs.Subject();
1949
1978
  _this._detailRequest = new rxjs.Subject();
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 || '');
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";
1986
2007
  return _this;
1987
2008
  }
1988
2009
  Object.defineProperty(FieldDescriptor.prototype, "name", {
@@ -1995,11 +2016,6 @@
1995
2016
  enumerable: false,
1996
2017
  configurable: true
1997
2018
  });
1998
- Object.defineProperty(FieldDescriptor.prototype, "attributeChange", {
1999
- get: function () { return this._attributeChange; },
2000
- enumerable: false,
2001
- configurable: true
2002
- });
2003
2019
  Object.defineProperty(FieldDescriptor.prototype, "editionPartial", {
2004
2020
  get: function () { return this._editionPartial; },
2005
2021
  enumerable: false,
@@ -2012,11 +2028,11 @@
2012
2028
  });
2013
2029
  Object.defineProperty(FieldDescriptor.prototype, "validating", {
2014
2030
  get: function () { return this._onValidation; },
2015
- set: function (isValidating) { this.setAttr(fldAttr.onValidation, isValidating); },
2031
+ set: function (isValidating) { this._onValidation = isValidating; },
2016
2032
  enumerable: false,
2017
2033
  configurable: true
2018
2034
  });
2019
- FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this.setAttr(fldAttr.intrinsicErrorMessage, message); };
2035
+ FieldDescriptor.prototype.setIntrinsicErrorMessage = function (message) { this._intrinsicErrorMessage = message; };
2020
2036
  Object.defineProperty(FieldDescriptor.prototype, "intrinsicErrorMessage", {
2021
2037
  set: function (message) { this.setIntrinsicErrorMessage(message); },
2022
2038
  enumerable: false,
@@ -2029,7 +2045,7 @@
2029
2045
  });
2030
2046
  Object.defineProperty(FieldDescriptor.prototype, "required", {
2031
2047
  get: function () { return this.fieldRequired; },
2032
- set: function (required) { this.setAttr(fldAttr.required, required !== null && required !== void 0 ? required : false); },
2048
+ set: function (required) { this.fieldRequired = required !== null && required !== void 0 ? required : false; },
2033
2049
  enumerable: false,
2034
2050
  configurable: true
2035
2051
  });
@@ -2037,10 +2053,10 @@
2037
2053
  get: function () { return (this._maxLength > 0) ? this._maxLength.toString() : ''; },
2038
2054
  set: function (requiredMaxLength) {
2039
2055
  if (typeof requiredMaxLength === 'string') {
2040
- this.setAttr(fldAttr.maxLength, parseInt(requiredMaxLength, 10));
2056
+ this._maxLength = parseInt(requiredMaxLength, 10);
2041
2057
  }
2042
2058
  else if (typeof requiredMaxLength === 'number') {
2043
- this.setAttr(fldAttr.maxLength, requiredMaxLength);
2059
+ this._maxLength = requiredMaxLength;
2044
2060
  }
2045
2061
  },
2046
2062
  enumerable: false,
@@ -2057,57 +2073,50 @@
2057
2073
  this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
2058
2074
  };
2059
2075
  FieldDescriptor.prototype.notifyEditionFinish = function () {
2060
- var _a, _b, _c, _d, _e;
2076
+ var _a, _b;
2061
2077
  var intrinsicValidation = true;
2062
- var fieldDefaultFormat = (_b = (_a = this._formConfig.fieldTypesPatterns) === null || _a === void 0 ? void 0 : _a[this.fieldType]) !== null && _b !== void 0 ? _b : null;
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;
2063
2081
  var fieldValue = this.getValue();
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);
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);
2067
2085
  if (!intrinsicValidation) {
2068
2086
  this.setError('99', this._intrinsicErrorMessage);
2069
2087
  }
2070
2088
  }
2071
2089
  this._editionFinish.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
2072
2090
  };
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
- };
2079
2091
  FieldDescriptor.prototype.notifyEditionDetailRequest = function () {
2080
2092
  this._detailRequest.next(this.fieldCode);
2081
2093
  };
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); };
2094
+ FieldDescriptor.prototype.showLabel = function () { this.visibleLabel = true; };
2095
+ FieldDescriptor.prototype.hideLabel = function () { this.visibleLabel = false; };
2096
+ FieldDescriptor.prototype.changed = function () { this.hasChanged = true; };
2088
2097
  FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
2089
- FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
2098
+ FieldDescriptor.prototype.setLabel = function (label) { this.fieldTitle = label; };
2090
2099
  FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); };
2091
2100
  Object.defineProperty(FieldDescriptor.prototype, "backend", {
2092
2101
  get: function () { return this.validateOnServer; },
2093
2102
  enumerable: false,
2094
2103
  configurable: true
2095
2104
  });
2105
+ FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.visibleLabel = visibleLabel; };
2096
2106
  FieldDescriptor.prototype.setEditable = function (editable) {
2097
2107
  if (editable === void 0) { editable = true; }
2098
2108
  (editable) ? this.enable() : this.disable();
2099
2109
  };
2100
- FieldDescriptor.prototype.hasError = function () { return this.errorCode !== '00'; };
2101
2110
  FieldDescriptor.prototype.setError = function (code, message, type) {
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 : '');
2111
+ if (type === void 0) { type = 'error'; }
2112
+ this.errorType = (code === '00') ? '' : type;
2113
+ this.errorCode = code;
2114
+ this.errorMessage = message;
2106
2115
  };
2107
2116
  FieldDescriptor.prototype.getError = function () { return { type: this.errorType, code: this.errorCode, message: this.errorMessage }; };
2108
2117
  Object.defineProperty(FieldDescriptor.prototype, "error", {
2109
2118
  get: function () { return this.getError(); },
2110
- set: function (errorObj) { var _a; this.setError(errorObj.code, errorObj.message, (_a = errorObj.type) !== null && _a !== void 0 ? _a : DEFAULT_ERROR_TYPE); },
2119
+ set: function (errorObj) { this.setError(errorObj.code, errorObj.message, errorObj.type); },
2111
2120
  enumerable: false,
2112
2121
  configurable: true
2113
2122
  });
@@ -2120,7 +2129,7 @@
2120
2129
  if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
2121
2130
  return true;
2122
2131
  }
2123
- if ((this.fieldType === this._formConfig.fieldTypes.array || this.fieldType === this._formConfig.fieldTypes.phone)
2132
+ if ((this.fieldType === FIELD_TYPES.array || this.fieldType === FIELD_TYPES.phone)
2124
2133
  && Array.isArray(fieldCurrentValue) && fieldCurrentValue.length === 0) {
2125
2134
  return true;
2126
2135
  }
@@ -2130,10 +2139,10 @@
2130
2139
  FieldDescriptor.prototype.getValue = function () {
2131
2140
  var _a;
2132
2141
  switch (this.fieldType) {
2133
- case this._formConfig.fieldTypes.check:
2142
+ case componentConstants.FIELDTYPE_CHECK:
2134
2143
  return (_a = this._fieldValue) !== null && _a !== void 0 ? _a : false;
2135
2144
  break;
2136
- case this._formConfig.fieldTypes.currency:
2145
+ case componentConstants.FIELDTYPE_CURRENCY:
2137
2146
  return this._fieldValue.replace(',', '');
2138
2147
  break;
2139
2148
  default:
@@ -2143,39 +2152,68 @@
2143
2152
  };
2144
2153
  FieldDescriptor.prototype.updateFromServer = function (fld) {
2145
2154
  var _a;
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);
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;
2164
2197
  }
2165
2198
  };
2166
2199
  FieldDescriptor.prototype.setFieldType = function (inputFieldType) {
2167
- this.setAttr(fldAttr.type, 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
+ */
2168
2206
  };
2169
2207
  FieldDescriptor.prototype.format = function () {
2170
- if (this.fieldType === this._formConfig.fieldTypes.currency) {
2171
- this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
2208
+ if (this.fieldType === componentConstants.FIELDTYPE_CURRENCY) {
2209
+ this._fieldValue = formatCurrency(this._fieldValue);
2172
2210
  }
2173
2211
  };
2174
2212
  FieldDescriptor.prototype.setMinValue = function (minValue) {
2175
2213
  var _a, _b, _c;
2176
- if (this.fieldType === this._formConfig.fieldTypes.date
2214
+ if (this.fieldType === componentConstants.FIELDTYPE_DATE
2177
2215
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMinValue)) {
2178
- this.setAttr(fldAttr.minValue, minValue);
2216
+ this._minValue = minValue;
2179
2217
  if (!minValue) {
2180
2218
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMinValue(false);
2181
2219
  }
@@ -2187,9 +2225,9 @@
2187
2225
  };
2188
2226
  FieldDescriptor.prototype.setMaxValue = function (maxValue) {
2189
2227
  var _a, _b, _c;
2190
- if (this.fieldType === this._formConfig.fieldTypes.date
2228
+ if (this.fieldType === componentConstants.FIELDTYPE_DATE
2191
2229
  && ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMaxValue)) {
2192
- this.setAttr(fldAttr.maxValue, maxValue);
2230
+ this._maxValue = maxValue;
2193
2231
  if (!maxValue) {
2194
2232
  (_b = this.widget) === null || _b === void 0 ? void 0 : _b.setMaxValue(false);
2195
2233
  }
@@ -2217,16 +2255,14 @@
2217
2255
  }
2218
2256
  return Object.assign({}, option);
2219
2257
  });
2220
- fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
2258
+ this.fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
2221
2259
  && fieldOptions.length > 0) ? fieldOptions : [];
2222
- this.setAttr(fldAttr.options, fieldOptions);
2223
- if (this.fieldType === this._formConfig.fieldTypes.array && this.widget) {
2260
+ if (this.fieldType === componentConstants.FIELDTYPE_ARRAY && this.widget) {
2224
2261
  return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
2225
2262
  }
2226
2263
  if (this._fieldValue) {
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);
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; }); });
2230
2266
  }
2231
2267
  else {
2232
2268
  var valInOptions = this.fieldOptions
@@ -2247,17 +2283,17 @@
2247
2283
  if (widgetUpdate === void 0) { widgetUpdate = true; }
2248
2284
  var _a;
2249
2285
  if (typeof newValue === UNDEFINED || newValue === null) {
2250
- return true;
2286
+ return;
2251
2287
  }
2252
2288
  var newFinalValue;
2253
2289
  switch (this.fieldType) {
2254
2290
  case 'BOOLEAN':
2255
2291
  newFinalValue = !!newValue;
2256
2292
  break;
2257
- case this._formConfig.fieldTypes.check:
2293
+ case componentConstants.FIELDTYPE_CHECK:
2258
2294
  newFinalValue = !!newValue;
2259
2295
  break;
2260
- case this._formConfig.fieldTypes.array:
2296
+ case componentConstants.FIELDTYPE_ARRAY:
2261
2297
  if (newValue === null || newValue === '') {
2262
2298
  newFinalValue = [];
2263
2299
  }
@@ -2271,7 +2307,7 @@
2271
2307
  newFinalValue = newValue;
2272
2308
  }
2273
2309
  break;
2274
- case this._formConfig.fieldTypes.map:
2310
+ case componentConstants.FIELDTYPE_MAP:
2275
2311
  newFinalValue = newValue;
2276
2312
  if (newFinalValue && this.widget && widgetUpdate) {
2277
2313
  var latitude = parseFloat(newFinalValue[0]);
@@ -2279,7 +2315,7 @@
2279
2315
  (_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
2280
2316
  }
2281
2317
  break;
2282
- case this._formConfig.fieldTypes.currency:
2318
+ case componentConstants.FIELDTYPE_CURRENCY:
2283
2319
  newFinalValue = formatCurrency(this._fieldValue);
2284
2320
  break;
2285
2321
  default:
@@ -2287,10 +2323,9 @@
2287
2323
  break;
2288
2324
  }
2289
2325
  if (this._fieldValue !== newFinalValue) {
2290
- this.setChanged(true);
2291
- this.setAttr(fldAttr.value, newFinalValue);
2326
+ this.hasChanged = true;
2327
+ this._fieldValue = newFinalValue;
2292
2328
  }
2293
- return true;
2294
2329
  };
2295
2330
  return FieldDescriptor;
2296
2331
  }(FormElement));
@@ -2298,16 +2333,14 @@
2298
2333
  var HEADER = 'HEADER';
2299
2334
  var NO_ERROR = '00';
2300
2335
  var FormStructureAndData = /** @class */ (function () {
2301
- function FormStructureAndData(definitionReceived, formConfig) {
2336
+ function FormStructureAndData(definitionReceived) {
2302
2337
  var e_1, _d, e_2, _e, e_3, _f, e_4, _g;
2303
- var _this = this;
2304
2338
  this._fieldsObj = {};
2305
2339
  this._actionsObj = {};
2306
2340
  this._tableObj = {};
2307
2341
  this._sectionsObj = {};
2308
2342
  this._immutableData = {};
2309
2343
  this._extraInfo = {};
2310
- this._formConfig = formConfig;
2311
2344
  this.state = '';
2312
2345
  this._actions = [];
2313
2346
  this._fields = [];
@@ -2343,7 +2376,7 @@
2343
2376
  try {
2344
2377
  for (var formActions_1 = __values(formActions), formActions_1_1 = formActions_1.next(); !formActions_1_1.done; formActions_1_1 = formActions_1.next()) {
2345
2378
  var actionReceived = formActions_1_1.value;
2346
- var globalAction = new FormAction(actionReceived, this._formConfig);
2379
+ var globalAction = new FormAction(actionReceived);
2347
2380
  var globalActionCode = globalAction.actionCode;
2348
2381
  if (globalActionCode) {
2349
2382
  this._actions.push(globalAction);
@@ -2374,7 +2407,7 @@
2374
2407
  try {
2375
2408
  for (var formFields_1 = __values(formFields), formFields_1_1 = formFields_1.next(); !formFields_1_1.done; formFields_1_1 = formFields_1.next()) {
2376
2409
  var fieldReceived = formFields_1_1.value;
2377
- var fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
2410
+ var fieldToAdd = new FieldDescriptor(fieldReceived);
2378
2411
  var fieldCode = fieldToAdd.fieldCode;
2379
2412
  if (fieldCode) {
2380
2413
  this._fields.push(fieldToAdd);
@@ -2401,14 +2434,14 @@
2401
2434
  enabledStates = __spreadArray([], __read(visibleStates));
2402
2435
  }
2403
2436
  if (!visibleStates || visibleStates.length === 0) {
2404
- visibleStates = _this._formConfig.defaultStateFlow.states;
2437
+ visibleStates = DEFAULT_STATE_FLOW.states;
2405
2438
  }
2406
2439
  return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
2407
2440
  });
2408
2441
  try {
2409
2442
  for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
2410
2443
  var tableReceived = tables_1_1.value;
2411
- var tableToAdd = new RecordTable(tableReceived, this._formConfig);
2444
+ var tableToAdd = new RecordTable(tableReceived);
2412
2445
  var tableCode = tableToAdd.tableCode;
2413
2446
  if (tableCode) {
2414
2447
  this._tables.push(tableToAdd);
@@ -2518,7 +2551,7 @@
2518
2551
  FormStructureAndData.prototype.setStateFlow = function (states, transitions, defaultState) {
2519
2552
  var _this = this;
2520
2553
  if (!states || !transitions) {
2521
- this._stateFlow = JSON.parse(JSON.stringify(this._formConfig.defaultStateFlow));
2554
+ this._stateFlow = JSON.parse(JSON.stringify(DEFAULT_STATE_FLOW));
2522
2555
  return;
2523
2556
  }
2524
2557
  this._stateFlow.states = states;
@@ -3197,6 +3230,7 @@
3197
3230
  this.transitionToken = null;
3198
3231
  this.inputDataFields = [];
3199
3232
  this.extraData = null;
3233
+ this.componentConstants = componentConstants;
3200
3234
  this.definitionObtained = false;
3201
3235
  this.formVisible = false;
3202
3236
  this.inServerProcess = false;
@@ -3218,9 +3252,6 @@
3218
3252
  this.cleanStart();
3219
3253
  this.customPreProcessing();
3220
3254
  }
3221
- BasicFormComponent.prototype.setConfig = function (formConfig) {
3222
- this.formConfig = formConfig;
3223
- };
3224
3255
  BasicFormComponent.prototype.cleanStart = function () {
3225
3256
  this._errorType = '';
3226
3257
  this.errorCode = '';
@@ -3563,7 +3594,7 @@
3563
3594
  case 1:
3564
3595
  formDefinition = _k.sent();
3565
3596
  this.inServerProcess = false;
3566
- this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
3597
+ this.formStructure = new FormStructureAndData(formDefinition);
3567
3598
  this.definitionObtained = true;
3568
3599
  return [3 /*break*/, 3];
3569
3600
  case 2:
@@ -3600,7 +3631,7 @@
3600
3631
  this.setFieldValue(fieldCode, fieldValue);
3601
3632
  }
3602
3633
  }
3603
- return [4 /*yield*/, this.requestFormAction(formActions.getData)];
3634
+ return [4 /*yield*/, this.requestFormAction(componentConstants.FORMACTION_GETDATA)];
3604
3635
  case 4:
3605
3636
  recordResponse = _k.sent();
3606
3637
  this.checkErrorRecordReceived(recordResponse);
@@ -3625,7 +3656,7 @@
3625
3656
  this.errorDetail = recordResponse.errorDetail;
3626
3657
  };
3627
3658
  BasicFormComponent.prototype.errorOccured = function () {
3628
- return (this.errorCode !== '00');
3659
+ return (this.errorCode !== componentConstants.SERVICE_ERRORCODE_NOERROR);
3629
3660
  };
3630
3661
  BasicFormComponent.prototype.changeState = function (state) { return this.formStructure.changeState(state); };
3631
3662
  BasicFormComponent.prototype.changeFormMode = function (state) { return this.changeState(state); };
@@ -4084,7 +4115,7 @@
4084
4115
  if (!fieldObj.backend) return [3 /*break*/, 2];
4085
4116
  fieldObj.validating = true;
4086
4117
  return [4 /*yield*/, this
4087
- .requestFormAction(formActions.validate, fieldObj.fieldCode)];
4118
+ .requestFormAction(componentConstants.FORMACTION_VALIDATE, fieldObj.fieldCode)];
4088
4119
  case 1:
4089
4120
  validationResult = _g.sent();
4090
4121
  finish = !this.errorOccured();
@@ -4329,7 +4360,7 @@
4329
4360
  actionCode: actionCode
4330
4361
  };
4331
4362
  return [4 /*yield*/, this
4332
- .requestFormAction(formActions.tableAction, actionSubject)];
4363
+ .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4333
4364
  case 1:
4334
4365
  actionResult = _g.sent();
4335
4366
  finish = !this.errorOccured();
@@ -4460,13 +4491,13 @@
4460
4491
  if (!action.backend) return [3 /*break*/, 2];
4461
4492
  actionSubject = {
4462
4493
  tableCode: tableCode,
4463
- actionType: this.formConfig.tableActions.inline,
4494
+ actionType: componentConstants.FORMTABLEACTION_INLINE,
4464
4495
  actionCode: actionCode,
4465
4496
  tableRecordId: recordId,
4466
4497
  tableRecordData: recordData
4467
4498
  };
4468
4499
  return [4 /*yield*/, this
4469
- .requestFormAction(formActions.tableAction, actionSubject)];
4500
+ .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4470
4501
  case 1:
4471
4502
  actionResult = _g.sent();
4472
4503
  finish = !this.errorOccured();
@@ -4590,13 +4621,13 @@
4590
4621
  if (!tableObject.selectionBackend) return [3 /*break*/, 2];
4591
4622
  actionSubject = {
4592
4623
  tableCode: tableCode,
4593
- actionType: this.formConfig.tableActions.rowSelection,
4624
+ actionType: componentConstants.FORMTABLEACTION_ROWSELECTION,
4594
4625
  actionCode: null,
4595
4626
  tableRecordId: recordId,
4596
4627
  tableRecordData: recordData
4597
4628
  };
4598
4629
  return [4 /*yield*/, this
4599
- .requestFormAction(formActions.tableAction, actionSubject)];
4630
+ .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4600
4631
  case 1:
4601
4632
  actionResult = _g.sent();
4602
4633
  finish = !this.errorOccured();
@@ -4721,12 +4752,12 @@
4721
4752
  if (!action.backend) return [3 /*break*/, 2];
4722
4753
  actionSubject = {
4723
4754
  tableCode: tableCode,
4724
- actionType: this.formConfig.tableActions.selection,
4755
+ actionType: componentConstants.FORMTABLEACTION_SELECTION,
4725
4756
  actionCode: actionCode,
4726
4757
  selectedRecords: selectedRecords
4727
4758
  };
4728
4759
  return [4 /*yield*/, this
4729
- .requestFormAction(formActions.tableAction, actionSubject)];
4760
+ .requestFormAction(componentConstants.FORMACTION_TABLEACTION, actionSubject)];
4730
4761
  case 1:
4731
4762
  actionResult = _g.sent();
4732
4763
  finish = !this.errorOccured();
@@ -4835,7 +4866,7 @@
4835
4866
  tableObject.putOnWait();
4836
4867
  actionSubject = { tableCode: tableCode };
4837
4868
  return [4 /*yield*/, this
4838
- .requestFormAction(formActions.getTableData, actionSubject)];
4869
+ .requestFormAction(componentConstants.FORMACTION_GETTABLEDATA, actionSubject)];
4839
4870
  case 1:
4840
4871
  actionResult = _g.sent();
4841
4872
  if (this.errorOccured()) {
@@ -4895,15 +4926,15 @@
4895
4926
  this.resetError();
4896
4927
  var completeFields = this.checkSectionRequiredFields(sectionCode, reqFieldMessage);
4897
4928
  if (!completeFields) {
4898
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
4929
+ this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_REQUIRED_FIELDS);
4899
4930
  return;
4900
4931
  }
4901
4932
  var validationError = false;
4902
4933
  var requiredEmptyFields = this.getRequiredEmptyFields(null, sectionCode);
4903
4934
  if (requiredEmptyFields.length > 0) {
4904
4935
  validationError = true;
4905
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
4906
- this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
4936
+ this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_REQUIRED_FIELDS);
4937
+ this.tagFieldsWithError(requiredEmptyFields, null, componentConstants.FIELD_REQUIRED_MESSAGE);
4907
4938
  try {
4908
4939
  for (var requiredEmptyFields_1 = __values(requiredEmptyFields), requiredEmptyFields_1_1 = requiredEmptyFields_1.next(); !requiredEmptyFields_1_1.done; requiredEmptyFields_1_1 = requiredEmptyFields_1.next()) {
4909
4940
  var fieldCode = requiredEmptyFields_1_1.value;
@@ -4926,7 +4957,7 @@
4926
4957
  var validationIssueFields = this.getFieldsWithValidationIssues(null, sectionCode);
4927
4958
  if (!validationError && validationIssueFields.length > 0) {
4928
4959
  validationError = true;
4929
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
4960
+ this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_VALIDATION_FIELDS);
4930
4961
  try {
4931
4962
  for (var validationIssueFields_1 = __values(validationIssueFields), validationIssueFields_1_1 = validationIssueFields_1.next(); !validationIssueFields_1_1.done; validationIssueFields_1_1 = validationIssueFields_1.next()) {
4932
4963
  var fieldCode = validationIssueFields_1_1.value;
@@ -5088,13 +5119,13 @@
5088
5119
  var requiredEmptyFields = this.getRequiredEmptyFields(recordCaptureFields, null);
5089
5120
  if (requiredEmptyFields.length > 0) {
5090
5121
  validationOk = false;
5091
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
5092
- this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
5122
+ this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_REQUIRED_FIELDS);
5123
+ this.tagFieldsWithError(requiredEmptyFields, null, componentConstants.FIELD_REQUIRED_MESSAGE);
5093
5124
  }
5094
5125
  var validationIssueFields = this.getFieldsWithValidationIssues(recordCaptureFields, null);
5095
5126
  if (validationIssueFields.length > 0) {
5096
5127
  validationOk = false;
5097
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
5128
+ this.setError(componentConstants.FORMERROR_TYPE_WARNING, componentConstants.FORMERROR_VALIDATION_TITLE, componentConstants.FORMERROR_VALIDATION_FIELDS);
5098
5129
  }
5099
5130
  return validationOk;
5100
5131
  };