View as Markdown

API reference: @salmonui/data-grid/engine/tree

cascadePlanfunction

import { cascadePlan } from '@salmonui/data-grid/engine/tree';
function cascadePlan(layout: TreeLayout, counts: Int32Array, sourceIndex: number, checked: boolean, selected: (sourceIndex: number) => boolean): {
    readonly select: number[];
    readonly deselect: number[];
};

Rows a cascade toggle of sourceIndex changes: the row and its kept subtree ([slot, next)), then the ancestors whose state follows. Checking selects every ancestor whose descendants become all selected (bottom-up, stopping at the first that does not); unchecking deselects every selected ancestor. Returns source indexes to select and to deselect.