|
|
@@ -28,6 +28,7 @@ interface ComboboxProps {
|
|
|
options: ComboboxOption[]
|
|
|
value?: string
|
|
|
onValueChange?: (value: string) => void
|
|
|
+ onSearchChange?: (search: string) => void
|
|
|
placeholder?: string
|
|
|
searchPlaceholder?: string
|
|
|
emptyMessage?: string
|
|
|
@@ -39,6 +40,7 @@ export function Combobox({
|
|
|
options,
|
|
|
value,
|
|
|
onValueChange,
|
|
|
+ onSearchChange,
|
|
|
placeholder = "请选择...",
|
|
|
searchPlaceholder = "搜索...",
|
|
|
emptyMessage = "未找到匹配项",
|
|
|
@@ -65,7 +67,10 @@ export function Combobox({
|
|
|
</PopoverTrigger>
|
|
|
<PopoverContent className="w-full p-0" align="start">
|
|
|
<Command>
|
|
|
- <CommandInput placeholder={searchPlaceholder} />
|
|
|
+ <CommandInput
|
|
|
+ placeholder={searchPlaceholder}
|
|
|
+ onValueChange={onSearchChange}
|
|
|
+ />
|
|
|
<CommandList>
|
|
|
<CommandEmpty>{emptyMessage}</CommandEmpty>
|
|
|
<CommandGroup>
|