@formio/js 5.0.0-dev.5641.6eb7b96 → 5.0.0-dev.5642.f9208f7
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 +0 -43
- 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 +1189 -608
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +5 -3
- package/dist/formio.full.js +913 -652
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +5 -3
- 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 +494 -1831
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +4 -10
- package/lib/cjs/CDN.d.ts +0 -1
- package/lib/cjs/CDN.js +3 -6
- package/lib/cjs/Element.d.ts +96 -86
- package/lib/cjs/Element.js +78 -68
- package/lib/cjs/Embed.d.ts +1 -1
- package/lib/cjs/Embed.js +12 -52
- package/lib/cjs/Form.d.ts +36 -365
- package/lib/cjs/Form.js +64 -50
- package/lib/cjs/FormBuilder.d.ts +2 -187
- package/lib/cjs/FormBuilder.js +8 -30
- package/lib/cjs/PDF.d.ts +13 -11
- package/lib/cjs/PDF.js +8 -6
- package/lib/cjs/Webform.d.ts +139 -180
- package/lib/cjs/Webform.js +296 -309
- package/lib/cjs/WebformBuilder.d.ts +14 -16
- package/lib/cjs/WebformBuilder.js +12 -19
- package/lib/cjs/Wizard.d.ts +21 -31
- package/lib/cjs/Wizard.js +20 -43
- package/lib/cjs/WizardBuilder.d.ts +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
- 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 +269 -502
- package/lib/cjs/components/_classes/component/Component.form.d.ts +3 -6
- package/lib/cjs/components/_classes/component/Component.form.js +0 -5
- package/lib/cjs/components/_classes/component/Component.js +190 -434
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
- 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 +2 -11
- package/lib/cjs/components/_classes/field/Field.js +1 -13
- package/lib/cjs/components/_classes/input/Input.d.ts +3 -4
- 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 +3 -6
- package/lib/cjs/components/_classes/list/ListComponent.form.js +0 -5
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +3 -37
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +67 -163
- package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +0 -5
- package/lib/cjs/components/_classes/nested/NestedComponent.js +54 -175
- 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 +1 -7
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
- package/lib/cjs/components/address/Address.d.ts +2 -4
- package/lib/cjs/components/address/Address.form.d.ts +3 -6
- package/lib/cjs/components/address/Address.form.js +0 -5
- package/lib/cjs/components/button/Button.d.ts +12 -3
- package/lib/cjs/components/button/Button.form.d.ts +3 -6
- package/lib/cjs/components/button/Button.form.js +0 -5
- package/lib/cjs/components/button/Button.js +0 -5
- package/lib/cjs/components/checkbox/Checkbox.d.ts +27 -4
- package/lib/cjs/components/checkbox/Checkbox.form.d.ts +3 -6
- package/lib/cjs/components/checkbox/Checkbox.form.js +0 -5
- package/lib/cjs/components/columns/Columns.d.ts +2 -3
- package/lib/cjs/components/columns/Columns.form.d.ts +3 -6
- package/lib/cjs/components/columns/Columns.form.js +0 -5
- package/lib/cjs/components/columns/Columns.js +1 -1
- package/lib/cjs/components/container/Container.form.d.ts +3 -6
- package/lib/cjs/components/container/Container.form.js +0 -5
- package/lib/cjs/components/content/Content.d.ts +1 -2
- package/lib/cjs/components/content/Content.form.d.ts +3 -6
- package/lib/cjs/components/content/Content.form.js +0 -5
- package/lib/cjs/components/currency/Currency.form.d.ts +3 -6
- package/lib/cjs/components/currency/Currency.form.js +0 -5
- package/lib/cjs/components/currency/Currency.js +2 -1
- package/lib/cjs/components/datagrid/DataGrid.d.ts +7 -8
- package/lib/cjs/components/datagrid/DataGrid.form.d.ts +3 -6
- package/lib/cjs/components/datagrid/DataGrid.form.js +0 -5
- package/lib/cjs/components/datagrid/DataGrid.js +5 -5
- package/lib/cjs/components/datamap/DataMap.d.ts +0 -1
- package/lib/cjs/components/datamap/DataMap.form.d.ts +3 -6
- package/lib/cjs/components/datamap/DataMap.form.js +0 -5
- package/lib/cjs/components/datetime/DateTime.d.ts +14 -0
- package/lib/cjs/components/datetime/DateTime.form.d.ts +3 -6
- package/lib/cjs/components/datetime/DateTime.form.js +0 -5
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
- package/lib/cjs/components/day/Day.d.ts +48 -22
- package/lib/cjs/components/day/Day.form.d.ts +3 -6
- package/lib/cjs/components/day/Day.form.js +0 -5
- package/lib/cjs/components/day/Day.js +20 -15
- package/lib/cjs/components/editgrid/EditGrid.d.ts +3 -7
- package/lib/cjs/components/editgrid/EditGrid.form.d.ts +3 -6
- package/lib/cjs/components/editgrid/EditGrid.form.js +0 -5
- package/lib/cjs/components/editgrid/EditGrid.js +3 -3
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +5 -2
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +9 -6
- package/lib/cjs/components/email/Email.form.d.ts +3 -6
- package/lib/cjs/components/email/Email.form.js +0 -5
- package/lib/cjs/components/fieldset/Fieldset.form.d.ts +3 -6
- package/lib/cjs/components/fieldset/Fieldset.form.js +0 -5
- package/lib/cjs/components/file/File.d.ts +22 -9
- package/lib/cjs/components/file/File.form.d.ts +3 -6
- package/lib/cjs/components/file/File.form.js +0 -5
- package/lib/cjs/components/file/File.js +1 -1
- package/lib/cjs/components/form/Form.d.ts +20 -31
- package/lib/cjs/components/form/Form.form.d.ts +3 -6
- package/lib/cjs/components/form/Form.form.js +0 -5
- package/lib/cjs/components/form/Form.js +10 -13
- package/lib/cjs/components/hidden/Hidden.d.ts +11 -1
- package/lib/cjs/components/hidden/Hidden.form.d.ts +3 -6
- package/lib/cjs/components/hidden/Hidden.form.js +0 -5
- package/lib/cjs/components/hidden/Hidden.js +2 -1
- package/lib/cjs/components/html/HTML.d.ts +1 -2
- package/lib/cjs/components/html/HTML.form.d.ts +3 -6
- package/lib/cjs/components/html/HTML.form.js +0 -5
- package/lib/cjs/components/number/Number.d.ts +17 -3
- package/lib/cjs/components/number/Number.form.d.ts +3 -6
- package/lib/cjs/components/number/Number.form.js +0 -5
- package/lib/cjs/components/number/Number.js +2 -1
- package/lib/cjs/components/panel/Panel.form.d.ts +3 -6
- package/lib/cjs/components/panel/Panel.form.js +0 -5
- package/lib/cjs/components/panel/Panel.js +1 -0
- package/lib/cjs/components/password/Password.form.d.ts +3 -6
- package/lib/cjs/components/password/Password.form.js +0 -5
- package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +0 -5
- package/lib/cjs/components/radio/Radio.d.ts +26 -3
- package/lib/cjs/components/radio/Radio.form.d.ts +3 -6
- package/lib/cjs/components/radio/Radio.form.js +0 -5
- package/lib/cjs/components/radio/Radio.js +4 -3
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +3 -6
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +0 -5
- package/lib/cjs/components/select/Select.d.ts +39 -16
- package/lib/cjs/components/select/Select.form.d.ts +3 -6
- package/lib/cjs/components/select/Select.form.js +0 -5
- package/lib/cjs/components/select/Select.js +16 -13
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +17 -2
- package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
- package/lib/cjs/components/selectboxes/SelectBoxes.form.js +0 -5
- package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -7
- package/lib/cjs/components/signature/Signature.d.ts +14 -1
- package/lib/cjs/components/signature/Signature.form.d.ts +3 -6
- package/lib/cjs/components/signature/Signature.form.js +0 -5
- package/lib/cjs/components/survey/Survey.d.ts +15 -3
- package/lib/cjs/components/survey/Survey.form.d.ts +3 -6
- package/lib/cjs/components/survey/Survey.form.js +0 -5
- package/lib/cjs/components/table/Table.d.ts +1 -2
- package/lib/cjs/components/table/Table.form.d.ts +3 -6
- package/lib/cjs/components/table/Table.form.js +0 -5
- package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/cjs/components/tabs/Tabs.form.d.ts +3 -6
- package/lib/cjs/components/tabs/Tabs.form.js +0 -5
- package/lib/cjs/components/tabs/Tabs.js +2 -1
- package/lib/cjs/components/tags/Tags.d.ts +14 -0
- package/lib/cjs/components/tags/Tags.form.d.ts +3 -6
- package/lib/cjs/components/tags/Tags.form.js +0 -5
- package/lib/cjs/components/textarea/TextArea.d.ts +9 -4
- package/lib/cjs/components/textarea/TextArea.form.d.ts +3 -6
- package/lib/cjs/components/textarea/TextArea.form.js +0 -5
- package/lib/cjs/components/textarea/TextArea.js +2 -2
- package/lib/cjs/components/textfield/TextField.d.ts +30 -14
- package/lib/cjs/components/textfield/TextField.form.d.ts +3 -6
- package/lib/cjs/components/textfield/TextField.form.js +0 -5
- package/lib/cjs/components/textfield/TextField.js +17 -14
- package/lib/cjs/components/time/Time.form.d.ts +3 -6
- package/lib/cjs/components/time/Time.form.js +0 -5
- package/lib/cjs/components/unknown/Unknown.form.d.ts +34 -5
- package/lib/cjs/components/unknown/Unknown.form.js +0 -4
- package/lib/cjs/components/url/Url.form.d.ts +3 -6
- package/lib/cjs/components/url/Url.form.js +0 -5
- package/lib/cjs/components/well/Well.form.d.ts +3 -6
- package/lib/cjs/components/well/Well.form.js +0 -5
- package/lib/cjs/formio.embed.d.ts +2 -1
- package/lib/cjs/formio.embed.js +100 -2
- package/lib/cjs/formio.form.d.ts +4 -11
- package/lib/cjs/formio.form.js +5 -13
- package/lib/cjs/providers/Providers.d.ts +5 -36
- package/lib/cjs/providers/Providers.js +0 -29
- package/lib/cjs/providers/address/AddressProvider.d.ts +12 -131
- package/lib/cjs/providers/address/AddressProvider.js +2 -88
- package/lib/cjs/providers/address/AzureAddressProvider.d.ts +1 -48
- package/lib/cjs/providers/address/AzureAddressProvider.js +0 -37
- package/lib/cjs/providers/address/CustomAddressProvider.d.ts +4 -27
- package/lib/cjs/providers/address/CustomAddressProvider.js +0 -34
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +6 -130
- package/lib/cjs/providers/address/GoogleAddressProvider.js +0 -72
- package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +7 -32
- package/lib/cjs/providers/address/NominatimAddressProvider.js +0 -33
- package/lib/cjs/providers/address/index.d.ts +1 -3
- package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -7
- package/lib/cjs/providers/processor/fileProcessor.js +0 -6
- package/lib/cjs/providers/storage/azure.d.ts +13 -6
- package/lib/cjs/providers/storage/azure.js +0 -5
- package/lib/cjs/providers/storage/base64.d.ts +6 -5
- package/lib/cjs/providers/storage/base64.js +0 -4
- package/lib/cjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/cjs/providers/storage/dropbox.js +0 -5
- package/lib/cjs/providers/storage/googleDrive.d.ts +5 -7
- package/lib/cjs/providers/storage/googleDrive.js +0 -6
- package/lib/cjs/providers/storage/indexeddb.d.ts +7 -5
- package/lib/cjs/providers/storage/indexeddb.js +0 -4
- package/lib/cjs/providers/storage/s3.d.ts +20 -6
- package/lib/cjs/providers/storage/s3.js +0 -5
- package/lib/cjs/providers/storage/url.d.ts +7 -6
- package/lib/cjs/providers/storage/url.js +0 -10
- package/lib/cjs/providers/storage/util.d.ts +1 -24
- package/lib/cjs/providers/storage/util.js +0 -18
- package/lib/cjs/templates/Templates.d.ts +0 -1
- package/lib/cjs/utils/Evaluator.d.ts +3 -6
- package/lib/cjs/utils/Evaluator.js +20 -11
- package/lib/cjs/utils/builder.d.ts +7 -9
- package/lib/cjs/utils/builder.js +5 -10
- package/lib/cjs/utils/calendarUtils.d.ts +13 -7
- package/lib/cjs/utils/calendarUtils.js +17 -10
- package/lib/cjs/utils/formUtils.d.ts +171 -43
- package/lib/cjs/utils/formUtils.js +569 -38
- package/lib/cjs/utils/utils.d.ts +221 -367
- package/lib/cjs/utils/utils.js +228 -335
- package/lib/cjs/widgets/CalendarWidget.d.ts +10 -9
- package/lib/cjs/widgets/CalendarWidget.js +11 -9
- package/lib/mjs/CDN.d.ts +0 -1
- package/lib/mjs/CDN.js +3 -6
- package/lib/mjs/Element.d.ts +96 -86
- package/lib/mjs/Element.js +78 -68
- package/lib/mjs/Embed.d.ts +1 -1
- package/lib/mjs/Embed.js +12 -52
- package/lib/mjs/Form.d.ts +36 -365
- package/lib/mjs/Form.js +57 -140
- package/lib/mjs/FormBuilder.d.ts +2 -187
- package/lib/mjs/FormBuilder.js +8 -32
- package/lib/mjs/PDF.d.ts +13 -11
- package/lib/mjs/PDF.js +8 -6
- package/lib/mjs/Webform.d.ts +139 -180
- package/lib/mjs/Webform.js +308 -321
- package/lib/mjs/WebformBuilder.d.ts +14 -16
- package/lib/mjs/WebformBuilder.js +12 -19
- package/lib/mjs/Wizard.d.ts +21 -31
- package/lib/mjs/Wizard.js +19 -42
- package/lib/mjs/WizardBuilder.d.ts +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
- 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 +269 -502
- package/lib/mjs/components/_classes/component/Component.form.d.ts +3 -6
- package/lib/mjs/components/_classes/component/Component.form.js +0 -5
- package/lib/mjs/components/_classes/component/Component.js +190 -434
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
- 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 +2 -11
- package/lib/mjs/components/_classes/field/Field.js +1 -13
- package/lib/mjs/components/_classes/input/Input.d.ts +3 -4
- 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 +3 -6
- package/lib/mjs/components/_classes/list/ListComponent.form.js +0 -5
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +3 -37
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +67 -163
- package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +0 -5
- package/lib/mjs/components/_classes/nested/NestedComponent.js +54 -175
- 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 +1 -7
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
- package/lib/mjs/components/address/Address.d.ts +2 -4
- package/lib/mjs/components/address/Address.form.d.ts +3 -6
- package/lib/mjs/components/address/Address.form.js +0 -5
- package/lib/mjs/components/button/Button.d.ts +12 -3
- package/lib/mjs/components/button/Button.form.d.ts +3 -6
- package/lib/mjs/components/button/Button.form.js +0 -5
- package/lib/mjs/components/button/Button.js +0 -5
- package/lib/mjs/components/checkbox/Checkbox.d.ts +27 -4
- package/lib/mjs/components/checkbox/Checkbox.form.d.ts +3 -6
- package/lib/mjs/components/checkbox/Checkbox.form.js +0 -5
- package/lib/mjs/components/columns/Columns.d.ts +2 -3
- package/lib/mjs/components/columns/Columns.form.d.ts +3 -6
- package/lib/mjs/components/columns/Columns.form.js +0 -5
- package/lib/mjs/components/columns/Columns.js +1 -1
- package/lib/mjs/components/container/Container.form.d.ts +3 -6
- package/lib/mjs/components/container/Container.form.js +0 -5
- package/lib/mjs/components/content/Content.d.ts +1 -2
- package/lib/mjs/components/content/Content.form.d.ts +3 -6
- package/lib/mjs/components/content/Content.form.js +0 -5
- package/lib/mjs/components/currency/Currency.form.d.ts +3 -6
- package/lib/mjs/components/currency/Currency.form.js +0 -5
- package/lib/mjs/components/currency/Currency.js +2 -1
- package/lib/mjs/components/datagrid/DataGrid.d.ts +7 -8
- package/lib/mjs/components/datagrid/DataGrid.form.d.ts +3 -6
- package/lib/mjs/components/datagrid/DataGrid.form.js +0 -5
- package/lib/mjs/components/datagrid/DataGrid.js +5 -5
- package/lib/mjs/components/datamap/DataMap.d.ts +0 -1
- package/lib/mjs/components/datamap/DataMap.form.d.ts +3 -6
- package/lib/mjs/components/datamap/DataMap.form.js +0 -5
- package/lib/mjs/components/datetime/DateTime.d.ts +14 -0
- package/lib/mjs/components/datetime/DateTime.form.d.ts +3 -6
- package/lib/mjs/components/datetime/DateTime.form.js +0 -5
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +48 -22
- package/lib/mjs/components/day/Day.form.d.ts +3 -6
- package/lib/mjs/components/day/Day.form.js +0 -5
- package/lib/mjs/components/day/Day.js +20 -15
- package/lib/mjs/components/editgrid/EditGrid.d.ts +3 -7
- package/lib/mjs/components/editgrid/EditGrid.form.d.ts +3 -6
- package/lib/mjs/components/editgrid/EditGrid.form.js +0 -5
- 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 +3 -6
- package/lib/mjs/components/email/Email.form.js +0 -5
- package/lib/mjs/components/fieldset/Fieldset.form.d.ts +3 -6
- package/lib/mjs/components/fieldset/Fieldset.form.js +0 -5
- package/lib/mjs/components/file/File.d.ts +22 -9
- package/lib/mjs/components/file/File.form.d.ts +3 -6
- package/lib/mjs/components/file/File.form.js +0 -5
- package/lib/mjs/components/file/File.js +1 -1
- package/lib/mjs/components/form/Form.d.ts +20 -31
- package/lib/mjs/components/form/Form.form.d.ts +3 -6
- package/lib/mjs/components/form/Form.form.js +0 -5
- package/lib/mjs/components/form/Form.js +10 -13
- package/lib/mjs/components/hidden/Hidden.d.ts +11 -1
- package/lib/mjs/components/hidden/Hidden.form.d.ts +3 -6
- package/lib/mjs/components/hidden/Hidden.form.js +0 -5
- package/lib/mjs/components/hidden/Hidden.js +2 -1
- package/lib/mjs/components/html/HTML.d.ts +1 -2
- package/lib/mjs/components/html/HTML.form.d.ts +3 -6
- package/lib/mjs/components/html/HTML.form.js +0 -5
- package/lib/mjs/components/number/Number.d.ts +17 -3
- package/lib/mjs/components/number/Number.form.d.ts +3 -6
- package/lib/mjs/components/number/Number.form.js +0 -5
- package/lib/mjs/components/number/Number.js +2 -1
- package/lib/mjs/components/panel/Panel.form.d.ts +3 -6
- package/lib/mjs/components/panel/Panel.form.js +0 -5
- package/lib/mjs/components/panel/Panel.js +1 -0
- package/lib/mjs/components/password/Password.form.d.ts +3 -6
- package/lib/mjs/components/password/Password.form.js +0 -5
- package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +0 -5
- package/lib/mjs/components/radio/Radio.d.ts +26 -3
- package/lib/mjs/components/radio/Radio.form.d.ts +3 -6
- package/lib/mjs/components/radio/Radio.form.js +0 -5
- package/lib/mjs/components/radio/Radio.js +4 -3
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +3 -6
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +0 -5
- package/lib/mjs/components/select/Select.d.ts +39 -16
- package/lib/mjs/components/select/Select.form.d.ts +3 -6
- package/lib/mjs/components/select/Select.form.js +0 -5
- package/lib/mjs/components/select/Select.js +17 -14
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +17 -2
- package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
- package/lib/mjs/components/selectboxes/SelectBoxes.form.js +0 -5
- package/lib/mjs/components/selectboxes/SelectBoxes.js +9 -7
- package/lib/mjs/components/signature/Signature.d.ts +14 -1
- package/lib/mjs/components/signature/Signature.form.d.ts +3 -6
- package/lib/mjs/components/signature/Signature.form.js +0 -5
- package/lib/mjs/components/survey/Survey.d.ts +15 -3
- package/lib/mjs/components/survey/Survey.form.d.ts +3 -6
- package/lib/mjs/components/survey/Survey.form.js +0 -5
- package/lib/mjs/components/table/Table.d.ts +1 -2
- package/lib/mjs/components/table/Table.form.d.ts +3 -6
- package/lib/mjs/components/table/Table.form.js +0 -5
- package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/mjs/components/tabs/Tabs.form.d.ts +3 -6
- package/lib/mjs/components/tabs/Tabs.form.js +0 -5
- package/lib/mjs/components/tabs/Tabs.js +2 -1
- package/lib/mjs/components/tags/Tags.d.ts +14 -0
- package/lib/mjs/components/tags/Tags.form.d.ts +3 -6
- package/lib/mjs/components/tags/Tags.form.js +0 -5
- package/lib/mjs/components/textarea/TextArea.d.ts +9 -4
- package/lib/mjs/components/textarea/TextArea.form.d.ts +3 -6
- package/lib/mjs/components/textarea/TextArea.form.js +0 -5
- package/lib/mjs/components/textarea/TextArea.js +2 -2
- package/lib/mjs/components/textfield/TextField.d.ts +30 -14
- package/lib/mjs/components/textfield/TextField.form.d.ts +3 -6
- package/lib/mjs/components/textfield/TextField.form.js +0 -5
- package/lib/mjs/components/textfield/TextField.js +17 -14
- package/lib/mjs/components/time/Time.form.d.ts +3 -6
- package/lib/mjs/components/time/Time.form.js +0 -5
- package/lib/mjs/components/unknown/Unknown.form.d.ts +34 -5
- package/lib/mjs/components/unknown/Unknown.form.js +0 -4
- package/lib/mjs/components/url/Url.form.d.ts +3 -6
- package/lib/mjs/components/url/Url.form.js +0 -5
- package/lib/mjs/components/well/Well.form.d.ts +3 -6
- package/lib/mjs/components/well/Well.form.js +0 -5
- package/lib/mjs/formio.embed.d.ts +2 -1
- package/lib/mjs/formio.embed.js +99 -2
- package/lib/mjs/formio.form.d.ts +4 -11
- package/lib/mjs/formio.form.js +3 -10
- package/lib/mjs/providers/Providers.d.ts +5 -36
- package/lib/mjs/providers/Providers.js +0 -29
- package/lib/mjs/providers/address/AddressProvider.d.ts +12 -131
- package/lib/mjs/providers/address/AddressProvider.js +2 -88
- package/lib/mjs/providers/address/AzureAddressProvider.d.ts +1 -48
- package/lib/mjs/providers/address/AzureAddressProvider.js +0 -37
- package/lib/mjs/providers/address/CustomAddressProvider.d.ts +4 -27
- package/lib/mjs/providers/address/CustomAddressProvider.js +0 -34
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +6 -130
- package/lib/mjs/providers/address/GoogleAddressProvider.js +0 -72
- package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +7 -32
- package/lib/mjs/providers/address/NominatimAddressProvider.js +0 -33
- package/lib/mjs/providers/address/index.d.ts +1 -3
- package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -7
- package/lib/mjs/providers/processor/fileProcessor.js +0 -6
- package/lib/mjs/providers/storage/azure.d.ts +13 -6
- package/lib/mjs/providers/storage/azure.js +0 -5
- package/lib/mjs/providers/storage/base64.d.ts +6 -5
- package/lib/mjs/providers/storage/base64.js +0 -4
- package/lib/mjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/mjs/providers/storage/dropbox.js +0 -5
- package/lib/mjs/providers/storage/googleDrive.d.ts +5 -7
- package/lib/mjs/providers/storage/googleDrive.js +0 -6
- package/lib/mjs/providers/storage/indexeddb.d.ts +7 -5
- package/lib/mjs/providers/storage/indexeddb.js +0 -4
- package/lib/mjs/providers/storage/s3.d.ts +20 -6
- package/lib/mjs/providers/storage/s3.js +0 -5
- package/lib/mjs/providers/storage/url.d.ts +7 -6
- package/lib/mjs/providers/storage/url.js +0 -10
- package/lib/mjs/providers/storage/util.d.ts +1 -24
- package/lib/mjs/providers/storage/util.js +0 -18
- package/lib/mjs/templates/Templates.d.ts +0 -1
- package/lib/mjs/utils/Evaluator.d.ts +3 -6
- package/lib/mjs/utils/Evaluator.js +20 -9
- package/lib/mjs/utils/builder.d.ts +7 -9
- package/lib/mjs/utils/builder.js +5 -10
- package/lib/mjs/utils/calendarUtils.d.ts +13 -7
- package/lib/mjs/utils/calendarUtils.js +17 -10
- package/lib/mjs/utils/formUtils.d.ts +171 -43
- package/lib/mjs/utils/formUtils.js +554 -6
- package/lib/mjs/utils/utils.d.ts +221 -367
- package/lib/mjs/utils/utils.js +222 -329
- package/lib/mjs/widgets/CalendarWidget.d.ts +10 -9
- package/lib/mjs/widgets/CalendarWidget.js +11 -9
- package/package.json +22 -22
- package/embed.d.ts +0 -1
- package/form.d.ts +0 -1
- package/lib/cjs/InlineEmbed.d.ts +0 -7
- package/lib/cjs/InlineEmbed.js +0 -116
- package/lib/mjs/InlineEmbed.d.ts +0 -7
- package/lib/mjs/InlineEmbed.js +0 -112
- package/sdk.d.ts +0 -1
- package/utils.d.ts +0 -1
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 = require("./Evaluator");
|
|
46
|
-
|
|
45
|
+
const Evaluator_1 = __importDefault(require("./Evaluator"));
|
|
46
|
+
exports.Evaluator = Evaluator_1.default;
|
|
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.default.interpolate;
|
|
50
50
|
exports.interpolate = interpolate;
|
|
51
51
|
const { fetch } = (0, fetch_ponyfill_1.default)({
|
|
52
52
|
Promise: Promise
|
|
@@ -67,10 +67,6 @@ 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
|
-
*/
|
|
74
70
|
function setPathToComponentAndPerentSchema(component) {
|
|
75
71
|
component.path = getComponentPath(component);
|
|
76
72
|
const dataParent = getDataParentComponent(component);
|
|
@@ -80,30 +76,79 @@ function setPathToComponentAndPerentSchema(component) {
|
|
|
80
76
|
}
|
|
81
77
|
/**
|
|
82
78
|
* Evaluate a method.
|
|
83
|
-
*
|
|
84
|
-
* @param
|
|
85
|
-
* @param
|
|
86
|
-
* @
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
*
|
|
80
|
+
* @param func
|
|
81
|
+
* @param args
|
|
82
|
+
* @return {*}
|
|
83
|
+
*/
|
|
84
|
+
function evaluate(func, args, ret, tokenize) {
|
|
85
|
+
let returnVal = null;
|
|
86
|
+
const component = args.component ? args.component : { key: 'unknown' };
|
|
87
|
+
if (!args.form && args.instance) {
|
|
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;
|
|
92
140
|
}
|
|
93
141
|
exports.evaluate = evaluate;
|
|
94
|
-
/**
|
|
95
|
-
* Returns a random compoennt ID.
|
|
96
|
-
* @returns {string} - A random component ID.
|
|
97
|
-
*/
|
|
98
142
|
function getRandomComponentId() {
|
|
99
143
|
return `e${Math.random().toString(36).substring(7)}`;
|
|
100
144
|
}
|
|
101
145
|
exports.getRandomComponentId = getRandomComponentId;
|
|
102
146
|
/**
|
|
103
147
|
* Get a property value of an element.
|
|
104
|
-
*
|
|
105
|
-
* @param
|
|
106
|
-
* @
|
|
148
|
+
*
|
|
149
|
+
* @param style
|
|
150
|
+
* @param prop
|
|
151
|
+
* @return {number}
|
|
107
152
|
*/
|
|
108
153
|
function getPropertyValue(style, prop) {
|
|
109
154
|
let value = style.getPropertyValue(prop);
|
|
@@ -113,8 +158,9 @@ function getPropertyValue(style, prop) {
|
|
|
113
158
|
exports.getPropertyValue = getPropertyValue;
|
|
114
159
|
/**
|
|
115
160
|
* Get an elements bounding rectagle.
|
|
116
|
-
*
|
|
117
|
-
* @
|
|
161
|
+
*
|
|
162
|
+
* @param element
|
|
163
|
+
* @return {{x: string, y: string, width: string, height: string}}
|
|
118
164
|
*/
|
|
119
165
|
function getElementRect(element) {
|
|
120
166
|
const style = window.getComputedStyle(element, null);
|
|
@@ -128,8 +174,8 @@ function getElementRect(element) {
|
|
|
128
174
|
exports.getElementRect = getElementRect;
|
|
129
175
|
/**
|
|
130
176
|
* Get non HTMLElement property in the window object
|
|
131
|
-
* @param {
|
|
132
|
-
* @
|
|
177
|
+
* @param {String} property
|
|
178
|
+
* @return {any || undefined}
|
|
133
179
|
*/
|
|
134
180
|
function getScriptPlugin(property) {
|
|
135
181
|
const obj = window[property];
|
|
@@ -142,8 +188,9 @@ function getScriptPlugin(property) {
|
|
|
142
188
|
exports.getScriptPlugin = getScriptPlugin;
|
|
143
189
|
/**
|
|
144
190
|
* Determines the boolean value of a setting.
|
|
145
|
-
*
|
|
146
|
-
* @
|
|
191
|
+
*
|
|
192
|
+
* @param value
|
|
193
|
+
* @return {boolean}
|
|
147
194
|
*/
|
|
148
195
|
function boolValue(value) {
|
|
149
196
|
if (lodash_1.default.isBoolean(value)) {
|
|
@@ -159,18 +206,22 @@ function boolValue(value) {
|
|
|
159
206
|
exports.boolValue = boolValue;
|
|
160
207
|
/**
|
|
161
208
|
* Check to see if an ID is a mongoID.
|
|
162
|
-
* @param
|
|
163
|
-
* @
|
|
209
|
+
* @param text
|
|
210
|
+
* @return {Array|{index: number, input: string}|Boolean|*}
|
|
164
211
|
*/
|
|
165
212
|
function isMongoId(text) {
|
|
166
|
-
return
|
|
213
|
+
return text.toString().match(/^[0-9a-fA-F]{24}$/);
|
|
167
214
|
}
|
|
168
215
|
exports.isMongoId = isMongoId;
|
|
169
216
|
/**
|
|
170
217
|
* Checks the calculated value for a provided component and data.
|
|
171
|
-
*
|
|
172
|
-
* @param {
|
|
173
|
-
*
|
|
218
|
+
*
|
|
219
|
+
* @param {Object} component
|
|
220
|
+
* The component to check for the calculated value.
|
|
221
|
+
* @param {Object} submission
|
|
222
|
+
* A submission object.
|
|
223
|
+
* @param data
|
|
224
|
+
* The full submission data.
|
|
174
225
|
*/
|
|
175
226
|
function checkCalculated(component, submission, rowData) {
|
|
176
227
|
// Process calculated value stuff if present.
|
|
@@ -187,12 +238,13 @@ function checkCalculated(component, submission, rowData) {
|
|
|
187
238
|
exports.checkCalculated = checkCalculated;
|
|
188
239
|
/**
|
|
189
240
|
* Check if a simple conditional evaluates to true.
|
|
190
|
-
*
|
|
191
|
-
* @param
|
|
192
|
-
* @param
|
|
193
|
-
* @param
|
|
194
|
-
* @param
|
|
195
|
-
* @
|
|
241
|
+
*
|
|
242
|
+
* @param condition
|
|
243
|
+
* @param condition
|
|
244
|
+
* @param row
|
|
245
|
+
* @param data
|
|
246
|
+
* @param instance
|
|
247
|
+
* @returns {boolean}
|
|
196
248
|
*/
|
|
197
249
|
function checkSimpleConditional(component, condition, row, data, instance) {
|
|
198
250
|
if (condition.when) {
|
|
@@ -237,13 +289,6 @@ function checkSimpleConditional(component, condition, row, data, instance) {
|
|
|
237
289
|
}
|
|
238
290
|
}
|
|
239
291
|
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
|
-
*/
|
|
247
292
|
function getComponentActualValue(compPath, data, row) {
|
|
248
293
|
let value = null;
|
|
249
294
|
if (row) {
|
|
@@ -261,15 +306,12 @@ function getComponentActualValue(compPath, data, row) {
|
|
|
261
306
|
exports.getComponentActualValue = getComponentActualValue;
|
|
262
307
|
/**
|
|
263
308
|
* Check custom javascript conditional.
|
|
264
|
-
*
|
|
265
|
-
* @param
|
|
266
|
-
* @param
|
|
267
|
-
* @param
|
|
268
|
-
* @param
|
|
269
|
-
* @
|
|
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.
|
|
309
|
+
*
|
|
310
|
+
* @param component
|
|
311
|
+
* @param custom
|
|
312
|
+
* @param row
|
|
313
|
+
* @param data
|
|
314
|
+
* @returns {*}
|
|
273
315
|
*/
|
|
274
316
|
function checkCustomConditional(component, custom, row, data, form, variable, onError, instance) {
|
|
275
317
|
if (typeof custom === 'string') {
|
|
@@ -284,16 +326,6 @@ function checkCustomConditional(component, custom, row, data, form, variable, on
|
|
|
284
326
|
return value;
|
|
285
327
|
}
|
|
286
328
|
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
|
-
*/
|
|
297
329
|
function checkJsonConditional(component, json, row, data, form, onError) {
|
|
298
330
|
try {
|
|
299
331
|
return json_logic_js_1.default.apply(json, {
|
|
@@ -309,14 +341,6 @@ function checkJsonConditional(component, json, row, data, form, onError) {
|
|
|
309
341
|
}
|
|
310
342
|
}
|
|
311
343
|
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
|
-
*/
|
|
320
344
|
function getRow(component, row, instance, conditional) {
|
|
321
345
|
var _a;
|
|
322
346
|
const condition = conditional || component.conditional;
|
|
@@ -339,12 +363,15 @@ function getRow(component, row, instance, conditional) {
|
|
|
339
363
|
}
|
|
340
364
|
/**
|
|
341
365
|
* Checks the conditions for a provided component and data.
|
|
342
|
-
*
|
|
343
|
-
* @param
|
|
344
|
-
*
|
|
345
|
-
* @param
|
|
346
|
-
*
|
|
347
|
-
* @
|
|
366
|
+
*
|
|
367
|
+
* @param component
|
|
368
|
+
* The component to check for the condition.
|
|
369
|
+
* @param row
|
|
370
|
+
* The data within a row
|
|
371
|
+
* @param data
|
|
372
|
+
* The full submission data.
|
|
373
|
+
*
|
|
374
|
+
* @returns {boolean}
|
|
348
375
|
*/
|
|
349
376
|
function checkCondition(component, row, data, form, instance) {
|
|
350
377
|
const { customConditional, conditional } = component;
|
|
@@ -364,13 +391,12 @@ function checkCondition(component, row, data, form, instance) {
|
|
|
364
391
|
exports.checkCondition = checkCondition;
|
|
365
392
|
/**
|
|
366
393
|
* Test a trigger on a component.
|
|
367
|
-
*
|
|
368
|
-
* @param
|
|
369
|
-
* @param
|
|
370
|
-
* @param
|
|
371
|
-
* @param
|
|
372
|
-
* @
|
|
373
|
-
* @returns {boolean} - TRUE if the trigger should fire; FALSE otherwise.
|
|
394
|
+
*
|
|
395
|
+
* @param component
|
|
396
|
+
* @param action
|
|
397
|
+
* @param data
|
|
398
|
+
* @param row
|
|
399
|
+
* @returns {mixed}
|
|
374
400
|
*/
|
|
375
401
|
function checkTrigger(component, trigger, row, data, form, instance) {
|
|
376
402
|
// If trigger is empty, don't fire it
|
|
@@ -390,16 +416,6 @@ function checkTrigger(component, trigger, row, data, form, instance) {
|
|
|
390
416
|
return false;
|
|
391
417
|
}
|
|
392
418
|
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
|
-
*/
|
|
403
419
|
function setActionProperty(component, action, result, row, data, instance) {
|
|
404
420
|
const property = action.property.value;
|
|
405
421
|
switch (action.property.type) {
|
|
@@ -422,7 +438,7 @@ function setActionProperty(component, action, result, row, data, instance) {
|
|
|
422
438
|
const currentValue = lodash_1.default.get(component, property, '');
|
|
423
439
|
const newValue = (instance && instance.interpolate)
|
|
424
440
|
? instance.interpolate(textValue, evalData)
|
|
425
|
-
: Evaluator_1.
|
|
441
|
+
: Evaluator_1.default.interpolate(textValue, evalData);
|
|
426
442
|
if (newValue !== currentValue) {
|
|
427
443
|
lodash_1.default.set(component, property, newValue);
|
|
428
444
|
}
|
|
@@ -434,8 +450,8 @@ function setActionProperty(component, action, result, row, data, instance) {
|
|
|
434
450
|
exports.setActionProperty = setActionProperty;
|
|
435
451
|
/**
|
|
436
452
|
* Removes HTML tags from string e.g. <div>Hello World</div> => Hello World
|
|
437
|
-
* @param {string} str
|
|
438
|
-
* @returns {string}
|
|
453
|
+
* @param {string} str
|
|
454
|
+
* @returns {string}
|
|
439
455
|
*/
|
|
440
456
|
function removeHTML(str) {
|
|
441
457
|
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
@@ -444,8 +460,8 @@ function removeHTML(str) {
|
|
|
444
460
|
exports.removeHTML = removeHTML;
|
|
445
461
|
/**
|
|
446
462
|
* Unescape HTML characters like <, >, & and etc.
|
|
447
|
-
* @param
|
|
448
|
-
* @returns {string}
|
|
463
|
+
* @param str
|
|
464
|
+
* @returns {string}
|
|
449
465
|
*/
|
|
450
466
|
function unescapeHTML(str) {
|
|
451
467
|
if (typeof window === 'undefined' || !('DOMParser' in window)) {
|
|
@@ -458,9 +474,9 @@ function unescapeHTML(str) {
|
|
|
458
474
|
exports.unescapeHTML = unescapeHTML;
|
|
459
475
|
/**
|
|
460
476
|
* Make HTML element from string
|
|
461
|
-
* @param
|
|
462
|
-
* @param
|
|
463
|
-
* @returns {HTMLElement}
|
|
477
|
+
* @param str
|
|
478
|
+
* @param selector
|
|
479
|
+
* @returns {HTMLElement}
|
|
464
480
|
*/
|
|
465
481
|
function convertStringToHTMLElement(str, selector) {
|
|
466
482
|
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
@@ -469,10 +485,10 @@ function convertStringToHTMLElement(str, selector) {
|
|
|
469
485
|
exports.convertStringToHTMLElement = convertStringToHTMLElement;
|
|
470
486
|
/**
|
|
471
487
|
* Make a filename guaranteed to be unique.
|
|
472
|
-
* @param
|
|
473
|
-
* @param
|
|
474
|
-
* @param
|
|
475
|
-
* @returns {string}
|
|
488
|
+
* @param name
|
|
489
|
+
* @param template
|
|
490
|
+
* @param evalContext
|
|
491
|
+
* @returns {string}
|
|
476
492
|
*/
|
|
477
493
|
function uniqueName(name, template, evalContext) {
|
|
478
494
|
template = template || '{{fileName}}-{{guid}}';
|
|
@@ -492,14 +508,10 @@ function uniqueName(name, template, evalContext) {
|
|
|
492
508
|
guid: guid()
|
|
493
509
|
});
|
|
494
510
|
//only letters, numbers, dots, dashes, underscores and spaces are allowed. Anything else will be replaced with dash
|
|
495
|
-
const uniqueName = `${Evaluator_1.
|
|
511
|
+
const uniqueName = `${Evaluator_1.default.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\-_ ]/g, '-');
|
|
496
512
|
return uniqueName;
|
|
497
513
|
}
|
|
498
514
|
exports.uniqueName = uniqueName;
|
|
499
|
-
/**
|
|
500
|
-
* Returns a GUID
|
|
501
|
-
* @returns {string} - A GUID.
|
|
502
|
-
*/
|
|
503
515
|
function guid() {
|
|
504
516
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
505
517
|
const r = Math.random() * 16 | 0;
|
|
@@ -512,8 +524,9 @@ function guid() {
|
|
|
512
524
|
exports.guid = guid;
|
|
513
525
|
/**
|
|
514
526
|
* Return a translated date setting.
|
|
515
|
-
*
|
|
516
|
-
* @
|
|
527
|
+
*
|
|
528
|
+
* @param date
|
|
529
|
+
* @return {(null|Date)}
|
|
517
530
|
*/
|
|
518
531
|
function getDateSetting(date) {
|
|
519
532
|
if (lodash_1.default.isNil(date) || lodash_1.default.isNaN(date) || date === '') {
|
|
@@ -531,7 +544,7 @@ function getDateSetting(date) {
|
|
|
531
544
|
}
|
|
532
545
|
dateSetting = null;
|
|
533
546
|
try {
|
|
534
|
-
const value = Evaluator_1.
|
|
547
|
+
const value = Evaluator_1.default.evaluator(`return ${date};`, 'moment')(moment_timezone_1.default);
|
|
535
548
|
if (typeof value === 'string') {
|
|
536
549
|
dateSetting = (0, moment_timezone_1.default)(value);
|
|
537
550
|
}
|
|
@@ -555,18 +568,14 @@ function getDateSetting(date) {
|
|
|
555
568
|
return dateSetting.toDate();
|
|
556
569
|
}
|
|
557
570
|
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
|
-
*/
|
|
563
571
|
function isValidDate(date) {
|
|
564
572
|
return lodash_1.default.isDate(date) && !lodash_1.default.isNaN(date.getDate());
|
|
565
573
|
}
|
|
566
574
|
exports.isValidDate = isValidDate;
|
|
567
575
|
/**
|
|
568
576
|
* Get the current timezone string.
|
|
569
|
-
*
|
|
577
|
+
*
|
|
578
|
+
* @return {string}
|
|
570
579
|
*/
|
|
571
580
|
function currentTimezone() {
|
|
572
581
|
if (moment_timezone_1.default.currentTimezone) {
|
|
@@ -578,9 +587,10 @@ function currentTimezone() {
|
|
|
578
587
|
exports.currentTimezone = currentTimezone;
|
|
579
588
|
/**
|
|
580
589
|
* Get an offset date provided a date object and timezone object.
|
|
581
|
-
*
|
|
582
|
-
* @param
|
|
583
|
-
* @
|
|
590
|
+
*
|
|
591
|
+
* @param date
|
|
592
|
+
* @param timezone
|
|
593
|
+
* @return {Date}
|
|
584
594
|
*/
|
|
585
595
|
function offsetDate(date, timezone) {
|
|
586
596
|
if (timezone === 'UTC') {
|
|
@@ -598,7 +608,8 @@ function offsetDate(date, timezone) {
|
|
|
598
608
|
exports.offsetDate = offsetDate;
|
|
599
609
|
/**
|
|
600
610
|
* Returns if the zones are loaded.
|
|
601
|
-
*
|
|
611
|
+
*
|
|
612
|
+
* @return {boolean}
|
|
602
613
|
*/
|
|
603
614
|
function zonesLoaded() {
|
|
604
615
|
return moment_timezone_1.default.zonesLoaded;
|
|
@@ -606,8 +617,9 @@ function zonesLoaded() {
|
|
|
606
617
|
exports.zonesLoaded = zonesLoaded;
|
|
607
618
|
/**
|
|
608
619
|
* Returns if we should load the zones.
|
|
609
|
-
*
|
|
610
|
-
* @
|
|
620
|
+
*
|
|
621
|
+
* @param timezone
|
|
622
|
+
* @return {boolean}
|
|
611
623
|
*/
|
|
612
624
|
function shouldLoadZones(timezone) {
|
|
613
625
|
if (timezone === currentTimezone() || timezone === 'UTC') {
|
|
@@ -618,9 +630,8 @@ function shouldLoadZones(timezone) {
|
|
|
618
630
|
exports.shouldLoadZones = shouldLoadZones;
|
|
619
631
|
/**
|
|
620
632
|
* Externally load the timezone data.
|
|
621
|
-
*
|
|
622
|
-
* @
|
|
623
|
-
* @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
|
|
633
|
+
*
|
|
634
|
+
* @return {Promise<any> | *}
|
|
624
635
|
*/
|
|
625
636
|
function loadZones(url, timezone) {
|
|
626
637
|
if (timezone && !shouldLoadZones(timezone)) {
|
|
@@ -645,10 +656,11 @@ function loadZones(url, timezone) {
|
|
|
645
656
|
exports.loadZones = loadZones;
|
|
646
657
|
/**
|
|
647
658
|
* Get the moment date object for translating dates with timezones.
|
|
648
|
-
*
|
|
649
|
-
* @param
|
|
650
|
-
* @param
|
|
651
|
-
* @
|
|
659
|
+
*
|
|
660
|
+
* @param value
|
|
661
|
+
* @param format
|
|
662
|
+
* @param timezone
|
|
663
|
+
* @return {*}
|
|
652
664
|
*/
|
|
653
665
|
function momentDate(value, format, timezone) {
|
|
654
666
|
const momentDate = (0, moment_timezone_1.default)(value);
|
|
@@ -666,12 +678,11 @@ function momentDate(value, format, timezone) {
|
|
|
666
678
|
exports.momentDate = momentDate;
|
|
667
679
|
/**
|
|
668
680
|
* Format a date provided a value, format, and timezone object.
|
|
669
|
-
*
|
|
670
|
-
* @param
|
|
671
|
-
* @param
|
|
672
|
-
* @param
|
|
673
|
-
* @
|
|
674
|
-
* @returns {string} - The formatted date.
|
|
681
|
+
*
|
|
682
|
+
* @param value
|
|
683
|
+
* @param format
|
|
684
|
+
* @param timezone
|
|
685
|
+
* @return {string}
|
|
675
686
|
*/
|
|
676
687
|
function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
|
|
677
688
|
const momentDate = (0, moment_timezone_1.default)(value, flatPickrInputFormat || undefined);
|
|
@@ -705,12 +716,12 @@ function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat)
|
|
|
705
716
|
exports.formatDate = formatDate;
|
|
706
717
|
/**
|
|
707
718
|
* Pass a format function to format within a timezone.
|
|
708
|
-
*
|
|
709
|
-
* @param
|
|
710
|
-
* @param
|
|
711
|
-
* @param
|
|
712
|
-
* @param
|
|
713
|
-
* @
|
|
719
|
+
*
|
|
720
|
+
* @param formatFn
|
|
721
|
+
* @param date
|
|
722
|
+
* @param format
|
|
723
|
+
* @param timezone
|
|
724
|
+
* @return {string}
|
|
714
725
|
*/
|
|
715
726
|
function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
|
716
727
|
if (timezone === currentTimezone()) {
|
|
@@ -730,11 +741,6 @@ function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
|
|
730
741
|
}
|
|
731
742
|
}
|
|
732
743
|
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
|
-
*/
|
|
738
744
|
function getLocaleDateFormatInfo(locale) {
|
|
739
745
|
const formatInfo = {};
|
|
740
746
|
const day = 21;
|
|
@@ -746,8 +752,8 @@ function getLocaleDateFormatInfo(locale) {
|
|
|
746
752
|
exports.getLocaleDateFormatInfo = getLocaleDateFormatInfo;
|
|
747
753
|
/**
|
|
748
754
|
* Convert the format from the angular-datepicker module to flatpickr format.
|
|
749
|
-
* @param
|
|
750
|
-
* @
|
|
755
|
+
* @param format
|
|
756
|
+
* @return {string}
|
|
751
757
|
*/
|
|
752
758
|
function convertFormatToFlatpickr(format) {
|
|
753
759
|
return format
|
|
@@ -778,8 +784,8 @@ function convertFormatToFlatpickr(format) {
|
|
|
778
784
|
exports.convertFormatToFlatpickr = convertFormatToFlatpickr;
|
|
779
785
|
/**
|
|
780
786
|
* Convert the format from the angular-datepicker module to moment format.
|
|
781
|
-
* @param
|
|
782
|
-
* @
|
|
787
|
+
* @param format
|
|
788
|
+
* @return {string}
|
|
783
789
|
*/
|
|
784
790
|
function convertFormatToMoment(format) {
|
|
785
791
|
return format
|
|
@@ -795,11 +801,6 @@ function convertFormatToMoment(format) {
|
|
|
795
801
|
.replace(/U/g, 'X');
|
|
796
802
|
}
|
|
797
803
|
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
|
-
*/
|
|
803
804
|
function convertFormatToMask(format) {
|
|
804
805
|
return format
|
|
805
806
|
// Long month replacement.
|
|
@@ -859,13 +860,6 @@ function getInputMask(mask, placeholderChar) {
|
|
|
859
860
|
return maskArray;
|
|
860
861
|
}
|
|
861
862
|
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
|
-
*/
|
|
869
863
|
function unmaskValue(value, mask, placeholderChar) {
|
|
870
864
|
if (!mask || !value || value.length > mask.length) {
|
|
871
865
|
return value;
|
|
@@ -882,12 +876,6 @@ function unmaskValue(value, mask, placeholderChar) {
|
|
|
882
876
|
return unmaskedValue;
|
|
883
877
|
}
|
|
884
878
|
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
|
-
*/
|
|
891
879
|
function matchInputMask(value, inputMask) {
|
|
892
880
|
if (!inputMask) {
|
|
893
881
|
return true;
|
|
@@ -906,11 +894,6 @@ function matchInputMask(value, inputMask) {
|
|
|
906
894
|
return true;
|
|
907
895
|
}
|
|
908
896
|
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
|
-
*/
|
|
914
897
|
function getNumberSeparators(lang = 'en') {
|
|
915
898
|
const formattedNumberString = (12345.6789).toLocaleString(lang);
|
|
916
899
|
const delimeters = formattedNumberString.match(/..(.)...(.)../);
|
|
@@ -926,12 +909,6 @@ function getNumberSeparators(lang = 'en') {
|
|
|
926
909
|
};
|
|
927
910
|
}
|
|
928
911
|
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
|
-
*/
|
|
935
912
|
function getNumberDecimalLimit(component, defaultLimit) {
|
|
936
913
|
if (lodash_1.default.has(component, 'decimalLimit')) {
|
|
937
914
|
return lodash_1.default.get(component, 'decimalLimit');
|
|
@@ -948,15 +925,6 @@ function getNumberDecimalLimit(component, defaultLimit) {
|
|
|
948
925
|
return decimalLimit;
|
|
949
926
|
}
|
|
950
927
|
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
|
-
*/
|
|
960
928
|
function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
|
|
961
929
|
// Get the prefix and suffix from the localized string.
|
|
962
930
|
let regex = `(.*)?${(100).toLocaleString(lang)}`;
|
|
@@ -979,9 +947,10 @@ function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, })
|
|
|
979
947
|
exports.getCurrencyAffixes = getCurrencyAffixes;
|
|
980
948
|
/**
|
|
981
949
|
* Fetch the field data provided a component.
|
|
982
|
-
*
|
|
983
|
-
* @param
|
|
984
|
-
* @
|
|
950
|
+
*
|
|
951
|
+
* @param data
|
|
952
|
+
* @param component
|
|
953
|
+
* @return {*}
|
|
985
954
|
*/
|
|
986
955
|
function fieldData(data, component) {
|
|
987
956
|
if (!data) {
|
|
@@ -1028,23 +997,16 @@ function fieldData(data, component) {
|
|
|
1028
997
|
exports.fieldData = fieldData;
|
|
1029
998
|
/**
|
|
1030
999
|
* Delays function execution with possibility to execute function synchronously or cancel it.
|
|
1031
|
-
*
|
|
1032
|
-
* @param
|
|
1033
|
-
* @param
|
|
1034
|
-
* @
|
|
1000
|
+
*
|
|
1001
|
+
* @param fn Function to delay
|
|
1002
|
+
* @param delay Delay time
|
|
1003
|
+
* @return {*}
|
|
1035
1004
|
*/
|
|
1036
1005
|
function delay(fn, delay = 0, ...args) {
|
|
1037
1006
|
const timer = setTimeout(fn, delay, ...args);
|
|
1038
|
-
/**
|
|
1039
|
-
*
|
|
1040
|
-
*/
|
|
1041
1007
|
function cancel() {
|
|
1042
1008
|
clearTimeout(timer);
|
|
1043
1009
|
}
|
|
1044
|
-
/**
|
|
1045
|
-
* Execute the function early.
|
|
1046
|
-
* @returns {*} - The result of the function.
|
|
1047
|
-
*/
|
|
1048
1010
|
function earlyCall() {
|
|
1049
1011
|
cancel();
|
|
1050
1012
|
return fn(...args);
|
|
@@ -1056,9 +1018,11 @@ function delay(fn, delay = 0, ...args) {
|
|
|
1056
1018
|
exports.delay = delay;
|
|
1057
1019
|
/**
|
|
1058
1020
|
* Iterate the given key to make it unique.
|
|
1059
|
-
*
|
|
1021
|
+
*
|
|
1022
|
+
* @param {String} key
|
|
1060
1023
|
* Modify the component key to be unique.
|
|
1061
|
-
*
|
|
1024
|
+
*
|
|
1025
|
+
* @returns {String}
|
|
1062
1026
|
* The new component key.
|
|
1063
1027
|
*/
|
|
1064
1028
|
function iterateKey(key) {
|
|
@@ -1072,9 +1036,10 @@ function iterateKey(key) {
|
|
|
1072
1036
|
exports.iterateKey = iterateKey;
|
|
1073
1037
|
/**
|
|
1074
1038
|
* Determines a unique key within a map provided the base key.
|
|
1075
|
-
*
|
|
1076
|
-
* @param
|
|
1077
|
-
* @
|
|
1039
|
+
*
|
|
1040
|
+
* @param map
|
|
1041
|
+
* @param base
|
|
1042
|
+
* @return {*}
|
|
1078
1043
|
*/
|
|
1079
1044
|
function uniqueKey(map, base) {
|
|
1080
1045
|
let newKey = base;
|
|
@@ -1086,9 +1051,8 @@ function uniqueKey(map, base) {
|
|
|
1086
1051
|
exports.uniqueKey = uniqueKey;
|
|
1087
1052
|
/**
|
|
1088
1053
|
* Determines the major version number of bootstrap.
|
|
1089
|
-
*
|
|
1090
|
-
* @
|
|
1091
|
-
* @returns {number} - The bootstrap version.
|
|
1054
|
+
*
|
|
1055
|
+
* @return {number}
|
|
1092
1056
|
*/
|
|
1093
1057
|
function bootstrapVersion(options) {
|
|
1094
1058
|
if (options.bootstrap) {
|
|
@@ -1106,8 +1070,9 @@ exports.bootstrapVersion = bootstrapVersion;
|
|
|
1106
1070
|
/**
|
|
1107
1071
|
* Retrun provided argument.
|
|
1108
1072
|
* If argument is a function, returns the result of a function call.
|
|
1109
|
-
* @param {
|
|
1110
|
-
*
|
|
1073
|
+
* @param {*} e;
|
|
1074
|
+
*
|
|
1075
|
+
* @return {*}
|
|
1111
1076
|
*/
|
|
1112
1077
|
function unfold(e) {
|
|
1113
1078
|
if (typeof e === 'function') {
|
|
@@ -1118,32 +1083,27 @@ function unfold(e) {
|
|
|
1118
1083
|
exports.unfold = unfold;
|
|
1119
1084
|
/**
|
|
1120
1085
|
* Map values through unfold and return first non-nil value.
|
|
1121
|
-
* @param {Array<T>} collection
|
|
1122
|
-
*
|
|
1086
|
+
* @param {Array<T>} collection;
|
|
1087
|
+
*
|
|
1088
|
+
* @return {T}
|
|
1123
1089
|
*/
|
|
1124
1090
|
exports.firstNonNil = lodash_1.default.flow([
|
|
1125
1091
|
lodash_1.default.partialRight(lodash_1.default.map, unfold),
|
|
1126
1092
|
lodash_1.default.partialRight(lodash_1.default.find, v => !lodash_1.default.isUndefined(v))
|
|
1127
1093
|
]);
|
|
1128
|
-
|
|
1129
|
-
* Create enclosed state.
|
|
1094
|
+
/*
|
|
1095
|
+
* Create enclosed state.
|
|
1096
|
+
* Returns functions to getting and cycling between states.
|
|
1130
1097
|
* @param {*} a - initial state.
|
|
1131
1098
|
* @param {*} b - next state.
|
|
1132
|
-
* @
|
|
1099
|
+
* @return {Functions[]} -- [get, toggle];
|
|
1133
1100
|
*/
|
|
1134
1101
|
function withSwitch(a, b) {
|
|
1135
1102
|
let state = a;
|
|
1136
1103
|
let next = b;
|
|
1137
|
-
/**
|
|
1138
|
-
* Returns the state of the switch.
|
|
1139
|
-
* @returns {*} - The current state.
|
|
1140
|
-
*/
|
|
1141
1104
|
function get() {
|
|
1142
1105
|
return state;
|
|
1143
1106
|
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Toggles the state of the switch.
|
|
1146
|
-
*/
|
|
1147
1107
|
function toggle() {
|
|
1148
1108
|
const prev = state;
|
|
1149
1109
|
state = next;
|
|
@@ -1152,14 +1112,6 @@ function withSwitch(a, b) {
|
|
|
1152
1112
|
return [get, toggle];
|
|
1153
1113
|
}
|
|
1154
1114
|
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
|
-
*/
|
|
1163
1115
|
function observeOverload(callback, options = {}) {
|
|
1164
1116
|
const { limit = 50, delay = 500 } = options;
|
|
1165
1117
|
let callCount = 0;
|
|
@@ -1180,13 +1132,6 @@ function observeOverload(callback, options = {}) {
|
|
|
1180
1132
|
};
|
|
1181
1133
|
}
|
|
1182
1134
|
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
|
-
*/
|
|
1190
1135
|
function getContextComponents(context, excludeNested, excludedTypes = []) {
|
|
1191
1136
|
const values = [];
|
|
1192
1137
|
context.utils.eachComponent(context.instance.options.editForm.components, (component, path) => {
|
|
@@ -1201,11 +1146,6 @@ function getContextComponents(context, excludeNested, excludedTypes = []) {
|
|
|
1201
1146
|
return values;
|
|
1202
1147
|
}
|
|
1203
1148
|
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
|
-
*/
|
|
1209
1149
|
function getContextButtons(context) {
|
|
1210
1150
|
const values = [];
|
|
1211
1151
|
context.utils.eachComponent(context.instance.options.editForm.components, (component) => {
|
|
@@ -1223,15 +1163,18 @@ exports.getContextButtons = getContextButtons;
|
|
|
1223
1163
|
const inTextTags = ['#text', 'A', 'B', 'EM', 'I', 'SMALL', 'STRONG', 'SUB', 'SUP', 'INS', 'DEL', 'MARK', 'CODE'];
|
|
1224
1164
|
/**
|
|
1225
1165
|
* Helper function for 'translateHTMLTemplate'. Translates text value of the passed html element.
|
|
1226
|
-
*
|
|
1227
|
-
* @param {
|
|
1228
|
-
* @
|
|
1166
|
+
*
|
|
1167
|
+
* @param {HTMLElement} elem
|
|
1168
|
+
* @param {Function} translate
|
|
1169
|
+
*
|
|
1170
|
+
* @returns {String}
|
|
1171
|
+
* Translated element template.
|
|
1229
1172
|
*/
|
|
1230
1173
|
function translateElemValue(elem, translate) {
|
|
1231
1174
|
if (!elem.innerText) {
|
|
1232
1175
|
return elem.innerHTML;
|
|
1233
1176
|
}
|
|
1234
|
-
const elemValue = elem.innerText.replace(Evaluator_1.
|
|
1177
|
+
const elemValue = elem.innerText.replace(Evaluator_1.default.templateSettings.interpolate, '').replace(/\s\s+/g, ' ').trim();
|
|
1235
1178
|
const translatedValue = translate(elemValue);
|
|
1236
1179
|
if (elemValue !== translatedValue) {
|
|
1237
1180
|
const links = elem.innerHTML.match(/<a[^>]*>(.*?)<\/a>/g);
|
|
@@ -1256,8 +1199,10 @@ function translateElemValue(elem, translate) {
|
|
|
1256
1199
|
}
|
|
1257
1200
|
/**
|
|
1258
1201
|
* Helper function for 'translateHTMLTemplate'. Goes deep through html tag children and calls function to translate their text values.
|
|
1259
|
-
*
|
|
1260
|
-
* @param {
|
|
1202
|
+
*
|
|
1203
|
+
* @param {HTMLElement} tag
|
|
1204
|
+
* @param {Function} translate
|
|
1205
|
+
*
|
|
1261
1206
|
* @returns {void}
|
|
1262
1207
|
*/
|
|
1263
1208
|
function translateDeepTag(tag, translate) {
|
|
@@ -1273,9 +1218,12 @@ function translateDeepTag(tag, translate) {
|
|
|
1273
1218
|
}
|
|
1274
1219
|
/**
|
|
1275
1220
|
* Translates text values in html template.
|
|
1276
|
-
*
|
|
1277
|
-
* @param {
|
|
1278
|
-
* @
|
|
1221
|
+
*
|
|
1222
|
+
* @param {String} template
|
|
1223
|
+
* @param {Function} translate
|
|
1224
|
+
*
|
|
1225
|
+
* @returns {String}
|
|
1226
|
+
* Html template with translated values.
|
|
1279
1227
|
*/
|
|
1280
1228
|
function translateHTMLTemplate(template, translate) {
|
|
1281
1229
|
const isHTML = /<[^>]*>/.test(template);
|
|
@@ -1293,9 +1241,9 @@ function translateHTMLTemplate(template, translate) {
|
|
|
1293
1241
|
exports.translateHTMLTemplate = translateHTMLTemplate;
|
|
1294
1242
|
/**
|
|
1295
1243
|
* Sanitize an html string.
|
|
1296
|
-
*
|
|
1297
|
-
* @param
|
|
1298
|
-
* @returns {
|
|
1244
|
+
*
|
|
1245
|
+
* @param string
|
|
1246
|
+
* @returns {*}
|
|
1299
1247
|
*/
|
|
1300
1248
|
function sanitize(string, options) {
|
|
1301
1249
|
if (typeof dompurify_1.default.sanitize !== 'function') {
|
|
@@ -1344,18 +1292,11 @@ function sanitize(string, options) {
|
|
|
1344
1292
|
exports.sanitize = sanitize;
|
|
1345
1293
|
/**
|
|
1346
1294
|
* 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.
|
|
1349
1295
|
*/
|
|
1350
1296
|
function fastCloneDeep(obj) {
|
|
1351
1297
|
return obj ? JSON.parse(JSON.stringify(obj)) : obj;
|
|
1352
1298
|
}
|
|
1353
1299
|
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
|
-
*/
|
|
1359
1300
|
function isInputComponent(componentJson) {
|
|
1360
1301
|
if (componentJson.input === false || componentJson.input === true) {
|
|
1361
1302
|
return componentJson.input;
|
|
@@ -1376,11 +1317,6 @@ function isInputComponent(componentJson) {
|
|
|
1376
1317
|
}
|
|
1377
1318
|
}
|
|
1378
1319
|
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
|
-
*/
|
|
1384
1320
|
function getArrayFromComponentPath(pathStr) {
|
|
1385
1321
|
if (!pathStr || !lodash_1.default.isString(pathStr)) {
|
|
1386
1322
|
if (!lodash_1.default.isArray(pathStr)) {
|
|
@@ -1395,12 +1331,6 @@ function getArrayFromComponentPath(pathStr) {
|
|
|
1395
1331
|
.map(part => lodash_1.default.defaultTo(lodash_1.default.toNumber(part), part));
|
|
1396
1332
|
}
|
|
1397
1333
|
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
|
-
*/
|
|
1404
1334
|
function isChildOf(child, parent) {
|
|
1405
1335
|
while (child && child.parent) {
|
|
1406
1336
|
if (child.parent === parent) {
|
|
@@ -1411,11 +1341,6 @@ function isChildOf(child, parent) {
|
|
|
1411
1341
|
return false;
|
|
1412
1342
|
}
|
|
1413
1343
|
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
|
-
*/
|
|
1419
1344
|
function getStringFromComponentPath(path) {
|
|
1420
1345
|
if (!lodash_1.default.isArray(path)) {
|
|
1421
1346
|
return path;
|
|
@@ -1432,22 +1357,17 @@ function getStringFromComponentPath(path) {
|
|
|
1432
1357
|
return strPath;
|
|
1433
1358
|
}
|
|
1434
1359
|
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
|
-
*/
|
|
1441
1360
|
function round(number, precision) {
|
|
1442
1361
|
if (lodash_1.default.isNumber(number)) {
|
|
1443
1362
|
return number.toFixed(precision);
|
|
1444
1363
|
}
|
|
1445
|
-
return number
|
|
1364
|
+
return number;
|
|
1446
1365
|
}
|
|
1447
1366
|
exports.round = round;
|
|
1448
1367
|
/**
|
|
1449
1368
|
* Check for Internet Explorer browser version
|
|
1450
|
-
*
|
|
1369
|
+
*
|
|
1370
|
+
* @return {(number|null)}
|
|
1451
1371
|
*/
|
|
1452
1372
|
function getIEBrowserVersion() {
|
|
1453
1373
|
const { ie, version } = getBrowserInfo();
|
|
@@ -1456,7 +1376,8 @@ function getIEBrowserVersion() {
|
|
|
1456
1376
|
exports.getIEBrowserVersion = getIEBrowserVersion;
|
|
1457
1377
|
/**
|
|
1458
1378
|
* Get browser name and version (modified from 'jquery-browser-plugin')
|
|
1459
|
-
*
|
|
1379
|
+
*
|
|
1380
|
+
* @return {Object} -- {{browser name, version, isWebkit?}}
|
|
1460
1381
|
* Possible browser names: chrome, safari, ie, edge, opera, mozilla, yabrowser
|
|
1461
1382
|
*/
|
|
1462
1383
|
function getBrowserInfo() {
|
|
@@ -1505,20 +1426,13 @@ function getBrowserInfo() {
|
|
|
1505
1426
|
return browser;
|
|
1506
1427
|
}
|
|
1507
1428
|
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
|
-
*/
|
|
1513
1429
|
function getComponentPathWithoutIndicies(path = '') {
|
|
1514
1430
|
return path.replace(/\[\d+\]/, '');
|
|
1515
1431
|
}
|
|
1516
1432
|
exports.getComponentPathWithoutIndicies = getComponentPathWithoutIndicies;
|
|
1517
1433
|
/**
|
|
1518
1434
|
* Returns a path to the component which based on its schema
|
|
1519
|
-
* @param {
|
|
1520
|
-
* @param {string} path - Path to the component
|
|
1521
|
-
* @returns {string} - Path to the component
|
|
1435
|
+
* @param {*} component is a component's schema containing link to its parent's schema in the 'parent' property
|
|
1522
1436
|
*/
|
|
1523
1437
|
function getComponentPath(component, path = '') {
|
|
1524
1438
|
var _a;
|
|
@@ -1531,8 +1445,8 @@ function getComponentPath(component, path = '') {
|
|
|
1531
1445
|
exports.getComponentPath = getComponentPath;
|
|
1532
1446
|
/**
|
|
1533
1447
|
* Returns a parent component of the passed component instance skipping all the Layout components
|
|
1534
|
-
* @param {
|
|
1535
|
-
* @
|
|
1448
|
+
* @param {*} componentInstance
|
|
1449
|
+
* @return {(Component|undefined)}
|
|
1536
1450
|
*/
|
|
1537
1451
|
function getDataParentComponent(componentInstance) {
|
|
1538
1452
|
if (!componentInstance) {
|
|
@@ -1549,8 +1463,8 @@ function getDataParentComponent(componentInstance) {
|
|
|
1549
1463
|
exports.getDataParentComponent = getDataParentComponent;
|
|
1550
1464
|
/**
|
|
1551
1465
|
* Returns whether the value is a promise
|
|
1552
|
-
* @param
|
|
1553
|
-
* @
|
|
1466
|
+
* @param value
|
|
1467
|
+
* @return {boolean}
|
|
1554
1468
|
*/
|
|
1555
1469
|
function isPromise(value) {
|
|
1556
1470
|
return value
|
|
@@ -1562,9 +1476,9 @@ exports.isPromise = isPromise;
|
|
|
1562
1476
|
/**
|
|
1563
1477
|
* Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
|
|
1564
1478
|
* changes by itself, e.g. EditGrid)
|
|
1565
|
-
* @param
|
|
1566
|
-
* @param
|
|
1567
|
-
* @returns {boolean|*}
|
|
1479
|
+
* @param componentInstance
|
|
1480
|
+
* @param firstPass
|
|
1481
|
+
* @returns {boolean|boolean|*}
|
|
1568
1482
|
*/
|
|
1569
1483
|
function isInsideScopingComponent(componentInstance, firstPass = true) {
|
|
1570
1484
|
if (!firstPass && (componentInstance === null || componentInstance === void 0 ? void 0 : componentInstance.hasScopedChildren)) {
|
|
@@ -1580,11 +1494,6 @@ function isInsideScopingComponent(componentInstance, firstPass = true) {
|
|
|
1580
1494
|
return false;
|
|
1581
1495
|
}
|
|
1582
1496
|
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
|
-
*/
|
|
1588
1497
|
function getFocusableElements(element) {
|
|
1589
1498
|
const focusableSelector = `button:not([disabled]), input:not([disabled]), select:not([disabled]),
|
|
1590
1499
|
textarea:not([disabled]), button:not([disabled]), [href]`;
|
|
@@ -1600,11 +1509,6 @@ exports.componentValueTypes = {
|
|
|
1600
1509
|
date: 'date',
|
|
1601
1510
|
any: 'any',
|
|
1602
1511
|
};
|
|
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
|
-
*/
|
|
1608
1512
|
function getComponentSavedTypes(fullSchema) {
|
|
1609
1513
|
const schema = fullSchema || {};
|
|
1610
1514
|
if (schema.persistent !== true) {
|
|
@@ -1618,10 +1522,9 @@ function getComponentSavedTypes(fullSchema) {
|
|
|
1618
1522
|
exports.getComponentSavedTypes = getComponentSavedTypes;
|
|
1619
1523
|
/**
|
|
1620
1524
|
* Interpolates @formio/core errors so that they are compatible with the renderer
|
|
1621
|
-
* @param {
|
|
1622
|
-
* @param
|
|
1623
|
-
* @
|
|
1624
|
-
* @returns {[]} - The interpolated errors
|
|
1525
|
+
* @param {FieldError[]} errors
|
|
1526
|
+
* @param firstPass
|
|
1527
|
+
* @returns {[]}
|
|
1625
1528
|
*/
|
|
1626
1529
|
const interpolateErrors = (component, errors, interpolateFn) => {
|
|
1627
1530
|
return errors.map((error) => {
|
|
@@ -1632,11 +1535,6 @@ const interpolateErrors = (component, errors, interpolateFn) => {
|
|
|
1632
1535
|
});
|
|
1633
1536
|
};
|
|
1634
1537
|
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
|
-
*/
|
|
1640
1538
|
function getItemTemplateKeys(template) {
|
|
1641
1539
|
const templateKeys = [];
|
|
1642
1540
|
if (!template) {
|
|
@@ -1654,11 +1552,6 @@ function getItemTemplateKeys(template) {
|
|
|
1654
1552
|
return templateKeys;
|
|
1655
1553
|
}
|
|
1656
1554
|
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
|
-
*/
|
|
1662
1555
|
function isSelectResourceWithObjectValue(comp = {}) {
|
|
1663
1556
|
const { reference, dataSrc, valueProperty } = comp;
|
|
1664
1557
|
return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));
|