tuain-ng-forms-lib 12.0.13 → 12.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/tuain-ng-forms-lib.umd.js +41 -31
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/components/elements/action.component.js +12 -12
- package/esm2015/lib/components/elements/field.component.js +20 -15
- package/esm2015/lib/components/forms/basic-form.js +8 -7
- package/fesm2015/tuain-ng-forms-lib.js +37 -31
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/components/elements/action.component.d.ts +1 -1
- package/lib/components/elements/field.component.d.ts +2 -2
- package/lib/components/forms/basic-form.d.ts +2 -1
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -13,35 +13,35 @@ class ActionComponent {
|
|
|
13
13
|
}
|
|
14
14
|
ngOnInit() {
|
|
15
15
|
var _a;
|
|
16
|
-
this.formConfig = (_a = this.
|
|
16
|
+
this.formConfig = (_a = this.action) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
17
17
|
this.start();
|
|
18
18
|
}
|
|
19
19
|
start() { }
|
|
20
20
|
activate() {
|
|
21
21
|
var _a;
|
|
22
|
-
if ((_a = this.
|
|
23
|
-
this.
|
|
22
|
+
if ((_a = this.action) === null || _a === void 0 ? void 0 : _a.notifyActivation) {
|
|
23
|
+
this.action.notifyActivation();
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
visibleOnRestriction() {
|
|
27
27
|
var _a, _b, _c, _d, _e;
|
|
28
|
-
if (!((_a = this.
|
|
28
|
+
if (!((_a = this.action) === null || _a === void 0 ? void 0 : _a.restrictedOnField)) {
|
|
29
29
|
return true;
|
|
30
30
|
}
|
|
31
|
-
if ((((_b = this.
|
|
32
|
-
&& this.relatedField === ((_c = this.
|
|
33
|
-
|| (((_d = this.
|
|
34
|
-
&& this.relatedField !== ((_e = this.
|
|
31
|
+
if ((((_b = this.action) === null || _b === void 0 ? void 0 : _b.restrictedOnOperator) === '=='
|
|
32
|
+
&& this.relatedField === ((_c = this.action) === null || _c === void 0 ? void 0 : _c.restrictedOnValue))
|
|
33
|
+
|| (((_d = this.action) === null || _d === void 0 ? void 0 : _d.restrictedOnOperator) === '!='
|
|
34
|
+
&& this.relatedField !== ((_e = this.action) === null || _e === void 0 ? void 0 : _e.restrictedOnValue))) {
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
get visible() {
|
|
39
39
|
var _a;
|
|
40
|
-
return ((_a = this.
|
|
40
|
+
return ((_a = this.action) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState)) && this.visibleOnRestriction();
|
|
41
41
|
}
|
|
42
42
|
get disabled() {
|
|
43
43
|
var _a;
|
|
44
|
-
return !((_a = this.
|
|
44
|
+
return !((_a = this.action) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
ActionComponent.decorators = [
|
|
@@ -51,7 +51,7 @@ ActionComponent.decorators = [
|
|
|
51
51
|
},] }
|
|
52
52
|
];
|
|
53
53
|
ActionComponent.propDecorators = {
|
|
54
|
-
|
|
54
|
+
action: [{ type: Input }],
|
|
55
55
|
busy: [{ type: Input }],
|
|
56
56
|
relatedField: [{ type: Input }],
|
|
57
57
|
currentState: [{ type: Input }],
|
|
@@ -63,8 +63,8 @@ const VALUE = '';
|
|
|
63
63
|
class FieldComponent {
|
|
64
64
|
ngOnInit() {
|
|
65
65
|
var _a, _b;
|
|
66
|
-
if (this.
|
|
67
|
-
this.formConfig = (_a = this.
|
|
66
|
+
if (this.field) {
|
|
67
|
+
this.formConfig = (_a = this.field) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
68
68
|
// Inicialización
|
|
69
69
|
const mapping = Object.entries(this.formConfig.componentFieldAttrMap);
|
|
70
70
|
for (let index = 0; index < mapping.length; index++) {
|
|
@@ -73,18 +73,18 @@ class FieldComponent {
|
|
|
73
73
|
if (compAttr === VALUE) {
|
|
74
74
|
this.updateValue();
|
|
75
75
|
}
|
|
76
|
-
else
|
|
77
|
-
this[compAttr] = (_b = this.
|
|
76
|
+
else {
|
|
77
|
+
this[compAttr] = (_b = this.field) === null || _b === void 0 ? void 0 : _b[fieldAttr.toString()];
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
// Subscripción a cambios en atributos
|
|
81
|
-
this.
|
|
81
|
+
this.field.attributeChange.subscribe(event => {
|
|
82
82
|
const { name: fieldAttr, value } = event;
|
|
83
83
|
const compAttr = this.formConfig.componentFieldAttrMap[fieldAttr];
|
|
84
84
|
if (compAttr === VALUE) {
|
|
85
85
|
this.updateValue();
|
|
86
86
|
}
|
|
87
|
-
else
|
|
87
|
+
else {
|
|
88
88
|
this[compAttr] = value;
|
|
89
89
|
}
|
|
90
90
|
});
|
|
@@ -93,16 +93,21 @@ class FieldComponent {
|
|
|
93
93
|
}
|
|
94
94
|
start() { }
|
|
95
95
|
focus() { }
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
updateObject() {
|
|
97
|
+
this.field._fieldValue = this.value;
|
|
98
|
+
this.onChangeContent();
|
|
99
|
+
}
|
|
100
|
+
updateValue() {
|
|
101
|
+
this.value = this.field._fieldValue;
|
|
102
|
+
}
|
|
98
103
|
onInputChange() {
|
|
99
|
-
setTimeout(() => this.
|
|
104
|
+
setTimeout(() => this.field.notifyEditionPartial(), 50);
|
|
100
105
|
}
|
|
101
106
|
onChangeContent() {
|
|
102
|
-
setTimeout(() => this.
|
|
107
|
+
setTimeout(() => this.field.notifyEditionFinish(), 50);
|
|
103
108
|
}
|
|
104
109
|
onShowInfo() {
|
|
105
|
-
setTimeout(() => this.
|
|
110
|
+
setTimeout(() => this.field.notifyEditionDetailRequest(), 50);
|
|
106
111
|
}
|
|
107
112
|
numberInputValidation(event) {
|
|
108
113
|
const k = event.charCode;
|
|
@@ -110,11 +115,11 @@ class FieldComponent {
|
|
|
110
115
|
}
|
|
111
116
|
get visible() {
|
|
112
117
|
var _a;
|
|
113
|
-
return (_a = this.
|
|
118
|
+
return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState);
|
|
114
119
|
}
|
|
115
120
|
get disabled() {
|
|
116
121
|
var _a;
|
|
117
|
-
return !((_a = this.
|
|
122
|
+
return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
118
123
|
}
|
|
119
124
|
}
|
|
120
125
|
FieldComponent.decorators = [
|
|
@@ -124,7 +129,7 @@ FieldComponent.decorators = [
|
|
|
124
129
|
},] }
|
|
125
130
|
];
|
|
126
131
|
FieldComponent.propDecorators = {
|
|
127
|
-
|
|
132
|
+
field: [{ type: Input }],
|
|
128
133
|
currentState: [{ type: Input }]
|
|
129
134
|
};
|
|
130
135
|
|
|
@@ -2379,7 +2384,7 @@ class BasicFormComponent {
|
|
|
2379
2384
|
this.extraData = {};
|
|
2380
2385
|
this.definitionObtained = false;
|
|
2381
2386
|
this.formVisible = false;
|
|
2382
|
-
this.
|
|
2387
|
+
this.busy = false;
|
|
2383
2388
|
this.formSectionsActivate = {};
|
|
2384
2389
|
this.formSectionsInactivate = {};
|
|
2385
2390
|
this.formActionsStart = {};
|
|
@@ -2398,6 +2403,7 @@ class BasicFormComponent {
|
|
|
2398
2403
|
this.cleanStart();
|
|
2399
2404
|
this.customPreProcessing();
|
|
2400
2405
|
}
|
|
2406
|
+
get inServerProcess() { return this.busy; }
|
|
2401
2407
|
setConfig(formConfig) {
|
|
2402
2408
|
this.formConfig = formConfig;
|
|
2403
2409
|
}
|
|
@@ -2414,7 +2420,7 @@ class BasicFormComponent {
|
|
|
2414
2420
|
this.definitionObtained = false;
|
|
2415
2421
|
// Se limpian los manejadores de eventos
|
|
2416
2422
|
this.formVisible = false;
|
|
2417
|
-
this.
|
|
2423
|
+
this.busy = false;
|
|
2418
2424
|
this.formSectionsActivate = {};
|
|
2419
2425
|
this.formSectionsInactivate = {};
|
|
2420
2426
|
this.formActionsStart = {};
|
|
@@ -2671,9 +2677,9 @@ class BasicFormComponent {
|
|
|
2671
2677
|
return;
|
|
2672
2678
|
}
|
|
2673
2679
|
if (!this.definitionObtained) {
|
|
2674
|
-
this.
|
|
2680
|
+
this.busy = true;
|
|
2675
2681
|
const formDefinition = yield this.formManagerService.getFormDefinition(this.name);
|
|
2676
|
-
this.
|
|
2682
|
+
this.busy = false;
|
|
2677
2683
|
this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
2678
2684
|
this.fields = this.formStructure.fields;
|
|
2679
2685
|
this.actions = this.formStructure.actions;
|
|
@@ -2731,9 +2737,9 @@ class BasicFormComponent {
|
|
|
2731
2737
|
this.errorCode = NO_ERROR;
|
|
2732
2738
|
this.errorMessage = '';
|
|
2733
2739
|
this.errorDetail = '';
|
|
2734
|
-
this.
|
|
2740
|
+
this.busy = true;
|
|
2735
2741
|
const formActionResponse = yield this.formManagerService.execServerAction(actionDetail);
|
|
2736
|
-
this.
|
|
2742
|
+
this.busy = false;
|
|
2737
2743
|
if (formActionResponse && formActionResponse.error.errorType) {
|
|
2738
2744
|
console.log('Excepción no soportada');
|
|
2739
2745
|
}
|