@formio/js 5.1.0-dev.6059.845a6e3 → 5.1.0-dev.6060.19e3bfc
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 +131 -13
- package/README.md +28 -1
- package/dist/formio.builder.css +19 -17
- 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 +19 -17
- package/dist/formio.form.js +102 -176
- 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 +19 -17
- package/dist/formio.full.js +123 -101
- 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 +4 -6
- package/lib/cjs/Form.js +16 -8
- package/lib/cjs/Formio.js +1 -1
- package/lib/cjs/PDFBuilder.js +4 -4
- package/lib/cjs/Webform.d.ts +16 -13
- package/lib/cjs/Webform.js +162 -148
- package/lib/cjs/WebformBuilder.js +17 -28
- package/lib/cjs/Wizard.js +1 -1
- package/lib/cjs/WizardBuilder.js +15 -2
- package/lib/cjs/components/Components.d.ts +3 -0
- package/lib/cjs/components/_classes/component/Component.d.ts +1 -0
- package/lib/cjs/components/_classes/component/Component.js +38 -11
- 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 +37 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +32 -2
- package/lib/cjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/cjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/cjs/components/_classes/input/Input.js +23 -1
- 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 +10 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +52 -31
- package/lib/cjs/components/address/Address.js +14 -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 +8 -0
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +2 -0
- package/lib/cjs/components/datagrid/DataGrid.js +41 -26
- package/lib/cjs/components/day/Day.js +9 -7
- package/lib/cjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/cjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/cjs/components/editgrid/EditGrid.js +26 -8
- package/lib/cjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/cjs/components/file/File.d.ts +1 -1
- package/lib/cjs/components/file/File.js +30 -19
- package/lib/cjs/components/form/Form.d.ts +1 -1
- package/lib/cjs/components/form/Form.js +9 -5
- package/lib/cjs/components/form/editForm/Form.edit.form.js +3 -3
- package/lib/cjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/cjs/components/hidden/Hidden.js +1 -1
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/cjs/components/number/Number.js +12 -5
- package/lib/cjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/cjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/cjs/components/radio/Radio.js +10 -0
- package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/cjs/components/select/Select.d.ts +0 -1
- package/lib/cjs/components/select/Select.js +12 -33
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +3 -2
- 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 +5 -3
- package/lib/cjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/cjs/components/survey/Survey.js +2 -2
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- 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 +12 -0
- package/lib/cjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/cjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/cjs/formio.form.js +5 -0
- package/lib/cjs/providers/storage/googleDrive.js +3 -2
- package/lib/cjs/providers/storage/s3.js +3 -3
- package/lib/cjs/providers/storage/xhr.d.ts +1 -0
- package/lib/cjs/providers/storage/xhr.js +6 -1
- package/lib/cjs/translations/en.d.ts +234 -81
- package/lib/cjs/translations/en.js +8 -81
- package/lib/cjs/utils/ChoicesWrapper.d.ts +4 -25
- package/lib/cjs/utils/ChoicesWrapper.js +47 -124
- package/lib/cjs/utils/formUtils.d.ts +2 -2
- package/lib/cjs/utils/i18n.d.ts +5 -2
- package/lib/cjs/utils/i18n.js +32 -5
- 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 +4 -6
- package/lib/mjs/Form.js +17 -9
- package/lib/mjs/Formio.js +1 -1
- package/lib/mjs/PDFBuilder.js +4 -4
- package/lib/mjs/Webform.d.ts +16 -13
- package/lib/mjs/Webform.js +171 -158
- package/lib/mjs/WebformBuilder.js +17 -28
- package/lib/mjs/Wizard.js +1 -1
- package/lib/mjs/WizardBuilder.js +15 -2
- package/lib/mjs/components/Components.d.ts +3 -0
- package/lib/mjs/components/_classes/component/Component.d.ts +1 -0
- package/lib/mjs/components/_classes/component/Component.js +27 -11
- 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 +37 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +32 -2
- package/lib/mjs/components/_classes/component/editForm/utils.d.ts +1 -0
- package/lib/mjs/components/_classes/component/editForm/utils.js +3 -0
- package/lib/mjs/components/_classes/input/Input.js +22 -1
- 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 +10 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +13 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +53 -31
- package/lib/mjs/components/address/Address.js +14 -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 +8 -0
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +12 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +2 -0
- package/lib/mjs/components/datagrid/DataGrid.js +41 -26
- package/lib/mjs/components/day/Day.js +9 -7
- package/lib/mjs/components/day/editForm/Day.edit.display.js +8 -0
- package/lib/mjs/components/editgrid/EditGrid.d.ts +1 -1
- package/lib/mjs/components/editgrid/EditGrid.js +25 -7
- package/lib/mjs/components/email/editForm/Email.edit.display.js +12 -0
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -0
- package/lib/mjs/components/file/File.d.ts +1 -1
- package/lib/mjs/components/file/File.js +30 -19
- package/lib/mjs/components/form/Form.d.ts +1 -1
- package/lib/mjs/components/form/Form.js +8 -5
- package/lib/mjs/components/form/editForm/Form.edit.form.js +3 -3
- package/lib/mjs/components/hidden/Hidden.d.ts +0 -1
- package/lib/mjs/components/hidden/Hidden.js +1 -1
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +8 -0
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +8 -0
- package/lib/mjs/components/number/Number.js +12 -5
- package/lib/mjs/components/number/editForm/Number.edit.display.js +12 -0
- package/lib/mjs/components/password/editForm/Password.edit.display.js +13 -1
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -1
- package/lib/mjs/components/radio/Radio.js +10 -0
- package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/mjs/components/select/Select.d.ts +0 -1
- package/lib/mjs/components/select/Select.js +14 -34
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +3 -2
- 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 +5 -3
- package/lib/mjs/components/signature/editForm/Signature.edit.display.d.ts +0 -6
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +0 -1
- package/lib/mjs/components/survey/Survey.js +2 -2
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +8 -0
- 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 +12 -0
- package/lib/mjs/components/url/editForm/Url.edit.display.js +12 -0
- package/lib/mjs/components/well/editForm/Well.edit.display.js +8 -0
- package/lib/mjs/formio.form.js +5 -0
- package/lib/mjs/providers/storage/googleDrive.js +3 -2
- package/lib/mjs/providers/storage/s3.js +3 -3
- package/lib/mjs/providers/storage/xhr.d.ts +1 -0
- package/lib/mjs/providers/storage/xhr.js +6 -1
- package/lib/mjs/translations/en.d.ts +234 -81
- package/lib/mjs/translations/en.js +87 -1
- package/lib/mjs/utils/ChoicesWrapper.d.ts +4 -25
- package/lib/mjs/utils/ChoicesWrapper.js +26 -119
- package/lib/mjs/utils/formUtils.d.ts +2 -2
- package/lib/mjs/utils/i18n.d.ts +5 -2
- package/lib/mjs/utils/i18n.js +32 -5
- package/lib/mjs/widgets/CalendarWidget.js +27 -27
- package/package.json +27 -11
@@ -210,7 +210,8 @@ class WebformBuilder extends Component_1.default {
|
|
210
210
|
params: {
|
211
211
|
type: 'resource',
|
212
212
|
limit: 1000000,
|
213
|
-
select: '_id,title,name,components'
|
213
|
+
select: '_id,title,name,components',
|
214
|
+
'tags__ne': 'noBuilderResource'
|
214
215
|
}
|
215
216
|
};
|
216
217
|
if (this.options && this.options.resourceTag) {
|
@@ -232,7 +233,7 @@ class WebformBuilder extends Component_1.default {
|
|
232
233
|
}
|
233
234
|
}
|
234
235
|
}).catch((err) => {
|
235
|
-
console.warn(
|
236
|
+
console.warn(`${this.t('loadingProjectSettingsError')}: ${err.message || err}`);
|
236
237
|
});
|
237
238
|
if (!formio.noProject && !isResourcesDisabled && formio.formsUrl) {
|
238
239
|
const resourceOptions = this.options.builder && this.options.builder.resource;
|
@@ -335,18 +336,18 @@ class WebformBuilder extends Component_1.default {
|
|
335
336
|
editJson: 'single'
|
336
337
|
});
|
337
338
|
if (component.refs.copyComponent) {
|
338
|
-
this.attachTooltip(component.refs.copyComponent, this.t('
|
339
|
+
this.attachTooltip(component.refs.copyComponent, this.t('copy'));
|
339
340
|
component.addEventListener(component.refs.copyComponent, 'click', () => this.copyComponent(component));
|
340
341
|
}
|
341
342
|
if (component.refs.pasteComponent) {
|
342
|
-
const pasteToolTip = this.attachTooltip(component.refs.pasteComponent, this.t('
|
343
|
+
const pasteToolTip = this.attachTooltip(component.refs.pasteComponent, this.t('pasteBelow'));
|
343
344
|
component.addEventListener(component.refs.pasteComponent, 'click', () => {
|
344
345
|
pasteToolTip.hide();
|
345
346
|
this.pasteComponent(component);
|
346
347
|
});
|
347
348
|
}
|
348
349
|
if (component.refs.moveComponent) {
|
349
|
-
this.attachTooltip(component.refs.moveComponent, this.t('
|
350
|
+
this.attachTooltip(component.refs.moveComponent, this.t('move'));
|
350
351
|
if (this.keyboardActionsEnabled) {
|
351
352
|
component.addEventListener(component.refs.moveComponent, 'click', () => {
|
352
353
|
this.moveComponent(component);
|
@@ -355,15 +356,15 @@ class WebformBuilder extends Component_1.default {
|
|
355
356
|
}
|
356
357
|
const parent = this.getParentElement(element);
|
357
358
|
if (component.refs.editComponent) {
|
358
|
-
this.attachTooltip(component.refs.editComponent, this.t('
|
359
|
+
this.attachTooltip(component.refs.editComponent, this.t('edit'));
|
359
360
|
component.addEventListener(component.refs.editComponent, 'click', () => this.editComponent(component.schema, parent, false, false, component.component, { inDataGrid: component.isInDataGrid }));
|
360
361
|
}
|
361
362
|
if (component.refs.editJson) {
|
362
|
-
this.attachTooltip(component.refs.editJson, this.t('
|
363
|
+
this.attachTooltip(component.refs.editJson, this.t('editJson'));
|
363
364
|
component.addEventListener(component.refs.editJson, 'click', () => this.editComponent(component.schema, parent, false, true, component.component));
|
364
365
|
}
|
365
366
|
if (component.refs.removeComponent) {
|
366
|
-
this.attachTooltip(component.refs.removeComponent, this.t('
|
367
|
+
this.attachTooltip(component.refs.removeComponent, this.t('remove'));
|
367
368
|
component.addEventListener(component.refs.removeComponent, 'click', () => this.removeComponent(component.schema, parent, component.component, component));
|
368
369
|
}
|
369
370
|
return element;
|
@@ -809,31 +810,18 @@ class WebformBuilder extends Component_1.default {
|
|
809
810
|
// Show an error if siblings are disabled for a component and such a component already exists.
|
810
811
|
const compKey = (group === 'resource') ? `component-${key}` : key;
|
811
812
|
const draggableComponent = ((_a = this.groups[group]) === null || _a === void 0 ? void 0 : _a.components[compKey]) || {};
|
812
|
-
if (draggableComponent.disableSiblings) {
|
813
|
+
if (draggableComponent.disableSiblings || draggableComponent.uniqueComponent) {
|
813
814
|
let isCompAlreadyExists = false;
|
814
815
|
(0, formUtils_1.eachComponent)(this.webform.components, (component) => {
|
815
|
-
if (component.type === draggableComponent.schema.type)
|
816
|
+
if ((draggableComponent.disableSiblings && component.type === draggableComponent.schema.type) ||
|
817
|
+
(draggableComponent.uniqueComponent && component.component.key === draggableComponent.schema.key)) {
|
816
818
|
isCompAlreadyExists = true;
|
817
819
|
return;
|
818
820
|
}
|
819
821
|
}, true);
|
820
822
|
if (isCompAlreadyExists) {
|
821
823
|
this.webform.redraw();
|
822
|
-
this.webform.setAlert('danger',
|
823
|
-
return;
|
824
|
-
}
|
825
|
-
}
|
826
|
-
if (draggableComponent.uniqueComponent) {
|
827
|
-
let isCompAlreadyExists = false;
|
828
|
-
(0, formUtils_1.eachComponent)(this.webform.components, (component) => {
|
829
|
-
if (component.key === draggableComponent.schema.key) {
|
830
|
-
isCompAlreadyExists = true;
|
831
|
-
return;
|
832
|
-
}
|
833
|
-
}, true);
|
834
|
-
if (isCompAlreadyExists) {
|
835
|
-
this.webform.redraw();
|
836
|
-
this.webform.setAlert('danger', `You cannot add more than one ${draggableComponent.title} component to one page.`);
|
824
|
+
this.webform.setAlert('danger', this.t('builderUniqueError', { componentKeyOrTitle: lodash_1.default.get(draggableComponent, draggableComponent.uniqueComponent ? 'title' : 'key') }));
|
837
825
|
return;
|
838
826
|
}
|
839
827
|
}
|
@@ -1268,7 +1256,8 @@ class WebformBuilder extends Component_1.default {
|
|
1268
1256
|
helplinks: this.helplinks,
|
1269
1257
|
}));
|
1270
1258
|
this.editForm.attach(this.componentEdit.querySelector(`[${this._referenceAttributeName}="editForm"]`));
|
1271
|
-
|
1259
|
+
const editFormData = (_a = this.editForm.submission) === null || _a === void 0 ? void 0 : _a.data;
|
1260
|
+
this.updateComponent((editFormData === null || editFormData === void 0 ? void 0 : editFormData.componentJson) || editFormData || component);
|
1272
1261
|
this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
|
1273
1262
|
});
|
1274
1263
|
});
|
@@ -1533,7 +1522,7 @@ class WebformBuilder extends Component_1.default {
|
|
1533
1522
|
*/
|
1534
1523
|
copyComponent(component) {
|
1535
1524
|
if (!window.sessionStorage) {
|
1536
|
-
return console.warn(
|
1525
|
+
return console.warn(this.t('sessionStorageSupportError'));
|
1537
1526
|
}
|
1538
1527
|
this.addClass(this.refs.form, 'builder-paste-mode');
|
1539
1528
|
window.sessionStorage.setItem('formio.clipboard', JSON.stringify(component.schema));
|
@@ -1545,7 +1534,7 @@ class WebformBuilder extends Component_1.default {
|
|
1545
1534
|
*/
|
1546
1535
|
pasteComponent(component) {
|
1547
1536
|
if (!window.sessionStorage) {
|
1548
|
-
return console.warn(
|
1537
|
+
return console.warn(this.t('sessionStorageSupportError'));
|
1549
1538
|
}
|
1550
1539
|
this.removeClass(this.refs.form, 'builder-paste-mode');
|
1551
1540
|
if (window.sessionStorage) {
|
package/lib/cjs/Wizard.js
CHANGED
package/lib/cjs/WizardBuilder.js
CHANGED
@@ -223,7 +223,7 @@ class WizardBuilder extends WebformBuilder_1.default {
|
|
223
223
|
const isSiblingAnAddPageButton = sibling === null || sibling === void 0 ? void 0 : sibling.classList.contains('wizard-add-page');
|
224
224
|
// We still can paste before Add Page button
|
225
225
|
if (!element.dragInfo || (sibling && !sibling.dragInfo && !isSiblingAnAddPageButton)) {
|
226
|
-
console.warn('
|
226
|
+
console.warn(this.t('noDragInfoError'));
|
227
227
|
return;
|
228
228
|
}
|
229
229
|
const oldPosition = element.dragInfo.index;
|
@@ -261,10 +261,23 @@ class WizardBuilder extends WebformBuilder_1.default {
|
|
261
261
|
if (component instanceof WizardBuilder) {
|
262
262
|
return;
|
263
263
|
}
|
264
|
+
if (!window.sessionStorage) {
|
265
|
+
return console.warn(this.t('sessionStorageSupportError'));
|
266
|
+
}
|
267
|
+
// If pasting after the Wizard's page, check if a full Wizard page was copied and pass it to addPage method
|
264
268
|
if (this._form.components.find(comp => lodash_1.default.isEqual(component.component, comp))) {
|
265
|
-
|
269
|
+
const data = window.sessionStorage.getItem('formio.clipboard');
|
270
|
+
if (data) {
|
271
|
+
const schema = JSON.parse(data);
|
272
|
+
// If the copied component is not a Wizard's page, do nothing since we can't paste outside the panel in Wizard
|
273
|
+
if (schema.type !== 'panel') {
|
274
|
+
return;
|
275
|
+
}
|
276
|
+
this.addPage(schema);
|
277
|
+
}
|
266
278
|
}
|
267
279
|
else {
|
280
|
+
// If we are not trying to paster after the current Wizard's page, just pass it to the WebformBuilder
|
268
281
|
return super.pasteComponent(component);
|
269
282
|
}
|
270
283
|
}
|
@@ -2,6 +2,7 @@ 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;
|
5
6
|
logicVariablesTable(additional: any): {
|
6
7
|
type: string;
|
7
8
|
tag: string;
|
@@ -86,6 +87,7 @@ export default class Components {
|
|
86
87
|
static set EditFormUtils(value: {
|
87
88
|
sortAndFilterComponents(components: any): any;
|
88
89
|
unifyComponents(objValue: any, srcValue: any): any;
|
90
|
+
tokenVariableDescription(): string;
|
89
91
|
logicVariablesTable(additional: any): {
|
90
92
|
type: string;
|
91
93
|
tag: string;
|
@@ -169,6 +171,7 @@ export default class Components {
|
|
169
171
|
static get EditFormUtils(): {
|
170
172
|
sortAndFilterComponents(components: any): any;
|
171
173
|
unifyComponents(objValue: any, srcValue: any): any;
|
174
|
+
tokenVariableDescription(): string;
|
172
175
|
logicVariablesTable(additional: any): {
|
173
176
|
type: string;
|
174
177
|
tag: string;
|
@@ -855,6 +855,7 @@ 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>;
|
858
859
|
get tree(): any;
|
859
860
|
/**
|
860
861
|
* The empty value for this component.
|
@@ -22,6 +22,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
22
|
__setModuleDefault(result, mod);
|
23
23
|
return result;
|
24
24
|
};
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
32
|
+
});
|
33
|
+
};
|
25
34
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
26
35
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
27
36
|
};
|
@@ -189,6 +198,7 @@ class Component extends Element_1.default {
|
|
189
198
|
properties: {},
|
190
199
|
allowMultipleMasks: false,
|
191
200
|
addons: [],
|
201
|
+
serverOverride: {},
|
192
202
|
}, ...sources);
|
193
203
|
}
|
194
204
|
/**
|
@@ -437,6 +447,9 @@ class Component extends Element_1.default {
|
|
437
447
|
// Allow anyone to hook into the component creation.
|
438
448
|
this.hook('component');
|
439
449
|
if (!this.options.skipInit) {
|
450
|
+
if (typeof this.beforeInit === 'function') {
|
451
|
+
this.beforeInit();
|
452
|
+
}
|
440
453
|
this.init();
|
441
454
|
}
|
442
455
|
}
|
@@ -538,7 +551,10 @@ class Component extends Element_1.default {
|
|
538
551
|
this.addons.push(addon);
|
539
552
|
}
|
540
553
|
else {
|
541
|
-
console.warn(
|
554
|
+
console.warn(this.t('addonSupportTypeError', {
|
555
|
+
type: this.component.type,
|
556
|
+
label: name.label
|
557
|
+
}));
|
542
558
|
}
|
543
559
|
}
|
544
560
|
return addon;
|
@@ -590,7 +606,7 @@ class Component extends Element_1.default {
|
|
590
606
|
return this.paths.dataPath;
|
591
607
|
}
|
592
608
|
set path(path) {
|
593
|
-
throw new Error(
|
609
|
+
throw new Error(this.t('setPathError'));
|
594
610
|
}
|
595
611
|
set parentVisible(value) {
|
596
612
|
this._parentVisible = value;
|
@@ -682,7 +698,7 @@ class Component extends Element_1.default {
|
|
682
698
|
return this.options.attachMode === 'builder';
|
683
699
|
}
|
684
700
|
get calculatedPath() {
|
685
|
-
console.error(
|
701
|
+
console.error(this.t('calculatedPathDeprecation'));
|
686
702
|
return this.path;
|
687
703
|
}
|
688
704
|
get labelPosition() {
|
@@ -848,7 +864,7 @@ class Component extends Element_1.default {
|
|
848
864
|
const name = names[names.length - 1];
|
849
865
|
const templatesByName = Templates_1.default.defaultTemplates[name];
|
850
866
|
if (!templatesByName) {
|
851
|
-
return { template:
|
867
|
+
return { template: this.t('unknownTemplate', { name }) };
|
852
868
|
}
|
853
869
|
const templateByMode = this.checkTemplateMode(templatesByName, modes);
|
854
870
|
if (templateByMode) {
|
@@ -905,9 +921,7 @@ class Component extends Element_1.default {
|
|
905
921
|
data.disabled = this.disabled;
|
906
922
|
data.builder = this.builderMode;
|
907
923
|
data.render = (...args) => {
|
908
|
-
console.warn(
|
909
|
-
If you need to render template (template A) inside of another template (template B),
|
910
|
-
pass pre-compiled template A (use this.renderTemplate('template_A_name') as template context variable for template B`);
|
924
|
+
console.warn(this.t('renderTemplateFunctionDeprecation'));
|
911
925
|
return this.renderTemplate(...args);
|
912
926
|
};
|
913
927
|
data.label = data.labelInfo || this.labelInfo;
|
@@ -1110,7 +1124,7 @@ class Component extends Element_1.default {
|
|
1110
1124
|
modalLabel = { className: 'field-required' };
|
1111
1125
|
}
|
1112
1126
|
return this.renderModalPreview({
|
1113
|
-
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('
|
1127
|
+
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('clickToSetValue'),
|
1114
1128
|
messages: '',
|
1115
1129
|
labelInfo: modalLabel,
|
1116
1130
|
});
|
@@ -1135,7 +1149,7 @@ class Component extends Element_1.default {
|
|
1135
1149
|
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
1136
1150
|
* @returns {string} - The rendered HTML string of a component.
|
1137
1151
|
*/
|
1138
|
-
render(children =
|
1152
|
+
render(children = this.t('unknownComponent', { type: this.component.type }), topLevel = false) {
|
1139
1153
|
const isVisible = this.visible;
|
1140
1154
|
this.rendered = true;
|
1141
1155
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
@@ -2427,6 +2441,15 @@ class Component extends Element_1.default {
|
|
2427
2441
|
return editor;
|
2428
2442
|
});
|
2429
2443
|
}
|
2444
|
+
getDragula() {
|
2445
|
+
return __awaiter(this, void 0, void 0, function* () {
|
2446
|
+
return new Promise((resolve) => {
|
2447
|
+
return Formio_1.Formio.requireLibrary('dragula', 'dragula', `${Formio_1.Formio.cdn.dragula}/dragula.js`, true, (ready) => {
|
2448
|
+
return ready.then(resolve);
|
2449
|
+
});
|
2450
|
+
});
|
2451
|
+
});
|
2452
|
+
}
|
2430
2453
|
get tree() {
|
2431
2454
|
return this.component.tree || false;
|
2432
2455
|
}
|
@@ -2556,7 +2579,7 @@ class Component extends Element_1.default {
|
|
2556
2579
|
}
|
2557
2580
|
return value;
|
2558
2581
|
};
|
2559
|
-
if (this.defaultMask) {
|
2582
|
+
if (Array.isArray(this.defaultMask) ? this.defaultMask.length > 0 : this.defaultMask) {
|
2560
2583
|
if (Array.isArray(defaultValue)) {
|
2561
2584
|
defaultValue = defaultValue.map(checkMask);
|
2562
2585
|
}
|
@@ -3335,7 +3358,7 @@ class Component extends Element_1.default {
|
|
3335
3358
|
}
|
3336
3359
|
// Maintain reverse compatibility.
|
3337
3360
|
whenReady() {
|
3338
|
-
console.warn(
|
3361
|
+
console.warn(this.t('whenReadyDeprecation'));
|
3339
3362
|
return this.dataReady;
|
3340
3363
|
}
|
3341
3364
|
get dataReady() {
|
@@ -3470,6 +3493,10 @@ class Component extends Element_1.default {
|
|
3470
3493
|
const disabled = this.shouldDisabled;
|
3471
3494
|
// Change states which won't be recalculated during redrawing
|
3472
3495
|
if (this.visible !== visible) {
|
3496
|
+
// If the logic is triggered by an event and the action sets the hidden state then the original
|
3497
|
+
// component definition must be changed so that the components hidden state does not get flipped back by
|
3498
|
+
// the fieldLogic function
|
3499
|
+
this.originalComponent.hidden = !visible;
|
3473
3500
|
this.visible = visible;
|
3474
3501
|
}
|
3475
3502
|
if (this.disabled !== disabled) {
|
@@ -50,6 +50,6 @@ exports.default = [
|
|
50
50
|
},
|
51
51
|
utils_1.default.javaScriptValue('Advanced Conditions', 'customConditional', 'conditional.json', 110, '<p>You must assign the <strong>show</strong> variable a boolean result.</p>' +
|
52
52
|
'<p><strong>Note: Advanced Conditional logic will override the results of the Simple Conditional logic.</strong></p>' +
|
53
|
-
'<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>')
|
53
|
+
'<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>', utils_1.default.tokenVariableDescription())
|
54
54
|
];
|
55
55
|
/* eslint-enable quotes, max-len */
|
@@ -87,6 +87,9 @@ declare const _default: ({
|
|
87
87
|
valueProperty?: undefined;
|
88
88
|
data?: undefined;
|
89
89
|
conditional?: undefined;
|
90
|
+
as?: undefined;
|
91
|
+
editor?: undefined;
|
92
|
+
description?: undefined;
|
90
93
|
} | {
|
91
94
|
type: string;
|
92
95
|
label: string;
|
@@ -103,6 +106,9 @@ declare const _default: ({
|
|
103
106
|
valueProperty?: undefined;
|
104
107
|
data?: undefined;
|
105
108
|
conditional?: undefined;
|
109
|
+
as?: undefined;
|
110
|
+
editor?: undefined;
|
111
|
+
description?: undefined;
|
106
112
|
} | {
|
107
113
|
weight: number;
|
108
114
|
type: string;
|
@@ -125,6 +131,9 @@ declare const _default: ({
|
|
125
131
|
valueProperty?: undefined;
|
126
132
|
data?: undefined;
|
127
133
|
conditional?: undefined;
|
134
|
+
as?: undefined;
|
135
|
+
editor?: undefined;
|
136
|
+
description?: undefined;
|
128
137
|
} | {
|
129
138
|
weight: number;
|
130
139
|
type: string;
|
@@ -173,6 +182,9 @@ declare const _default: ({
|
|
173
182
|
valueProperty?: undefined;
|
174
183
|
data?: undefined;
|
175
184
|
conditional?: undefined;
|
185
|
+
as?: undefined;
|
186
|
+
editor?: undefined;
|
187
|
+
description?: undefined;
|
176
188
|
} | {
|
177
189
|
type: string;
|
178
190
|
input: boolean;
|
@@ -200,6 +212,9 @@ declare const _default: ({
|
|
200
212
|
defaultValue?: undefined;
|
201
213
|
values?: undefined;
|
202
214
|
logic?: undefined;
|
215
|
+
as?: undefined;
|
216
|
+
editor?: undefined;
|
217
|
+
description?: undefined;
|
203
218
|
} | {
|
204
219
|
weight: number;
|
205
220
|
type: string;
|
@@ -216,5 +231,27 @@ declare const _default: ({
|
|
216
231
|
valueProperty?: undefined;
|
217
232
|
data?: undefined;
|
218
233
|
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;
|
219
256
|
})[];
|
220
257
|
export default _default;
|
@@ -81,6 +81,25 @@ exports.default = [
|
|
81
81
|
}
|
82
82
|
]
|
83
83
|
},
|
84
|
+
{
|
85
|
+
name: 'hide',
|
86
|
+
trigger: {
|
87
|
+
type: 'javascript',
|
88
|
+
javascript: 'result = instance.root.options.editJson === false;'
|
89
|
+
},
|
90
|
+
actions: [
|
91
|
+
{
|
92
|
+
name: 'hide',
|
93
|
+
type: 'property',
|
94
|
+
property: {
|
95
|
+
label: 'Hidden',
|
96
|
+
value: 'hidden',
|
97
|
+
type: 'boolean'
|
98
|
+
},
|
99
|
+
state: true
|
100
|
+
}
|
101
|
+
]
|
102
|
+
},
|
84
103
|
{
|
85
104
|
name: 'disabledToolTip',
|
86
105
|
trigger: {
|
@@ -140,7 +159,7 @@ exports.default = [
|
|
140
159
|
input: true
|
141
160
|
},
|
142
161
|
utils_1.default.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>'),
|
143
|
-
utils_1.default.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>',
|
162
|
+
utils_1.default.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>', utils_1.default.tokenVariableDescription()),
|
144
163
|
{
|
145
164
|
type: 'checkbox',
|
146
165
|
input: true,
|
@@ -157,5 +176,16 @@ exports.default = [
|
|
157
176
|
label: 'Allow Manual Override of Calculated Value',
|
158
177
|
tooltip: 'When checked, this will allow the user to manually override the calculated value.'
|
159
178
|
},
|
179
|
+
{
|
180
|
+
type: 'textarea',
|
181
|
+
as: 'json',
|
182
|
+
editor: 'ace',
|
183
|
+
weight: 1400,
|
184
|
+
input: true,
|
185
|
+
key: 'serverOverride',
|
186
|
+
label: 'Server Override',
|
187
|
+
tooltip: 'A JSON object containing the component settings that should be overriden when the form submission is processed on the server side.',
|
188
|
+
defaultValue: {},
|
189
|
+
description: '<b>Example</b>: { "clearOnHide": true }',
|
190
|
+
}
|
160
191
|
];
|
161
|
-
/* eslint-enable max-len */
|
@@ -2,6 +2,7 @@ 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;
|
5
6
|
function logicVariablesTable(additional: any): {
|
6
7
|
type: string;
|
7
8
|
tag: string;
|
@@ -37,6 +37,9 @@ const EditFormUtils = {
|
|
37
37
|
}
|
38
38
|
return lodash_1.default.isEqual(objValue, srcValue);
|
39
39
|
},
|
40
|
+
tokenVariableDescription() {
|
41
|
+
return '<tr><th>token</th><td>The decoded JWT token for the authenticated user.</td></tr>';
|
42
|
+
},
|
40
43
|
logicVariablesTable(additional) {
|
41
44
|
additional = additional || '';
|
42
45
|
return {
|
@@ -234,11 +234,33 @@ class Input extends Multivalue_1.default {
|
|
234
234
|
this.addFocusBlurEvents(element);
|
235
235
|
if (this.options.submitOnEnter) {
|
236
236
|
this.addEventListener(element, 'keypress', (event) => {
|
237
|
+
var _a;
|
237
238
|
const key = event.keyCode || event.which;
|
238
239
|
if (key === 13) {
|
239
240
|
event.preventDefault();
|
240
241
|
event.stopPropagation();
|
241
|
-
|
242
|
+
let submitButton = null;
|
243
|
+
if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.everyComponent) {
|
244
|
+
this.root.everyComponent((component) => {
|
245
|
+
if ((component === null || component === void 0 ? void 0 : component.component.type) === 'button' &&
|
246
|
+
(component === null || component === void 0 ? void 0 : component.component.action) === 'submit') {
|
247
|
+
submitButton = component;
|
248
|
+
return false;
|
249
|
+
}
|
250
|
+
});
|
251
|
+
}
|
252
|
+
const options = {};
|
253
|
+
if (submitButton) {
|
254
|
+
options.instance = submitButton;
|
255
|
+
options.component = submitButton.component;
|
256
|
+
options.noValidate = this.component.state === 'draft';
|
257
|
+
options.state = this.component.state || 'submitted';
|
258
|
+
submitButton.loading = true;
|
259
|
+
this.emit('submitButton', options);
|
260
|
+
}
|
261
|
+
else {
|
262
|
+
this.emit('submitButton', options);
|
263
|
+
}
|
242
264
|
}
|
243
265
|
});
|
244
266
|
}
|
@@ -138,12 +138,12 @@ class ListComponent extends Field_1.default {
|
|
138
138
|
component: this.component,
|
139
139
|
message: err.toString(),
|
140
140
|
});
|
141
|
-
console.warn(
|
141
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
142
142
|
}
|
143
143
|
/* eslint-disable max-statements */
|
144
144
|
updateItems(searchInput, forceUpdate) {
|
145
145
|
if (!this.component.data) {
|
146
|
-
console.warn(
|
146
|
+
console.warn(this.t('noSelectDataConfiguration', { componentKey: this.key }));
|
147
147
|
this.itemsLoadedResolve();
|
148
148
|
return;
|
149
149
|
}
|
@@ -175,7 +175,7 @@ class ListComponent extends Field_1.default {
|
|
175
175
|
this.loadItems(resourceUrl, searchInput, this.requestHeaders);
|
176
176
|
}
|
177
177
|
catch (err) {
|
178
|
-
console.warn(
|
178
|
+
console.warn(this.t('loadResourcesError', { componentKey: this.key }));
|
179
179
|
}
|
180
180
|
}
|
181
181
|
else {
|
@@ -219,7 +219,7 @@ class ListComponent extends Field_1.default {
|
|
219
219
|
return;
|
220
220
|
}
|
221
221
|
if (!window.indexedDB) {
|
222
|
-
window.alert(
|
222
|
+
window.alert(this.t('indexedDBSupportError'));
|
223
223
|
}
|
224
224
|
if (this.component.indexeddb && this.component.indexeddb.database && this.component.indexeddb.table) {
|
225
225
|
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 if no mask.
|
54
|
+
* @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
|
55
55
|
*/
|
56
56
|
updateMask(input: any, mask: string): void;
|
57
57
|
/**
|
@@ -66,7 +66,7 @@ class Multivalue extends Field_1.default {
|
|
66
66
|
return value;
|
67
67
|
}
|
68
68
|
get addAnother() {
|
69
|
-
return this.t(this.component.addAnother || '
|
69
|
+
return this.t(this.component.addAnother || 'addAnother');
|
70
70
|
}
|
71
71
|
/**
|
72
72
|
* @returns {Field} - The created field.
|
@@ -185,7 +185,7 @@ class Multivalue extends Field_1.default {
|
|
185
185
|
this.saveCaretPosition(element, index);
|
186
186
|
}
|
187
187
|
catch (err) {
|
188
|
-
console.warn('
|
188
|
+
console.warn(this.t('caretPositionSavingError'), err);
|
189
189
|
}
|
190
190
|
// If a mask is present, delay the update to allow mask to update first.
|
191
191
|
if (element.mask) {
|
@@ -264,10 +264,17 @@ class Multivalue extends Field_1.default {
|
|
264
264
|
}
|
265
265
|
/**
|
266
266
|
* @param {any} input - The input element on which the mask is to be applied.
|
267
|
-
* @param {string} mask - The mask pattern to apply to the input element. Exit early if no mask.
|
267
|
+
* @param {string} mask - The mask pattern to apply to the input element. Exit early and remove previous mask if no mask.
|
268
268
|
*/
|
269
269
|
updateMask(input, mask) {
|
270
270
|
if (!mask) {
|
271
|
+
if (input.mask) {
|
272
|
+
input.mask.destroy();
|
273
|
+
}
|
274
|
+
if (!this.component.placeholder) {
|
275
|
+
input.removeAttribute('placeholder');
|
276
|
+
}
|
277
|
+
input.value = '';
|
271
278
|
return;
|
272
279
|
}
|
273
280
|
this.setInputMask(input, mask, !this.component.placeholder);
|
@@ -11,6 +11,19 @@ const Components_1 = __importDefault(require("../../Components"));
|
|
11
11
|
*/
|
12
12
|
function default_1(...extend) {
|
13
13
|
return Components_1.default.baseEditForm([
|
14
|
+
{
|
15
|
+
key: 'display',
|
16
|
+
components: [
|
17
|
+
{
|
18
|
+
key: 'labelWidth',
|
19
|
+
ignore: true
|
20
|
+
},
|
21
|
+
{
|
22
|
+
key: 'labelMargin',
|
23
|
+
ignore: true
|
24
|
+
}
|
25
|
+
]
|
26
|
+
},
|
14
27
|
{
|
15
28
|
key: 'data',
|
16
29
|
ignore: true
|
@@ -13,6 +13,8 @@ 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;
|
16
18
|
getComponents(rowIndex: any): any;
|
17
19
|
removeSubmissionMetadataRow(index: any): void;
|
18
20
|
}
|