@formio/js 5.0.0-dev.5712.d53f35e → 5.0.0-dev.5714.6318ec3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +18 -0
- package/dist/formio.form.js +32 -22
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -0
- package/dist/formio.full.js +35 -25
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -0
- package/dist/formio.utils.js +12 -2
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -0
- package/lib/cjs/Form.d.ts +2 -2
- package/lib/cjs/Form.js +9 -3
- package/lib/cjs/PDF.js +1 -1
- package/lib/cjs/Webform.js +1 -2
- package/lib/cjs/WebformBuilder.js +13 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +2 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.js +5 -1
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +50 -29
- package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -1
- package/lib/cjs/components/datagrid/DataGrid.js +0 -8
- package/lib/cjs/components/datamap/DataMap.js +1 -1
- package/lib/cjs/components/day/Day.d.ts +2 -2
- package/lib/cjs/components/day/Day.js +3 -3
- package/lib/cjs/components/editgrid/EditGrid.js +1 -5
- package/lib/cjs/components/editgrid/fixtures/comp17.d.ts +80 -0
- package/lib/cjs/components/editgrid/fixtures/comp17.js +99 -0
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/editgrid/fixtures/index.js +3 -1
- package/lib/cjs/components/file/File.js +4 -0
- package/lib/cjs/components/form/editForm/Form.edit.form.js +1 -1
- package/lib/cjs/components/panel/Panel.d.ts +1 -0
- package/lib/cjs/components/panel/Panel.js +1 -0
- package/lib/cjs/components/radio/Radio.js +7 -6
- package/lib/cjs/components/radio/fixtures/comp12.d.ts +29 -0
- package/lib/cjs/components/radio/fixtures/comp12.js +36 -0
- package/lib/cjs/components/radio/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/radio/fixtures/index.js +3 -1
- package/lib/cjs/components/select/Select.d.ts +38 -0
- package/lib/cjs/components/select/Select.js +10 -0
- package/lib/cjs/components/select/fixtures/comp25.d.ts +44 -0
- package/lib/cjs/components/select/fixtures/comp25.js +59 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/select/fixtures/index.js +3 -1
- package/lib/cjs/components/time/Time.form.js +2 -2
- package/lib/cjs/templates/Templates.js +1 -1
- package/lib/cjs/translations/en.d.ts +1 -0
- package/lib/cjs/translations/en.js +1 -0
- package/lib/mjs/Form.d.ts +2 -2
- package/lib/mjs/Form.js +9 -3
- package/lib/mjs/PDF.js +1 -1
- package/lib/mjs/Webform.js +1 -2
- package/lib/mjs/WebformBuilder.js +12 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +2 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.js +5 -1
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +51 -29
- package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -1
- package/lib/mjs/components/datagrid/DataGrid.js +0 -8
- package/lib/mjs/components/datamap/DataMap.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +2 -2
- package/lib/mjs/components/day/Day.js +3 -3
- package/lib/mjs/components/editgrid/EditGrid.js +1 -5
- package/lib/mjs/components/editgrid/fixtures/comp17.d.ts +80 -0
- package/lib/mjs/components/editgrid/fixtures/comp17.js +97 -0
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/editgrid/fixtures/index.js +2 -1
- package/lib/mjs/components/file/File.js +4 -0
- package/lib/mjs/components/form/editForm/Form.edit.form.js +1 -1
- package/lib/mjs/components/panel/Panel.d.ts +1 -0
- package/lib/mjs/components/panel/Panel.js +1 -0
- package/lib/mjs/components/radio/Radio.js +7 -6
- package/lib/mjs/components/radio/fixtures/comp12.d.ts +29 -0
- package/lib/mjs/components/radio/fixtures/comp12.js +34 -0
- package/lib/mjs/components/radio/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/radio/fixtures/index.js +2 -1
- package/lib/mjs/components/select/Select.d.ts +38 -0
- package/lib/mjs/components/select/Select.js +13 -1
- package/lib/mjs/components/select/fixtures/comp25.d.ts +44 -0
- package/lib/mjs/components/select/fixtures/comp25.js +57 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/select/fixtures/index.js +2 -1
- package/lib/mjs/components/time/Time.form.js +2 -2
- package/lib/mjs/templates/Templates.js +1 -1
- package/lib/mjs/translations/en.d.ts +1 -0
- package/lib/mjs/translations/en.js +1 -0
- package/package.json +3 -3
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
/*! @license DOMPurify 3.1.5 | (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.5/LICENSE */
|
|
22
22
|
|
|
23
|
+
/*! @license DOMPurify 3.1.6 | (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.6/LICENSE */
|
|
24
|
+
|
|
23
25
|
/*! formiojs v5.0.0-rc.59 | https://unpkg.com/formiojs@5.0.0-rc.59/LICENSE.txt */
|
|
24
26
|
|
|
25
27
|
/**
|
package/lib/cjs/Form.d.ts
CHANGED
|
@@ -398,10 +398,10 @@ export default class Form extends Element {
|
|
|
398
398
|
getFormInitOptions(url: string, form: import('@formio/core').Form): object;
|
|
399
399
|
/**
|
|
400
400
|
* Sets the form to the JSON schema of a form.
|
|
401
|
-
* @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
|
|
401
|
+
* @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
|
|
402
402
|
* @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
|
|
403
403
|
*/
|
|
404
|
-
setForm(formParam: import('@formio/core').Form): Promise<Webform | Wizard | PDF>;
|
|
404
|
+
setForm(formParam: import('@formio/core').Form | string): Promise<Webform | Wizard | PDF>;
|
|
405
405
|
_form: any;
|
|
406
406
|
getSubmission(formio: any, opts: any): any;
|
|
407
407
|
/**
|
package/lib/cjs/Form.js
CHANGED
|
@@ -195,7 +195,7 @@ class Form extends Element_1.default {
|
|
|
195
195
|
}
|
|
196
196
|
/**
|
|
197
197
|
* Sets the form to the JSON schema of a form.
|
|
198
|
-
* @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
|
|
198
|
+
* @param {import('@formio/core').Form | string} formParam - The form JSON to set this form to.
|
|
199
199
|
* @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
|
|
200
200
|
*/
|
|
201
201
|
setForm(formParam) {
|
|
@@ -222,8 +222,14 @@ class Form extends Element_1.default {
|
|
|
222
222
|
}
|
|
223
223
|
this.loading = false;
|
|
224
224
|
this.instance = this.instance || this.create(form.display);
|
|
225
|
-
|
|
226
|
-
this.instance.setUrl
|
|
225
|
+
// If we're in builder mode, instance.setUrl is not a function, so just manually set the URL.
|
|
226
|
+
if (this.instance.setUrl) {
|
|
227
|
+
const options = this.getFormInitOptions(formParam, form);
|
|
228
|
+
this.instance.setUrl(formParam, options);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
this.instance.url = formParam;
|
|
232
|
+
}
|
|
227
233
|
this.instance.nosubmit = false;
|
|
228
234
|
this._form = this.instance.form = form;
|
|
229
235
|
if (submission) {
|
package/lib/cjs/PDF.js
CHANGED
|
@@ -70,7 +70,7 @@ class PDF extends Webform_1.default {
|
|
|
70
70
|
super.destroy(all);
|
|
71
71
|
}
|
|
72
72
|
rebuild() {
|
|
73
|
-
if (this.
|
|
73
|
+
if (this.builderMode && this.component.components) {
|
|
74
74
|
this.destroyComponents();
|
|
75
75
|
this.addComponents();
|
|
76
76
|
return Promise.resolve();
|
package/lib/cjs/Webform.js
CHANGED
|
@@ -826,7 +826,6 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
826
826
|
if (!submission || !submission.data) {
|
|
827
827
|
submission = {
|
|
828
828
|
data: {},
|
|
829
|
-
metadata: submission.metadata,
|
|
830
829
|
};
|
|
831
830
|
}
|
|
832
831
|
// Metadata needs to be available before setValue
|
|
@@ -1130,7 +1129,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
|
1130
1129
|
});
|
|
1131
1130
|
const displayedErrors = [];
|
|
1132
1131
|
if (errors.length) {
|
|
1133
|
-
errors = lodash_1.default.uniqBy(errors, (error) => error.message);
|
|
1132
|
+
errors = lodash_1.default.uniqBy(errors, (error) => { var _a, _b; return [error.message, (_a = error.component) === null || _a === void 0 ? void 0 : _a.id, (_b = error.context) === null || _b === void 0 ? void 0 : _b.path].join(); });
|
|
1134
1133
|
const createListItem = (message, index) => {
|
|
1135
1134
|
var _a, _b, _c;
|
|
1136
1135
|
const err = errors[index];
|
|
@@ -208,7 +208,8 @@ class WebformBuilder extends Component_1.default {
|
|
|
208
208
|
params: {
|
|
209
209
|
type: 'resource',
|
|
210
210
|
limit: 1000000,
|
|
211
|
-
select: '_id,title,name,components'
|
|
211
|
+
select: '_id,title,name,components',
|
|
212
|
+
'tags__ne': 'noBuilderResource'
|
|
212
213
|
}
|
|
213
214
|
};
|
|
214
215
|
if (this.options && this.options.resourceTag) {
|
|
@@ -908,7 +909,11 @@ class WebformBuilder extends Component_1.default {
|
|
|
908
909
|
if (form && form.properties) {
|
|
909
910
|
this.options.properties = form.properties;
|
|
910
911
|
}
|
|
911
|
-
|
|
912
|
+
let keyboardActionsEnabled = lodash_1.default.get(this.options, 'keyboardBuilder', false) || ((_a = this.options.properties) === null || _a === void 0 ? void 0 : _a.keyboardBuilder);
|
|
913
|
+
if (typeof keyboardActionsEnabled === 'string') {
|
|
914
|
+
keyboardActionsEnabled = keyboardActionsEnabled === 'true';
|
|
915
|
+
}
|
|
916
|
+
this.keyboardActionsEnabled = keyboardActionsEnabled;
|
|
912
917
|
const isShowSubmitButton = !this.options.noDefaultSubmitButton
|
|
913
918
|
&& (!form.components.length || !form.components.find(comp => comp.key === 'submit'));
|
|
914
919
|
// Ensure there is at least a submit button.
|
|
@@ -1060,7 +1065,10 @@ class WebformBuilder extends Component_1.default {
|
|
|
1060
1065
|
'calculateValue',
|
|
1061
1066
|
'conditional',
|
|
1062
1067
|
'customConditional',
|
|
1063
|
-
'id'
|
|
1068
|
+
'id',
|
|
1069
|
+
'fields.day.required',
|
|
1070
|
+
'fields.month.required',
|
|
1071
|
+
'fields.year.required',
|
|
1064
1072
|
]));
|
|
1065
1073
|
const parentComponent = defaultValueComponent.parent;
|
|
1066
1074
|
let tabIndex = -1;
|
|
@@ -1236,6 +1244,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1236
1244
|
const previewButtons = this.componentEdit.querySelectorAll(`[${this._referenceAttributeName}="previewButton"]`);
|
|
1237
1245
|
previewButtons.forEach((previewButton) => {
|
|
1238
1246
|
this.editForm.addEventListener(previewButton, 'click', (event) => {
|
|
1247
|
+
var _a;
|
|
1239
1248
|
event.preventDefault();
|
|
1240
1249
|
this.showPreview = !this.showPreview;
|
|
1241
1250
|
this.editForm.detach();
|
|
@@ -1247,6 +1256,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1247
1256
|
helplinks: this.helplinks,
|
|
1248
1257
|
}));
|
|
1249
1258
|
this.editForm.attach(this.componentEdit.querySelector(`[${this._referenceAttributeName}="editForm"]`));
|
|
1259
|
+
this.updateComponent((_a = this.editForm.submission.data) !== null && _a !== void 0 ? _a : component);
|
|
1250
1260
|
this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
|
|
1251
1261
|
});
|
|
1252
1262
|
});
|
|
@@ -211,11 +211,12 @@ export default class NestedComponent extends Field {
|
|
|
211
211
|
calculateValue(data: any, flags: any, row: any): any;
|
|
212
212
|
isLastPage(): boolean;
|
|
213
213
|
isValid(data: any, dirty: any): any;
|
|
214
|
-
validationProcessor({ scope, data, row, instance }: {
|
|
214
|
+
validationProcessor({ scope, data, row, instance, component }: {
|
|
215
215
|
scope: any;
|
|
216
216
|
data: any;
|
|
217
217
|
row: any;
|
|
218
218
|
instance: any;
|
|
219
|
+
component: any;
|
|
219
220
|
}, flags: any): void;
|
|
220
221
|
/**
|
|
221
222
|
* Perform a validation on all child components of this nested component.
|
|
@@ -497,6 +497,7 @@ class NestedComponent extends Field_1.default {
|
|
|
497
497
|
header: 'single',
|
|
498
498
|
collapsed: this.collapsed,
|
|
499
499
|
[this.nestedKey]: 'single',
|
|
500
|
+
messageContainer: 'single-scope',
|
|
500
501
|
});
|
|
501
502
|
let childPromise = Promise.resolve();
|
|
502
503
|
if (this.refs[this.nestedKey]) {
|
|
@@ -681,8 +682,11 @@ class NestedComponent extends Field_1.default {
|
|
|
681
682
|
isValid(data, dirty) {
|
|
682
683
|
return this.getComponents().reduce((valid, comp) => comp.isValid(data, dirty) && valid, super.isValid(data, dirty));
|
|
683
684
|
}
|
|
684
|
-
validationProcessor({ scope, data, row, instance }, flags) {
|
|
685
|
+
validationProcessor({ scope, data, row, instance, component }, flags) {
|
|
685
686
|
const { dirty } = flags;
|
|
687
|
+
if (this.root.hasExtraPages && this.page !== this.root.page) {
|
|
688
|
+
instance = this.getComponent(component.path);
|
|
689
|
+
}
|
|
686
690
|
if (!instance) {
|
|
687
691
|
return;
|
|
688
692
|
}
|
|
@@ -12,6 +12,8 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
|
12
12
|
hasAddButton(): any;
|
|
13
13
|
getComponent(path: any, fn: any, originalPath: any): any;
|
|
14
14
|
everyComponent(fn: any, rowIndex: any, options?: {}): void;
|
|
15
|
+
_getEmailTableHeader(options: any): string;
|
|
16
|
+
_getEmailTableBody(options: any): string;
|
|
15
17
|
getComponents(rowIndex: any): any;
|
|
16
18
|
}
|
|
17
19
|
import NestedDataComponent from '../nesteddata/NestedDataComponent';
|
|
@@ -149,39 +149,60 @@ class NestedArrayComponent extends NestedDataComponent_1.default {
|
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
+
_getEmailTableHeader(options) {
|
|
153
|
+
let row = '';
|
|
154
|
+
const getHeaderCell = (component) => {
|
|
155
|
+
if (!component.isInputComponent || !component.visible || component.skipInEmail) {
|
|
156
|
+
return '';
|
|
157
|
+
}
|
|
158
|
+
const label = component.label || component.key;
|
|
159
|
+
return `<th style="padding: 5px 10px;">${label}</th>`;
|
|
160
|
+
};
|
|
161
|
+
const components = this.getComponents(0);
|
|
162
|
+
for (const component of components) {
|
|
163
|
+
if (component.isInputComponent) {
|
|
164
|
+
row += getHeaderCell(component);
|
|
165
|
+
}
|
|
166
|
+
else if ((0, utils_1.isLayoutComponent)(component) && typeof component.everyComponent === 'function') {
|
|
167
|
+
component.everyComponent((comp) => {
|
|
168
|
+
row += getHeaderCell(comp);
|
|
169
|
+
}, options);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return `<thead><tr>${row}</tr></thead>`;
|
|
173
|
+
}
|
|
174
|
+
_getEmailTableBody(options) {
|
|
175
|
+
const getBodyCell = (component) => {
|
|
176
|
+
if (!component.isInputComponent || !component.visible || component.skipInEmail) {
|
|
177
|
+
return '';
|
|
178
|
+
}
|
|
179
|
+
return `<td style="padding: 5px 10px;">${component.getView(component.dataValue, options)}</td>`;
|
|
180
|
+
};
|
|
181
|
+
const rows = [];
|
|
182
|
+
for (const { components } of this.iteratableRows) {
|
|
183
|
+
let row = '';
|
|
184
|
+
for (const component of components) {
|
|
185
|
+
if (component.isInputComponent) {
|
|
186
|
+
row += getBodyCell(component);
|
|
187
|
+
}
|
|
188
|
+
else if ((0, utils_1.isLayoutComponent)(component) && typeof component.everyComponent === 'function') {
|
|
189
|
+
component.everyComponent((comp) => {
|
|
190
|
+
row += getBodyCell(comp);
|
|
191
|
+
}, options);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
rows.push(`<tr>${row}</tr>`);
|
|
195
|
+
}
|
|
196
|
+
return `<tbody>${rows.join('')}</tbody>`;
|
|
197
|
+
}
|
|
152
198
|
getValueAsString(value, options) {
|
|
153
|
-
var _a;
|
|
154
199
|
if (options === null || options === void 0 ? void 0 : options.email) {
|
|
155
|
-
|
|
200
|
+
return `
|
|
156
201
|
<table border="1" style="width:100%">
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
`);
|
|
160
|
-
(_a = this.component.components) === null || _a === void 0 ? void 0 : _a.forEach((component) => {
|
|
161
|
-
const label = component.label || component.key;
|
|
162
|
-
result += `<th style="padding: 5px 10px;">${label}</th>`;
|
|
163
|
-
});
|
|
164
|
-
result += (`
|
|
165
|
-
</tr>
|
|
166
|
-
</thead>
|
|
167
|
-
<tbody>
|
|
168
|
-
`);
|
|
169
|
-
this.iteratableRows.forEach(({ components }) => {
|
|
170
|
-
result += '<tr>';
|
|
171
|
-
lodash_1.default.each(components, (component) => {
|
|
172
|
-
result += '<td style="padding:5px 10px;">';
|
|
173
|
-
if (component.isInputComponent && component.visible && !component.skipInEmail) {
|
|
174
|
-
result += component.getView(component.dataValue, options);
|
|
175
|
-
}
|
|
176
|
-
result += '</td>';
|
|
177
|
-
});
|
|
178
|
-
result += '</tr>';
|
|
179
|
-
});
|
|
180
|
-
result += (`
|
|
181
|
-
</tbody>
|
|
202
|
+
${this._getEmailTableHeader(options)}
|
|
203
|
+
${this._getEmailTableBody(options)}
|
|
182
204
|
</table>
|
|
183
|
-
|
|
184
|
-
return result;
|
|
205
|
+
`;
|
|
185
206
|
}
|
|
186
207
|
if (!value || !value.length) {
|
|
187
208
|
return '';
|
|
@@ -263,13 +263,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
263
263
|
return hasHeader || ((col.label || col.title) && !col.hideLabel);
|
|
264
264
|
}, false);
|
|
265
265
|
}
|
|
266
|
-
loadRefs(element, refs) {
|
|
267
|
-
super.loadRefs(element, refs);
|
|
268
|
-
if (refs['messageContainer'] === 'single') {
|
|
269
|
-
const container = lodash_1.default.last(element.querySelectorAll(`[${this._referenceAttributeName}=messageContainer]`));
|
|
270
|
-
this.refs['messageContainer'] = container || this.refs['messageContainer'];
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
266
|
attach(element) {
|
|
274
267
|
this.loadRefs(element, {
|
|
275
268
|
[`${this.datagridKey}-row`]: 'multiple',
|
|
@@ -278,7 +271,6 @@ class DataGridComponent extends NestedArrayComponent_1.default {
|
|
|
278
271
|
[`${this.datagridKey}-removeRow`]: 'multiple',
|
|
279
272
|
[`${this.datagridKey}-group-header`]: 'multiple',
|
|
280
273
|
[this.datagridKey]: 'multiple',
|
|
281
|
-
'messageContainer': 'single'
|
|
282
274
|
});
|
|
283
275
|
if (this.allowReorder) {
|
|
284
276
|
this.refs[`${this.datagridKey}-row`].forEach((row, index) => {
|
|
@@ -241,7 +241,7 @@ class DataMapComponent extends DataGrid_1.default {
|
|
|
241
241
|
delete dataValue[key];
|
|
242
242
|
const comp = components[this.valueKey];
|
|
243
243
|
comp.component.key = newKey;
|
|
244
|
-
comp.path = Components_1.default.
|
|
244
|
+
comp.path = Components_1.default.getComponentPath(comp);
|
|
245
245
|
key = newKey;
|
|
246
246
|
});
|
|
247
247
|
const valueComponent = lodash_1.default.clone(this.component.valueComponent);
|
|
@@ -17,9 +17,9 @@ export default class DayComponent extends Field {
|
|
|
17
17
|
constructor(component: any, options: any, data: any);
|
|
18
18
|
/**
|
|
19
19
|
* The empty value for day component.
|
|
20
|
-
* @returns {'
|
|
20
|
+
* @returns {''} - The empty value of the day component.
|
|
21
21
|
*/
|
|
22
|
-
get emptyValue(): "
|
|
22
|
+
get emptyValue(): "";
|
|
23
23
|
get valueMask(): RegExp;
|
|
24
24
|
get dayRequired(): any;
|
|
25
25
|
get showDay(): boolean;
|
|
@@ -64,10 +64,10 @@ class DayComponent extends Field_1.default {
|
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* The empty value for day component.
|
|
67
|
-
* @returns {'
|
|
67
|
+
* @returns {''} - The empty value of the day component.
|
|
68
68
|
*/
|
|
69
69
|
get emptyValue() {
|
|
70
|
-
return '
|
|
70
|
+
return '';
|
|
71
71
|
}
|
|
72
72
|
get valueMask() {
|
|
73
73
|
return /^\d{2}\/\d{2}\/\d{4}$/;
|
|
@@ -363,7 +363,7 @@ class DayComponent extends Field_1.default {
|
|
|
363
363
|
setValueAt(index, value) {
|
|
364
364
|
// temporary solution to avoid input reset
|
|
365
365
|
// on invalid date.
|
|
366
|
-
if (
|
|
366
|
+
if (value === 'Invalid date') {
|
|
367
367
|
return null;
|
|
368
368
|
}
|
|
369
369
|
const parts = value.split('/');
|
|
@@ -490,11 +490,7 @@ class EditGridComponent extends NestedArrayComponent_1.default {
|
|
|
490
490
|
else {
|
|
491
491
|
this.removeClass(this.refs.component, `formio-component-${this.component.type}-row-open`);
|
|
492
492
|
}
|
|
493
|
-
|
|
494
|
-
this.loadRefs(element, {
|
|
495
|
-
messageContainer: 'single-scope',
|
|
496
|
-
});
|
|
497
|
-
return superAttach;
|
|
493
|
+
return super.attach(element);
|
|
498
494
|
}
|
|
499
495
|
flattenRowDataValue(dataValue) {
|
|
500
496
|
const flattened = {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
let type: string;
|
|
3
|
+
let display: string;
|
|
4
|
+
let components: ({
|
|
5
|
+
label: string;
|
|
6
|
+
tableView: boolean;
|
|
7
|
+
rowDrafts: boolean;
|
|
8
|
+
key: string;
|
|
9
|
+
type: string;
|
|
10
|
+
input: boolean;
|
|
11
|
+
components: {
|
|
12
|
+
collapsible: boolean;
|
|
13
|
+
key: string;
|
|
14
|
+
type: string;
|
|
15
|
+
label: string;
|
|
16
|
+
input: boolean;
|
|
17
|
+
tableView: boolean;
|
|
18
|
+
components: {
|
|
19
|
+
label: string;
|
|
20
|
+
columns: ({
|
|
21
|
+
components: {
|
|
22
|
+
label: string;
|
|
23
|
+
optionsLabelPosition: string;
|
|
24
|
+
inline: boolean;
|
|
25
|
+
tableView: boolean;
|
|
26
|
+
values: {
|
|
27
|
+
label: string;
|
|
28
|
+
value: string;
|
|
29
|
+
shortcut: string;
|
|
30
|
+
}[];
|
|
31
|
+
key: string;
|
|
32
|
+
type: string;
|
|
33
|
+
input: boolean;
|
|
34
|
+
}[];
|
|
35
|
+
width: number;
|
|
36
|
+
offset: number;
|
|
37
|
+
push: number;
|
|
38
|
+
pull: number;
|
|
39
|
+
size: string;
|
|
40
|
+
currentWidth: number;
|
|
41
|
+
} | {
|
|
42
|
+
components: {
|
|
43
|
+
label: string;
|
|
44
|
+
applyMaskOn: string;
|
|
45
|
+
autoExpand: boolean;
|
|
46
|
+
tableView: boolean;
|
|
47
|
+
key: string;
|
|
48
|
+
conditional: {
|
|
49
|
+
show: boolean;
|
|
50
|
+
conjunction: string;
|
|
51
|
+
};
|
|
52
|
+
type: string;
|
|
53
|
+
input: boolean;
|
|
54
|
+
}[];
|
|
55
|
+
width: number;
|
|
56
|
+
offset: number;
|
|
57
|
+
push: number;
|
|
58
|
+
pull: number;
|
|
59
|
+
size: string;
|
|
60
|
+
currentWidth: number;
|
|
61
|
+
})[];
|
|
62
|
+
key: string;
|
|
63
|
+
type: string;
|
|
64
|
+
input: boolean;
|
|
65
|
+
tableView: boolean;
|
|
66
|
+
}[];
|
|
67
|
+
}[];
|
|
68
|
+
disableOnInvalid?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
type: string;
|
|
71
|
+
label: string;
|
|
72
|
+
key: string;
|
|
73
|
+
disableOnInvalid: boolean;
|
|
74
|
+
input: boolean;
|
|
75
|
+
tableView: boolean;
|
|
76
|
+
rowDrafts?: undefined;
|
|
77
|
+
components?: undefined;
|
|
78
|
+
})[];
|
|
79
|
+
}
|
|
80
|
+
export default _default;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
type: 'form',
|
|
5
|
+
display: 'form',
|
|
6
|
+
components: [
|
|
7
|
+
{
|
|
8
|
+
label: 'Edit Grid',
|
|
9
|
+
tableView: false,
|
|
10
|
+
rowDrafts: false,
|
|
11
|
+
key: 'editGrid',
|
|
12
|
+
type: 'editgrid',
|
|
13
|
+
input: true,
|
|
14
|
+
components: [
|
|
15
|
+
{
|
|
16
|
+
collapsible: false,
|
|
17
|
+
key: 'panel',
|
|
18
|
+
type: 'panel',
|
|
19
|
+
label: 'Panel',
|
|
20
|
+
input: false,
|
|
21
|
+
tableView: false,
|
|
22
|
+
components: [
|
|
23
|
+
{
|
|
24
|
+
label: 'Columns',
|
|
25
|
+
columns: [
|
|
26
|
+
{
|
|
27
|
+
components: [
|
|
28
|
+
{
|
|
29
|
+
label: 'Radio',
|
|
30
|
+
optionsLabelPosition: 'right',
|
|
31
|
+
inline: false,
|
|
32
|
+
tableView: true,
|
|
33
|
+
values: [
|
|
34
|
+
{
|
|
35
|
+
label: 'yes',
|
|
36
|
+
value: 'yes',
|
|
37
|
+
shortcut: ''
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
label: 'no',
|
|
41
|
+
value: 'no',
|
|
42
|
+
shortcut: ''
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
key: 'radio',
|
|
46
|
+
type: 'radio',
|
|
47
|
+
input: true
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
width: 6,
|
|
51
|
+
offset: 0,
|
|
52
|
+
push: 0,
|
|
53
|
+
pull: 0,
|
|
54
|
+
size: 'md',
|
|
55
|
+
currentWidth: 6
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
components: [
|
|
59
|
+
{
|
|
60
|
+
label: 'Text Area',
|
|
61
|
+
applyMaskOn: 'change',
|
|
62
|
+
autoExpand: false,
|
|
63
|
+
tableView: true,
|
|
64
|
+
key: 'textArea',
|
|
65
|
+
conditional: {
|
|
66
|
+
show: true,
|
|
67
|
+
conjunction: 'all'
|
|
68
|
+
},
|
|
69
|
+
type: 'textarea',
|
|
70
|
+
input: true
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
width: 6,
|
|
74
|
+
offset: 0,
|
|
75
|
+
push: 0,
|
|
76
|
+
pull: 0,
|
|
77
|
+
size: 'md',
|
|
78
|
+
currentWidth: 6
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
key: 'columns',
|
|
82
|
+
type: 'columns',
|
|
83
|
+
input: false,
|
|
84
|
+
tableView: false
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'button',
|
|
92
|
+
label: 'Submit',
|
|
93
|
+
key: 'submit',
|
|
94
|
+
disableOnInvalid: true,
|
|
95
|
+
input: true,
|
|
96
|
+
tableView: false
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
};
|
|
@@ -14,8 +14,9 @@ import comp7 from './comp7';
|
|
|
14
14
|
import comp8 from './comp8';
|
|
15
15
|
import comp9 from './comp9';
|
|
16
16
|
import comp16 from './comp16';
|
|
17
|
+
import comp17 from './comp17';
|
|
17
18
|
import compOpenWhenEmpty from './comp-openWhenEmpty';
|
|
18
19
|
import withOpenWhenEmptyAndConditions from './comp-with-conditions-and-openWhenEmpty';
|
|
19
20
|
import compWithCustomDefaultValue from './comp-with-custom-default-value';
|
|
20
21
|
import compTestEvents from './comp-test-events';
|
|
21
|
-
export { comp1, comp2, comp3, comp10, comp11, comp12, comp13, comp14, comp15, comp4, comp5, comp6, comp7, comp8, comp9, comp16, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
|
|
22
|
+
export { comp1, comp2, comp3, comp10, comp11, comp12, comp13, comp14, comp15, comp4, comp5, comp6, comp7, comp8, comp9, comp16, comp17, compOpenWhenEmpty, withOpenWhenEmptyAndConditions, compWithCustomDefaultValue, compTestEvents };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.compTestEvents = exports.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = exports.comp16 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
6
|
+
exports.compTestEvents = exports.compWithCustomDefaultValue = exports.withOpenWhenEmptyAndConditions = exports.compOpenWhenEmpty = exports.comp17 = exports.comp16 = exports.comp9 = exports.comp8 = exports.comp7 = exports.comp6 = exports.comp5 = exports.comp4 = exports.comp15 = exports.comp14 = exports.comp13 = exports.comp12 = exports.comp11 = exports.comp10 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
|
8
8
|
exports.comp1 = comp1_1.default;
|
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
|
@@ -36,6 +36,8 @@ const comp15_1 = __importDefault(require("./comp15"));
|
|
|
36
36
|
exports.comp15 = comp15_1.default;
|
|
37
37
|
const comp16_1 = __importDefault(require("./comp16"));
|
|
38
38
|
exports.comp16 = comp16_1.default;
|
|
39
|
+
const comp17_1 = __importDefault(require("./comp17"));
|
|
40
|
+
exports.comp17 = comp17_1.default;
|
|
39
41
|
const comp_with_conditions_and_openWhenEmpty_1 = __importDefault(require("./comp-with-conditions-and-openWhenEmpty"));
|
|
40
42
|
exports.withOpenWhenEmptyAndConditions = comp_with_conditions_and_openWhenEmpty_1.default;
|
|
41
43
|
const comp_openWhenEmpty_1 = __importDefault(require("./comp-openWhenEmpty"));
|
|
@@ -935,6 +935,10 @@ class FileComponent extends Field_1.default {
|
|
|
935
935
|
: response.type === 'abort'
|
|
936
936
|
? this.t('Request was aborted')
|
|
937
937
|
: response.toString();
|
|
938
|
+
this.emit('fileUploadError', {
|
|
939
|
+
fileToSync,
|
|
940
|
+
response,
|
|
941
|
+
});
|
|
938
942
|
}
|
|
939
943
|
finally {
|
|
940
944
|
delete fileToSync.progress;
|
|
@@ -295,14 +295,15 @@ class RadioComponent extends ListComponent_1.default {
|
|
|
295
295
|
setItems(items) {
|
|
296
296
|
const listData = [];
|
|
297
297
|
items === null || items === void 0 ? void 0 : items.forEach((item, i) => {
|
|
298
|
+
const valueAtProperty = lodash_1.default.get(item, this.component.valueProperty);
|
|
298
299
|
this.loadedOptions[i] = {
|
|
299
|
-
value: this.component.valueProperty ?
|
|
300
|
-
label: this.component.valueProperty ? this.itemTemplate(item,
|
|
300
|
+
value: this.component.valueProperty ? valueAtProperty : item,
|
|
301
|
+
label: this.component.valueProperty ? this.itemTemplate(item, valueAtProperty) : this.itemTemplate(item, item, i)
|
|
301
302
|
};
|
|
302
|
-
listData.push(this.templateData[this.component.valueProperty ?
|
|
303
|
-
if ((this.component.valueProperty || !this.isRadio) && (lodash_1.default.isUndefined(
|
|
304
|
-
(!this.isRadio && lodash_1.default.isObject(
|
|
305
|
-
(!this.isRadio && lodash_1.default.isBoolean(
|
|
303
|
+
listData.push(this.templateData[this.component.valueProperty ? valueAtProperty : i]);
|
|
304
|
+
if ((this.component.valueProperty || !this.isRadio) && (lodash_1.default.isUndefined(valueAtProperty) ||
|
|
305
|
+
(!this.isRadio && lodash_1.default.isObject(valueAtProperty)) ||
|
|
306
|
+
(!this.isRadio && lodash_1.default.isBoolean(valueAtProperty)))) {
|
|
306
307
|
this.loadedOptions[i].invalid = true;
|
|
307
308
|
}
|
|
308
309
|
});
|