API reference: @salmonui/data-grid/engine/tree
parentsFromNestedfunction
import { parentsFromNested } from '@salmonui/data-grid/engine/tree';function parentsFromNested(rows: readonly unknown[], childrenField: string, indexOfRow?: (row: unknown) => number): Int32Array;
Parents 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 exactly the flattening (rows appended by a patch, or
reordered), falls back to an identity map, O(n) either way. A child object
that is not in rows (a parent replaced with copies of its children) is
matched through indexOfRow (the row id) when given. Rows that are
nobody's child are roots.