@formio/js 5.0.0-rc.27 → 5.0.0-rc.29
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 +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/cjs/Webform.js
CHANGED
@@ -115,7 +115,6 @@ class Webform extends NestedDataComponent_1.default {
|
|
115
115
|
else {
|
116
116
|
this.triggerSaveDraft = this.saveDraft.bind(this);
|
117
117
|
}
|
118
|
-
this.customErrors = [];
|
119
118
|
/**
|
120
119
|
* Determines if this form should submit the API on submit.
|
121
120
|
* @type {boolean}
|
@@ -779,9 +778,9 @@ class Webform extends NestedDataComponent_1.default {
|
|
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 @@ class Webform extends NestedDataComponent_1.default {
|
|
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 @@ class Webform extends NestedDataComponent_1.default {
|
|
1005
997
|
components.push(err.path);
|
1006
998
|
}
|
1007
999
|
components.forEach((path) => {
|
1008
|
-
const originalPath =
|
1000
|
+
const originalPath = (0, utils_1.getStringFromComponentPath)(path);
|
1009
1001
|
const component = this.getComponent(path, lodash_1.default.identity, originalPath);
|
1010
1002
|
if (err.fromServer) {
|
1011
1003
|
if (component.serverErrors) {
|
@@ -1020,42 +1012,32 @@ class Webform extends NestedDataComponent_1.default {
|
|
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 = lodash_1.default.uniqBy(errors, error => error.message);
|
1017
|
+
const createListItem = (message, index) => {
|
1018
|
+
var _a, _b, _c;
|
1019
|
+
const err = errors[index];
|
1020
|
+
const messageFromIndex = !lodash_1.default.isUndefined(index) && errors && errors[index];
|
1021
|
+
const keyOrPath = ((messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.formattedKeyOrPath) || (messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.path) || ((_a = messageFromIndex === null || messageFromIndex === void 0 ? void 0 : messageFromIndex.context) === null || _a === void 0 ? void 0 : _a.path)) || (((_b = err.context) === null || _b === void 0 ? void 0 : _b.component) && ((_c = err.context) === null || _c === void 0 ? void 0 : _c.component.key)) || (err.component && err.component.key) || err.fromServer && err.path;
|
1022
|
+
const formattedKeyOrPath = keyOrPath ? (0, utils_1.getStringFromComponentPath)(keyOrPath) : '';
|
1023
|
+
if (typeof err !== 'string' && !err.formattedKeyOrPath) {
|
1024
|
+
err.formattedKeyOrPath = formattedKeyOrPath;
|
1025
|
+
}
|
1026
|
+
return {
|
1027
|
+
message: (0, utils_1.unescapeHTML)(message),
|
1028
|
+
keyOrPath: formattedKeyOrPath
|
1037
1029
|
};
|
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));
|
1030
|
+
};
|
1031
|
+
errors.forEach(({ message, context, fromServer, component }, index) => {
|
1032
|
+
const text = !(component === null || component === void 0 ? void 0 : component.label) || (context === null || context === void 0 ? void 0 : context.hasLabel) || fromServer
|
1033
|
+
? this.t('alertMessage', { message: this.t(message) })
|
1034
|
+
: this.t('alertMessageWithLabel', {
|
1035
|
+
label: this.t(component === null || component === void 0 ? void 0 : component.label),
|
1036
|
+
message: this.t(message),
|
1049
1037
|
});
|
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
|
-
});
|
1038
|
+
displayedErrors.push(createListItem(text, index));
|
1039
|
+
});
|
1040
|
+
}
|
1059
1041
|
const errorsList = this.renderTemplate('errorsList', { errors: displayedErrors });
|
1060
1042
|
this.root.setAlert('danger', errorsList);
|
1061
1043
|
if (triggerEvent) {
|
@@ -1118,17 +1100,10 @@ class Webform extends NestedDataComponent_1.default {
|
|
1118
1100
|
this.emit('change', { isValid: true }, { silent: true });
|
1119
1101
|
return false;
|
1120
1102
|
}
|
1121
|
-
|
1122
|
-
if (this.submitted) {
|
1123
|
-
errors = this.showErrors();
|
1124
|
-
}
|
1125
|
-
else {
|
1126
|
-
errors = this.showErrors(error, true);
|
1127
|
-
}
|
1103
|
+
this.showErrors(error, true);
|
1128
1104
|
if (this.root && this.root.alert) {
|
1129
1105
|
this.scrollIntoView(this.root.alert);
|
1130
1106
|
}
|
1131
|
-
return errors;
|
1132
1107
|
}
|
1133
1108
|
/**
|
1134
1109
|
* Trigger the change event for this form.
|
@@ -1139,10 +1114,6 @@ class Webform extends NestedDataComponent_1.default {
|
|
1139
1114
|
onChange(flags, changed, modified, changes) {
|
1140
1115
|
flags = flags || {};
|
1141
1116
|
let isChangeEventEmitted = false;
|
1142
|
-
// For any change events, clear any custom errors for that component.
|
1143
|
-
if (changed && changed.component) {
|
1144
|
-
this.customErrors = this.customErrors.filter(err => err.component && err.component !== changed.component.key);
|
1145
|
-
}
|
1146
1117
|
super.onChange(flags, true);
|
1147
1118
|
const value = lodash_1.default.clone(this.submission);
|
1148
1119
|
flags.changed = value.changed = changed;
|
@@ -1150,10 +1121,13 @@ class Webform extends NestedDataComponent_1.default {
|
|
1150
1121
|
if (modified && this.pristine) {
|
1151
1122
|
this.pristine = false;
|
1152
1123
|
}
|
1153
|
-
|
1124
|
+
this.checkData(value.data, flags);
|
1125
|
+
const shouldValidate = !flags.noValidate || flags.fromIFrame || (flags.fromSubmission && this.rootPristine && this.pristine && flags.changed);
|
1126
|
+
const errors = shouldValidate ? this.validate(value.data, Object.assign(Object.assign({}, flags), { process: 'change' })) : [];
|
1127
|
+
value.isValid = errors.length === 0;
|
1154
1128
|
this.loading = false;
|
1155
1129
|
if (this.submitted) {
|
1156
|
-
this.showErrors();
|
1130
|
+
this.showErrors(errors);
|
1157
1131
|
}
|
1158
1132
|
// See if we need to save the draft of the form.
|
1159
1133
|
if (modified && this.options.saveDraft) {
|
@@ -1169,13 +1143,6 @@ class Webform extends NestedDataComponent_1.default {
|
|
1169
1143
|
this.initialized = true;
|
1170
1144
|
}
|
1171
1145
|
}
|
1172
|
-
checkData(data, flags = {}) {
|
1173
|
-
const valid = super.checkData(data, flags);
|
1174
|
-
if ((lodash_1.default.isEmpty(flags) || flags.noValidate) && this.submitted) {
|
1175
|
-
this.showErrors();
|
1176
|
-
}
|
1177
|
-
return valid;
|
1178
|
-
}
|
1179
1146
|
/**
|
1180
1147
|
* Send a delete request to the server.
|
1181
1148
|
*/
|
@@ -1228,18 +1195,31 @@ class Webform extends NestedDataComponent_1.default {
|
|
1228
1195
|
}
|
1229
1196
|
const submission = (0, utils_1.fastCloneDeep)(this.submission || {});
|
1230
1197
|
this.setMetadata(submission);
|
1231
|
-
submission.state = options.state || 'submitted';
|
1198
|
+
submission.state = options.state || submission.state || 'submitted';
|
1232
1199
|
const isDraft = (submission.state === 'draft');
|
1233
1200
|
this.hook('beforeSubmit', Object.assign(Object.assign({}, submission), { component: options.component }), (err, data) => {
|
1201
|
+
var _a;
|
1234
1202
|
if (err) {
|
1235
1203
|
return reject(err);
|
1236
1204
|
}
|
1237
1205
|
submission._vnote = data && data._vnote ? data._vnote : '';
|
1238
|
-
|
1239
|
-
|
1206
|
+
try {
|
1207
|
+
if (!isDraft && !options.noValidate) {
|
1208
|
+
if (!submission.data) {
|
1209
|
+
return reject('Invalid Submission');
|
1210
|
+
}
|
1211
|
+
const errors = this.validate(submission.data, {
|
1212
|
+
dirty: true,
|
1213
|
+
silentCheck: false,
|
1214
|
+
process: 'submit'
|
1215
|
+
});
|
1216
|
+
if (errors.length || ((_a = options.beforeSubmitResults) === null || _a === void 0 ? void 0 : _a.some((result) => result.status === 'rejected'))) {
|
1217
|
+
return reject(errors);
|
1218
|
+
}
|
1219
|
+
}
|
1240
1220
|
}
|
1241
|
-
|
1242
|
-
|
1221
|
+
catch (err) {
|
1222
|
+
console.error(err);
|
1243
1223
|
}
|
1244
1224
|
this.everyComponent((comp) => {
|
1245
1225
|
if (submission._vnote && comp.type === 'form' && comp.component.reference) {
|
@@ -1260,9 +1240,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
1260
1240
|
}
|
1261
1241
|
// Ensure err is an array.
|
1262
1242
|
err = Array.isArray(err) ? err : [err];
|
1263
|
-
|
1264
|
-
this.customErrors = err;
|
1265
|
-
return reject();
|
1243
|
+
return reject(err);
|
1266
1244
|
}
|
1267
1245
|
this.loading = true;
|
1268
1246
|
// Use the form action to submit the form if available.
|
@@ -1358,7 +1336,7 @@ class Webform extends NestedDataComponent_1.default {
|
|
1358
1336
|
*
|
1359
1337
|
* @returns {Promise} - A promise when the form is done submitting.
|
1360
1338
|
*/
|
1361
|
-
submit(before, options) {
|
1339
|
+
submit(before, options = {}) {
|
1362
1340
|
this.submissionInProcess = true;
|
1363
1341
|
if (!before) {
|
1364
1342
|
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[];
|
@@ -19,7 +19,7 @@ require("./components/builder");
|
|
19
19
|
if (typeof window !== 'undefined' && typeof window.global === 'undefined') {
|
20
20
|
window.global = window;
|
21
21
|
}
|
22
|
-
const
|
22
|
+
const dragula_1 = __importDefault(require("dragula"));
|
23
23
|
class WebformBuilder extends Component_1.default {
|
24
24
|
// eslint-disable-next-line max-statements
|
25
25
|
constructor() {
|
@@ -51,7 +51,7 @@ class WebformBuilder extends Component_1.default {
|
|
51
51
|
}
|
52
52
|
};
|
53
53
|
this.setElement(element);
|
54
|
-
this.dragulaLib =
|
54
|
+
this.dragulaLib = dragula_1.default;
|
55
55
|
this.builderHeight = 0;
|
56
56
|
this.schemas = {};
|
57
57
|
this.repeatablePaths = [];
|
@@ -361,7 +361,7 @@ class WebformBuilder extends Component_1.default {
|
|
361
361
|
}
|
362
362
|
if (component.refs.removeComponent) {
|
363
363
|
this.attachTooltip(component.refs.removeComponent, this.t('Remove'));
|
364
|
-
component.addEventListener(component.refs.removeComponent, 'click', () => this.removeComponent(component.schema, parent, component.component));
|
364
|
+
component.addEventListener(component.refs.removeComponent, 'click', () => this.removeComponent(component.schema, parent, component.component, component));
|
365
365
|
}
|
366
366
|
return element;
|
367
367
|
}
|
@@ -667,10 +667,10 @@ class WebformBuilder extends Component_1.default {
|
|
667
667
|
const containersArray = Array.prototype.slice.call(this.refs['sidebar-container']).filter(item => {
|
668
668
|
return item.id !== 'group-container-resource';
|
669
669
|
});
|
670
|
-
if (!
|
670
|
+
if (!dragula_1.default) {
|
671
671
|
return;
|
672
672
|
}
|
673
|
-
this.dragula = (0,
|
673
|
+
this.dragula = (0, dragula_1.default)(containersArray, {
|
674
674
|
moves(el) {
|
675
675
|
let moves = true;
|
676
676
|
const list = Array.from(el.classList).filter(item => item.indexOf('formio-component-') === 0);
|
@@ -735,6 +735,10 @@ class WebformBuilder extends Component_1.default {
|
|
735
735
|
}
|
736
736
|
}
|
737
737
|
if (info) {
|
738
|
+
//if this is a custom component that was already assigned a key, don't stomp on it
|
739
|
+
if (!Components_1.default.components.hasOwnProperty(info.type) && info.key) {
|
740
|
+
return info;
|
741
|
+
}
|
738
742
|
info.key = this.generateKey(info);
|
739
743
|
}
|
740
744
|
return info;
|
@@ -940,7 +944,7 @@ class WebformBuilder extends Component_1.default {
|
|
940
944
|
}
|
941
945
|
}
|
942
946
|
}
|
943
|
-
removeComponent(component, parent, original) {
|
947
|
+
removeComponent(component, parent, original, componentInstance) {
|
944
948
|
if (!parent) {
|
945
949
|
return;
|
946
950
|
}
|
@@ -966,6 +970,9 @@ class WebformBuilder extends Component_1.default {
|
|
966
970
|
else if (parent.formioComponent && parent.formioComponent.removeChildComponent) {
|
967
971
|
parent.formioComponent.removeChildComponent(component);
|
968
972
|
}
|
973
|
+
if (component.input && componentInstance && componentInstance.parent) {
|
974
|
+
lodash_1.default.unset(componentInstance._data, componentInstance.key);
|
975
|
+
}
|
969
976
|
const rebuild = parent.formioComponent.rebuild() || Promise.resolve();
|
970
977
|
rebuild.then(() => {
|
971
978
|
this.emit('removeComponent', component, parent.formioComponent.schema, path, index);
|
@@ -1094,13 +1101,14 @@ class WebformBuilder extends Component_1.default {
|
|
1094
1101
|
const repeatablePaths = this.findRepeatablePaths();
|
1095
1102
|
let hasInvalidComponents = false;
|
1096
1103
|
this.webform.everyComponent((comp) => {
|
1097
|
-
var _a
|
1104
|
+
var _a;
|
1098
1105
|
const path = comp.path;
|
1106
|
+
const errors = comp.visibleErrors || [];
|
1099
1107
|
if (repeatablePaths.includes(path)) {
|
1100
1108
|
comp.setCustomValidity(`API Key is not unique: ${comp.key}`);
|
1101
1109
|
hasInvalidComponents = true;
|
1102
1110
|
}
|
1103
|
-
else if (
|
1111
|
+
else if (errors.length && ((_a = errors[0].message) === null || _a === void 0 ? void 0 : _a.startsWith('API Key is not unique'))) {
|
1104
1112
|
comp.setCustomValidity('');
|
1105
1113
|
}
|
1106
1114
|
});
|
@@ -1135,8 +1143,8 @@ class WebformBuilder extends Component_1.default {
|
|
1135
1143
|
comp = component;
|
1136
1144
|
}
|
1137
1145
|
});
|
1138
|
-
const originalComp = comp.component;
|
1139
|
-
const originalComponentSchema = comp.schema;
|
1146
|
+
const originalComp = comp === null || comp === void 0 ? void 0 : comp.component;
|
1147
|
+
const originalComponentSchema = comp === null || comp === void 0 ? void 0 : comp.schema;
|
1140
1148
|
const isParentSaveChildMethod = this.isParentSaveChildMethod(parent.formioComponent);
|
1141
1149
|
if (parentContainer && !isParentSaveChildMethod) {
|
1142
1150
|
parentContainer[index] = submissionData;
|
@@ -1193,9 +1201,12 @@ class WebformBuilder extends Component_1.default {
|
|
1193
1201
|
saveButtons.forEach((saveButton) => {
|
1194
1202
|
this.editForm.addEventListener(saveButton, 'click', (event) => {
|
1195
1203
|
event.preventDefault();
|
1196
|
-
|
1204
|
+
const errors = this.editForm.validate(this.editForm.data, {
|
1205
|
+
dirty: true
|
1206
|
+
});
|
1207
|
+
if (errors.length) {
|
1197
1208
|
this.editForm.setPristine(false);
|
1198
|
-
this.editForm.showErrors();
|
1209
|
+
this.editForm.showErrors(errors);
|
1199
1210
|
return false;
|
1200
1211
|
}
|
1201
1212
|
this.saved = true;
|
@@ -1221,7 +1232,7 @@ class WebformBuilder extends Component_1.default {
|
|
1221
1232
|
});
|
1222
1233
|
}
|
1223
1234
|
editComponent(component, parent, isNew, isJsonEdit, original, flags = {}) {
|
1224
|
-
var _a;
|
1235
|
+
var _a, _b;
|
1225
1236
|
if (!component.key) {
|
1226
1237
|
return;
|
1227
1238
|
}
|
@@ -1248,7 +1259,7 @@ class WebformBuilder extends Component_1.default {
|
|
1248
1259
|
editFormOptions.editComponent = component;
|
1249
1260
|
editFormOptions.flags = flags;
|
1250
1261
|
this.hook('editComponentParentInstance', editFormOptions, parent);
|
1251
|
-
this.editForm = new Webform_1.default(Object.assign(Object.assign(Object.assign({}, lodash_1.default.omit(this.options, ['hooks', 'builder', 'events', 'attachMode', 'skipInit'])), { language: this.options.language }), editFormOptions));
|
1262
|
+
this.editForm = new Webform_1.default(Object.assign(Object.assign(Object.assign(Object.assign({}, lodash_1.default.omit(this.options, ['hooks', 'builder', 'events', 'attachMode', 'skipInit'])), { language: this.options.language }), editFormOptions), { evalContext: Object.assign(Object.assign({}, ((editFormOptions === null || editFormOptions === void 0 ? void 0 : editFormOptions.evalContext) || ((_a = this.options) === null || _a === void 0 ? void 0 : _a.evalContext) || {})), { buildingForm: this.form }) }));
|
1252
1263
|
this.hook('editFormProperties', parent);
|
1253
1264
|
this.editForm.form = (isJsonEdit && !isCustom) ? {
|
1254
1265
|
components: [
|
@@ -1296,7 +1307,7 @@ class WebformBuilder extends Component_1.default {
|
|
1296
1307
|
]));
|
1297
1308
|
this.hook('previewFormSettitngs', schema, isJsonEdit);
|
1298
1309
|
}
|
1299
|
-
this.showPreview = (
|
1310
|
+
this.showPreview = (_b = ComponentClass.builderInfo.showPreview) !== null && _b !== void 0 ? _b : true;
|
1300
1311
|
this.componentEdit = this.ce('div', { 'class': 'component-edit-container' });
|
1301
1312
|
this.setContent(this.componentEdit, this.renderTemplate('builderEditForm', {
|
1302
1313
|
componentInfo: ComponentClass.builderInfo,
|
@@ -1353,8 +1364,14 @@ class WebformBuilder extends Component_1.default {
|
|
1353
1364
|
}
|
1354
1365
|
}
|
1355
1366
|
}
|
1367
|
+
// If the edit form has any nested form inside, we get a partial data (nested form's data) in the
|
1368
|
+
// event.data property
|
1369
|
+
let editFormData;
|
1370
|
+
if (event.changed.instance && event.changed.instance.root && event.changed.instance.root.id !== this.editForm.id) {
|
1371
|
+
editFormData = this.editForm.data;
|
1372
|
+
}
|
1356
1373
|
// Update the component.
|
1357
|
-
this.updateComponent(event.data.componentJson || event.data, event.changed);
|
1374
|
+
this.updateComponent(event.data.componentJson || editFormData || event.data, event.changed);
|
1358
1375
|
}
|
1359
1376
|
});
|
1360
1377
|
this.attachEditComponentControls(component, parent, isNew, original, ComponentClass);
|
package/lib/cjs/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,13 +85,13 @@ 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 {
|
90
|
-
const setBaseUrl:
|
91
|
-
const setApiUrl:
|
92
|
-
const setAppUrl:
|
92
|
+
const setBaseUrl: any;
|
93
|
+
const setApiUrl: any;
|
94
|
+
const setAppUrl: any;
|
93
95
|
}
|
94
96
|
export default Wizard;
|
95
97
|
import Webform from './Webform';
|
96
|
-
import { Formio } from './Formio';
|
package/lib/cjs/Wizard.js
CHANGED
@@ -181,7 +181,10 @@ class Wizard extends Webform_1.default {
|
|
181
181
|
return this.renderTemplate('wizardNav', ctx);
|
182
182
|
}
|
183
183
|
prepareHeaderSettings(ctx, headerType) {
|
184
|
-
|
184
|
+
var _a;
|
185
|
+
const shouldHideBreadcrumbs = ((_a = this.currentPanel) === null || _a === void 0 ? void 0 : _a.breadcrumb) === 'none' ||
|
186
|
+
lodash_1.default.get(this.form, 'settings.wizardBreadcrumbsType', '') === 'none';
|
187
|
+
if (shouldHideBreadcrumbs || ctx.isSubForm) {
|
185
188
|
return null;
|
186
189
|
}
|
187
190
|
return this.renderTemplate(headerType, ctx);
|
@@ -577,6 +580,7 @@ class Wizard extends Webform_1.default {
|
|
577
580
|
}
|
578
581
|
this.redraw().then(() => {
|
579
582
|
this.checkData(this.submission.data);
|
583
|
+
this.validateCurrentPage();
|
580
584
|
});
|
581
585
|
return Promise.resolve();
|
582
586
|
}
|
@@ -674,7 +678,8 @@ class Wizard extends Webform_1.default {
|
|
674
678
|
});
|
675
679
|
}
|
676
680
|
// Validate the form, before go to the next page
|
677
|
-
|
681
|
+
const errors = this.validateCurrentPage({ dirty: true });
|
682
|
+
if (errors.length === 0) {
|
678
683
|
this.checkData(this.submission.data);
|
679
684
|
return this.beforePage(true).then(() => {
|
680
685
|
return this.setPage(this.getNextPage()).then(() => {
|
@@ -689,9 +694,14 @@ class Wizard extends Webform_1.default {
|
|
689
694
|
else {
|
690
695
|
this.currentPage.components.forEach((comp) => comp.setPristine(false));
|
691
696
|
this.scrollIntoView(this.element);
|
692
|
-
return Promise.reject(this.showErrors(
|
697
|
+
return Promise.reject(this.showErrors(errors, true));
|
693
698
|
}
|
694
699
|
}
|
700
|
+
validateCurrentPage(flags = {}) {
|
701
|
+
var _a;
|
702
|
+
// Accessing the parent ensures the right instance (whether it's the parent Wizard or a nested Wizard) performs its validation
|
703
|
+
return (_a = this.currentPage) === null || _a === void 0 ? void 0 : _a.parent.validateComponents(this.currentPage.component.components, this.currentPage.parent.data, flags);
|
704
|
+
}
|
695
705
|
emitPrevPage() {
|
696
706
|
this.emit('prevPage', { page: this.page, submission: this.submission });
|
697
707
|
}
|
@@ -768,7 +778,7 @@ class Wizard extends Webform_1.default {
|
|
768
778
|
return super.setForm(form, flags);
|
769
779
|
}
|
770
780
|
onSetForm(clonedForm, initialForm) {
|
771
|
-
this.component.components = (this.
|
781
|
+
this.component.components = (this.parent ? initialForm.components : clonedForm.components) || [];
|
772
782
|
this.setComponentSchema();
|
773
783
|
}
|
774
784
|
setEditMode(submission) {
|
@@ -781,7 +791,9 @@ class Wizard extends Webform_1.default {
|
|
781
791
|
const changed = this.getPages({ all: true }).reduce((changed, page) => {
|
782
792
|
return this.setNestedValue(page, submission.data, flags, changed) || changed;
|
783
793
|
}, false);
|
784
|
-
if (!flags.sanitize
|
794
|
+
if (!flags.sanitize ||
|
795
|
+
(flags && flags.fromSubmission && (this.prefixComps.length || this.suffixComps.length) && submission._id) ||
|
796
|
+
(this.options.server && (this.prefixComps.length || this.suffixComps.length))) {
|
785
797
|
this.mergeData(this.data, submission.data);
|
786
798
|
}
|
787
799
|
if (changed) {
|
@@ -833,9 +845,9 @@ class Wizard extends Webform_1.default {
|
|
833
845
|
onChange(flags, changed, modified, changes) {
|
834
846
|
var _a, _b;
|
835
847
|
super.onChange(flags, changed, modified, changes);
|
836
|
-
|
837
|
-
|
838
|
-
this.showErrors(
|
848
|
+
const errors = this.validate(this.localData, { dirty: false });
|
849
|
+
if (this.alert) {
|
850
|
+
this.showErrors(errors, true, true);
|
839
851
|
}
|
840
852
|
// If the pages change, need to redraw the header.
|
841
853
|
let currentPanels;
|
@@ -872,7 +884,7 @@ class Wizard extends Webform_1.default {
|
|
872
884
|
}
|
873
885
|
return super.redraw();
|
874
886
|
}
|
875
|
-
checkValidity(data, dirty, row, currentPageOnly) {
|
887
|
+
checkValidity(data, dirty, row, currentPageOnly, childErrors = []) {
|
876
888
|
if (!this.checkCondition(row, data)) {
|
877
889
|
this.setCustomValidity('');
|
878
890
|
return true;
|
@@ -880,7 +892,7 @@ class Wizard extends Webform_1.default {
|
|
880
892
|
const components = !currentPageOnly || this.isLastPage()
|
881
893
|
? this.getComponents()
|
882
894
|
: this.currentPage.components;
|
883
|
-
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row) && check, true);
|
895
|
+
return components.reduce((check, comp) => comp.checkValidity(data, dirty, row, childErrors) && check, true);
|
884
896
|
}
|
885
897
|
get errors() {
|
886
898
|
if (!this.isLastPage()) {
|
@@ -889,23 +901,22 @@ class Wizard extends Webform_1.default {
|
|
889
901
|
return super.errors;
|
890
902
|
}
|
891
903
|
focusOnComponent(key) {
|
892
|
-
|
893
|
-
|
894
|
-
let
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
904
|
+
const component = this.getComponent(key);
|
905
|
+
if (component) {
|
906
|
+
let topPanel = component.parent;
|
907
|
+
while (!(topPanel.parent instanceof Wizard)) {
|
908
|
+
topPanel = topPanel.parent;
|
909
|
+
}
|
910
|
+
const pageIndex = this.pages.findIndex(page => page === topPanel);
|
911
|
+
if (pageIndex >= 0) {
|
912
|
+
const page = this.pages[pageIndex];
|
913
|
+
if (page && page !== this.currentPage) {
|
914
|
+
return this.setPage(pageIndex).then(() => {
|
915
|
+
this.showErrors(this.validate(this.localData, { dirty: true }));
|
916
|
+
super.focusOnComponent(key);
|
917
|
+
});
|
899
918
|
}
|
900
|
-
}
|
901
|
-
return hasComponent;
|
902
|
-
});
|
903
|
-
if (page && page !== this.currentPage) {
|
904
|
-
return this.setPage(pageIndex).then(() => {
|
905
|
-
this.checkValidity(this.submission.data, true, this.submission.data);
|
906
|
-
this.showErrors();
|
907
|
-
super.focusOnComponent(key);
|
908
|
-
});
|
919
|
+
}
|
909
920
|
}
|
910
921
|
return super.focusOnComponent(key);
|
911
922
|
}
|
@@ -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;
|
@@ -268,30 +268,29 @@ class PasswordStrengthAddon extends FormioAddon_1.default {
|
|
268
268
|
var _a;
|
269
269
|
const passwordLength = value.length;
|
270
270
|
const { charactersPoolSize, errors } = this.performChecks(value);
|
271
|
-
this.errors = errors;
|
272
271
|
const entropy = this.calculatePasswordEntropy(passwordLength, charactersPoolSize);
|
273
272
|
const blackListCheck = ((_a = this.settings.blackList) === null || _a === void 0 ? void 0 : _a.length) || this.settings.customBlacklistedWords ?
|
274
273
|
this.checkBlackList(value)
|
275
274
|
: null;
|
275
|
+
const isValid = this.isValid();
|
276
|
+
if (!isValid) {
|
277
|
+
errors.push({
|
278
|
+
message: 'Password is not strong enough',
|
279
|
+
level: this.settings.required ? 'error' : 'warning'
|
280
|
+
});
|
281
|
+
}
|
276
282
|
// If there were found some words from the black list
|
277
283
|
if (blackListCheck && blackListCheck !== true) {
|
278
|
-
this.handleBlackListCheckResult(blackListCheck);
|
284
|
+
this.handleBlackListCheckResult(blackListCheck, errors);
|
279
285
|
// Select the mininal entropy based on the dictionary check or symbolic check
|
280
286
|
this.entropy = Math.min(entropy, blackListCheck.entropy);
|
281
287
|
}
|
282
288
|
else {
|
283
289
|
this.entropy = entropy;
|
284
290
|
}
|
285
|
-
|
286
|
-
if (!isValid) {
|
287
|
-
this.errors.push({
|
288
|
-
message: 'Password is not strong enough',
|
289
|
-
level: this.settings.required ? 'error' : 'warning'
|
290
|
-
});
|
291
|
-
}
|
292
|
-
return !this.errors.length;
|
291
|
+
return !errors.length;
|
293
292
|
}
|
294
|
-
handleBlackListCheckResult(result) {
|
293
|
+
handleBlackListCheckResult(result, errors) {
|
295
294
|
const blacklistedWords = result.blacklistedWords;
|
296
295
|
const isRequired = this.settings.disableBlacklistedWords;
|
297
296
|
const message = `Password ${isRequired ? 'must' : 'should'} not include common words: ${blacklistedWords.join(', ')}`;
|
@@ -299,7 +298,7 @@ class PasswordStrengthAddon extends FormioAddon_1.default {
|
|
299
298
|
name: 'blacklist',
|
300
299
|
required: isRequired,
|
301
300
|
};
|
302
|
-
this.handleRuleCheckResult(false, validation, message,
|
301
|
+
this.handleRuleCheckResult(false, validation, message, errors);
|
303
302
|
}
|
304
303
|
constructor(settings, componentInstance) {
|
305
304
|
super(settings, componentInstance);
|
package/lib/cjs/addons/index.js
CHANGED
@@ -12,7 +12,11 @@ exports.editForms = [
|
|
12
12
|
key: 'settings',
|
13
13
|
display: 'form',
|
14
14
|
input: true,
|
15
|
-
components
|
15
|
+
components: components.map((comp) => {
|
16
|
+
comp.tableView = false;
|
17
|
+
return comp;
|
18
|
+
}),
|
19
|
+
tableView: false,
|
16
20
|
defaultValue: {
|
17
21
|
data: defaultSettings
|
18
22
|
},
|