@formio/js 5.2.4-rc.0 → 5.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/formio.builder.css +50 -161
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.embed.js +1 -1
- package/dist/formio.embed.min.js +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.css +49 -158
- package/dist/formio.form.js +108 -152
- package/dist/formio.form.min.css +1 -1
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.css +50 -161
- package/dist/formio.full.js +227 -401
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +18 -51
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +14 -47
- package/dist/formio.utils.min.js +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/lib/cjs/CDN.js +12 -12
- package/lib/cjs/Element.d.ts +2 -3
- package/lib/cjs/Element.js +26 -29
- package/lib/cjs/Embed.js +42 -75
- package/lib/cjs/EventEmitter.js +1 -1
- package/lib/cjs/Form.d.ts +341 -371
- package/lib/cjs/Form.js +39 -153
- package/lib/cjs/FormBuilder.d.ts +3 -3
- package/lib/cjs/FormBuilder.js +3 -2
- package/lib/cjs/Formio.js +23 -26
- package/lib/cjs/InlineEmbed.js +17 -23
- package/lib/cjs/PDF.d.ts +0 -1
- package/lib/cjs/PDF.js +15 -18
- package/lib/cjs/PDFBuilder.js +36 -51
- package/lib/cjs/Webform.d.ts +366 -8
- package/lib/cjs/Webform.js +238 -177
- package/lib/cjs/WebformBuilder.js +152 -221
- package/lib/cjs/Wizard.js +65 -95
- package/lib/cjs/WizardBuilder.js +19 -27
- package/lib/cjs/addons/FormioAddon.js +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +57 -59
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +16 -24
- package/lib/cjs/addons/index.js +3 -3
- package/lib/cjs/components/Components.js +4 -0
- package/lib/cjs/components/_classes/component/Component.form.js +11 -11
- package/lib/cjs/components/_classes/component/Component.js +198 -309
- package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.js +4 -2
- package/lib/cjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +11 -9
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +25 -39
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +29 -47
- package/lib/cjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +7 -5
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +34 -37
- package/lib/cjs/components/_classes/component/editForm/utils.js +16 -12
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +6 -6
- package/lib/cjs/components/_classes/field/Field.js +1 -7
- package/lib/cjs/components/_classes/input/Input.js +26 -30
- package/lib/cjs/components/_classes/list/ListComponent.form.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +18 -27
- package/lib/cjs/components/_classes/list/editForm/ListComponent.edit.data.js +9 -36
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +13 -32
- package/lib/cjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +3 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.js +75 -67
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +14 -19
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +17 -19
- package/lib/cjs/components/address/Address.d.ts +0 -1
- package/lib/cjs/components/address/Address.js +52 -57
- package/lib/cjs/components/address/editForm/Address.edit.data.js +2 -2
- package/lib/cjs/components/address/editForm/Address.edit.display.js +2 -2
- package/lib/cjs/components/address/editForm/Address.edit.provider.js +11 -53
- package/lib/cjs/components/alert/Alert.js +15 -21
- package/lib/cjs/components/button/Button.form.js +1 -1
- package/lib/cjs/components/button/Button.js +47 -64
- package/lib/cjs/components/button/editForm/Button.edit.display.js +9 -49
- package/lib/cjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/cjs/components/checkbox/Checkbox.form.js +3 -3
- package/lib/cjs/components/checkbox/Checkbox.js +20 -28
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +3 -13
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.validation.js +2 -2
- package/lib/cjs/components/columns/Columns.form.js +1 -1
- package/lib/cjs/components/columns/Columns.js +12 -24
- package/lib/cjs/components/columns/editForm/Columns.edit.display.js +17 -17
- package/lib/cjs/components/container/Container.form.js +2 -2
- package/lib/cjs/components/container/Container.js +4 -6
- package/lib/cjs/components/container/editForm/Container.edit.data.js +3 -3
- package/lib/cjs/components/container/editForm/Container.edit.display.js +4 -4
- package/lib/cjs/components/content/Content.form.js +2 -4
- package/lib/cjs/components/content/Content.js +8 -10
- package/lib/cjs/components/content/editForm/Content.edit.display.js +10 -10
- package/lib/cjs/components/currency/Currency.form.js +3 -3
- package/lib/cjs/components/currency/Currency.js +10 -19
- package/lib/cjs/components/currency/editForm/Currency.edit.data.js +5 -5
- package/lib/cjs/components/currency/editForm/Currency.edit.display.js +8 -8
- package/lib/cjs/components/datagrid/DataGrid.form.js +3 -3
- package/lib/cjs/components/datagrid/DataGrid.js +42 -92
- package/lib/cjs/components/datagrid/editForm/DataGrid.edit.data.js +1 -1
- package/lib/cjs/components/datagrid/editForm/DataGrid.edit.display.js +14 -14
- package/lib/cjs/components/datagrid/editForm/DataGrid.edit.validation.js +3 -3
- package/lib/cjs/components/datamap/DataMap.form.js +2 -2
- package/lib/cjs/components/datamap/DataMap.js +35 -46
- package/lib/cjs/components/datamap/editForm/DataMap.edit.data.js +1 -1
- package/lib/cjs/components/datamap/editForm/DataMap.edit.display.js +8 -8
- package/lib/cjs/components/datetime/DateTime.form.js +5 -5
- package/lib/cjs/components/datetime/DateTime.js +15 -30
- package/lib/cjs/components/datetime/editForm/DateTime.edit.data.js +3 -4
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
- package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +17 -22
- package/lib/cjs/components/datetime/editForm/DateTime.edit.time.js +5 -5
- package/lib/cjs/components/datetime/editForm/DateTime.edit.validation.js +3 -3
- package/lib/cjs/components/day/Day.form.js +5 -5
- package/lib/cjs/components/day/Day.js +58 -147
- package/lib/cjs/components/day/editForm/Day.edit.day.js +9 -13
- package/lib/cjs/components/day/editForm/Day.edit.display.js +7 -7
- package/lib/cjs/components/day/editForm/Day.edit.month.js +8 -12
- package/lib/cjs/components/day/editForm/Day.edit.validation.js +7 -7
- package/lib/cjs/components/day/editForm/Day.edit.year.js +8 -8
- package/lib/cjs/components/editgrid/EditGrid.form.js +2 -2
- package/lib/cjs/components/editgrid/EditGrid.js +96 -142
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -7
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.templates.js +16 -16
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.validation.js +3 -3
- package/lib/cjs/components/email/Email.js +4 -4
- package/lib/cjs/components/email/editForm/Email.edit.display.js +3 -3
- package/lib/cjs/components/email/editForm/Email.edit.validation.js +6 -6
- package/lib/cjs/components/fieldset/Fieldset.form.js +1 -1
- package/lib/cjs/components/fieldset/Fieldset.js +2 -2
- package/lib/cjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -8
- package/lib/cjs/components/file/File.form.js +4 -4
- package/lib/cjs/components/file/File.js +90 -131
- package/lib/cjs/components/file/editForm/File.edit.display.js +5 -9
- package/lib/cjs/components/file/editForm/File.edit.file.js +53 -97
- package/lib/cjs/components/file/editForm/File.edit.validation.js +2 -2
- package/lib/cjs/components/form/Form.form.js +3 -3
- package/lib/cjs/components/form/Form.js +58 -68
- package/lib/cjs/components/form/editForm/Form.edit.data.js +3 -1
- package/lib/cjs/components/form/editForm/Form.edit.display.js +7 -6
- package/lib/cjs/components/form/editForm/Form.edit.form.js +9 -11
- package/lib/cjs/components/hidden/Hidden.form.js +4 -4
- package/lib/cjs/components/hidden/Hidden.js +2 -2
- package/lib/cjs/components/hidden/editForm/Hidden.edit.data.js +3 -3
- package/lib/cjs/components/hidden/editForm/Hidden.edit.display.js +10 -10
- package/lib/cjs/components/html/HTML.js +17 -23
- package/lib/cjs/components/html/editForm/HTML.edit.display.js +17 -17
- package/lib/cjs/components/html/editForm/HTML.edit.logic.js +2 -2
- package/lib/cjs/components/number/Number.form.js +3 -3
- package/lib/cjs/components/number/Number.js +11 -27
- package/lib/cjs/components/number/editForm/Number.edit.data.js +3 -3
- package/lib/cjs/components/number/editForm/Number.edit.display.js +4 -4
- package/lib/cjs/components/number/editForm/Number.edit.validation.js +9 -9
- package/lib/cjs/components/panel/Panel.form.js +1 -1
- package/lib/cjs/components/panel/Panel.js +2 -2
- package/lib/cjs/components/panel/editForm/Panel.edit.conditional.js +7 -5
- package/lib/cjs/components/panel/editForm/Panel.edit.display.js +29 -55
- package/lib/cjs/components/password/Password.form.js +3 -3
- package/lib/cjs/components/password/Password.js +2 -5
- package/lib/cjs/components/password/editForm/Password.edit.data.js +11 -11
- package/lib/cjs/components/password/editForm/Password.edit.display.js +3 -3
- package/lib/cjs/components/password/editForm/Password.edit.validation.js +3 -3
- package/lib/cjs/components/phonenumber/PhoneNumber.form.js +8 -8
- package/lib/cjs/components/phonenumber/PhoneNumber.js +3 -3
- package/lib/cjs/components/phonenumber/editForm/PhoneNumber.edit.validation.js +6 -6
- package/lib/cjs/components/radio/Radio.form.js +3 -3
- package/lib/cjs/components/radio/Radio.js +32 -58
- package/lib/cjs/components/radio/editForm/Radio.edit.data.js +9 -23
- package/lib/cjs/components/radio/editForm/Radio.edit.display.js +6 -6
- package/lib/cjs/components/radio/editForm/Radio.edit.validation.js +2 -2
- package/lib/cjs/components/recaptcha/ReCaptcha.form.js +5 -5
- package/lib/cjs/components/recaptcha/ReCaptcha.js +10 -10
- package/lib/cjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +24 -24
- package/lib/cjs/components/select/Select.form.js +3 -3
- package/lib/cjs/components/select/Select.js +140 -235
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +57 -191
- package/lib/cjs/components/select/editForm/Select.edit.display.js +2 -2
- package/lib/cjs/components/select/editForm/Select.edit.validation.js +4 -4
- package/lib/cjs/components/selectboxes/SelectBoxes.form.js +3 -3
- package/lib/cjs/components/selectboxes/SelectBoxes.js +16 -29
- package/lib/cjs/components/selectboxes/editForm/SelectBoxes.edit.validation.js +5 -5
- package/lib/cjs/components/signature/Signature.form.js +3 -3
- package/lib/cjs/components/signature/Signature.js +17 -26
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +10 -19
- package/lib/cjs/components/survey/Survey.form.js +3 -3
- package/lib/cjs/components/survey/Survey.js +17 -30
- package/lib/cjs/components/survey/editForm/Survey.edit.data.js +11 -23
- package/lib/cjs/components/survey/editForm/Survey.edit.display.js +1 -1
- package/lib/cjs/components/survey/editForm/Survey.edit.validation.js +1 -1
- package/lib/cjs/components/table/Table.form.js +1 -1
- package/lib/cjs/components/table/Table.js +7 -8
- package/lib/cjs/components/table/editForm/Table.edit.display.js +22 -22
- package/lib/cjs/components/tabs/Tabs.form.js +1 -1
- package/lib/cjs/components/tabs/Tabs.js +10 -27
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +17 -21
- package/lib/cjs/components/tags/Tags.form.js +1 -1
- package/lib/cjs/components/tags/Tags.js +12 -28
- package/lib/cjs/components/tags/editForm/Tags.edit.data.js +7 -7
- package/lib/cjs/components/textarea/TextArea.form.js +2 -2
- package/lib/cjs/components/textarea/TextArea.js +45 -63
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +72 -96
- package/lib/cjs/components/textarea/editForm/TextArea.edit.validation.js +3 -3
- package/lib/cjs/components/textfield/TextField.form.js +3 -3
- package/lib/cjs/components/textfield/TextField.js +21 -32
- package/lib/cjs/components/textfield/editForm/TextField.edit.data.js +13 -15
- package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +21 -31
- package/lib/cjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
- package/lib/cjs/components/time/Time.js +10 -17
- package/lib/cjs/components/time/editForm/Time.edit.display.js +2 -2
- package/lib/cjs/components/unknown/Unknown.form.js +5 -5
- package/lib/cjs/components/unknown/Unknown.js +2 -2
- package/lib/cjs/components/unknown/editForm/Unknown.edit.display.js +3 -3
- package/lib/cjs/components/url/Url.form.js +3 -3
- package/lib/cjs/components/url/Url.js +2 -2
- package/lib/cjs/components/url/editForm/Url.edit.display.js +3 -3
- package/lib/cjs/components/url/editForm/Url.edit.validation.js +1 -1
- package/lib/cjs/components/well/Well.form.js +1 -1
- package/lib/cjs/components/well/Well.js +2 -2
- package/lib/cjs/components/well/editForm/Well.edit.display.js +10 -10
- package/lib/cjs/formio.form.d.ts +1 -2
- package/lib/cjs/formio.form.js +12 -38
- package/lib/cjs/i18n.d.ts +0 -4
- package/lib/cjs/i18n.js +3 -7
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/pdf.image.d.ts +2 -0
- package/lib/cjs/pdf.image.js +94 -0
- package/lib/cjs/providers/address/AddressProvider.js +5 -8
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +3 -3
- package/lib/cjs/providers/address/GoogleAddressProvider.js +13 -24
- package/lib/cjs/providers/processor/fileProcessor.js +1 -3
- package/lib/cjs/providers/storage/azure.js +2 -5
- package/lib/cjs/providers/storage/dropbox.js +5 -4
- package/lib/cjs/providers/storage/googleDrive.js +4 -3
- package/lib/cjs/providers/storage/index.js +1 -1
- package/lib/cjs/providers/storage/indexeddb.js +6 -16
- package/lib/cjs/providers/storage/s3.js +6 -17
- package/lib/cjs/providers/storage/uploadAdapter.js +11 -17
- package/lib/cjs/providers/storage/url.js +11 -13
- package/lib/cjs/providers/storage/xhr.js +9 -17
- package/lib/cjs/templates/index.js +1 -1
- package/lib/cjs/translations/en.d.ts +2 -0
- package/lib/cjs/translations/en.js +9 -7
- package/lib/cjs/utils/ChoicesWrapper.js +2 -2
- package/lib/cjs/utils/builder.js +7 -31
- package/lib/cjs/utils/calendarUtils.js +5 -7
- package/lib/cjs/utils/conditionOperators/ConditionOperator.js +1 -1
- package/lib/cjs/utils/conditionOperators/DateGreaterThan.js +4 -12
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +1 -3
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +6 -10
- package/lib/cjs/utils/conditionOperators/index.js +1 -1
- package/lib/cjs/utils/formUtils.js +1 -1
- package/lib/cjs/utils/i18n.js +1 -7
- package/lib/cjs/utils/index.d.ts +1 -2
- package/lib/cjs/utils/index.js +2 -2
- package/lib/cjs/utils/jsonlogic/operators.d.ts +1 -0
- package/lib/cjs/utils/jsonlogic/operators.js +265 -0
- package/lib/cjs/utils/utils.d.ts +1 -10
- package/lib/cjs/utils/utils.js +92 -175
- package/lib/cjs/widgets/CalendarWidget.js +49 -66
- package/lib/cjs/widgets/InputWidget.js +4 -6
- package/lib/cjs/widgets/index.js +1 -1
- package/lib/mjs/CDN.js +12 -12
- package/lib/mjs/Element.d.ts +2 -3
- package/lib/mjs/Element.js +23 -29
- package/lib/mjs/Embed.js +43 -77
- package/lib/mjs/EventEmitter.js +1 -1
- package/lib/mjs/Form.d.ts +341 -371
- package/lib/mjs/Form.js +126 -142
- package/lib/mjs/FormBuilder.d.ts +3 -3
- package/lib/mjs/FormBuilder.js +3 -2
- package/lib/mjs/Formio.js +23 -26
- package/lib/mjs/InlineEmbed.js +17 -23
- package/lib/mjs/PDF.d.ts +0 -1
- package/lib/mjs/PDF.js +15 -18
- package/lib/mjs/PDFBuilder.js +36 -51
- package/lib/mjs/Webform.d.ts +366 -8
- package/lib/mjs/Webform.js +251 -184
- package/lib/mjs/WebformBuilder.js +151 -224
- package/lib/mjs/Wizard.js +64 -94
- package/lib/mjs/WizardBuilder.js +19 -27
- package/lib/mjs/addons/FormioAddon.js +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +57 -59
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +16 -24
- package/lib/mjs/addons/index.js +3 -3
- package/lib/mjs/components/Components.js +4 -0
- package/lib/mjs/components/_classes/component/Component.form.js +11 -11
- package/lib/mjs/components/_classes/component/Component.js +194 -313
- package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.js +4 -2
- package/lib/mjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +11 -9
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +0 -37
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +25 -39
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +29 -47
- package/lib/mjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +7 -5
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +34 -37
- package/lib/mjs/components/_classes/component/editForm/utils.js +16 -12
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +2 -2
- package/lib/mjs/components/_classes/field/Field.js +2 -8
- package/lib/mjs/components/_classes/input/Input.js +23 -27
- package/lib/mjs/components/_classes/list/ListComponent.form.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +18 -27
- package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +9 -36
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +13 -32
- package/lib/mjs/components/_classes/nested/NestedComponent.d.ts +1 -1
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +3 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.js +33 -41
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +15 -20
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +17 -19
- package/lib/mjs/components/address/Address.d.ts +0 -1
- package/lib/mjs/components/address/Address.js +49 -60
- package/lib/mjs/components/address/editForm/Address.edit.data.js +2 -2
- package/lib/mjs/components/address/editForm/Address.edit.display.js +2 -2
- package/lib/mjs/components/address/editForm/Address.edit.provider.js +11 -53
- package/lib/mjs/components/alert/Alert.js +16 -22
- package/lib/mjs/components/button/Button.form.js +1 -1
- package/lib/mjs/components/button/Button.js +42 -65
- package/lib/mjs/components/button/editForm/Button.edit.display.js +9 -49
- package/lib/mjs/components/checkbox/Checkbox.d.ts +1 -1
- package/lib/mjs/components/checkbox/Checkbox.form.js +3 -3
- package/lib/mjs/components/checkbox/Checkbox.js +21 -29
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +3 -13
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.validation.js +2 -2
- package/lib/mjs/components/columns/Columns.form.js +1 -1
- package/lib/mjs/components/columns/Columns.js +12 -24
- package/lib/mjs/components/columns/editForm/Columns.edit.display.js +17 -17
- package/lib/mjs/components/container/Container.form.js +2 -2
- package/lib/mjs/components/container/Container.js +4 -6
- package/lib/mjs/components/container/editForm/Container.edit.data.js +3 -3
- package/lib/mjs/components/container/editForm/Container.edit.display.js +4 -4
- package/lib/mjs/components/content/Content.form.js +2 -4
- package/lib/mjs/components/content/Content.js +8 -10
- package/lib/mjs/components/content/editForm/Content.edit.display.js +10 -10
- package/lib/mjs/components/currency/Currency.form.js +3 -3
- package/lib/mjs/components/currency/Currency.js +10 -19
- package/lib/mjs/components/currency/editForm/Currency.edit.data.js +5 -5
- package/lib/mjs/components/currency/editForm/Currency.edit.display.js +8 -8
- package/lib/mjs/components/datagrid/DataGrid.form.js +3 -3
- package/lib/mjs/components/datagrid/DataGrid.js +41 -92
- package/lib/mjs/components/datagrid/editForm/DataGrid.edit.data.js +1 -1
- package/lib/mjs/components/datagrid/editForm/DataGrid.edit.display.js +14 -14
- package/lib/mjs/components/datagrid/editForm/DataGrid.edit.validation.js +3 -3
- package/lib/mjs/components/datamap/DataMap.form.js +2 -2
- package/lib/mjs/components/datamap/DataMap.js +33 -46
- package/lib/mjs/components/datamap/editForm/DataMap.edit.data.js +1 -1
- package/lib/mjs/components/datamap/editForm/DataMap.edit.display.js +8 -8
- package/lib/mjs/components/datetime/DateTime.form.js +5 -5
- package/lib/mjs/components/datetime/DateTime.js +16 -31
- package/lib/mjs/components/datetime/editForm/DateTime.edit.data.js +3 -4
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
- package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +17 -22
- package/lib/mjs/components/datetime/editForm/DateTime.edit.time.js +5 -5
- package/lib/mjs/components/datetime/editForm/DateTime.edit.validation.js +3 -3
- package/lib/mjs/components/day/Day.form.js +5 -5
- package/lib/mjs/components/day/Day.js +58 -148
- package/lib/mjs/components/day/editForm/Day.edit.day.js +9 -13
- package/lib/mjs/components/day/editForm/Day.edit.display.js +7 -7
- package/lib/mjs/components/day/editForm/Day.edit.month.js +8 -12
- package/lib/mjs/components/day/editForm/Day.edit.validation.js +7 -7
- package/lib/mjs/components/day/editForm/Day.edit.year.js +8 -8
- package/lib/mjs/components/editgrid/EditGrid.form.js +2 -2
- package/lib/mjs/components/editgrid/EditGrid.js +92 -140
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +2 -7
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.templates.js +16 -16
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.validation.js +3 -3
- package/lib/mjs/components/email/Email.js +4 -4
- package/lib/mjs/components/email/editForm/Email.edit.display.js +3 -3
- package/lib/mjs/components/email/editForm/Email.edit.validation.js +6 -6
- package/lib/mjs/components/fieldset/Fieldset.form.js +1 -1
- package/lib/mjs/components/fieldset/Fieldset.js +2 -2
- package/lib/mjs/components/fieldset/editForm/Fieldset.edit.display.js +8 -8
- package/lib/mjs/components/file/File.form.js +4 -4
- package/lib/mjs/components/file/File.js +89 -136
- package/lib/mjs/components/file/editForm/File.edit.display.js +5 -9
- package/lib/mjs/components/file/editForm/File.edit.file.js +53 -97
- package/lib/mjs/components/file/editForm/File.edit.validation.js +2 -2
- package/lib/mjs/components/form/Form.form.js +3 -3
- package/lib/mjs/components/form/Form.js +55 -68
- package/lib/mjs/components/form/editForm/Form.edit.data.js +3 -1
- package/lib/mjs/components/form/editForm/Form.edit.display.js +7 -6
- package/lib/mjs/components/form/editForm/Form.edit.form.js +8 -10
- package/lib/mjs/components/hidden/Hidden.form.js +4 -4
- package/lib/mjs/components/hidden/Hidden.js +2 -2
- package/lib/mjs/components/hidden/editForm/Hidden.edit.data.js +3 -3
- package/lib/mjs/components/hidden/editForm/Hidden.edit.display.js +10 -10
- package/lib/mjs/components/html/HTML.js +17 -23
- package/lib/mjs/components/html/editForm/HTML.edit.display.js +17 -17
- package/lib/mjs/components/html/editForm/HTML.edit.logic.js +2 -2
- package/lib/mjs/components/number/Number.form.js +3 -3
- package/lib/mjs/components/number/Number.js +12 -28
- package/lib/mjs/components/number/editForm/Number.edit.data.js +3 -3
- package/lib/mjs/components/number/editForm/Number.edit.display.js +4 -4
- package/lib/mjs/components/number/editForm/Number.edit.validation.js +9 -9
- package/lib/mjs/components/panel/Panel.form.js +1 -1
- package/lib/mjs/components/panel/Panel.js +2 -2
- package/lib/mjs/components/panel/editForm/Panel.edit.conditional.js +8 -6
- package/lib/mjs/components/panel/editForm/Panel.edit.display.js +29 -55
- package/lib/mjs/components/password/Password.form.js +3 -3
- package/lib/mjs/components/password/Password.js +2 -5
- package/lib/mjs/components/password/editForm/Password.edit.data.js +11 -11
- package/lib/mjs/components/password/editForm/Password.edit.display.js +3 -3
- package/lib/mjs/components/password/editForm/Password.edit.validation.js +3 -3
- package/lib/mjs/components/phonenumber/PhoneNumber.form.js +8 -8
- package/lib/mjs/components/phonenumber/PhoneNumber.js +3 -3
- package/lib/mjs/components/phonenumber/editForm/PhoneNumber.edit.validation.js +6 -6
- package/lib/mjs/components/radio/Radio.form.js +3 -3
- package/lib/mjs/components/radio/Radio.js +30 -59
- package/lib/mjs/components/radio/editForm/Radio.edit.data.js +9 -23
- package/lib/mjs/components/radio/editForm/Radio.edit.display.js +6 -6
- package/lib/mjs/components/radio/editForm/Radio.edit.validation.js +2 -2
- package/lib/mjs/components/recaptcha/ReCaptcha.form.js +5 -5
- package/lib/mjs/components/recaptcha/ReCaptcha.js +8 -10
- package/lib/mjs/components/recaptcha/editForm/ReCaptcha.edit.display.js +24 -24
- package/lib/mjs/components/select/Select.form.js +3 -3
- package/lib/mjs/components/select/Select.js +145 -240
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +57 -191
- package/lib/mjs/components/select/editForm/Select.edit.display.js +2 -2
- package/lib/mjs/components/select/editForm/Select.edit.validation.js +4 -4
- package/lib/mjs/components/selectboxes/SelectBoxes.form.js +3 -3
- package/lib/mjs/components/selectboxes/SelectBoxes.js +16 -30
- package/lib/mjs/components/selectboxes/editForm/SelectBoxes.edit.validation.js +5 -5
- package/lib/mjs/components/signature/Signature.form.js +3 -3
- package/lib/mjs/components/signature/Signature.js +16 -26
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +10 -19
- package/lib/mjs/components/survey/Survey.form.js +3 -3
- package/lib/mjs/components/survey/Survey.js +17 -30
- package/lib/mjs/components/survey/editForm/Survey.edit.data.js +11 -23
- package/lib/mjs/components/survey/editForm/Survey.edit.display.js +1 -1
- package/lib/mjs/components/survey/editForm/Survey.edit.validation.js +1 -1
- package/lib/mjs/components/table/Table.form.js +1 -1
- package/lib/mjs/components/table/Table.js +6 -8
- package/lib/mjs/components/table/editForm/Table.edit.display.js +22 -22
- package/lib/mjs/components/tabs/Tabs.form.js +1 -1
- package/lib/mjs/components/tabs/Tabs.js +9 -27
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +17 -21
- package/lib/mjs/components/tags/Tags.form.js +1 -1
- package/lib/mjs/components/tags/Tags.js +12 -28
- package/lib/mjs/components/tags/editForm/Tags.edit.data.js +7 -7
- package/lib/mjs/components/textarea/TextArea.form.js +2 -2
- package/lib/mjs/components/textarea/TextArea.js +51 -75
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +72 -96
- package/lib/mjs/components/textarea/editForm/TextArea.edit.validation.js +3 -3
- package/lib/mjs/components/textfield/TextField.form.js +3 -3
- package/lib/mjs/components/textfield/TextField.js +23 -34
- package/lib/mjs/components/textfield/editForm/TextField.edit.data.js +13 -15
- package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +21 -31
- package/lib/mjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
- package/lib/mjs/components/time/Time.js +10 -17
- package/lib/mjs/components/time/editForm/Time.edit.display.js +2 -2
- package/lib/mjs/components/unknown/Unknown.form.js +5 -5
- package/lib/mjs/components/unknown/Unknown.js +2 -2
- package/lib/mjs/components/unknown/editForm/Unknown.edit.display.js +3 -3
- package/lib/mjs/components/url/Url.form.js +3 -3
- package/lib/mjs/components/url/Url.js +2 -2
- package/lib/mjs/components/url/editForm/Url.edit.display.js +3 -3
- package/lib/mjs/components/url/editForm/Url.edit.validation.js +1 -1
- package/lib/mjs/components/well/Well.form.js +1 -1
- package/lib/mjs/components/well/Well.js +2 -2
- package/lib/mjs/components/well/editForm/Well.edit.display.js +10 -10
- package/lib/mjs/formio.form.d.ts +1 -2
- package/lib/mjs/formio.form.js +8 -10
- package/lib/mjs/i18n.d.ts +0 -4
- package/lib/mjs/i18n.js +3 -7
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/pdf.image.d.ts +2 -0
- package/lib/mjs/pdf.image.js +94 -0
- package/lib/mjs/providers/address/AddressProvider.js +5 -8
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +3 -3
- package/lib/mjs/providers/address/GoogleAddressProvider.js +13 -24
- package/lib/mjs/providers/processor/fileProcessor.js +1 -3
- package/lib/mjs/providers/storage/azure.js +2 -5
- package/lib/mjs/providers/storage/dropbox.js +5 -4
- package/lib/mjs/providers/storage/googleDrive.js +4 -3
- package/lib/mjs/providers/storage/index.js +1 -1
- package/lib/mjs/providers/storage/indexeddb.js +6 -16
- package/lib/mjs/providers/storage/s3.js +8 -19
- package/lib/mjs/providers/storage/uploadAdapter.js +11 -17
- package/lib/mjs/providers/storage/url.js +11 -13
- package/lib/mjs/providers/storage/xhr.js +9 -17
- package/lib/mjs/templates/index.js +1 -1
- package/lib/mjs/translations/en.d.ts +2 -0
- package/lib/mjs/translations/en.js +9 -7
- package/lib/mjs/utils/ChoicesWrapper.js +2 -2
- package/lib/mjs/utils/builder.js +7 -31
- package/lib/mjs/utils/calendarUtils.js +5 -7
- package/lib/mjs/utils/conditionOperators/ConditionOperator.js +1 -1
- package/lib/mjs/utils/conditionOperators/DateGreaterThan.js +5 -16
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +1 -3
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +6 -10
- package/lib/mjs/utils/conditionOperators/index.js +1 -1
- package/lib/mjs/utils/formUtils.js +2 -2
- package/lib/mjs/utils/i18n.js +1 -7
- package/lib/mjs/utils/index.d.ts +1 -2
- package/lib/mjs/utils/index.js +3 -3
- package/lib/mjs/utils/jsonlogic/operators.d.ts +1 -0
- package/lib/mjs/utils/jsonlogic/operators.js +262 -0
- package/lib/mjs/utils/utils.d.ts +1 -10
- package/lib/mjs/utils/utils.js +91 -178
- package/lib/mjs/widgets/CalendarWidget.js +50 -67
- package/lib/mjs/widgets/InputWidget.js +4 -6
- package/lib/mjs/widgets/index.js +1 -1
- package/package.json +3 -3
- package/lib/cjs/translations/de.d.ts +0 -80
- package/lib/cjs/translations/de.js +0 -81
- package/lib/mjs/translations/de.d.ts +0 -80
- package/lib/mjs/translations/de.js +0 -79
|
@@ -6,7 +6,7 @@ import isMobile from 'ismobilejs';
|
|
|
6
6
|
import { processOne, processOneSync, validateProcessInfo } from '@formio/core/process';
|
|
7
7
|
import { Formio } from '../../../Formio';
|
|
8
8
|
import FormioUtils from '../../../utils';
|
|
9
|
-
import { fastCloneDeep, boolValue, currentTimezone, getScriptPlugin, getContextualRowData
|
|
9
|
+
import { fastCloneDeep, boolValue, currentTimezone, getScriptPlugin, getContextualRowData } from '../../../utils';
|
|
10
10
|
import Element from '../../../Element';
|
|
11
11
|
import ComponentModal from '../componentModal/ComponentModal';
|
|
12
12
|
import Widgets from '../../../widgets';
|
|
@@ -137,7 +137,7 @@ export default class Component extends Element {
|
|
|
137
137
|
*/
|
|
138
138
|
strictDateValidation: false,
|
|
139
139
|
multiple: false,
|
|
140
|
-
unique: false
|
|
140
|
+
unique: false
|
|
141
141
|
},
|
|
142
142
|
/**
|
|
143
143
|
* The simple conditional settings for a component.
|
|
@@ -145,7 +145,7 @@ export default class Component extends Element {
|
|
|
145
145
|
conditional: {
|
|
146
146
|
show: null,
|
|
147
147
|
when: null,
|
|
148
|
-
eq: ''
|
|
148
|
+
eq: ''
|
|
149
149
|
},
|
|
150
150
|
overlay: {
|
|
151
151
|
style: '',
|
|
@@ -161,7 +161,6 @@ export default class Component extends Element {
|
|
|
161
161
|
properties: {},
|
|
162
162
|
allowMultipleMasks: false,
|
|
163
163
|
addons: [],
|
|
164
|
-
serverOverride: {},
|
|
165
164
|
}, ...sources);
|
|
166
165
|
}
|
|
167
166
|
/**
|
|
@@ -170,20 +169,15 @@ export default class Component extends Element {
|
|
|
170
169
|
*/
|
|
171
170
|
static get conditionOperatorsSettings() {
|
|
172
171
|
return {
|
|
173
|
-
operators: [
|
|
174
|
-
'isEqual',
|
|
175
|
-
'isNotEqual',
|
|
176
|
-
'isEmpty',
|
|
177
|
-
'isNotEmpty',
|
|
178
|
-
],
|
|
172
|
+
operators: ['isEqual', 'isNotEqual', 'isEmpty', 'isNotEmpty'],
|
|
179
173
|
valueComponent() {
|
|
180
174
|
return {
|
|
181
175
|
type: 'textfield',
|
|
182
176
|
widget: {
|
|
183
|
-
type: 'input'
|
|
184
|
-
}
|
|
177
|
+
type: 'input'
|
|
178
|
+
}
|
|
185
179
|
};
|
|
186
|
-
}
|
|
180
|
+
}
|
|
187
181
|
};
|
|
188
182
|
}
|
|
189
183
|
/**
|
|
@@ -193,9 +187,7 @@ export default class Component extends Element {
|
|
|
193
187
|
*/
|
|
194
188
|
static savedValueTypes(schema) {
|
|
195
189
|
schema = schema || {};
|
|
196
|
-
return
|
|
197
|
-
FormioUtils.componentValueTypes.any,
|
|
198
|
-
]);
|
|
190
|
+
return FormioUtils.getComponentSavedTypes(schema) || [FormioUtils.componentValueTypes.any];
|
|
199
191
|
}
|
|
200
192
|
/**
|
|
201
193
|
* Provides a table view for this component. Override if you wish to do something different than using getView
|
|
@@ -212,11 +204,12 @@ export default class Component extends Element {
|
|
|
212
204
|
* @param {object} options - The options for this component.
|
|
213
205
|
* @param {object} data - The global data submission object this component will belong.
|
|
214
206
|
*/
|
|
207
|
+
/* eslint-disable max-statements */
|
|
215
208
|
constructor(component, options, data) {
|
|
216
209
|
super(Object.assign({
|
|
217
210
|
renderMode: 'form',
|
|
218
211
|
attachMode: 'full',
|
|
219
|
-
noDefaults: false
|
|
212
|
+
noDefaults: false
|
|
220
213
|
}, options || {}));
|
|
221
214
|
// Restore the component id.
|
|
222
215
|
if (component && component.id) {
|
|
@@ -237,7 +230,9 @@ export default class Component extends Element {
|
|
|
237
230
|
*/
|
|
238
231
|
this.refs = {};
|
|
239
232
|
// Allow global override for any component JSON.
|
|
240
|
-
if (component &&
|
|
233
|
+
if (component &&
|
|
234
|
+
this.options.components &&
|
|
235
|
+
this.options.components[component.type]) {
|
|
241
236
|
_.merge(component, this.options.components[component.type]);
|
|
242
237
|
}
|
|
243
238
|
/**
|
|
@@ -314,7 +309,7 @@ export default class Component extends Element {
|
|
|
314
309
|
*/
|
|
315
310
|
this.paths = FormioUtils.getComponentPaths(this.component, this.parent?.component, {
|
|
316
311
|
...this.parent?.paths,
|
|
317
|
-
dataIndex: this.options.rowIndex === undefined ? this.parent?.paths?.dataIndex : this.options.rowIndex
|
|
312
|
+
dataIndex: this.options.rowIndex === undefined ? this.parent?.paths?.dataIndex : this.options.rowIndex
|
|
318
313
|
});
|
|
319
314
|
this.options.name = this.options.name || 'data';
|
|
320
315
|
this._path = '';
|
|
@@ -323,12 +318,8 @@ export default class Component extends Element {
|
|
|
323
318
|
/**
|
|
324
319
|
* Determines if this component is visible, or not.
|
|
325
320
|
*/
|
|
326
|
-
this._parentVisible = this.options.hasOwnProperty('parentVisible')
|
|
327
|
-
|
|
328
|
-
: true;
|
|
329
|
-
this._visible =
|
|
330
|
-
this._parentVisible &&
|
|
331
|
-
(this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
|
|
321
|
+
this._parentVisible = this.options.hasOwnProperty('parentVisible') ? this.options.parentVisible : true;
|
|
322
|
+
this._visible = this._parentVisible && (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
|
|
332
323
|
this._parentDisabled = false;
|
|
333
324
|
/**
|
|
334
325
|
* The reference attribute name for this component
|
|
@@ -423,6 +414,7 @@ export default class Component extends Element {
|
|
|
423
414
|
this.init();
|
|
424
415
|
}
|
|
425
416
|
}
|
|
417
|
+
/* eslint-enable max-statements */
|
|
426
418
|
get componentsMap() {
|
|
427
419
|
return this.root?.childComponentsMap || {};
|
|
428
420
|
}
|
|
@@ -480,7 +472,10 @@ export default class Component extends Element {
|
|
|
480
472
|
return Promise.resolve(this);
|
|
481
473
|
}
|
|
482
474
|
get isPDFReadOnlyMode() {
|
|
483
|
-
return
|
|
475
|
+
return this.parent &&
|
|
476
|
+
this.parent.form &&
|
|
477
|
+
(this.parent.form.display === 'pdf') &&
|
|
478
|
+
this.options.readOnly;
|
|
484
479
|
}
|
|
485
480
|
get labelInfo() {
|
|
486
481
|
const label = {};
|
|
@@ -489,10 +484,7 @@ export default class Component extends Element {
|
|
|
489
484
|
label.labelPosition = this.component.labelPosition;
|
|
490
485
|
label.tooltipClass = `${this.iconClass('question-sign')} text-muted`;
|
|
491
486
|
const isPDFReadOnlyMode = this.isPDFReadOnlyMode;
|
|
492
|
-
if (this.hasInput &&
|
|
493
|
-
this.component.validate &&
|
|
494
|
-
boolValue(this.component.validate.required) &&
|
|
495
|
-
!isPDFReadOnlyMode) {
|
|
487
|
+
if (this.hasInput && this.component.validate && boolValue(this.component.validate.required) && !isPDFReadOnlyMode) {
|
|
496
488
|
label.className += ' field-required';
|
|
497
489
|
}
|
|
498
490
|
if (label.hidden) {
|
|
@@ -505,7 +497,7 @@ export default class Component extends Element {
|
|
|
505
497
|
}
|
|
506
498
|
init() {
|
|
507
499
|
this.disabled = this.shouldDisabled;
|
|
508
|
-
this._visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
|
|
500
|
+
this._visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
|
|
509
501
|
if (this.component.addons?.length) {
|
|
510
502
|
this.component.addons.forEach((addon) => this.createAddon(addon));
|
|
511
503
|
}
|
|
@@ -525,7 +517,7 @@ export default class Component extends Element {
|
|
|
525
517
|
set rowIndex(value) {
|
|
526
518
|
this.paths = FormioUtils.getComponentPaths(this.component, this.parent?.component, {
|
|
527
519
|
...(this.parent?.paths || {}),
|
|
528
|
-
...{ dataIndex: value }
|
|
520
|
+
...{ dataIndex: value }
|
|
529
521
|
});
|
|
530
522
|
this._rowIndex = value;
|
|
531
523
|
}
|
|
@@ -542,7 +534,8 @@ export default class Component extends Element {
|
|
|
542
534
|
let addon = null;
|
|
543
535
|
if (Addon) {
|
|
544
536
|
const supportedComponents = Addon.info.supportedComponents;
|
|
545
|
-
const supportsThisComponentType = !supportedComponents?.length ||
|
|
537
|
+
const supportsThisComponentType = !supportedComponents?.length ||
|
|
538
|
+
supportedComponents.indexOf(this.component.type) !== -1;
|
|
546
539
|
if (supportsThisComponentType) {
|
|
547
540
|
addon = new Addon(settings, this);
|
|
548
541
|
this.addons.push(addon);
|
|
@@ -579,9 +572,7 @@ export default class Component extends Element {
|
|
|
579
572
|
}
|
|
580
573
|
}
|
|
581
574
|
get shouldDisabled() {
|
|
582
|
-
return
|
|
583
|
-
this.component.disabled ||
|
|
584
|
-
(this.options.hasOwnProperty('disabled') && this.options.disabled[this.key]));
|
|
575
|
+
return this.options.readOnly || this.component.disabled || (this.options.hasOwnProperty('disabled') && this.options.disabled[this.key]);
|
|
585
576
|
}
|
|
586
577
|
get isInputComponent() {
|
|
587
578
|
return !this.component.hasOwnProperty('input') || this.component.input;
|
|
@@ -760,7 +751,7 @@ export default class Component extends Element {
|
|
|
760
751
|
'left-left',
|
|
761
752
|
'left-right',
|
|
762
753
|
'right-left',
|
|
763
|
-
'right-right'
|
|
754
|
+
'right-right'
|
|
764
755
|
].includes(this.labelPosition);
|
|
765
756
|
}
|
|
766
757
|
get labelPositions() {
|
|
@@ -798,7 +789,7 @@ export default class Component extends Element {
|
|
|
798
789
|
isRightPosition,
|
|
799
790
|
isRightAlign,
|
|
800
791
|
labelStyles,
|
|
801
|
-
contentStyles
|
|
792
|
+
contentStyles
|
|
802
793
|
};
|
|
803
794
|
}
|
|
804
795
|
/**
|
|
@@ -825,11 +816,11 @@ export default class Component extends Element {
|
|
|
825
816
|
modified[key] = val;
|
|
826
817
|
}
|
|
827
818
|
}
|
|
828
|
-
else if ((!recursion && key === 'type') ||
|
|
829
|
-
(!recursion && key === 'key') ||
|
|
830
|
-
(!recursion && key === 'label') ||
|
|
831
|
-
(!recursion && key === 'input') ||
|
|
832
|
-
(!recursion && key === 'tableView') ||
|
|
819
|
+
else if ((!recursion && (key === 'type')) ||
|
|
820
|
+
(!recursion && (key === 'key')) ||
|
|
821
|
+
(!recursion && (key === 'label')) ||
|
|
822
|
+
(!recursion && (key === 'input')) ||
|
|
823
|
+
(!recursion && (key === 'tableView')) ||
|
|
833
824
|
(val !== '' && !defaultSchema.hasOwnProperty(key)) ||
|
|
834
825
|
(val !== '' && val !== defaultSchema[key]) ||
|
|
835
826
|
(defaultSchema[key] && val !== defaultSchema[key])) {
|
|
@@ -873,32 +864,21 @@ export default class Component extends Element {
|
|
|
873
864
|
return super.t(text, params, ...args);
|
|
874
865
|
}
|
|
875
866
|
labelIsHidden() {
|
|
876
|
-
return
|
|
877
|
-
((
|
|
867
|
+
return !this.component.label ||
|
|
868
|
+
((!this.isInDataGrid && this.component.hideLabel) ||
|
|
878
869
|
(this.isInDataGrid && !this.component.dataGridLabel) ||
|
|
879
870
|
this.options.floatingLabels ||
|
|
880
|
-
this.options.inputsOnly) &&
|
|
881
|
-
!this.builderMode));
|
|
871
|
+
this.options.inputsOnly) && !this.builderMode;
|
|
882
872
|
}
|
|
883
873
|
transform(type, value) {
|
|
884
|
-
const frameworkTemplates = this.options.template
|
|
885
|
-
? Templates.templates[this.options.template]
|
|
886
|
-
: Templates.current;
|
|
874
|
+
const frameworkTemplates = this.options.template ? Templates.templates[this.options.template] : Templates.current;
|
|
887
875
|
return frameworkTemplates.hasOwnProperty('transform')
|
|
888
876
|
? frameworkTemplates.transform(type, value, this)
|
|
889
877
|
: (type, value) => value;
|
|
890
878
|
}
|
|
891
879
|
getTemplate(names, modes) {
|
|
892
|
-
modes = Array.isArray(modes)
|
|
893
|
-
|
|
894
|
-
: [
|
|
895
|
-
modes,
|
|
896
|
-
];
|
|
897
|
-
names = Array.isArray(names)
|
|
898
|
-
? names
|
|
899
|
-
: [
|
|
900
|
-
names,
|
|
901
|
-
];
|
|
880
|
+
modes = Array.isArray(modes) ? modes : [modes];
|
|
881
|
+
names = Array.isArray(names) ? names : [names];
|
|
902
882
|
if (!modes.includes('form')) {
|
|
903
883
|
modes.push('form');
|
|
904
884
|
}
|
|
@@ -909,9 +889,7 @@ export default class Component extends Element {
|
|
|
909
889
|
return result;
|
|
910
890
|
}
|
|
911
891
|
}
|
|
912
|
-
const frameworkTemplates = this.options.template
|
|
913
|
-
? Templates.templates[this.options.template]
|
|
914
|
-
: Templates.current;
|
|
892
|
+
const frameworkTemplates = this.options.template ? Templates.templates[this.options.template] : Templates.current;
|
|
915
893
|
result = this.checkTemplate(frameworkTemplates, names, modes);
|
|
916
894
|
if (result) {
|
|
917
895
|
return result;
|
|
@@ -1043,9 +1021,7 @@ export default class Component extends Element {
|
|
|
1043
1021
|
if (settings && this.root?.shadowRoot) {
|
|
1044
1022
|
settings.shadowRoot = this.root.shadowRoot;
|
|
1045
1023
|
}
|
|
1046
|
-
const widget = settings && Widgets[settings.type]
|
|
1047
|
-
? new Widgets[settings.type](settings, this.component, this)
|
|
1048
|
-
: null;
|
|
1024
|
+
const widget = settings && Widgets[settings.type] ? new Widgets[settings.type](settings, this.component, this) : null;
|
|
1049
1025
|
return widget;
|
|
1050
1026
|
}
|
|
1051
1027
|
/**
|
|
@@ -1054,12 +1030,7 @@ export default class Component extends Element {
|
|
|
1054
1030
|
*/
|
|
1055
1031
|
getBrowserLanguage() {
|
|
1056
1032
|
const nav = window.navigator;
|
|
1057
|
-
const browserLanguagePropertyKeys = [
|
|
1058
|
-
'language',
|
|
1059
|
-
'browserLanguage',
|
|
1060
|
-
'systemLanguage',
|
|
1061
|
-
'userLanguage',
|
|
1062
|
-
];
|
|
1033
|
+
const browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'];
|
|
1063
1034
|
let language;
|
|
1064
1035
|
// support for HTML 5.1 "navigator.languages"
|
|
1065
1036
|
if (Array.isArray(nav.languages)) {
|
|
@@ -1105,8 +1076,7 @@ export default class Component extends Element {
|
|
|
1105
1076
|
* @returns {string} - The submission timezone.
|
|
1106
1077
|
*/
|
|
1107
1078
|
get submissionTimezone() {
|
|
1108
|
-
this.options.submissionTimezone =
|
|
1109
|
-
this.options.submissionTimezone || _.get(this.root, 'options.submissionTimezone');
|
|
1079
|
+
this.options.submissionTimezone = this.options.submissionTimezone || _.get(this.root, 'options.submissionTimezone');
|
|
1110
1080
|
return this.options.submissionTimezone;
|
|
1111
1081
|
}
|
|
1112
1082
|
/**
|
|
@@ -1130,8 +1100,8 @@ export default class Component extends Element {
|
|
|
1130
1100
|
}
|
|
1131
1101
|
const submissionTimezone = this.submissionTimezone;
|
|
1132
1102
|
if (submissionTimezone &&
|
|
1133
|
-
(settings.displayInTimezone === 'submission' ||
|
|
1134
|
-
((this.options.pdf || this.options.server) && settings.displayInTimezone === 'viewer'))) {
|
|
1103
|
+
((settings.displayInTimezone === 'submission') ||
|
|
1104
|
+
((this.options.pdf || this.options.server) && (settings.displayInTimezone === 'viewer')))) {
|
|
1135
1105
|
return submissionTimezone;
|
|
1136
1106
|
}
|
|
1137
1107
|
// Return current timezone if none are provided.
|
|
@@ -1222,7 +1192,7 @@ export default class Component extends Element {
|
|
|
1222
1192
|
id: this.id,
|
|
1223
1193
|
classes: this.className,
|
|
1224
1194
|
styles: this.customStyle,
|
|
1225
|
-
children
|
|
1195
|
+
children
|
|
1226
1196
|
}, topLevel);
|
|
1227
1197
|
}
|
|
1228
1198
|
else {
|
|
@@ -1231,7 +1201,7 @@ export default class Component extends Element {
|
|
|
1231
1201
|
id: this.id,
|
|
1232
1202
|
classes: this.className,
|
|
1233
1203
|
styles: this.customStyle,
|
|
1234
|
-
children
|
|
1204
|
+
children
|
|
1235
1205
|
}, topLevel);
|
|
1236
1206
|
}
|
|
1237
1207
|
}
|
|
@@ -1244,7 +1214,8 @@ export default class Component extends Element {
|
|
|
1244
1214
|
createTooltip(tooltipEl, settings = {}) {
|
|
1245
1215
|
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
|
|
1246
1216
|
const tooltipDataTitle = tooltipEl.getAttribute('data-title');
|
|
1247
|
-
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1217
|
+
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1218
|
+
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1248
1219
|
return tippy(tooltipEl, {
|
|
1249
1220
|
allowHTML: true,
|
|
1250
1221
|
trigger: 'mouseenter click focus',
|
|
@@ -1286,7 +1257,9 @@ export default class Component extends Element {
|
|
|
1286
1257
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
1287
1258
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
1288
1259
|
const currentValue = modalShouldBeOpened ? this.componentModal.currentValue : this.dataValue;
|
|
1289
|
-
const openModalTemplate = this.componentModal && modalShouldBeOpened
|
|
1260
|
+
const openModalTemplate = this.componentModal && modalShouldBeOpened
|
|
1261
|
+
? this.componentModal.openModalTemplate
|
|
1262
|
+
: null;
|
|
1290
1263
|
this.componentModal = this.createComponentModal(element, modalShouldBeOpened, currentValue);
|
|
1291
1264
|
this.setOpenModalElement(openModalTemplate);
|
|
1292
1265
|
}
|
|
@@ -1300,7 +1273,7 @@ export default class Component extends Element {
|
|
|
1300
1273
|
}
|
|
1301
1274
|
this.loadRefs(element, {
|
|
1302
1275
|
messageContainer: 'single',
|
|
1303
|
-
tooltip: 'multiple'
|
|
1276
|
+
tooltip: 'multiple'
|
|
1304
1277
|
});
|
|
1305
1278
|
this.attachTooltips(this.refs.tooltip);
|
|
1306
1279
|
// Attach logic.
|
|
@@ -1324,7 +1297,7 @@ export default class Component extends Element {
|
|
|
1324
1297
|
const isFocused = this.root?.focusedComponent?.path === this.path;
|
|
1325
1298
|
if (isFocused) {
|
|
1326
1299
|
this.loadRefs(this.element, { input: 'multiple' });
|
|
1327
|
-
this.focus(this.root
|
|
1300
|
+
this.focus(this.root?.currentSelection?.index);
|
|
1328
1301
|
this.restoreCaretPosition();
|
|
1329
1302
|
}
|
|
1330
1303
|
}
|
|
@@ -1336,13 +1309,13 @@ export default class Component extends Element {
|
|
|
1336
1309
|
*/
|
|
1337
1310
|
addShortcut(element, shortcut) {
|
|
1338
1311
|
// Avoid infinite recursion.
|
|
1339
|
-
if (!element || !this.root || this.root === this) {
|
|
1312
|
+
if (!element || !this.root || (this.root === this)) {
|
|
1340
1313
|
return;
|
|
1341
1314
|
}
|
|
1342
1315
|
if (!shortcut) {
|
|
1343
1316
|
shortcut = this.component.shortcut;
|
|
1344
1317
|
}
|
|
1345
|
-
this.root
|
|
1318
|
+
this.root?.addShortcut(element, shortcut);
|
|
1346
1319
|
}
|
|
1347
1320
|
/**
|
|
1348
1321
|
* Removes a keyboard shortcut from this component.
|
|
@@ -1352,13 +1325,13 @@ export default class Component extends Element {
|
|
|
1352
1325
|
*/
|
|
1353
1326
|
removeShortcut(element, shortcut) {
|
|
1354
1327
|
// Avoid infinite recursion.
|
|
1355
|
-
if (!element || this.root === this) {
|
|
1328
|
+
if (!element || (this.root === this)) {
|
|
1356
1329
|
return;
|
|
1357
1330
|
}
|
|
1358
1331
|
if (!shortcut) {
|
|
1359
1332
|
shortcut = this.component.shortcut;
|
|
1360
1333
|
}
|
|
1361
|
-
this.root
|
|
1334
|
+
this.root?.removeShortcut(element, shortcut);
|
|
1362
1335
|
}
|
|
1363
1336
|
/**
|
|
1364
1337
|
* Remove all event handlers.
|
|
@@ -1398,10 +1371,7 @@ export default class Component extends Element {
|
|
|
1398
1371
|
if (refreshData === 'data') {
|
|
1399
1372
|
this.refresh(this.data, changed, flags);
|
|
1400
1373
|
}
|
|
1401
|
-
else if (changePath &&
|
|
1402
|
-
changed.instance?.paths?.localPath === refreshData &&
|
|
1403
|
-
changed &&
|
|
1404
|
-
changed.instance &&
|
|
1374
|
+
else if ((changePath && (changed.instance?.paths?.localPath === refreshData)) && changed && changed.instance &&
|
|
1405
1375
|
// Make sure the changed component is not in a different "context". Solves issues where refreshOn being set
|
|
1406
1376
|
// in fields inside EditGrids could alter their state from other rows (which is bad).
|
|
1407
1377
|
this.inContext(changed.instance)) {
|
|
@@ -1420,20 +1390,16 @@ export default class Component extends Element {
|
|
|
1420
1390
|
return;
|
|
1421
1391
|
}
|
|
1422
1392
|
if (!changes.length && flags.changed) {
|
|
1423
|
-
changes = [
|
|
1424
|
-
flags.changed,
|
|
1425
|
-
];
|
|
1393
|
+
changes = [flags.changed];
|
|
1426
1394
|
}
|
|
1427
|
-
const refreshOn = flags.fromBlur
|
|
1428
|
-
? this.component.refreshOnBlur
|
|
1429
|
-
: this.component.refreshOn || this.component.redrawOn;
|
|
1395
|
+
const refreshOn = flags.fromBlur ? this.component.refreshOnBlur : this.component.refreshOn || this.component.redrawOn;
|
|
1430
1396
|
// If they wish to refresh on a value, then add that here.
|
|
1431
1397
|
if (refreshOn) {
|
|
1432
1398
|
if (Array.isArray(refreshOn)) {
|
|
1433
|
-
refreshOn.forEach(
|
|
1399
|
+
refreshOn.forEach(refreshData => changes.forEach(changed => this.checkRefresh(refreshData, changed, flags)));
|
|
1434
1400
|
}
|
|
1435
1401
|
else {
|
|
1436
|
-
changes.forEach(
|
|
1402
|
+
changes.forEach(changed => this.checkRefresh(refreshOn, changed, flags));
|
|
1437
1403
|
}
|
|
1438
1404
|
}
|
|
1439
1405
|
}
|
|
@@ -1454,7 +1420,7 @@ export default class Component extends Element {
|
|
|
1454
1420
|
if (this.component.clearOnRefresh) {
|
|
1455
1421
|
this.setValue(null);
|
|
1456
1422
|
}
|
|
1457
|
-
this.triggerRedraw();
|
|
1423
|
+
this.triggerRedraw?.();
|
|
1458
1424
|
}
|
|
1459
1425
|
}
|
|
1460
1426
|
/**
|
|
@@ -1504,7 +1470,7 @@ export default class Component extends Element {
|
|
|
1504
1470
|
*/
|
|
1505
1471
|
createViewOnlyElement() {
|
|
1506
1472
|
this.setElement(this.ce('dl', {
|
|
1507
|
-
id: this.id
|
|
1473
|
+
id: this.id
|
|
1508
1474
|
}));
|
|
1509
1475
|
if (this.element) {
|
|
1510
1476
|
// Ensure you can get the component info from the element.
|
|
@@ -1616,7 +1582,7 @@ export default class Component extends Element {
|
|
|
1616
1582
|
*/
|
|
1617
1583
|
itemValueForHTMLMode(value) {
|
|
1618
1584
|
if (Array.isArray(value)) {
|
|
1619
|
-
const values = value.map(
|
|
1585
|
+
const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
1620
1586
|
return values.join(', ');
|
|
1621
1587
|
}
|
|
1622
1588
|
return this.itemValue(value);
|
|
@@ -1652,8 +1618,7 @@ export default class Component extends Element {
|
|
|
1652
1618
|
};
|
|
1653
1619
|
const handleCloseClick = (e) => {
|
|
1654
1620
|
if (confirm) {
|
|
1655
|
-
confirm()
|
|
1656
|
-
.then(() => close(e))
|
|
1621
|
+
confirm().then(() => close(e))
|
|
1657
1622
|
.catch(() => { });
|
|
1658
1623
|
}
|
|
1659
1624
|
else {
|
|
@@ -1753,11 +1718,9 @@ export default class Component extends Element {
|
|
|
1753
1718
|
// It is useful to translate strings in different scenarions (eg: custom edit grid templates, custom error messages etc.)
|
|
1754
1719
|
// and desirable to be publicly available rather than calling the internal {instance.t} function in the template string.
|
|
1755
1720
|
t: this.t.bind(this),
|
|
1756
|
-
submission: this.root
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
data: this.rootValue,
|
|
1760
|
-
},
|
|
1721
|
+
submission: (this.root ? this.root._submission : {
|
|
1722
|
+
data: this.rootValue
|
|
1723
|
+
}),
|
|
1761
1724
|
form: this.root ? this.root._form : {},
|
|
1762
1725
|
options: this.options,
|
|
1763
1726
|
}, additional));
|
|
@@ -1810,12 +1773,7 @@ export default class Component extends Element {
|
|
|
1810
1773
|
const iconset = this.options.iconset || Templates.current.defaultIconset || 'fa';
|
|
1811
1774
|
return Templates.current.hasOwnProperty('iconClass')
|
|
1812
1775
|
? Templates.current.iconClass(iconset, name, spinning)
|
|
1813
|
-
:
|
|
1814
|
-
'fa',
|
|
1815
|
-
'bi',
|
|
1816
|
-
].includes(this.options.iconset)
|
|
1817
|
-
? Templates.defaultTemplates.iconClass(iconset, name, spinning)
|
|
1818
|
-
: name;
|
|
1776
|
+
: this.options.iconset === 'fa' ? Templates.defaultTemplates.iconClass(iconset, name, spinning) : name;
|
|
1819
1777
|
}
|
|
1820
1778
|
/**
|
|
1821
1779
|
* Returns the size css class names for our current template.
|
|
@@ -1823,16 +1781,16 @@ export default class Component extends Element {
|
|
|
1823
1781
|
* @returns {string} - The size class for our component.
|
|
1824
1782
|
*/
|
|
1825
1783
|
size(size) {
|
|
1826
|
-
return Templates.current.hasOwnProperty('size')
|
|
1784
|
+
return Templates.current.hasOwnProperty('size')
|
|
1785
|
+
? Templates.current.size(size)
|
|
1786
|
+
: size;
|
|
1827
1787
|
}
|
|
1828
1788
|
/**
|
|
1829
1789
|
* The readible name for this component.
|
|
1830
1790
|
* @returns {string} - The name of the component.
|
|
1831
1791
|
*/
|
|
1832
1792
|
get name() {
|
|
1833
|
-
return this.t(this.component.label || this.component.placeholder || this.key, {
|
|
1834
|
-
_userInput: true,
|
|
1835
|
-
});
|
|
1793
|
+
return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
|
|
1836
1794
|
}
|
|
1837
1795
|
/**
|
|
1838
1796
|
* Returns the visible errors for this component.
|
|
@@ -1853,7 +1811,10 @@ export default class Component extends Element {
|
|
|
1853
1811
|
* @returns {string} - The error label for this component.
|
|
1854
1812
|
*/
|
|
1855
1813
|
get errorLabel() {
|
|
1856
|
-
return this.t(this.component.errorLabel
|
|
1814
|
+
return this.t(this.component.errorLabel
|
|
1815
|
+
|| this.component.label
|
|
1816
|
+
|| this.component.placeholder
|
|
1817
|
+
|| this.key);
|
|
1857
1818
|
}
|
|
1858
1819
|
/**
|
|
1859
1820
|
* Get the error message provided a certain type of error.
|
|
@@ -1861,9 +1822,7 @@ export default class Component extends Element {
|
|
|
1861
1822
|
* @returns {string} - The error message configured for this component.
|
|
1862
1823
|
*/
|
|
1863
1824
|
errorMessage(type) {
|
|
1864
|
-
return this.component.errors && this.component.errors[type]
|
|
1865
|
-
? this.component.errors[type]
|
|
1866
|
-
: type;
|
|
1825
|
+
return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
|
|
1867
1826
|
}
|
|
1868
1827
|
/**
|
|
1869
1828
|
* Sets the content, innerHTML, of an element to the sanitized content.
|
|
@@ -1938,7 +1897,7 @@ export default class Component extends Element {
|
|
|
1938
1897
|
*/
|
|
1939
1898
|
removeEventListeners() {
|
|
1940
1899
|
super.removeEventListeners();
|
|
1941
|
-
this.tooltips.forEach(
|
|
1900
|
+
this.tooltips.forEach(tooltip => tooltip.destroy());
|
|
1942
1901
|
this.tooltips = [];
|
|
1943
1902
|
}
|
|
1944
1903
|
/**
|
|
@@ -2029,7 +1988,7 @@ export default class Component extends Element {
|
|
|
2029
1988
|
this.redraw();
|
|
2030
1989
|
}
|
|
2031
1990
|
// Check visibility
|
|
2032
|
-
const visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
|
|
1991
|
+
const visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
|
|
2033
1992
|
if (this.visible !== visible) {
|
|
2034
1993
|
this.visible = visible;
|
|
2035
1994
|
}
|
|
@@ -2071,8 +2030,7 @@ export default class Component extends Element {
|
|
|
2071
2030
|
const newComponent = fastCloneDeep(this.originalComponent);
|
|
2072
2031
|
let changed = logics.reduce((changed, logic) => {
|
|
2073
2032
|
const result = FormioUtils.checkTrigger(newComponent, logic.trigger, row, data, this.root ? this.root._form : {}, this);
|
|
2074
|
-
return (
|
|
2075
|
-
changed);
|
|
2033
|
+
return (result ? this.applyActions(newComponent, logic.actions, result, row, data) : false) || changed;
|
|
2076
2034
|
}, false);
|
|
2077
2035
|
// If component definition changed, replace and mark as changed.
|
|
2078
2036
|
if (!_.isEqual(this.component, newComponent)) {
|
|
@@ -2232,17 +2190,13 @@ export default class Component extends Element {
|
|
|
2232
2190
|
};
|
|
2233
2191
|
}
|
|
2234
2192
|
if (!Array.isArray(messages)) {
|
|
2235
|
-
messages = [
|
|
2236
|
-
messages,
|
|
2237
|
-
];
|
|
2193
|
+
messages = [messages];
|
|
2238
2194
|
}
|
|
2239
|
-
messages = _.uniqBy(messages,
|
|
2195
|
+
messages = _.uniqBy(messages, message => message.message);
|
|
2240
2196
|
if (this.refs.messageContainer) {
|
|
2241
|
-
this.setContent(this.refs.messageContainer, messages
|
|
2242
|
-
.map((message) => {
|
|
2197
|
+
this.setContent(this.refs.messageContainer, messages.map((message) => {
|
|
2243
2198
|
return this.renderTemplate('message', { ...message });
|
|
2244
|
-
})
|
|
2245
|
-
.join(''));
|
|
2199
|
+
}).join(''));
|
|
2246
2200
|
}
|
|
2247
2201
|
}
|
|
2248
2202
|
/**
|
|
@@ -2302,16 +2256,14 @@ export default class Component extends Element {
|
|
|
2302
2256
|
*/
|
|
2303
2257
|
clearComponentOnHide() {
|
|
2304
2258
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
2305
|
-
if (this.component.clearOnHide !== false &&
|
|
2306
|
-
!this.options.readOnly &&
|
|
2307
|
-
!this.options.showHiddenFields) {
|
|
2259
|
+
if (this.component.clearOnHide !== false && !this.options.readOnly && !this.options.showHiddenFields) {
|
|
2308
2260
|
if (this.shouldConditionallyClear()) {
|
|
2309
2261
|
this.deleteValue();
|
|
2310
2262
|
}
|
|
2311
2263
|
else if (!this.hasValue() && this.shouldAddDefaultValue) {
|
|
2312
2264
|
// If shown, ensure the default is set.
|
|
2313
2265
|
this.setValue(this.defaultValue, {
|
|
2314
|
-
noUpdateEvent: true
|
|
2266
|
+
noUpdateEvent: true
|
|
2315
2267
|
});
|
|
2316
2268
|
}
|
|
2317
2269
|
}
|
|
@@ -2355,7 +2307,7 @@ export default class Component extends Element {
|
|
|
2355
2307
|
}
|
|
2356
2308
|
if (this.component.onChange) {
|
|
2357
2309
|
this.evaluate(this.component.onChange, {
|
|
2358
|
-
flags
|
|
2310
|
+
flags
|
|
2359
2311
|
});
|
|
2360
2312
|
}
|
|
2361
2313
|
// Set the changed variable.
|
|
@@ -2363,7 +2315,7 @@ export default class Component extends Element {
|
|
|
2363
2315
|
instance: this,
|
|
2364
2316
|
component: this.component,
|
|
2365
2317
|
value: this.dataValue,
|
|
2366
|
-
flags: flags
|
|
2318
|
+
flags: flags
|
|
2367
2319
|
};
|
|
2368
2320
|
// Emit the change.
|
|
2369
2321
|
this.emit('componentChange', changed);
|
|
@@ -2386,65 +2338,16 @@ export default class Component extends Element {
|
|
|
2386
2338
|
placeholder: this.t(this.component.placeholder, { _userInput: true }),
|
|
2387
2339
|
modules: {
|
|
2388
2340
|
toolbar: [
|
|
2389
|
-
[
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
[
|
|
2400
|
-
{
|
|
2401
|
-
header: [
|
|
2402
|
-
1,
|
|
2403
|
-
2,
|
|
2404
|
-
3,
|
|
2405
|
-
4,
|
|
2406
|
-
5,
|
|
2407
|
-
6,
|
|
2408
|
-
false,
|
|
2409
|
-
],
|
|
2410
|
-
},
|
|
2411
|
-
],
|
|
2412
|
-
[
|
|
2413
|
-
{ font: [] },
|
|
2414
|
-
],
|
|
2415
|
-
[
|
|
2416
|
-
'bold',
|
|
2417
|
-
'italic',
|
|
2418
|
-
'underline',
|
|
2419
|
-
'strike',
|
|
2420
|
-
{ script: 'sub' },
|
|
2421
|
-
{ script: 'super' },
|
|
2422
|
-
'clean',
|
|
2423
|
-
],
|
|
2424
|
-
[
|
|
2425
|
-
{ color: [] },
|
|
2426
|
-
{ background: [] },
|
|
2427
|
-
],
|
|
2428
|
-
[
|
|
2429
|
-
{ list: 'ordered' },
|
|
2430
|
-
{ list: 'bullet' },
|
|
2431
|
-
{ indent: '-1' },
|
|
2432
|
-
{ indent: '+1' },
|
|
2433
|
-
{ align: [] },
|
|
2434
|
-
],
|
|
2435
|
-
[
|
|
2436
|
-
'blockquote',
|
|
2437
|
-
'code-block',
|
|
2438
|
-
],
|
|
2439
|
-
[
|
|
2440
|
-
'link',
|
|
2441
|
-
'image',
|
|
2442
|
-
'video',
|
|
2443
|
-
'formula',
|
|
2444
|
-
'source',
|
|
2445
|
-
],
|
|
2446
|
-
],
|
|
2447
|
-
},
|
|
2341
|
+
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
|
|
2342
|
+
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
|
|
2343
|
+
[{ 'font': [] }],
|
|
2344
|
+
['bold', 'italic', 'underline', 'strike', { 'script': 'sub' }, { 'script': 'super' }, 'clean'],
|
|
2345
|
+
[{ 'color': [] }, { 'background': [] }],
|
|
2346
|
+
[{ 'list': 'ordered' }, { 'list': 'bullet' }, { 'indent': '-1' }, { 'indent': '+1' }, { 'align': [] }],
|
|
2347
|
+
['blockquote', 'code-block'],
|
|
2348
|
+
['link', 'image', 'video', 'formula', 'source']
|
|
2349
|
+
]
|
|
2350
|
+
}
|
|
2448
2351
|
},
|
|
2449
2352
|
ace: {
|
|
2450
2353
|
theme: 'ace/theme/xcode',
|
|
@@ -2452,7 +2355,7 @@ export default class Component extends Element {
|
|
|
2452
2355
|
minLines: 12,
|
|
2453
2356
|
tabSize: 2,
|
|
2454
2357
|
mode: 'ace/mode/javascript',
|
|
2455
|
-
placeholder: this.t(this.component.placeholder, { _userInput: true })
|
|
2358
|
+
placeholder: this.t(this.component.placeholder, { _userInput: true })
|
|
2456
2359
|
},
|
|
2457
2360
|
ckeditor: {
|
|
2458
2361
|
image: {
|
|
@@ -2462,18 +2365,18 @@ export default class Component extends Element {
|
|
|
2462
2365
|
'imageStyle:full',
|
|
2463
2366
|
'imageStyle:alignLeft',
|
|
2464
2367
|
'imageStyle:alignCenter',
|
|
2465
|
-
'imageStyle:alignRight'
|
|
2368
|
+
'imageStyle:alignRight'
|
|
2466
2369
|
],
|
|
2467
2370
|
styles: [
|
|
2468
2371
|
'full',
|
|
2469
2372
|
'alignLeft',
|
|
2470
2373
|
'alignCenter',
|
|
2471
|
-
'alignRight'
|
|
2472
|
-
]
|
|
2374
|
+
'alignRight'
|
|
2375
|
+
]
|
|
2473
2376
|
},
|
|
2474
|
-
extraPlugins: []
|
|
2377
|
+
extraPlugins: []
|
|
2475
2378
|
},
|
|
2476
|
-
default: {}
|
|
2379
|
+
default: {}
|
|
2477
2380
|
};
|
|
2478
2381
|
}
|
|
2479
2382
|
addCKE(element, settings, onChange) {
|
|
@@ -2484,7 +2387,8 @@ export default class Component extends Element {
|
|
|
2484
2387
|
if (this.component.isUploadEnabled) {
|
|
2485
2388
|
settings.extraPlugins.push(getFormioUploadAdapterPlugin(this.fileService, this));
|
|
2486
2389
|
}
|
|
2487
|
-
return Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', _.get(this.options, 'editors.ckeditor.src', `${Formio.cdn.ckeditor}/ckeditor.js`), true)
|
|
2390
|
+
return Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', _.get(this.options, 'editors.ckeditor.src', `${Formio.cdn.ckeditor}/ckeditor.js`), true)
|
|
2391
|
+
.then(() => {
|
|
2488
2392
|
if (!element.parentNode) {
|
|
2489
2393
|
return Promise.reject();
|
|
2490
2394
|
}
|
|
@@ -2494,7 +2398,7 @@ export default class Component extends Element {
|
|
|
2494
2398
|
return Promise.resolve(editor);
|
|
2495
2399
|
}
|
|
2496
2400
|
else {
|
|
2497
|
-
return ClassicEditor.create(element, settings).then(
|
|
2401
|
+
return ClassicEditor.create(element, settings).then(editor => {
|
|
2498
2402
|
editor.model.document.on('change', () => onChange(editor.data.get()));
|
|
2499
2403
|
return editor;
|
|
2500
2404
|
});
|
|
@@ -2508,16 +2412,18 @@ export default class Component extends Element {
|
|
|
2508
2412
|
...settings,
|
|
2509
2413
|
modules: {
|
|
2510
2414
|
table: true,
|
|
2511
|
-
...settings.modules
|
|
2512
|
-
}
|
|
2415
|
+
...settings.modules
|
|
2416
|
+
}
|
|
2513
2417
|
};
|
|
2514
2418
|
// Lazy load the quill css.
|
|
2515
2419
|
Formio.requireLibrary(`quill-css-${settings.theme}`, 'Quill', [
|
|
2516
|
-
{ type: 'styles', src: `${Formio.cdn.quill}/quill.${settings.theme}.css` }
|
|
2420
|
+
{ type: 'styles', src: `${Formio.cdn.quill}/quill.${settings.theme}.css` }
|
|
2517
2421
|
], true);
|
|
2518
2422
|
// Lazy load the quill library.
|
|
2519
|
-
return Formio.requireLibrary('quill', 'Quill', _.get(this.options, 'editors.quill.src', `${Formio.cdn.quill}/quill.min.js`), true)
|
|
2520
|
-
|
|
2423
|
+
return Formio.requireLibrary('quill', 'Quill', _.get(this.options, 'editors.quill.src', `${Formio.cdn.quill}/quill.min.js`), true)
|
|
2424
|
+
.then(() => {
|
|
2425
|
+
return Formio.requireLibrary('quill-table', 'Quill', `${Formio.cdn.baseUrl}/quill/quill-table.js`, true)
|
|
2426
|
+
.then(() => {
|
|
2521
2427
|
if (!element.parentNode) {
|
|
2522
2428
|
return Promise.reject();
|
|
2523
2429
|
}
|
|
@@ -2533,7 +2439,7 @@ export default class Component extends Element {
|
|
|
2533
2439
|
if (txtArea.style.display === 'inherit') {
|
|
2534
2440
|
this.quill.setContents(this.quill.clipboard.convert({ html: txtArea.value }));
|
|
2535
2441
|
}
|
|
2536
|
-
txtArea.style.display = txtArea.style.display === 'none' ? 'inherit' : 'none';
|
|
2442
|
+
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2537
2443
|
});
|
|
2538
2444
|
}
|
|
2539
2445
|
/** END CODEBLOCK */
|
|
@@ -2554,10 +2460,10 @@ export default class Component extends Element {
|
|
|
2554
2460
|
}
|
|
2555
2461
|
get shouldSanitizeValue() {
|
|
2556
2462
|
// Sanitize value if sanitizing for thw whole content is turned off
|
|
2557
|
-
return this.options?.sanitize !== false;
|
|
2463
|
+
return (this.options?.sanitize !== false);
|
|
2558
2464
|
}
|
|
2559
2465
|
addAce(element, settings, onChange) {
|
|
2560
|
-
if (!settings || settings.theme === 'snow') {
|
|
2466
|
+
if (!settings || (settings.theme === 'snow')) {
|
|
2561
2467
|
const mode = settings ? settings.mode : '';
|
|
2562
2468
|
settings = {};
|
|
2563
2469
|
if (mode) {
|
|
@@ -2565,7 +2471,8 @@ export default class Component extends Element {
|
|
|
2565
2471
|
}
|
|
2566
2472
|
}
|
|
2567
2473
|
settings = _.merge(this.wysiwygDefault.ace, _.get(this.options, 'editors.ace.settings', {}), settings || {});
|
|
2568
|
-
return Formio.requireLibrary('ace', 'ace', _.get(this.options, 'editors.ace.src', `${Formio.cdn.ace}/ace.js`), true)
|
|
2474
|
+
return Formio.requireLibrary('ace', 'ace', _.get(this.options, 'editors.ace.src', `${Formio.cdn.ace}/ace.js`), true)
|
|
2475
|
+
.then((editor) => {
|
|
2569
2476
|
editor = editor.edit(element);
|
|
2570
2477
|
editor.removeAllListeners('change');
|
|
2571
2478
|
editor.setOptions(settings);
|
|
@@ -2623,10 +2530,10 @@ export default class Component extends Element {
|
|
|
2623
2530
|
if (!this.allowData || !this.key) {
|
|
2624
2531
|
return;
|
|
2625
2532
|
}
|
|
2626
|
-
if (value !== null && value !== undefined) {
|
|
2533
|
+
if ((value !== null) && (value !== undefined)) {
|
|
2627
2534
|
value = this.hook('setDataValue', value, this.key, this._data);
|
|
2628
2535
|
}
|
|
2629
|
-
if (value === null || value === undefined) {
|
|
2536
|
+
if ((value === null) || (value === undefined)) {
|
|
2630
2537
|
this.unset();
|
|
2631
2538
|
return;
|
|
2632
2539
|
}
|
|
@@ -2644,7 +2551,7 @@ export default class Component extends Element {
|
|
|
2644
2551
|
if (_.isArray(dataValue) && dataValue.hasOwnProperty(index)) {
|
|
2645
2552
|
dataValue.splice(index, 1);
|
|
2646
2553
|
this.dataValue = dataValue;
|
|
2647
|
-
this.triggerChange(flags);
|
|
2554
|
+
this.triggerChange?.(flags);
|
|
2648
2555
|
}
|
|
2649
2556
|
}
|
|
2650
2557
|
}
|
|
@@ -2657,7 +2564,7 @@ export default class Component extends Element {
|
|
|
2657
2564
|
deleteValue() {
|
|
2658
2565
|
this.setValue(null, {
|
|
2659
2566
|
noUpdateEvent: true,
|
|
2660
|
-
noDefault: true
|
|
2567
|
+
noDefault: true
|
|
2661
2568
|
});
|
|
2662
2569
|
this.unset();
|
|
2663
2570
|
}
|
|
@@ -2672,10 +2579,9 @@ export default class Component extends Element {
|
|
|
2672
2579
|
* @returns {boolean} - TRUE if a default value is set.
|
|
2673
2580
|
*/
|
|
2674
2581
|
get hasDefaultValue() {
|
|
2675
|
-
return
|
|
2676
|
-
(this.component.
|
|
2677
|
-
|
|
2678
|
-
this.component.defaultValue !== undefined));
|
|
2582
|
+
return this.component.customDefaultValue || (this.component.hasOwnProperty('defaultValue') &&
|
|
2583
|
+
(this.component.defaultValue !== null) &&
|
|
2584
|
+
(this.component.defaultValue !== undefined));
|
|
2679
2585
|
}
|
|
2680
2586
|
/**
|
|
2681
2587
|
* Determine if we should add a default value for this component.
|
|
@@ -2770,7 +2676,7 @@ export default class Component extends Element {
|
|
|
2770
2676
|
Array.isArray(this.defaultValue) &&
|
|
2771
2677
|
this.refs.hasOwnProperty('input') &&
|
|
2772
2678
|
valueInput &&
|
|
2773
|
-
valueInput.length !== value.length &&
|
|
2679
|
+
(valueInput.length !== value.length) &&
|
|
2774
2680
|
this.visible) {
|
|
2775
2681
|
if (isFilelink || valueInput.length) {
|
|
2776
2682
|
this.redraw();
|
|
@@ -2824,9 +2730,9 @@ export default class Component extends Element {
|
|
|
2824
2730
|
}
|
|
2825
2731
|
setDefaultValue() {
|
|
2826
2732
|
if (this.defaultValue && this.shouldAddDefaultValue) {
|
|
2827
|
-
const defaultValue = this.component.multiple && !this.dataValue.length ? [] : this.defaultValue;
|
|
2733
|
+
const defaultValue = (this.component.multiple && !this.dataValue.length) ? [] : this.defaultValue;
|
|
2828
2734
|
this.setValue(defaultValue, {
|
|
2829
|
-
noUpdateEvent: true
|
|
2735
|
+
noUpdateEvent: true
|
|
2830
2736
|
});
|
|
2831
2737
|
}
|
|
2832
2738
|
}
|
|
@@ -2836,7 +2742,7 @@ export default class Component extends Element {
|
|
|
2836
2742
|
restoreValue() {
|
|
2837
2743
|
if (this.hasSetValue) {
|
|
2838
2744
|
this.setValue(this.dataValue, {
|
|
2839
|
-
noUpdateEvent: true
|
|
2745
|
+
noUpdateEvent: true
|
|
2840
2746
|
});
|
|
2841
2747
|
}
|
|
2842
2748
|
else {
|
|
@@ -2858,10 +2764,10 @@ export default class Component extends Element {
|
|
|
2858
2764
|
* @returns {boolean} - If the value changed.
|
|
2859
2765
|
*/
|
|
2860
2766
|
updateComponentValue(value, flags = {}) {
|
|
2861
|
-
let newValue = !flags.resetValue && (value === undefined || value === null) ? this.getValue() : value;
|
|
2767
|
+
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
2862
2768
|
newValue = this.normalizeValue(newValue, flags);
|
|
2863
2769
|
const oldValue = this.dataValue;
|
|
2864
|
-
let changed = newValue !== undefined ? this.hasChanged(newValue, oldValue) : false;
|
|
2770
|
+
let changed = ((newValue !== undefined) ? this.hasChanged(newValue, oldValue) : false);
|
|
2865
2771
|
if (changed) {
|
|
2866
2772
|
this.dataValue = newValue;
|
|
2867
2773
|
changed = this.dataValue !== oldValue;
|
|
@@ -2885,7 +2791,7 @@ export default class Component extends Element {
|
|
|
2885
2791
|
className: this.iconClass(name),
|
|
2886
2792
|
ref,
|
|
2887
2793
|
styles,
|
|
2888
|
-
content
|
|
2794
|
+
content
|
|
2889
2795
|
});
|
|
2890
2796
|
}
|
|
2891
2797
|
/**
|
|
@@ -2896,7 +2802,7 @@ export default class Component extends Element {
|
|
|
2896
2802
|
this.setValue(this.defaultValue || this.emptyValue, {
|
|
2897
2803
|
noUpdateEvent: true,
|
|
2898
2804
|
noValidate: true,
|
|
2899
|
-
resetValue: true
|
|
2805
|
+
resetValue: true
|
|
2900
2806
|
});
|
|
2901
2807
|
}
|
|
2902
2808
|
/**
|
|
@@ -2906,12 +2812,15 @@ export default class Component extends Element {
|
|
|
2906
2812
|
* @returns {boolean} - TRUE if the value has changed.
|
|
2907
2813
|
*/
|
|
2908
2814
|
hasChanged(newValue, oldValue) {
|
|
2909
|
-
if ((newValue === undefined || newValue === null) &&
|
|
2910
|
-
(oldValue === undefined || oldValue === null || this.isEmpty(oldValue))) {
|
|
2815
|
+
if (((newValue === undefined) || (newValue === null)) &&
|
|
2816
|
+
((oldValue === undefined) || (oldValue === null) || this.isEmpty(oldValue))) {
|
|
2911
2817
|
return false;
|
|
2912
2818
|
}
|
|
2913
2819
|
// If we do not have a value and are getting set to anything other than undefined or null, then we changed.
|
|
2914
|
-
if (newValue !== undefined &&
|
|
2820
|
+
if (newValue !== undefined &&
|
|
2821
|
+
newValue !== null &&
|
|
2822
|
+
this.allowData &&
|
|
2823
|
+
!this.hasValue()) {
|
|
2915
2824
|
return true;
|
|
2916
2825
|
}
|
|
2917
2826
|
return !_.isEqual(newValue, oldValue);
|
|
@@ -2928,7 +2837,7 @@ export default class Component extends Element {
|
|
|
2928
2837
|
// Reset the errors when a submission has been made and allow it to revalidate.
|
|
2929
2838
|
this._errors = [];
|
|
2930
2839
|
}
|
|
2931
|
-
this.triggerChange(flags);
|
|
2840
|
+
this.triggerChange?.(flags);
|
|
2932
2841
|
return true;
|
|
2933
2842
|
}
|
|
2934
2843
|
return false;
|
|
@@ -2945,10 +2854,11 @@ export default class Component extends Element {
|
|
|
2945
2854
|
data,
|
|
2946
2855
|
row: row || this.data,
|
|
2947
2856
|
submission: this.root?._submission || {
|
|
2948
|
-
data: this.rootValue
|
|
2949
|
-
}
|
|
2857
|
+
data: this.rootValue
|
|
2858
|
+
}
|
|
2950
2859
|
}, 'value');
|
|
2951
2860
|
}
|
|
2861
|
+
/* eslint-disable max-statements */
|
|
2952
2862
|
calculateComponentValue(data, flags, row) {
|
|
2953
2863
|
// Skip value calculation for the component if we don't have entire form data set or in builder mode
|
|
2954
2864
|
if (this.builderMode || _.isUndefined(_.get(this, 'root.data'))) {
|
|
@@ -2969,10 +2879,7 @@ export default class Component extends Element {
|
|
|
2969
2879
|
!(this.component.calculateValue || this.component.calculateValueVariable) ||
|
|
2970
2880
|
(this.options.server && !this.component.calculateServer) ||
|
|
2971
2881
|
(flags.dataSourceInitialLoading && allowOverride) ||
|
|
2972
|
-
(this.options.readOnly &&
|
|
2973
|
-
this.options.pdf &&
|
|
2974
|
-
allowOverride &&
|
|
2975
|
-
_.get(this.root, 'submission._id', false))) {
|
|
2882
|
+
(this.options.readOnly && this.options.pdf && allowOverride && _.get(this.root, 'submission._id', false))) {
|
|
2976
2883
|
return false;
|
|
2977
2884
|
}
|
|
2978
2885
|
const dataValue = this.dataValue;
|
|
@@ -2988,7 +2895,7 @@ export default class Component extends Element {
|
|
|
2988
2895
|
// Do not override calculations on server if they have calculateServer set.
|
|
2989
2896
|
if (allowOverride) {
|
|
2990
2897
|
// The value is considered locked if it is not empty and comes from a submission value.
|
|
2991
|
-
const fromSubmission = flags.fromSubmission && this.component.persistent === true;
|
|
2898
|
+
const fromSubmission = (flags.fromSubmission && this.component.persistent === true);
|
|
2992
2899
|
if (this.isEmpty(dataValue)) {
|
|
2993
2900
|
// Reset the calculation lock if ever the data is cleared.
|
|
2994
2901
|
this.calculationLocked = false;
|
|
@@ -2997,7 +2904,7 @@ export default class Component extends Element {
|
|
|
2997
2904
|
this.calculationLocked = true;
|
|
2998
2905
|
return false;
|
|
2999
2906
|
}
|
|
3000
|
-
const firstPass = this.calculatedValue === undefined || flags.resetValue;
|
|
2907
|
+
const firstPass = (this.calculatedValue === undefined) || flags.resetValue;
|
|
3001
2908
|
if (firstPass) {
|
|
3002
2909
|
this.calculatedValue = null;
|
|
3003
2910
|
}
|
|
@@ -3030,7 +2937,7 @@ export default class Component extends Element {
|
|
|
3030
2937
|
}
|
|
3031
2938
|
this.calculatedValue = fastCloneDeep(calculatedValue);
|
|
3032
2939
|
if (changed) {
|
|
3033
|
-
if (!flags.noPristineChangeOnModified && this.root
|
|
2940
|
+
if (!flags.noPristineChangeOnModified && this.root?.initialized) {
|
|
3034
2941
|
this.pristine = false;
|
|
3035
2942
|
}
|
|
3036
2943
|
flags.triggeredComponentId = this.id;
|
|
@@ -3038,6 +2945,7 @@ export default class Component extends Element {
|
|
|
3038
2945
|
}
|
|
3039
2946
|
return false;
|
|
3040
2947
|
}
|
|
2948
|
+
/* eslint-enable max-statements */
|
|
3041
2949
|
/**
|
|
3042
2950
|
* Performs calculations in this component plus any child components.
|
|
3043
2951
|
* @param {*} data - The data to perform the calculation with.
|
|
@@ -3112,8 +3020,8 @@ export default class Component extends Element {
|
|
|
3112
3020
|
scope: validationScope,
|
|
3113
3021
|
instance: this,
|
|
3114
3022
|
processors: [
|
|
3115
|
-
validateProcessInfo
|
|
3116
|
-
]
|
|
3023
|
+
validateProcessInfo
|
|
3024
|
+
]
|
|
3117
3025
|
});
|
|
3118
3026
|
const errors = validationScope.errors;
|
|
3119
3027
|
const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
@@ -3132,10 +3040,8 @@ export default class Component extends Element {
|
|
|
3132
3040
|
if (silentCheck) {
|
|
3133
3041
|
return [];
|
|
3134
3042
|
}
|
|
3135
|
-
const messages = errors.filter(
|
|
3136
|
-
if (errors.length &&
|
|
3137
|
-
!!messages.length &&
|
|
3138
|
-
(!this.isEmpty(this.defaultValue) || dirty || !this.pristine)) {
|
|
3043
|
+
const messages = errors.filter(message => !message.fromServer);
|
|
3044
|
+
if (errors.length && !!messages.length && (!this.isEmpty(this.defaultValue) || dirty || !this.pristine)) {
|
|
3139
3045
|
return this.setCustomValidity(messages, dirty);
|
|
3140
3046
|
}
|
|
3141
3047
|
else {
|
|
@@ -3149,12 +3055,7 @@ export default class Component extends Element {
|
|
|
3149
3055
|
*/
|
|
3150
3056
|
interpolateErrors(errors) {
|
|
3151
3057
|
const interpolatedErrors = FormioUtils.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
3152
|
-
return this.serverErrors?.length
|
|
3153
|
-
? [
|
|
3154
|
-
...interpolatedErrors,
|
|
3155
|
-
...this.serverErrors,
|
|
3156
|
-
]
|
|
3157
|
-
: interpolatedErrors;
|
|
3058
|
+
return this.serverErrors?.length ? [...interpolatedErrors, ...this.serverErrors] : interpolatedErrors;
|
|
3158
3059
|
}
|
|
3159
3060
|
/**
|
|
3160
3061
|
* Show component validation errors.
|
|
@@ -3168,7 +3069,7 @@ export default class Component extends Element {
|
|
|
3168
3069
|
if (flags.silentCheck) {
|
|
3169
3070
|
return [];
|
|
3170
3071
|
}
|
|
3171
|
-
let isDirty = flags.dirty === false ? false : this.dirty || flags.dirty;
|
|
3072
|
+
let isDirty = (flags.dirty === false) ? false : (this.dirty || flags.dirty);
|
|
3172
3073
|
if (this.options.alwaysDirty) {
|
|
3173
3074
|
isDirty = true;
|
|
3174
3075
|
}
|
|
@@ -3202,8 +3103,8 @@ export default class Component extends Element {
|
|
|
3202
3103
|
form: this.root ? this.root._form : {},
|
|
3203
3104
|
scope: { errors: [] },
|
|
3204
3105
|
processors: [
|
|
3205
|
-
validateProcessInfo
|
|
3206
|
-
]
|
|
3106
|
+
validateProcessInfo
|
|
3107
|
+
]
|
|
3207
3108
|
};
|
|
3208
3109
|
if (async) {
|
|
3209
3110
|
return processOne(processContext).then(() => {
|
|
@@ -3225,7 +3126,7 @@ export default class Component extends Element {
|
|
|
3225
3126
|
* @returns {boolean} - TRUE if the component is valid.
|
|
3226
3127
|
*/
|
|
3227
3128
|
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
3228
|
-
data = this.rootValue;
|
|
3129
|
+
data = data || this.rootValue;
|
|
3229
3130
|
row = row || this.data;
|
|
3230
3131
|
flags.dirty = dirty || false;
|
|
3231
3132
|
if (flags.async) {
|
|
@@ -3312,15 +3213,13 @@ export default class Component extends Element {
|
|
|
3312
3213
|
this.checkingData = false;
|
|
3313
3214
|
}
|
|
3314
3215
|
checkModal(errors = [], dirty = false) {
|
|
3315
|
-
const messages = errors.filter(
|
|
3216
|
+
const messages = errors.filter(error => !error.fromServer);
|
|
3316
3217
|
const isValid = errors.length === 0;
|
|
3317
3218
|
if (!this.component.modalEdit || !this.componentModal) {
|
|
3318
3219
|
return;
|
|
3319
3220
|
}
|
|
3320
3221
|
if (dirty && !isValid) {
|
|
3321
|
-
this.setErrorClasses([
|
|
3322
|
-
this.refs.openModal,
|
|
3323
|
-
], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3222
|
+
this.setErrorClasses([this.refs.openModal], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3324
3223
|
}
|
|
3325
3224
|
else {
|
|
3326
3225
|
this.clearErrorClasses(this.refs.openModalWrapper);
|
|
@@ -3330,7 +3229,7 @@ export default class Component extends Element {
|
|
|
3330
3229
|
return this.dataValue;
|
|
3331
3230
|
}
|
|
3332
3231
|
isEmpty(value = this.dataValue) {
|
|
3333
|
-
const isEmptyArray = _.isArray(value) && value.length === 1 ? _.isEqual(value[0], this.emptyValue) : false;
|
|
3232
|
+
const isEmptyArray = (_.isArray(value) && value.length === 1) ? _.isEqual(value[0], this.emptyValue) : false;
|
|
3334
3233
|
return value == null || value.length === 0 || _.isEqual(value, this.emptyValue) || isEmptyArray;
|
|
3335
3234
|
}
|
|
3336
3235
|
isEqual(valueA, valueB = this.dataValue) {
|
|
@@ -3361,7 +3260,7 @@ export default class Component extends Element {
|
|
|
3361
3260
|
}
|
|
3362
3261
|
addFocusBlurEvents(element) {
|
|
3363
3262
|
this.addEventListener(element, 'focus', () => {
|
|
3364
|
-
if (this.root.focusedComponent !== this) {
|
|
3263
|
+
if (this.root && this.root.focusedComponent !== this) {
|
|
3365
3264
|
if (this.root.pendingBlur) {
|
|
3366
3265
|
this.root.pendingBlur();
|
|
3367
3266
|
}
|
|
@@ -3377,11 +3276,11 @@ export default class Component extends Element {
|
|
|
3377
3276
|
this.root.pendingBlur = FormioUtils.delay(() => {
|
|
3378
3277
|
this.emit('blur', this);
|
|
3379
3278
|
if (this.component.validateOn === 'blur') {
|
|
3380
|
-
this.root.triggerChange({ fromBlur: true }, {
|
|
3279
|
+
this.root.triggerChange?.({ fromBlur: true }, {
|
|
3381
3280
|
instance: this,
|
|
3382
3281
|
component: this.component,
|
|
3383
3282
|
value: this.dataValue,
|
|
3384
|
-
flags: { fromBlur: true }
|
|
3283
|
+
flags: { fromBlur: true }
|
|
3385
3284
|
});
|
|
3386
3285
|
}
|
|
3387
3286
|
this.root.focusedComponent = null;
|
|
@@ -3389,6 +3288,7 @@ export default class Component extends Element {
|
|
|
3389
3288
|
});
|
|
3390
3289
|
});
|
|
3391
3290
|
}
|
|
3291
|
+
// eslint-disable-next-line max-statements
|
|
3392
3292
|
setCustomValidity(messages, dirty, external) {
|
|
3393
3293
|
const inputRefs = this.isInputComponent ? this.refs.input || [] : null;
|
|
3394
3294
|
if (typeof messages === 'string' && messages) {
|
|
@@ -3400,15 +3300,13 @@ export default class Component extends Element {
|
|
|
3400
3300
|
}
|
|
3401
3301
|
if (!Array.isArray(messages)) {
|
|
3402
3302
|
if (messages) {
|
|
3403
|
-
messages = [
|
|
3404
|
-
messages,
|
|
3405
|
-
];
|
|
3303
|
+
messages = [messages];
|
|
3406
3304
|
}
|
|
3407
3305
|
else {
|
|
3408
3306
|
messages = [];
|
|
3409
3307
|
}
|
|
3410
3308
|
}
|
|
3411
|
-
const errors = messages.filter(
|
|
3309
|
+
const errors = messages.filter(message => message.level === 'error');
|
|
3412
3310
|
let invalidInputRefs = inputRefs;
|
|
3413
3311
|
// Filter the invalid input refs in multiple components
|
|
3414
3312
|
if (this.component.multiple) {
|
|
@@ -3439,7 +3337,7 @@ export default class Component extends Element {
|
|
|
3439
3337
|
this.setErrorClasses(invalidInputRefs, dirty, !!errors.length, !!messages.length);
|
|
3440
3338
|
}
|
|
3441
3339
|
}
|
|
3442
|
-
else if (!errors.length || errors[0].external === !!external) {
|
|
3340
|
+
else if (!errors.length || (errors[0].external === !!external)) {
|
|
3443
3341
|
if (this.refs.messageContainer) {
|
|
3444
3342
|
this.empty(this.refs.messageContainer);
|
|
3445
3343
|
}
|
|
@@ -3460,7 +3358,7 @@ export default class Component extends Element {
|
|
|
3460
3358
|
* @returns {boolean|*} - TRUE if the value is hidden.
|
|
3461
3359
|
*/
|
|
3462
3360
|
isValueHidden() {
|
|
3463
|
-
if (this.component.protected && this.root
|
|
3361
|
+
if (this.component.protected && this.root?.editing) {
|
|
3464
3362
|
return false;
|
|
3465
3363
|
}
|
|
3466
3364
|
if (!this.root || !this.root.hasOwnProperty('editing')) {
|
|
@@ -3469,9 +3367,7 @@ export default class Component extends Element {
|
|
|
3469
3367
|
if (!this.root || !this.root.editing) {
|
|
3470
3368
|
return false;
|
|
3471
3369
|
}
|
|
3472
|
-
return (this.component.protected ||
|
|
3473
|
-
!this.component.persistent ||
|
|
3474
|
-
this.component.persistent === 'client-only');
|
|
3370
|
+
return (this.component.protected || !this.component.persistent || (this.component.persistent === 'client-only'));
|
|
3475
3371
|
}
|
|
3476
3372
|
shouldSkipValidation(data, row, flags = {}) {
|
|
3477
3373
|
const rules = [
|
|
@@ -3485,16 +3381,15 @@ export default class Component extends Element {
|
|
|
3485
3381
|
() => this.isValueHidden(),
|
|
3486
3382
|
// Force valid if component is hidden.
|
|
3487
3383
|
() => {
|
|
3488
|
-
if (!this.component.validateWhenHidden &&
|
|
3489
|
-
(!this.visible || !this.checkCondition(row, data))) {
|
|
3384
|
+
if (!this.component.validateWhenHidden && (!this.visible || !this.checkCondition(row, data))) {
|
|
3490
3385
|
// If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
|
|
3491
3386
|
this._errors = [];
|
|
3492
3387
|
return true;
|
|
3493
3388
|
}
|
|
3494
3389
|
return false;
|
|
3495
|
-
}
|
|
3390
|
+
}
|
|
3496
3391
|
];
|
|
3497
|
-
return rules.some(
|
|
3392
|
+
return rules.some(pred => pred());
|
|
3498
3393
|
}
|
|
3499
3394
|
// Maintain reverse compatibility.
|
|
3500
3395
|
whenReady() {
|
|
@@ -3511,13 +3406,7 @@ export default class Component extends Element {
|
|
|
3511
3406
|
*/
|
|
3512
3407
|
asString(value) {
|
|
3513
3408
|
value = value || this.getValue();
|
|
3514
|
-
return (Array.isArray(value)
|
|
3515
|
-
? value
|
|
3516
|
-
: [
|
|
3517
|
-
value,
|
|
3518
|
-
])
|
|
3519
|
-
.map(_.toString)
|
|
3520
|
-
.join(', ');
|
|
3409
|
+
return (Array.isArray(value) ? value : [value]).map(_.toString).join(', ');
|
|
3521
3410
|
}
|
|
3522
3411
|
/**
|
|
3523
3412
|
* Return if the component is disabled.
|
|
@@ -3546,13 +3435,13 @@ export default class Component extends Element {
|
|
|
3546
3435
|
}
|
|
3547
3436
|
}
|
|
3548
3437
|
setLoading(element, loading) {
|
|
3549
|
-
if (!element || element.loading === loading) {
|
|
3438
|
+
if (!element || (element.loading === loading)) {
|
|
3550
3439
|
return;
|
|
3551
3440
|
}
|
|
3552
3441
|
element.loading = loading;
|
|
3553
3442
|
if (!element.loader && loading) {
|
|
3554
3443
|
element.loader = this.ce('i', {
|
|
3555
|
-
class: `${this.iconClass('refresh', true)} button-icon-right
|
|
3444
|
+
class: `${this.iconClass('refresh', true)} button-icon-right`
|
|
3556
3445
|
});
|
|
3557
3446
|
}
|
|
3558
3447
|
if (element.loader) {
|
|
@@ -3567,9 +3456,9 @@ export default class Component extends Element {
|
|
|
3567
3456
|
selectOptions(select, tag, options, defaultValue) {
|
|
3568
3457
|
_.each(options, (option) => {
|
|
3569
3458
|
const attrs = {
|
|
3570
|
-
value: option.value
|
|
3459
|
+
value: option.value
|
|
3571
3460
|
};
|
|
3572
|
-
if (defaultValue !== undefined && option.value === defaultValue) {
|
|
3461
|
+
if (defaultValue !== undefined && (option.value === defaultValue)) {
|
|
3573
3462
|
attrs.selected = 'selected';
|
|
3574
3463
|
}
|
|
3575
3464
|
const optionElement = this.ce('option', attrs);
|
|
@@ -3596,7 +3485,8 @@ export default class Component extends Element {
|
|
|
3596
3485
|
}
|
|
3597
3486
|
getRelativePath(path) {
|
|
3598
3487
|
const keyPart = `.${this.key}`;
|
|
3599
|
-
const thisPath = this.isInputComponent ? this.path
|
|
3488
|
+
const thisPath = this.isInputComponent ? this.path
|
|
3489
|
+
: this.path.slice(0).replace(keyPart, '');
|
|
3600
3490
|
return path.replace(thisPath, '');
|
|
3601
3491
|
}
|
|
3602
3492
|
clear() {
|
|
@@ -3613,7 +3503,7 @@ export default class Component extends Element {
|
|
|
3613
3503
|
this.removeChildFrom(element, this.element);
|
|
3614
3504
|
}
|
|
3615
3505
|
detachLogic() {
|
|
3616
|
-
this.logic.forEach(
|
|
3506
|
+
this.logic.forEach(logic => {
|
|
3617
3507
|
if (logic.trigger.type === 'event') {
|
|
3618
3508
|
const event = this.interpolate(logic.trigger.event);
|
|
3619
3509
|
this.off(event); // only applies to callbacks on this component
|
|
@@ -3634,16 +3524,10 @@ export default class Component extends Element {
|
|
|
3634
3524
|
// If component definition changed, replace it.
|
|
3635
3525
|
if (!_.isEqual(this.component, newComponent)) {
|
|
3636
3526
|
this.component = newComponent;
|
|
3637
|
-
const visible = this.hasCondition()
|
|
3638
|
-
? !this.conditionallyHidden()
|
|
3639
|
-
: !this.component.hidden;
|
|
3527
|
+
const visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
|
|
3640
3528
|
const disabled = this.shouldDisabled;
|
|
3641
3529
|
// Change states which won't be recalculated during redrawing
|
|
3642
3530
|
if (this.visible !== visible) {
|
|
3643
|
-
// If the logic is triggered by an event and the action sets the hidden state then the original
|
|
3644
|
-
// component definition must be changed so that the components hidden state does not get flipped back by
|
|
3645
|
-
// the fieldLogic function
|
|
3646
|
-
this.originalComponent.hidden = !visible;
|
|
3647
3531
|
this.visible = visible;
|
|
3648
3532
|
}
|
|
3649
3533
|
if (this.disabled !== disabled) {
|
|
@@ -3665,7 +3549,7 @@ export default class Component extends Element {
|
|
|
3665
3549
|
name: this.options.name,
|
|
3666
3550
|
type: this.component.inputType || 'text',
|
|
3667
3551
|
class: 'form-control',
|
|
3668
|
-
lang: this.options.language
|
|
3552
|
+
lang: this.options.language
|
|
3669
3553
|
};
|
|
3670
3554
|
if (this.component.placeholder) {
|
|
3671
3555
|
attributes.placeholder = this.t(this.component.placeholder, { _userInput: true });
|
|
@@ -3681,7 +3565,7 @@ export default class Component extends Element {
|
|
|
3681
3565
|
type: 'input',
|
|
3682
3566
|
component: this.component,
|
|
3683
3567
|
changeEvent: 'change',
|
|
3684
|
-
attr: attributes
|
|
3568
|
+
attr: attributes
|
|
3685
3569
|
};
|
|
3686
3570
|
}
|
|
3687
3571
|
autofocus() {
|
|
@@ -3769,18 +3653,14 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3769
3653
|
Component.externalLibraries[name].resolve(plugin);
|
|
3770
3654
|
}
|
|
3771
3655
|
else {
|
|
3772
|
-
src = Array.isArray(src)
|
|
3773
|
-
? src
|
|
3774
|
-
: [
|
|
3775
|
-
src,
|
|
3776
|
-
];
|
|
3656
|
+
src = Array.isArray(src) ? src : [src];
|
|
3777
3657
|
src.forEach((lib) => {
|
|
3778
3658
|
let attrs = {};
|
|
3779
3659
|
let elementType = '';
|
|
3780
3660
|
if (typeof lib === 'string') {
|
|
3781
3661
|
lib = {
|
|
3782
3662
|
type: 'script',
|
|
3783
|
-
src: lib
|
|
3663
|
+
src: lib
|
|
3784
3664
|
};
|
|
3785
3665
|
}
|
|
3786
3666
|
switch (lib.type) {
|
|
@@ -3790,14 +3670,14 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3790
3670
|
src: lib.src,
|
|
3791
3671
|
type: 'text/javascript',
|
|
3792
3672
|
defer: true,
|
|
3793
|
-
async: true
|
|
3673
|
+
async: true
|
|
3794
3674
|
};
|
|
3795
3675
|
break;
|
|
3796
3676
|
case 'styles':
|
|
3797
3677
|
elementType = 'link';
|
|
3798
3678
|
attrs = {
|
|
3799
3679
|
href: lib.src,
|
|
3800
|
-
rel: 'stylesheet'
|
|
3680
|
+
rel: 'stylesheet'
|
|
3801
3681
|
};
|
|
3802
3682
|
break;
|
|
3803
3683
|
}
|
|
@@ -3826,7 +3706,8 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3826
3706
|
return Component.externalLibraries[name].ready;
|
|
3827
3707
|
};
|
|
3828
3708
|
Component.libraryReady = function (name) {
|
|
3829
|
-
if (Component.externalLibraries.hasOwnProperty(name) &&
|
|
3709
|
+
if (Component.externalLibraries.hasOwnProperty(name) &&
|
|
3710
|
+
Component.externalLibraries[name].ready) {
|
|
3830
3711
|
return Component.externalLibraries[name].ready;
|
|
3831
3712
|
}
|
|
3832
3713
|
return Promise.reject(`${name} library was not required.`);
|