@formio/js 5.0.0-rc.80 → 5.0.0-rc.81
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/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +7 -7
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.js +8 -8
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +2 -2
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +2 -2
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/components/_classes/component/Component.js +1 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +3 -0
- package/lib/cjs/components/editgrid/fixtures/comp18.d.ts +38 -0
- package/lib/cjs/components/editgrid/fixtures/comp18.js +74 -0
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +8 -7
- package/lib/cjs/components/editgrid/fixtures/index.js +7 -1
- package/lib/cjs/components/select/Select.js +3 -6
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +36 -2
- package/lib/cjs/components/select/editForm/Select.edit.data.js +29 -10
- package/lib/cjs/components/select/fixtures/comp4.d.ts +5 -2
- package/lib/cjs/components/select/fixtures/comp4.js +4 -0
- package/lib/mjs/components/_classes/component/Component.js +1 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +3 -0
- package/lib/mjs/components/editgrid/fixtures/comp18.d.ts +38 -0
- package/lib/mjs/components/editgrid/fixtures/comp18.js +72 -0
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +8 -7
- package/lib/mjs/components/editgrid/fixtures/index.js +4 -1
- package/lib/mjs/components/select/Select.js +3 -6
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +36 -2
- package/lib/mjs/components/select/editForm/Select.edit.data.js +27 -8
- package/lib/mjs/components/select/fixtures/comp4.d.ts +5 -2
- package/lib/mjs/components/select/fixtures/comp4.js +4 -0
- package/package.json +2 -2
@@ -27,16 +27,20 @@ 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
|
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
|
+
}
|
31
36
|
// nothing can set if don't have downloaded resources
|
32
37
|
if (!selectDataComponent || !instance.getValue() || !instance.downloadedResources?.length) {
|
33
38
|
return;
|
34
39
|
}
|
35
|
-
// if valueProperty is not provided, we have entire object
|
36
40
|
const shouldCalculateUrlData = data.dataSrc === 'url' && data.data.url && data.valueProperty;
|
37
41
|
const shouldCalculateResourceData = data.dataSrc === 'resource' && data.data.resource && data.valueProperty;
|
38
|
-
const newValue = shouldCalculateUrlData || shouldCalculateResourceData ? calculateSelectData(context) :
|
39
|
-
selectDataComponent.setValue(newValue);
|
42
|
+
const newValue = shouldCalculateUrlData || shouldCalculateResourceData ? calculateSelectData(context) : null;
|
43
|
+
selectDataComponent.setValue(newValue, { resetValue: newValue === null });
|
40
44
|
}, 0);
|
41
45
|
};
|
42
46
|
export default [
|
@@ -678,10 +682,25 @@ export default [
|
|
678
682
|
{
|
679
683
|
key: 'selectData',
|
680
684
|
conditional: {
|
681
|
-
json: {
|
682
|
-
|
683
|
-
{
|
684
|
-
|
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
|
+
},
|
685
704
|
},
|
686
705
|
},
|
687
706
|
{
|
@@ -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;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@formio/js",
|
3
|
-
"version": "5.0.0-rc.
|
3
|
+
"version": "5.0.0-rc.81",
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
5
5
|
"main": "lib/cjs/index.js",
|
6
6
|
"exports": {
|
@@ -81,7 +81,7 @@
|
|
81
81
|
"dependencies": {
|
82
82
|
"@formio/bootstrap": "3.0.0-rc.37",
|
83
83
|
"@formio/choices.js": "^10.2.1",
|
84
|
-
"@formio/core": "2.
|
84
|
+
"@formio/core": "2.3.0-rc.3",
|
85
85
|
"@formio/text-mask-addons": "^3.8.0-formio.2",
|
86
86
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
87
87
|
"abortcontroller-polyfill": "^1.7.5",
|