@formio/js 5.1.0-dev.6059.845a6e3 → 5.1.0-dev.6060.19e3bfc
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/Changelog.md +131 -13
- package/README.md +28 -1
- package/dist/formio.builder.css +19 -17
- 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 +19 -17
- package/dist/formio.form.js +102 -176
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -3
- package/dist/formio.full.css +19 -17
- package/dist/formio.full.js +123 -101
- package/dist/formio.full.min.css +2 -2
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -3
- package/dist/formio.js +10 -10
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +3 -3
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/CDN.d.ts +1 -1
- package/lib/cjs/CDN.js +2 -2
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Form.d.ts +4 -6
- package/lib/cjs/Form.js +16 -8
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDFBuilder.js +4 -4
- package/lib/cjs/Webform.d.ts +16 -13
- package/lib/cjs/Webform.js +162 -148
- package/lib/cjs/WebformBuilder.js +17 -28
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/WizardBuilder.js +15 -2
- package/lib/cjs/components/Components.d.ts +3 -0
- package/lib/cjs/components/_classes/component/Component.d.ts +1 -0
- package/lib/cjs/components/_classes/component/Component.js +38 -11
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +37 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +32 -2
- package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/cjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/cjs/components/_classes/input/Input.js +23 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +10 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +52 -31
- package/lib/cjs/components/address/Address.js +14 -1
- package/lib/cjs/components/button/Button.js +6 -6
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +2 -2
- package/lib/cjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +2 -0
- package/lib/cjs/components/datagrid/DataGrid.js +41 -26
- package/lib/cjs/components/day/Day.js +9 -7
- package/lib/cjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +26 -8
- package/lib/cjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/cjs/components/file/File.d.ts +1 -1
- package/lib/cjs/components/file/File.js +30 -19
- package/lib/cjs/components/form/Form.d.ts +1 -1
- package/lib/cjs/components/form/Form.js +9 -5
- package/lib/cjs/components/form/editForm/Form.edit.form.js +3 -3
- package/lib/cjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/cjs/components/hidden/Hidden.js +1 -1
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/cjs/components/number/Number.js +12 -5
- package/lib/cjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/cjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/cjs/components/radio/Radio.js +10 -0
- package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/cjs/components/select/Select.d.ts +0 -1
- package/lib/cjs/components/select/Select.js +12 -33
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +3 -2
- package/lib/cjs/components/selectboxes/SelectBoxes.js +2 -2
- package/lib/cjs/components/signature/Signature.d.ts +1 -1
- package/lib/cjs/components/signature/Signature.js +5 -3
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/cjs/components/survey/Survey.js +2 -2
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/cjs/components/tags/Tags.d.ts +1 -1
- package/lib/cjs/components/tags/Tags.js +2 -2
- package/lib/cjs/components/textarea/TextArea.js +6 -6
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/cjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/cjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/cjs/formio.form.js +5 -0
- package/lib/cjs/providers/storage/googleDrive.js +3 -2
- package/lib/cjs/providers/storage/s3.js +3 -3
- package/lib/cjs/providers/storage/xhr.d.ts +1 -0
- package/lib/cjs/providers/storage/xhr.js +6 -1
- package/lib/cjs/translations/en.d.ts +234 -81
- package/lib/cjs/translations/en.js +8 -81
- package/lib/cjs/utils/ChoicesWrapper.d.ts +4 -25
- package/lib/cjs/utils/ChoicesWrapper.js +47 -124
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/i18n.d.ts +5 -2
- package/lib/cjs/utils/i18n.js +32 -5
- package/lib/cjs/widgets/CalendarWidget.js +27 -27
- package/lib/mjs/CDN.d.ts +1 -1
- package/lib/mjs/CDN.js +2 -2
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Form.d.ts +4 -6
- package/lib/mjs/Form.js +17 -9
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +4 -4
- package/lib/mjs/Webform.d.ts +16 -13
- package/lib/mjs/Webform.js +171 -158
- package/lib/mjs/WebformBuilder.js +17 -28
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/WizardBuilder.js +15 -2
- package/lib/mjs/components/Components.d.ts +3 -0
- package/lib/mjs/components/_classes/component/Component.d.ts +1 -0
- package/lib/mjs/components/_classes/component/Component.js +27 -11
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +37 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +32 -2
- package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/mjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/mjs/components/_classes/input/Input.js +22 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +10 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +53 -31
- package/lib/mjs/components/address/Address.js +14 -1
- package/lib/mjs/components/button/Button.js +6 -6
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +2 -2
- package/lib/mjs/components/content/editForm/Content.edit.display.js +8 -0
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +2 -0
- package/lib/mjs/components/datagrid/DataGrid.js +41 -26
- package/lib/mjs/components/day/Day.js +9 -7
- package/lib/mjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +25 -7
- package/lib/mjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/mjs/components/file/File.d.ts +1 -1
- package/lib/mjs/components/file/File.js +30 -19
- package/lib/mjs/components/form/Form.d.ts +1 -1
- package/lib/mjs/components/form/Form.js +8 -5
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -3
- package/lib/mjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/mjs/components/hidden/Hidden.js +1 -1
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/mjs/components/number/Number.js +12 -5
- package/lib/mjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/mjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/mjs/components/radio/Radio.js +10 -0
- package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/mjs/components/select/Select.d.ts +0 -1
- package/lib/mjs/components/select/Select.js +14 -34
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +3 -2
- package/lib/mjs/components/selectboxes/SelectBoxes.js +2 -2
- package/lib/mjs/components/signature/Signature.d.ts +1 -1
- package/lib/mjs/components/signature/Signature.js +5 -3
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/mjs/components/survey/Survey.js +2 -2
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- package/lib/mjs/components/tags/Tags.d.ts +1 -1
- package/lib/mjs/components/tags/Tags.js +2 -2
- package/lib/mjs/components/textarea/TextArea.js +6 -6
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +12 -0
- package/lib/mjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/mjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/mjs/formio.form.js +5 -0
- package/lib/mjs/providers/storage/googleDrive.js +3 -2
- package/lib/mjs/providers/storage/s3.js +3 -3
- package/lib/mjs/providers/storage/xhr.d.ts +1 -0
- package/lib/mjs/providers/storage/xhr.js +6 -1
- package/lib/mjs/translations/en.d.ts +234 -81
- package/lib/mjs/translations/en.js +87 -1
- package/lib/mjs/utils/ChoicesWrapper.d.ts +4 -25
- package/lib/mjs/utils/ChoicesWrapper.js +26 -119
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/i18n.d.ts +5 -2
- package/lib/mjs/utils/i18n.js +32 -5
- package/lib/mjs/widgets/CalendarWidget.js +27 -27
- package/package.json +27 -11
@@ -159,7 +159,9 @@ class SignatureComponent extends Input_1.default {
|
|
159
159
|
if (this.dataValue) {
|
160
160
|
this.setDataToSigaturePad();
|
161
161
|
}
|
162
|
-
this.
|
162
|
+
if (!this.disabled) {
|
163
|
+
this.showCanvas(true);
|
164
|
+
}
|
163
165
|
}
|
164
166
|
}
|
165
167
|
renderElement(value, index) {
|
@@ -175,7 +177,7 @@ class SignatureComponent extends Input_1.default {
|
|
175
177
|
return this.renderModalPreview({
|
176
178
|
previewText: this.dataValue ?
|
177
179
|
`<img src=${this.dataValue} ${this._referenceAttributeName}='openModal' style="width: 100%;height: 100%;" />` :
|
178
|
-
this.t('
|
180
|
+
this.t('clickToSign')
|
179
181
|
});
|
180
182
|
}
|
181
183
|
attach(element) {
|
@@ -243,7 +245,7 @@ class SignatureComponent extends Input_1.default {
|
|
243
245
|
if (lodash_1.default.isUndefined(value) && this.inDataTable) {
|
244
246
|
return '';
|
245
247
|
}
|
246
|
-
return value ? '
|
248
|
+
return this.t(value ? 'yes' : 'no');
|
247
249
|
}
|
248
250
|
focus() {
|
249
251
|
this.refs.padBody.focus();
|
@@ -7,7 +7,6 @@ declare const _default: ({
|
|
7
7
|
placeholder: string;
|
8
8
|
weight: number;
|
9
9
|
conditional?: undefined;
|
10
|
-
customConditional?: undefined;
|
11
10
|
ignore?: undefined;
|
12
11
|
} | {
|
13
12
|
type: string;
|
@@ -24,7 +23,6 @@ declare const _default: ({
|
|
24
23
|
};
|
25
24
|
};
|
26
25
|
weight: number;
|
27
|
-
customConditional?: undefined;
|
28
26
|
ignore?: undefined;
|
29
27
|
} | {
|
30
28
|
weight: number;
|
@@ -32,9 +30,6 @@ declare const _default: ({
|
|
32
30
|
label: string;
|
33
31
|
tooltip: string;
|
34
32
|
key: string;
|
35
|
-
customConditional: ({ options }: {
|
36
|
-
options: any;
|
37
|
-
}) => boolean;
|
38
33
|
input: boolean;
|
39
34
|
placeholder?: undefined;
|
40
35
|
conditional?: undefined;
|
@@ -49,6 +44,5 @@ declare const _default: ({
|
|
49
44
|
placeholder?: undefined;
|
50
45
|
weight?: undefined;
|
51
46
|
conditional?: undefined;
|
52
|
-
customConditional?: undefined;
|
53
47
|
})[];
|
54
48
|
export default _default;
|
@@ -39,7 +39,6 @@ exports.default = [
|
|
39
39
|
label: 'Keep Overlay Aspect Ratio',
|
40
40
|
tooltip: 'If checked, the field will have the same aspect ratio as its preview.',
|
41
41
|
key: 'keepOverlayRatio',
|
42
|
-
customConditional: ({ options }) => { var _a; return (((_a = options === null || options === void 0 ? void 0 : options.editForm) === null || _a === void 0 ? void 0 : _a.display) === 'pdf'); },
|
43
42
|
input: true
|
44
43
|
},
|
45
44
|
{
|
@@ -128,8 +128,8 @@ class SurveyComponent extends Field_1.default {
|
|
128
128
|
<table border="1" style="width:100%">
|
129
129
|
<thead>
|
130
130
|
<tr>
|
131
|
-
<th
|
132
|
-
<th
|
131
|
+
<th>${this.t('surveyQuestion')}</th>
|
132
|
+
<th>${this.t('surveyQuestionValue')}</th>
|
133
133
|
</tr>
|
134
134
|
</thead>
|
135
135
|
<tbody>
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const utils_1 = require("../../utils/utils");
|
7
7
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
8
|
-
const choices_js_1 = __importDefault(require("
|
8
|
+
const choices_js_1 = __importDefault(require("choices.js"));
|
9
9
|
class TagsComponent extends Input_1.default {
|
10
10
|
static schema(...extend) {
|
11
11
|
return Input_1.default.schema({
|
@@ -129,7 +129,7 @@ class TagsComponent extends Input_1.default {
|
|
129
129
|
const changed = super.setValue(value, flags);
|
130
130
|
if (this.choices) {
|
131
131
|
let dataValue = this.dataValue;
|
132
|
-
this.choices.
|
132
|
+
this.choices.clearStore();
|
133
133
|
if (dataValue) {
|
134
134
|
if (typeof dataValue === 'string') {
|
135
135
|
dataValue = dataValue.split(this.delimiter).filter(result => result);
|
@@ -136,7 +136,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
136
136
|
case 'quill':
|
137
137
|
// Normalize the configurations for quill.
|
138
138
|
if (settings.hasOwnProperty('toolbarGroups') || settings.hasOwnProperty('toolbar')) {
|
139
|
-
console.warn(
|
139
|
+
console.warn(this.t('needConfigurationForQuill'));
|
140
140
|
settings = this.wysiwygDefault.quill;
|
141
141
|
}
|
142
142
|
// Add the quill editor.
|
@@ -208,7 +208,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
208
208
|
imageHandler(moduleInstance, range, files) {
|
209
209
|
const quillInstance = moduleInstance.quill;
|
210
210
|
if (!files || !files.length) {
|
211
|
-
console.warn('
|
211
|
+
console.warn(this.t('noFilesSelected'));
|
212
212
|
return;
|
213
213
|
}
|
214
214
|
quillInstance.enable(false);
|
@@ -233,7 +233,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
233
233
|
alt: JSON.stringify(requestData),
|
234
234
|
}), Quill.sources.USER);
|
235
235
|
}).catch(error => {
|
236
|
-
console.warn('
|
236
|
+
console.warn(this.t('quillImageUploadFailed'));
|
237
237
|
console.warn(error);
|
238
238
|
quillInstance.enable(true);
|
239
239
|
});
|
@@ -530,7 +530,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
530
530
|
}
|
531
531
|
this.element.scrollIntoView();
|
532
532
|
}).catch((err) => {
|
533
|
-
console.warn('
|
533
|
+
console.warn(this.t('editorFocusError'), err);
|
534
534
|
});
|
535
535
|
break;
|
536
536
|
}
|
@@ -539,7 +539,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
539
539
|
this.editors[0].focus();
|
540
540
|
this.element.scrollIntoView();
|
541
541
|
}).catch((err) => {
|
542
|
-
console.warn('
|
542
|
+
console.warn(this.t('editorFocusError'), err);
|
543
543
|
});
|
544
544
|
break;
|
545
545
|
}
|
@@ -547,7 +547,7 @@ class TextAreaComponent extends TextField_1.default {
|
|
547
547
|
(_c = this.editorsReady[0]) === null || _c === void 0 ? void 0 : _c.then(() => {
|
548
548
|
this.editors[0].focus();
|
549
549
|
}).catch((err) => {
|
550
|
-
console.warn('
|
550
|
+
console.warn(this.t('editorFocusError'), err);
|
551
551
|
});
|
552
552
|
break;
|
553
553
|
}
|
@@ -14,10 +14,22 @@ exports.default = [
|
|
14
14
|
key: 'allowMultipleMasks',
|
15
15
|
ignore: true
|
16
16
|
},
|
17
|
+
{
|
18
|
+
key: 'inputMasks',
|
19
|
+
ignore: true
|
20
|
+
},
|
17
21
|
{
|
18
22
|
key: 'mask',
|
19
23
|
ignore: true
|
20
24
|
},
|
25
|
+
{
|
26
|
+
key: 'widget.type',
|
27
|
+
ignore: true
|
28
|
+
},
|
29
|
+
{
|
30
|
+
key: 'widget',
|
31
|
+
ignore: true
|
32
|
+
},
|
21
33
|
{
|
22
34
|
type: 'number',
|
23
35
|
input: true,
|
@@ -9,6 +9,18 @@ exports.default = [
|
|
9
9
|
key: 'allowMultipleMasks',
|
10
10
|
ignore: true
|
11
11
|
},
|
12
|
+
{
|
13
|
+
key: 'inputMasks',
|
14
|
+
ignore: true
|
15
|
+
},
|
16
|
+
{
|
17
|
+
key: 'widget.type',
|
18
|
+
ignore: true
|
19
|
+
},
|
20
|
+
{
|
21
|
+
key: 'widget',
|
22
|
+
ignore: true
|
23
|
+
},
|
12
24
|
{
|
13
25
|
key: 'showWordCount',
|
14
26
|
ignore: true,
|
package/lib/cjs/formio.form.js
CHANGED
@@ -29,6 +29,7 @@ const EventEmitter_1 = __importDefault(require("./EventEmitter"));
|
|
29
29
|
exports.EventEmitter = EventEmitter_1.default;
|
30
30
|
const Webform_1 = __importDefault(require("./Webform"));
|
31
31
|
exports.Webform = Webform_1.default;
|
32
|
+
const i18n_1 = require("./utils/i18n");
|
32
33
|
Formio_1.Formio.loadModules = (path = `${Formio_1.Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
|
33
34
|
Formio_1.Formio.requireLibrary(name, name, path, true)
|
34
35
|
.then((modules) => {
|
@@ -73,6 +74,7 @@ function registerModule(mod, defaultFn = null, options = {}) {
|
|
73
74
|
case 'templates':
|
74
75
|
for (const framework of Object.keys(mod.templates)) {
|
75
76
|
Formio_1.Formio.Templates.extendTemplate(framework, mod.templates[framework]);
|
77
|
+
Formio_1.Formio.Templates.defaultTemplates = lodash_1.default.defaults(mod.templates[framework], Formio_1.Formio.Templates.defaultTemplates);
|
76
78
|
}
|
77
79
|
if (mod.templates[current]) {
|
78
80
|
Formio_1.Formio.Templates.current = mod.templates[current];
|
@@ -100,6 +102,9 @@ function registerModule(mod, defaultFn = null, options = {}) {
|
|
100
102
|
case 'evaluator':
|
101
103
|
Formio_1.Formio.Evaluator.registerEvaluator(mod.evaluator);
|
102
104
|
break;
|
105
|
+
case 'translations':
|
106
|
+
i18n_1.I18n.setDefaultTranslations(mod.translations);
|
107
|
+
break;
|
103
108
|
case 'library':
|
104
109
|
options.license
|
105
110
|
? Formio_1.Formio.Licenses.addLicense(mod.library, options.license)
|
@@ -52,10 +52,11 @@ function googledrive(formio) {
|
|
52
52
|
xhr.send(fd);
|
53
53
|
}));
|
54
54
|
},
|
55
|
-
downloadFile(file) {
|
55
|
+
downloadFile(file, component) {
|
56
56
|
const token = formio.getToken();
|
57
|
+
// Constructed the url with the fileId, fileName, displayImage, imageSize if applicable
|
57
58
|
file.url =
|
58
|
-
`${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}`;
|
59
|
+
`${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}${component.image ? '&displayImage=true' : ''}${component.imageSize ? `&imageSize=${component.imageSize}` : ''}`;
|
59
60
|
return Promise.resolve(file);
|
60
61
|
},
|
61
62
|
deleteFile: function deleteFile(fileInfo) {
|
@@ -115,7 +115,7 @@ function s3(formio) {
|
|
115
115
|
const { changeMessage } = multipart;
|
116
116
|
changeMessage('Completing AWS S3 multipart upload...');
|
117
117
|
const token = formio.getToken();
|
118
|
-
const response = yield fetch(`${formio.formUrl}/storage/s3/multipart/complete`, {
|
118
|
+
const response = yield xhr_1.default.fetch(`${formio.formUrl}/storage/s3/multipart/complete`, {
|
119
119
|
method: 'POST',
|
120
120
|
headers: Object.assign({ 'Content-Type': 'application/json' }, (token ? { 'x-jwt-token': token } : {})),
|
121
121
|
body: JSON.stringify({ parts, uploadId: serverResponse.uploadId, key: serverResponse.key })
|
@@ -134,7 +134,7 @@ function s3(formio) {
|
|
134
134
|
abortMultipartUpload(serverResponse) {
|
135
135
|
const { uploadId, key } = serverResponse;
|
136
136
|
const token = formio.getToken();
|
137
|
-
fetch(`${formio.formUrl}/storage/s3/multipart/abort`, {
|
137
|
+
xhr_1.default.fetch(`${formio.formUrl}/storage/s3/multipart/abort`, {
|
138
138
|
method: 'POST',
|
139
139
|
headers: Object.assign({ 'Content-Type': 'application/json' }, (token ? { 'x-jwt-token': token } : {})),
|
140
140
|
body: JSON.stringify({ uploadId, key })
|
@@ -148,7 +148,7 @@ function s3(formio) {
|
|
148
148
|
const start = i * partSize;
|
149
149
|
const end = (i + 1) * partSize;
|
150
150
|
const blob = i < urls.length ? file.slice(start, end) : file.slice(start);
|
151
|
-
const promise = fetch(urls[i], {
|
151
|
+
const promise = xhr_1.default.fetch(urls[i], {
|
152
152
|
method: 'PUT',
|
153
153
|
headers,
|
154
154
|
body: blob,
|
@@ -3,6 +3,7 @@ export default XHR;
|
|
3
3
|
declare namespace XHR {
|
4
4
|
function trim(text: any): any;
|
5
5
|
function path(items: any): any;
|
6
|
+
function fetch(url: any, options: any): Promise<Response>;
|
6
7
|
function upload(formio: any, type: any, xhrCallback: any, file: any, fileName: any, dir: any, progressCallback: any, groupPermissions: any, groupId: any, abortCallback: any, multipartOptions: any): Promise<any>;
|
7
8
|
function makeXhrRequest(formio: any, xhrCallback: any, serverResponse: any, progressCallback: any, abortCallback: any): Promise<any>;
|
8
9
|
}
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
15
15
|
exports.setXhrHeaders = void 0;
|
16
16
|
const trim_1 = __importDefault(require("lodash/trim"));
|
17
|
+
const Formio_1 = require("../../Formio");
|
17
18
|
const setXhrHeaders = (formio, xhr) => {
|
18
19
|
const { headers } = formio.options;
|
19
20
|
if (headers) {
|
@@ -36,13 +37,17 @@ const XHR = {
|
|
36
37
|
path(items) {
|
37
38
|
return items.filter(item => !!item).map(XHR.trim).join('/');
|
38
39
|
},
|
40
|
+
fetch(url, options) {
|
41
|
+
options = Formio_1.Formio.pluginAlter('requestOptions', options, url);
|
42
|
+
return fetch(url, options);
|
43
|
+
},
|
39
44
|
upload(formio, type, xhrCallback, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback, multipartOptions) {
|
40
45
|
return __awaiter(this, void 0, void 0, function* () {
|
41
46
|
// make request to Form.io server
|
42
47
|
const token = formio.getToken();
|
43
48
|
let response;
|
44
49
|
try {
|
45
|
-
response = yield fetch(`${formio.formUrl}/storage/${type}`, {
|
50
|
+
response = yield XHR.fetch(`${formio.formUrl}/storage/${type}`, {
|
46
51
|
method: 'POST',
|
47
52
|
headers: Object.assign({ 'Accept': 'application/json', 'Content-Type': 'application/json; charset=UTF-8' }, (token ? { 'x-jwt-token': token } : {})),
|
48
53
|
body: JSON.stringify({
|
@@ -1,82 +1,235 @@
|
|
1
|
-
declare
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
1
|
+
declare const _default: {
|
2
|
+
unsavedRowsError: string;
|
3
|
+
invalidRowsError: string;
|
4
|
+
invalidRowError: string;
|
5
|
+
invalidOption: string;
|
6
|
+
invalidDay: string;
|
7
|
+
alertMessageWithLabel: string;
|
8
|
+
alertMessage: string;
|
9
|
+
complete: string;
|
10
|
+
error: string;
|
11
|
+
errorListHotkey: string;
|
12
|
+
errorsListNavigationMessage: string;
|
13
|
+
submitError: string;
|
14
|
+
required: string;
|
15
|
+
unique: string;
|
16
|
+
array: string;
|
17
|
+
array_nonempty: string;
|
18
|
+
nonarray: string;
|
19
|
+
select: string;
|
20
|
+
pattern: string;
|
21
|
+
minLength: string;
|
22
|
+
maxLength: string;
|
23
|
+
minWords: string;
|
24
|
+
maxWords: string;
|
25
|
+
min: string;
|
26
|
+
max: string;
|
27
|
+
maxDate: string;
|
28
|
+
minDate: string;
|
29
|
+
maxYear: string;
|
30
|
+
minYear: string;
|
31
|
+
minSelectedCount: string;
|
32
|
+
maxSelectedCount: string;
|
33
|
+
invalid_email: string;
|
34
|
+
invalid_url: string;
|
35
|
+
invalid_regex: string;
|
36
|
+
invalid_date: string;
|
37
|
+
invalid_day: string;
|
38
|
+
invalidValueProperty: string;
|
39
|
+
mask: string;
|
40
|
+
valueIsNotAvailable: string;
|
41
|
+
stripe: string;
|
42
|
+
month: string;
|
43
|
+
day: string;
|
44
|
+
year: string;
|
45
|
+
january: string;
|
46
|
+
february: string;
|
47
|
+
march: string;
|
48
|
+
april: string;
|
49
|
+
may: string;
|
50
|
+
june: string;
|
51
|
+
july: string;
|
52
|
+
august: string;
|
53
|
+
september: string;
|
54
|
+
october: string;
|
55
|
+
november: string;
|
56
|
+
december: string;
|
57
|
+
next: string;
|
58
|
+
previous: string;
|
59
|
+
cancel: string;
|
60
|
+
submit: string;
|
61
|
+
confirmCancel: string;
|
62
|
+
saveDraftInstanceError: string;
|
63
|
+
saveDraftAuthError: string;
|
64
|
+
restoreDraftInstanceError: string;
|
65
|
+
saveDraftError: string;
|
66
|
+
restoreDraftError: string;
|
67
|
+
time: string;
|
68
|
+
cancelButtonAriaLabel: string;
|
69
|
+
previousButtonAriaLabel: string;
|
70
|
+
nextButtonAriaLabel: string;
|
71
|
+
submitButtonAriaLabel: string;
|
72
|
+
reCaptchaTokenValidationError: string;
|
73
|
+
reCaptchaTokenNotSpecifiedError: string;
|
74
|
+
apiKey: string;
|
75
|
+
typeRemaining: string;
|
76
|
+
typeCount: string;
|
77
|
+
requiredDayField: string;
|
78
|
+
requiredDayEmpty: string;
|
79
|
+
requiredMonthField: string;
|
80
|
+
requiredYearField: string;
|
81
|
+
formNotReady: string;
|
82
|
+
noFormElement: string;
|
83
|
+
notUniqueKey: string;
|
84
|
+
newFormSchema: string;
|
85
|
+
missingUrl: string;
|
86
|
+
urlNotAttachedToBtn: string;
|
87
|
+
loadingProjectSettingsError: string;
|
88
|
+
sessionStorageSupportError: string;
|
89
|
+
builderUniqueError: string;
|
90
|
+
pageNotFound: string;
|
91
|
+
noDragInfoError: string;
|
92
|
+
addonSupportTypeError: string;
|
93
|
+
setPathError: string;
|
94
|
+
calculatedPathDeprecation: string;
|
95
|
+
unknownTemplate: string;
|
96
|
+
unknownComponent: string;
|
97
|
+
renderTemplateFunctionDeprecation: string;
|
98
|
+
whenReadyDeprecation: string;
|
99
|
+
loadResourcesError: string;
|
100
|
+
noSelectDataConfiguration: string;
|
101
|
+
indexedDBSupportError: string;
|
102
|
+
caretPositionSavingError: string;
|
103
|
+
iteratableRowsError: string;
|
104
|
+
checkRowDeprecation: string;
|
105
|
+
noOAuthBtn: string;
|
106
|
+
noOAuthConfiguration: string;
|
107
|
+
oAuthErrorsTitle: string;
|
108
|
+
noOAuthFormUrl: string;
|
109
|
+
oAuthStateError: string;
|
110
|
+
componentInvalidRowValidation: string;
|
111
|
+
videoPlayerNotFound: string;
|
112
|
+
synchronizationFailed: string;
|
113
|
+
fileWithDuplicatedNameInProgress: string;
|
114
|
+
fileWithDuplicatedNameLoaded: string;
|
115
|
+
nestedForm: string;
|
116
|
+
noDataProvided: string;
|
117
|
+
subformSubmissionLoadingError: string;
|
118
|
+
noDelimiterSet: string;
|
119
|
+
noSiteKey: string;
|
120
|
+
failedToNormalize: string;
|
121
|
+
failedToCompareItems: string;
|
122
|
+
editorFocusError: string;
|
123
|
+
quillImageUploadFailed: string;
|
124
|
+
noFilesSelected: string;
|
125
|
+
needConfigurationForQuill: string;
|
126
|
+
waitPdfConverting: string;
|
127
|
+
uploading: string;
|
128
|
+
pasteBelow: string;
|
129
|
+
copy: string;
|
130
|
+
move: string;
|
131
|
+
edit: string;
|
132
|
+
editJson: string;
|
133
|
+
remove: string;
|
134
|
+
clickToSetValue: string;
|
135
|
+
words: string;
|
136
|
+
characters: string;
|
137
|
+
addAnother: string;
|
138
|
+
yes: string;
|
139
|
+
no: string;
|
140
|
+
wantToClearData: string;
|
141
|
+
yesDelete: string;
|
142
|
+
waitFileProcessing: string;
|
143
|
+
wrongFileType: string;
|
144
|
+
fileTooSmall: string;
|
145
|
+
fileTooBig: string;
|
146
|
+
noFileService: string;
|
147
|
+
fileProcessingFailed: string;
|
148
|
+
readyForUpload: string;
|
149
|
+
readyForRemovingFromStorage: string;
|
150
|
+
preparingFileToRemove: string;
|
151
|
+
succefullyRemoved: string;
|
152
|
+
succefullyUploaded: string;
|
153
|
+
maxSelectItems: string;
|
154
|
+
minSelectItems: string;
|
155
|
+
clickToSign: string;
|
156
|
+
surveyQuestion: string;
|
157
|
+
surveyQuestionValue: string;
|
158
|
+
success: string;
|
159
|
+
noResultsFound: string;
|
160
|
+
noChoices: string;
|
161
|
+
typeToSearch: string;
|
162
|
+
loading: string;
|
163
|
+
help: string;
|
164
|
+
component: string;
|
165
|
+
save: string;
|
166
|
+
preview: string;
|
167
|
+
dragAndDropComponent: string;
|
168
|
+
searchFields: string;
|
169
|
+
noMatchesFound: string;
|
170
|
+
fileName: string;
|
171
|
+
size: string;
|
172
|
+
type: string;
|
173
|
+
gallery: string;
|
174
|
+
camera: string;
|
175
|
+
dropFilesToAttach: string;
|
176
|
+
useCamera: string;
|
177
|
+
browse: string;
|
178
|
+
takePicture: string;
|
179
|
+
switchToFileUpload: string;
|
180
|
+
completeStatus: string;
|
181
|
+
noStorageSet: string;
|
182
|
+
noFileApiSupport: string;
|
183
|
+
noFormDataSupport: string;
|
184
|
+
noProgressSupport: string;
|
185
|
+
close: string;
|
186
|
+
addResource: string;
|
187
|
+
autocomplete: string;
|
188
|
+
showPreview: string;
|
189
|
+
hidePreview: string;
|
190
|
+
createPage: string;
|
191
|
+
page: string;
|
192
|
+
closeBtnDescription: string;
|
193
|
+
cancelBtnDescription: string;
|
194
|
+
saveBtnDescription: string;
|
195
|
+
addOrRemove: string;
|
196
|
+
anyFileTypesAllowed: string;
|
197
|
+
allowedFileTypes: string;
|
198
|
+
syncing: string;
|
199
|
+
syncNow: string;
|
200
|
+
pressToOpen: string;
|
201
|
+
browseToAttachFileFor: string;
|
202
|
+
or: string;
|
203
|
+
numericOnly: string;
|
204
|
+
uploadPdfFile: string;
|
205
|
+
dropToStart: string;
|
206
|
+
expand: string;
|
207
|
+
collapse: string;
|
208
|
+
add: string;
|
209
|
+
delete: string;
|
210
|
+
revert: string;
|
211
|
+
removeBtnPressToRemove: string;
|
212
|
+
file: string;
|
213
|
+
captureVideo: string;
|
214
|
+
captureAudio: string;
|
215
|
+
captureImage: string;
|
216
|
+
browseFiles: string;
|
217
|
+
noComponentsSetInGrid: string;
|
218
|
+
sortAscending: string;
|
219
|
+
sortDescending: string;
|
220
|
+
filter: string;
|
221
|
+
clear: string;
|
222
|
+
showItemsWithValue: string;
|
223
|
+
gridItemsPerPage: string;
|
224
|
+
gridAllItems: string;
|
225
|
+
recordsSelectedOnPage: string;
|
226
|
+
recordsSelectedInTable: string;
|
227
|
+
gridSelectAll: string;
|
228
|
+
itemsInTable: string;
|
229
|
+
clearSelection: string;
|
230
|
+
editGridRow: string;
|
231
|
+
deleteGridRow: string;
|
232
|
+
selected: string;
|
233
|
+
actions: string;
|
234
|
+
};
|
82
235
|
export default _default;
|