EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
Currency native select
Yurii41c888047f13
diff --git a/client/src/views/fields/currency.ts b/client/src/views/fields/currency.tsindex 93b702ce4a..e8c7f9bb8e 100644--- a/client/src/views/fields/currency.ts+++ b/client/src/views/fields/currency.ts@@ -33,6 +33,7 @@import FloatFieldView from 'views/fields/float';import Select from 'ui/select';import {BaseOptions, BaseParams, BaseViewSchema, FieldValidator} from 'views/fields/base';+import Utils from 'utils';/*** Parameters.@@ -132,7 +133,7 @@ class CurrencyFieldView<protected currencyList: string[]protected decimalPlaces: number- private $currency: JQuery+ private currencyElement: HTMLSelectElement | null = nullprotected data() {const currencyValue = this.model.get(this.currencyFieldName) ||@@ -309,15 +310,22 @@ class CurrencyFieldView<super.afterRender();if (this.mode === this.MODE_EDIT) {- this.$currency = this.$el.find(`[data-name="${this.currencyFieldName}"]`);+ this.currencyElement = this.element+ .querySelector<HTMLSelectElement>(`[data-name="${this.currencyFieldName}"]`);- if (this.$currency.length) {- this.$currency.on('change', () => {- this.model.set(this.currencyFieldName, this.$currency.val(), {ui: true});+ if (this.currencyElement) {+ this.currencyElement.addEventListener('change', () => {+ this.model.set(this.currencyFieldName, this.currencyElement?.value, {ui: true});});- Select.init(this.$currency);+ if (!Utils.isMobile()) {+ Select.init(this.currencyElement);+ } else {+ this.currencyElement.classList.add('native-select');+ }}+ } else {+ this.currencyElement = null;}}@@ -348,8 +356,8 @@ class CurrencyFieldView<const data = {} as Record<string, any>;- let currencyValue: any = this.$currency.length ?- this.$currency.val() :+ let currencyValue: any = this.currencyElement ?+ this.currencyElement.value :this.defaultCurrency;if (value === null) {diff --git a/frontend/less/espo/elements/form.less b/frontend/less/espo/elements/form.lessindex 8c9e84a8e8..de55b5938a 100644--- a/frontend/less/espo/elements/form.less+++ b/frontend/less/espo/elements/form.less@@ -79,6 +79,10 @@ input.form-control {margin-left: var(--minus-1px);}}++ > select.native-select {+ margin-left: var(--minus-1px);+ }}+ input.form-control {