@formio/js 5.0.0-dev.5813.afa74f0 → 5.0.0-dev.5818.039b965

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.
@@ -914,8 +914,11 @@ class WebformBuilder extends Component_1.default {
914
914
  keyboardActionsEnabled = keyboardActionsEnabled === 'true';
915
915
  }
916
916
  this.keyboardActionsEnabled = keyboardActionsEnabled;
917
+ const isSubmitButton = (comp) => {
918
+ return (comp.type === 'button') && ((comp.action === 'submit') || !comp.action);
919
+ };
917
920
  const isShowSubmitButton = !this.options.noDefaultSubmitButton
918
- && (!form.components.length || !form.components.find(comp => comp.key === 'submit'));
921
+ && (!form.components.length || !form.components.find(comp => isSubmitButton(comp)));
919
922
  // Ensure there is at least a submit button.
920
923
  if (isShowSubmitButton) {
921
924
  form.components.push({
package/lib/cjs/Wizard.js CHANGED
@@ -715,7 +715,7 @@ class Wizard extends Webform_1.default {
715
715
  }
716
716
  else {
717
717
  this.currentPage.components.forEach((comp) => comp.setPristine(false));
718
- this.scrollIntoView(this.element);
718
+ this.scrollIntoView(this.element, true);
719
719
  return Promise.reject(this.showErrors(errors, true));
720
720
  }
721
721
  }
@@ -1075,7 +1075,7 @@ declare class Component extends Element {
1075
1075
  */
1076
1076
  elementInfo(): any;
1077
1077
  autofocus(): void;
1078
- scrollIntoView(element?: any): void;
1078
+ scrollIntoView(element: any, verticalOnly: any): void;
1079
1079
  focus(index: any): void;
1080
1080
  /**
1081
1081
  * Get `Formio` instance for working with files
@@ -3453,12 +3453,12 @@ class Component extends Element_1.default {
3453
3453
  this.on('render', () => this.focus(), true);
3454
3454
  }
3455
3455
  }
3456
- scrollIntoView(element = this.element) {
3456
+ scrollIntoView(element = this.element, verticalOnly) {
3457
3457
  if (!element) {
3458
3458
  return;
3459
3459
  }
3460
3460
  const { left, top } = element.getBoundingClientRect();
3461
- window.scrollTo(left + window.scrollX, top + window.scrollY);
3461
+ window.scrollTo(verticalOnly ? window.scrollX : left + window.scrollX, top + window.scrollY);
3462
3462
  }
3463
3463
  focus(index) {
3464
3464
  var _a, _b, _c;
@@ -898,8 +898,11 @@ export default class WebformBuilder extends Component {
898
898
  keyboardActionsEnabled = keyboardActionsEnabled === 'true';
899
899
  }
900
900
  this.keyboardActionsEnabled = keyboardActionsEnabled;
901
+ const isSubmitButton = (comp) => {
902
+ return (comp.type === 'button') && ((comp.action === 'submit') || !comp.action);
903
+ };
901
904
  const isShowSubmitButton = !this.options.noDefaultSubmitButton
902
- && (!form.components.length || !form.components.find(comp => comp.key === 'submit'));
905
+ && (!form.components.length || !form.components.find(comp => isSubmitButton(comp)));
903
906
  // Ensure there is at least a submit button.
904
907
  if (isShowSubmitButton) {
905
908
  form.components.push({
package/lib/mjs/Wizard.js CHANGED
@@ -705,7 +705,7 @@ export default class Wizard extends Webform {
705
705
  }
706
706
  else {
707
707
  this.currentPage.components.forEach((comp) => comp.setPristine(false));
708
- this.scrollIntoView(this.element);
708
+ this.scrollIntoView(this.element, true);
709
709
  return Promise.reject(this.showErrors(errors, true));
710
710
  }
711
711
  }
@@ -1075,7 +1075,7 @@ declare class Component extends Element {
1075
1075
  */
1076
1076
  elementInfo(): any;
1077
1077
  autofocus(): void;
1078
- scrollIntoView(element?: any): void;
1078
+ scrollIntoView(element: any, verticalOnly: any): void;
1079
1079
  focus(index: any): void;
1080
1080
  /**
1081
1081
  * Get `Formio` instance for working with files
@@ -3415,12 +3415,12 @@ export default class Component extends Element {
3415
3415
  this.on('render', () => this.focus(), true);
3416
3416
  }
3417
3417
  }
3418
- scrollIntoView(element = this.element) {
3418
+ scrollIntoView(element = this.element, verticalOnly) {
3419
3419
  if (!element) {
3420
3420
  return;
3421
3421
  }
3422
3422
  const { left, top } = element.getBoundingClientRect();
3423
- window.scrollTo(left + window.scrollX, top + window.scrollY);
3423
+ window.scrollTo(verticalOnly ? window.scrollX : left + window.scrollX, top + window.scrollY);
3424
3424
  }
3425
3425
  focus(index) {
3426
3426
  if ('beforeFocus' in this.parent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5813.afa74f0",
3
+ "version": "5.0.0-dev.5818.039b965",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {