Skip to content

Commit 9ecabc3

Browse files
committed
fix: 修复原有 select 自动完成功能
1 parent b759ebe commit 9ecabc3

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

packages/components/src/select/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export interface ISelectProps<T = string> {
2727
disabled?: boolean;
2828
onChange?: (value: T) => void;
2929
onSearchChange?: (value: string) => void;
30+
/**
31+
* 搜索行为不采用默认的 filterOptions 进行筛选,由外部托管
32+
*/
33+
externalSearchBehavior?: boolean;
3034
/**
3135
* 当鼠标划过时触发回调
3236
* @param value 鼠标划过的是第几个 option
@@ -290,6 +294,7 @@ export function Select<T = string>({
290294
description,
291295
notMatchWarning,
292296
onSearchChange,
297+
externalSearchBehavior
293298
}: ISelectProps<T>) {
294299
const [open, setOpen] = useState<boolean>(false);
295300
const [searchInput, setSearchInput] = useState('');
@@ -526,7 +531,7 @@ export function Select<T = string>({
526531
{showWarning && <div className='kt-select-warning-text'>{notMatchWarning}</div>}
527532

528533
{open &&
529-
!searchInput &&
534+
!(externalSearchBehavior && searchInput) &&
530535
(isDataOptions(filteredOptions) || isDataOptionGroups(filteredOptions) ? (
531536
<SelectOptionsList
532537
optionRenderer={optionRenderer}

packages/file-tree-next/src/browser/dialog/file-dialog.view.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ export const FileDialog = ({
288288
searchPlaceholder={selectPath}
289289
value={selectPath}
290290
showSearch={showFilePathSearch}
291+
externalSearchBehavior={true}
291292
>
292293
{directoryList.map((item, idx) => (
293294
<Option value={item} key={`${idx} - ${item}`}>

0 commit comments

Comments
 (0)