Fix #14801 to allow search dataset list when add (#14841)

### What problem does this PR solve?

Fix #14801 to allow search dataset list when add, following on #14825

<img width="2172" height="857" alt="image"
src="https://github.com/user-attachments/assets/65ea7647-56f4-4c16-8437-121b834811f0"
/>


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Wang Qi
2026-05-12 19:36:23 +08:00
committed by GitHub
parent 3f41f8cfae
commit 76d5240fb5
3 changed files with 88 additions and 15 deletions

View File

@@ -188,6 +188,10 @@ interface MultiSelectProps
showSelectAll?: boolean;
popoverTestId?: string;
optionTestIdPrefix?: string;
searchValue?: string;
onSearchChange?: (value: string) => void;
isSearching?: boolean;
shouldFilter?: boolean;
}
export const MultiSelect = React.forwardRef<
@@ -209,6 +213,10 @@ export const MultiSelect = React.forwardRef<
showSelectAll = true,
popoverTestId,
optionTestIdPrefix,
searchValue,
onSearchChange,
isSearching = false,
shouldFilter,
...props
},
ref,
@@ -434,15 +442,19 @@ export const MultiSelect = React.forwardRef<
onEscapeKeyDown={() => setIsPopoverOpen(false)}
data-testid={popoverTestId}
>
<Command className="p-5 pb-8">
{options && options.length > 0 && (
<Command className="p-5 pb-8" shouldFilter={shouldFilter}>
{((options && options.length > 0) || onSearchChange) && (
<CommandInput
placeholder={t('common.search') + '...'}
onKeyDown={handleInputKeyDown}
value={searchValue}
onValueChange={onSearchChange}
/>
)}
<CommandList className="mt-2">
<CommandEmpty>No results found.</CommandEmpty>
<CommandEmpty>
{isSearching ? t('common.searching') : t('common.noDataFound')}
</CommandEmpty>
<CommandGroup>
{showSelectAll && options && options.length > 0 && (
<CommandItem