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…
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.
Package
@sheetwrite/core/shell
Source
packages/core/src/shell/formula-controls.ts#L136
Declaration
functioncreateFormulaBar(
host:HTMLElement,
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 →,
options?:FormulaBarOptionsinterface FormulaBarOptions {
focusGrid?: () => void;
label?: string;
}interfaceFormulaBarOptions {focusGrid?: () =>void;label?:string;}interfaceFormulaBarOptions {focusGrid?: () =>void;label?:string;}Host elements and callbacks used to bind a formula bar to a Grid.API reference →,
):FormulaBarPieceinterface FormulaBarPiece {
setReadOnly(readOnly: boolean): void;
readonly element: HTMLElement;
destroy(): void;
}interfaceFormulaBarPiece {setReadOnly(readOnly:boolean):void;readonlyelement:HTMLElement;destroy():void;}interfaceFormulaBarPiece {setReadOnly(readOnly:boolean,):void;readonlyelement:HTMLElement;destroy():void;}A formula bar piece; setReadOnly blocks commits without unmounting.API reference →