Skip to content

EspoCRM – Open Source CRM Application

Enum native on mobile

Yurii084f32932899
diff --git a/client/src/utils.ts b/client/src/utils.ts
index afb9d7c1da..1220b66944 100644
--- a/client/src/utils.ts
+++ b/client/src/utils.ts
@@ -31,7 +31,9 @@ import type ViewHelper from 'view-helper';
import type AclManager from 'acl-manager';
import type Model from 'model';
import type User from 'models/user';
-import _, {functions} from 'underscore';
+import _ from 'underscore';
+
+let isMobile;
export interface AccessDefs {
/**
@@ -756,13 +758,11 @@ const Utils = {
* @internal
*/
isMobile: function(): boolean {
- if (!('userAgentData' in navigator)) {
- return false;
- }
-
- const userAgentData = navigator.userAgentData as Record<string, any>;
+ // @ts-ignore
+ isMobile ??= navigator?.userAgentData?.mobile ??
+ /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
- return userAgentData.mobile ?? false;
+ return isMobile;
},
};
diff --git a/client/src/views/fields/base.ts b/client/src/views/fields/base.ts
index 08474be3b2..3041544520 100644
--- a/client/src/views/fields/base.ts
+++ b/client/src/views/fields/base.ts
@@ -34,6 +34,7 @@ import Model from 'model';
import Ui from 'ui';
import _ from 'underscore';
import JQuery from 'jquery'
+import Utils from 'utils';
const $ = JQuery;
@@ -864,10 +865,14 @@ export default class BaseFieldView<
}
if (this.isSearchMode()) {
- const $searchType = this.$el.find('select.search-type');
+ const searchTypeElement = this.element.querySelector<HTMLSelectElement>('select.search-type');
- if ($searchType.length) {
- Select.init($searchType, {matchAnyWord: true});
+ if (searchTypeElement) {
+ if (!Utils.isMobile()) {
+ Select.init(searchTypeElement, {matchAnyWord: true});
+ } else {
+ searchTypeElement.classList.add('native-select');
+ }
}
}
});
diff --git a/frontend/less/espo/elements/form.less b/frontend/less/espo/elements/form.less
index 871b5e02e7..8c9e84a8e8 100644
--- a/frontend/less/espo/elements/form.less
+++ b/frontend/less/espo/elements/form.less
@@ -592,6 +592,12 @@ input[type="radio"].form-radio {
}
select.form-control.native-select {
+ min-height: var(--input-height-base);
+
+ &.input-sm {
+ min-height: var(--input-height-small);
+ }
+
&, &::picker(select) {
appearance: base-select;
}