Files
cherry-studio/src/renderer/src/components/CustomSelect.tsx
T
one c7a0b05841 refactor(Select): provide consistent search experience for antd Select (#7363)
- Add CustomSelect for enhanced searching
- Replace some Select components with CustomSelect
- Fix translation language searching problem
2025-06-19 19:23:25 +08:00

18 lines
519 B
TypeScript

import { includeKeywords } from '@renderer/utils/search'
import { Select, SelectProps } from 'antd'
/**
* 自定义 Select,使用增强的搜索 filter
*/
const CustomSelect = ({ ref, ...props }: SelectProps & { ref?: React.RefObject<any | null> }) => {
return <Select ref={ref} filterOption={enhancedFilterOption} {...props} />
}
CustomSelect.displayName = 'CustomSelect'
function enhancedFilterOption(input: string, option: any) {
return includeKeywords(option.label, input)
}
export default CustomSelect