@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
@@ -4,6 +4,10 @@ import Field from '../field/Field';
|
|
4
4
|
import Components from '../../Components';
|
5
5
|
import { getArrayFromComponentPath, getStringFromComponentPath, getRandomComponentId } from '../../../utils/utils';
|
6
6
|
import { process as processAsync, processSync } from '@formio/core/process';
|
7
|
+
/**
|
8
|
+
* NestedComponent class.
|
9
|
+
* @augments Field
|
10
|
+
*/
|
7
11
|
export default class NestedComponent extends Field {
|
8
12
|
static schema(...extend) {
|
9
13
|
return Field.schema({
|
@@ -14,20 +18,40 @@ export default class NestedComponent extends Field {
|
|
14
18
|
constructor(component, options, data) {
|
15
19
|
super(component, options, data);
|
16
20
|
this.type = 'components';
|
21
|
+
/**
|
22
|
+
* The collapsed state of this NestedComponent.
|
23
|
+
* @type {boolean}
|
24
|
+
* @default false
|
25
|
+
* @private
|
26
|
+
*/
|
17
27
|
this._collapsed = !!this.component.collapsed;
|
18
28
|
}
|
19
29
|
get defaultSchema() {
|
20
30
|
return NestedComponent.schema();
|
21
31
|
}
|
32
|
+
/**
|
33
|
+
* Get the schema for the NestedComponent.
|
34
|
+
* @returns {object} The schema for the NestedComponent.
|
35
|
+
* @override
|
36
|
+
*/
|
22
37
|
get schema() {
|
23
38
|
const schema = super.schema;
|
24
39
|
const components = _.uniqBy(this.getComponents(), 'component.key');
|
25
40
|
schema.components = _.map(components, 'schema');
|
26
41
|
return schema;
|
27
42
|
}
|
43
|
+
/**
|
44
|
+
* Get collapsed state.
|
45
|
+
* @returns {boolean} The collapsed state.
|
46
|
+
*/
|
28
47
|
get collapsed() {
|
29
48
|
return this._collapsed;
|
30
49
|
}
|
50
|
+
/**
|
51
|
+
* Set collapsed state.
|
52
|
+
* @param {boolean} value - The collapsed state.
|
53
|
+
* @returns {void}
|
54
|
+
*/
|
31
55
|
collapse(value) {
|
32
56
|
const promise = this.redraw();
|
33
57
|
if (!value) {
|
@@ -35,10 +59,20 @@ export default class NestedComponent extends Field {
|
|
35
59
|
}
|
36
60
|
return promise;
|
37
61
|
}
|
62
|
+
/**
|
63
|
+
* Set collapsed state.
|
64
|
+
* @param {boolean} value - The collapsed state.
|
65
|
+
* @returns {void}
|
66
|
+
*/
|
38
67
|
set collapsed(value) {
|
39
68
|
this._collapsed = value;
|
40
69
|
this.collapse(value);
|
41
70
|
}
|
71
|
+
/**
|
72
|
+
* Set visible state of parent and each child component.
|
73
|
+
* @param {boolean} value - The visible state.
|
74
|
+
* @returns {void}
|
75
|
+
*/
|
42
76
|
set visible(value) {
|
43
77
|
// DO NOT CALL super here. There is an issue where clearOnHide was getting triggered with
|
44
78
|
// subcomponents because the "parentVisible" flag was set to false when it should really be
|
@@ -69,65 +103,136 @@ export default class NestedComponent extends Field {
|
|
69
103
|
this.redraw();
|
70
104
|
}
|
71
105
|
}
|
106
|
+
/**
|
107
|
+
* Get visible state.
|
108
|
+
* @returns {boolean} The visible state.
|
109
|
+
*/
|
72
110
|
get visible() {
|
73
111
|
return super.visible;
|
74
112
|
}
|
113
|
+
/**
|
114
|
+
* Set parent visibility.
|
115
|
+
* @param {boolean} value - The parent visibility.
|
116
|
+
* @returns {void}
|
117
|
+
*/
|
75
118
|
set parentVisible(value) {
|
76
119
|
super.parentVisible = value;
|
77
120
|
this.components.forEach(component => component.parentVisible = this.visible);
|
78
121
|
}
|
122
|
+
/**
|
123
|
+
* Get parent visibility.
|
124
|
+
* @returns {boolean} The parent visibility.
|
125
|
+
*/
|
79
126
|
get parentVisible() {
|
80
127
|
return super.parentVisible;
|
81
128
|
}
|
129
|
+
/**
|
130
|
+
* Get the disabled state.
|
131
|
+
* @returns {boolean} - The disabled state.
|
132
|
+
*/
|
82
133
|
get disabled() {
|
83
134
|
return super.disabled;
|
84
135
|
}
|
136
|
+
/**
|
137
|
+
* Set the disabled state.
|
138
|
+
* @param {boolean} disabled - The disabled state.
|
139
|
+
*/
|
85
140
|
set disabled(disabled) {
|
86
141
|
super.disabled = disabled;
|
87
142
|
this.components.forEach((component) => component.parentDisabled = disabled);
|
88
143
|
}
|
144
|
+
/**
|
145
|
+
* Set parent disabled state.
|
146
|
+
* @param {boolean} value - The parent disabled state.
|
147
|
+
* @returns {void}
|
148
|
+
*/
|
89
149
|
set parentDisabled(value) {
|
90
150
|
super.parentDisabled = value;
|
91
151
|
this.components.forEach(component => {
|
92
152
|
component.parentDisabled = this.disabled;
|
93
153
|
});
|
94
154
|
}
|
155
|
+
/**
|
156
|
+
* Get parent disabled state.
|
157
|
+
* @returns {boolean} The parent disabled state.
|
158
|
+
*/
|
95
159
|
get parentDisabled() {
|
96
160
|
return super.parentDisabled;
|
97
161
|
}
|
162
|
+
/**
|
163
|
+
* Get ready state from all components.
|
164
|
+
* @returns {Promise<Array>} - The promise that resolves when all components are ready.
|
165
|
+
*/
|
98
166
|
get ready() {
|
99
167
|
return Promise.all(this.getComponents().map(component => component.ready));
|
100
168
|
}
|
169
|
+
/**
|
170
|
+
* Get currentForm object.
|
171
|
+
* @returns {object} - The current form object.
|
172
|
+
*/
|
101
173
|
get currentForm() {
|
102
174
|
return super.currentForm;
|
103
175
|
}
|
176
|
+
/**
|
177
|
+
* Set currentForm object.
|
178
|
+
* @param {object} instance - The current form object.
|
179
|
+
* @returns {void}
|
180
|
+
*/
|
104
181
|
set currentForm(instance) {
|
105
182
|
super.currentForm = instance;
|
106
183
|
this.getComponents().forEach(component => {
|
107
184
|
component.currentForm = instance;
|
108
185
|
});
|
109
186
|
}
|
187
|
+
/**
|
188
|
+
* Get Row Index.
|
189
|
+
* @returns {number} - The row index.
|
190
|
+
*/
|
110
191
|
get rowIndex() {
|
111
192
|
return this._rowIndex;
|
112
193
|
}
|
194
|
+
/**
|
195
|
+
* Set Row Index to row and update each component.
|
196
|
+
* @param {number} value - The row index.
|
197
|
+
* @returns {void}
|
198
|
+
*/
|
113
199
|
set rowIndex(value) {
|
114
200
|
this._rowIndex = value;
|
115
201
|
this.eachComponent((component) => {
|
116
202
|
component.rowIndex = value;
|
117
203
|
});
|
118
204
|
}
|
205
|
+
/**
|
206
|
+
* Get Contextual data of the component.
|
207
|
+
* @returns {object} - The contextual data of the component.
|
208
|
+
* @override
|
209
|
+
*/
|
119
210
|
componentContext() {
|
120
211
|
return this._data;
|
121
212
|
}
|
213
|
+
/**
|
214
|
+
* Get the data of the component.
|
215
|
+
* @returns {object} - The data of the component.
|
216
|
+
* @override
|
217
|
+
*/
|
122
218
|
get data() {
|
123
219
|
return this._data;
|
124
220
|
}
|
221
|
+
/**
|
222
|
+
* Set the data of the component.
|
223
|
+
* @param {object} value - The data of the component.
|
224
|
+
* @returns {void}
|
225
|
+
*/
|
125
226
|
set data(value) {
|
126
227
|
this._data = value;
|
127
228
|
this.eachComponent((component) => {
|
128
229
|
component.data = this.componentContext(component);
|
129
230
|
});
|
130
231
|
}
|
232
|
+
/**
|
233
|
+
* Get components array.
|
234
|
+
* @returns {Array} - The components array.
|
235
|
+
*/
|
131
236
|
getComponents() {
|
132
237
|
return this.components || [];
|
133
238
|
}
|
@@ -150,6 +255,11 @@ export default class NestedComponent extends Field {
|
|
150
255
|
}
|
151
256
|
});
|
152
257
|
}
|
258
|
+
/**
|
259
|
+
* Check if the component has a component.
|
260
|
+
* @param {import('@formio/core').Component} component - The component to check.
|
261
|
+
* @returns {boolean} - TRUE if the component has a component, FALSE otherwise.
|
262
|
+
*/
|
153
263
|
hasComponent(component) {
|
154
264
|
let result = false;
|
155
265
|
this.everyComponent((comp) => {
|
@@ -160,6 +270,10 @@ export default class NestedComponent extends Field {
|
|
160
270
|
});
|
161
271
|
return result;
|
162
272
|
}
|
273
|
+
/**
|
274
|
+
* Get the flattened components of this NestedComponent.
|
275
|
+
* @returns {object} - The flattened components of this NestedComponent.
|
276
|
+
*/
|
163
277
|
flattenComponents() {
|
164
278
|
const result = {};
|
165
279
|
this.everyComponent((component) => {
|
@@ -252,10 +366,10 @@ export default class NestedComponent extends Field {
|
|
252
366
|
/**
|
253
367
|
* Create a new component and add it to the components array.
|
254
368
|
* @param {import('@formio/core').Component} component - The component JSON schema to create.
|
255
|
-
* @param {
|
256
|
-
* @param {
|
257
|
-
* @param {
|
258
|
-
* @param {
|
369
|
+
* @param {object} options - The options to create the component with.
|
370
|
+
* @param {import('@formio/core').DataObject} data - The submission data object to house the data for this component.
|
371
|
+
* @param {import('@formio/core').Component} [before] - The component before which to add this component.
|
372
|
+
* @param {import('@formio/core').Component} [replacedComp] - The component to replace with this component.
|
259
373
|
* @returns {any} - The created component instance.
|
260
374
|
*/
|
261
375
|
createComponent(component, options, data, before, replacedComp) {
|
@@ -319,8 +433,8 @@ export default class NestedComponent extends Field {
|
|
319
433
|
}
|
320
434
|
/**
|
321
435
|
* Add a new component instance to the components array.
|
322
|
-
* @param {
|
323
|
-
* @param {
|
436
|
+
* @param {import('@formio/core').DataObject} [data] - The Submission data for this component.
|
437
|
+
* @param {object} [options] - The options for this component.
|
324
438
|
*/
|
325
439
|
addComponents(data, options) {
|
326
440
|
data = data || this.data;
|
@@ -336,7 +450,7 @@ export default class NestedComponent extends Field {
|
|
336
450
|
}
|
337
451
|
/**
|
338
452
|
* Add a new component to the components array.
|
339
|
-
* @param {
|
453
|
+
* @param {import('@formio/core').Component} component - The component JSON schema to add.
|
340
454
|
* @param {object} data - The submission data object to house the data for this component.
|
341
455
|
* @param {HTMLElement} before - A DOM element to insert this element before.
|
342
456
|
* @param {boolean} [noAdd] - A possibly extraneous boolean flag.
|
@@ -403,6 +517,10 @@ export default class NestedComponent extends Field {
|
|
403
517
|
childPromise,
|
404
518
|
]);
|
405
519
|
}
|
520
|
+
/**
|
521
|
+
* Attach the logic to the components.
|
522
|
+
* @param {import('@formio/core').Component[]} components - The components to attach logic to.
|
523
|
+
*/
|
406
524
|
attachComponentsLogic(components) {
|
407
525
|
components = components || this.components;
|
408
526
|
_.each(components, (comp) => {
|
@@ -432,8 +550,8 @@ export default class NestedComponent extends Field {
|
|
432
550
|
}
|
433
551
|
/**
|
434
552
|
* Remove a component from the components array and from the children object
|
435
|
-
* @param {
|
436
|
-
* @param {
|
553
|
+
* @param {import('@formio/core').Component} component - The component to remove from the components.
|
554
|
+
* @param {import('@formio/core').Component[]} components - An array of components to remove this component from.
|
437
555
|
* @param {boolean} [all] - If set to TRUE will cascade remove all components.
|
438
556
|
*/
|
439
557
|
removeComponent(component, components, all = false) {
|
@@ -571,9 +689,9 @@ export default class NestedComponent extends Field {
|
|
571
689
|
}
|
572
690
|
/**
|
573
691
|
* Perform a validation on all child components of this nested component.
|
574
|
-
* @param {
|
575
|
-
* @param {
|
576
|
-
* @param {
|
692
|
+
* @param {import('@formio/core').Component[]} components - The components to validate.
|
693
|
+
* @param {import('@formio/core').DataObject} data - The data to validate.
|
694
|
+
* @param {object} flags - The flags to use when validating.
|
577
695
|
* @returns {Promise<Array>|Array} - The errors if any exist.
|
578
696
|
*/
|
579
697
|
validateComponents(components = null, data = null, flags = {}) {
|
@@ -611,9 +729,9 @@ export default class NestedComponent extends Field {
|
|
611
729
|
}
|
612
730
|
/**
|
613
731
|
* Validate a nested component with data, or its own internal data.
|
614
|
-
* @param {
|
615
|
-
* @param {
|
616
|
-
* @returns {
|
732
|
+
* @param {import('@formio/core').DataObject} data - The data to validate.
|
733
|
+
* @param {object} flags - The flags to use when validating.
|
734
|
+
* @returns {Array} - The errors if any exist.
|
617
735
|
*/
|
618
736
|
validate(data = null, flags = {}) {
|
619
737
|
data = data || this.rootValue;
|
@@ -3,9 +3,15 @@ export default class NestedDataComponent extends NestedComponent {
|
|
3
3
|
hasChanged(newValue: any, oldValue: any): boolean;
|
4
4
|
get allowData(): boolean;
|
5
5
|
get emptyValue(): {};
|
6
|
+
componentContext(): any;
|
6
7
|
getValueAsString(value: any, options: any): string;
|
7
8
|
getDataValueAsTable(value: any, options: any): string;
|
8
9
|
everyComponent(fn: any, options?: {}): void;
|
10
|
+
/**
|
11
|
+
* Get the value of this component.
|
12
|
+
* @returns {*}
|
13
|
+
*/
|
14
|
+
getValue(): any;
|
9
15
|
updateValue(value: any, flags?: {}): boolean;
|
10
16
|
setValue(value: any, flags?: {}): boolean;
|
11
17
|
}
|
@@ -54,7 +54,7 @@ export default class AddressComponent extends ContainerComponent {
|
|
54
54
|
renderElement(value: any): any;
|
55
55
|
renderRow(value: any, index: any): any;
|
56
56
|
renderGrid(): any;
|
57
|
-
render():
|
57
|
+
render(): Field;
|
58
58
|
onSelectAddress(address: any, element: any, index: any): void;
|
59
59
|
addRow(): void;
|
60
60
|
attach(element: any): Promise<void>;
|
@@ -65,3 +65,4 @@ export default class AddressComponent extends ContainerComponent {
|
|
65
65
|
getValueAsString(value: any, options: any): any;
|
66
66
|
}
|
67
67
|
import ContainerComponent from '../container/Container';
|
68
|
+
import Field from '../_classes/field/Field';
|
@@ -21,7 +21,7 @@ export default class ButtonComponent extends Field {
|
|
21
21
|
get clicked(): any;
|
22
22
|
get defaultValue(): boolean;
|
23
23
|
get oauthConfig(): any;
|
24
|
-
render():
|
24
|
+
render(): Field;
|
25
25
|
attachButton(): void;
|
26
26
|
hasError: boolean | undefined;
|
27
27
|
isDisabledOnInvalid: any;
|
@@ -14,7 +14,7 @@ export default class ColumnsComponent extends NestedComponent {
|
|
14
14
|
get columnKey(): string;
|
15
15
|
columns: any[] | undefined;
|
16
16
|
labelIsHidden(): boolean;
|
17
|
-
render():
|
17
|
+
render(): import("../_classes/field/Field").default;
|
18
18
|
justifyColumn(items: any, index: any): boolean;
|
19
19
|
justify(): any;
|
20
20
|
get gridSize(): number;
|
@@ -54,7 +54,7 @@ export default class DataGridComponent extends NestedArrayComponent {
|
|
54
54
|
hasTopSubmit(): any;
|
55
55
|
hasBottomSubmit(): any;
|
56
56
|
get canAddColumn(): boolean;
|
57
|
-
render():
|
57
|
+
render(): import("../_classes/field/Field").default;
|
58
58
|
getRows(): {}[];
|
59
59
|
getColumns(): any[];
|
60
60
|
hasHeader(): any;
|
@@ -84,7 +84,7 @@ export default class DayComponent extends Field {
|
|
84
84
|
}[] | undefined;
|
85
85
|
setErrorClasses(elements: any, dirty: any, hasError: any): void;
|
86
86
|
dayFirst: any;
|
87
|
-
render():
|
87
|
+
render(): Field;
|
88
88
|
renderField(name: any): any;
|
89
89
|
attach(element: any): Promise<void>;
|
90
90
|
set disabled(disabled: any);
|
@@ -35,6 +35,8 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
35
35
|
get inlineEditMode(): any;
|
36
36
|
get saveEditMode(): boolean;
|
37
37
|
get minLength(): any;
|
38
|
+
set data(value: any);
|
39
|
+
get data(): any;
|
38
40
|
get displayAsTable(): any;
|
39
41
|
get iteratableRows(): any;
|
40
42
|
get defaultValue(): any[];
|
@@ -45,7 +45,7 @@ export default class FileComponent extends Field {
|
|
45
45
|
type: number;
|
46
46
|
actions: number;
|
47
47
|
};
|
48
|
-
render():
|
48
|
+
render(): Field;
|
49
49
|
getVideoStream(constraints: any): any;
|
50
50
|
stopVideoStream(videoStream: any): void;
|
51
51
|
getFrame(videoPlayer: any): Promise<any>;
|
@@ -130,7 +130,7 @@ export default class FileComponent extends Field {
|
|
130
130
|
message: string;
|
131
131
|
file?: undefined;
|
132
132
|
} | {
|
133
|
-
file:
|
133
|
+
file: FormData | null;
|
134
134
|
status?: undefined;
|
135
135
|
message?: undefined;
|
136
136
|
}>;
|
@@ -43,7 +43,7 @@ export default class RadioComponent extends ListComponent {
|
|
43
43
|
itemsLoadedResolve: ((value: any) => void) | undefined;
|
44
44
|
optionsLoaded: boolean | undefined;
|
45
45
|
loadedOptions: any[] | undefined;
|
46
|
-
render():
|
46
|
+
render(): import("../_classes/field/Field").default;
|
47
47
|
attach(element: any): Promise<void>;
|
48
48
|
detach(element: any): void;
|
49
49
|
validateValueProperty(): boolean;
|
@@ -357,9 +357,9 @@ export default class RadioComponent extends ListComponent {
|
|
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
|
/**
|
@@ -284,10 +284,10 @@ export default class SelectComponent extends ListComponent {
|
|
284
284
|
}
|
285
285
|
/**
|
286
286
|
* Adds an option to the select dropdown.
|
287
|
-
* @param value
|
288
|
-
* @param label
|
289
|
-
* @param attrs
|
290
|
-
* @param id
|
287
|
+
* @param {*} value - The value of the new option.
|
288
|
+
* @param {string} label - The label of the new option.
|
289
|
+
* @param {object} [attrs] - Additional value attributes. Defaults to {}.
|
290
|
+
* @param {string} [id] - An id. Defaults to a random string.
|
291
291
|
*/
|
292
292
|
addOption(value, label, attrs = {}, id = getRandomComponentId()) {
|
293
293
|
if (_.isNil(label))
|
@@ -593,6 +593,7 @@ export default class SelectComponent extends ListComponent {
|
|
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.
|
@@ -1069,12 +1070,6 @@ export default class SelectComponent extends ListComponent {
|
|
1069
1070
|
get visible() {
|
1070
1071
|
return super.visible;
|
1071
1072
|
}
|
1072
|
-
/**
|
1073
|
-
* @param {*} value
|
1074
|
-
* @param values
|
1075
|
-
* @param {Array} items
|
1076
|
-
* @param keyValue
|
1077
|
-
*/
|
1078
1073
|
addCurrentChoices(values, items, keyValue) {
|
1079
1074
|
if (!values) {
|
1080
1075
|
return false;
|
@@ -1223,9 +1218,9 @@ export default class SelectComponent extends ListComponent {
|
|
1223
1218
|
}
|
1224
1219
|
}
|
1225
1220
|
/**
|
1226
|
-
* Normalize values coming into updateValue.
|
1227
|
-
* @param value
|
1228
|
-
* @returns {*}
|
1221
|
+
* Normalize values coming into updateValue. For example, depending on the configuration, string value `"true"` will be normalized to boolean `true`.
|
1222
|
+
* @param {*} value - The value to normalize
|
1223
|
+
* @returns {*} - Returns the normalized value
|
1229
1224
|
*/
|
1230
1225
|
normalizeValue(value) {
|
1231
1226
|
if (this.component.multiple && Array.isArray(value)) {
|
@@ -1421,6 +1416,7 @@ export default class SelectComponent extends ListComponent {
|
|
1421
1416
|
/**
|
1422
1417
|
* Performs required transformations on the initial value to use in selectOptions
|
1423
1418
|
* @param {*} value
|
1419
|
+
* @returns {*} - Returns the options value.
|
1424
1420
|
*/
|
1425
1421
|
getOptionValue(value) {
|
1426
1422
|
return _.isObject(value) && this.isEntireObjectDisplay()
|
@@ -1435,7 +1431,7 @@ export default class SelectComponent extends ListComponent {
|
|
1435
1431
|
}
|
1436
1432
|
/**
|
1437
1433
|
* If component has static values (values, json) or custom values, returns an array of them
|
1438
|
-
* @returns {Array<*>|undefined}
|
1434
|
+
* @returns {Array<*>|undefined} - Returns an array of the static or custom values.
|
1439
1435
|
*/
|
1440
1436
|
getOptionsValues() {
|
1441
1437
|
let rawItems = [];
|
@@ -1475,7 +1471,7 @@ export default class SelectComponent extends ListComponent {
|
|
1475
1471
|
}
|
1476
1472
|
/**
|
1477
1473
|
* Check if a component is eligible for multiple validation
|
1478
|
-
* @returns {boolean}
|
1474
|
+
* @returns {boolean} - Returns FALSE for select components.
|
1479
1475
|
*/
|
1480
1476
|
validateMultiple() {
|
1481
1477
|
// 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 {};
|