import type { DomBindings, WalkontableInstance } from '../types'; import type Settings from '../settings'; /** * Creates an overlay over the original Walkontable instance. The overlay renders the clone of the original Walkontable * and (optionally) implements behavior needed for native horizontal and vertical scrolling. * * @abstract * @class Overlay * @property {Walkontable} wot The Walkontable instance. */ export declare abstract class Overlay { /** * The Walkontable settings. * * @private * @type {Settings} */ wtSettings: Settings; /** * The Walkontable instance. * * @type {WalkontableInstance} */ wot: WalkontableInstance; /** * DOM elements bound to the current instance. * * @type {DomBindings} */ domBindings: DomBindings; /** * Function that returns the proper facade. * * @type {Function} */ facadeGetter: Function; /** * Legacy support for the Walkontable instance. * * @type {WalkontableInstance} */ instance: WalkontableInstance; /** * The overlay type name. * * @type {string} */ type: string; /** * The main table scrollable element. * * @type {HTMLElement | Window} */ mainTableScrollableElement: HTMLElement | Window; /** * The table element. * * @type {HTMLTableElement} */ TABLE: HTMLTableElement; /** * The hider element. * * @type {HTMLElement} */ hider: HTMLElement; /** * The spreader element. * * @type {HTMLElement} */ spreader: HTMLElement; /** * The holder element. * * @type {HTMLElement | Window} */ holder: HTMLElement | Window; /** * The Walkontable root element. * * @type {HTMLElement} */ wtRootElement: HTMLElement; /** * The trimming container. * * @type {HTMLElement | Window} */ trimmingContainer: HTMLElement | Window; /** * Flag indicating if full render is needed. * * @type {boolean} */ needFullRender: boolean; /** * The cloned Walkontable instance. * * @type {WalkontableInstance | null} */ clone: WalkontableInstance | null; /** * @param {Walkontable} wotInstance The Walkontable instance. @TODO refactoring: check if can be deleted. * @param {FacadeGetter} facadeGetter Function which return proper facade. * @param {CLONE_TYPES_ENUM} type The overlay type name (clone name). * @param {Settings} wtSettings The Walkontable settings. * @param {DomBindings} domBindings Dom elements bound to the current instance. */ constructor(wotInstance: WalkontableInstance, facadeGetter: Function, type: string, wtSettings: Settings, domBindings: DomBindings); abstract resetFixedPosition(): boolean; abstract createTable(...args: unknown[]): unknown; abstract setScrollPosition(pos: number): boolean; abstract getScrollPosition(): number; abstract getTableParentOffset(): number; abstract getOverlayOffset(): number; abstract onScroll(): void; abstract sumCellSizes(from: number, to: number): number; abstract adjustElementsSize(): void; abstract applyToDOM(): void; abstract scrollTo(sourceIndex: number, snapToEdge: boolean): boolean; /** * Checks if the overlay rendering state has changed. * * @returns {boolean} */ hasRenderingStateChanged(): boolean; /** * Updates internal state with an information about the need of full rendering of the overlay in the next draw cycles. * * If the state is changed to render the overlay, the `needFullRender` property is set to `true` which means that * the overlay will be fully rendered in the current draw cycle. If the state is changed to not render the overlay, * the `needFullRender` property is set to `false` which means that the overlay will be fully rendered in the * current draw cycle but it will not be rendered in the next draw cycles. * * @param {'before' | 'after'} drawPhase The phase of the rendering process. */ updateStateOfRendering(drawPhase: 'before' | 'after'): void; /** * Checks if overlay should be fully rendered. * * @returns {boolean} */ shouldBeRendered(): boolean; /** * Update the trimming container. */ updateTrimmingContainer(): void; /** * Update the main scrollable element. */ updateMainScrollableElement(): void; /** * Calculates coordinates of the provided element, relative to the root Handsontable element. * NOTE: The element needs to be a child of the overlay in order for the method to work correctly. * * @param {HTMLElement} element The cell element to calculate the position for. * @param {number} rowIndex Visual row index. * @param {number} columnIndex Visual column index. * @returns {{top: number, start: number}|undefined} */ getRelativeCellPosition(element: HTMLElement, rowIndex: number, columnIndex: number): { start: number; top: number; } | undefined; /** * Get inline start value depending of direction. * * @param {HTMLElement} el Element. * @returns {number} */ getRelativeStartPosition(el: HTMLElement): number; /** * Calculates coordinates of the provided element, relative to the root Handsontable element within a table with window * as a scrollable element. * * @private * @param {boolean} onFixedRowTop `true` if the coordinates point to a place within the top fixed rows. * @param {boolean} onFixedColumn `true` if the coordinates point to a place within the fixed columns. * @param {number} elementOffset Offset position of the cell element. * @param {number} spreaderOffset Offset position of the spreader element. * @returns {{top: number, left: number}} */ getRelativeCellPositionWithinWindow(onFixedRowTop: boolean, onFixedColumn: boolean, elementOffset: { start: number; top: number; }, spreaderOffset: { start: number; top: number; }): { start: number; top: number; }; /** * Calculates coordinates of the provided element, relative to the root Handsontable element within a table with window * as a scrollable element. * * @private * @param {boolean} onFixedRowTop `true` if the coordinates point to a place within the top fixed rows. * @param {boolean} onFixedRowBottom `true` if the coordinates point to a place within the bottom fixed rows. * @param {boolean} onFixedColumn `true` if the coordinates point to a place within the fixed columns. * @param {number} elementOffset Offset position of the cell element. * @param {number} spreaderOffset Offset position of the spreader element. * @returns {{top: number, left: number}} */ getRelativeCellPositionWithinHolder(onFixedRowTop: boolean, onFixedRowBottom: boolean, onFixedColumn: boolean, elementOffset: { start: number; top: number; }, spreaderOffset: { start: number; top: number; }): { start: number; top: number; }; /** * Make a clone of table for overlay. * * @returns {Clone} */ makeClone(): WalkontableInstance; /** * Refresh/Redraw overlay. * * @param {boolean} [fastDraw=false] When `true`, try to refresh only the positions of borders without rerendering * the data. It will only work if Table.draw() does not force * rendering anyway. */ refresh(fastDraw?: boolean): void; /** * Reset overlay styles to initial values. */ reset(): void; /** * Determine if Walkontable is running in RTL mode. * * @returns {boolean} */ isRtl(): boolean; /** * Destroy overlay instance. */ destroy(): void; }