@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
|
@@ -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,7 +166,6 @@ class Component extends Element_1.default {
|
|
|
166
166
|
properties: {},
|
|
167
167
|
allowMultipleMasks: false,
|
|
168
168
|
addons: [],
|
|
169
|
-
serverOverride: {},
|
|
170
169
|
}, ...sources);
|
|
171
170
|
}
|
|
172
171
|
/**
|
|
@@ -175,20 +174,15 @@ class Component extends Element_1.default {
|
|
|
175
174
|
*/
|
|
176
175
|
static get conditionOperatorsSettings() {
|
|
177
176
|
return {
|
|
178
|
-
operators: [
|
|
179
|
-
'isEqual',
|
|
180
|
-
'isNotEqual',
|
|
181
|
-
'isEmpty',
|
|
182
|
-
'isNotEmpty',
|
|
183
|
-
],
|
|
177
|
+
operators: ['isEqual', 'isNotEqual', 'isEmpty', 'isNotEmpty'],
|
|
184
178
|
valueComponent() {
|
|
185
179
|
return {
|
|
186
180
|
type: 'textfield',
|
|
187
181
|
widget: {
|
|
188
|
-
type: 'input'
|
|
189
|
-
}
|
|
182
|
+
type: 'input'
|
|
183
|
+
}
|
|
190
184
|
};
|
|
191
|
-
}
|
|
185
|
+
}
|
|
192
186
|
};
|
|
193
187
|
}
|
|
194
188
|
/**
|
|
@@ -198,9 +192,7 @@ class Component extends Element_1.default {
|
|
|
198
192
|
*/
|
|
199
193
|
static savedValueTypes(schema) {
|
|
200
194
|
schema = schema || {};
|
|
201
|
-
return
|
|
202
|
-
utils_1.default.componentValueTypes.any,
|
|
203
|
-
]);
|
|
195
|
+
return utils_1.default.getComponentSavedTypes(schema) || [utils_1.default.componentValueTypes.any];
|
|
204
196
|
}
|
|
205
197
|
/**
|
|
206
198
|
* Provides a table view for this component. Override if you wish to do something different than using getView
|
|
@@ -217,12 +209,13 @@ class Component extends Element_1.default {
|
|
|
217
209
|
* @param {object} options - The options for this component.
|
|
218
210
|
* @param {object} data - The global data submission object this component will belong.
|
|
219
211
|
*/
|
|
212
|
+
/* eslint-disable max-statements */
|
|
220
213
|
constructor(component, options, data) {
|
|
221
214
|
var _a, _b, _c, _d;
|
|
222
215
|
super(Object.assign({
|
|
223
216
|
renderMode: 'form',
|
|
224
217
|
attachMode: 'full',
|
|
225
|
-
noDefaults: false
|
|
218
|
+
noDefaults: false
|
|
226
219
|
}, options || {}));
|
|
227
220
|
// Restore the component id.
|
|
228
221
|
if (component && component.id) {
|
|
@@ -243,7 +236,9 @@ class Component extends Element_1.default {
|
|
|
243
236
|
*/
|
|
244
237
|
this.refs = {};
|
|
245
238
|
// Allow global override for any component JSON.
|
|
246
|
-
if (component &&
|
|
239
|
+
if (component &&
|
|
240
|
+
this.options.components &&
|
|
241
|
+
this.options.components[component.type]) {
|
|
247
242
|
lodash_1.default.merge(component, this.options.components[component.type]);
|
|
248
243
|
}
|
|
249
244
|
/**
|
|
@@ -326,12 +321,8 @@ class Component extends Element_1.default {
|
|
|
326
321
|
/**
|
|
327
322
|
* Determines if this component is visible, or not.
|
|
328
323
|
*/
|
|
329
|
-
this._parentVisible = this.options.hasOwnProperty('parentVisible')
|
|
330
|
-
|
|
331
|
-
: true;
|
|
332
|
-
this._visible =
|
|
333
|
-
this._parentVisible &&
|
|
334
|
-
(this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
|
|
324
|
+
this._parentVisible = this.options.hasOwnProperty('parentVisible') ? this.options.parentVisible : true;
|
|
325
|
+
this._visible = this._parentVisible && (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
|
|
335
326
|
this._parentDisabled = false;
|
|
336
327
|
/**
|
|
337
328
|
* The reference attribute name for this component
|
|
@@ -426,6 +417,7 @@ class Component extends Element_1.default {
|
|
|
426
417
|
this.init();
|
|
427
418
|
}
|
|
428
419
|
}
|
|
420
|
+
/* eslint-enable max-statements */
|
|
429
421
|
get componentsMap() {
|
|
430
422
|
var _a;
|
|
431
423
|
return ((_a = this.root) === null || _a === void 0 ? void 0 : _a.childComponentsMap) || {};
|
|
@@ -484,7 +476,10 @@ class Component extends Element_1.default {
|
|
|
484
476
|
return Promise.resolve(this);
|
|
485
477
|
}
|
|
486
478
|
get isPDFReadOnlyMode() {
|
|
487
|
-
return
|
|
479
|
+
return this.parent &&
|
|
480
|
+
this.parent.form &&
|
|
481
|
+
(this.parent.form.display === 'pdf') &&
|
|
482
|
+
this.options.readOnly;
|
|
488
483
|
}
|
|
489
484
|
get labelInfo() {
|
|
490
485
|
const label = {};
|
|
@@ -493,10 +488,7 @@ class Component extends Element_1.default {
|
|
|
493
488
|
label.labelPosition = this.component.labelPosition;
|
|
494
489
|
label.tooltipClass = `${this.iconClass('question-sign')} text-muted`;
|
|
495
490
|
const isPDFReadOnlyMode = this.isPDFReadOnlyMode;
|
|
496
|
-
if (this.hasInput &&
|
|
497
|
-
this.component.validate &&
|
|
498
|
-
(0, utils_2.boolValue)(this.component.validate.required) &&
|
|
499
|
-
!isPDFReadOnlyMode) {
|
|
491
|
+
if (this.hasInput && this.component.validate && (0, utils_2.boolValue)(this.component.validate.required) && !isPDFReadOnlyMode) {
|
|
500
492
|
label.className += ' field-required';
|
|
501
493
|
}
|
|
502
494
|
if (label.hidden) {
|
|
@@ -510,7 +502,7 @@ class Component extends Element_1.default {
|
|
|
510
502
|
init() {
|
|
511
503
|
var _a;
|
|
512
504
|
this.disabled = this.shouldDisabled;
|
|
513
|
-
this._visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
|
|
505
|
+
this._visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
|
|
514
506
|
if ((_a = this.component.addons) === null || _a === void 0 ? void 0 : _a.length) {
|
|
515
507
|
this.component.addons.forEach((addon) => this.createAddon(addon));
|
|
516
508
|
}
|
|
@@ -546,7 +538,8 @@ class Component extends Element_1.default {
|
|
|
546
538
|
let addon = null;
|
|
547
539
|
if (Addon) {
|
|
548
540
|
const supportedComponents = Addon.info.supportedComponents;
|
|
549
|
-
const supportsThisComponentType = !(supportedComponents === null || supportedComponents === void 0 ? void 0 : supportedComponents.length) ||
|
|
541
|
+
const supportsThisComponentType = !(supportedComponents === null || supportedComponents === void 0 ? void 0 : supportedComponents.length) ||
|
|
542
|
+
supportedComponents.indexOf(this.component.type) !== -1;
|
|
550
543
|
if (supportsThisComponentType) {
|
|
551
544
|
addon = new Addon(settings, this);
|
|
552
545
|
this.addons.push(addon);
|
|
@@ -583,9 +576,7 @@ class Component extends Element_1.default {
|
|
|
583
576
|
}
|
|
584
577
|
}
|
|
585
578
|
get shouldDisabled() {
|
|
586
|
-
return
|
|
587
|
-
this.component.disabled ||
|
|
588
|
-
(this.options.hasOwnProperty('disabled') && this.options.disabled[this.key]));
|
|
579
|
+
return this.options.readOnly || this.component.disabled || (this.options.hasOwnProperty('disabled') && this.options.disabled[this.key]);
|
|
589
580
|
}
|
|
590
581
|
get isInputComponent() {
|
|
591
582
|
return !this.component.hasOwnProperty('input') || this.component.input;
|
|
@@ -764,7 +755,7 @@ class Component extends Element_1.default {
|
|
|
764
755
|
'left-left',
|
|
765
756
|
'left-right',
|
|
766
757
|
'right-left',
|
|
767
|
-
'right-right'
|
|
758
|
+
'right-right'
|
|
768
759
|
].includes(this.labelPosition);
|
|
769
760
|
}
|
|
770
761
|
get labelPositions() {
|
|
@@ -802,7 +793,7 @@ class Component extends Element_1.default {
|
|
|
802
793
|
isRightPosition,
|
|
803
794
|
isRightAlign,
|
|
804
795
|
labelStyles,
|
|
805
|
-
contentStyles
|
|
796
|
+
contentStyles
|
|
806
797
|
};
|
|
807
798
|
}
|
|
808
799
|
/**
|
|
@@ -829,11 +820,11 @@ class Component extends Element_1.default {
|
|
|
829
820
|
modified[key] = val;
|
|
830
821
|
}
|
|
831
822
|
}
|
|
832
|
-
else if ((!recursion && key === 'type') ||
|
|
833
|
-
(!recursion && key === 'key') ||
|
|
834
|
-
(!recursion && key === 'label') ||
|
|
835
|
-
(!recursion && key === 'input') ||
|
|
836
|
-
(!recursion && key === 'tableView') ||
|
|
823
|
+
else if ((!recursion && (key === 'type')) ||
|
|
824
|
+
(!recursion && (key === 'key')) ||
|
|
825
|
+
(!recursion && (key === 'label')) ||
|
|
826
|
+
(!recursion && (key === 'input')) ||
|
|
827
|
+
(!recursion && (key === 'tableView')) ||
|
|
837
828
|
(val !== '' && !defaultSchema.hasOwnProperty(key)) ||
|
|
838
829
|
(val !== '' && val !== defaultSchema[key]) ||
|
|
839
830
|
(defaultSchema[key] && val !== defaultSchema[key])) {
|
|
@@ -877,32 +868,21 @@ class Component extends Element_1.default {
|
|
|
877
868
|
return super.t(text, params, ...args);
|
|
878
869
|
}
|
|
879
870
|
labelIsHidden() {
|
|
880
|
-
return
|
|
881
|
-
((
|
|
871
|
+
return !this.component.label ||
|
|
872
|
+
((!this.isInDataGrid && this.component.hideLabel) ||
|
|
882
873
|
(this.isInDataGrid && !this.component.dataGridLabel) ||
|
|
883
874
|
this.options.floatingLabels ||
|
|
884
|
-
this.options.inputsOnly) &&
|
|
885
|
-
!this.builderMode));
|
|
875
|
+
this.options.inputsOnly) && !this.builderMode;
|
|
886
876
|
}
|
|
887
877
|
transform(type, value) {
|
|
888
|
-
const frameworkTemplates = this.options.template
|
|
889
|
-
? Templates_1.default.templates[this.options.template]
|
|
890
|
-
: Templates_1.default.current;
|
|
878
|
+
const frameworkTemplates = this.options.template ? Templates_1.default.templates[this.options.template] : Templates_1.default.current;
|
|
891
879
|
return frameworkTemplates.hasOwnProperty('transform')
|
|
892
880
|
? frameworkTemplates.transform(type, value, this)
|
|
893
881
|
: (type, value) => value;
|
|
894
882
|
}
|
|
895
883
|
getTemplate(names, modes) {
|
|
896
|
-
modes = Array.isArray(modes)
|
|
897
|
-
|
|
898
|
-
: [
|
|
899
|
-
modes,
|
|
900
|
-
];
|
|
901
|
-
names = Array.isArray(names)
|
|
902
|
-
? names
|
|
903
|
-
: [
|
|
904
|
-
names,
|
|
905
|
-
];
|
|
884
|
+
modes = Array.isArray(modes) ? modes : [modes];
|
|
885
|
+
names = Array.isArray(names) ? names : [names];
|
|
906
886
|
if (!modes.includes('form')) {
|
|
907
887
|
modes.push('form');
|
|
908
888
|
}
|
|
@@ -913,9 +893,7 @@ class Component extends Element_1.default {
|
|
|
913
893
|
return result;
|
|
914
894
|
}
|
|
915
895
|
}
|
|
916
|
-
const frameworkTemplates = this.options.template
|
|
917
|
-
? Templates_1.default.templates[this.options.template]
|
|
918
|
-
: Templates_1.default.current;
|
|
896
|
+
const frameworkTemplates = this.options.template ? Templates_1.default.templates[this.options.template] : Templates_1.default.current;
|
|
919
897
|
result = this.checkTemplate(frameworkTemplates, names, modes);
|
|
920
898
|
if (result) {
|
|
921
899
|
return result;
|
|
@@ -1049,9 +1027,7 @@ class Component extends Element_1.default {
|
|
|
1049
1027
|
if (settings && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.shadowRoot)) {
|
|
1050
1028
|
settings.shadowRoot = this.root.shadowRoot;
|
|
1051
1029
|
}
|
|
1052
|
-
const widget = settings && widgets_1.default[settings.type]
|
|
1053
|
-
? new widgets_1.default[settings.type](settings, this.component, this)
|
|
1054
|
-
: null;
|
|
1030
|
+
const widget = settings && widgets_1.default[settings.type] ? new widgets_1.default[settings.type](settings, this.component, this) : null;
|
|
1055
1031
|
return widget;
|
|
1056
1032
|
}
|
|
1057
1033
|
/**
|
|
@@ -1060,12 +1036,7 @@ class Component extends Element_1.default {
|
|
|
1060
1036
|
*/
|
|
1061
1037
|
getBrowserLanguage() {
|
|
1062
1038
|
const nav = window.navigator;
|
|
1063
|
-
const browserLanguagePropertyKeys = [
|
|
1064
|
-
'language',
|
|
1065
|
-
'browserLanguage',
|
|
1066
|
-
'systemLanguage',
|
|
1067
|
-
'userLanguage',
|
|
1068
|
-
];
|
|
1039
|
+
const browserLanguagePropertyKeys = ['language', 'browserLanguage', 'systemLanguage', 'userLanguage'];
|
|
1069
1040
|
let language;
|
|
1070
1041
|
// support for HTML 5.1 "navigator.languages"
|
|
1071
1042
|
if (Array.isArray(nav.languages)) {
|
|
@@ -1111,8 +1082,7 @@ class Component extends Element_1.default {
|
|
|
1111
1082
|
* @returns {string} - The submission timezone.
|
|
1112
1083
|
*/
|
|
1113
1084
|
get submissionTimezone() {
|
|
1114
|
-
this.options.submissionTimezone =
|
|
1115
|
-
this.options.submissionTimezone || lodash_1.default.get(this.root, 'options.submissionTimezone');
|
|
1085
|
+
this.options.submissionTimezone = this.options.submissionTimezone || lodash_1.default.get(this.root, 'options.submissionTimezone');
|
|
1116
1086
|
return this.options.submissionTimezone;
|
|
1117
1087
|
}
|
|
1118
1088
|
/**
|
|
@@ -1136,8 +1106,8 @@ class Component extends Element_1.default {
|
|
|
1136
1106
|
}
|
|
1137
1107
|
const submissionTimezone = this.submissionTimezone;
|
|
1138
1108
|
if (submissionTimezone &&
|
|
1139
|
-
(settings.displayInTimezone === 'submission' ||
|
|
1140
|
-
((this.options.pdf || this.options.server) && settings.displayInTimezone === 'viewer'))) {
|
|
1109
|
+
((settings.displayInTimezone === 'submission') ||
|
|
1110
|
+
((this.options.pdf || this.options.server) && (settings.displayInTimezone === 'viewer')))) {
|
|
1141
1111
|
return submissionTimezone;
|
|
1142
1112
|
}
|
|
1143
1113
|
// Return current timezone if none are provided.
|
|
@@ -1229,7 +1199,7 @@ class Component extends Element_1.default {
|
|
|
1229
1199
|
id: this.id,
|
|
1230
1200
|
classes: this.className,
|
|
1231
1201
|
styles: this.customStyle,
|
|
1232
|
-
children
|
|
1202
|
+
children
|
|
1233
1203
|
}, topLevel);
|
|
1234
1204
|
}
|
|
1235
1205
|
else {
|
|
@@ -1238,7 +1208,7 @@ class Component extends Element_1.default {
|
|
|
1238
1208
|
id: this.id,
|
|
1239
1209
|
classes: this.className,
|
|
1240
1210
|
styles: this.customStyle,
|
|
1241
|
-
children
|
|
1211
|
+
children
|
|
1242
1212
|
}, topLevel);
|
|
1243
1213
|
}
|
|
1244
1214
|
}
|
|
@@ -1251,7 +1221,8 @@ class Component extends Element_1.default {
|
|
|
1251
1221
|
createTooltip(tooltipEl, settings = {}) {
|
|
1252
1222
|
const tooltipAttribute = tooltipEl.getAttribute('data-tooltip');
|
|
1253
1223
|
const tooltipDataTitle = tooltipEl.getAttribute('data-title');
|
|
1254
|
-
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1224
|
+
const tooltipText = this.interpolate(tooltipDataTitle || tooltipAttribute)
|
|
1225
|
+
.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
1255
1226
|
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 }) }));
|
|
1256
1227
|
}
|
|
1257
1228
|
/**
|
|
@@ -1285,7 +1256,9 @@ class Component extends Element_1.default {
|
|
|
1285
1256
|
if (!this.builderMode && !this.previewMode && this.component.modalEdit) {
|
|
1286
1257
|
const modalShouldBeOpened = this.componentModal ? this.componentModal.isOpened : false;
|
|
1287
1258
|
const currentValue = modalShouldBeOpened ? this.componentModal.currentValue : this.dataValue;
|
|
1288
|
-
const openModalTemplate = this.componentModal && modalShouldBeOpened
|
|
1259
|
+
const openModalTemplate = this.componentModal && modalShouldBeOpened
|
|
1260
|
+
? this.componentModal.openModalTemplate
|
|
1261
|
+
: null;
|
|
1289
1262
|
this.componentModal = this.createComponentModal(element, modalShouldBeOpened, currentValue);
|
|
1290
1263
|
this.setOpenModalElement(openModalTemplate);
|
|
1291
1264
|
}
|
|
@@ -1299,7 +1272,7 @@ class Component extends Element_1.default {
|
|
|
1299
1272
|
}
|
|
1300
1273
|
this.loadRefs(element, {
|
|
1301
1274
|
messageContainer: 'single',
|
|
1302
|
-
tooltip: 'multiple'
|
|
1275
|
+
tooltip: 'multiple'
|
|
1303
1276
|
});
|
|
1304
1277
|
this.attachTooltips(this.refs.tooltip);
|
|
1305
1278
|
// Attach logic.
|
|
@@ -1320,11 +1293,11 @@ class Component extends Element_1.default {
|
|
|
1320
1293
|
* Restors the "focus" on a component after a redraw event has occured.
|
|
1321
1294
|
*/
|
|
1322
1295
|
restoreFocus() {
|
|
1323
|
-
var _a, _b, _c;
|
|
1296
|
+
var _a, _b, _c, _d;
|
|
1324
1297
|
const isFocused = ((_b = (_a = this.root) === null || _a === void 0 ? void 0 : _a.focusedComponent) === null || _b === void 0 ? void 0 : _b.path) === this.path;
|
|
1325
1298
|
if (isFocused) {
|
|
1326
1299
|
this.loadRefs(this.element, { input: 'multiple' });
|
|
1327
|
-
this.focus((_c = this.root
|
|
1300
|
+
this.focus((_d = (_c = this.root) === null || _c === void 0 ? void 0 : _c.currentSelection) === null || _d === void 0 ? void 0 : _d.index);
|
|
1328
1301
|
this.restoreCaretPosition();
|
|
1329
1302
|
}
|
|
1330
1303
|
}
|
|
@@ -1335,14 +1308,15 @@ class Component extends Element_1.default {
|
|
|
1335
1308
|
* @returns {void}
|
|
1336
1309
|
*/
|
|
1337
1310
|
addShortcut(element, shortcut) {
|
|
1311
|
+
var _a;
|
|
1338
1312
|
// Avoid infinite recursion.
|
|
1339
|
-
if (!element || !this.root || this.root === this) {
|
|
1313
|
+
if (!element || !this.root || (this.root === this)) {
|
|
1340
1314
|
return;
|
|
1341
1315
|
}
|
|
1342
1316
|
if (!shortcut) {
|
|
1343
1317
|
shortcut = this.component.shortcut;
|
|
1344
1318
|
}
|
|
1345
|
-
this.root.addShortcut(element, shortcut);
|
|
1319
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.addShortcut(element, shortcut);
|
|
1346
1320
|
}
|
|
1347
1321
|
/**
|
|
1348
1322
|
* Removes a keyboard shortcut from this component.
|
|
@@ -1351,14 +1325,15 @@ class Component extends Element_1.default {
|
|
|
1351
1325
|
* @returns {void}
|
|
1352
1326
|
*/
|
|
1353
1327
|
removeShortcut(element, shortcut) {
|
|
1328
|
+
var _a;
|
|
1354
1329
|
// Avoid infinite recursion.
|
|
1355
|
-
if (!element || this.root === this) {
|
|
1330
|
+
if (!element || (this.root === this)) {
|
|
1356
1331
|
return;
|
|
1357
1332
|
}
|
|
1358
1333
|
if (!shortcut) {
|
|
1359
1334
|
shortcut = this.component.shortcut;
|
|
1360
1335
|
}
|
|
1361
|
-
this.root.removeShortcut(element, shortcut);
|
|
1336
|
+
(_a = this.root) === null || _a === void 0 ? void 0 : _a.removeShortcut(element, shortcut);
|
|
1362
1337
|
}
|
|
1363
1338
|
/**
|
|
1364
1339
|
* Remove all event handlers.
|
|
@@ -1399,10 +1374,7 @@ class Component extends Element_1.default {
|
|
|
1399
1374
|
if (refreshData === 'data') {
|
|
1400
1375
|
this.refresh(this.data, changed, flags);
|
|
1401
1376
|
}
|
|
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 &&
|
|
1377
|
+
else if ((changePath && (((_b = (_a = changed.instance) === null || _a === void 0 ? void 0 : _a.paths) === null || _b === void 0 ? void 0 : _b.localPath) === refreshData)) && changed && changed.instance &&
|
|
1406
1378
|
// Make sure the changed component is not in a different "context". Solves issues where refreshOn being set
|
|
1407
1379
|
// in fields inside EditGrids could alter their state from other rows (which is bad).
|
|
1408
1380
|
this.inContext(changed.instance)) {
|
|
@@ -1421,20 +1393,16 @@ class Component extends Element_1.default {
|
|
|
1421
1393
|
return;
|
|
1422
1394
|
}
|
|
1423
1395
|
if (!changes.length && flags.changed) {
|
|
1424
|
-
changes = [
|
|
1425
|
-
flags.changed,
|
|
1426
|
-
];
|
|
1396
|
+
changes = [flags.changed];
|
|
1427
1397
|
}
|
|
1428
|
-
const refreshOn = flags.fromBlur
|
|
1429
|
-
? this.component.refreshOnBlur
|
|
1430
|
-
: this.component.refreshOn || this.component.redrawOn;
|
|
1398
|
+
const refreshOn = flags.fromBlur ? this.component.refreshOnBlur : this.component.refreshOn || this.component.redrawOn;
|
|
1431
1399
|
// If they wish to refresh on a value, then add that here.
|
|
1432
1400
|
if (refreshOn) {
|
|
1433
1401
|
if (Array.isArray(refreshOn)) {
|
|
1434
|
-
refreshOn.forEach(
|
|
1402
|
+
refreshOn.forEach(refreshData => changes.forEach(changed => this.checkRefresh(refreshData, changed, flags)));
|
|
1435
1403
|
}
|
|
1436
1404
|
else {
|
|
1437
|
-
changes.forEach(
|
|
1405
|
+
changes.forEach(changed => this.checkRefresh(refreshOn, changed, flags));
|
|
1438
1406
|
}
|
|
1439
1407
|
}
|
|
1440
1408
|
}
|
|
@@ -1444,6 +1412,7 @@ class Component extends Element_1.default {
|
|
|
1444
1412
|
* @returns {void}
|
|
1445
1413
|
*/
|
|
1446
1414
|
refresh(value) {
|
|
1415
|
+
var _a;
|
|
1447
1416
|
if (this.hasOwnProperty('refreshOnValue')) {
|
|
1448
1417
|
this.refreshOnChanged = !lodash_1.default.isEqual(value, this.refreshOnValue);
|
|
1449
1418
|
}
|
|
@@ -1455,7 +1424,7 @@ class Component extends Element_1.default {
|
|
|
1455
1424
|
if (this.component.clearOnRefresh) {
|
|
1456
1425
|
this.setValue(null);
|
|
1457
1426
|
}
|
|
1458
|
-
this.triggerRedraw();
|
|
1427
|
+
(_a = this.triggerRedraw) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
1459
1428
|
}
|
|
1460
1429
|
}
|
|
1461
1430
|
/**
|
|
@@ -1505,7 +1474,7 @@ class Component extends Element_1.default {
|
|
|
1505
1474
|
*/
|
|
1506
1475
|
createViewOnlyElement() {
|
|
1507
1476
|
this.setElement(this.ce('dl', {
|
|
1508
|
-
id: this.id
|
|
1477
|
+
id: this.id
|
|
1509
1478
|
}));
|
|
1510
1479
|
if (this.element) {
|
|
1511
1480
|
// Ensure you can get the component info from the element.
|
|
@@ -1617,7 +1586,7 @@ class Component extends Element_1.default {
|
|
|
1617
1586
|
*/
|
|
1618
1587
|
itemValueForHTMLMode(value) {
|
|
1619
1588
|
if (Array.isArray(value)) {
|
|
1620
|
-
const values = value.map(
|
|
1589
|
+
const values = value.map(item => Array.isArray(item) ? this.itemValueForHTMLMode(item) : this.itemValue(item));
|
|
1621
1590
|
return values.join(', ');
|
|
1622
1591
|
}
|
|
1623
1592
|
return this.itemValue(value);
|
|
@@ -1653,8 +1622,7 @@ class Component extends Element_1.default {
|
|
|
1653
1622
|
};
|
|
1654
1623
|
const handleCloseClick = (e) => {
|
|
1655
1624
|
if (confirm) {
|
|
1656
|
-
confirm()
|
|
1657
|
-
.then(() => close(e))
|
|
1625
|
+
confirm().then(() => close(e))
|
|
1658
1626
|
.catch(() => { });
|
|
1659
1627
|
}
|
|
1660
1628
|
else {
|
|
@@ -1754,11 +1722,9 @@ class Component extends Element_1.default {
|
|
|
1754
1722
|
// It is useful to translate strings in different scenarions (eg: custom edit grid templates, custom error messages etc.)
|
|
1755
1723
|
// and desirable to be publicly available rather than calling the internal {instance.t} function in the template string.
|
|
1756
1724
|
t: this.t.bind(this),
|
|
1757
|
-
submission: this.root
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
data: this.rootValue,
|
|
1761
|
-
},
|
|
1725
|
+
submission: (this.root ? this.root._submission : {
|
|
1726
|
+
data: this.rootValue
|
|
1727
|
+
}),
|
|
1762
1728
|
form: this.root ? this.root._form : {},
|
|
1763
1729
|
options: this.options,
|
|
1764
1730
|
}, additional));
|
|
@@ -1811,12 +1777,7 @@ class Component extends Element_1.default {
|
|
|
1811
1777
|
const iconset = this.options.iconset || Templates_1.default.current.defaultIconset || 'fa';
|
|
1812
1778
|
return Templates_1.default.current.hasOwnProperty('iconClass')
|
|
1813
1779
|
? Templates_1.default.current.iconClass(iconset, name, spinning)
|
|
1814
|
-
:
|
|
1815
|
-
'fa',
|
|
1816
|
-
'bi',
|
|
1817
|
-
].includes(this.options.iconset)
|
|
1818
|
-
? Templates_1.default.defaultTemplates.iconClass(iconset, name, spinning)
|
|
1819
|
-
: name;
|
|
1780
|
+
: this.options.iconset === 'fa' ? Templates_1.default.defaultTemplates.iconClass(iconset, name, spinning) : name;
|
|
1820
1781
|
}
|
|
1821
1782
|
/**
|
|
1822
1783
|
* Returns the size css class names for our current template.
|
|
@@ -1824,16 +1785,16 @@ class Component extends Element_1.default {
|
|
|
1824
1785
|
* @returns {string} - The size class for our component.
|
|
1825
1786
|
*/
|
|
1826
1787
|
size(size) {
|
|
1827
|
-
return Templates_1.default.current.hasOwnProperty('size')
|
|
1788
|
+
return Templates_1.default.current.hasOwnProperty('size')
|
|
1789
|
+
? Templates_1.default.current.size(size)
|
|
1790
|
+
: size;
|
|
1828
1791
|
}
|
|
1829
1792
|
/**
|
|
1830
1793
|
* The readible name for this component.
|
|
1831
1794
|
* @returns {string} - The name of the component.
|
|
1832
1795
|
*/
|
|
1833
1796
|
get name() {
|
|
1834
|
-
return this.t(this.component.label || this.component.placeholder || this.key, {
|
|
1835
|
-
_userInput: true,
|
|
1836
|
-
});
|
|
1797
|
+
return this.t(this.component.label || this.component.placeholder || this.key, { _userInput: true });
|
|
1837
1798
|
}
|
|
1838
1799
|
/**
|
|
1839
1800
|
* Returns the visible errors for this component.
|
|
@@ -1854,7 +1815,10 @@ class Component extends Element_1.default {
|
|
|
1854
1815
|
* @returns {string} - The error label for this component.
|
|
1855
1816
|
*/
|
|
1856
1817
|
get errorLabel() {
|
|
1857
|
-
return this.t(this.component.errorLabel
|
|
1818
|
+
return this.t(this.component.errorLabel
|
|
1819
|
+
|| this.component.label
|
|
1820
|
+
|| this.component.placeholder
|
|
1821
|
+
|| this.key);
|
|
1858
1822
|
}
|
|
1859
1823
|
/**
|
|
1860
1824
|
* Get the error message provided a certain type of error.
|
|
@@ -1862,9 +1826,7 @@ class Component extends Element_1.default {
|
|
|
1862
1826
|
* @returns {string} - The error message configured for this component.
|
|
1863
1827
|
*/
|
|
1864
1828
|
errorMessage(type) {
|
|
1865
|
-
return this.component.errors && this.component.errors[type]
|
|
1866
|
-
? this.component.errors[type]
|
|
1867
|
-
: type;
|
|
1829
|
+
return (this.component.errors && this.component.errors[type]) ? this.component.errors[type] : type;
|
|
1868
1830
|
}
|
|
1869
1831
|
/**
|
|
1870
1832
|
* Sets the content, innerHTML, of an element to the sanitized content.
|
|
@@ -1940,7 +1902,7 @@ class Component extends Element_1.default {
|
|
|
1940
1902
|
*/
|
|
1941
1903
|
removeEventListeners() {
|
|
1942
1904
|
super.removeEventListeners();
|
|
1943
|
-
this.tooltips.forEach(
|
|
1905
|
+
this.tooltips.forEach(tooltip => tooltip.destroy());
|
|
1944
1906
|
this.tooltips = [];
|
|
1945
1907
|
}
|
|
1946
1908
|
/**
|
|
@@ -2031,7 +1993,7 @@ class Component extends Element_1.default {
|
|
|
2031
1993
|
this.redraw();
|
|
2032
1994
|
}
|
|
2033
1995
|
// Check visibility
|
|
2034
|
-
const visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
|
|
1996
|
+
const visible = (this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden);
|
|
2035
1997
|
if (this.visible !== visible) {
|
|
2036
1998
|
this.visible = visible;
|
|
2037
1999
|
}
|
|
@@ -2073,8 +2035,7 @@ class Component extends Element_1.default {
|
|
|
2073
2035
|
const newComponent = (0, utils_2.fastCloneDeep)(this.originalComponent);
|
|
2074
2036
|
let changed = logics.reduce((changed, logic) => {
|
|
2075
2037
|
const result = utils_1.default.checkTrigger(newComponent, logic.trigger, row, data, this.root ? this.root._form : {}, this);
|
|
2076
|
-
return (
|
|
2077
|
-
changed);
|
|
2038
|
+
return (result ? this.applyActions(newComponent, logic.actions, result, row, data) : false) || changed;
|
|
2078
2039
|
}, false);
|
|
2079
2040
|
// If component definition changed, replace and mark as changed.
|
|
2080
2041
|
if (!lodash_1.default.isEqual(this.component, newComponent)) {
|
|
@@ -2234,17 +2195,13 @@ class Component extends Element_1.default {
|
|
|
2234
2195
|
};
|
|
2235
2196
|
}
|
|
2236
2197
|
if (!Array.isArray(messages)) {
|
|
2237
|
-
messages = [
|
|
2238
|
-
messages,
|
|
2239
|
-
];
|
|
2198
|
+
messages = [messages];
|
|
2240
2199
|
}
|
|
2241
|
-
messages = lodash_1.default.uniqBy(messages,
|
|
2200
|
+
messages = lodash_1.default.uniqBy(messages, message => message.message);
|
|
2242
2201
|
if (this.refs.messageContainer) {
|
|
2243
|
-
this.setContent(this.refs.messageContainer, messages
|
|
2244
|
-
.map((message) => {
|
|
2202
|
+
this.setContent(this.refs.messageContainer, messages.map((message) => {
|
|
2245
2203
|
return this.renderTemplate('message', Object.assign({}, message));
|
|
2246
|
-
})
|
|
2247
|
-
.join(''));
|
|
2204
|
+
}).join(''));
|
|
2248
2205
|
}
|
|
2249
2206
|
}
|
|
2250
2207
|
/**
|
|
@@ -2304,16 +2261,14 @@ class Component extends Element_1.default {
|
|
|
2304
2261
|
*/
|
|
2305
2262
|
clearComponentOnHide() {
|
|
2306
2263
|
// clearOnHide defaults to true for old forms (without the value set) so only trigger if the value is false.
|
|
2307
|
-
if (this.component.clearOnHide !== false &&
|
|
2308
|
-
!this.options.readOnly &&
|
|
2309
|
-
!this.options.showHiddenFields) {
|
|
2264
|
+
if (this.component.clearOnHide !== false && !this.options.readOnly && !this.options.showHiddenFields) {
|
|
2310
2265
|
if (this.shouldConditionallyClear()) {
|
|
2311
2266
|
this.deleteValue();
|
|
2312
2267
|
}
|
|
2313
2268
|
else if (!this.hasValue() && this.shouldAddDefaultValue) {
|
|
2314
2269
|
// If shown, ensure the default is set.
|
|
2315
2270
|
this.setValue(this.defaultValue, {
|
|
2316
|
-
noUpdateEvent: true
|
|
2271
|
+
noUpdateEvent: true
|
|
2317
2272
|
});
|
|
2318
2273
|
}
|
|
2319
2274
|
}
|
|
@@ -2357,7 +2312,7 @@ class Component extends Element_1.default {
|
|
|
2357
2312
|
}
|
|
2358
2313
|
if (this.component.onChange) {
|
|
2359
2314
|
this.evaluate(this.component.onChange, {
|
|
2360
|
-
flags
|
|
2315
|
+
flags
|
|
2361
2316
|
});
|
|
2362
2317
|
}
|
|
2363
2318
|
// Set the changed variable.
|
|
@@ -2365,7 +2320,7 @@ class Component extends Element_1.default {
|
|
|
2365
2320
|
instance: this,
|
|
2366
2321
|
component: this.component,
|
|
2367
2322
|
value: this.dataValue,
|
|
2368
|
-
flags: flags
|
|
2323
|
+
flags: flags
|
|
2369
2324
|
};
|
|
2370
2325
|
// Emit the change.
|
|
2371
2326
|
this.emit('componentChange', changed);
|
|
@@ -2388,65 +2343,16 @@ class Component extends Element_1.default {
|
|
|
2388
2343
|
placeholder: this.t(this.component.placeholder, { _userInput: true }),
|
|
2389
2344
|
modules: {
|
|
2390
2345
|
toolbar: [
|
|
2391
|
-
[
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
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
|
-
},
|
|
2346
|
+
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
|
|
2347
|
+
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
|
|
2348
|
+
[{ 'font': [] }],
|
|
2349
|
+
['bold', 'italic', 'underline', 'strike', { 'script': 'sub' }, { 'script': 'super' }, 'clean'],
|
|
2350
|
+
[{ 'color': [] }, { 'background': [] }],
|
|
2351
|
+
[{ 'list': 'ordered' }, { 'list': 'bullet' }, { 'indent': '-1' }, { 'indent': '+1' }, { 'align': [] }],
|
|
2352
|
+
['blockquote', 'code-block'],
|
|
2353
|
+
['link', 'image', 'video', 'formula', 'source']
|
|
2354
|
+
]
|
|
2355
|
+
}
|
|
2450
2356
|
},
|
|
2451
2357
|
ace: {
|
|
2452
2358
|
theme: 'ace/theme/xcode',
|
|
@@ -2454,7 +2360,7 @@ class Component extends Element_1.default {
|
|
|
2454
2360
|
minLines: 12,
|
|
2455
2361
|
tabSize: 2,
|
|
2456
2362
|
mode: 'ace/mode/javascript',
|
|
2457
|
-
placeholder: this.t(this.component.placeholder, { _userInput: true })
|
|
2363
|
+
placeholder: this.t(this.component.placeholder, { _userInput: true })
|
|
2458
2364
|
},
|
|
2459
2365
|
ckeditor: {
|
|
2460
2366
|
image: {
|
|
@@ -2464,18 +2370,18 @@ class Component extends Element_1.default {
|
|
|
2464
2370
|
'imageStyle:full',
|
|
2465
2371
|
'imageStyle:alignLeft',
|
|
2466
2372
|
'imageStyle:alignCenter',
|
|
2467
|
-
'imageStyle:alignRight'
|
|
2373
|
+
'imageStyle:alignRight'
|
|
2468
2374
|
],
|
|
2469
2375
|
styles: [
|
|
2470
2376
|
'full',
|
|
2471
2377
|
'alignLeft',
|
|
2472
2378
|
'alignCenter',
|
|
2473
|
-
'alignRight'
|
|
2474
|
-
]
|
|
2379
|
+
'alignRight'
|
|
2380
|
+
]
|
|
2475
2381
|
},
|
|
2476
|
-
extraPlugins: []
|
|
2382
|
+
extraPlugins: []
|
|
2477
2383
|
},
|
|
2478
|
-
default: {}
|
|
2384
|
+
default: {}
|
|
2479
2385
|
};
|
|
2480
2386
|
}
|
|
2481
2387
|
addCKE(element, settings, onChange) {
|
|
@@ -2486,7 +2392,8 @@ class Component extends Element_1.default {
|
|
|
2486
2392
|
if (this.component.isUploadEnabled) {
|
|
2487
2393
|
settings.extraPlugins.push((0, uploadAdapter_1.getFormioUploadAdapterPlugin)(this.fileService, this));
|
|
2488
2394
|
}
|
|
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)
|
|
2395
|
+
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)
|
|
2396
|
+
.then(() => {
|
|
2490
2397
|
if (!element.parentNode) {
|
|
2491
2398
|
return Promise.reject();
|
|
2492
2399
|
}
|
|
@@ -2496,7 +2403,7 @@ class Component extends Element_1.default {
|
|
|
2496
2403
|
return Promise.resolve(editor);
|
|
2497
2404
|
}
|
|
2498
2405
|
else {
|
|
2499
|
-
return ClassicEditor.create(element, settings).then(
|
|
2406
|
+
return ClassicEditor.create(element, settings).then(editor => {
|
|
2500
2407
|
editor.model.document.on('change', () => onChange(editor.data.get()));
|
|
2501
2408
|
return editor;
|
|
2502
2409
|
});
|
|
@@ -2509,11 +2416,13 @@ class Component extends Element_1.default {
|
|
|
2509
2416
|
settings = Object.assign(Object.assign({}, settings), { modules: Object.assign({ table: true }, settings.modules) });
|
|
2510
2417
|
// Lazy load the quill css.
|
|
2511
2418
|
Formio_1.Formio.requireLibrary(`quill-css-${settings.theme}`, 'Quill', [
|
|
2512
|
-
{ type: 'styles', src: `${Formio_1.Formio.cdn.quill}/quill.${settings.theme}.css` }
|
|
2419
|
+
{ type: 'styles', src: `${Formio_1.Formio.cdn.quill}/quill.${settings.theme}.css` }
|
|
2513
2420
|
], true);
|
|
2514
2421
|
// Lazy load the quill library.
|
|
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)
|
|
2516
|
-
|
|
2422
|
+
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)
|
|
2423
|
+
.then(() => {
|
|
2424
|
+
return Formio_1.Formio.requireLibrary('quill-table', 'Quill', `${Formio_1.Formio.cdn.baseUrl}/quill/quill-table.js`, true)
|
|
2425
|
+
.then(() => {
|
|
2517
2426
|
if (!element.parentNode) {
|
|
2518
2427
|
return Promise.reject();
|
|
2519
2428
|
}
|
|
@@ -2529,7 +2438,7 @@ class Component extends Element_1.default {
|
|
|
2529
2438
|
if (txtArea.style.display === 'inherit') {
|
|
2530
2439
|
this.quill.setContents(this.quill.clipboard.convert({ html: txtArea.value }));
|
|
2531
2440
|
}
|
|
2532
|
-
txtArea.style.display = txtArea.style.display === 'none' ? 'inherit' : 'none';
|
|
2441
|
+
txtArea.style.display = (txtArea.style.display === 'none') ? 'inherit' : 'none';
|
|
2533
2442
|
});
|
|
2534
2443
|
}
|
|
2535
2444
|
/** END CODEBLOCK */
|
|
@@ -2551,10 +2460,10 @@ class Component extends Element_1.default {
|
|
|
2551
2460
|
get shouldSanitizeValue() {
|
|
2552
2461
|
var _a;
|
|
2553
2462
|
// Sanitize value if sanitizing for thw whole content is turned off
|
|
2554
|
-
return ((_a = this.options) === null || _a === void 0 ? void 0 : _a.sanitize) !== false;
|
|
2463
|
+
return (((_a = this.options) === null || _a === void 0 ? void 0 : _a.sanitize) !== false);
|
|
2555
2464
|
}
|
|
2556
2465
|
addAce(element, settings, onChange) {
|
|
2557
|
-
if (!settings || settings.theme === 'snow') {
|
|
2466
|
+
if (!settings || (settings.theme === 'snow')) {
|
|
2558
2467
|
const mode = settings ? settings.mode : '';
|
|
2559
2468
|
settings = {};
|
|
2560
2469
|
if (mode) {
|
|
@@ -2562,7 +2471,8 @@ class Component extends Element_1.default {
|
|
|
2562
2471
|
}
|
|
2563
2472
|
}
|
|
2564
2473
|
settings = lodash_1.default.merge(this.wysiwygDefault.ace, lodash_1.default.get(this.options, 'editors.ace.settings', {}), settings || {});
|
|
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)
|
|
2474
|
+
return Formio_1.Formio.requireLibrary('ace', 'ace', lodash_1.default.get(this.options, 'editors.ace.src', `${Formio_1.Formio.cdn.ace}/ace.js`), true)
|
|
2475
|
+
.then((editor) => {
|
|
2566
2476
|
editor = editor.edit(element);
|
|
2567
2477
|
editor.removeAllListeners('change');
|
|
2568
2478
|
editor.setOptions(settings);
|
|
@@ -2620,10 +2530,10 @@ class Component extends Element_1.default {
|
|
|
2620
2530
|
if (!this.allowData || !this.key) {
|
|
2621
2531
|
return;
|
|
2622
2532
|
}
|
|
2623
|
-
if (value !== null && value !== undefined) {
|
|
2533
|
+
if ((value !== null) && (value !== undefined)) {
|
|
2624
2534
|
value = this.hook('setDataValue', value, this.key, this._data);
|
|
2625
2535
|
}
|
|
2626
|
-
if (value === null || value === undefined) {
|
|
2536
|
+
if ((value === null) || (value === undefined)) {
|
|
2627
2537
|
this.unset();
|
|
2628
2538
|
return;
|
|
2629
2539
|
}
|
|
@@ -2636,12 +2546,13 @@ class Component extends Element_1.default {
|
|
|
2636
2546
|
* @param {*} flags - The flags to use when splicing the value.
|
|
2637
2547
|
*/
|
|
2638
2548
|
splice(index, flags = {}) {
|
|
2549
|
+
var _a;
|
|
2639
2550
|
if (this.hasValue()) {
|
|
2640
2551
|
const dataValue = this.dataValue || [];
|
|
2641
2552
|
if (lodash_1.default.isArray(dataValue) && dataValue.hasOwnProperty(index)) {
|
|
2642
2553
|
dataValue.splice(index, 1);
|
|
2643
2554
|
this.dataValue = dataValue;
|
|
2644
|
-
this.triggerChange(flags);
|
|
2555
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, flags);
|
|
2645
2556
|
}
|
|
2646
2557
|
}
|
|
2647
2558
|
}
|
|
@@ -2654,7 +2565,7 @@ class Component extends Element_1.default {
|
|
|
2654
2565
|
deleteValue() {
|
|
2655
2566
|
this.setValue(null, {
|
|
2656
2567
|
noUpdateEvent: true,
|
|
2657
|
-
noDefault: true
|
|
2568
|
+
noDefault: true
|
|
2658
2569
|
});
|
|
2659
2570
|
this.unset();
|
|
2660
2571
|
}
|
|
@@ -2669,10 +2580,9 @@ class Component extends Element_1.default {
|
|
|
2669
2580
|
* @returns {boolean} - TRUE if a default value is set.
|
|
2670
2581
|
*/
|
|
2671
2582
|
get hasDefaultValue() {
|
|
2672
|
-
return
|
|
2673
|
-
(this.component.
|
|
2674
|
-
|
|
2675
|
-
this.component.defaultValue !== undefined));
|
|
2583
|
+
return this.component.customDefaultValue || (this.component.hasOwnProperty('defaultValue') &&
|
|
2584
|
+
(this.component.defaultValue !== null) &&
|
|
2585
|
+
(this.component.defaultValue !== undefined));
|
|
2676
2586
|
}
|
|
2677
2587
|
/**
|
|
2678
2588
|
* Determine if we should add a default value for this component.
|
|
@@ -2767,7 +2677,7 @@ class Component extends Element_1.default {
|
|
|
2767
2677
|
Array.isArray(this.defaultValue) &&
|
|
2768
2678
|
this.refs.hasOwnProperty('input') &&
|
|
2769
2679
|
valueInput &&
|
|
2770
|
-
valueInput.length !== value.length &&
|
|
2680
|
+
(valueInput.length !== value.length) &&
|
|
2771
2681
|
this.visible) {
|
|
2772
2682
|
if (isFilelink || valueInput.length) {
|
|
2773
2683
|
this.redraw();
|
|
@@ -2821,9 +2731,9 @@ class Component extends Element_1.default {
|
|
|
2821
2731
|
}
|
|
2822
2732
|
setDefaultValue() {
|
|
2823
2733
|
if (this.defaultValue && this.shouldAddDefaultValue) {
|
|
2824
|
-
const defaultValue = this.component.multiple && !this.dataValue.length ? [] : this.defaultValue;
|
|
2734
|
+
const defaultValue = (this.component.multiple && !this.dataValue.length) ? [] : this.defaultValue;
|
|
2825
2735
|
this.setValue(defaultValue, {
|
|
2826
|
-
noUpdateEvent: true
|
|
2736
|
+
noUpdateEvent: true
|
|
2827
2737
|
});
|
|
2828
2738
|
}
|
|
2829
2739
|
}
|
|
@@ -2833,7 +2743,7 @@ class Component extends Element_1.default {
|
|
|
2833
2743
|
restoreValue() {
|
|
2834
2744
|
if (this.hasSetValue) {
|
|
2835
2745
|
this.setValue(this.dataValue, {
|
|
2836
|
-
noUpdateEvent: true
|
|
2746
|
+
noUpdateEvent: true
|
|
2837
2747
|
});
|
|
2838
2748
|
}
|
|
2839
2749
|
else {
|
|
@@ -2855,10 +2765,10 @@ class Component extends Element_1.default {
|
|
|
2855
2765
|
* @returns {boolean} - If the value changed.
|
|
2856
2766
|
*/
|
|
2857
2767
|
updateComponentValue(value, flags = {}) {
|
|
2858
|
-
let newValue = !flags.resetValue && (value === undefined || value === null) ? this.getValue() : value;
|
|
2768
|
+
let newValue = (!flags.resetValue && (value === undefined || value === null)) ? this.getValue() : value;
|
|
2859
2769
|
newValue = this.normalizeValue(newValue, flags);
|
|
2860
2770
|
const oldValue = this.dataValue;
|
|
2861
|
-
let changed = newValue !== undefined ? this.hasChanged(newValue, oldValue) : false;
|
|
2771
|
+
let changed = ((newValue !== undefined) ? this.hasChanged(newValue, oldValue) : false);
|
|
2862
2772
|
if (changed) {
|
|
2863
2773
|
this.dataValue = newValue;
|
|
2864
2774
|
changed = this.dataValue !== oldValue;
|
|
@@ -2882,7 +2792,7 @@ class Component extends Element_1.default {
|
|
|
2882
2792
|
className: this.iconClass(name),
|
|
2883
2793
|
ref,
|
|
2884
2794
|
styles,
|
|
2885
|
-
content
|
|
2795
|
+
content
|
|
2886
2796
|
});
|
|
2887
2797
|
}
|
|
2888
2798
|
/**
|
|
@@ -2893,7 +2803,7 @@ class Component extends Element_1.default {
|
|
|
2893
2803
|
this.setValue(this.defaultValue || this.emptyValue, {
|
|
2894
2804
|
noUpdateEvent: true,
|
|
2895
2805
|
noValidate: true,
|
|
2896
|
-
resetValue: true
|
|
2806
|
+
resetValue: true
|
|
2897
2807
|
});
|
|
2898
2808
|
}
|
|
2899
2809
|
/**
|
|
@@ -2903,12 +2813,15 @@ class Component extends Element_1.default {
|
|
|
2903
2813
|
* @returns {boolean} - TRUE if the value has changed.
|
|
2904
2814
|
*/
|
|
2905
2815
|
hasChanged(newValue, oldValue) {
|
|
2906
|
-
if ((newValue === undefined || newValue === null) &&
|
|
2907
|
-
(oldValue === undefined || oldValue === null || this.isEmpty(oldValue))) {
|
|
2816
|
+
if (((newValue === undefined) || (newValue === null)) &&
|
|
2817
|
+
((oldValue === undefined) || (oldValue === null) || this.isEmpty(oldValue))) {
|
|
2908
2818
|
return false;
|
|
2909
2819
|
}
|
|
2910
2820
|
// If we do not have a value and are getting set to anything other than undefined or null, then we changed.
|
|
2911
|
-
if (newValue !== undefined &&
|
|
2821
|
+
if (newValue !== undefined &&
|
|
2822
|
+
newValue !== null &&
|
|
2823
|
+
this.allowData &&
|
|
2824
|
+
!this.hasValue()) {
|
|
2912
2825
|
return true;
|
|
2913
2826
|
}
|
|
2914
2827
|
return !lodash_1.default.isEqual(newValue, oldValue);
|
|
@@ -2920,12 +2833,13 @@ class Component extends Element_1.default {
|
|
|
2920
2833
|
* @returns {boolean} - If the value changed.
|
|
2921
2834
|
*/
|
|
2922
2835
|
updateOnChange(flags = {}, changed = false) {
|
|
2836
|
+
var _a;
|
|
2923
2837
|
if (!flags.noUpdateEvent && changed) {
|
|
2924
2838
|
if (flags.fromSubmission) {
|
|
2925
2839
|
// Reset the errors when a submission has been made and allow it to revalidate.
|
|
2926
2840
|
this._errors = [];
|
|
2927
2841
|
}
|
|
2928
|
-
this.triggerChange(flags);
|
|
2842
|
+
(_a = this.triggerChange) === null || _a === void 0 ? void 0 : _a.call(this, flags);
|
|
2929
2843
|
return true;
|
|
2930
2844
|
}
|
|
2931
2845
|
return false;
|
|
@@ -2943,11 +2857,13 @@ class Component extends Element_1.default {
|
|
|
2943
2857
|
data,
|
|
2944
2858
|
row: row || this.data,
|
|
2945
2859
|
submission: ((_a = this.root) === null || _a === void 0 ? void 0 : _a._submission) || {
|
|
2946
|
-
data: this.rootValue
|
|
2947
|
-
}
|
|
2860
|
+
data: this.rootValue
|
|
2861
|
+
}
|
|
2948
2862
|
}, 'value');
|
|
2949
2863
|
}
|
|
2864
|
+
/* eslint-disable max-statements */
|
|
2950
2865
|
calculateComponentValue(data, flags, row) {
|
|
2866
|
+
var _a;
|
|
2951
2867
|
// Skip value calculation for the component if we don't have entire form data set or in builder mode
|
|
2952
2868
|
if (this.builderMode || lodash_1.default.isUndefined(lodash_1.default.get(this, 'root.data'))) {
|
|
2953
2869
|
return false;
|
|
@@ -2967,10 +2883,7 @@ class Component extends Element_1.default {
|
|
|
2967
2883
|
!(this.component.calculateValue || this.component.calculateValueVariable) ||
|
|
2968
2884
|
(this.options.server && !this.component.calculateServer) ||
|
|
2969
2885
|
(flags.dataSourceInitialLoading && allowOverride) ||
|
|
2970
|
-
(this.options.readOnly &&
|
|
2971
|
-
this.options.pdf &&
|
|
2972
|
-
allowOverride &&
|
|
2973
|
-
lodash_1.default.get(this.root, 'submission._id', false))) {
|
|
2886
|
+
(this.options.readOnly && this.options.pdf && allowOverride && lodash_1.default.get(this.root, 'submission._id', false))) {
|
|
2974
2887
|
return false;
|
|
2975
2888
|
}
|
|
2976
2889
|
const dataValue = this.dataValue;
|
|
@@ -2986,7 +2899,7 @@ class Component extends Element_1.default {
|
|
|
2986
2899
|
// Do not override calculations on server if they have calculateServer set.
|
|
2987
2900
|
if (allowOverride) {
|
|
2988
2901
|
// The value is considered locked if it is not empty and comes from a submission value.
|
|
2989
|
-
const fromSubmission = flags.fromSubmission && this.component.persistent === true;
|
|
2902
|
+
const fromSubmission = (flags.fromSubmission && this.component.persistent === true);
|
|
2990
2903
|
if (this.isEmpty(dataValue)) {
|
|
2991
2904
|
// Reset the calculation lock if ever the data is cleared.
|
|
2992
2905
|
this.calculationLocked = false;
|
|
@@ -2995,7 +2908,7 @@ class Component extends Element_1.default {
|
|
|
2995
2908
|
this.calculationLocked = true;
|
|
2996
2909
|
return false;
|
|
2997
2910
|
}
|
|
2998
|
-
const firstPass = this.calculatedValue === undefined || flags.resetValue;
|
|
2911
|
+
const firstPass = (this.calculatedValue === undefined) || flags.resetValue;
|
|
2999
2912
|
if (firstPass) {
|
|
3000
2913
|
this.calculatedValue = null;
|
|
3001
2914
|
}
|
|
@@ -3028,7 +2941,7 @@ class Component extends Element_1.default {
|
|
|
3028
2941
|
}
|
|
3029
2942
|
this.calculatedValue = (0, utils_2.fastCloneDeep)(calculatedValue);
|
|
3030
2943
|
if (changed) {
|
|
3031
|
-
if (!flags.noPristineChangeOnModified && this.root.initialized) {
|
|
2944
|
+
if (!flags.noPristineChangeOnModified && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.initialized)) {
|
|
3032
2945
|
this.pristine = false;
|
|
3033
2946
|
}
|
|
3034
2947
|
flags.triggeredComponentId = this.id;
|
|
@@ -3036,6 +2949,7 @@ class Component extends Element_1.default {
|
|
|
3036
2949
|
}
|
|
3037
2950
|
return false;
|
|
3038
2951
|
}
|
|
2952
|
+
/* eslint-enable max-statements */
|
|
3039
2953
|
/**
|
|
3040
2954
|
* Performs calculations in this component plus any child components.
|
|
3041
2955
|
* @param {*} data - The data to perform the calculation with.
|
|
@@ -3111,8 +3025,8 @@ class Component extends Element_1.default {
|
|
|
3111
3025
|
scope: validationScope,
|
|
3112
3026
|
instance: this,
|
|
3113
3027
|
processors: [
|
|
3114
|
-
process_1.validateProcessInfo
|
|
3115
|
-
]
|
|
3028
|
+
process_1.validateProcessInfo
|
|
3029
|
+
]
|
|
3116
3030
|
});
|
|
3117
3031
|
const errors = validationScope.errors;
|
|
3118
3032
|
const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
@@ -3131,10 +3045,8 @@ class Component extends Element_1.default {
|
|
|
3131
3045
|
if (silentCheck) {
|
|
3132
3046
|
return [];
|
|
3133
3047
|
}
|
|
3134
|
-
const messages = errors.filter(
|
|
3135
|
-
if (errors.length &&
|
|
3136
|
-
!!messages.length &&
|
|
3137
|
-
(!this.isEmpty(this.defaultValue) || dirty || !this.pristine)) {
|
|
3048
|
+
const messages = errors.filter(message => !message.fromServer);
|
|
3049
|
+
if (errors.length && !!messages.length && (!this.isEmpty(this.defaultValue) || dirty || !this.pristine)) {
|
|
3138
3050
|
return this.setCustomValidity(messages, dirty);
|
|
3139
3051
|
}
|
|
3140
3052
|
else {
|
|
@@ -3149,12 +3061,7 @@ class Component extends Element_1.default {
|
|
|
3149
3061
|
interpolateErrors(errors) {
|
|
3150
3062
|
var _a;
|
|
3151
3063
|
const interpolatedErrors = utils_1.default.interpolateErrors(this.component, errors, this.t.bind(this));
|
|
3152
|
-
return ((_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.length)
|
|
3153
|
-
? [
|
|
3154
|
-
...interpolatedErrors,
|
|
3155
|
-
...this.serverErrors,
|
|
3156
|
-
]
|
|
3157
|
-
: interpolatedErrors;
|
|
3064
|
+
return ((_a = this.serverErrors) === null || _a === void 0 ? void 0 : _a.length) ? [...interpolatedErrors, ...this.serverErrors] : interpolatedErrors;
|
|
3158
3065
|
}
|
|
3159
3066
|
/**
|
|
3160
3067
|
* Show component validation errors.
|
|
@@ -3168,7 +3075,7 @@ class Component extends Element_1.default {
|
|
|
3168
3075
|
if (flags.silentCheck) {
|
|
3169
3076
|
return [];
|
|
3170
3077
|
}
|
|
3171
|
-
let isDirty = flags.dirty === false ? false : this.dirty || flags.dirty;
|
|
3078
|
+
let isDirty = (flags.dirty === false) ? false : (this.dirty || flags.dirty);
|
|
3172
3079
|
if (this.options.alwaysDirty) {
|
|
3173
3080
|
isDirty = true;
|
|
3174
3081
|
}
|
|
@@ -3203,8 +3110,8 @@ class Component extends Element_1.default {
|
|
|
3203
3110
|
form: this.root ? this.root._form : {},
|
|
3204
3111
|
scope: { errors: [] },
|
|
3205
3112
|
processors: [
|
|
3206
|
-
process_1.validateProcessInfo
|
|
3207
|
-
]
|
|
3113
|
+
process_1.validateProcessInfo
|
|
3114
|
+
]
|
|
3208
3115
|
};
|
|
3209
3116
|
if (async) {
|
|
3210
3117
|
return (0, process_1.processOne)(processContext).then(() => {
|
|
@@ -3226,7 +3133,7 @@ class Component extends Element_1.default {
|
|
|
3226
3133
|
* @returns {boolean} - TRUE if the component is valid.
|
|
3227
3134
|
*/
|
|
3228
3135
|
checkComponentValidity(data = null, dirty = false, row = null, flags = {}, allErrors = []) {
|
|
3229
|
-
data = this.rootValue;
|
|
3136
|
+
data = data || this.rootValue;
|
|
3230
3137
|
row = row || this.data;
|
|
3231
3138
|
flags.dirty = dirty || false;
|
|
3232
3139
|
if (flags.async) {
|
|
@@ -3313,15 +3220,13 @@ class Component extends Element_1.default {
|
|
|
3313
3220
|
this.checkingData = false;
|
|
3314
3221
|
}
|
|
3315
3222
|
checkModal(errors = [], dirty = false) {
|
|
3316
|
-
const messages = errors.filter(
|
|
3223
|
+
const messages = errors.filter(error => !error.fromServer);
|
|
3317
3224
|
const isValid = errors.length === 0;
|
|
3318
3225
|
if (!this.component.modalEdit || !this.componentModal) {
|
|
3319
3226
|
return;
|
|
3320
3227
|
}
|
|
3321
3228
|
if (dirty && !isValid) {
|
|
3322
|
-
this.setErrorClasses([
|
|
3323
|
-
this.refs.openModal,
|
|
3324
|
-
], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3229
|
+
this.setErrorClasses([this.refs.openModal], dirty, !isValid, !!messages.length, this.refs.openModalWrapper);
|
|
3325
3230
|
}
|
|
3326
3231
|
else {
|
|
3327
3232
|
this.clearErrorClasses(this.refs.openModalWrapper);
|
|
@@ -3331,7 +3236,7 @@ class Component extends Element_1.default {
|
|
|
3331
3236
|
return this.dataValue;
|
|
3332
3237
|
}
|
|
3333
3238
|
isEmpty(value = this.dataValue) {
|
|
3334
|
-
const isEmptyArray = lodash_1.default.isArray(value) && value.length === 1 ? lodash_1.default.isEqual(value[0], this.emptyValue) : false;
|
|
3239
|
+
const isEmptyArray = (lodash_1.default.isArray(value) && value.length === 1) ? lodash_1.default.isEqual(value[0], this.emptyValue) : false;
|
|
3335
3240
|
return value == null || value.length === 0 || lodash_1.default.isEqual(value, this.emptyValue) || isEmptyArray;
|
|
3336
3241
|
}
|
|
3337
3242
|
isEqual(valueA, valueB = this.dataValue) {
|
|
@@ -3362,7 +3267,7 @@ class Component extends Element_1.default {
|
|
|
3362
3267
|
}
|
|
3363
3268
|
addFocusBlurEvents(element) {
|
|
3364
3269
|
this.addEventListener(element, 'focus', () => {
|
|
3365
|
-
if (this.root.focusedComponent !== this) {
|
|
3270
|
+
if (this.root && this.root.focusedComponent !== this) {
|
|
3366
3271
|
if (this.root.pendingBlur) {
|
|
3367
3272
|
this.root.pendingBlur();
|
|
3368
3273
|
}
|
|
@@ -3376,13 +3281,14 @@ class Component extends Element_1.default {
|
|
|
3376
3281
|
});
|
|
3377
3282
|
this.addEventListener(element, 'blur', () => {
|
|
3378
3283
|
this.root.pendingBlur = utils_1.default.delay(() => {
|
|
3284
|
+
var _a, _b;
|
|
3379
3285
|
this.emit('blur', this);
|
|
3380
3286
|
if (this.component.validateOn === 'blur') {
|
|
3381
|
-
this.root.triggerChange({ fromBlur: true }, {
|
|
3287
|
+
(_b = (_a = this.root).triggerChange) === null || _b === void 0 ? void 0 : _b.call(_a, { fromBlur: true }, {
|
|
3382
3288
|
instance: this,
|
|
3383
3289
|
component: this.component,
|
|
3384
3290
|
value: this.dataValue,
|
|
3385
|
-
flags: { fromBlur: true }
|
|
3291
|
+
flags: { fromBlur: true }
|
|
3386
3292
|
});
|
|
3387
3293
|
}
|
|
3388
3294
|
this.root.focusedComponent = null;
|
|
@@ -3390,6 +3296,7 @@ class Component extends Element_1.default {
|
|
|
3390
3296
|
});
|
|
3391
3297
|
});
|
|
3392
3298
|
}
|
|
3299
|
+
// eslint-disable-next-line max-statements
|
|
3393
3300
|
setCustomValidity(messages, dirty, external) {
|
|
3394
3301
|
const inputRefs = this.isInputComponent ? this.refs.input || [] : null;
|
|
3395
3302
|
if (typeof messages === 'string' && messages) {
|
|
@@ -3401,15 +3308,13 @@ class Component extends Element_1.default {
|
|
|
3401
3308
|
}
|
|
3402
3309
|
if (!Array.isArray(messages)) {
|
|
3403
3310
|
if (messages) {
|
|
3404
|
-
messages = [
|
|
3405
|
-
messages,
|
|
3406
|
-
];
|
|
3311
|
+
messages = [messages];
|
|
3407
3312
|
}
|
|
3408
3313
|
else {
|
|
3409
3314
|
messages = [];
|
|
3410
3315
|
}
|
|
3411
3316
|
}
|
|
3412
|
-
const errors = messages.filter(
|
|
3317
|
+
const errors = messages.filter(message => message.level === 'error');
|
|
3413
3318
|
let invalidInputRefs = inputRefs;
|
|
3414
3319
|
// Filter the invalid input refs in multiple components
|
|
3415
3320
|
if (this.component.multiple) {
|
|
@@ -3442,7 +3347,7 @@ class Component extends Element_1.default {
|
|
|
3442
3347
|
this.setErrorClasses(invalidInputRefs, dirty, !!errors.length, !!messages.length);
|
|
3443
3348
|
}
|
|
3444
3349
|
}
|
|
3445
|
-
else if (!errors.length || errors[0].external === !!external) {
|
|
3350
|
+
else if (!errors.length || (errors[0].external === !!external)) {
|
|
3446
3351
|
if (this.refs.messageContainer) {
|
|
3447
3352
|
this.empty(this.refs.messageContainer);
|
|
3448
3353
|
}
|
|
@@ -3463,7 +3368,8 @@ class Component extends Element_1.default {
|
|
|
3463
3368
|
* @returns {boolean|*} - TRUE if the value is hidden.
|
|
3464
3369
|
*/
|
|
3465
3370
|
isValueHidden() {
|
|
3466
|
-
|
|
3371
|
+
var _a;
|
|
3372
|
+
if (this.component.protected && ((_a = this.root) === null || _a === void 0 ? void 0 : _a.editing)) {
|
|
3467
3373
|
return false;
|
|
3468
3374
|
}
|
|
3469
3375
|
if (!this.root || !this.root.hasOwnProperty('editing')) {
|
|
@@ -3472,9 +3378,7 @@ class Component extends Element_1.default {
|
|
|
3472
3378
|
if (!this.root || !this.root.editing) {
|
|
3473
3379
|
return false;
|
|
3474
3380
|
}
|
|
3475
|
-
return (this.component.protected ||
|
|
3476
|
-
!this.component.persistent ||
|
|
3477
|
-
this.component.persistent === 'client-only');
|
|
3381
|
+
return (this.component.protected || !this.component.persistent || (this.component.persistent === 'client-only'));
|
|
3478
3382
|
}
|
|
3479
3383
|
shouldSkipValidation(data, row, flags = {}) {
|
|
3480
3384
|
const rules = [
|
|
@@ -3488,16 +3392,15 @@ class Component extends Element_1.default {
|
|
|
3488
3392
|
() => this.isValueHidden(),
|
|
3489
3393
|
// Force valid if component is hidden.
|
|
3490
3394
|
() => {
|
|
3491
|
-
if (!this.component.validateWhenHidden &&
|
|
3492
|
-
(!this.visible || !this.checkCondition(row, data))) {
|
|
3395
|
+
if (!this.component.validateWhenHidden && (!this.visible || !this.checkCondition(row, data))) {
|
|
3493
3396
|
// If this component is forced valid when it is hidden, then we also need to reset the errors for this component.
|
|
3494
3397
|
this._errors = [];
|
|
3495
3398
|
return true;
|
|
3496
3399
|
}
|
|
3497
3400
|
return false;
|
|
3498
|
-
}
|
|
3401
|
+
}
|
|
3499
3402
|
];
|
|
3500
|
-
return rules.some(
|
|
3403
|
+
return rules.some(pred => pred());
|
|
3501
3404
|
}
|
|
3502
3405
|
// Maintain reverse compatibility.
|
|
3503
3406
|
whenReady() {
|
|
@@ -3514,13 +3417,7 @@ class Component extends Element_1.default {
|
|
|
3514
3417
|
*/
|
|
3515
3418
|
asString(value) {
|
|
3516
3419
|
value = value || this.getValue();
|
|
3517
|
-
return (Array.isArray(value)
|
|
3518
|
-
? value
|
|
3519
|
-
: [
|
|
3520
|
-
value,
|
|
3521
|
-
])
|
|
3522
|
-
.map(lodash_1.default.toString)
|
|
3523
|
-
.join(', ');
|
|
3420
|
+
return (Array.isArray(value) ? value : [value]).map(lodash_1.default.toString).join(', ');
|
|
3524
3421
|
}
|
|
3525
3422
|
/**
|
|
3526
3423
|
* Return if the component is disabled.
|
|
@@ -3549,13 +3446,13 @@ class Component extends Element_1.default {
|
|
|
3549
3446
|
}
|
|
3550
3447
|
}
|
|
3551
3448
|
setLoading(element, loading) {
|
|
3552
|
-
if (!element || element.loading === loading) {
|
|
3449
|
+
if (!element || (element.loading === loading)) {
|
|
3553
3450
|
return;
|
|
3554
3451
|
}
|
|
3555
3452
|
element.loading = loading;
|
|
3556
3453
|
if (!element.loader && loading) {
|
|
3557
3454
|
element.loader = this.ce('i', {
|
|
3558
|
-
class: `${this.iconClass('refresh', true)} button-icon-right
|
|
3455
|
+
class: `${this.iconClass('refresh', true)} button-icon-right`
|
|
3559
3456
|
});
|
|
3560
3457
|
}
|
|
3561
3458
|
if (element.loader) {
|
|
@@ -3570,9 +3467,9 @@ class Component extends Element_1.default {
|
|
|
3570
3467
|
selectOptions(select, tag, options, defaultValue) {
|
|
3571
3468
|
lodash_1.default.each(options, (option) => {
|
|
3572
3469
|
const attrs = {
|
|
3573
|
-
value: option.value
|
|
3470
|
+
value: option.value
|
|
3574
3471
|
};
|
|
3575
|
-
if (defaultValue !== undefined && option.value === defaultValue) {
|
|
3472
|
+
if (defaultValue !== undefined && (option.value === defaultValue)) {
|
|
3576
3473
|
attrs.selected = 'selected';
|
|
3577
3474
|
}
|
|
3578
3475
|
const optionElement = this.ce('option', attrs);
|
|
@@ -3599,7 +3496,8 @@ class Component extends Element_1.default {
|
|
|
3599
3496
|
}
|
|
3600
3497
|
getRelativePath(path) {
|
|
3601
3498
|
const keyPart = `.${this.key}`;
|
|
3602
|
-
const thisPath = this.isInputComponent ? this.path
|
|
3499
|
+
const thisPath = this.isInputComponent ? this.path
|
|
3500
|
+
: this.path.slice(0).replace(keyPart, '');
|
|
3603
3501
|
return path.replace(thisPath, '');
|
|
3604
3502
|
}
|
|
3605
3503
|
clear() {
|
|
@@ -3616,7 +3514,7 @@ class Component extends Element_1.default {
|
|
|
3616
3514
|
this.removeChildFrom(element, this.element);
|
|
3617
3515
|
}
|
|
3618
3516
|
detachLogic() {
|
|
3619
|
-
this.logic.forEach(
|
|
3517
|
+
this.logic.forEach(logic => {
|
|
3620
3518
|
if (logic.trigger.type === 'event') {
|
|
3621
3519
|
const event = this.interpolate(logic.trigger.event);
|
|
3622
3520
|
this.off(event); // only applies to callbacks on this component
|
|
@@ -3637,16 +3535,10 @@ class Component extends Element_1.default {
|
|
|
3637
3535
|
// If component definition changed, replace it.
|
|
3638
3536
|
if (!lodash_1.default.isEqual(this.component, newComponent)) {
|
|
3639
3537
|
this.component = newComponent;
|
|
3640
|
-
const visible = this.hasCondition()
|
|
3641
|
-
? !this.conditionallyHidden()
|
|
3642
|
-
: !this.component.hidden;
|
|
3538
|
+
const visible = this.hasCondition() ? !this.conditionallyHidden() : !this.component.hidden;
|
|
3643
3539
|
const disabled = this.shouldDisabled;
|
|
3644
3540
|
// Change states which won't be recalculated during redrawing
|
|
3645
3541
|
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;
|
|
3650
3542
|
this.visible = visible;
|
|
3651
3543
|
}
|
|
3652
3544
|
if (this.disabled !== disabled) {
|
|
@@ -3668,7 +3560,7 @@ class Component extends Element_1.default {
|
|
|
3668
3560
|
name: this.options.name,
|
|
3669
3561
|
type: this.component.inputType || 'text',
|
|
3670
3562
|
class: 'form-control',
|
|
3671
|
-
lang: this.options.language
|
|
3563
|
+
lang: this.options.language
|
|
3672
3564
|
};
|
|
3673
3565
|
if (this.component.placeholder) {
|
|
3674
3566
|
attributes.placeholder = this.t(this.component.placeholder, { _userInput: true });
|
|
@@ -3684,7 +3576,7 @@ class Component extends Element_1.default {
|
|
|
3684
3576
|
type: 'input',
|
|
3685
3577
|
component: this.component,
|
|
3686
3578
|
changeEvent: 'change',
|
|
3687
|
-
attr: attributes
|
|
3579
|
+
attr: attributes
|
|
3688
3580
|
};
|
|
3689
3581
|
}
|
|
3690
3582
|
autofocus() {
|
|
@@ -3774,18 +3666,14 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3774
3666
|
Component.externalLibraries[name].resolve(plugin);
|
|
3775
3667
|
}
|
|
3776
3668
|
else {
|
|
3777
|
-
src = Array.isArray(src)
|
|
3778
|
-
? src
|
|
3779
|
-
: [
|
|
3780
|
-
src,
|
|
3781
|
-
];
|
|
3669
|
+
src = Array.isArray(src) ? src : [src];
|
|
3782
3670
|
src.forEach((lib) => {
|
|
3783
3671
|
let attrs = {};
|
|
3784
3672
|
let elementType = '';
|
|
3785
3673
|
if (typeof lib === 'string') {
|
|
3786
3674
|
lib = {
|
|
3787
3675
|
type: 'script',
|
|
3788
|
-
src: lib
|
|
3676
|
+
src: lib
|
|
3789
3677
|
};
|
|
3790
3678
|
}
|
|
3791
3679
|
switch (lib.type) {
|
|
@@ -3795,14 +3683,14 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3795
3683
|
src: lib.src,
|
|
3796
3684
|
type: 'text/javascript',
|
|
3797
3685
|
defer: true,
|
|
3798
|
-
async: true
|
|
3686
|
+
async: true
|
|
3799
3687
|
};
|
|
3800
3688
|
break;
|
|
3801
3689
|
case 'styles':
|
|
3802
3690
|
elementType = 'link';
|
|
3803
3691
|
attrs = {
|
|
3804
3692
|
href: lib.src,
|
|
3805
|
-
rel: 'stylesheet'
|
|
3693
|
+
rel: 'stylesheet'
|
|
3806
3694
|
};
|
|
3807
3695
|
break;
|
|
3808
3696
|
}
|
|
@@ -3831,7 +3719,8 @@ Component.requireLibrary = function (name, property, src, polling) {
|
|
|
3831
3719
|
return Component.externalLibraries[name].ready;
|
|
3832
3720
|
};
|
|
3833
3721
|
Component.libraryReady = function (name) {
|
|
3834
|
-
if (Component.externalLibraries.hasOwnProperty(name) &&
|
|
3722
|
+
if (Component.externalLibraries.hasOwnProperty(name) &&
|
|
3723
|
+
Component.externalLibraries[name].ready) {
|
|
3835
3724
|
return Component.externalLibraries[name].ready;
|
|
3836
3725
|
}
|
|
3837
3726
|
return Promise.reject(`${name} library was not required.`);
|