@formio/js 5.0.0-dev.5641.d9ab3df → 5.0.0-dev.5642.afd813e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +0 -37
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +1189 -608
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +5 -3
- package/dist/formio.full.js +913 -652
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +5 -3
- package/dist/formio.js +18 -18
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +494 -1831
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +4 -10
- package/lib/cjs/CDN.d.ts +0 -1
- package/lib/cjs/CDN.js +3 -6
- package/lib/cjs/Element.d.ts +96 -86
- package/lib/cjs/Element.js +78 -68
- package/lib/cjs/Embed.d.ts +1 -1
- package/lib/cjs/Embed.js +12 -52
- package/lib/cjs/Form.d.ts +36 -365
- package/lib/cjs/Form.js +64 -50
- package/lib/cjs/FormBuilder.d.ts +2 -187
- package/lib/cjs/FormBuilder.js +8 -30
- package/lib/cjs/PDF.d.ts +13 -11
- package/lib/cjs/PDF.js +8 -6
- package/lib/cjs/Webform.d.ts +139 -180
- package/lib/cjs/Webform.js +296 -309
- package/lib/cjs/WebformBuilder.d.ts +14 -16
- package/lib/cjs/WebformBuilder.js +10 -11
- package/lib/cjs/Wizard.d.ts +21 -31
- package/lib/cjs/Wizard.js +20 -43
- package/lib/cjs/WizardBuilder.d.ts +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
- package/lib/cjs/components/Components.d.ts +4 -4
- package/lib/cjs/components/Components.js +3 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +269 -502
- package/lib/cjs/components/_classes/component/Component.form.d.ts +3 -6
- package/lib/cjs/components/_classes/component/Component.form.js +0 -5
- package/lib/cjs/components/_classes/component/Component.js +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/file/File.js +1 -2
- 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 +14 -17
- package/lib/cjs/components/hidden/Hidden.d.ts +11 -1
- package/lib/cjs/components/hidden/Hidden.form.d.ts +3 -6
- package/lib/cjs/components/hidden/Hidden.form.js +0 -5
- package/lib/cjs/components/hidden/Hidden.js +2 -1
- package/lib/cjs/components/html/HTML.d.ts +1 -2
- package/lib/cjs/components/html/HTML.form.d.ts +3 -6
- package/lib/cjs/components/html/HTML.form.js +0 -5
- package/lib/cjs/components/number/Number.d.ts +17 -3
- package/lib/cjs/components/number/Number.form.d.ts +3 -6
- package/lib/cjs/components/number/Number.form.js +0 -5
- package/lib/cjs/components/number/Number.js +2 -1
- package/lib/cjs/components/panel/Panel.form.d.ts +3 -6
- package/lib/cjs/components/panel/Panel.form.js +0 -5
- package/lib/cjs/components/panel/Panel.js +1 -0
- package/lib/cjs/components/password/Password.form.d.ts +3 -6
- package/lib/cjs/components/password/Password.form.js +0 -5
- package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +0 -5
- package/lib/cjs/components/radio/Radio.d.ts +26 -3
- package/lib/cjs/components/radio/Radio.form.d.ts +3 -6
- package/lib/cjs/components/radio/Radio.form.js +0 -5
- package/lib/cjs/components/radio/Radio.js +4 -3
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +3 -6
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +0 -5
- package/lib/cjs/components/select/Select.d.ts +39 -16
- package/lib/cjs/components/select/Select.form.d.ts +3 -6
- package/lib/cjs/components/select/Select.form.js +0 -5
- package/lib/cjs/components/select/Select.js +16 -13
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +17 -2
- package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
- package/lib/cjs/components/selectboxes/SelectBoxes.form.js +0 -5
- package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -7
- package/lib/cjs/components/signature/Signature.d.ts +14 -1
- package/lib/cjs/components/signature/Signature.form.d.ts +3 -6
- package/lib/cjs/components/signature/Signature.form.js +0 -5
- package/lib/cjs/components/survey/Survey.d.ts +15 -3
- package/lib/cjs/components/survey/Survey.form.d.ts +3 -6
- package/lib/cjs/components/survey/Survey.form.js +0 -5
- package/lib/cjs/components/table/Table.d.ts +1 -2
- package/lib/cjs/components/table/Table.form.d.ts +3 -6
- package/lib/cjs/components/table/Table.form.js +0 -5
- package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/cjs/components/tabs/Tabs.form.d.ts +3 -6
- package/lib/cjs/components/tabs/Tabs.form.js +0 -5
- package/lib/cjs/components/tabs/Tabs.js +2 -1
- package/lib/cjs/components/tags/Tags.d.ts +14 -0
- package/lib/cjs/components/tags/Tags.form.d.ts +3 -6
- package/lib/cjs/components/tags/Tags.form.js +0 -5
- package/lib/cjs/components/textarea/TextArea.d.ts +9 -4
- package/lib/cjs/components/textarea/TextArea.form.d.ts +3 -6
- package/lib/cjs/components/textarea/TextArea.form.js +0 -5
- package/lib/cjs/components/textarea/TextArea.js +2 -2
- package/lib/cjs/components/textfield/TextField.d.ts +30 -14
- package/lib/cjs/components/textfield/TextField.form.d.ts +3 -6
- package/lib/cjs/components/textfield/TextField.form.js +0 -5
- package/lib/cjs/components/textfield/TextField.js +17 -16
- package/lib/cjs/components/time/Time.form.d.ts +3 -6
- package/lib/cjs/components/time/Time.form.js +0 -5
- package/lib/cjs/components/unknown/Unknown.form.d.ts +34 -5
- package/lib/cjs/components/unknown/Unknown.form.js +0 -4
- package/lib/cjs/components/url/Url.form.d.ts +3 -6
- package/lib/cjs/components/url/Url.form.js +0 -5
- package/lib/cjs/components/well/Well.form.d.ts +3 -6
- package/lib/cjs/components/well/Well.form.js +0 -5
- package/lib/cjs/formio.embed.d.ts +2 -1
- package/lib/cjs/formio.embed.js +100 -2
- package/lib/cjs/formio.form.d.ts +4 -11
- package/lib/cjs/formio.form.js +5 -13
- package/lib/cjs/providers/Providers.d.ts +5 -36
- package/lib/cjs/providers/Providers.js +0 -29
- package/lib/cjs/providers/address/AddressProvider.d.ts +12 -131
- package/lib/cjs/providers/address/AddressProvider.js +2 -88
- package/lib/cjs/providers/address/AzureAddressProvider.d.ts +1 -48
- package/lib/cjs/providers/address/AzureAddressProvider.js +0 -37
- package/lib/cjs/providers/address/CustomAddressProvider.d.ts +4 -27
- package/lib/cjs/providers/address/CustomAddressProvider.js +0 -34
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +6 -130
- package/lib/cjs/providers/address/GoogleAddressProvider.js +0 -72
- package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +7 -32
- package/lib/cjs/providers/address/NominatimAddressProvider.js +0 -33
- package/lib/cjs/providers/address/index.d.ts +1 -3
- package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -7
- package/lib/cjs/providers/processor/fileProcessor.js +0 -6
- package/lib/cjs/providers/storage/azure.d.ts +13 -6
- package/lib/cjs/providers/storage/azure.js +0 -5
- package/lib/cjs/providers/storage/base64.d.ts +6 -5
- package/lib/cjs/providers/storage/base64.js +0 -4
- package/lib/cjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/cjs/providers/storage/dropbox.js +0 -5
- package/lib/cjs/providers/storage/googleDrive.d.ts +5 -7
- package/lib/cjs/providers/storage/googleDrive.js +0 -6
- package/lib/cjs/providers/storage/indexeddb.d.ts +7 -5
- package/lib/cjs/providers/storage/indexeddb.js +0 -4
- package/lib/cjs/providers/storage/s3.d.ts +20 -6
- package/lib/cjs/providers/storage/s3.js +0 -5
- package/lib/cjs/providers/storage/url.d.ts +7 -6
- package/lib/cjs/providers/storage/url.js +0 -10
- package/lib/cjs/providers/storage/util.d.ts +1 -24
- package/lib/cjs/providers/storage/util.js +0 -18
- package/lib/cjs/templates/Templates.d.ts +0 -1
- package/lib/cjs/utils/Evaluator.d.ts +3 -6
- package/lib/cjs/utils/Evaluator.js +20 -11
- package/lib/cjs/utils/builder.d.ts +7 -9
- package/lib/cjs/utils/builder.js +5 -10
- package/lib/cjs/utils/calendarUtils.d.ts +13 -7
- package/lib/cjs/utils/calendarUtils.js +17 -10
- package/lib/cjs/utils/formUtils.d.ts +171 -43
- package/lib/cjs/utils/formUtils.js +569 -38
- package/lib/cjs/utils/utils.d.ts +221 -367
- package/lib/cjs/utils/utils.js +228 -335
- package/lib/cjs/widgets/CalendarWidget.d.ts +10 -9
- package/lib/cjs/widgets/CalendarWidget.js +11 -9
- package/lib/mjs/CDN.d.ts +0 -1
- package/lib/mjs/CDN.js +3 -6
- package/lib/mjs/Element.d.ts +96 -86
- package/lib/mjs/Element.js +78 -68
- package/lib/mjs/Embed.d.ts +1 -1
- package/lib/mjs/Embed.js +12 -52
- package/lib/mjs/Form.d.ts +36 -365
- package/lib/mjs/Form.js +57 -140
- package/lib/mjs/FormBuilder.d.ts +2 -187
- package/lib/mjs/FormBuilder.js +8 -32
- package/lib/mjs/PDF.d.ts +13 -11
- package/lib/mjs/PDF.js +8 -6
- package/lib/mjs/Webform.d.ts +139 -180
- package/lib/mjs/Webform.js +308 -321
- package/lib/mjs/WebformBuilder.d.ts +14 -16
- package/lib/mjs/WebformBuilder.js +10 -11
- package/lib/mjs/Wizard.d.ts +21 -31
- package/lib/mjs/Wizard.js +19 -42
- package/lib/mjs/WizardBuilder.d.ts +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
- package/lib/mjs/components/Components.d.ts +4 -4
- package/lib/mjs/components/Components.js +3 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +269 -502
- package/lib/mjs/components/_classes/component/Component.form.d.ts +3 -6
- package/lib/mjs/components/_classes/component/Component.form.js +0 -5
- package/lib/mjs/components/_classes/component/Component.js +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/file/File.js +1 -2
- 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 +12 -15
- package/lib/mjs/components/hidden/Hidden.d.ts +11 -1
- package/lib/mjs/components/hidden/Hidden.form.d.ts +3 -6
- package/lib/mjs/components/hidden/Hidden.form.js +0 -5
- package/lib/mjs/components/hidden/Hidden.js +2 -1
- package/lib/mjs/components/html/HTML.d.ts +1 -2
- package/lib/mjs/components/html/HTML.form.d.ts +3 -6
- package/lib/mjs/components/html/HTML.form.js +0 -5
- package/lib/mjs/components/number/Number.d.ts +17 -3
- package/lib/mjs/components/number/Number.form.d.ts +3 -6
- package/lib/mjs/components/number/Number.form.js +0 -5
- package/lib/mjs/components/number/Number.js +2 -1
- package/lib/mjs/components/panel/Panel.form.d.ts +3 -6
- package/lib/mjs/components/panel/Panel.form.js +0 -5
- package/lib/mjs/components/panel/Panel.js +1 -0
- package/lib/mjs/components/password/Password.form.d.ts +3 -6
- package/lib/mjs/components/password/Password.form.js +0 -5
- package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +0 -5
- package/lib/mjs/components/radio/Radio.d.ts +26 -3
- package/lib/mjs/components/radio/Radio.form.d.ts +3 -6
- package/lib/mjs/components/radio/Radio.form.js +0 -5
- package/lib/mjs/components/radio/Radio.js +4 -3
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +3 -6
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +0 -5
- package/lib/mjs/components/select/Select.d.ts +39 -16
- package/lib/mjs/components/select/Select.form.d.ts +3 -6
- package/lib/mjs/components/select/Select.form.js +0 -5
- package/lib/mjs/components/select/Select.js +17 -14
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +17 -2
- package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
- package/lib/mjs/components/selectboxes/SelectBoxes.form.js +0 -5
- package/lib/mjs/components/selectboxes/SelectBoxes.js +9 -7
- package/lib/mjs/components/signature/Signature.d.ts +14 -1
- package/lib/mjs/components/signature/Signature.form.d.ts +3 -6
- package/lib/mjs/components/signature/Signature.form.js +0 -5
- package/lib/mjs/components/survey/Survey.d.ts +15 -3
- package/lib/mjs/components/survey/Survey.form.d.ts +3 -6
- package/lib/mjs/components/survey/Survey.form.js +0 -5
- package/lib/mjs/components/table/Table.d.ts +1 -2
- package/lib/mjs/components/table/Table.form.d.ts +3 -6
- package/lib/mjs/components/table/Table.form.js +0 -5
- package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/mjs/components/tabs/Tabs.form.d.ts +3 -6
- package/lib/mjs/components/tabs/Tabs.form.js +0 -5
- package/lib/mjs/components/tabs/Tabs.js +2 -1
- package/lib/mjs/components/tags/Tags.d.ts +14 -0
- package/lib/mjs/components/tags/Tags.form.d.ts +3 -6
- package/lib/mjs/components/tags/Tags.form.js +0 -5
- package/lib/mjs/components/textarea/TextArea.d.ts +9 -4
- package/lib/mjs/components/textarea/TextArea.form.d.ts +3 -6
- package/lib/mjs/components/textarea/TextArea.form.js +0 -5
- package/lib/mjs/components/textarea/TextArea.js +2 -2
- package/lib/mjs/components/textfield/TextField.d.ts +30 -14
- package/lib/mjs/components/textfield/TextField.form.d.ts +3 -6
- package/lib/mjs/components/textfield/TextField.form.js +0 -5
- package/lib/mjs/components/textfield/TextField.js +17 -16
- package/lib/mjs/components/time/Time.form.d.ts +3 -6
- package/lib/mjs/components/time/Time.form.js +0 -5
- package/lib/mjs/components/unknown/Unknown.form.d.ts +34 -5
- package/lib/mjs/components/unknown/Unknown.form.js +0 -4
- package/lib/mjs/components/url/Url.form.d.ts +3 -6
- package/lib/mjs/components/url/Url.form.js +0 -5
- package/lib/mjs/components/well/Well.form.d.ts +3 -6
- package/lib/mjs/components/well/Well.form.js +0 -5
- package/lib/mjs/formio.embed.d.ts +2 -1
- package/lib/mjs/formio.embed.js +99 -2
- package/lib/mjs/formio.form.d.ts +4 -11
- package/lib/mjs/formio.form.js +3 -10
- package/lib/mjs/providers/Providers.d.ts +5 -36
- package/lib/mjs/providers/Providers.js +0 -29
- package/lib/mjs/providers/address/AddressProvider.d.ts +12 -131
- package/lib/mjs/providers/address/AddressProvider.js +2 -88
- package/lib/mjs/providers/address/AzureAddressProvider.d.ts +1 -48
- package/lib/mjs/providers/address/AzureAddressProvider.js +0 -37
- package/lib/mjs/providers/address/CustomAddressProvider.d.ts +4 -27
- package/lib/mjs/providers/address/CustomAddressProvider.js +0 -34
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +6 -130
- package/lib/mjs/providers/address/GoogleAddressProvider.js +0 -72
- package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +7 -32
- package/lib/mjs/providers/address/NominatimAddressProvider.js +0 -33
- package/lib/mjs/providers/address/index.d.ts +1 -3
- package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -7
- package/lib/mjs/providers/processor/fileProcessor.js +0 -6
- package/lib/mjs/providers/storage/azure.d.ts +13 -6
- package/lib/mjs/providers/storage/azure.js +0 -5
- package/lib/mjs/providers/storage/base64.d.ts +6 -5
- package/lib/mjs/providers/storage/base64.js +0 -4
- package/lib/mjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/mjs/providers/storage/dropbox.js +0 -5
- package/lib/mjs/providers/storage/googleDrive.d.ts +5 -7
- package/lib/mjs/providers/storage/googleDrive.js +0 -6
- package/lib/mjs/providers/storage/indexeddb.d.ts +7 -5
- package/lib/mjs/providers/storage/indexeddb.js +0 -4
- package/lib/mjs/providers/storage/s3.d.ts +20 -6
- package/lib/mjs/providers/storage/s3.js +0 -5
- package/lib/mjs/providers/storage/url.d.ts +7 -6
- package/lib/mjs/providers/storage/url.js +0 -10
- package/lib/mjs/providers/storage/util.d.ts +1 -24
- package/lib/mjs/providers/storage/util.js +0 -18
- package/lib/mjs/templates/Templates.d.ts +0 -1
- package/lib/mjs/utils/Evaluator.d.ts +3 -6
- package/lib/mjs/utils/Evaluator.js +20 -9
- package/lib/mjs/utils/builder.d.ts +7 -9
- package/lib/mjs/utils/builder.js +5 -10
- package/lib/mjs/utils/calendarUtils.d.ts +13 -7
- package/lib/mjs/utils/calendarUtils.js +17 -10
- package/lib/mjs/utils/formUtils.d.ts +171 -43
- package/lib/mjs/utils/formUtils.js +554 -6
- package/lib/mjs/utils/utils.d.ts +221 -367
- package/lib/mjs/utils/utils.js +222 -329
- package/lib/mjs/widgets/CalendarWidget.d.ts +10 -9
- package/lib/mjs/widgets/CalendarWidget.js +11 -9
- package/package.json +22 -22
- package/embed.d.ts +0 -1
- package/form.d.ts +0 -1
- package/lib/cjs/InlineEmbed.d.ts +0 -7
- package/lib/cjs/InlineEmbed.js +0 -116
- package/lib/mjs/InlineEmbed.d.ts +0 -7
- package/lib/mjs/InlineEmbed.js +0 -112
- package/sdk.d.ts +0 -1
- package/utils.d.ts +0 -1
|
@@ -193,7 +193,9 @@ class Component extends Element_1.default {
|
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* Return the simple condition settings as part of the component.
|
|
196
|
-
*
|
|
196
|
+
*
|
|
197
|
+
* @return {Object}
|
|
198
|
+
*
|
|
197
199
|
*/
|
|
198
200
|
static get conditionOperatorsSettings() {
|
|
199
201
|
return {
|
|
@@ -210,8 +212,10 @@ class Component extends Element_1.default {
|
|
|
210
212
|
}
|
|
211
213
|
/**
|
|
212
214
|
* Return the array of possible types of component value absed on its schema.
|
|
215
|
+
*
|
|
213
216
|
* @param schema
|
|
214
|
-
* @
|
|
217
|
+
* @return {Array}
|
|
218
|
+
*
|
|
215
219
|
*/
|
|
216
220
|
static savedValueTypes(schema) {
|
|
217
221
|
schema = schema || {};
|
|
@@ -220,6 +224,7 @@ class Component extends Element_1.default {
|
|
|
220
224
|
/**
|
|
221
225
|
* Provides a table view for this component. Override if you wish to do something different than using getView
|
|
222
226
|
* method of your instance.
|
|
227
|
+
*
|
|
223
228
|
* @param value
|
|
224
229
|
* @param options
|
|
225
230
|
*/
|
|
@@ -228,9 +233,10 @@ class Component extends Element_1.default {
|
|
|
228
233
|
/* eslint-enable no-unused-vars */
|
|
229
234
|
/**
|
|
230
235
|
* Initialize a new Component.
|
|
231
|
-
*
|
|
232
|
-
* @param {
|
|
233
|
-
* @param {
|
|
236
|
+
*
|
|
237
|
+
* @param {Object} component - The component JSON you wish to initialize.
|
|
238
|
+
* @param {Object} options - The options for this component.
|
|
239
|
+
* @param {Object} data - The global data submission object this component will belong.
|
|
234
240
|
*/
|
|
235
241
|
/* eslint-disable max-statements */
|
|
236
242
|
constructor(component, options, data) {
|
|
@@ -261,6 +267,7 @@ class Component extends Element_1.default {
|
|
|
261
267
|
}
|
|
262
268
|
/**
|
|
263
269
|
* The data path to this specific component instance.
|
|
270
|
+
*
|
|
264
271
|
* @type {string}
|
|
265
272
|
*/
|
|
266
273
|
this.path = (component === null || component === void 0 ? void 0 : component.key) || '';
|
|
@@ -308,27 +315,32 @@ class Component extends Element_1.default {
|
|
|
308
315
|
this.row = this.options.row;
|
|
309
316
|
/**
|
|
310
317
|
* Points to a flat map of child components (if applicable).
|
|
311
|
-
*
|
|
318
|
+
*
|
|
319
|
+
* @type {Object}
|
|
312
320
|
*/
|
|
313
321
|
this.childComponentsMap = {};
|
|
314
322
|
/**
|
|
315
323
|
* Determines if this component is disabled, or not.
|
|
324
|
+
*
|
|
316
325
|
* @type {boolean}
|
|
317
326
|
*/
|
|
318
327
|
this._disabled = (0, utils_1.boolValue)(this.component.disabled) ? this.component.disabled : false;
|
|
319
328
|
/**
|
|
320
329
|
* Points to the root component, usually the FormComponent.
|
|
330
|
+
*
|
|
321
331
|
* @type {Component}
|
|
322
332
|
*/
|
|
323
333
|
this.root = this.options.root || this;
|
|
324
334
|
this.localRoot = this.options.localRoot || this;
|
|
325
335
|
/**
|
|
326
336
|
* If this input has been input and provided value.
|
|
337
|
+
*
|
|
327
338
|
* @type {boolean}
|
|
328
339
|
*/
|
|
329
340
|
this.pristine = true;
|
|
330
341
|
/**
|
|
331
342
|
* Points to the parent component.
|
|
343
|
+
*
|
|
332
344
|
* @type {Component}
|
|
333
345
|
*/
|
|
334
346
|
this.parent = this.options.parent;
|
|
@@ -348,7 +360,7 @@ class Component extends Element_1.default {
|
|
|
348
360
|
this._referenceAttributeName = 'ref';
|
|
349
361
|
/**
|
|
350
362
|
* Used to trigger a new change in this component.
|
|
351
|
-
* @type {
|
|
363
|
+
* @type {function} - Call to trigger a change in this component.
|
|
352
364
|
*/
|
|
353
365
|
let changes = [];
|
|
354
366
|
let lastChanged = null;
|
|
@@ -389,6 +401,7 @@ class Component extends Element_1.default {
|
|
|
389
401
|
};
|
|
390
402
|
/**
|
|
391
403
|
* Used to trigger a redraw event within this component.
|
|
404
|
+
*
|
|
392
405
|
* @type {Function}
|
|
393
406
|
*/
|
|
394
407
|
this.triggerRedraw = lodash_1.default.debounce(this.redraw.bind(this), 100);
|
|
@@ -590,8 +603,8 @@ class Component extends Element_1.default {
|
|
|
590
603
|
return this.shouldForceVisibility(component, 'show');
|
|
591
604
|
}
|
|
592
605
|
/**
|
|
593
|
-
*
|
|
594
|
-
* @param {boolean}
|
|
606
|
+
*
|
|
607
|
+
* @param value {boolean}
|
|
595
608
|
*/
|
|
596
609
|
set visible(value) {
|
|
597
610
|
if (this._visible !== value) {
|
|
@@ -609,8 +622,8 @@ class Component extends Element_1.default {
|
|
|
609
622
|
}
|
|
610
623
|
}
|
|
611
624
|
/**
|
|
612
|
-
*
|
|
613
|
-
* @returns {boolean}
|
|
625
|
+
*
|
|
626
|
+
* @returns {boolean}
|
|
614
627
|
*/
|
|
615
628
|
get visible() {
|
|
616
629
|
// Show only if visibility changes or if we are in builder mode or if hidden fields should be shown.
|
|
@@ -700,10 +713,9 @@ class Component extends Element_1.default {
|
|
|
700
713
|
}
|
|
701
714
|
/**
|
|
702
715
|
* Returns only the schema that is different from the default.
|
|
703
|
-
*
|
|
704
|
-
* @param
|
|
705
|
-
* @param
|
|
706
|
-
* @returns {object} - The minified json schema for this component.
|
|
716
|
+
*
|
|
717
|
+
* @param schema
|
|
718
|
+
* @param defaultSchema
|
|
707
719
|
*/
|
|
708
720
|
getModifiedSchema(schema, defaultSchema, recursion) {
|
|
709
721
|
const modified = {};
|
|
@@ -737,24 +749,21 @@ class Component extends Element_1.default {
|
|
|
737
749
|
}
|
|
738
750
|
/**
|
|
739
751
|
* Returns the JSON schema for this component.
|
|
740
|
-
* @returns {object} - The JSON schema for this component.
|
|
741
752
|
*/
|
|
742
753
|
get schema() {
|
|
743
754
|
return (0, utils_1.fastCloneDeep)(this.getModifiedSchema(lodash_1.default.omit(this.component, 'id'), this.defaultSchema));
|
|
744
755
|
}
|
|
745
756
|
/**
|
|
746
757
|
* Returns true if component is inside DataGrid
|
|
747
|
-
* @returns {boolean} - True if component is inside DataGrid
|
|
748
758
|
*/
|
|
749
759
|
get isInDataGrid() {
|
|
750
760
|
return this.inDataGrid;
|
|
751
761
|
}
|
|
752
762
|
/**
|
|
753
763
|
* Translate a text using the i18n system.
|
|
764
|
+
*
|
|
754
765
|
* @param {string} text - The i18n identifier.
|
|
755
|
-
* @param {
|
|
756
|
-
* @param {...any} args - Additional arguments to pass to the translation library.
|
|
757
|
-
* @returns {string} - The translated text.
|
|
766
|
+
* @param {Object} params - The i18n parameters to use for translation.
|
|
758
767
|
*/
|
|
759
768
|
t(text, params = {}, ...args) {
|
|
760
769
|
if (!text) {
|
|
@@ -844,7 +853,7 @@ class Component extends Element_1.default {
|
|
|
844
853
|
isHtmlRenderMode() {
|
|
845
854
|
return this.options.renderMode === 'html';
|
|
846
855
|
}
|
|
847
|
-
renderTemplate(name, data = {}, modeOption
|
|
856
|
+
renderTemplate(name, data = {}, modeOption) {
|
|
848
857
|
// Need to make this fall back to form if renderMode is not found similar to how we search templates.
|
|
849
858
|
const mode = modeOption || this.options.renderMode || 'form';
|
|
850
859
|
data.component = this.component;
|
|
@@ -884,12 +893,11 @@ class Component extends Element_1.default {
|
|
|
884
893
|
}
|
|
885
894
|
/**
|
|
886
895
|
* Sanitize an html string.
|
|
887
|
-
*
|
|
888
|
-
* @param
|
|
889
|
-
* @
|
|
890
|
-
* @returns {*} - The sanitized html string.
|
|
896
|
+
*
|
|
897
|
+
* @param string
|
|
898
|
+
* @returns {*}
|
|
891
899
|
*/
|
|
892
|
-
sanitize(dirty, forceSanitize
|
|
900
|
+
sanitize(dirty, forceSanitize, options) {
|
|
893
901
|
var _a;
|
|
894
902
|
if (!this.shouldSanitizeValue && !forceSanitize) {
|
|
895
903
|
return dirty;
|
|
@@ -900,9 +908,12 @@ class Component extends Element_1.default {
|
|
|
900
908
|
}
|
|
901
909
|
/**
|
|
902
910
|
* Render a template string into html.
|
|
903
|
-
*
|
|
904
|
-
* @param
|
|
905
|
-
* @
|
|
911
|
+
*
|
|
912
|
+
* @param template
|
|
913
|
+
* @param data
|
|
914
|
+
* @param actions
|
|
915
|
+
*
|
|
916
|
+
* @return {HTMLElement|String} - The created element or an empty string if template is not specified.
|
|
906
917
|
*/
|
|
907
918
|
renderString(template, data) {
|
|
908
919
|
if (!template) {
|
|
@@ -911,18 +922,9 @@ class Component extends Element_1.default {
|
|
|
911
922
|
// Interpolate the template and populate
|
|
912
923
|
return this.interpolate(template, data);
|
|
913
924
|
}
|
|
914
|
-
/**
|
|
915
|
-
* Allows for modification of the component value prior to submission.
|
|
916
|
-
* @param {*} input - The input to be modified.
|
|
917
|
-
* @returns {*} - The modified input mapping for the extended component.
|
|
918
|
-
*/
|
|
919
925
|
performInputMapping(input) {
|
|
920
926
|
return input;
|
|
921
927
|
}
|
|
922
|
-
/**
|
|
923
|
-
* Returns the component "widget" if one is available.
|
|
924
|
-
* @returns {Widget|null} - The widget instance. null if not available.
|
|
925
|
-
*/
|
|
926
928
|
get widget() {
|
|
927
929
|
var _a;
|
|
928
930
|
const settings = this.component.widget;
|
|
@@ -932,10 +934,6 @@ class Component extends Element_1.default {
|
|
|
932
934
|
const widget = settings && widgets_1.default[settings.type] ? new widgets_1.default[settings.type](settings, this.component, this) : null;
|
|
933
935
|
return widget;
|
|
934
936
|
}
|
|
935
|
-
/**
|
|
936
|
-
* Returns the native supported browser language.
|
|
937
|
-
* @returns {string|null} - The native browser language that is supported.
|
|
938
|
-
*/
|
|
939
937
|
getBrowserLanguage() {
|
|
940
938
|
const nav = window.navigator;
|
|
941
939
|
const browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'];
|
|
@@ -959,46 +957,38 @@ class Component extends Element_1.default {
|
|
|
959
957
|
return null;
|
|
960
958
|
}
|
|
961
959
|
/**
|
|
962
|
-
* Called before a next and previous page is triggered allowing the components
|
|
963
|
-
*
|
|
960
|
+
* Called before a next and previous page is triggered allowing the components
|
|
961
|
+
* to perform special functions.
|
|
962
|
+
*
|
|
963
|
+
* @return {*}
|
|
964
964
|
*/
|
|
965
965
|
beforePage() {
|
|
966
966
|
return Promise.resolve(true);
|
|
967
967
|
}
|
|
968
|
-
/**
|
|
969
|
-
* Called before the next page is triggered allowing the components to hook into the page navigation and perform tasks.
|
|
970
|
-
* @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next page navigation.
|
|
971
|
-
*/
|
|
972
968
|
beforeNext() {
|
|
973
969
|
return this.beforePage(true);
|
|
974
970
|
}
|
|
975
971
|
/**
|
|
976
|
-
* Called before a submission is triggered allowing the components
|
|
977
|
-
*
|
|
972
|
+
* Called before a submission is triggered allowing the components
|
|
973
|
+
* to perform special async functions.
|
|
974
|
+
*
|
|
975
|
+
* @return {*}
|
|
978
976
|
*/
|
|
979
977
|
beforeSubmit() {
|
|
980
978
|
return Promise.resolve(true);
|
|
981
979
|
}
|
|
982
980
|
/**
|
|
983
981
|
* Return the submission timezone.
|
|
984
|
-
*
|
|
982
|
+
*
|
|
983
|
+
* @return {*}
|
|
985
984
|
*/
|
|
986
985
|
get submissionTimezone() {
|
|
987
986
|
this.options.submissionTimezone = this.options.submissionTimezone || lodash_1.default.get(this.root, 'options.submissionTimezone');
|
|
988
987
|
return this.options.submissionTimezone;
|
|
989
988
|
}
|
|
990
|
-
/**
|
|
991
|
-
* Return the current timezone.
|
|
992
|
-
* @returns {string} - The current timezone.
|
|
993
|
-
*/
|
|
994
989
|
get timezone() {
|
|
995
990
|
return this.getTimezone(this.component);
|
|
996
991
|
}
|
|
997
|
-
/**
|
|
998
|
-
* Return the current timezone.
|
|
999
|
-
* @param {object} settings - Settings to control how the timezone should be returned.
|
|
1000
|
-
* @returns {string} - The current timezone.
|
|
1001
|
-
*/
|
|
1002
992
|
getTimezone(settings) {
|
|
1003
993
|
if (settings.timezone) {
|
|
1004
994
|
return settings.timezone;
|
|
@@ -1022,9 +1012,6 @@ class Component extends Element_1.default {
|
|
|
1022
1012
|
* @param {string} [referenceAttributeName] - The attribute name to use for the reference.
|
|
1023
1013
|
*/
|
|
1024
1014
|
loadRefs(element, refs, referenceAttributeName) {
|
|
1025
|
-
if (!element) {
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1028
1015
|
for (const ref in refs) {
|
|
1029
1016
|
const refType = refs[ref];
|
|
1030
1017
|
const isString = typeof refType === 'string';
|
|
@@ -1039,17 +1026,9 @@ class Component extends Element_1.default {
|
|
|
1039
1026
|
}
|
|
1040
1027
|
}
|
|
1041
1028
|
}
|
|
1042
|
-
|
|
1043
|
-
* Opens the modal element.
|
|
1044
|
-
* @param {string} template - The template to use for the modal dialog.
|
|
1045
|
-
*/
|
|
1046
|
-
setOpenModalElement(template = null) {
|
|
1029
|
+
setOpenModalElement(template) {
|
|
1047
1030
|
this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
|
|
1048
1031
|
}
|
|
1049
|
-
/**
|
|
1050
|
-
* Returns the modal preview template.
|
|
1051
|
-
* @returns {string} - The modal preview template.
|
|
1052
|
-
*/
|
|
1053
1032
|
getModalPreviewTemplate() {
|
|
1054
1033
|
var _a;
|
|
1055
1034
|
const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
|
|
@@ -1063,11 +1042,6 @@ class Component extends Element_1.default {
|
|
|
1063
1042
|
labelInfo: modalLabel,
|
|
1064
1043
|
});
|
|
1065
1044
|
}
|
|
1066
|
-
/**
|
|
1067
|
-
* Performs a complete build of a component, which empties, renders, sets the content in the DOM, and then finally attaches events.
|
|
1068
|
-
* @param {HTMLElement} element - The element to attach this component to.
|
|
1069
|
-
* @returns {Promise<void>} - A promise that resolves when the component has been built.
|
|
1070
|
-
*/
|
|
1071
1045
|
build(element) {
|
|
1072
1046
|
element = element || this.element;
|
|
1073
1047
|
this.empty(element);
|
|
@@ -1077,12 +1051,6 @@ class Component extends Element_1.default {
|
|
|
1077
1051
|
get hasModalSaveButton() {
|
|
1078
1052
|
return true;
|
|
1079
1053
|
}
|
|
1080
|
-
/**
|
|
1081
|
-
* Renders a component as an HTML string.
|
|
1082
|
-
* @param {string} children - The contents of all the children HTML as a string.
|
|
1083
|
-
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
|
1084
|
-
* @returns {string} - The rendered HTML string of a component.
|
|
1085
|
-
*/
|
|
1086
1054
|
render(children = `Unknown component: ${this.component.type}`, topLevel = false) {
|
|
1087
1055
|
const isVisible = this.visible;
|
|
1088
1056
|
this.rendered = true;
|
|
@@ -1106,11 +1074,6 @@ class Component extends Element_1.default {
|
|
|
1106
1074
|
}, topLevel);
|
|
1107
1075
|
}
|
|
1108
1076
|
}
|
|
1109
|
-
/**
|
|
1110
|
-
* Attaches all the tooltips provided the refs object.
|
|
1111
|
-
* @param {object} toolTipsRefs - The refs for the tooltips within your template.
|
|
1112
|
-
* @returns {void}
|
|
1113
|
-
*/
|
|
1114
1077
|
attachTooltips(toolTipsRefs) {
|
|
1115
1078
|
toolTipsRefs === null || toolTipsRefs === void 0 ? void 0 : toolTipsRefs.forEach((tooltip, index) => {
|
|
1116
1079
|
if (tooltip) {
|
|
@@ -1129,21 +1092,9 @@ class Component extends Element_1.default {
|
|
|
1129
1092
|
}
|
|
1130
1093
|
});
|
|
1131
1094
|
}
|
|
1132
|
-
/**
|
|
1133
|
-
* Create a new component modal for this component.
|
|
1134
|
-
* @param {HTMLElement} element - The element to attach the modal to.
|
|
1135
|
-
* @param {boolean} modalShouldBeOpened - TRUE if the modal should open immediately.
|
|
1136
|
-
* @param {any} currentValue - The current value of the component.
|
|
1137
|
-
* @returns {ComponentModal} - The created component modal.
|
|
1138
|
-
*/
|
|
1139
1095
|
createComponentModal(element, modalShouldBeOpened, currentValue) {
|
|
1140
1096
|
return new ComponentModal_1.default(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
|
|
1141
1097
|
}
|
|
1142
|
-
/**
|
|
1143
|
-
* Attaches all event listensers for this component to the DOM elements that were rendered.
|
|
1144
|
-
* @param {HTMLElement} element - The element to attach the listeners to.
|
|
1145
|
-
* @returns {Promise<void>} - Resolves when the component is done attaching to the DOM.
|
|
1146
|
-
*/
|
|
1147
1098
|
attach(element) {
|
|
1148
1099
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
1149
1100
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
@@ -1181,9 +1132,6 @@ class Component extends Element_1.default {
|
|
|
1181
1132
|
this.addons.forEach((addon) => addon.attach(element));
|
|
1182
1133
|
return Promise.resolve();
|
|
1183
1134
|
}
|
|
1184
|
-
/**
|
|
1185
|
-
* Restors the "focus" on a component after a redraw event has occured.
|
|
1186
|
-
*/
|
|
1187
1135
|
restoreFocus() {
|
|
1188
1136
|
var _a, _b, _c;
|
|
1189
1137
|
const isFocused = ((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.focusedComponent) === null || _b === void 0 ? void 0 : _b.path) === this.path;
|
|
@@ -1193,12 +1141,6 @@ class Component extends Element_1.default {
|
|
|
1193
1141
|
this.restoreCaretPosition();
|
|
1194
1142
|
}
|
|
1195
1143
|
}
|
|
1196
|
-
/**
|
|
1197
|
-
* Adds a keyboard shortcut to this component.
|
|
1198
|
-
* @param {HTMLElement} element - The element to attach the keyboard shortcut to.
|
|
1199
|
-
* @param {string} shortcut - The keyboard shortcut to add.
|
|
1200
|
-
* @returns {void}
|
|
1201
|
-
*/
|
|
1202
1144
|
addShortcut(element, shortcut) {
|
|
1203
1145
|
// Avoid infinite recursion.
|
|
1204
1146
|
if (!element || !this.root || (this.root === this)) {
|
|
@@ -1209,12 +1151,6 @@ class Component extends Element_1.default {
|
|
|
1209
1151
|
}
|
|
1210
1152
|
this.root.addShortcut(element, shortcut);
|
|
1211
1153
|
}
|
|
1212
|
-
/**
|
|
1213
|
-
* Removes a keyboard shortcut from this component.
|
|
1214
|
-
* @param {HTMLElement} element - The element to remove the keyboard shortcut from.
|
|
1215
|
-
* @param {string} shortcut - The keyboard shortcut to remove.
|
|
1216
|
-
* @returns {void}
|
|
1217
|
-
*/
|
|
1218
1154
|
removeShortcut(element, shortcut) {
|
|
1219
1155
|
// Avoid infinite recursion.
|
|
1220
1156
|
if (!element || (this.root === this)) {
|
|
@@ -1247,13 +1183,6 @@ class Component extends Element_1.default {
|
|
|
1247
1183
|
this.tooltip.destroy();
|
|
1248
1184
|
}
|
|
1249
1185
|
}
|
|
1250
|
-
/**
|
|
1251
|
-
* Determines if the component should be refreshed based on the path of another component that changed.
|
|
1252
|
-
* @param {string} refreshData - The path of the data that needs to trigger a refresh.
|
|
1253
|
-
* @param {boolean} changed - Flag that is true if the data has been changed.
|
|
1254
|
-
* @param {any} flags - The flags for the checkData procedure.
|
|
1255
|
-
* @returns {void}
|
|
1256
|
-
*/
|
|
1257
1186
|
checkRefresh(refreshData, changed, flags) {
|
|
1258
1187
|
const changePath = lodash_1.default.get(changed, 'instance.path', false);
|
|
1259
1188
|
// Don't let components change themselves.
|
|
@@ -1270,12 +1199,6 @@ class Component extends Element_1.default {
|
|
|
1270
1199
|
this.refresh(changed.value, changed, flags);
|
|
1271
1200
|
}
|
|
1272
1201
|
}
|
|
1273
|
-
/**
|
|
1274
|
-
* 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.
|
|
1275
|
-
* @param {Array<any>} changes - The list of components that have changed.
|
|
1276
|
-
* @param {any} flags - The checkData flags.
|
|
1277
|
-
* @returns {void}
|
|
1278
|
-
*/
|
|
1279
1202
|
checkRefreshOn(changes, flags = {}) {
|
|
1280
1203
|
changes = changes || [];
|
|
1281
1204
|
if (flags.noRefresh) {
|
|
@@ -1297,8 +1220,8 @@ class Component extends Element_1.default {
|
|
|
1297
1220
|
}
|
|
1298
1221
|
/**
|
|
1299
1222
|
* Refreshes the component with a new value.
|
|
1300
|
-
*
|
|
1301
|
-
* @
|
|
1223
|
+
*
|
|
1224
|
+
* @param value
|
|
1302
1225
|
*/
|
|
1303
1226
|
refresh(value) {
|
|
1304
1227
|
if (this.hasOwnProperty('refreshOnValue')) {
|
|
@@ -1321,8 +1244,8 @@ class Component extends Element_1.default {
|
|
|
1321
1244
|
* with the components data and returns true if they are in the same context.
|
|
1322
1245
|
*
|
|
1323
1246
|
* Different rows of the same EditGrid, for example, are in different contexts.
|
|
1324
|
-
*
|
|
1325
|
-
* @
|
|
1247
|
+
*
|
|
1248
|
+
* @param component
|
|
1326
1249
|
*/
|
|
1327
1250
|
inContext(component) {
|
|
1328
1251
|
if (component.data === this.data) {
|
|
@@ -1337,18 +1260,9 @@ class Component extends Element_1.default {
|
|
|
1337
1260
|
}
|
|
1338
1261
|
return false;
|
|
1339
1262
|
}
|
|
1340
|
-
/**
|
|
1341
|
-
* Determines if we are in "view" only mode.
|
|
1342
|
-
* @returns {boolean} - TRUE if we are in "view" only mode.
|
|
1343
|
-
*/
|
|
1344
1263
|
get viewOnly() {
|
|
1345
1264
|
return this.options.readOnly && this.options.viewAsHtml;
|
|
1346
1265
|
}
|
|
1347
|
-
/**
|
|
1348
|
-
* Sets the HTMLElement for this component.
|
|
1349
|
-
* @param {HTMLElement} element - The element that is attached to this component.
|
|
1350
|
-
* @returns {void}
|
|
1351
|
-
*/
|
|
1352
1266
|
setElement(element) {
|
|
1353
1267
|
if (this.element) {
|
|
1354
1268
|
delete this.element.component;
|
|
@@ -1356,10 +1270,6 @@ class Component extends Element_1.default {
|
|
|
1356
1270
|
}
|
|
1357
1271
|
this.element = element;
|
|
1358
1272
|
}
|
|
1359
|
-
/**
|
|
1360
|
-
* Creates an element to hold the "view only" version of this component.
|
|
1361
|
-
* @returns {HTMLElement} - The element for this component.
|
|
1362
|
-
*/
|
|
1363
1273
|
createViewOnlyElement() {
|
|
1364
1274
|
this.setElement(this.ce('dl', {
|
|
1365
1275
|
id: this.id
|
|
@@ -1370,18 +1280,14 @@ class Component extends Element_1.default {
|
|
|
1370
1280
|
}
|
|
1371
1281
|
return this.element;
|
|
1372
1282
|
}
|
|
1373
|
-
/**
|
|
1374
|
-
* The default value for the "view only" mode of a component if the value is not provided.
|
|
1375
|
-
* @returns {string} - The default value for this component.
|
|
1376
|
-
*/
|
|
1377
1283
|
get defaultViewOnlyValue() {
|
|
1378
1284
|
return '-';
|
|
1379
1285
|
}
|
|
1380
1286
|
/**
|
|
1381
1287
|
* Uses the widget to determine the output string.
|
|
1382
|
-
*
|
|
1383
|
-
* @param
|
|
1384
|
-
* @
|
|
1288
|
+
*
|
|
1289
|
+
* @param value
|
|
1290
|
+
* @return {*}
|
|
1385
1291
|
*/
|
|
1386
1292
|
getWidgetValueAsString(value, options) {
|
|
1387
1293
|
const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
|
|
@@ -1406,12 +1312,6 @@ class Component extends Element_1.default {
|
|
|
1406
1312
|
const widget = this.refs.input[0].widget;
|
|
1407
1313
|
return widget.getValueAsString(value, options);
|
|
1408
1314
|
}
|
|
1409
|
-
/**
|
|
1410
|
-
* Returns the value of the component as a string.
|
|
1411
|
-
* @param {any} value - The value for this component.
|
|
1412
|
-
* @param {any} options - The options for this component.
|
|
1413
|
-
* @returns {string} - The string representation of the value of this component.
|
|
1414
|
-
*/
|
|
1415
1315
|
getValueAsString(value, options) {
|
|
1416
1316
|
if (!value) {
|
|
1417
1317
|
return '';
|
|
@@ -1429,32 +1329,20 @@ class Component extends Element_1.default {
|
|
|
1429
1329
|
const stringValue = value.toString();
|
|
1430
1330
|
return this.sanitize(stringValue);
|
|
1431
1331
|
}
|
|
1432
|
-
/**
|
|
1433
|
-
* Returns the string representation "view" of the component value.
|
|
1434
|
-
* @param {any} value - The value of the component.
|
|
1435
|
-
* @param {any} options - The options for this component.
|
|
1436
|
-
* @returns {string} - The string representation of the value of this component.
|
|
1437
|
-
*/
|
|
1438
1332
|
getView(value, options) {
|
|
1439
1333
|
if (this.component.protected) {
|
|
1440
1334
|
return '--- PROTECTED ---';
|
|
1441
1335
|
}
|
|
1442
1336
|
return this.getValueAsString(value, options);
|
|
1443
1337
|
}
|
|
1444
|
-
/**
|
|
1445
|
-
* Updates the items list for this component. Useful for Select and other List component types.
|
|
1446
|
-
* @param {...any} args - The arguments to pass to the onChange event.
|
|
1447
|
-
* @returns {void}
|
|
1448
|
-
*/
|
|
1449
1338
|
updateItems(...args) {
|
|
1450
1339
|
this.restoreValue();
|
|
1451
1340
|
this.onChange(...args);
|
|
1452
1341
|
}
|
|
1453
1342
|
/**
|
|
1454
|
-
*
|
|
1455
|
-
* @param {
|
|
1456
|
-
* @
|
|
1457
|
-
* @returns {any} - The value of the item.
|
|
1343
|
+
* @param {*} data
|
|
1344
|
+
* @param {boolean} [forceUseValue=false] - if true, return 'value' property of the data
|
|
1345
|
+
* @return {*}
|
|
1458
1346
|
*/
|
|
1459
1347
|
itemValue(data, forceUseValue = false) {
|
|
1460
1348
|
if (lodash_1.default.isObject(data) && !lodash_1.default.isArray(data)) {
|
|
@@ -1467,11 +1355,6 @@ class Component extends Element_1.default {
|
|
|
1467
1355
|
}
|
|
1468
1356
|
return data;
|
|
1469
1357
|
}
|
|
1470
|
-
/**
|
|
1471
|
-
* Returns the item value for html mode.
|
|
1472
|
-
* @param {any} value - The value for this component.
|
|
1473
|
-
* @returns {any} - The value of the item for html mode.
|
|
1474
|
-
*/
|
|
1475
1358
|
itemValueForHTMLMode(value) {
|
|
1476
1359
|
if (Array.isArray(value)) {
|
|
1477
1360
|
const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
@@ -1479,13 +1362,6 @@ class Component extends Element_1.default {
|
|
|
1479
1362
|
}
|
|
1480
1363
|
return this.itemValue(value);
|
|
1481
1364
|
}
|
|
1482
|
-
/**
|
|
1483
|
-
* Creates a modal to input the value of this component.
|
|
1484
|
-
* @param {HTMLElement} element - The element to attach the modal to.
|
|
1485
|
-
* @param {any} attr - A list of attributes to add to the modal.
|
|
1486
|
-
* @param {boolean} confirm - If we should add a confirmation to the modal that keeps it from closing unless confirmed.
|
|
1487
|
-
* @returns {HTMLElement} - The created modal element.
|
|
1488
|
-
*/
|
|
1489
1365
|
createModal(element, attr, confirm) {
|
|
1490
1366
|
const dialog = this.ce('div', attr || {});
|
|
1491
1367
|
this.setContent(dialog, this.renderTemplate('dialog'));
|
|
@@ -1521,10 +1397,6 @@ class Component extends Element_1.default {
|
|
|
1521
1397
|
this.addEventListener(dialog.refs.dialogClose, 'click', handleCloseClick);
|
|
1522
1398
|
return dialog;
|
|
1523
1399
|
}
|
|
1524
|
-
/**
|
|
1525
|
-
* Uses CSS classes to show or hide an element.
|
|
1526
|
-
* @returns {boolean} - TRUE if the element has been css removed.
|
|
1527
|
-
*/
|
|
1528
1400
|
get optimizeRedraw() {
|
|
1529
1401
|
if (this.options.optimizeRedraw && this.element && !this.visible) {
|
|
1530
1402
|
this.addClass(this.element, 'formio-removed');
|
|
@@ -1562,7 +1434,7 @@ class Component extends Element_1.default {
|
|
|
1562
1434
|
}
|
|
1563
1435
|
/**
|
|
1564
1436
|
* Build the custom style from the layout values
|
|
1565
|
-
* @
|
|
1437
|
+
* @return {string} - The custom style
|
|
1566
1438
|
*/
|
|
1567
1439
|
get customStyle() {
|
|
1568
1440
|
let customCSS = '';
|
|
@@ -1573,31 +1445,24 @@ class Component extends Element_1.default {
|
|
|
1573
1445
|
});
|
|
1574
1446
|
return customCSS;
|
|
1575
1447
|
}
|
|
1576
|
-
/**
|
|
1577
|
-
* Returns the component condition operator settings if available.
|
|
1578
|
-
* @returns {object} - The component condition operator settings.
|
|
1579
|
-
*/
|
|
1580
1448
|
static get serverConditionSettings() {
|
|
1581
1449
|
return Component.conditionOperatorsSettings;
|
|
1582
1450
|
}
|
|
1583
|
-
/**
|
|
1584
|
-
* Returns if the application is on a mobile device.
|
|
1585
|
-
* @returns {boolean} - TRUE if the application is on a mobile device.
|
|
1586
|
-
*/
|
|
1587
1451
|
get isMobile() {
|
|
1588
1452
|
return (0, ismobilejs_1.default)();
|
|
1589
1453
|
}
|
|
1590
1454
|
/**
|
|
1591
1455
|
* Returns the outside wrapping element of this component.
|
|
1592
|
-
* @returns {HTMLElement}
|
|
1456
|
+
* @returns {HTMLElement}
|
|
1593
1457
|
*/
|
|
1594
1458
|
getElement() {
|
|
1595
1459
|
return this.element;
|
|
1596
1460
|
}
|
|
1597
1461
|
/**
|
|
1598
1462
|
* Create an evaluation context for all script executions and interpolations.
|
|
1599
|
-
*
|
|
1600
|
-
* @
|
|
1463
|
+
*
|
|
1464
|
+
* @param additional
|
|
1465
|
+
* @return {*}
|
|
1601
1466
|
*/
|
|
1602
1467
|
evalContext(additional) {
|
|
1603
1468
|
return super.evalContext(Object.assign({
|
|
@@ -1619,29 +1484,18 @@ class Component extends Element_1.default {
|
|
|
1619
1484
|
}
|
|
1620
1485
|
/**
|
|
1621
1486
|
* Sets the pristine flag for this component.
|
|
1622
|
-
*
|
|
1487
|
+
*
|
|
1488
|
+
* @param pristine {boolean} - TRUE to make pristine, FALSE not pristine.
|
|
1623
1489
|
*/
|
|
1624
1490
|
setPristine(pristine) {
|
|
1625
1491
|
this.pristine = pristine;
|
|
1626
1492
|
}
|
|
1627
|
-
/**
|
|
1628
|
-
* Returns if the component is pristine.
|
|
1629
|
-
* @returns {boolean} - TRUE if the component is pristine.
|
|
1630
|
-
*/
|
|
1631
1493
|
get isPristine() {
|
|
1632
1494
|
return this.pristine;
|
|
1633
1495
|
}
|
|
1634
|
-
/**
|
|
1635
|
-
* Sets the dirty flag for this component.
|
|
1636
|
-
* @param {boolean} dirty - TRUE to make dirty, FALSE not dirty.
|
|
1637
|
-
*/
|
|
1638
1496
|
setDirty(dirty) {
|
|
1639
1497
|
this.dirty = dirty;
|
|
1640
1498
|
}
|
|
1641
|
-
/**
|
|
1642
|
-
* Returns if the component is dirty.
|
|
1643
|
-
* @returns {boolean} - TRUE if the component is dirty.
|
|
1644
|
-
*/
|
|
1645
1499
|
get isDirty() {
|
|
1646
1500
|
return this.dirty;
|
|
1647
1501
|
}
|
|
@@ -1655,23 +1509,12 @@ class Component extends Element_1.default {
|
|
|
1655
1509
|
this.restoreValue();
|
|
1656
1510
|
this.triggerRootChange();
|
|
1657
1511
|
}
|
|
1658
|
-
/**
|
|
1659
|
-
* Returns the icon class for a given icon name.
|
|
1660
|
-
* @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.
|
|
1661
|
-
* @param {boolean} spinning - If the component should be spinning.
|
|
1662
|
-
* @returns {string} - The icon class for the equivalent icon in the iconset we are using.
|
|
1663
|
-
*/
|
|
1664
1512
|
iconClass(name, spinning) {
|
|
1665
1513
|
const iconset = this.options.iconset || Templates_1.default.current.defaultIconset || 'fa';
|
|
1666
1514
|
return Templates_1.default.current.hasOwnProperty('iconClass')
|
|
1667
1515
|
? Templates_1.default.current.iconClass(iconset, name, spinning)
|
|
1668
1516
|
: this.options.iconset === 'fa' ? Templates_1.default.defaultTemplates.iconClass(iconset, name, spinning) : name;
|
|
1669
1517
|
}
|
|
1670
|
-
/**
|
|
1671
|
-
* Returns the size css class names for our current template.
|
|
1672
|
-
* @param {string} size - The size class name for the default iconset.
|
|
1673
|
-
* @returns {string} - The size class for our component.
|
|
1674
|
-
*/
|
|
1675
1518
|
size(size) {
|
|
1676
1519
|
return Templates_1.default.current.hasOwnProperty('size')
|
|
1677
1520
|
? Templates_1.default.current.size(size)
|
|
@@ -1684,23 +1527,15 @@ class Component extends Element_1.default {
|
|
|
1684
1527
|
get name() {
|
|
1685
1528
|
return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
|
|
1686
1529
|
}
|
|
1687
|
-
/**
|
|
1688
|
-
* Returns the visible errors for this component.
|
|
1689
|
-
* @returns {Array<object>} - The visible errors for this component.
|
|
1690
|
-
*/
|
|
1691
1530
|
get visibleErrors() {
|
|
1692
1531
|
return this._visibleErrors;
|
|
1693
1532
|
}
|
|
1694
|
-
/**
|
|
1695
|
-
* Returns all the errors for this component, visible or not.
|
|
1696
|
-
* @returns {Array<object>} - All the errors for this component.
|
|
1697
|
-
*/
|
|
1698
1533
|
get errors() {
|
|
1699
1534
|
return this._errors;
|
|
1700
1535
|
}
|
|
1701
1536
|
/**
|
|
1702
1537
|
* Returns the error label for this component.
|
|
1703
|
-
* @
|
|
1538
|
+
* @return {*}
|
|
1704
1539
|
*/
|
|
1705
1540
|
get errorLabel() {
|
|
1706
1541
|
return this.t(this.component.errorLabel
|
|
@@ -1710,20 +1545,12 @@ class Component extends Element_1.default {
|
|
|
1710
1545
|
}
|
|
1711
1546
|
/**
|
|
1712
1547
|
* Get the error message provided a certain type of error.
|
|
1713
|
-
* @param
|
|
1714
|
-
* @
|
|
1548
|
+
* @param type
|
|
1549
|
+
* @return {*}
|
|
1715
1550
|
*/
|
|
1716
1551
|
errorMessage(type) {
|
|
1717
1552
|
return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
|
|
1718
1553
|
}
|
|
1719
|
-
/**
|
|
1720
|
-
* Sets the content, innerHTML, of an element to the sanitized content.
|
|
1721
|
-
* @param {HTMLElement} element - The element to set the innerHTML to.
|
|
1722
|
-
* @param {string} content - The HTML string content that we wish to set.
|
|
1723
|
-
* @param {boolean} forceSanitize - If we should force the content to be sanitized.
|
|
1724
|
-
* @param {any} sanitizeOptions - The options for the sanitize function.
|
|
1725
|
-
* @returns {boolean} - TRUE if the content was sanitized and set.
|
|
1726
|
-
*/
|
|
1727
1554
|
setContent(element, content, forceSanitize, sanitizeOptions) {
|
|
1728
1555
|
if (element instanceof HTMLElement) {
|
|
1729
1556
|
element.innerHTML = this.sanitize(content, forceSanitize, sanitizeOptions);
|
|
@@ -1731,9 +1558,6 @@ class Component extends Element_1.default {
|
|
|
1731
1558
|
}
|
|
1732
1559
|
return false;
|
|
1733
1560
|
}
|
|
1734
|
-
/**
|
|
1735
|
-
* Restores the caret position in the input element after a refresh occurs.
|
|
1736
|
-
*/
|
|
1737
1561
|
restoreCaretPosition() {
|
|
1738
1562
|
var _a, _b, _c;
|
|
1739
1563
|
if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.currentSelection) {
|
|
@@ -1756,10 +1580,6 @@ class Component extends Element_1.default {
|
|
|
1756
1580
|
}
|
|
1757
1581
|
}
|
|
1758
1582
|
}
|
|
1759
|
-
/**
|
|
1760
|
-
* Redraw the component.
|
|
1761
|
-
* @returns {Promise<void>} - A promise that resolves when the component is done redrawing.
|
|
1762
|
-
*/
|
|
1763
1583
|
redraw() {
|
|
1764
1584
|
// Don't bother if we have not built yet.
|
|
1765
1585
|
if (!this.element || !this.element.parentNode || this.optimizeRedraw) {
|
|
@@ -1775,54 +1595,29 @@ class Component extends Element_1.default {
|
|
|
1775
1595
|
this.setElement(parent.children[index]);
|
|
1776
1596
|
return this.attach(this.element);
|
|
1777
1597
|
}
|
|
1778
|
-
/**
|
|
1779
|
-
* Rebuild and redraw a component.
|
|
1780
|
-
* @returns {Promise<void>} - A promise that resolves when the component is done rebuilding and redrawing.
|
|
1781
|
-
*/
|
|
1782
1598
|
rebuild() {
|
|
1783
1599
|
this.destroy();
|
|
1784
1600
|
this.init();
|
|
1785
1601
|
this.visible = this.conditionallyVisible(null, null);
|
|
1786
1602
|
return this.redraw();
|
|
1787
1603
|
}
|
|
1788
|
-
/**
|
|
1789
|
-
* Removes all event listeners attached to this component.
|
|
1790
|
-
*/
|
|
1791
1604
|
removeEventListeners() {
|
|
1792
1605
|
super.removeEventListeners();
|
|
1793
1606
|
this.tooltips.forEach(tooltip => tooltip.destroy());
|
|
1794
1607
|
this.tooltips = [];
|
|
1795
1608
|
}
|
|
1796
|
-
/**
|
|
1797
|
-
* Returns if the dom node has the classes provided.
|
|
1798
|
-
* @param {HTMLElement} element - The element to check for the class.
|
|
1799
|
-
* @param {string} className - The name of the class to check.
|
|
1800
|
-
* @returns {boolean|void} - TRUE if the element has the class.
|
|
1801
|
-
*/
|
|
1802
1609
|
hasClass(element, className) {
|
|
1803
1610
|
if (!element) {
|
|
1804
1611
|
return;
|
|
1805
1612
|
}
|
|
1806
1613
|
return super.hasClass(element, this.transform('class', className));
|
|
1807
1614
|
}
|
|
1808
|
-
/**
|
|
1809
|
-
* Adds a class to an HTML element.
|
|
1810
|
-
* @param {HTMLElement} element - The dom element to add the class to.
|
|
1811
|
-
* @param {string} className - The class name you wish to add.
|
|
1812
|
-
* @returns {this|void} - The component instance.
|
|
1813
|
-
*/
|
|
1814
1615
|
addClass(element, className) {
|
|
1815
1616
|
if (!element) {
|
|
1816
1617
|
return;
|
|
1817
1618
|
}
|
|
1818
1619
|
return super.addClass(element, this.transform('class', className));
|
|
1819
1620
|
}
|
|
1820
|
-
/**
|
|
1821
|
-
* Removes a class from an element.
|
|
1822
|
-
* @param {HTMLElement} element - The element to remove the class from.
|
|
1823
|
-
* @param {string} className - The class name to remove.
|
|
1824
|
-
* @returns {this|void} - The component instance.
|
|
1825
|
-
*/
|
|
1826
1621
|
removeClass(element, className) {
|
|
1827
1622
|
if (!element) {
|
|
1828
1623
|
return;
|
|
@@ -1831,7 +1626,8 @@ class Component extends Element_1.default {
|
|
|
1831
1626
|
}
|
|
1832
1627
|
/**
|
|
1833
1628
|
* Determines if this component has a condition defined.
|
|
1834
|
-
*
|
|
1629
|
+
*
|
|
1630
|
+
* @return {null}
|
|
1835
1631
|
*/
|
|
1836
1632
|
hasCondition() {
|
|
1837
1633
|
if (this._hasCondition !== null) {
|
|
@@ -1842,9 +1638,9 @@ class Component extends Element_1.default {
|
|
|
1842
1638
|
}
|
|
1843
1639
|
/**
|
|
1844
1640
|
* Check if this component is conditionally visible.
|
|
1845
|
-
*
|
|
1846
|
-
* @param
|
|
1847
|
-
* @
|
|
1641
|
+
*
|
|
1642
|
+
* @param data
|
|
1643
|
+
* @return {boolean}
|
|
1848
1644
|
*/
|
|
1849
1645
|
conditionallyVisible(data, row) {
|
|
1850
1646
|
data = data || this.rootValue;
|
|
@@ -1859,19 +1655,16 @@ class Component extends Element_1.default {
|
|
|
1859
1655
|
* Checks the condition of this component.
|
|
1860
1656
|
*
|
|
1861
1657
|
* TODO: Switch row and data parameters to be consistent with other methods.
|
|
1862
|
-
*
|
|
1863
|
-
* @param
|
|
1864
|
-
* @
|
|
1658
|
+
*
|
|
1659
|
+
* @param row - The row contextual data.
|
|
1660
|
+
* @param data - The global data object.
|
|
1661
|
+
* @return {boolean} - True if the condition applies to this component.
|
|
1865
1662
|
*/
|
|
1866
1663
|
checkCondition(row, data) {
|
|
1867
1664
|
return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
|
|
1868
1665
|
}
|
|
1869
1666
|
/**
|
|
1870
1667
|
* Check for conditionals and hide/show the element based on those conditions.
|
|
1871
|
-
* @param {any} data - The data to check against.
|
|
1872
|
-
* @param {any} flags - The flags passed to checkData function.
|
|
1873
|
-
* @param {any} row - The row data to check against.
|
|
1874
|
-
* @returns {boolean} - TRUE if the component is visible.
|
|
1875
1668
|
*/
|
|
1876
1669
|
checkComponentConditions(data, flags, row) {
|
|
1877
1670
|
data = data || this.rootValue;
|
|
@@ -1889,10 +1682,8 @@ class Component extends Element_1.default {
|
|
|
1889
1682
|
}
|
|
1890
1683
|
/**
|
|
1891
1684
|
* Checks conditions for this component and any sub components.
|
|
1892
|
-
* @param
|
|
1893
|
-
* @
|
|
1894
|
-
* @param {any} row - The row data to check against.
|
|
1895
|
-
* @returns {boolean} - TRUE if the component is visible.
|
|
1685
|
+
* @param args
|
|
1686
|
+
* @return {boolean}
|
|
1896
1687
|
*/
|
|
1897
1688
|
checkConditions(data, flags, row) {
|
|
1898
1689
|
data = data || this.rootValue;
|
|
@@ -1900,20 +1691,17 @@ class Component extends Element_1.default {
|
|
|
1900
1691
|
row = row || this.data;
|
|
1901
1692
|
return this.checkComponentConditions(data, flags, row);
|
|
1902
1693
|
}
|
|
1903
|
-
/**
|
|
1904
|
-
* Returns the component logic if applicable.
|
|
1905
|
-
* @returns {Array<object>} - The component logic.
|
|
1906
|
-
*/
|
|
1907
1694
|
get logic() {
|
|
1908
1695
|
return this.component.logic || [];
|
|
1909
1696
|
}
|
|
1910
1697
|
/**
|
|
1911
1698
|
* Check all triggers and apply necessary actions.
|
|
1912
|
-
*
|
|
1913
|
-
* @param
|
|
1914
|
-
* @returns {boolean|void} - TRUE if the component was altered.
|
|
1699
|
+
*
|
|
1700
|
+
* @param data
|
|
1915
1701
|
*/
|
|
1916
|
-
fieldLogic(data
|
|
1702
|
+
fieldLogic(data, row) {
|
|
1703
|
+
data = data || this.rootValue;
|
|
1704
|
+
row = row || this.data;
|
|
1917
1705
|
const logics = this.logic;
|
|
1918
1706
|
// If there aren't logic, don't go further.
|
|
1919
1707
|
if (logics.length === 0) {
|
|
@@ -1936,10 +1724,6 @@ class Component extends Element_1.default {
|
|
|
1936
1724
|
}
|
|
1937
1725
|
return changed;
|
|
1938
1726
|
}
|
|
1939
|
-
/**
|
|
1940
|
-
* Retuns if the browser is Internet Explorer.
|
|
1941
|
-
* @returns {boolean} - TRUE if the browser is IE.
|
|
1942
|
-
*/
|
|
1943
1727
|
isIE() {
|
|
1944
1728
|
if (typeof window === 'undefined') {
|
|
1945
1729
|
return false;
|
|
@@ -1964,24 +1748,9 @@ class Component extends Element_1.default {
|
|
|
1964
1748
|
// other browser
|
|
1965
1749
|
return false;
|
|
1966
1750
|
}
|
|
1967
|
-
/**
|
|
1968
|
-
* Defines the logic action value through evaluation.
|
|
1969
|
-
* @param {object} action - The action within the Logic system to perform.
|
|
1970
|
-
* @param {object} argsObject - The arguments to pass to the evaluation.
|
|
1971
|
-
* @returns {any} - The result of the evaluation.
|
|
1972
|
-
*/
|
|
1973
1751
|
defineActionValue(action, argsObject) {
|
|
1974
1752
|
return this.evaluate(action.value, argsObject, 'value');
|
|
1975
1753
|
}
|
|
1976
|
-
/**
|
|
1977
|
-
* Apply the actions of Logic for a component once the conditions have been met.
|
|
1978
|
-
* @param {object} newComponent - The new component to apply the actions to.
|
|
1979
|
-
* @param {Array<object>} actions - An array of actions
|
|
1980
|
-
* @param {any} result - The result of the conditional check in order to evaluate the actions.
|
|
1981
|
-
* @param {any} row - The contextual row data for this component.
|
|
1982
|
-
* @param {any} data - The global data object for the submission.
|
|
1983
|
-
* @returns {boolean} - TRUE if the component was altered.
|
|
1984
|
-
*/
|
|
1985
1754
|
applyActions(newComponent, actions, result, row, data) {
|
|
1986
1755
|
data = data || this.rootValue;
|
|
1987
1756
|
row = row || this.data;
|
|
@@ -2061,8 +1830,8 @@ class Component extends Element_1.default {
|
|
|
2061
1830
|
}
|
|
2062
1831
|
/**
|
|
2063
1832
|
* Add a new input error to this element.
|
|
2064
|
-
*
|
|
2065
|
-
* @
|
|
1833
|
+
*
|
|
1834
|
+
* @param {{level: string, message: string}[]} messages
|
|
2066
1835
|
*/
|
|
2067
1836
|
addMessages(messages) {
|
|
2068
1837
|
if (!messages) {
|
|
@@ -2085,15 +1854,6 @@ class Component extends Element_1.default {
|
|
|
2085
1854
|
}).join(''));
|
|
2086
1855
|
}
|
|
2087
1856
|
}
|
|
2088
|
-
/**
|
|
2089
|
-
* Sets the form input widget error classes.
|
|
2090
|
-
* @param {Array<HTMLElement>} elements - An array of DOM elements to set the error classes on.
|
|
2091
|
-
* @param {boolean} dirty - If the input is dirty.
|
|
2092
|
-
* @param {boolean} hasErrors - If the input has errors.
|
|
2093
|
-
* @param {boolean} hasMessages - If the input has messages.
|
|
2094
|
-
* @param {HTMLElement} element - The wrapper element for all the other elements passed in first argument.
|
|
2095
|
-
* @returns {void}
|
|
2096
|
-
*/
|
|
2097
1857
|
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
2098
1858
|
this.clearErrorClasses();
|
|
2099
1859
|
elements.forEach((element) => {
|
|
@@ -2120,12 +1880,6 @@ class Component extends Element_1.default {
|
|
|
2120
1880
|
this.addClass(element, 'has-message');
|
|
2121
1881
|
}
|
|
2122
1882
|
}
|
|
2123
|
-
/**
|
|
2124
|
-
* Adds the classes necessary to mark an element as invalid.
|
|
2125
|
-
* @param {HTMLElement} element - The element you wish to add the invalid classes to.
|
|
2126
|
-
* @param {boolean} invalid - TRUE if the component is invalid, FALSE otherwise.
|
|
2127
|
-
* @returns {void}
|
|
2128
|
-
*/
|
|
2129
1883
|
setElementInvalid(element, invalid) {
|
|
2130
1884
|
if (!element)
|
|
2131
1885
|
return;
|
|
@@ -2137,9 +1891,6 @@ class Component extends Element_1.default {
|
|
|
2137
1891
|
}
|
|
2138
1892
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
|
2139
1893
|
}
|
|
2140
|
-
/**
|
|
2141
|
-
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
|
2142
|
-
*/
|
|
2143
1894
|
clearOnHide() {
|
|
2144
1895
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
2145
1896
|
if (
|
|
@@ -2159,10 +1910,6 @@ class Component extends Element_1.default {
|
|
|
2159
1910
|
}
|
|
2160
1911
|
}
|
|
2161
1912
|
}
|
|
2162
|
-
/**
|
|
2163
|
-
* Triggers a debounced onChange event for the root component (usually Webform).
|
|
2164
|
-
* @param {...any} args - The arguments to pass to the onChange event.
|
|
2165
|
-
*/
|
|
2166
1913
|
triggerRootChange(...args) {
|
|
2167
1914
|
if (this.options.onChange) {
|
|
2168
1915
|
this.options.onChange(...args);
|
|
@@ -2171,13 +1918,6 @@ class Component extends Element_1.default {
|
|
|
2171
1918
|
this.root.triggerChange(...args);
|
|
2172
1919
|
}
|
|
2173
1920
|
}
|
|
2174
|
-
/**
|
|
2175
|
-
* Called when the component value has been changed. This will then trigger the root level onChange handler which
|
|
2176
|
-
* propagates the checkData methods for the full component tree.
|
|
2177
|
-
* @param {any} flags - The flags for the change event propagation.
|
|
2178
|
-
* @param {boolean} fromRoot - If the change event is from the root component.
|
|
2179
|
-
* @returns {boolean} - TRUE if the component has changed.
|
|
2180
|
-
*/
|
|
2181
1921
|
onChange(flags, fromRoot) {
|
|
2182
1922
|
flags = flags || {};
|
|
2183
1923
|
if (flags.modified) {
|
|
@@ -2307,7 +2047,7 @@ class Component extends Element_1.default {
|
|
|
2307
2047
|
return Promise.reject();
|
|
2308
2048
|
}
|
|
2309
2049
|
this.quill = new Quill(element, isIEBrowser ? Object.assign(Object.assign({}, settings), { modules: {} }) : settings);
|
|
2310
|
-
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ
|
|
2050
|
+
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ **/
|
|
2311
2051
|
const txtArea = document.createElement('textarea');
|
|
2312
2052
|
txtArea.setAttribute('class', 'quill-source-code');
|
|
2313
2053
|
this.quill.addContainer('ql-custom').appendChild(txtArea);
|
|
@@ -2321,7 +2061,7 @@ class Component extends Element_1.default {
|
|
|
2321
2061
|
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2322
2062
|
});
|
|
2323
2063
|
}
|
|
2324
|
-
/** END CODEBLOCK
|
|
2064
|
+
/** END CODEBLOCK **/
|
|
2325
2065
|
// Make sure to select cursor when they click on the element.
|
|
2326
2066
|
this.addEventListener(element, 'click', () => this.quill.focus());
|
|
2327
2067
|
// Allows users to skip toolbar items when tabbing though form
|
|
@@ -2369,22 +2109,23 @@ class Component extends Element_1.default {
|
|
|
2369
2109
|
}
|
|
2370
2110
|
/**
|
|
2371
2111
|
* The empty value for this component.
|
|
2372
|
-
*
|
|
2112
|
+
*
|
|
2113
|
+
* @return {null}
|
|
2373
2114
|
*/
|
|
2374
2115
|
get emptyValue() {
|
|
2375
2116
|
return null;
|
|
2376
2117
|
}
|
|
2377
2118
|
/**
|
|
2378
2119
|
* Returns if this component has a value set.
|
|
2379
|
-
*
|
|
2380
|
-
* @returns {boolean} - TRUE if a value is set.
|
|
2120
|
+
*
|
|
2381
2121
|
*/
|
|
2382
2122
|
hasValue(data) {
|
|
2383
2123
|
return !lodash_1.default.isUndefined(lodash_1.default.get(data || this.data, this.key));
|
|
2384
2124
|
}
|
|
2385
2125
|
/**
|
|
2386
2126
|
* Get the data value at the root level.
|
|
2387
|
-
*
|
|
2127
|
+
*
|
|
2128
|
+
* @return {*}
|
|
2388
2129
|
*/
|
|
2389
2130
|
get rootValue() {
|
|
2390
2131
|
return this.root ? this.root.data : this.data;
|
|
@@ -2394,7 +2135,7 @@ class Component extends Element_1.default {
|
|
|
2394
2135
|
}
|
|
2395
2136
|
/**
|
|
2396
2137
|
* Get the static value of this component.
|
|
2397
|
-
* @
|
|
2138
|
+
* @return {*}
|
|
2398
2139
|
*/
|
|
2399
2140
|
get dataValue() {
|
|
2400
2141
|
if (!this.key ||
|
|
@@ -2412,7 +2153,8 @@ class Component extends Element_1.default {
|
|
|
2412
2153
|
}
|
|
2413
2154
|
/**
|
|
2414
2155
|
* Sets the static value of this component.
|
|
2415
|
-
*
|
|
2156
|
+
*
|
|
2157
|
+
* @param value
|
|
2416
2158
|
*/
|
|
2417
2159
|
set dataValue(value) {
|
|
2418
2160
|
if (!this.allowData ||
|
|
@@ -2432,8 +2174,8 @@ class Component extends Element_1.default {
|
|
|
2432
2174
|
}
|
|
2433
2175
|
/**
|
|
2434
2176
|
* Splice a value from the dataValue.
|
|
2435
|
-
*
|
|
2436
|
-
* @param
|
|
2177
|
+
*
|
|
2178
|
+
* @param index
|
|
2437
2179
|
*/
|
|
2438
2180
|
splice(index, flags = {}) {
|
|
2439
2181
|
if (this.hasValue()) {
|
|
@@ -2501,7 +2243,8 @@ class Component extends Element_1.default {
|
|
|
2501
2243
|
}
|
|
2502
2244
|
/**
|
|
2503
2245
|
* Get the input value of this component.
|
|
2504
|
-
*
|
|
2246
|
+
*
|
|
2247
|
+
* @return {*}
|
|
2505
2248
|
*/
|
|
2506
2249
|
getValue() {
|
|
2507
2250
|
if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
@@ -2523,8 +2266,9 @@ class Component extends Element_1.default {
|
|
|
2523
2266
|
}
|
|
2524
2267
|
/**
|
|
2525
2268
|
* Get the value at a specific index.
|
|
2526
|
-
*
|
|
2527
|
-
* @
|
|
2269
|
+
*
|
|
2270
|
+
* @param index
|
|
2271
|
+
* @returns {*}
|
|
2528
2272
|
*/
|
|
2529
2273
|
getValueAt(index) {
|
|
2530
2274
|
const input = this.performInputMapping(this.refs.input[index]);
|
|
@@ -2532,9 +2276,11 @@ class Component extends Element_1.default {
|
|
|
2532
2276
|
}
|
|
2533
2277
|
/**
|
|
2534
2278
|
* Set the value of this component.
|
|
2535
|
-
*
|
|
2536
|
-
* @param
|
|
2537
|
-
* @
|
|
2279
|
+
*
|
|
2280
|
+
* @param value
|
|
2281
|
+
* @param flags
|
|
2282
|
+
*
|
|
2283
|
+
* @return {boolean} - If the value changed.
|
|
2538
2284
|
*/
|
|
2539
2285
|
setValue(value, flags = {}) {
|
|
2540
2286
|
const changed = this.updateValue(value, flags);
|
|
@@ -2565,9 +2311,9 @@ class Component extends Element_1.default {
|
|
|
2565
2311
|
}
|
|
2566
2312
|
/**
|
|
2567
2313
|
* Set the value at a specific index.
|
|
2568
|
-
*
|
|
2569
|
-
* @param
|
|
2570
|
-
* @param
|
|
2314
|
+
*
|
|
2315
|
+
* @param index
|
|
2316
|
+
* @param value
|
|
2571
2317
|
*/
|
|
2572
2318
|
setValueAt(index, value, flags = {}) {
|
|
2573
2319
|
if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
|
|
@@ -2614,8 +2360,9 @@ class Component extends Element_1.default {
|
|
|
2614
2360
|
}
|
|
2615
2361
|
/**
|
|
2616
2362
|
* Normalize values coming into updateValue.
|
|
2617
|
-
*
|
|
2618
|
-
* @
|
|
2363
|
+
*
|
|
2364
|
+
* @param value
|
|
2365
|
+
* @return {*}
|
|
2619
2366
|
*/
|
|
2620
2367
|
normalizeValue(value) {
|
|
2621
2368
|
if (this.component.multiple && !Array.isArray(value)) {
|
|
@@ -2625,9 +2372,8 @@ class Component extends Element_1.default {
|
|
|
2625
2372
|
}
|
|
2626
2373
|
/**
|
|
2627
2374
|
* Update a value of this component.
|
|
2628
|
-
*
|
|
2629
|
-
* @param
|
|
2630
|
-
* @returns {boolean} - If the value changed.
|
|
2375
|
+
*
|
|
2376
|
+
* @param flags
|
|
2631
2377
|
*/
|
|
2632
2378
|
updateComponentValue(value, flags = {}) {
|
|
2633
2379
|
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
@@ -2646,8 +2392,9 @@ class Component extends Element_1.default {
|
|
|
2646
2392
|
}
|
|
2647
2393
|
/**
|
|
2648
2394
|
* Updates the value of this component plus all sub-components.
|
|
2649
|
-
*
|
|
2650
|
-
* @
|
|
2395
|
+
*
|
|
2396
|
+
* @param args
|
|
2397
|
+
* @return {boolean}
|
|
2651
2398
|
*/
|
|
2652
2399
|
updateValue(...args) {
|
|
2653
2400
|
return this.updateComponentValue(...args);
|
|
@@ -2673,9 +2420,10 @@ class Component extends Element_1.default {
|
|
|
2673
2420
|
}
|
|
2674
2421
|
/**
|
|
2675
2422
|
* Determine if the value of this component has changed.
|
|
2676
|
-
*
|
|
2677
|
-
* @param
|
|
2678
|
-
* @
|
|
2423
|
+
*
|
|
2424
|
+
* @param newValue
|
|
2425
|
+
* @param oldValue
|
|
2426
|
+
* @return {boolean}
|
|
2679
2427
|
*/
|
|
2680
2428
|
hasChanged(newValue, oldValue) {
|
|
2681
2429
|
if (((newValue === undefined) || (newValue === null)) &&
|
|
@@ -2693,9 +2441,8 @@ class Component extends Element_1.default {
|
|
|
2693
2441
|
}
|
|
2694
2442
|
/**
|
|
2695
2443
|
* Update the value on change.
|
|
2696
|
-
*
|
|
2697
|
-
* @param
|
|
2698
|
-
* @returns {boolean} - If the value changed.
|
|
2444
|
+
*
|
|
2445
|
+
* @param flags
|
|
2699
2446
|
*/
|
|
2700
2447
|
updateOnChange(flags = {}, changed = false) {
|
|
2701
2448
|
if (!flags.noUpdateEvent && changed) {
|
|
@@ -2708,6 +2455,13 @@ class Component extends Element_1.default {
|
|
|
2708
2455
|
}
|
|
2709
2456
|
return false;
|
|
2710
2457
|
}
|
|
2458
|
+
/**
|
|
2459
|
+
* Perform a calculated value operation.
|
|
2460
|
+
*
|
|
2461
|
+
* @param data - The global data object.
|
|
2462
|
+
*
|
|
2463
|
+
* @return {boolean} - If the value changed during calculation.
|
|
2464
|
+
*/
|
|
2711
2465
|
convertNumberOrBoolToString(value) {
|
|
2712
2466
|
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
2713
2467
|
return value.toString();
|
|
@@ -2816,10 +2570,9 @@ class Component extends Element_1.default {
|
|
|
2816
2570
|
/* eslint-enable max-statements */
|
|
2817
2571
|
/**
|
|
2818
2572
|
* Performs calculations in this component plus any child components.
|
|
2819
|
-
*
|
|
2820
|
-
* @param
|
|
2821
|
-
* @
|
|
2822
|
-
* @returns {boolean} - TRUE if the value changed.
|
|
2573
|
+
*
|
|
2574
|
+
* @param args
|
|
2575
|
+
* @return {boolean}
|
|
2823
2576
|
*/
|
|
2824
2577
|
calculateValue(data, flags, row) {
|
|
2825
2578
|
data = data || this.rootValue;
|
|
@@ -2829,14 +2582,15 @@ class Component extends Element_1.default {
|
|
|
2829
2582
|
}
|
|
2830
2583
|
/**
|
|
2831
2584
|
* Get this component's label text.
|
|
2832
|
-
*
|
|
2585
|
+
*
|
|
2833
2586
|
*/
|
|
2834
2587
|
get label() {
|
|
2835
2588
|
return this.component.label;
|
|
2836
2589
|
}
|
|
2837
2590
|
/**
|
|
2838
2591
|
* Set this component's label text and render it.
|
|
2839
|
-
*
|
|
2592
|
+
*
|
|
2593
|
+
* @param value - The new label text.
|
|
2840
2594
|
*/
|
|
2841
2595
|
set label(value) {
|
|
2842
2596
|
this.component.label = value;
|
|
@@ -2846,18 +2600,17 @@ class Component extends Element_1.default {
|
|
|
2846
2600
|
}
|
|
2847
2601
|
/**
|
|
2848
2602
|
* Get FormioForm element at the root of this component tree.
|
|
2849
|
-
*
|
|
2603
|
+
*
|
|
2850
2604
|
*/
|
|
2851
2605
|
getRoot() {
|
|
2852
2606
|
return this.root;
|
|
2853
2607
|
}
|
|
2854
2608
|
/**
|
|
2855
2609
|
* Returns the invalid message, or empty string if the component is valid.
|
|
2856
|
-
*
|
|
2857
|
-
* @param
|
|
2858
|
-
* @param
|
|
2859
|
-
* @
|
|
2860
|
-
* @returns {string} - The message to show when the component is invalid.
|
|
2610
|
+
*
|
|
2611
|
+
* @param data
|
|
2612
|
+
* @param dirty
|
|
2613
|
+
* @return {*}
|
|
2861
2614
|
*/
|
|
2862
2615
|
invalidMessage(data, dirty, ignoreCondition, row) {
|
|
2863
2616
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
|
@@ -2889,9 +2642,10 @@ class Component extends Element_1.default {
|
|
|
2889
2642
|
}
|
|
2890
2643
|
/**
|
|
2891
2644
|
* Returns if the component is valid or not.
|
|
2892
|
-
*
|
|
2893
|
-
* @param
|
|
2894
|
-
* @
|
|
2645
|
+
*
|
|
2646
|
+
* @param data
|
|
2647
|
+
* @param dirty
|
|
2648
|
+
* @return {boolean}
|
|
2895
2649
|
*/
|
|
2896
2650
|
isValid(data, dirty) {
|
|
2897
2651
|
return !this.invalidMessage(data, dirty);
|
|
@@ -2910,8 +2664,8 @@ class Component extends Element_1.default {
|
|
|
2910
2664
|
}
|
|
2911
2665
|
/**
|
|
2912
2666
|
* Interpolate errors from the validation methods.
|
|
2913
|
-
* @param {
|
|
2914
|
-
* @returns
|
|
2667
|
+
* @param {*} errors
|
|
2668
|
+
* @returns
|
|
2915
2669
|
*/
|
|
2916
2670
|
interpolateErrors(errors) {
|
|
2917
2671
|
var _a;
|
|
@@ -2924,7 +2678,7 @@ class Component extends Element_1.default {
|
|
|
2924
2678
|
* @param {*} data - The root submission data.
|
|
2925
2679
|
* @param {*} row - The contextual row data.
|
|
2926
2680
|
* @param {*} flags - The flags to perform validation.
|
|
2927
|
-
* @returns
|
|
2681
|
+
* @returns
|
|
2928
2682
|
*/
|
|
2929
2683
|
showValidationErrors(errors, data, row, flags) {
|
|
2930
2684
|
if (flags.silentCheck) {
|
|
@@ -2944,9 +2698,9 @@ class Component extends Element_1.default {
|
|
|
2944
2698
|
* @param {*} data - The root data you wish to use for this component.
|
|
2945
2699
|
* @param {*} row - The contextual row data you wish to use for this component.
|
|
2946
2700
|
* @param {*} flags - The flags to control the behavior of the validation.
|
|
2947
|
-
* @returns
|
|
2701
|
+
* @returns
|
|
2948
2702
|
*/
|
|
2949
|
-
validateComponent(data
|
|
2703
|
+
validateComponent(data, row, flags = {}) {
|
|
2950
2704
|
data = data || this.rootValue;
|
|
2951
2705
|
row = row || this.data;
|
|
2952
2706
|
const { async = false } = flags;
|
|
@@ -2977,14 +2731,13 @@ class Component extends Element_1.default {
|
|
|
2977
2731
|
}
|
|
2978
2732
|
/**
|
|
2979
2733
|
* Checks the validity of this component and sets the error message if it is invalid.
|
|
2980
|
-
*
|
|
2981
|
-
* @param
|
|
2982
|
-
* @param
|
|
2983
|
-
* @param
|
|
2984
|
-
* @
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
2734
|
+
*
|
|
2735
|
+
* @param data
|
|
2736
|
+
* @param dirty
|
|
2737
|
+
* @param row
|
|
2738
|
+
* @return {boolean}
|
|
2739
|
+
*/
|
|
2740
|
+
checkComponentValidity(data, dirty, row, flags = {}, allErrors = []) {
|
|
2988
2741
|
data = data || this.rootValue;
|
|
2989
2742
|
row = row || this.data;
|
|
2990
2743
|
flags.dirty = dirty || false;
|
|
@@ -3020,30 +2773,32 @@ class Component extends Element_1.default {
|
|
|
3020
2773
|
}
|
|
3021
2774
|
/**
|
|
3022
2775
|
* Checks the validity of the component.
|
|
3023
|
-
* @param {*} data
|
|
3024
|
-
* @param {
|
|
3025
|
-
* @param {*} row
|
|
3026
|
-
* @param {
|
|
3027
|
-
* @
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2776
|
+
* @param {*} data
|
|
2777
|
+
* @param {*} dirty
|
|
2778
|
+
* @param {*} row
|
|
2779
|
+
* @param {*} silentCheck
|
|
2780
|
+
* @returns
|
|
2781
|
+
*/
|
|
2782
|
+
checkValidity(data, dirty, row, silentCheck, errors = []) {
|
|
3031
2783
|
data = data || this.rootValue;
|
|
3032
2784
|
row = row || this.data;
|
|
2785
|
+
console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3033
2786
|
return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
|
|
3034
2787
|
}
|
|
3035
|
-
checkAsyncValidity(data
|
|
2788
|
+
checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
|
|
2789
|
+
console.log('Deprecation warning: Component.checkAsyncValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3036
2790
|
return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
|
|
3037
2791
|
}
|
|
3038
2792
|
/**
|
|
3039
2793
|
* Check the conditions, calculations, and validity of a single component and triggers an update if
|
|
3040
2794
|
* something changed.
|
|
3041
|
-
*
|
|
3042
|
-
* @param
|
|
3043
|
-
* @param
|
|
3044
|
-
*
|
|
2795
|
+
*
|
|
2796
|
+
* @param data - The root data of the change event.
|
|
2797
|
+
* @param flags - The flags from this change event.
|
|
2798
|
+
*
|
|
2799
|
+
* @return boolean - If component is valid or not.
|
|
3045
2800
|
*/
|
|
3046
|
-
checkData(data
|
|
2801
|
+
checkData(data, flags, row) {
|
|
3047
2802
|
data = data || this.rootValue;
|
|
3048
2803
|
flags = flags || {};
|
|
3049
2804
|
row = row || this.data;
|
|
@@ -3086,7 +2841,8 @@ class Component extends Element_1.default {
|
|
|
3086
2841
|
}
|
|
3087
2842
|
/**
|
|
3088
2843
|
* Check if a component is eligible for multiple validation
|
|
3089
|
-
*
|
|
2844
|
+
*
|
|
2845
|
+
* @return {boolean}
|
|
3090
2846
|
*/
|
|
3091
2847
|
validateMultiple() {
|
|
3092
2848
|
return true;
|
|
@@ -3206,7 +2962,8 @@ class Component extends Element_1.default {
|
|
|
3206
2962
|
/**
|
|
3207
2963
|
* Determines if the value of this component is hidden from the user as if it is coming from the server, but is
|
|
3208
2964
|
* protected.
|
|
3209
|
-
*
|
|
2965
|
+
*
|
|
2966
|
+
* @return {boolean|*}
|
|
3210
2967
|
*/
|
|
3211
2968
|
isValueHidden() {
|
|
3212
2969
|
if (this.component.protected && this.root.editing) {
|
|
@@ -3251,8 +3008,6 @@ class Component extends Element_1.default {
|
|
|
3251
3008
|
}
|
|
3252
3009
|
/**
|
|
3253
3010
|
* Prints out the value of this component as a string value.
|
|
3254
|
-
* @param {*} value - The value to print out.
|
|
3255
|
-
* @returns {string} - The string representation of the value.
|
|
3256
3011
|
*/
|
|
3257
3012
|
asString(value) {
|
|
3258
3013
|
value = value || this.getValue();
|
|
@@ -3260,14 +3015,15 @@ class Component extends Element_1.default {
|
|
|
3260
3015
|
}
|
|
3261
3016
|
/**
|
|
3262
3017
|
* Return if the component is disabled.
|
|
3263
|
-
* @
|
|
3018
|
+
* @return {boolean}
|
|
3264
3019
|
*/
|
|
3265
3020
|
get disabled() {
|
|
3266
3021
|
return this._disabled || this.parentDisabled;
|
|
3267
3022
|
}
|
|
3268
3023
|
/**
|
|
3269
3024
|
* Disable this component.
|
|
3270
|
-
*
|
|
3025
|
+
*
|
|
3026
|
+
* @param {boolean} disabled
|
|
3271
3027
|
*/
|
|
3272
3028
|
set disabled(disabled) {
|
|
3273
3029
|
this._disabled = disabled;
|
|
@@ -3392,7 +3148,6 @@ class Component extends Element_1.default {
|
|
|
3392
3148
|
}
|
|
3393
3149
|
/**
|
|
3394
3150
|
* Get the element information.
|
|
3395
|
-
* @returns {*} - The components "input" DOM element information.
|
|
3396
3151
|
*/
|
|
3397
3152
|
elementInfo() {
|
|
3398
3153
|
const attributes = {
|
|
@@ -3431,13 +3186,15 @@ class Component extends Element_1.default {
|
|
|
3431
3186
|
const { left, top } = element.getBoundingClientRect();
|
|
3432
3187
|
window.scrollTo(left + window.scrollX, top + window.scrollY);
|
|
3433
3188
|
}
|
|
3434
|
-
focus(index
|
|
3189
|
+
focus(index) {
|
|
3435
3190
|
var _a, _b;
|
|
3436
3191
|
if ('beforeFocus' in this.parent) {
|
|
3437
3192
|
this.parent.beforeFocus(this);
|
|
3438
3193
|
}
|
|
3439
3194
|
if ((_a = this.refs.input) === null || _a === void 0 ? void 0 : _a.length) {
|
|
3440
|
-
const focusingInput = this.refs.input[index]
|
|
3195
|
+
const focusingInput = typeof index === 'number' && this.refs.input[index]
|
|
3196
|
+
? this.refs.input[index]
|
|
3197
|
+
: this.refs.input[this.refs.input.length - 1];
|
|
3441
3198
|
if (((_b = this.component.widget) === null || _b === void 0 ? void 0 : _b.type) === 'calendar') {
|
|
3442
3199
|
const sibling = focusingInput.nextSibling;
|
|
3443
3200
|
if (sibling) {
|
|
@@ -3457,7 +3214,6 @@ class Component extends Element_1.default {
|
|
|
3457
3214
|
}
|
|
3458
3215
|
/**
|
|
3459
3216
|
* Get `Formio` instance for working with files
|
|
3460
|
-
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
|
3461
3217
|
*/
|
|
3462
3218
|
get fileService() {
|
|
3463
3219
|
if (this.options.fileService) {
|