@formio/js 5.2.3 → 5.2.4-rc.0
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 +161 -50
- 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 +158 -49
- package/dist/formio.form.js +152 -108
- 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 +161 -50
- package/dist/formio.full.js +401 -227
- 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 +51 -18
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.js +47 -14
- 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 +3 -2
- package/lib/cjs/Element.js +27 -21
- package/lib/cjs/Embed.js +74 -40
- package/lib/cjs/EventEmitter.js +1 -1
- package/lib/cjs/Form.d.ts +371 -341
- package/lib/cjs/Form.js +153 -39
- package/lib/cjs/FormBuilder.d.ts +3 -3
- package/lib/cjs/FormBuilder.js +2 -3
- package/lib/cjs/Formio.js +26 -23
- package/lib/cjs/InlineEmbed.js +23 -17
- package/lib/cjs/PDF.d.ts +1 -0
- package/lib/cjs/PDF.js +18 -15
- package/lib/cjs/PDFBuilder.js +51 -36
- package/lib/cjs/Webform.d.ts +8 -366
- package/lib/cjs/Webform.js +176 -235
- package/lib/cjs/WebformBuilder.js +217 -144
- package/lib/cjs/Wizard.js +92 -62
- package/lib/cjs/WizardBuilder.js +27 -19
- package/lib/cjs/addons/FormioAddon.js +1 -1
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +59 -57
- package/lib/cjs/addons/PasswordStrength/PasswordStrengthAddon.js +24 -16
- package/lib/cjs/addons/index.js +3 -3
- package/lib/cjs/components/Components.js +0 -4
- package/lib/cjs/components/_classes/component/Component.form.js +11 -11
- package/lib/cjs/components/_classes/component/Component.js +298 -179
- package/lib/cjs/components/_classes/component/editForm/Component.edit.addons.js +2 -4
- package/lib/cjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
- package/lib/cjs/components/_classes/component/editForm/Component.edit.conditional.js +9 -11
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.d.ts +37 -0
- package/lib/cjs/components/_classes/component/editForm/Component.edit.data.js +39 -25
- package/lib/cjs/components/_classes/component/editForm/Component.edit.display.js +47 -29
- package/lib/cjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
- package/lib/cjs/components/_classes/component/editForm/Component.edit.logic.js +5 -7
- package/lib/cjs/components/_classes/component/editForm/Component.edit.validation.js +37 -34
- package/lib/cjs/components/_classes/component/editForm/utils.js +12 -16
- package/lib/cjs/components/_classes/componentModal/ComponentModal.js +6 -6
- package/lib/cjs/components/_classes/field/Field.js +7 -1
- package/lib/cjs/components/_classes/input/Input.js +30 -26
- package/lib/cjs/components/_classes/list/ListComponent.form.js +1 -1
- package/lib/cjs/components/_classes/list/ListComponent.js +27 -18
- package/lib/cjs/components/_classes/list/editForm/ListComponent.edit.data.js +36 -9
- package/lib/cjs/components/_classes/multivalue/Multivalue.js +32 -13
- package/lib/cjs/components/_classes/nested/NestedComponent.form.js +3 -3
- package/lib/cjs/components/_classes/nested/NestedComponent.js +36 -32
- package/lib/cjs/components/_classes/nestedarray/NestedArrayComponent.js +19 -14
- package/lib/cjs/components/_classes/nesteddata/NestedDataComponent.js +19 -17
- package/lib/cjs/components/address/Address.js +52 -45
- 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 +53 -11
- package/lib/cjs/components/alert/Alert.js +21 -15
- package/lib/cjs/components/button/Button.form.js +1 -1
- package/lib/cjs/components/button/Button.js +50 -27
- package/lib/cjs/components/button/editForm/Button.edit.display.js +49 -9
- 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 +28 -20
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
- package/lib/cjs/components/checkbox/editForm/Checkbox.edit.display.js +13 -3
- 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 +24 -12
- 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 +6 -4
- 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 +4 -2
- package/lib/cjs/components/content/Content.js +10 -8
- 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 +19 -10
- 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 +89 -38
- 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 +44 -31
- 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 +30 -15
- package/lib/cjs/components/datetime/editForm/DateTime.edit.data.js +4 -3
- package/lib/cjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
- package/lib/cjs/components/datetime/editForm/DateTime.edit.display.js +22 -17
- 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 +146 -56
- package/lib/cjs/components/day/editForm/Day.edit.day.js +13 -9
- package/lib/cjs/components/day/editForm/Day.edit.display.js +7 -7
- package/lib/cjs/components/day/editForm/Day.edit.month.js +12 -8
- 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 +137 -89
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
- package/lib/cjs/components/editgrid/editForm/EditGrid.edit.display.js +7 -2
- 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 +126 -80
- package/lib/cjs/components/file/editForm/File.edit.display.js +9 -5
- package/lib/cjs/components/file/editForm/File.edit.file.d.ts +37 -16
- package/lib/cjs/components/file/editForm/File.edit.file.js +169 -72
- 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 +67 -51
- package/lib/cjs/components/form/editForm/Form.edit.data.js +1 -3
- package/lib/cjs/components/form/editForm/Form.edit.display.js +6 -7
- package/lib/cjs/components/form/editForm/Form.edit.form.js +11 -9
- 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 +23 -17
- 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 +27 -11
- 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 +5 -7
- package/lib/cjs/components/panel/editForm/Panel.edit.display.js +55 -29
- package/lib/cjs/components/password/Password.form.js +3 -3
- package/lib/cjs/components/password/Password.js +5 -2
- 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 +55 -26
- package/lib/cjs/components/radio/editForm/Radio.edit.data.js +23 -9
- 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 +7 -5
- 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 +235 -129
- package/lib/cjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/cjs/components/select/editForm/Select.edit.data.js +191 -57
- 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 +31 -15
- 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 +25 -15
- package/lib/cjs/components/signature/editForm/Signature.edit.display.js +19 -10
- package/lib/cjs/components/survey/Survey.form.js +3 -3
- package/lib/cjs/components/survey/Survey.js +30 -17
- package/lib/cjs/components/survey/editForm/Survey.edit.data.js +23 -11
- 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 -5
- 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 +26 -8
- package/lib/cjs/components/tabs/editForm/Tabs.edit.display.js +21 -17
- package/lib/cjs/components/tags/Tags.form.js +1 -1
- package/lib/cjs/components/tags/Tags.js +28 -12
- 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 +63 -45
- package/lib/cjs/components/textarea/editForm/TextArea.edit.display.js +96 -72
- 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 +32 -21
- package/lib/cjs/components/textfield/editForm/TextField.edit.data.js +15 -13
- package/lib/cjs/components/textfield/editForm/TextField.edit.display.js +31 -21
- package/lib/cjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
- package/lib/cjs/components/time/Time.js +17 -10
- 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 +2 -1
- package/lib/cjs/formio.form.js +38 -12
- package/lib/cjs/i18n.d.ts +4 -0
- package/lib/cjs/i18n.js +7 -3
- package/lib/cjs/package.json +1 -1
- package/lib/cjs/providers/address/AddressProvider.js +8 -5
- package/lib/cjs/providers/address/GoogleAddressProvider.d.ts +3 -3
- package/lib/cjs/providers/address/GoogleAddressProvider.js +24 -13
- package/lib/cjs/providers/processor/fileProcessor.js +3 -1
- package/lib/cjs/providers/storage/azure.js +5 -2
- package/lib/cjs/providers/storage/dropbox.js +4 -5
- package/lib/cjs/providers/storage/googleDrive.js +3 -4
- package/lib/cjs/providers/storage/index.js +1 -1
- package/lib/cjs/providers/storage/indexeddb.js +16 -6
- package/lib/cjs/providers/storage/s3.js +17 -6
- package/lib/cjs/providers/storage/uploadAdapter.js +17 -11
- package/lib/cjs/providers/storage/url.js +13 -11
- package/lib/cjs/providers/storage/xhr.js +17 -9
- package/lib/cjs/templates/index.js +1 -1
- package/lib/cjs/translations/de.d.ts +80 -0
- package/lib/cjs/translations/de.js +81 -0
- package/lib/cjs/translations/en.d.ts +0 -2
- package/lib/cjs/translations/en.js +7 -9
- package/lib/cjs/utils/ChoicesWrapper.js +2 -2
- package/lib/cjs/utils/builder.js +31 -7
- package/lib/cjs/utils/calendarUtils.js +7 -5
- package/lib/cjs/utils/conditionOperators/ConditionOperator.js +1 -1
- package/lib/cjs/utils/conditionOperators/DateGreaterThan.js +12 -4
- package/lib/cjs/utils/conditionOperators/IsEmptyValue.js +3 -1
- package/lib/cjs/utils/conditionOperators/IsEqualTo.js +10 -6
- package/lib/cjs/utils/conditionOperators/index.js +1 -1
- package/lib/cjs/utils/formUtils.js +1 -1
- package/lib/cjs/utils/i18n.js +7 -1
- package/lib/cjs/utils/index.d.ts +2 -1
- package/lib/cjs/utils/index.js +2 -2
- package/lib/cjs/utils/utils.d.ts +10 -1
- package/lib/cjs/utils/utils.js +175 -92
- package/lib/cjs/widgets/CalendarWidget.js +66 -49
- package/lib/cjs/widgets/InputWidget.js +6 -4
- package/lib/cjs/widgets/index.js +1 -1
- package/lib/mjs/CDN.js +12 -12
- package/lib/mjs/Element.d.ts +3 -2
- package/lib/mjs/Element.js +27 -21
- package/lib/mjs/Embed.js +76 -42
- package/lib/mjs/EventEmitter.js +1 -1
- package/lib/mjs/Form.d.ts +371 -341
- package/lib/mjs/Form.js +142 -126
- package/lib/mjs/FormBuilder.d.ts +3 -3
- package/lib/mjs/FormBuilder.js +2 -3
- package/lib/mjs/Formio.js +26 -23
- package/lib/mjs/InlineEmbed.js +23 -17
- package/lib/mjs/PDF.d.ts +1 -0
- package/lib/mjs/PDF.js +18 -15
- package/lib/mjs/PDFBuilder.js +51 -36
- package/lib/mjs/Webform.d.ts +8 -366
- package/lib/mjs/Webform.js +183 -250
- package/lib/mjs/WebformBuilder.js +220 -147
- package/lib/mjs/Wizard.js +93 -63
- package/lib/mjs/WizardBuilder.js +27 -19
- package/lib/mjs/addons/FormioAddon.js +1 -1
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.form.js +59 -57
- package/lib/mjs/addons/PasswordStrength/PasswordStrengthAddon.js +24 -16
- package/lib/mjs/addons/index.js +3 -3
- package/lib/mjs/components/Components.js +0 -4
- package/lib/mjs/components/_classes/component/Component.form.js +11 -11
- package/lib/mjs/components/_classes/component/Component.js +303 -184
- package/lib/mjs/components/_classes/component/editForm/Component.edit.addons.js +2 -4
- package/lib/mjs/components/_classes/component/editForm/Component.edit.api.js +5 -5
- package/lib/mjs/components/_classes/component/editForm/Component.edit.conditional.js +9 -11
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.d.ts +37 -0
- package/lib/mjs/components/_classes/component/editForm/Component.edit.data.js +39 -25
- package/lib/mjs/components/_classes/component/editForm/Component.edit.display.js +47 -29
- package/lib/mjs/components/_classes/component/editForm/Component.edit.layout.js +9 -9
- package/lib/mjs/components/_classes/component/editForm/Component.edit.logic.js +5 -7
- package/lib/mjs/components/_classes/component/editForm/Component.edit.validation.js +37 -34
- package/lib/mjs/components/_classes/component/editForm/utils.js +12 -16
- package/lib/mjs/components/_classes/componentModal/ComponentModal.js +2 -2
- package/lib/mjs/components/_classes/field/Field.js +8 -2
- package/lib/mjs/components/_classes/input/Input.js +27 -23
- package/lib/mjs/components/_classes/list/ListComponent.form.js +1 -1
- package/lib/mjs/components/_classes/list/ListComponent.js +27 -18
- package/lib/mjs/components/_classes/list/editForm/ListComponent.edit.data.js +36 -9
- package/lib/mjs/components/_classes/multivalue/Multivalue.js +32 -13
- package/lib/mjs/components/_classes/nested/NestedComponent.form.js +3 -3
- package/lib/mjs/components/_classes/nested/NestedComponent.js +32 -28
- package/lib/mjs/components/_classes/nestedarray/NestedArrayComponent.js +20 -15
- package/lib/mjs/components/_classes/nesteddata/NestedDataComponent.js +19 -17
- package/lib/mjs/components/address/Address.js +57 -46
- 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 +53 -11
- package/lib/mjs/components/alert/Alert.js +22 -16
- package/lib/mjs/components/button/Button.form.js +1 -1
- package/lib/mjs/components/button/Button.js +51 -28
- package/lib/mjs/components/button/editForm/Button.edit.display.js +49 -9
- 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 +29 -21
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.data.js +1 -1
- package/lib/mjs/components/checkbox/editForm/Checkbox.edit.display.js +13 -3
- 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 +24 -12
- 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 +6 -4
- 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 +4 -2
- package/lib/mjs/components/content/Content.js +10 -8
- 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 +19 -10
- 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 +90 -39
- 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 +44 -31
- 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 +31 -16
- package/lib/mjs/components/datetime/editForm/DateTime.edit.data.js +4 -3
- package/lib/mjs/components/datetime/editForm/DateTime.edit.date.js +10 -10
- package/lib/mjs/components/datetime/editForm/DateTime.edit.display.js +22 -17
- 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 +147 -57
- package/lib/mjs/components/day/editForm/Day.edit.day.js +13 -9
- package/lib/mjs/components/day/editForm/Day.edit.display.js +7 -7
- package/lib/mjs/components/day/editForm/Day.edit.month.js +12 -8
- 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 +138 -90
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.data.js +2 -2
- package/lib/mjs/components/editgrid/editForm/EditGrid.edit.display.js +7 -2
- 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 +131 -84
- package/lib/mjs/components/file/editForm/File.edit.display.js +9 -5
- package/lib/mjs/components/file/editForm/File.edit.file.d.ts +37 -16
- package/lib/mjs/components/file/editForm/File.edit.file.js +169 -72
- 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 +67 -51
- package/lib/mjs/components/form/editForm/Form.edit.data.js +1 -3
- package/lib/mjs/components/form/editForm/Form.edit.display.js +6 -7
- package/lib/mjs/components/form/editForm/Form.edit.form.js +10 -8
- 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 +23 -17
- 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 +28 -12
- 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 +6 -8
- package/lib/mjs/components/panel/editForm/Panel.edit.display.js +55 -29
- package/lib/mjs/components/password/Password.form.js +3 -3
- package/lib/mjs/components/password/Password.js +5 -2
- 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 +56 -27
- package/lib/mjs/components/radio/editForm/Radio.edit.data.js +23 -9
- 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 +7 -5
- 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 +240 -134
- package/lib/mjs/components/select/editForm/Select.edit.data.d.ts +1 -1
- package/lib/mjs/components/select/editForm/Select.edit.data.js +191 -57
- 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 +32 -16
- 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 +25 -15
- package/lib/mjs/components/signature/editForm/Signature.edit.display.js +19 -10
- package/lib/mjs/components/survey/Survey.form.js +3 -3
- package/lib/mjs/components/survey/Survey.js +30 -17
- package/lib/mjs/components/survey/editForm/Survey.edit.data.js +23 -11
- 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 +7 -5
- 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 +26 -8
- package/lib/mjs/components/tabs/editForm/Tabs.edit.display.js +21 -17
- package/lib/mjs/components/tags/Tags.form.js +1 -1
- package/lib/mjs/components/tags/Tags.js +28 -12
- 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 +75 -51
- package/lib/mjs/components/textarea/editForm/TextArea.edit.display.js +96 -72
- 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 +34 -23
- package/lib/mjs/components/textfield/editForm/TextField.edit.data.js +15 -13
- package/lib/mjs/components/textfield/editForm/TextField.edit.display.js +31 -21
- package/lib/mjs/components/textfield/editForm/TextField.edit.validation.js +6 -6
- package/lib/mjs/components/time/Time.js +17 -10
- 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 +2 -1
- package/lib/mjs/formio.form.js +10 -8
- package/lib/mjs/i18n.d.ts +4 -0
- package/lib/mjs/i18n.js +7 -3
- package/lib/mjs/package.json +1 -1
- package/lib/mjs/providers/address/AddressProvider.js +8 -5
- package/lib/mjs/providers/address/GoogleAddressProvider.d.ts +3 -3
- package/lib/mjs/providers/address/GoogleAddressProvider.js +24 -13
- package/lib/mjs/providers/processor/fileProcessor.js +3 -1
- package/lib/mjs/providers/storage/azure.js +5 -2
- package/lib/mjs/providers/storage/dropbox.js +4 -5
- package/lib/mjs/providers/storage/googleDrive.js +3 -4
- package/lib/mjs/providers/storage/index.js +1 -1
- package/lib/mjs/providers/storage/indexeddb.js +16 -6
- package/lib/mjs/providers/storage/s3.js +19 -8
- package/lib/mjs/providers/storage/uploadAdapter.js +17 -11
- package/lib/mjs/providers/storage/url.js +13 -11
- package/lib/mjs/providers/storage/xhr.js +17 -9
- package/lib/mjs/templates/index.js +1 -1
- package/lib/mjs/translations/de.d.ts +80 -0
- package/lib/mjs/translations/de.js +79 -0
- package/lib/mjs/translations/en.d.ts +0 -2
- package/lib/mjs/translations/en.js +7 -9
- package/lib/mjs/utils/ChoicesWrapper.js +2 -2
- package/lib/mjs/utils/builder.js +31 -7
- package/lib/mjs/utils/calendarUtils.js +7 -5
- package/lib/mjs/utils/conditionOperators/ConditionOperator.js +1 -1
- package/lib/mjs/utils/conditionOperators/DateGreaterThan.js +16 -5
- package/lib/mjs/utils/conditionOperators/IsEmptyValue.js +3 -1
- package/lib/mjs/utils/conditionOperators/IsEqualTo.js +10 -6
- package/lib/mjs/utils/conditionOperators/index.js +1 -1
- package/lib/mjs/utils/formUtils.js +2 -2
- package/lib/mjs/utils/i18n.js +7 -1
- package/lib/mjs/utils/index.d.ts +2 -1
- package/lib/mjs/utils/index.js +3 -3
- package/lib/mjs/utils/utils.d.ts +10 -1
- package/lib/mjs/utils/utils.js +178 -91
- package/lib/mjs/widgets/CalendarWidget.js +67 -50
- package/lib/mjs/widgets/InputWidget.js +6 -4
- package/lib/mjs/widgets/index.js +1 -1
- package/package.json +3 -3
- package/lib/cjs/pdf.image.d.ts +0 -2
- package/lib/cjs/pdf.image.js +0 -94
- package/lib/cjs/utils/jsonlogic/operators.d.ts +0 -1
- package/lib/cjs/utils/jsonlogic/operators.js +0 -265
- package/lib/mjs/pdf.image.d.ts +0 -2
- package/lib/mjs/pdf.image.js +0 -94
- package/lib/mjs/utils/jsonlogic/operators.d.ts +0 -1
- package/lib/mjs/utils/jsonlogic/operators.js +0 -262
|
@@ -142,7 +142,7 @@ class Component extends Element_1.default {
|
|
|
142
142
|
*/
|
|
143
143
|
strictDateValidation: false,
|
|
144
144
|
multiple: false,
|
|
145
|
-
unique: false
|
|
145
|
+
unique: false,
|
|
146
146
|
},
|
|
147
147
|
/**
|
|
148
148
|
* The simple conditional settings for a component.
|
|
@@ -150,7 +150,7 @@ class Component extends Element_1.default {
|
|
|
150
150
|
conditional: {
|
|
151
151
|
show: null,
|
|
152
152
|
when: null,
|
|
153
|
-
eq: ''
|
|
153
|
+
eq: '',
|
|
154
154
|
},
|
|
155
155
|
overlay: {
|
|
156
156
|
style: '',
|
|
@@ -166,6 +166,7 @@ class Component extends Element_1.default {
|
|
|
166
166
|
properties: {},
|
|
167
167
|
allowMultipleMasks: false,
|
|
168
168
|
addons: [],
|
|
169
|
+
serverOverride: {},
|
|
169
170
|
}, ...sources);
|
|
170
171
|
}
|
|
171
172
|
/**
|
|
@@ -174,15 +175,20 @@ class Component extends Element_1.default {
|
|
|
174
175
|
*/
|
|
175
176
|
static get conditionOperatorsSettings() {
|
|
176
177
|
return {
|
|
177
|
-
operators: [
|
|
178
|
+
operators: [
|
|
179
|
+
'isEqual',
|
|
180
|
+
'isNotEqual',
|
|
181
|
+
'isEmpty',
|
|
182
|
+
'isNotEmpty',
|
|
183
|
+
],
|
|
178
184
|
valueComponent() {
|
|
179
185
|
return {
|
|
180
186
|
type: 'textfield',
|
|
181
187
|
widget: {
|
|
182
|
-
type: 'input'
|
|
183
|
-
}
|
|
188
|
+
type: 'input',
|
|
189
|
+
},
|
|
184
190
|
};
|
|
185
|
-
}
|
|
191
|
+
},
|
|
186
192
|
};
|
|
187
193
|
}
|
|
188
194
|
/**
|
|
@@ -192,7 +198,9 @@ class Component extends Element_1.default {
|
|
|
192
198
|
*/
|
|
193
199
|
static savedValueTypes(schema) {
|
|
194
200
|
schema = schema || {};
|
|
195
|
-
return utils_1.default.getComponentSavedTypes(schema) || [
|
|
201
|
+
return (utils_1.default.getComponentSavedTypes(schema) || [
|
|
202
|
+
utils_1.default.componentValueTypes.any,
|
|
203
|
+
]);
|
|
196
204
|
}
|
|
197
205
|
/**
|
|
198
206
|
* Provides a table view for this component. Override if you wish to do something different than using getView
|
|
@@ -209,13 +217,12 @@ class Component extends Element_1.default {
|
|
|
209
217
|
* @param {object} options - The options for this component.
|
|
210
218
|
* @param {object} data - The global data submission object this component will belong.
|
|
211
219
|
*/
|
|
212
|
-
/* eslint-disable max-statements */
|
|
213
220
|
constructor(component, options, data) {
|
|
214
221
|
var _a, _b, _c, _d;
|
|
215
222
|
super(Object.assign({
|
|
216
223
|
renderMode: 'form',
|
|
217
224
|
attachMode: 'full',
|
|
218
|
-
noDefaults: false
|
|
225
|
+
noDefaults: false,
|
|
219
226
|
}, options || {}));
|
|
220
227
|
// Restore the component id.
|
|
221
228
|
if (component && component.id) {
|
|
@@ -236,9 +243,7 @@ class Component extends Element_1.default {
|
|
|
236
243
|
*/
|
|
237
244
|
this.refs = {};
|
|
238
245
|
// Allow global override for any component JSON.
|
|
239
|
-
if (component &&
|
|
240
|
-
this.options.components &&
|
|
241
|
-
this.options.components[component.type]) {
|
|
246
|
+
if (component && this.options.components && this.options.components[component.type]) {
|
|
242
247
|
lodash_1.default.merge(component, this.options.components[component.type]);
|
|
243
248
|
}
|
|
244
249
|
/**
|
|
@@ -321,8 +326,12 @@ class Component extends Element_1.default {
|
|
|
321
326
|
/**
|
|
322
327
|
* Determines if this component is visible, or not.
|
|
323
328
|
*/
|
|
324
|
-
this._parentVisible = this.options.hasOwnProperty('parentVisible')
|
|
325
|
-
|
|
329
|
+
this._parentVisible = this.options.hasOwnProperty('parentVisible')
|
|
330
|
+
? this.options.parentVisible
|
|
331
|
+
: true;
|
|
332
|
+
this._visible =
|
|
333
|
+
this._parentVisible &&
|
|
334
|
+
(this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
|
|
326
335
|
this._parentDisabled = false;
|
|
327
336
|
/**
|
|
328
337
|
* The reference attribute name for this component
|
|
@@ -417,7 +426,6 @@ class Component extends Element_1.default {
|
|
|
417
426
|
this.init();
|
|
418
427
|
}
|
|
419
428
|
}
|
|
420
|
-
/* eslint-enable max-statements */
|
|
421
429
|
get componentsMap() {
|
|
422
430
|
var _a;
|
|
423
431
|
return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.childComponentsMap) || {};
|
|
@@ -476,10 +484,7 @@ class Component extends Element_1.default {
|
|
|
476
484
|
return Promise.resolve(this);
|
|
477
485
|
}
|
|
478
486
|
get isPDFReadOnlyMode() {
|
|
479
|
-
return this.parent &&
|
|
480
|
-
this.parent.form &&
|
|
481
|
-
(this.parent.form.display === 'pdf') &&
|
|
482
|
-
this.options.readOnly;
|
|
487
|
+
return (this.parent && this.parent.form && this.parent.form.display === 'pdf' && this.options.readOnly);
|
|
483
488
|
}
|
|
484
489
|
get labelInfo() {
|
|
485
490
|
const label = {};
|
|
@@ -488,7 +493,10 @@ class Component extends Element_1.default {
|
|
|
488
493
|
label.labelPosition = this.component.labelPosition;
|
|
489
494
|
label.tooltipClass = `${this.iconClass('question-sign')} text-muted`;
|
|
490
495
|
const isPDFReadOnlyMode = this.isPDFReadOnlyMode;
|
|
491
|
-
if (this.hasInput &&
|
|
496
|
+
if (this.hasInput &&
|
|
497
|
+
this.component.validate &&
|
|
498
|
+
(0, utils_2.boolValue)(this.component.validate.required) &&
|
|
499
|
+
!isPDFReadOnlyMode) {
|
|
492
500
|
label.className += ' field-required';
|
|
493
501
|
}
|
|
494
502
|
if (label.hidden) {
|
|
@@ -502,7 +510,7 @@ class Component extends Element_1.default {
|
|
|
502
510
|
init() {
|
|
503
511
|
var _a;
|
|
504
512
|
this.disabled = this.shouldDisabled;
|
|
505
|
-
this._visible =
|
|
513
|
+
this._visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
|
|
506
514
|
if ((_a = this.component.addons) === null || _a === void 0 ? void 0 : _a.length) {
|
|
507
515
|
this.component.addons.forEach((addon) => this.createAddon(addon));
|
|
508
516
|
}
|
|
@@ -538,8 +546,7 @@ class Component extends Element_1.default {
|
|
|
538
546
|
let addon = null;
|
|
539
547
|
if (Addon) {
|
|
540
548
|
const supportedComponents = Addon.info.supportedComponents;
|
|
541
|
-
const supportsThisComponentType = !(supportedComponents === null || supportedComponents === void 0 ? void 0 : supportedComponents.length) ||
|
|
542
|
-
supportedComponents.indexOf(this.component.type) !== -1;
|
|
549
|
+
const supportsThisComponentType = !(supportedComponents === null || supportedComponents === void 0 ? void 0 : supportedComponents.length) || supportedComponents.indexOf(this.component.type) !== -1;
|
|
543
550
|
if (supportsThisComponentType) {
|
|
544
551
|
addon = new Addon(settings, this);
|
|
545
552
|
this.addons.push(addon);
|
|
@@ -576,7 +583,9 @@ class Component extends Element_1.default {
|
|
|
576
583
|
}
|
|
577
584
|
}
|
|
578
585
|
get shouldDisabled() {
|
|
579
|
-
return this.options.readOnly ||
|
|
586
|
+
return (this.options.readOnly ||
|
|
587
|
+
this.component.disabled ||
|
|
588
|
+
(this.options.hasOwnProperty('disabled') && this.options.disabled[this.key]));
|
|
580
589
|
}
|
|
581
590
|
get isInputComponent() {
|
|
582
591
|
return !this.component.hasOwnProperty('input') || this.component.input;
|
|
@@ -755,7 +764,7 @@ class Component extends Element_1.default {
|
|
|
755
764
|
'left-left',
|
|
756
765
|
'left-right',
|
|
757
766
|
'right-left',
|
|
758
|
-
'right-right'
|
|
767
|
+
'right-right',
|
|
759
768
|
].includes(this.labelPosition);
|
|
760
769
|
}
|
|
761
770
|
get labelPositions() {
|
|
@@ -793,7 +802,7 @@ class Component extends Element_1.default {
|
|
|
793
802
|
isRightPosition,
|
|
794
803
|
isRightAlign,
|
|
795
804
|
labelStyles,
|
|
796
|
-
contentStyles
|
|
805
|
+
contentStyles,
|
|
797
806
|
};
|
|
798
807
|
}
|
|
799
808
|
/**
|
|
@@ -820,11 +829,11 @@ class Component extends Element_1.default {
|
|
|
820
829
|
modified[key] = val;
|
|
821
830
|
}
|
|
822
831
|
}
|
|
823
|
-
else if ((!recursion &&
|
|
824
|
-
(!recursion &&
|
|
825
|
-
(!recursion &&
|
|
826
|
-
(!recursion &&
|
|
827
|
-
(!recursion &&
|
|
832
|
+
else if ((!recursion && key === 'type') ||
|
|
833
|
+
(!recursion && key === 'key') ||
|
|
834
|
+
(!recursion && key === 'label') ||
|
|
835
|
+
(!recursion && key === 'input') ||
|
|
836
|
+
(!recursion && key === 'tableView') ||
|
|
828
837
|
(val !== '' && !defaultSchema.hasOwnProperty(key)) ||
|
|
829
838
|
(val !== '' && val !== defaultSchema[key]) ||
|
|
830
839
|
(defaultSchema[key] && val !== defaultSchema[key])) {
|
|
@@ -868,21 +877,32 @@ class Component extends Element_1.default {
|
|
|
868
877
|
return super.t(text, params, ...args);
|
|
869
878
|
}
|
|
870
879
|
labelIsHidden() {
|
|
871
|
-
return !this.component.label ||
|
|
872
|
-
((!this.isInDataGrid && this.component.hideLabel) ||
|
|
880
|
+
return (!this.component.label ||
|
|
881
|
+
(((!this.isInDataGrid && this.component.hideLabel) ||
|
|
873
882
|
(this.isInDataGrid && !this.component.dataGridLabel) ||
|
|
874
883
|
this.options.floatingLabels ||
|
|
875
|
-
this.options.inputsOnly) &&
|
|
884
|
+
this.options.inputsOnly) &&
|
|
885
|
+
!this.builderMode));
|
|
876
886
|
}
|
|
877
887
|
transform(type, value) {
|
|
878
|
-
const frameworkTemplates = this.options.template
|
|
888
|
+
const frameworkTemplates = this.options.template
|
|
889
|
+
? Templates_1.default.templates[this.options.template]
|
|
890
|
+
: Templates_1.default.current;
|
|
879
891
|
return frameworkTemplates.hasOwnProperty('transform')
|
|
880
892
|
? frameworkTemplates.transform(type, value, this)
|
|
881
893
|
: (type, value) => value;
|
|
882
894
|
}
|
|
883
895
|
getTemplate(names, modes) {
|
|
884
|
-
modes = Array.isArray(modes)
|
|
885
|
-
|
|
896
|
+
modes = Array.isArray(modes)
|
|
897
|
+
? modes
|
|
898
|
+
: [
|
|
899
|
+
modes,
|
|
900
|
+
];
|
|
901
|
+
names = Array.isArray(names)
|
|
902
|
+
? names
|
|
903
|
+
: [
|
|
904
|
+
names,
|
|
905
|
+
];
|
|
886
906
|
if (!modes.includes('form')) {
|
|
887
907
|
modes.push('form');
|
|
888
908
|
}
|
|
@@ -893,7 +913,9 @@ class Component extends Element_1.default {
|
|
|
893
913
|
return result;
|
|
894
914
|
}
|
|
895
915
|
}
|
|
896
|
-
const frameworkTemplates = this.options.template
|
|
916
|
+
const frameworkTemplates = this.options.template
|
|
917
|
+
? Templates_1.default.templates[this.options.template]
|
|
918
|
+
: Templates_1.default.current;
|
|
897
919
|
result = this.checkTemplate(frameworkTemplates, names, modes);
|
|
898
920
|
if (result) {
|
|
899
921
|
return result;
|
|
@@ -1027,7 +1049,9 @@ class Component extends Element_1.default {
|
|
|
1027
1049
|
if (settings && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.shadowRoot)) {
|
|
1028
1050
|
settings.shadowRoot = this.root.shadowRoot;
|
|
1029
1051
|
}
|
|
1030
|
-
const widget = settings && widgets_1.default[settings.type]
|
|
1052
|
+
const widget = settings && widgets_1.default[settings.type]
|
|
1053
|
+
? new widgets_1.default[settings.type](settings, this.component, this)
|
|
1054
|
+
: null;
|
|
1031
1055
|
return widget;
|
|
1032
1056
|
}
|
|
1033
1057
|
/**
|
|
@@ -1036,7 +1060,12 @@ class Component extends Element_1.default {
|
|
|
1036
1060
|
*/
|
|
1037
1061
|
getBrowserLanguage() {
|
|
1038
1062
|
const nav = window.navigator;
|
|
1039
|
-
const browserLanguagePropertyKeys = [
|
|
1063
|
+
const browserLanguagePropertyKeys = [
|
|
1064
|
+
'language',
|
|
1065
|
+
'browserLanguage',
|
|
1066
|
+
'systemLanguage',
|
|
1067
|
+
'userLanguage',
|
|
1068
|
+
];
|
|
1040
1069
|
let language;
|
|
1041
1070
|
// support for HTML 5.1 "navigator.languages"
|
|
1042
1071
|
if (Array.isArray(nav.languages)) {
|
|
@@ -1082,7 +1111,8 @@ class Component extends Element_1.default {
|
|
|
1082
1111
|
* @returns {string} - The submission timezone.
|
|
1083
1112
|
*/
|
|
1084
1113
|
get submissionTimezone() {
|
|
1085
|
-
this.options.submissionTimezone =
|
|
1114
|
+
this.options.submissionTimezone =
|
|
1115
|
+
this.options.submissionTimezone || lodash_1.default.get(this.root, 'options.submissionTimezone');
|
|
1086
1116
|
return this.options.submissionTimezone;
|
|
1087
1117
|
}
|
|
1088
1118
|
/**
|
|
@@ -1106,8 +1136,8 @@ class Component extends Element_1.default {
|
|
|
1106
1136
|
}
|
|
1107
1137
|
const submissionTimezone = this.submissionTimezone;
|
|
1108
1138
|
if (submissionTimezone &&
|
|
1109
|
-
(
|
|
1110
|
-
((this.options.pdf || this.options.server) &&
|
|
1139
|
+
(settings.displayInTimezone === 'submission' ||
|
|
1140
|
+
((this.options.pdf || this.options.server) && settings.displayInTimezone === 'viewer'))) {
|
|
1111
1141
|
return submissionTimezone;
|
|
1112
1142
|
}
|
|
1113
1143
|
// Return current timezone if none are provided.
|
|
@@ -1199,7 +1229,7 @@ class Component extends Element_1.default {
|
|
|
1199
1229
|
id: this.id,
|
|
1200
1230
|
classes: this.className,
|
|
1201
1231
|
styles: this.customStyle,
|
|
1202
|
-
children
|
|
1232
|
+
children,
|
|
1203
1233
|
}, topLevel);
|
|
1204
1234
|
}
|
|
1205
1235
|
else {
|
|
@@ -1208,7 +1238,7 @@ class Component extends Element_1.default {
|
|
|
1208
1238
|
id: this.id,
|
|
1209
1239
|
classes: this.className,
|
|
1210
1240
|
styles: this.customStyle,
|
|
1211
|
-
children
|
|
1241
|
+
children,
|
|
1212
1242
|
}, topLevel);
|
|
1213
1243
|
}
|
|
1214
1244
|
}
|
|
@@ -1221,8 +1251,7 @@ class Component extends Element_1.default {
|
|
|
1221
1251
|
createTooltip(tooltipEl, settings = {}) {
|
|
1222
1252
|
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
|
|
1223
1253
|
const tooltipDataTitle = tooltipEl.getAttribute('data-title');
|
|
1224
|
-
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1225
|
-
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1254
|
+
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute).replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1226
1255
|
return (0, tippy_js_1.default)(tooltipEl, Object.assign(Object.assign({ allowHTML: true, trigger: 'mouseenter click focus', placement: 'right', zIndex: 10000, interactive: true }, settings), { content: this.t(this.sanitize(tooltipText), { _userInput: true }) }));
|
|
1227
1256
|
}
|
|
1228
1257
|
/**
|
|
@@ -1256,9 +1285,7 @@ class Component extends Element_1.default {
|
|
|
1256
1285
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
1257
1286
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
1258
1287
|
const currentValue = modalShouldBeOpened ? this.componentModal.currentValue : this.dataValue;
|
|
1259
|
-
const openModalTemplate = this.componentModal && modalShouldBeOpened
|
|
1260
|
-
? this.componentModal.openModalTemplate
|
|
1261
|
-
: null;
|
|
1288
|
+
const openModalTemplate = this.componentModal && modalShouldBeOpened ? this.componentModal.openModalTemplate : null;
|
|
1262
1289
|
this.componentModal = this.createComponentModal(element, modalShouldBeOpened, currentValue);
|
|
1263
1290
|
this.setOpenModalElement(openModalTemplate);
|
|
1264
1291
|
}
|
|
@@ -1272,7 +1299,7 @@ class Component extends Element_1.default {
|
|
|
1272
1299
|
}
|
|
1273
1300
|
this.loadRefs(element, {
|
|
1274
1301
|
messageContainer: 'single',
|
|
1275
|
-
tooltip: 'multiple'
|
|
1302
|
+
tooltip: 'multiple',
|
|
1276
1303
|
});
|
|
1277
1304
|
this.attachTooltips(this.refs.tooltip);
|
|
1278
1305
|
// Attach logic.
|
|
@@ -1309,7 +1336,7 @@ class Component extends Element_1.default {
|
|
|
1309
1336
|
*/
|
|
1310
1337
|
addShortcut(element, shortcut) {
|
|
1311
1338
|
// Avoid infinite recursion.
|
|
1312
|
-
if (!element || !this.root ||
|
|
1339
|
+
if (!element || !this.root || this.root === this) {
|
|
1313
1340
|
return;
|
|
1314
1341
|
}
|
|
1315
1342
|
if (!shortcut) {
|
|
@@ -1325,7 +1352,7 @@ class Component extends Element_1.default {
|
|
|
1325
1352
|
*/
|
|
1326
1353
|
removeShortcut(element, shortcut) {
|
|
1327
1354
|
// Avoid infinite recursion.
|
|
1328
|
-
if (!element ||
|
|
1355
|
+
if (!element || this.root === this) {
|
|
1329
1356
|
return;
|
|
1330
1357
|
}
|
|
1331
1358
|
if (!shortcut) {
|
|
@@ -1372,7 +1399,10 @@ class Component extends Element_1.default {
|
|
|
1372
1399
|
if (refreshData === 'data') {
|
|
1373
1400
|
this.refresh(this.data, changed, flags);
|
|
1374
1401
|
}
|
|
1375
|
-
else if (
|
|
1402
|
+
else if (changePath &&
|
|
1403
|
+
((_b = (_a = changed.instance) === null || _a === void 0 ? void 0 : _a.paths) === null || _b === void 0 ? void 0 : _b.localPath) === refreshData &&
|
|
1404
|
+
changed &&
|
|
1405
|
+
changed.instance &&
|
|
1376
1406
|
// Make sure the changed component is not in a different "context". Solves issues where refreshOn being set
|
|
1377
1407
|
// in fields inside EditGrids could alter their state from other rows (which is bad).
|
|
1378
1408
|
this.inContext(changed.instance)) {
|
|
@@ -1391,16 +1421,20 @@ class Component extends Element_1.default {
|
|
|
1391
1421
|
return;
|
|
1392
1422
|
}
|
|
1393
1423
|
if (!changes.length && flags.changed) {
|
|
1394
|
-
changes = [
|
|
1424
|
+
changes = [
|
|
1425
|
+
flags.changed,
|
|
1426
|
+
];
|
|
1395
1427
|
}
|
|
1396
|
-
const refreshOn = flags.fromBlur
|
|
1428
|
+
const refreshOn = flags.fromBlur
|
|
1429
|
+
? this.component.refreshOnBlur
|
|
1430
|
+
: this.component.refreshOn || this.component.redrawOn;
|
|
1397
1431
|
// If they wish to refresh on a value, then add that here.
|
|
1398
1432
|
if (refreshOn) {
|
|
1399
1433
|
if (Array.isArray(refreshOn)) {
|
|
1400
|
-
refreshOn.forEach(refreshData => changes.forEach(changed => this.checkRefresh(refreshData, changed, flags)));
|
|
1434
|
+
refreshOn.forEach((refreshData) => changes.forEach((changed) => this.checkRefresh(refreshData, changed, flags)));
|
|
1401
1435
|
}
|
|
1402
1436
|
else {
|
|
1403
|
-
changes.forEach(changed => this.checkRefresh(refreshOn, changed, flags));
|
|
1437
|
+
changes.forEach((changed) => this.checkRefresh(refreshOn, changed, flags));
|
|
1404
1438
|
}
|
|
1405
1439
|
}
|
|
1406
1440
|
}
|
|
@@ -1471,7 +1505,7 @@ class Component extends Element_1.default {
|
|
|
1471
1505
|
*/
|
|
1472
1506
|
createViewOnlyElement() {
|
|
1473
1507
|
this.setElement(this.ce('dl', {
|
|
1474
|
-
id: this.id
|
|
1508
|
+
id: this.id,
|
|
1475
1509
|
}));
|
|
1476
1510
|
if (this.element) {
|
|
1477
1511
|
// Ensure you can get the component info from the element.
|
|
@@ -1583,7 +1617,7 @@ class Component extends Element_1.default {
|
|
|
1583
1617
|
*/
|
|
1584
1618
|
itemValueForHTMLMode(value) {
|
|
1585
1619
|
if (Array.isArray(value)) {
|
|
1586
|
-
const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
1620
|
+
const values = value.map((item) => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
1587
1621
|
return values.join(', ');
|
|
1588
1622
|
}
|
|
1589
1623
|
return this.itemValue(value);
|
|
@@ -1619,7 +1653,8 @@ class Component extends Element_1.default {
|
|
|
1619
1653
|
};
|
|
1620
1654
|
const handleCloseClick = (e) => {
|
|
1621
1655
|
if (confirm) {
|
|
1622
|
-
confirm()
|
|
1656
|
+
confirm()
|
|
1657
|
+
.then(() => close(e))
|
|
1623
1658
|
.catch(() => { });
|
|
1624
1659
|
}
|
|
1625
1660
|
else {
|
|
@@ -1719,9 +1754,11 @@ class Component extends Element_1.default {
|
|
|
1719
1754
|
// It is useful to translate strings in different scenarions (eg: custom edit grid templates, custom error messages etc.)
|
|
1720
1755
|
// and desirable to be publicly available rather than calling the internal {instance.t} function in the template string.
|
|
1721
1756
|
t: this.t.bind(this),
|
|
1722
|
-
submission:
|
|
1723
|
-
|
|
1724
|
-
|
|
1757
|
+
submission: this.root
|
|
1758
|
+
? this.root._submission
|
|
1759
|
+
: {
|
|
1760
|
+
data: this.rootValue,
|
|
1761
|
+
},
|
|
1725
1762
|
form: this.root ? this.root._form : {},
|
|
1726
1763
|
options: this.options,
|
|
1727
1764
|
}, additional));
|
|
@@ -1774,7 +1811,12 @@ class Component extends Element_1.default {
|
|
|
1774
1811
|
const iconset = this.options.iconset || Templates_1.default.current.defaultIconset || 'fa';
|
|
1775
1812
|
return Templates_1.default.current.hasOwnProperty('iconClass')
|
|
1776
1813
|
? Templates_1.default.current.iconClass(iconset, name, spinning)
|
|
1777
|
-
:
|
|
1814
|
+
: [
|
|
1815
|
+
'fa',
|
|
1816
|
+
'bi',
|
|
1817
|
+
].includes(this.options.iconset)
|
|
1818
|
+
? Templates_1.default.defaultTemplates.iconClass(iconset, name, spinning)
|
|
1819
|
+
: name;
|
|
1778
1820
|
}
|
|
1779
1821
|
/**
|
|
1780
1822
|
* Returns the size css class names for our current template.
|
|
@@ -1782,16 +1824,16 @@ class Component extends Element_1.default {
|
|
|
1782
1824
|
* @returns {string} - The size class for our component.
|
|
1783
1825
|
*/
|
|
1784
1826
|
size(size) {
|
|
1785
|
-
return Templates_1.default.current.hasOwnProperty('size')
|
|
1786
|
-
? Templates_1.default.current.size(size)
|
|
1787
|
-
: size;
|
|
1827
|
+
return Templates_1.default.current.hasOwnProperty('size') ? Templates_1.default.current.size(size) : size;
|
|
1788
1828
|
}
|
|
1789
1829
|
/**
|
|
1790
1830
|
* The readible name for this component.
|
|
1791
1831
|
* @returns {string} - The name of the component.
|
|
1792
1832
|
*/
|
|
1793
1833
|
get name() {
|
|
1794
|
-
return this.t(this.component.label || this.component.placeholder || this.key, {
|
|
1834
|
+
return this.t(this.component.label || this.component.placeholder || this.key, {
|
|
1835
|
+
_userInput: true,
|
|
1836
|
+
});
|
|
1795
1837
|
}
|
|
1796
1838
|
/**
|
|
1797
1839
|
* Returns the visible errors for this component.
|
|
@@ -1812,10 +1854,7 @@ class Component extends Element_1.default {
|
|
|
1812
1854
|
* @returns {string} - The error label for this component.
|
|
1813
1855
|
*/
|
|
1814
1856
|
get errorLabel() {
|
|
1815
|
-
return this.t(this.component.errorLabel
|
|
1816
|
-
|| this.component.label
|
|
1817
|
-
|| this.component.placeholder
|
|
1818
|
-
|| this.key);
|
|
1857
|
+
return this.t(this.component.errorLabel || this.component.label || this.component.placeholder || this.key);
|
|
1819
1858
|
}
|
|
1820
1859
|
/**
|
|
1821
1860
|
* Get the error message provided a certain type of error.
|
|
@@ -1823,7 +1862,9 @@ class Component extends Element_1.default {
|
|
|
1823
1862
|
* @returns {string} - The error message configured for this component.
|
|
1824
1863
|
*/
|
|
1825
1864
|
errorMessage(type) {
|
|
1826
|
-
return
|
|
1865
|
+
return this.component.errors && this.component.errors[type]
|
|
1866
|
+
? this.component.errors[type]
|
|
1867
|
+
: type;
|
|
1827
1868
|
}
|
|
1828
1869
|
/**
|
|
1829
1870
|
* Sets the content, innerHTML, of an element to the sanitized content.
|
|
@@ -1899,7 +1940,7 @@ class Component extends Element_1.default {
|
|
|
1899
1940
|
*/
|
|
1900
1941
|
removeEventListeners() {
|
|
1901
1942
|
super.removeEventListeners();
|
|
1902
|
-
this.tooltips.forEach(tooltip => tooltip.destroy());
|
|
1943
|
+
this.tooltips.forEach((tooltip) => tooltip.destroy());
|
|
1903
1944
|
this.tooltips = [];
|
|
1904
1945
|
}
|
|
1905
1946
|
/**
|
|
@@ -1990,7 +2031,7 @@ class Component extends Element_1.default {
|
|
|
1990
2031
|
this.redraw();
|
|
1991
2032
|
}
|
|
1992
2033
|
// Check visibility
|
|
1993
|
-
const visible =
|
|
2034
|
+
const visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
|
|
1994
2035
|
if (this.visible !== visible) {
|
|
1995
2036
|
this.visible = visible;
|
|
1996
2037
|
}
|
|
@@ -2032,7 +2073,8 @@ class Component extends Element_1.default {
|
|
|
2032
2073
|
const newComponent = (0, utils_2.fastCloneDeep)(this.originalComponent);
|
|
2033
2074
|
let changed = logics.reduce((changed, logic) => {
|
|
2034
2075
|
const result = utils_1.default.checkTrigger(newComponent, logic.trigger, row, data, this.root ? this.root._form : {}, this);
|
|
2035
|
-
return (result ? this.applyActions(newComponent, logic.actions, result, row, data) : false) ||
|
|
2076
|
+
return ((result ? this.applyActions(newComponent, logic.actions, result, row, data) : false) ||
|
|
2077
|
+
changed);
|
|
2036
2078
|
}, false);
|
|
2037
2079
|
// If component definition changed, replace and mark as changed.
|
|
2038
2080
|
if (!lodash_1.default.isEqual(this.component, newComponent)) {
|
|
@@ -2192,13 +2234,17 @@ class Component extends Element_1.default {
|
|
|
2192
2234
|
};
|
|
2193
2235
|
}
|
|
2194
2236
|
if (!Array.isArray(messages)) {
|
|
2195
|
-
messages = [
|
|
2237
|
+
messages = [
|
|
2238
|
+
messages,
|
|
2239
|
+
];
|
|
2196
2240
|
}
|
|
2197
|
-
messages = lodash_1.default.uniqBy(messages, message => message.message);
|
|
2241
|
+
messages = lodash_1.default.uniqBy(messages, (message) => message.message);
|
|
2198
2242
|
if (this.refs.messageContainer) {
|
|
2199
|
-
this.setContent(this.refs.messageContainer, messages
|
|
2243
|
+
this.setContent(this.refs.messageContainer, messages
|
|
2244
|
+
.map((message) => {
|
|
2200
2245
|
return this.renderTemplate('message', Object.assign({}, message));
|
|
2201
|
-
})
|
|
2246
|
+
})
|
|
2247
|
+
.join(''));
|
|
2202
2248
|
}
|
|
2203
2249
|
}
|
|
2204
2250
|
/**
|
|
@@ -2258,14 +2304,16 @@ class Component extends Element_1.default {
|
|
|
2258
2304
|
*/
|
|
2259
2305
|
clearComponentOnHide() {
|
|
2260
2306
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
2261
|
-
if (this.component.clearOnHide !== false &&
|
|
2307
|
+
if (this.component.clearOnHide !== false &&
|
|
2308
|
+
!this.options.readOnly &&
|
|
2309
|
+
!this.options.showHiddenFields) {
|
|
2262
2310
|
if (this.shouldConditionallyClear()) {
|
|
2263
2311
|
this.deleteValue();
|
|
2264
2312
|
}
|
|
2265
2313
|
else if (!this.hasValue() && this.shouldAddDefaultValue) {
|
|
2266
2314
|
// If shown, ensure the default is set.
|
|
2267
2315
|
this.setValue(this.defaultValue, {
|
|
2268
|
-
noUpdateEvent: true
|
|
2316
|
+
noUpdateEvent: true,
|
|
2269
2317
|
});
|
|
2270
2318
|
}
|
|
2271
2319
|
}
|
|
@@ -2309,7 +2357,7 @@ class Component extends Element_1.default {
|
|
|
2309
2357
|
}
|
|
2310
2358
|
if (this.component.onChange) {
|
|
2311
2359
|
this.evaluate(this.component.onChange, {
|
|
2312
|
-
flags
|
|
2360
|
+
flags,
|
|
2313
2361
|
});
|
|
2314
2362
|
}
|
|
2315
2363
|
// Set the changed variable.
|
|
@@ -2317,7 +2365,7 @@ class Component extends Element_1.default {
|
|
|
2317
2365
|
instance: this,
|
|
2318
2366
|
component: this.component,
|
|
2319
2367
|
value: this.dataValue,
|
|
2320
|
-
flags: flags
|
|
2368
|
+
flags: flags,
|
|
2321
2369
|
};
|
|
2322
2370
|
// Emit the change.
|
|
2323
2371
|
this.emit('componentChange', changed);
|
|
@@ -2340,16 +2388,65 @@ class Component extends Element_1.default {
|
|
|
2340
2388
|
placeholder: this.t(this.component.placeholder, { _userInput: true }),
|
|
2341
2389
|
modules: {
|
|
2342
2390
|
toolbar: [
|
|
2343
|
-
[
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2391
|
+
[
|
|
2392
|
+
{
|
|
2393
|
+
size: [
|
|
2394
|
+
'small',
|
|
2395
|
+
false,
|
|
2396
|
+
'large',
|
|
2397
|
+
'huge',
|
|
2398
|
+
],
|
|
2399
|
+
},
|
|
2400
|
+
], // custom dropdown
|
|
2401
|
+
[
|
|
2402
|
+
{
|
|
2403
|
+
header: [
|
|
2404
|
+
1,
|
|
2405
|
+
2,
|
|
2406
|
+
3,
|
|
2407
|
+
4,
|
|
2408
|
+
5,
|
|
2409
|
+
6,
|
|
2410
|
+
false,
|
|
2411
|
+
],
|
|
2412
|
+
},
|
|
2413
|
+
],
|
|
2414
|
+
[
|
|
2415
|
+
{ font: [] },
|
|
2416
|
+
],
|
|
2417
|
+
[
|
|
2418
|
+
'bold',
|
|
2419
|
+
'italic',
|
|
2420
|
+
'underline',
|
|
2421
|
+
'strike',
|
|
2422
|
+
{ script: 'sub' },
|
|
2423
|
+
{ script: 'super' },
|
|
2424
|
+
'clean',
|
|
2425
|
+
],
|
|
2426
|
+
[
|
|
2427
|
+
{ color: [] },
|
|
2428
|
+
{ background: [] },
|
|
2429
|
+
],
|
|
2430
|
+
[
|
|
2431
|
+
{ list: 'ordered' },
|
|
2432
|
+
{ list: 'bullet' },
|
|
2433
|
+
{ indent: '-1' },
|
|
2434
|
+
{ indent: '+1' },
|
|
2435
|
+
{ align: [] },
|
|
2436
|
+
],
|
|
2437
|
+
[
|
|
2438
|
+
'blockquote',
|
|
2439
|
+
'code-block',
|
|
2440
|
+
],
|
|
2441
|
+
[
|
|
2442
|
+
'link',
|
|
2443
|
+
'image',
|
|
2444
|
+
'video',
|
|
2445
|
+
'formula',
|
|
2446
|
+
'source',
|
|
2447
|
+
],
|
|
2448
|
+
],
|
|
2449
|
+
},
|
|
2353
2450
|
},
|
|
2354
2451
|
ace: {
|
|
2355
2452
|
theme: 'ace/theme/xcode',
|
|
@@ -2357,7 +2454,7 @@ class Component extends Element_1.default {
|
|
|
2357
2454
|
minLines: 12,
|
|
2358
2455
|
tabSize: 2,
|
|
2359
2456
|
mode: 'ace/mode/javascript',
|
|
2360
|
-
placeholder: this.t(this.component.placeholder, { _userInput: true })
|
|
2457
|
+
placeholder: this.t(this.component.placeholder, { _userInput: true }),
|
|
2361
2458
|
},
|
|
2362
2459
|
ckeditor: {
|
|
2363
2460
|
image: {
|
|
@@ -2367,18 +2464,18 @@ class Component extends Element_1.default {
|
|
|
2367
2464
|
'imageStyle:full',
|
|
2368
2465
|
'imageStyle:alignLeft',
|
|
2369
2466
|
'imageStyle:alignCenter',
|
|
2370
|
-
'imageStyle:alignRight'
|
|
2467
|
+
'imageStyle:alignRight',
|
|
2371
2468
|
],
|
|
2372
2469
|
styles: [
|
|
2373
2470
|
'full',
|
|
2374
2471
|
'alignLeft',
|
|
2375
2472
|
'alignCenter',
|
|
2376
|
-
'alignRight'
|
|
2377
|
-
]
|
|
2473
|
+
'alignRight',
|
|
2474
|
+
],
|
|
2378
2475
|
},
|
|
2379
|
-
extraPlugins: []
|
|
2476
|
+
extraPlugins: [],
|
|
2380
2477
|
},
|
|
2381
|
-
default: {}
|
|
2478
|
+
default: {},
|
|
2382
2479
|
};
|
|
2383
2480
|
}
|
|
2384
2481
|
addCKE(element, settings, onChange) {
|
|
@@ -2389,8 +2486,7 @@ class Component extends Element_1.default {
|
|
|
2389
2486
|
if (this.component.isUploadEnabled) {
|
|
2390
2487
|
settings.extraPlugins.push((0, uploadAdapter_1.getFormioUploadAdapterPlugin)(this.fileService, this));
|
|
2391
2488
|
}
|
|
2392
|
-
return Formio_1.Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', lodash_1.default.get(this.options, 'editors.ckeditor.src', `${Formio_1.Formio.cdn.ckeditor}/ckeditor.js`), true)
|
|
2393
|
-
.then(() => {
|
|
2489
|
+
return Formio_1.Formio.requireLibrary('ckeditor', isIEBrowser ? 'CKEDITOR' : 'ClassicEditor', lodash_1.default.get(this.options, 'editors.ckeditor.src', `${Formio_1.Formio.cdn.ckeditor}/ckeditor.js`), true).then(() => {
|
|
2394
2490
|
if (!element.parentNode) {
|
|
2395
2491
|
return Promise.reject();
|
|
2396
2492
|
}
|
|
@@ -2400,7 +2496,7 @@ class Component extends Element_1.default {
|
|
|
2400
2496
|
return Promise.resolve(editor);
|
|
2401
2497
|
}
|
|
2402
2498
|
else {
|
|
2403
|
-
return ClassicEditor.create(element, settings).then(editor => {
|
|
2499
|
+
return ClassicEditor.create(element, settings).then((editor) => {
|
|
2404
2500
|
editor.model.document.on('change', () => onChange(editor.data.get()));
|
|
2405
2501
|
return editor;
|
|
2406
2502
|
});
|
|
@@ -2413,13 +2509,11 @@ class Component extends Element_1.default {
|
|
|
2413
2509
|
settings = Object.assign(Object.assign({}, settings), { modules: Object.assign({ table: true }, settings.modules) });
|
|
2414
2510
|
// Lazy load the quill css.
|
|
2415
2511
|
Formio_1.Formio.requireLibrary(`quill-css-${settings.theme}`, 'Quill', [
|
|
2416
|
-
{ type: 'styles', src: `${Formio_1.Formio.cdn.quill}/quill.${settings.theme}.css` }
|
|
2512
|
+
{ type: 'styles', src: `${Formio_1.Formio.cdn.quill}/quill.${settings.theme}.css` },
|
|
2417
2513
|
], true);
|
|
2418
2514
|
// Lazy load the quill library.
|
|
2419
|
-
return Formio_1.Formio.requireLibrary('quill', 'Quill', lodash_1.default.get(this.options, 'editors.quill.src', `${Formio_1.Formio.cdn.quill}/quill.min.js`), true)
|
|
2420
|
-
.then(() => {
|
|
2421
|
-
return Formio_1.Formio.requireLibrary('quill-table', 'Quill', `${Formio_1.Formio.cdn.baseUrl}/quill/quill-table.js`, true)
|
|
2422
|
-
.then(() => {
|
|
2515
|
+
return Formio_1.Formio.requireLibrary('quill', 'Quill', lodash_1.default.get(this.options, 'editors.quill.src', `${Formio_1.Formio.cdn.quill}/quill.min.js`), true).then(() => {
|
|
2516
|
+
return Formio_1.Formio.requireLibrary('quill-table', 'Quill', `${Formio_1.Formio.cdn.baseUrl}/quill/quill-table.js`, true).then(() => {
|
|
2423
2517
|
if (!element.parentNode) {
|
|
2424
2518
|
return Promise.reject();
|
|
2425
2519
|
}
|
|
@@ -2435,7 +2529,7 @@ class Component extends Element_1.default {
|
|
|
2435
2529
|
if (txtArea.style.display === 'inherit') {
|
|
2436
2530
|
this.quill.setContents(this.quill.clipboard.convert({ html: txtArea.value }));
|
|
2437
2531
|
}
|
|
2438
|
-
txtArea.style.display =
|
|
2532
|
+
txtArea.style.display = txtArea.style.display === 'none' ? 'inherit' : 'none';
|
|
2439
2533
|
});
|
|
2440
2534
|
}
|
|
2441
2535
|
/** END CODEBLOCK */
|
|
@@ -2457,10 +2551,10 @@ class Component extends Element_1.default {
|
|
|
2457
2551
|
get shouldSanitizeValue() {
|
|
2458
2552
|
var _a;
|
|
2459
2553
|
// Sanitize value if sanitizing for thw whole content is turned off
|
|
2460
|
-
return ((
|
|
2554
|
+
return ((_a = this.options) === null || _a === void 0 ? void 0 : _a.sanitize) !== false;
|
|
2461
2555
|
}
|
|
2462
2556
|
addAce(element, settings, onChange) {
|
|
2463
|
-
if (!settings ||
|
|
2557
|
+
if (!settings || settings.theme === 'snow') {
|
|
2464
2558
|
const mode = settings ? settings.mode : '';
|
|
2465
2559
|
settings = {};
|
|
2466
2560
|
if (mode) {
|
|
@@ -2468,8 +2562,7 @@ class Component extends Element_1.default {
|
|
|
2468
2562
|
}
|
|
2469
2563
|
}
|
|
2470
2564
|
settings = lodash_1.default.merge(this.wysiwygDefault.ace, lodash_1.default.get(this.options, 'editors.ace.settings', {}), settings || {});
|
|
2471
|
-
return Formio_1.Formio.requireLibrary('ace', 'ace', lodash_1.default.get(this.options, 'editors.ace.src', `${Formio_1.Formio.cdn.ace}/ace.js`), true)
|
|
2472
|
-
.then((editor) => {
|
|
2565
|
+
return Formio_1.Formio.requireLibrary('ace', 'ace', lodash_1.default.get(this.options, 'editors.ace.src', `${Formio_1.Formio.cdn.ace}/ace.js`), true).then((editor) => {
|
|
2473
2566
|
editor = editor.edit(element);
|
|
2474
2567
|
editor.removeAllListeners('change');
|
|
2475
2568
|
editor.setOptions(settings);
|
|
@@ -2527,10 +2620,10 @@ class Component extends Element_1.default {
|
|
|
2527
2620
|
if (!this.allowData || !this.key) {
|
|
2528
2621
|
return;
|
|
2529
2622
|
}
|
|
2530
|
-
if (
|
|
2623
|
+
if (value !== null && value !== undefined) {
|
|
2531
2624
|
value = this.hook('setDataValue', value, this.key, this._data);
|
|
2532
2625
|
}
|
|
2533
|
-
if (
|
|
2626
|
+
if (value === null || value === undefined) {
|
|
2534
2627
|
this.unset();
|
|
2535
2628
|
return;
|
|
2536
2629
|
}
|
|
@@ -2561,7 +2654,7 @@ class Component extends Element_1.default {
|
|
|
2561
2654
|
deleteValue() {
|
|
2562
2655
|
this.setValue(null, {
|
|
2563
2656
|
noUpdateEvent: true,
|
|
2564
|
-
noDefault: true
|
|
2657
|
+
noDefault: true,
|
|
2565
2658
|
});
|
|
2566
2659
|
this.unset();
|
|
2567
2660
|
}
|
|
@@ -2576,9 +2669,10 @@ class Component extends Element_1.default {
|
|
|
2576
2669
|
* @returns {boolean} - TRUE if a default value is set.
|
|
2577
2670
|
*/
|
|
2578
2671
|
get hasDefaultValue() {
|
|
2579
|
-
return this.component.customDefaultValue ||
|
|
2580
|
-
(this.component.defaultValue
|
|
2581
|
-
|
|
2672
|
+
return (this.component.customDefaultValue ||
|
|
2673
|
+
(this.component.hasOwnProperty('defaultValue') &&
|
|
2674
|
+
this.component.defaultValue !== null &&
|
|
2675
|
+
this.component.defaultValue !== undefined));
|
|
2582
2676
|
}
|
|
2583
2677
|
/**
|
|
2584
2678
|
* Determine if we should add a default value for this component.
|
|
@@ -2673,7 +2767,7 @@ class Component extends Element_1.default {
|
|
|
2673
2767
|
Array.isArray(this.defaultValue) &&
|
|
2674
2768
|
this.refs.hasOwnProperty('input') &&
|
|
2675
2769
|
valueInput &&
|
|
2676
|
-
|
|
2770
|
+
valueInput.length !== value.length &&
|
|
2677
2771
|
this.visible) {
|
|
2678
2772
|
if (isFilelink || valueInput.length) {
|
|
2679
2773
|
this.redraw();
|
|
@@ -2727,9 +2821,9 @@ class Component extends Element_1.default {
|
|
|
2727
2821
|
}
|
|
2728
2822
|
setDefaultValue() {
|
|
2729
2823
|
if (this.defaultValue && this.shouldAddDefaultValue) {
|
|
2730
|
-
const defaultValue =
|
|
2824
|
+
const defaultValue = this.component.multiple && !this.dataValue.length ? [] : this.defaultValue;
|
|
2731
2825
|
this.setValue(defaultValue, {
|
|
2732
|
-
noUpdateEvent: true
|
|
2826
|
+
noUpdateEvent: true,
|
|
2733
2827
|
});
|
|
2734
2828
|
}
|
|
2735
2829
|
}
|
|
@@ -2739,7 +2833,7 @@ class Component extends Element_1.default {
|
|
|
2739
2833
|
restoreValue() {
|
|
2740
2834
|
if (this.hasSetValue) {
|
|
2741
2835
|
this.setValue(this.dataValue, {
|
|
2742
|
-
noUpdateEvent: true
|
|
2836
|
+
noUpdateEvent: true,
|
|
2743
2837
|
});
|
|
2744
2838
|
}
|
|
2745
2839
|
else {
|
|
@@ -2761,10 +2855,10 @@ class Component extends Element_1.default {
|
|
|
2761
2855
|
* @returns {boolean} - If the value changed.
|
|
2762
2856
|
*/
|
|
2763
2857
|
updateComponentValue(value, flags = {}) {
|
|
2764
|
-
let newValue =
|
|
2858
|
+
let newValue = !flags.resetValue && (value === undefined || value === null) ? this.getValue() : value;
|
|
2765
2859
|
newValue = this.normalizeValue(newValue, flags);
|
|
2766
2860
|
const oldValue = this.dataValue;
|
|
2767
|
-
let changed =
|
|
2861
|
+
let changed = newValue !== undefined ? this.hasChanged(newValue, oldValue) : false;
|
|
2768
2862
|
if (changed) {
|
|
2769
2863
|
this.dataValue = newValue;
|
|
2770
2864
|
changed = this.dataValue !== oldValue;
|
|
@@ -2788,7 +2882,7 @@ class Component extends Element_1.default {
|
|
|
2788
2882
|
className: this.iconClass(name),
|
|
2789
2883
|
ref,
|
|
2790
2884
|
styles,
|
|
2791
|
-
content
|
|
2885
|
+
content,
|
|
2792
2886
|
});
|
|
2793
2887
|
}
|
|
2794
2888
|
/**
|
|
@@ -2799,7 +2893,7 @@ class Component extends Element_1.default {
|
|
|
2799
2893
|
this.setValue(this.defaultValue || this.emptyValue, {
|
|
2800
2894
|
noUpdateEvent: true,
|
|
2801
2895
|
noValidate: true,
|
|
2802
|
-
resetValue: true
|
|
2896
|
+
resetValue: true,
|
|
2803
2897
|
});
|
|
2804
2898
|
}
|
|
2805
2899
|
/**
|
|
@@ -2809,15 +2903,12 @@ class Component extends Element_1.default {
|
|
|
2809
2903
|
* @returns {boolean} - TRUE if the value has changed.
|
|
2810
2904
|
*/
|
|
2811
2905
|
hasChanged(newValue, oldValue) {
|
|
2812
|
-
if ((
|
|
2813
|
-
(
|
|
2906
|
+
if ((newValue === undefined || newValue === null) &&
|
|
2907
|
+
(oldValue === undefined || oldValue === null || this.isEmpty(oldValue))) {
|
|
2814
2908
|
return false;
|
|
2815
2909
|
}
|
|
2816
2910
|
// If we do not have a value and are getting set to anything other than undefined or null, then we changed.
|
|
2817
|
-
if (newValue !== undefined &&
|
|
2818
|
-
newValue !== null &&
|
|
2819
|
-
this.allowData &&
|
|
2820
|
-
!this.hasValue()) {
|
|
2911
|
+
if (newValue !== undefined && newValue !== null && this.allowData && !this.hasValue()) {
|
|
2821
2912
|
return true;
|
|
2822
2913
|
}
|
|
2823
2914
|
return !lodash_1.default.isEqual(newValue, oldValue);
|
|
@@ -2852,11 +2943,10 @@ class Component extends Element_1.default {
|
|
|
2852
2943
|
data,
|
|
2853
2944
|
row: row || this.data,
|
|
2854
2945
|
submission: ((_a = this.root) === null || _a === void 0 ? void 0 : _a._submission) || {
|
|
2855
|
-
data: this.rootValue
|
|
2856
|
-
}
|
|
2946
|
+
data: this.rootValue,
|
|
2947
|
+
},
|
|
2857
2948
|
}, 'value');
|
|
2858
2949
|
}
|
|
2859
|
-
/* eslint-disable max-statements */
|
|
2860
2950
|
calculateComponentValue(data, flags, row) {
|
|
2861
2951
|
// Skip value calculation for the component if we don't have entire form data set or in builder mode
|
|
2862
2952
|
if (this.builderMode || lodash_1.default.isUndefined(lodash_1.default.get(this, 'root.data'))) {
|
|
@@ -2877,7 +2967,10 @@ class Component extends Element_1.default {
|
|
|
2877
2967
|
!(this.component.calculateValue || this.component.calculateValueVariable) ||
|
|
2878
2968
|
(this.options.server && !this.component.calculateServer) ||
|
|
2879
2969
|
(flags.dataSourceInitialLoading && allowOverride) ||
|
|
2880
|
-
(this.options.readOnly &&
|
|
2970
|
+
(this.options.readOnly &&
|
|
2971
|
+
this.options.pdf &&
|
|
2972
|
+
allowOverride &&
|
|
2973
|
+
lodash_1.default.get(this.root, 'submission._id', false))) {
|
|
2881
2974
|
return false;
|
|
2882
2975
|
}
|
|
2883
2976
|
const dataValue = this.dataValue;
|
|
@@ -2893,7 +2986,7 @@ class Component extends Element_1.default {
|
|
|
2893
2986
|
// Do not override calculations on server if they have calculateServer set.
|
|
2894
2987
|
if (allowOverride) {
|
|
2895
2988
|
// The value is considered locked if it is not empty and comes from a submission value.
|
|
2896
|
-
const fromSubmission =
|
|
2989
|
+
const fromSubmission = flags.fromSubmission && this.component.persistent === true;
|
|
2897
2990
|
if (this.isEmpty(dataValue)) {
|
|
2898
2991
|
// Reset the calculation lock if ever the data is cleared.
|
|
2899
2992
|
this.calculationLocked = false;
|
|
@@ -2902,7 +2995,7 @@ class Component extends Element_1.default {
|
|
|
2902
2995
|
this.calculationLocked = true;
|
|
2903
2996
|
return false;
|
|
2904
2997
|
}
|
|
2905
|
-
const firstPass =
|
|
2998
|
+
const firstPass = this.calculatedValue === undefined || flags.resetValue;
|
|
2906
2999
|
if (firstPass) {
|
|
2907
3000
|
this.calculatedValue = null;
|
|
2908
3001
|
}
|
|
@@ -2943,7 +3036,6 @@ class Component extends Element_1.default {
|
|
|
2943
3036
|
}
|
|
2944
3037
|
return false;
|
|
2945
3038
|
}
|
|
2946
|
-
/* eslint-enable max-statements */
|
|
2947
3039
|
/**
|
|
2948
3040
|
* Performs calculations in this component plus any child components.
|
|
2949
3041
|
* @param {*} data - The data to perform the calculation with.
|
|
@@ -3019,8 +3111,8 @@ class Component extends Element_1.default {
|
|
|
3019
3111
|
scope: validationScope,
|
|
3020
3112
|
instance: this,
|
|
3021
3113
|
processors: [
|
|
3022
|
-
process_1.validateProcessInfo
|
|
3023
|
-
]
|
|
3114
|
+
process_1.validateProcessInfo,
|
|
3115
|
+
],
|
|
3024
3116
|
});
|
|
3025
3117
|
const errors = validationScope.errors;
|
|
3026
3118
|
const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
@@ -3039,8 +3131,10 @@ class Component extends Element_1.default {
|
|
|
3039
3131
|
if (silentCheck) {
|
|
3040
3132
|
return [];
|
|
3041
3133
|
}
|
|
3042
|
-
const messages = errors.filter(message => !message.fromServer);
|
|
3043
|
-
if (errors.length &&
|
|
3134
|
+
const messages = errors.filter((message) => !message.fromServer);
|
|
3135
|
+
if (errors.length &&
|
|
3136
|
+
!!messages.length &&
|
|
3137
|
+
(!this.isEmpty(this.defaultValue) || dirty || !this.pristine)) {
|
|
3044
3138
|
return this.setCustomValidity(messages, dirty);
|
|
3045
3139
|
}
|
|
3046
3140
|
else {
|
|
@@ -3055,7 +3149,12 @@ class Component extends Element_1.default {
|
|
|
3055
3149
|
interpolateErrors(errors) {
|
|
3056
3150
|
var _a;
|
|
3057
3151
|
const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
3058
|
-
return ((_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.length)
|
|
3152
|
+
return ((_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.length)
|
|
3153
|
+
? [
|
|
3154
|
+
...interpolatedErrors,
|
|
3155
|
+
...this.serverErrors,
|
|
3156
|
+
]
|
|
3157
|
+
: interpolatedErrors;
|
|
3059
3158
|
}
|
|
3060
3159
|
/**
|
|
3061
3160
|
* Show component validation errors.
|
|
@@ -3069,7 +3168,7 @@ class Component extends Element_1.default {
|
|
|
3069
3168
|
if (flags.silentCheck) {
|
|
3070
3169
|
return [];
|
|
3071
3170
|
}
|
|
3072
|
-
let isDirty =
|
|
3171
|
+
let isDirty = flags.dirty === false ? false : this.dirty || flags.dirty;
|
|
3073
3172
|
if (this.options.alwaysDirty) {
|
|
3074
3173
|
isDirty = true;
|
|
3075
3174
|
}
|
|
@@ -3104,8 +3203,8 @@ class Component extends Element_1.default {
|
|
|
3104
3203
|
form: this.root ? this.root._form : {},
|
|
3105
3204
|
scope: { errors: [] },
|
|
3106
3205
|
processors: [
|
|
3107
|
-
process_1.validateProcessInfo
|
|
3108
|
-
]
|
|
3206
|
+
process_1.validateProcessInfo,
|
|
3207
|
+
],
|
|
3109
3208
|
};
|
|
3110
3209
|
if (async) {
|
|
3111
3210
|
return (0, process_1.processOne)(processContext).then(() => {
|
|
@@ -3127,7 +3226,7 @@ class Component extends Element_1.default {
|
|
|
3127
3226
|
* @returns {boolean} - TRUE if the component is valid.
|
|
3128
3227
|
*/
|
|
3129
3228
|
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
3130
|
-
data =
|
|
3229
|
+
data = this.rootValue;
|
|
3131
3230
|
row = row || this.data;
|
|
3132
3231
|
flags.dirty = dirty || false;
|
|
3133
3232
|
if (flags.async) {
|
|
@@ -3214,13 +3313,15 @@ class Component extends Element_1.default {
|
|
|
3214
3313
|
this.checkingData = false;
|
|
3215
3314
|
}
|
|
3216
3315
|
checkModal(errors = [], dirty = false) {
|
|
3217
|
-
const messages = errors.filter(error => !error.fromServer);
|
|
3316
|
+
const messages = errors.filter((error) => !error.fromServer);
|
|
3218
3317
|
const isValid = errors.length === 0;
|
|
3219
3318
|
if (!this.component.modalEdit || !this.componentModal) {
|
|
3220
3319
|
return;
|
|
3221
3320
|
}
|
|
3222
3321
|
if (dirty && !isValid) {
|
|
3223
|
-
this.setErrorClasses([
|
|
3322
|
+
this.setErrorClasses([
|
|
3323
|
+
this.refs.openModal,
|
|
3324
|
+
], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3224
3325
|
}
|
|
3225
3326
|
else {
|
|
3226
3327
|
this.clearErrorClasses(this.refs.openModalWrapper);
|
|
@@ -3230,7 +3331,7 @@ class Component extends Element_1.default {
|
|
|
3230
3331
|
return this.dataValue;
|
|
3231
3332
|
}
|
|
3232
3333
|
isEmpty(value = this.dataValue) {
|
|
3233
|
-
const isEmptyArray =
|
|
3334
|
+
const isEmptyArray = lodash_1.default.isArray(value) && value.length === 1 ? lodash_1.default.isEqual(value[0], this.emptyValue) : false;
|
|
3234
3335
|
return value == null || value.length === 0 || lodash_1.default.isEqual(value, this.emptyValue) || isEmptyArray;
|
|
3235
3336
|
}
|
|
3236
3337
|
isEqual(valueA, valueB = this.dataValue) {
|
|
@@ -3281,7 +3382,7 @@ class Component extends Element_1.default {
|
|
|
3281
3382
|
instance: this,
|
|
3282
3383
|
component: this.component,
|
|
3283
3384
|
value: this.dataValue,
|
|
3284
|
-
flags: { fromBlur: true }
|
|
3385
|
+
flags: { fromBlur: true },
|
|
3285
3386
|
});
|
|
3286
3387
|
}
|
|
3287
3388
|
this.root.focusedComponent = null;
|
|
@@ -3289,7 +3390,6 @@ class Component extends Element_1.default {
|
|
|
3289
3390
|
});
|
|
3290
3391
|
});
|
|
3291
3392
|
}
|
|
3292
|
-
// eslint-disable-next-line max-statements
|
|
3293
3393
|
setCustomValidity(messages, dirty, external) {
|
|
3294
3394
|
const inputRefs = this.isInputComponent ? this.refs.input || [] : null;
|
|
3295
3395
|
if (typeof messages === 'string' && messages) {
|
|
@@ -3301,13 +3401,15 @@ class Component extends Element_1.default {
|
|
|
3301
3401
|
}
|
|
3302
3402
|
if (!Array.isArray(messages)) {
|
|
3303
3403
|
if (messages) {
|
|
3304
|
-
messages = [
|
|
3404
|
+
messages = [
|
|
3405
|
+
messages,
|
|
3406
|
+
];
|
|
3305
3407
|
}
|
|
3306
3408
|
else {
|
|
3307
3409
|
messages = [];
|
|
3308
3410
|
}
|
|
3309
3411
|
}
|
|
3310
|
-
const errors = messages.filter(message => message.level === 'error');
|
|
3412
|
+
const errors = messages.filter((message) => message.level === 'error');
|
|
3311
3413
|
let invalidInputRefs = inputRefs;
|
|
3312
3414
|
// Filter the invalid input refs in multiple components
|
|
3313
3415
|
if (this.component.multiple) {
|
|
@@ -3340,7 +3442,7 @@ class Component extends Element_1.default {
|
|
|
3340
3442
|
this.setErrorClasses(invalidInputRefs, dirty, !!errors.length, !!messages.length);
|
|
3341
3443
|
}
|
|
3342
3444
|
}
|
|
3343
|
-
else if (!errors.length ||
|
|
3445
|
+
else if (!errors.length || errors[0].external === !!external) {
|
|
3344
3446
|
if (this.refs.messageContainer) {
|
|
3345
3447
|
this.empty(this.refs.messageContainer);
|
|
3346
3448
|
}
|
|
@@ -3370,7 +3472,9 @@ class Component extends Element_1.default {
|
|
|
3370
3472
|
if (!this.root || !this.root.editing) {
|
|
3371
3473
|
return false;
|
|
3372
3474
|
}
|
|
3373
|
-
return (this.component.protected ||
|
|
3475
|
+
return (this.component.protected ||
|
|
3476
|
+
!this.component.persistent ||
|
|
3477
|
+
this.component.persistent === 'client-only');
|
|
3374
3478
|
}
|
|
3375
3479
|
shouldSkipValidation(data, row, flags = {}) {
|
|
3376
3480
|
const rules = [
|
|
@@ -3384,15 +3488,16 @@ class Component extends Element_1.default {
|
|
|
3384
3488
|
() => this.isValueHidden(),
|
|
3385
3489
|
// Force valid if component is hidden.
|
|
3386
3490
|
() => {
|
|
3387
|
-
if (!this.component.validateWhenHidden &&
|
|
3491
|
+
if (!this.component.validateWhenHidden &&
|
|
3492
|
+
(!this.visible || !this.checkCondition(row, data))) {
|
|
3388
3493
|
// If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
|
|
3389
3494
|
this._errors = [];
|
|
3390
3495
|
return true;
|
|
3391
3496
|
}
|
|
3392
3497
|
return false;
|
|
3393
|
-
}
|
|
3498
|
+
},
|
|
3394
3499
|
];
|
|
3395
|
-
return rules.some(pred => pred());
|
|
3500
|
+
return rules.some((pred) => pred());
|
|
3396
3501
|
}
|
|
3397
3502
|
// Maintain reverse compatibility.
|
|
3398
3503
|
whenReady() {
|
|
@@ -3409,7 +3514,13 @@ class Component extends Element_1.default {
|
|
|
3409
3514
|
*/
|
|
3410
3515
|
asString(value) {
|
|
3411
3516
|
value = value || this.getValue();
|
|
3412
|
-
return (Array.isArray(value)
|
|
3517
|
+
return (Array.isArray(value)
|
|
3518
|
+
? value
|
|
3519
|
+
: [
|
|
3520
|
+
value,
|
|
3521
|
+
])
|
|
3522
|
+
.map(lodash_1.default.toString)
|
|
3523
|
+
.join(', ');
|
|
3413
3524
|
}
|
|
3414
3525
|
/**
|
|
3415
3526
|
* Return if the component is disabled.
|
|
@@ -3438,13 +3549,13 @@ class Component extends Element_1.default {
|
|
|
3438
3549
|
}
|
|
3439
3550
|
}
|
|
3440
3551
|
setLoading(element, loading) {
|
|
3441
|
-
if (!element ||
|
|
3552
|
+
if (!element || element.loading === loading) {
|
|
3442
3553
|
return;
|
|
3443
3554
|
}
|
|
3444
3555
|
element.loading = loading;
|
|
3445
3556
|
if (!element.loader && loading) {
|
|
3446
3557
|
element.loader = this.ce('i', {
|
|
3447
|
-
class: `${this.iconClass('refresh', true)} button-icon-right
|
|
3558
|
+
class: `${this.iconClass('refresh', true)} button-icon-right`,
|
|
3448
3559
|
});
|
|
3449
3560
|
}
|
|
3450
3561
|
if (element.loader) {
|
|
@@ -3459,9 +3570,9 @@ class Component extends Element_1.default {
|
|
|
3459
3570
|
selectOptions(select, tag, options, defaultValue) {
|
|
3460
3571
|
lodash_1.default.each(options, (option) => {
|
|
3461
3572
|
const attrs = {
|
|
3462
|
-
value: option.value
|
|
3573
|
+
value: option.value,
|
|
3463
3574
|
};
|
|
3464
|
-
if (defaultValue !== undefined &&
|
|
3575
|
+
if (defaultValue !== undefined && option.value === defaultValue) {
|
|
3465
3576
|
attrs.selected = 'selected';
|
|
3466
3577
|
}
|
|
3467
3578
|
const optionElement = this.ce('option', attrs);
|
|
@@ -3488,8 +3599,7 @@ class Component extends Element_1.default {
|
|
|
3488
3599
|
}
|
|
3489
3600
|
getRelativePath(path) {
|
|
3490
3601
|
const keyPart = `.${this.key}`;
|
|
3491
|
-
const thisPath = this.isInputComponent ? this.path
|
|
3492
|
-
: this.path.slice(0).replace(keyPart, '');
|
|
3602
|
+
const thisPath = this.isInputComponent ? this.path : this.path.slice(0).replace(keyPart, '');
|
|
3493
3603
|
return path.replace(thisPath, '');
|
|
3494
3604
|
}
|
|
3495
3605
|
clear() {
|
|
@@ -3506,7 +3616,7 @@ class Component extends Element_1.default {
|
|
|
3506
3616
|
this.removeChildFrom(element, this.element);
|
|
3507
3617
|
}
|
|
3508
3618
|
detachLogic() {
|
|
3509
|
-
this.logic.forEach(logic => {
|
|
3619
|
+
this.logic.forEach((logic) => {
|
|
3510
3620
|
if (logic.trigger.type === 'event') {
|
|
3511
3621
|
const event = this.interpolate(logic.trigger.event);
|
|
3512
3622
|
this.off(event); // only applies to callbacks on this component
|
|
@@ -3527,10 +3637,16 @@ class Component extends Element_1.default {
|
|
|
3527
3637
|
// If component definition changed, replace it.
|
|
3528
3638
|
if (!lodash_1.default.isEqual(this.component, newComponent)) {
|
|
3529
3639
|
this.component = newComponent;
|
|
3530
|
-
const visible = this.hasCondition()
|
|
3640
|
+
const visible = this.hasCondition()
|
|
3641
|
+
? !this.conditionallyHidden()
|
|
3642
|
+
: !this.component.hidden;
|
|
3531
3643
|
const disabled = this.shouldDisabled;
|
|
3532
3644
|
// Change states which won't be recalculated during redrawing
|
|
3533
3645
|
if (this.visible !== visible) {
|
|
3646
|
+
// If the logic is triggered by an event and the action sets the hidden state then the original
|
|
3647
|
+
// component definition must be changed so that the components hidden state does not get flipped back by
|
|
3648
|
+
// the fieldLogic function
|
|
3649
|
+
this.originalComponent.hidden = !visible;
|
|
3534
3650
|
this.visible = visible;
|
|
3535
3651
|
}
|
|
3536
3652
|
if (this.disabled !== disabled) {
|
|
@@ -3552,7 +3668,7 @@ class Component extends Element_1.default {
|
|
|
3552
3668
|
name: this.options.name,
|
|
3553
3669
|
type: this.component.inputType || 'text',
|
|
3554
3670
|
class: 'form-control',
|
|
3555
|
-
lang: this.options.language
|
|
3671
|
+
lang: this.options.language,
|
|
3556
3672
|
};
|
|
3557
3673
|
if (this.component.placeholder) {
|
|
3558
3674
|
attributes.placeholder = this.t(this.component.placeholder, { _userInput: true });
|
|
@@ -3568,7 +3684,7 @@ class Component extends Element_1.default {
|
|
|
3568
3684
|
type: 'input',
|
|
3569
3685
|
component: this.component,
|
|
3570
3686
|
changeEvent: 'change',
|
|
3571
|
-
attr: attributes
|
|
3687
|
+
attr: attributes,
|
|
3572
3688
|
};
|
|
3573
3689
|
}
|
|
3574
3690
|
autofocus() {
|
|
@@ -3658,14 +3774,18 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3658
3774
|
Component.externalLibraries[name].resolve(plugin);
|
|
3659
3775
|
}
|
|
3660
3776
|
else {
|
|
3661
|
-
src = Array.isArray(src)
|
|
3777
|
+
src = Array.isArray(src)
|
|
3778
|
+
? src
|
|
3779
|
+
: [
|
|
3780
|
+
src,
|
|
3781
|
+
];
|
|
3662
3782
|
src.forEach((lib) => {
|
|
3663
3783
|
let attrs = {};
|
|
3664
3784
|
let elementType = '';
|
|
3665
3785
|
if (typeof lib === 'string') {
|
|
3666
3786
|
lib = {
|
|
3667
3787
|
type: 'script',
|
|
3668
|
-
src: lib
|
|
3788
|
+
src: lib,
|
|
3669
3789
|
};
|
|
3670
3790
|
}
|
|
3671
3791
|
switch (lib.type) {
|
|
@@ -3675,14 +3795,14 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3675
3795
|
src: lib.src,
|
|
3676
3796
|
type: 'text/javascript',
|
|
3677
3797
|
defer: true,
|
|
3678
|
-
async: true
|
|
3798
|
+
async: true,
|
|
3679
3799
|
};
|
|
3680
3800
|
break;
|
|
3681
3801
|
case 'styles':
|
|
3682
3802
|
elementType = 'link';
|
|
3683
3803
|
attrs = {
|
|
3684
3804
|
href: lib.src,
|
|
3685
|
-
rel: 'stylesheet'
|
|
3805
|
+
rel: 'stylesheet',
|
|
3686
3806
|
};
|
|
3687
3807
|
break;
|
|
3688
3808
|
}
|
|
@@ -3711,8 +3831,7 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3711
3831
|
return Component.externalLibraries[name].ready;
|
|
3712
3832
|
};
|
|
3713
3833
|
Component.libraryReady = function (name) {
|
|
3714
|
-
if (Component.externalLibraries.hasOwnProperty(name) &&
|
|
3715
|
-
Component.externalLibraries[name].ready) {
|
|
3834
|
+
if (Component.externalLibraries.hasOwnProperty(name) && Component.externalLibraries[name].ready) {
|
|
3716
3835
|
return Component.externalLibraries[name].ready;
|
|
3717
3836
|
}
|
|
3718
3837
|
return Promise.reject(`${name} library was not required.`);
|