@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.
@@ -1056,6 +1056,7 @@ class WebformBuilder extends Component_1.default {
1056
1056
  'conditional',
1057
1057
  'customConditional',
1058
1058
  'id',
1059
+ 'logic',
1059
1060
  'fields.day.required',
1060
1061
  'fields.month.required',
1061
1062
  'fields.year.required',
@@ -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, _b;
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 (_b = this.currentPage) === null || _b === void 0 ? void 0 : _b.parent.validateComponents(components, this.currentPage.parent.data, flags);
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
- // The onChange loop doesn't need all components for wizards
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);
@@ -1040,6 +1040,7 @@ export default class WebformBuilder extends Component {
1040
1040
  'conditional',
1041
1041
  'customConditional',
1042
1042
  'id',
1043
+ 'logic',
1043
1044
  'fields.day.required',
1044
1045
  'fields.month.required',
1045
1046
  'fields.year.required',
@@ -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
- // The onChange loop doesn't need all components for wizards
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5920.f1002ff",
3
+ "version": "5.0.0-dev.5923.b428b7b",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {