Fix: Dataset parse logic (#12330)

### What problem does this PR solve?

Fix: Dataset  logic of parser

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
chanx
2025-12-30 19:53:00 +08:00
committed by GitHub
parent 2fccf3924d
commit a7e466142d
9 changed files with 126 additions and 76 deletions

View File

@ -109,6 +109,19 @@ export const SelectWithSearch = forwardRef<
}
}, [options, value]);
const showSearch = useMemo(() => {
if (Array.isArray(options) && options.length > 5) {
return true;
}
if (Array.isArray(options)) {
const optionsNum = options.reduce((acc, option) => {
return acc + (option?.options?.length || 0);
}, 0);
return optionsNum > 5;
}
return false;
}, [options]);
const handleSelect = useCallback(
(val: string) => {
setValue(val);
@ -179,7 +192,7 @@ export const SelectWithSearch = forwardRef<
align="start"
>
<Command className="p-5">
{options && options.length > 5 && (
{showSearch && (
<CommandInput
placeholder={t('common.search') + '...'}
className=" placeholder:text-text-disabled"