Imperative grid handle for document commands, events, rendering, and teardown.
Package
@sheetwrite/react
Source
packages/core/dist/types/grid.d.ts#L289
Members 81
store
readonly store: Storeinterface Store {
getWorkbook(): Workbook;
getCell(addr: CellAddress): ResolvedCell;
getFormula(addr: CellAddress): string | null;
getRefTarget(addr: CellAddress): CellAddress | null;
recalculateVolatile(now?: Date): void;
getVisibleWindow(
sheet: SheetId,
rows: { start: number; end: number },
cols: readonly number[],
): VisibleWindowView;
getDataWindow?(
sheet: SheetId,
rows: { start: number; end: number },
cols: readonly number[],
// … 22 more lines — see the API reference
}interfaceStore {getWorkbook():Workbook;getCell(addr:CellAddress):ResolvedCell;getFormula(addr:CellAddress):string|null;getRefTarget(addr:CellAddress):CellAddress|null;recalculateVolatile(now?:Date):void;getVisibleWindow(sheet:SheetId,rows: { start:number; end:number },cols:readonlynumber[],):VisibleWindowView;getDataWindow?(sheet:SheetId,rows: { start:number; end:number },cols:readonlynumber[],// … 22 more lines — see the API reference}interfaceStore {getWorkbook():Workbook;getCell(addr:CellAddress,):ResolvedCell;getFormula(addr:CellAddress,):string|null;getRefTarget(addr:CellAddress,):CellAddress|null;recalculateVolatile(now?:Date,):void;getVisibleWindow(sheet:SheetId,rows: {start:number;end:number;// … 53 more lines — see the API reference}Columnar workbook storage, query, transaction, and subscription contract.API reference →;
actionsImperative action surface for binding custom toolbars/menus.
readonly actions: GridActionsinterface GridActions {
toggleBold(): void;
toggleItalic(): void;
toggleUnderline(): void;
toggleStrikethrough(): void;
setAlign(align: CellAlign): void;
setTextColor(color: string): void;
setFillColor(color: string): void;
toggleBorder(): void;
clearFormat(): void;
merge(): void;
unmerge(): void;
sort(ascending: boolean): void;
insertRowAbove(): void;
insertRowBelow(): void;
// … 21 more lines — see the API reference
}interfaceGridActions {toggleBold():void;toggleItalic():void;toggleUnderline():void;toggleStrikethrough():void;setAlign(align:CellAlign):void;setTextColor(color:string):void;setFillColor(color:string):void;toggleBorder():void;clearFormat():void;merge():void;unmerge():void;sort(ascending:boolean):void;insertRowAbove():void;insertRowBelow():void;// … 21 more lines — see the API reference}interfaceGridActions {toggleBold():void;toggleItalic():void;toggleUnderline():void;toggleStrikethrough():void;setAlign(align:CellAlign,):void;setTextColor(color:string,):void;setFillColor(color:string,):void;toggleBorder():void;clearFormat():void;merge():void;unmerge():void;sort(ascending:boolean):void;// … 37 more lines — see the API reference}Imperative operations the toolbar and context menu bind to; also exposed as Grid.actions.API reference →;
setActiveSheet
setActiveSheet(id: SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →): void;
scrollToCell
scrollToCell(addr: CellAddressinterface CellAddress {
sheet: SheetId;
row: number;
col: number;
}interfaceCellAddress {sheet:SheetId;row:number;col:number;}interfaceCellAddress {sheet:SheetId;row:number;col:number;}Zero-based address of one cell on a stable sheet ID.API reference →): void;
getCellAtPointResolve browser viewport coordinates to an active-sheet cell for host-owned menus and interactions.
getCellAtPoint(clientX: number, clientY: number): CellAddressinterface CellAddress {
sheet: SheetId;
row: number;
col: number;
}interfaceCellAddress {sheet:SheetId;row:number;col:number;}interfaceCellAddress {sheet:SheetId;row:number;col:number;}Zero-based address of one cell on a stable sheet ID.API reference →|null;
Resolve browser viewport coordinates to an active-sheet cell for host-owned
menus and interactions. Returns null outside the cell body.
getActiveSheetId of the currently visible sheet.
getActiveSheet(): SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →;
getCellInputEditable snapshot of the cell at a view position on the active sheet, or null when out of bounds.
getCellInput(row: number, col: number): CellInputSnapshotinterface CellInputSnapshot {
readonly address: CellAddress;
readonly text: string;
readonly format: CellFormat;
}interfaceCellInputSnapshot {readonlyaddress:CellAddress;readonlytext:string;readonlyformat:CellFormat;}interfaceCellInputSnapshot {readonlyaddress:CellAddress;readonlytext:string;readonlyformat:CellFormat;}View-aware editable snapshot of one cell, for hosts building a detached formula bar or cell inspector. address is the translated *data* address — the correct target for Grid.applyTransaction even under an active sort/filter view — while the (row, col) inputs of Grid.getCellInput are active-sheet view coordinates.API reference →|null;
Editable snapshot of the cell at a view position on the active sheet, or
null when out of bounds. See CellInputSnapshot.
Option-level replacement: re-run construction-time resolution
(`DEFAULT_THEME < CSS custom properties < theme`) with the new partial.
`undefined` restores the CSS-variable/default resolution. Adapters call
this for their declarative `theme` prop; imperative patching stays on
setTheme.
getEffectiveThemeThe effective (post-zoom) theme the renderer is currently painting with.
setReadOnlyUpdate editability without replacing the Grid or clearing session state.
setReadOnly(readOnly: boolean): void;
setConfigReconfigure built-in chrome and keyboard handling without replacing the Grid or clearing selection/history.
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;
Reconfigure built-in chrome and keyboard handling without replacing the
Grid or clearing selection/history. Construction-bound GridOptions are not
accepted here.
applyTransactionApply arbitrary patches as one undoable Grid commit.
applyTransaction(transaction: GridTransactioninterface GridTransaction {
patches: DocumentOp[];
}interfaceGridTransaction {patches:DocumentOp[];}interfaceGridTransaction {patches:DocumentOp[];}An undoable transaction submitted through a Grid. Grid transactions deliberately have no epoch: optimistic reconciliation is a low-level Store concern, while Grid commits are normal host-driven edits that participate in read-only policy and undo/redo history.API reference →): ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
Apply arbitrary patches as one undoable Grid commit. No-op when read-only.
Use `Store.applyTransaction` only for low-level writes that intentionally
bypass Grid history and policy.
exportSnapshotDeterministically export the complete authoritative workbook document.
search(query: string, opts?:SearchOptionsinterface SearchOptions {
matchCase?: boolean;
wholeCell?: boolean;
sheet?: SheetId;
columns?: number[];
}interfaceSearchOptions {matchCase?:boolean;wholeCell?:boolean;sheet?:SheetId;columns?:number[];}interfaceSearchOptions {matchCase?:boolean;wholeCell?:boolean;sheet?:SheetId;columns?:number[];}Case, whole-cell, sheet, and column constraints for grid search.API reference →): SearchResultinterface SearchResult {
query: string;
matches: CellAddress[];
active: number;
}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}Ordered matches and active index produced by a grid search.API reference →;
findNextMove the active match to the next match and scroll it into view.
findNext(): SearchResultinterface SearchResult {
query: string;
matches: CellAddress[];
active: number;
}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}Ordered matches and active index produced by a grid search.API reference →;
findPrevMove the active match to the previous match and scroll it into view.
findPrev(): SearchResultinterface SearchResult {
query: string;
matches: CellAddress[];
active: number;
}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}Ordered matches and active index produced by a grid search.API reference →;
clearSearchClear the current search and its highlights.
clearSearch(): void;
replaceCurrentReplace the active match with replacement, then advance to the next match (re-scanning against the new data).
replaceCurrent(replacement: string): SearchResultinterface SearchResult {
query: string;
matches: CellAddress[];
active: number;
}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}Ordered matches and active index produced by a grid search.API reference →;
Replace the active match with `replacement`, then advance to the next match
(re-scanning against the new data). Only literal text/number cells are
eligible; formula and ref cells are skipped (formula source is never
rewritten). Honors the active SearchOptions (matchCase; `wholeCell`
swaps the entire cell). The write flows through the grid's commit path as
one undoable step. No-op when read-only or when there is no active match.
replaceAllReplace every current match in a single undoable transaction (one undo() restores them all), then re-scan.
replaceAll(replacement: string): ReplaceResultinterface ReplaceResult {
replaced: number;
result: SearchResult;
}interfaceReplaceResult {replaced:number;result:SearchResult;}interfaceReplaceResult {replaced:number;result:SearchResult;}Replacement count and refreshed search state returned by replace-all.API reference →;
Replace every current match in a single undoable transaction (one
`undo()` restores them all), then re-scan. Formula/ref cells are skipped
and not counted. No-op when read-only.
insertRows
insertRows(at: number, count?: number): void;
removeRows
removeRows(at: number, count?: number): void;
insertColumns
insertColumns(at: number, count?: number): void;
removeColumns
removeColumns(at: number, count?: number): void;
addSheetAdd a sheet with a stable ID and make it available to the tab bar.
addSheet(input: AddSheetInput): SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →;
removeSheetRemove a sheet; at least one sheet always remains.
removeSheet(id: SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →): void;
renameSheet
renameSheet(id: SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →, name: string): void;
moveSheet
moveSheet(id: SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →, toIndex: number): void;
setConditionalFormats
setConditionalFormats(rules: readonly ConditionalFormatRuleinterface ConditionalFormatRule {
range: Range;
when: ConditionalFormatPredicate;
style: CellStyle;
}interfaceConditionalFormatRule {range:Range;when:ConditionalFormatPredicate;style:CellStyle;}interfaceConditionalFormatRule {range:Range;when:ConditionalFormatPredicate;style:CellStyle;}Ordered condition and style applied to a cell range.API reference →[]): void;
setValidationRule
setValidationRule(rule: DataValidationRuleinterface DataValidationRule {
id: string;
range: Range;
condition: DataValidationCondition;
policy: ValidationPolicy;
allowBlank?: boolean;
helpText?: string;
}interfaceDataValidationRule {id:string;range:Range;condition:DataValidationCondition;policy:ValidationPolicy;allowBlank?:boolean;helpText?:string;}interfaceDataValidationRule {id:string;range:Range;condition:DataValidationCondition;policy:ValidationPolicy;allowBlank?:boolean;helpText?:string;}One stable, range-scoped data-entry rule. Blank cells are allowed unless disabled.API reference →): ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
removeValidationRule
removeValidationRule(id: string): ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
setProtectedRange
setProtectedRange(protectedRange: ProtectedRangeinterface ProtectedRange {
id: string;
range: Range;
label?: string;
permissionKey?: string;
}interfaceProtectedRange {id:string;range:Range;label?:string;permissionKey?:string;}interfaceProtectedRange {id:string;range:Range;label?:string;permissionKey?:string;}Serializable client UX policy. A host resolver decides whether a local mutation may proceed.API reference →): ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
removeProtectedRange
removeProtectedRange(id: string): ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
styleRangeMerge style into every cell of range (null clears cell styles) as one undoable transaction.
styleRange(range: Rangeinterface Range {
sheet: SheetId;
start: { row: number; col: number };
end: { row: number; col: number };
}interfaceRange {sheet:SheetId;start: { row:number; col:number };end: { row:number; col:number };}interfaceRange {sheet:SheetId;start: {row:number;col:number;};end: {row:number;col:number;};}Inclusive rectangular cell range on a stable sheet ID.API reference →, style: Partial<CellStyleinterface CellStyle {
bold?: boolean;
italic?: boolean;
underline?: boolean;
strikethrough?: boolean;
fontSize?: number;
color?: string;
backgroundColor?: string;
align?: CellAlign;
wrap?: boolean;
border?: CellBorders;
}interfaceCellStyle {bold?:boolean;italic?:boolean;underline?:boolean;strikethrough?:boolean;fontSize?:number;color?:string;backgroundColor?:string;align?:CellAlign;wrap?:boolean;border?:CellBorders;}interfaceCellStyle {bold?:boolean;italic?:boolean;underline?:boolean;strikethrough?:boolean;fontSize?:number;color?:string;backgroundColor?:string;align?:CellAlign;wrap?:boolean;border?:CellBorders;}Serializable formatting applied to a cell or used as a column default.API reference →>|null): void;
Merge `style` into every cell of `range` (null clears cell styles) as one
undoable transaction. Styles land in the store and paint in the canvas —
unlike highlightCells, which draws a translucent overlay above it.
beginEditOpen the cell editor at a view cell, optionally seeding text / selecting all.
dataEdgeCtrl+Arrow-style jump target: the data-run edge from (row, col) on the moved axis (row for vertical moves, col for horizontal), or null when the store is not columnar.
dataEdge(row: number, col: number, dRow: number, dCol: number): number |null;
Ctrl+Arrow-style jump target: the data-run edge from (row, col) on the
moved axis (row for vertical moves, col for horizontal), or null when the
store is not columnar. Under an active sort/filter view, `row` is a view
position and vertical moves return view positions. For hosts building
their own keymaps (`config.keyboard`).
setRowHeightSet one row's persistent display height through document history.
setRowHeight(row: number, height: number): void;
setColumnWidthSet one column's width via an undoable setColumn patch.
setColumnWidth(col: number, width: number): void;
autoFitRowsExplicitly resize rows to fit wrapped content; never runs during paint.
autoFitRows(range?:Rangeinterface Range {
sheet: SheetId;
start: { row: number; col: number };
end: { row: number; col: number };
}interfaceRange {sheet:SheetId;start: { row:number; col:number };end: { row:number; col:number };}interfaceRange {sheet:SheetId;start: {row:number;col:number;};end: {row:number;col:number;};}Inclusive rectangular cell range on a stable sheet ID.API reference →): void;
autoFitColumnsExplicitly resize columns from a bulk worksheet read.
autoFitColumns(cols?: readonly number[]): void;
setFrozenPin the first rows view rows and cols columns; they stay visible while the body scrolls (0 = unfreeze that axis).
setFrozen(rows: number, cols?: number): void;
Pin the first `rows` view rows and `cols` columns; they stay visible while
the body scrolls (0 = unfreeze that axis). Persisted on the active sheet.
setZoomContent zoom factor (0.5–2): scales row/column geometry and fonts.
setZoom(zoom: number): void;
getZoom
getZoom(): number;
rendererKindWhich renderer is actually active: "worker" when the OffscreenCanvas worker constructed successfully, "canvas" otherwise (including after a renderer-fallback).
readonlystore:Storeinterface Store {
getWorkbook(): Workbook;
getCell(addr: CellAddress): ResolvedCell;
getFormula(addr: CellAddress): string | null;
getRefTarget(addr: CellAddress): CellAddress | null;
recalculateVolatile(now?: Date): void;
getVisibleWindow(
sheet: SheetId,
rows: { start: number; end: number },
cols: readonly number[],
): VisibleWindowView;
getDataWindow?(
sheet: SheetId,
rows: { start: number; end: number },
cols: readonly number[],
// … 22 more lines — see the API reference
}interfaceStore {getWorkbook():Workbook;getCell(addr:CellAddress):ResolvedCell;getFormula(addr:CellAddress):string|null;getRefTarget(addr:CellAddress):CellAddress|null;recalculateVolatile(now?:Date):void;getVisibleWindow(sheet:SheetId,rows: { start:number; end:number },cols:readonlynumber[],):VisibleWindowView;getDataWindow?(sheet:SheetId,rows: { start:number; end:number },cols:readonlynumber[],// … 22 more lines — see the API reference}interfaceStore {getWorkbook():Workbook;getCell(addr:CellAddress,):ResolvedCell;getFormula(addr:CellAddress,):string|null;getRefTarget(addr:CellAddress,):CellAddress|null;recalculateVolatile(now?:Date,):void;getVisibleWindow(sheet:SheetId,rows: {start:number;end:number;// … 53 more lines — see the API reference}Columnar workbook storage, query, transaction, and subscription contract.API reference →;
readonlyactions:GridActionsinterface GridActions {
toggleBold(): void;
toggleItalic(): void;
toggleUnderline(): void;
toggleStrikethrough(): void;
setAlign(align: CellAlign): void;
setTextColor(color: string): void;
setFillColor(color: string): void;
toggleBorder(): void;
clearFormat(): void;
merge(): void;
unmerge(): void;
sort(ascending: boolean): void;
insertRowAbove(): void;
insertRowBelow(): void;
// … 21 more lines — see the API reference
}interfaceGridActions {toggleBold():void;toggleItalic():void;toggleUnderline():void;toggleStrikethrough():void;setAlign(align:CellAlign):void;setTextColor(color:string):void;setFillColor(color:string):void;toggleBorder():void;clearFormat():void;merge():void;unmerge():void;sort(ascending:boolean):void;insertRowAbove():void;insertRowBelow():void;// … 21 more lines — see the API reference}interfaceGridActions {toggleBold():void;toggleItalic():void;toggleUnderline():void;toggleStrikethrough():void;setAlign(align:CellAlign,):void;setTextColor(color:string,):void;setFillColor(color:string,):void;toggleBorder():void;clearFormat():void;merge():void;unmerge():void;sort(ascending:boolean):void;// … 37 more lines — see the API reference}Imperative operations the toolbar and context menu bind to; also exposed as Grid.actions.API reference →;
setActiveSheet(id:SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →):void;
scrollToCell(addr:CellAddressinterface CellAddress {
sheet: SheetId;
row: number;
col: number;
}interfaceCellAddress {sheet:SheetId;row:number;col:number;}interfaceCellAddress {sheet:SheetId;row:number;col:number;}Zero-based address of one cell on a stable sheet ID.API reference →):void;
getCellAtPoint(clientX:number, clientY:number):CellAddressinterface CellAddress {
sheet: SheetId;
row: number;
col: number;
}interfaceCellAddress {sheet:SheetId;row:number;col:number;}interfaceCellAddress {sheet:SheetId;row:number;col:number;}Zero-based address of one cell on a stable sheet ID.API reference →|null;
getActiveSheet():SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →;
getCellInput(row:number, col:number):CellInputSnapshotinterface CellInputSnapshot {
readonly address: CellAddress;
readonly text: string;
readonly format: CellFormat;
}interfaceCellInputSnapshot {readonlyaddress:CellAddress;readonlytext:string;readonlyformat:CellFormat;}interfaceCellInputSnapshot {readonlyaddress:CellAddress;readonlytext:string;readonlyformat:CellFormat;}View-aware editable snapshot of one cell, for hosts building a detached formula bar or cell inspector. address is the translated *data* address — the correct target for Grid.applyTransaction even under an active sort/filter view — while the (row, col) inputs of Grid.getCellInput are active-sheet view coordinates.API reference →|null;
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;
applyTransaction(transaction:GridTransactioninterface GridTransaction {
patches: DocumentOp[];
}interfaceGridTransaction {patches:DocumentOp[];}interfaceGridTransaction {patches:DocumentOp[];}An undoable transaction submitted through a Grid. Grid transactions deliberately have no epoch: optimistic reconciliation is a low-level Store concern, while Grid commits are normal host-driven edits that participate in read-only policy and undo/redo history.API reference →):ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
):ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
defineCellRenderer(name:string, renderer:CellRendererinterface CellRenderer {
canvas?(ctx: CanvasRenderingContext2D, c: CellPaintContext): void;
dom?(c: CellPaintContext): HTMLElement;
}interfaceCellRenderer {canvas?(ctx:CanvasRenderingContext2D, c:CellPaintContext):void;dom?(c:CellPaintContext):HTMLElement;}interfaceCellRenderer {canvas?(ctx:CanvasRenderingContext2D,c:CellPaintContext,):void;dom?(c:CellPaintContext,):HTMLElement;}Custom cell renderer hooks for the main-thread canvas or DOM overlay.API reference →):void;
aggregate(col:number, op:AggregateOptype AggregateOp = "sum" | "avg" | "min" | "max" | "count";typeAggregateOp="sum"|"avg"|"min"|"max"|"count";typeAggregateOp=|"sum"|"avg"|"min"|"max"|"count";Column aggregate operation for Grid.aggregate / Store data ops.API reference →):number;
sortBy(col:number, ascending?:boolean):void;
sortByMulti(keys:readonlySortKeyinterface SortKey {
col: number;
ascending: boolean;
}interfaceSortKey {col:number;ascending:boolean;}interfaceSortKey {col:number;ascending:boolean;}One key of a multi-column sort, applied in array order (first = primary).API reference →[]):void;
filterBy(col:number, needle:string):void;
setColumnFilter(col:number, filter:ColumnFiltertype ColumnFilter =
| { kind: "values"; values: readonly CellScalar[] }
| { kind: "contains"; text: string; matchCase?: boolean }
| {
kind: "compare";
op: "gt" | "gte" | "lt" | "lte" | "eq" | "neq";
value: number;
}
| { kind: "empty" }
| { kind: "nonEmpty" };typeColumnFilter=| { kind:"values"; values:readonlyCellScalar[] }| { kind:"contains"; text:string; matchCase?:boolean }| {kind:"compare";op:"gt"|"gte"|"lt"|"lte"|"eq"|"neq";value:number;}| { kind:"empty" }| { kind:"nonEmpty" };typeColumnFilter=| {kind:"values";values:readonlyCellScalar[];}| {kind:"contains";text:string;matchCase?:boolean;}| {kind:"compare";op:|"gt"|"gte"|"lt"|"lte"|"eq"|"neq";// … 4 more lines — see the API reference}One column's filter predicate. All active column filters AND together; matching is against the cell's resolved value (text or number).API reference →|null):void;
setSort(keys:readonlySortKeyinterface SortKey {
col: number;
ascending: boolean;
}interfaceSortKey {col:number;ascending:boolean;}interfaceSortKey {col:number;ascending:boolean;}One key of a multi-column sort, applied in array order (first = primary).API reference →[]):ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
getColumnFilters():ReadonlyMap<number, ColumnFiltertype ColumnFilter =
| { kind: "values"; values: readonly CellScalar[] }
| { kind: "contains"; text: string; matchCase?: boolean }
| {
kind: "compare";
op: "gt" | "gte" | "lt" | "lte" | "eq" | "neq";
value: number;
}
| { kind: "empty" }
| { kind: "nonEmpty" };typeColumnFilter=| { kind:"values"; values:readonlyCellScalar[] }| { kind:"contains"; text:string; matchCase?:boolean }| {kind:"compare";op:"gt"|"gte"|"lt"|"lte"|"eq"|"neq";value:number;}| { kind:"empty" }| { kind:"nonEmpty" };typeColumnFilter=| {kind:"values";values:readonlyCellScalar[];}| {kind:"contains";text:string;matchCase?:boolean;}| {kind:"compare";op:|"gt"|"gte"|"lt"|"lte"|"eq"|"neq";// … 4 more lines — see the API reference}One column's filter predicate. All active column filters AND together; matching is against the cell's resolved value (text or number).API reference →>;
distinctValues(col:number, limit?:number):CellScalartype CellScalar = string | number | boolean | null;typeCellScalar=string|number|boolean|null;typeCellScalar=|string|number|boolean|null;A scalar that can be displayed directly.API reference →[];
search(query:string, opts?:SearchOptionsinterface SearchOptions {
matchCase?: boolean;
wholeCell?: boolean;
sheet?: SheetId;
columns?: number[];
}interfaceSearchOptions {matchCase?:boolean;wholeCell?:boolean;sheet?:SheetId;columns?:number[];}interfaceSearchOptions {matchCase?:boolean;wholeCell?:boolean;sheet?:SheetId;columns?:number[];}Case, whole-cell, sheet, and column constraints for grid search.API reference →):SearchResultinterface SearchResult {
query: string;
matches: CellAddress[];
active: number;
}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}Ordered matches and active index produced by a grid search.API reference →;
findNext():SearchResultinterface SearchResult {
query: string;
matches: CellAddress[];
active: number;
}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}Ordered matches and active index produced by a grid search.API reference →;
findPrev():SearchResultinterface SearchResult {
query: string;
matches: CellAddress[];
active: number;
}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}Ordered matches and active index produced by a grid search.API reference →;
clearSearch():void;
replaceCurrent(replacement:string):SearchResultinterface SearchResult {
query: string;
matches: CellAddress[];
active: number;
}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}interfaceSearchResult {query:string;matches:CellAddress[];active:number;}Ordered matches and active index produced by a grid search.API reference →;
replaceAll(replacement:string):ReplaceResultinterface ReplaceResult {
replaced: number;
result: SearchResult;
}interfaceReplaceResult {replaced:number;result:SearchResult;}interfaceReplaceResult {replaced:number;result:SearchResult;}Replacement count and refreshed search state returned by replace-all.API reference →;
insertRows(at:number, count?:number):void;
removeRows(at:number, count?:number):void;
insertColumns(at:number, count?:number):void;
removeColumns(at:number, count?:number):void;
addSheet(input:AddSheetInput):SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →;
removeSheet(id:SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →):void;
renameSheet(id:SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →, name:string):void;
moveSheet(id:SheetIdtype SheetId = string;typeSheetId=string;typeSheetId=string;Stable identifier used to address a workbook sheet.API reference →, toIndex:number):void;
setConditionalFormats(rules:readonlyConditionalFormatRuleinterface ConditionalFormatRule {
range: Range;
when: ConditionalFormatPredicate;
style: CellStyle;
}interfaceConditionalFormatRule {range:Range;when:ConditionalFormatPredicate;style:CellStyle;}interfaceConditionalFormatRule {range:Range;when:ConditionalFormatPredicate;style:CellStyle;}Ordered condition and style applied to a cell range.API reference →[]):void;
setValidationRule(rule:DataValidationRuleinterface DataValidationRule {
id: string;
range: Range;
condition: DataValidationCondition;
policy: ValidationPolicy;
allowBlank?: boolean;
helpText?: string;
}interfaceDataValidationRule {id:string;range:Range;condition:DataValidationCondition;policy:ValidationPolicy;allowBlank?:boolean;helpText?:string;}interfaceDataValidationRule {id:string;range:Range;condition:DataValidationCondition;policy:ValidationPolicy;allowBlank?:boolean;helpText?:string;}One stable, range-scoped data-entry rule. Blank cells are allowed unless disabled.API reference →):ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
removeValidationRule(id:string):ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
setProtectedRange(protectedRange:ProtectedRangeinterface ProtectedRange {
id: string;
range: Range;
label?: string;
permissionKey?: string;
}interfaceProtectedRange {id:string;range:Range;label?:string;permissionKey?:string;}interfaceProtectedRange {id:string;range:Range;label?:string;permissionKey?:string;}Serializable client UX policy. A host resolver decides whether a local mutation may proceed.API reference →):ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;
removeProtectedRange(id:string):ApplyTransactionResulttype ApplyTransactionResult =
| {
status: "applied";
epoch: number;
transaction: Transaction;
warnings?: MutationIssue[];
rejections?: MutationIssue[];
}
| {
status: "conflict";
expectedEpoch: number;
actualEpoch: number;
}
| { status: "rejected"; epoch: number; issues: MutationIssue[] }
| {
// … 5 more lines — see the API reference
}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| { status:"rejected"; epoch:number; issues:MutationIssue[] }| {// … 5 more lines — see the API reference}typeApplyTransactionResult=| {status:"applied";epoch:number;transaction:Transaction;warnings?:MutationIssue[];rejections?:MutationIssue[];}| {status:"conflict";expectedEpoch:number;actualEpoch:number;}| {status:"rejected";epoch:number;issues:MutationIssue[];}| {// … 8 more lines — see the API reference}Outcome of applying a document transaction, including conflict, rejection, and no-op states.API reference →;