tuain-ng-forms-lib 14.1.2 → 14.3.0
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/esm2020/lib/classes/forms/element.mjs +9 -3
- package/esm2020/lib/classes/forms/field.mjs +325 -243
- package/esm2020/lib/classes/forms/form.mjs +26 -26
- package/esm2020/lib/classes/forms/subsection.mjs +2 -2
- package/esm2020/lib/components/elements/action.component.mjs +3 -3
- package/esm2020/lib/components/elements/field.component.mjs +38 -46
- package/esm2020/lib/components/elements/layout/element.component.mjs +3 -3
- package/esm2020/lib/components/elements/layout/form-error.component.mjs +3 -3
- package/esm2020/lib/components/elements/layout/form-header.component.mjs +3 -3
- package/esm2020/lib/components/elements/layout/section.component.mjs +3 -3
- package/esm2020/lib/components/elements/layout/sub-section.component.mjs +3 -3
- package/esm2020/lib/components/elements/tables/table-record-action.component.mjs +3 -3
- package/esm2020/lib/components/elements/tables/table-record-field.component.mjs +3 -3
- package/esm2020/lib/components/elements/tables/table.component.mjs +3 -3
- package/esm2020/lib/components/forms/basic-form.mjs +76 -37
- package/esm2020/lib/tuain-ng-forms-lib.module.mjs +7 -9
- package/fesm2015/tuain-ng-forms-lib.mjs +511 -391
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +503 -385
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/element.d.ts +7 -6
- package/lib/classes/forms/field.d.ts +168 -72
- package/lib/classes/forms/form.d.ts +1 -1
- package/lib/components/elements/action.component.d.ts +1 -1
- package/lib/components/elements/field.component.d.ts +11 -11
- package/lib/components/elements/layout/element.component.d.ts +1 -1
- package/lib/components/elements/layout/form-error.component.d.ts +1 -1
- package/lib/components/elements/layout/form-header.component.d.ts +1 -1
- package/lib/components/elements/layout/section.component.d.ts +1 -1
- package/lib/components/elements/layout/sub-section.component.d.ts +1 -1
- package/lib/components/elements/tables/table-record-action.component.d.ts +1 -1
- package/lib/components/elements/tables/table-record-field.component.d.ts +1 -1
- package/lib/components/elements/tables/table.component.d.ts +1 -1
- package/lib/components/forms/basic-form.d.ts +9 -5
- package/package.json +1 -1
|
@@ -47,9 +47,9 @@ class ActionComponent {
|
|
|
47
47
|
return !((_a = this.action) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
ActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
51
|
-
ActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
52
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
50
|
+
ActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ActionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
51
|
+
ActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: ActionComponent, selector: "lib-action", inputs: { action: "action", busy: "busy", relatedField: "relatedField", state: "state", style: "style", showLabel: "showLabel" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ActionComponent, decorators: [{
|
|
53
53
|
type: Component,
|
|
54
54
|
args: [{
|
|
55
55
|
selector: 'lib-action',
|
|
@@ -72,28 +72,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImpor
|
|
|
72
72
|
const VALUE = 'value';
|
|
73
73
|
const FOCUS = 'focus';
|
|
74
74
|
class FieldComponent {
|
|
75
|
+
constructor() {
|
|
76
|
+
// Atributos obtenidos estáticamente
|
|
77
|
+
this.code = '';
|
|
78
|
+
this.info = '';
|
|
79
|
+
this.alignment = '';
|
|
80
|
+
this.tooltip = '';
|
|
81
|
+
this.field = null;
|
|
82
|
+
}
|
|
75
83
|
ngOnInit() {
|
|
76
|
-
var _a, _b;
|
|
77
|
-
if (this.field) {
|
|
78
|
-
|
|
79
|
-
// Inicialización
|
|
80
|
-
const mapping = Object.entries(this.formConfig.componentFieldAttrMap);
|
|
81
|
-
for (let index = 0; index < mapping.length; index++) {
|
|
82
|
-
const [fieldAttr1, compAttr1] = mapping[index];
|
|
83
|
-
const compAttr = compAttr1.toString();
|
|
84
|
-
const fieldAttr = fieldAttr1.toString();
|
|
85
|
-
const attributeValue = (_b = this.field) === null || _b === void 0 ? void 0 : _b[fieldAttr];
|
|
86
|
-
this.dafaultProcessFieldChange(compAttr, attributeValue);
|
|
87
|
-
this.processFieldChange(compAttr, attributeValue);
|
|
88
|
-
}
|
|
89
|
-
// Subscripción a cambios en atributos
|
|
90
|
-
this.field.attributeChange.subscribe(event => {
|
|
91
|
-
const { name: fieldAttr, value } = event;
|
|
92
|
-
const compAttr = this.formConfig.componentFieldAttrMap[fieldAttr];
|
|
93
|
-
this.dafaultProcessFieldChange(compAttr, value);
|
|
94
|
-
this.processFieldChange(compAttr, value);
|
|
95
|
-
});
|
|
84
|
+
var _a, _b, _c;
|
|
85
|
+
if (!this.field) {
|
|
86
|
+
return;
|
|
96
87
|
}
|
|
88
|
+
this.formConfig = (_a = this.field) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
89
|
+
// Inicialización
|
|
90
|
+
const mapping = this.formConfig.fieldPropagateAttributes;
|
|
91
|
+
for (let index = 0; index < mapping.length; index++) {
|
|
92
|
+
const attrName = mapping[index].toString();
|
|
93
|
+
const attributeValue = (_b = this.field) === null || _b === void 0 ? void 0 : _b[attrName];
|
|
94
|
+
this.dafaultProcessFieldChange(attrName, attributeValue);
|
|
95
|
+
this.processFieldChange(attrName, attributeValue);
|
|
96
|
+
}
|
|
97
|
+
// Subscripción a cambios en atributos
|
|
98
|
+
(_c = this.field) === null || _c === void 0 ? void 0 : _c.attributeChange.subscribe(event => {
|
|
99
|
+
const { name: attrName, value } = event;
|
|
100
|
+
this.dafaultProcessFieldChange(attrName, value);
|
|
101
|
+
this.processFieldChange(attrName, value);
|
|
102
|
+
});
|
|
97
103
|
this.start();
|
|
98
104
|
}
|
|
99
105
|
dafaultProcessFieldChange(attribute, value) {
|
|
@@ -107,48 +113,34 @@ class FieldComponent {
|
|
|
107
113
|
this[attribute] = value;
|
|
108
114
|
}
|
|
109
115
|
}
|
|
116
|
+
get visible() { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state); }
|
|
117
|
+
get disabled() { var _a; return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state)); }
|
|
118
|
+
updateValue() { var _a; this.value = (_a = this.field) === null || _a === void 0 ? void 0 : _a.value; }
|
|
119
|
+
onInputChange() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionPartial(); }, 50); }
|
|
120
|
+
onChangeContent() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionFinish(); }, 50); }
|
|
121
|
+
onShowInfo(detail = null) { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionDetailRequest(detail); }, 50); }
|
|
110
122
|
processFieldChange(attribute, value) { }
|
|
111
123
|
start() { }
|
|
112
124
|
focus() { }
|
|
113
|
-
updateObject() {
|
|
114
|
-
this.field.setValue(this.value);
|
|
115
|
-
}
|
|
125
|
+
updateObject() { var _a; (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value); }
|
|
116
126
|
inputChanged() {
|
|
117
|
-
|
|
127
|
+
var _a;
|
|
128
|
+
(_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value);
|
|
118
129
|
this.onChangeContent();
|
|
119
130
|
}
|
|
120
131
|
inputTyped() {
|
|
121
|
-
|
|
132
|
+
var _a;
|
|
133
|
+
(_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value);
|
|
122
134
|
this.onInputChange();
|
|
123
135
|
}
|
|
124
|
-
updateValue() {
|
|
125
|
-
this.value = this.field.getValue();
|
|
126
|
-
}
|
|
127
|
-
onInputChange() {
|
|
128
|
-
setTimeout(() => this.field.notifyEditionPartial(), 50);
|
|
129
|
-
}
|
|
130
|
-
onChangeContent() {
|
|
131
|
-
setTimeout(() => this.field.notifyEditionFinish(), 50);
|
|
132
|
-
}
|
|
133
|
-
onShowInfo(detail = null) {
|
|
134
|
-
setTimeout(() => this.field.notifyEditionDetailRequest(detail), 50);
|
|
135
|
-
}
|
|
136
136
|
numberInputValidation(event) {
|
|
137
137
|
const k = event.charCode;
|
|
138
138
|
return (k > 47 && k < 58);
|
|
139
139
|
}
|
|
140
|
-
get visible() {
|
|
141
|
-
var _a;
|
|
142
|
-
return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state);
|
|
143
|
-
}
|
|
144
|
-
get disabled() {
|
|
145
|
-
var _a;
|
|
146
|
-
return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
|
|
147
|
-
}
|
|
148
140
|
}
|
|
149
|
-
FieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
150
|
-
FieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
151
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
141
|
+
FieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
142
|
+
FieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: FieldComponent, selector: "lib-field", inputs: { field: "field", state: "state" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FieldComponent, decorators: [{
|
|
152
144
|
type: Component,
|
|
153
145
|
args: [{
|
|
154
146
|
selector: 'lib-field',
|
|
@@ -176,9 +168,9 @@ class ElementComponent {
|
|
|
176
168
|
return !((_a = this.element) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
|
|
177
169
|
}
|
|
178
170
|
}
|
|
179
|
-
ElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
180
|
-
ElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
181
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
171
|
+
ElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ElementComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
172
|
+
ElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: ElementComponent, selector: "lib-element", inputs: { element: "element", form: "form", state: "state" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
173
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ElementComponent, decorators: [{
|
|
182
174
|
type: Component,
|
|
183
175
|
args: [{
|
|
184
176
|
selector: 'lib-element',
|
|
@@ -194,9 +186,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImpor
|
|
|
194
186
|
|
|
195
187
|
class FormErrorComponent {
|
|
196
188
|
}
|
|
197
|
-
FormErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
198
|
-
FormErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
199
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
189
|
+
FormErrorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FormErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
190
|
+
FormErrorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: FormErrorComponent, selector: "lib-form-error", inputs: { errorTitle: "errorTitle", errorMessage: "errorMessage", errorType: "errorType" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
191
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FormErrorComponent, decorators: [{
|
|
200
192
|
type: Component,
|
|
201
193
|
args: [{
|
|
202
194
|
selector: 'lib-form-error',
|
|
@@ -219,9 +211,9 @@ class FormHeaderComponent {
|
|
|
219
211
|
this.goBackEvent.emit();
|
|
220
212
|
}
|
|
221
213
|
}
|
|
222
|
-
FormHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
223
|
-
FormHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
224
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
214
|
+
FormHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FormHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
215
|
+
FormHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: FormHeaderComponent, selector: "lib-form-header", inputs: { formManager: "formManager", goBackAction: "goBackAction", showTitle: "showTitle", headerActions: "headerActions" }, outputs: { goBackEvent: "goBackEvent" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FormHeaderComponent, decorators: [{
|
|
225
217
|
type: Component,
|
|
226
218
|
args: [{
|
|
227
219
|
selector: 'lib-form-header',
|
|
@@ -245,9 +237,9 @@ class SectionComponent {
|
|
|
245
237
|
}
|
|
246
238
|
start() { }
|
|
247
239
|
}
|
|
248
|
-
SectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
249
|
-
SectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
250
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
240
|
+
SectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
241
|
+
SectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: SectionComponent, selector: "lib-section", inputs: { section: "section", formManager: "formManager" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SectionComponent, decorators: [{
|
|
251
243
|
type: Component,
|
|
252
244
|
args: [{
|
|
253
245
|
selector: 'lib-section',
|
|
@@ -265,9 +257,9 @@ class SubSectionComponent {
|
|
|
265
257
|
}
|
|
266
258
|
start() { }
|
|
267
259
|
}
|
|
268
|
-
SubSectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
269
|
-
SubSectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
270
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
260
|
+
SubSectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SubSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
261
|
+
SubSectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: SubSectionComponent, selector: "lib-subsection", inputs: { subSection: "subSection", showHeader: "showHeader", formManager: "formManager" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
262
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SubSectionComponent, decorators: [{
|
|
271
263
|
type: Component,
|
|
272
264
|
args: [{
|
|
273
265
|
selector: 'lib-subsection',
|
|
@@ -300,9 +292,9 @@ class LibTableRecordActionComponent {
|
|
|
300
292
|
}
|
|
301
293
|
class() { }
|
|
302
294
|
}
|
|
303
|
-
LibTableRecordActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
304
|
-
LibTableRecordActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
305
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
295
|
+
LibTableRecordActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordActionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
296
|
+
LibTableRecordActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: LibTableRecordActionComponent, selector: "lib-table-record-action", inputs: { recordId: "recordId", recordData: "recordData", action: "action" }, outputs: { actionSelected: "actionSelected" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
297
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordActionComponent, decorators: [{
|
|
306
298
|
type: Component,
|
|
307
299
|
args: [{
|
|
308
300
|
selector: 'lib-table-record-action',
|
|
@@ -325,9 +317,9 @@ class LibTableRecordFieldComponent {
|
|
|
325
317
|
}
|
|
326
318
|
start() { }
|
|
327
319
|
}
|
|
328
|
-
LibTableRecordFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
329
|
-
LibTableRecordFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
330
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
320
|
+
LibTableRecordFieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
321
|
+
LibTableRecordFieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: LibTableRecordFieldComponent, selector: "lib-table-record-field", inputs: { fieldCode: "fieldCode", fieldType: "fieldType", fieldValue: "fieldValue" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordFieldComponent, decorators: [{
|
|
331
323
|
type: Component,
|
|
332
324
|
args: [{
|
|
333
325
|
selector: 'lib-table-record-field',
|
|
@@ -417,9 +409,9 @@ class LibTableComponent {
|
|
|
417
409
|
}
|
|
418
410
|
}
|
|
419
411
|
}
|
|
420
|
-
LibTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
421
|
-
LibTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
422
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
412
|
+
LibTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
413
|
+
LibTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: LibTableComponent, selector: "lib-table", inputs: { table: "table", tableRecords: "tableRecords", disabled: "disabled", state: "state", waiting: "waiting" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableComponent, decorators: [{
|
|
423
415
|
type: Component,
|
|
424
416
|
args: [{
|
|
425
417
|
selector: 'lib-table',
|
|
@@ -467,6 +459,10 @@ const operators = {
|
|
|
467
459
|
class FormElement {
|
|
468
460
|
constructor(elementDefinition, formConfig) {
|
|
469
461
|
var _a, _b, _c;
|
|
462
|
+
this._visible = true;
|
|
463
|
+
this.visibleStates = null;
|
|
464
|
+
this.enabledStates = null;
|
|
465
|
+
this.elementType = null;
|
|
470
466
|
this._formConfig = formConfig;
|
|
471
467
|
this._isForced = false;
|
|
472
468
|
this.setVisibleStates(elementDefinition.visibleStates);
|
|
@@ -476,6 +472,7 @@ class FormElement {
|
|
|
476
472
|
this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
|
|
477
473
|
this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : {};
|
|
478
474
|
}
|
|
475
|
+
;
|
|
479
476
|
getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
|
|
480
477
|
setCustomAttribute(name, value) {
|
|
481
478
|
if (name) {
|
|
@@ -522,14 +519,14 @@ class FormElement {
|
|
|
522
519
|
this._isForced = forced;
|
|
523
520
|
}
|
|
524
521
|
}
|
|
525
|
-
show(forced) {
|
|
522
|
+
show(forced = null) {
|
|
526
523
|
this._visible = true;
|
|
527
524
|
if (forced !== null) {
|
|
528
525
|
this._isForced = forced;
|
|
529
526
|
this._visibleForced = true;
|
|
530
527
|
}
|
|
531
528
|
}
|
|
532
|
-
hide(forced) {
|
|
529
|
+
hide(forced = null) {
|
|
533
530
|
this._visible = false;
|
|
534
531
|
if (forced !== null) {
|
|
535
532
|
this._isForced = forced;
|
|
@@ -540,6 +537,7 @@ class FormElement {
|
|
|
540
537
|
disable() { this.disabled = true; }
|
|
541
538
|
get enabled() { return !this.disabled; }
|
|
542
539
|
get editable() { return !this.disabled; }
|
|
540
|
+
set editable(editable) { this.disabled = !editable; }
|
|
543
541
|
}
|
|
544
542
|
|
|
545
543
|
const HEADER = 'HEADER';
|
|
@@ -581,35 +579,40 @@ const DEFAULT_CAPTURE_TYPE = 'INPUT';
|
|
|
581
579
|
const DEFAULT_ALIGNMENT = 'left';
|
|
582
580
|
const STD_MAX_LENGTH = 50;
|
|
583
581
|
const BIG_MAX_LENGTH = 500;
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
minValue
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
582
|
+
const directChanges = [
|
|
583
|
+
'defaultEditable', 'defaultValue', 'alignment', 'required', 'errorCode', 'errorMessage', 'errorType',
|
|
584
|
+
'tooltip', 'info', 'format', 'intrinsicErrorMessage', 'outputOnly', 'captureType', 'title', 'type',
|
|
585
|
+
'maxLength', 'maxValue', 'minLength', 'minValue', 'validateOnServer', 'serverAction', 'visibleLabel',
|
|
586
|
+
'options',
|
|
587
|
+
];
|
|
588
|
+
const attrs = {
|
|
589
|
+
_captureType: { name: '_captureType', propagate: 'captureType' },
|
|
590
|
+
_errorCode: { name: '_errorCode', propagate: 'errorCode' },
|
|
591
|
+
_errorMessage: { name: '_errorMessage', propagate: 'errorMessage' },
|
|
592
|
+
_errorType: { name: '_errorType', propagate: 'errorType' },
|
|
593
|
+
_defaultValue: { name: '_defaultValue', propagate: 'defaultValue' },
|
|
594
|
+
_defaultEditable: { name: '_defaultEditable', propagate: 'defaultEditable' },
|
|
595
|
+
_fieldAlignment: { name: '_fieldAlignment', propagate: 'alignment' },
|
|
596
|
+
_fieldCode: { name: '_fieldCode', propagate: 'code' },
|
|
597
|
+
_fieldInfo: { name: '_fieldInfo', propagate: 'info' },
|
|
598
|
+
_fieldRequired: { name: '_fieldRequired', propagate: 'required' },
|
|
599
|
+
_fieldTitle: { name: '_fieldTitle', propagate: 'title' },
|
|
600
|
+
_fieldType: { name: '_fieldType', propagate: 'type' },
|
|
601
|
+
_fieldFormat: { name: '_fieldFormat', propagate: 'format' },
|
|
602
|
+
_fieldOptions: { name: '_fieldOptions', propagate: 'options' },
|
|
603
|
+
_focus: { name: '_focus', propagate: 'focus' },
|
|
604
|
+
_hasChanged: { name: '_hasChanged', propagate: 'hasChanged' },
|
|
605
|
+
_intrinsicErrorMessage: { name: '_intrinsicErrorMessage', propagate: null },
|
|
606
|
+
_maxLength: { name: '_maxLength', propagate: 'maxLength' },
|
|
607
|
+
_maxValue: { name: '_maxValue', propagate: 'maxValue' },
|
|
608
|
+
_minLength: { name: '_minLength', propagate: 'minLength' },
|
|
609
|
+
_minValue: { name: '_minValue', propagate: 'minValue' },
|
|
610
|
+
_onValidation: { name: '_onValidation', propagate: 'onValidation' },
|
|
611
|
+
_outputOnly: { name: '_outputOnly', propagate: 'outputOnly' },
|
|
612
|
+
_tooltipText: { name: '_tooltipText', propagate: 'tooltip' },
|
|
613
|
+
_validateOnServer: { name: '_validateOnServer', propagate: 'validateOnServer' },
|
|
614
|
+
_value: { name: '_value', propagate: 'value' },
|
|
615
|
+
_visibleLabel: { name: '_visibleLabel', propagate: 'visibleLabel' },
|
|
613
616
|
};
|
|
614
617
|
class FieldDescriptor extends FormElement {
|
|
615
618
|
constructor(inputFieldReceived, formConfig) {
|
|
@@ -619,48 +622,48 @@ class FieldDescriptor extends FormElement {
|
|
|
619
622
|
this._editionPartial = new Subject();
|
|
620
623
|
this._detailRequest = new Subject();
|
|
621
624
|
this._attributeChange = new Subject();
|
|
622
|
-
this.
|
|
623
|
-
this.
|
|
625
|
+
this._errorType = '';
|
|
626
|
+
this._errorCode = '';
|
|
627
|
+
this._errorMessage = '';
|
|
628
|
+
this._fieldCode = '';
|
|
629
|
+
this._intrinsicErrorMessage = '';
|
|
624
630
|
this._maxLength = 0;
|
|
625
631
|
this._minLength = 0;
|
|
632
|
+
this._focus = false;
|
|
626
633
|
this._onValidation = false;
|
|
627
|
-
this.
|
|
628
|
-
this.
|
|
629
|
-
this.
|
|
630
|
-
this.
|
|
631
|
-
this.
|
|
632
|
-
this.
|
|
633
|
-
this.
|
|
634
|
-
this.
|
|
635
|
-
this.
|
|
636
|
-
this.
|
|
637
|
-
this.
|
|
638
|
-
this.
|
|
639
|
-
this.
|
|
640
|
-
this.
|
|
641
|
-
this.
|
|
642
|
-
this.errorType = '';
|
|
643
|
-
this.errorCode = '';
|
|
644
|
-
this.errorMessage = '';
|
|
645
|
-
this.fieldOptions = null;
|
|
634
|
+
this._validateOnServer = false;
|
|
635
|
+
this._visibleLabel = false;
|
|
636
|
+
this._captureType = '';
|
|
637
|
+
this._defaultValue = '';
|
|
638
|
+
this._defaultEditable = false;
|
|
639
|
+
this._fieldAlignment = '';
|
|
640
|
+
this._fieldInfo = '';
|
|
641
|
+
this._fieldRequired = false;
|
|
642
|
+
this._fieldTitle = '';
|
|
643
|
+
this._fieldType = '';
|
|
644
|
+
this._fieldFormat = null;
|
|
645
|
+
this._fieldOptions = null;
|
|
646
|
+
this._hasChanged = false;
|
|
647
|
+
this._outputOnly = false;
|
|
648
|
+
this._tooltipText = '';
|
|
646
649
|
this.elementType = elementTypes.field;
|
|
647
650
|
const fld = (inputFieldReceived) ? inputFieldReceived : {};
|
|
648
|
-
this.setAttr(
|
|
649
|
-
this.
|
|
650
|
-
this.
|
|
651
|
-
this.
|
|
651
|
+
this.setAttr(attrs._fieldCode, fld.fieldCode);
|
|
652
|
+
this.title = (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : this._fieldCode;
|
|
653
|
+
this.type = fld.fieldTypeCode;
|
|
654
|
+
this.captureType = (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE;
|
|
652
655
|
const defaultValue = (_c = fld.defaultValue) !== null && _c !== void 0 ? _c : null;
|
|
653
|
-
if (this.
|
|
654
|
-
this.
|
|
656
|
+
if (this._fieldType === this._formConfig.fieldTypes.boolean) {
|
|
657
|
+
this.defaultValue = defaultValue !== null && defaultValue !== void 0 ? defaultValue : false;
|
|
655
658
|
}
|
|
656
659
|
else {
|
|
657
|
-
this.
|
|
660
|
+
this.defaultValue = defaultValue;
|
|
658
661
|
}
|
|
659
|
-
const defaultTypeAlignment = (this._formConfig.tableFieldStyles[this.
|
|
660
|
-
? this._formConfig.tableFieldStyles[this.
|
|
662
|
+
const defaultTypeAlignment = (this._formConfig.tableFieldStyles[this._fieldType] != null)
|
|
663
|
+
? this._formConfig.tableFieldStyles[this._fieldType]['text-align'] : DEFAULT_ALIGNMENT;
|
|
661
664
|
const fieldAlignment = (fld.alignment != null) ? fld.alignment.toLowerCase() : defaultTypeAlignment;
|
|
662
|
-
this.
|
|
663
|
-
this.
|
|
665
|
+
this.alignment = fieldAlignment;
|
|
666
|
+
this.info = fld.info || '';
|
|
664
667
|
let fieldFormat;
|
|
665
668
|
try {
|
|
666
669
|
fieldFormat = (fld.format) ? new RegExp(fld.format) : null;
|
|
@@ -668,70 +671,256 @@ class FieldDescriptor extends FormElement {
|
|
|
668
671
|
catch (e) {
|
|
669
672
|
fieldFormat = null;
|
|
670
673
|
}
|
|
671
|
-
this.
|
|
672
|
-
this.
|
|
673
|
-
this.
|
|
674
|
-
this.
|
|
675
|
-
this.
|
|
676
|
-
this.
|
|
677
|
-
this.
|
|
678
|
-
|
|
679
|
-
this.
|
|
680
|
-
const intrinsicErrorMessage = (_r = (_m = (_l = (_k = (_j = this._formConfig) === null || _j === void 0 ? void 0 : _j.fieldValidations) === null || _k === void 0 ? void 0 : _k[this.fieldType]) === null || _l === void 0 ? void 0 : _l.message) !== null && _m !== void 0 ? _m : (_q = (_p = (_o = this._formConfig) === null || _o === void 0 ? void 0 : _o.fieldValidations) === null || _p === void 0 ? void 0 : _p.DEFAULT) === null || _q === void 0 ? void 0 : _q.message) !== null && _r !== void 0 ? _r : '';
|
|
681
|
-
this.setAttr(fldAttr.intrinsicErrorMessage, intrinsicErrorMessage);
|
|
674
|
+
this.format = fieldFormat;
|
|
675
|
+
this.validateOnServer = (_d = fld.serverAction) !== null && _d !== void 0 ? _d : false;
|
|
676
|
+
this.tooltip = fld.tooltip || '';
|
|
677
|
+
this.defaultEditable = this.enabled;
|
|
678
|
+
this.required = (_e = fld.required) !== null && _e !== void 0 ? _e : false;
|
|
679
|
+
this.outputOnly = (_f = fld.outputOnly) !== null && _f !== void 0 ? _f : false;
|
|
680
|
+
this.maxLength = (_g = fld.maxLength) !== null && _g !== void 0 ? _g : (this._captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
681
|
+
this.intrinsicErrorMessage = (_q = (_l = (_k = (_j = (_h = this._formConfig) === null || _h === void 0 ? void 0 : _h.fieldValidations) === null || _j === void 0 ? void 0 : _j[this._fieldType]) === null || _k === void 0 ? void 0 : _k.message) !== null && _l !== void 0 ? _l : (_p = (_o = (_m = this._formConfig) === null || _m === void 0 ? void 0 : _m.fieldValidations) === null || _o === void 0 ? void 0 : _o.DEFAULT) === null || _p === void 0 ? void 0 : _p.message) !== null && _q !== void 0 ? _q : '';
|
|
682
|
+
this.setError(fld.errorCode, fld.errorMessage, (_r = fld.errorType) !== null && _r !== void 0 ? _r : DEFAULT_ERROR_TYPE);
|
|
682
683
|
this.setEditable((_s = fld.editable) !== null && _s !== void 0 ? _s : true);
|
|
683
|
-
this.
|
|
684
|
+
this.visibleLabel = (_t = fld.visibleLabel) !== null && _t !== void 0 ? _t : true;
|
|
684
685
|
this.setVisibility(fld.visible);
|
|
685
|
-
this.
|
|
686
|
-
this.
|
|
686
|
+
this.options = fld.fieldOptions;
|
|
687
|
+
this._setValue((_v = (_u = fld.fieldValue) !== null && _u !== void 0 ? _u : this._defaultValue) !== null && _v !== void 0 ? _v : '');
|
|
687
688
|
}
|
|
688
|
-
get
|
|
689
|
-
|
|
689
|
+
get alignment() { return this._fieldAlignment; }
|
|
690
|
+
set alignment(alignment) { this.setAttr(attrs._fieldAlignment, alignment); }
|
|
690
691
|
get attributeChange() { return this._attributeChange; }
|
|
691
|
-
get
|
|
692
|
+
get backend() { return this._validateOnServer; }
|
|
693
|
+
get captureType() { return this._captureType; }
|
|
694
|
+
set captureType(captureType) { this.setAttr(attrs._captureType, captureType); }
|
|
695
|
+
get code() { return this._fieldCode; }
|
|
696
|
+
get fieldCode() { return this._fieldCode; }
|
|
697
|
+
get defaultValue() { return this._defaultValue; }
|
|
698
|
+
set defaultValue(defaultValue) { this.setAttr(attrs._defaultValue, defaultValue); }
|
|
699
|
+
get defaultEditable() { return this._defaultEditable; }
|
|
700
|
+
set defaultEditable(editable) { this.setAttr(attrs._defaultEditable, editable); }
|
|
692
701
|
get detailRequest() { return this._detailRequest; }
|
|
693
|
-
get
|
|
694
|
-
get
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
702
|
+
get editionFinish() { return this._editionFinish; }
|
|
703
|
+
get editionPartial() { return this._editionPartial; }
|
|
704
|
+
get empty() {
|
|
705
|
+
const fieldCurrentValue = this.value;
|
|
706
|
+
if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
|
|
707
|
+
return true;
|
|
708
|
+
}
|
|
709
|
+
if (this._fieldType === this._formConfig.fieldTypes.array
|
|
710
|
+
&& Array.isArray(fieldCurrentValue) && fieldCurrentValue.length === 0) {
|
|
711
|
+
return true;
|
|
712
|
+
}
|
|
713
|
+
;
|
|
714
|
+
if (this._fieldType === this._formConfig.fieldTypes.phone) {
|
|
715
|
+
if (!Array.isArray(fieldCurrentValue)) {
|
|
716
|
+
return true;
|
|
717
|
+
}
|
|
718
|
+
if (fieldCurrentValue.length !== 2 || !fieldCurrentValue[0] || !fieldCurrentValue[1]) {
|
|
719
|
+
return true;
|
|
720
|
+
}
|
|
721
|
+
return false;
|
|
722
|
+
}
|
|
723
|
+
;
|
|
724
|
+
return fieldCurrentValue === '';
|
|
707
725
|
}
|
|
726
|
+
get error() { return { type: this._errorType, code: this._errorCode, message: this._errorMessage }; }
|
|
727
|
+
set error(errorObj) { var _a; this.setError(errorObj.code, errorObj.message, (_a = errorObj.type) !== null && _a !== void 0 ? _a : DEFAULT_ERROR_TYPE); }
|
|
728
|
+
get errorCode() { return this._errorCode; }
|
|
729
|
+
set errorCode(code) { this.setError(code, this._errorMessage); }
|
|
730
|
+
get errorMessage() { return this._errorMessage; }
|
|
731
|
+
set errorMessage(msg) { this.setError(this._errorCode, msg); }
|
|
732
|
+
get errorType() { return this._errorType; }
|
|
733
|
+
get externalValue() { return this._externalValue; }
|
|
734
|
+
get format() { return this._fieldFormat; }
|
|
735
|
+
set format(format) { this.setAttr(attrs._fieldFormat, format); }
|
|
736
|
+
get hasChanged() { return this._hasChanged; }
|
|
737
|
+
set hasChanged(hasChanged) { this.setAttr(attrs._hasChanged, hasChanged); }
|
|
738
|
+
get info() { return this._fieldInfo; }
|
|
739
|
+
set info(newInfo) { this.setAttr(attrs._fieldInfo, newInfo); }
|
|
740
|
+
set intrinsicErrorMessage(message) { this.setAttr(attrs._intrinsicErrorMessage, message); }
|
|
708
741
|
get maxLength() { return (this._maxLength > 0) ? this._maxLength.toString() : ''; }
|
|
709
|
-
set maxLength(requiredMaxLength) {
|
|
710
|
-
|
|
711
|
-
|
|
742
|
+
set maxLength(requiredMaxLength) { this.setAttr(attrs._maxLength, +requiredMaxLength); }
|
|
743
|
+
get maxValue() { return this._maxValue; }
|
|
744
|
+
set maxValue(inputMaxValue) {
|
|
745
|
+
let maxValue = inputMaxValue;
|
|
746
|
+
if (this._fieldType === this._formConfig.fieldTypes.date) {
|
|
747
|
+
maxValue = new Date(maxValue);
|
|
712
748
|
}
|
|
713
|
-
|
|
714
|
-
|
|
749
|
+
this.setAttr(attrs._maxValue, maxValue);
|
|
750
|
+
}
|
|
751
|
+
get minLength() { return this._minLength; }
|
|
752
|
+
set minLength(requiredMinLength) { this.setAttr(attrs._minLength, +requiredMinLength); }
|
|
753
|
+
get minValue() { return this._minValue; }
|
|
754
|
+
set minValue(inputMinValue) {
|
|
755
|
+
let minValue = inputMinValue;
|
|
756
|
+
if (this._fieldType === this._formConfig.fieldTypes.date) {
|
|
757
|
+
minValue = new Date(minValue);
|
|
715
758
|
}
|
|
759
|
+
this.setAttr(attrs._minValue, minValue);
|
|
716
760
|
}
|
|
717
|
-
get
|
|
718
|
-
|
|
761
|
+
get name() { return this._fieldCode; }
|
|
762
|
+
get options() {
|
|
763
|
+
var _a, _b;
|
|
764
|
+
return (_b = (_a = this._fieldOptions) === null || _a === void 0 ? void 0 : _a.map(option => {
|
|
765
|
+
const optionCopy = Object.assign({}, option);
|
|
766
|
+
return optionCopy;
|
|
767
|
+
})) !== null && _b !== void 0 ? _b : null;
|
|
768
|
+
}
|
|
769
|
+
set options(newOptions) {
|
|
770
|
+
var _a, _b, _c, _d;
|
|
771
|
+
if ((!this._formConfig.captureTypesWithOptions.includes(this._captureType))
|
|
772
|
+
|| typeof newOptions === UNDEFINED || !newOptions
|
|
773
|
+
|| !Array.isArray(newOptions)) {
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
776
|
+
let fieldOptions = newOptions.map((option) => {
|
|
777
|
+
if (option.text !== undefined && option.text !== null
|
|
778
|
+
&& option.value !== undefined && option.value !== null) {
|
|
779
|
+
return { fieldOptionValue: option.text, fieldOptionId: option.value };
|
|
780
|
+
}
|
|
781
|
+
return option;
|
|
782
|
+
});
|
|
783
|
+
fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
|
|
784
|
+
&& fieldOptions.length > 0) ? fieldOptions : [];
|
|
785
|
+
this.setAttr(attrs._fieldOptions, fieldOptions);
|
|
786
|
+
if (this._value) {
|
|
787
|
+
if (this._fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._value)) {
|
|
788
|
+
const fieldValue = (_a = this._value) === null || _a === void 0 ? void 0 : _a.filter(item => { var _a; return (_a = this._fieldOptions) === null || _a === void 0 ? void 0 : _a.find(opt => opt.fieldOptionId === item); });
|
|
789
|
+
this.setAttr(attrs._value, fieldValue);
|
|
790
|
+
}
|
|
791
|
+
else {
|
|
792
|
+
const valInOptions = (_b = this._fieldOptions) === null || _b === void 0 ? void 0 : _b.find(item => item.fieldOptionId === this._value);
|
|
793
|
+
if (!valInOptions) {
|
|
794
|
+
this._setValue('');
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
if (this._fieldRequired && ((_c = this._fieldOptions) === null || _c === void 0 ? void 0 : _c.length) === 1) {
|
|
799
|
+
this._setValue((_d = this._fieldOptions) === null || _d === void 0 ? void 0 : _d[0].fieldOptionId);
|
|
800
|
+
this.notifyEditionFinish();
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
get optionText() { var _a, _b, _c; return (_c = (_b = (_a = this._fieldOptions) === null || _a === void 0 ? void 0 : _a.find(item => item.fieldOptionId === this._value)) === null || _b === void 0 ? void 0 : _b.fieldOptionValue) !== null && _c !== void 0 ? _c : null; }
|
|
804
|
+
get outputOnly() { return this._outputOnly; }
|
|
805
|
+
set outputOnly(outputOnly) { this.setAttr(attrs._outputOnly, outputOnly); }
|
|
806
|
+
get required() { return this._fieldRequired; }
|
|
807
|
+
set required(required) { this.setAttr(attrs._fieldRequired, required !== null && required !== void 0 ? required : false); }
|
|
808
|
+
get title() { return this._fieldTitle; }
|
|
809
|
+
set title(title) { this.setAttr(attrs._fieldTitle, title.toString()); }
|
|
810
|
+
get tooltip() { return this._tooltipText; }
|
|
811
|
+
set tooltip(tooltip) { this.setAttr(attrs._tooltipText, tooltip); }
|
|
812
|
+
get type() { return this._fieldType; }
|
|
813
|
+
set type(fieldType) { this.setAttr(attrs._fieldType, fieldType); }
|
|
814
|
+
get validating() { return this._onValidation; }
|
|
815
|
+
set validating(isValidating) { this.setAttr(attrs._onValidation, isValidating); }
|
|
816
|
+
get value() {
|
|
817
|
+
return (this._fieldType === this._formConfig.fieldTypes.boolean
|
|
818
|
+
|| this._fieldType === this._formConfig.fieldTypes.check) ? yn(this._value) : this._value;
|
|
819
|
+
}
|
|
820
|
+
get validateOnServer() { return this._validateOnServer; }
|
|
821
|
+
set validateOnServer(validateOnServer) { this.setAttr(attrs._validateOnServer, validateOnServer); }
|
|
822
|
+
get serverAction() { return this._validateOnServer; }
|
|
823
|
+
set serverAction(validateOnServer) { this.validateOnServer = validateOnServer; }
|
|
824
|
+
set value(newValue) { this._setValue(newValue); }
|
|
825
|
+
get visibleLabel() { return this._visibleLabel; }
|
|
826
|
+
set visibleLabel(visibleLabel) { this.setAttr(attrs._visibleLabel, visibleLabel); }
|
|
827
|
+
/**
|
|
828
|
+
* @deprecated Use options
|
|
829
|
+
*/
|
|
830
|
+
get fieldOptions() { return this._fieldOptions; }
|
|
831
|
+
/**
|
|
832
|
+
* @deprecated Use options
|
|
833
|
+
*/
|
|
834
|
+
set fieldOptions(options) { this.options = options; }
|
|
835
|
+
/**
|
|
836
|
+
* @deprecated Use value
|
|
837
|
+
*/
|
|
838
|
+
get fieldValue() { return this.value; }
|
|
839
|
+
/**
|
|
840
|
+
* @deprecated Use hasChanged
|
|
841
|
+
*/
|
|
842
|
+
changed(hasChanged = true) { this.hasChanged = hasChanged; }
|
|
843
|
+
clean() { this._setValue(this._defaultValue || ''); this.resetError(); }
|
|
844
|
+
focus() { this.setAttr(attrs._focus, true); }
|
|
845
|
+
getErrorCode() { return this.error.code; }
|
|
846
|
+
setErrorCode(code) { this.setError(code, this._errorMessage); }
|
|
847
|
+
getErrorMessage() { return this.error.message; }
|
|
848
|
+
setErrorMessage(msg) { this.setError(this._errorCode, msg); }
|
|
849
|
+
getRequired() { return this.required; }
|
|
850
|
+
hasError() { return this._errorCode !== NO_ERROR; }
|
|
851
|
+
hideLabel() { this.visibleLabel = false; }
|
|
852
|
+
resetError() { (this._errorCode !== NO_ERROR) && this.setError(NO_ERROR, null); }
|
|
853
|
+
setEditable(editable = true) { (editable) ? this.enable() : this.disable(); }
|
|
854
|
+
setValue(newValue, widgetUpdate = true) { this._setValue(newValue, widgetUpdate); }
|
|
855
|
+
showLabel() { this.visibleLabel = true; }
|
|
856
|
+
/**
|
|
857
|
+
* @deprecated Use title
|
|
858
|
+
*/
|
|
859
|
+
setLabel(label) { this.title = label; }
|
|
860
|
+
/**
|
|
861
|
+
* @deprecated Use required
|
|
862
|
+
*/
|
|
863
|
+
setRequired(required) { this.required = required; }
|
|
864
|
+
/**
|
|
865
|
+
* @deprecated Use changed
|
|
866
|
+
*/
|
|
867
|
+
setChanged(hasChanged) { this.changed(hasChanged); }
|
|
868
|
+
/**
|
|
869
|
+
* @deprecated Use value
|
|
870
|
+
*/
|
|
871
|
+
getValue() { return this.value; }
|
|
872
|
+
/**
|
|
873
|
+
* @deprecated Use empty
|
|
874
|
+
*/
|
|
875
|
+
isEmpty() { return this.empty; }
|
|
876
|
+
/**
|
|
877
|
+
* @deprecated Use error
|
|
878
|
+
*/
|
|
879
|
+
getError() { return this.error; }
|
|
880
|
+
/**
|
|
881
|
+
* @deprecated Use optionText
|
|
882
|
+
*/
|
|
883
|
+
getOptionText() { return this.optionText; }
|
|
884
|
+
/**
|
|
885
|
+
* @deprecated Use options
|
|
886
|
+
*/
|
|
887
|
+
getFieldOptions() { return this.options; }
|
|
888
|
+
/**
|
|
889
|
+
* @deprecated Use options
|
|
890
|
+
*/
|
|
891
|
+
setFieldOptions(newOptions) { return this.options = newOptions; }
|
|
892
|
+
/**
|
|
893
|
+
* @deprecated Use intrinsicErrorMessage
|
|
894
|
+
*/
|
|
895
|
+
setIntrinsicErrorMessage(message) { this.intrinsicErrorMessage = message; }
|
|
896
|
+
/**
|
|
897
|
+
* @deprecated Use maxValue
|
|
898
|
+
*/
|
|
899
|
+
setMaxValue(inputMaxValue) { this.maxValue = inputMaxValue; }
|
|
900
|
+
/**
|
|
901
|
+
* @deprecated Use minValue
|
|
902
|
+
*/
|
|
903
|
+
setMinValue(inputMinValue) { this.minValue = inputMinValue; }
|
|
904
|
+
/**
|
|
905
|
+
* @deprecated Use showLabel
|
|
906
|
+
*/
|
|
907
|
+
setVisibleLabel(visibleLabel) { this.visibleLabel = visibleLabel; }
|
|
719
908
|
notifyEditionPartial() {
|
|
720
909
|
this.resetError();
|
|
721
|
-
this._editionPartial.next({ code: this.
|
|
910
|
+
this._editionPartial.next({ code: this._fieldCode, intrinsicValidation: true });
|
|
722
911
|
}
|
|
723
912
|
notifyEditionFinish() {
|
|
724
913
|
var _a, _b, _c, _d, _e;
|
|
725
|
-
const fieldValue = this.
|
|
914
|
+
const fieldValue = this.value;
|
|
726
915
|
this.resetError();
|
|
727
|
-
const validationConfig = (_b = (_a = this._formConfig.fieldValidations) === null || _a === void 0 ? void 0 : _a[this.
|
|
916
|
+
const validationConfig = (_b = (_a = this._formConfig.fieldValidations) === null || _a === void 0 ? void 0 : _a[this._fieldType]) !== null && _b !== void 0 ? _b : {};
|
|
728
917
|
const { type, validation } = validationConfig;
|
|
729
918
|
let message = validationConfig === null || validationConfig === void 0 ? void 0 : validationConfig.message;
|
|
730
919
|
let intrinsicValidation = true;
|
|
731
|
-
if (fieldValue && (validation || this.
|
|
920
|
+
if (fieldValue && (validation || this._fieldFormat)) {
|
|
732
921
|
if (type === 'regexp') {
|
|
733
922
|
intrinsicValidation = ((_c = validation === null || validation === void 0 ? void 0 : validation.test(fieldValue)) !== null && _c !== void 0 ? _c : true)
|
|
734
|
-
&& ((_e = (_d = this.
|
|
923
|
+
&& ((_e = (_d = this._fieldFormat) === null || _d === void 0 ? void 0 : _d.test(fieldValue)) !== null && _e !== void 0 ? _e : true);
|
|
735
924
|
}
|
|
736
925
|
else if (type === 'function' && typeof validation === 'function') {
|
|
737
926
|
const { valid, message: customMessage } = validation(fieldValue, this);
|
|
@@ -753,158 +942,48 @@ class FieldDescriptor extends FormElement {
|
|
|
753
942
|
if (intrinsicValidation && fieldValue && typeof fieldValue === 'string'
|
|
754
943
|
&& this._minLength && (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.length) < this._minLength) {
|
|
755
944
|
intrinsicValidation = false;
|
|
756
|
-
this.setError('99', `Longitud de ${this.
|
|
757
|
-
}
|
|
758
|
-
this._editionFinish.next({ code: this.fieldCode, intrinsicValidation });
|
|
759
|
-
}
|
|
760
|
-
setAttr(name, value) {
|
|
761
|
-
this[name] = value;
|
|
762
|
-
if (this._formConfig.monitoredFieldAttributes.includes(name)) {
|
|
763
|
-
this._attributeChange.next({ name, value });
|
|
945
|
+
this.setError('99', `Longitud de ${this._fieldTitle} debe ser de al menos ${this._minLength}`);
|
|
764
946
|
}
|
|
947
|
+
this._editionFinish.next({ code: this._fieldCode, intrinsicValidation });
|
|
765
948
|
}
|
|
766
949
|
notifyEditionDetailRequest(detail) {
|
|
767
|
-
const detailEvent = {
|
|
768
|
-
code: this.fieldCode,
|
|
769
|
-
detail,
|
|
770
|
-
};
|
|
950
|
+
const detailEvent = { code: this._fieldCode, detail };
|
|
771
951
|
this._detailRequest.next(detailEvent);
|
|
772
952
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
changed() { this.setChanged(true); }
|
|
778
|
-
setLabel(label) { this.setAttr(fldAttr.title, label); }
|
|
779
|
-
clean() { this.setValue(this.defaultValue || ''); this.resetError(); }
|
|
780
|
-
get backend() { return this.validateOnServer; }
|
|
781
|
-
setEditable(editable = true) { (editable) ? this.enable() : this.disable(); }
|
|
782
|
-
hasError() { return this.errorCode !== NO_ERROR; }
|
|
783
|
-
resetError() { (this.errorCode !== NO_ERROR) && this.setError(NO_ERROR, null); }
|
|
784
|
-
setError(code, message, type = DEFAULT_ERROR_TYPE) {
|
|
785
|
-
this.setAttr(fldAttr.errorCode, code !== null && code !== void 0 ? code : NO_ERROR);
|
|
786
|
-
this.setAttr(fldAttr.errorType, (this.errorCode === NO_ERROR) ? '' : type);
|
|
787
|
-
this.setAttr(fldAttr.errorMessage, message !== null && message !== void 0 ? message : '');
|
|
788
|
-
}
|
|
789
|
-
getError() { return { type: this.errorType, code: this.errorCode, message: this.errorMessage }; }
|
|
790
|
-
get error() { return this.getError(); }
|
|
791
|
-
set error(errorObj) { var _a; this.setError(errorObj.code, errorObj.message, (_a = errorObj.type) !== null && _a !== void 0 ? _a : DEFAULT_ERROR_TYPE); }
|
|
792
|
-
getErrorCode() { return this.getError().code; }
|
|
793
|
-
setErrorCode(code) { this.setError(code, this.errorMessage); }
|
|
794
|
-
getErrorMessage() { return this.getError().message; }
|
|
795
|
-
setErrorMessage(msg) { this.setError(this.errorCode, msg); }
|
|
796
|
-
get empty() { return this.isEmpty(); }
|
|
797
|
-
isEmpty() {
|
|
798
|
-
const fieldCurrentValue = this.getValue();
|
|
799
|
-
if (fieldCurrentValue === undefined || fieldCurrentValue === null) {
|
|
800
|
-
return true;
|
|
801
|
-
}
|
|
802
|
-
if (this.fieldType === this._formConfig.fieldTypes.array
|
|
803
|
-
&& Array.isArray(fieldCurrentValue) && fieldCurrentValue.length === 0) {
|
|
804
|
-
return true;
|
|
805
|
-
}
|
|
806
|
-
;
|
|
807
|
-
if (this.fieldType === this._formConfig.fieldTypes.phone) {
|
|
808
|
-
if (!Array.isArray(fieldCurrentValue)) {
|
|
809
|
-
return true;
|
|
810
|
-
}
|
|
811
|
-
if (fieldCurrentValue.length !== 2 || !fieldCurrentValue[0] || !fieldCurrentValue[1]) {
|
|
812
|
-
return true;
|
|
813
|
-
}
|
|
814
|
-
return false;
|
|
815
|
-
}
|
|
816
|
-
;
|
|
817
|
-
return fieldCurrentValue === '';
|
|
818
|
-
}
|
|
819
|
-
getValue() {
|
|
820
|
-
if (this.fieldType === this._formConfig.fieldTypes.boolean
|
|
821
|
-
|| this.fieldType === this._formConfig.fieldTypes.check) {
|
|
822
|
-
return yn(this._value);
|
|
823
|
-
}
|
|
824
|
-
return this._value;
|
|
953
|
+
setAttr(attr, value) {
|
|
954
|
+
const { name: attrName, propagate: name } = attr;
|
|
955
|
+
this[attrName] = value;
|
|
956
|
+
name && this._attributeChange.next({ name, value });
|
|
825
957
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
958
|
+
setError(code, message, type = DEFAULT_ERROR_TYPE) {
|
|
959
|
+
this.setAttr(attrs._errorCode, code !== null && code !== void 0 ? code : NO_ERROR);
|
|
960
|
+
this.setAttr(attrs._errorType, (this._errorCode === NO_ERROR) ? '' : type);
|
|
961
|
+
this.setAttr(attrs._errorMessage, message !== null && message !== void 0 ? message : '');
|
|
829
962
|
}
|
|
830
963
|
updateFromServer(fld) {
|
|
831
|
-
var _a;
|
|
832
964
|
const fieldKeys = Object.keys(fld);
|
|
833
965
|
for (let index = 0; index < fieldKeys.length; index++) {
|
|
834
966
|
const attrName = fieldKeys[index];
|
|
835
967
|
const attrValue = fld[attrName];
|
|
836
|
-
(attrName
|
|
837
|
-
|
|
838
|
-
(attrName === this._formConfig.apiFieldAttrs.required) && this.setAttr(fldAttr.required, (_a = fld.required) !== null && _a !== void 0 ? _a : false);
|
|
839
|
-
(attrName === this._formConfig.apiFieldAttrs.errorCode) && this.setAttr(fldAttr.errorCode, fld.errorCode);
|
|
840
|
-
(attrName === this._formConfig.apiFieldAttrs.errorMessage) && this.setAttr(fldAttr.errorMessage, fld.errorMessage);
|
|
841
|
-
(attrName === this._formConfig.apiFieldAttrs.tooltip) && this.setAttr(fldAttr.tooltipText, fld.tooltip);
|
|
842
|
-
(attrName === this._formConfig.apiFieldAttrs.info) && this.setAttr(fldAttr.info, fld.info);
|
|
843
|
-
(attrName === this._formConfig.apiFieldAttrs.editable) && this.setEditable(fld.editable);
|
|
844
|
-
(attrName === this._formConfig.apiFieldAttrs.title) && this.setLabel(fld.fieldTitle.toString());
|
|
845
|
-
(attrName === this._formConfig.apiFieldAttrs.value) && (this.setValue(fld.fieldValue) && this.setChanged(false));
|
|
846
|
-
(attrName === this._formConfig.apiFieldAttrs.options) && this.setFieldOptions(fld.fieldOptions);
|
|
847
|
-
(attrName === this._formConfig.apiFieldAttrs.captureType) && this.setAttr(fldAttr.captureType, fld.captureType || 'INPUT');
|
|
848
|
-
(attrName === this._formConfig.apiFieldAttrs.type) && this.setAttr(fldAttr.type, fld.fieldTypeCode);
|
|
849
|
-
(attrName === this._formConfig.apiFieldAttrs.maxLength) && this.setAttr(fldAttr.maxLength, fld.maxLength);
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
setMinValue(inputMinValue) {
|
|
853
|
-
let minValue = inputMinValue;
|
|
854
|
-
if (this.fieldType === this._formConfig.fieldTypes.date) {
|
|
855
|
-
minValue = new Date(minValue);
|
|
856
|
-
}
|
|
857
|
-
this.setAttr(fldAttr.minValue, minValue);
|
|
858
|
-
}
|
|
859
|
-
setMaxValue(inputMaxValue) {
|
|
860
|
-
let maxValue = inputMaxValue;
|
|
861
|
-
if (this.fieldType === this._formConfig.fieldTypes.date) {
|
|
862
|
-
maxValue = new Date(maxValue);
|
|
863
|
-
}
|
|
864
|
-
this.setAttr(fldAttr.maxValue, maxValue);
|
|
865
|
-
}
|
|
866
|
-
getFieldOptions() {
|
|
867
|
-
return this.fieldOptions.map(option => {
|
|
868
|
-
const optionCopy = Object.assign({}, option);
|
|
869
|
-
return optionCopy;
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
setFieldOptions(newOptions) {
|
|
873
|
-
var _a;
|
|
874
|
-
if ((!this._formConfig.captureTypesWithOptions.includes(this.captureType))
|
|
875
|
-
|| typeof newOptions === UNDEFINED || !newOptions
|
|
876
|
-
|| !Array.isArray(newOptions)) {
|
|
877
|
-
return;
|
|
878
|
-
}
|
|
879
|
-
let fieldOptions = newOptions.map(option => {
|
|
880
|
-
if (option.text !== undefined && option.text !== null
|
|
881
|
-
&& option.value !== undefined && option.value !== null) {
|
|
882
|
-
return { fieldOptionValue: option.text, fieldOptionId: option.value };
|
|
883
|
-
}
|
|
884
|
-
return Object.assign({}, option);
|
|
885
|
-
});
|
|
886
|
-
fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
|
|
887
|
-
&& fieldOptions.length > 0) ? fieldOptions : [];
|
|
888
|
-
this.setAttr(fldAttr.options, fieldOptions);
|
|
889
|
-
if (this._value) {
|
|
890
|
-
if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._value)) {
|
|
891
|
-
const fieldValue = (_a = this._value) === null || _a === void 0 ? void 0 : _a.filter(item => this.fieldOptions.find(opt => opt.fieldOptionId === item));
|
|
892
|
-
this.setAttr(fldAttr.value, fieldValue);
|
|
968
|
+
if (directChanges.includes(attrName)) {
|
|
969
|
+
this[attrName] = attrValue;
|
|
893
970
|
}
|
|
894
971
|
else {
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
972
|
+
(attrName === 'label') && (this.title = attrValue);
|
|
973
|
+
(attrName === 'labelVisible') && (this.visibleLabel = attrValue);
|
|
974
|
+
(attrName === 'editable') && this.setEditable(attrValue);
|
|
975
|
+
(attrName === 'visible') && this.setVisibility(attrValue);
|
|
976
|
+
(attrName === 'value') && (this._setValue(attrValue) && (this.hasChanged = false));
|
|
977
|
+
(attrName === 'fieldValue') && (this._setValue(attrValue) && (this.hasChanged = false));
|
|
978
|
+
(attrName === 'fieldOptions') && (this.options = attrValue);
|
|
979
|
+
(attrName === 'fieldTitle') && (this.title = attrValue);
|
|
980
|
+
(attrName === 'fieldTypeCode') && (this.type = attrValue);
|
|
981
|
+
(attrName === 'fieldType') && (this.type = attrValue);
|
|
982
|
+
(attrName === 'tooltipText') && (this.tooltip = attrValue);
|
|
900
983
|
}
|
|
901
984
|
}
|
|
902
|
-
if (this.fieldRequired && this.fieldOptions.length === 1) {
|
|
903
|
-
this.setValue(this.fieldOptions[0].fieldOptionId);
|
|
904
|
-
this.notifyEditionFinish();
|
|
905
|
-
}
|
|
906
985
|
}
|
|
907
|
-
|
|
986
|
+
_setValue(newValue, widgetUpdate = true) {
|
|
908
987
|
var _a;
|
|
909
988
|
if (typeof newValue === UNDEFINED) {
|
|
910
989
|
return true;
|
|
@@ -913,12 +992,12 @@ class FieldDescriptor extends FormElement {
|
|
|
913
992
|
return true;
|
|
914
993
|
}
|
|
915
994
|
let newFinalValue;
|
|
916
|
-
if (this.
|
|
917
|
-
|| this.
|
|
995
|
+
if (this._fieldType === this._formConfig.fieldTypes.boolean
|
|
996
|
+
|| this._fieldType === this._formConfig.fieldTypes.check) {
|
|
918
997
|
newFinalValue = (_a = yn(newValue)) !== null && _a !== void 0 ? _a : false;
|
|
919
998
|
}
|
|
920
|
-
else if (this.
|
|
921
|
-
|| this.
|
|
999
|
+
else if (this._fieldType === this._formConfig.fieldTypes.array
|
|
1000
|
+
|| this._fieldType === this._formConfig.fieldTypes.map) {
|
|
922
1001
|
if (newValue === null || newValue === '') {
|
|
923
1002
|
newFinalValue = [];
|
|
924
1003
|
}
|
|
@@ -933,9 +1012,9 @@ class FieldDescriptor extends FormElement {
|
|
|
933
1012
|
newFinalValue = newValue;
|
|
934
1013
|
}
|
|
935
1014
|
if (this._value !== newFinalValue) {
|
|
936
|
-
this.
|
|
1015
|
+
this.hasChanged = true;
|
|
937
1016
|
if (widgetUpdate) {
|
|
938
|
-
this.setAttr(
|
|
1017
|
+
this.setAttr(attrs._value, newFinalValue);
|
|
939
1018
|
}
|
|
940
1019
|
else {
|
|
941
1020
|
this._value = newFinalValue;
|
|
@@ -1583,7 +1662,7 @@ class RecordFormSubSection {
|
|
|
1583
1662
|
return this.subSectionFields;
|
|
1584
1663
|
}
|
|
1585
1664
|
getFieldNames() {
|
|
1586
|
-
return this.subSectionFields.map(field => field.
|
|
1665
|
+
return this.subSectionFields.map(field => field.code);
|
|
1587
1666
|
}
|
|
1588
1667
|
getActions() {
|
|
1589
1668
|
return this.subSectionActions;
|
|
@@ -1800,7 +1879,7 @@ class FormStructureAndData {
|
|
|
1800
1879
|
});
|
|
1801
1880
|
for (const fieldReceived of formFields) {
|
|
1802
1881
|
const fieldToAdd = new FieldDescriptor(fieldReceived, this._formConfig);
|
|
1803
|
-
const fieldCode = fieldToAdd.
|
|
1882
|
+
const fieldCode = fieldToAdd.code;
|
|
1804
1883
|
if (fieldCode) {
|
|
1805
1884
|
this._fieldArray.push(fieldToAdd);
|
|
1806
1885
|
this._fields[fieldCode] = fieldToAdd;
|
|
@@ -1895,13 +1974,13 @@ class FormStructureAndData {
|
|
|
1895
1974
|
get fields() { return this._fields; }
|
|
1896
1975
|
get fieldNames() { return this.getFieldNames(); }
|
|
1897
1976
|
getFields() { return this._fieldArray; }
|
|
1898
|
-
getFieldNames() { return this._fieldArray.map(field => field.
|
|
1977
|
+
getFieldNames() { return this._fieldArray.map(field => field.code); }
|
|
1899
1978
|
getField(code) { var _a; return (code && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[code])) ? this._fields[code] : null; }
|
|
1900
1979
|
enableField(code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.enable(); }
|
|
1901
1980
|
disableField(code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.disable(); }
|
|
1902
|
-
getFieldValue(code) { var _a; return (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.
|
|
1903
|
-
getFieldOptionText(code) { var _a; return (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.
|
|
1904
|
-
getFieldOptions(code) { var _a, _b; return (_b = (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.
|
|
1981
|
+
getFieldValue(code) { var _a; return (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.value; }
|
|
1982
|
+
getFieldOptionText(code) { var _a; return (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.optionText; }
|
|
1983
|
+
getFieldOptions(code) { var _a, _b; return (_b = (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.options) !== null && _b !== void 0 ? _b : null; }
|
|
1905
1984
|
setFieldValue(code, value) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setValue(value); }
|
|
1906
1985
|
setFieldError(code, errorCode, message, type = 'error') { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setError(errorCode, message, type); }
|
|
1907
1986
|
setFieldIntrinsicErrorMessage(code, message) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setIntrinsicErrorMessage(message); }
|
|
@@ -1910,7 +1989,8 @@ class FormStructureAndData {
|
|
|
1910
1989
|
const codes = this.getFieldSet(null, inputCodes !== null && inputCodes !== void 0 ? inputCodes : null);
|
|
1911
1990
|
for (const code of codes) {
|
|
1912
1991
|
try {
|
|
1913
|
-
(_a = this.getField(code))
|
|
1992
|
+
const field = (_a = this.getField(code)) !== null && _a !== void 0 ? _a : null;
|
|
1993
|
+
field && (field.required = required);
|
|
1914
1994
|
}
|
|
1915
1995
|
catch (e) {
|
|
1916
1996
|
console.log(`Error modificando campo ${code}: ${e}`);
|
|
@@ -1971,28 +2051,28 @@ class FormStructureAndData {
|
|
|
1971
2051
|
return processedFields;
|
|
1972
2052
|
}
|
|
1973
2053
|
enableFields(codes, secCode, subCode) {
|
|
1974
|
-
return this.applyOnFields(fld => fld.enable(), codes, secCode, subCode);
|
|
2054
|
+
return this.applyOnFields(fld => fld === null || fld === void 0 ? void 0 : fld.enable(), codes, secCode, subCode);
|
|
1975
2055
|
}
|
|
1976
2056
|
showFields(codes, secCode, subCode) {
|
|
1977
|
-
return this.applyOnFields(fld => fld.show(), codes, secCode, subCode);
|
|
2057
|
+
return this.applyOnFields(fld => fld === null || fld === void 0 ? void 0 : fld.show(), codes, secCode, subCode);
|
|
1978
2058
|
}
|
|
1979
2059
|
hideFields(codes, secCode, subCode) {
|
|
1980
|
-
return this.applyOnFields(fld => fld.hide(), codes, secCode, subCode);
|
|
2060
|
+
return this.applyOnFields(fld => fld === null || fld === void 0 ? void 0 : fld.hide(), codes, secCode, subCode);
|
|
1981
2061
|
}
|
|
1982
2062
|
showLabelFields(codes, secCode, subCode) {
|
|
1983
|
-
return this.applyOnFields(fld => fld.showLablel(), codes, secCode, subCode);
|
|
2063
|
+
return this.applyOnFields(fld => fld === null || fld === void 0 ? void 0 : fld.showLablel(), codes, secCode, subCode);
|
|
1984
2064
|
}
|
|
1985
2065
|
hideLabelFields(codes, secCode, subCode) {
|
|
1986
|
-
return this.applyOnFields(fld => fld.hideLabel(), codes, secCode, subCode);
|
|
2066
|
+
return this.applyOnFields(fld => fld === null || fld === void 0 ? void 0 : fld.hideLabel(), codes, secCode, subCode);
|
|
1987
2067
|
}
|
|
1988
2068
|
disableFields(codes, secCode, subCode) {
|
|
1989
|
-
return this.applyOnFields(fld => fld.disable(), codes, secCode, subCode);
|
|
2069
|
+
return this.applyOnFields(fld => fld === null || fld === void 0 ? void 0 : fld.disable(), codes, secCode, subCode);
|
|
1990
2070
|
}
|
|
1991
2071
|
cleanFields(codes, secCode, subCode) {
|
|
1992
|
-
return this.applyOnFields(fld => fld.clean(), codes, secCode, subCode);
|
|
2072
|
+
return this.applyOnFields(fld => fld === null || fld === void 0 ? void 0 : fld.clean(), codes, secCode, subCode);
|
|
1993
2073
|
}
|
|
1994
2074
|
tagFieldsWithError(message, codes, secCode, subCode) {
|
|
1995
|
-
return this.applyOnFields(fld => fld.setErrorMessage(message), codes, secCode, subCode);
|
|
2075
|
+
return this.applyOnFields(fld => fld === null || fld === void 0 ? void 0 : fld.setErrorMessage(message), codes, secCode, subCode);
|
|
1996
2076
|
}
|
|
1997
2077
|
cleanErrorFields(codes, secCode, subCode) {
|
|
1998
2078
|
return this.tagFieldsWithError('', codes, secCode, subCode);
|
|
@@ -2001,16 +2081,16 @@ class FormStructureAndData {
|
|
|
2001
2081
|
return this.tagFieldsWithError(message, this.getRequiredEmptyFields(codes, secCode, subCode)) > 0;
|
|
2002
2082
|
}
|
|
2003
2083
|
getRequiredFields(codes, secCode, subCode) {
|
|
2004
|
-
return this.getFieldSet(fld => fld.required, codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
2084
|
+
return this.getFieldSet(fld => fld === null || fld === void 0 ? void 0 : fld.required, codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
2005
2085
|
}
|
|
2006
2086
|
getRequiredEmptyFields(codes, secCode, subCode) {
|
|
2007
|
-
return this.getFieldSet(fld => fld.required && fld.empty, codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
2087
|
+
return this.getFieldSet(fld => (fld === null || fld === void 0 ? void 0 : fld.required) && (fld === null || fld === void 0 ? void 0 : fld.empty), codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
2008
2088
|
}
|
|
2009
2089
|
getChangedFields(codes, secCode, subCode) {
|
|
2010
|
-
return this.getFieldSet(fld => !fld.outputOnly && fld.hasChanged(), codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
2090
|
+
return this.getFieldSet(fld => !(fld === null || fld === void 0 ? void 0 : fld.outputOnly) && (fld === null || fld === void 0 ? void 0 : fld.hasChanged()), codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
2011
2091
|
}
|
|
2012
2092
|
getFieldsWithValidationIssues(codes, secCode, subCode) {
|
|
2013
|
-
return this.getFieldSet(fld => fld
|
|
2093
|
+
return this.getFieldSet(fld => fld === null || fld === void 0 ? void 0 : fld.hasError(), codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
2014
2094
|
}
|
|
2015
2095
|
getFieldsValues(inputCodes, secCode, subCode) {
|
|
2016
2096
|
var _a, _b, _c;
|
|
@@ -2128,14 +2208,14 @@ class FormStructureAndData {
|
|
|
2128
2208
|
fields: [],
|
|
2129
2209
|
tables: [],
|
|
2130
2210
|
};
|
|
2131
|
-
formData.fields = this.getFields().filter(fld => !fld.outputOnly)
|
|
2211
|
+
formData.fields = this.getFields().filter(fld => !(fld === null || fld === void 0 ? void 0 : fld.outputOnly))
|
|
2132
2212
|
.map(fld => {
|
|
2133
2213
|
const fieldPayload = {
|
|
2134
|
-
fieldCode: fld.
|
|
2135
|
-
fieldValue: fld.
|
|
2136
|
-
editable: !fld.disabled,
|
|
2137
|
-
visible: fld.visible,
|
|
2138
|
-
required: fld.required,
|
|
2214
|
+
fieldCode: fld === null || fld === void 0 ? void 0 : fld.code,
|
|
2215
|
+
fieldValue: fld === null || fld === void 0 ? void 0 : fld.value,
|
|
2216
|
+
editable: !(fld === null || fld === void 0 ? void 0 : fld.disabled),
|
|
2217
|
+
visible: fld === null || fld === void 0 ? void 0 : fld.visible,
|
|
2218
|
+
required: fld === null || fld === void 0 ? void 0 : fld.required,
|
|
2139
2219
|
fieldOptions: '',
|
|
2140
2220
|
};
|
|
2141
2221
|
return fieldPayload;
|
|
@@ -2281,6 +2361,7 @@ class BasicFormComponent {
|
|
|
2281
2361
|
this._formRoute = null;
|
|
2282
2362
|
this._definitionObtained = false;
|
|
2283
2363
|
// Eventos de acciones y campos
|
|
2364
|
+
this._formSectionsCanDeactivate = {};
|
|
2284
2365
|
this._formSectionsActivate = {};
|
|
2285
2366
|
this._formSectionsInactivate = {};
|
|
2286
2367
|
this._formActionsStart = {};
|
|
@@ -2581,6 +2662,7 @@ class BasicFormComponent {
|
|
|
2581
2662
|
// Se limpian los manejadores de eventos
|
|
2582
2663
|
this.visible = false;
|
|
2583
2664
|
this.busy = false;
|
|
2665
|
+
this._formSectionsCanDeactivate = {};
|
|
2584
2666
|
this._formSectionsActivate = {};
|
|
2585
2667
|
this._formSectionsInactivate = {};
|
|
2586
2668
|
this._formActionsStart = {};
|
|
@@ -2623,7 +2705,7 @@ class BasicFormComponent {
|
|
|
2623
2705
|
displayActionServerError() { }
|
|
2624
2706
|
displayValidationServerError() { }
|
|
2625
2707
|
displayTableServerError() { }
|
|
2626
|
-
showFieldInfo(
|
|
2708
|
+
showFieldInfo(code, detail) { }
|
|
2627
2709
|
showModalDialog(title, body, options, callback, params) { }
|
|
2628
2710
|
openUploadDialog(title, body, options, callback, params) { }
|
|
2629
2711
|
/**
|
|
@@ -2800,9 +2882,9 @@ class BasicFormComponent {
|
|
|
2800
2882
|
(_f = this._formStructure) === null || _f === void 0 ? void 0 : _f.changeState(initialState || ((_g = this._formStructure) === null || _g === void 0 ? void 0 : _g.defaultState));
|
|
2801
2883
|
const inputFieldNames = Object.keys(this.inputDataFields);
|
|
2802
2884
|
for (let index = 0; index < inputFieldNames.length; index++) {
|
|
2803
|
-
const
|
|
2804
|
-
const fieldValue = this.inputDataFields[
|
|
2805
|
-
this.setFieldValue(
|
|
2885
|
+
const code = inputFieldNames[index];
|
|
2886
|
+
const fieldValue = this.inputDataFields[code];
|
|
2887
|
+
this.setFieldValue(code, fieldValue);
|
|
2806
2888
|
}
|
|
2807
2889
|
const recordResponse = yield this.requestFormAction(formActions.getData);
|
|
2808
2890
|
this.checkErrorRecordReceived(recordResponse);
|
|
@@ -2930,6 +3012,15 @@ class BasicFormComponent {
|
|
|
2930
3012
|
/**
|
|
2931
3013
|
* Manejo de event handlers para acciones sobre el formulario
|
|
2932
3014
|
*/
|
|
3015
|
+
onSectionCanDeactivate(codes, callback, properties = null) {
|
|
3016
|
+
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3017
|
+
sectionSet.forEach((sectionName) => {
|
|
3018
|
+
if (!this._formSectionsCanDeactivate[sectionName]) {
|
|
3019
|
+
this._formSectionsCanDeactivate[sectionName] = [];
|
|
3020
|
+
}
|
|
3021
|
+
this._formSectionsCanDeactivate[sectionName].push({ callback, properties });
|
|
3022
|
+
});
|
|
3023
|
+
}
|
|
2933
3024
|
onSectionActivation(codes, callback, properties = null) {
|
|
2934
3025
|
const sectionSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
2935
3026
|
sectionSet.forEach((sectionName) => {
|
|
@@ -2966,9 +3057,30 @@ class BasicFormComponent {
|
|
|
2966
3057
|
this._formActionsFinish[actionName].push({ callback, properties });
|
|
2967
3058
|
});
|
|
2968
3059
|
}
|
|
3060
|
+
verifySectionActivation(code) {
|
|
3061
|
+
var _a;
|
|
3062
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
3063
|
+
const sectionObject = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
|
|
3064
|
+
if (!sectionObject) {
|
|
3065
|
+
return false;
|
|
3066
|
+
}
|
|
3067
|
+
const clientSectionMethods = this._formSectionsCanDeactivate[code];
|
|
3068
|
+
if (clientSectionMethods) {
|
|
3069
|
+
for (const clientSectionMethod of clientSectionMethods) {
|
|
3070
|
+
const { callback, properties } = clientSectionMethod;
|
|
3071
|
+
const canActivate = callback(sectionObject);
|
|
3072
|
+
if (canActivate === false) {
|
|
3073
|
+
return false;
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
return true;
|
|
3078
|
+
});
|
|
3079
|
+
}
|
|
2969
3080
|
launchSectionActivation(code) {
|
|
2970
3081
|
var _a;
|
|
2971
3082
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3083
|
+
this.notifyFormActivity();
|
|
2972
3084
|
const sectionObject = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
|
|
2973
3085
|
if (!sectionObject) {
|
|
2974
3086
|
return;
|
|
@@ -2985,6 +3097,7 @@ class BasicFormComponent {
|
|
|
2985
3097
|
launchSectionInactivation(code) {
|
|
2986
3098
|
var _a;
|
|
2987
3099
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3100
|
+
this.notifyFormActivity();
|
|
2988
3101
|
const sectionObject = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
|
|
2989
3102
|
if (!sectionObject) {
|
|
2990
3103
|
return;
|
|
@@ -3000,6 +3113,7 @@ class BasicFormComponent {
|
|
|
3000
3113
|
}
|
|
3001
3114
|
startAction(code) {
|
|
3002
3115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3116
|
+
this.notifyFormActivity();
|
|
3003
3117
|
const actionObject = this.getAction(code);
|
|
3004
3118
|
if (!actionObject) {
|
|
3005
3119
|
return;
|
|
@@ -3072,38 +3186,39 @@ class BasicFormComponent {
|
|
|
3072
3186
|
*/
|
|
3073
3187
|
onFieldInput(codes, callback, properties = null) {
|
|
3074
3188
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3075
|
-
fieldSet.forEach((
|
|
3076
|
-
if (!this._fieldInputValidation[
|
|
3077
|
-
this._fieldInputValidation[
|
|
3189
|
+
fieldSet.forEach((code) => {
|
|
3190
|
+
if (!this._fieldInputValidation[code]) {
|
|
3191
|
+
this._fieldInputValidation[code] = [];
|
|
3078
3192
|
}
|
|
3079
|
-
this._fieldInputValidation[
|
|
3193
|
+
this._fieldInputValidation[code].push({ callback, properties });
|
|
3080
3194
|
});
|
|
3081
3195
|
}
|
|
3082
3196
|
onFieldValidationStart(codes, callback, properties = null) {
|
|
3083
3197
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3084
|
-
fieldSet.forEach((
|
|
3085
|
-
if (!this._fieldValidationsStart[
|
|
3086
|
-
this._fieldValidationsStart[
|
|
3198
|
+
fieldSet.forEach((code) => {
|
|
3199
|
+
if (!this._fieldValidationsStart[code]) {
|
|
3200
|
+
this._fieldValidationsStart[code] = [];
|
|
3087
3201
|
}
|
|
3088
|
-
this._fieldValidationsStart[
|
|
3202
|
+
this._fieldValidationsStart[code].push({ callback, properties });
|
|
3089
3203
|
});
|
|
3090
3204
|
}
|
|
3091
3205
|
onFieldValidationFinish(codes, callback, properties = null) {
|
|
3092
3206
|
const fieldSet = (Array.isArray(codes)) ? codes : (codes ? [codes] : []);
|
|
3093
|
-
fieldSet.forEach((
|
|
3094
|
-
if (!this._fieldValidationsFinish[
|
|
3095
|
-
this._fieldValidationsFinish[
|
|
3207
|
+
fieldSet.forEach((code) => {
|
|
3208
|
+
if (!this._fieldValidationsFinish[code]) {
|
|
3209
|
+
this._fieldValidationsFinish[code] = [];
|
|
3096
3210
|
}
|
|
3097
|
-
this._fieldValidationsFinish[
|
|
3211
|
+
this._fieldValidationsFinish[code].push({ callback, properties });
|
|
3098
3212
|
});
|
|
3099
3213
|
}
|
|
3100
|
-
startFieldInputValidation(
|
|
3214
|
+
startFieldInputValidation(code, intrinsicValidation = true) {
|
|
3101
3215
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3102
|
-
|
|
3216
|
+
this.notifyFormActivity();
|
|
3217
|
+
const fieldToValidate = this.getField(code);
|
|
3103
3218
|
if (!fieldToValidate) {
|
|
3104
3219
|
return false;
|
|
3105
3220
|
}
|
|
3106
|
-
const validationCallbacks = this._fieldInputValidation[
|
|
3221
|
+
const validationCallbacks = this._fieldInputValidation[code];
|
|
3107
3222
|
if (validationCallbacks) {
|
|
3108
3223
|
const clientValidationPromises = [];
|
|
3109
3224
|
for (const validationMethod of validationCallbacks) {
|
|
@@ -3116,13 +3231,14 @@ class BasicFormComponent {
|
|
|
3116
3231
|
return true;
|
|
3117
3232
|
});
|
|
3118
3233
|
}
|
|
3119
|
-
startFieldValidation(
|
|
3234
|
+
startFieldValidation(code, intrinsicValidation = true) {
|
|
3120
3235
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3121
|
-
|
|
3236
|
+
this.notifyFormActivity();
|
|
3237
|
+
const fieldToValidate = this.getField(code);
|
|
3122
3238
|
if (!fieldToValidate) {
|
|
3123
3239
|
return;
|
|
3124
3240
|
}
|
|
3125
|
-
const validationCallbacks = this._fieldValidationsStart[
|
|
3241
|
+
const validationCallbacks = this._fieldValidationsStart[code];
|
|
3126
3242
|
if (validationCallbacks) {
|
|
3127
3243
|
const clientValidationPromises = [];
|
|
3128
3244
|
for (const validationMethod of validationCallbacks) {
|
|
@@ -3153,10 +3269,9 @@ class BasicFormComponent {
|
|
|
3153
3269
|
if (fieldObj.backend) {
|
|
3154
3270
|
fieldObj.validating = true;
|
|
3155
3271
|
validationResult = yield this
|
|
3156
|
-
.requestFormAction(formActions.validate, fieldObj.
|
|
3272
|
+
.requestFormAction(formActions.validate, fieldObj.code);
|
|
3157
3273
|
serverError = !!this.errorOccured();
|
|
3158
3274
|
}
|
|
3159
|
-
yield this.finishFieldValidation(fieldObj, validationResult, serverError);
|
|
3160
3275
|
if (serverError) {
|
|
3161
3276
|
fieldObj === null || fieldObj === void 0 ? void 0 : fieldObj.setErrorCode(this.errorCode);
|
|
3162
3277
|
fieldObj === null || fieldObj === void 0 ? void 0 : fieldObj.setErrorMessage(this.errorMessage);
|
|
@@ -3165,13 +3280,14 @@ class BasicFormComponent {
|
|
|
3165
3280
|
callback(fieldObj);
|
|
3166
3281
|
}
|
|
3167
3282
|
}
|
|
3283
|
+
yield this.finishFieldValidation(fieldObj, validationResult, serverError);
|
|
3168
3284
|
fieldObj.validating = false;
|
|
3169
3285
|
});
|
|
3170
3286
|
}
|
|
3171
3287
|
finishFieldValidation(fieldObject, validationResult, serverError = false) {
|
|
3172
3288
|
var _a;
|
|
3173
3289
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3174
|
-
const validationCallbacks = this._fieldValidationsFinish[fieldObject.
|
|
3290
|
+
const validationCallbacks = this._fieldValidationsFinish[fieldObject.code];
|
|
3175
3291
|
if (validationCallbacks) {
|
|
3176
3292
|
const clientActionPromises = [];
|
|
3177
3293
|
for (const validationMethod of validationCallbacks) {
|
|
@@ -3185,9 +3301,9 @@ class BasicFormComponent {
|
|
|
3185
3301
|
}
|
|
3186
3302
|
});
|
|
3187
3303
|
}
|
|
3188
|
-
continueFieldValidation(
|
|
3304
|
+
continueFieldValidation(code) {
|
|
3189
3305
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3190
|
-
return this.startServerFieldValidation(
|
|
3306
|
+
return this.startServerFieldValidation(code);
|
|
3191
3307
|
});
|
|
3192
3308
|
}
|
|
3193
3309
|
/**
|
|
@@ -3299,6 +3415,7 @@ class BasicFormComponent {
|
|
|
3299
3415
|
}
|
|
3300
3416
|
startTableGlobalAction(tableActionEvent) {
|
|
3301
3417
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3418
|
+
this.notifyFormActivity();
|
|
3302
3419
|
const { tableCode, actionCode } = tableActionEvent;
|
|
3303
3420
|
const tableObject = this.getTable(tableCode);
|
|
3304
3421
|
if (!tableObject || !actionCode) {
|
|
@@ -3386,6 +3503,7 @@ class BasicFormComponent {
|
|
|
3386
3503
|
}
|
|
3387
3504
|
startTableAction(tableActionEvent) {
|
|
3388
3505
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3506
|
+
this.notifyFormActivity();
|
|
3389
3507
|
const { tableCode, actionCode, actionDetail } = tableActionEvent;
|
|
3390
3508
|
const tableObject = this.getTable(tableCode);
|
|
3391
3509
|
if (!tableObject || !actionCode) {
|
|
@@ -3478,6 +3596,7 @@ class BasicFormComponent {
|
|
|
3478
3596
|
}
|
|
3479
3597
|
startTableRecordSelection(tableActionEvent) {
|
|
3480
3598
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3599
|
+
this.notifyFormActivity();
|
|
3481
3600
|
const { tableCode, actionDetail } = tableActionEvent;
|
|
3482
3601
|
const tableObject = this.getTable(tableCode);
|
|
3483
3602
|
if (!tableObject) {
|
|
@@ -3556,6 +3675,7 @@ class BasicFormComponent {
|
|
|
3556
3675
|
}
|
|
3557
3676
|
startTableSelectionAction(tableActionEvent) {
|
|
3558
3677
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3678
|
+
this.notifyFormActivity();
|
|
3559
3679
|
const { tableCode, actionCode, actionDetail } = tableActionEvent;
|
|
3560
3680
|
const tableObject = this.getTable(tableCode);
|
|
3561
3681
|
if (!tableObject || !actionCode) {
|
|
@@ -3643,6 +3763,7 @@ class BasicFormComponent {
|
|
|
3643
3763
|
}
|
|
3644
3764
|
startTableGetData(tableActionEvent) {
|
|
3645
3765
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3766
|
+
this.notifyFormActivity();
|
|
3646
3767
|
const { tableCode } = tableActionEvent;
|
|
3647
3768
|
const tableObject = this.getTable(tableCode);
|
|
3648
3769
|
const tableActionDetail = {
|
|
@@ -3722,8 +3843,8 @@ class BasicFormComponent {
|
|
|
3722
3843
|
validationError = true;
|
|
3723
3844
|
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
3724
3845
|
this.tagFieldsWithError(this.formConfig.formStandardErrors.requiredField, requiredEmptyFields);
|
|
3725
|
-
for (const
|
|
3726
|
-
const requiredEmptyField = this.getField(
|
|
3846
|
+
for (const code of requiredEmptyFields) {
|
|
3847
|
+
const requiredEmptyField = this.getField(code);
|
|
3727
3848
|
requiredEmptyField === null || requiredEmptyField === void 0 ? void 0 : requiredEmptyField.focus();
|
|
3728
3849
|
break;
|
|
3729
3850
|
}
|
|
@@ -3732,8 +3853,8 @@ class BasicFormComponent {
|
|
|
3732
3853
|
if (!validationError && validationIssueFields.length > 0) {
|
|
3733
3854
|
validationError = true;
|
|
3734
3855
|
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
3735
|
-
for (const
|
|
3736
|
-
const validationIssueField = this.getField(
|
|
3856
|
+
for (const code of validationIssueFields) {
|
|
3857
|
+
const validationIssueField = this.getField(code);
|
|
3737
3858
|
if (validationIssueField) {
|
|
3738
3859
|
validationIssueField.focus();
|
|
3739
3860
|
}
|
|
@@ -3750,13 +3871,14 @@ class BasicFormComponent {
|
|
|
3750
3871
|
if (tableRecord && columnNames) {
|
|
3751
3872
|
for (const columnName of columnNames) {
|
|
3752
3873
|
const columnValue = (_a = tableRecord.getFieldValue(columnName)) !== null && _a !== void 0 ? _a : '';
|
|
3753
|
-
const
|
|
3754
|
-
this.setFieldValue(
|
|
3874
|
+
const code = (_b = mappingTable === null || mappingTable === void 0 ? void 0 : mappingTable[columnName]) !== null && _b !== void 0 ? _b : columnName;
|
|
3875
|
+
this.setFieldValue(code, columnValue);
|
|
3755
3876
|
}
|
|
3756
3877
|
return true;
|
|
3757
3878
|
}
|
|
3758
3879
|
return false;
|
|
3759
3880
|
}
|
|
3881
|
+
notifyFormActivity() { this._eventEmiter.next('formActivity', { code: this.formCode }); }
|
|
3760
3882
|
/**
|
|
3761
3883
|
* Métodos Legacy de compatibilidad hacia atrás
|
|
3762
3884
|
*/
|
|
@@ -3839,9 +3961,9 @@ class BasicFormComponent {
|
|
|
3839
3961
|
return this.onTableGetDataFinish(code, callback, properties);
|
|
3840
3962
|
}
|
|
3841
3963
|
}
|
|
3842
|
-
BasicFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3843
|
-
BasicFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
3844
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
3964
|
+
BasicFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: BasicFormComponent, deps: [{ token: LibFormManagerService }, { token: LibEventManagerService }, { token: LibFileManagementService }], target: i0.ɵɵFactoryTarget.Component });
|
|
3965
|
+
BasicFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: BasicFormComponent, selector: "ng-component", ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
3966
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: BasicFormComponent, decorators: [{
|
|
3845
3967
|
type: Component,
|
|
3846
3968
|
args: [{
|
|
3847
3969
|
template: `<ng-content></ng-content>`
|
|
@@ -3863,8 +3985,8 @@ const COMPONENTS = [
|
|
|
3863
3985
|
];
|
|
3864
3986
|
class TuainNgFormsLibModule {
|
|
3865
3987
|
}
|
|
3866
|
-
TuainNgFormsLibModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
3867
|
-
TuainNgFormsLibModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
3988
|
+
TuainNgFormsLibModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: TuainNgFormsLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
3989
|
+
TuainNgFormsLibModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.6", ngImport: i0, type: TuainNgFormsLibModule, declarations: [BasicFormComponent,
|
|
3868
3990
|
ActionComponent,
|
|
3869
3991
|
FieldComponent,
|
|
3870
3992
|
ElementComponent,
|
|
@@ -3887,12 +4009,10 @@ TuainNgFormsLibModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", v
|
|
|
3887
4009
|
LibTableRecordActionComponent,
|
|
3888
4010
|
LibTableRecordFieldComponent,
|
|
3889
4011
|
LibTableComponent] });
|
|
3890
|
-
TuainNgFormsLibModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
]] });
|
|
3895
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.1", ngImport: i0, type: TuainNgFormsLibModule, decorators: [{
|
|
4012
|
+
TuainNgFormsLibModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: TuainNgFormsLibModule, imports: [CommonModule,
|
|
4013
|
+
RouterModule,
|
|
4014
|
+
FormsModule] });
|
|
4015
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: TuainNgFormsLibModule, decorators: [{
|
|
3896
4016
|
type: NgModule,
|
|
3897
4017
|
args: [{
|
|
3898
4018
|
declarations: COMPONENTS,
|