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
|
@@ -11,32 +11,32 @@
|
|
|
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
25
|
var _a, _b, _c, _d, _e;
|
|
26
|
-
if (!((_a = this.
|
|
26
|
+
if (!((_a = this.action) === null || _a === void 0 ? void 0 : _a.restrictedOnField)) {
|
|
27
27
|
return true;
|
|
28
28
|
}
|
|
29
|
-
if ((((_b = this.
|
|
30
|
-
&& this.relatedField === ((_c = this.
|
|
31
|
-
|| (((_d = this.
|
|
32
|
-
&& this.relatedField !== ((_e = this.
|
|
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
33
|
return true;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(ActionComponent.prototype, "visible", {
|
|
37
37
|
get: function () {
|
|
38
38
|
var _a;
|
|
39
|
-
return ((_a = this.
|
|
39
|
+
return ((_a = this.action) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState)) && this.visibleOnRestriction();
|
|
40
40
|
},
|
|
41
41
|
enumerable: false,
|
|
42
42
|
configurable: true
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
Object.defineProperty(ActionComponent.prototype, "disabled", {
|
|
45
45
|
get: function () {
|
|
46
46
|
var _a;
|
|
47
|
-
return !((_a = this.
|
|
47
|
+
return !((_a = this.action) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
48
48
|
},
|
|
49
49
|
enumerable: false,
|
|
50
50
|
configurable: true
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},] }
|
|
59
59
|
];
|
|
60
60
|
ActionComponent.propDecorators = {
|
|
61
|
-
|
|
61
|
+
action: [{ type: core.Input }],
|
|
62
62
|
busy: [{ type: core.Input }],
|
|
63
63
|
relatedField: [{ type: core.Input }],
|
|
64
64
|
currentState: [{ type: core.Input }],
|
|
@@ -391,8 +391,8 @@
|
|
|
391
391
|
FieldComponent.prototype.ngOnInit = function () {
|
|
392
392
|
var _this = this;
|
|
393
393
|
var _a, _b;
|
|
394
|
-
if (this.
|
|
395
|
-
this.formConfig = (_a = this.
|
|
394
|
+
if (this.field) {
|
|
395
|
+
this.formConfig = (_a = this.field) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
396
396
|
// Inicialización
|
|
397
397
|
var mapping = Object.entries(this.formConfig.componentFieldAttrMap);
|
|
398
398
|
for (var index = 0; index < mapping.length; index++) {
|
|
@@ -401,18 +401,18 @@
|
|
|
401
401
|
if (compAttr === VALUE) {
|
|
402
402
|
this.updateValue();
|
|
403
403
|
}
|
|
404
|
-
else
|
|
405
|
-
this[compAttr] = (_b = this.
|
|
404
|
+
else {
|
|
405
|
+
this[compAttr] = (_b = this.field) === null || _b === void 0 ? void 0 : _b[fieldAttr.toString()];
|
|
406
406
|
}
|
|
407
407
|
}
|
|
408
408
|
// Subscripción a cambios en atributos
|
|
409
|
-
this.
|
|
409
|
+
this.field.attributeChange.subscribe(function (event) {
|
|
410
410
|
var fieldAttr = event.name, value = event.value;
|
|
411
411
|
var compAttr = _this.formConfig.componentFieldAttrMap[fieldAttr];
|
|
412
412
|
if (compAttr === VALUE) {
|
|
413
413
|
_this.updateValue();
|
|
414
414
|
}
|
|
415
|
-
else
|
|
415
|
+
else {
|
|
416
416
|
_this[compAttr] = value;
|
|
417
417
|
}
|
|
418
418
|
});
|
|
@@ -421,19 +421,24 @@
|
|
|
421
421
|
};
|
|
422
422
|
FieldComponent.prototype.start = function () { };
|
|
423
423
|
FieldComponent.prototype.focus = function () { };
|
|
424
|
-
FieldComponent.prototype.
|
|
425
|
-
|
|
424
|
+
FieldComponent.prototype.updateObject = function () {
|
|
425
|
+
this.field._fieldValue = this.value;
|
|
426
|
+
this.onChangeContent();
|
|
427
|
+
};
|
|
428
|
+
FieldComponent.prototype.updateValue = function () {
|
|
429
|
+
this.value = this.field._fieldValue;
|
|
430
|
+
};
|
|
426
431
|
FieldComponent.prototype.onInputChange = function () {
|
|
427
432
|
var _this = this;
|
|
428
|
-
setTimeout(function () { return _this.
|
|
433
|
+
setTimeout(function () { return _this.field.notifyEditionPartial(); }, 50);
|
|
429
434
|
};
|
|
430
435
|
FieldComponent.prototype.onChangeContent = function () {
|
|
431
436
|
var _this = this;
|
|
432
|
-
setTimeout(function () { return _this.
|
|
437
|
+
setTimeout(function () { return _this.field.notifyEditionFinish(); }, 50);
|
|
433
438
|
};
|
|
434
439
|
FieldComponent.prototype.onShowInfo = function () {
|
|
435
440
|
var _this = this;
|
|
436
|
-
setTimeout(function () { return _this.
|
|
441
|
+
setTimeout(function () { return _this.field.notifyEditionDetailRequest(); }, 50);
|
|
437
442
|
};
|
|
438
443
|
FieldComponent.prototype.numberInputValidation = function (event) {
|
|
439
444
|
var k = event.charCode;
|
|
@@ -442,7 +447,7 @@
|
|
|
442
447
|
Object.defineProperty(FieldComponent.prototype, "visible", {
|
|
443
448
|
get: function () {
|
|
444
449
|
var _a;
|
|
445
|
-
return (_a = this.
|
|
450
|
+
return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.currentState);
|
|
446
451
|
},
|
|
447
452
|
enumerable: false,
|
|
448
453
|
configurable: true
|
|
@@ -450,7 +455,7 @@
|
|
|
450
455
|
Object.defineProperty(FieldComponent.prototype, "disabled", {
|
|
451
456
|
get: function () {
|
|
452
457
|
var _a;
|
|
453
|
-
return !((_a = this.
|
|
458
|
+
return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.currentState));
|
|
454
459
|
},
|
|
455
460
|
enumerable: false,
|
|
456
461
|
configurable: true
|
|
@@ -464,7 +469,7 @@
|
|
|
464
469
|
},] }
|
|
465
470
|
];
|
|
466
471
|
FieldComponent.propDecorators = {
|
|
467
|
-
|
|
472
|
+
field: [{ type: core.Input }],
|
|
468
473
|
currentState: [{ type: core.Input }]
|
|
469
474
|
};
|
|
470
475
|
|
|
@@ -3293,7 +3298,7 @@
|
|
|
3293
3298
|
this.extraData = {};
|
|
3294
3299
|
this.definitionObtained = false;
|
|
3295
3300
|
this.formVisible = false;
|
|
3296
|
-
this.
|
|
3301
|
+
this.busy = false;
|
|
3297
3302
|
this.formSectionsActivate = {};
|
|
3298
3303
|
this.formSectionsInactivate = {};
|
|
3299
3304
|
this.formActionsStart = {};
|
|
@@ -3312,6 +3317,11 @@
|
|
|
3312
3317
|
this.cleanStart();
|
|
3313
3318
|
this.customPreProcessing();
|
|
3314
3319
|
}
|
|
3320
|
+
Object.defineProperty(BasicFormComponent.prototype, "inServerProcess", {
|
|
3321
|
+
get: function () { return this.busy; },
|
|
3322
|
+
enumerable: false,
|
|
3323
|
+
configurable: true
|
|
3324
|
+
});
|
|
3315
3325
|
BasicFormComponent.prototype.setConfig = function (formConfig) {
|
|
3316
3326
|
this.formConfig = formConfig;
|
|
3317
3327
|
};
|
|
@@ -3328,7 +3338,7 @@
|
|
|
3328
3338
|
this.definitionObtained = false;
|
|
3329
3339
|
// Se limpian los manejadores de eventos
|
|
3330
3340
|
this.formVisible = false;
|
|
3331
|
-
this.
|
|
3341
|
+
this.busy = false;
|
|
3332
3342
|
this.formSectionsActivate = {};
|
|
3333
3343
|
this.formSectionsInactivate = {};
|
|
3334
3344
|
this.formActionsStart = {};
|
|
@@ -3635,11 +3645,11 @@
|
|
|
3635
3645
|
return [2 /*return*/];
|
|
3636
3646
|
}
|
|
3637
3647
|
if (!!this.definitionObtained) return [3 /*break*/, 2];
|
|
3638
|
-
this.
|
|
3648
|
+
this.busy = true;
|
|
3639
3649
|
return [4 /*yield*/, this.formManagerService.getFormDefinition(this.name)];
|
|
3640
3650
|
case 1:
|
|
3641
3651
|
formDefinition = _j.sent();
|
|
3642
|
-
this.
|
|
3652
|
+
this.busy = false;
|
|
3643
3653
|
this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
3644
3654
|
this.fields = this.formStructure.fields;
|
|
3645
3655
|
this.actions = this.formStructure.actions;
|
|
@@ -3708,11 +3718,11 @@
|
|
|
3708
3718
|
this.errorCode = NO_ERROR;
|
|
3709
3719
|
this.errorMessage = '';
|
|
3710
3720
|
this.errorDetail = '';
|
|
3711
|
-
this.
|
|
3721
|
+
this.busy = true;
|
|
3712
3722
|
return [4 /*yield*/, this.formManagerService.execServerAction(actionDetail)];
|
|
3713
3723
|
case 1:
|
|
3714
3724
|
formActionResponse = _j.sent();
|
|
3715
|
-
this.
|
|
3725
|
+
this.busy = false;
|
|
3716
3726
|
if (formActionResponse && formActionResponse.error.errorType) {
|
|
3717
3727
|
console.log('Excepción no soportada');
|
|
3718
3728
|
}
|