@formio/js 5.0.0-rc.51 → 5.0.0-rc.53
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 +561 -721
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -49
- package/dist/formio.full.js +563 -693
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -49
- package/dist/formio.js +11 -11
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +34 -194
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +11 -49
- 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/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/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/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/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 +11 -11
@@ -1,3 +1,11 @@
|
|
1
|
+
/*!
|
2
|
+
* dist/inputmask
|
3
|
+
* https://github.com/RobinHerbots/Inputmask
|
4
|
+
* Copyright (c) 2010 - 2023 Robin Herbots
|
5
|
+
* Licensed under the MIT license
|
6
|
+
* Version: 5.0.8
|
7
|
+
*/
|
8
|
+
|
1
9
|
/*!
|
2
10
|
* https://github.com/Starcounter-Jack/JSON-Patch
|
3
11
|
* (c) 2017-2021 Joachim Wester
|
@@ -10,57 +18,11 @@
|
|
10
18
|
* MIT licensed
|
11
19
|
*/
|
12
20
|
|
13
|
-
/*!
|
14
|
-
* dependencyLibs/inputmask.dependencyLib.js
|
15
|
-
* https://github.com/RobinHerbots/Inputmask
|
16
|
-
* Copyright (c) 2010 - 2019 Robin Herbots
|
17
|
-
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
18
|
-
* Version: 4.0.9
|
19
|
-
*/
|
20
|
-
|
21
|
-
/*!
|
22
|
-
* global/window.js
|
23
|
-
* https://github.com/RobinHerbots/Inputmask
|
24
|
-
* Copyright (c) 2010 - 2019 Robin Herbots
|
25
|
-
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
26
|
-
* Version: 4.0.9
|
27
|
-
*/
|
28
|
-
|
29
|
-
/*!
|
30
|
-
* inputmask.date.extensions.js
|
31
|
-
* https://github.com/RobinHerbots/Inputmask
|
32
|
-
* Copyright (c) 2010 - 2019 Robin Herbots
|
33
|
-
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
34
|
-
* Version: 4.0.9
|
35
|
-
*/
|
36
|
-
|
37
|
-
/*!
|
38
|
-
* inputmask.extensions.js
|
39
|
-
* https://github.com/RobinHerbots/Inputmask
|
40
|
-
* Copyright (c) 2010 - 2019 Robin Herbots
|
41
|
-
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
42
|
-
* Version: 4.0.9
|
43
|
-
*/
|
44
|
-
|
45
|
-
/*!
|
46
|
-
* inputmask.js
|
47
|
-
* https://github.com/RobinHerbots/Inputmask
|
48
|
-
* Copyright (c) 2010 - 2019 Robin Herbots
|
49
|
-
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
50
|
-
* Version: 4.0.9
|
51
|
-
*/
|
52
|
-
|
53
|
-
/*!
|
54
|
-
* inputmask.numeric.extensions.js
|
55
|
-
* https://github.com/RobinHerbots/Inputmask
|
56
|
-
* Copyright (c) 2010 - 2019 Robin Herbots
|
57
|
-
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
|
58
|
-
* Version: 4.0.9
|
59
|
-
*/
|
60
|
-
|
61
21
|
/*! @license DOMPurify 3.1.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.2/LICENSE */
|
62
22
|
|
63
|
-
/*!
|
23
|
+
/*! @license DOMPurify 3.1.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.3/LICENSE */
|
24
|
+
|
25
|
+
/*! formiojs v5.0.0-rc.53 | https://unpkg.com/formiojs@5.0.0-rc.53/LICENSE.txt */
|
64
26
|
|
65
27
|
/**
|
66
28
|
* @license
|
package/lib/cjs/Form.d.ts
CHANGED
@@ -1,27 +1,298 @@
|
|
1
1
|
export default class Form extends Element {
|
2
2
|
static embed(embed: any): Promise<any>;
|
3
|
+
constructor(elementOrForm: any, formOrOptions: any, options?: {});
|
4
|
+
/**
|
5
|
+
* Represents a JSON value.
|
6
|
+
* @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
|
7
|
+
*/
|
8
|
+
/**
|
9
|
+
* Represents a JSON array.
|
10
|
+
* @typedef {Array<JSON>} JSONArray
|
11
|
+
*/
|
12
|
+
/**
|
13
|
+
* Represents a JSON object.
|
14
|
+
* @typedef {{[key: string]: JSON}} JSONObject
|
15
|
+
*/
|
16
|
+
/**
|
17
|
+
* @typedef {object} FormioHooks
|
18
|
+
* @property {Function} [beforeSubmit]
|
19
|
+
* @property {Function} [beforeCancel]
|
20
|
+
* @property {Function} [beforeNext]
|
21
|
+
* @property {Function} [beforePrev]
|
22
|
+
* @property {Function} [attachComponent]
|
23
|
+
* @property {Function} [setDataValue]
|
24
|
+
* @property {Function} [addComponents]
|
25
|
+
* @property {Function} [addComponent]
|
26
|
+
* @property {Function} [customValidation]
|
27
|
+
* @property {Function} [attachWebform]
|
28
|
+
*/
|
29
|
+
/**
|
30
|
+
* @typedef {object} SanitizeConfig
|
31
|
+
* @property {string[]} [addAttr]
|
32
|
+
* @property {string[]} [addTags]
|
33
|
+
* @property {string[]} [allowedAttrs]
|
34
|
+
* @property {string[]} [allowedTags]
|
35
|
+
* @property {string[]} [allowedUriRegex]
|
36
|
+
* @property {string[]} [addUriSafeAttr]
|
37
|
+
*/
|
38
|
+
/**
|
39
|
+
* @typedef {object} ButtonSettings
|
40
|
+
* @property {boolean} [showPrevious]
|
41
|
+
* @property {boolean} [showNext]
|
42
|
+
* @property {boolean} [showCancel]
|
43
|
+
* @property {boolean} [showSubmit]
|
44
|
+
*/
|
45
|
+
/**
|
46
|
+
* @typedef {object} FormOptions
|
47
|
+
* @property {boolean} [saveDraft] - Enable the save draft feature.
|
48
|
+
* @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
|
49
|
+
* @property {boolean} [readOnly] - Set this form to readOnly.
|
50
|
+
* @property {boolean} [noAlerts] - Disable the alerts dialog.
|
51
|
+
* @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
|
52
|
+
* @property {string} [template] - Custom logic for creation of elements.
|
53
|
+
* @property {boolean} [noDefaults] - Exclude default values from the settings.
|
54
|
+
* @property {any} [fileService] - The file service for this form.
|
55
|
+
* @property {EventEmitter} [events] - The EventEmitter for this form.
|
56
|
+
* @property {string} [language] - The language to render this form in.
|
57
|
+
* @property {{[key: string]: string}} [i18next] - The i18next configuration for this form.
|
58
|
+
* @property {boolean} [viewAsHtml] - View the form as raw HTML.
|
59
|
+
* @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
|
60
|
+
* @property {boolean} [highlightErrors] - Highlight any errors on the form.
|
61
|
+
* @property {string} [componentErrorClass] - The error class for components.
|
62
|
+
* @property {any} [templates] - The templates for this form.
|
63
|
+
* @property {string} [iconset] - The iconset for this form.
|
64
|
+
* @property {import('@formio/core').Component[]} [components] - The components for this form.
|
65
|
+
* @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
|
66
|
+
* @property {boolean} [showHiddenFields] - Show hidden fields.
|
67
|
+
* @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
|
68
|
+
* @property {{[key: string]: boolean}} [show] - Components to show for this form.
|
69
|
+
* @property {Formio} [formio] - The Formio instance for this form.
|
70
|
+
* @property {string} [decimalSeparator] - The decimal separator for this form.
|
71
|
+
* @property {string} [thousandsSeparator] - The thousands separator for this form.
|
72
|
+
* @property {FormioHooks} [hooks] - The hooks for this form.
|
73
|
+
* @property {boolean} [alwaysDirty] - Always be dirty.
|
74
|
+
* @property {boolean} [skipDraftRestore] - Skip restoring a draft.
|
75
|
+
* @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
|
76
|
+
* @property {string} [cdnUrl] - The CDN url for this form.
|
77
|
+
* @property {boolean} [flatten] - Flatten the form.
|
78
|
+
* @property {boolean} [sanitize] - Sanitize the form.
|
79
|
+
* @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
|
80
|
+
* @property {ButtonSettings} [buttonSettings] - The button settings for this form.
|
81
|
+
* @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
|
82
|
+
* @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
|
83
|
+
* @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
|
84
|
+
* @property {boolean} [showCheckboxBackground] - Show the checkbox background.
|
85
|
+
* @property {number} [zoom] - The zoom for PDF forms.
|
86
|
+
*/
|
3
87
|
/**
|
4
88
|
* Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
|
5
|
-
* @param {object}
|
6
|
-
* @param {object | string}
|
7
|
-
* @param {
|
8
|
-
* @param {boolean} options.readOnly - Set this form to readOnly
|
9
|
-
* @param {boolean} options.noAlerts - Set to true to disable the alerts dialog.
|
10
|
-
* @param {boolean} options.i18n - The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js
|
11
|
-
* @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.
|
12
|
-
* @param {...any} args
|
89
|
+
* @param {object} elementOrForm - The DOM element you wish to render this form within, or the form definition.
|
90
|
+
* @param {object | string | FormOptions} formOrOptions - A Form JSON schema, the URL of a hosted form, or the form options.
|
91
|
+
* @param {FormOptions} [options] - The options to create a new form instance.
|
13
92
|
* @example
|
14
93
|
* import Form from '@formio/js/Form';
|
15
94
|
* const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
|
16
95
|
* form.build();
|
17
96
|
*/
|
18
|
-
|
97
|
+
/**
|
98
|
+
* @type {FormOptions} - the options for this Form.
|
99
|
+
*/
|
100
|
+
options: {
|
101
|
+
/**
|
102
|
+
* - Enable the save draft feature.
|
103
|
+
*/
|
104
|
+
saveDraft?: boolean | undefined;
|
105
|
+
/**
|
106
|
+
* - The throttle for the save draft feature.
|
107
|
+
*/
|
108
|
+
saveDraftThrottle?: number | undefined;
|
109
|
+
/**
|
110
|
+
* - Set this form to readOnly.
|
111
|
+
*/
|
112
|
+
readOnly?: boolean | undefined;
|
113
|
+
/**
|
114
|
+
* - Disable the alerts dialog.
|
115
|
+
*/
|
116
|
+
noAlerts?: boolean | undefined;
|
117
|
+
/**
|
118
|
+
* - The translation file for this rendering.
|
119
|
+
*/
|
120
|
+
i18n?: {
|
121
|
+
[key: string]: string;
|
122
|
+
} | undefined;
|
123
|
+
/**
|
124
|
+
* - Custom logic for creation of elements.
|
125
|
+
*/
|
126
|
+
template?: string | undefined;
|
127
|
+
/**
|
128
|
+
* - Exclude default values from the settings.
|
129
|
+
*/
|
130
|
+
noDefaults?: boolean | undefined;
|
131
|
+
/**
|
132
|
+
* - The file service for this form.
|
133
|
+
*/
|
134
|
+
fileService?: any;
|
135
|
+
/**
|
136
|
+
* - The EventEmitter for this form.
|
137
|
+
*/
|
138
|
+
events?: any;
|
139
|
+
/**
|
140
|
+
* - The language to render this form in.
|
141
|
+
*/
|
142
|
+
language?: string | undefined;
|
143
|
+
/**
|
144
|
+
* - The i18next configuration for this form.
|
145
|
+
*/
|
146
|
+
i18next?: {
|
147
|
+
[key: string]: string;
|
148
|
+
} | undefined;
|
149
|
+
/**
|
150
|
+
* - View the form as raw HTML.
|
151
|
+
*/
|
152
|
+
viewAsHtml?: boolean | undefined;
|
153
|
+
/**
|
154
|
+
* - The render mode for this form.
|
155
|
+
*/
|
156
|
+
renderMode?: "builder" | "form" | "html" | "flat" | "pdf" | undefined;
|
157
|
+
/**
|
158
|
+
* - Highlight any errors on the form.
|
159
|
+
*/
|
160
|
+
highlightErrors?: boolean | undefined;
|
161
|
+
/**
|
162
|
+
* - The error class for components.
|
163
|
+
*/
|
164
|
+
componentErrorClass?: string | undefined;
|
165
|
+
/**
|
166
|
+
* - The templates for this form.
|
167
|
+
*/
|
168
|
+
templates?: any;
|
169
|
+
/**
|
170
|
+
* - The iconset for this form.
|
171
|
+
*/
|
172
|
+
iconset?: string | undefined;
|
173
|
+
/**
|
174
|
+
* - The components for this form.
|
175
|
+
*/
|
176
|
+
components?: import("@formio/core").Component[] | undefined;
|
177
|
+
/**
|
178
|
+
* - Disabled components for this form.
|
179
|
+
*/
|
180
|
+
disabled?: {
|
181
|
+
[key: string]: boolean;
|
182
|
+
} | undefined;
|
183
|
+
/**
|
184
|
+
* - Show hidden fields.
|
185
|
+
*/
|
186
|
+
showHiddenFields?: boolean | undefined;
|
187
|
+
/**
|
188
|
+
* - Hidden components for this form.
|
189
|
+
*/
|
190
|
+
hide?: {
|
191
|
+
[key: string]: boolean;
|
192
|
+
} | undefined;
|
193
|
+
/**
|
194
|
+
* - Components to show for this form.
|
195
|
+
*/
|
196
|
+
show?: {
|
197
|
+
[key: string]: boolean;
|
198
|
+
} | undefined;
|
199
|
+
/**
|
200
|
+
* - The Formio instance for this form.
|
201
|
+
*/
|
202
|
+
formio?: any;
|
203
|
+
/**
|
204
|
+
* - The decimal separator for this form.
|
205
|
+
*/
|
206
|
+
decimalSeparator?: string | undefined;
|
207
|
+
/**
|
208
|
+
* - The thousands separator for this form.
|
209
|
+
*/
|
210
|
+
thousandsSeparator?: string | undefined;
|
211
|
+
/**
|
212
|
+
* - The hooks for this form.
|
213
|
+
*/
|
214
|
+
hooks?: {
|
215
|
+
beforeSubmit?: Function | undefined;
|
216
|
+
beforeCancel?: Function | undefined;
|
217
|
+
beforeNext?: Function | undefined;
|
218
|
+
beforePrev?: Function | undefined;
|
219
|
+
attachComponent?: Function | undefined;
|
220
|
+
setDataValue?: Function | undefined;
|
221
|
+
addComponents?: Function | undefined;
|
222
|
+
addComponent?: Function | undefined;
|
223
|
+
customValidation?: Function | undefined;
|
224
|
+
attachWebform?: Function | undefined;
|
225
|
+
} | undefined;
|
226
|
+
/**
|
227
|
+
* - Always be dirty.
|
228
|
+
*/
|
229
|
+
alwaysDirty?: boolean | undefined;
|
230
|
+
/**
|
231
|
+
* - Skip restoring a draft.
|
232
|
+
*/
|
233
|
+
skipDraftRestore?: boolean | undefined;
|
234
|
+
/**
|
235
|
+
* - The display for this form.
|
236
|
+
*/
|
237
|
+
display?: "form" | "pdf" | "wizard" | undefined;
|
238
|
+
/**
|
239
|
+
* - The CDN url for this form.
|
240
|
+
*/
|
241
|
+
cdnUrl?: string | undefined;
|
242
|
+
/**
|
243
|
+
* - Flatten the form.
|
244
|
+
*/
|
245
|
+
flatten?: boolean | undefined;
|
246
|
+
/**
|
247
|
+
* - Sanitize the form.
|
248
|
+
*/
|
249
|
+
sanitize?: boolean | undefined;
|
250
|
+
/**
|
251
|
+
* - The sanitize configuration for this form.
|
252
|
+
*/
|
253
|
+
sanitizeConfig?: {
|
254
|
+
addAttr?: string[] | undefined;
|
255
|
+
addTags?: string[] | undefined;
|
256
|
+
allowedAttrs?: string[] | undefined;
|
257
|
+
allowedTags?: string[] | undefined;
|
258
|
+
allowedUriRegex?: string[] | undefined;
|
259
|
+
addUriSafeAttr?: string[] | undefined;
|
260
|
+
} | undefined;
|
261
|
+
/**
|
262
|
+
* - The button settings for this form.
|
263
|
+
*/
|
264
|
+
buttonSettings?: {
|
265
|
+
showPrevious?: boolean | undefined;
|
266
|
+
showNext?: boolean | undefined;
|
267
|
+
showCancel?: boolean | undefined;
|
268
|
+
showSubmit?: boolean | undefined;
|
269
|
+
} | undefined;
|
270
|
+
/**
|
271
|
+
* - The breadcrumb settings for this form.
|
272
|
+
*/
|
273
|
+
breadcrumbSettings?: object | undefined;
|
274
|
+
/**
|
275
|
+
* - Allow the previous button (for Wizard forms).
|
276
|
+
*/
|
277
|
+
allowPrevious?: boolean | undefined;
|
278
|
+
/**
|
279
|
+
* - The order of the buttons (for Wizard forms).
|
280
|
+
*/
|
281
|
+
wizardButtonOrder?: string[] | undefined;
|
282
|
+
/**
|
283
|
+
* - Show the checkbox background.
|
284
|
+
*/
|
285
|
+
showCheckboxBackground?: boolean | undefined;
|
286
|
+
/**
|
287
|
+
* - The zoom for PDF forms.
|
288
|
+
*/
|
289
|
+
zoom?: number | undefined;
|
290
|
+
};
|
19
291
|
ready: Promise<any>;
|
20
292
|
readyResolve: (value: any) => void;
|
21
293
|
readyReject: (reason?: any) => void;
|
22
294
|
instance: any;
|
23
295
|
element: any;
|
24
|
-
options: any;
|
25
296
|
display: string;
|
26
297
|
createElement(tag: any, attrs: any, children: any): any;
|
27
298
|
set loading(load: any);
|
package/lib/cjs/Form.js
CHANGED
@@ -32,27 +32,22 @@ const displays_1 = __importDefault(require("./displays"));
|
|
32
32
|
const templates_1 = __importDefault(require("./templates"));
|
33
33
|
const FormioUtils = __importStar(require("./utils/utils"));
|
34
34
|
class Form extends Element_1.default {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
* const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
|
48
|
-
* form.build();
|
49
|
-
*/
|
50
|
-
constructor(...args) {
|
51
|
-
let options = args[0] instanceof HTMLElement ? args[2] : args[1];
|
35
|
+
constructor(elementOrForm, formOrOptions, options = {}) {
|
36
|
+
let element, form, formOptions;
|
37
|
+
if (elementOrForm instanceof HTMLElement) {
|
38
|
+
element = elementOrForm;
|
39
|
+
form = formOrOptions;
|
40
|
+
formOptions = options;
|
41
|
+
}
|
42
|
+
else {
|
43
|
+
element = null;
|
44
|
+
form = elementOrForm;
|
45
|
+
formOptions = formOrOptions || {};
|
46
|
+
}
|
52
47
|
if (Formio_1.Formio.options && Formio_1.Formio.options.form) {
|
53
|
-
|
48
|
+
formOptions = Object.assign(formOptions, Formio_1.Formio.options.form);
|
54
49
|
}
|
55
|
-
super(
|
50
|
+
super(formOptions);
|
56
51
|
if (this.options.useSessionToken) {
|
57
52
|
Formio_1.Formio.useSessionToken(this.options);
|
58
53
|
}
|
@@ -61,30 +56,22 @@ class Form extends Element_1.default {
|
|
61
56
|
this.readyReject = reject;
|
62
57
|
});
|
63
58
|
this.instance = null;
|
64
|
-
if (
|
59
|
+
if (element) {
|
65
60
|
if (this.element) {
|
66
61
|
delete this.element.component;
|
67
62
|
}
|
68
|
-
this.element =
|
69
|
-
this.options = args[2] || {};
|
70
|
-
this.options.events = this.events;
|
71
|
-
this.setForm(args[1])
|
72
|
-
.then(() => this.readyResolve(this.instance))
|
73
|
-
.catch(this.readyReject);
|
63
|
+
this.element = element;
|
74
64
|
}
|
75
|
-
else
|
65
|
+
else {
|
76
66
|
this.element = null;
|
77
|
-
|
78
|
-
|
79
|
-
this.setForm(
|
67
|
+
}
|
68
|
+
if (form) {
|
69
|
+
this.setForm(form)
|
80
70
|
.then(() => this.readyResolve(this.instance))
|
81
71
|
.catch(this.readyReject);
|
82
72
|
}
|
83
|
-
|
84
|
-
|
85
|
-
this.options = {};
|
86
|
-
this.options.events = this.events;
|
87
|
-
}
|
73
|
+
this.options = formOptions;
|
74
|
+
this.options.events = this.events;
|
88
75
|
this.display = '';
|
89
76
|
}
|
90
77
|
createElement(tag, attrs, children) {
|
package/lib/cjs/FormBuilder.d.ts
CHANGED
@@ -1,6 +1,191 @@
|
|
1
1
|
export default class FormBuilder extends Form {
|
2
|
-
|
3
|
-
|
2
|
+
/**
|
3
|
+
* @typedef FormBuilderOptions
|
4
|
+
* @property {string[]} [disabled] - An array of "keys" of components that should be disabled within the form builder. Example: ['firstName', 'lastName']
|
5
|
+
* @property {boolean} [noNewEdit] - When set to TRUE no modal is shown when a component is dragged onto the form.
|
6
|
+
* @property {boolean} [noDefaultSubmitButton] - Set to TRUE to not include the default submit button in Webforms.
|
7
|
+
* @property {boolean} [alwaysConfirmComponentRemoval] - Set to TRUE to always require confirmation before removing a component.
|
8
|
+
* @property {object} [formConfig] - Form configurations to apply to forms being created. These configurations are added to the "config" property of the form object.
|
9
|
+
* @property {string} [resourceTag] - The tag to use to query for the "Existing Resource Fields" section of the builder.
|
10
|
+
* @property {import('./Form').FormOptions} [editForm] - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
11
|
+
* @property {string} [language] - The language to load into the form builder.
|
12
|
+
* @property {object} [builder] - The builder options to pass to the builder.
|
13
|
+
* @property {'form'|'wizard'|'pdf'} [display] - The display mode of the builder.
|
14
|
+
* @property {string} [resourceFilter] - Filter applied to the resources that appear in the builder's Existing Resource Fields.
|
15
|
+
* @property {boolean} [noSource] - When set to TRUE, the resource ID in the builder's Existing Resource Fields will not be linked.
|
16
|
+
* @property {boolean} [showFullJsonSchema] - When set to TRUE, the full JSON schema will be displayed in the JSON edit menu.
|
17
|
+
*/
|
18
|
+
/** @type {FormBuilderOptions} */
|
19
|
+
static options: {
|
20
|
+
/**
|
21
|
+
* - An array of "keys" of components that should be disabled within the form builder. Example: ['firstName', 'lastName']
|
22
|
+
*/
|
23
|
+
disabled?: string[] | undefined;
|
24
|
+
/**
|
25
|
+
* - When set to TRUE no modal is shown when a component is dragged onto the form.
|
26
|
+
*/
|
27
|
+
noNewEdit?: boolean | undefined;
|
28
|
+
/**
|
29
|
+
* - Set to TRUE to not include the default submit button in Webforms.
|
30
|
+
*/
|
31
|
+
noDefaultSubmitButton?: boolean | undefined;
|
32
|
+
/**
|
33
|
+
* - Set to TRUE to always require confirmation before removing a component.
|
34
|
+
*/
|
35
|
+
alwaysConfirmComponentRemoval?: boolean | undefined;
|
36
|
+
/**
|
37
|
+
* - Form configurations to apply to forms being created. These configurations are added to the "config" property of the form object.
|
38
|
+
*/
|
39
|
+
formConfig?: object | undefined;
|
40
|
+
/**
|
41
|
+
* - The tag to use to query for the "Existing Resource Fields" section of the builder.
|
42
|
+
*/
|
43
|
+
resourceTag?: string | undefined;
|
44
|
+
/**
|
45
|
+
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
46
|
+
*/
|
47
|
+
editForm?: any;
|
48
|
+
/**
|
49
|
+
* - The language to load into the form builder.
|
50
|
+
*/
|
51
|
+
language?: string | undefined;
|
52
|
+
/**
|
53
|
+
* - The builder options to pass to the builder.
|
54
|
+
*/
|
55
|
+
builder?: object | undefined;
|
56
|
+
/**
|
57
|
+
* - The display mode of the builder.
|
58
|
+
*/
|
59
|
+
display?: "form" | "pdf" | "wizard" | undefined;
|
60
|
+
/**
|
61
|
+
* - Filter applied to the resources that appear in the builder's Existing Resource Fields.
|
62
|
+
*/
|
63
|
+
resourceFilter?: string | undefined;
|
64
|
+
/**
|
65
|
+
* - When set to TRUE, the resource ID in the builder's Existing Resource Fields will not be linked.
|
66
|
+
*/
|
67
|
+
noSource?: boolean | undefined;
|
68
|
+
/**
|
69
|
+
* - When set to TRUE, the full JSON schema will be displayed in the JSON edit menu.
|
70
|
+
*/
|
71
|
+
showFullJsonSchema?: boolean | undefined;
|
72
|
+
};
|
73
|
+
/**
|
74
|
+
* Creates a new form builder.
|
75
|
+
* @param {HTMLElement} element - The HTML element to place the form builder.
|
76
|
+
* @param {string | object} form - The form to pass to the builder
|
77
|
+
* @param {FormBuilderOptions} options - The options to create this builder.
|
78
|
+
* @returns {FormBuilder} - The form builder instance.
|
79
|
+
*/
|
80
|
+
constructor(element: HTMLElement, form: string | object, options: {
|
81
|
+
/**
|
82
|
+
* - An array of "keys" of components that should be disabled within the form builder. Example: ['firstName', 'lastName']
|
83
|
+
*/
|
84
|
+
disabled?: string[] | undefined;
|
85
|
+
/**
|
86
|
+
* - When set to TRUE no modal is shown when a component is dragged onto the form.
|
87
|
+
*/
|
88
|
+
noNewEdit?: boolean | undefined;
|
89
|
+
/**
|
90
|
+
* - Set to TRUE to not include the default submit button in Webforms.
|
91
|
+
*/
|
92
|
+
noDefaultSubmitButton?: boolean | undefined;
|
93
|
+
/**
|
94
|
+
* - Set to TRUE to always require confirmation before removing a component.
|
95
|
+
*/
|
96
|
+
alwaysConfirmComponentRemoval?: boolean | undefined;
|
97
|
+
/**
|
98
|
+
* - Form configurations to apply to forms being created. These configurations are added to the "config" property of the form object.
|
99
|
+
*/
|
100
|
+
formConfig?: object | undefined;
|
101
|
+
/**
|
102
|
+
* - The tag to use to query for the "Existing Resource Fields" section of the builder.
|
103
|
+
*/
|
104
|
+
resourceTag?: string | undefined;
|
105
|
+
/**
|
106
|
+
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
107
|
+
*/
|
108
|
+
editForm?: any;
|
109
|
+
/**
|
110
|
+
* - The language to load into the form builder.
|
111
|
+
*/
|
112
|
+
language?: string | undefined;
|
113
|
+
/**
|
114
|
+
* - The builder options to pass to the builder.
|
115
|
+
*/
|
116
|
+
builder?: object | undefined;
|
117
|
+
/**
|
118
|
+
* - The display mode of the builder.
|
119
|
+
*/
|
120
|
+
display?: "form" | "pdf" | "wizard" | undefined;
|
121
|
+
/**
|
122
|
+
* - Filter applied to the resources that appear in the builder's Existing Resource Fields.
|
123
|
+
*/
|
124
|
+
resourceFilter?: string | undefined;
|
125
|
+
/**
|
126
|
+
* - When set to TRUE, the resource ID in the builder's Existing Resource Fields will not be linked.
|
127
|
+
*/
|
128
|
+
noSource?: boolean | undefined;
|
129
|
+
/**
|
130
|
+
* - When set to TRUE, the full JSON schema will be displayed in the JSON edit menu.
|
131
|
+
*/
|
132
|
+
showFullJsonSchema?: boolean | undefined;
|
133
|
+
});
|
134
|
+
/** @type {FormBuilderOptions} */
|
135
|
+
options: {
|
136
|
+
/**
|
137
|
+
* - An array of "keys" of components that should be disabled within the form builder. Example: ['firstName', 'lastName']
|
138
|
+
*/
|
139
|
+
disabled?: string[] | undefined;
|
140
|
+
/**
|
141
|
+
* - When set to TRUE no modal is shown when a component is dragged onto the form.
|
142
|
+
*/
|
143
|
+
noNewEdit?: boolean | undefined;
|
144
|
+
/**
|
145
|
+
* - Set to TRUE to not include the default submit button in Webforms.
|
146
|
+
*/
|
147
|
+
noDefaultSubmitButton?: boolean | undefined;
|
148
|
+
/**
|
149
|
+
* - Set to TRUE to always require confirmation before removing a component.
|
150
|
+
*/
|
151
|
+
alwaysConfirmComponentRemoval?: boolean | undefined;
|
152
|
+
/**
|
153
|
+
* - Form configurations to apply to forms being created. These configurations are added to the "config" property of the form object.
|
154
|
+
*/
|
155
|
+
formConfig?: object | undefined;
|
156
|
+
/**
|
157
|
+
* - The tag to use to query for the "Existing Resource Fields" section of the builder.
|
158
|
+
*/
|
159
|
+
resourceTag?: string | undefined;
|
160
|
+
/**
|
161
|
+
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
162
|
+
*/
|
163
|
+
editForm?: any;
|
164
|
+
/**
|
165
|
+
* - The language to load into the form builder.
|
166
|
+
*/
|
167
|
+
language?: string | undefined;
|
168
|
+
/**
|
169
|
+
* - The builder options to pass to the builder.
|
170
|
+
*/
|
171
|
+
builder?: object | undefined;
|
172
|
+
/**
|
173
|
+
* - The display mode of the builder.
|
174
|
+
*/
|
175
|
+
display?: "form" | "pdf" | "wizard" | undefined;
|
176
|
+
/**
|
177
|
+
* - Filter applied to the resources that appear in the builder's Existing Resource Fields.
|
178
|
+
*/
|
179
|
+
resourceFilter?: string | undefined;
|
180
|
+
/**
|
181
|
+
* - When set to TRUE, the resource ID in the builder's Existing Resource Fields will not be linked.
|
182
|
+
*/
|
183
|
+
noSource?: boolean | undefined;
|
184
|
+
/**
|
185
|
+
* - When set to TRUE, the full JSON schema will be displayed in the JSON edit menu.
|
186
|
+
*/
|
187
|
+
showFullJsonSchema?: boolean | undefined;
|
188
|
+
};
|
4
189
|
create(display: any): any;
|
5
190
|
}
|
6
191
|
import Form from './Form';
|