@formio/js 5.0.0-dev.5920.f1002ff → 5.0.0-dev.5923.b428b7b
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 +1 -0
- package/lib/cjs/Wizard.d.ts +1 -0
- package/lib/cjs/Wizard.js +14 -5
- package/lib/cjs/components/form/Form.js +1 -1
- package/lib/mjs/WebformBuilder.js +1 -0
- package/lib/mjs/Wizard.d.ts +1 -0
- package/lib/mjs/Wizard.js +13 -4
- package/lib/mjs/components/form/Form.js +1 -1
- package/package.json +1 -1
package/lib/cjs/Wizard.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ 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[];
|
|
108
109
|
focusOnComponent(key: any): void | Promise<void>;
|
|
109
110
|
}
|
|
110
111
|
declare namespace Wizard {
|
package/lib/cjs/Wizard.js
CHANGED
|
@@ -720,10 +720,9 @@ class Wizard extends Webform_1.default {
|
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
722
|
validateCurrentPage(flags = {}) {
|
|
723
|
-
var _a
|
|
724
|
-
const components = (_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.components.map((component) => component.component);
|
|
723
|
+
var _a;
|
|
725
724
|
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
|
726
|
-
return (
|
|
725
|
+
return (_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.parent.validateComponents(this.currentPage.component.components, this.currentPage.parent.data, flags);
|
|
727
726
|
}
|
|
728
727
|
emitPrevPage() {
|
|
729
728
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
|
@@ -865,8 +864,7 @@ class Wizard extends Webform_1.default {
|
|
|
865
864
|
onChange(flags, changed, modified, changes) {
|
|
866
865
|
var _a, _b;
|
|
867
866
|
super.onChange(flags, changed, modified, changes);
|
|
868
|
-
|
|
869
|
-
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
|
867
|
+
const errors = this.validate(this.localData, { dirty: false });
|
|
870
868
|
if (this.alert) {
|
|
871
869
|
this.showErrors(errors, true, true);
|
|
872
870
|
}
|
|
@@ -926,6 +924,17 @@ class Wizard extends Webform_1.default {
|
|
|
926
924
|
}
|
|
927
925
|
return super.errors;
|
|
928
926
|
}
|
|
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
|
+
}
|
|
929
938
|
focusOnComponent(key) {
|
|
930
939
|
const component = this.getComponent(key);
|
|
931
940
|
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 && !this.isNestedWizard) {
|
|
480
480
|
return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
|
|
481
481
|
}
|
|
482
482
|
return super.checkComponentValidity(data, dirty, row, options, errors);
|
package/lib/mjs/Wizard.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ 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[];
|
|
108
109
|
focusOnComponent(key: any): void | Promise<void>;
|
|
109
110
|
}
|
|
110
111
|
declare namespace Wizard {
|
package/lib/mjs/Wizard.js
CHANGED
|
@@ -710,9 +710,8 @@ export default class Wizard extends Webform {
|
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
712
|
validateCurrentPage(flags = {}) {
|
|
713
|
-
const components = this.currentPage?.components.map((component) => component.component);
|
|
714
713
|
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
|
715
|
-
return this.currentPage?.parent.validateComponents(components, this.currentPage.parent.data, flags);
|
|
714
|
+
return this.currentPage?.parent.validateComponents(this.currentPage.component.components, this.currentPage.parent.data, flags);
|
|
716
715
|
}
|
|
717
716
|
emitPrevPage() {
|
|
718
717
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
|
@@ -853,8 +852,7 @@ export default class Wizard extends Webform {
|
|
|
853
852
|
}
|
|
854
853
|
onChange(flags, changed, modified, changes) {
|
|
855
854
|
super.onChange(flags, changed, modified, changes);
|
|
856
|
-
|
|
857
|
-
const errors = this.submitted ? this.validate(this.localData, { dirty: true }) : this.validateCurrentPage();
|
|
855
|
+
const errors = this.validate(this.localData, { dirty: false });
|
|
858
856
|
if (this.alert) {
|
|
859
857
|
this.showErrors(errors, true, true);
|
|
860
858
|
}
|
|
@@ -913,6 +911,17 @@ export default class Wizard extends Webform {
|
|
|
913
911
|
}
|
|
914
912
|
return super.errors;
|
|
915
913
|
}
|
|
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
|
+
}
|
|
916
925
|
focusOnComponent(key) {
|
|
917
926
|
const component = this.getComponent(key);
|
|
918
927
|
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 && !this.isNestedWizard) {
|
|
474
474
|
return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
|
|
475
475
|
}
|
|
476
476
|
return super.checkComponentValidity(data, dirty, row, options, errors);
|