@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
@@ -9,15 +9,25 @@ export default class Providers {
|
|
9
9
|
(): {
|
10
10
|
title: string;
|
11
11
|
name: string;
|
12
|
-
uploadFile(file: any, fileName: any): any
|
13
|
-
downloadFile(file: any): any
|
12
|
+
uploadFile(file: any, fileName: any): Promise<any>;
|
13
|
+
downloadFile(file: any): Promise<any>;
|
14
14
|
};
|
15
15
|
title: string;
|
16
16
|
};
|
17
17
|
s3: {
|
18
18
|
(formio: any): {
|
19
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any):
|
19
|
+
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<{
|
20
|
+
storage: string;
|
21
|
+
name: any;
|
22
|
+
bucket: any;
|
23
|
+
key: any;
|
24
|
+
url: any;
|
25
|
+
acl: any;
|
26
|
+
size: any;
|
27
|
+
type: any;
|
28
|
+
}>;
|
20
29
|
downloadFile(file: any): any;
|
30
|
+
deleteFile(fileInfo: any): any;
|
21
31
|
};
|
22
32
|
title: string;
|
23
33
|
};
|
@@ -26,15 +36,24 @@ export default class Providers {
|
|
26
36
|
title: string;
|
27
37
|
name: string;
|
28
38
|
uploadFile(file: any, name: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): any;
|
29
|
-
deleteFile(fileInfo: any): any
|
30
|
-
downloadFile(file: any): any
|
39
|
+
deleteFile(fileInfo: any): Promise<any>;
|
40
|
+
downloadFile(file: any): Promise<any>;
|
31
41
|
};
|
32
42
|
title: string;
|
33
43
|
};
|
34
44
|
azure: {
|
35
45
|
(formio: any): {
|
36
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any):
|
46
|
+
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<{
|
47
|
+
storage: string;
|
48
|
+
name: any;
|
49
|
+
size: any;
|
50
|
+
type: any;
|
51
|
+
groupPermissions: any;
|
52
|
+
groupId: any;
|
53
|
+
key: any;
|
54
|
+
}>;
|
37
55
|
downloadFile(file: any): any;
|
56
|
+
deleteFile: (fileInfo: any) => any;
|
38
57
|
};
|
39
58
|
title: string;
|
40
59
|
};
|
@@ -42,16 +61,17 @@ export default class Providers {
|
|
42
61
|
(): {
|
43
62
|
title: string;
|
44
63
|
name: string;
|
45
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any): any;
|
46
|
-
downloadFile(file: any, options: any): any
|
47
|
-
deleteFile(file: any, options: any): any
|
64
|
+
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any): Promise<any> | undefined;
|
65
|
+
downloadFile(file: any, options: any): Promise<any>;
|
66
|
+
deleteFile(file: any, options: any): Promise<any>;
|
48
67
|
};
|
49
68
|
title: string;
|
50
69
|
};
|
51
70
|
googledrive: {
|
52
71
|
(formio: any): {
|
53
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): any
|
54
|
-
downloadFile(file: any): any
|
72
|
+
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<any>;
|
73
|
+
downloadFile(file: any): Promise<any>;
|
74
|
+
deleteFile: (fileInfo: any) => any;
|
55
75
|
};
|
56
76
|
title: string;
|
57
77
|
};
|
@@ -12,7 +12,7 @@ export class GoogleAddressProvider extends AddressProvider {
|
|
12
12
|
addRequiredProviderOptions(options: any): void;
|
13
13
|
filterPlace(place: any): {};
|
14
14
|
attachAutocomplete(elem: any, index: any, onSelectAddress: any): void;
|
15
|
-
search():
|
16
|
-
makeRequest():
|
15
|
+
search(): Promise<void>;
|
16
|
+
makeRequest(): Promise<void>;
|
17
17
|
}
|
18
18
|
import { AddressProvider } from './AddressProvider';
|
@@ -8,7 +8,6 @@ exports.GoogleAddressProvider = void 0;
|
|
8
8
|
const Formio_1 = require("../../Formio");
|
9
9
|
const lodash_1 = __importDefault(require("lodash"));
|
10
10
|
const AddressProvider_1 = require("./AddressProvider");
|
11
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
12
11
|
class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
13
12
|
static get name() {
|
14
13
|
return 'google';
|
@@ -103,10 +102,10 @@ class GoogleAddressProvider extends AddressProvider_1.AddressProvider {
|
|
103
102
|
});
|
104
103
|
}
|
105
104
|
search() {
|
106
|
-
return
|
105
|
+
return Promise.resolve();
|
107
106
|
}
|
108
107
|
makeRequest() {
|
109
|
-
return
|
108
|
+
return Promise.resolve();
|
110
109
|
}
|
111
110
|
getDisplayValue(address) {
|
112
111
|
const displayedProperty = lodash_1.default.has(address, this.displayValueProperty)
|
@@ -1,2 +1,2 @@
|
|
1
1
|
export default fileProcessor;
|
2
|
-
declare function fileProcessor(formio: any, config: any): (file: any, options: any) => any
|
2
|
+
declare function fileProcessor(formio: any, config: any): (file: any, options: any) => Promise<any>;
|
@@ -1,10 +1,6 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const
|
7
|
-
const fileProcessor = (formio, config) => (file, options) => new native_promise_only_1.default((resolve, reject) => {
|
3
|
+
const fileProcessor = (formio, config) => (file, options) => new Promise((resolve, reject) => {
|
8
4
|
const xhr = new XMLHttpRequest();
|
9
5
|
// Fire on network error.
|
10
6
|
xhr.onerror = (err) => {
|
@@ -1,7 +1,16 @@
|
|
1
1
|
export default azure;
|
2
2
|
declare function azure(formio: any): {
|
3
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any):
|
3
|
+
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<{
|
4
|
+
storage: string;
|
5
|
+
name: any;
|
6
|
+
size: any;
|
7
|
+
type: any;
|
8
|
+
groupPermissions: any;
|
9
|
+
groupId: any;
|
10
|
+
key: any;
|
11
|
+
}>;
|
4
12
|
downloadFile(file: any): any;
|
13
|
+
deleteFile: (fileInfo: any) => any;
|
5
14
|
};
|
6
15
|
declare namespace azure {
|
7
16
|
const title: string;
|
@@ -11,19 +11,24 @@ const azure = (formio) => ({
|
|
11
11
|
xhr.setRequestHeader('Content-Type', file.type);
|
12
12
|
xhr.setRequestHeader('x-ms-blob-type', 'BlockBlob');
|
13
13
|
return file;
|
14
|
-
}, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback).then(() => {
|
14
|
+
}, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback).then((response) => {
|
15
15
|
return {
|
16
16
|
storage: 'azure',
|
17
17
|
name: xhr_1.default.path([dir, fileName]),
|
18
18
|
size: file.size,
|
19
19
|
type: file.type,
|
20
20
|
groupPermissions,
|
21
|
-
groupId
|
21
|
+
groupId,
|
22
|
+
key: response.pathFile
|
22
23
|
};
|
23
24
|
});
|
24
25
|
},
|
25
26
|
downloadFile(file) {
|
26
27
|
return formio.makeRequest('file', `${formio.formUrl}/storage/azure?name=${xhr_1.default.trim(file.name)}`, 'GET');
|
28
|
+
},
|
29
|
+
deleteFile: function deleteFile(fileInfo) {
|
30
|
+
var url = `${formio.formUrl}/storage/azure?name=${xhr_1.default.trim(fileInfo.name)}&key=${xhr_1.default.trim(fileInfo.key)}`;
|
31
|
+
return formio.makeRequest('', url, 'delete');
|
27
32
|
}
|
28
33
|
});
|
29
34
|
azure.title = 'Azure File Services';
|
@@ -2,8 +2,8 @@ export default base64;
|
|
2
2
|
declare function base64(): {
|
3
3
|
title: string;
|
4
4
|
name: string;
|
5
|
-
uploadFile(file: any, fileName: any): any
|
6
|
-
downloadFile(file: any): any
|
5
|
+
uploadFile(file: any, fileName: any): Promise<any>;
|
6
|
+
downloadFile(file: any): Promise<any>;
|
7
7
|
};
|
8
8
|
declare namespace base64 {
|
9
9
|
const title: string;
|
@@ -1,15 +1,11 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
7
3
|
const base64 = () => ({
|
8
4
|
title: 'Base64',
|
9
5
|
name: 'base64',
|
10
6
|
uploadFile(file, fileName) {
|
11
7
|
const reader = new FileReader();
|
12
|
-
return new
|
8
|
+
return new Promise((resolve, reject) => {
|
13
9
|
reader.onload = (event) => {
|
14
10
|
const url = event.target.result;
|
15
11
|
resolve({
|
@@ -28,7 +24,7 @@ const base64 = () => ({
|
|
28
24
|
},
|
29
25
|
downloadFile(file) {
|
30
26
|
// Return the original as there is nothing to do.
|
31
|
-
return
|
27
|
+
return Promise.resolve(file);
|
32
28
|
}
|
33
29
|
});
|
34
30
|
base64.title = 'Base64';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export default dropbox;
|
2
2
|
declare function dropbox(formio: any): {
|
3
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): any
|
4
|
-
downloadFile(file: any): any
|
3
|
+
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<any>;
|
4
|
+
downloadFile(file: any): Promise<any>;
|
5
5
|
};
|
6
6
|
declare namespace dropbox {
|
7
7
|
const title: string;
|
@@ -1,13 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
7
3
|
const xhr_1 = require("./xhr");
|
8
4
|
const dropbox = (formio) => ({
|
9
5
|
uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback) {
|
10
|
-
return new
|
6
|
+
return new Promise(((resolve, reject) => {
|
11
7
|
// Send the file with data.
|
12
8
|
const xhr = new XMLHttpRequest();
|
13
9
|
if (typeof progressCallback === 'function') {
|
@@ -54,7 +50,7 @@ const dropbox = (formio) => ({
|
|
54
50
|
const token = formio.getToken();
|
55
51
|
file.url =
|
56
52
|
`${formio.formUrl}/storage/dropbox?path_lower=${file.path_lower}${token ? `&x-jwt-token=${token}` : ''}`;
|
57
|
-
return
|
53
|
+
return Promise.resolve(file);
|
58
54
|
}
|
59
55
|
});
|
60
56
|
dropbox.title = 'Dropbox';
|
@@ -1,7 +1,8 @@
|
|
1
1
|
export default googledrive;
|
2
2
|
declare function googledrive(formio: any): {
|
3
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): any
|
4
|
-
downloadFile(file: any): any
|
3
|
+
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<any>;
|
4
|
+
downloadFile(file: any): Promise<any>;
|
5
|
+
deleteFile: (fileInfo: any) => any;
|
5
6
|
};
|
6
7
|
declare namespace googledrive {
|
7
8
|
const title: string;
|
@@ -1,13 +1,9 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
7
3
|
const xhr_1 = require("./xhr");
|
8
4
|
const googledrive = (formio) => ({
|
9
5
|
uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback) {
|
10
|
-
return new
|
6
|
+
return new Promise(((resolve, reject) => {
|
11
7
|
// Send the file with data.
|
12
8
|
const xhr = new XMLHttpRequest();
|
13
9
|
if (typeof progressCallback === 'function') {
|
@@ -53,7 +49,11 @@ const googledrive = (formio) => ({
|
|
53
49
|
const token = formio.getToken();
|
54
50
|
file.url =
|
55
51
|
`${formio.formUrl}/storage/gdrive?fileId=${file.id}&fileName=${file.originalName}${token ? `&x-jwt-token=${token}` : ''}`;
|
56
|
-
return
|
52
|
+
return Promise.resolve(file);
|
53
|
+
},
|
54
|
+
deleteFile: function deleteFile(fileInfo) {
|
55
|
+
var url = ''.concat(formio.formUrl, `/storage/gdrive?id=${fileInfo.id}&name=${fileInfo.originalName}`);
|
56
|
+
return formio.makeRequest('', url, 'delete');
|
57
57
|
}
|
58
58
|
});
|
59
59
|
googledrive.title = 'Google Drive';
|
@@ -2,9 +2,9 @@ export default indexeddb;
|
|
2
2
|
declare function indexeddb(): {
|
3
3
|
title: string;
|
4
4
|
name: string;
|
5
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any): any;
|
6
|
-
downloadFile(file: any, options: any): any
|
7
|
-
deleteFile(file: any, options: any): any
|
5
|
+
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any): Promise<any> | undefined;
|
6
|
+
downloadFile(file: any, options: any): Promise<any>;
|
7
|
+
deleteFile(file: any, options: any): Promise<any>;
|
8
8
|
};
|
9
9
|
declare namespace indexeddb {
|
10
10
|
const title: string;
|
@@ -1,10 +1,6 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
3
|
const uuid_1 = require("uuid");
|
7
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
8
4
|
const indexeddb = () => ({
|
9
5
|
title: 'indexedDB',
|
10
6
|
name: 'indexeddb',
|
@@ -13,8 +9,8 @@ const indexeddb = () => ({
|
|
13
9
|
console.log('This browser doesn\'t support IndexedDB');
|
14
10
|
return;
|
15
11
|
}
|
16
|
-
return new
|
17
|
-
const request = indexedDB.open(options.indexeddb
|
12
|
+
return new Promise((resolve) => {
|
13
|
+
const request = indexedDB.open(options.indexeddb);
|
18
14
|
request.onsuccess = function (event) {
|
19
15
|
const db = event.target.result;
|
20
16
|
resolve(db);
|
@@ -25,7 +21,7 @@ const indexeddb = () => ({
|
|
25
21
|
};
|
26
22
|
}).then((db) => {
|
27
23
|
const reader = new FileReader();
|
28
|
-
return new
|
24
|
+
return new Promise((resolve, reject) => {
|
29
25
|
reader.onload = () => {
|
30
26
|
const blobObject = new Blob([file], { type: file.type });
|
31
27
|
const id = (0, uuid_1.v4)(blobObject);
|
@@ -62,14 +58,14 @@ const indexeddb = () => ({
|
|
62
58
|
});
|
63
59
|
},
|
64
60
|
downloadFile(file, options) {
|
65
|
-
return new
|
66
|
-
const request = indexedDB.open(options.indexeddb
|
61
|
+
return new Promise((resolve) => {
|
62
|
+
const request = indexedDB.open(options.indexeddb);
|
67
63
|
request.onsuccess = function (event) {
|
68
64
|
const db = event.target.result;
|
69
65
|
resolve(db);
|
70
66
|
};
|
71
67
|
}).then((db) => {
|
72
|
-
return new
|
68
|
+
return new Promise((resolve, reject) => {
|
73
69
|
const trans = db.transaction([options.indexeddbTable], 'readonly');
|
74
70
|
const store = trans.objectStore(options.indexeddbTable).get(file.id);
|
75
71
|
store.onsuccess = () => {
|
@@ -97,14 +93,14 @@ const indexeddb = () => ({
|
|
97
93
|
});
|
98
94
|
},
|
99
95
|
deleteFile(file, options) {
|
100
|
-
return new
|
101
|
-
const request = indexedDB.open(options.indexeddb
|
96
|
+
return new Promise((resolve) => {
|
97
|
+
const request = indexedDB.open(options.indexeddb);
|
102
98
|
request.onsuccess = function (event) {
|
103
99
|
const db = event.target.result;
|
104
100
|
resolve(db);
|
105
101
|
};
|
106
102
|
}).then((db) => {
|
107
|
-
return new
|
103
|
+
return new Promise((resolve, reject) => {
|
108
104
|
const trans = db.transaction([options.indexeddbTable], 'readwrite');
|
109
105
|
const store = trans.objectStore(options.indexeddbTable).delete(file.id);
|
110
106
|
store.onsuccess = () => {
|
@@ -1,7 +1,17 @@
|
|
1
1
|
export default s3;
|
2
2
|
declare function s3(formio: any): {
|
3
|
-
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any):
|
3
|
+
uploadFile(file: any, fileName: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<{
|
4
|
+
storage: string;
|
5
|
+
name: any;
|
6
|
+
bucket: any;
|
7
|
+
key: any;
|
8
|
+
url: any;
|
9
|
+
acl: any;
|
10
|
+
size: any;
|
11
|
+
type: any;
|
12
|
+
}>;
|
4
13
|
downloadFile(file: any): any;
|
14
|
+
deleteFile(fileInfo: any): any;
|
5
15
|
};
|
6
16
|
declare namespace s3 {
|
7
17
|
const title: string;
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
7
6
|
const xhr_1 = __importDefault(require("./xhr"));
|
8
7
|
const s3 = (formio) => ({
|
9
8
|
uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback) {
|
@@ -42,8 +41,12 @@ const s3 = (formio) => ({
|
|
42
41
|
return formio.makeRequest('file', `${formio.formUrl}/storage/s3?bucket=${xhr_1.default.trim(file.bucket)}&key=${xhr_1.default.trim(file.key)}`, 'GET');
|
43
42
|
}
|
44
43
|
else {
|
45
|
-
return
|
44
|
+
return Promise.resolve(file);
|
46
45
|
}
|
46
|
+
},
|
47
|
+
deleteFile(fileInfo) {
|
48
|
+
const url = `${formio.formUrl}/file/${xhr_1.default.trim(fileInfo.name)}?bucket=${xhr_1.default.trim(fileInfo.bucket)}&key=${xhr_1.default.trim(fileInfo.key)}`;
|
49
|
+
return formio.makeRequest('', url, 'delete');
|
47
50
|
}
|
48
51
|
});
|
49
52
|
s3.title = 'S3';
|
@@ -1,11 +1,7 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
3
|
exports.getFormioUploadAdapterPlugin = void 0;
|
7
4
|
const utils_1 = require("../../utils/utils");
|
8
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
9
5
|
/**
|
10
6
|
* UploadAdapter for CKEditor https://ckeditor.com/docs/ckeditor5/latest/framework/guides/deep-dive/upload-adapter.html
|
11
7
|
*/
|
@@ -17,7 +13,7 @@ class FormioUploadAdapter {
|
|
17
13
|
}
|
18
14
|
upload() {
|
19
15
|
return this.loader.file
|
20
|
-
.then(file => new
|
16
|
+
.then(file => new Promise((resolve, reject) => {
|
21
17
|
const { uploadStorage, uploadUrl, uploadOptions, uploadDir, fileKey } = this.component.component;
|
22
18
|
const uploadParams = [
|
23
19
|
uploadStorage,
|
@@ -3,8 +3,8 @@ declare function url(formio: any): {
|
|
3
3
|
title: string;
|
4
4
|
name: string;
|
5
5
|
uploadFile(file: any, name: any, dir: any, progressCallback: any, url: any, options: any, fileKey: any, groupPermissions: any, groupId: any, abortCallback: any): any;
|
6
|
-
deleteFile(fileInfo: any): any
|
7
|
-
downloadFile(file: any): any
|
6
|
+
deleteFile(fileInfo: any): Promise<any>;
|
7
|
+
downloadFile(file: any): Promise<any>;
|
8
8
|
};
|
9
9
|
declare namespace url {
|
10
10
|
const title: string;
|
@@ -1,12 +1,8 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
7
3
|
const url = (formio) => {
|
8
4
|
const xhrRequest = (url, name, query, data, options, progressCallback, abortCallback) => {
|
9
|
-
return new
|
5
|
+
return new Promise((resolve, reject) => {
|
10
6
|
const xhr = new XMLHttpRequest();
|
11
7
|
const json = (typeof data === 'string');
|
12
8
|
const fd = new FormData();
|
@@ -65,7 +61,15 @@ const url = (formio) => {
|
|
65
61
|
if (options) {
|
66
62
|
const parsedOptions = typeof options === 'string' ? JSON.parse(options) : options;
|
67
63
|
for (const prop in parsedOptions) {
|
68
|
-
|
64
|
+
if (prop === 'headers') {
|
65
|
+
const headers = parsedOptions['headers'];
|
66
|
+
for (const header in headers) {
|
67
|
+
xhr.setRequestHeader(header, headers[header]);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
else {
|
71
|
+
xhr[prop] = parsedOptions[prop];
|
72
|
+
}
|
69
73
|
}
|
70
74
|
}
|
71
75
|
xhr.send(json ? data : fd);
|
@@ -108,7 +112,7 @@ const url = (formio) => {
|
|
108
112
|
}
|
109
113
|
},
|
110
114
|
deleteFile(fileInfo) {
|
111
|
-
return new
|
115
|
+
return new Promise((resolve, reject) => {
|
112
116
|
const xhr = new XMLHttpRequest();
|
113
117
|
xhr.open('DELETE', fileInfo.url, true);
|
114
118
|
xhr.onload = () => {
|
@@ -130,7 +134,7 @@ const url = (formio) => {
|
|
130
134
|
return xhrRequest(file.url, file.name, {}, JSON.stringify(file)).then(response => response.data);
|
131
135
|
}
|
132
136
|
// Return the original as there is nothing to do.
|
133
|
-
return
|
137
|
+
return Promise.resolve(file);
|
134
138
|
}
|
135
139
|
};
|
136
140
|
};
|
@@ -3,5 +3,5 @@ export default XHR;
|
|
3
3
|
declare namespace XHR {
|
4
4
|
function trim(text: any): any;
|
5
5
|
function path(items: any): any;
|
6
|
-
function upload(formio: any, type: any, xhrCb: any, file: any, fileName: any, dir: any, progressCallback: any, groupPermissions: any, groupId: any, abortCallback: any): any
|
6
|
+
function upload(formio: any, type: any, xhrCb: any, file: any, fileName: any, dir: any, progressCallback: any, groupPermissions: any, groupId: any, abortCallback: any): Promise<any>;
|
7
7
|
}
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.setXhrHeaders = void 0;
|
7
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
8
7
|
const trim_1 = __importDefault(require("lodash/trim"));
|
9
8
|
const setXhrHeaders = (formio, xhr) => {
|
10
9
|
const { headers } = formio.options;
|
@@ -29,7 +28,7 @@ const XHR = {
|
|
29
28
|
return items.filter(item => !!item).map(XHR.trim).join('/');
|
30
29
|
},
|
31
30
|
upload(formio, type, xhrCb, file, fileName, dir, progressCallback, groupPermissions, groupId, abortCallback) {
|
32
|
-
return new
|
31
|
+
return new Promise(((resolve, reject) => {
|
33
32
|
// Send the pre response to sign the upload.
|
34
33
|
const pre = new XMLHttpRequest();
|
35
34
|
// This only fires on a network error.
|