Files
Aether/frontend/src/components/ui/select-search-context.ts
T
fawney19andAoaoMH 46bab1b97f feat: 为下拉选择组件添加搜索过滤功能,支持拼音匹配
- 新增 search.ts 搜索工具,支持中文拼音(全拼/首字母)模糊匹配
- 新增 select-search-context.ts,通过 provide/inject 为 radix-vue Select 组件注入搜索能力
- MultiSelect、ModelMultiSelect 组件集成搜索框,选项超过阈值时自动显示
- select-content/select-item 组件支持搜索过滤与空状态提示
- StandaloneKeyFormDialog、UserFormDialog 中手写下拉框替换为复用 MultiSelect 组件
- 引入 pinyin-pro 依赖,按需懒加载

Closes #210

Co-authored-by: AoaoMH <kidxb@vip.qq.com>
2026-03-09 19:53:54 +08:00

18 lines
508 B
TypeScript

import type { InjectionKey, Ref } from 'vue'
export interface RegisteredSelectItem {
value: string
text: string
}
export interface SelectSearchContext {
searchQuery: Ref<string>
hiddenValues: Ref<Set<string>>
registerItem: (id: string, item: RegisteredSelectItem) => void
updateItem: (id: string, item: Partial<RegisteredSelectItem>) => void
unregisterItem: (id: string) => void
}
export const SELECT_SEARCH_CONTEXT_KEY: InjectionKey<SelectSearchContext> =
Symbol('select-search-context')