@formio/js 5.4.1 → 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 +1 -0
- 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 +1 -0
- package/dist/formio.form.js +131 -109
- 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 +1 -0
- package/dist/formio.full.js +155 -133
- 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 +26 -26
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -2
- package/dist/formio.utils.js +19 -19
- 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 +5 -5
- package/lib/cjs/components/_classes/component/Component.js +60 -132
- 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.js +10 -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 +23 -63
- 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 +48 -92
- 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 +1 -3
- 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 -82
- package/lib/cjs/translations/en.js +9 -82
- 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 +37 -47
- 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 +5 -5
- package/lib/mjs/components/_classes/component/Component.js +59 -132
- 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.js +9 -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 +23 -63
- 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 +51 -95
- 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 +1 -3
- 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 -82
- package/lib/mjs/translations/en.js +88 -0
- 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 +37 -47
- package/lib/mjs/widgets/CalendarWidget.js +2 -6
- package/package.json +6 -4
|
@@ -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
|
}
|
|
@@ -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,14 +356,14 @@ export default class ButtonComponent extends Field {
|
|
|
363
356
|
}
|
|
364
357
|
}
|
|
365
358
|
openOauth(settings) {
|
|
366
|
-
// this is if the temp session (storing the state and code verifiers) expires in the db
|
|
359
|
+
// this is if the temp session (storing the state and code verifiers) expires in the db
|
|
367
360
|
// and we need to fetch new oauth state
|
|
368
361
|
if (settings.sessionExpireAt && Date.now() >= settings.sessionExpireAt) {
|
|
369
362
|
this._handleOauthSessionExpired();
|
|
370
363
|
return;
|
|
371
364
|
}
|
|
372
365
|
if (!this.root?.formio) {
|
|
373
|
-
console.warn(
|
|
366
|
+
console.warn(this.t('noOAuthFormUrl'));
|
|
374
367
|
return;
|
|
375
368
|
}
|
|
376
369
|
let params = {
|
|
@@ -424,7 +417,7 @@ export default class ButtonComponent extends Field {
|
|
|
424
417
|
}
|
|
425
418
|
// TODO: check for error response here
|
|
426
419
|
if (settings.state !== params.state) {
|
|
427
|
-
this.root?.setAlert('danger',
|
|
420
|
+
this.root?.setAlert('danger', this.t('oAuthStateError'));
|
|
428
421
|
return;
|
|
429
422
|
}
|
|
430
423
|
if (settings.sessionId) {
|
|
@@ -468,7 +461,7 @@ export default class ButtonComponent extends Field {
|
|
|
468
461
|
catch (error) {
|
|
469
462
|
if (error.name !== 'SecurityError' &&
|
|
470
463
|
(error.name !== 'Error' || error.message !== 'Permission denied')) {
|
|
471
|
-
this.root?.setAlert('danger', error.message || error);
|
|
464
|
+
this.root?.setAlert('danger', this.t(`${error.message || error}`));
|
|
472
465
|
}
|
|
473
466
|
}
|
|
474
467
|
if (!popup || popup.closed || popup.closed === undefined) {
|
|
@@ -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
|
},
|
|
@@ -30,9 +30,7 @@ export default class CheckBoxComponent extends Field {
|
|
|
30
30
|
static get conditionOperatorsSettings() {
|
|
31
31
|
return {
|
|
32
32
|
...super.conditionOperatorsSettings,
|
|
33
|
-
operators: [
|
|
34
|
-
'isEqual',
|
|
35
|
-
],
|
|
33
|
+
operators: ['isEqual'],
|
|
36
34
|
valueComponent() {
|
|
37
35
|
return {
|
|
38
36
|
valueType: 'boolean',
|
|
@@ -54,13 +52,9 @@ export default class CheckBoxComponent extends Field {
|
|
|
54
52
|
return types;
|
|
55
53
|
}
|
|
56
54
|
if (schema.inputType === 'radio') {
|
|
57
|
-
return [
|
|
58
|
-
componentValueTypes.string,
|
|
59
|
-
];
|
|
55
|
+
return [componentValueTypes.string];
|
|
60
56
|
}
|
|
61
|
-
return [
|
|
62
|
-
componentValueTypes.boolean,
|
|
63
|
-
];
|
|
57
|
+
return [componentValueTypes.boolean];
|
|
64
58
|
}
|
|
65
59
|
get defaultSchema() {
|
|
66
60
|
return CheckBoxComponent.schema();
|
|
@@ -195,7 +189,7 @@ export default class CheckBoxComponent extends Field {
|
|
|
195
189
|
if (_.isUndefined(value) && this.inDataTable) {
|
|
196
190
|
return '';
|
|
197
191
|
}
|
|
198
|
-
return this.t(hasValue ? '
|
|
192
|
+
return this.t(hasValue ? 'yes' : 'no');
|
|
199
193
|
}
|
|
200
194
|
updateValue(value, flags) {
|
|
201
195
|
// If this is a radio and is alredy checked, uncheck it.
|
|
@@ -58,10 +58,7 @@ export default [
|
|
|
58
58
|
weight: 420,
|
|
59
59
|
conditional: {
|
|
60
60
|
json: {
|
|
61
|
-
'===': [
|
|
62
|
-
{ var: 'data.inputType' },
|
|
63
|
-
'radio',
|
|
64
|
-
],
|
|
61
|
+
'===': [{ var: 'data.inputType' }, 'radio'],
|
|
65
62
|
},
|
|
66
63
|
},
|
|
67
64
|
},
|
|
@@ -74,10 +71,7 @@ export default [
|
|
|
74
71
|
weight: 430,
|
|
75
72
|
conditional: {
|
|
76
73
|
json: {
|
|
77
|
-
'===': [
|
|
78
|
-
{ var: 'data.inputType' },
|
|
79
|
-
'radio',
|
|
80
|
-
],
|
|
74
|
+
'===': [{ var: 'data.inputType' }, 'radio'],
|
|
81
75
|
},
|
|
82
76
|
},
|
|
83
77
|
},
|
|
@@ -36,9 +36,7 @@ export default class ColumnsComponent extends NestedComponent {
|
|
|
36
36
|
this.rows = [];
|
|
37
37
|
}
|
|
38
38
|
get schema() {
|
|
39
|
-
const schema = _.omit(super.schema, [
|
|
40
|
-
'components',
|
|
41
|
-
]);
|
|
39
|
+
const schema = _.omit(super.schema, ['components']);
|
|
42
40
|
schema.columns?.map((column, colIndex) => {
|
|
43
41
|
column.components.map((comp, compIndex) => {
|
|
44
42
|
const clonedComp = _.clone(comp);
|
|
@@ -122,28 +120,18 @@ export default class ColumnsComponent extends NestedComponent {
|
|
|
122
120
|
const initVal = { stack: [], rows: [] };
|
|
123
121
|
const width = (x) => x.component.width;
|
|
124
122
|
const result = _.reduce(this.components, (acc, next) => {
|
|
125
|
-
const stack = [
|
|
126
|
-
...acc.stack,
|
|
127
|
-
next,
|
|
128
|
-
];
|
|
123
|
+
const stack = [...acc.stack, next];
|
|
129
124
|
if (_.sumBy(stack, width) <= this.gridSize) {
|
|
130
125
|
acc.stack = stack;
|
|
131
126
|
return acc;
|
|
132
127
|
}
|
|
133
128
|
else {
|
|
134
|
-
acc.rows = [
|
|
135
|
-
|
|
136
|
-
acc.stack,
|
|
137
|
-
];
|
|
138
|
-
acc.stack = [
|
|
139
|
-
next,
|
|
140
|
-
];
|
|
129
|
+
acc.rows = [...acc.rows, acc.stack];
|
|
130
|
+
acc.stack = [next];
|
|
141
131
|
return acc;
|
|
142
132
|
}
|
|
143
133
|
}, initVal);
|
|
144
|
-
return _.concat(result.rows, [
|
|
145
|
-
result.stack,
|
|
146
|
-
]);
|
|
134
|
+
return _.concat(result.rows, [result.stack]);
|
|
147
135
|
}
|
|
148
136
|
checkData(data, flags, row, components) {
|
|
149
137
|
super.checkData(data, flags, row, components);
|
|
@@ -32,9 +32,7 @@ export default class ContainerComponent extends NestedDataComponent {
|
|
|
32
32
|
this.type = 'container';
|
|
33
33
|
}
|
|
34
34
|
static savedValueTypes(schema) {
|
|
35
|
-
return
|
|
36
|
-
componentValueTypes.object,
|
|
37
|
-
]);
|
|
35
|
+
return getComponentSavedTypes(schema) || [componentValueTypes.object];
|
|
38
36
|
}
|
|
39
37
|
addComponents(data, options) {
|
|
40
38
|
return super.addComponents(this.dataValue, options);
|
|
@@ -104,13 +104,8 @@ export default class CurrencyComponent extends NumberComponent {
|
|
|
104
104
|
const isNegative = value.includes(negativeValueSymbol) || false;
|
|
105
105
|
value = this.stripPrefixSuffix(isNegative ? value.replace(negativeValueSymbol, '') : value);
|
|
106
106
|
if (value.includes(this.decimalSeparator)) {
|
|
107
|
-
[
|
|
108
|
-
|
|
109
|
-
decimalPart,
|
|
110
|
-
] = value.split(this.decimalSeparator);
|
|
111
|
-
decimalPartNumbers = [
|
|
112
|
-
...decimalPart.split(''),
|
|
113
|
-
];
|
|
107
|
+
[integerPart, decimalPart] = value.split(this.decimalSeparator);
|
|
108
|
+
decimalPartNumbers = [...decimalPart.split('')];
|
|
114
109
|
}
|
|
115
110
|
else {
|
|
116
111
|
integerPart = value;
|