mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: Do not display arrow icons on leaf node of folders #1826 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -13,6 +13,7 @@ export interface IFile {
|
||||
update_date: string;
|
||||
update_time: number;
|
||||
source_type: string;
|
||||
has_child_folder?: boolean;
|
||||
}
|
||||
|
||||
export interface IFolder {
|
||||
|
||||
@ -3,6 +3,7 @@ import { IFile } from '@/interfaces/database/file-manager';
|
||||
import type { GetProp, TreeSelectProps } from 'antd';
|
||||
import { TreeSelect } from 'antd';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
type DefaultOptionType = GetProp<TreeSelectProps, 'treeData'>[number];
|
||||
|
||||
@ -12,6 +13,7 @@ interface IProps {
|
||||
}
|
||||
|
||||
const AsyncTreeSelect = ({ value, onChange }: IProps) => {
|
||||
const { t } = useTranslation();
|
||||
const { fetchList } = useFetchPureFileList();
|
||||
const [treeData, setTreeData] = useState<Omit<DefaultOptionType, 'label'>[]>(
|
||||
[],
|
||||
@ -30,7 +32,10 @@ const AsyncTreeSelect = ({ value, onChange }: IProps) => {
|
||||
pId: x.parent_id,
|
||||
value: x.id,
|
||||
title: x.name,
|
||||
isLeaf: false,
|
||||
isLeaf:
|
||||
typeof x.has_child_folder === 'boolean'
|
||||
? !x.has_child_folder
|
||||
: false,
|
||||
})),
|
||||
);
|
||||
});
|
||||
@ -53,7 +58,7 @@ const AsyncTreeSelect = ({ value, onChange }: IProps) => {
|
||||
style={{ width: '100%' }}
|
||||
value={value}
|
||||
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
|
||||
placeholder="Please select"
|
||||
placeholder={t('fileManager.pleaseSelect')}
|
||||
onChange={handleChange}
|
||||
loadData={onLoadData}
|
||||
treeData={treeData}
|
||||
|
||||
Reference in New Issue
Block a user