tuain-ng-forms-lib 12.0.14 → 12.0.18
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 +47 -29
- 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 +26 -13
- package/esm2015/lib/components/forms/basic-form.js +8 -7
- package/fesm2015/tuain-ng-forms-lib.js +43 -29
- 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 +4 -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++) {
|
|
@@ -74,11 +74,11 @@ class FieldComponent {
|
|
|
74
74
|
this.updateValue();
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
this[compAttr] = (_b = this.
|
|
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) {
|
|
@@ -93,16 +93,29 @@ 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
|
+
inputChanged() {
|
|
101
|
+
this.field._fieldValue = this.value;
|
|
102
|
+
this.onInputChange();
|
|
103
|
+
}
|
|
104
|
+
inputTyped() {
|
|
105
|
+
this.field._fieldValue = this.value;
|
|
106
|
+
this.onInputChange();
|
|
107
|
+
}
|
|
108
|
+
updateValue() {
|
|
109
|
+
this.value = this.field._fieldValue;
|
|
110
|
+
}
|
|
98
111
|
onInputChange() {
|
|
99
|
-
setTimeout(() => this.
|
|
112
|
+
setTimeout(() => this.field.notifyEditionPartial(), 50);
|
|
100
113
|
}
|
|
101
114
|
onChangeContent() {
|
|
102
|
-
setTimeout(() => this.
|
|
115
|
+
setTimeout(() => this.field.notifyEditionFinish(), 50);
|
|
103
116
|
}
|
|
104
117
|
onShowInfo() {
|
|
105
|
-
setTimeout(() => this.
|
|
118
|
+
setTimeout(() => this.field.notifyEditionDetailRequest(), 50);
|
|
106
119
|
}
|
|
107
120
|
numberInputValidation(event) {
|
|
108
121
|
const k = event.charCode;
|
|
@@ -110,11 +123,11 @@ class FieldComponent {
|
|
|
110
123
|
}
|
|
111
124
|
get visible() {
|
|
112
125
|
var _a;
|
|
113
|
-
return (_a = this.
|
|
126
|
+
return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState);
|
|
114
127
|
}
|
|
115
128
|
get disabled() {
|
|
116
129
|
var _a;
|
|
117
|
-
return !((_a = this.
|
|
130
|
+
return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
118
131
|
}
|
|
119
132
|
}
|
|
120
133
|
FieldComponent.decorators = [
|
|
@@ -124,7 +137,7 @@ FieldComponent.decorators = [
|
|
|
124
137
|
},] }
|
|
125
138
|
];
|
|
126
139
|
FieldComponent.propDecorators = {
|
|
127
|
-
|
|
140
|
+
field: [{ type: Input }],
|
|
128
141
|
currentState: [{ type: Input }]
|
|
129
142
|
};
|
|
130
143
|
|
|
@@ -2379,7 +2392,7 @@ class BasicFormComponent {
|
|
|
2379
2392
|
this.extraData = {};
|
|
2380
2393
|
this.definitionObtained = false;
|
|
2381
2394
|
this.formVisible = false;
|
|
2382
|
-
this.
|
|
2395
|
+
this.busy = false;
|
|
2383
2396
|
this.formSectionsActivate = {};
|
|
2384
2397
|
this.formSectionsInactivate = {};
|
|
2385
2398
|
this.formActionsStart = {};
|
|
@@ -2398,6 +2411,7 @@ class BasicFormComponent {
|
|
|
2398
2411
|
this.cleanStart();
|
|
2399
2412
|
this.customPreProcessing();
|
|
2400
2413
|
}
|
|
2414
|
+
get inServerProcess() { return this.busy; }
|
|
2401
2415
|
setConfig(formConfig) {
|
|
2402
2416
|
this.formConfig = formConfig;
|
|
2403
2417
|
}
|
|
@@ -2414,7 +2428,7 @@ class BasicFormComponent {
|
|
|
2414
2428
|
this.definitionObtained = false;
|
|
2415
2429
|
// Se limpian los manejadores de eventos
|
|
2416
2430
|
this.formVisible = false;
|
|
2417
|
-
this.
|
|
2431
|
+
this.busy = false;
|
|
2418
2432
|
this.formSectionsActivate = {};
|
|
2419
2433
|
this.formSectionsInactivate = {};
|
|
2420
2434
|
this.formActionsStart = {};
|
|
@@ -2671,9 +2685,9 @@ class BasicFormComponent {
|
|
|
2671
2685
|
return;
|
|
2672
2686
|
}
|
|
2673
2687
|
if (!this.definitionObtained) {
|
|
2674
|
-
this.
|
|
2688
|
+
this.busy = true;
|
|
2675
2689
|
const formDefinition = yield this.formManagerService.getFormDefinition(this.name);
|
|
2676
|
-
this.
|
|
2690
|
+
this.busy = false;
|
|
2677
2691
|
this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
2678
2692
|
this.fields = this.formStructure.fields;
|
|
2679
2693
|
this.actions = this.formStructure.actions;
|
|
@@ -2731,9 +2745,9 @@ class BasicFormComponent {
|
|
|
2731
2745
|
this.errorCode = NO_ERROR;
|
|
2732
2746
|
this.errorMessage = '';
|
|
2733
2747
|
this.errorDetail = '';
|
|
2734
|
-
this.
|
|
2748
|
+
this.busy = true;
|
|
2735
2749
|
const formActionResponse = yield this.formManagerService.execServerAction(actionDetail);
|
|
2736
|
-
this.
|
|
2750
|
+
this.busy = false;
|
|
2737
2751
|
if (formActionResponse && formActionResponse.error.errorType) {
|
|
2738
2752
|
console.log('Excepción no soportada');
|
|
2739
2753
|
}
|