import { DisposableCollection } from '@difizen/mana-common';
import { BaseView, SelectionService } from '@difizen/mana-core';
import type { StatefulView, ViewSize } from '@difizen/mana-core';
import type { MenuPath } from '@difizen/mana-core';
import type PerfectScrollbar from 'perfect-scrollbar';
import * as React from 'react';
import type { ScrollParams } from 'react-virtualized';
import { CellMeasurerCache } from 'react-virtualized';
import type { MeasuredCellParent } from 'react-virtualized/dist/es/CellMeasurer';
import { LabelProvider } from '../../label';
import type { ModifierAwareEvent, NodeRow } from '../tree';
import { TreeNode } from '../tree';
import { TreeDecoratorService } from '../tree-decorator';
import { ExpandableTreeNode } from '../tree-expansion';
import { TreeModel } from '../tree-model';
import type { NodeProps } from '../tree-protocol';
import { TreeProps } from '../tree-protocol';
import { SelectableTreeNode } from '../tree-selection';
import type { TreeViewDecoration } from '../tree-view-decoration';
import { TreeViewDecorator } from './tree-view-decorator';
import './index.less';
/**
 * Representation of the tree view properties.
 */
export type ViewProps = {
    /**
     * The width property.
     */
    width: number;
    /**
     * The height property.
     */
    height: number;
    /**
     * The scroll to row value.
     */
    scrollToRow?: number;
    /**
     * The list of node rows.
     */
    rows: NodeRow[];
    handleScroll: (info: ScrollParams) => void;
    renderNodeRow: (row: NodeRow) => React.ReactNode;
};
export interface TreeViewRowProps {
    rowKey: string;
    index?: number | undefined;
    parent: MeasuredCellParent;
    style?: React.CSSProperties | undefined;
    row?: NodeRow;
    cache: CellMeasurerCache;
}
export declare const TreeViewRow: (props: TreeViewRowProps) => import("react/jsx-runtime").JSX.Element | null;
export declare function TreeViewContent(): import("react/jsx-runtime").JSX.Element;
export declare const TreeViewComponent: React.ForwardRefExoticComponent<React.RefAttributes<HTMLDivElement>>;
export declare const TreeViewFactoryId = "tree-view-factory";
export declare class TreeView extends BaseView implements StatefulView {
    /**
     * Row index to ensure visibility.
     * - Used to forcefully scroll if necessary.
     */
    scrollToRow: number | undefined;
    id: string;
    view: React.ForwardRefExoticComponent<React.RefAttributes<HTMLDivElement>>;
    rows: Map<string, NodeRow>;
    contextMenuData: any;
    scrollOptions: PerfectScrollbar.Options;
    protected toDispose: DisposableCollection;
    protected shouldScrollToRow: boolean;
    readonly contextMenuPath: MenuPath;
    readonly props: TreeProps;
    readonly model: TreeModel;
    readonly treeViewDecorator: TreeViewDecorator;
    readonly selectionService: SelectionService;
    readonly lableProvider: LabelProvider;
    readonly treeRowComponent: (props: TreeViewRowProps) => import("react/jsx-runtime").JSX.Element | null;
    protected readonly decoratorService: TreeDecoratorService;
    constructor(props: TreeProps, model: TreeModel, treeViewDecorator: TreeViewDecorator, selectionService: SelectionService, lableProvider: LabelProvider, decoratorService: TreeDecoratorService);
    offsetWidth?: number | undefined;
    offsetHeight?: number | undefined;
    onViewResize: (size: ViewSize) => void;
    protected init(): void;
    protected updateRows: () => void;
    protected doUpdateRows(): void;
    /**
     * Create the node class names.
     * @param node the tree node.
     * @param _props the node properties.
     *
     * @returns the list of tree node class names.
     */
    protected createNodeClassNames(node: TreeNode, _props: NodeProps): string[];
    /**
     * Create node attributes for the tree node given the node properties.
     * @param node the tree node.
     * @param props the node properties.
     */
    createNodeAttributes(node: TreeNode, props: NodeProps): React.Attributes & React.HTMLAttributes<HTMLElement>;
    /**
     * Create the container attributes for the widget.
     */
    createContainerAttributes(): React.HTMLAttributes<HTMLElement>;
    /**
     * Get the container tree node.
     *
     * @returns the tree node for the container if available.
     */
    getContainerTreeNode(): TreeNode | undefined;
    /**
     * Handle the context menu click event.
     * - The context menu click event is triggered by the right-click.
     * @param node the tree node if available.
     * @param event the right-click mouse event.
     */
    handleContextMenuEvent: (event: React.MouseEvent<HTMLElement>, tree: TreeView | undefined, n: TreeNode | TreeView | undefined) => void;
    /**
     * Convert the tree node to context menu arguments.
     * @param _node the selectable tree node.
     */
    setContextMenuArgs: (node: TreeNode | undefined, tree?: TreeView | undefined) => any;
    /**
     * Actually focus the tree node.
     */
    protected doFocus(): void;
    /**
     * Get the tree node to focus.
     *
     * @returns the node to focus if available.
     */
    protected getNodeToFocus(): SelectableTreeNode | undefined;
    updateGlobalSelection(): void;
    /**
     * Update the `scrollToRow`.
     * @param updateOptions the tree widget force update options.
     */
    protected updateScrollToRow(): void;
    /**
     * Handle the scroll event.
     */
    readonly handleScroll: (info: ScrollParams) => void;
    /**
     * Get the `scrollToRow`.
     *
     * @returns the `scrollToRow` if available.
     */
    protected getScrollToRow(): number | undefined;
    protected shouldDisplayNode(node: TreeNode): boolean;
    /**
     * Toggle the node.
     */
    readonly toggle: (event: React.MouseEvent<HTMLElement>) => void;
    protected findNodeAttr(domNode: (EventTarget & HTMLElement) | null): string | undefined;
    /**
     * Actually toggle the tree node.
     * @param event the mouse click event.
     */
    protected doToggle(event: React.MouseEvent<HTMLElement>): void;
    /**
     * Determine if the tree modifier aware event has a `ctrlcmd` mask.
     * @param event the tree modifier aware event.
     *
     * @returns `true` if the tree modifier aware event contains the `ctrlcmd` mask.
     */
    protected hasCtrlCmdMask(event: ModifierAwareEvent): boolean;
    /**
     * Determine if the tree modifier aware event has a `shift` mask.
     * @param event the tree modifier aware event.
     *
     * @returns `true` if the tree modifier aware event contains the `shift` mask.
     */
    protected hasShiftMask(event: ModifierAwareEvent): boolean;
    /**
     * Handle the single-click mouse event.
     * @param node the tree node if available.
     * @param event the mouse single-click event.
     */
    handleClickEvent(maybeProxyNode: TreeNode | undefined, event: React.MouseEvent<HTMLElement>): void;
    /**
     * Handle the double-click mouse event.
     * @param node the tree node if available.
     * @param event the double-click mouse event.
     */
    handleDblClickEvent(node: TreeNode | undefined, event: React.MouseEvent<HTMLElement>): void;
    /**
     * Determine the classes to use for an icon
     * - Assumes a Font Awesome name when passed a single string, otherwise uses the passed string array
     * @param iconName the icon name or list of icon names.
     * @param additionalClasses additional CSS classes.
     *
     * @returns the icon class name.
     */
    getIconClass(iconName: string | string[], additionalClasses?: string[]): string;
    /**
     * Apply font styles to the tree.
     * @param original the original css properties.
     * @param fontData the optional `fontData`.
     */
    applyFontStyles(original: React.CSSProperties, fontData: TreeViewDecoration.FontData | undefined): React.CSSProperties;
    isExpandable(node: TreeNode): node is ExpandableTreeNode;
    needsActiveIndentGuideline(node: TreeNode): boolean;
    toNodeIcon(node: TreeNode): string;
    toNodeName(node: TreeNode): string;
    toNodeDescription(node: TreeNode): string;
    /**
     * Create the tree node style.
     * @param node the tree node.
     * @param props the node properties.
     */
    createNodeStyle(node: TreeNode, props: NodeProps): React.CSSProperties | undefined;
    /**
     * Decorate the node style.
     * @param node the tree node.
     * @param style the optional CSS properties.
     *
     * @returns the CSS styles if available.
     */
    protected decorateNodeStyle(node: TreeNode, style: React.CSSProperties | undefined): React.CSSProperties | undefined;
    /**
     * Get the default node style.
     * @param node the tree node.
     * @param props the node properties.
     *
     * @returns the CSS properties if available.
     */
    protected getDefaultNodeStyle(node: TreeNode, props: NodeProps): React.CSSProperties | undefined;
    protected getPaddingLeft(node: TreeNode, props: NodeProps): number;
    /**
     * If the node is a composite, a toggle will be rendered.
     * Otherwise we need to add the width and the left, right padding => 18px
     */
    protected needsExpansionTogglePadding(node: TreeNode): boolean;
    /**
     * Deflate the tree node for storage.
     * @param node the tree node.
     */
    protected deflateForStorage(node: TreeNode): object;
    /**
     * Inflate the tree node from storage.
     * @param node the tree node.
     * @param parent the optional tree node.
     */
    protected inflateFromStorage(node: any, parent?: TreeNode): TreeNode;
    /**
     * Store the tree state.
     */
    storeState(): object;
    /**
     * Restore the state.
     * @param oldState the old state object.
     */
    restoreState(oldState: object): void;
}
export type TreeViewSelection = readonly Readonly<SelectableTreeNode>[] & {
    source: TreeView;
};
export declare namespace TreeViewSelection {
    function isSource(selection: Record<any, any> | undefined, source: TreeView): boolean;
    function getSource(selection: Record<any, any> | undefined): TreeView | undefined;
    function is(selection: Record<any, any> | undefined): selection is TreeViewSelection;
    function create(source: TreeView): TreeViewSelection;
}
//# sourceMappingURL=tree-view.d.ts.map