import React from 'react'; import { TreeProps, TreeState, LatestTreeNodeProps, TreeNodesStates, DisabledTreeNode, FlatTreeData, AnyObject, CheckKeysInfo, CheckedKeysObj, TreeData, FlatTreeKeysMap, TreeStore } from './iTree'; declare function noop(): void; declare class Tree extends React.Component { static defaultProps: { clsPrefix: string; blockNode: boolean; showLine: boolean; showIcon: boolean; selectable: boolean; multiple: boolean; checkable: boolean; checkStrictly: boolean; draggable: boolean; autoExpandParent: boolean; defaultExpandAll: boolean; defaultExpandedKeys: never[]; defaultCheckedKeys: never[]; defaultSelectedKeys: never[]; onExpand: typeof noop; onCheck: typeof noop; onSelect: typeof noop; onDragStart: typeof noop; onDragEnter: typeof noop; onDragOver: typeof noop; onDragLeave: typeof noop; onDrop: typeof noop; onDragEnd: typeof noop; tabIndexValue: number; lazyLoad: boolean; autoSelectWhenFocus: boolean; getScrollContainer: typeof noop; expandWhenDoubleClick: boolean; getCheckboxAttrs: typeof noop; fieldid: string; syncCheckedAndSelectedStatus: boolean; disabled: boolean; icon: null; inverse: boolean; fieldNames: { title: string; key: string; children: string; }; dragDelayExpandTime: number; }; contextmenuKeys: string[]; latestTreeNode: LatestTreeNodeProps; checkedKeysChange: boolean; selectKeyDomPos: string; autoExpandKeys: string[] | null; rowsInView: number; loadCount: number; flatTreeKeysMap: FlatTreeKeysMap; startIndex: number; endIndex: number; cacheTreeNodes: React.ReactElement[]; disabledTreeNodes: DisabledTreeNode[]; store: TreeStore; latestState: boolean | null; cachedLatestState: boolean | null; treeNodesStates: TreeNodesStates; lazyLoadAllChildren: React.ReactElement[]; lazyLoadTreeNodesStates: TreeNodesStates; checkedKeys: string[]; dragNodesKeys: string[]; treeNodesStatesKeysInfo: Partial; checkKeys: CheckKeysInfo | undefined; _checkedKeys: string[] | undefined; dropPosition: number | undefined; _rawExpandedKeys: string[] | undefined; hasCalculateRowHeight: boolean; tree: HTMLUListElement | null; dragNode: React.ReactElement; _dropTrigger: boolean; cacheExpandedKeys: Set | null; halfCheckedKeys: string[]; selectKeyDomExist: boolean; dataChange: boolean; timer: ReturnType | undefined; constructor(props: TreeProps); componentDidMount(): void; hasTreeNode: () => boolean; UNSAFE_componentWillMount(): void; UNSAFE_componentWillReceiveProps(nextProps: TreeProps): void; componentDidUpdate(): void; componentWillUnmount(): void; isRootNode: (node: React.ReactElement) => boolean; calculateRowHeight: () => void; onDragStart(e: React.DragEvent, treeNode: React.ReactElement): void; onDragEnterGap(e: React.DragEvent, treeNode: any): 1 | 0 | -1; onDragEnter(e: React.DragEvent, treeNode: React.ReactElement): void; onDragOver(e: React.DragEvent, treeNode: React.ReactElement): void; onDragLeave(e: React.DragEvent, treeNode: React.ReactElement): void; onDrop(e: React.DragEvent, treeNode: React.ReactElement): false | undefined; onDragEnd(e: React.DragEvent, treeNode: React.ReactElement): void; /** * * * @param {*} treeNode 当前操作的节点 * @param {*} keyType 键盘事件通用的key类型 left 为收起,right为展开 * @returns * @memberof Tree */ onExpand(treeNode: React.ReactElement, keyType?: string, e?: React.MouseEvent | React.KeyboardEvent): undefined | Promise; getCheckedKeys: (keys?: string[]) => string[]; onCheck: (treeNode: React.ReactElement, event?: React.MouseEvent | React.KeyboardEvent) => void; onSelect(treeNode: React.ReactElement, event: React.MouseEvent | React.KeyboardEvent): void; onDoubleClick(treeNode: React.ReactElement, e: React.MouseEvent | React.KeyboardEvent): void; onMouseEnter(e: React.MouseEvent, treeNode: React.ReactElement): void; onMouseLeave(e: React.MouseEvent, treeNode: React.ReactElement): void; onContextMenu(e: React.MouseEvent, treeNode: React.ReactElement): void; goDown(currentPos: string, currentIndex: string, e: React.KeyboardEvent, treeNode: React.ReactElement): void; goUp(currentPos: string, currentIndex: string, e: React.KeyboardEvent): void; onKeyDown: (e: React.KeyboardEvent, treeNode: React.ReactElement) => void; _setDataTransfer(e: React.KeyboardEvent): void; _focusDom: (selectKeyDomPos: string, targetDom: HTMLElement) => void; /** * 此方法为了解决树快捷键,当有的元素隐藏,按tab键也要显示的问题 * @param {*} e */ onUlFocus: (e: React.FocusEvent) => void; getFilterExpandedKeys(props: TreeProps, expandKeyProp: string, expandAll: boolean): string[]; getDefaultExpandedKeys(props: TreeProps, willReceiveProps?: boolean): string[] | undefined; getDefaultCheckedKeys(props: TreeProps, willReceiveProps?: boolean): string[] | CheckedKeysObj | undefined; getDefaultSelectedKeys(props: TreeProps, willReceiveProps?: boolean): string[] | undefined; getRawExpandedKeys(): void; getOpenTransitionName(): string | undefined; getDragNodes(treeNode: React.ReactElement): string[]; getExpandedKeys(treeNode: React.ReactElement, expand: boolean): string[] | undefined; filterTreeNode(treeNode: React.ReactElement): boolean; /** * 将截取后的 List 数组转换为 Tree 结构,并更新 state */ handleTreeListChange: (treeList: FlatTreeData[], startIndex?: number, endIndex?: number) => void; /** * 深度遍历 treeData,把Tree数据拍平,变为一维数组 * @param {*} treeData * @param {*} parentKey 标识父节点 * @param {*} isShown 该节点是否显示在页面中,当节点的父节点是展开状态 或 该节点是根节点时,该值为 true */ deepTraversal: (treeData?: TreeData[], parentKey?: string | null, isShown?: boolean) => FlatTreeData[]; /** * 根据 treeData 渲染树节点 * @param data 树形结构的数组 * @param preHeight 前置占位高度 * @param sufHeight 后置占位高度 */ renderTreefromData: (data: TreeData[]) => JSX.Element[]; /** * @description 计算懒加载时的前置占位和后置占位 * @param start {Number} 开始截取数据的位置 * @param end {Number} 结束截取数据的位置 * @return sumHeight {Number} 空白占位的高度 */ getSumHeight: (start: number, end: number) => number; renderTreeNode: (child: React.ReactElement, index: number, level?: number) => React.ReactElement> | null; render(): JSX.Element; } export default Tree;