@formio/js 5.0.0-rc.82 → 5.0.0-rc.83

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@
10
10
  * MIT licensed
11
11
  */
12
12
 
13
- /*! formiojs v5.0.0-rc.82 | https://unpkg.com/formiojs@5.0.0-rc.82/LICENSE.txt */
13
+ /*! formiojs v5.0.0-rc.83 | https://unpkg.com/formiojs@5.0.0-rc.83/LICENSE.txt */
14
14
 
15
15
  /**
16
16
  * @license
@@ -20,7 +20,7 @@
20
20
 
21
21
  /*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
22
22
 
23
- /*! formiojs v5.0.0-rc.82 | https://unpkg.com/formiojs@5.0.0-rc.82/LICENSE.txt */
23
+ /*! formiojs v5.0.0-rc.83 | https://unpkg.com/formiojs@5.0.0-rc.83/LICENSE.txt */
24
24
 
25
25
  /**
26
26
  * @license
@@ -913,8 +913,11 @@ class WebformBuilder extends Component_1.default {
913
913
  keyboardActionsEnabled = keyboardActionsEnabled === 'true';
914
914
  }
915
915
  this.keyboardActionsEnabled = keyboardActionsEnabled;
916
+ const isSubmitButton = (comp) => {
917
+ return (comp.type === 'button') && ((comp.action === 'submit') || !comp.action);
918
+ };
916
919
  const isShowSubmitButton = !this.options.noDefaultSubmitButton
917
- && (!form.components.length || !form.components.find(comp => comp.key === 'submit'));
920
+ && (!form.components.length || !form.components.find(comp => isSubmitButton(comp)));
918
921
  // Ensure there is at least a submit button.
919
922
  if (isShowSubmitButton) {
920
923
  form.components.push({
@@ -2618,9 +2618,6 @@ class Component extends Element_1.default {
2618
2618
  * @returns {*} - The normalized value.
2619
2619
  */
2620
2620
  normalizeValue(value) {
2621
- if (this.component.multiple && !Array.isArray(value)) {
2622
- value = value ? [value] : [];
2623
- }
2624
2621
  return value;
2625
2622
  }
2626
2623
  /**
@@ -34,12 +34,12 @@ class Multivalue extends Field_1.default {
34
34
  }
35
35
  else {
36
36
  if (Array.isArray(value) && !underlyingValueShouldBeArray) {
37
+ if (core_1.Utils.getModelType(this.component) === 'any') {
38
+ return super.normalizeValue(value, flags);
39
+ }
37
40
  if (this.component.storeas === 'string') {
38
41
  return super.normalizeValue(value.join(this.delimiter || ''), flags);
39
42
  }
40
- if (this.component.type === 'hidden' && value.length > 1) {
41
- return super.normalizeValue(value, flags);
42
- }
43
43
  return super.normalizeValue(value[0] || emptyValue, flags);
44
44
  }
45
45
  else {
@@ -420,7 +420,9 @@ class DayComponent extends Field_1.default {
420
420
  DAY = null;
421
421
  }
422
422
  if (!this.showMonth) {
423
- DAY = DAY === 0 ? 0 : DAY - 1;
423
+ if (!lodash_1.default.isNull(DAY)) {
424
+ DAY = DAY === 0 ? 0 : DAY - 1;
425
+ }
424
426
  YEAR = YEAR - 1;
425
427
  MONTH = null;
426
428
  }
@@ -897,8 +897,11 @@ export default class WebformBuilder extends Component {
897
897
  keyboardActionsEnabled = keyboardActionsEnabled === 'true';
898
898
  }
899
899
  this.keyboardActionsEnabled = keyboardActionsEnabled;
900
+ const isSubmitButton = (comp) => {
901
+ return (comp.type === 'button') && ((comp.action === 'submit') || !comp.action);
902
+ };
900
903
  const isShowSubmitButton = !this.options.noDefaultSubmitButton
901
- && (!form.components.length || !form.components.find(comp => comp.key === 'submit'));
904
+ && (!form.components.length || !form.components.find(comp => isSubmitButton(comp)));
902
905
  // Ensure there is at least a submit button.
903
906
  if (isShowSubmitButton) {
904
907
  form.components.push({
@@ -2587,9 +2587,6 @@ export default class Component extends Element {
2587
2587
  * @returns {*} - The normalized value.
2588
2588
  */
2589
2589
  normalizeValue(value) {
2590
- if (this.component.multiple && !Array.isArray(value)) {
2591
- value = value ? [value] : [];
2592
- }
2593
2590
  return value;
2594
2591
  }
2595
2592
  /**
@@ -29,12 +29,12 @@ export default class Multivalue extends Field {
29
29
  }
30
30
  else {
31
31
  if (Array.isArray(value) && !underlyingValueShouldBeArray) {
32
+ if (Utils.getModelType(this.component) === 'any') {
33
+ return super.normalizeValue(value, flags);
34
+ }
32
35
  if (this.component.storeas === 'string') {
33
36
  return super.normalizeValue(value.join(this.delimiter || ''), flags);
34
37
  }
35
- if (this.component.type === 'hidden' && value.length > 1) {
36
- return super.normalizeValue(value, flags);
37
- }
38
38
  return super.normalizeValue(value[0] || emptyValue, flags);
39
39
  }
40
40
  else {
@@ -418,7 +418,9 @@ export default class DayComponent extends Field {
418
418
  DAY = null;
419
419
  }
420
420
  if (!this.showMonth) {
421
- DAY = DAY === 0 ? 0 : DAY - 1;
421
+ if (!_.isNull(DAY)) {
422
+ DAY = DAY === 0 ? 0 : DAY - 1;
423
+ }
422
424
  YEAR = YEAR - 1;
423
425
  MONTH = null;
424
426
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-rc.82",
3
+ "version": "5.0.0-rc.83",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {