@formio/js 5.0.0-dev.5807.065a0ba → 5.0.0-dev.5810.b51094a

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.
@@ -37,6 +37,9 @@ class Multivalue extends Field_1.default {
37
37
  if (this.component.storeas === 'string') {
38
38
  return super.normalizeValue(value.join(this.delimiter || ''), flags);
39
39
  }
40
+ if (this.component.type === 'hidden' && value.length > 1) {
41
+ return super.normalizeValue(value, flags);
42
+ }
40
43
  return super.normalizeValue(value[0] || emptyValue, flags);
41
44
  }
42
45
  else {
@@ -1102,47 +1102,13 @@ declare const _default: ({
1102
1102
  conditional: {
1103
1103
  json: {
1104
1104
  and: ({
1105
- var: string;
1106
- '==='?: undefined;
1107
- '!=='?: undefined;
1108
- or?: undefined;
1109
- } | {
1110
- '===': (boolean | {
1105
+ '!==': ({
1111
1106
  var: string;
1112
- })[];
1113
- var?: undefined;
1114
- '!=='?: undefined;
1115
- or?: undefined;
1107
+ } | null)[];
1116
1108
  } | {
1117
1109
  '!==': (string | {
1118
1110
  var: string;
1119
1111
  })[];
1120
- var?: undefined;
1121
- '==='?: undefined;
1122
- or?: undefined;
1123
- } | {
1124
- or: ({
1125
- '===': (string | {
1126
- var: string;
1127
- })[];
1128
- and?: undefined;
1129
- } | {
1130
- and: ({
1131
- '===': (string | {
1132
- var: string;
1133
- })[];
1134
- '!=='?: undefined;
1135
- } | {
1136
- '!==': (string | {
1137
- var: string;
1138
- })[];
1139
- '==='?: undefined;
1140
- })[];
1141
- '==='?: undefined;
1142
- })[];
1143
- var?: undefined;
1144
- '==='?: undefined;
1145
- '!=='?: undefined;
1146
1112
  })[];
1147
1113
  '==='?: undefined;
1148
1114
  in?: undefined;
@@ -31,22 +31,18 @@ const calculateSelectData = (context) => {
31
31
  const setSelectData = (context) => {
32
32
  // Wait before downloadedResources will be set
33
33
  setTimeout(() => {
34
- var _a, _b;
34
+ var _a;
35
35
  const { instance, data } = context;
36
- const selectDataComponent = (_a = instance === null || instance === void 0 ? void 0 : instance.root) === null || _a === void 0 ? void 0 : _a.getComponent('selectData');
37
- // clear selectData if conditions are not met or clearing default value
38
- if (selectDataComponent && (!selectDataComponent.visible || !data.defaultValue)) {
39
- selectDataComponent.setValue(null, { resetValue: true });
40
- return;
41
- }
36
+ const selectDataComponent = instance === null || instance === void 0 ? void 0 : instance.root.getComponent('selectData');
42
37
  // nothing can set if don't have downloaded resources
43
- if (!selectDataComponent || !instance.getValue() || !((_b = instance.downloadedResources) === null || _b === void 0 ? void 0 : _b.length)) {
38
+ if (!selectDataComponent || !instance.getValue() || !((_a = instance.downloadedResources) === null || _a === void 0 ? void 0 : _a.length)) {
44
39
  return;
45
40
  }
41
+ // if valueProperty is not provided, we have entire object
46
42
  const shouldCalculateUrlData = data.dataSrc === 'url' && data.data.url && data.valueProperty;
47
43
  const shouldCalculateResourceData = data.dataSrc === 'resource' && data.data.resource && data.valueProperty;
48
- const newValue = shouldCalculateUrlData || shouldCalculateResourceData ? calculateSelectData(context) : null;
49
- selectDataComponent.setValue(newValue, { resetValue: newValue === null });
44
+ const newValue = shouldCalculateUrlData || shouldCalculateResourceData ? calculateSelectData(context) : undefined;
45
+ selectDataComponent.setValue(newValue);
50
46
  }, 0);
51
47
  };
52
48
  exports.default = [
@@ -688,25 +684,10 @@ exports.default = [
688
684
  {
689
685
  key: 'selectData',
690
686
  conditional: {
691
- json: {
692
- and: [
693
- { var: 'data.valueProperty' },
694
- { '===': [{ var: 'data.lazyLoad' }, true] },
695
- { '!==': [{ var: 'data.widget' }, 'html5'] },
696
- {
697
- or: [
698
- { '===': [{ var: 'data.dataSrc' }, 'url'] },
699
- {
700
- and: [
701
- { '===': [{ var: 'data.dataSrc' }, 'resource'] },
702
- // 'data' means entire object from resource will be used
703
- { '!==': [{ var: 'data.valueProperty' }, 'data'] },
704
- ],
705
- }
706
- ]
707
- }
708
- ]
709
- },
687
+ json: { 'and': [
688
+ { '!==': [{ var: 'data.valueProperty' }, null] },
689
+ { '!==': [{ var: 'data.valueProperty' }, ''] },
690
+ ] },
710
691
  },
711
692
  },
712
693
  {
@@ -32,6 +32,9 @@ export default class Multivalue extends Field {
32
32
  if (this.component.storeas === 'string') {
33
33
  return super.normalizeValue(value.join(this.delimiter || ''), flags);
34
34
  }
35
+ if (this.component.type === 'hidden' && value.length > 1) {
36
+ return super.normalizeValue(value, flags);
37
+ }
35
38
  return super.normalizeValue(value[0] || emptyValue, flags);
36
39
  }
37
40
  else {
@@ -1102,47 +1102,13 @@ declare const _default: ({
1102
1102
  conditional: {
1103
1103
  json: {
1104
1104
  and: ({
1105
- var: string;
1106
- '==='?: undefined;
1107
- '!=='?: undefined;
1108
- or?: undefined;
1109
- } | {
1110
- '===': (boolean | {
1105
+ '!==': ({
1111
1106
  var: string;
1112
- })[];
1113
- var?: undefined;
1114
- '!=='?: undefined;
1115
- or?: undefined;
1107
+ } | null)[];
1116
1108
  } | {
1117
1109
  '!==': (string | {
1118
1110
  var: string;
1119
1111
  })[];
1120
- var?: undefined;
1121
- '==='?: undefined;
1122
- or?: undefined;
1123
- } | {
1124
- or: ({
1125
- '===': (string | {
1126
- var: string;
1127
- })[];
1128
- and?: undefined;
1129
- } | {
1130
- and: ({
1131
- '===': (string | {
1132
- var: string;
1133
- })[];
1134
- '!=='?: undefined;
1135
- } | {
1136
- '!==': (string | {
1137
- var: string;
1138
- })[];
1139
- '==='?: undefined;
1140
- })[];
1141
- '==='?: undefined;
1142
- })[];
1143
- var?: undefined;
1144
- '==='?: undefined;
1145
- '!=='?: undefined;
1146
1112
  })[];
1147
1113
  '==='?: undefined;
1148
1114
  in?: undefined;
@@ -27,20 +27,16 @@ const setSelectData = (context) => {
27
27
  // Wait before downloadedResources will be set
28
28
  setTimeout(() => {
29
29
  const { instance, data } = context;
30
- const selectDataComponent = instance?.root?.getComponent('selectData');
31
- // clear selectData if conditions are not met or clearing default value
32
- if (selectDataComponent && (!selectDataComponent.visible || !data.defaultValue)) {
33
- selectDataComponent.setValue(null, { resetValue: true });
34
- return;
35
- }
30
+ const selectDataComponent = instance?.root.getComponent('selectData');
36
31
  // nothing can set if don't have downloaded resources
37
32
  if (!selectDataComponent || !instance.getValue() || !instance.downloadedResources?.length) {
38
33
  return;
39
34
  }
35
+ // if valueProperty is not provided, we have entire object
40
36
  const shouldCalculateUrlData = data.dataSrc === 'url' && data.data.url && data.valueProperty;
41
37
  const shouldCalculateResourceData = data.dataSrc === 'resource' && data.data.resource && data.valueProperty;
42
- const newValue = shouldCalculateUrlData || shouldCalculateResourceData ? calculateSelectData(context) : null;
43
- selectDataComponent.setValue(newValue, { resetValue: newValue === null });
38
+ const newValue = shouldCalculateUrlData || shouldCalculateResourceData ? calculateSelectData(context) : undefined;
39
+ selectDataComponent.setValue(newValue);
44
40
  }, 0);
45
41
  };
46
42
  export default [
@@ -682,25 +678,10 @@ export default [
682
678
  {
683
679
  key: 'selectData',
684
680
  conditional: {
685
- json: {
686
- and: [
687
- { var: 'data.valueProperty' },
688
- { '===': [{ var: 'data.lazyLoad' }, true] },
689
- { '!==': [{ var: 'data.widget' }, 'html5'] },
690
- {
691
- or: [
692
- { '===': [{ var: 'data.dataSrc' }, 'url'] },
693
- {
694
- and: [
695
- { '===': [{ var: 'data.dataSrc' }, 'resource'] },
696
- // 'data' means entire object from resource will be used
697
- { '!==': [{ var: 'data.valueProperty' }, 'data'] },
698
- ],
699
- }
700
- ]
701
- }
702
- ]
703
- },
681
+ json: { 'and': [
682
+ { '!==': [{ var: 'data.valueProperty' }, null] },
683
+ { '!==': [{ var: 'data.valueProperty' }, ''] },
684
+ ] },
704
685
  },
705
686
  },
706
687
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/js",
3
- "version": "5.0.0-dev.5807.065a0ba",
3
+ "version": "5.0.0-dev.5810.b51094a",
4
4
  "description": "JavaScript powered Forms with JSON Form Builder",
5
5
  "main": "lib/cjs/index.js",
6
6
  "exports": {