@formio/js 5.0.0-dev.5807.065a0ba → 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/dist/formio.form.js +2 -2
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.full.js +3 -3
- package/dist/formio.full.min.js +1 -1
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/components/_classes/component/Component.d.ts +1 -1
- package/lib/cjs/components/_classes/component/Component.js +2 -2
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +2 -36
- package/lib/cjs/components/select/editForm/Select.edit.data.js +10 -29
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/components/_classes/component/Component.d.ts +1 -1
- package/lib/mjs/components/_classes/component/Component.js +2 -2
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +2 -36
- package/lib/mjs/components/select/editForm/Select.edit.data.js +8 -27
- package/package.json +1 -1
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
|
|
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;
|
|
@@ -1102,47 +1102,13 @@ declare const _default: ({
|
|
|
1102
1102
|
conditional: {
|
|
1103
1103
|
json: {
|
|
1104
1104
|
and: ({
|
|
1105
|
-
|
|
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
|
|
34
|
+
var _a;
|
|
35
35
|
const { instance, data } = context;
|
|
36
|
-
const selectDataComponent =
|
|
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() || !((
|
|
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) :
|
|
49
|
-
selectDataComponent.setValue(newValue
|
|
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
|
-
|
|
693
|
-
{ var: 'data.valueProperty' },
|
|
694
|
-
|
|
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
|
{
|
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
|
|
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) {
|
|
@@ -1102,47 +1102,13 @@ declare const _default: ({
|
|
|
1102
1102
|
conditional: {
|
|
1103
1103
|
json: {
|
|
1104
1104
|
and: ({
|
|
1105
|
-
|
|
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
|
|
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) :
|
|
43
|
-
selectDataComponent.setValue(newValue
|
|
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
|
-
|
|
687
|
-
{ var: 'data.valueProperty' },
|
|
688
|
-
|
|
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
|
{
|