@formio/js 5.0.0-dev.5633.8d2b30d → 5.0.0-dev.5633.fde3bc9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +47 -2
- package/dist/formio.builder.css +8 -8
- 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 +8 -8
- package/dist/formio.form.js +615 -1196
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -5
- package/dist/formio.full.css +8 -8
- package/dist/formio.full.js +659 -920
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -5
- package/dist/formio.js +18 -18
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1829 -492
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +10 -4
- package/embed.d.ts +1 -0
- package/form.d.ts +1 -0
- package/lib/cjs/CDN.d.ts +1 -0
- package/lib/cjs/CDN.js +6 -3
- package/lib/cjs/Element.d.ts +86 -96
- package/lib/cjs/Element.js +68 -78
- package/lib/cjs/Embed.d.ts +1 -1
- package/lib/cjs/Embed.js +52 -12
- package/lib/cjs/Form.d.ts +365 -36
- package/lib/cjs/Form.js +50 -64
- package/lib/cjs/FormBuilder.d.ts +187 -2
- package/lib/cjs/FormBuilder.js +30 -8
- package/lib/cjs/InlineEmbed.d.ts +7 -0
- package/lib/cjs/InlineEmbed.js +116 -0
- package/lib/cjs/PDF.d.ts +11 -13
- package/lib/cjs/PDF.js +6 -8
- package/lib/cjs/Webform.d.ts +183 -143
- package/lib/cjs/Webform.js +310 -298
- package/lib/cjs/WebformBuilder.d.ts +16 -14
- package/lib/cjs/WebformBuilder.js +11 -10
- package/lib/cjs/Wizard.d.ts +31 -21
- package/lib/cjs/Wizard.js +43 -20
- package/lib/cjs/WizardBuilder.d.ts +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
- package/lib/cjs/components/Components.d.ts +4 -4
- package/lib/cjs/components/Components.js +3 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +507 -276
- package/lib/cjs/components/_classes/component/Component.form.d.ts +6 -3
- package/lib/cjs/components/_classes/component/Component.form.js +5 -0
- package/lib/cjs/components/_classes/component/Component.js +438 -196
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +0 -8
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +2 -2
- package/lib/cjs/components/_classes/component/editForm/utils.js +2 -2
- package/lib/cjs/components/_classes/component/fixtures/comp6.d.ts +77 -0
- package/lib/cjs/components/_classes/component/fixtures/comp6.js +59 -0
- package/lib/cjs/components/_classes/component/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/_classes/component/fixtures/index.js +3 -1
- package/lib/cjs/components/_classes/field/Field.d.ts +11 -2
- package/lib/cjs/components/_classes/field/Field.js +13 -1
- package/lib/cjs/components/_classes/input/Input.d.ts +4 -3
- package/lib/cjs/components/_classes/input/Input.js +8 -6
- package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +6 -3
- package/lib/cjs/components/_classes/list/ListComponent.form.js +5 -0
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +37 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +163 -67
- package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +5 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +175 -54
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
- package/lib/cjs/components/address/Address.d.ts +4 -2
- package/lib/cjs/components/address/Address.form.d.ts +6 -3
- package/lib/cjs/components/address/Address.form.js +5 -0
- package/lib/cjs/components/button/Button.d.ts +3 -12
- package/lib/cjs/components/button/Button.form.d.ts +6 -3
- package/lib/cjs/components/button/Button.form.js +5 -0
- package/lib/cjs/components/button/Button.js +5 -0
- package/lib/cjs/components/checkbox/Checkbox.d.ts +4 -27
- package/lib/cjs/components/checkbox/Checkbox.form.d.ts +6 -3
- package/lib/cjs/components/checkbox/Checkbox.form.js +5 -0
- package/lib/cjs/components/columns/Columns.d.ts +3 -2
- package/lib/cjs/components/columns/Columns.form.d.ts +6 -3
- package/lib/cjs/components/columns/Columns.form.js +5 -0
- package/lib/cjs/components/columns/Columns.js +1 -1
- package/lib/cjs/components/container/Container.form.d.ts +6 -3
- package/lib/cjs/components/container/Container.form.js +5 -0
- package/lib/cjs/components/content/Content.d.ts +2 -1
- package/lib/cjs/components/content/Content.form.d.ts +6 -3
- package/lib/cjs/components/content/Content.form.js +5 -0
- package/lib/cjs/components/currency/Currency.form.d.ts +6 -3
- package/lib/cjs/components/currency/Currency.form.js +5 -0
- package/lib/cjs/components/currency/Currency.js +1 -2
- package/lib/cjs/components/datagrid/DataGrid.d.ts +8 -7
- package/lib/cjs/components/datagrid/DataGrid.form.d.ts +6 -3
- package/lib/cjs/components/datagrid/DataGrid.form.js +5 -0
- package/lib/cjs/components/datagrid/DataGrid.js +5 -5
- package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
- package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.js +36 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/cjs/components/datamap/DataMap.form.d.ts +6 -3
- package/lib/cjs/components/datamap/DataMap.form.js +5 -0
- package/lib/cjs/components/datetime/DateTime.d.ts +0 -14
- package/lib/cjs/components/datetime/DateTime.form.d.ts +6 -3
- package/lib/cjs/components/datetime/DateTime.form.js +5 -0
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
- package/lib/cjs/components/day/Day.d.ts +23 -49
- package/lib/cjs/components/day/Day.form.d.ts +6 -3
- package/lib/cjs/components/day/Day.form.js +5 -0
- package/lib/cjs/components/day/Day.js +16 -21
- package/lib/cjs/components/day/fixtures/comp7.d.ts +109 -0
- package/lib/cjs/components/day/fixtures/comp7.js +109 -0
- package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/day/fixtures/index.js +3 -1
- package/lib/cjs/components/editgrid/EditGrid.d.ts +7 -3
- package/lib/cjs/components/editgrid/EditGrid.form.d.ts +6 -3
- package/lib/cjs/components/editgrid/EditGrid.form.js +5 -0
- package/lib/cjs/components/editgrid/EditGrid.js +3 -3
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -5
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +6 -9
- package/lib/cjs/components/email/Email.form.d.ts +6 -3
- package/lib/cjs/components/email/Email.form.js +5 -0
- package/lib/cjs/components/fieldset/Fieldset.form.d.ts +6 -3
- package/lib/cjs/components/fieldset/Fieldset.form.js +5 -0
- package/lib/cjs/components/file/File.d.ts +9 -22
- package/lib/cjs/components/file/File.form.d.ts +6 -3
- package/lib/cjs/components/file/File.form.js +5 -0
- package/lib/cjs/components/file/File.js +1 -2
- package/lib/cjs/components/form/Form.d.ts +34 -24
- package/lib/cjs/components/form/Form.form.d.ts +6 -3
- package/lib/cjs/components/form/Form.form.js +5 -0
- package/lib/cjs/components/form/Form.js +15 -13
- package/lib/cjs/components/hidden/Hidden.d.ts +1 -11
- package/lib/cjs/components/hidden/Hidden.form.d.ts +6 -3
- package/lib/cjs/components/hidden/Hidden.form.js +5 -0
- package/lib/cjs/components/hidden/Hidden.js +1 -2
- package/lib/cjs/components/html/HTML.d.ts +2 -1
- package/lib/cjs/components/html/HTML.form.d.ts +6 -3
- package/lib/cjs/components/html/HTML.form.js +5 -0
- package/lib/cjs/components/number/Number.d.ts +3 -17
- package/lib/cjs/components/number/Number.form.d.ts +6 -3
- package/lib/cjs/components/number/Number.form.js +5 -0
- package/lib/cjs/components/number/Number.js +1 -2
- package/lib/cjs/components/panel/Panel.form.d.ts +6 -3
- package/lib/cjs/components/panel/Panel.form.js +5 -0
- package/lib/cjs/components/panel/Panel.js +0 -1
- package/lib/cjs/components/password/Password.form.d.ts +6 -3
- package/lib/cjs/components/password/Password.form.js +5 -0
- package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +5 -0
- package/lib/cjs/components/radio/Radio.d.ts +3 -26
- package/lib/cjs/components/radio/Radio.form.d.ts +6 -3
- package/lib/cjs/components/radio/Radio.form.js +5 -0
- package/lib/cjs/components/radio/Radio.js +6 -6
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +5 -0
- package/lib/cjs/components/select/Select.d.ts +16 -39
- package/lib/cjs/components/select/Select.form.d.ts +6 -3
- package/lib/cjs/components/select/Select.form.js +5 -0
- package/lib/cjs/components/select/Select.js +13 -16
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +2 -17
- package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
- package/lib/cjs/components/selectboxes/SelectBoxes.form.js +5 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -9
- package/lib/cjs/components/signature/Signature.d.ts +0 -14
- package/lib/cjs/components/signature/Signature.form.d.ts +6 -3
- package/lib/cjs/components/signature/Signature.form.js +5 -0
- package/lib/cjs/components/survey/Survey.d.ts +3 -15
- package/lib/cjs/components/survey/Survey.form.d.ts +6 -3
- package/lib/cjs/components/survey/Survey.form.js +5 -0
- package/lib/cjs/components/table/Table.d.ts +2 -1
- package/lib/cjs/components/table/Table.form.d.ts +6 -3
- package/lib/cjs/components/table/Table.form.js +5 -0
- package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/cjs/components/tabs/Tabs.form.d.ts +6 -3
- package/lib/cjs/components/tabs/Tabs.form.js +5 -0
- package/lib/cjs/components/tabs/Tabs.js +1 -2
- package/lib/cjs/components/tags/Tags.d.ts +0 -14
- package/lib/cjs/components/tags/Tags.form.d.ts +6 -3
- package/lib/cjs/components/tags/Tags.form.js +5 -0
- package/lib/cjs/components/textarea/TextArea.d.ts +4 -9
- package/lib/cjs/components/textarea/TextArea.form.d.ts +6 -3
- package/lib/cjs/components/textarea/TextArea.form.js +5 -0
- package/lib/cjs/components/textarea/TextArea.js +2 -2
- package/lib/cjs/components/textfield/TextField.d.ts +14 -30
- package/lib/cjs/components/textfield/TextField.form.d.ts +6 -3
- package/lib/cjs/components/textfield/TextField.form.js +5 -0
- package/lib/cjs/components/textfield/TextField.js +16 -17
- package/lib/cjs/components/time/Time.form.d.ts +6 -3
- package/lib/cjs/components/time/Time.form.js +5 -0
- package/lib/cjs/components/unknown/Unknown.form.d.ts +5 -34
- package/lib/cjs/components/unknown/Unknown.form.js +4 -0
- package/lib/cjs/components/url/Url.form.d.ts +6 -3
- package/lib/cjs/components/url/Url.form.js +5 -0
- package/lib/cjs/components/well/Well.form.d.ts +6 -3
- package/lib/cjs/components/well/Well.form.js +5 -0
- package/lib/cjs/formio.embed.d.ts +1 -2
- package/lib/cjs/formio.embed.js +2 -100
- package/lib/cjs/formio.form.d.ts +11 -4
- package/lib/cjs/formio.form.js +13 -5
- package/lib/cjs/providers/Providers.d.ts +36 -5
- package/lib/cjs/providers/Providers.js +29 -0
- package/lib/cjs/providers/address/AddressProvider.d.ts +131 -12
- package/lib/cjs/providers/address/AddressProvider.js +88 -2
- package/lib/cjs/providers/address/AzureAddressProvider.d.ts +48 -1
- package/lib/cjs/providers/address/AzureAddressProvider.js +37 -0
- package/lib/cjs/providers/address/CustomAddressProvider.d.ts +27 -4
- package/lib/cjs/providers/address/CustomAddressProvider.js +34 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +130 -6
- package/lib/cjs/providers/address/GoogleAddressProvider.js +73 -1
- package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +32 -7
- package/lib/cjs/providers/address/NominatimAddressProvider.js +33 -0
- package/lib/cjs/providers/address/index.d.ts +3 -1
- package/lib/cjs/providers/processor/fileProcessor.d.ts +7 -1
- package/lib/cjs/providers/processor/fileProcessor.js +6 -0
- package/lib/cjs/providers/storage/azure.d.ts +6 -13
- package/lib/cjs/providers/storage/azure.js +5 -0
- package/lib/cjs/providers/storage/base64.d.ts +5 -6
- package/lib/cjs/providers/storage/base64.js +4 -0
- package/lib/cjs/providers/storage/dropbox.d.ts +6 -4
- package/lib/cjs/providers/storage/dropbox.js +5 -0
- package/lib/cjs/providers/storage/googleDrive.d.ts +7 -5
- package/lib/cjs/providers/storage/googleDrive.js +6 -0
- package/lib/cjs/providers/storage/indexeddb.d.ts +5 -7
- package/lib/cjs/providers/storage/indexeddb.js +4 -0
- package/lib/cjs/providers/storage/s3.d.ts +6 -20
- package/lib/cjs/providers/storage/s3.js +5 -0
- package/lib/cjs/providers/storage/url.d.ts +6 -7
- package/lib/cjs/providers/storage/url.js +10 -0
- package/lib/cjs/providers/storage/util.d.ts +24 -1
- package/lib/cjs/providers/storage/util.js +18 -0
- package/lib/cjs/templates/Templates.d.ts +1 -0
- package/lib/cjs/translations/en.d.ts +2 -0
- package/lib/cjs/translations/en.js +3 -1
- package/lib/cjs/utils/ChoicesWrapper.d.ts +1 -1
- package/lib/cjs/utils/ChoicesWrapper.js +13 -2
- package/lib/cjs/utils/Evaluator.d.ts +6 -3
- package/lib/cjs/utils/Evaluator.js +11 -20
- package/lib/cjs/utils/builder.d.ts +9 -7
- package/lib/cjs/utils/builder.js +10 -5
- package/lib/cjs/utils/calendarUtils.d.ts +7 -13
- package/lib/cjs/utils/calendarUtils.js +10 -17
- package/lib/cjs/utils/formUtils.d.ts +43 -171
- package/lib/cjs/utils/formUtils.js +38 -569
- package/lib/cjs/utils/utils.d.ts +367 -221
- package/lib/cjs/utils/utils.js +335 -228
- package/lib/cjs/widgets/CalendarWidget.d.ts +9 -10
- package/lib/cjs/widgets/CalendarWidget.js +9 -11
- package/lib/mjs/CDN.d.ts +1 -0
- package/lib/mjs/CDN.js +6 -3
- package/lib/mjs/Element.d.ts +86 -96
- package/lib/mjs/Element.js +68 -78
- package/lib/mjs/Embed.d.ts +1 -1
- package/lib/mjs/Embed.js +52 -12
- package/lib/mjs/Form.d.ts +365 -36
- package/lib/mjs/Form.js +140 -57
- package/lib/mjs/FormBuilder.d.ts +187 -2
- package/lib/mjs/FormBuilder.js +32 -8
- package/lib/mjs/InlineEmbed.d.ts +7 -0
- package/lib/mjs/InlineEmbed.js +112 -0
- package/lib/mjs/PDF.d.ts +11 -13
- package/lib/mjs/PDF.js +6 -8
- package/lib/mjs/Webform.d.ts +183 -143
- package/lib/mjs/Webform.js +322 -310
- package/lib/mjs/WebformBuilder.d.ts +16 -14
- package/lib/mjs/WebformBuilder.js +11 -10
- package/lib/mjs/Wizard.d.ts +31 -21
- package/lib/mjs/Wizard.js +42 -19
- package/lib/mjs/WizardBuilder.d.ts +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
- package/lib/mjs/components/Components.d.ts +4 -4
- package/lib/mjs/components/Components.js +3 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +507 -276
- package/lib/mjs/components/_classes/component/Component.form.d.ts +6 -3
- package/lib/mjs/components/_classes/component/Component.form.js +5 -0
- package/lib/mjs/components/_classes/component/Component.js +438 -196
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +0 -8
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/mjs/components/_classes/component/fixtures/comp6.d.ts +77 -0
- package/lib/mjs/components/_classes/component/fixtures/comp6.js +57 -0
- package/lib/mjs/components/_classes/component/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/_classes/component/fixtures/index.js +2 -1
- package/lib/mjs/components/_classes/field/Field.d.ts +11 -2
- package/lib/mjs/components/_classes/field/Field.js +13 -1
- package/lib/mjs/components/_classes/input/Input.d.ts +4 -3
- package/lib/mjs/components/_classes/input/Input.js +8 -6
- package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +6 -3
- package/lib/mjs/components/_classes/list/ListComponent.form.js +5 -0
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +37 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +163 -67
- package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +5 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +175 -54
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
- package/lib/mjs/components/address/Address.d.ts +4 -2
- package/lib/mjs/components/address/Address.form.d.ts +6 -3
- package/lib/mjs/components/address/Address.form.js +5 -0
- package/lib/mjs/components/button/Button.d.ts +3 -12
- package/lib/mjs/components/button/Button.form.d.ts +6 -3
- package/lib/mjs/components/button/Button.form.js +5 -0
- package/lib/mjs/components/button/Button.js +5 -0
- package/lib/mjs/components/checkbox/Checkbox.d.ts +4 -27
- package/lib/mjs/components/checkbox/Checkbox.form.d.ts +6 -3
- package/lib/mjs/components/checkbox/Checkbox.form.js +5 -0
- package/lib/mjs/components/columns/Columns.d.ts +3 -2
- package/lib/mjs/components/columns/Columns.form.d.ts +6 -3
- package/lib/mjs/components/columns/Columns.form.js +5 -0
- package/lib/mjs/components/columns/Columns.js +1 -1
- package/lib/mjs/components/container/Container.form.d.ts +6 -3
- package/lib/mjs/components/container/Container.form.js +5 -0
- package/lib/mjs/components/content/Content.d.ts +2 -1
- package/lib/mjs/components/content/Content.form.d.ts +6 -3
- package/lib/mjs/components/content/Content.form.js +5 -0
- package/lib/mjs/components/currency/Currency.form.d.ts +6 -3
- package/lib/mjs/components/currency/Currency.form.js +5 -0
- package/lib/mjs/components/currency/Currency.js +1 -2
- package/lib/mjs/components/datagrid/DataGrid.d.ts +8 -7
- package/lib/mjs/components/datagrid/DataGrid.form.d.ts +6 -3
- package/lib/mjs/components/datagrid/DataGrid.form.js +5 -0
- package/lib/mjs/components/datagrid/DataGrid.js +5 -5
- package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
- package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.js +34 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/mjs/components/datamap/DataMap.form.d.ts +6 -3
- package/lib/mjs/components/datamap/DataMap.form.js +5 -0
- package/lib/mjs/components/datetime/DateTime.d.ts +0 -14
- package/lib/mjs/components/datetime/DateTime.form.d.ts +6 -3
- package/lib/mjs/components/datetime/DateTime.form.js +5 -0
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +23 -49
- package/lib/mjs/components/day/Day.form.d.ts +6 -3
- package/lib/mjs/components/day/Day.form.js +5 -0
- package/lib/mjs/components/day/Day.js +16 -21
- package/lib/mjs/components/day/fixtures/comp7.d.ts +109 -0
- package/lib/mjs/components/day/fixtures/comp7.js +107 -0
- package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/day/fixtures/index.js +2 -1
- package/lib/mjs/components/editgrid/EditGrid.d.ts +7 -3
- package/lib/mjs/components/editgrid/EditGrid.form.d.ts +6 -3
- package/lib/mjs/components/editgrid/EditGrid.form.js +5 -0
- package/lib/mjs/components/editgrid/EditGrid.js +3 -3
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
- package/lib/mjs/components/email/Email.form.d.ts +6 -3
- package/lib/mjs/components/email/Email.form.js +5 -0
- package/lib/mjs/components/fieldset/Fieldset.form.d.ts +6 -3
- package/lib/mjs/components/fieldset/Fieldset.form.js +5 -0
- package/lib/mjs/components/file/File.d.ts +9 -22
- package/lib/mjs/components/file/File.form.d.ts +6 -3
- package/lib/mjs/components/file/File.form.js +5 -0
- package/lib/mjs/components/file/File.js +1 -2
- package/lib/mjs/components/form/Form.d.ts +34 -24
- package/lib/mjs/components/form/Form.form.d.ts +6 -3
- package/lib/mjs/components/form/Form.form.js +5 -0
- package/lib/mjs/components/form/Form.js +15 -13
- package/lib/mjs/components/hidden/Hidden.d.ts +1 -11
- package/lib/mjs/components/hidden/Hidden.form.d.ts +6 -3
- package/lib/mjs/components/hidden/Hidden.form.js +5 -0
- package/lib/mjs/components/hidden/Hidden.js +1 -2
- package/lib/mjs/components/html/HTML.d.ts +2 -1
- package/lib/mjs/components/html/HTML.form.d.ts +6 -3
- package/lib/mjs/components/html/HTML.form.js +5 -0
- package/lib/mjs/components/number/Number.d.ts +3 -17
- package/lib/mjs/components/number/Number.form.d.ts +6 -3
- package/lib/mjs/components/number/Number.form.js +5 -0
- package/lib/mjs/components/number/Number.js +1 -2
- package/lib/mjs/components/panel/Panel.form.d.ts +6 -3
- package/lib/mjs/components/panel/Panel.form.js +5 -0
- package/lib/mjs/components/panel/Panel.js +0 -1
- package/lib/mjs/components/password/Password.form.d.ts +6 -3
- package/lib/mjs/components/password/Password.form.js +5 -0
- package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +5 -0
- package/lib/mjs/components/radio/Radio.d.ts +3 -26
- package/lib/mjs/components/radio/Radio.form.d.ts +6 -3
- package/lib/mjs/components/radio/Radio.form.js +5 -0
- package/lib/mjs/components/radio/Radio.js +6 -6
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +5 -0
- package/lib/mjs/components/select/Select.d.ts +16 -39
- package/lib/mjs/components/select/Select.form.d.ts +6 -3
- package/lib/mjs/components/select/Select.form.js +5 -0
- package/lib/mjs/components/select/Select.js +14 -17
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +2 -17
- package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
- package/lib/mjs/components/selectboxes/SelectBoxes.form.js +5 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -9
- package/lib/mjs/components/signature/Signature.d.ts +0 -14
- package/lib/mjs/components/signature/Signature.form.d.ts +6 -3
- package/lib/mjs/components/signature/Signature.form.js +5 -0
- package/lib/mjs/components/survey/Survey.d.ts +3 -15
- package/lib/mjs/components/survey/Survey.form.d.ts +6 -3
- package/lib/mjs/components/survey/Survey.form.js +5 -0
- package/lib/mjs/components/table/Table.d.ts +2 -1
- package/lib/mjs/components/table/Table.form.d.ts +6 -3
- package/lib/mjs/components/table/Table.form.js +5 -0
- package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/mjs/components/tabs/Tabs.form.d.ts +6 -3
- package/lib/mjs/components/tabs/Tabs.form.js +5 -0
- package/lib/mjs/components/tabs/Tabs.js +1 -2
- package/lib/mjs/components/tags/Tags.d.ts +0 -14
- package/lib/mjs/components/tags/Tags.form.d.ts +6 -3
- package/lib/mjs/components/tags/Tags.form.js +5 -0
- package/lib/mjs/components/textarea/TextArea.d.ts +4 -9
- package/lib/mjs/components/textarea/TextArea.form.d.ts +6 -3
- package/lib/mjs/components/textarea/TextArea.form.js +5 -0
- package/lib/mjs/components/textarea/TextArea.js +2 -2
- package/lib/mjs/components/textfield/TextField.d.ts +14 -30
- package/lib/mjs/components/textfield/TextField.form.d.ts +6 -3
- package/lib/mjs/components/textfield/TextField.form.js +5 -0
- package/lib/mjs/components/textfield/TextField.js +16 -17
- package/lib/mjs/components/time/Time.form.d.ts +6 -3
- package/lib/mjs/components/time/Time.form.js +5 -0
- package/lib/mjs/components/unknown/Unknown.form.d.ts +5 -34
- package/lib/mjs/components/unknown/Unknown.form.js +4 -0
- package/lib/mjs/components/url/Url.form.d.ts +6 -3
- package/lib/mjs/components/url/Url.form.js +5 -0
- package/lib/mjs/components/well/Well.form.d.ts +6 -3
- package/lib/mjs/components/well/Well.form.js +5 -0
- package/lib/mjs/formio.embed.d.ts +1 -2
- package/lib/mjs/formio.embed.js +2 -99
- package/lib/mjs/formio.form.d.ts +11 -4
- package/lib/mjs/formio.form.js +10 -3
- package/lib/mjs/providers/Providers.d.ts +36 -5
- package/lib/mjs/providers/Providers.js +29 -0
- package/lib/mjs/providers/address/AddressProvider.d.ts +131 -12
- package/lib/mjs/providers/address/AddressProvider.js +88 -2
- package/lib/mjs/providers/address/AzureAddressProvider.d.ts +48 -1
- package/lib/mjs/providers/address/AzureAddressProvider.js +37 -0
- package/lib/mjs/providers/address/CustomAddressProvider.d.ts +27 -4
- package/lib/mjs/providers/address/CustomAddressProvider.js +34 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +130 -6
- package/lib/mjs/providers/address/GoogleAddressProvider.js +73 -1
- package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +32 -7
- package/lib/mjs/providers/address/NominatimAddressProvider.js +33 -0
- package/lib/mjs/providers/address/index.d.ts +3 -1
- package/lib/mjs/providers/processor/fileProcessor.d.ts +7 -1
- package/lib/mjs/providers/processor/fileProcessor.js +6 -0
- package/lib/mjs/providers/storage/azure.d.ts +6 -13
- package/lib/mjs/providers/storage/azure.js +5 -0
- package/lib/mjs/providers/storage/base64.d.ts +5 -6
- package/lib/mjs/providers/storage/base64.js +4 -0
- package/lib/mjs/providers/storage/dropbox.d.ts +6 -4
- package/lib/mjs/providers/storage/dropbox.js +5 -0
- package/lib/mjs/providers/storage/googleDrive.d.ts +7 -5
- package/lib/mjs/providers/storage/googleDrive.js +6 -0
- package/lib/mjs/providers/storage/indexeddb.d.ts +5 -7
- package/lib/mjs/providers/storage/indexeddb.js +4 -0
- package/lib/mjs/providers/storage/s3.d.ts +6 -20
- package/lib/mjs/providers/storage/s3.js +5 -0
- package/lib/mjs/providers/storage/url.d.ts +6 -7
- package/lib/mjs/providers/storage/url.js +10 -0
- package/lib/mjs/providers/storage/util.d.ts +24 -1
- package/lib/mjs/providers/storage/util.js +18 -0
- package/lib/mjs/templates/Templates.d.ts +1 -0
- package/lib/mjs/translations/en.d.ts +2 -0
- package/lib/mjs/translations/en.js +3 -1
- package/lib/mjs/utils/ChoicesWrapper.d.ts +1 -1
- package/lib/mjs/utils/ChoicesWrapper.js +13 -2
- package/lib/mjs/utils/Evaluator.d.ts +6 -3
- package/lib/mjs/utils/Evaluator.js +9 -20
- package/lib/mjs/utils/builder.d.ts +9 -7
- package/lib/mjs/utils/builder.js +10 -5
- package/lib/mjs/utils/calendarUtils.d.ts +7 -13
- package/lib/mjs/utils/calendarUtils.js +10 -17
- package/lib/mjs/utils/formUtils.d.ts +43 -171
- package/lib/mjs/utils/formUtils.js +6 -554
- package/lib/mjs/utils/utils.d.ts +367 -221
- package/lib/mjs/utils/utils.js +329 -222
- package/lib/mjs/widgets/CalendarWidget.d.ts +9 -10
- package/lib/mjs/widgets/CalendarWidget.js +9 -11
- package/package.json +22 -22
- package/sdk.d.ts +1 -0
- package/utils.d.ts +1 -0
package/lib/mjs/Form.js
CHANGED
|
@@ -4,28 +4,119 @@ import Displays from './displays';
|
|
|
4
4
|
import templates from './templates';
|
|
5
5
|
import * as FormioUtils from './utils/utils';
|
|
6
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
|
+
*/
|
|
7
90
|
/**
|
|
8
91
|
* Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
|
|
9
|
-
*
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {Object} options - The options to create a new form instance.
|
|
13
|
-
* @param {boolean} options.readOnly - Set this form to readOnly
|
|
14
|
-
* @param {boolean} options.noAlerts - Set to true to disable the alerts dialog.
|
|
15
|
-
* @param {boolean} options.i18n - The translation file for this rendering. @see https://github.com/formio/formio.js/blob/master/i18n.js
|
|
16
|
-
* @param {boolean} options.template - Provides a way to inject custom logic into the creation of every element rendered within the form.
|
|
17
|
-
*
|
|
92
|
+
* @param {object} elementOrForm - The DOM element you wish to render this form within, or the form definition.
|
|
93
|
+
* @param {object | string | FormOptions} formOrOptions - A Form JSON schema, the URL of a hosted form, or the form options.
|
|
94
|
+
* @param {FormOptions} [options] - The options to create a new form instance.
|
|
18
95
|
* @example
|
|
19
96
|
* import Form from '@formio/js/Form';
|
|
20
97
|
* const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
|
|
21
98
|
* form.build();
|
|
22
99
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
100
|
+
/**
|
|
101
|
+
* @type {FormOptions} - the options for this Form.
|
|
102
|
+
*/
|
|
103
|
+
options;
|
|
104
|
+
constructor(elementOrForm, formOrOptions, options = {}) {
|
|
105
|
+
let element, form, formOptions;
|
|
106
|
+
if (elementOrForm instanceof HTMLElement) {
|
|
107
|
+
element = elementOrForm;
|
|
108
|
+
form = formOrOptions;
|
|
109
|
+
formOptions = options;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
element = null;
|
|
113
|
+
form = elementOrForm;
|
|
114
|
+
formOptions = formOrOptions || {};
|
|
115
|
+
}
|
|
25
116
|
if (Formio.options && Formio.options.form) {
|
|
26
|
-
|
|
117
|
+
formOptions = Object.assign(formOptions, Formio.options.form);
|
|
27
118
|
}
|
|
28
|
-
super(
|
|
119
|
+
super(formOptions);
|
|
29
120
|
if (this.options.useSessionToken) {
|
|
30
121
|
Formio.useSessionToken(this.options);
|
|
31
122
|
}
|
|
@@ -34,30 +125,22 @@ export default class Form extends Element {
|
|
|
34
125
|
this.readyReject = reject;
|
|
35
126
|
});
|
|
36
127
|
this.instance = null;
|
|
37
|
-
if (
|
|
128
|
+
if (element) {
|
|
38
129
|
if (this.element) {
|
|
39
130
|
delete this.element.component;
|
|
40
131
|
}
|
|
41
|
-
this.element =
|
|
42
|
-
this.options = args[2] || {};
|
|
43
|
-
this.options.events = this.events;
|
|
44
|
-
this.setForm(args[1])
|
|
45
|
-
.then(() => this.readyResolve(this.instance))
|
|
46
|
-
.catch(this.readyReject);
|
|
132
|
+
this.element = element;
|
|
47
133
|
}
|
|
48
|
-
else
|
|
134
|
+
else {
|
|
49
135
|
this.element = null;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.setForm(
|
|
136
|
+
}
|
|
137
|
+
if (form) {
|
|
138
|
+
this.setForm(form)
|
|
53
139
|
.then(() => this.readyResolve(this.instance))
|
|
54
140
|
.catch(this.readyReject);
|
|
55
141
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.options = {};
|
|
59
|
-
this.options.events = this.events;
|
|
60
|
-
}
|
|
142
|
+
this.options = formOptions;
|
|
143
|
+
this.options.events = this.events;
|
|
61
144
|
this.display = '';
|
|
62
145
|
}
|
|
63
146
|
createElement(tag, attrs, children) {
|
|
@@ -105,9 +188,8 @@ export default class Form extends Element {
|
|
|
105
188
|
}
|
|
106
189
|
/**
|
|
107
190
|
* Create a new form instance provided the display of the form.
|
|
108
|
-
*
|
|
109
191
|
* @param {string} display - The display of the form, either "wizard", "form", or "pdf"
|
|
110
|
-
* @
|
|
192
|
+
* @returns {Webform|Wizard|PDF} - The new form instance for the display.
|
|
111
193
|
*/
|
|
112
194
|
create(display) {
|
|
113
195
|
if (this.options && (this.options.flatten || this.options.renderMode === 'flat')) {
|
|
@@ -124,9 +206,8 @@ export default class Form extends Element {
|
|
|
124
206
|
}
|
|
125
207
|
/**
|
|
126
208
|
* Sets the form. Either as JSON or a URL to a form JSON schema.
|
|
127
|
-
*
|
|
128
209
|
* @param {string|object} formParam - Either the form JSON or the URL of the form json.
|
|
129
|
-
* @
|
|
210
|
+
* @returns {void}
|
|
130
211
|
*/
|
|
131
212
|
set form(formParam) {
|
|
132
213
|
this.setForm(formParam);
|
|
@@ -153,12 +234,11 @@ export default class Form extends Element {
|
|
|
153
234
|
};
|
|
154
235
|
}
|
|
155
236
|
/**
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
*/
|
|
237
|
+
* Check Subdirectories path and provide correct options
|
|
238
|
+
* @param {string} url - The the URL of the form json.
|
|
239
|
+
* @param {import('@formio/core').Form} form - The form json.
|
|
240
|
+
* @returns {object} The initial options with base and project.
|
|
241
|
+
*/
|
|
162
242
|
getFormInitOptions(url, form) {
|
|
163
243
|
const options = {};
|
|
164
244
|
const index = url.indexOf(form?.path);
|
|
@@ -182,6 +262,11 @@ export default class Form extends Element {
|
|
|
182
262
|
}
|
|
183
263
|
return {};
|
|
184
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Sets the form to the JSON schema of a form.
|
|
267
|
+
* @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
|
|
268
|
+
* @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
|
|
269
|
+
*/
|
|
185
270
|
setForm(formParam) {
|
|
186
271
|
let result;
|
|
187
272
|
formParam = formParam || this.form;
|
|
@@ -242,17 +327,15 @@ export default class Form extends Element {
|
|
|
242
327
|
}
|
|
243
328
|
/**
|
|
244
329
|
* Returns the loaded forms JSON.
|
|
245
|
-
*
|
|
246
|
-
* @return {object} - The loaded form's JSON
|
|
330
|
+
* @returns {object} - The loaded form's JSON
|
|
247
331
|
*/
|
|
248
332
|
get form() {
|
|
249
333
|
return this._form;
|
|
250
334
|
}
|
|
251
335
|
/**
|
|
252
336
|
* Changes the display of the form.
|
|
253
|
-
*
|
|
254
337
|
* @param {string} display - The display to set this form. Either "wizard", "form", or "pdf"
|
|
255
|
-
* @
|
|
338
|
+
* @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created after changing the display.
|
|
256
339
|
*/
|
|
257
340
|
setDisplay(display) {
|
|
258
341
|
if ((this.display === display) && this.instance) {
|
|
@@ -293,9 +376,9 @@ export default class Form extends Element {
|
|
|
293
376
|
}
|
|
294
377
|
/**
|
|
295
378
|
* Sanitize an html string.
|
|
296
|
-
*
|
|
297
|
-
* @param string
|
|
298
|
-
* @returns {
|
|
379
|
+
* @param {string} dirty - The dirty html string to sanitize.
|
|
380
|
+
* @param {boolean} forceSanitize - If the string should be force sanitized.
|
|
381
|
+
* @returns {string} - The sanitized html string.
|
|
299
382
|
*/
|
|
300
383
|
sanitize(dirty, forceSanitize) {
|
|
301
384
|
// If Sanitize is turned off
|
|
@@ -313,8 +396,7 @@ export default class Form extends Element {
|
|
|
313
396
|
}
|
|
314
397
|
/**
|
|
315
398
|
* Build a new form.
|
|
316
|
-
*
|
|
317
|
-
* @return {Promise<T>}
|
|
399
|
+
* @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created.
|
|
318
400
|
*/
|
|
319
401
|
build() {
|
|
320
402
|
if (!this.instance) {
|
|
@@ -369,15 +451,16 @@ export default class Form extends Element {
|
|
|
369
451
|
// Allow simple embedding.
|
|
370
452
|
Formio.embedForm = (embed) => Form.embed(embed);
|
|
371
453
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
374
|
-
* @param
|
|
375
|
-
* @param
|
|
376
|
-
* @
|
|
377
|
-
*
|
|
378
|
-
*
|
|
454
|
+
* Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
|
|
455
|
+
* @param {object} elementOrForm - The DOM element you wish to render this form within, or the form definition.
|
|
456
|
+
* @param {object | string | FormOptions} formOrOptions - A Form JSON schema, the URL of a hosted form, or the form options.
|
|
457
|
+
* @param {FormOptions} [options] - The options to create a new form instance.
|
|
458
|
+
* @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created.
|
|
459
|
+
* @example
|
|
460
|
+
* import { Formio } from '@formio/js';
|
|
461
|
+
* Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example');
|
|
379
462
|
*/
|
|
380
|
-
Formio.createForm = (
|
|
381
|
-
return (new Form(
|
|
463
|
+
Formio.createForm = (elementOrForm, formOrOptions, options) => {
|
|
464
|
+
return (new Form(elementOrForm, formOrOptions, options)).ready;
|
|
382
465
|
};
|
|
383
466
|
Formio.Form = Form;
|
package/lib/mjs/FormBuilder.d.ts
CHANGED
|
@@ -1,6 +1,191 @@
|
|
|
1
1
|
export default class FormBuilder extends Form {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @typedef FormBuilderOptions
|
|
4
|
+
* @property {string[]} [disabled] - An array of "keys" of components that should be disabled within the form builder. Example: ['firstName', 'lastName']
|
|
5
|
+
* @property {boolean} [noNewEdit] - When set to TRUE no modal is shown when a component is dragged onto the form.
|
|
6
|
+
* @property {boolean} [noDefaultSubmitButton] - Set to TRUE to not include the default submit button in Webforms.
|
|
7
|
+
* @property {boolean} [alwaysConfirmComponentRemoval] - Set to TRUE to always require confirmation before removing a component.
|
|
8
|
+
* @property {object} [formConfig] - Form configurations to apply to forms being created. These configurations are added to the "config" property of the form object.
|
|
9
|
+
* @property {string} [resourceTag] - The tag to use to query for the "Existing Resource Fields" section of the builder.
|
|
10
|
+
* @property {import('./Form').FormOptions} [editForm] - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
11
|
+
* @property {string} [language] - The language to load into the form builder.
|
|
12
|
+
* @property {object} [builder] - The builder options to pass to the builder.
|
|
13
|
+
* @property {'form'|'wizard'|'pdf'} [display] - The display mode of the builder.
|
|
14
|
+
* @property {string} [resourceFilter] - Filter applied to the resources that appear in the builder's Existing Resource Fields.
|
|
15
|
+
* @property {boolean} [noSource] - When set to TRUE, the resource ID in the builder's Existing Resource Fields will not be linked.
|
|
16
|
+
* @property {boolean} [showFullJsonSchema] - When set to TRUE, the full JSON schema will be displayed in the JSON edit menu.
|
|
17
|
+
*/
|
|
18
|
+
/** @type {FormBuilderOptions} */
|
|
19
|
+
static options: {
|
|
20
|
+
/**
|
|
21
|
+
* - An array of "keys" of components that should be disabled within the form builder. Example: ['firstName', 'lastName']
|
|
22
|
+
*/
|
|
23
|
+
disabled?: string[] | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* - When set to TRUE no modal is shown when a component is dragged onto the form.
|
|
26
|
+
*/
|
|
27
|
+
noNewEdit?: boolean | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* - Set to TRUE to not include the default submit button in Webforms.
|
|
30
|
+
*/
|
|
31
|
+
noDefaultSubmitButton?: boolean | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* - Set to TRUE to always require confirmation before removing a component.
|
|
34
|
+
*/
|
|
35
|
+
alwaysConfirmComponentRemoval?: boolean | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* - Form configurations to apply to forms being created. These configurations are added to the "config" property of the form object.
|
|
38
|
+
*/
|
|
39
|
+
formConfig?: object | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* - The tag to use to query for the "Existing Resource Fields" section of the builder.
|
|
42
|
+
*/
|
|
43
|
+
resourceTag?: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
46
|
+
*/
|
|
47
|
+
editForm?: any;
|
|
48
|
+
/**
|
|
49
|
+
* - The language to load into the form builder.
|
|
50
|
+
*/
|
|
51
|
+
language?: string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* - The builder options to pass to the builder.
|
|
54
|
+
*/
|
|
55
|
+
builder?: object | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* - The display mode of the builder.
|
|
58
|
+
*/
|
|
59
|
+
display?: "form" | "pdf" | "wizard" | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* - Filter applied to the resources that appear in the builder's Existing Resource Fields.
|
|
62
|
+
*/
|
|
63
|
+
resourceFilter?: string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* - When set to TRUE, the resource ID in the builder's Existing Resource Fields will not be linked.
|
|
66
|
+
*/
|
|
67
|
+
noSource?: boolean | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* - When set to TRUE, the full JSON schema will be displayed in the JSON edit menu.
|
|
70
|
+
*/
|
|
71
|
+
showFullJsonSchema?: boolean | undefined;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Creates a new form builder.
|
|
75
|
+
* @param {HTMLElement} element - The HTML element to place the form builder.
|
|
76
|
+
* @param {string | object} form - The form to pass to the builder
|
|
77
|
+
* @param {FormBuilderOptions} options - The options to create this builder.
|
|
78
|
+
* @returns {FormBuilder} - The form builder instance.
|
|
79
|
+
*/
|
|
80
|
+
constructor(element: HTMLElement, form: string | object, options: {
|
|
81
|
+
/**
|
|
82
|
+
* - An array of "keys" of components that should be disabled within the form builder. Example: ['firstName', 'lastName']
|
|
83
|
+
*/
|
|
84
|
+
disabled?: string[] | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* - When set to TRUE no modal is shown when a component is dragged onto the form.
|
|
87
|
+
*/
|
|
88
|
+
noNewEdit?: boolean | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* - Set to TRUE to not include the default submit button in Webforms.
|
|
91
|
+
*/
|
|
92
|
+
noDefaultSubmitButton?: boolean | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* - Set to TRUE to always require confirmation before removing a component.
|
|
95
|
+
*/
|
|
96
|
+
alwaysConfirmComponentRemoval?: boolean | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* - Form configurations to apply to forms being created. These configurations are added to the "config" property of the form object.
|
|
99
|
+
*/
|
|
100
|
+
formConfig?: object | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* - The tag to use to query for the "Existing Resource Fields" section of the builder.
|
|
103
|
+
*/
|
|
104
|
+
resourceTag?: string | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
107
|
+
*/
|
|
108
|
+
editForm?: any;
|
|
109
|
+
/**
|
|
110
|
+
* - The language to load into the form builder.
|
|
111
|
+
*/
|
|
112
|
+
language?: string | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* - The builder options to pass to the builder.
|
|
115
|
+
*/
|
|
116
|
+
builder?: object | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* - The display mode of the builder.
|
|
119
|
+
*/
|
|
120
|
+
display?: "form" | "pdf" | "wizard" | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* - Filter applied to the resources that appear in the builder's Existing Resource Fields.
|
|
123
|
+
*/
|
|
124
|
+
resourceFilter?: string | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* - When set to TRUE, the resource ID in the builder's Existing Resource Fields will not be linked.
|
|
127
|
+
*/
|
|
128
|
+
noSource?: boolean | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* - When set to TRUE, the full JSON schema will be displayed in the JSON edit menu.
|
|
131
|
+
*/
|
|
132
|
+
showFullJsonSchema?: boolean | undefined;
|
|
133
|
+
});
|
|
134
|
+
/** @type {FormBuilderOptions} */
|
|
135
|
+
options: {
|
|
136
|
+
/**
|
|
137
|
+
* - An array of "keys" of components that should be disabled within the form builder. Example: ['firstName', 'lastName']
|
|
138
|
+
*/
|
|
139
|
+
disabled?: string[] | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* - When set to TRUE no modal is shown when a component is dragged onto the form.
|
|
142
|
+
*/
|
|
143
|
+
noNewEdit?: boolean | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* - Set to TRUE to not include the default submit button in Webforms.
|
|
146
|
+
*/
|
|
147
|
+
noDefaultSubmitButton?: boolean | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* - Set to TRUE to always require confirmation before removing a component.
|
|
150
|
+
*/
|
|
151
|
+
alwaysConfirmComponentRemoval?: boolean | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* - Form configurations to apply to forms being created. These configurations are added to the "config" property of the form object.
|
|
154
|
+
*/
|
|
155
|
+
formConfig?: object | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* - The tag to use to query for the "Existing Resource Fields" section of the builder.
|
|
158
|
+
*/
|
|
159
|
+
resourceTag?: string | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
162
|
+
*/
|
|
163
|
+
editForm?: any;
|
|
164
|
+
/**
|
|
165
|
+
* - The language to load into the form builder.
|
|
166
|
+
*/
|
|
167
|
+
language?: string | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* - The builder options to pass to the builder.
|
|
170
|
+
*/
|
|
171
|
+
builder?: object | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* - The display mode of the builder.
|
|
174
|
+
*/
|
|
175
|
+
display?: "form" | "pdf" | "wizard" | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* - Filter applied to the resources that appear in the builder's Existing Resource Fields.
|
|
178
|
+
*/
|
|
179
|
+
resourceFilter?: string | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* - When set to TRUE, the resource ID in the builder's Existing Resource Fields will not be linked.
|
|
182
|
+
*/
|
|
183
|
+
noSource?: boolean | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* - When set to TRUE, the full JSON schema will be displayed in the JSON edit menu.
|
|
186
|
+
*/
|
|
187
|
+
showFullJsonSchema?: boolean | undefined;
|
|
188
|
+
};
|
|
4
189
|
create(display: any): any;
|
|
5
190
|
}
|
|
6
191
|
import Form from './Form';
|
package/lib/mjs/FormBuilder.js
CHANGED
|
@@ -2,7 +2,33 @@ import { Formio } from './Formio';
|
|
|
2
2
|
import Builders from './builders';
|
|
3
3
|
import Form from './Form';
|
|
4
4
|
export default class FormBuilder extends Form {
|
|
5
|
+
/**
|
|
6
|
+
* @typedef FormBuilderOptions
|
|
7
|
+
* @property {string[]} [disabled] - An array of "keys" of components that should be disabled within the form builder. Example: ['firstName', 'lastName']
|
|
8
|
+
* @property {boolean} [noNewEdit] - When set to TRUE no modal is shown when a component is dragged onto the form.
|
|
9
|
+
* @property {boolean} [noDefaultSubmitButton] - Set to TRUE to not include the default submit button in Webforms.
|
|
10
|
+
* @property {boolean} [alwaysConfirmComponentRemoval] - Set to TRUE to always require confirmation before removing a component.
|
|
11
|
+
* @property {object} [formConfig] - Form configurations to apply to forms being created. These configurations are added to the "config" property of the form object.
|
|
12
|
+
* @property {string} [resourceTag] - The tag to use to query for the "Existing Resource Fields" section of the builder.
|
|
13
|
+
* @property {import('./Form').FormOptions} [editForm] - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
14
|
+
* @property {string} [language] - The language to load into the form builder.
|
|
15
|
+
* @property {object} [builder] - The builder options to pass to the builder.
|
|
16
|
+
* @property {'form'|'wizard'|'pdf'} [display] - The display mode of the builder.
|
|
17
|
+
* @property {string} [resourceFilter] - Filter applied to the resources that appear in the builder's Existing Resource Fields.
|
|
18
|
+
* @property {boolean} [noSource] - When set to TRUE, the resource ID in the builder's Existing Resource Fields will not be linked.
|
|
19
|
+
* @property {boolean} [showFullJsonSchema] - When set to TRUE, the full JSON schema will be displayed in the JSON edit menu.
|
|
20
|
+
*/
|
|
21
|
+
/** @type {FormBuilderOptions} */
|
|
5
22
|
static options = {};
|
|
23
|
+
/** @type {FormBuilderOptions} */
|
|
24
|
+
options;
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new form builder.
|
|
27
|
+
* @param {HTMLElement} element - The HTML element to place the form builder.
|
|
28
|
+
* @param {string | object} form - The form to pass to the builder
|
|
29
|
+
* @param {FormBuilderOptions} options - The options to create this builder.
|
|
30
|
+
* @returns {FormBuilder} - The form builder instance.
|
|
31
|
+
*/
|
|
6
32
|
constructor(element, form, options) {
|
|
7
33
|
form = form || {};
|
|
8
34
|
options = options || {};
|
|
@@ -20,14 +46,12 @@ export default class FormBuilder extends Form {
|
|
|
20
46
|
}
|
|
21
47
|
/**
|
|
22
48
|
* Factory that creates a new form builder based on the form parameter.
|
|
23
|
-
*
|
|
24
|
-
* @param
|
|
25
|
-
* @param
|
|
26
|
-
* @
|
|
27
|
-
*
|
|
28
|
-
* @return {Promise} - When the form is instance is ready.
|
|
49
|
+
* @param {HTMLElement} element - The HTML Element to add this form to.
|
|
50
|
+
* @param {string|object} form - The src of the form, or a form object.
|
|
51
|
+
* @param {object} options - The options to create this form.
|
|
52
|
+
* @returns {Promise} - When the form is instance is ready.
|
|
29
53
|
*/
|
|
30
|
-
Formio.builder = (
|
|
31
|
-
return (new FormBuilder(
|
|
54
|
+
Formio.builder = (element, form, options) => {
|
|
55
|
+
return (new FormBuilder(element, form, options)).ready;
|
|
32
56
|
};
|
|
33
57
|
Formio.FormBuilder = FormBuilder;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Formio } from './Embed';
|
|
2
|
+
/**
|
|
3
|
+
* Inline embed a form within a webpage.
|
|
4
|
+
* @param {*} config - Configuration to configure how the inline embed is rendered.
|
|
5
|
+
*/
|
|
6
|
+
export function embed(config = {}) {
|
|
7
|
+
const scripts = document.getElementsByTagName('script');
|
|
8
|
+
config = Object.assign({}, window.FormioConfig || {}, config);
|
|
9
|
+
let thisScript = null;
|
|
10
|
+
let i = scripts.length;
|
|
11
|
+
const scriptName = config.scriptName || 'formio.embed.';
|
|
12
|
+
while (i--) {
|
|
13
|
+
if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
|
|
14
|
+
thisScript = scripts[i];
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (thisScript) {
|
|
19
|
+
const query = {};
|
|
20
|
+
const queryString = thisScript.src.replace(/^[^?]+\??/, '');
|
|
21
|
+
queryString.replace(/\?/g, '&').split('&').forEach((item) => {
|
|
22
|
+
query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
|
|
23
|
+
});
|
|
24
|
+
let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
|
|
25
|
+
scriptSrc.pop();
|
|
26
|
+
let cdnSrc = '';
|
|
27
|
+
if (['js', 'offline'].includes(scriptSrc[scriptSrc.length - 1])) {
|
|
28
|
+
scriptSrc.pop();
|
|
29
|
+
scriptSrc = cdnSrc = scriptSrc.join('/');
|
|
30
|
+
scriptSrc += '/js';
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
scriptSrc = scriptSrc.join('/');
|
|
34
|
+
}
|
|
35
|
+
const debug = (query.debug === 'true' || query.debug === '1');
|
|
36
|
+
const renderer = debug ? 'formio.form' : 'formio.form.min';
|
|
37
|
+
Formio.config = Object.assign({
|
|
38
|
+
script: query.script || (`${scriptSrc}/${renderer}.js`),
|
|
39
|
+
style: query.styles || (`${scriptSrc}/${renderer}.css`),
|
|
40
|
+
cdn: query.cdn || cdnSrc,
|
|
41
|
+
class: (query.class || 'formio-form-wrapper'),
|
|
42
|
+
src: query.src,
|
|
43
|
+
form: null,
|
|
44
|
+
submission: null,
|
|
45
|
+
project: query.project,
|
|
46
|
+
base: query.base || 'https://api.form.io',
|
|
47
|
+
submit: query.submit,
|
|
48
|
+
includeLibs: (query.libs === 'true' || query.libs === '1'),
|
|
49
|
+
noshadow: (query.shadow === 'false' || query.shadow === '0'),
|
|
50
|
+
template: query.template || 'bootstrap',
|
|
51
|
+
debug: debug,
|
|
52
|
+
config: {},
|
|
53
|
+
redirect: (query.return || query.redirect),
|
|
54
|
+
embedCSS: (`${scriptSrc}/formio.embed.css`),
|
|
55
|
+
success: query.success || 'Thank you for your submission!',
|
|
56
|
+
before: null,
|
|
57
|
+
after: null
|
|
58
|
+
}, config);
|
|
59
|
+
if (Formio.config.alter) {
|
|
60
|
+
Formio.config.alter(Formio.config);
|
|
61
|
+
}
|
|
62
|
+
const form = (Formio.config.form || Formio.config.src);
|
|
63
|
+
if (form) {
|
|
64
|
+
Formio.debug('Embedding Configuration', config);
|
|
65
|
+
// The id for this embedded form.
|
|
66
|
+
Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
|
|
67
|
+
Formio.debug('Creating form element');
|
|
68
|
+
const element = Formio.createElement('div', {
|
|
69
|
+
'id': Formio.config.id,
|
|
70
|
+
class: Formio.config.class
|
|
71
|
+
});
|
|
72
|
+
// insertAfter doesn't exist, but effect is identical.
|
|
73
|
+
thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
|
|
74
|
+
Formio.createForm(element, form, Formio.config.config).then((instance) => {
|
|
75
|
+
if (Formio.config.submit) {
|
|
76
|
+
instance.nosubmit = true;
|
|
77
|
+
}
|
|
78
|
+
// Trigger the submit done event.
|
|
79
|
+
instance.on('submitDone', (submission) => Formio.submitDone(instance, submission));
|
|
80
|
+
// Configure a redirect.
|
|
81
|
+
instance.on('submit', (submission) => {
|
|
82
|
+
Formio.debug("on('submit')", submission);
|
|
83
|
+
if (Formio.config.submit) {
|
|
84
|
+
Formio.debug(`Sending submission to ${Formio.config.submit}`);
|
|
85
|
+
const headers = {
|
|
86
|
+
'content-type': 'application/json'
|
|
87
|
+
};
|
|
88
|
+
const token = Formio.FormioClass.getToken();
|
|
89
|
+
if (token) {
|
|
90
|
+
headers['x-jwt-token'] = token;
|
|
91
|
+
}
|
|
92
|
+
Formio.FormioClass.fetch(Formio.config.submit, {
|
|
93
|
+
body: JSON.stringify(submission),
|
|
94
|
+
headers: headers,
|
|
95
|
+
method: 'POST',
|
|
96
|
+
mode: 'cors',
|
|
97
|
+
})
|
|
98
|
+
.then(resp => resp.json())
|
|
99
|
+
.then((submission) => {
|
|
100
|
+
Formio.submitDone(instance, submission);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
// Show an error if the script cannot be found.
|
|
109
|
+
document.write('<span>Could not locate the Embedded form.</span>');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export { Formio };
|