@formio/js 5.4.0 → 5.4.2
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/README.md +11 -5
- package/dist/formio.builder.css +12 -5
- package/dist/formio.builder.min.css +1 -1
- 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.css +12 -5
- package/dist/formio.form.js +2883 -2867
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -2
- package/dist/formio.full.css +12 -5
- package/dist/formio.full.js +3507 -3491
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -2
- package/dist/formio.js +1139 -1145
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -2
- package/dist/formio.utils.js +1066 -1072
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Embed.js +8 -16
- package/lib/cjs/Form.js +4 -4
- package/lib/cjs/Formio.js +2 -9
- package/lib/cjs/InlineEmbed.js +1 -4
- package/lib/cjs/PDF.js +28 -8
- package/lib/cjs/PDFBuilder.js +6 -10
- package/lib/cjs/Webform.d.ts +1 -0
- package/lib/cjs/Webform.js +19 -34
- package/lib/cjs/WebformBuilder.js +27 -68
- package/lib/cjs/Wizard.d.ts +1 -0
- package/lib/cjs/Wizard.js +44 -31
- package/lib/cjs/WizardBuilder.js +5 -15
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +2 -6
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -9
- package/lib/cjs/addons/index.js +1 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +10 -5
- package/lib/cjs/components/_classes/component/Component.js +76 -134
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -4
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +4 -16
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +1 -4
- package/lib/cjs/components/_classes/field/Field.js +1 -4
- package/lib/cjs/components/_classes/input/Input.js +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/cjs/components/_classes/list/editForm/ListComponent.edit.data.js +6 -28
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +8 -26
- package/lib/cjs/components/_classes/nested/NestedComponent.js +1 -4
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +5 -9
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +1 -3
- package/lib/cjs/components/address/Address.js +10 -30
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +8 -32
- package/lib/cjs/components/alert/Alert.js +3 -6
- package/lib/cjs/components/button/Button.d.ts +1 -0
- package/lib/cjs/components/button/Button.js +31 -17
- package/lib/cjs/components/button/editForm/Button.edit.display.js +8 -32
- package/lib/cjs/components/checkbox/Checkbox.js +4 -10
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +2 -8
- package/lib/cjs/components/columns/Columns.js +5 -17
- package/lib/cjs/components/container/Container.js +1 -3
- package/lib/cjs/components/currency/Currency.js +2 -7
- package/lib/cjs/components/datagrid/DataGrid.js +27 -68
- package/lib/cjs/components/datamap/DataMap.js +4 -16
- package/lib/cjs/components/datetime/DateTime.js +2 -6
- package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +1 -4
- package/lib/cjs/components/day/Day.js +12 -70
- package/lib/cjs/components/day/editForm/Day.edit.day.js +1 -3
- package/lib/cjs/components/day/editForm/Day.edit.month.js +1 -3
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -0
- package/lib/cjs/components/editgrid/EditGrid.js +18 -44
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -4
- package/lib/cjs/components/file/File.js +40 -70
- package/lib/cjs/components/file/editForm/File.edit.display.js +1 -5
- package/lib/cjs/components/file/editForm/File.edit.file.js +8 -30
- package/lib/cjs/components/form/Form.js +5 -7
- package/lib/cjs/components/html/HTML.js +1 -5
- package/lib/cjs/components/number/Number.js +2 -4
- package/lib/cjs/components/panel/editForm/Panel.edit.display.js +3 -12
- package/lib/cjs/components/password/Password.js +1 -4
- package/lib/cjs/components/radio/Radio.js +7 -17
- package/lib/cjs/components/radio/editForm/Radio.edit.data.js +4 -14
- package/lib/cjs/components/recaptcha/ReCaptcha.js +3 -6
- package/lib/cjs/components/select/Select.js +49 -94
- package/lib/cjs/components/select/editForm/Select.edit.data.js +37 -182
- package/lib/cjs/components/select/editForm/Select.edit.validation.js +1 -9
- package/lib/cjs/components/selectboxes/SelectBoxes.js +3 -6
- package/lib/cjs/components/signature/Signature.d.ts +1 -1
- package/lib/cjs/components/signature/Signature.js +5 -10
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +2 -6
- package/lib/cjs/components/survey/Survey.js +6 -17
- package/lib/cjs/components/survey/editForm/Survey.edit.data.js +4 -12
- package/lib/cjs/components/table/editForm/Table.edit.display.js +3 -3
- package/lib/cjs/components/tabs/Tabs.js +4 -19
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +1 -3
- package/lib/cjs/components/tags/Tags.js +4 -14
- package/lib/cjs/components/textarea/TextArea.js +8 -15
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +14 -56
- package/lib/cjs/components/textfield/TextField.js +4 -4
- package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +2 -8
- package/lib/cjs/components/time/Time.js +1 -4
- package/lib/cjs/components/time/editForm/Time.edit.display.js +1 -4
- package/lib/cjs/formio.form.js +5 -5
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/providers/address/AddressProvider.js +1 -1
- package/lib/cjs/providers/address/GoogleAddressProvider.js +2 -4
- package/lib/cjs/providers/processor/fileProcessor.js +1 -3
- package/lib/cjs/providers/storage/azure.js +5 -6
- package/lib/cjs/providers/storage/indexeddb.js +5 -15
- package/lib/cjs/providers/storage/s3.js +3 -14
- package/lib/cjs/providers/storage/xhr.js +19 -28
- package/lib/cjs/templates/Templates.js +1 -0
- package/lib/cjs/translations/en.d.ts +237 -81
- package/lib/cjs/translations/en.js +10 -81
- package/lib/cjs/utils/ChoicesWrapper.js +1 -1
- package/lib/cjs/utils/builder.js +5 -26
- package/lib/cjs/utils/i18n.d.ts +5 -2
- package/lib/cjs/utils/i18n.js +33 -12
- package/lib/cjs/utils/utils.js +42 -52
- package/lib/cjs/widgets/CalendarWidget.js +2 -6
- package/lib/mjs/Embed.js +8 -16
- package/lib/mjs/Form.js +4 -4
- package/lib/mjs/Formio.js +2 -9
- package/lib/mjs/InlineEmbed.js +1 -4
- package/lib/mjs/PDF.js +27 -8
- package/lib/mjs/PDFBuilder.js +6 -10
- package/lib/mjs/Webform.d.ts +1 -0
- package/lib/mjs/Webform.js +19 -31
- package/lib/mjs/WebformBuilder.js +27 -68
- package/lib/mjs/Wizard.d.ts +1 -0
- package/lib/mjs/Wizard.js +39 -27
- package/lib/mjs/WizardBuilder.js +5 -15
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +2 -6
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -9
- package/lib/mjs/addons/index.js +1 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +10 -5
- package/lib/mjs/components/_classes/component/Component.js +75 -134
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -4
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +4 -16
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -4
- package/lib/mjs/components/_classes/field/Field.js +1 -4
- package/lib/mjs/components/_classes/input/Input.js +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +6 -28
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +8 -26
- package/lib/mjs/components/_classes/nested/NestedComponent.js +1 -4
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +5 -9
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +1 -3
- package/lib/mjs/components/address/Address.js +10 -30
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +8 -32
- package/lib/mjs/components/alert/Alert.js +3 -6
- package/lib/mjs/components/button/Button.d.ts +1 -0
- package/lib/mjs/components/button/Button.js +29 -16
- package/lib/mjs/components/button/editForm/Button.edit.display.js +8 -32
- package/lib/mjs/components/checkbox/Checkbox.js +4 -10
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +2 -8
- package/lib/mjs/components/columns/Columns.js +5 -17
- package/lib/mjs/components/container/Container.js +1 -3
- package/lib/mjs/components/currency/Currency.js +2 -7
- package/lib/mjs/components/datagrid/DataGrid.js +28 -69
- package/lib/mjs/components/datamap/DataMap.js +12 -18
- package/lib/mjs/components/datetime/DateTime.js +2 -6
- package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +1 -4
- package/lib/mjs/components/day/Day.js +12 -70
- package/lib/mjs/components/day/editForm/Day.edit.day.js +1 -3
- package/lib/mjs/components/day/editForm/Day.edit.month.js +1 -3
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -0
- package/lib/mjs/components/editgrid/EditGrid.js +18 -44
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -4
- package/lib/mjs/components/file/File.js +40 -70
- package/lib/mjs/components/file/editForm/File.edit.display.js +1 -5
- package/lib/mjs/components/file/editForm/File.edit.file.js +8 -30
- package/lib/mjs/components/form/Form.js +5 -7
- package/lib/mjs/components/html/HTML.js +1 -5
- package/lib/mjs/components/number/Number.js +2 -4
- package/lib/mjs/components/panel/editForm/Panel.edit.display.js +3 -12
- package/lib/mjs/components/password/Password.js +1 -4
- package/lib/mjs/components/radio/Radio.js +7 -17
- package/lib/mjs/components/radio/editForm/Radio.edit.data.js +4 -14
- package/lib/mjs/components/recaptcha/ReCaptcha.js +3 -6
- package/lib/mjs/components/select/Select.js +52 -97
- package/lib/mjs/components/select/editForm/Select.edit.data.js +37 -182
- package/lib/mjs/components/select/editForm/Select.edit.validation.js +1 -9
- package/lib/mjs/components/selectboxes/SelectBoxes.js +3 -6
- package/lib/mjs/components/signature/Signature.d.ts +1 -1
- package/lib/mjs/components/signature/Signature.js +5 -10
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +2 -6
- package/lib/mjs/components/survey/Survey.js +6 -17
- package/lib/mjs/components/survey/editForm/Survey.edit.data.js +4 -12
- package/lib/mjs/components/table/editForm/Table.edit.display.js +3 -3
- package/lib/mjs/components/tabs/Tabs.js +4 -19
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +1 -3
- package/lib/mjs/components/tags/Tags.js +4 -14
- package/lib/mjs/components/textarea/TextArea.js +8 -15
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +14 -56
- package/lib/mjs/components/textfield/TextField.js +4 -4
- package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +2 -8
- package/lib/mjs/components/time/Time.js +1 -4
- package/lib/mjs/components/time/editForm/Time.edit.display.js +1 -4
- package/lib/mjs/formio.form.js +6 -6
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/providers/address/AddressProvider.js +1 -1
- package/lib/mjs/providers/address/GoogleAddressProvider.js +2 -4
- package/lib/mjs/providers/processor/fileProcessor.js +1 -3
- package/lib/mjs/providers/storage/azure.js +5 -6
- package/lib/mjs/providers/storage/indexeddb.js +5 -15
- package/lib/mjs/providers/storage/s3.js +3 -14
- package/lib/mjs/providers/storage/xhr.js +19 -32
- package/lib/mjs/templates/Templates.js +1 -0
- package/lib/mjs/translations/en.d.ts +237 -81
- package/lib/mjs/translations/en.js +91 -1
- package/lib/mjs/utils/ChoicesWrapper.js +1 -1
- package/lib/mjs/utils/builder.js +5 -26
- package/lib/mjs/utils/i18n.d.ts +5 -2
- package/lib/mjs/utils/i18n.js +33 -12
- package/lib/mjs/utils/utils.js +42 -52
- package/lib/mjs/widgets/CalendarWidget.js +2 -6
- package/package.json +8 -6
|
@@ -19,10 +19,7 @@ export default [
|
|
|
19
19
|
tooltip: 'A URL that returns a JSON array to use as the data source.',
|
|
20
20
|
conditional: {
|
|
21
21
|
json: {
|
|
22
|
-
'===': [
|
|
23
|
-
{ var: 'data.dataSrc' },
|
|
24
|
-
'url',
|
|
25
|
-
],
|
|
22
|
+
'===': [{ var: 'data.dataSrc' }, 'url'],
|
|
26
23
|
},
|
|
27
24
|
},
|
|
28
25
|
},
|
|
@@ -49,10 +46,7 @@ export default [
|
|
|
49
46
|
],
|
|
50
47
|
conditional: {
|
|
51
48
|
json: {
|
|
52
|
-
'===': [
|
|
53
|
-
{ var: 'data.dataSrc' },
|
|
54
|
-
'url',
|
|
55
|
-
],
|
|
49
|
+
'===': [{ var: 'data.dataSrc' }, 'url'],
|
|
56
50
|
},
|
|
57
51
|
},
|
|
58
52
|
},
|
|
@@ -68,14 +62,7 @@ export default [
|
|
|
68
62
|
tooltip: 'The property of each item in the data source to use as the select value. If not specified, the item itself will be used.',
|
|
69
63
|
conditional: {
|
|
70
64
|
json: {
|
|
71
|
-
in: [
|
|
72
|
-
{ var: 'data.dataSrc' },
|
|
73
|
-
[
|
|
74
|
-
'json',
|
|
75
|
-
'url',
|
|
76
|
-
'custom',
|
|
77
|
-
],
|
|
78
|
-
],
|
|
65
|
+
in: [{ var: 'data.dataSrc' }, ['json', 'url', 'custom']],
|
|
79
66
|
},
|
|
80
67
|
},
|
|
81
68
|
},
|
|
@@ -108,10 +95,7 @@ export default [
|
|
|
108
95
|
tooltip: 'Check this if you would like to use Formio Authentication with the request.',
|
|
109
96
|
conditional: {
|
|
110
97
|
json: {
|
|
111
|
-
'===': [
|
|
112
|
-
{ var: 'data.dataSrc' },
|
|
113
|
-
'url',
|
|
114
|
-
],
|
|
98
|
+
'===': [{ var: 'data.dataSrc' }, 'url'],
|
|
115
99
|
},
|
|
116
100
|
},
|
|
117
101
|
},
|
|
@@ -126,16 +110,10 @@ export default [
|
|
|
126
110
|
json: {
|
|
127
111
|
or: [
|
|
128
112
|
{
|
|
129
|
-
'===': [
|
|
130
|
-
{ var: 'data.dataSrc' },
|
|
131
|
-
'url',
|
|
132
|
-
],
|
|
113
|
+
'===': [{ var: 'data.dataSrc' }, 'url'],
|
|
133
114
|
},
|
|
134
115
|
{
|
|
135
|
-
'===': [
|
|
136
|
-
{ var: 'data.dataSrc' },
|
|
137
|
-
'resource',
|
|
138
|
-
],
|
|
116
|
+
'===': [{ var: 'data.dataSrc' }, 'resource'],
|
|
139
117
|
},
|
|
140
118
|
],
|
|
141
119
|
},
|
|
@@ -17,26 +17,16 @@ export default class Multivalue extends Field {
|
|
|
17
17
|
if (Array.isArray(value)) {
|
|
18
18
|
if (underlyingValueShouldBeArray) {
|
|
19
19
|
if (value.length === 0 || !Array.isArray(value[0])) {
|
|
20
|
-
return [
|
|
21
|
-
value,
|
|
22
|
-
];
|
|
20
|
+
return [value];
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
if (value.length === 0) {
|
|
26
|
-
return [
|
|
27
|
-
emptyValue,
|
|
28
|
-
];
|
|
24
|
+
return [emptyValue];
|
|
29
25
|
}
|
|
30
26
|
return super.normalizeValue(value, flags);
|
|
31
27
|
}
|
|
32
28
|
else {
|
|
33
|
-
return super.normalizeValue(value == null
|
|
34
|
-
? [
|
|
35
|
-
emptyValue,
|
|
36
|
-
]
|
|
37
|
-
: [
|
|
38
|
-
value,
|
|
39
|
-
], flags);
|
|
29
|
+
return super.normalizeValue(value == null ? [emptyValue] : [value], flags);
|
|
40
30
|
}
|
|
41
31
|
}
|
|
42
32
|
else {
|
|
@@ -64,22 +54,16 @@ export default class Multivalue extends Field {
|
|
|
64
54
|
let value = super.defaultValue;
|
|
65
55
|
if (this.component.multiple) {
|
|
66
56
|
if (_.isArray(value)) {
|
|
67
|
-
value = !value.length
|
|
68
|
-
? [
|
|
69
|
-
super.emptyValue,
|
|
70
|
-
]
|
|
71
|
-
: value;
|
|
57
|
+
value = !value.length ? [super.emptyValue] : value;
|
|
72
58
|
}
|
|
73
59
|
else {
|
|
74
|
-
value = [
|
|
75
|
-
value,
|
|
76
|
-
];
|
|
60
|
+
value = [value];
|
|
77
61
|
}
|
|
78
62
|
}
|
|
79
63
|
return value;
|
|
80
64
|
}
|
|
81
65
|
get addAnother() {
|
|
82
|
-
return this.t(this.component.addAnother || '
|
|
66
|
+
return this.t(this.component.addAnother || 'addAnother');
|
|
83
67
|
}
|
|
84
68
|
/**
|
|
85
69
|
* @returns {Field} - The created field.
|
|
@@ -198,7 +182,7 @@ export default class Multivalue extends Field {
|
|
|
198
182
|
this.saveCaretPosition(element, index);
|
|
199
183
|
}
|
|
200
184
|
catch (err) {
|
|
201
|
-
console.warn('
|
|
185
|
+
console.warn(this.t('caretPositionSavingError'), err);
|
|
202
186
|
}
|
|
203
187
|
// If a mask is present, delay the update to allow mask to update first.
|
|
204
188
|
if (element.mask) {
|
|
@@ -300,9 +284,7 @@ export default class Multivalue extends Field {
|
|
|
300
284
|
}
|
|
301
285
|
let dataValue = this.dataValue || [];
|
|
302
286
|
if (!Array.isArray(dataValue)) {
|
|
303
|
-
dataValue = [
|
|
304
|
-
dataValue,
|
|
305
|
-
];
|
|
287
|
+
dataValue = [dataValue];
|
|
306
288
|
}
|
|
307
289
|
if (Array.isArray(value)) {
|
|
308
290
|
dataValue = dataValue.concat(value);
|
|
@@ -511,10 +511,7 @@ export default class NestedComponent extends Field {
|
|
|
511
511
|
}
|
|
512
512
|
});
|
|
513
513
|
}
|
|
514
|
-
return Promise.all([
|
|
515
|
-
superPromise,
|
|
516
|
-
childPromise,
|
|
517
|
-
]);
|
|
514
|
+
return Promise.all([superPromise, childPromise]);
|
|
518
515
|
}
|
|
519
516
|
/**
|
|
520
517
|
* Attach the logic to the components.
|
|
@@ -12,15 +12,13 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
|
12
12
|
}, ...extend);
|
|
13
13
|
}
|
|
14
14
|
static savedValueTypes() {
|
|
15
|
-
return [
|
|
16
|
-
componentValueTypes.array,
|
|
17
|
-
];
|
|
15
|
+
return [componentValueTypes.array];
|
|
18
16
|
}
|
|
19
17
|
componentContext(component) {
|
|
20
18
|
return this.iteratableRows[component.rowIndex].data;
|
|
21
19
|
}
|
|
22
20
|
get iteratableRows() {
|
|
23
|
-
throw new Error(
|
|
21
|
+
throw new Error(this.t('iteratableRowsError'));
|
|
24
22
|
}
|
|
25
23
|
get rowIndex() {
|
|
26
24
|
return this._rowIndex;
|
|
@@ -62,12 +60,10 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
|
62
60
|
}
|
|
63
61
|
validate(data, flags = {}) {
|
|
64
62
|
data = data || this.data;
|
|
65
|
-
return this.validateComponents([
|
|
66
|
-
this.component,
|
|
67
|
-
], data, flags);
|
|
63
|
+
return this.validateComponents([this.component], data, flags);
|
|
68
64
|
}
|
|
69
65
|
checkRow(...args) {
|
|
70
|
-
console.log('
|
|
66
|
+
console.log(this.t('checkRowDeprecation'));
|
|
71
67
|
return this.processRow.call(this, ...args);
|
|
72
68
|
}
|
|
73
69
|
processRow(method, data, opts, row, components, silentCheck) {
|
|
@@ -124,7 +120,7 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
|
124
120
|
`;
|
|
125
121
|
this.component.components?.forEach((component) => {
|
|
126
122
|
const label = component.label || component.key;
|
|
127
|
-
result += `<th style="padding: 5px 10px;">${label}</th>`;
|
|
123
|
+
result += `<th style="padding: 5px 10px;">${this.t(label, { _userInput: true })}</th>`;
|
|
128
124
|
});
|
|
129
125
|
result += `
|
|
130
126
|
</tr>
|
|
@@ -12,9 +12,7 @@ export default class NestedDataComponent extends NestedComponent {
|
|
|
12
12
|
return !_.isEqual(newValue, oldValue);
|
|
13
13
|
}
|
|
14
14
|
static savedValueTypes(schema) {
|
|
15
|
-
return
|
|
16
|
-
componentValueTypes.object,
|
|
17
|
-
]);
|
|
15
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.object];
|
|
18
16
|
}
|
|
19
17
|
get allowData() {
|
|
20
18
|
return true;
|
|
@@ -78,9 +78,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
78
78
|
}
|
|
79
79
|
static savedValueTypes(schema) {
|
|
80
80
|
schema = schema || {};
|
|
81
|
-
return
|
|
82
|
-
componentValueTypes.object,
|
|
83
|
-
]);
|
|
81
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.object];
|
|
84
82
|
}
|
|
85
83
|
static get builderInfo() {
|
|
86
84
|
return {
|
|
@@ -98,10 +96,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
98
96
|
static get conditionOperatorsSettings() {
|
|
99
97
|
return {
|
|
100
98
|
...super.conditionOperatorsSettings,
|
|
101
|
-
operators: [
|
|
102
|
-
'isEmpty',
|
|
103
|
-
'isNotEmpty',
|
|
104
|
-
],
|
|
99
|
+
operators: ['isEmpty', 'isNotEmpty'],
|
|
105
100
|
};
|
|
106
101
|
}
|
|
107
102
|
mergeSchema(component = {}) {
|
|
@@ -201,11 +196,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
201
196
|
}
|
|
202
197
|
get address() {
|
|
203
198
|
if (this.isMultiple) {
|
|
204
|
-
return _.isArray(this.dataValue)
|
|
205
|
-
? this.dataValue
|
|
206
|
-
: [
|
|
207
|
-
this.dataValue,
|
|
208
|
-
];
|
|
199
|
+
return _.isArray(this.dataValue) ? this.dataValue : [this.dataValue];
|
|
209
200
|
}
|
|
210
201
|
// Manual mode is not implementing for multiple value
|
|
211
202
|
return this.manualModeEnabled && this.dataValue ? this.dataValue.address : this.dataValue;
|
|
@@ -221,11 +212,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
221
212
|
get defaultValue() {
|
|
222
213
|
let defaultValue = super.defaultValue;
|
|
223
214
|
if (this.isMultiple) {
|
|
224
|
-
defaultValue = _.isArray(defaultValue)
|
|
225
|
-
? defaultValue
|
|
226
|
-
: [
|
|
227
|
-
defaultValue,
|
|
228
|
-
];
|
|
215
|
+
defaultValue = _.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
229
216
|
}
|
|
230
217
|
return defaultValue;
|
|
231
218
|
}
|
|
@@ -241,9 +228,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
241
228
|
get dataValue() {
|
|
242
229
|
const resultValue = _.get(this._data, this.path);
|
|
243
230
|
if (!_.isArray(resultValue) && this.component.multiple) {
|
|
244
|
-
return [
|
|
245
|
-
resultValue,
|
|
246
|
-
];
|
|
231
|
+
return [resultValue];
|
|
247
232
|
}
|
|
248
233
|
return super.dataValue;
|
|
249
234
|
}
|
|
@@ -341,7 +326,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
341
326
|
return !this.isMultiple && (this.builderMode || this.manualModeEnabled);
|
|
342
327
|
}
|
|
343
328
|
get addAnother() {
|
|
344
|
-
return this.t(this.component.addAnother || '
|
|
329
|
+
return this.t(this.component.addAnother || 'addAnother');
|
|
345
330
|
}
|
|
346
331
|
renderElement(value) {
|
|
347
332
|
return this.renderTemplate(this.templateName, {
|
|
@@ -383,9 +368,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
383
368
|
onSelectAddress(address, element, index) {
|
|
384
369
|
if (this.isMultiple) {
|
|
385
370
|
this.address[index] = address;
|
|
386
|
-
this.address = [
|
|
387
|
-
...this.address,
|
|
388
|
-
];
|
|
371
|
+
this.address = [...this.address];
|
|
389
372
|
}
|
|
390
373
|
else {
|
|
391
374
|
this.address = address;
|
|
@@ -597,12 +580,9 @@ export default class AddressComponent extends ContainerComponent {
|
|
|
597
580
|
}
|
|
598
581
|
return this.getComponents()
|
|
599
582
|
.filter((component) => component.hasValue(address))
|
|
600
|
-
.map((component) => [
|
|
601
|
-
component,
|
|
602
|
-
|
|
603
|
-
])
|
|
604
|
-
.filter(([component, componentValue,]) => !component.isEmpty(componentValue))
|
|
605
|
-
.map(([component, componentValue,]) => component.getValueAsString(componentValue, options))
|
|
583
|
+
.map((component) => [component, _.get(address, component.key)])
|
|
584
|
+
.filter(([component, componentValue]) => !component.isEmpty(componentValue))
|
|
585
|
+
.map(([component, componentValue]) => component.getValueAsString(componentValue, options))
|
|
606
586
|
.join(', ');
|
|
607
587
|
}
|
|
608
588
|
return super.getValueAsString(address, options);
|
|
@@ -38,10 +38,7 @@ export default [
|
|
|
38
38
|
},
|
|
39
39
|
conditional: {
|
|
40
40
|
json: {
|
|
41
|
-
'===': [
|
|
42
|
-
{ var: 'data.provider' },
|
|
43
|
-
'azure',
|
|
44
|
-
],
|
|
41
|
+
'===': [{ var: 'data.provider' }, 'azure'],
|
|
45
42
|
},
|
|
46
43
|
},
|
|
47
44
|
},
|
|
@@ -58,10 +55,7 @@ export default [
|
|
|
58
55
|
},
|
|
59
56
|
conditional: {
|
|
60
57
|
json: {
|
|
61
|
-
'===': [
|
|
62
|
-
{ var: 'data.provider' },
|
|
63
|
-
'custom',
|
|
64
|
-
],
|
|
58
|
+
'===': [{ var: 'data.provider' }, 'custom'],
|
|
65
59
|
},
|
|
66
60
|
},
|
|
67
61
|
},
|
|
@@ -76,10 +70,7 @@ export default [
|
|
|
76
70
|
tooltip: 'Which query param should be used to pass as a search string. Default is `query`.',
|
|
77
71
|
conditional: {
|
|
78
72
|
json: {
|
|
79
|
-
'===': [
|
|
80
|
-
{ var: 'data.provider' },
|
|
81
|
-
'custom',
|
|
82
|
-
],
|
|
73
|
+
'===': [{ var: 'data.provider' }, 'custom'],
|
|
83
74
|
},
|
|
84
75
|
},
|
|
85
76
|
},
|
|
@@ -93,10 +84,7 @@ export default [
|
|
|
93
84
|
tooltip: 'The property within the response data, where iterable addresses reside. For example: results.',
|
|
94
85
|
conditional: {
|
|
95
86
|
json: {
|
|
96
|
-
'===': [
|
|
97
|
-
{ var: 'data.provider' },
|
|
98
|
-
'custom',
|
|
99
|
-
],
|
|
87
|
+
'===': [{ var: 'data.provider' }, 'custom'],
|
|
100
88
|
},
|
|
101
89
|
},
|
|
102
90
|
},
|
|
@@ -110,10 +98,7 @@ export default [
|
|
|
110
98
|
tooltip: 'The property of each address in the response to use as the display value.',
|
|
111
99
|
conditional: {
|
|
112
100
|
json: {
|
|
113
|
-
'===': [
|
|
114
|
-
{ var: 'data.provider' },
|
|
115
|
-
'custom',
|
|
116
|
-
],
|
|
101
|
+
'===': [{ var: 'data.provider' }, 'custom'],
|
|
117
102
|
},
|
|
118
103
|
},
|
|
119
104
|
},
|
|
@@ -130,10 +115,7 @@ export default [
|
|
|
130
115
|
tooltip: 'Additional query params can be specified here in a way of JSON object.',
|
|
131
116
|
conditional: {
|
|
132
117
|
json: {
|
|
133
|
-
'===': [
|
|
134
|
-
{ var: 'data.provider' },
|
|
135
|
-
'custom',
|
|
136
|
-
],
|
|
118
|
+
'===': [{ var: 'data.provider' }, 'custom'],
|
|
137
119
|
},
|
|
138
120
|
},
|
|
139
121
|
},
|
|
@@ -150,10 +132,7 @@ export default [
|
|
|
150
132
|
},
|
|
151
133
|
conditional: {
|
|
152
134
|
json: {
|
|
153
|
-
'===': [
|
|
154
|
-
{ var: 'data.provider' },
|
|
155
|
-
'google',
|
|
156
|
-
],
|
|
135
|
+
'===': [{ var: 'data.provider' }, 'google'],
|
|
157
136
|
},
|
|
158
137
|
},
|
|
159
138
|
},
|
|
@@ -171,10 +150,7 @@ export default [
|
|
|
171
150
|
tooltip: "Specify Google Maps Autocomplete options used for address searching as JSON object. Follow the <a href ='https://developers.google.com/maps/documentation/javascript/places-autocomplete' target='_blank'>link</a> for available options",
|
|
172
151
|
conditional: {
|
|
173
152
|
json: {
|
|
174
|
-
'===': [
|
|
175
|
-
{ var: 'data.provider' },
|
|
176
|
-
'google',
|
|
177
|
-
],
|
|
153
|
+
'===': [{ var: 'data.provider' }, 'google'],
|
|
178
154
|
},
|
|
179
155
|
},
|
|
180
156
|
},
|
|
@@ -22,11 +22,7 @@ export default class Alert {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
showErrors(errors = [], triggerEvent = false, options = {}) {
|
|
25
|
-
errors = _.isArray(errors)
|
|
26
|
-
? errors
|
|
27
|
-
: [
|
|
28
|
-
errors,
|
|
29
|
-
];
|
|
25
|
+
errors = _.isArray(errors) ? errors : [errors];
|
|
30
26
|
const messagesList = this.createMessagesList('error', errors);
|
|
31
27
|
this.showAlert('error', messagesList, options);
|
|
32
28
|
if (triggerEvent) {
|
|
@@ -112,7 +108,7 @@ export default class Alert {
|
|
|
112
108
|
};
|
|
113
109
|
if (this.refs.messageRef?.length) {
|
|
114
110
|
this.refs.messageRef.forEach((el) => {
|
|
115
|
-
Object.entries(customEvents).forEach(([event, listeners
|
|
111
|
+
Object.entries(customEvents).forEach(([event, listeners]) => {
|
|
116
112
|
listeners.forEach((listener) => this.parentComponent.addEventListener(el, event, listener));
|
|
117
113
|
this.eventListenersKeys.push(event);
|
|
118
114
|
});
|
|
@@ -142,6 +138,7 @@ export default class Alert {
|
|
|
142
138
|
const component = this.parentComponent.root?.getComponent(path, null, keyOrPath);
|
|
143
139
|
if (component && _.isFunction(component.focus)) {
|
|
144
140
|
component.focus();
|
|
141
|
+
component.scrollIntoView();
|
|
145
142
|
}
|
|
146
143
|
}
|
|
147
144
|
}
|
|
@@ -29,6 +29,7 @@ export default class ButtonComponent extends Field {
|
|
|
29
29
|
detach(element: any): void;
|
|
30
30
|
onClick(event: any): void;
|
|
31
31
|
openOauth(settings: any): void;
|
|
32
|
+
_handleOauthSessionExpired(): void;
|
|
32
33
|
get oauthComponentPath(): any;
|
|
33
34
|
focus(): void;
|
|
34
35
|
triggerCaptcha(): void;
|
|
@@ -30,9 +30,7 @@ export default class ButtonComponent extends Field {
|
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
static savedValueTypes(schema) {
|
|
33
|
-
return
|
|
34
|
-
componentValueTypes.boolean,
|
|
35
|
-
]);
|
|
33
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.boolean];
|
|
36
34
|
}
|
|
37
35
|
constructor(component, options, data) {
|
|
38
36
|
super(component, options, data);
|
|
@@ -44,12 +42,7 @@ export default class ButtonComponent extends Field {
|
|
|
44
42
|
get inputInfo() {
|
|
45
43
|
const info = super.elementInfo();
|
|
46
44
|
info.type = 'button';
|
|
47
|
-
info.attr.type = [
|
|
48
|
-
'submit',
|
|
49
|
-
'saveState',
|
|
50
|
-
].includes(this.component.action)
|
|
51
|
-
? 'submit'
|
|
52
|
-
: 'button';
|
|
45
|
+
info.attr.type = ['submit', 'saveState'].includes(this.component.action) ? 'submit' : 'button';
|
|
53
46
|
this.component.theme = this.component.theme || 'default';
|
|
54
47
|
info.attr.class = `btn btn-${this.component.theme}`;
|
|
55
48
|
if (this.component.size) {
|
|
@@ -345,17 +338,17 @@ export default class ButtonComponent extends Field {
|
|
|
345
338
|
break;
|
|
346
339
|
case 'oauth':
|
|
347
340
|
if (this.root === this) {
|
|
348
|
-
console.warn('
|
|
341
|
+
console.warn(this.t('noOAuthBtn'));
|
|
349
342
|
return;
|
|
350
343
|
}
|
|
351
344
|
// Display Alert if OAuth config is missing
|
|
352
345
|
if (!this.oauthConfig) {
|
|
353
|
-
this.root
|
|
346
|
+
this.root.setAlert('danger', this.t('noOAuthConfiguration'));
|
|
354
347
|
break;
|
|
355
348
|
}
|
|
356
349
|
// Display Alert if oAuth has an error is missing
|
|
357
350
|
if (this.oauthConfig.error) {
|
|
358
|
-
this.root?.setAlert('danger',
|
|
351
|
+
this.root?.setAlert('danger', `${this.t('oAuthErrorsTitle')} ${this.t(this.oauthConfig.error)}`);
|
|
359
352
|
break;
|
|
360
353
|
}
|
|
361
354
|
this.openOauth(this.oauthConfig);
|
|
@@ -363,8 +356,14 @@ export default class ButtonComponent extends Field {
|
|
|
363
356
|
}
|
|
364
357
|
}
|
|
365
358
|
openOauth(settings) {
|
|
359
|
+
// this is if the temp session (storing the state and code verifiers) expires in the db
|
|
360
|
+
// and we need to fetch new oauth state
|
|
361
|
+
if (settings.sessionExpireAt && Date.now() >= settings.sessionExpireAt) {
|
|
362
|
+
this._handleOauthSessionExpired();
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
366
365
|
if (!this.root?.formio) {
|
|
367
|
-
console.warn(
|
|
366
|
+
console.warn(this.t('noOAuthFormUrl'));
|
|
368
367
|
return;
|
|
369
368
|
}
|
|
370
369
|
let params = {
|
|
@@ -378,7 +377,8 @@ export default class ButtonComponent extends Field {
|
|
|
378
377
|
if (settings.state) {
|
|
379
378
|
params.state = settings.state;
|
|
380
379
|
}
|
|
381
|
-
|
|
380
|
+
// okta requires both a state and a code challenge for PKCE
|
|
381
|
+
if (settings.code_challenge) {
|
|
382
382
|
params.code_challenge = settings.code_challenge;
|
|
383
383
|
params.code_challenge_method = 'S256';
|
|
384
384
|
}
|
|
@@ -417,9 +417,12 @@ export default class ButtonComponent extends Field {
|
|
|
417
417
|
}
|
|
418
418
|
// TODO: check for error response here
|
|
419
419
|
if (settings.state !== params.state) {
|
|
420
|
-
this.root?.setAlert('danger',
|
|
420
|
+
this.root?.setAlert('danger', this.t('oAuthStateError'));
|
|
421
421
|
return;
|
|
422
422
|
}
|
|
423
|
+
if (settings.sessionId) {
|
|
424
|
+
params.sessionId = settings.sessionId;
|
|
425
|
+
}
|
|
423
426
|
// Depending on where the settings came from, submit to either the submission endpoint (old) or oauth endpoint (new).
|
|
424
427
|
let requestPromise = Promise.resolve();
|
|
425
428
|
if (_.has(this, 'root.form.config.oauth') &&
|
|
@@ -446,6 +449,11 @@ export default class ButtonComponent extends Field {
|
|
|
446
449
|
this.root?.onSubmit(result, true);
|
|
447
450
|
})
|
|
448
451
|
.catch((err) => {
|
|
452
|
+
console.log(err);
|
|
453
|
+
if (settings.sessionExpireAt && Date.now() >= settings.sessionExpireAt) {
|
|
454
|
+
this._handleOauthSessionExpired();
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
449
457
|
this.root?.onSubmissionError(err);
|
|
450
458
|
});
|
|
451
459
|
}
|
|
@@ -453,7 +461,7 @@ export default class ButtonComponent extends Field {
|
|
|
453
461
|
catch (error) {
|
|
454
462
|
if (error.name !== 'SecurityError' &&
|
|
455
463
|
(error.name !== 'Error' || error.message !== 'Permission denied')) {
|
|
456
|
-
this.root?.setAlert('danger', error.message || error);
|
|
464
|
+
this.root?.setAlert('danger', this.t(`${error.message || error}`));
|
|
457
465
|
}
|
|
458
466
|
}
|
|
459
467
|
if (!popup || popup.closed || popup.closed === undefined) {
|
|
@@ -461,6 +469,11 @@ export default class ButtonComponent extends Field {
|
|
|
461
469
|
}
|
|
462
470
|
}, 100);
|
|
463
471
|
}
|
|
472
|
+
_handleOauthSessionExpired() {
|
|
473
|
+
this.root?.setAlert('warning', this.t('oauthSessionExpired'));
|
|
474
|
+
this.loading = true;
|
|
475
|
+
setTimeout(() => window.location.reload(), 2000);
|
|
476
|
+
}
|
|
464
477
|
get oauthComponentPath() {
|
|
465
478
|
const pathArray = getArrayFromComponentPath(this.path);
|
|
466
479
|
return _.chain(pathArray)
|
|
@@ -56,10 +56,7 @@ export default [
|
|
|
56
56
|
},
|
|
57
57
|
conditional: {
|
|
58
58
|
json: {
|
|
59
|
-
'===': [
|
|
60
|
-
{ var: 'data.action' },
|
|
61
|
-
'oauth',
|
|
62
|
-
],
|
|
59
|
+
'===': [{ var: 'data.action' }, 'oauth'],
|
|
63
60
|
},
|
|
64
61
|
},
|
|
65
62
|
},
|
|
@@ -73,10 +70,7 @@ export default [
|
|
|
73
70
|
input: true,
|
|
74
71
|
conditional: {
|
|
75
72
|
json: {
|
|
76
|
-
'===': [
|
|
77
|
-
{ var: 'data.action' },
|
|
78
|
-
'saveState',
|
|
79
|
-
],
|
|
73
|
+
'===': [{ var: 'data.action' }, 'saveState'],
|
|
80
74
|
},
|
|
81
75
|
},
|
|
82
76
|
},
|
|
@@ -90,10 +84,7 @@ export default [
|
|
|
90
84
|
tooltip: 'Use the Enter key to submit form.',
|
|
91
85
|
conditional: {
|
|
92
86
|
json: {
|
|
93
|
-
'===': [
|
|
94
|
-
{ var: 'data.action' },
|
|
95
|
-
'submit',
|
|
96
|
-
],
|
|
87
|
+
'===': [{ var: 'data.action' }, 'submit'],
|
|
97
88
|
},
|
|
98
89
|
},
|
|
99
90
|
},
|
|
@@ -107,10 +98,7 @@ export default [
|
|
|
107
98
|
tooltip: 'When the button is pressed, show any validation errors on the form.',
|
|
108
99
|
conditional: {
|
|
109
100
|
json: {
|
|
110
|
-
'!==': [
|
|
111
|
-
{ var: 'data.action' },
|
|
112
|
-
'submit',
|
|
113
|
-
],
|
|
101
|
+
'!==': [{ var: 'data.action' }, 'submit'],
|
|
114
102
|
},
|
|
115
103
|
},
|
|
116
104
|
},
|
|
@@ -123,10 +111,7 @@ export default [
|
|
|
123
111
|
tooltip: 'The event to fire when the button is clicked.',
|
|
124
112
|
conditional: {
|
|
125
113
|
json: {
|
|
126
|
-
'===': [
|
|
127
|
-
{ var: 'data.action' },
|
|
128
|
-
'event',
|
|
129
|
-
],
|
|
114
|
+
'===': [{ var: 'data.action' }, 'event'],
|
|
130
115
|
},
|
|
131
116
|
},
|
|
132
117
|
},
|
|
@@ -141,10 +126,7 @@ export default [
|
|
|
141
126
|
placeholder: 'https://example.form.io',
|
|
142
127
|
conditional: {
|
|
143
128
|
json: {
|
|
144
|
-
'===': [
|
|
145
|
-
{ var: 'data.action' },
|
|
146
|
-
'url',
|
|
147
|
-
],
|
|
129
|
+
'===': [{ var: 'data.action' }, 'url'],
|
|
148
130
|
},
|
|
149
131
|
},
|
|
150
132
|
},
|
|
@@ -172,10 +154,7 @@ export default [
|
|
|
172
154
|
],
|
|
173
155
|
conditional: {
|
|
174
156
|
json: {
|
|
175
|
-
'===': [
|
|
176
|
-
{ var: 'data.action' },
|
|
177
|
-
'url',
|
|
178
|
-
],
|
|
157
|
+
'===': [{ var: 'data.action' }, 'url'],
|
|
179
158
|
},
|
|
180
159
|
},
|
|
181
160
|
},
|
|
@@ -191,10 +170,7 @@ export default [
|
|
|
191
170
|
placeholder: "data['mykey'] = data['anotherKey'];",
|
|
192
171
|
conditional: {
|
|
193
172
|
json: {
|
|
194
|
-
'===': [
|
|
195
|
-
{ var: 'data.action' },
|
|
196
|
-
'custom',
|
|
197
|
-
],
|
|
173
|
+
'===': [{ var: 'data.action' }, 'custom'],
|
|
198
174
|
},
|
|
199
175
|
},
|
|
200
176
|
},
|