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,10 +102,15 @@ 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>
|
||||||
|
<template v-if="props.useGlob">
|
||||||
<n-tooltip trigger="hover">
|
<n-tooltip trigger="hover">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
<n-icon :component="Help" />
|
<n-icon :component="Help" />
|
||||||
|
@ -112,6 +120,7 @@ defineExpose({
|
||||||
</div>
|
</div>
|
||||||
</n-tooltip>
|
</n-tooltip>
|
||||||
</template>
|
</template>
|
||||||
|
</template>
|
||||||
</n-input>
|
</n-input>
|
||||||
|
|
||||||
<icon-button
|
<icon-button
|
||||||
|
|
|
@ -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