tuain-ng-forms-lib 12.0.85 → 12.0.88
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 +15 -13
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/field.js +4 -5
- package/esm2015/lib/components/forms/basic-form.js +13 -10
- package/fesm2015/tuain-ng-forms-lib.js +15 -13
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/components/forms/basic-form.d.ts +1 -0
- package/package.json +1 -1
|
@@ -703,14 +703,13 @@ class FieldDescriptor extends FormElement {
|
|
|
703
703
|
}
|
|
704
704
|
;
|
|
705
705
|
if (this.fieldType === this._formConfig.fieldTypes.phone) {
|
|
706
|
-
if (Array.isArray(fieldCurrentValue)
|
|
706
|
+
if (!Array.isArray(fieldCurrentValue)) {
|
|
707
707
|
return true;
|
|
708
708
|
}
|
|
709
|
-
if (
|
|
710
|
-
&& (!fieldCurrentValue[1] || fieldCurrentValue[1].length === 0)) {
|
|
709
|
+
if (fieldCurrentValue.length !== 2 || !fieldCurrentValue[0] || !fieldCurrentValue[1]) {
|
|
711
710
|
return true;
|
|
712
711
|
}
|
|
713
|
-
return
|
|
712
|
+
return false;
|
|
714
713
|
}
|
|
715
714
|
;
|
|
716
715
|
return fieldCurrentValue === '';
|
|
@@ -2541,17 +2540,18 @@ class BasicFormComponent {
|
|
|
2541
2540
|
return (name) ? ((_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : null) : null;
|
|
2542
2541
|
}
|
|
2543
2542
|
preocessInputParams(params) {
|
|
2544
|
-
var _a, _b, _c;
|
|
2543
|
+
var _a, _b, _c, _d;
|
|
2545
2544
|
this._controlToken = (_a = params === null || params === void 0 ? void 0 : params[TOKEN]) !== null && _a !== void 0 ? _a : null;
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2545
|
+
this.formSubject = (_b = params === null || params === void 0 ? void 0 : params[SUBJECT]) !== null && _b !== void 0 ? _b : null;
|
|
2546
|
+
const tokenInfo = (this._controlToken) ? this.formManagerService.getFormInfo(this._controlToken) : {};
|
|
2547
|
+
const { token, subject, state, fields, extra, originToken } = tokenInfo;
|
|
2548
|
+
if (token && this._controlToken === token) {
|
|
2549
|
+
this.formSubject = (_d = (_c = this.formSubject) !== null && _c !== void 0 ? _c : subject) !== null && _d !== void 0 ? _d : null;
|
|
2550
|
+
this.inputDataFields = fields;
|
|
2551
|
+
this.extraData = extra;
|
|
2552
|
+
this._originToken = originToken;
|
|
2553
|
+
return state;
|
|
2549
2554
|
}
|
|
2550
|
-
this.formSubject = (_c = (_b = params === null || params === void 0 ? void 0 : params[SUBJECT]) !== null && _b !== void 0 ? _b : subject) !== null && _c !== void 0 ? _c : null;
|
|
2551
|
-
this.inputDataFields = fields;
|
|
2552
|
-
this.extraData = extra;
|
|
2553
|
-
this._originToken = originToken;
|
|
2554
|
-
return state;
|
|
2555
2555
|
}
|
|
2556
2556
|
subscribeSectionActivation() {
|
|
2557
2557
|
const formSections = this._formStructure.sections;
|
|
@@ -2600,6 +2600,7 @@ class BasicFormComponent {
|
|
|
2600
2600
|
}
|
|
2601
2601
|
}
|
|
2602
2602
|
formInit(params) {
|
|
2603
|
+
var _a;
|
|
2603
2604
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2604
2605
|
let initialState = this.preocessInputParams(params);
|
|
2605
2606
|
if (!this.name) {
|
|
@@ -2631,6 +2632,7 @@ class BasicFormComponent {
|
|
|
2631
2632
|
const recordResponse = yield this.requestFormAction(formActions.getData);
|
|
2632
2633
|
this.checkErrorRecordReceived(recordResponse);
|
|
2633
2634
|
this.visible = true;
|
|
2635
|
+
this.enabledSections = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.visibleSections;
|
|
2634
2636
|
this.subscribeSectionActivation();
|
|
2635
2637
|
this.subscribeFieldsSubjects();
|
|
2636
2638
|
this.subscribeActionSubjects();
|