@formio/js 5.0.0-rc.52 → 5.0.0-rc.54
Sign up to get free protection for your applications and to get access to all the features.
- 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.js +551 -541
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -1
- package/dist/formio.full.js +553 -543
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -1
- 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 +14 -4
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +3 -1
- package/embed.d.ts +1 -0
- package/form.d.ts +1 -0
- package/lib/cjs/Form.d.ts +281 -10
- package/lib/cjs/Form.js +22 -35
- package/lib/cjs/FormBuilder.d.ts +187 -2
- package/lib/cjs/FormBuilder.js +29 -6
- package/lib/cjs/InlineEmbed.d.ts +7 -0
- package/lib/cjs/InlineEmbed.js +109 -0
- package/lib/cjs/PDF.d.ts +0 -1
- package/lib/cjs/Webform.d.ts +6 -6
- package/lib/cjs/Webform.js +2 -2
- package/lib/cjs/Wizard.d.ts +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -6
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -4
- package/lib/cjs/components/_classes/field/Field.d.ts +11 -2
- package/lib/cjs/components/_classes/field/Field.js +13 -1
- package/lib/cjs/components/_classes/input/Input.d.ts +4 -3
- package/lib/cjs/components/_classes/input/Input.js +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +4 -5
- package/lib/cjs/components/_classes/list/ListComponent.form.js +3 -2
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +42 -11
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +37 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +127 -33
- package/lib/cjs/components/_classes/nested/NestedComponent.js +133 -15
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +6 -0
- package/lib/cjs/components/address/Address.d.ts +2 -1
- package/lib/cjs/components/button/Button.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/columns/Columns.d.ts +1 -1
- package/lib/cjs/components/container/Container.d.ts +1 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/cjs/components/day/Day.d.ts +1 -1
- package/lib/cjs/components/editgrid/EditGrid.d.ts +2 -0
- package/lib/cjs/components/file/File.d.ts +2 -2
- package/lib/cjs/components/number/Number.d.ts +1 -1
- package/lib/cjs/components/radio/Radio.d.ts +1 -1
- package/lib/cjs/components/radio/Radio.form.d.ts +1 -3
- package/lib/cjs/components/radio/Radio.js +3 -3
- package/lib/cjs/components/select/Select.d.ts +9 -14
- package/lib/cjs/components/select/Select.form.d.ts +1 -3
- package/lib/cjs/components/select/Select.js +11 -15
- package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +1 -3
- package/lib/cjs/components/survey/Survey.d.ts +1 -1
- package/lib/cjs/components/table/Table.d.ts +1 -1
- package/lib/cjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/cjs/components/textfield/TextField.d.ts +1 -1
- package/lib/cjs/formio.embed.d.ts +1 -2
- package/lib/cjs/formio.embed.js +2 -100
- package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +1 -1
- package/lib/cjs/providers/address/NominatimAddressProvider.js +5 -1
- package/lib/cjs/providers/processor/fileProcessor.d.ts +7 -1
- package/lib/cjs/providers/processor/fileProcessor.js +6 -0
- package/lib/cjs/providers/storage/azure.d.ts +4 -15
- package/lib/cjs/providers/storage/azure.js +3 -2
- package/lib/cjs/providers/storage/base64.d.ts +3 -7
- package/lib/cjs/providers/storage/base64.js +2 -1
- package/lib/cjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/cjs/providers/storage/dropbox.js +3 -2
- package/lib/cjs/providers/storage/googleDrive.d.ts +4 -6
- package/lib/cjs/providers/storage/googleDrive.js +3 -1
- package/lib/cjs/providers/storage/indexeddb.d.ts +3 -8
- package/lib/cjs/providers/storage/indexeddb.js +2 -1
- package/lib/cjs/providers/storage/s3.d.ts +4 -22
- package/lib/cjs/providers/storage/s3.js +3 -2
- package/lib/cjs/providers/storage/url.d.ts +3 -8
- package/lib/cjs/providers/storage/url.js +4 -3
- package/lib/cjs/providers/storage/util.d.ts +22 -6
- package/lib/cjs/providers/storage/util.js +16 -5
- package/lib/cjs/utils/builder.d.ts +9 -7
- package/lib/cjs/utils/builder.js +10 -5
- package/lib/cjs/utils/calendarUtils.d.ts +6 -10
- package/lib/cjs/utils/calendarUtils.js +7 -11
- package/lib/cjs/utils/formUtils.d.ts +4 -4
- package/lib/cjs/utils/formUtils.js +3 -3
- package/lib/cjs/utils/utils.d.ts +123 -121
- package/lib/cjs/utils/utils.js +99 -94
- package/lib/mjs/Form.d.ts +281 -10
- package/lib/mjs/Form.js +112 -28
- package/lib/mjs/FormBuilder.d.ts +187 -2
- package/lib/mjs/FormBuilder.js +31 -6
- package/lib/mjs/InlineEmbed.d.ts +7 -0
- package/lib/mjs/InlineEmbed.js +105 -0
- package/lib/mjs/PDF.d.ts +0 -1
- package/lib/mjs/Webform.d.ts +6 -6
- package/lib/mjs/Webform.js +3 -3
- package/lib/mjs/Wizard.d.ts +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -6
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -4
- package/lib/mjs/components/_classes/field/Field.d.ts +11 -2
- package/lib/mjs/components/_classes/field/Field.js +13 -1
- package/lib/mjs/components/_classes/input/Input.d.ts +4 -3
- package/lib/mjs/components/_classes/input/Input.js +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +4 -5
- package/lib/mjs/components/_classes/list/ListComponent.form.js +3 -2
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +42 -11
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +37 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +127 -33
- package/lib/mjs/components/_classes/nested/NestedComponent.js +133 -15
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +6 -0
- package/lib/mjs/components/address/Address.d.ts +2 -1
- package/lib/mjs/components/button/Button.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/columns/Columns.d.ts +1 -1
- package/lib/mjs/components/container/Container.d.ts +1 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -1
- package/lib/mjs/components/day/Day.d.ts +1 -1
- package/lib/mjs/components/editgrid/EditGrid.d.ts +2 -0
- package/lib/mjs/components/file/File.d.ts +2 -2
- package/lib/mjs/components/number/Number.d.ts +1 -1
- package/lib/mjs/components/radio/Radio.d.ts +1 -1
- package/lib/mjs/components/radio/Radio.form.d.ts +1 -3
- package/lib/mjs/components/radio/Radio.js +3 -3
- package/lib/mjs/components/select/Select.d.ts +9 -14
- package/lib/mjs/components/select/Select.form.d.ts +1 -3
- package/lib/mjs/components/select/Select.js +11 -15
- package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +1 -3
- package/lib/mjs/components/survey/Survey.d.ts +1 -1
- package/lib/mjs/components/table/Table.d.ts +1 -1
- package/lib/mjs/components/tabs/Tabs.d.ts +1 -1
- package/lib/mjs/components/textfield/TextField.d.ts +1 -1
- package/lib/mjs/formio.embed.d.ts +1 -2
- package/lib/mjs/formio.embed.js +2 -99
- package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +1 -1
- package/lib/mjs/providers/address/NominatimAddressProvider.js +5 -1
- package/lib/mjs/providers/processor/fileProcessor.d.ts +7 -1
- package/lib/mjs/providers/processor/fileProcessor.js +6 -0
- package/lib/mjs/providers/storage/azure.d.ts +4 -15
- package/lib/mjs/providers/storage/azure.js +3 -2
- package/lib/mjs/providers/storage/base64.d.ts +3 -7
- package/lib/mjs/providers/storage/base64.js +2 -1
- package/lib/mjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/mjs/providers/storage/dropbox.js +3 -2
- package/lib/mjs/providers/storage/googleDrive.d.ts +4 -6
- package/lib/mjs/providers/storage/googleDrive.js +3 -1
- package/lib/mjs/providers/storage/indexeddb.d.ts +3 -8
- package/lib/mjs/providers/storage/indexeddb.js +2 -1
- package/lib/mjs/providers/storage/s3.d.ts +4 -22
- package/lib/mjs/providers/storage/s3.js +3 -2
- package/lib/mjs/providers/storage/url.d.ts +3 -8
- package/lib/mjs/providers/storage/url.js +4 -3
- package/lib/mjs/providers/storage/util.d.ts +22 -6
- package/lib/mjs/providers/storage/util.js +16 -5
- package/lib/mjs/utils/builder.d.ts +9 -7
- package/lib/mjs/utils/builder.js +10 -5
- package/lib/mjs/utils/calendarUtils.d.ts +6 -10
- package/lib/mjs/utils/calendarUtils.js +7 -11
- package/lib/mjs/utils/formUtils.d.ts +4 -4
- package/lib/mjs/utils/formUtils.js +3 -3
- package/lib/mjs/utils/utils.d.ts +123 -121
- package/lib/mjs/utils/utils.js +99 -94
- package/package.json +17 -13
- package/sdk.d.ts +1 -0
- package/utils.d.ts +1 -0
@@ -357,9 +357,9 @@ class RadioComponent extends ListComponent_1.default {
|
|
357
357
|
return changed;
|
358
358
|
}
|
359
359
|
/**
|
360
|
-
* Normalize values coming into updateValue.
|
361
|
-
* @param value
|
362
|
-
* @returns {*}
|
360
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
361
|
+
* @param {*} value - The value to normalize
|
362
|
+
* @returns {*} - Returns the normalized value
|
363
363
|
*/
|
364
364
|
normalizeValue(value) {
|
365
365
|
const dataType = this.component.dataType || 'auto';
|
@@ -44,12 +44,12 @@ export default class SelectComponent extends ListComponent {
|
|
44
44
|
itemTemplate(data: any, value: any): any;
|
45
45
|
/**
|
46
46
|
* Adds an option to the select dropdown.
|
47
|
-
* @param value
|
48
|
-
* @param label
|
49
|
-
* @param attrs
|
50
|
-
* @param id
|
47
|
+
* @param {*} value - The value of the new option.
|
48
|
+
* @param {string} label - The label of the new option.
|
49
|
+
* @param {object} [attrs] - Additional value attributes. Defaults to {}.
|
50
|
+
* @param {string} [id] - An id. Defaults to a random string.
|
51
51
|
*/
|
52
|
-
addOption(value: any, label:
|
52
|
+
addOption(value: any, label: string, attrs?: object | undefined, id?: string | undefined): void;
|
53
53
|
addValueOptions(items: any): boolean;
|
54
54
|
disableInfiniteScroll(): void;
|
55
55
|
set serverCount(value: any);
|
@@ -77,7 +77,7 @@ export default class SelectComponent extends ListComponent {
|
|
77
77
|
activate(): void;
|
78
78
|
setLoadingItem(addToCurrentList?: boolean): void;
|
79
79
|
get active(): boolean | undefined;
|
80
|
-
render():
|
80
|
+
render(): import("../_classes/field/Field").default;
|
81
81
|
wrapElement(element: any): any;
|
82
82
|
choicesOptions(): any;
|
83
83
|
attach(element: any): Promise<void> | undefined;
|
@@ -93,13 +93,7 @@ export default class SelectComponent extends ListComponent {
|
|
93
93
|
attachRefreshOnBlur(): void;
|
94
94
|
addPlaceholderItem(placeholderValue: any): void;
|
95
95
|
update(): void;
|
96
|
-
|
97
|
-
* @param {*} value
|
98
|
-
* @param values
|
99
|
-
* @param {Array} items
|
100
|
-
* @param keyValue
|
101
|
-
*/
|
102
|
-
addCurrentChoices(values: any, items: any[], keyValue: any): any;
|
96
|
+
addCurrentChoices(values: any, items: any, keyValue: any): any;
|
103
97
|
getValueAsString(data: any, options: any): any;
|
104
98
|
normalizeSingleValue(value: any): any;
|
105
99
|
setMetadata(value: any): any;
|
@@ -113,11 +107,12 @@ export default class SelectComponent extends ListComponent {
|
|
113
107
|
/**
|
114
108
|
* Performs required transformations on the initial value to use in selectOptions
|
115
109
|
* @param {*} value
|
110
|
+
* @returns {*} - Returns the options value.
|
116
111
|
*/
|
117
112
|
getOptionValue(value: any): any;
|
118
113
|
/**
|
119
114
|
* If component has static values (values, json) or custom values, returns an array of them
|
120
|
-
* @returns {Array<*>|undefined}
|
115
|
+
* @returns {Array<*>|undefined} - Returns an array of the static or custom values.
|
121
116
|
*/
|
122
117
|
getOptionsValues(): Array<any> | undefined;
|
123
118
|
/**
|
@@ -286,10 +286,10 @@ class SelectComponent extends ListComponent_1.default {
|
|
286
286
|
}
|
287
287
|
/**
|
288
288
|
* Adds an option to the select dropdown.
|
289
|
-
* @param value
|
290
|
-
* @param label
|
291
|
-
* @param attrs
|
292
|
-
* @param id
|
289
|
+
* @param {*} value - The value of the new option.
|
290
|
+
* @param {string} label - The label of the new option.
|
291
|
+
* @param {object} [attrs] - Additional value attributes. Defaults to {}.
|
292
|
+
* @param {string} [id] - An id. Defaults to a random string.
|
293
293
|
*/
|
294
294
|
addOption(value, label, attrs = {}, id = (0, utils_1.getRandomComponentId)()) {
|
295
295
|
if (lodash_1.default.isNil(label))
|
@@ -593,6 +593,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
593
593
|
}
|
594
594
|
/**
|
595
595
|
* Get the request headers for this select dropdown.
|
596
|
+
* @returns {*} - Returns the request headers for this select dropdown.
|
596
597
|
*/
|
597
598
|
get requestHeaders() {
|
598
599
|
// Create the headers object.
|
@@ -1042,12 +1043,6 @@ class SelectComponent extends ListComponent_1.default {
|
|
1042
1043
|
get visible() {
|
1043
1044
|
return super.visible;
|
1044
1045
|
}
|
1045
|
-
/**
|
1046
|
-
* @param {*} value
|
1047
|
-
* @param values
|
1048
|
-
* @param {Array} items
|
1049
|
-
* @param keyValue
|
1050
|
-
*/
|
1051
1046
|
addCurrentChoices(values, items, keyValue) {
|
1052
1047
|
if (!values) {
|
1053
1048
|
return false;
|
@@ -1196,9 +1191,9 @@ class SelectComponent extends ListComponent_1.default {
|
|
1196
1191
|
}
|
1197
1192
|
}
|
1198
1193
|
/**
|
1199
|
-
* Normalize values coming into updateValue.
|
1200
|
-
* @param value
|
1201
|
-
* @returns {*}
|
1194
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
1195
|
+
* @param {*} value - The value to normalize
|
1196
|
+
* @returns {*} - Returns the normalized value
|
1202
1197
|
*/
|
1203
1198
|
normalizeValue(value) {
|
1204
1199
|
if (this.component.multiple && Array.isArray(value)) {
|
@@ -1395,6 +1390,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1395
1390
|
/**
|
1396
1391
|
* Performs required transformations on the initial value to use in selectOptions
|
1397
1392
|
* @param {*} value
|
1393
|
+
* @returns {*} - Returns the options value.
|
1398
1394
|
*/
|
1399
1395
|
getOptionValue(value) {
|
1400
1396
|
return lodash_1.default.isObject(value) && this.isEntireObjectDisplay()
|
@@ -1409,7 +1405,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1409
1405
|
}
|
1410
1406
|
/**
|
1411
1407
|
* If component has static values (values, json) or custom values, returns an array of them
|
1412
|
-
* @returns {Array<*>|undefined}
|
1408
|
+
* @returns {Array<*>|undefined} - Returns an array of the static or custom values.
|
1413
1409
|
*/
|
1414
1410
|
getOptionsValues() {
|
1415
1411
|
let rawItems = [];
|
@@ -1449,7 +1445,7 @@ class SelectComponent extends ListComponent_1.default {
|
|
1449
1445
|
}
|
1450
1446
|
/**
|
1451
1447
|
* Check if a component is eligible for multiple validation
|
1452
|
-
* @returns {boolean}
|
1448
|
+
* @returns {boolean} - Returns FALSE for select components.
|
1453
1449
|
*/
|
1454
1450
|
validateMultiple() {
|
1455
1451
|
// Select component will contain one input when flagged as multiple.
|
@@ -14,7 +14,7 @@ export default class SurveyComponent extends Field {
|
|
14
14
|
operators: string[];
|
15
15
|
};
|
16
16
|
static savedValueTypes(schema: any): string[];
|
17
|
-
render():
|
17
|
+
render(): Field;
|
18
18
|
attach(element: any): Promise<void>;
|
19
19
|
setValue(value: any, flags?: {}): boolean;
|
20
20
|
get emptyValue(): {};
|
@@ -19,6 +19,6 @@ export default class TableComponent extends NestedComponent {
|
|
19
19
|
get colWidth(): string;
|
20
20
|
noField: boolean;
|
21
21
|
table: any[] | undefined;
|
22
|
-
render():
|
22
|
+
render(): import("../_classes/field/Field").default;
|
23
23
|
}
|
24
24
|
import NestedComponent from '../_classes/nested/NestedComponent';
|
@@ -16,7 +16,7 @@ export default class TabsComponent extends NestedComponent {
|
|
16
16
|
currentTab: number;
|
17
17
|
noField: boolean;
|
18
18
|
tabs: any[] | undefined;
|
19
|
-
render():
|
19
|
+
render(): import("../_classes/field/Field").default;
|
20
20
|
detach(all: any): void;
|
21
21
|
/**
|
22
22
|
* Set the current tab.
|
@@ -38,7 +38,7 @@ export default class TextFieldComponent extends Input {
|
|
38
38
|
* @param flags
|
39
39
|
*/
|
40
40
|
setValueAt(index: any, value: any, flags?: {}): void;
|
41
|
-
unmaskValue(value: any, format?: any):
|
41
|
+
unmaskValue(value: any, format?: any): string;
|
42
42
|
/**
|
43
43
|
* Returns the value at this index.
|
44
44
|
* @param index
|
@@ -1,2 +1 @@
|
|
1
|
-
export {
|
2
|
-
import { Formio } from './Embed';
|
1
|
+
export {};
|
package/lib/cjs/formio.embed.js
CHANGED
@@ -1,102 +1,4 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
|
4
|
-
|
5
|
-
Object.defineProperty(exports, "Formio", { enumerable: true, get: function () { return Embed_1.Formio; } });
|
6
|
-
const scripts = document.getElementsByTagName('script');
|
7
|
-
const config = window.FormioConfig || {};
|
8
|
-
let thisScript = null;
|
9
|
-
let i = scripts.length;
|
10
|
-
const scriptName = config.scriptName || 'formio.embed.';
|
11
|
-
while (i--) {
|
12
|
-
if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
|
13
|
-
thisScript = scripts[i];
|
14
|
-
break;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
if (thisScript) {
|
18
|
-
const query = {};
|
19
|
-
const queryString = thisScript.src.replace(/^[^?]+\??/, '');
|
20
|
-
queryString.replace(/\?/g, '&').split('&').forEach((item) => {
|
21
|
-
query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
|
22
|
-
});
|
23
|
-
let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
|
24
|
-
scriptSrc.pop();
|
25
|
-
if (config.formioPath) {
|
26
|
-
config.formioPath(scriptSrc);
|
27
|
-
}
|
28
|
-
scriptSrc = scriptSrc.join('/');
|
29
|
-
const debug = (query.debug === 'true' || query.debug === '1');
|
30
|
-
const renderer = debug ? 'formio.form' : 'formio.form.min';
|
31
|
-
Embed_1.Formio.config = Object.assign({
|
32
|
-
script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.js`),
|
33
|
-
style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/${renderer}.css`),
|
34
|
-
cdn: query.cdn,
|
35
|
-
class: (query.class || 'formio-form-wrapper'),
|
36
|
-
src: query.src,
|
37
|
-
form: null,
|
38
|
-
submission: null,
|
39
|
-
project: query.project,
|
40
|
-
base: query.base || 'https://api.form.io',
|
41
|
-
submit: query.submit,
|
42
|
-
includeLibs: (query.libs === 'true' || query.libs === '1'),
|
43
|
-
template: query.template,
|
44
|
-
debug: debug,
|
45
|
-
config: {},
|
46
|
-
redirect: (query.return || query.redirect),
|
47
|
-
embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
|
48
|
-
success: query.success || 'Thank you for your submission!',
|
49
|
-
before: null,
|
50
|
-
after: null
|
51
|
-
}, config);
|
52
|
-
const form = (Embed_1.Formio.config.form || Embed_1.Formio.config.src);
|
53
|
-
if (form) {
|
54
|
-
Embed_1.Formio.debug('Embedding Configuration', config);
|
55
|
-
if (Embed_1.Formio.config.addPremiumLib) {
|
56
|
-
Embed_1.Formio.config.addPremiumLib(Embed_1.Formio.config, scriptSrc);
|
57
|
-
}
|
58
|
-
// The id for this embedded form.
|
59
|
-
Embed_1.Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
|
60
|
-
Embed_1.Formio.debug('Creating form element');
|
61
|
-
const element = Embed_1.Formio.createElement('div', {
|
62
|
-
'id': Embed_1.Formio.config.id,
|
63
|
-
class: Embed_1.Formio.config.class
|
64
|
-
});
|
65
|
-
// insertAfter doesn't exist, but effect is identical.
|
66
|
-
thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
|
67
|
-
Embed_1.Formio.createForm(element, form, Embed_1.Formio.config.config).then((instance) => {
|
68
|
-
if (Embed_1.Formio.config.submit) {
|
69
|
-
instance.nosubmit = true;
|
70
|
-
}
|
71
|
-
// Configure a redirect.
|
72
|
-
instance.on('submit', (submission) => {
|
73
|
-
Embed_1.Formio.debug("on('submit')", submission);
|
74
|
-
if (Embed_1.Formio.config.submit) {
|
75
|
-
Embed_1.Formio.debug(`Sending submission to ${Embed_1.Formio.config.submit}`);
|
76
|
-
const headers = {
|
77
|
-
'content-type': 'application/json'
|
78
|
-
};
|
79
|
-
const token = Embed_1.Formio.FormioClass.getToken();
|
80
|
-
if (token) {
|
81
|
-
headers['x-jwt-token'] = token;
|
82
|
-
}
|
83
|
-
Embed_1.Formio.FormioClass.fetch(Embed_1.Formio.config.submit, {
|
84
|
-
body: JSON.stringify(submission),
|
85
|
-
headers: headers,
|
86
|
-
method: 'POST',
|
87
|
-
mode: 'cors',
|
88
|
-
})
|
89
|
-
.then(resp => resp.json())
|
90
|
-
.then(submission => Embed_1.Formio.submitDone(instance, submission));
|
91
|
-
}
|
92
|
-
else {
|
93
|
-
Embed_1.Formio.submitDone(instance, submission);
|
94
|
-
}
|
95
|
-
});
|
96
|
-
});
|
97
|
-
}
|
98
|
-
}
|
99
|
-
else {
|
100
|
-
// Show an error if the script cannot be found.
|
101
|
-
document.write('<span>Could not locate the Embedded form.</span>');
|
102
|
-
}
|
3
|
+
const InlineEmbed_1 = require("./InlineEmbed");
|
4
|
+
(0, InlineEmbed_1.embed)();
|
@@ -19,7 +19,7 @@ export class NominatimAddressProvider extends AddressProvider {
|
|
19
19
|
get displayValueProperty(): string;
|
20
20
|
/**
|
21
21
|
* Generates the request URL for the address provider with options.
|
22
|
-
* @param {NominatimAddressProviderOptionsParams} options
|
22
|
+
* @param {NominatimAddressProviderOptionsParams} options - The request options.
|
23
23
|
* @returns {string} The formatted Url.
|
24
24
|
*/
|
25
25
|
getRequestUrl(options?: NominatimAddressProviderOptionsParams): string;
|
@@ -11,6 +11,10 @@ const AddressProvider_1 = require("./AddressProvider");
|
|
11
11
|
* {extends AddressProvider}
|
12
12
|
*/
|
13
13
|
class NominatimAddressProvider extends AddressProvider_1.AddressProvider {
|
14
|
+
/**
|
15
|
+
* Gets the name of the address provider.
|
16
|
+
* @type {string}
|
17
|
+
*/
|
14
18
|
static get name() {
|
15
19
|
return 'nominatim';
|
16
20
|
}
|
@@ -49,7 +53,7 @@ class NominatimAddressProvider extends AddressProvider_1.AddressProvider {
|
|
49
53
|
}
|
50
54
|
/**
|
51
55
|
* Generates the request URL for the address provider with options.
|
52
|
-
* @param {NominatimAddressProviderOptionsParams} options
|
56
|
+
* @param {NominatimAddressProviderOptionsParams} options - The request options.
|
53
57
|
* @returns {string} The formatted Url.
|
54
58
|
*/
|
55
59
|
getRequestUrl(options = {}) {
|
@@ -1,2 +1,8 @@
|
|
1
1
|
export default fileProcessor;
|
2
|
-
|
2
|
+
/**
|
3
|
+
* Creates a file processor function.
|
4
|
+
* @param {Formio} formio - The Formio instance.
|
5
|
+
* @param {object} config - The configuration object.
|
6
|
+
* @returns {function(File, object): Promise<FormData>} A function that takes a file and options, and returns a Promise that resolves with the processed file.
|
7
|
+
*/
|
8
|
+
declare function fileProcessor(formio: Formio, config: object): (arg0: File, arg1: object) => Promise<FormData>;
|
@@ -1,5 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
/**
|
4
|
+
* Creates a file processor function.
|
5
|
+
* @param {Formio} formio - The Formio instance.
|
6
|
+
* @param {object} config - The configuration object.
|
7
|
+
* @returns {function(File, object): Promise<FormData>} A function that takes a file and options, and returns a Promise that resolves with the processed file.
|
8
|
+
*/
|
3
9
|
const fileProcessor = (formio, config) => (file, options) => new Promise((resolve, reject) => {
|
4
10
|
const xhr = new XMLHttpRequest();
|
5
11
|
// Fire on network error.
|
@@ -1,21 +1,10 @@
|
|
1
1
|
export default azure;
|
2
2
|
/**
|
3
|
-
*
|
4
|
-
* @param formio
|
3
|
+
* Azure File Services provider for file storage.
|
4
|
+
* @param {object} formio formio instance
|
5
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
5
6
|
*/
|
6
|
-
declare function azure(formio:
|
7
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<{
|
8
|
-
storage: string;
|
9
|
-
name: any;
|
10
|
-
size: any;
|
11
|
-
type: any;
|
12
|
-
groupPermissions: any;
|
13
|
-
groupId: any;
|
14
|
-
key: any;
|
15
|
-
}>;
|
16
|
-
downloadFile(file: any): any;
|
17
|
-
deleteFile: (fileInfo: any) => any;
|
18
|
-
};
|
7
|
+
declare function azure(formio: object): any;
|
19
8
|
declare namespace azure {
|
20
9
|
let title: string;
|
21
10
|
}
|
@@ -5,8 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const xhr_1 = __importDefault(require("./xhr"));
|
7
7
|
/**
|
8
|
-
*
|
9
|
-
* @param formio
|
8
|
+
* Azure File Services provider for file storage.
|
9
|
+
* @param {object} formio formio instance
|
10
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
10
11
|
*/
|
11
12
|
function azure(formio) {
|
12
13
|
return {
|
@@ -1,13 +1,9 @@
|
|
1
1
|
export default base64;
|
2
2
|
/**
|
3
|
-
*
|
3
|
+
* base64 File Services provider for file storage.
|
4
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
4
5
|
*/
|
5
|
-
declare function base64():
|
6
|
-
title: string;
|
7
|
-
name: string;
|
8
|
-
uploadFile(file: any, fileName: any): Promise<any>;
|
9
|
-
downloadFile(file: any): Promise<any>;
|
10
|
-
};
|
6
|
+
declare function base64(): any;
|
11
7
|
declare namespace base64 {
|
12
8
|
let title: string;
|
13
9
|
}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
/**
|
4
|
-
*
|
4
|
+
* base64 File Services provider for file storage.
|
5
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
5
6
|
*/
|
6
7
|
function base64() {
|
7
8
|
return {
|
@@ -1,12 +1,10 @@
|
|
1
1
|
export default dropbox;
|
2
2
|
/**
|
3
|
-
*
|
4
|
-
* @param formio
|
3
|
+
* Dropbox provider for file storage.
|
4
|
+
* @param {object} formio formio instance
|
5
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
5
6
|
*/
|
6
|
-
declare function dropbox(formio:
|
7
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<any>;
|
8
|
-
downloadFile(file: any): Promise<any>;
|
9
|
-
};
|
7
|
+
declare function dropbox(formio: object): any;
|
10
8
|
declare namespace dropbox {
|
11
9
|
let title: string;
|
12
10
|
}
|
@@ -2,8 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const xhr_1 = require("./xhr");
|
4
4
|
/**
|
5
|
-
*
|
6
|
-
* @param formio
|
5
|
+
* Dropbox provider for file storage.
|
6
|
+
* @param {object} formio formio instance
|
7
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
7
8
|
*/
|
8
9
|
function dropbox(formio) {
|
9
10
|
return {
|
@@ -1,13 +1,11 @@
|
|
1
1
|
export default googledrive;
|
2
2
|
/**
|
3
3
|
*
|
4
|
-
*
|
4
|
+
* Google Drive provider for file storage.
|
5
|
+
* @param {object} formio - formio instance
|
6
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
5
7
|
*/
|
6
|
-
declare function googledrive(formio:
|
7
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<any>;
|
8
|
-
downloadFile(file: any): Promise<any>;
|
9
|
-
deleteFile: (fileInfo: any) => any;
|
10
|
-
};
|
8
|
+
declare function googledrive(formio: object): any;
|
11
9
|
declare namespace googledrive {
|
12
10
|
let title: string;
|
13
11
|
}
|
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const xhr_1 = require("./xhr");
|
4
4
|
/**
|
5
5
|
*
|
6
|
-
*
|
6
|
+
* Google Drive provider for file storage.
|
7
|
+
* @param {object} formio - formio instance
|
8
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
7
9
|
*/
|
8
10
|
function googledrive(formio) {
|
9
11
|
return {
|
@@ -1,14 +1,9 @@
|
|
1
1
|
export default indexeddb;
|
2
2
|
/**
|
3
|
-
*
|
3
|
+
* indexedDb provider for file storage.
|
4
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
4
5
|
*/
|
5
|
-
declare function indexeddb():
|
6
|
-
title: string;
|
7
|
-
name: string;
|
8
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any): Promise<any> | undefined;
|
9
|
-
downloadFile(file: any, options: any): Promise<any>;
|
10
|
-
deleteFile(file: any, options: any): Promise<any>;
|
11
|
-
};
|
6
|
+
declare function indexeddb(): any;
|
12
7
|
declare namespace indexeddb {
|
13
8
|
let title: string;
|
14
9
|
}
|
@@ -2,7 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const uuid_1 = require("uuid");
|
4
4
|
/**
|
5
|
-
*
|
5
|
+
* indexedDb provider for file storage.
|
6
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
6
7
|
*/
|
7
8
|
function indexeddb() {
|
8
9
|
return {
|
@@ -1,28 +1,10 @@
|
|
1
1
|
export default s3;
|
2
2
|
/**
|
3
|
-
*
|
4
|
-
* @param formio
|
3
|
+
* S3 File Services provider for file storage.
|
4
|
+
* @param {object} formio formio instance
|
5
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
5
6
|
*/
|
6
|
-
declare function s3(formio:
|
7
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any, multipartOptions: any): Promise<{
|
8
|
-
storage: string;
|
9
|
-
name: any;
|
10
|
-
bucket: any;
|
11
|
-
key: any;
|
12
|
-
url: any;
|
13
|
-
acl: any;
|
14
|
-
size: any;
|
15
|
-
type: any;
|
16
|
-
}>;
|
17
|
-
completeMultipartUpload(serverResponse: any, parts: any, multipart: any): Promise<void>;
|
18
|
-
abortMultipartUpload(serverResponse: any): void;
|
19
|
-
uploadParts(file: any, urls: any, headers: any, partSize: any, multipart: any, abortSignal: any): Promise<{
|
20
|
-
ETag: string;
|
21
|
-
PartNumber: number;
|
22
|
-
}[]>;
|
23
|
-
downloadFile(file: any): any;
|
24
|
-
deleteFile(fileInfo: any): any;
|
25
|
-
};
|
7
|
+
declare function s3(formio: object): any;
|
26
8
|
declare namespace s3 {
|
27
9
|
let title: string;
|
28
10
|
}
|
@@ -43,8 +43,9 @@ const loadAbortControllerPolyfill = () => __awaiter(void 0, void 0, void 0, func
|
|
43
43
|
}
|
44
44
|
});
|
45
45
|
/**
|
46
|
-
*
|
47
|
-
* @param formio
|
46
|
+
* S3 File Services provider for file storage.
|
47
|
+
* @param {object} formio formio instance
|
48
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
48
49
|
*/
|
49
50
|
function s3(formio) {
|
50
51
|
return {
|
@@ -1,15 +1,10 @@
|
|
1
1
|
export default url;
|
2
2
|
/**
|
3
3
|
*
|
4
|
-
* @param formio
|
4
|
+
* @param {object} formio - formio instance
|
5
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
5
6
|
*/
|
6
|
-
declare function url(formio:
|
7
|
-
title: string;
|
8
|
-
name: string;
|
9
|
-
uploadFile(file: any, name: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): any;
|
10
|
-
deleteFile(fileInfo: any, options: any): Promise<any>;
|
11
|
-
downloadFile(file: any): Promise<any>;
|
12
|
-
};
|
7
|
+
declare function url(formio: object): any;
|
13
8
|
declare namespace url {
|
14
9
|
let title: string;
|
15
10
|
}
|
@@ -2,13 +2,14 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
/**
|
4
4
|
*
|
5
|
-
* @param formio
|
5
|
+
* @param {object} formio - formio instance
|
6
|
+
* @returns {import('./typedefs').FileProvider} The FileProvider interface defined in index.js.
|
6
7
|
*/
|
7
8
|
function url(formio) {
|
8
9
|
/**
|
9
10
|
*
|
10
|
-
* @param options
|
11
|
-
* @param xhr
|
11
|
+
* @param {object} options - options to set on the xhr
|
12
|
+
* @param {object} xhr - the xhr object
|
12
13
|
*/
|
13
14
|
function setOptions(options, xhr) {
|
14
15
|
const parsedOptions = typeof options === 'string' ? JSON.parse(options) : options;
|
@@ -1,8 +1,24 @@
|
|
1
1
|
/**
|
2
|
-
*
|
3
|
-
* @param fn
|
4
|
-
* @param args
|
5
|
-
* @param retries
|
6
|
-
* @param err
|
2
|
+
* @typedef {any[]} Args
|
7
3
|
*/
|
8
|
-
|
4
|
+
/**
|
5
|
+
* Function to be retried
|
6
|
+
* @callback RetryFunction
|
7
|
+
* @param {...Args} args
|
8
|
+
* @returns {Promise<any>}
|
9
|
+
*/
|
10
|
+
/**
|
11
|
+
* Executes a function with retries in case of failure.
|
12
|
+
* @param {RetryFunction} fn - The function to be executed.
|
13
|
+
* @param {Args} args - The arguments to be passed to the function.
|
14
|
+
* @param {number} [retries] - The number of retries in case of failure.
|
15
|
+
* @param {string} [err] - The error message to be thrown after all retries have failed.
|
16
|
+
* @returns {Promise<any>} The result of the function execution.
|
17
|
+
* @throws {Error} When all retries have failed.
|
18
|
+
*/
|
19
|
+
export function withRetries(fn: RetryFunction, args: Args, retries?: number | undefined, err?: string | undefined): Promise<any>;
|
20
|
+
export type Args = any[];
|
21
|
+
/**
|
22
|
+
* Function to be retried
|
23
|
+
*/
|
24
|
+
export type RetryFunction = (...args: Args[]) => Promise<any>;
|