@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/Element.js
CHANGED
|
@@ -41,21 +41,18 @@ export default class Element {
|
|
|
41
41
|
this.options.i18next = this.i18next = this.options.i18next || I18n.init(this.options.i18n);
|
|
42
42
|
/**
|
|
43
43
|
* An instance of the EventEmitter class to handle the emitting and registration of events.
|
|
44
|
-
*
|
|
45
44
|
* @type {EventEmitter}
|
|
46
45
|
*/
|
|
47
46
|
this.events = (options && options.events) ? options.events : new EventEmitter();
|
|
48
47
|
this.defaultMask = null;
|
|
49
48
|
/**
|
|
50
49
|
* Conditional to show or hide helplinks in editForm
|
|
51
|
-
*
|
|
52
50
|
* @type {*|boolean}
|
|
53
51
|
*/
|
|
54
52
|
this.helplinks = (this.options.helplinks === 'false') ? false : (this.options.helplinks || 'https://help.form.io');
|
|
55
53
|
}
|
|
56
54
|
/**
|
|
57
55
|
* Register for a new event within this component.
|
|
58
|
-
*
|
|
59
56
|
* @example
|
|
60
57
|
* let component = new BaseComponent({
|
|
61
58
|
* type: 'textfield',
|
|
@@ -65,12 +62,11 @@ export default class Element {
|
|
|
65
62
|
* component.on('componentChange', (changed) => {
|
|
66
63
|
* console.log('this element is changed.');
|
|
67
64
|
* });
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
65
|
* @param {string} event - The event you wish to register the handler for.
|
|
71
|
-
* @param {
|
|
66
|
+
* @param {Function} cb - The callback handler to handle this event.
|
|
72
67
|
* @param {boolean} [internal] - This is an internal event handler.
|
|
73
68
|
* @param {boolean} [once] - This event should only fire once.
|
|
69
|
+
* @returns {EventEmitter | void} - The event emitter instance.
|
|
74
70
|
*/
|
|
75
71
|
on(event, cb, internal, once = false) {
|
|
76
72
|
if (!this.events) {
|
|
@@ -86,18 +82,18 @@ export default class Element {
|
|
|
86
82
|
}
|
|
87
83
|
/**
|
|
88
84
|
* Register for a new single-fire event within this component.
|
|
89
|
-
*
|
|
90
85
|
* @param {string} event - The event you wish to register the handler for.
|
|
91
|
-
* @param {
|
|
86
|
+
* @param {Function} cb - The callback handler to handle this event.
|
|
87
|
+
* @param {boolean} internal - This is an internal event handler.
|
|
88
|
+
* @returns {EventEmitter} - The event emitter instance.
|
|
92
89
|
*/
|
|
93
90
|
once(event, cb, internal) {
|
|
94
91
|
return this.on(event, cb, internal, true);
|
|
95
92
|
}
|
|
96
93
|
/**
|
|
97
94
|
* Allow catching any event.
|
|
98
|
-
*
|
|
99
|
-
* @
|
|
100
|
-
* @returns {this}
|
|
95
|
+
* @param {Function} cb - The callback handler to handle this event.
|
|
96
|
+
* @returns {EventEmitter | void} - The event emitter instance.
|
|
101
97
|
*/
|
|
102
98
|
onAny(cb) {
|
|
103
99
|
if (!this.events) {
|
|
@@ -107,9 +103,8 @@ export default class Element {
|
|
|
107
103
|
}
|
|
108
104
|
/**
|
|
109
105
|
* Removes the listener that will be fired when any event is emitted.
|
|
110
|
-
*
|
|
111
|
-
* @
|
|
112
|
-
* @returns {this}
|
|
106
|
+
* @param {Function} cb - The callback handler to handle this event.
|
|
107
|
+
* @returns {EventEmitter | void} - The event emitter instance.
|
|
113
108
|
*/
|
|
114
109
|
offAny(cb) {
|
|
115
110
|
if (!this.events) {
|
|
@@ -119,9 +114,8 @@ export default class Element {
|
|
|
119
114
|
}
|
|
120
115
|
/**
|
|
121
116
|
* Removes a listener for a certain event. Not passing the 2nd arg will remove all listeners for that event.
|
|
122
|
-
*
|
|
123
117
|
* @param {string} event - The event you wish to register the handler for.
|
|
124
|
-
* @param {
|
|
118
|
+
* @param {Function | undefined} cb - The callback handler to handle this event.
|
|
125
119
|
*/
|
|
126
120
|
off(event, cb) {
|
|
127
121
|
if (!this.events) {
|
|
@@ -142,9 +136,8 @@ export default class Element {
|
|
|
142
136
|
}
|
|
143
137
|
/**
|
|
144
138
|
* Emit a new event.
|
|
145
|
-
*
|
|
146
139
|
* @param {string} event - The event to emit.
|
|
147
|
-
* @param {
|
|
140
|
+
* @param {object} data - The data to emit with the handler.
|
|
148
141
|
*/
|
|
149
142
|
emit(event, ...data) {
|
|
150
143
|
if (this.events) {
|
|
@@ -153,9 +146,8 @@ export default class Element {
|
|
|
153
146
|
}
|
|
154
147
|
/**
|
|
155
148
|
* Check if the component has an event handler set up for the event.
|
|
156
|
-
*
|
|
157
149
|
* @param {string} event - The event name.
|
|
158
|
-
* @returns {boolean}
|
|
150
|
+
* @returns {boolean} - TRUE if the event is registered, FALSE otherwise.
|
|
159
151
|
*/
|
|
160
152
|
hasEventHandler(event) {
|
|
161
153
|
if (!this.events) {
|
|
@@ -171,15 +163,12 @@ export default class Element {
|
|
|
171
163
|
}
|
|
172
164
|
/**
|
|
173
165
|
* Wrapper method to add an event listener to an HTML element.
|
|
174
|
-
*
|
|
175
|
-
* @param
|
|
176
|
-
*
|
|
177
|
-
* @param
|
|
178
|
-
*
|
|
179
|
-
* @
|
|
180
|
-
* The callback function to be executed when the listener is triggered.
|
|
181
|
-
* @param persistent
|
|
182
|
-
* If this listener should persist beyond "destroy" commands.
|
|
166
|
+
* @param {HtmlElement} obj - The DOM element to add the event to.
|
|
167
|
+
* @param {string} type - The event name to add.
|
|
168
|
+
* @param {Function} func - The callback function to be executed when the listener is triggered.
|
|
169
|
+
* @param {boolean} persistent - If this listener should persist beyond "destroy" commands.
|
|
170
|
+
* @param {boolean} capture - If this listener should be executed in the capture phase.
|
|
171
|
+
* @returns {void | this} - The instance of the element.
|
|
183
172
|
*/
|
|
184
173
|
addEventListener(obj, type, func, persistent, capture) {
|
|
185
174
|
if (!obj) {
|
|
@@ -198,9 +187,10 @@ export default class Element {
|
|
|
198
187
|
}
|
|
199
188
|
/**
|
|
200
189
|
* Remove an event listener from the object.
|
|
201
|
-
*
|
|
202
|
-
* @param
|
|
203
|
-
* @param
|
|
190
|
+
* @param {HTMLElement} obj - The DOM element to remove the event from.
|
|
191
|
+
* @param {string} type - The event name to remove.
|
|
192
|
+
* @param {Function} func - The callback function to remove.
|
|
193
|
+
* @returns {this | void} - The instance of the element.
|
|
204
194
|
*/
|
|
205
195
|
removeEventListener(obj, type, func = null) {
|
|
206
196
|
const indexes = [];
|
|
@@ -246,6 +236,7 @@ export default class Element {
|
|
|
246
236
|
}
|
|
247
237
|
/**
|
|
248
238
|
* Removes all event listeners attached to this component.
|
|
239
|
+
* @param {boolean} all - If all events should be removed, including external events.
|
|
249
240
|
*/
|
|
250
241
|
destroy(all = false) {
|
|
251
242
|
this.removeEventListeners();
|
|
@@ -256,9 +247,9 @@ export default class Element {
|
|
|
256
247
|
}
|
|
257
248
|
/**
|
|
258
249
|
* Append an HTML DOM element to a container.
|
|
259
|
-
*
|
|
260
|
-
* @param element
|
|
261
|
-
* @
|
|
250
|
+
* @param {HTMLElement} element - The DOM element to append.
|
|
251
|
+
* @param {HTMLElement} container - The DOM element that is the container of the element getting appended.
|
|
252
|
+
* @returns {this} - The instance of the element.
|
|
262
253
|
*/
|
|
263
254
|
appendTo(element, container) {
|
|
264
255
|
container?.appendChild(element);
|
|
@@ -266,9 +257,9 @@ export default class Element {
|
|
|
266
257
|
}
|
|
267
258
|
/**
|
|
268
259
|
* Prepend an HTML DOM element to a container.
|
|
269
|
-
*
|
|
270
260
|
* @param {HTMLElement} element - The DOM element to prepend.
|
|
271
261
|
* @param {HTMLElement} container - The DOM element that is the container of the element getting prepended.
|
|
262
|
+
* @returns {this} - The instance of the element.
|
|
272
263
|
*/
|
|
273
264
|
prependTo(element, container) {
|
|
274
265
|
if (container) {
|
|
@@ -289,9 +280,9 @@ export default class Element {
|
|
|
289
280
|
}
|
|
290
281
|
/**
|
|
291
282
|
* Removes an HTML DOM element from its bounding container.
|
|
292
|
-
*
|
|
293
283
|
* @param {HTMLElement} element - The element to remove.
|
|
294
284
|
* @param {HTMLElement} container - The DOM element that is the container of the element to remove.
|
|
285
|
+
* @returns {this} - The instance of the element.
|
|
295
286
|
*/
|
|
296
287
|
removeChildFrom(element, container) {
|
|
297
288
|
if (container && container.contains(element)) {
|
|
@@ -306,12 +297,10 @@ export default class Element {
|
|
|
306
297
|
}
|
|
307
298
|
/**
|
|
308
299
|
* Alias for document.createElement.
|
|
309
|
-
*
|
|
310
300
|
* @param {string} type - The type of element to create
|
|
311
|
-
* @param {
|
|
301
|
+
* @param {object} attr - The element attributes to add to the created element.
|
|
312
302
|
* @param {Various} children - Child elements. Can be a DOM Element, string or array of both.
|
|
313
|
-
*
|
|
314
|
-
* @return {HTMLElement} - The created element.
|
|
303
|
+
* @returns {HTMLElement} - The created element.
|
|
315
304
|
*/
|
|
316
305
|
ce(type, attr, children = null) {
|
|
317
306
|
// console.warn('Call to deprecated this.ce(). Dom elements should be created with templates, not manually with ce.');
|
|
@@ -327,8 +316,9 @@ export default class Element {
|
|
|
327
316
|
}
|
|
328
317
|
/**
|
|
329
318
|
* Append different types of children.
|
|
330
|
-
*
|
|
331
|
-
* @param child
|
|
319
|
+
* @param {HTMLElement} element - The element to append to.
|
|
320
|
+
* @param {HTMLElement} child - The child element to append.
|
|
321
|
+
* @returns {this} - The instance of the element.
|
|
332
322
|
*/
|
|
333
323
|
appendChild(element, child) {
|
|
334
324
|
if (Array.isArray(child)) {
|
|
@@ -350,15 +340,18 @@ export default class Element {
|
|
|
350
340
|
maskPlaceholder(mask) {
|
|
351
341
|
return mask.map((char) => (char instanceof RegExp) ? this.placeholderChar : char).join('');
|
|
352
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* Get the placeholder character for the input mask.
|
|
345
|
+
* @returns {string} - The placeholder character.
|
|
346
|
+
*/
|
|
353
347
|
get placeholderChar() {
|
|
354
348
|
return this.component?.inputMaskPlaceholderChar || '_';
|
|
355
349
|
}
|
|
356
350
|
/**
|
|
357
351
|
* Sets the input mask for an input.
|
|
358
|
-
*
|
|
359
352
|
* @param {HTMLElement} input - The html input to apply the mask to.
|
|
360
|
-
* @param {
|
|
361
|
-
* @param {
|
|
353
|
+
* @param {string} inputMask - The input mask to add to this input.
|
|
354
|
+
* @param {boolean} usePlaceholder - Set the mask placeholder on the input.
|
|
362
355
|
*/
|
|
363
356
|
setInputMask(input, inputMask, usePlaceholder) {
|
|
364
357
|
if (input && inputMask) {
|
|
@@ -391,17 +384,17 @@ export default class Element {
|
|
|
391
384
|
}
|
|
392
385
|
/**
|
|
393
386
|
* Translate a text using the i18n system.
|
|
394
|
-
*
|
|
395
387
|
* @param {string|Array<string>} text - The i18n identifier.
|
|
396
|
-
* @param {
|
|
388
|
+
* @param {...any} args - The arguments to pass to the i18n translation.
|
|
389
|
+
* @returns {string} - The translated text.
|
|
397
390
|
*/
|
|
398
391
|
t(text, ...args) {
|
|
399
392
|
return this.i18next ? this.i18next.t(text, ...args) : text;
|
|
400
393
|
}
|
|
401
394
|
/**
|
|
402
395
|
* Alias to create a text node.
|
|
403
|
-
* @param text
|
|
404
|
-
* @returns {
|
|
396
|
+
* @param {string} text - The text to create.
|
|
397
|
+
* @returns {HtmlElement} - The created text node.
|
|
405
398
|
*/
|
|
406
399
|
text(text) {
|
|
407
400
|
return document.createTextNode(this.t(text));
|
|
@@ -409,7 +402,7 @@ export default class Element {
|
|
|
409
402
|
/**
|
|
410
403
|
* Adds an object of attributes onto an element.
|
|
411
404
|
* @param {HtmlElement} element - The element to add the attributes to.
|
|
412
|
-
* @param {
|
|
405
|
+
* @param {object} attr - The attributes to add to the input element.
|
|
413
406
|
*/
|
|
414
407
|
attr(element, attr) {
|
|
415
408
|
if (!element) {
|
|
@@ -432,6 +425,9 @@ export default class Element {
|
|
|
432
425
|
* Determines if an element has a class.
|
|
433
426
|
*
|
|
434
427
|
* Taken from jQuery https://j11y.io/jquery/#v=1.5.0&fn=jQuery.fn.hasClass
|
|
428
|
+
* @param {HTMLElement} element - The element to check for the class.
|
|
429
|
+
* @param {string} className - The class to check for.
|
|
430
|
+
* @returns {boolean} - TRUE if the element has the class, FALSE otherwise.
|
|
435
431
|
*/
|
|
436
432
|
hasClass(element, className) {
|
|
437
433
|
if (!element) {
|
|
@@ -443,11 +439,9 @@ export default class Element {
|
|
|
443
439
|
}
|
|
444
440
|
/**
|
|
445
441
|
* Adds a class to a DOM element.
|
|
446
|
-
*
|
|
447
|
-
* @param
|
|
448
|
-
*
|
|
449
|
-
* @param className
|
|
450
|
-
* The name of the class to add.
|
|
442
|
+
* @param {HTMLElement} element - The element to add a class to.
|
|
443
|
+
* @param {string} className - The name of the class to add.
|
|
444
|
+
* @returns {this} - The instance of the element.
|
|
451
445
|
*/
|
|
452
446
|
addClass(element, className) {
|
|
453
447
|
if (!element || !(element instanceof HTMLElement)) {
|
|
@@ -462,11 +456,9 @@ export default class Element {
|
|
|
462
456
|
}
|
|
463
457
|
/**
|
|
464
458
|
* Remove a class from a DOM element.
|
|
465
|
-
*
|
|
466
|
-
* @param
|
|
467
|
-
*
|
|
468
|
-
* @param className
|
|
469
|
-
* The name of the class that is to be removed.
|
|
459
|
+
* @param {HTMLElement} element - The DOM element to remove the class from.
|
|
460
|
+
* @param {string} className - The name of the class that is to be removed.
|
|
461
|
+
* @returns {this} - The instance of the element.
|
|
470
462
|
*/
|
|
471
463
|
removeClass(element, className) {
|
|
472
464
|
if (!element || !className || !(element instanceof HTMLElement)) {
|
|
@@ -482,7 +474,6 @@ export default class Element {
|
|
|
482
474
|
}
|
|
483
475
|
/**
|
|
484
476
|
* Empty's an HTML DOM element.
|
|
485
|
-
*
|
|
486
477
|
* @param {HTMLElement} element - The element you wish to empty.
|
|
487
478
|
*/
|
|
488
479
|
empty(element) {
|
|
@@ -494,9 +485,8 @@ export default class Element {
|
|
|
494
485
|
}
|
|
495
486
|
/**
|
|
496
487
|
* Create an evaluation context for all script executions and interpolations.
|
|
497
|
-
*
|
|
498
|
-
* @
|
|
499
|
-
* @return {*}
|
|
488
|
+
* @param {object} additional - Additional context to apply to the evaluation context.
|
|
489
|
+
* @returns {*} - The evaluation context.
|
|
500
490
|
*/
|
|
501
491
|
evalContext(additional) {
|
|
502
492
|
return Object.assign({
|
|
@@ -520,10 +510,10 @@ export default class Element {
|
|
|
520
510
|
}
|
|
521
511
|
/**
|
|
522
512
|
* Performs an interpolation using the evaluation context of this component.
|
|
523
|
-
*
|
|
524
|
-
* @param
|
|
525
|
-
* @param
|
|
526
|
-
* @
|
|
513
|
+
* @param {string} string - The string to interpolate.
|
|
514
|
+
* @param {object} data - The data to use in the interpolation.
|
|
515
|
+
* @param {object} options - The options to pass to the interpolation.
|
|
516
|
+
* @returns {XML|string|*|void} - The interpolated string.
|
|
527
517
|
*/
|
|
528
518
|
interpolate(string, data, options = {}) {
|
|
529
519
|
if (typeof string !== 'function' && (this.component.content || this.component.html)
|
|
@@ -539,19 +529,19 @@ export default class Element {
|
|
|
539
529
|
}
|
|
540
530
|
/**
|
|
541
531
|
* Performs an evaluation using the evaluation context of this component.
|
|
542
|
-
*
|
|
543
|
-
* @param
|
|
544
|
-
* @param
|
|
545
|
-
* @param
|
|
546
|
-
* @param
|
|
547
|
-
* @
|
|
532
|
+
* @param {string|Function|object} func - The function or string to evaluate.
|
|
533
|
+
* @param {object} args - The arguments to pass to the evaluation.
|
|
534
|
+
* @param {string} ret - The name of the variable within the evaluation context to return.
|
|
535
|
+
* @param {boolean} interpolate - Determines if it should replace all {{ }} token references with actual data.
|
|
536
|
+
* @param {import('@formio/core').EvaluatorOptions} options - The options to pass to the evaluation.
|
|
537
|
+
* @returns {*} - The result of the evaluation.
|
|
548
538
|
*/
|
|
549
|
-
evaluate(func, args, ret,
|
|
550
|
-
return FormioUtils.evaluate(func, this.evalContext(args), ret,
|
|
539
|
+
evaluate(func, args, ret, interpolate, options = {}) {
|
|
540
|
+
return FormioUtils.evaluate(func, this.evalContext(args), ret, interpolate, options);
|
|
551
541
|
}
|
|
552
542
|
/**
|
|
553
543
|
* Allow for options to hook into the functionality of this renderer.
|
|
554
|
-
* @
|
|
544
|
+
* @returns {*} - The result of the hook function.
|
|
555
545
|
*/
|
|
556
546
|
hook() {
|
|
557
547
|
const name = arguments[0];
|
package/lib/mjs/Embed.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export class Formio {
|
|
|
26
26
|
static addStyles(wrapper: any, href: any): Promise<void>;
|
|
27
27
|
static submitDone(instance: any, submission: any): Promise<void>;
|
|
28
28
|
static formioScript(script: any, builder: any): any;
|
|
29
|
-
static addLibrary(
|
|
29
|
+
static addLibrary(libWrapper: any, lib: any, name: any): Promise<void>;
|
|
30
30
|
static addLoader(wrapper: any): Promise<void>;
|
|
31
31
|
static init(element: any, options?: {}, builder?: boolean): Promise<any>;
|
|
32
32
|
static afterCreate(instance: any, wrapper: any, readyEvent: any): Promise<any>;
|
package/lib/mjs/Embed.js
CHANGED
|
@@ -79,6 +79,9 @@ export class Formio {
|
|
|
79
79
|
}
|
|
80
80
|
static createElement(type, attrs, children) {
|
|
81
81
|
const element = document.createElement(type);
|
|
82
|
+
if (!attrs) {
|
|
83
|
+
return element;
|
|
84
|
+
}
|
|
82
85
|
Object.keys(attrs).forEach(key => {
|
|
83
86
|
element.setAttribute(key, attrs[key]);
|
|
84
87
|
});
|
|
@@ -138,6 +141,9 @@ export class Formio {
|
|
|
138
141
|
}
|
|
139
142
|
static async submitDone(instance, submission) {
|
|
140
143
|
Formio.debug('Submision Complete', submission);
|
|
144
|
+
if (Formio.config.submitDone) {
|
|
145
|
+
Formio.config.submitDone(submission, instance);
|
|
146
|
+
}
|
|
141
147
|
const successMessage = (Formio.config.success || '').toString();
|
|
142
148
|
if (successMessage && successMessage.toLowerCase() !== 'false' && instance.element) {
|
|
143
149
|
instance.element.innerHTML = `<div class="alert-success" role="alert">${successMessage}</div>`;
|
|
@@ -177,20 +183,21 @@ export class Formio {
|
|
|
177
183
|
}
|
|
178
184
|
return script;
|
|
179
185
|
}
|
|
180
|
-
static async addLibrary(
|
|
186
|
+
static async addLibrary(libWrapper, lib, name) {
|
|
181
187
|
if (!lib) {
|
|
182
188
|
return;
|
|
183
189
|
}
|
|
184
190
|
if (lib.dependencies) {
|
|
185
191
|
for (let i = 0; i < lib.dependencies.length; i++) {
|
|
186
|
-
|
|
192
|
+
const libName = lib.dependencies[i];
|
|
193
|
+
await Formio.addLibrary(libWrapper, Formio.config.libs[libName], libName);
|
|
187
194
|
}
|
|
188
195
|
}
|
|
189
196
|
if (lib.css) {
|
|
190
|
-
await Formio.addStyles(
|
|
197
|
+
await Formio.addStyles((lib.global ? document.body : libWrapper), lib.css);
|
|
191
198
|
}
|
|
192
199
|
if (lib.js) {
|
|
193
|
-
const module = await Formio.addScript(
|
|
200
|
+
const module = await Formio.addScript((lib.global ? document.body : libWrapper), lib.js, lib.use ? name : false);
|
|
194
201
|
if (lib.use) {
|
|
195
202
|
Formio.debug(`Using ${name}`);
|
|
196
203
|
const options = lib.options || {};
|
|
@@ -200,6 +207,12 @@ export class Formio {
|
|
|
200
207
|
Formio.use((typeof lib.use === 'function' ? lib.use(module) : module), options);
|
|
201
208
|
}
|
|
202
209
|
}
|
|
210
|
+
if (lib.globalStyle) {
|
|
211
|
+
const style = Formio.createElement('style');
|
|
212
|
+
style.type = 'text/css';
|
|
213
|
+
style.innerHTML = lib.globalStyle;
|
|
214
|
+
document.body.appendChild(style);
|
|
215
|
+
}
|
|
203
216
|
}
|
|
204
217
|
static async addLoader(wrapper) {
|
|
205
218
|
wrapper.appendChild(Formio.createElement('div', {
|
|
@@ -228,7 +241,16 @@ export class Formio {
|
|
|
228
241
|
use: true
|
|
229
242
|
},
|
|
230
243
|
fontawesome: {
|
|
231
|
-
|
|
244
|
+
// Due to an issue with font-face not loading in the shadowdom (https://issues.chromium.org/issues/41085401), we need
|
|
245
|
+
// to do 2 things. 1.) Load the fonts from the global cdn, and 2.) add the font-face to the global styles on the page.
|
|
246
|
+
css: `https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css`,
|
|
247
|
+
globalStyle: `@font-face {
|
|
248
|
+
font-family: 'FontAwesome';
|
|
249
|
+
src: url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.eot?v=4.7.0');
|
|
250
|
+
src: url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'), url('https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
|
|
251
|
+
font-weight: normal;
|
|
252
|
+
font-style: normal;
|
|
253
|
+
}`
|
|
232
254
|
},
|
|
233
255
|
bootstrap4: {
|
|
234
256
|
dependencies: ['fontawesome'],
|
|
@@ -239,9 +261,24 @@ export class Formio {
|
|
|
239
261
|
css: `${Formio.cdn.bootstrap}/css/bootstrap.min.css`
|
|
240
262
|
},
|
|
241
263
|
'bootstrap-icons': {
|
|
242
|
-
|
|
264
|
+
// Due to an issue with font-face not loading in the shadowdom (https://issues.chromium.org/issues/41085401), we need
|
|
265
|
+
// to do 2 things. 1.) Load the fonts from the global cdn, and 2.) add the font-face to the global styles on the page.
|
|
266
|
+
css: 'https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.min.css',
|
|
267
|
+
globalStyle: `@font-face {
|
|
268
|
+
font-display: block;
|
|
269
|
+
font-family: "bootstrap-icons";
|
|
270
|
+
src: url("https://cdn.jsdelivr.net/npm/bootstrap-icons/font/fonts/bootstrap-icons.woff2?dd67030699838ea613ee6dbda90effa6") format("woff2"),
|
|
271
|
+
url("https://cdn.jsdelivr.net/npm/bootstrap-icons/font/fonts/bootstrap-icons.woff?dd67030699838ea613ee6dbda90effa6") format("woff");
|
|
272
|
+
}`
|
|
243
273
|
}
|
|
244
274
|
};
|
|
275
|
+
// Add all bootswatch templates.
|
|
276
|
+
['cerulean', 'cosmo', 'cyborg', 'darkly', 'flatly', 'journal', 'litera', 'lumen', 'lux', 'materia', 'minty', 'pulse', 'sandstone', 'simplex', 'sketchy', 'slate', 'solar', 'spacelab', 'superhero', 'united', 'yeti'].forEach((template) => {
|
|
277
|
+
Formio.config.libs[template] = {
|
|
278
|
+
dependencies: ['bootstrap-icons'],
|
|
279
|
+
css: `${Formio.cdn.bootswatch}/dist/${template}/bootstrap.min.css`
|
|
280
|
+
};
|
|
281
|
+
});
|
|
245
282
|
const id = Formio.config.id || `formio-${Math.random().toString(36).substring(7)}`;
|
|
246
283
|
// Create a new wrapper and add the element inside of a new wrapper.
|
|
247
284
|
let wrapper = Formio.createElement('div', {
|
|
@@ -249,7 +286,7 @@ export class Formio {
|
|
|
249
286
|
});
|
|
250
287
|
element.parentNode.insertBefore(wrapper, element);
|
|
251
288
|
// If we include the libraries, then we will attempt to run this in shadow dom.
|
|
252
|
-
const useShadowDom = Formio.config.includeLibs && (typeof wrapper.attachShadow === 'function');
|
|
289
|
+
const useShadowDom = Formio.config.includeLibs && !Formio.config.noshadow && (typeof wrapper.attachShadow === 'function');
|
|
253
290
|
if (useShadowDom) {
|
|
254
291
|
wrapper = wrapper.attachShadow({
|
|
255
292
|
mode: 'open'
|
|
@@ -285,14 +322,17 @@ export class Formio {
|
|
|
285
322
|
if (Formio.config.template && Formio.config.includeLibs) {
|
|
286
323
|
await Formio.addLibrary(libWrapper, Formio.config.libs[Formio.config.template], Formio.config.template);
|
|
287
324
|
}
|
|
288
|
-
|
|
325
|
+
if (!Formio.config.libraries) {
|
|
326
|
+
Formio.config.libraries = Formio.config.modules || {};
|
|
327
|
+
}
|
|
328
|
+
// Adding premium if it is provided via the config.
|
|
289
329
|
if (Formio.config.premium) {
|
|
290
|
-
Formio.config.
|
|
330
|
+
Formio.config.libraries.premium = Formio.config.premium;
|
|
291
331
|
}
|
|
292
332
|
// Allow adding dynamic modules.
|
|
293
|
-
if (Formio.config.
|
|
294
|
-
for (const name in Formio.config.
|
|
295
|
-
const lib = Formio.config.
|
|
333
|
+
if (Formio.config.libraries) {
|
|
334
|
+
for (const name in Formio.config.libraries) {
|
|
335
|
+
const lib = Formio.config.libraries[name];
|
|
296
336
|
lib.use = lib.use || true;
|
|
297
337
|
await Formio.addLibrary(libWrapper, lib, name);
|
|
298
338
|
}
|