@formio/js 5.2.4-rc.0 → 5.2.5
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/dist/formio.builder.css +50 -161
- 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 +49 -158
- package/dist/formio.form.js +108 -152
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.css +50 -161
- package/dist/formio.full.js +227 -401
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +18 -51
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +14 -47
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/CDN.js +12 -12
- package/lib/cjs/Element.d.ts +2 -3
- package/lib/cjs/Element.js +26 -29
- package/lib/cjs/Embed.js +42 -75
- package/lib/cjs/EventEmitter.js +1 -1
- package/lib/cjs/Form.d.ts +341 -371
- package/lib/cjs/Form.js +39 -153
- package/lib/cjs/FormBuilder.d.ts +3 -3
- package/lib/cjs/FormBuilder.js +3 -2
- package/lib/cjs/Formio.js +23 -26
- package/lib/cjs/InlineEmbed.js +17 -23
- package/lib/cjs/PDF.d.ts +0 -1
- package/lib/cjs/PDF.js +15 -18
- package/lib/cjs/PDFBuilder.js +36 -51
- package/lib/cjs/Webform.d.ts +366 -8
- package/lib/cjs/Webform.js +238 -177
- package/lib/cjs/WebformBuilder.js +152 -221
- package/lib/cjs/Wizard.js +65 -95
- package/lib/cjs/WizardBuilder.js +19 -27
- package/lib/cjs/addons/FormioAddon.js +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +57 -59
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +16 -24
- package/lib/cjs/addons/index.js +3 -3
- package/lib/cjs/components/Components.js +4 -0
- package/lib/cjs/components/_classes/component/Component.form.js +11 -11
- package/lib/cjs/components/_classes/component/Component.js +198 -309
- package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.js +4 -2
- package/lib/cjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +11 -9
- 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 +25 -39
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +29 -47
- package/lib/cjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +7 -5
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +34 -37
- package/lib/cjs/components/_classes/component/editForm/utils.js +16 -12
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +6 -6
- package/lib/cjs/components/_classes/field/Field.js +1 -7
- package/lib/cjs/components/_classes/input/Input.js +26 -30
- package/lib/cjs/components/_classes/list/ListComponent.form.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +18 -27
- package/lib/cjs/components/_classes/list/editForm/ListComponent.edit.data.js +9 -36
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +13 -32
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +3 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.js +75 -67
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +14 -19
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +17 -19
- package/lib/cjs/components/address/Address.d.ts +0 -1
- package/lib/cjs/components/address/Address.js +52 -57
- package/lib/cjs/components/address/editForm/Address.edit.data.js +2 -2
- package/lib/cjs/components/address/editForm/Address.edit.display.js +2 -2
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +11 -53
- package/lib/cjs/components/alert/Alert.js +15 -21
- package/lib/cjs/components/button/Button.form.js +1 -1
- package/lib/cjs/components/button/Button.js +47 -64
- package/lib/cjs/components/button/editForm/Button.edit.display.js +9 -49
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.form.js +3 -3
- package/lib/cjs/components/checkbox/Checkbox.js +20 -28
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +3 -13
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.validation.js +2 -2
- package/lib/cjs/components/columns/Columns.form.js +1 -1
- package/lib/cjs/components/columns/Columns.js +12 -24
- package/lib/cjs/components/columns/editForm/Columns.edit.display.js +17 -17
- package/lib/cjs/components/container/Container.form.js +2 -2
- package/lib/cjs/components/container/Container.js +4 -6
- package/lib/cjs/components/container/editForm/Container.edit.data.js +3 -3
- package/lib/cjs/components/container/editForm/Container.edit.display.js +4 -4
- package/lib/cjs/components/content/Content.form.js +2 -4
- package/lib/cjs/components/content/Content.js +8 -10
- package/lib/cjs/components/content/editForm/Content.edit.display.js +10 -10
- package/lib/cjs/components/currency/Currency.form.js +3 -3
- package/lib/cjs/components/currency/Currency.js +10 -19
- package/lib/cjs/components/currency/editForm/Currency.edit.data.js +5 -5
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +8 -8
- package/lib/cjs/components/datagrid/DataGrid.form.js +3 -3
- package/lib/cjs/components/datagrid/DataGrid.js +42 -92
- package/lib/cjs/components/datagrid/editForm/DataGrid.edit.data.js +1 -1
- package/lib/cjs/components/datagrid/editForm/DataGrid.edit.display.js +14 -14
- package/lib/cjs/components/datagrid/editForm/DataGrid.edit.validation.js +3 -3
- package/lib/cjs/components/datamap/DataMap.form.js +2 -2
- package/lib/cjs/components/datamap/DataMap.js +35 -46
- package/lib/cjs/components/datamap/editForm/DataMap.edit.data.js +1 -1
- package/lib/cjs/components/datamap/editForm/DataMap.edit.display.js +8 -8
- package/lib/cjs/components/datetime/DateTime.form.js +5 -5
- package/lib/cjs/components/datetime/DateTime.js +15 -30
- package/lib/cjs/components/datetime/editForm/DateTime.edit.data.js +3 -4
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
- package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +17 -22
- package/lib/cjs/components/datetime/editForm/DateTime.edit.time.js +5 -5
- package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.js +3 -3
- package/lib/cjs/components/day/Day.form.js +5 -5
- package/lib/cjs/components/day/Day.js +58 -147
- package/lib/cjs/components/day/editForm/Day.edit.day.js +9 -13
- package/lib/cjs/components/day/editForm/Day.edit.display.js +7 -7
- package/lib/cjs/components/day/editForm/Day.edit.month.js +8 -12
- package/lib/cjs/components/day/editForm/Day.edit.validation.js +7 -7
- package/lib/cjs/components/day/editForm/Day.edit.year.js +8 -8
- package/lib/cjs/components/editgrid/EditGrid.form.js +2 -2
- package/lib/cjs/components/editgrid/EditGrid.js +96 -142
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -7
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +16 -16
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.validation.js +3 -3
- package/lib/cjs/components/email/Email.js +4 -4
- package/lib/cjs/components/email/editForm/Email.edit.display.js +3 -3
- package/lib/cjs/components/email/editForm/Email.edit.validation.js +6 -6
- package/lib/cjs/components/fieldset/Fieldset.form.js +1 -1
- package/lib/cjs/components/fieldset/Fieldset.js +2 -2
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -8
- package/lib/cjs/components/file/File.form.js +4 -4
- package/lib/cjs/components/file/File.js +90 -131
- package/lib/cjs/components/file/editForm/File.edit.display.js +5 -9
- package/lib/cjs/components/file/editForm/File.edit.file.js +53 -97
- package/lib/cjs/components/file/editForm/File.edit.validation.js +2 -2
- package/lib/cjs/components/form/Form.form.js +3 -3
- package/lib/cjs/components/form/Form.js +58 -68
- package/lib/cjs/components/form/editForm/Form.edit.data.js +3 -1
- package/lib/cjs/components/form/editForm/Form.edit.display.js +7 -6
- package/lib/cjs/components/form/editForm/Form.edit.form.js +9 -11
- package/lib/cjs/components/hidden/Hidden.form.js +4 -4
- package/lib/cjs/components/hidden/Hidden.js +2 -2
- package/lib/cjs/components/hidden/editForm/Hidden.edit.data.js +3 -3
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +10 -10
- package/lib/cjs/components/html/HTML.js +17 -23
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +17 -17
- package/lib/cjs/components/html/editForm/HTML.edit.logic.js +2 -2
- package/lib/cjs/components/number/Number.form.js +3 -3
- package/lib/cjs/components/number/Number.js +11 -27
- package/lib/cjs/components/number/editForm/Number.edit.data.js +3 -3
- package/lib/cjs/components/number/editForm/Number.edit.display.js +4 -4
- package/lib/cjs/components/number/editForm/Number.edit.validation.js +9 -9
- package/lib/cjs/components/panel/Panel.form.js +1 -1
- package/lib/cjs/components/panel/Panel.js +2 -2
- package/lib/cjs/components/panel/editForm/Panel.edit.conditional.js +7 -5
- package/lib/cjs/components/panel/editForm/Panel.edit.display.js +29 -55
- package/lib/cjs/components/password/Password.form.js +3 -3
- package/lib/cjs/components/password/Password.js +2 -5
- package/lib/cjs/components/password/editForm/Password.edit.data.js +11 -11
- package/lib/cjs/components/password/editForm/Password.edit.display.js +3 -3
- package/lib/cjs/components/password/editForm/Password.edit.validation.js +3 -3
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +8 -8
- package/lib/cjs/components/phonenumber/PhoneNumber.js +3 -3
- package/lib/cjs/components/phonenumber/editForm/PhoneNumber.edit.validation.js +6 -6
- package/lib/cjs/components/radio/Radio.form.js +3 -3
- package/lib/cjs/components/radio/Radio.js +32 -58
- package/lib/cjs/components/radio/editForm/Radio.edit.data.js +9 -23
- package/lib/cjs/components/radio/editForm/Radio.edit.display.js +6 -6
- package/lib/cjs/components/radio/editForm/Radio.edit.validation.js +2 -2
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +5 -5
- package/lib/cjs/components/recaptcha/ReCaptcha.js +10 -10
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +24 -24
- package/lib/cjs/components/select/Select.form.js +3 -3
- package/lib/cjs/components/select/Select.js +140 -235
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +57 -191
- package/lib/cjs/components/select/editForm/Select.edit.display.js +2 -2
- package/lib/cjs/components/select/editForm/Select.edit.validation.js +4 -4
- package/lib/cjs/components/selectboxes/SelectBoxes.form.js +3 -3
- package/lib/cjs/components/selectboxes/SelectBoxes.js +16 -29
- package/lib/cjs/components/selectboxes/editForm/SelectBoxes.edit.validation.js +5 -5
- package/lib/cjs/components/signature/Signature.form.js +3 -3
- package/lib/cjs/components/signature/Signature.js +17 -26
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +10 -19
- package/lib/cjs/components/survey/Survey.form.js +3 -3
- package/lib/cjs/components/survey/Survey.js +17 -30
- package/lib/cjs/components/survey/editForm/Survey.edit.data.js +11 -23
- package/lib/cjs/components/survey/editForm/Survey.edit.display.js +1 -1
- package/lib/cjs/components/survey/editForm/Survey.edit.validation.js +1 -1
- package/lib/cjs/components/table/Table.form.js +1 -1
- package/lib/cjs/components/table/Table.js +7 -8
- package/lib/cjs/components/table/editForm/Table.edit.display.js +22 -22
- package/lib/cjs/components/tabs/Tabs.form.js +1 -1
- package/lib/cjs/components/tabs/Tabs.js +10 -27
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +17 -21
- package/lib/cjs/components/tags/Tags.form.js +1 -1
- package/lib/cjs/components/tags/Tags.js +12 -28
- package/lib/cjs/components/tags/editForm/Tags.edit.data.js +7 -7
- package/lib/cjs/components/textarea/TextArea.form.js +2 -2
- package/lib/cjs/components/textarea/TextArea.js +45 -63
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +72 -96
- package/lib/cjs/components/textarea/editForm/TextArea.edit.validation.js +3 -3
- package/lib/cjs/components/textfield/TextField.form.js +3 -3
- package/lib/cjs/components/textfield/TextField.js +21 -32
- package/lib/cjs/components/textfield/editForm/TextField.edit.data.js +13 -15
- package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +21 -31
- package/lib/cjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
- package/lib/cjs/components/time/Time.js +10 -17
- package/lib/cjs/components/time/editForm/Time.edit.display.js +2 -2
- package/lib/cjs/components/unknown/Unknown.form.js +5 -5
- package/lib/cjs/components/unknown/Unknown.js +2 -2
- package/lib/cjs/components/unknown/editForm/Unknown.edit.display.js +3 -3
- package/lib/cjs/components/url/Url.form.js +3 -3
- package/lib/cjs/components/url/Url.js +2 -2
- package/lib/cjs/components/url/editForm/Url.edit.display.js +3 -3
- package/lib/cjs/components/url/editForm/Url.edit.validation.js +1 -1
- package/lib/cjs/components/well/Well.form.js +1 -1
- package/lib/cjs/components/well/Well.js +2 -2
- package/lib/cjs/components/well/editForm/Well.edit.display.js +10 -10
- package/lib/cjs/formio.form.d.ts +1 -2
- package/lib/cjs/formio.form.js +12 -38
- package/lib/cjs/i18n.d.ts +0 -4
- package/lib/cjs/i18n.js +3 -7
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/pdf.image.d.ts +2 -0
- package/lib/cjs/pdf.image.js +94 -0
- package/lib/cjs/providers/address/AddressProvider.js +5 -8
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +3 -3
- package/lib/cjs/providers/address/GoogleAddressProvider.js +13 -24
- package/lib/cjs/providers/processor/fileProcessor.js +1 -3
- package/lib/cjs/providers/storage/azure.js +2 -5
- package/lib/cjs/providers/storage/dropbox.js +5 -4
- package/lib/cjs/providers/storage/googleDrive.js +4 -3
- package/lib/cjs/providers/storage/index.js +1 -1
- package/lib/cjs/providers/storage/indexeddb.js +6 -16
- package/lib/cjs/providers/storage/s3.js +6 -17
- package/lib/cjs/providers/storage/uploadAdapter.js +11 -17
- package/lib/cjs/providers/storage/url.js +11 -13
- package/lib/cjs/providers/storage/xhr.js +9 -17
- package/lib/cjs/templates/index.js +1 -1
- package/lib/cjs/translations/en.d.ts +2 -0
- package/lib/cjs/translations/en.js +9 -7
- package/lib/cjs/utils/ChoicesWrapper.js +2 -2
- package/lib/cjs/utils/builder.js +7 -31
- package/lib/cjs/utils/calendarUtils.js +5 -7
- package/lib/cjs/utils/conditionOperators/ConditionOperator.js +1 -1
- package/lib/cjs/utils/conditionOperators/DateGreaterThan.js +4 -12
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +1 -3
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +6 -10
- package/lib/cjs/utils/conditionOperators/index.js +1 -1
- package/lib/cjs/utils/formUtils.js +1 -1
- package/lib/cjs/utils/i18n.js +1 -7
- package/lib/cjs/utils/index.d.ts +1 -2
- package/lib/cjs/utils/index.js +2 -2
- package/lib/cjs/utils/jsonlogic/operators.d.ts +1 -0
- package/lib/cjs/utils/jsonlogic/operators.js +265 -0
- package/lib/cjs/utils/utils.d.ts +1 -10
- package/lib/cjs/utils/utils.js +92 -175
- package/lib/cjs/widgets/CalendarWidget.js +49 -66
- package/lib/cjs/widgets/InputWidget.js +4 -6
- package/lib/cjs/widgets/index.js +1 -1
- package/lib/mjs/CDN.js +12 -12
- package/lib/mjs/Element.d.ts +2 -3
- package/lib/mjs/Element.js +23 -29
- package/lib/mjs/Embed.js +43 -77
- package/lib/mjs/EventEmitter.js +1 -1
- package/lib/mjs/Form.d.ts +341 -371
- package/lib/mjs/Form.js +126 -142
- package/lib/mjs/FormBuilder.d.ts +3 -3
- package/lib/mjs/FormBuilder.js +3 -2
- package/lib/mjs/Formio.js +23 -26
- package/lib/mjs/InlineEmbed.js +17 -23
- package/lib/mjs/PDF.d.ts +0 -1
- package/lib/mjs/PDF.js +15 -18
- package/lib/mjs/PDFBuilder.js +36 -51
- package/lib/mjs/Webform.d.ts +366 -8
- package/lib/mjs/Webform.js +251 -184
- package/lib/mjs/WebformBuilder.js +151 -224
- package/lib/mjs/Wizard.js +64 -94
- package/lib/mjs/WizardBuilder.js +19 -27
- package/lib/mjs/addons/FormioAddon.js +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +57 -59
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +16 -24
- package/lib/mjs/addons/index.js +3 -3
- package/lib/mjs/components/Components.js +4 -0
- package/lib/mjs/components/_classes/component/Component.form.js +11 -11
- package/lib/mjs/components/_classes/component/Component.js +194 -313
- package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.js +4 -2
- package/lib/mjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +11 -9
- 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 +25 -39
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +29 -47
- package/lib/mjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +7 -5
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +34 -37
- package/lib/mjs/components/_classes/component/editForm/utils.js +16 -12
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +2 -2
- package/lib/mjs/components/_classes/field/Field.js +2 -8
- package/lib/mjs/components/_classes/input/Input.js +23 -27
- package/lib/mjs/components/_classes/list/ListComponent.form.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +18 -27
- package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +9 -36
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +13 -32
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +3 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.js +33 -41
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +15 -20
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +17 -19
- package/lib/mjs/components/address/Address.d.ts +0 -1
- package/lib/mjs/components/address/Address.js +49 -60
- package/lib/mjs/components/address/editForm/Address.edit.data.js +2 -2
- package/lib/mjs/components/address/editForm/Address.edit.display.js +2 -2
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +11 -53
- package/lib/mjs/components/alert/Alert.js +16 -22
- package/lib/mjs/components/button/Button.form.js +1 -1
- package/lib/mjs/components/button/Button.js +42 -65
- package/lib/mjs/components/button/editForm/Button.edit.display.js +9 -49
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.form.js +3 -3
- package/lib/mjs/components/checkbox/Checkbox.js +21 -29
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +3 -13
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.validation.js +2 -2
- package/lib/mjs/components/columns/Columns.form.js +1 -1
- package/lib/mjs/components/columns/Columns.js +12 -24
- package/lib/mjs/components/columns/editForm/Columns.edit.display.js +17 -17
- package/lib/mjs/components/container/Container.form.js +2 -2
- package/lib/mjs/components/container/Container.js +4 -6
- package/lib/mjs/components/container/editForm/Container.edit.data.js +3 -3
- package/lib/mjs/components/container/editForm/Container.edit.display.js +4 -4
- package/lib/mjs/components/content/Content.form.js +2 -4
- package/lib/mjs/components/content/Content.js +8 -10
- package/lib/mjs/components/content/editForm/Content.edit.display.js +10 -10
- package/lib/mjs/components/currency/Currency.form.js +3 -3
- package/lib/mjs/components/currency/Currency.js +10 -19
- package/lib/mjs/components/currency/editForm/Currency.edit.data.js +5 -5
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +8 -8
- package/lib/mjs/components/datagrid/DataGrid.form.js +3 -3
- package/lib/mjs/components/datagrid/DataGrid.js +41 -92
- package/lib/mjs/components/datagrid/editForm/DataGrid.edit.data.js +1 -1
- package/lib/mjs/components/datagrid/editForm/DataGrid.edit.display.js +14 -14
- package/lib/mjs/components/datagrid/editForm/DataGrid.edit.validation.js +3 -3
- package/lib/mjs/components/datamap/DataMap.form.js +2 -2
- package/lib/mjs/components/datamap/DataMap.js +33 -46
- package/lib/mjs/components/datamap/editForm/DataMap.edit.data.js +1 -1
- package/lib/mjs/components/datamap/editForm/DataMap.edit.display.js +8 -8
- package/lib/mjs/components/datetime/DateTime.form.js +5 -5
- package/lib/mjs/components/datetime/DateTime.js +16 -31
- package/lib/mjs/components/datetime/editForm/DateTime.edit.data.js +3 -4
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
- package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +17 -22
- package/lib/mjs/components/datetime/editForm/DateTime.edit.time.js +5 -5
- package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.js +3 -3
- package/lib/mjs/components/day/Day.form.js +5 -5
- package/lib/mjs/components/day/Day.js +58 -148
- package/lib/mjs/components/day/editForm/Day.edit.day.js +9 -13
- package/lib/mjs/components/day/editForm/Day.edit.display.js +7 -7
- package/lib/mjs/components/day/editForm/Day.edit.month.js +8 -12
- package/lib/mjs/components/day/editForm/Day.edit.validation.js +7 -7
- package/lib/mjs/components/day/editForm/Day.edit.year.js +8 -8
- package/lib/mjs/components/editgrid/EditGrid.form.js +2 -2
- package/lib/mjs/components/editgrid/EditGrid.js +92 -140
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -7
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +16 -16
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.validation.js +3 -3
- package/lib/mjs/components/email/Email.js +4 -4
- package/lib/mjs/components/email/editForm/Email.edit.display.js +3 -3
- package/lib/mjs/components/email/editForm/Email.edit.validation.js +6 -6
- package/lib/mjs/components/fieldset/Fieldset.form.js +1 -1
- package/lib/mjs/components/fieldset/Fieldset.js +2 -2
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -8
- package/lib/mjs/components/file/File.form.js +4 -4
- package/lib/mjs/components/file/File.js +89 -136
- package/lib/mjs/components/file/editForm/File.edit.display.js +5 -9
- package/lib/mjs/components/file/editForm/File.edit.file.js +53 -97
- package/lib/mjs/components/file/editForm/File.edit.validation.js +2 -2
- package/lib/mjs/components/form/Form.form.js +3 -3
- package/lib/mjs/components/form/Form.js +55 -68
- package/lib/mjs/components/form/editForm/Form.edit.data.js +3 -1
- package/lib/mjs/components/form/editForm/Form.edit.display.js +7 -6
- package/lib/mjs/components/form/editForm/Form.edit.form.js +8 -10
- package/lib/mjs/components/hidden/Hidden.form.js +4 -4
- package/lib/mjs/components/hidden/Hidden.js +2 -2
- package/lib/mjs/components/hidden/editForm/Hidden.edit.data.js +3 -3
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +10 -10
- package/lib/mjs/components/html/HTML.js +17 -23
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +17 -17
- package/lib/mjs/components/html/editForm/HTML.edit.logic.js +2 -2
- package/lib/mjs/components/number/Number.form.js +3 -3
- package/lib/mjs/components/number/Number.js +12 -28
- package/lib/mjs/components/number/editForm/Number.edit.data.js +3 -3
- package/lib/mjs/components/number/editForm/Number.edit.display.js +4 -4
- package/lib/mjs/components/number/editForm/Number.edit.validation.js +9 -9
- package/lib/mjs/components/panel/Panel.form.js +1 -1
- package/lib/mjs/components/panel/Panel.js +2 -2
- package/lib/mjs/components/panel/editForm/Panel.edit.conditional.js +8 -6
- package/lib/mjs/components/panel/editForm/Panel.edit.display.js +29 -55
- package/lib/mjs/components/password/Password.form.js +3 -3
- package/lib/mjs/components/password/Password.js +2 -5
- package/lib/mjs/components/password/editForm/Password.edit.data.js +11 -11
- package/lib/mjs/components/password/editForm/Password.edit.display.js +3 -3
- package/lib/mjs/components/password/editForm/Password.edit.validation.js +3 -3
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +8 -8
- package/lib/mjs/components/phonenumber/PhoneNumber.js +3 -3
- package/lib/mjs/components/phonenumber/editForm/PhoneNumber.edit.validation.js +6 -6
- package/lib/mjs/components/radio/Radio.form.js +3 -3
- package/lib/mjs/components/radio/Radio.js +30 -59
- package/lib/mjs/components/radio/editForm/Radio.edit.data.js +9 -23
- package/lib/mjs/components/radio/editForm/Radio.edit.display.js +6 -6
- package/lib/mjs/components/radio/editForm/Radio.edit.validation.js +2 -2
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +5 -5
- package/lib/mjs/components/recaptcha/ReCaptcha.js +8 -10
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +24 -24
- package/lib/mjs/components/select/Select.form.js +3 -3
- package/lib/mjs/components/select/Select.js +145 -240
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +57 -191
- package/lib/mjs/components/select/editForm/Select.edit.display.js +2 -2
- package/lib/mjs/components/select/editForm/Select.edit.validation.js +4 -4
- package/lib/mjs/components/selectboxes/SelectBoxes.form.js +3 -3
- package/lib/mjs/components/selectboxes/SelectBoxes.js +16 -30
- package/lib/mjs/components/selectboxes/editForm/SelectBoxes.edit.validation.js +5 -5
- package/lib/mjs/components/signature/Signature.form.js +3 -3
- package/lib/mjs/components/signature/Signature.js +16 -26
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +10 -19
- package/lib/mjs/components/survey/Survey.form.js +3 -3
- package/lib/mjs/components/survey/Survey.js +17 -30
- package/lib/mjs/components/survey/editForm/Survey.edit.data.js +11 -23
- package/lib/mjs/components/survey/editForm/Survey.edit.display.js +1 -1
- package/lib/mjs/components/survey/editForm/Survey.edit.validation.js +1 -1
- package/lib/mjs/components/table/Table.form.js +1 -1
- package/lib/mjs/components/table/Table.js +6 -8
- package/lib/mjs/components/table/editForm/Table.edit.display.js +22 -22
- package/lib/mjs/components/tabs/Tabs.form.js +1 -1
- package/lib/mjs/components/tabs/Tabs.js +9 -27
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +17 -21
- package/lib/mjs/components/tags/Tags.form.js +1 -1
- package/lib/mjs/components/tags/Tags.js +12 -28
- package/lib/mjs/components/tags/editForm/Tags.edit.data.js +7 -7
- package/lib/mjs/components/textarea/TextArea.form.js +2 -2
- package/lib/mjs/components/textarea/TextArea.js +51 -75
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +72 -96
- package/lib/mjs/components/textarea/editForm/TextArea.edit.validation.js +3 -3
- package/lib/mjs/components/textfield/TextField.form.js +3 -3
- package/lib/mjs/components/textfield/TextField.js +23 -34
- package/lib/mjs/components/textfield/editForm/TextField.edit.data.js +13 -15
- package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +21 -31
- package/lib/mjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
- package/lib/mjs/components/time/Time.js +10 -17
- package/lib/mjs/components/time/editForm/Time.edit.display.js +2 -2
- package/lib/mjs/components/unknown/Unknown.form.js +5 -5
- package/lib/mjs/components/unknown/Unknown.js +2 -2
- package/lib/mjs/components/unknown/editForm/Unknown.edit.display.js +3 -3
- package/lib/mjs/components/url/Url.form.js +3 -3
- package/lib/mjs/components/url/Url.js +2 -2
- package/lib/mjs/components/url/editForm/Url.edit.display.js +3 -3
- package/lib/mjs/components/url/editForm/Url.edit.validation.js +1 -1
- package/lib/mjs/components/well/Well.form.js +1 -1
- package/lib/mjs/components/well/Well.js +2 -2
- package/lib/mjs/components/well/editForm/Well.edit.display.js +10 -10
- package/lib/mjs/formio.form.d.ts +1 -2
- package/lib/mjs/formio.form.js +8 -10
- package/lib/mjs/i18n.d.ts +0 -4
- package/lib/mjs/i18n.js +3 -7
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/pdf.image.d.ts +2 -0
- package/lib/mjs/pdf.image.js +94 -0
- package/lib/mjs/providers/address/AddressProvider.js +5 -8
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +3 -3
- package/lib/mjs/providers/address/GoogleAddressProvider.js +13 -24
- package/lib/mjs/providers/processor/fileProcessor.js +1 -3
- package/lib/mjs/providers/storage/azure.js +2 -5
- package/lib/mjs/providers/storage/dropbox.js +5 -4
- package/lib/mjs/providers/storage/googleDrive.js +4 -3
- package/lib/mjs/providers/storage/index.js +1 -1
- package/lib/mjs/providers/storage/indexeddb.js +6 -16
- package/lib/mjs/providers/storage/s3.js +8 -19
- package/lib/mjs/providers/storage/uploadAdapter.js +11 -17
- package/lib/mjs/providers/storage/url.js +11 -13
- package/lib/mjs/providers/storage/xhr.js +9 -17
- package/lib/mjs/templates/index.js +1 -1
- package/lib/mjs/translations/en.d.ts +2 -0
- package/lib/mjs/translations/en.js +9 -7
- package/lib/mjs/utils/ChoicesWrapper.js +2 -2
- package/lib/mjs/utils/builder.js +7 -31
- package/lib/mjs/utils/calendarUtils.js +5 -7
- package/lib/mjs/utils/conditionOperators/ConditionOperator.js +1 -1
- package/lib/mjs/utils/conditionOperators/DateGreaterThan.js +5 -16
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +1 -3
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +6 -10
- package/lib/mjs/utils/conditionOperators/index.js +1 -1
- package/lib/mjs/utils/formUtils.js +2 -2
- package/lib/mjs/utils/i18n.js +1 -7
- package/lib/mjs/utils/index.d.ts +1 -2
- package/lib/mjs/utils/index.js +3 -3
- package/lib/mjs/utils/jsonlogic/operators.d.ts +1 -0
- package/lib/mjs/utils/jsonlogic/operators.js +262 -0
- package/lib/mjs/utils/utils.d.ts +1 -10
- package/lib/mjs/utils/utils.js +91 -178
- package/lib/mjs/widgets/CalendarWidget.js +50 -67
- package/lib/mjs/widgets/InputWidget.js +4 -6
- package/lib/mjs/widgets/index.js +1 -1
- package/package.json +3 -3
- package/lib/cjs/translations/de.d.ts +0 -80
- package/lib/cjs/translations/de.js +0 -81
- package/lib/mjs/translations/de.d.ts +0 -80
- package/lib/mjs/translations/de.js +0 -79
|
@@ -20,6 +20,7 @@ if (typeof window !== 'undefined' && typeof window.global === 'undefined') {
|
|
|
20
20
|
}
|
|
21
21
|
const dragula_1 = __importDefault(require("dragula"));
|
|
22
22
|
class WebformBuilder extends Component_1.default {
|
|
23
|
+
// eslint-disable-next-line max-statements
|
|
23
24
|
constructor() {
|
|
24
25
|
let element, options;
|
|
25
26
|
if (arguments[0] instanceof HTMLElement || arguments[1]) {
|
|
@@ -81,17 +82,17 @@ class WebformBuilder extends Component_1.default {
|
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
this.groupOrder = this.groupOrder
|
|
84
|
-
.filter(
|
|
85
|
+
.filter(group => group && !group.ignore)
|
|
85
86
|
.sort((a, b) => a.weight - b.weight);
|
|
86
|
-
const defaultOpenedGroup = this.groupOrder.find(
|
|
87
|
+
const defaultOpenedGroup = this.groupOrder.find(x => x.key !== 'basic' && x.default);
|
|
87
88
|
if (defaultOpenedGroup) {
|
|
88
|
-
this.groupOrder.forEach(
|
|
89
|
+
this.groupOrder.forEach(x => {
|
|
89
90
|
if ('default' in x && x.key !== defaultOpenedGroup.key) {
|
|
90
91
|
x.default = false;
|
|
91
92
|
}
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
|
-
this.groupOrder = this.groupOrder.map(
|
|
95
|
+
this.groupOrder = this.groupOrder.map(group => group.key);
|
|
95
96
|
for (const type in Components_1.default.components) {
|
|
96
97
|
const component = Components_1.default.components[type];
|
|
97
98
|
if (component.builderInfo && component.builderInfo.schema) {
|
|
@@ -109,7 +110,9 @@ class WebformBuilder extends Component_1.default {
|
|
|
109
110
|
for (const key in info.components) {
|
|
110
111
|
const compKey = group === 'resource' ? `component-${key}` : key;
|
|
111
112
|
let comp = info.components[compKey];
|
|
112
|
-
if (comp === true &&
|
|
113
|
+
if (comp === true &&
|
|
114
|
+
Components_1.default.components[key] &&
|
|
115
|
+
Components_1.default.components[key].builderInfo) {
|
|
113
116
|
comp = Components_1.default.components[key].builderInfo;
|
|
114
117
|
}
|
|
115
118
|
if (comp && comp.schema) {
|
|
@@ -133,8 +136,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
133
136
|
// The main webform shouldn't have this class as it adds extra styles.
|
|
134
137
|
return template;
|
|
135
138
|
}
|
|
136
|
-
if (
|
|
137
|
-
self.parent.noDragDrop) {
|
|
139
|
+
if (this.options.disabled && this.options.disabled.includes(self.key) || self.parent.noDragDrop) {
|
|
138
140
|
return html;
|
|
139
141
|
}
|
|
140
142
|
return this.renderTemplate('builderComponent', {
|
|
@@ -143,23 +145,20 @@ class WebformBuilder extends Component_1.default {
|
|
|
143
145
|
childComponent: component,
|
|
144
146
|
design: (_b = self === null || self === void 0 ? void 0 : self.options) === null || _b === void 0 ? void 0 : _b.design,
|
|
145
147
|
editJson: (_c = self === null || self === void 0 ? void 0 : self.options) === null || _c === void 0 ? void 0 : _c.editJson,
|
|
146
|
-
editComponent: this.hasEditTabs(component.type)
|
|
148
|
+
editComponent: this.hasEditTabs(component.type)
|
|
147
149
|
});
|
|
148
150
|
};
|
|
149
151
|
this.options.hooks.renderComponents = (html, { components, self }) => {
|
|
150
152
|
// if Datagrid and already has a component, don't make it droppable.
|
|
151
|
-
if (
|
|
153
|
+
if (self.type === 'datagrid' && components.length > 0 || self.noDragDrop) {
|
|
152
154
|
return html;
|
|
153
155
|
}
|
|
154
156
|
if (!components ||
|
|
155
157
|
(!components.length && !components.nodrop) ||
|
|
156
|
-
(self.type === 'form' &&
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
html
|
|
160
|
-
this.renderTemplate('builderPlaceholder', {
|
|
161
|
-
position: 0,
|
|
162
|
-
}) + html;
|
|
158
|
+
(self.type === 'form' && components.length <= 1 && (components.length === 0 || components[0].type === 'button'))) {
|
|
159
|
+
html = this.renderTemplate('builderPlaceholder', {
|
|
160
|
+
position: 0
|
|
161
|
+
}) + html;
|
|
163
162
|
}
|
|
164
163
|
return this.renderTemplate('builderComponents', {
|
|
165
164
|
key: self.key,
|
|
@@ -196,8 +195,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
196
195
|
this.dragula.containers.push(containerElement);
|
|
197
196
|
}
|
|
198
197
|
// If this is an existing datagrid element, don't make it draggable.
|
|
199
|
-
if ((component.type === 'datagrid' || component.type === 'datamap') &&
|
|
200
|
-
components.length > 0) {
|
|
198
|
+
if ((component.type === 'datagrid' || component.type === 'datamap') && components.length > 0) {
|
|
201
199
|
return element;
|
|
202
200
|
}
|
|
203
201
|
// Since we added a wrapper, need to return the original element so that we can find the components inside it.
|
|
@@ -219,27 +217,19 @@ class WebformBuilder extends Component_1.default {
|
|
|
219
217
|
params: {
|
|
220
218
|
type: 'resource',
|
|
221
219
|
limit: 1000000,
|
|
222
|
-
select: '_id,title,name,components'
|
|
223
|
-
}
|
|
220
|
+
select: '_id,title,name,components'
|
|
221
|
+
}
|
|
224
222
|
};
|
|
225
223
|
if (this.options && this.options.resourceTag) {
|
|
226
|
-
query.params.tags = [
|
|
227
|
-
this.options.resourceTag,
|
|
228
|
-
];
|
|
224
|
+
query.params.tags = [this.options.resourceTag];
|
|
229
225
|
}
|
|
230
226
|
else if (!this.options || !this.options.hasOwnProperty('resourceTag')) {
|
|
231
|
-
query.params.tags = [
|
|
232
|
-
'builder',
|
|
233
|
-
];
|
|
227
|
+
query.params.tags = ['builder'];
|
|
234
228
|
}
|
|
235
229
|
const formio = new Formio_1.Formio(Formio_1.Formio.projectUrl);
|
|
236
230
|
const isResourcesDisabled = this.options.builder && this.options.builder.resource === false;
|
|
237
|
-
formio
|
|
238
|
-
.
|
|
239
|
-
.then((project) => {
|
|
240
|
-
if (project &&
|
|
241
|
-
(lodash_1.default.get(project, 'settings.addConfigToForms', false) ||
|
|
242
|
-
lodash_1.default.get(project, 'addConfigToForms', false))) {
|
|
231
|
+
formio.loadProject().then((project) => {
|
|
232
|
+
if (project && (lodash_1.default.get(project, 'settings.addConfigToForms', false) || lodash_1.default.get(project, 'addConfigToForms', false))) {
|
|
243
233
|
const config = project.config || {};
|
|
244
234
|
this.options.formConfig = config;
|
|
245
235
|
const pathToFormConfig = 'webform._form.config';
|
|
@@ -248,13 +238,13 @@ class WebformBuilder extends Component_1.default {
|
|
|
248
238
|
lodash_1.default.set(this, pathToFormConfig, config);
|
|
249
239
|
}
|
|
250
240
|
}
|
|
251
|
-
})
|
|
252
|
-
.catch((err) => {
|
|
241
|
+
}).catch((err) => {
|
|
253
242
|
console.warn(`Could not load project settings: ${err.message || err}`);
|
|
254
243
|
});
|
|
255
244
|
if (!formio.noProject && !isResourcesDisabled && formio.formsUrl) {
|
|
256
245
|
const resourceOptions = this.options.builder && this.options.builder.resource;
|
|
257
|
-
formio.loadForms(query)
|
|
246
|
+
formio.loadForms(query)
|
|
247
|
+
.then((resources) => {
|
|
258
248
|
if (resources.length) {
|
|
259
249
|
this.builder.resource = {
|
|
260
250
|
title: resourceOptions ? resourceOptions.title : 'Existing Resource Fields',
|
|
@@ -262,7 +252,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
262
252
|
weight: resourceOptions ? resourceOptions.weight : 50,
|
|
263
253
|
subgroups: [],
|
|
264
254
|
components: [],
|
|
265
|
-
componentOrder: []
|
|
255
|
+
componentOrder: []
|
|
266
256
|
};
|
|
267
257
|
this.groups.resource = {
|
|
268
258
|
title: resourceOptions ? resourceOptions.title : 'Existing Resource Fields',
|
|
@@ -270,7 +260,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
270
260
|
weight: resourceOptions ? resourceOptions.weight : 50,
|
|
271
261
|
subgroups: [],
|
|
272
262
|
components: [],
|
|
273
|
-
componentOrder: []
|
|
263
|
+
componentOrder: []
|
|
274
264
|
};
|
|
275
265
|
if (!this.groupOrder.includes('resource')) {
|
|
276
266
|
this.groupOrder.push('resource');
|
|
@@ -291,6 +281,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
291
281
|
return true;
|
|
292
282
|
}
|
|
293
283
|
addExistingResourceFields(resources) {
|
|
284
|
+
var _a;
|
|
294
285
|
lodash_1.default.each(resources, (resource, index) => {
|
|
295
286
|
const resourceKey = `resource-${resource.name}`;
|
|
296
287
|
const subgroup = {
|
|
@@ -320,24 +311,21 @@ class WebformBuilder extends Component_1.default {
|
|
|
320
311
|
group: 'resource',
|
|
321
312
|
subgroup: resourceKey,
|
|
322
313
|
}, {
|
|
323
|
-
schema: Object.assign(Object.assign({}, component), { label: component.label, key: component.key, lockKey: true, source: !this.options.noSource ? resource._id : undefined, isNew: true })
|
|
314
|
+
schema: Object.assign(Object.assign({}, component), { label: component.label, key: component.key, lockKey: true, source: (!this.options.noSource ? resource._id : undefined), isNew: true })
|
|
324
315
|
});
|
|
325
316
|
}, true);
|
|
326
317
|
this.groups.resource.subgroups.push(subgroup);
|
|
327
318
|
});
|
|
328
|
-
this.triggerRedraw();
|
|
319
|
+
(_a = this.triggerRedraw) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
329
320
|
}
|
|
330
321
|
attachTooltip(component, title) {
|
|
331
322
|
return (0, tippy_js_1.default)(component, {
|
|
332
323
|
allowHTML: true,
|
|
333
324
|
trigger: 'mouseenter focus',
|
|
334
325
|
placement: 'top',
|
|
335
|
-
delay: [
|
|
336
|
-
200,
|
|
337
|
-
0,
|
|
338
|
-
],
|
|
326
|
+
delay: [200, 0],
|
|
339
327
|
zIndex: 10000,
|
|
340
|
-
content: title
|
|
328
|
+
content: title
|
|
341
329
|
});
|
|
342
330
|
}
|
|
343
331
|
attachComponent(element, component) {
|
|
@@ -352,7 +340,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
352
340
|
moveComponent: 'single',
|
|
353
341
|
copyComponent: 'single',
|
|
354
342
|
pasteComponent: 'single',
|
|
355
|
-
editJson: 'single'
|
|
343
|
+
editJson: 'single'
|
|
356
344
|
});
|
|
357
345
|
if (component.refs.copyComponent) {
|
|
358
346
|
this.attachTooltip(component.refs.copyComponent, this.t('Copy'));
|
|
@@ -376,9 +364,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
376
364
|
const parent = this.getParentElement(element);
|
|
377
365
|
if (component.refs.editComponent) {
|
|
378
366
|
this.attachTooltip(component.refs.editComponent, this.t('Edit'));
|
|
379
|
-
component.addEventListener(component.refs.editComponent, 'click', () => this.editComponent(component.schema, parent, false, false, component.component, {
|
|
380
|
-
inDataGrid: component.isInDataGrid,
|
|
381
|
-
}));
|
|
367
|
+
component.addEventListener(component.refs.editComponent, 'click', () => this.editComponent(component.schema, parent, false, false, component.component, { inDataGrid: component.isInDataGrid }));
|
|
382
368
|
}
|
|
383
369
|
if (component.refs.editJson) {
|
|
384
370
|
this.attachTooltip(component.refs.editJson, this.t('Edit JSON'));
|
|
@@ -394,7 +380,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
394
380
|
this.webform = new Webform_1.default(this.element, options);
|
|
395
381
|
if (this.element) {
|
|
396
382
|
this.loadRefs(this.element, {
|
|
397
|
-
form: 'single'
|
|
383
|
+
form: 'single'
|
|
398
384
|
});
|
|
399
385
|
if (this.refs.form) {
|
|
400
386
|
this.webform.element = this.refs.form;
|
|
@@ -418,20 +404,20 @@ class WebformBuilder extends Component_1.default {
|
|
|
418
404
|
},
|
|
419
405
|
advanced: {
|
|
420
406
|
title: 'Advanced',
|
|
421
|
-
weight: 10
|
|
407
|
+
weight: 10
|
|
422
408
|
},
|
|
423
409
|
layout: {
|
|
424
410
|
title: 'Layout',
|
|
425
|
-
weight: 20
|
|
411
|
+
weight: 20
|
|
426
412
|
},
|
|
427
413
|
data: {
|
|
428
414
|
title: 'Data',
|
|
429
|
-
weight: 30
|
|
415
|
+
weight: 30
|
|
430
416
|
},
|
|
431
417
|
premium: {
|
|
432
418
|
title: 'Premium',
|
|
433
|
-
weight: 40
|
|
434
|
-
}
|
|
419
|
+
weight: 40
|
|
420
|
+
}
|
|
435
421
|
};
|
|
436
422
|
}
|
|
437
423
|
redraw() {
|
|
@@ -468,10 +454,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
468
454
|
const componentSchema = component.component;
|
|
469
455
|
// If the current component is the namespace, we don't need to find it again.
|
|
470
456
|
if (namespaceKey === component.key) {
|
|
471
|
-
return [
|
|
472
|
-
...componentSchema.components,
|
|
473
|
-
componentSchema,
|
|
474
|
-
];
|
|
457
|
+
return [...componentSchema.components, componentSchema];
|
|
475
458
|
}
|
|
476
459
|
// Get the namespace component so we have the original object.
|
|
477
460
|
const namespaceComponent = (0, utils_1.getComponent)(this.form.components, namespaceKey, true);
|
|
@@ -483,16 +466,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
483
466
|
return null;
|
|
484
467
|
}
|
|
485
468
|
// Some components are their own namespace.
|
|
486
|
-
if ([
|
|
487
|
-
'address',
|
|
488
|
-
'container',
|
|
489
|
-
'datagrid',
|
|
490
|
-
'editgrid',
|
|
491
|
-
'dynamicWizard',
|
|
492
|
-
'tree',
|
|
493
|
-
].includes(component.type) ||
|
|
494
|
-
component.tree ||
|
|
495
|
-
component.arrayTree) {
|
|
469
|
+
if (['address', 'container', 'datagrid', 'editgrid', 'dynamicWizard', 'tree'].includes(component.type) || component.tree || component.arrayTree) {
|
|
496
470
|
return component.key;
|
|
497
471
|
}
|
|
498
472
|
// Anything else, keep going up.
|
|
@@ -512,7 +486,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
512
486
|
group,
|
|
513
487
|
groupKey: group.key,
|
|
514
488
|
groupId: `group-container-${groupKey}`,
|
|
515
|
-
subgroups: []
|
|
489
|
+
subgroups: []
|
|
516
490
|
})),
|
|
517
491
|
keyboardActionsEnabled: this.keyboardActionsEnabled,
|
|
518
492
|
})),
|
|
@@ -531,7 +505,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
531
505
|
sidebar: 'single',
|
|
532
506
|
'sidebar-search': 'single',
|
|
533
507
|
'sidebar-groups': 'single',
|
|
534
|
-
container: 'multiple',
|
|
508
|
+
'container': 'multiple',
|
|
535
509
|
'sidebar-anchor': 'multiple',
|
|
536
510
|
'sidebar-group': 'multiple',
|
|
537
511
|
'sidebar-container': 'multiple',
|
|
@@ -557,15 +531,11 @@ class WebformBuilder extends Component_1.default {
|
|
|
557
531
|
};
|
|
558
532
|
const hideShow = (group, forceShow, toggle = false) => {
|
|
559
533
|
if (forceShow || (toggle && !Array.from(group.classList).includes('show'))) {
|
|
560
|
-
group.classList.add([
|
|
561
|
-
'show',
|
|
562
|
-
]);
|
|
534
|
+
group.classList.add(['show']);
|
|
563
535
|
group.style.display = 'inherit';
|
|
564
536
|
}
|
|
565
537
|
else {
|
|
566
|
-
group.classList.remove([
|
|
567
|
-
'show',
|
|
568
|
-
]);
|
|
538
|
+
group.classList.remove(['show']);
|
|
569
539
|
group.style.display = 'none';
|
|
570
540
|
}
|
|
571
541
|
};
|
|
@@ -582,9 +552,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
582
552
|
const openByDefault = getAttribute(group, 'default') === 'true';
|
|
583
553
|
const groupId = group.getAttribute('id').slice('group-'.length);
|
|
584
554
|
const groupParent = getAttribute(group, 'parent').slice('#builder-sidebar-'.length);
|
|
585
|
-
if ((openByDefault && groupParent === clickedId) ||
|
|
586
|
-
groupId === clickedParentId ||
|
|
587
|
-
groupIndex === index) {
|
|
555
|
+
if (((openByDefault && groupParent === clickedId) || groupId === clickedParentId || groupIndex === index)) {
|
|
588
556
|
hideShow(group, false, true);
|
|
589
557
|
}
|
|
590
558
|
});
|
|
@@ -609,21 +577,20 @@ class WebformBuilder extends Component_1.default {
|
|
|
609
577
|
}
|
|
610
578
|
const drake = this.dragula;
|
|
611
579
|
if (this.refs.form) {
|
|
612
|
-
(0, dom_autoscroller_1.default)([
|
|
613
|
-
window,
|
|
614
|
-
], {
|
|
580
|
+
(0, dom_autoscroller_1.default)([window], {
|
|
615
581
|
margin: 20,
|
|
616
582
|
maxSpeed: 6,
|
|
617
583
|
scrollWhenOutside: true,
|
|
618
584
|
autoScroll: function () {
|
|
619
585
|
return this.down && (drake === null || drake === void 0 ? void 0 : drake.dragging);
|
|
620
|
-
}
|
|
586
|
+
}
|
|
621
587
|
});
|
|
622
588
|
return this.webform.attach(this.refs.form);
|
|
623
589
|
}
|
|
624
590
|
});
|
|
625
591
|
}
|
|
626
592
|
searchFields(searchString = '') {
|
|
593
|
+
var _a;
|
|
627
594
|
const searchValue = searchString.toLowerCase();
|
|
628
595
|
const sidebar = this.refs['sidebar'];
|
|
629
596
|
const sidebarGroups = this.refs['sidebar-groups'];
|
|
@@ -652,29 +619,30 @@ class WebformBuilder extends Component_1.default {
|
|
|
652
619
|
};
|
|
653
620
|
const filterGroupOrder = (groupOrder, searchValue) => {
|
|
654
621
|
const result = lodash_1.default.cloneDeep(groupOrder);
|
|
655
|
-
return result.filter(
|
|
622
|
+
return result.filter(key => filterGroupBy(this.groups[key], searchValue));
|
|
656
623
|
};
|
|
657
624
|
const filterSubgroups = (groups, searchValue) => {
|
|
658
625
|
const result = lodash_1.default.clone(groups);
|
|
659
626
|
return result
|
|
660
|
-
.map(
|
|
661
|
-
.filter(
|
|
627
|
+
.map(subgroup => filterGroupBy(subgroup, searchValue))
|
|
628
|
+
.filter(subgroup => !lodash_1.default.isNull(subgroup));
|
|
662
629
|
};
|
|
663
|
-
const toTemplate =
|
|
630
|
+
const toTemplate = groupKey => {
|
|
664
631
|
return {
|
|
665
632
|
group: filterGroupBy(this.groups[groupKey], searchValue),
|
|
666
633
|
groupKey,
|
|
667
634
|
groupId: sidebar.id || sidebarGroups.id,
|
|
668
|
-
subgroups: filterSubgroups(this.groups[groupKey].subgroups, searchValue)
|
|
635
|
+
subgroups: filterSubgroups(this.groups[groupKey].subgroups, searchValue)
|
|
636
|
+
.map((group) => this.renderTemplate('builderSidebarGroup', {
|
|
669
637
|
group,
|
|
670
638
|
groupKey: group.key,
|
|
671
639
|
groupId: `group-container-${groupKey}`,
|
|
672
|
-
subgroups: []
|
|
640
|
+
subgroups: []
|
|
673
641
|
})),
|
|
674
642
|
};
|
|
675
643
|
};
|
|
676
644
|
sidebarGroups.innerHTML = filterGroupOrder(this.groupOrder, searchValue)
|
|
677
|
-
.map(
|
|
645
|
+
.map(groupKey => this.renderTemplate('builderSidebarGroup', toTemplate(groupKey)))
|
|
678
646
|
.join('');
|
|
679
647
|
this.loadRefs(this.element, {
|
|
680
648
|
'sidebar-groups': 'single',
|
|
@@ -684,7 +652,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
684
652
|
});
|
|
685
653
|
this.updateDragAndDrop();
|
|
686
654
|
if (searchValue === '') {
|
|
687
|
-
this.triggerRedraw();
|
|
655
|
+
(_a = this.triggerRedraw) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
688
656
|
}
|
|
689
657
|
}
|
|
690
658
|
orderComponents(groupInfo, foundComponents) {
|
|
@@ -692,10 +660,10 @@ class WebformBuilder extends Component_1.default {
|
|
|
692
660
|
const isResource = groupInfo.key.indexOf('resource-') === 0;
|
|
693
661
|
if (components) {
|
|
694
662
|
groupInfo.componentOrder = Object.keys(components)
|
|
695
|
-
.map(
|
|
696
|
-
.filter(
|
|
663
|
+
.map(key => components[key])
|
|
664
|
+
.filter(component => component && !component.ignore && !component.ignoreForForm)
|
|
697
665
|
.sort((a, b) => a.weight - b.weight)
|
|
698
|
-
.map(
|
|
666
|
+
.map(component => isResource ? `component-${component.key}` : component.key);
|
|
699
667
|
}
|
|
700
668
|
}
|
|
701
669
|
updateDragAndDrop() {
|
|
@@ -711,9 +679,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
711
679
|
if (this.dragula) {
|
|
712
680
|
this.dragula.destroy();
|
|
713
681
|
}
|
|
714
|
-
const containersArray = Array.prototype.slice
|
|
715
|
-
.call(this.refs['sidebar-container'])
|
|
716
|
-
.filter((item) => {
|
|
682
|
+
const containersArray = Array.prototype.slice.call(this.refs['sidebar-container']).filter(item => {
|
|
717
683
|
return item.id !== 'group-container-resource';
|
|
718
684
|
});
|
|
719
685
|
if (!dragula_1.default) {
|
|
@@ -722,8 +688,8 @@ class WebformBuilder extends Component_1.default {
|
|
|
722
688
|
this.dragula = (0, dragula_1.default)(containersArray, {
|
|
723
689
|
moves(el) {
|
|
724
690
|
let moves = true;
|
|
725
|
-
const list = Array.from(el.classList).filter(
|
|
726
|
-
list.forEach(
|
|
691
|
+
const list = Array.from(el.classList).filter(item => item.indexOf('formio-component-') === 0);
|
|
692
|
+
list.forEach(item => {
|
|
727
693
|
const key = item.slice('formio-component-'.length);
|
|
728
694
|
if (options.disabled && options.disabled.includes(key)) {
|
|
729
695
|
moves = false;
|
|
@@ -739,7 +705,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
739
705
|
},
|
|
740
706
|
accepts(el, target) {
|
|
741
707
|
return !el.contains(target) && !target.classList.contains('no-drop');
|
|
742
|
-
}
|
|
708
|
+
}
|
|
743
709
|
}).on('drop', (element, target, source, sibling) => this.onDrop(element, target, source, sibling));
|
|
744
710
|
}
|
|
745
711
|
detach() {
|
|
@@ -773,8 +739,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
773
739
|
info = (0, utils_1.fastCloneDeep)(groupComponents[key].schema);
|
|
774
740
|
}
|
|
775
741
|
}
|
|
776
|
-
else if (group === 'searchFields') {
|
|
777
|
-
//Search components go into this group
|
|
742
|
+
else if (group === 'searchFields') { //Search components go into this group
|
|
778
743
|
const resourceGroups = this.groups.resource.subgroups;
|
|
779
744
|
for (let ix = 0; ix < resourceGroups.length; ix++) {
|
|
780
745
|
const resourceGroup = resourceGroups[ix];
|
|
@@ -802,21 +767,22 @@ class WebformBuilder extends Component_1.default {
|
|
|
802
767
|
let tabIndex = 0;
|
|
803
768
|
switch (parent.type) {
|
|
804
769
|
case 'table':
|
|
805
|
-
tableRowIndex = lodash_1.default.findIndex(parent.rows,
|
|
806
|
-
tableColumnIndex = lodash_1.default.findIndex(parent.rows[tableRowIndex], (column
|
|
770
|
+
tableRowIndex = lodash_1.default.findIndex(parent.rows, row => row.some(column => column.components.some(comp => comp.key === component.key)));
|
|
771
|
+
tableColumnIndex = lodash_1.default.findIndex(parent.rows[tableRowIndex], (column => column.components.some(comp => comp.key === component.key)));
|
|
807
772
|
path = `rows[${tableRowIndex}][${tableColumnIndex}].components`;
|
|
808
773
|
break;
|
|
809
774
|
case 'columns':
|
|
810
|
-
columnIndex = lodash_1.default.findIndex(parent.columns,
|
|
775
|
+
columnIndex = lodash_1.default.findIndex(parent.columns, column => column.components.some(comp => comp.key === component.key));
|
|
811
776
|
path = `columns[${columnIndex}].components`;
|
|
812
777
|
break;
|
|
813
778
|
case 'tabs':
|
|
814
|
-
tabIndex = lodash_1.default.findIndex(parent.components,
|
|
779
|
+
tabIndex = lodash_1.default.findIndex(parent.components, tab => tab.components.some(comp => comp.key === component.key));
|
|
815
780
|
path = `components[${tabIndex}].components`;
|
|
816
781
|
break;
|
|
817
782
|
}
|
|
818
783
|
return path;
|
|
819
784
|
}
|
|
785
|
+
/* eslint-disable max-statements */
|
|
820
786
|
onDrop(element, target, source, sibling) {
|
|
821
787
|
var _a;
|
|
822
788
|
if (!target) {
|
|
@@ -852,7 +818,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
852
818
|
return;
|
|
853
819
|
}
|
|
854
820
|
// Show an error if siblings are disabled for a component and such a component already exists.
|
|
855
|
-
const compKey = group === 'resource' ? `component-${key}` : key;
|
|
821
|
+
const compKey = (group === 'resource') ? `component-${key}` : key;
|
|
856
822
|
const draggableComponent = ((_a = this.groups[group]) === null || _a === void 0 ? void 0 : _a.components[compKey]) || {};
|
|
857
823
|
if (draggableComponent.disableSiblings) {
|
|
858
824
|
let isCompAlreadyExists = false;
|
|
@@ -891,10 +857,8 @@ class WebformBuilder extends Component_1.default {
|
|
|
891
857
|
if (target.formioContainer) {
|
|
892
858
|
if (sibling) {
|
|
893
859
|
if (!sibling.getAttribute('data-noattach')) {
|
|
894
|
-
index = lodash_1.default.findIndex(target.formioContainer, {
|
|
895
|
-
|
|
896
|
-
});
|
|
897
|
-
index = index === -1 ? 0 : index;
|
|
860
|
+
index = lodash_1.default.findIndex(target.formioContainer, { key: lodash_1.default.get(sibling, 'formioComponent.component.key') });
|
|
861
|
+
index = (index === -1) ? 0 : index;
|
|
898
862
|
}
|
|
899
863
|
else {
|
|
900
864
|
index = sibling.getAttribute('data-position');
|
|
@@ -916,11 +880,11 @@ class WebformBuilder extends Component_1.default {
|
|
|
916
880
|
parent.addChildComponent(info, element, target, source, sibling);
|
|
917
881
|
}
|
|
918
882
|
const componentInDataGrid = parent.type === 'datagrid';
|
|
919
|
-
if (isNew
|
|
920
|
-
!this.options.noNewEdit
|
|
921
|
-
!info.noNewEdit
|
|
922
|
-
this.hasEditTabs(info.type)
|
|
923
|
-
!(this.options.design && info.type === 'reviewpage')) {
|
|
883
|
+
if (isNew
|
|
884
|
+
&& !this.options.noNewEdit
|
|
885
|
+
&& !info.noNewEdit
|
|
886
|
+
&& this.hasEditTabs(info.type)
|
|
887
|
+
&& !(this.options.design && info.type === 'reviewpage')) {
|
|
924
888
|
this.editComponent(info, target, isNew, null, null, { inDataGrid: componentInDataGrid });
|
|
925
889
|
}
|
|
926
890
|
// Only rebuild the parts needing to be rebuilt.
|
|
@@ -984,12 +948,12 @@ class WebformBuilder extends Component_1.default {
|
|
|
984
948
|
block: false,
|
|
985
949
|
action: 'submit',
|
|
986
950
|
disableOnInvalid: true,
|
|
987
|
-
theme: 'primary'
|
|
951
|
+
theme: 'primary'
|
|
988
952
|
});
|
|
989
953
|
}
|
|
990
954
|
if (this.webform) {
|
|
991
955
|
const shouldRebuild = !this.webform.form.components ||
|
|
992
|
-
form.components.length !== this.webform.form.components.length;
|
|
956
|
+
(form.components.length !== this.webform.form.components.length);
|
|
993
957
|
return this.webform.setForm(form, { keepAsReference: true }).then(() => {
|
|
994
958
|
if (this.refs.form) {
|
|
995
959
|
this.builderHeight = this.refs.form.offsetHeight;
|
|
@@ -1006,7 +970,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1006
970
|
//populate isEnabled for captcha form settings
|
|
1007
971
|
let isCaptchaEnabled = false;
|
|
1008
972
|
if (this.form.components) {
|
|
1009
|
-
(0, utils_1.eachComponent)(form.components,
|
|
973
|
+
(0, utils_1.eachComponent)(form.components, component => {
|
|
1010
974
|
if (isCaptchaEnabled) {
|
|
1011
975
|
return;
|
|
1012
976
|
}
|
|
@@ -1033,8 +997,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1033
997
|
(Array.isArray(component.rows) && component.rows.length) ||
|
|
1034
998
|
(Array.isArray(component.columns) && component.columns.length));
|
|
1035
999
|
if (this.options.alwaysConfirmComponentRemoval || removingComponentsGroup) {
|
|
1036
|
-
const message = removingComponentsGroup
|
|
1037
|
-
? 'Removing this component will also remove all of its children. Are you sure you want to do this?'
|
|
1000
|
+
const message = removingComponentsGroup ? 'Removing this component will also remove all of its children. Are you sure you want to do this?'
|
|
1038
1001
|
: 'Are you sure you want to remove this component?';
|
|
1039
1002
|
remove = window.confirm(this.t(message));
|
|
1040
1003
|
}
|
|
@@ -1053,7 +1016,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1053
1016
|
if (component.input && componentInstance && parent.formioComponent) {
|
|
1054
1017
|
const parentDefaultValue = lodash_1.default.get(parent.formioComponent, 'component.defaultValue', null);
|
|
1055
1018
|
if (Array.isArray(parentDefaultValue)) {
|
|
1056
|
-
parentDefaultValue.forEach(
|
|
1019
|
+
parentDefaultValue.forEach(v => lodash_1.default.unset(v, componentInstance.key));
|
|
1057
1020
|
}
|
|
1058
1021
|
else if (typeof parentDefaultValue === 'object') {
|
|
1059
1022
|
lodash_1.default.unset(parentDefaultValue, componentInstance.key);
|
|
@@ -1078,29 +1041,23 @@ class WebformBuilder extends Component_1.default {
|
|
|
1078
1041
|
}
|
|
1079
1042
|
}
|
|
1080
1043
|
updateComponent(component, changed) {
|
|
1081
|
-
const sanitizeConfig = lodash_1.default.get(this.webform, 'form.settings.sanitizeConfig') ||
|
|
1082
|
-
lodash_1.default.get(this.webform, 'form.globalSettings.sanitizeConfig');
|
|
1044
|
+
const sanitizeConfig = lodash_1.default.get(this.webform, 'form.settings.sanitizeConfig') || lodash_1.default.get(this.webform, 'form.globalSettings.sanitizeConfig');
|
|
1083
1045
|
// Update the preview.
|
|
1084
1046
|
if (this.preview) {
|
|
1085
1047
|
this.preview.form = {
|
|
1086
|
-
components: [
|
|
1087
|
-
lodash_1.default.omit(Object.assign({}, component), [
|
|
1048
|
+
components: [lodash_1.default.omit(Object.assign({}, component), [
|
|
1088
1049
|
'hidden',
|
|
1089
1050
|
'conditional',
|
|
1090
1051
|
'calculateValue',
|
|
1091
1052
|
'logic',
|
|
1092
1053
|
'autofocus',
|
|
1093
1054
|
'customConditional',
|
|
1094
|
-
]),
|
|
1095
|
-
],
|
|
1055
|
+
])],
|
|
1096
1056
|
config: this.options.formConfig || {},
|
|
1097
1057
|
sanitizeConfig,
|
|
1098
1058
|
};
|
|
1099
|
-
const fieldsToRemoveDoubleQuotes = [
|
|
1100
|
-
|
|
1101
|
-
'tooltip',
|
|
1102
|
-
];
|
|
1103
|
-
this.preview.form.components.forEach((component) => this.replaceDoubleQuotes(component, fieldsToRemoveDoubleQuotes));
|
|
1059
|
+
const fieldsToRemoveDoubleQuotes = ['label', 'tooltip'];
|
|
1060
|
+
this.preview.form.components.forEach(component => this.replaceDoubleQuotes(component, fieldsToRemoveDoubleQuotes));
|
|
1104
1061
|
const previewElement = this.componentEdit.querySelector(`[${this._referenceAttributeName}="preview"]`);
|
|
1105
1062
|
if (previewElement) {
|
|
1106
1063
|
this.setContent(previewElement, this.preview.render(), null, sanitizeConfig);
|
|
@@ -1110,11 +1067,8 @@ class WebformBuilder extends Component_1.default {
|
|
|
1110
1067
|
// Change the "default value" field to be reflective of this component.
|
|
1111
1068
|
const defaultValueComponent = (0, utils_1.getComponent)(this.editForm.components, 'defaultValue', true);
|
|
1112
1069
|
if (defaultValueComponent && component.type !== 'hidden') {
|
|
1113
|
-
const defaultChanged = changed &&
|
|
1114
|
-
(
|
|
1115
|
-
(changed.instance &&
|
|
1116
|
-
defaultValueComponent.hasComponent &&
|
|
1117
|
-
defaultValueComponent.hasComponent(changed.instance)));
|
|
1070
|
+
const defaultChanged = changed && ((changed.component && changed.component.key === 'defaultValue')
|
|
1071
|
+
|| (changed.instance && defaultValueComponent.hasComponent && defaultValueComponent.hasComponent(changed.instance)));
|
|
1118
1072
|
if (!defaultChanged) {
|
|
1119
1073
|
lodash_1.default.assign(defaultValueComponent.component, lodash_1.default.omit(Object.assign({}, component), [
|
|
1120
1074
|
'key',
|
|
@@ -1143,12 +1097,12 @@ class WebformBuilder extends Component_1.default {
|
|
|
1143
1097
|
if (!this.originalDefaultValue) {
|
|
1144
1098
|
this.originalDefaultValue = (0, utils_1.fastCloneDeep)(defaultValueComponent.component);
|
|
1145
1099
|
}
|
|
1146
|
-
(0, utils_1.eachComponent)(defaultValueComponent.component.components, (comp
|
|
1100
|
+
(0, utils_1.eachComponent)(defaultValueComponent.component.components, (comp => {
|
|
1147
1101
|
var _a;
|
|
1148
1102
|
if ((_a = comp.validate) === null || _a === void 0 ? void 0 : _a.required) {
|
|
1149
1103
|
comp.validate.required = false;
|
|
1150
1104
|
}
|
|
1151
|
-
});
|
|
1105
|
+
}));
|
|
1152
1106
|
}
|
|
1153
1107
|
const parentComponent = defaultValueComponent.parent;
|
|
1154
1108
|
let tabIndex = -1;
|
|
@@ -1204,15 +1158,9 @@ class WebformBuilder extends Component_1.default {
|
|
|
1204
1158
|
const isLayout = (0, utils_1.componentInfo)(comp).layout;
|
|
1205
1159
|
if (!isLayout) {
|
|
1206
1160
|
if (keys.has(paths.dataPath)) {
|
|
1207
|
-
const onlyRadioCheckboxes = ((_a = repeatablePaths[paths.dataPath]) === null || _a === void 0 ? void 0 : _a.onlyRadioCheckboxes) === false
|
|
1208
|
-
? false
|
|
1209
|
-
: isRadioCheckbox;
|
|
1161
|
+
const onlyRadioCheckboxes = ((_a = repeatablePaths[paths.dataPath]) === null || _a === void 0 ? void 0 : _a.onlyRadioCheckboxes) === false ? false : isRadioCheckbox;
|
|
1210
1162
|
repeatablePaths[paths.dataPath] = {
|
|
1211
|
-
comps: [
|
|
1212
|
-
...(((_b = repeatablePaths[paths.dataPath]) === null || _b === void 0 ? void 0 : _b.comps) || []),
|
|
1213
|
-
keys.get(paths.dataPath),
|
|
1214
|
-
comp,
|
|
1215
|
-
],
|
|
1163
|
+
comps: [...(((_b = repeatablePaths[paths.dataPath]) === null || _b === void 0 ? void 0 : _b.comps) || []), keys.get(paths.dataPath), comp],
|
|
1216
1164
|
onlyRadioCheckboxes,
|
|
1217
1165
|
};
|
|
1218
1166
|
}
|
|
@@ -1257,9 +1205,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1257
1205
|
const parentContainer = parent ? parent.formioContainer : this.container;
|
|
1258
1206
|
const parentComponent = parent ? parent.formioComponent : this;
|
|
1259
1207
|
this.dialog.close();
|
|
1260
|
-
const path = parentContainer
|
|
1261
|
-
? this.getComponentsPath(component, parentComponent.component)
|
|
1262
|
-
: '';
|
|
1208
|
+
const path = parentContainer ? this.getComponentsPath(component, parentComponent.component) : '';
|
|
1263
1209
|
if (!original) {
|
|
1264
1210
|
original = parent.formioContainer.find((comp) => comp.id === component.id);
|
|
1265
1211
|
}
|
|
@@ -1271,10 +1217,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1271
1217
|
submissionData.components = this.originalDefaultValue.components;
|
|
1272
1218
|
this.originalDefaultValue = null;
|
|
1273
1219
|
}
|
|
1274
|
-
const fieldsToRemoveDoubleQuotes = [
|
|
1275
|
-
'label',
|
|
1276
|
-
'tooltip',
|
|
1277
|
-
];
|
|
1220
|
+
const fieldsToRemoveDoubleQuotes = ['label', 'tooltip'];
|
|
1278
1221
|
this.replaceDoubleQuotes(submissionData, fieldsToRemoveDoubleQuotes);
|
|
1279
1222
|
this.hook('beforeSaveComponentSettings', submissionData);
|
|
1280
1223
|
let comp = null;
|
|
@@ -1298,7 +1241,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1298
1241
|
const rebuild = parentComponent.rebuild() || Promise.resolve();
|
|
1299
1242
|
return rebuild.then(() => {
|
|
1300
1243
|
parentComponent.resetValue();
|
|
1301
|
-
const schema = parentContainer ? parentContainer[index] : comp ? comp.schema : [];
|
|
1244
|
+
const schema = parentContainer ? parentContainer[index] : (comp ? comp.schema : []);
|
|
1302
1245
|
this.emitSaveComponentEvent(schema, originalComp, parentComponent.schema, path, index, isNew, originalComponentSchema);
|
|
1303
1246
|
this.emit('change', this.form);
|
|
1304
1247
|
this.highlightInvalidComponents();
|
|
@@ -1343,7 +1286,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1343
1286
|
this.editForm.addEventListener(saveButton, 'click', (event) => {
|
|
1344
1287
|
event.preventDefault();
|
|
1345
1288
|
const errors = this.editForm.validate(this.editForm.data, {
|
|
1346
|
-
dirty: true
|
|
1289
|
+
dirty: true
|
|
1347
1290
|
});
|
|
1348
1291
|
if (errors.length) {
|
|
1349
1292
|
this.editForm.setPristine(false);
|
|
@@ -1403,74 +1346,62 @@ class WebformBuilder extends Component_1.default {
|
|
|
1403
1346
|
editFormOptions.editComponent = component;
|
|
1404
1347
|
editFormOptions.flags = flags;
|
|
1405
1348
|
this.hook('editComponentParentInstance', editFormOptions, parent);
|
|
1406
|
-
this.editForm = new Webform_1.default(Object.assign(Object.assign(Object.assign(Object.assign({}, lodash_1.default.omit(this.options, [
|
|
1407
|
-
'hooks',
|
|
1408
|
-
'builder',
|
|
1409
|
-
'events',
|
|
1410
|
-
'attachMode',
|
|
1411
|
-
'skipInit',
|
|
1412
|
-
])), { language: this.options.language }), editFormOptions), { evalContext: Object.assign(Object.assign({}, ((editFormOptions === null || editFormOptions === void 0 ? void 0 : editFormOptions.evalContext) || ((_a = this.options) === null || _a === void 0 ? void 0 : _a.evalContext) || {})), { buildingForm: this.form }) }));
|
|
1349
|
+
this.editForm = new Webform_1.default(Object.assign(Object.assign(Object.assign(Object.assign({}, lodash_1.default.omit(this.options, ['hooks', 'builder', 'events', 'attachMode', 'skipInit'])), { language: this.options.language }), editFormOptions), { evalContext: Object.assign(Object.assign({}, ((editFormOptions === null || editFormOptions === void 0 ? void 0 : editFormOptions.evalContext) || ((_a = this.options) === null || _a === void 0 ? void 0 : _a.evalContext) || {})), { buildingForm: this.form }) }));
|
|
1413
1350
|
this.hook('editFormProperties', parent);
|
|
1414
|
-
this.editForm.form =
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
key: 'showFullSchema',
|
|
1431
|
-
label: 'Full Schema',
|
|
1432
|
-
},
|
|
1433
|
-
],
|
|
1351
|
+
this.editForm.form = (isJsonEdit && !isCustom) ? {
|
|
1352
|
+
components: [
|
|
1353
|
+
{
|
|
1354
|
+
type: 'textarea',
|
|
1355
|
+
as: 'json',
|
|
1356
|
+
editor: 'ace',
|
|
1357
|
+
weight: 10,
|
|
1358
|
+
input: true,
|
|
1359
|
+
key: 'componentJson',
|
|
1360
|
+
label: 'Component JSON',
|
|
1361
|
+
tooltip: 'Edit the JSON for this component.'
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
type: 'checkbox',
|
|
1365
|
+
key: 'showFullSchema',
|
|
1366
|
+
label: 'Full Schema'
|
|
1434
1367
|
}
|
|
1435
|
-
|
|
1368
|
+
]
|
|
1369
|
+
} : ComponentClass.editForm(lodash_1.default.cloneDeep(overrides));
|
|
1436
1370
|
const instanceOptions = {
|
|
1437
1371
|
inFormBuilder: true,
|
|
1438
1372
|
};
|
|
1439
1373
|
this.hook('instanceOptionsPreview', instanceOptions);
|
|
1440
1374
|
const instance = new ComponentClass(componentCopy, instanceOptions);
|
|
1441
1375
|
const schema = this.hook('builderComponentSchema', component, instance);
|
|
1442
|
-
this.editForm.submission = isJsonEdit
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
data: instance.component,
|
|
1451
|
-
};
|
|
1376
|
+
this.editForm.submission = isJsonEdit ? {
|
|
1377
|
+
data: {
|
|
1378
|
+
componentJson: schema,
|
|
1379
|
+
showFullSchema: this.options.showFullJsonSchema
|
|
1380
|
+
},
|
|
1381
|
+
} : {
|
|
1382
|
+
data: instance.component,
|
|
1383
|
+
};
|
|
1452
1384
|
if (this.preview) {
|
|
1453
1385
|
this.preview.destroy();
|
|
1454
1386
|
}
|
|
1455
|
-
if (!ComponentClass.builderInfo.hasOwnProperty('preview') ||
|
|
1456
|
-
ComponentClass.builderInfo.preview) {
|
|
1387
|
+
if (!ComponentClass.builderInfo.hasOwnProperty('preview') || ComponentClass.builderInfo.preview) {
|
|
1457
1388
|
this.preview = new Webform_1.default(lodash_1.default.omit(Object.assign(Object.assign({}, this.options), { preview: true }), [
|
|
1458
1389
|
'hooks',
|
|
1459
1390
|
'builder',
|
|
1460
1391
|
'events',
|
|
1461
1392
|
'attachMode',
|
|
1462
|
-
'calculateValue'
|
|
1393
|
+
'calculateValue'
|
|
1463
1394
|
]));
|
|
1464
1395
|
this.hook('previewFormSettitngs', schema, isJsonEdit);
|
|
1465
1396
|
}
|
|
1466
1397
|
this.showPreview = (_b = ComponentClass.builderInfo.showPreview) !== null && _b !== void 0 ? _b : true;
|
|
1467
|
-
this.componentEdit = this.ce('div', { class: 'component-edit-container' });
|
|
1398
|
+
this.componentEdit = this.ce('div', { 'class': 'component-edit-container' });
|
|
1468
1399
|
this.setContent(this.componentEdit, this.renderTemplate('builderEditForm', {
|
|
1469
1400
|
componentInfo: ComponentClass.builderInfo,
|
|
1470
1401
|
editForm: this.editForm.render(),
|
|
1471
1402
|
preview: this.preview ? this.preview.render() : false,
|
|
1472
1403
|
showPreview: this.showPreview,
|
|
1473
|
-
helplinks: this.helplinks
|
|
1404
|
+
helplinks: this.helplinks
|
|
1474
1405
|
}));
|
|
1475
1406
|
this.dialog = this.createModal(this.componentEdit, lodash_1.default.get(this.options, 'dialogAttr', {}));
|
|
1476
1407
|
// This is the attach step.
|
|
@@ -1484,33 +1415,27 @@ class WebformBuilder extends Component_1.default {
|
|
|
1484
1415
|
this.editForm.submission = {
|
|
1485
1416
|
data: {
|
|
1486
1417
|
componentJson: value ? instance.component : component,
|
|
1487
|
-
showFullSchema: value
|
|
1418
|
+
showFullSchema: value
|
|
1488
1419
|
},
|
|
1489
1420
|
};
|
|
1490
1421
|
return;
|
|
1491
1422
|
}
|
|
1492
1423
|
// See if this is a manually modified key. Treat custom component keys as manually modified
|
|
1493
|
-
if ((event.changed.component && event.changed.component.key === 'key') || isJsonEdit) {
|
|
1424
|
+
if ((event.changed.component && (event.changed.component.key === 'key')) || isJsonEdit) {
|
|
1494
1425
|
componentCopy.keyModified = true;
|
|
1495
1426
|
}
|
|
1496
1427
|
let isComponentLabelChanged = false;
|
|
1497
1428
|
if (event.changed.instance) {
|
|
1498
|
-
isComponentLabelChanged = [
|
|
1499
|
-
'label',
|
|
1500
|
-
'title',
|
|
1501
|
-
].includes(event.changed.instance.path);
|
|
1429
|
+
isComponentLabelChanged = ['label', 'title'].includes(event.changed.instance.path);
|
|
1502
1430
|
}
|
|
1503
1431
|
else if (event.changed.component) {
|
|
1504
|
-
isComponentLabelChanged = [
|
|
1505
|
-
'label',
|
|
1506
|
-
'title',
|
|
1507
|
-
].includes(event.changed.component.key);
|
|
1432
|
+
isComponentLabelChanged = ['label', 'title'].includes(event.changed.component.key);
|
|
1508
1433
|
}
|
|
1509
1434
|
if (isComponentLabelChanged) {
|
|
1510
1435
|
// Ensure this component has a key.
|
|
1511
1436
|
if (isNew) {
|
|
1512
1437
|
if (!event.data.keyModified) {
|
|
1513
|
-
this.editForm.everyComponent(
|
|
1438
|
+
this.editForm.everyComponent(component => {
|
|
1514
1439
|
if (component.key === 'key' && component.parent.component.key === 'tabs') {
|
|
1515
1440
|
component.setValue(this.updateComponentKey(event.data));
|
|
1516
1441
|
return false;
|
|
@@ -1520,7 +1445,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1520
1445
|
if (this.form) {
|
|
1521
1446
|
let formComponents = this.findNamespaceRoot(parent.formioComponent);
|
|
1522
1447
|
// excluding component which key uniqueness is to be checked to prevent the comparing of the same keys
|
|
1523
|
-
formComponents = formComponents.filter(
|
|
1448
|
+
formComponents = formComponents.filter(comp => editFormOptions.editComponent.id !== comp.id);
|
|
1524
1449
|
// Set a unique key for this component.
|
|
1525
1450
|
builder_1.default.uniquify(formComponents, event.data);
|
|
1526
1451
|
}
|
|
@@ -1529,9 +1454,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1529
1454
|
// If the edit form has any nested form inside, we get a partial data (nested form's data) in the
|
|
1530
1455
|
// event.data property
|
|
1531
1456
|
let editFormData;
|
|
1532
|
-
if (event.changed.instance &&
|
|
1533
|
-
event.changed.instance.root &&
|
|
1534
|
-
event.changed.instance.root.id !== this.editForm.id) {
|
|
1457
|
+
if (event.changed.instance && event.changed.instance.root && event.changed.instance.root.id !== this.editForm.id) {
|
|
1535
1458
|
editFormData = this.editForm.data;
|
|
1536
1459
|
}
|
|
1537
1460
|
// Update the component.
|
|
@@ -1558,7 +1481,10 @@ class WebformBuilder extends Component_1.default {
|
|
|
1558
1481
|
this.emit('editComponent', component);
|
|
1559
1482
|
}
|
|
1560
1483
|
updateComponentKey(data) {
|
|
1561
|
-
return lodash_1.default.camelCase(data.title ||
|
|
1484
|
+
return lodash_1.default.camelCase(data.title ||
|
|
1485
|
+
data.label ||
|
|
1486
|
+
data.placeholder ||
|
|
1487
|
+
data.type).replace(/^[0-9]*/, '');
|
|
1562
1488
|
}
|
|
1563
1489
|
moveComponent(component) {
|
|
1564
1490
|
var _a;
|
|
@@ -1593,7 +1519,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1593
1519
|
}
|
|
1594
1520
|
}
|
|
1595
1521
|
const len = source.formioComponent.components.length;
|
|
1596
|
-
index = index === -1 ? 0 : index + step;
|
|
1522
|
+
index = (index === -1) ? 0 : index + step;
|
|
1597
1523
|
if (index === -1) {
|
|
1598
1524
|
source.formioContainer.push(info);
|
|
1599
1525
|
source.appendChild(element);
|
|
@@ -1686,7 +1612,7 @@ class WebformBuilder extends Component_1.default {
|
|
|
1686
1612
|
parent.formioComponent.saveChildComponent(schema, false);
|
|
1687
1613
|
}
|
|
1688
1614
|
parent.formioComponent.rebuild();
|
|
1689
|
-
this.emitSaveComponentEvent(schema, schema, parent.formioComponent.component, path, index + 1, true, schema);
|
|
1615
|
+
this.emitSaveComponentEvent(schema, schema, parent.formioComponent.component, path, (index + 1), true, schema);
|
|
1690
1616
|
}
|
|
1691
1617
|
this.emit('change', this.form);
|
|
1692
1618
|
}
|
|
@@ -1731,23 +1657,28 @@ class WebformBuilder extends Component_1.default {
|
|
|
1731
1657
|
super.destroy(all);
|
|
1732
1658
|
}
|
|
1733
1659
|
addBuilderGroup(name, group) {
|
|
1660
|
+
var _a;
|
|
1734
1661
|
if (!this.groups[name]) {
|
|
1735
1662
|
this.groups[name] = group;
|
|
1736
1663
|
this.groupOrder.push(name);
|
|
1737
|
-
this.triggerRedraw();
|
|
1664
|
+
(_a = this.triggerRedraw) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1738
1665
|
}
|
|
1739
1666
|
else {
|
|
1740
1667
|
this.updateBuilderGroup(name, group);
|
|
1741
1668
|
}
|
|
1742
1669
|
}
|
|
1743
1670
|
updateBuilderGroup(name, group) {
|
|
1671
|
+
var _a;
|
|
1744
1672
|
if (this.groups[name]) {
|
|
1745
1673
|
this.groups[name] = group;
|
|
1746
|
-
this.triggerRedraw();
|
|
1674
|
+
(_a = this.triggerRedraw) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1747
1675
|
}
|
|
1748
1676
|
}
|
|
1749
1677
|
generateKey(info) {
|
|
1750
|
-
return info.key || lodash_1.default.camelCase(info.title ||
|
|
1678
|
+
return info.key || lodash_1.default.camelCase(info.title ||
|
|
1679
|
+
info.label ||
|
|
1680
|
+
info.placeholder ||
|
|
1681
|
+
info.type);
|
|
1751
1682
|
}
|
|
1752
1683
|
hasEditTabs(type) {
|
|
1753
1684
|
// If the component type does not exist then it has no edit tabs
|