View as Markdown

API reference

@salmonui/data-grid/engine/tree

65 exported symbols: 24 functions, 1 class, 10 interfaces, 27 types and 3 constants. Each name links its page with the signature, docs and members.

import { … } from '@salmonui/data-grid/engine/tree';

Functions

  • applySelectionDeltaApplies a selection change to the counts in place: every ancestor of a changed row moves by one. O(changed × depth).
  • buildTreeLayoutBuilds the pre-order of the rows kept by keep (null: every row). priority lists source indexes in sibling order (the sort stage's order; null: source order); k…
  • buildVisibleRangesVisible ranges of layout where expanded[s] (by source index) opens a row with kept children. With footers, a child summary row follows the last visible descend…
  • cascadePlanRows a cascade toggle of sourceIndex changes: the row and its kept subtree ([slot, next)), then the ancestors whose state follows. Checking selects every ances…
  • checkStateOfTri-state of a row: checked when it and every kept descendant are selected, unchecked when none is, else mixed.
  • childrenInSource indexes of the kept children of a row (-1: the roots), in sibling order.
  • countSelectedDescendantsSelected descendants of every kept row of layout (by source index). O(n): one reverse pre-order pass.
  • createTreeModuleCreates the tree module. Options come from options merged under DataGridOptions.tree (TreeOptions, or true for nested rows under 'children').
  • descendantCountKept descendants of a row.
  • descendantsOfSource indexes of the kept descendants of a row, in pre-order ([slot + 1, next)).
  • flattenTreeNested rows (childrenField arrays) as one flat pre-order array, rows by reference (never copied). Iterative, so deep trees never overflow the stack; a row that…
  • getTreeStateThe tree part of an engine's state, or null without the tree module.
  • isAncestorOfTrue when ancestor is a proper ancestor of row in layout (both source indexes). O(1).
  • parentsFromIdsParents of flat self-referential rows. parentIdOf(i) returns row i's parent id (null for a root); indexOf resolves an id to a source index (-1 when unknown, th…
  • parentsFromNestedParents of nested rows that are already in flat pre-order (flattenTree output). One parallel walk of the nesting and the flat array; when the flat array is not…
  • positionOfSlotVisible data position of a slot, or -1 when it is hidden by a collapsed ancestor.
  • restoreTreeStateRestores a tree part (tree.setExpanded); null without the tree module.
  • siblingInfo[childCount, posinset, setsize] of a kept row (source index): short sibling walks, falling back to the layout's arrays (built on first read) for wide sibling l…
  • slotAtPositionSlot of visible data position p.
  • treeCopyRowIdsThe copied row ids widened by mode over the kept layout of the current query: ancestors adds every kept ancestor, descendants every kept descendant, both both,…
  • treeOfThe tree (full index and kept layout) of a tree-mode model, or null.
  • treePartOfThe tree part of a raw state, validated, or null.
  • withTreePersistenceStorage binding functions that include tree.expandedRows (wraps DATA_GRID_PERSISTENCE_FNS).
  • withTreeStateInstance state methods that include tree.expandedRows (wraps createDataGridStateApi(engine)).

Classes

Interfaces

  • TreeInfo
  • TreeIssueA data problem found while resolving parents: an unknown parent id (orphan) or a parent chain that loops (cycle).
  • TreeLayoutPre-order layout of the kept rows of a tree. Arrays named by slot are indexed by pre-order slot, the others by source index.
  • TreeLoadContext
  • TreeOptions
  • TreeRangesVisible slot ranges of a layout (grid-free).
  • TreeRowInfoWhat the renderer needs per tree row (ctx.tree, row ARIA, toggle). Stable identity while unchanged.
  • TreeState
  • TreeStructureTree reads the selection, editing, and row drag modules use through treeOf(model) (view-helpers.ts) without importing tree code: the full (unfiltered) tree and…
  • TreeViewModelThe tree view's per-model data (shared by its paged views).

Types

Constants