tuain-ng-forms-lib 14.3.20 → 14.4.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/classes/forms/element.mjs +8 -69
- package/esm2020/lib/classes/forms/field.mjs +5 -12
- package/esm2020/lib/classes/forms/form.mjs +11 -7
- package/esm2020/lib/classes/forms/piece-propagate.mjs +30 -0
- package/esm2020/lib/classes/forms/piece.mjs +95 -0
- package/esm2020/lib/classes/forms/section.mjs +44 -44
- package/esm2020/lib/classes/forms/subsection.mjs +24 -14
- package/esm2020/lib/classes/forms/table/action.mjs +5 -18
- package/esm2020/lib/classes/forms/table/column.mjs +8 -15
- package/esm2020/lib/classes/forms/table/row-data.mjs +14 -9
- package/esm2020/lib/classes/forms/table/table.mjs +62 -42
- package/esm2020/lib/components/elements/action.component.mjs +26 -13
- package/esm2020/lib/components/elements/field.component.mjs +20 -22
- package/esm2020/lib/components/elements/layout/element.component.mjs +5 -16
- package/esm2020/lib/components/elements/layout/form-header.component.mjs +5 -5
- package/esm2020/lib/components/elements/layout/piece.component.mjs +22 -0
- package/esm2020/lib/components/elements/layout/section.component.mjs +20 -5
- package/esm2020/lib/components/elements/layout/sub-section.component.mjs +20 -7
- package/esm2020/lib/components/elements/tables/table-record-action.component.mjs +21 -5
- package/esm2020/lib/components/elements/tables/table.component.mjs +50 -54
- package/esm2020/lib/components/forms/basic-form.mjs +26 -15
- package/fesm2015/tuain-ng-forms-lib.mjs +533 -398
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +500 -368
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/element.d.ts +3 -29
- package/lib/classes/forms/field.d.ts +0 -3
- package/lib/classes/forms/form.d.ts +3 -0
- package/lib/classes/forms/piece-propagate.d.ts +11 -0
- package/lib/classes/forms/piece.d.ts +41 -0
- package/lib/classes/forms/section.d.ts +10 -18
- package/lib/classes/forms/subsection.d.ts +10 -12
- package/lib/classes/forms/table/action.d.ts +3 -11
- package/lib/classes/forms/table/column.d.ts +4 -7
- package/lib/classes/forms/table/row-data.d.ts +1 -1
- package/lib/classes/forms/table/table.d.ts +3 -4
- package/lib/components/elements/action.component.d.ts +4 -8
- package/lib/components/elements/field.component.d.ts +5 -10
- package/lib/components/elements/layout/element.component.d.ts +3 -8
- package/lib/components/elements/layout/form-header.component.d.ts +3 -3
- package/lib/components/elements/layout/piece.component.d.ts +10 -0
- package/lib/components/elements/layout/section.component.d.ts +4 -3
- package/lib/components/elements/layout/sub-section.component.d.ts +4 -4
- package/lib/components/elements/tables/table-record-action.component.d.ts +2 -2
- package/lib/components/elements/tables/table.component.d.ts +6 -18
- package/lib/components/forms/basic-form.d.ts +2 -0
- 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
|
|
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:
|
|
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",
|
|
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
|
-
|
|
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
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
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
|
-
(
|
|
99
|
-
const { name:
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
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
|
-
|
|
155
|
+
defaultProcessAttributeChange(attribute, value) {
|
|
106
156
|
if (attribute === VALUE) {
|
|
107
157
|
this.updateValue();
|
|
108
158
|
}
|
|
@@ -113,24 +163,19 @@ 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
|
-
updateObject() { var _a; (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value); }
|
|
171
|
+
updateObject(widgetUpdate = true) { var _a; (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value, widgetUpdate); }
|
|
126
172
|
inputChanged() {
|
|
127
173
|
var _a;
|
|
128
174
|
(_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value);
|
|
129
175
|
this.onChangeContent();
|
|
130
176
|
}
|
|
131
177
|
inputTyped() {
|
|
132
|
-
|
|
133
|
-
(_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value);
|
|
178
|
+
this.updateObject(false);
|
|
134
179
|
this.onInputChange();
|
|
135
180
|
}
|
|
136
181
|
numberInputValidation(event) {
|
|
@@ -138,8 +183,8 @@ class FieldComponent {
|
|
|
138
183
|
return (k > 47 && k < 58);
|
|
139
184
|
}
|
|
140
185
|
}
|
|
141
|
-
FieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FieldComponent, deps:
|
|
142
|
-
FieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: FieldComponent, selector: "lib-field", inputs: { field: "field",
|
|
186
|
+
FieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FieldComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
187
|
+
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
188
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FieldComponent, decorators: [{
|
|
144
189
|
type: Component,
|
|
145
190
|
args: [{
|
|
@@ -148,40 +193,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
148
193
|
}]
|
|
149
194
|
}], propDecorators: { field: [{
|
|
150
195
|
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
196
|
}] } });
|
|
186
197
|
|
|
187
198
|
class FormErrorComponent {
|
|
@@ -204,7 +215,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
204
215
|
|
|
205
216
|
class FormHeaderComponent {
|
|
206
217
|
constructor() {
|
|
207
|
-
this.
|
|
218
|
+
this.canGoBack = false;
|
|
208
219
|
this.goBackEvent = new EventEmitter();
|
|
209
220
|
}
|
|
210
221
|
goBackForm() {
|
|
@@ -212,16 +223,16 @@ class FormHeaderComponent {
|
|
|
212
223
|
}
|
|
213
224
|
}
|
|
214
225
|
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: {
|
|
226
|
+
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
227
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FormHeaderComponent, decorators: [{
|
|
217
228
|
type: Component,
|
|
218
229
|
args: [{
|
|
219
230
|
selector: 'lib-form-header',
|
|
220
231
|
template: `<ng-content></ng-content>`
|
|
221
232
|
}]
|
|
222
|
-
}], propDecorators: {
|
|
233
|
+
}], propDecorators: { form: [{
|
|
223
234
|
type: Input
|
|
224
|
-
}],
|
|
235
|
+
}], canGoBack: [{
|
|
225
236
|
type: Input
|
|
226
237
|
}], showTitle: [{
|
|
227
238
|
type: Input
|
|
@@ -231,14 +242,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
231
242
|
type: Output
|
|
232
243
|
}] } });
|
|
233
244
|
|
|
234
|
-
class SectionComponent {
|
|
245
|
+
class SectionComponent extends PieceComponent {
|
|
235
246
|
ngOnInit() {
|
|
247
|
+
var _a, _b, _c, _d;
|
|
248
|
+
this.formConfig = (_a = this.section) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
249
|
+
const mapping = (_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.sectionPropagateAttributes;
|
|
250
|
+
for (let index = 0; index < mapping.length; index++) {
|
|
251
|
+
const attrName = mapping[index].toString();
|
|
252
|
+
const attributeValue = (_c = this.section) === null || _c === void 0 ? void 0 : _c[attrName];
|
|
253
|
+
this.defaultProcessAttributeChange(attrName, attributeValue);
|
|
254
|
+
this.customProcessAttributeChange(attrName, attributeValue);
|
|
255
|
+
}
|
|
256
|
+
// Subscripción a cambios en atributos
|
|
257
|
+
(_d = this.section) === null || _d === void 0 ? void 0 : _d.attributeChange.subscribe(event => {
|
|
258
|
+
const { name: attrName, value } = event;
|
|
259
|
+
this.defaultProcessAttributeChange(attrName, value);
|
|
260
|
+
this.customProcessAttributeChange(attrName, value);
|
|
261
|
+
});
|
|
236
262
|
this.start();
|
|
237
263
|
}
|
|
238
264
|
start() { }
|
|
239
265
|
}
|
|
240
|
-
SectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SectionComponent, deps:
|
|
241
|
-
SectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: SectionComponent, selector: "lib-section", inputs: { section: "section",
|
|
266
|
+
SectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SectionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
267
|
+
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
268
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SectionComponent, decorators: [{
|
|
243
269
|
type: Component,
|
|
244
270
|
args: [{
|
|
@@ -247,18 +273,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
247
273
|
}]
|
|
248
274
|
}], propDecorators: { section: [{
|
|
249
275
|
type: Input
|
|
250
|
-
}],
|
|
276
|
+
}], form: [{
|
|
251
277
|
type: Input
|
|
252
278
|
}] } });
|
|
253
279
|
|
|
254
|
-
class SubSectionComponent {
|
|
280
|
+
class SubSectionComponent extends PieceComponent {
|
|
255
281
|
ngOnInit() {
|
|
282
|
+
var _a, _b, _c, _d;
|
|
283
|
+
this.formConfig = (_a = this.subSection) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
284
|
+
const mapping = (_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.subSectionPropagateAttributes;
|
|
285
|
+
for (let index = 0; index < mapping.length; index++) {
|
|
286
|
+
const attrName = mapping[index].toString();
|
|
287
|
+
const attributeValue = (_c = this.subSection) === null || _c === void 0 ? void 0 : _c[attrName];
|
|
288
|
+
this.defaultProcessAttributeChange(attrName, attributeValue);
|
|
289
|
+
this.customProcessAttributeChange(attrName, attributeValue);
|
|
290
|
+
}
|
|
291
|
+
// Subscripción a cambios en atributos
|
|
292
|
+
(_d = this.subSection) === null || _d === void 0 ? void 0 : _d.attributeChange.subscribe(event => {
|
|
293
|
+
const { name: attrName, value } = event;
|
|
294
|
+
this.defaultProcessAttributeChange(attrName, value);
|
|
295
|
+
this.customProcessAttributeChange(attrName, value);
|
|
296
|
+
});
|
|
256
297
|
this.start();
|
|
257
298
|
}
|
|
258
299
|
start() { }
|
|
259
300
|
}
|
|
260
|
-
SubSectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SubSectionComponent, deps:
|
|
261
|
-
SubSectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: SubSectionComponent, selector: "lib-subsection", inputs: { subSection: "subSection",
|
|
301
|
+
SubSectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SubSectionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
302
|
+
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
303
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SubSectionComponent, decorators: [{
|
|
263
304
|
type: Component,
|
|
264
305
|
args: [{
|
|
@@ -267,18 +308,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
267
308
|
}]
|
|
268
309
|
}], propDecorators: { subSection: [{
|
|
269
310
|
type: Input
|
|
270
|
-
}],
|
|
271
|
-
type: Input
|
|
272
|
-
}], formManager: [{
|
|
311
|
+
}], form: [{
|
|
273
312
|
type: Input
|
|
274
313
|
}] } });
|
|
275
314
|
|
|
276
315
|
const INLINE_ACTION$1 = 'INLINE';
|
|
277
|
-
class LibTableRecordActionComponent {
|
|
316
|
+
class LibTableRecordActionComponent extends PieceComponent {
|
|
278
317
|
constructor() {
|
|
318
|
+
super(...arguments);
|
|
279
319
|
this.actionSelected = new EventEmitter();
|
|
280
320
|
}
|
|
281
321
|
ngOnInit() {
|
|
322
|
+
var _a, _b, _c, _d;
|
|
323
|
+
this.formConfig = (_a = this.action) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
324
|
+
const mapping = (_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.actionPropagateAttributes;
|
|
325
|
+
for (let index = 0; index < mapping.length; index++) {
|
|
326
|
+
const attrName = mapping[index].toString();
|
|
327
|
+
const attributeValue = (_c = this.action) === null || _c === void 0 ? void 0 : _c[attrName];
|
|
328
|
+
this.defaultProcessAttributeChange(attrName, attributeValue);
|
|
329
|
+
this.customProcessAttributeChange(attrName, attributeValue);
|
|
330
|
+
}
|
|
331
|
+
// Subscripción a cambios en atributos
|
|
332
|
+
(_d = this.action) === null || _d === void 0 ? void 0 : _d.attributeChange.subscribe(event => {
|
|
333
|
+
const { name: attrName, value } = event;
|
|
334
|
+
this.defaultProcessAttributeChange(attrName, value);
|
|
335
|
+
this.customProcessAttributeChange(attrName, value);
|
|
336
|
+
});
|
|
282
337
|
this.start();
|
|
283
338
|
}
|
|
284
339
|
start() { }
|
|
@@ -292,8 +347,8 @@ class LibTableRecordActionComponent {
|
|
|
292
347
|
}
|
|
293
348
|
class() { }
|
|
294
349
|
}
|
|
295
|
-
LibTableRecordActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordActionComponent, deps:
|
|
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 });
|
|
350
|
+
LibTableRecordActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordActionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
351
|
+
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
352
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableRecordActionComponent, decorators: [{
|
|
298
353
|
type: Component,
|
|
299
354
|
args: [{
|
|
@@ -301,7 +356,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
301
356
|
template: `<ng-content></ng-content>`,
|
|
302
357
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
303
358
|
}]
|
|
304
|
-
}],
|
|
359
|
+
}], propDecorators: { recordId: [{
|
|
305
360
|
type: Input
|
|
306
361
|
}], recordData: [{
|
|
307
362
|
type: Input
|
|
@@ -339,66 +394,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
339
394
|
type: Input
|
|
340
395
|
}] } });
|
|
341
396
|
|
|
342
|
-
|
|
343
|
-
class LibTableComponent {
|
|
397
|
+
class LibTableComponent extends ElementComponent {
|
|
344
398
|
constructor() {
|
|
345
|
-
|
|
346
|
-
this.globalSearch = false;
|
|
399
|
+
super(...arguments);
|
|
347
400
|
this.globalFilterString = '';
|
|
348
|
-
this.visibleRecords = [];
|
|
349
|
-
this.selectedRecords = [];
|
|
350
|
-
this.totalRecordsNumber = 0;
|
|
351
|
-
this.allSelected = false;
|
|
352
|
-
this.layout = '';
|
|
353
401
|
this.loaded = false;
|
|
354
402
|
this.selectable = false;
|
|
355
403
|
this.hasActions = false;
|
|
356
|
-
this.
|
|
404
|
+
this.table = null;
|
|
405
|
+
this.visibleRecords = [];
|
|
406
|
+
this.waiting = false;
|
|
357
407
|
}
|
|
358
408
|
ngOnInit() {
|
|
359
|
-
var _a;
|
|
360
|
-
if (this.table) {
|
|
361
|
-
|
|
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
|
-
});
|
|
409
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
410
|
+
if (!this.table) {
|
|
411
|
+
return;
|
|
382
412
|
}
|
|
413
|
+
this.formConfig = (_a = this.table) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
414
|
+
this.tableFieldStyles = (_b = this.formConfig) === null || _b === void 0 ? void 0 : _b.tableFieldStyles;
|
|
415
|
+
this.selectable = (_c = this.table) === null || _c === void 0 ? void 0 : _c.selectable;
|
|
416
|
+
this.hasActions = (_d = this.table) === null || _d === void 0 ? void 0 : _d.hasActions();
|
|
417
|
+
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);
|
|
418
|
+
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);
|
|
419
|
+
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);
|
|
420
|
+
// Inicialización de campos mapeados del objeto
|
|
421
|
+
const mapping = Object.entries((_l = this.formConfig) === null || _l === void 0 ? void 0 : _l.tablePropagationAttributes);
|
|
422
|
+
for (let index = 0; index < mapping.length; index++) {
|
|
423
|
+
const tableAttr = (_m = mapping[index]) === null || _m === void 0 ? void 0 : _m[0];
|
|
424
|
+
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 : '';
|
|
425
|
+
const attributeValue = (_r = this.table) === null || _r === void 0 ? void 0 : _r[tableAttr];
|
|
426
|
+
this.defaultProcessAttributeChange(componentAttr, attributeValue);
|
|
427
|
+
this.customProcessAttributeChange(componentAttr, attributeValue);
|
|
428
|
+
}
|
|
429
|
+
// Subscripción a cambios en atributos
|
|
430
|
+
(_s = this.table) === null || _s === void 0 ? void 0 : _s.attributeChange.subscribe(event => {
|
|
431
|
+
const { name: attrName, value } = event;
|
|
432
|
+
this.defaultProcessAttributeChange(attrName, value);
|
|
433
|
+
this.customProcessAttributeChange(attrName, value);
|
|
434
|
+
});
|
|
383
435
|
this.start();
|
|
384
436
|
}
|
|
385
|
-
start() { }
|
|
386
437
|
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(); }
|
|
438
|
+
tableGlobalAction(actionCode) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyGlobalAction(actionCode); }
|
|
439
|
+
tableSelectionAction(actionCode) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifySelectionAction(actionCode); }
|
|
440
|
+
tableActionSelected(actionEvent) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyInlineAction(actionEvent); }
|
|
441
|
+
tableSelectionToggle(recordId) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.notifyRecordSelection(recordId); }
|
|
442
|
+
toggleSelectAll() { var _a, _b, _c; return ((_a = this.table) === null || _a === void 0 ? void 0 : _a.allSelected) ? (_b = this.table) === null || _b === void 0 ? void 0 : _b.unSelectAll() : (_c = this.table) === null || _c === void 0 ? void 0 : _c.selectAll(); }
|
|
392
443
|
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((
|
|
396
|
-
|
|
444
|
+
changePage(requestedPage) { var _a; (_a = this.table) === null || _a === void 0 ? void 0 : _a.changePage(requestedPage); }
|
|
445
|
+
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'); }
|
|
446
|
+
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); }
|
|
447
|
+
defaultProcessAttributeChange(attribute, value) {
|
|
448
|
+
if (!attribute) {
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
397
451
|
try {
|
|
398
|
-
if (
|
|
452
|
+
if (attribute === 'visibleRecords') {
|
|
399
453
|
this.updateTableData();
|
|
400
454
|
}
|
|
401
|
-
this[
|
|
455
|
+
this[attribute] = value;
|
|
402
456
|
return true;
|
|
403
457
|
}
|
|
404
458
|
catch (_a) {
|
|
@@ -406,16 +460,17 @@ class LibTableComponent {
|
|
|
406
460
|
}
|
|
407
461
|
}
|
|
408
462
|
filterHasChanged(column, values) {
|
|
463
|
+
var _a, _b;
|
|
409
464
|
if (!values || values.length === 0) {
|
|
410
|
-
this.table.removeColumnFilter(column.fieldCode);
|
|
465
|
+
(_a = this.table) === null || _a === void 0 ? void 0 : _a.removeColumnFilter(column.fieldCode);
|
|
411
466
|
}
|
|
412
467
|
else {
|
|
413
|
-
this.table.addColumnFilter(column.fieldCode, values);
|
|
468
|
+
(_b = this.table) === null || _b === void 0 ? void 0 : _b.addColumnFilter(column.fieldCode, values);
|
|
414
469
|
}
|
|
415
470
|
}
|
|
416
471
|
}
|
|
417
|
-
LibTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableComponent, deps:
|
|
418
|
-
LibTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: LibTableComponent, selector: "lib-table", inputs: { table: "table",
|
|
472
|
+
LibTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
473
|
+
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
474
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: LibTableComponent, decorators: [{
|
|
420
475
|
type: Component,
|
|
421
476
|
args: [{
|
|
@@ -425,11 +480,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
425
480
|
}]
|
|
426
481
|
}], propDecorators: { table: [{
|
|
427
482
|
type: Input
|
|
428
|
-
}],
|
|
429
|
-
type: Input
|
|
430
|
-
}], disabled: [{
|
|
431
|
-
type: Input
|
|
432
|
-
}], state: [{
|
|
483
|
+
}], visibleRecords: [{
|
|
433
484
|
type: Input
|
|
434
485
|
}], waiting: [{
|
|
435
486
|
type: Input
|
|
@@ -461,23 +512,29 @@ const operators = {
|
|
|
461
512
|
IN: 'IN',
|
|
462
513
|
};
|
|
463
514
|
|
|
464
|
-
class
|
|
465
|
-
constructor(
|
|
466
|
-
var _a, _b, _c;
|
|
467
|
-
this.
|
|
515
|
+
class FormPiece {
|
|
516
|
+
constructor(pieceDefinition, formConfig) {
|
|
517
|
+
var _a, _b, _c, _d;
|
|
518
|
+
this._formState = '';
|
|
519
|
+
this._absoluteVisible = true;
|
|
520
|
+
this._absoluteDisabled = false;
|
|
468
521
|
this.visibleStates = null;
|
|
469
522
|
this.enabledStates = null;
|
|
470
|
-
this.
|
|
523
|
+
this._visible = true;
|
|
524
|
+
this._disabled = false;
|
|
525
|
+
this.customAttributes = {};
|
|
471
526
|
this._formConfig = formConfig;
|
|
472
527
|
this._isForced = false;
|
|
473
|
-
this.setVisibleStates(elementDefinition.visibleStates);
|
|
474
|
-
this.setEnabledStates(elementDefinition.enabledStates);
|
|
475
528
|
this._visibleForced = false;
|
|
476
|
-
this.
|
|
477
|
-
this.
|
|
478
|
-
this.
|
|
529
|
+
this.setVisibleStates(pieceDefinition.visibleStates);
|
|
530
|
+
this.setEnabledStates(pieceDefinition.enabledStates);
|
|
531
|
+
this.enabled = (_a = !(pieceDefinition === null || pieceDefinition === void 0 ? void 0 : pieceDefinition.disabled)) !== null && _a !== void 0 ? _a : false;
|
|
532
|
+
this.setVisibility((_b = pieceDefinition === null || pieceDefinition === void 0 ? void 0 : pieceDefinition.visible) !== null && _b !== void 0 ? _b : true);
|
|
533
|
+
this.customAttributes = (_c = pieceDefinition === null || pieceDefinition === void 0 ? void 0 : pieceDefinition.customAttributes) !== null && _c !== void 0 ? _c : {};
|
|
534
|
+
if (pieceDefinition === null || pieceDefinition === void 0 ? void 0 : pieceDefinition.customAttributes) {
|
|
535
|
+
(_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]);
|
|
536
|
+
}
|
|
479
537
|
}
|
|
480
|
-
;
|
|
481
538
|
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
539
|
setCustomAttribute(name, value) {
|
|
483
540
|
if (name) {
|
|
@@ -490,9 +547,6 @@ class FormElement {
|
|
|
490
547
|
});
|
|
491
548
|
}
|
|
492
549
|
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; }
|
|
496
550
|
setVisibleStates(newStates) {
|
|
497
551
|
const visibleStates = (!Array.isArray(newStates) && typeof newStates === 'string')
|
|
498
552
|
? newStates.split(',').map(state => state.trim()).filter(state => state.length > 0)
|
|
@@ -507,47 +561,105 @@ class FormElement {
|
|
|
507
561
|
}
|
|
508
562
|
viewOnState(state) { return (this.visibleStates && state) ? this.visibleStates.includes(state) : false; }
|
|
509
563
|
enabledOnState(state) { return (this.enabledStates && state) ? this.enabledStates.includes(state) : false; }
|
|
510
|
-
|
|
511
|
-
|
|
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; }
|
|
564
|
+
get absoluteVisible() { return this._absoluteVisible; }
|
|
565
|
+
get absoluteDisabled() { return this._absoluteDisabled; }
|
|
566
|
+
get visible() { return this._visible; }
|
|
519
567
|
set visible(visible) { this.setVisibility(visible); }
|
|
520
568
|
visibleOn(state) {
|
|
521
|
-
return this.
|
|
569
|
+
return this._absoluteVisible && this.viewOnState(state);
|
|
522
570
|
}
|
|
523
571
|
enabledOn(state) {
|
|
524
|
-
return !this.
|
|
572
|
+
return !this._absoluteDisabled && this.enabledOnState(state);
|
|
525
573
|
}
|
|
526
574
|
setVisibility(visible, forced = null) {
|
|
527
|
-
this.
|
|
528
|
-
if (forced
|
|
575
|
+
this._absoluteVisible = !!visible;
|
|
576
|
+
if (forced !== null) {
|
|
529
577
|
this._isForced = forced;
|
|
578
|
+
this._visibleForced = visible;
|
|
530
579
|
}
|
|
580
|
+
this._visible = this._absoluteVisible && this.viewOnState(this._formState);
|
|
531
581
|
}
|
|
532
582
|
show(forced = null) {
|
|
533
|
-
this.
|
|
534
|
-
if (forced !== null) {
|
|
535
|
-
this._isForced = forced;
|
|
536
|
-
this._visibleForced = true;
|
|
537
|
-
}
|
|
583
|
+
this.setVisibility(true, forced);
|
|
538
584
|
}
|
|
539
585
|
hide(forced = null) {
|
|
540
|
-
this.
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
586
|
+
this.setVisibility(false, forced);
|
|
587
|
+
}
|
|
588
|
+
get enabled() { return !this._disabled; }
|
|
589
|
+
set enabled(enabled) {
|
|
590
|
+
this._absoluteDisabled = !enabled;
|
|
591
|
+
this._disabled = this._absoluteDisabled || !this.enabledOnState(this._formState);
|
|
592
|
+
}
|
|
593
|
+
get editable() { return !this._disabled; }
|
|
594
|
+
get disabled() { return this._disabled; }
|
|
595
|
+
set disabled(disabled) { this.enabled = !disabled; }
|
|
596
|
+
enable() { this.enabled = true; }
|
|
597
|
+
disable() { this.enabled = false; }
|
|
598
|
+
formStateChangeCustomSubscribe(formChangeSubject) { }
|
|
599
|
+
formStateChange(state) {
|
|
600
|
+
if (state) {
|
|
601
|
+
this._formState = state;
|
|
602
|
+
this._visible = this._absoluteVisible && this.viewOnState(state);
|
|
603
|
+
this._disabled = this._absoluteDisabled || !this.enabledOnState(state);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
subscribeFormStateChange(formChangeSubject) {
|
|
607
|
+
this.formStateChangeCustomSubscribe(formChangeSubject);
|
|
608
|
+
formChangeSubject.subscribe(event => this.formStateChange(event === null || event === void 0 ? void 0 : event.state));
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const VISIBLE = 'visible';
|
|
613
|
+
const DISABLED = 'disabled';
|
|
614
|
+
class FormPiecePropagate extends FormPiece {
|
|
615
|
+
constructor(pieceDefinition, formConfig) {
|
|
616
|
+
super(pieceDefinition, formConfig);
|
|
617
|
+
this._attributeChange = new BehaviorSubject(null);
|
|
618
|
+
}
|
|
619
|
+
get attributeChange() { return this._attributeChange; }
|
|
620
|
+
propagateAttribute(name, value) {
|
|
621
|
+
var _a;
|
|
622
|
+
(_a = this._attributeChange) === null || _a === void 0 ? void 0 : _a.next({ name, value });
|
|
623
|
+
}
|
|
624
|
+
setVisibility(visible, forced = null) {
|
|
625
|
+
super.setVisibility(visible, forced);
|
|
626
|
+
this.propagateAttribute(VISIBLE, this._visible);
|
|
627
|
+
}
|
|
628
|
+
set enabled(enabled) {
|
|
629
|
+
super.enabled = enabled;
|
|
630
|
+
this.propagateAttribute(DISABLED, this._disabled);
|
|
631
|
+
}
|
|
632
|
+
formStateChange(state) {
|
|
633
|
+
super.formStateChange(state);
|
|
634
|
+
if (state) {
|
|
635
|
+
this.propagateAttribute(VISIBLE, this._visible);
|
|
636
|
+
this.propagateAttribute(DISABLED, this._disabled);
|
|
544
637
|
}
|
|
545
638
|
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
class FormElement extends FormPiecePropagate {
|
|
642
|
+
constructor(elementDefinition, formConfig) {
|
|
643
|
+
super(elementDefinition, formConfig);
|
|
644
|
+
this.elementType = null;
|
|
645
|
+
}
|
|
646
|
+
;
|
|
647
|
+
setAttr(attr, value) {
|
|
648
|
+
const { name: attrName, propagate: name } = attr;
|
|
649
|
+
this[attrName] = value;
|
|
650
|
+
name && this.propagateAttribute(name, value);
|
|
651
|
+
}
|
|
652
|
+
isField() { return this.elementType === elementTypes.field; }
|
|
653
|
+
isAction() { return this.elementType === elementTypes.action; }
|
|
654
|
+
isTable() { return this.elementType === elementTypes.table; }
|
|
655
|
+
/**
|
|
656
|
+
* @deprecated Utilizar viewOnState
|
|
657
|
+
*/
|
|
658
|
+
supportState(state) { return this.viewOnState(state); }
|
|
659
|
+
/**
|
|
660
|
+
* @deprecated Utilizar viewOnState
|
|
661
|
+
*/
|
|
662
|
+
supportMode(state) { return this.viewOnState(state); }
|
|
551
663
|
}
|
|
552
664
|
|
|
553
665
|
const HEADER = 'HEADER';
|
|
@@ -595,7 +707,7 @@ const directChanges = [
|
|
|
595
707
|
'maxLength', 'maxValue', 'minLength', 'minValue', 'validateOnServer', 'serverAction', 'visibleLabel',
|
|
596
708
|
'options',
|
|
597
709
|
];
|
|
598
|
-
const attrs = {
|
|
710
|
+
const attrs$1 = {
|
|
599
711
|
_captureType: { name: '_captureType', propagate: 'captureType' },
|
|
600
712
|
_errorCode: { name: '_errorCode', propagate: 'errorCode' },
|
|
601
713
|
_errorMessage: { name: '_errorMessage', propagate: 'errorMessage' },
|
|
@@ -626,12 +738,11 @@ const attrs = {
|
|
|
626
738
|
};
|
|
627
739
|
class FieldDescriptor extends FormElement {
|
|
628
740
|
constructor(inputFieldReceived, formConfig) {
|
|
629
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
741
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
630
742
|
super(inputFieldReceived, formConfig);
|
|
631
743
|
this._editionFinish = new Subject();
|
|
632
744
|
this._editionPartial = new Subject();
|
|
633
745
|
this._detailRequest = new Subject();
|
|
634
|
-
this._attributeChange = new Subject();
|
|
635
746
|
this._errorType = '';
|
|
636
747
|
this._errorCode = '';
|
|
637
748
|
this._errorMessage = '';
|
|
@@ -658,7 +769,7 @@ class FieldDescriptor extends FormElement {
|
|
|
658
769
|
this._tooltipText = '';
|
|
659
770
|
this.elementType = elementTypes.field;
|
|
660
771
|
const fld = (inputFieldReceived) ? inputFieldReceived : {};
|
|
661
|
-
this.setAttr(attrs._fieldCode, fld.fieldCode);
|
|
772
|
+
this.setAttr(attrs$1._fieldCode, fld.fieldCode);
|
|
662
773
|
this.title = (_a = fld.fieldTitle) !== null && _a !== void 0 ? _a : this._fieldCode;
|
|
663
774
|
this.type = fld.fieldTypeCode;
|
|
664
775
|
this.captureType = (_b = fld.captureType) !== null && _b !== void 0 ? _b : DEFAULT_CAPTURE_TYPE;
|
|
@@ -687,27 +798,26 @@ class FieldDescriptor extends FormElement {
|
|
|
687
798
|
this.defaultEditable = this.enabled;
|
|
688
799
|
this.required = (_e = fld.required) !== null && _e !== void 0 ? _e : false;
|
|
689
800
|
this.outputOnly = (_f = fld.outputOnly) !== null && _f !== void 0 ? _f : false;
|
|
690
|
-
this.maxLength =
|
|
691
|
-
this.intrinsicErrorMessage = (
|
|
692
|
-
this.setError(fld.errorCode, fld.errorMessage, (
|
|
693
|
-
this.setEditable((
|
|
694
|
-
this.visibleLabel = (
|
|
801
|
+
this.maxLength = fld.maxLength || (this._captureType === 'TEXTAREA' ? BIG_MAX_LENGTH : STD_MAX_LENGTH);
|
|
802
|
+
this.intrinsicErrorMessage = (_p = (_k = (_j = (_h = (_g = this._formConfig) === null || _g === void 0 ? void 0 : _g.fieldValidations) === null || _h === void 0 ? void 0 : _h[this._fieldType]) === null || _j === void 0 ? void 0 : _j.message) !== null && _k !== void 0 ? _k : (_o = (_m = (_l = this._formConfig) === null || _l === void 0 ? void 0 : _l.fieldValidations) === null || _m === void 0 ? void 0 : _m.DEFAULT) === null || _o === void 0 ? void 0 : _o.message) !== null && _p !== void 0 ? _p : '';
|
|
803
|
+
this.setError(fld.errorCode, fld.errorMessage, (_q = fld.errorType) !== null && _q !== void 0 ? _q : DEFAULT_ERROR_TYPE);
|
|
804
|
+
this.setEditable((_r = fld.editable) !== null && _r !== void 0 ? _r : true);
|
|
805
|
+
this.visibleLabel = (_s = fld.visibleLabel) !== null && _s !== void 0 ? _s : true;
|
|
695
806
|
this.setVisibility(fld.visible);
|
|
696
807
|
this.options = fld.fieldOptions;
|
|
697
|
-
this._setValue((
|
|
808
|
+
this._setValue((_u = (_t = fld.fieldValue) !== null && _t !== void 0 ? _t : this._defaultValue) !== null && _u !== void 0 ? _u : '');
|
|
698
809
|
}
|
|
699
810
|
get alignment() { return this._fieldAlignment; }
|
|
700
|
-
set alignment(alignment) { this.setAttr(attrs._fieldAlignment, alignment); }
|
|
701
|
-
get attributeChange() { return this._attributeChange; }
|
|
811
|
+
set alignment(alignment) { this.setAttr(attrs$1._fieldAlignment, alignment); }
|
|
702
812
|
get backend() { return this._validateOnServer; }
|
|
703
813
|
get captureType() { return this._captureType; }
|
|
704
|
-
set captureType(captureType) { this.setAttr(attrs._captureType, captureType); }
|
|
814
|
+
set captureType(captureType) { this.setAttr(attrs$1._captureType, captureType); }
|
|
705
815
|
get code() { return this._fieldCode; }
|
|
706
816
|
get fieldCode() { return this._fieldCode; }
|
|
707
817
|
get defaultValue() { return this._defaultValue; }
|
|
708
|
-
set defaultValue(defaultValue) { this.setAttr(attrs._defaultValue, defaultValue); }
|
|
818
|
+
set defaultValue(defaultValue) { this.setAttr(attrs$1._defaultValue, defaultValue); }
|
|
709
819
|
get defaultEditable() { return this._defaultEditable; }
|
|
710
|
-
set defaultEditable(editable) { this.setAttr(attrs._defaultEditable, editable); }
|
|
820
|
+
set defaultEditable(editable) { this.setAttr(attrs$1._defaultEditable, editable); }
|
|
711
821
|
get detailRequest() { return this._detailRequest; }
|
|
712
822
|
get editionFinish() { return this._editionFinish; }
|
|
713
823
|
get editionPartial() { return this._editionPartial; }
|
|
@@ -742,31 +852,31 @@ class FieldDescriptor extends FormElement {
|
|
|
742
852
|
get errorType() { return this._errorType; }
|
|
743
853
|
get externalValue() { return this._externalValue; }
|
|
744
854
|
get format() { return this._fieldFormat; }
|
|
745
|
-
set format(format) { this.setAttr(attrs._fieldFormat, format); }
|
|
855
|
+
set format(format) { this.setAttr(attrs$1._fieldFormat, format); }
|
|
746
856
|
get hasChanged() { return this._hasChanged; }
|
|
747
|
-
set hasChanged(hasChanged) { this.setAttr(attrs._hasChanged, hasChanged); }
|
|
857
|
+
set hasChanged(hasChanged) { this.setAttr(attrs$1._hasChanged, hasChanged); }
|
|
748
858
|
get info() { return this._fieldInfo; }
|
|
749
|
-
set info(newInfo) { this.setAttr(attrs._fieldInfo, newInfo); }
|
|
750
|
-
set intrinsicErrorMessage(message) { this.setAttr(attrs._intrinsicErrorMessage, message); }
|
|
859
|
+
set info(newInfo) { this.setAttr(attrs$1._fieldInfo, newInfo); }
|
|
860
|
+
set intrinsicErrorMessage(message) { this.setAttr(attrs$1._intrinsicErrorMessage, message); }
|
|
751
861
|
get maxLength() { return (this._maxLength > 0) ? this._maxLength.toString() : ''; }
|
|
752
|
-
set maxLength(requiredMaxLength) { this.setAttr(attrs._maxLength, +requiredMaxLength); }
|
|
862
|
+
set maxLength(requiredMaxLength) { this.setAttr(attrs$1._maxLength, requiredMaxLength ? +requiredMaxLength : null); }
|
|
753
863
|
get maxValue() { return this._maxValue; }
|
|
754
864
|
set maxValue(inputMaxValue) {
|
|
755
865
|
let maxValue = inputMaxValue;
|
|
756
866
|
if (this._fieldType === this._formConfig.fieldTypes.date) {
|
|
757
867
|
maxValue = new Date(maxValue);
|
|
758
868
|
}
|
|
759
|
-
this.setAttr(attrs._maxValue, maxValue);
|
|
869
|
+
this.setAttr(attrs$1._maxValue, maxValue);
|
|
760
870
|
}
|
|
761
871
|
get minLength() { return this._minLength; }
|
|
762
|
-
set minLength(requiredMinLength) { this.setAttr(attrs._minLength, +requiredMinLength); }
|
|
872
|
+
set minLength(requiredMinLength) { this.setAttr(attrs$1._minLength, requiredMinLength ? +requiredMinLength : null); }
|
|
763
873
|
get minValue() { return this._minValue; }
|
|
764
874
|
set minValue(inputMinValue) {
|
|
765
875
|
let minValue = inputMinValue;
|
|
766
876
|
if (this._fieldType === this._formConfig.fieldTypes.date) {
|
|
767
877
|
minValue = new Date(minValue);
|
|
768
878
|
}
|
|
769
|
-
this.setAttr(attrs._minValue, minValue);
|
|
879
|
+
this.setAttr(attrs$1._minValue, minValue);
|
|
770
880
|
}
|
|
771
881
|
get name() { return this._fieldCode; }
|
|
772
882
|
get options() {
|
|
@@ -777,7 +887,7 @@ class FieldDescriptor extends FormElement {
|
|
|
777
887
|
})) !== null && _b !== void 0 ? _b : null;
|
|
778
888
|
}
|
|
779
889
|
set options(newOptions) {
|
|
780
|
-
var _a, _b, _c, _d;
|
|
890
|
+
var _a, _b, _c, _d, _e;
|
|
781
891
|
if ((!this._formConfig.captureTypesWithOptions.includes(this._captureType))
|
|
782
892
|
|| typeof newOptions === UNDEFINED || !newOptions
|
|
783
893
|
|| !Array.isArray(newOptions)) {
|
|
@@ -792,11 +902,11 @@ class FieldDescriptor extends FormElement {
|
|
|
792
902
|
});
|
|
793
903
|
fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
|
|
794
904
|
&& fieldOptions.length > 0) ? fieldOptions : [];
|
|
795
|
-
this.setAttr(attrs._fieldOptions, fieldOptions);
|
|
905
|
+
this.setAttr(attrs$1._fieldOptions, fieldOptions);
|
|
796
906
|
if (this._value) {
|
|
797
907
|
if (this._fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._value)) {
|
|
798
908
|
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);
|
|
909
|
+
this.setAttr(attrs$1._value, fieldValue);
|
|
800
910
|
}
|
|
801
911
|
else {
|
|
802
912
|
const valInOptions = (_b = this._fieldOptions) === null || _b === void 0 ? void 0 : _b.find(item => item.fieldOptionId === this._value);
|
|
@@ -805,35 +915,35 @@ class FieldDescriptor extends FormElement {
|
|
|
805
915
|
}
|
|
806
916
|
}
|
|
807
917
|
}
|
|
808
|
-
if (this._fieldRequired && ((_c = this._fieldOptions) === null || _c === void 0 ? void 0 : _c.length) === 1) {
|
|
809
|
-
this._setValue((
|
|
918
|
+
if (this._fieldRequired && ((_c = this._fieldOptions) === null || _c === void 0 ? void 0 : _c.length) === 1 && this._value !== ((_d = this._fieldOptions) === null || _d === void 0 ? void 0 : _d[0].fieldOptionId)) {
|
|
919
|
+
this._setValue((_e = this._fieldOptions) === null || _e === void 0 ? void 0 : _e[0].fieldOptionId);
|
|
810
920
|
this.notifyEditionFinish();
|
|
811
921
|
}
|
|
812
922
|
}
|
|
813
923
|
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
924
|
get outputOnly() { return this._outputOnly; }
|
|
815
|
-
set outputOnly(outputOnly) { this.setAttr(attrs._outputOnly, outputOnly); }
|
|
925
|
+
set outputOnly(outputOnly) { this.setAttr(attrs$1._outputOnly, outputOnly); }
|
|
816
926
|
get required() { return this._fieldRequired; }
|
|
817
|
-
set required(required) { this.setAttr(attrs._fieldRequired, required !== null && required !== void 0 ? required : false); }
|
|
927
|
+
set required(required) { this.setAttr(attrs$1._fieldRequired, required !== null && required !== void 0 ? required : false); }
|
|
818
928
|
get title() { return this._fieldTitle; }
|
|
819
|
-
set title(title) { var _a; this.setAttr(attrs._fieldTitle, (_a = title === null || title === void 0 ? void 0 : title.toString()) !== null && _a !== void 0 ? _a : ''); }
|
|
929
|
+
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
930
|
get tooltip() { return this._tooltipText; }
|
|
821
|
-
set tooltip(tooltip) { this.setAttr(attrs._tooltipText, tooltip); }
|
|
931
|
+
set tooltip(tooltip) { this.setAttr(attrs$1._tooltipText, tooltip); }
|
|
822
932
|
get type() { return this._fieldType; }
|
|
823
|
-
set type(fieldType) { this.setAttr(attrs._fieldType, fieldType); }
|
|
933
|
+
set type(fieldType) { this.setAttr(attrs$1._fieldType, fieldType); }
|
|
824
934
|
get validating() { return this._onValidation; }
|
|
825
|
-
set validating(isValidating) { this.setAttr(attrs._onValidation, isValidating); }
|
|
935
|
+
set validating(isValidating) { this.setAttr(attrs$1._onValidation, isValidating); }
|
|
826
936
|
get value() {
|
|
827
937
|
return (this._fieldType === this._formConfig.fieldTypes.boolean
|
|
828
938
|
|| this._fieldType === this._formConfig.fieldTypes.check) ? yn(this._value) : this._value;
|
|
829
939
|
}
|
|
830
940
|
get validateOnServer() { return this._validateOnServer; }
|
|
831
|
-
set validateOnServer(validateOnServer) { this.setAttr(attrs._validateOnServer, validateOnServer); }
|
|
941
|
+
set validateOnServer(validateOnServer) { this.setAttr(attrs$1._validateOnServer, validateOnServer); }
|
|
832
942
|
get serverAction() { return this._validateOnServer; }
|
|
833
943
|
set serverAction(validateOnServer) { this.validateOnServer = validateOnServer; }
|
|
834
944
|
set value(newValue) { this._setValue(newValue); }
|
|
835
945
|
get visibleLabel() { return this._visibleLabel; }
|
|
836
|
-
set visibleLabel(visibleLabel) { this.setAttr(attrs._visibleLabel, visibleLabel); }
|
|
946
|
+
set visibleLabel(visibleLabel) { this.setAttr(attrs$1._visibleLabel, visibleLabel); }
|
|
837
947
|
/**
|
|
838
948
|
* @deprecated Use options
|
|
839
949
|
*/
|
|
@@ -851,7 +961,7 @@ class FieldDescriptor extends FormElement {
|
|
|
851
961
|
*/
|
|
852
962
|
changed(hasChanged = true) { this.hasChanged = hasChanged; }
|
|
853
963
|
clean() { this._setValue(this._defaultValue || ''); this.resetError(); }
|
|
854
|
-
focus() { this.setAttr(attrs._focus, true); }
|
|
964
|
+
focus() { this.setAttr(attrs$1._focus, true); }
|
|
855
965
|
getErrorCode() { return this.error.code; }
|
|
856
966
|
setErrorCode(code) { this.setError(code, this._errorMessage); }
|
|
857
967
|
getErrorMessage() { return this.error.message; }
|
|
@@ -960,15 +1070,10 @@ class FieldDescriptor extends FormElement {
|
|
|
960
1070
|
const detailEvent = { code: this._fieldCode, detail };
|
|
961
1071
|
this._detailRequest.next(detailEvent);
|
|
962
1072
|
}
|
|
963
|
-
setAttr(attr, value) {
|
|
964
|
-
const { name: attrName, propagate: name } = attr;
|
|
965
|
-
this[attrName] = value;
|
|
966
|
-
name && this._attributeChange.next({ name, value });
|
|
967
|
-
}
|
|
968
1073
|
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 : '');
|
|
1074
|
+
this.setAttr(attrs$1._errorCode, code !== null && code !== void 0 ? code : NO_ERROR);
|
|
1075
|
+
this.setAttr(attrs$1._errorType, (this._errorCode === NO_ERROR) ? '' : type);
|
|
1076
|
+
this.setAttr(attrs$1._errorMessage, message !== null && message !== void 0 ? message : '');
|
|
972
1077
|
}
|
|
973
1078
|
updateFromServer(fld) {
|
|
974
1079
|
const fieldKeys = Object.keys(fld);
|
|
@@ -1024,7 +1129,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1024
1129
|
if (this._value !== newFinalValue) {
|
|
1025
1130
|
this.hasChanged = true;
|
|
1026
1131
|
if (widgetUpdate) {
|
|
1027
|
-
this.setAttr(attrs._value, newFinalValue);
|
|
1132
|
+
this.setAttr(attrs$1._value, newFinalValue);
|
|
1028
1133
|
}
|
|
1029
1134
|
else {
|
|
1030
1135
|
this._value = newFinalValue;
|
|
@@ -1034,23 +1139,22 @@ class FieldDescriptor extends FormElement {
|
|
|
1034
1139
|
}
|
|
1035
1140
|
}
|
|
1036
1141
|
|
|
1037
|
-
class RecordTableColumn {
|
|
1142
|
+
class RecordTableColumn extends FormPiece {
|
|
1038
1143
|
constructor(recTableColReceived, formConfig) {
|
|
1039
|
-
var _a, _b, _c;
|
|
1144
|
+
var _a, _b, _c, _d;
|
|
1145
|
+
super(recTableColReceived, formConfig);
|
|
1040
1146
|
this.fieldCode = '';
|
|
1041
1147
|
this.fieldTitle = '';
|
|
1042
1148
|
this.fieldType = '';
|
|
1043
1149
|
this.fieldAlignment = '';
|
|
1044
1150
|
this.fieldFormat = '';
|
|
1045
|
-
this.visible = true;
|
|
1046
1151
|
this.sortable = true;
|
|
1152
|
+
this.searchable = true;
|
|
1047
1153
|
this.sortDirections = [];
|
|
1048
|
-
this.customAttributes = {};
|
|
1049
1154
|
// Filtros
|
|
1050
1155
|
this.filterVisible = false;
|
|
1051
1156
|
this.filterDef = null;
|
|
1052
1157
|
this.filterSetup = null;
|
|
1053
|
-
this._formConfig = formConfig;
|
|
1054
1158
|
this.filterDef = null;
|
|
1055
1159
|
if (recTableColReceived) {
|
|
1056
1160
|
this.fieldCode = recTableColReceived.fieldCode;
|
|
@@ -1058,24 +1162,15 @@ class RecordTableColumn {
|
|
|
1058
1162
|
this.fieldType = recTableColReceived.fieldTypeCode || this._formConfig.fieldTypes.text;
|
|
1059
1163
|
const defaultTypeAlignment = (this._formConfig.tableFieldStyles[this.fieldType] != null) ? this._formConfig.tableFieldStyles[this.fieldType]['text-align'] : 'left';
|
|
1060
1164
|
this.fieldAlignment = (recTableColReceived.alignment != null) ? recTableColReceived.alignment.toLowerCase() : defaultTypeAlignment;
|
|
1061
|
-
this.
|
|
1165
|
+
this._absoluteVisible = (_a = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.visible) !== null && _a !== void 0 ? _a : true;
|
|
1062
1166
|
this.sortable = (_b = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.sortable) !== null && _b !== void 0 ? _b : false;
|
|
1167
|
+
this.searchable = (_c = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.searchable) !== null && _c !== void 0 ? _c : true;
|
|
1063
1168
|
this.sortDirections = (this.sortable) ? ['ascend', 'descend'] : [];
|
|
1064
1169
|
this.fieldFormat = recTableColReceived.format || '';
|
|
1065
|
-
this.customAttributes = (
|
|
1170
|
+
this.customAttributes = (_d = recTableColReceived === null || recTableColReceived === void 0 ? void 0 : recTableColReceived.customAttributes) !== null && _d !== void 0 ? _d : {};
|
|
1066
1171
|
}
|
|
1067
1172
|
}
|
|
1068
|
-
|
|
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
|
-
}
|
|
1173
|
+
setSearchable(searchable = true) { this.searchable = searchable; }
|
|
1079
1174
|
hideFilter() {
|
|
1080
1175
|
this.filterVisible = false;
|
|
1081
1176
|
}
|
|
@@ -1121,9 +1216,10 @@ class RecordTableColumn {
|
|
|
1121
1216
|
}
|
|
1122
1217
|
}
|
|
1123
1218
|
|
|
1124
|
-
class TableAction {
|
|
1125
|
-
constructor(actionDefinition) {
|
|
1126
|
-
var _a, _b
|
|
1219
|
+
class TableAction extends FormPiece {
|
|
1220
|
+
constructor(actionDefinition, formConfig) {
|
|
1221
|
+
var _a, _b;
|
|
1222
|
+
super(actionDefinition, formConfig);
|
|
1127
1223
|
this.actionCode = actionDefinition.actionCode;
|
|
1128
1224
|
this.actionTitle = actionDefinition.actionTitle;
|
|
1129
1225
|
this.iconName = actionDefinition.iconName || this.actionCode;
|
|
@@ -1131,37 +1227,20 @@ class TableAction {
|
|
|
1131
1227
|
this.actionClass = actionDefinition.actionClass || 'INLINE';
|
|
1132
1228
|
this.newState = actionDefinition.newState;
|
|
1133
1229
|
this.stateField = actionDefinition.stateField || '';
|
|
1134
|
-
this.visibleStates = actionDefinition.visibleStates || [];
|
|
1135
|
-
this.enabledStates = actionDefinition.enabledStates || [];
|
|
1136
1230
|
this.backend = (_a = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _a !== void 0 ? _a : false;
|
|
1137
1231
|
this.restrictedOnField = actionDefinition.fieldRestrictedCode || '';
|
|
1138
1232
|
this.restrictedOnValue = (_b = actionDefinition.valueRestricted) !== null && _b !== void 0 ? _b : '';
|
|
1139
1233
|
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
1234
|
}
|
|
1153
|
-
supportMode(state) { return this.viewOnState(state); }
|
|
1154
|
-
viewOnState(state) { return this.visibleStates.includes(state); }
|
|
1155
|
-
enabledOnState(state) { return this.enabledStates.includes(state); }
|
|
1156
1235
|
}
|
|
1157
1236
|
|
|
1158
1237
|
class TableRecordData {
|
|
1159
1238
|
constructor(recordReceived, recordDefinition, selectionFieldName = null) {
|
|
1239
|
+
this.recordId = null;
|
|
1240
|
+
this.selected = false;
|
|
1160
1241
|
this.recordData = {};
|
|
1161
1242
|
const { tableRecordId, recordData } = recordReceived;
|
|
1162
1243
|
this.recordId = tableRecordId;
|
|
1163
|
-
this.selected = false;
|
|
1164
|
-
this.recordData = {};
|
|
1165
1244
|
if (!recordDefinition || recordDefinition.length === 0 || !recordData || recordData.length === 0) {
|
|
1166
1245
|
return;
|
|
1167
1246
|
}
|
|
@@ -1200,10 +1279,11 @@ class TableRecordData {
|
|
|
1200
1279
|
if (!words || words.length === 0) {
|
|
1201
1280
|
return true;
|
|
1202
1281
|
}
|
|
1203
|
-
for (const
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1282
|
+
for (const word of words) {
|
|
1283
|
+
let wordIsPresent = false;
|
|
1284
|
+
for (const fieldCode in this.recordData) {
|
|
1285
|
+
const columnDef = columnObj === null || columnObj === void 0 ? void 0 : columnObj[fieldCode];
|
|
1286
|
+
if ((columnDef === null || columnDef === void 0 ? void 0 : columnDef.searchable) && this.recordData.hasOwnProperty(fieldCode)) {
|
|
1207
1287
|
const term = word.toUpperCase();
|
|
1208
1288
|
let fieldValue;
|
|
1209
1289
|
if (columnDef.fieldType.toUpperCase().includes('DATE')) {
|
|
@@ -1213,12 +1293,16 @@ class TableRecordData {
|
|
|
1213
1293
|
fieldValue = this.recordData[fieldCode];
|
|
1214
1294
|
}
|
|
1215
1295
|
if (fieldValue.toString().toUpperCase().includes(term)) {
|
|
1216
|
-
|
|
1296
|
+
wordIsPresent = true;
|
|
1297
|
+
break;
|
|
1217
1298
|
}
|
|
1218
1299
|
}
|
|
1219
1300
|
}
|
|
1301
|
+
if (!wordIsPresent) {
|
|
1302
|
+
return false;
|
|
1303
|
+
}
|
|
1220
1304
|
}
|
|
1221
|
-
return
|
|
1305
|
+
return true;
|
|
1222
1306
|
}
|
|
1223
1307
|
hasCondition(columnFilters) {
|
|
1224
1308
|
if (!columnFilters || columnFilters.length === 0) {
|
|
@@ -1267,6 +1351,21 @@ class TableRecordData {
|
|
|
1267
1351
|
|
|
1268
1352
|
const TABLE_SORT_ASCENDING = 'asc';
|
|
1269
1353
|
const TABLE_SORT_DESCENDING = 'desc';
|
|
1354
|
+
const attrs = {
|
|
1355
|
+
allSelected: { name: 'allSelected', propagate: 'allSelected' },
|
|
1356
|
+
tableCode: { name: 'tableCode', propagate: 'code' },
|
|
1357
|
+
clientPaging: { name: 'clientPaging', propagate: null },
|
|
1358
|
+
globalSearch: { name: 'globalSearch', propagate: 'globalSearch' },
|
|
1359
|
+
globalFilterString: { name: 'globalFilterString', propagate: 'globalFilterString' },
|
|
1360
|
+
sorting: { name: 'sorting', propagate: null },
|
|
1361
|
+
recordsPerPage: { name: 'recordsPerPage', propagate: 'recordsPerPage' },
|
|
1362
|
+
layout: { name: 'layout', propagate: 'layout' },
|
|
1363
|
+
columns: { name: 'columns', propagate: 'columns' },
|
|
1364
|
+
selectedRecords: { name: 'selectedRecords', propagate: 'selectedRecords' },
|
|
1365
|
+
currentPage: { name: 'currentPage', propagate: 'currentPage' },
|
|
1366
|
+
totalRecordsNumber: { name: 'totalRecordsNumber', propagate: 'totalRecordsNumber' },
|
|
1367
|
+
visibleRecords: { name: 'visibleRecords', propagate: 'visibleRecords' },
|
|
1368
|
+
};
|
|
1270
1369
|
class RecordTable extends FormElement {
|
|
1271
1370
|
constructor(tableReceived, formConfig) {
|
|
1272
1371
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -1276,10 +1375,10 @@ class RecordTable extends FormElement {
|
|
|
1276
1375
|
this._recordSelectionTrigger = new Subject();
|
|
1277
1376
|
this._selectionActionTrigger = new Subject();
|
|
1278
1377
|
this._getDataTrigger = new Subject();
|
|
1279
|
-
this._attributeChange = new Subject();
|
|
1280
1378
|
this._tableColumnObj = {};
|
|
1281
1379
|
this._actionsObj = {};
|
|
1282
1380
|
// Mecanismos de filtrado nueva versión
|
|
1381
|
+
this.globalFilterString = '';
|
|
1283
1382
|
this.globalFilterStrings = [];
|
|
1284
1383
|
this.layout = null;
|
|
1285
1384
|
this.tableRecordObj = {};
|
|
@@ -1307,22 +1406,23 @@ class RecordTable extends FormElement {
|
|
|
1307
1406
|
this.selectable = (_b = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectable) !== null && _b !== void 0 ? _b : false;
|
|
1308
1407
|
this.selectionBackend = (_c = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.selectionBackend) !== null && _c !== void 0 ? _c : false;
|
|
1309
1408
|
this.sortable = (_d = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.sortable) !== null && _d !== void 0 ? _d : false;
|
|
1310
|
-
this.setAttr(
|
|
1311
|
-
this.setAttr(
|
|
1312
|
-
this.setAttr(
|
|
1313
|
-
this.setAttr(
|
|
1314
|
-
this.setAttr(
|
|
1315
|
-
this.setAttr(
|
|
1316
|
-
this.setAttr(
|
|
1317
|
-
this.setAttr(
|
|
1409
|
+
this.setAttr(attrs.allSelected, false);
|
|
1410
|
+
this.setAttr(attrs.tableCode, tableReceived.tableCode);
|
|
1411
|
+
this.setAttr(attrs.clientPaging, (_e = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.clientPaging) !== null && _e !== void 0 ? _e : true);
|
|
1412
|
+
this.setAttr(attrs.globalSearch, (_f = tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.simpleFilter) !== null && _f !== void 0 ? _f : false);
|
|
1413
|
+
this.setAttr(attrs.globalFilterString, '');
|
|
1414
|
+
this.setAttr(attrs.sorting, { columnName: '', direction: '' });
|
|
1415
|
+
this.setAttr(attrs.recordsPerPage, formConfig.defaultRecordsPerPage);
|
|
1416
|
+
this.setAttr(attrs.layout, '');
|
|
1318
1417
|
if (tableReceived.fields) {
|
|
1319
1418
|
const columns = [];
|
|
1320
1419
|
for (const columnReceived of tableReceived.fields) {
|
|
1321
|
-
const
|
|
1420
|
+
const columnEnriched = Object.assign(Object.assign({}, columnReceived), { visibleStates: this.visibleStates, enabledStates: this.enabledStates });
|
|
1421
|
+
const columnDefinition = new RecordTableColumn(columnEnriched, this._formConfig);
|
|
1322
1422
|
columns.push(columnDefinition);
|
|
1323
1423
|
this._tableColumnObj[columnDefinition.fieldCode] = columnDefinition;
|
|
1324
1424
|
}
|
|
1325
|
-
this.setAttr(
|
|
1425
|
+
this.setAttr(attrs.columns, columns);
|
|
1326
1426
|
}
|
|
1327
1427
|
if (tableReceived.actions) {
|
|
1328
1428
|
const tableActions = tableReceived.actions.map(objDef => {
|
|
@@ -1339,7 +1439,7 @@ class RecordTable extends FormElement {
|
|
|
1339
1439
|
return Object.assign(Object.assign({}, objDef), { visibleStates, enabledStates });
|
|
1340
1440
|
});
|
|
1341
1441
|
for (const actionReceived of tableActions) {
|
|
1342
|
-
const inlineAction = new TableAction(actionReceived);
|
|
1442
|
+
const inlineAction = new TableAction(actionReceived, this._formConfig);
|
|
1343
1443
|
this._actions.push(inlineAction);
|
|
1344
1444
|
this._actionsObj[inlineAction.actionCode] = inlineAction;
|
|
1345
1445
|
}
|
|
@@ -1358,9 +1458,8 @@ class RecordTable extends FormElement {
|
|
|
1358
1458
|
get selectionActionTrigger() { return this._selectionActionTrigger; }
|
|
1359
1459
|
get recordSelectionTrigger() { return this._recordSelectionTrigger; }
|
|
1360
1460
|
get getDataTrigger() { return this._getDataTrigger; }
|
|
1361
|
-
get attributeChange() { return this._attributeChange; }
|
|
1362
1461
|
getLayout() { return this.layout; }
|
|
1363
|
-
setLayout(layout) { this.setAttr(
|
|
1462
|
+
setLayout(layout) { this.setAttr(attrs.layout, layout); }
|
|
1364
1463
|
hasActions() { return (this._actions.length > 0); }
|
|
1365
1464
|
getSelectedRecords() { return this.tableRecords.filter(rec => rec.selected).map(rec => rec.recordId); }
|
|
1366
1465
|
activateGlobalSearch() { this.globalSearch = true; }
|
|
@@ -1368,12 +1467,6 @@ class RecordTable extends FormElement {
|
|
|
1368
1467
|
columnDefinition(fieldCode) { return this._tableColumnObj[fieldCode]; }
|
|
1369
1468
|
putOnWait() { this.waiting = true; }
|
|
1370
1469
|
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
1470
|
notifyGlobalAction(actionCode) {
|
|
1378
1471
|
const tableEvent = {
|
|
1379
1472
|
tableCode: this.tableCode,
|
|
@@ -1439,23 +1532,23 @@ class RecordTable extends FormElement {
|
|
|
1439
1532
|
this.updateVisibleRecords();
|
|
1440
1533
|
}
|
|
1441
1534
|
selectAll() {
|
|
1442
|
-
this.setAttr(
|
|
1535
|
+
this.setAttr(attrs.allSelected, true);
|
|
1443
1536
|
this.tableRecords.forEach(record => record.select());
|
|
1444
|
-
this.setAttr(
|
|
1537
|
+
this.setAttr(attrs.selectedRecords, this.getSelectedRecords());
|
|
1445
1538
|
return true;
|
|
1446
1539
|
}
|
|
1447
1540
|
unSelectAll() {
|
|
1448
|
-
this.setAttr(
|
|
1541
|
+
this.setAttr(attrs.allSelected, false);
|
|
1449
1542
|
this.tableRecords.forEach(record => record.unselect());
|
|
1450
|
-
this.setAttr(
|
|
1543
|
+
this.setAttr(attrs.selectedRecords, this.getSelectedRecords());
|
|
1451
1544
|
return true;
|
|
1452
1545
|
}
|
|
1453
1546
|
setTableRecords(tableRecords, append) {
|
|
1454
1547
|
if (!append) {
|
|
1455
1548
|
this.tableRecords = [];
|
|
1456
|
-
this.setAttr(
|
|
1549
|
+
this.setAttr(attrs.allSelected, false);
|
|
1457
1550
|
this.tableRecords.forEach(record => record.unselect());
|
|
1458
|
-
this.setAttr(
|
|
1551
|
+
this.setAttr(attrs.selectedRecords, []);
|
|
1459
1552
|
this.tableRecordObj = {};
|
|
1460
1553
|
}
|
|
1461
1554
|
const newRecordsObj = Object.assign({}, this.tableRecordObj);
|
|
@@ -1467,7 +1560,7 @@ class RecordTable extends FormElement {
|
|
|
1467
1560
|
newRecordsObj[recordIdKey] = recordReceived;
|
|
1468
1561
|
}
|
|
1469
1562
|
this.tableRecords = newRecords;
|
|
1470
|
-
this.setAttr(
|
|
1563
|
+
this.setAttr(attrs.selectedRecords, this.getSelectedRecords());
|
|
1471
1564
|
this.tableRecordObj = newRecordsObj;
|
|
1472
1565
|
this.updateVisibleRecords();
|
|
1473
1566
|
}
|
|
@@ -1476,7 +1569,7 @@ class RecordTable extends FormElement {
|
|
|
1476
1569
|
setTableAppend(append) { this._appendPages = append; }
|
|
1477
1570
|
changePage(requestedPage) {
|
|
1478
1571
|
if (this.clientPaging) {
|
|
1479
|
-
this.setAttr(
|
|
1572
|
+
this.setAttr(attrs.currentPage, requestedPage);
|
|
1480
1573
|
this.updateVisibleRecords();
|
|
1481
1574
|
}
|
|
1482
1575
|
else {
|
|
@@ -1484,11 +1577,10 @@ class RecordTable extends FormElement {
|
|
|
1484
1577
|
}
|
|
1485
1578
|
}
|
|
1486
1579
|
updateVisibleRecords() {
|
|
1487
|
-
// updateView const changeViewAttributes = ['currentPage', 'recordsPerPage', 'sorting'];
|
|
1488
1580
|
let visibleRecords;
|
|
1489
1581
|
if (this.clientPaging) {
|
|
1490
1582
|
let filteredRecords = this.getFilteredRecords();
|
|
1491
|
-
this.setAttr(
|
|
1583
|
+
this.setAttr(attrs.totalRecordsNumber, filteredRecords.length);
|
|
1492
1584
|
const sliceNumber1 = (this.currentPage - 1) * this.recordsPerPage;
|
|
1493
1585
|
const sliceNumber2 = (this.currentPage - 1) * this.recordsPerPage + this.recordsPerPage;
|
|
1494
1586
|
visibleRecords = filteredRecords.slice(sliceNumber1, sliceNumber2);
|
|
@@ -1501,17 +1593,17 @@ class RecordTable extends FormElement {
|
|
|
1501
1593
|
else {
|
|
1502
1594
|
visibleRecords = this.tableRecords;
|
|
1503
1595
|
}
|
|
1504
|
-
this.setAttr(
|
|
1596
|
+
this.setAttr(attrs.visibleRecords, visibleRecords);
|
|
1505
1597
|
}
|
|
1506
1598
|
updateFromServer(tableReceived) {
|
|
1507
1599
|
this.requestedPage = 1;
|
|
1508
1600
|
this.visible = (tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.visible) || true;
|
|
1509
1601
|
this.totalPages = tableReceived.totalPages || 1;
|
|
1510
1602
|
this.recordsNumber = tableReceived.recordsNumber;
|
|
1511
|
-
this.setAttr(
|
|
1512
|
-
this.setAttr(
|
|
1513
|
-
this.setAttr(
|
|
1514
|
-
this.setAttr(
|
|
1603
|
+
this.setAttr(attrs.currentPage, +(tableReceived === null || tableReceived === void 0 ? void 0 : tableReceived.currentPage) || 1);
|
|
1604
|
+
this.setAttr(attrs.recordsPerPage, +tableReceived.recordsPerPage);
|
|
1605
|
+
this.setAttr(attrs.totalRecordsNumber, (this.clientPaging) ? tableReceived.tableRecords.length : +tableReceived.totalRecordsNumber);
|
|
1606
|
+
this.setAttr(attrs.sorting, {
|
|
1515
1607
|
columnName: tableReceived.sortingColumn || '',
|
|
1516
1608
|
direction: tableReceived.sortingDirection || ''
|
|
1517
1609
|
});
|
|
@@ -1561,7 +1653,7 @@ class RecordTable extends FormElement {
|
|
|
1561
1653
|
this.changePage(1);
|
|
1562
1654
|
}
|
|
1563
1655
|
if (notifyComponent) {
|
|
1564
|
-
this.setAttr(
|
|
1656
|
+
this.setAttr(attrs.globalFilterString, text.trim());
|
|
1565
1657
|
}
|
|
1566
1658
|
}
|
|
1567
1659
|
addFilterDefinition(columnName, filterDefinition) {
|
|
@@ -1611,10 +1703,10 @@ class RecordTable extends FormElement {
|
|
|
1611
1703
|
for (let index = 0; index < columnFilters.length; index++) {
|
|
1612
1704
|
const columnFilter = columnFilters[index];
|
|
1613
1705
|
compactFilter.advancedFilter.push({
|
|
1614
|
-
fieldCode: columnFilter.fieldCode,
|
|
1615
|
-
operator: columnFilter.operator,
|
|
1616
|
-
fieldValue1: columnFilter.values[0],
|
|
1617
|
-
fieldValue2: columnFilter.values[1],
|
|
1706
|
+
fieldCode: columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.fieldCode,
|
|
1707
|
+
operator: columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.operator,
|
|
1708
|
+
fieldValue1: columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.values[0],
|
|
1709
|
+
fieldValue2: columnFilter === null || columnFilter === void 0 ? void 0 : columnFilter.values[1],
|
|
1618
1710
|
});
|
|
1619
1711
|
}
|
|
1620
1712
|
return compactFilter;
|
|
@@ -1630,7 +1722,7 @@ class RecordTable extends FormElement {
|
|
|
1630
1722
|
}
|
|
1631
1723
|
}
|
|
1632
1724
|
setRequiredOrder(columnField, direction = null) {
|
|
1633
|
-
this.setAttr(
|
|
1725
|
+
this.setAttr(attrs.sorting, {
|
|
1634
1726
|
columnName: columnField,
|
|
1635
1727
|
direction: (direction === 'ascend') ? TABLE_SORT_ASCENDING : TABLE_SORT_DESCENDING,
|
|
1636
1728
|
});
|
|
@@ -1657,28 +1749,40 @@ class RecordTable extends FormElement {
|
|
|
1657
1749
|
}
|
|
1658
1750
|
return direction === TABLE_SORT_ASCENDING ? result : -result;
|
|
1659
1751
|
}
|
|
1752
|
+
formStateChangeCustomSubscribe(formChangeSubject) {
|
|
1753
|
+
var _a, _b;
|
|
1754
|
+
(_a = this.columns) === null || _a === void 0 ? void 0 : _a.forEach(column => {
|
|
1755
|
+
column === null || column === void 0 ? void 0 : column.subscribeFormStateChange(formChangeSubject);
|
|
1756
|
+
});
|
|
1757
|
+
(_b = this._actions) === null || _b === void 0 ? void 0 : _b.forEach(action => {
|
|
1758
|
+
action === null || action === void 0 ? void 0 : action.subscribeFormStateChange(formChangeSubject);
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1660
1761
|
}
|
|
1661
1762
|
|
|
1662
|
-
class RecordFormSubSection {
|
|
1663
|
-
constructor(subsectionReceived, formObject) {
|
|
1664
|
-
|
|
1665
|
-
return;
|
|
1666
|
-
}
|
|
1763
|
+
class RecordFormSubSection extends FormPiecePropagate {
|
|
1764
|
+
constructor(subsectionReceived, formObject, formConfig) {
|
|
1765
|
+
super(subsectionReceived, formConfig);
|
|
1667
1766
|
this._customRender = null;
|
|
1668
|
-
this.
|
|
1767
|
+
this.subsectionId = null;
|
|
1768
|
+
this.subsectionCode = null;
|
|
1769
|
+
this.subsectionTitle = null;
|
|
1669
1770
|
this.subSectionElements = [];
|
|
1670
1771
|
this.subSectionFields = [];
|
|
1671
1772
|
this.subSectionTables = [];
|
|
1672
1773
|
this.subSectionActions = [];
|
|
1673
1774
|
this.elementsArray = {};
|
|
1775
|
+
this.active = false;
|
|
1776
|
+
if (!subsectionReceived) {
|
|
1777
|
+
return;
|
|
1778
|
+
}
|
|
1674
1779
|
this.subsectionId = (subsectionReceived.subsectionId) ? subsectionReceived.subsectionId.toString() : '';
|
|
1675
1780
|
this.subsectionCode = (subsectionReceived.subsectionCode) ? subsectionReceived.subsectionCode : '';
|
|
1676
1781
|
this.subsectionTitle = (subsectionReceived.subsectionTitle) ? subsectionReceived.subsectionTitle : '';
|
|
1677
|
-
this.visibleStates = subsectionReceived.visibleStates || [];
|
|
1678
1782
|
if (subsectionReceived.elements) {
|
|
1679
1783
|
for (const receivedElement of subsectionReceived.elements) {
|
|
1680
1784
|
let elementObject = null;
|
|
1681
|
-
let arrayToAdd =
|
|
1785
|
+
let arrayToAdd = [];
|
|
1682
1786
|
const { type, code } = receivedElement;
|
|
1683
1787
|
switch (type) {
|
|
1684
1788
|
case elementTypes.field:
|
|
@@ -1703,8 +1807,6 @@ class RecordFormSubSection {
|
|
|
1703
1807
|
}
|
|
1704
1808
|
}
|
|
1705
1809
|
}
|
|
1706
|
-
show() { this.visible = true; }
|
|
1707
|
-
hide() { this.visible = false; }
|
|
1708
1810
|
get customRender() { return this._customRender; }
|
|
1709
1811
|
set customRender(customRenderName) { this._customRender = customRenderName; }
|
|
1710
1812
|
getField(name) {
|
|
@@ -1722,47 +1824,51 @@ class RecordFormSubSection {
|
|
|
1722
1824
|
getActionNames() {
|
|
1723
1825
|
return this.subSectionActions.map(action => action.actionCode);
|
|
1724
1826
|
}
|
|
1725
|
-
|
|
1726
|
-
|
|
1827
|
+
activate() {
|
|
1828
|
+
if (!this.active) {
|
|
1829
|
+
this.active = true;
|
|
1830
|
+
// this.subsectionCode && this._activation.next(this.subsectionCode);
|
|
1831
|
+
}
|
|
1832
|
+
}
|
|
1833
|
+
inactivate() {
|
|
1834
|
+
if (this.active) {
|
|
1835
|
+
this.active = false;
|
|
1836
|
+
// this.subsectionCode && this._inactivation.next(this.subsectionCode);
|
|
1837
|
+
}
|
|
1727
1838
|
}
|
|
1728
|
-
supportMode(state) { return this.viewOnState(state); }
|
|
1729
1839
|
}
|
|
1730
1840
|
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1841
|
+
const ACTIVE$1 = 'active';
|
|
1842
|
+
class RecordFormSection extends FormPiecePropagate {
|
|
1843
|
+
constructor(sectionReceived, formObject, formConfig) {
|
|
1844
|
+
super(sectionReceived, formConfig);
|
|
1734
1845
|
this._activation = new Subject();
|
|
1735
1846
|
this._inactivation = new Subject();
|
|
1736
1847
|
this.active = false;
|
|
1737
|
-
this.
|
|
1848
|
+
this.sectionId = null;
|
|
1849
|
+
this.sectionCode = null;
|
|
1850
|
+
this.sectionTitle = null;
|
|
1851
|
+
this.subSections = [];
|
|
1852
|
+
this._exclusiveSubSectionsByAttr = {};
|
|
1738
1853
|
if (!sectionReceived) {
|
|
1739
1854
|
return;
|
|
1740
1855
|
}
|
|
1741
|
-
this.visible = true;
|
|
1742
1856
|
this.sectionId = (sectionReceived.sectionId) ? sectionReceived.sectionId.toString() : '';
|
|
1743
1857
|
this.sectionCode = (sectionReceived.sectionCode) ? sectionReceived.sectionCode : '';
|
|
1744
1858
|
this.sectionTitle = (sectionReceived.sectionTitle) ? sectionReceived.sectionTitle : '';
|
|
1745
|
-
this.visibleStates = sectionReceived.visibleStates || [];
|
|
1746
1859
|
this.subSections = [];
|
|
1747
1860
|
this.subSectionsObj = {};
|
|
1748
1861
|
if (sectionReceived.subsections) {
|
|
1749
|
-
const subsections = sectionReceived.subsections.map(
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
.filter(state => state.length > 0);
|
|
1755
|
-
}
|
|
1756
|
-
if (!visibleStates || visibleStates.length === 0) {
|
|
1757
|
-
visibleStates = this.visibleStates;
|
|
1862
|
+
const subsections = sectionReceived.subsections.map(subSecDef => {
|
|
1863
|
+
var _a;
|
|
1864
|
+
const visibleStates = (_a = subSecDef.visibleStates) !== null && _a !== void 0 ? _a : [];
|
|
1865
|
+
if (subSecDef.elements && Array.isArray(subSecDef.elements)) {
|
|
1866
|
+
subSecDef.elements = subSecDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
|
|
1758
1867
|
}
|
|
1759
|
-
|
|
1760
|
-
objDef.elements = objDef.elements.map(elm => ({ code: elm.elementCode, type: elm.elementTypeName }));
|
|
1761
|
-
}
|
|
1762
|
-
return Object.assign(Object.assign({}, objDef), { visibleStates });
|
|
1868
|
+
return Object.assign(Object.assign({}, subSecDef), { visibleStates });
|
|
1763
1869
|
});
|
|
1764
1870
|
for (const subsectionReceived of subsections) {
|
|
1765
|
-
const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject);
|
|
1871
|
+
const subSectionToAdd = new RecordFormSubSection(subsectionReceived, formObject, formConfig);
|
|
1766
1872
|
const subsectionCode = subSectionToAdd.subsectionCode;
|
|
1767
1873
|
if (subsectionCode) {
|
|
1768
1874
|
this.subSections.push(subSectionToAdd);
|
|
@@ -1770,60 +1876,64 @@ class RecordFormSection {
|
|
|
1770
1876
|
}
|
|
1771
1877
|
}
|
|
1772
1878
|
}
|
|
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
1879
|
}
|
|
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
1880
|
get code() { return this.sectionCode; }
|
|
1786
1881
|
get activation() { return this._activation; }
|
|
1787
1882
|
get inactivation() { return this._inactivation; }
|
|
1788
1883
|
activate() {
|
|
1789
1884
|
if (!this.active) {
|
|
1790
1885
|
this.active = true;
|
|
1791
|
-
this._activation.next(this.sectionCode);
|
|
1886
|
+
this.sectionCode && this._activation.next(this.sectionCode);
|
|
1792
1887
|
}
|
|
1793
1888
|
}
|
|
1794
1889
|
inactivate() {
|
|
1795
1890
|
if (this.active) {
|
|
1796
1891
|
this.active = false;
|
|
1797
|
-
this._inactivation.next(this.sectionCode);
|
|
1892
|
+
this.sectionCode && this._inactivation.next(this.sectionCode);
|
|
1798
1893
|
}
|
|
1799
1894
|
}
|
|
1800
|
-
show() { this.visible = true; }
|
|
1801
|
-
hide() { this.visible = false; }
|
|
1802
1895
|
get title() { return this.sectionTitle; }
|
|
1803
1896
|
set title(title) { this.sectionTitle = title; }
|
|
1804
1897
|
getVisibleSubsections(state) {
|
|
1805
|
-
return this.subSections.filter(subSection =>
|
|
1806
|
-
return subSection.visible && subSection.viewOnState(state);
|
|
1807
|
-
});
|
|
1898
|
+
return this.subSections.filter(subSection => subSection.visible);
|
|
1808
1899
|
}
|
|
1809
1900
|
getSubsection(subSectionCode) {
|
|
1810
1901
|
return (this.subSectionsObj && this.subSectionsObj[subSectionCode])
|
|
1811
1902
|
? this.subSectionsObj[subSectionCode] : null;
|
|
1812
1903
|
}
|
|
1904
|
+
activateSubSection(subSectionCode) {
|
|
1905
|
+
if (subSectionCode === this._exclusiveSubSectionsByAttr[ACTIVE$1]) {
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1908
|
+
const subSection = (this.subSectionsObj && this.subSectionsObj[subSectionCode])
|
|
1909
|
+
? this.subSectionsObj[subSectionCode] : null;
|
|
1910
|
+
if (subSection) {
|
|
1911
|
+
subSection === null || subSection === void 0 ? void 0 : subSection.activate();
|
|
1912
|
+
this._exclusiveSubSectionsByAttr[ACTIVE$1] = subSectionCode;
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1813
1915
|
getFields() {
|
|
1916
|
+
var _a;
|
|
1814
1917
|
let fieldsArray = [];
|
|
1815
1918
|
if (this.subSections && this.subSections.length > 0) {
|
|
1816
1919
|
for (const subSection of this.subSections) {
|
|
1817
|
-
|
|
1920
|
+
const subsectionFields = (_a = subSection.getFields()) !== null && _a !== void 0 ? _a : [];
|
|
1921
|
+
if ((subsectionFields === null || subsectionFields === void 0 ? void 0 : subsectionFields.length) > 0) {
|
|
1922
|
+
fieldsArray = fieldsArray.concat(subsectionFields);
|
|
1923
|
+
}
|
|
1818
1924
|
}
|
|
1819
1925
|
}
|
|
1820
1926
|
return fieldsArray;
|
|
1821
1927
|
}
|
|
1822
1928
|
getActions() {
|
|
1929
|
+
var _a;
|
|
1823
1930
|
let actionArray = [];
|
|
1824
1931
|
if (this.subSections && this.subSections.length > 0) {
|
|
1825
1932
|
for (const subSection of this.subSections) {
|
|
1826
|
-
|
|
1933
|
+
const subSectionActions = (_a = subSection.getActions()) !== null && _a !== void 0 ? _a : [];
|
|
1934
|
+
if ((subSectionActions === null || subSectionActions === void 0 ? void 0 : subSectionActions.length) > 0) {
|
|
1935
|
+
actionArray = actionArray.concat(subSectionActions);
|
|
1936
|
+
}
|
|
1827
1937
|
}
|
|
1828
1938
|
}
|
|
1829
1939
|
return actionArray;
|
|
@@ -1858,9 +1968,12 @@ class RecordFormSection {
|
|
|
1858
1968
|
}
|
|
1859
1969
|
return null;
|
|
1860
1970
|
}
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1971
|
+
formStateChangeCustomSubscribe(formChangeSubject) {
|
|
1972
|
+
var _a;
|
|
1973
|
+
(_a = this.subSections) === null || _a === void 0 ? void 0 : _a.forEach(subsection => {
|
|
1974
|
+
subsection === null || subsection === void 0 ? void 0 : subsection.subscribeFormStateChange(formChangeSubject);
|
|
1975
|
+
});
|
|
1976
|
+
}
|
|
1864
1977
|
}
|
|
1865
1978
|
|
|
1866
1979
|
const ACTIVE = 'active';
|
|
@@ -1871,6 +1984,7 @@ const DISABLE = 'disable';
|
|
|
1871
1984
|
const CLEAN = 'clean';
|
|
1872
1985
|
class FormStructureAndData {
|
|
1873
1986
|
constructor(definitionReceived, formConfig) {
|
|
1987
|
+
this._stateChange = new Subject();
|
|
1874
1988
|
this._name = '';
|
|
1875
1989
|
this._title = '';
|
|
1876
1990
|
this._fields = {};
|
|
@@ -1924,8 +2038,9 @@ class FormStructureAndData {
|
|
|
1924
2038
|
}
|
|
1925
2039
|
if (definitionReceived.fields) {
|
|
1926
2040
|
const formFields = definitionReceived.fields.map(objDef => {
|
|
2041
|
+
var _a;
|
|
1927
2042
|
let visibleStates = objDef.visibleStates;
|
|
1928
|
-
let enabledStates = objDef.enabledStates
|
|
2043
|
+
let enabledStates = (_a = objDef.enabledStates) !== null && _a !== void 0 ? _a : objDef.editableStates;
|
|
1929
2044
|
if (!visibleStates) {
|
|
1930
2045
|
visibleStates = (objDef.fieldModes || '').split(',')
|
|
1931
2046
|
.map(state => state.trim())
|
|
@@ -1975,7 +2090,7 @@ class FormStructureAndData {
|
|
|
1975
2090
|
return Object.assign(Object.assign({}, objDef), { visibleStates });
|
|
1976
2091
|
});
|
|
1977
2092
|
for (const sectionReceived of formSections) {
|
|
1978
|
-
const sectionToAdd = new RecordFormSection(sectionReceived, this);
|
|
2093
|
+
const sectionToAdd = new RecordFormSection(sectionReceived, this, this._formConfig);
|
|
1979
2094
|
const sectionCode = sectionToAdd.sectionCode;
|
|
1980
2095
|
if (sectionCode) {
|
|
1981
2096
|
this._sectionArray.push(sectionToAdd);
|
|
@@ -2007,8 +2122,10 @@ class FormStructureAndData {
|
|
|
2007
2122
|
this.state = newState;
|
|
2008
2123
|
}
|
|
2009
2124
|
}
|
|
2125
|
+
this._stateChange.next({ state: this.state });
|
|
2010
2126
|
return (this.state === newState);
|
|
2011
2127
|
}
|
|
2128
|
+
get stateChange() { return this._stateChange; }
|
|
2012
2129
|
setStateFlow(states, transitions, defaultState) {
|
|
2013
2130
|
this._stateFlow.states = states;
|
|
2014
2131
|
this._stateFlow.defaultState = defaultState || this._stateFlow.states[0];
|
|
@@ -2207,7 +2324,7 @@ class FormStructureAndData {
|
|
|
2207
2324
|
getSections() { return this._sectionArray; }
|
|
2208
2325
|
getSectionsByAttribute(name, value) { return this._sectionArray.filter(item => item.matchAttribute(name, value)); }
|
|
2209
2326
|
get sectionTitles() { return this._sectionArray.map(formSection => formSection.sectionTitle); }
|
|
2210
|
-
get visibleSections() { return this._sectionArray.filter(sec => sec.
|
|
2327
|
+
get visibleSections() { return this._sectionArray.filter(sec => sec.absoluteVisible); }
|
|
2211
2328
|
getSection(code) { var _a; return (code && ((_a = this._sections) === null || _a === void 0 ? void 0 : _a[code])) ? this._sections[code] : null; }
|
|
2212
2329
|
showSections(codes) { this.execOnSections(codes, SHOW); }
|
|
2213
2330
|
hideSections(codes) { this.execOnSections(codes, HIDE); }
|
|
@@ -2270,8 +2387,8 @@ class FormStructureAndData {
|
|
|
2270
2387
|
const fieldPayload = {
|
|
2271
2388
|
fieldCode: fld === null || fld === void 0 ? void 0 : fld.code,
|
|
2272
2389
|
fieldValue: fld === null || fld === void 0 ? void 0 : fld.value,
|
|
2273
|
-
editable: !(fld === null || fld === void 0 ? void 0 : fld.
|
|
2274
|
-
visible: fld === null || fld === void 0 ? void 0 : fld.
|
|
2390
|
+
editable: !(fld === null || fld === void 0 ? void 0 : fld.absoluteDisabled),
|
|
2391
|
+
visible: fld === null || fld === void 0 ? void 0 : fld.absoluteVisible,
|
|
2275
2392
|
required: fld === null || fld === void 0 ? void 0 : fld.required,
|
|
2276
2393
|
fieldOptions: '',
|
|
2277
2394
|
};
|
|
@@ -2280,7 +2397,7 @@ class FormStructureAndData {
|
|
|
2280
2397
|
formData.tables = this.getTables().map(tbl => {
|
|
2281
2398
|
const tablePayload = {
|
|
2282
2399
|
tableCode: tbl.tableCode,
|
|
2283
|
-
visible: tbl.
|
|
2400
|
+
visible: tbl.absoluteVisible,
|
|
2284
2401
|
currentPage: tbl.currentPage,
|
|
2285
2402
|
requestedPage: tbl.requestedPage,
|
|
2286
2403
|
recordsPerPage: tbl.recordsPerPage,
|
|
@@ -2453,6 +2570,8 @@ class BasicFormComponent {
|
|
|
2453
2570
|
this.cleanStart();
|
|
2454
2571
|
this.customPreProcessing();
|
|
2455
2572
|
}
|
|
2573
|
+
get title() { var _a; return (_a = this.getTitle()) !== null && _a !== void 0 ? _a : ''; }
|
|
2574
|
+
set title(title) { this.setTitle(title); }
|
|
2456
2575
|
getTitle() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTitle(); }
|
|
2457
2576
|
setTitle(title) { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.setTitle(title); }
|
|
2458
2577
|
cleanData() { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.cleanData(); }
|
|
@@ -2864,7 +2983,7 @@ class BasicFormComponent {
|
|
|
2864
2983
|
return null;
|
|
2865
2984
|
}
|
|
2866
2985
|
subscribeSectionActivation() {
|
|
2867
|
-
var _a;
|
|
2986
|
+
var _a, _b;
|
|
2868
2987
|
const formSections = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.sections;
|
|
2869
2988
|
const sectionNames = Object.keys(formSections);
|
|
2870
2989
|
for (let index = 0; index < sectionNames.length; index++) {
|
|
@@ -2872,6 +2991,8 @@ class BasicFormComponent {
|
|
|
2872
2991
|
const section = formSections[sectionName];
|
|
2873
2992
|
section.activation.subscribe((code) => this.launchSectionActivation(code));
|
|
2874
2993
|
section.inactivation.subscribe((code) => this.launchSectionInactivation(code));
|
|
2994
|
+
// Adicionalmente se le pide a la sección se subscriba al cambio de estado del formulario
|
|
2995
|
+
section.subscribeFormStateChange((_b = this._formStructure) === null || _b === void 0 ? void 0 : _b.stateChange);
|
|
2875
2996
|
}
|
|
2876
2997
|
}
|
|
2877
2998
|
subscribeFieldsSubjects() {
|
|
@@ -2879,6 +3000,7 @@ class BasicFormComponent {
|
|
|
2879
3000
|
const formFields = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getFields();
|
|
2880
3001
|
if (Array.isArray(formFields)) {
|
|
2881
3002
|
formFields.forEach(field => {
|
|
3003
|
+
var _a;
|
|
2882
3004
|
field.editionFinish.subscribe(event => {
|
|
2883
3005
|
const { code, intrinsicValidation } = event;
|
|
2884
3006
|
this.startFieldValidation(code, intrinsicValidation);
|
|
@@ -2888,6 +3010,8 @@ class BasicFormComponent {
|
|
|
2888
3010
|
this.startFieldInputValidation(code, intrinsicValidation);
|
|
2889
3011
|
});
|
|
2890
3012
|
field.detailRequest.subscribe(event => this.showFieldInfo(event.code, event.detail));
|
|
3013
|
+
// Adicionalmente se le pide al campo se subscriba al cambio de estado del formulario
|
|
3014
|
+
field.subscribeFormStateChange((_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.stateChange);
|
|
2891
3015
|
});
|
|
2892
3016
|
}
|
|
2893
3017
|
}
|
|
@@ -2896,7 +3020,10 @@ class BasicFormComponent {
|
|
|
2896
3020
|
const formActions = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getActions();
|
|
2897
3021
|
if (Array.isArray(formActions)) {
|
|
2898
3022
|
formActions.forEach(action => {
|
|
3023
|
+
var _a;
|
|
2899
3024
|
action.actionActivated.subscribe(code => this.startAction(code));
|
|
3025
|
+
// Adicionalmente se le pide a la acción se subscriba al cambio de estado del formulario
|
|
3026
|
+
action.subscribeFormStateChange((_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.stateChange);
|
|
2900
3027
|
});
|
|
2901
3028
|
}
|
|
2902
3029
|
}
|
|
@@ -2905,11 +3032,14 @@ class BasicFormComponent {
|
|
|
2905
3032
|
const formTables = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getTables();
|
|
2906
3033
|
if (Array.isArray(formTables)) {
|
|
2907
3034
|
formTables.forEach(table => {
|
|
3035
|
+
var _a;
|
|
2908
3036
|
table.inlineActionTrigger.subscribe(event => this.startTableAction(event));
|
|
2909
3037
|
table.globalActionTrigger.subscribe(event => this.startTableGlobalAction(event));
|
|
2910
3038
|
table.recordSelectionTrigger.subscribe(event => this.startTableRecordSelection(event));
|
|
2911
3039
|
table.selectionActionTrigger.subscribe(event => this.startTableSelectionAction(event));
|
|
2912
3040
|
table.getDataTrigger.subscribe(event => this.startTableGetData(event));
|
|
3041
|
+
// Adicionalmente se le pide a la tabla se subscriba al cambio de estado del formulario
|
|
3042
|
+
table.subscribeFormStateChange((_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.stateChange);
|
|
2913
3043
|
});
|
|
2914
3044
|
}
|
|
2915
3045
|
}
|
|
@@ -2936,21 +3066,22 @@ class BasicFormComponent {
|
|
|
2936
3066
|
if (!this.supportState(initialState)) {
|
|
2937
3067
|
initialState = (_e = (_d = this._formStructure) === null || _d === void 0 ? void 0 : _d.defaultState) !== null && _e !== void 0 ? _e : null;
|
|
2938
3068
|
}
|
|
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
3069
|
const inputFieldNames = Object.keys(this.inputDataFields);
|
|
2941
3070
|
for (let index = 0; index < inputFieldNames.length; index++) {
|
|
2942
3071
|
const code = inputFieldNames[index];
|
|
2943
3072
|
const fieldValue = this.inputDataFields[code];
|
|
2944
3073
|
this.setFieldValue(code, fieldValue);
|
|
2945
3074
|
}
|
|
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
3075
|
this.subscribeSectionActivation();
|
|
2951
3076
|
this.subscribeFieldsSubjects();
|
|
2952
3077
|
this.subscribeActionSubjects();
|
|
2953
3078
|
this.subscribeTableSubjects();
|
|
3079
|
+
// Se define el estado inicial y se solicita la acción inicial
|
|
3080
|
+
(_f = this._formStructure) === null || _f === void 0 ? void 0 : _f.changeState(initialState || ((_g = this._formStructure) === null || _g === void 0 ? void 0 : _g.defaultState));
|
|
3081
|
+
const recordResponse = yield this.requestFormAction(formActions.getData);
|
|
3082
|
+
this.checkErrorRecordReceived(recordResponse);
|
|
3083
|
+
this.visible = true;
|
|
3084
|
+
this.enabledSections = (_j = (_h = this._formStructure) === null || _h === void 0 ? void 0 : _h.visibleSections) !== null && _j !== void 0 ? _j : [];
|
|
2954
3085
|
this.start();
|
|
2955
3086
|
this.customFormStart();
|
|
2956
3087
|
});
|
|
@@ -3227,7 +3358,7 @@ class BasicFormComponent {
|
|
|
3227
3358
|
for (const clientActionMethod of finishActionMethods) {
|
|
3228
3359
|
const { callback, properties } = clientActionMethod;
|
|
3229
3360
|
const continueOnError = (_a = properties === null || properties === void 0 ? void 0 : properties.continueOnError) !== null && _a !== void 0 ? _a : false;
|
|
3230
|
-
if (!serverError || continueOnError) {
|
|
3361
|
+
if (callback && (!serverError || continueOnError)) {
|
|
3231
3362
|
clientActionPromises.push(callback(action, actionResult));
|
|
3232
3363
|
}
|
|
3233
3364
|
}
|
|
@@ -3599,6 +3730,7 @@ class BasicFormComponent {
|
|
|
3599
3730
|
});
|
|
3600
3731
|
}
|
|
3601
3732
|
startTableServerAction(tableActionDetail) {
|
|
3733
|
+
var _a;
|
|
3602
3734
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3603
3735
|
const { tableObject, action, tableCode, actionCode, recordId, recordData } = tableActionDetail;
|
|
3604
3736
|
if (!tableObject || !action) {
|
|
@@ -3610,7 +3742,7 @@ class BasicFormComponent {
|
|
|
3610
3742
|
if (action.backend) {
|
|
3611
3743
|
const actionSubject = {
|
|
3612
3744
|
tableCode,
|
|
3613
|
-
actionType: this.formConfig.tableActions.inline,
|
|
3745
|
+
actionType: (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.tableActions.inline,
|
|
3614
3746
|
actionCode,
|
|
3615
3747
|
tableRecordId: recordId,
|
|
3616
3748
|
tableRecordData: recordData
|
|
@@ -3685,6 +3817,7 @@ class BasicFormComponent {
|
|
|
3685
3817
|
});
|
|
3686
3818
|
}
|
|
3687
3819
|
startTableServerRecordSelection(tableSelectionDetail) {
|
|
3820
|
+
var _a;
|
|
3688
3821
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3689
3822
|
const { tableObject, tableCode, recordId, recordData } = tableSelectionDetail;
|
|
3690
3823
|
if (!tableObject) {
|
|
@@ -3696,7 +3829,7 @@ class BasicFormComponent {
|
|
|
3696
3829
|
if (tableObject.selectionBackend) {
|
|
3697
3830
|
const actionSubject = {
|
|
3698
3831
|
tableCode,
|
|
3699
|
-
actionType: this.formConfig.tableActions.rowSelection,
|
|
3832
|
+
actionType: (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.tableActions.rowSelection,
|
|
3700
3833
|
actionCode: null,
|
|
3701
3834
|
tableRecordId: recordId,
|
|
3702
3835
|
tableRecordData: recordData
|
|
@@ -3770,6 +3903,7 @@ class BasicFormComponent {
|
|
|
3770
3903
|
});
|
|
3771
3904
|
}
|
|
3772
3905
|
startTableServerSelectionAction(tableActionDetail) {
|
|
3906
|
+
var _a;
|
|
3773
3907
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3774
3908
|
const { tableObject, action, tableCode, actionCode, selectedRecords } = tableActionDetail;
|
|
3775
3909
|
if (!tableObject || !action) {
|
|
@@ -3781,7 +3915,7 @@ class BasicFormComponent {
|
|
|
3781
3915
|
if (action.backend) {
|
|
3782
3916
|
const actionSubject = {
|
|
3783
3917
|
tableCode,
|
|
3784
|
-
actionType: this.formConfig.tableActions.selection,
|
|
3918
|
+
actionType: (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.tableActions.selection,
|
|
3785
3919
|
actionCode,
|
|
3786
3920
|
selectedRecords
|
|
3787
3921
|
};
|
|
@@ -3881,35 +4015,36 @@ class BasicFormComponent {
|
|
|
3881
4015
|
});
|
|
3882
4016
|
}
|
|
3883
4017
|
checkSectionRequiredFields(sectionCode, reqFieldMessage) {
|
|
4018
|
+
var _a;
|
|
3884
4019
|
this.cleanErrorFields(null, sectionCode);
|
|
3885
|
-
const requiredFieldMessage = reqFieldMessage !== null && reqFieldMessage !== void 0 ? reqFieldMessage : this.formConfig.formStandardErrors.requiredField;
|
|
4020
|
+
const requiredFieldMessage = reqFieldMessage !== null && reqFieldMessage !== void 0 ? reqFieldMessage : (_a = this.formConfig) === null || _a === void 0 ? void 0 : _a.formStandardErrors.requiredField;
|
|
3886
4021
|
const numErrors = this.tagFieldsWithError(requiredFieldMessage, this.getRequiredEmptyFields(null, sectionCode));
|
|
3887
4022
|
return (numErrors === 0);
|
|
3888
4023
|
}
|
|
3889
4024
|
validateSectionConsistency(sectionCode, reqFieldMessage) {
|
|
3890
|
-
var _a, _b;
|
|
4025
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
3891
4026
|
this.resetError();
|
|
3892
4027
|
const completeFields = this.checkSectionRequiredFields(sectionCode, reqFieldMessage);
|
|
3893
4028
|
if (!completeFields) {
|
|
3894
|
-
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.requiredFields);
|
|
4029
|
+
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
4030
|
return false;
|
|
3896
4031
|
}
|
|
3897
4032
|
let validationError = false;
|
|
3898
|
-
const requiredEmptyFields = (
|
|
4033
|
+
const requiredEmptyFields = (_d = this.getRequiredEmptyFields(null, sectionCode)) !== null && _d !== void 0 ? _d : [];
|
|
3899
4034
|
if ((requiredEmptyFields === null || requiredEmptyFields === void 0 ? void 0 : requiredEmptyFields.length) > 0) {
|
|
3900
4035
|
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);
|
|
4036
|
+
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);
|
|
4037
|
+
this.tagFieldsWithError((_h = this.formConfig) === null || _h === void 0 ? void 0 : _h.formStandardErrors.requiredField, requiredEmptyFields);
|
|
3903
4038
|
for (const code of requiredEmptyFields) {
|
|
3904
4039
|
const requiredEmptyField = this.getField(code);
|
|
3905
4040
|
requiredEmptyField === null || requiredEmptyField === void 0 ? void 0 : requiredEmptyField.focus();
|
|
3906
4041
|
break;
|
|
3907
4042
|
}
|
|
3908
4043
|
}
|
|
3909
|
-
const validationIssueFields = (
|
|
4044
|
+
const validationIssueFields = (_j = this.getFieldsWithValidationIssues(null, sectionCode)) !== null && _j !== void 0 ? _j : [];
|
|
3910
4045
|
if (!validationError && validationIssueFields.length > 0) {
|
|
3911
4046
|
validationError = true;
|
|
3912
|
-
this.setError(this.formConfig.formStandardErrors.typeWarning, this.formConfig.formStandardErrors.validationTitle, this.formConfig.formStandardErrors.validationFields);
|
|
4047
|
+
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
4048
|
for (const code of validationIssueFields) {
|
|
3914
4049
|
const validationIssueField = this.getField(code);
|
|
3915
4050
|
if (validationIssueField) {
|