@formio/js 5.2.4-rc.0 → 5.2.5
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/dist/formio.builder.css +50 -161
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.js +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 +49 -158
- package/dist/formio.form.js +108 -152
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.css +50 -161
- package/dist/formio.full.js +227 -401
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +18 -51
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +14 -47
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/CDN.js +12 -12
- package/lib/cjs/Element.d.ts +2 -3
- package/lib/cjs/Element.js +26 -29
- package/lib/cjs/Embed.js +42 -75
- package/lib/cjs/EventEmitter.js +1 -1
- package/lib/cjs/Form.d.ts +341 -371
- package/lib/cjs/Form.js +39 -153
- package/lib/cjs/FormBuilder.d.ts +3 -3
- package/lib/cjs/FormBuilder.js +3 -2
- package/lib/cjs/Formio.js +23 -26
- package/lib/cjs/InlineEmbed.js +17 -23
- package/lib/cjs/PDF.d.ts +0 -1
- package/lib/cjs/PDF.js +15 -18
- package/lib/cjs/PDFBuilder.js +36 -51
- package/lib/cjs/Webform.d.ts +366 -8
- package/lib/cjs/Webform.js +238 -177
- package/lib/cjs/WebformBuilder.js +152 -221
- package/lib/cjs/Wizard.js +65 -95
- package/lib/cjs/WizardBuilder.js +19 -27
- package/lib/cjs/addons/FormioAddon.js +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +57 -59
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +16 -24
- package/lib/cjs/addons/index.js +3 -3
- package/lib/cjs/components/Components.js +4 -0
- package/lib/cjs/components/_classes/component/Component.form.js +11 -11
- package/lib/cjs/components/_classes/component/Component.js +198 -309
- package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.js +4 -2
- package/lib/cjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +11 -9
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +25 -39
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +29 -47
- package/lib/cjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +7 -5
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +34 -37
- package/lib/cjs/components/_classes/component/editForm/utils.js +16 -12
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +6 -6
- package/lib/cjs/components/_classes/field/Field.js +1 -7
- package/lib/cjs/components/_classes/input/Input.js +26 -30
- package/lib/cjs/components/_classes/list/ListComponent.form.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +18 -27
- package/lib/cjs/components/_classes/list/editForm/ListComponent.edit.data.js +9 -36
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +13 -32
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +3 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.js +75 -67
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +14 -19
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +17 -19
- package/lib/cjs/components/address/Address.d.ts +0 -1
- package/lib/cjs/components/address/Address.js +52 -57
- package/lib/cjs/components/address/editForm/Address.edit.data.js +2 -2
- package/lib/cjs/components/address/editForm/Address.edit.display.js +2 -2
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +11 -53
- package/lib/cjs/components/alert/Alert.js +15 -21
- package/lib/cjs/components/button/Button.form.js +1 -1
- package/lib/cjs/components/button/Button.js +47 -64
- package/lib/cjs/components/button/editForm/Button.edit.display.js +9 -49
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.form.js +3 -3
- package/lib/cjs/components/checkbox/Checkbox.js +20 -28
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +3 -13
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.validation.js +2 -2
- package/lib/cjs/components/columns/Columns.form.js +1 -1
- package/lib/cjs/components/columns/Columns.js +12 -24
- package/lib/cjs/components/columns/editForm/Columns.edit.display.js +17 -17
- package/lib/cjs/components/container/Container.form.js +2 -2
- package/lib/cjs/components/container/Container.js +4 -6
- package/lib/cjs/components/container/editForm/Container.edit.data.js +3 -3
- package/lib/cjs/components/container/editForm/Container.edit.display.js +4 -4
- package/lib/cjs/components/content/Content.form.js +2 -4
- package/lib/cjs/components/content/Content.js +8 -10
- package/lib/cjs/components/content/editForm/Content.edit.display.js +10 -10
- package/lib/cjs/components/currency/Currency.form.js +3 -3
- package/lib/cjs/components/currency/Currency.js +10 -19
- package/lib/cjs/components/currency/editForm/Currency.edit.data.js +5 -5
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +8 -8
- package/lib/cjs/components/datagrid/DataGrid.form.js +3 -3
- package/lib/cjs/components/datagrid/DataGrid.js +42 -92
- package/lib/cjs/components/datagrid/editForm/DataGrid.edit.data.js +1 -1
- package/lib/cjs/components/datagrid/editForm/DataGrid.edit.display.js +14 -14
- package/lib/cjs/components/datagrid/editForm/DataGrid.edit.validation.js +3 -3
- package/lib/cjs/components/datamap/DataMap.form.js +2 -2
- package/lib/cjs/components/datamap/DataMap.js +35 -46
- package/lib/cjs/components/datamap/editForm/DataMap.edit.data.js +1 -1
- package/lib/cjs/components/datamap/editForm/DataMap.edit.display.js +8 -8
- package/lib/cjs/components/datetime/DateTime.form.js +5 -5
- package/lib/cjs/components/datetime/DateTime.js +15 -30
- package/lib/cjs/components/datetime/editForm/DateTime.edit.data.js +3 -4
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
- package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +17 -22
- package/lib/cjs/components/datetime/editForm/DateTime.edit.time.js +5 -5
- package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.js +3 -3
- package/lib/cjs/components/day/Day.form.js +5 -5
- package/lib/cjs/components/day/Day.js +58 -147
- package/lib/cjs/components/day/editForm/Day.edit.day.js +9 -13
- package/lib/cjs/components/day/editForm/Day.edit.display.js +7 -7
- package/lib/cjs/components/day/editForm/Day.edit.month.js +8 -12
- package/lib/cjs/components/day/editForm/Day.edit.validation.js +7 -7
- package/lib/cjs/components/day/editForm/Day.edit.year.js +8 -8
- package/lib/cjs/components/editgrid/EditGrid.form.js +2 -2
- package/lib/cjs/components/editgrid/EditGrid.js +96 -142
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -7
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +16 -16
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.validation.js +3 -3
- package/lib/cjs/components/email/Email.js +4 -4
- package/lib/cjs/components/email/editForm/Email.edit.display.js +3 -3
- package/lib/cjs/components/email/editForm/Email.edit.validation.js +6 -6
- package/lib/cjs/components/fieldset/Fieldset.form.js +1 -1
- package/lib/cjs/components/fieldset/Fieldset.js +2 -2
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -8
- package/lib/cjs/components/file/File.form.js +4 -4
- package/lib/cjs/components/file/File.js +90 -131
- package/lib/cjs/components/file/editForm/File.edit.display.js +5 -9
- package/lib/cjs/components/file/editForm/File.edit.file.js +53 -97
- package/lib/cjs/components/file/editForm/File.edit.validation.js +2 -2
- package/lib/cjs/components/form/Form.form.js +3 -3
- package/lib/cjs/components/form/Form.js +58 -68
- package/lib/cjs/components/form/editForm/Form.edit.data.js +3 -1
- package/lib/cjs/components/form/editForm/Form.edit.display.js +7 -6
- package/lib/cjs/components/form/editForm/Form.edit.form.js +9 -11
- package/lib/cjs/components/hidden/Hidden.form.js +4 -4
- package/lib/cjs/components/hidden/Hidden.js +2 -2
- package/lib/cjs/components/hidden/editForm/Hidden.edit.data.js +3 -3
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +10 -10
- package/lib/cjs/components/html/HTML.js +17 -23
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +17 -17
- package/lib/cjs/components/html/editForm/HTML.edit.logic.js +2 -2
- package/lib/cjs/components/number/Number.form.js +3 -3
- package/lib/cjs/components/number/Number.js +11 -27
- package/lib/cjs/components/number/editForm/Number.edit.data.js +3 -3
- package/lib/cjs/components/number/editForm/Number.edit.display.js +4 -4
- package/lib/cjs/components/number/editForm/Number.edit.validation.js +9 -9
- package/lib/cjs/components/panel/Panel.form.js +1 -1
- package/lib/cjs/components/panel/Panel.js +2 -2
- package/lib/cjs/components/panel/editForm/Panel.edit.conditional.js +7 -5
- package/lib/cjs/components/panel/editForm/Panel.edit.display.js +29 -55
- package/lib/cjs/components/password/Password.form.js +3 -3
- package/lib/cjs/components/password/Password.js +2 -5
- package/lib/cjs/components/password/editForm/Password.edit.data.js +11 -11
- package/lib/cjs/components/password/editForm/Password.edit.display.js +3 -3
- package/lib/cjs/components/password/editForm/Password.edit.validation.js +3 -3
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +8 -8
- package/lib/cjs/components/phonenumber/PhoneNumber.js +3 -3
- package/lib/cjs/components/phonenumber/editForm/PhoneNumber.edit.validation.js +6 -6
- package/lib/cjs/components/radio/Radio.form.js +3 -3
- package/lib/cjs/components/radio/Radio.js +32 -58
- package/lib/cjs/components/radio/editForm/Radio.edit.data.js +9 -23
- package/lib/cjs/components/radio/editForm/Radio.edit.display.js +6 -6
- package/lib/cjs/components/radio/editForm/Radio.edit.validation.js +2 -2
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +5 -5
- package/lib/cjs/components/recaptcha/ReCaptcha.js +10 -10
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +24 -24
- package/lib/cjs/components/select/Select.form.js +3 -3
- package/lib/cjs/components/select/Select.js +140 -235
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +57 -191
- package/lib/cjs/components/select/editForm/Select.edit.display.js +2 -2
- package/lib/cjs/components/select/editForm/Select.edit.validation.js +4 -4
- package/lib/cjs/components/selectboxes/SelectBoxes.form.js +3 -3
- package/lib/cjs/components/selectboxes/SelectBoxes.js +16 -29
- package/lib/cjs/components/selectboxes/editForm/SelectBoxes.edit.validation.js +5 -5
- package/lib/cjs/components/signature/Signature.form.js +3 -3
- package/lib/cjs/components/signature/Signature.js +17 -26
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +10 -19
- package/lib/cjs/components/survey/Survey.form.js +3 -3
- package/lib/cjs/components/survey/Survey.js +17 -30
- package/lib/cjs/components/survey/editForm/Survey.edit.data.js +11 -23
- package/lib/cjs/components/survey/editForm/Survey.edit.display.js +1 -1
- package/lib/cjs/components/survey/editForm/Survey.edit.validation.js +1 -1
- package/lib/cjs/components/table/Table.form.js +1 -1
- package/lib/cjs/components/table/Table.js +7 -8
- package/lib/cjs/components/table/editForm/Table.edit.display.js +22 -22
- package/lib/cjs/components/tabs/Tabs.form.js +1 -1
- package/lib/cjs/components/tabs/Tabs.js +10 -27
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +17 -21
- package/lib/cjs/components/tags/Tags.form.js +1 -1
- package/lib/cjs/components/tags/Tags.js +12 -28
- package/lib/cjs/components/tags/editForm/Tags.edit.data.js +7 -7
- package/lib/cjs/components/textarea/TextArea.form.js +2 -2
- package/lib/cjs/components/textarea/TextArea.js +45 -63
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +72 -96
- package/lib/cjs/components/textarea/editForm/TextArea.edit.validation.js +3 -3
- package/lib/cjs/components/textfield/TextField.form.js +3 -3
- package/lib/cjs/components/textfield/TextField.js +21 -32
- package/lib/cjs/components/textfield/editForm/TextField.edit.data.js +13 -15
- package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +21 -31
- package/lib/cjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
- package/lib/cjs/components/time/Time.js +10 -17
- package/lib/cjs/components/time/editForm/Time.edit.display.js +2 -2
- package/lib/cjs/components/unknown/Unknown.form.js +5 -5
- package/lib/cjs/components/unknown/Unknown.js +2 -2
- package/lib/cjs/components/unknown/editForm/Unknown.edit.display.js +3 -3
- package/lib/cjs/components/url/Url.form.js +3 -3
- package/lib/cjs/components/url/Url.js +2 -2
- package/lib/cjs/components/url/editForm/Url.edit.display.js +3 -3
- package/lib/cjs/components/url/editForm/Url.edit.validation.js +1 -1
- package/lib/cjs/components/well/Well.form.js +1 -1
- package/lib/cjs/components/well/Well.js +2 -2
- package/lib/cjs/components/well/editForm/Well.edit.display.js +10 -10
- package/lib/cjs/formio.form.d.ts +1 -2
- package/lib/cjs/formio.form.js +12 -38
- package/lib/cjs/i18n.d.ts +0 -4
- package/lib/cjs/i18n.js +3 -7
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/pdf.image.d.ts +2 -0
- package/lib/cjs/pdf.image.js +94 -0
- package/lib/cjs/providers/address/AddressProvider.js +5 -8
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +3 -3
- package/lib/cjs/providers/address/GoogleAddressProvider.js +13 -24
- package/lib/cjs/providers/processor/fileProcessor.js +1 -3
- package/lib/cjs/providers/storage/azure.js +2 -5
- package/lib/cjs/providers/storage/dropbox.js +5 -4
- package/lib/cjs/providers/storage/googleDrive.js +4 -3
- package/lib/cjs/providers/storage/index.js +1 -1
- package/lib/cjs/providers/storage/indexeddb.js +6 -16
- package/lib/cjs/providers/storage/s3.js +6 -17
- package/lib/cjs/providers/storage/uploadAdapter.js +11 -17
- package/lib/cjs/providers/storage/url.js +11 -13
- package/lib/cjs/providers/storage/xhr.js +9 -17
- package/lib/cjs/templates/index.js +1 -1
- package/lib/cjs/translations/en.d.ts +2 -0
- package/lib/cjs/translations/en.js +9 -7
- package/lib/cjs/utils/ChoicesWrapper.js +2 -2
- package/lib/cjs/utils/builder.js +7 -31
- package/lib/cjs/utils/calendarUtils.js +5 -7
- package/lib/cjs/utils/conditionOperators/ConditionOperator.js +1 -1
- package/lib/cjs/utils/conditionOperators/DateGreaterThan.js +4 -12
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +1 -3
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +6 -10
- package/lib/cjs/utils/conditionOperators/index.js +1 -1
- package/lib/cjs/utils/formUtils.js +1 -1
- package/lib/cjs/utils/i18n.js +1 -7
- package/lib/cjs/utils/index.d.ts +1 -2
- package/lib/cjs/utils/index.js +2 -2
- package/lib/cjs/utils/jsonlogic/operators.d.ts +1 -0
- package/lib/cjs/utils/jsonlogic/operators.js +265 -0
- package/lib/cjs/utils/utils.d.ts +1 -10
- package/lib/cjs/utils/utils.js +92 -175
- package/lib/cjs/widgets/CalendarWidget.js +49 -66
- package/lib/cjs/widgets/InputWidget.js +4 -6
- package/lib/cjs/widgets/index.js +1 -1
- package/lib/mjs/CDN.js +12 -12
- package/lib/mjs/Element.d.ts +2 -3
- package/lib/mjs/Element.js +23 -29
- package/lib/mjs/Embed.js +43 -77
- package/lib/mjs/EventEmitter.js +1 -1
- package/lib/mjs/Form.d.ts +341 -371
- package/lib/mjs/Form.js +126 -142
- package/lib/mjs/FormBuilder.d.ts +3 -3
- package/lib/mjs/FormBuilder.js +3 -2
- package/lib/mjs/Formio.js +23 -26
- package/lib/mjs/InlineEmbed.js +17 -23
- package/lib/mjs/PDF.d.ts +0 -1
- package/lib/mjs/PDF.js +15 -18
- package/lib/mjs/PDFBuilder.js +36 -51
- package/lib/mjs/Webform.d.ts +366 -8
- package/lib/mjs/Webform.js +251 -184
- package/lib/mjs/WebformBuilder.js +151 -224
- package/lib/mjs/Wizard.js +64 -94
- package/lib/mjs/WizardBuilder.js +19 -27
- package/lib/mjs/addons/FormioAddon.js +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +57 -59
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +16 -24
- package/lib/mjs/addons/index.js +3 -3
- package/lib/mjs/components/Components.js +4 -0
- package/lib/mjs/components/_classes/component/Component.form.js +11 -11
- package/lib/mjs/components/_classes/component/Component.js +194 -313
- package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.js +4 -2
- package/lib/mjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +11 -9
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +25 -39
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +29 -47
- package/lib/mjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +7 -5
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +34 -37
- package/lib/mjs/components/_classes/component/editForm/utils.js +16 -12
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +2 -2
- package/lib/mjs/components/_classes/field/Field.js +2 -8
- package/lib/mjs/components/_classes/input/Input.js +23 -27
- package/lib/mjs/components/_classes/list/ListComponent.form.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +18 -27
- package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +9 -36
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +13 -32
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +3 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.js +33 -41
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +15 -20
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +17 -19
- package/lib/mjs/components/address/Address.d.ts +0 -1
- package/lib/mjs/components/address/Address.js +49 -60
- package/lib/mjs/components/address/editForm/Address.edit.data.js +2 -2
- package/lib/mjs/components/address/editForm/Address.edit.display.js +2 -2
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +11 -53
- package/lib/mjs/components/alert/Alert.js +16 -22
- package/lib/mjs/components/button/Button.form.js +1 -1
- package/lib/mjs/components/button/Button.js +42 -65
- package/lib/mjs/components/button/editForm/Button.edit.display.js +9 -49
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.form.js +3 -3
- package/lib/mjs/components/checkbox/Checkbox.js +21 -29
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +3 -13
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.validation.js +2 -2
- package/lib/mjs/components/columns/Columns.form.js +1 -1
- package/lib/mjs/components/columns/Columns.js +12 -24
- package/lib/mjs/components/columns/editForm/Columns.edit.display.js +17 -17
- package/lib/mjs/components/container/Container.form.js +2 -2
- package/lib/mjs/components/container/Container.js +4 -6
- package/lib/mjs/components/container/editForm/Container.edit.data.js +3 -3
- package/lib/mjs/components/container/editForm/Container.edit.display.js +4 -4
- package/lib/mjs/components/content/Content.form.js +2 -4
- package/lib/mjs/components/content/Content.js +8 -10
- package/lib/mjs/components/content/editForm/Content.edit.display.js +10 -10
- package/lib/mjs/components/currency/Currency.form.js +3 -3
- package/lib/mjs/components/currency/Currency.js +10 -19
- package/lib/mjs/components/currency/editForm/Currency.edit.data.js +5 -5
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +8 -8
- package/lib/mjs/components/datagrid/DataGrid.form.js +3 -3
- package/lib/mjs/components/datagrid/DataGrid.js +41 -92
- package/lib/mjs/components/datagrid/editForm/DataGrid.edit.data.js +1 -1
- package/lib/mjs/components/datagrid/editForm/DataGrid.edit.display.js +14 -14
- package/lib/mjs/components/datagrid/editForm/DataGrid.edit.validation.js +3 -3
- package/lib/mjs/components/datamap/DataMap.form.js +2 -2
- package/lib/mjs/components/datamap/DataMap.js +33 -46
- package/lib/mjs/components/datamap/editForm/DataMap.edit.data.js +1 -1
- package/lib/mjs/components/datamap/editForm/DataMap.edit.display.js +8 -8
- package/lib/mjs/components/datetime/DateTime.form.js +5 -5
- package/lib/mjs/components/datetime/DateTime.js +16 -31
- package/lib/mjs/components/datetime/editForm/DateTime.edit.data.js +3 -4
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
- package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +17 -22
- package/lib/mjs/components/datetime/editForm/DateTime.edit.time.js +5 -5
- package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.js +3 -3
- package/lib/mjs/components/day/Day.form.js +5 -5
- package/lib/mjs/components/day/Day.js +58 -148
- package/lib/mjs/components/day/editForm/Day.edit.day.js +9 -13
- package/lib/mjs/components/day/editForm/Day.edit.display.js +7 -7
- package/lib/mjs/components/day/editForm/Day.edit.month.js +8 -12
- package/lib/mjs/components/day/editForm/Day.edit.validation.js +7 -7
- package/lib/mjs/components/day/editForm/Day.edit.year.js +8 -8
- package/lib/mjs/components/editgrid/EditGrid.form.js +2 -2
- package/lib/mjs/components/editgrid/EditGrid.js +92 -140
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -7
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +16 -16
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.validation.js +3 -3
- package/lib/mjs/components/email/Email.js +4 -4
- package/lib/mjs/components/email/editForm/Email.edit.display.js +3 -3
- package/lib/mjs/components/email/editForm/Email.edit.validation.js +6 -6
- package/lib/mjs/components/fieldset/Fieldset.form.js +1 -1
- package/lib/mjs/components/fieldset/Fieldset.js +2 -2
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -8
- package/lib/mjs/components/file/File.form.js +4 -4
- package/lib/mjs/components/file/File.js +89 -136
- package/lib/mjs/components/file/editForm/File.edit.display.js +5 -9
- package/lib/mjs/components/file/editForm/File.edit.file.js +53 -97
- package/lib/mjs/components/file/editForm/File.edit.validation.js +2 -2
- package/lib/mjs/components/form/Form.form.js +3 -3
- package/lib/mjs/components/form/Form.js +55 -68
- package/lib/mjs/components/form/editForm/Form.edit.data.js +3 -1
- package/lib/mjs/components/form/editForm/Form.edit.display.js +7 -6
- package/lib/mjs/components/form/editForm/Form.edit.form.js +8 -10
- package/lib/mjs/components/hidden/Hidden.form.js +4 -4
- package/lib/mjs/components/hidden/Hidden.js +2 -2
- package/lib/mjs/components/hidden/editForm/Hidden.edit.data.js +3 -3
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +10 -10
- package/lib/mjs/components/html/HTML.js +17 -23
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +17 -17
- package/lib/mjs/components/html/editForm/HTML.edit.logic.js +2 -2
- package/lib/mjs/components/number/Number.form.js +3 -3
- package/lib/mjs/components/number/Number.js +12 -28
- package/lib/mjs/components/number/editForm/Number.edit.data.js +3 -3
- package/lib/mjs/components/number/editForm/Number.edit.display.js +4 -4
- package/lib/mjs/components/number/editForm/Number.edit.validation.js +9 -9
- package/lib/mjs/components/panel/Panel.form.js +1 -1
- package/lib/mjs/components/panel/Panel.js +2 -2
- package/lib/mjs/components/panel/editForm/Panel.edit.conditional.js +8 -6
- package/lib/mjs/components/panel/editForm/Panel.edit.display.js +29 -55
- package/lib/mjs/components/password/Password.form.js +3 -3
- package/lib/mjs/components/password/Password.js +2 -5
- package/lib/mjs/components/password/editForm/Password.edit.data.js +11 -11
- package/lib/mjs/components/password/editForm/Password.edit.display.js +3 -3
- package/lib/mjs/components/password/editForm/Password.edit.validation.js +3 -3
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +8 -8
- package/lib/mjs/components/phonenumber/PhoneNumber.js +3 -3
- package/lib/mjs/components/phonenumber/editForm/PhoneNumber.edit.validation.js +6 -6
- package/lib/mjs/components/radio/Radio.form.js +3 -3
- package/lib/mjs/components/radio/Radio.js +30 -59
- package/lib/mjs/components/radio/editForm/Radio.edit.data.js +9 -23
- package/lib/mjs/components/radio/editForm/Radio.edit.display.js +6 -6
- package/lib/mjs/components/radio/editForm/Radio.edit.validation.js +2 -2
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +5 -5
- package/lib/mjs/components/recaptcha/ReCaptcha.js +8 -10
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +24 -24
- package/lib/mjs/components/select/Select.form.js +3 -3
- package/lib/mjs/components/select/Select.js +145 -240
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +57 -191
- package/lib/mjs/components/select/editForm/Select.edit.display.js +2 -2
- package/lib/mjs/components/select/editForm/Select.edit.validation.js +4 -4
- package/lib/mjs/components/selectboxes/SelectBoxes.form.js +3 -3
- package/lib/mjs/components/selectboxes/SelectBoxes.js +16 -30
- package/lib/mjs/components/selectboxes/editForm/SelectBoxes.edit.validation.js +5 -5
- package/lib/mjs/components/signature/Signature.form.js +3 -3
- package/lib/mjs/components/signature/Signature.js +16 -26
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +10 -19
- package/lib/mjs/components/survey/Survey.form.js +3 -3
- package/lib/mjs/components/survey/Survey.js +17 -30
- package/lib/mjs/components/survey/editForm/Survey.edit.data.js +11 -23
- package/lib/mjs/components/survey/editForm/Survey.edit.display.js +1 -1
- package/lib/mjs/components/survey/editForm/Survey.edit.validation.js +1 -1
- package/lib/mjs/components/table/Table.form.js +1 -1
- package/lib/mjs/components/table/Table.js +6 -8
- package/lib/mjs/components/table/editForm/Table.edit.display.js +22 -22
- package/lib/mjs/components/tabs/Tabs.form.js +1 -1
- package/lib/mjs/components/tabs/Tabs.js +9 -27
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +17 -21
- package/lib/mjs/components/tags/Tags.form.js +1 -1
- package/lib/mjs/components/tags/Tags.js +12 -28
- package/lib/mjs/components/tags/editForm/Tags.edit.data.js +7 -7
- package/lib/mjs/components/textarea/TextArea.form.js +2 -2
- package/lib/mjs/components/textarea/TextArea.js +51 -75
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +72 -96
- package/lib/mjs/components/textarea/editForm/TextArea.edit.validation.js +3 -3
- package/lib/mjs/components/textfield/TextField.form.js +3 -3
- package/lib/mjs/components/textfield/TextField.js +23 -34
- package/lib/mjs/components/textfield/editForm/TextField.edit.data.js +13 -15
- package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +21 -31
- package/lib/mjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
- package/lib/mjs/components/time/Time.js +10 -17
- package/lib/mjs/components/time/editForm/Time.edit.display.js +2 -2
- package/lib/mjs/components/unknown/Unknown.form.js +5 -5
- package/lib/mjs/components/unknown/Unknown.js +2 -2
- package/lib/mjs/components/unknown/editForm/Unknown.edit.display.js +3 -3
- package/lib/mjs/components/url/Url.form.js +3 -3
- package/lib/mjs/components/url/Url.js +2 -2
- package/lib/mjs/components/url/editForm/Url.edit.display.js +3 -3
- package/lib/mjs/components/url/editForm/Url.edit.validation.js +1 -1
- package/lib/mjs/components/well/Well.form.js +1 -1
- package/lib/mjs/components/well/Well.js +2 -2
- package/lib/mjs/components/well/editForm/Well.edit.display.js +10 -10
- package/lib/mjs/formio.form.d.ts +1 -2
- package/lib/mjs/formio.form.js +8 -10
- package/lib/mjs/i18n.d.ts +0 -4
- package/lib/mjs/i18n.js +3 -7
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/pdf.image.d.ts +2 -0
- package/lib/mjs/pdf.image.js +94 -0
- package/lib/mjs/providers/address/AddressProvider.js +5 -8
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +3 -3
- package/lib/mjs/providers/address/GoogleAddressProvider.js +13 -24
- package/lib/mjs/providers/processor/fileProcessor.js +1 -3
- package/lib/mjs/providers/storage/azure.js +2 -5
- package/lib/mjs/providers/storage/dropbox.js +5 -4
- package/lib/mjs/providers/storage/googleDrive.js +4 -3
- package/lib/mjs/providers/storage/index.js +1 -1
- package/lib/mjs/providers/storage/indexeddb.js +6 -16
- package/lib/mjs/providers/storage/s3.js +8 -19
- package/lib/mjs/providers/storage/uploadAdapter.js +11 -17
- package/lib/mjs/providers/storage/url.js +11 -13
- package/lib/mjs/providers/storage/xhr.js +9 -17
- package/lib/mjs/templates/index.js +1 -1
- package/lib/mjs/translations/en.d.ts +2 -0
- package/lib/mjs/translations/en.js +9 -7
- package/lib/mjs/utils/ChoicesWrapper.js +2 -2
- package/lib/mjs/utils/builder.js +7 -31
- package/lib/mjs/utils/calendarUtils.js +5 -7
- package/lib/mjs/utils/conditionOperators/ConditionOperator.js +1 -1
- package/lib/mjs/utils/conditionOperators/DateGreaterThan.js +5 -16
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +1 -3
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +6 -10
- package/lib/mjs/utils/conditionOperators/index.js +1 -1
- package/lib/mjs/utils/formUtils.js +2 -2
- package/lib/mjs/utils/i18n.js +1 -7
- package/lib/mjs/utils/index.d.ts +1 -2
- package/lib/mjs/utils/index.js +3 -3
- package/lib/mjs/utils/jsonlogic/operators.d.ts +1 -0
- package/lib/mjs/utils/jsonlogic/operators.js +262 -0
- package/lib/mjs/utils/utils.d.ts +1 -10
- package/lib/mjs/utils/utils.js +91 -178
- package/lib/mjs/widgets/CalendarWidget.js +50 -67
- package/lib/mjs/widgets/InputWidget.js +4 -6
- package/lib/mjs/widgets/index.js +1 -1
- package/package.json +3 -3
- package/lib/cjs/translations/de.d.ts +0 -80
- package/lib/cjs/translations/de.js +0 -81
- package/lib/mjs/translations/de.d.ts +0 -80
- package/lib/mjs/translations/de.js +0 -79
package/lib/cjs/Form.js
CHANGED
|
@@ -3,112 +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.FormOptions = void 0;
|
|
7
6
|
const Element_1 = __importDefault(require("./Element"));
|
|
8
7
|
const Formio_1 = require("./Formio");
|
|
9
8
|
const displays_1 = __importDefault(require("./displays"));
|
|
10
9
|
const templates_1 = __importDefault(require("./templates"));
|
|
11
10
|
const utils_1 = __importDefault(require("./utils"));
|
|
12
|
-
/**
|
|
13
|
-
* Represents a JSON value.
|
|
14
|
-
* @typedef {(string | number | boolean | null | JSONArray | JSONObject)} JSON
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Represents a JSON array.
|
|
18
|
-
* @typedef {Array<JSON>} JSONArray
|
|
19
|
-
*/
|
|
20
|
-
/**
|
|
21
|
-
* Represents a JSON object.
|
|
22
|
-
* @typedef {{[key: string]: JSON}} JSONObject
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* @typedef {object} FormioHooks
|
|
26
|
-
* @property {Function} [beforeSubmit] - Called before a submission is made.
|
|
27
|
-
* @property {Function} [beforeCancel] - Called before a cancel is made.
|
|
28
|
-
* @property {Function} [beforeNext] - Called before the next page is navigated to.
|
|
29
|
-
* @property {Function} [beforePrev] - Called before the previous page is navigated to.
|
|
30
|
-
* @property {Function} [attachComponent] - Called when a component is attached.
|
|
31
|
-
* @property {Function} [setDataValue] - Called when a data value is set.
|
|
32
|
-
* @property {Function} [addComponents] - Called when components are added.
|
|
33
|
-
* @property {Function} [addComponent] - Called when a component is added.
|
|
34
|
-
* @property {Function} [customValidation] - Called when a custom validation is made.
|
|
35
|
-
* @property {Function} [attachWebform] - Called when a webform is attached.
|
|
36
|
-
*/
|
|
37
|
-
/**
|
|
38
|
-
* @typedef {object} SanitizeConfig
|
|
39
|
-
* @property {string[]} [addAttr] - The html attributes to allow with sanitization.
|
|
40
|
-
* @property {string[]} [addTags] - The html tags to allow with sanitization.
|
|
41
|
-
* @property {string[]} [allowedAttrs] - The html attributes to allow with sanitization.
|
|
42
|
-
* @property {string[]} [allowedTags] - The html tags to allow with sanitization.
|
|
43
|
-
* @property {string[]} [allowedUriRegex] - The regex for allowed URIs.
|
|
44
|
-
* @property {string[]} [addUriSafeAttr] - The URI attributes to allow with sanitization.
|
|
45
|
-
*/
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {object} ButtonSettings
|
|
48
|
-
* @property {boolean} [showPrevious] - Show the previous button in wizard forms.
|
|
49
|
-
* @property {boolean} [showNext] - Show the next button in wizard forms.
|
|
50
|
-
* @property {boolean} [showCancel] - Show the cancel button in wizard forms.
|
|
51
|
-
* @property {boolean} [showSubmit] - Show the submit button in wizard forms.
|
|
52
|
-
*/
|
|
53
|
-
/**
|
|
54
|
-
* @typedef {object} FormOptions
|
|
55
|
-
* @property {boolean} [saveDraft] - Enable the save draft feature.
|
|
56
|
-
* @property {number} [saveDraftThrottle] - The throttle for the save draft feature.
|
|
57
|
-
* @property {boolean} [readOnly] - Set this form to readOnly.
|
|
58
|
-
* @property {boolean} [noAlerts] - Disable the alerts dialog.
|
|
59
|
-
* @property {{[key: string]: string}} [i18n] - The translation file for this rendering.
|
|
60
|
-
* @property {string} [template] - Custom logic for creation of elements.
|
|
61
|
-
* @property {boolean} [noDefaults] - Exclude default values from the settings.
|
|
62
|
-
* @property {any} [fileService] - The file service for this form.
|
|
63
|
-
* @property {EventEmitter} [events] - The EventEmitter for this form.
|
|
64
|
-
* @property {string} [language] - The language to render this form in.
|
|
65
|
-
* @property {{[key: string]: string}} [i18next] - The i18next configuration for this form.
|
|
66
|
-
* @property {boolean} [viewAsHtml] - View the form as raw HTML.
|
|
67
|
-
* @property {'form' | 'html' | 'flat' | 'builder' | 'pdf'} [renderMode] - The render mode for this form.
|
|
68
|
-
* @property {boolean} [highlightErrors] - Highlight any errors on the form.
|
|
69
|
-
* @property {string} [componentErrorClass] - The error class for components.
|
|
70
|
-
* @property {any} [templates] - The templates for this form.
|
|
71
|
-
* @property {string} [iconset] - The iconset for this form.
|
|
72
|
-
* @property {import('@formio/core').Component[]} [components] - The components for this form.
|
|
73
|
-
* @property {{[key: string]: boolean}} [disabled] - Disabled components for this form.
|
|
74
|
-
* @property {boolean} [showHiddenFields] - Show hidden fields.
|
|
75
|
-
* @property {{[key: string]: boolean}} [hide] - Hidden components for this form.
|
|
76
|
-
* @property {{[key: string]: boolean}} [show] - Components to show for this form.
|
|
77
|
-
* @property {Formio} [formio] - The Formio instance for this form.
|
|
78
|
-
* @property {string} [decimalSeparator] - The decimal separator for this form.
|
|
79
|
-
* @property {string} [thousandsSeparator] - The thousands separator for this form.
|
|
80
|
-
* @property {FormioHooks} [hooks] - The hooks for this form.
|
|
81
|
-
* @property {boolean} [alwaysDirty] - Always be dirty.
|
|
82
|
-
* @property {boolean} [skipDraftRestore] - Skip restoring a draft.
|
|
83
|
-
* @property {'form' | 'wizard' | 'pdf'} [display] - The display for this form.
|
|
84
|
-
* @property {string} [cdnUrl] - The CDN url for this form.
|
|
85
|
-
* @property {boolean} [flatten] - Flatten the form.
|
|
86
|
-
* @property {boolean} [sanitize] - Sanitize the form.
|
|
87
|
-
* @property {SanitizeConfig} [sanitizeConfig] - The sanitize configuration for this form.
|
|
88
|
-
* @property {ButtonSettings} [buttonSettings] - The button settings for this form.
|
|
89
|
-
* @property {object} [breadcrumbSettings] - The breadcrumb settings for this form.
|
|
90
|
-
* @property {boolean} [allowPrevious] - Allow the previous button (for Wizard forms).
|
|
91
|
-
* @property {string[]} [wizardButtonOrder] - The order of the buttons (for Wizard forms).
|
|
92
|
-
* @property {boolean} [showCheckboxBackground] - Show the checkbox background.
|
|
93
|
-
* @property {number} [zoom] - The zoom for PDF forms.
|
|
94
|
-
* @property {boolean} [building] - Whether the form is in builder mode.
|
|
95
|
-
* @property {boolean} [inputsOnly] - Whether to render inputs only (for PDF forms).
|
|
96
|
-
*/
|
|
97
|
-
/**
|
|
98
|
-
* Form class for rendering webforms, pdfs, and wizards.
|
|
99
|
-
* @property {FormOptions} options - The options for this Form instance.
|
|
100
|
-
*/
|
|
101
11
|
class Form extends Element_1.default {
|
|
102
|
-
/**
|
|
103
|
-
* Creates an easy to use interface for embedding webforms, pdfs, and wizards into your application.
|
|
104
|
-
* @param {object} elementOrForm - The DOM element you wish to render this form within, or the form definition.
|
|
105
|
-
* @param {object | string | FormOptions} formOrOptions - A Form JSON schema, the URL of a hosted form, or the form options.
|
|
106
|
-
* @param {FormOptions} [options] - The options to create a new form instance.
|
|
107
|
-
* @example
|
|
108
|
-
* import Form from '@formio/js/Form';
|
|
109
|
-
* const form = new Form(document.getElementById('formio'), 'https://examples.form.io/example');
|
|
110
|
-
* form.build();
|
|
111
|
-
*/
|
|
112
12
|
constructor(elementOrForm, formOrOptions, options = {}) {
|
|
113
13
|
let element, form, formOptions;
|
|
114
14
|
if (elementOrForm instanceof HTMLElement) {
|
|
@@ -158,7 +58,7 @@ class Form extends Element_1.default {
|
|
|
158
58
|
element.setAttribute(attr, attrs[attr]);
|
|
159
59
|
}
|
|
160
60
|
}
|
|
161
|
-
(children || []).forEach(
|
|
61
|
+
(children || []).forEach(child => {
|
|
162
62
|
element.appendChild(this.createElement(child.tag, child.attrs, child.children));
|
|
163
63
|
});
|
|
164
64
|
return element;
|
|
@@ -172,23 +72,19 @@ class Form extends Element_1.default {
|
|
|
172
72
|
return;
|
|
173
73
|
}
|
|
174
74
|
this.loader = this.createElement('div', {
|
|
175
|
-
class: 'formio-loader'
|
|
176
|
-
}, [
|
|
177
|
-
{
|
|
75
|
+
'class': 'formio-loader'
|
|
76
|
+
}, [{
|
|
178
77
|
tag: 'div',
|
|
179
78
|
attrs: {
|
|
180
|
-
class: 'loader-wrapper'
|
|
79
|
+
class: 'loader-wrapper'
|
|
181
80
|
},
|
|
182
|
-
children: [
|
|
183
|
-
{
|
|
81
|
+
children: [{
|
|
184
82
|
tag: 'div',
|
|
185
83
|
attrs: {
|
|
186
|
-
class: 'loader text-center'
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
},
|
|
191
|
-
]);
|
|
84
|
+
class: 'loader text-center'
|
|
85
|
+
}
|
|
86
|
+
}]
|
|
87
|
+
}]);
|
|
192
88
|
this.element.appendChild(this.loader);
|
|
193
89
|
}
|
|
194
90
|
else if (this.loader) {
|
|
@@ -212,6 +108,7 @@ class Form extends Element_1.default {
|
|
|
212
108
|
return new displays_1.default.displays[display](this.element, this.options);
|
|
213
109
|
}
|
|
214
110
|
else {
|
|
111
|
+
// eslint-disable-next-line new-cap
|
|
215
112
|
return new displays_1.default.displays['webform'](this.element, this.options);
|
|
216
113
|
}
|
|
217
114
|
}
|
|
@@ -227,21 +124,21 @@ class Form extends Element_1.default {
|
|
|
227
124
|
return {
|
|
228
125
|
components: [
|
|
229
126
|
{
|
|
230
|
-
label: 'HTML',
|
|
231
|
-
tag: 'div',
|
|
232
|
-
className: 'error error-message alert alert-danger ui red message',
|
|
233
|
-
attrs: [
|
|
127
|
+
'label': 'HTML',
|
|
128
|
+
'tag': 'div',
|
|
129
|
+
'className': 'error error-message alert alert-danger ui red message',
|
|
130
|
+
'attrs': [
|
|
234
131
|
{
|
|
235
|
-
attr: 'role',
|
|
236
|
-
value: 'alert'
|
|
237
|
-
}
|
|
132
|
+
'attr': 'role',
|
|
133
|
+
'value': 'alert'
|
|
134
|
+
}
|
|
238
135
|
],
|
|
239
|
-
key: 'errorMessage',
|
|
240
|
-
type: 'htmlelement',
|
|
241
|
-
input: false,
|
|
242
|
-
content: typeof err === 'string' ? err : err.message,
|
|
243
|
-
}
|
|
244
|
-
]
|
|
136
|
+
'key': 'errorMessage',
|
|
137
|
+
'type': 'htmlelement',
|
|
138
|
+
'input': false,
|
|
139
|
+
'content': typeof err === 'string' ? err : err.message,
|
|
140
|
+
}
|
|
141
|
+
]
|
|
245
142
|
};
|
|
246
143
|
}
|
|
247
144
|
/**
|
|
@@ -260,7 +157,7 @@ class Form extends Element_1.default {
|
|
|
260
157
|
const projectUrl = url.substring(0, index - 1);
|
|
261
158
|
const urlParts = Formio_1.Formio.getUrlParts(projectUrl);
|
|
262
159
|
// project url doesn't include subdirectories path
|
|
263
|
-
if (!urlParts || urlParts.filter(
|
|
160
|
+
if (!urlParts || urlParts.filter(part => !!part).length < 4) {
|
|
264
161
|
return options;
|
|
265
162
|
}
|
|
266
163
|
const baseUrl = `${urlParts[1]}${urlParts[2]}`;
|
|
@@ -275,7 +172,7 @@ class Form extends Element_1.default {
|
|
|
275
172
|
}
|
|
276
173
|
/**
|
|
277
174
|
* Sets the form to the JSON schema of a form.
|
|
278
|
-
* @param {import('@formio/core').Form
|
|
175
|
+
* @param {import('@formio/core').Form} formParam - The form JSON to set this form to.
|
|
279
176
|
* @returns {Promise<Webform|Wizard|PDF>} - The webform instance that was created.
|
|
280
177
|
*/
|
|
281
178
|
setForm(formParam) {
|
|
@@ -290,10 +187,9 @@ class Form extends Element_1.default {
|
|
|
290
187
|
error = err;
|
|
291
188
|
})
|
|
292
189
|
.then((submission) => {
|
|
293
|
-
return (
|
|
294
|
-
.loadForm()
|
|
190
|
+
return formio.loadForm()
|
|
295
191
|
// If the form returned an error, show it instead of the form.
|
|
296
|
-
.catch(
|
|
192
|
+
.catch(err => {
|
|
297
193
|
error = err;
|
|
298
194
|
})
|
|
299
195
|
.then((form) => {
|
|
@@ -303,14 +199,8 @@ class Form extends Element_1.default {
|
|
|
303
199
|
}
|
|
304
200
|
this.loading = false;
|
|
305
201
|
this.instance = this.instance || this.create(form.display);
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
const options = this.getFormInitOptions(formParam, form);
|
|
309
|
-
this.instance.setUrl(formParam, options);
|
|
310
|
-
}
|
|
311
|
-
else {
|
|
312
|
-
this.instance.url = formParam;
|
|
313
|
-
}
|
|
202
|
+
const options = this.getFormInitOptions(formParam, form);
|
|
203
|
+
this.instance.setUrl(formParam, options);
|
|
314
204
|
this.instance.nosubmit = false;
|
|
315
205
|
this._form = this.instance.form = form;
|
|
316
206
|
if (submission) {
|
|
@@ -320,7 +210,7 @@ class Form extends Element_1.default {
|
|
|
320
210
|
throw error;
|
|
321
211
|
}
|
|
322
212
|
return this.instance;
|
|
323
|
-
})
|
|
213
|
+
});
|
|
324
214
|
});
|
|
325
215
|
}
|
|
326
216
|
else {
|
|
@@ -356,15 +246,13 @@ class Form extends Element_1.default {
|
|
|
356
246
|
* @returns {Promise<Webform|Wizard|PDF>} - The form instance that was created after changing the display.
|
|
357
247
|
*/
|
|
358
248
|
setDisplay(display) {
|
|
359
|
-
if (this.display === display && this.instance) {
|
|
249
|
+
if ((this.display === display) && this.instance) {
|
|
360
250
|
return Promise.resolve(this.instance);
|
|
361
251
|
}
|
|
362
252
|
this.form.display = display;
|
|
363
253
|
this.instance.destroy();
|
|
364
254
|
this.instance = this.create(display);
|
|
365
|
-
return this.setForm(this.form)
|
|
366
|
-
this.instance.emit('setDisplay', this.form.display);
|
|
367
|
-
});
|
|
255
|
+
return this.setForm(this.form);
|
|
368
256
|
}
|
|
369
257
|
empty() {
|
|
370
258
|
if (this.element) {
|
|
@@ -426,11 +314,10 @@ class Form extends Element_1.default {
|
|
|
426
314
|
return Promise.reject('No DOM element for form.');
|
|
427
315
|
}
|
|
428
316
|
// Add temporary loader.
|
|
429
|
-
const template = this.options && this.options.template ? this.options.template : 'bootstrap';
|
|
317
|
+
const template = (this.options && this.options.template) ? this.options.template : 'bootstrap';
|
|
430
318
|
const loader = templates_1.default[template].loader || templates_1.default.bootstrap.loader;
|
|
431
319
|
this.setContent(this.element, loader.form);
|
|
432
|
-
return this.render()
|
|
433
|
-
.then((html) => {
|
|
320
|
+
return this.render().then(html => {
|
|
434
321
|
this.setContent(this.element, html);
|
|
435
322
|
return this.attach(this.element).then(() => this.instance);
|
|
436
323
|
})
|
|
@@ -443,7 +330,8 @@ class Form extends Element_1.default {
|
|
|
443
330
|
if (!this.instance) {
|
|
444
331
|
return Promise.reject('Form not ready. Use form.ready promise');
|
|
445
332
|
}
|
|
446
|
-
return Promise.resolve(this.instance.render())
|
|
333
|
+
return Promise.resolve(this.instance.render())
|
|
334
|
+
.then((param) => {
|
|
447
335
|
this.emit('render', param);
|
|
448
336
|
return param;
|
|
449
337
|
});
|
|
@@ -456,7 +344,8 @@ class Form extends Element_1.default {
|
|
|
456
344
|
delete this.element.component;
|
|
457
345
|
}
|
|
458
346
|
this.element = element;
|
|
459
|
-
return this.instance.attach(this.element)
|
|
347
|
+
return this.instance.attach(this.element)
|
|
348
|
+
.then((param) => {
|
|
460
349
|
this.emit('attach', param);
|
|
461
350
|
return param;
|
|
462
351
|
});
|
|
@@ -481,9 +370,6 @@ Formio_1.Formio.embedForm = (embed) => Form.embed(embed);
|
|
|
481
370
|
* Formio.createForm(document.getElementById('formio'), 'https://examples.form.io/example');
|
|
482
371
|
*/
|
|
483
372
|
Formio_1.Formio.createForm = (elementOrForm, formOrOptions, options) => {
|
|
484
|
-
return new Form(elementOrForm, formOrOptions, options).ready;
|
|
373
|
+
return (new Form(elementOrForm, formOrOptions, options)).ready;
|
|
485
374
|
};
|
|
486
375
|
Formio_1.Formio.Form = Form;
|
|
487
|
-
// Export a dummy for TypeScript type resolution
|
|
488
|
-
const FormOptions = undefined;
|
|
489
|
-
exports.FormOptions = FormOptions;
|
package/lib/cjs/FormBuilder.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export default class FormBuilder extends Form {
|
|
|
44
44
|
/**
|
|
45
45
|
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
46
46
|
*/
|
|
47
|
-
editForm?:
|
|
47
|
+
editForm?: any;
|
|
48
48
|
/**
|
|
49
49
|
* - The language to load into the form builder.
|
|
50
50
|
*/
|
|
@@ -105,7 +105,7 @@ export default class FormBuilder extends Form {
|
|
|
105
105
|
/**
|
|
106
106
|
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
107
107
|
*/
|
|
108
|
-
editForm?:
|
|
108
|
+
editForm?: any;
|
|
109
109
|
/**
|
|
110
110
|
* - The language to load into the form builder.
|
|
111
111
|
*/
|
|
@@ -160,7 +160,7 @@ export default class FormBuilder extends Form {
|
|
|
160
160
|
/**
|
|
161
161
|
* - The options to apply to the Edit Form (the form that shows inside the modal when you edit a component).
|
|
162
162
|
*/
|
|
163
|
-
editForm?:
|
|
163
|
+
editForm?: any;
|
|
164
164
|
/**
|
|
165
165
|
* - The language to load into the form builder.
|
|
166
166
|
*/
|
package/lib/cjs/FormBuilder.js
CHANGED
|
@@ -17,13 +17,14 @@ class FormBuilder extends Form_1.default {
|
|
|
17
17
|
constructor(element, form, options) {
|
|
18
18
|
form = form || {};
|
|
19
19
|
options = options || {};
|
|
20
|
-
super(element, form, Object.assign(options, FormBuilder.options, Formio_1.Formio.options && Formio_1.Formio.options.builder ? Formio_1.Formio.options.builder : {}));
|
|
20
|
+
super(element, form, Object.assign(options, FormBuilder.options, ((Formio_1.Formio.options && Formio_1.Formio.options.builder) ? Formio_1.Formio.options.builder : {})));
|
|
21
21
|
}
|
|
22
22
|
create(display) {
|
|
23
23
|
if (builders_1.default.builders[display]) {
|
|
24
24
|
return new builders_1.default.builders[display](this.element, this.options);
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
|
+
// eslint-disable-next-line new-cap
|
|
27
28
|
return new builders_1.default.builders['webform'](this.element, this.options);
|
|
28
29
|
}
|
|
29
30
|
}
|
|
@@ -55,6 +56,6 @@ exports.default = FormBuilder;
|
|
|
55
56
|
* @returns {Promise} - When the form is instance is ready.
|
|
56
57
|
*/
|
|
57
58
|
Formio_1.Formio.builder = (element, form, options) => {
|
|
58
|
-
return new FormBuilder(element, form, options).ready;
|
|
59
|
+
return (new FormBuilder(element, form, options)).ready;
|
|
59
60
|
};
|
|
60
61
|
Formio_1.Formio.FormBuilder = FormBuilder;
|
package/lib/cjs/Formio.js
CHANGED
|
@@ -11,10 +11,8 @@ const CDN_1 = __importDefault(require("./CDN"));
|
|
|
11
11
|
const providers_1 = __importDefault(require("./providers"));
|
|
12
12
|
sdk_1.Formio.cdn = new CDN_1.default();
|
|
13
13
|
sdk_1.Formio.Providers = providers_1.default;
|
|
14
|
-
sdk_1.Formio.version = '5.
|
|
15
|
-
CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc')
|
|
16
|
-
? 'https://cdn.test-form.io'
|
|
17
|
-
: 'https://cdn.form.io';
|
|
14
|
+
sdk_1.Formio.version = '5.2.5';
|
|
15
|
+
CDN_1.default.defaultCDN = sdk_1.Formio.version.includes('rc') ? 'https://cdn.test-form.io' : 'https://cdn.form.io';
|
|
18
16
|
const isNil = (val) => val === null || val === undefined;
|
|
19
17
|
sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
|
|
20
18
|
const requestArgs = {
|
|
@@ -22,11 +20,13 @@ sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, prog
|
|
|
22
20
|
method: 'upload',
|
|
23
21
|
file: file,
|
|
24
22
|
fileName: fileName,
|
|
25
|
-
dir: dir
|
|
23
|
+
dir: dir
|
|
26
24
|
};
|
|
27
25
|
fileKey = fileKey || 'file';
|
|
28
|
-
const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)
|
|
29
|
-
|
|
26
|
+
const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)
|
|
27
|
+
.then(() => {
|
|
28
|
+
return sdk_1.Formio.pluginGet('fileRequest', requestArgs)
|
|
29
|
+
.then((result) => {
|
|
30
30
|
if (storage && isNil(result)) {
|
|
31
31
|
const Provider = providers_1.default.getProvider('storage', storage);
|
|
32
32
|
if (Provider) {
|
|
@@ -37,7 +37,7 @@ sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, prog
|
|
|
37
37
|
return provider.uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback, multipartOptions);
|
|
38
38
|
}
|
|
39
39
|
else {
|
|
40
|
-
throw 'Storage provider not found';
|
|
40
|
+
throw ('Storage provider not found');
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
return result || { url: '' };
|
|
@@ -48,10 +48,12 @@ sdk_1.Formio.prototype.uploadFile = function (storage, file, fileName, dir, prog
|
|
|
48
48
|
sdk_1.Formio.prototype.downloadFile = function (file, options) {
|
|
49
49
|
const requestArgs = {
|
|
50
50
|
method: 'download',
|
|
51
|
-
file: file
|
|
51
|
+
file: file
|
|
52
52
|
};
|
|
53
|
-
const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)
|
|
54
|
-
|
|
53
|
+
const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)
|
|
54
|
+
.then(() => {
|
|
55
|
+
return sdk_1.Formio.pluginGet('fileRequest', requestArgs)
|
|
56
|
+
.then((result) => {
|
|
55
57
|
if (file.storage && isNil(result)) {
|
|
56
58
|
const Provider = providers_1.default.getProvider('storage', file.storage);
|
|
57
59
|
if (Provider) {
|
|
@@ -59,7 +61,7 @@ sdk_1.Formio.prototype.downloadFile = function (file, options) {
|
|
|
59
61
|
return provider.downloadFile(file, options);
|
|
60
62
|
}
|
|
61
63
|
else {
|
|
62
|
-
throw 'Storage provider not found';
|
|
64
|
+
throw ('Storage provider not found');
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
return result || { url: '' };
|
|
@@ -70,10 +72,12 @@ sdk_1.Formio.prototype.downloadFile = function (file, options) {
|
|
|
70
72
|
sdk_1.Formio.prototype.deleteFile = function (file, options) {
|
|
71
73
|
const requestArgs = {
|
|
72
74
|
method: 'delete',
|
|
73
|
-
file: file
|
|
75
|
+
file: file
|
|
74
76
|
};
|
|
75
|
-
const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)
|
|
76
|
-
|
|
77
|
+
const request = sdk_1.Formio.pluginWait('preRequest', requestArgs)
|
|
78
|
+
.then(() => {
|
|
79
|
+
return sdk_1.Formio.pluginGet('fileRequest', requestArgs)
|
|
80
|
+
.then((result) => {
|
|
77
81
|
if (file.storage && isNil(result)) {
|
|
78
82
|
const Provider = providers_1.default.getProvider('storage', file.storage);
|
|
79
83
|
if (Provider) {
|
|
@@ -81,7 +85,7 @@ sdk_1.Formio.prototype.deleteFile = function (file, options) {
|
|
|
81
85
|
return provider.deleteFile(file, options);
|
|
82
86
|
}
|
|
83
87
|
else {
|
|
84
|
-
throw 'Storage provider not found';
|
|
88
|
+
throw ('Storage provider not found');
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
return result || { url: '' };
|
|
@@ -90,14 +94,7 @@ sdk_1.Formio.prototype.deleteFile = function (file, options) {
|
|
|
90
94
|
return sdk_1.Formio.pluginAlter('wrapFileRequestPromise', request, requestArgs);
|
|
91
95
|
};
|
|
92
96
|
// Esnure we proxy the following methods to the FormioEmbed class.
|
|
93
|
-
[
|
|
94
|
-
'setBaseUrl',
|
|
95
|
-
'setApiUrl',
|
|
96
|
-
'setAppUrl',
|
|
97
|
-
'setProjectUrl',
|
|
98
|
-
'setPathType',
|
|
99
|
-
'setLicense',
|
|
100
|
-
].forEach((fn) => {
|
|
97
|
+
['setBaseUrl', 'setApiUrl', 'setAppUrl', 'setProjectUrl', 'setPathType', 'setLicense'].forEach((fn) => {
|
|
101
98
|
const baseFn = sdk_1.Formio[fn];
|
|
102
99
|
sdk_1.Formio[fn] = function (arg) {
|
|
103
100
|
const retVal = Embed_1.Formio[fn](arg, true);
|
|
@@ -122,8 +119,8 @@ sdk_1.Formio.addToGlobal = (global) => {
|
|
|
122
119
|
global.Formio = sdk_1.Formio;
|
|
123
120
|
}
|
|
124
121
|
};
|
|
125
|
-
if (typeof
|
|
126
|
-
sdk_1.Formio.addToGlobal(
|
|
122
|
+
if (typeof global !== 'undefined') {
|
|
123
|
+
sdk_1.Formio.addToGlobal(global);
|
|
127
124
|
}
|
|
128
125
|
if (typeof window !== 'undefined') {
|
|
129
126
|
sdk_1.Formio.addToGlobal(window);
|
package/lib/cjs/InlineEmbed.js
CHANGED
|
@@ -14,7 +14,7 @@ function embed(config = {}) {
|
|
|
14
14
|
let i = scripts.length;
|
|
15
15
|
const scriptName = config.scriptName || 'formio.embed.';
|
|
16
16
|
while (i--) {
|
|
17
|
-
if (scripts[i].src && scripts[i].src.indexOf(scriptName) !== -1) {
|
|
17
|
+
if (scripts[i].src && (scripts[i].src.indexOf(scriptName) !== -1)) {
|
|
18
18
|
thisScript = scripts[i];
|
|
19
19
|
break;
|
|
20
20
|
}
|
|
@@ -22,19 +22,13 @@ function embed(config = {}) {
|
|
|
22
22
|
if (thisScript) {
|
|
23
23
|
const query = {};
|
|
24
24
|
const queryString = thisScript.src.replace(/^[^?]+\??/, '');
|
|
25
|
-
queryString
|
|
26
|
-
.replace(/\?/g, '&')
|
|
27
|
-
.split('&')
|
|
28
|
-
.forEach((item) => {
|
|
25
|
+
queryString.replace(/\?/g, '&').split('&').forEach((item) => {
|
|
29
26
|
query[item.split('=')[0]] = item.split('=')[1] && decodeURIComponent(item.split('=')[1]);
|
|
30
27
|
});
|
|
31
28
|
let scriptSrc = thisScript.src.replace(/^([^?]+).*/, '$1').split('/');
|
|
32
29
|
scriptSrc.pop();
|
|
33
30
|
let cdnSrc = '';
|
|
34
|
-
if ([
|
|
35
|
-
'js',
|
|
36
|
-
'offline',
|
|
37
|
-
].includes(scriptSrc[scriptSrc.length - 1])) {
|
|
31
|
+
if (['js', 'offline'].includes(scriptSrc[scriptSrc.length - 1])) {
|
|
38
32
|
scriptSrc.pop();
|
|
39
33
|
scriptSrc = cdnSrc = scriptSrc.join('/');
|
|
40
34
|
scriptSrc += '/js';
|
|
@@ -42,42 +36,42 @@ function embed(config = {}) {
|
|
|
42
36
|
else {
|
|
43
37
|
scriptSrc = scriptSrc.join('/');
|
|
44
38
|
}
|
|
45
|
-
const debug = query.debug === 'true' || query.debug === '1';
|
|
39
|
+
const debug = (query.debug === 'true' || query.debug === '1');
|
|
46
40
|
const renderer = debug ? 'formio.form' : 'formio.form.min';
|
|
47
41
|
Embed_1.Formio.config = Object.assign({
|
|
48
|
-
script: query.script || `${scriptSrc}/${renderer}.js
|
|
49
|
-
style: query.styles || `${scriptSrc}/${renderer}.css
|
|
42
|
+
script: query.script || (`${scriptSrc}/${renderer}.js`),
|
|
43
|
+
style: query.styles || (`${scriptSrc}/${renderer}.css`),
|
|
50
44
|
cdn: query.cdn || cdnSrc,
|
|
51
|
-
class: query.class || 'formio-form-wrapper',
|
|
45
|
+
class: (query.class || 'formio-form-wrapper'),
|
|
52
46
|
src: query.src,
|
|
53
47
|
form: null,
|
|
54
48
|
submission: null,
|
|
55
49
|
project: query.project,
|
|
56
50
|
base: query.base || 'https://api.form.io',
|
|
57
51
|
submit: query.submit,
|
|
58
|
-
includeLibs: query.libs === 'true' || query.libs === '1',
|
|
59
|
-
noshadow: query.shadow === 'false' || query.shadow === '0',
|
|
52
|
+
includeLibs: (query.libs === 'true' || query.libs === '1'),
|
|
53
|
+
noshadow: (query.shadow === 'false' || query.shadow === '0'),
|
|
60
54
|
template: query.template || 'bootstrap',
|
|
61
55
|
debug: debug,
|
|
62
56
|
config: {},
|
|
63
|
-
redirect: query.return || query.redirect,
|
|
64
|
-
embedCSS: `${scriptSrc}/formio.embed.css
|
|
57
|
+
redirect: (query.return || query.redirect),
|
|
58
|
+
embedCSS: (`${scriptSrc}/formio.embed.css`),
|
|
65
59
|
success: query.success || 'Thank you for your submission!',
|
|
66
60
|
before: null,
|
|
67
|
-
after: null
|
|
61
|
+
after: null
|
|
68
62
|
}, config);
|
|
69
63
|
if (Embed_1.Formio.config.alter) {
|
|
70
64
|
Embed_1.Formio.config.alter(Embed_1.Formio.config);
|
|
71
65
|
}
|
|
72
|
-
const form = Embed_1.Formio.config.form || Embed_1.Formio.config.src;
|
|
66
|
+
const form = (Embed_1.Formio.config.form || Embed_1.Formio.config.src);
|
|
73
67
|
if (form) {
|
|
74
68
|
Embed_1.Formio.debug('Embedding Configuration', config);
|
|
75
69
|
// The id for this embedded form.
|
|
76
70
|
Embed_1.Formio.config.id = `formio-${Math.random().toString(36).substring(7)}`;
|
|
77
71
|
Embed_1.Formio.debug('Creating form element');
|
|
78
72
|
const element = Embed_1.Formio.createElement('div', {
|
|
79
|
-
id: Embed_1.Formio.config.id,
|
|
80
|
-
class: Embed_1.Formio.config.class
|
|
73
|
+
'id': Embed_1.Formio.config.id,
|
|
74
|
+
class: Embed_1.Formio.config.class
|
|
81
75
|
});
|
|
82
76
|
// insertAfter doesn't exist, but effect is identical.
|
|
83
77
|
thisScript.parentNode.insertBefore(element, thisScript.parentNode.firstElementChild.nextSibling);
|
|
@@ -93,7 +87,7 @@ function embed(config = {}) {
|
|
|
93
87
|
if (Embed_1.Formio.config.submit) {
|
|
94
88
|
Embed_1.Formio.debug(`Sending submission to ${Embed_1.Formio.config.submit}`);
|
|
95
89
|
const headers = {
|
|
96
|
-
'content-type': 'application/json'
|
|
90
|
+
'content-type': 'application/json'
|
|
97
91
|
};
|
|
98
92
|
const token = Embed_1.Formio.FormioClass.getToken();
|
|
99
93
|
if (token) {
|
|
@@ -105,7 +99,7 @@ function embed(config = {}) {
|
|
|
105
99
|
method: 'POST',
|
|
106
100
|
mode: 'cors',
|
|
107
101
|
})
|
|
108
|
-
.then(
|
|
102
|
+
.then(resp => resp.json())
|
|
109
103
|
.then((submission) => {
|
|
110
104
|
Embed_1.Formio.submitDone(instance, submission);
|
|
111
105
|
});
|