@formio/js 5.0.0-dev.5610.da13e39 → 5.0.0-dev.5613.3476921
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/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 +1199 -651
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +11 -3
- package/dist/formio.full.js +919 -691
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +11 -3
- package/dist/formio.js +16 -16
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +493 -1861
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -12
- package/lib/cjs/Element.d.ts +96 -86
- package/lib/cjs/Element.js +78 -68
- 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 +298 -313
- package/lib/cjs/WebformBuilder.d.ts +14 -16
- package/lib/cjs/WebformBuilder.js +11 -17
- package/lib/cjs/Wizard.d.ts +21 -31
- package/lib/cjs/Wizard.js +19 -42
- 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 +189 -433
- 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/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 -5
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +0 -4
- 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 +16 -13
- 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/translations/en.d.ts +1 -0
- package/lib/cjs/translations/en.js +1 -0
- 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 +216 -362
- package/lib/cjs/utils/utils.js +224 -331
- package/lib/cjs/widgets/CalendarWidget.d.ts +10 -9
- package/lib/cjs/widgets/CalendarWidget.js +11 -9
- package/lib/mjs/Element.d.ts +96 -86
- package/lib/mjs/Element.js +78 -68
- 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 +310 -325
- package/lib/mjs/WebformBuilder.d.ts +14 -16
- package/lib/mjs/WebformBuilder.js +11 -16
- package/lib/mjs/Wizard.d.ts +21 -31
- package/lib/mjs/Wizard.js +18 -41
- 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 +189 -433
- 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/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 -5
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +0 -4
- 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 +16 -13
- 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 +16 -13
- 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/translations/en.d.ts +1 -0
- package/lib/mjs/translations/en.js +1 -0
- 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 +216 -362
- package/lib/mjs/utils/utils.js +218 -325
- 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 -109
- package/lib/mjs/InlineEmbed.d.ts +0 -7
- package/lib/mjs/InlineEmbed.js +0 -105
- 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,9 @@ function getElementRect(element) {
|
|
|
128
174
|
exports.getElementRect = getElementRect;
|
|
129
175
|
/**
|
|
130
176
|
* Determines the boolean value of a setting.
|
|
131
|
-
*
|
|
132
|
-
* @
|
|
177
|
+
*
|
|
178
|
+
* @param value
|
|
179
|
+
* @return {boolean}
|
|
133
180
|
*/
|
|
134
181
|
function boolValue(value) {
|
|
135
182
|
if (lodash_1.default.isBoolean(value)) {
|
|
@@ -145,18 +192,22 @@ function boolValue(value) {
|
|
|
145
192
|
exports.boolValue = boolValue;
|
|
146
193
|
/**
|
|
147
194
|
* Check to see if an ID is a mongoID.
|
|
148
|
-
* @param
|
|
149
|
-
* @
|
|
195
|
+
* @param text
|
|
196
|
+
* @return {Array|{index: number, input: string}|Boolean|*}
|
|
150
197
|
*/
|
|
151
198
|
function isMongoId(text) {
|
|
152
|
-
return
|
|
199
|
+
return text.toString().match(/^[0-9a-fA-F]{24}$/);
|
|
153
200
|
}
|
|
154
201
|
exports.isMongoId = isMongoId;
|
|
155
202
|
/**
|
|
156
203
|
* Checks the calculated value for a provided component and data.
|
|
157
|
-
*
|
|
158
|
-
* @param {
|
|
159
|
-
*
|
|
204
|
+
*
|
|
205
|
+
* @param {Object} component
|
|
206
|
+
* The component to check for the calculated value.
|
|
207
|
+
* @param {Object} submission
|
|
208
|
+
* A submission object.
|
|
209
|
+
* @param data
|
|
210
|
+
* The full submission data.
|
|
160
211
|
*/
|
|
161
212
|
function checkCalculated(component, submission, rowData) {
|
|
162
213
|
// Process calculated value stuff if present.
|
|
@@ -173,12 +224,13 @@ function checkCalculated(component, submission, rowData) {
|
|
|
173
224
|
exports.checkCalculated = checkCalculated;
|
|
174
225
|
/**
|
|
175
226
|
* Check if a simple conditional evaluates to true.
|
|
176
|
-
*
|
|
177
|
-
* @param
|
|
178
|
-
* @param
|
|
179
|
-
* @param
|
|
180
|
-
* @param
|
|
181
|
-
* @
|
|
227
|
+
*
|
|
228
|
+
* @param condition
|
|
229
|
+
* @param condition
|
|
230
|
+
* @param row
|
|
231
|
+
* @param data
|
|
232
|
+
* @param instance
|
|
233
|
+
* @returns {boolean}
|
|
182
234
|
*/
|
|
183
235
|
function checkSimpleConditional(component, condition, row, data, instance) {
|
|
184
236
|
if (condition.when) {
|
|
@@ -223,13 +275,6 @@ function checkSimpleConditional(component, condition, row, data, instance) {
|
|
|
223
275
|
}
|
|
224
276
|
}
|
|
225
277
|
exports.checkSimpleConditional = checkSimpleConditional;
|
|
226
|
-
/**
|
|
227
|
-
* Returns a components normalized value.
|
|
228
|
-
* @param {string} compPath - The full path to the component.
|
|
229
|
-
* @param {*} data - The data object to get the value from.
|
|
230
|
-
* @param {*} row - The contextual row data for the component.
|
|
231
|
-
* @returns {*} - The normalized value of the component.
|
|
232
|
-
*/
|
|
233
278
|
function getComponentActualValue(compPath, data, row) {
|
|
234
279
|
let value = null;
|
|
235
280
|
if (row) {
|
|
@@ -247,15 +292,12 @@ function getComponentActualValue(compPath, data, row) {
|
|
|
247
292
|
exports.getComponentActualValue = getComponentActualValue;
|
|
248
293
|
/**
|
|
249
294
|
* Check custom javascript conditional.
|
|
250
|
-
*
|
|
251
|
-
* @param
|
|
252
|
-
* @param
|
|
253
|
-
* @param
|
|
254
|
-
* @param
|
|
255
|
-
* @
|
|
256
|
-
* @param {*} onError - A custom return if there is an error or the value is null from the evaluation.
|
|
257
|
-
* @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
|
|
258
|
-
* @returns {*} - The result of the evaulation.
|
|
295
|
+
*
|
|
296
|
+
* @param component
|
|
297
|
+
* @param custom
|
|
298
|
+
* @param row
|
|
299
|
+
* @param data
|
|
300
|
+
* @returns {*}
|
|
259
301
|
*/
|
|
260
302
|
function checkCustomConditional(component, custom, row, data, form, variable, onError, instance) {
|
|
261
303
|
if (typeof custom === 'string') {
|
|
@@ -270,16 +312,6 @@ function checkCustomConditional(component, custom, row, data, form, variable, on
|
|
|
270
312
|
return value;
|
|
271
313
|
}
|
|
272
314
|
exports.checkCustomConditional = checkCustomConditional;
|
|
273
|
-
/**
|
|
274
|
-
* Check a component for JSON conditionals.
|
|
275
|
-
* @param {import('@formio/core').Component} component - The component
|
|
276
|
-
* @param {import('@formio/core').JSONConditional} json - The json conditional to check.
|
|
277
|
-
* @param {*} row - The contextual row data for the component.
|
|
278
|
-
* @param {*} data - The full submission data.
|
|
279
|
-
* @param {import('@formio/core').Form} form - The Form JSON of the form.
|
|
280
|
-
* @param {*} onError - Custom return value if there is an error.
|
|
281
|
-
* @returns {boolean} - TRUE if the condition is true; FALSE otherwise.
|
|
282
|
-
*/
|
|
283
315
|
function checkJsonConditional(component, json, row, data, form, onError) {
|
|
284
316
|
try {
|
|
285
317
|
return json_logic_js_1.default.apply(json, {
|
|
@@ -295,14 +327,6 @@ function checkJsonConditional(component, json, row, data, form, onError) {
|
|
|
295
327
|
}
|
|
296
328
|
}
|
|
297
329
|
exports.checkJsonConditional = checkJsonConditional;
|
|
298
|
-
/**
|
|
299
|
-
* Returns the contextual row data for a component.
|
|
300
|
-
* @param {import('@formio/core').Component} component - The component to get the row data for.
|
|
301
|
-
* @param {*} row - The row data for the component.
|
|
302
|
-
* @param {import('../../src/components/_classes/component/Component').Component} instance - The component instance.
|
|
303
|
-
* @param {*} conditional - The component conditional.
|
|
304
|
-
* @returns {*} - The contextual row data for the component.
|
|
305
|
-
*/
|
|
306
330
|
function getRow(component, row, instance, conditional) {
|
|
307
331
|
var _a;
|
|
308
332
|
const condition = conditional || component.conditional;
|
|
@@ -325,12 +349,15 @@ function getRow(component, row, instance, conditional) {
|
|
|
325
349
|
}
|
|
326
350
|
/**
|
|
327
351
|
* Checks the conditions for a provided component and data.
|
|
328
|
-
*
|
|
329
|
-
* @param
|
|
330
|
-
*
|
|
331
|
-
* @param
|
|
332
|
-
*
|
|
333
|
-
* @
|
|
352
|
+
*
|
|
353
|
+
* @param component
|
|
354
|
+
* The component to check for the condition.
|
|
355
|
+
* @param row
|
|
356
|
+
* The data within a row
|
|
357
|
+
* @param data
|
|
358
|
+
* The full submission data.
|
|
359
|
+
*
|
|
360
|
+
* @returns {boolean}
|
|
334
361
|
*/
|
|
335
362
|
function checkCondition(component, row, data, form, instance) {
|
|
336
363
|
const { customConditional, conditional } = component;
|
|
@@ -350,13 +377,12 @@ function checkCondition(component, row, data, form, instance) {
|
|
|
350
377
|
exports.checkCondition = checkCondition;
|
|
351
378
|
/**
|
|
352
379
|
* Test a trigger on a component.
|
|
353
|
-
*
|
|
354
|
-
* @param
|
|
355
|
-
* @param
|
|
356
|
-
* @param
|
|
357
|
-
* @param
|
|
358
|
-
* @
|
|
359
|
-
* @returns {boolean} - TRUE if the trigger should fire; FALSE otherwise.
|
|
380
|
+
*
|
|
381
|
+
* @param component
|
|
382
|
+
* @param action
|
|
383
|
+
* @param data
|
|
384
|
+
* @param row
|
|
385
|
+
* @returns {mixed}
|
|
360
386
|
*/
|
|
361
387
|
function checkTrigger(component, trigger, row, data, form, instance) {
|
|
362
388
|
// If trigger is empty, don't fire it
|
|
@@ -376,16 +402,6 @@ function checkTrigger(component, trigger, row, data, form, instance) {
|
|
|
376
402
|
return false;
|
|
377
403
|
}
|
|
378
404
|
exports.checkTrigger = checkTrigger;
|
|
379
|
-
/**
|
|
380
|
-
* Sets a property on a component via an executed Logic action.
|
|
381
|
-
* @param {import('@formio/core').Component} component - The component to set the property on.
|
|
382
|
-
* @param {import('@formio/core').LogicAction} action - The action to perform on the component.
|
|
383
|
-
* @param {string} result - The name of the variable in the evaulation to use as the result.
|
|
384
|
-
* @param {import('@formio/core').DataObject} row - The contextual row data.
|
|
385
|
-
* @param {import('@formio/core').DataObject} data - The full submission data.
|
|
386
|
-
* @param {any} instance - The component instance.
|
|
387
|
-
* @returns {import('@formio/core').Component} - The modified component.
|
|
388
|
-
*/
|
|
389
405
|
function setActionProperty(component, action, result, row, data, instance) {
|
|
390
406
|
const property = action.property.value;
|
|
391
407
|
switch (action.property.type) {
|
|
@@ -408,7 +424,7 @@ function setActionProperty(component, action, result, row, data, instance) {
|
|
|
408
424
|
const currentValue = lodash_1.default.get(component, property, '');
|
|
409
425
|
const newValue = (instance && instance.interpolate)
|
|
410
426
|
? instance.interpolate(textValue, evalData)
|
|
411
|
-
: Evaluator_1.
|
|
427
|
+
: Evaluator_1.default.interpolate(textValue, evalData);
|
|
412
428
|
if (newValue !== currentValue) {
|
|
413
429
|
lodash_1.default.set(component, property, newValue);
|
|
414
430
|
}
|
|
@@ -420,8 +436,8 @@ function setActionProperty(component, action, result, row, data, instance) {
|
|
|
420
436
|
exports.setActionProperty = setActionProperty;
|
|
421
437
|
/**
|
|
422
438
|
* Unescape HTML characters like <, >, & and etc.
|
|
423
|
-
* @param
|
|
424
|
-
* @returns {string}
|
|
439
|
+
* @param str
|
|
440
|
+
* @returns {string}
|
|
425
441
|
*/
|
|
426
442
|
function unescapeHTML(str) {
|
|
427
443
|
if (typeof window === 'undefined' || !('DOMParser' in window)) {
|
|
@@ -433,9 +449,9 @@ function unescapeHTML(str) {
|
|
|
433
449
|
exports.unescapeHTML = unescapeHTML;
|
|
434
450
|
/**
|
|
435
451
|
* Make HTML element from string
|
|
436
|
-
* @param
|
|
437
|
-
* @param
|
|
438
|
-
* @returns {HTMLElement}
|
|
452
|
+
* @param str
|
|
453
|
+
* @param selector
|
|
454
|
+
* @returns {HTMLElement}
|
|
439
455
|
*/
|
|
440
456
|
function convertStringToHTMLElement(str, selector) {
|
|
441
457
|
const doc = new window.DOMParser().parseFromString(str, 'text/html');
|
|
@@ -444,10 +460,10 @@ function convertStringToHTMLElement(str, selector) {
|
|
|
444
460
|
exports.convertStringToHTMLElement = convertStringToHTMLElement;
|
|
445
461
|
/**
|
|
446
462
|
* Make a filename guaranteed to be unique.
|
|
447
|
-
* @param
|
|
448
|
-
* @param
|
|
449
|
-
* @param
|
|
450
|
-
* @returns {string}
|
|
463
|
+
* @param name
|
|
464
|
+
* @param template
|
|
465
|
+
* @param evalContext
|
|
466
|
+
* @returns {string}
|
|
451
467
|
*/
|
|
452
468
|
function uniqueName(name, template, evalContext) {
|
|
453
469
|
template = template || '{{fileName}}-{{guid}}';
|
|
@@ -467,14 +483,10 @@ function uniqueName(name, template, evalContext) {
|
|
|
467
483
|
guid: guid()
|
|
468
484
|
});
|
|
469
485
|
//only letters, numbers, dots, dashes, underscores and spaces are allowed. Anything else will be replaced with dash
|
|
470
|
-
const uniqueName = `${Evaluator_1.
|
|
486
|
+
const uniqueName = `${Evaluator_1.default.interpolate(template, evalContext)}${extension}`.replace(/[^0-9a-zA-Z.\-_ ]/g, '-');
|
|
471
487
|
return uniqueName;
|
|
472
488
|
}
|
|
473
489
|
exports.uniqueName = uniqueName;
|
|
474
|
-
/**
|
|
475
|
-
* Returns a GUID
|
|
476
|
-
* @returns {string} - A GUID.
|
|
477
|
-
*/
|
|
478
490
|
function guid() {
|
|
479
491
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
|
|
480
492
|
const r = Math.random() * 16 | 0;
|
|
@@ -487,8 +499,9 @@ function guid() {
|
|
|
487
499
|
exports.guid = guid;
|
|
488
500
|
/**
|
|
489
501
|
* Return a translated date setting.
|
|
490
|
-
*
|
|
491
|
-
* @
|
|
502
|
+
*
|
|
503
|
+
* @param date
|
|
504
|
+
* @return {(null|Date)}
|
|
492
505
|
*/
|
|
493
506
|
function getDateSetting(date) {
|
|
494
507
|
if (lodash_1.default.isNil(date) || lodash_1.default.isNaN(date) || date === '') {
|
|
@@ -506,7 +519,7 @@ function getDateSetting(date) {
|
|
|
506
519
|
}
|
|
507
520
|
dateSetting = null;
|
|
508
521
|
try {
|
|
509
|
-
const value = Evaluator_1.
|
|
522
|
+
const value = Evaluator_1.default.evaluator(`return ${date};`, 'moment')(moment_timezone_1.default);
|
|
510
523
|
if (typeof value === 'string') {
|
|
511
524
|
dateSetting = (0, moment_timezone_1.default)(value);
|
|
512
525
|
}
|
|
@@ -530,18 +543,14 @@ function getDateSetting(date) {
|
|
|
530
543
|
return dateSetting.toDate();
|
|
531
544
|
}
|
|
532
545
|
exports.getDateSetting = getDateSetting;
|
|
533
|
-
/**
|
|
534
|
-
* Returns true if the date is a valid date. False otherwise.
|
|
535
|
-
* @param {Date|string} date - The date to check for validity.
|
|
536
|
-
* @returns {boolean} - TRUE if the date is valid; FALSE otherwise.
|
|
537
|
-
*/
|
|
538
546
|
function isValidDate(date) {
|
|
539
547
|
return lodash_1.default.isDate(date) && !lodash_1.default.isNaN(date.getDate());
|
|
540
548
|
}
|
|
541
549
|
exports.isValidDate = isValidDate;
|
|
542
550
|
/**
|
|
543
551
|
* Get the current timezone string.
|
|
544
|
-
*
|
|
552
|
+
*
|
|
553
|
+
* @return {string}
|
|
545
554
|
*/
|
|
546
555
|
function currentTimezone() {
|
|
547
556
|
if (moment_timezone_1.default.currentTimezone) {
|
|
@@ -553,9 +562,10 @@ function currentTimezone() {
|
|
|
553
562
|
exports.currentTimezone = currentTimezone;
|
|
554
563
|
/**
|
|
555
564
|
* Get an offset date provided a date object and timezone object.
|
|
556
|
-
*
|
|
557
|
-
* @param
|
|
558
|
-
* @
|
|
565
|
+
*
|
|
566
|
+
* @param date
|
|
567
|
+
* @param timezone
|
|
568
|
+
* @return {Date}
|
|
559
569
|
*/
|
|
560
570
|
function offsetDate(date, timezone) {
|
|
561
571
|
if (timezone === 'UTC') {
|
|
@@ -573,7 +583,8 @@ function offsetDate(date, timezone) {
|
|
|
573
583
|
exports.offsetDate = offsetDate;
|
|
574
584
|
/**
|
|
575
585
|
* Returns if the zones are loaded.
|
|
576
|
-
*
|
|
586
|
+
*
|
|
587
|
+
* @return {boolean}
|
|
577
588
|
*/
|
|
578
589
|
function zonesLoaded() {
|
|
579
590
|
return moment_timezone_1.default.zonesLoaded;
|
|
@@ -581,8 +592,9 @@ function zonesLoaded() {
|
|
|
581
592
|
exports.zonesLoaded = zonesLoaded;
|
|
582
593
|
/**
|
|
583
594
|
* Returns if we should load the zones.
|
|
584
|
-
*
|
|
585
|
-
* @
|
|
595
|
+
*
|
|
596
|
+
* @param timezone
|
|
597
|
+
* @return {boolean}
|
|
586
598
|
*/
|
|
587
599
|
function shouldLoadZones(timezone) {
|
|
588
600
|
if (timezone === currentTimezone() || timezone === 'UTC') {
|
|
@@ -593,9 +605,8 @@ function shouldLoadZones(timezone) {
|
|
|
593
605
|
exports.shouldLoadZones = shouldLoadZones;
|
|
594
606
|
/**
|
|
595
607
|
* Externally load the timezone data.
|
|
596
|
-
*
|
|
597
|
-
* @
|
|
598
|
-
* @returns {Promise<any> | *} - Resolves when the zones for this timezone are loaded.
|
|
608
|
+
*
|
|
609
|
+
* @return {Promise<any> | *}
|
|
599
610
|
*/
|
|
600
611
|
function loadZones(url, timezone) {
|
|
601
612
|
if (timezone && !shouldLoadZones(timezone)) {
|
|
@@ -620,10 +631,11 @@ function loadZones(url, timezone) {
|
|
|
620
631
|
exports.loadZones = loadZones;
|
|
621
632
|
/**
|
|
622
633
|
* Get the moment date object for translating dates with timezones.
|
|
623
|
-
*
|
|
624
|
-
* @param
|
|
625
|
-
* @param
|
|
626
|
-
* @
|
|
634
|
+
*
|
|
635
|
+
* @param value
|
|
636
|
+
* @param format
|
|
637
|
+
* @param timezone
|
|
638
|
+
* @return {*}
|
|
627
639
|
*/
|
|
628
640
|
function momentDate(value, format, timezone) {
|
|
629
641
|
const momentDate = (0, moment_timezone_1.default)(value);
|
|
@@ -641,12 +653,11 @@ function momentDate(value, format, timezone) {
|
|
|
641
653
|
exports.momentDate = momentDate;
|
|
642
654
|
/**
|
|
643
655
|
* Format a date provided a value, format, and timezone object.
|
|
644
|
-
*
|
|
645
|
-
* @param
|
|
646
|
-
* @param
|
|
647
|
-
* @param
|
|
648
|
-
* @
|
|
649
|
-
* @returns {string} - The formatted date.
|
|
656
|
+
*
|
|
657
|
+
* @param value
|
|
658
|
+
* @param format
|
|
659
|
+
* @param timezone
|
|
660
|
+
* @return {string}
|
|
650
661
|
*/
|
|
651
662
|
function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat) {
|
|
652
663
|
const momentDate = (0, moment_timezone_1.default)(value, flatPickrInputFormat || undefined);
|
|
@@ -680,12 +691,12 @@ function formatDate(timezonesUrl, value, format, timezone, flatPickrInputFormat)
|
|
|
680
691
|
exports.formatDate = formatDate;
|
|
681
692
|
/**
|
|
682
693
|
* Pass a format function to format within a timezone.
|
|
683
|
-
*
|
|
684
|
-
* @param
|
|
685
|
-
* @param
|
|
686
|
-
* @param
|
|
687
|
-
* @param
|
|
688
|
-
* @
|
|
694
|
+
*
|
|
695
|
+
* @param formatFn
|
|
696
|
+
* @param date
|
|
697
|
+
* @param format
|
|
698
|
+
* @param timezone
|
|
699
|
+
* @return {string}
|
|
689
700
|
*/
|
|
690
701
|
function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
|
691
702
|
if (timezone === currentTimezone()) {
|
|
@@ -705,11 +716,6 @@ function formatOffset(timezonesUrl, formatFn, date, format, timezone) {
|
|
|
705
716
|
}
|
|
706
717
|
}
|
|
707
718
|
exports.formatOffset = formatOffset;
|
|
708
|
-
/**
|
|
709
|
-
* Returns the local date format information.
|
|
710
|
-
* @param {Intl.LocalesArgument} locale - The locale to get the date format for.
|
|
711
|
-
* @returns {object} - The local date format information.
|
|
712
|
-
*/
|
|
713
719
|
function getLocaleDateFormatInfo(locale) {
|
|
714
720
|
const formatInfo = {};
|
|
715
721
|
const day = 21;
|
|
@@ -721,8 +727,8 @@ function getLocaleDateFormatInfo(locale) {
|
|
|
721
727
|
exports.getLocaleDateFormatInfo = getLocaleDateFormatInfo;
|
|
722
728
|
/**
|
|
723
729
|
* Convert the format from the angular-datepicker module to flatpickr format.
|
|
724
|
-
* @param
|
|
725
|
-
* @
|
|
730
|
+
* @param format
|
|
731
|
+
* @return {string}
|
|
726
732
|
*/
|
|
727
733
|
function convertFormatToFlatpickr(format) {
|
|
728
734
|
return format
|
|
@@ -753,8 +759,8 @@ function convertFormatToFlatpickr(format) {
|
|
|
753
759
|
exports.convertFormatToFlatpickr = convertFormatToFlatpickr;
|
|
754
760
|
/**
|
|
755
761
|
* Convert the format from the angular-datepicker module to moment format.
|
|
756
|
-
* @param
|
|
757
|
-
* @
|
|
762
|
+
* @param format
|
|
763
|
+
* @return {string}
|
|
758
764
|
*/
|
|
759
765
|
function convertFormatToMoment(format) {
|
|
760
766
|
return format
|
|
@@ -770,11 +776,6 @@ function convertFormatToMoment(format) {
|
|
|
770
776
|
.replace(/U/g, 'X');
|
|
771
777
|
}
|
|
772
778
|
exports.convertFormatToMoment = convertFormatToMoment;
|
|
773
|
-
/**
|
|
774
|
-
* Convert the format from the angular-datepicker module to mask format.
|
|
775
|
-
* @param {string} format - The format to convert.
|
|
776
|
-
* @returns {string} - The converted format.
|
|
777
|
-
*/
|
|
778
779
|
function convertFormatToMask(format) {
|
|
779
780
|
return format
|
|
780
781
|
// Long month replacement.
|
|
@@ -834,13 +835,6 @@ function getInputMask(mask, placeholderChar) {
|
|
|
834
835
|
return maskArray;
|
|
835
836
|
}
|
|
836
837
|
exports.getInputMask = getInputMask;
|
|
837
|
-
/**
|
|
838
|
-
* Unmasks a value using the provided mask and placeholder characters.
|
|
839
|
-
* @param {string} value - The value to unmask.
|
|
840
|
-
* @param {string} mask - The mask to use for unmasking.
|
|
841
|
-
* @param {string} placeholderChar - The placeholder character to use for unmasking.
|
|
842
|
-
* @returns {string} - The unmasked value.
|
|
843
|
-
*/
|
|
844
838
|
function unmaskValue(value, mask, placeholderChar) {
|
|
845
839
|
if (!mask || !value || value.length > mask.length) {
|
|
846
840
|
return value;
|
|
@@ -857,12 +851,6 @@ function unmaskValue(value, mask, placeholderChar) {
|
|
|
857
851
|
return unmaskedValue;
|
|
858
852
|
}
|
|
859
853
|
exports.unmaskValue = unmaskValue;
|
|
860
|
-
/**
|
|
861
|
-
* Returns true if the value matches the input mask format.
|
|
862
|
-
* @param {string} value - The value to check.
|
|
863
|
-
* @param {string} inputMask - The input mask to check against.
|
|
864
|
-
* @returns {boolean} - TRUE if the value matches the input mask; FALSE otherwise.
|
|
865
|
-
*/
|
|
866
854
|
function matchInputMask(value, inputMask) {
|
|
867
855
|
if (!inputMask) {
|
|
868
856
|
return true;
|
|
@@ -881,11 +869,6 @@ function matchInputMask(value, inputMask) {
|
|
|
881
869
|
return true;
|
|
882
870
|
}
|
|
883
871
|
exports.matchInputMask = matchInputMask;
|
|
884
|
-
/**
|
|
885
|
-
* Returns the number separators (i.e. 1,000) for the provided language.
|
|
886
|
-
* @param {string} lang - The language code to get the number separators for.
|
|
887
|
-
* @returns {{delimiter: string, decimalSeparator: string}} - The number separators.
|
|
888
|
-
*/
|
|
889
872
|
function getNumberSeparators(lang = 'en') {
|
|
890
873
|
const formattedNumberString = (12345.6789).toLocaleString(lang);
|
|
891
874
|
const delimeters = formattedNumberString.match(/..(.)...(.)../);
|
|
@@ -901,12 +884,6 @@ function getNumberSeparators(lang = 'en') {
|
|
|
901
884
|
};
|
|
902
885
|
}
|
|
903
886
|
exports.getNumberSeparators = getNumberSeparators;
|
|
904
|
-
/**
|
|
905
|
-
* Returns the number for the maximum amount of decimal places for a number.
|
|
906
|
-
* @param {import('@formio/core').Component} component - The component to check for decimal limits.
|
|
907
|
-
* @param {number} defaultLimit - The default limit to use if none is provided in the component.
|
|
908
|
-
* @returns {number} - The number of decimal places allowed.
|
|
909
|
-
*/
|
|
910
887
|
function getNumberDecimalLimit(component, defaultLimit) {
|
|
911
888
|
if (lodash_1.default.has(component, 'decimalLimit')) {
|
|
912
889
|
return lodash_1.default.get(component, 'decimalLimit');
|
|
@@ -923,15 +900,6 @@ function getNumberDecimalLimit(component, defaultLimit) {
|
|
|
923
900
|
return decimalLimit;
|
|
924
901
|
}
|
|
925
902
|
exports.getNumberDecimalLimit = getNumberDecimalLimit;
|
|
926
|
-
/**
|
|
927
|
-
* Returns the currency affixes for a specific language.
|
|
928
|
-
* @param {object} arg0 - The arguments object.
|
|
929
|
-
* @param {string} arg0.currency - The currency code to get the affixes for.
|
|
930
|
-
* @param {number} arg0.decimalLimit - The number of decimal places to use.
|
|
931
|
-
* @param {string} arg0.decimalSeparator - The decimal separator to use.
|
|
932
|
-
* @param {string} arg0.lang - The language code to use.
|
|
933
|
-
* @returns {{prefix: string, suffix: string}} - The currency affixes.
|
|
934
|
-
*/
|
|
935
903
|
function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
|
|
936
904
|
// Get the prefix and suffix from the localized string.
|
|
937
905
|
let regex = `(.*)?${(100).toLocaleString(lang)}`;
|
|
@@ -954,9 +922,10 @@ function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, })
|
|
|
954
922
|
exports.getCurrencyAffixes = getCurrencyAffixes;
|
|
955
923
|
/**
|
|
956
924
|
* Fetch the field data provided a component.
|
|
957
|
-
*
|
|
958
|
-
* @param
|
|
959
|
-
* @
|
|
925
|
+
*
|
|
926
|
+
* @param data
|
|
927
|
+
* @param component
|
|
928
|
+
* @return {*}
|
|
960
929
|
*/
|
|
961
930
|
function fieldData(data, component) {
|
|
962
931
|
if (!data) {
|
|
@@ -1003,23 +972,16 @@ function fieldData(data, component) {
|
|
|
1003
972
|
exports.fieldData = fieldData;
|
|
1004
973
|
/**
|
|
1005
974
|
* Delays function execution with possibility to execute function synchronously or cancel it.
|
|
1006
|
-
*
|
|
1007
|
-
* @param
|
|
1008
|
-
* @param
|
|
1009
|
-
* @
|
|
975
|
+
*
|
|
976
|
+
* @param fn Function to delay
|
|
977
|
+
* @param delay Delay time
|
|
978
|
+
* @return {*}
|
|
1010
979
|
*/
|
|
1011
980
|
function delay(fn, delay = 0, ...args) {
|
|
1012
981
|
const timer = setTimeout(fn, delay, ...args);
|
|
1013
|
-
/**
|
|
1014
|
-
*
|
|
1015
|
-
*/
|
|
1016
982
|
function cancel() {
|
|
1017
983
|
clearTimeout(timer);
|
|
1018
984
|
}
|
|
1019
|
-
/**
|
|
1020
|
-
* Execute the function early.
|
|
1021
|
-
* @returns {*} - The result of the function.
|
|
1022
|
-
*/
|
|
1023
985
|
function earlyCall() {
|
|
1024
986
|
cancel();
|
|
1025
987
|
return fn(...args);
|
|
@@ -1031,9 +993,11 @@ function delay(fn, delay = 0, ...args) {
|
|
|
1031
993
|
exports.delay = delay;
|
|
1032
994
|
/**
|
|
1033
995
|
* Iterate the given key to make it unique.
|
|
1034
|
-
*
|
|
996
|
+
*
|
|
997
|
+
* @param {String} key
|
|
1035
998
|
* Modify the component key to be unique.
|
|
1036
|
-
*
|
|
999
|
+
*
|
|
1000
|
+
* @returns {String}
|
|
1037
1001
|
* The new component key.
|
|
1038
1002
|
*/
|
|
1039
1003
|
function iterateKey(key) {
|
|
@@ -1047,9 +1011,10 @@ function iterateKey(key) {
|
|
|
1047
1011
|
exports.iterateKey = iterateKey;
|
|
1048
1012
|
/**
|
|
1049
1013
|
* Determines a unique key within a map provided the base key.
|
|
1050
|
-
*
|
|
1051
|
-
* @param
|
|
1052
|
-
* @
|
|
1014
|
+
*
|
|
1015
|
+
* @param map
|
|
1016
|
+
* @param base
|
|
1017
|
+
* @return {*}
|
|
1053
1018
|
*/
|
|
1054
1019
|
function uniqueKey(map, base) {
|
|
1055
1020
|
let newKey = base;
|
|
@@ -1061,9 +1026,8 @@ function uniqueKey(map, base) {
|
|
|
1061
1026
|
exports.uniqueKey = uniqueKey;
|
|
1062
1027
|
/**
|
|
1063
1028
|
* Determines the major version number of bootstrap.
|
|
1064
|
-
*
|
|
1065
|
-
* @
|
|
1066
|
-
* @returns {number} - The bootstrap version.
|
|
1029
|
+
*
|
|
1030
|
+
* @return {number}
|
|
1067
1031
|
*/
|
|
1068
1032
|
function bootstrapVersion(options) {
|
|
1069
1033
|
if (options.bootstrap) {
|
|
@@ -1081,8 +1045,9 @@ exports.bootstrapVersion = bootstrapVersion;
|
|
|
1081
1045
|
/**
|
|
1082
1046
|
* Retrun provided argument.
|
|
1083
1047
|
* If argument is a function, returns the result of a function call.
|
|
1084
|
-
* @param {
|
|
1085
|
-
*
|
|
1048
|
+
* @param {*} e;
|
|
1049
|
+
*
|
|
1050
|
+
* @return {*}
|
|
1086
1051
|
*/
|
|
1087
1052
|
function unfold(e) {
|
|
1088
1053
|
if (typeof e === 'function') {
|
|
@@ -1093,32 +1058,27 @@ function unfold(e) {
|
|
|
1093
1058
|
exports.unfold = unfold;
|
|
1094
1059
|
/**
|
|
1095
1060
|
* Map values through unfold and return first non-nil value.
|
|
1096
|
-
* @param {Array<T>} collection
|
|
1097
|
-
*
|
|
1061
|
+
* @param {Array<T>} collection;
|
|
1062
|
+
*
|
|
1063
|
+
* @return {T}
|
|
1098
1064
|
*/
|
|
1099
1065
|
exports.firstNonNil = lodash_1.default.flow([
|
|
1100
1066
|
lodash_1.default.partialRight(lodash_1.default.map, unfold),
|
|
1101
1067
|
lodash_1.default.partialRight(lodash_1.default.find, v => !lodash_1.default.isUndefined(v))
|
|
1102
1068
|
]);
|
|
1103
|
-
|
|
1104
|
-
* Create enclosed state.
|
|
1069
|
+
/*
|
|
1070
|
+
* Create enclosed state.
|
|
1071
|
+
* Returns functions to getting and cycling between states.
|
|
1105
1072
|
* @param {*} a - initial state.
|
|
1106
1073
|
* @param {*} b - next state.
|
|
1107
|
-
* @
|
|
1074
|
+
* @return {Functions[]} -- [get, toggle];
|
|
1108
1075
|
*/
|
|
1109
1076
|
function withSwitch(a, b) {
|
|
1110
1077
|
let state = a;
|
|
1111
1078
|
let next = b;
|
|
1112
|
-
/**
|
|
1113
|
-
* Returns the state of the switch.
|
|
1114
|
-
* @returns {*} - The current state.
|
|
1115
|
-
*/
|
|
1116
1079
|
function get() {
|
|
1117
1080
|
return state;
|
|
1118
1081
|
}
|
|
1119
|
-
/**
|
|
1120
|
-
* Toggles the state of the switch.
|
|
1121
|
-
*/
|
|
1122
1082
|
function toggle() {
|
|
1123
1083
|
const prev = state;
|
|
1124
1084
|
state = next;
|
|
@@ -1127,14 +1087,6 @@ function withSwitch(a, b) {
|
|
|
1127
1087
|
return [get, toggle];
|
|
1128
1088
|
}
|
|
1129
1089
|
exports.withSwitch = withSwitch;
|
|
1130
|
-
/**
|
|
1131
|
-
* Create a function that will call the provided function only the provided limit.
|
|
1132
|
-
* @param {Function} callback - The callback to call.
|
|
1133
|
-
* @param {object} options - The options to use.
|
|
1134
|
-
* @param {number} options.limit - The limit to call the callback.
|
|
1135
|
-
* @param {number} options.delay - The delay to wait before resetting the call count.
|
|
1136
|
-
* @returns {Function} - The function that will call the callback only the provided limit.
|
|
1137
|
-
*/
|
|
1138
1090
|
function observeOverload(callback, options = {}) {
|
|
1139
1091
|
const { limit = 50, delay = 500 } = options;
|
|
1140
1092
|
let callCount = 0;
|
|
@@ -1155,13 +1107,6 @@ function observeOverload(callback, options = {}) {
|
|
|
1155
1107
|
};
|
|
1156
1108
|
}
|
|
1157
1109
|
exports.observeOverload = observeOverload;
|
|
1158
|
-
/**
|
|
1159
|
-
* Returns the components that are provided within an evaluation context.
|
|
1160
|
-
* @param {any} context - The evaluation context to get the components from.
|
|
1161
|
-
* @param {boolean} excludeNested - Exclude nested components.
|
|
1162
|
-
* @param {Array<string>} excludedTypes - The types of components to exclude.
|
|
1163
|
-
* @returns {Array} - The components within the evaluation context.
|
|
1164
|
-
*/
|
|
1165
1110
|
function getContextComponents(context, excludeNested, excludedTypes = []) {
|
|
1166
1111
|
const values = [];
|
|
1167
1112
|
context.utils.eachComponent(context.instance.options.editForm.components, (component, path) => {
|
|
@@ -1176,11 +1121,6 @@ function getContextComponents(context, excludeNested, excludedTypes = []) {
|
|
|
1176
1121
|
return values;
|
|
1177
1122
|
}
|
|
1178
1123
|
exports.getContextComponents = getContextComponents;
|
|
1179
|
-
/**
|
|
1180
|
-
* Returns the button components that are within an evaluation context.
|
|
1181
|
-
* @param {any} context - The evaluation context to get the components from.
|
|
1182
|
-
* @returns {Array} - The button components within the evaluation context.
|
|
1183
|
-
*/
|
|
1184
1124
|
function getContextButtons(context) {
|
|
1185
1125
|
const values = [];
|
|
1186
1126
|
context.utils.eachComponent(context.instance.options.editForm.components, (component) => {
|
|
@@ -1198,15 +1138,18 @@ exports.getContextButtons = getContextButtons;
|
|
|
1198
1138
|
const inTextTags = ['#text', 'A', 'B', 'EM', 'I', 'SMALL', 'STRONG', 'SUB', 'SUP', 'INS', 'DEL', 'MARK', 'CODE'];
|
|
1199
1139
|
/**
|
|
1200
1140
|
* Helper function for 'translateHTMLTemplate'. Translates text value of the passed html element.
|
|
1201
|
-
*
|
|
1202
|
-
* @param {
|
|
1203
|
-
* @
|
|
1141
|
+
*
|
|
1142
|
+
* @param {HTMLElement} elem
|
|
1143
|
+
* @param {Function} translate
|
|
1144
|
+
*
|
|
1145
|
+
* @returns {String}
|
|
1146
|
+
* Translated element template.
|
|
1204
1147
|
*/
|
|
1205
1148
|
function translateElemValue(elem, translate) {
|
|
1206
1149
|
if (!elem.innerText) {
|
|
1207
1150
|
return elem.innerHTML;
|
|
1208
1151
|
}
|
|
1209
|
-
const elemValue = elem.innerText.replace(Evaluator_1.
|
|
1152
|
+
const elemValue = elem.innerText.replace(Evaluator_1.default.templateSettings.interpolate, '').replace(/\s\s+/g, ' ').trim();
|
|
1210
1153
|
const translatedValue = translate(elemValue);
|
|
1211
1154
|
if (elemValue !== translatedValue) {
|
|
1212
1155
|
const links = elem.innerHTML.match(/<a[^>]*>(.*?)<\/a>/g);
|
|
@@ -1231,8 +1174,10 @@ function translateElemValue(elem, translate) {
|
|
|
1231
1174
|
}
|
|
1232
1175
|
/**
|
|
1233
1176
|
* Helper function for 'translateHTMLTemplate'. Goes deep through html tag children and calls function to translate their text values.
|
|
1234
|
-
*
|
|
1235
|
-
* @param {
|
|
1177
|
+
*
|
|
1178
|
+
* @param {HTMLElement} tag
|
|
1179
|
+
* @param {Function} translate
|
|
1180
|
+
*
|
|
1236
1181
|
* @returns {void}
|
|
1237
1182
|
*/
|
|
1238
1183
|
function translateDeepTag(tag, translate) {
|
|
@@ -1248,9 +1193,12 @@ function translateDeepTag(tag, translate) {
|
|
|
1248
1193
|
}
|
|
1249
1194
|
/**
|
|
1250
1195
|
* Translates text values in html template.
|
|
1251
|
-
*
|
|
1252
|
-
* @param {
|
|
1253
|
-
* @
|
|
1196
|
+
*
|
|
1197
|
+
* @param {String} template
|
|
1198
|
+
* @param {Function} translate
|
|
1199
|
+
*
|
|
1200
|
+
* @returns {String}
|
|
1201
|
+
* Html template with translated values.
|
|
1254
1202
|
*/
|
|
1255
1203
|
function translateHTMLTemplate(template, translate) {
|
|
1256
1204
|
const isHTML = /<[^>]*>/.test(template);
|
|
@@ -1268,9 +1216,9 @@ function translateHTMLTemplate(template, translate) {
|
|
|
1268
1216
|
exports.translateHTMLTemplate = translateHTMLTemplate;
|
|
1269
1217
|
/**
|
|
1270
1218
|
* Sanitize an html string.
|
|
1271
|
-
*
|
|
1272
|
-
* @param
|
|
1273
|
-
* @returns {
|
|
1219
|
+
*
|
|
1220
|
+
* @param string
|
|
1221
|
+
* @returns {*}
|
|
1274
1222
|
*/
|
|
1275
1223
|
function sanitize(string, options) {
|
|
1276
1224
|
if (typeof dompurify_1.default.sanitize !== 'function') {
|
|
@@ -1319,18 +1267,11 @@ function sanitize(string, options) {
|
|
|
1319
1267
|
exports.sanitize = sanitize;
|
|
1320
1268
|
/**
|
|
1321
1269
|
* Fast cloneDeep for JSON objects only.
|
|
1322
|
-
* @param {any} obj - The object to perform a fast clone deep against.
|
|
1323
|
-
* @returns {any} - The cloned object.
|
|
1324
1270
|
*/
|
|
1325
1271
|
function fastCloneDeep(obj) {
|
|
1326
1272
|
return obj ? JSON.parse(JSON.stringify(obj)) : obj;
|
|
1327
1273
|
}
|
|
1328
1274
|
exports.fastCloneDeep = fastCloneDeep;
|
|
1329
|
-
/**
|
|
1330
|
-
* Returns if the component is an input component.
|
|
1331
|
-
* @param {import('@formio/core').Component} componentJson - The JSON of a component.
|
|
1332
|
-
* @returns {bool} - TRUE if the component is an input component; FALSE otherwise.
|
|
1333
|
-
*/
|
|
1334
1275
|
function isInputComponent(componentJson) {
|
|
1335
1276
|
if (componentJson.input === false || componentJson.input === true) {
|
|
1336
1277
|
return componentJson.input;
|
|
@@ -1351,11 +1292,6 @@ function isInputComponent(componentJson) {
|
|
|
1351
1292
|
}
|
|
1352
1293
|
}
|
|
1353
1294
|
exports.isInputComponent = isInputComponent;
|
|
1354
|
-
/**
|
|
1355
|
-
* Takes a component path, and returns a component path array.
|
|
1356
|
-
* @param {string} pathStr - The path string to convert to an array.
|
|
1357
|
-
* @returns {Arryay<number>} - The array of paths.
|
|
1358
|
-
*/
|
|
1359
1295
|
function getArrayFromComponentPath(pathStr) {
|
|
1360
1296
|
if (!pathStr || !lodash_1.default.isString(pathStr)) {
|
|
1361
1297
|
if (!lodash_1.default.isArray(pathStr)) {
|
|
@@ -1370,12 +1306,6 @@ function getArrayFromComponentPath(pathStr) {
|
|
|
1370
1306
|
.map(part => lodash_1.default.defaultTo(lodash_1.default.toNumber(part), part));
|
|
1371
1307
|
}
|
|
1372
1308
|
exports.getArrayFromComponentPath = getArrayFromComponentPath;
|
|
1373
|
-
/**
|
|
1374
|
-
* Returns true if the component is a child of the parent.
|
|
1375
|
-
* @param {any} child - The child component to check.
|
|
1376
|
-
* @param {any} parent - The parent component to check.
|
|
1377
|
-
* @returns {boolean} - TRUE if the child is a child of the parent; FALSE otherwise.
|
|
1378
|
-
*/
|
|
1379
1309
|
function isChildOf(child, parent) {
|
|
1380
1310
|
while (child && child.parent) {
|
|
1381
1311
|
if (child.parent === parent) {
|
|
@@ -1386,11 +1316,6 @@ function isChildOf(child, parent) {
|
|
|
1386
1316
|
return false;
|
|
1387
1317
|
}
|
|
1388
1318
|
exports.isChildOf = isChildOf;
|
|
1389
|
-
/**
|
|
1390
|
-
* Takes an array of component path indexes, and returns a string version of that array.
|
|
1391
|
-
* @param {Array<number>} path - The path array to convert to a string.
|
|
1392
|
-
* @returns {string} - The string version of the path.
|
|
1393
|
-
*/
|
|
1394
1319
|
function getStringFromComponentPath(path) {
|
|
1395
1320
|
if (!lodash_1.default.isArray(path)) {
|
|
1396
1321
|
return path;
|
|
@@ -1407,22 +1332,17 @@ function getStringFromComponentPath(path) {
|
|
|
1407
1332
|
return strPath;
|
|
1408
1333
|
}
|
|
1409
1334
|
exports.getStringFromComponentPath = getStringFromComponentPath;
|
|
1410
|
-
/**
|
|
1411
|
-
* Takes a number and rounds it to the provided precision amount.
|
|
1412
|
-
* @param {number} number - The number to round.
|
|
1413
|
-
* @param {number} precision - The precision to round the number to.
|
|
1414
|
-
* @returns {string} - The rounded number.
|
|
1415
|
-
*/
|
|
1416
1335
|
function round(number, precision) {
|
|
1417
1336
|
if (lodash_1.default.isNumber(number)) {
|
|
1418
1337
|
return number.toFixed(precision);
|
|
1419
1338
|
}
|
|
1420
|
-
return number
|
|
1339
|
+
return number;
|
|
1421
1340
|
}
|
|
1422
1341
|
exports.round = round;
|
|
1423
1342
|
/**
|
|
1424
1343
|
* Check for Internet Explorer browser version
|
|
1425
|
-
*
|
|
1344
|
+
*
|
|
1345
|
+
* @return {(number|null)}
|
|
1426
1346
|
*/
|
|
1427
1347
|
function getIEBrowserVersion() {
|
|
1428
1348
|
const { ie, version } = getBrowserInfo();
|
|
@@ -1431,7 +1351,8 @@ function getIEBrowserVersion() {
|
|
|
1431
1351
|
exports.getIEBrowserVersion = getIEBrowserVersion;
|
|
1432
1352
|
/**
|
|
1433
1353
|
* Get browser name and version (modified from 'jquery-browser-plugin')
|
|
1434
|
-
*
|
|
1354
|
+
*
|
|
1355
|
+
* @return {Object} -- {{browser name, version, isWebkit?}}
|
|
1435
1356
|
* Possible browser names: chrome, safari, ie, edge, opera, mozilla, yabrowser
|
|
1436
1357
|
*/
|
|
1437
1358
|
function getBrowserInfo() {
|
|
@@ -1480,20 +1401,13 @@ function getBrowserInfo() {
|
|
|
1480
1401
|
return browser;
|
|
1481
1402
|
}
|
|
1482
1403
|
exports.getBrowserInfo = getBrowserInfo;
|
|
1483
|
-
/**
|
|
1484
|
-
* Takes a component path, which may include array indicies (i.e. [0][1]), and returns the compoennt path without the indicies.
|
|
1485
|
-
* @param {string} path - The path to remove the indicies from.
|
|
1486
|
-
* @returns {string} - The path without the indicies.
|
|
1487
|
-
*/
|
|
1488
1404
|
function getComponentPathWithoutIndicies(path = '') {
|
|
1489
1405
|
return path.replace(/\[\d+\]/, '');
|
|
1490
1406
|
}
|
|
1491
1407
|
exports.getComponentPathWithoutIndicies = getComponentPathWithoutIndicies;
|
|
1492
1408
|
/**
|
|
1493
1409
|
* Returns a path to the component which based on its schema
|
|
1494
|
-
* @param {
|
|
1495
|
-
* @param {string} path - Path to the component
|
|
1496
|
-
* @returns {string} - Path to the component
|
|
1410
|
+
* @param {*} component is a component's schema containing link to its parent's schema in the 'parent' property
|
|
1497
1411
|
*/
|
|
1498
1412
|
function getComponentPath(component, path = '') {
|
|
1499
1413
|
var _a;
|
|
@@ -1506,8 +1420,8 @@ function getComponentPath(component, path = '') {
|
|
|
1506
1420
|
exports.getComponentPath = getComponentPath;
|
|
1507
1421
|
/**
|
|
1508
1422
|
* Returns a parent component of the passed component instance skipping all the Layout components
|
|
1509
|
-
* @param {
|
|
1510
|
-
* @
|
|
1423
|
+
* @param {*} componentInstance
|
|
1424
|
+
* @return {(Component|undefined)}
|
|
1511
1425
|
*/
|
|
1512
1426
|
function getDataParentComponent(componentInstance) {
|
|
1513
1427
|
if (!componentInstance) {
|
|
@@ -1524,8 +1438,8 @@ function getDataParentComponent(componentInstance) {
|
|
|
1524
1438
|
exports.getDataParentComponent = getDataParentComponent;
|
|
1525
1439
|
/**
|
|
1526
1440
|
* Returns whether the value is a promise
|
|
1527
|
-
* @param
|
|
1528
|
-
* @
|
|
1441
|
+
* @param value
|
|
1442
|
+
* @return {boolean}
|
|
1529
1443
|
*/
|
|
1530
1444
|
function isPromise(value) {
|
|
1531
1445
|
return value
|
|
@@ -1537,9 +1451,9 @@ exports.isPromise = isPromise;
|
|
|
1537
1451
|
/**
|
|
1538
1452
|
* Determines if the component has a scoping parent in tree (a component which scopes its children and manages its
|
|
1539
1453
|
* changes by itself, e.g. EditGrid)
|
|
1540
|
-
* @param
|
|
1541
|
-
* @param
|
|
1542
|
-
* @returns {boolean|*}
|
|
1454
|
+
* @param componentInstance
|
|
1455
|
+
* @param firstPass
|
|
1456
|
+
* @returns {boolean|boolean|*}
|
|
1543
1457
|
*/
|
|
1544
1458
|
function isInsideScopingComponent(componentInstance, firstPass = true) {
|
|
1545
1459
|
if (!firstPass && (componentInstance === null || componentInstance === void 0 ? void 0 : componentInstance.hasScopedChildren)) {
|
|
@@ -1555,11 +1469,6 @@ function isInsideScopingComponent(componentInstance, firstPass = true) {
|
|
|
1555
1469
|
return false;
|
|
1556
1470
|
}
|
|
1557
1471
|
exports.isInsideScopingComponent = isInsideScopingComponent;
|
|
1558
|
-
/**
|
|
1559
|
-
* Returns all the focusable elements within the provided dom element.
|
|
1560
|
-
* @param {HTMLElement} element - The element to get the focusable elements from.
|
|
1561
|
-
* @returns {NodeList<HTMLElement>} - The focusable elements within the provided element.
|
|
1562
|
-
*/
|
|
1563
1472
|
function getFocusableElements(element) {
|
|
1564
1473
|
const focusableSelector = `button:not([disabled]), input:not([disabled]), select:not([disabled]),
|
|
1565
1474
|
textarea:not([disabled]), button:not([disabled]), [href]`;
|
|
@@ -1575,11 +1484,6 @@ exports.componentValueTypes = {
|
|
|
1575
1484
|
date: 'date',
|
|
1576
1485
|
any: 'any',
|
|
1577
1486
|
};
|
|
1578
|
-
/**
|
|
1579
|
-
* Returns the saved types for the component
|
|
1580
|
-
* @param {import('@formio/core').Component} fullSchema - The component schema
|
|
1581
|
-
* @returns {Array<string>|null} - The saved types for the component
|
|
1582
|
-
*/
|
|
1583
1487
|
function getComponentSavedTypes(fullSchema) {
|
|
1584
1488
|
const schema = fullSchema || {};
|
|
1585
1489
|
if (schema.persistent !== true) {
|
|
@@ -1593,10 +1497,9 @@ function getComponentSavedTypes(fullSchema) {
|
|
|
1593
1497
|
exports.getComponentSavedTypes = getComponentSavedTypes;
|
|
1594
1498
|
/**
|
|
1595
1499
|
* Interpolates @formio/core errors so that they are compatible with the renderer
|
|
1596
|
-
* @param {
|
|
1597
|
-
* @param
|
|
1598
|
-
* @
|
|
1599
|
-
* @returns {[]} - The interpolated errors
|
|
1500
|
+
* @param {FieldError[]} errors
|
|
1501
|
+
* @param firstPass
|
|
1502
|
+
* @returns {[]}
|
|
1600
1503
|
*/
|
|
1601
1504
|
const interpolateErrors = (component, errors, interpolateFn) => {
|
|
1602
1505
|
return errors.map((error) => {
|
|
@@ -1607,11 +1510,6 @@ const interpolateErrors = (component, errors, interpolateFn) => {
|
|
|
1607
1510
|
});
|
|
1608
1511
|
};
|
|
1609
1512
|
exports.interpolateErrors = interpolateErrors;
|
|
1610
|
-
/**
|
|
1611
|
-
* Returns the template keys inside the template code.
|
|
1612
|
-
* @param {string} template - The template to get the keys from.
|
|
1613
|
-
* @returns {Array<string>} - The keys inside the template.
|
|
1614
|
-
*/
|
|
1615
1513
|
function getItemTemplateKeys(template) {
|
|
1616
1514
|
const templateKeys = [];
|
|
1617
1515
|
if (!template) {
|
|
@@ -1629,11 +1527,6 @@ function getItemTemplateKeys(template) {
|
|
|
1629
1527
|
return templateKeys;
|
|
1630
1528
|
}
|
|
1631
1529
|
exports.getItemTemplateKeys = getItemTemplateKeys;
|
|
1632
|
-
/**
|
|
1633
|
-
* Returns if the component is a select resource with an object for its value.
|
|
1634
|
-
* @param {import('@formio/core').Component} comp - The component to check.
|
|
1635
|
-
* @returns {boolean} - TRUE if the component is a select resource with an object for its value; FALSE otherwise.
|
|
1636
|
-
*/
|
|
1637
1530
|
function isSelectResourceWithObjectValue(comp = {}) {
|
|
1638
1531
|
const { reference, dataSrc, valueProperty } = comp;
|
|
1639
1532
|
return reference || (dataSrc === 'resource' && (!valueProperty || valueProperty === 'data'));
|