@formio/js 5.0.0-dev.5613.3476921 → 5.0.0-dev.5614.b5c93f3
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 +73 -4
- package/dist/formio.builder.css +8 -13
- 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 -13
- package/dist/formio.form.js +803 -1226
- 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 -3
- package/dist/formio.full.css +8 -13
- package/dist/formio.full.js +722 -941
- 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 -3
- package/dist/formio.js +18 -18
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1853 -466
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +10 -2
- 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 +87 -98
- package/lib/cjs/Element.js +76 -95
- 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 -75
- package/lib/cjs/FormBuilder.d.ts +187 -2
- package/lib/cjs/FormBuilder.js +30 -8
- package/lib/cjs/Formio.js +12 -0
- 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 +7 -16
- package/lib/cjs/PDFBuilder.js +3 -3
- package/lib/cjs/Webform.d.ts +193 -140
- package/lib/cjs/Webform.js +341 -306
- package/lib/cjs/WebformBuilder.d.ts +18 -15
- package/lib/cjs/WebformBuilder.js +34 -27
- package/lib/cjs/Wizard.d.ts +31 -21
- package/lib/cjs/Wizard.js +44 -21
- package/lib/cjs/WizardBuilder.d.ts +1 -1
- package/lib/cjs/addons/FormioAddon.d.ts +0 -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 +516 -270
- 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 +470 -246
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +1 -1
- 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/comp7.d.ts +84 -0
- package/lib/cjs/components/_classes/component/fixtures/comp7.js +86 -0
- package/lib/cjs/components/_classes/component/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/_classes/component/fixtures/index.js +5 -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 +32 -23
- 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 +44 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +164 -68
- 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 +182 -62
- 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/address/Address.js +4 -0
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +1 -1
- package/lib/cjs/components/button/Button.d.ts +4 -13
- 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 +12 -7
- package/lib/cjs/components/checkbox/Checkbox.d.ts +5 -28
- 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/checkbox/Checkbox.js +1 -1
- package/lib/cjs/components/checkbox/fixtures/comp6.d.ts +32 -0
- package/lib/cjs/components/checkbox/fixtures/comp6.js +30 -0
- package/lib/cjs/components/checkbox/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/checkbox/fixtures/index.js +3 -1
- 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 +3 -3
- 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 +17 -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 +55 -37
- 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/comp-with-reorder.d.ts +100 -0
- package/lib/cjs/components/datagrid/fixtures/comp-with-reorder.js +139 -0
- package/lib/cjs/components/datagrid/fixtures/comp10.d.ts +81 -0
- package/lib/cjs/components/datagrid/fixtures/comp10.js +87 -0
- package/lib/cjs/components/datagrid/fixtures/comp9.d.ts +41 -0
- package/lib/cjs/components/datagrid/fixtures/comp9.js +44 -0
- package/lib/cjs/components/datagrid/fixtures/index.d.ts +5 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +9 -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/comp8.d.ts +41 -0
- package/lib/cjs/components/day/fixtures/comp8.js +40 -0
- package/lib/cjs/components/day/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/day/fixtures/index.js +5 -1
- package/lib/cjs/components/editgrid/EditGrid.d.ts +8 -4
- 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 +12 -26
- 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 -23
- 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 +3 -4
- package/lib/cjs/components/form/Form.d.ts +38 -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 +33 -20
- 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 +2 -3
- package/lib/cjs/components/number/fixtures/comp8.d.ts +32 -0
- package/lib/cjs/components/number/fixtures/comp8.js +28 -0
- package/lib/cjs/components/number/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/number/fixtures/index.js +3 -1
- 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/phonenumber/fixtures/comp2.d.ts +16 -0
- package/lib/cjs/components/phonenumber/fixtures/comp2.js +25 -0
- package/lib/cjs/components/phonenumber/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/phonenumber/fixtures/index.js +3 -1
- package/lib/cjs/components/radio/Radio.d.ts +4 -27
- 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 +11 -9
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +2 -9
- package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +7 -2
- package/lib/cjs/components/recaptcha/ReCaptcha.js +1 -8
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +33 -2
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +13 -2
- 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 +23 -24
- package/lib/cjs/components/select/editForm/Select.edit.data.js +16 -2
- package/lib/cjs/components/select/fixtures/comp22.js +1 -1
- package/lib/cjs/components/select/fixtures/comp23.d.ts +58 -0
- package/lib/cjs/components/select/fixtures/comp23.js +49 -0
- package/lib/cjs/components/select/fixtures/comp24.d.ts +47 -0
- package/lib/cjs/components/select/fixtures/comp24.js +40 -0
- package/lib/cjs/components/select/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/select/fixtures/index.js +5 -1
- 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 +11 -10
- 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/signature/Signature.js +1 -1
- 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 +3 -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/table/Table.js +1 -1
- 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/tags/Tags.js +2 -4
- 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 +135 -6
- package/lib/cjs/providers/address/GoogleAddressProvider.js +95 -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 +5 -0
- package/lib/cjs/translations/en.js +6 -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/conditionOperators/IsEmptyValue.js +4 -3
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +3 -3
- 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 -218
- package/lib/cjs/utils/utils.js +420 -252
- package/lib/cjs/widgets/CalendarWidget.d.ts +9 -10
- package/lib/cjs/widgets/CalendarWidget.js +11 -13
- package/lib/mjs/CDN.d.ts +1 -0
- package/lib/mjs/CDN.js +6 -3
- package/lib/mjs/Element.d.ts +87 -98
- package/lib/mjs/Element.js +76 -95
- 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 -68
- package/lib/mjs/FormBuilder.d.ts +187 -2
- package/lib/mjs/FormBuilder.js +32 -8
- package/lib/mjs/Formio.js +12 -0
- 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 +7 -16
- package/lib/mjs/PDFBuilder.js +3 -3
- package/lib/mjs/Webform.d.ts +193 -140
- package/lib/mjs/Webform.js +353 -318
- package/lib/mjs/WebformBuilder.d.ts +18 -15
- package/lib/mjs/WebformBuilder.js +34 -27
- package/lib/mjs/Wizard.d.ts +31 -21
- package/lib/mjs/Wizard.js +43 -20
- package/lib/mjs/WizardBuilder.d.ts +1 -1
- package/lib/mjs/addons/FormioAddon.d.ts +0 -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 +516 -270
- 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 +479 -247
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +1 -1
- 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/comp7.d.ts +84 -0
- package/lib/mjs/components/_classes/component/fixtures/comp7.js +84 -0
- package/lib/mjs/components/_classes/component/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/_classes/component/fixtures/index.js +3 -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 +31 -23
- 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 +44 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +164 -68
- 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 +182 -62
- 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/address/Address.js +4 -0
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +1 -1
- package/lib/mjs/components/button/Button.d.ts +4 -13
- 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 +12 -7
- package/lib/mjs/components/checkbox/Checkbox.d.ts +5 -28
- 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/checkbox/Checkbox.js +1 -1
- package/lib/mjs/components/checkbox/fixtures/comp6.d.ts +32 -0
- package/lib/mjs/components/checkbox/fixtures/comp6.js +28 -0
- package/lib/mjs/components/checkbox/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/checkbox/fixtures/index.js +2 -1
- 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 +3 -3
- 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 +17 -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 +55 -37
- 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/comp-with-reorder.d.ts +100 -0
- package/lib/mjs/components/datagrid/fixtures/comp-with-reorder.js +137 -0
- package/lib/mjs/components/datagrid/fixtures/comp10.d.ts +81 -0
- package/lib/mjs/components/datagrid/fixtures/comp10.js +85 -0
- package/lib/mjs/components/datagrid/fixtures/comp9.d.ts +41 -0
- package/lib/mjs/components/datagrid/fixtures/comp9.js +42 -0
- package/lib/mjs/components/datagrid/fixtures/index.d.ts +5 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +5 -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/comp8.d.ts +41 -0
- package/lib/mjs/components/day/fixtures/comp8.js +38 -0
- package/lib/mjs/components/day/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/day/fixtures/index.js +3 -1
- package/lib/mjs/components/editgrid/EditGrid.d.ts +8 -4
- 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 +12 -25
- 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 -23
- 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 +3 -4
- package/lib/mjs/components/form/Form.d.ts +38 -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 +31 -18
- 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 +2 -3
- package/lib/mjs/components/number/fixtures/comp8.d.ts +32 -0
- package/lib/mjs/components/number/fixtures/comp8.js +26 -0
- package/lib/mjs/components/number/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/number/fixtures/index.js +2 -1
- 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/phonenumber/fixtures/comp2.d.ts +16 -0
- package/lib/mjs/components/phonenumber/fixtures/comp2.js +23 -0
- package/lib/mjs/components/phonenumber/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/phonenumber/fixtures/index.js +2 -1
- package/lib/mjs/components/radio/Radio.d.ts +4 -27
- 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 +11 -9
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +2 -9
- package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +7 -2
- package/lib/mjs/components/recaptcha/ReCaptcha.js +1 -8
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.d.ts +33 -2
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +13 -2
- 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 +24 -25
- package/lib/mjs/components/select/editForm/Select.edit.data.js +16 -2
- package/lib/mjs/components/select/fixtures/comp22.js +1 -1
- package/lib/mjs/components/select/fixtures/comp23.d.ts +58 -0
- package/lib/mjs/components/select/fixtures/comp23.js +47 -0
- package/lib/mjs/components/select/fixtures/comp24.d.ts +47 -0
- package/lib/mjs/components/select/fixtures/comp24.js +38 -0
- package/lib/mjs/components/select/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/select/fixtures/index.js +3 -1
- 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 +11 -10
- 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/signature/Signature.js +1 -1
- 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 +3 -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/table/Table.js +1 -1
- 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/tags/Tags.js +2 -4
- 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 +135 -6
- package/lib/mjs/providers/address/GoogleAddressProvider.js +94 -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 +5 -0
- package/lib/mjs/translations/en.js +6 -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/conditionOperators/IsEmptyValue.js +3 -3
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +1 -1
- 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 -218
- package/lib/mjs/utils/utils.js +409 -233
- package/lib/mjs/widgets/CalendarWidget.d.ts +9 -10
- package/lib/mjs/widgets/CalendarWidget.js +11 -13
- package/package.json +22 -23
- 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);
|
|
@@ -529,30 +516,10 @@ class Component extends Element_1.default {
|
|
|
529
516
|
}
|
|
530
517
|
return addon;
|
|
531
518
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
delete this.element.component;
|
|
535
|
-
delete this.element;
|
|
536
|
-
}
|
|
537
|
-
delete this._currentForm;
|
|
538
|
-
delete this.parent;
|
|
539
|
-
delete this.root;
|
|
540
|
-
delete this.triggerChange;
|
|
541
|
-
delete this.triggerRedraw;
|
|
542
|
-
if (this.options) {
|
|
543
|
-
delete this.options.root;
|
|
544
|
-
delete this.options.parent;
|
|
545
|
-
delete this.options.i18next;
|
|
546
|
-
}
|
|
547
|
-
super.teardown();
|
|
548
|
-
}
|
|
549
|
-
destroy(all = false) {
|
|
550
|
-
super.destroy(all);
|
|
519
|
+
destroy() {
|
|
520
|
+
super.destroy();
|
|
551
521
|
this.detach();
|
|
552
522
|
this.addons.forEach((addon) => addon.destroy());
|
|
553
|
-
if (all) {
|
|
554
|
-
this.teardown();
|
|
555
|
-
}
|
|
556
523
|
}
|
|
557
524
|
get shouldDisabled() {
|
|
558
525
|
return this.options.readOnly || this.component.disabled || (this.options.hasOwnProperty('disabled') && this.options.disabled[this.key]);
|
|
@@ -603,8 +570,8 @@ class Component extends Element_1.default {
|
|
|
603
570
|
return this.shouldForceVisibility(component, 'show');
|
|
604
571
|
}
|
|
605
572
|
/**
|
|
606
|
-
*
|
|
607
|
-
* @param
|
|
573
|
+
* Sets the component visibility.
|
|
574
|
+
* @param {boolean} value - Whether the component should be visible or not.
|
|
608
575
|
*/
|
|
609
576
|
set visible(value) {
|
|
610
577
|
if (this._visible !== value) {
|
|
@@ -622,8 +589,8 @@ class Component extends Element_1.default {
|
|
|
622
589
|
}
|
|
623
590
|
}
|
|
624
591
|
/**
|
|
625
|
-
*
|
|
626
|
-
* @returns {boolean}
|
|
592
|
+
* Returns the component visibility
|
|
593
|
+
* @returns {boolean} - Whether the component is visible or not.
|
|
627
594
|
*/
|
|
628
595
|
get visible() {
|
|
629
596
|
// Show only if visibility changes or if we are in builder mode or if hidden fields should be shown.
|
|
@@ -713,9 +680,10 @@ class Component extends Element_1.default {
|
|
|
713
680
|
}
|
|
714
681
|
/**
|
|
715
682
|
* Returns only the schema that is different from the default.
|
|
716
|
-
*
|
|
717
|
-
* @param schema
|
|
718
|
-
* @param
|
|
683
|
+
* @param {object} schema - The "full" json schema for the component.
|
|
684
|
+
* @param {object} defaultSchema - The "default" json schema for the component.
|
|
685
|
+
* @param {boolean} recursion - If we are currently in a recursive loop.
|
|
686
|
+
* @returns {object} - The minified json schema for this component.
|
|
719
687
|
*/
|
|
720
688
|
getModifiedSchema(schema, defaultSchema, recursion) {
|
|
721
689
|
const modified = {};
|
|
@@ -749,21 +717,24 @@ class Component extends Element_1.default {
|
|
|
749
717
|
}
|
|
750
718
|
/**
|
|
751
719
|
* Returns the JSON schema for this component.
|
|
720
|
+
* @returns {object} - The JSON schema for this component.
|
|
752
721
|
*/
|
|
753
722
|
get schema() {
|
|
754
723
|
return (0, utils_1.fastCloneDeep)(this.getModifiedSchema(lodash_1.default.omit(this.component, 'id'), this.defaultSchema));
|
|
755
724
|
}
|
|
756
725
|
/**
|
|
757
726
|
* Returns true if component is inside DataGrid
|
|
727
|
+
* @returns {boolean} - True if component is inside DataGrid
|
|
758
728
|
*/
|
|
759
729
|
get isInDataGrid() {
|
|
760
730
|
return this.inDataGrid;
|
|
761
731
|
}
|
|
762
732
|
/**
|
|
763
733
|
* Translate a text using the i18n system.
|
|
764
|
-
*
|
|
765
734
|
* @param {string} text - The i18n identifier.
|
|
766
|
-
* @param {
|
|
735
|
+
* @param {object} params - The i18n parameters to use for translation.
|
|
736
|
+
* @param {...any} args - Additional arguments to pass to the translation library.
|
|
737
|
+
* @returns {string} - The translated text.
|
|
767
738
|
*/
|
|
768
739
|
t(text, params = {}, ...args) {
|
|
769
740
|
if (!text) {
|
|
@@ -853,7 +824,7 @@ class Component extends Element_1.default {
|
|
|
853
824
|
isHtmlRenderMode() {
|
|
854
825
|
return this.options.renderMode === 'html';
|
|
855
826
|
}
|
|
856
|
-
renderTemplate(name, data = {}, modeOption) {
|
|
827
|
+
renderTemplate(name, data = {}, modeOption = '') {
|
|
857
828
|
// Need to make this fall back to form if renderMode is not found similar to how we search templates.
|
|
858
829
|
const mode = modeOption || this.options.renderMode || 'form';
|
|
859
830
|
data.component = this.component;
|
|
@@ -893,11 +864,12 @@ class Component extends Element_1.default {
|
|
|
893
864
|
}
|
|
894
865
|
/**
|
|
895
866
|
* Sanitize an html string.
|
|
896
|
-
*
|
|
897
|
-
* @param
|
|
898
|
-
* @
|
|
867
|
+
* @param {string} dirty - The dirty html string to sanitize.
|
|
868
|
+
* @param {boolean} forceSanitize - If we should force the sanitize to occur.
|
|
869
|
+
* @param {object} options - The options for the sanitize.
|
|
870
|
+
* @returns {*} - The sanitized html string.
|
|
899
871
|
*/
|
|
900
|
-
sanitize(dirty, forceSanitize, options) {
|
|
872
|
+
sanitize(dirty, forceSanitize = false, options = {}) {
|
|
901
873
|
var _a;
|
|
902
874
|
if (!this.shouldSanitizeValue && !forceSanitize) {
|
|
903
875
|
return dirty;
|
|
@@ -908,12 +880,9 @@ class Component extends Element_1.default {
|
|
|
908
880
|
}
|
|
909
881
|
/**
|
|
910
882
|
* 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.
|
|
883
|
+
* @param {string} template - The template to render.
|
|
884
|
+
* @param {object} data - The data to provide to the template.
|
|
885
|
+
* @returns {HTMLElement | string} - The created element or an empty string if template is not specified.
|
|
917
886
|
*/
|
|
918
887
|
renderString(template, data) {
|
|
919
888
|
if (!template) {
|
|
@@ -922,9 +891,18 @@ class Component extends Element_1.default {
|
|
|
922
891
|
// Interpolate the template and populate
|
|
923
892
|
return this.interpolate(template, data);
|
|
924
893
|
}
|
|
894
|
+
/**
|
|
895
|
+
* Allows for modification of the component value prior to submission.
|
|
896
|
+
* @param {*} input - The input to be modified.
|
|
897
|
+
* @returns {*} - The modified input mapping for the extended component.
|
|
898
|
+
*/
|
|
925
899
|
performInputMapping(input) {
|
|
926
900
|
return input;
|
|
927
901
|
}
|
|
902
|
+
/**
|
|
903
|
+
* Returns the component "widget" if one is available.
|
|
904
|
+
* @returns {Widget|null} - The widget instance. null if not available.
|
|
905
|
+
*/
|
|
928
906
|
get widget() {
|
|
929
907
|
var _a;
|
|
930
908
|
const settings = this.component.widget;
|
|
@@ -934,6 +912,10 @@ class Component extends Element_1.default {
|
|
|
934
912
|
const widget = settings && widgets_1.default[settings.type] ? new widgets_1.default[settings.type](settings, this.component, this) : null;
|
|
935
913
|
return widget;
|
|
936
914
|
}
|
|
915
|
+
/**
|
|
916
|
+
* Returns the native supported browser language.
|
|
917
|
+
* @returns {string|null} - The native browser language that is supported.
|
|
918
|
+
*/
|
|
937
919
|
getBrowserLanguage() {
|
|
938
920
|
const nav = window.navigator;
|
|
939
921
|
const browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'];
|
|
@@ -957,38 +939,46 @@ class Component extends Element_1.default {
|
|
|
957
939
|
return null;
|
|
958
940
|
}
|
|
959
941
|
/**
|
|
960
|
-
* Called before a next and previous page is triggered allowing the components
|
|
961
|
-
* to
|
|
962
|
-
*
|
|
963
|
-
* @return {*}
|
|
942
|
+
* Called before a next and previous page is triggered allowing the components to perform special functions.
|
|
943
|
+
* @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next/previous page navigation.
|
|
964
944
|
*/
|
|
965
945
|
beforePage() {
|
|
966
946
|
return Promise.resolve(true);
|
|
967
947
|
}
|
|
948
|
+
/**
|
|
949
|
+
* Called before the next page is triggered allowing the components to hook into the page navigation and perform tasks.
|
|
950
|
+
* @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next page navigation.
|
|
951
|
+
*/
|
|
968
952
|
beforeNext() {
|
|
969
953
|
return this.beforePage(true);
|
|
970
954
|
}
|
|
971
955
|
/**
|
|
972
|
-
* Called before a submission is triggered allowing the components
|
|
973
|
-
* to
|
|
974
|
-
*
|
|
975
|
-
* @return {*}
|
|
956
|
+
* Called before a submission is triggered allowing the components to perform special async functions.
|
|
957
|
+
* @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the submission.
|
|
976
958
|
*/
|
|
977
959
|
beforeSubmit() {
|
|
978
960
|
return Promise.resolve(true);
|
|
979
961
|
}
|
|
980
962
|
/**
|
|
981
963
|
* Return the submission timezone.
|
|
982
|
-
*
|
|
983
|
-
* @return {*}
|
|
964
|
+
* @returns {string} - The submission timezone.
|
|
984
965
|
*/
|
|
985
966
|
get submissionTimezone() {
|
|
986
967
|
this.options.submissionTimezone = this.options.submissionTimezone || lodash_1.default.get(this.root, 'options.submissionTimezone');
|
|
987
968
|
return this.options.submissionTimezone;
|
|
988
969
|
}
|
|
970
|
+
/**
|
|
971
|
+
* Return the current timezone.
|
|
972
|
+
* @returns {string} - The current timezone.
|
|
973
|
+
*/
|
|
989
974
|
get timezone() {
|
|
990
975
|
return this.getTimezone(this.component);
|
|
991
976
|
}
|
|
977
|
+
/**
|
|
978
|
+
* Return the current timezone.
|
|
979
|
+
* @param {object} settings - Settings to control how the timezone should be returned.
|
|
980
|
+
* @returns {string} - The current timezone.
|
|
981
|
+
*/
|
|
992
982
|
getTimezone(settings) {
|
|
993
983
|
if (settings.timezone) {
|
|
994
984
|
return settings.timezone;
|
|
@@ -1012,6 +1002,9 @@ class Component extends Element_1.default {
|
|
|
1012
1002
|
* @param {string} [referenceAttributeName] - The attribute name to use for the reference.
|
|
1013
1003
|
*/
|
|
1014
1004
|
loadRefs(element, refs, referenceAttributeName) {
|
|
1005
|
+
if (!element) {
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1015
1008
|
for (const ref in refs) {
|
|
1016
1009
|
const refType = refs[ref];
|
|
1017
1010
|
const isString = typeof refType === 'string';
|
|
@@ -1026,9 +1019,25 @@ class Component extends Element_1.default {
|
|
|
1026
1019
|
}
|
|
1027
1020
|
}
|
|
1028
1021
|
}
|
|
1029
|
-
|
|
1022
|
+
/**
|
|
1023
|
+
* Opens the modal element.
|
|
1024
|
+
* @param {string} template - The template to use for the modal dialog.
|
|
1025
|
+
*/
|
|
1026
|
+
setOpenModalElement(template = null) {
|
|
1030
1027
|
this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
|
|
1031
1028
|
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Renders a modal preview template and returns the markup as a string
|
|
1031
|
+
* @param {object|null|undefined} ctx - The rendering context
|
|
1032
|
+
* @returns {string} - The modal preview markup
|
|
1033
|
+
*/
|
|
1034
|
+
renderModalPreview(ctx) {
|
|
1035
|
+
return this.renderTemplate('modalPreview', ctx || {});
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Returns the modal preview template.
|
|
1039
|
+
* @returns {string} - The modal preview template.
|
|
1040
|
+
*/
|
|
1032
1041
|
getModalPreviewTemplate() {
|
|
1033
1042
|
var _a;
|
|
1034
1043
|
const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
|
|
@@ -1036,12 +1045,17 @@ class Component extends Element_1.default {
|
|
|
1036
1045
|
if (this.hasInput && ((_a = this.component.validate) === null || _a === void 0 ? void 0 : _a.required) && !this.isPDFReadOnlyMode) {
|
|
1037
1046
|
modalLabel = { className: 'field-required' };
|
|
1038
1047
|
}
|
|
1039
|
-
return this.
|
|
1048
|
+
return this.renderModalPreview({
|
|
1040
1049
|
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
|
|
1041
1050
|
messages: '',
|
|
1042
1051
|
labelInfo: modalLabel,
|
|
1043
1052
|
});
|
|
1044
1053
|
}
|
|
1054
|
+
/**
|
|
1055
|
+
* Performs a complete build of a component, which empties, renders, sets the content in the DOM, and then finally attaches events.
|
|
1056
|
+
* @param {HTMLElement} element - The element to attach this component to.
|
|
1057
|
+
* @returns {Promise<void>} - A promise that resolves when the component has been built.
|
|
1058
|
+
*/
|
|
1045
1059
|
build(element) {
|
|
1046
1060
|
element = element || this.element;
|
|
1047
1061
|
this.empty(element);
|
|
@@ -1051,6 +1065,12 @@ class Component extends Element_1.default {
|
|
|
1051
1065
|
get hasModalSaveButton() {
|
|
1052
1066
|
return true;
|
|
1053
1067
|
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Renders a component as an HTML string.
|
|
1070
|
+
* @param {string} children - The contents of all the children HTML as a string.
|
|
1071
|
+
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
|
1072
|
+
* @returns {string} - The rendered HTML string of a component.
|
|
1073
|
+
*/
|
|
1054
1074
|
render(children = `Unknown component: ${this.component.type}`, topLevel = false) {
|
|
1055
1075
|
const isVisible = this.visible;
|
|
1056
1076
|
this.rendered = true;
|
|
@@ -1074,27 +1094,46 @@ class Component extends Element_1.default {
|
|
|
1074
1094
|
}, topLevel);
|
|
1075
1095
|
}
|
|
1076
1096
|
}
|
|
1097
|
+
/**
|
|
1098
|
+
* Creates the tooltip instance using tippy.js and returns it
|
|
1099
|
+
* @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
|
|
1100
|
+
* @param {object|null|undefined} settings - tippy.js options
|
|
1101
|
+
* @returns {import('tippy.js').Tippy} - tippy.js instance
|
|
1102
|
+
*/
|
|
1103
|
+
createTooltip(tooltipEl, settings = {}) {
|
|
1104
|
+
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
|
|
1105
|
+
const tooltipDataTitle = tooltipEl.getAttribute('data-title');
|
|
1106
|
+
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1107
|
+
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1108
|
+
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 }) }));
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Attaches all the tooltips provided the refs object.
|
|
1112
|
+
* @param {object} toolTipsRefs - The refs for the tooltips within your template.
|
|
1113
|
+
* @returns {void}
|
|
1114
|
+
*/
|
|
1077
1115
|
attachTooltips(toolTipsRefs) {
|
|
1078
1116
|
toolTipsRefs === null || toolTipsRefs === void 0 ? void 0 : toolTipsRefs.forEach((tooltip, index) => {
|
|
1079
1117
|
if (tooltip) {
|
|
1080
|
-
|
|
1081
|
-
const tooltipDataTitle = tooltip.getAttribute('data-title');
|
|
1082
|
-
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1083
|
-
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1084
|
-
this.tooltips[index] = (0, tippy_js_1.default)(tooltip, {
|
|
1085
|
-
allowHTML: true,
|
|
1086
|
-
trigger: 'mouseenter click focus',
|
|
1087
|
-
placement: 'right',
|
|
1088
|
-
zIndex: 10000,
|
|
1089
|
-
interactive: true,
|
|
1090
|
-
content: this.t(this.sanitize(tooltipText), { _userInput: true }),
|
|
1091
|
-
});
|
|
1118
|
+
this.tooltips[index] = this.createTooltip(tooltip);
|
|
1092
1119
|
}
|
|
1093
1120
|
});
|
|
1094
1121
|
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Create a new component modal for this component.
|
|
1124
|
+
* @param {HTMLElement} element - The element to attach the modal to.
|
|
1125
|
+
* @param {boolean} modalShouldBeOpened - TRUE if the modal should open immediately.
|
|
1126
|
+
* @param {any} currentValue - The current value of the component.
|
|
1127
|
+
* @returns {ComponentModal} - The created component modal.
|
|
1128
|
+
*/
|
|
1095
1129
|
createComponentModal(element, modalShouldBeOpened, currentValue) {
|
|
1096
1130
|
return new ComponentModal_1.default(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
|
|
1097
1131
|
}
|
|
1132
|
+
/**
|
|
1133
|
+
* Attaches all event listensers for this component to the DOM elements that were rendered.
|
|
1134
|
+
* @param {HTMLElement} element - The element to attach the listeners to.
|
|
1135
|
+
* @returns {Promise<void>} - Resolves when the component is done attaching to the DOM.
|
|
1136
|
+
*/
|
|
1098
1137
|
attach(element) {
|
|
1099
1138
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
1100
1139
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
@@ -1106,7 +1145,7 @@ class Component extends Element_1.default {
|
|
|
1106
1145
|
this.setOpenModalElement(openModalTemplate);
|
|
1107
1146
|
}
|
|
1108
1147
|
this.attached = true;
|
|
1109
|
-
this.
|
|
1148
|
+
this.element = element;
|
|
1110
1149
|
element.component = this;
|
|
1111
1150
|
// If this already has an id, get it from the dom. If SSR, it could be different from the initiated id.
|
|
1112
1151
|
if (this.element.id) {
|
|
@@ -1132,6 +1171,9 @@ class Component extends Element_1.default {
|
|
|
1132
1171
|
this.addons.forEach((addon) => addon.attach(element));
|
|
1133
1172
|
return Promise.resolve();
|
|
1134
1173
|
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Restors the "focus" on a component after a redraw event has occured.
|
|
1176
|
+
*/
|
|
1135
1177
|
restoreFocus() {
|
|
1136
1178
|
var _a, _b, _c;
|
|
1137
1179
|
const isFocused = ((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.focusedComponent) === null || _b === void 0 ? void 0 : _b.path) === this.path;
|
|
@@ -1141,6 +1183,12 @@ class Component extends Element_1.default {
|
|
|
1141
1183
|
this.restoreCaretPosition();
|
|
1142
1184
|
}
|
|
1143
1185
|
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Adds a keyboard shortcut to this component.
|
|
1188
|
+
* @param {HTMLElement} element - The element to attach the keyboard shortcut to.
|
|
1189
|
+
* @param {string} shortcut - The keyboard shortcut to add.
|
|
1190
|
+
* @returns {void}
|
|
1191
|
+
*/
|
|
1144
1192
|
addShortcut(element, shortcut) {
|
|
1145
1193
|
// Avoid infinite recursion.
|
|
1146
1194
|
if (!element || !this.root || (this.root === this)) {
|
|
@@ -1151,6 +1199,12 @@ class Component extends Element_1.default {
|
|
|
1151
1199
|
}
|
|
1152
1200
|
this.root.addShortcut(element, shortcut);
|
|
1153
1201
|
}
|
|
1202
|
+
/**
|
|
1203
|
+
* Removes a keyboard shortcut from this component.
|
|
1204
|
+
* @param {HTMLElement} element - The element to remove the keyboard shortcut from.
|
|
1205
|
+
* @param {string} shortcut - The keyboard shortcut to remove.
|
|
1206
|
+
* @returns {void}
|
|
1207
|
+
*/
|
|
1154
1208
|
removeShortcut(element, shortcut) {
|
|
1155
1209
|
// Avoid infinite recursion.
|
|
1156
1210
|
if (!element || (this.root === this)) {
|
|
@@ -1165,17 +1219,6 @@ class Component extends Element_1.default {
|
|
|
1165
1219
|
* Remove all event handlers.
|
|
1166
1220
|
*/
|
|
1167
1221
|
detach() {
|
|
1168
|
-
// First iterate through each ref and delete the component so there are no dangling component references.
|
|
1169
|
-
lodash_1.default.each(this.refs, (ref) => {
|
|
1170
|
-
if (typeof ref === NodeList) {
|
|
1171
|
-
ref.forEach((elem) => {
|
|
1172
|
-
delete elem.component;
|
|
1173
|
-
});
|
|
1174
|
-
}
|
|
1175
|
-
else if (ref) {
|
|
1176
|
-
delete ref.component;
|
|
1177
|
-
}
|
|
1178
|
-
});
|
|
1179
1222
|
this.refs = {};
|
|
1180
1223
|
this.removeEventListeners();
|
|
1181
1224
|
this.detachLogic();
|
|
@@ -1183,6 +1226,13 @@ class Component extends Element_1.default {
|
|
|
1183
1226
|
this.tooltip.destroy();
|
|
1184
1227
|
}
|
|
1185
1228
|
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Determines if the component should be refreshed based on the path of another component that changed.
|
|
1231
|
+
* @param {string} refreshData - The path of the data that needs to trigger a refresh.
|
|
1232
|
+
* @param {boolean} changed - Flag that is true if the data has been changed.
|
|
1233
|
+
* @param {any} flags - The flags for the checkData procedure.
|
|
1234
|
+
* @returns {void}
|
|
1235
|
+
*/
|
|
1186
1236
|
checkRefresh(refreshData, changed, flags) {
|
|
1187
1237
|
const changePath = lodash_1.default.get(changed, 'instance.path', false);
|
|
1188
1238
|
// Don't let components change themselves.
|
|
@@ -1199,6 +1249,12 @@ class Component extends Element_1.default {
|
|
|
1199
1249
|
this.refresh(changed.value, changed, flags);
|
|
1200
1250
|
}
|
|
1201
1251
|
}
|
|
1252
|
+
/**
|
|
1253
|
+
* 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.
|
|
1254
|
+
* @param {Array<any>} changes - The list of components that have changed.
|
|
1255
|
+
* @param {any} flags - The checkData flags.
|
|
1256
|
+
* @returns {void}
|
|
1257
|
+
*/
|
|
1202
1258
|
checkRefreshOn(changes, flags = {}) {
|
|
1203
1259
|
changes = changes || [];
|
|
1204
1260
|
if (flags.noRefresh) {
|
|
@@ -1220,8 +1276,8 @@ class Component extends Element_1.default {
|
|
|
1220
1276
|
}
|
|
1221
1277
|
/**
|
|
1222
1278
|
* Refreshes the component with a new value.
|
|
1223
|
-
*
|
|
1224
|
-
* @
|
|
1279
|
+
* @param {any} value - The latest value of the component to check if it needs to be refreshed.
|
|
1280
|
+
* @returns {void}
|
|
1225
1281
|
*/
|
|
1226
1282
|
refresh(value) {
|
|
1227
1283
|
if (this.hasOwnProperty('refreshOnValue')) {
|
|
@@ -1244,8 +1300,8 @@ class Component extends Element_1.default {
|
|
|
1244
1300
|
* with the components data and returns true if they are in the same context.
|
|
1245
1301
|
*
|
|
1246
1302
|
* Different rows of the same EditGrid, for example, are in different contexts.
|
|
1247
|
-
*
|
|
1248
|
-
* @
|
|
1303
|
+
* @param {any} component - The component to check if it is in the same context as this component.
|
|
1304
|
+
* @returns {boolean} - TRUE if the component is in the same context as this component.
|
|
1249
1305
|
*/
|
|
1250
1306
|
inContext(component) {
|
|
1251
1307
|
if (component.data === this.data) {
|
|
@@ -1260,9 +1316,18 @@ class Component extends Element_1.default {
|
|
|
1260
1316
|
}
|
|
1261
1317
|
return false;
|
|
1262
1318
|
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Determines if we are in "view" only mode.
|
|
1321
|
+
* @returns {boolean} - TRUE if we are in "view" only mode.
|
|
1322
|
+
*/
|
|
1263
1323
|
get viewOnly() {
|
|
1264
1324
|
return this.options.readOnly && this.options.viewAsHtml;
|
|
1265
1325
|
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Sets the HTMLElement for this component.
|
|
1328
|
+
* @param {HTMLElement} element - The element that is attached to this component.
|
|
1329
|
+
* @returns {void}
|
|
1330
|
+
*/
|
|
1266
1331
|
setElement(element) {
|
|
1267
1332
|
if (this.element) {
|
|
1268
1333
|
delete this.element.component;
|
|
@@ -1270,24 +1335,32 @@ class Component extends Element_1.default {
|
|
|
1270
1335
|
}
|
|
1271
1336
|
this.element = element;
|
|
1272
1337
|
}
|
|
1338
|
+
/**
|
|
1339
|
+
* Creates an element to hold the "view only" version of this component.
|
|
1340
|
+
* @returns {HTMLElement} - The element for this component.
|
|
1341
|
+
*/
|
|
1273
1342
|
createViewOnlyElement() {
|
|
1274
|
-
this.
|
|
1343
|
+
this.element = this.ce('dl', {
|
|
1275
1344
|
id: this.id
|
|
1276
|
-
})
|
|
1345
|
+
});
|
|
1277
1346
|
if (this.element) {
|
|
1278
1347
|
// Ensure you can get the component info from the element.
|
|
1279
1348
|
this.element.component = this;
|
|
1280
1349
|
}
|
|
1281
1350
|
return this.element;
|
|
1282
1351
|
}
|
|
1352
|
+
/**
|
|
1353
|
+
* The default value for the "view only" mode of a component if the value is not provided.
|
|
1354
|
+
* @returns {string} - The default value for this component.
|
|
1355
|
+
*/
|
|
1283
1356
|
get defaultViewOnlyValue() {
|
|
1284
1357
|
return '-';
|
|
1285
1358
|
}
|
|
1286
1359
|
/**
|
|
1287
1360
|
* Uses the widget to determine the output string.
|
|
1288
|
-
*
|
|
1289
|
-
* @param
|
|
1290
|
-
* @
|
|
1361
|
+
* @param {any} value - The current value of the component.
|
|
1362
|
+
* @param {any} options - The options for getValueAsString.
|
|
1363
|
+
* @returns {any|Array<any>} - The value as a string.
|
|
1291
1364
|
*/
|
|
1292
1365
|
getWidgetValueAsString(value, options) {
|
|
1293
1366
|
const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
|
|
@@ -1312,6 +1385,12 @@ class Component extends Element_1.default {
|
|
|
1312
1385
|
const widget = this.refs.input[0].widget;
|
|
1313
1386
|
return widget.getValueAsString(value, options);
|
|
1314
1387
|
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Returns the value of the component as a string.
|
|
1390
|
+
* @param {any} value - The value for this component.
|
|
1391
|
+
* @param {any} options - The options for this component.
|
|
1392
|
+
* @returns {string} - The string representation of the value of this component.
|
|
1393
|
+
*/
|
|
1315
1394
|
getValueAsString(value, options) {
|
|
1316
1395
|
if (!value) {
|
|
1317
1396
|
return '';
|
|
@@ -1329,20 +1408,32 @@ class Component extends Element_1.default {
|
|
|
1329
1408
|
const stringValue = value.toString();
|
|
1330
1409
|
return this.sanitize(stringValue);
|
|
1331
1410
|
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Returns the string representation "view" of the component value.
|
|
1413
|
+
* @param {any} value - The value of the component.
|
|
1414
|
+
* @param {any} options - The options for this component.
|
|
1415
|
+
* @returns {string} - The string representation of the value of this component.
|
|
1416
|
+
*/
|
|
1332
1417
|
getView(value, options) {
|
|
1333
1418
|
if (this.component.protected) {
|
|
1334
1419
|
return '--- PROTECTED ---';
|
|
1335
1420
|
}
|
|
1336
1421
|
return this.getValueAsString(value, options);
|
|
1337
1422
|
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Updates the items list for this component. Useful for Select and other List component types.
|
|
1425
|
+
* @param {...any} args - The arguments to pass to the onChange event.
|
|
1426
|
+
* @returns {void}
|
|
1427
|
+
*/
|
|
1338
1428
|
updateItems(...args) {
|
|
1339
1429
|
this.restoreValue();
|
|
1340
1430
|
this.onChange(...args);
|
|
1341
1431
|
}
|
|
1342
1432
|
/**
|
|
1343
|
-
*
|
|
1344
|
-
* @param {
|
|
1345
|
-
* @
|
|
1433
|
+
* Returns the value for a specific item in a List type component.
|
|
1434
|
+
* @param {any} data - The data for this component.
|
|
1435
|
+
* @param {boolean} [forceUseValue] - if true, return 'value' property of the data
|
|
1436
|
+
* @returns {any} - The value of the item.
|
|
1346
1437
|
*/
|
|
1347
1438
|
itemValue(data, forceUseValue = false) {
|
|
1348
1439
|
if (lodash_1.default.isObject(data) && !lodash_1.default.isArray(data)) {
|
|
@@ -1355,6 +1446,11 @@ class Component extends Element_1.default {
|
|
|
1355
1446
|
}
|
|
1356
1447
|
return data;
|
|
1357
1448
|
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Returns the item value for html mode.
|
|
1451
|
+
* @param {any} value - The value for this component.
|
|
1452
|
+
* @returns {any} - The value of the item for html mode.
|
|
1453
|
+
*/
|
|
1358
1454
|
itemValueForHTMLMode(value) {
|
|
1359
1455
|
if (Array.isArray(value)) {
|
|
1360
1456
|
const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
@@ -1362,6 +1458,13 @@ class Component extends Element_1.default {
|
|
|
1362
1458
|
}
|
|
1363
1459
|
return this.itemValue(value);
|
|
1364
1460
|
}
|
|
1461
|
+
/**
|
|
1462
|
+
* Creates a modal to input the value of this component.
|
|
1463
|
+
* @param {HTMLElement} element - The element to attach the modal to.
|
|
1464
|
+
* @param {any} attr - A list of attributes to add to the modal.
|
|
1465
|
+
* @param {boolean} confirm - If we should add a confirmation to the modal that keeps it from closing unless confirmed.
|
|
1466
|
+
* @returns {HTMLElement} - The created modal element.
|
|
1467
|
+
*/
|
|
1365
1468
|
createModal(element, attr, confirm) {
|
|
1366
1469
|
const dialog = this.ce('div', attr || {});
|
|
1367
1470
|
this.setContent(dialog, this.renderTemplate('dialog'));
|
|
@@ -1397,6 +1500,10 @@ class Component extends Element_1.default {
|
|
|
1397
1500
|
this.addEventListener(dialog.refs.dialogClose, 'click', handleCloseClick);
|
|
1398
1501
|
return dialog;
|
|
1399
1502
|
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Uses CSS classes to show or hide an element.
|
|
1505
|
+
* @returns {boolean} - TRUE if the element has been css removed.
|
|
1506
|
+
*/
|
|
1400
1507
|
get optimizeRedraw() {
|
|
1401
1508
|
if (this.options.optimizeRedraw && this.element && !this.visible) {
|
|
1402
1509
|
this.addClass(this.element, 'formio-removed');
|
|
@@ -1434,7 +1541,7 @@ class Component extends Element_1.default {
|
|
|
1434
1541
|
}
|
|
1435
1542
|
/**
|
|
1436
1543
|
* Build the custom style from the layout values
|
|
1437
|
-
* @
|
|
1544
|
+
* @returns {string} - The custom style
|
|
1438
1545
|
*/
|
|
1439
1546
|
get customStyle() {
|
|
1440
1547
|
let customCSS = '';
|
|
@@ -1445,24 +1552,31 @@ class Component extends Element_1.default {
|
|
|
1445
1552
|
});
|
|
1446
1553
|
return customCSS;
|
|
1447
1554
|
}
|
|
1555
|
+
/**
|
|
1556
|
+
* Returns the component condition operator settings if available.
|
|
1557
|
+
* @returns {object} - The component condition operator settings.
|
|
1558
|
+
*/
|
|
1448
1559
|
static get serverConditionSettings() {
|
|
1449
1560
|
return Component.conditionOperatorsSettings;
|
|
1450
1561
|
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Returns if the application is on a mobile device.
|
|
1564
|
+
* @returns {boolean} - TRUE if the application is on a mobile device.
|
|
1565
|
+
*/
|
|
1451
1566
|
get isMobile() {
|
|
1452
1567
|
return (0, ismobilejs_1.default)();
|
|
1453
1568
|
}
|
|
1454
1569
|
/**
|
|
1455
1570
|
* Returns the outside wrapping element of this component.
|
|
1456
|
-
* @returns {HTMLElement}
|
|
1571
|
+
* @returns {HTMLElement} - The wrapping element of this component.
|
|
1457
1572
|
*/
|
|
1458
1573
|
getElement() {
|
|
1459
1574
|
return this.element;
|
|
1460
1575
|
}
|
|
1461
1576
|
/**
|
|
1462
1577
|
* Create an evaluation context for all script executions and interpolations.
|
|
1463
|
-
*
|
|
1464
|
-
* @
|
|
1465
|
-
* @return {*}
|
|
1578
|
+
* @param {any} additional - Additional context to provide.
|
|
1579
|
+
* @returns {any} - The evaluation context.
|
|
1466
1580
|
*/
|
|
1467
1581
|
evalContext(additional) {
|
|
1468
1582
|
return super.evalContext(Object.assign({
|
|
@@ -1484,18 +1598,29 @@ class Component extends Element_1.default {
|
|
|
1484
1598
|
}
|
|
1485
1599
|
/**
|
|
1486
1600
|
* Sets the pristine flag for this component.
|
|
1487
|
-
*
|
|
1488
|
-
* @param pristine {boolean} - TRUE to make pristine, FALSE not pristine.
|
|
1601
|
+
* @param {boolean} pristine - TRUE to make pristine, FALSE not pristine.
|
|
1489
1602
|
*/
|
|
1490
1603
|
setPristine(pristine) {
|
|
1491
1604
|
this.pristine = pristine;
|
|
1492
1605
|
}
|
|
1606
|
+
/**
|
|
1607
|
+
* Returns if the component is pristine.
|
|
1608
|
+
* @returns {boolean} - TRUE if the component is pristine.
|
|
1609
|
+
*/
|
|
1493
1610
|
get isPristine() {
|
|
1494
1611
|
return this.pristine;
|
|
1495
1612
|
}
|
|
1613
|
+
/**
|
|
1614
|
+
* Sets the dirty flag for this component.
|
|
1615
|
+
* @param {boolean} dirty - TRUE to make dirty, FALSE not dirty.
|
|
1616
|
+
*/
|
|
1496
1617
|
setDirty(dirty) {
|
|
1497
1618
|
this.dirty = dirty;
|
|
1498
1619
|
}
|
|
1620
|
+
/**
|
|
1621
|
+
* Returns if the component is dirty.
|
|
1622
|
+
* @returns {boolean} - TRUE if the component is dirty.
|
|
1623
|
+
*/
|
|
1499
1624
|
get isDirty() {
|
|
1500
1625
|
return this.dirty;
|
|
1501
1626
|
}
|
|
@@ -1509,12 +1634,23 @@ class Component extends Element_1.default {
|
|
|
1509
1634
|
this.restoreValue();
|
|
1510
1635
|
this.triggerRootChange();
|
|
1511
1636
|
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Returns the icon class for a given icon name.
|
|
1639
|
+
* @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.
|
|
1640
|
+
* @param {boolean} spinning - If the component should be spinning.
|
|
1641
|
+
* @returns {string} - The icon class for the equivalent icon in the iconset we are using.
|
|
1642
|
+
*/
|
|
1512
1643
|
iconClass(name, spinning) {
|
|
1513
1644
|
const iconset = this.options.iconset || Templates_1.default.current.defaultIconset || 'fa';
|
|
1514
1645
|
return Templates_1.default.current.hasOwnProperty('iconClass')
|
|
1515
1646
|
? Templates_1.default.current.iconClass(iconset, name, spinning)
|
|
1516
1647
|
: this.options.iconset === 'fa' ? Templates_1.default.defaultTemplates.iconClass(iconset, name, spinning) : name;
|
|
1517
1648
|
}
|
|
1649
|
+
/**
|
|
1650
|
+
* Returns the size css class names for our current template.
|
|
1651
|
+
* @param {string} size - The size class name for the default iconset.
|
|
1652
|
+
* @returns {string} - The size class for our component.
|
|
1653
|
+
*/
|
|
1518
1654
|
size(size) {
|
|
1519
1655
|
return Templates_1.default.current.hasOwnProperty('size')
|
|
1520
1656
|
? Templates_1.default.current.size(size)
|
|
@@ -1527,15 +1663,23 @@ class Component extends Element_1.default {
|
|
|
1527
1663
|
get name() {
|
|
1528
1664
|
return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
|
|
1529
1665
|
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Returns the visible errors for this component.
|
|
1668
|
+
* @returns {Array<object>} - The visible errors for this component.
|
|
1669
|
+
*/
|
|
1530
1670
|
get visibleErrors() {
|
|
1531
1671
|
return this._visibleErrors;
|
|
1532
1672
|
}
|
|
1673
|
+
/**
|
|
1674
|
+
* Returns all the errors for this component, visible or not.
|
|
1675
|
+
* @returns {Array<object>} - All the errors for this component.
|
|
1676
|
+
*/
|
|
1533
1677
|
get errors() {
|
|
1534
1678
|
return this._errors;
|
|
1535
1679
|
}
|
|
1536
1680
|
/**
|
|
1537
1681
|
* Returns the error label for this component.
|
|
1538
|
-
* @
|
|
1682
|
+
* @returns {string} - The error label for this component.
|
|
1539
1683
|
*/
|
|
1540
1684
|
get errorLabel() {
|
|
1541
1685
|
return this.t(this.component.errorLabel
|
|
@@ -1545,12 +1689,20 @@ class Component extends Element_1.default {
|
|
|
1545
1689
|
}
|
|
1546
1690
|
/**
|
|
1547
1691
|
* Get the error message provided a certain type of error.
|
|
1548
|
-
* @param type
|
|
1549
|
-
* @
|
|
1692
|
+
* @param {string} type - The type of error to fetch the message for.
|
|
1693
|
+
* @returns {string} - The error message configured for this component.
|
|
1550
1694
|
*/
|
|
1551
1695
|
errorMessage(type) {
|
|
1552
1696
|
return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
|
|
1553
1697
|
}
|
|
1698
|
+
/**
|
|
1699
|
+
* Sets the content, innerHTML, of an element to the sanitized content.
|
|
1700
|
+
* @param {HTMLElement} element - The element to set the innerHTML to.
|
|
1701
|
+
* @param {string} content - The HTML string content that we wish to set.
|
|
1702
|
+
* @param {boolean} forceSanitize - If we should force the content to be sanitized.
|
|
1703
|
+
* @param {any} sanitizeOptions - The options for the sanitize function.
|
|
1704
|
+
* @returns {boolean} - TRUE if the content was sanitized and set.
|
|
1705
|
+
*/
|
|
1554
1706
|
setContent(element, content, forceSanitize, sanitizeOptions) {
|
|
1555
1707
|
if (element instanceof HTMLElement) {
|
|
1556
1708
|
element.innerHTML = this.sanitize(content, forceSanitize, sanitizeOptions);
|
|
@@ -1558,6 +1710,9 @@ class Component extends Element_1.default {
|
|
|
1558
1710
|
}
|
|
1559
1711
|
return false;
|
|
1560
1712
|
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Restores the caret position in the input element after a refresh occurs.
|
|
1715
|
+
*/
|
|
1561
1716
|
restoreCaretPosition() {
|
|
1562
1717
|
var _a, _b, _c;
|
|
1563
1718
|
if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.currentSelection) {
|
|
@@ -1580,6 +1735,10 @@ class Component extends Element_1.default {
|
|
|
1580
1735
|
}
|
|
1581
1736
|
}
|
|
1582
1737
|
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Redraw the component.
|
|
1740
|
+
* @returns {Promise<void>} - A promise that resolves when the component is done redrawing.
|
|
1741
|
+
*/
|
|
1583
1742
|
redraw() {
|
|
1584
1743
|
// Don't bother if we have not built yet.
|
|
1585
1744
|
if (!this.element || !this.element.parentNode || this.optimizeRedraw) {
|
|
@@ -1592,32 +1751,57 @@ class Component extends Element_1.default {
|
|
|
1592
1751
|
const parent = this.element.parentNode;
|
|
1593
1752
|
const index = Array.prototype.indexOf.call(parent.children, this.element);
|
|
1594
1753
|
this.element.outerHTML = this.sanitize(this.render());
|
|
1595
|
-
this.
|
|
1754
|
+
this.element = parent.children[index];
|
|
1596
1755
|
return this.attach(this.element);
|
|
1597
1756
|
}
|
|
1757
|
+
/**
|
|
1758
|
+
* Rebuild and redraw a component.
|
|
1759
|
+
* @returns {Promise<void>} - A promise that resolves when the component is done rebuilding and redrawing.
|
|
1760
|
+
*/
|
|
1598
1761
|
rebuild() {
|
|
1599
1762
|
this.destroy();
|
|
1600
1763
|
this.init();
|
|
1601
1764
|
this.visible = this.conditionallyVisible(null, null);
|
|
1602
1765
|
return this.redraw();
|
|
1603
1766
|
}
|
|
1767
|
+
/**
|
|
1768
|
+
* Removes all event listeners attached to this component.
|
|
1769
|
+
*/
|
|
1604
1770
|
removeEventListeners() {
|
|
1605
1771
|
super.removeEventListeners();
|
|
1606
1772
|
this.tooltips.forEach(tooltip => tooltip.destroy());
|
|
1607
1773
|
this.tooltips = [];
|
|
1608
1774
|
}
|
|
1775
|
+
/**
|
|
1776
|
+
* Returns if the dom node has the classes provided.
|
|
1777
|
+
* @param {HTMLElement} element - The element to check for the class.
|
|
1778
|
+
* @param {string} className - The name of the class to check.
|
|
1779
|
+
* @returns {boolean|void} - TRUE if the element has the class.
|
|
1780
|
+
*/
|
|
1609
1781
|
hasClass(element, className) {
|
|
1610
1782
|
if (!element) {
|
|
1611
1783
|
return;
|
|
1612
1784
|
}
|
|
1613
1785
|
return super.hasClass(element, this.transform('class', className));
|
|
1614
1786
|
}
|
|
1787
|
+
/**
|
|
1788
|
+
* Adds a class to an HTML element.
|
|
1789
|
+
* @param {HTMLElement} element - The dom element to add the class to.
|
|
1790
|
+
* @param {string} className - The class name you wish to add.
|
|
1791
|
+
* @returns {this|void} - The component instance.
|
|
1792
|
+
*/
|
|
1615
1793
|
addClass(element, className) {
|
|
1616
1794
|
if (!element) {
|
|
1617
1795
|
return;
|
|
1618
1796
|
}
|
|
1619
1797
|
return super.addClass(element, this.transform('class', className));
|
|
1620
1798
|
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Removes a class from an element.
|
|
1801
|
+
* @param {HTMLElement} element - The element to remove the class from.
|
|
1802
|
+
* @param {string} className - The class name to remove.
|
|
1803
|
+
* @returns {this|void} - The component instance.
|
|
1804
|
+
*/
|
|
1621
1805
|
removeClass(element, className) {
|
|
1622
1806
|
if (!element) {
|
|
1623
1807
|
return;
|
|
@@ -1626,8 +1810,7 @@ class Component extends Element_1.default {
|
|
|
1626
1810
|
}
|
|
1627
1811
|
/**
|
|
1628
1812
|
* Determines if this component has a condition defined.
|
|
1629
|
-
*
|
|
1630
|
-
* @return {null}
|
|
1813
|
+
* @returns {boolean} - TRUE if the component has a condition defined.
|
|
1631
1814
|
*/
|
|
1632
1815
|
hasCondition() {
|
|
1633
1816
|
if (this._hasCondition !== null) {
|
|
@@ -1638,9 +1821,9 @@ class Component extends Element_1.default {
|
|
|
1638
1821
|
}
|
|
1639
1822
|
/**
|
|
1640
1823
|
* Check if this component is conditionally visible.
|
|
1641
|
-
*
|
|
1642
|
-
* @param data
|
|
1643
|
-
* @
|
|
1824
|
+
* @param {any} data - The data to check against.
|
|
1825
|
+
* @param {any} row - The row data to check against.
|
|
1826
|
+
* @returns {boolean} - TRUE if the component is conditionally visible.
|
|
1644
1827
|
*/
|
|
1645
1828
|
conditionallyVisible(data, row) {
|
|
1646
1829
|
data = data || this.rootValue;
|
|
@@ -1655,16 +1838,19 @@ class Component extends Element_1.default {
|
|
|
1655
1838
|
* Checks the condition of this component.
|
|
1656
1839
|
*
|
|
1657
1840
|
* TODO: Switch row and data parameters to be consistent with other methods.
|
|
1658
|
-
*
|
|
1659
|
-
* @param
|
|
1660
|
-
* @
|
|
1661
|
-
* @return {boolean} - True if the condition applies to this component.
|
|
1841
|
+
* @param {any} row - The row contextual data.
|
|
1842
|
+
* @param {any} data - The global data object.
|
|
1843
|
+
* @returns {boolean} - True if the condition applies to this component.
|
|
1662
1844
|
*/
|
|
1663
1845
|
checkCondition(row, data) {
|
|
1664
1846
|
return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
|
|
1665
1847
|
}
|
|
1666
1848
|
/**
|
|
1667
1849
|
* Check for conditionals and hide/show the element based on those conditions.
|
|
1850
|
+
* @param {any} data - The data to check against.
|
|
1851
|
+
* @param {any} flags - The flags passed to checkData function.
|
|
1852
|
+
* @param {any} row - The row data to check against.
|
|
1853
|
+
* @returns {boolean} - TRUE if the component is visible.
|
|
1668
1854
|
*/
|
|
1669
1855
|
checkComponentConditions(data, flags, row) {
|
|
1670
1856
|
data = data || this.rootValue;
|
|
@@ -1682,8 +1868,10 @@ class Component extends Element_1.default {
|
|
|
1682
1868
|
}
|
|
1683
1869
|
/**
|
|
1684
1870
|
* Checks conditions for this component and any sub components.
|
|
1685
|
-
* @param
|
|
1686
|
-
* @
|
|
1871
|
+
* @param {any} data - The data to check against.
|
|
1872
|
+
* @param {any} flags - The flags passed to checkData function.
|
|
1873
|
+
* @param {any} row - The row data to check against.
|
|
1874
|
+
* @returns {boolean} - TRUE if the component is visible.
|
|
1687
1875
|
*/
|
|
1688
1876
|
checkConditions(data, flags, row) {
|
|
1689
1877
|
data = data || this.rootValue;
|
|
@@ -1691,17 +1879,20 @@ class Component extends Element_1.default {
|
|
|
1691
1879
|
row = row || this.data;
|
|
1692
1880
|
return this.checkComponentConditions(data, flags, row);
|
|
1693
1881
|
}
|
|
1882
|
+
/**
|
|
1883
|
+
* Returns the component logic if applicable.
|
|
1884
|
+
* @returns {Array<object>} - The component logic.
|
|
1885
|
+
*/
|
|
1694
1886
|
get logic() {
|
|
1695
1887
|
return this.component.logic || [];
|
|
1696
1888
|
}
|
|
1697
1889
|
/**
|
|
1698
1890
|
* Check all triggers and apply necessary actions.
|
|
1699
|
-
*
|
|
1700
|
-
* @param data
|
|
1891
|
+
* @param {any} data - The data to check against.
|
|
1892
|
+
* @param {any} row - The row data to check against.
|
|
1893
|
+
* @returns {boolean|void} - TRUE if the component was altered.
|
|
1701
1894
|
*/
|
|
1702
|
-
fieldLogic(data, row) {
|
|
1703
|
-
data = data || this.rootValue;
|
|
1704
|
-
row = row || this.data;
|
|
1895
|
+
fieldLogic(data = this.rootValue, row = this.data) {
|
|
1705
1896
|
const logics = this.logic;
|
|
1706
1897
|
// If there aren't logic, don't go further.
|
|
1707
1898
|
if (logics.length === 0) {
|
|
@@ -1724,6 +1915,10 @@ class Component extends Element_1.default {
|
|
|
1724
1915
|
}
|
|
1725
1916
|
return changed;
|
|
1726
1917
|
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Retuns if the browser is Internet Explorer.
|
|
1920
|
+
* @returns {boolean} - TRUE if the browser is IE.
|
|
1921
|
+
*/
|
|
1727
1922
|
isIE() {
|
|
1728
1923
|
if (typeof window === 'undefined') {
|
|
1729
1924
|
return false;
|
|
@@ -1748,9 +1943,24 @@ class Component extends Element_1.default {
|
|
|
1748
1943
|
// other browser
|
|
1749
1944
|
return false;
|
|
1750
1945
|
}
|
|
1946
|
+
/**
|
|
1947
|
+
* Defines the logic action value through evaluation.
|
|
1948
|
+
* @param {object} action - The action within the Logic system to perform.
|
|
1949
|
+
* @param {object} argsObject - The arguments to pass to the evaluation.
|
|
1950
|
+
* @returns {any} - The result of the evaluation.
|
|
1951
|
+
*/
|
|
1751
1952
|
defineActionValue(action, argsObject) {
|
|
1752
1953
|
return this.evaluate(action.value, argsObject, 'value');
|
|
1753
1954
|
}
|
|
1955
|
+
/**
|
|
1956
|
+
* Apply the actions of Logic for a component once the conditions have been met.
|
|
1957
|
+
* @param {object} newComponent - The new component to apply the actions to.
|
|
1958
|
+
* @param {Array<object>} actions - An array of actions
|
|
1959
|
+
* @param {any} result - The result of the conditional check in order to evaluate the actions.
|
|
1960
|
+
* @param {any} row - The contextual row data for this component.
|
|
1961
|
+
* @param {any} data - The global data object for the submission.
|
|
1962
|
+
* @returns {boolean} - TRUE if the component was altered.
|
|
1963
|
+
*/
|
|
1754
1964
|
applyActions(newComponent, actions, result, row, data) {
|
|
1755
1965
|
data = data || this.rootValue;
|
|
1756
1966
|
row = row || this.data;
|
|
@@ -1830,8 +2040,8 @@ class Component extends Element_1.default {
|
|
|
1830
2040
|
}
|
|
1831
2041
|
/**
|
|
1832
2042
|
* Add a new input error to this element.
|
|
1833
|
-
*
|
|
1834
|
-
* @
|
|
2043
|
+
* @param {Array<object>|string} messages - An array of messages to add to the element.
|
|
2044
|
+
* @returns {void}
|
|
1835
2045
|
*/
|
|
1836
2046
|
addMessages(messages) {
|
|
1837
2047
|
if (!messages) {
|
|
@@ -1850,13 +2060,19 @@ class Component extends Element_1.default {
|
|
|
1850
2060
|
messages = lodash_1.default.uniqBy(messages, message => message.message);
|
|
1851
2061
|
if (this.refs.messageContainer) {
|
|
1852
2062
|
this.setContent(this.refs.messageContainer, messages.map((message) => {
|
|
1853
|
-
if (message.message && typeof message.message === 'string') {
|
|
1854
|
-
message.message = message.message.replaceAll('<', '<').replaceAll('>', '>');
|
|
1855
|
-
}
|
|
1856
2063
|
return this.renderTemplate('message', Object.assign({}, message));
|
|
1857
2064
|
}).join(''));
|
|
1858
2065
|
}
|
|
1859
2066
|
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Sets the form input widget error classes.
|
|
2069
|
+
* @param {Array<HTMLElement>} elements - An array of DOM elements to set the error classes on.
|
|
2070
|
+
* @param {boolean} dirty - If the input is dirty.
|
|
2071
|
+
* @param {boolean} hasErrors - If the input has errors.
|
|
2072
|
+
* @param {boolean} hasMessages - If the input has messages.
|
|
2073
|
+
* @param {HTMLElement} element - The wrapper element for all the other elements passed in first argument.
|
|
2074
|
+
* @returns {void}
|
|
2075
|
+
*/
|
|
1860
2076
|
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
1861
2077
|
this.clearErrorClasses();
|
|
1862
2078
|
elements.forEach((element) => {
|
|
@@ -1883,6 +2099,12 @@ class Component extends Element_1.default {
|
|
|
1883
2099
|
this.addClass(element, 'has-message');
|
|
1884
2100
|
}
|
|
1885
2101
|
}
|
|
2102
|
+
/**
|
|
2103
|
+
* Adds the classes necessary to mark an element as invalid.
|
|
2104
|
+
* @param {HTMLElement} element - The element you wish to add the invalid classes to.
|
|
2105
|
+
* @param {boolean} invalid - TRUE if the component is invalid, FALSE otherwise.
|
|
2106
|
+
* @returns {void}
|
|
2107
|
+
*/
|
|
1886
2108
|
setElementInvalid(element, invalid) {
|
|
1887
2109
|
if (!element)
|
|
1888
2110
|
return;
|
|
@@ -1894,6 +2116,9 @@ class Component extends Element_1.default {
|
|
|
1894
2116
|
}
|
|
1895
2117
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
|
1896
2118
|
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
|
2121
|
+
*/
|
|
1897
2122
|
clearOnHide() {
|
|
1898
2123
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
1899
2124
|
if (
|
|
@@ -1913,6 +2138,10 @@ class Component extends Element_1.default {
|
|
|
1913
2138
|
}
|
|
1914
2139
|
}
|
|
1915
2140
|
}
|
|
2141
|
+
/**
|
|
2142
|
+
* Triggers a debounced onChange event for the root component (usually Webform).
|
|
2143
|
+
* @param {...any} args - The arguments to pass to the onChange event.
|
|
2144
|
+
*/
|
|
1916
2145
|
triggerRootChange(...args) {
|
|
1917
2146
|
if (this.options.onChange) {
|
|
1918
2147
|
this.options.onChange(...args);
|
|
@@ -1921,6 +2150,13 @@ class Component extends Element_1.default {
|
|
|
1921
2150
|
this.root.triggerChange(...args);
|
|
1922
2151
|
}
|
|
1923
2152
|
}
|
|
2153
|
+
/**
|
|
2154
|
+
* Called when the component value has been changed. This will then trigger the root level onChange handler which
|
|
2155
|
+
* propagates the checkData methods for the full component tree.
|
|
2156
|
+
* @param {any} flags - The flags for the change event propagation.
|
|
2157
|
+
* @param {boolean} fromRoot - If the change event is from the root component.
|
|
2158
|
+
* @returns {boolean} - TRUE if the component has changed.
|
|
2159
|
+
*/
|
|
1924
2160
|
onChange(flags, fromRoot) {
|
|
1925
2161
|
flags = flags || {};
|
|
1926
2162
|
if (flags.modified) {
|
|
@@ -2050,7 +2286,7 @@ class Component extends Element_1.default {
|
|
|
2050
2286
|
return Promise.reject();
|
|
2051
2287
|
}
|
|
2052
2288
|
this.quill = new Quill(element, isIEBrowser ? Object.assign(Object.assign({}, settings), { modules: {} }) : settings);
|
|
2053
|
-
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ
|
|
2289
|
+
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ */
|
|
2054
2290
|
const txtArea = document.createElement('textarea');
|
|
2055
2291
|
txtArea.setAttribute('class', 'quill-source-code');
|
|
2056
2292
|
this.quill.addContainer('ql-custom').appendChild(txtArea);
|
|
@@ -2064,7 +2300,7 @@ class Component extends Element_1.default {
|
|
|
2064
2300
|
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2065
2301
|
});
|
|
2066
2302
|
}
|
|
2067
|
-
/** END CODEBLOCK
|
|
2303
|
+
/** END CODEBLOCK */
|
|
2068
2304
|
// Make sure to select cursor when they click on the element.
|
|
2069
2305
|
this.addEventListener(element, 'click', () => this.quill.focus());
|
|
2070
2306
|
// Allows users to skip toolbar items when tabbing though form
|
|
@@ -2112,23 +2348,22 @@ class Component extends Element_1.default {
|
|
|
2112
2348
|
}
|
|
2113
2349
|
/**
|
|
2114
2350
|
* The empty value for this component.
|
|
2115
|
-
*
|
|
2116
|
-
* @return {null}
|
|
2351
|
+
* @returns {null} - The empty value for this component.
|
|
2117
2352
|
*/
|
|
2118
2353
|
get emptyValue() {
|
|
2119
2354
|
return null;
|
|
2120
2355
|
}
|
|
2121
2356
|
/**
|
|
2122
2357
|
* Returns if this component has a value set.
|
|
2123
|
-
*
|
|
2358
|
+
* @param {any} data - The global data object.
|
|
2359
|
+
* @returns {boolean} - TRUE if a value is set.
|
|
2124
2360
|
*/
|
|
2125
2361
|
hasValue(data) {
|
|
2126
2362
|
return !lodash_1.default.isUndefined(lodash_1.default.get(data || this.data, this.key));
|
|
2127
2363
|
}
|
|
2128
2364
|
/**
|
|
2129
2365
|
* Get the data value at the root level.
|
|
2130
|
-
*
|
|
2131
|
-
* @return {*}
|
|
2366
|
+
* @returns {*} - The root value for the component, typically the Webform data object.
|
|
2132
2367
|
*/
|
|
2133
2368
|
get rootValue() {
|
|
2134
2369
|
return this.root ? this.root.data : this.data;
|
|
@@ -2138,7 +2373,7 @@ class Component extends Element_1.default {
|
|
|
2138
2373
|
}
|
|
2139
2374
|
/**
|
|
2140
2375
|
* Get the static value of this component.
|
|
2141
|
-
* @
|
|
2376
|
+
* @returns {*} - The value for this component.
|
|
2142
2377
|
*/
|
|
2143
2378
|
get dataValue() {
|
|
2144
2379
|
if (!this.key ||
|
|
@@ -2156,8 +2391,7 @@ class Component extends Element_1.default {
|
|
|
2156
2391
|
}
|
|
2157
2392
|
/**
|
|
2158
2393
|
* Sets the static value of this component.
|
|
2159
|
-
*
|
|
2160
|
-
* @param value
|
|
2394
|
+
* @param {*} value - The value to set for this component.
|
|
2161
2395
|
*/
|
|
2162
2396
|
set dataValue(value) {
|
|
2163
2397
|
if (!this.allowData ||
|
|
@@ -2177,8 +2411,8 @@ class Component extends Element_1.default {
|
|
|
2177
2411
|
}
|
|
2178
2412
|
/**
|
|
2179
2413
|
* Splice a value from the dataValue.
|
|
2180
|
-
*
|
|
2181
|
-
* @param
|
|
2414
|
+
* @param {number} index - The index to splice for an array component values.
|
|
2415
|
+
* @param {*} flags - The flags to use when splicing the value.
|
|
2182
2416
|
*/
|
|
2183
2417
|
splice(index, flags = {}) {
|
|
2184
2418
|
if (this.hasValue()) {
|
|
@@ -2246,8 +2480,7 @@ class Component extends Element_1.default {
|
|
|
2246
2480
|
}
|
|
2247
2481
|
/**
|
|
2248
2482
|
* Get the input value of this component.
|
|
2249
|
-
*
|
|
2250
|
-
* @return {*}
|
|
2483
|
+
* @returns {*} - The value for the component.
|
|
2251
2484
|
*/
|
|
2252
2485
|
getValue() {
|
|
2253
2486
|
if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
@@ -2269,9 +2502,8 @@ class Component extends Element_1.default {
|
|
|
2269
2502
|
}
|
|
2270
2503
|
/**
|
|
2271
2504
|
* Get the value at a specific index.
|
|
2272
|
-
*
|
|
2273
|
-
* @
|
|
2274
|
-
* @returns {*}
|
|
2505
|
+
* @param {number} index - For an array component or multiple values, this returns the value at a specific index.
|
|
2506
|
+
* @returns {*} - The value at the specified index.
|
|
2275
2507
|
*/
|
|
2276
2508
|
getValueAt(index) {
|
|
2277
2509
|
const input = this.performInputMapping(this.refs.input[index]);
|
|
@@ -2279,11 +2511,9 @@ class Component extends Element_1.default {
|
|
|
2279
2511
|
}
|
|
2280
2512
|
/**
|
|
2281
2513
|
* Set the value of this component.
|
|
2282
|
-
*
|
|
2283
|
-
* @param value
|
|
2284
|
-
* @
|
|
2285
|
-
*
|
|
2286
|
-
* @return {boolean} - If the value changed.
|
|
2514
|
+
* @param {*} value - The value to set for this component.
|
|
2515
|
+
* @param {*} flags - The flags to use when setting the value.
|
|
2516
|
+
* @returns {boolean} - If the value changed.
|
|
2287
2517
|
*/
|
|
2288
2518
|
setValue(value, flags = {}) {
|
|
2289
2519
|
const changed = this.updateValue(value, flags);
|
|
@@ -2314,9 +2544,9 @@ class Component extends Element_1.default {
|
|
|
2314
2544
|
}
|
|
2315
2545
|
/**
|
|
2316
2546
|
* Set the value at a specific index.
|
|
2317
|
-
*
|
|
2318
|
-
* @param index
|
|
2319
|
-
* @param value
|
|
2547
|
+
* @param {number} index - The index to set the value at.
|
|
2548
|
+
* @param {*} value - The value to set at the specified index.
|
|
2549
|
+
* @param {*} flags - The flags to use when setting the value.
|
|
2320
2550
|
*/
|
|
2321
2551
|
setValueAt(index, value, flags = {}) {
|
|
2322
2552
|
if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
|
|
@@ -2363,9 +2593,8 @@ class Component extends Element_1.default {
|
|
|
2363
2593
|
}
|
|
2364
2594
|
/**
|
|
2365
2595
|
* Normalize values coming into updateValue.
|
|
2366
|
-
*
|
|
2367
|
-
* @
|
|
2368
|
-
* @return {*}
|
|
2596
|
+
* @param {*} value - The value to normalize before setting.
|
|
2597
|
+
* @returns {*} - The normalized value.
|
|
2369
2598
|
*/
|
|
2370
2599
|
normalizeValue(value) {
|
|
2371
2600
|
if (this.component.multiple && !Array.isArray(value)) {
|
|
@@ -2375,8 +2604,9 @@ class Component extends Element_1.default {
|
|
|
2375
2604
|
}
|
|
2376
2605
|
/**
|
|
2377
2606
|
* Update a value of this component.
|
|
2378
|
-
*
|
|
2379
|
-
* @param flags
|
|
2607
|
+
* @param {*} value - The value to update.
|
|
2608
|
+
* @param {*} flags - The flags to use when updating the value.
|
|
2609
|
+
* @returns {boolean} - If the value changed.
|
|
2380
2610
|
*/
|
|
2381
2611
|
updateComponentValue(value, flags = {}) {
|
|
2382
2612
|
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
@@ -2395,9 +2625,8 @@ class Component extends Element_1.default {
|
|
|
2395
2625
|
}
|
|
2396
2626
|
/**
|
|
2397
2627
|
* Updates the value of this component plus all sub-components.
|
|
2398
|
-
*
|
|
2399
|
-
* @
|
|
2400
|
-
* @return {boolean}
|
|
2628
|
+
* @param {...any} args - The arguments to pass to updateValue.
|
|
2629
|
+
* @returns {boolean} - If the value changed.
|
|
2401
2630
|
*/
|
|
2402
2631
|
updateValue(...args) {
|
|
2403
2632
|
return this.updateComponentValue(...args);
|
|
@@ -2415,7 +2644,7 @@ class Component extends Element_1.default {
|
|
|
2415
2644
|
*/
|
|
2416
2645
|
resetValue() {
|
|
2417
2646
|
this.unset();
|
|
2418
|
-
this.setValue(this.emptyValue, {
|
|
2647
|
+
this.setValue(this.defaultValue || this.emptyValue, {
|
|
2419
2648
|
noUpdateEvent: true,
|
|
2420
2649
|
noValidate: true,
|
|
2421
2650
|
resetValue: true
|
|
@@ -2423,10 +2652,9 @@ class Component extends Element_1.default {
|
|
|
2423
2652
|
}
|
|
2424
2653
|
/**
|
|
2425
2654
|
* Determine if the value of this component has changed.
|
|
2426
|
-
*
|
|
2427
|
-
* @param
|
|
2428
|
-
* @
|
|
2429
|
-
* @return {boolean}
|
|
2655
|
+
* @param {*} newValue - The new value to check.
|
|
2656
|
+
* @param {*} oldValue - The existing value of the component.
|
|
2657
|
+
* @returns {boolean} - TRUE if the value has changed.
|
|
2430
2658
|
*/
|
|
2431
2659
|
hasChanged(newValue, oldValue) {
|
|
2432
2660
|
if (((newValue === undefined) || (newValue === null)) &&
|
|
@@ -2444,8 +2672,9 @@ class Component extends Element_1.default {
|
|
|
2444
2672
|
}
|
|
2445
2673
|
/**
|
|
2446
2674
|
* Update the value on change.
|
|
2447
|
-
*
|
|
2448
|
-
* @param
|
|
2675
|
+
* @param {*} flags - The flags to use when triggering the on change event.
|
|
2676
|
+
* @param {boolean} changed - If the value has changed.
|
|
2677
|
+
* @returns {boolean} - If the value changed.
|
|
2449
2678
|
*/
|
|
2450
2679
|
updateOnChange(flags = {}, changed = false) {
|
|
2451
2680
|
if (!flags.noUpdateEvent && changed) {
|
|
@@ -2458,13 +2687,6 @@ class Component extends Element_1.default {
|
|
|
2458
2687
|
}
|
|
2459
2688
|
return false;
|
|
2460
2689
|
}
|
|
2461
|
-
/**
|
|
2462
|
-
* Perform a calculated value operation.
|
|
2463
|
-
*
|
|
2464
|
-
* @param data - The global data object.
|
|
2465
|
-
*
|
|
2466
|
-
* @return {boolean} - If the value changed during calculation.
|
|
2467
|
-
*/
|
|
2468
2690
|
convertNumberOrBoolToString(value) {
|
|
2469
2691
|
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
2470
2692
|
return value.toString();
|
|
@@ -2562,7 +2784,7 @@ class Component extends Element_1.default {
|
|
|
2562
2784
|
}
|
|
2563
2785
|
this.calculatedValue = (0, utils_1.fastCloneDeep)(calculatedValue);
|
|
2564
2786
|
if (changed) {
|
|
2565
|
-
if (!flags.noPristineChangeOnModified) {
|
|
2787
|
+
if (!flags.noPristineChangeOnModified && this.root.initialized) {
|
|
2566
2788
|
this.pristine = false;
|
|
2567
2789
|
}
|
|
2568
2790
|
flags.triggeredComponentId = this.id;
|
|
@@ -2573,9 +2795,10 @@ class Component extends Element_1.default {
|
|
|
2573
2795
|
/* eslint-enable max-statements */
|
|
2574
2796
|
/**
|
|
2575
2797
|
* Performs calculations in this component plus any child components.
|
|
2576
|
-
*
|
|
2577
|
-
* @param
|
|
2578
|
-
* @
|
|
2798
|
+
* @param {*} data - The data to perform the calculation with.
|
|
2799
|
+
* @param {*} flags - The flags to use when calculating the value.
|
|
2800
|
+
* @param {*} row - The contextual row data to use when performing the calculation.
|
|
2801
|
+
* @returns {boolean} - TRUE if the value changed.
|
|
2579
2802
|
*/
|
|
2580
2803
|
calculateValue(data, flags, row) {
|
|
2581
2804
|
data = data || this.rootValue;
|
|
@@ -2585,15 +2808,14 @@ class Component extends Element_1.default {
|
|
|
2585
2808
|
}
|
|
2586
2809
|
/**
|
|
2587
2810
|
* Get this component's label text.
|
|
2588
|
-
*
|
|
2811
|
+
* @returns {string} - The label text for this component.
|
|
2589
2812
|
*/
|
|
2590
2813
|
get label() {
|
|
2591
2814
|
return this.component.label;
|
|
2592
2815
|
}
|
|
2593
2816
|
/**
|
|
2594
2817
|
* Set this component's label text and render it.
|
|
2595
|
-
*
|
|
2596
|
-
* @param value - The new label text.
|
|
2818
|
+
* @param {string} value - The new label text.
|
|
2597
2819
|
*/
|
|
2598
2820
|
set label(value) {
|
|
2599
2821
|
this.component.label = value;
|
|
@@ -2603,17 +2825,18 @@ class Component extends Element_1.default {
|
|
|
2603
2825
|
}
|
|
2604
2826
|
/**
|
|
2605
2827
|
* Get FormioForm element at the root of this component tree.
|
|
2606
|
-
*
|
|
2828
|
+
* @returns {*} root - The root component to search from.
|
|
2607
2829
|
*/
|
|
2608
2830
|
getRoot() {
|
|
2609
2831
|
return this.root;
|
|
2610
2832
|
}
|
|
2611
2833
|
/**
|
|
2612
2834
|
* Returns the invalid message, or empty string if the component is valid.
|
|
2613
|
-
*
|
|
2614
|
-
* @param
|
|
2615
|
-
* @param
|
|
2616
|
-
* @
|
|
2835
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2836
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2837
|
+
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
|
2838
|
+
* @param {*} row - Contextual row data for this component.
|
|
2839
|
+
* @returns {string} - The message to show when the component is invalid.
|
|
2617
2840
|
*/
|
|
2618
2841
|
invalidMessage(data, dirty, ignoreCondition, row) {
|
|
2619
2842
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
|
@@ -2645,10 +2868,9 @@ class Component extends Element_1.default {
|
|
|
2645
2868
|
}
|
|
2646
2869
|
/**
|
|
2647
2870
|
* Returns if the component is valid or not.
|
|
2648
|
-
*
|
|
2649
|
-
* @param
|
|
2650
|
-
* @
|
|
2651
|
-
* @return {boolean}
|
|
2871
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2872
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2873
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2652
2874
|
*/
|
|
2653
2875
|
isValid(data, dirty) {
|
|
2654
2876
|
return !this.invalidMessage(data, dirty);
|
|
@@ -2667,8 +2889,8 @@ class Component extends Element_1.default {
|
|
|
2667
2889
|
}
|
|
2668
2890
|
/**
|
|
2669
2891
|
* Interpolate errors from the validation methods.
|
|
2670
|
-
* @param {
|
|
2671
|
-
* @returns
|
|
2892
|
+
* @param {Array<any>} errors - An array of errors to interpolate.
|
|
2893
|
+
* @returns {Array<any>} - The interpolated errors.
|
|
2672
2894
|
*/
|
|
2673
2895
|
interpolateErrors(errors) {
|
|
2674
2896
|
var _a;
|
|
@@ -2681,7 +2903,7 @@ class Component extends Element_1.default {
|
|
|
2681
2903
|
* @param {*} data - The root submission data.
|
|
2682
2904
|
* @param {*} row - The contextual row data.
|
|
2683
2905
|
* @param {*} flags - The flags to perform validation.
|
|
2684
|
-
* @returns
|
|
2906
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2685
2907
|
*/
|
|
2686
2908
|
showValidationErrors(errors, data, row, flags) {
|
|
2687
2909
|
if (flags.silentCheck) {
|
|
@@ -2701,9 +2923,9 @@ class Component extends Element_1.default {
|
|
|
2701
2923
|
* @param {*} data - The root data you wish to use for this component.
|
|
2702
2924
|
* @param {*} row - The contextual row data you wish to use for this component.
|
|
2703
2925
|
* @param {*} flags - The flags to control the behavior of the validation.
|
|
2704
|
-
* @returns
|
|
2926
|
+
* @returns {Array<any>} - An array of errors if the component is invalid.
|
|
2705
2927
|
*/
|
|
2706
|
-
validateComponent(data, row, flags = {}) {
|
|
2928
|
+
validateComponent(data = null, row = null, flags = {}) {
|
|
2707
2929
|
data = data || this.rootValue;
|
|
2708
2930
|
row = row || this.data;
|
|
2709
2931
|
const { async = false } = flags;
|
|
@@ -2734,13 +2956,14 @@ class Component extends Element_1.default {
|
|
|
2734
2956
|
}
|
|
2735
2957
|
/**
|
|
2736
2958
|
* Checks the validity of this component and sets the error message if it is invalid.
|
|
2737
|
-
*
|
|
2738
|
-
* @param
|
|
2739
|
-
* @param
|
|
2740
|
-
* @param
|
|
2741
|
-
* @
|
|
2742
|
-
|
|
2743
|
-
|
|
2959
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2960
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2961
|
+
* @param {*} row - The contextual row data for this component.
|
|
2962
|
+
* @param {*} flags - The flags to use when checking the validity.
|
|
2963
|
+
* @param {Array<any>} allErrors - An array of all errors that have occured so that it can be appended when another one occurs here.
|
|
2964
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2965
|
+
*/
|
|
2966
|
+
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
2744
2967
|
data = data || this.rootValue;
|
|
2745
2968
|
row = row || this.data;
|
|
2746
2969
|
flags.dirty = dirty || false;
|
|
@@ -2776,32 +2999,30 @@ class Component extends Element_1.default {
|
|
|
2776
2999
|
}
|
|
2777
3000
|
/**
|
|
2778
3001
|
* Checks the validity of the component.
|
|
2779
|
-
* @param {*} data
|
|
2780
|
-
* @param {
|
|
2781
|
-
* @param {*} row
|
|
2782
|
-
* @param {
|
|
2783
|
-
* @
|
|
2784
|
-
|
|
2785
|
-
|
|
3002
|
+
* @param {*} data - The data to check if the component is valid.
|
|
3003
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
3004
|
+
* @param {*} row - The contextual row data for this component.
|
|
3005
|
+
* @param {boolean} silentCheck - If the check should be silent and not set the error messages.
|
|
3006
|
+
* @param {Array<any>} errors - An array of all errors that have occured so that it can be appended when another one occurs here.
|
|
3007
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
3008
|
+
*/
|
|
3009
|
+
checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2786
3010
|
data = data || this.rootValue;
|
|
2787
3011
|
row = row || this.data;
|
|
2788
|
-
console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
2789
3012
|
return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
|
|
2790
3013
|
}
|
|
2791
|
-
checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
|
|
2792
|
-
console.log('Deprecation warning: Component.checkAsyncValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3014
|
+
checkAsyncValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2793
3015
|
return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
|
|
2794
3016
|
}
|
|
2795
3017
|
/**
|
|
2796
3018
|
* Check the conditions, calculations, and validity of a single component and triggers an update if
|
|
2797
3019
|
* something changed.
|
|
2798
|
-
*
|
|
2799
|
-
* @param
|
|
2800
|
-
* @param
|
|
2801
|
-
*
|
|
2802
|
-
* @return boolean - If component is valid or not.
|
|
3020
|
+
* @param {*} data - The root data of the change event.
|
|
3021
|
+
* @param {*} flags - The flags from this change event.
|
|
3022
|
+
* @param {*} row - The contextual row data for this component.
|
|
3023
|
+
* @returns {void|boolean} - TRUE if no check should be performed on the component.
|
|
2803
3024
|
*/
|
|
2804
|
-
checkData(data, flags, row) {
|
|
3025
|
+
checkData(data = null, flags = null, row = null) {
|
|
2805
3026
|
data = data || this.rootValue;
|
|
2806
3027
|
flags = flags || {};
|
|
2807
3028
|
row = row || this.data;
|
|
@@ -2844,8 +3065,7 @@ class Component extends Element_1.default {
|
|
|
2844
3065
|
}
|
|
2845
3066
|
/**
|
|
2846
3067
|
* Check if a component is eligible for multiple validation
|
|
2847
|
-
*
|
|
2848
|
-
* @return {boolean}
|
|
3068
|
+
* @returns {boolean} - TRUE if the component is eligible for multiple validation.
|
|
2849
3069
|
*/
|
|
2850
3070
|
validateMultiple() {
|
|
2851
3071
|
return true;
|
|
@@ -2965,8 +3185,7 @@ class Component extends Element_1.default {
|
|
|
2965
3185
|
/**
|
|
2966
3186
|
* Determines if the value of this component is hidden from the user as if it is coming from the server, but is
|
|
2967
3187
|
* protected.
|
|
2968
|
-
*
|
|
2969
|
-
* @return {boolean|*}
|
|
3188
|
+
* @returns {boolean|*} - TRUE if the value is hidden.
|
|
2970
3189
|
*/
|
|
2971
3190
|
isValueHidden() {
|
|
2972
3191
|
if (this.component.protected && this.root.editing) {
|
|
@@ -3011,6 +3230,8 @@ class Component extends Element_1.default {
|
|
|
3011
3230
|
}
|
|
3012
3231
|
/**
|
|
3013
3232
|
* Prints out the value of this component as a string value.
|
|
3233
|
+
* @param {*} value - The value to print out.
|
|
3234
|
+
* @returns {string} - The string representation of the value.
|
|
3014
3235
|
*/
|
|
3015
3236
|
asString(value) {
|
|
3016
3237
|
value = value || this.getValue();
|
|
@@ -3018,15 +3239,14 @@ class Component extends Element_1.default {
|
|
|
3018
3239
|
}
|
|
3019
3240
|
/**
|
|
3020
3241
|
* Return if the component is disabled.
|
|
3021
|
-
* @
|
|
3242
|
+
* @returns {boolean} - TRUE if the component is disabled.
|
|
3022
3243
|
*/
|
|
3023
3244
|
get disabled() {
|
|
3024
3245
|
return this._disabled || this.parentDisabled;
|
|
3025
3246
|
}
|
|
3026
3247
|
/**
|
|
3027
3248
|
* Disable this component.
|
|
3028
|
-
*
|
|
3029
|
-
* @param {boolean} disabled
|
|
3249
|
+
* @param {boolean} disabled - TRUE to disable the component.
|
|
3030
3250
|
*/
|
|
3031
3251
|
set disabled(disabled) {
|
|
3032
3252
|
this._disabled = disabled;
|
|
@@ -3137,6 +3357,10 @@ class Component extends Element_1.default {
|
|
|
3137
3357
|
const disabled = this.shouldDisabled;
|
|
3138
3358
|
// Change states which won't be recalculated during redrawing
|
|
3139
3359
|
if (this.visible !== visible) {
|
|
3360
|
+
// If the logic is triggered by an event and the action sets the hidden state then the original
|
|
3361
|
+
// component definition must be changed so that the components hidden state does not get flipped back by
|
|
3362
|
+
// the fieldLogic function
|
|
3363
|
+
this.originalComponent.hidden = !visible;
|
|
3140
3364
|
this.visible = visible;
|
|
3141
3365
|
}
|
|
3142
3366
|
if (this.disabled !== disabled) {
|
|
@@ -3151,6 +3375,7 @@ class Component extends Element_1.default {
|
|
|
3151
3375
|
}
|
|
3152
3376
|
/**
|
|
3153
3377
|
* Get the element information.
|
|
3378
|
+
* @returns {*} - The components "input" DOM element information.
|
|
3154
3379
|
*/
|
|
3155
3380
|
elementInfo() {
|
|
3156
3381
|
const attributes = {
|
|
@@ -3189,15 +3414,13 @@ class Component extends Element_1.default {
|
|
|
3189
3414
|
const { left, top } = element.getBoundingClientRect();
|
|
3190
3415
|
window.scrollTo(left + window.scrollX, top + window.scrollY);
|
|
3191
3416
|
}
|
|
3192
|
-
focus(index) {
|
|
3417
|
+
focus(index = (this.refs.input.length - 1)) {
|
|
3193
3418
|
var _a, _b;
|
|
3194
3419
|
if ('beforeFocus' in this.parent) {
|
|
3195
3420
|
this.parent.beforeFocus(this);
|
|
3196
3421
|
}
|
|
3197
3422
|
if ((_a = this.refs.input) === null || _a === void 0 ? void 0 : _a.length) {
|
|
3198
|
-
const focusingInput =
|
|
3199
|
-
? this.refs.input[index]
|
|
3200
|
-
: this.refs.input[this.refs.input.length - 1];
|
|
3423
|
+
const focusingInput = this.refs.input[index];
|
|
3201
3424
|
if (((_b = this.component.widget) === null || _b === void 0 ? void 0 : _b.type) === 'calendar') {
|
|
3202
3425
|
const sibling = focusingInput.nextSibling;
|
|
3203
3426
|
if (sibling) {
|
|
@@ -3217,6 +3440,7 @@ class Component extends Element_1.default {
|
|
|
3217
3440
|
}
|
|
3218
3441
|
/**
|
|
3219
3442
|
* Get `Formio` instance for working with files
|
|
3443
|
+
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
|
3220
3444
|
*/
|
|
3221
3445
|
get fileService() {
|
|
3222
3446
|
if (this.options.fileService) {
|
|
@@ -3256,7 +3480,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3256
3480
|
}.bind(Component.externalLibraries[name]);
|
|
3257
3481
|
}
|
|
3258
3482
|
// See if the plugin already exists.
|
|
3259
|
-
const plugin =
|
|
3483
|
+
const plugin = (0, utils_1.getScriptPlugin)(property);
|
|
3260
3484
|
if (plugin) {
|
|
3261
3485
|
Component.externalLibraries[name].resolve(plugin);
|
|
3262
3486
|
}
|
|
@@ -3299,7 +3523,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3299
3523
|
// if no callback is provided, then check periodically for the script.
|
|
3300
3524
|
if (polling) {
|
|
3301
3525
|
setTimeout(function checkLibrary() {
|
|
3302
|
-
const plugin =
|
|
3526
|
+
const plugin = (0, utils_1.getScriptPlugin)(property);
|
|
3303
3527
|
if (plugin) {
|
|
3304
3528
|
Component.externalLibraries[name].resolve(plugin);
|
|
3305
3529
|
}
|