← All packages

API reference

@searsuite/sear-plugin-cell-format

Cell number-format state, commands, display projection, and persistence.

16 exportsderived from source

classCellFormatMatrixsource ↗
class CellFormatMatrix extends CSRMatrix<CellFormat | null>

Sparse matrix containing explicit per-cell number formats.

constructorconstructor
CellFormatMatrix(data?: CellFormatMatrixData, shape?: [number, number]): CellFormatMatrix
data: CellFormatMatrixData
shape: [number, number]
methodaddItem
addItem(row: number, column: number, format: CellFormat | null): this

Stores a format through the CSR API.

row: number
column: number
format: CellFormat | null
methodsetItem
setItem(row: number, column: number, format: CellFormat | null): this

Stores a validated format, or removes the sparse entry for null.

row: number
column: number
format: CellFormat | null
Inherited members 34

Inherited from CSRMatrix.

classCellFormatMatrixErrorsource ↗
class CellFormatMatrixError extends SearError

Public error raised when persisted Sheet cell-format state is invalid.

constructorconstructor
CellFormatMatrixError(message: string, details?: SearErrorDetails): CellFormatMatrixError
message: string
details: SearErrorDetails
propertycode
readonly code: "SHEET_CELL_FORMAT_INVALID"

Stable machine-readable identifier for this error category.

Inherited members 9

Inherited from SearError.

classSheetCellFormatPluginsource ↗
class SheetCellFormatPlugin extends Plugin<unknown, CellProperties, SheetCellFormatPluginState>

Plugin owning per-cell number formats, their commands, OT, rendering projection, and export.

constructorconstructor
SheetCellFormatPlugin(state: SheetCellFormatPluginState): SheetCellFormatPlugin
state: SheetCellFormatPluginState
propertydocumentState
readonly documentState: PluginDocumentStateContribution<SheetCellFormatPluginState, SheetCellFormatPluginState>

Document-state export modules owned by this plugin state.

propertyinterestedIn
interestedIn: string[]

