@formio/js 5.0.0-rc.19 → 5.0.0-rc.21
Sign up to get free protection for your applications and to get access to all the features.
- 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,4 +1,229 @@
|
|
1
1
|
declare namespace _default {
|
2
|
-
const bootstrap:
|
2
|
+
const bootstrap: {
|
3
|
+
webform: {
|
4
|
+
form: string;
|
5
|
+
builder: string;
|
6
|
+
};
|
7
|
+
well: {
|
8
|
+
form: string;
|
9
|
+
};
|
10
|
+
wizard: {
|
11
|
+
form: string;
|
12
|
+
builder: string;
|
13
|
+
};
|
14
|
+
wizardHeader: {
|
15
|
+
form: string;
|
16
|
+
};
|
17
|
+
wizardHeaderClassic: {
|
18
|
+
form: string;
|
19
|
+
};
|
20
|
+
wizardHeaderVertical: {
|
21
|
+
form: string;
|
22
|
+
};
|
23
|
+
wizardNav: {
|
24
|
+
form: string;
|
25
|
+
};
|
26
|
+
errorsList: {
|
27
|
+
form: string;
|
28
|
+
};
|
29
|
+
alert: {
|
30
|
+
form: string;
|
31
|
+
};
|
32
|
+
treeView: {
|
33
|
+
form: string;
|
34
|
+
};
|
35
|
+
treeEdit: {
|
36
|
+
form: string;
|
37
|
+
};
|
38
|
+
transform(type: any, text: any, instance: any): any;
|
39
|
+
defaultIconset: string;
|
40
|
+
iconClass: (iconset: any, name: any, spinning: any) => string;
|
41
|
+
cssClasses: {
|
42
|
+
'border-default': string;
|
43
|
+
'formio-tab-panel-active': string;
|
44
|
+
'formio-tab-link-active': string;
|
45
|
+
'formio-tab-link-container-active': string;
|
46
|
+
'formio-form-error': string;
|
47
|
+
'formio-form-alert': string;
|
48
|
+
'formio-label-error': string;
|
49
|
+
'formio-input-error': string;
|
50
|
+
'formio-alert-danger': string;
|
51
|
+
'formio-alert-success': string;
|
52
|
+
'formio-alert-warning': string;
|
53
|
+
'formio-modal-cancel-button': string;
|
54
|
+
'formio-modal-confirm-button': string;
|
55
|
+
'form-group': string;
|
56
|
+
};
|
57
|
+
address: {
|
58
|
+
form: string;
|
59
|
+
html: string;
|
60
|
+
};
|
61
|
+
builder: {
|
62
|
+
form: string;
|
63
|
+
};
|
64
|
+
builderComponent: {
|
65
|
+
form: string;
|
66
|
+
};
|
67
|
+
builderComponents: {
|
68
|
+
form: string;
|
69
|
+
};
|
70
|
+
builderEditForm: {
|
71
|
+
form: string;
|
72
|
+
};
|
73
|
+
builderPlaceholder: {
|
74
|
+
form: string;
|
75
|
+
};
|
76
|
+
builderSidebar: {
|
77
|
+
form: string;
|
78
|
+
};
|
79
|
+
builderSidebarGroup: {
|
80
|
+
form: string;
|
81
|
+
};
|
82
|
+
builderWizard: {
|
83
|
+
form: string;
|
84
|
+
};
|
85
|
+
button: {
|
86
|
+
form: string;
|
87
|
+
html: string;
|
88
|
+
};
|
89
|
+
checkbox: {
|
90
|
+
form: string;
|
91
|
+
html: string;
|
92
|
+
};
|
93
|
+
columns: {
|
94
|
+
form: string;
|
95
|
+
};
|
96
|
+
component: {
|
97
|
+
form: string;
|
98
|
+
};
|
99
|
+
componentModal: {
|
100
|
+
form: string;
|
101
|
+
};
|
102
|
+
components: {
|
103
|
+
form: string;
|
104
|
+
};
|
105
|
+
tableComponents: {
|
106
|
+
form: string;
|
107
|
+
};
|
108
|
+
container: {
|
109
|
+
form: string;
|
110
|
+
};
|
111
|
+
datagrid: {
|
112
|
+
form: string;
|
113
|
+
html: string;
|
114
|
+
};
|
115
|
+
day: {
|
116
|
+
form: string;
|
117
|
+
};
|
118
|
+
dialog: {
|
119
|
+
form: string;
|
120
|
+
};
|
121
|
+
editgrid: {
|
122
|
+
form: string;
|
123
|
+
html: string;
|
124
|
+
};
|
125
|
+
editgridTable: {
|
126
|
+
form: string;
|
127
|
+
html: string;
|
128
|
+
};
|
129
|
+
field: {
|
130
|
+
form: string;
|
131
|
+
align: string;
|
132
|
+
};
|
133
|
+
fieldset: {
|
134
|
+
form: string;
|
135
|
+
};
|
136
|
+
file: {
|
137
|
+
form: string;
|
138
|
+
};
|
139
|
+
html: {
|
140
|
+
form: string;
|
141
|
+
};
|
142
|
+
icon: {
|
143
|
+
form: string;
|
144
|
+
};
|
145
|
+
input: {
|
146
|
+
form: string;
|
147
|
+
html: string;
|
148
|
+
};
|
149
|
+
label: {
|
150
|
+
form: string;
|
151
|
+
};
|
152
|
+
loader: {
|
153
|
+
form: string;
|
154
|
+
};
|
155
|
+
loading: {
|
156
|
+
form: string;
|
157
|
+
};
|
158
|
+
map: {
|
159
|
+
form: string;
|
160
|
+
};
|
161
|
+
message: {
|
162
|
+
form: string;
|
163
|
+
};
|
164
|
+
modaledit: {
|
165
|
+
form: string;
|
166
|
+
};
|
167
|
+
modaldialog: {
|
168
|
+
form: string;
|
169
|
+
};
|
170
|
+
modalPreview: {
|
171
|
+
form: string;
|
172
|
+
};
|
173
|
+
multipleMasksInput: {
|
174
|
+
form: string;
|
175
|
+
};
|
176
|
+
multiValueRow: {
|
177
|
+
form: string;
|
178
|
+
};
|
179
|
+
multiValueTable: {
|
180
|
+
form: string;
|
181
|
+
};
|
182
|
+
panel: {
|
183
|
+
form: string;
|
184
|
+
};
|
185
|
+
pdf: {
|
186
|
+
form: string;
|
187
|
+
};
|
188
|
+
pdfBuilder: {
|
189
|
+
form: string;
|
190
|
+
};
|
191
|
+
pdfBuilderUpload: {
|
192
|
+
form: string;
|
193
|
+
};
|
194
|
+
radio: {
|
195
|
+
form: string;
|
196
|
+
html: string;
|
197
|
+
};
|
198
|
+
resourceAdd: {
|
199
|
+
form: string;
|
200
|
+
};
|
201
|
+
select: {
|
202
|
+
form: string;
|
203
|
+
html: string;
|
204
|
+
};
|
205
|
+
selectOption: {
|
206
|
+
form: string;
|
207
|
+
html: string;
|
208
|
+
};
|
209
|
+
signature: {
|
210
|
+
form: string;
|
211
|
+
html: string;
|
212
|
+
};
|
213
|
+
survey: {
|
214
|
+
form: string;
|
215
|
+
html: string;
|
216
|
+
};
|
217
|
+
tab: {
|
218
|
+
flat: string;
|
219
|
+
form: string;
|
220
|
+
};
|
221
|
+
table: {
|
222
|
+
form: string;
|
223
|
+
};
|
224
|
+
tree: {
|
225
|
+
form: string;
|
226
|
+
};
|
227
|
+
};
|
3
228
|
}
|
4
229
|
export default _default;
|
@@ -5,25 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const lodash_1 = __importDefault(require("lodash"));
|
7
7
|
const string_hash_1 = __importDefault(require("string-hash"));
|
8
|
+
const utils_1 = require("@formio/core/utils");
|
8
9
|
const Evaluator = {
|
9
10
|
noeval: false,
|
10
11
|
protectedEval: false,
|
11
12
|
cache: {},
|
12
|
-
templateSettings:
|
13
|
-
|
14
|
-
interpolate: /\{\{([\s\S]+?)\}\}/g,
|
15
|
-
escape: /\{\{\{([\s\S]+?)\}\}\}/g
|
16
|
-
},
|
17
|
-
evaluator(func, ...params) {
|
18
|
-
if (Evaluator.noeval) {
|
19
|
-
console.warn('No evaluations allowed for this renderer.');
|
20
|
-
return lodash_1.default.noop;
|
21
|
-
}
|
22
|
-
if (typeof params[0] === 'object') {
|
23
|
-
params = lodash_1.default.keys(params[0]);
|
24
|
-
}
|
25
|
-
return new Function(...params, func);
|
26
|
-
},
|
13
|
+
templateSettings: utils_1.Evaluator.templateSettings,
|
14
|
+
evaluator: utils_1.Evaluator.evaluator,
|
27
15
|
template(template, hash) {
|
28
16
|
hash = hash || (0, string_hash_1.default)(template);
|
29
17
|
if (Evaluator.cache[hash]) {
|
@@ -53,24 +41,7 @@ const Evaluator = {
|
|
53
41
|
rawTemplate = String(rawTemplate);
|
54
42
|
let template;
|
55
43
|
if (Evaluator.noeval || options.noeval) {
|
56
|
-
|
57
|
-
return rawTemplate.replace(/({{\s*(.*?)\s*}})/g, (match, $1, $2) => {
|
58
|
-
// Allow for conditional values.
|
59
|
-
const parts = $2.split('||').map(item => item.trim());
|
60
|
-
let value = '';
|
61
|
-
let path = '';
|
62
|
-
for (let i = 0; i < parts.length; i++) {
|
63
|
-
path = parts[i];
|
64
|
-
value = lodash_1.default.get(data, path);
|
65
|
-
if (value) {
|
66
|
-
break;
|
67
|
-
}
|
68
|
-
}
|
69
|
-
if (options.data) {
|
70
|
-
lodash_1.default.set(options.data, path, value);
|
71
|
-
}
|
72
|
-
return value;
|
73
|
-
});
|
44
|
+
return utils_1.Evaluator.interpolateString(rawTemplate, data, _options);
|
74
45
|
}
|
75
46
|
else {
|
76
47
|
template = Evaluator.template(rawTemplate);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* This file is used to mimic the i18n library interface.
|
3
|
+
*/
|
4
|
+
export class I18n {
|
5
|
+
static init(languages?: {}): I18n;
|
6
|
+
static createInstance(): I18n;
|
7
|
+
constructor(languages?: {});
|
8
|
+
languages: {};
|
9
|
+
language: string;
|
10
|
+
currentLanguage: any;
|
11
|
+
setLanguages(languages: any): void;
|
12
|
+
dir(lang?: string): "rtl" | "ltr";
|
13
|
+
changeLanguage(language: any, ready?: null): void;
|
14
|
+
addResourceBundle(language: any, type: any, strings: any): void;
|
15
|
+
t(text: any, ...args: any[]): any;
|
16
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.I18n = void 0;
|
7
|
+
const utils_1 = require("@formio/core/utils");
|
8
|
+
const i18n_1 = __importDefault(require("../i18n"));
|
9
|
+
const i18Defaults = {};
|
10
|
+
for (const lang in i18n_1.default.resources) {
|
11
|
+
if (i18n_1.default.resources.hasOwnProperty(lang)) {
|
12
|
+
i18Defaults[lang] = i18n_1.default.resources[lang].translation;
|
13
|
+
}
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* This file is used to mimic the i18n library interface.
|
17
|
+
*/
|
18
|
+
class I18n {
|
19
|
+
constructor(languages = {}) {
|
20
|
+
this.languages = i18Defaults;
|
21
|
+
this.language = 'en';
|
22
|
+
this.currentLanguage = i18Defaults.en;
|
23
|
+
this.setLanguages(languages);
|
24
|
+
this.changeLanguage(this.language);
|
25
|
+
}
|
26
|
+
setLanguages(languages) {
|
27
|
+
if (languages.resources) {
|
28
|
+
for (const lang in languages.resources) {
|
29
|
+
if (languages.resources.hasOwnProperty(lang)) {
|
30
|
+
languages[lang] = languages.resources[lang].translation;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
delete languages.resources;
|
34
|
+
}
|
35
|
+
if (languages.lng) {
|
36
|
+
languages.language = languages.lng;
|
37
|
+
delete languages.lng;
|
38
|
+
}
|
39
|
+
// Do not use these configurations.
|
40
|
+
delete languages.nsSeparator;
|
41
|
+
delete languages.keySeparator;
|
42
|
+
delete languages.pluralSeparator;
|
43
|
+
delete languages.contextSeparator;
|
44
|
+
// Now establish the languages default.
|
45
|
+
if (languages.language) {
|
46
|
+
this.language = languages.language;
|
47
|
+
}
|
48
|
+
for (const lang in languages) {
|
49
|
+
if (lang !== 'language' && languages.hasOwnProperty(lang)) {
|
50
|
+
if (!this.languages[lang]) {
|
51
|
+
this.languages[lang] = {};
|
52
|
+
}
|
53
|
+
this.languages[lang] = Object.assign(Object.assign({}, this.languages[lang]), languages[lang]);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
static init(languages = {}) {
|
58
|
+
return new I18n(languages);
|
59
|
+
}
|
60
|
+
dir(lang = '') {
|
61
|
+
lang = lang || this.language;
|
62
|
+
const rtls = ['ar', 'he', 'fa', 'ps', 'ur'];
|
63
|
+
return rtls.includes(lang) ? 'rtl' : 'ltr';
|
64
|
+
}
|
65
|
+
static createInstance() {
|
66
|
+
return new I18n();
|
67
|
+
}
|
68
|
+
changeLanguage(language, ready = null) {
|
69
|
+
if (!this.languages[language]) {
|
70
|
+
language = 'en';
|
71
|
+
}
|
72
|
+
this.language = language;
|
73
|
+
this.currentLanguage = this.languages[language] ? this.languages[language] : {};
|
74
|
+
if (ready) {
|
75
|
+
ready();
|
76
|
+
}
|
77
|
+
}
|
78
|
+
addResourceBundle(language, type, strings) {
|
79
|
+
this.languages[language] = strings;
|
80
|
+
}
|
81
|
+
t(text, ...args) {
|
82
|
+
if (this.currentLanguage[text]) {
|
83
|
+
return utils_1.Evaluator.interpolateString(this.currentLanguage[text], ...args);
|
84
|
+
}
|
85
|
+
return utils_1.Evaluator.interpolateString(text, ...args);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
exports.I18n = I18n;
|
package/lib/cjs/utils/utils.d.ts
CHANGED
@@ -223,7 +223,7 @@ export function getNumberSeparators(lang?: string): {
|
|
223
223
|
};
|
224
224
|
export function getNumberDecimalLimit(component: any, defaultLimit: any): any;
|
225
225
|
export function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }: {
|
226
|
-
currency
|
226
|
+
currency: any;
|
227
227
|
decimalLimit: any;
|
228
228
|
decimalSeparator: any;
|
229
229
|
lang: any;
|
@@ -349,6 +349,7 @@ export function isPromise(value: any): boolean;
|
|
349
349
|
*/
|
350
350
|
export function isInsideScopingComponent(componentInstance: any, firstPass?: boolean): boolean | boolean | any;
|
351
351
|
export function getFocusableElements(element: any): any;
|
352
|
+
export function getComponentSavedTypes(fullSchema: any): string[] | null;
|
352
353
|
export * from "./formUtils";
|
353
354
|
/**
|
354
355
|
* Map values through unfold and return first non-nil value.
|
@@ -357,6 +358,15 @@ export * from "./formUtils";
|
|
357
358
|
* @return {T}
|
358
359
|
*/
|
359
360
|
export const firstNonNil: any;
|
361
|
+
export namespace componentValueTypes {
|
362
|
+
const number: string;
|
363
|
+
const string: string;
|
364
|
+
const boolean: string;
|
365
|
+
const array: string;
|
366
|
+
const object: string;
|
367
|
+
const date: string;
|
368
|
+
const any: string;
|
369
|
+
}
|
360
370
|
import jsonLogic from 'json-logic-js';
|
361
371
|
import ConditionOperators from './conditionOperators';
|
362
372
|
import Evaluator from './Evaluator';
|
package/lib/cjs/utils/utils.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
-
/* global
|
2
|
+
/* global jQuery */
|
3
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
4
4
|
if (k2 === undefined) k2 = k;
|
5
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
@@ -31,7 +31,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
31
31
|
};
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
33
33
|
exports.observeOverload = exports.withSwitch = exports.firstNonNil = exports.unfold = exports.bootstrapVersion = exports.uniqueKey = exports.iterateKey = exports.delay = exports.fieldData = exports.getCurrencyAffixes = exports.getNumberDecimalLimit = exports.getNumberSeparators = exports.matchInputMask = exports.unmaskValue = exports.getInputMask = exports.convertFormatToMask = exports.convertFormatToMoment = exports.convertFormatToFlatpickr = exports.getLocaleDateFormatInfo = exports.formatOffset = exports.formatDate = exports.momentDate = exports.loadZones = exports.shouldLoadZones = exports.zonesLoaded = exports.offsetDate = exports.currentTimezone = exports.isValidDate = exports.getDateSetting = exports.guid = exports.uniqueName = exports.convertStringToHTMLElement = exports.unescapeHTML = exports.setActionProperty = exports.checkTrigger = exports.checkCondition = exports.checkJsonConditional = exports.checkCustomConditional = exports.getComponentActualValue = exports.checkSimpleConditional = exports.checkCalculated = exports.isMongoId = exports.boolValue = exports.getElementRect = exports.getPropertyValue = exports.getRandomComponentId = exports.evaluate = exports.moment = exports.ConditionOperators = exports.jsonLogic = void 0;
|
34
|
-
exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.hasInvalidComponent = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = void 0;
|
34
|
+
exports.getComponentSavedTypes = exports.componentValueTypes = exports._ = exports.getFocusableElements = exports.isInsideScopingComponent = exports.isPromise = exports.getDataParentComponent = exports.getComponentPath = exports.getComponentPathWithoutIndicies = exports.getBrowserInfo = exports.getIEBrowserVersion = exports.round = exports.getStringFromComponentPath = exports.hasInvalidComponent = exports.getArrayFromComponentPath = exports.isInputComponent = exports.interpolate = exports.Evaluator = exports.fastCloneDeep = exports.sanitize = exports.translateHTMLTemplate = exports.getContextButtons = exports.getContextComponents = void 0;
|
35
35
|
const lodash_1 = __importDefault(require("lodash"));
|
36
36
|
exports._ = lodash_1.default;
|
37
37
|
const fetch_ponyfill_1 = __importDefault(require("fetch-ponyfill"));
|
@@ -40,7 +40,6 @@ exports.jsonLogic = json_logic_js_1.default;
|
|
40
40
|
const moment_timezone_1 = __importDefault(require("moment-timezone/moment-timezone"));
|
41
41
|
const jstimezonedetect_1 = __importDefault(require("jstimezonedetect"));
|
42
42
|
const operators_1 = require("./jsonlogic/operators");
|
43
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
44
43
|
const dompurify_1 = __importDefault(require("dompurify"));
|
45
44
|
const formUtils_1 = require("./formUtils");
|
46
45
|
const Evaluator_1 = __importDefault(require("./Evaluator"));
|
@@ -50,7 +49,7 @@ exports.ConditionOperators = conditionOperators_1.default;
|
|
50
49
|
const interpolate = Evaluator_1.default.interpolate;
|
51
50
|
exports.interpolate = interpolate;
|
52
51
|
const { fetch } = (0, fetch_ponyfill_1.default)({
|
53
|
-
Promise:
|
52
|
+
Promise: Promise
|
54
53
|
});
|
55
54
|
__exportStar(require("./formUtils"), exports);
|
56
55
|
// Configure JsonLogic
|
@@ -387,7 +386,7 @@ exports.checkCondition = checkCondition;
|
|
387
386
|
*/
|
388
387
|
function checkTrigger(component, trigger, row, data, form, instance) {
|
389
388
|
// If trigger is empty, don't fire it
|
390
|
-
if (!trigger[trigger.type]) {
|
389
|
+
if (!trigger || !trigger[trigger.type]) {
|
391
390
|
return false;
|
392
391
|
}
|
393
392
|
switch (trigger.type) {
|
@@ -612,7 +611,7 @@ exports.shouldLoadZones = shouldLoadZones;
|
|
612
611
|
function loadZones(url, timezone) {
|
613
612
|
if (timezone && !shouldLoadZones(timezone)) {
|
614
613
|
// Return non-resolving promise.
|
615
|
-
return new
|
614
|
+
return new Promise(lodash_1.default.noop);
|
616
615
|
}
|
617
616
|
if (moment_timezone_1.default.zonesPromise) {
|
618
617
|
return moment_timezone_1.default.zonesPromise;
|
@@ -899,7 +898,7 @@ function getNumberDecimalLimit(component, defaultLimit) {
|
|
899
898
|
return decimalLimit;
|
900
899
|
}
|
901
900
|
exports.getNumberDecimalLimit = getNumberDecimalLimit;
|
902
|
-
function getCurrencyAffixes({ currency
|
901
|
+
function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
|
903
902
|
// Get the prefix and suffix from the localized string.
|
904
903
|
let regex = `(.*)?${(100).toLocaleString(lang)}`;
|
905
904
|
if (decimalLimit) {
|
@@ -908,7 +907,7 @@ function getCurrencyAffixes({ currency = 'USD', decimalLimit, decimalSeparator,
|
|
908
907
|
regex += '(.*)?';
|
909
908
|
const parts = (100).toLocaleString(lang, {
|
910
909
|
style: 'currency',
|
911
|
-
currency,
|
910
|
+
currency: currency ? currency : 'USD',
|
912
911
|
useGrouping: true,
|
913
912
|
maximumFractionDigits: decimalLimit || 0,
|
914
913
|
minimumFractionDigits: decimalLimit || 0
|
@@ -1032,8 +1031,8 @@ function bootstrapVersion(options) {
|
|
1032
1031
|
if (options.bootstrap) {
|
1033
1032
|
return options.bootstrap;
|
1034
1033
|
}
|
1035
|
-
if ((typeof
|
1036
|
-
return parseInt(
|
1034
|
+
if ((typeof jQuery === 'function') && (typeof jQuery().collapse === 'function')) {
|
1035
|
+
return parseInt(jQuery.fn.collapse.Constructor.VERSION.split('.')[0], 10);
|
1037
1036
|
}
|
1038
1037
|
if (window.bootstrap && window.bootstrap.Collapse) {
|
1039
1038
|
return parseInt(window.bootstrap.Collapse.VERSION.split('.')[0], 10);
|
@@ -1466,3 +1465,23 @@ function getFocusableElements(element) {
|
|
1466
1465
|
return element.querySelectorAll(focusableSelector);
|
1467
1466
|
}
|
1468
1467
|
exports.getFocusableElements = getFocusableElements;
|
1468
|
+
exports.componentValueTypes = {
|
1469
|
+
number: 'number',
|
1470
|
+
string: 'string',
|
1471
|
+
boolean: 'boolean',
|
1472
|
+
array: 'array',
|
1473
|
+
object: 'object',
|
1474
|
+
date: 'date',
|
1475
|
+
any: 'any',
|
1476
|
+
};
|
1477
|
+
function getComponentSavedTypes(fullSchema) {
|
1478
|
+
const schema = fullSchema || {};
|
1479
|
+
if (schema.persistent !== true) {
|
1480
|
+
return [];
|
1481
|
+
}
|
1482
|
+
if (schema.multiple) {
|
1483
|
+
return [exports.componentValueTypes.array];
|
1484
|
+
}
|
1485
|
+
return null;
|
1486
|
+
}
|
1487
|
+
exports.getComponentSavedTypes = getComponentSavedTypes;
|
@@ -21,7 +21,7 @@ export class ValidationChecker {
|
|
21
21
|
key: string;
|
22
22
|
hasLabel: boolean;
|
23
23
|
message(component: any): any;
|
24
|
-
check(component: any, setting: any, value: any): any
|
24
|
+
check(component: any, setting: any, value: any): true | Promise<any>;
|
25
25
|
};
|
26
26
|
multiple: {
|
27
27
|
key: string;
|
@@ -170,7 +170,35 @@ export class ValidationChecker {
|
|
170
170
|
};
|
171
171
|
};
|
172
172
|
checkValidator(component: any, validator: any, setting: any, value: any, data: any, index: any, row: any, async: any): any;
|
173
|
-
validate(component: any, validatorName: any, value: any, data: any, index: any, row: any, async: any, conditionallyVisible: any, validationObj: any):
|
173
|
+
validate(component: any, validatorName: any, value: any, data: any, index: any, row: any, async: any, conditionallyVisible: any, validationObj: any): false | {
|
174
|
+
message: string;
|
175
|
+
level: string;
|
176
|
+
path: any;
|
177
|
+
context: {
|
178
|
+
validator: any;
|
179
|
+
hasLabel: any;
|
180
|
+
setting: any;
|
181
|
+
key: any;
|
182
|
+
label: any;
|
183
|
+
value: any;
|
184
|
+
index: any;
|
185
|
+
input: any;
|
186
|
+
};
|
187
|
+
} | Promise<false | {
|
188
|
+
message: string;
|
189
|
+
level: string;
|
190
|
+
path: any;
|
191
|
+
context: {
|
192
|
+
validator: any;
|
193
|
+
hasLabel: any;
|
194
|
+
setting: any;
|
195
|
+
key: any;
|
196
|
+
label: any;
|
197
|
+
value: any;
|
198
|
+
index: any;
|
199
|
+
input: any;
|
200
|
+
};
|
201
|
+
}>;
|
174
202
|
checkComponent(component: any, data: any, row: any, includeWarnings?: boolean, async?: boolean): any;
|
175
203
|
/**
|
176
204
|
* Use the new validations engine to evaluate any errors.
|
@@ -7,10 +7,9 @@ exports.ValidationChecker = exports.default = void 0;
|
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
8
8
|
const utils_1 = require("../utils/utils");
|
9
9
|
const moment_1 = __importDefault(require("moment"));
|
10
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
11
10
|
const fetch_ponyfill_1 = __importDefault(require("fetch-ponyfill"));
|
12
11
|
const { fetch, Headers, Request } = (0, fetch_ponyfill_1.default)({
|
13
|
-
Promise:
|
12
|
+
Promise: Promise
|
14
13
|
});
|
15
14
|
const calendarUtils_1 = require("../utils/calendarUtils");
|
16
15
|
const Rules_1 = __importDefault(require("./Rules"));
|
@@ -75,7 +74,8 @@ class ValidationChecker {
|
|
75
74
|
if (!this.config.db) {
|
76
75
|
return true;
|
77
76
|
}
|
78
|
-
return new
|
77
|
+
return new Promise(resolve => {
|
78
|
+
var _a;
|
79
79
|
const form = this.config.form;
|
80
80
|
const submission = this.config.submission;
|
81
81
|
const path = `data.${component.path}`;
|
@@ -101,10 +101,19 @@ class ValidationChecker {
|
|
101
101
|
};
|
102
102
|
// Build the query
|
103
103
|
const query = { form: form._id };
|
104
|
+
let collationOptions = {};
|
104
105
|
if (lodash_1.default.isString(value)) {
|
105
106
|
if (component.component.dbIndex) {
|
106
107
|
addPathQueryParams(value, query, path);
|
107
108
|
}
|
109
|
+
// These are kind of hacky but provides for a more efficient "unique" validation when the string is an email,
|
110
|
+
// because we (by and large) only have to worry about ASCII and partial unicode; this way, we can use collation-
|
111
|
+
// aware indexes with case insensitive email searches to make things like login and registration a whole lot faster
|
112
|
+
else if (component.component.type === 'email' ||
|
113
|
+
(component.component.type === 'textfield' && ((_a = component.component.validate) === null || _a === void 0 ? void 0 : _a.pattern) === '[A-Za-z0-9]+')) {
|
114
|
+
addPathQueryParams(value, query, path);
|
115
|
+
collationOptions = { collation: { locale: 'en', strength: 2 } };
|
116
|
+
}
|
108
117
|
else {
|
109
118
|
addPathQueryParams({
|
110
119
|
$regex: new RegExp(`^${(0, utils_1.escapeRegExCharacters)(value)}$`),
|
@@ -132,8 +141,7 @@ class ValidationChecker {
|
|
132
141
|
// Only search for non-deleted items
|
133
142
|
query.deleted = { $eq: null };
|
134
143
|
query.state = 'submitted';
|
135
|
-
|
136
|
-
this.config.db.findOne(query, (err, result) => {
|
144
|
+
const uniqueValidationCallback = (err, result) => {
|
137
145
|
if (err) {
|
138
146
|
return resolve(false);
|
139
147
|
}
|
@@ -150,6 +158,21 @@ class ValidationChecker {
|
|
150
158
|
else {
|
151
159
|
return resolve(true);
|
152
160
|
}
|
161
|
+
};
|
162
|
+
// Try to find an existing value within the form
|
163
|
+
this.config.db.findOne(query, null, collationOptions, (err, result) => {
|
164
|
+
if (err && collationOptions.collation) {
|
165
|
+
// presume this error comes from db compatibility, try again as regex
|
166
|
+
delete query[path];
|
167
|
+
addPathQueryParams({
|
168
|
+
$regex: new RegExp(`^${(0, utils_1.escapeRegExCharacters)(value)}$`),
|
169
|
+
$options: 'i'
|
170
|
+
}, query, path);
|
171
|
+
this.config.db.findOne(query, uniqueValidationCallback);
|
172
|
+
}
|
173
|
+
else {
|
174
|
+
return uniqueValidationCallback(err, result);
|
175
|
+
}
|
153
176
|
});
|
154
177
|
}).catch(() => false);
|
155
178
|
}
|
@@ -825,7 +848,7 @@ class ValidationChecker {
|
|
825
848
|
return '';
|
826
849
|
};
|
827
850
|
if (async) {
|
828
|
-
return
|
851
|
+
return Promise.resolve(resultOrPromise).then(processResult);
|
829
852
|
}
|
830
853
|
else {
|
831
854
|
return processResult(resultOrPromise);
|
@@ -867,7 +890,7 @@ class ValidationChecker {
|
|
867
890
|
}
|
868
891
|
};
|
869
892
|
if (async) {
|
870
|
-
return
|
893
|
+
return Promise.resolve(resultOrPromise).then(processResult);
|
871
894
|
}
|
872
895
|
else {
|
873
896
|
return processResult(resultOrPromise);
|
@@ -880,7 +903,7 @@ class ValidationChecker {
|
|
880
903
|
&& !lodash_1.default.defaultTo(component.component.persistent, true);
|
881
904
|
// If we're server-side and it's not a persistent component, don't run validation at all
|
882
905
|
if (isServerSidePersistent || component.component.validate === false) {
|
883
|
-
return async ?
|
906
|
+
return async ? Promise.resolve([]) : [];
|
884
907
|
}
|
885
908
|
data = data || component.rootValue;
|
886
909
|
row = row || component.data;
|
@@ -1001,7 +1024,7 @@ class ValidationChecker {
|
|
1001
1024
|
};
|
1002
1025
|
// Wait for results if using async mode, otherwise process and return immediately
|
1003
1026
|
if (async) {
|
1004
|
-
return
|
1027
|
+
return Promise.all(resultsOrPromises).then(formatResults);
|
1005
1028
|
}
|
1006
1029
|
else {
|
1007
1030
|
return formatResults(resultsOrPromises);
|