import * as React from 'react'; import RcTree, { TreeNode as RcTreeNode, TreeProps as RcTreeProps, TreeNodeProps as RcTreeNodeProps } from 'rc-tree'; import { Key } from 'rc-tree/lib/interface'; import { ObjectInterface } from '../_utils/interfaces'; import './style/tree.css'; import { DraggableConfig, DraggableFn } from 'rc-tree/lib/Tree'; export interface TreeNodeAttribute { eventKey: string; prefixCls: string; className: string; expanded: boolean; selected: boolean; checked: boolean; halfChecked: boolean; children: React.ReactNode; title: React.ReactNode; pos: string; dragOver: boolean; dragOverGapTop: boolean; dragOverGapBottom: boolean; isLeaf: boolean; selectable: boolean; disabled: boolean; disableCheckbox: boolean; } export interface TreeNodeProps extends ObjectInterface { className?: string; checkable?: boolean; disabled?: boolean; disableCheckbox?: boolean; title?: string | React.ReactNode; key?: Key; eventKey?: string; isLeaf?: boolean; checked?: boolean; expanded?: boolean; loading?: boolean; selected?: boolean; selectable?: boolean; icon?: ((treeNode: TreeNodeAttribute) => React.ReactNode) | React.ReactNode; children?: React.ReactNode; } export declare type TreeNodeType = React.Component; export interface TreeProps extends Omit { showLine?: boolean; className?: string; /** 是否支持多选 */ multiple?: boolean; /** 是否自动展开父节点 */ autoExpandParent?: boolean; /** checkable状态下节点选择完全受控(父子节点选中状态不再关联) */ checkStrictly?: boolean; /** 是否支持选中 */ checkable?: boolean; /** 是否禁用树 */ disabled?: boolean; /** 默认展开所有树节点 */ defaultExpandAll?: boolean; /** 默认展开对应树节点 */ defaultExpandParent?: boolean; /** 默认展开指定的树节点 */ defaultExpandedKeys?: Key[]; /** (受控)展开指定的树节点 */ expandedKeys?: Key[]; /** (受控)选中复选框的树节点 */ checkedKeys?: Key[] | { checked: Key[]; halfChecked: Key[]; }; /** 默认选中复选框的树节点 */ defaultCheckedKeys?: Key[]; /** (受控)设置选中的树节点 */ selectedKeys?: Key[]; /** 默认选中的树节点 */ defaultTreeedKeys?: Key[]; selectable?: boolean; /** 点击树节点触发 */ filterDmcTreeNode?: (node: TreeNodeType) => boolean; loadedKeys?: Key[]; /** 设置节点可拖拽(IE>8) */ draggable?: DraggableFn | boolean | DraggableConfig; style?: React.CSSProperties; showIcon?: boolean; icon?: ((nodeProps: RcTreeNodeProps) => React.ReactNode) | React.ReactNode; switcherIcon?: React.ReactNode | ((nodeProps: TreeNodeProps) => React.ReactNode); prefixCls?: string; children?: React.ReactNode; blockNode?: boolean; virtual?: boolean; direction?: 'ltr' | 'rtl'; fullSelect?: boolean; type?: 'assist-bg'; withoutSelectEffect?: boolean; withoutHoverEffect?: boolean; emptyContent?: React.ReactNode; } export interface DmcTreeRef { treeComponent: RcTree | null; componentWrapper: HTMLDivElement | null; } interface CompoundedComponent extends React.ForwardRefExoticComponent> { TreeNode: typeof RcTreeNode; } declare const Tree: CompoundedComponent; declare const TreeMemo: React.MemoExoticComponent; export { TreeMemo, RcTreeNode as TreeNode }; export default Tree;