import type { default as CellCoords } from '../3rdparty/walkontable/src/cell/coords'; import type { default as CellRange } from '../3rdparty/walkontable/src/cell/range'; /** * The SelectionRange class is a simple CellRanges collection designed for easy manipulation of the multiple * consecutive and non-consecutive selections. * * @class SelectionRange * @util */ declare class SelectionRange { /** * List of all CellRanges added to the class instance. * * @type {CellRange[]} */ ranges: CellRange[]; /** * @type {function(CellCoords): CellRange} */ createCellRange: (...args: CellCoords[]) => CellRange; /** * Initializes the collection with a factory function used to create new CellRange instances. */ constructor(createCellRange: (...args: CellCoords[]) => CellRange); /** * Check if selected range is empty. * * @returns {boolean} */ isEmpty(): boolean; /** * Set coordinates to the class instance. It clears all previously added coordinates and push `coords` * to the collection. * * @param {CellCoords} coords The CellCoords instance with defined visual coordinates. * @returns {SelectionRange} */ set(coords: CellCoords): this; /** * Add coordinates to the class instance. The new coordinates are added to the end of the range collection. * * @param {CellCoords} coords The CellCoords instance with defined visual coordinates. * @returns {SelectionRange} */ add(coords: CellCoords): this; /** * Pushes a new CellRange instance to the collection. * * @param {CellRange} cellRange The CellRange instance with defined visual coordinates. * @returns {SelectionRange} */ push(cellRange: CellRange | unknown): this; /** * Removes from the stack the last added coordinates. * * @returns {CellRange} */ pop(): CellRange | undefined; /** * Get last added coordinates from ranges, it returns a CellRange instance. * * @returns {CellRange|undefined} */ current(): CellRange | undefined; /** * Get previously added coordinates from ranges, it returns a CellRange instance. * * @returns {CellRange|undefined} */ previous(): CellRange | undefined; /** * Returns `true` if coords is within any selection coords. This method iterates through * all selection layers to check if the coords object is within selection range. * * @param {CellCoords} coords The CellCoords instance with defined visual coordinates. * @param {function(CellRange, number): boolean} [criteria] The function that allows injecting custom criteria. * @returns {boolean} */ includes(coords: CellCoords, criteria?: (cellRange: CellRange, index: number) => boolean): boolean; /** * Find all ranges that are equal to the provided range. * * @param {CellRange} cellRange The CellRange instance with defined visual coordinates. * @returns {Array<{range: CellRange, layer: number}>} */ findAll(cellRange: CellRange): { range: CellRange; layer: number; }[]; /** * Removes all ranges that are equal to the provided ranges. * * @param {CellRange[]} cellRanges The array of CellRange instances with defined visual coordinates. * @returns {SelectionRange} */ remove(cellRanges: CellRange[]): this; /** * Removes the ranges based on the provided index layers (0 no N). * * @param {number[]} layerIndexes The array of indexes that will be removed from the selection. * @returns {SelectionRange} */ removeLayers(layerIndexes: number[]): this; /** * Clear collection. * * @returns {SelectionRange} */ clear(): this; /** * Get count of added all coordinates added to the selection. * * @returns {number} */ size(): number; /** * Creates a clone of this class. * * @returns {SelectionRange} */ clone(): SelectionRange; /** * Allows applying custom index translations for any range within the class instance. * * @param {function(CellRange): CellRange} mapFunction The function that allows injecting custom index translation logic. * @returns {SelectionRange} */ map(mapFunction: (cellRange: CellRange, index: number) => CellRange): this; /** * Peek the coordinates based on the index where that coordinate resides in the collection. * * @param {number} [index=0] An index where the coordinate will be retrieved from. The index '0' gets the * latest range. * @returns {CellRange|undefined} */ peekByIndex(index?: number): CellRange | undefined; /** * Returns an iterator over all CellRange entries stored in the collection, enabling use in for-of loops. */ [Symbol.iterator](): IterableIterator; } export default SelectionRange;