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
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ This component allows to receive the following information
|
|
|
80
80
|
| --- | ----------- |
|
|
81
81
|
| actionObjec | Defines the action object of the form |
|
|
82
82
|
| currentMode | Defines the current state of the form in order to define if the element can be visible or actionable |
|
|
83
|
-
|
|
|
83
|
+
| busy | Defines in the form is makinh an exclusive process that prevents the action execution |
|
|
84
84
|
| relatedField | Describe the field object related with this action |
|
|
85
85
|
| style | Define a style attribute for the action |
|
|
86
86
|
| showLabel | Define if the action shows it's label
|
|
@@ -21,18 +21,30 @@
|
|
|
21
21
|
this.actionObject.notifyActivation();
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
ActionComponent.prototype.visibleOnRestriction = function () {
|
|
25
|
+
var _a, _b, _c, _d, _e;
|
|
26
|
+
if (!((_a = this.actionObject) === null || _a === void 0 ? void 0 : _a.restrictedOnField)) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if ((((_b = this.actionObject) === null || _b === void 0 ? void 0 : _b.restrictedOnOperator) === '=='
|
|
30
|
+
&& this.relatedField === ((_c = this.actionObject) === null || _c === void 0 ? void 0 : _c.restrictedOnValue))
|
|
31
|
+
|| (((_d = this.actionObject) === null || _d === void 0 ? void 0 : _d.restrictedOnOperator) === '!='
|
|
32
|
+
&& this.relatedField !== ((_e = this.actionObject) === null || _e === void 0 ? void 0 : _e.restrictedOnValue))) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(ActionComponent.prototype, "visible", {
|
|
25
37
|
get: function () {
|
|
26
|
-
var _a
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
var _a;
|
|
39
|
+
return ((_a = this.actionObject) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState)) && this.visibleOnRestriction();
|
|
40
|
+
},
|
|
41
|
+
enumerable: false,
|
|
42
|
+
configurable: true
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(ActionComponent.prototype, "disabled", {
|
|
45
|
+
get: function () {
|
|
46
|
+
var _a;
|
|
47
|
+
return !((_a = this.actionObject) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
36
48
|
},
|
|
37
49
|
enumerable: false,
|
|
38
50
|
configurable: true
|
|
@@ -47,9 +59,9 @@
|
|
|
47
59
|
];
|
|
48
60
|
ActionComponent.propDecorators = {
|
|
49
61
|
actionObject: [{ type: core.Input }],
|
|
50
|
-
|
|
51
|
-
formBusy: [{ type: core.Input }],
|
|
62
|
+
busy: [{ type: core.Input }],
|
|
52
63
|
relatedField: [{ type: core.Input }],
|
|
64
|
+
currentState: [{ type: core.Input }],
|
|
53
65
|
style: [{ type: core.Input }],
|
|
54
66
|
showLabel: [{ type: core.Input }]
|
|
55
67
|
};
|
|
@@ -384,8 +396,14 @@
|
|
|
384
396
|
// Inicialización
|
|
385
397
|
var mapping = Object.entries(this.formConfig.componentFieldAttrMap);
|
|
386
398
|
for (var index = 0; index < mapping.length; index++) {
|
|
387
|
-
var _c = __read(mapping[index], 2), fieldAttr = _c[0],
|
|
388
|
-
|
|
399
|
+
var _c = __read(mapping[index], 2), fieldAttr = _c[0], compAttr1 = _c[1];
|
|
400
|
+
var compAttr = compAttr1.toString();
|
|
401
|
+
if (compAttr === VALUE) {
|
|
402
|
+
this.updateValue();
|
|
403
|
+
}
|
|
404
|
+
else if (this.hasOwnProperty(compAttr)) {
|
|
405
|
+
this[compAttr] = (_b = this.fieldObject) === null || _b === void 0 ? void 0 : _b[fieldAttr.toString()];
|
|
406
|
+
}
|
|
389
407
|
}
|
|
390
408
|
// Subscripción a cambios en atributos
|
|
391
409
|
this.fieldObject.attributeChange.subscribe(function (event) {
|
|
@@ -421,6 +439,22 @@
|
|
|
421
439
|
var k = event.charCode;
|
|
422
440
|
return (k > 47 && k < 58);
|
|
423
441
|
};
|
|
442
|
+
Object.defineProperty(FieldComponent.prototype, "visible", {
|
|
443
|
+
get: function () {
|
|
444
|
+
var _a;
|
|
445
|
+
return (_a = this.fieldObject) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState);
|
|
446
|
+
},
|
|
447
|
+
enumerable: false,
|
|
448
|
+
configurable: true
|
|
449
|
+
});
|
|
450
|
+
Object.defineProperty(FieldComponent.prototype, "disabled", {
|
|
451
|
+
get: function () {
|
|
452
|
+
var _a;
|
|
453
|
+
return !((_a = this.fieldObject) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
454
|
+
},
|
|
455
|
+
enumerable: false,
|
|
456
|
+
configurable: true
|
|
457
|
+
});
|
|
424
458
|
return FieldComponent;
|
|
425
459
|
}());
|
|
426
460
|
FieldComponent.decorators = [
|
|
@@ -431,7 +465,7 @@
|
|
|
431
465
|
];
|
|
432
466
|
FieldComponent.propDecorators = {
|
|
433
467
|
fieldObject: [{ type: core.Input }],
|
|
434
|
-
|
|
468
|
+
currentState: [{ type: core.Input }]
|
|
435
469
|
};
|
|
436
470
|
|
|
437
471
|
var ElementComponent = /** @class */ (function () {
|
|
@@ -3698,7 +3732,7 @@
|
|
|
3698
3732
|
BasicFormComponent.prototype.updateFormWithServerData = function (formContent) {
|
|
3699
3733
|
var e_1, _j, e_2, _k, e_3, _l;
|
|
3700
3734
|
var currentMode = formContent.currentMode, formSubject = formContent.formSubject, actions = formContent.actions, fields = formContent.fields, recordTables = formContent.recordTables, returnedFile = formContent.returnedFile, immutableData = formContent.immutableData, extraInfo = formContent.extraInfo;
|
|
3701
|
-
|
|
3735
|
+
currentMode && this.changeState(currentMode);
|
|
3702
3736
|
if (formSubject) {
|
|
3703
3737
|
this.formSubject = formSubject;
|
|
3704
3738
|
}
|
|
@@ -3930,7 +3964,7 @@
|
|
|
3930
3964
|
return [4 /*yield*/, this.finishAction(action, actionResult)];
|
|
3931
3965
|
case 3:
|
|
3932
3966
|
_j.sent();
|
|
3933
|
-
this.changeState(action.newState);
|
|
3967
|
+
action.newState && this.changeState(action.newState);
|
|
3934
3968
|
return [3 /*break*/, 5];
|
|
3935
3969
|
case 4:
|
|
3936
3970
|
this.displayActionServerError();
|
|
@@ -4362,7 +4396,7 @@
|
|
|
4362
4396
|
return [4 /*yield*/, this.finishTableGlobalAction(tableActionDetail, actionResult)];
|
|
4363
4397
|
case 3:
|
|
4364
4398
|
_j.sent();
|
|
4365
|
-
this.changeState(action.newState);
|
|
4399
|
+
action.newState && this.changeState(action.newState);
|
|
4366
4400
|
return [3 /*break*/, 5];
|
|
4367
4401
|
case 4:
|
|
4368
4402
|
this.displayTableServerError();
|
|
@@ -4497,7 +4531,7 @@
|
|
|
4497
4531
|
case 2:
|
|
4498
4532
|
if (finish) {
|
|
4499
4533
|
this.finishTableAction(tableActionDetail, actionResult);
|
|
4500
|
-
this.changeState(action.newState);
|
|
4534
|
+
action.newState && this.changeState(action.newState);
|
|
4501
4535
|
}
|
|
4502
4536
|
else {
|
|
4503
4537
|
this.displayTableServerError();
|
|
@@ -4757,7 +4791,7 @@
|
|
|
4757
4791
|
case 2:
|
|
4758
4792
|
if (finish) {
|
|
4759
4793
|
this.finishTableSelectionAction(tableActionDetail, actionResult);
|
|
4760
|
-
this.changeState(action.newState);
|
|
4794
|
+
action.newState && this.changeState(action.newState);
|
|
4761
4795
|
}
|
|
4762
4796
|
else {
|
|
4763
4797
|
this.displayTableServerError();
|