import type { HotInstance } from '../../core/types'; /** * Describes style properties for a single border side or corner. */ export interface BorderSettings { width?: number; color?: string; cornerVisible?: boolean | ((...args: unknown[]) => boolean); hide?: boolean; className?: string; [key: string]: unknown; } /** * Internal shape of a stored border object, used by the plugin's bookkeeping. */ export interface BorderObject { id: string; row: number; col: number; top?: BorderSettings; bottom?: BorderSettings; start?: BorderSettings; end?: BorderSettings; border?: Record; range?: { from: { row: number; col: number; }; to: { row: number; col: number; }; }; [key: string]: unknown; } /** * Minimal interface the contextMenuItem functions need from the CustomBorders plugin instance. */ export interface CustomBordersPlugin { hot: HotInstance; prepareBorder(selected: Record[], place: string, remove: boolean | undefined): void; } /** * Describes a single user-provided custom border configuration entry. */ export interface CustomBorderConfig { row?: number; col?: number; top?: BorderSettings; bottom?: BorderSettings; start?: BorderSettings; end?: BorderSettings; left?: BorderSettings; right?: BorderSettings; border?: Record; range?: { from: { row: number; col: number; }; to: { row: number; col: number; }; }; [key: string]: unknown; } /** * Create separated id for borders for each cell. * * @param {number} row Visual row index. * @param {number} col Visual column index. * @returns {string} */ export declare function createId(row: number, col: number): string; /** * Create default single border for each position (top/right/bottom/left). * * @returns {object} `{{width: number, color: string}}`. */ export declare function createDefaultCustomBorder(): BorderSettings; /** * Create default object for empty border. * * @returns {object} `{{hide: boolean}}`. */ export declare function createSingleEmptyBorder(): BorderSettings; /** * Create default Handsontable border object. * * @returns {object} `{{width: number, color: string, cornerVisible: boolean}}`. */ export declare function createDefaultHtBorder(): { width: number; color: string; cornerVisible: boolean; }; /** * Normalizes the border object to be compatible with the Border API from the Walkontable. * The function translates the "left"/"right" properties to "start"/"end" prop names. * * @param {object} border The configuration object of the border. * @returns {object} */ export declare function normalizeBorder>(border: T): T; /** * Denormalizes the border object to be backward compatible with the previous version of the CustomBorders * plugin API. The function extends the border configuration object for the backward compatible "left"/"right" * properties. * * @param {object} border The configuration object of the border. * @returns {object} */ export declare function denormalizeBorder>(border: T): T; /** * Prepare empty border for each cell with all custom borders hidden. * * @param {number} row Visual row index. * @param {number} col Visual column index. * @returns {BorderObject} Returns border configuration containing visual indexes. */ export declare function createEmptyBorders(row: number, col: number): BorderObject; /** * @param {object} defaultBorder The default border object. * @param {object} customBorder The border object with custom settings. * @returns {object} */ export declare function extendDefaultBorder(defaultBorder: BorderObject, customBorder: CustomBorderConfig): BorderObject; /** * Check if selection has border. * * @param {Core} hot The Handsontable instance. * @param {string} [direction] If set ('left' or 'top') then only the specified border side will be checked. * @returns {boolean} */ export declare function checkSelectionBorders(hot: HotInstance, direction?: string): boolean; /** * Mark label in contextMenu as selected. * * @param {string} label The label text. * @returns {string} */ export declare function markSelected(label: string): string; /** * Checks if in the borders config there are defined "left" or "right" border properties. * * @param {object[]} borders The custom border plugin's options. * @returns {boolean} */ export declare function hasLeftRightTypeOptions(borders: CustomBorderConfig[]): boolean; /** * Checks if in the borders config there are defined "start" or "end" border properties. * * @param {object[]} borders The custom border plugin's options. * @returns {boolean} */ export declare function hasStartEndTypeOptions(borders: CustomBorderConfig[]): boolean; /** * Translates the physical horizontal direction to logical ones. If not known property name is * passed it will be returned without modification. * * @param {string} propName The physical direction property name ("left" or "right"). * @returns {string} */ export declare function toInlinePropName(propName: string): string;