/** * @description * * The `CellCoords` class holds the coordinates (`row`, `col`) of a single cell. * * It also contains methods for validating the coordinates * and retrieving them as an object. * * To import the `CellCoords` class: * * ```js * import Handsontable, { CellCoords } from '/handsontable'; * * // or, using modules * import Handsontable, { CellCoords } from '/handsontable/base'; * ``` */ declare class CellCoords { #private; /** * A visual row index. * * @type {number} */ row: number | null; /** * A visual column index. * * @type {number} */ col: number | null; /** * Creates a new CellCoords instance. * * @param {number} [row] A visual row index. * @param {number} [column] A visual column index. * @param {boolean} [isRtl=false] A flag which determines if the coordinates run in RTL mode. */ constructor(row?: number, column?: number, isRtl?: boolean); /** * Checks if the coordinates in your `CellCoords` instance are valid * in the context of given table parameters. * * The `row` index: * - Must be an integer. * - Must be higher than the number of column headers in the table. * - Must be lower than the total number of rows in the table. * * The `col` index: * - Must be an integer. * - Must be higher than the number of row headers in the table. * - Must be lower than the total number of columns in the table. * * @param {object} [tableParams] An object with a defined table size. * @param {number} [tableParams.countRows=0] The total number of rows. * @param {number} [tableParams.countCols=0] The total number of columns. * @param {number} [tableParams.countRowHeaders=0] A number of row headers. * @param {number} [tableParams.countColHeaders=0] A number of column headers. * @returns {boolean} `true`: The coordinates are valid. */ isValid(tableParams?: { countRows?: number; countCols?: number; countRowHeaders?: number; countColHeaders?: number; }): boolean; /** * Checks whether both row and col coordinates are set (not null). * * @returns {boolean} */ isSet(): this is CellCoords & { row: number; col: number; }; /** * Checks if another set of coordinates (`coords`) * is equal to the coordinates in your `CellCoords` instance. * * @param {CellCoords} coords Coordinates to check. * @returns {boolean} */ isEqual(coords: CellCoords): boolean; /** * Checks if the coordinates point to the headers range. If one of the axis (row or col) point to * the header (negative value) then method returns `true`. * * @returns {boolean} */ isHeader(): boolean; /** * Checks if the coordinates point to the cells range. If all axis (row and col) point to * the cell (positive value) then method returns `true`. * * @returns {boolean} */ isCell(): boolean; /** * Checks if the coordinates runs in RTL mode. * * @returns {boolean} */ isRtl(): boolean; /** * Checks if another set of coordinates (`testedCoords`) * is south-east of the coordinates in your `CellCoords` instance. * * @param {CellCoords} testedCoords Coordinates to check. * @returns {boolean} */ isSouthEastOf(testedCoords: CellCoords): boolean; /** * Checks if another set of coordinates (`testedCoords`) * is north-west of the coordinates in your `CellCoords` instance. * * @param {CellCoords} testedCoords Coordinates to check. * @returns {boolean} */ isNorthWestOf(testedCoords: CellCoords): boolean; /** * Checks if another set of coordinates (`testedCoords`) * is south-west of the coordinates in your `CellCoords` instance. * * @param {CellCoords} testedCoords Coordinates to check. * @returns {boolean} */ isSouthWestOf(testedCoords: CellCoords): boolean; /** * Checks if another set of coordinates (`testedCoords`) * is north-east of the coordinates in your `CellCoords` instance. * * @param {CellCoords} testedCoords Coordinates to check. * @returns {boolean} */ isNorthEastOf(testedCoords: CellCoords): boolean; /** * Normalizes the coordinates in your `CellCoords` instance to the nearest valid position. * * Coordinates that point to headers (negative values) are normalized to `0`. * * @returns {CellCoords} */ normalize(): CellCoords; /** * Assigns the coordinates from another `CellCoords` instance (or compatible literal object) * to your `CellCoords` instance. * * @param {CellCoords | { row: number | undefined, col: number | undefined }} coords The CellCoords * instance or compatible literal object. * @returns {CellCoords} */ assign(coords: CellCoords | { row?: number; col?: number; }): CellCoords; /** * Clones your `CellCoords` instance. * * @returns {CellCoords} */ clone(): CellCoords; /** * Converts your `CellCoords` instance into an object literal with `row` and `col` properties. * * @returns {{row: number, col: number}} An object literal with `row` and `col` properties. */ toObject(): { row: number | null; col: number | null; }; } export default CellCoords;