@formio/js 5.0.0-dev.5919.408636c → 5.0.0-dev.5920.f1002ff
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.d.ts +0 -1
- package/lib/cjs/Wizard.js +5 -14
- package/lib/cjs/components/form/Form.js +1 -1
- package/lib/mjs/WebformBuilder.js +6 -9
- package/lib/mjs/Wizard.d.ts +0 -1
- package/lib/mjs/Wizard.js +4 -13
- 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.d.ts
CHANGED
|
@@ -105,7 +105,6 @@ declare class Wizard extends Webform {
|
|
|
105
105
|
pageId(page: any): any;
|
|
106
106
|
onChange(flags: any, changed: any, modified: any, changes: any): void;
|
|
107
107
|
checkValidity(data: any, dirty: any, row: any, currentPageOnly: any, childErrors?: any[]): any;
|
|
108
|
-
showErrors(errors: any, triggerEvent: any): void | any[];
|
|
109
108
|
focusOnComponent(key: any): void | Promise<void>;
|
|
110
109
|
}
|
|
111
110
|
declare namespace Wizard {
|
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: true }) : this.validateCurrentPage();
|
|
868
870
|
if (this.alert) {
|
|
869
871
|
this.showErrors(errors, true, true);
|
|
870
872
|
}
|
|
@@ -924,17 +926,6 @@ class Wizard extends Webform_1.default {
|
|
|
924
926
|
}
|
|
925
927
|
return super.errors;
|
|
926
928
|
}
|
|
927
|
-
showErrors(errors, triggerEvent) {
|
|
928
|
-
if (this.hasExtraPages) {
|
|
929
|
-
this.subWizards.forEach((subWizard) => {
|
|
930
|
-
if (Array.isArray(subWizard.errors)) {
|
|
931
|
-
errors = [...errors, ...subWizard.errors];
|
|
932
|
-
}
|
|
933
|
-
});
|
|
934
|
-
}
|
|
935
|
-
;
|
|
936
|
-
return super.showErrors(errors, triggerEvent);
|
|
937
|
-
}
|
|
938
929
|
focusOnComponent(key) {
|
|
939
930
|
const component = this.getComponent(key);
|
|
940
931
|
if (component) {
|
|
@@ -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.d.ts
CHANGED
|
@@ -105,7 +105,6 @@ declare class Wizard extends Webform {
|
|
|
105
105
|
pageId(page: any): any;
|
|
106
106
|
onChange(flags: any, changed: any, modified: any, changes: any): void;
|
|
107
107
|
checkValidity(data: any, dirty: any, row: any, currentPageOnly: any, childErrors?: any[]): any;
|
|
108
|
-
showErrors(errors: any, triggerEvent: any): void | any[];
|
|
109
108
|
focusOnComponent(key: any): void | Promise<void>;
|
|
110
109
|
}
|
|
111
110
|
declare namespace Wizard {
|
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: true }) : this.validateCurrentPage();
|
|
856
858
|
if (this.alert) {
|
|
857
859
|
this.showErrors(errors, true, true);
|
|
858
860
|
}
|
|
@@ -911,17 +913,6 @@ export default class Wizard extends Webform {
|
|
|
911
913
|
}
|
|
912
914
|
return super.errors;
|
|
913
915
|
}
|
|
914
|
-
showErrors(errors, triggerEvent) {
|
|
915
|
-
if (this.hasExtraPages) {
|
|
916
|
-
this.subWizards.forEach((subWizard) => {
|
|
917
|
-
if (Array.isArray(subWizard.errors)) {
|
|
918
|
-
errors = [...errors, ...subWizard.errors];
|
|
919
|
-
}
|
|
920
|
-
});
|
|
921
|
-
}
|
|
922
|
-
;
|
|
923
|
-
return super.showErrors(errors, triggerEvent);
|
|
924
|
-
}
|
|
925
916
|
focusOnComponent(key) {
|
|
926
917
|
const component = this.getComponent(key);
|
|
927
918
|
if (component) {
|
|
@@ -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);
|