@formio/js 5.0.0-dev.5643.9c5173a → 5.0.0-dev.5646.35daa65
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 +65 -2
- package/dist/formio.builder.css +8 -8
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.css +8 -8
- package/dist/formio.form.js +792 -1237
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +3 -5
- package/dist/formio.full.css +8 -8
- package/dist/formio.full.js +692 -933
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +3 -5
- package/dist/formio.js +18 -18
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +1853 -476
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +10 -4
- package/embed.d.ts +1 -0
- package/form.d.ts +1 -0
- package/lib/cjs/CDN.d.ts +1 -0
- package/lib/cjs/CDN.js +6 -3
- package/lib/cjs/Element.d.ts +86 -96
- package/lib/cjs/Element.js +68 -78
- package/lib/cjs/Embed.d.ts +1 -1
- package/lib/cjs/Embed.js +52 -12
- package/lib/cjs/Form.d.ts +365 -36
- package/lib/cjs/Form.js +50 -64
- package/lib/cjs/FormBuilder.d.ts +187 -2
- package/lib/cjs/FormBuilder.js +30 -8
- package/lib/cjs/Formio.js +1 -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 +6 -8
- package/lib/cjs/Webform.d.ts +187 -139
- package/lib/cjs/Webform.js +330 -300
- package/lib/cjs/WebformBuilder.d.ts +16 -14
- package/lib/cjs/WebformBuilder.js +19 -12
- package/lib/cjs/Wizard.d.ts +31 -21
- package/lib/cjs/Wizard.js +43 -20
- package/lib/cjs/WizardBuilder.d.ts +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
- package/lib/cjs/components/Components.d.ts +4 -4
- package/lib/cjs/components/Components.js +3 -3
- package/lib/cjs/components/_classes/component/Component.d.ts +515 -269
- package/lib/cjs/components/_classes/component/Component.form.d.ts +6 -3
- package/lib/cjs/components/_classes/component/Component.form.js +5 -0
- package/lib/cjs/components/_classes/component/Component.js +462 -204
- 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 +31 -7
- 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 +163 -67
- package/lib/cjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +5 -0
- package/lib/cjs/components/_classes/nested/NestedComponent.js +175 -54
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
- package/lib/cjs/components/address/Address.d.ts +4 -2
- package/lib/cjs/components/address/Address.form.d.ts +6 -3
- package/lib/cjs/components/address/Address.form.js +5 -0
- package/lib/cjs/components/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 +3 -12
- package/lib/cjs/components/button/Button.form.d.ts +6 -3
- package/lib/cjs/components/button/Button.form.js +5 -0
- package/lib/cjs/components/button/Button.js +5 -0
- package/lib/cjs/components/checkbox/Checkbox.d.ts +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 +1 -1
- package/lib/cjs/components/container/Container.form.d.ts +6 -3
- package/lib/cjs/components/container/Container.form.js +5 -0
- package/lib/cjs/components/content/Content.d.ts +2 -1
- package/lib/cjs/components/content/Content.form.d.ts +6 -3
- package/lib/cjs/components/content/Content.form.js +5 -0
- package/lib/cjs/components/currency/Currency.form.d.ts +6 -3
- package/lib/cjs/components/currency/Currency.form.js +5 -0
- package/lib/cjs/components/currency/Currency.js +1 -2
- package/lib/cjs/components/datagrid/DataGrid.d.ts +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-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 +4 -1
- package/lib/cjs/components/datagrid/fixtures/index.js +7 -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 +7 -3
- package/lib/cjs/components/editgrid/EditGrid.form.d.ts +6 -3
- package/lib/cjs/components/editgrid/EditGrid.form.js +5 -0
- package/lib/cjs/components/editgrid/EditGrid.js +5 -5
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -5
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +6 -9
- package/lib/cjs/components/email/Email.form.d.ts +6 -3
- package/lib/cjs/components/email/Email.form.js +5 -0
- package/lib/cjs/components/fieldset/Fieldset.form.d.ts +6 -3
- package/lib/cjs/components/fieldset/Fieldset.form.js +5 -0
- package/lib/cjs/components/file/File.d.ts +9 -22
- package/lib/cjs/components/file/File.form.d.ts +6 -3
- package/lib/cjs/components/file/File.form.js +5 -0
- package/lib/cjs/components/file/File.js +1 -2
- package/lib/cjs/components/form/Form.d.ts +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 +27 -15
- 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 +3 -26
- package/lib/cjs/components/radio/Radio.form.d.ts +6 -3
- package/lib/cjs/components/radio/Radio.form.js +5 -0
- package/lib/cjs/components/radio/Radio.js +6 -7
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +5 -0
- package/lib/cjs/components/select/Select.d.ts +16 -39
- package/lib/cjs/components/select/Select.form.d.ts +6 -3
- package/lib/cjs/components/select/Select.form.js +5 -0
- package/lib/cjs/components/select/Select.js +14 -18
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +2 -17
- package/lib/cjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
- package/lib/cjs/components/selectboxes/SelectBoxes.form.js +5 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -9
- package/lib/cjs/components/signature/Signature.d.ts +0 -14
- package/lib/cjs/components/signature/Signature.form.d.ts +6 -3
- package/lib/cjs/components/signature/Signature.form.js +5 -0
- package/lib/cjs/components/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 +2 -1
- package/lib/cjs/components/table/Table.form.d.ts +6 -3
- package/lib/cjs/components/table/Table.form.js +5 -0
- package/lib/cjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/cjs/components/tabs/Tabs.form.d.ts +6 -3
- package/lib/cjs/components/tabs/Tabs.form.js +5 -0
- package/lib/cjs/components/tabs/Tabs.js +1 -2
- package/lib/cjs/components/tags/Tags.d.ts +0 -14
- package/lib/cjs/components/tags/Tags.form.d.ts +6 -3
- package/lib/cjs/components/tags/Tags.form.js +5 -0
- package/lib/cjs/components/textarea/TextArea.d.ts +4 -9
- package/lib/cjs/components/textarea/TextArea.form.d.ts +6 -3
- package/lib/cjs/components/textarea/TextArea.form.js +5 -0
- package/lib/cjs/components/textarea/TextArea.js +2 -2
- package/lib/cjs/components/textfield/TextField.d.ts +14 -30
- package/lib/cjs/components/textfield/TextField.form.d.ts +6 -3
- package/lib/cjs/components/textfield/TextField.form.js +5 -0
- package/lib/cjs/components/textfield/TextField.js +16 -17
- package/lib/cjs/components/time/Time.form.d.ts +6 -3
- package/lib/cjs/components/time/Time.form.js +5 -0
- package/lib/cjs/components/unknown/Unknown.form.d.ts +5 -34
- package/lib/cjs/components/unknown/Unknown.form.js +4 -0
- package/lib/cjs/components/url/Url.form.d.ts +6 -3
- package/lib/cjs/components/url/Url.form.js +5 -0
- package/lib/cjs/components/well/Well.form.d.ts +6 -3
- package/lib/cjs/components/well/Well.form.js +5 -0
- package/lib/cjs/formio.embed.d.ts +1 -2
- package/lib/cjs/formio.embed.js +2 -100
- package/lib/cjs/formio.form.d.ts +11 -4
- package/lib/cjs/formio.form.js +13 -5
- package/lib/cjs/providers/Providers.d.ts +36 -5
- package/lib/cjs/providers/Providers.js +29 -0
- package/lib/cjs/providers/address/AddressProvider.d.ts +131 -12
- package/lib/cjs/providers/address/AddressProvider.js +88 -2
- package/lib/cjs/providers/address/AzureAddressProvider.d.ts +48 -1
- package/lib/cjs/providers/address/AzureAddressProvider.js +37 -0
- package/lib/cjs/providers/address/CustomAddressProvider.d.ts +27 -4
- package/lib/cjs/providers/address/CustomAddressProvider.js +34 -0
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +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 +360 -223
- package/lib/cjs/utils/utils.js +394 -239
- package/lib/cjs/widgets/CalendarWidget.d.ts +9 -10
- package/lib/cjs/widgets/CalendarWidget.js +9 -11
- package/lib/mjs/CDN.d.ts +1 -0
- package/lib/mjs/CDN.js +6 -3
- package/lib/mjs/Element.d.ts +86 -96
- package/lib/mjs/Element.js +68 -78
- package/lib/mjs/Embed.d.ts +1 -1
- package/lib/mjs/Embed.js +52 -12
- package/lib/mjs/Form.d.ts +365 -36
- package/lib/mjs/Form.js +140 -57
- package/lib/mjs/FormBuilder.d.ts +187 -2
- package/lib/mjs/FormBuilder.js +32 -8
- package/lib/mjs/Formio.js +1 -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 +6 -8
- package/lib/mjs/Webform.d.ts +187 -139
- package/lib/mjs/Webform.js +342 -312
- package/lib/mjs/WebformBuilder.d.ts +16 -14
- package/lib/mjs/WebformBuilder.js +19 -12
- package/lib/mjs/Wizard.d.ts +31 -21
- package/lib/mjs/Wizard.js +42 -19
- package/lib/mjs/WizardBuilder.d.ts +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +8 -5
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +6 -3
- package/lib/mjs/components/Components.d.ts +4 -4
- package/lib/mjs/components/Components.js +3 -3
- package/lib/mjs/components/_classes/component/Component.d.ts +515 -269
- package/lib/mjs/components/_classes/component/Component.form.d.ts +6 -3
- package/lib/mjs/components/_classes/component/Component.form.js +5 -0
- package/lib/mjs/components/_classes/component/Component.js +470 -204
- 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 +30 -7
- 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 +163 -67
- package/lib/mjs/components/_classes/nested/NestedComponent.form.d.ts +6 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +5 -0
- package/lib/mjs/components/_classes/nested/NestedComponent.js +175 -54
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +2 -2
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +1 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +7 -1
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +2 -3
- package/lib/mjs/components/address/Address.d.ts +4 -2
- package/lib/mjs/components/address/Address.form.d.ts +6 -3
- package/lib/mjs/components/address/Address.form.js +5 -0
- package/lib/mjs/components/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 +3 -12
- package/lib/mjs/components/button/Button.form.d.ts +6 -3
- package/lib/mjs/components/button/Button.form.js +5 -0
- package/lib/mjs/components/button/Button.js +5 -0
- package/lib/mjs/components/checkbox/Checkbox.d.ts +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 +1 -1
- package/lib/mjs/components/container/Container.form.d.ts +6 -3
- package/lib/mjs/components/container/Container.form.js +5 -0
- package/lib/mjs/components/content/Content.d.ts +2 -1
- package/lib/mjs/components/content/Content.form.d.ts +6 -3
- package/lib/mjs/components/content/Content.form.js +5 -0
- package/lib/mjs/components/currency/Currency.form.d.ts +6 -3
- package/lib/mjs/components/currency/Currency.form.js +5 -0
- package/lib/mjs/components/currency/Currency.js +1 -2
- package/lib/mjs/components/datagrid/DataGrid.d.ts +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-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 +4 -1
- package/lib/mjs/components/datagrid/fixtures/index.js +4 -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 +7 -3
- package/lib/mjs/components/editgrid/EditGrid.form.d.ts +6 -3
- package/lib/mjs/components/editgrid/EditGrid.form.js +5 -0
- package/lib/mjs/components/editgrid/EditGrid.js +5 -5
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +1 -1
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +1 -1
- package/lib/mjs/components/email/Email.form.d.ts +6 -3
- package/lib/mjs/components/email/Email.form.js +5 -0
- package/lib/mjs/components/fieldset/Fieldset.form.d.ts +6 -3
- package/lib/mjs/components/fieldset/Fieldset.form.js +5 -0
- package/lib/mjs/components/file/File.d.ts +9 -22
- package/lib/mjs/components/file/File.form.d.ts +6 -3
- package/lib/mjs/components/file/File.form.js +5 -0
- package/lib/mjs/components/file/File.js +1 -2
- package/lib/mjs/components/form/Form.d.ts +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 +25 -13
- package/lib/mjs/components/hidden/Hidden.d.ts +1 -11
- package/lib/mjs/components/hidden/Hidden.form.d.ts +6 -3
- package/lib/mjs/components/hidden/Hidden.form.js +5 -0
- package/lib/mjs/components/hidden/Hidden.js +1 -2
- package/lib/mjs/components/html/HTML.d.ts +2 -1
- package/lib/mjs/components/html/HTML.form.d.ts +6 -3
- package/lib/mjs/components/html/HTML.form.js +5 -0
- package/lib/mjs/components/number/Number.d.ts +3 -17
- package/lib/mjs/components/number/Number.form.d.ts +6 -3
- package/lib/mjs/components/number/Number.form.js +5 -0
- package/lib/mjs/components/number/Number.js +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 +3 -26
- package/lib/mjs/components/radio/Radio.form.d.ts +6 -3
- package/lib/mjs/components/radio/Radio.form.js +5 -0
- package/lib/mjs/components/radio/Radio.js +6 -6
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.form.d.ts +6 -3
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +5 -0
- package/lib/mjs/components/select/Select.d.ts +16 -39
- package/lib/mjs/components/select/Select.form.d.ts +6 -3
- package/lib/mjs/components/select/Select.form.js +5 -0
- package/lib/mjs/components/select/Select.js +15 -19
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +2 -17
- package/lib/mjs/components/selectboxes/SelectBoxes.form.d.ts +6 -3
- package/lib/mjs/components/selectboxes/SelectBoxes.form.js +5 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -9
- package/lib/mjs/components/signature/Signature.d.ts +0 -14
- package/lib/mjs/components/signature/Signature.form.d.ts +6 -3
- package/lib/mjs/components/signature/Signature.form.js +5 -0
- package/lib/mjs/components/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 +2 -1
- package/lib/mjs/components/table/Table.form.d.ts +6 -3
- package/lib/mjs/components/table/Table.form.js +5 -0
- package/lib/mjs/components/tabs/Tabs.d.ts +4 -4
- package/lib/mjs/components/tabs/Tabs.form.d.ts +6 -3
- package/lib/mjs/components/tabs/Tabs.form.js +5 -0
- package/lib/mjs/components/tabs/Tabs.js +1 -2
- package/lib/mjs/components/tags/Tags.d.ts +0 -14
- package/lib/mjs/components/tags/Tags.form.d.ts +6 -3
- package/lib/mjs/components/tags/Tags.form.js +5 -0
- package/lib/mjs/components/textarea/TextArea.d.ts +4 -9
- package/lib/mjs/components/textarea/TextArea.form.d.ts +6 -3
- package/lib/mjs/components/textarea/TextArea.form.js +5 -0
- package/lib/mjs/components/textarea/TextArea.js +2 -2
- package/lib/mjs/components/textfield/TextField.d.ts +14 -30
- package/lib/mjs/components/textfield/TextField.form.d.ts +6 -3
- package/lib/mjs/components/textfield/TextField.form.js +5 -0
- package/lib/mjs/components/textfield/TextField.js +16 -17
- package/lib/mjs/components/time/Time.form.d.ts +6 -3
- package/lib/mjs/components/time/Time.form.js +5 -0
- package/lib/mjs/components/unknown/Unknown.form.d.ts +5 -34
- package/lib/mjs/components/unknown/Unknown.form.js +4 -0
- package/lib/mjs/components/url/Url.form.d.ts +6 -3
- package/lib/mjs/components/url/Url.form.js +5 -0
- package/lib/mjs/components/well/Well.form.d.ts +6 -3
- package/lib/mjs/components/well/Well.form.js +5 -0
- package/lib/mjs/formio.embed.d.ts +1 -2
- package/lib/mjs/formio.embed.js +2 -99
- package/lib/mjs/formio.form.d.ts +11 -4
- package/lib/mjs/formio.form.js +10 -3
- package/lib/mjs/providers/Providers.d.ts +36 -5
- package/lib/mjs/providers/Providers.js +29 -0
- package/lib/mjs/providers/address/AddressProvider.d.ts +131 -12
- package/lib/mjs/providers/address/AddressProvider.js +88 -2
- package/lib/mjs/providers/address/AzureAddressProvider.d.ts +48 -1
- package/lib/mjs/providers/address/AzureAddressProvider.js +37 -0
- package/lib/mjs/providers/address/CustomAddressProvider.d.ts +27 -4
- package/lib/mjs/providers/address/CustomAddressProvider.js +34 -0
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +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 +360 -223
- package/lib/mjs/utils/utils.js +387 -233
- package/lib/mjs/widgets/CalendarWidget.d.ts +9 -10
- package/lib/mjs/widgets/CalendarWidget.js +9 -11
- 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);
|
|
@@ -603,8 +590,8 @@ class Component extends Element_1.default {
|
|
|
603
590
|
return this.shouldForceVisibility(component, 'show');
|
|
604
591
|
}
|
|
605
592
|
/**
|
|
606
|
-
*
|
|
607
|
-
* @param
|
|
593
|
+
* Sets the component visibility.
|
|
594
|
+
* @param {boolean} value - Whether the component should be visible or not.
|
|
608
595
|
*/
|
|
609
596
|
set visible(value) {
|
|
610
597
|
if (this._visible !== value) {
|
|
@@ -622,8 +609,8 @@ class Component extends Element_1.default {
|
|
|
622
609
|
}
|
|
623
610
|
}
|
|
624
611
|
/**
|
|
625
|
-
*
|
|
626
|
-
* @returns {boolean}
|
|
612
|
+
* Returns the component visibility
|
|
613
|
+
* @returns {boolean} - Whether the component is visible or not.
|
|
627
614
|
*/
|
|
628
615
|
get visible() {
|
|
629
616
|
// Show only if visibility changes or if we are in builder mode or if hidden fields should be shown.
|
|
@@ -713,9 +700,10 @@ class Component extends Element_1.default {
|
|
|
713
700
|
}
|
|
714
701
|
/**
|
|
715
702
|
* Returns only the schema that is different from the default.
|
|
716
|
-
*
|
|
717
|
-
* @param schema
|
|
718
|
-
* @param
|
|
703
|
+
* @param {object} schema - The "full" json schema for the component.
|
|
704
|
+
* @param {object} defaultSchema - The "default" json schema for the component.
|
|
705
|
+
* @param {boolean} recursion - If we are currently in a recursive loop.
|
|
706
|
+
* @returns {object} - The minified json schema for this component.
|
|
719
707
|
*/
|
|
720
708
|
getModifiedSchema(schema, defaultSchema, recursion) {
|
|
721
709
|
const modified = {};
|
|
@@ -749,21 +737,24 @@ class Component extends Element_1.default {
|
|
|
749
737
|
}
|
|
750
738
|
/**
|
|
751
739
|
* Returns the JSON schema for this component.
|
|
740
|
+
* @returns {object} - The JSON schema for this component.
|
|
752
741
|
*/
|
|
753
742
|
get schema() {
|
|
754
743
|
return (0, utils_1.fastCloneDeep)(this.getModifiedSchema(lodash_1.default.omit(this.component, 'id'), this.defaultSchema));
|
|
755
744
|
}
|
|
756
745
|
/**
|
|
757
746
|
* Returns true if component is inside DataGrid
|
|
747
|
+
* @returns {boolean} - True if component is inside DataGrid
|
|
758
748
|
*/
|
|
759
749
|
get isInDataGrid() {
|
|
760
750
|
return this.inDataGrid;
|
|
761
751
|
}
|
|
762
752
|
/**
|
|
763
753
|
* Translate a text using the i18n system.
|
|
764
|
-
*
|
|
765
754
|
* @param {string} text - The i18n identifier.
|
|
766
|
-
* @param {
|
|
755
|
+
* @param {object} params - The i18n parameters to use for translation.
|
|
756
|
+
* @param {...any} args - Additional arguments to pass to the translation library.
|
|
757
|
+
* @returns {string} - The translated text.
|
|
767
758
|
*/
|
|
768
759
|
t(text, params = {}, ...args) {
|
|
769
760
|
if (!text) {
|
|
@@ -853,7 +844,7 @@ class Component extends Element_1.default {
|
|
|
853
844
|
isHtmlRenderMode() {
|
|
854
845
|
return this.options.renderMode === 'html';
|
|
855
846
|
}
|
|
856
|
-
renderTemplate(name, data = {}, modeOption) {
|
|
847
|
+
renderTemplate(name, data = {}, modeOption = '') {
|
|
857
848
|
// Need to make this fall back to form if renderMode is not found similar to how we search templates.
|
|
858
849
|
const mode = modeOption || this.options.renderMode || 'form';
|
|
859
850
|
data.component = this.component;
|
|
@@ -893,11 +884,12 @@ class Component extends Element_1.default {
|
|
|
893
884
|
}
|
|
894
885
|
/**
|
|
895
886
|
* Sanitize an html string.
|
|
896
|
-
*
|
|
897
|
-
* @param
|
|
898
|
-
* @
|
|
887
|
+
* @param {string} dirty - The dirty html string to sanitize.
|
|
888
|
+
* @param {boolean} forceSanitize - If we should force the sanitize to occur.
|
|
889
|
+
* @param {object} options - The options for the sanitize.
|
|
890
|
+
* @returns {*} - The sanitized html string.
|
|
899
891
|
*/
|
|
900
|
-
sanitize(dirty, forceSanitize, options) {
|
|
892
|
+
sanitize(dirty, forceSanitize = false, options = {}) {
|
|
901
893
|
var _a;
|
|
902
894
|
if (!this.shouldSanitizeValue && !forceSanitize) {
|
|
903
895
|
return dirty;
|
|
@@ -908,12 +900,9 @@ class Component extends Element_1.default {
|
|
|
908
900
|
}
|
|
909
901
|
/**
|
|
910
902
|
* Render a template string into html.
|
|
911
|
-
*
|
|
912
|
-
* @param template
|
|
913
|
-
* @
|
|
914
|
-
* @param actions
|
|
915
|
-
*
|
|
916
|
-
* @return {HTMLElement|String} - The created element or an empty string if template is not specified.
|
|
903
|
+
* @param {string} template - The template to render.
|
|
904
|
+
* @param {object} data - The data to provide to the template.
|
|
905
|
+
* @returns {HTMLElement | string} - The created element or an empty string if template is not specified.
|
|
917
906
|
*/
|
|
918
907
|
renderString(template, data) {
|
|
919
908
|
if (!template) {
|
|
@@ -922,9 +911,18 @@ class Component extends Element_1.default {
|
|
|
922
911
|
// Interpolate the template and populate
|
|
923
912
|
return this.interpolate(template, data);
|
|
924
913
|
}
|
|
914
|
+
/**
|
|
915
|
+
* Allows for modification of the component value prior to submission.
|
|
916
|
+
* @param {*} input - The input to be modified.
|
|
917
|
+
* @returns {*} - The modified input mapping for the extended component.
|
|
918
|
+
*/
|
|
925
919
|
performInputMapping(input) {
|
|
926
920
|
return input;
|
|
927
921
|
}
|
|
922
|
+
/**
|
|
923
|
+
* Returns the component "widget" if one is available.
|
|
924
|
+
* @returns {Widget|null} - The widget instance. null if not available.
|
|
925
|
+
*/
|
|
928
926
|
get widget() {
|
|
929
927
|
var _a;
|
|
930
928
|
const settings = this.component.widget;
|
|
@@ -934,6 +932,10 @@ class Component extends Element_1.default {
|
|
|
934
932
|
const widget = settings && widgets_1.default[settings.type] ? new widgets_1.default[settings.type](settings, this.component, this) : null;
|
|
935
933
|
return widget;
|
|
936
934
|
}
|
|
935
|
+
/**
|
|
936
|
+
* Returns the native supported browser language.
|
|
937
|
+
* @returns {string|null} - The native browser language that is supported.
|
|
938
|
+
*/
|
|
937
939
|
getBrowserLanguage() {
|
|
938
940
|
const nav = window.navigator;
|
|
939
941
|
const browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'];
|
|
@@ -957,38 +959,46 @@ class Component extends Element_1.default {
|
|
|
957
959
|
return null;
|
|
958
960
|
}
|
|
959
961
|
/**
|
|
960
|
-
* Called before a next and previous page is triggered allowing the components
|
|
961
|
-
* to
|
|
962
|
-
*
|
|
963
|
-
* @return {*}
|
|
962
|
+
* Called before a next and previous page is triggered allowing the components to perform special functions.
|
|
963
|
+
* @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next/previous page navigation.
|
|
964
964
|
*/
|
|
965
965
|
beforePage() {
|
|
966
966
|
return Promise.resolve(true);
|
|
967
967
|
}
|
|
968
|
+
/**
|
|
969
|
+
* Called before the next page is triggered allowing the components to hook into the page navigation and perform tasks.
|
|
970
|
+
* @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the next page navigation.
|
|
971
|
+
*/
|
|
968
972
|
beforeNext() {
|
|
969
973
|
return this.beforePage(true);
|
|
970
974
|
}
|
|
971
975
|
/**
|
|
972
|
-
* Called before a submission is triggered allowing the components
|
|
973
|
-
* to
|
|
974
|
-
*
|
|
975
|
-
* @return {*}
|
|
976
|
+
* Called before a submission is triggered allowing the components to perform special async functions.
|
|
977
|
+
* @returns {Promise<boolean>} - A promise to resolve when the component is no longer blocking the submission.
|
|
976
978
|
*/
|
|
977
979
|
beforeSubmit() {
|
|
978
980
|
return Promise.resolve(true);
|
|
979
981
|
}
|
|
980
982
|
/**
|
|
981
983
|
* Return the submission timezone.
|
|
982
|
-
*
|
|
983
|
-
* @return {*}
|
|
984
|
+
* @returns {string} - The submission timezone.
|
|
984
985
|
*/
|
|
985
986
|
get submissionTimezone() {
|
|
986
987
|
this.options.submissionTimezone = this.options.submissionTimezone || lodash_1.default.get(this.root, 'options.submissionTimezone');
|
|
987
988
|
return this.options.submissionTimezone;
|
|
988
989
|
}
|
|
990
|
+
/**
|
|
991
|
+
* Return the current timezone.
|
|
992
|
+
* @returns {string} - The current timezone.
|
|
993
|
+
*/
|
|
989
994
|
get timezone() {
|
|
990
995
|
return this.getTimezone(this.component);
|
|
991
996
|
}
|
|
997
|
+
/**
|
|
998
|
+
* Return the current timezone.
|
|
999
|
+
* @param {object} settings - Settings to control how the timezone should be returned.
|
|
1000
|
+
* @returns {string} - The current timezone.
|
|
1001
|
+
*/
|
|
992
1002
|
getTimezone(settings) {
|
|
993
1003
|
if (settings.timezone) {
|
|
994
1004
|
return settings.timezone;
|
|
@@ -1012,6 +1022,9 @@ class Component extends Element_1.default {
|
|
|
1012
1022
|
* @param {string} [referenceAttributeName] - The attribute name to use for the reference.
|
|
1013
1023
|
*/
|
|
1014
1024
|
loadRefs(element, refs, referenceAttributeName) {
|
|
1025
|
+
if (!element) {
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1015
1028
|
for (const ref in refs) {
|
|
1016
1029
|
const refType = refs[ref];
|
|
1017
1030
|
const isString = typeof refType === 'string';
|
|
@@ -1026,9 +1039,25 @@ class Component extends Element_1.default {
|
|
|
1026
1039
|
}
|
|
1027
1040
|
}
|
|
1028
1041
|
}
|
|
1029
|
-
|
|
1042
|
+
/**
|
|
1043
|
+
* Opens the modal element.
|
|
1044
|
+
* @param {string} template - The template to use for the modal dialog.
|
|
1045
|
+
*/
|
|
1046
|
+
setOpenModalElement(template = null) {
|
|
1030
1047
|
this.componentModal.setOpenModalElement(template || this.getModalPreviewTemplate());
|
|
1031
1048
|
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Renders a modal preview template and returns the markup as a string
|
|
1051
|
+
* @param {object|null|undefined} ctx - The rendering context
|
|
1052
|
+
* @returns {string} - The modal preview markup
|
|
1053
|
+
*/
|
|
1054
|
+
renderModalPreview(ctx) {
|
|
1055
|
+
return this.renderTemplate('modalPreview', ctx || {});
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* Returns the modal preview template.
|
|
1059
|
+
* @returns {string} - The modal preview template.
|
|
1060
|
+
*/
|
|
1032
1061
|
getModalPreviewTemplate() {
|
|
1033
1062
|
var _a;
|
|
1034
1063
|
const dataValue = this.component.type === 'password' ? this.dataValue.replace(/./g, '•') : this.dataValue;
|
|
@@ -1036,12 +1065,17 @@ class Component extends Element_1.default {
|
|
|
1036
1065
|
if (this.hasInput && ((_a = this.component.validate) === null || _a === void 0 ? void 0 : _a.required) && !this.isPDFReadOnlyMode) {
|
|
1037
1066
|
modalLabel = { className: 'field-required' };
|
|
1038
1067
|
}
|
|
1039
|
-
return this.
|
|
1068
|
+
return this.renderModalPreview({
|
|
1040
1069
|
previewText: this.getValueAsString(dataValue, { modalPreview: true }) || this.t('Click to set value'),
|
|
1041
1070
|
messages: '',
|
|
1042
1071
|
labelInfo: modalLabel,
|
|
1043
1072
|
});
|
|
1044
1073
|
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Performs a complete build of a component, which empties, renders, sets the content in the DOM, and then finally attaches events.
|
|
1076
|
+
* @param {HTMLElement} element - The element to attach this component to.
|
|
1077
|
+
* @returns {Promise<void>} - A promise that resolves when the component has been built.
|
|
1078
|
+
*/
|
|
1045
1079
|
build(element) {
|
|
1046
1080
|
element = element || this.element;
|
|
1047
1081
|
this.empty(element);
|
|
@@ -1051,6 +1085,12 @@ class Component extends Element_1.default {
|
|
|
1051
1085
|
get hasModalSaveButton() {
|
|
1052
1086
|
return true;
|
|
1053
1087
|
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Renders a component as an HTML string.
|
|
1090
|
+
* @param {string} children - The contents of all the children HTML as a string.
|
|
1091
|
+
* @param {boolean} topLevel - If this is the topmost component that is being rendered.
|
|
1092
|
+
* @returns {string} - The rendered HTML string of a component.
|
|
1093
|
+
*/
|
|
1054
1094
|
render(children = `Unknown component: ${this.component.type}`, topLevel = false) {
|
|
1055
1095
|
const isVisible = this.visible;
|
|
1056
1096
|
this.rendered = true;
|
|
@@ -1074,27 +1114,46 @@ class Component extends Element_1.default {
|
|
|
1074
1114
|
}, topLevel);
|
|
1075
1115
|
}
|
|
1076
1116
|
}
|
|
1117
|
+
/**
|
|
1118
|
+
* Creates the tooltip instance using tippy.js and returns it
|
|
1119
|
+
* @param {HTMLElement} tooltipEl - HTML element to attach the tooltip
|
|
1120
|
+
* @param {object|null|undefined} settings - tippy.js options
|
|
1121
|
+
* @returns {import('tippy.js').Tippy} - tippy.js instance
|
|
1122
|
+
*/
|
|
1123
|
+
createTooltip(tooltipEl, settings = {}) {
|
|
1124
|
+
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
|
|
1125
|
+
const tooltipDataTitle = tooltipEl.getAttribute('data-title');
|
|
1126
|
+
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1127
|
+
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1128
|
+
return (0, tippy_js_1.default)(tooltipEl, Object.assign(Object.assign({ allowHTML: true, trigger: 'mouseenter click focus', placement: 'right', zIndex: 10000, interactive: true }, settings), { content: this.t(this.sanitize(tooltipText), { _userInput: true }) }));
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* Attaches all the tooltips provided the refs object.
|
|
1132
|
+
* @param {object} toolTipsRefs - The refs for the tooltips within your template.
|
|
1133
|
+
* @returns {void}
|
|
1134
|
+
*/
|
|
1077
1135
|
attachTooltips(toolTipsRefs) {
|
|
1078
1136
|
toolTipsRefs === null || toolTipsRefs === void 0 ? void 0 : toolTipsRefs.forEach((tooltip, index) => {
|
|
1079
1137
|
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
|
-
});
|
|
1138
|
+
this.tooltips[index] = this.createTooltip(tooltip);
|
|
1092
1139
|
}
|
|
1093
1140
|
});
|
|
1094
1141
|
}
|
|
1142
|
+
/**
|
|
1143
|
+
* Create a new component modal for this component.
|
|
1144
|
+
* @param {HTMLElement} element - The element to attach the modal to.
|
|
1145
|
+
* @param {boolean} modalShouldBeOpened - TRUE if the modal should open immediately.
|
|
1146
|
+
* @param {any} currentValue - The current value of the component.
|
|
1147
|
+
* @returns {ComponentModal} - The created component modal.
|
|
1148
|
+
*/
|
|
1095
1149
|
createComponentModal(element, modalShouldBeOpened, currentValue) {
|
|
1096
1150
|
return new ComponentModal_1.default(this, element, modalShouldBeOpened, currentValue, this._referenceAttributeName);
|
|
1097
1151
|
}
|
|
1152
|
+
/**
|
|
1153
|
+
* Attaches all event listensers for this component to the DOM elements that were rendered.
|
|
1154
|
+
* @param {HTMLElement} element - The element to attach the listeners to.
|
|
1155
|
+
* @returns {Promise<void>} - Resolves when the component is done attaching to the DOM.
|
|
1156
|
+
*/
|
|
1098
1157
|
attach(element) {
|
|
1099
1158
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
1100
1159
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
@@ -1132,6 +1191,9 @@ class Component extends Element_1.default {
|
|
|
1132
1191
|
this.addons.forEach((addon) => addon.attach(element));
|
|
1133
1192
|
return Promise.resolve();
|
|
1134
1193
|
}
|
|
1194
|
+
/**
|
|
1195
|
+
* Restors the "focus" on a component after a redraw event has occured.
|
|
1196
|
+
*/
|
|
1135
1197
|
restoreFocus() {
|
|
1136
1198
|
var _a, _b, _c;
|
|
1137
1199
|
const isFocused = ((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.focusedComponent) === null || _b === void 0 ? void 0 : _b.path) === this.path;
|
|
@@ -1141,6 +1203,12 @@ class Component extends Element_1.default {
|
|
|
1141
1203
|
this.restoreCaretPosition();
|
|
1142
1204
|
}
|
|
1143
1205
|
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Adds a keyboard shortcut to this component.
|
|
1208
|
+
* @param {HTMLElement} element - The element to attach the keyboard shortcut to.
|
|
1209
|
+
* @param {string} shortcut - The keyboard shortcut to add.
|
|
1210
|
+
* @returns {void}
|
|
1211
|
+
*/
|
|
1144
1212
|
addShortcut(element, shortcut) {
|
|
1145
1213
|
// Avoid infinite recursion.
|
|
1146
1214
|
if (!element || !this.root || (this.root === this)) {
|
|
@@ -1151,6 +1219,12 @@ class Component extends Element_1.default {
|
|
|
1151
1219
|
}
|
|
1152
1220
|
this.root.addShortcut(element, shortcut);
|
|
1153
1221
|
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Removes a keyboard shortcut from this component.
|
|
1224
|
+
* @param {HTMLElement} element - The element to remove the keyboard shortcut from.
|
|
1225
|
+
* @param {string} shortcut - The keyboard shortcut to remove.
|
|
1226
|
+
* @returns {void}
|
|
1227
|
+
*/
|
|
1154
1228
|
removeShortcut(element, shortcut) {
|
|
1155
1229
|
// Avoid infinite recursion.
|
|
1156
1230
|
if (!element || (this.root === this)) {
|
|
@@ -1183,6 +1257,13 @@ class Component extends Element_1.default {
|
|
|
1183
1257
|
this.tooltip.destroy();
|
|
1184
1258
|
}
|
|
1185
1259
|
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Determines if the component should be refreshed based on the path of another component that changed.
|
|
1262
|
+
* @param {string} refreshData - The path of the data that needs to trigger a refresh.
|
|
1263
|
+
* @param {boolean} changed - Flag that is true if the data has been changed.
|
|
1264
|
+
* @param {any} flags - The flags for the checkData procedure.
|
|
1265
|
+
* @returns {void}
|
|
1266
|
+
*/
|
|
1186
1267
|
checkRefresh(refreshData, changed, flags) {
|
|
1187
1268
|
const changePath = lodash_1.default.get(changed, 'instance.path', false);
|
|
1188
1269
|
// Don't let components change themselves.
|
|
@@ -1199,6 +1280,12 @@ class Component extends Element_1.default {
|
|
|
1199
1280
|
this.refresh(changed.value, changed, flags);
|
|
1200
1281
|
}
|
|
1201
1282
|
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Iterates over a list of changes, and determines if the component should be refreshed if it is configured to refresh on any of those components.
|
|
1285
|
+
* @param {Array<any>} changes - The list of components that have changed.
|
|
1286
|
+
* @param {any} flags - The checkData flags.
|
|
1287
|
+
* @returns {void}
|
|
1288
|
+
*/
|
|
1202
1289
|
checkRefreshOn(changes, flags = {}) {
|
|
1203
1290
|
changes = changes || [];
|
|
1204
1291
|
if (flags.noRefresh) {
|
|
@@ -1220,8 +1307,8 @@ class Component extends Element_1.default {
|
|
|
1220
1307
|
}
|
|
1221
1308
|
/**
|
|
1222
1309
|
* Refreshes the component with a new value.
|
|
1223
|
-
*
|
|
1224
|
-
* @
|
|
1310
|
+
* @param {any} value - The latest value of the component to check if it needs to be refreshed.
|
|
1311
|
+
* @returns {void}
|
|
1225
1312
|
*/
|
|
1226
1313
|
refresh(value) {
|
|
1227
1314
|
if (this.hasOwnProperty('refreshOnValue')) {
|
|
@@ -1244,8 +1331,8 @@ class Component extends Element_1.default {
|
|
|
1244
1331
|
* with the components data and returns true if they are in the same context.
|
|
1245
1332
|
*
|
|
1246
1333
|
* Different rows of the same EditGrid, for example, are in different contexts.
|
|
1247
|
-
*
|
|
1248
|
-
* @
|
|
1334
|
+
* @param {any} component - The component to check if it is in the same context as this component.
|
|
1335
|
+
* @returns {boolean} - TRUE if the component is in the same context as this component.
|
|
1249
1336
|
*/
|
|
1250
1337
|
inContext(component) {
|
|
1251
1338
|
if (component.data === this.data) {
|
|
@@ -1260,9 +1347,18 @@ class Component extends Element_1.default {
|
|
|
1260
1347
|
}
|
|
1261
1348
|
return false;
|
|
1262
1349
|
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Determines if we are in "view" only mode.
|
|
1352
|
+
* @returns {boolean} - TRUE if we are in "view" only mode.
|
|
1353
|
+
*/
|
|
1263
1354
|
get viewOnly() {
|
|
1264
1355
|
return this.options.readOnly && this.options.viewAsHtml;
|
|
1265
1356
|
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Sets the HTMLElement for this component.
|
|
1359
|
+
* @param {HTMLElement} element - The element that is attached to this component.
|
|
1360
|
+
* @returns {void}
|
|
1361
|
+
*/
|
|
1266
1362
|
setElement(element) {
|
|
1267
1363
|
if (this.element) {
|
|
1268
1364
|
delete this.element.component;
|
|
@@ -1270,6 +1366,10 @@ class Component extends Element_1.default {
|
|
|
1270
1366
|
}
|
|
1271
1367
|
this.element = element;
|
|
1272
1368
|
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Creates an element to hold the "view only" version of this component.
|
|
1371
|
+
* @returns {HTMLElement} - The element for this component.
|
|
1372
|
+
*/
|
|
1273
1373
|
createViewOnlyElement() {
|
|
1274
1374
|
this.setElement(this.ce('dl', {
|
|
1275
1375
|
id: this.id
|
|
@@ -1280,14 +1380,18 @@ class Component extends Element_1.default {
|
|
|
1280
1380
|
}
|
|
1281
1381
|
return this.element;
|
|
1282
1382
|
}
|
|
1383
|
+
/**
|
|
1384
|
+
* The default value for the "view only" mode of a component if the value is not provided.
|
|
1385
|
+
* @returns {string} - The default value for this component.
|
|
1386
|
+
*/
|
|
1283
1387
|
get defaultViewOnlyValue() {
|
|
1284
1388
|
return '-';
|
|
1285
1389
|
}
|
|
1286
1390
|
/**
|
|
1287
1391
|
* Uses the widget to determine the output string.
|
|
1288
|
-
*
|
|
1289
|
-
* @param
|
|
1290
|
-
* @
|
|
1392
|
+
* @param {any} value - The current value of the component.
|
|
1393
|
+
* @param {any} options - The options for getValueAsString.
|
|
1394
|
+
* @returns {any|Array<any>} - The value as a string.
|
|
1291
1395
|
*/
|
|
1292
1396
|
getWidgetValueAsString(value, options) {
|
|
1293
1397
|
const noInputWidget = !this.refs.input || !this.refs.input[0] || !this.refs.input[0].widget;
|
|
@@ -1312,6 +1416,12 @@ class Component extends Element_1.default {
|
|
|
1312
1416
|
const widget = this.refs.input[0].widget;
|
|
1313
1417
|
return widget.getValueAsString(value, options);
|
|
1314
1418
|
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Returns the value of the component as a string.
|
|
1421
|
+
* @param {any} value - The value for this component.
|
|
1422
|
+
* @param {any} options - The options for this component.
|
|
1423
|
+
* @returns {string} - The string representation of the value of this component.
|
|
1424
|
+
*/
|
|
1315
1425
|
getValueAsString(value, options) {
|
|
1316
1426
|
if (!value) {
|
|
1317
1427
|
return '';
|
|
@@ -1329,20 +1439,32 @@ class Component extends Element_1.default {
|
|
|
1329
1439
|
const stringValue = value.toString();
|
|
1330
1440
|
return this.sanitize(stringValue);
|
|
1331
1441
|
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Returns the string representation "view" of the component value.
|
|
1444
|
+
* @param {any} value - The value of the component.
|
|
1445
|
+
* @param {any} options - The options for this component.
|
|
1446
|
+
* @returns {string} - The string representation of the value of this component.
|
|
1447
|
+
*/
|
|
1332
1448
|
getView(value, options) {
|
|
1333
1449
|
if (this.component.protected) {
|
|
1334
1450
|
return '--- PROTECTED ---';
|
|
1335
1451
|
}
|
|
1336
1452
|
return this.getValueAsString(value, options);
|
|
1337
1453
|
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Updates the items list for this component. Useful for Select and other List component types.
|
|
1456
|
+
* @param {...any} args - The arguments to pass to the onChange event.
|
|
1457
|
+
* @returns {void}
|
|
1458
|
+
*/
|
|
1338
1459
|
updateItems(...args) {
|
|
1339
1460
|
this.restoreValue();
|
|
1340
1461
|
this.onChange(...args);
|
|
1341
1462
|
}
|
|
1342
1463
|
/**
|
|
1343
|
-
*
|
|
1344
|
-
* @param {
|
|
1345
|
-
* @
|
|
1464
|
+
* Returns the value for a specific item in a List type component.
|
|
1465
|
+
* @param {any} data - The data for this component.
|
|
1466
|
+
* @param {boolean} [forceUseValue] - if true, return 'value' property of the data
|
|
1467
|
+
* @returns {any} - The value of the item.
|
|
1346
1468
|
*/
|
|
1347
1469
|
itemValue(data, forceUseValue = false) {
|
|
1348
1470
|
if (lodash_1.default.isObject(data) && !lodash_1.default.isArray(data)) {
|
|
@@ -1355,6 +1477,11 @@ class Component extends Element_1.default {
|
|
|
1355
1477
|
}
|
|
1356
1478
|
return data;
|
|
1357
1479
|
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Returns the item value for html mode.
|
|
1482
|
+
* @param {any} value - The value for this component.
|
|
1483
|
+
* @returns {any} - The value of the item for html mode.
|
|
1484
|
+
*/
|
|
1358
1485
|
itemValueForHTMLMode(value) {
|
|
1359
1486
|
if (Array.isArray(value)) {
|
|
1360
1487
|
const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
@@ -1362,6 +1489,13 @@ class Component extends Element_1.default {
|
|
|
1362
1489
|
}
|
|
1363
1490
|
return this.itemValue(value);
|
|
1364
1491
|
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Creates a modal to input the value of this component.
|
|
1494
|
+
* @param {HTMLElement} element - The element to attach the modal to.
|
|
1495
|
+
* @param {any} attr - A list of attributes to add to the modal.
|
|
1496
|
+
* @param {boolean} confirm - If we should add a confirmation to the modal that keeps it from closing unless confirmed.
|
|
1497
|
+
* @returns {HTMLElement} - The created modal element.
|
|
1498
|
+
*/
|
|
1365
1499
|
createModal(element, attr, confirm) {
|
|
1366
1500
|
const dialog = this.ce('div', attr || {});
|
|
1367
1501
|
this.setContent(dialog, this.renderTemplate('dialog'));
|
|
@@ -1397,6 +1531,10 @@ class Component extends Element_1.default {
|
|
|
1397
1531
|
this.addEventListener(dialog.refs.dialogClose, 'click', handleCloseClick);
|
|
1398
1532
|
return dialog;
|
|
1399
1533
|
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Uses CSS classes to show or hide an element.
|
|
1536
|
+
* @returns {boolean} - TRUE if the element has been css removed.
|
|
1537
|
+
*/
|
|
1400
1538
|
get optimizeRedraw() {
|
|
1401
1539
|
if (this.options.optimizeRedraw && this.element && !this.visible) {
|
|
1402
1540
|
this.addClass(this.element, 'formio-removed');
|
|
@@ -1434,7 +1572,7 @@ class Component extends Element_1.default {
|
|
|
1434
1572
|
}
|
|
1435
1573
|
/**
|
|
1436
1574
|
* Build the custom style from the layout values
|
|
1437
|
-
* @
|
|
1575
|
+
* @returns {string} - The custom style
|
|
1438
1576
|
*/
|
|
1439
1577
|
get customStyle() {
|
|
1440
1578
|
let customCSS = '';
|
|
@@ -1445,24 +1583,31 @@ class Component extends Element_1.default {
|
|
|
1445
1583
|
});
|
|
1446
1584
|
return customCSS;
|
|
1447
1585
|
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Returns the component condition operator settings if available.
|
|
1588
|
+
* @returns {object} - The component condition operator settings.
|
|
1589
|
+
*/
|
|
1448
1590
|
static get serverConditionSettings() {
|
|
1449
1591
|
return Component.conditionOperatorsSettings;
|
|
1450
1592
|
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Returns if the application is on a mobile device.
|
|
1595
|
+
* @returns {boolean} - TRUE if the application is on a mobile device.
|
|
1596
|
+
*/
|
|
1451
1597
|
get isMobile() {
|
|
1452
1598
|
return (0, ismobilejs_1.default)();
|
|
1453
1599
|
}
|
|
1454
1600
|
/**
|
|
1455
1601
|
* Returns the outside wrapping element of this component.
|
|
1456
|
-
* @returns {HTMLElement}
|
|
1602
|
+
* @returns {HTMLElement} - The wrapping element of this component.
|
|
1457
1603
|
*/
|
|
1458
1604
|
getElement() {
|
|
1459
1605
|
return this.element;
|
|
1460
1606
|
}
|
|
1461
1607
|
/**
|
|
1462
1608
|
* Create an evaluation context for all script executions and interpolations.
|
|
1463
|
-
*
|
|
1464
|
-
* @
|
|
1465
|
-
* @return {*}
|
|
1609
|
+
* @param {any} additional - Additional context to provide.
|
|
1610
|
+
* @returns {any} - The evaluation context.
|
|
1466
1611
|
*/
|
|
1467
1612
|
evalContext(additional) {
|
|
1468
1613
|
return super.evalContext(Object.assign({
|
|
@@ -1484,18 +1629,29 @@ class Component extends Element_1.default {
|
|
|
1484
1629
|
}
|
|
1485
1630
|
/**
|
|
1486
1631
|
* Sets the pristine flag for this component.
|
|
1487
|
-
*
|
|
1488
|
-
* @param pristine {boolean} - TRUE to make pristine, FALSE not pristine.
|
|
1632
|
+
* @param {boolean} pristine - TRUE to make pristine, FALSE not pristine.
|
|
1489
1633
|
*/
|
|
1490
1634
|
setPristine(pristine) {
|
|
1491
1635
|
this.pristine = pristine;
|
|
1492
1636
|
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Returns if the component is pristine.
|
|
1639
|
+
* @returns {boolean} - TRUE if the component is pristine.
|
|
1640
|
+
*/
|
|
1493
1641
|
get isPristine() {
|
|
1494
1642
|
return this.pristine;
|
|
1495
1643
|
}
|
|
1644
|
+
/**
|
|
1645
|
+
* Sets the dirty flag for this component.
|
|
1646
|
+
* @param {boolean} dirty - TRUE to make dirty, FALSE not dirty.
|
|
1647
|
+
*/
|
|
1496
1648
|
setDirty(dirty) {
|
|
1497
1649
|
this.dirty = dirty;
|
|
1498
1650
|
}
|
|
1651
|
+
/**
|
|
1652
|
+
* Returns if the component is dirty.
|
|
1653
|
+
* @returns {boolean} - TRUE if the component is dirty.
|
|
1654
|
+
*/
|
|
1499
1655
|
get isDirty() {
|
|
1500
1656
|
return this.dirty;
|
|
1501
1657
|
}
|
|
@@ -1509,12 +1665,23 @@ class Component extends Element_1.default {
|
|
|
1509
1665
|
this.restoreValue();
|
|
1510
1666
|
this.triggerRootChange();
|
|
1511
1667
|
}
|
|
1668
|
+
/**
|
|
1669
|
+
* Returns the icon class for a given icon name.
|
|
1670
|
+
* @param {string} name - The name of the icon you wish to fetch provided the icon class. This is the "font awesome" version of the name of the icon.
|
|
1671
|
+
* @param {boolean} spinning - If the component should be spinning.
|
|
1672
|
+
* @returns {string} - The icon class for the equivalent icon in the iconset we are using.
|
|
1673
|
+
*/
|
|
1512
1674
|
iconClass(name, spinning) {
|
|
1513
1675
|
const iconset = this.options.iconset || Templates_1.default.current.defaultIconset || 'fa';
|
|
1514
1676
|
return Templates_1.default.current.hasOwnProperty('iconClass')
|
|
1515
1677
|
? Templates_1.default.current.iconClass(iconset, name, spinning)
|
|
1516
1678
|
: this.options.iconset === 'fa' ? Templates_1.default.defaultTemplates.iconClass(iconset, name, spinning) : name;
|
|
1517
1679
|
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Returns the size css class names for our current template.
|
|
1682
|
+
* @param {string} size - The size class name for the default iconset.
|
|
1683
|
+
* @returns {string} - The size class for our component.
|
|
1684
|
+
*/
|
|
1518
1685
|
size(size) {
|
|
1519
1686
|
return Templates_1.default.current.hasOwnProperty('size')
|
|
1520
1687
|
? Templates_1.default.current.size(size)
|
|
@@ -1527,15 +1694,23 @@ class Component extends Element_1.default {
|
|
|
1527
1694
|
get name() {
|
|
1528
1695
|
return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
|
|
1529
1696
|
}
|
|
1697
|
+
/**
|
|
1698
|
+
* Returns the visible errors for this component.
|
|
1699
|
+
* @returns {Array<object>} - The visible errors for this component.
|
|
1700
|
+
*/
|
|
1530
1701
|
get visibleErrors() {
|
|
1531
1702
|
return this._visibleErrors;
|
|
1532
1703
|
}
|
|
1704
|
+
/**
|
|
1705
|
+
* Returns all the errors for this component, visible or not.
|
|
1706
|
+
* @returns {Array<object>} - All the errors for this component.
|
|
1707
|
+
*/
|
|
1533
1708
|
get errors() {
|
|
1534
1709
|
return this._errors;
|
|
1535
1710
|
}
|
|
1536
1711
|
/**
|
|
1537
1712
|
* Returns the error label for this component.
|
|
1538
|
-
* @
|
|
1713
|
+
* @returns {string} - The error label for this component.
|
|
1539
1714
|
*/
|
|
1540
1715
|
get errorLabel() {
|
|
1541
1716
|
return this.t(this.component.errorLabel
|
|
@@ -1545,12 +1720,20 @@ class Component extends Element_1.default {
|
|
|
1545
1720
|
}
|
|
1546
1721
|
/**
|
|
1547
1722
|
* Get the error message provided a certain type of error.
|
|
1548
|
-
* @param type
|
|
1549
|
-
* @
|
|
1723
|
+
* @param {string} type - The type of error to fetch the message for.
|
|
1724
|
+
* @returns {string} - The error message configured for this component.
|
|
1550
1725
|
*/
|
|
1551
1726
|
errorMessage(type) {
|
|
1552
1727
|
return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
|
|
1553
1728
|
}
|
|
1729
|
+
/**
|
|
1730
|
+
* Sets the content, innerHTML, of an element to the sanitized content.
|
|
1731
|
+
* @param {HTMLElement} element - The element to set the innerHTML to.
|
|
1732
|
+
* @param {string} content - The HTML string content that we wish to set.
|
|
1733
|
+
* @param {boolean} forceSanitize - If we should force the content to be sanitized.
|
|
1734
|
+
* @param {any} sanitizeOptions - The options for the sanitize function.
|
|
1735
|
+
* @returns {boolean} - TRUE if the content was sanitized and set.
|
|
1736
|
+
*/
|
|
1554
1737
|
setContent(element, content, forceSanitize, sanitizeOptions) {
|
|
1555
1738
|
if (element instanceof HTMLElement) {
|
|
1556
1739
|
element.innerHTML = this.sanitize(content, forceSanitize, sanitizeOptions);
|
|
@@ -1558,6 +1741,9 @@ class Component extends Element_1.default {
|
|
|
1558
1741
|
}
|
|
1559
1742
|
return false;
|
|
1560
1743
|
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Restores the caret position in the input element after a refresh occurs.
|
|
1746
|
+
*/
|
|
1561
1747
|
restoreCaretPosition() {
|
|
1562
1748
|
var _a, _b, _c;
|
|
1563
1749
|
if ((_a = this.root) === null || _a === void 0 ? void 0 : _a.currentSelection) {
|
|
@@ -1580,6 +1766,10 @@ class Component extends Element_1.default {
|
|
|
1580
1766
|
}
|
|
1581
1767
|
}
|
|
1582
1768
|
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Redraw the component.
|
|
1771
|
+
* @returns {Promise<void>} - A promise that resolves when the component is done redrawing.
|
|
1772
|
+
*/
|
|
1583
1773
|
redraw() {
|
|
1584
1774
|
// Don't bother if we have not built yet.
|
|
1585
1775
|
if (!this.element || !this.element.parentNode || this.optimizeRedraw) {
|
|
@@ -1595,29 +1785,54 @@ class Component extends Element_1.default {
|
|
|
1595
1785
|
this.setElement(parent.children[index]);
|
|
1596
1786
|
return this.attach(this.element);
|
|
1597
1787
|
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Rebuild and redraw a component.
|
|
1790
|
+
* @returns {Promise<void>} - A promise that resolves when the component is done rebuilding and redrawing.
|
|
1791
|
+
*/
|
|
1598
1792
|
rebuild() {
|
|
1599
1793
|
this.destroy();
|
|
1600
1794
|
this.init();
|
|
1601
1795
|
this.visible = this.conditionallyVisible(null, null);
|
|
1602
1796
|
return this.redraw();
|
|
1603
1797
|
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Removes all event listeners attached to this component.
|
|
1800
|
+
*/
|
|
1604
1801
|
removeEventListeners() {
|
|
1605
1802
|
super.removeEventListeners();
|
|
1606
1803
|
this.tooltips.forEach(tooltip => tooltip.destroy());
|
|
1607
1804
|
this.tooltips = [];
|
|
1608
1805
|
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Returns if the dom node has the classes provided.
|
|
1808
|
+
* @param {HTMLElement} element - The element to check for the class.
|
|
1809
|
+
* @param {string} className - The name of the class to check.
|
|
1810
|
+
* @returns {boolean|void} - TRUE if the element has the class.
|
|
1811
|
+
*/
|
|
1609
1812
|
hasClass(element, className) {
|
|
1610
1813
|
if (!element) {
|
|
1611
1814
|
return;
|
|
1612
1815
|
}
|
|
1613
1816
|
return super.hasClass(element, this.transform('class', className));
|
|
1614
1817
|
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Adds a class to an HTML element.
|
|
1820
|
+
* @param {HTMLElement} element - The dom element to add the class to.
|
|
1821
|
+
* @param {string} className - The class name you wish to add.
|
|
1822
|
+
* @returns {this|void} - The component instance.
|
|
1823
|
+
*/
|
|
1615
1824
|
addClass(element, className) {
|
|
1616
1825
|
if (!element) {
|
|
1617
1826
|
return;
|
|
1618
1827
|
}
|
|
1619
1828
|
return super.addClass(element, this.transform('class', className));
|
|
1620
1829
|
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Removes a class from an element.
|
|
1832
|
+
* @param {HTMLElement} element - The element to remove the class from.
|
|
1833
|
+
* @param {string} className - The class name to remove.
|
|
1834
|
+
* @returns {this|void} - The component instance.
|
|
1835
|
+
*/
|
|
1621
1836
|
removeClass(element, className) {
|
|
1622
1837
|
if (!element) {
|
|
1623
1838
|
return;
|
|
@@ -1626,8 +1841,7 @@ class Component extends Element_1.default {
|
|
|
1626
1841
|
}
|
|
1627
1842
|
/**
|
|
1628
1843
|
* Determines if this component has a condition defined.
|
|
1629
|
-
*
|
|
1630
|
-
* @return {null}
|
|
1844
|
+
* @returns {boolean} - TRUE if the component has a condition defined.
|
|
1631
1845
|
*/
|
|
1632
1846
|
hasCondition() {
|
|
1633
1847
|
if (this._hasCondition !== null) {
|
|
@@ -1638,9 +1852,9 @@ class Component extends Element_1.default {
|
|
|
1638
1852
|
}
|
|
1639
1853
|
/**
|
|
1640
1854
|
* Check if this component is conditionally visible.
|
|
1641
|
-
*
|
|
1642
|
-
* @param data
|
|
1643
|
-
* @
|
|
1855
|
+
* @param {any} data - The data to check against.
|
|
1856
|
+
* @param {any} row - The row data to check against.
|
|
1857
|
+
* @returns {boolean} - TRUE if the component is conditionally visible.
|
|
1644
1858
|
*/
|
|
1645
1859
|
conditionallyVisible(data, row) {
|
|
1646
1860
|
data = data || this.rootValue;
|
|
@@ -1655,16 +1869,19 @@ class Component extends Element_1.default {
|
|
|
1655
1869
|
* Checks the condition of this component.
|
|
1656
1870
|
*
|
|
1657
1871
|
* 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.
|
|
1872
|
+
* @param {any} row - The row contextual data.
|
|
1873
|
+
* @param {any} data - The global data object.
|
|
1874
|
+
* @returns {boolean} - True if the condition applies to this component.
|
|
1662
1875
|
*/
|
|
1663
1876
|
checkCondition(row, data) {
|
|
1664
1877
|
return FormioUtils.checkCondition(this.component, row || this.data, data || this.rootValue, this.root ? this.root._form : {}, this);
|
|
1665
1878
|
}
|
|
1666
1879
|
/**
|
|
1667
1880
|
* Check for conditionals and hide/show the element based on those conditions.
|
|
1881
|
+
* @param {any} data - The data to check against.
|
|
1882
|
+
* @param {any} flags - The flags passed to checkData function.
|
|
1883
|
+
* @param {any} row - The row data to check against.
|
|
1884
|
+
* @returns {boolean} - TRUE if the component is visible.
|
|
1668
1885
|
*/
|
|
1669
1886
|
checkComponentConditions(data, flags, row) {
|
|
1670
1887
|
data = data || this.rootValue;
|
|
@@ -1682,8 +1899,10 @@ class Component extends Element_1.default {
|
|
|
1682
1899
|
}
|
|
1683
1900
|
/**
|
|
1684
1901
|
* Checks conditions for this component and any sub components.
|
|
1685
|
-
* @param
|
|
1686
|
-
* @
|
|
1902
|
+
* @param {any} data - The data to check against.
|
|
1903
|
+
* @param {any} flags - The flags passed to checkData function.
|
|
1904
|
+
* @param {any} row - The row data to check against.
|
|
1905
|
+
* @returns {boolean} - TRUE if the component is visible.
|
|
1687
1906
|
*/
|
|
1688
1907
|
checkConditions(data, flags, row) {
|
|
1689
1908
|
data = data || this.rootValue;
|
|
@@ -1691,17 +1910,20 @@ class Component extends Element_1.default {
|
|
|
1691
1910
|
row = row || this.data;
|
|
1692
1911
|
return this.checkComponentConditions(data, flags, row);
|
|
1693
1912
|
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Returns the component logic if applicable.
|
|
1915
|
+
* @returns {Array<object>} - The component logic.
|
|
1916
|
+
*/
|
|
1694
1917
|
get logic() {
|
|
1695
1918
|
return this.component.logic || [];
|
|
1696
1919
|
}
|
|
1697
1920
|
/**
|
|
1698
1921
|
* Check all triggers and apply necessary actions.
|
|
1699
|
-
*
|
|
1700
|
-
* @param data
|
|
1922
|
+
* @param {any} data - The data to check against.
|
|
1923
|
+
* @param {any} row - The row data to check against.
|
|
1924
|
+
* @returns {boolean|void} - TRUE if the component was altered.
|
|
1701
1925
|
*/
|
|
1702
|
-
fieldLogic(data, row) {
|
|
1703
|
-
data = data || this.rootValue;
|
|
1704
|
-
row = row || this.data;
|
|
1926
|
+
fieldLogic(data = this.rootValue, row = this.data) {
|
|
1705
1927
|
const logics = this.logic;
|
|
1706
1928
|
// If there aren't logic, don't go further.
|
|
1707
1929
|
if (logics.length === 0) {
|
|
@@ -1724,6 +1946,10 @@ class Component extends Element_1.default {
|
|
|
1724
1946
|
}
|
|
1725
1947
|
return changed;
|
|
1726
1948
|
}
|
|
1949
|
+
/**
|
|
1950
|
+
* Retuns if the browser is Internet Explorer.
|
|
1951
|
+
* @returns {boolean} - TRUE if the browser is IE.
|
|
1952
|
+
*/
|
|
1727
1953
|
isIE() {
|
|
1728
1954
|
if (typeof window === 'undefined') {
|
|
1729
1955
|
return false;
|
|
@@ -1748,9 +1974,24 @@ class Component extends Element_1.default {
|
|
|
1748
1974
|
// other browser
|
|
1749
1975
|
return false;
|
|
1750
1976
|
}
|
|
1977
|
+
/**
|
|
1978
|
+
* Defines the logic action value through evaluation.
|
|
1979
|
+
* @param {object} action - The action within the Logic system to perform.
|
|
1980
|
+
* @param {object} argsObject - The arguments to pass to the evaluation.
|
|
1981
|
+
* @returns {any} - The result of the evaluation.
|
|
1982
|
+
*/
|
|
1751
1983
|
defineActionValue(action, argsObject) {
|
|
1752
1984
|
return this.evaluate(action.value, argsObject, 'value');
|
|
1753
1985
|
}
|
|
1986
|
+
/**
|
|
1987
|
+
* Apply the actions of Logic for a component once the conditions have been met.
|
|
1988
|
+
* @param {object} newComponent - The new component to apply the actions to.
|
|
1989
|
+
* @param {Array<object>} actions - An array of actions
|
|
1990
|
+
* @param {any} result - The result of the conditional check in order to evaluate the actions.
|
|
1991
|
+
* @param {any} row - The contextual row data for this component.
|
|
1992
|
+
* @param {any} data - The global data object for the submission.
|
|
1993
|
+
* @returns {boolean} - TRUE if the component was altered.
|
|
1994
|
+
*/
|
|
1754
1995
|
applyActions(newComponent, actions, result, row, data) {
|
|
1755
1996
|
data = data || this.rootValue;
|
|
1756
1997
|
row = row || this.data;
|
|
@@ -1830,8 +2071,8 @@ class Component extends Element_1.default {
|
|
|
1830
2071
|
}
|
|
1831
2072
|
/**
|
|
1832
2073
|
* Add a new input error to this element.
|
|
1833
|
-
*
|
|
1834
|
-
* @
|
|
2074
|
+
* @param {Array<object>|string} messages - An array of messages to add to the element.
|
|
2075
|
+
* @returns {void}
|
|
1835
2076
|
*/
|
|
1836
2077
|
addMessages(messages) {
|
|
1837
2078
|
if (!messages) {
|
|
@@ -1854,6 +2095,15 @@ class Component extends Element_1.default {
|
|
|
1854
2095
|
}).join(''));
|
|
1855
2096
|
}
|
|
1856
2097
|
}
|
|
2098
|
+
/**
|
|
2099
|
+
* Sets the form input widget error classes.
|
|
2100
|
+
* @param {Array<HTMLElement>} elements - An array of DOM elements to set the error classes on.
|
|
2101
|
+
* @param {boolean} dirty - If the input is dirty.
|
|
2102
|
+
* @param {boolean} hasErrors - If the input has errors.
|
|
2103
|
+
* @param {boolean} hasMessages - If the input has messages.
|
|
2104
|
+
* @param {HTMLElement} element - The wrapper element for all the other elements passed in first argument.
|
|
2105
|
+
* @returns {void}
|
|
2106
|
+
*/
|
|
1857
2107
|
setErrorClasses(elements, dirty, hasErrors, hasMessages, element = this.element) {
|
|
1858
2108
|
this.clearErrorClasses();
|
|
1859
2109
|
elements.forEach((element) => {
|
|
@@ -1880,6 +2130,12 @@ class Component extends Element_1.default {
|
|
|
1880
2130
|
this.addClass(element, 'has-message');
|
|
1881
2131
|
}
|
|
1882
2132
|
}
|
|
2133
|
+
/**
|
|
2134
|
+
* Adds the classes necessary to mark an element as invalid.
|
|
2135
|
+
* @param {HTMLElement} element - The element you wish to add the invalid classes to.
|
|
2136
|
+
* @param {boolean} invalid - TRUE if the component is invalid, FALSE otherwise.
|
|
2137
|
+
* @returns {void}
|
|
2138
|
+
*/
|
|
1883
2139
|
setElementInvalid(element, invalid) {
|
|
1884
2140
|
if (!element)
|
|
1885
2141
|
return;
|
|
@@ -1891,6 +2147,9 @@ class Component extends Element_1.default {
|
|
|
1891
2147
|
}
|
|
1892
2148
|
element.setAttribute('aria-invalid', invalid ? 'true' : 'false');
|
|
1893
2149
|
}
|
|
2150
|
+
/**
|
|
2151
|
+
* Clears the components data if it is conditionally hidden AND clearOnHide is set to true for this component.
|
|
2152
|
+
*/
|
|
1894
2153
|
clearOnHide() {
|
|
1895
2154
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
1896
2155
|
if (
|
|
@@ -1910,6 +2169,10 @@ class Component extends Element_1.default {
|
|
|
1910
2169
|
}
|
|
1911
2170
|
}
|
|
1912
2171
|
}
|
|
2172
|
+
/**
|
|
2173
|
+
* Triggers a debounced onChange event for the root component (usually Webform).
|
|
2174
|
+
* @param {...any} args - The arguments to pass to the onChange event.
|
|
2175
|
+
*/
|
|
1913
2176
|
triggerRootChange(...args) {
|
|
1914
2177
|
if (this.options.onChange) {
|
|
1915
2178
|
this.options.onChange(...args);
|
|
@@ -1918,6 +2181,13 @@ class Component extends Element_1.default {
|
|
|
1918
2181
|
this.root.triggerChange(...args);
|
|
1919
2182
|
}
|
|
1920
2183
|
}
|
|
2184
|
+
/**
|
|
2185
|
+
* Called when the component value has been changed. This will then trigger the root level onChange handler which
|
|
2186
|
+
* propagates the checkData methods for the full component tree.
|
|
2187
|
+
* @param {any} flags - The flags for the change event propagation.
|
|
2188
|
+
* @param {boolean} fromRoot - If the change event is from the root component.
|
|
2189
|
+
* @returns {boolean} - TRUE if the component has changed.
|
|
2190
|
+
*/
|
|
1921
2191
|
onChange(flags, fromRoot) {
|
|
1922
2192
|
flags = flags || {};
|
|
1923
2193
|
if (flags.modified) {
|
|
@@ -2047,7 +2317,7 @@ class Component extends Element_1.default {
|
|
|
2047
2317
|
return Promise.reject();
|
|
2048
2318
|
}
|
|
2049
2319
|
this.quill = new Quill(element, isIEBrowser ? Object.assign(Object.assign({}, settings), { modules: {} }) : settings);
|
|
2050
|
-
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ
|
|
2320
|
+
/** This block of code adds the [source] capabilities. See https://codepen.io/anon/pen/ZyEjrQ */
|
|
2051
2321
|
const txtArea = document.createElement('textarea');
|
|
2052
2322
|
txtArea.setAttribute('class', 'quill-source-code');
|
|
2053
2323
|
this.quill.addContainer('ql-custom').appendChild(txtArea);
|
|
@@ -2061,7 +2331,7 @@ class Component extends Element_1.default {
|
|
|
2061
2331
|
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2062
2332
|
});
|
|
2063
2333
|
}
|
|
2064
|
-
/** END CODEBLOCK
|
|
2334
|
+
/** END CODEBLOCK */
|
|
2065
2335
|
// Make sure to select cursor when they click on the element.
|
|
2066
2336
|
this.addEventListener(element, 'click', () => this.quill.focus());
|
|
2067
2337
|
// Allows users to skip toolbar items when tabbing though form
|
|
@@ -2109,23 +2379,22 @@ class Component extends Element_1.default {
|
|
|
2109
2379
|
}
|
|
2110
2380
|
/**
|
|
2111
2381
|
* The empty value for this component.
|
|
2112
|
-
*
|
|
2113
|
-
* @return {null}
|
|
2382
|
+
* @returns {null} - The empty value for this component.
|
|
2114
2383
|
*/
|
|
2115
2384
|
get emptyValue() {
|
|
2116
2385
|
return null;
|
|
2117
2386
|
}
|
|
2118
2387
|
/**
|
|
2119
2388
|
* Returns if this component has a value set.
|
|
2120
|
-
*
|
|
2389
|
+
* @param {any} data - The global data object.
|
|
2390
|
+
* @returns {boolean} - TRUE if a value is set.
|
|
2121
2391
|
*/
|
|
2122
2392
|
hasValue(data) {
|
|
2123
2393
|
return !lodash_1.default.isUndefined(lodash_1.default.get(data || this.data, this.key));
|
|
2124
2394
|
}
|
|
2125
2395
|
/**
|
|
2126
2396
|
* Get the data value at the root level.
|
|
2127
|
-
*
|
|
2128
|
-
* @return {*}
|
|
2397
|
+
* @returns {*} - The root value for the component, typically the Webform data object.
|
|
2129
2398
|
*/
|
|
2130
2399
|
get rootValue() {
|
|
2131
2400
|
return this.root ? this.root.data : this.data;
|
|
@@ -2135,7 +2404,7 @@ class Component extends Element_1.default {
|
|
|
2135
2404
|
}
|
|
2136
2405
|
/**
|
|
2137
2406
|
* Get the static value of this component.
|
|
2138
|
-
* @
|
|
2407
|
+
* @returns {*} - The value for this component.
|
|
2139
2408
|
*/
|
|
2140
2409
|
get dataValue() {
|
|
2141
2410
|
if (!this.key ||
|
|
@@ -2153,8 +2422,7 @@ class Component extends Element_1.default {
|
|
|
2153
2422
|
}
|
|
2154
2423
|
/**
|
|
2155
2424
|
* Sets the static value of this component.
|
|
2156
|
-
*
|
|
2157
|
-
* @param value
|
|
2425
|
+
* @param {*} value - The value to set for this component.
|
|
2158
2426
|
*/
|
|
2159
2427
|
set dataValue(value) {
|
|
2160
2428
|
if (!this.allowData ||
|
|
@@ -2174,8 +2442,8 @@ class Component extends Element_1.default {
|
|
|
2174
2442
|
}
|
|
2175
2443
|
/**
|
|
2176
2444
|
* Splice a value from the dataValue.
|
|
2177
|
-
*
|
|
2178
|
-
* @param
|
|
2445
|
+
* @param {number} index - The index to splice for an array component values.
|
|
2446
|
+
* @param {*} flags - The flags to use when splicing the value.
|
|
2179
2447
|
*/
|
|
2180
2448
|
splice(index, flags = {}) {
|
|
2181
2449
|
if (this.hasValue()) {
|
|
@@ -2243,8 +2511,7 @@ class Component extends Element_1.default {
|
|
|
2243
2511
|
}
|
|
2244
2512
|
/**
|
|
2245
2513
|
* Get the input value of this component.
|
|
2246
|
-
*
|
|
2247
|
-
* @return {*}
|
|
2514
|
+
* @returns {*} - The value for the component.
|
|
2248
2515
|
*/
|
|
2249
2516
|
getValue() {
|
|
2250
2517
|
if (!this.hasInput || this.viewOnly || !this.refs.input || !this.refs.input.length) {
|
|
@@ -2266,9 +2533,8 @@ class Component extends Element_1.default {
|
|
|
2266
2533
|
}
|
|
2267
2534
|
/**
|
|
2268
2535
|
* Get the value at a specific index.
|
|
2269
|
-
*
|
|
2270
|
-
* @
|
|
2271
|
-
* @returns {*}
|
|
2536
|
+
* @param {number} index - For an array component or multiple values, this returns the value at a specific index.
|
|
2537
|
+
* @returns {*} - The value at the specified index.
|
|
2272
2538
|
*/
|
|
2273
2539
|
getValueAt(index) {
|
|
2274
2540
|
const input = this.performInputMapping(this.refs.input[index]);
|
|
@@ -2276,11 +2542,9 @@ class Component extends Element_1.default {
|
|
|
2276
2542
|
}
|
|
2277
2543
|
/**
|
|
2278
2544
|
* Set the value of this component.
|
|
2279
|
-
*
|
|
2280
|
-
* @param value
|
|
2281
|
-
* @
|
|
2282
|
-
*
|
|
2283
|
-
* @return {boolean} - If the value changed.
|
|
2545
|
+
* @param {*} value - The value to set for this component.
|
|
2546
|
+
* @param {*} flags - The flags to use when setting the value.
|
|
2547
|
+
* @returns {boolean} - If the value changed.
|
|
2284
2548
|
*/
|
|
2285
2549
|
setValue(value, flags = {}) {
|
|
2286
2550
|
const changed = this.updateValue(value, flags);
|
|
@@ -2311,9 +2575,9 @@ class Component extends Element_1.default {
|
|
|
2311
2575
|
}
|
|
2312
2576
|
/**
|
|
2313
2577
|
* Set the value at a specific index.
|
|
2314
|
-
*
|
|
2315
|
-
* @param index
|
|
2316
|
-
* @param value
|
|
2578
|
+
* @param {number} index - The index to set the value at.
|
|
2579
|
+
* @param {*} value - The value to set at the specified index.
|
|
2580
|
+
* @param {*} flags - The flags to use when setting the value.
|
|
2317
2581
|
*/
|
|
2318
2582
|
setValueAt(index, value, flags = {}) {
|
|
2319
2583
|
if (!flags.noDefault && (value === null || value === undefined) && !this.component.multiple) {
|
|
@@ -2360,9 +2624,8 @@ class Component extends Element_1.default {
|
|
|
2360
2624
|
}
|
|
2361
2625
|
/**
|
|
2362
2626
|
* Normalize values coming into updateValue.
|
|
2363
|
-
*
|
|
2364
|
-
* @
|
|
2365
|
-
* @return {*}
|
|
2627
|
+
* @param {*} value - The value to normalize before setting.
|
|
2628
|
+
* @returns {*} - The normalized value.
|
|
2366
2629
|
*/
|
|
2367
2630
|
normalizeValue(value) {
|
|
2368
2631
|
if (this.component.multiple && !Array.isArray(value)) {
|
|
@@ -2372,8 +2635,9 @@ class Component extends Element_1.default {
|
|
|
2372
2635
|
}
|
|
2373
2636
|
/**
|
|
2374
2637
|
* Update a value of this component.
|
|
2375
|
-
*
|
|
2376
|
-
* @param flags
|
|
2638
|
+
* @param {*} value - The value to update.
|
|
2639
|
+
* @param {*} flags - The flags to use when updating the value.
|
|
2640
|
+
* @returns {boolean} - If the value changed.
|
|
2377
2641
|
*/
|
|
2378
2642
|
updateComponentValue(value, flags = {}) {
|
|
2379
2643
|
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
@@ -2392,9 +2656,8 @@ class Component extends Element_1.default {
|
|
|
2392
2656
|
}
|
|
2393
2657
|
/**
|
|
2394
2658
|
* Updates the value of this component plus all sub-components.
|
|
2395
|
-
*
|
|
2396
|
-
* @
|
|
2397
|
-
* @return {boolean}
|
|
2659
|
+
* @param {...any} args - The arguments to pass to updateValue.
|
|
2660
|
+
* @returns {boolean} - If the value changed.
|
|
2398
2661
|
*/
|
|
2399
2662
|
updateValue(...args) {
|
|
2400
2663
|
return this.updateComponentValue(...args);
|
|
@@ -2412,7 +2675,7 @@ class Component extends Element_1.default {
|
|
|
2412
2675
|
*/
|
|
2413
2676
|
resetValue() {
|
|
2414
2677
|
this.unset();
|
|
2415
|
-
this.setValue(this.emptyValue, {
|
|
2678
|
+
this.setValue(this.defaultValue || this.emptyValue, {
|
|
2416
2679
|
noUpdateEvent: true,
|
|
2417
2680
|
noValidate: true,
|
|
2418
2681
|
resetValue: true
|
|
@@ -2420,10 +2683,9 @@ class Component extends Element_1.default {
|
|
|
2420
2683
|
}
|
|
2421
2684
|
/**
|
|
2422
2685
|
* Determine if the value of this component has changed.
|
|
2423
|
-
*
|
|
2424
|
-
* @param
|
|
2425
|
-
* @
|
|
2426
|
-
* @return {boolean}
|
|
2686
|
+
* @param {*} newValue - The new value to check.
|
|
2687
|
+
* @param {*} oldValue - The existing value of the component.
|
|
2688
|
+
* @returns {boolean} - TRUE if the value has changed.
|
|
2427
2689
|
*/
|
|
2428
2690
|
hasChanged(newValue, oldValue) {
|
|
2429
2691
|
if (((newValue === undefined) || (newValue === null)) &&
|
|
@@ -2441,8 +2703,9 @@ class Component extends Element_1.default {
|
|
|
2441
2703
|
}
|
|
2442
2704
|
/**
|
|
2443
2705
|
* Update the value on change.
|
|
2444
|
-
*
|
|
2445
|
-
* @param
|
|
2706
|
+
* @param {*} flags - The flags to use when triggering the on change event.
|
|
2707
|
+
* @param {boolean} changed - If the value has changed.
|
|
2708
|
+
* @returns {boolean} - If the value changed.
|
|
2446
2709
|
*/
|
|
2447
2710
|
updateOnChange(flags = {}, changed = false) {
|
|
2448
2711
|
if (!flags.noUpdateEvent && changed) {
|
|
@@ -2455,13 +2718,6 @@ class Component extends Element_1.default {
|
|
|
2455
2718
|
}
|
|
2456
2719
|
return false;
|
|
2457
2720
|
}
|
|
2458
|
-
/**
|
|
2459
|
-
* Perform a calculated value operation.
|
|
2460
|
-
*
|
|
2461
|
-
* @param data - The global data object.
|
|
2462
|
-
*
|
|
2463
|
-
* @return {boolean} - If the value changed during calculation.
|
|
2464
|
-
*/
|
|
2465
2721
|
convertNumberOrBoolToString(value) {
|
|
2466
2722
|
if (typeof value === 'number' || typeof value === 'boolean') {
|
|
2467
2723
|
return value.toString();
|
|
@@ -2559,7 +2815,7 @@ class Component extends Element_1.default {
|
|
|
2559
2815
|
}
|
|
2560
2816
|
this.calculatedValue = (0, utils_1.fastCloneDeep)(calculatedValue);
|
|
2561
2817
|
if (changed) {
|
|
2562
|
-
if (!flags.noPristineChangeOnModified) {
|
|
2818
|
+
if (!flags.noPristineChangeOnModified && this.root.initialized) {
|
|
2563
2819
|
this.pristine = false;
|
|
2564
2820
|
}
|
|
2565
2821
|
flags.triggeredComponentId = this.id;
|
|
@@ -2570,9 +2826,10 @@ class Component extends Element_1.default {
|
|
|
2570
2826
|
/* eslint-enable max-statements */
|
|
2571
2827
|
/**
|
|
2572
2828
|
* Performs calculations in this component plus any child components.
|
|
2573
|
-
*
|
|
2574
|
-
* @param
|
|
2575
|
-
* @
|
|
2829
|
+
* @param {*} data - The data to perform the calculation with.
|
|
2830
|
+
* @param {*} flags - The flags to use when calculating the value.
|
|
2831
|
+
* @param {*} row - The contextual row data to use when performing the calculation.
|
|
2832
|
+
* @returns {boolean} - TRUE if the value changed.
|
|
2576
2833
|
*/
|
|
2577
2834
|
calculateValue(data, flags, row) {
|
|
2578
2835
|
data = data || this.rootValue;
|
|
@@ -2582,15 +2839,14 @@ class Component extends Element_1.default {
|
|
|
2582
2839
|
}
|
|
2583
2840
|
/**
|
|
2584
2841
|
* Get this component's label text.
|
|
2585
|
-
*
|
|
2842
|
+
* @returns {string} - The label text for this component.
|
|
2586
2843
|
*/
|
|
2587
2844
|
get label() {
|
|
2588
2845
|
return this.component.label;
|
|
2589
2846
|
}
|
|
2590
2847
|
/**
|
|
2591
2848
|
* Set this component's label text and render it.
|
|
2592
|
-
*
|
|
2593
|
-
* @param value - The new label text.
|
|
2849
|
+
* @param {string} value - The new label text.
|
|
2594
2850
|
*/
|
|
2595
2851
|
set label(value) {
|
|
2596
2852
|
this.component.label = value;
|
|
@@ -2600,17 +2856,18 @@ class Component extends Element_1.default {
|
|
|
2600
2856
|
}
|
|
2601
2857
|
/**
|
|
2602
2858
|
* Get FormioForm element at the root of this component tree.
|
|
2603
|
-
*
|
|
2859
|
+
* @returns {*} root - The root component to search from.
|
|
2604
2860
|
*/
|
|
2605
2861
|
getRoot() {
|
|
2606
2862
|
return this.root;
|
|
2607
2863
|
}
|
|
2608
2864
|
/**
|
|
2609
2865
|
* Returns the invalid message, or empty string if the component is valid.
|
|
2610
|
-
*
|
|
2611
|
-
* @param
|
|
2612
|
-
* @param
|
|
2613
|
-
* @
|
|
2866
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2867
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2868
|
+
* @param {boolean} ignoreCondition - If conditions for the component should be ignored when checking validity.
|
|
2869
|
+
* @param {*} row - Contextual row data for this component.
|
|
2870
|
+
* @returns {string} - The message to show when the component is invalid.
|
|
2614
2871
|
*/
|
|
2615
2872
|
invalidMessage(data, dirty, ignoreCondition, row) {
|
|
2616
2873
|
if (!ignoreCondition && !this.checkCondition(row, data)) {
|
|
@@ -2642,10 +2899,9 @@ class Component extends Element_1.default {
|
|
|
2642
2899
|
}
|
|
2643
2900
|
/**
|
|
2644
2901
|
* Returns if the component is valid or not.
|
|
2645
|
-
*
|
|
2646
|
-
* @param
|
|
2647
|
-
* @
|
|
2648
|
-
* @return {boolean}
|
|
2902
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2903
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2904
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2649
2905
|
*/
|
|
2650
2906
|
isValid(data, dirty) {
|
|
2651
2907
|
return !this.invalidMessage(data, dirty);
|
|
@@ -2664,8 +2920,8 @@ class Component extends Element_1.default {
|
|
|
2664
2920
|
}
|
|
2665
2921
|
/**
|
|
2666
2922
|
* Interpolate errors from the validation methods.
|
|
2667
|
-
* @param {
|
|
2668
|
-
* @returns
|
|
2923
|
+
* @param {Array<any>} errors - An array of errors to interpolate.
|
|
2924
|
+
* @returns {Array<any>} - The interpolated errors.
|
|
2669
2925
|
*/
|
|
2670
2926
|
interpolateErrors(errors) {
|
|
2671
2927
|
var _a;
|
|
@@ -2678,7 +2934,7 @@ class Component extends Element_1.default {
|
|
|
2678
2934
|
* @param {*} data - The root submission data.
|
|
2679
2935
|
* @param {*} row - The contextual row data.
|
|
2680
2936
|
* @param {*} flags - The flags to perform validation.
|
|
2681
|
-
* @returns
|
|
2937
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2682
2938
|
*/
|
|
2683
2939
|
showValidationErrors(errors, data, row, flags) {
|
|
2684
2940
|
if (flags.silentCheck) {
|
|
@@ -2698,9 +2954,9 @@ class Component extends Element_1.default {
|
|
|
2698
2954
|
* @param {*} data - The root data you wish to use for this component.
|
|
2699
2955
|
* @param {*} row - The contextual row data you wish to use for this component.
|
|
2700
2956
|
* @param {*} flags - The flags to control the behavior of the validation.
|
|
2701
|
-
* @returns
|
|
2957
|
+
* @returns {Array<any>} - An array of errors if the component is invalid.
|
|
2702
2958
|
*/
|
|
2703
|
-
validateComponent(data, row, flags = {}) {
|
|
2959
|
+
validateComponent(data = null, row = null, flags = {}) {
|
|
2704
2960
|
data = data || this.rootValue;
|
|
2705
2961
|
row = row || this.data;
|
|
2706
2962
|
const { async = false } = flags;
|
|
@@ -2731,13 +2987,14 @@ class Component extends Element_1.default {
|
|
|
2731
2987
|
}
|
|
2732
2988
|
/**
|
|
2733
2989
|
* Checks the validity of this component and sets the error message if it is invalid.
|
|
2734
|
-
*
|
|
2735
|
-
* @param
|
|
2736
|
-
* @param
|
|
2737
|
-
* @param
|
|
2738
|
-
* @
|
|
2739
|
-
|
|
2740
|
-
|
|
2990
|
+
* @param {*} data - The data to check if the component is valid.
|
|
2991
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
2992
|
+
* @param {*} row - The contextual row data for this component.
|
|
2993
|
+
* @param {*} flags - The flags to use when checking the validity.
|
|
2994
|
+
* @param {Array<any>} allErrors - An array of all errors that have occured so that it can be appended when another one occurs here.
|
|
2995
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
2996
|
+
*/
|
|
2997
|
+
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
2741
2998
|
data = data || this.rootValue;
|
|
2742
2999
|
row = row || this.data;
|
|
2743
3000
|
flags.dirty = dirty || false;
|
|
@@ -2773,32 +3030,30 @@ class Component extends Element_1.default {
|
|
|
2773
3030
|
}
|
|
2774
3031
|
/**
|
|
2775
3032
|
* Checks the validity of the component.
|
|
2776
|
-
* @param {*} data
|
|
2777
|
-
* @param {
|
|
2778
|
-
* @param {*} row
|
|
2779
|
-
* @param {
|
|
2780
|
-
* @
|
|
2781
|
-
|
|
2782
|
-
|
|
3033
|
+
* @param {*} data - The data to check if the component is valid.
|
|
3034
|
+
* @param {boolean} dirty - If the component is dirty.
|
|
3035
|
+
* @param {*} row - The contextual row data for this component.
|
|
3036
|
+
* @param {boolean} silentCheck - If the check should be silent and not set the error messages.
|
|
3037
|
+
* @param {Array<any>} errors - An array of all errors that have occured so that it can be appended when another one occurs here.
|
|
3038
|
+
* @returns {boolean} - TRUE if the component is valid.
|
|
3039
|
+
*/
|
|
3040
|
+
checkValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2783
3041
|
data = data || this.rootValue;
|
|
2784
3042
|
row = row || this.data;
|
|
2785
|
-
console.log('Deprecation warning: Component.checkValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
2786
3043
|
return this.checkComponentValidity(data, dirty, row, { silentCheck }, errors);
|
|
2787
3044
|
}
|
|
2788
|
-
checkAsyncValidity(data, dirty, row, silentCheck, errors = []) {
|
|
2789
|
-
console.log('Deprecation warning: Component.checkAsyncValidity() will be deprecated in 6.x version of renderer. Use Component.validateComponent instead.');
|
|
3045
|
+
checkAsyncValidity(data = null, dirty = false, row = null, silentCheck = false, errors = []) {
|
|
2790
3046
|
return this.checkComponentValidity(data, dirty, row, { async: true, silentCheck }, errors);
|
|
2791
3047
|
}
|
|
2792
3048
|
/**
|
|
2793
3049
|
* Check the conditions, calculations, and validity of a single component and triggers an update if
|
|
2794
3050
|
* something changed.
|
|
2795
|
-
*
|
|
2796
|
-
* @param
|
|
2797
|
-
* @param
|
|
2798
|
-
*
|
|
2799
|
-
* @return boolean - If component is valid or not.
|
|
3051
|
+
* @param {*} data - The root data of the change event.
|
|
3052
|
+
* @param {*} flags - The flags from this change event.
|
|
3053
|
+
* @param {*} row - The contextual row data for this component.
|
|
3054
|
+
* @returns {void|boolean} - TRUE if no check should be performed on the component.
|
|
2800
3055
|
*/
|
|
2801
|
-
checkData(data, flags, row) {
|
|
3056
|
+
checkData(data = null, flags = null, row = null) {
|
|
2802
3057
|
data = data || this.rootValue;
|
|
2803
3058
|
flags = flags || {};
|
|
2804
3059
|
row = row || this.data;
|
|
@@ -2841,8 +3096,7 @@ class Component extends Element_1.default {
|
|
|
2841
3096
|
}
|
|
2842
3097
|
/**
|
|
2843
3098
|
* Check if a component is eligible for multiple validation
|
|
2844
|
-
*
|
|
2845
|
-
* @return {boolean}
|
|
3099
|
+
* @returns {boolean} - TRUE if the component is eligible for multiple validation.
|
|
2846
3100
|
*/
|
|
2847
3101
|
validateMultiple() {
|
|
2848
3102
|
return true;
|
|
@@ -2962,8 +3216,7 @@ class Component extends Element_1.default {
|
|
|
2962
3216
|
/**
|
|
2963
3217
|
* Determines if the value of this component is hidden from the user as if it is coming from the server, but is
|
|
2964
3218
|
* protected.
|
|
2965
|
-
*
|
|
2966
|
-
* @return {boolean|*}
|
|
3219
|
+
* @returns {boolean|*} - TRUE if the value is hidden.
|
|
2967
3220
|
*/
|
|
2968
3221
|
isValueHidden() {
|
|
2969
3222
|
if (this.component.protected && this.root.editing) {
|
|
@@ -3008,6 +3261,8 @@ class Component extends Element_1.default {
|
|
|
3008
3261
|
}
|
|
3009
3262
|
/**
|
|
3010
3263
|
* Prints out the value of this component as a string value.
|
|
3264
|
+
* @param {*} value - The value to print out.
|
|
3265
|
+
* @returns {string} - The string representation of the value.
|
|
3011
3266
|
*/
|
|
3012
3267
|
asString(value) {
|
|
3013
3268
|
value = value || this.getValue();
|
|
@@ -3015,15 +3270,14 @@ class Component extends Element_1.default {
|
|
|
3015
3270
|
}
|
|
3016
3271
|
/**
|
|
3017
3272
|
* Return if the component is disabled.
|
|
3018
|
-
* @
|
|
3273
|
+
* @returns {boolean} - TRUE if the component is disabled.
|
|
3019
3274
|
*/
|
|
3020
3275
|
get disabled() {
|
|
3021
3276
|
return this._disabled || this.parentDisabled;
|
|
3022
3277
|
}
|
|
3023
3278
|
/**
|
|
3024
3279
|
* Disable this component.
|
|
3025
|
-
*
|
|
3026
|
-
* @param {boolean} disabled
|
|
3280
|
+
* @param {boolean} disabled - TRUE to disable the component.
|
|
3027
3281
|
*/
|
|
3028
3282
|
set disabled(disabled) {
|
|
3029
3283
|
this._disabled = disabled;
|
|
@@ -3134,6 +3388,10 @@ class Component extends Element_1.default {
|
|
|
3134
3388
|
const disabled = this.shouldDisabled;
|
|
3135
3389
|
// Change states which won't be recalculated during redrawing
|
|
3136
3390
|
if (this.visible !== visible) {
|
|
3391
|
+
// If the logic is triggered by an event and the action sets the hidden state then the original
|
|
3392
|
+
// component definition must be changed so that the components hidden state does not get flipped back by
|
|
3393
|
+
// the fieldLogic function
|
|
3394
|
+
this.originalComponent.hidden = !visible;
|
|
3137
3395
|
this.visible = visible;
|
|
3138
3396
|
}
|
|
3139
3397
|
if (this.disabled !== disabled) {
|
|
@@ -3148,6 +3406,7 @@ class Component extends Element_1.default {
|
|
|
3148
3406
|
}
|
|
3149
3407
|
/**
|
|
3150
3408
|
* Get the element information.
|
|
3409
|
+
* @returns {*} - The components "input" DOM element information.
|
|
3151
3410
|
*/
|
|
3152
3411
|
elementInfo() {
|
|
3153
3412
|
const attributes = {
|
|
@@ -3186,15 +3445,13 @@ class Component extends Element_1.default {
|
|
|
3186
3445
|
const { left, top } = element.getBoundingClientRect();
|
|
3187
3446
|
window.scrollTo(left + window.scrollX, top + window.scrollY);
|
|
3188
3447
|
}
|
|
3189
|
-
focus(index) {
|
|
3448
|
+
focus(index = (this.refs.input.length - 1)) {
|
|
3190
3449
|
var _a, _b;
|
|
3191
3450
|
if ('beforeFocus' in this.parent) {
|
|
3192
3451
|
this.parent.beforeFocus(this);
|
|
3193
3452
|
}
|
|
3194
3453
|
if ((_a = this.refs.input) === null || _a === void 0 ? void 0 : _a.length) {
|
|
3195
|
-
const focusingInput =
|
|
3196
|
-
? this.refs.input[index]
|
|
3197
|
-
: this.refs.input[this.refs.input.length - 1];
|
|
3454
|
+
const focusingInput = this.refs.input[index];
|
|
3198
3455
|
if (((_b = this.component.widget) === null || _b === void 0 ? void 0 : _b.type) === 'calendar') {
|
|
3199
3456
|
const sibling = focusingInput.nextSibling;
|
|
3200
3457
|
if (sibling) {
|
|
@@ -3214,6 +3471,7 @@ class Component extends Element_1.default {
|
|
|
3214
3471
|
}
|
|
3215
3472
|
/**
|
|
3216
3473
|
* Get `Formio` instance for working with files
|
|
3474
|
+
* @returns {import('@formio/core').Formio} - The Formio instance file service.
|
|
3217
3475
|
*/
|
|
3218
3476
|
get fileService() {
|
|
3219
3477
|
if (this.options.fileService) {
|