@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
|
@@ -165,7 +165,9 @@ export default class Component extends Element {
|
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
167
|
* Return the simple condition settings as part of the component.
|
|
168
|
-
*
|
|
168
|
+
*
|
|
169
|
+
* @return {Object}
|
|
170
|
+
*
|
|
169
171
|
*/
|
|
170
172
|
static get conditionOperatorsSettings() {
|
|
171
173
|
return {
|
|
@@ -182,8 +184,10 @@ export default class Component extends Element {
|
|
|
182
184
|
}
|
|
183
185
|
/**
|
|
184
186
|
* Return the array of possible types of component value absed on its schema.
|
|
187
|
+
*
|
|
185
188
|
* @param schema
|
|
186
|
-
* @
|
|
189
|
+
* @return {Array}
|
|
190
|
+
*
|
|
187
191
|
*/
|
|
188
192
|
static savedValueTypes(schema) {
|
|
189
193
|
schema = schema || {};
|
|
@@ -192,6 +196,7 @@ export default class Component extends Element {
|
|
|
192
196
|
/**
|
|
193
197
|
* Provides a table view for this component. Override if you wish to do something different than using getView
|
|
194
198
|
* method of your instance.
|
|
199
|
+
*
|
|
195
200
|
* @param value
|
|
196
201
|
* @param options
|
|
197
202
|
*/
|
|
@@ -200,9 +205,10 @@ export default class Component extends Element {
|
|
|
200
205
|
/* eslint-enable no-unused-vars */
|
|
201
206
|
/**
|
|
202
207
|
* Initialize a new Component.
|
|
203
|
-
*
|
|
204
|
-
* @param {
|
|
205
|
-
* @param {
|
|
208
|
+
*
|
|
209
|
+
* @param {Object} component - The component JSON you wish to initialize.
|
|
210
|
+
* @param {Object} options - The options for this component.
|
|
211
|
+
* @param {Object} data - The global data submission object this component will belong.
|
|
206
212
|
*/
|
|
207
213
|
/* eslint-disable max-statements */
|
|
208
214
|
constructor(component, options, data) {
|
|
@@ -233,6 +239,7 @@ export default class Component extends Element {
|
|
|
233
239
|
}
|
|
234
240
|
/**
|
|
235
241
|
* The data path to this specific component instance.
|
|
242
|
+
*
|
|
236
243
|
* @type {string}
|
|
237
244
|
*/
|
|
238
245
|
this.path = component?.key || '';
|
|
@@ -280,27 +287,32 @@ export default class Component extends Element {
|
|
|
280
287
|
this.row = this.options.row;
|
|
281
288
|
/**
|
|
282
289
|
* Points to a flat map of child components (if applicable).
|
|
283
|
-
*
|
|
290
|
+
*
|
|
291
|
+
* @type {Object}
|
|
284
292
|
*/
|
|
285
293
|
this.childComponentsMap = {};
|
|
286
294
|
/**
|
|
287
295
|
* Determines if this component is disabled, or not.
|
|
296
|
+
*
|
|
288
297
|
* @type {boolean}
|
|
289
298
|
*/
|
|
290
299
|
this._disabled = boolValue(this.component.disabled) ? this.component.disabled : false;
|
|
291
300
|
/**
|
|
292
301
|
* Points to the root component, usually the FormComponent.
|
|
302
|
+
*
|
|
293
303
|
* @type {Component}
|
|
294
304
|
*/
|
|
295
305
|
this.root = this.options.root || this;
|
|
296
306
|
this.localRoot = this.options.localRoot || this;
|
|
297
307
|
/**
|
|
298
308
|
* If this input has been input and provided value.
|
|
309
|
+
*
|
|
299
310
|
* @type {boolean}
|
|
300
311
|
*/
|
|
301
312
|
this.pristine = true;
|
|
302
313
|
/**
|
|
303
314
|
* Points to the parent component.
|
|
315
|
+
*
|
|
304
316
|
* @type {Component}
|
|
305
317
|
*/
|
|
306
318
|
this.parent = this.options.parent;
|
|
@@ -320,7 +332,7 @@ export default class Component extends Element {
|
|
|
320
332
|
this._referenceAttributeName = 'ref';
|
|
321
333
|
/**
|
|
322
334
|
* Used to trigger a new change in this component.
|
|
323
|
-
* @type {
|
|
335
|
+
* @type {function} - Call to trigger a change in this component.
|
|
324
336
|
*/
|
|
325
337
|
let changes = [];
|
|
326
338
|
let lastChanged = null;
|
|
@@ -361,6 +373,7 @@ export default class Component extends Element {
|
|
|
361
373
|
};
|
|
362
374
|
/**
|
|
363
375
|
* Used to trigger a redraw event within this component.
|
|
376
|
+
*
|
|
364
377
|
* @type {Function}
|
|
365
378
|
*/
|
|
366
379
|
this.triggerRedraw = _.debounce(this.redraw.bind(this), 100);
|
|
@@ -559,8 +572,8 @@ export default class Component extends Element {
|
|
|
559
572
|
return this.shouldForceVisibility(component, 'show');
|
|
560
573
|
}
|
|
561
574
|
/**
|
|
562
|
-
*
|
|
563
|
-
* @param {boolean}
|
|
575
|
+
*
|
|
576
|
+
* @param value {boolean}
|
|
564
577
|
*/
|
|
565
578
|
set visible(value) {
|
|
566
579
|
if (this._visible !== value) {
|
|
@@ -578,8 +591,8 @@ export default class Component extends Element {
|
|
|
578
591
|
}
|
|
579
592
|
}
|
|
580
593
|
/**
|
|
581
|
-
*
|
|
582
|
-
* @returns {boolean}
|
|
594
|
+
*
|
|
595
|
+
* @returns {boolean}
|
|
583
596
|
*/
|
|
584
597
|
get visible() {
|
|
585
598
|
// Show only if visibility changes or if we are in builder mode or if hidden fields should be shown.
|
|
@@ -669,10 +682,9 @@ export default class Component extends Element {
|
|
|
669
682
|
}
|
|
670
683
|
/**
|
|
671
684
|
* Returns only the schema that is different from the default.
|
|
672
|
-
*
|
|
673
|
-
* @param
|
|
674
|
-
* @param
|
|
675
|
-
* @returns {object} - The minified json schema for this component.
|
|
685
|
+
*
|
|
686
|
+
* @param schema
|
|
687
|
+
* @param defaultSchema
|
|
676
688
|
*/
|
|
677
689
|
getModifiedSchema(schema, defaultSchema, recursion) {
|
|
678
690
|
const modified = {};
|
|
@@ -706,24 +718,21 @@ export default class Component extends Element {
|
|
|
706
718
|
}
|
|
707
719
|
/**
|
|
708
720
|
* Returns the JSON schema for this component.
|
|
709
|
-
* @returns {object} - The JSON schema for this component.
|
|
710
721
|
*/
|
|
711
722
|
get schema() {
|
|
712
723
|
return fastCloneDeep(this.getModifiedSchema(_.omit(this.component, 'id'), this.defaultSchema));
|
|
713
724
|
}
|
|
714
725
|
/**
|
|
715
726
|
* Returns true if component is inside DataGrid
|
|
716
|
-
* @returns {boolean} - True if component is inside DataGrid
|
|
717
727
|
*/
|
|
718
728
|
get isInDataGrid() {
|
|
719
729
|
return this.inDataGrid;
|
|
720
730
|
}
|
|
721
731
|
/**
|
|
722
732
|
* Translate a text using the i18n system.
|
|
733
|
+
*
|
|
723
734
|
* @param {string} text - The i18n identifier.
|
|
724
|
-
* @param {
|
|
725
|
-
* @param {...any} args - Additional arguments to pass to the translation library.
|
|
726
|
-
* @returns {string} - The translated text.
|
|
735
|
+
* @param {Object} params - The i18n parameters to use for translation.
|
|
727
736
|
*/
|
|
728
737
|
t(text, params = {}, ...args) {
|
|
729
738
|
if (!text) {
|
|
@@ -813,7 +822,7 @@ export default class Component extends Element {
|
|
|
813
822
|
isHtmlRenderMode() {
|
|
814
823
|
return this.options.renderMode === 'html';
|
|
815
824
|
}
|
|
816
|
-
renderTemplate(name, data = {}, modeOption
|
|
825
|
+
renderTemplate(name, data = {}, modeOption) {
|
|
817
826
|
// Need to make this fall back to form if renderMode is not found similar to how we search templates.
|
|
818
827
|
const mode = modeOption || this.options.renderMode || 'form';
|
|
819
828
|
data.component = this.component;
|
|
@@ -853,12 +862,11 @@ export default class Component extends Element {
|
|
|
853
862
|
}
|
|
854
863
|
/**
|
|
855
864
|
* Sanitize an html string.
|
|
856
|
-
*
|
|
857
|
-
* @param
|
|
858
|
-
* @
|
|
859
|
-
* @returns {*} - The sanitized html string.
|
|
865
|
+
*
|
|
866
|
+
* @param string
|
|
867
|
+
* @returns {*}
|
|
860
868
|
*/
|
|
861
|
-
sanitize(dirty, forceSanitize
|
|
869
|
+
sanitize(dirty, forceSanitize, options) {
|
|
862
870
|
if (!this.shouldSanitizeValue && !forceSanitize) {
|
|
863
871
|
return dirty;
|
|
864
872
|
}
|
|
@@ -868,9 +876,12 @@ export default class Component extends Element {
|
|
|
868
876
|
}
|
|
869
877
|
/**
|
|
870
878
|
* Render a template string into html.
|
|
871
|
-
*
|
|
872
|
-
* @param
|
|
873
|
-
* @
|
|
879
|
+
*
|
|
880
|
+
* @param template
|
|
881
|
+
* @param data
|
|
882
|
+
* @param actions
|
|
883
|
+
*
|
|
884
|
+
* @return {HTMLElement|String} - The created element or an empty string if template is not specified.
|
|
874
885
|
*/
|
|
875
886
|
renderString(template, data) {
|
|
876
887
|
if (!template) {
|
|
@@ -879,18 +890,9 @@ export default class Component extends Element {
|
|
|
879
890
|
// Interpolate the template and populate
|
|
880
891
|
return this.interpolate(template, data);
|
|
881
892
|
}
|
|
882
|
-
/**
|
|
883
|
-
* Allows for modification of the component value prior to submission.
|
|
884
|
-
* @param {*} input - The input to be modified.
|
|
885
|
-
* @returns {*} - The modified input mapping for the extended component.
|
|
886
|
-
*/
|
|
887
893
|
performInputMapping(input) {
|
|
888
894
|
return input;
|
|
889
895
|
}
|
|
890
|
-
/**
|
|
891
|
-
* Returns the component "widget" if one is available.
|
|
892
|
-
* @returns {Widget|null} - The widget instance. null if not available.
|
|
893
|
-
*/
|
|
894
896
|
get widget() {
|
|
895
897
|
const settings = this.component.widget;
|
|
896
898
|
if (settings && this.root?.shadowRoot) {
|
|
@@ -899,10 +901,6 @@ export default class Component extends Element {
|
|
|
899
901
|
const widget = settings && Widgets[settings.type] ? new Widgets[settings.type](settings, this.component, this) : null;
|
|
900
902
|
return widget;
|
|
901
903
|
}
|
|
902
|
-
/**
|
|
903
|
-
* Returns the native supported browser language.
|
|
904
|
-
* @returns {string|null} - The native browser language that is supported.
|
|
905
|
-
*/
|
|
906
904
|
getBrowserLanguage() {
|
|
907
905
|
const nav = window.navigator;
|
|
908
906
|
const browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'];
|
|
@@ -926,46 +924,38 @@ export default class Component extends Element {
|
|
|
926
924
|
return null;
|
|
927
925
|
}
|
|
928
926
|
/**
|
|
929
|
-
* Called before a next and previous page is triggered allowing the components
|
|
930
|
-
*
|
|
927
|
+
* Called before a next and previous page is triggered allowing the components
|
|
928
|
+
* to perform special functions.
|
|
929
|
+
*
|
|
930
|
+
* @return {*}
|
|
931
931
|
*/
|
|
932
932
|
beforePage() {
|
|
933
933
|
return Promise.resolve(true);
|
|
934
934
|
}
|
|
935
|
-
/**
|
|
936
|
-
* Called before the next page is triggered allowing the components to hook into the page navigation and perform tasks.
|
|
937
|
-
* @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next page navigation.
|
|
938
|
-
*/
|
|
939
935
|
beforeNext() {
|
|
940
936
|
return this.beforePage(true);
|
|
941
937
|
}
|
|
942
938
|
/**
|
|
943
|
-
* Called before a submission is triggered allowing the components
|
|
944
|
-
*
|
|
939
|
+
* Called before a submission is triggered allowing the components
|
|
940
|
+
* to perform special async functions.
|
|
941
|
+
*
|
|
942
|
+
* @return {*}
|
|
945
943
|
*/
|
|
946
944
|
beforeSubmit() {
|
|
947
945
|
return Promise.resolve(true);
|
|
948
946
|
}
|
|
949
947
|
/**
|
|
950
948
|
* Return the submission timezone.
|
|
951
|
-
*
|
|
949
|
+
*
|
|
950
|
+
* @return {*}
|
|
952
951
|
*/
|
|
953
952
|
get submissionTimezone() {
|
|
954
953
|
this.options.submissionTimezone = this.options.submissionTimezone || _.get(this.root, 'options.submissionTimezone');
|
|
955
954
|
return this.options.submissionTimezone;
|
|
956
955
|
}
|
|
957
|
-
/**
|
|
958
|
-
* Return the current timezone.
|
|
959
|
-
* @returns {string} - The current timezone.
|
|
960
|
-
*/
|
|
961
956
|
get timezone() {
|
|
962
957
|
return this.getTimezone(this.component);
|
|
963
958
|
}
|
|
964
|
-
/**
|
|
965
|
-
* Return the current timezone.
|
|
966
|
-
* @param {object} settings - Settings to control how the timezone should be returned.
|
|
967
|
-
* @returns {string} - The current timezone.
|
|
968
|
-
*/
|
|
969
959
|
getTimezone(settings) {
|
|
970
960
|
if (settings.timezone) {
|
|
971
961
|
return settings.timezone;
|
|
@@ -989,9 +979,6 @@ export default class Component extends Element {
|
|
|
989
979
|
* @param {string} [referenceAttributeName] - The attribute name to use for the reference.
|
|
990
980
|
*/
|
|
991
981
|
loadRefs(element, refs, referenceAttributeName) {
|
|
992
|
-
if (!element) {
|
|
993
|
-
return;
|
|
994
|
-
}
|
|
995
982
|
for (const ref in refs) {
|
|
996
983
|
const refType = refs[ref];
|
|
997
984
|
const isString = typeof refType === 'string';
|
|
@@ -1006,17 +993,9 @@ export default class Component extends Element {
|
|
|
1006
993
|
}
|
|
1007
994
|
}
|
|
1008
995
|
}
|
|
1009
|
-
|
|
1010
|
-
* Opens the modal element.
|
|
1011
|
-
* @param {string} template - The template to use for the modal dialog.
|
|
1012
|
-
*/
|
|
1013
|
-
setOpenModalElement(template = null) {
|
|
996
|
+
setOpenModalElement(template) {
|
|
1014
997
|
this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
|
|
1015
998
|
}
|
|
1016
|
-
/**
|
|
1017
|
-
* Returns the modal preview template.
|
|
1018
|
-
* @returns {string} - The modal preview template.
|
|
1019
|
-
*/
|
|
1020
999
|
getModalPreviewTemplate() {
|
|
1021
1000
|
const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
|
|
1022
1001
|
let modalLabel;
|
|
@@ -1029,11 +1008,6 @@ export default class Component extends Element {
|
|
|
1029
1008
|
labelInfo: modalLabel,
|
|
1030
1009
|
});
|
|
1031
1010
|
}
|
|
1032
|
-
/**
|
|
1033
|
-
* Performs a complete build of a component, which empties, renders, sets the content in the DOM, and then finally attaches events.
|
|
1034
|
-
* @param {HTMLElement} element - The element to attach this component to.
|
|
1035
|
-
* @returns {Promise<void>} - A promise that resolves when the component has been built.
|
|
1036
|
-
*/
|
|
1037
1011
|
build(element) {
|
|
1038
1012
|
element = element || this.element;
|
|
1039
1013
|
this.empty(element);
|
|
@@ -1043,12 +1017,6 @@ export default class Component extends Element {
|
|
|
1043
1017
|
get hasModalSaveButton() {
|
|
1044
1018
|
return true;
|
|
1045
1019
|
}
|
|
1046
|
-
/**
|
|
1047
|
-
* Renders a component as an HTML string.
|
|
1048
|
-
* @param {string} children - The contents of all the children HTML as a string.
|
|
1049
|
-
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
|
1050
|
-
* @returns {string} - The rendered HTML string of a component.
|
|
1051
|
-
*/
|
|
1052
1020
|
render(children = `Unknown component: ${this.component.type}`, topLevel = false) {
|
|
1053
1021
|
const isVisible = this.visible;
|
|
1054
1022
|
this.rendered = true;
|
|
@@ -1072,11 +1040,6 @@ export default class Component extends Element {
|
|
|
1072
1040
|
}, topLevel);
|
|
1073
1041
|
}
|
|
1074
1042
|
}
|
|
1075
|
-
/**
|
|
1076
|
-
* Attaches all the tooltips provided the refs object.
|
|
1077
|
-
* @param {object} toolTipsRefs - The refs for the tooltips within your template.
|
|
1078
|
-
* @returns {void}
|
|
1079
|
-
*/
|
|
1080
1043
|
attachTooltips(toolTipsRefs) {
|
|
1081
1044
|
toolTipsRefs?.forEach((tooltip, index) => {
|
|
1082
1045
|
if (tooltip) {
|
|
@@ -1095,21 +1058,9 @@ export default class Component extends Element {
|
|
|
1095
1058
|
}
|
|
1096
1059
|
});
|
|
1097
1060
|
}
|
|
1098
|
-
/**
|
|
1099
|
-
* Create a new component modal for this component.
|
|
1100
|
-
* @param {HTMLElement} element - The element to attach the modal to.
|
|
1101
|
-
* @param {boolean} modalShouldBeOpened - TRUE if the modal should open immediately.
|
|
1102
|
-
* @param {any} currentValue - The current value of the component.
|
|
1103
|
-
* @returns {ComponentModal} - The created component modal.
|
|
1104
|
-
*/
|
|
1105
1061
|
createComponentModal(element, modalShouldBeOpened, currentValue) {
|
|
1106
1062
|
return new ComponentModal(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
|
|
1107
1063
|
}
|
|
1108
|
-
/**
|
|
1109
|
-
* Attaches all event listensers for this component to the DOM elements that were rendered.
|
|
1110
|
-
* @param {HTMLElement} element - The element to attach the listeners to.
|
|
1111
|
-
* @returns {Promise<void>} - Resolves when the component is done attaching to the DOM.
|
|
1112
|
-
*/
|
|
1113
1064
|
attach(element) {
|
|
1114
1065
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
1115
1066
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
@@ -1147,9 +1098,6 @@ export default class Component extends Element {
|
|
|
1147
1098
|
this.addons.forEach((addon) => addon.attach(element));
|
|
1148
1099
|
return Promise.resolve();
|
|
1149
1100
|
}
|
|
1150
|
-
/**
|
|
1151
|
-
* Restors the "focus" on a component after a redraw event has occured.
|
|
1152
|
-
*/
|
|
1153
1101
|
restoreFocus() {
|
|
1154
1102
|
const isFocused = this.root?.focusedComponent?.path === this.path;
|
|
1155
1103
|
if (isFocused) {
|
|
@@ -1158,12 +1106,6 @@ export default class Component extends Element {
|
|
|
1158
1106
|
this.restoreCaretPosition();
|
|
1159
1107
|
}
|
|
1160
1108
|
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Adds a keyboard shortcut to this component.
|
|
1163
|
-
* @param {HTMLElement} element - The element to attach the keyboard shortcut to.
|
|
1164
|
-
* @param {string} shortcut - The keyboard shortcut to add.
|
|
1165
|
-
* @returns {void}
|
|
1166
|
-
*/
|
|
1167
1109
|
addShortcut(element, shortcut) {
|
|
1168
1110
|
// Avoid infinite recursion.
|
|
1169
1111
|
if (!element || !this.root || (this.root === this)) {
|
|
@@ -1174,12 +1116,6 @@ export default class Component extends Element {
|
|
|
1174
1116
|
}
|
|
1175
1117
|
this.root.addShortcut(element, shortcut);
|
|
1176
1118
|
}
|
|
1177
|
-
/**
|
|
1178
|
-
* Removes a keyboard shortcut from this component.
|
|
1179
|
-
* @param {HTMLElement} element - The element to remove the keyboard shortcut from.
|
|
1180
|
-
* @param {string} shortcut - The keyboard shortcut to remove.
|
|
1181
|
-
* @returns {void}
|
|
1182
|
-
*/
|
|
1183
1119
|
removeShortcut(element, shortcut) {
|
|
1184
1120
|
// Avoid infinite recursion.
|
|
1185
1121
|
if (!element || (this.root === this)) {
|
|
@@ -1212,13 +1148,6 @@ export default class Component extends Element {
|
|
|
1212
1148
|
this.tooltip.destroy();
|
|
1213
1149
|
}
|
|
1214
1150
|
}
|
|
1215
|
-
/**
|
|
1216
|
-
* Determines if the component should be refreshed based on the path of another component that changed.
|
|
1217
|
-
* @param {string} refreshData - The path of the data that needs to trigger a refresh.
|
|
1218
|
-
* @param {boolean} changed - Flag that is true if the data has been changed.
|
|
1219
|
-
* @param {any} flags - The flags for the checkData procedure.
|
|
1220
|
-
* @returns {void}
|
|
1221
|
-
*/
|
|
1222
1151
|
checkRefresh(refreshData, changed, flags) {
|
|
1223
1152
|
const changePath = _.get(changed, 'instance.path', false);
|
|
1224
1153
|
// Don't let components change themselves.
|
|
@@ -1235,12 +1164,6 @@ export default class Component extends Element {
|
|
|
1235
1164
|
this.refresh(changed.value, changed, flags);
|
|
1236
1165
|
}
|
|
1237
1166
|
}
|
|
1238
|
-
/**
|
|
1239
|
-
* Iterates over a list of changes, and determines if the component should be refreshed if it is configured to refresh on any of those components.
|
|
1240
|
-
* @param {Array<any>} changes - The list of components that have changed.
|
|
1241
|
-
* @param {any} flags - The checkData flags.
|
|
1242
|
-
* @returns {void}
|
|
1243
|
-
*/
|
|
1244
1167
|
checkRefreshOn(changes, flags = {}) {
|
|
1245
1168
|
changes = changes || [];
|
|
1246
1169
|
if (flags.noRefresh) {
|
|
@@ -1262,8 +1185,8 @@ export default class Component extends Element {
|
|
|
1262
1185
|
}
|
|
1263
1186
|
/**
|
|
1264
1187
|
* Refreshes the component with a new value.
|
|
1265
|
-
*
|
|
1266
|
-
* @
|
|
1188
|
+
*
|
|
1189
|
+
* @param value
|
|
1267
1190
|
*/
|
|
1268
1191
|
refresh(value) {
|
|
1269
1192
|
if (this.hasOwnProperty('refreshOnValue')) {
|
|
@@ -1286,8 +1209,8 @@ export default class Component extends Element {
|
|
|
1286
1209
|
* with the components data and returns true if they are in the same context.
|
|
1287
1210
|
*
|
|
1288
1211
|
* Different rows of the same EditGrid, for example, are in different contexts.
|
|
1289
|
-
*
|
|
1290
|
-
* @
|
|
1212
|
+
*
|
|
1213
|
+
* @param component
|
|
1291
1214
|
*/
|
|
1292
1215
|
inContext(component) {
|
|
1293
1216
|
if (component.data === this.data) {
|
|
@@ -1302,18 +1225,9 @@ export default class Component extends Element {
|
|
|
1302
1225
|
}
|
|
1303
1226
|
return false;
|
|
1304
1227
|
}
|
|
1305
|
-
/**
|
|
1306
|
-
* Determines if we are in "view" only mode.
|
|
1307
|
-
* @returns {boolean} - TRUE if we are in "view" only mode.
|
|
1308
|
-
*/
|
|
1309
1228
|
get viewOnly() {
|
|
1310
1229
|
return this.options.readOnly && this.options.viewAsHtml;
|
|
1311
1230
|
}
|
|
1312
|
-
/**
|
|
1313
|
-
* Sets the HTMLElement for this component.
|
|
1314
|
-
* @param {HTMLElement} element - The element that is attached to this component.
|
|
1315
|
-
* @returns {void}
|
|
1316
|
-
*/
|
|
1317
1231
|
setElement(element) {
|
|
1318
1232
|
if (this.element) {
|
|
1319
1233
|
delete this.element.component;
|
|
@@ -1321,10 +1235,6 @@ export default class Component extends Element {
|
|
|
1321
1235
|
}
|
|
1322
1236
|
this.element = element;
|
|
1323
1237
|
}
|
|
1324
|
-
/**
|
|
1325
|
-
* Creates an element to hold the "view only" version of this component.
|
|
1326
|
-
* @returns {HTMLElement} - The element for this component.
|
|
1327
|
-
*/
|
|
1328
1238
|
createViewOnlyElement() {
|
|
1329
1239
|
this.setElement(this.ce('dl', {
|
|
1330
1240
|
id: this.id
|
|
@@ -1335,18 +1245,14 @@ export default class Component extends Element {
|
|
|
1335
1245
|
}
|
|
1336
1246
|
return this.element;
|
|
1337
1247
|
}
|
|
1338
|
-
/**
|
|
1339
|
-
* The default value for the "view only" mode of a component if the value is not provided.
|
|
1340
|
-
* @returns {string} - The default value for this component.
|
|
1341
|
-
*/
|
|
1342
1248
|
get defaultViewOnlyValue() {
|
|
1343
1249
|
return '-';
|
|
1344
1250
|
}
|
|
1345
1251
|
/**
|
|
1346
1252
|
* Uses the widget to determine the output string.
|
|
1347
|
-
*
|
|
1348
|
-
* @param
|
|
1349
|
-
* @
|
|
1253
|
+
*
|
|
1254
|
+
* @param value
|
|
1255
|
+
* @return {*}
|
|
1350
1256
|
*/
|
|
1351
1257
|
getWidgetValueAsString(value, options) {
|
|
1352
1258
|
const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
|
|
@@ -1371,12 +1277,6 @@ export default class Component extends Element {
|
|
|
1371
1277
|
const widget = this.refs.input[0].widget;
|
|
1372
1278
|
return widget.getValueAsString(value, options);
|
|
1373
1279
|
}
|
|
1374
|
-
/**
|
|
1375
|
-
* Returns the value of the component as a string.
|
|
1376
|
-
* @param {any} value - The value for this component.
|
|
1377
|
-
* @param {any} options - The options for this component.
|
|
1378
|
-
* @returns {string} - The string representation of the value of this component.
|
|
1379
|
-
*/
|
|
1380
1280
|
getValueAsString(value, options) {
|
|
1381
1281
|
if (!value) {
|
|
1382
1282
|
return '';
|
|
@@ -1394,32 +1294,20 @@ export default class Component extends Element {
|
|
|
1394
1294
|
const stringValue = value.toString();
|
|
1395
1295
|
return this.sanitize(stringValue);
|
|
1396
1296
|
}
|
|
1397
|
-
/**
|
|
1398
|
-
* Returns the string representation "view" of the component value.
|
|
1399
|
-
* @param {any} value - The value of the component.
|
|
1400
|
-
* @param {any} options - The options for this component.
|
|
1401
|
-
* @returns {string} - The string representation of the value of this component.
|
|
1402
|
-
*/
|
|
1403
1297
|
getView(value, options) {
|
|
1404
1298
|
if (this.component.protected) {
|
|
1405
1299
|
return '--- PROTECTED ---';
|
|
1406
1300
|
}
|
|
1407
1301
|
return this.getValueAsString(value, options);
|
|
1408
1302
|
}
|
|
1409
|
-
/**
|
|
1410
|
-
* Updates the items list for this component. Useful for Select and other List component types.
|
|
1411
|
-
* @param {...any} args - The arguments to pass to the onChange event.
|
|
1412
|
-
* @returns {void}
|
|
1413
|
-
*/
|
|
1414
1303
|
updateItems(...args) {
|
|
1415
1304
|
this.restoreValue();
|
|
1416
1305
|
this.onChange(...args);
|
|
1417
1306
|
}
|
|
1418
1307
|
/**
|
|
1419
|
-
*
|
|
1420
|
-
* @param {
|
|
1421
|
-
* @
|
|
1422
|
-
* @returns {any} - The value of the item.
|
|
1308
|
+
* @param {*} data
|
|
1309
|
+
* @param {boolean} [forceUseValue=false] - if true, return 'value' property of the data
|
|
1310
|
+
* @return {*}
|
|
1423
1311
|
*/
|
|
1424
1312
|
itemValue(data, forceUseValue = false) {
|
|
1425
1313
|
if (_.isObject(data) && !_.isArray(data)) {
|
|
@@ -1432,11 +1320,6 @@ export default class Component extends Element {
|
|
|
1432
1320
|
}
|
|
1433
1321
|
return data;
|
|
1434
1322
|
}
|
|
1435
|
-
/**
|
|
1436
|
-
* Returns the item value for html mode.
|
|
1437
|
-
* @param {any} value - The value for this component.
|
|
1438
|
-
* @returns {any} - The value of the item for html mode.
|
|
1439
|
-
*/
|
|
1440
1323
|
itemValueForHTMLMode(value) {
|
|
1441
1324
|
if (Array.isArray(value)) {
|
|
1442
1325
|
const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
@@ -1444,13 +1327,6 @@ export default class Component extends Element {
|
|
|
1444
1327
|
}
|
|
1445
1328
|
return this.itemValue(value);
|
|
1446
1329
|
}
|
|
1447
|
-
/**
|
|
1448
|
-
* Creates a modal to input the value of this component.
|
|
1449
|
-
* @param {HTMLElement} element - The element to attach the modal to.
|
|
1450
|
-
* @param {any} attr - A list of attributes to add to the modal.
|
|
1451
|
-
* @param {boolean} confirm - If we should add a confirmation to the modal that keeps it from closing unless confirmed.
|
|
1452
|
-
* @returns {HTMLElement} - The created modal element.
|
|
1453
|
-
*/
|
|
1454
1330
|
createModal(element, attr, confirm) {
|
|
1455
1331
|
const dialog = this.ce('div', attr || {});
|
|
1456
1332
|
this.setContent(dialog, this.renderTemplate('dialog'));
|
|
@@ -1486,10 +1362,6 @@ export default class Component extends Element {
|
|
|
1486
1362
|
this.addEventListener(dialog.refs.dialogClose, 'click', handleCloseClick);
|
|
1487
1363
|
return dialog;
|
|
1488
1364
|
}
|
|
1489
|
-
/**
|
|
1490
|
-
* Uses CSS classes to show or hide an element.
|
|
1491
|
-
* @returns {boolean} - TRUE if the element has been css removed.
|
|
1492
|
-
*/
|
|
1493
1365
|
get optimizeRedraw() {
|
|
1494
1366
|
if (this.options.optimizeRedraw && this.element && !this.visible) {
|
|
1495
1367
|
this.addClass(this.element, 'formio-removed');
|
|
@@ -1527,7 +1399,7 @@ export default class Component extends Element {
|
|
|
1527
1399
|
}
|
|
1528
1400
|
/**
|
|
1529
1401
|
* Build the custom style from the layout values
|
|
1530
|
-
* @
|
|
1402
|
+
* @return {string} - The custom style
|
|
1531
1403
|
*/
|
|
1532
1404
|
get customStyle() {
|
|
1533
1405
|
let customCSS = '';
|
|
@@ -1538,31 +1410,24 @@ export default class Component extends Element {
|
|
|
1538
1410
|
});
|
|
1539
1411
|
return customCSS;
|
|
1540
1412
|
}
|
|
1541
|
-
/**
|
|
1542
|
-
* Returns the component condition operator settings if available.
|
|
1543
|
-
* @returns {object} - The component condition operator settings.
|
|
1544
|
-
*/
|
|
1545
1413
|
static get serverConditionSettings() {
|
|
1546
1414
|
return Component.conditionOperatorsSettings;
|
|
1547
1415
|
}
|
|
1548
|
-
/**
|
|
1549
|
-
* Returns if the application is on a mobile device.
|
|
1550
|
-
* @returns {boolean} - TRUE if the application is on a mobile device.
|
|
1551
|
-
*/
|
|
1552
1416
|
get isMobile() {
|
|
1553
1417
|
return isMobile();
|
|
1554
1418
|
}
|
|
1555
1419
|
/**
|
|
1556
1420
|
* Returns the outside wrapping element of this component.
|
|
1557
|
-
* @returns {HTMLElement}
|
|
1421
|
+
* @returns {HTMLElement}
|
|
1558
1422
|
*/
|
|
1559
1423
|
getElement() {
|
|
1560
1424
|
return this.element;
|
|
1561
1425
|
}
|
|
1562
1426
|
/**
|
|
1563
1427
|
* Create an evaluation context for all script executions and interpolations.
|
|
1564
|
-
*
|
|
1565
|
-
* @
|
|
1428
|
+
*
|
|
1429
|
+
* @param additional
|
|
1430
|
+
* @return {*}
|
|
1566
1431
|
*/
|
|
1567
1432
|
evalContext(additional) {
|
|
1568
1433
|
return super.evalContext(Object.assign({
|
|
@@ -1584,29 +1449,18 @@ export default class Component extends Element {
|
|
|
1584
1449
|
}
|
|
1585
1450
|
/**
|
|
1586
1451
|
* Sets the pristine flag for this component.
|
|
1587
|
-
*
|
|
1452
|
+
*
|
|
1453
|
+
* @param pristine {boolean} - TRUE to make pristine, FALSE not pristine.
|
|
1588
1454
|
*/
|
|
1589
1455
|
setPristine(pristine) {
|
|
1590
1456
|
this.pristine = pristine;
|
|
1591
1457
|
}
|
|
1592
|
-
/**
|
|
1593
|
-
* Returns if the component is pristine.
|
|
1594
|
-
* @returns {boolean} - TRUE if the component is pristine.
|
|
1595
|
-
*/
|
|
1596
1458
|
get isPristine() {
|
|
1597
1459
|
return this.pristine;
|
|
1598
1460
|
}
|
|
1599
|
-
/**
|
|
1600
|
-
* Sets the dirty flag for this component.
|
|
1601
|
-
* @param {boolean} dirty - TRUE to make dirty, FALSE not dirty.
|
|
1602
|
-
*/
|
|
1603
1461
|
setDirty(dirty) {
|
|
1604
1462
|
this.dirty = dirty;
|
|
1605
1463
|
}
|
|
1606
|
-
/**
|
|
1607
|
-
* Returns if the component is dirty.
|
|
1608
|
-
* @returns {boolean} - TRUE if the component is dirty.
|
|
1609
|
-
*/
|
|
1610
1464
|
get isDirty() {
|
|
1611
1465
|
return this.dirty;
|
|
1612
1466
|
}
|
|
@@ -1620,23 +1474,12 @@ export default class Component extends Element {
|
|
|
1620
1474
|
this.restoreValue();
|
|
1621
1475
|
this.triggerRootChange();
|
|
1622
1476
|
}
|
|
1623
|
-
/**
|
|
1624
|
-
* Returns the icon class for a given icon name.
|
|
1625
|
-
* @param {string} name - The name of the icon you wish to fetch provided the icon class. This is the "font awesome" version of the name of the icon.
|
|
1626
|
-
* @param {boolean} spinning - If the component should be spinning.
|
|
1627
|
-
* @returns {string} - The icon class for the equivalent icon in the iconset we are using.
|
|
1628
|
-
*/
|
|
1629
1477
|
iconClass(name, spinning) {
|
|
1630
1478
|
const iconset = this.options.iconset || Templates.current.defaultIconset || 'fa';
|
|
1631
1479
|
return Templates.current.hasOwnProperty('iconClass')
|
|
1632
1480
|
? Templates.current.iconClass(iconset, name, spinning)
|
|
1633
1481
|
: this.options.iconset === 'fa' ? Templates.defaultTemplates.iconClass(iconset, name, spinning) : name;
|
|
1634
1482
|
}
|
|
1635
|
-
/**
|
|
1636
|
-
* Returns the size css class names for our current template.
|
|
1637
|
-
* @param {string} size - The size class name for the default iconset.
|
|
1638
|
-
* @returns {string} - The size class for our component.
|
|
1639
|
-
*/
|
|
1640
1483
|
size(size) {
|
|
1641
1484
|
return Templates.current.hasOwnProperty('size')
|
|
1642
1485
|
? Templates.current.size(size)
|
|
@@ -1649,23 +1492,15 @@ export default class Component extends Element {
|
|
|
1649
1492
|
get name() {
|
|
1650
1493
|
return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
|
|
1651
1494
|
}
|
|
1652
|
-
/**
|
|
1653
|
-
* Returns the visible errors for this component.
|
|
1654
|
-
* @returns {Array<object>} - The visible errors for this component.
|
|
1655
|
-
*/
|
|
1656
1495
|
get visibleErrors() {
|
|
1657
1496
|
return this._visibleErrors;
|
|
1658
1497
|
}
|
|
1659
|
-
/**
|
|
1660
|
-
* Returns all the errors for this component, visible or not.
|
|
1661
|
-
* @returns {Array<object>} - All the errors for this component.
|
|
1662
|
-
*/
|
|
1663
1498
|
get errors() {
|
|
1664
1499
|
return this._errors;
|
|
1665
1500
|
}
|
|
1666
1501
|
/**
|
|
1667
1502
|
* Returns the error label for this component.
|
|
1668
|
-
* @
|
|
1503
|
+
* @return {*}
|
|
1669
1504
|
*/
|
|
1670
1505
|
get errorLabel() {
|
|
1671
1506
|
return this.t(this.component.errorLabel
|
|
@@ -1675,20 +1510,12 @@ export default class Component extends Element {
|
|
|
1675
1510
|
}
|
|
1676
1511
|
/**
|
|
1677
1512
|
* Get the error message provided a certain type of error.
|
|
1678
|
-
* @param
|
|
1679
|
-
* @
|
|
1513
|
+
* @param type
|
|
1514
|
+
* @return {*}
|
|
1680
1515
|
*/
|
|
1681
1516
|
errorMessage(type) {
|
|
1682
1517
|
return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
|
|
1683
1518
|
}
|
|
1684
|
-
/**
|
|
1685
|
-
* Sets the content, innerHTML, of an element to the sanitized content.
|
|
1686
|
-
* @param {HTMLElement} element - The element to set the innerHTML to.
|
|
1687
|
-
* @param {string} content - The HTML string content that we wish to set.
|
|
1688
|
-
* @param {boolean} forceSanitize - If we should force the content to be sanitized.
|
|
1689
|
-
* @param {any} sanitizeOptions - The options for the sanitize function.
|
|
1690
|
-
* @returns {boolean} - TRUE if the content was sanitized and set.
|
|
1691
|
-
*/
|
|
1692
1519
|
setContent(element, content, forceSanitize, sanitizeOptions) {
|
|
1693
1520
|
if (element instanceof HTMLElement) {
|
|
1694
1521
|
element.innerHTML = this.sanitize(content, forceSanitize, sanitizeOptions);
|
|
@@ -1696,9 +1523,6 @@ export default class Component extends Element {
|
|
|
1696
1523
|
}
|
|
1697
1524
|
return false;
|
|
1698
1525
|
}
|
|
1699
|
-
/**
|
|
1700
|
-
* Restores the caret position in the input element after a refresh occurs.
|
|
1701
|
-
*/
|
|
1702
1526
|
restoreCaretPosition() {
|
|
1703
1527
|
if (this.root?.currentSelection) {
|
|
1704
1528
|
if (this.refs.input?.length) {
|
|
@@ -1720,10 +1544,6 @@ export default class Component extends Element {
|
|
|
1720
1544
|
}
|
|
1721
1545
|
}
|
|
1722
1546
|
}
|
|
1723
|
-
/**
|
|
1724
|
-
* Redraw the component.
|
|
1725
|
-
* @returns {Promise<void>} - A promise that resolves when the component is done redrawing.
|
|
1726
|
-
*/
|
|
1727
1547
|
redraw() {
|
|
1728
1548
|
// Don't bother if we have not built yet.
|
|
1729
1549
|
if (!this.element || !this.element.parentNode || this.optimizeRedraw) {
|
|
@@ -1739,54 +1559,29 @@ export default class Component extends Element {
|
|
|
1739
1559
|
this.setElement(parent.children[index]);
|
|
1740
1560
|
return this.attach(this.element);
|
|
1741
1561
|
}
|
|
1742
|
-
/**
|
|
1743
|
-
* Rebuild and redraw a component.
|
|
1744
|
-
* @returns {Promise<void>} - A promise that resolves when the component is done rebuilding and redrawing.
|
|
1745
|
-
*/
|
|
1746
1562
|
rebuild() {
|
|
1747
1563
|
this.destroy();
|
|
1748
1564
|
this.init();
|
|
1749
1565
|
this.visible = this.conditionallyVisible(null, null);
|
|
1750
1566
|
return this.redraw();
|
|
1751
1567
|
}
|
|
1752
|
-
/**
|
|
1753
|
-
* Removes all event listeners attached to this component.
|
|
1754
|
-
*/
|
|
1755
1568
|
removeEventListeners() {
|
|
1756
1569
|
super.removeEventListeners();
|
|
1757
1570
|
this.tooltips.forEach(tooltip => tooltip.destroy());
|
|
1758
1571
|
this.tooltips = [];
|
|
1759
1572
|
}
|
|
1760
|
-
/**
|
|
1761
|
-
* Returns if the dom node has the classes provided.
|
|
1762
|
-
* @param {HTMLElement} element - The element to check for the class.
|
|
1763
|
-
* @param {string} className - The name of the class to check.
|
|
1764
|
-
* @returns {boolean|void} - TRUE if the element has the class.
|
|
1765
|
-
*/
|
|
1766
1573
|
hasClass(element, className) {
|
|
1767
1574
|
if (!element) {
|
|
1768
1575
|
return;
|
|
1769
1576
|
}
|
|
1770
1577
|
return super.hasClass(element, this.transform('class', className));
|
|
1771
1578
|
}
|
|
1772
|
-
/**
|
|
1773
|
-
* Adds a class to an HTML element.
|
|
1774
|
-
* @param {HTMLElement} element - The dom element to add the class to.
|
|
1775
|
-
* @param {string} className - The class name you wish to add.
|
|
1776
|
-
* @returns {this|void} - The component instance.
|
|
1777
|
-
*/
|
|
1778
1579
|
addClass(element, className) {
|
|
1779
1580
|
if (!element) {
|
|
1780
1581
|
return;
|
|
1781
1582
|
}
|
|
1782
1583
|
return super.addClass(element, this.transform('class', className));
|
|
1783
1584
|
}
|
|
1784
|
-
/**
|
|
1785
|
-
* Removes a class from an element.
|
|
1786
|
-
* @param {HTMLElement} element - The element to remove the class from.
|
|
1787
|
-
* @param {string} className - The class name to remove.
|
|
1788
|
-
* @returns {this|void} - The component instance.
|
|
1789
|
-
*/
|
|
1790
1585
|
removeClass(element, className) {
|
|
1791
1586
|
if (!element) {
|
|
1792
1587
|
return;
|
|
@@ -1795,7 +1590,8 @@ export default class Component extends Element {
|
|
|
1795
1590
|
}
|
|
1796
1591
|
/**
|
|
1797
1592
|
* Determines if this component has a condition defined.
|
|
1798
|
-
*
|
|
1593
|
+
*
|
|
1594
|
+
* @return {null}
|
|
1799
1595
|
*/
|
|
1800
1596
|
hasCondition() {
|
|
1801
1597
|
if (this._hasCondition !== null) {
|
|
@@ -1806,9 +1602,9 @@ export default class Component extends Element {
|
|
|
1806
1602
|
}
|
|
1807
1603
|
/**
|
|
1808
1604
|
* Check if this component is conditionally visible.
|
|
1809
|
-
*
|
|
1810
|
-
* @param
|
|
1811
|
-
* @
|
|
1605
|
+
*
|
|
1606
|
+
* @param data
|
|
1607
|
+
* @return {boolean}
|
|
1812
1608
|
*/
|
|
1813
1609
|
conditionallyVisible(data, row) {
|
|
1814
1610
|
data = data || this.rootValue;
|
|
@@ -1823,19 +1619,16 @@ export default class Component extends Element {
|
|
|
1823
1619
|
* Checks the condition of this component.
|
|
1824
1620
|
*
|
|
1825
1621
|
* TODO: Switch row and data parameters to be consistent with other methods.
|
|
1826
|
-
*
|
|
1827
|
-
* @param
|
|
1828
|
-
* @
|
|
1622
|
+
*
|
|
1623
|
+
* @param row - The row contextual data.
|
|
1624
|
+
* @param data - The global data object.
|
|
1625
|
+
* @return {boolean} - True if the condition applies to this component.
|
|
1829
1626
|
*/
|
|
1830
1627
|
checkCondition(row, data) {
|
|
1831
1628
|
return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
|
|
1832
1629
|
}
|
|
1833
1630
|
/**
|
|
1834
1631
|
* Check for conditionals and hide/show the element based on those conditions.
|
|
1835
|
-
* @param {any} data - The data to check against.
|
|
1836
|
-
* @param {any} flags - The flags passed to checkData function.
|
|
1837
|
-
* @param {any} row - The row data to check against.
|
|
1838
|
-
* @returns {boolean} - TRUE if the component is visible.
|
|
1839
1632
|
*/
|
|
1840
1633
|
checkComponentConditions(data, flags, row) {
|
|
1841
1634
|
data = data || this.rootValue;
|
|
@@ -1853,10 +1646,8 @@ export default class Component extends Element {
|
|
|
1853
1646
|
}
|
|
1854
1647
|
/**
|
|
1855
1648
|
* Checks conditions for this component and any sub components.
|
|
1856
|
-
* @param
|
|
1857
|
-
* @
|
|
1858
|
-
* @param {any} row - The row data to check against.
|
|
1859
|
-
* @returns {boolean} - TRUE if the component is visible.
|
|
1649
|
+
* @param args
|
|
1650
|
+
* @return {boolean}
|
|
1860
1651
|
*/
|
|
1861
1652
|
checkConditions(data, flags, row) {
|
|
1862
1653
|
data = data || this.rootValue;
|
|
@@ -1864,20 +1655,17 @@ export default class Component extends Element {
|
|
|
1864
1655
|
row = row || this.data;
|
|
1865
1656
|
return this.checkComponentConditions(data, flags, row);
|
|
1866
1657
|
}
|
|
1867
|
-
/**
|
|
1868
|
-
* Returns the component logic if applicable.
|
|
1869
|
-
* @returns {Array<object>} - The component logic.
|
|
1870
|
-
*/
|
|
1871
1658
|
get logic() {
|
|
1872
1659
|
return this.component.logic || [];
|
|
1873
1660
|
}
|
|
1874
1661
|
/**
|
|
1875
1662
|
* Check all triggers and apply necessary actions.
|
|
1876
|
-
*
|
|
1877
|
-
* @param
|
|
1878
|
-
* @returns {boolean|void} - TRUE if the component was altered.
|
|
1663
|
+
*
|
|
1664
|
+
* @param data
|
|
1879
1665
|
*/
|
|
1880
|
-
fieldLogic(data
|
|
1666
|
+
fieldLogic(data, row) {
|
|
1667
|
+
data = data || this.rootValue;
|
|
1668
|
+
row = row || this.data;
|
|
1881
1669
|
const logics = this.logic;
|
|
1882
1670
|
// If there aren't logic, don't go further.
|
|
1883
1671
|
if (logics.length === 0) {
|
|
@@ -1900,10 +1688,6 @@ export default class Component extends Element {
|
|
|
1900
1688
|
}
|
|
1901
1689
|
return changed;
|
|
1902
1690
|
}
|
|
1903
|
-
/**
|
|
1904
|
-
* Retuns if the browser is Internet Explorer.
|
|
1905
|
-
* @returns {boolean} - TRUE if the browser is IE.
|
|
1906
|
-
*/
|
|
1907
1691
|
isIE() {
|
|
1908
1692
|
if (typeof window === 'undefined') {
|
|
1909
1693
|
return false;
|
|
@@ -1928,24 +1712,9 @@ export default class Component extends Element {
|
|
|
1928
1712
|
// other browser
|
|
1929
1713
|
return false;
|
|
1930
1714
|
}
|
|
1931
|
-
/**
|
|
1932
|
-
* Defines the logic action value through evaluation.
|
|
1933
|
-
* @param {object} action - The action within the Logic system to perform.
|
|
1934
|
-
* @param {object} argsObject - The arguments to pass to the evaluation.
|
|
1935
|
-
* @returns {any} - The result of the evaluation.
|
|
1936
|
-
*/
|
|
1937
1715
|
defineActionValue(action, argsObject) {
|
|
1938
1716
|
return this.evaluate(action.value, argsObject, 'value');
|
|
1939
1717
|
}
|
|
1940
|
-
/**
|
|
1941
|
-
* Apply the actions of Logic for a component once the conditions have been met.
|
|
1942
|
-
* @param {object} newComponent - The new component to apply the actions to.
|
|
1943
|
-
* @param {Array<object>} actions - An array of actions
|
|
1944
|
-
* @param {any} result - The result of the conditional check in order to evaluate the actions.
|
|
1945
|
-
* @param {any} row - The contextual row data for this component.
|
|
1946
|
-
* @param {any} data - The global data object for the submission.
|
|
1947
|
-
* @returns {boolean} - TRUE if the component was altered.
|
|
1948
|
-
*/
|
|
1949
1718
|
applyActions(newComponent, actions, result, row, data) {
|
|
1950
1719
|
data = data || this.rootValue;
|
|
1951
1720
|
row = row || this.data;
|
|
@@ -2025,8 +1794,8 @@ export default class Component extends Element {
|
|
|
2025
1794
|
}
|
|
2026
1795
|
/**
|
|
2027
1796
|
* Add a new input error to this element.
|
|
2028
|
-
*
|
|
2029
|
-
* @
|
|
1797
|
+
*
|
|
1798
|
+
* @param {{level: string, message: string}[]} messages
|
|
2030
1799
|
*/
|
|
2031
1800
|
addMessages(messages) {
|
|
2032
1801
|
if (!messages) {
|
|
@@ -2052,15 +1821,6 @@ export default class Component extends Element {
|
|
|
2052
1821
|
}).join(''));
|
|
2053
1822
|
}
|
|
2054
1823
|
}
|
|
2055
|
-
/**
|
|
2056
|
-
* Sets the form input widget error classes.
|
|
2057
|
-
* @param {Array<HTMLElement>} elements - An array of DOM elements to set the error classes on.
|
|
2058
|
-
* @param {boolean} dirty - If the input is dirty.
|
|
2059
|
-
* @param {boolean} hasErrors - If the input has errors.
|
|
2060
|
-
* @param {boolean} hasMessages - If the input has messages.
|
|
2061
|
-
* @param {HTMLElement} element - The wrapper element for all the other elements passed in first argument.
|
|
2062
|
-
* @returns {void}
|
|
2063
|
-
*/
|
|
2064
1824
|
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
2065
1825
|
this.clearErrorClasses();
|
|
2066
1826
|
elements.forEach((element) => {
|
|
@@ -2087,12 +1847,6 @@ export default class Component extends Element {
|
|
|
2087
1847
|
this.addClass(element, 'has-message');
|
|
2088
1848
|
}
|
|
2089
1849
|
}
|
|
2090
|
-
/**
|
|
2091
|
-
* Adds the classes necessary to mark an element as invalid.
|
|
2092
|
-
* @param {HTMLElement} element - The element you wish to add the invalid classes to.
|
|
2093
|
-
* @param {boolean} invalid - TRUE if the component is invalid, FALSE otherwise.
|
|
2094
|
-
* @returns {void}
|
|
2095
|
-
*/
|
|
2096
1850
|
setElementInvalid(element, invalid) {
|
|
2097
1851
|
if (!element)
|
|
2098
1852
|
return;
|
|
@@ -2104,9 +1858,6 @@ export default class Component extends Element {
|
|
|
2104
1858
|
}
|
|
2105
1859
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
|
2106
1860
|
}
|
|
2107
|
-
/**
|
|
2108
|
-
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
|
2109
|
-
*/
|
|
2110
1861
|
clearOnHide() {
|
|
2111
1862
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
2112
1863
|
if (
|
|
@@ -2126,10 +1877,6 @@ export default class Component extends Element {
|
|
|
2126
1877
|
}
|
|
2127
1878
|
}
|
|
2128
1879
|
}
|
|
2129
|
-
/**
|
|
2130
|
-
* Triggers a debounced onChange event for the root component (usually Webform).
|
|
2131
|
-
* @param {...any} args - The arguments to pass to the onChange event.
|
|
2132
|
-
*/
|
|
2133
1880
|
triggerRootChange(...args) {
|
|
2134
1881
|
if (this.options.onChange) {
|
|
2135
1882
|
this.options.onChange(...args);
|
|
@@ -2138,13 +1885,6 @@ export default class Component extends Element {
|
|
|
2138
1885
|
this.root.triggerChange(...args);
|
|
2139
1886
|
}
|
|
2140
1887
|
}
|
|
2141
|
-
/**
|
|
2142
|
-
* Called when the component value has been changed. This will then trigger the root level onChange handler which
|
|
2143
|
-
* propagates the checkData methods for the full component tree.
|
|
2144
|
-
* @param {any} flags - The flags for the change event propagation.
|
|
2145
|
-
* @param {boolean} fromRoot - If the change event is from the root component.
|
|
2146
|
-
* @returns {boolean} - TRUE if the component has changed.
|
|
2147
|
-
*/
|
|
2148
1888
|
onChange(flags, fromRoot) {
|
|
2149
1889
|
flags = flags || {};
|
|
2150
1890
|
if (flags.modified) {
|
|
@@ -2280,7 +2020,7 @@ export default class Component extends Element {
|
|
|
2280
2020
|
return Promise.reject();
|
|
2281
2021
|
}
|
|
2282
2022
|
this.quill = new Quill(element, isIEBrowser ? { ...settings, modules: {} } : settings);
|
|
2283
|
-
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ
|
|
2023
|
+
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ **/
|
|
2284
2024
|
const txtArea = document.createElement('textarea');
|
|
2285
2025
|
txtArea.setAttribute('class', 'quill-source-code');
|
|
2286
2026
|
this.quill.addContainer('ql-custom').appendChild(txtArea);
|
|
@@ -2294,7 +2034,7 @@ export default class Component extends Element {
|
|
|
2294
2034
|
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2295
2035
|
});
|
|
2296
2036
|
}
|
|
2297
|
-
/** END CODEBLOCK
|
|
2037
|
+
/** END CODEBLOCK **/
|
|
2298
2038
|
// Make sure to select cursor when they click on the element.
|
|
2299
2039
|
this.addEventListener(element, 'click', () => this.quill.focus());
|
|
2300
2040
|
// Allows users to skip toolbar items when tabbing though form
|
|
@@ -2341,22 +2081,23 @@ export default class Component extends Element {
|
|
|
2341
2081
|
}
|
|
2342
2082
|
/**
|
|
2343
2083
|
* The empty value for this component.
|
|
2344
|
-
*
|
|
2084
|
+
*
|
|
2085
|
+
* @return {null}
|
|
2345
2086
|
*/
|
|
2346
2087
|
get emptyValue() {
|
|
2347
2088
|
return null;
|
|
2348
2089
|
}
|
|
2349
2090
|
/**
|
|
2350
2091
|
* Returns if this component has a value set.
|
|
2351
|
-
*
|
|
2352
|
-
* @returns {boolean} - TRUE if a value is set.
|
|
2092
|
+
*
|
|
2353
2093
|
*/
|
|
2354
2094
|
hasValue(data) {
|
|
2355
2095
|
return !_.isUndefined(_.get(data || this.data, this.key));
|
|
2356
2096
|
}
|
|
2357
2097
|
/**
|
|
2358
2098
|
* Get the data value at the root level.
|
|
2359
|
-
*
|
|
2099
|
+
*
|
|
2100
|
+
* @return {*}
|
|
2360
2101
|
*/
|
|
2361
2102
|
get rootValue() {
|
|
2362
2103
|
return this.root ? this.root.data : this.data;
|
|
@@ -2366,7 +2107,7 @@ export default class Component extends Element {
|
|
|
2366
2107
|
}
|
|
2367
2108
|
/**
|
|
2368
2109
|
* Get the static value of this component.
|
|
2369
|
-
* @
|
|
2110
|
+
* @return {*}
|
|
2370
2111
|
*/
|
|
2371
2112
|
get dataValue() {
|
|
2372
2113
|
if (!this.key ||
|
|
@@ -2384,7 +2125,8 @@ export default class Component extends Element {
|
|
|
2384
2125
|
}
|
|
2385
2126
|
/**
|
|
2386
2127
|
* Sets the static value of this component.
|
|
2387
|
-
*
|
|
2128
|
+
*
|
|
2129
|
+
* @param value
|
|
2388
2130
|
*/
|
|
2389
2131
|
set dataValue(value) {
|
|
2390
2132
|
if (!this.allowData ||
|
|
@@ -2404,8 +2146,8 @@ export default class Component extends Element {
|
|
|
2404
2146
|
}
|
|
2405
2147
|
/**
|
|
2406
2148
|
* Splice a value from the dataValue.
|
|
2407
|
-
*
|
|
2408
|
-
* @param
|
|
2149
|
+
*
|
|
2150
|
+
* @param index
|
|
2409
2151
|
*/
|
|
2410
2152
|
splice(index, flags = {}) {
|
|
2411
2153
|
if (this.hasValue()) {
|
|
@@ -2473,7 +2215,8 @@ export default class Component extends Element {
|
|
|
2473
2215
|
}
|
|
2474
2216
|
/**
|
|
2475
2217
|
* Get the input value of this component.
|
|
2476
|
-
*
|
|
2218
|
+
*
|
|
2219
|
+
* @return {*}
|
|
2477
2220
|
*/
|
|
2478
2221
|
getValue() {
|
|
2479
2222
|
if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
@@ -2495,8 +2238,9 @@ export default class Component extends Element {
|
|
|
2495
2238
|
}
|
|
2496
2239
|
/**
|
|
2497
2240
|
* Get the value at a specific index.
|
|
2498
|
-
*
|
|
2499
|
-
* @
|
|
2241
|
+
*
|
|
2242
|
+
* @param index
|
|
2243
|
+
* @returns {*}
|
|
2500
2244
|
*/
|
|
2501
2245
|
getValueAt(index) {
|
|
2502
2246
|
const input = this.performInputMapping(this.refs.input[index]);
|
|
@@ -2504,9 +2248,11 @@ export default class Component extends Element {
|
|
|
2504
2248
|
}
|
|
2505
2249
|
/**
|
|
2506
2250
|
* Set the value of this component.
|
|
2507
|
-
*
|
|
2508
|
-
* @param
|
|
2509
|
-
* @
|
|
2251
|
+
*
|
|
2252
|
+
* @param value
|
|
2253
|
+
* @param flags
|
|
2254
|
+
*
|
|
2255
|
+
* @return {boolean} - If the value changed.
|
|
2510
2256
|
*/
|
|
2511
2257
|
setValue(value, flags = {}) {
|
|
2512
2258
|
const changed = this.updateValue(value, flags);
|
|
@@ -2537,9 +2283,9 @@ export default class Component extends Element {
|
|
|
2537
2283
|
}
|
|
2538
2284
|
/**
|
|
2539
2285
|
* Set the value at a specific index.
|
|
2540
|
-
*
|
|
2541
|
-
* @param
|
|
2542
|
-
* @param
|
|
2286
|
+
*
|
|
2287
|
+
* @param index
|
|
2288
|
+
* @param value
|
|
2543
2289
|
*/
|
|
2544
2290
|
setValueAt(index, value, flags = {}) {
|
|
2545
2291
|
if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
|
|
@@ -2586,8 +2332,9 @@ export default class Component extends Element {
|
|
|
2586
2332
|
}
|
|
2587
2333
|
/**
|
|
2588
2334
|
* Normalize values coming into updateValue.
|
|
2589
|
-
*
|
|
2590
|
-
* @
|
|
2335
|
+
*
|
|
2336
|
+
* @param value
|
|
2337
|
+
* @return {*}
|
|
2591
2338
|
*/
|
|
2592
2339
|
normalizeValue(value) {
|
|
2593
2340
|
if (this.component.multiple && !Array.isArray(value)) {
|
|
@@ -2597,9 +2344,8 @@ export default class Component extends Element {
|
|
|
2597
2344
|
}
|
|
2598
2345
|
/**
|
|
2599
2346
|
* Update a value of this component.
|
|
2600
|
-
*
|
|
2601
|
-
* @param
|
|
2602
|
-
* @returns {boolean} - If the value changed.
|
|
2347
|
+
*
|
|
2348
|
+
* @param flags
|
|
2603
2349
|
*/
|
|
2604
2350
|
updateComponentValue(value, flags = {}) {
|
|
2605
2351
|
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
@@ -2618,8 +2364,9 @@ export default class Component extends Element {
|
|
|
2618
2364
|
}
|
|
2619
2365
|
/**
|
|
2620
2366
|
* Updates the value of this component plus all sub-components.
|
|
2621
|
-
*
|
|
2622
|
-
* @
|
|
2367
|
+
*
|
|
2368
|
+
* @param args
|
|
2369
|
+
* @return {boolean}
|
|
2623
2370
|
*/
|
|
2624
2371
|
updateValue(...args) {
|
|
2625
2372
|
return this.updateComponentValue(...args);
|
|
@@ -2645,9 +2392,10 @@ export default class Component extends Element {
|
|
|
2645
2392
|
}
|
|
2646
2393
|
/**
|
|
2647
2394
|
* Determine if the value of this component has changed.
|
|
2648
|
-
*
|
|
2649
|
-
* @param
|
|
2650
|
-
* @
|
|
2395
|
+
*
|
|
2396
|
+
* @param newValue
|
|
2397
|
+
* @param oldValue
|
|
2398
|
+
* @return {boolean}
|
|
2651
2399
|
*/
|
|
2652
2400
|
hasChanged(newValue, oldValue) {
|
|
2653
2401
|
if (((newValue === undefined) || (newValue === null)) &&
|
|
@@ -2665,9 +2413,8 @@ export default class Component extends Element {
|
|
|
2665
2413
|
}
|
|
2666
2414
|
/**
|
|
2667
2415
|
* Update the value on change.
|
|
2668
|
-
*
|
|
2669
|
-
* @param
|
|
2670
|
-
* @returns {boolean} - If the value changed.
|
|
2416
|
+
*
|
|
2417
|
+
* @param flags
|
|
2671
2418
|
*/
|
|
2672
2419
|
updateOnChange(flags = {}, changed = false) {
|
|
2673
2420
|
if (!flags.noUpdateEvent && changed) {
|
|
@@ -2680,6 +2427,13 @@ export default class Component extends Element {
|
|
|
2680
2427
|
}
|
|
2681
2428
|
return false;
|
|
2682
2429
|
}
|
|
2430
|
+
/**
|
|
2431
|
+
* Perform a calculated value operation.
|
|
2432
|
+
*
|
|
2433
|
+
* @param data - The global data object.
|
|
2434
|
+
*
|
|
2435
|
+
* @return {boolean} - If the value changed during calculation.
|
|
2436
|
+
*/
|
|
2683
2437
|
convertNumberOrBoolToString(value) {
|
|
2684
2438
|
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
2685
2439
|
return value.toString();
|
|
@@ -2787,10 +2541,9 @@ export default class Component extends Element {
|
|
|
2787
2541
|
/* eslint-enable max-statements */
|
|
2788
2542
|
/**
|
|
2789
2543
|
* Performs calculations in this component plus any child components.
|
|
2790
|
-
*
|
|
2791
|
-
* @param
|
|
2792
|
-
* @
|
|
2793
|
-
* @returns {boolean} - TRUE if the value changed.
|
|
2544
|
+
*
|
|
2545
|
+
* @param args
|
|
2546
|
+
* @return {boolean}
|
|
2794
2547
|
*/
|
|
2795
2548
|
calculateValue(data, flags, row) {
|
|
2796
2549
|
data = data || this.rootValue;
|
|
@@ -2800,14 +2553,15 @@ export default class Component extends Element {
|
|
|
2800
2553
|
}
|
|
2801
2554
|
/**
|
|
2802
2555
|
* Get this component's label text.
|
|
2803
|
-
*
|
|
2556
|
+
*
|
|
2804
2557
|
*/
|
|
2805
2558
|
get label() {
|
|
2806
2559
|
return this.component.label;
|
|
2807
2560
|
}
|
|
2808
2561
|
/**
|
|
2809
2562
|
* Set this component's label text and render it.
|
|
2810
|
-
*
|
|
2563
|
+
*
|
|
2564
|
+
* @param value - The new label text.
|
|
2811
2565
|
*/
|
|
2812
2566
|
set label(value) {
|
|
2813
2567
|
this.component.label = value;
|
|
@@ -2817,18 +2571,17 @@ export default class Component extends Element {
|
|
|
2817
2571
|
}
|
|
2818
2572
|
/**
|
|
2819
2573
|
* Get FormioForm element at the root of this component tree.
|
|
2820
|
-
*
|
|
2574
|
+
*
|
|
2821
2575
|
*/
|
|
2822
2576
|
getRoot() {
|
|
2823
2577
|
return this.root;
|
|
2824
2578
|
}
|
|
2825
2579
|
/**
|
|
2826
2580
|
* Returns the invalid message, or empty string if the component is valid.
|
|
2827
|
-
*
|
|
2828
|
-
* @param
|
|
2829
|
-
* @param
|
|
2830
|
-
* @
|
|
2831
|
-
* @returns {string} - The message to show when the component is invalid.
|
|
2581
|
+
*
|
|
2582
|
+
* @param data
|
|
2583
|
+
* @param dirty
|
|
2584
|
+
* @return {*}
|
|
2832
2585
|
*/
|
|
2833
2586
|
invalidMessage(data, dirty, ignoreCondition, row) {
|
|
2834
2587
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
|
@@ -2860,9 +2613,10 @@ export default class Component extends Element {
|
|
|
2860
2613
|
}
|
|
2861
2614
|
/**
|
|
2862
2615
|
* Returns if the component is valid or not.
|
|
2863
|
-
*
|
|
2864
|
-
* @param
|
|
2865
|
-
* @
|
|
2616
|
+
*
|
|
2617
|
+
* @param data
|
|
2618
|
+
* @param dirty
|
|
2619
|
+
* @return {boolean}
|
|
2866
2620
|
*/
|
|
2867
2621
|
isValid(data, dirty) {
|
|
2868
2622
|
return !this.invalidMessage(data, dirty);
|
|
@@ -2881,8 +2635,8 @@ export default class Component extends Element {
|
|
|
2881
2635
|
}
|
|
2882
2636
|
/**
|
|
2883
2637
|
* Interpolate errors from the validation methods.
|
|
2884
|
-
* @param {
|
|
2885
|
-
* @returns
|
|
2638
|
+
* @param {*} errors
|
|
2639
|
+
* @returns
|
|
2886
2640
|
*/
|
|
2887
2641
|
interpolateErrors(errors) {
|
|
2888
2642
|
const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
@@ -2894,7 +2648,7 @@ export default class Component extends Element {
|
|
|
2894
2648
|
* @param {*} data - The root submission data.
|
|
2895
2649
|
* @param {*} row - The contextual row data.
|
|
2896
2650
|
* @param {*} flags - The flags to perform validation.
|
|
2897
|
-
* @returns
|
|
2651
|
+
* @returns
|
|
2898
2652
|
*/
|
|
2899
2653
|
showValidationErrors(errors, data, row, flags) {
|
|
2900
2654
|
if (flags.silentCheck) {
|
|
@@ -2914,9 +2668,9 @@ export default class Component extends Element {
|
|
|
2914
2668
|
* @param {*} data - The root data you wish to use for this component.
|
|
2915
2669
|
* @param {*} row - The contextual row data you wish to use for this component.
|
|
2916
2670
|
* @param {*} flags - The flags to control the behavior of the validation.
|
|
2917
|
-
* @returns
|
|
2671
|
+
* @returns
|
|
2918
2672
|
*/
|
|
2919
|
-
validateComponent(data
|
|
2673
|
+
validateComponent(data, row, flags = {}) {
|
|
2920
2674
|
data = data || this.rootValue;
|
|
2921
2675
|
row = row || this.data;
|
|
2922
2676
|
const { async = false } = flags;
|
|
@@ -2947,14 +2701,13 @@ export default class Component extends Element {
|
|
|
2947
2701
|
}
|
|
2948
2702
|
/**
|
|
2949
2703
|
* Checks the validity of this component and sets the error message if it is invalid.
|
|
2950
|
-
*
|
|
2951
|
-
* @param
|
|
2952
|
-
* @param
|
|
2953
|
-
* @param
|
|
2954
|
-
* @
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
2704
|
+
*
|
|
2705
|
+
* @param data
|
|
2706
|
+
* @param dirty
|
|
2707
|
+
* @param row
|
|
2708
|
+
* @return {boolean}
|
|
2709
|
+
*/
|
|
2710
|
+
checkComponentValidity(data, dirty, row, flags = {}, allErrors = []) {
|
|
2958
2711
|
data = data || this.rootValue;
|
|
2959
2712
|
row = row || this.data;
|
|
2960
2713
|
flags.dirty = dirty || false;
|
|
@@ -2990,30 +2743,32 @@ export default class Component extends Element {
|
|
|
2990
2743
|
}
|
|
2991
2744
|
/**
|
|
2992
2745
|
* Checks the validity of the component.
|
|
2993
|
-
* @param {*} data
|
|
2994
|
-
* @param {
|
|
2995
|
-
* @param {*} row
|
|
2996
|
-
* @param {
|
|
2997
|
-
* @
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2746
|
+
* @param {*} data
|
|
2747
|
+
* @param {*} dirty
|
|
2748
|
+
* @param {*} row
|
|
2749
|
+
* @param {*} silentCheck
|
|
2750
|
+
* @returns
|
|
2751
|
+
*/
|
|
2752
|
+
checkValidity(data, dirty, row, silentCheck, errors = []) {
|
|
3001
2753
|
data = data || this.rootValue;
|
|
3002
2754
|
row = row || this.data;
|
|
2755
|
+
console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3003
2756
|
return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
|
|
3004
2757
|
}
|
|
3005
|
-
checkAsyncValidity(data
|
|
2758
|
+
checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
|
|
2759
|
+
console.log('Deprecation warning: Component.checkAsyncValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3006
2760
|
return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
|
|
3007
2761
|
}
|
|
3008
2762
|
/**
|
|
3009
2763
|
* Check the conditions, calculations, and validity of a single component and triggers an update if
|
|
3010
2764
|
* something changed.
|
|
3011
|
-
*
|
|
3012
|
-
* @param
|
|
3013
|
-
* @param
|
|
3014
|
-
*
|
|
2765
|
+
*
|
|
2766
|
+
* @param data - The root data of the change event.
|
|
2767
|
+
* @param flags - The flags from this change event.
|
|
2768
|
+
*
|
|
2769
|
+
* @return boolean - If component is valid or not.
|
|
3015
2770
|
*/
|
|
3016
|
-
checkData(data
|
|
2771
|
+
checkData(data, flags, row) {
|
|
3017
2772
|
data = data || this.rootValue;
|
|
3018
2773
|
flags = flags || {};
|
|
3019
2774
|
row = row || this.data;
|
|
@@ -3056,7 +2811,8 @@ export default class Component extends Element {
|
|
|
3056
2811
|
}
|
|
3057
2812
|
/**
|
|
3058
2813
|
* Check if a component is eligible for multiple validation
|
|
3059
|
-
*
|
|
2814
|
+
*
|
|
2815
|
+
* @return {boolean}
|
|
3060
2816
|
*/
|
|
3061
2817
|
validateMultiple() {
|
|
3062
2818
|
return true;
|
|
@@ -3174,7 +2930,8 @@ export default class Component extends Element {
|
|
|
3174
2930
|
/**
|
|
3175
2931
|
* Determines if the value of this component is hidden from the user as if it is coming from the server, but is
|
|
3176
2932
|
* protected.
|
|
3177
|
-
*
|
|
2933
|
+
*
|
|
2934
|
+
* @return {boolean|*}
|
|
3178
2935
|
*/
|
|
3179
2936
|
isValueHidden() {
|
|
3180
2937
|
if (this.component.protected && this.root.editing) {
|
|
@@ -3219,8 +2976,6 @@ export default class Component extends Element {
|
|
|
3219
2976
|
}
|
|
3220
2977
|
/**
|
|
3221
2978
|
* Prints out the value of this component as a string value.
|
|
3222
|
-
* @param {*} value - The value to print out.
|
|
3223
|
-
* @returns {string} - The string representation of the value.
|
|
3224
2979
|
*/
|
|
3225
2980
|
asString(value) {
|
|
3226
2981
|
value = value || this.getValue();
|
|
@@ -3228,14 +2983,15 @@ export default class Component extends Element {
|
|
|
3228
2983
|
}
|
|
3229
2984
|
/**
|
|
3230
2985
|
* Return if the component is disabled.
|
|
3231
|
-
* @
|
|
2986
|
+
* @return {boolean}
|
|
3232
2987
|
*/
|
|
3233
2988
|
get disabled() {
|
|
3234
2989
|
return this._disabled || this.parentDisabled;
|
|
3235
2990
|
}
|
|
3236
2991
|
/**
|
|
3237
2992
|
* Disable this component.
|
|
3238
|
-
*
|
|
2993
|
+
*
|
|
2994
|
+
* @param {boolean} disabled
|
|
3239
2995
|
*/
|
|
3240
2996
|
set disabled(disabled) {
|
|
3241
2997
|
this._disabled = disabled;
|
|
@@ -3360,7 +3116,6 @@ export default class Component extends Element {
|
|
|
3360
3116
|
}
|
|
3361
3117
|
/**
|
|
3362
3118
|
* Get the element information.
|
|
3363
|
-
* @returns {*} - The components "input" DOM element information.
|
|
3364
3119
|
*/
|
|
3365
3120
|
elementInfo() {
|
|
3366
3121
|
const attributes = {
|
|
@@ -3399,12 +3154,14 @@ export default class Component extends Element {
|
|
|
3399
3154
|
const { left, top } = element.getBoundingClientRect();
|
|
3400
3155
|
window.scrollTo(left + window.scrollX, top + window.scrollY);
|
|
3401
3156
|
}
|
|
3402
|
-
focus(index
|
|
3157
|
+
focus(index) {
|
|
3403
3158
|
if ('beforeFocus' in this.parent) {
|
|
3404
3159
|
this.parent.beforeFocus(this);
|
|
3405
3160
|
}
|
|
3406
3161
|
if (this.refs.input?.length) {
|
|
3407
|
-
const focusingInput = this.refs.input[index]
|
|
3162
|
+
const focusingInput = typeof index === 'number' && this.refs.input[index]
|
|
3163
|
+
? this.refs.input[index]
|
|
3164
|
+
: this.refs.input[this.refs.input.length - 1];
|
|
3408
3165
|
if (this.component.widget?.type === 'calendar') {
|
|
3409
3166
|
const sibling = focusingInput.nextSibling;
|
|
3410
3167
|
if (sibling) {
|
|
@@ -3424,7 +3181,6 @@ export default class Component extends Element {
|
|
|
3424
3181
|
}
|
|
3425
3182
|
/**
|
|
3426
3183
|
* Get `Formio` instance for working with files
|
|
3427
|
-
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
|
3428
3184
|
*/
|
|
3429
3185
|
get fileService() {
|
|
3430
3186
|
if (this.options.fileService) {
|