@formio/js 5.0.0-dev.5633.8d2b30d → 5.0.0-dev.5633.fde3bc9
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 +47 -2
- package/dist/formio.builder.css +8 -8
- package/dist/formio.builder.min.css +1 -1
- 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.css +8 -8
- package/dist/formio.form.js +615 -1196
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -5
- package/dist/formio.full.css +8 -8
- package/dist/formio.full.js +659 -920
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -5
- package/dist/formio.js +18 -18
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1829 -492
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +10 -4
- package/embed.d.ts +1 -0
- package/form.d.ts +1 -0
- package/lib/cjs/CDN.d.ts +1 -0
- package/lib/cjs/CDN.js +6 -3
- package/lib/cjs/Element.d.ts +86 -96
- package/lib/cjs/Element.js +68 -78
- package/lib/cjs/Embed.d.ts +1 -1
- package/lib/cjs/Embed.js +52 -12
- 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 +116 -0
- package/lib/cjs/PDF.d.ts +11 -13
- package/lib/cjs/PDF.js +6 -8
- package/lib/cjs/Webform.d.ts +183 -143
- package/lib/cjs/Webform.js +310 -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 +43 -20
- 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 +507 -276
- 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 +438 -196
- 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/component/fixtures/comp6.d.ts +77 -0
- package/lib/cjs/components/_classes/component/fixtures/comp6.js +59 -0
- package/lib/cjs/components/_classes/component/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/_classes/component/fixtures/index.js +3 -1
- 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 +8 -6
- 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/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
- package/lib/cjs/components/datagrid/fixtures/comp-with-checkboxes.js +36 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +3 -1
- package/lib/cjs/components/datamap/DataMap.d.ts +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 +23 -49
- 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 +16 -21
- package/lib/cjs/components/day/fixtures/comp7.d.ts +109 -0
- package/lib/cjs/components/day/fixtures/comp7.js +109 -0
- package/lib/cjs/components/day/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/day/fixtures/index.js +3 -1
- 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/file/File.js +1 -2
- package/lib/cjs/components/form/Form.d.ts +34 -24
- 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 +15 -13
- 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 +6 -6
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +5 -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 +0 -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 +16 -17
- 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 +73 -1
- 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/translations/en.d.ts +2 -0
- package/lib/cjs/translations/en.js +3 -1
- package/lib/cjs/utils/ChoicesWrapper.d.ts +1 -1
- package/lib/cjs/utils/ChoicesWrapper.js +13 -2
- package/lib/cjs/utils/Evaluator.d.ts +6 -3
- package/lib/cjs/utils/Evaluator.js +11 -20
- 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 +367 -221
- package/lib/cjs/utils/utils.js +335 -228
- package/lib/cjs/widgets/CalendarWidget.d.ts +9 -10
- package/lib/cjs/widgets/CalendarWidget.js +9 -11
- package/lib/mjs/CDN.d.ts +1 -0
- package/lib/mjs/CDN.js +6 -3
- package/lib/mjs/Element.d.ts +86 -96
- package/lib/mjs/Element.js +68 -78
- package/lib/mjs/Embed.d.ts +1 -1
- package/lib/mjs/Embed.js +52 -12
- 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 +112 -0
- package/lib/mjs/PDF.d.ts +11 -13
- package/lib/mjs/PDF.js +6 -8
- package/lib/mjs/Webform.d.ts +183 -143
- package/lib/mjs/Webform.js +322 -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 +42 -19
- 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 +507 -276
- 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 +438 -196
- 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/component/fixtures/comp6.d.ts +77 -0
- package/lib/mjs/components/_classes/component/fixtures/comp6.js +57 -0
- package/lib/mjs/components/_classes/component/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/_classes/component/fixtures/index.js +2 -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 +8 -6
- 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/datagrid/fixtures/comp-with-checkboxes.d.ts +29 -0
- package/lib/mjs/components/datagrid/fixtures/comp-with-checkboxes.js +34 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +2 -1
- package/lib/mjs/components/datamap/DataMap.d.ts +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 +23 -49
- 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 +16 -21
- package/lib/mjs/components/day/fixtures/comp7.d.ts +109 -0
- package/lib/mjs/components/day/fixtures/comp7.js +107 -0
- package/lib/mjs/components/day/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/day/fixtures/index.js +2 -1
- 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/file/File.js +1 -2
- package/lib/mjs/components/form/Form.d.ts +34 -24
- 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 +15 -13
- 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 +6 -6
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +5 -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 +14 -17
- 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 +0 -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 +16 -17
- 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 +73 -1
- 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/translations/en.d.ts +2 -0
- package/lib/mjs/translations/en.js +3 -1
- package/lib/mjs/utils/ChoicesWrapper.d.ts +1 -1
- package/lib/mjs/utils/ChoicesWrapper.js +13 -2
- package/lib/mjs/utils/Evaluator.d.ts +6 -3
- package/lib/mjs/utils/Evaluator.js +9 -20
- 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 +367 -221
- package/lib/mjs/utils/utils.js +329 -222
- 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,18 +1039,25 @@ 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
|
}
|
|
1032
1049
|
/**
|
|
1033
1050
|
* Renders a modal preview template and returns the markup as a string
|
|
1034
|
-
*
|
|
1035
|
-
* @
|
|
1036
|
-
* @return {string}
|
|
1051
|
+
* @param {object|null|undefined} ctx - The rendering context
|
|
1052
|
+
* @return {string} - The modal preview markup
|
|
1037
1053
|
*/
|
|
1038
1054
|
renderModalPreview(ctx) {
|
|
1039
1055
|
return this.renderTemplate('modalPreview', ctx || {});
|
|
1040
1056
|
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Returns the modal preview template.
|
|
1059
|
+
* @returns {string} - The modal preview template.
|
|
1060
|
+
*/
|
|
1041
1061
|
getModalPreviewTemplate() {
|
|
1042
1062
|
var _a;
|
|
1043
1063
|
const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
|
|
@@ -1051,6 +1071,11 @@ class Component extends Element_1.default {
|
|
|
1051
1071
|
labelInfo: modalLabel,
|
|
1052
1072
|
});
|
|
1053
1073
|
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Performs a complete build of a component, which empties, renders, sets the content in the DOM, and then finally attaches events.
|
|
1076
|
+
* @param {HTMLElement} element - The element to attach this component to.
|
|
1077
|
+
* @returns {Promise<void>} - A promise that resolves when the component has been built.
|
|
1078
|
+
*/
|
|
1054
1079
|
build(element) {
|
|
1055
1080
|
element = element || this.element;
|
|
1056
1081
|
this.empty(element);
|
|
@@ -1060,6 +1085,12 @@ class Component extends Element_1.default {
|
|
|
1060
1085
|
get hasModalSaveButton() {
|
|
1061
1086
|
return true;
|
|
1062
1087
|
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Renders a component as an HTML string.
|
|
1090
|
+
* @param {string} children - The contents of all the children HTML as a string.
|
|
1091
|
+
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
|
1092
|
+
* @returns {string} - The rendered HTML string of a component.
|
|
1093
|
+
*/
|
|
1063
1094
|
render(children = `Unknown component: ${this.component.type}`, topLevel = false) {
|
|
1064
1095
|
const isVisible = this.visible;
|
|
1065
1096
|
this.rendered = true;
|
|
@@ -1085,10 +1116,9 @@ class Component extends Element_1.default {
|
|
|
1085
1116
|
}
|
|
1086
1117
|
/**
|
|
1087
1118
|
* Creates the tooltip instance using tippy.js and returns it
|
|
1088
|
-
*
|
|
1089
1119
|
* @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
|
|
1090
|
-
* @param {
|
|
1091
|
-
* @return {
|
|
1120
|
+
* @param {object|null|undefined} settings - tippy.js options
|
|
1121
|
+
* @return {import('tippy.js').Tippy} - tippy.js instance
|
|
1092
1122
|
*/
|
|
1093
1123
|
createTooltip(tooltipEl, settings = {}) {
|
|
1094
1124
|
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
|
|
@@ -1097,6 +1127,11 @@ class Component extends Element_1.default {
|
|
|
1097
1127
|
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1098
1128
|
return (0, tippy_js_1.default)(tooltipEl, Object.assign(Object.assign({ allowHTML: true, trigger: 'mouseenter click focus', placement: 'right', zIndex: 10000, interactive: true }, settings), { content: this.t(this.sanitize(tooltipText), { _userInput: true }) }));
|
|
1099
1129
|
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Attaches all the tooltips provided the refs object.
|
|
1132
|
+
* @param {object} toolTipsRefs - The refs for the tooltips within your template.
|
|
1133
|
+
* @returns {void}
|
|
1134
|
+
*/
|
|
1100
1135
|
attachTooltips(toolTipsRefs) {
|
|
1101
1136
|
toolTipsRefs === null || toolTipsRefs === void 0 ? void 0 : toolTipsRefs.forEach((tooltip, index) => {
|
|
1102
1137
|
if (tooltip) {
|
|
@@ -1104,9 +1139,21 @@ class Component extends Element_1.default {
|
|
|
1104
1139
|
}
|
|
1105
1140
|
});
|
|
1106
1141
|
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Create a new component modal for this component.
|
|
1144
|
+
* @param {HTMLElement} element - The element to attach the modal to.
|
|
1145
|
+
* @param {boolean} modalShouldBeOpened - TRUE if the modal should open immediately.
|
|
1146
|
+
* @param {any} currentValue - The current value of the component.
|
|
1147
|
+
* @returns {ComponentModal} - The created component modal.
|
|
1148
|
+
*/
|
|
1107
1149
|
createComponentModal(element, modalShouldBeOpened, currentValue) {
|
|
1108
1150
|
return new ComponentModal_1.default(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
|
|
1109
1151
|
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Attaches all event listensers for this component to the DOM elements that were rendered.
|
|
1154
|
+
* @param {HTMLElement} element - The element to attach the listeners to.
|
|
1155
|
+
* @returns {Promise<void>} - Resolves when the component is done attaching to the DOM.
|
|
1156
|
+
*/
|
|
1110
1157
|
attach(element) {
|
|
1111
1158
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
1112
1159
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
@@ -1144,6 +1191,9 @@ class Component extends Element_1.default {
|
|
|
1144
1191
|
this.addons.forEach((addon) => addon.attach(element));
|
|
1145
1192
|
return Promise.resolve();
|
|
1146
1193
|
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Restors the "focus" on a component after a redraw event has occured.
|
|
1196
|
+
*/
|
|
1147
1197
|
restoreFocus() {
|
|
1148
1198
|
var _a, _b, _c;
|
|
1149
1199
|
const isFocused = ((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.focusedComponent) === null || _b === void 0 ? void 0 : _b.path) === this.path;
|
|
@@ -1153,6 +1203,12 @@ class Component extends Element_1.default {
|
|
|
1153
1203
|
this.restoreCaretPosition();
|
|
1154
1204
|
}
|
|
1155
1205
|
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Adds a keyboard shortcut to this component.
|
|
1208
|
+
* @param {HTMLElement} element - The element to attach the keyboard shortcut to.
|
|
1209
|
+
* @param {string} shortcut - The keyboard shortcut to add.
|
|
1210
|
+
* @returns {void}
|
|
1211
|
+
*/
|
|
1156
1212
|
addShortcut(element, shortcut) {
|
|
1157
1213
|
// Avoid infinite recursion.
|
|
1158
1214
|
if (!element || !this.root || (this.root === this)) {
|
|
@@ -1163,6 +1219,12 @@ class Component extends Element_1.default {
|
|
|
1163
1219
|
}
|
|
1164
1220
|
this.root.addShortcut(element, shortcut);
|
|
1165
1221
|
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Removes a keyboard shortcut from this component.
|
|
1224
|
+
* @param {HTMLElement} element - The element to remove the keyboard shortcut from.
|
|
1225
|
+
* @param {string} shortcut - The keyboard shortcut to remove.
|
|
1226
|
+
* @returns {void}
|
|
1227
|
+
*/
|
|
1166
1228
|
removeShortcut(element, shortcut) {
|
|
1167
1229
|
// Avoid infinite recursion.
|
|
1168
1230
|
if (!element || (this.root === this)) {
|
|
@@ -1195,6 +1257,13 @@ class Component extends Element_1.default {
|
|
|
1195
1257
|
this.tooltip.destroy();
|
|
1196
1258
|
}
|
|
1197
1259
|
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Determines if the component should be refreshed based on the path of another component that changed.
|
|
1262
|
+
* @param {string} refreshData - The path of the data that needs to trigger a refresh.
|
|
1263
|
+
* @param {boolean} changed - Flag that is true if the data has been changed.
|
|
1264
|
+
* @param {any} flags - The flags for the checkData procedure.
|
|
1265
|
+
* @returns {void}
|
|
1266
|
+
*/
|
|
1198
1267
|
checkRefresh(refreshData, changed, flags) {
|
|
1199
1268
|
const changePath = lodash_1.default.get(changed, 'instance.path', false);
|
|
1200
1269
|
// Don't let components change themselves.
|
|
@@ -1211,6 +1280,12 @@ class Component extends Element_1.default {
|
|
|
1211
1280
|
this.refresh(changed.value, changed, flags);
|
|
1212
1281
|
}
|
|
1213
1282
|
}
|
|
1283
|
+
/**
|
|
1284
|
+
* 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.
|
|
1285
|
+
* @param {Array<any>} changes - The list of components that have changed.
|
|
1286
|
+
* @param {any} flags - The checkData flags.
|
|
1287
|
+
* @returns {void}
|
|
1288
|
+
*/
|
|
1214
1289
|
checkRefreshOn(changes, flags = {}) {
|
|
1215
1290
|
changes = changes || [];
|
|
1216
1291
|
if (flags.noRefresh) {
|
|
@@ -1232,8 +1307,8 @@ class Component extends Element_1.default {
|
|
|
1232
1307
|
}
|
|
1233
1308
|
/**
|
|
1234
1309
|
* Refreshes the component with a new value.
|
|
1235
|
-
*
|
|
1236
|
-
* @
|
|
1310
|
+
* @param {any} value - The latest value of the component to check if it needs to be refreshed.
|
|
1311
|
+
* @returns {void}
|
|
1237
1312
|
*/
|
|
1238
1313
|
refresh(value) {
|
|
1239
1314
|
if (this.hasOwnProperty('refreshOnValue')) {
|
|
@@ -1256,8 +1331,8 @@ class Component extends Element_1.default {
|
|
|
1256
1331
|
* with the components data and returns true if they are in the same context.
|
|
1257
1332
|
*
|
|
1258
1333
|
* Different rows of the same EditGrid, for example, are in different contexts.
|
|
1259
|
-
*
|
|
1260
|
-
* @
|
|
1334
|
+
* @param {any} component - The component to check if it is in the same context as this component.
|
|
1335
|
+
* @returns {boolean} - TRUE if the component is in the same context as this component.
|
|
1261
1336
|
*/
|
|
1262
1337
|
inContext(component) {
|
|
1263
1338
|
if (component.data === this.data) {
|
|
@@ -1272,9 +1347,18 @@ class Component extends Element_1.default {
|
|
|
1272
1347
|
}
|
|
1273
1348
|
return false;
|
|
1274
1349
|
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Determines if we are in "view" only mode.
|
|
1352
|
+
* @returns {boolean} - TRUE if we are in "view" only mode.
|
|
1353
|
+
*/
|
|
1275
1354
|
get viewOnly() {
|
|
1276
1355
|
return this.options.readOnly && this.options.viewAsHtml;
|
|
1277
1356
|
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Sets the HTMLElement for this component.
|
|
1359
|
+
* @param {HTMLElement} element - The element that is attached to this component.
|
|
1360
|
+
* @returns {void}
|
|
1361
|
+
*/
|
|
1278
1362
|
setElement(element) {
|
|
1279
1363
|
if (this.element) {
|
|
1280
1364
|
delete this.element.component;
|
|
@@ -1282,6 +1366,10 @@ class Component extends Element_1.default {
|
|
|
1282
1366
|
}
|
|
1283
1367
|
this.element = element;
|
|
1284
1368
|
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Creates an element to hold the "view only" version of this component.
|
|
1371
|
+
* @returns {HTMLElement} - The element for this component.
|
|
1372
|
+
*/
|
|
1285
1373
|
createViewOnlyElement() {
|
|
1286
1374
|
this.setElement(this.ce('dl', {
|
|
1287
1375
|
id: this.id
|
|
@@ -1292,14 +1380,18 @@ class Component extends Element_1.default {
|
|
|
1292
1380
|
}
|
|
1293
1381
|
return this.element;
|
|
1294
1382
|
}
|
|
1383
|
+
/**
|
|
1384
|
+
* The default value for the "view only" mode of a component if the value is not provided.
|
|
1385
|
+
* @returns {string} - The default value for this component.
|
|
1386
|
+
*/
|
|
1295
1387
|
get defaultViewOnlyValue() {
|
|
1296
1388
|
return '-';
|
|
1297
1389
|
}
|
|
1298
1390
|
/**
|
|
1299
1391
|
* Uses the widget to determine the output string.
|
|
1300
|
-
*
|
|
1301
|
-
* @param
|
|
1302
|
-
* @
|
|
1392
|
+
* @param {any} value - The current value of the component.
|
|
1393
|
+
* @param {any} options - The options for getValueAsString.
|
|
1394
|
+
* @returns {any|Array<any>} - The value as a string.
|
|
1303
1395
|
*/
|
|
1304
1396
|
getWidgetValueAsString(value, options) {
|
|
1305
1397
|
const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
|
|
@@ -1324,6 +1416,12 @@ class Component extends Element_1.default {
|
|
|
1324
1416
|
const widget = this.refs.input[0].widget;
|
|
1325
1417
|
return widget.getValueAsString(value, options);
|
|
1326
1418
|
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Returns the value of the component as a string.
|
|
1421
|
+
* @param {any} value - The value for this component.
|
|
1422
|
+
* @param {any} options - The options for this component.
|
|
1423
|
+
* @returns {string} - The string representation of the value of this component.
|
|
1424
|
+
*/
|
|
1327
1425
|
getValueAsString(value, options) {
|
|
1328
1426
|
if (!value) {
|
|
1329
1427
|
return '';
|
|
@@ -1341,20 +1439,32 @@ class Component extends Element_1.default {
|
|
|
1341
1439
|
const stringValue = value.toString();
|
|
1342
1440
|
return this.sanitize(stringValue);
|
|
1343
1441
|
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Returns the string representation "view" of the component value.
|
|
1444
|
+
* @param {any} value - The value of the component.
|
|
1445
|
+
* @param {any} options - The options for this component.
|
|
1446
|
+
* @returns {string} - The string representation of the value of this component.
|
|
1447
|
+
*/
|
|
1344
1448
|
getView(value, options) {
|
|
1345
1449
|
if (this.component.protected) {
|
|
1346
1450
|
return '--- PROTECTED ---';
|
|
1347
1451
|
}
|
|
1348
1452
|
return this.getValueAsString(value, options);
|
|
1349
1453
|
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Updates the items list for this component. Useful for Select and other List component types.
|
|
1456
|
+
* @param {...any} args - The arguments to pass to the onChange event.
|
|
1457
|
+
* @returns {void}
|
|
1458
|
+
*/
|
|
1350
1459
|
updateItems(...args) {
|
|
1351
1460
|
this.restoreValue();
|
|
1352
1461
|
this.onChange(...args);
|
|
1353
1462
|
}
|
|
1354
1463
|
/**
|
|
1355
|
-
*
|
|
1356
|
-
* @param {
|
|
1357
|
-
* @
|
|
1464
|
+
* Returns the value for a specific item in a List type component.
|
|
1465
|
+
* @param {any} data - The data for this component.
|
|
1466
|
+
* @param {boolean} [forceUseValue] - if true, return 'value' property of the data
|
|
1467
|
+
* @returns {any} - The value of the item.
|
|
1358
1468
|
*/
|
|
1359
1469
|
itemValue(data, forceUseValue = false) {
|
|
1360
1470
|
if (lodash_1.default.isObject(data) && !lodash_1.default.isArray(data)) {
|
|
@@ -1367,6 +1477,11 @@ class Component extends Element_1.default {
|
|
|
1367
1477
|
}
|
|
1368
1478
|
return data;
|
|
1369
1479
|
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Returns the item value for html mode.
|
|
1482
|
+
* @param {any} value - The value for this component.
|
|
1483
|
+
* @returns {any} - The value of the item for html mode.
|
|
1484
|
+
*/
|
|
1370
1485
|
itemValueForHTMLMode(value) {
|
|
1371
1486
|
if (Array.isArray(value)) {
|
|
1372
1487
|
const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
@@ -1374,6 +1489,13 @@ class Component extends Element_1.default {
|
|
|
1374
1489
|
}
|
|
1375
1490
|
return this.itemValue(value);
|
|
1376
1491
|
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Creates a modal to input the value of this component.
|
|
1494
|
+
* @param {HTMLElement} element - The element to attach the modal to.
|
|
1495
|
+
* @param {any} attr - A list of attributes to add to the modal.
|
|
1496
|
+
* @param {boolean} confirm - If we should add a confirmation to the modal that keeps it from closing unless confirmed.
|
|
1497
|
+
* @returns {HTMLElement} - The created modal element.
|
|
1498
|
+
*/
|
|
1377
1499
|
createModal(element, attr, confirm) {
|
|
1378
1500
|
const dialog = this.ce('div', attr || {});
|
|
1379
1501
|
this.setContent(dialog, this.renderTemplate('dialog'));
|
|
@@ -1409,6 +1531,10 @@ class Component extends Element_1.default {
|
|
|
1409
1531
|
this.addEventListener(dialog.refs.dialogClose, 'click', handleCloseClick);
|
|
1410
1532
|
return dialog;
|
|
1411
1533
|
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Uses CSS classes to show or hide an element.
|
|
1536
|
+
* @returns {boolean} - TRUE if the element has been css removed.
|
|
1537
|
+
*/
|
|
1412
1538
|
get optimizeRedraw() {
|
|
1413
1539
|
if (this.options.optimizeRedraw && this.element && !this.visible) {
|
|
1414
1540
|
this.addClass(this.element, 'formio-removed');
|
|
@@ -1446,7 +1572,7 @@ class Component extends Element_1.default {
|
|
|
1446
1572
|
}
|
|
1447
1573
|
/**
|
|
1448
1574
|
* Build the custom style from the layout values
|
|
1449
|
-
* @
|
|
1575
|
+
* @returns {string} - The custom style
|
|
1450
1576
|
*/
|
|
1451
1577
|
get customStyle() {
|
|
1452
1578
|
let customCSS = '';
|
|
@@ -1457,24 +1583,31 @@ class Component extends Element_1.default {
|
|
|
1457
1583
|
});
|
|
1458
1584
|
return customCSS;
|
|
1459
1585
|
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Returns the component condition operator settings if available.
|
|
1588
|
+
* @returns {object} - The component condition operator settings.
|
|
1589
|
+
*/
|
|
1460
1590
|
static get serverConditionSettings() {
|
|
1461
1591
|
return Component.conditionOperatorsSettings;
|
|
1462
1592
|
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Returns if the application is on a mobile device.
|
|
1595
|
+
* @returns {boolean} - TRUE if the application is on a mobile device.
|
|
1596
|
+
*/
|
|
1463
1597
|
get isMobile() {
|
|
1464
1598
|
return (0, ismobilejs_1.default)();
|
|
1465
1599
|
}
|
|
1466
1600
|
/**
|
|
1467
1601
|
* Returns the outside wrapping element of this component.
|
|
1468
|
-
* @returns {HTMLElement}
|
|
1602
|
+
* @returns {HTMLElement} - The wrapping element of this component.
|
|
1469
1603
|
*/
|
|
1470
1604
|
getElement() {
|
|
1471
1605
|
return this.element;
|
|
1472
1606
|
}
|
|
1473
1607
|
/**
|
|
1474
1608
|
* Create an evaluation context for all script executions and interpolations.
|
|
1475
|
-
*
|
|
1476
|
-
* @
|
|
1477
|
-
* @return {*}
|
|
1609
|
+
* @param {any} additional - Additional context to provide.
|
|
1610
|
+
* @returns {any} - The evaluation context.
|
|
1478
1611
|
*/
|
|
1479
1612
|
evalContext(additional) {
|
|
1480
1613
|
return super.evalContext(Object.assign({
|
|
@@ -1496,18 +1629,29 @@ class Component extends Element_1.default {
|
|
|
1496
1629
|
}
|
|
1497
1630
|
/**
|
|
1498
1631
|
* Sets the pristine flag for this component.
|
|
1499
|
-
*
|
|
1500
|
-
* @param pristine {boolean} - TRUE to make pristine, FALSE not pristine.
|
|
1632
|
+
* @param {boolean} pristine - TRUE to make pristine, FALSE not pristine.
|
|
1501
1633
|
*/
|
|
1502
1634
|
setPristine(pristine) {
|
|
1503
1635
|
this.pristine = pristine;
|
|
1504
1636
|
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Returns if the component is pristine.
|
|
1639
|
+
* @returns {boolean} - TRUE if the component is pristine.
|
|
1640
|
+
*/
|
|
1505
1641
|
get isPristine() {
|
|
1506
1642
|
return this.pristine;
|
|
1507
1643
|
}
|
|
1644
|
+
/**
|
|
1645
|
+
* Sets the dirty flag for this component.
|
|
1646
|
+
* @param {boolean} dirty - TRUE to make dirty, FALSE not dirty.
|
|
1647
|
+
*/
|
|
1508
1648
|
setDirty(dirty) {
|
|
1509
1649
|
this.dirty = dirty;
|
|
1510
1650
|
}
|
|
1651
|
+
/**
|
|
1652
|
+
* Returns if the component is dirty.
|
|
1653
|
+
* @returns {boolean} - TRUE if the component is dirty.
|
|
1654
|
+
*/
|
|
1511
1655
|
get isDirty() {
|
|
1512
1656
|
return this.dirty;
|
|
1513
1657
|
}
|
|
@@ -1521,12 +1665,23 @@ class Component extends Element_1.default {
|
|
|
1521
1665
|
this.restoreValue();
|
|
1522
1666
|
this.triggerRootChange();
|
|
1523
1667
|
}
|
|
1668
|
+
/**
|
|
1669
|
+
* Returns the icon class for a given icon name.
|
|
1670
|
+
* @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.
|
|
1671
|
+
* @param {boolean} spinning - If the component should be spinning.
|
|
1672
|
+
* @returns {string} - The icon class for the equivalent icon in the iconset we are using.
|
|
1673
|
+
*/
|
|
1524
1674
|
iconClass(name, spinning) {
|
|
1525
1675
|
const iconset = this.options.iconset || Templates_1.default.current.defaultIconset || 'fa';
|
|
1526
1676
|
return Templates_1.default.current.hasOwnProperty('iconClass')
|
|
1527
1677
|
? Templates_1.default.current.iconClass(iconset, name, spinning)
|
|
1528
1678
|
: this.options.iconset === 'fa' ? Templates_1.default.defaultTemplates.iconClass(iconset, name, spinning) : name;
|
|
1529
1679
|
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Returns the size css class names for our current template.
|
|
1682
|
+
* @param {string} size - The size class name for the default iconset.
|
|
1683
|
+
* @returns {string} - The size class for our component.
|
|
1684
|
+
*/
|
|
1530
1685
|
size(size) {
|
|
1531
1686
|
return Templates_1.default.current.hasOwnProperty('size')
|
|
1532
1687
|
? Templates_1.default.current.size(size)
|
|
@@ -1539,15 +1694,23 @@ class Component extends Element_1.default {
|
|
|
1539
1694
|
get name() {
|
|
1540
1695
|
return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
|
|
1541
1696
|
}
|
|
1697
|
+
/**
|
|
1698
|
+
* Returns the visible errors for this component.
|
|
1699
|
+
* @returns {Array<object>} - The visible errors for this component.
|
|
1700
|
+
*/
|
|
1542
1701
|
get visibleErrors() {
|
|
1543
1702
|
return this._visibleErrors;
|
|
1544
1703
|
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Returns all the errors for this component, visible or not.
|
|
1706
|
+
* @returns {Array<object>} - All the errors for this component.
|
|
1707
|
+
*/
|
|
1545
1708
|
get errors() {
|
|
1546
1709
|
return this._errors;
|
|
1547
1710
|
}
|
|
1548
1711
|
/**
|
|
1549
1712
|
* Returns the error label for this component.
|
|
1550
|
-
* @
|
|
1713
|
+
* @returns {string} - The error label for this component.
|
|
1551
1714
|
*/
|
|
1552
1715
|
get errorLabel() {
|
|
1553
1716
|
return this.t(this.component.errorLabel
|
|
@@ -1557,12 +1720,20 @@ class Component extends Element_1.default {
|
|
|
1557
1720
|
}
|
|
1558
1721
|
/**
|
|
1559
1722
|
* Get the error message provided a certain type of error.
|
|
1560
|
-
* @param type
|
|
1561
|
-
* @
|
|
1723
|
+
* @param {string} type - The type of error to fetch the message for.
|
|
1724
|
+
* @returns {string} - The error message configured for this component.
|
|
1562
1725
|
*/
|
|
1563
1726
|
errorMessage(type) {
|
|
1564
1727
|
return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
|
|
1565
1728
|
}
|
|
1729
|
+
/**
|
|
1730
|
+
* Sets the content, innerHTML, of an element to the sanitized content.
|
|
1731
|
+
* @param {HTMLElement} element - The element to set the innerHTML to.
|
|
1732
|
+
* @param {string} content - The HTML string content that we wish to set.
|
|
1733
|
+
* @param {boolean} forceSanitize - If we should force the content to be sanitized.
|
|
1734
|
+
* @param {any} sanitizeOptions - The options for the sanitize function.
|
|
1735
|
+
* @returns {boolean} - TRUE if the content was sanitized and set.
|
|
1736
|
+
*/
|
|
1566
1737
|
setContent(element, content, forceSanitize, sanitizeOptions) {
|
|
1567
1738
|
if (element instanceof HTMLElement) {
|
|
1568
1739
|
element.innerHTML = this.sanitize(content, forceSanitize, sanitizeOptions);
|
|
@@ -1570,6 +1741,9 @@ class Component extends Element_1.default {
|
|
|
1570
1741
|
}
|
|
1571
1742
|
return false;
|
|
1572
1743
|
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Restores the caret position in the input element after a refresh occurs.
|
|
1746
|
+
*/
|
|
1573
1747
|
restoreCaretPosition() {
|
|
1574
1748
|
var _a, _b, _c;
|
|
1575
1749
|
if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.currentSelection) {
|
|
@@ -1592,6 +1766,10 @@ class Component extends Element_1.default {
|
|
|
1592
1766
|
}
|
|
1593
1767
|
}
|
|
1594
1768
|
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Redraw the component.
|
|
1771
|
+
* @returns {Promise<void>} - A promise that resolves when the component is done redrawing.
|
|
1772
|
+
*/
|
|
1595
1773
|
redraw() {
|
|
1596
1774
|
// Don't bother if we have not built yet.
|
|
1597
1775
|
if (!this.element || !this.element.parentNode || this.optimizeRedraw) {
|
|
@@ -1607,29 +1785,54 @@ class Component extends Element_1.default {
|
|
|
1607
1785
|
this.setElement(parent.children[index]);
|
|
1608
1786
|
return this.attach(this.element);
|
|
1609
1787
|
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Rebuild and redraw a component.
|
|
1790
|
+
* @returns {Promise<void>} - A promise that resolves when the component is done rebuilding and redrawing.
|
|
1791
|
+
*/
|
|
1610
1792
|
rebuild() {
|
|
1611
1793
|
this.destroy();
|
|
1612
1794
|
this.init();
|
|
1613
1795
|
this.visible = this.conditionallyVisible(null, null);
|
|
1614
1796
|
return this.redraw();
|
|
1615
1797
|
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Removes all event listeners attached to this component.
|
|
1800
|
+
*/
|
|
1616
1801
|
removeEventListeners() {
|
|
1617
1802
|
super.removeEventListeners();
|
|
1618
1803
|
this.tooltips.forEach(tooltip => tooltip.destroy());
|
|
1619
1804
|
this.tooltips = [];
|
|
1620
1805
|
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Returns if the dom node has the classes provided.
|
|
1808
|
+
* @param {HTMLElement} element - The element to check for the class.
|
|
1809
|
+
* @param {string} className - The name of the class to check.
|
|
1810
|
+
* @returns {boolean|void} - TRUE if the element has the class.
|
|
1811
|
+
*/
|
|
1621
1812
|
hasClass(element, className) {
|
|
1622
1813
|
if (!element) {
|
|
1623
1814
|
return;
|
|
1624
1815
|
}
|
|
1625
1816
|
return super.hasClass(element, this.transform('class', className));
|
|
1626
1817
|
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Adds a class to an HTML element.
|
|
1820
|
+
* @param {HTMLElement} element - The dom element to add the class to.
|
|
1821
|
+
* @param {string} className - The class name you wish to add.
|
|
1822
|
+
* @returns {this|void} - The component instance.
|
|
1823
|
+
*/
|
|
1627
1824
|
addClass(element, className) {
|
|
1628
1825
|
if (!element) {
|
|
1629
1826
|
return;
|
|
1630
1827
|
}
|
|
1631
1828
|
return super.addClass(element, this.transform('class', className));
|
|
1632
1829
|
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Removes a class from an element.
|
|
1832
|
+
* @param {HTMLElement} element - The element to remove the class from.
|
|
1833
|
+
* @param {string} className - The class name to remove.
|
|
1834
|
+
* @returns {this|void} - The component instance.
|
|
1835
|
+
*/
|
|
1633
1836
|
removeClass(element, className) {
|
|
1634
1837
|
if (!element) {
|
|
1635
1838
|
return;
|
|
@@ -1638,8 +1841,7 @@ class Component extends Element_1.default {
|
|
|
1638
1841
|
}
|
|
1639
1842
|
/**
|
|
1640
1843
|
* Determines if this component has a condition defined.
|
|
1641
|
-
*
|
|
1642
|
-
* @return {null}
|
|
1844
|
+
* @returns {boolean} - TRUE if the component has a condition defined.
|
|
1643
1845
|
*/
|
|
1644
1846
|
hasCondition() {
|
|
1645
1847
|
if (this._hasCondition !== null) {
|
|
@@ -1650,9 +1852,9 @@ class Component extends Element_1.default {
|
|
|
1650
1852
|
}
|
|
1651
1853
|
/**
|
|
1652
1854
|
* Check if this component is conditionally visible.
|
|
1653
|
-
*
|
|
1654
|
-
* @param data
|
|
1655
|
-
* @
|
|
1855
|
+
* @param {any} data - The data to check against.
|
|
1856
|
+
* @param {any} row - The row data to check against.
|
|
1857
|
+
* @returns {boolean} - TRUE if the component is conditionally visible.
|
|
1656
1858
|
*/
|
|
1657
1859
|
conditionallyVisible(data, row) {
|
|
1658
1860
|
data = data || this.rootValue;
|
|
@@ -1667,16 +1869,19 @@ class Component extends Element_1.default {
|
|
|
1667
1869
|
* Checks the condition of this component.
|
|
1668
1870
|
*
|
|
1669
1871
|
* TODO: Switch row and data parameters to be consistent with other methods.
|
|
1670
|
-
*
|
|
1671
|
-
* @param
|
|
1672
|
-
* @
|
|
1673
|
-
* @return {boolean} - True if the condition applies to this component.
|
|
1872
|
+
* @param {any} row - The row contextual data.
|
|
1873
|
+
* @param {any} data - The global data object.
|
|
1874
|
+
* @returns {boolean} - True if the condition applies to this component.
|
|
1674
1875
|
*/
|
|
1675
1876
|
checkCondition(row, data) {
|
|
1676
1877
|
return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
|
|
1677
1878
|
}
|
|
1678
1879
|
/**
|
|
1679
1880
|
* Check for conditionals and hide/show the element based on those conditions.
|
|
1881
|
+
* @param {any} data - The data to check against.
|
|
1882
|
+
* @param {any} flags - The flags passed to checkData function.
|
|
1883
|
+
* @param {any} row - The row data to check against.
|
|
1884
|
+
* @returns {boolean} - TRUE if the component is visible.
|
|
1680
1885
|
*/
|
|
1681
1886
|
checkComponentConditions(data, flags, row) {
|
|
1682
1887
|
data = data || this.rootValue;
|
|
@@ -1694,8 +1899,10 @@ class Component extends Element_1.default {
|
|
|
1694
1899
|
}
|
|
1695
1900
|
/**
|
|
1696
1901
|
* Checks conditions for this component and any sub components.
|
|
1697
|
-
* @param
|
|
1698
|
-
* @
|
|
1902
|
+
* @param {any} data - The data to check against.
|
|
1903
|
+
* @param {any} flags - The flags passed to checkData function.
|
|
1904
|
+
* @param {any} row - The row data to check against.
|
|
1905
|
+
* @returns {boolean} - TRUE if the component is visible.
|
|
1699
1906
|
*/
|
|
1700
1907
|
checkConditions(data, flags, row) {
|
|
1701
1908
|
data = data || this.rootValue;
|
|
@@ -1703,17 +1910,20 @@ class Component extends Element_1.default {
|
|
|
1703
1910
|
row = row || this.data;
|
|
1704
1911
|
return this.checkComponentConditions(data, flags, row);
|
|
1705
1912
|
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Returns the component logic if applicable.
|
|
1915
|
+
* @returns {Array<object>} - The component logic.
|
|
1916
|
+
*/
|
|
1706
1917
|
get logic() {
|
|
1707
1918
|
return this.component.logic || [];
|
|
1708
1919
|
}
|
|
1709
1920
|
/**
|
|
1710
1921
|
* Check all triggers and apply necessary actions.
|
|
1711
|
-
*
|
|
1712
|
-
* @param data
|
|
1922
|
+
* @param {any} data - The data to check against.
|
|
1923
|
+
* @param {any} row - The row data to check against.
|
|
1924
|
+
* @returns {boolean|void} - TRUE if the component was altered.
|
|
1713
1925
|
*/
|
|
1714
|
-
fieldLogic(data, row) {
|
|
1715
|
-
data = data || this.rootValue;
|
|
1716
|
-
row = row || this.data;
|
|
1926
|
+
fieldLogic(data = this.rootValue, row = this.data) {
|
|
1717
1927
|
const logics = this.logic;
|
|
1718
1928
|
// If there aren't logic, don't go further.
|
|
1719
1929
|
if (logics.length === 0) {
|
|
@@ -1736,6 +1946,10 @@ class Component extends Element_1.default {
|
|
|
1736
1946
|
}
|
|
1737
1947
|
return changed;
|
|
1738
1948
|
}
|
|
1949
|
+
/**
|
|
1950
|
+
* Retuns if the browser is Internet Explorer.
|
|
1951
|
+
* @returns {boolean} - TRUE if the browser is IE.
|
|
1952
|
+
*/
|
|
1739
1953
|
isIE() {
|
|
1740
1954
|
if (typeof window === 'undefined') {
|
|
1741
1955
|
return false;
|
|
@@ -1760,9 +1974,24 @@ class Component extends Element_1.default {
|
|
|
1760
1974
|
// other browser
|
|
1761
1975
|
return false;
|
|
1762
1976
|
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Defines the logic action value through evaluation.
|
|
1979
|
+
* @param {object} action - The action within the Logic system to perform.
|
|
1980
|
+
* @param {object} argsObject - The arguments to pass to the evaluation.
|
|
1981
|
+
* @returns {any} - The result of the evaluation.
|
|
1982
|
+
*/
|
|
1763
1983
|
defineActionValue(action, argsObject) {
|
|
1764
1984
|
return this.evaluate(action.value, argsObject, 'value');
|
|
1765
1985
|
}
|
|
1986
|
+
/**
|
|
1987
|
+
* Apply the actions of Logic for a component once the conditions have been met.
|
|
1988
|
+
* @param {object} newComponent - The new component to apply the actions to.
|
|
1989
|
+
* @param {Array<object>} actions - An array of actions
|
|
1990
|
+
* @param {any} result - The result of the conditional check in order to evaluate the actions.
|
|
1991
|
+
* @param {any} row - The contextual row data for this component.
|
|
1992
|
+
* @param {any} data - The global data object for the submission.
|
|
1993
|
+
* @returns {boolean} - TRUE if the component was altered.
|
|
1994
|
+
*/
|
|
1766
1995
|
applyActions(newComponent, actions, result, row, data) {
|
|
1767
1996
|
data = data || this.rootValue;
|
|
1768
1997
|
row = row || this.data;
|
|
@@ -1842,8 +2071,8 @@ class Component extends Element_1.default {
|
|
|
1842
2071
|
}
|
|
1843
2072
|
/**
|
|
1844
2073
|
* Add a new input error to this element.
|
|
1845
|
-
*
|
|
1846
|
-
* @
|
|
2074
|
+
* @param {Array<object>|string} messages - An array of messages to add to the element.
|
|
2075
|
+
* @returns {void}
|
|
1847
2076
|
*/
|
|
1848
2077
|
addMessages(messages) {
|
|
1849
2078
|
if (!messages) {
|
|
@@ -1866,6 +2095,15 @@ class Component extends Element_1.default {
|
|
|
1866
2095
|
}).join(''));
|
|
1867
2096
|
}
|
|
1868
2097
|
}
|
|
2098
|
+
/**
|
|
2099
|
+
* Sets the form input widget error classes.
|
|
2100
|
+
* @param {Array<HTMLElement>} elements - An array of DOM elements to set the error classes on.
|
|
2101
|
+
* @param {boolean} dirty - If the input is dirty.
|
|
2102
|
+
* @param {boolean} hasErrors - If the input has errors.
|
|
2103
|
+
* @param {boolean} hasMessages - If the input has messages.
|
|
2104
|
+
* @param {HTMLElement} element - The wrapper element for all the other elements passed in first argument.
|
|
2105
|
+
* @returns {void}
|
|
2106
|
+
*/
|
|
1869
2107
|
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
1870
2108
|
this.clearErrorClasses();
|
|
1871
2109
|
elements.forEach((element) => {
|
|
@@ -1892,6 +2130,12 @@ class Component extends Element_1.default {
|
|
|
1892
2130
|
this.addClass(element, 'has-message');
|
|
1893
2131
|
}
|
|
1894
2132
|
}
|
|
2133
|
+
/**
|
|
2134
|
+
* Adds the classes necessary to mark an element as invalid.
|
|
2135
|
+
* @param {HTMLElement} element - The element you wish to add the invalid classes to.
|
|
2136
|
+
* @param {boolean} invalid - TRUE if the component is invalid, FALSE otherwise.
|
|
2137
|
+
* @returns {void}
|
|
2138
|
+
*/
|
|
1895
2139
|
setElementInvalid(element, invalid) {
|
|
1896
2140
|
if (!element)
|
|
1897
2141
|
return;
|
|
@@ -1903,6 +2147,9 @@ class Component extends Element_1.default {
|
|
|
1903
2147
|
}
|
|
1904
2148
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
|
1905
2149
|
}
|
|
2150
|
+
/**
|
|
2151
|
+
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
|
2152
|
+
*/
|
|
1906
2153
|
clearOnHide() {
|
|
1907
2154
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
1908
2155
|
if (
|
|
@@ -1922,6 +2169,10 @@ class Component extends Element_1.default {
|
|
|
1922
2169
|
}
|
|
1923
2170
|
}
|
|
1924
2171
|
}
|
|
2172
|
+
/**
|
|
2173
|
+
* Triggers a debounced onChange event for the root component (usually Webform).
|
|
2174
|
+
* @param {...any} args - The arguments to pass to the onChange event.
|
|
2175
|
+
*/
|
|
1925
2176
|
triggerRootChange(...args) {
|
|
1926
2177
|
if (this.options.onChange) {
|
|
1927
2178
|
this.options.onChange(...args);
|
|
@@ -1930,6 +2181,13 @@ class Component extends Element_1.default {
|
|
|
1930
2181
|
this.root.triggerChange(...args);
|
|
1931
2182
|
}
|
|
1932
2183
|
}
|
|
2184
|
+
/**
|
|
2185
|
+
* Called when the component value has been changed. This will then trigger the root level onChange handler which
|
|
2186
|
+
* propagates the checkData methods for the full component tree.
|
|
2187
|
+
* @param {any} flags - The flags for the change event propagation.
|
|
2188
|
+
* @param {boolean} fromRoot - If the change event is from the root component.
|
|
2189
|
+
* @returns {boolean} - TRUE if the component has changed.
|
|
2190
|
+
*/
|
|
1933
2191
|
onChange(flags, fromRoot) {
|
|
1934
2192
|
flags = flags || {};
|
|
1935
2193
|
if (flags.modified) {
|
|
@@ -2059,7 +2317,7 @@ class Component extends Element_1.default {
|
|
|
2059
2317
|
return Promise.reject();
|
|
2060
2318
|
}
|
|
2061
2319
|
this.quill = new Quill(element, isIEBrowser ? Object.assign(Object.assign({}, settings), { modules: {} }) : settings);
|
|
2062
|
-
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ
|
|
2320
|
+
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ */
|
|
2063
2321
|
const txtArea = document.createElement('textarea');
|
|
2064
2322
|
txtArea.setAttribute('class', 'quill-source-code');
|
|
2065
2323
|
this.quill.addContainer('ql-custom').appendChild(txtArea);
|
|
@@ -2073,7 +2331,7 @@ class Component extends Element_1.default {
|
|
|
2073
2331
|
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2074
2332
|
});
|
|
2075
2333
|
}
|
|
2076
|
-
/** END CODEBLOCK
|
|
2334
|
+
/** END CODEBLOCK */
|
|
2077
2335
|
// Make sure to select cursor when they click on the element.
|
|
2078
2336
|
this.addEventListener(element, 'click', () => this.quill.focus());
|
|
2079
2337
|
// Allows users to skip toolbar items when tabbing though form
|
|
@@ -2121,23 +2379,22 @@ class Component extends Element_1.default {
|
|
|
2121
2379
|
}
|
|
2122
2380
|
/**
|
|
2123
2381
|
* The empty value for this component.
|
|
2124
|
-
*
|
|
2125
|
-
* @return {null}
|
|
2382
|
+
* @returns {null} - The empty value for this component.
|
|
2126
2383
|
*/
|
|
2127
2384
|
get emptyValue() {
|
|
2128
2385
|
return null;
|
|
2129
2386
|
}
|
|
2130
2387
|
/**
|
|
2131
2388
|
* Returns if this component has a value set.
|
|
2132
|
-
*
|
|
2389
|
+
* @param {any} data - The global data object.
|
|
2390
|
+
* @returns {boolean} - TRUE if a value is set.
|
|
2133
2391
|
*/
|
|
2134
2392
|
hasValue(data) {
|
|
2135
2393
|
return !lodash_1.default.isUndefined(lodash_1.default.get(data || this.data, this.key));
|
|
2136
2394
|
}
|
|
2137
2395
|
/**
|
|
2138
2396
|
* Get the data value at the root level.
|
|
2139
|
-
*
|
|
2140
|
-
* @return {*}
|
|
2397
|
+
* @returns {*} - The root value for the component, typically the Webform data object.
|
|
2141
2398
|
*/
|
|
2142
2399
|
get rootValue() {
|
|
2143
2400
|
return this.root ? this.root.data : this.data;
|
|
@@ -2147,7 +2404,7 @@ class Component extends Element_1.default {
|
|
|
2147
2404
|
}
|
|
2148
2405
|
/**
|
|
2149
2406
|
* Get the static value of this component.
|
|
2150
|
-
* @
|
|
2407
|
+
* @returns {*} - The value for this component.
|
|
2151
2408
|
*/
|
|
2152
2409
|
get dataValue() {
|
|
2153
2410
|
if (!this.key ||
|
|
@@ -2165,8 +2422,7 @@ class Component extends Element_1.default {
|
|
|
2165
2422
|
}
|
|
2166
2423
|
/**
|
|
2167
2424
|
* Sets the static value of this component.
|
|
2168
|
-
*
|
|
2169
|
-
* @param value
|
|
2425
|
+
* @param {*} value - The value to set for this component.
|
|
2170
2426
|
*/
|
|
2171
2427
|
set dataValue(value) {
|
|
2172
2428
|
if (!this.allowData ||
|
|
@@ -2186,8 +2442,8 @@ class Component extends Element_1.default {
|
|
|
2186
2442
|
}
|
|
2187
2443
|
/**
|
|
2188
2444
|
* Splice a value from the dataValue.
|
|
2189
|
-
*
|
|
2190
|
-
* @param
|
|
2445
|
+
* @param {number} index - The index to splice for an array component values.
|
|
2446
|
+
* @param {*} flags - The flags to use when splicing the value.
|
|
2191
2447
|
*/
|
|
2192
2448
|
splice(index, flags = {}) {
|
|
2193
2449
|
if (this.hasValue()) {
|
|
@@ -2255,8 +2511,7 @@ class Component extends Element_1.default {
|
|
|
2255
2511
|
}
|
|
2256
2512
|
/**
|
|
2257
2513
|
* Get the input value of this component.
|
|
2258
|
-
*
|
|
2259
|
-
* @return {*}
|
|
2514
|
+
* @returns {*} - The value for the component.
|
|
2260
2515
|
*/
|
|
2261
2516
|
getValue() {
|
|
2262
2517
|
if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
@@ -2278,9 +2533,8 @@ class Component extends Element_1.default {
|
|
|
2278
2533
|
}
|
|
2279
2534
|
/**
|
|
2280
2535
|
* Get the value at a specific index.
|
|
2281
|
-
*
|
|
2282
|
-
* @
|
|
2283
|
-
* @returns {*}
|
|
2536
|
+
* @param {number} index - For an array component or multiple values, this returns the value at a specific index.
|
|
2537
|
+
* @returns {*} - The value at the specified index.
|
|
2284
2538
|
*/
|
|
2285
2539
|
getValueAt(index) {
|
|
2286
2540
|
const input = this.performInputMapping(this.refs.input[index]);
|
|
@@ -2288,11 +2542,9 @@ class Component extends Element_1.default {
|
|
|
2288
2542
|
}
|
|
2289
2543
|
/**
|
|
2290
2544
|
* Set the value of this component.
|
|
2291
|
-
*
|
|
2292
|
-
* @param value
|
|
2293
|
-
* @
|
|
2294
|
-
*
|
|
2295
|
-
* @return {boolean} - If the value changed.
|
|
2545
|
+
* @param {*} value - The value to set for this component.
|
|
2546
|
+
* @param {*} flags - The flags to use when setting the value.
|
|
2547
|
+
* @returns {boolean} - If the value changed.
|
|
2296
2548
|
*/
|
|
2297
2549
|
setValue(value, flags = {}) {
|
|
2298
2550
|
const changed = this.updateValue(value, flags);
|
|
@@ -2323,9 +2575,9 @@ class Component extends Element_1.default {
|
|
|
2323
2575
|
}
|
|
2324
2576
|
/**
|
|
2325
2577
|
* Set the value at a specific index.
|
|
2326
|
-
*
|
|
2327
|
-
* @param index
|
|
2328
|
-
* @param value
|
|
2578
|
+
* @param {number} index - The index to set the value at.
|
|
2579
|
+
* @param {*} value - The value to set at the specified index.
|
|
2580
|
+
* @param {*} flags - The flags to use when setting the value.
|
|
2329
2581
|
*/
|
|
2330
2582
|
setValueAt(index, value, flags = {}) {
|
|
2331
2583
|
if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
|
|
@@ -2372,9 +2624,8 @@ class Component extends Element_1.default {
|
|
|
2372
2624
|
}
|
|
2373
2625
|
/**
|
|
2374
2626
|
* Normalize values coming into updateValue.
|
|
2375
|
-
*
|
|
2376
|
-
* @
|
|
2377
|
-
* @return {*}
|
|
2627
|
+
* @param {*} value - The value to normalize before setting.
|
|
2628
|
+
* @returns {*} - The normalized value.
|
|
2378
2629
|
*/
|
|
2379
2630
|
normalizeValue(value) {
|
|
2380
2631
|
if (this.component.multiple && !Array.isArray(value)) {
|
|
@@ -2384,8 +2635,9 @@ class Component extends Element_1.default {
|
|
|
2384
2635
|
}
|
|
2385
2636
|
/**
|
|
2386
2637
|
* Update a value of this component.
|
|
2387
|
-
*
|
|
2388
|
-
* @param flags
|
|
2638
|
+
* @param {*} value - The value to update.
|
|
2639
|
+
* @param {*} flags - The flags to use when updating the value.
|
|
2640
|
+
* @returns {boolean} - If the value changed.
|
|
2389
2641
|
*/
|
|
2390
2642
|
updateComponentValue(value, flags = {}) {
|
|
2391
2643
|
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
@@ -2404,9 +2656,8 @@ class Component extends Element_1.default {
|
|
|
2404
2656
|
}
|
|
2405
2657
|
/**
|
|
2406
2658
|
* Updates the value of this component plus all sub-components.
|
|
2407
|
-
*
|
|
2408
|
-
* @
|
|
2409
|
-
* @return {boolean}
|
|
2659
|
+
* @param {...any} args - The arguments to pass to updateValue.
|
|
2660
|
+
* @returns {boolean} - If the value changed.
|
|
2410
2661
|
*/
|
|
2411
2662
|
updateValue(...args) {
|
|
2412
2663
|
return this.updateComponentValue(...args);
|
|
@@ -2424,7 +2675,7 @@ class Component extends Element_1.default {
|
|
|
2424
2675
|
*/
|
|
2425
2676
|
resetValue() {
|
|
2426
2677
|
this.unset();
|
|
2427
|
-
this.setValue(this.emptyValue, {
|
|
2678
|
+
this.setValue(this.defaultValue || this.emptyValue, {
|
|
2428
2679
|
noUpdateEvent: true,
|
|
2429
2680
|
noValidate: true,
|
|
2430
2681
|
resetValue: true
|
|
@@ -2432,10 +2683,9 @@ class Component extends Element_1.default {
|
|
|
2432
2683
|
}
|
|
2433
2684
|
/**
|
|
2434
2685
|
* Determine if the value of this component has changed.
|
|
2435
|
-
*
|
|
2436
|
-
* @param
|
|
2437
|
-
* @
|
|
2438
|
-
* @return {boolean}
|
|
2686
|
+
* @param {*} newValue - The new value to check.
|
|
2687
|
+
* @param {*} oldValue - The existing value of the component.
|
|
2688
|
+
* @returns {boolean} - TRUE if the value has changed.
|
|
2439
2689
|
*/
|
|
2440
2690
|
hasChanged(newValue, oldValue) {
|
|
2441
2691
|
if (((newValue === undefined) || (newValue === null)) &&
|
|
@@ -2453,8 +2703,9 @@ class Component extends Element_1.default {
|
|
|
2453
2703
|
}
|
|
2454
2704
|
/**
|
|
2455
2705
|
* Update the value on change.
|
|
2456
|
-
*
|
|
2457
|
-
* @param
|
|
2706
|
+
* @param {*} flags - The flags to use when triggering the on change event.
|
|
2707
|
+
* @param {boolean} changed - If the value has changed.
|
|
2708
|
+
* @returns {boolean} - If the value changed.
|
|
2458
2709
|
*/
|
|
2459
2710
|
updateOnChange(flags = {}, changed = false) {
|
|
2460
2711
|
if (!flags.noUpdateEvent && changed) {
|
|
@@ -2467,13 +2718,6 @@ class Component extends Element_1.default {
|
|
|
2467
2718
|
}
|
|
2468
2719
|
return false;
|
|
2469
2720
|
}
|
|
2470
|
-
/**
|
|
2471
|
-
* Perform a calculated value operation.
|
|
2472
|
-
*
|
|
2473
|
-
* @param data - The global data object.
|
|
2474
|
-
*
|
|
2475
|
-
* @return {boolean} - If the value changed during calculation.
|
|
2476
|
-
*/
|
|
2477
2721
|
convertNumberOrBoolToString(value) {
|
|
2478
2722
|
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
2479
2723
|
return value.toString();
|
|
@@ -2582,9 +2826,10 @@ class Component extends Element_1.default {
|
|
|
2582
2826
|
/* eslint-enable max-statements */
|
|
2583
2827
|
/**
|
|
2584
2828
|
* Performs calculations in this component plus any child components.
|
|
2585
|
-
*
|
|
2586
|
-
* @param
|
|
2587
|
-
* @
|
|
2829
|
+
* @param {*} data - The data to perform the calculation with.
|
|
2830
|
+
* @param {*} flags - The flags to use when calculating the value.
|
|
2831
|
+
* @param {*} row - The contextual row data to use when performing the calculation.
|
|
2832
|
+
* @returns {boolean} - TRUE if the value changed.
|
|
2588
2833
|
*/
|
|
2589
2834
|
calculateValue(data, flags, row) {
|
|
2590
2835
|
data = data || this.rootValue;
|
|
@@ -2594,15 +2839,14 @@ class Component extends Element_1.default {
|
|
|
2594
2839
|
}
|
|
2595
2840
|
/**
|
|
2596
2841
|
* Get this component's label text.
|
|
2597
|
-
*
|
|
2842
|
+
* @returns {string} - The label text for this component.
|
|
2598
2843
|
*/
|
|
2599
2844
|
get label() {
|
|
2600
2845
|
return this.component.label;
|
|
2601
2846
|
}
|
|
2602
2847
|
/**
|
|
2603
2848
|
* Set this component's label text and render it.
|
|
2604
|
-
*
|
|
2605
|
-
* @param value - The new label text.
|
|
2849
|
+
* @param {string} value - The new label text.
|
|
2606
2850
|
*/
|
|
2607
2851
|
set label(value) {
|
|
2608
2852
|
this.component.label = value;
|
|
@@ -2612,17 +2856,18 @@ class Component extends Element_1.default {
|
|
|
2612
2856
|
}
|
|
2613
2857
|
/**
|
|
2614
2858
|
* Get FormioForm element at the root of this component tree.
|
|
2615
|
-
*
|
|
2859
|
+
* @returns {*} root - The root component to search from.
|
|
2616
2860
|
*/
|
|
2617
2861
|
getRoot() {
|
|
2618
2862
|
return this.root;
|
|
2619
2863
|
}
|
|
2620
2864
|
/**
|
|
2621
2865
|
* Returns the invalid message, or empty string if the component is valid.
|
|
2622
|
-
*
|
|
2623
|
-
* @param
|
|
2624
|
-
* @param
|
|
2625
|
-
* @
|
|
2866
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2867
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2868
|
+
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
|
2869
|
+
* @param {*} row - Contextual row data for this component.
|
|
2870
|
+
* @returns {string} - The message to show when the component is invalid.
|
|
2626
2871
|
*/
|
|
2627
2872
|
invalidMessage(data, dirty, ignoreCondition, row) {
|
|
2628
2873
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
|
@@ -2654,10 +2899,9 @@ class Component extends Element_1.default {
|
|
|
2654
2899
|
}
|
|
2655
2900
|
/**
|
|
2656
2901
|
* Returns if the component is valid or not.
|
|
2657
|
-
*
|
|
2658
|
-
* @param
|
|
2659
|
-
* @
|
|
2660
|
-
* @return {boolean}
|
|
2902
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2903
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2904
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2661
2905
|
*/
|
|
2662
2906
|
isValid(data, dirty) {
|
|
2663
2907
|
return !this.invalidMessage(data, dirty);
|
|
@@ -2676,8 +2920,8 @@ class Component extends Element_1.default {
|
|
|
2676
2920
|
}
|
|
2677
2921
|
/**
|
|
2678
2922
|
* Interpolate errors from the validation methods.
|
|
2679
|
-
* @param {
|
|
2680
|
-
* @returns
|
|
2923
|
+
* @param {Array<any>} errors - An array of errors to interpolate.
|
|
2924
|
+
* @returns {Array<any>} - The interpolated errors.
|
|
2681
2925
|
*/
|
|
2682
2926
|
interpolateErrors(errors) {
|
|
2683
2927
|
var _a;
|
|
@@ -2690,7 +2934,7 @@ class Component extends Element_1.default {
|
|
|
2690
2934
|
* @param {*} data - The root submission data.
|
|
2691
2935
|
* @param {*} row - The contextual row data.
|
|
2692
2936
|
* @param {*} flags - The flags to perform validation.
|
|
2693
|
-
* @returns
|
|
2937
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2694
2938
|
*/
|
|
2695
2939
|
showValidationErrors(errors, data, row, flags) {
|
|
2696
2940
|
if (flags.silentCheck) {
|
|
@@ -2710,9 +2954,9 @@ class Component extends Element_1.default {
|
|
|
2710
2954
|
* @param {*} data - The root data you wish to use for this component.
|
|
2711
2955
|
* @param {*} row - The contextual row data you wish to use for this component.
|
|
2712
2956
|
* @param {*} flags - The flags to control the behavior of the validation.
|
|
2713
|
-
* @returns
|
|
2957
|
+
* @returns {Array<any>} - An array of errors if the component is invalid.
|
|
2714
2958
|
*/
|
|
2715
|
-
validateComponent(data, row, flags = {}) {
|
|
2959
|
+
validateComponent(data = null, row = null, flags = {}) {
|
|
2716
2960
|
data = data || this.rootValue;
|
|
2717
2961
|
row = row || this.data;
|
|
2718
2962
|
const { async = false } = flags;
|
|
@@ -2743,13 +2987,14 @@ class Component extends Element_1.default {
|
|
|
2743
2987
|
}
|
|
2744
2988
|
/**
|
|
2745
2989
|
* Checks the validity of this component and sets the error message if it is invalid.
|
|
2746
|
-
*
|
|
2747
|
-
* @param
|
|
2748
|
-
* @param
|
|
2749
|
-
* @param
|
|
2750
|
-
* @
|
|
2751
|
-
|
|
2752
|
-
|
|
2990
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2991
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2992
|
+
* @param {*} row - The contextual row data for this component.
|
|
2993
|
+
* @param {*} flags - The flags to use when checking the validity.
|
|
2994
|
+
* @param {Array<any>} allErrors - An array of all errors that have occured so that it can be appended when another one occurs here.
|
|
2995
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2996
|
+
*/
|
|
2997
|
+
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
2753
2998
|
data = data || this.rootValue;
|
|
2754
2999
|
row = row || this.data;
|
|
2755
3000
|
flags.dirty = dirty || false;
|
|
@@ -2785,32 +3030,30 @@ class Component extends Element_1.default {
|
|
|
2785
3030
|
}
|
|
2786
3031
|
/**
|
|
2787
3032
|
* Checks the validity of the component.
|
|
2788
|
-
* @param {*} data
|
|
2789
|
-
* @param {
|
|
2790
|
-
* @param {*} row
|
|
2791
|
-
* @param {
|
|
2792
|
-
* @
|
|
2793
|
-
|
|
2794
|
-
|
|
3033
|
+
* @param {*} data - The data to check if the component is valid.
|
|
3034
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
3035
|
+
* @param {*} row - The contextual row data for this component.
|
|
3036
|
+
* @param {boolean} silentCheck - If the check should be silent and not set the error messages.
|
|
3037
|
+
* @param {Array<any>} errors - An array of all errors that have occured so that it can be appended when another one occurs here.
|
|
3038
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
3039
|
+
*/
|
|
3040
|
+
checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2795
3041
|
data = data || this.rootValue;
|
|
2796
3042
|
row = row || this.data;
|
|
2797
|
-
console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
2798
3043
|
return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
|
|
2799
3044
|
}
|
|
2800
|
-
checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
|
|
2801
|
-
console.log('Deprecation warning: Component.checkAsyncValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3045
|
+
checkAsyncValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2802
3046
|
return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
|
|
2803
3047
|
}
|
|
2804
3048
|
/**
|
|
2805
3049
|
* Check the conditions, calculations, and validity of a single component and triggers an update if
|
|
2806
3050
|
* something changed.
|
|
2807
|
-
*
|
|
2808
|
-
* @param
|
|
2809
|
-
* @param
|
|
2810
|
-
*
|
|
2811
|
-
* @return boolean - If component is valid or not.
|
|
3051
|
+
* @param {*} data - The root data of the change event.
|
|
3052
|
+
* @param {*} flags - The flags from this change event.
|
|
3053
|
+
* @param {*} row - The contextual row data for this component.
|
|
3054
|
+
* @returns {void|boolean} - TRUE if no check should be performed on the component.
|
|
2812
3055
|
*/
|
|
2813
|
-
checkData(data, flags, row) {
|
|
3056
|
+
checkData(data = null, flags = null, row = null) {
|
|
2814
3057
|
data = data || this.rootValue;
|
|
2815
3058
|
flags = flags || {};
|
|
2816
3059
|
row = row || this.data;
|
|
@@ -2853,8 +3096,7 @@ class Component extends Element_1.default {
|
|
|
2853
3096
|
}
|
|
2854
3097
|
/**
|
|
2855
3098
|
* Check if a component is eligible for multiple validation
|
|
2856
|
-
*
|
|
2857
|
-
* @return {boolean}
|
|
3099
|
+
* @returns {boolean} - TRUE if the component is eligible for multiple validation.
|
|
2858
3100
|
*/
|
|
2859
3101
|
validateMultiple() {
|
|
2860
3102
|
return true;
|
|
@@ -2974,8 +3216,7 @@ class Component extends Element_1.default {
|
|
|
2974
3216
|
/**
|
|
2975
3217
|
* Determines if the value of this component is hidden from the user as if it is coming from the server, but is
|
|
2976
3218
|
* protected.
|
|
2977
|
-
*
|
|
2978
|
-
* @return {boolean|*}
|
|
3219
|
+
* @returns {boolean|*} - TRUE if the value is hidden.
|
|
2979
3220
|
*/
|
|
2980
3221
|
isValueHidden() {
|
|
2981
3222
|
if (this.component.protected && this.root.editing) {
|
|
@@ -3020,6 +3261,8 @@ class Component extends Element_1.default {
|
|
|
3020
3261
|
}
|
|
3021
3262
|
/**
|
|
3022
3263
|
* Prints out the value of this component as a string value.
|
|
3264
|
+
* @param {*} value - The value to print out.
|
|
3265
|
+
* @returns {string} - The string representation of the value.
|
|
3023
3266
|
*/
|
|
3024
3267
|
asString(value) {
|
|
3025
3268
|
value = value || this.getValue();
|
|
@@ -3027,15 +3270,14 @@ class Component extends Element_1.default {
|
|
|
3027
3270
|
}
|
|
3028
3271
|
/**
|
|
3029
3272
|
* Return if the component is disabled.
|
|
3030
|
-
* @
|
|
3273
|
+
* @returns {boolean} - TRUE if the component is disabled.
|
|
3031
3274
|
*/
|
|
3032
3275
|
get disabled() {
|
|
3033
3276
|
return this._disabled || this.parentDisabled;
|
|
3034
3277
|
}
|
|
3035
3278
|
/**
|
|
3036
3279
|
* Disable this component.
|
|
3037
|
-
*
|
|
3038
|
-
* @param {boolean} disabled
|
|
3280
|
+
* @param {boolean} disabled - TRUE to disable the component.
|
|
3039
3281
|
*/
|
|
3040
3282
|
set disabled(disabled) {
|
|
3041
3283
|
this._disabled = disabled;
|
|
@@ -3160,6 +3402,7 @@ class Component extends Element_1.default {
|
|
|
3160
3402
|
}
|
|
3161
3403
|
/**
|
|
3162
3404
|
* Get the element information.
|
|
3405
|
+
* @returns {*} - The components "input" DOM element information.
|
|
3163
3406
|
*/
|
|
3164
3407
|
elementInfo() {
|
|
3165
3408
|
const attributes = {
|
|
@@ -3198,15 +3441,13 @@ class Component extends Element_1.default {
|
|
|
3198
3441
|
const { left, top } = element.getBoundingClientRect();
|
|
3199
3442
|
window.scrollTo(left + window.scrollX, top + window.scrollY);
|
|
3200
3443
|
}
|
|
3201
|
-
focus(index) {
|
|
3444
|
+
focus(index = (this.refs.input.length - 1)) {
|
|
3202
3445
|
var _a, _b;
|
|
3203
3446
|
if ('beforeFocus' in this.parent) {
|
|
3204
3447
|
this.parent.beforeFocus(this);
|
|
3205
3448
|
}
|
|
3206
3449
|
if ((_a = this.refs.input) === null || _a === void 0 ? void 0 : _a.length) {
|
|
3207
|
-
const focusingInput =
|
|
3208
|
-
? this.refs.input[index]
|
|
3209
|
-
: this.refs.input[this.refs.input.length - 1];
|
|
3450
|
+
const focusingInput = this.refs.input[index];
|
|
3210
3451
|
if (((_b = this.component.widget) === null || _b === void 0 ? void 0 : _b.type) === 'calendar') {
|
|
3211
3452
|
const sibling = focusingInput.nextSibling;
|
|
3212
3453
|
if (sibling) {
|
|
@@ -3226,6 +3467,7 @@ class Component extends Element_1.default {
|
|
|
3226
3467
|
}
|
|
3227
3468
|
/**
|
|
3228
3469
|
* Get `Formio` instance for working with files
|
|
3470
|
+
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
|
3229
3471
|
*/
|
|
3230
3472
|
get fileService() {
|
|
3231
3473
|
if (this.options.fileService) {
|