import type { HotInstance } from './core/types'; import type { WalkontableInstance } from './3rdparty/walkontable/src/types'; import EventManager from './eventManager'; /** * @class TableView * @private */ declare class TableView { #private; /** * Instance of {@link Handsontable}. * * @private * @type {Handsontable} */ hot: HotInstance; /** * Instance of {@link EventManager}. * * @private * @type {EventManager} */ eventManager: EventManager; /** * Current Handsontable's GridSettings object. * * @private * @type {GridSettings} */ settings: import("./settings").GridSettings; /** * Main element. * * @private * @type {HTMLTableSectionElement} */ THEAD: HTMLTableSectionElement; /** * Main
element. * * @private * @type {HTMLTableSectionElement} */ TBODY: HTMLTableSectionElement; /** * Main Walkontable instance. * * @private * @type {Walkontable} */ _wt: WalkontableInstance; /** * Main Walkontable instance. * * @type {Walkontable} */ activeWt: WalkontableInstance; /** * The flag determines if the `adjustElementsSize` method call was made during * the render suspending. If true, the method has to be triggered once after render * resuming. * * @private * @type {boolean} */ postponedAdjustElementsSize: boolean; /** * @param {Hanstontable} hotInstance Instance of {@link Handsontable}. */ constructor(hotInstance: HotInstance); /** * Renders WalkontableUI. */ render(): void; /** * Adjust overlays elements size and master table size. By default the internal `adjustElementsSize` * call of the Walkontable is postponed to the next render cycle. If `flush` is set to `true`, the method * will be executed immediately. * * TODO: This method should not exist. It is a workaround for the issue with updating the elements * size after render. It should be calculated and updated automatically in Walkontable. * * @param {boolean} [flush=false] If `true`, the method will be executed immediately. */ adjustElementsSize(flush?: boolean): void; /** * Returns td object given coordinates. * * @param {CellCoords} coords Renderable cell coordinates. * @param {boolean} topmost Indicates whether the cell should be calculated from the topmost. * @returns {HTMLTableCellElement|null} */ getCellAtCoords(coords: { row: number; col: number; }, topmost: boolean): number | HTMLTableCellElement | null; /** * Scroll viewport to a cell. * * @param {CellCoords} coords Renderable cell coordinates. * @param {'auto' | 'start' | 'end'} [horizontalSnap] If `'start'`, viewport is scrolled to show * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport. * @param {'auto' | 'top' | 'bottom'} [verticalSnap] If `'top'`, viewport is scrolled to show * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of * the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport. * @returns {boolean} */ scrollViewport(coords: { row: number; col: number; }, horizontalSnap?: string, verticalSnap?: string): boolean; /** * Scroll viewport to a column. * * @param {number} column Renderable column index. * @param {'auto' | 'start' | 'end'} [snap] If `'start'`, viewport is scrolled to show * the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of * the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport. * @returns {boolean} */ scrollViewportHorizontally(column: number, snap: string): boolean; /** * Scroll viewport to a row. * * @param {number} row Renderable row index. * @param {'auto' | 'top' | 'bottom'} [snap] If `'top'`, viewport is scrolled to show * the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on * the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of * the viewport. * @returns {boolean} */ scrollViewportVertically(row: number, snap: string): boolean; /** * Prepares DOMElements and adds correct className to the root element. * * @private */ createElements(): void; /** * Attaches necessary listeners. * * @private */ registerEvents(): void; /** * Invalidates Walkontable viewport caches for row heights and column widths (per-index axis sizes). */ invalidateIndexSizesCache(): void; /** * Invalidates Walkontable viewport cache for column widths. */ invalidateColumnWidthCache(): void; /** * Invalidates Walkontable viewport cache for row heights. */ invalidateRowHeightCache(): void; /** * Translate renderable cell coordinates to visual coordinates. * * @param {CellCoords} coords The cell coordinates. * @returns {CellCoords} */ translateFromRenderableToVisualCoords({ row, col }: { row: number; col: number; }): import("./base").CellCoords; /** * Translate renderable row and column indexes to visual row and column indexes. * * @param {number} renderableRow Renderable row index. * @param {number} renderableColumn Renderable columnIndex. * @returns {number[]} */ translateFromRenderableToVisualIndex(renderableRow: number, renderableColumn: number): [number, number]; /** * Returns the number of renderable indexes. * * @private * @param {IndexMapper} indexMapper The IndexMapper instance for specific axis. * @param {number} maxElements Maximum number of elements (rows or columns). * * @returns {number|*} */ countRenderableIndexes(indexMapper: import('./translations').IndexMapper, maxElements: number): number; /** * Returns the number of renderable columns. * * @returns {number} */ countRenderableColumns(): number; /** * Returns the number of renderable rows. * * @returns {number} */ countRenderableRows(): number; /** * Returns number of not hidden row indexes counting from the passed starting index. * The counting direction can be controlled by `incrementBy` argument. * * @param {number} visualIndex The visual index from which the counting begins. * @param {number} incrementBy If `-1` then counting is backwards or forward when `1`. * @returns {number} */ countNotHiddenRowIndexes(visualIndex: number, incrementBy: number): number; /** * Returns number of not hidden column indexes counting from the passed starting index. * The counting direction can be controlled by `incrementBy` argument. * * @param {number} visualIndex The visual index from which the counting begins. * @param {number} incrementBy If `-1` then counting is backwards or forward when `1`. * @returns {number} */ countNotHiddenColumnIndexes(visualIndex: number, incrementBy: number): number; /** * Returns number of not hidden indexes counting from the passed starting index. * The counting direction can be controlled by `incrementBy` argument. * * @param {number} visualIndex The visual index from which the counting begins. * @param {number} incrementBy If `-1` then counting is backwards or forward when `1`. * @param {IndexMapper} indexMapper The IndexMapper instance for specific axis. * @param {number} renderableIndexesCount Total count of renderable indexes for specific axis. * @returns {number} */ countNotHiddenIndexes(visualIndex: number, incrementBy: number, indexMapper: import('./translations').IndexMapper, renderableIndexesCount: number): number; /** * The function returns the number of not hidden column indexes that fit between the first and * last fixed column in the left (or right in RTL mode) overlay. * * @returns {number} */ countNotHiddenFixedColumnsStart(): number; /** * The function returns the number of not hidden row indexes that fit between the first and * last fixed row in the top overlay. * * @returns {number} */ countNotHiddenFixedRowsTop(): number; /** * The function returns the number of not hidden row indexes that fit between the first and * last fixed row in the bottom overlay. * * @returns {number} */ countNotHiddenFixedRowsBottom(): number; /** * The function returns the number of renderable column indexes within the passed range of the visual indexes. * * @param {number} columnStart The column visual start index. * @param {number} columnEnd The column visual end index. * @returns {number} */ countRenderableColumnsInRange(columnStart: number, columnEnd: number): number; /** * The function returns the number of renderable row indexes within the passed range of the visual indexes. * * @param {number} rowStart The row visual start index. * @param {number} rowEnd The row visual end index. * @returns {number} */ countRenderableRowsInRange(rowStart: number, rowEnd: number): number; /** * Checks if at least one cell than belongs to the main table is not covered by the top, left or * bottom overlay. * * @returns {boolean} */ isMainTableNotFullyCoveredByOverlays(): boolean; /** * Defines default configuration and initializes WalkOnTable instance. * * @private */ initializeWalkontable(): void; /** * Checks if it's possible to create text selection in element. * * @private * @param {HTMLElement} el The element to check. * @returns {boolean} */ isTextSelectionAllowed(el: HTMLElement): boolean; /** * Checks if user's been called mousedown. * * @private * @returns {boolean} */ isMouseDown(): boolean; /** * Checks if active cell is editing. * * @private * @returns {boolean} */ isCellEdited(): boolean | undefined; /** * `beforeDraw` callback. * * @private * @param {boolean} force If `true` rendering was triggered by a change of settings or data or `false` if * rendering was triggered by scrolling or moving selection. * @param {object} skipRender Object with `skipRender` property, if it is set to `true ` the next rendering * cycle will be skipped. */ beforeRender(force: boolean, skipRender: boolean): void; /** * `afterRender` callback. * * @private * @param {boolean} force If `true` rendering was triggered by a change of settings or data or `false` if * rendering was triggered by scrolling or moving selection. */ afterRender(force: boolean): void; /** * Append row header to a TH element. * * @private * @param {number} visualRowIndex The visual row index. * @param {HTMLTableHeaderCellElement} TH The table header element. */ appendRowHeader(visualRowIndex: number, TH: HTMLTableCellElement): void; /** * Append column header to a TH element. * * @private * @param {number} visualColumnIndex Visual column index. * @param {HTMLTableCellElement} TH The table header element. * @param {Function} [label] The function that returns the header label. * @param {number} [headerLevel=0] The index of header level counting from the top (positive * values counting from 0 to N). */ appendColHeader(visualColumnIndex: number, TH: HTMLTableCellElement, label?: (column?: number, headerLevel?: number) => string | string[], headerLevel?: number): void; /** * Updates header cell content. * * @private * @param {HTMLElement} element Element to update. * @param {number} index Row index or column index. * @param {Function} content Function which should be returns content for this cell. * @param {number} [headerLevel=0] The index of header level counting from the top (positive * values counting from 0 to N). */ updateCellHeader(element: HTMLElement, index: number, content: (index: number, headerLevel?: number) => unknown, headerLevel?: number): void; /** * Given a element's left (or right in RTL mode) position relative to the viewport, returns maximum * element width until the right (or left) edge of the viewport (before scrollbar). * * @private * @param {number} inlineOffset The left (or right in RTL mode) offset. * @returns {number} */ maximumVisibleElementWidth(inlineOffset: number): number; /** * Given a element's top position relative to the viewport, returns maximum element height until the bottom * edge of the viewport (before scrollbar). * * @private * @param {number} topOffset The top offset. * @returns {number} */ maximumVisibleElementHeight(topOffset: number): number; /** * Sets new dimensions of the container. * * @param {number} width The table width. * @param {number} height The table height. */ setLastSize(width: number, height: number): void; /** * Returns cached dimensions. * * @returns {object} */ getLastSize(): { width: number; height: number; }; /** * Returns the first rendered row in the DOM (usually is not visible in the table's viewport). * * @returns {number | null} */ getFirstRenderedVisibleRow(): number | null; /** * Returns the last rendered row in the DOM (usually is not visible in the table's viewport). * * @returns {number | null} */ getLastRenderedVisibleRow(): number | null; /** * Returns the first rendered column in the DOM (usually is not visible in the table's viewport). * * @returns {number | null} */ getFirstRenderedVisibleColumn(): number | null; /** * Returns the last rendered column in the DOM (usually is not visible in the table's viewport). * * @returns {number | null} */ getLastRenderedVisibleColumn(): number | null; /** * Returns the first fully visible row in the table viewport. When the table has overlays the method returns * the first row of the master table that is not overlapped by overlay. * * @returns {number} */ getFirstFullyVisibleRow(): number | null; /** * Returns the last fully visible row in the table viewport. When the table has overlays the method returns * the first row of the master table that is not overlapped by overlay. * * @returns {number} */ getLastFullyVisibleRow(): number | null; /** * Returns the first fully visible column in the table viewport. When the table has overlays the method returns * the first row of the master table that is not overlapped by overlay. * * @returns {number} */ getFirstFullyVisibleColumn(): number | null; /** * Returns the last fully visible column in the table viewport. When the table has overlays the method returns * the first row of the master table that is not overlapped by overlay. * * @returns {number} */ getLastFullyVisibleColumn(): number | null; /** * Returns the first partially visible row in the table viewport. When the table has overlays the method returns * the first row of the master table that is not overlapped by overlay. * * @returns {number} */ getFirstPartiallyVisibleRow(): number | null; /** * Returns the last partially visible row in the table viewport. When the table has overlays the method returns * the first row of the master table that is not overlapped by overlay. * * @returns {number} */ getLastPartiallyVisibleRow(): number | null; /** * Returns the first partially visible column in the table viewport. When the table has overlays the method returns * the first row of the master table that is not overlapped by overlay. * * @returns {number} */ getFirstPartiallyVisibleColumn(): number | null; /** * Returns the last partially visible column in the table viewport. When the table has overlays the method returns * the first row of the master table that is not overlapped by overlay. * * @returns {number} */ getLastPartiallyVisibleColumn(): number | null; /** * Returns the total count of the rendered column headers. * * @returns {number} */ getColumnHeadersCount(): number; /** * Returns the total count of the rendered row headers. * * @returns {number} */ getRowHeadersCount(): number; /** * Returns the table's viewport width. When the table has defined the size of the container, * and the columns do not fill the entire viewport, the viewport width is equal to the sum of * the columns' widths. * * @returns {number} */ getViewportWidth(): number; /** * Returns the table's total width including the scrollbar width. * * @returns {number} */ getWorkspaceWidth(): number; /** * Returns the table's viewport height. When the table has defined the size of the container, * and the rows do not fill the entire viewport, the viewport height is equal to the sum of * the rows' heights. * * @returns {number} */ getViewportHeight(): number; /** * Returns the table's total height including the scrollbar height. * * @returns {number} */ getWorkspaceHeight(): number; /** * Checks to what overlay the provided element belongs. * * @param {HTMLElement} element The DOM element to check. * @returns {'master'|'inline_start'|'top'|'top_inline_start_corner'|'bottom'|'bottom_inline_start_corner'} */ getElementOverlayName(element: HTMLElement): string; /** * Gets the overlay instance by its name. * * @param {'inline_start'|'top'|'top_inline_start_corner'|'bottom'|'bottom_inline_start_corner'} overlayName The overlay name. * @returns {Overlay | null} */ getOverlayByName(overlayName: string): import("./3rdparty/walkontable/src/overlay").Overlay | WalkontableInstance | null; /** * Gets the name of the overlay that currently renders the table. If the method is called out of the render cycle * the 'master' name is returned. * * @returns {string} */ getActiveOverlayName(): string; /** * Checks if the table is visible or not. * * @returns {boolean} */ isVisible(): boolean; /** * Checks if the table has a horizontal scrollbar. * * @returns {boolean} */ hasVerticalScroll(): boolean; /** * Checks if the table has a vertical scrollbar. * * @returns {boolean} */ hasHorizontalScroll(): boolean; /** * Gets table's width. The returned width is the width of the rendered cells that fit in the * current viewport. The value may change depends on the viewport position (scroll position). * * @returns {boolean} */ getTableWidth(): number; /** * Gets table's height. The returned height is the height of the rendered cells that fit in the * current viewport. The value may change depends on the viewport position (scroll position). * * @returns {boolean} */ getTableHeight(): number; /** * Gets table's total width. The returned width is the width of all rendered cells (including headers) * that can be displayed in the table. * * @returns {boolean} */ getTotalTableWidth(): number; /** * Gets table's total height. The returned height is the height of all rendered cells (including headers) * that can be displayed in the table. * * @returns {boolean} */ getTotalTableHeight(): number; /** * Gets the table's offset. * * @returns {{ left: number, top: number }} */ getTableOffset(): { left: number; top: number; }; /** * Gets the current scroll position of the table. * * @returns {{ left: number, top: number }} The current scroll position. */ getTableScrollPosition(): { left: number; top: number; }; /** * Sets the table's scroll position. * * @param {{ left: number, top: number }} position The scroll position. */ setTableScrollPosition(position: Record