tuain-ng-forms-lib 14.3.19 → 14.4.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/esm2020/lib/classes/forms/element.mjs +8 -69
  2. package/esm2020/lib/classes/forms/field.mjs +2 -9
  3. package/esm2020/lib/classes/forms/form.mjs +6 -2
  4. package/esm2020/lib/classes/forms/piece.mjs +115 -0
  5. package/esm2020/lib/classes/forms/section.mjs +25 -28
  6. package/esm2020/lib/classes/forms/subsection.mjs +12 -15
  7. package/esm2020/lib/classes/forms/table/action.mjs +5 -18
  8. package/esm2020/lib/classes/forms/table/column.mjs +4 -14
  9. package/esm2020/lib/classes/forms/table/table.mjs +50 -37
  10. package/esm2020/lib/components/elements/action.component.mjs +26 -13
  11. package/esm2020/lib/components/elements/field.component.mjs +18 -20
  12. package/esm2020/lib/components/elements/layout/element.component.mjs +5 -16
  13. package/esm2020/lib/components/elements/layout/form-header.component.mjs +5 -5
  14. package/esm2020/lib/components/elements/layout/piece.component.mjs +22 -0
  15. package/esm2020/lib/components/elements/layout/section.component.mjs +20 -5
  16. package/esm2020/lib/components/elements/layout/sub-section.component.mjs +20 -7
  17. package/esm2020/lib/components/elements/tables/table-record-action.component.mjs +21 -5
  18. package/esm2020/lib/components/elements/tables/table.component.mjs +67 -47
  19. package/esm2020/lib/components/forms/basic-form.mjs +25 -14
  20. package/fesm2015/tuain-ng-forms-lib.mjs +460 -339
  21. package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
  22. package/fesm2020/tuain-ng-forms-lib.mjs +436 -320
  23. package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
  24. package/lib/classes/forms/element.d.ts +3 -29
  25. package/lib/classes/forms/field.d.ts +0 -3
  26. package/lib/classes/forms/form.d.ts +3 -0
  27. package/lib/classes/forms/piece.d.ts +43 -0
  28. package/lib/classes/forms/section.d.ts +8 -18
  29. package/lib/classes/forms/subsection.d.ts +7 -12
  30. package/lib/classes/forms/table/action.d.ts +3 -11
  31. package/lib/classes/forms/table/column.d.ts +2 -7
  32. package/lib/classes/forms/table/table.d.ts +1 -3
  33. package/lib/components/elements/action.component.d.ts +4 -8
  34. package/lib/components/elements/field.component.d.ts +4 -9
  35. package/lib/components/elements/layout/element.component.d.ts +3 -8
  36. package/lib/components/elements/layout/form-header.component.d.ts +3 -3
  37. package/lib/components/elements/layout/piece.component.d.ts +10 -0
  38. package/lib/components/elements/layout/section.component.d.ts +4 -3
  39. package/lib/components/elements/layout/sub-section.component.d.ts +4 -4
  40. package/lib/components/elements/tables/table-record-action.component.d.ts +2 -2
  41. package/lib/components/elements/tables/table.component.d.ts +6 -10
  42. package/lib/components/forms/basic-form.d.ts +2 -0
  43. package/package.json +1 -1
@@ -1,24 +1,81 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Component, Input, EventEmitter, Output, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
3
  import { __awaiter } from 'tslib';
4
- import { Subject, ReplaySubject } from 'rxjs';
4
+ import { BehaviorSubject, Subject, ReplaySubject } from 'rxjs';
5
5
  import yn from 'yn';
6
6
  import { nanoid } from 'nanoid';
7
7
  import { CommonModule } from '@angular/common';
8
8
  import { RouterModule } from '@angular/router';
9
9
  import { FormsModule } from '@angular/forms';
10
10
 
11
- class ActionComponent {
11
+ class PieceComponent {
12
12
  constructor() {
13
+ this.visible = true;
14
+ this.disabled = false;
15
+ }
16
+ defaultProcessAttributeChange(attribute, value) {
17
+ attribute && (this[attribute] = value);
18
+ }
19
+ customProcessAttributeChange(attribute, value) { }
20
+ }
21
+ PieceComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: PieceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
22
+ PieceComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: PieceComponent, selector: "lib-piece", ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
23
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: PieceComponent, decorators: [{
24
+ type: Component,
25
+ args: [{
26
+ selector: 'lib-piece',
27
+ template: `<ng-content></ng-content>`
28
+ }]
29
+ }] });
30
+
31
+ class ElementComponent extends PieceComponent {
32
+ start() { }
33
+ }
34
+ ElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
35
+ ElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: ElementComponent, selector: "lib-element", inputs: { element: "element", form: "form" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
36
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ElementComponent, decorators: [{
37
+ type: Component,
38
+ args: [{
39
+ selector: 'lib-element',
40
+ template: `<ng-content></ng-content>`
41
+ }]
42
+ }], propDecorators: { element: [{
43
+ type: Input
44
+ }], form: [{
45
+ type: Input
46
+ }] } });
47
+
48
+ class ActionComponent extends ElementComponent {
49
+ constructor() {
50
+ super(...arguments);
51
+ this.inProgress = false;
52
+ this.action = null;
13
53
  this.style = 'primary';
14
54
  this.showLabel = true;
15
55
  }
16
56
  ngOnInit() {
17
- var _a;
57
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
58
+ if (!this.action) {
59
+ return;
60
+ }
18
61
  this.formConfig = (_a = this.action) === null || _a === void 0 ? void 0 : _a._formConfig;
62
+ const mapping = Object.entries((_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.actionPropagateAttributes);
63
+ for (let index = 0; index < mapping.length; index++) {
64
+ const actionAttr = (_c = mapping[index]) === null || _c === void 0 ? void 0 : _c[0];
65
+ const componentAttr = (_f = (_e = (_d = mapping[index]) === null || _d === void 0 ? void 0 : _d[1]) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _f !== void 0 ? _f : '';
66
+ if (componentAttr) {
67
+ const value = (_g = this.action) === null || _g === void 0 ? void 0 : _g[actionAttr];
68
+ this.defaultProcessAttributeChange(componentAttr, value);
69
+ this.customProcessAttributeChange(componentAttr, value);
70
+ }
71
+ }
72
+ (_j = (_h = this.action) === null || _h === void 0 ? void 0 : _h.attributeChange) === null || _j === void 0 ? void 0 : _j.subscribe(event => {
73
+ const { name: componentAttr, value } = event;
74
+ this.defaultProcessAttributeChange(componentAttr, value);
75
+ this.customProcessAttributeChange(componentAttr, value);
76
+ });
19
77
  this.start();
20
78
  }
21
- start() { }
22
79
  activate() {
23
80
  var _a;
24
81
  if ((_a = this.action) === null || _a === void 0 ? void 0 : _a.notifyActivation) {
@@ -38,17 +95,9 @@ class ActionComponent {
38
95
  }
39
96
  return false;
40
97
  }
41
- get visible() {
42
- var _a;
43
- return ((_a = this.action) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state)) && this.visibleOnRestriction();
44
- }
45
- get disabled() {
46
- var _a;
47
- return !((_a = this.action) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
48
- }
49
98
  }
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 });
99
+ ActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ActionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
100
+ ActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: ActionComponent, selector: "lib-action", inputs: { action: "action", busy: "busy", relatedField: "relatedField", style: "style", showLabel: "showLabel" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
52
101
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ActionComponent, decorators: [{
53
102
  type: Component,
54
103
  args: [{
@@ -61,8 +110,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
61
110
  type: Input
62
111
  }], relatedField: [{
63
112
  type: Input
64
- }], state: [{
65
- type: Input
66
113
  }], style: [{
67
114
  type: Input
68
115
  }], showLabel: [{
@@ -71,8 +118,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
71
118
 
72
119
  const VALUE = 'value';
73
120
  const FOCUS = 'focus';
74
- class FieldComponent {
121
+ class FieldComponent extends ElementComponent {
75
122
  constructor() {
123
+ super(...arguments);
76
124
  // Atributos obtenidos estáticamente
77
125
  this.code = '';
78
126
  this.info = '';
@@ -81,28 +129,30 @@ class FieldComponent {
81
129
  this.field = null;
82
130
  }
83
131
  ngOnInit() {
84
- var _a, _b, _c;
132
+ var _a, _b, _c, _d, _e, _f, _g, _h;
85
133
  if (!this.field) {
86
134
  return;
87
135
  }
88
136
  this.formConfig = (_a = this.field) === null || _a === void 0 ? void 0 : _a._formConfig;
89
- // Inicialización
90
- const mapping = this.formConfig.fieldPropagateAttributes;
137
+ const mapping = Object.entries((_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.fieldPropagateAttributes);
91
138
  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);
139
+ const fieldAttr = (_c = mapping[index]) === null || _c === void 0 ? void 0 : _c[0];
140
+ const componentAttr = (_f = (_e = (_d = mapping[index]) === null || _d === void 0 ? void 0 : _d[1]) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _f !== void 0 ? _f : '';
141
+ if (componentAttr) {
142
+ const value = (_g = this.field) === null || _g === void 0 ? void 0 : _g[fieldAttr];
143
+ this.defaultProcessAttributeChange(componentAttr, value);
144
+ this.customProcessAttributeChange(componentAttr, value);
145
+ }
96
146
  }
97
147
  // 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);
148
+ (_h = this.field) === null || _h === void 0 ? void 0 : _h.attributeChange.subscribe(event => {
149
+ const { name: componentAttr, value } = event;
150
+ this.defaultProcessAttributeChange(componentAttr, value);
151
+ this.customProcessAttributeChange(componentAttr, value);
102
152
  });
103
153
  this.start();
104
154
  }
105
- dafaultProcessFieldChange(attribute, value) {
155
+ defaultProcessAttributeChange(attribute, value) {
106
156
  if (attribute === VALUE) {
107
157
  this.updateValue();
108
158
  }
@@ -113,14 +163,10 @@ class FieldComponent {
113
163
  this[attribute] = value;
114
164
  }
115
165
  }
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
166
  updateValue() { var _a; this.value = (_a = this.field) === null || _a === void 0 ? void 0 : _a.value; }
119
167
  onInputChange() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionPartial(); }, 50); }
120
168
  onChangeContent() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionFinish(); }, 50); }
121
169
  onShowInfo(detail = null) { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionDetailRequest(detail); }, 50); }
122
- processFieldChange(attribute, value) { }
123
- start() { }
124
170
  focus() { }
125
171
  updateObject() { var _a; (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value); }
126
172
  inputChanged() {
@@ -138,8 +184,8 @@ class FieldComponent {
138
184
  return (k > 47 && k < 58);
139
185
  }
140
186
  }
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 });
187
+ FieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
188
+ FieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: FieldComponent, selector: "lib-field", inputs: { field: "field" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
143
189
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FieldComponent, decorators: [{
144
190
  type: Component,
145
191
  args: [{
@@ -148,40 +194,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
148
194
  }]
149
195
  }], propDecorators: { field: [{
150
196
  type: Input
151
- }], state: [{
152
- type: Input
153
- }] } });
154
-
155
- class ElementComponent {
156
- ngOnInit() {
157
- var _a;
158
- this.formConfig = (_a = this.element) === null || _a === void 0 ? void 0 : _a._formConfig;
159
- this.start();
160
- }
161
- start() { }
162
- get visible() {
163
- var _a;
164
- return (_a = this.element) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state);
165
- }
166
- get disabled() {
167
- var _a;
168
- return !((_a = this.element) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
169
- }
170
- }
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: [{
174
- type: Component,
175
- args: [{
176
- selector: 'lib-element',
177
- template: `<ng-content></ng-content>`
178
- }]
179
- }], propDecorators: { element: [{
180
- type: Input
181
- }], form: [{
182
- type: Input
183
- }], state: [{
184
- type: Input
185
197
  }] } });
