tuain-ng-forms-lib 12.0.8 → 12.0.12
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 +39 -8
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/element.js +7 -1
- package/esm2015/lib/classes/forms/field.js +2 -2
- package/esm2015/lib/classes/forms/form.js +3 -1
- package/esm2015/lib/components/elements/field.component.js +10 -2
- package/esm2015/lib/components/elements/layout/element.component.js +5 -7
- package/esm2015/lib/components/forms/basic-form.js +6 -1
- package/fesm2015/tuain-ng-forms-lib.js +27 -8
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/element.d.ts +2 -0
- package/lib/classes/forms/form.d.ts +2 -0
- package/lib/components/elements/field.component.d.ts +3 -0
- package/lib/components/elements/layout/element.component.d.ts +1 -1
- package/lib/components/forms/basic-form.d.ts +3 -0
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -372,6 +372,7 @@
|
|
|
372
372
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
+
var VALUE = '';
|
|
375
376
|
var FieldComponent = /** @class */ (function () {
|
|
376
377
|
function FieldComponent() {
|
|
377
378
|
}
|
|
@@ -390,13 +391,20 @@
|
|
|
390
391
|
this.fieldObject.attributeChange.subscribe(function (event) {
|
|
391
392
|
var fieldAttr = event.name, value = event.value;
|
|
392
393
|
var compAttr = _this.formConfig.componentFieldAttrMap[fieldAttr];
|
|
393
|
-
|
|
394
|
+
if (compAttr === VALUE) {
|
|
395
|
+
_this.updateValue();
|
|
396
|
+
}
|
|
397
|
+
else if (_this.hasOwnProperty(compAttr)) {
|
|
398
|
+
_this[compAttr] = value;
|
|
399
|
+
}
|
|
394
400
|
});
|
|
395
401
|
}
|
|
396
402
|
this.start();
|
|
397
403
|
};
|
|
398
404
|
FieldComponent.prototype.start = function () { };
|
|
399
405
|
FieldComponent.prototype.focus = function () { };
|
|
406
|
+
FieldComponent.prototype.updateValue = function () { };
|
|
407
|
+
FieldComponent.prototype.updateObject = function () { };
|
|
400
408
|
FieldComponent.prototype.onInputChange = function () {
|
|
401
409
|
var _this = this;
|
|
402
410
|
setTimeout(function () { return _this.fieldObject.notifyEditionPartial(); }, 50);
|
|
@@ -437,18 +445,16 @@
|
|
|
437
445
|
ElementComponent.prototype.start = function () { };
|
|
438
446
|
Object.defineProperty(ElementComponent.prototype, "visible", {
|
|
439
447
|
get: function () {
|
|
440
|
-
var _a, _b
|
|
441
|
-
|
|
442
|
-
return visible && ((_c = this.formElement) === null || _c === void 0 ? void 0 : _c.viewOnState((_d = this.formManager) === null || _d === void 0 ? void 0 : _d.currentState));
|
|
448
|
+
var _a, _b;
|
|
449
|
+
return (_a = this.formElement) === null || _a === void 0 ? void 0 : _a.visibleOn((_b = this.formManager) === null || _b === void 0 ? void 0 : _b.currentState);
|
|
443
450
|
},
|
|
444
451
|
enumerable: false,
|
|
445
452
|
configurable: true
|
|
446
453
|
});
|
|
447
454
|
Object.defineProperty(ElementComponent.prototype, "disabled", {
|
|
448
455
|
get: function () {
|
|
449
|
-
var _a, _b
|
|
450
|
-
|
|
451
|
-
return disabled || !((_c = this.formElement) === null || _c === void 0 ? void 0 : _c.enabledOnState((_d = this.formManager) === null || _d === void 0 ? void 0 : _d.currentState));
|
|
456
|
+
var _a, _b;
|
|
457
|
+
return !((_a = this.formElement) === null || _a === void 0 ? void 0 : _a.enabledOn((_b = this.formManager) === null || _b === void 0 ? void 0 : _b.currentState));
|
|
452
458
|
},
|
|
453
459
|
enumerable: false,
|
|
454
460
|
configurable: true
|
|
@@ -630,6 +636,12 @@
|
|
|
630
636
|
enumerable: false,
|
|
631
637
|
configurable: true
|
|
632
638
|
});
|
|
639
|
+
FormElement.prototype.visibleOn = function (state) {
|
|
640
|
+
return this.visible && this.viewOnState(state);
|
|
641
|
+
};
|
|
642
|
+
FormElement.prototype.enabledOn = function (state) {
|
|
643
|
+
return !this.disabled && this.enabledOnState(state);
|
|
644
|
+
};
|
|
633
645
|
FormElement.prototype.setVisibility = function (visible, forced) {
|
|
634
646
|
if (forced === void 0) { forced = null; }
|
|
635
647
|
this._visible = visible && true;
|
|
@@ -2310,7 +2322,7 @@
|
|
|
2310
2322
|
}
|
|
2311
2323
|
break;
|
|
2312
2324
|
case this._formConfig.fieldTypes.currency:
|
|
2313
|
-
newFinalValue = formatCurrency(
|
|
2325
|
+
newFinalValue = formatCurrency(newValue);
|
|
2314
2326
|
break;
|
|
2315
2327
|
default:
|
|
2316
2328
|
newFinalValue = newValue;
|
|
@@ -2592,6 +2604,11 @@
|
|
|
2592
2604
|
? this._sectionsObj[sectionCode] : null;
|
|
2593
2605
|
return (section) ? section.getSubsection(subsectionCode) : null;
|
|
2594
2606
|
};
|
|
2607
|
+
Object.defineProperty(FormStructureAndData.prototype, "actions", {
|
|
2608
|
+
get: function () { return this._actionsObj; },
|
|
2609
|
+
enumerable: false,
|
|
2610
|
+
configurable: true
|
|
2611
|
+
});
|
|
2595
2612
|
FormStructureAndData.prototype.getSection = function (sectionCode) {
|
|
2596
2613
|
return (this._sectionsObj && this._sectionsObj[sectionCode])
|
|
2597
2614
|
? this._sectionsObj[sectionCode] : null;
|
|
@@ -2776,6 +2793,11 @@
|
|
|
2776
2793
|
var actionNames = (Array.isArray(actionArray)) ? actionArray : [actionArray];
|
|
2777
2794
|
actionNames.forEach(function (actionCode) { return _this.disableAction(actionCode); });
|
|
2778
2795
|
};
|
|
2796
|
+
Object.defineProperty(FormStructureAndData.prototype, "fields", {
|
|
2797
|
+
get: function () { return this._fieldsObj; },
|
|
2798
|
+
enumerable: false,
|
|
2799
|
+
configurable: true
|
|
2800
|
+
});
|
|
2779
2801
|
FormStructureAndData.prototype.enableField = function (fieldCode) {
|
|
2780
2802
|
var fieldObject = this.getFieldObject(fieldCode);
|
|
2781
2803
|
return (fieldObject) ? fieldObject.enable() : null;
|
|
@@ -3265,6 +3287,8 @@
|
|
|
3265
3287
|
this.errorMessage = '';
|
|
3266
3288
|
this.errorDetail = '';
|
|
3267
3289
|
this.formStructure = null;
|
|
3290
|
+
this.fields = null;
|
|
3291
|
+
this.actions = null;
|
|
3268
3292
|
this.controlToken = null;
|
|
3269
3293
|
this.inputDataFields = {};
|
|
3270
3294
|
this.definitionObtained = false;
|
|
@@ -3285,6 +3309,11 @@
|
|
|
3285
3309
|
this.tableGetDataStart = {};
|
|
3286
3310
|
this.tableGetDataFinish = {};
|
|
3287
3311
|
};
|
|
3312
|
+
Object.defineProperty(BasicFormComponent.prototype, "form", {
|
|
3313
|
+
get: function () { return this.formStructure; },
|
|
3314
|
+
enumerable: false,
|
|
3315
|
+
configurable: true
|
|
3316
|
+
});
|
|
3288
3317
|
Object.defineProperty(BasicFormComponent.prototype, "currentState", {
|
|
3289
3318
|
get: function () { return this.formStructure.state; },
|
|
3290
3319
|
set: function (state) { this.formStructure.changeState(state); },
|
|
@@ -3578,6 +3607,8 @@
|
|
|
3578
3607
|
formDefinition = _j.sent();
|
|
3579
3608
|
this.inServerProcess = false;
|
|
3580
3609
|
this.formStructure = new FormStructureAndData(formDefinition, this.formConfig);
|
|
3610
|
+
this.fields = this.formStructure.fields;
|
|
3611
|
+
this.actions = this.formStructure.actions;
|
|
3581
3612
|
this.definitionObtained = true;
|
|
3582
3613
|
return [3 /*break*/, 3];
|
|
3583
3614
|
case 2:
|