UNPKG

@1771technologies/lytenyte-pro

Version:

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

16 lines (15 loc) 615 B
import { getFocusableNodes } from "./get-focusable-nodes.js"; import { getTreeNodeId } from "./get-tree-node-id.js"; export function getIdsBetweenNodes(start, end, panel) { const focusables = getFocusableNodes(panel); let startIndex = focusables.indexOf(start); let endIndex = focusables.indexOf(end); if (startIndex == -1 || endIndex == -1) return []; [startIndex, endIndex] = [Math.min(startIndex, endIndex), Math.max(startIndex, endIndex)]; const ids = []; for (let i = startIndex; i <= endIndex; i++) { ids.push(getTreeNodeId(focusables[i])); } return ids; }