UNPKG

@1771technologies/lytenyte-pro

Version:

Blazingly fast headless React data grid with 100s of features.

16 lines (15 loc) 480 B
import { getTreeNodeId } from "./get-tree-node-id.js"; import { isTreeNodeDisabled } from "./is-tree-node-disabled.js"; export function selectNode(node, ctx, focus) { if (!node || isTreeNodeDisabled(node)) return; if (focus) node.focus(); const id = getTreeNodeId(node); if (ctx.selection.has(id)) return; ctx.selectionPivotRef.current = id; const next = new Set(ctx.selection); next.add(id); ctx.onSelectionChange(next); }