[Teams] Autocomplete input component

This commit is contained in:
Matej Glasnák committed 2022-11-29 20:28:34 +01:00
1 parent da9d338175
commit e881020f86
1 file changed
+6 -3
@@ -7,7 +7,7 @@
@keydown.enter="optionSelected()"
/>
<div class="suggestion">
<div class="suggestion" v-if="suggestion">
<span class="hidden-part">{{ suggestion._suggestionHiddenPart }}</span>
<span>{{ suggestion._suggestionShownPart }}</span>
</div>
@@ -36,7 +36,7 @@ export default {
const normalizedSearch = this._normalize(this.search)
if (!normalizedSearch.length || !this.options.length)
return ''
return null
const filteredOptions = this.options.filter(option => {
const normalizedValue = this._normalize(option.value)
@@ -45,7 +45,7 @@ export default {
})
if (!filteredOptions[0])
return ''
return null
const suggestion = {
...filteredOptions[0],
@@ -60,6 +60,9 @@ export default {
methods: {
optionSelected() {
if (!this.suggestion)
return
this.$emit('option-selected', this.suggestion)
this.search = ''
},