@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
package/lib/mjs/Form.js
CHANGED
|
@@ -3,96 +3,90 @@ import { Formio } from './Formio';
|
|
|
3
3
|
import Displays from './displays';
|
|
4
4
|
import templates from './templates';
|
|
5
5
|
import FormioUtils from './utils';
|
|
6
|
-
/**
|
|
7
|
-
* Represents a JSON value.
|
|
8
|
-
* @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Represents a JSON array.
|
|
12
|
-
* @typedef {Array<JSON>} JSONArray
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Represents a JSON object.
|
|
16
|
-
* @typedef {{[key: string]: JSON}} JSONObject
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* @typedef {object} FormioHooks
|
|
20
|
-
* @property {Function} [beforeSubmit] - Called before a submission is made.
|
|
21
|
-
* @property {Function} [beforeCancel] - Called before a cancel is made.
|
|
22
|
-
* @property {Function} [beforeNext] - Called before the next page is navigated to.
|
|
23
|
-
* @property {Function} [beforePrev] - Called before the previous page is navigated to.
|
|
24
|
-
* @property {Function} [attachComponent] - Called when a component is attached.
|
|
25
|
-
* @property {Function} [setDataValue] - Called when a data value is set.
|
|
26
|
-
* @property {Function} [addComponents] - Called when components are added.
|
|
27
|
-
* @property {Function} [addComponent] - Called when a component is added.
|
|
28
|
-
* @property {Function} [customValidation] - Called when a custom validation is made.
|
|
29
|
-
* @property {Function} [attachWebform] - Called when a webform is attached.
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* @typedef {object} SanitizeConfig
|
|
33
|
-
* @property {string[]} [addAttr] - The html attributes to allow with sanitization.
|
|
34
|
-
* @property {string[]} [addTags] - The html tags to allow with sanitization.
|
|
35
|
-
* @property {string[]} [allowedAttrs] - The html attributes to allow with sanitization.
|
|
36
|
-
* @property {string[]} [allowedTags] - The html tags to allow with sanitization.
|
|
37
|
-
* @property {string[]} [allowedUriRegex] - The regex for allowed URIs.
|
|
38
|
-
* @property {string[]} [addUriSafeAttr] - The URI attributes to allow with sanitization.
|
|
39
|
-
*/
|
|
40
|
-
/**
|
|
41
|
-
* @typedef {object} ButtonSettings
|
|
42
|
-
* @property {boolean} [showPrevious] - Show the previous button in wizard forms.
|
|
43
|
-
* @property {boolean} [showNext] - Show the next button in wizard forms.
|
|
44
|
-
* @property {boolean} [showCancel] - Show the cancel button in wizard forms.
|
|
45
|
-
* @property {boolean} [showSubmit] - Show the submit button in wizard forms.
|
|
46
|
-
*/
|
|
47
|
-
/**
|
|
48
|
-
* @typedef {object} FormOptions
|
|
49
|
-
* @property {boolean} [saveDraft] - Enable the save draft feature.
|
|
50
|
-
* @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
|
|
51
|
-
* @property {boolean} [readOnly] - Set this form to readOnly.
|
|
52
|
-
* @property {boolean} [noAlerts] - Disable the alerts dialog.
|
|
53
|
-
* @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
|
|
54
|
-
* @property {string} [template] - Custom logic for creation of elements.
|
|
55
|
-
* @property {boolean} [noDefaults] - Exclude default values from the settings.
|
|
56
|
-
* @property {any} [fileService] - The file service for this form.
|
|
57
|
-
* @property {EventEmitter} [events] - The EventEmitter for this form.
|
|
58
|
-
* @property {string} [language] - The language to render this form in.
|
|
59
|
-
* @property {{[key: string]: string}} [i18next] - The i18next configuration for this form.
|
|
60
|
-
* @property {boolean} [viewAsHtml] - View the form as raw HTML.
|
|
61
|
-
* @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
|
|
62
|
-
* @property {boolean} [highlightErrors] - Highlight any errors on the form.
|
|
63
|
-
* @property {string} [componentErrorClass] - The error class for components.
|
|
64
|
-
* @property {any} [templates] - The templates for this form.
|
|
65
|
-
* @property {string} [iconset] - The iconset for this form.
|
|
66
|
-
* @property {import('@formio/core').Component[]} [components] - The components for this form.
|
|
67
|
-
* @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
|
|
68
|
-
* @property {boolean} [showHiddenFields] - Show hidden fields.
|
|
69
|
-
* @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
|
|
70
|
-
* @property {{[key: string]: boolean}} [show] - Components to show for this form.
|
|
71
|
-
* @property {Formio} [formio] - The Formio instance for this form.
|
|
72
|
-
* @property {string} [decimalSeparator] - The decimal separator for this form.
|
|
73
|
-
* @property {string} [thousandsSeparator] - The thousands separator for this form.
|
|
74
|
-
* @property {FormioHooks} [hooks] - The hooks for this form.
|
|
75
|
-
* @property {boolean} [alwaysDirty] - Always be dirty.
|
|
76
|
-
* @property {boolean} [skipDraftRestore] - Skip restoring a draft.
|
|
77
|
-
* @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
|
|
78
|
-
* @property {string} [cdnUrl] - The CDN url for this form.
|
|
79
|
-
* @property {boolean} [flatten] - Flatten the form.
|
|
80
|
-
* @property {boolean} [sanitize] - Sanitize the form.
|
|
81
|
-
* @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
|
|
82
|
-
* @property {ButtonSettings} [buttonSettings] - The button settings for this form.
|
|
83
|
-
* @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
|
|
84
|
-
* @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
|
|
85
|
-
* @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
|
|
86
|
-
* @property {boolean} [showCheckboxBackground] - Show the checkbox background.
|
|
87
|
-
* @property {number} [zoom] - The zoom for PDF forms.
|
|
88
|
-
* @property {boolean} [building] - Whether the form is in builder mode.
|
|
89
|
-
* @property {boolean} [inputsOnly] - Whether to render inputs only (for PDF forms).
|
|
90
|
-
*/
|
|
91
|
-
/**
|
|
92
|
-
* Form class for rendering webforms, pdfs, and wizards.
|
|
93
|
-
* @property {FormOptions} options - The options for this Form instance.
|
|
94
|
-
*/
|
|
95
6
|
export default class Form extends Element {
|
|
7
|
+
/**
|
|
8
|
+
* Represents a JSON value.
|
|
9
|
+
* @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Represents a JSON array.
|
|
13
|
+
* @typedef {Array<JSON>} JSONArray
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Represents a JSON object.
|
|
17
|
+
* @typedef {{[key: string]: JSON}} JSONObject
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {object} FormioHooks
|
|
21
|
+
* @property {Function} [beforeSubmit] - Called before a submission is made.
|
|
22
|
+
* @property {Function} [beforeCancel] - Called before a cancel is made.
|
|
23
|
+
* @property {Function} [beforeNext] - Called before the next page is navigated to.
|
|
24
|
+
* @property {Function} [beforePrev] - Called before the previous page is navigated to.
|
|
25
|
+
* @property {Function} [attachComponent] - Called when a component is attached.
|
|
26
|
+
* @property {Function} [setDataValue] - Called when a data value is set.
|
|
27
|
+
* @property {Function} [addComponents] - Called when components are added.
|
|
28
|
+
* @property {Function} [addComponent] - Called when a component is added.
|
|
29
|
+
* @property {Function} [customValidation] - Called when a custom validation is made.
|
|
30
|
+
* @property {Function} [attachWebform] - Called when a webform is attached.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {object} SanitizeConfig
|
|
34
|
+
* @property {string[]} [addAttr] - The html attributes to allow with sanitization.
|
|
35
|
+
* @property {string[]} [addTags] - The html tags to allow with sanitization.
|
|
36
|
+
* @property {string[]} [allowedAttrs] - The html attributes to allow with sanitization.
|
|
37
|
+
* @property {string[]} [allowedTags] - The html tags to allow with sanitization.
|
|
38
|
+
* @property {string[]} [allowedUriRegex] - The regex for allowed URIs.
|
|
39
|
+
* @property {string[]} [addUriSafeAttr] - The URI attributes to allow with sanitization.
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* @typedef {object} ButtonSettings
|
|
43
|
+
* @property {boolean} [showPrevious] - Show the previous button in wizard forms.
|
|
44
|
+
* @property {boolean} [showNext] - Show the next button in wizard forms.
|
|
45
|
+
* @property {boolean} [showCancel] - Show the cancel button in wizard forms.
|
|
46
|
+
* @property {boolean} [showSubmit] - Show the submit button in wizard forms.
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {object} FormOptions
|
|
50
|
+
* @property {boolean} [saveDraft] - Enable the save draft feature.
|
|
51
|
+
* @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
|
|
52
|
+
* @property {boolean} [readOnly] - Set this form to readOnly.
|
|
53
|
+
* @property {boolean} [noAlerts] - Disable the alerts dialog.
|
|
54
|
+
* @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
|
|
55
|
+
* @property {string} [template] - Custom logic for creation of elements.
|
|
56
|
+
* @property {boolean} [noDefaults] - Exclude default values from the settings.
|
|
57
|
+
* @property {any} [fileService] - The file service for this form.
|
|
58
|
+
* @property {EventEmitter} [events] - The EventEmitter for this form.
|
|
59
|
+
* @property {string} [language] - The language to render this form in.
|
|
60
|
+
* @property {{[key: string]: string}} [i18next] - The i18next configuration for this form.
|
|
61
|
+
* @property {boolean} [viewAsHtml] - View the form as raw HTML.
|
|
62
|
+
* @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
|
|
63
|
+
* @property {boolean} [highlightErrors] - Highlight any errors on the form.
|
|
64
|
+
* @property {string} [componentErrorClass] - The error class for components.
|
|
65
|
+
* @property {any} [templates] - The templates for this form.
|
|
66
|
+
* @property {string} [iconset] - The iconset for this form.
|
|
67
|
+
* @property {import('@formio/core').Component[]} [components] - The components for this form.
|
|
68
|
+
* @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
|
|
69
|
+
* @property {boolean} [showHiddenFields] - Show hidden fields.
|
|
70
|
+
* @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
|
|
71
|
+
* @property {{[key: string]: boolean}} [show] - Components to show for this form.
|
|
72
|
+
* @property {Formio} [formio] - The Formio instance for this form.
|
|
73
|
+
* @property {string} [decimalSeparator] - The decimal separator for this form.
|
|
74
|
+
* @property {string} [thousandsSeparator] - The thousands separator for this form.
|
|
75
|
+
* @property {FormioHooks} [hooks] - The hooks for this form.
|
|
76
|
+
* @property {boolean} [alwaysDirty] - Always be dirty.
|
|
77
|
+
* @property {boolean} [skipDraftRestore] - Skip restoring a draft.
|
|
78
|
+
* @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
|
|
79
|
+
* @property {string} [cdnUrl] - The CDN url for this form.
|
|
80
|
+
* @property {boolean} [flatten] - Flatten the form.
|
|
81
|
+
* @property {boolean} [sanitize] - Sanitize the form.
|
|
82
|
+
* @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
|
|
83
|
+
* @property {ButtonSettings} [buttonSettings] - The button settings for this form.
|
|
84
|
+
* @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
|
|
85
|
+
* @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
|
|
86
|
+
* @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
|
|
87
|
+
* @property {boolean} [showCheckboxBackground] - Show the checkbox background.
|
|
88
|
+
* @property {number} [zoom] - The zoom for PDF forms.
|
|
89
|
+
*/
|
|
96
90
|
/**
|
|
97
91
|
* Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
|
|
98
92
|
* @param {object} elementOrForm - The DOM element you wish to render this form within, or the form definition.
|
|
@@ -103,6 +97,10 @@ export default class Form extends Element {
|
|
|
103
97
|
* const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
|
|
104
98
|
* form.build();
|
|
105
99
|
*/
|
|
100
|
+
/**
|
|
101
|
+
* @type {FormOptions} - the options for this Form.
|
|
102
|
+
*/
|
|
103
|
+
options;
|
|
106
104
|
constructor(elementOrForm, formOrOptions, options = {}) {
|
|
107
105
|
let element, form, formOptions;
|
|
108
106
|
if (elementOrForm instanceof HTMLElement) {
|
|
@@ -152,7 +150,7 @@ export default class Form extends Element {
|
|
|
152
150
|
element.setAttribute(attr, attrs[attr]);
|
|
153
151
|
}
|
|
154
152
|
}
|
|
155
|
-
(children || []).forEach(
|
|
153
|
+
(children || []).forEach(child => {
|
|
156
154
|
element.appendChild(this.createElement(child.tag, child.attrs, child.children));
|
|
157
155
|
});
|
|
158
156
|
return element;
|
|
@@ -166,23 +164,19 @@ export default class Form extends Element {
|
|
|
166
164
|
return;
|
|
167
165
|
}
|
|
168
166
|
this.loader = this.createElement('div', {
|
|
169
|
-
class: 'formio-loader'
|
|
170
|
-
}, [
|
|
171
|
-
{
|
|
167
|
+
'class': 'formio-loader'
|
|
168
|
+
}, [{
|
|
172
169
|
tag: 'div',
|
|
173
170
|
attrs: {
|
|
174
|
-
class: 'loader-wrapper'
|
|
171
|
+
class: 'loader-wrapper'
|
|
175
172
|
},
|
|
176
|
-
children: [
|
|
177
|
-
{
|
|
173
|
+
children: [{
|
|
178
174
|
tag: 'div',
|
|
179
175
|
attrs: {
|
|
180
|
-
class: 'loader text-center'
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
},
|
|
185
|
-
]);
|
|
176
|
+
class: 'loader text-center'
|
|
177
|
+
}
|
|
178
|
+
}]
|
|
179
|
+
}]);
|
|
186
180
|
this.element.appendChild(this.loader);
|
|
187
181
|
}
|
|
188
182
|
else if (this.loader) {
|
|
@@ -206,6 +200,7 @@ export default class Form extends Element {
|
|
|
206
200
|
return new Displays.displays[display](this.element, this.options);
|
|
207
201
|
}
|
|
208
202
|
else {
|
|
203
|
+
// eslint-disable-next-line new-cap
|
|
209
204
|
return new Displays.displays['webform'](this.element, this.options);
|
|
210
205
|
}
|
|
211
206
|
}
|
|
@@ -221,21 +216,21 @@ export default class Form extends Element {
|
|
|
221
216
|
return {
|
|
222
217
|
components: [
|
|
223
218
|
{
|
|
224
|
-
label: 'HTML',
|
|
225
|
-
tag: 'div',
|
|
226
|
-
className: 'error error-message alert alert-danger ui red message',
|
|
227
|
-
attrs: [
|
|
219
|
+
'label': 'HTML',
|
|
220
|
+
'tag': 'div',
|
|
221
|
+
'className': 'error error-message alert alert-danger ui red message',
|
|
222
|
+
'attrs': [
|
|
228
223
|
{
|
|
229
|
-
attr: 'role',
|
|
230
|
-
value: 'alert'
|
|
231
|
-
}
|
|
224
|
+
'attr': 'role',
|
|
225
|
+
'value': 'alert'
|
|
226
|
+
}
|
|
232
227
|
],
|
|
233
|
-
key: 'errorMessage',
|
|
234
|
-
type: 'htmlelement',
|
|
235
|
-
input: false,
|
|
236
|
-
content: typeof err === 'string' ? err : err.message,
|
|
237
|
-
}
|
|
238
|
-
]
|
|
228
|
+
'key': 'errorMessage',
|
|
229
|
+
'type': 'htmlelement',
|
|
230
|
+
'input': false,
|
|
231
|
+
'content': typeof err === 'string' ? err : err.message,
|
|
232
|
+
}
|
|
233
|
+
]
|
|
239
234
|
};
|
|
240
235
|
}
|
|
241
236
|
/**
|
|
@@ -254,7 +249,7 @@ export default class Form extends Element {
|
|
|
254
249
|
const projectUrl = url.substring(0, index - 1);
|
|
255
250
|
const urlParts = Formio.getUrlParts(projectUrl);
|
|
256
251
|
// project url doesn't include subdirectories path
|
|
257
|
-
if (!urlParts || urlParts.filter(
|
|
252
|
+
if (!urlParts || urlParts.filter(part => !!part).length < 4) {
|
|
258
253
|
return options;
|
|
259
254
|
}
|
|
260
255
|
const baseUrl = `${urlParts[1]}${urlParts[2]}`;
|
|
@@ -269,7 +264,7 @@ export default class Form extends Element {
|
|
|
269
264
|
}
|
|
270
265
|
/**
|
|
271
266
|
* Sets the form to the JSON schema of a form.
|
|
272
|
-
* @param {import('@formio/core').Form
|
|
267
|
+
* @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
|
|
273
268
|
* @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
|
|
274
269
|
*/
|
|
275
270
|
setForm(formParam) {
|
|
@@ -284,10 +279,9 @@ export default class Form extends Element {
|
|
|
284
279
|
error = err;
|
|
285
280
|
})
|
|
286
281
|
.then((submission) => {
|
|
287
|
-
return (
|
|
288
|
-
.loadForm()
|
|
282
|
+
return formio.loadForm()
|
|
289
283
|
// If the form returned an error, show it instead of the form.
|
|
290
|
-
.catch(
|
|
284
|
+
.catch(err => {
|
|
291
285
|
error = err;
|
|
292
286
|
})
|
|
293
287
|
.then((form) => {
|
|
@@ -297,14 +291,8 @@ export default class Form extends Element {
|
|
|
297
291
|
}
|
|
298
292
|
this.loading = false;
|
|
299
293
|
this.instance = this.instance || this.create(form.display);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
const options = this.getFormInitOptions(formParam, form);
|
|
303
|
-
this.instance.setUrl(formParam, options);
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
this.instance.url = formParam;
|
|
307
|
-
}
|
|
294
|
+
const options = this.getFormInitOptions(formParam, form);
|
|
295
|
+
this.instance.setUrl(formParam, options);
|
|
308
296
|
this.instance.nosubmit = false;
|
|
309
297
|
this._form = this.instance.form = form;
|
|
310
298
|
if (submission) {
|
|
@@ -314,7 +302,7 @@ export default class Form extends Element {
|
|
|
314
302
|
throw error;
|
|
315
303
|
}
|
|
316
304
|
return this.instance;
|
|
317
|
-
})
|
|
305
|
+
});
|
|
318
306
|
});
|
|
319
307
|
}
|
|
320
308
|
else {
|
|
@@ -350,15 +338,13 @@ export default class Form extends Element {
|
|
|
350
338
|
* @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created after changing the display.
|
|
351
339
|
*/
|
|
352
340
|
setDisplay(display) {
|
|
353
|
-
if (this.display === display && this.instance) {
|
|
341
|
+
if ((this.display === display) && this.instance) {
|
|
354
342
|
return Promise.resolve(this.instance);
|
|
355
343
|
}
|
|
356
344
|
this.form.display = display;
|
|
357
345
|
this.instance.destroy();
|
|
358
346
|
this.instance = this.create(display);
|
|
359
|
-
return this.setForm(this.form)
|
|
360
|
-
this.instance.emit('setDisplay', this.form.display);
|
|
361
|
-
});
|
|
347
|
+
return this.setForm(this.form);
|
|
362
348
|
}
|
|
363
349
|
empty() {
|
|
364
350
|
if (this.element) {
|
|
@@ -420,11 +406,10 @@ export default class Form extends Element {
|
|
|
420
406
|
return Promise.reject('No DOM element for form.');
|
|
421
407
|
}
|
|
422
408
|
// Add temporary loader.
|
|
423
|
-
const template = this.options && this.options.template ? this.options.template : 'bootstrap';
|
|
409
|
+
const template = (this.options && this.options.template) ? this.options.template : 'bootstrap';
|
|
424
410
|
const loader = templates[template].loader || templates.bootstrap.loader;
|
|
425
411
|
this.setContent(this.element, loader.form);
|
|
426
|
-
return this.render()
|
|
427
|
-
.then((html) => {
|
|
412
|
+
return this.render().then(html => {
|
|
428
413
|
this.setContent(this.element, html);
|
|
429
414
|
return this.attach(this.element).then(() => this.instance);
|
|
430
415
|
})
|
|
@@ -437,7 +422,8 @@ export default class Form extends Element {
|
|
|
437
422
|
if (!this.instance) {
|
|
438
423
|
return Promise.reject('Form not ready. Use form.ready promise');
|
|
439
424
|
}
|
|
440
|
-
return Promise.resolve(this.instance.render())
|
|
425
|
+
return Promise.resolve(this.instance.render())
|
|
426
|
+
.then((param) => {
|
|
441
427
|
this.emit('render', param);
|
|
442
428
|
return param;
|
|
443
429
|
});
|
|
@@ -450,7 +436,8 @@ export default class Form extends Element {
|
|
|
450
436
|
delete this.element.component;
|
|
451
437
|
}
|
|
452
438
|
this.element = element;
|
|
453
|
-
return this.instance.attach(this.element)
|
|
439
|
+
return this.instance.attach(this.element)
|
|
440
|
+
.then((param) => {
|
|
454
441
|
this.emit('attach', param);
|
|
455
442
|
return param;
|
|
456
443
|
});
|
|
@@ -474,9 +461,6 @@ Formio.embedForm = (embed) => Form.embed(embed);
|
|
|
474
461
|
* Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example');
|
|
475
462
|
*/
|
|
476
463
|
Formio.createForm = (elementOrForm, formOrOptions, options) => {
|
|
477
|
-
return new Form(elementOrForm, formOrOptions, options).ready;
|
|
464
|
+
return (new Form(elementOrForm, formOrOptions, options)).ready;
|
|
478
465
|
};
|
|
479
466
|
Formio.Form = Form;
|
|
480
|
-
// Export a dummy for TypeScript type resolution
|
|
481
|
-
const FormOptions = undefined;
|
|
482
|
-
export { FormOptions };
|
package/lib/mjs/FormBuilder.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export default class FormBuilder extends Form {
|
|
|
44
44
|
/**
|
|
45
45
|
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
46
46
|
*/
|
|
47
|
-
editForm?:
|
|
47
|
+
editForm?: any;
|
|
48
48
|
/**
|
|
49
49
|
* - The language to load into the form builder.
|
|
50
50
|
*/
|
|
@@ -105,7 +105,7 @@ export default class FormBuilder extends Form {
|
|
|
105
105
|
/**
|
|
106
106
|
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
107
107
|
*/
|
|
108
|
-
editForm?:
|
|
108
|
+
editForm?: any;
|
|
109
109
|
/**
|
|
110
110
|
* - The language to load into the form builder.
|
|
111
111
|
*/
|
|
@@ -160,7 +160,7 @@ export default class FormBuilder extends Form {
|
|
|
160
160
|
/**
|
|
161
161
|
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
162
162
|
*/
|
|
163
|
-
editForm?:
|
|
163
|
+
editForm?: any;
|
|
164
164
|
/**
|
|
165
165
|
* - The language to load into the form builder.
|
|
166
166
|
*/
|
package/lib/mjs/FormBuilder.js
CHANGED
|
@@ -32,13 +32,14 @@ export default class FormBuilder extends Form {
|
|
|
32
32
|
constructor(element, form, options) {
|
|
33
33
|
form = form || {};
|
|
34
34
|
options = options || {};
|
|
35
|
-
super(element, form, Object.assign(options, FormBuilder.options, Formio.options && Formio.options.builder ? Formio.options.builder : {}));
|
|
35
|
+
super(element, form, Object.assign(options, FormBuilder.options, ((Formio.options && Formio.options.builder) ? Formio.options.builder : {})));
|
|
36
36
|
}
|
|
37
37
|
create(display) {
|
|
38
38
|
if (Builders.builders[display]) {
|
|
39
39
|
return new Builders.builders[display](this.element, this.options);
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
+
// eslint-disable-next-line new-cap
|
|
42
43
|
return new Builders.builders['webform'](this.element, this.options);
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -51,6 +52,6 @@ export default class FormBuilder extends Form {
|
|
|
51
52
|
* @returns {Promise} - When the form is instance is ready.
|
|
52
53
|
*/
|
|
53
54
|
Formio.builder = (element, form, options) => {
|
|
54
|
-
return new FormBuilder(element, form, options).ready;
|
|
55
|
+
return (new FormBuilder(element, form, options)).ready;
|
|
55
56
|
};
|
|
56
57
|
Formio.FormBuilder = FormBuilder;
|
package/lib/mjs/Formio.js
CHANGED
|
@@ -4,10 +4,8 @@ import CDN from './CDN';
|
|
|
4
4
|
import Providers from './providers';
|
|
5
5
|
FormioCore.cdn = new CDN();
|
|
6
6
|
FormioCore.Providers = Providers;
|
|
7
|
-
FormioCore.version = '5.
|
|
8
|
-
CDN.defaultCDN = FormioCore.version.includes('rc')
|
|
9
|
-
? 'https://cdn.test-form.io'
|
|
10
|
-
: 'https://cdn.form.io';
|
|
7
|
+
FormioCore.version = '5.2.5';
|
|
8
|
+
CDN.defaultCDN = FormioCore.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
|
|
11
9
|
const isNil = (val) => val === null || val === undefined;
|
|
12
10
|
FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
|
|
13
11
|
const requestArgs = {
|
|
@@ -15,11 +13,13 @@ FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progre
|
|
|
15
13
|
method: 'upload',
|
|
16
14
|
file: file,
|
|
17
15
|
fileName: fileName,
|
|
18
|
-
dir: dir
|
|
16
|
+
dir: dir
|
|
19
17
|
};
|
|
20
18
|
fileKey = fileKey || 'file';
|
|
21
|
-
const request = FormioCore.pluginWait('preRequest', requestArgs)
|
|
22
|
-
|
|
19
|
+
const request = FormioCore.pluginWait('preRequest', requestArgs)
|
|
20
|
+
.then(() => {
|
|
21
|
+
return FormioCore.pluginGet('fileRequest', requestArgs)
|
|
22
|
+
.then((result) => {
|
|
23
23
|
if (storage && isNil(result)) {
|
|
24
24
|
const Provider = Providers.getProvider('storage', storage);
|
|
25
25
|
if (Provider) {
|
|
@@ -30,7 +30,7 @@ FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progre
|
|
|
30
30
|
return provider.uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback, multipartOptions);
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
throw 'Storage provider not found';
|
|
33
|
+
throw ('Storage provider not found');
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
return result || { url: '' };
|
|
@@ -41,10 +41,12 @@ FormioCore.prototype.uploadFile = function (storage, file, fileName, dir, progre
|
|
|
41
41
|
FormioCore.prototype.downloadFile = function (file, options) {
|
|
42
42
|
const requestArgs = {
|
|
43
43
|
method: 'download',
|
|
44
|
-
file: file
|
|
44
|
+
file: file
|
|
45
45
|
};
|
|
46
|
-
const request = FormioCore.pluginWait('preRequest', requestArgs)
|
|
47
|
-
|
|
46
|
+
const request = FormioCore.pluginWait('preRequest', requestArgs)
|
|
47
|
+
.then(() => {
|
|
48
|
+
return FormioCore.pluginGet('fileRequest', requestArgs)
|
|
49
|
+
.then((result) => {
|
|
48
50
|
if (file.storage && isNil(result)) {
|
|
49
51
|
const Provider = Providers.getProvider('storage', file.storage);
|
|
50
52
|
if (Provider) {
|
|
@@ -52,7 +54,7 @@ FormioCore.prototype.downloadFile = function (file, options) {
|
|
|
52
54
|
return provider.downloadFile(file, options);
|
|
53
55
|
}
|
|
54
56
|
else {
|
|
55
|
-
throw 'Storage provider not found';
|
|
57
|
+
throw ('Storage provider not found');
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
return result || { url: '' };
|
|
@@ -63,10 +65,12 @@ FormioCore.prototype.downloadFile = function (file, options) {
|
|
|
63
65
|
FormioCore.prototype.deleteFile = function (file, options) {
|
|
64
66
|
const requestArgs = {
|
|
65
67
|
method: 'delete',
|
|
66
|
-
file: file
|
|
68
|
+
file: file
|
|
67
69
|
};
|
|
68
|
-
const request = FormioCore.pluginWait('preRequest', requestArgs)
|
|
69
|
-
|
|
70
|
+
const request = FormioCore.pluginWait('preRequest', requestArgs)
|
|
71
|
+
.then(() => {
|
|
72
|
+
return FormioCore.pluginGet('fileRequest', requestArgs)
|
|
73
|
+
.then((result) => {
|
|
70
74
|
if (file.storage && isNil(result)) {
|
|
71
75
|
const Provider = Providers.getProvider('storage', file.storage);
|
|
72
76
|
if (Provider) {
|
|
@@ -74,7 +78,7 @@ FormioCore.prototype.deleteFile = function (file, options) {
|
|
|
74
78
|
return provider.deleteFile(file, options);
|
|
75
79
|
}
|
|
76
80
|
else {
|
|
77
|
-
throw 'Storage provider not found';
|
|
81
|
+
throw ('Storage provider not found');
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
return result || { url: '' };
|
|
@@ -83,14 +87,7 @@ FormioCore.prototype.deleteFile = function (file, options) {
|
|
|
83
87
|
return FormioCore.pluginAlter('wrapFileRequestPromise', request, requestArgs);
|
|
84
88
|
};
|
|
85
89
|
// Esnure we proxy the following methods to the FormioEmbed class.
|
|
86
|
-
[
|
|
87
|
-
'setBaseUrl',
|
|
88
|
-
'setApiUrl',
|
|
89
|
-
'setAppUrl',
|
|
90
|
-
'setProjectUrl',
|
|
91
|
-
'setPathType',
|
|
92
|
-
'setLicense',
|
|
93
|
-
].forEach((fn) => {
|
|
90
|
+
['setBaseUrl', 'setApiUrl', 'setAppUrl', 'setProjectUrl', 'setPathType', 'setLicense'].forEach((fn) => {
|
|
94
91
|
const baseFn = FormioCore[fn];
|
|
95
92
|
FormioCore[fn] = function (arg) {
|
|
96
93
|
const retVal = FormioEmbed[fn](arg, true);
|
|
@@ -115,8 +112,8 @@ FormioCore.addToGlobal = (global) => {
|
|
|
115
112
|
global.Formio = FormioCore;
|
|
116
113
|
}
|
|
117
114
|
};
|
|
118
|
-
if (typeof
|
|
119
|
-
FormioCore.addToGlobal(
|
|
115
|
+
if (typeof global !== 'undefined') {
|
|
116
|
+
FormioCore.addToGlobal(global);
|
|
120
117
|
}
|
|
121
118
|
if (typeof window !== 'undefined') {
|
|
122
119
|
FormioCore.addToGlobal(window);
|
package/lib/mjs/InlineEmbed.js
CHANGED
|
@@ -10,7 +10,7 @@ export function embed(config = {}) {
|
|
|
10
10
|
let i = scripts.length;
|
|
11
11
|
const scriptName = config.scriptName || 'formio.embed.';
|
|
12
12
|
while (i--) {
|
|
13
|
-
if (scripts[i].src && scripts[i].src.indexOf(scriptName) !== -1) {
|
|
13
|
+
if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
|
|
14
14
|
thisScript = scripts[i];
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
@@ -18,19 +18,13 @@ export function embed(config = {}) {
|
|
|
18
18
|
if (thisScript) {
|
|
19
19
|
const query = {};
|
|
20
20
|
const queryString = thisScript.src.replace(/^[^?]+\??/, '');
|
|
21
|
-
queryString
|
|
22
|
-
.replace(/\?/g, '&')
|
|
23
|
-
.split('&')
|
|
24
|
-
.forEach((item) => {
|
|
21
|
+
queryString.replace(/\?/g, '&').split('&').forEach((item) => {
|
|
25
22
|
query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
|
|
26
23
|
});
|
|
27
24
|
let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
|
|
28
25
|
scriptSrc.pop();
|
|
29
26
|
let cdnSrc = '';
|
|
30
|
-
if ([
|
|
31
|
-
'js',
|
|
32
|
-
'offline',
|
|
33
|
-
].includes(scriptSrc[scriptSrc.length - 1])) {
|
|
27
|
+
if (['js', 'offline'].includes(scriptSrc[scriptSrc.length - 1])) {
|
|
34
28
|
scriptSrc.pop();
|
|
35
29
|
scriptSrc = cdnSrc = scriptSrc.join('/');
|
|
36
30
|
scriptSrc += '/js';
|
|
@@ -38,42 +32,42 @@ export function embed(config = {}) {
|
|
|
38
32
|
else {
|
|
39
33
|
scriptSrc = scriptSrc.join('/');
|
|
40
34
|
}
|
|
41
|
-
const debug = query.debug === 'true' || query.debug === '1';
|
|
35
|
+
const debug = (query.debug === 'true' || query.debug === '1');
|
|
42
36
|
const renderer = debug ? 'formio.form' : 'formio.form.min';
|
|
43
37
|
Formio.config = Object.assign({
|
|
44
|
-
script: query.script || `${scriptSrc}/${renderer}.js
|
|
45
|
-
style: query.styles || `${scriptSrc}/${renderer}.css
|
|
38
|
+
script: query.script || (`${scriptSrc}/${renderer}.js`),
|
|
39
|
+
style: query.styles || (`${scriptSrc}/${renderer}.css`),
|
|
46
40
|
cdn: query.cdn || cdnSrc,
|
|
47
|
-
class: query.class || 'formio-form-wrapper',
|
|
41
|
+
class: (query.class || 'formio-form-wrapper'),
|
|
48
42
|
src: query.src,
|
|
49
43
|
form: null,
|
|
50
44
|
submission: null,
|
|
51
45
|
project: query.project,
|
|
52
46
|
base: query.base || 'https://api.form.io',
|
|
53
47
|
submit: query.submit,
|
|
54
|
-
includeLibs: query.libs === 'true' || query.libs === '1',
|
|
55
|
-
noshadow: query.shadow === 'false' || query.shadow === '0',
|
|
48
|
+
includeLibs: (query.libs === 'true' || query.libs === '1'),
|
|
49
|
+
noshadow: (query.shadow === 'false' || query.shadow === '0'),
|
|
56
50
|
template: query.template || 'bootstrap',
|
|
57
51
|
debug: debug,
|
|
58
52
|
config: {},
|
|
59
|
-
redirect: query.return || query.redirect,
|
|
60
|
-
embedCSS: `${scriptSrc}/formio.embed.css
|
|
53
|
+
redirect: (query.return || query.redirect),
|
|
54
|
+
embedCSS: (`${scriptSrc}/formio.embed.css`),
|
|
61
55
|
success: query.success || 'Thank you for your submission!',
|
|
62
56
|
before: null,
|
|
63
|
-
after: null
|
|
57
|
+
after: null
|
|
64
58
|
}, config);
|
|
65
59
|
if (Formio.config.alter) {
|
|
66
60
|
Formio.config.alter(Formio.config);
|
|
67
61
|
}
|
|
68
|
-
const form = Formio.config.form || Formio.config.src;
|
|
62
|
+
const form = (Formio.config.form || Formio.config.src);
|
|
69
63
|
if (form) {
|
|
70
64
|
Formio.debug('Embedding Configuration', config);
|
|
71
65
|
// The id for this embedded form.
|
|
72
66
|
Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
|
|
73
67
|
Formio.debug('Creating form element');
|
|
74
68
|
const element = Formio.createElement('div', {
|
|
75
|
-
id: Formio.config.id,
|
|
76
|
-
class: Formio.config.class
|
|
69
|
+
'id': Formio.config.id,
|
|
70
|
+
class: Formio.config.class
|
|
77
71
|
});
|
|
78
72
|
// insertAfter doesn't exist, but effect is identical.
|
|
79
73
|
thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
|
|
@@ -89,7 +83,7 @@ export function embed(config = {}) {
|
|
|
89
83
|
if (Formio.config.submit) {
|
|
90
84
|
Formio.debug(`Sending submission to ${Formio.config.submit}`);
|
|
91
85
|
const headers = {
|
|
92
|
-
'content-type': 'application/json'
|
|
86
|
+
'content-type': 'application/json'
|
|
93
87
|
};
|
|
94
88
|
const token = Formio.FormioClass.getToken();
|
|
95
89
|
if (token) {
|
|
@@ -101,7 +95,7 @@ export function embed(config = {}) {
|
|
|
101
95
|
method: 'POST',
|
|
102
96
|
mode: 'cors',
|
|
103
97
|
})
|
|
104
|
-
.then(
|
|
98
|
+
.then(resp => resp.json())
|
|
105
99
|
.then((submission) => {
|
|
106
100
|
Formio.submitDone(instance, submission);
|
|
107
101
|
});
|