import type { HyperFormulaEngine } from '../engine/types'; interface AxisIndexMapper { getVisualFromPhysicalIndex(physicalIndex: number): number | null; getIndexesSequence(): number[]; getNotTrimmedIndexes(): number[]; getNumberOfIndexes(): number; } interface ParentIndexSyncer { getEngine(): HyperFormulaEngine | null; getSheetId(): number | null; getPostponeAction(callback?: Function): Function; isPerformingUndoRedo(): boolean; } /** * @private * @class IndexSyncer * @description * * Indexes synchronizer responsible for providing logic for particular axis. It respects an idea to represent trimmed * elements in HF's engine to perform formulas calculations on them. It also provides method for translation from visual * row/column indexes to HF's row/column indexes. */ declare class AxisSyncer { #private; /** * Initializes the axis syncer for the given axis with the corresponding index mapper and parent index syncer references. */ constructor(axis: string, indexMapper: AxisIndexMapper, indexSyncer: ParentIndexSyncer); /** * Sets removed HF indexes (it should be done right before performing move on HOT). * * @param {Array} removedIndexes List of removed physical indexes. * @returns {Array} List of removed visual indexes. */ setRemovedHfIndexes(removedIndexes: number[]): number[]; /** * Gets removed HF indexes (right before performing removal on HOT). * * @returns {Array} List of removed HF indexes. */ getRemovedHfIndexes(): number[]; /** * Gets corresponding HyperFormula index for particular visual index. It's respecting the idea that HF's engine * is fed also with trimmed indexes (business requirements for formula result calculation also for trimmed elements). * * @param {number} visualIndex Visual index. * @returns {number} */ getHfIndexFromVisualIndex(visualIndex: number): number; /** * Gets corresponding visual index for a HyperFormula index. Inverse of {@link getHfIndexFromVisualIndex}. * Returns -1 when the HF index points to a trimmed element (not visible to the user). * * @param {number} hfIndex HyperFormula index. * @returns {number} */ getVisualIndexFromHfIndex(hfIndex: number): number; /** * Synchronizes moves done on HOT to HF engine (based on previously calculated positions). * * @private * @param {Array<{from: number, to: number}>} moves Calculated HF's move positions. */ syncMoves(moves: Array<{ from: number; to: number; }>): void; /** * Stores information about performed HOT moves for purpose of calculating where to move HF elements. * * @param {Array} movedVisualIndexes Sequence of moved visual indexes for certain axis. * @param {number} visualFinalIndex Final visual place where to move HOT indexes. * @param {boolean} movePossible Indicates if it's possible to move HOT indexes to the desired position. */ storeMovesInformation(movedVisualIndexes: number[], visualFinalIndex: number, movePossible: boolean): void; /** * Calculating where to move HF elements and performing already calculated moves. * * @param {boolean} movePossible Indicates if it was possible to move HOT indexes to the desired position. * @param {boolean} orderChanged Indicates if order of HOT indexes was changed by move. */ calculateAndSyncMoves(movePossible: boolean, orderChanged: boolean): void; /** * Gets callback for hook triggered after performing change of indexes order. * * @returns {Function} */ getIndexesChangeSyncMethod(): (source: string) => void; /** * Initialize the AxisSyncer. */ init(): void; } export default AxisSyncer;