@formio/js 5.0.0-dev.5604.02ffada → 5.0.0-dev.5610.11a9aca
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 +1 -0
- 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 +641 -1189
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -11
- package/dist/formio.full.js +685 -913
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -11
- 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 +1855 -487
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +12 -2
- package/embed.d.ts +1 -0
- package/form.d.ts +1 -0
- package/lib/cjs/Element.d.ts +85 -96
- package/lib/cjs/Element.js +65 -76
- package/lib/cjs/Form.d.ts +365 -36
- package/lib/cjs/Form.js +50 -64
- package/lib/cjs/FormBuilder.d.ts +187 -2
- package/lib/cjs/FormBuilder.js +30 -8
- package/lib/cjs/InlineEmbed.d.ts +7 -0
- package/lib/cjs/InlineEmbed.js +109 -0
- package/lib/cjs/PDF.d.ts +11 -13
- package/lib/cjs/PDF.js +6 -8
- package/lib/cjs/Webform.d.ts +180 -139
- package/lib/cjs/Webform.js +313 -298
- package/lib/cjs/WebformBuilder.d.ts +16 -14
- package/lib/cjs/WebformBuilder.js +11 -10
- package/lib/cjs/Wizard.d.ts +31 -21
- package/lib/cjs/Wizard.js +42 -19
- package/lib/cjs/WizardBuilder.d.ts +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
- 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 +501 -266
- package/lib/cjs/components/_classes/component/Component.form.d.ts +6 -3
- package/lib/cjs/components/_classes/component/Component.form.js +5 -0
- package/lib/cjs/components/_classes/component/Component.js +433 -190
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +0 -8
- 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 +11 -2
- package/lib/cjs/components/_classes/field/Field.js +13 -1
- package/lib/cjs/components/_classes/input/Input.d.ts +4 -3
- 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 +6 -3
- package/lib/cjs/components/_classes/list/ListComponent.form.js +5 -0
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +37 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +163 -67
- package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +5 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +175 -54
- 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 +7 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
- package/lib/cjs/components/address/Address.d.ts +4 -2
- package/lib/cjs/components/address/Address.form.d.ts +6 -3
- package/lib/cjs/components/address/Address.form.js +5 -0
- package/lib/cjs/components/button/Button.d.ts +3 -12
- package/lib/cjs/components/button/Button.form.d.ts +6 -3
- package/lib/cjs/components/button/Button.form.js +5 -0
- package/lib/cjs/components/button/Button.js +5 -0
- package/lib/cjs/components/checkbox/Checkbox.d.ts +4 -27
- package/lib/cjs/components/checkbox/Checkbox.form.d.ts +6 -3
- package/lib/cjs/components/checkbox/Checkbox.form.js +5 -0
- package/lib/cjs/components/columns/Columns.d.ts +3 -2
- package/lib/cjs/components/columns/Columns.form.d.ts +6 -3
- package/lib/cjs/components/columns/Columns.form.js +5 -0
- package/lib/cjs/components/columns/Columns.js +1 -1
- package/lib/cjs/components/container/Container.form.d.ts +6 -3
- package/lib/cjs/components/container/Container.form.js +5 -0
- package/lib/cjs/components/content/Content.d.ts +2 -1
- package/lib/cjs/components/content/Content.form.d.ts +6 -3
- package/lib/cjs/components/content/Content.form.js +5 -0
- package/lib/cjs/components/currency/Currency.form.d.ts +6 -3
- package/lib/cjs/components/currency/Currency.form.js +5 -0
- package/lib/cjs/components/currency/Currency.js +1 -2
- package/lib/cjs/components/datagrid/DataGrid.d.ts +8 -7
- package/lib/cjs/components/datagrid/DataGrid.form.d.ts +6 -3
- package/lib/cjs/components/datagrid/DataGrid.form.js +5 -0
- package/lib/cjs/components/datagrid/DataGrid.js +5 -5
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/cjs/components/datamap/DataMap.form.d.ts +6 -3
- package/lib/cjs/components/datamap/DataMap.form.js +5 -0
- package/lib/cjs/components/datetime/DateTime.d.ts +0 -14
- package/lib/cjs/components/datetime/DateTime.form.d.ts +6 -3
- package/lib/cjs/components/datetime/DateTime.form.js +5 -0
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +2 -2
- package/lib/cjs/components/day/Day.d.ts +22 -48
- package/lib/cjs/components/day/Day.form.d.ts +6 -3
- package/lib/cjs/components/day/Day.form.js +5 -0
- package/lib/cjs/components/day/Day.js +15 -20
- package/lib/cjs/components/editgrid/EditGrid.d.ts +7 -3
- package/lib/cjs/components/editgrid/EditGrid.form.d.ts +6 -3
- package/lib/cjs/components/editgrid/EditGrid.form.js +5 -0
- package/lib/cjs/components/editgrid/EditGrid.js +3 -3
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -5
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +6 -9
- package/lib/cjs/components/email/Email.form.d.ts +6 -3
- package/lib/cjs/components/email/Email.form.js +5 -0
- package/lib/cjs/components/fieldset/Fieldset.form.d.ts +6 -3
- package/lib/cjs/components/fieldset/Fieldset.form.js +5 -0
- package/lib/cjs/components/file/File.d.ts +9 -22
- package/lib/cjs/components/file/File.form.d.ts +6 -3
- package/lib/cjs/components/file/File.form.js +5 -0
- package/lib/cjs/components/form/Form.d.ts +31 -20
- package/lib/cjs/components/form/Form.form.d.ts +6 -3
- package/lib/cjs/components/form/Form.form.js +5 -0
- package/lib/cjs/components/form/Form.js +13 -10
- package/lib/cjs/components/hidden/Hidden.d.ts +1 -11
- package/lib/cjs/components/hidden/Hidden.form.d.ts +6 -3
- package/lib/cjs/components/hidden/Hidden.form.js +5 -0
- package/lib/cjs/components/hidden/Hidden.js +1 -2
- package/lib/cjs/components/html/HTML.d.ts +2 -1
- package/lib/cjs/components/html/HTML.form.d.ts +6 -3
- package/lib/cjs/components/html/HTML.form.js +5 -0
- package/lib/cjs/components/number/Number.d.ts +3 -17
- package/lib/cjs/components/number/Number.form.d.ts +6 -3
- package/lib/cjs/components/number/Number.form.js +5 -0
- package/lib/cjs/components/number/Number.js +1 -2
- package/lib/cjs/components/panel/Panel.form.d.ts +6 -3
- package/lib/cjs/components/panel/Panel.form.js +5 -0
- package/lib/cjs/components/panel/Panel.js +0 -1
- package/lib/cjs/components/password/Password.form.d.ts +6 -3
- package/lib/cjs/components/password/Password.form.js +5 -0
- package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +5 -0
- package/lib/cjs/components/radio/Radio.d.ts +3 -26
- package/lib/cjs/components/radio/Radio.form.d.ts +6 -3
- package/lib/cjs/components/radio/Radio.form.js +5 -0
- package/lib/cjs/components/radio/Radio.js +3 -4
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +5 -3
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +4 -0
- package/lib/cjs/components/select/Select.d.ts +16 -39
- package/lib/cjs/components/select/Select.form.d.ts +6 -3
- package/lib/cjs/components/select/Select.form.js +5 -0
- package/lib/cjs/components/select/Select.js +13 -16
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +2 -17
- package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
- package/lib/cjs/components/selectboxes/SelectBoxes.form.js +5 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -9
- package/lib/cjs/components/signature/Signature.d.ts +1 -14
- package/lib/cjs/components/signature/Signature.form.d.ts +6 -3
- package/lib/cjs/components/signature/Signature.form.js +5 -0
- package/lib/cjs/components/survey/Survey.d.ts +3 -15
- package/lib/cjs/components/survey/Survey.form.d.ts +6 -3
- package/lib/cjs/components/survey/Survey.form.js +5 -0
- package/lib/cjs/components/table/Table.d.ts +2 -1
- package/lib/cjs/components/table/Table.form.d.ts +6 -3
- package/lib/cjs/components/table/Table.form.js +5 -0
- package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/cjs/components/tabs/Tabs.form.d.ts +6 -3
- package/lib/cjs/components/tabs/Tabs.form.js +5 -0
- package/lib/cjs/components/tabs/Tabs.js +1 -2
- package/lib/cjs/components/tags/Tags.d.ts +0 -14
- package/lib/cjs/components/tags/Tags.form.d.ts +6 -3
- package/lib/cjs/components/tags/Tags.form.js +5 -0
- package/lib/cjs/components/textarea/TextArea.d.ts +4 -9
- package/lib/cjs/components/textarea/TextArea.form.d.ts +6 -3
- package/lib/cjs/components/textarea/TextArea.form.js +5 -0
- package/lib/cjs/components/textarea/TextArea.js +2 -2
- package/lib/cjs/components/textfield/TextField.d.ts +14 -30
- package/lib/cjs/components/textfield/TextField.form.d.ts +6 -3
- package/lib/cjs/components/textfield/TextField.form.js +5 -0
- package/lib/cjs/components/textfield/TextField.js +13 -16
- package/lib/cjs/components/time/Time.form.d.ts +6 -3
- package/lib/cjs/components/time/Time.form.js +5 -0
- package/lib/cjs/components/unknown/Unknown.form.d.ts +5 -34
- package/lib/cjs/components/unknown/Unknown.form.js +4 -0
- package/lib/cjs/components/url/Url.form.d.ts +6 -3
- package/lib/cjs/components/url/Url.form.js +5 -0
- package/lib/cjs/components/well/Well.form.d.ts +6 -3
- package/lib/cjs/components/well/Well.form.js +5 -0
- package/lib/cjs/formio.embed.d.ts +1 -2
- package/lib/cjs/formio.embed.js +2 -100
- package/lib/cjs/formio.form.d.ts +11 -4
- package/lib/cjs/formio.form.js +13 -5
- package/lib/cjs/providers/Providers.d.ts +36 -5
- package/lib/cjs/providers/Providers.js +29 -0
- package/lib/cjs/providers/address/AddressProvider.d.ts +131 -12
- package/lib/cjs/providers/address/AddressProvider.js +88 -2
- package/lib/cjs/providers/address/AzureAddressProvider.d.ts +48 -1
- package/lib/cjs/providers/address/AzureAddressProvider.js +37 -0
- package/lib/cjs/providers/address/CustomAddressProvider.d.ts +27 -4
- package/lib/cjs/providers/address/CustomAddressProvider.js +34 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +130 -6
- package/lib/cjs/providers/address/GoogleAddressProvider.js +72 -0
- package/lib/cjs/providers/address/NominatimAddressProvider.d.ts +32 -7
- package/lib/cjs/providers/address/NominatimAddressProvider.js +33 -0
- package/lib/cjs/providers/address/index.d.ts +3 -1
- package/lib/cjs/providers/processor/fileProcessor.d.ts +7 -1
- package/lib/cjs/providers/processor/fileProcessor.js +6 -0
- package/lib/cjs/providers/storage/azure.d.ts +6 -13
- package/lib/cjs/providers/storage/azure.js +5 -0
- package/lib/cjs/providers/storage/base64.d.ts +5 -6
- package/lib/cjs/providers/storage/base64.js +4 -0
- package/lib/cjs/providers/storage/dropbox.d.ts +6 -4
- package/lib/cjs/providers/storage/dropbox.js +5 -0
- package/lib/cjs/providers/storage/googleDrive.d.ts +7 -5
- package/lib/cjs/providers/storage/googleDrive.js +6 -0
- package/lib/cjs/providers/storage/indexeddb.d.ts +5 -7
- package/lib/cjs/providers/storage/indexeddb.js +4 -0
- package/lib/cjs/providers/storage/s3.d.ts +6 -20
- package/lib/cjs/providers/storage/s3.js +5 -0
- package/lib/cjs/providers/storage/url.d.ts +6 -7
- package/lib/cjs/providers/storage/url.js +10 -0
- package/lib/cjs/providers/storage/util.d.ts +24 -1
- package/lib/cjs/providers/storage/util.js +18 -0
- package/lib/cjs/templates/Templates.d.ts +1 -0
- package/lib/cjs/utils/Evaluator.d.ts +7 -3
- package/lib/cjs/utils/Evaluator.js +12 -18
- package/lib/cjs/utils/builder.d.ts +9 -7
- package/lib/cjs/utils/builder.js +10 -5
- package/lib/cjs/utils/calendarUtils.d.ts +7 -13
- package/lib/cjs/utils/calendarUtils.js +10 -17
- package/lib/cjs/utils/formUtils.d.ts +43 -171
- package/lib/cjs/utils/formUtils.js +38 -569
- package/lib/cjs/utils/utils.d.ts +361 -216
- package/lib/cjs/utils/utils.js +329 -169
- package/lib/cjs/widgets/CalendarWidget.d.ts +9 -10
- package/lib/cjs/widgets/CalendarWidget.js +9 -11
- package/lib/mjs/Element.d.ts +85 -96
- package/lib/mjs/Element.js +65 -76
- package/lib/mjs/Form.d.ts +365 -36
- package/lib/mjs/Form.js +140 -57
- package/lib/mjs/FormBuilder.d.ts +187 -2
- package/lib/mjs/FormBuilder.js +32 -8
- package/lib/mjs/InlineEmbed.d.ts +7 -0
- package/lib/mjs/InlineEmbed.js +105 -0
- package/lib/mjs/PDF.d.ts +11 -13
- package/lib/mjs/PDF.js +6 -8
- package/lib/mjs/Webform.d.ts +180 -139
- package/lib/mjs/Webform.js +325 -310
- package/lib/mjs/WebformBuilder.d.ts +16 -14
- package/lib/mjs/WebformBuilder.js +11 -10
- package/lib/mjs/Wizard.d.ts +31 -21
- package/lib/mjs/Wizard.js +41 -18
- package/lib/mjs/WizardBuilder.d.ts +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
- 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 +501 -266
- package/lib/mjs/components/_classes/component/Component.form.d.ts +6 -3
- package/lib/mjs/components/_classes/component/Component.form.js +5 -0
- package/lib/mjs/components/_classes/component/Component.js +433 -190
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +0 -8
- 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 +11 -2
- package/lib/mjs/components/_classes/field/Field.js +13 -1
- package/lib/mjs/components/_classes/input/Input.d.ts +4 -3
- 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 +6 -3
- package/lib/mjs/components/_classes/list/ListComponent.form.js +5 -0
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +43 -12
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +37 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +163 -67
- package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +5 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +175 -54
- 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 +7 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
- package/lib/mjs/components/address/Address.d.ts +4 -2
- package/lib/mjs/components/address/Address.form.d.ts +6 -3
- package/lib/mjs/components/address/Address.form.js +5 -0
- package/lib/mjs/components/button/Button.d.ts +3 -12
- package/lib/mjs/components/button/Button.form.d.ts +6 -3
- package/lib/mjs/components/button/Button.form.js +5 -0
- package/lib/mjs/components/button/Button.js +5 -0
- package/lib/mjs/components/checkbox/Checkbox.d.ts +4 -27
- package/lib/mjs/components/checkbox/Checkbox.form.d.ts +6 -3
- package/lib/mjs/components/checkbox/Checkbox.form.js +5 -0
- package/lib/mjs/components/columns/Columns.d.ts +3 -2
- package/lib/mjs/components/columns/Columns.form.d.ts +6 -3
- package/lib/mjs/components/columns/Columns.form.js +5 -0
- package/lib/mjs/components/columns/Columns.js +1 -1
- package/lib/mjs/components/container/Container.form.d.ts +6 -3
- package/lib/mjs/components/container/Container.form.js +5 -0
- package/lib/mjs/components/content/Content.d.ts +2 -1
- package/lib/mjs/components/content/Content.form.d.ts +6 -3
- package/lib/mjs/components/content/Content.form.js +5 -0
- package/lib/mjs/components/currency/Currency.form.d.ts +6 -3
- package/lib/mjs/components/currency/Currency.form.js +5 -0
- package/lib/mjs/components/currency/Currency.js +1 -2
- package/lib/mjs/components/datagrid/DataGrid.d.ts +8 -7
- package/lib/mjs/components/datagrid/DataGrid.form.d.ts +6 -3
- package/lib/mjs/components/datagrid/DataGrid.form.js +5 -0
- package/lib/mjs/components/datagrid/DataGrid.js +5 -5
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/mjs/components/datamap/DataMap.form.d.ts +6 -3
- package/lib/mjs/components/datamap/DataMap.form.js +5 -0
- package/lib/mjs/components/datetime/DateTime.d.ts +0 -14
- package/lib/mjs/components/datetime/DateTime.form.d.ts +6 -3
- package/lib/mjs/components/datetime/DateTime.form.js +5 -0
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +1 -1
- package/lib/mjs/components/day/Day.d.ts +22 -48
- package/lib/mjs/components/day/Day.form.d.ts +6 -3
- package/lib/mjs/components/day/Day.form.js +5 -0
- package/lib/mjs/components/day/Day.js +15 -20
- package/lib/mjs/components/editgrid/EditGrid.d.ts +7 -3
- package/lib/mjs/components/editgrid/EditGrid.form.d.ts +6 -3
- package/lib/mjs/components/editgrid/EditGrid.form.js +5 -0
- 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 +6 -3
- package/lib/mjs/components/email/Email.form.js +5 -0
- package/lib/mjs/components/fieldset/Fieldset.form.d.ts +6 -3
- package/lib/mjs/components/fieldset/Fieldset.form.js +5 -0
- package/lib/mjs/components/file/File.d.ts +9 -22
- package/lib/mjs/components/file/File.form.d.ts +6 -3
- package/lib/mjs/components/file/File.form.js +5 -0
- package/lib/mjs/components/form/Form.d.ts +31 -20
- package/lib/mjs/components/form/Form.form.d.ts +6 -3
- package/lib/mjs/components/form/Form.form.js +5 -0
- package/lib/mjs/components/form/Form.js +13 -10
- package/lib/mjs/components/hidden/Hidden.d.ts +1 -11
- package/lib/mjs/components/hidden/Hidden.form.d.ts +6 -3
- package/lib/mjs/components/hidden/Hidden.form.js +5 -0
- package/lib/mjs/components/hidden/Hidden.js +1 -2
- package/lib/mjs/components/html/HTML.d.ts +2 -1
- package/lib/mjs/components/html/HTML.form.d.ts +6 -3
- package/lib/mjs/components/html/HTML.form.js +5 -0
- package/lib/mjs/components/number/Number.d.ts +3 -17
- package/lib/mjs/components/number/Number.form.d.ts +6 -3
- package/lib/mjs/components/number/Number.form.js +5 -0
- package/lib/mjs/components/number/Number.js +1 -2
- package/lib/mjs/components/panel/Panel.form.d.ts +6 -3
- package/lib/mjs/components/panel/Panel.form.js +5 -0
- package/lib/mjs/components/panel/Panel.js +0 -1
- package/lib/mjs/components/password/Password.form.d.ts +6 -3
- package/lib/mjs/components/password/Password.form.js +5 -0
- package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +5 -0
- package/lib/mjs/components/radio/Radio.d.ts +3 -26
- package/lib/mjs/components/radio/Radio.form.d.ts +6 -3
- package/lib/mjs/components/radio/Radio.form.js +5 -0
- package/lib/mjs/components/radio/Radio.js +3 -4
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +5 -3
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +4 -0
- package/lib/mjs/components/select/Select.d.ts +16 -39
- package/lib/mjs/components/select/Select.form.d.ts +6 -3
- package/lib/mjs/components/select/Select.form.js +5 -0
- package/lib/mjs/components/select/Select.js +13 -16
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +2 -17
- package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
- package/lib/mjs/components/selectboxes/SelectBoxes.form.js +5 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -9
- package/lib/mjs/components/signature/Signature.d.ts +1 -14
- package/lib/mjs/components/signature/Signature.form.d.ts +6 -3
- package/lib/mjs/components/signature/Signature.form.js +5 -0
- package/lib/mjs/components/survey/Survey.d.ts +3 -15
- package/lib/mjs/components/survey/Survey.form.d.ts +6 -3
- package/lib/mjs/components/survey/Survey.form.js +5 -0
- package/lib/mjs/components/table/Table.d.ts +2 -1
- package/lib/mjs/components/table/Table.form.d.ts +6 -3
- package/lib/mjs/components/table/Table.form.js +5 -0
- package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/mjs/components/tabs/Tabs.form.d.ts +6 -3
- package/lib/mjs/components/tabs/Tabs.form.js +5 -0
- package/lib/mjs/components/tabs/Tabs.js +1 -2
- package/lib/mjs/components/tags/Tags.d.ts +0 -14
- package/lib/mjs/components/tags/Tags.form.d.ts +6 -3
- package/lib/mjs/components/tags/Tags.form.js +5 -0
- package/lib/mjs/components/textarea/TextArea.d.ts +4 -9
- package/lib/mjs/components/textarea/TextArea.form.d.ts +6 -3
- package/lib/mjs/components/textarea/TextArea.form.js +5 -0
- package/lib/mjs/components/textarea/TextArea.js +2 -2
- package/lib/mjs/components/textfield/TextField.d.ts +14 -30
- package/lib/mjs/components/textfield/TextField.form.d.ts +6 -3
- package/lib/mjs/components/textfield/TextField.form.js +5 -0
- package/lib/mjs/components/textfield/TextField.js +13 -16
- package/lib/mjs/components/time/Time.form.d.ts +6 -3
- package/lib/mjs/components/time/Time.form.js +5 -0
- package/lib/mjs/components/unknown/Unknown.form.d.ts +5 -34
- package/lib/mjs/components/unknown/Unknown.form.js +4 -0
- package/lib/mjs/components/url/Url.form.d.ts +6 -3
- package/lib/mjs/components/url/Url.form.js +5 -0
- package/lib/mjs/components/well/Well.form.d.ts +6 -3
- package/lib/mjs/components/well/Well.form.js +5 -0
- package/lib/mjs/formio.embed.d.ts +1 -2
- package/lib/mjs/formio.embed.js +2 -99
- package/lib/mjs/formio.form.d.ts +11 -4
- package/lib/mjs/formio.form.js +10 -3
- package/lib/mjs/providers/Providers.d.ts +36 -5
- package/lib/mjs/providers/Providers.js +29 -0
- package/lib/mjs/providers/address/AddressProvider.d.ts +131 -12
- package/lib/mjs/providers/address/AddressProvider.js +88 -2
- package/lib/mjs/providers/address/AzureAddressProvider.d.ts +48 -1
- package/lib/mjs/providers/address/AzureAddressProvider.js +37 -0
- package/lib/mjs/providers/address/CustomAddressProvider.d.ts +27 -4
- package/lib/mjs/providers/address/CustomAddressProvider.js +34 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +130 -6
- package/lib/mjs/providers/address/GoogleAddressProvider.js +72 -0
- package/lib/mjs/providers/address/NominatimAddressProvider.d.ts +32 -7
- package/lib/mjs/providers/address/NominatimAddressProvider.js +33 -0
- package/lib/mjs/providers/address/index.d.ts +3 -1
- package/lib/mjs/providers/processor/fileProcessor.d.ts +7 -1
- package/lib/mjs/providers/processor/fileProcessor.js +6 -0
- package/lib/mjs/providers/storage/azure.d.ts +6 -13
- package/lib/mjs/providers/storage/azure.js +5 -0
- package/lib/mjs/providers/storage/base64.d.ts +5 -6
- package/lib/mjs/providers/storage/base64.js +4 -0
- package/lib/mjs/providers/storage/dropbox.d.ts +6 -4
- package/lib/mjs/providers/storage/dropbox.js +5 -0
- package/lib/mjs/providers/storage/googleDrive.d.ts +7 -5
- package/lib/mjs/providers/storage/googleDrive.js +6 -0
- package/lib/mjs/providers/storage/indexeddb.d.ts +5 -7
- package/lib/mjs/providers/storage/indexeddb.js +4 -0
- package/lib/mjs/providers/storage/s3.d.ts +6 -20
- package/lib/mjs/providers/storage/s3.js +5 -0
- package/lib/mjs/providers/storage/url.d.ts +6 -7
- package/lib/mjs/providers/storage/url.js +10 -0
- package/lib/mjs/providers/storage/util.d.ts +24 -1
- package/lib/mjs/providers/storage/util.js +18 -0
- package/lib/mjs/templates/Templates.d.ts +1 -0
- package/lib/mjs/utils/Evaluator.d.ts +7 -3
- package/lib/mjs/utils/Evaluator.js +10 -18
- package/lib/mjs/utils/builder.d.ts +9 -7
- package/lib/mjs/utils/builder.js +10 -5
- package/lib/mjs/utils/calendarUtils.d.ts +7 -13
- package/lib/mjs/utils/calendarUtils.js +10 -17
- package/lib/mjs/utils/formUtils.d.ts +43 -171
- package/lib/mjs/utils/formUtils.js +6 -554
- package/lib/mjs/utils/utils.d.ts +361 -216
- package/lib/mjs/utils/utils.js +321 -161
- package/lib/mjs/widgets/CalendarWidget.d.ts +9 -10
- package/lib/mjs/widgets/CalendarWidget.js +9 -11
- package/package.json +22 -22
- package/sdk.d.ts +1 -0
- package/utils.d.ts +1 -0
|
@@ -193,9 +193,7 @@ class Component extends Element_1.default {
|
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* Return the simple condition settings as part of the component.
|
|
196
|
-
*
|
|
197
|
-
* @return {Object}
|
|
198
|
-
*
|
|
196
|
+
* @returns {object} - The simple conditional settings.
|
|
199
197
|
*/
|
|
200
198
|
static get conditionOperatorsSettings() {
|
|
201
199
|
return {
|
|
@@ -212,10 +210,8 @@ class Component extends Element_1.default {
|
|
|
212
210
|
}
|
|
213
211
|
/**
|
|
214
212
|
* Return the array of possible types of component value absed on its schema.
|
|
215
|
-
*
|
|
216
213
|
* @param schema
|
|
217
|
-
* @
|
|
218
|
-
*
|
|
214
|
+
* @returns {Array}
|
|
219
215
|
*/
|
|
220
216
|
static savedValueTypes(schema) {
|
|
221
217
|
schema = schema || {};
|
|
@@ -224,7 +220,6 @@ class Component extends Element_1.default {
|
|
|
224
220
|
/**
|
|
225
221
|
* Provides a table view for this component. Override if you wish to do something different than using getView
|
|
226
222
|
* method of your instance.
|
|
227
|
-
*
|
|
228
223
|
* @param value
|
|
229
224
|
* @param options
|
|
230
225
|
*/
|
|
@@ -233,10 +228,9 @@ class Component extends Element_1.default {
|
|
|
233
228
|
/* eslint-enable no-unused-vars */
|
|
234
229
|
/**
|
|
235
230
|
* Initialize a new Component.
|
|
236
|
-
*
|
|
237
|
-
* @param {
|
|
238
|
-
* @param {
|
|
239
|
-
* @param {Object} data - The global data submission object this component will belong.
|
|
231
|
+
* @param {object} component - The component JSON you wish to initialize.
|
|
232
|
+
* @param {object} options - The options for this component.
|
|
233
|
+
* @param {object} data - The global data submission object this component will belong.
|
|
240
234
|
*/
|
|
241
235
|
/* eslint-disable max-statements */
|
|
242
236
|
constructor(component, options, data) {
|
|
@@ -267,7 +261,6 @@ class Component extends Element_1.default {
|
|
|
267
261
|
}
|
|
268
262
|
/**
|
|
269
263
|
* The data path to this specific component instance.
|
|
270
|
-
*
|
|
271
264
|
* @type {string}
|
|
272
265
|
*/
|
|
273
266
|
this.path = (component === null || component === void 0 ? void 0 : component.key) || '';
|
|
@@ -315,32 +308,27 @@ class Component extends Element_1.default {
|
|
|
315
308
|
this.row = this.options.row;
|
|
316
309
|
/**
|
|
317
310
|
* Points to a flat map of child components (if applicable).
|
|
318
|
-
*
|
|
319
|
-
* @type {Object}
|
|
311
|
+
* @type {object}
|
|
320
312
|
*/
|
|
321
313
|
this.childComponentsMap = {};
|
|
322
314
|
/**
|
|
323
315
|
* Determines if this component is disabled, or not.
|
|
324
|
-
*
|
|
325
316
|
* @type {boolean}
|
|
326
317
|
*/
|
|
327
318
|
this._disabled = (0, utils_1.boolValue)(this.component.disabled) ? this.component.disabled : false;
|
|
328
319
|
/**
|
|
329
320
|
* Points to the root component, usually the FormComponent.
|
|
330
|
-
*
|
|
331
321
|
* @type {Component}
|
|
332
322
|
*/
|
|
333
323
|
this.root = this.options.root || this;
|
|
334
324
|
this.localRoot = this.options.localRoot || this;
|
|
335
325
|
/**
|
|
336
326
|
* If this input has been input and provided value.
|
|
337
|
-
*
|
|
338
327
|
* @type {boolean}
|
|
339
328
|
*/
|
|
340
329
|
this.pristine = true;
|
|
341
330
|
/**
|
|
342
331
|
* Points to the parent component.
|
|
343
|
-
*
|
|
344
332
|
* @type {Component}
|
|
345
333
|
*/
|
|
346
334
|
this.parent = this.options.parent;
|
|
@@ -360,7 +348,7 @@ class Component extends Element_1.default {
|
|
|
360
348
|
this._referenceAttributeName = 'ref';
|
|
361
349
|
/**
|
|
362
350
|
* Used to trigger a new change in this component.
|
|
363
|
-
* @type {
|
|
351
|
+
* @type {Function} - Call to trigger a change in this component.
|
|
364
352
|
*/
|
|
365
353
|
let changes = [];
|
|
366
354
|
let lastChanged = null;
|
|
@@ -401,7 +389,6 @@ class Component extends Element_1.default {
|
|
|
401
389
|
};
|
|
402
390
|
/**
|
|
403
391
|
* Used to trigger a redraw event within this component.
|
|
404
|
-
*
|
|
405
392
|
* @type {Function}
|
|
406
393
|
*/
|
|
407
394
|
this.triggerRedraw = lodash_1.default.debounce(this.redraw.bind(this), 100);
|
|
@@ -603,8 +590,8 @@ class Component extends Element_1.default {
|
|
|
603
590
|
return this.shouldForceVisibility(component, 'show');
|
|
604
591
|
}
|
|
605
592
|
/**
|
|
606
|
-
*
|
|
607
|
-
* @param
|
|
593
|
+
* Sets the component visibility.
|
|
594
|
+
* @param {boolean} value - Whether the component should be visible or not.
|
|
608
595
|
*/
|
|
609
596
|
set visible(value) {
|
|
610
597
|
if (this._visible !== value) {
|
|
@@ -622,8 +609,8 @@ class Component extends Element_1.default {
|
|
|
622
609
|
}
|
|
623
610
|
}
|
|
624
611
|
/**
|
|
625
|
-
*
|
|
626
|
-
* @returns {boolean}
|
|
612
|
+
* Returns the component visibility
|
|
613
|
+
* @returns {boolean} - Whether the component is visible or not.
|
|
627
614
|
*/
|
|
628
615
|
get visible() {
|
|
629
616
|
// Show only if visibility changes or if we are in builder mode or if hidden fields should be shown.
|
|
@@ -713,9 +700,10 @@ class Component extends Element_1.default {
|
|
|
713
700
|
}
|
|
714
701
|
/**
|
|
715
702
|
* Returns only the schema that is different from the default.
|
|
716
|
-
*
|
|
717
|
-
* @param schema
|
|
718
|
-
* @param
|
|
703
|
+
* @param {object} schema - The "full" json schema for the component.
|
|
704
|
+
* @param {object} defaultSchema - The "default" json schema for the component.
|
|
705
|
+
* @param {boolean} recursion - If we are currently in a recursive loop.
|
|
706
|
+
* @returns {object} - The minified json schema for this component.
|
|
719
707
|
*/
|
|
720
708
|
getModifiedSchema(schema, defaultSchema, recursion) {
|
|
721
709
|
const modified = {};
|
|
@@ -749,21 +737,24 @@ class Component extends Element_1.default {
|
|
|
749
737
|
}
|
|
750
738
|
/**
|
|
751
739
|
* Returns the JSON schema for this component.
|
|
740
|
+
* @returns {object} - The JSON schema for this component.
|
|
752
741
|
*/
|
|
753
742
|
get schema() {
|
|
754
743
|
return (0, utils_1.fastCloneDeep)(this.getModifiedSchema(lodash_1.default.omit(this.component, 'id'), this.defaultSchema));
|
|
755
744
|
}
|
|
756
745
|
/**
|
|
757
746
|
* Returns true if component is inside DataGrid
|
|
747
|
+
* @returns {boolean} - True if component is inside DataGrid
|
|
758
748
|
*/
|
|
759
749
|
get isInDataGrid() {
|
|
760
750
|
return this.inDataGrid;
|
|
761
751
|
}
|
|
762
752
|
/**
|
|
763
753
|
* Translate a text using the i18n system.
|
|
764
|
-
*
|
|
765
754
|
* @param {string} text - The i18n identifier.
|
|
766
|
-
* @param {
|
|
755
|
+
* @param {object} params - The i18n parameters to use for translation.
|
|
756
|
+
* @param {...any} args - Additional arguments to pass to the translation library.
|
|
757
|
+
* @returns {string} - The translated text.
|
|
767
758
|
*/
|
|
768
759
|
t(text, params = {}, ...args) {
|
|
769
760
|
if (!text) {
|
|
@@ -853,7 +844,7 @@ class Component extends Element_1.default {
|
|
|
853
844
|
isHtmlRenderMode() {
|
|
854
845
|
return this.options.renderMode === 'html';
|
|
855
846
|
}
|
|
856
|
-
renderTemplate(name, data = {}, modeOption) {
|
|
847
|
+
renderTemplate(name, data = {}, modeOption = '') {
|
|
857
848
|
// Need to make this fall back to form if renderMode is not found similar to how we search templates.
|
|
858
849
|
const mode = modeOption || this.options.renderMode || 'form';
|
|
859
850
|
data.component = this.component;
|
|
@@ -893,11 +884,12 @@ class Component extends Element_1.default {
|
|
|
893
884
|
}
|
|
894
885
|
/**
|
|
895
886
|
* Sanitize an html string.
|
|
896
|
-
*
|
|
897
|
-
* @param
|
|
898
|
-
* @
|
|
887
|
+
* @param {string} dirty - The dirty html string to sanitize.
|
|
888
|
+
* @param {boolean} forceSanitize - If we should force the sanitize to occur.
|
|
889
|
+
* @param {object} options - The options for the sanitize.
|
|
890
|
+
* @returns {*} - The sanitized html string.
|
|
899
891
|
*/
|
|
900
|
-
sanitize(dirty, forceSanitize, options) {
|
|
892
|
+
sanitize(dirty, forceSanitize = false, options = {}) {
|
|
901
893
|
var _a;
|
|
902
894
|
if (!this.shouldSanitizeValue && !forceSanitize) {
|
|
903
895
|
return dirty;
|
|
@@ -908,12 +900,9 @@ class Component extends Element_1.default {
|
|
|
908
900
|
}
|
|
909
901
|
/**
|
|
910
902
|
* Render a template string into html.
|
|
911
|
-
*
|
|
912
|
-
* @param template
|
|
913
|
-
* @
|
|
914
|
-
* @param actions
|
|
915
|
-
*
|
|
916
|
-
* @return {HTMLElement|String} - The created element or an empty string if template is not specified.
|
|
903
|
+
* @param {string} template - The template to render.
|
|
904
|
+
* @param {object} data - The data to provide to the template.
|
|
905
|
+
* @returns {HTMLElement | string} - The created element or an empty string if template is not specified.
|
|
917
906
|
*/
|
|
918
907
|
renderString(template, data) {
|
|
919
908
|
if (!template) {
|
|
@@ -922,9 +911,18 @@ class Component extends Element_1.default {
|
|
|
922
911
|
// Interpolate the template and populate
|
|
923
912
|
return this.interpolate(template, data);
|
|
924
913
|
}
|
|
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
|
+
*/
|
|
925
919
|
performInputMapping(input) {
|
|
926
920
|
return input;
|
|
927
921
|
}
|
|
922
|
+
/**
|
|
923
|
+
* Returns the component "widget" if one is available.
|
|
924
|
+
* @returns {Widget|null} - The widget instance. null if not available.
|
|
925
|
+
*/
|
|
928
926
|
get widget() {
|
|
929
927
|
var _a;
|
|
930
928
|
const settings = this.component.widget;
|
|
@@ -934,6 +932,10 @@ class Component extends Element_1.default {
|
|
|
934
932
|
const widget = settings && widgets_1.default[settings.type] ? new widgets_1.default[settings.type](settings, this.component, this) : null;
|
|
935
933
|
return widget;
|
|
936
934
|
}
|
|
935
|
+
/**
|
|
936
|
+
* Returns the native supported browser language.
|
|
937
|
+
* @returns {string|null} - The native browser language that is supported.
|
|
938
|
+
*/
|
|
937
939
|
getBrowserLanguage() {
|
|
938
940
|
const nav = window.navigator;
|
|
939
941
|
const browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'];
|
|
@@ -957,38 +959,46 @@ class Component extends Element_1.default {
|
|
|
957
959
|
return null;
|
|
958
960
|
}
|
|
959
961
|
/**
|
|
960
|
-
* Called before a next and previous page is triggered allowing the components
|
|
961
|
-
* to
|
|
962
|
-
*
|
|
963
|
-
* @return {*}
|
|
962
|
+
* Called before a next and previous page is triggered allowing the components to perform special functions.
|
|
963
|
+
* @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next/previous page navigation.
|
|
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
|
+
*/
|
|
968
972
|
beforeNext() {
|
|
969
973
|
return this.beforePage(true);
|
|
970
974
|
}
|
|
971
975
|
/**
|
|
972
|
-
* Called before a submission is triggered allowing the components
|
|
973
|
-
* to
|
|
974
|
-
*
|
|
975
|
-
* @return {*}
|
|
976
|
+
* Called before a submission is triggered allowing the components to perform special async functions.
|
|
977
|
+
* @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the submission.
|
|
976
978
|
*/
|
|
977
979
|
beforeSubmit() {
|
|
978
980
|
return Promise.resolve(true);
|
|
979
981
|
}
|
|
980
982
|
/**
|
|
981
983
|
* Return the submission timezone.
|
|
982
|
-
*
|
|
983
|
-
* @return {*}
|
|
984
|
+
* @returns {string} - The submission timezone.
|
|
984
985
|
*/
|
|
985
986
|
get submissionTimezone() {
|
|
986
987
|
this.options.submissionTimezone = this.options.submissionTimezone || lodash_1.default.get(this.root, 'options.submissionTimezone');
|
|
987
988
|
return this.options.submissionTimezone;
|
|
988
989
|
}
|
|
990
|
+
/**
|
|
991
|
+
* Return the current timezone.
|
|
992
|
+
* @returns {string} - The current timezone.
|
|
993
|
+
*/
|
|
989
994
|
get timezone() {
|
|
990
995
|
return this.getTimezone(this.component);
|
|
991
996
|
}
|
|
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
|
+
*/
|
|
992
1002
|
getTimezone(settings) {
|
|
993
1003
|
if (settings.timezone) {
|
|
994
1004
|
return settings.timezone;
|
|
@@ -1012,6 +1022,9 @@ class Component extends Element_1.default {
|
|
|
1012
1022
|
* @param {string} [referenceAttributeName] - The attribute name to use for the reference.
|
|
1013
1023
|
*/
|
|
1014
1024
|
loadRefs(element, refs, referenceAttributeName) {
|
|
1025
|
+
if (!element) {
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1015
1028
|
for (const ref in refs) {
|
|
1016
1029
|
const refType = refs[ref];
|
|
1017
1030
|
const isString = typeof refType === 'string';
|
|
@@ -1026,9 +1039,17 @@ class Component extends Element_1.default {
|
|
|
1026
1039
|
}
|
|
1027
1040
|
}
|
|
1028
1041
|
}
|
|
1029
|
-
|
|
1042
|
+
/**
|
|
1043
|
+
* Opens the modal element.
|
|
1044
|
+
* @param {string} template - The template to use for the modal dialog.
|
|
1045
|
+
*/
|
|
1046
|
+
setOpenModalElement(template = null) {
|
|
1030
1047
|
this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
|
|
1031
1048
|
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Returns the modal preview template.
|
|
1051
|
+
* @returns {string} - The modal preview template.
|
|
1052
|
+
*/
|
|
1032
1053
|
getModalPreviewTemplate() {
|
|
1033
1054
|
var _a;
|
|
1034
1055
|
const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
|
|
@@ -1042,6 +1063,11 @@ class Component extends Element_1.default {
|
|
|
1042
1063
|
labelInfo: modalLabel,
|
|
1043
1064
|
});
|
|
1044
1065
|
}
|
|
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
|
+
*/
|
|
1045
1071
|
build(element) {
|
|
1046
1072
|
element = element || this.element;
|
|
1047
1073
|
this.empty(element);
|
|
@@ -1051,6 +1077,12 @@ class Component extends Element_1.default {
|
|
|
1051
1077
|
get hasModalSaveButton() {
|
|
1052
1078
|
return true;
|
|
1053
1079
|
}
|
|
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
|
+
*/
|
|
1054
1086
|
render(children = `Unknown component: ${this.component.type}`, topLevel = false) {
|
|
1055
1087
|
const isVisible = this.visible;
|
|
1056
1088
|
this.rendered = true;
|
|
@@ -1074,6 +1106,11 @@ class Component extends Element_1.default {
|
|
|
1074
1106
|
}, topLevel);
|
|
1075
1107
|
}
|
|
1076
1108
|
}
|
|
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
|
+
*/
|
|
1077
1114
|
attachTooltips(toolTipsRefs) {
|
|
1078
1115
|
toolTipsRefs === null || toolTipsRefs === void 0 ? void 0 : toolTipsRefs.forEach((tooltip, index) => {
|
|
1079
1116
|
if (tooltip) {
|
|
@@ -1092,9 +1129,21 @@ class Component extends Element_1.default {
|
|
|
1092
1129
|
}
|
|
1093
1130
|
});
|
|
1094
1131
|
}
|
|
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
|
+
*/
|
|
1095
1139
|
createComponentModal(element, modalShouldBeOpened, currentValue) {
|
|
1096
1140
|
return new ComponentModal_1.default(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
|
|
1097
1141
|
}
|
|
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
|
+
*/
|
|
1098
1147
|
attach(element) {
|
|
1099
1148
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
1100
1149
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
@@ -1132,6 +1181,9 @@ class Component extends Element_1.default {
|
|
|
1132
1181
|
this.addons.forEach((addon) => addon.attach(element));
|
|
1133
1182
|
return Promise.resolve();
|
|
1134
1183
|
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Restors the "focus" on a component after a redraw event has occured.
|
|
1186
|
+
*/
|
|
1135
1187
|
restoreFocus() {
|
|
1136
1188
|
var _a, _b, _c;
|
|
1137
1189
|
const isFocused = ((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.focusedComponent) === null || _b === void 0 ? void 0 : _b.path) === this.path;
|
|
@@ -1141,6 +1193,12 @@ class Component extends Element_1.default {
|
|
|
1141
1193
|
this.restoreCaretPosition();
|
|
1142
1194
|
}
|
|
1143
1195
|
}
|
|
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
|
+
*/
|
|
1144
1202
|
addShortcut(element, shortcut) {
|
|
1145
1203
|
// Avoid infinite recursion.
|
|
1146
1204
|
if (!element || !this.root || (this.root === this)) {
|
|
@@ -1151,6 +1209,12 @@ class Component extends Element_1.default {
|
|
|
1151
1209
|
}
|
|
1152
1210
|
this.root.addShortcut(element, shortcut);
|
|
1153
1211
|
}
|
|
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
|
+
*/
|
|
1154
1218
|
removeShortcut(element, shortcut) {
|
|
1155
1219
|
// Avoid infinite recursion.
|
|
1156
1220
|
if (!element || (this.root === this)) {
|
|
@@ -1183,6 +1247,13 @@ class Component extends Element_1.default {
|
|
|
1183
1247
|
this.tooltip.destroy();
|
|
1184
1248
|
}
|
|
1185
1249
|
}
|
|
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
|
+
*/
|
|
1186
1257
|
checkRefresh(refreshData, changed, flags) {
|
|
1187
1258
|
const changePath = lodash_1.default.get(changed, 'instance.path', false);
|
|
1188
1259
|
// Don't let components change themselves.
|
|
@@ -1199,6 +1270,12 @@ class Component extends Element_1.default {
|
|
|
1199
1270
|
this.refresh(changed.value, changed, flags);
|
|
1200
1271
|
}
|
|
1201
1272
|
}
|
|
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
|
+
*/
|
|
1202
1279
|
checkRefreshOn(changes, flags = {}) {
|
|
1203
1280
|
changes = changes || [];
|
|
1204
1281
|
if (flags.noRefresh) {
|
|
@@ -1220,8 +1297,8 @@ class Component extends Element_1.default {
|
|
|
1220
1297
|
}
|
|
1221
1298
|
/**
|
|
1222
1299
|
* Refreshes the component with a new value.
|
|
1223
|
-
*
|
|
1224
|
-
* @
|
|
1300
|
+
* @param {any} value - The latest value of the component to check if it needs to be refreshed.
|
|
1301
|
+
* @returns {void}
|
|
1225
1302
|
*/
|
|
1226
1303
|
refresh(value) {
|
|
1227
1304
|
if (this.hasOwnProperty('refreshOnValue')) {
|
|
@@ -1244,8 +1321,8 @@ class Component extends Element_1.default {
|
|
|
1244
1321
|
* with the components data and returns true if they are in the same context.
|
|
1245
1322
|
*
|
|
1246
1323
|
* Different rows of the same EditGrid, for example, are in different contexts.
|
|
1247
|
-
*
|
|
1248
|
-
* @
|
|
1324
|
+
* @param {any} component - The component to check if it is in the same context as this component.
|
|
1325
|
+
* @returns {boolean} - TRUE if the component is in the same context as this component.
|
|
1249
1326
|
*/
|
|
1250
1327
|
inContext(component) {
|
|
1251
1328
|
if (component.data === this.data) {
|
|
@@ -1260,9 +1337,18 @@ class Component extends Element_1.default {
|
|
|
1260
1337
|
}
|
|
1261
1338
|
return false;
|
|
1262
1339
|
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Determines if we are in "view" only mode.
|
|
1342
|
+
* @returns {boolean} - TRUE if we are in "view" only mode.
|
|
1343
|
+
*/
|
|
1263
1344
|
get viewOnly() {
|
|
1264
1345
|
return this.options.readOnly && this.options.viewAsHtml;
|
|
1265
1346
|
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Sets the HTMLElement for this component.
|
|
1349
|
+
* @param {HTMLElement} element - The element that is attached to this component.
|
|
1350
|
+
* @returns {void}
|
|
1351
|
+
*/
|
|
1266
1352
|
setElement(element) {
|
|
1267
1353
|
if (this.element) {
|
|
1268
1354
|
delete this.element.component;
|
|
@@ -1270,6 +1356,10 @@ class Component extends Element_1.default {
|
|
|
1270
1356
|
}
|
|
1271
1357
|
this.element = element;
|
|
1272
1358
|
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Creates an element to hold the "view only" version of this component.
|
|
1361
|
+
* @returns {HTMLElement} - The element for this component.
|
|
1362
|
+
*/
|
|
1273
1363
|
createViewOnlyElement() {
|
|
1274
1364
|
this.setElement(this.ce('dl', {
|
|
1275
1365
|
id: this.id
|
|
@@ -1280,14 +1370,18 @@ class Component extends Element_1.default {
|
|
|
1280
1370
|
}
|
|
1281
1371
|
return this.element;
|
|
1282
1372
|
}
|
|
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
|
+
*/
|
|
1283
1377
|
get defaultViewOnlyValue() {
|
|
1284
1378
|
return '-';
|
|
1285
1379
|
}
|
|
1286
1380
|
/**
|
|
1287
1381
|
* Uses the widget to determine the output string.
|
|
1288
|
-
*
|
|
1289
|
-
* @param
|
|
1290
|
-
* @
|
|
1382
|
+
* @param {any} value - The current value of the component.
|
|
1383
|
+
* @param {any} options - The options for getValueAsString.
|
|
1384
|
+
* @returns {any|Array<any>} - The value as a string.
|
|
1291
1385
|
*/
|
|
1292
1386
|
getWidgetValueAsString(value, options) {
|
|
1293
1387
|
const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
|
|
@@ -1312,6 +1406,12 @@ class Component extends Element_1.default {
|
|
|
1312
1406
|
const widget = this.refs.input[0].widget;
|
|
1313
1407
|
return widget.getValueAsString(value, options);
|
|
1314
1408
|
}
|
|
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
|
+
*/
|
|
1315
1415
|
getValueAsString(value, options) {
|
|
1316
1416
|
if (!value) {
|
|
1317
1417
|
return '';
|
|
@@ -1329,20 +1429,32 @@ class Component extends Element_1.default {
|
|
|
1329
1429
|
const stringValue = value.toString();
|
|
1330
1430
|
return this.sanitize(stringValue);
|
|
1331
1431
|
}
|
|
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
|
+
*/
|
|
1332
1438
|
getView(value, options) {
|
|
1333
1439
|
if (this.component.protected) {
|
|
1334
1440
|
return '--- PROTECTED ---';
|
|
1335
1441
|
}
|
|
1336
1442
|
return this.getValueAsString(value, options);
|
|
1337
1443
|
}
|
|
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
|
+
*/
|
|
1338
1449
|
updateItems(...args) {
|
|
1339
1450
|
this.restoreValue();
|
|
1340
1451
|
this.onChange(...args);
|
|
1341
1452
|
}
|
|
1342
1453
|
/**
|
|
1343
|
-
*
|
|
1344
|
-
* @param {
|
|
1345
|
-
* @
|
|
1454
|
+
* Returns the value for a specific item in a List type component.
|
|
1455
|
+
* @param {any} data - The data for this component.
|
|
1456
|
+
* @param {boolean} [forceUseValue] - if true, return 'value' property of the data
|
|
1457
|
+
* @returns {any} - The value of the item.
|
|
1346
1458
|
*/
|
|
1347
1459
|
itemValue(data, forceUseValue = false) {
|
|
1348
1460
|
if (lodash_1.default.isObject(data) && !lodash_1.default.isArray(data)) {
|
|
@@ -1355,6 +1467,11 @@ class Component extends Element_1.default {
|
|
|
1355
1467
|
}
|
|
1356
1468
|
return data;
|
|
1357
1469
|
}
|
|
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
|
+
*/
|
|
1358
1475
|
itemValueForHTMLMode(value) {
|
|
1359
1476
|
if (Array.isArray(value)) {
|
|
1360
1477
|
const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
@@ -1362,6 +1479,13 @@ class Component extends Element_1.default {
|
|
|
1362
1479
|
}
|
|
1363
1480
|
return this.itemValue(value);
|
|
1364
1481
|
}
|
|
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
|
+
*/
|
|
1365
1489
|
createModal(element, attr, confirm) {
|
|
1366
1490
|
const dialog = this.ce('div', attr || {});
|
|
1367
1491
|
this.setContent(dialog, this.renderTemplate('dialog'));
|
|
@@ -1397,6 +1521,10 @@ class Component extends Element_1.default {
|
|
|
1397
1521
|
this.addEventListener(dialog.refs.dialogClose, 'click', handleCloseClick);
|
|
1398
1522
|
return dialog;
|
|
1399
1523
|
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Uses CSS classes to show or hide an element.
|
|
1526
|
+
* @returns {boolean} - TRUE if the element has been css removed.
|
|
1527
|
+
*/
|
|
1400
1528
|
get optimizeRedraw() {
|
|
1401
1529
|
if (this.options.optimizeRedraw && this.element && !this.visible) {
|
|
1402
1530
|
this.addClass(this.element, 'formio-removed');
|
|
@@ -1434,7 +1562,7 @@ class Component extends Element_1.default {
|
|
|
1434
1562
|
}
|
|
1435
1563
|
/**
|
|
1436
1564
|
* Build the custom style from the layout values
|
|
1437
|
-
* @
|
|
1565
|
+
* @returns {string} - The custom style
|
|
1438
1566
|
*/
|
|
1439
1567
|
get customStyle() {
|
|
1440
1568
|
let customCSS = '';
|
|
@@ -1445,24 +1573,31 @@ class Component extends Element_1.default {
|
|
|
1445
1573
|
});
|
|
1446
1574
|
return customCSS;
|
|
1447
1575
|
}
|
|
1576
|
+
/**
|
|
1577
|
+
* Returns the component condition operator settings if available.
|
|
1578
|
+
* @returns {object} - The component condition operator settings.
|
|
1579
|
+
*/
|
|
1448
1580
|
static get serverConditionSettings() {
|
|
1449
1581
|
return Component.conditionOperatorsSettings;
|
|
1450
1582
|
}
|
|
1583
|
+
/**
|
|
1584
|
+
* Returns if the application is on a mobile device.
|
|
1585
|
+
* @returns {boolean} - TRUE if the application is on a mobile device.
|
|
1586
|
+
*/
|
|
1451
1587
|
get isMobile() {
|
|
1452
1588
|
return (0, ismobilejs_1.default)();
|
|
1453
1589
|
}
|
|
1454
1590
|
/**
|
|
1455
1591
|
* Returns the outside wrapping element of this component.
|
|
1456
|
-
* @returns {HTMLElement}
|
|
1592
|
+
* @returns {HTMLElement} - The wrapping element of this component.
|
|
1457
1593
|
*/
|
|
1458
1594
|
getElement() {
|
|
1459
1595
|
return this.element;
|
|
1460
1596
|
}
|
|
1461
1597
|
/**
|
|
1462
1598
|
* Create an evaluation context for all script executions and interpolations.
|
|
1463
|
-
*
|
|
1464
|
-
* @
|
|
1465
|
-
* @return {*}
|
|
1599
|
+
* @param {any} additional - Additional context to provide.
|
|
1600
|
+
* @returns {any} - The evaluation context.
|
|
1466
1601
|
*/
|
|
1467
1602
|
evalContext(additional) {
|
|
1468
1603
|
return super.evalContext(Object.assign({
|
|
@@ -1484,18 +1619,29 @@ class Component extends Element_1.default {
|
|
|
1484
1619
|
}
|
|
1485
1620
|
/**
|
|
1486
1621
|
* Sets the pristine flag for this component.
|
|
1487
|
-
*
|
|
1488
|
-
* @param pristine {boolean} - TRUE to make pristine, FALSE not pristine.
|
|
1622
|
+
* @param {boolean} pristine - TRUE to make pristine, FALSE not pristine.
|
|
1489
1623
|
*/
|
|
1490
1624
|
setPristine(pristine) {
|
|
1491
1625
|
this.pristine = pristine;
|
|
1492
1626
|
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Returns if the component is pristine.
|
|
1629
|
+
* @returns {boolean} - TRUE if the component is pristine.
|
|
1630
|
+
*/
|
|
1493
1631
|
get isPristine() {
|
|
1494
1632
|
return this.pristine;
|
|
1495
1633
|
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Sets the dirty flag for this component.
|
|
1636
|
+
* @param {boolean} dirty - TRUE to make dirty, FALSE not dirty.
|
|
1637
|
+
*/
|
|
1496
1638
|
setDirty(dirty) {
|
|
1497
1639
|
this.dirty = dirty;
|
|
1498
1640
|
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Returns if the component is dirty.
|
|
1643
|
+
* @returns {boolean} - TRUE if the component is dirty.
|
|
1644
|
+
*/
|
|
1499
1645
|
get isDirty() {
|
|
1500
1646
|
return this.dirty;
|
|
1501
1647
|
}
|
|
@@ -1509,12 +1655,23 @@ class Component extends Element_1.default {
|
|
|
1509
1655
|
this.restoreValue();
|
|
1510
1656
|
this.triggerRootChange();
|
|
1511
1657
|
}
|
|
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
|
+
*/
|
|
1512
1664
|
iconClass(name, spinning) {
|
|
1513
1665
|
const iconset = this.options.iconset || Templates_1.default.current.defaultIconset || 'fa';
|
|
1514
1666
|
return Templates_1.default.current.hasOwnProperty('iconClass')
|
|
1515
1667
|
? Templates_1.default.current.iconClass(iconset, name, spinning)
|
|
1516
1668
|
: this.options.iconset === 'fa' ? Templates_1.default.defaultTemplates.iconClass(iconset, name, spinning) : name;
|
|
1517
1669
|
}
|
|
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
|
+
*/
|
|
1518
1675
|
size(size) {
|
|
1519
1676
|
return Templates_1.default.current.hasOwnProperty('size')
|
|
1520
1677
|
? Templates_1.default.current.size(size)
|
|
@@ -1527,15 +1684,23 @@ class Component extends Element_1.default {
|
|
|
1527
1684
|
get name() {
|
|
1528
1685
|
return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
|
|
1529
1686
|
}
|
|
1687
|
+
/**
|
|
1688
|
+
* Returns the visible errors for this component.
|
|
1689
|
+
* @returns {Array<object>} - The visible errors for this component.
|
|
1690
|
+
*/
|
|
1530
1691
|
get visibleErrors() {
|
|
1531
1692
|
return this._visibleErrors;
|
|
1532
1693
|
}
|
|
1694
|
+
/**
|
|
1695
|
+
* Returns all the errors for this component, visible or not.
|
|
1696
|
+
* @returns {Array<object>} - All the errors for this component.
|
|
1697
|
+
*/
|
|
1533
1698
|
get errors() {
|
|
1534
1699
|
return this._errors;
|
|
1535
1700
|
}
|
|
1536
1701
|
/**
|
|
1537
1702
|
* Returns the error label for this component.
|
|
1538
|
-
* @
|
|
1703
|
+
* @returns {string} - The error label for this component.
|
|
1539
1704
|
*/
|
|
1540
1705
|
get errorLabel() {
|
|
1541
1706
|
return this.t(this.component.errorLabel
|
|
@@ -1545,12 +1710,20 @@ class Component extends Element_1.default {
|
|
|
1545
1710
|
}
|
|
1546
1711
|
/**
|
|
1547
1712
|
* Get the error message provided a certain type of error.
|
|
1548
|
-
* @param type
|
|
1549
|
-
* @
|
|
1713
|
+
* @param {string} type - The type of error to fetch the message for.
|
|
1714
|
+
* @returns {string} - The error message configured for this component.
|
|
1550
1715
|
*/
|
|
1551
1716
|
errorMessage(type) {
|
|
1552
1717
|
return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
|
|
1553
1718
|
}
|
|
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
|
+
*/
|
|
1554
1727
|
setContent(element, content, forceSanitize, sanitizeOptions) {
|
|
1555
1728
|
if (element instanceof HTMLElement) {
|
|
1556
1729
|
element.innerHTML = this.sanitize(content, forceSanitize, sanitizeOptions);
|
|
@@ -1558,6 +1731,9 @@ class Component extends Element_1.default {
|
|
|
1558
1731
|
}
|
|
1559
1732
|
return false;
|
|
1560
1733
|
}
|
|
1734
|
+
/**
|
|
1735
|
+
* Restores the caret position in the input element after a refresh occurs.
|
|
1736
|
+
*/
|
|
1561
1737
|
restoreCaretPosition() {
|
|
1562
1738
|
var _a, _b, _c;
|
|
1563
1739
|
if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.currentSelection) {
|
|
@@ -1580,6 +1756,10 @@ class Component extends Element_1.default {
|
|
|
1580
1756
|
}
|
|
1581
1757
|
}
|
|
1582
1758
|
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Redraw the component.
|
|
1761
|
+
* @returns {Promise<void>} - A promise that resolves when the component is done redrawing.
|
|
1762
|
+
*/
|
|
1583
1763
|
redraw() {
|
|
1584
1764
|
// Don't bother if we have not built yet.
|
|
1585
1765
|
if (!this.element || !this.element.parentNode || this.optimizeRedraw) {
|
|
@@ -1595,29 +1775,54 @@ class Component extends Element_1.default {
|
|
|
1595
1775
|
this.setElement(parent.children[index]);
|
|
1596
1776
|
return this.attach(this.element);
|
|
1597
1777
|
}
|
|
1778
|
+
/**
|
|
1779
|
+
* Rebuild and redraw a component.
|
|
1780
|
+
* @returns {Promise<void>} - A promise that resolves when the component is done rebuilding and redrawing.
|
|
1781
|
+
*/
|
|
1598
1782
|
rebuild() {
|
|
1599
1783
|
this.destroy();
|
|
1600
1784
|
this.init();
|
|
1601
1785
|
this.visible = this.conditionallyVisible(null, null);
|
|
1602
1786
|
return this.redraw();
|
|
1603
1787
|
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Removes all event listeners attached to this component.
|
|
1790
|
+
*/
|
|
1604
1791
|
removeEventListeners() {
|
|
1605
1792
|
super.removeEventListeners();
|
|
1606
1793
|
this.tooltips.forEach(tooltip => tooltip.destroy());
|
|
1607
1794
|
this.tooltips = [];
|
|
1608
1795
|
}
|
|
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
|
+
*/
|
|
1609
1802
|
hasClass(element, className) {
|
|
1610
1803
|
if (!element) {
|
|
1611
1804
|
return;
|
|
1612
1805
|
}
|
|
1613
1806
|
return super.hasClass(element, this.transform('class', className));
|
|
1614
1807
|
}
|
|
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
|
+
*/
|
|
1615
1814
|
addClass(element, className) {
|
|
1616
1815
|
if (!element) {
|
|
1617
1816
|
return;
|
|
1618
1817
|
}
|
|
1619
1818
|
return super.addClass(element, this.transform('class', className));
|
|
1620
1819
|
}
|
|
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
|
+
*/
|
|
1621
1826
|
removeClass(element, className) {
|
|
1622
1827
|
if (!element) {
|
|
1623
1828
|
return;
|
|
@@ -1626,8 +1831,7 @@ class Component extends Element_1.default {
|
|
|
1626
1831
|
}
|
|
1627
1832
|
/**
|
|
1628
1833
|
* Determines if this component has a condition defined.
|
|
1629
|
-
*
|
|
1630
|
-
* @return {null}
|
|
1834
|
+
* @returns {boolean} - TRUE if the component has a condition defined.
|
|
1631
1835
|
*/
|
|
1632
1836
|
hasCondition() {
|
|
1633
1837
|
if (this._hasCondition !== null) {
|
|
@@ -1638,9 +1842,9 @@ class Component extends Element_1.default {
|
|
|
1638
1842
|
}
|
|
1639
1843
|
/**
|
|
1640
1844
|
* Check if this component is conditionally visible.
|
|
1641
|
-
*
|
|
1642
|
-
* @param data
|
|
1643
|
-
* @
|
|
1845
|
+
* @param {any} data - The data to check against.
|
|
1846
|
+
* @param {any} row - The row data to check against.
|
|
1847
|
+
* @returns {boolean} - TRUE if the component is conditionally visible.
|
|
1644
1848
|
*/
|
|
1645
1849
|
conditionallyVisible(data, row) {
|
|
1646
1850
|
data = data || this.rootValue;
|
|
@@ -1655,16 +1859,19 @@ class Component extends Element_1.default {
|
|
|
1655
1859
|
* Checks the condition of this component.
|
|
1656
1860
|
*
|
|
1657
1861
|
* TODO: Switch row and data parameters to be consistent with other methods.
|
|
1658
|
-
*
|
|
1659
|
-
* @param
|
|
1660
|
-
* @
|
|
1661
|
-
* @return {boolean} - True if the condition applies to this component.
|
|
1862
|
+
* @param {any} row - The row contextual data.
|
|
1863
|
+
* @param {any} data - The global data object.
|
|
1864
|
+
* @returns {boolean} - True if the condition applies to this component.
|
|
1662
1865
|
*/
|
|
1663
1866
|
checkCondition(row, data) {
|
|
1664
1867
|
return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
|
|
1665
1868
|
}
|
|
1666
1869
|
/**
|
|
1667
1870
|
* 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.
|
|
1668
1875
|
*/
|
|
1669
1876
|
checkComponentConditions(data, flags, row) {
|
|
1670
1877
|
data = data || this.rootValue;
|
|
@@ -1682,8 +1889,10 @@ class Component extends Element_1.default {
|
|
|
1682
1889
|
}
|
|
1683
1890
|
/**
|
|
1684
1891
|
* Checks conditions for this component and any sub components.
|
|
1685
|
-
* @param
|
|
1686
|
-
* @
|
|
1892
|
+
* @param {any} data - The data to check against.
|
|
1893
|
+
* @param {any} flags - The flags passed to checkData function.
|
|
1894
|
+
* @param {any} row - The row data to check against.
|
|
1895
|
+
* @returns {boolean} - TRUE if the component is visible.
|
|
1687
1896
|
*/
|
|
1688
1897
|
checkConditions(data, flags, row) {
|
|
1689
1898
|
data = data || this.rootValue;
|
|
@@ -1691,17 +1900,20 @@ class Component extends Element_1.default {
|
|
|
1691
1900
|
row = row || this.data;
|
|
1692
1901
|
return this.checkComponentConditions(data, flags, row);
|
|
1693
1902
|
}
|
|
1903
|
+
/**
|
|
1904
|
+
* Returns the component logic if applicable.
|
|
1905
|
+
* @returns {Array<object>} - The component logic.
|
|
1906
|
+
*/
|
|
1694
1907
|
get logic() {
|
|
1695
1908
|
return this.component.logic || [];
|
|
1696
1909
|
}
|
|
1697
1910
|
/**
|
|
1698
1911
|
* Check all triggers and apply necessary actions.
|
|
1699
|
-
*
|
|
1700
|
-
* @param data
|
|
1912
|
+
* @param {any} data - The data to check against.
|
|
1913
|
+
* @param {any} row - The row data to check against.
|
|
1914
|
+
* @returns {boolean|void} - TRUE if the component was altered.
|
|
1701
1915
|
*/
|
|
1702
|
-
fieldLogic(data, row) {
|
|
1703
|
-
data = data || this.rootValue;
|
|
1704
|
-
row = row || this.data;
|
|
1916
|
+
fieldLogic(data = this.rootValue, row = this.data) {
|
|
1705
1917
|
const logics = this.logic;
|
|
1706
1918
|
// If there aren't logic, don't go further.
|
|
1707
1919
|
if (logics.length === 0) {
|
|
@@ -1724,6 +1936,10 @@ class Component extends Element_1.default {
|
|
|
1724
1936
|
}
|
|
1725
1937
|
return changed;
|
|
1726
1938
|
}
|
|
1939
|
+
/**
|
|
1940
|
+
* Retuns if the browser is Internet Explorer.
|
|
1941
|
+
* @returns {boolean} - TRUE if the browser is IE.
|
|
1942
|
+
*/
|
|
1727
1943
|
isIE() {
|
|
1728
1944
|
if (typeof window === 'undefined') {
|
|
1729
1945
|
return false;
|
|
@@ -1748,9 +1964,24 @@ class Component extends Element_1.default {
|
|
|
1748
1964
|
// other browser
|
|
1749
1965
|
return false;
|
|
1750
1966
|
}
|
|
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
|
+
*/
|
|
1751
1973
|
defineActionValue(action, argsObject) {
|
|
1752
1974
|
return this.evaluate(action.value, argsObject, 'value');
|
|
1753
1975
|
}
|
|
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
|
+
*/
|
|
1754
1985
|
applyActions(newComponent, actions, result, row, data) {
|
|
1755
1986
|
data = data || this.rootValue;
|
|
1756
1987
|
row = row || this.data;
|
|
@@ -1830,9 +2061,8 @@ class Component extends Element_1.default {
|
|
|
1830
2061
|
}
|
|
1831
2062
|
/**
|
|
1832
2063
|
* Add a new input error to this element.
|
|
1833
|
-
*
|
|
1834
|
-
* @
|
|
1835
|
-
* @param dirty
|
|
2064
|
+
* @param {Array<object>|string} messages - An array of messages to add to the element.
|
|
2065
|
+
* @returns {void}
|
|
1836
2066
|
*/
|
|
1837
2067
|
addMessages(messages) {
|
|
1838
2068
|
if (!messages) {
|
|
@@ -1858,6 +2088,15 @@ class Component extends Element_1.default {
|
|
|
1858
2088
|
}).join(''));
|
|
1859
2089
|
}
|
|
1860
2090
|
}
|
|
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
|
+
*/
|
|
1861
2100
|
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
1862
2101
|
this.clearErrorClasses();
|
|
1863
2102
|
elements.forEach((element) => {
|
|
@@ -1884,6 +2123,12 @@ class Component extends Element_1.default {
|
|
|
1884
2123
|
this.addClass(element, 'has-message');
|
|
1885
2124
|
}
|
|
1886
2125
|
}
|
|
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
|
+
*/
|
|
1887
2132
|
setElementInvalid(element, invalid) {
|
|
1888
2133
|
if (!element)
|
|
1889
2134
|
return;
|
|
@@ -1895,6 +2140,9 @@ class Component extends Element_1.default {
|
|
|
1895
2140
|
}
|
|
1896
2141
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
|
1897
2142
|
}
|
|
2143
|
+
/**
|
|
2144
|
+
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
|
2145
|
+
*/
|
|
1898
2146
|
clearOnHide() {
|
|
1899
2147
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
1900
2148
|
if (
|
|
@@ -1914,6 +2162,10 @@ class Component extends Element_1.default {
|
|
|
1914
2162
|
}
|
|
1915
2163
|
}
|
|
1916
2164
|
}
|
|
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
|
+
*/
|
|
1917
2169
|
triggerRootChange(...args) {
|
|
1918
2170
|
if (this.options.onChange) {
|
|
1919
2171
|
this.options.onChange(...args);
|
|
@@ -1922,6 +2174,13 @@ class Component extends Element_1.default {
|
|
|
1922
2174
|
this.root.triggerChange(...args);
|
|
1923
2175
|
}
|
|
1924
2176
|
}
|
|
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
|
+
*/
|
|
1925
2184
|
onChange(flags, fromRoot) {
|
|
1926
2185
|
flags = flags || {};
|
|
1927
2186
|
if (flags.modified) {
|
|
@@ -2051,7 +2310,7 @@ class Component extends Element_1.default {
|
|
|
2051
2310
|
return Promise.reject();
|
|
2052
2311
|
}
|
|
2053
2312
|
this.quill = new Quill(element, isIEBrowser ? Object.assign(Object.assign({}, settings), { modules: {} }) : settings);
|
|
2054
|
-
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ
|
|
2313
|
+
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ */
|
|
2055
2314
|
const txtArea = document.createElement('textarea');
|
|
2056
2315
|
txtArea.setAttribute('class', 'quill-source-code');
|
|
2057
2316
|
this.quill.addContainer('ql-custom').appendChild(txtArea);
|
|
@@ -2065,7 +2324,7 @@ class Component extends Element_1.default {
|
|
|
2065
2324
|
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2066
2325
|
});
|
|
2067
2326
|
}
|
|
2068
|
-
/** END CODEBLOCK
|
|
2327
|
+
/** END CODEBLOCK */
|
|
2069
2328
|
// Make sure to select cursor when they click on the element.
|
|
2070
2329
|
this.addEventListener(element, 'click', () => this.quill.focus());
|
|
2071
2330
|
// Allows users to skip toolbar items when tabbing though form
|
|
@@ -2113,23 +2372,22 @@ class Component extends Element_1.default {
|
|
|
2113
2372
|
}
|
|
2114
2373
|
/**
|
|
2115
2374
|
* The empty value for this component.
|
|
2116
|
-
*
|
|
2117
|
-
* @return {null}
|
|
2375
|
+
* @returns {null} - The empty value for this component.
|
|
2118
2376
|
*/
|
|
2119
2377
|
get emptyValue() {
|
|
2120
2378
|
return null;
|
|
2121
2379
|
}
|
|
2122
2380
|
/**
|
|
2123
2381
|
* Returns if this component has a value set.
|
|
2124
|
-
*
|
|
2382
|
+
* @param {any} data - The global data object.
|
|
2383
|
+
* @returns {boolean} - TRUE if a value is set.
|
|
2125
2384
|
*/
|
|
2126
2385
|
hasValue(data) {
|
|
2127
2386
|
return !lodash_1.default.isUndefined(lodash_1.default.get(data || this.data, this.key));
|
|
2128
2387
|
}
|
|
2129
2388
|
/**
|
|
2130
2389
|
* Get the data value at the root level.
|
|
2131
|
-
*
|
|
2132
|
-
* @return {*}
|
|
2390
|
+
* @returns {*} - The root value for the component, typically the Webform data object.
|
|
2133
2391
|
*/
|
|
2134
2392
|
get rootValue() {
|
|
2135
2393
|
return this.root ? this.root.data : this.data;
|
|
@@ -2139,7 +2397,7 @@ class Component extends Element_1.default {
|
|
|
2139
2397
|
}
|
|
2140
2398
|
/**
|
|
2141
2399
|
* Get the static value of this component.
|
|
2142
|
-
* @
|
|
2400
|
+
* @returns {*} - The value for this component.
|
|
2143
2401
|
*/
|
|
2144
2402
|
get dataValue() {
|
|
2145
2403
|
if (!this.key ||
|
|
@@ -2157,8 +2415,7 @@ class Component extends Element_1.default {
|
|
|
2157
2415
|
}
|
|
2158
2416
|
/**
|
|
2159
2417
|
* Sets the static value of this component.
|
|
2160
|
-
*
|
|
2161
|
-
* @param value
|
|
2418
|
+
* @param {*} value - The value to set for this component.
|
|
2162
2419
|
*/
|
|
2163
2420
|
set dataValue(value) {
|
|
2164
2421
|
if (!this.allowData ||
|
|
@@ -2178,8 +2435,8 @@ class Component extends Element_1.default {
|
|
|
2178
2435
|
}
|
|
2179
2436
|
/**
|
|
2180
2437
|
* Splice a value from the dataValue.
|
|
2181
|
-
*
|
|
2182
|
-
* @param
|
|
2438
|
+
* @param {number} index - The index to splice for an array component values.
|
|
2439
|
+
* @param {*} flags - The flags to use when splicing the value.
|
|
2183
2440
|
*/
|
|
2184
2441
|
splice(index, flags = {}) {
|
|
2185
2442
|
if (this.hasValue()) {
|
|
@@ -2247,8 +2504,7 @@ class Component extends Element_1.default {
|
|
|
2247
2504
|
}
|
|
2248
2505
|
/**
|
|
2249
2506
|
* Get the input value of this component.
|
|
2250
|
-
*
|
|
2251
|
-
* @return {*}
|
|
2507
|
+
* @returns {*} - The value for the component.
|
|
2252
2508
|
*/
|
|
2253
2509
|
getValue() {
|
|
2254
2510
|
if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
@@ -2270,9 +2526,8 @@ class Component extends Element_1.default {
|
|
|
2270
2526
|
}
|
|
2271
2527
|
/**
|
|
2272
2528
|
* Get the value at a specific index.
|
|
2273
|
-
*
|
|
2274
|
-
* @
|
|
2275
|
-
* @returns {*}
|
|
2529
|
+
* @param {number} index - For an array component or multiple values, this returns the value at a specific index.
|
|
2530
|
+
* @returns {*} - The value at the specified index.
|
|
2276
2531
|
*/
|
|
2277
2532
|
getValueAt(index) {
|
|
2278
2533
|
const input = this.performInputMapping(this.refs.input[index]);
|
|
@@ -2280,11 +2535,9 @@ class Component extends Element_1.default {
|
|
|
2280
2535
|
}
|
|
2281
2536
|
/**
|
|
2282
2537
|
* Set the value of this component.
|
|
2283
|
-
*
|
|
2284
|
-
* @param value
|
|
2285
|
-
* @
|
|
2286
|
-
*
|
|
2287
|
-
* @return {boolean} - If the value changed.
|
|
2538
|
+
* @param {*} value - The value to set for this component.
|
|
2539
|
+
* @param {*} flags - The flags to use when setting the value.
|
|
2540
|
+
* @returns {boolean} - If the value changed.
|
|
2288
2541
|
*/
|
|
2289
2542
|
setValue(value, flags = {}) {
|
|
2290
2543
|
const changed = this.updateValue(value, flags);
|
|
@@ -2315,9 +2568,9 @@ class Component extends Element_1.default {
|
|
|
2315
2568
|
}
|
|
2316
2569
|
/**
|
|
2317
2570
|
* Set the value at a specific index.
|
|
2318
|
-
*
|
|
2319
|
-
* @param index
|
|
2320
|
-
* @param value
|
|
2571
|
+
* @param {number} index - The index to set the value at.
|
|
2572
|
+
* @param {*} value - The value to set at the specified index.
|
|
2573
|
+
* @param {*} flags - The flags to use when setting the value.
|
|
2321
2574
|
*/
|
|
2322
2575
|
setValueAt(index, value, flags = {}) {
|
|
2323
2576
|
if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
|
|
@@ -2364,9 +2617,8 @@ class Component extends Element_1.default {
|
|
|
2364
2617
|
}
|
|
2365
2618
|
/**
|
|
2366
2619
|
* Normalize values coming into updateValue.
|
|
2367
|
-
*
|
|
2368
|
-
* @
|
|
2369
|
-
* @return {*}
|
|
2620
|
+
* @param {*} value - The value to normalize before setting.
|
|
2621
|
+
* @returns {*} - The normalized value.
|
|
2370
2622
|
*/
|
|
2371
2623
|
normalizeValue(value) {
|
|
2372
2624
|
if (this.component.multiple && !Array.isArray(value)) {
|
|
@@ -2376,8 +2628,9 @@ class Component extends Element_1.default {
|
|
|
2376
2628
|
}
|
|
2377
2629
|
/**
|
|
2378
2630
|
* Update a value of this component.
|
|
2379
|
-
*
|
|
2380
|
-
* @param flags
|
|
2631
|
+
* @param {*} value - The value to update.
|
|
2632
|
+
* @param {*} flags - The flags to use when updating the value.
|
|
2633
|
+
* @returns {boolean} - If the value changed.
|
|
2381
2634
|
*/
|
|
2382
2635
|
updateComponentValue(value, flags = {}) {
|
|
2383
2636
|
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
@@ -2396,9 +2649,8 @@ class Component extends Element_1.default {
|
|
|
2396
2649
|
}
|
|
2397
2650
|
/**
|
|
2398
2651
|
* Updates the value of this component plus all sub-components.
|
|
2399
|
-
*
|
|
2400
|
-
* @
|
|
2401
|
-
* @return {boolean}
|
|
2652
|
+
* @param {...any} args - The arguments to pass to updateValue.
|
|
2653
|
+
* @returns {boolean} - If the value changed.
|
|
2402
2654
|
*/
|
|
2403
2655
|
updateValue(...args) {
|
|
2404
2656
|
return this.updateComponentValue(...args);
|
|
@@ -2424,10 +2676,9 @@ class Component extends Element_1.default {
|
|
|
2424
2676
|
}
|
|
2425
2677
|
/**
|
|
2426
2678
|
* Determine if the value of this component has changed.
|
|
2427
|
-
*
|
|
2428
|
-
* @param
|
|
2429
|
-
* @
|
|
2430
|
-
* @return {boolean}
|
|
2679
|
+
* @param {*} newValue - The new value to check.
|
|
2680
|
+
* @param {*} oldValue - The existing value of the component.
|
|
2681
|
+
* @returns {boolean} - TRUE if the value has changed.
|
|
2431
2682
|
*/
|
|
2432
2683
|
hasChanged(newValue, oldValue) {
|
|
2433
2684
|
if (((newValue === undefined) || (newValue === null)) &&
|
|
@@ -2445,8 +2696,9 @@ class Component extends Element_1.default {
|
|
|
2445
2696
|
}
|
|
2446
2697
|
/**
|
|
2447
2698
|
* Update the value on change.
|
|
2448
|
-
*
|
|
2449
|
-
* @param
|
|
2699
|
+
* @param {*} flags - The flags to use when triggering the on change event.
|
|
2700
|
+
* @param {boolean} changed - If the value has changed.
|
|
2701
|
+
* @returns {boolean} - If the value changed.
|
|
2450
2702
|
*/
|
|
2451
2703
|
updateOnChange(flags = {}, changed = false) {
|
|
2452
2704
|
if (!flags.noUpdateEvent && changed) {
|
|
@@ -2459,13 +2711,6 @@ class Component extends Element_1.default {
|
|
|
2459
2711
|
}
|
|
2460
2712
|
return false;
|
|
2461
2713
|
}
|
|
2462
|
-
/**
|
|
2463
|
-
* Perform a calculated value operation.
|
|
2464
|
-
*
|
|
2465
|
-
* @param data - The global data object.
|
|
2466
|
-
*
|
|
2467
|
-
* @return {boolean} - If the value changed during calculation.
|
|
2468
|
-
*/
|
|
2469
2714
|
convertNumberOrBoolToString(value) {
|
|
2470
2715
|
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
2471
2716
|
return value.toString();
|
|
@@ -2574,9 +2819,10 @@ class Component extends Element_1.default {
|
|
|
2574
2819
|
/* eslint-enable max-statements */
|
|
2575
2820
|
/**
|
|
2576
2821
|
* Performs calculations in this component plus any child components.
|
|
2577
|
-
*
|
|
2578
|
-
* @param
|
|
2579
|
-
* @
|
|
2822
|
+
* @param {*} data - The data to perform the calculation with.
|
|
2823
|
+
* @param {*} flags - The flags to use when calculating the value.
|
|
2824
|
+
* @param {*} row - The contextual row data to use when performing the calculation.
|
|
2825
|
+
* @returns {boolean} - TRUE if the value changed.
|
|
2580
2826
|
*/
|
|
2581
2827
|
calculateValue(data, flags, row) {
|
|
2582
2828
|
data = data || this.rootValue;
|
|
@@ -2586,15 +2832,14 @@ class Component extends Element_1.default {
|
|
|
2586
2832
|
}
|
|
2587
2833
|
/**
|
|
2588
2834
|
* Get this component's label text.
|
|
2589
|
-
*
|
|
2835
|
+
* @returns {string} - The label text for this component.
|
|
2590
2836
|
*/
|
|
2591
2837
|
get label() {
|
|
2592
2838
|
return this.component.label;
|
|
2593
2839
|
}
|
|
2594
2840
|
/**
|
|
2595
2841
|
* Set this component's label text and render it.
|
|
2596
|
-
*
|
|
2597
|
-
* @param value - The new label text.
|
|
2842
|
+
* @param {string} value - The new label text.
|
|
2598
2843
|
*/
|
|
2599
2844
|
set label(value) {
|
|
2600
2845
|
this.component.label = value;
|
|
@@ -2604,17 +2849,18 @@ class Component extends Element_1.default {
|
|
|
2604
2849
|
}
|
|
2605
2850
|
/**
|
|
2606
2851
|
* Get FormioForm element at the root of this component tree.
|
|
2607
|
-
*
|
|
2852
|
+
* @returns {*} root - The root component to search from.
|
|
2608
2853
|
*/
|
|
2609
2854
|
getRoot() {
|
|
2610
2855
|
return this.root;
|
|
2611
2856
|
}
|
|
2612
2857
|
/**
|
|
2613
2858
|
* Returns the invalid message, or empty string if the component is valid.
|
|
2614
|
-
*
|
|
2615
|
-
* @param
|
|
2616
|
-
* @param
|
|
2617
|
-
* @
|
|
2859
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2860
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2861
|
+
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
|
2862
|
+
* @param {*} row - Contextual row data for this component.
|
|
2863
|
+
* @returns {string} - The message to show when the component is invalid.
|
|
2618
2864
|
*/
|
|
2619
2865
|
invalidMessage(data, dirty, ignoreCondition, row) {
|
|
2620
2866
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
|
@@ -2646,10 +2892,9 @@ class Component extends Element_1.default {
|
|
|
2646
2892
|
}
|
|
2647
2893
|
/**
|
|
2648
2894
|
* Returns if the component is valid or not.
|
|
2649
|
-
*
|
|
2650
|
-
* @param
|
|
2651
|
-
* @
|
|
2652
|
-
* @return {boolean}
|
|
2895
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2896
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2897
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2653
2898
|
*/
|
|
2654
2899
|
isValid(data, dirty) {
|
|
2655
2900
|
return !this.invalidMessage(data, dirty);
|
|
@@ -2668,8 +2913,8 @@ class Component extends Element_1.default {
|
|
|
2668
2913
|
}
|
|
2669
2914
|
/**
|
|
2670
2915
|
* Interpolate errors from the validation methods.
|
|
2671
|
-
* @param {
|
|
2672
|
-
* @returns
|
|
2916
|
+
* @param {Array<any>} errors - An array of errors to interpolate.
|
|
2917
|
+
* @returns {Array<any>} - The interpolated errors.
|
|
2673
2918
|
*/
|
|
2674
2919
|
interpolateErrors(errors) {
|
|
2675
2920
|
var _a;
|
|
@@ -2682,7 +2927,7 @@ class Component extends Element_1.default {
|
|
|
2682
2927
|
* @param {*} data - The root submission data.
|
|
2683
2928
|
* @param {*} row - The contextual row data.
|
|
2684
2929
|
* @param {*} flags - The flags to perform validation.
|
|
2685
|
-
* @returns
|
|
2930
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2686
2931
|
*/
|
|
2687
2932
|
showValidationErrors(errors, data, row, flags) {
|
|
2688
2933
|
if (flags.silentCheck) {
|
|
@@ -2702,9 +2947,9 @@ class Component extends Element_1.default {
|
|
|
2702
2947
|
* @param {*} data - The root data you wish to use for this component.
|
|
2703
2948
|
* @param {*} row - The contextual row data you wish to use for this component.
|
|
2704
2949
|
* @param {*} flags - The flags to control the behavior of the validation.
|
|
2705
|
-
* @returns
|
|
2950
|
+
* @returns {Array<any>} - An array of errors if the component is invalid.
|
|
2706
2951
|
*/
|
|
2707
|
-
validateComponent(data, row, flags = {}) {
|
|
2952
|
+
validateComponent(data = null, row = null, flags = {}) {
|
|
2708
2953
|
data = data || this.rootValue;
|
|
2709
2954
|
row = row || this.data;
|
|
2710
2955
|
const { async = false } = flags;
|
|
@@ -2735,13 +2980,14 @@ class Component extends Element_1.default {
|
|
|
2735
2980
|
}
|
|
2736
2981
|
/**
|
|
2737
2982
|
* Checks the validity of this component and sets the error message if it is invalid.
|
|
2738
|
-
*
|
|
2739
|
-
* @param
|
|
2740
|
-
* @param
|
|
2741
|
-
* @param
|
|
2742
|
-
* @
|
|
2743
|
-
|
|
2744
|
-
|
|
2983
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2984
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2985
|
+
* @param {*} row - The contextual row data for this component.
|
|
2986
|
+
* @param {*} flags - The flags to use when checking the validity.
|
|
2987
|
+
* @param {Array<any>} allErrors - An array of all errors that have occured so that it can be appended when another one occurs here.
|
|
2988
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2989
|
+
*/
|
|
2990
|
+
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
2745
2991
|
data = data || this.rootValue;
|
|
2746
2992
|
row = row || this.data;
|
|
2747
2993
|
flags.dirty = dirty || false;
|
|
@@ -2777,32 +3023,30 @@ class Component extends Element_1.default {
|
|
|
2777
3023
|
}
|
|
2778
3024
|
/**
|
|
2779
3025
|
* Checks the validity of the component.
|
|
2780
|
-
* @param {*} data
|
|
2781
|
-
* @param {
|
|
2782
|
-
* @param {*} row
|
|
2783
|
-
* @param {
|
|
2784
|
-
* @
|
|
2785
|
-
|
|
2786
|
-
|
|
3026
|
+
* @param {*} data - The data to check if the component is valid.
|
|
3027
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
3028
|
+
* @param {*} row - The contextual row data for this component.
|
|
3029
|
+
* @param {boolean} silentCheck - If the check should be silent and not set the error messages.
|
|
3030
|
+
* @param {Array<any>} errors - An array of all errors that have occured so that it can be appended when another one occurs here.
|
|
3031
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
3032
|
+
*/
|
|
3033
|
+
checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2787
3034
|
data = data || this.rootValue;
|
|
2788
3035
|
row = row || this.data;
|
|
2789
|
-
console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
2790
3036
|
return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
|
|
2791
3037
|
}
|
|
2792
|
-
checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
|
|
2793
|
-
console.log('Deprecation warning: Component.checkAsyncValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3038
|
+
checkAsyncValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2794
3039
|
return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
|
|
2795
3040
|
}
|
|
2796
3041
|
/**
|
|
2797
3042
|
* Check the conditions, calculations, and validity of a single component and triggers an update if
|
|
2798
3043
|
* something changed.
|
|
2799
|
-
*
|
|
2800
|
-
* @param
|
|
2801
|
-
* @param
|
|
2802
|
-
*
|
|
2803
|
-
* @return boolean - If component is valid or not.
|
|
3044
|
+
* @param {*} data - The root data of the change event.
|
|
3045
|
+
* @param {*} flags - The flags from this change event.
|
|
3046
|
+
* @param {*} row - The contextual row data for this component.
|
|
3047
|
+
* @returns {void|boolean} - TRUE if no check should be performed on the component.
|
|
2804
3048
|
*/
|
|
2805
|
-
checkData(data, flags, row) {
|
|
3049
|
+
checkData(data = null, flags = null, row = null) {
|
|
2806
3050
|
data = data || this.rootValue;
|
|
2807
3051
|
flags = flags || {};
|
|
2808
3052
|
row = row || this.data;
|
|
@@ -2845,8 +3089,7 @@ class Component extends Element_1.default {
|
|
|
2845
3089
|
}
|
|
2846
3090
|
/**
|
|
2847
3091
|
* Check if a component is eligible for multiple validation
|
|
2848
|
-
*
|
|
2849
|
-
* @return {boolean}
|
|
3092
|
+
* @returns {boolean} - TRUE if the component is eligible for multiple validation.
|
|
2850
3093
|
*/
|
|
2851
3094
|
validateMultiple() {
|
|
2852
3095
|
return true;
|
|
@@ -2966,8 +3209,7 @@ class Component extends Element_1.default {
|
|
|
2966
3209
|
/**
|
|
2967
3210
|
* Determines if the value of this component is hidden from the user as if it is coming from the server, but is
|
|
2968
3211
|
* protected.
|
|
2969
|
-
*
|
|
2970
|
-
* @return {boolean|*}
|
|
3212
|
+
* @returns {boolean|*} - TRUE if the value is hidden.
|
|
2971
3213
|
*/
|
|
2972
3214
|
isValueHidden() {
|
|
2973
3215
|
if (this.component.protected && this.root.editing) {
|
|
@@ -3012,6 +3254,8 @@ class Component extends Element_1.default {
|
|
|
3012
3254
|
}
|
|
3013
3255
|
/**
|
|
3014
3256
|
* 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.
|
|
3015
3259
|
*/
|
|
3016
3260
|
asString(value) {
|
|
3017
3261
|
value = value || this.getValue();
|
|
@@ -3019,15 +3263,14 @@ class Component extends Element_1.default {
|
|
|
3019
3263
|
}
|
|
3020
3264
|
/**
|
|
3021
3265
|
* Return if the component is disabled.
|
|
3022
|
-
* @
|
|
3266
|
+
* @returns {boolean} - TRUE if the component is disabled.
|
|
3023
3267
|
*/
|
|
3024
3268
|
get disabled() {
|
|
3025
3269
|
return this._disabled || this.parentDisabled;
|
|
3026
3270
|
}
|
|
3027
3271
|
/**
|
|
3028
3272
|
* Disable this component.
|
|
3029
|
-
*
|
|
3030
|
-
* @param {boolean} disabled
|
|
3273
|
+
* @param {boolean} disabled - TRUE to disable the component.
|
|
3031
3274
|
*/
|
|
3032
3275
|
set disabled(disabled) {
|
|
3033
3276
|
this._disabled = disabled;
|
|
@@ -3152,6 +3395,7 @@ class Component extends Element_1.default {
|
|
|
3152
3395
|
}
|
|
3153
3396
|
/**
|
|
3154
3397
|
* Get the element information.
|
|
3398
|
+
* @returns {*} - The components "input" DOM element information.
|
|
3155
3399
|
*/
|
|
3156
3400
|
elementInfo() {
|
|
3157
3401
|
const attributes = {
|
|
@@ -3190,15 +3434,13 @@ class Component extends Element_1.default {
|
|
|
3190
3434
|
const { left, top } = element.getBoundingClientRect();
|
|
3191
3435
|
window.scrollTo(left + window.scrollX, top + window.scrollY);
|
|
3192
3436
|
}
|
|
3193
|
-
focus(index) {
|
|
3437
|
+
focus(index = (this.refs.input.length - 1)) {
|
|
3194
3438
|
var _a, _b;
|
|
3195
3439
|
if ('beforeFocus' in this.parent) {
|
|
3196
3440
|
this.parent.beforeFocus(this);
|
|
3197
3441
|
}
|
|
3198
3442
|
if ((_a = this.refs.input) === null || _a === void 0 ? void 0 : _a.length) {
|
|
3199
|
-
const focusingInput =
|
|
3200
|
-
? this.refs.input[index]
|
|
3201
|
-
: this.refs.input[this.refs.input.length - 1];
|
|
3443
|
+
const focusingInput = this.refs.input[index];
|
|
3202
3444
|
if (((_b = this.component.widget) === null || _b === void 0 ? void 0 : _b.type) === 'calendar') {
|
|
3203
3445
|
const sibling = focusingInput.nextSibling;
|
|
3204
3446
|
if (sibling) {
|
|
@@ -3218,6 +3460,7 @@ class Component extends Element_1.default {
|
|
|
3218
3460
|
}
|
|
3219
3461
|
/**
|
|
3220
3462
|
* Get `Formio` instance for working with files
|
|
3463
|
+
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
|
3221
3464
|
*/
|
|
3222
3465
|
get fileService() {
|
|
3223
3466
|
if (this.options.fileService) {
|