import * as React from 'react'; import { Component } from 'react'; import { ICreateStateByPropsParams } from './utils/createStateByProps'; import { ITreeData, TreeRootIdArray, ITreeRootInfoMap, ITreeRenderKey } from './utils/common'; export interface ITreeOperation { name: string; icon?: string | React.ReactNode; action: (data: ITreeData) => void; shouldRender?: (data: ITreeData) => boolean; } export interface ITreeOncheckHelpInfo { currentRoot: ITreeData; disabled: ITreeData[]; all: ITreeData[]; top: ITreeData[]; bottom: ITreeData[]; } export interface ITreeProps extends ICreateStateByPropsParams { render?: (data: ITreeData, isExpanded?: boolean) => React.ReactNode; operations?: ITreeOperation[]; foldable?: boolean; onCheck?: (selected: TreeRootIdArray, info: ITreeOncheckHelpInfo) => void; size?: 'medium' | 'small' | 'large'; commonStyle?: React.CSSProperties; onExpand?: (data: ITreeData, config: { isExpanded: boolean; }) => void; autoExpandOnSelect?: boolean; onSelect?: (data: ITreeData, target: HTMLSpanElement) => void; } export interface ITreeState { prevProps: ITreeProps; tree: ITreeData[]; rootInfoMap: ITreeRootInfoMap; expandNode: TreeRootIdArray; checkedNode: TreeRootIdArray; disabledNode: TreeRootIdArray; renderKey: ITreeRenderKey; loadingNode: TreeRootIdArray; } export declare class Tree extends Component { static defaultProps: { autoExpandOnSelect: boolean; dataType: string; foldable: boolean; checkable: boolean; size: string; }; constructor(props: ITreeProps); static getDerivedStateFromProps(nextProps: ITreeProps, state: ITreeState): { prevProps: ITreeProps; tree?: ITreeData[]; rootInfoMap?: ITreeRootInfoMap; expandNode?: TreeRootIdArray; checkedNode?: TreeRootIdArray; disabledNode?: TreeRootIdArray; renderKey?: ITreeRenderKey; loadingNode?: TreeRootIdArray; }; handleExpandClick(root: ITreeData, e: React.MouseEvent): void; handleExpand(root: ITreeData, isSwitcher: boolean): void; handleCheckboxClick(root: ITreeData): void; renderSwitcher(root: ITreeData): JSX.Element; renderContent(root: ITreeData, isExpanded: boolean): JSX.Element; renderCheckbox(root: ITreeData): JSX.Element; renderOperations(root: ITreeData, isExpanded: boolean): JSX.Element; renderTreeNodes(roots: ITreeData[]): JSX.Element[]; render(): JSX.Element; } export default Tree;