@1771technologies/lytenyte-pro
Version:
Blazingly fast headless React data grid with 100s of features.
32 lines (31 loc) • 1.35 kB
TypeScript
import type { PathBranch, PathLeaf, PathProvidedItem } from "@1771technologies/lytenyte-shared";
import type { CSSProperties } from "react";
export interface TreeVirtualBranch<T extends PathProvidedItem> {
readonly kind: "branch";
readonly path: string;
readonly branch: PathBranch<T>;
readonly children: TreeVirtualItem<T>[];
readonly rowIndex: number;
readonly attrs: {
readonly style: CSSProperties;
"data-ln-row-index": number;
readonly "aria-posinset": number;
readonly "aria-setsize": number;
};
}
export interface TreeVirtualLeaf<T extends PathProvidedItem> {
readonly kind: "leaf";
readonly leaf: PathLeaf<T>;
readonly rowIndex: number;
readonly attrs: {
readonly style: CSSProperties;
"data-ln-row-index": number;
readonly "aria-posinset": number;
readonly "aria-setsize": number;
};
}
export type TreeVirtualItem<T extends PathProvidedItem> = TreeVirtualBranch<T> | TreeVirtualLeaf<T>;
type Path = string[];
type PathEntry<T extends PathProvidedItem> = [Path | "", PathBranch<T> | PathLeaf<T>];
export declare function makeVirtualTree<T extends PathProvidedItem>(paths: PathEntry<T>[], nodeToIndex: Map<PathBranch<T> | PathLeaf<T>, number>, itemHeight: number, nonAdjacentPathTrees: boolean): TreeVirtualItem<T>[];
export {};