import type { HotInstance } from '../../../core/types'; import type MergedCellsCollection from '../cellsCollection'; import type MergedCellCoords from '../cellCoords'; interface MergeCellsPlugin { hot: HotInstance; mergedCellsCollection: MergedCellsCollection; ifChromeForceRepaint(): void; } /** * Class responsible for all of the Autofill-related operations on merged cells. * * @private * @class AutofillCalculations */ declare class AutofillCalculations { /** * Reference to the Merge Cells plugin. * * @type {MergeCells} */ plugin: MergeCellsPlugin; /** * Reference to the MergedCellsCollection class instance. * * @type {MergedCellsCollection} */ mergedCellsCollection: MergedCellsCollection; /** * Cache of the currently processed autofill data. * * @private * @type {object} */ currentFillData: Record | null; /** * Initializes the autofill calculations helper with a reference to the MergeCells plugin and its merged cells collection. */ constructor(plugin: MergeCellsPlugin); /** * Get the direction of the autofill process. * * @param {Array} baseArea The selection area. * @param {Array} fullArea The final area (base + drag). * @returns {string} `up`, `down`, `left` or `right`. */ getDirection(baseArea: number[], fullArea: number[]): string; /** * Snap the drag area to the farthest merged cell, so it won't clip any of the merged cells. * * @param {Array} baseArea The base selected area. * @param {Array} fullArea The drag area. * @param {string} dragDirection The autofill drag direction. * @param {Array} foundMergedCells MergeCellCoords found in the base selection area. * @returns {Array} The new drag area. */ snapDragArea(baseArea: number[], fullArea: number[], dragDirection: string, foundMergedCells: MergedCellCoords[]): number[]; /** * Update the current fill cache with the provided object. * * @private * @param {object} updateObject The current filled object cache. */ updateCurrentFillCache(updateObject: Record): void; /** * Get the "length" of the drag area. * * @private * @param {Array} baseArea The base selection area. * @param {Array} fullArea The drag area (containing the base area). * @param {string} direction The drag direction. * @returns {number} The "length" (height or width, depending on the direction) of the drag. */ getAutofillSize(baseArea: number[], fullArea: number[], direction: string): number; /** * Trim the default drag area (containing the selection area) to the drag-only area. * * @private * @param {Array} baseArea The base selection area. * @param {Array} fullArea The base selection area extended by the drag area. * @param {string} direction Drag direction. * @returns {Array} Array representing the drag area coordinates. */ getDragArea(baseArea: number[], fullArea: number[], direction: string): number[]; /** * Get the to-be-farthest merged cell in the newly filled area. * * @private * @param {Array} baseArea The base selection area. * @param {Array} fullArea The drag area (containing the base area). * @param {string} direction The drag direction. * @param {Array} mergedCellArray Array of the merged cells found in the base area. * @returns {MergedCellCoords|null} */ getFarthestCollection(baseArea: number[], fullArea: number[], direction: string, mergedCellArray: MergedCellCoords[]): MergedCellCoords | null; /** * Recreate the merged cells after the autofill process. * * @param {Array} changes Changes made. */ recreateAfterDataPopulation(changes: unknown[][]): void; /** * Get the drag range from the changes made. * * @private * @param {Array} changes The changes made. * @returns {object} Object with `from` and `to` properties, both containing `row` and `column` keys. */ getRangeFromChanges(changes: unknown[][]): { from: { row: number; column: number; }; to: { row: number; column: number; }; }; /** * Check if the drag area contains any merged cells. * * @param {Array} baseArea The base selection area. * @param {Array} fullArea The base area extended by the drag area. * @param {string} direction Drag direction. * @returns {boolean} */ dragAreaOverlapsCollections(baseArea: number[], fullArea: number[], direction: string): boolean; } export default AutofillCalculations;