@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,24 +1,12 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import stringHash from 'string-hash';
|
|
3
|
+
import { Evaluator as CoreEvaluator } from '@formio/core/utils';
|
|
3
4
|
const Evaluator = {
|
|
4
5
|
noeval: false,
|
|
5
6
|
protectedEval: false,
|
|
6
7
|
cache: {},
|
|
7
|
-
templateSettings:
|
|
8
|
-
|
|
9
|
-
interpolate: /\{\{([\s\S]+?)\}\}/g,
|
|
10
|
-
escape: /\{\{\{([\s\S]+?)\}\}\}/g
|
|
11
|
-
},
|
|
12
|
-
evaluator(func, ...params) {
|
|
13
|
-
if (Evaluator.noeval) {
|
|
14
|
-
console.warn('No evaluations allowed for this renderer.');
|
|
15
|
-
return _.noop;
|
|
16
|
-
}
|
|
17
|
-
if (typeof params[0] === 'object') {
|
|
18
|
-
params = _.keys(params[0]);
|
|
19
|
-
}
|
|
20
|
-
return new Function(...params, func);
|
|
21
|
-
},
|
|
8
|
+
templateSettings: CoreEvaluator.templateSettings,
|
|
9
|
+
evaluator: CoreEvaluator.evaluator,
|
|
22
10
|
template(template, hash) {
|
|
23
11
|
hash = hash || stringHash(template);
|
|
24
12
|
if (Evaluator.cache[hash]) {
|
|
@@ -48,24 +36,7 @@ const Evaluator = {
|
|
|
48
36
|
rawTemplate = String(rawTemplate);
|
|
49
37
|
let template;
|
|
50
38
|
if (Evaluator.noeval || options.noeval) {
|
|
51
|
-
|
|
52
|
-
return rawTemplate.replace(/({{\s*(.*?)\s*}})/g, (match, $1, $2) => {
|
|
53
|
-
// Allow for conditional values.
|
|
54
|
-
const parts = $2.split('||').map(item => item.trim());
|
|
55
|
-
let value = '';
|
|
56
|
-
let path = '';
|
|
57
|
-
for (let i = 0; i < parts.length; i++) {
|
|
58
|
-
path = parts[i];
|
|
59
|
-
value = _.get(data, path);
|
|
60
|
-
if (value) {
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (options.data) {
|
|
65
|
-
_.set(options.data, path, value);
|
|
66
|
-
}
|
|
67
|
-
return value;
|
|
68
|
-
});
|
|
39
|
+
return CoreEvaluator.interpolateString(rawTemplate, data, _options);
|
|
69
40
|
}
|
|
70
41
|
else {
|
|
71
42
|
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,81 @@
|
|
|
1
|
+
import { Evaluator } from '@formio/core/utils';
|
|
2
|
+
import i18n from '../i18n';
|
|
3
|
+
const i18Defaults = {};
|
|
4
|
+
for (const lang in i18n.resources) {
|
|
5
|
+
if (i18n.resources.hasOwnProperty(lang)) {
|
|
6
|
+
i18Defaults[lang] = i18n.resources[lang].translation;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* This file is used to mimic the i18n library interface.
|
|
11
|
+
*/
|
|
12
|
+
export class I18n {
|
|
13
|
+
languages = i18Defaults;
|
|
14
|
+
language = 'en';
|
|
15
|
+
currentLanguage = i18Defaults.en;
|
|
16
|
+
constructor(languages = {}) {
|
|
17
|
+
this.setLanguages(languages);
|
|
18
|
+
this.changeLanguage(this.language);
|
|
19
|
+
}
|
|
20
|
+
setLanguages(languages) {
|
|
21
|
+
if (languages.resources) {
|
|
22
|
+
for (const lang in languages.resources) {
|
|
23
|
+
if (languages.resources.hasOwnProperty(lang)) {
|
|
24
|
+
languages[lang] = languages.resources[lang].translation;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
delete languages.resources;
|
|
28
|
+
}
|
|
29
|
+
if (languages.lng) {
|
|
30
|
+
languages.language = languages.lng;
|
|
31
|
+
delete languages.lng;
|
|
32
|
+
}
|
|
33
|
+
// Do not use these configurations.
|
|
34
|
+
delete languages.nsSeparator;
|
|
35
|
+
delete languages.keySeparator;
|
|
36
|
+
delete languages.pluralSeparator;
|
|
37
|
+
delete languages.contextSeparator;
|
|
38
|
+
// Now establish the languages default.
|
|
39
|
+
if (languages.language) {
|
|
40
|
+
this.language = languages.language;
|
|
41
|
+
}
|
|
42
|
+
for (const lang in languages) {
|
|
43
|
+
if (lang !== 'language' && languages.hasOwnProperty(lang)) {
|
|
44
|
+
if (!this.languages[lang]) {
|
|
45
|
+
this.languages[lang] = {};
|
|
46
|
+
}
|
|
47
|
+
this.languages[lang] = { ...this.languages[lang], ...languages[lang] };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
static init(languages = {}) {
|
|
52
|
+
return new I18n(languages);
|
|
53
|
+
}
|
|
54
|
+
dir(lang = '') {
|
|
55
|
+
lang = lang || this.language;
|
|
56
|
+
const rtls = ['ar', 'he', 'fa', 'ps', 'ur'];
|
|
57
|
+
return rtls.includes(lang) ? 'rtl' : 'ltr';
|
|
58
|
+
}
|
|
59
|
+
static createInstance() {
|
|
60
|
+
return new I18n();
|
|
61
|
+
}
|
|
62
|
+
changeLanguage(language, ready = null) {
|
|
63
|
+
if (!this.languages[language]) {
|
|
64
|
+
language = 'en';
|
|
65
|
+
}
|
|
66
|
+
this.language = language;
|
|
67
|
+
this.currentLanguage = this.languages[language] ? this.languages[language] : {};
|
|
68
|
+
if (ready) {
|
|
69
|
+
ready();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
addResourceBundle(language, type, strings) {
|
|
73
|
+
this.languages[language] = strings;
|
|
74
|
+
}
|
|
75
|
+
t(text, ...args) {
|
|
76
|
+
if (this.currentLanguage[text]) {
|
|
77
|
+
return Evaluator.interpolateString(this.currentLanguage[text], ...args);
|
|
78
|
+
}
|
|
79
|
+
return Evaluator.interpolateString(text, ...args);
|
|
80
|
+
}
|
|
81
|
+
}
|
package/lib/mjs/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/mjs/utils/utils.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
/* global
|
|
1
|
+
/* global jQuery */
|
|
2
2
|
import _ from 'lodash';
|
|
3
3
|
import fetchPonyfill from 'fetch-ponyfill';
|
|
4
4
|
import jsonLogic from 'json-logic-js';
|
|
5
5
|
import moment from 'moment-timezone/moment-timezone';
|
|
6
6
|
import jtz from 'jstimezonedetect';
|
|
7
7
|
import { lodashOperators } from './jsonlogic/operators';
|
|
8
|
-
import NativePromise from 'native-promise-only';
|
|
9
8
|
import dompurify from 'dompurify';
|
|
10
9
|
import { getValue } from './formUtils';
|
|
11
10
|
import Evaluator from './Evaluator';
|
|
12
11
|
import ConditionOperators from './conditionOperators';
|
|
13
12
|
const interpolate = Evaluator.interpolate;
|
|
14
13
|
const { fetch } = fetchPonyfill({
|
|
15
|
-
Promise:
|
|
14
|
+
Promise: Promise
|
|
16
15
|
});
|
|
17
16
|
export * from './formUtils';
|
|
18
17
|
// Configure JsonLogic
|
|
@@ -337,7 +336,7 @@ export function checkCondition(component, row, data, form, instance) {
|
|
|
337
336
|
*/
|
|
338
337
|
export function checkTrigger(component, trigger, row, data, form, instance) {
|
|
339
338
|
// If trigger is empty, don't fire it
|
|
340
|
-
if (!trigger[trigger.type]) {
|
|
339
|
+
if (!trigger || !trigger[trigger.type]) {
|
|
341
340
|
return false;
|
|
342
341
|
}
|
|
343
342
|
switch (trigger.type) {
|
|
@@ -550,7 +549,7 @@ export function shouldLoadZones(timezone) {
|
|
|
550
549
|
export function loadZones(url, timezone) {
|
|
551
550
|
if (timezone && !shouldLoadZones(timezone)) {
|
|
552
551
|
// Return non-resolving promise.
|
|
553
|
-
return new
|
|
552
|
+
return new Promise(_.noop);
|
|
554
553
|
}
|
|
555
554
|
if (moment.zonesPromise) {
|
|
556
555
|
return moment.zonesPromise;
|
|
@@ -824,7 +823,7 @@ export function getNumberDecimalLimit(component, defaultLimit) {
|
|
|
824
823
|
}
|
|
825
824
|
return decimalLimit;
|
|
826
825
|
}
|
|
827
|
-
export function getCurrencyAffixes({ currency
|
|
826
|
+
export function getCurrencyAffixes({ currency, decimalLimit, decimalSeparator, lang, }) {
|
|
828
827
|
// Get the prefix and suffix from the localized string.
|
|
829
828
|
let regex = `(.*)?${(100).toLocaleString(lang)}`;
|
|
830
829
|
if (decimalLimit) {
|
|
@@ -833,7 +832,7 @@ export function getCurrencyAffixes({ currency = 'USD', decimalLimit, decimalSepa
|
|
|
833
832
|
regex += '(.*)?';
|
|
834
833
|
const parts = (100).toLocaleString(lang, {
|
|
835
834
|
style: 'currency',
|
|
836
|
-
currency,
|
|
835
|
+
currency: currency ? currency : 'USD',
|
|
837
836
|
useGrouping: true,
|
|
838
837
|
maximumFractionDigits: decimalLimit || 0,
|
|
839
838
|
minimumFractionDigits: decimalLimit || 0
|
|
@@ -952,8 +951,8 @@ export function bootstrapVersion(options) {
|
|
|
952
951
|
if (options.bootstrap) {
|
|
953
952
|
return options.bootstrap;
|
|
954
953
|
}
|
|
955
|
-
if ((typeof
|
|
956
|
-
return parseInt(
|
|
954
|
+
if ((typeof jQuery === 'function') && (typeof jQuery().collapse === 'function')) {
|
|
955
|
+
return parseInt(jQuery.fn.collapse.Constructor.VERSION.split('.')[0], 10);
|
|
957
956
|
}
|
|
958
957
|
if (window.bootstrap && window.bootstrap.Collapse) {
|
|
959
958
|
return parseInt(window.bootstrap.Collapse.VERSION.split('.')[0], 10);
|
|
@@ -1366,3 +1365,22 @@ export function getFocusableElements(element) {
|
|
|
1366
1365
|
}
|
|
1367
1366
|
// Export lodash to save space with other libraries.
|
|
1368
1367
|
export { _ };
|
|
1368
|
+
export const componentValueTypes = {
|
|
1369
|
+
number: 'number',
|
|
1370
|
+
string: 'string',
|
|
1371
|
+
boolean: 'boolean',
|
|
1372
|
+
array: 'array',
|
|
1373
|
+
object: 'object',
|
|
1374
|
+
date: 'date',
|
|
1375
|
+
any: 'any',
|
|
1376
|
+
};
|
|
1377
|
+
export function getComponentSavedTypes(fullSchema) {
|
|
1378
|
+
const schema = fullSchema || {};
|
|
1379
|
+
if (schema.persistent !== true) {
|
|
1380
|
+
return [];
|
|
1381
|
+
}
|
|
1382
|
+
if (schema.multiple) {
|
|
1383
|
+
return [componentValueTypes.array];
|
|
1384
|
+
}
|
|
1385
|
+
return null;
|
|
1386
|
+
}
|
|
@@ -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.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import { boolValue, getInputMask, matchInputMask, getDateSetting, escapeRegExCharacters, interpolate, convertFormatToMoment, getArrayFromComponentPath, unescapeHTML } from '../utils/utils';
|
|
3
3
|
import moment from 'moment';
|
|
4
|
-
import NativePromise from 'native-promise-only';
|
|
5
4
|
import fetchPonyfill from 'fetch-ponyfill';
|
|
6
5
|
const { fetch, Headers, Request } = fetchPonyfill({
|
|
7
|
-
Promise:
|
|
6
|
+
Promise: Promise
|
|
8
7
|
});
|
|
9
8
|
import { checkInvalidDate, CALENDAR_ERROR_MESSAGES } from '../utils/calendarUtils';
|
|
10
9
|
import Rules from './Rules';
|
|
@@ -69,7 +68,7 @@ class ValidationChecker {
|
|
|
69
68
|
if (!this.config.db) {
|
|
70
69
|
return true;
|
|
71
70
|
}
|
|
72
|
-
return new
|
|
71
|
+
return new Promise(resolve => {
|
|
73
72
|
const form = this.config.form;
|
|
74
73
|
const submission = this.config.submission;
|
|
75
74
|
const path = `data.${component.path}`;
|
|
@@ -95,10 +94,19 @@ class ValidationChecker {
|
|
|
95
94
|
};
|
|
96
95
|
// Build the query
|
|
97
96
|
const query = { form: form._id };
|
|
97
|
+
let collationOptions = {};
|
|
98
98
|
if (_.isString(value)) {
|
|
99
99
|
if (component.component.dbIndex) {
|
|
100
100
|
addPathQueryParams(value, query, path);
|
|
101
101
|
}
|
|
102
|
+
// These are kind of hacky but provides for a more efficient "unique" validation when the string is an email,
|
|
103
|
+
// because we (by and large) only have to worry about ASCII and partial unicode; this way, we can use collation-
|
|
104
|
+
// aware indexes with case insensitive email searches to make things like login and registration a whole lot faster
|
|
105
|
+
else if (component.component.type === 'email' ||
|
|
106
|
+
(component.component.type === 'textfield' && component.component.validate?.pattern === '[A-Za-z0-9]+')) {
|
|
107
|
+
addPathQueryParams(value, query, path);
|
|
108
|
+
collationOptions = { collation: { locale: 'en', strength: 2 } };
|
|
109
|
+
}
|
|
102
110
|
else {
|
|
103
111
|
addPathQueryParams({
|
|
104
112
|
$regex: new RegExp(`^${escapeRegExCharacters(value)}$`),
|
|
@@ -126,8 +134,7 @@ class ValidationChecker {
|
|
|
126
134
|
// Only search for non-deleted items
|
|
127
135
|
query.deleted = { $eq: null };
|
|
128
136
|
query.state = 'submitted';
|
|
129
|
-
|
|
130
|
-
this.config.db.findOne(query, (err, result) => {
|
|
137
|
+
const uniqueValidationCallback = (err, result) => {
|
|
131
138
|
if (err) {
|
|
132
139
|
return resolve(false);
|
|
133
140
|
}
|
|
@@ -144,6 +151,21 @@ class ValidationChecker {
|
|
|
144
151
|
else {
|
|
145
152
|
return resolve(true);
|
|
146
153
|
}
|
|
154
|
+
};
|
|
155
|
+
// Try to find an existing value within the form
|
|
156
|
+
this.config.db.findOne(query, null, collationOptions, (err, result) => {
|
|
157
|
+
if (err && collationOptions.collation) {
|
|
158
|
+
// presume this error comes from db compatibility, try again as regex
|
|
159
|
+
delete query[path];
|
|
160
|
+
addPathQueryParams({
|
|
161
|
+
$regex: new RegExp(`^${escapeRegExCharacters(value)}$`),
|
|
162
|
+
$options: 'i'
|
|
163
|
+
}, query, path);
|
|
164
|
+
this.config.db.findOne(query, uniqueValidationCallback);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return uniqueValidationCallback(err, result);
|
|
168
|
+
}
|
|
147
169
|
});
|
|
148
170
|
}).catch(() => false);
|
|
149
171
|
}
|
|
@@ -819,7 +841,7 @@ class ValidationChecker {
|
|
|
819
841
|
return '';
|
|
820
842
|
};
|
|
821
843
|
if (async) {
|
|
822
|
-
return
|
|
844
|
+
return Promise.resolve(resultOrPromise).then(processResult);
|
|
823
845
|
}
|
|
824
846
|
else {
|
|
825
847
|
return processResult(resultOrPromise);
|
|
@@ -860,7 +882,7 @@ class ValidationChecker {
|
|
|
860
882
|
}
|
|
861
883
|
};
|
|
862
884
|
if (async) {
|
|
863
|
-
return
|
|
885
|
+
return Promise.resolve(resultOrPromise).then(processResult);
|
|
864
886
|
}
|
|
865
887
|
else {
|
|
866
888
|
return processResult(resultOrPromise);
|
|
@@ -872,7 +894,7 @@ class ValidationChecker {
|
|
|
872
894
|
&& !_.defaultTo(component.component.persistent, true);
|
|
873
895
|
// If we're server-side and it's not a persistent component, don't run validation at all
|
|
874
896
|
if (isServerSidePersistent || component.component.validate === false) {
|
|
875
|
-
return async ?
|
|
897
|
+
return async ? Promise.resolve([]) : [];
|
|
876
898
|
}
|
|
877
899
|
data = data || component.rootValue;
|
|
878
900
|
row = row || component.data;
|
|
@@ -993,7 +1015,7 @@ class ValidationChecker {
|
|
|
993
1015
|
};
|
|
994
1016
|
// Wait for results if using async mode, otherwise process and return immediately
|
|
995
1017
|
if (async) {
|
|
996
|
-
return
|
|
1018
|
+
return Promise.all(resultsOrPromises).then(formatResults);
|
|
997
1019
|
}
|
|
998
1020
|
else {
|
|
999
1021
|
return formatResults(resultsOrPromises);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { interpolate } from '../../utils/utils';
|
|
2
|
-
import NativePromise from 'native-promise-only';
|
|
3
2
|
import fetchPonyfill from 'fetch-ponyfill';
|
|
4
3
|
const { fetch, Headers, Request } = fetchPonyfill({
|
|
5
|
-
Promise:
|
|
4
|
+
Promise: Promise
|
|
6
5
|
});
|
|
7
6
|
import _ from 'lodash';
|
|
8
7
|
import Rule from './Rule';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { escapeRegExCharacters } from '../../utils/utils';
|
|
2
2
|
import _ from 'lodash';
|
|
3
|
-
import NativePromise from 'native-promise-only';
|
|
4
3
|
import Rule from './Rule';
|
|
5
4
|
export default class Unique extends Rule {
|
|
6
5
|
defaultMessage = '{{field}} must be unique';
|
|
@@ -13,7 +12,7 @@ export default class Unique extends Rule {
|
|
|
13
12
|
if (!this.config.db) {
|
|
14
13
|
return true;
|
|
15
14
|
}
|
|
16
|
-
return new
|
|
15
|
+
return new Promise(resolve => {
|
|
17
16
|
const form = this.config.form;
|
|
18
17
|
const submission = this.config.submission;
|
|
19
18
|
const path = `data.${this.component.path}`;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import Element from '../Element';
|
|
3
|
-
import NativePromise from 'native-promise-only';
|
|
4
3
|
export default class InputWidget extends Element {
|
|
5
4
|
static get defaultSettings() {
|
|
6
5
|
return {
|
|
@@ -17,7 +16,7 @@ export default class InputWidget extends Element {
|
|
|
17
16
|
}
|
|
18
17
|
attach(input) {
|
|
19
18
|
this._input = input;
|
|
20
|
-
return
|
|
19
|
+
return Promise.resolve();
|
|
21
20
|
}
|
|
22
21
|
get defaultSettings() {
|
|
23
22
|
return {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formio/js",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.21",
|
|
4
4
|
"description": "JavaScript powered Forms with JSON Form Builder",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
"import": "./lib/mjs/index.js",
|
|
10
10
|
"require": "./lib/cjs/index.js"
|
|
11
11
|
},
|
|
12
|
+
"./sdk": {
|
|
13
|
+
"import": "./lib/mjs/Formio.js",
|
|
14
|
+
"require": "./lib/cjs/Formio.js"
|
|
15
|
+
},
|
|
12
16
|
"./utils": {
|
|
13
17
|
"import": "./lib/mjs/utils/index.js",
|
|
14
18
|
"require": "./lib/cjs/utils/index.js"
|
|
@@ -33,24 +37,24 @@
|
|
|
33
37
|
"lint"
|
|
34
38
|
],
|
|
35
39
|
"scripts": {
|
|
36
|
-
"build": "
|
|
40
|
+
"build": "yarn doc && yarn lib && yarn dist",
|
|
41
|
+
"doc": "esdoc",
|
|
37
42
|
"dist": "gulp clean:dist && webpack --config webpack.config.js && webpack --config webpack.prod.js && gulp build",
|
|
38
|
-
"lib": "gulp clean:lib && tsc --project tsconfig.cjs.json && tsc --project tsconfig.mjs.json &&
|
|
43
|
+
"lib": "gulp clean:lib && tsc --project tsconfig.cjs.json && tsc --project tsconfig.mjs.json && yarn lib:package",
|
|
39
44
|
"lib:package": "node ./libpackage.js",
|
|
40
|
-
"version": "node -e '
|
|
41
|
-
"build-app": "
|
|
45
|
+
"version": "node -e 'console.log(require(`./package.json`).version)'",
|
|
46
|
+
"build-app": "yarn build-app:create-app && yarn build-app:jekyll && yarn build-app:remove-app",
|
|
42
47
|
"build-app:create-app": "node -e 'var fs=require(`fs`);fs.writeFileSync(`./_config.app.yml`, `baseurl: /` + require(`./package.json`).version + `/`);'",
|
|
43
48
|
"build-app:remove-app": "rm ./_config.app.yml",
|
|
44
49
|
"build-app:jekyll": "jekyll build --config _config.yml,_config.app.yml",
|
|
45
50
|
"deploy-s3": "$(node -e 'process.stdout.write(`aws s3 cp _site s3://formiojs.test-form.io/` + require(`./package.json`).version + `/ --recursive`)')",
|
|
46
|
-
"invalidate": "VERSION=$(
|
|
47
|
-
"release": "
|
|
48
|
-
"tag": "VERSION=$(
|
|
49
|
-
"dopublish": "npm test;gulp build;
|
|
51
|
+
"invalidate": "VERSION=$(yarn version);aws cloudfront create-invalidation --distribution-id E1MXNA5A4ZKRMZ --paths \"/$VERSION/*\"",
|
|
52
|
+
"release": "yarn build-app && yarn deploy-s3",
|
|
53
|
+
"tag": "VERSION=$(yarn version);git add -A; git commit -m \"Build $Version\";git push origin master;git tag v$VERSION;git push origin --tags;",
|
|
54
|
+
"dopublish": "npm test;gulp build;yarn tag;npm publish lib --tag=rc;",
|
|
50
55
|
"lint": "gulp eslint",
|
|
51
56
|
"serve": "jekyll serve --config _config.yml,_config.dev.yml",
|
|
52
|
-
"test": "
|
|
53
|
-
"test:unit": "npm run lib && mocha --require ts-node/register 'src/**/*.unit.js'",
|
|
57
|
+
"test": "mocha 'src/**/*.unit.js'",
|
|
54
58
|
"test:updateRenders": "npm run lib && TZ=UTC node --require jsdom-global/register test/updateRenders.js",
|
|
55
59
|
"test:e2e": "NODE_OPTIONS=\"--max-old-space-size=4096\" karma start --verbose --single-run"
|
|
56
60
|
},
|
|
@@ -73,9 +77,9 @@
|
|
|
73
77
|
},
|
|
74
78
|
"homepage": "https://github.com/formio/formio.js#readme",
|
|
75
79
|
"dependencies": {
|
|
76
|
-
"@formio/bootstrap": "^3.0.0-rc.
|
|
80
|
+
"@formio/bootstrap": "^3.0.0-rc.12",
|
|
77
81
|
"@formio/choices.js": "^10.2.0",
|
|
78
|
-
"@formio/core": "1.3.0-rc.
|
|
82
|
+
"@formio/core": "1.3.0-rc.16",
|
|
79
83
|
"@formio/text-mask-addons": "^3.8.0-formio.2",
|
|
80
84
|
"@formio/vanilla-text-mask": "^5.1.1-formio.1",
|
|
81
85
|
"autocompleter": "^8.0.4",
|
|
@@ -93,7 +97,6 @@
|
|
|
93
97
|
"fast-deep-equal": "^3.1.3",
|
|
94
98
|
"fast-json-patch": "^3.1.1",
|
|
95
99
|
"fetch-ponyfill": "^7.1.0",
|
|
96
|
-
"i18next": "23.2.3",
|
|
97
100
|
"idb": "^7.1.1",
|
|
98
101
|
"ismobilejs": "^1.1.1",
|
|
99
102
|
"json-logic-js": "^2.0.2",
|
|
@@ -102,7 +105,6 @@
|
|
|
102
105
|
"lodash": "^4.17.21",
|
|
103
106
|
"moment": "^2.29.4",
|
|
104
107
|
"moment-timezone": "^0.5.43",
|
|
105
|
-
"native-promise-only": "^0.8.1",
|
|
106
108
|
"quill": "^2.0.0-dev.3",
|
|
107
109
|
"resize-observer-polyfill": "^1.5.1",
|
|
108
110
|
"signature_pad": "^4.1.4",
|
|
@@ -114,6 +116,7 @@
|
|
|
114
116
|
"devDependencies": {
|
|
115
117
|
"@typescript-eslint/eslint-plugin": "^5.60.1",
|
|
116
118
|
"@typescript-eslint/parser": "^5.60.1",
|
|
119
|
+
"ace-builds": "^1.4.12",
|
|
117
120
|
"async-limiter": "^2.0.0",
|
|
118
121
|
"bootstrap-icons": "^1.10.5",
|
|
119
122
|
"bootswatch": "^5.3.0",
|
package/types/index.d.ts
CHANGED
package/types/utils.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ export type AnyForJSON = { [key: string]: any } | any;
|
|
|
4
4
|
|
|
5
5
|
export namespace Utils {
|
|
6
6
|
const ConditionOperators: any;
|
|
7
|
+
const componentValueTypes: { [key: string]: string };
|
|
7
8
|
const Evaluator: any;
|
|
8
9
|
const _: any;
|
|
10
|
+
function getComponentSavedTypes(schema: object): Array<any> | null;
|
|
9
11
|
function evaluate(
|
|
10
12
|
func: any,
|
|
11
13
|
args: { component: any; form: any; instance: any; row: any; data: any } | any,
|