@formio/js 5.0.0-dev.5636.99a32e6 → 5.0.0-dev.5641.6eb7b96
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 +45 -0
- 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.js +607 -1188
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -5
- package/dist/formio.full.js +651 -912
- 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 +180 -139
- package/lib/cjs/Webform.js +311 -297
- package/lib/cjs/WebformBuilder.d.ts +16 -14
- package/lib/cjs/WebformBuilder.js +19 -12
- 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 +502 -269
- 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 +434 -193
- 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/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 +2 -2
- 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/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 +22 -48
- 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 +15 -20
- 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/form/Form.d.ts +31 -20
- 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 +16 -12
- 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 +3 -4
- 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 +14 -17
- 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 +1 -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 +14 -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 +72 -0
- 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/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 +370 -218
- package/lib/cjs/utils/utils.js +348 -230
- 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 +180 -139
- package/lib/mjs/Webform.js +323 -309
- package/lib/mjs/WebformBuilder.d.ts +16 -14
- package/lib/mjs/WebformBuilder.js +19 -12
- 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 +502 -269
- 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 +434 -193
- 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/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 +2 -2
- 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/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 +22 -48
- 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 +15 -20
- 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/form/Form.d.ts +31 -20
- 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 +16 -12
- 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 +3 -4
- 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 +15 -18
- 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 +1 -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 +14 -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 +72 -0
- 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/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 +370 -218
- package/lib/mjs/utils/utils.js +339 -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/cjs/utils/utils.js
CHANGED
|
@@ -30,8 +30,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
30
30
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.
|
|
34
|
-
exports.isSelectResourceWithObjectValue = exports.getItemTemplateKeys = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = void 0;
|
|
33
|
+
exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.removeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getScriptPlugin = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
|
|
34
|
+
exports.isSelectResourceWithObjectValue = exports.getItemTemplateKeys = exports.interpolateErrors = exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.isChildOf = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = exports.observeOverload = exports.withSwitch = void 0;
|
|
35
35
|
const lodash_1 = __importDefault(require("lodash"));
|
|
36
36
|
exports._ = lodash_1.default;
|
|
37
37
|
const fetch_ponyfill_1 = __importDefault(require("fetch-ponyfill"));
|
|
@@ -42,11 +42,11 @@ const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
|
|
|
42
42
|
const operators_1 = require("./jsonlogic/operators");
|
|
43
43
|
const dompurify_1 = __importDefault(require("dompurify"));
|
|
44
44
|
const formUtils_1 = require("./formUtils");
|
|
45
|
-
const Evaluator_1 =
|
|
46
|
-
exports
|
|
45
|
+
const Evaluator_1 = require("./Evaluator");
|
|
46
|
+
Object.defineProperty(exports, "Evaluator", { enumerable: true, get: function () { return Evaluator_1.Evaluator; } });
|
|
47
47
|
const conditionOperators_1 = __importDefault(require("./conditionOperators"));
|
|
48
48
|
exports.ConditionOperators = conditionOperators_1.default;
|
|
49
|
-
const interpolate = Evaluator_1.
|
|
49
|
+
const interpolate = Evaluator_1.Evaluator.interpolate;
|
|
50
50
|
exports.interpolate = interpolate;
|
|
51
51
|
const { fetch } = (0, fetch_ponyfill_1.default)({
|
|
52
52
|
Promise: Promise
|
|
@@ -67,6 +67,10 @@ json_logic_js_1.default.add_operation('relativeMaxDate', (relativeMaxDate) => {
|
|
|
67
67
|
return (0, moment_timezone_1.default)().add(relativeMaxDate, 'days').toISOString();
|
|
68
68
|
});
|
|
69
69
|
exports.moment = __importStar(require("moment-timezone/moment-timezone"));
|
|
70
|
+
/**
|
|
71
|
+
* Sets the path to the component and parent schema.
|
|
72
|
+
* @param {import('@formio/core').Component} component - The component to set the path for.
|
|
73
|
+
*/
|
|
70
74
|
function setPathToComponentAndPerentSchema(component) {
|
|
71
75
|
component.path = getComponentPath(component);
|
|
72
76
|
const dataParent = getDataParentComponent(component);
|
|
@@ -76,79 +80,30 @@ function setPathToComponentAndPerentSchema(component) {
|
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* Evaluate a method.
|
|
79
|
-
*
|
|
80
|
-
* @param
|
|
81
|
-
* @param
|
|
82
|
-
* @
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
args.form = lodash_1.default.get(args.instance, 'root._form', {});
|
|
89
|
-
}
|
|
90
|
-
const componentKey = component.key;
|
|
91
|
-
if (typeof func === 'string') {
|
|
92
|
-
if (ret) {
|
|
93
|
-
func += `;return ${ret}`;
|
|
94
|
-
}
|
|
95
|
-
if (tokenize) {
|
|
96
|
-
// Replace all {{ }} references with actual data.
|
|
97
|
-
func = func.replace(/({{\s+(.*)\s+}})/, (match, $1, $2) => {
|
|
98
|
-
if ($2.indexOf('data.') === 0) {
|
|
99
|
-
return lodash_1.default.get(args.data, $2.replace('data.', ''));
|
|
100
|
-
}
|
|
101
|
-
else if ($2.indexOf('row.') === 0) {
|
|
102
|
-
return lodash_1.default.get(args.row, $2.replace('row.', ''));
|
|
103
|
-
}
|
|
104
|
-
// Support legacy...
|
|
105
|
-
return lodash_1.default.get(args.data, $2);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
try {
|
|
109
|
-
func = Evaluator_1.default.evaluator(func, args);
|
|
110
|
-
args = lodash_1.default.values(args);
|
|
111
|
-
}
|
|
112
|
-
catch (err) {
|
|
113
|
-
console.warn(`An error occured within the custom function for ${componentKey}`, err);
|
|
114
|
-
returnVal = null;
|
|
115
|
-
func = false;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
if (typeof func === 'function') {
|
|
119
|
-
try {
|
|
120
|
-
returnVal = Evaluator_1.default.evaluate(func, args);
|
|
121
|
-
}
|
|
122
|
-
catch (err) {
|
|
123
|
-
returnVal = null;
|
|
124
|
-
console.warn(`An error occured within custom function for ${componentKey}`, err);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
else if (typeof func === 'object') {
|
|
128
|
-
try {
|
|
129
|
-
returnVal = json_logic_js_1.default.apply(func, args);
|
|
130
|
-
}
|
|
131
|
-
catch (err) {
|
|
132
|
-
returnVal = null;
|
|
133
|
-
console.warn(`An error occured within custom function for ${componentKey}`, err);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
else if (func) {
|
|
137
|
-
console.warn(`Unknown function type for ${componentKey}`);
|
|
138
|
-
}
|
|
139
|
-
return returnVal;
|
|
83
|
+
* @param {Function|string|object} func - The function to evaluate.
|
|
84
|
+
* @param {*} args - A map of arguments to pass to the function.
|
|
85
|
+
* @param {string} ret - The name of the "return" variable in the script.
|
|
86
|
+
* @param {boolean} interpolate - True if the script should be interpolated before being executed.
|
|
87
|
+
* @param {import('@formio/core').EvaluatorOptions} options - The evaluator options.
|
|
88
|
+
* @returns {*} - The result of the evaluation.
|
|
89
|
+
*/
|
|
90
|
+
function evaluate(func, args, ret, interpolate, options = {}) {
|
|
91
|
+
return Evaluator_1.Evaluator.evaluate(func, args, ret, interpolate, undefined, options);
|
|
140
92
|
}
|
|
141
93
|
exports.evaluate = evaluate;
|
|
94
|
+
/**
|
|
95
|
+
* Returns a random compoennt ID.
|
|
96
|
+
* @returns {string} - A random component ID.
|
|
97
|
+
*/
|
|
142
98
|
function getRandomComponentId() {
|
|
143
99
|
return `e${Math.random().toString(36).substring(7)}`;
|
|
144
100
|
}
|
|
145
101
|
exports.getRandomComponentId = getRandomComponentId;
|
|
146
102
|
/**
|
|
147
103
|
* Get a property value of an element.
|
|
148
|
-
*
|
|
149
|
-
* @param
|
|
150
|
-
* @
|
|
151
|
-
* @return {number}
|
|
104
|
+
* @param {CSSStyleDeclaration} style - The style element to get the property value from.
|
|
105
|
+
* @param {string} prop - The property to get the value for.
|
|
106
|
+
* @returns {number} - The value of the property.
|
|
152
107
|
*/
|
|
153
108
|
function getPropertyValue(style, prop) {
|
|
154
109
|
let value = style.getPropertyValue(prop);
|
|
@@ -158,9 +113,8 @@ function getPropertyValue(style, prop) {
|
|
|
158
113
|
exports.getPropertyValue = getPropertyValue;
|
|
159
114
|
/**
|
|
160
115
|
* Get an elements bounding rectagle.
|
|
161
|
-
*
|
|
162
|
-
* @
|
|
163
|
-
* @return {{x: string, y: string, width: string, height: string}}
|
|
116
|
+
* @param {HTMLElement} element - A DOM element to get the bounding rectangle for.
|
|
117
|
+
* @returns {{x: number, y: number, width: number, height: number}} - The bounding rectangle.
|
|
164
118
|
*/
|
|
165
119
|
function getElementRect(element) {
|
|
166
120
|
const style = window.getComputedStyle(element, null);
|
|
@@ -174,8 +128,8 @@ function getElementRect(element) {
|
|
|
174
128
|
exports.getElementRect = getElementRect;
|
|
175
129
|
/**
|
|
176
130
|
* Get non HTMLElement property in the window object
|
|
177
|
-
* @param {
|
|
178
|
-
* @
|
|
131
|
+
* @param {string} property - The window property to fetch the script plugin from.
|
|
132
|
+
* @returns {any | undefined} - The HTML Element property on the window object.
|
|
179
133
|
*/
|
|
180
134
|
function getScriptPlugin(property) {
|
|
181
135
|
const obj = window[property];
|
|
@@ -188,9 +142,8 @@ function getScriptPlugin(property) {
|
|
|
188
142
|
exports.getScriptPlugin = getScriptPlugin;
|
|
189
143
|
/**
|
|
190
144
|
* Determines the boolean value of a setting.
|
|
191
|
-
*
|
|
192
|
-
* @
|
|
193
|
-
* @return {boolean}
|
|
145
|
+
* @param {string|boolean} value - A string or boolean value to convert to boolean.
|
|
146
|
+
* @returns {boolean} - The boolean value of the setting.
|
|
194
147
|
*/
|
|
195
148
|
function boolValue(value) {
|
|
196
149
|
if (lodash_1.default.isBoolean(value)) {
|
|
@@ -206,22 +159,18 @@ function boolValue(value) {
|
|
|
206
159
|
exports.boolValue = boolValue;
|
|
207
160
|
/**
|
|
208
161
|
* Check to see if an ID is a mongoID.
|
|
209
|
-
* @param text
|
|
210
|
-
* @
|
|
162
|
+
* @param {string} text - The text to check if it is a mongoID.
|
|
163
|
+
* @returns {boolean} - TRUE if the text is a mongoID; FALSE otherwise.
|
|
211
164
|
*/
|
|
212
165
|
function isMongoId(text) {
|
|
213
|
-
return text.toString().match(/^[0-9a-fA-F]{24}$/);
|
|
166
|
+
return !!text.toString().match(/^[0-9a-fA-F]{24}$/);
|
|
214
167
|
}
|
|
215
168
|
exports.isMongoId = isMongoId;
|
|
216
169
|
/**
|
|
217
170
|
* Checks the calculated value for a provided component and data.
|
|
218
|
-
*
|
|
219
|
-
* @param {
|
|
220
|
-
*
|
|
221
|
-
* @param {Object} submission
|
|
222
|
-
* A submission object.
|
|
223
|
-
* @param data
|
|
224
|
-
* The full submission data.
|
|
171
|
+
* @param {import('@formio/core').Component} component - The component to check for the calculated value.
|
|
172
|
+
* @param {import('@formio/core').Submission} submission - A submission object.
|
|
173
|
+
* @param {*} rowData - The contextual row data for the component.
|
|
225
174
|
*/
|
|
226
175
|
function checkCalculated(component, submission, rowData) {
|
|
227
176
|
// Process calculated value stuff if present.
|
|
@@ -238,13 +187,12 @@ function checkCalculated(component, submission, rowData) {
|
|
|
238
187
|
exports.checkCalculated = checkCalculated;
|
|
239
188
|
/**
|
|
240
189
|
* Check if a simple conditional evaluates to true.
|
|
241
|
-
*
|
|
242
|
-
* @param condition
|
|
243
|
-
* @param
|
|
244
|
-
* @param
|
|
245
|
-
* @param
|
|
246
|
-
* @
|
|
247
|
-
* @returns {boolean}
|
|
190
|
+
* @param {import('@formio/core').Component} component - The component to check for the conditional.
|
|
191
|
+
* @param {import('@formio/core').SimpleConditional} condition - The condition to check.
|
|
192
|
+
* @param {*} row - The row data for the component.
|
|
193
|
+
* @param {*} data - The full submission data.
|
|
194
|
+
* @param {import('../../src/components/_classes/component/Component').Component} instance - The instance of the component.
|
|
195
|
+
* @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
|
|
248
196
|
*/
|
|
249
197
|
function checkSimpleConditional(component, condition, row, data, instance) {
|
|
250
198
|
if (condition.when) {
|
|
@@ -289,6 +237,13 @@ function checkSimpleConditional(component, condition, row, data, instance) {
|
|
|
289
237
|
}
|
|
290
238
|
}
|
|
291
239
|
exports.checkSimpleConditional = checkSimpleConditional;
|
|
240
|
+
/**
|
|
241
|
+
* Returns a components normalized value.
|
|
242
|
+
* @param {string} compPath - The full path to the component.
|
|
243
|
+
* @param {*} data - The data object to get the value from.
|
|
244
|
+
* @param {*} row - The contextual row data for the component.
|
|
245
|
+
* @returns {*} - The normalized value of the component.
|
|
246
|
+
*/
|
|
292
247
|
function getComponentActualValue(compPath, data, row) {
|
|
293
248
|
let value = null;
|
|
294
249
|
if (row) {
|
|
@@ -306,12 +261,15 @@ function getComponentActualValue(compPath, data, row) {
|
|
|
306
261
|
exports.getComponentActualValue = getComponentActualValue;
|
|
307
262
|
/**
|
|
308
263
|
* Check custom javascript conditional.
|
|
309
|
-
*
|
|
310
|
-
* @param
|
|
311
|
-
* @param
|
|
312
|
-
* @param
|
|
313
|
-
* @param
|
|
314
|
-
* @
|
|
264
|
+
* @param {import('@formio/core').Component} component - The component to check for the conditional.
|
|
265
|
+
* @param {string} custom - The custom conditional string to evaluate.
|
|
266
|
+
* @param {*} row - The row data for the component.
|
|
267
|
+
* @param {*} data - The full submission data.
|
|
268
|
+
* @param {import('@formio/core').Form} form - The form object.
|
|
269
|
+
* @param {string} variable - The variable name for the result of the custom conditional.
|
|
270
|
+
* @param {*} onError - A custom return if there is an error or the value is null from the evaluation.
|
|
271
|
+
* @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
|
|
272
|
+
* @returns {*} - The result of the evaulation.
|
|
315
273
|
*/
|
|
316
274
|
function checkCustomConditional(component, custom, row, data, form, variable, onError, instance) {
|
|
317
275
|
if (typeof custom === 'string') {
|
|
@@ -326,6 +284,16 @@ function checkCustomConditional(component, custom, row, data, form, variable, on
|
|
|
326
284
|
return value;
|
|
327
285
|
}
|
|
328
286
|
exports.checkCustomConditional = checkCustomConditional;
|
|
287
|
+
/**
|
|
288
|
+
* Check a component for JSON conditionals.
|
|
289
|
+
* @param {import('@formio/core').Component} component - The component
|
|
290
|
+
* @param {import('@formio/core').JSONConditional} json - The json conditional to check.
|
|
291
|
+
* @param {*} row - The contextual row data for the component.
|
|
292
|
+
* @param {*} data - The full submission data.
|
|
293
|
+
* @param {import('@formio/core').Form} form - The Form JSON of the form.
|
|
294
|
+
* @param {*} onError - Custom return value if there is an error.
|
|
295
|
+
* @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
|
|
296
|
+
*/
|
|
329
297
|
function checkJsonConditional(component, json, row, data, form, onError) {
|
|
330
298
|
try {
|
|
331
299
|
return json_logic_js_1.default.apply(json, {
|
|
@@ -341,6 +309,14 @@ function checkJsonConditional(component, json, row, data, form, onError) {
|
|
|
341
309
|
}
|
|
342
310
|
}
|
|
343
311
|
exports.checkJsonConditional = checkJsonConditional;
|
|
312
|
+
/**
|
|
313
|
+
* Returns the contextual row data for a component.
|
|
314
|
+
* @param {import('@formio/core').Component} component - The component to get the row data for.
|
|
315
|
+
* @param {*} row - The row data for the component.
|
|
316
|
+
* @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
|
|
317
|
+
* @param {*} conditional - The component conditional.
|
|
318
|
+
* @returns {*} - The contextual row data for the component.
|
|
319
|
+
*/
|
|
344
320
|
function getRow(component, row, instance, conditional) {
|
|
345
321
|
var _a;
|
|
346
322
|
const condition = conditional || component.conditional;
|
|
@@ -363,15 +339,12 @@ function getRow(component, row, instance, conditional) {
|
|
|
363
339
|
}
|
|
364
340
|
/**
|
|
365
341
|
* Checks the conditions for a provided component and data.
|
|
366
|
-
*
|
|
367
|
-
* @param
|
|
368
|
-
*
|
|
369
|
-
* @param
|
|
370
|
-
*
|
|
371
|
-
* @
|
|
372
|
-
* The full submission data.
|
|
373
|
-
*
|
|
374
|
-
* @returns {boolean}
|
|
342
|
+
* @param {import('@formio/core').Component} component - The component to check for the condition.
|
|
343
|
+
* @param {*} row - The data within a row
|
|
344
|
+
* @param {*} data - The full submission data.
|
|
345
|
+
* @param {import('@formio/core').Form} form - The form object.
|
|
346
|
+
* @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
|
|
347
|
+
* @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
|
|
375
348
|
*/
|
|
376
349
|
function checkCondition(component, row, data, form, instance) {
|
|
377
350
|
const { customConditional, conditional } = component;
|
|
@@ -391,12 +364,13 @@ function checkCondition(component, row, data, form, instance) {
|
|
|
391
364
|
exports.checkCondition = checkCondition;
|
|
392
365
|
/**
|
|
393
366
|
* Test a trigger on a component.
|
|
394
|
-
*
|
|
395
|
-
* @param
|
|
396
|
-
* @param
|
|
397
|
-
* @param data
|
|
398
|
-
* @param
|
|
399
|
-
* @
|
|
367
|
+
* @param {import('@formio/core').Component} component - The component to test the trigger against.
|
|
368
|
+
* @param {import('@formio/core').LogicTrigger} trigger - The trigger configuration.
|
|
369
|
+
* @param {import('@formio/core').DataObject} row - The contextual row data.
|
|
370
|
+
* @param {import('@formio/core').DataObject} data - The root data object.
|
|
371
|
+
* @param {import('@formio/core').Form} form - The form object.
|
|
372
|
+
* @param {any} instance - The component that is performing the trigger.
|
|
373
|
+
* @returns {boolean} - TRUE if the trigger should fire; FALSE otherwise.
|
|
400
374
|
*/
|
|
401
375
|
function checkTrigger(component, trigger, row, data, form, instance) {
|
|
402
376
|
// If trigger is empty, don't fire it
|
|
@@ -416,6 +390,16 @@ function checkTrigger(component, trigger, row, data, form, instance) {
|
|
|
416
390
|
return false;
|
|
417
391
|
}
|
|
418
392
|
exports.checkTrigger = checkTrigger;
|
|
393
|
+
/**
|
|
394
|
+
* Sets a property on a component via an executed Logic action.
|
|
395
|
+
* @param {import('@formio/core').Component} component - The component to set the property on.
|
|
396
|
+
* @param {import('@formio/core').LogicAction} action - The action to perform on the component.
|
|
397
|
+
* @param {string} result - The name of the variable in the evaulation to use as the result.
|
|
398
|
+
* @param {import('@formio/core').DataObject} row - The contextual row data.
|
|
399
|
+
* @param {import('@formio/core').DataObject} data - The full submission data.
|
|
400
|
+
* @param {any} instance - The component instance.
|
|
401
|
+
* @returns {import('@formio/core').Component} - The modified component.
|
|
402
|
+
*/
|
|
419
403
|
function setActionProperty(component, action, result, row, data, instance) {
|
|
420
404
|
const property = action.property.value;
|
|
421
405
|
switch (action.property.type) {
|
|
@@ -438,7 +422,7 @@ function setActionProperty(component, action, result, row, data, instance) {
|
|
|
438
422
|
const currentValue = lodash_1.default.get(component, property, '');
|
|
439
423
|
const newValue = (instance && instance.interpolate)
|
|
440
424
|
? instance.interpolate(textValue, evalData)
|
|
441
|
-
: Evaluator_1.
|
|
425
|
+
: Evaluator_1.Evaluator.interpolate(textValue, evalData);
|
|
442
426
|
if (newValue !== currentValue) {
|
|
443
427
|
lodash_1.default.set(component, property, newValue);
|
|
444
428
|
}
|
|
@@ -448,24 +432,35 @@ function setActionProperty(component, action, result, row, data, instance) {
|
|
|
448
432
|
return component;
|
|
449
433
|
}
|
|
450
434
|
exports.setActionProperty = setActionProperty;
|
|
435
|
+
/**
|
|
436
|
+
* Removes HTML tags from string e.g. <div>Hello World</div> => Hello World
|
|
437
|
+
* @param {string} str - The string to remove HTML tags from.
|
|
438
|
+
* @returns {string} - The string without HTML tags.
|
|
439
|
+
*/
|
|
440
|
+
function removeHTML(str) {
|
|
441
|
+
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
442
|
+
return (doc.body.textContent || '').trim();
|
|
443
|
+
}
|
|
444
|
+
exports.removeHTML = removeHTML;
|
|
451
445
|
/**
|
|
452
446
|
* Unescape HTML characters like <, >, & and etc.
|
|
453
|
-
* @param str
|
|
454
|
-
* @returns {string}
|
|
447
|
+
* @param {string} str - The string to unescape.
|
|
448
|
+
* @returns {string} - The unescaped string.
|
|
455
449
|
*/
|
|
456
450
|
function unescapeHTML(str) {
|
|
457
451
|
if (typeof window === 'undefined' || !('DOMParser' in window)) {
|
|
458
452
|
return str;
|
|
459
453
|
}
|
|
460
|
-
const
|
|
461
|
-
|
|
454
|
+
const elem = document.createElement('textarea');
|
|
455
|
+
elem.innerHTML = str;
|
|
456
|
+
return elem.value;
|
|
462
457
|
}
|
|
463
458
|
exports.unescapeHTML = unescapeHTML;
|
|
464
459
|
/**
|
|
465
460
|
* Make HTML element from string
|
|
466
|
-
* @param str
|
|
467
|
-
* @param selector
|
|
468
|
-
* @returns {HTMLElement}
|
|
461
|
+
* @param {string} str - The string to convert to an HTML element.
|
|
462
|
+
* @param {string} selector - The selector to use to get the element once it is created.
|
|
463
|
+
* @returns {HTMLElement} - The HTML element that was created.
|
|
469
464
|
*/
|
|
470
465
|
function convertStringToHTMLElement(str, selector) {
|
|
471
466
|
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
@@ -474,10 +469,10 @@ function convertStringToHTMLElement(str, selector) {
|
|
|
474
469
|
exports.convertStringToHTMLElement = convertStringToHTMLElement;
|
|
475
470
|
/**
|
|
476
471
|
* Make a filename guaranteed to be unique.
|
|
477
|
-
* @param name
|
|
478
|
-
* @param template
|
|
479
|
-
* @param evalContext
|
|
480
|
-
* @returns {string}
|
|
472
|
+
* @param {string} name - The original name of the file.
|
|
473
|
+
* @param {string} template - The template to use for the unique name.
|
|
474
|
+
* @param {object} evalContext - The context to use for the evaluation.
|
|
475
|
+
* @returns {string} - A unique filename.
|
|
481
476
|
*/
|
|
482
477
|
function uniqueName(name, template, evalContext) {
|
|
483
478
|
template = template || '{{fileName}}-{{guid}}';
|
|
@@ -497,10 +492,14 @@ function uniqueName(name, template, evalContext) {
|
|
|
497
492
|
guid: guid()
|
|
498
493
|
});
|
|
499
494
|
//only letters, numbers, dots, dashes, underscores and spaces are allowed. Anything else will be replaced with dash
|
|
500
|
-
const uniqueName = `${Evaluator_1.
|
|
495
|
+
const uniqueName = `${Evaluator_1.Evaluator.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\-_ ]/g, '-');
|
|
501
496
|
return uniqueName;
|
|
502
497
|
}
|
|
503
498
|
exports.uniqueName = uniqueName;
|
|
499
|
+
/**
|
|
500
|
+
* Returns a GUID
|
|
501
|
+
* @returns {string} - A GUID.
|
|
502
|
+
*/
|
|
504
503
|
function guid() {
|
|
505
504
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
506
505
|
const r = Math.random() * 16 | 0;
|
|
@@ -513,9 +512,8 @@ function guid() {
|
|
|
513
512
|
exports.guid = guid;
|
|
514
513
|
/**
|
|
515
514
|
* Return a translated date setting.
|
|
516
|
-
*
|
|
517
|
-
* @
|
|
518
|
-
* @return {(null|Date)}
|
|
515
|
+
* @param {string|Date} date - The date to translate.
|
|
516
|
+
* @returns {(null|Date)} - The translated date.
|
|
519
517
|
*/
|
|
520
518
|
function getDateSetting(date) {
|
|
521
519
|
if (lodash_1.default.isNil(date) || lodash_1.default.isNaN(date) || date === '') {
|
|
@@ -533,7 +531,7 @@ function getDateSetting(date) {
|
|
|
533
531
|
}
|
|
534
532
|
dateSetting = null;
|
|
535
533
|
try {
|
|
536
|
-
const value = Evaluator_1.
|
|
534
|
+
const value = Evaluator_1.Evaluator.evaluator(`return ${date};`, 'moment')(moment_timezone_1.default);
|
|
537
535
|
if (typeof value === 'string') {
|
|
538
536
|
dateSetting = (0, moment_timezone_1.default)(value);
|
|
539
537
|
}
|
|
@@ -557,14 +555,18 @@ function getDateSetting(date) {
|
|
|
557
555
|
return dateSetting.toDate();
|
|
558
556
|
}
|
|
559
557
|
exports.getDateSetting = getDateSetting;
|
|
558
|
+
/**
|
|
559
|
+
* Returns true if the date is a valid date. False otherwise.
|
|
560
|
+
* @param {Date|string} date - The date to check for validity.
|
|
561
|
+
* @returns {boolean} - TRUE if the date is valid; FALSE otherwise.
|
|
562
|
+
*/
|
|
560
563
|
function isValidDate(date) {
|
|
561
564
|
return lodash_1.default.isDate(date) && !lodash_1.default.isNaN(date.getDate());
|
|
562
565
|
}
|
|
563
566
|
exports.isValidDate = isValidDate;
|
|
564
567
|
/**
|
|
565
568
|
* Get the current timezone string.
|
|
566
|
-
*
|
|
567
|
-
* @return {string}
|
|
569
|
+
* @returns {string} - The current timezone.
|
|
568
570
|
*/
|
|
569
571
|
function currentTimezone() {
|
|
570
572
|
if (moment_timezone_1.default.currentTimezone) {
|
|
@@ -576,10 +578,9 @@ function currentTimezone() {
|
|
|
576
578
|
exports.currentTimezone = currentTimezone;
|
|
577
579
|
/**
|
|
578
580
|
* Get an offset date provided a date object and timezone object.
|
|
579
|
-
*
|
|
580
|
-
* @param date
|
|
581
|
-
* @
|
|
582
|
-
* @return {Date}
|
|
581
|
+
* @param {Date} date - The date to offset.
|
|
582
|
+
* @param {string} timezone - The timezone to offset the date to.
|
|
583
|
+
* @returns {Date} - The offset date.
|
|
583
584
|
*/
|
|
584
585
|
function offsetDate(date, timezone) {
|
|
585
586
|
if (timezone === 'UTC') {
|
|
@@ -597,8 +598,7 @@ function offsetDate(date, timezone) {
|
|
|
597
598
|
exports.offsetDate = offsetDate;
|
|
598
599
|
/**
|
|
599
600
|
* Returns if the zones are loaded.
|
|
600
|
-
*
|
|
601
|
-
* @return {boolean}
|
|
601
|
+
* @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
|
|
602
602
|
*/
|
|
603
603
|
function zonesLoaded() {
|
|
604
604
|
return moment_timezone_1.default.zonesLoaded;
|
|
@@ -606,9 +606,8 @@ function zonesLoaded() {
|
|
|
606
606
|
exports.zonesLoaded = zonesLoaded;
|
|
607
607
|
/**
|
|
608
608
|
* Returns if we should load the zones.
|
|
609
|
-
*
|
|
610
|
-
* @
|
|
611
|
-
* @return {boolean}
|
|
609
|
+
* @param {string} timezone - The timezone to check if we should load the zones.
|
|
610
|
+
* @returns {boolean} - TRUE if we should load the zones; FALSE otherwise.
|
|
612
611
|
*/
|
|
613
612
|
function shouldLoadZones(timezone) {
|
|
614
613
|
if (timezone === currentTimezone() || timezone === 'UTC') {
|
|
@@ -619,8 +618,9 @@ function shouldLoadZones(timezone) {
|
|
|
619
618
|
exports.shouldLoadZones = shouldLoadZones;
|
|
620
619
|
/**
|
|
621
620
|
* Externally load the timezone data.
|
|
622
|
-
*
|
|
623
|
-
* @
|
|
621
|
+
* @param {string} url - The URL to load the timezone data from.
|
|
622
|
+
* @param {string} timezone - The timezone to load.
|
|
623
|
+
* @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
|
|
624
624
|
*/
|
|
625
625
|
function loadZones(url, timezone) {
|
|
626
626
|
if (timezone && !shouldLoadZones(timezone)) {
|
|
@@ -645,11 +645,10 @@ function loadZones(url, timezone) {
|
|
|
645
645
|
exports.loadZones = loadZones;
|
|
646
646
|
/**
|
|
647
647
|
* Get the moment date object for translating dates with timezones.
|
|
648
|
-
*
|
|
649
|
-
* @param
|
|
650
|
-
* @param
|
|
651
|
-
* @
|
|
652
|
-
* @return {*}
|
|
648
|
+
* @param {string|Date} value - The value to convert into a moment date.
|
|
649
|
+
* @param {string} format - The format to convert the date to.
|
|
650
|
+
* @param {string} timezone - The timezone to convert the date to.
|
|
651
|
+
* @returns {Date} - The moment date object.
|
|
653
652
|
*/
|
|
654
653
|
function momentDate(value, format, timezone) {
|
|
655
654
|
const momentDate = (0, moment_timezone_1.default)(value);
|
|
@@ -667,11 +666,12 @@ function momentDate(value, format, timezone) {
|
|
|
667
666
|
exports.momentDate = momentDate;
|
|
668
667
|
/**
|
|
669
668
|
* Format a date provided a value, format, and timezone object.
|
|
670
|
-
*
|
|
671
|
-
* @param value
|
|
672
|
-
* @param format
|
|
673
|
-
* @param timezone
|
|
674
|
-
* @
|
|
669
|
+
* @param {string} timezonesUrl - The URL to load the timezone data from.
|
|
670
|
+
* @param {string|Date} value - The value to format.
|
|
671
|
+
* @param {string} format - The format to format the date to.
|
|
672
|
+
* @param {string} timezone - The timezone to format the date to.
|
|
673
|
+
* @param {string} flatPickrInputFormat - The format to use for flatpickr input.
|
|
674
|
+
* @returns {string} - The formatted date.
|
|
675
675
|
*/
|
|
676
676
|
function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
|
|
677
677
|
const momentDate = (0, moment_timezone_1.default)(value, flatPickrInputFormat || undefined);
|
|
@@ -705,12 +705,12 @@ function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat)
|
|
|
705
705
|
exports.formatDate = formatDate;
|
|
706
706
|
/**
|
|
707
707
|
* Pass a format function to format within a timezone.
|
|
708
|
-
*
|
|
709
|
-
* @param formatFn
|
|
710
|
-
* @param date
|
|
711
|
-
* @param format
|
|
712
|
-
* @param timezone
|
|
713
|
-
* @
|
|
708
|
+
* @param {string} timezonesUrl - The URL to load the timezone data from.
|
|
709
|
+
* @param {Function} formatFn - The format function to use.
|
|
710
|
+
* @param {Date|string} date - The date to format.
|
|
711
|
+
* @param {string} format - The format to format the date to.
|
|
712
|
+
* @param {string} timezone - The timezone to format the date to.
|
|
713
|
+
* @returns {string} - The formatted date.
|
|
714
714
|
*/
|
|
715
715
|
function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
|
716
716
|
if (timezone === currentTimezone()) {
|
|
@@ -730,6 +730,11 @@ function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
exports.formatOffset = formatOffset;
|
|
733
|
+
/**
|
|
734
|
+
* Returns the local date format information.
|
|
735
|
+
* @param {Intl.LocalesArgument} locale - The locale to get the date format for.
|
|
736
|
+
* @returns {object} - The local date format information.
|
|
737
|
+
*/
|
|
733
738
|
function getLocaleDateFormatInfo(locale) {
|
|
734
739
|
const formatInfo = {};
|
|
735
740
|
const day = 21;
|
|
@@ -741,8 +746,8 @@ function getLocaleDateFormatInfo(locale) {
|
|
|
741
746
|
exports.getLocaleDateFormatInfo = getLocaleDateFormatInfo;
|
|
742
747
|
/**
|
|
743
748
|
* Convert the format from the angular-datepicker module to flatpickr format.
|
|
744
|
-
* @param format
|
|
745
|
-
* @
|
|
749
|
+
* @param {string} format - The format to convert.
|
|
750
|
+
* @returns {string} - The converted format.
|
|
746
751
|
*/
|
|
747
752
|
function convertFormatToFlatpickr(format) {
|
|
748
753
|
return format
|
|
@@ -773,8 +778,8 @@ function convertFormatToFlatpickr(format) {
|
|
|
773
778
|
exports.convertFormatToFlatpickr = convertFormatToFlatpickr;
|
|
774
779
|
/**
|
|
775
780
|
* Convert the format from the angular-datepicker module to moment format.
|
|
776
|
-
* @param format
|
|
777
|
-
* @
|
|
781
|
+
* @param {string} format - The format to convert.
|
|
782
|
+
* @returns {string} - The converted format.
|
|
778
783
|
*/
|
|
779
784
|
function convertFormatToMoment(format) {
|
|
780
785
|
return format
|
|
@@ -790,6 +795,11 @@ function convertFormatToMoment(format) {
|
|
|
790
795
|
.replace(/U/g, 'X');
|
|
791
796
|
}
|
|
792
797
|
exports.convertFormatToMoment = convertFormatToMoment;
|
|
798
|
+
/**
|
|
799
|
+
* Convert the format from the angular-datepicker module to mask format.
|
|
800
|
+
* @param {string} format - The format to convert.
|
|
801
|
+
* @returns {string} - The converted format.
|
|
802
|
+
*/
|
|
793
803
|
function convertFormatToMask(format) {
|
|
794
804
|
return format
|
|
795
805
|
// Long month replacement.
|
|
@@ -849,6 +859,13 @@ function getInputMask(mask, placeholderChar) {
|
|
|
849
859
|
return maskArray;
|
|
850
860
|
}
|
|
851
861
|
exports.getInputMask = getInputMask;
|
|
862
|
+
/**
|
|
863
|
+
* Unmasks a value using the provided mask and placeholder characters.
|
|
864
|
+
* @param {string} value - The value to unmask.
|
|
865
|
+
* @param {string} mask - The mask to use for unmasking.
|
|
866
|
+
* @param {string} placeholderChar - The placeholder character to use for unmasking.
|
|
867
|
+
* @returns {string} - The unmasked value.
|
|
868
|
+
*/
|
|
852
869
|
function unmaskValue(value, mask, placeholderChar) {
|
|
853
870
|
if (!mask || !value || value.length > mask.length) {
|
|
854
871
|
return value;
|
|
@@ -865,6 +882,12 @@ function unmaskValue(value, mask, placeholderChar) {
|
|
|
865
882
|
return unmaskedValue;
|
|
866
883
|
}
|
|
867
884
|
exports.unmaskValue = unmaskValue;
|
|
885
|
+
/**
|
|
886
|
+
* Returns true if the value matches the input mask format.
|
|
887
|
+
* @param {string} value - The value to check.
|
|
888
|
+
* @param {string} inputMask - The input mask to check against.
|
|
889
|
+
* @returns {boolean} - TRUE if the value matches the input mask; FALSE otherwise.
|
|
890
|
+
*/
|
|
868
891
|
function matchInputMask(value, inputMask) {
|
|
869
892
|
if (!inputMask) {
|
|
870
893
|
return true;
|
|
@@ -883,6 +906,11 @@ function matchInputMask(value, inputMask) {
|
|
|
883
906
|
return true;
|
|
884
907
|
}
|
|
885
908
|
exports.matchInputMask = matchInputMask;
|
|
909
|
+
/**
|
|
910
|
+
* Returns the number separators (i.e. 1,000) for the provided language.
|
|
911
|
+
* @param {string} lang - The language code to get the number separators for.
|
|
912
|
+
* @returns {{delimiter: string, decimalSeparator: string}} - The number separators.
|
|
913
|
+
*/
|
|
886
914
|
function getNumberSeparators(lang = 'en') {
|
|
887
915
|
const formattedNumberString = (12345.6789).toLocaleString(lang);
|
|
888
916
|
const delimeters = formattedNumberString.match(/..(.)...(.)../);
|
|
@@ -898,6 +926,12 @@ function getNumberSeparators(lang = 'en') {
|
|
|
898
926
|
};
|
|
899
927
|
}
|
|
900
928
|
exports.getNumberSeparators = getNumberSeparators;
|
|
929
|
+
/**
|
|
930
|
+
* Returns the number for the maximum amount of decimal places for a number.
|
|
931
|
+
* @param {import('@formio/core').Component} component - The component to check for decimal limits.
|
|
932
|
+
* @param {number} defaultLimit - The default limit to use if none is provided in the component.
|
|
933
|
+
* @returns {number} - The number of decimal places allowed.
|
|
934
|
+
*/
|
|
901
935
|
function getNumberDecimalLimit(component, defaultLimit) {
|
|
902
936
|
if (lodash_1.default.has(component, 'decimalLimit')) {
|
|
903
937
|
return lodash_1.default.get(component, 'decimalLimit');
|
|
@@ -914,6 +948,15 @@ function getNumberDecimalLimit(component, defaultLimit) {
|
|
|
914
948
|
return decimalLimit;
|
|
915
949
|
}
|
|
916
950
|
exports.getNumberDecimalLimit = getNumberDecimalLimit;
|
|
951
|
+
/**
|
|
952
|
+
* Returns the currency affixes for a specific language.
|
|
953
|
+
* @param {object} arg0 - The arguments object.
|
|
954
|
+
* @param {string} arg0.currency - The currency code to get the affixes for.
|
|
955
|
+
* @param {number} arg0.decimalLimit - The number of decimal places to use.
|
|
956
|
+
* @param {string} arg0.decimalSeparator - The decimal separator to use.
|
|
957
|
+
* @param {string} arg0.lang - The language code to use.
|
|
958
|
+
* @returns {{prefix: string, suffix: string}} - The currency affixes.
|
|
959
|
+
*/
|
|
917
960
|
function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
|
|
918
961
|
// Get the prefix and suffix from the localized string.
|
|
919
962
|
let regex = `(.*)?${(100).toLocaleString(lang)}`;
|
|
@@ -936,10 +979,9 @@ function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, })
|
|
|
936
979
|
exports.getCurrencyAffixes = getCurrencyAffixes;
|
|
937
980
|
/**
|
|
938
981
|
* Fetch the field data provided a component.
|
|
939
|
-
*
|
|
940
|
-
* @param data
|
|
941
|
-
* @
|
|
942
|
-
* @return {*}
|
|
982
|
+
* @param {import('@formio/core').DataObject} data - The data object to fetch the field data from.
|
|
983
|
+
* @param {import('@formio/core').Component} component - The component to fetch the field data for.
|
|
984
|
+
* @returns {*} - The field data.
|
|
943
985
|
*/
|
|
944
986
|
function fieldData(data, component) {
|
|
945
987
|
if (!data) {
|
|
@@ -986,16 +1028,23 @@ function fieldData(data, component) {
|
|
|
986
1028
|
exports.fieldData = fieldData;
|
|
987
1029
|
/**
|
|
988
1030
|
* Delays function execution with possibility to execute function synchronously or cancel it.
|
|
989
|
-
*
|
|
990
|
-
* @param
|
|
991
|
-
* @param
|
|
992
|
-
* @
|
|
1031
|
+
* @param {Function} fn - Function to delay
|
|
1032
|
+
* @param {number} delay - Delay time
|
|
1033
|
+
* @param {...any} args - Arguments to pass to the function
|
|
1034
|
+
* @returns {*} - Function to cancel the delay
|
|
993
1035
|
*/
|
|
994
1036
|
function delay(fn, delay = 0, ...args) {
|
|
995
1037
|
const timer = setTimeout(fn, delay, ...args);
|
|
1038
|
+
/**
|
|
1039
|
+
*
|
|
1040
|
+
*/
|
|
996
1041
|
function cancel() {
|
|
997
1042
|
clearTimeout(timer);
|
|
998
1043
|
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Execute the function early.
|
|
1046
|
+
* @returns {*} - The result of the function.
|
|
1047
|
+
*/
|
|
999
1048
|
function earlyCall() {
|
|
1000
1049
|
cancel();
|
|
1001
1050
|
return fn(...args);
|
|
@@ -1007,11 +1056,9 @@ function delay(fn, delay = 0, ...args) {
|
|
|
1007
1056
|
exports.delay = delay;
|
|
1008
1057
|
/**
|
|
1009
1058
|
* Iterate the given key to make it unique.
|
|
1010
|
-
*
|
|
1011
|
-
* @param {String} key
|
|
1059
|
+
* @param {string} key
|
|
1012
1060
|
* Modify the component key to be unique.
|
|
1013
|
-
*
|
|
1014
|
-
* @returns {String}
|
|
1061
|
+
* @returns {string}
|
|
1015
1062
|
* The new component key.
|
|
1016
1063
|
*/
|
|
1017
1064
|
function iterateKey(key) {
|
|
@@ -1025,10 +1072,9 @@ function iterateKey(key) {
|
|
|
1025
1072
|
exports.iterateKey = iterateKey;
|
|
1026
1073
|
/**
|
|
1027
1074
|
* Determines a unique key within a map provided the base key.
|
|
1028
|
-
*
|
|
1029
|
-
* @param
|
|
1030
|
-
* @
|
|
1031
|
-
* @return {*}
|
|
1075
|
+
* @param {Record<string, string>} map - The map to check for uniqueness.
|
|
1076
|
+
* @param {string} base - The base path of the key.
|
|
1077
|
+
* @returns {string} - The unique key.
|
|
1032
1078
|
*/
|
|
1033
1079
|
function uniqueKey(map, base) {
|
|
1034
1080
|
let newKey = base;
|
|
@@ -1040,8 +1086,9 @@ function uniqueKey(map, base) {
|
|
|
1040
1086
|
exports.uniqueKey = uniqueKey;
|
|
1041
1087
|
/**
|
|
1042
1088
|
* Determines the major version number of bootstrap.
|
|
1043
|
-
*
|
|
1044
|
-
* @
|
|
1089
|
+
* @param {object} options - The options to check for bootstrap version.
|
|
1090
|
+
* @param {string} options.bootstrap - The bootstrap version to use.
|
|
1091
|
+
* @returns {number} - The bootstrap version.
|
|
1045
1092
|
*/
|
|
1046
1093
|
function bootstrapVersion(options) {
|
|
1047
1094
|
if (options.bootstrap) {
|
|
@@ -1059,9 +1106,8 @@ exports.bootstrapVersion = bootstrapVersion;
|
|
|
1059
1106
|
/**
|
|
1060
1107
|
* Retrun provided argument.
|
|
1061
1108
|
* If argument is a function, returns the result of a function call.
|
|
1062
|
-
* @param {
|
|
1063
|
-
*
|
|
1064
|
-
* @return {*}
|
|
1109
|
+
* @param {Function|any} e - The argument to check if a function and call if so.
|
|
1110
|
+
* @returns {any} - Either the result of the function call (e) or e if it is not a function.
|
|
1065
1111
|
*/
|
|
1066
1112
|
function unfold(e) {
|
|
1067
1113
|
if (typeof e === 'function') {
|
|
@@ -1072,27 +1118,32 @@ function unfold(e) {
|
|
|
1072
1118
|
exports.unfold = unfold;
|
|
1073
1119
|
/**
|
|
1074
1120
|
* Map values through unfold and return first non-nil value.
|
|
1075
|
-
* @param {Array<T>} collection
|
|
1076
|
-
*
|
|
1077
|
-
* @return {T}
|
|
1121
|
+
* @param {Array<T>} collection - The collection to map through unfold.;
|
|
1122
|
+
* @returns {T} - The first non-nil value.
|
|
1078
1123
|
*/
|
|
1079
1124
|
exports.firstNonNil = lodash_1.default.flow([
|
|
1080
1125
|
lodash_1.default.partialRight(lodash_1.default.map, unfold),
|
|
1081
1126
|
lodash_1.default.partialRight(lodash_1.default.find, v => !lodash_1.default.isUndefined(v))
|
|
1082
1127
|
]);
|
|
1083
|
-
|
|
1084
|
-
* Create enclosed state.
|
|
1085
|
-
* Returns functions to getting and cycling between states.
|
|
1128
|
+
/**
|
|
1129
|
+
* Create enclosed state. Returns functions to getting and cycling between states.
|
|
1086
1130
|
* @param {*} a - initial state.
|
|
1087
1131
|
* @param {*} b - next state.
|
|
1088
|
-
* @
|
|
1132
|
+
* @returns {Functions[]} -- [get, toggle];
|
|
1089
1133
|
*/
|
|
1090
1134
|
function withSwitch(a, b) {
|
|
1091
1135
|
let state = a;
|
|
1092
1136
|
let next = b;
|
|
1137
|
+
/**
|
|
1138
|
+
* Returns the state of the switch.
|
|
1139
|
+
* @returns {*} - The current state.
|
|
1140
|
+
*/
|
|
1093
1141
|
function get() {
|
|
1094
1142
|
return state;
|
|
1095
1143
|
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Toggles the state of the switch.
|
|
1146
|
+
*/
|
|
1096
1147
|
function toggle() {
|
|
1097
1148
|
const prev = state;
|
|
1098
1149
|
state = next;
|
|
@@ -1101,6 +1152,14 @@ function withSwitch(a, b) {
|
|
|
1101
1152
|
return [get, toggle];
|
|
1102
1153
|
}
|
|
1103
1154
|
exports.withSwitch = withSwitch;
|
|
1155
|
+
/**
|
|
1156
|
+
* Create a function that will call the provided function only the provided limit.
|
|
1157
|
+
* @param {Function} callback - The callback to call.
|
|
1158
|
+
* @param {object} options - The options to use.
|
|
1159
|
+
* @param {number} options.limit - The limit to call the callback.
|
|
1160
|
+
* @param {number} options.delay - The delay to wait before resetting the call count.
|
|
1161
|
+
* @returns {Function} - The function that will call the callback only the provided limit.
|
|
1162
|
+
*/
|
|
1104
1163
|
function observeOverload(callback, options = {}) {
|
|
1105
1164
|
const { limit = 50, delay = 500 } = options;
|
|
1106
1165
|
let callCount = 0;
|
|
@@ -1121,6 +1180,13 @@ function observeOverload(callback, options = {}) {
|
|
|
1121
1180
|
};
|
|
1122
1181
|
}
|
|
1123
1182
|
exports.observeOverload = observeOverload;
|
|
1183
|
+
/**
|
|
1184
|
+
* Returns the components that are provided within an evaluation context.
|
|
1185
|
+
* @param {any} context - The evaluation context to get the components from.
|
|
1186
|
+
* @param {boolean} excludeNested - Exclude nested components.
|
|
1187
|
+
* @param {Array<string>} excludedTypes - The types of components to exclude.
|
|
1188
|
+
* @returns {Array} - The components within the evaluation context.
|
|
1189
|
+
*/
|
|
1124
1190
|
function getContextComponents(context, excludeNested, excludedTypes = []) {
|
|
1125
1191
|
const values = [];
|
|
1126
1192
|
context.utils.eachComponent(context.instance.options.editForm.components, (component, path) => {
|
|
@@ -1135,6 +1201,11 @@ function getContextComponents(context, excludeNested, excludedTypes = []) {
|
|
|
1135
1201
|
return values;
|
|
1136
1202
|
}
|
|
1137
1203
|
exports.getContextComponents = getContextComponents;
|
|
1204
|
+
/**
|
|
1205
|
+
* Returns the button components that are within an evaluation context.
|
|
1206
|
+
* @param {any} context - The evaluation context to get the components from.
|
|
1207
|
+
* @returns {Array} - The button components within the evaluation context.
|
|
1208
|
+
*/
|
|
1138
1209
|
function getContextButtons(context) {
|
|
1139
1210
|
const values = [];
|
|
1140
1211
|
context.utils.eachComponent(context.instance.options.editForm.components, (component) => {
|
|
@@ -1152,18 +1223,15 @@ exports.getContextButtons = getContextButtons;
|
|
|
1152
1223
|
const inTextTags = ['#text', 'A', 'B', 'EM', 'I', 'SMALL', 'STRONG', 'SUB', 'SUP', 'INS', 'DEL', 'MARK', 'CODE'];
|
|
1153
1224
|
/**
|
|
1154
1225
|
* Helper function for 'translateHTMLTemplate'. Translates text value of the passed html element.
|
|
1155
|
-
*
|
|
1156
|
-
* @param {
|
|
1157
|
-
* @
|
|
1158
|
-
*
|
|
1159
|
-
* @returns {String}
|
|
1160
|
-
* Translated element template.
|
|
1226
|
+
* @param {HTMLElement} elem - The element to translate.
|
|
1227
|
+
* @param {Function} translate - The translation function.
|
|
1228
|
+
* @returns {string} - Translated element template.
|
|
1161
1229
|
*/
|
|
1162
1230
|
function translateElemValue(elem, translate) {
|
|
1163
1231
|
if (!elem.innerText) {
|
|
1164
1232
|
return elem.innerHTML;
|
|
1165
1233
|
}
|
|
1166
|
-
const elemValue = elem.innerText.replace(Evaluator_1.
|
|
1234
|
+
const elemValue = elem.innerText.replace(Evaluator_1.Evaluator.templateSettings.interpolate, '').replace(/\s\s+/g, ' ').trim();
|
|
1167
1235
|
const translatedValue = translate(elemValue);
|
|
1168
1236
|
if (elemValue !== translatedValue) {
|
|
1169
1237
|
const links = elem.innerHTML.match(/<a[^>]*>(.*?)<\/a>/g);
|
|
@@ -1188,10 +1256,8 @@ function translateElemValue(elem, translate) {
|
|
|
1188
1256
|
}
|
|
1189
1257
|
/**
|
|
1190
1258
|
* Helper function for 'translateHTMLTemplate'. Goes deep through html tag children and calls function to translate their text values.
|
|
1191
|
-
*
|
|
1192
|
-
* @param {
|
|
1193
|
-
* @param {Function} translate
|
|
1194
|
-
*
|
|
1259
|
+
* @param {HTMLElement} tag - The tag to translate.
|
|
1260
|
+
* @param {Function} translate - The translation function.
|
|
1195
1261
|
* @returns {void}
|
|
1196
1262
|
*/
|
|
1197
1263
|
function translateDeepTag(tag, translate) {
|
|
@@ -1207,12 +1273,9 @@ function translateDeepTag(tag, translate) {
|
|
|
1207
1273
|
}
|
|
1208
1274
|
/**
|
|
1209
1275
|
* Translates text values in html template.
|
|
1210
|
-
*
|
|
1211
|
-
* @param {
|
|
1212
|
-
* @
|
|
1213
|
-
*
|
|
1214
|
-
* @returns {String}
|
|
1215
|
-
* Html template with translated values.
|
|
1276
|
+
* @param {string} template - The template to translate.
|
|
1277
|
+
* @param {Function} translate - The translation function.
|
|
1278
|
+
* @returns {string} - Html template with translated values.
|
|
1216
1279
|
*/
|
|
1217
1280
|
function translateHTMLTemplate(template, translate) {
|
|
1218
1281
|
const isHTML = /<[^>]*>/.test(template);
|
|
@@ -1230,9 +1293,9 @@ function translateHTMLTemplate(template, translate) {
|
|
|
1230
1293
|
exports.translateHTMLTemplate = translateHTMLTemplate;
|
|
1231
1294
|
/**
|
|
1232
1295
|
* Sanitize an html string.
|
|
1233
|
-
*
|
|
1234
|
-
* @param
|
|
1235
|
-
* @returns {
|
|
1296
|
+
* @param {string} string - The string to sanitize.
|
|
1297
|
+
* @param {any} options - The options to use for sanitization.
|
|
1298
|
+
* @returns {string} - The sanitized html string.
|
|
1236
1299
|
*/
|
|
1237
1300
|
function sanitize(string, options) {
|
|
1238
1301
|
if (typeof dompurify_1.default.sanitize !== 'function') {
|
|
@@ -1281,11 +1344,18 @@ function sanitize(string, options) {
|
|
|
1281
1344
|
exports.sanitize = sanitize;
|
|
1282
1345
|
/**
|
|
1283
1346
|
* Fast cloneDeep for JSON objects only.
|
|
1347
|
+
* @param {any} obj - The object to perform a fast clone deep against.
|
|
1348
|
+
* @returns {any} - The cloned object.
|
|
1284
1349
|
*/
|
|
1285
1350
|
function fastCloneDeep(obj) {
|
|
1286
1351
|
return obj ? JSON.parse(JSON.stringify(obj)) : obj;
|
|
1287
1352
|
}
|
|
1288
1353
|
exports.fastCloneDeep = fastCloneDeep;
|
|
1354
|
+
/**
|
|
1355
|
+
* Returns if the component is an input component.
|
|
1356
|
+
* @param {import('@formio/core').Component} componentJson - The JSON of a component.
|
|
1357
|
+
* @returns {bool} - TRUE if the component is an input component; FALSE otherwise.
|
|
1358
|
+
*/
|
|
1289
1359
|
function isInputComponent(componentJson) {
|
|
1290
1360
|
if (componentJson.input === false || componentJson.input === true) {
|
|
1291
1361
|
return componentJson.input;
|
|
@@ -1306,6 +1376,11 @@ function isInputComponent(componentJson) {
|
|
|
1306
1376
|
}
|
|
1307
1377
|
}
|
|
1308
1378
|
exports.isInputComponent = isInputComponent;
|
|
1379
|
+
/**
|
|
1380
|
+
* Takes a component path, and returns a component path array.
|
|
1381
|
+
* @param {string} pathStr - The path string to convert to an array.
|
|
1382
|
+
* @returns {Arryay<number>} - The array of paths.
|
|
1383
|
+
*/
|
|
1309
1384
|
function getArrayFromComponentPath(pathStr) {
|
|
1310
1385
|
if (!pathStr || !lodash_1.default.isString(pathStr)) {
|
|
1311
1386
|
if (!lodash_1.default.isArray(pathStr)) {
|
|
@@ -1320,6 +1395,12 @@ function getArrayFromComponentPath(pathStr) {
|
|
|
1320
1395
|
.map(part => lodash_1.default.defaultTo(lodash_1.default.toNumber(part), part));
|
|
1321
1396
|
}
|
|
1322
1397
|
exports.getArrayFromComponentPath = getArrayFromComponentPath;
|
|
1398
|
+
/**
|
|
1399
|
+
* Returns true if the component is a child of the parent.
|
|
1400
|
+
* @param {any} child - The child component to check.
|
|
1401
|
+
* @param {any} parent - The parent component to check.
|
|
1402
|
+
* @returns {boolean} - TRUE if the child is a child of the parent; FALSE otherwise.
|
|
1403
|
+
*/
|
|
1323
1404
|
function isChildOf(child, parent) {
|
|
1324
1405
|
while (child && child.parent) {
|
|
1325
1406
|
if (child.parent === parent) {
|
|
@@ -1330,6 +1411,11 @@ function isChildOf(child, parent) {
|
|
|
1330
1411
|
return false;
|
|
1331
1412
|
}
|
|
1332
1413
|
exports.isChildOf = isChildOf;
|
|
1414
|
+
/**
|
|
1415
|
+
* Takes an array of component path indexes, and returns a string version of that array.
|
|
1416
|
+
* @param {Array<number>} path - The path array to convert to a string.
|
|
1417
|
+
* @returns {string} - The string version of the path.
|
|
1418
|
+
*/
|
|
1333
1419
|
function getStringFromComponentPath(path) {
|
|
1334
1420
|
if (!lodash_1.default.isArray(path)) {
|
|
1335
1421
|
return path;
|
|
@@ -1346,17 +1432,22 @@ function getStringFromComponentPath(path) {
|
|
|
1346
1432
|
return strPath;
|
|
1347
1433
|
}
|
|
1348
1434
|
exports.getStringFromComponentPath = getStringFromComponentPath;
|
|
1435
|
+
/**
|
|
1436
|
+
* Takes a number and rounds it to the provided precision amount.
|
|
1437
|
+
* @param {number} number - The number to round.
|
|
1438
|
+
* @param {number} precision - The precision to round the number to.
|
|
1439
|
+
* @returns {string} - The rounded number.
|
|
1440
|
+
*/
|
|
1349
1441
|
function round(number, precision) {
|
|
1350
1442
|
if (lodash_1.default.isNumber(number)) {
|
|
1351
1443
|
return number.toFixed(precision);
|
|
1352
1444
|
}
|
|
1353
|
-
return number;
|
|
1445
|
+
return number.toString();
|
|
1354
1446
|
}
|
|
1355
1447
|
exports.round = round;
|
|
1356
1448
|
/**
|
|
1357
1449
|
* Check for Internet Explorer browser version
|
|
1358
|
-
*
|
|
1359
|
-
* @return {(number|null)}
|
|
1450
|
+
* @returns {(number|null)} - The IE browser version or null if not IE
|
|
1360
1451
|
*/
|
|
1361
1452
|
function getIEBrowserVersion() {
|
|
1362
1453
|
const { ie, version } = getBrowserInfo();
|
|
@@ -1365,8 +1456,7 @@ function getIEBrowserVersion() {
|
|
|
1365
1456
|
exports.getIEBrowserVersion = getIEBrowserVersion;
|
|
1366
1457
|
/**
|
|
1367
1458
|
* Get browser name and version (modified from 'jquery-browser-plugin')
|
|
1368
|
-
*
|
|
1369
|
-
* @return {Object} -- {{browser name, version, isWebkit?}}
|
|
1459
|
+
* @returns {object} -- {{browser name, version, isWebkit?}}
|
|
1370
1460
|
* Possible browser names: chrome, safari, ie, edge, opera, mozilla, yabrowser
|
|
1371
1461
|
*/
|
|
1372
1462
|
function getBrowserInfo() {
|
|
@@ -1415,13 +1505,20 @@ function getBrowserInfo() {
|
|
|
1415
1505
|
return browser;
|
|
1416
1506
|
}
|
|
1417
1507
|
exports.getBrowserInfo = getBrowserInfo;
|
|
1508
|
+
/**
|
|
1509
|
+
* Takes a component path, which may include array indicies (i.e. [0][1]), and returns the compoennt path without the indicies.
|
|
1510
|
+
* @param {string} path - The path to remove the indicies from.
|
|
1511
|
+
* @returns {string} - The path without the indicies.
|
|
1512
|
+
*/
|
|
1418
1513
|
function getComponentPathWithoutIndicies(path = '') {
|
|
1419
1514
|
return path.replace(/\[\d+\]/, '');
|
|
1420
1515
|
}
|
|
1421
1516
|
exports.getComponentPathWithoutIndicies = getComponentPathWithoutIndicies;
|
|
1422
1517
|
/**
|
|
1423
1518
|
* Returns a path to the component which based on its schema
|
|
1424
|
-
* @param {
|
|
1519
|
+
* @param {import('@formio/core').Component} component - Component containing link to its parent's schema in the 'parent' property
|
|
1520
|
+
* @param {string} path - Path to the component
|
|
1521
|
+
* @returns {string} - Path to the component
|
|
1425
1522
|
*/
|
|
1426
1523
|
function getComponentPath(component, path = '') {
|
|
1427
1524
|
var _a;
|
|
@@ -1434,8 +1531,8 @@ function getComponentPath(component, path = '') {
|
|
|
1434
1531
|
exports.getComponentPath = getComponentPath;
|
|
1435
1532
|
/**
|
|
1436
1533
|
* Returns a parent component of the passed component instance skipping all the Layout components
|
|
1437
|
-
* @param {
|
|
1438
|
-
* @
|
|
1534
|
+
* @param {Component} componentInstance - The component to check for the parent.
|
|
1535
|
+
* @returns {Component|undefined} - The parent data component.
|
|
1439
1536
|
*/
|
|
1440
1537
|
function getDataParentComponent(componentInstance) {
|
|
1441
1538
|
if (!componentInstance) {
|
|
@@ -1452,8 +1549,8 @@ function getDataParentComponent(componentInstance) {
|
|
|
1452
1549
|
exports.getDataParentComponent = getDataParentComponent;
|
|
1453
1550
|
/**
|
|
1454
1551
|
* Returns whether the value is a promise
|
|
1455
|
-
* @param value
|
|
1456
|
-
* @
|
|
1552
|
+
* @param {any} value - The value to check
|
|
1553
|
+
* @returns {boolean} - TRUE if the value is a promise; FALSE otherwise
|
|
1457
1554
|
*/
|
|
1458
1555
|
function isPromise(value) {
|
|
1459
1556
|
return value
|
|
@@ -1465,9 +1562,9 @@ exports.isPromise = isPromise;
|
|
|
1465
1562
|
/**
|
|
1466
1563
|
* Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
|
|
1467
1564
|
* changes by itself, e.g. EditGrid)
|
|
1468
|
-
* @param componentInstance
|
|
1469
|
-
* @param firstPass
|
|
1470
|
-
* @returns {boolean
|
|
1565
|
+
* @param {Component} componentInstance - The component to check for the scoping parent.
|
|
1566
|
+
* @param {boolean} firstPass - Whether it is the first pass of the function
|
|
1567
|
+
* @returns {boolean|*} - TRUE if the component has a scoping parent; FALSE otherwise
|
|
1471
1568
|
*/
|
|
1472
1569
|
function isInsideScopingComponent(componentInstance, firstPass = true) {
|
|
1473
1570
|
if (!firstPass && (componentInstance === null || componentInstance === void 0 ? void 0 : componentInstance.hasScopedChildren)) {
|
|
@@ -1483,6 +1580,11 @@ function isInsideScopingComponent(componentInstance, firstPass = true) {
|
|
|
1483
1580
|
return false;
|
|
1484
1581
|
}
|
|
1485
1582
|
exports.isInsideScopingComponent = isInsideScopingComponent;
|
|
1583
|
+
/**
|
|
1584
|
+
* Returns all the focusable elements within the provided dom element.
|
|
1585
|
+
* @param {HTMLElement} element - The element to get the focusable elements from.
|
|
1586
|
+
* @returns {NodeList<HTMLElement>} - The focusable elements within the provided element.
|
|
1587
|
+
*/
|
|
1486
1588
|
function getFocusableElements(element) {
|
|
1487
1589
|
const focusableSelector = `button:not([disabled]), input:not([disabled]), select:not([disabled]),
|
|
1488
1590
|
textarea:not([disabled]), button:not([disabled]), [href]`;
|
|
@@ -1498,6 +1600,11 @@ exports.componentValueTypes = {
|
|
|
1498
1600
|
date: 'date',
|
|
1499
1601
|
any: 'any',
|
|
1500
1602
|
};
|
|
1603
|
+
/**
|
|
1604
|
+
* Returns the saved types for the component
|
|
1605
|
+
* @param {import('@formio/core').Component} fullSchema - The component schema
|
|
1606
|
+
* @returns {Array<string>|null} - The saved types for the component
|
|
1607
|
+
*/
|
|
1501
1608
|
function getComponentSavedTypes(fullSchema) {
|
|
1502
1609
|
const schema = fullSchema || {};
|
|
1503
1610
|
if (schema.persistent !== true) {
|
|
@@ -1511,9 +1618,10 @@ function getComponentSavedTypes(fullSchema) {
|
|
|
1511
1618
|
exports.getComponentSavedTypes = getComponentSavedTypes;
|
|
1512
1619
|
/**
|
|
1513
1620
|
* Interpolates @formio/core errors so that they are compatible with the renderer
|
|
1514
|
-
* @param {
|
|
1515
|
-
* @param
|
|
1516
|
-
* @
|
|
1621
|
+
* @param {Component} component - The component to interpolate the errors for
|
|
1622
|
+
* @param {FieldError[]} errors - The errors to interpolate
|
|
1623
|
+
* @param {Function} interpolateFn - The interpolation function
|
|
1624
|
+
* @returns {[]} - The interpolated errors
|
|
1517
1625
|
*/
|
|
1518
1626
|
const interpolateErrors = (component, errors, interpolateFn) => {
|
|
1519
1627
|
return errors.map((error) => {
|
|
@@ -1524,6 +1632,11 @@ const interpolateErrors = (component, errors, interpolateFn) => {
|
|
|
1524
1632
|
});
|
|
1525
1633
|
};
|
|
1526
1634
|
exports.interpolateErrors = interpolateErrors;
|
|
1635
|
+
/**
|
|
1636
|
+
* Returns the template keys inside the template code.
|
|
1637
|
+
* @param {string} template - The template to get the keys from.
|
|
1638
|
+
* @returns {Array<string>} - The keys inside the template.
|
|
1639
|
+
*/
|
|
1527
1640
|
function getItemTemplateKeys(template) {
|
|
1528
1641
|
const templateKeys = [];
|
|
1529
1642
|
if (!template) {
|
|
@@ -1541,6 +1654,11 @@ function getItemTemplateKeys(template) {
|
|
|
1541
1654
|
return templateKeys;
|
|
1542
1655
|
}
|
|
1543
1656
|
exports.getItemTemplateKeys = getItemTemplateKeys;
|
|
1657
|
+
/**
|
|
1658
|
+
* Returns if the component is a select resource with an object for its value.
|
|
1659
|
+
* @param {import('@formio/core').Component} comp - The component to check.
|
|
1660
|
+
* @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
|
|
1661
|
+
*/
|
|
1544
1662
|
function isSelectResourceWithObjectValue(comp = {}) {
|
|
1545
1663
|
const { reference, dataSrc, valueProperty } = comp;
|
|
1546
1664
|
return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));
|