@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
@@ -0,0 +1,30 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
const type: string;
|
3
|
+
const components: ({
|
4
|
+
type: string;
|
5
|
+
key: string;
|
6
|
+
rows: number;
|
7
|
+
editor: string;
|
8
|
+
hideLabel: boolean;
|
9
|
+
as: string;
|
10
|
+
input: boolean;
|
11
|
+
label?: undefined;
|
12
|
+
showValidations?: undefined;
|
13
|
+
tableView?: undefined;
|
14
|
+
} | {
|
15
|
+
label: string;
|
16
|
+
showValidations: boolean;
|
17
|
+
tableView: boolean;
|
18
|
+
key: string;
|
19
|
+
type: string;
|
20
|
+
input: boolean;
|
21
|
+
rows?: undefined;
|
22
|
+
editor?: undefined;
|
23
|
+
hideLabel?: undefined;
|
24
|
+
as?: undefined;
|
25
|
+
})[];
|
26
|
+
const title: string;
|
27
|
+
const display: string;
|
28
|
+
const name: string;
|
29
|
+
}
|
30
|
+
export default _default;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = {
|
4
|
+
type: 'form',
|
5
|
+
components: [
|
6
|
+
{
|
7
|
+
type: 'textarea',
|
8
|
+
key: 'jsonTextarea',
|
9
|
+
rows: 5,
|
10
|
+
editor: 'ace',
|
11
|
+
hideLabel: true,
|
12
|
+
as: 'json',
|
13
|
+
input: true
|
14
|
+
},
|
15
|
+
{
|
16
|
+
label: 'Submit',
|
17
|
+
showValidations: false,
|
18
|
+
tableView: false,
|
19
|
+
key: 'submit',
|
20
|
+
type: 'button',
|
21
|
+
input: true
|
22
|
+
}
|
23
|
+
],
|
24
|
+
title: 'text area tests',
|
25
|
+
display: 'form',
|
26
|
+
name: 'textAriaTests',
|
27
|
+
};
|
@@ -3,10 +3,12 @@ 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
|
-
exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
6
|
+
exports.comp4 = exports.comp3 = exports.comp2 = exports.comp1 = void 0;
|
7
7
|
const comp1_1 = __importDefault(require("./comp1"));
|
8
8
|
exports.comp1 = comp1_1.default;
|
9
9
|
const comp2_1 = __importDefault(require("./comp2"));
|
10
10
|
exports.comp2 = comp2_1.default;
|
11
11
|
const comp3_1 = __importDefault(require("./comp3"));
|
12
12
|
exports.comp3 = comp3_1.default;
|
13
|
+
const comp4_1 = __importDefault(require("./comp4"));
|
14
|
+
exports.comp4 = comp4_1.default;
|
@@ -7,6 +7,27 @@ export default class TextFieldComponent extends Input {
|
|
7
7
|
weight: number;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
|
+
static get serverConditionSettings(): {
|
11
|
+
operators: any[];
|
12
|
+
constructor: Function;
|
13
|
+
toString(): string;
|
14
|
+
toLocaleString(): string;
|
15
|
+
valueOf(): Object;
|
16
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
17
|
+
isPrototypeOf(v: Object): boolean;
|
18
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
19
|
+
};
|
20
|
+
static get conditionOperatorsSettings(): {
|
21
|
+
operators: any[];
|
22
|
+
constructor: Function;
|
23
|
+
toString(): string;
|
24
|
+
toLocaleString(): string;
|
25
|
+
valueOf(): Object;
|
26
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
27
|
+
isPrototypeOf(v: Object): boolean;
|
28
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
29
|
+
};
|
30
|
+
static savedValueTypes(schema: any): string[];
|
10
31
|
get emptyValue(): string;
|
11
32
|
/**
|
12
33
|
* Returns the mask value object.
|
@@ -34,5 +55,6 @@ export default class TextFieldComponent extends Input {
|
|
34
55
|
getValueAt(index: any): any;
|
35
56
|
isHtmlRenderMode(): any;
|
36
57
|
truncateMultipleSpaces(value: any): any;
|
58
|
+
beforeSubmit(): Promise<any>;
|
37
59
|
}
|
38
60
|
import Input from '../_classes/input/Input';
|
@@ -29,7 +29,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const Input_1 = __importDefault(require("../_classes/input/Input"));
|
30
30
|
const vanilla_text_mask_1 = require("@formio/vanilla-text-mask");
|
31
31
|
const FormioUtils = __importStar(require("../../utils/utils"));
|
32
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
33
32
|
class TextFieldComponent extends Input_1.default {
|
34
33
|
static schema(...extend) {
|
35
34
|
return Input_1.default.schema({
|
@@ -61,6 +60,15 @@ class TextFieldComponent extends Input_1.default {
|
|
61
60
|
schema: TextFieldComponent.schema()
|
62
61
|
};
|
63
62
|
}
|
63
|
+
static get serverConditionSettings() {
|
64
|
+
return TextFieldComponent.conditionOperatorsSettings;
|
65
|
+
}
|
66
|
+
static get conditionOperatorsSettings() {
|
67
|
+
return Object.assign(Object.assign({}, super.conditionOperatorsSettings), { operators: [...super.conditionOperatorsSettings.operators, 'includes', 'notIncludes', 'endsWith', 'startsWith'] });
|
68
|
+
}
|
69
|
+
static savedValueTypes(schema) {
|
70
|
+
return FormioUtils.getComponentSavedTypes(schema) || [FormioUtils.componentValueTypes.string];
|
71
|
+
}
|
64
72
|
get defaultSchema() {
|
65
73
|
return TextFieldComponent.schema();
|
66
74
|
}
|
@@ -233,11 +241,11 @@ class TextFieldComponent extends Input_1.default {
|
|
233
241
|
beforeSubmit() {
|
234
242
|
let value = this.dataValue;
|
235
243
|
if (!this.component.truncateMultipleSpaces || !value) {
|
236
|
-
return
|
244
|
+
return Promise.resolve(value);
|
237
245
|
}
|
238
246
|
value = this.truncateMultipleSpaces(value);
|
239
247
|
this.dataValue = value;
|
240
|
-
return
|
248
|
+
return Promise.resolve(value).then(() => super.beforeSubmit());
|
241
249
|
}
|
242
250
|
}
|
243
251
|
exports.default = TextFieldComponent;
|
@@ -1,4 +1,15 @@
|
|
1
1
|
export default class TimeComponent extends TextFieldComponent {
|
2
|
+
static get serverConditionSettings(): {
|
3
|
+
valueComponent(classComp: any): any;
|
4
|
+
operators: any[];
|
5
|
+
constructor: Function;
|
6
|
+
toString(): string;
|
7
|
+
toLocaleString(): string;
|
8
|
+
valueOf(): Object;
|
9
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
10
|
+
isPrototypeOf(v: Object): boolean;
|
11
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
12
|
+
};
|
2
13
|
rawData: string | never[];
|
3
14
|
get dataFormat(): any;
|
4
15
|
get skipMaskValidation(): boolean;
|
@@ -18,6 +18,11 @@ class TimeComponent extends TextField_1.default {
|
|
18
18
|
dataFormat: defaultDataFormat,
|
19
19
|
}, ...extend);
|
20
20
|
}
|
21
|
+
static get serverConditionSettings() {
|
22
|
+
return Object.assign(Object.assign({}, super.serverConditionSettings), { valueComponent(classComp) {
|
23
|
+
return Object.assign(Object.assign({}, classComp), { type: 'time' });
|
24
|
+
} });
|
25
|
+
}
|
21
26
|
constructor(component, options, data) {
|
22
27
|
super(component, options, data);
|
23
28
|
const { edge: isEdgeBrowser, version: edgeVersion } = (0, utils_1.getBrowserInfo)();
|
@@ -38,7 +43,7 @@ class TimeComponent extends TextField_1.default {
|
|
38
43
|
title: 'Time',
|
39
44
|
icon: 'clock-o',
|
40
45
|
group: 'advanced',
|
41
|
-
documentation: '/userguide/form-building/advanced-components#time',
|
46
|
+
documentation: '/userguide/form-building/advanced-components#time-1',
|
42
47
|
weight: 55,
|
43
48
|
schema: TimeComponent.schema(),
|
44
49
|
};
|
@@ -2,9 +2,9 @@ export default class TreeComponent extends NestedDataComponent {
|
|
2
2
|
static get builderInfo(): {
|
3
3
|
title: string;
|
4
4
|
icon: string;
|
5
|
-
group: string;
|
6
5
|
weight: number;
|
7
6
|
documentation: string;
|
7
|
+
showPreview: boolean;
|
8
8
|
schema: any;
|
9
9
|
};
|
10
10
|
constructor(...args: any[]);
|
@@ -23,10 +23,11 @@ export default class TreeComponent extends NestedDataComponent {
|
|
23
23
|
renderChildNodes(nodes: any[] | undefined, odd: any): any;
|
24
24
|
renderEdit(node?: {}): any;
|
25
25
|
renderView(node?: {}): any;
|
26
|
-
|
26
|
+
attach(element: any): Promise<[void, void]> | Promise<[[void, void], void | [void, void]]>;
|
27
|
+
attachNode(element: any, node: any): Promise<void> | Promise<[void, void]>;
|
27
28
|
attachActions(node: any): void;
|
28
|
-
attachComponents(node: any, ...args: any[]): any
|
29
|
-
attachChildren(node: any): any
|
29
|
+
attachComponents(node: any, ...args: any[]): Promise<any>;
|
30
|
+
attachChildren(node: any): Promise<any>;
|
30
31
|
addChild(parent: any): void;
|
31
32
|
cancelNode(node: any): void;
|
32
33
|
editNode(node: any): void;
|
@@ -5,8 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const Component_form_1 = __importDefault(require("../_classes/component/Component.form"));
|
7
7
|
const Tree_edit_data_1 = __importDefault(require("./editForm/Tree.edit.data"));
|
8
|
+
const Tree_edit_display_1 = __importDefault(require("./editForm/Tree.edit.display"));
|
8
9
|
function default_1(...extend) {
|
9
10
|
return (0, Component_form_1.default)([
|
11
|
+
{
|
12
|
+
key: 'display',
|
13
|
+
components: Tree_edit_display_1.default,
|
14
|
+
},
|
10
15
|
{
|
11
16
|
key: 'data',
|
12
17
|
components: Tree_edit_data_1.default,
|
@@ -8,7 +8,6 @@ const Component_1 = __importDefault(require("../_classes/component/Component"));
|
|
8
8
|
const Components_1 = __importDefault(require("../Components"));
|
9
9
|
const NestedDataComponent_1 = __importDefault(require("../_classes/nesteddata/NestedDataComponent"));
|
10
10
|
const Node_1 = __importDefault(require("./Node"));
|
11
|
-
const native_promise_only_1 = __importDefault(require("native-promise-only"));
|
12
11
|
class TreeComponent extends NestedDataComponent_1.default {
|
13
12
|
static schema(...extend) {
|
14
13
|
return NestedDataComponent_1.default.schema({
|
@@ -26,9 +25,9 @@ class TreeComponent extends NestedDataComponent_1.default {
|
|
26
25
|
return {
|
27
26
|
title: 'Tree',
|
28
27
|
icon: 'indent',
|
29
|
-
group: 'data',
|
30
28
|
weight: 40,
|
31
29
|
documentation: '/userguide/form-building/data-components#tree',
|
30
|
+
showPreview: false,
|
32
31
|
schema: TreeComponent.schema(),
|
33
32
|
};
|
34
33
|
}
|
@@ -135,17 +134,17 @@ class TreeComponent extends NestedDataComponent_1.default {
|
|
135
134
|
this.loadRefs(element, {
|
136
135
|
root: 'single',
|
137
136
|
});
|
138
|
-
return
|
137
|
+
return Promise.all([
|
139
138
|
super.attach(element),
|
140
139
|
this.attachNode(this.refs.root, this.treeRoot),
|
141
140
|
]);
|
142
141
|
}
|
143
142
|
attachNode(element, node) {
|
144
143
|
if (!element) {
|
145
|
-
return
|
144
|
+
return Promise.resolve();
|
146
145
|
}
|
147
|
-
let componentsPromise =
|
148
|
-
let childrenPromise =
|
146
|
+
let componentsPromise = Promise.resolve();
|
147
|
+
let childrenPromise = Promise.resolve();
|
149
148
|
node.refs = lodash_1.default.reduce(element.children, (refs, child) => (child.hasAttribute('ref')
|
150
149
|
? Object.assign(Object.assign({}, refs), { [child.getAttribute('ref')]: child }) : refs), {});
|
151
150
|
if (node.refs.content) {
|
@@ -155,7 +154,7 @@ class TreeComponent extends NestedDataComponent_1.default {
|
|
155
154
|
if (node.refs.childNodes) {
|
156
155
|
childrenPromise = this.attachChildren(node);
|
157
156
|
}
|
158
|
-
return
|
157
|
+
return Promise.all([
|
159
158
|
componentsPromise,
|
160
159
|
childrenPromise,
|
161
160
|
]);
|
@@ -221,11 +220,11 @@ class TreeComponent extends NestedDataComponent_1.default {
|
|
221
220
|
});
|
222
221
|
return node.refs.nodeEdit
|
223
222
|
? super.attachComponents(node.refs.nodeEdit, node.components)
|
224
|
-
:
|
223
|
+
: Promise.resolve();
|
225
224
|
}
|
226
225
|
attachChildren(node) {
|
227
226
|
const childElements = node.refs.childNodes.children;
|
228
|
-
return
|
227
|
+
return Promise.all(lodash_1.default.map(childElements, (childElement, index) => this.attachNode(childElement, node.children[index])));
|
229
228
|
}
|
230
229
|
setValue(value, flags = {}) {
|
231
230
|
const changed = this.updateValue(value, flags);
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = [
|
4
|
+
{
|
5
|
+
key: 'treeInfo',
|
6
|
+
weight: -10,
|
7
|
+
type: 'htmlelement',
|
8
|
+
tag: 'div',
|
9
|
+
className: 'alert alert-danger',
|
10
|
+
content: 'This component has been deprecated and will be removed in a future version of Formio.js.',
|
11
|
+
}
|
12
|
+
];
|
@@ -4,9 +4,11 @@ export default class WellComponent extends NestedComponent {
|
|
4
4
|
icon: string;
|
5
5
|
group: string;
|
6
6
|
documentation: string;
|
7
|
+
showPreview: boolean;
|
7
8
|
weight: number;
|
8
9
|
schema: any;
|
9
10
|
};
|
11
|
+
static savedValueTypes(): never[];
|
10
12
|
constructor(...args: any[]);
|
11
13
|
noField: boolean;
|
12
14
|
}
|
@@ -20,10 +20,14 @@ class WellComponent extends NestedComponent_1.default {
|
|
20
20
|
icon: 'square-o',
|
21
21
|
group: 'layout',
|
22
22
|
documentation: '/userguide/form-building/layout-components#well',
|
23
|
+
showPreview: false,
|
23
24
|
weight: 60,
|
24
25
|
schema: WellComponent.schema()
|
25
26
|
};
|
26
27
|
}
|
28
|
+
static savedValueTypes() {
|
29
|
+
return [];
|
30
|
+
}
|
27
31
|
get defaultSchema() {
|
28
32
|
return WellComponent.schema();
|
29
33
|
}
|
@@ -1 +1,2 @@
|
|
1
|
-
export {};
|
1
|
+
export { Formio };
|
2
|
+
import { Formio } from './Embed';
|
package/lib/cjs/formio.embed.js
CHANGED
@@ -1,4 +1,99 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.Formio = void 0;
|
3
4
|
const Embed_1 = require("./Embed");
|
4
|
-
(
|
5
|
+
Object.defineProperty(exports, "Formio", { enumerable: true, get: function () { return Embed_1.Formio; } });
|
6
|
+
const scripts = document.getElementsByTagName('script');
|
7
|
+
const config = window.FormioConfig || {};
|
8
|
+
let thisScript = null;
|
9
|
+
let i = scripts.length;
|
10
|
+
const scriptName = config.scriptName || 'formio.embed.';
|
11
|
+
while (i--) {
|
12
|
+
if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
|
13
|
+
thisScript = scripts[i];
|
14
|
+
break;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
if (thisScript) {
|
18
|
+
const query = {};
|
19
|
+
const queryString = thisScript.src.replace(/^[^?]+\??/, '');
|
20
|
+
queryString.replace(/\?/g, '&').split('&').forEach((item) => {
|
21
|
+
query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
|
22
|
+
});
|
23
|
+
let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
|
24
|
+
scriptSrc.pop();
|
25
|
+
if (config.formioPath) {
|
26
|
+
config.formioPath(scriptSrc);
|
27
|
+
}
|
28
|
+
scriptSrc = scriptSrc.join('/');
|
29
|
+
Embed_1.Formio.config = Object.assign({
|
30
|
+
script: query.script || (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.form.min.js`),
|
31
|
+
style: query.styles || (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.form.min.css`),
|
32
|
+
cdn: query.cdn,
|
33
|
+
class: (query.class || 'formio-form-wrapper'),
|
34
|
+
src: query.src,
|
35
|
+
form: null,
|
36
|
+
submission: null,
|
37
|
+
project: query.project,
|
38
|
+
base: query.base || 'https://api.form.io',
|
39
|
+
submit: query.submit,
|
40
|
+
includeLibs: (query.libs === 'true' || query.libs === '1'),
|
41
|
+
template: query.template,
|
42
|
+
debug: (query.debug === 'true' || query.debug === '1'),
|
43
|
+
config: {},
|
44
|
+
redirect: (query.return || query.redirect),
|
45
|
+
embedCSS: (`${config.updatePath ? config.updatePath() : scriptSrc}/formio.embed.css`),
|
46
|
+
before: null,
|
47
|
+
after: null
|
48
|
+
}, config);
|
49
|
+
const form = (Embed_1.Formio.config.form || Embed_1.Formio.config.src);
|
50
|
+
if (form) {
|
51
|
+
Embed_1.Formio.debug('Embedding Configuration', config);
|
52
|
+
if (Embed_1.Formio.config.addPremiumLib) {
|
53
|
+
Embed_1.Formio.config.addPremiumLib(Embed_1.Formio.config, scriptSrc);
|
54
|
+
}
|
55
|
+
// The id for this embedded form.
|
56
|
+
Embed_1.Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
|
57
|
+
Embed_1.Formio.debug('Creating form element');
|
58
|
+
const element = Embed_1.Formio.createElement('div', {
|
59
|
+
'id': Embed_1.Formio.config.id,
|
60
|
+
class: Embed_1.Formio.config.class
|
61
|
+
});
|
62
|
+
// insertAfter doesn't exist, but effect is identical.
|
63
|
+
thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
|
64
|
+
Embed_1.Formio.createForm(element, form, Embed_1.Formio.config.config).then((instance) => {
|
65
|
+
if (Embed_1.Formio.config.submit) {
|
66
|
+
instance.nosubmit = true;
|
67
|
+
}
|
68
|
+
// Configure a redirect.
|
69
|
+
instance.on('submit', (submission) => {
|
70
|
+
Embed_1.Formio.debug("on('submit')", submission);
|
71
|
+
if (Embed_1.Formio.config.submit) {
|
72
|
+
Embed_1.Formio.debug(`Sending submission to ${Embed_1.Formio.config.submit}`);
|
73
|
+
const headers = {
|
74
|
+
'content-type': 'application/json'
|
75
|
+
};
|
76
|
+
const token = Embed_1.Formio.FormioClass.getToken();
|
77
|
+
if (token) {
|
78
|
+
headers['x-jwt-token'] = token;
|
79
|
+
}
|
80
|
+
Embed_1.Formio.FormioClass.fetch(Embed_1.Formio.config.submit, {
|
81
|
+
body: JSON.stringify(submission),
|
82
|
+
headers: headers,
|
83
|
+
method: 'POST',
|
84
|
+
mode: 'cors',
|
85
|
+
})
|
86
|
+
.then(resp => resp.json())
|
87
|
+
.then(submission => Embed_1.Formio.submitDone(instance, submission));
|
88
|
+
}
|
89
|
+
else {
|
90
|
+
Embed_1.Formio.submitDone(instance, submission);
|
91
|
+
}
|
92
|
+
});
|
93
|
+
});
|
94
|
+
}
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
// Show an error if the script cannot be found.
|
98
|
+
document.write('<span>Could not locate the Embedded form.</span>');
|
99
|
+
}
|
package/lib/cjs/formio.form.d.ts
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
* @param {*} plugin
|
4
4
|
* @returns
|
5
5
|
*/
|
6
|
-
export function registerModule(mod: any, defaultFn?: null): void;
|
7
|
-
export function useModule(defaultFn?: null): (
|
6
|
+
export function registerModule(mod: any, defaultFn?: null, options?: {}): void;
|
7
|
+
export function useModule(defaultFn?: null): (plugins: any, options?: {}) => void;
|
8
8
|
import Components from './components/Components';
|
9
9
|
import Displays from './displays/Displays';
|
10
10
|
import Providers from './providers';
|
@@ -19,4 +19,5 @@ import ValueSources from './validator/valueSources';
|
|
19
19
|
import Utils from './utils';
|
20
20
|
import Form from './Form';
|
21
21
|
import { Formio } from './Formio';
|
22
|
-
|
22
|
+
import Licenses from './licenses';
|
23
|
+
export { Components, Displays, Providers, Rules, Widgets, Templates, Conjunctions, Operators, QuickRules, Transformers, ValueSources, Utils, Form, Formio, Licenses };
|
package/lib/cjs/formio.form.js
CHANGED
@@ -3,7 +3,7 @@ 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
|
-
exports.Formio = exports.Form = exports.Utils = exports.ValueSources = exports.Transformers = exports.QuickRules = exports.Operators = exports.Conjunctions = exports.Templates = exports.Widgets = exports.Rules = exports.Providers = exports.Displays = exports.Components = exports.useModule = exports.registerModule = void 0;
|
6
|
+
exports.Licenses = exports.Formio = exports.Form = exports.Utils = exports.ValueSources = exports.Transformers = exports.QuickRules = exports.Operators = exports.Conjunctions = exports.Templates = exports.Widgets = exports.Rules = exports.Providers = exports.Displays = exports.Components = exports.useModule = exports.registerModule = void 0;
|
7
7
|
const lodash_1 = __importDefault(require("lodash"));
|
8
8
|
const Formio_1 = require("./Formio");
|
9
9
|
Object.defineProperty(exports, "Formio", { enumerable: true, get: function () { return Formio_1.Formio; } });
|
@@ -35,6 +35,8 @@ exports.Form = Form_1.default;
|
|
35
35
|
const utils_1 = __importDefault(require("./utils"));
|
36
36
|
exports.Utils = utils_1.default;
|
37
37
|
const Evaluator_1 = __importDefault(require("./utils/Evaluator"));
|
38
|
+
const licenses_1 = __importDefault(require("./licenses"));
|
39
|
+
exports.Licenses = licenses_1.default;
|
38
40
|
Formio_1.Formio.loadModules = (path = `${Formio_1.Formio.getApiUrl()}/externalModules.js`, name = 'externalModules') => {
|
39
41
|
Formio_1.Formio.requireLibrary(name, name, path, true)
|
40
42
|
.then((modules) => {
|
@@ -57,6 +59,7 @@ Formio_1.Formio.QuickRules = quickRules_1.default;
|
|
57
59
|
Formio_1.Formio.Transformers = transformers_1.default;
|
58
60
|
Formio_1.Formio.ValueSources = valueSources_1.default;
|
59
61
|
Formio_1.Formio.AllComponents = components_1.default;
|
62
|
+
Formio_1.Formio.Licenses = licenses_1.default;
|
60
63
|
// This is strange, but is needed for "premium" components to import correctly.
|
61
64
|
Formio_1.Formio.Formio = Formio_1.Formio;
|
62
65
|
Formio_1.Formio.Components.setComponents(components_1.default);
|
@@ -65,7 +68,7 @@ Formio_1.Formio.Components.setComponents(components_1.default);
|
|
65
68
|
* @param {*} plugin
|
66
69
|
* @returns
|
67
70
|
*/
|
68
|
-
function registerModule(mod, defaultFn = null) {
|
71
|
+
function registerModule(mod, defaultFn = null, options = {}) {
|
69
72
|
// Sanity check.
|
70
73
|
if (typeof mod !== 'object') {
|
71
74
|
return;
|
@@ -124,6 +127,11 @@ function registerModule(mod, defaultFn = null) {
|
|
124
127
|
case 'valueSources':
|
125
128
|
Formio_1.Formio.ValueSources.addValueSources(mod.valueSources);
|
126
129
|
break;
|
130
|
+
case 'library':
|
131
|
+
options.license
|
132
|
+
? Formio_1.Formio.Licenses.addLicense(mod.library, mod.license)
|
133
|
+
: Formio_1.Formio.Licenses.removeLicense(mod.library);
|
134
|
+
break;
|
127
135
|
default:
|
128
136
|
if (defaultFn) {
|
129
137
|
if (!defaultFn(key, mod)) {
|
@@ -137,22 +145,23 @@ function registerModule(mod, defaultFn = null) {
|
|
137
145
|
}
|
138
146
|
exports.registerModule = registerModule;
|
139
147
|
function useModule(defaultFn = null) {
|
140
|
-
return (
|
148
|
+
return (plugins, options = {}) => {
|
149
|
+
plugins = lodash_1.default.isArray(plugins) ? plugins : [plugins];
|
141
150
|
plugins.forEach((plugin) => {
|
142
151
|
if (Array.isArray(plugin)) {
|
143
|
-
plugin.forEach(p => registerModule(p, defaultFn));
|
152
|
+
plugin.forEach(p => registerModule(p, defaultFn, options));
|
144
153
|
}
|
145
154
|
else {
|
146
|
-
registerModule(plugin, defaultFn);
|
155
|
+
registerModule(plugin, defaultFn, options);
|
147
156
|
}
|
148
157
|
});
|
149
158
|
};
|
150
159
|
}
|
151
160
|
exports.useModule = useModule;
|
152
161
|
/**
|
153
|
-
* Allows passing in plugins as
|
162
|
+
* Allows passing in plugins as an array of plugins or a single plugin.
|
154
163
|
*
|
155
|
-
* Formio.plugins(plugin1,
|
156
|
-
* Formio.plugins([plugin1, plugin2, etc]);
|
164
|
+
* Formio.plugins(plugin1, options);
|
165
|
+
* Formio.plugins([plugin1, plugin2, etc], options);
|
157
166
|
*/
|
158
167
|
Formio_1.Formio.use = useModule();
|
@@ -0,0 +1,22 @@
|
|
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
|
+
const lodash_1 = __importDefault(require("lodash"));
|
7
|
+
class Licenses {
|
8
|
+
static addLicense(name, license) {
|
9
|
+
Licenses.licenses[name] = license;
|
10
|
+
}
|
11
|
+
static getLicense(name) {
|
12
|
+
return Licenses.licenses[name];
|
13
|
+
}
|
14
|
+
static removeLicense(name) {
|
15
|
+
lodash_1.default.unset(Licenses.licenses, name);
|
16
|
+
}
|
17
|
+
static getLicenses() {
|
18
|
+
return Licenses.licenses;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
Licenses.licenses = {};
|
22
|
+
exports.default = Licenses;
|
@@ -0,0 +1,7 @@
|
|
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
|
+
const Licenses_1 = __importDefault(require("./Licenses"));
|
7
|
+
exports.default = Licenses_1.default;
|