tuain-ng-forms-lib 0.12.31 → 0.12.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/tuain-ng-forms-lib.umd.js +157 -251
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/action.js +5 -5
- package/esm2015/lib/classes/forms/element.js +7 -6
- package/esm2015/lib/classes/forms/field.js +41 -91
- package/esm2015/lib/classes/forms/form.constants.js +11 -82
- package/esm2015/lib/classes/forms/form.js +8 -8
- package/esm2015/lib/classes/forms/subsection.js +5 -5
- package/esm2015/lib/classes/forms/table/column.js +5 -5
- package/esm2015/lib/classes/forms/table/row-data.js +6 -4
- package/esm2015/lib/classes/forms/table/table.js +15 -13
- package/esm2015/lib/components/elements/action.component.js +3 -1
- package/esm2015/lib/components/elements/field.component.js +21 -11
- package/esm2015/lib/components/elements/layout/element.component.js +3 -6
- package/esm2015/lib/components/elements/layout/form-error.component.js +1 -1
- package/esm2015/lib/components/elements/tables/table.component.js +7 -7
- package/esm2015/lib/components/forms/basic-form.js +24 -22
- package/fesm2015/tuain-ng-forms-lib.js +156 -255
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/action.d.ts +1 -1
- package/lib/classes/forms/element.d.ts +2 -1
- package/lib/classes/forms/field.d.ts +2 -1
- package/lib/classes/forms/form.constants.d.ts +10 -74
- package/lib/classes/forms/form.d.ts +2 -1
- package/lib/classes/forms/table/column.d.ts +2 -1
- package/lib/classes/forms/table/table.d.ts +1 -1
- package/lib/components/elements/action.component.d.ts +1 -0
- package/lib/components/elements/field.component.d.ts +1 -2
- package/lib/components/elements/layout/element.component.d.ts +1 -2
- package/lib/components/elements/layout/form-error.component.d.ts +0 -1
- package/lib/components/elements/tables/table.component.d.ts +1 -0
- package/lib/components/forms/basic-form.d.ts +2 -1
- package/package.json +1 -1
- 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,132 +54,52 @@
|
|
|
52
54
|
showLabel: [{ type: core.Input }]
|
|
53
55
|
};
|
|
54
56
|
|
|
55
|
-
var
|
|
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',
|
|
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
|
-
|
|
149
|
-
var MONITORED_ATTRIBUTES$1 = {
|
|
57
|
+
var MONITORED_ATTRIBUTES = {
|
|
150
58
|
_maxLength: 'maxLength',
|
|
151
|
-
_onValidation: '
|
|
59
|
+
_onValidation: 'onValidation',
|
|
152
60
|
_fieldValue: 'value',
|
|
153
61
|
captureType: 'captureType',
|
|
154
|
-
fieldTitle: '
|
|
155
|
-
fieldType: '
|
|
62
|
+
fieldTitle: 'title',
|
|
63
|
+
fieldType: 'type',
|
|
156
64
|
errorMessage: 'errorMessage',
|
|
157
65
|
errorType: 'errorType',
|
|
158
66
|
errorCode: 'errorCode',
|
|
159
67
|
visibleLabel: 'visibleLabel',
|
|
160
|
-
fieldRequired: '
|
|
161
|
-
fieldOptions: '
|
|
68
|
+
fieldRequired: 'required',
|
|
69
|
+
fieldOptions: 'options',
|
|
162
70
|
};
|
|
163
71
|
var FieldComponent = /** @class */ (function () {
|
|
164
72
|
function FieldComponent() {
|
|
165
|
-
this.componentConstants = Object.assign({}, componentConstants);
|
|
166
73
|
}
|
|
167
74
|
FieldComponent.prototype.ngOnInit = function () {
|
|
168
75
|
var _this = this;
|
|
76
|
+
var _a;
|
|
169
77
|
if (this.fieldObject) {
|
|
78
|
+
this.formConfig = (_a = this.fieldObject) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
170
79
|
// Atributos estáticos
|
|
171
80
|
this.code = this.fieldObject.fieldCode;
|
|
172
81
|
this.fieldInfo = this.fieldObject.fieldInfo;
|
|
173
82
|
this.fieldAlignment = this.fieldObject.fieldAlignment;
|
|
174
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;
|
|
175
97
|
this.fieldObject.widget = this;
|
|
176
98
|
// Atributos dinámicos
|
|
177
99
|
this.fieldObject.attributeChange.subscribe(function (event) {
|
|
178
100
|
var name = event.name, value = event.value;
|
|
179
|
-
if (_this[MONITORED_ATTRIBUTES
|
|
180
|
-
_this[MONITORED_ATTRIBUTES
|
|
101
|
+
if (_this[MONITORED_ATTRIBUTES[name]]) {
|
|
102
|
+
_this[MONITORED_ATTRIBUTES[name]] = value;
|
|
181
103
|
}
|
|
182
104
|
});
|
|
183
105
|
}
|
|
@@ -209,7 +131,6 @@
|
|
|
209
131
|
template: "<ng-content></ng-content>"
|
|
210
132
|
},] }
|
|
211
133
|
];
|
|
212
|
-
FieldComponent.ctorParameters = function () { return []; };
|
|
213
134
|
FieldComponent.propDecorators = {
|
|
214
135
|
fieldObject: [{ type: core.Input }],
|
|
215
136
|
disabled: [{ type: core.Input }]
|
|
@@ -217,9 +138,10 @@
|
|
|
217
138
|
|
|
218
139
|
var ElementComponent = /** @class */ (function () {
|
|
219
140
|
function ElementComponent() {
|
|
220
|
-
this.componentConstants = Object.assign({}, componentConstants);
|
|
221
141
|
}
|
|
222
142
|
ElementComponent.prototype.ngOnInit = function () {
|
|
143
|
+
var _a;
|
|
144
|
+
this.formConfig = (_a = this.formElement) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
223
145
|
this.start();
|
|
224
146
|
};
|
|
225
147
|
ElementComponent.prototype.start = function () { };
|
|
@@ -249,7 +171,6 @@
|
|
|
249
171
|
template: "<ng-content></ng-content>"
|
|
250
172
|
},] }
|
|
251
173
|
];
|
|
252
|
-
ElementComponent.ctorParameters = function () { return []; };
|
|
253
174
|
ElementComponent.propDecorators = {
|
|
254
175
|
formElement: [{ type: core.Input }],
|
|
255
176
|
formManager: [{ type: core.Input }]
|
|
@@ -675,9 +596,33 @@
|
|
|
675
596
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
676
597
|
}
|
|
677
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
|
+
|
|
678
622
|
var FormElement = /** @class */ (function () {
|
|
679
|
-
function FormElement(elementDefinition) {
|
|
623
|
+
function FormElement(elementDefinition, formConfig) {
|
|
680
624
|
var _a, _b;
|
|
625
|
+
this._formConfig = formConfig;
|
|
681
626
|
this._isForced = false;
|
|
682
627
|
this.setVisibleStates(elementDefinition.visibleStates);
|
|
683
628
|
this.setEnabledStates(elementDefinition.enabledStates);
|
|
@@ -686,9 +631,9 @@
|
|
|
686
631
|
this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
|
|
687
632
|
this.widget = null;
|
|
688
633
|
}
|
|
689
|
-
FormElement.prototype.isField = function () { return this.elementType ===
|
|
690
|
-
FormElement.prototype.isAction = function () { return this.elementType ===
|
|
691
|
-
FormElement.prototype.isTable = function () { return this.elementType ===
|
|
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; };
|
|
692
637
|
FormElement.prototype.setVisibleStates = function (newStates) {
|
|
693
638
|
var visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
|
|
694
639
|
? newStates.split(',').map(function (state) { return state.trim(); }).filter(function (state) { return state.length > 0; })
|
|
@@ -748,13 +693,14 @@
|
|
|
748
693
|
}());
|
|
749
694
|
|
|
750
695
|
var RecordTableColumn = /** @class */ (function () {
|
|
751
|
-
function RecordTableColumn(recTableColReceived) {
|
|
696
|
+
function RecordTableColumn(recTableColReceived, formConfig) {
|
|
752
697
|
var _a, _b, _c;
|
|
698
|
+
this._formConfig = formConfig;
|
|
753
699
|
if (recTableColReceived) {
|
|
754
700
|
this.fieldCode = recTableColReceived.fieldCode;
|
|
755
701
|
this.fieldTitle = recTableColReceived.fieldTitle;
|
|
756
|
-
this.fieldType = recTableColReceived.fieldTypeCode ||
|
|
757
|
-
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';
|
|
758
704
|
this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
|
|
759
705
|
this.visible = (_a = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.visible) !== null && _a !== void 0 ? _a : true;
|
|
760
706
|
this.sortable = (_b = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.sortable) !== null && _b !== void 0 ? _b : false;
|
|
@@ -843,6 +789,8 @@
|
|
|
843
789
|
return outputValue;
|
|
844
790
|
}
|
|
845
791
|
|
|
792
|
+
var DATE_TYPE = 'DATE';
|
|
793
|
+
var CURRENCY_TYPE = 'CURRENCY';
|
|
846
794
|
var TableRecordData = /** @class */ (function () {
|
|
847
795
|
function TableRecordData(recordReceived, recordDefinition, selectionFieldName) {
|
|
848
796
|
var _this = this;
|
|
@@ -879,10 +827,10 @@
|
|
|
879
827
|
}
|
|
880
828
|
}
|
|
881
829
|
TableRecordData.prototype.formatFieldValue = function (fieldType, fieldValue) {
|
|
882
|
-
if (fieldType ===
|
|
830
|
+
if (fieldType === CURRENCY_TYPE) {
|
|
883
831
|
return formatCurrency(fieldValue);
|
|
884
832
|
}
|
|
885
|
-
else if (fieldType ===
|
|
833
|
+
else if (fieldType === DATE_TYPE && fieldValue) {
|
|
886
834
|
return new Date(fieldValue).toISOString().split('T')[0];
|
|
887
835
|
}
|
|
888
836
|
return fieldValue || '';
|
|
@@ -993,6 +941,8 @@
|
|
|
993
941
|
return TableRecordData;
|
|
994
942
|
}());
|
|
995
943
|
|
|
944
|
+
var TABLE_SORT_ASCENDING = 'asc';
|
|
945
|
+
var TABLE_SORT_DESCENDING = 'desc';
|
|
996
946
|
var TABLE_FILTER_TYPES = {
|
|
997
947
|
simpleFilterChange: 'SIMPLE_CHANGE',
|
|
998
948
|
simpleFilterFinish: 'SIMPLE_FINISH',
|
|
@@ -1001,11 +951,11 @@
|
|
|
1001
951
|
};
|
|
1002
952
|
var RecordTable = /** @class */ (function (_super) {
|
|
1003
953
|
__extends(RecordTable, _super);
|
|
1004
|
-
function RecordTable(tableReceived) {
|
|
954
|
+
function RecordTable(tableReceived, formConfig) {
|
|
1005
955
|
var e_1, _h, e_2, _j, e_3, _k;
|
|
1006
956
|
var _this = this;
|
|
1007
957
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1008
|
-
_this = _super.call(this, tableReceived) || this;
|
|
958
|
+
_this = _super.call(this, tableReceived, formConfig) || this;
|
|
1009
959
|
_this._inlineActionTrigger = new rxjs.Subject();
|
|
1010
960
|
_this._globalActionTrigger = new rxjs.Subject();
|
|
1011
961
|
_this._recordSelectionTrigger = new rxjs.Subject();
|
|
@@ -1015,7 +965,7 @@
|
|
|
1015
965
|
_this._tableColumnObj = {};
|
|
1016
966
|
_this._actionsObj = {};
|
|
1017
967
|
_this.allSelected = false;
|
|
1018
|
-
_this.elementType =
|
|
968
|
+
_this.elementType = elementTypes.table;
|
|
1019
969
|
_this.waiting = false;
|
|
1020
970
|
_this.complexFilter = false;
|
|
1021
971
|
_this.currentPage = 1;
|
|
@@ -1038,12 +988,12 @@
|
|
|
1038
988
|
_this.customAttributes = (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.customAttributes) !== null && _f !== void 0 ? _f : {};
|
|
1039
989
|
_this.sortable = (_g = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _g !== void 0 ? _g : false;
|
|
1040
990
|
_this.sorting = { columnName: '', direction: '' };
|
|
1041
|
-
_this.recordsPerPage =
|
|
991
|
+
_this.recordsPerPage = formConfig.defaultRecordsPerPage;
|
|
1042
992
|
if (tableReceived.fields) {
|
|
1043
993
|
try {
|
|
1044
994
|
for (var _l = __values(tableReceived.fields), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
1045
995
|
var columnReceived = _m.value;
|
|
1046
|
-
var columnDefinition = new RecordTableColumn(columnReceived);
|
|
996
|
+
var columnDefinition = new RecordTableColumn(columnReceived, _this._formConfig);
|
|
1047
997
|
_this.columns.push(columnDefinition);
|
|
1048
998
|
_this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
|
|
1049
999
|
}
|
|
@@ -1303,7 +1253,7 @@
|
|
|
1303
1253
|
? this._actionsObj[actionCode] : null;
|
|
1304
1254
|
};
|
|
1305
1255
|
RecordTable.prototype.getActions = function (actionClass, actionTypes) {
|
|
1306
|
-
if (actionClass === void 0) { actionClass =
|
|
1256
|
+
if (actionClass === void 0) { actionClass = this._formConfig.tableActions.inline; }
|
|
1307
1257
|
if (actionTypes === void 0) { actionTypes = null; }
|
|
1308
1258
|
return this._actions.filter(function (actionDef) {
|
|
1309
1259
|
var typeIncluded = (actionTypes) ? actionTypes.includes(actionDef.actionType) : true;
|
|
@@ -1378,14 +1328,14 @@
|
|
|
1378
1328
|
RecordTable.prototype.setRequiredOrder = function (columnField) {
|
|
1379
1329
|
if (columnField !== this.sorting.columnName) {
|
|
1380
1330
|
this.sorting.columnName = columnField;
|
|
1381
|
-
this.sorting.direction =
|
|
1331
|
+
this.sorting.direction = TABLE_SORT_ASCENDING;
|
|
1382
1332
|
}
|
|
1383
1333
|
else {
|
|
1384
|
-
if (this.sorting.direction ===
|
|
1385
|
-
this.sorting.direction =
|
|
1334
|
+
if (this.sorting.direction === TABLE_SORT_ASCENDING) {
|
|
1335
|
+
this.sorting.direction = TABLE_SORT_DESCENDING;
|
|
1386
1336
|
}
|
|
1387
1337
|
else {
|
|
1388
|
-
this.sorting.direction =
|
|
1338
|
+
this.sorting.direction = TABLE_SORT_ASCENDING;
|
|
1389
1339
|
}
|
|
1390
1340
|
}
|
|
1391
1341
|
};
|
|
@@ -1407,7 +1357,7 @@
|
|
|
1407
1357
|
else if (recordAColumn > recordBColumn) {
|
|
1408
1358
|
result = 1;
|
|
1409
1359
|
}
|
|
1410
|
-
return direction ===
|
|
1360
|
+
return direction === TABLE_SORT_ASCENDING ? result : -result;
|
|
1411
1361
|
};
|
|
1412
1362
|
return RecordTable;
|
|
1413
1363
|
}(FormElement));
|
|
@@ -1570,13 +1520,15 @@
|
|
|
1570
1520
|
this.hasActions = false;
|
|
1571
1521
|
}
|
|
1572
1522
|
LibTableComponent.prototype.ngOnInit = function () {
|
|
1573
|
-
|
|
1523
|
+
var _a;
|
|
1524
|
+
this.formConfig = (_a = this.tableObject) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
1525
|
+
this.tableFieldStyles = this.formConfig.tableFieldStyles;
|
|
1574
1526
|
this.selectable = this.tableObject.selectable;
|
|
1575
1527
|
this.hasActions = this.tableObject.hasActions;
|
|
1576
1528
|
this.tableObject.widget = this;
|
|
1577
|
-
this.inlineActions = this.tableObject.getActions(
|
|
1578
|
-
this.globalActions = this.tableObject.getActions(
|
|
1579
|
-
this.selectionActions = this.tableObject.getActions(
|
|
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);
|
|
1580
1532
|
this.start();
|
|
1581
1533
|
};
|
|
1582
1534
|
LibTableComponent.prototype.start = function () { };
|
|
@@ -1694,15 +1646,15 @@
|
|
|
1694
1646
|
var arrayToAdd = null;
|
|
1695
1647
|
var type = receivedElement.type, code = receivedElement.code;
|
|
1696
1648
|
switch (type) {
|
|
1697
|
-
case
|
|
1649
|
+
case elementTypes.field:
|
|
1698
1650
|
elementObject = formObject.getFieldObject(code);
|
|
1699
1651
|
arrayToAdd = this.subSectionFields;
|
|
1700
1652
|
break;
|
|
1701
|
-
case
|
|
1653
|
+
case elementTypes.table:
|
|
1702
1654
|
elementObject = formObject.getTableObject(code);
|
|
1703
1655
|
arrayToAdd = this.subSectionTables;
|
|
1704
1656
|
break;
|
|
1705
|
-
case
|
|
1657
|
+
case elementTypes.action:
|
|
1706
1658
|
elementObject = formObject.getActionObject(code);
|
|
1707
1659
|
arrayToAdd = this.subSectionActions;
|
|
1708
1660
|
break;
|
|
@@ -1912,13 +1864,13 @@
|
|
|
1912
1864
|
var HEADER$1 = 'HEADER';
|
|
1913
1865
|
var FormAction = /** @class */ (function (_super) {
|
|
1914
1866
|
__extends(FormAction, _super);
|
|
1915
|
-
function FormAction(actionDefinition) {
|
|
1867
|
+
function FormAction(actionDefinition, formConfig) {
|
|
1916
1868
|
var _this = this;
|
|
1917
1869
|
var _a, _b;
|
|
1918
|
-
_this = _super.call(this, actionDefinition) || this;
|
|
1870
|
+
_this = _super.call(this, actionDefinition, formConfig) || this;
|
|
1919
1871
|
_this._actionActivated = new rxjs.Subject();
|
|
1920
1872
|
_this.inProgress = false;
|
|
1921
|
-
_this.elementType =
|
|
1873
|
+
_this.elementType = elementTypes.action;
|
|
1922
1874
|
_this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
|
|
1923
1875
|
_this.actionName = actionDefinition.actionTitle;
|
|
1924
1876
|
_this.iconName = actionDefinition.iconName || _this.actionCode;
|
|
@@ -1952,58 +1904,9 @@
|
|
|
1952
1904
|
}(FormElement));
|
|
1953
1905
|
|
|
1954
1906
|
var UNDEFINED = 'undefined';
|
|
1955
|
-
var FIELD_VALUE = 'fieldValue';
|
|
1956
|
-
var FIELD_OPTIONS = 'fieldOptions';
|
|
1957
|
-
var FIELD_TITLE = 'fieldTitle';
|
|
1958
|
-
var FIELD_CAPTURE_TYPE = 'captureType';
|
|
1959
|
-
var FIELD_TYPE = 'fieldTypeCode';
|
|
1960
|
-
var FIELD_MAX_LENGTH = 'maxLength';
|
|
1961
|
-
var FIELD_VISIBLE = 'visible';
|
|
1962
|
-
var FIELD_LABEL_VISIBLE = 'visibleLabel';
|
|
1963
|
-
var FIELD_REQUIRED = 'required';
|
|
1964
|
-
var FIELD_ERR_CODE = 'errorCode';
|
|
1965
|
-
var FIELD_ERR_MSG = 'errorMessage';
|
|
1966
|
-
var FIELD_TOOLTIP = 'tooltipText';
|
|
1967
|
-
var FIELD_INFO = 'info';
|
|
1968
|
-
var FIELD_EDITABLE = 'editable';
|
|
1969
|
-
var FIELD_TYPES = {
|
|
1970
|
-
boolean: 'BOOLEAN',
|
|
1971
|
-
array: 'ARRAY',
|
|
1972
|
-
check: 'CHECK',
|
|
1973
|
-
date: 'DATE',
|
|
1974
|
-
daterange: 'DATERANGE',
|
|
1975
|
-
time: 'TIME',
|
|
1976
|
-
timerange: 'TIMERANGE',
|
|
1977
|
-
map: 'MAP',
|
|
1978
|
-
number: 'NUMBER',
|
|
1979
|
-
decimal: 'DECIMAL',
|
|
1980
|
-
currency: 'CURRENCY',
|
|
1981
|
-
select: 'SELECT',
|
|
1982
|
-
typeahead: 'TYPEAHEAD',
|
|
1983
|
-
text: 'TEXT',
|
|
1984
|
-
password: 'PASSWORD',
|
|
1985
|
-
label: 'LABEL',
|
|
1986
|
-
html: 'HTML',
|
|
1987
|
-
title: 'TITLE',
|
|
1988
|
-
message: 'MESSAGE',
|
|
1989
|
-
link: 'LINK',
|
|
1990
|
-
warning: 'WARNING',
|
|
1991
|
-
avatar: 'AVATAR',
|
|
1992
|
-
email: 'EMAIL',
|
|
1993
|
-
phone: 'PHONE',
|
|
1994
|
-
};
|
|
1995
|
-
var FIELD_TYPES_FORMATS = {
|
|
1996
|
-
EMAIL: new RegExp('^\\w+([\\.-]?\\w+)@\\w+([\\.-]?\\w+)(\\.\\w{2,3})+$'),
|
|
1997
|
-
};
|
|
1998
|
-
var INTRINSIC_ERROR_MESSAGES = {
|
|
1999
|
-
EMAIL: "El valor no corresponde a un correo v\u00E1lido",
|
|
2000
|
-
DEFAULT: "El valor no se ajusta al formato establecido",
|
|
2001
|
-
};
|
|
2002
1907
|
var DEFAULT_ERROR_TYPE = 'error';
|
|
2003
1908
|
var DEFAULT_CAPTURE_TYPE = 'INPUT';
|
|
2004
1909
|
var DEFAULT_ALIGNMENT = 'left';
|
|
2005
|
-
var MONITORED_ATTRIBUTES = ['_maxLength', '_onValidation', 'captureType', 'fieldTitle', 'fieldType',
|
|
2006
|
-
'errorMessage', 'errorType', 'errorCode', 'visibleLabel', 'fieldRequired', 'fieldOptions', '_fieldValue'];
|
|
2007
1910
|
var STD_MAX_LENGTH = 50;
|
|
2008
1911
|
var BIG_MAX_LENGTH = 500;
|
|
2009
1912
|
var fldAttr = {
|
|
@@ -2037,22 +1940,22 @@
|
|
|
2037
1940
|
};
|
|
2038
1941
|
var FieldDescriptor = /** @class */ (function (_super) {
|
|
2039
1942
|
__extends(FieldDescriptor, _super);
|
|
2040
|
-
function FieldDescriptor(inputFieldReceived) {
|
|
1943
|
+
function FieldDescriptor(inputFieldReceived, formConfig) {
|
|
2041
1944
|
var _this = this;
|
|
2042
1945
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2043
|
-
_this = _super.call(this, inputFieldReceived) || this;
|
|
1946
|
+
_this = _super.call(this, inputFieldReceived, formConfig) || this;
|
|
2044
1947
|
_this._editionFinish = new rxjs.Subject();
|
|
2045
1948
|
_this._editionPartial = new rxjs.Subject();
|
|
2046
1949
|
_this._detailRequest = new rxjs.Subject();
|
|
2047
1950
|
_this._attributeChange = new rxjs.Subject();
|
|
2048
|
-
_this.elementType =
|
|
1951
|
+
_this.elementType = elementTypes.field;
|
|
2049
1952
|
var fld = (inputFieldReceived) ? inputFieldReceived : {};
|
|
2050
1953
|
_this.setAttr(fldAttr.code, fld.fieldCode);
|
|
2051
1954
|
_this.setAttr(fldAttr.title, (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : _this.fieldCode);
|
|
2052
1955
|
_this.setAttr(fldAttr.captureType, (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE);
|
|
2053
1956
|
_this.setAttr(fldAttr.defaultValue, (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null);
|
|
2054
|
-
var defaultTypeAlignment = (tableFieldStyles[_this.fieldType] != null)
|
|
2055
|
-
? tableFieldStyles[_this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
|
|
1957
|
+
var defaultTypeAlignment = (_this._formConfig.tableFieldStyles[_this.fieldType] != null)
|
|
1958
|
+
? _this._formConfig.tableFieldStyles[_this.fieldType]['text-align'] : DEFAULT_ALIGNMENT;
|
|
2056
1959
|
var fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
|
|
2057
1960
|
_this.setAttr(fldAttr.alignment, fieldAlignment);
|
|
2058
1961
|
_this.setAttr(fldAttr.info, fld.info || '');
|
|
@@ -2073,7 +1976,7 @@
|
|
|
2073
1976
|
_this.setAttr(fldAttr.outputOnly, (_h = fld.outputOnly) !== null && _h !== void 0 ? _h : false);
|
|
2074
1977
|
var maxLength = (_j = fld.maxLength) !== null && _j !== void 0 ? _j : (_this.captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
2075
1978
|
_this.setAttr(fldAttr.maxLength, maxLength);
|
|
2076
|
-
_this.setAttr(fldAttr.intrinsicErrorMessage, (_k =
|
|
1979
|
+
_this.setAttr(fldAttr.intrinsicErrorMessage, (_k = _this._formConfig.fieldTypeErrMsg[_this.fieldType]) !== null && _k !== void 0 ? _k : _this._formConfig.fieldTypeErrMsg.DEFAULT);
|
|
2077
1980
|
_this.setFieldType(fld.fieldTypeCode);
|
|
2078
1981
|
_this.setEditable((_l = fld.editable) !== null && _l !== void 0 ? _l : true);
|
|
2079
1982
|
_this.setVisibleLabel((_m = fld.visibleLabel) !== null && _m !== void 0 ? _m : true);
|
|
@@ -2154,13 +2057,13 @@
|
|
|
2154
2057
|
this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
|
|
2155
2058
|
};
|
|
2156
2059
|
FieldDescriptor.prototype.notifyEditionFinish = function () {
|
|
2157
|
-
var _a, _b, _c, _d;
|
|
2060
|
+
var _a, _b, _c, _d, _e;
|
|
2158
2061
|
var intrinsicValidation = true;
|
|
2159
|
-
var fieldDefaultFormat = (_a =
|
|
2062
|
+
var fieldDefaultFormat = (_b = (_a = this._formConfig.fieldTypesPatterns) === null || _a === void 0 ? void 0 : _a[this.fieldType]) !== null && _b !== void 0 ? _b : null;
|
|
2160
2063
|
var fieldValue = this.getValue();
|
|
2161
2064
|
if (fieldValue && (fieldDefaultFormat || this.fieldFormat)) {
|
|
2162
|
-
intrinsicValidation = ((
|
|
2163
|
-
&& ((
|
|
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);
|
|
2164
2067
|
if (!intrinsicValidation) {
|
|
2165
2068
|
this.setError('99', this._intrinsicErrorMessage);
|
|
2166
2069
|
}
|
|
@@ -2168,16 +2071,15 @@
|
|
|
2168
2071
|
this._editionFinish.next({ code: this.fieldCode, intrinsicValidation: intrinsicValidation });
|
|
2169
2072
|
};
|
|
2170
2073
|
FieldDescriptor.prototype.setAttr = function (name, value) {
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
}
|
|
2174
|
-
if (MONITORED_ATTRIBUTES.includes(name)) {
|
|
2074
|
+
this[name] = value;
|
|
2075
|
+
if (this._formConfig.monitoredFieldAttributes.includes(name)) {
|
|
2175
2076
|
this._attributeChange.next({ name: name, value: value });
|
|
2176
2077
|
}
|
|
2177
2078
|
};
|
|
2178
2079
|
FieldDescriptor.prototype.notifyEditionDetailRequest = function () {
|
|
2179
2080
|
this._detailRequest.next(this.fieldCode);
|
|
2180
2081
|
};
|
|
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; };
|
|
2181
2083
|
FieldDescriptor.prototype.setVisibleLabel = function (visibleLabel) { this.setAttr(fldAttr.visibleLabel, visibleLabel); };
|
|
2182
2084
|
FieldDescriptor.prototype.showLabel = function () { this.setVisibleLabel(true); };
|
|
2183
2085
|
FieldDescriptor.prototype.hideLabel = function () { this.setVisibleLabel(false); };
|
|
@@ -2218,7 +2120,7 @@
|
|
|
2218
2120
|
if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
|
|
2219
2121
|
return true;
|
|
2220
2122
|
}
|
|
2221
|
-
if ((this.fieldType ===
|
|
2123
|
+
if ((this.fieldType === this._formConfig.fieldTypes.array || this.fieldType === this._formConfig.fieldTypes.phone)
|
|
2222
2124
|
&& Array.isArray(fieldCurrentValue) && fieldCurrentValue.length === 0) {
|
|
2223
2125
|
return true;
|
|
2224
2126
|
}
|
|
@@ -2228,10 +2130,10 @@
|
|
|
2228
2130
|
FieldDescriptor.prototype.getValue = function () {
|
|
2229
2131
|
var _a;
|
|
2230
2132
|
switch (this.fieldType) {
|
|
2231
|
-
case
|
|
2133
|
+
case this._formConfig.fieldTypes.check:
|
|
2232
2134
|
return (_a = this._fieldValue) !== null && _a !== void 0 ? _a : false;
|
|
2233
2135
|
break;
|
|
2234
|
-
case
|
|
2136
|
+
case this._formConfig.fieldTypes.currency:
|
|
2235
2137
|
return this._fieldValue.replace(',', '');
|
|
2236
2138
|
break;
|
|
2237
2139
|
default:
|
|
@@ -2245,33 +2147,33 @@
|
|
|
2245
2147
|
for (var index = 0; index < fieldKeys.length; index++) {
|
|
2246
2148
|
var attrName = fieldKeys[index];
|
|
2247
2149
|
var attrValue = fld[attrName];
|
|
2248
|
-
(attrName ===
|
|
2249
|
-
(attrName ===
|
|
2250
|
-
(attrName ===
|
|
2251
|
-
(attrName ===
|
|
2252
|
-
(attrName ===
|
|
2253
|
-
(attrName ===
|
|
2254
|
-
(attrName ===
|
|
2255
|
-
(attrName ===
|
|
2256
|
-
(attrName ===
|
|
2257
|
-
(attrName ===
|
|
2258
|
-
(attrName ===
|
|
2259
|
-
(attrName ===
|
|
2260
|
-
(attrName ===
|
|
2261
|
-
(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);
|
|
2262
2164
|
}
|
|
2263
2165
|
};
|
|
2264
2166
|
FieldDescriptor.prototype.setFieldType = function (inputFieldType) {
|
|
2265
2167
|
this.setAttr(fldAttr.type, inputFieldType);
|
|
2266
2168
|
};
|
|
2267
2169
|
FieldDescriptor.prototype.format = function () {
|
|
2268
|
-
if (this.fieldType ===
|
|
2170
|
+
if (this.fieldType === this._formConfig.fieldTypes.currency) {
|
|
2269
2171
|
this.setAttr(fldAttr.value, formatCurrency(this._fieldValue));
|
|
2270
2172
|
}
|
|
2271
2173
|
};
|
|
2272
2174
|
FieldDescriptor.prototype.setMinValue = function (minValue) {
|
|
2273
2175
|
var _a, _b, _c;
|
|
2274
|
-
if (this.fieldType ===
|
|
2176
|
+
if (this.fieldType === this._formConfig.fieldTypes.date
|
|
2275
2177
|
&& ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMinValue)) {
|
|
2276
2178
|
this.setAttr(fldAttr.minValue, minValue);
|
|
2277
2179
|
if (!minValue) {
|
|
@@ -2285,7 +2187,7 @@
|
|
|
2285
2187
|
};
|
|
2286
2188
|
FieldDescriptor.prototype.setMaxValue = function (maxValue) {
|
|
2287
2189
|
var _a, _b, _c;
|
|
2288
|
-
if (this.fieldType ===
|
|
2190
|
+
if (this.fieldType === this._formConfig.fieldTypes.date
|
|
2289
2191
|
&& ((_a = this.widget) === null || _a === void 0 ? void 0 : _a.setMaxValue)) {
|
|
2290
2192
|
this.setAttr(fldAttr.maxValue, maxValue);
|
|
2291
2193
|
if (!maxValue) {
|
|
@@ -2318,11 +2220,11 @@
|
|
|
2318
2220
|
fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
|
|
2319
2221
|
&& fieldOptions.length > 0) ? fieldOptions : [];
|
|
2320
2222
|
this.setAttr(fldAttr.options, fieldOptions);
|
|
2321
|
-
if (this.fieldType ===
|
|
2223
|
+
if (this.fieldType === this._formConfig.fieldTypes.array && this.widget) {
|
|
2322
2224
|
return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
|
|
2323
2225
|
}
|
|
2324
2226
|
if (this._fieldValue) {
|
|
2325
|
-
if (this.fieldType ===
|
|
2227
|
+
if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._fieldValue)) {
|
|
2326
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; }); });
|
|
2327
2229
|
this.setAttr(fldAttr.value, fieldValue);
|
|
2328
2230
|
}
|
|
@@ -2352,10 +2254,10 @@
|
|
|
2352
2254
|
case 'BOOLEAN':
|
|
2353
2255
|
newFinalValue = !!newValue;
|
|
2354
2256
|
break;
|
|
2355
|
-
case
|
|
2257
|
+
case this._formConfig.fieldTypes.check:
|
|
2356
2258
|
newFinalValue = !!newValue;
|
|
2357
2259
|
break;
|
|
2358
|
-
case
|
|
2260
|
+
case this._formConfig.fieldTypes.array:
|
|
2359
2261
|
if (newValue === null || newValue === '') {
|
|
2360
2262
|
newFinalValue = [];
|
|
2361
2263
|
}
|
|
@@ -2369,7 +2271,7 @@
|
|
|
2369
2271
|
newFinalValue = newValue;
|
|
2370
2272
|
}
|
|
2371
2273
|
break;
|
|
2372
|
-
case
|
|
2274
|
+
case this._formConfig.fieldTypes.map:
|
|
2373
2275
|
newFinalValue = newValue;
|
|
2374
2276
|
if (newFinalValue && this.widget && widgetUpdate) {
|
|
2375
2277
|
var latitude = parseFloat(newFinalValue[0]);
|
|
@@ -2377,7 +2279,7 @@
|
|
|
2377
2279
|
(_a = this.widget) === null || _a === void 0 ? void 0 : _a.setLocation(latitude, longitude);
|
|
2378
2280
|
}
|
|
2379
2281
|
break;
|
|
2380
|
-
case
|
|
2282
|
+
case this._formConfig.fieldTypes.currency:
|
|
2381
2283
|
newFinalValue = formatCurrency(this._fieldValue);
|
|
2382
2284
|
break;
|
|
2383
2285
|
default:
|
|
@@ -2396,14 +2298,16 @@
|
|
|
2396
2298
|
var HEADER = 'HEADER';
|
|
2397
2299
|
var NO_ERROR = '00';
|
|
2398
2300
|
var FormStructureAndData = /** @class */ (function () {
|
|
2399
|
-
function FormStructureAndData(definitionReceived) {
|
|
2301
|
+
function FormStructureAndData(definitionReceived, formConfig) {
|
|
2400
2302
|
var e_1, _d, e_2, _e, e_3, _f, e_4, _g;
|
|
2303
|
+
var _this = this;
|
|
2401
2304
|
this._fieldsObj = {};
|
|
2402
2305
|
this._actionsObj = {};
|
|
2403
2306
|
this._tableObj = {};
|
|
2404
2307
|
this._sectionsObj = {};
|
|
2405
2308
|
this._immutableData = {};
|
|
2406
2309
|
this._extraInfo = {};
|
|
2310
|
+
this._formConfig = formConfig;
|
|
2407
2311
|
this.state = '';
|
|
2408
2312
|
this._actions = [];
|
|
2409
2313
|
this._fields = [];
|
|
@@ -2439,7 +2343,7 @@
|
|
|
2439
2343
|
try {
|
|
2440
2344
|
for (var formActions_1 = __values(formActions), formActions_1_1 = formActions_1.next(); !formActions_1_1.done; formActions_1_1 = formActions_1.next()) {
|
|
2441
2345
|
var actionReceived = formActions_1_1.value;
|
|
2442
|
-
var globalAction = new FormAction(actionReceived);
|
|
2346
|
+
var globalAction = new FormAction(actionReceived, this._formConfig);
|
|
2443
2347
|
var globalActionCode = globalAction.actionCode;
|
|
2444
2348
|
if (globalActionCode) {
|
|
2445
2349
|
this._actions.push(globalAction);
|
|
@@ -2470,7 +2374,7 @@
|
|
|
2470
2374
|
try {
|
|
2471
2375
|
for (var formFields_1 = __values(formFields), formFields_1_1 = formFields_1.next(); !formFields_1_1.done; formFields_1_1 = formFields_1.next()) {
|
|
2472
2376
|
var fieldReceived = formFields_1_1.value;
|
|
2473
|
-
var fieldToAdd = new FieldDescriptor(fieldReceived);
|
|
2377
|
+
var fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
|
|
2474
2378
|
var fieldCode = fieldToAdd.fieldCode;
|
|
2475
2379
|
if (fieldCode) {
|
|
2476
2380
|
this._fields.push(fieldToAdd);
|
|
@@ -2497,14 +2401,14 @@
|
|
|
2497
2401
|
enabledStates = __spreadArray([], __read(visibleStates));
|
|
2498
2402
|
}
|
|
2499
2403
|
if (!visibleStates || visibleStates.length === 0) {
|
|
2500
|
-
visibleStates =
|
|
2404
|
+
visibleStates = _this._formConfig.defaultStateFlow.states;
|
|
2501
2405
|
}
|
|
2502
2406
|
return Object.assign(Object.assign({}, objDef), { visibleStates: visibleStates, enabledStates: enabledStates });
|
|
2503
2407
|
});
|
|
2504
2408
|
try {
|
|
2505
2409
|
for (var tables_1 = __values(tables), tables_1_1 = tables_1.next(); !tables_1_1.done; tables_1_1 = tables_1.next()) {
|
|
2506
2410
|
var tableReceived = tables_1_1.value;
|
|
2507
|
-
var tableToAdd = new RecordTable(tableReceived);
|
|
2411
|
+
var tableToAdd = new RecordTable(tableReceived, this._formConfig);
|
|
2508
2412
|
var tableCode = tableToAdd.tableCode;
|
|
2509
2413
|
if (tableCode) {
|
|
2510
2414
|
this._tables.push(tableToAdd);
|
|
@@ -2614,7 +2518,7 @@
|
|
|
2614
2518
|
FormStructureAndData.prototype.setStateFlow = function (states, transitions, defaultState) {
|
|
2615
2519
|
var _this = this;
|
|
2616
2520
|
if (!states || !transitions) {
|
|
2617
|
-
this._stateFlow = JSON.parse(JSON.stringify(
|
|
2521
|
+
this._stateFlow = JSON.parse(JSON.stringify(this._formConfig.defaultStateFlow));
|
|
2618
2522
|
return;
|
|
2619
2523
|
}
|
|
2620
2524
|
this._stateFlow.states = states;
|
|
@@ -3293,7 +3197,6 @@
|
|
|
3293
3197
|
this.transitionToken = null;
|
|
3294
3198
|
this.inputDataFields = [];
|
|
3295
3199
|
this.extraData = null;
|
|
3296
|
-
this.componentConstants = componentConstants;
|
|
3297
3200
|
this.definitionObtained = false;
|
|
3298
3201
|
this.formVisible = false;
|
|
3299
3202
|
this.inServerProcess = false;
|
|
@@ -3315,6 +3218,9 @@
|
|
|
3315
3218
|
this.cleanStart();
|
|
3316
3219
|
this.customPreProcessing();
|
|
3317
3220
|
}
|
|
3221
|
+
BasicFormComponent.prototype.setConfig = function (formConfig) {
|
|
3222
|
+
this.formConfig = formConfig;
|
|
3223
|
+
};
|
|
3318
3224
|
BasicFormComponent.prototype.cleanStart = function () {
|
|
3319
3225
|
this._errorType = '';
|
|
3320
3226
|
this.errorCode = '';
|
|
@@ -3657,7 +3563,7 @@
|
|
|
3657
3563
|
case 1:
|
|
3658
3564
|
formDefinition = _k.sent();
|
|
3659
3565
|
this.inServerProcess = false;
|
|
3660
|
-
this.formStructure = new FormStructureAndData(formDefinition);
|
|
3566
|
+
this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
3661
3567
|
this.definitionObtained = true;
|
|
3662
3568
|
return [3 /*break*/, 3];
|
|
3663
3569
|
case 2:
|
|
@@ -3694,7 +3600,7 @@
|
|
|
3694
3600
|
this.setFieldValue(fieldCode, fieldValue);
|
|
3695
3601
|
}
|
|
3696
3602
|
}
|
|
3697
|
-
return [4 /*yield*/, this.requestFormAction(
|
|
3603
|
+
return [4 /*yield*/, this.requestFormAction(formActions.getData)];
|
|
3698
3604
|
case 4:
|
|
3699
3605
|
recordResponse = _k.sent();
|
|
3700
3606
|
this.checkErrorRecordReceived(recordResponse);
|
|
@@ -3719,7 +3625,7 @@
|
|
|
3719
3625
|
this.errorDetail = recordResponse.errorDetail;
|
|
3720
3626
|
};
|
|
3721
3627
|
BasicFormComponent.prototype.errorOccured = function () {
|
|
3722
|
-
return (this.errorCode !==
|
|
3628
|
+
return (this.errorCode !== '00');
|
|
3723
3629
|
};
|
|
3724
3630
|
BasicFormComponent.prototype.changeState = function (state) { return this.formStructure.changeState(state); };
|
|
3725
3631
|
BasicFormComponent.prototype.changeFormMode = function (state) { return this.changeState(state); };
|
|
@@ -4178,7 +4084,7 @@
|
|
|
4178
4084
|
if (!fieldObj.backend) return [3 /*break*/, 2];
|
|
4179
4085
|
fieldObj.validating = true;
|
|
4180
4086
|
return [4 /*yield*/, this
|
|
4181
|
-
.requestFormAction(
|
|
4087
|
+
.requestFormAction(formActions.validate, fieldObj.fieldCode)];
|
|
4182
4088
|
case 1:
|
|
4183
4089
|
validationResult = _g.sent();
|
|
4184
4090
|
finish = !this.errorOccured();
|
|
@@ -4423,7 +4329,7 @@
|
|
|
4423
4329
|
actionCode: actionCode
|
|
4424
4330
|
};
|
|
4425
4331
|
return [4 /*yield*/, this
|
|
4426
|
-
.requestFormAction(
|
|
4332
|
+
.requestFormAction(formActions.tableAction, actionSubject)];
|
|
4427
4333
|
case 1:
|
|
4428
4334
|
actionResult = _g.sent();
|
|
4429
4335
|
finish = !this.errorOccured();
|
|
@@ -4554,13 +4460,13 @@
|
|
|
4554
4460
|
if (!action.backend) return [3 /*break*/, 2];
|
|
4555
4461
|
actionSubject = {
|
|
4556
4462
|
tableCode: tableCode,
|
|
4557
|
-
actionType:
|
|
4463
|
+
actionType: this.formConfig.tableActions.inline,
|
|
4558
4464
|
actionCode: actionCode,
|
|
4559
4465
|
tableRecordId: recordId,
|
|
4560
4466
|
tableRecordData: recordData
|
|
4561
4467
|
};
|
|
4562
4468
|
return [4 /*yield*/, this
|
|
4563
|
-
.requestFormAction(
|
|
4469
|
+
.requestFormAction(formActions.tableAction, actionSubject)];
|
|
4564
4470
|
case 1:
|
|
4565
4471
|
actionResult = _g.sent();
|
|
4566
4472
|
finish = !this.errorOccured();
|
|
@@ -4684,13 +4590,13 @@
|
|
|
4684
4590
|
if (!tableObject.selectionBackend) return [3 /*break*/, 2];
|
|
4685
4591
|
actionSubject = {
|
|
4686
4592
|
tableCode: tableCode,
|
|
4687
|
-
actionType:
|
|
4593
|
+
actionType: this.formConfig.tableActions.rowSelection,
|
|
4688
4594
|
actionCode: null,
|
|
4689
4595
|
tableRecordId: recordId,
|
|
4690
4596
|
tableRecordData: recordData
|
|
4691
4597
|
};
|
|
4692
4598
|
return [4 /*yield*/, this
|
|
4693
|
-
.requestFormAction(
|
|
4599
|
+
.requestFormAction(formActions.tableAction, actionSubject)];
|
|
4694
4600
|
case 1:
|
|
4695
4601
|
actionResult = _g.sent();
|
|
4696
4602
|
finish = !this.errorOccured();
|
|
@@ -4815,12 +4721,12 @@
|
|
|
4815
4721
|
if (!action.backend) return [3 /*break*/, 2];
|
|
4816
4722
|
actionSubject = {
|
|
4817
4723
|
tableCode: tableCode,
|
|
4818
|
-
actionType:
|
|
4724
|
+
actionType: this.formConfig.tableActions.selection,
|
|
4819
4725
|
actionCode: actionCode,
|
|
4820
4726
|
selectedRecords: selectedRecords
|
|
4821
4727
|
};
|
|
4822
4728
|
return [4 /*yield*/, this
|
|
4823
|
-
.requestFormAction(
|
|
4729
|
+
.requestFormAction(formActions.tableAction, actionSubject)];
|
|
4824
4730
|
case 1:
|
|
4825
4731
|
actionResult = _g.sent();
|
|
4826
4732
|
finish = !this.errorOccured();
|
|
@@ -4929,7 +4835,7 @@
|
|
|
4929
4835
|
tableObject.putOnWait();
|
|
4930
4836
|
actionSubject = { tableCode: tableCode };
|
|
4931
4837
|
return [4 /*yield*/, this
|
|
4932
|
-
.requestFormAction(
|
|
4838
|
+
.requestFormAction(formActions.getTableData, actionSubject)];
|
|
4933
4839
|
case 1:
|
|
4934
4840
|
actionResult = _g.sent();
|
|
4935
4841
|
if (this.errorOccured()) {
|
|
@@ -4989,15 +4895,15 @@
|
|
|
4989
4895
|
this.resetError();
|
|
4990
4896
|
var completeFields = this.checkSectionRequiredFields(sectionCode, reqFieldMessage);
|
|
4991
4897
|
if (!completeFields) {
|
|
4992
|
-
this.setError(
|
|
4898
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
4993
4899
|
return;
|
|
4994
4900
|
}
|
|
4995
4901
|
var validationError = false;
|
|
4996
4902
|
var requiredEmptyFields = this.getRequiredEmptyFields(null, sectionCode);
|
|
4997
4903
|
if (requiredEmptyFields.length > 0) {
|
|
4998
4904
|
validationError = true;
|
|
4999
|
-
this.setError(
|
|
5000
|
-
this.tagFieldsWithError(requiredEmptyFields, null,
|
|
4905
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
4906
|
+
this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
|
|
5001
4907
|
try {
|
|
5002
4908
|
for (var requiredEmptyFields_1 = __values(requiredEmptyFields), requiredEmptyFields_1_1 = requiredEmptyFields_1.next(); !requiredEmptyFields_1_1.done; requiredEmptyFields_1_1 = requiredEmptyFields_1.next()) {
|
|
5003
4909
|
var fieldCode = requiredEmptyFields_1_1.value;
|
|
@@ -5020,7 +4926,7 @@
|
|
|
5020
4926
|
var validationIssueFields = this.getFieldsWithValidationIssues(null, sectionCode);
|
|
5021
4927
|
if (!validationError && validationIssueFields.length > 0) {
|
|
5022
4928
|
validationError = true;
|
|
5023
|
-
this.setError(
|
|
4929
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
5024
4930
|
try {
|
|
5025
4931
|
for (var validationIssueFields_1 = __values(validationIssueFields), validationIssueFields_1_1 = validationIssueFields_1.next(); !validationIssueFields_1_1.done; validationIssueFields_1_1 = validationIssueFields_1.next()) {
|
|
5026
4932
|
var fieldCode = validationIssueFields_1_1.value;
|
|
@@ -5182,13 +5088,13 @@
|
|
|
5182
5088
|
var requiredEmptyFields = this.getRequiredEmptyFields(recordCaptureFields, null);
|
|
5183
5089
|
if (requiredEmptyFields.length > 0) {
|
|
5184
5090
|
validationOk = false;
|
|
5185
|
-
this.setError(
|
|
5186
|
-
this.tagFieldsWithError(requiredEmptyFields, null,
|
|
5091
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
5092
|
+
this.tagFieldsWithError(requiredEmptyFields, null, this.formConfig.formStandardErrors.requiredField);
|
|
5187
5093
|
}
|
|
5188
5094
|
var validationIssueFields = this.getFieldsWithValidationIssues(recordCaptureFields, null);
|
|
5189
5095
|
if (validationIssueFields.length > 0) {
|
|
5190
5096
|
validationOk = false;
|
|
5191
|
-
this.setError(
|
|
5097
|
+
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
5192
5098
|
}
|
|
5193
5099
|
return validationOk;
|
|
5194
5100
|
};
|