186
198
 
187
199
  class FormErrorComponent {
@@ -204,7 +216,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
204
216
 
205
217
  class FormHeaderComponent {
206
218
  constructor() {
207
- this.goBackAction = false;
219
+ this.canGoBack = false;
208
220
  this.goBackEvent = new EventEmitter();
209
221
  }
210
222
  goBackForm() {
@@ -212,16 +224,16 @@ class FormHeaderComponent {
212
224
  }
213
225
  }
214
226
  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 });
227
+ FormHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: FormHeaderComponent, selector: "lib-form-header", inputs: { form: "form", canGoBack: "canGoBack", showTitle: "showTitle", headerActions: "headerActions" }, outputs: { goBackEvent: "goBackEvent" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
216
228
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FormHeaderComponent, decorators: [{
217
229
  type: Component,
218
230
  args: [{
219
231
  selector: 'lib-form-header',
220
232
  template: `<ng-content></ng-content>`
221
233
  }]
222
- }], propDecorators: { formManager: [{
234
+ }], propDecorators: { form: [{
223
235
  type: Input
224
- }], goBackAction: [{
236
+ }], canGoBack: [{
225
237
  type: Input
226
238
  }], showTitle: [{
227
239
  type: Input
@@ -231,14 +243,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
231
243
  type: Output
232
244
  }] } });
233
245
 
234
- class SectionComponent {
246
+ class SectionComponent extends PieceComponent {
235
247
  ngOnInit() {
248
+ var _a, _b, _c, _d;
249
+ this.formConfig = (_a = this.section) === null || _a === void 0 ? void 0 : _a._formConfig;
250
+ const mapping = (_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.sectionPropagateAttributes;
251
+ for (let index = 0; index < mapping.length; index++) {
252
+ const attrName = mapping[index].toString();
253
+ const attributeValue = (_c = this.section) === null || _c === void 0 ? void 0 : _c[attrName];
254
+ this.defaultProcessAttributeChange(attrName, attributeValue);
255
+ this.customProcessAttributeChange(attrName, attributeValue);
256
+ }
257
+ // Subscripción a cambios en atributos
258
+ (_d = this.section) === null || _d === void 0 ? void 0 : _d.attributeChange.subscribe(event => {
259
+ const { name: attrName, value } = event;
260
+ this.defaultProcessAttributeChange(attrName, value);
261
+ this.customProcessAttributeChange(attrName, value);
262
+ });
236
263
  this.start();
237
264
  }
238
265
  start() { }
239
266
  }
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 });
267
+ SectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SectionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
268
+ SectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: SectionComponent, selector: "lib-section", inputs: { section: "section", form: "form" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
242
269
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SectionComponent, decorators: [{
243
270
  type: Component,
244
271
  args: [{
@@ -247,18 +274,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
247
274
  }]
248
275
  }], propDecorators: { section: [{
249
276
  type: Input
250
- }], formManager: [{
277
+ }], form: [{
251
278
  type: Input
252
279
  }] } });
253
280
 
254
- class SubSectionComponent {
281
+ class SubSectionComponent extends PieceComponent {
255
282
  ngOnInit() {
283
+ var _a, _b, _c, _d;
284
+ this.formConfig = (_a = this.subSection) === null || _a === void 0 ? void 0 : _a._formConfig;
285
+ const mapping = (_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.subSectionPropagateAttributes;
286
+ for (let index = 0; index < mapping.length; index++) {
287
+ const attrName = mapping[index].toString();
288
+ const attributeValue = (_c = this.subSection) === null || _c === void 0 ? void 0 : _c[attrName];
289
+ this.defaultProcessAttributeChange(attrName, attributeValue);
290
+ this.customProcessAttributeChange(attrName, attributeValue);
291
+ }
292
+ // Subscripción a cambios en atributos
293
+ (_d = this.subSection) === null || _d === void 0 ? void 0 : _d.attributeChange.subscribe(event => {
294
+ const { name: attrName, value } = event;
295
+ this.defaultProcessAttributeChange(attrName, value);
296
+ this.customProcessAttributeChange(attrName, value);
297
+ });
256
298
  this.start();
257
299
  }
258
300
  start() { }
259
301
  }
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 });
302
+ SubSectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SubSectionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
303
+ SubSectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: SubSectionComponent, selector: "lib-subsection", inputs: { subSection: "subSection", form: "form" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
262
304
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SubSectionComponent, decorators: [{
263
305
  type: Component,
264
306
  args: [{
@@ -267,18 +309,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
267
309
  }]
268
310
  }], propDecorators: { subSection: [{
269
311
  type: Input
270
- }], showHeader: [{
271
- type: Input
272
- }], formManager: [{
312
+ }], form: [{
273
313
  type: Input
274
314
  }] } });
275
315
 
276
316
  const INLINE_ACTION$1 = 'INLINE';
277
- class LibTableRecordActionComponent {
317
+ class LibTableRecordActionComponent extends PieceComponent {
278
318
  constructor() {
319
+ super(...arguments);
279
320
  this.actionSelected = new EventEmitter();
280
321
  }
281
322
  ngOnInit() {
323
+ var _a, _b, _c, _d;
324
+ this.formConfig = (_a = this.action) === null || _a === void 0 ? void 0 : _a._formConfig;
325
+ const mapping = (_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.actionPropagateAttributes;
326
+ for (let index = 0; index < mapping.length; index++) {
327
+ const attrName = mapping[index].toString();
328
+ const attributeValue = (_c = this.action) === null || _c === void 0 ? void 0 : _c[attrName];
329
+ this.defaultProcessAttributeChange(attrName, attributeValue);
330
+ this.customProcessAttributeChange(attrName, attributeValue);
331
+ }
332
+ // Subscripción a cambios en atributos
333
+ (_d = this.action) === null || _d === void 0 ? void 0 : _d.attributeChange.subscribe(event => {
334
+ const { name: attrName, value } = event;
335
+ this.defaultProcessAttributeChange(attrName, value);
336
+ this.customProcessAttributeChange(attrName, value);
337
+ });
282
338
  this.start();
283
339
  }
284
340
  start() { }
@@ -292,8 +348,8 @@ class LibTableRecordActionComponent {
292
348
  }
293
349
  class() { }
294
350
  }
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 });
351
+ LibTableRecordActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordActionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
352
+ 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" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
297
353
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordActionComponent, decorators: [{
298
354
  type: Component,
299
355
  args: [{
@@ -301,7 +357,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
301
357
  template: `<ng-content></ng-content>`,
302
358
  changeDetection: ChangeDetectionStrategy.OnPush
303
359
  }]
304
- }], ctorParameters: function () { return []; }, propDecorators: { recordId: [{
360
+ }], propDecorators: { recordId: [{
305
361
  type: Input
306
362
  }], recordData: [{
307
363
  type: Input
@@ -340,12 +396,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
340
396
  }] } });
341
397
 
342
398
  const changeViewAttributes = ['visibleRecords', 'currentPage', 'recordsPerPage'];
