UNPKG

@vectara/vectara-ui

Version:

Vectara's design system, codified as a React and Sass component library

15 lines (14 loc) 524 B
import { SpansRow } from "./types"; export type FlatSpan<T> = { row: T; id: string; parentId: string | null; depth: number; hasChildren: boolean; hasLoadedChildren: boolean; posInSet: number; setSize: number; }; export type IdAccessor<T> = (row: T) => string; export type ParentAccessor<T> = (row: T) => string | null; export declare const buildAndFlattenSpans: <T extends SpansRow>(rows: T[], expandedIds: Set<string>, getId: IdAccessor<T>, getParentId: ParentAccessor<T>) => FlatSpan<T>[];