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