tuain-ng-forms-lib 12.0.12 → 12.0.13
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/README.md +1 -1
- package/bundles/tuain-ng-forms-lib.umd.js +55 -21
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/components/elements/action.component.js +12 -4
- package/esm2015/lib/components/elements/field.component.js +18 -4
- package/esm2015/lib/components/forms/basic-form.js +6 -6
- package/fesm2015/tuain-ng-forms-lib.js +33 -11
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/components/elements/action.component.d.ts +7 -4
- package/lib/components/elements/field.component.d.ts +3 -1
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -23,7 +23,7 @@ class ActionComponent {
|
|
|
23
23
|
this.actionObject.notifyActivation();
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
visibleOnRestriction() {
|
|
27
27
|
var _a, _b, _c, _d, _e;
|
|
28
28
|
if (!((_a = this.actionObject) === null || _a === void 0 ? void 0 : _a.restrictedOnField)) {
|
|
29
29
|
return true;
|
|
@@ -35,6 +35,14 @@ class ActionComponent {
|
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
get visible() {
|
|
39
|
+
var _a;
|
|
40
|
+
return ((_a = this.actionObject) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState)) && this.visibleOnRestriction();
|
|
41
|
+
}
|
|
42
|
+
get disabled() {
|
|
43
|
+
var _a;
|
|
44
|
+
return !((_a = this.actionObject) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
ActionComponent.decorators = [
|
|
40
48
|
{ type: Component, args: [{
|
|
@@ -44,9 +52,9 @@ ActionComponent.decorators = [
|
|
|
44
52
|
];
|
|
45
53
|
ActionComponent.propDecorators = {
|
|
46
54
|
actionObject: [{ type: Input }],
|
|
47
|
-
|
|
48
|
-
formBusy: [{ type: Input }],
|
|
55
|
+
busy: [{ type: Input }],
|
|
49
56
|
relatedField: [{ type: Input }],
|
|
57
|
+
currentState: [{ type: Input }],
|
|
50
58
|
style: [{ type: Input }],
|
|
51
59
|
showLabel: [{ type: Input }]
|
|
52
60
|
};
|
|
@@ -60,8 +68,14 @@ class FieldComponent {
|
|
|
60
68
|
// Inicialización
|
|
61
69
|
const mapping = Object.entries(this.formConfig.componentFieldAttrMap);
|
|
62
70
|
for (let index = 0; index < mapping.length; index++) {
|
|
63
|
-
const [fieldAttr,
|
|
64
|
-
|
|
71
|
+
const [fieldAttr, compAttr1] = mapping[index];
|
|
72
|
+
const compAttr = compAttr1.toString();
|
|
73
|
+
if (compAttr === VALUE) {
|
|
74
|
+
this.updateValue();
|
|
75
|
+
}
|
|
76
|
+
else if (this.hasOwnProperty(compAttr)) {
|
|
77
|
+
this[compAttr] = (_b = this.fieldObject) === null || _b === void 0 ? void 0 : _b[fieldAttr.toString()];
|
|
78
|
+
}
|
|
65
79
|
}
|
|
66
80
|
// Subscripción a cambios en atributos
|
|
67
81
|
this.fieldObject.attributeChange.subscribe(event => {
|
|
@@ -94,6 +108,14 @@ class FieldComponent {
|
|
|
94
108
|
const k = event.charCode;
|
|
95
109
|
return (k > 47 && k < 58);
|
|
96
110
|
}
|
|
111
|
+
get visible() {
|
|
112
|
+
var _a;
|
|
113
|
+
return (_a = this.fieldObject) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState);
|
|
114
|
+
}
|
|
115
|
+
get disabled() {
|
|
116
|
+
var _a;
|
|
117
|
+
return !((_a = this.fieldObject) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
118
|
+
}
|
|
97
119
|
}
|
|
98
120
|
FieldComponent.decorators = [
|
|
99
121
|
{ type: Component, args: [{
|
|
@@ -103,7 +125,7 @@ FieldComponent.decorators = [
|
|
|
103
125
|
];
|
|
104
126
|
FieldComponent.propDecorators = {
|
|
105
127
|
fieldObject: [{ type: Input }],
|
|
106
|
-
|
|
128
|
+
currentState: [{ type: Input }]
|
|
107
129
|
};
|
|
108
130
|
|
|
109
131
|
class ElementComponent {
|
|
@@ -2728,7 +2750,7 @@ class BasicFormComponent {
|
|
|
2728
2750
|
}
|
|
2729
2751
|
updateFormWithServerData(formContent) {
|
|
2730
2752
|
const { currentMode, formSubject, actions, fields, recordTables, returnedFile, immutableData, extraInfo, } = formContent;
|
|
2731
|
-
|
|
2753
|
+
currentMode && this.changeState(currentMode);
|
|
2732
2754
|
if (formSubject) {
|
|
2733
2755
|
this.formSubject = formSubject;
|
|
2734
2756
|
}
|
|
@@ -2866,7 +2888,7 @@ class BasicFormComponent {
|
|
|
2866
2888
|
}
|
|
2867
2889
|
if (finish) {
|
|
2868
2890
|
yield this.finishAction(action, actionResult);
|
|
2869
|
-
this.changeState(action.newState);
|
|
2891
|
+
action.newState && this.changeState(action.newState);
|
|
2870
2892
|
}
|
|
2871
2893
|
else {
|
|
2872
2894
|
this.displayActionServerError();
|
|
@@ -3163,7 +3185,7 @@ class BasicFormComponent {
|
|
|
3163
3185
|
}
|
|
3164
3186
|
if (finish) {
|
|
3165
3187
|
yield this.finishTableGlobalAction(tableActionDetail, actionResult);
|
|
3166
|
-
this.changeState(action.newState);
|
|
3188
|
+
action.newState && this.changeState(action.newState);
|
|
3167
3189
|
}
|
|
3168
3190
|
else {
|
|
3169
3191
|
this.displayTableServerError();
|
|
@@ -3246,7 +3268,7 @@ class BasicFormComponent {
|
|
|
3246
3268
|
}
|
|
3247
3269
|
if (finish) {
|
|
3248
3270
|
this.finishTableAction(tableActionDetail, actionResult);
|
|
3249
|
-
this.changeState(action.newState);
|
|
3271
|
+
action.newState && this.changeState(action.newState);
|
|
3250
3272
|
}
|
|
3251
3273
|
else {
|
|
3252
3274
|
this.displayTableServerError();
|
|
@@ -3404,7 +3426,7 @@ class BasicFormComponent {
|
|
|
3404
3426
|
}
|
|
3405
3427
|
if (finish) {
|
|
3406
3428
|
this.finishTableSelectionAction(tableActionDetail, actionResult);
|
|
3407
|
-
this.changeState(action.newState);
|
|
3429
|
+
action.newState && this.changeState(action.newState);
|
|
3408
3430
|
}
|
|
3409
3431
|
else {
|
|
3410
3432
|
this.displayTableServerError();
|