tuain-ng-forms-lib 12.0.12 → 12.0.16
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 +78 -39
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/components/elements/action.component.js +21 -13
- package/esm2015/lib/components/elements/field.component.js +26 -12
- package/esm2015/lib/components/forms/basic-form.js +13 -12
- package/fesm2015/tuain-ng-forms-lib.js +57 -34
- 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 +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
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
|
|
@@ -11,28 +11,40 @@
|
|
|
11
11
|
}
|
|
12
12
|
ActionComponent.prototype.ngOnInit = function () {
|
|
13
13
|
var _a;
|
|
14
|
-
this.formConfig = (_a = this.
|
|
14
|
+
this.formConfig = (_a = this.action) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
15
15
|
this.start();
|
|
16
16
|
};
|
|
17
17
|
ActionComponent.prototype.start = function () { };
|
|
18
18
|
ActionComponent.prototype.activate = function () {
|
|
19
19
|
var _a;
|
|
20
|
-
if ((_a = this.
|
|
21
|
-
this.
|
|
20
|
+
if ((_a = this.action) === null || _a === void 0 ? void 0 : _a.notifyActivation) {
|
|
21
|
+
this.action.notifyActivation();
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
|
|
24
|
+
ActionComponent.prototype.visibleOnRestriction = function () {
|
|
25
|
+
var _a, _b, _c, _d, _e;
|
|
26
|
+
if (!((_a = this.action) === null || _a === void 0 ? void 0 : _a.restrictedOnField)) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if ((((_b = this.action) === null || _b === void 0 ? void 0 : _b.restrictedOnOperator) === '=='
|
|
30
|
+
&& this.relatedField === ((_c = this.action) === null || _c === void 0 ? void 0 : _c.restrictedOnValue))
|
|
31
|
+
|| (((_d = this.action) === null || _d === void 0 ? void 0 : _d.restrictedOnOperator) === '!='
|
|
32
|
+
&& this.relatedField !== ((_e = this.action) === 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.action) === 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.action) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
36
48
|
},
|
|
37
49
|
enumerable: false,
|
|
38
50
|
configurable: true
|
|
@@ -46,10 +58,10 @@
|
|
|
46
58
|
},] }
|
|
47
59
|
];
|
|
48
60
|
ActionComponent.propDecorators = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
formBusy: [{ type: core.Input }],
|
|
61
|
+
action: [{ 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
|
};
|
|
@@ -379,22 +391,28 @@
|
|
|
379
391
|
FieldComponent.prototype.ngOnInit = function () {
|
|
380
392
|
var _this = this;
|
|
381
393
|
var _a, _b;
|
|
382
|
-
if (this.
|
|
383
|
-
this.formConfig = (_a = this.
|
|
394
|
+
if (this.field) {
|
|
395
|
+
this.formConfig = (_a = this.field) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
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 {
|
|
405
|
+
this[compAttr] = (_b = this.field) === null || _b === void 0 ? void 0 : _b[fieldAttr.toString()];
|
|
406
|
+
}
|
|
389
407
|
}
|
|
390
408
|
// Subscripción a cambios en atributos
|
|
391
|
-
this.
|
|
409
|
+
this.field.attributeChange.subscribe(function (event) {
|
|
392
410
|
var fieldAttr = event.name, value = event.value;
|
|
393
411
|
var compAttr = _this.formConfig.componentFieldAttrMap[fieldAttr];
|
|
394
412
|
if (compAttr === VALUE) {
|
|
395
413
|
_this.updateValue();
|
|
396
414
|
}
|
|
397
|
-
else
|
|
415
|
+
else {
|
|
398
416
|
_this[compAttr] = value;
|
|
399
417
|
}
|
|
400
418
|
});
|
|
@@ -407,20 +425,36 @@
|
|
|
407
425
|
FieldComponent.prototype.updateObject = function () { };
|
|
408
426
|
FieldComponent.prototype.onInputChange = function () {
|
|
409
427
|
var _this = this;
|
|
410
|
-
setTimeout(function () { return _this.
|
|
428
|
+
setTimeout(function () { return _this.field.notifyEditionPartial(); }, 50);
|
|
411
429
|
};
|
|
412
430
|
FieldComponent.prototype.onChangeContent = function () {
|
|
413
431
|
var _this = this;
|
|
414
|
-
setTimeout(function () { return _this.
|
|
432
|
+
setTimeout(function () { return _this.field.notifyEditionFinish(); }, 50);
|
|
415
433
|
};
|
|
416
434
|
FieldComponent.prototype.onShowInfo = function () {
|
|
417
435
|
var _this = this;
|
|
418
|
-
setTimeout(function () { return _this.
|
|
436
|
+
setTimeout(function () { return _this.field.notifyEditionDetailRequest(); }, 50);
|
|
419
437
|
};
|
|
420
438
|
FieldComponent.prototype.numberInputValidation = function (event) {
|
|
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.field) === 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.field) === 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 = [
|
|
@@ -430,8 +464,8 @@
|
|
|
430
464
|
},] }
|
|
431
465
|
];
|
|
432
466
|
FieldComponent.propDecorators = {
|
|
433
|
-
|
|
434
|
-
|
|
467
|
+
field: [{ type: core.Input }],
|
|
468
|
+
currentState: [{ type: core.Input }]
|
|
435
469
|
};
|
|
436
470
|
|
|
437
471
|
var ElementComponent = /** @class */ (function () {
|
|
@@ -3259,7 +3293,7 @@
|
|
|
3259
3293
|
this.extraData = {};
|
|
3260
3294
|
this.definitionObtained = false;
|
|
3261
3295
|
this.formVisible = false;
|
|
3262
|
-
this.
|
|
3296
|
+
this.busy = false;
|
|
3263
3297
|
this.formSectionsActivate = {};
|
|
3264
3298
|
this.formSectionsInactivate = {};
|
|
3265
3299
|
this.formActionsStart = {};
|
|
@@ -3278,6 +3312,11 @@
|
|
|
3278
3312
|
this.cleanStart();
|
|
3279
3313
|
this.customPreProcessing();
|
|
3280
3314
|
}
|
|
3315
|
+
Object.defineProperty(BasicFormComponent.prototype, "inServerProcess", {
|
|
3316
|
+
get: function () { return this.busy; },
|
|
3317
|
+
enumerable: false,
|
|
3318
|
+
configurable: true
|
|
3319
|
+
});
|
|
3281
3320
|
BasicFormComponent.prototype.setConfig = function (formConfig) {
|
|
3282
3321
|
this.formConfig = formConfig;
|
|
3283
3322
|
};
|
|
@@ -3294,7 +3333,7 @@
|
|
|
3294
3333
|
this.definitionObtained = false;
|
|
3295
3334
|
// Se limpian los manejadores de eventos
|
|
3296
3335
|
this.formVisible = false;
|
|
3297
|
-
this.
|
|
3336
|
+
this.busy = false;
|
|
3298
3337
|
this.formSectionsActivate = {};
|
|
3299
3338
|
this.formSectionsInactivate = {};
|
|
3300
3339
|
this.formActionsStart = {};
|
|
@@ -3601,11 +3640,11 @@
|
|
|
3601
3640
|
return [2 /*return*/];
|
|
3602
3641
|
}
|
|
3603
3642
|
if (!!this.definitionObtained) return [3 /*break*/, 2];
|
|
3604
|
-
this.
|
|
3643
|
+
this.busy = true;
|
|
3605
3644
|
return [4 /*yield*/, this.formManagerService.getFormDefinition(this.name)];
|
|
3606
3645
|
case 1:
|
|
3607
3646
|
formDefinition = _j.sent();
|
|
3608
|
-
this.
|
|
3647
|
+
this.busy = false;
|
|
3609
3648
|
this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
3610
3649
|
this.fields = this.formStructure.fields;
|
|
3611
3650
|
this.actions = this.formStructure.actions;
|
|
@@ -3674,11 +3713,11 @@
|
|
|
3674
3713
|
this.errorCode = NO_ERROR;
|
|
3675
3714
|
this.errorMessage = '';
|
|
3676
3715
|
this.errorDetail = '';
|
|
3677
|
-
this.
|
|
3716
|
+
this.busy = true;
|
|
3678
3717
|
return [4 /*yield*/, this.formManagerService.execServerAction(actionDetail)];
|
|
3679
3718
|
case 1:
|
|
3680
3719
|
formActionResponse = _j.sent();
|
|
3681
|
-
this.
|
|
3720
|
+
this.busy = false;
|
|
3682
3721
|
if (formActionResponse && formActionResponse.error.errorType) {
|
|
3683
3722
|
console.log('Excepción no soportada');
|
|
3684
3723
|
}
|
|
@@ -3698,7 +3737,7 @@
|
|
|
3698
3737
|
BasicFormComponent.prototype.updateFormWithServerData = function (formContent) {
|
|
3699
3738
|
var e_1, _j, e_2, _k, e_3, _l;
|
|
3700
3739
|
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
|
-
|
|
3740
|
+
currentMode && this.changeState(currentMode);
|
|
3702
3741
|
if (formSubject) {
|
|
3703
3742
|
this.formSubject = formSubject;
|
|
3704
3743
|
}
|
|
@@ -3930,7 +3969,7 @@
|
|
|
3930
3969
|
return [4 /*yield*/, this.finishAction(action, actionResult)];
|
|
3931
3970
|
case 3:
|
|
3932
3971
|
_j.sent();
|
|
3933
|
-
this.changeState(action.newState);
|
|
3972
|
+
action.newState && this.changeState(action.newState);
|
|
3934
3973
|
return [3 /*break*/, 5];
|
|
3935
3974
|
case 4:
|
|
3936
3975
|
this.displayActionServerError();
|
|
@@ -4362,7 +4401,7 @@
|
|
|
4362
4401
|
return [4 /*yield*/, this.finishTableGlobalAction(tableActionDetail, actionResult)];
|
|
4363
4402
|
case 3:
|
|
4364
4403
|
_j.sent();
|
|
4365
|
-
this.changeState(action.newState);
|
|
4404
|
+
action.newState && this.changeState(action.newState);
|
|
4366
4405
|
return [3 /*break*/, 5];
|
|
4367
4406
|
case 4:
|
|
4368
4407
|
this.displayTableServerError();
|
|
@@ -4497,7 +4536,7 @@
|
|
|
4497
4536
|
case 2:
|
|
4498
4537
|
if (finish) {
|
|
4499
4538
|
this.finishTableAction(tableActionDetail, actionResult);
|
|
4500
|
-
this.changeState(action.newState);
|
|
4539
|
+
action.newState && this.changeState(action.newState);
|
|
4501
4540
|
}
|
|
4502
4541
|
else {
|
|
4503
4542
|
this.displayTableServerError();
|
|
@@ -4757,7 +4796,7 @@
|
|
|
4757
4796
|
case 2:
|
|
4758
4797
|
if (finish) {
|
|
4759
4798
|
this.finishTableSelectionAction(tableActionDetail, actionResult);
|
|
4760
|
-
this.changeState(action.newState);
|
|
4799
|
+
action.newState && this.changeState(action.newState);
|
|
4761
4800
|
}
|
|
4762
4801
|
else {
|
|
4763
4802
|
this.displayTableServerError();
|