perf: add 'use-glob' prop to search input
This commit is contained in:
parent
84b42e6461
commit
2f25b524cd
|
@ -18,6 +18,10 @@ const props = defineProps({
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
useGlob: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['filterChanged', 'matchChanged'])
|
const emit = defineEmits(['filterChanged', 'matchChanged'])
|
||||||
|
@ -82,7 +86,6 @@ defineExpose({
|
||||||
<template>
|
<template>
|
||||||
<n-input-group>
|
<n-input-group>
|
||||||
<slot name="prepend" />
|
<slot name="prepend" />
|
||||||
|
|
||||||
<n-input
|
<n-input
|
||||||
v-model:value="inputData.filter"
|
v-model:value="inputData.filter"
|
||||||
:placeholder="$t('interface.filter')"
|
:placeholder="$t('interface.filter')"
|
||||||
|
@ -99,18 +102,24 @@ defineExpose({
|
||||||
{{ inputData.match }}
|
{{ inputData.match }}
|
||||||
</n-tag>
|
</n-tag>
|
||||||
</template>
|
</template>
|
||||||
{{ $t('interface.full_search_result', { pattern: inputData.match }) }}
|
{{
|
||||||
|
$t('interface.full_search_result', {
|
||||||
|
pattern: props.useGlob ? inputData.match : '*' + inputData.match + '*',
|
||||||
|
})
|
||||||
|
}}
|
||||||
</n-tooltip>
|
</n-tooltip>
|
||||||
</template>
|
</template>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<n-tooltip trigger="hover">
|
<template v-if="props.useGlob">
|
||||||
<template #trigger>
|
<n-tooltip trigger="hover">
|
||||||
<n-icon :component="Help" />
|
<template #trigger>
|
||||||
</template>
|
<n-icon :component="Help" />
|
||||||
<div class="text-block" style="max-width: 600px">
|
</template>
|
||||||
{{ $t('dialogue.filter.filter_pattern_tip') }}
|
<div class="text-block" style="max-width: 600px">
|
||||||
</div>
|
{{ $t('dialogue.filter.filter_pattern_tip') }}
|
||||||
</n-tooltip>
|
</div>
|
||||||
|
</n-tooltip>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</n-input>
|
</n-input>
|
||||||
|
|
||||||
|
|
|
@ -217,6 +217,7 @@ onMounted(() => onReload())
|
||||||
:debounce-wait="1000"
|
:debounce-wait="1000"
|
||||||
:full-search-icon="Search"
|
:full-search-icon="Search"
|
||||||
small
|
small
|
||||||
|
use-glob
|
||||||
@filter-changed="onFilterInput"
|
@filter-changed="onFilterInput"
|
||||||
@match-changed="onMatchInput">
|
@match-changed="onMatchInput">
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
"unpin_edit": "Cancel Pin",
|
"unpin_edit": "Cancel Pin",
|
||||||
"search": "Search",
|
"search": "Search",
|
||||||
"full_search": "Full Search",
|
"full_search": "Full Search",
|
||||||
"full_search_result": "The content has been matched as '*{pattern}*'",
|
"full_search_result": "The content has been matched as '{pattern}'",
|
||||||
"filter_field": "Filter Field",
|
"filter_field": "Filter Field",
|
||||||
"filter_value": "Filter Value",
|
"filter_value": "Filter Value",
|
||||||
"length": "Length",
|
"length": "Length",
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
"unpin_edit": "取消固定",
|
"unpin_edit": "取消固定",
|
||||||
"search": "搜索",
|
"search": "搜索",
|
||||||
"full_search": "全文匹配",
|
"full_search": "全文匹配",
|
||||||
"full_search_result": "内容已匹配为 *{pattern}*",
|
"full_search_result": "内容已匹配为 {pattern}",
|
||||||
"filter_field": "筛选字段",
|
"filter_field": "筛选字段",
|
||||||
"filter_value": "筛选值",
|
"filter_value": "筛选值",
|
||||||
"length": "长度",
|
"length": "长度",
|
||||||
|
|
Loading…
Reference in New Issue