import type { IndexMapper } from '../../translations'; import type { default as CellRange } from '../../3rdparty/walkontable/src/cell/range'; import type MergedCellCoords from './cellCoords'; /** * Data shape for focus order nodes. */ export interface FocusNodeData { selectionLayer: number; colStart: number; colEnd: number; rowStart: number; rowEnd: number; } /** * Class responsible for providing the correct focus order (vertical and horizontal) within a selection that * contains merged cells. * * The order is computed lazily. A focus stop ("node") is either a visible non-merged cell or a merged * cell that is fully contained in the selection layer (anchored at its first visible cell in scan * order). Cells covered by a merged cell that sticks out of the layer produce no focus stop. Each * navigation step costs time relative to the merged cells it walks past — never to the selection area. * * @private */ export declare class FocusOrder { #private; /** * Initializes the focus order manager with the merged cell getter and row and column index mappers used to navigate focus through merged regions. */ constructor({ mergedCellsGetter, rowIndexMapper, columnIndexMapper }: { mergedCellsGetter: (row: number, column: number) => MergedCellCoords | false; rowIndexMapper: IndexMapper; columnIndexMapper: IndexMapper; }); /** * Gets the currently selected node data from the vertical focus order. * * @returns {FocusNodeData | undefined} */ getCurrentVerticalNode(): FocusNodeData | undefined; /** * Gets the first node data from the vertical focus order. * * @returns {FocusNodeData | undefined} */ getFirstVerticalNode(): FocusNodeData | undefined; /** * Gets the next selected node data from the vertical focus order. * * @returns {FocusNodeData} */ getNextVerticalNode(): FocusNodeData; /** * Gets the previous selected node data from the vertical focus order. * * @returns {FocusNodeData} */ getPrevVerticalNode(): FocusNodeData; /** * Gets the currently selected node data from the horizontal focus order. * * @returns {FocusNodeData | undefined} */ getCurrentHorizontalNode(): FocusNodeData | undefined; /** * Gets the first node data from the horizontal focus order. * * @returns {FocusNodeData | undefined} */ getFirstHorizontalNode(): FocusNodeData | undefined; /** * Gets the next selected node data from the horizontal focus order. * * @returns {FocusNodeData} */ getNextHorizontalNode(): FocusNodeData; /** * Gets the previous selected node data from the horizontal focus order. * * @returns {FocusNodeData} */ getPrevHorizontalNode(): FocusNodeData; /** * Sets the previous node in both focus orders as active. */ setPrevNodeAsActive(): void; /** * Sets the next node in both focus orders as active. */ setNextNodeAsActive(): void; /** * Rebuilds the focus order based on the provided selection. Only the layers' geometry is * captured — the focus stops themselves are computed lazily during navigation. * * @param {CellRange[]} selectedRanges The selected ranges to build the focus order for. */ buildFocusOrder(selectedRanges: CellRange[]): void; /** * Sets the active node based on the provided row and column. * * @param {number} row The visual row index. * @param {number} column The visual column index. * @param {number} selectionLayerIndex The index of the selection layer to which the focus should be marked as active. * @returns {FocusOrder} */ setActiveNode(row: number, column: number, selectionLayerIndex?: number): this; }