@formio/js 5.0.0-dev.5804.10012e4 → 5.0.0-dev.5809.36e6e3c

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
@@ -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
@@ -3456,12 +3456,12 @@ class Component extends Element_1.default {
3456
3456
  this.on('render', () => this.focus(), true);
3457
3457
  }
3458
3458
  }
3459
- scrollIntoView(element = this.element) {
3459
+ scrollIntoView(element = this.element, verticalOnly) {
3460
3460
  if (!element) {
3461
3461
  return;
3462
3462
  }
3463
3463
  const { left, top } = element.getBoundingClientRect();
3464
- window.scrollTo(left + window.scrollX, top + window.scrollY);
3464
+ window.scrollTo(verticalOnly ? window.scrollX : left + window.scrollX, top + window.scrollY);
3465
3465
  }
3466
3466
  focus(index) {
3467
3467
  var _a, _b, _c;
@@ -1500,11 +1500,7 @@ class SelectComponent extends ListComponent_1.default {
1500
1500
  data = data.toString();
1501
1501
  }
1502
1502
  if (Array.isArray(data) && data.some(item => this.isBooleanOrNumber(item))) {
1503
- data = data.map(item => {
1504
- if (this.isBooleanOrNumber(item)) {
1505
- item = item.toString();
1506
- }
1507
- });
1503
+ data = data.map(item => this.isBooleanOrNumber(item) ? item.toString() : item);
1508
1504
  }
1509
1505
  return data;
1510
1506
  };
@@ -7,10 +7,13 @@ declare namespace _default {
7
7
  export let multiple: boolean;
8
8
  export let dataSrc: string;
9
9
  export namespace data {
10
- let values: {
10
+ let values: ({
11
11
  label: string;
12
12
  value: string;
13
- }[];
13
+ } | {
14
+ label: string;
15
+ value: number[];
16
+ })[];
14
17
  let resource: string;
15
18
  let json: string;
16
19
  let url: string;
@@ -21,6 +21,10 @@ exports.default = {
21
21
  }, {
22
22
  'label': 'test',
23
23
  'value': 'test'
24
+ },
25
+ {
26
+ 'label': '1',
27
+ 'value': [1, 2, 3]
24
28
  }],
25
29
  'resource': '',
26
30
  'json': '',
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
@@ -3418,12 +3418,12 @@ export default class Component extends Element {
3418
3418
  this.on('render', () => this.focus(), true);
3419
3419
  }
3420
3420
  }
3421
- scrollIntoView(element = this.element) {
3421
+ scrollIntoView(element = this.element, verticalOnly) {
3422
3422
  if (!element) {
3423
3423
  return;
3424
3424
  }
3425
3425
  const { left, top } = element.getBoundingClientRect();
3426
- window.scrollTo(left + window.scrollX, top + window.scrollY);
3426
+ window.scrollTo(verticalOnly ? window.scrollX : left + window.scrollX, top + window.scrollY);
3427
3427
  }
3428
3428
  focus(index) {
3429
3429
  if ('beforeFocus' in this.parent) {
@@ -1527,11 +1527,7 @@ export default class SelectComponent extends ListComponent {
1527
1527
  data = data.toString();
1528
1528
  }
1529
1529
  if (Array.isArray(data) && data.some(item => this.isBooleanOrNumber(item))) {
1530
- data = data.map(item => {
1531
- if (this.isBooleanOrNumber(item)) {
1532
- item = item.toString();
1533
- }
1534
- });
1530
+ data = data.map(item => this.isBooleanOrNumber(item) ? item.toString() : item);
1535
1531
  }
1536
1532
  return data;
1537
1533
  };
@@ -7,10 +7,13 @@ declare namespace _default {
7
7
  export let multiple: boolean;
8
8
  export let dataSrc: string;
9
9
  export namespace data {
10
- let values: {
10
+ let values: ({
11
11
  label: string;
12
12
  value: string;
13
- }[];
13
+ } | {
14
+ label: string;
15
+ value: number[];
16
+ })[];
14
17
  let resource: string;
15
18
  let json: string;
16
19
  let url: string;
@@ -19,6 +19,10 @@ export default {
19
19
  }, {
20
20
  'label': 'test',
21
21
  'value': 'test'
22
+ },
23
+ {
24
+ 'label': '1',
25
+ 'value': [1, 2, 3]
22
26
  }],
23
27
  'resource': '',
24
28
  'json': '',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5804.10012e4",
3
+ "version": "5.0.0-dev.5809.36e6e3c",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {