@formio/js 5.0.0-dev.5932.9b8cb6d → 5.0.0-dev.5935.c16c9d9
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/dist/formio.form.js +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +2 -2
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/Wizard.js +11 -9
- package/lib/cjs/components/editgrid/EditGrid.js +5 -2
- package/lib/mjs/Wizard.js +11 -9
- package/lib/mjs/components/editgrid/EditGrid.js +4 -1
- package/package.json +1 -1
package/lib/cjs/Wizard.js
CHANGED
|
@@ -602,7 +602,10 @@ class Wizard extends Webform_1.default {
|
|
|
602
602
|
}
|
|
603
603
|
this.redraw().then(() => {
|
|
604
604
|
this.checkData(this.submission.data);
|
|
605
|
-
this.validateCurrentPage();
|
|
605
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
|
606
|
+
if (this.alert) {
|
|
607
|
+
this.showErrors(errors, true, true);
|
|
608
|
+
}
|
|
606
609
|
});
|
|
607
610
|
return Promise.resolve();
|
|
608
611
|
}
|
|
@@ -699,9 +702,11 @@ class Wizard extends Webform_1.default {
|
|
|
699
702
|
});
|
|
700
703
|
});
|
|
701
704
|
}
|
|
702
|
-
// Validate the form
|
|
703
|
-
const
|
|
704
|
-
|
|
705
|
+
// Validate the form before going to the next page
|
|
706
|
+
const currentPageErrors = this.validateCurrentPage({ dirty: true });
|
|
707
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : currentPageErrors;
|
|
708
|
+
// allow going to the next page if the current page is valid, even if there are form level errors
|
|
709
|
+
if (currentPageErrors.length === 0) {
|
|
705
710
|
this.checkData(this.submission.data);
|
|
706
711
|
return this.beforePage(true).then(() => {
|
|
707
712
|
return this.setPage(this.getNextPage()).then(() => {
|
|
@@ -716,7 +721,7 @@ class Wizard extends Webform_1.default {
|
|
|
716
721
|
else {
|
|
717
722
|
this.currentPage.components.forEach((comp) => comp.setPristine(false));
|
|
718
723
|
this.scrollIntoView(this.element, true);
|
|
719
|
-
return Promise.reject(
|
|
724
|
+
return Promise.reject(this.showErrors(errors, true));
|
|
720
725
|
}
|
|
721
726
|
}
|
|
722
727
|
validateCurrentPage(flags = {}) {
|
|
@@ -921,10 +926,7 @@ class Wizard extends Webform_1.default {
|
|
|
921
926
|
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
|
|
922
927
|
}
|
|
923
928
|
get errors() {
|
|
924
|
-
|
|
925
|
-
return this.currentPage.errors;
|
|
926
|
-
}
|
|
927
|
-
return super.errors;
|
|
929
|
+
return !this.isLastPage() && !this.submitted ? this.currentPage.errors : super.errors;
|
|
928
930
|
}
|
|
929
931
|
focusOnComponent(key) {
|
|
930
932
|
const component = this.getComponent(key);
|
|
@@ -987,7 +987,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
987
987
|
dirty;
|
|
988
988
|
}
|
|
989
989
|
validateRow(editRow, dirty, forceSilentCheck, fromSubmission) {
|
|
990
|
-
var _a;
|
|
990
|
+
var _a, _b;
|
|
991
991
|
editRow.errors = [];
|
|
992
992
|
if (this.shouldValidateRow(editRow, dirty, fromSubmission)) {
|
|
993
993
|
const silentCheck = (this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck;
|
|
@@ -1037,9 +1037,12 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
1037
1037
|
});
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
|
-
if (!this.component.rowDrafts || ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submitted)) {
|
|
1040
|
+
if (editRow.alerts && (!this.component.rowDrafts || ((_a = this.root) === null || _a === void 0 ? void 0 : _a.submitted))) {
|
|
1041
1041
|
this.showRowErrorAlerts(editRow, editRow.errors);
|
|
1042
1042
|
}
|
|
1043
|
+
else if ((_b = editRow.errors) === null || _b === void 0 ? void 0 : _b.length) {
|
|
1044
|
+
this.setCustomValidity(editRow.errors, dirty);
|
|
1045
|
+
}
|
|
1043
1046
|
return editRow.errors;
|
|
1044
1047
|
}
|
|
1045
1048
|
showRowErrorAlerts(editRow, errors) {
|
package/lib/mjs/Wizard.js
CHANGED
|
@@ -594,7 +594,10 @@ export default class Wizard extends Webform {
|
|
|
594
594
|
}
|
|
595
595
|
this.redraw().then(() => {
|
|
596
596
|
this.checkData(this.submission.data);
|
|
597
|
-
this.validateCurrentPage();
|
|
597
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
|
598
|
+
if (this.alert) {
|
|
599
|
+
this.showErrors(errors, true, true);
|
|
600
|
+
}
|
|
598
601
|
});
|
|
599
602
|
return Promise.resolve();
|
|
600
603
|
}
|
|
@@ -689,9 +692,11 @@ export default class Wizard extends Webform {
|
|
|
689
692
|
});
|
|
690
693
|
});
|
|
691
694
|
}
|
|
692
|
-
// Validate the form
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
+
// Validate the form before going to the next page
|
|
696
|
+
const currentPageErrors = this.validateCurrentPage({ dirty: true });
|
|
697
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : currentPageErrors;
|
|
698
|
+
// allow going to the next page if the current page is valid, even if there are form level errors
|
|
699
|
+
if (currentPageErrors.length === 0) {
|
|
695
700
|
this.checkData(this.submission.data);
|
|
696
701
|
return this.beforePage(true).then(() => {
|
|
697
702
|
return this.setPage(this.getNextPage()).then(() => {
|
|
@@ -706,7 +711,7 @@ export default class Wizard extends Webform {
|
|
|
706
711
|
else {
|
|
707
712
|
this.currentPage.components.forEach((comp) => comp.setPristine(false));
|
|
708
713
|
this.scrollIntoView(this.element, true);
|
|
709
|
-
return Promise.reject(
|
|
714
|
+
return Promise.reject(this.showErrors(errors, true));
|
|
710
715
|
}
|
|
711
716
|
}
|
|
712
717
|
validateCurrentPage(flags = {}) {
|
|
@@ -908,10 +913,7 @@ export default class Wizard extends Webform {
|
|
|
908
913
|
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, currentPageOnly, childErrors) && check, true);
|
|
909
914
|
}
|
|
910
915
|
get errors() {
|
|
911
|
-
|
|
912
|
-
return this.currentPage.errors;
|
|
913
|
-
}
|
|
914
|
-
return super.errors;
|
|
916
|
+
return !this.isLastPage() && !this.submitted ? this.currentPage.errors : super.errors;
|
|
915
917
|
}
|
|
916
918
|
focusOnComponent(key) {
|
|
917
919
|
const component = this.getComponent(key);
|
|
@@ -1026,9 +1026,12 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
|
1026
1026
|
});
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
|
-
if (!this.component.rowDrafts || this.root?.submitted) {
|
|
1029
|
+
if (editRow.alerts && (!this.component.rowDrafts || this.root?.submitted)) {
|
|
1030
1030
|
this.showRowErrorAlerts(editRow, editRow.errors);
|
|
1031
1031
|
}
|
|
1032
|
+
else if (editRow.errors?.length) {
|
|
1033
|
+
this.setCustomValidity(editRow.errors, dirty);
|
|
1034
|
+
}
|
|
1032
1035
|
return editRow.errors;
|
|
1033
1036
|
}
|
|
1034
1037
|
showRowErrorAlerts(editRow, errors) {
|