@formio/js 5.1.0-dev.5979.933c0c9 → 5.1.0-dev.5981.6282823

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/lib/cjs/Wizard.js CHANGED
@@ -667,7 +667,7 @@ class Wizard extends Webform_1.default {
667
667
  return this.page - 1;
668
668
  }
669
669
  beforeSubmit() {
670
- const pages = this.getPages();
670
+ const pages = this.getPages({ all: true });
671
671
  return Promise.all(pages.map((page) => {
672
672
  page.options.beforeSubmit = true;
673
673
  return page.beforeSubmit();
@@ -587,11 +587,21 @@ class FormComponent extends Component_1.default {
587
587
  this.dataValue = submission;
588
588
  return Promise.resolve(this.dataValue);
589
589
  }
590
- return this.submitSubForm(false)
591
- .then(() => {
592
- return this.dataValue;
593
- })
594
- .then(() => super.beforeSubmit());
590
+ if (this.isSubFormLazyLoad() && !this.subFormLoading) {
591
+ return this.createSubForm(true)
592
+ .then(this.submitSubForm(false))
593
+ .then(() => {
594
+ return this.dataValue;
595
+ })
596
+ .then(() => super.beforeSubmit());
597
+ }
598
+ else {
599
+ return this.submitSubForm(false)
600
+ .then(() => {
601
+ return this.dataValue;
602
+ })
603
+ .then(() => super.beforeSubmit());
604
+ }
595
605
  }
596
606
  isSubFormLazyLoad() {
597
607
  var _a, _b;
@@ -198,7 +198,7 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
198
198
  if (!Formio_1.Formio.libraries[this.getLibraryName()]) {
199
199
  return;
200
200
  }
201
- const existingScript = document === null || document === void 0 ? void 0 : document.querySelector(`script[src^="${GOOGLE_MAPS_JS_URL}"]`);
201
+ const existingScript = document.querySelector(`script[src^="${GOOGLE_MAPS_JS_URL}"]`);
202
202
  if (existingScript && ((_a = options.params) === null || _a === void 0 ? void 0 : _a.key) && !existingScript.attributes.src.value.endsWith(options.params.key)) {
203
203
  const googleMapsScripts = (_b = document.querySelectorAll(`script[src^="${GOOGLE_MAPS_BASE_URL}"]`)) !== null && _b !== void 0 ? _b : [];
204
204
  googleMapsScripts.forEach(script => script.parentNode.removeChild(script));
package/lib/mjs/Wizard.js CHANGED
@@ -657,7 +657,7 @@ export default class Wizard extends Webform {
657
657
  return this.page - 1;
658
658
  }
659
659
  beforeSubmit() {
660
- const pages = this.getPages();
660
+ const pages = this.getPages({ all: true });
661
661
  return Promise.all(pages.map((page) => {
662
662
  page.options.beforeSubmit = true;
663
663
  return page.beforeSubmit();
@@ -580,11 +580,21 @@ export default class FormComponent extends Component {
580
580
  this.dataValue = submission;
581
581
  return Promise.resolve(this.dataValue);
582
582
  }
583
- return this.submitSubForm(false)
584
- .then(() => {
585
- return this.dataValue;
586
- })
587
- .then(() => super.beforeSubmit());
583
+ if (this.isSubFormLazyLoad() && !this.subFormLoading) {
584
+ return this.createSubForm(true)
585
+ .then(this.submitSubForm(false))
586
+ .then(() => {
587
+ return this.dataValue;
588
+ })
589
+ .then(() => super.beforeSubmit());
590
+ }
591
+ else {
592
+ return this.submitSubForm(false)
593
+ .then(() => {
594
+ return this.dataValue;
595
+ })
596
+ .then(() => super.beforeSubmit());
597
+ }
588
598
  }
589
599
  isSubFormLazyLoad() {
590
600
  return this.root?._form?.display === 'wizard' && this.component.lazyLoad;
@@ -190,7 +190,7 @@ export class GoogleAddressProvider extends AddressProvider {
190
190
  if (!Formio.libraries[this.getLibraryName()]) {
191
191
  return;
192
192
  }
193
- const existingScript = document?.querySelector(`script[src^="${GOOGLE_MAPS_JS_URL}"]`);
193
+ const existingScript = document.querySelector(`script[src^="${GOOGLE_MAPS_JS_URL}"]`);
194
194
  if (existingScript && options.params?.key && !existingScript.attributes.src.value.endsWith(options.params.key)) {
195
195
  const googleMapsScripts = document.querySelectorAll(`script[src^="${GOOGLE_MAPS_BASE_URL}"]`) ?? [];
196
196
  googleMapsScripts.forEach(script => script.parentNode.removeChild(script));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.1.0-dev.5979.933c0c9",
3
+ "version": "5.1.0-dev.5981.6282823",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {