1
0

feat(filter): add actual label search when autocompleting

This commit is contained in:
kolaente
2024-03-06 18:33:31 +01:00
parent 9ade917ac4
commit 8fa2f6686a
2 changed files with 27 additions and 33 deletions

View File

@ -27,30 +27,6 @@ watch(
const emit = defineEmits(['blur'])
const placeholderText = computed(() => {
const value = (model.value || '').replace(/[\n\r\t]/gi, ' ')
if (state.value === 'unfocused') {
return value ? '' : props.suggestion
}
if (!value || !value.trim()) {
return props.suggestion
}
return lookahead()
})
const spacerText = computed(() => {
const value = (model.value || '').replace(/[\n\r\t]/gi, ' ')
if (!value || !value.trim()) {
return props.suggestion
}
return value
})
const props = withDefaults(defineProps<{
options: any[],
suggestion?: string,
@ -161,14 +137,10 @@ function onUpdateField(e) {
<div class="entry-box">
<slot
name="input"
:spacerText
:placeholderText
:onUpdateField
:onFocusField
:onKeydown
>
<div class="spacer">{{ spacerText }}</div>
<div class="placeholder">{{ placeholderText }}</div>
<textarea class="field"
@input="onUpdateField"
@focus="onFocusField"