The lifecycle handle returned by createGridController: the live grid, a theme passthrough, and a single teardown that detaches every subscription and destroys the grid.
The lifecycle handle returned by createGridController: the live grid,
a theme passthrough, and a single teardown that detaches every subscription
and destroys the grid.
Package
@sheetwrite/core/adapter
Source
packages/core/src/grid-controller.ts#L43
Members 7
gridThe imperative core grid this controller owns.
readonly grid: Gridinterface Grid {
readonly store: Store;
readonly actions: GridActions;
setActiveSheet(id: SheetId): void;
scrollToCell(addr: CellAddress): void;
getCellAtPoint(
clientX: number,
clientY: number,
): CellAddress | null;
getActiveSheet(): SheetId;
getCellInput(row: number, col: number): CellInputSnapshot | null;
getSelection(): Selection | null;
setSelection(sel: Selection | null): void;
setTheme(theme: Partial<Theme>): void;
replaceTheme(theme: Partial<Theme> | undefined): void;
// … 106 more lines — see the API reference
}interfaceGrid {readonlystore:Store;readonlyactions:GridActions;setActiveSheet(id:SheetId):void;scrollToCell(addr:CellAddress):void;getCellAtPoint(clientX:number,clientY:number,):CellAddress|null;getActiveSheet():SheetId;getCellInput(row:number, col:number):CellInputSnapshot|null;getSelection():Selection|null;setSelection(sel:Selection|null):void;setTheme(theme:Partial<Theme>):void;replaceTheme(theme:Partial<Theme> |undefined):void;// … 106 more lines — see the API reference}interfaceGrid {readonlystore:Store;readonlyactions:GridActions;setActiveSheet(id:SheetId,):void;scrollToCell(addr:CellAddress,):void;getCellAtPoint(clientX:number,clientY:number,):CellAddress|null;getActiveSheet():SheetId;getCellInput(row:number,col:number,):CellInputSnapshot|null;getSelection():Selection|null;// … 229 more lines — see the API reference}Imperative grid handle for document commands, events, rendering, and teardown.API reference →;
setThemeApply the host's declarative theme prop: option-level replacement via Grid.replaceTheme; undefined restores CSS/default resolution.
setReadOnlyUpdate editability without replacing the owned grid.
setReadOnly(readOnly: boolean): void;
setConfigUpdate built-in chrome and keyboard configuration without replacing the grid.
setConfig(config: GridConfiginterface GridConfig {
toolbar?: boolean | ToolbarItem[];
bold?: boolean;
italic?: boolean;
align?: boolean;
textColor?: boolean;
fillColor?: boolean;
border?: boolean;
clearFormat?: boolean;
merge?: boolean;
sort?: boolean;
export?: boolean;
icons?: Partial<Record<ToolbarActionName, ToolbarIcon>>;
contextMenu?: boolean | ContextMenuItems;
undo?: boolean;
// … 4 more lines — see the API reference
}interfaceGridConfig {toolbar?:boolean|ToolbarItem[];bold?:boolean;italic?:boolean;align?:boolean;textColor?:boolean;fillColor?:boolean;border?:boolean;clearFormat?:boolean;merge?:boolean;sort?:boolean;export?:boolean;icons?:Partial<Record<ToolbarActionName, ToolbarIcon>>;contextMenu?:boolean|ContextMenuItems;undo?:boolean;// … 4 more lines — see the API reference}interfaceGridConfig {toolbar?:boolean|ToolbarItem[];bold?:boolean;italic?:boolean;align?:boolean;textColor?:boolean;fillColor?:boolean;border?:boolean;clearFormat?:boolean;merge?:boolean;sort?:boolean;export?:boolean;icons?:Partial<Record<ToolbarActionName,ToolbarIcon>>;// … 12 more lines — see the API reference}Toolbar / feature configuration. When config is set the built-in toolbar is shown; control flags default to true except the opt-in export flag.API reference →|undefined): void;
setOverscanLive-update the render overscan without replacing the grid; undefined restores the default.
setOverscan(overscan: number |undefined): void;
setMinColumnsLive-update the minimum rendered column count without emitting user edits.
setMinColumns(minColumns: number |undefined): void;
destroyDetach every event subscription and destroy the grid.
destroy(): void;
Detach every event subscription and destroy the grid. Call exactly once.
Declaration
View full TypeScript declaration
exportinterfaceGridController {
readonlygrid:Gridinterface Grid {
readonly store: Store;
readonly actions: GridActions;
setActiveSheet(id: SheetId): void;
scrollToCell(addr: CellAddress): void;
getCellAtPoint(
clientX: number,
clientY: number,
): CellAddress | null;
getActiveSheet(): SheetId;
getCellInput(row: number, col: number): CellInputSnapshot | null;
getSelection(): Selection | null;
setSelection(sel: Selection | null): void;
setTheme(theme: Partial<Theme>): void;
replaceTheme(theme: Partial<Theme> | undefined): void;
// … 106 more lines — see the API reference
}interfaceGrid {readonlystore:Store;readonlyactions:GridActions;setActiveSheet(id:SheetId):void;scrollToCell(addr:CellAddress):void;getCellAtPoint(clientX:number,clientY:number,):CellAddress|null;getActiveSheet():SheetId;getCellInput(row:number, col:number):CellInputSnapshot|null;getSelection():Selection|null;setSelection(sel:Selection|null):void;setTheme(theme:Partial<Theme>):void;replaceTheme(theme:Partial<Theme> |undefined):void;// … 106 more lines — see the API reference}interfaceGrid {readonlystore:Store;readonlyactions:GridActions;setActiveSheet(id:SheetId,):void;scrollToCell(addr:CellAddress,):void;getCellAtPoint(clientX:number,clientY:number,):CellAddress|null;getActiveSheet():SheetId;getCellInput(row:number,col:number,):CellInputSnapshot|null;getSelection():Selection|null;// … 229 more lines — see the API reference}Imperative grid handle for document commands, events, rendering, and teardown.API reference →;
setConfig(config:GridConfiginterface GridConfig {
toolbar?: boolean | ToolbarItem[];
bold?: boolean;
italic?: boolean;
align?: boolean;
textColor?: boolean;
fillColor?: boolean;
border?: boolean;
clearFormat?: boolean;
merge?: boolean;
sort?: boolean;
export?: boolean;
icons?: Partial<Record<ToolbarActionName, ToolbarIcon>>;
contextMenu?: boolean | ContextMenuItems;
undo?: boolean;
// … 4 more lines — see the API reference
}interfaceGridConfig {toolbar?:boolean|ToolbarItem[];bold?:boolean;italic?:boolean;align?:boolean;textColor?:boolean;fillColor?:boolean;border?:boolean;clearFormat?:boolean;merge?:boolean;sort?:boolean;export?:boolean;icons?:Partial<Record<ToolbarActionName, ToolbarIcon>>;contextMenu?:boolean|ContextMenuItems;undo?:boolean;// … 4 more lines — see the API reference}interfaceGridConfig {toolbar?:boolean|ToolbarItem[];bold?:boolean;italic?:boolean;align?:boolean;textColor?:boolean;fillColor?:boolean;border?:boolean;clearFormat?:boolean;merge?:boolean;sort?:boolean;export?:boolean;icons?:Partial<Record<ToolbarActionName,ToolbarIcon>>;// … 12 more lines — see the API reference}Toolbar / feature configuration. When config is set the built-in toolbar is shown; control flags default to true except the opt-in export flag.API reference →|undefined):void;