@formio/js 5.0.0-rc.27 → 5.0.0-rc.29
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/fonts/bootstrap-icons.woff +0 -0
- package/dist/fonts/bootstrap-icons.woff2 +0 -0
- 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.js +957 -2270
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +4 -2
- package/dist/formio.full.css +100 -3
- package/dist/formio.full.js +961 -2231
- package/dist/formio.full.min.css +2 -2
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +4 -2
- package/dist/formio.js +101 -1966
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -3
- package/dist/formio.utils.js +145 -104
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +4 -2
- package/lib/cjs/CDN.d.ts +1 -1
- package/lib/cjs/CDN.js +2 -2
- package/lib/cjs/Embed.d.ts +16 -7
- package/lib/cjs/Embed.js +76 -24
- package/lib/cjs/Formio.d.ts +0 -1
- package/lib/cjs/Formio.js +27 -19
- package/lib/cjs/PDF.js +2 -2
- package/lib/cjs/Webform.d.ts +6 -9
- package/lib/cjs/Webform.js +59 -81
- package/lib/cjs/WebformBuilder.d.ts +1 -1
- package/lib/cjs/WebformBuilder.js +33 -16
- package/lib/cjs/Wizard.d.ts +5 -4
- package/lib/cjs/Wizard.js +37 -26
- package/lib/cjs/WizardBuilder.d.ts +1 -0
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +1 -2
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +11 -12
- package/lib/cjs/addons/index.d.ts +1 -0
- package/lib/cjs/addons/index.js +5 -1
- package/lib/cjs/components/Components.d.ts +7 -0
- package/lib/cjs/components/Components.js +30 -0
- package/lib/cjs/components/_classes/component/Component.d.ts +57 -27
- package/lib/cjs/components/_classes/component/Component.js +193 -119
- package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.d.ts +8 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.js +31 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +28 -11
- package/lib/cjs/components/_classes/nested/NestedComponent.js +88 -57
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +4 -3
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +17 -4
- package/lib/cjs/components/builder.js +0 -2
- package/lib/cjs/components/button/Button.js +2 -1
- package/lib/cjs/components/columns/Columns.d.ts +1 -0
- package/lib/cjs/components/columns/Columns.js +2 -3
- package/lib/cjs/components/columns/editForm/Columns.edit.display.d.ts +30 -1
- package/lib/cjs/components/columns/editForm/Columns.edit.display.js +23 -1
- package/lib/cjs/components/container/Container.d.ts +1 -0
- package/lib/cjs/components/container/Container.js +2 -6
- package/lib/cjs/components/content/Content.d.ts +1 -0
- package/lib/cjs/components/content/Content.js +1 -0
- package/lib/cjs/components/datagrid/DataGrid.d.ts +0 -8
- package/lib/cjs/components/datagrid/DataGrid.js +9 -26
- package/lib/cjs/components/datamap/DataMap.js +2 -1
- package/lib/cjs/components/datetime/DateTime.js +0 -2
- package/lib/cjs/components/day/Day.js +2 -3
- package/lib/cjs/components/editgrid/EditGrid.d.ts +8 -4
- package/lib/cjs/components/editgrid/EditGrid.js +96 -73
- package/lib/cjs/components/email/Email.js +0 -1
- package/lib/cjs/components/file/File.js +1 -1
- package/lib/cjs/components/file/fixtures/comp3.d.ts +29 -0
- package/lib/cjs/components/file/fixtures/comp3.js +31 -0
- package/lib/cjs/components/form/Form.d.ts +2 -6
- package/lib/cjs/components/form/Form.js +43 -14
- package/lib/cjs/components/index.d.ts +0 -2
- package/lib/cjs/components/index.js +0 -2
- package/lib/cjs/components/number/Number.d.ts +1 -2
- package/lib/cjs/components/number/Number.js +5 -6
- package/lib/cjs/components/panel/Panel.d.ts +0 -1
- package/lib/cjs/components/panel/Panel.js +2 -9
- package/lib/cjs/components/panel/editForm/Panel.edit.display.d.ts +6 -38
- package/lib/cjs/components/panel/editForm/Panel.edit.display.js +3 -16
- package/lib/cjs/components/phonenumber/PhoneNumber.js +17 -0
- package/lib/cjs/components/radio/Radio.js +0 -2
- package/lib/cjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/cjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/cjs/components/select/Select.js +3 -2
- package/lib/cjs/components/selectboxes/SelectBoxes.d.ts +1 -2
- package/lib/cjs/components/selectboxes/SelectBoxes.js +7 -6
- package/lib/cjs/components/table/editForm/Table.edit.display.d.ts +31 -2
- package/lib/cjs/components/table/editForm/Table.edit.display.js +22 -0
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.d.ts +30 -2
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +22 -0
- package/lib/cjs/components/textfield/TextField.js +20 -6
- package/lib/cjs/components/time/Time.js +0 -6
- package/lib/cjs/components/url/Url.js +0 -1
- package/lib/cjs/components/well/editForm/Well.edit.display.d.ts +25 -2
- package/lib/cjs/components/well/editForm/Well.edit.display.js +18 -0
- package/lib/cjs/formio.embed.js +5 -3
- package/lib/cjs/formio.form.d.ts +1 -7
- package/lib/cjs/formio.form.js +3 -38
- package/lib/cjs/index.d.ts +2 -1
- package/lib/cjs/index.js +3 -1
- package/lib/cjs/providers/Providers.d.ts +0 -4
- package/lib/cjs/providers/storage/azure.d.ts +0 -2
- package/lib/cjs/providers/storage/azure.js +1 -6
- package/lib/cjs/providers/storage/googleDrive.d.ts +0 -1
- package/lib/cjs/providers/storage/googleDrive.js +0 -4
- package/lib/cjs/providers/storage/s3.d.ts +0 -1
- package/lib/cjs/providers/storage/s3.js +0 -4
- package/lib/cjs/templates/Templates.d.ts +1 -11
- package/lib/cjs/templates/Templates.js +4 -41
- package/lib/cjs/translations/en.d.ts +5 -0
- package/lib/cjs/translations/en.js +5 -0
- package/lib/cjs/utils/formUtils.js +1 -0
- package/lib/cjs/utils/index.d.ts +1 -0
- package/lib/cjs/utils/index.js +2 -0
- package/lib/cjs/utils/utils.d.ts +2 -1
- package/lib/cjs/utils/utils.js +27 -9
- package/lib/mjs/CDN.d.ts +1 -1
- package/lib/mjs/CDN.js +2 -2
- package/lib/mjs/Embed.d.ts +16 -7
- package/lib/mjs/Embed.js +75 -18
- package/lib/mjs/Formio.d.ts +0 -1
- package/lib/mjs/Formio.js +11 -3
- package/lib/mjs/PDF.js +2 -2
- package/lib/mjs/Webform.d.ts +6 -9
- package/lib/mjs/Webform.js +58 -82
- package/lib/mjs/WebformBuilder.d.ts +1 -1
- package/lib/mjs/WebformBuilder.js +31 -10
- package/lib/mjs/Wizard.d.ts +5 -4
- package/lib/mjs/Wizard.js +36 -27
- package/lib/mjs/WizardBuilder.d.ts +1 -0
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.d.ts +1 -2
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +11 -12
- package/lib/mjs/addons/index.d.ts +1 -0
- package/lib/mjs/addons/index.js +5 -1
- package/lib/mjs/components/Components.d.ts +7 -0
- package/lib/mjs/components/Components.js +29 -0
- package/lib/mjs/components/_classes/component/Component.d.ts +57 -27
- package/lib/mjs/components/_classes/component/Component.js +191 -118
- package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.d.ts +8 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.js +31 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +28 -11
- package/lib/mjs/components/_classes/nested/NestedComponent.js +88 -57
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.d.ts +4 -3
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +18 -5
- package/lib/mjs/components/builder.js +0 -2
- package/lib/mjs/components/button/Button.js +2 -1
- package/lib/mjs/components/columns/Columns.d.ts +1 -0
- package/lib/mjs/components/columns/Columns.js +2 -3
- package/lib/mjs/components/columns/editForm/Columns.edit.display.d.ts +30 -1
- package/lib/mjs/components/columns/editForm/Columns.edit.display.js +23 -1
- package/lib/mjs/components/container/Container.d.ts +1 -0
- package/lib/mjs/components/container/Container.js +2 -6
- package/lib/mjs/components/content/Content.d.ts +1 -0
- package/lib/mjs/components/content/Content.js +1 -0
- package/lib/mjs/components/datagrid/DataGrid.d.ts +0 -8
- package/lib/mjs/components/datagrid/DataGrid.js +9 -26
- package/lib/mjs/components/datamap/DataMap.js +2 -1
- package/lib/mjs/components/datetime/DateTime.js +0 -2
- package/lib/mjs/components/day/Day.js +2 -3
- package/lib/mjs/components/editgrid/EditGrid.d.ts +8 -4
- package/lib/mjs/components/editgrid/EditGrid.js +97 -76
- package/lib/mjs/components/email/Email.js +0 -1
- package/lib/mjs/components/file/File.js +1 -1
- package/lib/mjs/components/file/fixtures/comp3.d.ts +29 -0
- package/lib/mjs/components/file/fixtures/comp3.js +29 -0
- package/lib/mjs/components/form/Form.d.ts +2 -6
- package/lib/mjs/components/form/Form.js +45 -14
- package/lib/mjs/components/index.d.ts +0 -2
- package/lib/mjs/components/index.js +0 -2
- package/lib/mjs/components/number/Number.d.ts +1 -2
- package/lib/mjs/components/number/Number.js +4 -5
- package/lib/mjs/components/panel/Panel.d.ts +0 -1
- package/lib/mjs/components/panel/Panel.js +3 -9
- package/lib/mjs/components/panel/editForm/Panel.edit.display.d.ts +6 -38
- package/lib/mjs/components/panel/editForm/Panel.edit.display.js +3 -16
- package/lib/mjs/components/phonenumber/PhoneNumber.js +17 -0
- package/lib/mjs/components/radio/Radio.js +0 -2
- package/lib/mjs/components/recaptcha/ReCaptcha.d.ts +1 -1
- package/lib/mjs/components/recaptcha/ReCaptcha.js +2 -2
- package/lib/mjs/components/select/Select.js +3 -2
- package/lib/mjs/components/selectboxes/SelectBoxes.d.ts +1 -2
- package/lib/mjs/components/selectboxes/SelectBoxes.js +7 -6
- package/lib/mjs/components/table/editForm/Table.edit.display.d.ts +31 -2
- package/lib/mjs/components/table/editForm/Table.edit.display.js +22 -0
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.d.ts +30 -2
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +22 -0
- package/lib/mjs/components/textfield/TextField.js +20 -6
- package/lib/mjs/components/time/Time.js +0 -6
- package/lib/mjs/components/url/Url.js +0 -1
- package/lib/mjs/components/well/editForm/Well.edit.display.d.ts +25 -2
- package/lib/mjs/components/well/editForm/Well.edit.display.js +18 -0
- package/lib/mjs/formio.embed.js +5 -3
- package/lib/mjs/formio.form.d.ts +1 -7
- package/lib/mjs/formio.form.js +3 -32
- package/lib/mjs/index.d.ts +2 -1
- package/lib/mjs/index.js +2 -1
- package/lib/mjs/providers/Providers.d.ts +0 -4
- package/lib/mjs/providers/storage/azure.d.ts +0 -2
- package/lib/mjs/providers/storage/azure.js +1 -6
- package/lib/mjs/providers/storage/googleDrive.d.ts +0 -1
- package/lib/mjs/providers/storage/googleDrive.js +0 -4
- package/lib/mjs/providers/storage/s3.d.ts +0 -1
- package/lib/mjs/providers/storage/s3.js +0 -4
- package/lib/mjs/templates/Templates.d.ts +1 -11
- package/lib/mjs/templates/Templates.js +4 -40
- package/lib/mjs/translations/en.d.ts +5 -0
- package/lib/mjs/translations/en.js +5 -0
- package/lib/mjs/utils/formUtils.js +1 -0
- package/lib/mjs/utils/index.d.ts +1 -0
- package/lib/mjs/utils/index.js +1 -0
- package/lib/mjs/utils/utils.d.ts +2 -1
- package/lib/mjs/utils/utils.js +24 -7
- package/package.json +13 -13
- package/lib/cjs/components/tree/Node.d.ts +0 -55
- package/lib/cjs/components/tree/Node.js +0 -185
- package/lib/cjs/components/tree/Tree.d.ts +0 -48
- package/lib/cjs/components/tree/Tree.form.d.ts +0 -3
- package/lib/cjs/components/tree/Tree.form.js +0 -21
- package/lib/cjs/components/tree/Tree.js +0 -383
- package/lib/cjs/components/tree/editForm/Tree.edit.data.d.ts +0 -5
- package/lib/cjs/components/tree/editForm/Tree.edit.data.js +0 -9
- package/lib/cjs/components/tree/editForm/Tree.edit.display.d.ts +0 -9
- package/lib/cjs/components/tree/editForm/Tree.edit.display.js +0 -12
- package/lib/cjs/components/tree/fixtures/comp1.d.ts +0 -23
- package/lib/cjs/components/tree/fixtures/comp1.js +0 -24
- package/lib/cjs/components/tree/fixtures/comp2.d.ts +0 -116
- package/lib/cjs/components/tree/fixtures/comp2.js +0 -82
- package/lib/cjs/components/tree/fixtures/comp3.d.ts +0 -24
- package/lib/cjs/components/tree/fixtures/comp3.js +0 -25
- package/lib/cjs/components/tree/fixtures/comp4.d.ts +0 -42
- package/lib/cjs/components/tree/fixtures/comp4.js +0 -47
- package/lib/cjs/components/tree/fixtures/index.d.ts +0 -5
- package/lib/cjs/components/tree/fixtures/index.js +0 -14
- package/lib/cjs/validator/Rules.d.ts +0 -53
- package/lib/cjs/validator/Rules.js +0 -22
- package/lib/cjs/validator/Validator.d.ts +0 -228
- package/lib/cjs/validator/Validator.js +0 -1113
- package/lib/cjs/validator/conjunctions/index.d.ts +0 -7
- package/lib/cjs/validator/conjunctions/index.js +0 -18
- package/lib/cjs/validator/operators/index.d.ts +0 -7
- package/lib/cjs/validator/operators/index.js +0 -18
- package/lib/cjs/validator/quickRules/index.d.ts +0 -7
- package/lib/cjs/validator/quickRules/index.js +0 -18
- package/lib/cjs/validator/rules/Custom.d.ts +0 -5
- package/lib/cjs/validator/rules/Custom.js +0 -30
- package/lib/cjs/validator/rules/Date.d.ts +0 -5
- package/lib/cjs/validator/rules/Date.js +0 -25
- package/lib/cjs/validator/rules/Day.d.ts +0 -5
- package/lib/cjs/validator/rules/Day.js +0 -58
- package/lib/cjs/validator/rules/Email.d.ts +0 -5
- package/lib/cjs/validator/rules/Email.js +0 -24
- package/lib/cjs/validator/rules/JSON.d.ts +0 -5
- package/lib/cjs/validator/rules/JSON.js +0 -29
- package/lib/cjs/validator/rules/Mask.d.ts +0 -5
- package/lib/cjs/validator/rules/Mask.js +0 -32
- package/lib/cjs/validator/rules/Max.d.ts +0 -5
- package/lib/cjs/validator/rules/Max.js +0 -21
- package/lib/cjs/validator/rules/MaxDate.d.ts +0 -5
- package/lib/cjs/validator/rules/MaxDate.js +0 -34
- package/lib/cjs/validator/rules/MaxLength.d.ts +0 -5
- package/lib/cjs/validator/rules/MaxLength.js +0 -20
- package/lib/cjs/validator/rules/MaxWords.d.ts +0 -5
- package/lib/cjs/validator/rules/MaxWords.js +0 -20
- package/lib/cjs/validator/rules/MaxYear.d.ts +0 -5
- package/lib/cjs/validator/rules/MaxYear.js +0 -22
- package/lib/cjs/validator/rules/Min.d.ts +0 -5
- package/lib/cjs/validator/rules/Min.js +0 -21
- package/lib/cjs/validator/rules/MinDate.d.ts +0 -5
- package/lib/cjs/validator/rules/MinDate.js +0 -30
- package/lib/cjs/validator/rules/MinLength.d.ts +0 -5
- package/lib/cjs/validator/rules/MinLength.js +0 -20
- package/lib/cjs/validator/rules/MinWords.d.ts +0 -5
- package/lib/cjs/validator/rules/MinWords.js +0 -20
- package/lib/cjs/validator/rules/MinYear.d.ts +0 -5
- package/lib/cjs/validator/rules/MinYear.js +0 -22
- package/lib/cjs/validator/rules/Pattern.d.ts +0 -5
- package/lib/cjs/validator/rules/Pattern.js +0 -20
- package/lib/cjs/validator/rules/Required.d.ts +0 -5
- package/lib/cjs/validator/rules/Required.js +0 -17
- package/lib/cjs/validator/rules/Rule.d.ts +0 -7
- package/lib/cjs/validator/rules/Rule.js +0 -12
- package/lib/cjs/validator/rules/Select.d.ts +0 -5
- package/lib/cjs/validator/rules/Select.js +0 -95
- package/lib/cjs/validator/rules/Time.d.ts +0 -5
- package/lib/cjs/validator/rules/Time.js +0 -19
- package/lib/cjs/validator/rules/Unique.d.ts +0 -5
- package/lib/cjs/validator/rules/Unique.js +0 -69
- package/lib/cjs/validator/rules/Url.d.ts +0 -5
- package/lib/cjs/validator/rules/Url.js +0 -23
- package/lib/cjs/validator/rules/index.d.ts +0 -47
- package/lib/cjs/validator/rules/index.js +0 -51
- package/lib/cjs/validator/transformers/index.d.ts +0 -7
- package/lib/cjs/validator/transformers/index.js +0 -18
- package/lib/cjs/validator/valueSources/index.d.ts +0 -7
- package/lib/cjs/validator/valueSources/index.js +0 -18
- package/lib/mjs/components/tree/Node.d.ts +0 -55
- package/lib/mjs/components/tree/Node.js +0 -179
- package/lib/mjs/components/tree/Tree.d.ts +0 -48
- package/lib/mjs/components/tree/Tree.form.d.ts +0 -3
- package/lib/mjs/components/tree/Tree.form.js +0 -15
- package/lib/mjs/components/tree/Tree.js +0 -384
- package/lib/mjs/components/tree/editForm/Tree.edit.data.d.ts +0 -5
- package/lib/mjs/components/tree/editForm/Tree.edit.data.js +0 -7
- package/lib/mjs/components/tree/editForm/Tree.edit.display.d.ts +0 -9
- package/lib/mjs/components/tree/editForm/Tree.edit.display.js +0 -10
- package/lib/mjs/components/tree/fixtures/comp1.d.ts +0 -23
- package/lib/mjs/components/tree/fixtures/comp1.js +0 -22
- package/lib/mjs/components/tree/fixtures/comp2.d.ts +0 -116
- package/lib/mjs/components/tree/fixtures/comp2.js +0 -80
- package/lib/mjs/components/tree/fixtures/comp3.d.ts +0 -24
- package/lib/mjs/components/tree/fixtures/comp3.js +0 -23
- package/lib/mjs/components/tree/fixtures/comp4.d.ts +0 -42
- package/lib/mjs/components/tree/fixtures/comp4.js +0 -45
- package/lib/mjs/components/tree/fixtures/index.d.ts +0 -5
- package/lib/mjs/components/tree/fixtures/index.js +0 -5
- package/lib/mjs/validator/Rules.d.ts +0 -53
- package/lib/mjs/validator/Rules.js +0 -17
- package/lib/mjs/validator/Validator.d.ts +0 -228
- package/lib/mjs/validator/Validator.js +0 -1103
- package/lib/mjs/validator/conjunctions/index.d.ts +0 -7
- package/lib/mjs/validator/conjunctions/index.js +0 -16
- package/lib/mjs/validator/operators/index.d.ts +0 -7
- package/lib/mjs/validator/operators/index.js +0 -16
- package/lib/mjs/validator/quickRules/index.d.ts +0 -7
- package/lib/mjs/validator/quickRules/index.js +0 -16
- package/lib/mjs/validator/rules/Custom.d.ts +0 -5
- package/lib/mjs/validator/rules/Custom.js +0 -21
- package/lib/mjs/validator/rules/Date.d.ts +0 -5
- package/lib/mjs/validator/rules/Date.js +0 -16
- package/lib/mjs/validator/rules/Day.d.ts +0 -5
- package/lib/mjs/validator/rules/Day.js +0 -49
- package/lib/mjs/validator/rules/Email.d.ts +0 -5
- package/lib/mjs/validator/rules/Email.js +0 -15
- package/lib/mjs/validator/rules/JSON.d.ts +0 -5
- package/lib/mjs/validator/rules/JSON.js +0 -20
- package/lib/mjs/validator/rules/Mask.d.ts +0 -5
- package/lib/mjs/validator/rules/Mask.js +0 -23
- package/lib/mjs/validator/rules/Max.d.ts +0 -5
- package/lib/mjs/validator/rules/Max.js +0 -12
- package/lib/mjs/validator/rules/MaxDate.d.ts +0 -5
- package/lib/mjs/validator/rules/MaxDate.js +0 -25
- package/lib/mjs/validator/rules/MaxLength.d.ts +0 -5
- package/lib/mjs/validator/rules/MaxLength.js +0 -11
- package/lib/mjs/validator/rules/MaxWords.d.ts +0 -5
- package/lib/mjs/validator/rules/MaxWords.js +0 -11
- package/lib/mjs/validator/rules/MaxYear.d.ts +0 -5
- package/lib/mjs/validator/rules/MaxYear.js +0 -13
- package/lib/mjs/validator/rules/Min.d.ts +0 -5
- package/lib/mjs/validator/rules/Min.js +0 -12
- package/lib/mjs/validator/rules/MinDate.d.ts +0 -5
- package/lib/mjs/validator/rules/MinDate.js +0 -21
- package/lib/mjs/validator/rules/MinLength.d.ts +0 -5
- package/lib/mjs/validator/rules/MinLength.js +0 -11
- package/lib/mjs/validator/rules/MinWords.d.ts +0 -5
- package/lib/mjs/validator/rules/MinWords.js +0 -11
- package/lib/mjs/validator/rules/MinYear.d.ts +0 -5
- package/lib/mjs/validator/rules/MinYear.js +0 -13
- package/lib/mjs/validator/rules/Pattern.d.ts +0 -5
- package/lib/mjs/validator/rules/Pattern.js +0 -11
- package/lib/mjs/validator/rules/Required.d.ts +0 -5
- package/lib/mjs/validator/rules/Required.js +0 -8
- package/lib/mjs/validator/rules/Rule.d.ts +0 -7
- package/lib/mjs/validator/rules/Rule.js +0 -9
- package/lib/mjs/validator/rules/Select.d.ts +0 -5
- package/lib/mjs/validator/rules/Select.js +0 -86
- package/lib/mjs/validator/rules/Time.d.ts +0 -5
- package/lib/mjs/validator/rules/Time.js +0 -10
- package/lib/mjs/validator/rules/Unique.d.ts +0 -5
- package/lib/mjs/validator/rules/Unique.js +0 -60
- package/lib/mjs/validator/rules/Url.d.ts +0 -5
- package/lib/mjs/validator/rules/Url.js +0 -14
- package/lib/mjs/validator/rules/index.d.ts +0 -47
- package/lib/mjs/validator/rules/index.js +0 -46
- package/lib/mjs/validator/transformers/index.d.ts +0 -7
- package/lib/mjs/validator/transformers/index.js +0 -16
- package/lib/mjs/validator/valueSources/index.d.ts +0 -7
- package/lib/mjs/validator/valueSources/index.js +0 -16
package/lib/mjs/Embed.js
CHANGED
@@ -1,17 +1,48 @@
|
|
1
1
|
import CDN from './CDN.js';
|
2
2
|
class Formio {
|
3
|
+
static FormioClass = null;
|
3
4
|
static baseUrl;
|
4
5
|
static projectUrl;
|
6
|
+
static pathType;
|
5
7
|
static language;
|
6
8
|
static config = {};
|
7
|
-
static cdn =
|
8
|
-
static
|
9
|
+
static cdn = new CDN();
|
10
|
+
static modules = [];
|
11
|
+
static icons = '';
|
12
|
+
static formioReady = new Promise((ready, reject) => {
|
13
|
+
Formio._formioReady = ready;
|
14
|
+
Formio._formioReadyReject = reject;
|
15
|
+
});
|
9
16
|
static version = 'FORMIO_VERSION';
|
10
|
-
static
|
17
|
+
static setBaseUrl(url, norecurse) {
|
11
18
|
Formio.baseUrl = url;
|
19
|
+
if (!norecurse && Formio.FormioClass) {
|
20
|
+
Formio.FormioClass.setBaseUrl(url);
|
21
|
+
}
|
12
22
|
}
|
13
|
-
static
|
23
|
+
static setApiUrl(url, norecurse) {
|
24
|
+
Formio.baseUrl = url;
|
25
|
+
if (!norecurse && Formio.FormioClass) {
|
26
|
+
Formio.FormioClass.setApiUrl(url);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
static setProjectUrl(url, norecurse) {
|
14
30
|
Formio.projectUrl = url;
|
31
|
+
if (!norecurse && Formio.FormioClass) {
|
32
|
+
Formio.FormioClass.setProjectUrl(url);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
static setAppUrl(url, norecurse) {
|
36
|
+
Formio.projectUrl = url;
|
37
|
+
if (!norecurse && Formio.FormioClass) {
|
38
|
+
Formio.FormioClass.setAppUrl(url);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
static setPathType(type, norecurse) {
|
42
|
+
Formio.pathType = type;
|
43
|
+
if (!norecurse && Formio.FormioClass) {
|
44
|
+
Formio.FormioClass.setPathType(type);
|
45
|
+
}
|
15
46
|
}
|
16
47
|
static debug(...args) {
|
17
48
|
if (Formio.config.debug) {
|
@@ -23,14 +54,22 @@ class Formio {
|
|
23
54
|
Formio.FormioClass.clearCache();
|
24
55
|
}
|
25
56
|
}
|
26
|
-
static global(prop) {
|
57
|
+
static global(prop, flag = '') {
|
27
58
|
const globalValue = window[prop];
|
28
|
-
if (globalValue && globalValue
|
59
|
+
if (flag && globalValue && !globalValue[flag]) {
|
29
60
|
return null;
|
30
61
|
}
|
31
62
|
Formio.debug(`Getting global ${prop}`, globalValue);
|
32
63
|
return globalValue;
|
33
64
|
}
|
65
|
+
static use(module) {
|
66
|
+
if (Formio.FormioClass && Formio.FormioClass.isRenderer) {
|
67
|
+
Formio.FormioClass.use(module);
|
68
|
+
}
|
69
|
+
else {
|
70
|
+
Formio.modules.push(module);
|
71
|
+
}
|
72
|
+
}
|
34
73
|
static createElement(type, attrs, children) {
|
35
74
|
const element = document.createElement(type);
|
36
75
|
Object.keys(attrs).forEach(key => {
|
@@ -41,14 +80,14 @@ class Formio {
|
|
41
80
|
});
|
42
81
|
return element;
|
43
82
|
}
|
44
|
-
static async addScript(wrapper, src, name) {
|
83
|
+
static async addScript(wrapper, src, name, flag = '') {
|
45
84
|
if (!src) {
|
46
85
|
return Promise.resolve();
|
47
86
|
}
|
48
87
|
if (typeof src !== 'string' && src.length) {
|
49
88
|
return Promise.all(src.map(ref => Formio.addScript(wrapper, ref)));
|
50
89
|
}
|
51
|
-
if (name && Formio.global(name)) {
|
90
|
+
if (name && Formio.global(name, flag)) {
|
52
91
|
Formio.debug(`${name} already loaded.`);
|
53
92
|
return Promise.resolve(Formio.global(name));
|
54
93
|
}
|
@@ -62,7 +101,7 @@ class Formio {
|
|
62
101
|
return new Promise((resolve) => {
|
63
102
|
Formio.debug(`Waiting to load ${name}`);
|
64
103
|
const wait = setInterval(() => {
|
65
|
-
if (Formio.global(name)) {
|
104
|
+
if (Formio.global(name, flag)) {
|
66
105
|
clearInterval(wait);
|
67
106
|
Formio.debug(`${name} loaded.`);
|
68
107
|
resolve(Formio.global(name));
|
@@ -125,8 +164,8 @@ class Formio {
|
|
125
164
|
return script;
|
126
165
|
}
|
127
166
|
// eslint-disable-next-line max-statements
|
128
|
-
static async init(element, builder = false) {
|
129
|
-
Formio.cdn = new CDN(Formio.config.cdn);
|
167
|
+
static async init(element, options = {}, builder = false) {
|
168
|
+
Formio.cdn = new CDN(Formio.config.cdn, Formio.config.cdnUrls || {});
|
130
169
|
Formio.config.libs = Formio.config.libs || {
|
131
170
|
uswds: {
|
132
171
|
fa: true,
|
@@ -142,10 +181,17 @@ class Formio {
|
|
142
181
|
};
|
143
182
|
const id = Formio.config.id || `formio-${Math.random().toString(36).substring(7)}`;
|
144
183
|
// Create a new wrapper and add the element inside of a new wrapper.
|
145
|
-
|
184
|
+
let wrapper = Formio.createElement('div', {
|
146
185
|
'id': `"${id}-wrapper"`
|
147
186
|
});
|
148
187
|
element.parentNode.insertBefore(wrapper, element);
|
188
|
+
// If we include the libraries, then we will attempt to run this in shadow dom.
|
189
|
+
if (Formio.config.includeLibs && (typeof wrapper.attachShadow === 'function') && !Formio.config.premium) {
|
190
|
+
wrapper = wrapper.attachShadow({
|
191
|
+
mode: 'open'
|
192
|
+
});
|
193
|
+
options.shadowRoot = wrapper;
|
194
|
+
}
|
149
195
|
element.parentNode.removeChild(element);
|
150
196
|
wrapper.appendChild(element);
|
151
197
|
// Load the renderer styles.
|
@@ -165,10 +211,20 @@ class Formio {
|
|
165
211
|
}
|
166
212
|
}]
|
167
213
|
}]));
|
168
|
-
|
169
|
-
Formio.FormioClass.
|
170
|
-
Formio.FormioClass.
|
214
|
+
const renderer = Formio.config.debug ? 'formio.form' : 'formio.form.min';
|
215
|
+
Formio.FormioClass = await Formio.addScript(wrapper, Formio.formioScript(Formio.config.script || `${Formio.cdn.js}/${renderer}.js`, builder), 'Formio', builder ? 'isBuilder' : 'isRenderer');
|
216
|
+
Formio.FormioClass.setBaseUrl(options.baseUrl || Formio.baseUrl || Formio.config.base);
|
217
|
+
Formio.FormioClass.setProjectUrl(options.projectUrl || Formio.projectUrl || Formio.config.project);
|
171
218
|
Formio.FormioClass.language = Formio.language;
|
219
|
+
Formio.modules.forEach((module) => {
|
220
|
+
Formio.FormioClass.use(module);
|
221
|
+
});
|
222
|
+
if (Formio.icons) {
|
223
|
+
Formio.FormioClass.icons = Formio.icons;
|
224
|
+
}
|
225
|
+
if (Formio.pathType) {
|
226
|
+
Formio.FormioClass.setPathType(Formio.pathType);
|
227
|
+
}
|
172
228
|
// Add premium modules
|
173
229
|
if (Formio.global('premium')) {
|
174
230
|
Formio.debug('Using premium module.');
|
@@ -207,15 +263,16 @@ class Formio {
|
|
207
263
|
Formio.debug('Using premium');
|
208
264
|
Formio.FormioClass.use(await Formio.addScript(wrapper, Formio.config.premium.js, 'premium'));
|
209
265
|
}
|
210
|
-
await Formio.addStyles(wrapper, Formio.formioScript(Formio.config.style || `${Formio.cdn.js}
|
266
|
+
await Formio.addStyles(wrapper, Formio.formioScript(Formio.config.style || `${Formio.cdn.js}/${renderer}.css`, builder));
|
211
267
|
if (Formio.config.before) {
|
212
268
|
await Formio.config.before(Formio.FormioClass, element, Formio.config);
|
213
269
|
}
|
214
270
|
Formio.FormioClass.license = true;
|
271
|
+
Formio._formioReady(Formio.FormioClass);
|
215
272
|
return wrapper;
|
216
273
|
}
|
217
274
|
static async createForm(element, form, options) {
|
218
|
-
const wrapper = await Formio.init(element);
|
275
|
+
const wrapper = await Formio.init(element, options);
|
219
276
|
return Formio.FormioClass.createForm(element, form, {
|
220
277
|
...options,
|
221
278
|
...{ noLoader: true }
|
@@ -241,7 +298,7 @@ class Formio {
|
|
241
298
|
});
|
242
299
|
}
|
243
300
|
static async builder(element, form, options) {
|
244
|
-
const wrapper = await Formio.init(element, true);
|
301
|
+
const wrapper = await Formio.init(element, options, true);
|
245
302
|
return Formio.FormioClass.builder(element, form, options).then((instance) => {
|
246
303
|
Formio.debug('Builder created', instance);
|
247
304
|
Formio.debug('Removing loader');
|
package/lib/mjs/Formio.d.ts
CHANGED
package/lib/mjs/Formio.js
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
import { Formio } from '@formio/core';
|
1
|
+
import { Formio } from '@formio/core/sdk';
|
2
|
+
import { Formio as FormioEmbed } from './Embed';
|
2
3
|
import CDN from './CDN';
|
3
4
|
import Providers from './providers';
|
4
5
|
Formio.cdn = new CDN();
|
5
6
|
Formio.Providers = Providers;
|
6
7
|
Formio.version = 'FORMIO_VERSION';
|
7
8
|
const isNil = (val) => val === null || val === undefined;
|
8
|
-
Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback) {
|
9
|
+
Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, uploadStartCallback, abortCallback, multipartOptions) {
|
9
10
|
const requestArgs = {
|
10
11
|
provider: storage,
|
11
12
|
method: 'upload',
|
@@ -25,7 +26,7 @@ Formio.prototype.uploadFile = function (storage, file, fileName, dir, progressCa
|
|
25
26
|
if (uploadStartCallback) {
|
26
27
|
uploadStartCallback();
|
27
28
|
}
|
28
|
-
return provider.uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback);
|
29
|
+
return provider.uploadFile(file, fileName, dir, progressCallback, url, options, fileKey, groupPermissions, groupId, abortCallback, multipartOptions);
|
29
30
|
}
|
30
31
|
else {
|
31
32
|
throw ('Storage provider not found');
|
@@ -86,4 +87,11 @@ Formio.prototype.deleteFile = function (file, options) {
|
|
86
87
|
};
|
87
88
|
// For reverse compatability.
|
88
89
|
Formio.Promise = Promise;
|
90
|
+
Formio.formioReady = FormioEmbed.formioReady;
|
91
|
+
Formio.config = FormioEmbed.config;
|
92
|
+
Formio.builder = FormioEmbed.builder;
|
93
|
+
Formio.Form = FormioEmbed.Form;
|
94
|
+
Formio.FormBuilder = FormioEmbed.FormBuilder;
|
95
|
+
Formio.use = FormioEmbed.use;
|
96
|
+
Formio.createForm = FormioEmbed.createForm;
|
89
97
|
export { Formio };
|
package/lib/mjs/PDF.js
CHANGED
@@ -235,7 +235,7 @@ export default class PDF extends Webform {
|
|
235
235
|
const helpBlock = document.getElementById('submit-error');
|
236
236
|
const submitError = this.t('submitError');
|
237
237
|
const isSubmitErrorShown = this.refs.buttonMessage?.textContent.trim() === submitError;
|
238
|
-
if (!helpBlock &&
|
238
|
+
if (!helpBlock && error.length && !isSubmitErrorShown) {
|
239
239
|
const p = this.ce('p', { class: 'help-block' });
|
240
240
|
this.setContent(p, submitError);
|
241
241
|
p.addEventListener('click', () => {
|
@@ -245,7 +245,7 @@ export default class PDF extends Webform {
|
|
245
245
|
this.appendTo(p, div);
|
246
246
|
this.appendTo(div, this.element);
|
247
247
|
}
|
248
|
-
if (!
|
248
|
+
if (!error.length && helpBlock) {
|
249
249
|
helpBlock.remove();
|
250
250
|
}
|
251
251
|
super.showErrors(error, triggerEvent);
|
package/lib/mjs/Webform.d.ts
CHANGED
@@ -20,7 +20,6 @@ declare class Webform extends NestedDataComponent {
|
|
20
20
|
draftEnabled: boolean;
|
21
21
|
savingDraft: boolean;
|
22
22
|
triggerSaveDraft: any;
|
23
|
-
customErrors: any[];
|
24
23
|
set nosubmit(arg: any);
|
25
24
|
get nosubmit(): any;
|
26
25
|
/**
|
@@ -327,7 +326,7 @@ declare class Webform extends NestedDataComponent {
|
|
327
326
|
* @param {Object} error - An optional additional error to display along with the component errors.
|
328
327
|
* @returns {*}
|
329
328
|
*/
|
330
|
-
showErrors(
|
329
|
+
showErrors(errors: any, triggerEvent: any, onChange: any): any;
|
331
330
|
/**
|
332
331
|
* Called when the submission has completed, or if the submission needs to be sent to an external library.
|
333
332
|
*
|
@@ -342,7 +341,7 @@ declare class Webform extends NestedDataComponent {
|
|
342
341
|
*
|
343
342
|
* @param {Object} error - The error that occured.
|
344
343
|
*/
|
345
|
-
onSubmissionError(error: Object):
|
344
|
+
onSubmissionError(error: Object): false | undefined;
|
346
345
|
/**
|
347
346
|
* Trigger the change event for this form.
|
348
347
|
*
|
@@ -350,7 +349,6 @@ declare class Webform extends NestedDataComponent {
|
|
350
349
|
* @param flags
|
351
350
|
*/
|
352
351
|
onChange(flags: any, changed: any, modified: any, changes: any): void;
|
353
|
-
checkData(data: any, flags?: {}): any;
|
354
352
|
/**
|
355
353
|
* Send a delete request to the server.
|
356
354
|
*/
|
@@ -388,7 +386,7 @@ declare class Webform extends NestedDataComponent {
|
|
388
386
|
*
|
389
387
|
* @returns {Promise} - A promise when the form is done submitting.
|
390
388
|
*/
|
391
|
-
submit(before: boolean, options
|
389
|
+
submit(before: boolean, options?: {}): Promise<any>;
|
392
390
|
submitUrl(URL: any, headers: any): void;
|
393
391
|
triggerRecaptcha(): void;
|
394
392
|
_nosubmit: any;
|
@@ -396,10 +394,9 @@ declare class Webform extends NestedDataComponent {
|
|
396
394
|
get variables(): any;
|
397
395
|
}
|
398
396
|
declare namespace Webform {
|
399
|
-
const setBaseUrl:
|
400
|
-
const setApiUrl:
|
401
|
-
const setAppUrl:
|
397
|
+
const setBaseUrl: any;
|
398
|
+
const setApiUrl: any;
|
399
|
+
const setAppUrl: any;
|
402
400
|
}
|
403
401
|
export default Webform;
|
404
402
|
import NestedDataComponent from './components/_classes/nesteddata/NestedDataComponent';
|
405
|
-
import { Formio } from './Formio';
|
package/lib/mjs/Webform.js
CHANGED
@@ -6,7 +6,7 @@ import i18nDefaults from './i18n';
|
|
6
6
|
import { Formio } from './Formio';
|
7
7
|
import Components from './components/Components';
|
8
8
|
import NestedDataComponent from './components/_classes/nesteddata/NestedDataComponent';
|
9
|
-
import { fastCloneDeep, currentTimezone, unescapeHTML, getStringFromComponentPath, searchComponents, convertStringToHTMLElement, getArrayFromComponentPath } from './utils/utils';
|
9
|
+
import { fastCloneDeep, currentTimezone, unescapeHTML, getStringFromComponentPath, searchComponents, convertStringToHTMLElement, getArrayFromComponentPath, interpolateErrors } from './utils/utils';
|
10
10
|
import { eachComponent } from './utils/formUtils';
|
11
11
|
// Initialize the available forms.
|
12
12
|
Formio.forms = {};
|
@@ -83,7 +83,6 @@ export default class Webform extends NestedDataComponent {
|
|
83
83
|
else {
|
84
84
|
this.triggerSaveDraft = this.saveDraft.bind(this);
|
85
85
|
}
|
86
|
-
this.customErrors = [];
|
87
86
|
/**
|
88
87
|
* Determines if this form should submit the API on submit.
|
89
88
|
* @type {boolean}
|
@@ -779,9 +778,9 @@ export default class Webform extends NestedDataComponent {
|
|
779
778
|
this.component.input = false;
|
780
779
|
this.addComponents();
|
781
780
|
this.on('submitButton', options => {
|
782
|
-
this.submit(false, options).catch(e => e !== false && console.log(e));
|
781
|
+
this.submit(false, options).catch(e => e !== false && e !== undefined && console.log(e));
|
783
782
|
}, true);
|
784
|
-
this.on('checkValidity', (data) => this.
|
783
|
+
this.on('checkValidity', (data) => this.validate(data, { dirty: true, process: 'change' }), true);
|
785
784
|
this.on('requestUrl', (args) => (this.submitUrl(args.url, args.headers)), true);
|
786
785
|
this.on('resetForm', () => this.resetValue(), true);
|
787
786
|
this.on('deleteSubmission', () => this.deleteSubmission(), true);
|
@@ -975,21 +974,14 @@ export default class Webform extends NestedDataComponent {
|
|
975
974
|
* @returns {*}
|
976
975
|
*/
|
977
976
|
/* eslint-disable no-unused-vars */
|
978
|
-
showErrors(
|
979
|
-
|
980
|
-
|
981
|
-
if (error) {
|
982
|
-
if (Array.isArray(error)) {
|
983
|
-
errors = errors.concat(error);
|
984
|
-
}
|
985
|
-
else {
|
986
|
-
errors.push(error);
|
987
|
-
}
|
977
|
+
showErrors(errors, triggerEvent, onChange) {
|
978
|
+
if (!errors) {
|
979
|
+
return;
|
988
980
|
}
|
989
|
-
|
990
|
-
|
981
|
+
this.loading = false;
|
982
|
+
if (!Array.isArray(errors)) {
|
983
|
+
errors = [errors];
|
991
984
|
}
|
992
|
-
errors = errors.concat(this.customErrors);
|
993
985
|
errors = errors.concat(this.serverErrors || []);
|
994
986
|
if (!errors.length) {
|
995
987
|
this.setAlert(false);
|
@@ -1005,7 +997,7 @@ export default class Webform extends NestedDataComponent {
|
|
1005
997
|
components.push(err.path);
|
1006
998
|
}
|
1007
999
|
components.forEach((path) => {
|
1008
|
-
const originalPath =
|
1000
|
+
const originalPath = getStringFromComponentPath(path);
|
1009
1001
|
const component = this.getComponent(path, _.identity, originalPath);
|
1010
1002
|
if (err.fromServer) {
|
1011
1003
|
if (component.serverErrors) {
|
@@ -1020,42 +1012,31 @@ export default class Webform extends NestedDataComponent {
|
|
1020
1012
|
});
|
1021
1013
|
});
|
1022
1014
|
const displayedErrors = [];
|
1023
|
-
errors.
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
};
|
1015
|
+
if (errors.length) {
|
1016
|
+
errors = _.uniqBy(errors, error => error.message);
|
1017
|
+
const createListItem = (message, index) => {
|
1018
|
+
const err = errors[index];
|
1019
|
+
const messageFromIndex = !_.isUndefined(index) && errors && errors[index];
|
1020
|
+
const keyOrPath = (messageFromIndex?.formattedKeyOrPath || messageFromIndex?.path || messageFromIndex?.context?.path) || (err.context?.component && err.context?.component.key) || (err.component && err.component.key) || err.fromServer && err.path;
|
1021
|
+
const formattedKeyOrPath = keyOrPath ? getStringFromComponentPath(keyOrPath) : '';
|
1022
|
+
if (typeof err !== 'string' && !err.formattedKeyOrPath) {
|
1023
|
+
err.formattedKeyOrPath = formattedKeyOrPath;
|
1024
|
+
}
|
1025
|
+
return {
|
1026
|
+
message: unescapeHTML(message),
|
1027
|
+
keyOrPath: formattedKeyOrPath
|
1037
1028
|
};
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
label: this.t(component.label),
|
1046
|
-
message: this.t(message),
|
1047
|
-
});
|
1048
|
-
displayedErrors.push(createListItem(text, index));
|
1029
|
+
};
|
1030
|
+
errors.forEach(({ message, context, fromServer, component }, index) => {
|
1031
|
+
const text = !component?.label || context?.hasLabel || fromServer
|
1032
|
+
? this.t('alertMessage', { message: this.t(message) })
|
1033
|
+
: this.t('alertMessageWithLabel', {
|
1034
|
+
label: this.t(component?.label),
|
1035
|
+
message: this.t(message),
|
1049
1036
|
});
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
? this.t('alertMessage', { message: this.t(err.message || '') })
|
1054
|
-
: this.t('alertMessage', { message: this.t(err) });
|
1055
|
-
displayedErrors.push(createListItem(message));
|
1056
|
-
}
|
1057
|
-
}
|
1058
|
-
});
|
1037
|
+
displayedErrors.push(createListItem(text, index));
|
1038
|
+
});
|
1039
|
+
}
|
1059
1040
|
const errorsList = this.renderTemplate('errorsList', { errors: displayedErrors });
|
1060
1041
|
this.root.setAlert('danger', errorsList);
|
1061
1042
|
if (triggerEvent) {
|
@@ -1117,17 +1098,10 @@ export default class Webform extends NestedDataComponent {
|
|
1117
1098
|
this.emit('change', { isValid: true }, { silent: true });
|
1118
1099
|
return false;
|
1119
1100
|
}
|
1120
|
-
|
1121
|
-
if (this.submitted) {
|
1122
|
-
errors = this.showErrors();
|
1123
|
-
}
|
1124
|
-
else {
|
1125
|
-
errors = this.showErrors(error, true);
|
1126
|
-
}
|
1101
|
+
this.showErrors(error, true);
|
1127
1102
|
if (this.root && this.root.alert) {
|
1128
1103
|
this.scrollIntoView(this.root.alert);
|
1129
1104
|
}
|
1130
|
-
return errors;
|
1131
1105
|
}
|
1132
1106
|
/**
|
1133
1107
|
* Trigger the change event for this form.
|
@@ -1138,10 +1112,6 @@ export default class Webform extends NestedDataComponent {
|
|
1138
1112
|
onChange(flags, changed, modified, changes) {
|
1139
1113
|
flags = flags || {};
|
1140
1114
|
let isChangeEventEmitted = false;
|
1141
|
-
// For any change events, clear any custom errors for that component.
|
1142
|
-
if (changed && changed.component) {
|
1143
|
-
this.customErrors = this.customErrors.filter(err => err.component && err.component !== changed.component.key);
|
1144
|
-
}
|
1145
1115
|
super.onChange(flags, true);
|
1146
1116
|
const value = _.clone(this.submission);
|
1147
1117
|
flags.changed = value.changed = changed;
|
@@ -1149,10 +1119,13 @@ export default class Webform extends NestedDataComponent {
|
|
1149
1119
|
if (modified && this.pristine) {
|
1150
1120
|
this.pristine = false;
|
1151
1121
|
}
|
1152
|
-
|
1122
|
+
this.checkData(value.data, flags);
|
1123
|
+
const shouldValidate = !flags.noValidate || flags.fromIFrame || (flags.fromSubmission && this.rootPristine && this.pristine && flags.changed);
|
1124
|
+
const errors = shouldValidate ? this.validate(value.data, { ...flags, process: 'change' }) : [];
|
1125
|
+
value.isValid = errors.length === 0;
|
1153
1126
|
this.loading = false;
|
1154
1127
|
if (this.submitted) {
|
1155
|
-
this.showErrors();
|
1128
|
+
this.showErrors(errors);
|
1156
1129
|
}
|
1157
1130
|
// See if we need to save the draft of the form.
|
1158
1131
|
if (modified && this.options.saveDraft) {
|
@@ -1168,13 +1141,6 @@ export default class Webform extends NestedDataComponent {
|
|
1168
1141
|
this.initialized = true;
|
1169
1142
|
}
|
1170
1143
|
}
|
1171
|
-
checkData(data, flags = {}) {
|
1172
|
-
const valid = super.checkData(data, flags);
|
1173
|
-
if ((_.isEmpty(flags) || flags.noValidate) && this.submitted) {
|
1174
|
-
this.showErrors();
|
1175
|
-
}
|
1176
|
-
return valid;
|
1177
|
-
}
|
1178
1144
|
/**
|
1179
1145
|
* Send a delete request to the server.
|
1180
1146
|
*/
|
@@ -1227,18 +1193,30 @@ export default class Webform extends NestedDataComponent {
|
|
1227
1193
|
}
|
1228
1194
|
const submission = fastCloneDeep(this.submission || {});
|
1229
1195
|
this.setMetadata(submission);
|
1230
|
-
submission.state = options.state || 'submitted';
|
1196
|
+
submission.state = options.state || submission.state || 'submitted';
|
1231
1197
|
const isDraft = (submission.state === 'draft');
|
1232
1198
|
this.hook('beforeSubmit', { ...submission, component: options.component }, (err, data) => {
|
1233
1199
|
if (err) {
|
1234
1200
|
return reject(err);
|
1235
1201
|
}
|
1236
1202
|
submission._vnote = data && data._vnote ? data._vnote : '';
|
1237
|
-
|
1238
|
-
|
1203
|
+
try {
|
1204
|
+
if (!isDraft && !options.noValidate) {
|
1205
|
+
if (!submission.data) {
|
1206
|
+
return reject('Invalid Submission');
|
1207
|
+
}
|
1208
|
+
const errors = this.validate(submission.data, {
|
1209
|
+
dirty: true,
|
1210
|
+
silentCheck: false,
|
1211
|
+
process: 'submit'
|
1212
|
+
});
|
1213
|
+
if (errors.length || options.beforeSubmitResults?.some((result) => result.status === 'rejected')) {
|
1214
|
+
return reject(errors);
|
1215
|
+
}
|
1216
|
+
}
|
1239
1217
|
}
|
1240
|
-
|
1241
|
-
|
1218
|
+
catch (err) {
|
1219
|
+
console.error(err);
|
1242
1220
|
}
|
1243
1221
|
this.everyComponent((comp) => {
|
1244
1222
|
if (submission._vnote && comp.type === 'form' && comp.component.reference) {
|
@@ -1259,9 +1237,7 @@ export default class Webform extends NestedDataComponent {
|
|
1259
1237
|
}
|
1260
1238
|
// Ensure err is an array.
|
1261
1239
|
err = Array.isArray(err) ? err : [err];
|
1262
|
-
|
1263
|
-
this.customErrors = err;
|
1264
|
-
return reject();
|
1240
|
+
return reject(err);
|
1265
1241
|
}
|
1266
1242
|
this.loading = true;
|
1267
1243
|
// Use the form action to submit the form if available.
|
@@ -1356,7 +1332,7 @@ export default class Webform extends NestedDataComponent {
|
|
1356
1332
|
*
|
1357
1333
|
* @returns {Promise} - A promise when the form is done submitting.
|
1358
1334
|
*/
|
1359
|
-
submit(before, options) {
|
1335
|
+
submit(before, options = {}) {
|
1360
1336
|
this.submissionInProcess = true;
|
1361
1337
|
if (!before) {
|
1362
1338
|
return this.beforeSubmit(options).then(() => this.executeSubmit(options));
|
@@ -73,7 +73,7 @@ export default class WebformBuilder extends Component {
|
|
73
73
|
setForm(form: any): any;
|
74
74
|
keyboardActionsEnabled: any;
|
75
75
|
populateRecaptchaSettings(form: any): void;
|
76
|
-
removeComponent(component: any, parent: any, original: any): boolean | undefined;
|
76
|
+
removeComponent(component: any, parent: any, original: any, componentInstance: any): boolean | undefined;
|
77
77
|
replaceDoubleQuotes(data: any, fieldsToRemoveDoubleQuotes?: any[]): any;
|
78
78
|
updateComponent(component: any, changed: any): void;
|
79
79
|
findRepeatablePaths(): any[];
|