import type { ReactiveController } from 'lit'; import type { GridHost, Keys } from '../internal/types.js'; /** * Default pixel indentation per depth level for the tree group column. */ export declare const DEFAULT_TREE_INDENT = 20; /** * Tree metadata exposed to renderers. One entry per row that ends up in the * flat output. */ export interface TreeRowMeta { depth: number; hasChildren: boolean; /** Stable key for the row (path-joined string). Useful for keyed reconciliation. */ key: string; /** Last path segment — used as the group-column label for synthesized parents. */ label: string; } /** * Reactive controller backing tree (nested-row) data. * * @remarks * Tree mode keeps the data array flat. Each row's hierarchy is derived from a * user-supplied `getDataPath` callback (AG Grid's "tree data" pattern). The * controller: * * 1. Builds an in-memory tree from the post-sort, post-filter rows. * 2. Synthesizes parent nodes for any path level that lacks a backing row. * 3. Walks the tree honouring the current expansion set and emits a flat * list of rows in display order. * 4. Records per-row metadata (depth, hasChildren) that the cell renderer * reads to draw the chevron + indentation. * * Expansion state is split into two sets — `expanded` for rows that have * backing data (keyed by reference, so it survives sort/filter), and * `expandedKeys` for synthesized parents (keyed by their path string). */ export declare class TreeController implements ReactiveController { #private; protected host: GridHost; expanded: Set; expandedKeys: Set; constructor(host: GridHost); hostConnected(): void; /** Whether tree mode is enabled at the grid level. */ get enabled(): boolean; /** The configured indentation, in pixels, per depth level. */ get childIndent(): number; /** * The column key that displays the chevron + indentation. Resolves to the * configured `groupColumnKey`, falling back to the first visible data column. */ get groupColumnKey(): Keys | undefined; isGroupColumn(key: Keys): boolean; /** * Per-row metadata. Populated as a side effect of {@link process}; reading * before the first pipeline pass returns `undefined`. */ getMeta(row: T): TreeRowMeta | undefined; getDepth(row: T): number; hasChildren(row: T): boolean; isSynthesized(row: T): boolean; /** Group-column label override for synthesized parent rows. */ getLabel(row: T): string | null; isExpanded(row: T): boolean; /** Toggles the expansion state of a tree row. */ toggleRow(row: T): Promise; expandRow(row: T): Promise; collapseRow(row: T): Promise; /** Expands every parent in the current tree. */ expandAll(): Promise; /** Collapses every currently-expanded row. */ collapseAll(): Promise; /** * Pipeline entry point. Called by {@link DataOperationsController.apply} * after sort/filter/quickFilter. Builds the tree, applies the configured * defaults the first time we see this data, and returns rows in * display-order with any synthesized parents inserted. */ process(input: ReadonlyArray): T[]; /** * Resets cached metadata + defaults flag so the next pipeline pass * re-applies `defaultExpanded`. Called from the data watcher when the * input array is replaced wholesale. */ resetForDataChange(): void; }