import { ReactElement, ReactNode } from 'react'; import { DivProps, Id, SelectableProps } from '../../types'; import { OptionType, SelectionContextBaseProps } from '../selectionContext'; import { InputProps } from '../input'; import { TreeNode, TreeNodeProps } from './treeNode'; export interface NodeType extends Partial>, Omit, 'children'> { children?: NodeType[]; } export type SortPlacement = 'before' | 'after' | 'child'; export type SortInfo = { source: V; destination: V; placement: SortPlacement; }; export interface TreeSharedProps, V extends Id = Id> extends Omit, 'options'> { nodes?: N[]; /** 默认为`label` */ labelKey?: keyof N; searchTokenKey?: keyof N; showLine?: boolean; indent?: number; renderExpandIcon?(nodeValue: V, isExpand: boolean, expanded: V[]): ReactNode; /** 是否显示`checkbox`选择框,`multiple`为`true`时,默认为`true`,否则默认为`false` */ showCheckbox?: boolean; readOnly?: boolean; /** 为true时,点击标签也会展开节点,默认为`false`, 仅点击展开按钮才能展开节点 */ clickLabelToExpand?: boolean; defaultExpanded?: V[]; expanded?: V[]; onExpandedChange?(expanded: V[], nodeValue: V, isExpand: boolean): void; /** 是否可以拖拽排序,默认为`false` */ sortable?: boolean; /** 是否显示拖拽把手,默认为`true` */ showDragHandle?: boolean; onSort?(info: SortInfo): void; } export interface TreeBaseProps, V extends Id = Id> extends TreeSharedProps, Omit { searchable?: boolean; searchInputProps?: InputProps; defaultSearchValue?: string; searchValue?: string; onSearchChange?(searchValue: string): void; } export type TreeProps, V extends Id = Id> = TreeBaseProps & SelectableProps; type TreeContext = { expandedSet: Set; toggleExpanded(value: V): void; indent: number; renderExpandIcon?: TreeBaseProps['renderExpandIcon']; showCheckbox: boolean; readOnly?: boolean; disabled?: boolean; clickLabelToExpand?: boolean; }; declare const TreeContext: import("react").Context>; export declare function useTreeContext(): TreeContext; export declare const Tree: { , V extends Id = Id>(props: TreeProps): ReactElement; Node: typeof TreeNode; }; export {};