Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/components/src/select/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
disabled?: boolean;
onChange?: (value: T) => void;
onSearchChange?: (value: string) => void;
/**
* 搜索行为不采用默认的 filterOptions 进行筛选,由外部托管
*/
externalSearchBehavior?: boolean;
/**
* 当鼠标划过时触发回调
* @param value 鼠标划过的是第几个 option
Expand Down Expand Up @@ -290,13 +294,16 @@
description,
notMatchWarning,
onSearchChange,
externalSearchBehavior

Check failure on line 297 in packages/components/src/select/index.tsx

View workflow job for this annotation

GitHub Actions / build (macos-latest, 20.x)

Missing trailing comma
}: ISelectProps<T>) {
const [open, setOpen] = useState<boolean>(false);
const [searchInput, setSearchInput] = useState('');

const selectRef = React.useRef<HTMLDivElement | null>(null);
const overlayRef = React.useRef<HTMLDivElement | null>(null);

externalSearchBehavior = externalSearchBehavior ?? !!onSearchChange

Check failure on line 305 in packages/components/src/select/index.tsx

View workflow job for this annotation

GitHub Actions / build (macos-latest, 20.x)

Missing semicolon

const handleToggleOpen = useCallback(
(e: React.MouseEvent) => {
e.preventDefault();
Expand Down Expand Up @@ -526,7 +533,7 @@
{showWarning && <div className='kt-select-warning-text'>{notMatchWarning}</div>}

{open &&
!searchInput &&
!(externalSearchBehavior && searchInput) &&
(isDataOptions(filteredOptions) || isDataOptionGroups(filteredOptions) ? (
<SelectOptionsList
optionRenderer={optionRenderer}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ export const FileDialog = ({
searchPlaceholder={selectPath}
value={selectPath}
showSearch={showFilePathSearch}
externalSearchBehavior={true}
>
{directoryList.map((item, idx) => (
<Option value={item} key={`${idx} - ${item}`}>
Expand Down
Loading