343
- class LibTableComponent {
399
+ class LibTableComponent extends ElementComponent {
344
400
  constructor() {
401
+ super(...arguments);
345
402
  this.currentPage = 1;
346
403
  this.globalSearch = false;
347
404
  this.globalFilterString = '';
348
- this.visibleRecords = [];
405
+ // visibleRecords: any[] = [];
349
406
  this.selectedRecords = [];
350
407
  this.totalRecordsNumber = 0;
351
408
  this.allSelected = false;
@@ -353,52 +410,74 @@ class LibTableComponent {
353
410
  this.loaded = false;
354
411
  this.selectable = false;
355
412
  this.hasActions = false;
356
- this.disabled = false;
413
+ this.table = null;
414
+ this.visibleRecords = [];
415
+ this.waiting = false;
357
416
  }
358
417
  ngOnInit() {
359
- var _a;
360
- if (this.table) {
361
- this.formConfig = (_a = this.table) === null || _a === void 0 ? void 0 : _a._formConfig;
362
- this.tableFieldStyles = this.formConfig.tableFieldStyles;
363
- this.selectable = this.table.selectable;
364
- this.hasActions = this.table.hasActions();
365
- this.inlineActions = this.table.getActions(this.formConfig.tableActions.inline);
366
- this.globalActions = this.table.getActions(this.formConfig.tableActions.global);
367
- this.selectionActions = this.table.getActions(this.formConfig.tableActions.selection);
368
- // Inicialización de campos mapeados del objeto
369
- const mapping = Object.entries(this.formConfig.componentTableAttrMap);
370
- for (let index = 0; index < mapping.length; index++) {
371
- const [tableAttrRaw, compAttrRaw] = mapping[index];
372
- const tableAttr = tableAttrRaw.toString();
373
- const compAttr = compAttrRaw.toString();
374
- this.syncAttribute(compAttr, this.table[tableAttr]);
375
- }
376
- // Subscripción a cambios en atributos
377
- this.table.attributeChange.subscribe(event => {
378
- const { name: tableAttr, value } = event;
379
- const compAttr = this.formConfig.componentTableAttrMap[tableAttr];
380
- this.syncAttribute(compAttr, value);
381
- });
418
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
419
+ if (!this.table) {
420
+ return;
421
+ }
422
+ this.formConfig = (_a = this.table) === null || _a === void 0 ? void 0 : _a._formConfig;
423
+ this.tableFieldStyles = (_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.tableFieldStyles;
424
+ this.selectable = (_c = this.table) === null || _c === void 0 ? void 0 : _c.selectable;
425
+ this.hasActions = (_d = this.table) === null || _d === void 0 ? void 0 : _d.hasActions();
426
+ this.inlineActions = (_e = this.table) === null || _e === void 0 ? void 0 : _e.getActions((_f = this.formConfig) === null || _f === void 0 ? void 0 : _f.tableActions.inline);
427
+ this.globalActions = (_g = this.table) === null || _g === void 0 ? void 0 : _g.getActions((_h = this.formConfig) === null || _h === void 0 ? void 0 : _h.tableActions.global);
428
+ this.selectionActions = (_j = this.table) === null || _j === void 0 ? void 0 : _j.getActions((_k = this.formConfig) === null || _k === void 0 ? void 0 : _k.tableActions.selection);
429
+ // Inicialización de campos mapeados del objeto
430
+ const mapping = Object.entries((_l = this.formConfig) === null || _l === void 0 ? void 0 : _l.actionPropagateAttributes);
431
+ for (let index = 0; index < mapping.length; index++) {
432
+ const tableAttr = (_m = mapping[index]) === null || _m === void 0 ? void 0 : _m[0];
433
+ const componentAttr = (_q = (_p = (_o = mapping[index]) === null || _o === void 0 ? void 0 : _o[1]) === null || _p === void 0 ? void 0 : _p.toString()) !== null && _q !== void 0 ? _q : '';
434
+ const attributeValue = (_r = this.table) === null || _r === void 0 ? void 0 : _r[tableAttr];
435
+ this.defaultProcessAttributeChange(componentAttr, attributeValue);
436
+ this.customProcessAttributeChange(componentAttr, attributeValue);
382
437
  }
438
+ // Subscripción a cambios en atributos
439
+ (_s = this.table) === null || _s === void 0 ? void 0 : _s.attributeChange.subscribe(event => {
440
+ const { name: attrName, value } = event;
441
+ this.defaultProcessAttributeChange(attrName, value);
442
+ this.customProcessAttributeChange(attrName, value);
443
+ });
444
+ // Suscripción a los cambios de atributos de las columnas
445
+ // this.table.columns.forEach(column => {
446
+ // mapping = this.formConfig?.tableColumnPropagateAttributes;
447
+ // for (let index = 0; index < mapping.length; index++) {
448
+ // const attrName = mapping[index].toString();
449
+ // const attributeValue = column?.[attrName];
450
+ // this.defaultColumnAttributeChange(column, attrName, attributeValue);
451
+ // }
452
+ // column?.attributeChange.subscribe(event => {
453
+ // const { name: attrName, value } = event;
454
+ // this.defaultColumnAttributeChange(column, attrName, value);
455
+ // });
456
+ // });
383
457
  this.start();
384
458
  }
385
- start() { }
459
+ // defaultColumnAttributeChange(column: any, attribute: string, value?: any) {
460
+ // attribute && (column[attribute] = value);
461
+ // }
386
462
  updateTableData() { }
387
- tableGlobalAction(actionCode) { this.table.notifyGlobalAction(actionCode); }
388
- tableSelectionAction(actionCode) { this.table.notifySelectionAction(actionCode); }
389
- tableActionSelected(actionEvent) { this.table.notifyInlineAction(actionEvent); }
390
- tableSelectionToggle(recordId) { this.table.notifyRecordSelection(recordId); }
391
- toggleSelectAll() { return (this.allSelected) ? this.table.unSelectAll() : this.table.selectAll(); }
463
+ tableGlobalAction(actionCode) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyGlobalAction(actionCode); }
464
+ tableSelectionAction(actionCode) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifySelectionAction(actionCode); }
465
+ tableActionSelected(actionEvent) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyInlineAction(actionEvent); }
466
+ tableSelectionToggle(recordId) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyRecordSelection(recordId); }
467
+ toggleSelectAll() { var _a, _b; return (this.allSelected) ? (_a = this.table) === null || _a === void 0 ? void 0 : _a.unSelectAll() : (_b = this.table) === null || _b === void 0 ? void 0 : _b.selectAll(); }
392
468
  globalFilterCompleted() { this.changePage(1); }
393
- changePage(requestedPage) { this.table.changePage(requestedPage); }
394
- tableColumnSort(columnName, direction = null) { this.table.sort(columnName, direction !== null && direction !== void 0 ? direction : 'ascend'); }
395
- globalFilterChanged() { var _a, _b; this.table.setGlobalFilterString((_b = (_a = this.globalFilterString) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '', false); }
396
- syncAttribute(name, value) {
469
+ changePage(requestedPage) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.changePage(requestedPage); }
470
+ tableColumnSort(columnName, direction = null) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.sort(columnName, direction !== null && direction !== void 0 ? direction : 'ascend'); }
471
+ globalFilterChanged() { var _a, _b, _c; (_a = this.table) === null || _a === void 0 ? void 0 : _a.setGlobalFilterString((_c = (_b = this.globalFilterString) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '', false); }
472
+ defaultProcessAttributeChange(attribute, value) {
473
+ if (!attribute) {
474
+ return false;
475
+ }
397
476
  try {
398
- if (name === 'visibleRecords') {
477
+ if (attribute === 'visibleRecords') {
399
478
  this.updateTableData();
400
479
  }
401
- this[name] = value;
480
+ this[attribute] = value;
402
481
  return true;
403
482
  }
404
483
  catch (_a) {
@@ -406,16 +485,17 @@ class LibTableComponent {
406
485
  }
407
486
  }
408
487
  filterHasChanged(column, values) {
488
+ var _a, _b;
409
489
  if (!values || values.length === 0) {
410
- this.table.removeColumnFilter(column.fieldCode);
490
+ (_a = this.table) === null || _a === void 0 ? void 0 : _a.removeColumnFilter(column.fieldCode);
411
491
  }
412
492
  else {
413
- this.table.addColumnFilter(column.fieldCode, values);
493
+ (_b = this.table) === null || _b === void 0 ? void 0 : _b.addColumnFilter(column.fieldCode, values);
414
494
  }
415
495
  }
416
496
  }
417
- LibTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
418
- 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 });
497
+ LibTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
498
+ LibTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: LibTableComponent, selector: "lib-table", inputs: { table: "table", visibleRecords: "visibleRecords", waiting: "waiting" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
419
499
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableComponent, decorators: [{
420
500
  type: Component,
421
501
  args: [{
@@ -425,11 +505,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
425
505
  }]
426
506
  }], propDecorators: { table: [{
427
507
  type: Input
428
- }], tableRecords: [{
429
- type: Input
430
- }], disabled: [{
431
- type: Input
432
- }], state: [{
508
+ }], visibleRecords: [{
433
509
  type: Input
434
510
  }], waiting: [{
435
511
  type: Input
@@ -461,23 +537,30 @@ const operators = {
461
537
  IN: 'IN',
462
538
  };
463
539
 
464
- class FormElement {
465
- constructor(elementDefinition, formConfig) {
466
- var _a, _b, _c;
540
+ class FormPiece {
541
+ constructor(pieceDefinition, formConfig) {
542
+ var _a, _b, _c, _d;
543
+ this._attributeChange = new BehaviorSubject(null);
544
+ this._formState = '';
467
545
  this._visible = true;
546
+ this._disabled = false;
468
547
  this.visibleStates = null;
469
548
  this.enabledStates = null;
470
- this.elementType = null;
549
+ this.visibleOnState = true;
550
+ this.disabledOnState = false;
551
+ this.customAttributes = {};
471
552
  this._formConfig = formConfig;
472
553
  this._isForced = false;
473
- this.setVisibleStates(elementDefinition.visibleStates);
474
- this.setEnabledStates(elementDefinition.enabledStates);
475
554
  this._visibleForced = false;
476
- this.disabled = (_a = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.disabled) !== null && _a !== void 0 ? _a : false;
477
- this.setVisibility((_b = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.visible) !== null && _b !== void 0 ? _b : true);
478
- this.customAttributes = (_c = elementDefinition === null || elementDefinition === void 0 ? void 0 : elementDefinition.customAttributes) !== null && _c !== void 0 ? _c : {};
555
+ this.setVisibleStates(pieceDefinition.visibleStates);
556
+ this.setEnabledStates(pieceDefinition.enabledStates);
557
+ this.enabled = (_a = !(pieceDefinition === null || pieceDefinition === void 0 ? void 0 : pieceDefinition.disabled)) !== null && _a !== void 0 ? _a : false;
558
+ this.setVisibility((_b = pieceDefinition === null || pieceDefinition === void 0 ? void 0 : pieceDefinition.visible) !== null && _b !== void 0 ? _b : true);
559
+ this.customAttributes = (_c = pieceDefinition === null || pieceDefinition === void 0 ? void 0 : pieceDefinition.customAttributes) !== null && _c !== void 0 ? _c : {};
560
+ if (pieceDefinition === null || pieceDefinition === void 0 ? void 0 : pieceDefinition.customAttributes) {
561
+ (_d = Object.keys(pieceDefinition === null || pieceDefinition === void 0 ? void 0 : pieceDefinition.customAttributes)) === null || _d === void 0 ? void 0 : _d.forEach(attr => this.customAttributes[attr] = pieceDefinition === null || pieceDefinition === void 0 ? void 0 : pieceDefinition.customAttributes[attr]);
562
+ }
479
563
  }
480
- ;
481
564
  getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
482
565
  setCustomAttribute(name, value) {
483
566
  if (name) {
@@ -490,9 +573,10 @@ class FormElement {
490
573
  });
491
574
  }
492
575
  matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
493
- isField() { return this.elementType === elementTypes.field; }
494
- isAction() { return this.elementType === elementTypes.action; }
495
- isTable() { return this.elementType === elementTypes.table; }
576
+ get attributeChange() { return this._attributeChange; }
577
+ propagateAttribute(name, value) {
578
+ this._attributeChange.next({ name, value });
579
+ }
496
580
  setVisibleStates(newStates) {
497
581
  const visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
498
582
  ? newStates.split(',').map(state => state.trim()).filter(state => state.length > 0)
@@ -507,47 +591,90 @@ class FormElement {
507
591
  }
508
592
  viewOnState(state) { return (this.visibleStates && state) ? this.visibleStates.includes(state) : false; }
509
593
  enabledOnState(state) { return (this.enabledStates && state) ? this.enabledStates.includes(state) : false; }
510
- /**
511
- * @deprecated Utilizar viewOnState
512
- */
513
- supportState(state) { return this.viewOnState(state); }
514
- /**
515
- * @deprecated Utilizar viewOnState
516
- */
517
- supportMode(state) { return this.viewOnState(state); }
518
- get visible() { return (this._isForced) ? this._visibleForced : this._visible; }
594
+ get visible() { return this._visible; }
519
595
  set visible(visible) { this.setVisibility(visible); }
520
596
  visibleOn(state) {
521
597
  return this.visible && this.viewOnState(state);
522
598
  }
523
599
  enabledOn(state) {
524
- return !this.disabled && this.enabledOnState(state);
600
+ return !this._disabled && this.enabledOnState(state);
525
601
  }
526
602
  setVisibility(visible, forced = null) {
527
603
  this._visible = visible && true;
528
- if (forced != null) {
604
+ this.propagateVisible();
605
+ if (forced !== null) {
529
606
  this._isForced = forced;
607
+ this._visibleForced = visible;
608
+ }
609
+ const formerVisibleOnState = this.visibleOnState;
610
+ this.visibleOnState = this.visible && this.viewOnState(this._formState);
611
+ if (formerVisibleOnState !== this.visibleOnState) {
612
+ this.propagateAttribute('visible', this.visibleOnState);
530
613
  }
531
614
  }
532
615
  show(forced = null) {
533
- this._visible = true;
534
- if (forced !== null) {
535
- this._isForced = forced;
536
- this._visibleForced = true;
537
- }
616
+ this.setVisibility(true, forced);
538
617
  }
539
618
  hide(forced = null) {
540
- this._visible = false;
541
- if (forced !== null) {
542
- this._isForced = forced;
543
- this._visibleForced = false;
544
- }
619
+ this.setVisibility(false, forced);
620
+ }
621
+ get disabled() { return this._disabled; }
622
+ get enabled() { return !this._disabled; }
623
+ get editable() { return !this._disabled; }
624
+ set enabled(enabled) {
625
+ this._disabled = !enabled;
626
+ const formerDisableOnState = this.disabledOnState;
627
+ this.disabledOnState = this._disabled || !this.enabledOnState(this._formState);
628
+ if (formerDisableOnState !== this.disabledOnState) {
629
+ this.propagateDisabled();
630
+ }
631
+ }
632
+ enable() { this.enabled = true; }
633
+ disable() { this.enabled = false; }
634
+ subscribeFormStateChange(formChangeSubject) {
635
+ this.formStateChangeCustom(formChangeSubject);
636
+ formChangeSubject.subscribe(event => {
637
+ const { state } = event !== null && event !== void 0 ? event : {};
638
+ if (state) {
639
+ this._formState = state;
640
+ this.visibleOnState = this.visible && this.viewOnState(state);
641
+ this.disabledOnState = this._disabled || !this.enabledOnState(state);
642
+ this.propagateVisible();
643
+ this.propagateDisabled();
644
+ }
645
+ });
646
+ }
647
+ formStateChangeCustom(formChangeSubject) { }
648
+ propagateVisible() {
649
+ this.propagateAttribute('visible', this.visibleOnState);
650
+ }
651
+ propagateDisabled() {
652
+ this.propagateAttribute('disabled', this.disabledOnState);
545
653
  }
546
- enable() { this.disabled = false; }
547
- disable() { this.disabled = true; }
548
- get enabled() { return !this.disabled; }
549
- get editable() { return !this.disabled; }
550
- set editable(editable) { this.disabled = !editable; }
654
+ }
655
+
656
+ class FormElement extends FormPiece {
657
+ constructor(elementDefinition, formConfig) {
658
+ super(elementDefinition, formConfig);
659
+ this.elementType = null;
660
+ }
661
+ ;
662
+ setAttr(attr, value) {
663
+ const { name: attrName, propagate: name } = attr;
664
+ this[attrName] = value;
665
+ name && this.propagateAttribute(name, value);
666
+ }
667
+ isField() { return this.elementType === elementTypes.field; }
668
+ isAction() { return this.elementType === elementTypes.action; }
669
+ isTable() { return this.elementType === elementTypes.table; }
670
+ /**
671
+ * @deprecated Utilizar viewOnState
672
+ */
673
+ supportState(state) { return this.viewOnState(state); }
674
+ /**
675
+ * @deprecated Utilizar viewOnState
676
+ */
677
+ supportMode(state) { return this.viewOnState(state); }
551
678
  }
552
679
 
553
680
  const HEADER = 'HEADER';
@@ -595,7 +722,7 @@ const directChanges = [
595
722
  'maxLength', 'maxValue', 'minLength', 'minValue', 'validateOnServer', 'serverAction', 'visibleLabel',
596
723
  'options',
597
724
  ];
598
- const attrs = {
725
+ const attrs$1 = {
599
726
  _captureType: { name: '_captureType', propagate: 'captureType' },
600
727
  _errorCode: { name: '_errorCode', propagate: 'errorCode' },
601
728
  _errorMessage: { name: '_errorMessage', propagate: 'errorMessage' },
@@ -631,7 +758,6 @@ class FieldDescriptor extends FormElement {
631
758
  this._editionFinish = new Subject();
632
759
  this._editionPartial = new Subject();
633
760
  this._detailRequest = new Subject();
634
- this._attributeChange = new Subject();
635
761
  this._errorType = '';
636
762
  this._errorCode = '';
637
763
  this._errorMessage = '';
@@ -658,7 +784,7 @@ class FieldDescriptor extends FormElement {
658
784
  this._tooltipText = '';
659
785
  this.elementType = elementTypes.field;
660
786
  const fld = (inputFieldReceived) ? inputFieldReceived : {};
661
- this.setAttr(attrs._fieldCode, fld.fieldCode);
787
+ this.setAttr(attrs$1._fieldCode, fld.fieldCode);
662
788
  this.title = (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : this._fieldCode;
663
789
  this.type = fld.fieldTypeCode;
664
790
  this.captureType = (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE;
@@ -697,17 +823,16 @@ class FieldDescriptor extends FormElement {
697
823
  this._setValue((_v = (_u = fld.fieldValue) !== null && _u !== void 0 ? _u : this._defaultValue) !== null && _v !== void 0 ? _v : '');
698
824
  }
699
825
  get alignment() { return this._fieldAlignment; }
700
- set alignment(alignment) { this.setAttr(attrs._fieldAlignment, alignment); }
701
- get attributeChange() { return this._attributeChange; }
826
+ set alignment(alignment) { this.setAttr(attrs$1._fieldAlignment, alignment); }
702
827
  get backend() { return this._validateOnServer; }
703
828
  get captureType() { return this._captureType; }
704
- set captureType(captureType) { this.setAttr(attrs._captureType, captureType); }
829
+ set captureType(captureType) { this.setAttr(attrs$1._captureType, captureType); }
705
830
  get code() { return this._fieldCode; }
706
831
  get fieldCode() { return this._fieldCode; }
707
832
  get defaultValue() { return this._defaultValue; }
708
- set defaultValue(defaultValue) { this.setAttr(attrs._defaultValue, defaultValue); }
833
+ set defaultValue(defaultValue) { this.setAttr(attrs$1._defaultValue, defaultValue); }
709
834
  get defaultEditable() { return this._defaultEditable; }
710
- set defaultEditable(editable) { this.setAttr(attrs._defaultEditable, editable); }
835
+ set defaultEditable(editable) { this.setAttr(attrs$1._defaultEditable, editable); }
711
836
  get detailRequest() { return this._detailRequest; }
712
837
  get editionFinish() { return this._editionFinish; }
713
838
  get editionPartial() { return this._editionPartial; }
@@ -742,31 +867,31 @@ class FieldDescriptor extends FormElement {
742
867
  get errorType() { return this._errorType; }
743
868
  get externalValue() { return this._externalValue; }
744
869
  get format() { return this._fieldFormat; }
745
- set format(format) { this.setAttr(attrs._fieldFormat, format); }
870
+ set format(format) { this.setAttr(attrs$1._fieldFormat, format); }
746
871
  get hasChanged() { return this._hasChanged; }
747
- set hasChanged(hasChanged) { this.setAttr(attrs._hasChanged, hasChanged); }
872
+ set hasChanged(hasChanged) { this.setAttr(attrs$1._hasChanged, hasChanged); }
748
873
  get info() { return this._fieldInfo; }
749
- set info(newInfo) { this.setAttr(attrs._fieldInfo, newInfo); }
750
- set intrinsicErrorMessage(message) { this.setAttr(attrs._intrinsicErrorMessage, message); }
874
+ set info(newInfo) { this.setAttr(attrs$1._fieldInfo, newInfo); }
875
+ set intrinsicErrorMessage(message) { this.setAttr(attrs$1._intrinsicErrorMessage, message); }
751
876
  get maxLength() { return (this._maxLength > 0) ? this._maxLength.toString() : ''; }
752
- set maxLength(requiredMaxLength) { this.setAttr(attrs._maxLength, +requiredMaxLength); }
877
+ set maxLength(requiredMaxLength) { this.setAttr(attrs$1._maxLength, +requiredMaxLength); }
753
878
  get maxValue() { return this._maxValue; }
754
879
  set maxValue(inputMaxValue) {
755
880
  let maxValue = inputMaxValue;
756
881
  if (this._fieldType === this._formConfig.fieldTypes.date) {
757
882
  maxValue = new Date(maxValue);
758
883
  }
759
- this.setAttr(attrs._maxValue, maxValue);
884
+ this.setAttr(attrs$1._maxValue, maxValue);
760
885
  }
761
886
  get minLength() { return this._minLength; }
762
- set minLength(requiredMinLength) { this.setAttr(attrs._minLength, +requiredMinLength); }
887
+ set minLength(requiredMinLength) { this.setAttr(attrs$1._minLength, +requiredMinLength); }
763
888
  get minValue() { return this._minValue; }
764
889
  set minValue(inputMinValue) {
765
890
  let minValue = inputMinValue;
766
891
  if (this._fieldType === this._formConfig.fieldTypes.date) {
767
892
  minValue = new Date(minValue);
768
893
  }
769
- this.setAttr(attrs._minValue, minValue);
894
+ this.setAttr(attrs$1._minValue, minValue);
770
895
  }
771
896
  get name() { return this._fieldCode; }
772
897
  get options() {
@@ -792,11 +917,11 @@ class FieldDescriptor extends FormElement {
792
917
  });
793
918
  fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
794
919
  && fieldOptions.length > 0) ? fieldOptions : [];
795
- this.setAttr(attrs._fieldOptions, fieldOptions);
920
+ this.setAttr(attrs$1._fieldOptions, fieldOptions);
796
921
  if (this._value) {
797
922
  if (this._fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._value)) {
798
923
  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); });
799
- this.setAttr(attrs._value, fieldValue);
924
+ this.setAttr(attrs$1._value, fieldValue);
800
925
  }
801
926
  else {
802
927
  const valInOptions = (_b = this._fieldOptions) === null || _b === void 0 ? void 0 : _b.find(item => item.fieldOptionId === this._value);
@@ -812,28 +937,28 @@ class FieldDescriptor extends FormElement {
812
937
  }
813
938
  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; }
814
939
  get outputOnly() { return this._outputOnly; }
815
- set outputOnly(outputOnly) { this.setAttr(attrs._outputOnly, outputOnly); }
940
+ set outputOnly(outputOnly) { this.setAttr(attrs$1._outputOnly, outputOnly); }
816
941
  get required() { return this._fieldRequired; }
817
- set required(required) { this.setAttr(attrs._fieldRequired, required !== null && required !== void 0 ? required : false); }
942
+ set required(required) { this.setAttr(attrs$1._fieldRequired, required !== null && required !== void 0 ? required : false); }
818
943
  get title() { return this._fieldTitle; }
819
- set title(title) { this.setAttr(attrs._fieldTitle, title.toString()); }
944
+ set title(title) { var _a; this.setAttr(attrs$1._fieldTitle, (_a = title === null || title === void 0 ? void 0 : title.toString()) !== null && _a !== void 0 ? _a : ''); }
820
945
  get tooltip() { return this._tooltipText; }
821
- set tooltip(tooltip) { this.setAttr(attrs._tooltipText, tooltip); }
946
+ set tooltip(tooltip) { this.setAttr(attrs$1._tooltipText, tooltip); }
822
947
  get type() { return this._fieldType; }
823
- set type(fieldType) { this.setAttr(attrs._fieldType, fieldType); }
948
+ set type(fieldType) { this.setAttr(attrs$1._fieldType, fieldType); }
824
949
  get validating() { return this._onValidation; }
825
- set validating(isValidating) { this.setAttr(attrs._onValidation, isValidating); }
950
+ set validating(isValidating) { this.setAttr(attrs$1._onValidation, isValidating); }
826
951
  get value() {
827
952
  return (this._fieldType === this._formConfig.fieldTypes.boolean
828
953
  || this._fieldType === this._formConfig.fieldTypes.check) ? yn(this._value) : this._value;
829
954
  }
830
955
  get validateOnServer() { return this._validateOnServer; }
831
- set validateOnServer(validateOnServer) { this.setAttr(attrs._validateOnServer, validateOnServer); }
956
+ set validateOnServer(validateOnServer) { this.setAttr(attrs$1._validateOnServer, validateOnServer); }
832
957
  get serverAction() { return this._validateOnServer; }
833
958
  set serverAction(validateOnServer) { this.validateOnServer = validateOnServer; }
834
959
  set value(newValue) { this._setValue(newValue); }
835
960
  get visibleLabel() { return this._visibleLabel; }
836
- set visibleLabel(visibleLabel) { this.setAttr(attrs._visibleLabel, visibleLabel); }
961
+ set visibleLabel(visibleLabel) { this.setAttr(attrs$1._visibleLabel, visibleLabel); }
837
962
  /**
838
963
  * @deprecated Use options
839
964
  */
@@ -851,7 +976,7 @@ class FieldDescriptor extends FormElement {
851
976
  */
852
977
  changed(hasChanged = true) { this.hasChanged = hasChanged; }
853
978
  clean() { this._setValue(this._defaultValue || ''); this.resetError(); }
854
- focus() { this.setAttr(attrs._focus, true); }
979
+ focus() { this.setAttr(attrs$1._focus, true); }
855
980
  getErrorCode() { return this.error.code; }
856
981
  setErrorCode(code) { this.setError(code, this._errorMessage); }
857
982
  getErrorMessage() { return this.error.message; }
@@ -960,15 +1085,10 @@ class FieldDescriptor extends FormElement {
960
1085
  const detailEvent = { code: this._fieldCode, detail };
961
1086
  this._detailRequest.next(detailEvent);
962
1087
  }
963
- setAttr(attr, value) {
964
- const { name: attrName, propagate: name } = attr;
965
- this[attrName] = value;
966
- name && this._attributeChange.next({ name, value });
967
- }
968
1088
  setError(code, message, type = DEFAULT_ERROR_TYPE) {
969
- this.setAttr(attrs._errorCode, code !== null && code !== void 0 ? code : NO_ERROR);
970
- this.setAttr(attrs._errorType, (this._errorCode === NO_ERROR) ? '' : type);
971
- this.setAttr(attrs._errorMessage, message !== null && message !== void 0 ? message : '');
1089
+ this.setAttr(attrs$1._errorCode, code !== null && code !== void 0 ? code : NO_ERROR);
1090
+ this.setAttr(attrs$1._errorType, (this._errorCode === NO_ERROR) ? '' : type);
1091
+ this.setAttr(attrs$1._errorMessage, message !== null && message !== void 0 ? message : '');
972
1092
  }
973
1093
  updateFromServer(fld) {
974
1094
  const fieldKeys = Object.keys(fld);
@@ -1024,7 +1144,7 @@ class FieldDescriptor extends FormElement {
1024
1144
  if (this._value !== newFinalValue) {
1025
1145
  this.hasChanged = true;
1026
1146
  if (widgetUpdate) {
1027
- this.setAttr(attrs._value, newFinalValue);
1147
+ this.setAttr(attrs$1._value, newFinalValue);
1028
1148
  }
1029
1149
  else {
1030
1150
  this._value = newFinalValue;
@@ -1034,23 +1154,21 @@ class FieldDescriptor extends FormElement {
1034
1154
  }
1035
1155
  }
1036
1156
 
1037
- class RecordTableColumn {
1157
+ class RecordTableColumn extends FormPiece {
1038
1158
  constructor(recTableColReceived, formConfig) {
1039
1159
  var _a, _b, _c;
1160
+ super(recTableColReceived, formConfig);
1040
1161
  this.fieldCode = '';
1041
1162
  this.fieldTitle = '';
1042
1163
  this.fieldType = '';
1043
1164
  this.fieldAlignment = '';
1044
1165
  this.fieldFormat = '';
1045
- this.visible = true;
1046
1166
  this.sortable = true;
1047
1167
  this.sortDirections = [];
1048
- this.customAttributes = {};
1049
1168
  // Filtros
1050
1169
  this.filterVisible = false;
1051
1170
  this.filterDef = null;
1052
1171
  this.filterSetup = null;
1053
- this._formConfig = formConfig;
1054
1172
  this.filterDef = null;
1055
1173
  if (recTableColReceived) {
1056
1174
  this.fieldCode = recTableColReceived.fieldCode;
@@ -1065,17 +1183,6 @@ class RecordTableColumn {
1065
1183
  this.customAttributes = (_c = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.customAttributes) !== null && _c !== void 0 ? _c : {};
1066
1184
  }
1067
1185
  }
1068
- getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
1069
- setCustomAttribute(name, value) {
1070
- if (name) {
1071
- this.customAttributes[name] = value;
1072
- }
1073
- }
1074
- setCustomAttributes(attributes) {
1075
- Object.entries(attributes).forEach(([name, value]) => {
1076
- this.setCustomAttribute(name, value);
1077
- });
1078
- }
1079
1186
  hideFilter() {
1080
1187
  this.filterVisible = false;
1081
1188
  }
@@ -1121,9 +1228,10 @@ class RecordTableColumn {
1121
1228
  }
1122
1229
  }
1123
1230
 
1124
- class TableAction {
1125
- constructor(actionDefinition) {
1126
- var _a, _b, _c;
1231
+ class TableAction extends FormPiece {
1232
+ constructor(actionDefinition, formConfig) {
1233
+ var _a, _b;
1234
+ super(actionDefinition, formConfig);
1127
1235
  this.actionCode = actionDefinition.actionCode;
1128
1236
  this.actionTitle = actionDefinition.actionTitle;
1129
1237
  this.iconName = actionDefinition.iconName || this.actionCode;
@@ -1131,28 +1239,11 @@ class TableAction {
1131
1239
  this.actionClass = actionDefinition.actionClass || 'INLINE';
1132
1240
  this.newState = actionDefinition.newState;
1133
1241
  this.stateField = actionDefinition.stateField || '';
1134
- this.visibleStates = actionDefinition.visibleStates || [];
1135
- this.enabledStates = actionDefinition.enabledStates || [];
1136
1242
  this.backend = (_a = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _a !== void 0 ? _a : false;
1137
1243
  this.restrictedOnField = actionDefinition.fieldRestrictedCode || '';
1138
1244
  this.restrictedOnValue = (_b = actionDefinition.valueRestricted) !== null && _b !== void 0 ? _b : '';
1139
1245
  this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
1140
- this.customAttributes = (_c = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.customAttributes) !== null && _c !== void 0 ? _c : {};
1141
- }
1142
- getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
1143
- setCustomAttribute(name, value) {
1144
- if (name) {
1145
- this.customAttributes[name] = value;
1146
- }
1147
- }
1148
- setCustomAttributes(attributes) {
1149
- Object.entries(attributes).forEach(([name, value]) => {
1150
- this.setCustomAttribute(name, value);
1151
- });
1152
1246
  }
1153
- supportMode(state) { return this.viewOnState(state); }
1154
- viewOnState(state) { return this.visibleStates.includes(state); }
1155
- enabledOnState(state) { return this.enabledStates.includes(state); }
1156
1247
  }
1157
1248
 
1158
1249
  class TableRecordData {
@@ -1267,6 +1358,21 @@ class TableRecordData {
1267
1358
 
1268
1359
  const TABLE_SORT_ASCENDING = 'asc';
1269
1360
  const TABLE_SORT_DESCENDING = 'desc';
1361
+ const attrs = {
1362
+ allSelected: { name: 'allSelected', propagate: 'allSelected' },
1363
+ tableCode: { name: 'tableCode', propagate: 'code' },
1364
+ clientPaging: { name: 'clientPaging', propagate: null },
1365
+ globalSearch: { name: 'globalSearch', propagate: 'globalSearch' },
1366
+ globalFilterString: { name: 'globalFilterString', propagate: null },
1367
+ sorting: { name: 'sorting', propagate: null },
1368
+ recordsPerPage: { name: 'recordsPerPage', propagate: 'recordsPerPage' },
1369
+ layout: { name: 'layout', propagate: 'layout' },
1370
+ columns: { name: 'columns', propagate: 'columns' },
1371
+ selectedRecords: { name: 'selectedRecords', propagate: 'selectedRecords' },
1372
+ currentPage: { name: 'currentPage', propagate: 'currentPage' },
1373
+ totalRecordsNumber: { name: 'totalRecordsNumber', propagate: 'totalRecordsNumber' },
1374
+ visibleRecords: { name: 'visibleRecords', propagate: 'visibleRecords' },
1375
+ };
1270
1376
  class RecordTable extends FormElement {
1271
1377
  constructor(tableReceived, formConfig) {
1272
1378
  var _a, _b, _c, _d, _e, _f;
@@ -1276,7 +1382,6 @@ class RecordTable extends FormElement {
1276
1382
  this._recordSelectionTrigger = new Subject();
1277
1383
  this._selectionActionTrigger = new Subject();
1278
1384
  this._getDataTrigger = new Subject();
1279
- this._attributeChange = new Subject();
1280
1385
  this._tableColumnObj = {};
1281
1386
  this._actionsObj = {};
1282
1387
  // Mecanismos de filtrado nueva versión
@@ -1307,22 +1412,23 @@ class RecordTable extends FormElement {
1307
1412
  this.selectable = (_b = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _b !== void 0 ? _b : false;
1308
1413
  this.selectionBackend = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _c !== void 0 ? _c : false;
1309
1414
  this.sortable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _d !== void 0 ? _d : false;
1310
- this.setAttr('allSelected', false);
1311
- this.setAttr('tableCode', tableReceived.tableCode);
1312
- this.setAttr('clientPaging', (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.clientPaging) !== null && _e !== void 0 ? _e : true);
1313
- this.setAttr('globalSearch', (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.simpleFilter) !== null && _f !== void 0 ? _f : false);
1314
- this.setAttr('globalFilterString', '');
1315
- this.setAttr('sorting', { columnName: '', direction: '' });
1316
- this.setAttr('recordsPerPage', formConfig.defaultRecordsPerPage);
1317
- this.setAttr('layout', '');
1415
+ this.setAttr(attrs.allSelected, false);
1416
+ this.setAttr(attrs.tableCode, tableReceived.tableCode);
1417
+ this.setAttr(attrs.clientPaging, (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.clientPaging) !== null && _e !== void 0 ? _e : true);
1418
+ this.setAttr(attrs.globalSearch, (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.simpleFilter) !== null && _f !== void 0 ? _f : false);
1419
+ this.setAttr(attrs.globalFilterString, '');
1420
+ this.setAttr(attrs.sorting, { columnName: '', direction: '' });
1421
+ this.setAttr(attrs.recordsPerPage, formConfig.defaultRecordsPerPage);
1422
+ this.setAttr(attrs.layout, '');
1318
1423
  if (tableReceived.fields) {
1319
1424
  const columns = [];
1320
1425
  for (const columnReceived of tableReceived.fields) {
1321
- const columnDefinition = new RecordTableColumn(columnReceived, this._formConfig);
1426
+ const columnEnriched = Object.assign(Object.assign({}, columnReceived), { visibleStates: this.visibleStates });
1427
+ const columnDefinition = new RecordTableColumn(columnEnriched, this._formConfig);
1322
1428
  columns.push(columnDefinition);
1323
1429
  this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
1324
1430
  }
1325
- this.setAttr('columns', columns);
1431
+ this.setAttr(attrs.columns, columns);
1326
1432
  }
1327
1433
  if (tableReceived.actions) {
1328
1434
  const tableActions = tableReceived.actions.map(objDef => {
@@ -1339,7 +1445,7 @@ class RecordTable extends FormElement {
1339
1445
  return Object.assign(Object.assign({}, objDef), { visibleStates, enabledStates });
1340
1446
  });
1341
1447
  for (const actionReceived of tableActions) {
1342
- const inlineAction = new TableAction(actionReceived);
1448
+ const inlineAction = new TableAction(actionReceived, this._formConfig);
1343
1449
  this._actions.push(inlineAction);
1344
1450
  this._actionsObj[inlineAction.actionCode] = inlineAction;
1345
1451
  }
@@ -1358,9 +1464,8 @@ class RecordTable extends FormElement {
1358
1464
  get selectionActionTrigger() { return this._selectionActionTrigger; }
1359
1465
  get recordSelectionTrigger() { return this._recordSelectionTrigger; }
1360
1466
  get getDataTrigger() { return this._getDataTrigger; }
1361
- get attributeChange() { return this._attributeChange; }
1362
1467
  getLayout() { return this.layout; }
1363
- setLayout(layout) { this.setAttr('layout', layout); }
1468
+ setLayout(layout) { this.setAttr(attrs.layout, layout); }
1364
1469
  hasActions() { return (this._actions.length > 0); }
1365
1470
  getSelectedRecords() { return this.tableRecords.filter(rec => rec.selected).map(rec => rec.recordId); }
1366
1471
  activateGlobalSearch() { this.globalSearch = true; }
@@ -1368,12 +1473,6 @@ class RecordTable extends FormElement {
1368
1473
  columnDefinition(fieldCode) { return this._tableColumnObj[fieldCode]; }
1369
1474
  putOnWait() { this.waiting = true; }
1370
1475
  freeWaiting() { this.waiting = false; }
1371
- setAttr(name, value) {
1372
- this[name] = value;
1373
- if (this._formConfig.monitoredTableAttributes.includes(name)) {
1374
- this._attributeChange.next({ name, value });
1375
- }
1376
- }
1377
1476
  notifyGlobalAction(actionCode) {
1378
1477
  const tableEvent = {
1379
1478
  tableCode: this.tableCode,
@@ -1439,23 +1538,23 @@ class RecordTable extends FormElement {
1439
1538
  this.updateVisibleRecords();
1440
1539
  }
1441
1540
  selectAll() {
1442
- this.setAttr('allSelected', true);
1541
+ this.setAttr(attrs.allSelected, true);
1443
1542
  this.tableRecords.forEach(record => record.select());
1444
- this.setAttr('selectedRecords', this.getSelectedRecords());
1543
+ this.setAttr(attrs.selectedRecords, this.getSelectedRecords());
1445
1544
  return true;
1446
1545
  }
1447
1546
  unSelectAll() {
1448
- this.setAttr('allSelected', false);
1547
+ this.setAttr(attrs.allSelected, false);
1449
1548
  this.tableRecords.forEach(record => record.unselect());
1450
- this.setAttr('selectedRecords', this.getSelectedRecords());
1549
+ this.setAttr(attrs.selectedRecords, this.getSelectedRecords());
1451
1550
  return true;
1452
1551
  }
1453
1552
  setTableRecords(tableRecords, append) {
1454
1553
  if (!append) {
1455
1554
  this.tableRecords = [];
1456
- this.setAttr('allSelected', false);
1555
+ this.setAttr(attrs.allSelected, false);
1457
1556
  this.tableRecords.forEach(record => record.unselect());
1458
- this.setAttr('selectedRecords', []);
1557
+ this.setAttr(attrs.selectedRecords, []);
1459
1558
  this.tableRecordObj = {};
1460
1559
  }
1461
1560
  const newRecordsObj = Object.assign({}, this.tableRecordObj);
@@ -1467,7 +1566,7 @@ class RecordTable extends FormElement {
1467
1566
  newRecordsObj[recordIdKey] = recordReceived;
1468
1567
  }
1469
1568
  this.tableRecords = newRecords;
1470
- this.setAttr('selectedRecords', this.getSelectedRecords());
1569
+ this.setAttr(attrs.selectedRecords, this.getSelectedRecords());
1471
1570
  this.tableRecordObj = newRecordsObj;
1472
1571
  this.updateVisibleRecords();
1473
1572
  }
@@ -1476,7 +1575,7 @@ class RecordTable extends FormElement {
1476
1575
  setTableAppend(append) { this._appendPages = append; }
1477
1576
  changePage(requestedPage) {
1478
1577
  if (this.clientPaging) {
1479
- this.setAttr('currentPage', requestedPage);
1578
+ this.setAttr(attrs.currentPage, requestedPage);
1480
1579
  this.updateVisibleRecords();
1481
1580
  }
1482
1581
  else {
@@ -1488,7 +1587,7 @@ class RecordTable extends FormElement {
1488
1587
  let visibleRecords;
1489
1588
  if (this.clientPaging) {
1490
1589
  let filteredRecords = this.getFilteredRecords();
1491
- this.setAttr('totalRecordsNumber', filteredRecords.length);
1590
+ this.setAttr(attrs.totalRecordsNumber, filteredRecords.length);
1492
1591
  const sliceNumber1 = (this.currentPage - 1) * this.recordsPerPage;
1493
1592
  const sliceNumber2 = (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage;
1494
1593
  visibleRecords = filteredRecords.slice(sliceNumber1, sliceNumber2);
@@ -1501,17 +1600,17 @@ class RecordTable extends FormElement {
1501
1600
  else {
1502
1601
  visibleRecords = this.tableRecords;
1503
1602
  }
1504
- this.setAttr('visibleRecords', visibleRecords);
1603
+ this.setAttr(attrs.visibleRecords, visibleRecords);
1505
1604
  }
1506
1605
  updateFromServer(tableReceived) {
1507
1606
  this.requestedPage = 1;
1508
1607
  this.visible = (tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.visible) || true;
1509
1608
  this.totalPages = tableReceived.totalPages || 1;
1510
1609
  this.recordsNumber = tableReceived.recordsNumber;
1511
- this.setAttr('currentPage', +(tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.currentPage) || 1);
1512
- this.setAttr('recordsPerPage', +tableReceived.recordsPerPage);
1513
- this.setAttr('totalRecordsNumber', (this.clientPaging) ? tableReceived.tableRecords.length : +tableReceived.totalRecordsNumber);
1514
- this.setAttr('sorting', {
1610
+ this.setAttr(attrs.currentPage, +(tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.currentPage) || 1);
1611
+ this.setAttr(attrs.recordsPerPage, +tableReceived.recordsPerPage);
1612
+ this.setAttr(attrs.totalRecordsNumber, (this.clientPaging) ? tableReceived.tableRecords.length : +tableReceived.totalRecordsNumber);
1613
+ this.setAttr(attrs.sorting, {
1515
1614
  columnName: tableReceived.sortingColumn || '',
1516
1615
  direction: tableReceived.sortingDirection || ''
1517
1616
  });
@@ -1561,7 +1660,7 @@ class RecordTable extends FormElement {
1561
1660
  this.changePage(1);
1562
1661
  }
1563
1662
  if (notifyComponent) {
1564
- this.setAttr('globalFilterString', text);
1663
+ this.setAttr(attrs.globalFilterString, text);
1565
1664
  }
1566
1665
  }
1567
1666
  addFilterDefinition(columnName, filterDefinition) {
@@ -1630,7 +1729,7 @@ class RecordTable extends FormElement {
1630
1729
  }
1631
1730
  }
1632
1731
  setRequiredOrder(columnField, direction = null) {
1633
- this.setAttr('sorting', {
1732
+ this.setAttr(attrs.sorting, {
1634
1733
  columnName: columnField,
1635
1734
  direction: (direction === 'ascend') ? TABLE_SORT_ASCENDING : TABLE_SORT_DESCENDING,
1636
1735
  });
@@ -1657,28 +1756,36 @@ class RecordTable extends FormElement {
1657
1756
  }
1658
1757
  return direction === TABLE_SORT_ASCENDING ? result : -result;
1659
1758
  }
1759
+ formStateChangeCustom(formChangeSubject) {
1760
+ var _a;
1761
+ (_a = this.columns) === null || _a === void 0 ? void 0 : _a.forEach(column => {
1762
+ column === null || column === void 0 ? void 0 : column.subscribeFormStateChange(formChangeSubject);
1763
+ });
1764
+ }
1660
1765
  }
1661
1766
 
1662
- class RecordFormSubSection {
1663
- constructor(subsectionReceived, formObject) {
1664
- if (!subsectionReceived) {
1665
- return;
1666
- }
1767
+ class RecordFormSubSection extends FormPiece {
1768
+ constructor(subsectionReceived, formObject, formConfig) {
1769
+ super(subsectionReceived, formConfig);
1667
1770
  this._customRender = null;
1668
- this.visible = true;
1771
+ this.subsectionId = null;
1772
+ this.subsectionCode = null;
1773
+ this.subsectionTitle = null;
1669
1774
  this.subSectionElements = [];
1670
1775
  this.subSectionFields = [];
1671
1776
  this.subSectionTables = [];
1672
1777
  this.subSectionActions = [];
1673
1778
  this.elementsArray = {};
1779
+ if (!subsectionReceived) {
1780
+ return;
1781
+ }
1674
1782
  this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
1675
1783
  this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
1676
1784
  this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
1677
- this.visibleStates = subsectionReceived.visibleStates || [];
1678
1785
  if (subsectionReceived.elements) {
1679
1786
  for (const receivedElement of subsectionReceived.elements) {
1680
1787
  let elementObject = null;
1681
- let arrayToAdd = null;
1788
+ let arrayToAdd = [];
1682
1789
  const { type, code } = receivedElement;
1683
1790
  switch (type) {
1684
1791
  case elementTypes.field:
@@ -1703,8 +1810,6 @@ class RecordFormSubSection {
1703
1810
  }
1704
1811
  }
1705
1812
  }
1706
- show() { this.visible = true; }
1707
- hide() { this.visible = false; }
1708
1813
  get customRender() { return this._customRender; }
1709
1814
  set customRender(customRenderName) { this._customRender = customRenderName; }
1710
1815
  getField(name) {
@@ -1722,27 +1827,24 @@ class RecordFormSubSection {
1722
1827
  getActionNames() {
1723
1828
  return this.subSectionActions.map(action => action.actionCode);
1724
1829
  }
1725
- viewOnState(state) {
1726
- return this.visibleStates.includes(state);
1727
- }
1728
- supportMode(state) { return this.viewOnState(state); }
1729
1830
  }
1730
1831
 
1731
- class RecordFormSection {
1732
- constructor(sectionReceived, formObject) {
1733
- var _a;
1832
+ class RecordFormSection extends FormPiece {
1833
+ constructor(sectionReceived, formObject, formConfig) {
1834
+ super(sectionReceived, formConfig);
1734
1835
  this._activation = new Subject();
1735
1836
  this._inactivation = new Subject();
1736
1837
  this.active = false;
1737
- this.customAttributes = {};
1838
+ this.sectionId = null;
1839
+ this.sectionCode = null;
1840
+ this.sectionTitle = null;
1841
+ this.subSections = [];
1738
1842
  if (!sectionReceived) {
1739
1843
  return;
1740
1844
  }
1741
- this.visible = true;
1742
1845
  this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
1743
1846
  this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
1744
1847
  this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
1745
- this.visibleStates = sectionReceived.visibleStates || [];
1746
1848
  this.subSections = [];
1747
1849
  this.subSectionsObj = {};
1748
1850
  if (sectionReceived.subsections) {
@@ -1762,7 +1864,7 @@ class RecordFormSection {
1762
1864
  return Object.assign(Object.assign({}, objDef), { visibleStates });
1763
1865
  });
1764
1866
  for (const subsectionReceived of subsections) {
1765
- const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
1867
+ const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject, formConfig);
1766
1868
  const subsectionCode = subSectionToAdd.subsectionCode;
1767
1869
  if (subsectionCode) {
1768
1870
  this.subSections.push(subSectionToAdd);
@@ -1770,35 +1872,22 @@ class RecordFormSection {
1770
1872
  }
1771
1873
  }
1772
1874
  }
1773
- if (sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes) {
1774
- (_a = Object.keys(sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes)) === null || _a === void 0 ? void 0 : _a.forEach(attr => this.customAttributes[attr] = sectionReceived === null || sectionReceived === void 0 ? void 0 : sectionReceived.customAttributes[attr]);
1775
- }
1776
1875
  }
1777
- getCustomAttribute(name) { var _a, _b; return (_b = (_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null; }
1778
- setCustomAttribute(name, value) { return name && (this.customAttributes[name] = value); }
1779
- setCustomAttributes(attributes) {
1780
- Object.entries(attributes).forEach(([name, value]) => {
1781
- this.setCustomAttribute(name, value);
1782
- });
1783
- }
1784
- matchAttribute(name, value) { var _a; return ((_a = this.customAttributes) === null || _a === void 0 ? void 0 : _a[name]) === value; }
1785
1876
  get code() { return this.sectionCode; }
1786
1877
  get activation() { return this._activation; }
1787
1878
  get inactivation() { return this._inactivation; }
1788
1879
  activate() {
1789
1880
  if (!this.active) {
1790
1881
  this.active = true;
1791
- this._activation.next(this.sectionCode);
1882
+ this.sectionCode && this._activation.next(this.sectionCode);
1792
1883
  }
1793
1884
  }
1794
1885
  inactivate() {
1795
1886
  if (this.active) {
1796
1887
  this.active = false;
1797
- this._inactivation.next(this.sectionCode);
1888
+ this.sectionCode && this._inactivation.next(this.sectionCode);
1798
1889
  }
1799
1890
  }
1800
- show() { this.visible = true; }
1801
- hide() { this.visible = false; }
1802
1891
  get title() { return this.sectionTitle; }
1803
1892
  set title(title) { this.sectionTitle = title; }
1804
1893
  getVisibleSubsections(state) {
@@ -1811,19 +1900,27 @@ class RecordFormSection {
1811
1900
  ? this.subSectionsObj[subSectionCode] : null;
1812
1901
  }
1813
1902
  getFields() {
1903
+ var _a;
1814
1904
  let fieldsArray = [];
1815
1905
  if (this.subSections && this.subSections.length > 0) {
1816
1906
  for (const subSection of this.subSections) {
1817
- fieldsArray = fieldsArray.concat(subSection.getFields());
1907
+ const subsectionFields = (_a = subSection.getFields()) !== null && _a !== void 0 ? _a : [];
1908
+ if ((subsectionFields === null || subsectionFields === void 0 ? void 0 : subsectionFields.length) > 0) {
1909
+ fieldsArray = fieldsArray.concat(subsectionFields);
1910
+ }
1818
1911
  }
1819
1912
  }
1820
1913
  return fieldsArray;
1821
1914
  }
1822
1915
  getActions() {
1916
+ var _a;
1823
1917
  let actionArray = [];
1824
1918
  if (this.subSections && this.subSections.length > 0) {
1825
1919
  for (const subSection of this.subSections) {
1826
- actionArray = actionArray.concat(subSection.getActions());
1920
+ const subSectionActions = (_a = subSection.getActions()) !== null && _a !== void 0 ? _a : [];
1921
+ if ((subSectionActions === null || subSectionActions === void 0 ? void 0 : subSectionActions.length) > 0) {
1922
+ actionArray = actionArray.concat(subSectionActions);
1923
+ }
1827
1924
  }
1828
1925
  }
1829
1926
  return actionArray;
@@ -1858,9 +1955,12 @@ class RecordFormSection {
1858
1955
  }
1859
1956
  return null;
1860
1957
  }
1861
- supportState(state) { return this.viewOnState(state); }
1862
- viewOnState(state) { return this.visibleStates.includes(state); }
1863
- supportMode(state) { return this.viewOnState(state); }
1958
+ formStateChangeCustom(formChangeSubject) {
1959
+ var _a;
1960
+ (_a = this.subSections) === null || _a === void 0 ? void 0 : _a.forEach(subsection => {
1961
+ subsection === null || subsection === void 0 ? void 0 : subsection.subscribeFormStateChange(formChangeSubject);
1962
+ });
1963
+ }
1864
1964
  }
1865
1965
 
1866
1966
  const ACTIVE = 'active';
@@ -1871,6 +1971,7 @@ const DISABLE = 'disable';
1871
1971
  const CLEAN = 'clean';
1872
1972
  class FormStructureAndData {
1873
1973
  constructor(definitionReceived, formConfig) {
1974
+ this._stateChange = new Subject();
1874
1975
  this._name = '';
1875
1976
  this._title = '';
1876
1977
  this._fields = {};
@@ -1975,7 +2076,7 @@ class FormStructureAndData {
1975
2076
  return Object.assign(Object.assign({}, objDef), { visibleStates });
1976
2077
  });
1977
2078
  for (const sectionReceived of formSections) {
1978
- const sectionToAdd = new RecordFormSection(sectionReceived, this);
2079
+ const sectionToAdd = new RecordFormSection(sectionReceived, this, this._formConfig);
1979
2080
  const sectionCode = sectionToAdd.sectionCode;
1980
2081
  if (sectionCode) {
1981
2082
  this._sectionArray.push(sectionToAdd);
@@ -2007,8 +2108,10 @@ class FormStructureAndData {
2007
2108
  this.state = newState;
2008
2109
  }
2009
2110
  }
2111
+ this._stateChange.next({ state: this.state });
2010
2112
  return (this.state === newState);
2011
2113
  }
2114
+ get stateChange() { return this._stateChange; }
2012
2115
  setStateFlow(states, transitions, defaultState) {
2013
2116
  this._stateFlow.states = states;
2014
2117
  this._stateFlow.defaultState = defaultState || this._stateFlow.states[0];
@@ -2453,6 +2556,8 @@ class BasicFormComponent {
2453
2556
  this.cleanStart();
2454
2557
  this.customPreProcessing();
2455
2558
  }
2559
+ get title() { var _a; return (_a = this.getTitle()) !== null && _a !== void 0 ? _a : ''; }
2560
+ set title(title) { this.setTitle(title); }
2456
2561
  getTitle() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTitle(); }
2457
2562
  setTitle(title) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setTitle(title); }
2458
2563
  cleanData() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanData(); }
@@ -2864,7 +2969,7 @@ class BasicFormComponent {
2864
2969
  return null;
2865
2970
  }
2866
2971
  subscribeSectionActivation() {
2867
- var _a;
2972
+ var _a, _b;
2868
2973
  const formSections = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.sections;
2869
2974
  const sectionNames = Object.keys(formSections);
2870
2975
  for (let index = 0; index < sectionNames.length; index++) {
@@ -2872,6 +2977,8 @@ class BasicFormComponent {
2872
2977
  const section = formSections[sectionName];
2873
2978
  section.activation.subscribe((code) => this.launchSectionActivation(code));
2874
2979
  section.inactivation.subscribe((code) => this.launchSectionInactivation(code));
2980
+ // Adicionalmente se le pide a la sección se subscriba al cambio de estado del formulario
2981
+ section.subscribeFormStateChange((_b = this._formStructure) === null || _b === void 0 ? void 0 : _b.stateChange);
2875
2982
  }
2876
2983
  }
2877
2984
  subscribeFieldsSubjects() {
@@ -2879,6 +2986,7 @@ class BasicFormComponent {
2879
2986
  const formFields = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields();
2880
2987
  if (Array.isArray(formFields)) {
2881
2988
  formFields.forEach(field => {
2989
+ var _a;
2882
2990
  field.editionFinish.subscribe(event => {
2883
2991
  const { code, intrinsicValidation } = event;
2884
2992
  this.startFieldValidation(code, intrinsicValidation);
@@ -2888,6 +2996,8 @@ class BasicFormComponent {
2888
2996
  this.startFieldInputValidation(code, intrinsicValidation);
2889
2997
  });
2890
2998
  field.detailRequest.subscribe(event => this.showFieldInfo(event.code, event.detail));
2999
+ // Adicionalmente se le pide al campo se subscriba al cambio de estado del formulario
3000
+ field.subscribeFormStateChange((_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.stateChange);
2891
3001
  });
2892
3002
  }
2893
3003
  }
@@ -2896,7 +3006,10 @@ class BasicFormComponent {
2896
3006
  const formActions = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActions();
2897
3007
  if (Array.isArray(formActions)) {
2898
3008
  formActions.forEach(action => {
3009
+ var _a;
2899
3010
  action.actionActivated.subscribe(code => this.startAction(code));
3011
+ // Adicionalmente se le pide a la acción se subscriba al cambio de estado del formulario
3012
+ action.subscribeFormStateChange((_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.stateChange);
2900
3013
  });
2901
3014
  }
2902
3015
  }
@@ -2905,11 +3018,14 @@ class BasicFormComponent {
2905
3018
  const formTables = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTables();
2906
3019
  if (Array.isArray(formTables)) {
2907
3020
  formTables.forEach(table => {
3021
+ var _a;
2908
3022
  table.inlineActionTrigger.subscribe(event => this.startTableAction(event));
2909
3023
  table.globalActionTrigger.subscribe(event => this.startTableGlobalAction(event));
2910
3024
  table.recordSelectionTrigger.subscribe(event => this.startTableRecordSelection(event));
2911
3025
  table.selectionActionTrigger.subscribe(event => this.startTableSelectionAction(event));
2912
3026
  table.getDataTrigger.subscribe(event => this.startTableGetData(event));
3027
+ // Adicionalmente se le pide a la tabla se subscriba al cambio de estado del formulario
3028
+ table.subscribeFormStateChange((_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.stateChange);
2913
3029
  });
2914
3030
  }
2915
3031
  }
@@ -2936,21 +3052,22 @@ class BasicFormComponent {
2936
3052
  if (!this.supportState(initialState)) {
2937
3053
  initialState = (_e = (_d = this._formStructure) === null || _d === void 0 ? void 0 : _d.defaultState) !== null && _e !== void 0 ? _e : null;
2938
3054
  }
2939
- (_f = this._formStructure) === null || _f === void 0 ? void 0 : _f.changeState(initialState || ((_g = this._formStructure) === null || _g === void 0 ? void 0 : _g.defaultState));
2940
3055
  const inputFieldNames = Object.keys(this.inputDataFields);
2941
3056
  for (let index = 0; index < inputFieldNames.length; index++) {
2942
3057
  const code = inputFieldNames[index];
2943
3058
  const fieldValue = this.inputDataFields[code];
2944
3059
  this.setFieldValue(code, fieldValue);
2945
3060
  }
2946
- const recordResponse = yield this.requestFormAction(formActions.getData);
2947
- this.checkErrorRecordReceived(recordResponse);
2948
- this.visible = true;
2949
- this.enabledSections = (_j = (_h = this._formStructure) === null || _h === void 0 ? void 0 : _h.visibleSections) !== null && _j !== void 0 ? _j : [];
2950
3061
  this.subscribeSectionActivation();
2951
3062
  this.subscribeFieldsSubjects();
2952
3063
  this.subscribeActionSubjects();
2953
3064
  this.subscribeTableSubjects();
3065
+ // Se define el estado inicial y se solicita la acción inicial
3066
+ (_f = this._formStructure) === null || _f === void 0 ? void 0 : _f.changeState(initialState || ((_g = this._formStructure) === null || _g === void 0 ? void 0 : _g.defaultState));
3067
+ const recordResponse = yield this.requestFormAction(formActions.getData);
3068
+ this.checkErrorRecordReceived(recordResponse);
3069
+ this.visible = true;
3070
+ this.enabledSections = (_j = (_h = this._formStructure) === null || _h === void 0 ? void 0 : _h.visibleSections) !== null && _j !== void 0 ? _j : [];
2954
3071
  this.start();
2955
3072
  this.customFormStart();
2956
3073
  });
@@ -3599,6 +3716,7 @@ class BasicFormComponent {
3599
3716
  });
3600
3717
  }
3601
3718
  startTableServerAction(tableActionDetail) {
3719
+ var _a;
3602
3720
  return __awaiter(this, void 0, void 0, function* () {
3603
3721
  const { tableObject, action, tableCode, actionCode, recordId, recordData } = tableActionDetail;
3604
3722
  if (!tableObject || !action) {
@@ -3610,7 +3728,7 @@ class BasicFormComponent {
3610
3728
  if (action.backend) {
3611
3729
  const actionSubject = {
3612
3730
  tableCode,
3613
- actionType: this.formConfig.tableActions.inline,
3731
+ actionType: (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.tableActions.inline,
3614
3732
  actionCode,
3615
3733
  tableRecordId: recordId,
3616
3734
  tableRecordData: recordData
@@ -3685,6 +3803,7 @@ class BasicFormComponent {
3685
3803
  });
3686
3804
  }
3687
3805
  startTableServerRecordSelection(tableSelectionDetail) {
3806
+ var _a;
3688
3807
  return __awaiter(this, void 0, void 0, function* () {
3689
3808
  const { tableObject, tableCode, recordId, recordData } = tableSelectionDetail;
3690
3809
  if (!tableObject) {
@@ -3696,7 +3815,7 @@ class BasicFormComponent {
3696
3815
  if (tableObject.selectionBackend) {
3697
3816
  const actionSubject = {
3698
3817
  tableCode,
3699
- actionType: this.formConfig.tableActions.rowSelection,
3818
+ actionType: (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.tableActions.rowSelection,
3700
3819
  actionCode: null,
3701
3820
  tableRecordId: recordId,
3702
3821
  tableRecordData: recordData
@@ -3770,6 +3889,7 @@ class BasicFormComponent {
3770
3889
  });
3771
3890
  }
3772
3891
  startTableServerSelectionAction(tableActionDetail) {
3892
+ var _a;
3773
3893
  return __awaiter(this, void 0, void 0, function* () {
3774
3894
  const { tableObject, action, tableCode, actionCode, selectedRecords } = tableActionDetail;
3775
3895
  if (!tableObject || !action) {
@@ -3781,7 +3901,7 @@ class BasicFormComponent {
3781
3901
  if (action.backend) {
3782
3902
  const actionSubject = {
3783
3903
  tableCode,
3784
- actionType: this.formConfig.tableActions.selection,
3904
+ actionType: (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.tableActions.selection,
3785
3905
  actionCode,
3786
3906
  selectedRecords
3787
3907
  };
@@ -3881,35 +4001,36 @@ class BasicFormComponent {
3881
4001
  });
3882
4002
  }
3883
4003
  checkSectionRequiredFields(sectionCode, reqFieldMessage) {
4004
+ var _a;
3884
4005
  this.cleanErrorFields(null, sectionCode);
3885
- const requiredFieldMessage = reqFieldMessage !== null && reqFieldMessage !== void 0 ? reqFieldMessage : this.formConfig.formStandardErrors.requiredField;
4006
+ const requiredFieldMessage = reqFieldMessage !== null && reqFieldMessage !== void 0 ? reqFieldMessage : (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.formStandardErrors.requiredField;
3886
4007
  const numErrors = this.tagFieldsWithError(requiredFieldMessage, this.getRequiredEmptyFields(null, sectionCode));
3887
4008
  return (numErrors === 0);
3888
4009
  }
3889
4010
  validateSectionConsistency(sectionCode, reqFieldMessage) {
3890
- var _a, _b;
4011
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3891
4012
  this.resetError();
3892
4013
  const completeFields = this.checkSectionRequiredFields(sectionCode, reqFieldMessage);
3893
4014
  if (!completeFields) {
3894
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
4015
+ this.setError((_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.formStandardErrors.typeWarning, (_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.formStandardErrors.validationTitle, (_c = this.formConfig) === null || _c === void 0 ? void 0 : _c.formStandardErrors.requiredFields);
3895
4016
  return false;
3896
4017
  }
3897
4018
  let validationError = false;
3898
- const requiredEmptyFields = (_a = this.getRequiredEmptyFields(null, sectionCode)) !== null && _a !== void 0 ? _a : [];
4019
+ const requiredEmptyFields = (_d = this.getRequiredEmptyFields(null, sectionCode)) !== null && _d !== void 0 ? _d : [];
3899
4020
  if ((requiredEmptyFields === null || requiredEmptyFields === void 0 ? void 0 : requiredEmptyFields.length) > 0) {
3900
4021
  validationError = true;
3901
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
3902
- this.tagFieldsWithError(this.formConfig.formStandardErrors.requiredField, requiredEmptyFields);
4022
+ this.setError((_e = this.formConfig) === null || _e === void 0 ? void 0 : _e.formStandardErrors.typeWarning, (_f = this.formConfig) === null || _f === void 0 ? void 0 : _f.formStandardErrors.validationTitle, (_g = this.formConfig) === null || _g === void 0 ? void 0 : _g.formStandardErrors.requiredFields);
4023
+ this.tagFieldsWithError((_h = this.formConfig) === null || _h === void 0 ? void 0 : _h.formStandardErrors.requiredField, requiredEmptyFields);
3903
4024
  for (const code of requiredEmptyFields) {
3904
4025
  const requiredEmptyField = this.getField(code);
3905
4026
  requiredEmptyField === null || requiredEmptyField === void 0 ? void 0 : requiredEmptyField.focus();
3906
4027
  break;
3907
4028
  }
3908
4029
  }
3909
- const validationIssueFields = (_b = this.getFieldsWithValidationIssues(null, sectionCode)) !== null && _b !== void 0 ? _b : [];
4030
+ const validationIssueFields = (_j = this.getFieldsWithValidationIssues(null, sectionCode)) !== null && _j !== void 0 ? _j : [];
3910
4031
  if (!validationError && validationIssueFields.length > 0) {
3911
4032
  validationError = true;
3912
- this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
4033
+ this.setError((_k = this.formConfig) === null || _k === void 0 ? void 0 : _k.formStandardErrors.typeWarning, (_l = this.formConfig) === null || _l === void 0 ? void 0 : _l.formStandardErrors.validationTitle, (_m = this.formConfig) === null || _m === void 0 ? void 0 : _m.formStandardErrors.validationFields);
3913
4034
  for (const code of validationIssueFields) {
3914
4035
  const validationIssueField = this.getField(code);
3915
4036
  if (validationIssueField) {