@alpernative/tree
Version:
[`@alpernative/tree`](https://www.npmjs.com/package/@alpernative/tree) is a high-performance, customizable tree component for React. It provides a wide range of features, including virtualization, drag-and-drop, and nested drag-and-drop support.
16 lines (15 loc) • 873 B
TypeScript
import { FlattenedItem, Path, TreeData, TreeItemData, ItemId, TreeItem, TreeSourcePosition, TreeDestinationPosition } from '../types';
export type TreeItemMutation = {
id?: ItemId;
children?: ItemId[];
hasChildren?: boolean;
isExpanded?: boolean;
isChildrenLoading?: boolean;
data?: TreeItemData;
};
export declare const flattenTree: (tree: TreeData, path?: Path) => FlattenedItem[];
export declare const mutateTree: (tree: TreeData, ItemId: ItemId, mutation: TreeItemMutation) => TreeData;
export declare const getItem: (tree: TreeData, path: Path) => TreeItem;
export declare const getParent: (tree: TreeData, path: Path) => TreeItem;
export declare const getTreePosition: (tree: TreeData, path: Path) => TreeSourcePosition;
export declare const moveItemOnTree: (tree: TreeData, from: TreeSourcePosition, to: TreeDestinationPosition) => TreeData;