Skip to content
GRID Editor

Operator

The edit methods over a workbook. Each one makes the change, keeps it in the history it was built with, and leaves the workbook untouched when the engine refuses any of it. The one module in the package that calls Apiary.

Type Parameter Default type
TContext undefined
new Operator<TContext = undefined>(props: {
history?: History<TContext>;
model: Model;
writer: string;
}): Operator<TContext>;
Parameter Type
props { history?: History<TContext>; model: Model; writer: string; }
props.history? History<TContext>
props.model Model
props.writer string

Operator<TContext>

Property Modifier Type
writer readonly string
addSheet(add: SheetChange, context?: TContext): void;

Add an empty sheet after the others as one undoable operation.

Parameter Type
add SheetChange
context? TContext

void


apply(parts: Part[], operation: EditorOperation): PendingRecord;

Makes the change the parts describe and reports it as a record, with the parts that take it back. The history uses this for undo and redo. The parts must come from an operator’s record; parts built any other way are not supported.

Parameter Type
parts Part[]
operation EditorOperation

PendingRecord


applyPaintFormat(paint: CellsPaint, context?: TContext): void;

Make cells formatted exactly like the given styles, as one undoable operation. Cells a merge covers are left as they are.

Parameter Type
paint CellsPaint
context? TContext

void


clearCells(clear: CellsClear, context?: TContext): void;

Empty the cells of a range, keeping their formatting, as one undoable operation.

Parameter Type
clear CellsClear
context? TContext

void


deleteCells(cells: CellsShift<"left" | "up">, context?: TContext): void;

Delete a range of cells, moving the cells beyond it into the gap, as one undoable operation.

Parameter Type
cells CellsShift<"left" | "up">
context? TContext

void


deleteColumns(columns: ColumnsDelete, context?: TContext): void;

Delete whole columns, moving the columns right of them left, as one undoable operation.

Parameter Type
columns ColumnsDelete
context? TContext

void


deleteRows(rows: RowsDelete, context?: TContext): void;

Delete whole rows, moving the rows below them up, as one undoable operation.

Parameter Type
rows RowsDelete
context? TContext

void


deleteSheet(remove: SheetChange, context?: TContext): void;

Remove a sheet with everything on it as one undoable operation.

Parameter Type
remove SheetChange
context? TContext

void


editCells(edit: CellsEdit, context?: TContext): void;

Put values, formulas and styles into cells as one undoable operation.

Parameter Type
edit CellsEdit
context? TContext

void


fill(fill: CellsFill, context?: TContext): void;

Fill a range from a seed range, as the fill handle does, as one undoable operation.

Parameter Type
fill CellsFill
context? TContext

void


formatCells(format: CellsFormat, context?: TContext): void;

Add formatting to the cells of a range, keeping what else they are formatted with, as one undoable operation. Cells a merge covers are left as they are.

Parameter Type
format CellsFormat
context? TContext

void


formatRowsOrColumns(format: RowsOrColumnsFormat, context?: TContext): void;

Format whole rows or columns, so the format also covers cells added later, as one undoable operation. Cells that would not show the format they should, other than cells a merge covers, are formatted on their own.

Parameter Type
format RowsOrColumnsFormat
context? TContext

void


insertCells(cells: CellsShift<"right" | "down">, context?: TContext): void;

Insert empty cells at a range, moving the cells there out of the way, as one undoable operation.

Parameter Type
cells CellsShift<"right" | "down">
context? TContext

void


insertColumn(insert: ColumnInsert, context?: TContext): void;

Insert an empty column at the given position, moving the columns from there right, as one undoable operation.

Parameter Type
insert ColumnInsert
context? TContext

void


insertRow(insert: RowInsert, context?: TContext): void;

Insert an empty row at the given position, moving the rows from there down, as one undoable operation.

Parameter Type
insert RowInsert
context? TContext

void


mergeCells(merge: CellsMerge, context?: TContext): void;

Merge cells, releasing any merge in the way, as one undoable operation. The cells the merge covers are emptied, as the workbook would empty them.

Parameter Type
merge CellsMerge
context? TContext

void


moveCells(move: CellsMove, context?: TContext): void;

Move a block of cells onto a destination of the same size, or onto the block of that size whose top-left cell to names, as one undoable operation.

Parameter Type
move CellsMove
context? TContext

void


pasteCells(paste: CellsPaste, context?: TContext): void;

Paste a block of cells, merge what was merged in it, and repeat it over a larger selection, as one undoable operation. If any of it is refused nothing is changed.

Parameter Type
paste CellsPaste
context? TContext

void


renameSheet(rename: SheetRename, context?: TContext): void;

Rename a sheet, keeping formulas pointing at it, as one undoable operation.

Parameter Type
rename SheetRename
context? TContext

void


reorderColumns(reorder: BandReorder, context?: TContext): void;

Lift whole columns out and drop them elsewhere as one undoable operation.

Parameter Type
reorder BandReorder
context? TContext

void


reorderRows(reorder: BandReorder, context?: TContext): void;

Lift whole rows out and drop them elsewhere as one undoable operation.

Parameter Type
reorder BandReorder
context? TContext

void


resizeColumn(resize: ColumnResize, context?: TContext): void;

Give a column a width as one undoable operation.

Parameter Type
resize ColumnResize
context? TContext

void


resizeRow(resize: RowResize, context?: TContext): void;

Give a row a height as one undoable operation.

Parameter Type
resize RowResize
context? TContext

void


setBorders(target: RangeBorders, context?: TContext): void;

Put borders on the edges of a range as one undoable operation. Each edge then shows only the border put there, whatever the cell across it had on that edge.

Parameter Type
target RangeBorders
context? TContext

void


unmergeCells(unmerge: CellsMerge, context?: TContext): void;

Release every merge touching a range as one undoable operation.

Parameter Type
unmerge CellsMerge
context? TContext

void