@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/cjs/utils/utils.js
CHANGED
|
@@ -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
|
}
|
|
@@ -450,8 +434,8 @@ function setActionProperty(component, action, result, row, data, instance) {
|
|
|
450
434
|
exports.setActionProperty = setActionProperty;
|
|
451
435
|
/**
|
|
452
436
|
* Removes HTML tags from string e.g. <div>Hello World</div> => Hello World
|
|
453
|
-
* @param {string} str
|
|
454
|
-
* @returns {string}
|
|
437
|
+
* @param {string} str - The string to remove HTML tags from.
|
|
438
|
+
* @returns {string} - The string without HTML tags.
|
|
455
439
|
*/
|
|
456
440
|
function removeHTML(str) {
|
|
457
441
|
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
@@ -460,8 +444,8 @@ function removeHTML(str) {
|
|
|
460
444
|
exports.removeHTML = removeHTML;
|
|
461
445
|
/**
|
|
462
446
|
* Unescape HTML characters like <, >, & and etc.
|
|
463
|
-
* @param str
|
|
464
|
-
* @returns {string}
|
|
447
|
+
* @param {string} str - The string to unescape.
|
|
448
|
+
* @returns {string} - The unescaped string.
|
|
465
449
|
*/
|
|
466
450
|
function unescapeHTML(str) {
|
|
467
451
|
if (typeof window === 'undefined' || !('DOMParser' in window)) {
|
|
@@ -474,9 +458,9 @@ function unescapeHTML(str) {
|
|
|
474
458
|
exports.unescapeHTML = unescapeHTML;
|
|
475
459
|
/**
|
|
476
460
|
* Make HTML element from string
|
|
477
|
-
* @param str
|
|
478
|
-
* @param selector
|
|
479
|
-
* @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.
|
|
480
464
|
*/
|
|
481
465
|
function convertStringToHTMLElement(str, selector) {
|
|
482
466
|
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
@@ -485,10 +469,10 @@ function convertStringToHTMLElement(str, selector) {
|
|
|
485
469
|
exports.convertStringToHTMLElement = convertStringToHTMLElement;
|
|
486
470
|
/**
|
|
487
471
|
* Make a filename guaranteed to be unique.
|
|
488
|
-
* @param name
|
|
489
|
-
* @param template
|
|
490
|
-
* @param evalContext
|
|
491
|
-
* @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.
|
|
492
476
|
*/
|
|
493
477
|
function uniqueName(name, template, evalContext) {
|
|
494
478
|
template = template || '{{fileName}}-{{guid}}';
|
|
@@ -508,10 +492,14 @@ function uniqueName(name, template, evalContext) {
|
|
|
508
492
|
guid: guid()
|
|
509
493
|
});
|
|
510
494
|
//only letters, numbers, dots, dashes, underscores and spaces are allowed. Anything else will be replaced with dash
|
|
511
|
-
const uniqueName = `${Evaluator_1.
|
|
495
|
+
const uniqueName = `${Evaluator_1.Evaluator.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\-_ ]/g, '-');
|
|
512
496
|
return uniqueName;
|
|
513
497
|
}
|
|
514
498
|
exports.uniqueName = uniqueName;
|
|
499
|
+
/**
|
|
500
|
+
* Returns a GUID
|
|
501
|
+
* @returns {string} - A GUID.
|
|
502
|
+
*/
|
|
515
503
|
function guid() {
|
|
516
504
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
517
505
|
const r = Math.random() * 16 | 0;
|
|
@@ -524,9 +512,8 @@ function guid() {
|
|
|
524
512
|
exports.guid = guid;
|
|
525
513
|
/**
|
|
526
514
|
* Return a translated date setting.
|
|
527
|
-
*
|
|
528
|
-
* @
|
|
529
|
-
* @return {(null|Date)}
|
|
515
|
+
* @param {string|Date} date - The date to translate.
|
|
516
|
+
* @returns {(null|Date)} - The translated date.
|
|
530
517
|
*/
|
|
531
518
|
function getDateSetting(date) {
|
|
532
519
|
if (lodash_1.default.isNil(date) || lodash_1.default.isNaN(date) || date === '') {
|
|
@@ -544,7 +531,7 @@ function getDateSetting(date) {
|
|
|
544
531
|
}
|
|
545
532
|
dateSetting = null;
|
|
546
533
|
try {
|
|
547
|
-
const value = Evaluator_1.
|
|
534
|
+
const value = Evaluator_1.Evaluator.evaluator(`return ${date};`, 'moment')(moment_timezone_1.default);
|
|
548
535
|
if (typeof value === 'string') {
|
|
549
536
|
dateSetting = (0, moment_timezone_1.default)(value);
|
|
550
537
|
}
|
|
@@ -568,14 +555,18 @@ function getDateSetting(date) {
|
|
|
568
555
|
return dateSetting.toDate();
|
|
569
556
|
}
|
|
570
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
|
+
*/
|
|
571
563
|
function isValidDate(date) {
|
|
572
564
|
return lodash_1.default.isDate(date) && !lodash_1.default.isNaN(date.getDate());
|
|
573
565
|
}
|
|
574
566
|
exports.isValidDate = isValidDate;
|
|
575
567
|
/**
|
|
576
568
|
* Get the current timezone string.
|
|
577
|
-
*
|
|
578
|
-
* @return {string}
|
|
569
|
+
* @returns {string} - The current timezone.
|
|
579
570
|
*/
|
|
580
571
|
function currentTimezone() {
|
|
581
572
|
if (moment_timezone_1.default.currentTimezone) {
|
|
@@ -587,10 +578,9 @@ function currentTimezone() {
|
|
|
587
578
|
exports.currentTimezone = currentTimezone;
|
|
588
579
|
/**
|
|
589
580
|
* Get an offset date provided a date object and timezone object.
|
|
590
|
-
*
|
|
591
|
-
* @param date
|
|
592
|
-
* @
|
|
593
|
-
* @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.
|
|
594
584
|
*/
|
|
595
585
|
function offsetDate(date, timezone) {
|
|
596
586
|
if (timezone === 'UTC') {
|
|
@@ -608,8 +598,7 @@ function offsetDate(date, timezone) {
|
|
|
608
598
|
exports.offsetDate = offsetDate;
|
|
609
599
|
/**
|
|
610
600
|
* Returns if the zones are loaded.
|
|
611
|
-
*
|
|
612
|
-
* @return {boolean}
|
|
601
|
+
* @returns {boolean} - TRUE if the zones are loaded; FALSE otherwise.
|
|
613
602
|
*/
|
|
614
603
|
function zonesLoaded() {
|
|
615
604
|
return moment_timezone_1.default.zonesLoaded;
|
|
@@ -617,9 +606,8 @@ function zonesLoaded() {
|
|
|
617
606
|
exports.zonesLoaded = zonesLoaded;
|
|
618
607
|
/**
|
|
619
608
|
* Returns if we should load the zones.
|
|
620
|
-
*
|
|
621
|
-
* @
|
|
622
|
-
* @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.
|
|
623
611
|
*/
|
|
624
612
|
function shouldLoadZones(timezone) {
|
|
625
613
|
if (timezone === currentTimezone() || timezone === 'UTC') {
|
|
@@ -630,8 +618,9 @@ function shouldLoadZones(timezone) {
|
|
|
630
618
|
exports.shouldLoadZones = shouldLoadZones;
|
|
631
619
|
/**
|
|
632
620
|
* Externally load the timezone data.
|
|
633
|
-
*
|
|
634
|
-
* @
|
|
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.
|
|
635
624
|
*/
|
|
636
625
|
function loadZones(url, timezone) {
|
|
637
626
|
if (timezone && !shouldLoadZones(timezone)) {
|
|
@@ -656,11 +645,10 @@ function loadZones(url, timezone) {
|
|
|
656
645
|
exports.loadZones = loadZones;
|
|
657
646
|
/**
|
|
658
647
|
* Get the moment date object for translating dates with timezones.
|
|
659
|
-
*
|
|
660
|
-
* @param
|
|
661
|
-
* @param
|
|
662
|
-
* @
|
|
663
|
-
* @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.
|
|
664
652
|
*/
|
|
665
653
|
function momentDate(value, format, timezone) {
|
|
666
654
|
const momentDate = (0, moment_timezone_1.default)(value);
|
|
@@ -678,11 +666,12 @@ function momentDate(value, format, timezone) {
|
|
|
678
666
|
exports.momentDate = momentDate;
|
|
679
667
|
/**
|
|
680
668
|
* Format a date provided a value, format, and timezone object.
|
|
681
|
-
*
|
|
682
|
-
* @param value
|
|
683
|
-
* @param format
|
|
684
|
-
* @param timezone
|
|
685
|
-
* @
|
|
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.
|
|
686
675
|
*/
|
|
687
676
|
function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
|
|
688
677
|
const momentDate = (0, moment_timezone_1.default)(value, flatPickrInputFormat || undefined);
|
|
@@ -716,12 +705,12 @@ function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat)
|
|
|
716
705
|
exports.formatDate = formatDate;
|
|
717
706
|
/**
|
|
718
707
|
* Pass a format function to format within a timezone.
|
|
719
|
-
*
|
|
720
|
-
* @param formatFn
|
|
721
|
-
* @param date
|
|
722
|
-
* @param format
|
|
723
|
-
* @param timezone
|
|
724
|
-
* @
|
|
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.
|
|
725
714
|
*/
|
|
726
715
|
function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
|
727
716
|
if (timezone === currentTimezone()) {
|
|
@@ -741,6 +730,11 @@ function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
|
|
741
730
|
}
|
|
742
731
|
}
|
|
743
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
|
+
*/
|
|
744
738
|
function getLocaleDateFormatInfo(locale) {
|
|
745
739
|
const formatInfo = {};
|
|
746
740
|
const day = 21;
|
|
@@ -752,8 +746,8 @@ function getLocaleDateFormatInfo(locale) {
|
|
|
752
746
|
exports.getLocaleDateFormatInfo = getLocaleDateFormatInfo;
|
|
753
747
|
/**
|
|
754
748
|
* Convert the format from the angular-datepicker module to flatpickr format.
|
|
755
|
-
* @param format
|
|
756
|
-
* @
|
|
749
|
+
* @param {string} format - The format to convert.
|
|
750
|
+
* @returns {string} - The converted format.
|
|
757
751
|
*/
|
|
758
752
|
function convertFormatToFlatpickr(format) {
|
|
759
753
|
return format
|
|
@@ -784,8 +778,8 @@ function convertFormatToFlatpickr(format) {
|
|
|
784
778
|
exports.convertFormatToFlatpickr = convertFormatToFlatpickr;
|
|
785
779
|
/**
|
|
786
780
|
* Convert the format from the angular-datepicker module to moment format.
|
|
787
|
-
* @param format
|
|
788
|
-
* @
|
|
781
|
+
* @param {string} format - The format to convert.
|
|
782
|
+
* @returns {string} - The converted format.
|
|
789
783
|
*/
|
|
790
784
|
function convertFormatToMoment(format) {
|
|
791
785
|
return format
|
|
@@ -801,6 +795,11 @@ function convertFormatToMoment(format) {
|
|
|
801
795
|
.replace(/U/g, 'X');
|
|
802
796
|
}
|
|
803
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
|
+
*/
|
|
804
803
|
function convertFormatToMask(format) {
|
|
805
804
|
return format
|
|
806
805
|
// Long month replacement.
|
|
@@ -860,6 +859,13 @@ function getInputMask(mask, placeholderChar) {
|
|
|
860
859
|
return maskArray;
|
|
861
860
|
}
|
|
862
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
|
+
*/
|
|
863
869
|
function unmaskValue(value, mask, placeholderChar) {
|
|
864
870
|
if (!mask || !value || value.length > mask.length) {
|
|
865
871
|
return value;
|
|
@@ -876,6 +882,12 @@ function unmaskValue(value, mask, placeholderChar) {
|
|
|
876
882
|
return unmaskedValue;
|
|
877
883
|
}
|
|
878
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
|
+
*/
|
|
879
891
|
function matchInputMask(value, inputMask) {
|
|
880
892
|
if (!inputMask) {
|
|
881
893
|
return true;
|
|
@@ -894,6 +906,11 @@ function matchInputMask(value, inputMask) {
|
|
|
894
906
|
return true;
|
|
895
907
|
}
|
|
896
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
|
+
*/
|
|
897
914
|
function getNumberSeparators(lang = 'en') {
|
|
898
915
|
const formattedNumberString = (12345.6789).toLocaleString(lang);
|
|
899
916
|
const delimeters = formattedNumberString.match(/..(.)...(.)../);
|
|
@@ -909,6 +926,12 @@ function getNumberSeparators(lang = 'en') {
|
|
|
909
926
|
};
|
|
910
927
|
}
|
|
911
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
|
+
*/
|
|
912
935
|
function getNumberDecimalLimit(component, defaultLimit) {
|
|
913
936
|
if (lodash_1.default.has(component, 'decimalLimit')) {
|
|
914
937
|
return lodash_1.default.get(component, 'decimalLimit');
|
|
@@ -925,6 +948,15 @@ function getNumberDecimalLimit(component, defaultLimit) {
|
|
|
925
948
|
return decimalLimit;
|
|
926
949
|
}
|
|
927
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
|
+
*/
|
|
928
960
|
function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
|
|
929
961
|
// Get the prefix and suffix from the localized string.
|
|
930
962
|
let regex = `(.*)?${(100).toLocaleString(lang)}`;
|
|
@@ -947,10 +979,9 @@ function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, })
|
|
|
947
979
|
exports.getCurrencyAffixes = getCurrencyAffixes;
|
|
948
980
|
/**
|
|
949
981
|
* Fetch the field data provided a component.
|
|
950
|
-
*
|
|
951
|
-
* @param data
|
|
952
|
-
* @
|
|
953
|
-
* @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.
|
|
954
985
|
*/
|
|
955
986
|
function fieldData(data, component) {
|
|
956
987
|
if (!data) {
|
|
@@ -997,16 +1028,23 @@ function fieldData(data, component) {
|
|
|
997
1028
|
exports.fieldData = fieldData;
|
|
998
1029
|
/**
|
|
999
1030
|
* Delays function execution with possibility to execute function synchronously or cancel it.
|
|
1000
|
-
*
|
|
1001
|
-
* @param
|
|
1002
|
-
* @param
|
|
1003
|
-
* @
|
|
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
|
|
1004
1035
|
*/
|
|
1005
1036
|
function delay(fn, delay = 0, ...args) {
|
|
1006
1037
|
const timer = setTimeout(fn, delay, ...args);
|
|
1038
|
+
/**
|
|
1039
|
+
*
|
|
1040
|
+
*/
|
|
1007
1041
|
function cancel() {
|
|
1008
1042
|
clearTimeout(timer);
|
|
1009
1043
|
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Execute the function early.
|
|
1046
|
+
* @returns {*} - The result of the function.
|
|
1047
|
+
*/
|
|
1010
1048
|
function earlyCall() {
|
|
1011
1049
|
cancel();
|
|
1012
1050
|
return fn(...args);
|
|
@@ -1018,11 +1056,9 @@ function delay(fn, delay = 0, ...args) {
|
|
|
1018
1056
|
exports.delay = delay;
|
|
1019
1057
|
/**
|
|
1020
1058
|
* Iterate the given key to make it unique.
|
|
1021
|
-
*
|
|
1022
|
-
* @param {String} key
|
|
1059
|
+
* @param {string} key
|
|
1023
1060
|
* Modify the component key to be unique.
|
|
1024
|
-
*
|
|
1025
|
-
* @returns {String}
|
|
1061
|
+
* @returns {string}
|
|
1026
1062
|
* The new component key.
|
|
1027
1063
|
*/
|
|
1028
1064
|
function iterateKey(key) {
|
|
@@ -1036,10 +1072,9 @@ function iterateKey(key) {
|
|
|
1036
1072
|
exports.iterateKey = iterateKey;
|
|
1037
1073
|
/**
|
|
1038
1074
|
* Determines a unique key within a map provided the base key.
|
|
1039
|
-
*
|
|
1040
|
-
* @param
|
|
1041
|
-
* @
|
|
1042
|
-
* @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.
|
|
1043
1078
|
*/
|
|
1044
1079
|
function uniqueKey(map, base) {
|
|
1045
1080
|
let newKey = base;
|
|
@@ -1051,8 +1086,9 @@ function uniqueKey(map, base) {
|
|
|
1051
1086
|
exports.uniqueKey = uniqueKey;
|
|
1052
1087
|
/**
|
|
1053
1088
|
* Determines the major version number of bootstrap.
|
|
1054
|
-
*
|
|
1055
|
-
* @
|
|
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.
|
|
1056
1092
|
*/
|
|
1057
1093
|
function bootstrapVersion(options) {
|
|
1058
1094
|
if (options.bootstrap) {
|
|
@@ -1070,9 +1106,8 @@ exports.bootstrapVersion = bootstrapVersion;
|
|
|
1070
1106
|
/**
|
|
1071
1107
|
* Retrun provided argument.
|
|
1072
1108
|
* If argument is a function, returns the result of a function call.
|
|
1073
|
-
* @param {
|
|
1074
|
-
*
|
|
1075
|
-
* @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.
|
|
1076
1111
|
*/
|
|
1077
1112
|
function unfold(e) {
|
|
1078
1113
|
if (typeof e === 'function') {
|
|
@@ -1083,27 +1118,32 @@ function unfold(e) {
|
|
|
1083
1118
|
exports.unfold = unfold;
|
|
1084
1119
|
/**
|
|
1085
1120
|
* Map values through unfold and return first non-nil value.
|
|
1086
|
-
* @param {Array<T>} collection
|
|
1087
|
-
*
|
|
1088
|
-
* @return {T}
|
|
1121
|
+
* @param {Array<T>} collection - The collection to map through unfold.;
|
|
1122
|
+
* @returns {T} - The first non-nil value.
|
|
1089
1123
|
*/
|
|
1090
1124
|
exports.firstNonNil = lodash_1.default.flow([
|
|
1091
1125
|
lodash_1.default.partialRight(lodash_1.default.map, unfold),
|
|
1092
1126
|
lodash_1.default.partialRight(lodash_1.default.find, v => !lodash_1.default.isUndefined(v))
|
|
1093
1127
|
]);
|
|
1094
|
-
|
|
1095
|
-
* Create enclosed state.
|
|
1096
|
-
* Returns functions to getting and cycling between states.
|
|
1128
|
+
/**
|
|
1129
|
+
* Create enclosed state. Returns functions to getting and cycling between states.
|
|
1097
1130
|
* @param {*} a - initial state.
|
|
1098
1131
|
* @param {*} b - next state.
|
|
1099
|
-
* @
|
|
1132
|
+
* @returns {Functions[]} -- [get, toggle];
|
|
1100
1133
|
*/
|
|
1101
1134
|
function withSwitch(a, b) {
|
|
1102
1135
|
let state = a;
|
|
1103
1136
|
let next = b;
|
|
1137
|
+
/**
|
|
1138
|
+
* Returns the state of the switch.
|
|
1139
|
+
* @returns {*} - The current state.
|
|
1140
|
+
*/
|
|
1104
1141
|
function get() {
|
|
1105
1142
|
return state;
|
|
1106
1143
|
}
|
|
1144
|
+
/**
|
|
1145
|
+
* Toggles the state of the switch.
|
|
1146
|
+
*/
|
|
1107
1147
|
function toggle() {
|
|
1108
1148
|
const prev = state;
|
|
1109
1149
|
state = next;
|
|
@@ -1112,6 +1152,14 @@ function withSwitch(a, b) {
|
|
|
1112
1152
|
return [get, toggle];
|
|
1113
1153
|
}
|
|
1114
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
|
+
*/
|
|
1115
1163
|
function observeOverload(callback, options = {}) {
|
|
1116
1164
|
const { limit = 50, delay = 500 } = options;
|
|
1117
1165
|
let callCount = 0;
|
|
@@ -1132,6 +1180,13 @@ function observeOverload(callback, options = {}) {
|
|
|
1132
1180
|
};
|
|
1133
1181
|
}
|
|
1134
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
|
+
*/
|
|
1135
1190
|
function getContextComponents(context, excludeNested, excludedTypes = []) {
|
|
1136
1191
|
const values = [];
|
|
1137
1192
|
context.utils.eachComponent(context.instance.options.editForm.components, (component, path) => {
|
|
@@ -1146,6 +1201,11 @@ function getContextComponents(context, excludeNested, excludedTypes = []) {
|
|
|
1146
1201
|
return values;
|
|
1147
1202
|
}
|
|
1148
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
|
+
*/
|
|
1149
1209
|
function getContextButtons(context) {
|
|
1150
1210
|
const values = [];
|
|
1151
1211
|
context.utils.eachComponent(context.instance.options.editForm.components, (component) => {
|
|
@@ -1163,18 +1223,15 @@ exports.getContextButtons = getContextButtons;
|
|
|
1163
1223
|
const inTextTags = ['#text', 'A', 'B', 'EM', 'I', 'SMALL', 'STRONG', 'SUB', 'SUP', 'INS', 'DEL', 'MARK', 'CODE'];
|
|
1164
1224
|
/**
|
|
1165
1225
|
* Helper function for 'translateHTMLTemplate'. Translates text value of the passed html element.
|
|
1166
|
-
*
|
|
1167
|
-
* @param {
|
|
1168
|
-
* @
|
|
1169
|
-
*
|
|
1170
|
-
* @returns {String}
|
|
1171
|
-
* Translated element template.
|
|
1226
|
+
* @param {HTMLElement} elem - The element to translate.
|
|
1227
|
+
* @param {Function} translate - The translation function.
|
|
1228
|
+
* @returns {string} - Translated element template.
|
|
1172
1229
|
*/
|
|
1173
1230
|
function translateElemValue(elem, translate) {
|
|
1174
1231
|
if (!elem.innerText) {
|
|
1175
1232
|
return elem.innerHTML;
|
|
1176
1233
|
}
|
|
1177
|
-
const elemValue = elem.innerText.replace(Evaluator_1.
|
|
1234
|
+
const elemValue = elem.innerText.replace(Evaluator_1.Evaluator.templateSettings.interpolate, '').replace(/\s\s+/g, ' ').trim();
|
|
1178
1235
|
const translatedValue = translate(elemValue);
|
|
1179
1236
|
if (elemValue !== translatedValue) {
|
|
1180
1237
|
const links = elem.innerHTML.match(/<a[^>]*>(.*?)<\/a>/g);
|
|
@@ -1199,10 +1256,8 @@ function translateElemValue(elem, translate) {
|
|
|
1199
1256
|
}
|
|
1200
1257
|
/**
|
|
1201
1258
|
* Helper function for 'translateHTMLTemplate'. Goes deep through html tag children and calls function to translate their text values.
|
|
1202
|
-
*
|
|
1203
|
-
* @param {
|
|
1204
|
-
* @param {Function} translate
|
|
1205
|
-
*
|
|
1259
|
+
* @param {HTMLElement} tag - The tag to translate.
|
|
1260
|
+
* @param {Function} translate - The translation function.
|
|
1206
1261
|
* @returns {void}
|
|
1207
1262
|
*/
|
|
1208
1263
|
function translateDeepTag(tag, translate) {
|
|
@@ -1218,12 +1273,9 @@ function translateDeepTag(tag, translate) {
|
|
|
1218
1273
|
}
|
|
1219
1274
|
/**
|
|
1220
1275
|
* Translates text values in html template.
|
|
1221
|
-
*
|
|
1222
|
-
* @param {
|
|
1223
|
-
* @
|
|
1224
|
-
*
|
|
1225
|
-
* @returns {String}
|
|
1226
|
-
* 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.
|
|
1227
1279
|
*/
|
|
1228
1280
|
function translateHTMLTemplate(template, translate) {
|
|
1229
1281
|
const isHTML = /<[^>]*>/.test(template);
|
|
@@ -1241,9 +1293,9 @@ function translateHTMLTemplate(template, translate) {
|
|
|
1241
1293
|
exports.translateHTMLTemplate = translateHTMLTemplate;
|
|
1242
1294
|
/**
|
|
1243
1295
|
* Sanitize an html string.
|
|
1244
|
-
*
|
|
1245
|
-
* @param
|
|
1246
|
-
* @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.
|
|
1247
1299
|
*/
|
|
1248
1300
|
function sanitize(string, options) {
|
|
1249
1301
|
if (typeof dompurify_1.default.sanitize !== 'function') {
|
|
@@ -1292,11 +1344,18 @@ function sanitize(string, options) {
|
|
|
1292
1344
|
exports.sanitize = sanitize;
|
|
1293
1345
|
/**
|
|
1294
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.
|
|
1295
1349
|
*/
|
|
1296
1350
|
function fastCloneDeep(obj) {
|
|
1297
1351
|
return obj ? JSON.parse(JSON.stringify(obj)) : obj;
|
|
1298
1352
|
}
|
|
1299
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
|
+
*/
|
|
1300
1359
|
function isInputComponent(componentJson) {
|
|
1301
1360
|
if (componentJson.input === false || componentJson.input === true) {
|
|
1302
1361
|
return componentJson.input;
|
|
@@ -1317,6 +1376,11 @@ function isInputComponent(componentJson) {
|
|
|
1317
1376
|
}
|
|
1318
1377
|
}
|
|
1319
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
|
+
*/
|
|
1320
1384
|
function getArrayFromComponentPath(pathStr) {
|
|
1321
1385
|
if (!pathStr || !lodash_1.default.isString(pathStr)) {
|
|
1322
1386
|
if (!lodash_1.default.isArray(pathStr)) {
|
|
@@ -1331,6 +1395,12 @@ function getArrayFromComponentPath(pathStr) {
|
|
|
1331
1395
|
.map(part => lodash_1.default.defaultTo(lodash_1.default.toNumber(part), part));
|
|
1332
1396
|
}
|
|
1333
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
|
+
*/
|
|
1334
1404
|
function isChildOf(child, parent) {
|
|
1335
1405
|
while (child && child.parent) {
|
|
1336
1406
|
if (child.parent === parent) {
|
|
@@ -1341,6 +1411,11 @@ function isChildOf(child, parent) {
|
|
|
1341
1411
|
return false;
|
|
1342
1412
|
}
|
|
1343
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
|
+
*/
|
|
1344
1419
|
function getStringFromComponentPath(path) {
|
|
1345
1420
|
if (!lodash_1.default.isArray(path)) {
|
|
1346
1421
|
return path;
|
|
@@ -1357,17 +1432,22 @@ function getStringFromComponentPath(path) {
|
|
|
1357
1432
|
return strPath;
|
|
1358
1433
|
}
|
|
1359
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
|
+
*/
|
|
1360
1441
|
function round(number, precision) {
|
|
1361
1442
|
if (lodash_1.default.isNumber(number)) {
|
|
1362
1443
|
return number.toFixed(precision);
|
|
1363
1444
|
}
|
|
1364
|
-
return number;
|
|
1445
|
+
return number.toString();
|
|
1365
1446
|
}
|
|
1366
1447
|
exports.round = round;
|
|
1367
1448
|
/**
|
|
1368
1449
|
* Check for Internet Explorer browser version
|
|
1369
|
-
*
|
|
1370
|
-
* @return {(number|null)}
|
|
1450
|
+
* @returns {(number|null)} - The IE browser version or null if not IE
|
|
1371
1451
|
*/
|
|
1372
1452
|
function getIEBrowserVersion() {
|
|
1373
1453
|
const { ie, version } = getBrowserInfo();
|
|
@@ -1376,8 +1456,7 @@ function getIEBrowserVersion() {
|
|
|
1376
1456
|
exports.getIEBrowserVersion = getIEBrowserVersion;
|
|
1377
1457
|
/**
|
|
1378
1458
|
* Get browser name and version (modified from 'jquery-browser-plugin')
|
|
1379
|
-
*
|
|
1380
|
-
* @return {Object} -- {{browser name, version, isWebkit?}}
|
|
1459
|
+
* @returns {object} -- {{browser name, version, isWebkit?}}
|
|
1381
1460
|
* Possible browser names: chrome, safari, ie, edge, opera, mozilla, yabrowser
|
|
1382
1461
|
*/
|
|
1383
1462
|
function getBrowserInfo() {
|
|
@@ -1426,13 +1505,20 @@ function getBrowserInfo() {
|
|
|
1426
1505
|
return browser;
|
|
1427
1506
|
}
|
|
1428
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
|
+
*/
|
|
1429
1513
|
function getComponentPathWithoutIndicies(path = '') {
|
|
1430
1514
|
return path.replace(/\[\d+\]/, '');
|
|
1431
1515
|
}
|
|
1432
1516
|
exports.getComponentPathWithoutIndicies = getComponentPathWithoutIndicies;
|
|
1433
1517
|
/**
|
|
1434
1518
|
* Returns a path to the component which based on its schema
|
|
1435
|
-
* @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
|
|
1436
1522
|
*/
|
|
1437
1523
|
function getComponentPath(component, path = '') {
|
|
1438
1524
|
var _a;
|
|
@@ -1445,8 +1531,8 @@ function getComponentPath(component, path = '') {
|
|
|
1445
1531
|
exports.getComponentPath = getComponentPath;
|
|
1446
1532
|
/**
|
|
1447
1533
|
* Returns a parent component of the passed component instance skipping all the Layout components
|
|
1448
|
-
* @param {
|
|
1449
|
-
* @
|
|
1534
|
+
* @param {Component} componentInstance - The component to check for the parent.
|
|
1535
|
+
* @returns {Component|undefined} - The parent data component.
|
|
1450
1536
|
*/
|
|
1451
1537
|
function getDataParentComponent(componentInstance) {
|
|
1452
1538
|
if (!componentInstance) {
|
|
@@ -1463,8 +1549,8 @@ function getDataParentComponent(componentInstance) {
|
|
|
1463
1549
|
exports.getDataParentComponent = getDataParentComponent;
|
|
1464
1550
|
/**
|
|
1465
1551
|
* Returns whether the value is a promise
|
|
1466
|
-
* @param value
|
|
1467
|
-
* @
|
|
1552
|
+
* @param {any} value - The value to check
|
|
1553
|
+
* @returns {boolean} - TRUE if the value is a promise; FALSE otherwise
|
|
1468
1554
|
*/
|
|
1469
1555
|
function isPromise(value) {
|
|
1470
1556
|
return value
|
|
@@ -1476,9 +1562,9 @@ exports.isPromise = isPromise;
|
|
|
1476
1562
|
/**
|
|
1477
1563
|
* Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
|
|
1478
1564
|
* changes by itself, e.g. EditGrid)
|
|
1479
|
-
* @param componentInstance
|
|
1480
|
-
* @param firstPass
|
|
1481
|
-
* @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
|
|
1482
1568
|
*/
|
|
1483
1569
|
function isInsideScopingComponent(componentInstance, firstPass = true) {
|
|
1484
1570
|
if (!firstPass && (componentInstance === null || componentInstance === void 0 ? void 0 : componentInstance.hasScopedChildren)) {
|
|
@@ -1494,6 +1580,11 @@ function isInsideScopingComponent(componentInstance, firstPass = true) {
|
|
|
1494
1580
|
return false;
|
|
1495
1581
|
}
|
|
1496
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
|
+
*/
|
|
1497
1588
|
function getFocusableElements(element) {
|
|
1498
1589
|
const focusableSelector = `button:not([disabled]), input:not([disabled]), select:not([disabled]),
|
|
1499
1590
|
textarea:not([disabled]), button:not([disabled]), [href]`;
|
|
@@ -1509,6 +1600,11 @@ exports.componentValueTypes = {
|
|
|
1509
1600
|
date: 'date',
|
|
1510
1601
|
any: 'any',
|
|
1511
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
|
+
*/
|
|
1512
1608
|
function getComponentSavedTypes(fullSchema) {
|
|
1513
1609
|
const schema = fullSchema || {};
|
|
1514
1610
|
if (schema.persistent !== true) {
|
|
@@ -1522,9 +1618,10 @@ function getComponentSavedTypes(fullSchema) {
|
|
|
1522
1618
|
exports.getComponentSavedTypes = getComponentSavedTypes;
|
|
1523
1619
|
/**
|
|
1524
1620
|
* Interpolates @formio/core errors so that they are compatible with the renderer
|
|
1525
|
-
* @param {
|
|
1526
|
-
* @param
|
|
1527
|
-
* @
|
|
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
|
|
1528
1625
|
*/
|
|
1529
1626
|
const interpolateErrors = (component, errors, interpolateFn) => {
|
|
1530
1627
|
return errors.map((error) => {
|
|
@@ -1535,6 +1632,11 @@ const interpolateErrors = (component, errors, interpolateFn) => {
|
|
|
1535
1632
|
});
|
|
1536
1633
|
};
|
|
1537
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
|
+
*/
|
|
1538
1640
|
function getItemTemplateKeys(template) {
|
|
1539
1641
|
const templateKeys = [];
|
|
1540
1642
|
if (!template) {
|
|
@@ -1552,6 +1654,11 @@ function getItemTemplateKeys(template) {
|
|
|
1552
1654
|
return templateKeys;
|
|
1553
1655
|
}
|
|
1554
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
|
+
*/
|
|
1555
1662
|
function isSelectResourceWithObjectValue(comp = {}) {
|
|
1556
1663
|
const { reference, dataSrc, valueProperty } = comp;
|
|
1557
1664
|
return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));
|