fixed the automatic selection in the autocomplete

This commit is contained in:
Luca Haid
2026-02-02 14:11:01 +01:00
parent e970ec9101
commit 46034e53bb
2 changed files with 12 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ const RadiusUsers = {
<tt-smart-autocomplete <tt-smart-autocomplete
v-model="billAddrDisplay" v-model="billAddrDisplay"
:wide="true" :wide="true"
:initial-mode="searchMode"
placeholder="Kunde suchen" placeholder="Kunde suchen"
@select="onAddrSelect" @select="onAddrSelect"
@enter="loadRadiusUsers" @enter="loadRadiusUsers"

View File

@@ -21,6 +21,10 @@ const TtSmartAutocomplete = {
apiEndpoint: { apiEndpoint: {
type: String, type: String,
default: '' default: ''
},
initialMode: {
type: String,
default: 'autocomplete'
} }
}, },
emits: ['update:modelValue', 'select', 'change', 'enter', 'mode-change'], emits: ['update:modelValue', 'select', 'change', 'enter', 'mode-change'],
@@ -32,7 +36,7 @@ const TtSmartAutocomplete = {
const items = ref({}); const items = ref({});
const highlighted = ref(-1); const highlighted = ref(-1);
const busy = ref(false); const busy = ref(false);
const mode = ref('autocomplete'); const mode = ref(props.initialMode || 'autocomplete');
const logoDropdownOpen = ref(false); const logoDropdownOpen = ref(false);
const hasMoreResults = ref(false); const hasMoreResults = ref(false);
const mainInput = ref(null); const mainInput = ref(null);
@@ -60,6 +64,12 @@ const TtSmartAutocomplete = {
} }
}); });
watch(() => props.initialMode, (val) => {
if (val && val !== mode.value) {
mode.value = val;
}
});
const debounce = (fn, ms) => { const debounce = (fn, ms) => {
let timeout; let timeout;
return (...args) => { return (...args) => {