@formio/js 5.0.0-rc.27 → 5.0.0-rc.28
Sign up to get free protection for your applications and to get access to all the features.
- 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 +710 -689
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +2 -2
- package/dist/formio.full.css +100 -3
- package/dist/formio.full.js +715 -727
- package/dist/formio.full.min.css +2 -2
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +2 -2
- package/dist/formio.js +659 -264
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +2 -2
- package/dist/formio.utils.js +29 -8
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +2 -2
- package/lib/cjs/Embed.d.ts +1 -1
- package/lib/cjs/Embed.js +14 -6
- package/lib/cjs/PDF.js +2 -2
- package/lib/cjs/Webform.d.ts +3 -5
- package/lib/cjs/Webform.js +59 -81
- package/lib/cjs/WebformBuilder.d.ts +1 -1
- package/lib/cjs/WebformBuilder.js +27 -10
- package/lib/cjs/Wizard.d.ts +2 -0
- 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 +2 -38
- package/lib/cjs/index.d.ts +2 -1
- package/lib/cjs/index.js +2 -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/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/utils.d.ts +2 -1
- package/lib/cjs/utils/utils.js +27 -9
- package/lib/mjs/Embed.d.ts +1 -1
- package/lib/mjs/Embed.js +14 -6
- package/lib/mjs/PDF.js +2 -2
- package/lib/mjs/Webform.d.ts +3 -5
- package/lib/mjs/Webform.js +58 -82
- package/lib/mjs/WebformBuilder.d.ts +1 -1
- package/lib/mjs/WebformBuilder.js +28 -7
- package/lib/mjs/Wizard.d.ts +2 -0
- 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 +2 -32
- package/lib/mjs/index.d.ts +2 -1
- package/lib/mjs/index.js +1 -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/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/utils.d.ts +2 -1
- package/lib/mjs/utils/utils.js +24 -7
- package/package.json +5 -5
- 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/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[];
|
@@ -347,7 +347,7 @@ export default class WebformBuilder extends Component {
|
|
347
347
|
}
|
348
348
|
if (component.refs.removeComponent) {
|
349
349
|
this.attachTooltip(component.refs.removeComponent, this.t('Remove'));
|
350
|
-
component.addEventListener(component.refs.removeComponent, 'click', () => this.removeComponent(component.schema, parent, component.component));
|
350
|
+
component.addEventListener(component.refs.removeComponent, 'click', () => this.removeComponent(component.schema, parent, component.component, component));
|
351
351
|
}
|
352
352
|
return element;
|
353
353
|
}
|
@@ -721,6 +721,10 @@ export default class WebformBuilder extends Component {
|
|
721
721
|
}
|
722
722
|
}
|
723
723
|
if (info) {
|
724
|
+
//if this is a custom component that was already assigned a key, don't stomp on it
|
725
|
+
if (!Components.components.hasOwnProperty(info.type) && info.key) {
|
726
|
+
return info;
|
727
|
+
}
|
724
728
|
info.key = this.generateKey(info);
|
725
729
|
}
|
726
730
|
return info;
|
@@ -924,7 +928,7 @@ export default class WebformBuilder extends Component {
|
|
924
928
|
}
|
925
929
|
}
|
926
930
|
}
|
927
|
-
removeComponent(component, parent, original) {
|
931
|
+
removeComponent(component, parent, original, componentInstance) {
|
928
932
|
if (!parent) {
|
929
933
|
return;
|
930
934
|
}
|
@@ -950,6 +954,9 @@ export default class WebformBuilder extends Component {
|
|
950
954
|
else if (parent.formioComponent && parent.formioComponent.removeChildComponent) {
|
951
955
|
parent.formioComponent.removeChildComponent(component);
|
952
956
|
}
|
957
|
+
if (component.input && componentInstance && componentInstance.parent) {
|
958
|
+
_.unset(componentInstance._data, componentInstance.key);
|
959
|
+
}
|
953
960
|
const rebuild = parent.formioComponent.rebuild() || Promise.resolve();
|
954
961
|
rebuild.then(() => {
|
955
962
|
this.emit('removeComponent', component, parent.formioComponent.schema, path, index);
|
@@ -1079,11 +1086,12 @@ export default class WebformBuilder extends Component {
|
|
1079
1086
|
let hasInvalidComponents = false;
|
1080
1087
|
this.webform.everyComponent((comp) => {
|
1081
1088
|
const path = comp.path;
|
1089
|
+
const errors = comp.visibleErrors || [];
|
1082
1090
|
if (repeatablePaths.includes(path)) {
|
1083
1091
|
comp.setCustomValidity(`API Key is not unique: ${comp.key}`);
|
1084
1092
|
hasInvalidComponents = true;
|
1085
1093
|
}
|
1086
|
-
else if (
|
1094
|
+
else if (errors.length && errors[0].message?.startsWith('API Key is not unique')) {
|
1087
1095
|
comp.setCustomValidity('');
|
1088
1096
|
}
|
1089
1097
|
});
|
@@ -1176,9 +1184,12 @@ export default class WebformBuilder extends Component {
|
|
1176
1184
|
saveButtons.forEach((saveButton) => {
|
1177
1185
|
this.editForm.addEventListener(saveButton, 'click', (event) => {
|
1178
1186
|
event.preventDefault();
|
1179
|
-
|
1187
|
+
const errors = this.editForm.validate(this.editForm.data, {
|
1188
|
+
dirty: true
|
1189
|
+
});
|
1190
|
+
if (errors.length) {
|
1180
1191
|
this.editForm.setPristine(false);
|
1181
|
-
this.editForm.showErrors();
|
1192
|
+
this.editForm.showErrors(errors);
|
1182
1193
|
return false;
|
1183
1194
|
}
|
1184
1195
|
this.saved = true;
|
@@ -1233,7 +1244,11 @@ export default class WebformBuilder extends Component {
|
|
1233
1244
|
this.editForm = new Webform({
|
1234
1245
|
..._.omit(this.options, ['hooks', 'builder', 'events', 'attachMode', 'skipInit']),
|
1235
1246
|
language: this.options.language,
|
1236
|
-
...editFormOptions
|
1247
|
+
...editFormOptions,
|
1248
|
+
evalContext: {
|
1249
|
+
...(editFormOptions?.evalContext || this.options?.evalContext || {}),
|
1250
|
+
buildingForm: this.form,
|
1251
|
+
},
|
1237
1252
|
});
|
1238
1253
|
this.hook('editFormProperties', parent);
|
1239
1254
|
this.editForm.form = (isJsonEdit && !isCustom) ? {
|
@@ -1339,8 +1354,14 @@ export default class WebformBuilder extends Component {
|
|
1339
1354
|
}
|
1340
1355
|
}
|
1341
1356
|
}
|
1357
|
+
// If the edit form has any nested form inside, we get a partial data (nested form's data) in the
|
1358
|
+
// event.data property
|
1359
|
+
let editFormData;
|
1360
|
+
if (event.changed.instance && event.changed.instance.root && event.changed.instance.root.id !== this.editForm.id) {
|
1361
|
+
editFormData = this.editForm.data;
|
1362
|
+
}
|
1342
1363
|
// Update the component.
|
1343
|
-
this.updateComponent(event.data.componentJson || event.data, event.changed);
|
1364
|
+
this.updateComponent(event.data.componentJson || editFormData || event.data, event.changed);
|
1344
1365
|
}
|
1345
1366
|
});
|
1346
1367
|
this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
|
package/lib/mjs/Wizard.d.ts
CHANGED
@@ -70,6 +70,7 @@ declare class Wizard extends Webform {
|
|
70
70
|
beforePage(next: any): Promise<any>;
|
71
71
|
emitNextPage(): void;
|
72
72
|
nextPage(): Promise<void>;
|
73
|
+
validateCurrentPage(flags?: {}): any;
|
73
74
|
emitPrevPage(): void;
|
74
75
|
prevPage(): Promise<void>;
|
75
76
|
cancel(noconfirm: any): Promise<void> | Promise<number>;
|
@@ -84,6 +85,7 @@ declare class Wizard extends Webform {
|
|
84
85
|
hasButton(name: any, nextPage?: number | null): any;
|
85
86
|
pageId(page: any): any;
|
86
87
|
onChange(flags: any, changed: any, modified: any, changes: any): void;
|
88
|
+
checkValidity(data: any, dirty: any, row: any, currentPageOnly: any, childErrors?: any[]): any;
|
87
89
|
focusOnComponent(key: any): any;
|
88
90
|
}
|
89
91
|
declare namespace Wizard {
|
package/lib/mjs/Wizard.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import _ from 'lodash';
|
2
2
|
import Webform from './Webform';
|
3
3
|
import { Formio } from './Formio';
|
4
|
-
import { fastCloneDeep, checkCondition, firstNonNil, uniqueKey, eachComponent } from './utils/utils';
|
4
|
+
import { fastCloneDeep, checkCondition, firstNonNil, uniqueKey, eachComponent, unescapeHTML } from './utils/utils';
|
5
5
|
export default class Wizard extends Webform {
|
6
6
|
/**
|
7
7
|
* Constructor for wizard based forms
|
@@ -172,7 +172,9 @@ export default class Wizard extends Webform {
|
|
172
172
|
return this.renderTemplate('wizardNav', ctx);
|
173
173
|
}
|
174
174
|
prepareHeaderSettings(ctx, headerType) {
|
175
|
-
|
175
|
+
const shouldHideBreadcrumbs = this.currentPanel?.breadcrumb === 'none' ||
|
176
|
+
_.get(this.form, 'settings.wizardBreadcrumbsType', '') === 'none';
|
177
|
+
if (shouldHideBreadcrumbs || ctx.isSubForm) {
|
176
178
|
return null;
|
177
179
|
}
|
178
180
|
return this.renderTemplate(headerType, ctx);
|
@@ -570,6 +572,7 @@ export default class Wizard extends Webform {
|
|
570
572
|
}
|
571
573
|
this.redraw().then(() => {
|
572
574
|
this.checkData(this.submission.data);
|
575
|
+
this.validateCurrentPage();
|
573
576
|
});
|
574
577
|
return Promise.resolve();
|
575
578
|
}
|
@@ -665,7 +668,8 @@ export default class Wizard extends Webform {
|
|
665
668
|
});
|
666
669
|
}
|
667
670
|
// Validate the form, before go to the next page
|
668
|
-
|
671
|
+
const errors = this.validateCurrentPage({ dirty: true });
|
672
|
+
if (errors.length === 0) {
|
669
673
|
this.checkData(this.submission.data);
|
670
674
|
return this.beforePage(true).then(() => {
|
671
675
|
return this.setPage(this.getNextPage()).then(() => {
|
@@ -680,9 +684,13 @@ export default class Wizard extends Webform {
|
|
680
684
|
else {
|
681
685
|
this.currentPage.components.forEach((comp) => comp.setPristine(false));
|
682
686
|
this.scrollIntoView(this.element);
|
683
|
-
return Promise.reject(this.showErrors(
|
687
|
+
return Promise.reject(this.showErrors(errors, true));
|
684
688
|
}
|
685
689
|
}
|
690
|
+
validateCurrentPage(flags = {}) {
|
691
|
+
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
692
|
+
return this.currentPage?.parent.validateComponents(this.currentPage.component.components, this.currentPage.parent.data, flags);
|
693
|
+
}
|
686
694
|
emitPrevPage() {
|
687
695
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
688
696
|
}
|
@@ -759,7 +767,7 @@ export default class Wizard extends Webform {
|
|
759
767
|
return super.setForm(form, flags);
|
760
768
|
}
|
761
769
|
onSetForm(clonedForm, initialForm) {
|
762
|
-
this.component.components = (this.
|
770
|
+
this.component.components = (this.parent ? initialForm.components : clonedForm.components) || [];
|
763
771
|
this.setComponentSchema();
|
764
772
|
}
|
765
773
|
setEditMode(submission) {
|
@@ -772,7 +780,9 @@ export default class Wizard extends Webform {
|
|
772
780
|
const changed = this.getPages({ all: true }).reduce((changed, page) => {
|
773
781
|
return this.setNestedValue(page, submission.data, flags, changed) || changed;
|
774
782
|
}, false);
|
775
|
-
if (!flags.sanitize
|
783
|
+
if (!flags.sanitize ||
|
784
|
+
(flags && flags.fromSubmission && (this.prefixComps.length || this.suffixComps.length) && submission._id) ||
|
785
|
+
(this.options.server && (this.prefixComps.length || this.suffixComps.length))) {
|
776
786
|
this.mergeData(this.data, submission.data);
|
777
787
|
}
|
778
788
|
if (changed) {
|
@@ -823,9 +833,9 @@ export default class Wizard extends Webform {
|
|
823
833
|
}
|
824
834
|
onChange(flags, changed, modified, changes) {
|
825
835
|
super.onChange(flags, changed, modified, changes);
|
826
|
-
|
827
|
-
|
828
|
-
this.showErrors(
|
836
|
+
const errors = this.validate(this.localData, { dirty: false });
|
837
|
+
if (this.alert) {
|
838
|
+
this.showErrors(errors, true, true);
|
829
839
|
}
|
830
840
|
// If the pages change, need to redraw the header.
|
831
841
|
let currentPanels;
|
@@ -861,7 +871,7 @@ export default class Wizard extends Webform {
|
|
861
871
|
}
|
862
872
|
return super.redraw();
|
863
873
|
}
|
864
|
-
checkValidity(data, dirty, row, currentPageOnly) {
|
874
|
+
checkValidity(data, dirty, row, currentPageOnly, childErrors = []) {
|
865
875
|
if (!this.checkCondition(row, data)) {
|
866
876
|
this.setCustomValidity('');
|
867
877
|
return true;
|
@@ -869,7 +879,7 @@ export default class Wizard extends Webform {
|
|
869
879
|
const components = !currentPageOnly || this.isLastPage()
|
870
880
|
? this.getComponents()
|
871
881
|
: this.currentPage.components;
|
872
|
-
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row) && check, true);
|
882
|
+
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, childErrors) && check, true);
|
873
883
|
}
|
874
884
|
get errors() {
|
875
885
|
if (!this.isLastPage()) {
|
@@ -878,23 +888,22 @@ export default class Wizard extends Webform {
|
|
878
888
|
return super.errors;
|
879
889
|
}
|
880
890
|
focusOnComponent(key) {
|
881
|
-
|
882
|
-
|
883
|
-
let
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
891
|
+
const component = this.getComponent(key);
|
892
|
+
if (component) {
|
893
|
+
let topPanel = component.parent;
|
894
|
+
while (!(topPanel.parent instanceof Wizard)) {
|
895
|
+
topPanel = topPanel.parent;
|
896
|
+
}
|
897
|
+
const pageIndex = this.pages.findIndex(page => page === topPanel);
|
898
|
+
if (pageIndex >= 0) {
|
899
|
+
const page = this.pages[pageIndex];
|
900
|
+
if (page && page !== this.currentPage) {
|
901
|
+
return this.setPage(pageIndex).then(() => {
|
902
|
+
this.showErrors(this.validate(this.localData, { dirty: true }));
|
903
|
+
super.focusOnComponent(key);
|
904
|
+
});
|
888
905
|
}
|
889
|
-
}
|
890
|
-
return hasComponent;
|
891
|
-
});
|
892
|
-
if (page && page !== this.currentPage) {
|
893
|
-
return this.setPage(pageIndex).then(() => {
|
894
|
-
this.checkValidity(this.submission.data, true, this.submission.data);
|
895
|
-
this.showErrors();
|
896
|
-
super.focusOnComponent(key);
|
897
|
-
});
|
906
|
+
}
|
898
907
|
}
|
899
908
|
return super.focusOnComponent(key);
|
900
909
|
}
|
@@ -698,8 +698,7 @@ export default class PasswordStrengthAddon extends FormioAddon {
|
|
698
698
|
* @param {string} value - Suggested password
|
699
699
|
*/
|
700
700
|
checkValidity(value: string): boolean;
|
701
|
-
errors: any
|
702
|
-
handleBlackListCheckResult(result: any): void;
|
701
|
+
handleBlackListCheckResult(result: any, errors: any): void;
|
703
702
|
levels: any[];
|
704
703
|
maxEntropy: any;
|
705
704
|
attach(element: any): void;
|
@@ -261,30 +261,29 @@ export default class PasswordStrengthAddon extends FormioAddon {
|
|
261
261
|
checkValidity(value) {
|
262
262
|
const passwordLength = value.length;
|
263
263
|
const { charactersPoolSize, errors } = this.performChecks(value);
|
264
|
-
this.errors = errors;
|
265
264
|
const entropy = this.calculatePasswordEntropy(passwordLength, charactersPoolSize);
|
266
265
|
const blackListCheck = this.settings.blackList?.length || this.settings.customBlacklistedWords ?
|
267
266
|
this.checkBlackList(value)
|
268
267
|
: null;
|
268
|
+
const isValid = this.isValid();
|
269
|
+
if (!isValid) {
|
270
|
+
errors.push({
|
271
|
+
message: 'Password is not strong enough',
|
272
|
+
level: this.settings.required ? 'error' : 'warning'
|
273
|
+
});
|
274
|
+
}
|
269
275
|
// If there were found some words from the black list
|
270
276
|
if (blackListCheck && blackListCheck !== true) {
|
271
|
-
this.handleBlackListCheckResult(blackListCheck);
|
277
|
+
this.handleBlackListCheckResult(blackListCheck, errors);
|
272
278
|
// Select the mininal entropy based on the dictionary check or symbolic check
|
273
279
|
this.entropy = Math.min(entropy, blackListCheck.entropy);
|
274
280
|
}
|
275
281
|
else {
|
276
282
|
this.entropy = entropy;
|
277
283
|
}
|
278
|
-
|
279
|
-
if (!isValid) {
|
280
|
-
this.errors.push({
|
281
|
-
message: 'Password is not strong enough',
|
282
|
-
level: this.settings.required ? 'error' : 'warning'
|
283
|
-
});
|
284
|
-
}
|
285
|
-
return !this.errors.length;
|
284
|
+
return !errors.length;
|
286
285
|
}
|
287
|
-
handleBlackListCheckResult(result) {
|
286
|
+
handleBlackListCheckResult(result, errors) {
|
288
287
|
const blacklistedWords = result.blacklistedWords;
|
289
288
|
const isRequired = this.settings.disableBlacklistedWords;
|
290
289
|
const message = `Password ${isRequired ? 'must' : 'should'} not include common words: ${blacklistedWords.join(', ')}`;
|
@@ -292,7 +291,7 @@ export default class PasswordStrengthAddon extends FormioAddon {
|
|
292
291
|
name: 'blacklist',
|
293
292
|
required: isRequired,
|
294
293
|
};
|
295
|
-
this.handleRuleCheckResult(false, validation, message,
|
294
|
+
this.handleRuleCheckResult(false, validation, message, errors);
|
296
295
|
}
|
297
296
|
constructor(settings, componentInstance) {
|
298
297
|
super(settings, componentInstance);
|
package/lib/mjs/addons/index.js
CHANGED
@@ -253,6 +253,13 @@ export default class Components {
|
|
253
253
|
static setComponents(comps: any): void;
|
254
254
|
static addComponent(name: any, comp: any): void;
|
255
255
|
static setComponent(name: any, comp: any): void;
|
256
|
+
/**
|
257
|
+
* Return a path of component's value.
|
258
|
+
*
|
259
|
+
* @param {Object} component - The component instance.
|
260
|
+
* @return {string} - The component's value path.
|
261
|
+
*/
|
262
|
+
static getComponentPath(component: Object): string;
|
256
263
|
static create(component: any, options: any, data: any): any;
|
257
264
|
}
|
258
265
|
import BaseEditForm from './_classes/component/Component.form';
|
@@ -45,6 +45,30 @@ class Components {
|
|
45
45
|
static setComponent(name, comp) {
|
46
46
|
Components.components[name] = comp;
|
47
47
|
}
|
48
|
+
/**
|
49
|
+
* Return a path of component's value.
|
50
|
+
*
|
51
|
+
* @param {Object} component - The component instance.
|
52
|
+
* @return {string} - The component's value path.
|
53
|
+
*/
|
54
|
+
static getComponentPath(component) {
|
55
|
+
let path = '';
|
56
|
+
if (component.component.key) {
|
57
|
+
let thisPath = component.options?.parent || component;
|
58
|
+
while (thisPath && !thisPath.allowData && thisPath.parent) {
|
59
|
+
thisPath = thisPath.parent;
|
60
|
+
}
|
61
|
+
// TODO: any component that is nested in e.g. a Data Grid or an Edit Grid is going to receive a row prop; the problem
|
62
|
+
// is that options.row is passed to each further nested component, which results in erroneous paths like
|
63
|
+
// `editGrid[0].container[0].textField` rather than `editGrid[0].container.textField`. This should be adapted for other
|
64
|
+
// components with a tree-like data model
|
65
|
+
const rowIndex = component.row;
|
66
|
+
const rowIndexPath = rowIndex && !['container'].includes(thisPath.component.type) ? `[${Number.parseInt(rowIndex)}]` : '';
|
67
|
+
path = `${thisPath.path}${rowIndexPath}.`;
|
68
|
+
path += component.component.key;
|
69
|
+
return _.trim(path, '.');
|
70
|
+
}
|
71
|
+
}
|
48
72
|
static create(component, options, data) {
|
49
73
|
let comp = null;
|
50
74
|
if (component.type && Components.components.hasOwnProperty(component.type)) {
|
@@ -69,6 +93,11 @@ class Components {
|
|
69
93
|
else {
|
70
94
|
comp = new Component(component, options, data);
|
71
95
|
}
|
96
|
+
const path = Components.getComponentPath(comp);
|
97
|
+
if (path) {
|
98
|
+
comp.path = path;
|
99
|
+
comp.componentsMap[comp.path] = comp;
|
100
|
+
}
|
72
101
|
return comp;
|
73
102
|
}
|
74
103
|
}
|