@formio/js 5.0.0-dev.5610.da13e39 → 5.0.0-dev.5613.3476921
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +1199 -651
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +11 -3
- package/dist/formio.full.js +919 -691
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +11 -3
- package/dist/formio.js +16 -16
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +493 -1861
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -12
- package/lib/cjs/Element.d.ts +96 -86
- package/lib/cjs/Element.js +78 -68
- package/lib/cjs/Form.d.ts +36 -365
- package/lib/cjs/Form.js +64 -50
- package/lib/cjs/FormBuilder.d.ts +2 -187
- package/lib/cjs/FormBuilder.js +8 -30
- package/lib/cjs/PDF.d.ts +13 -11
- package/lib/cjs/PDF.js +8 -6
- package/lib/cjs/Webform.d.ts +139 -180
- package/lib/cjs/Webform.js +298 -313
- package/lib/cjs/WebformBuilder.d.ts +14 -16
- package/lib/cjs/WebformBuilder.js +11 -17
- package/lib/cjs/Wizard.d.ts +21 -31
- package/lib/cjs/Wizard.js +19 -42
- package/lib/cjs/WizardBuilder.d.ts +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
- package/lib/cjs/components/Components.d.ts +4 -4
- package/lib/cjs/components/Components.js +3 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +269 -502
- package/lib/cjs/components/_classes/component/Component.form.d.ts +3 -6
- package/lib/cjs/components/_classes/component/Component.form.js +0 -5
- package/lib/cjs/components/_classes/component/Component.js +189 -433
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +2 -2
- package/lib/cjs/components/_classes/component/editForm/utils.js +2 -2
- package/lib/cjs/components/_classes/field/Field.d.ts +2 -11
- package/lib/cjs/components/_classes/field/Field.js +1 -13
- package/lib/cjs/components/_classes/input/Input.d.ts +3 -4
- package/lib/cjs/components/_classes/input/Input.js +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.d.ts +2 -2
- package/lib/cjs/components/_classes/list/ListComponent.form.d.ts +3 -6
- package/lib/cjs/components/_classes/list/ListComponent.form.js +0 -5
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +3 -37
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +67 -163
- package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +0 -5
- package/lib/cjs/components/_classes/nested/NestedComponent.js +54 -175
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -7
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
- package/lib/cjs/components/address/Address.d.ts +2 -4
- package/lib/cjs/components/address/Address.form.d.ts +3 -6
- package/lib/cjs/components/address/Address.form.js +0 -5
- package/lib/cjs/components/button/Button.d.ts +12 -3
- package/lib/cjs/components/button/Button.form.d.ts +3 -6
- package/lib/cjs/components/button/Button.form.js +0 -5
- package/lib/cjs/components/button/Button.js +0 -5
- package/lib/cjs/components/checkbox/Checkbox.d.ts +27 -4
- package/lib/cjs/components/checkbox/Checkbox.form.d.ts +3 -6
- package/lib/cjs/components/checkbox/Checkbox.form.js +0 -5
- package/lib/cjs/components/columns/Columns.d.ts +2 -3
- package/lib/cjs/components/columns/Columns.form.d.ts +3 -6
- package/lib/cjs/components/columns/Columns.form.js +0 -5
- package/lib/cjs/components/columns/Columns.js +1 -1
- package/lib/cjs/components/container/Container.form.d.ts +3 -6
- package/lib/cjs/components/container/Container.form.js +0 -5
- package/lib/cjs/components/content/Content.d.ts +1 -2
- package/lib/cjs/components/content/Content.form.d.ts +3 -6
- package/lib/cjs/components/content/Content.form.js +0 -5
- package/lib/cjs/components/currency/Currency.form.d.ts +3 -6
- package/lib/cjs/components/currency/Currency.form.js +0 -5
- package/lib/cjs/components/currency/Currency.js +2 -1
- package/lib/cjs/components/datagrid/DataGrid.d.ts +7 -8
- package/lib/cjs/components/datagrid/DataGrid.form.d.ts +3 -6
- package/lib/cjs/components/datagrid/DataGrid.form.js +0 -5
- package/lib/cjs/components/datagrid/DataGrid.js +5 -5
- package/lib/cjs/components/datamap/DataMap.d.ts +0 -1
- package/lib/cjs/components/datamap/DataMap.form.d.ts +3 -6
- package/lib/cjs/components/datamap/DataMap.form.js +0 -5
- package/lib/cjs/components/datetime/DateTime.d.ts +14 -0
- package/lib/cjs/components/datetime/DateTime.form.d.ts +3 -6
- package/lib/cjs/components/datetime/DateTime.form.js +0 -5
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
- package/lib/cjs/components/day/Day.d.ts +48 -22
- package/lib/cjs/components/day/Day.form.d.ts +3 -6
- package/lib/cjs/components/day/Day.form.js +0 -5
- package/lib/cjs/components/day/Day.js +20 -15
- package/lib/cjs/components/editgrid/EditGrid.d.ts +3 -7
- package/lib/cjs/components/editgrid/EditGrid.form.d.ts +3 -6
- package/lib/cjs/components/editgrid/EditGrid.form.js +0 -5
- package/lib/cjs/components/editgrid/EditGrid.js +3 -3
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +5 -2
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +9 -6
- package/lib/cjs/components/email/Email.form.d.ts +3 -6
- package/lib/cjs/components/email/Email.form.js +0 -5
- package/lib/cjs/components/fieldset/Fieldset.form.d.ts +3 -6
- package/lib/cjs/components/fieldset/Fieldset.form.js +0 -5
- package/lib/cjs/components/file/File.d.ts +22 -9
- package/lib/cjs/components/file/File.form.d.ts +3 -6
- package/lib/cjs/components/file/File.form.js +0 -5
- package/lib/cjs/components/form/Form.d.ts +20 -31
- package/lib/cjs/components/form/Form.form.d.ts +3 -6
- package/lib/cjs/components/form/Form.form.js +0 -5
- package/lib/cjs/components/form/Form.js +10 -13
- package/lib/cjs/components/hidden/Hidden.d.ts +11 -1
- package/lib/cjs/components/hidden/Hidden.form.d.ts +3 -6
- package/lib/cjs/components/hidden/Hidden.form.js +0 -5
- package/lib/cjs/components/hidden/Hidden.js +2 -1
- package/lib/cjs/components/html/HTML.d.ts +1 -2
- package/lib/cjs/components/html/HTML.form.d.ts +3 -6
- package/lib/cjs/components/html/HTML.form.js +0 -5
- package/lib/cjs/components/number/Number.d.ts +17 -3
- package/lib/cjs/components/number/Number.form.d.ts +3 -6
- package/lib/cjs/components/number/Number.form.js +0 -5
- package/lib/cjs/components/number/Number.js +2 -1
- package/lib/cjs/components/panel/Panel.form.d.ts +3 -6
- package/lib/cjs/components/panel/Panel.form.js +0 -5
- package/lib/cjs/components/panel/Panel.js +1 -0
- package/lib/cjs/components/password/Password.form.d.ts +3 -6
- package/lib/cjs/components/password/Password.form.js +0 -5
- package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +0 -5
- package/lib/cjs/components/radio/Radio.d.ts +26 -3
- package/lib/cjs/components/radio/Radio.form.d.ts +3 -6
- package/lib/cjs/components/radio/Radio.form.js +0 -5
- package/lib/cjs/components/radio/Radio.js +4 -3
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +3 -5
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +0 -4
- package/lib/cjs/components/select/Select.d.ts +39 -16
- package/lib/cjs/components/select/Select.form.d.ts +3 -6
- package/lib/cjs/components/select/Select.form.js +0 -5
- package/lib/cjs/components/select/Select.js +16 -13
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +17 -2
- package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
- package/lib/cjs/components/selectboxes/SelectBoxes.form.js +0 -5
- package/lib/cjs/components/selectboxes/SelectBoxes.js +9 -7
- package/lib/cjs/components/signature/Signature.d.ts +14 -1
- package/lib/cjs/components/signature/Signature.form.d.ts +3 -6
- package/lib/cjs/components/signature/Signature.form.js +0 -5
- package/lib/cjs/components/survey/Survey.d.ts +15 -3
- package/lib/cjs/components/survey/Survey.form.d.ts +3 -6
- package/lib/cjs/components/survey/Survey.form.js +0 -5
- package/lib/cjs/components/table/Table.d.ts +1 -2
- package/lib/cjs/components/table/Table.form.d.ts +3 -6
- package/lib/cjs/components/table/Table.form.js +0 -5
- package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/cjs/components/tabs/Tabs.form.d.ts +3 -6
- package/lib/cjs/components/tabs/Tabs.form.js +0 -5
- package/lib/cjs/components/tabs/Tabs.js +2 -1
- package/lib/cjs/components/tags/Tags.d.ts +14 -0
- package/lib/cjs/components/tags/Tags.form.d.ts +3 -6
- package/lib/cjs/components/tags/Tags.form.js +0 -5
- package/lib/cjs/components/textarea/TextArea.d.ts +9 -4
- package/lib/cjs/components/textarea/TextArea.form.d.ts +3 -6
- package/lib/cjs/components/textarea/TextArea.form.js +0 -5
- package/lib/cjs/components/textarea/TextArea.js +2 -2
- package/lib/cjs/components/textfield/TextField.d.ts +30 -14
- package/lib/cjs/components/textfield/TextField.form.d.ts +3 -6
- package/lib/cjs/components/textfield/TextField.form.js +0 -5
- package/lib/cjs/components/textfield/TextField.js +16 -13
- package/lib/cjs/components/time/Time.form.d.ts +3 -6
- package/lib/cjs/components/time/Time.form.js +0 -5
- package/lib/cjs/components/unknown/Unknown.form.d.ts +34 -5
- package/lib/cjs/components/unknown/Unknown.form.js +0 -4
- package/lib/cjs/components/url/Url.form.d.ts +3 -6
- package/lib/cjs/components/url/Url.form.js +0 -5
- package/lib/cjs/components/well/Well.form.d.ts +3 -6
- package/lib/cjs/components/well/Well.form.js +0 -5
- package/lib/cjs/formio.embed.d.ts +2 -1
- package/lib/cjs/formio.embed.js +100 -2
- package/lib/cjs/formio.form.d.ts +4 -11
- package/lib/cjs/formio.form.js +5 -13
- package/lib/cjs/providers/Providers.d.ts +5 -36
- package/lib/cjs/providers/Providers.js +0 -29
- package/lib/cjs/providers/address/AddressProvider.d.ts +12 -131
- package/lib/cjs/providers/address/AddressProvider.js +2 -88
- package/lib/cjs/providers/address/AzureAddressProvider.d.ts +1 -48
- package/lib/cjs/providers/address/AzureAddressProvider.js +0 -37
- package/lib/cjs/providers/address/CustomAddressProvider.d.ts +4 -27
- package/lib/cjs/providers/address/CustomAddressProvider.js +0 -34
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +6 -130
- package/lib/cjs/providers/address/GoogleAddressProvider.js +0 -72
- package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +7 -32
- package/lib/cjs/providers/address/NominatimAddressProvider.js +0 -33
- package/lib/cjs/providers/address/index.d.ts +1 -3
- package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -7
- package/lib/cjs/providers/processor/fileProcessor.js +0 -6
- package/lib/cjs/providers/storage/azure.d.ts +13 -6
- package/lib/cjs/providers/storage/azure.js +0 -5
- package/lib/cjs/providers/storage/base64.d.ts +6 -5
- package/lib/cjs/providers/storage/base64.js +0 -4
- package/lib/cjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/cjs/providers/storage/dropbox.js +0 -5
- package/lib/cjs/providers/storage/googleDrive.d.ts +5 -7
- package/lib/cjs/providers/storage/googleDrive.js +0 -6
- package/lib/cjs/providers/storage/indexeddb.d.ts +7 -5
- package/lib/cjs/providers/storage/indexeddb.js +0 -4
- package/lib/cjs/providers/storage/s3.d.ts +20 -6
- package/lib/cjs/providers/storage/s3.js +0 -5
- package/lib/cjs/providers/storage/url.d.ts +7 -6
- package/lib/cjs/providers/storage/url.js +0 -10
- package/lib/cjs/providers/storage/util.d.ts +1 -24
- package/lib/cjs/providers/storage/util.js +0 -18
- package/lib/cjs/templates/Templates.d.ts +0 -1
- package/lib/cjs/translations/en.d.ts +1 -0
- package/lib/cjs/translations/en.js +1 -0
- package/lib/cjs/utils/Evaluator.d.ts +3 -6
- package/lib/cjs/utils/Evaluator.js +20 -11
- package/lib/cjs/utils/builder.d.ts +7 -9
- package/lib/cjs/utils/builder.js +5 -10
- package/lib/cjs/utils/calendarUtils.d.ts +13 -7
- package/lib/cjs/utils/calendarUtils.js +17 -10
- package/lib/cjs/utils/formUtils.d.ts +171 -43
- package/lib/cjs/utils/formUtils.js +569 -38
- package/lib/cjs/utils/utils.d.ts +216 -362
- package/lib/cjs/utils/utils.js +224 -331
- package/lib/cjs/widgets/CalendarWidget.d.ts +10 -9
- package/lib/cjs/widgets/CalendarWidget.js +11 -9
- package/lib/mjs/Element.d.ts +96 -86
- package/lib/mjs/Element.js +78 -68
- package/lib/mjs/Form.d.ts +36 -365
- package/lib/mjs/Form.js +57 -140
- package/lib/mjs/FormBuilder.d.ts +2 -187
- package/lib/mjs/FormBuilder.js +8 -32
- package/lib/mjs/PDF.d.ts +13 -11
- package/lib/mjs/PDF.js +8 -6
- package/lib/mjs/Webform.d.ts +139 -180
- package/lib/mjs/Webform.js +310 -325
- package/lib/mjs/WebformBuilder.d.ts +14 -16
- package/lib/mjs/WebformBuilder.js +11 -16
- package/lib/mjs/Wizard.d.ts +21 -31
- package/lib/mjs/Wizard.js +18 -41
- package/lib/mjs/WizardBuilder.d.ts +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +5 -8
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +3 -6
- package/lib/mjs/components/Components.d.ts +4 -4
- package/lib/mjs/components/Components.js +3 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +269 -502
- package/lib/mjs/components/_classes/component/Component.form.d.ts +3 -6
- package/lib/mjs/components/_classes/component/Component.form.js +0 -5
- package/lib/mjs/components/_classes/component/Component.js +189 -433
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +8 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +1 -1
- package/lib/mjs/components/_classes/component/editForm/utils.js +1 -1
- package/lib/mjs/components/_classes/field/Field.d.ts +2 -11
- package/lib/mjs/components/_classes/field/Field.js +1 -13
- package/lib/mjs/components/_classes/input/Input.d.ts +3 -4
- package/lib/mjs/components/_classes/input/Input.js +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.d.ts +2 -2
- package/lib/mjs/components/_classes/list/ListComponent.form.d.ts +3 -6
- package/lib/mjs/components/_classes/list/ListComponent.form.js +0 -5
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +12 -43
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +3 -37
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +67 -163
- package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +3 -6
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +0 -5
- package/lib/mjs/components/_classes/nested/NestedComponent.js +54 -175
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -7
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +3 -2
- package/lib/mjs/components/address/Address.d.ts +2 -4
- package/lib/mjs/components/address/Address.form.d.ts +3 -6
- package/lib/mjs/components/address/Address.form.js +0 -5
- package/lib/mjs/components/button/Button.d.ts +12 -3
- package/lib/mjs/components/button/Button.form.d.ts +3 -6
- package/lib/mjs/components/button/Button.form.js +0 -5
- package/lib/mjs/components/button/Button.js +0 -5
- package/lib/mjs/components/checkbox/Checkbox.d.ts +27 -4
- package/lib/mjs/components/checkbox/Checkbox.form.d.ts +3 -6
- package/lib/mjs/components/checkbox/Checkbox.form.js +0 -5
- package/lib/mjs/components/columns/Columns.d.ts +2 -3
- package/lib/mjs/components/columns/Columns.form.d.ts +3 -6
- package/lib/mjs/components/columns/Columns.form.js +0 -5
- package/lib/mjs/components/columns/Columns.js +1 -1
- package/lib/mjs/components/container/Container.form.d.ts +3 -6
- package/lib/mjs/components/container/Container.form.js +0 -5
- package/lib/mjs/components/content/Content.d.ts +1 -2
- package/lib/mjs/components/content/Content.form.d.ts +3 -6
- package/lib/mjs/components/content/Content.form.js +0 -5
- package/lib/mjs/components/currency/Currency.form.d.ts +3 -6
- package/lib/mjs/components/currency/Currency.form.js +0 -5
- package/lib/mjs/components/currency/Currency.js +2 -1
- package/lib/mjs/components/datagrid/DataGrid.d.ts +7 -8
- package/lib/mjs/components/datagrid/DataGrid.form.d.ts +3 -6
- package/lib/mjs/components/datagrid/DataGrid.form.js +0 -5
- package/lib/mjs/components/datagrid/DataGrid.js +5 -5
- package/lib/mjs/components/datamap/DataMap.d.ts +0 -1
- package/lib/mjs/components/datamap/DataMap.form.d.ts +3 -6
- package/lib/mjs/components/datamap/DataMap.form.js +0 -5
- package/lib/mjs/components/datetime/DateTime.d.ts +14 -0
- package/lib/mjs/components/datetime/DateTime.form.d.ts +3 -6
- package/lib/mjs/components/datetime/DateTime.form.js +0 -5
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +48 -22
- package/lib/mjs/components/day/Day.form.d.ts +3 -6
- package/lib/mjs/components/day/Day.form.js +0 -5
- package/lib/mjs/components/day/Day.js +20 -15
- package/lib/mjs/components/editgrid/EditGrid.d.ts +3 -7
- package/lib/mjs/components/editgrid/EditGrid.form.d.ts +3 -6
- package/lib/mjs/components/editgrid/EditGrid.form.js +0 -5
- package/lib/mjs/components/editgrid/EditGrid.js +3 -3
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
- package/lib/mjs/components/email/Email.form.d.ts +3 -6
- package/lib/mjs/components/email/Email.form.js +0 -5
- package/lib/mjs/components/fieldset/Fieldset.form.d.ts +3 -6
- package/lib/mjs/components/fieldset/Fieldset.form.js +0 -5
- package/lib/mjs/components/file/File.d.ts +22 -9
- package/lib/mjs/components/file/File.form.d.ts +3 -6
- package/lib/mjs/components/file/File.form.js +0 -5
- package/lib/mjs/components/form/Form.d.ts +20 -31
- package/lib/mjs/components/form/Form.form.d.ts +3 -6
- package/lib/mjs/components/form/Form.form.js +0 -5
- package/lib/mjs/components/form/Form.js +10 -13
- package/lib/mjs/components/hidden/Hidden.d.ts +11 -1
- package/lib/mjs/components/hidden/Hidden.form.d.ts +3 -6
- package/lib/mjs/components/hidden/Hidden.form.js +0 -5
- package/lib/mjs/components/hidden/Hidden.js +2 -1
- package/lib/mjs/components/html/HTML.d.ts +1 -2
- package/lib/mjs/components/html/HTML.form.d.ts +3 -6
- package/lib/mjs/components/html/HTML.form.js +0 -5
- package/lib/mjs/components/number/Number.d.ts +17 -3
- package/lib/mjs/components/number/Number.form.d.ts +3 -6
- package/lib/mjs/components/number/Number.form.js +0 -5
- package/lib/mjs/components/number/Number.js +2 -1
- package/lib/mjs/components/panel/Panel.form.d.ts +3 -6
- package/lib/mjs/components/panel/Panel.form.js +0 -5
- package/lib/mjs/components/panel/Panel.js +1 -0
- package/lib/mjs/components/password/Password.form.d.ts +3 -6
- package/lib/mjs/components/password/Password.form.js +0 -5
- package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +3 -6
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +0 -5
- package/lib/mjs/components/radio/Radio.d.ts +26 -3
- package/lib/mjs/components/radio/Radio.form.d.ts +3 -6
- package/lib/mjs/components/radio/Radio.form.js +0 -5
- package/lib/mjs/components/radio/Radio.js +4 -3
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +3 -5
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +0 -4
- package/lib/mjs/components/select/Select.d.ts +39 -16
- package/lib/mjs/components/select/Select.form.d.ts +3 -6
- package/lib/mjs/components/select/Select.form.js +0 -5
- package/lib/mjs/components/select/Select.js +16 -13
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +17 -2
- package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +3 -6
- package/lib/mjs/components/selectboxes/SelectBoxes.form.js +0 -5
- package/lib/mjs/components/selectboxes/SelectBoxes.js +9 -7
- package/lib/mjs/components/signature/Signature.d.ts +14 -1
- package/lib/mjs/components/signature/Signature.form.d.ts +3 -6
- package/lib/mjs/components/signature/Signature.form.js +0 -5
- package/lib/mjs/components/survey/Survey.d.ts +15 -3
- package/lib/mjs/components/survey/Survey.form.d.ts +3 -6
- package/lib/mjs/components/survey/Survey.form.js +0 -5
- package/lib/mjs/components/table/Table.d.ts +1 -2
- package/lib/mjs/components/table/Table.form.d.ts +3 -6
- package/lib/mjs/components/table/Table.form.js +0 -5
- package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/mjs/components/tabs/Tabs.form.d.ts +3 -6
- package/lib/mjs/components/tabs/Tabs.form.js +0 -5
- package/lib/mjs/components/tabs/Tabs.js +2 -1
- package/lib/mjs/components/tags/Tags.d.ts +14 -0
- package/lib/mjs/components/tags/Tags.form.d.ts +3 -6
- package/lib/mjs/components/tags/Tags.form.js +0 -5
- package/lib/mjs/components/textarea/TextArea.d.ts +9 -4
- package/lib/mjs/components/textarea/TextArea.form.d.ts +3 -6
- package/lib/mjs/components/textarea/TextArea.form.js +0 -5
- package/lib/mjs/components/textarea/TextArea.js +2 -2
- package/lib/mjs/components/textfield/TextField.d.ts +30 -14
- package/lib/mjs/components/textfield/TextField.form.d.ts +3 -6
- package/lib/mjs/components/textfield/TextField.form.js +0 -5
- package/lib/mjs/components/textfield/TextField.js +16 -13
- package/lib/mjs/components/time/Time.form.d.ts +3 -6
- package/lib/mjs/components/time/Time.form.js +0 -5
- package/lib/mjs/components/unknown/Unknown.form.d.ts +34 -5
- package/lib/mjs/components/unknown/Unknown.form.js +0 -4
- package/lib/mjs/components/url/Url.form.d.ts +3 -6
- package/lib/mjs/components/url/Url.form.js +0 -5
- package/lib/mjs/components/well/Well.form.d.ts +3 -6
- package/lib/mjs/components/well/Well.form.js +0 -5
- package/lib/mjs/formio.embed.d.ts +2 -1
- package/lib/mjs/formio.embed.js +99 -2
- package/lib/mjs/formio.form.d.ts +4 -11
- package/lib/mjs/formio.form.js +3 -10
- package/lib/mjs/providers/Providers.d.ts +5 -36
- package/lib/mjs/providers/Providers.js +0 -29
- package/lib/mjs/providers/address/AddressProvider.d.ts +12 -131
- package/lib/mjs/providers/address/AddressProvider.js +2 -88
- package/lib/mjs/providers/address/AzureAddressProvider.d.ts +1 -48
- package/lib/mjs/providers/address/AzureAddressProvider.js +0 -37
- package/lib/mjs/providers/address/CustomAddressProvider.d.ts +4 -27
- package/lib/mjs/providers/address/CustomAddressProvider.js +0 -34
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +6 -130
- package/lib/mjs/providers/address/GoogleAddressProvider.js +0 -72
- package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +7 -32
- package/lib/mjs/providers/address/NominatimAddressProvider.js +0 -33
- package/lib/mjs/providers/address/index.d.ts +1 -3
- package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -7
- package/lib/mjs/providers/processor/fileProcessor.js +0 -6
- package/lib/mjs/providers/storage/azure.d.ts +13 -6
- package/lib/mjs/providers/storage/azure.js +0 -5
- package/lib/mjs/providers/storage/base64.d.ts +6 -5
- package/lib/mjs/providers/storage/base64.js +0 -4
- package/lib/mjs/providers/storage/dropbox.d.ts +4 -6
- package/lib/mjs/providers/storage/dropbox.js +0 -5
- package/lib/mjs/providers/storage/googleDrive.d.ts +5 -7
- package/lib/mjs/providers/storage/googleDrive.js +0 -6
- package/lib/mjs/providers/storage/indexeddb.d.ts +7 -5
- package/lib/mjs/providers/storage/indexeddb.js +0 -4
- package/lib/mjs/providers/storage/s3.d.ts +20 -6
- package/lib/mjs/providers/storage/s3.js +0 -5
- package/lib/mjs/providers/storage/url.d.ts +7 -6
- package/lib/mjs/providers/storage/url.js +0 -10
- package/lib/mjs/providers/storage/util.d.ts +1 -24
- package/lib/mjs/providers/storage/util.js +0 -18
- package/lib/mjs/templates/Templates.d.ts +0 -1
- package/lib/mjs/translations/en.d.ts +1 -0
- package/lib/mjs/translations/en.js +1 -0
- package/lib/mjs/utils/Evaluator.d.ts +3 -6
- package/lib/mjs/utils/Evaluator.js +20 -9
- package/lib/mjs/utils/builder.d.ts +7 -9
- package/lib/mjs/utils/builder.js +5 -10
- package/lib/mjs/utils/calendarUtils.d.ts +13 -7
- package/lib/mjs/utils/calendarUtils.js +17 -10
- package/lib/mjs/utils/formUtils.d.ts +171 -43
- package/lib/mjs/utils/formUtils.js +554 -6
- package/lib/mjs/utils/utils.d.ts +216 -362
- package/lib/mjs/utils/utils.js +218 -325
- package/lib/mjs/widgets/CalendarWidget.d.ts +10 -9
- package/lib/mjs/widgets/CalendarWidget.js +11 -9
- package/package.json +22 -22
- package/embed.d.ts +0 -1
- package/form.d.ts +0 -1
- package/lib/cjs/InlineEmbed.d.ts +0 -7
- package/lib/cjs/InlineEmbed.js +0 -109
- package/lib/mjs/InlineEmbed.d.ts +0 -7
- package/lib/mjs/InlineEmbed.js +0 -105
- package/sdk.d.ts +0 -1
- package/utils.d.ts +0 -1
|
@@ -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) {
|
|
@@ -2088,15 +1857,6 @@ class Component extends Element_1.default {
|
|
|
2088
1857
|
}).join(''));
|
|
2089
1858
|
}
|
|
2090
1859
|
}
|
|
2091
|
-
/**
|
|
2092
|
-
* Sets the form input widget error classes.
|
|
2093
|
-
* @param {Array<HTMLElement>} elements - An array of DOM elements to set the error classes on.
|
|
2094
|
-
* @param {boolean} dirty - If the input is dirty.
|
|
2095
|
-
* @param {boolean} hasErrors - If the input has errors.
|
|
2096
|
-
* @param {boolean} hasMessages - If the input has messages.
|
|
2097
|
-
* @param {HTMLElement} element - The wrapper element for all the other elements passed in first argument.
|
|
2098
|
-
* @returns {void}
|
|
2099
|
-
*/
|
|
2100
1860
|
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
2101
1861
|
this.clearErrorClasses();
|
|
2102
1862
|
elements.forEach((element) => {
|
|
@@ -2123,12 +1883,6 @@ class Component extends Element_1.default {
|
|
|
2123
1883
|
this.addClass(element, 'has-message');
|
|
2124
1884
|
}
|
|
2125
1885
|
}
|
|
2126
|
-
/**
|
|
2127
|
-
* Adds the classes necessary to mark an element as invalid.
|
|
2128
|
-
* @param {HTMLElement} element - The element you wish to add the invalid classes to.
|
|
2129
|
-
* @param {boolean} invalid - TRUE if the component is invalid, FALSE otherwise.
|
|
2130
|
-
* @returns {void}
|
|
2131
|
-
*/
|
|
2132
1886
|
setElementInvalid(element, invalid) {
|
|
2133
1887
|
if (!element)
|
|
2134
1888
|
return;
|
|
@@ -2140,9 +1894,6 @@ class Component extends Element_1.default {
|
|
|
2140
1894
|
}
|
|
2141
1895
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
|
2142
1896
|
}
|
|
2143
|
-
/**
|
|
2144
|
-
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
|
2145
|
-
*/
|
|
2146
1897
|
clearOnHide() {
|
|
2147
1898
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
2148
1899
|
if (
|
|
@@ -2162,10 +1913,6 @@ class Component extends Element_1.default {
|
|
|
2162
1913
|
}
|
|
2163
1914
|
}
|
|
2164
1915
|
}
|
|
2165
|
-
/**
|
|
2166
|
-
* Triggers a debounced onChange event for the root component (usually Webform).
|
|
2167
|
-
* @param {...any} args - The arguments to pass to the onChange event.
|
|
2168
|
-
*/
|
|
2169
1916
|
triggerRootChange(...args) {
|
|
2170
1917
|
if (this.options.onChange) {
|
|
2171
1918
|
this.options.onChange(...args);
|
|
@@ -2174,13 +1921,6 @@ class Component extends Element_1.default {
|
|
|
2174
1921
|
this.root.triggerChange(...args);
|
|
2175
1922
|
}
|
|
2176
1923
|
}
|
|
2177
|
-
/**
|
|
2178
|
-
* Called when the component value has been changed. This will then trigger the root level onChange handler which
|
|
2179
|
-
* propagates the checkData methods for the full component tree.
|
|
2180
|
-
* @param {any} flags - The flags for the change event propagation.
|
|
2181
|
-
* @param {boolean} fromRoot - If the change event is from the root component.
|
|
2182
|
-
* @returns {boolean} - TRUE if the component has changed.
|
|
2183
|
-
*/
|
|
2184
1924
|
onChange(flags, fromRoot) {
|
|
2185
1925
|
flags = flags || {};
|
|
2186
1926
|
if (flags.modified) {
|
|
@@ -2310,7 +2050,7 @@ class Component extends Element_1.default {
|
|
|
2310
2050
|
return Promise.reject();
|
|
2311
2051
|
}
|
|
2312
2052
|
this.quill = new Quill(element, isIEBrowser ? Object.assign(Object.assign({}, settings), { modules: {} }) : settings);
|
|
2313
|
-
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ
|
|
2053
|
+
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ **/
|
|
2314
2054
|
const txtArea = document.createElement('textarea');
|
|
2315
2055
|
txtArea.setAttribute('class', 'quill-source-code');
|
|
2316
2056
|
this.quill.addContainer('ql-custom').appendChild(txtArea);
|
|
@@ -2324,7 +2064,7 @@ class Component extends Element_1.default {
|
|
|
2324
2064
|
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2325
2065
|
});
|
|
2326
2066
|
}
|
|
2327
|
-
/** END CODEBLOCK
|
|
2067
|
+
/** END CODEBLOCK **/
|
|
2328
2068
|
// Make sure to select cursor when they click on the element.
|
|
2329
2069
|
this.addEventListener(element, 'click', () => this.quill.focus());
|
|
2330
2070
|
// Allows users to skip toolbar items when tabbing though form
|
|
@@ -2372,22 +2112,23 @@ class Component extends Element_1.default {
|
|
|
2372
2112
|
}
|
|
2373
2113
|
/**
|
|
2374
2114
|
* The empty value for this component.
|
|
2375
|
-
*
|
|
2115
|
+
*
|
|
2116
|
+
* @return {null}
|
|
2376
2117
|
*/
|
|
2377
2118
|
get emptyValue() {
|
|
2378
2119
|
return null;
|
|
2379
2120
|
}
|
|
2380
2121
|
/**
|
|
2381
2122
|
* Returns if this component has a value set.
|
|
2382
|
-
*
|
|
2383
|
-
* @returns {boolean} - TRUE if a value is set.
|
|
2123
|
+
*
|
|
2384
2124
|
*/
|
|
2385
2125
|
hasValue(data) {
|
|
2386
2126
|
return !lodash_1.default.isUndefined(lodash_1.default.get(data || this.data, this.key));
|
|
2387
2127
|
}
|
|
2388
2128
|
/**
|
|
2389
2129
|
* Get the data value at the root level.
|
|
2390
|
-
*
|
|
2130
|
+
*
|
|
2131
|
+
* @return {*}
|
|
2391
2132
|
*/
|
|
2392
2133
|
get rootValue() {
|
|
2393
2134
|
return this.root ? this.root.data : this.data;
|
|
@@ -2397,7 +2138,7 @@ class Component extends Element_1.default {
|
|
|
2397
2138
|
}
|
|
2398
2139
|
/**
|
|
2399
2140
|
* Get the static value of this component.
|
|
2400
|
-
* @
|
|
2141
|
+
* @return {*}
|
|
2401
2142
|
*/
|
|
2402
2143
|
get dataValue() {
|
|
2403
2144
|
if (!this.key ||
|
|
@@ -2415,7 +2156,8 @@ class Component extends Element_1.default {
|
|
|
2415
2156
|
}
|
|
2416
2157
|
/**
|
|
2417
2158
|
* Sets the static value of this component.
|
|
2418
|
-
*
|
|
2159
|
+
*
|
|
2160
|
+
* @param value
|
|
2419
2161
|
*/
|
|
2420
2162
|
set dataValue(value) {
|
|
2421
2163
|
if (!this.allowData ||
|
|
@@ -2435,8 +2177,8 @@ class Component extends Element_1.default {
|
|
|
2435
2177
|
}
|
|
2436
2178
|
/**
|
|
2437
2179
|
* Splice a value from the dataValue.
|
|
2438
|
-
*
|
|
2439
|
-
* @param
|
|
2180
|
+
*
|
|
2181
|
+
* @param index
|
|
2440
2182
|
*/
|
|
2441
2183
|
splice(index, flags = {}) {
|
|
2442
2184
|
if (this.hasValue()) {
|
|
@@ -2504,7 +2246,8 @@ class Component extends Element_1.default {
|
|
|
2504
2246
|
}
|
|
2505
2247
|
/**
|
|
2506
2248
|
* Get the input value of this component.
|
|
2507
|
-
*
|
|
2249
|
+
*
|
|
2250
|
+
* @return {*}
|
|
2508
2251
|
*/
|
|
2509
2252
|
getValue() {
|
|
2510
2253
|
if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
@@ -2526,8 +2269,9 @@ class Component extends Element_1.default {
|
|
|
2526
2269
|
}
|
|
2527
2270
|
/**
|
|
2528
2271
|
* Get the value at a specific index.
|
|
2529
|
-
*
|
|
2530
|
-
* @
|
|
2272
|
+
*
|
|
2273
|
+
* @param index
|
|
2274
|
+
* @returns {*}
|
|
2531
2275
|
*/
|
|
2532
2276
|
getValueAt(index) {
|
|
2533
2277
|
const input = this.performInputMapping(this.refs.input[index]);
|
|
@@ -2535,9 +2279,11 @@ class Component extends Element_1.default {
|
|
|
2535
2279
|
}
|
|
2536
2280
|
/**
|
|
2537
2281
|
* Set the value of this component.
|
|
2538
|
-
*
|
|
2539
|
-
* @param
|
|
2540
|
-
* @
|
|
2282
|
+
*
|
|
2283
|
+
* @param value
|
|
2284
|
+
* @param flags
|
|
2285
|
+
*
|
|
2286
|
+
* @return {boolean} - If the value changed.
|
|
2541
2287
|
*/
|
|
2542
2288
|
setValue(value, flags = {}) {
|
|
2543
2289
|
const changed = this.updateValue(value, flags);
|
|
@@ -2568,9 +2314,9 @@ class Component extends Element_1.default {
|
|
|
2568
2314
|
}
|
|
2569
2315
|
/**
|
|
2570
2316
|
* Set the value at a specific index.
|
|
2571
|
-
*
|
|
2572
|
-
* @param
|
|
2573
|
-
* @param
|
|
2317
|
+
*
|
|
2318
|
+
* @param index
|
|
2319
|
+
* @param value
|
|
2574
2320
|
*/
|
|
2575
2321
|
setValueAt(index, value, flags = {}) {
|
|
2576
2322
|
if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
|
|
@@ -2617,8 +2363,9 @@ class Component extends Element_1.default {
|
|
|
2617
2363
|
}
|
|
2618
2364
|
/**
|
|
2619
2365
|
* Normalize values coming into updateValue.
|
|
2620
|
-
*
|
|
2621
|
-
* @
|
|
2366
|
+
*
|
|
2367
|
+
* @param value
|
|
2368
|
+
* @return {*}
|
|
2622
2369
|
*/
|
|
2623
2370
|
normalizeValue(value) {
|
|
2624
2371
|
if (this.component.multiple && !Array.isArray(value)) {
|
|
@@ -2628,9 +2375,8 @@ class Component extends Element_1.default {
|
|
|
2628
2375
|
}
|
|
2629
2376
|
/**
|
|
2630
2377
|
* Update a value of this component.
|
|
2631
|
-
*
|
|
2632
|
-
* @param
|
|
2633
|
-
* @returns {boolean} - If the value changed.
|
|
2378
|
+
*
|
|
2379
|
+
* @param flags
|
|
2634
2380
|
*/
|
|
2635
2381
|
updateComponentValue(value, flags = {}) {
|
|
2636
2382
|
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
@@ -2649,8 +2395,9 @@ class Component extends Element_1.default {
|
|
|
2649
2395
|
}
|
|
2650
2396
|
/**
|
|
2651
2397
|
* Updates the value of this component plus all sub-components.
|
|
2652
|
-
*
|
|
2653
|
-
* @
|
|
2398
|
+
*
|
|
2399
|
+
* @param args
|
|
2400
|
+
* @return {boolean}
|
|
2654
2401
|
*/
|
|
2655
2402
|
updateValue(...args) {
|
|
2656
2403
|
return this.updateComponentValue(...args);
|
|
@@ -2676,9 +2423,10 @@ class Component extends Element_1.default {
|
|
|
2676
2423
|
}
|
|
2677
2424
|
/**
|
|
2678
2425
|
* Determine if the value of this component has changed.
|
|
2679
|
-
*
|
|
2680
|
-
* @param
|
|
2681
|
-
* @
|
|
2426
|
+
*
|
|
2427
|
+
* @param newValue
|
|
2428
|
+
* @param oldValue
|
|
2429
|
+
* @return {boolean}
|
|
2682
2430
|
*/
|
|
2683
2431
|
hasChanged(newValue, oldValue) {
|
|
2684
2432
|
if (((newValue === undefined) || (newValue === null)) &&
|
|
@@ -2696,9 +2444,8 @@ class Component extends Element_1.default {
|
|
|
2696
2444
|
}
|
|
2697
2445
|
/**
|
|
2698
2446
|
* Update the value on change.
|
|
2699
|
-
*
|
|
2700
|
-
* @param
|
|
2701
|
-
* @returns {boolean} - If the value changed.
|
|
2447
|
+
*
|
|
2448
|
+
* @param flags
|
|
2702
2449
|
*/
|
|
2703
2450
|
updateOnChange(flags = {}, changed = false) {
|
|
2704
2451
|
if (!flags.noUpdateEvent && changed) {
|
|
@@ -2711,6 +2458,13 @@ class Component extends Element_1.default {
|
|
|
2711
2458
|
}
|
|
2712
2459
|
return false;
|
|
2713
2460
|
}
|
|
2461
|
+
/**
|
|
2462
|
+
* Perform a calculated value operation.
|
|
2463
|
+
*
|
|
2464
|
+
* @param data - The global data object.
|
|
2465
|
+
*
|
|
2466
|
+
* @return {boolean} - If the value changed during calculation.
|
|
2467
|
+
*/
|
|
2714
2468
|
convertNumberOrBoolToString(value) {
|
|
2715
2469
|
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
2716
2470
|
return value.toString();
|
|
@@ -2819,10 +2573,9 @@ class Component extends Element_1.default {
|
|
|
2819
2573
|
/* eslint-enable max-statements */
|
|
2820
2574
|
/**
|
|
2821
2575
|
* Performs calculations in this component plus any child components.
|
|
2822
|
-
*
|
|
2823
|
-
* @param
|
|
2824
|
-
* @
|
|
2825
|
-
* @returns {boolean} - TRUE if the value changed.
|
|
2576
|
+
*
|
|
2577
|
+
* @param args
|
|
2578
|
+
* @return {boolean}
|
|
2826
2579
|
*/
|
|
2827
2580
|
calculateValue(data, flags, row) {
|
|
2828
2581
|
data = data || this.rootValue;
|
|
@@ -2832,14 +2585,15 @@ class Component extends Element_1.default {
|
|
|
2832
2585
|
}
|
|
2833
2586
|
/**
|
|
2834
2587
|
* Get this component's label text.
|
|
2835
|
-
*
|
|
2588
|
+
*
|
|
2836
2589
|
*/
|
|
2837
2590
|
get label() {
|
|
2838
2591
|
return this.component.label;
|
|
2839
2592
|
}
|
|
2840
2593
|
/**
|
|
2841
2594
|
* Set this component's label text and render it.
|
|
2842
|
-
*
|
|
2595
|
+
*
|
|
2596
|
+
* @param value - The new label text.
|
|
2843
2597
|
*/
|
|
2844
2598
|
set label(value) {
|
|
2845
2599
|
this.component.label = value;
|
|
@@ -2849,18 +2603,17 @@ class Component extends Element_1.default {
|
|
|
2849
2603
|
}
|
|
2850
2604
|
/**
|
|
2851
2605
|
* Get FormioForm element at the root of this component tree.
|
|
2852
|
-
*
|
|
2606
|
+
*
|
|
2853
2607
|
*/
|
|
2854
2608
|
getRoot() {
|
|
2855
2609
|
return this.root;
|
|
2856
2610
|
}
|
|
2857
2611
|
/**
|
|
2858
2612
|
* Returns the invalid message, or empty string if the component is valid.
|
|
2859
|
-
*
|
|
2860
|
-
* @param
|
|
2861
|
-
* @param
|
|
2862
|
-
* @
|
|
2863
|
-
* @returns {string} - The message to show when the component is invalid.
|
|
2613
|
+
*
|
|
2614
|
+
* @param data
|
|
2615
|
+
* @param dirty
|
|
2616
|
+
* @return {*}
|
|
2864
2617
|
*/
|
|
2865
2618
|
invalidMessage(data, dirty, ignoreCondition, row) {
|
|
2866
2619
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
|
@@ -2892,9 +2645,10 @@ class Component extends Element_1.default {
|
|
|
2892
2645
|
}
|
|
2893
2646
|
/**
|
|
2894
2647
|
* Returns if the component is valid or not.
|
|
2895
|
-
*
|
|
2896
|
-
* @param
|
|
2897
|
-
* @
|
|
2648
|
+
*
|
|
2649
|
+
* @param data
|
|
2650
|
+
* @param dirty
|
|
2651
|
+
* @return {boolean}
|
|
2898
2652
|
*/
|
|
2899
2653
|
isValid(data, dirty) {
|
|
2900
2654
|
return !this.invalidMessage(data, dirty);
|
|
@@ -2913,8 +2667,8 @@ class Component extends Element_1.default {
|
|
|
2913
2667
|
}
|
|
2914
2668
|
/**
|
|
2915
2669
|
* Interpolate errors from the validation methods.
|
|
2916
|
-
* @param {
|
|
2917
|
-
* @returns
|
|
2670
|
+
* @param {*} errors
|
|
2671
|
+
* @returns
|
|
2918
2672
|
*/
|
|
2919
2673
|
interpolateErrors(errors) {
|
|
2920
2674
|
var _a;
|
|
@@ -2927,7 +2681,7 @@ class Component extends Element_1.default {
|
|
|
2927
2681
|
* @param {*} data - The root submission data.
|
|
2928
2682
|
* @param {*} row - The contextual row data.
|
|
2929
2683
|
* @param {*} flags - The flags to perform validation.
|
|
2930
|
-
* @returns
|
|
2684
|
+
* @returns
|
|
2931
2685
|
*/
|
|
2932
2686
|
showValidationErrors(errors, data, row, flags) {
|
|
2933
2687
|
if (flags.silentCheck) {
|
|
@@ -2947,9 +2701,9 @@ class Component extends Element_1.default {
|
|
|
2947
2701
|
* @param {*} data - The root data you wish to use for this component.
|
|
2948
2702
|
* @param {*} row - The contextual row data you wish to use for this component.
|
|
2949
2703
|
* @param {*} flags - The flags to control the behavior of the validation.
|
|
2950
|
-
* @returns
|
|
2704
|
+
* @returns
|
|
2951
2705
|
*/
|
|
2952
|
-
validateComponent(data
|
|
2706
|
+
validateComponent(data, row, flags = {}) {
|
|
2953
2707
|
data = data || this.rootValue;
|
|
2954
2708
|
row = row || this.data;
|
|
2955
2709
|
const { async = false } = flags;
|
|
@@ -2980,14 +2734,13 @@ class Component extends Element_1.default {
|
|
|
2980
2734
|
}
|
|
2981
2735
|
/**
|
|
2982
2736
|
* Checks the validity of this component and sets the error message if it is invalid.
|
|
2983
|
-
*
|
|
2984
|
-
* @param
|
|
2985
|
-
* @param
|
|
2986
|
-
* @param
|
|
2987
|
-
* @
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
2737
|
+
*
|
|
2738
|
+
* @param data
|
|
2739
|
+
* @param dirty
|
|
2740
|
+
* @param row
|
|
2741
|
+
* @return {boolean}
|
|
2742
|
+
*/
|
|
2743
|
+
checkComponentValidity(data, dirty, row, flags = {}, allErrors = []) {
|
|
2991
2744
|
data = data || this.rootValue;
|
|
2992
2745
|
row = row || this.data;
|
|
2993
2746
|
flags.dirty = dirty || false;
|
|
@@ -3023,30 +2776,32 @@ class Component extends Element_1.default {
|
|
|
3023
2776
|
}
|
|
3024
2777
|
/**
|
|
3025
2778
|
* Checks the validity of the component.
|
|
3026
|
-
* @param {*} data
|
|
3027
|
-
* @param {
|
|
3028
|
-
* @param {*} row
|
|
3029
|
-
* @param {
|
|
3030
|
-
* @
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2779
|
+
* @param {*} data
|
|
2780
|
+
* @param {*} dirty
|
|
2781
|
+
* @param {*} row
|
|
2782
|
+
* @param {*} silentCheck
|
|
2783
|
+
* @returns
|
|
2784
|
+
*/
|
|
2785
|
+
checkValidity(data, dirty, row, silentCheck, errors = []) {
|
|
3034
2786
|
data = data || this.rootValue;
|
|
3035
2787
|
row = row || this.data;
|
|
2788
|
+
console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3036
2789
|
return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
|
|
3037
2790
|
}
|
|
3038
|
-
checkAsyncValidity(data
|
|
2791
|
+
checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
|
|
2792
|
+
console.log('Deprecation warning: Component.checkAsyncValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3039
2793
|
return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
|
|
3040
2794
|
}
|
|
3041
2795
|
/**
|
|
3042
2796
|
* Check the conditions, calculations, and validity of a single component and triggers an update if
|
|
3043
2797
|
* something changed.
|
|
3044
|
-
*
|
|
3045
|
-
* @param
|
|
3046
|
-
* @param
|
|
3047
|
-
*
|
|
2798
|
+
*
|
|
2799
|
+
* @param data - The root data of the change event.
|
|
2800
|
+
* @param flags - The flags from this change event.
|
|
2801
|
+
*
|
|
2802
|
+
* @return boolean - If component is valid or not.
|
|
3048
2803
|
*/
|
|
3049
|
-
checkData(data
|
|
2804
|
+
checkData(data, flags, row) {
|
|
3050
2805
|
data = data || this.rootValue;
|
|
3051
2806
|
flags = flags || {};
|
|
3052
2807
|
row = row || this.data;
|
|
@@ -3089,7 +2844,8 @@ class Component extends Element_1.default {
|
|
|
3089
2844
|
}
|
|
3090
2845
|
/**
|
|
3091
2846
|
* Check if a component is eligible for multiple validation
|
|
3092
|
-
*
|
|
2847
|
+
*
|
|
2848
|
+
* @return {boolean}
|
|
3093
2849
|
*/
|
|
3094
2850
|
validateMultiple() {
|
|
3095
2851
|
return true;
|
|
@@ -3209,7 +2965,8 @@ class Component extends Element_1.default {
|
|
|
3209
2965
|
/**
|
|
3210
2966
|
* Determines if the value of this component is hidden from the user as if it is coming from the server, but is
|
|
3211
2967
|
* protected.
|
|
3212
|
-
*
|
|
2968
|
+
*
|
|
2969
|
+
* @return {boolean|*}
|
|
3213
2970
|
*/
|
|
3214
2971
|
isValueHidden() {
|
|
3215
2972
|
if (this.component.protected && this.root.editing) {
|
|
@@ -3254,8 +3011,6 @@ class Component extends Element_1.default {
|
|
|
3254
3011
|
}
|
|
3255
3012
|
/**
|
|
3256
3013
|
* Prints out the value of this component as a string value.
|
|
3257
|
-
* @param {*} value - The value to print out.
|
|
3258
|
-
* @returns {string} - The string representation of the value.
|
|
3259
3014
|
*/
|
|
3260
3015
|
asString(value) {
|
|
3261
3016
|
value = value || this.getValue();
|
|
@@ -3263,14 +3018,15 @@ class Component extends Element_1.default {
|
|
|
3263
3018
|
}
|
|
3264
3019
|
/**
|
|
3265
3020
|
* Return if the component is disabled.
|
|
3266
|
-
* @
|
|
3021
|
+
* @return {boolean}
|
|
3267
3022
|
*/
|
|
3268
3023
|
get disabled() {
|
|
3269
3024
|
return this._disabled || this.parentDisabled;
|
|
3270
3025
|
}
|
|
3271
3026
|
/**
|
|
3272
3027
|
* Disable this component.
|
|
3273
|
-
*
|
|
3028
|
+
*
|
|
3029
|
+
* @param {boolean} disabled
|
|
3274
3030
|
*/
|
|
3275
3031
|
set disabled(disabled) {
|
|
3276
3032
|
this._disabled = disabled;
|
|
@@ -3395,7 +3151,6 @@ class Component extends Element_1.default {
|
|
|
3395
3151
|
}
|
|
3396
3152
|
/**
|
|
3397
3153
|
* Get the element information.
|
|
3398
|
-
* @returns {*} - The components "input" DOM element information.
|
|
3399
3154
|
*/
|
|
3400
3155
|
elementInfo() {
|
|
3401
3156
|
const attributes = {
|
|
@@ -3434,13 +3189,15 @@ class Component extends Element_1.default {
|
|
|
3434
3189
|
const { left, top } = element.getBoundingClientRect();
|
|
3435
3190
|
window.scrollTo(left + window.scrollX, top + window.scrollY);
|
|
3436
3191
|
}
|
|
3437
|
-
focus(index
|
|
3192
|
+
focus(index) {
|
|
3438
3193
|
var _a, _b;
|
|
3439
3194
|
if ('beforeFocus' in this.parent) {
|
|
3440
3195
|
this.parent.beforeFocus(this);
|
|
3441
3196
|
}
|
|
3442
3197
|
if ((_a = this.refs.input) === null || _a === void 0 ? void 0 : _a.length) {
|
|
3443
|
-
const focusingInput = this.refs.input[index]
|
|
3198
|
+
const focusingInput = typeof index === 'number' && this.refs.input[index]
|
|
3199
|
+
? this.refs.input[index]
|
|
3200
|
+
: this.refs.input[this.refs.input.length - 1];
|
|
3444
3201
|
if (((_b = this.component.widget) === null || _b === void 0 ? void 0 : _b.type) === 'calendar') {
|
|
3445
3202
|
const sibling = focusingInput.nextSibling;
|
|
3446
3203
|
if (sibling) {
|
|
@@ -3460,7 +3217,6 @@ class Component extends Element_1.default {
|
|
|
3460
3217
|
}
|
|
3461
3218
|
/**
|
|
3462
3219
|
* Get `Formio` instance for working with files
|
|
3463
|
-
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
|
3464
3220
|
*/
|
|
3465
3221
|
get fileService() {
|
|
3466
3222
|
if (this.options.fileService) {
|