Declares which Sheet OT action names this plugin is interested in. The engine will only call apply when a transaction contains at least one operation matching these action names, unless the transaction is owned by this plugin.

  • [&#39;uc&#39;, &#39;rr&#39;, &#39;rc&#39;] — only called for UpdateCell, ResizeRow, ResizeCol
  • [&#39;*&#39;] — called for any transaction (wildcard)
  • [] — only called for this plugin's own transactions
propertytransactionOT
readonly transactionOT: { collaborative: boolean; definition: TransactionOTDefinition<MatrixOTOperation<unknown>>; ownerId: string; relations: OTTransformRelation<MatrixOTOperation<unknown>, MatrixOTOperation<unknown>>[] }

Shared transaction algebra used by history and collaboration.

propertywarnOnDuplicateDepth
readonly warnOnDuplicateDepth: false

Whether PluginManager should warn when another ordered plugin shares this depth.

propertydocumentStatestatic
readonly documentState: PluginDocumentStateContribution<SheetCellFormatPluginState, SheetCellFormatPluginState>
propertypluginKeystatic
readonly pluginKey: PluginKey
propertysymbolstatic
readonly symbol: symbol
methodapply
apply(state: SheetCellFormatPluginState, transaction: Transaction): SheetCellFormatPluginState | null

Applies a transaction to plugin-owned state and returns the next state.

state: SheetCellFormatPluginState
transaction: Transaction
methodgetPluginConfig
getPluginConfig(): null

Returns this plugin's runtime configuration view for the current core.

methodregisterCellVisualReaders
registerCellVisualReaders(registry: SheetCellVisualReaderRegistry): void
registry: SheetCellVisualReaderRegistry
methodregisterCommands
registerCommands(commands: SheetCommandBus): void
commands: SheetCommandBus
methodregisterFormatTransfers
registerFormatTransfers(registry: SheetFormatTransferRegistry): void

Transfers only this owner's persisted formats.

registry: SheetFormatTransferRegistry
methodregisterQueries
registerQueries(queries: SheetQueryRegistry): void
queries: SheetQueryRegistry
methodregisterRangeMoves
registerRangeMoves(registry: SheetRangeMoveRegistry): void
registry: SheetRangeMoveRegistry
methodregisterRangeReorders
registerRangeReorders(registry: SheetRangeReorderRegistry): void
registry: SheetRangeReorderRegistry
methodregisterState
registerState(): { dataEngine: { dataView: { fieldKey: string; select: (state: unknown): CellFormatMatrix; viewKey: string }[] }; key: PluginKey; state: SheetCellFormatPluginState }

Registers one or more plugin-owned state records with the host manager.

methodrender
render(): Node<CellProperties>[]

Produces scene nodes owned by this plugin for the current core state.

Inherited members 26

Inherited from Plugin.

interfaceSheetAdjustRangeCellFormatDecimalsInputsource ↗
interface SheetAdjustRangeCellFormatDecimalsInput extends SheetRangeInput

Input accepted by AdjustRangeCellFormatDecimalPlacesCommand.

propertydelta
readonly delta: number
Inherited members 2

Inherited from SheetRangeInput.

interfaceSheetCellFormatCommandDataSourcesource ↗
interface SheetCellFormatCommandDataSource extends CellFormatCommandRangeDataSource

State access required by the cell-format command.

propertytarget
readonly target: PluginKey
methodreadCellFormat
readCellFormat(row: number, column: number): CellFormat | null
row: number
column: number
Inherited members 2
  • getColumnCount
  • getRowCount
interfaceSheetCellFormatPluginStatesource ↗
interface SheetCellFormatPluginState

State exclusively owned by SheetCellFormatPlugin.

propertycellFormats
readonly cellFormats: CellFormatMatrix
interfaceSheetCellFormatReadersource ↗
interface SheetCellFormatReader

Read-only projection of one Sheet's persisted cell-format matrix.

propertyshape
readonly shape: [number, number]
methodgetItem
getItem(row: number, column: number): CellFormat | null
row: number
column: number
interfaceSheetSetRangeCellFormatInputsource ↗
interface SheetSetRangeCellFormatInput extends SheetRangeInput

Input accepted by SetRangeCellFormatCommand.

propertyformat
readonly format: CellFormat | null
Inherited members 2

Inherited from SheetRangeInput.

variableAdjustRangeCellFormatDecimalPlacesCommandsource ↗
AdjustRangeCellFormatDecimalPlacesCommand: SheetCommandDefinition<SheetAdjustRangeCellFormatDecimalsInput, SheetCommandResult>

Public command for increasing or decreasing a range's visible decimal places.

variableReadSheetCellFormatQuerysource ↗
ReadSheetCellFormatQuery: SheetQueryDefinition<void, SheetCellFormatReader>

Reads the active Sheet's live, read-only cell-format projection.

variableSetRangeCellFormatCommandsource ↗
SetRangeCellFormatCommand: SheetCommandDefinition<SheetSetRangeCellFormatInput, SheetCommandResult>

Public command for setting or clearing the number format of a cell range.

variableSheetCellFormatFieldKeysource ↗
SheetCellFormatFieldKey: "sheet.cellFormat"

DataEngine field owned by SheetCellFormatPlugin.

functioncreateAdjustCellFormatDecimalOperationssource ↗
createAdjustCellFormatDecimalOperations(input: SheetAdjustRangeCellFormatDecimalsInput, dataSource: SheetCellFormatCommandDataSource): UpdateCellOTOperation<CellFormat>[]

Creates sparse MatrixOT updates for a decimal-place adjustment.

input: SheetAdjustRangeCellFormatDecimalsInput
dataSource: SheetCellFormatCommandDataSource
functioncreateSetRangeCellFormatOperationssource ↗
createSetRangeCellFormatOperations(input: SheetSetRangeCellFormatInput, dataSource: SheetCellFormatCommandDataSource): UpdateCellOTOperation<CellFormat>[]

Creates sparse MatrixOT updates for one format range.

input: SheetSetRangeCellFormatInput
dataSource: SheetCellFormatCommandDataSource
functionreadSheetCellFormatssource ↗
readSheetCellFormats(dataEngine: DataEngine): CellFormatMatrix | null

Reads the live format matrix published by SheetCellFormatPlugin.

dataEngine: DataEngine
functionregisterSheetCellFormatCommandsource ↗
registerSheetCellFormatCommand(commands: SheetCommandBus, dataSource: SheetCellFormatCommandDataSource): void

Registers the command owned by SheetCellFormatPlugin.

commands: SheetCommandBus
dataSource: SheetCellFormatCommandDataSource