@formio/js 5.1.0-dev.6056.ba6432d → 5.1.0-dev.6059.845a6e3
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 +13 -131
- package/README.md +1 -28
- package/dist/formio.builder.css +17 -19
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.css +17 -19
- package/dist/formio.form.js +176 -102
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -3
- package/dist/formio.full.css +17 -19
- package/dist/formio.full.js +101 -123
- package/dist/formio.full.min.css +2 -2
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -3
- package/dist/formio.js +10 -10
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +3 -3
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/CDN.d.ts +1 -1
- package/lib/cjs/CDN.js +2 -2
- package/lib/cjs/Embed.js +1 -1
- package/lib/cjs/Form.d.ts +6 -4
- package/lib/cjs/Form.js +8 -16
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDFBuilder.js +4 -4
- package/lib/cjs/Webform.d.ts +13 -16
- package/lib/cjs/Webform.js +148 -162
- package/lib/cjs/WebformBuilder.js +28 -17
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/WizardBuilder.js +2 -15
- package/lib/cjs/components/Components.d.ts +0 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/cjs/components/_classes/component/Component.js +11 -38
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +2 -13
- package/lib/cjs/components/_classes/component/editForm/utils.d.ts +0 -1
- package/lib/cjs/components/_classes/component/editForm/utils.js +0 -3
- package/lib/cjs/components/_classes/input/Input.js +1 -23
- package/lib/cjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +3 -10
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +0 -13
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +0 -2
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +31 -52
- package/lib/cjs/components/address/Address.js +1 -1
- package/lib/cjs/components/button/Button.js +6 -6
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +2 -2
- package/lib/cjs/components/content/editForm/Content.edit.display.js +0 -8
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +0 -12
- package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -2
- package/lib/cjs/components/datagrid/DataGrid.js +26 -41
- package/lib/cjs/components/day/Day.js +7 -9
- package/lib/cjs/components/day/editForm/Day.edit.display.js +0 -8
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +8 -26
- package/lib/cjs/components/email/editForm/Email.edit.display.js +0 -12
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +0 -8
- package/lib/cjs/components/file/File.d.ts +1 -1
- package/lib/cjs/components/file/File.js +17 -23
- package/lib/cjs/components/form/Form.d.ts +1 -1
- package/lib/cjs/components/form/Form.js +5 -9
- package/lib/cjs/components/form/editForm/Form.edit.form.js +3 -3
- package/lib/cjs/components/hidden/Hidden.d.ts +1 -0
- package/lib/cjs/components/hidden/Hidden.js +1 -1
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +0 -8
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +0 -8
- package/lib/cjs/components/number/Number.js +5 -12
- package/lib/cjs/components/number/editForm/Number.edit.display.js +0 -12
- package/lib/cjs/components/password/editForm/Password.edit.display.js +1 -13
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +1 -9
- package/lib/cjs/components/radio/Radio.js +0 -10
- package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/cjs/components/select/Select.d.ts +1 -0
- package/lib/cjs/components/select/Select.js +33 -12
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +2 -3
- package/lib/cjs/components/selectboxes/SelectBoxes.js +2 -2
- package/lib/cjs/components/signature/Signature.d.ts +1 -1
- package/lib/cjs/components/signature/Signature.js +3 -5
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +6 -0
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +1 -0
- package/lib/cjs/components/survey/Survey.js +2 -2
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +0 -8
- package/lib/cjs/components/tags/Tags.d.ts +1 -1
- package/lib/cjs/components/tags/Tags.js +2 -2
- package/lib/cjs/components/textarea/TextArea.js +6 -6
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +0 -12
- package/lib/cjs/components/url/editForm/Url.edit.display.js +0 -12
- package/lib/cjs/components/well/editForm/Well.edit.display.js +0 -8
- package/lib/cjs/formio.form.js +0 -5
- package/lib/cjs/providers/storage/googleDrive.js +2 -3
- package/lib/cjs/providers/storage/s3.js +3 -3
- package/lib/cjs/providers/storage/xhr.d.ts +0 -1
- package/lib/cjs/providers/storage/xhr.js +1 -6
- package/lib/cjs/translations/en.d.ts +81 -234
- package/lib/cjs/translations/en.js +81 -8
- package/lib/cjs/utils/ChoicesWrapper.d.ts +25 -4
- package/lib/cjs/utils/ChoicesWrapper.js +124 -47
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/i18n.d.ts +2 -5
- package/lib/cjs/utils/i18n.js +5 -32
- package/lib/cjs/widgets/CalendarWidget.js +27 -27
- package/lib/mjs/CDN.d.ts +1 -1
- package/lib/mjs/CDN.js +2 -2
- package/lib/mjs/Embed.js +1 -1
- package/lib/mjs/Form.d.ts +6 -4
- package/lib/mjs/Form.js +9 -17
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +4 -4
- package/lib/mjs/Webform.d.ts +13 -16
- package/lib/mjs/Webform.js +158 -171
- package/lib/mjs/WebformBuilder.js +28 -17
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/WizardBuilder.js +2 -15
- package/lib/mjs/components/Components.d.ts +0 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +0 -1
- package/lib/mjs/components/_classes/component/Component.js +11 -27
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +2 -13
- package/lib/mjs/components/_classes/component/editForm/utils.d.ts +0 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +0 -3
- package/lib/mjs/components/_classes/input/Input.js +1 -22
- package/lib/mjs/components/_classes/list/ListComponent.js +4 -4
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -1
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +3 -10
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +0 -13
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +0 -2
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +31 -53
- package/lib/mjs/components/address/Address.js +1 -1
- package/lib/mjs/components/button/Button.js +6 -6
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.js +2 -2
- package/lib/mjs/components/content/editForm/Content.edit.display.js +0 -8
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +0 -12
- package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -2
- package/lib/mjs/components/datagrid/DataGrid.js +26 -41
- package/lib/mjs/components/day/Day.js +7 -9
- package/lib/mjs/components/day/editForm/Day.edit.display.js +0 -8
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +7 -25
- package/lib/mjs/components/email/editForm/Email.edit.display.js +0 -12
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +0 -8
- package/lib/mjs/components/file/File.d.ts +1 -1
- package/lib/mjs/components/file/File.js +17 -23
- package/lib/mjs/components/form/Form.d.ts +1 -1
- package/lib/mjs/components/form/Form.js +5 -8
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -3
- package/lib/mjs/components/hidden/Hidden.d.ts +1 -0
- package/lib/mjs/components/hidden/Hidden.js +1 -1
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +0 -8
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +0 -8
- package/lib/mjs/components/number/Number.js +5 -12
- package/lib/mjs/components/number/editForm/Number.edit.display.js +0 -12
- package/lib/mjs/components/password/editForm/Password.edit.display.js +1 -13
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +1 -9
- package/lib/mjs/components/radio/Radio.js +0 -10
- package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/mjs/components/select/Select.d.ts +1 -0
- package/lib/mjs/components/select/Select.js +34 -14
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +2 -3
- package/lib/mjs/components/selectboxes/SelectBoxes.js +2 -2
- package/lib/mjs/components/signature/Signature.d.ts +1 -1
- package/lib/mjs/components/signature/Signature.js +3 -5
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +6 -0
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +1 -0
- package/lib/mjs/components/survey/Survey.js +2 -2
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +0 -8
- package/lib/mjs/components/tags/Tags.d.ts +1 -1
- package/lib/mjs/components/tags/Tags.js +2 -2
- package/lib/mjs/components/textarea/TextArea.js +6 -6
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +0 -12
- package/lib/mjs/components/url/editForm/Url.edit.display.js +0 -12
- package/lib/mjs/components/well/editForm/Well.edit.display.js +0 -8
- package/lib/mjs/formio.form.js +0 -5
- package/lib/mjs/providers/storage/googleDrive.js +2 -3
- package/lib/mjs/providers/storage/s3.js +3 -3
- package/lib/mjs/providers/storage/xhr.d.ts +0 -1
- package/lib/mjs/providers/storage/xhr.js +1 -6
- package/lib/mjs/translations/en.d.ts +81 -234
- package/lib/mjs/translations/en.js +1 -87
- package/lib/mjs/utils/ChoicesWrapper.d.ts +25 -4
- package/lib/mjs/utils/ChoicesWrapper.js +119 -26
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/i18n.d.ts +2 -5
- package/lib/mjs/utils/i18n.js +5 -32
- package/lib/mjs/widgets/CalendarWidget.js +27 -27
- package/package.json +11 -27
@@ -189,8 +189,7 @@ export default class WebformBuilder extends Component {
|
|
189
189
|
params: {
|
190
190
|
type: 'resource',
|
191
191
|
limit: 1000000,
|
192
|
-
select: '_id,title,name,components'
|
193
|
-
'tags__ne': 'noBuilderResource'
|
192
|
+
select: '_id,title,name,components'
|
194
193
|
}
|
195
194
|
};
|
196
195
|
if (this.options && this.options.resourceTag) {
|
@@ -212,7 +211,7 @@ export default class WebformBuilder extends Component {
|
|
212
211
|
}
|
213
212
|
}
|
214
213
|
}).catch((err) => {
|
215
|
-
console.warn(
|
214
|
+
console.warn(`Could not load project settings: ${err.message || err}`);
|
216
215
|
});
|
217
216
|
if (!formio.noProject && !isResourcesDisabled && formio.formsUrl) {
|
218
217
|
const resourceOptions = this.options.builder && this.options.builder.resource;
|
@@ -322,18 +321,18 @@ export default class WebformBuilder extends Component {
|
|
322
321
|
editJson: 'single'
|
323
322
|
});
|
324
323
|
if (component.refs.copyComponent) {
|
325
|
-
this.attachTooltip(component.refs.copyComponent, this.t('
|
324
|
+
this.attachTooltip(component.refs.copyComponent, this.t('Copy'));
|
326
325
|
component.addEventListener(component.refs.copyComponent, 'click', () => this.copyComponent(component));
|
327
326
|
}
|
328
327
|
if (component.refs.pasteComponent) {
|
329
|
-
const pasteToolTip = this.attachTooltip(component.refs.pasteComponent, this.t('
|
328
|
+
const pasteToolTip = this.attachTooltip(component.refs.pasteComponent, this.t('Paste below'));
|
330
329
|
component.addEventListener(component.refs.pasteComponent, 'click', () => {
|
331
330
|
pasteToolTip.hide();
|
332
331
|
this.pasteComponent(component);
|
333
332
|
});
|
334
333
|
}
|
335
334
|
if (component.refs.moveComponent) {
|
336
|
-
this.attachTooltip(component.refs.moveComponent, this.t('
|
335
|
+
this.attachTooltip(component.refs.moveComponent, this.t('Move'));
|
337
336
|
if (this.keyboardActionsEnabled) {
|
338
337
|
component.addEventListener(component.refs.moveComponent, 'click', () => {
|
339
338
|
this.moveComponent(component);
|
@@ -342,15 +341,15 @@ export default class WebformBuilder extends Component {
|
|
342
341
|
}
|
343
342
|
const parent = this.getParentElement(element);
|
344
343
|
if (component.refs.editComponent) {
|
345
|
-
this.attachTooltip(component.refs.editComponent, this.t('
|
344
|
+
this.attachTooltip(component.refs.editComponent, this.t('Edit'));
|
346
345
|
component.addEventListener(component.refs.editComponent, 'click', () => this.editComponent(component.schema, parent, false, false, component.component, { inDataGrid: component.isInDataGrid }));
|
347
346
|
}
|
348
347
|
if (component.refs.editJson) {
|
349
|
-
this.attachTooltip(component.refs.editJson, this.t('
|
348
|
+
this.attachTooltip(component.refs.editJson, this.t('Edit JSON'));
|
350
349
|
component.addEventListener(component.refs.editJson, 'click', () => this.editComponent(component.schema, parent, false, true, component.component));
|
351
350
|
}
|
352
351
|
if (component.refs.removeComponent) {
|
353
|
-
this.attachTooltip(component.refs.removeComponent, this.t('
|
352
|
+
this.attachTooltip(component.refs.removeComponent, this.t('Remove'));
|
354
353
|
component.addEventListener(component.refs.removeComponent, 'click', () => this.removeComponent(component.schema, parent, component.component, component));
|
355
354
|
}
|
356
355
|
return element;
|
@@ -795,18 +794,31 @@ export default class WebformBuilder extends Component {
|
|
795
794
|
// Show an error if siblings are disabled for a component and such a component already exists.
|
796
795
|
const compKey = (group === 'resource') ? `component-${key}` : key;
|
797
796
|
const draggableComponent = this.groups[group]?.components[compKey] || {};
|
798
|
-
if (draggableComponent.disableSiblings
|
797
|
+
if (draggableComponent.disableSiblings) {
|
799
798
|
let isCompAlreadyExists = false;
|
800
799
|
eachComponent(this.webform.components, (component) => {
|
801
|
-
if (
|
802
|
-
(draggableComponent.uniqueComponent && component.component.key === draggableComponent.schema.key)) {
|
800
|
+
if (component.type === draggableComponent.schema.type) {
|
803
801
|
isCompAlreadyExists = true;
|
804
802
|
return;
|
805
803
|
}
|
806
804
|
}, true);
|
807
805
|
if (isCompAlreadyExists) {
|
808
806
|
this.webform.redraw();
|
809
|
-
this.webform.setAlert('danger',
|
807
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.key} component to one page.`);
|
808
|
+
return;
|
809
|
+
}
|
810
|
+
}
|
811
|
+
if (draggableComponent.uniqueComponent) {
|
812
|
+
let isCompAlreadyExists = false;
|
813
|
+
eachComponent(this.webform.components, (component) => {
|
814
|
+
if (component.key === draggableComponent.schema.key) {
|
815
|
+
isCompAlreadyExists = true;
|
816
|
+
return;
|
817
|
+
}
|
818
|
+
}, true);
|
819
|
+
if (isCompAlreadyExists) {
|
820
|
+
this.webform.redraw();
|
821
|
+
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.title} component to one page.`);
|
810
822
|
return;
|
811
823
|
}
|
812
824
|
}
|
@@ -1239,8 +1251,7 @@ export default class WebformBuilder extends Component {
|
|
1239
1251
|
helplinks: this.helplinks,
|
1240
1252
|
}));
|
1241
1253
|
this.editForm.attach(this.componentEdit.querySelector(`[${this._referenceAttributeName}="editForm"]`));
|
1242
|
-
|
1243
|
-
this.updateComponent(editFormData?.componentJson || editFormData || component);
|
1254
|
+
this.updateComponent(this.editForm.submission.data ?? component);
|
1244
1255
|
this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
|
1245
1256
|
});
|
1246
1257
|
});
|
@@ -1525,7 +1536,7 @@ export default class WebformBuilder extends Component {
|
|
1525
1536
|
*/
|
1526
1537
|
copyComponent(component) {
|
1527
1538
|
if (!window.sessionStorage) {
|
1528
|
-
return console.warn(this.
|
1539
|
+
return console.warn('Session storage is not supported in this browser.');
|
1529
1540
|
}
|
1530
1541
|
this.addClass(this.refs.form, 'builder-paste-mode');
|
1531
1542
|
window.sessionStorage.setItem('formio.clipboard', JSON.stringify(component.schema));
|
@@ -1537,7 +1548,7 @@ export default class WebformBuilder extends Component {
|
|
1537
1548
|
*/
|
1538
1549
|
pasteComponent(component) {
|
1539
1550
|
if (!window.sessionStorage) {
|
1540
|
-
return console.warn(this.
|
1551
|
+
return console.warn('Session storage is not supported in this browser.');
|
1541
1552
|
}
|
1542
1553
|
this.removeClass(this.refs.form, 'builder-paste-mode');
|
1543
1554
|
if (window.sessionStorage) {
|
package/lib/mjs/Wizard.js
CHANGED
@@ -606,7 +606,7 @@ export default class Wizard extends Webform {
|
|
606
606
|
this.redraw();
|
607
607
|
return Promise.resolve();
|
608
608
|
}
|
609
|
-
return Promise.reject(
|
609
|
+
return Promise.reject('Page not found');
|
610
610
|
}
|
611
611
|
pageFieldLogic(page) {
|
612
612
|
if (this.pages?.[page]) {
|
package/lib/mjs/WizardBuilder.js
CHANGED
@@ -217,7 +217,7 @@ export default class WizardBuilder extends WebformBuilder {
|
|
217
217
|
const isSiblingAnAddPageButton = sibling?.classList.contains('wizard-add-page');
|
218
218
|
// We still can paste before Add Page button
|
219
219
|
if (!element.dragInfo || (sibling && !sibling.dragInfo && !isSiblingAnAddPageButton)) {
|
220
|
-
console.warn(
|
220
|
+
console.warn('There is no Drag Info available for either dragged or sibling element');
|
221
221
|
return;
|
222
222
|
}
|
223
223
|
const oldPosition = element.dragInfo.index;
|
@@ -255,23 +255,10 @@ export default class WizardBuilder extends WebformBuilder {
|
|
255
255
|
if (component instanceof WizardBuilder) {
|
256
256
|
return;
|
257
257
|
}
|
258
|
-
if (!window.sessionStorage) {
|
259
|
-
return console.warn(this.t('sessionStorageSupportError'));
|
260
|
-
}
|
261
|
-
// If pasting after the Wizard's page, check if a full Wizard page was copied and pass it to addPage method
|
262
258
|
if (this._form.components.find(comp => _.isEqual(component.component, comp))) {
|
263
|
-
|
264
|
-
if (data) {
|
265
|
-
const schema = JSON.parse(data);
|
266
|
-
// If the copied component is not a Wizard's page, do nothing since we can't paste outside the panel in Wizard
|
267
|
-
if (schema.type !== 'panel') {
|
268
|
-
return;
|
269
|
-
}
|
270
|
-
this.addPage(schema);
|
271
|
-
}
|
259
|
+
this.addPage(component);
|
272
260
|
}
|
273
261
|
else {
|
274
|
-
// If we are not trying to paster after the current Wizard's page, just pass it to the WebformBuilder
|
275
262
|
return super.pasteComponent(component);
|
276
263
|
}
|
277
264
|
}
|
@@ -2,7 +2,6 @@ export default class Components {
|
|
2
2
|
static _editFormUtils: {
|
3
3
|
sortAndFilterComponents(components: any): any;
|
4
4
|
unifyComponents(objValue: any, srcValue: any): any;
|
5
|
-
tokenVariableDescription(): string;
|
6
5
|
logicVariablesTable(additional: any): {
|
7
6
|
type: string;
|
8
7
|
tag: string;
|
@@ -87,7 +86,6 @@ export default class Components {
|
|
87
86
|
static set EditFormUtils(value: {
|
88
87
|
sortAndFilterComponents(components: any): any;
|
89
88
|
unifyComponents(objValue: any, srcValue: any): any;
|
90
|
-
tokenVariableDescription(): string;
|
91
89
|
logicVariablesTable(additional: any): {
|
92
90
|
type: string;
|
93
91
|
tag: string;
|
@@ -171,7 +169,6 @@ export default class Components {
|
|
171
169
|
static get EditFormUtils(): {
|
172
170
|
sortAndFilterComponents(components: any): any;
|
173
171
|
unifyComponents(objValue: any, srcValue: any): any;
|
174
|
-
tokenVariableDescription(): string;
|
175
172
|
logicVariablesTable(additional: any): {
|
176
173
|
type: string;
|
177
174
|
tag: string;
|
@@ -855,7 +855,6 @@ declare class Component extends Element {
|
|
855
855
|
quill: any;
|
856
856
|
get shouldSanitizeValue(): boolean;
|
857
857
|
addAce(element: any, settings: any, onChange: any): any;
|
858
|
-
getDragula(): Promise<any>;
|
859
858
|
get tree(): any;
|
860
859
|
/**
|
861
860
|
* The empty value for this component.
|
@@ -161,7 +161,6 @@ export default class Component extends Element {
|
|
161
161
|
properties: {},
|
162
162
|
allowMultipleMasks: false,
|
163
163
|
addons: [],
|
164
|
-
serverOverride: {},
|
165
164
|
}, ...sources);
|
166
165
|
}
|
167
166
|
/**
|
@@ -412,9 +411,6 @@ export default class Component extends Element {
|
|
412
411
|
// Allow anyone to hook into the component creation.
|
413
412
|
this.hook('component');
|
414
413
|
if (!this.options.skipInit) {
|
415
|
-
if (typeof this.beforeInit === 'function') {
|
416
|
-
this.beforeInit();
|
417
|
-
}
|
418
414
|
this.init();
|
419
415
|
}
|
420
416
|
}
|
@@ -515,10 +511,7 @@ export default class Component extends Element {
|
|
515
511
|
this.addons.push(addon);
|
516
512
|
}
|
517
513
|
else {
|
518
|
-
console.warn(
|
519
|
-
type: this.component.type,
|
520
|
-
label: name.label
|
521
|
-
}));
|
514
|
+
console.warn(`Addon ${name.label} does not support component of type ${this.component.type}.`);
|
522
515
|
}
|
523
516
|
}
|
524
517
|
return addon;
|
@@ -570,7 +563,7 @@ export default class Component extends Element {
|
|
570
563
|
return this.paths.dataPath;
|
571
564
|
}
|
572
565
|
set path(path) {
|
573
|
-
throw new Error(
|
566
|
+
throw new Error('Should not be setting the path of a component.');
|
574
567
|
}
|
575
568
|
set parentVisible(value) {
|
576
569
|
this._parentVisible = value;
|
@@ -662,7 +655,7 @@ export default class Component extends Element {
|
|
662
655
|
return this.options.attachMode === 'builder';
|
663
656
|
}
|
664
657
|
get calculatedPath() {
|
665
|
-
console.error(
|
658
|
+
console.error('component.calculatedPath was deprecated, use component.path instead.');
|
666
659
|
return this.path;
|
667
660
|
}
|
668
661
|
get labelPosition() {
|
@@ -828,7 +821,7 @@ export default class Component extends Element {
|
|
828
821
|
const name = names[names.length - 1];
|
829
822
|
const templatesByName = Templates.defaultTemplates[name];
|
830
823
|
if (!templatesByName) {
|
831
|
-
return { template:
|
824
|
+
return { template: `Unknown template: ${name}` };
|
832
825
|
}
|
833
826
|
const templateByMode = this.checkTemplateMode(templatesByName, modes);
|
834
827
|
if (templateByMode) {
|
@@ -885,7 +878,9 @@ export default class Component extends Element {
|
|
885
878
|
data.disabled = this.disabled;
|
886
879
|
data.builder = this.builderMode;
|
887
880
|
data.render = (...args) => {
|
888
|
-
console.warn(
|
881
|
+
console.warn(`Form.io 'render' template function is deprecated.
|
882
|
+
If you need to render template (template A) inside of another template (template B),
|
883
|
+
pass pre-compiled template A (use this.renderTemplate('template_A_name') as template context variable for template B`);
|
889
884
|
return this.renderTemplate(...args);
|
890
885
|
};
|
891
886
|
data.label = data.labelInfo || this.labelInfo;
|
@@ -1085,7 +1080,7 @@ export default class Component extends Element {
|
|
1085
1080
|
modalLabel = { className: 'field-required' };
|
1086
1081
|
}
|
1087
1082
|
return this.renderModalPreview({
|
1088
|
-
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('
|
1083
|
+
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
|
1089
1084
|
messages: '',
|
1090
1085
|
labelInfo: modalLabel,
|
1091
1086
|
});
|
@@ -1110,7 +1105,7 @@ export default class Component extends Element {
|
|
1110
1105
|
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
1111
1106
|
* @returns {string} - The rendered HTML string of a component.
|
1112
1107
|
*/
|
1113
|
-
render(children =
|
1108
|
+
render(children = `Unknown component: ${this.component.type}`, topLevel = false) {
|
1114
1109
|
const isVisible = this.visible;
|
1115
1110
|
this.rendered = true;
|
1116
1111
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
@@ -2412,13 +2407,6 @@ export default class Component extends Element {
|
|
2412
2407
|
return editor;
|
2413
2408
|
});
|
2414
2409
|
}
|
2415
|
-
async getDragula() {
|
2416
|
-
return new Promise((resolve) => {
|
2417
|
-
return Formio.requireLibrary('dragula', 'dragula', `${Formio.cdn.dragula}/dragula.js`, true, (ready) => {
|
2418
|
-
return ready.then(resolve);
|
2419
|
-
});
|
2420
|
-
});
|
2421
|
-
}
|
2422
2410
|
get tree() {
|
2423
2411
|
return this.component.tree || false;
|
2424
2412
|
}
|
@@ -2548,7 +2536,7 @@ export default class Component extends Element {
|
|
2548
2536
|
}
|
2549
2537
|
return value;
|
2550
2538
|
};
|
2551
|
-
if (
|
2539
|
+
if (this.defaultMask) {
|
2552
2540
|
if (Array.isArray(defaultValue)) {
|
2553
2541
|
defaultValue = defaultValue.map(checkMask);
|
2554
2542
|
}
|
@@ -3321,7 +3309,7 @@ export default class Component extends Element {
|
|
3321
3309
|
}
|
3322
3310
|
// Maintain reverse compatibility.
|
3323
3311
|
whenReady() {
|
3324
|
-
console.warn(
|
3312
|
+
console.warn('The whenReady() method has been deprecated. Please use the dataReady property instead.');
|
3325
3313
|
return this.dataReady;
|
3326
3314
|
}
|
3327
3315
|
get dataReady() {
|
@@ -3456,10 +3444,6 @@ export default class Component extends Element {
|
|
3456
3444
|
const disabled = this.shouldDisabled;
|
3457
3445
|
// Change states which won't be recalculated during redrawing
|
3458
3446
|
if (this.visible !== visible) {
|
3459
|
-
// If the logic is triggered by an event and the action sets the hidden state then the original
|
3460
|
-
// component definition must be changed so that the components hidden state does not get flipped back by
|
3461
|
-
// the fieldLogic function
|
3462
|
-
this.originalComponent.hidden = !visible;
|
3463
3447
|
this.visible = visible;
|
3464
3448
|
}
|
3465
3449
|
if (this.disabled !== disabled) {
|
@@ -45,6 +45,6 @@ export default [
|
|
45
45
|
},
|
46
46
|
EditFormUtils.javaScriptValue('Advanced Conditions', 'customConditional', 'conditional.json', 110, '<p>You must assign the <strong>show</strong> variable a boolean result.</p>' +
|
47
47
|
'<p><strong>Note: Advanced Conditional logic will override the results of the Simple Conditional logic.</strong></p>' +
|
48
|
-
'<h5>Example</h5><pre>show = !!data.showMe;</pre>', '<p><a href="https://help.form.io/userguide/form-building/logic-and-conditions" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>'
|
48
|
+
'<h5>Example</h5><pre>show = !!data.showMe;</pre>', '<p><a href="https://help.form.io/userguide/form-building/logic-and-conditions" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>')
|
49
49
|
];
|
50
50
|
/* eslint-enable quotes, max-len */
|
@@ -87,9 +87,6 @@ declare const _default: ({
|
|
87
87
|
valueProperty?: undefined;
|
88
88
|
data?: undefined;
|
89
89
|
conditional?: undefined;
|
90
|
-
as?: undefined;
|
91
|
-
editor?: undefined;
|
92
|
-
description?: undefined;
|
93
90
|
} | {
|
94
91
|
type: string;
|
95
92
|
label: string;
|
@@ -106,9 +103,6 @@ declare const _default: ({
|
|
106
103
|
valueProperty?: undefined;
|
107
104
|
data?: undefined;
|
108
105
|
conditional?: undefined;
|
109
|
-
as?: undefined;
|
110
|
-
editor?: undefined;
|
111
|
-
description?: undefined;
|
112
106
|
} | {
|
113
107
|
weight: number;
|
114
108
|
type: string;
|
@@ -131,9 +125,6 @@ declare const _default: ({
|
|
131
125
|
valueProperty?: undefined;
|
132
126
|
data?: undefined;
|
133
127
|
conditional?: undefined;
|
134
|
-
as?: undefined;
|
135
|
-
editor?: undefined;
|
136
|
-
description?: undefined;
|
137
128
|
} | {
|
138
129
|
weight: number;
|
139
130
|
type: string;
|
@@ -182,9 +173,6 @@ declare const _default: ({
|
|
182
173
|
valueProperty?: undefined;
|
183
174
|
data?: undefined;
|
184
175
|
conditional?: undefined;
|
185
|
-
as?: undefined;
|
186
|
-
editor?: undefined;
|
187
|
-
description?: undefined;
|
188
176
|
} | {
|
189
177
|
type: string;
|
190
178
|
input: boolean;
|
@@ -212,9 +200,6 @@ declare const _default: ({
|
|
212
200
|
defaultValue?: undefined;
|
213
201
|
values?: undefined;
|
214
202
|
logic?: undefined;
|
215
|
-
as?: undefined;
|
216
|
-
editor?: undefined;
|
217
|
-
description?: undefined;
|
218
203
|
} | {
|
219
204
|
weight: number;
|
220
205
|
type: string;
|
@@ -231,27 +216,5 @@ declare const _default: ({
|
|
231
216
|
valueProperty?: undefined;
|
232
217
|
data?: undefined;
|
233
218
|
conditional?: undefined;
|
234
|
-
as?: undefined;
|
235
|
-
editor?: undefined;
|
236
|
-
description?: undefined;
|
237
|
-
} | {
|
238
|
-
type: string;
|
239
|
-
as: string;
|
240
|
-
editor: string;
|
241
|
-
weight: number;
|
242
|
-
input: boolean;
|
243
|
-
key: string;
|
244
|
-
label: string;
|
245
|
-
tooltip: string;
|
246
|
-
defaultValue: {};
|
247
|
-
description: string;
|
248
|
-
placeholder?: undefined;
|
249
|
-
inline?: undefined;
|
250
|
-
values?: undefined;
|
251
|
-
logic?: undefined;
|
252
|
-
dataSrc?: undefined;
|
253
|
-
valueProperty?: undefined;
|
254
|
-
data?: undefined;
|
255
|
-
conditional?: undefined;
|
256
219
|
})[];
|
257
220
|
export default _default;
|
@@ -135,7 +135,7 @@ export default [
|
|
135
135
|
input: true
|
136
136
|
},
|
137
137
|
EditFormUtils.javaScriptValue('Custom Default Value', 'customDefaultValue', 'customDefaultValue', 1000, '<p><h4>Example:</h4><pre>value = data.firstName + " " + data.lastName;</pre></p>', '<p><h4>Example:</h4><pre>{"cat": [{"var": "data.firstName"}, " ", {"var": "data.lastName"}]}</pre>'),
|
138
|
-
EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 1100, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="https://help.form.io/userguide/form-building/logic-and-conditions#calculated-values" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>',
|
138
|
+
EditFormUtils.javaScriptValue('Calculated Value', 'calculateValue', 'calculateValue', 1100, '<p><h4>Example:</h4><pre>value = data.a + data.b + data.c;</pre></p>', '<p><h4>Example:</h4><pre>{"+": [{"var": "data.a"}, {"var": "data.b"}, {"var": "data.c"}]}</pre><p><a href="https://help.form.io/userguide/form-building/logic-and-conditions#calculated-values" target="_blank" rel="noopener noreferrer">Click here for an example</a></p>', '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>'),
|
139
139
|
{
|
140
140
|
type: 'checkbox',
|
141
141
|
input: true,
|
@@ -152,16 +152,5 @@ export default [
|
|
152
152
|
label: 'Allow Manual Override of Calculated Value',
|
153
153
|
tooltip: 'When checked, this will allow the user to manually override the calculated value.'
|
154
154
|
},
|
155
|
-
{
|
156
|
-
type: 'textarea',
|
157
|
-
as: 'json',
|
158
|
-
editor: 'ace',
|
159
|
-
weight: 1400,
|
160
|
-
input: true,
|
161
|
-
key: 'serverOverride',
|
162
|
-
label: 'Server Override',
|
163
|
-
tooltip: 'A JSON object containing the component settings that should be overriden when the form submission is processed on the server side.',
|
164
|
-
defaultValue: {},
|
165
|
-
description: '<b>Example</b>: { "clearOnHide": true }',
|
166
|
-
}
|
167
155
|
];
|
156
|
+
/* eslint-enable max-len */
|
@@ -2,7 +2,6 @@ export default EditFormUtils;
|
|
2
2
|
declare namespace EditFormUtils {
|
3
3
|
function sortAndFilterComponents(components: any): any;
|
4
4
|
function unifyComponents(objValue: any, srcValue: any): any;
|
5
|
-
function tokenVariableDescription(): string;
|
6
5
|
function logicVariablesTable(additional: any): {
|
7
6
|
type: string;
|
8
7
|
tag: string;
|
@@ -32,9 +32,6 @@ const EditFormUtils = {
|
|
32
32
|
}
|
33
33
|
return _.isEqual(objValue, srcValue);
|
34
34
|
},
|
35
|
-
tokenVariableDescription() {
|
36
|
-
return '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>';
|
37
|
-
},
|
38
35
|
logicVariablesTable(additional) {
|
39
36
|
additional = additional || '';
|
40
37
|
return {
|
@@ -233,28 +233,7 @@ export default class Input extends Multivalue {
|
|
233
233
|
if (key === 13) {
|
234
234
|
event.preventDefault();
|
235
235
|
event.stopPropagation();
|
236
|
-
|
237
|
-
if (this.root?.everyComponent) {
|
238
|
-
this.root.everyComponent((component) => {
|
239
|
-
if (component?.component.type === 'button' &&
|
240
|
-
component?.component.action === 'submit') {
|
241
|
-
submitButton = component;
|
242
|
-
return false;
|
243
|
-
}
|
244
|
-
});
|
245
|
-
}
|
246
|
-
const options = {};
|
247
|
-
if (submitButton) {
|
248
|
-
options.instance = submitButton;
|
249
|
-
options.component = submitButton.component;
|
250
|
-
options.noValidate = this.component.state === 'draft';
|
251
|
-
options.state = this.component.state || 'submitted';
|
252
|
-
submitButton.loading = true;
|
253
|
-
this.emit('submitButton', options);
|
254
|
-
}
|
255
|
-
else {
|
256
|
-
this.emit('submitButton', options);
|
257
|
-
}
|
236
|
+
this.emit('submitButton');
|
258
237
|
}
|
259
238
|
});
|
260
239
|
}
|
@@ -133,12 +133,12 @@ export default class ListComponent extends Field {
|
|
133
133
|
component: this.component,
|
134
134
|
message: err.toString(),
|
135
135
|
});
|
136
|
-
console.warn(
|
136
|
+
console.warn(`Unable to load resources for ${this.key}`);
|
137
137
|
}
|
138
138
|
/* eslint-disable max-statements */
|
139
139
|
updateItems(searchInput, forceUpdate) {
|
140
140
|
if (!this.component.data) {
|
141
|
-
console.warn(
|
141
|
+
console.warn(`Select component ${this.key} does not have data configuration.`);
|
142
142
|
this.itemsLoadedResolve();
|
143
143
|
return;
|
144
144
|
}
|
@@ -170,7 +170,7 @@ export default class ListComponent extends Field {
|
|
170
170
|
this.loadItems(resourceUrl, searchInput, this.requestHeaders);
|
171
171
|
}
|
172
172
|
catch (err) {
|
173
|
-
console.warn(
|
173
|
+
console.warn(`Unable to load resources for ${this.key}`);
|
174
174
|
}
|
175
175
|
}
|
176
176
|
else {
|
@@ -214,7 +214,7 @@ export default class ListComponent extends Field {
|
|
214
214
|
return;
|
215
215
|
}
|
216
216
|
if (!window.indexedDB) {
|
217
|
-
window.alert(
|
217
|
+
window.alert("Your browser doesn't support current version of indexedDB");
|
218
218
|
}
|
219
219
|
if (this.component.indexeddb && this.component.indexeddb.database && this.component.indexeddb.table) {
|
220
220
|
const request = window.indexedDB.open(this.component.indexeddb.database);
|
@@ -51,7 +51,7 @@ export default class Multivalue extends Field {
|
|
51
51
|
attachMultiMask(index: number): boolean;
|
52
52
|
/**
|
53
53
|
* @param {any} input - The input element on which the mask is to be applied.
|
54
|
-
* @param {string} mask - The mask pattern to apply to the input element. Exit early
|
54
|
+
* @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
|
55
55
|
*/
|
56
56
|
updateMask(input: any, mask: string): void;
|
57
57
|
/**
|
@@ -61,7 +61,7 @@ export default class Multivalue extends Field {
|
|
61
61
|
return value;
|
62
62
|
}
|
63
63
|
get addAnother() {
|
64
|
-
return this.t(this.component.addAnother || '
|
64
|
+
return this.t(this.component.addAnother || 'Add Another');
|
65
65
|
}
|
66
66
|
/**
|
67
67
|
* @returns {Field} - The created field.
|
@@ -180,7 +180,7 @@ export default class Multivalue extends Field {
|
|
180
180
|
this.saveCaretPosition(element, index);
|
181
181
|
}
|
182
182
|
catch (err) {
|
183
|
-
console.warn(
|
183
|
+
console.warn('An error occurred while trying to save caret position', err);
|
184
184
|
}
|
185
185
|
// If a mask is present, delay the update to allow mask to update first.
|
186
186
|
if (element.mask) {
|
@@ -259,17 +259,10 @@ export default class Multivalue extends Field {
|
|
259
259
|
}
|
260
260
|
/**
|
261
261
|
* @param {any} input - The input element on which the mask is to be applied.
|
262
|
-
* @param {string} mask - The mask pattern to apply to the input element. Exit early
|
262
|
+
* @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
|
263
263
|
*/
|
264
264
|
updateMask(input, mask) {
|
265
265
|
if (!mask) {
|
266
|
-
if (input.mask) {
|
267
|
-
input.mask.destroy();
|
268
|
-
}
|
269
|
-
if (!this.component.placeholder) {
|
270
|
-
input.removeAttribute('placeholder');
|
271
|
-
}
|
272
|
-
input.value = '';
|
273
266
|
return;
|
274
267
|
}
|
275
268
|
this.setInputMask(input, mask, !this.component.placeholder);
|
@@ -6,19 +6,6 @@ import Components from '../../Components';
|
|
6
6
|
*/
|
7
7
|
export default function (...extend) {
|
8
8
|
return Components.baseEditForm([
|
9
|
-
{
|
10
|
-
key: 'display',
|
11
|
-
components: [
|
12
|
-
{
|
13
|
-
key: 'labelWidth',
|
14
|
-
ignore: true
|
15
|
-
},
|
16
|
-
{
|
17
|
-
key: 'labelMargin',
|
18
|
-
ignore: true
|
19
|
-
}
|
20
|
-
]
|
21
|
-
},
|
22
9
|
{
|
23
10
|
key: 'data',
|
24
11
|
ignore: true
|
@@ -13,8 +13,6 @@ export default class NestedArrayComponent extends NestedDataComponent {
|
|
13
13
|
processRow(method: any, data: any, opts: any, row: any, components: any, silentCheck: any): any;
|
14
14
|
hasAddButton(): any;
|
15
15
|
everyComponent(fn: any, rowIndex: any, options?: {}): void;
|
16
|
-
_getEmailTableHeader(options: any): string;
|
17
|
-
_getEmailTableBody(options: any): string;
|
18
16
|
getComponents(rowIndex: any): any;
|
19
17
|
removeSubmissionMetadataRow(index: any): void;
|
20
18
|
}
|