Detached formula bar: mirrors the focused cell's editable text (exact
formula source, else literal text) and commits on Enter through the grid's
undoable transaction path, targeting the data address captured with the
draft — correct even under an active sort/filter view. A focused, dirty
draft is never overwritten by selection/change events; Escape restores the
last stable text.
Declaration
function createFormulaBar (
Referenced by
Workspace packages depending on @sheetwrite/core
@sheetwrite/benchdependency
@sheetwrite/docs-startdependency
@sheetwrite/reactdependency
@sheetwrite/sveltedependency
@sheetwrite/vuedependency
@sheetwrite/xlsxdependency
Public exports naming createFormulaBar
interface Grid {
readonly store: Store;
readonly actions: GridActions;
getRuntimeResourceSnapshot(
operation: RuntimeResourceOperation,
phase: RuntimeResourcePhase,
runtime?: RuntimeMemoryObservation,
): RuntimeResourceSnapshot;
getCommandState(command: GridCommandName): GridCommandState;
setActiveSheet(id: SheetId): void;
scrollToCell(addr: CellAddress): void;
getCellAtPoint(
clientX: number,
clientY: number,
): CellAddress | null;
// … 122 more lines — see the API reference
} interface Grid {
readonly store : Store ;
readonly actions : GridActions ;
getRuntimeResourceSnapshot (
operation : RuntimeResourceOperation ,
phase : RuntimeResourcePhase ,
runtime ?: RuntimeMemoryObservation ,
) : RuntimeResourceSnapshot ;
getCommandState ( command : GridCommandName ) : GridCommandState ;
setActiveSheet ( id : SheetId ) : void ;
scrollToCell ( addr : CellAddress ) : void ;
getCellAtPoint (
clientX : number ,
clientY : number ,
) : CellAddress | null ;
// … 122 more lines — see the API reference
} interface Grid {
readonly store : Store ;
readonly actions : GridActions ;
getRuntimeResourceSnapshot (
operation : RuntimeResourceOperation ,
phase : RuntimeResourcePhase ,
runtime ?: RuntimeMemoryObservation ,
) : RuntimeResourceSnapshot ;
getCommandState (
command : GridCommandName ,
) : GridCommandState ;
setActiveSheet (
id : SheetId ,
) : void ;
scrollToCell (
addr : CellAddress ,
) : void ;
getCellAtPoint (
clientX : number ,
// … 259 more lines — see the API reference
} Imperative grid handle for document commands, events, rendering, and teardown. @example import type { Grid } from "@sheetwrite/core"; function updateTotal(grid: Grid) { const sheet = grid.getActiveSheet(); const result = grid.applyTransaction({ patches: [{ op: "set", addr: { sheet, row: 0, col: 0 }, value: { kind: "literal", value: 42 } }], }); if (result.status === "applied") grid.scrollToCell({ sheet, row: 0, col: 0 }); return grid.aggregate(0, "sum"); } @see createGrid @see Grid.applyTransaction API reference → interface FormulaBarOptions {
focusGrid?: () => void;
label?: string;
} interface FormulaBarOptions {
focusGrid ?: () => void ;
label ?: string ;
} interface FormulaBarOptions {
focusGrid ?: () => void ;
label ?: string ;
} Host elements and callbacks used to bind a formula bar to a Grid. API reference → interface FormulaBarPiece {
setReadOnly(readOnly: boolean): void;
readonly element: HTMLElement;
destroy(): void;
} interface FormulaBarPiece {
setReadOnly ( readOnly : boolean ) : void ;
readonly element : HTMLElement ;
destroy () : void ;
} interface FormulaBarPiece {
setReadOnly (
readOnly : boolean ,
) : void ;
readonly element : HTMLElement ;
destroy () : void ;
} A formula bar piece; setReadOnly blocks commits without unmounting. API reference →