import fuzzy from 'fuzzy';
import React from 'react';
import { Event } from '@opensumi/ide-utils';
import { RenamePromptHandle } from './prompt';
import { NewPromptHandle } from './prompt/NewPromptHandle';
import { CompositeTreeNode, TreeNode } from './tree';
import { TreeModel } from './tree/model/TreeModel';
import { INodeRendererProps } from './TreeNodeRendererWrap';
export type IRecycleTreeAlign = 'smart' | 'start' | 'center' | 'end' | 'auto';
export interface IModelChange {
    preModel: TreeModel;
    nextModel: TreeModel;
}
export type IRecycleTreeOverflow = 'ellipsis' | 'auto';
export interface IRecycleTreeSize {
    width?: number;
    height: number;
}
export interface IRecycleTreeProps<T = TreeModel> {
    children(props: any): React.ReactNode;
    model: T;
    /**
     * 容器高度
     * height 计算出可视区域渲染数量
     * @type {number}
     * @memberof RecycleTreeProps
     */
    height: number;
    /**
     * 容器宽度
     * 不传默认按照 100% 宽度渲染
     * @type {number}
     * @memberof RecycleTreeProps
     */
    width?: number;
    /**
     * 节点高度
     * @type {number}
     * @memberof RecycleTreeProps
     */
    itemHeight: number;
    /**
     * Tree外部样式
     * @type {React.CSSProperties}
     * @memberof RecycleTreeProps
     */
    style?: React.CSSProperties;
    /**
     * Tree外部样式名
     * @type {string}
     * @memberof RecycleTreeProps
     */
    className?: string;
    /**
     * Tree初始化完成后会返回控制句柄
     * @memberof IRecycleTreeProps
     */
    onReady?: (handle: IRecycleTreeHandle) => void;
    /**
     * 筛选节点字段
     * 1. 路径匹配，如app/test
     * 2. 模糊匹配
     * @type {string}
     * @memberof IRecycleTreeProps
     */
    filter?: string;
    /**
     * 筛选器
     */
    filterProvider?: {
        fuzzyOptions: () => fuzzy.FilterOptions<any>;
        filterAlways?: boolean;
    };
    /**
     * 空白时的占位元素
     * @type {React.ReactNode}
     * @memberof IRecycleTreeProps
     */
    placeholder?: React.JSXElementConstructor<any>;
    /**
     * 声明文件树单行超出时的处理行为：
     * - ellipsis 展示省略号
     * - auto 撑开容器，可能会有横向滚动条
     * 默认为 ellipsis
     * @type {IRecycleTreeOverflow}
     * @memberof IRecycleTreeProps
     */
    overflow?: IRecycleTreeOverflow;
    /**
     * 声明Tree加载时预加载的节点内容
     * 主要用于避免快速滚动时出现空白区域的情况
     * 默认值为：Recycle.DEFAULT_OVER_SCAN_COUNT = 50
     * @type {number}
     * @memberof IRecycleTreeProps
     */
    overScanCount?: number;
    /**
     * 是否保留 Tree 底部空白，大小为 22 px
     * 默认值为：false
     */
    leaveBottomBlank?: boolean;
    /**
     * 指定如何获取 item key
     */
    getItemKey?: (node: INodeRendererProps) => string | number;
    /**
     * 支持根据内容动态调整高度
     * 最低不能少于 22 px
     * 默认值为: false
     *
     */
    supportDynamicHeights?: boolean;
}
export interface IRecycleTreeError {
    type: RenderErrorType;
    message: string;
}
export declare enum RenderErrorType {
    RENDER_ITEM = 0,
    GET_RENDED_KEY = 1,
    RENDER_ERROR = 2
}
export interface IRecycleTreeHandle {
    /**
     * 新建节点
     *
     * @param pathOrTreeNode 节点或者节点路径
     */
    promptNewTreeNode(pathOrTreeNode: string | CompositeTreeNode): Promise<NewPromptHandle>;
    /**
     * 新建可折叠节点
     *
     * @param pathOrTreeNode 节点或者节点路径
     */
    promptNewCompositeTreeNode(pathOrTreeNode: string | CompositeTreeNode): Promise<NewPromptHandle>;
    /**
     * 重命名节点
     *
     * @param pathOrTreeNode 节点或者节点路径
     */
    promptRename(pathOrTreeNode: string | TreeNode | CompositeTreeNode, defaultName?: string): Promise<RenamePromptHandle>;
    /**
     * 展开节点
     *
     * @param pathOrTreeNode 节点或者节点路径
     */
    expandNode(pathOrTreeNode: string | CompositeTreeNode): Promise<void>;
    /**
     * 折叠节点
     *
     * @param pathOrTreeNode 节点或者节点路径
     */
    collapseNode(pathOrTreeNode: string | CompositeTreeNode): Promise<void>;
    /**
     * 定位节点位置，滚动条将会滚动到对应可视区域，需要手动控制是否稳定后再进行节点定位
     *
     * @param pathOrTreeNode 节点或者节点路径
     * @param align IRecycleTreeAlign
     * @param untilStable 是否在节点稳定时再进行定位操作，部分Tree可能在定位过程中会有不断传入的变化，如文件树
     */
    ensureVisible(pathOrTreeNode: string | TreeNode | CompositeTreeNode, align?: IRecycleTreeAlign, untilStable?: boolean): Promise<TreeNode | undefined>;
    /**
     * 获取当前Tree的宽高信息
     *
     * @returns {IRecycleTreeSize}
     * @memberof IRecycleTreeHandle
     */
    getCurrentSize(): IRecycleTreeSize;
    /**
     * 获取当前TreeModel
     *
     * @param pathOrTreeNode 节点或者节点路径
     */
    getModel(): TreeModel;
    /**
     * TreeModel变更事件
     *
     * @param pathOrTreeNode 节点或者节点路径
     */
    onDidChangeModel: Event<IModelChange>;
    /**
     * Tree更新事件
     *
     * @param pathOrTreeNode 节点或者节点路径
     */
    onDidUpdate: Event<void>;
    /**
     * Tree更新事件, 仅触发一次
     *
     * @param pathOrTreeNode 节点或者节点路径
     */
    onOnceDidUpdate: Event<void>;
    /**
     * 监听渲染报错
     *
     * @param pathOrTreeNode 节点或者节点路径
     */
    onError: Event<IRecycleTreeError>;
    /**
     * 自适应每条 item 的布局（暂时只计算高度）
     */
    layoutItem: () => void;
}
export declare class RecycleTree extends React.Component<IRecycleTreeProps> {
    static PADDING_BOTTOM_SIZE: number;
    private static DEFAULT_ITEM_HEIGHT;
    private static TRY_ENSURE_VISIBLE_MAX_TIMES;
    private static FILTER_FUZZY_OPTIONS;
    private static DEFAULT_OVER_SCAN_COUNT;
    private _promptHandle;
    private idxToRendererPropsCache;
    private dynamicSizeMap;
    private listRef;
    private disposables;
    private onErrorEmitter;
    private onDidUpdateEmitter;
    private onDidModelChangeEmitter;
    private newPromptInsertionIndex;
    private promptTargetID;
    private tryEnsureVisibleTimes;
    private idToFilterRendererPropsCache;
    private filterFlattenBranch;
    private filterFlattenBranchChildrenCache;
    private filterWatcherDisposeCollection;
    private queueUpdatePromise;
    private updateCancelToken;
    private expandNodeCancelToken;
    private willUpdateTasks;
    private queueUpdateThrottler;
    private doBatchUpdate;
    private batchUpdate;
    private getNewPromptInsertIndex;
    UNSAFE_componentWillUpdate(prevProps: IRecycleTreeProps): void;
    componentDidUpdate(prevProps: IRecycleTreeProps): void;
    private promptNew;
    private promptNewTreeNode;
    private promptNewCompositeTreeNode;
    private promptRename;
    private expandNode;
    private collapseNode;
    private _isEnsuring;
    private ensureVisible;
    private tryScrollIntoView;
    private tryScrollIntoViewWhileStable;
    componentDidMount(): void;
    componentWillUnmount(): void;
    private set promptHandle(value);
    private get promptHandle();
    private getItemAtIndex;
    private handleListScroll;
    private get adjustedRowCount();
    private getItemKey;
    private filterItems;
    private renderItem;
    private layoutItem;
    private getItemSize;
    render(): React.JSX.Element;
}
//# sourceMappingURL=RecycleTree.d.ts.map