Match-id-e266428ff041c68ffd2851a12262c612f5a354c3

This commit is contained in:
* 2022-04-07 11:56:48 +08:00 committed by *
parent baf13b7c59
commit cc11ffd17f
1 changed files with 13 additions and 7 deletions

View File

@ -12,30 +12,36 @@ export interface IData {
userKey: string;
}
type IItem = {
interface IItem {
hasChild: boolean,
onCollapse: (id: string) => void,
onClick: (id: string) => void,
isCollapsed: boolean,
isSelect: boolean,
highlightValue: string,
} & IData
data: IData,
}
const indentationLength = 20;
function Item(props: IItem) {
const {
name,
userKey,
hasChild,
onCollapse,
isCollapsed,
id,
indentation,
data,
onClick,
isSelect,
highlightValue = '',
} = props;
const {
name,
userKey,
id,
indentation,
} = data;
const isShowKey = userKey !== '';
const showIcon = hasChild ? <Triangle director={isCollapsed ? 'right' : 'down'} /> : '';
const handleClickCollapse = () => {
@ -163,7 +169,7 @@ function VTree({ data, highlightValue, selectedId, onRendered }: {
onCollapse={changeCollapseNode}
onClick={handleClickItem}
highlightValue={highlightValue}
{...item} />
data={item} />
);
}}
</VList>