@formio/js 5.0.0-rc.19 → 5.0.0-rc.21
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/README.md +1 -1
- package/dist/formio.builder.css +14 -22
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.css +1 -40
- package/dist/formio.embed.js +2 -90
- package/dist/formio.embed.min.css +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 +10 -2
- package/dist/formio.form.js +1267 -1103
- 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 -8
- package/dist/formio.full.css +14 -22
- package/dist/formio.full.js +1302 -1127
- 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 -8
- package/dist/formio.js +713 -626
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -7
- package/dist/formio.utils.js +220 -13
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -7
- package/lib/cjs/CDN.d.ts +1 -0
- package/lib/cjs/CDN.js +2 -1
- package/lib/cjs/Element.js +7 -2
- package/lib/cjs/Embed.d.ts +21 -1
- package/lib/cjs/Embed.js +211 -308
- package/lib/cjs/Form.d.ts +9 -6
- package/lib/cjs/Form.js +53 -11
- package/lib/cjs/PDF.d.ts +11 -3
- package/lib/cjs/PDF.js +4 -5
- package/lib/cjs/PDFBuilder.js +2 -3
- package/lib/cjs/Webform.d.ts +10 -13
- package/lib/cjs/Webform.js +46 -125
- package/lib/cjs/WebformBuilder.d.ts +6 -1
- package/lib/cjs/WebformBuilder.js +105 -65
- package/lib/cjs/Wizard.d.ts +8 -5
- package/lib/cjs/Wizard.js +12 -12
- package/lib/cjs/WizardBuilder.d.ts +6 -4
- package/lib/cjs/WizardBuilder.js +20 -3
- package/lib/cjs/addons/FormioAddon.d.ts +1 -1
- package/lib/cjs/addons/FormioAddon.js +1 -2
- package/lib/cjs/components/_classes/component/Component.d.ts +24 -8
- package/lib/cjs/components/_classes/component/Component.js +44 -14
- package/lib/cjs/components/_classes/input/Input.d.ts +1 -1
- package/lib/cjs/components/_classes/input/Input.js +1 -2
- package/lib/cjs/components/_classes/list/ListComponent.d.ts +4 -0
- package/lib/cjs/components/_classes/list/ListComponent.js +43 -6
- package/lib/cjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +10 -4
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +5 -2
- package/lib/cjs/components/_classes/nested/NestedComponent.js +9 -10
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
- package/lib/cjs/components/address/Address.d.ts +8 -0
- package/lib/cjs/components/address/Address.js +5 -0
- package/lib/cjs/components/button/Button.d.ts +1 -0
- package/lib/cjs/components/button/Button.js +5 -3
- package/lib/cjs/components/checkbox/Checkbox.d.ts +41 -0
- package/lib/cjs/components/checkbox/Checkbox.js +32 -5
- package/lib/cjs/components/columns/Columns.d.ts +2 -0
- package/lib/cjs/components/columns/Columns.js +4 -0
- package/lib/cjs/components/container/Container.d.ts +1 -0
- package/lib/cjs/components/container/Container.js +4 -0
- package/lib/cjs/components/content/Content.d.ts +2 -0
- package/lib/cjs/components/content/Content.js +4 -2
- package/lib/cjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
- package/lib/cjs/components/currency/editForm/Currency.edit.data.js +4 -0
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +4 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +1 -0
- package/lib/cjs/components/datagrid/DataGrid.js +8 -1
- package/lib/cjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/cjs/components/datamap/DataMap.js +4 -0
- package/lib/cjs/components/datetime/DateTime.d.ts +23 -0
- package/lib/cjs/components/datetime/DateTime.js +20 -1
- package/lib/cjs/components/day/Day.d.ts +22 -1
- package/lib/cjs/components/day/Day.js +20 -6
- package/lib/cjs/components/day/fixtures/comp3.js +2 -2
- package/lib/cjs/components/editgrid/EditGrid.d.ts +4 -3
- package/lib/cjs/components/editgrid/EditGrid.js +11 -6
- package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
- package/lib/cjs/components/editgrid/fixtures/comp-with-custom-default-value.js +227 -0
- package/lib/cjs/components/editgrid/fixtures/comp15.d.ts +54 -0
- package/lib/cjs/components/editgrid/fixtures/comp15.js +51 -0
- package/lib/cjs/components/editgrid/fixtures/index.d.ts +3 -1
- package/lib/cjs/components/editgrid/fixtures/index.js +5 -1
- package/lib/cjs/components/fieldset/Fieldset.d.ts +2 -0
- package/lib/cjs/components/fieldset/Fieldset.js +4 -0
- package/lib/cjs/components/file/File.d.ts +28 -6
- package/lib/cjs/components/file/File.js +40 -15
- package/lib/cjs/components/file/editForm/File.edit.file.d.ts +62 -0
- package/lib/cjs/components/file/editForm/File.edit.file.js +29 -2
- package/lib/cjs/components/form/Form.d.ts +4 -0
- package/lib/cjs/components/form/Form.js +12 -10
- package/lib/cjs/components/hidden/Hidden.d.ts +1 -0
- package/lib/cjs/components/hidden/Hidden.js +1 -0
- package/lib/cjs/components/html/HTML.d.ts +2 -0
- package/lib/cjs/components/html/HTML.js +4 -0
- package/lib/cjs/components/number/Number.d.ts +24 -1
- package/lib/cjs/components/number/Number.js +18 -6
- package/lib/cjs/components/panel/Panel.d.ts +1 -0
- package/lib/cjs/components/panel/Panel.js +3 -0
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +9 -0
- package/lib/cjs/components/radio/Radio.d.ts +24 -3
- package/lib/cjs/components/radio/Radio.js +89 -18
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +2 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.js +7 -5
- package/lib/cjs/components/resource/Resource.d.ts +7 -0
- package/lib/cjs/components/resource/Resource.js +0 -1
- package/lib/cjs/components/resource/editForm/Resource.edit.display.js +1 -1
- package/lib/cjs/components/select/Select.d.ts +25 -5
- package/lib/cjs/components/select/Select.js +51 -51
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +37 -0
- package/lib/cjs/components/selectboxes/SelectBoxes.js +60 -25
- package/lib/cjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
- package/lib/cjs/components/selectboxes/fixtures/comp4.js +47 -32
- package/lib/cjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
- package/lib/cjs/components/selectboxes/fixtures/comp6.js +15 -0
- package/lib/cjs/components/selectboxes/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/selectboxes/fixtures/index.js +3 -1
- package/lib/cjs/components/signature/Signature.d.ts +22 -1
- package/lib/cjs/components/signature/Signature.js +16 -3
- package/lib/cjs/components/survey/Survey.d.ts +21 -0
- package/lib/cjs/components/survey/Survey.js +9 -0
- package/lib/cjs/components/table/Table.d.ts +2 -0
- package/lib/cjs/components/table/Table.js +4 -0
- package/lib/cjs/components/tabs/Tabs.d.ts +2 -0
- package/lib/cjs/components/tabs/Tabs.js +4 -0
- package/lib/cjs/components/tags/Tags.d.ts +21 -0
- package/lib/cjs/components/tags/Tags.js +11 -0
- package/lib/cjs/components/textarea/TextArea.d.ts +3 -2
- package/lib/cjs/components/textarea/TextArea.js +4 -5
- package/lib/cjs/components/textarea/fixtures/comp4.d.ts +30 -0
- package/lib/cjs/components/textarea/fixtures/comp4.js +27 -0
- package/lib/cjs/components/textarea/fixtures/index.d.ts +2 -1
- package/lib/cjs/components/textarea/fixtures/index.js +3 -1
- package/lib/cjs/components/textfield/TextField.d.ts +22 -0
- package/lib/cjs/components/textfield/TextField.js +11 -3
- package/lib/cjs/components/time/Time.d.ts +11 -0
- package/lib/cjs/components/time/Time.js +6 -1
- package/lib/cjs/components/tree/Tree.d.ts +5 -4
- package/lib/cjs/components/tree/Tree.form.js +5 -0
- package/lib/cjs/components/tree/Tree.js +8 -9
- package/lib/cjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
- package/lib/cjs/components/tree/editForm/Tree.edit.display.js +12 -0
- package/lib/cjs/components/well/Well.d.ts +2 -0
- package/lib/cjs/components/well/Well.js +4 -0
- package/lib/cjs/formio.embed.d.ts +2 -1
- package/lib/cjs/formio.embed.js +96 -1
- package/lib/cjs/formio.form.d.ts +4 -3
- package/lib/cjs/formio.form.js +17 -8
- package/lib/cjs/licenses/Licenses.d.ts +7 -0
- package/lib/cjs/licenses/Licenses.js +22 -0
- package/lib/cjs/licenses/index.d.ts +2 -0
- package/lib/cjs/licenses/index.js +7 -0
- package/lib/cjs/providers/Providers.d.ts +31 -11
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +2 -2
- package/lib/cjs/providers/address/GoogleAddressProvider.js +2 -3
- package/lib/cjs/providers/processor/fileProcessor.d.ts +1 -1
- package/lib/cjs/providers/processor/fileProcessor.js +1 -5
- package/lib/cjs/providers/storage/azure.d.ts +10 -1
- package/lib/cjs/providers/storage/azure.js +7 -2
- package/lib/cjs/providers/storage/base64.d.ts +2 -2
- package/lib/cjs/providers/storage/base64.js +2 -6
- package/lib/cjs/providers/storage/dropbox.d.ts +2 -2
- package/lib/cjs/providers/storage/dropbox.js +2 -6
- package/lib/cjs/providers/storage/googleDrive.d.ts +3 -2
- package/lib/cjs/providers/storage/googleDrive.js +6 -6
- package/lib/cjs/providers/storage/indexeddb.d.ts +3 -3
- package/lib/cjs/providers/storage/indexeddb.js +9 -13
- package/lib/cjs/providers/storage/s3.d.ts +11 -1
- package/lib/cjs/providers/storage/s3.js +5 -2
- package/lib/cjs/providers/storage/uploadAdapter.js +1 -5
- package/lib/cjs/providers/storage/url.d.ts +2 -2
- package/lib/cjs/providers/storage/url.js +12 -8
- package/lib/cjs/providers/storage/xhr.d.ts +1 -1
- package/lib/cjs/providers/storage/xhr.js +1 -2
- package/lib/cjs/templates/index.d.ts +226 -1
- package/lib/cjs/utils/Evaluator.js +4 -33
- package/lib/cjs/utils/i18n.d.ts +16 -0
- package/lib/cjs/utils/i18n.js +88 -0
- package/lib/cjs/utils/utils.d.ts +11 -1
- package/lib/cjs/utils/utils.js +29 -10
- package/lib/cjs/validator/Validator.d.ts +30 -2
- package/lib/cjs/validator/Validator.js +32 -9
- package/lib/cjs/validator/rules/Select.js +1 -2
- package/lib/cjs/validator/rules/Unique.d.ts +1 -1
- package/lib/cjs/validator/rules/Unique.js +1 -2
- package/lib/cjs/widgets/CalendarWidget.d.ts +1 -0
- package/lib/cjs/widgets/InputWidget.d.ts +1 -1
- package/lib/cjs/widgets/InputWidget.js +1 -2
- package/lib/mjs/CDN.d.ts +1 -0
- package/lib/mjs/CDN.js +2 -1
- package/lib/mjs/Element.js +6 -2
- package/lib/mjs/Embed.d.ts +21 -1
- package/lib/mjs/Embed.js +208 -319
- package/lib/mjs/Form.d.ts +9 -6
- package/lib/mjs/Form.js +53 -11
- package/lib/mjs/PDF.d.ts +11 -3
- package/lib/mjs/PDF.js +4 -5
- package/lib/mjs/PDFBuilder.js +2 -3
- package/lib/mjs/Webform.d.ts +10 -13
- package/lib/mjs/Webform.js +46 -128
- package/lib/mjs/WebformBuilder.d.ts +6 -1
- package/lib/mjs/WebformBuilder.js +103 -65
- package/lib/mjs/Wizard.d.ts +8 -5
- package/lib/mjs/Wizard.js +12 -12
- package/lib/mjs/WizardBuilder.d.ts +6 -4
- package/lib/mjs/WizardBuilder.js +20 -3
- package/lib/mjs/addons/FormioAddon.d.ts +1 -1
- package/lib/mjs/addons/FormioAddon.js +1 -2
- package/lib/mjs/components/_classes/component/Component.d.ts +24 -8
- package/lib/mjs/components/_classes/component/Component.js +44 -14
- package/lib/mjs/components/_classes/input/Input.d.ts +1 -1
- package/lib/mjs/components/_classes/input/Input.js +1 -2
- package/lib/mjs/components/_classes/list/ListComponent.d.ts +4 -0
- package/lib/mjs/components/_classes/list/ListComponent.js +43 -5
- package/lib/mjs/components/_classes/multivalue/Multivalue.d.ts +1 -0
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +10 -4
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +5 -2
- package/lib/mjs/components/_classes/nested/NestedComponent.js +9 -10
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +1 -0
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +4 -0
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.d.ts +1 -0
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +4 -0
- package/lib/mjs/components/address/Address.d.ts +8 -0
- package/lib/mjs/components/address/Address.js +5 -0
- package/lib/mjs/components/button/Button.d.ts +1 -0
- package/lib/mjs/components/button/Button.js +6 -4
- package/lib/mjs/components/checkbox/Checkbox.d.ts +41 -0
- package/lib/mjs/components/checkbox/Checkbox.js +36 -5
- package/lib/mjs/components/columns/Columns.d.ts +2 -0
- package/lib/mjs/components/columns/Columns.js +4 -0
- package/lib/mjs/components/container/Container.d.ts +1 -0
- package/lib/mjs/components/container/Container.js +5 -1
- package/lib/mjs/components/content/Content.d.ts +2 -0
- package/lib/mjs/components/content/Content.js +4 -2
- package/lib/mjs/components/currency/editForm/Currency.edit.data.d.ts +14 -2
- package/lib/mjs/components/currency/editForm/Currency.edit.data.js +4 -0
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +4 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +1 -0
- package/lib/mjs/components/datagrid/DataGrid.js +8 -1
- package/lib/mjs/components/datamap/DataMap.d.ts +1 -0
- package/lib/mjs/components/datamap/DataMap.js +5 -1
- package/lib/mjs/components/datetime/DateTime.d.ts +23 -0
- package/lib/mjs/components/datetime/DateTime.js +27 -1
- package/lib/mjs/components/day/Day.d.ts +22 -1
- package/lib/mjs/components/day/Day.js +24 -7
- package/lib/mjs/components/day/fixtures/comp3.js +2 -2
- package/lib/mjs/components/editgrid/EditGrid.d.ts +4 -3
- package/lib/mjs/components/editgrid/EditGrid.js +11 -6
- package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.d.ts +190 -0
- package/lib/mjs/components/editgrid/fixtures/comp-with-custom-default-value.js +225 -0
- package/lib/mjs/components/editgrid/fixtures/comp15.d.ts +54 -0
- package/lib/mjs/components/editgrid/fixtures/comp15.js +49 -0
- package/lib/mjs/components/editgrid/fixtures/index.d.ts +3 -1
- package/lib/mjs/components/editgrid/fixtures/index.js +3 -1
- package/lib/mjs/components/fieldset/Fieldset.d.ts +2 -0
- package/lib/mjs/components/fieldset/Fieldset.js +4 -0
- package/lib/mjs/components/file/File.d.ts +28 -6
- package/lib/mjs/components/file/File.js +44 -16
- package/lib/mjs/components/file/editForm/File.edit.file.d.ts +62 -0
- package/lib/mjs/components/file/editForm/File.edit.file.js +29 -2
- package/lib/mjs/components/form/Form.d.ts +4 -0
- package/lib/mjs/components/form/Form.js +13 -11
- package/lib/mjs/components/hidden/Hidden.d.ts +1 -0
- package/lib/mjs/components/hidden/Hidden.js +1 -0
- package/lib/mjs/components/html/HTML.d.ts +2 -0
- package/lib/mjs/components/html/HTML.js +4 -0
- package/lib/mjs/components/number/Number.d.ts +24 -1
- package/lib/mjs/components/number/Number.js +23 -7
- package/lib/mjs/components/panel/Panel.d.ts +1 -0
- package/lib/mjs/components/panel/Panel.js +3 -0
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +9 -0
- package/lib/mjs/components/radio/Radio.d.ts +24 -3
- package/lib/mjs/components/radio/Radio.js +93 -19
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +2 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.js +7 -5
- package/lib/mjs/components/resource/Resource.d.ts +7 -0
- package/lib/mjs/components/resource/Resource.js +0 -1
- package/lib/mjs/components/resource/editForm/Resource.edit.display.js +1 -1
- package/lib/mjs/components/select/Select.d.ts +25 -5
- package/lib/mjs/components/select/Select.js +55 -52
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +37 -0
- package/lib/mjs/components/selectboxes/SelectBoxes.js +63 -25
- package/lib/mjs/components/selectboxes/fixtures/comp4.d.ts +30 -27
- package/lib/mjs/components/selectboxes/fixtures/comp4.js +47 -32
- package/lib/mjs/components/selectboxes/fixtures/comp6.d.ts +14 -0
- package/lib/mjs/components/selectboxes/fixtures/comp6.js +13 -0
- package/lib/mjs/components/selectboxes/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/selectboxes/fixtures/index.js +2 -1
- package/lib/mjs/components/signature/Signature.d.ts +22 -1
- package/lib/mjs/components/signature/Signature.js +19 -3
- package/lib/mjs/components/survey/Survey.d.ts +21 -0
- package/lib/mjs/components/survey/Survey.js +13 -1
- package/lib/mjs/components/table/Table.d.ts +2 -0
- package/lib/mjs/components/table/Table.js +4 -0
- package/lib/mjs/components/tabs/Tabs.d.ts +2 -0
- package/lib/mjs/components/tabs/Tabs.js +4 -0
- package/lib/mjs/components/tags/Tags.d.ts +21 -0
- package/lib/mjs/components/tags/Tags.js +14 -0
- package/lib/mjs/components/textarea/TextArea.d.ts +3 -2
- package/lib/mjs/components/textarea/TextArea.js +4 -5
- package/lib/mjs/components/textarea/fixtures/comp4.d.ts +30 -0
- package/lib/mjs/components/textarea/fixtures/comp4.js +25 -0
- package/lib/mjs/components/textarea/fixtures/index.d.ts +2 -1
- package/lib/mjs/components/textarea/fixtures/index.js +2 -1
- package/lib/mjs/components/textfield/TextField.d.ts +22 -0
- package/lib/mjs/components/textfield/TextField.js +14 -3
- package/lib/mjs/components/time/Time.d.ts +11 -0
- package/lib/mjs/components/time/Time.js +12 -1
- package/lib/mjs/components/tree/Tree.d.ts +5 -4
- package/lib/mjs/components/tree/Tree.form.js +5 -0
- package/lib/mjs/components/tree/Tree.js +8 -9
- package/lib/mjs/components/tree/editForm/Tree.edit.display.d.ts +9 -0
- package/lib/mjs/components/tree/editForm/Tree.edit.display.js +10 -0
- package/lib/mjs/components/well/Well.d.ts +2 -0
- package/lib/mjs/components/well/Well.js +4 -0
- package/lib/mjs/formio.embed.d.ts +2 -1
- package/lib/mjs/formio.embed.js +96 -2
- package/lib/mjs/formio.form.d.ts +4 -3
- package/lib/mjs/formio.form.js +16 -8
- package/lib/mjs/licenses/Licenses.d.ts +7 -0
- package/lib/mjs/licenses/Licenses.js +17 -0
- package/lib/mjs/licenses/index.d.ts +2 -0
- package/lib/mjs/licenses/index.js +2 -0
- package/lib/mjs/providers/Providers.d.ts +31 -11
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +2 -2
- package/lib/mjs/providers/address/GoogleAddressProvider.js +2 -3
- package/lib/mjs/providers/processor/fileProcessor.d.ts +1 -1
- package/lib/mjs/providers/processor/fileProcessor.js +1 -2
- package/lib/mjs/providers/storage/azure.d.ts +10 -1
- package/lib/mjs/providers/storage/azure.js +7 -2
- package/lib/mjs/providers/storage/base64.d.ts +2 -2
- package/lib/mjs/providers/storage/base64.js +2 -3
- package/lib/mjs/providers/storage/dropbox.d.ts +2 -2
- package/lib/mjs/providers/storage/dropbox.js +2 -3
- package/lib/mjs/providers/storage/googleDrive.d.ts +3 -2
- package/lib/mjs/providers/storage/googleDrive.js +6 -3
- package/lib/mjs/providers/storage/indexeddb.d.ts +3 -3
- package/lib/mjs/providers/storage/indexeddb.js +9 -10
- package/lib/mjs/providers/storage/s3.d.ts +11 -1
- package/lib/mjs/providers/storage/s3.js +5 -2
- package/lib/mjs/providers/storage/uploadAdapter.js +1 -2
- package/lib/mjs/providers/storage/url.d.ts +2 -2
- package/lib/mjs/providers/storage/url.js +12 -5
- package/lib/mjs/providers/storage/xhr.d.ts +1 -1
- package/lib/mjs/providers/storage/xhr.js +1 -2
- package/lib/mjs/templates/index.d.ts +226 -1
- package/lib/mjs/utils/Evaluator.js +4 -33
- package/lib/mjs/utils/i18n.d.ts +16 -0
- package/lib/mjs/utils/i18n.js +81 -0
- package/lib/mjs/utils/utils.d.ts +11 -1
- package/lib/mjs/utils/utils.js +27 -9
- package/lib/mjs/validator/Validator.d.ts +30 -2
- package/lib/mjs/validator/Validator.js +31 -9
- package/lib/mjs/validator/rules/Select.js +1 -2
- package/lib/mjs/validator/rules/Unique.d.ts +1 -1
- package/lib/mjs/validator/rules/Unique.js +1 -2
- package/lib/mjs/widgets/CalendarWidget.d.ts +1 -0
- package/lib/mjs/widgets/InputWidget.d.ts +1 -1
- package/lib/mjs/widgets/InputWidget.js +1 -2
- package/package.json +18 -15
- package/types/index.d.ts +1 -0
- package/types/licenses.d.ts +7 -0
- package/types/utils.d.ts +2 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import ListComponent from '../_classes/list/ListComponent';
|
|
3
|
-
import NativePromise from 'native-promise-only';
|
|
4
3
|
import { Formio } from '../../Formio';
|
|
5
|
-
import { boolValue } from '../../utils/utils';
|
|
4
|
+
import { boolValue, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
|
6
5
|
export default class RadioComponent extends ListComponent {
|
|
7
6
|
static schema(...extend) {
|
|
8
7
|
return ListComponent.schema({
|
|
@@ -27,6 +26,39 @@ export default class RadioComponent extends ListComponent {
|
|
|
27
26
|
schema: RadioComponent.schema()
|
|
28
27
|
};
|
|
29
28
|
}
|
|
29
|
+
static get conditionOperatorsSettings() {
|
|
30
|
+
return {
|
|
31
|
+
...super.conditionOperatorsSettings,
|
|
32
|
+
valueComponent(classComp) {
|
|
33
|
+
return {
|
|
34
|
+
type: 'select',
|
|
35
|
+
dataSrc: 'custom',
|
|
36
|
+
valueProperty: 'value',
|
|
37
|
+
dataType: classComp.dataType || '',
|
|
38
|
+
data: {
|
|
39
|
+
custom() {
|
|
40
|
+
return classComp.values;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
static savedValueTypes(schema) {
|
|
48
|
+
const { boolean, string, number, object, array } = componentValueTypes;
|
|
49
|
+
const { dataType } = schema;
|
|
50
|
+
const types = getComponentSavedTypes(schema);
|
|
51
|
+
if (types) {
|
|
52
|
+
return types;
|
|
53
|
+
}
|
|
54
|
+
if (dataType === 'object') {
|
|
55
|
+
return [object, array];
|
|
56
|
+
}
|
|
57
|
+
if (componentValueTypes[dataType]) {
|
|
58
|
+
return [componentValueTypes[dataType]];
|
|
59
|
+
}
|
|
60
|
+
return [boolean, string, number, object, array];
|
|
61
|
+
}
|
|
30
62
|
constructor(component, options, data) {
|
|
31
63
|
super(component, options, data);
|
|
32
64
|
this.previousValue = this.dataValue || null;
|
|
@@ -58,6 +90,10 @@ export default class RadioComponent extends ListComponent {
|
|
|
58
90
|
get optionSelectedClass() {
|
|
59
91
|
return 'radio-selected';
|
|
60
92
|
}
|
|
93
|
+
get listData() {
|
|
94
|
+
const listData = _.get(this.root, 'submission.metadata.listData', {});
|
|
95
|
+
return _.get(listData, this.path);
|
|
96
|
+
}
|
|
61
97
|
init() {
|
|
62
98
|
super.init();
|
|
63
99
|
this.templateData = {};
|
|
@@ -73,7 +109,7 @@ export default class RadioComponent extends ListComponent {
|
|
|
73
109
|
if (typeof this.itemsLoadedResolve === 'function') {
|
|
74
110
|
this.itemsLoadedResolve();
|
|
75
111
|
}
|
|
76
|
-
this.itemsLoaded = new
|
|
112
|
+
this.itemsLoaded = new Promise((resolve) => {
|
|
77
113
|
this.itemsLoadedResolve = resolve;
|
|
78
114
|
});
|
|
79
115
|
if (args.length) {
|
|
@@ -81,11 +117,13 @@ export default class RadioComponent extends ListComponent {
|
|
|
81
117
|
}
|
|
82
118
|
return triggerUpdate(...updateArgs);
|
|
83
119
|
};
|
|
84
|
-
this.itemsLoaded = new
|
|
120
|
+
this.itemsLoaded = new Promise((resolve) => {
|
|
85
121
|
this.itemsLoadedResolve = resolve;
|
|
86
122
|
});
|
|
87
|
-
this.
|
|
123
|
+
this.optionsLoaded = false;
|
|
88
124
|
this.loadedOptions = [];
|
|
125
|
+
// Get the template keys for this radio component.
|
|
126
|
+
this.getTemplateKeys();
|
|
89
127
|
}
|
|
90
128
|
render() {
|
|
91
129
|
return super.render(this.renderTemplate('radio', {
|
|
@@ -185,6 +223,13 @@ export default class RadioComponent extends ListComponent {
|
|
|
185
223
|
}
|
|
186
224
|
}
|
|
187
225
|
loadItems(url, search, headers, options, method, body) {
|
|
226
|
+
if (this.optionsLoaded) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (!this.shouldLoad) {
|
|
230
|
+
this.loadItemsFromMetadata();
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
188
233
|
// Ensure we have a method and remove any body if method is get
|
|
189
234
|
method = method || 'GET';
|
|
190
235
|
if (method.toUpperCase() === 'GET') {
|
|
@@ -194,33 +239,55 @@ export default class RadioComponent extends ListComponent {
|
|
|
194
239
|
options.ignoreCache = this.component.ignoreCache;
|
|
195
240
|
// Make the request.
|
|
196
241
|
options.header = headers;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
242
|
+
this.loading = true;
|
|
243
|
+
Formio.makeRequest(this.options.formio, 'select', url, method, body, options)
|
|
244
|
+
.then((response) => {
|
|
245
|
+
this.loading = false;
|
|
246
|
+
this.error = null;
|
|
247
|
+
this.setItems(response);
|
|
248
|
+
this.optionsLoaded = true;
|
|
249
|
+
this.redraw();
|
|
250
|
+
})
|
|
251
|
+
.catch((err) => {
|
|
252
|
+
this.handleLoadingError(err);
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
loadItemsFromMetadata() {
|
|
256
|
+
this.listData.forEach((item, i) => {
|
|
257
|
+
this.loadedOptions[i] = {
|
|
258
|
+
label: this.itemTemplate(item)
|
|
259
|
+
};
|
|
260
|
+
if (_.isEqual(item, this.selectData)) {
|
|
261
|
+
this.loadedOptions[i].value = this.dataValue;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
this.optionsLoaded = true;
|
|
265
|
+
this.redraw();
|
|
211
266
|
}
|
|
212
267
|
setItems(items) {
|
|
268
|
+
const listData = [];
|
|
213
269
|
items?.forEach((item, i) => {
|
|
214
270
|
this.loadedOptions[i] = {
|
|
215
271
|
value: item[this.component.valueProperty],
|
|
216
272
|
label: this.itemTemplate(item, item[this.component.valueProperty])
|
|
217
273
|
};
|
|
274
|
+
listData.push(this.templateData[item[this.component.valueProperty]]);
|
|
218
275
|
if (_.isUndefined(item[this.component.valueProperty]) ||
|
|
219
276
|
_.isObject(item[this.component.valueProperty]) ||
|
|
220
277
|
(!this.isRadio && _.isBoolean(item[this.component.valueProperty]))) {
|
|
221
278
|
this.loadedOptions[i].invalid = true;
|
|
222
279
|
}
|
|
223
280
|
});
|
|
281
|
+
if (this.isSelectURL) {
|
|
282
|
+
const submission = this.root.submission;
|
|
283
|
+
if (!submission.metadata) {
|
|
284
|
+
submission.metadata = {};
|
|
285
|
+
}
|
|
286
|
+
if (!submission.metadata.listData) {
|
|
287
|
+
submission.metadata.listData = {};
|
|
288
|
+
}
|
|
289
|
+
_.set(submission.metadata.listData, this.path, listData);
|
|
290
|
+
}
|
|
224
291
|
}
|
|
225
292
|
setSelectedClasses() {
|
|
226
293
|
if (this.refs.wrapper) {
|
|
@@ -283,6 +350,13 @@ export default class RadioComponent extends ListComponent {
|
|
|
283
350
|
if (value === 'false') {
|
|
284
351
|
value = false;
|
|
285
352
|
}
|
|
353
|
+
if (this.isSelectURL && this.templateData && this.templateData[value]) {
|
|
354
|
+
const submission = this.root.submission;
|
|
355
|
+
if (!submission.metadata.selectData) {
|
|
356
|
+
submission.metadata.selectData = {};
|
|
357
|
+
}
|
|
358
|
+
_.set(submission.metadata.selectData, this.path, this.templateData[value]);
|
|
359
|
+
}
|
|
286
360
|
return super.normalizeValue(value);
|
|
287
361
|
}
|
|
288
362
|
}
|
|
@@ -7,13 +7,14 @@ export default class ReCaptchaComponent extends Component {
|
|
|
7
7
|
weight: number;
|
|
8
8
|
schema: any;
|
|
9
9
|
};
|
|
10
|
+
static savedValueTypes(): never[];
|
|
10
11
|
render(): any;
|
|
11
12
|
recaptchaResult: any;
|
|
12
13
|
createInput(): void;
|
|
13
14
|
recaptchaApiReady: any;
|
|
14
15
|
createLabel(): void;
|
|
15
16
|
verify(actionName: any): void;
|
|
16
|
-
recaptchaVerifiedPromise:
|
|
17
|
+
recaptchaVerifiedPromise: Promise<void> | undefined;
|
|
17
18
|
isLoading: boolean | undefined;
|
|
18
19
|
sendVerificationRequest(token: any): any;
|
|
19
20
|
checkComponentValidity(data: any, dirty: any, row: any, options?: {}): any;
|
|
@@ -3,7 +3,6 @@ import Component from '../_classes/component/Component';
|
|
|
3
3
|
import { Formio } from '../../Formio';
|
|
4
4
|
import _get from 'lodash/get';
|
|
5
5
|
import _debounce from 'lodash/debounce';
|
|
6
|
-
import NativePromise from 'native-promise-only';
|
|
7
6
|
export default class ReCaptchaComponent extends Component {
|
|
8
7
|
static schema(...extend) {
|
|
9
8
|
return Component.schema({
|
|
@@ -22,6 +21,9 @@ export default class ReCaptchaComponent extends Component {
|
|
|
22
21
|
schema: ReCaptchaComponent.schema()
|
|
23
22
|
};
|
|
24
23
|
}
|
|
24
|
+
static savedValueTypes() {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
25
27
|
render() {
|
|
26
28
|
this.recaptchaResult = null;
|
|
27
29
|
if (this.builderMode) {
|
|
@@ -61,7 +63,7 @@ export default class ReCaptchaComponent extends Component {
|
|
|
61
63
|
this.recaptchaApiReady = Formio.requireLibrary('googleRecaptcha', 'grecaptcha', recaptchaApiScriptUrl, true);
|
|
62
64
|
}
|
|
63
65
|
if (this.recaptchaApiReady) {
|
|
64
|
-
this.recaptchaVerifiedPromise = new
|
|
66
|
+
this.recaptchaVerifiedPromise = new Promise((resolve, reject) => {
|
|
65
67
|
this.recaptchaApiReady
|
|
66
68
|
.then(() => {
|
|
67
69
|
if (!this.isLoading) {
|
|
@@ -117,13 +119,13 @@ export default class ReCaptchaComponent extends Component {
|
|
|
117
119
|
const componentData = row[this.component.key];
|
|
118
120
|
if (!componentData || !componentData.token) {
|
|
119
121
|
this.setCustomValidity('ReCAPTCHA: Token is not specified in submission');
|
|
120
|
-
return
|
|
122
|
+
return Promise.resolve(false);
|
|
121
123
|
}
|
|
122
124
|
if (!componentData.success) {
|
|
123
125
|
this.setCustomValidity('ReCAPTCHA: Token validation error');
|
|
124
|
-
return
|
|
126
|
+
return Promise.resolve(false);
|
|
125
127
|
}
|
|
126
|
-
return this.hook('validateReCaptcha', componentData.token, () =>
|
|
128
|
+
return this.hook('validateReCaptcha', componentData.token, () => Promise.resolve(true))
|
|
127
129
|
.then((success) => success)
|
|
128
130
|
.catch((err) => {
|
|
129
131
|
this.setCustomValidity(err.message || err);
|
|
@@ -5,7 +5,7 @@ export default [
|
|
|
5
5
|
type: 'htmlelement',
|
|
6
6
|
tag: 'div',
|
|
7
7
|
className: 'alert alert-danger',
|
|
8
|
-
content: '
|
|
8
|
+
content: 'This component has been deprecated and will be removed in a future version of Formio.js.',
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
type: 'select',
|
|
@@ -7,11 +7,32 @@ export default class SelectComponent extends ListComponent {
|
|
|
7
7
|
documentation: string;
|
|
8
8
|
schema: any;
|
|
9
9
|
};
|
|
10
|
+
static get serverConditionSettings(): {
|
|
11
|
+
valueComponent(classComp: any): any;
|
|
12
|
+
constructor: Function;
|
|
13
|
+
toString(): string;
|
|
14
|
+
toLocaleString(): string;
|
|
15
|
+
valueOf(): Object;
|
|
16
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
17
|
+
isPrototypeOf(v: Object): boolean;
|
|
18
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
19
|
+
};
|
|
20
|
+
static get conditionOperatorsSettings(): {
|
|
21
|
+
valueComponent(classComp: any): any;
|
|
22
|
+
constructor: Function;
|
|
23
|
+
toString(): string;
|
|
24
|
+
toLocaleString(): string;
|
|
25
|
+
valueOf(): Object;
|
|
26
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
27
|
+
isPrototypeOf(v: Object): boolean;
|
|
28
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
29
|
+
};
|
|
30
|
+
static savedValueTypes(schema: any): any[];
|
|
10
31
|
templateData: {} | undefined;
|
|
11
32
|
triggerUpdate: ((...args: any[]) => any) | undefined;
|
|
12
33
|
set itemsLoaded(arg: any);
|
|
13
34
|
get itemsLoaded(): any;
|
|
14
|
-
itemsLoadedResolve: any;
|
|
35
|
+
itemsLoadedResolve: ((value: any) => void) | undefined;
|
|
15
36
|
isFromSearch: boolean | undefined;
|
|
16
37
|
searchServerCount: any;
|
|
17
38
|
defaultServerCount: any;
|
|
@@ -19,6 +40,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
19
40
|
searchDownloadedResources: any;
|
|
20
41
|
defaultDownloadedResources: any;
|
|
21
42
|
activated: boolean | undefined;
|
|
43
|
+
get dataReady(): any;
|
|
22
44
|
get emptyValue(): {};
|
|
23
45
|
get valueProperty(): any;
|
|
24
46
|
get inputInfo(): {
|
|
@@ -35,6 +57,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
35
57
|
get isSelectResource(): boolean;
|
|
36
58
|
get itemsFromUrl(): boolean;
|
|
37
59
|
get isInfiniteScrollProvided(): boolean;
|
|
60
|
+
get shouldInitialLoad(): any;
|
|
38
61
|
isEntireObjectDisplay(): boolean;
|
|
39
62
|
selectValueAndLabel(data: any): {
|
|
40
63
|
value: any;
|
|
@@ -55,11 +78,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
55
78
|
set downloadedResources(arg: any);
|
|
56
79
|
get downloadedResources(): any;
|
|
57
80
|
getSingleItemValueForHTMLMode(data: any): any;
|
|
58
|
-
getTemplateKeys(): void;
|
|
59
|
-
templateKeys: any[] | undefined;
|
|
60
81
|
get loadingError(): boolean | undefined;
|
|
61
|
-
get selectData(): any;
|
|
62
|
-
get shouldLoad(): any;
|
|
63
82
|
loadItems(url: any, search: any, headers: any, options: any, method: any, body: any): void;
|
|
64
83
|
getCustomItems(): any;
|
|
65
84
|
asyncValues: boolean | undefined;
|
|
@@ -79,6 +98,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
79
98
|
render(): any;
|
|
80
99
|
wrapElement(element: any): any;
|
|
81
100
|
choicesOptions(): any;
|
|
101
|
+
attach(element: any): Promise<void> | undefined;
|
|
82
102
|
focusableElement: any;
|
|
83
103
|
choices: Choices | null | undefined;
|
|
84
104
|
scrollList: any;
|
|
@@ -2,8 +2,7 @@ import _ from 'lodash';
|
|
|
2
2
|
import { Formio } from '../../Formio';
|
|
3
3
|
import ListComponent from '../_classes/list/ListComponent';
|
|
4
4
|
import Form from '../../Form';
|
|
5
|
-
import
|
|
6
|
-
import { getRandomComponentId, boolValue, isPromise } from '../../utils/utils';
|
|
5
|
+
import { getRandomComponentId, boolValue, isPromise, componentValueTypes, getComponentSavedTypes } from '../../utils/utils';
|
|
7
6
|
import Choices from '../../utils/ChoicesWrapper';
|
|
8
7
|
export default class SelectComponent extends ListComponent {
|
|
9
8
|
static schema(...extend) {
|
|
@@ -54,6 +53,35 @@ export default class SelectComponent extends ListComponent {
|
|
|
54
53
|
schema: SelectComponent.schema()
|
|
55
54
|
};
|
|
56
55
|
}
|
|
56
|
+
static get serverConditionSettings() {
|
|
57
|
+
return SelectComponent.conditionOperatorsSettings;
|
|
58
|
+
}
|
|
59
|
+
static get conditionOperatorsSettings() {
|
|
60
|
+
return {
|
|
61
|
+
...super.conditionOperatorsSettings,
|
|
62
|
+
valueComponent(classComp) {
|
|
63
|
+
return { ...classComp, type: 'select' };
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
static savedValueTypes(schema) {
|
|
68
|
+
const { boolean, string, number, object, array } = componentValueTypes;
|
|
69
|
+
const { dataType, reference } = schema;
|
|
70
|
+
const types = getComponentSavedTypes(schema);
|
|
71
|
+
if (types) {
|
|
72
|
+
return types;
|
|
73
|
+
}
|
|
74
|
+
if (reference) {
|
|
75
|
+
return [object];
|
|
76
|
+
}
|
|
77
|
+
if (dataType === 'object') {
|
|
78
|
+
return [object, array];
|
|
79
|
+
}
|
|
80
|
+
if (componentValueTypes[dataType]) {
|
|
81
|
+
return [componentValueTypes[dataType]];
|
|
82
|
+
}
|
|
83
|
+
return [boolean, string, number, object, array];
|
|
84
|
+
}
|
|
57
85
|
init() {
|
|
58
86
|
super.init();
|
|
59
87
|
this.templateData = {};
|
|
@@ -69,7 +97,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
69
97
|
if (typeof this.itemsLoadedResolve === 'function') {
|
|
70
98
|
this.itemsLoadedResolve();
|
|
71
99
|
}
|
|
72
|
-
this.itemsLoaded = new
|
|
100
|
+
this.itemsLoaded = new Promise((resolve) => {
|
|
73
101
|
this.itemsLoadedResolve = resolve;
|
|
74
102
|
});
|
|
75
103
|
if (args.length) {
|
|
@@ -89,7 +117,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
89
117
|
}
|
|
90
118
|
// If this component has been activated.//
|
|
91
119
|
this.activated = false;
|
|
92
|
-
this.itemsLoaded = new
|
|
120
|
+
this.itemsLoaded = new Promise((resolve) => {
|
|
93
121
|
this.itemsLoadedResolve = resolve;
|
|
94
122
|
});
|
|
95
123
|
if (this.isHtmlRenderMode()) {
|
|
@@ -104,7 +132,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
104
132
|
if (this.root &&
|
|
105
133
|
this.root.submissionSet &&
|
|
106
134
|
!this.attached) {
|
|
107
|
-
return
|
|
135
|
+
return Promise.resolve();
|
|
108
136
|
}
|
|
109
137
|
return this.itemsLoaded;
|
|
110
138
|
}
|
|
@@ -165,6 +193,15 @@ export default class SelectComponent extends ListComponent {
|
|
|
165
193
|
get shouldDisabled() {
|
|
166
194
|
return super.shouldDisabled || this.parentDisabled;
|
|
167
195
|
}
|
|
196
|
+
get shouldInitialLoad() {
|
|
197
|
+
if (this.component.widget === 'html5' &&
|
|
198
|
+
this.isEntireObjectDisplay() &&
|
|
199
|
+
this.component.searchField &&
|
|
200
|
+
this.dataValue) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
return super.shouldLoad;
|
|
204
|
+
}
|
|
168
205
|
isEntireObjectDisplay() {
|
|
169
206
|
return this.component.dataSrc === 'resource' && this.valueProperty === 'data';
|
|
170
207
|
}
|
|
@@ -189,7 +226,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
189
226
|
const value = (typeof itemLabel === 'string') ? this.t(itemLabel, { _userInput: true }) : itemLabel;
|
|
190
227
|
return this.sanitize(value, this.shouldSanitizeValue);
|
|
191
228
|
}
|
|
192
|
-
if (this.component.multiple ? this.dataValue.find((val) => value === val) : (this.dataValue === value)) {
|
|
229
|
+
if (this.component.multiple && _.isArray(this.dataValue) ? this.dataValue.find((val) => value === val) : (this.dataValue === value)) {
|
|
193
230
|
const selectData = this.selectData;
|
|
194
231
|
if (selectData) {
|
|
195
232
|
const templateValue = this.component.reference && value?._id ? value._id.toString() : value;
|
|
@@ -434,48 +471,9 @@ export default class SelectComponent extends ListComponent {
|
|
|
434
471
|
}
|
|
435
472
|
return defaultValue;
|
|
436
473
|
}
|
|
437
|
-
getTemplateKeys() {
|
|
438
|
-
this.templateKeys = [];
|
|
439
|
-
if (this.options.readOnly && this.component.template) {
|
|
440
|
-
const keys = this.component.template.match(/({{\s*(.*?)\s*}})/g);
|
|
441
|
-
if (keys) {
|
|
442
|
-
keys.forEach((key) => {
|
|
443
|
-
const propKey = key.match(/{{\s*item\.(.*?)\s*}}/);
|
|
444
|
-
if (propKey && propKey.length > 1) {
|
|
445
|
-
this.templateKeys.push(propKey[1]);
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
474
|
get loadingError() {
|
|
452
475
|
return !this.component.refreshOn && !this.component.refreshOnBlur && this.networkError;
|
|
453
476
|
}
|
|
454
|
-
get selectData() {
|
|
455
|
-
const selectData = _.get(this.root, 'submission.metadata.selectData', {});
|
|
456
|
-
return _.get(selectData, this.path);
|
|
457
|
-
}
|
|
458
|
-
get shouldLoad() {
|
|
459
|
-
if (this.loadingError) {
|
|
460
|
-
return false;
|
|
461
|
-
}
|
|
462
|
-
// Live forms should always load.
|
|
463
|
-
if (!this.options.readOnly) {
|
|
464
|
-
return true;
|
|
465
|
-
}
|
|
466
|
-
// If there are template keys, then we need to see if we have the data.
|
|
467
|
-
if (this.templateKeys && this.templateKeys.length) {
|
|
468
|
-
// See if we already have the data we need.
|
|
469
|
-
const dataValue = this.dataValue;
|
|
470
|
-
const selectData = this.selectData;
|
|
471
|
-
return this.templateKeys.reduce((shouldLoad, key) => {
|
|
472
|
-
const hasValue = _.has(dataValue, key) || _.has(selectData, key);
|
|
473
|
-
return shouldLoad || !hasValue;
|
|
474
|
-
}, false);
|
|
475
|
-
}
|
|
476
|
-
// Return that we should load.
|
|
477
|
-
return true;
|
|
478
|
-
}
|
|
479
477
|
loadItems(url, search, headers, options, method, body) {
|
|
480
478
|
options = options || {};
|
|
481
479
|
// See if we should load items or not.
|
|
@@ -514,7 +512,11 @@ export default class SelectComponent extends ListComponent {
|
|
|
514
512
|
});
|
|
515
513
|
// Add search capability.
|
|
516
514
|
if (this.component.searchField && search) {
|
|
517
|
-
const searchValue = Array.isArray(search)
|
|
515
|
+
const searchValue = Array.isArray(search)
|
|
516
|
+
? search.join(',')
|
|
517
|
+
: typeof search === 'object'
|
|
518
|
+
? JSON.stringify(search)
|
|
519
|
+
: search;
|
|
518
520
|
query[this.component.searchField] = this.component.searchField.endsWith('__regex')
|
|
519
521
|
? _.escapeRegExp(searchValue)
|
|
520
522
|
: searchValue;
|
|
@@ -937,7 +939,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
937
939
|
const items = this.choices._store.activeItems;
|
|
938
940
|
if (!items.length) {
|
|
939
941
|
this.choices._addItem({
|
|
940
|
-
value:
|
|
942
|
+
value: '',
|
|
941
943
|
label: placeholderValue,
|
|
942
944
|
choiceId: 0,
|
|
943
945
|
groupId: -1,
|
|
@@ -1107,7 +1109,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1107
1109
|
if (this.component.multiple) {
|
|
1108
1110
|
templateData = {};
|
|
1109
1111
|
const dataValue = this.dataValue;
|
|
1110
|
-
if (dataValue && dataValue.length) {
|
|
1112
|
+
if (dataValue && _.isArray(dataValue) && dataValue.length) {
|
|
1111
1113
|
dataValue.forEach((dataValueItem) => {
|
|
1112
1114
|
const dataValueItemValue = this.component.reference ? dataValueItem._id.toString() : dataValueItem;
|
|
1113
1115
|
templateData[dataValueItemValue] = this.templateData[dataValueItemValue];
|
|
@@ -1175,7 +1177,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1175
1177
|
}
|
|
1176
1178
|
setValue(value, flags = {}) {
|
|
1177
1179
|
const previousValue = this.dataValue;
|
|
1178
|
-
if (this.component.widget === 'html5' && (_.isEqual(value, previousValue) || _.isEqual(previousValue, {}) && _.isEqual(flags, {}))) {
|
|
1180
|
+
if (this.component.widget === 'html5' && (_.isEqual(value, previousValue) || _.isEqual(previousValue, {}) && _.isEqual(flags, {})) && !flags.fromSubmission) {
|
|
1179
1181
|
return false;
|
|
1180
1182
|
}
|
|
1181
1183
|
const changed = this.updateValue(value, flags);
|
|
@@ -1227,7 +1229,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1227
1229
|
!this.active &&
|
|
1228
1230
|
!this.selectOptions.length &&
|
|
1229
1231
|
hasValue &&
|
|
1230
|
-
this.
|
|
1232
|
+
this.shouldInitialLoad &&
|
|
1231
1233
|
this.visible && (this.component.searchField || this.component.valueProperty);
|
|
1232
1234
|
}
|
|
1233
1235
|
setChoicesValue(value, hasPreviousValue, flags = {}) {
|
|
@@ -1251,7 +1253,8 @@ export default class SelectComponent extends ListComponent {
|
|
|
1251
1253
|
else {
|
|
1252
1254
|
if (hasValue) {
|
|
1253
1255
|
const values = Array.isArray(value) ? value : [value];
|
|
1254
|
-
if (!_.isEqual(this.dataValue, this.defaultValue) && this.selectOptions.length < 2
|
|
1256
|
+
if (!_.isEqual(this.dataValue, this.defaultValue) && this.selectOptions.length < 2
|
|
1257
|
+
|| (this.selectData && flags.fromSubmission)) {
|
|
1255
1258
|
const { value, label } = this.selectValueAndLabel(this.dataValue);
|
|
1256
1259
|
this.addOption(value, label);
|
|
1257
1260
|
}
|
|
@@ -1279,7 +1282,7 @@ export default class SelectComponent extends ListComponent {
|
|
|
1279
1282
|
}
|
|
1280
1283
|
}
|
|
1281
1284
|
get itemsLoaded() {
|
|
1282
|
-
return this._itemsLoaded ||
|
|
1285
|
+
return this._itemsLoaded || Promise.resolve();
|
|
1283
1286
|
}
|
|
1284
1287
|
set itemsLoaded(promise) {
|
|
1285
1288
|
this._itemsLoaded = promise;
|
|
@@ -1,4 +1,41 @@
|
|
|
1
1
|
export default class SelectBoxesComponent extends RadioComponent {
|
|
2
|
+
static get serverConditionSettings(): {
|
|
3
|
+
valueComponent(classComp: any): {
|
|
4
|
+
type: string;
|
|
5
|
+
dataSrc: string;
|
|
6
|
+
valueProperty: string;
|
|
7
|
+
valueType: string;
|
|
8
|
+
data: {
|
|
9
|
+
custom: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
constructor: Function;
|
|
13
|
+
toString(): string;
|
|
14
|
+
toLocaleString(): string;
|
|
15
|
+
valueOf(): Object;
|
|
16
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
17
|
+
isPrototypeOf(v: Object): boolean;
|
|
18
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
19
|
+
};
|
|
20
|
+
static get conditionOperatorsSettings(): {
|
|
21
|
+
valueComponent(classComp: any): {
|
|
22
|
+
type: string;
|
|
23
|
+
dataSrc: string;
|
|
24
|
+
valueProperty: string;
|
|
25
|
+
valueType: string;
|
|
26
|
+
data: {
|
|
27
|
+
custom: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
constructor: Function;
|
|
31
|
+
toString(): string;
|
|
32
|
+
toLocaleString(): string;
|
|
33
|
+
valueOf(): Object;
|
|
34
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
35
|
+
isPrototypeOf(v: Object): boolean;
|
|
36
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
37
|
+
};
|
|
38
|
+
static savedValueTypes(schema: any): string[];
|
|
2
39
|
constructor(...args: any[]);
|
|
3
40
|
validators: string[];
|
|
4
41
|
get emptyValue(): any;
|