← All packages

@searsuite/sear-plugin-cell-highlight

Highlight rules

A rule pairs a condition with a style. Range readers supply the cell values used to evaluate that condition.

interfaceAddCellHighlightRuleInput
interface AddCellHighlightRuleInput extends SheetRangeInput

Common range input accepted by explicit range commands.

Inherited members 2

Inherited from SheetRangeInput.

interfaceCellHighlightRule

One conditional rule stored at its range's top-left matrix cell.

typeCellHighlightKind
type CellHighlightKind = typeof CellHighlightKind[keyof typeof CellHighlightKind] CellHighlightKind: { AboveAverage: "aboveAverage"; BelowAverage: "belowAverage"; Bottom: "bottom"; Duplicate: "duplicate"; Empty: "empty"; Error: "error"; NotEmpty: "notEmpty"; NotError: "notError"; … }
typeCellHighlightNumericRangeReader
type CellHighlightNumericRangeReader = (startRow: number, startColumn: number, endRow: number, endColumn: number, visit: (value: number): void): void
typeCellHighlightStyle
type CellHighlightStyle = typeof CellHighlightStyle[keyof typeof CellHighlightStyle] CellHighlightStyle: { GreenFill: "greenFill"; RedBorder: "redBorder"; RedFill: "redFill"; RedText: "redText"; YellowFill: "yellowFill" }
typeCellHighlightTextOperator
type CellHighlightTextOperator = typeof CellHighlightTextOperator[keyof typeof CellHighlightTextOperator] CellHighlightTextOperator: { Contains: "contains"; EndsWith: "endsWith"; NotContains: "notContains"; StartsWith: "startsWith" }
typeCellHighlightValueOperator
type CellHighlightValueOperator = typeof CellHighlightValueOperator[keyof typeof CellHighlightValueOperator] CellHighlightValueOperator: { Between: "between"; Equal: "equal"; Greater: "greater"; GreaterOrEqual: "greaterOrEqual"; Less: "less"; LessOrEqual: "lessOrEqual"; NotBetween: "notBetween"; NotEqual: "notEqual" }
typeCellHighlightValueRangeReader
type CellHighlightValueRangeReader = (startRow: number, startColumn: number, endRow: number, endColumn: number, visit: (value: unknown): void): void
typeCellHighlightValueReader
type CellHighlightValueReader = (row: number, column: number): unknown
variableAddCellHighlightRuleCommand
AddCellHighlightRuleCommand: SheetCommandDefinition<AddCellHighlightRuleInput, SheetCommandResult>
variableClearCellHighlightRulesCommand
ClearCellHighlightRulesCommand: SheetCommandDefinition<ClearCellHighlightRulesInput, SheetCommandResult>
variableReadCellHighlightRulesQuery
ReadCellHighlightRulesQuery: SheetQueryDefinition<void, readonly PositionedCellHighlightRule[]>
variableRemoveCellHighlightRuleCommand
RemoveCellHighlightRuleCommand: SheetCommandDefinition<RemoveCellHighlightRuleInput, SheetCommandResult>

Apply and read highlights

Add, remove, and clear commands change the stored rules; the read query returns the rules affecting a range.

classCellHighlightMatrix
class CellHighlightMatrix extends CSRMatrix<CellHighlightRule[] | null>

Sparse rule anchors; the range index avoids scanning all rules for every visible cell.

constructorCellHighlightMatrix(data?: CellHighlightMatrixData, shape?: [number, number]): CellHighlightMatrix
methodaddItem(row: number, column: number, rules: CellHighlightRule[] | null): this

Adds an item to the matrix at the specified row and column.

ReturnsThe current instance for chaining.

row

The row index.

methodclone(): this

Creates an independent copy of this value and its mutable data.

methodfindRules(row: number, column: number): PositionedCellHighlightRule[]
methodforEachStored(callback: (rules: CellHighlightRule[] | null, row: number, column: number): void): void

Visits only stored anchors even when the sheet has many empty rows.

methodgetItem(row: number, column: number): CellHighlightRule[] | null

Retrieves an item from the matrix at the specified row and column.

ReturnsThe item at the specified position or null if not present.

row

The row index.

methodgetRules(): PositionedCellHighlightRule[]
methodreplaceRules(entries: readonly PositionedCellHighlightRule[]): void
methodsetItem(row: number, column: number, rules: CellHighlightRule[] | null): this
Inherited members 31

Inherited from CSRMatrix.

classSheetCellHighlightPlugin
class SheetCellHighlightPlugin extends Plugin<unknown, CellProperties, SheetCellHighlightPluginState>

Base contract implemented by sheet and document plugins.

Plugins own their state, declare lifecycle hooks, transform transactions into state, and render scene nodes for their host core. Runtime packages should extend this contract rather than reaching into Core internals.

constructorSheetCellHighlightPlugin(state: SheetCellHighlightPluginState, dependencies: CellHighlightDependencies): SheetCellHighlightPlugin
propertyreadonly documentState: PluginDocumentStateContribution<SheetCellHighlightPluginState, SheetCellHighlightPluginState>

Document-state export modules owned by this plugin state.

propertyinterestedIn: MatrixOTActionName[]

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
propertyreadonly transactionOT: { collaborative: boolean; definition: TransactionOTDefinition<MatrixOTOperation<unknown>>; ownerId: string; relations: OTTransformRelation<MatrixOTOperation<unknown>, MatrixOTOperation<unknown>>[] }

Shared transaction algebra used by history and collaboration.

propertyreadonly warnOnDuplicateDepth: false

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

propertyreadonly documentState: PluginDocumentStateContribution<SheetCellHighlightPluginState, SheetCellHighlightPluginState>static
propertyreadonly pluginKey: PluginKeystatic
propertyreadonly symbol: typeof symbolstatic
methodapply(state: SheetCellHighlightPluginState, transaction: Transaction): SheetCellHighlightPluginState | null

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

methoddispose(): void
methodgetPluginConfig(): null

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

methodinvalidateRangeStatistics(cells?: readonly SheetDisplayedValueCoordinate[]): void

Invalidates derived range statistics after displayed values change.

methodregisterCellVisualReaders(registry: SheetCellVisualReaderRegistry): void
methodregisterCommands(commands: SheetCommandBus): void
methodregisterQueries(queries: SheetQueryRegistry): void
methodregisterRangeMoves(registry: SheetRangeMoveRegistry): void
methodregisterState(): { dataEngine: { dataView: { fieldKey: string; select: (state: unknown): CellHighlightMatrix; viewKey: string }[] }; key: PluginKey; state: SheetCellHighlightPluginState }

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

methodrender(): Node<CellProperties>[]

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

Inherited members 25

Inherited from Plugin.

variableSheetCellHighlightFieldKey
SheetCellHighlightFieldKey: "sheet.cellHighlight"
functionreadSheetCellHighlights
readSheetCellHighlights(dataEngine: DataEngine): CellHighlightMatrix | null