@formio/js 5.0.0-dev.5641.d9ab3df → 5.0.0-dev.5643.9c5173a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +0 -43
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +1188 -607
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +5 -3
- package/dist/formio.full.js +912 -651
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +5 -3
- package/dist/formio.js +18 -18
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +494 -1831
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +4 -10
- package/lib/cjs/CDN.d.ts +0 -1
- package/lib/cjs/CDN.js +3 -6
- package/lib/cjs/Element.d.ts +96 -86
- package/lib/cjs/Element.js +78 -68
- package/lib/cjs/Embed.d.ts +1 -1
- package/lib/cjs/Embed.js +12 -52
- package/lib/cjs/Form.d.ts +36 -365
- package/lib/cjs/Form.js +64 -50
- package/lib/cjs/FormBuilder.d.ts +2 -187
- package/lib/cjs/FormBuilder.js +8 -30
- package/lib/cjs/PDF.d.ts +13 -11
- package/lib/cjs/PDF.js +8 -6
- package/lib/cjs/Webform.d.ts +139 -180
- package/lib/cjs/Webform.js +296 -309
- package/lib/cjs/WebformBuilder.d.ts +14 -16
- package/lib/cjs/WebformBuilder.js +12 -19
- package/lib/cjs/Wizard.d.ts +21 -31
- package/lib/cjs/Wizard.js +20 -43
- package/lib/cjs/WizardBuilder.d.ts +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
- package/lib/cjs/components/Components.d.ts +4 -4
- package/lib/cjs/components/Components.js +3 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +269 -502
- package/lib/cjs/components/_classes/component/Component.form.d.ts +3 -6
- package/lib/cjs/components/_classes/component/Component.form.js +0 -5
- package/lib/cjs/components/_classes/component/Component.js +190 -434
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +2 -2
- package/lib/cjs/components/_classes/component/editForm/utils.js +2 -2
- package/lib/cjs/components/_classes/field/Field.d.ts +2 -11
- package/lib/cjs/components/_classes/field/Field.js +1 -13
- package/lib/cjs/components/_classes/input/Input.d.ts +3 -4
- package/lib/cjs/components/_classes/input/Input.js +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +3 -6
- package/lib/cjs/components/_classes/list/ListComponent.form.js +0 -5
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +3 -37
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +67 -163
- package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +0 -5
- package/lib/cjs/components/_classes/nested/NestedComponent.js +54 -175
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -7
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
- package/lib/cjs/components/address/Address.d.ts +2 -4
- package/lib/cjs/components/address/Address.form.d.ts +3 -6
- package/lib/cjs/components/address/Address.form.js +0 -5
- package/lib/cjs/components/button/Button.d.ts +12 -3
- package/lib/cjs/components/button/Button.form.d.ts +3 -6
- package/lib/cjs/components/button/Button.form.js +0 -5
- package/lib/cjs/components/button/Button.js +0 -5
- package/lib/cjs/components/checkbox/Checkbox.d.ts +27 -4
- package/lib/cjs/components/checkbox/Checkbox.form.d.ts +3 -6
- package/lib/cjs/components/checkbox/Checkbox.form.js +0 -5
- package/lib/cjs/components/columns/Columns.d.ts +2 -3
- package/lib/cjs/components/columns/Columns.form.d.ts +3 -6
- package/lib/cjs/components/columns/Columns.form.js +0 -5
- package/lib/cjs/components/columns/Columns.js +1 -1
- package/lib/cjs/components/container/Container.form.d.ts +3 -6
- package/lib/cjs/components/container/Container.form.js +0 -5
- package/lib/cjs/components/content/Content.d.ts +1 -2
- package/lib/cjs/components/content/Content.form.d.ts +3 -6
- package/lib/cjs/components/content/Content.form.js +0 -5
- package/lib/cjs/components/currency/Currency.form.d.ts +3 -6
- package/lib/cjs/components/currency/Currency.form.js +0 -5
- package/lib/cjs/components/currency/Currency.js +2 -1
- package/lib/cjs/components/datagrid/DataGrid.d.ts +7 -8
- package/lib/cjs/components/datagrid/DataGrid.form.d.ts +3 -6
- package/lib/cjs/components/datagrid/DataGrid.form.js +0 -5
- package/lib/cjs/components/datagrid/DataGrid.js +5 -5
- package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
- package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.js +36 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
- package/lib/cjs/components/datamap/DataMap.d.ts +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 +6 -4
- 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 +12 -19
- package/lib/mjs/Wizard.d.ts +21 -31
- package/lib/mjs/Wizard.js +19 -42
- package/lib/mjs/WizardBuilder.d.ts +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
- package/lib/mjs/components/Components.d.ts +4 -4
- package/lib/mjs/components/Components.js +3 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +269 -502
- package/lib/mjs/components/_classes/component/Component.form.d.ts +3 -6
- package/lib/mjs/components/_classes/component/Component.form.js +0 -5
- package/lib/mjs/components/_classes/component/Component.js +190 -434
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/mjs/components/_classes/field/Field.d.ts +2 -11
- package/lib/mjs/components/_classes/field/Field.js +1 -13
- package/lib/mjs/components/_classes/input/Input.d.ts +3 -4
- package/lib/mjs/components/_classes/input/Input.js +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +3 -6
- package/lib/mjs/components/_classes/list/ListComponent.form.js +0 -5
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +3 -37
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +67 -163
- package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +0 -5
- package/lib/mjs/components/_classes/nested/NestedComponent.js +54 -175
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -7
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
- package/lib/mjs/components/address/Address.d.ts +2 -4
- package/lib/mjs/components/address/Address.form.d.ts +3 -6
- package/lib/mjs/components/address/Address.form.js +0 -5
- package/lib/mjs/components/button/Button.d.ts +12 -3
- package/lib/mjs/components/button/Button.form.d.ts +3 -6
- package/lib/mjs/components/button/Button.form.js +0 -5
- package/lib/mjs/components/button/Button.js +0 -5
- package/lib/mjs/components/checkbox/Checkbox.d.ts +27 -4
- package/lib/mjs/components/checkbox/Checkbox.form.d.ts +3 -6
- package/lib/mjs/components/checkbox/Checkbox.form.js +0 -5
- package/lib/mjs/components/columns/Columns.d.ts +2 -3
- package/lib/mjs/components/columns/Columns.form.d.ts +3 -6
- package/lib/mjs/components/columns/Columns.form.js +0 -5
- package/lib/mjs/components/columns/Columns.js +1 -1
- package/lib/mjs/components/container/Container.form.d.ts +3 -6
- package/lib/mjs/components/container/Container.form.js +0 -5
- package/lib/mjs/components/content/Content.d.ts +1 -2
- package/lib/mjs/components/content/Content.form.d.ts +3 -6
- package/lib/mjs/components/content/Content.form.js +0 -5
- package/lib/mjs/components/currency/Currency.form.d.ts +3 -6
- package/lib/mjs/components/currency/Currency.form.js +0 -5
- package/lib/mjs/components/currency/Currency.js +2 -1
- package/lib/mjs/components/datagrid/DataGrid.d.ts +7 -8
- package/lib/mjs/components/datagrid/DataGrid.form.d.ts +3 -6
- package/lib/mjs/components/datagrid/DataGrid.form.js +0 -5
- package/lib/mjs/components/datagrid/DataGrid.js +5 -5
- package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
- package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.js +34 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
- package/lib/mjs/components/datamap/DataMap.d.ts +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 +5 -4
- 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
|
@@ -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) {
|
|
@@ -2049,15 +1818,6 @@ export default class Component extends Element {
|
|
|
2049
1818
|
}).join(''));
|
|
2050
1819
|
}
|
|
2051
1820
|
}
|
|
2052
|
-
/**
|
|
2053
|
-
* Sets the form input widget error classes.
|
|
2054
|
-
* @param {Array<HTMLElement>} elements - An array of DOM elements to set the error classes on.
|
|
2055
|
-
* @param {boolean} dirty - If the input is dirty.
|
|
2056
|
-
* @param {boolean} hasErrors - If the input has errors.
|
|
2057
|
-
* @param {boolean} hasMessages - If the input has messages.
|
|
2058
|
-
* @param {HTMLElement} element - The wrapper element for all the other elements passed in first argument.
|
|
2059
|
-
* @returns {void}
|
|
2060
|
-
*/
|
|
2061
1821
|
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
2062
1822
|
this.clearErrorClasses();
|
|
2063
1823
|
elements.forEach((element) => {
|
|
@@ -2084,12 +1844,6 @@ export default class Component extends Element {
|
|
|
2084
1844
|
this.addClass(element, 'has-message');
|
|
2085
1845
|
}
|
|
2086
1846
|
}
|
|
2087
|
-
/**
|
|
2088
|
-
* Adds the classes necessary to mark an element as invalid.
|
|
2089
|
-
* @param {HTMLElement} element - The element you wish to add the invalid classes to.
|
|
2090
|
-
* @param {boolean} invalid - TRUE if the component is invalid, FALSE otherwise.
|
|
2091
|
-
* @returns {void}
|
|
2092
|
-
*/
|
|
2093
1847
|
setElementInvalid(element, invalid) {
|
|
2094
1848
|
if (!element)
|
|
2095
1849
|
return;
|
|
@@ -2101,9 +1855,6 @@ export default class Component extends Element {
|
|
|
2101
1855
|
}
|
|
2102
1856
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
|
2103
1857
|
}
|
|
2104
|
-
/**
|
|
2105
|
-
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
|
2106
|
-
*/
|
|
2107
1858
|
clearOnHide() {
|
|
2108
1859
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
2109
1860
|
if (
|
|
@@ -2123,10 +1874,6 @@ export default class Component extends Element {
|
|
|
2123
1874
|
}
|
|
2124
1875
|
}
|
|
2125
1876
|
}
|
|
2126
|
-
/**
|
|
2127
|
-
* Triggers a debounced onChange event for the root component (usually Webform).
|
|
2128
|
-
* @param {...any} args - The arguments to pass to the onChange event.
|
|
2129
|
-
*/
|
|
2130
1877
|
triggerRootChange(...args) {
|
|
2131
1878
|
if (this.options.onChange) {
|
|
2132
1879
|
this.options.onChange(...args);
|
|
@@ -2135,13 +1882,6 @@ export default class Component extends Element {
|
|
|
2135
1882
|
this.root.triggerChange(...args);
|
|
2136
1883
|
}
|
|
2137
1884
|
}
|
|
2138
|
-
/**
|
|
2139
|
-
* Called when the component value has been changed. This will then trigger the root level onChange handler which
|
|
2140
|
-
* propagates the checkData methods for the full component tree.
|
|
2141
|
-
* @param {any} flags - The flags for the change event propagation.
|
|
2142
|
-
* @param {boolean} fromRoot - If the change event is from the root component.
|
|
2143
|
-
* @returns {boolean} - TRUE if the component has changed.
|
|
2144
|
-
*/
|
|
2145
1885
|
onChange(flags, fromRoot) {
|
|
2146
1886
|
flags = flags || {};
|
|
2147
1887
|
if (flags.modified) {
|
|
@@ -2277,7 +2017,7 @@ export default class Component extends Element {
|
|
|
2277
2017
|
return Promise.reject();
|
|
2278
2018
|
}
|
|
2279
2019
|
this.quill = new Quill(element, isIEBrowser ? { ...settings, modules: {} } : settings);
|
|
2280
|
-
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ
|
|
2020
|
+
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ **/
|
|
2281
2021
|
const txtArea = document.createElement('textarea');
|
|
2282
2022
|
txtArea.setAttribute('class', 'quill-source-code');
|
|
2283
2023
|
this.quill.addContainer('ql-custom').appendChild(txtArea);
|
|
@@ -2291,7 +2031,7 @@ export default class Component extends Element {
|
|
|
2291
2031
|
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2292
2032
|
});
|
|
2293
2033
|
}
|
|
2294
|
-
/** END CODEBLOCK
|
|
2034
|
+
/** END CODEBLOCK **/
|
|
2295
2035
|
// Make sure to select cursor when they click on the element.
|
|
2296
2036
|
this.addEventListener(element, 'click', () => this.quill.focus());
|
|
2297
2037
|
// Allows users to skip toolbar items when tabbing though form
|
|
@@ -2338,22 +2078,23 @@ export default class Component extends Element {
|
|
|
2338
2078
|
}
|
|
2339
2079
|
/**
|
|
2340
2080
|
* The empty value for this component.
|
|
2341
|
-
*
|
|
2081
|
+
*
|
|
2082
|
+
* @return {null}
|
|
2342
2083
|
*/
|
|
2343
2084
|
get emptyValue() {
|
|
2344
2085
|
return null;
|
|
2345
2086
|
}
|
|
2346
2087
|
/**
|
|
2347
2088
|
* Returns if this component has a value set.
|
|
2348
|
-
*
|
|
2349
|
-
* @returns {boolean} - TRUE if a value is set.
|
|
2089
|
+
*
|
|
2350
2090
|
*/
|
|
2351
2091
|
hasValue(data) {
|
|
2352
2092
|
return !_.isUndefined(_.get(data || this.data, this.key));
|
|
2353
2093
|
}
|
|
2354
2094
|
/**
|
|
2355
2095
|
* Get the data value at the root level.
|
|
2356
|
-
*
|
|
2096
|
+
*
|
|
2097
|
+
* @return {*}
|
|
2357
2098
|
*/
|
|
2358
2099
|
get rootValue() {
|
|
2359
2100
|
return this.root ? this.root.data : this.data;
|
|
@@ -2363,7 +2104,7 @@ export default class Component extends Element {
|
|
|
2363
2104
|
}
|
|
2364
2105
|
/**
|
|
2365
2106
|
* Get the static value of this component.
|
|
2366
|
-
* @
|
|
2107
|
+
* @return {*}
|
|
2367
2108
|
*/
|
|
2368
2109
|
get dataValue() {
|
|
2369
2110
|
if (!this.key ||
|
|
@@ -2381,7 +2122,8 @@ export default class Component extends Element {
|
|
|
2381
2122
|
}
|
|
2382
2123
|
/**
|
|
2383
2124
|
* Sets the static value of this component.
|
|
2384
|
-
*
|
|
2125
|
+
*
|
|
2126
|
+
* @param value
|
|
2385
2127
|
*/
|
|
2386
2128
|
set dataValue(value) {
|
|
2387
2129
|
if (!this.allowData ||
|
|
@@ -2401,8 +2143,8 @@ export default class Component extends Element {
|
|
|
2401
2143
|
}
|
|
2402
2144
|
/**
|
|
2403
2145
|
* Splice a value from the dataValue.
|
|
2404
|
-
*
|
|
2405
|
-
* @param
|
|
2146
|
+
*
|
|
2147
|
+
* @param index
|
|
2406
2148
|
*/
|
|
2407
2149
|
splice(index, flags = {}) {
|
|
2408
2150
|
if (this.hasValue()) {
|
|
@@ -2470,7 +2212,8 @@ export default class Component extends Element {
|
|
|
2470
2212
|
}
|
|
2471
2213
|
/**
|
|
2472
2214
|
* Get the input value of this component.
|
|
2473
|
-
*
|
|
2215
|
+
*
|
|
2216
|
+
* @return {*}
|
|
2474
2217
|
*/
|
|
2475
2218
|
getValue() {
|
|
2476
2219
|
if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
@@ -2492,8 +2235,9 @@ export default class Component extends Element {
|
|
|
2492
2235
|
}
|
|
2493
2236
|
/**
|
|
2494
2237
|
* Get the value at a specific index.
|
|
2495
|
-
*
|
|
2496
|
-
* @
|
|
2238
|
+
*
|
|
2239
|
+
* @param index
|
|
2240
|
+
* @returns {*}
|
|
2497
2241
|
*/
|
|
2498
2242
|
getValueAt(index) {
|
|
2499
2243
|
const input = this.performInputMapping(this.refs.input[index]);
|
|
@@ -2501,9 +2245,11 @@ export default class Component extends Element {
|
|
|
2501
2245
|
}
|
|
2502
2246
|
/**
|
|
2503
2247
|
* Set the value of this component.
|
|
2504
|
-
*
|
|
2505
|
-
* @param
|
|
2506
|
-
* @
|
|
2248
|
+
*
|
|
2249
|
+
* @param value
|
|
2250
|
+
* @param flags
|
|
2251
|
+
*
|
|
2252
|
+
* @return {boolean} - If the value changed.
|
|
2507
2253
|
*/
|
|
2508
2254
|
setValue(value, flags = {}) {
|
|
2509
2255
|
const changed = this.updateValue(value, flags);
|
|
@@ -2534,9 +2280,9 @@ export default class Component extends Element {
|
|
|
2534
2280
|
}
|
|
2535
2281
|
/**
|
|
2536
2282
|
* Set the value at a specific index.
|
|
2537
|
-
*
|
|
2538
|
-
* @param
|
|
2539
|
-
* @param
|
|
2283
|
+
*
|
|
2284
|
+
* @param index
|
|
2285
|
+
* @param value
|
|
2540
2286
|
*/
|
|
2541
2287
|
setValueAt(index, value, flags = {}) {
|
|
2542
2288
|
if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
|
|
@@ -2583,8 +2329,9 @@ export default class Component extends Element {
|
|
|
2583
2329
|
}
|
|
2584
2330
|
/**
|
|
2585
2331
|
* Normalize values coming into updateValue.
|
|
2586
|
-
*
|
|
2587
|
-
* @
|
|
2332
|
+
*
|
|
2333
|
+
* @param value
|
|
2334
|
+
* @return {*}
|
|
2588
2335
|
*/
|
|
2589
2336
|
normalizeValue(value) {
|
|
2590
2337
|
if (this.component.multiple && !Array.isArray(value)) {
|
|
@@ -2594,9 +2341,8 @@ export default class Component extends Element {
|
|
|
2594
2341
|
}
|
|
2595
2342
|
/**
|
|
2596
2343
|
* Update a value of this component.
|
|
2597
|
-
*
|
|
2598
|
-
* @param
|
|
2599
|
-
* @returns {boolean} - If the value changed.
|
|
2344
|
+
*
|
|
2345
|
+
* @param flags
|
|
2600
2346
|
*/
|
|
2601
2347
|
updateComponentValue(value, flags = {}) {
|
|
2602
2348
|
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
@@ -2615,8 +2361,9 @@ export default class Component extends Element {
|
|
|
2615
2361
|
}
|
|
2616
2362
|
/**
|
|
2617
2363
|
* Updates the value of this component plus all sub-components.
|
|
2618
|
-
*
|
|
2619
|
-
* @
|
|
2364
|
+
*
|
|
2365
|
+
* @param args
|
|
2366
|
+
* @return {boolean}
|
|
2620
2367
|
*/
|
|
2621
2368
|
updateValue(...args) {
|
|
2622
2369
|
return this.updateComponentValue(...args);
|
|
@@ -2642,9 +2389,10 @@ export default class Component extends Element {
|
|
|
2642
2389
|
}
|
|
2643
2390
|
/**
|
|
2644
2391
|
* Determine if the value of this component has changed.
|
|
2645
|
-
*
|
|
2646
|
-
* @param
|
|
2647
|
-
* @
|
|
2392
|
+
*
|
|
2393
|
+
* @param newValue
|
|
2394
|
+
* @param oldValue
|
|
2395
|
+
* @return {boolean}
|
|
2648
2396
|
*/
|
|
2649
2397
|
hasChanged(newValue, oldValue) {
|
|
2650
2398
|
if (((newValue === undefined) || (newValue === null)) &&
|
|
@@ -2662,9 +2410,8 @@ export default class Component extends Element {
|
|
|
2662
2410
|
}
|
|
2663
2411
|
/**
|
|
2664
2412
|
* Update the value on change.
|
|
2665
|
-
*
|
|
2666
|
-
* @param
|
|
2667
|
-
* @returns {boolean} - If the value changed.
|
|
2413
|
+
*
|
|
2414
|
+
* @param flags
|
|
2668
2415
|
*/
|
|
2669
2416
|
updateOnChange(flags = {}, changed = false) {
|
|
2670
2417
|
if (!flags.noUpdateEvent && changed) {
|
|
@@ -2677,6 +2424,13 @@ export default class Component extends Element {
|
|
|
2677
2424
|
}
|
|
2678
2425
|
return false;
|
|
2679
2426
|
}
|
|
2427
|
+
/**
|
|
2428
|
+
* Perform a calculated value operation.
|
|
2429
|
+
*
|
|
2430
|
+
* @param data - The global data object.
|
|
2431
|
+
*
|
|
2432
|
+
* @return {boolean} - If the value changed during calculation.
|
|
2433
|
+
*/
|
|
2680
2434
|
convertNumberOrBoolToString(value) {
|
|
2681
2435
|
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
2682
2436
|
return value.toString();
|
|
@@ -2773,7 +2527,7 @@ export default class Component extends Element {
|
|
|
2773
2527
|
}
|
|
2774
2528
|
this.calculatedValue = fastCloneDeep(calculatedValue);
|
|
2775
2529
|
if (changed) {
|
|
2776
|
-
if (!flags.noPristineChangeOnModified
|
|
2530
|
+
if (!flags.noPristineChangeOnModified) {
|
|
2777
2531
|
this.pristine = false;
|
|
2778
2532
|
}
|
|
2779
2533
|
flags.triggeredComponentId = this.id;
|
|
@@ -2784,10 +2538,9 @@ export default class Component extends Element {
|
|
|
2784
2538
|
/* eslint-enable max-statements */
|
|
2785
2539
|
/**
|
|
2786
2540
|
* Performs calculations in this component plus any child components.
|
|
2787
|
-
*
|
|
2788
|
-
* @param
|
|
2789
|
-
* @
|
|
2790
|
-
* @returns {boolean} - TRUE if the value changed.
|
|
2541
|
+
*
|
|
2542
|
+
* @param args
|
|
2543
|
+
* @return {boolean}
|
|
2791
2544
|
*/
|
|
2792
2545
|
calculateValue(data, flags, row) {
|
|
2793
2546
|
data = data || this.rootValue;
|
|
@@ -2797,14 +2550,15 @@ export default class Component extends Element {
|
|
|
2797
2550
|
}
|
|
2798
2551
|
/**
|
|
2799
2552
|
* Get this component's label text.
|
|
2800
|
-
*
|
|
2553
|
+
*
|
|
2801
2554
|
*/
|
|
2802
2555
|
get label() {
|
|
2803
2556
|
return this.component.label;
|
|
2804
2557
|
}
|
|
2805
2558
|
/**
|
|
2806
2559
|
* Set this component's label text and render it.
|
|
2807
|
-
*
|
|
2560
|
+
*
|
|
2561
|
+
* @param value - The new label text.
|
|
2808
2562
|
*/
|
|
2809
2563
|
set label(value) {
|
|
2810
2564
|
this.component.label = value;
|
|
@@ -2814,18 +2568,17 @@ export default class Component extends Element {
|
|
|
2814
2568
|
}
|
|
2815
2569
|
/**
|
|
2816
2570
|
* Get FormioForm element at the root of this component tree.
|
|
2817
|
-
*
|
|
2571
|
+
*
|
|
2818
2572
|
*/
|
|
2819
2573
|
getRoot() {
|
|
2820
2574
|
return this.root;
|
|
2821
2575
|
}
|
|
2822
2576
|
/**
|
|
2823
2577
|
* Returns the invalid message, or empty string if the component is valid.
|
|
2824
|
-
*
|
|
2825
|
-
* @param
|
|
2826
|
-
* @param
|
|
2827
|
-
* @
|
|
2828
|
-
* @returns {string} - The message to show when the component is invalid.
|
|
2578
|
+
*
|
|
2579
|
+
* @param data
|
|
2580
|
+
* @param dirty
|
|
2581
|
+
* @return {*}
|
|
2829
2582
|
*/
|
|
2830
2583
|
invalidMessage(data, dirty, ignoreCondition, row) {
|
|
2831
2584
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
|
@@ -2857,9 +2610,10 @@ export default class Component extends Element {
|
|
|
2857
2610
|
}
|
|
2858
2611
|
/**
|
|
2859
2612
|
* Returns if the component is valid or not.
|
|
2860
|
-
*
|
|
2861
|
-
* @param
|
|
2862
|
-
* @
|
|
2613
|
+
*
|
|
2614
|
+
* @param data
|
|
2615
|
+
* @param dirty
|
|
2616
|
+
* @return {boolean}
|
|
2863
2617
|
*/
|
|
2864
2618
|
isValid(data, dirty) {
|
|
2865
2619
|
return !this.invalidMessage(data, dirty);
|
|
@@ -2878,8 +2632,8 @@ export default class Component extends Element {
|
|
|
2878
2632
|
}
|
|
2879
2633
|
/**
|
|
2880
2634
|
* Interpolate errors from the validation methods.
|
|
2881
|
-
* @param {
|
|
2882
|
-
* @returns
|
|
2635
|
+
* @param {*} errors
|
|
2636
|
+
* @returns
|
|
2883
2637
|
*/
|
|
2884
2638
|
interpolateErrors(errors) {
|
|
2885
2639
|
const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
@@ -2891,7 +2645,7 @@ export default class Component extends Element {
|
|
|
2891
2645
|
* @param {*} data - The root submission data.
|
|
2892
2646
|
* @param {*} row - The contextual row data.
|
|
2893
2647
|
* @param {*} flags - The flags to perform validation.
|
|
2894
|
-
* @returns
|
|
2648
|
+
* @returns
|
|
2895
2649
|
*/
|
|
2896
2650
|
showValidationErrors(errors, data, row, flags) {
|
|
2897
2651
|
if (flags.silentCheck) {
|
|
@@ -2911,9 +2665,9 @@ export default class Component extends Element {
|
|
|
2911
2665
|
* @param {*} data - The root data you wish to use for this component.
|
|
2912
2666
|
* @param {*} row - The contextual row data you wish to use for this component.
|
|
2913
2667
|
* @param {*} flags - The flags to control the behavior of the validation.
|
|
2914
|
-
* @returns
|
|
2668
|
+
* @returns
|
|
2915
2669
|
*/
|
|
2916
|
-
validateComponent(data
|
|
2670
|
+
validateComponent(data, row, flags = {}) {
|
|
2917
2671
|
data = data || this.rootValue;
|
|
2918
2672
|
row = row || this.data;
|
|
2919
2673
|
const { async = false } = flags;
|
|
@@ -2944,14 +2698,13 @@ export default class Component extends Element {
|
|
|
2944
2698
|
}
|
|
2945
2699
|
/**
|
|
2946
2700
|
* Checks the validity of this component and sets the error message if it is invalid.
|
|
2947
|
-
*
|
|
2948
|
-
* @param
|
|
2949
|
-
* @param
|
|
2950
|
-
* @param
|
|
2951
|
-
* @
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
2701
|
+
*
|
|
2702
|
+
* @param data
|
|
2703
|
+
* @param dirty
|
|
2704
|
+
* @param row
|
|
2705
|
+
* @return {boolean}
|
|
2706
|
+
*/
|
|
2707
|
+
checkComponentValidity(data, dirty, row, flags = {}, allErrors = []) {
|
|
2955
2708
|
data = data || this.rootValue;
|
|
2956
2709
|
row = row || this.data;
|
|
2957
2710
|
flags.dirty = dirty || false;
|
|
@@ -2987,30 +2740,32 @@ export default class Component extends Element {
|
|
|
2987
2740
|
}
|
|
2988
2741
|
/**
|
|
2989
2742
|
* Checks the validity of the component.
|
|
2990
|
-
* @param {*} data
|
|
2991
|
-
* @param {
|
|
2992
|
-
* @param {*} row
|
|
2993
|
-
* @param {
|
|
2994
|
-
* @
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2743
|
+
* @param {*} data
|
|
2744
|
+
* @param {*} dirty
|
|
2745
|
+
* @param {*} row
|
|
2746
|
+
* @param {*} silentCheck
|
|
2747
|
+
* @returns
|
|
2748
|
+
*/
|
|
2749
|
+
checkValidity(data, dirty, row, silentCheck, errors = []) {
|
|
2998
2750
|
data = data || this.rootValue;
|
|
2999
2751
|
row = row || this.data;
|
|
2752
|
+
console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3000
2753
|
return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
|
|
3001
2754
|
}
|
|
3002
|
-
checkAsyncValidity(data
|
|
2755
|
+
checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
|
|
2756
|
+
console.log('Deprecation warning: Component.checkAsyncValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3003
2757
|
return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
|
|
3004
2758
|
}
|
|
3005
2759
|
/**
|
|
3006
2760
|
* Check the conditions, calculations, and validity of a single component and triggers an update if
|
|
3007
2761
|
* something changed.
|
|
3008
|
-
*
|
|
3009
|
-
* @param
|
|
3010
|
-
* @param
|
|
3011
|
-
*
|
|
2762
|
+
*
|
|
2763
|
+
* @param data - The root data of the change event.
|
|
2764
|
+
* @param flags - The flags from this change event.
|
|
2765
|
+
*
|
|
2766
|
+
* @return boolean - If component is valid or not.
|
|
3012
2767
|
*/
|
|
3013
|
-
checkData(data
|
|
2768
|
+
checkData(data, flags, row) {
|
|
3014
2769
|
data = data || this.rootValue;
|
|
3015
2770
|
flags = flags || {};
|
|
3016
2771
|
row = row || this.data;
|
|
@@ -3053,7 +2808,8 @@ export default class Component extends Element {
|
|
|
3053
2808
|
}
|
|
3054
2809
|
/**
|
|
3055
2810
|
* Check if a component is eligible for multiple validation
|
|
3056
|
-
*
|
|
2811
|
+
*
|
|
2812
|
+
* @return {boolean}
|
|
3057
2813
|
*/
|
|
3058
2814
|
validateMultiple() {
|
|
3059
2815
|
return true;
|
|
@@ -3171,7 +2927,8 @@ export default class Component extends Element {
|
|
|
3171
2927
|
/**
|
|
3172
2928
|
* Determines if the value of this component is hidden from the user as if it is coming from the server, but is
|
|
3173
2929
|
* protected.
|
|
3174
|
-
*
|
|
2930
|
+
*
|
|
2931
|
+
* @return {boolean|*}
|
|
3175
2932
|
*/
|
|
3176
2933
|
isValueHidden() {
|
|
3177
2934
|
if (this.component.protected && this.root.editing) {
|
|
@@ -3216,8 +2973,6 @@ export default class Component extends Element {
|
|
|
3216
2973
|
}
|
|
3217
2974
|
/**
|
|
3218
2975
|
* Prints out the value of this component as a string value.
|
|
3219
|
-
* @param {*} value - The value to print out.
|
|
3220
|
-
* @returns {string} - The string representation of the value.
|
|
3221
2976
|
*/
|
|
3222
2977
|
asString(value) {
|
|
3223
2978
|
value = value || this.getValue();
|
|
@@ -3225,14 +2980,15 @@ export default class Component extends Element {
|
|
|
3225
2980
|
}
|
|
3226
2981
|
/**
|
|
3227
2982
|
* Return if the component is disabled.
|
|
3228
|
-
* @
|
|
2983
|
+
* @return {boolean}
|
|
3229
2984
|
*/
|
|
3230
2985
|
get disabled() {
|
|
3231
2986
|
return this._disabled || this.parentDisabled;
|
|
3232
2987
|
}
|
|
3233
2988
|
/**
|
|
3234
2989
|
* Disable this component.
|
|
3235
|
-
*
|
|
2990
|
+
*
|
|
2991
|
+
* @param {boolean} disabled
|
|
3236
2992
|
*/
|
|
3237
2993
|
set disabled(disabled) {
|
|
3238
2994
|
this._disabled = disabled;
|
|
@@ -3357,7 +3113,6 @@ export default class Component extends Element {
|
|
|
3357
3113
|
}
|
|
3358
3114
|
/**
|
|
3359
3115
|
* Get the element information.
|
|
3360
|
-
* @returns {*} - The components "input" DOM element information.
|
|
3361
3116
|
*/
|
|
3362
3117
|
elementInfo() {
|
|
3363
3118
|
const attributes = {
|
|
@@ -3396,12 +3151,14 @@ export default class Component extends Element {
|
|
|
3396
3151
|
const { left, top } = element.getBoundingClientRect();
|
|
3397
3152
|
window.scrollTo(left + window.scrollX, top + window.scrollY);
|
|
3398
3153
|
}
|
|
3399
|
-
focus(index
|
|
3154
|
+
focus(index) {
|
|
3400
3155
|
if ('beforeFocus' in this.parent) {
|
|
3401
3156
|
this.parent.beforeFocus(this);
|
|
3402
3157
|
}
|
|
3403
3158
|
if (this.refs.input?.length) {
|
|
3404
|
-
const focusingInput = this.refs.input[index]
|
|
3159
|
+
const focusingInput = typeof index === 'number' && this.refs.input[index]
|
|
3160
|
+
? this.refs.input[index]
|
|
3161
|
+
: this.refs.input[this.refs.input.length - 1];
|
|
3405
3162
|
if (this.component.widget?.type === 'calendar') {
|
|
3406
3163
|
const sibling = focusingInput.nextSibling;
|
|
3407
3164
|
if (sibling) {
|
|
@@ -3421,7 +3178,6 @@ export default class Component extends Element {
|
|
|
3421
3178
|
}
|
|
3422
3179
|
/**
|
|
3423
3180
|
* Get `Formio` instance for working with files
|
|
3424
|
-
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
|
3425
3181
|
*/
|
|
3426
3182
|
get fileService() {
|
|
3427
3183
|
if (this.options.fileService) {
|