@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
|
@@ -89,10 +89,7 @@ export default class TabsComponent extends NestedComponent {
|
|
|
89
89
|
[this.tabKey]: 'multiple',
|
|
90
90
|
[this.tabLikey]: 'multiple',
|
|
91
91
|
});
|
|
92
|
-
[
|
|
93
|
-
'change',
|
|
94
|
-
'error',
|
|
95
|
-
].forEach((event) => this.on(event, this.handleTabsValidation.bind(this)));
|
|
92
|
+
['change', 'error'].forEach((event) => this.on(event, this.handleTabsValidation.bind(this)));
|
|
96
93
|
const superAttach = super.attach(element);
|
|
97
94
|
this.refs[this.tabLinkKey].forEach((tabLink, index) => {
|
|
98
95
|
this.addEventListener(tabLink, 'click', (event) => {
|
|
@@ -182,12 +179,7 @@ export default class TabsComponent extends NestedComponent {
|
|
|
182
179
|
const element = Array.isArray(elements) || elements instanceof NodeList ? this.element : elements;
|
|
183
180
|
super.clearErrorClasses(element);
|
|
184
181
|
}
|
|
185
|
-
elements =
|
|
186
|
-
Array.isArray(elements) || elements instanceof NodeList
|
|
187
|
-
? elements
|
|
188
|
-
: [
|
|
189
|
-
elements,
|
|
190
|
-
];
|
|
182
|
+
elements = Array.isArray(elements) || elements instanceof NodeList ? elements : [elements];
|
|
191
183
|
elements.forEach((element) => {
|
|
192
184
|
this.removeClass(element, 'is-invalid');
|
|
193
185
|
this.removeClass(element, 'tab-error');
|
|
@@ -201,19 +193,12 @@ export default class TabsComponent extends NestedComponent {
|
|
|
201
193
|
this.clearErrorClasses(this.refs[this.tabLinkKey]);
|
|
202
194
|
const invalidTabsIndexes = this.tabs.reduce((invalidTabs, tab, tabIndex) => {
|
|
203
195
|
const hasComponentWithError = tab.some((comp) => !!comp.error);
|
|
204
|
-
return hasComponentWithError
|
|
205
|
-
? [
|
|
206
|
-
...invalidTabs,
|
|
207
|
-
tabIndex,
|
|
208
|
-
]
|
|
209
|
-
: invalidTabs;
|
|
196
|
+
return hasComponentWithError ? [...invalidTabs, tabIndex] : invalidTabs;
|
|
210
197
|
}, []);
|
|
211
198
|
if (!invalidTabsIndexes.length) {
|
|
212
199
|
return;
|
|
213
200
|
}
|
|
214
|
-
const invalidTabs = [
|
|
215
|
-
...this.refs[this.tabLinkKey],
|
|
216
|
-
].filter((_, tabIndex) => invalidTabsIndexes.includes(tabIndex));
|
|
201
|
+
const invalidTabs = [...this.refs[this.tabLinkKey]].filter((_, tabIndex) => invalidTabsIndexes.includes(tabIndex));
|
|
217
202
|
this.setErrorClasses(invalidTabs);
|
|
218
203
|
}
|
|
219
204
|
}
|
|
@@ -28,11 +28,7 @@ export default class TagsComponent extends Input {
|
|
|
28
28
|
static get conditionOperatorsSettings() {
|
|
29
29
|
return {
|
|
30
30
|
...super.conditionOperatorsSettings,
|
|
31
|
-
operators: [
|
|
32
|
-
...super.conditionOperatorsSettings.operators,
|
|
33
|
-
'includes',
|
|
34
|
-
'notIncludes',
|
|
35
|
-
],
|
|
31
|
+
operators: [...super.conditionOperatorsSettings.operators, 'includes', 'notIncludes'],
|
|
36
32
|
};
|
|
37
33
|
}
|
|
38
34
|
static savedValueTypes(schema) {
|
|
@@ -85,7 +81,7 @@ export default class TagsComponent extends Input {
|
|
|
85
81
|
shadowRoot: this.root ? this.root.shadowRoot : null,
|
|
86
82
|
placeholder: hasPlaceholder,
|
|
87
83
|
placeholderValue: hasPlaceholder
|
|
88
|
-
? this.t(this.component.placeholder, { _userInput: true })
|
|
84
|
+
? this.sanitize(this.t(this.component.placeholder, { _userInput: true }), true)
|
|
89
85
|
: null,
|
|
90
86
|
});
|
|
91
87
|
this.choices.itemList.element.tabIndex = element.tabIndex;
|
|
@@ -107,9 +103,7 @@ export default class TagsComponent extends Input {
|
|
|
107
103
|
this.choices.clearInput();
|
|
108
104
|
}
|
|
109
105
|
else {
|
|
110
|
-
this.choices.setValue([
|
|
111
|
-
value,
|
|
112
|
-
]);
|
|
106
|
+
this.choices.setValue([value]);
|
|
113
107
|
this.choices.clearInput();
|
|
114
108
|
this.choices.hideDropdown(true);
|
|
115
109
|
this.updateValue(null, {
|
|
@@ -144,11 +138,7 @@ export default class TagsComponent extends Input {
|
|
|
144
138
|
if (typeof dataValue === 'string') {
|
|
145
139
|
dataValue = dataValue.split(this.delimiter).filter((result) => result);
|
|
146
140
|
}
|
|
147
|
-
const value = Array.isArray(dataValue)
|
|
148
|
-
? dataValue
|
|
149
|
-
: [
|
|
150
|
-
dataValue,
|
|
151
|
-
];
|
|
141
|
+
const value = Array.isArray(dataValue) ? dataValue : [dataValue];
|
|
152
142
|
this.choices.setValue(value.map((val) => this.sanitize(val, this.shouldSanitizeValue)));
|
|
153
143
|
}
|
|
154
144
|
}
|
|
@@ -144,7 +144,7 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
144
144
|
case 'quill':
|
|
145
145
|
// Normalize the configurations for quill.
|
|
146
146
|
if (settings.hasOwnProperty('toolbarGroups') || settings.hasOwnProperty('toolbar')) {
|
|
147
|
-
console.warn(
|
|
147
|
+
console.warn(this.t('needConfigurationForQuill'));
|
|
148
148
|
settings = this.wysiwygDefault.quill;
|
|
149
149
|
}
|
|
150
150
|
// Add the quill editor.
|
|
@@ -219,7 +219,7 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
219
219
|
imageHandler(moduleInstance, range, files) {
|
|
220
220
|
const quillInstance = moduleInstance.quill;
|
|
221
221
|
if (!files || !files.length) {
|
|
222
|
-
console.warn('
|
|
222
|
+
console.warn(this.t('noFilesSelected'));
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
225
|
quillInstance.enable(false);
|
|
@@ -245,7 +245,7 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
245
245
|
}), Quill.sources.USER);
|
|
246
246
|
})
|
|
247
247
|
.catch((error) => {
|
|
248
|
-
console.warn('
|
|
248
|
+
console.warn(this.t('quillImageUploadFailed'));
|
|
249
249
|
console.warn(error);
|
|
250
250
|
quillInstance.enable(true);
|
|
251
251
|
});
|
|
@@ -302,15 +302,8 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
302
302
|
}
|
|
303
303
|
setContent(element, content, forceSanitize) {
|
|
304
304
|
super.setContent(element, content, forceSanitize, {
|
|
305
|
-
addAttr: [
|
|
306
|
-
|
|
307
|
-
'allowfullscreen',
|
|
308
|
-
'frameborder',
|
|
309
|
-
'scrolling',
|
|
310
|
-
],
|
|
311
|
-
addTags: [
|
|
312
|
-
'iframe',
|
|
313
|
-
],
|
|
305
|
+
addAttr: ['allow', 'allowfullscreen', 'frameborder', 'scrolling'],
|
|
306
|
+
addTags: ['iframe'],
|
|
314
307
|
});
|
|
315
308
|
}
|
|
316
309
|
setReadOnlyValue(value, index) {
|
|
@@ -551,7 +544,7 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
551
544
|
this.element.scrollIntoView();
|
|
552
545
|
})
|
|
553
546
|
.catch((err) => {
|
|
554
|
-
console.warn('
|
|
547
|
+
console.warn(this.t('editorFocusError'), err);
|
|
555
548
|
});
|
|
556
549
|
break;
|
|
557
550
|
}
|
|
@@ -562,7 +555,7 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
562
555
|
this.element.scrollIntoView();
|
|
563
556
|
})
|
|
564
557
|
.catch((err) => {
|
|
565
|
-
console.warn('
|
|
558
|
+
console.warn(this.t('editorFocusError'), err);
|
|
566
559
|
});
|
|
567
560
|
break;
|
|
568
561
|
}
|
|
@@ -572,7 +565,7 @@ export default class TextAreaComponent extends TextFieldComponent {
|
|
|
572
565
|
this.editors[0].focus();
|
|
573
566
|
})
|
|
574
567
|
.catch((err) => {
|
|
575
|
-
console.warn('
|
|
568
|
+
console.warn(this.t('editorFocusError'), err);
|
|
576
569
|
});
|
|
577
570
|
break;
|
|
578
571
|
}
|
|
@@ -56,10 +56,7 @@ export default [
|
|
|
56
56
|
weight: 415,
|
|
57
57
|
conditional: {
|
|
58
58
|
json: {
|
|
59
|
-
'==': [
|
|
60
|
-
{ var: 'data.editor' },
|
|
61
|
-
'',
|
|
62
|
-
],
|
|
59
|
+
'==': [{ var: 'data.editor' }, ''],
|
|
63
60
|
},
|
|
64
61
|
},
|
|
65
62
|
},
|
|
@@ -73,16 +70,10 @@ export default [
|
|
|
73
70
|
json: {
|
|
74
71
|
or: [
|
|
75
72
|
{
|
|
76
|
-
'===': [
|
|
77
|
-
{ var: 'data.editor' },
|
|
78
|
-
'quill',
|
|
79
|
-
],
|
|
73
|
+
'===': [{ var: 'data.editor' }, 'quill'],
|
|
80
74
|
},
|
|
81
75
|
{
|
|
82
|
-
'===': [
|
|
83
|
-
{ var: 'data.editor' },
|
|
84
|
-
'ckeditor',
|
|
85
|
-
],
|
|
76
|
+
'===': [{ var: 'data.editor' }, 'ckeditor'],
|
|
86
77
|
},
|
|
87
78
|
],
|
|
88
79
|
},
|
|
@@ -108,10 +99,7 @@ export default [
|
|
|
108
99
|
},
|
|
109
100
|
conditional: {
|
|
110
101
|
json: {
|
|
111
|
-
'===': [
|
|
112
|
-
{ var: 'data.isUploadEnabled' },
|
|
113
|
-
true,
|
|
114
|
-
],
|
|
102
|
+
'===': [{ var: 'data.isUploadEnabled' }, true],
|
|
115
103
|
},
|
|
116
104
|
},
|
|
117
105
|
},
|
|
@@ -125,10 +113,7 @@ export default [
|
|
|
125
113
|
tooltip: "See <a href='https://github.com/danialfarid/ng-file-upload#server-side' target='_blank'>https://github.com/danialfarid/ng-file-upload#server-side</a> for how to set up the server.",
|
|
126
114
|
conditional: {
|
|
127
115
|
json: {
|
|
128
|
-
'===': [
|
|
129
|
-
{ var: 'data.uploadStorage' },
|
|
130
|
-
'url',
|
|
131
|
-
],
|
|
116
|
+
'===': [{ var: 'data.uploadStorage' }, 'url'],
|
|
132
117
|
},
|
|
133
118
|
},
|
|
134
119
|
},
|
|
@@ -165,10 +150,7 @@ export default [
|
|
|
165
150
|
weight: 415.5,
|
|
166
151
|
conditional: {
|
|
167
152
|
json: {
|
|
168
|
-
'===': [
|
|
169
|
-
{ var: 'data.isUploadEnabled' },
|
|
170
|
-
true,
|
|
171
|
-
],
|
|
153
|
+
'===': [{ var: 'data.isUploadEnabled' }, true],
|
|
172
154
|
},
|
|
173
155
|
},
|
|
174
156
|
},
|
|
@@ -185,22 +167,13 @@ export default [
|
|
|
185
167
|
json: {
|
|
186
168
|
and: [
|
|
187
169
|
{
|
|
188
|
-
'===': [
|
|
189
|
-
{ var: 'data.editor' },
|
|
190
|
-
'quill',
|
|
191
|
-
],
|
|
170
|
+
'===': [{ var: 'data.editor' }, 'quill'],
|
|
192
171
|
},
|
|
193
172
|
{
|
|
194
|
-
'===': [
|
|
195
|
-
{ var: 'data.isUploadEnabled' },
|
|
196
|
-
true,
|
|
197
|
-
],
|
|
173
|
+
'===': [{ var: 'data.isUploadEnabled' }, true],
|
|
198
174
|
},
|
|
199
175
|
{
|
|
200
|
-
'===': [
|
|
201
|
-
{ var: 'data.uploadStorage' },
|
|
202
|
-
'url',
|
|
203
|
-
],
|
|
176
|
+
'===': [{ var: 'data.uploadStorage' }, 'url'],
|
|
204
177
|
},
|
|
205
178
|
],
|
|
206
179
|
},
|
|
@@ -225,16 +198,10 @@ export default [
|
|
|
225
198
|
json: {
|
|
226
199
|
or: [
|
|
227
200
|
{
|
|
228
|
-
'===': [
|
|
229
|
-
{ var: 'data.editor' },
|
|
230
|
-
'quill',
|
|
231
|
-
],
|
|
201
|
+
'===': [{ var: 'data.editor' }, 'quill'],
|
|
232
202
|
},
|
|
233
203
|
{
|
|
234
|
-
'===': [
|
|
235
|
-
{ var: 'data.editor' },
|
|
236
|
-
'ace',
|
|
237
|
-
],
|
|
204
|
+
'===': [{ var: 'data.editor' }, 'ace'],
|
|
238
205
|
},
|
|
239
206
|
],
|
|
240
207
|
},
|
|
@@ -257,22 +224,13 @@ export default [
|
|
|
257
224
|
json: {
|
|
258
225
|
or: [
|
|
259
226
|
{
|
|
260
|
-
'===': [
|
|
261
|
-
{ var: 'data.editor' },
|
|
262
|
-
'ace',
|
|
263
|
-
],
|
|
227
|
+
'===': [{ var: 'data.editor' }, 'ace'],
|
|
264
228
|
},
|
|
265
229
|
{
|
|
266
|
-
'===': [
|
|
267
|
-
{ var: 'data.editor' },
|
|
268
|
-
'ckeditor',
|
|
269
|
-
],
|
|
230
|
+
'===': [{ var: 'data.editor' }, 'ckeditor'],
|
|
270
231
|
},
|
|
271
232
|
{
|
|
272
|
-
'===': [
|
|
273
|
-
{ var: 'data.editor' },
|
|
274
|
-
'quill',
|
|
275
|
-
],
|
|
233
|
+
'===': [{ var: 'data.editor' }, 'quill'],
|
|
276
234
|
},
|
|
277
235
|
],
|
|
278
236
|
},
|
|
@@ -56,9 +56,7 @@ export default class TextFieldComponent extends Input {
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
static savedValueTypes(schema) {
|
|
59
|
-
return
|
|
60
|
-
FormioUtils.componentValueTypes.string,
|
|
61
|
-
]);
|
|
59
|
+
return FormioUtils.getComponentSavedTypes(schema) || [FormioUtils.componentValueTypes.string];
|
|
62
60
|
}
|
|
63
61
|
get defaultSchema() {
|
|
64
62
|
return TextFieldComponent.schema();
|
|
@@ -126,7 +124,9 @@ export default class TextFieldComponent extends Input {
|
|
|
126
124
|
defaultValue = defaultValue[0];
|
|
127
125
|
}
|
|
128
126
|
// Extract string if defaultValue is a mask object to prevent nesting
|
|
129
|
-
if (defaultValue &&
|
|
127
|
+
if (defaultValue &&
|
|
128
|
+
typeof defaultValue === 'object' &&
|
|
129
|
+
defaultValue.hasOwnProperty('value')) {
|
|
130
130
|
defaultValue = defaultValue.value;
|
|
131
131
|
}
|
|
132
132
|
value.value = defaultValue;
|
|
@@ -69,10 +69,7 @@ export default [
|
|
|
69
69
|
},
|
|
70
70
|
conditional: {
|
|
71
71
|
json: {
|
|
72
|
-
'===': [
|
|
73
|
-
{ var: 'data.type' },
|
|
74
|
-
'textfield',
|
|
75
|
-
],
|
|
72
|
+
'===': [{ var: 'data.type' }, 'textfield'],
|
|
76
73
|
},
|
|
77
74
|
},
|
|
78
75
|
},
|
|
@@ -101,10 +98,7 @@ export default [
|
|
|
101
98
|
as: 'json',
|
|
102
99
|
conditional: {
|
|
103
100
|
json: {
|
|
104
|
-
'!==': [
|
|
105
|
-
{ var: 'data.widget.type' },
|
|
106
|
-
'input',
|
|
107
|
-
],
|
|
101
|
+
'!==': [{ var: 'data.widget.type' }, 'input'],
|
|
108
102
|
},
|
|
109
103
|
},
|
|
110
104
|
},
|
|
@@ -65,10 +65,7 @@ export default class TimeComponent extends TextFieldComponent {
|
|
|
65
65
|
}
|
|
66
66
|
removeValue(index) {
|
|
67
67
|
this.rawData = Array.isArray(this.rawData)
|
|
68
|
-
? [
|
|
69
|
-
...this.rawData.slice(0, index),
|
|
70
|
-
...this.rawData.slice(index + 1),
|
|
71
|
-
]
|
|
68
|
+
? [...this.rawData.slice(0, index), ...this.rawData.slice(index + 1)]
|
|
72
69
|
: this.emptyValue;
|
|
73
70
|
super.removeValue(index);
|
|
74
71
|
}
|
package/lib/mjs/formio.form.js
CHANGED
|
@@ -11,6 +11,7 @@ import Utils, { DefaultEvaluator, Evaluator, registerEvaluator } from './utils';
|
|
|
11
11
|
import Licenses from './licenses';
|
|
12
12
|
import EventEmitter from './EventEmitter';
|
|
13
13
|
import Webform from './Webform';
|
|
14
|
+
import { I18n } from './utils/i18n';
|
|
14
15
|
Formio.loadModules = (path = `${Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
|
|
15
16
|
Formio.requireLibrary(name, name, path, true).then((modules) => {
|
|
16
17
|
Formio.use(modules);
|
|
@@ -88,6 +89,9 @@ export function registerModule(mod, defaultFn = null, options = {}) {
|
|
|
88
89
|
? Formio.Licenses.addLicense(mod.library, options.license)
|
|
89
90
|
: Formio.Licenses.removeLicense(mod.library);
|
|
90
91
|
break;
|
|
92
|
+
case 'translations':
|
|
93
|
+
I18n.setDefaultTranslations(mod.translations);
|
|
94
|
+
break;
|
|
91
95
|
default:
|
|
92
96
|
if (defaultFn) {
|
|
93
97
|
defaultFn(key, mod);
|
|
@@ -102,11 +106,7 @@ export function registerModule(mod, defaultFn = null, options = {}) {
|
|
|
102
106
|
*/
|
|
103
107
|
export function useModule(defaultFn = null) {
|
|
104
108
|
return (plugins, options = {}) => {
|
|
105
|
-
plugins = _.isArray(plugins)
|
|
106
|
-
? plugins
|
|
107
|
-
: [
|
|
108
|
-
plugins
|
|
109
|
-
];
|
|
109
|
+
plugins = _.isArray(plugins) ? plugins : [plugins];
|
|
110
110
|
plugins.forEach((plugin) => {
|
|
111
111
|
if (Array.isArray(plugin)) {
|
|
112
112
|
plugin.forEach((p) => registerModule(p, defaultFn, options));
|
|
@@ -126,4 +126,4 @@ export function useModule(defaultFn = null) {
|
|
|
126
126
|
Formio.use = useModule();
|
|
127
127
|
export { Formio as FormioCore } from './Formio';
|
|
128
128
|
// Export the components.
|
|
129
|
-
export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform, DefaultEvaluator, FormOptions };
|
|
129
|
+
export { Components, Displays, Providers, Widgets, Templates, Utils, Form, Formio, Licenses, EventEmitter, Webform, DefaultEvaluator, FormOptions, };
|
package/lib/mjs/package.json
CHANGED
|
@@ -88,7 +88,7 @@ export class AddressProvider {
|
|
|
88
88
|
*/
|
|
89
89
|
serialize(params) {
|
|
90
90
|
return _.toPairs(params)
|
|
91
|
-
.map(([key, value
|
|
91
|
+
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
|
92
92
|
.join('&');
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
@@ -124,9 +124,7 @@ export class GoogleAddressProvider extends AddressProvider {
|
|
|
124
124
|
if (countryCodes[region]) {
|
|
125
125
|
region = countryCodes[region];
|
|
126
126
|
}
|
|
127
|
-
_.set(providerOptions, 'params.autocompleteOptions.componentRestrictions.country', [
|
|
128
|
-
region,
|
|
129
|
-
]);
|
|
127
|
+
_.set(providerOptions, 'params.autocompleteOptions.componentRestrictions.country', [region]);
|
|
130
128
|
}
|
|
131
129
|
}
|
|
132
130
|
/**
|
|
@@ -20,9 +20,7 @@ const fileProcessor = (formio, config) => (file, options) => new Promise((resolv
|
|
|
20
20
|
xhr.onload = () => {
|
|
21
21
|
if (xhr.status >= 200 && xhr.status < 300) {
|
|
22
22
|
const mimetype = xhr.getResponseHeader('Content-Type') || file.type;
|
|
23
|
-
resolve(new File([
|
|
24
|
-
xhr.response,
|
|
25
|
-
], file.name, { type: mimetype }));
|
|
23
|
+
resolve(new File([xhr.response], file.name, { type: mimetype }));
|
|
26
24
|
}
|
|
27
25
|
else {
|
|
28
26
|
reject(xhr.response || 'Unable to process file');
|
|
@@ -15,10 +15,7 @@ function azure(formio) {
|
|
|
15
15
|
}, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback).then((response) => {
|
|
16
16
|
return {
|
|
17
17
|
storage: 'azure',
|
|
18
|
-
name: XHR.path([
|
|
19
|
-
dir,
|
|
20
|
-
fileName,
|
|
21
|
-
]),
|
|
18
|
+
name: XHR.path([dir, fileName]),
|
|
22
19
|
size: file.size,
|
|
23
20
|
type: file.type,
|
|
24
21
|
groupPermissions,
|
|
@@ -30,10 +27,12 @@ function azure(formio) {
|
|
|
30
27
|
downloadFile(file) {
|
|
31
28
|
return formio.makeRequest('file', `${formio.formUrl}/storage/azure?name=${XHR.trim(file.name)}`, 'GET');
|
|
32
29
|
},
|
|
33
|
-
deleteFile(fileInfo,
|
|
30
|
+
deleteFile(fileInfo, _options) {
|
|
34
31
|
const name = XHR.trim(fileInfo.name);
|
|
35
32
|
const key = XHR.trim(fileInfo.key);
|
|
36
|
-
return formio
|
|
33
|
+
return formio
|
|
34
|
+
.makeRequest('', `${formio.formUrl}/storage/azure?name=${encodeURIComponent(name)}&key=${encodeURIComponent(key)}`, 'delete')
|
|
35
|
+
.then((response) => {
|
|
37
36
|
return {
|
|
38
37
|
success: true,
|
|
39
38
|
key: response?.key || key,
|
|
@@ -26,9 +26,7 @@ function indexeddb() {
|
|
|
26
26
|
const reader = new FileReader();
|
|
27
27
|
return new Promise((resolve, reject) => {
|
|
28
28
|
reader.onload = () => {
|
|
29
|
-
const blobObject = new Blob([
|
|
30
|
-
file,
|
|
31
|
-
], { type: file.type });
|
|
29
|
+
const blobObject = new Blob([file], { type: file.type });
|
|
32
30
|
const id = uuidv4(blobObject);
|
|
33
31
|
const data = {
|
|
34
32
|
id,
|
|
@@ -38,9 +36,7 @@ function indexeddb() {
|
|
|
38
36
|
type: file.type,
|
|
39
37
|
url,
|
|
40
38
|
};
|
|
41
|
-
const trans = db.transaction([
|
|
42
|
-
options.indexeddbTable,
|
|
43
|
-
], 'readwrite');
|
|
39
|
+
const trans = db.transaction([options.indexeddbTable], 'readwrite');
|
|
44
40
|
const addReq = trans.objectStore(options.indexeddbTable).put(data, id);
|
|
45
41
|
addReq.onerror = function (e) {
|
|
46
42
|
console.log('error storing data');
|
|
@@ -73,16 +69,12 @@ function indexeddb() {
|
|
|
73
69
|
};
|
|
74
70
|
}).then((db) => {
|
|
75
71
|
return new Promise((resolve, reject) => {
|
|
76
|
-
const trans = db.transaction([
|
|
77
|
-
options.indexeddbTable,
|
|
78
|
-
], 'readonly');
|
|
72
|
+
const trans = db.transaction([options.indexeddbTable], 'readonly');
|
|
79
73
|
const store = trans.objectStore(options.indexeddbTable).get(file.id);
|
|
80
74
|
store.onsuccess = () => {
|
|
81
75
|
trans.oncomplete = () => {
|
|
82
76
|
const result = store.result;
|
|
83
|
-
const dbFile = new File([
|
|
84
|
-
store.result.data,
|
|
85
|
-
], file.name, {
|
|
77
|
+
const dbFile = new File([store.result.data], file.name, {
|
|
86
78
|
type: store.result.type,
|
|
87
79
|
});
|
|
88
80
|
const reader = new FileReader();
|
|
@@ -112,9 +104,7 @@ function indexeddb() {
|
|
|
112
104
|
};
|
|
113
105
|
}).then((db) => {
|
|
114
106
|
return new Promise((resolve, reject) => {
|
|
115
|
-
const trans = db.transaction([
|
|
116
|
-
options.indexeddbTable,
|
|
117
|
-
], 'readwrite');
|
|
107
|
+
const trans = db.transaction([options.indexeddbTable], 'readwrite');
|
|
118
108
|
const store = trans.objectStore(options.indexeddbTable).delete(file.id);
|
|
119
109
|
store.onsuccess = () => {
|
|
120
110
|
trans.oncomplete = () => {
|
|
@@ -15,11 +15,7 @@ function s3(formio) {
|
|
|
15
15
|
async uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback, multipartOptions) {
|
|
16
16
|
const xhrCallback = async (xhr, response, abortCallback) => {
|
|
17
17
|
response.data.fileName = fileName;
|
|
18
|
-
response.data.key = XHR.path([
|
|
19
|
-
response.data.key,
|
|
20
|
-
dir,
|
|
21
|
-
fileName,
|
|
22
|
-
]);
|
|
18
|
+
response.data.key = XHR.path([response.data.key, dir, fileName]);
|
|
23
19
|
if (response.signed) {
|
|
24
20
|
if (multipartOptions && Array.isArray(response.signed)) {
|
|
25
21
|
// patch abort callback
|
|
@@ -31,11 +27,7 @@ function s3(formio) {
|
|
|
31
27
|
}
|
|
32
28
|
try {
|
|
33
29
|
const parts = await this.uploadParts(file, response.signed, response.data.headers, response.partSizeActual, multipartOptions, abortSignal);
|
|
34
|
-
await withRetries(this.completeMultipartUpload, [
|
|
35
|
-
response,
|
|
36
|
-
parts,
|
|
37
|
-
multipartOptions,
|
|
38
|
-
], 3);
|
|
30
|
+
await withRetries(this.completeMultipartUpload, [response, parts, multipartOptions], 3);
|
|
39
31
|
return;
|
|
40
32
|
}
|
|
41
33
|
catch (err) {
|
|
@@ -73,10 +65,7 @@ function s3(formio) {
|
|
|
73
65
|
name: fileName,
|
|
74
66
|
bucket: response.bucket,
|
|
75
67
|
key: response.data.key,
|
|
76
|
-
url: XHR.path([
|
|
77
|
-
response.url,
|
|
78
|
-
response.data.key,
|
|
79
|
-
]),
|
|
68
|
+
url: XHR.path([response.url, response.data.key]),
|
|
80
69
|
acl: response.data.acl,
|
|
81
70
|
size: file.size,
|
|
82
71
|
type: file.type,
|
|
@@ -24,45 +24,32 @@ const XHR = {
|
|
|
24
24
|
.join('/');
|
|
25
25
|
},
|
|
26
26
|
async upload(formio, type, xhrCallback, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback, multipartOptions) {
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
let response;
|
|
27
|
+
// Use makeRequest so portal plugins (e.g. x-remote-token) are applied.
|
|
28
|
+
let serverResponse;
|
|
30
29
|
try {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
body: JSON.stringify({
|
|
39
|
-
name: XHR.path([
|
|
40
|
-
dir,
|
|
41
|
-
fileName,
|
|
42
|
-
]),
|
|
43
|
-
size: file.size,
|
|
44
|
-
type: file.type,
|
|
45
|
-
groupPermissions,
|
|
46
|
-
groupId,
|
|
47
|
-
multipart: multipartOptions,
|
|
48
|
-
}),
|
|
30
|
+
serverResponse = await formio.makeRequest('file', `${formio.formUrl}/storage/${type}`, 'POST', {
|
|
31
|
+
name: XHR.path([dir, fileName]),
|
|
32
|
+
size: file.size,
|
|
33
|
+
type: file.type,
|
|
34
|
+
groupPermissions,
|
|
35
|
+
groupId,
|
|
36
|
+
multipart: multipartOptions,
|
|
49
37
|
});
|
|
50
38
|
}
|
|
51
39
|
catch (err) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
40
|
+
if (err?.networkError) {
|
|
41
|
+
throw err;
|
|
42
|
+
}
|
|
43
|
+
if (err instanceof Error) {
|
|
44
|
+
throw err;
|
|
45
|
+
}
|
|
46
|
+
const message = typeof err === 'string' ? err : err?.message || err?.error;
|
|
47
|
+
const error = new Error(message || 'Unable to sign file.');
|
|
48
|
+
if (err?.status === 504) {
|
|
59
49
|
error.networkError = true;
|
|
60
|
-
throw error;
|
|
61
50
|
}
|
|
62
|
-
|
|
63
|
-
throw new Error(message || 'Unable to sign file.');
|
|
51
|
+
throw error;
|
|
64
52
|
}
|
|
65
|
-
const serverResponse = await response.json();
|
|
66
53
|
return await XHR.makeXhrRequest(formio, xhrCallback, serverResponse, progressCallback, abortCallback);
|
|
67
54
|
},
|
|
68
55
|
makeXhrRequest(formio, xhrCallback, serverResponse, progressCallback, abortCallback) {
|