@formio/js 5.0.0-dev.5633.53931b9 → 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 +180 -139
- package/lib/cjs/Webform.js +308 -295
- 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 +502 -269
- 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 +435 -191
- 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 +31 -20
- package/lib/cjs/components/form/Form.form.d.ts +6 -3
- package/lib/cjs/components/form/Form.form.js +5 -0
- package/lib/cjs/components/form/Form.js +13 -10
- package/lib/cjs/components/hidden/Hidden.d.ts +1 -11
- package/lib/cjs/components/hidden/Hidden.form.d.ts +6 -3
- package/lib/cjs/components/hidden/Hidden.form.js +5 -0
- package/lib/cjs/components/hidden/Hidden.js +1 -2
- package/lib/cjs/components/html/HTML.d.ts +2 -1
- package/lib/cjs/components/html/HTML.form.d.ts +6 -3
- package/lib/cjs/components/html/HTML.form.js +5 -0
- package/lib/cjs/components/number/Number.d.ts +3 -17
- package/lib/cjs/components/number/Number.form.d.ts +6 -3
- package/lib/cjs/components/number/Number.form.js +5 -0
- package/lib/cjs/components/number/Number.js +1 -2
- package/lib/cjs/components/panel/Panel.form.d.ts +6 -3
- package/lib/cjs/components/panel/Panel.form.js +5 -0
- package/lib/cjs/components/panel/Panel.js +0 -1
- package/lib/cjs/components/password/Password.form.d.ts +6 -3
- package/lib/cjs/components/password/Password.form.js +5 -0
- package/lib/cjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +5 -0
- package/lib/cjs/components/radio/Radio.d.ts +3 -26
- package/lib/cjs/components/radio/Radio.form.d.ts +6 -3
- package/lib/cjs/components/radio/Radio.form.js +5 -0
- package/lib/cjs/components/radio/Radio.js +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 +180 -139
- package/lib/mjs/Webform.js +320 -307
- 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 +502 -269
- 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 +435 -191
- 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 +31 -20
- package/lib/mjs/components/form/Form.form.d.ts +6 -3
- package/lib/mjs/components/form/Form.form.js +5 -0
- package/lib/mjs/components/form/Form.js +13 -10
- package/lib/mjs/components/hidden/Hidden.d.ts +1 -11
- package/lib/mjs/components/hidden/Hidden.form.d.ts +6 -3
- package/lib/mjs/components/hidden/Hidden.form.js +5 -0
- package/lib/mjs/components/hidden/Hidden.js +1 -2
- package/lib/mjs/components/html/HTML.d.ts +2 -1
- package/lib/mjs/components/html/HTML.form.d.ts +6 -3
- package/lib/mjs/components/html/HTML.form.js +5 -0
- package/lib/mjs/components/number/Number.d.ts +3 -17
- package/lib/mjs/components/number/Number.form.d.ts +6 -3
- package/lib/mjs/components/number/Number.form.js +5 -0
- package/lib/mjs/components/number/Number.js +1 -2
- package/lib/mjs/components/panel/Panel.form.d.ts +6 -3
- package/lib/mjs/components/panel/Panel.form.js +5 -0
- package/lib/mjs/components/panel/Panel.js +0 -1
- package/lib/mjs/components/password/Password.form.d.ts +6 -3
- package/lib/mjs/components/password/Password.form.js +5 -0
- package/lib/mjs/components/phonenumber/PhoneNumber.form.d.ts +6 -3
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +5 -0
- package/lib/mjs/components/radio/Radio.d.ts +3 -26
- package/lib/mjs/components/radio/Radio.form.d.ts +6 -3
- package/lib/mjs/components/radio/Radio.form.js +5 -0
- package/lib/mjs/components/radio/Radio.js +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,17 +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
1051
|
* @param {object|null|undefined} ctx - The rendering context
|
|
1035
|
-
* @return {string}
|
|
1052
|
+
* @return {string} - The modal preview markup
|
|
1036
1053
|
*/
|
|
1037
1054
|
renderModalPreview(ctx) {
|
|
1038
1055
|
return this.renderTemplate('modalPreview', ctx || {});
|
|
1039
1056
|
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Returns the modal preview template.
|
|
1059
|
+
* @returns {string} - The modal preview template.
|
|
1060
|
+
*/
|
|
1040
1061
|
getModalPreviewTemplate() {
|
|
1041
1062
|
var _a;
|
|
1042
1063
|
const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
|
|
@@ -1050,6 +1071,11 @@ class Component extends Element_1.default {
|
|
|
1050
1071
|
labelInfo: modalLabel,
|
|
1051
1072
|
});
|
|
1052
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
|
+
*/
|
|
1053
1079
|
build(element) {
|
|
1054
1080
|
element = element || this.element;
|
|
1055
1081
|
this.empty(element);
|
|
@@ -1059,6 +1085,12 @@ class Component extends Element_1.default {
|
|
|
1059
1085
|
get hasModalSaveButton() {
|
|
1060
1086
|
return true;
|
|
1061
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
|
+
*/
|
|
1062
1094
|
render(children = `Unknown component: ${this.component.type}`, topLevel = false) {
|
|
1063
1095
|
const isVisible = this.visible;
|
|
1064
1096
|
this.rendered = true;
|
|
@@ -1095,6 +1127,11 @@ class Component extends Element_1.default {
|
|
|
1095
1127
|
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1096
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 }) }));
|
|
1097
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
|
+
*/
|
|
1098
1135
|
attachTooltips(toolTipsRefs) {
|
|
1099
1136
|
toolTipsRefs === null || toolTipsRefs === void 0 ? void 0 : toolTipsRefs.forEach((tooltip, index) => {
|
|
1100
1137
|
if (tooltip) {
|
|
@@ -1102,9 +1139,21 @@ class Component extends Element_1.default {
|
|
|
1102
1139
|
}
|
|
1103
1140
|
});
|
|
1104
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
|
+
*/
|
|
1105
1149
|
createComponentModal(element, modalShouldBeOpened, currentValue) {
|
|
1106
1150
|
return new ComponentModal_1.default(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
|
|
1107
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
|
+
*/
|
|
1108
1157
|
attach(element) {
|
|
1109
1158
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
1110
1159
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
@@ -1142,6 +1191,9 @@ class Component extends Element_1.default {
|
|
|
1142
1191
|
this.addons.forEach((addon) => addon.attach(element));
|
|
1143
1192
|
return Promise.resolve();
|
|
1144
1193
|
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Restors the "focus" on a component after a redraw event has occured.
|
|
1196
|
+
*/
|
|
1145
1197
|
restoreFocus() {
|
|
1146
1198
|
var _a, _b, _c;
|
|
1147
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;
|
|
@@ -1151,6 +1203,12 @@ class Component extends Element_1.default {
|
|
|
1151
1203
|
this.restoreCaretPosition();
|
|
1152
1204
|
}
|
|
1153
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
|
+
*/
|
|
1154
1212
|
addShortcut(element, shortcut) {
|
|
1155
1213
|
// Avoid infinite recursion.
|
|
1156
1214
|
if (!element || !this.root || (this.root === this)) {
|
|
@@ -1161,6 +1219,12 @@ class Component extends Element_1.default {
|
|
|
1161
1219
|
}
|
|
1162
1220
|
this.root.addShortcut(element, shortcut);
|
|
1163
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
|
+
*/
|
|
1164
1228
|
removeShortcut(element, shortcut) {
|
|
1165
1229
|
// Avoid infinite recursion.
|
|
1166
1230
|
if (!element || (this.root === this)) {
|
|
@@ -1193,6 +1257,13 @@ class Component extends Element_1.default {
|
|
|
1193
1257
|
this.tooltip.destroy();
|
|
1194
1258
|
}
|
|
1195
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
|
+
*/
|
|
1196
1267
|
checkRefresh(refreshData, changed, flags) {
|
|
1197
1268
|
const changePath = lodash_1.default.get(changed, 'instance.path', false);
|
|
1198
1269
|
// Don't let components change themselves.
|
|
@@ -1209,6 +1280,12 @@ class Component extends Element_1.default {
|
|
|
1209
1280
|
this.refresh(changed.value, changed, flags);
|
|
1210
1281
|
}
|
|
1211
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
|
+
*/
|
|
1212
1289
|
checkRefreshOn(changes, flags = {}) {
|
|
1213
1290
|
changes = changes || [];
|
|
1214
1291
|
if (flags.noRefresh) {
|
|
@@ -1230,8 +1307,8 @@ class Component extends Element_1.default {
|
|
|
1230
1307
|
}
|
|
1231
1308
|
/**
|
|
1232
1309
|
* Refreshes the component with a new value.
|
|
1233
|
-
*
|
|
1234
|
-
* @
|
|
1310
|
+
* @param {any} value - The latest value of the component to check if it needs to be refreshed.
|
|
1311
|
+
* @returns {void}
|
|
1235
1312
|
*/
|
|
1236
1313
|
refresh(value) {
|
|
1237
1314
|
if (this.hasOwnProperty('refreshOnValue')) {
|
|
@@ -1254,8 +1331,8 @@ class Component extends Element_1.default {
|
|
|
1254
1331
|
* with the components data and returns true if they are in the same context.
|
|
1255
1332
|
*
|
|
1256
1333
|
* Different rows of the same EditGrid, for example, are in different contexts.
|
|
1257
|
-
*
|
|
1258
|
-
* @
|
|
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.
|
|
1259
1336
|
*/
|
|
1260
1337
|
inContext(component) {
|
|
1261
1338
|
if (component.data === this.data) {
|
|
@@ -1270,9 +1347,18 @@ class Component extends Element_1.default {
|
|
|
1270
1347
|
}
|
|
1271
1348
|
return false;
|
|
1272
1349
|
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Determines if we are in "view" only mode.
|
|
1352
|
+
* @returns {boolean} - TRUE if we are in "view" only mode.
|
|
1353
|
+
*/
|
|
1273
1354
|
get viewOnly() {
|
|
1274
1355
|
return this.options.readOnly && this.options.viewAsHtml;
|
|
1275
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
|
+
*/
|
|
1276
1362
|
setElement(element) {
|
|
1277
1363
|
if (this.element) {
|
|
1278
1364
|
delete this.element.component;
|
|
@@ -1280,6 +1366,10 @@ class Component extends Element_1.default {
|
|
|
1280
1366
|
}
|
|
1281
1367
|
this.element = element;
|
|
1282
1368
|
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Creates an element to hold the "view only" version of this component.
|
|
1371
|
+
* @returns {HTMLElement} - The element for this component.
|
|
1372
|
+
*/
|
|
1283
1373
|
createViewOnlyElement() {
|
|
1284
1374
|
this.setElement(this.ce('dl', {
|
|
1285
1375
|
id: this.id
|
|
@@ -1290,14 +1380,18 @@ class Component extends Element_1.default {
|
|
|
1290
1380
|
}
|
|
1291
1381
|
return this.element;
|
|
1292
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
|
+
*/
|
|
1293
1387
|
get defaultViewOnlyValue() {
|
|
1294
1388
|
return '-';
|
|
1295
1389
|
}
|
|
1296
1390
|
/**
|
|
1297
1391
|
* Uses the widget to determine the output string.
|
|
1298
|
-
*
|
|
1299
|
-
* @param
|
|
1300
|
-
* @
|
|
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.
|
|
1301
1395
|
*/
|
|
1302
1396
|
getWidgetValueAsString(value, options) {
|
|
1303
1397
|
const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
|
|
@@ -1322,6 +1416,12 @@ class Component extends Element_1.default {
|
|
|
1322
1416
|
const widget = this.refs.input[0].widget;
|
|
1323
1417
|
return widget.getValueAsString(value, options);
|
|
1324
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
|
+
*/
|
|
1325
1425
|
getValueAsString(value, options) {
|
|
1326
1426
|
if (!value) {
|
|
1327
1427
|
return '';
|
|
@@ -1339,20 +1439,32 @@ class Component extends Element_1.default {
|
|
|
1339
1439
|
const stringValue = value.toString();
|
|
1340
1440
|
return this.sanitize(stringValue);
|
|
1341
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
|
+
*/
|
|
1342
1448
|
getView(value, options) {
|
|
1343
1449
|
if (this.component.protected) {
|
|
1344
1450
|
return '--- PROTECTED ---';
|
|
1345
1451
|
}
|
|
1346
1452
|
return this.getValueAsString(value, options);
|
|
1347
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
|
+
*/
|
|
1348
1459
|
updateItems(...args) {
|
|
1349
1460
|
this.restoreValue();
|
|
1350
1461
|
this.onChange(...args);
|
|
1351
1462
|
}
|
|
1352
1463
|
/**
|
|
1353
|
-
*
|
|
1354
|
-
* @param {
|
|
1355
|
-
* @
|
|
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.
|
|
1356
1468
|
*/
|
|
1357
1469
|
itemValue(data, forceUseValue = false) {
|
|
1358
1470
|
if (lodash_1.default.isObject(data) && !lodash_1.default.isArray(data)) {
|
|
@@ -1365,6 +1477,11 @@ class Component extends Element_1.default {
|
|
|
1365
1477
|
}
|
|
1366
1478
|
return data;
|
|
1367
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
|
+
*/
|
|
1368
1485
|
itemValueForHTMLMode(value) {
|
|
1369
1486
|
if (Array.isArray(value)) {
|
|
1370
1487
|
const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
@@ -1372,6 +1489,13 @@ class Component extends Element_1.default {
|
|
|
1372
1489
|
}
|
|
1373
1490
|
return this.itemValue(value);
|
|
1374
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
|
+
*/
|
|
1375
1499
|
createModal(element, attr, confirm) {
|
|
1376
1500
|
const dialog = this.ce('div', attr || {});
|
|
1377
1501
|
this.setContent(dialog, this.renderTemplate('dialog'));
|
|
@@ -1407,6 +1531,10 @@ class Component extends Element_1.default {
|
|
|
1407
1531
|
this.addEventListener(dialog.refs.dialogClose, 'click', handleCloseClick);
|
|
1408
1532
|
return dialog;
|
|
1409
1533
|
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Uses CSS classes to show or hide an element.
|
|
1536
|
+
* @returns {boolean} - TRUE if the element has been css removed.
|
|
1537
|
+
*/
|
|
1410
1538
|
get optimizeRedraw() {
|
|
1411
1539
|
if (this.options.optimizeRedraw && this.element && !this.visible) {
|
|
1412
1540
|
this.addClass(this.element, 'formio-removed');
|
|
@@ -1444,7 +1572,7 @@ class Component extends Element_1.default {
|
|
|
1444
1572
|
}
|
|
1445
1573
|
/**
|
|
1446
1574
|
* Build the custom style from the layout values
|
|
1447
|
-
* @
|
|
1575
|
+
* @returns {string} - The custom style
|
|
1448
1576
|
*/
|
|
1449
1577
|
get customStyle() {
|
|
1450
1578
|
let customCSS = '';
|
|
@@ -1455,24 +1583,31 @@ class Component extends Element_1.default {
|
|
|
1455
1583
|
});
|
|
1456
1584
|
return customCSS;
|
|
1457
1585
|
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Returns the component condition operator settings if available.
|
|
1588
|
+
* @returns {object} - The component condition operator settings.
|
|
1589
|
+
*/
|
|
1458
1590
|
static get serverConditionSettings() {
|
|
1459
1591
|
return Component.conditionOperatorsSettings;
|
|
1460
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
|
+
*/
|
|
1461
1597
|
get isMobile() {
|
|
1462
1598
|
return (0, ismobilejs_1.default)();
|
|
1463
1599
|
}
|
|
1464
1600
|
/**
|
|
1465
1601
|
* Returns the outside wrapping element of this component.
|
|
1466
|
-
* @returns {HTMLElement}
|
|
1602
|
+
* @returns {HTMLElement} - The wrapping element of this component.
|
|
1467
1603
|
*/
|
|
1468
1604
|
getElement() {
|
|
1469
1605
|
return this.element;
|
|
1470
1606
|
}
|
|
1471
1607
|
/**
|
|
1472
1608
|
* Create an evaluation context for all script executions and interpolations.
|
|
1473
|
-
*
|
|
1474
|
-
* @
|
|
1475
|
-
* @return {*}
|
|
1609
|
+
* @param {any} additional - Additional context to provide.
|
|
1610
|
+
* @returns {any} - The evaluation context.
|
|
1476
1611
|
*/
|
|
1477
1612
|
evalContext(additional) {
|
|
1478
1613
|
return super.evalContext(Object.assign({
|
|
@@ -1494,18 +1629,29 @@ class Component extends Element_1.default {
|
|
|
1494
1629
|
}
|
|
1495
1630
|
/**
|
|
1496
1631
|
* Sets the pristine flag for this component.
|
|
1497
|
-
*
|
|
1498
|
-
* @param pristine {boolean} - TRUE to make pristine, FALSE not pristine.
|
|
1632
|
+
* @param {boolean} pristine - TRUE to make pristine, FALSE not pristine.
|
|
1499
1633
|
*/
|
|
1500
1634
|
setPristine(pristine) {
|
|
1501
1635
|
this.pristine = pristine;
|
|
1502
1636
|
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Returns if the component is pristine.
|
|
1639
|
+
* @returns {boolean} - TRUE if the component is pristine.
|
|
1640
|
+
*/
|
|
1503
1641
|
get isPristine() {
|
|
1504
1642
|
return this.pristine;
|
|
1505
1643
|
}
|
|
1644
|
+
/**
|
|
1645
|
+
* Sets the dirty flag for this component.
|
|
1646
|
+
* @param {boolean} dirty - TRUE to make dirty, FALSE not dirty.
|
|
1647
|
+
*/
|
|
1506
1648
|
setDirty(dirty) {
|
|
1507
1649
|
this.dirty = dirty;
|
|
1508
1650
|
}
|
|
1651
|
+
/**
|
|
1652
|
+
* Returns if the component is dirty.
|
|
1653
|
+
* @returns {boolean} - TRUE if the component is dirty.
|
|
1654
|
+
*/
|
|
1509
1655
|
get isDirty() {
|
|
1510
1656
|
return this.dirty;
|
|
1511
1657
|
}
|
|
@@ -1519,12 +1665,23 @@ class Component extends Element_1.default {
|
|
|
1519
1665
|
this.restoreValue();
|
|
1520
1666
|
this.triggerRootChange();
|
|
1521
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
|
+
*/
|
|
1522
1674
|
iconClass(name, spinning) {
|
|
1523
1675
|
const iconset = this.options.iconset || Templates_1.default.current.defaultIconset || 'fa';
|
|
1524
1676
|
return Templates_1.default.current.hasOwnProperty('iconClass')
|
|
1525
1677
|
? Templates_1.default.current.iconClass(iconset, name, spinning)
|
|
1526
1678
|
: this.options.iconset === 'fa' ? Templates_1.default.defaultTemplates.iconClass(iconset, name, spinning) : name;
|
|
1527
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
|
+
*/
|
|
1528
1685
|
size(size) {
|
|
1529
1686
|
return Templates_1.default.current.hasOwnProperty('size')
|
|
1530
1687
|
? Templates_1.default.current.size(size)
|
|
@@ -1537,15 +1694,23 @@ class Component extends Element_1.default {
|
|
|
1537
1694
|
get name() {
|
|
1538
1695
|
return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
|
|
1539
1696
|
}
|
|
1697
|
+
/**
|
|
1698
|
+
* Returns the visible errors for this component.
|
|
1699
|
+
* @returns {Array<object>} - The visible errors for this component.
|
|
1700
|
+
*/
|
|
1540
1701
|
get visibleErrors() {
|
|
1541
1702
|
return this._visibleErrors;
|
|
1542
1703
|
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Returns all the errors for this component, visible or not.
|
|
1706
|
+
* @returns {Array<object>} - All the errors for this component.
|
|
1707
|
+
*/
|
|
1543
1708
|
get errors() {
|
|
1544
1709
|
return this._errors;
|
|
1545
1710
|
}
|
|
1546
1711
|
/**
|
|
1547
1712
|
* Returns the error label for this component.
|
|
1548
|
-
* @
|
|
1713
|
+
* @returns {string} - The error label for this component.
|
|
1549
1714
|
*/
|
|
1550
1715
|
get errorLabel() {
|
|
1551
1716
|
return this.t(this.component.errorLabel
|
|
@@ -1555,12 +1720,20 @@ class Component extends Element_1.default {
|
|
|
1555
1720
|
}
|
|
1556
1721
|
/**
|
|
1557
1722
|
* Get the error message provided a certain type of error.
|
|
1558
|
-
* @param type
|
|
1559
|
-
* @
|
|
1723
|
+
* @param {string} type - The type of error to fetch the message for.
|
|
1724
|
+
* @returns {string} - The error message configured for this component.
|
|
1560
1725
|
*/
|
|
1561
1726
|
errorMessage(type) {
|
|
1562
1727
|
return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
|
|
1563
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
|
+
*/
|
|
1564
1737
|
setContent(element, content, forceSanitize, sanitizeOptions) {
|
|
1565
1738
|
if (element instanceof HTMLElement) {
|
|
1566
1739
|
element.innerHTML = this.sanitize(content, forceSanitize, sanitizeOptions);
|
|
@@ -1568,6 +1741,9 @@ class Component extends Element_1.default {
|
|
|
1568
1741
|
}
|
|
1569
1742
|
return false;
|
|
1570
1743
|
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Restores the caret position in the input element after a refresh occurs.
|
|
1746
|
+
*/
|
|
1571
1747
|
restoreCaretPosition() {
|
|
1572
1748
|
var _a, _b, _c;
|
|
1573
1749
|
if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.currentSelection) {
|
|
@@ -1590,6 +1766,10 @@ class Component extends Element_1.default {
|
|
|
1590
1766
|
}
|
|
1591
1767
|
}
|
|
1592
1768
|
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Redraw the component.
|
|
1771
|
+
* @returns {Promise<void>} - A promise that resolves when the component is done redrawing.
|
|
1772
|
+
*/
|
|
1593
1773
|
redraw() {
|
|
1594
1774
|
// Don't bother if we have not built yet.
|
|
1595
1775
|
if (!this.element || !this.element.parentNode || this.optimizeRedraw) {
|
|
@@ -1605,29 +1785,54 @@ class Component extends Element_1.default {
|
|
|
1605
1785
|
this.setElement(parent.children[index]);
|
|
1606
1786
|
return this.attach(this.element);
|
|
1607
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
|
+
*/
|
|
1608
1792
|
rebuild() {
|
|
1609
1793
|
this.destroy();
|
|
1610
1794
|
this.init();
|
|
1611
1795
|
this.visible = this.conditionallyVisible(null, null);
|
|
1612
1796
|
return this.redraw();
|
|
1613
1797
|
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Removes all event listeners attached to this component.
|
|
1800
|
+
*/
|
|
1614
1801
|
removeEventListeners() {
|
|
1615
1802
|
super.removeEventListeners();
|
|
1616
1803
|
this.tooltips.forEach(tooltip => tooltip.destroy());
|
|
1617
1804
|
this.tooltips = [];
|
|
1618
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
|
+
*/
|
|
1619
1812
|
hasClass(element, className) {
|
|
1620
1813
|
if (!element) {
|
|
1621
1814
|
return;
|
|
1622
1815
|
}
|
|
1623
1816
|
return super.hasClass(element, this.transform('class', className));
|
|
1624
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
|
+
*/
|
|
1625
1824
|
addClass(element, className) {
|
|
1626
1825
|
if (!element) {
|
|
1627
1826
|
return;
|
|
1628
1827
|
}
|
|
1629
1828
|
return super.addClass(element, this.transform('class', className));
|
|
1630
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
|
+
*/
|
|
1631
1836
|
removeClass(element, className) {
|
|
1632
1837
|
if (!element) {
|
|
1633
1838
|
return;
|
|
@@ -1636,8 +1841,7 @@ class Component extends Element_1.default {
|
|
|
1636
1841
|
}
|
|
1637
1842
|
/**
|
|
1638
1843
|
* Determines if this component has a condition defined.
|
|
1639
|
-
*
|
|
1640
|
-
* @return {null}
|
|
1844
|
+
* @returns {boolean} - TRUE if the component has a condition defined.
|
|
1641
1845
|
*/
|
|
1642
1846
|
hasCondition() {
|
|
1643
1847
|
if (this._hasCondition !== null) {
|
|
@@ -1648,9 +1852,9 @@ class Component extends Element_1.default {
|
|
|
1648
1852
|
}
|
|
1649
1853
|
/**
|
|
1650
1854
|
* Check if this component is conditionally visible.
|
|
1651
|
-
*
|
|
1652
|
-
* @param data
|
|
1653
|
-
* @
|
|
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.
|
|
1654
1858
|
*/
|
|
1655
1859
|
conditionallyVisible(data, row) {
|
|
1656
1860
|
data = data || this.rootValue;
|
|
@@ -1665,16 +1869,19 @@ class Component extends Element_1.default {
|
|
|
1665
1869
|
* Checks the condition of this component.
|
|
1666
1870
|
*
|
|
1667
1871
|
* TODO: Switch row and data parameters to be consistent with other methods.
|
|
1668
|
-
*
|
|
1669
|
-
* @param
|
|
1670
|
-
* @
|
|
1671
|
-
* @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.
|
|
1672
1875
|
*/
|
|
1673
1876
|
checkCondition(row, data) {
|
|
1674
1877
|
return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
|
|
1675
1878
|
}
|
|
1676
1879
|
/**
|
|
1677
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.
|
|
1678
1885
|
*/
|
|
1679
1886
|
checkComponentConditions(data, flags, row) {
|
|
1680
1887
|
data = data || this.rootValue;
|
|
@@ -1692,8 +1899,10 @@ class Component extends Element_1.default {
|
|
|
1692
1899
|
}
|
|
1693
1900
|
/**
|
|
1694
1901
|
* Checks conditions for this component and any sub components.
|
|
1695
|
-
* @param
|
|
1696
|
-
* @
|
|
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.
|
|
1697
1906
|
*/
|
|
1698
1907
|
checkConditions(data, flags, row) {
|
|
1699
1908
|
data = data || this.rootValue;
|
|
@@ -1701,17 +1910,20 @@ class Component extends Element_1.default {
|
|
|
1701
1910
|
row = row || this.data;
|
|
1702
1911
|
return this.checkComponentConditions(data, flags, row);
|
|
1703
1912
|
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Returns the component logic if applicable.
|
|
1915
|
+
* @returns {Array<object>} - The component logic.
|
|
1916
|
+
*/
|
|
1704
1917
|
get logic() {
|
|
1705
1918
|
return this.component.logic || [];
|
|
1706
1919
|
}
|
|
1707
1920
|
/**
|
|
1708
1921
|
* Check all triggers and apply necessary actions.
|
|
1709
|
-
*
|
|
1710
|
-
* @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.
|
|
1711
1925
|
*/
|
|
1712
|
-
fieldLogic(data, row) {
|
|
1713
|
-
data = data || this.rootValue;
|
|
1714
|
-
row = row || this.data;
|
|
1926
|
+
fieldLogic(data = this.rootValue, row = this.data) {
|
|
1715
1927
|
const logics = this.logic;
|
|
1716
1928
|
// If there aren't logic, don't go further.
|
|
1717
1929
|
if (logics.length === 0) {
|
|
@@ -1734,6 +1946,10 @@ class Component extends Element_1.default {
|
|
|
1734
1946
|
}
|
|
1735
1947
|
return changed;
|
|
1736
1948
|
}
|
|
1949
|
+
/**
|
|
1950
|
+
* Retuns if the browser is Internet Explorer.
|
|
1951
|
+
* @returns {boolean} - TRUE if the browser is IE.
|
|
1952
|
+
*/
|
|
1737
1953
|
isIE() {
|
|
1738
1954
|
if (typeof window === 'undefined') {
|
|
1739
1955
|
return false;
|
|
@@ -1758,9 +1974,24 @@ class Component extends Element_1.default {
|
|
|
1758
1974
|
// other browser
|
|
1759
1975
|
return false;
|
|
1760
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
|
+
*/
|
|
1761
1983
|
defineActionValue(action, argsObject) {
|
|
1762
1984
|
return this.evaluate(action.value, argsObject, 'value');
|
|
1763
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
|
+
*/
|
|
1764
1995
|
applyActions(newComponent, actions, result, row, data) {
|
|
1765
1996
|
data = data || this.rootValue;
|
|
1766
1997
|
row = row || this.data;
|
|
@@ -1840,8 +2071,8 @@ class Component extends Element_1.default {
|
|
|
1840
2071
|
}
|
|
1841
2072
|
/**
|
|
1842
2073
|
* Add a new input error to this element.
|
|
1843
|
-
*
|
|
1844
|
-
* @
|
|
2074
|
+
* @param {Array<object>|string} messages - An array of messages to add to the element.
|
|
2075
|
+
* @returns {void}
|
|
1845
2076
|
*/
|
|
1846
2077
|
addMessages(messages) {
|
|
1847
2078
|
if (!messages) {
|
|
@@ -1864,6 +2095,15 @@ class Component extends Element_1.default {
|
|
|
1864
2095
|
}).join(''));
|
|
1865
2096
|
}
|
|
1866
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
|
+
*/
|
|
1867
2107
|
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
1868
2108
|
this.clearErrorClasses();
|
|
1869
2109
|
elements.forEach((element) => {
|
|
@@ -1890,6 +2130,12 @@ class Component extends Element_1.default {
|
|
|
1890
2130
|
this.addClass(element, 'has-message');
|
|
1891
2131
|
}
|
|
1892
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
|
+
*/
|
|
1893
2139
|
setElementInvalid(element, invalid) {
|
|
1894
2140
|
if (!element)
|
|
1895
2141
|
return;
|
|
@@ -1901,6 +2147,9 @@ class Component extends Element_1.default {
|
|
|
1901
2147
|
}
|
|
1902
2148
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
|
1903
2149
|
}
|
|
2150
|
+
/**
|
|
2151
|
+
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
|
2152
|
+
*/
|
|
1904
2153
|
clearOnHide() {
|
|
1905
2154
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
1906
2155
|
if (
|
|
@@ -1920,6 +2169,10 @@ class Component extends Element_1.default {
|
|
|
1920
2169
|
}
|
|
1921
2170
|
}
|
|
1922
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
|
+
*/
|
|
1923
2176
|
triggerRootChange(...args) {
|
|
1924
2177
|
if (this.options.onChange) {
|
|
1925
2178
|
this.options.onChange(...args);
|
|
@@ -1928,6 +2181,13 @@ class Component extends Element_1.default {
|
|
|
1928
2181
|
this.root.triggerChange(...args);
|
|
1929
2182
|
}
|
|
1930
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
|
+
*/
|
|
1931
2191
|
onChange(flags, fromRoot) {
|
|
1932
2192
|
flags = flags || {};
|
|
1933
2193
|
if (flags.modified) {
|
|
@@ -2057,7 +2317,7 @@ class Component extends Element_1.default {
|
|
|
2057
2317
|
return Promise.reject();
|
|
2058
2318
|
}
|
|
2059
2319
|
this.quill = new Quill(element, isIEBrowser ? Object.assign(Object.assign({}, settings), { modules: {} }) : settings);
|
|
2060
|
-
/** 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 */
|
|
2061
2321
|
const txtArea = document.createElement('textarea');
|
|
2062
2322
|
txtArea.setAttribute('class', 'quill-source-code');
|
|
2063
2323
|
this.quill.addContainer('ql-custom').appendChild(txtArea);
|
|
@@ -2071,7 +2331,7 @@ class Component extends Element_1.default {
|
|
|
2071
2331
|
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2072
2332
|
});
|
|
2073
2333
|
}
|
|
2074
|
-
/** END CODEBLOCK
|
|
2334
|
+
/** END CODEBLOCK */
|
|
2075
2335
|
// Make sure to select cursor when they click on the element.
|
|
2076
2336
|
this.addEventListener(element, 'click', () => this.quill.focus());
|
|
2077
2337
|
// Allows users to skip toolbar items when tabbing though form
|
|
@@ -2119,23 +2379,22 @@ class Component extends Element_1.default {
|
|
|
2119
2379
|
}
|
|
2120
2380
|
/**
|
|
2121
2381
|
* The empty value for this component.
|
|
2122
|
-
*
|
|
2123
|
-
* @return {null}
|
|
2382
|
+
* @returns {null} - The empty value for this component.
|
|
2124
2383
|
*/
|
|
2125
2384
|
get emptyValue() {
|
|
2126
2385
|
return null;
|
|
2127
2386
|
}
|
|
2128
2387
|
/**
|
|
2129
2388
|
* Returns if this component has a value set.
|
|
2130
|
-
*
|
|
2389
|
+
* @param {any} data - The global data object.
|
|
2390
|
+
* @returns {boolean} - TRUE if a value is set.
|
|
2131
2391
|
*/
|
|
2132
2392
|
hasValue(data) {
|
|
2133
2393
|
return !lodash_1.default.isUndefined(lodash_1.default.get(data || this.data, this.key));
|
|
2134
2394
|
}
|
|
2135
2395
|
/**
|
|
2136
2396
|
* Get the data value at the root level.
|
|
2137
|
-
*
|
|
2138
|
-
* @return {*}
|
|
2397
|
+
* @returns {*} - The root value for the component, typically the Webform data object.
|
|
2139
2398
|
*/
|
|
2140
2399
|
get rootValue() {
|
|
2141
2400
|
return this.root ? this.root.data : this.data;
|
|
@@ -2145,7 +2404,7 @@ class Component extends Element_1.default {
|
|
|
2145
2404
|
}
|
|
2146
2405
|
/**
|
|
2147
2406
|
* Get the static value of this component.
|
|
2148
|
-
* @
|
|
2407
|
+
* @returns {*} - The value for this component.
|
|
2149
2408
|
*/
|
|
2150
2409
|
get dataValue() {
|
|
2151
2410
|
if (!this.key ||
|
|
@@ -2163,8 +2422,7 @@ class Component extends Element_1.default {
|
|
|
2163
2422
|
}
|
|
2164
2423
|
/**
|
|
2165
2424
|
* Sets the static value of this component.
|
|
2166
|
-
*
|
|
2167
|
-
* @param value
|
|
2425
|
+
* @param {*} value - The value to set for this component.
|
|
2168
2426
|
*/
|
|
2169
2427
|
set dataValue(value) {
|
|
2170
2428
|
if (!this.allowData ||
|
|
@@ -2184,8 +2442,8 @@ class Component extends Element_1.default {
|
|
|
2184
2442
|
}
|
|
2185
2443
|
/**
|
|
2186
2444
|
* Splice a value from the dataValue.
|
|
2187
|
-
*
|
|
2188
|
-
* @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.
|
|
2189
2447
|
*/
|
|
2190
2448
|
splice(index, flags = {}) {
|
|
2191
2449
|
if (this.hasValue()) {
|
|
@@ -2253,8 +2511,7 @@ class Component extends Element_1.default {
|
|
|
2253
2511
|
}
|
|
2254
2512
|
/**
|
|
2255
2513
|
* Get the input value of this component.
|
|
2256
|
-
*
|
|
2257
|
-
* @return {*}
|
|
2514
|
+
* @returns {*} - The value for the component.
|
|
2258
2515
|
*/
|
|
2259
2516
|
getValue() {
|
|
2260
2517
|
if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
@@ -2276,9 +2533,8 @@ class Component extends Element_1.default {
|
|
|
2276
2533
|
}
|
|
2277
2534
|
/**
|
|
2278
2535
|
* Get the value at a specific index.
|
|
2279
|
-
*
|
|
2280
|
-
* @
|
|
2281
|
-
* @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.
|
|
2282
2538
|
*/
|
|
2283
2539
|
getValueAt(index) {
|
|
2284
2540
|
const input = this.performInputMapping(this.refs.input[index]);
|
|
@@ -2286,11 +2542,9 @@ class Component extends Element_1.default {
|
|
|
2286
2542
|
}
|
|
2287
2543
|
/**
|
|
2288
2544
|
* Set the value of this component.
|
|
2289
|
-
*
|
|
2290
|
-
* @param value
|
|
2291
|
-
* @
|
|
2292
|
-
*
|
|
2293
|
-
* @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.
|
|
2294
2548
|
*/
|
|
2295
2549
|
setValue(value, flags = {}) {
|
|
2296
2550
|
const changed = this.updateValue(value, flags);
|
|
@@ -2321,9 +2575,9 @@ class Component extends Element_1.default {
|
|
|
2321
2575
|
}
|
|
2322
2576
|
/**
|
|
2323
2577
|
* Set the value at a specific index.
|
|
2324
|
-
*
|
|
2325
|
-
* @param index
|
|
2326
|
-
* @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.
|
|
2327
2581
|
*/
|
|
2328
2582
|
setValueAt(index, value, flags = {}) {
|
|
2329
2583
|
if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
|
|
@@ -2370,9 +2624,8 @@ class Component extends Element_1.default {
|
|
|
2370
2624
|
}
|
|
2371
2625
|
/**
|
|
2372
2626
|
* Normalize values coming into updateValue.
|
|
2373
|
-
*
|
|
2374
|
-
* @
|
|
2375
|
-
* @return {*}
|
|
2627
|
+
* @param {*} value - The value to normalize before setting.
|
|
2628
|
+
* @returns {*} - The normalized value.
|
|
2376
2629
|
*/
|
|
2377
2630
|
normalizeValue(value) {
|
|
2378
2631
|
if (this.component.multiple && !Array.isArray(value)) {
|
|
@@ -2382,8 +2635,9 @@ class Component extends Element_1.default {
|
|
|
2382
2635
|
}
|
|
2383
2636
|
/**
|
|
2384
2637
|
* Update a value of this component.
|
|
2385
|
-
*
|
|
2386
|
-
* @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.
|
|
2387
2641
|
*/
|
|
2388
2642
|
updateComponentValue(value, flags = {}) {
|
|
2389
2643
|
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
@@ -2402,9 +2656,8 @@ class Component extends Element_1.default {
|
|
|
2402
2656
|
}
|
|
2403
2657
|
/**
|
|
2404
2658
|
* Updates the value of this component plus all sub-components.
|
|
2405
|
-
*
|
|
2406
|
-
* @
|
|
2407
|
-
* @return {boolean}
|
|
2659
|
+
* @param {...any} args - The arguments to pass to updateValue.
|
|
2660
|
+
* @returns {boolean} - If the value changed.
|
|
2408
2661
|
*/
|
|
2409
2662
|
updateValue(...args) {
|
|
2410
2663
|
return this.updateComponentValue(...args);
|
|
@@ -2422,7 +2675,7 @@ class Component extends Element_1.default {
|
|
|
2422
2675
|
*/
|
|
2423
2676
|
resetValue() {
|
|
2424
2677
|
this.unset();
|
|
2425
|
-
this.setValue(this.emptyValue, {
|
|
2678
|
+
this.setValue(this.defaultValue || this.emptyValue, {
|
|
2426
2679
|
noUpdateEvent: true,
|
|
2427
2680
|
noValidate: true,
|
|
2428
2681
|
resetValue: true
|
|
@@ -2430,10 +2683,9 @@ class Component extends Element_1.default {
|
|
|
2430
2683
|
}
|
|
2431
2684
|
/**
|
|
2432
2685
|
* Determine if the value of this component has changed.
|
|
2433
|
-
*
|
|
2434
|
-
* @param
|
|
2435
|
-
* @
|
|
2436
|
-
* @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.
|
|
2437
2689
|
*/
|
|
2438
2690
|
hasChanged(newValue, oldValue) {
|
|
2439
2691
|
if (((newValue === undefined) || (newValue === null)) &&
|
|
@@ -2451,8 +2703,9 @@ class Component extends Element_1.default {
|
|
|
2451
2703
|
}
|
|
2452
2704
|
/**
|
|
2453
2705
|
* Update the value on change.
|
|
2454
|
-
*
|
|
2455
|
-
* @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.
|
|
2456
2709
|
*/
|
|
2457
2710
|
updateOnChange(flags = {}, changed = false) {
|
|
2458
2711
|
if (!flags.noUpdateEvent && changed) {
|
|
@@ -2465,13 +2718,6 @@ class Component extends Element_1.default {
|
|
|
2465
2718
|
}
|
|
2466
2719
|
return false;
|
|
2467
2720
|
}
|
|
2468
|
-
/**
|
|
2469
|
-
* Perform a calculated value operation.
|
|
2470
|
-
*
|
|
2471
|
-
* @param data - The global data object.
|
|
2472
|
-
*
|
|
2473
|
-
* @return {boolean} - If the value changed during calculation.
|
|
2474
|
-
*/
|
|
2475
2721
|
convertNumberOrBoolToString(value) {
|
|
2476
2722
|
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
2477
2723
|
return value.toString();
|
|
@@ -2580,9 +2826,10 @@ class Component extends Element_1.default {
|
|
|
2580
2826
|
/* eslint-enable max-statements */
|
|
2581
2827
|
/**
|
|
2582
2828
|
* Performs calculations in this component plus any child components.
|
|
2583
|
-
*
|
|
2584
|
-
* @param
|
|
2585
|
-
* @
|
|
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.
|
|
2586
2833
|
*/
|
|
2587
2834
|
calculateValue(data, flags, row) {
|
|
2588
2835
|
data = data || this.rootValue;
|
|
@@ -2592,15 +2839,14 @@ class Component extends Element_1.default {
|
|
|
2592
2839
|
}
|
|
2593
2840
|
/**
|
|
2594
2841
|
* Get this component's label text.
|
|
2595
|
-
*
|
|
2842
|
+
* @returns {string} - The label text for this component.
|
|
2596
2843
|
*/
|
|
2597
2844
|
get label() {
|
|
2598
2845
|
return this.component.label;
|
|
2599
2846
|
}
|
|
2600
2847
|
/**
|
|
2601
2848
|
* Set this component's label text and render it.
|
|
2602
|
-
*
|
|
2603
|
-
* @param value - The new label text.
|
|
2849
|
+
* @param {string} value - The new label text.
|
|
2604
2850
|
*/
|
|
2605
2851
|
set label(value) {
|
|
2606
2852
|
this.component.label = value;
|
|
@@ -2610,17 +2856,18 @@ class Component extends Element_1.default {
|
|
|
2610
2856
|
}
|
|
2611
2857
|
/**
|
|
2612
2858
|
* Get FormioForm element at the root of this component tree.
|
|
2613
|
-
*
|
|
2859
|
+
* @returns {*} root - The root component to search from.
|
|
2614
2860
|
*/
|
|
2615
2861
|
getRoot() {
|
|
2616
2862
|
return this.root;
|
|
2617
2863
|
}
|
|
2618
2864
|
/**
|
|
2619
2865
|
* Returns the invalid message, or empty string if the component is valid.
|
|
2620
|
-
*
|
|
2621
|
-
* @param
|
|
2622
|
-
* @param
|
|
2623
|
-
* @
|
|
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.
|
|
2624
2871
|
*/
|
|
2625
2872
|
invalidMessage(data, dirty, ignoreCondition, row) {
|
|
2626
2873
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
|
@@ -2652,10 +2899,9 @@ class Component extends Element_1.default {
|
|
|
2652
2899
|
}
|
|
2653
2900
|
/**
|
|
2654
2901
|
* Returns if the component is valid or not.
|
|
2655
|
-
*
|
|
2656
|
-
* @param
|
|
2657
|
-
* @
|
|
2658
|
-
* @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.
|
|
2659
2905
|
*/
|
|
2660
2906
|
isValid(data, dirty) {
|
|
2661
2907
|
return !this.invalidMessage(data, dirty);
|
|
@@ -2674,8 +2920,8 @@ class Component extends Element_1.default {
|
|
|
2674
2920
|
}
|
|
2675
2921
|
/**
|
|
2676
2922
|
* Interpolate errors from the validation methods.
|
|
2677
|
-
* @param {
|
|
2678
|
-
* @returns
|
|
2923
|
+
* @param {Array<any>} errors - An array of errors to interpolate.
|
|
2924
|
+
* @returns {Array<any>} - The interpolated errors.
|
|
2679
2925
|
*/
|
|
2680
2926
|
interpolateErrors(errors) {
|
|
2681
2927
|
var _a;
|
|
@@ -2688,7 +2934,7 @@ class Component extends Element_1.default {
|
|
|
2688
2934
|
* @param {*} data - The root submission data.
|
|
2689
2935
|
* @param {*} row - The contextual row data.
|
|
2690
2936
|
* @param {*} flags - The flags to perform validation.
|
|
2691
|
-
* @returns
|
|
2937
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2692
2938
|
*/
|
|
2693
2939
|
showValidationErrors(errors, data, row, flags) {
|
|
2694
2940
|
if (flags.silentCheck) {
|
|
@@ -2708,9 +2954,9 @@ class Component extends Element_1.default {
|
|
|
2708
2954
|
* @param {*} data - The root data you wish to use for this component.
|
|
2709
2955
|
* @param {*} row - The contextual row data you wish to use for this component.
|
|
2710
2956
|
* @param {*} flags - The flags to control the behavior of the validation.
|
|
2711
|
-
* @returns
|
|
2957
|
+
* @returns {Array<any>} - An array of errors if the component is invalid.
|
|
2712
2958
|
*/
|
|
2713
|
-
validateComponent(data, row, flags = {}) {
|
|
2959
|
+
validateComponent(data = null, row = null, flags = {}) {
|
|
2714
2960
|
data = data || this.rootValue;
|
|
2715
2961
|
row = row || this.data;
|
|
2716
2962
|
const { async = false } = flags;
|
|
@@ -2741,13 +2987,14 @@ class Component extends Element_1.default {
|
|
|
2741
2987
|
}
|
|
2742
2988
|
/**
|
|
2743
2989
|
* Checks the validity of this component and sets the error message if it is invalid.
|
|
2744
|
-
*
|
|
2745
|
-
* @param
|
|
2746
|
-
* @param
|
|
2747
|
-
* @param
|
|
2748
|
-
* @
|
|
2749
|
-
|
|
2750
|
-
|
|
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 = []) {
|
|
2751
2998
|
data = data || this.rootValue;
|
|
2752
2999
|
row = row || this.data;
|
|
2753
3000
|
flags.dirty = dirty || false;
|
|
@@ -2783,32 +3030,30 @@ class Component extends Element_1.default {
|
|
|
2783
3030
|
}
|
|
2784
3031
|
/**
|
|
2785
3032
|
* Checks the validity of the component.
|
|
2786
|
-
* @param {*} data
|
|
2787
|
-
* @param {
|
|
2788
|
-
* @param {*} row
|
|
2789
|
-
* @param {
|
|
2790
|
-
* @
|
|
2791
|
-
|
|
2792
|
-
|
|
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 = []) {
|
|
2793
3041
|
data = data || this.rootValue;
|
|
2794
3042
|
row = row || this.data;
|
|
2795
|
-
console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
2796
3043
|
return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
|
|
2797
3044
|
}
|
|
2798
|
-
checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
|
|
2799
|
-
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 = []) {
|
|
2800
3046
|
return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
|
|
2801
3047
|
}
|
|
2802
3048
|
/**
|
|
2803
3049
|
* Check the conditions, calculations, and validity of a single component and triggers an update if
|
|
2804
3050
|
* something changed.
|
|
2805
|
-
*
|
|
2806
|
-
* @param
|
|
2807
|
-
* @param
|
|
2808
|
-
*
|
|
2809
|
-
* @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.
|
|
2810
3055
|
*/
|
|
2811
|
-
checkData(data, flags, row) {
|
|
3056
|
+
checkData(data = null, flags = null, row = null) {
|
|
2812
3057
|
data = data || this.rootValue;
|
|
2813
3058
|
flags = flags || {};
|
|
2814
3059
|
row = row || this.data;
|
|
@@ -2851,8 +3096,7 @@ class Component extends Element_1.default {
|
|
|
2851
3096
|
}
|
|
2852
3097
|
/**
|
|
2853
3098
|
* Check if a component is eligible for multiple validation
|
|
2854
|
-
*
|
|
2855
|
-
* @return {boolean}
|
|
3099
|
+
* @returns {boolean} - TRUE if the component is eligible for multiple validation.
|
|
2856
3100
|
*/
|
|
2857
3101
|
validateMultiple() {
|
|
2858
3102
|
return true;
|
|
@@ -2972,8 +3216,7 @@ class Component extends Element_1.default {
|
|
|
2972
3216
|
/**
|
|
2973
3217
|
* Determines if the value of this component is hidden from the user as if it is coming from the server, but is
|
|
2974
3218
|
* protected.
|
|
2975
|
-
*
|
|
2976
|
-
* @return {boolean|*}
|
|
3219
|
+
* @returns {boolean|*} - TRUE if the value is hidden.
|
|
2977
3220
|
*/
|
|
2978
3221
|
isValueHidden() {
|
|
2979
3222
|
if (this.component.protected && this.root.editing) {
|
|
@@ -3018,6 +3261,8 @@ class Component extends Element_1.default {
|
|
|
3018
3261
|
}
|
|
3019
3262
|
/**
|
|
3020
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.
|
|
3021
3266
|
*/
|
|
3022
3267
|
asString(value) {
|
|
3023
3268
|
value = value || this.getValue();
|
|
@@ -3025,15 +3270,14 @@ class Component extends Element_1.default {
|
|
|
3025
3270
|
}
|
|
3026
3271
|
/**
|
|
3027
3272
|
* Return if the component is disabled.
|
|
3028
|
-
* @
|
|
3273
|
+
* @returns {boolean} - TRUE if the component is disabled.
|
|
3029
3274
|
*/
|
|
3030
3275
|
get disabled() {
|
|
3031
3276
|
return this._disabled || this.parentDisabled;
|
|
3032
3277
|
}
|
|
3033
3278
|
/**
|
|
3034
3279
|
* Disable this component.
|
|
3035
|
-
*
|
|
3036
|
-
* @param {boolean} disabled
|
|
3280
|
+
* @param {boolean} disabled - TRUE to disable the component.
|
|
3037
3281
|
*/
|
|
3038
3282
|
set disabled(disabled) {
|
|
3039
3283
|
this._disabled = disabled;
|
|
@@ -3158,6 +3402,7 @@ class Component extends Element_1.default {
|
|
|
3158
3402
|
}
|
|
3159
3403
|
/**
|
|
3160
3404
|
* Get the element information.
|
|
3405
|
+
* @returns {*} - The components "input" DOM element information.
|
|
3161
3406
|
*/
|
|
3162
3407
|
elementInfo() {
|
|
3163
3408
|
const attributes = {
|
|
@@ -3196,15 +3441,13 @@ class Component extends Element_1.default {
|
|
|
3196
3441
|
const { left, top } = element.getBoundingClientRect();
|
|
3197
3442
|
window.scrollTo(left + window.scrollX, top + window.scrollY);
|
|
3198
3443
|
}
|
|
3199
|
-
focus(index) {
|
|
3444
|
+
focus(index = (this.refs.input.length - 1)) {
|
|
3200
3445
|
var _a, _b;
|
|
3201
3446
|
if ('beforeFocus' in this.parent) {
|
|
3202
3447
|
this.parent.beforeFocus(this);
|
|
3203
3448
|
}
|
|
3204
3449
|
if ((_a = this.refs.input) === null || _a === void 0 ? void 0 : _a.length) {
|
|
3205
|
-
const focusingInput =
|
|
3206
|
-
? this.refs.input[index]
|
|
3207
|
-
: this.refs.input[this.refs.input.length - 1];
|
|
3450
|
+
const focusingInput = this.refs.input[index];
|
|
3208
3451
|
if (((_b = this.component.widget) === null || _b === void 0 ? void 0 : _b.type) === 'calendar') {
|
|
3209
3452
|
const sibling = focusingInput.nextSibling;
|
|
3210
3453
|
if (sibling) {
|
|
@@ -3224,6 +3467,7 @@ class Component extends Element_1.default {
|
|
|
3224
3467
|
}
|
|
3225
3468
|
/**
|
|
3226
3469
|
* Get `Formio` instance for working with files
|
|
3470
|
+
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
|
3227
3471
|
*/
|
|
3228
3472
|
get fileService() {
|
|
3229
3473
|
if (this.options.fileService) {
|