@formio/js 5.0.0-dev.5919.408636c → 5.0.0-dev.5920.f58ae24
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 +3 -3
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/WebformBuilder.js +6 -9
- package/lib/cjs/Wizard.js +12 -11
- package/lib/cjs/components/form/Form.js +1 -1
- package/lib/mjs/WebformBuilder.js +6 -9
- package/lib/mjs/Wizard.js +11 -10
- package/lib/mjs/components/form/Form.js +1 -1
- package/package.json +1 -1
|
@@ -901,16 +901,13 @@ class WebformBuilder extends Component_1.default {
|
|
|
901
901
|
keyboardActionsEnabled = keyboardActionsEnabled === 'true';
|
|
902
902
|
}
|
|
903
903
|
this.keyboardActionsEnabled = keyboardActionsEnabled;
|
|
904
|
-
const
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
// Don't add if there is noAddSubmitButton flag passed, or the form has id, or the form has a submit button already
|
|
910
|
-
const shouldAddSubmitButton = (display === 'wizard' && !hasSubmitButton) ||
|
|
911
|
-
(!noAddSubmitButton && !_id && !hasSubmitButton);
|
|
904
|
+
const isSubmitButton = (comp) => {
|
|
905
|
+
return (comp.type === 'button') && ((comp.action === 'submit') || !comp.action);
|
|
906
|
+
};
|
|
907
|
+
const isShowSubmitButton = !this.options.noDefaultSubmitButton
|
|
908
|
+
&& (!form.components.length || !form.components.find(comp => isSubmitButton(comp)));
|
|
912
909
|
// Ensure there is at least a submit button.
|
|
913
|
-
if (
|
|
910
|
+
if (isShowSubmitButton) {
|
|
914
911
|
form.components.push({
|
|
915
912
|
type: 'button',
|
|
916
913
|
label: 'Submit',
|
package/lib/cjs/Wizard.js
CHANGED
|
@@ -720,9 +720,10 @@ class Wizard extends Webform_1.default {
|
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
722
|
validateCurrentPage(flags = {}) {
|
|
723
|
-
var _a;
|
|
723
|
+
var _a, _b;
|
|
724
|
+
const components = (_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.components.map((component) => component.component);
|
|
724
725
|
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
|
725
|
-
return (
|
|
726
|
+
return (_b = this.currentPage) === null || _b === void 0 ? void 0 : _b.parent.validateComponents(components, this.currentPage.parent.data, flags);
|
|
726
727
|
}
|
|
727
728
|
emitPrevPage() {
|
|
728
729
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
|
@@ -864,7 +865,8 @@ class Wizard extends Webform_1.default {
|
|
|
864
865
|
onChange(flags, changed, modified, changes) {
|
|
865
866
|
var _a, _b;
|
|
866
867
|
super.onChange(flags, changed, modified, changes);
|
|
867
|
-
|
|
868
|
+
// The onChange loop doesn't need all components for wizards
|
|
869
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: false }) : this.validateCurrentPage();
|
|
868
870
|
if (this.alert) {
|
|
869
871
|
this.showErrors(errors, true, true);
|
|
870
872
|
}
|
|
@@ -925,14 +927,13 @@ class Wizard extends Webform_1.default {
|
|
|
925
927
|
return super.errors;
|
|
926
928
|
}
|
|
927
929
|
showErrors(errors, triggerEvent) {
|
|
928
|
-
if (this.hasExtraPages) {
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
}
|
|
935
|
-
;
|
|
930
|
+
// if (this.hasExtraPages) {
|
|
931
|
+
// this.subWizards.forEach((subWizard) => {
|
|
932
|
+
// if(Array.isArray(subWizard.errors)) {
|
|
933
|
+
// errors = [...errors, ...subWizard.errors]
|
|
934
|
+
// }
|
|
935
|
+
// })
|
|
936
|
+
// }
|
|
936
937
|
return super.showErrors(errors, triggerEvent);
|
|
937
938
|
}
|
|
938
939
|
focusOnComponent(key) {
|
|
@@ -476,7 +476,7 @@ class FormComponent extends Component_1.default {
|
|
|
476
476
|
checkComponentValidity(data, dirty, row, options, errors = []) {
|
|
477
477
|
options = options || {};
|
|
478
478
|
const silentCheck = options.silentCheck || false;
|
|
479
|
-
if (this.subForm
|
|
479
|
+
if (this.subForm) {
|
|
480
480
|
return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
|
|
481
481
|
}
|
|
482
482
|
return super.checkComponentValidity(data, dirty, row, options, errors);
|
|
@@ -885,16 +885,13 @@ export default class WebformBuilder extends Component {
|
|
|
885
885
|
keyboardActionsEnabled = keyboardActionsEnabled === 'true';
|
|
886
886
|
}
|
|
887
887
|
this.keyboardActionsEnabled = keyboardActionsEnabled;
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
const
|
|
892
|
-
|
|
893
|
-
// Don't add if there is noAddSubmitButton flag passed, or the form has id, or the form has a submit button already
|
|
894
|
-
const shouldAddSubmitButton = (display === 'wizard' && !hasSubmitButton) ||
|
|
895
|
-
(!noAddSubmitButton && !_id && !hasSubmitButton);
|
|
888
|
+
const isSubmitButton = (comp) => {
|
|
889
|
+
return (comp.type === 'button') && ((comp.action === 'submit') || !comp.action);
|
|
890
|
+
};
|
|
891
|
+
const isShowSubmitButton = !this.options.noDefaultSubmitButton
|
|
892
|
+
&& (!form.components.length || !form.components.find(comp => isSubmitButton(comp)));
|
|
896
893
|
// Ensure there is at least a submit button.
|
|
897
|
-
if (
|
|
894
|
+
if (isShowSubmitButton) {
|
|
898
895
|
form.components.push({
|
|
899
896
|
type: 'button',
|
|
900
897
|
label: 'Submit',
|
package/lib/mjs/Wizard.js
CHANGED
|
@@ -710,8 +710,9 @@ export default class Wizard extends Webform {
|
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
712
|
validateCurrentPage(flags = {}) {
|
|
713
|
+
const components = this.currentPage?.components.map((component) => component.component);
|
|
713
714
|
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
|
714
|
-
return this.currentPage?.parent.validateComponents(
|
|
715
|
+
return this.currentPage?.parent.validateComponents(components, this.currentPage.parent.data, flags);
|
|
715
716
|
}
|
|
716
717
|
emitPrevPage() {
|
|
717
718
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
|
@@ -852,7 +853,8 @@ export default class Wizard extends Webform {
|
|
|
852
853
|
}
|
|
853
854
|
onChange(flags, changed, modified, changes) {
|
|
854
855
|
super.onChange(flags, changed, modified, changes);
|
|
855
|
-
|
|
856
|
+
// The onChange loop doesn't need all components for wizards
|
|
857
|
+
const errors = this.submitted ? this.validate(this.localData, { dirty: false }) : this.validateCurrentPage();
|
|
856
858
|
if (this.alert) {
|
|
857
859
|
this.showErrors(errors, true, true);
|
|
858
860
|
}
|
|
@@ -912,14 +914,13 @@ export default class Wizard extends Webform {
|
|
|
912
914
|
return super.errors;
|
|
913
915
|
}
|
|
914
916
|
showErrors(errors, triggerEvent) {
|
|
915
|
-
if (this.hasExtraPages) {
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
}
|
|
922
|
-
;
|
|
917
|
+
// if (this.hasExtraPages) {
|
|
918
|
+
// this.subWizards.forEach((subWizard) => {
|
|
919
|
+
// if(Array.isArray(subWizard.errors)) {
|
|
920
|
+
// errors = [...errors, ...subWizard.errors]
|
|
921
|
+
// }
|
|
922
|
+
// })
|
|
923
|
+
// }
|
|
923
924
|
return super.showErrors(errors, triggerEvent);
|
|
924
925
|
}
|
|
925
926
|
focusOnComponent(key) {
|
|
@@ -470,7 +470,7 @@ export default class FormComponent extends Component {
|
|
|
470
470
|
checkComponentValidity(data, dirty, row, options, errors = []) {
|
|
471
471
|
options = options || {};
|
|
472
472
|
const silentCheck = options.silentCheck || false;
|
|
473
|
-
if (this.subForm
|
|
473
|
+
if (this.subForm) {
|
|
474
474
|
return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
|
|
475
475
|
}
|
|
476
476
|
return super.checkComponentValidity(data, dirty, row, options, errors);
|