@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
@@ -83,12 +83,16 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
83
83
|
removeRow(rowIndex: any, modified: any): void;
|
84
84
|
createRowComponents(row: any, rowIndex: any, recreatePartially: any): any;
|
85
85
|
hasOpenRows(): any;
|
86
|
+
getAttachedData(data?: null): any;
|
86
87
|
shouldValidateDraft(editRow: any): any;
|
87
88
|
shouldValidateRow(editRow: any, dirty: any): any;
|
88
|
-
validateRow(editRow: any, dirty: any, forceSilentCheck: any):
|
89
|
-
showRowErrorAlerts(editRow: any,
|
90
|
-
|
91
|
-
|
89
|
+
validateRow(editRow: any, dirty: any, forceSilentCheck: any): any;
|
90
|
+
showRowErrorAlerts(editRow: any, errors: any): void;
|
91
|
+
/**
|
92
|
+
* Return that this component processes its own validation.
|
93
|
+
*/
|
94
|
+
get processOwnValidation(): boolean;
|
95
|
+
setRowInvalid(ref: any, index: any): void;
|
92
96
|
changeState(changed: any, flags: any): void;
|
93
97
|
openWhenEmpty(): void;
|
94
98
|
restoreRowContext(editRow: any, flags?: {}): void;
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import _ from 'lodash';
|
2
|
+
import { processSync } from '@formio/core';
|
3
|
+
import { editgrid as templates } from '@formio/bootstrap/components';
|
2
4
|
import NestedArrayComponent from '../_classes/nestedarray/NestedArrayComponent';
|
3
5
|
import Component from '../_classes/component/Component';
|
4
6
|
import Alert from '../alert/Alert';
|
5
|
-
import { fastCloneDeep, Evaluator, getArrayFromComponentPath, eachComponent } from '../../utils/utils';
|
6
|
-
import { editgrid as templates } from '@formio/bootstrap/components';
|
7
|
+
import { fastCloneDeep, Evaluator, getArrayFromComponentPath, eachComponent, getComponentsSchema } from '../../utils/utils';
|
7
8
|
const EditRowState = {
|
8
9
|
New: 'new',
|
9
10
|
Editing: 'editing',
|
@@ -82,7 +83,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
82
83
|
{% if (!instance.options.readOnly && !instance.disabled) { %}
|
83
84
|
<div class="col-sm-2">
|
84
85
|
<div class="btn-group pull-right">
|
85
|
-
<button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('
|
86
|
+
<button class="btn btn-default btn-light btn-sm editRow"><i class="{{ iconClass('pen-fill') }}"></i></button>
|
86
87
|
{% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
|
87
88
|
<button class="btn btn-danger btn-sm removeRow"><i class="{{ iconClass('trash') }}"></i></button>
|
88
89
|
{% } %}
|
@@ -103,7 +104,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
103
104
|
{% if (!instance.options.readOnly && !instance.disabled) { %}
|
104
105
|
<td class="editgrid-table-column">
|
105
106
|
<div class="btn-group">
|
106
|
-
<button class="btn btn-default btn-light btn-sm editRow" aria-label="{{ t('Edit row') }}"><i class="{{ iconClass('
|
107
|
+
<button class="btn btn-default btn-light btn-sm editRow" aria-label="{{ t('Edit row') }}"><i class="{{ iconClass('pen-fill') }}"></i></button>
|
107
108
|
{% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}
|
108
109
|
<button class="btn btn-danger btn-sm removeRow" aria-label="{{ t('Remove row') }}"><i class="{{ iconClass('trash') }}"></i></button>
|
109
110
|
{% } %}
|
@@ -434,11 +435,10 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
434
435
|
action: () => {
|
435
436
|
this.editRow(rowIndex).then(() => {
|
436
437
|
if (this.component.rowDrafts) {
|
437
|
-
this.validateRow(editRow, false);
|
438
|
-
const
|
439
|
-
const shouldShowRowErrorsAlert = this.component.modal && hasErrors && this.root?.submitted;
|
438
|
+
const errors = this.validateRow(editRow, false);
|
439
|
+
const shouldShowRowErrorsAlert = this.component.modal && errors.length && this.root?.submitted;
|
440
440
|
if (shouldShowRowErrorsAlert) {
|
441
|
-
this.alert.showErrors(
|
441
|
+
this.alert.showErrors(errors, false);
|
442
442
|
editRow.alerts = true;
|
443
443
|
}
|
444
444
|
}
|
@@ -606,7 +606,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
606
606
|
component: this.component,
|
607
607
|
row: editRow,
|
608
608
|
});
|
609
|
-
this.
|
609
|
+
this.processRow('checkData', null, {}, editRow.data, editRow.components);
|
610
610
|
if (this.component.modal) {
|
611
611
|
this.addRowModal(rowIndex);
|
612
612
|
}
|
@@ -653,13 +653,14 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
653
653
|
if (!this.component.rowDrafts) {
|
654
654
|
editRow.components.forEach((comp) => comp.setPristine(false));
|
655
655
|
}
|
656
|
-
|
656
|
+
const errors = this.validateRow(editRow, true);
|
657
|
+
if (!errors.length || this.component.rowDrafts) {
|
657
658
|
editRow.willBeSaved = true;
|
658
659
|
dialog.close();
|
659
660
|
this.saveRow(rowIndex, true);
|
660
661
|
}
|
661
662
|
else {
|
662
|
-
this.alert.showErrors(
|
663
|
+
this.alert.showErrors(errors, false);
|
663
664
|
editRow.alerts = true;
|
664
665
|
}
|
665
666
|
},
|
@@ -784,9 +785,9 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
784
785
|
if (!this.component.rowDrafts) {
|
785
786
|
editRow.components.forEach((comp) => comp.setPristine(false));
|
786
787
|
}
|
787
|
-
const
|
788
|
+
const errors = this.validateRow(editRow, true);
|
788
789
|
if (!this.component.rowDrafts) {
|
789
|
-
if (
|
790
|
+
if (errors.length) {
|
790
791
|
return false;
|
791
792
|
}
|
792
793
|
}
|
@@ -812,7 +813,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
812
813
|
}
|
813
814
|
}
|
814
815
|
}
|
815
|
-
editRow.state = this.component.rowDrafts &&
|
816
|
+
editRow.state = this.component.rowDrafts && errors.length ? EditRowState.Draft : EditRowState.Saved;
|
816
817
|
editRow.backup = null;
|
817
818
|
this.updateValue();
|
818
819
|
this.emit('editGridSaveRow', {
|
@@ -919,21 +920,12 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
919
920
|
return;
|
920
921
|
}
|
921
922
|
const editRow = this.editRows[rowIndex];
|
922
|
-
if (editRow
|
923
|
-
this.checkData
|
924
|
-
...flags,
|
925
|
-
changed,
|
926
|
-
rowIndex,
|
927
|
-
}, this.data);
|
928
|
-
}
|
929
|
-
else if (editRow) {
|
930
|
-
// If drafts allowed, perform validation silently if there was no attempt to submit a form
|
931
|
-
const silentCheck = this.component.rowDrafts && !this.shouldValidateDraft(editRow);
|
932
|
-
this.checkRow('checkData', null, {
|
923
|
+
if (editRow) {
|
924
|
+
this.processRow('checkData', null, {
|
933
925
|
...flags,
|
934
926
|
changed,
|
935
|
-
|
936
|
-
|
927
|
+
}, editRow.data, editRow.components);
|
928
|
+
this.validateRow(editRow, false);
|
937
929
|
}
|
938
930
|
if (this.variableTypeComponentsIndexes.length) {
|
939
931
|
this.checkRowVariableTypeComponents(editRow, rowIndex);
|
@@ -949,6 +941,11 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
949
941
|
hasOpenRows() {
|
950
942
|
return this.editRows.some(row => this.isOpen(row));
|
951
943
|
}
|
944
|
+
getAttachedData(data = null) {
|
945
|
+
const ourData = fastCloneDeep(data || this._data || this.rootValue);
|
946
|
+
_.set(ourData, this.key, this.editRows.map((row) => row.data));
|
947
|
+
return ourData;
|
948
|
+
}
|
952
949
|
shouldValidateDraft(editRow) {
|
953
950
|
// Draft rows should be validated only when there was an attempt to submit a form
|
954
951
|
return (editRow.state === EditRowState.Draft &&
|
@@ -959,46 +956,64 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
959
956
|
}
|
960
957
|
shouldValidateRow(editRow, dirty) {
|
961
958
|
return this.shouldValidateDraft(editRow) ||
|
959
|
+
editRow.state === EditRowState.New ||
|
962
960
|
editRow.state === EditRowState.Editing ||
|
963
961
|
editRow.alerts ||
|
964
962
|
dirty;
|
965
963
|
}
|
966
964
|
validateRow(editRow, dirty, forceSilentCheck) {
|
967
|
-
|
968
|
-
const errorsSnapshot = [...this.errors];
|
965
|
+
editRow.errors = [];
|
969
966
|
if (this.shouldValidateRow(editRow, dirty)) {
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
967
|
+
const silentCheck = (this.component.rowDrafts && !this.shouldValidateDraft(editRow)) || forceSilentCheck;
|
968
|
+
const rootValue = fastCloneDeep(this.rootValue);
|
969
|
+
const editGridValue = _.get(rootValue, this.path, []);
|
970
|
+
editGridValue[editRow.rowIndex] = editRow.data;
|
971
|
+
_.set(rootValue, this.path, editGridValue);
|
972
|
+
editRow.errors = processSync({
|
973
|
+
components: fastCloneDeep(this.component.components).map((component) => {
|
974
|
+
component.parentPath = `${this.path}[${editRow.rowIndex}]`;
|
975
|
+
return component;
|
976
|
+
}),
|
977
|
+
data: rootValue,
|
978
|
+
row: editRow.data,
|
979
|
+
process: 'validateRow',
|
980
|
+
instances: this.componentsMap,
|
981
|
+
scope: { errors: [] },
|
982
|
+
processors: [
|
983
|
+
(context) => this.validationProcessor(context, { dirty, silentCheck })
|
984
|
+
]
|
985
|
+
}).errors;
|
974
986
|
}
|
987
|
+
// TODO: this is essentially running its own custom validation and should be moved into a validation rule
|
975
988
|
if (this.component.validate && this.component.validate.row) {
|
976
|
-
valid = this.evaluate(this.component.validate.row, {
|
977
|
-
valid,
|
989
|
+
const valid = this.evaluate(this.component.validate.row, {
|
990
|
+
valid: (editRow.length === 0),
|
978
991
|
row: editRow.data
|
979
992
|
}, 'valid', true);
|
980
993
|
if (valid.toString() !== 'true') {
|
981
|
-
editRow.
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
994
|
+
editRow.errors.push({
|
995
|
+
type: 'error',
|
996
|
+
rowError: true,
|
997
|
+
message: valid.toString()
|
998
|
+
});
|
986
999
|
}
|
987
1000
|
if (valid === null) {
|
988
|
-
|
1001
|
+
editRow.errors.push({
|
1002
|
+
type: 'error',
|
1003
|
+
message: `Invalid row validation for ${this.key}`
|
1004
|
+
});
|
989
1005
|
}
|
990
1006
|
}
|
991
|
-
editRow.errors = !valid ? this.errors.filter((err) => !errorsSnapshot.includes(err)) : null;
|
992
1007
|
if (!this.component.rowDrafts || this.root?.submitted) {
|
993
|
-
this.showRowErrorAlerts(editRow,
|
1008
|
+
this.showRowErrorAlerts(editRow, editRow.errors);
|
994
1009
|
}
|
995
|
-
return
|
1010
|
+
return editRow.errors;
|
996
1011
|
}
|
997
|
-
showRowErrorAlerts(editRow,
|
1012
|
+
showRowErrorAlerts(editRow, errors) {
|
998
1013
|
if (editRow.alerts) {
|
999
1014
|
if (this.alert) {
|
1000
|
-
if (
|
1001
|
-
this.alert.showErrors(
|
1015
|
+
if (errors.length) {
|
1016
|
+
this.alert.showErrors(errors, false);
|
1002
1017
|
editRow.alerts = true;
|
1003
1018
|
}
|
1004
1019
|
else {
|
@@ -1007,39 +1022,34 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1007
1022
|
}
|
1008
1023
|
}
|
1009
1024
|
}
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
return true;
|
1016
|
-
}
|
1017
|
-
return this.checkComponentValidity(data, dirty, row, { silentCheck });
|
1025
|
+
/**
|
1026
|
+
* Return that this component processes its own validation.
|
1027
|
+
*/
|
1028
|
+
get processOwnValidation() {
|
1029
|
+
return true;
|
1018
1030
|
}
|
1019
|
-
checkComponentValidity(data, dirty, row, options = {}) {
|
1031
|
+
checkComponentValidity(data, dirty, row, options = {}, errors = []) {
|
1020
1032
|
const { silentCheck } = options;
|
1021
|
-
const
|
1022
|
-
const superValid = super.checkComponentValidity(data, dirty, row, options);
|
1033
|
+
const superValid = super.checkComponentValidity(data, dirty, row, options, errors);
|
1023
1034
|
// If super tells us that component invalid and there is no need to update alerts, just return false
|
1024
1035
|
if (!superValid && (!this.alert && !this.hasOpenRows())) {
|
1025
1036
|
return false;
|
1026
1037
|
}
|
1027
|
-
if (this.shouldSkipValidation(data, dirty, row)) {
|
1028
|
-
return true;
|
1029
|
-
}
|
1030
|
-
let rowsValid = true;
|
1031
1038
|
let rowsEditing = false;
|
1039
|
+
const allRowErrors = [];
|
1032
1040
|
this.editRows.forEach((editRow, index) => {
|
1033
1041
|
// Trigger all errors on the row.
|
1034
|
-
const
|
1035
|
-
|
1042
|
+
const rowErrors = this.validateRow(editRow, dirty, silentCheck);
|
1043
|
+
errors.push(...rowErrors);
|
1044
|
+
allRowErrors.push(...rowErrors);
|
1036
1045
|
if (this.rowRefs) {
|
1037
1046
|
const rowContainer = this.rowRefs[index];
|
1038
1047
|
if (rowContainer) {
|
1039
1048
|
const errorContainer = rowContainer.querySelector('.editgrid-row-error');
|
1040
|
-
if (
|
1049
|
+
if (rowErrors.length && errorContainer && (!this.component.rowDrafts || this.shouldValidateDraft(editRow))) {
|
1050
|
+
const rowError = rowErrors.find(error => error.rowError);
|
1041
1051
|
this.addClass(errorContainer, 'help-block');
|
1042
|
-
errorContainer.textContent = this.t(this.errorMessage('invalidRowError'));
|
1052
|
+
errorContainer.textContent = this.t(rowError ? rowError.message : this.errorMessage('invalidRowError'));
|
1043
1053
|
}
|
1044
1054
|
else if (errorContainer) {
|
1045
1055
|
errorContainer.textContent = '';
|
@@ -1049,10 +1059,9 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1049
1059
|
// If this is a dirty check, and any rows are still editing, we need to throw validation error.
|
1050
1060
|
rowsEditing |= (dirty && this.isOpen(editRow));
|
1051
1061
|
});
|
1052
|
-
if (
|
1053
|
-
if (!silentCheck && (!this.component.rowDrafts || this.root?.submitted)) {
|
1062
|
+
if (allRowErrors.length) {
|
1063
|
+
if (!silentCheck && (dirty || this.dirty) && (!this.component.rowDrafts || this.root?.submitted)) {
|
1054
1064
|
this.setCustomValidity(this.t(this.errorMessage('invalidRowsError')), dirty);
|
1055
|
-
// Delete this class, because otherwise all the components inside EditGrid will has red border even if they are valid
|
1056
1065
|
this.removeClass(this.element, 'has-error');
|
1057
1066
|
}
|
1058
1067
|
return false;
|
@@ -1062,15 +1071,28 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1062
1071
|
return false;
|
1063
1072
|
}
|
1064
1073
|
const message = this.invalid || this.invalidMessage(data, dirty);
|
1065
|
-
if (
|
1066
|
-
this.setCustomValidity(message, dirty);
|
1067
|
-
this.
|
1074
|
+
if (allRowErrors.length && this.root?.submitted && !message) {
|
1075
|
+
this._errors = this.setCustomValidity(message, dirty);
|
1076
|
+
errors.push(...this._errors);
|
1077
|
+
this.root.showErrors([message]);
|
1068
1078
|
}
|
1069
1079
|
else {
|
1070
|
-
this.setCustomValidity(message, dirty);
|
1080
|
+
this._errors = this.setCustomValidity(message, dirty);
|
1081
|
+
errors.push(...this._errors);
|
1071
1082
|
}
|
1072
1083
|
return superValid;
|
1073
1084
|
}
|
1085
|
+
setRowInvalid(ref, index) {
|
1086
|
+
const editRow = this.editRows[index];
|
1087
|
+
const errorContainer = ref.querySelector('.editgrid-row-error');
|
1088
|
+
if (errorContainer && (!this.component.rowDrafts || this.shouldValidateDraft(editRow))) {
|
1089
|
+
this.addClass(errorContainer, 'help-block');
|
1090
|
+
errorContainer.textContent = this.t(this.errorMessage('invalidRowError'));
|
1091
|
+
}
|
1092
|
+
else if (errorContainer) {
|
1093
|
+
errorContainer.textContent = '';
|
1094
|
+
}
|
1095
|
+
}
|
1074
1096
|
changeState(changed, flags) {
|
1075
1097
|
if (changed || (flags.resetValue && this.component.modalEdit)) {
|
1076
1098
|
this.rebuild();
|
@@ -1092,7 +1114,6 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1092
1114
|
}
|
1093
1115
|
}
|
1094
1116
|
const changed = this.hasChanged(value, this.dataValue);
|
1095
|
-
flags.noValidate = !changed;
|
1096
1117
|
if (this.parent) {
|
1097
1118
|
this.parent.checkComponentConditions();
|
1098
1119
|
}
|
@@ -1105,7 +1126,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1105
1126
|
this.restoreRowContext(editRow, flags);
|
1106
1127
|
editRow.state = EditRowState.Saved;
|
1107
1128
|
editRow.backup = null;
|
1108
|
-
editRow.
|
1129
|
+
editRow.errors = [];
|
1109
1130
|
}
|
1110
1131
|
else {
|
1111
1132
|
this.editRows[rowIndex] = {
|
@@ -1113,7 +1134,7 @@ export default class EditGridComponent extends NestedArrayComponent {
|
|
1113
1134
|
data: row,
|
1114
1135
|
state: EditRowState.Saved,
|
1115
1136
|
backup: null,
|
1116
|
-
|
1137
|
+
errors: [],
|
1117
1138
|
};
|
1118
1139
|
}
|
1119
1140
|
});
|
@@ -282,7 +282,7 @@ export default class FileComponent extends Field {
|
|
282
282
|
}
|
283
283
|
deleteFile(fileInfo) {
|
284
284
|
const { options = {} } = this.component;
|
285
|
-
if (fileInfo && (['url', 'indexeddb'
|
285
|
+
if (fileInfo && (['url', 'indexeddb'].includes(this.component.storage))) {
|
286
286
|
const { fileService } = this;
|
287
287
|
if (fileService && typeof fileService.deleteFile === 'function') {
|
288
288
|
fileService.deleteFile(fileInfo, options);
|
@@ -0,0 +1,29 @@
|
|
1
|
+
declare namespace _default {
|
2
|
+
const type: string;
|
3
|
+
const display: string;
|
4
|
+
const components: ({
|
5
|
+
label: string;
|
6
|
+
tableView: boolean;
|
7
|
+
storage: string;
|
8
|
+
webcam: boolean;
|
9
|
+
fileTypes: {
|
10
|
+
label: string;
|
11
|
+
value: string;
|
12
|
+
}[];
|
13
|
+
key: string;
|
14
|
+
type: string;
|
15
|
+
input: boolean;
|
16
|
+
disableOnInvalid?: undefined;
|
17
|
+
} | {
|
18
|
+
type: string;
|
19
|
+
label: string;
|
20
|
+
key: string;
|
21
|
+
disableOnInvalid: boolean;
|
22
|
+
input: boolean;
|
23
|
+
tableView: boolean;
|
24
|
+
storage?: undefined;
|
25
|
+
webcam?: undefined;
|
26
|
+
fileTypes?: undefined;
|
27
|
+
})[];
|
28
|
+
}
|
29
|
+
export default _default;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
export default {
|
2
|
+
type: 'form',
|
3
|
+
display: 'form',
|
4
|
+
components: [
|
5
|
+
{
|
6
|
+
label: 'Upload',
|
7
|
+
tableView: false,
|
8
|
+
storage: 'base64',
|
9
|
+
webcam: false,
|
10
|
+
fileTypes: [
|
11
|
+
{
|
12
|
+
label: '',
|
13
|
+
value: ''
|
14
|
+
}
|
15
|
+
],
|
16
|
+
key: 'file',
|
17
|
+
type: 'file',
|
18
|
+
input: true
|
19
|
+
},
|
20
|
+
{
|
21
|
+
type: 'button',
|
22
|
+
label: 'Submit',
|
23
|
+
key: 'submit',
|
24
|
+
disableOnInvalid: true,
|
25
|
+
input: true,
|
26
|
+
tableView: false
|
27
|
+
}
|
28
|
+
],
|
29
|
+
};
|
@@ -25,10 +25,6 @@ export default class FormComponent extends Component {
|
|
25
25
|
getSubOptions(options?: {}): {};
|
26
26
|
render(): any;
|
27
27
|
asString(value: any): any;
|
28
|
-
/**
|
29
|
-
* Prints out the value of form components as a datagrid value.
|
30
|
-
*/
|
31
|
-
getValueAsString(value: any): any;
|
32
28
|
attach(element: any): Promise<any>;
|
33
29
|
get hasLoadedForm(): any;
|
34
30
|
get isRevisionChanged(): any;
|
@@ -54,7 +50,7 @@ export default class FormComponent extends Component {
|
|
54
50
|
loadSubForm(fromAttach: any): any;
|
55
51
|
subFormLoading: boolean | undefined;
|
56
52
|
get subFormData(): any;
|
57
|
-
checkComponentValidity(data: any, dirty: any, row: any, options: any): any;
|
53
|
+
checkComponentValidity(data: any, dirty: any, row: any, options: any, errors?: any[]): any;
|
58
54
|
checkComponentConditions(data: any, flags: any, row: any): any;
|
59
55
|
calculateValue(data: any, flags: any, row: any): any;
|
60
56
|
setPristine(pristine: any): void;
|
@@ -74,7 +70,7 @@ export default class FormComponent extends Component {
|
|
74
70
|
*
|
75
71
|
* @return {*}
|
76
72
|
*/
|
77
|
-
submitSubForm(
|
73
|
+
submitSubForm(): any;
|
78
74
|
/**
|
79
75
|
* Submit the form before the next page is triggered.
|
80
76
|
*/
|
@@ -137,7 +137,6 @@ export default class FormComponent extends Component {
|
|
137
137
|
}
|
138
138
|
}
|
139
139
|
getSubOptions(options = {}) {
|
140
|
-
options.parentPath = `${this.path}.data.`;
|
141
140
|
options.events = this.createEmitter();
|
142
141
|
// Make sure to not show the submit button in wizards in the nested forms.
|
143
142
|
_.set(options, 'buttonSettings.showSubmit', false);
|
@@ -186,6 +185,12 @@ export default class FormComponent extends Component {
|
|
186
185
|
if (this.options.onChange) {
|
187
186
|
options.onChange = this.options.onChange;
|
188
187
|
}
|
188
|
+
if (this.options.preview) {
|
189
|
+
options.preview = this.options.preview;
|
190
|
+
}
|
191
|
+
if (this.options.inEditGrid) {
|
192
|
+
options.inEditGrid = this.options.inEditGrid;
|
193
|
+
}
|
189
194
|
return options;
|
190
195
|
}
|
191
196
|
render() {
|
@@ -201,7 +206,7 @@ export default class FormComponent extends Component {
|
|
201
206
|
/**
|
202
207
|
* Prints out the value of form components as a datagrid value.
|
203
208
|
*/
|
204
|
-
getValueAsString(value) {
|
209
|
+
getValueAsString(value, options) {
|
205
210
|
if (!value) {
|
206
211
|
return 'No data provided';
|
207
212
|
}
|
@@ -211,6 +216,33 @@ export default class FormComponent extends Component {
|
|
211
216
|
if (!value.data || !Object.keys(value.data).length) {
|
212
217
|
return 'No data provided';
|
213
218
|
}
|
219
|
+
if (options?.email) {
|
220
|
+
let result = (`
|
221
|
+
<table border="1" style="width:100%">
|
222
|
+
<tbody>
|
223
|
+
`);
|
224
|
+
this.everyComponent((component) => {
|
225
|
+
if (component.isInputComponent && component.visible && !component.skipInEmail) {
|
226
|
+
result += (`
|
227
|
+
<tr>
|
228
|
+
<th style="padding: 5px 10px;">${component.label}</th>
|
229
|
+
<td style="width:100%;padding:5px 10px;">${component.getView(component.dataValue, options)}</td>
|
230
|
+
</tr>
|
231
|
+
`);
|
232
|
+
}
|
233
|
+
}, {
|
234
|
+
...options,
|
235
|
+
fromRoot: true,
|
236
|
+
});
|
237
|
+
result += (`
|
238
|
+
</tbody>
|
239
|
+
</table>
|
240
|
+
`);
|
241
|
+
return result;
|
242
|
+
}
|
243
|
+
if (_.isEmpty(value)) {
|
244
|
+
return '';
|
245
|
+
}
|
214
246
|
return '[Complex Data]';
|
215
247
|
}
|
216
248
|
attach(element) {
|
@@ -386,7 +418,7 @@ export default class FormComponent extends Component {
|
|
386
418
|
return Promise.resolve();
|
387
419
|
}
|
388
420
|
if (this.hasLoadedForm && !this.isRevisionChanged &&
|
389
|
-
!(this.options.pdf && this.useOriginalRevision && _.isNull(this.subForm) && !this.subFormLoading)) {
|
421
|
+
!(this.options.pdf && this.component?.useOriginalRevision && _.isNull(this.subForm) && !this.subFormLoading)) {
|
390
422
|
// Pass config down to sub forms.
|
391
423
|
if (this.root && this.root.form && this.root.form.config && !this.formObj.config) {
|
392
424
|
this.formObj.config = this.root.form.config;
|
@@ -398,6 +430,9 @@ export default class FormComponent extends Component {
|
|
398
430
|
return (new Formio(this.formSrc)).loadForm({ params: { live: 1 } })
|
399
431
|
.then((formObj) => {
|
400
432
|
this.formObj = formObj;
|
433
|
+
if (this.options.pdf && this.component.useOriginalRevision) {
|
434
|
+
this.formObj.display = 'form';
|
435
|
+
}
|
401
436
|
this.subFormLoading = false;
|
402
437
|
return formObj;
|
403
438
|
})
|
@@ -411,13 +446,13 @@ export default class FormComponent extends Component {
|
|
411
446
|
get subFormData() {
|
412
447
|
return this.dataValue?.data || {};
|
413
448
|
}
|
414
|
-
checkComponentValidity(data, dirty, row, options) {
|
449
|
+
checkComponentValidity(data, dirty, row, options, errors = []) {
|
415
450
|
options = options || {};
|
416
451
|
const silentCheck = options.silentCheck || false;
|
417
452
|
if (this.subForm) {
|
418
|
-
return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck);
|
453
|
+
return this.subForm.checkValidity(this.subFormData, dirty, null, silentCheck, errors);
|
419
454
|
}
|
420
|
-
return super.checkComponentValidity(data, dirty, row, options);
|
455
|
+
return super.checkComponentValidity(data, dirty, row, options, errors);
|
421
456
|
}
|
422
457
|
checkComponentConditions(data, flags, row) {
|
423
458
|
const visible = super.checkComponentConditions(data, flags, row);
|
@@ -476,7 +511,7 @@ export default class FormComponent extends Component {
|
|
476
511
|
*
|
477
512
|
* @return {*}
|
478
513
|
*/
|
479
|
-
submitSubForm(
|
514
|
+
submitSubForm() {
|
480
515
|
// If we wish to submit the form on next page, then do that here.
|
481
516
|
if (this.shouldSubmit) {
|
482
517
|
return this.subFormReady.then(() => {
|
@@ -484,6 +519,7 @@ export default class FormComponent extends Component {
|
|
484
519
|
return this.dataValue;
|
485
520
|
}
|
486
521
|
this.subForm.nosubmit = false;
|
522
|
+
this.subForm.submitted = true;
|
487
523
|
return this.subForm.submitForm().then(result => {
|
488
524
|
this.subForm.loading = false;
|
489
525
|
this.subForm.showAllErrors = false;
|
@@ -491,13 +527,8 @@ export default class FormComponent extends Component {
|
|
491
527
|
return this.dataValue;
|
492
528
|
}).catch(err => {
|
493
529
|
this.subForm.showAllErrors = true;
|
494
|
-
|
495
|
-
|
496
|
-
return Promise.reject(err);
|
497
|
-
}
|
498
|
-
else {
|
499
|
-
return {};
|
500
|
-
}
|
530
|
+
this.subForm.onSubmissionError(err);
|
531
|
+
return Promise.reject(err);
|
501
532
|
});
|
502
533
|
});
|
503
534
|
}
|
@@ -44,7 +44,6 @@ declare namespace _default {
|
|
44
44
|
export { TextAreaComponent as textarea };
|
45
45
|
export { TextFieldComponent as textfield };
|
46
46
|
export { TimeComponent as time };
|
47
|
-
export { TreeComponent as tree };
|
48
47
|
export { UnknownComponent as unknown };
|
49
48
|
export { UrlComponent as url };
|
50
49
|
export { WellComponent as well };
|
@@ -94,7 +93,6 @@ import TagsComponent from './tags/Tags';
|
|
94
93
|
import TextAreaComponent from './textarea/TextArea';
|
95
94
|
import TextFieldComponent from './textfield/TextField';
|
96
95
|
import TimeComponent from './time/Time';
|
97
|
-
import TreeComponent from './tree/Tree';
|
98
96
|
import UnknownComponent from './unknown/Unknown';
|
99
97
|
import UrlComponent from './url/Url';
|
100
98
|
import WellComponent from './well/Well';
|
@@ -42,7 +42,6 @@ import TagsComponent from './tags/Tags';
|
|
42
42
|
import TextAreaComponent from './textarea/TextArea';
|
43
43
|
import TextFieldComponent from './textfield/TextField';
|
44
44
|
import TimeComponent from './time/Time';
|
45
|
-
import TreeComponent from './tree/Tree';
|
46
45
|
import UnknownComponent from './unknown/Unknown';
|
47
46
|
import UrlComponent from './url/Url';
|
48
47
|
import WellComponent from './well/Well';
|
@@ -92,7 +91,6 @@ export default {
|
|
92
91
|
textarea: TextAreaComponent,
|
93
92
|
textfield: TextFieldComponent,
|
94
93
|
time: TimeComponent,
|
95
|
-
tree: TreeComponent,
|
96
94
|
unknown: UnknownComponent,
|
97
95
|
url: UrlComponent,
|
98
96
|
well: WellComponent,
|
@@ -31,10 +31,9 @@ export default class NumberComponent extends Input {
|
|
31
31
|
};
|
32
32
|
static savedValueTypes(schema: any): string[];
|
33
33
|
constructor(...args: any[]);
|
34
|
-
|
34
|
+
decimalSeparator: any;
|
35
35
|
delimiter: any;
|
36
36
|
decimalLimit: any;
|
37
|
-
decimalSeparator: any;
|
38
37
|
numberMask: any;
|
39
38
|
/**
|
40
39
|
* Creates the number mask for normal numbers.
|