@searsuite/sear-plugin-cell-merge
Merge and unmerge
Merge commands change the range structure. The matrix and read helper expose merged ranges to other features.
- classCellMergeMatrix
-
class CellMergeMatrix extends CSRMatrix<SheetCellMerge | null>Sparse matrix containing one end coordinate at every merged-range anchor.
constructor CellMergeMatrix(data?: CellMergeMatrixData, shape?: [number, number]): CellMergeMatrixmethod addItem(row: number, column: number, value: SheetCellMerge | null): thisAdds an item to the matrix at the specified row and column.
ReturnsThe current instance for chaining.
rowThe row index.
valueThe value to add.
method clone(): thisDeep-clones stored merge values.
method findRange(row: number, column: number): Rect | nullFinds the merged range containing one sheet cell.
method forEachStored(callback: (value: SheetCellMerge | null, row: number, col: number): void): voidVisits actual anchors only, locating their rows through CSR pointer binary search.
method getItem(row: number, column: number): SheetCellMerge | nullReturns an isolated value so callers cannot mutate persisted matrix state.
method getRanges(): Rect[]Returns all merged ranges in matrix traversal order.
method replaceRanges(ranges: readonly Rect[]): thisRebuilds sparse entries from normalized ranges while preserving matrix shape.
method setItem(row: number, column: number, value: SheetCellMerge | null): thisStores or clears a merged range anchored at the supplied cell.
Inherited members 31
Inherited from CSRMatrix.
- name
- ndim
- nnz
- shape
- addColumn
- addListener
- addRow
- cloneCommittedView
- cloneDetached
- cloneForStaging
- deleteColumns
- deleteRows
- dispatch
- dot
- forEach
- forEachStoredInRange
- forEachStoredInRow
- fromDense
- getCol
- getDefaultValue
- getRow
- lockMutations
- multiply
- removeItem
- removeListener
- setDefaultValue
- sum
- swapColumn
- swapRow
- toArray
- transpose
- classSheetCellMergeConfirmationError
-
class SheetCellMergeConfirmationError extends SearErrorBase class for errors intentionally exposed by SearSuite packages.
Packages may throw this generic form while they do not need a more specific public error type. Domain-specific subclasses override
code.constructor SheetCellMergeConfirmationError(reason: "required" | "changed"): SheetCellMergeConfirmationErrorproperty readonly code: "SHEET_MERGE_CONFIRMATION_REQUIRED"Stable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- classSheetCellMergePlugin
-
class SheetCellMergePlugin extends Plugin<unknown, CellProperties, SheetCellMergePluginState>Owns sparse merged-cell state, commands, structure projection, collaboration, and export.
constructor SheetCellMergePlugin(state: SheetCellMergePluginState, cellContent?: SheetCellMergeContentSource): SheetCellMergePluginproperty readonly documentState: PluginDocumentStateContribution<SheetCellMergePluginState, SheetCellMergePluginState>Document-state export modules owned by this plugin state.
property interestedIn: MatrixOTActionName[]Declares which Sheet OT action names this plugin is interested in. The engine will only call
applywhen a transaction contains at least one operation matching these action names, unless the transaction is owned by this plugin.['uc', 'rr', 'rc']— only called for UpdateCell, ResizeRow, ResizeCol['*']— called for any transaction (wildcard)[]— only called for this plugin's own transactions
property readonly transactionOT: { collaborative: boolean; definition: TransactionOTDefinition<MatrixOTOperation<unknown>>; ownerId: string; relations: OTTransformRelation<MatrixOTOperation<unknown>, MatrixOTOperation<unknown>>[] }Shared transaction algebra used by history and collaboration.
property readonly warnOnDuplicateDepth: falseWhether PluginManager should warn when another ordered plugin shares this depth.
property readonly documentState: PluginDocumentStateContribution<SheetCellMergePluginState, SheetCellMergePluginState>staticproperty readonly pluginKey: PluginKeystaticproperty readonly symbol: typeof symbolstaticmethod apply(pluginState: SheetCellMergePluginState, transaction: Transaction): SheetCellMergePluginState | nullApplies a transaction to plugin-owned state and returns the next state.
method getPluginConfig(): nullReturns this plugin's runtime configuration view for the current core.
method isMergedCell(row: number, column: number): Rect | nullmethod registerCommands(commands: SheetCommandBus): voidmethod registerQueries(queries: SheetQueryRegistry): voidmethod registerRangeMoves(registry: SheetRangeMoveRegistry): voidMoves complete merged ranges and rejects moves that split a merge.
method registerRangeReorders(registry: SheetRangeReorderRegistry): voidmethod registerState(): { dataEngine: { dataView: { fieldKey: string; select: (state: unknown): CellMergeMatrix; viewKey: string }[] }; key: PluginKey; state: SheetCellMergePluginState }Registers one or more plugin-owned state records with the host manager.
method render(): Node<CellProperties>[]Produces scene nodes owned by this plugin for the current core state.
Inherited members 25
Inherited from Plugin.
- depth
- transactionHistory
- key
- dirtyRect
- enforceRuntimeWriteBoundary
- enforceStateWriteBoundary
- getState
- hasStateWriteBoundary
- lockCommittedState
- onClick
- onDblClick
- onInitialDataCell
- onInitialDataComplete
- onMouseDown
- onMouseMove
- onMouseUp
- onResize
- onScroll
- onTransactionCommitted
- projectTransaction
- registerConfig
- sealRuntimeMetadata
- sealRuntimeMethods
- sealRuntimeWrites
- setState
- interfaceCellMergeMatrixData
-
Serialized CSR entries accepted by CellMergeMatrix.
property readonly data: SheetCellMerge | null[]property readonly indices: number[]property readonly indptr: number[] - interfaceSheetCellMerge
-
Sparse value stored only at the top-left cell of a merged range.
property readonly endColumn: numberproperty readonly endRow: number - interfaceSheetCellMergeActionDataSource
-
interface SheetCellMergeActionDataSource extends SheetCellMergeCommandDataSource - interfaceSheetCellMergeCommandDataSource
-
property readonly target: PluginKeymethod readMatrix(): CellMergeMatrix - interfaceSheetCellMergeContentSource
- interfaceSheetCellMergePluginState
-
property cellMerges: CellMergeMatrix - interfaceSheetMergeInput
-
interface SheetMergeInput extends SheetRangeInputCommon range input accepted by explicit range commands.
- variableAnalyzeMergeCellsQuery
-
AnalyzeMergeCellsQuery: SheetQueryDefinition<SheetRangeInput, SheetMergeAnalysis | null> - variableMergeCellsCommand
-
MergeCellsCommand: SheetCommandDefinition<SheetMergeInput, SheetCommandResult> - variableSheetCellMergeFieldKey
-
SheetCellMergeFieldKey: "sheet.cellMerge"DataEngine field owned by SheetCellMergePlugin.
- variableToggleMergeCellsCommand
-
ToggleMergeCellsCommand: SheetCommandDefinition<SheetMergeInput, SheetCommandResult> - variableUnmergeCellsCommand
-
UnmergeCellsCommand: SheetCommandDefinition<SheetRangeInput, SheetCommandResult> - functionanalyzeMergeCells
-
analyzeMergeCells(input: SheetRangeInput, dataSource: SheetCellMergeActionDataSource): SheetMergeAnalysis | null - functioncreateMergeCellsOperations
-
createMergeCellsOperations(input: SheetRangeInput, dataSource: SheetCellMergeCommandDataSource): UpdateCellOTOperation<SheetCellMerge>[] - functioncreateUnmergeCellsOperations
-
createUnmergeCellsOperations(input: SheetRangeInput, dataSource: SheetCellMergeCommandDataSource): UpdateCellOTOperation<SheetCellMerge>[] - functionreadSheetCellMerges
-
readSheetCellMerges(dataEngine: DataEngine): CellMergeMatrix | nullReads merged-cell state published by SheetCellMergePlugin.
- functionregisterSheetCellMergeCommands
-
registerSheetCellMergeCommands(commands: SheetCommandBus, dataSource: SheetCellMergeActionDataSource): voidRegisters every command owned by SheetCellMergePlugin.
- functionregisterSheetCellMergeQueries
-
registerSheetCellMergeQueries(queries: SheetQueryRegistry, dataSource: SheetCellMergeActionDataSource): void
Analysis and conflicts
analyzeMergeCells checks a proposed merge before it is committed. The error types describe conflicts with content or structural moves.
- classSheetMergeRangeMoveError
-
class SheetMergeRangeMoveError extends SearErrorA cell move that would split an existing merged range.
constructor SheetMergeRangeMoveError(context: SheetRangeMoveContext): SheetMergeRangeMoveErrorproperty readonly code: "SHEET_MOVE_SPLIT_MERGE"Stable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- classSheetMergeStructureMoveError
-
class SheetMergeStructureMoveError extends SearErrorA structure permutation would leave a merged range noncontiguous.
constructor SheetMergeStructureMoveError(range: readonly readonly number[][]): SheetMergeStructureMoveErrorproperty readonly code: "SHEET_STRUCTURE_MOVE_SPLIT_MERGE"Stable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
No matching API entries.