import Handsontable from 'handsontable/base'; import { ComponentType, FC, PropsWithChildren } from 'react'; import { ScopeIdentifier, HotRendererProps } from './types'; import { RenderersPortalManagerRef } from './renderersPortalManager'; export interface HotTableContextImpl { /** * Map with column indexes (or a string = 'global') as keys, and booleans as values. Each key represents a component-based editor * declared for the used column index, or a global one, if the key is the `global` string. */ readonly componentRendererColumns: Map; /** * Array of object containing the column settings. */ readonly columnsSettings: Handsontable.ColumnSettings[]; /** * Sets the column settings based on information received from HotColumn. * * @param {HotTableProps} columnSettings Column settings object. * @param {number} columnIndex Column index. */ readonly emitColumnSettings: (columnSettings: Handsontable.ColumnSettings, columnIndex: number) => void; /** * Trim the column settings array to the given length. Used to drop slots * left over from HotColumn children that have unmounted. * * @param {number} length Target length for the column settings array. */ readonly trimColumnSettings: (length: number) => void; /** * Return a renderer wrapper function for the provided renderer component. * * @param {ComponentType} Renderer React renderer component. * @returns {Handsontable.renderers.BaseRenderer} The Handsontable rendering function. */ readonly getRendererWrapper: (Renderer: ComponentType) => typeof Handsontable.renderers.BaseRenderer; /** * Starts a view-render pass: forgets which portal containers the previous pass rendered. */ readonly resetRenderedPortals: () => void; /** * Records a cell element the grid painted in the current view-render pass, whatever its renderer. * * @param {HTMLTableCellElement} TD The painted cell element. */ readonly markCellPainted: (TD: HTMLTableCellElement) => void; /** * Returns the number of portal containers currently retained by the cache. * Diagnostic hook used to assert the cache stays bounded to the viewport * (it must not grow with the total scrolled row/column count). * * @returns {number} The portal container cache size. */ readonly getPortalContainerCacheSize: () => number; /** * Set the renderers portal manager dispatch function. * * @param {RenderersPortalManagerRef} pm The PortalManager dispatch function. */ readonly setRenderersPortalManagerRef: (pm: RenderersPortalManagerRef) => void; /** * Evicts the portals of the cells that left the grid and puts the rest into the portal manager. */ readonly pushCellPortalsIntoPortalManager: () => void; } declare const HotTableContextProvider: FC; /** * Exposes the table context object to components * * @returns {HotTableContextImpl} HotTableContext */ declare function useHotTableContext(): HotTableContextImpl; export { HotTableContextProvider, useHotTableContext };