← All packages

API reference

@searsuite/sear-plugin-filter

Sheet range filtering with independent rules and row visibility.

30 exportsderived from source

classSheetFilterMatrixsource ↗
class SheetFilterMatrix extends CSRMatrix<SheetFilterDefinition | null>

One sparse anchor holds the current range and its column rules.

constructorconstructor
SheetFilterMatrix(data?: { data: SheetFilterDefinition | null[]; indices: number[]; indptr: number[] }): SheetFilterMatrix
data: { data: SheetFilterDefinition | null[]; indices: number[]; indptr: number[] }
methodaddItem
addItem(row: number, column: number, value: SheetFilterDefinition | null): this

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

ReturnsThe current instance for chaining.

row: number

The row index.

column: number
value: SheetFilterDefinition | null

The value to add.

methodclone
clone(): this

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

methodgetItem
getItem(row: number, column: number): SheetFilterDefinition | 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: number

The row index.

column: number
Inherited members 32

Inherited from CSRMatrix.

classSheetFilterPluginsource ↗
class SheetFilterPlugin extends Plugin<unknown, CellProperties, SheetFilterPluginState>, SheetRowVisibility

Owns persisted filter rules and a derived, editor-local row visibility view.

constructorconstructor
SheetFilterPlugin(state: SheetFilterPluginState, dependencies: SheetFilterDependencies): SheetFilterPlugin
state: SheetFilterPluginState
dependencies: SheetFilterDependencies
propertydocumentState
readonly documentState: PluginDocumentStateContribution<SheetFilterPluginState, SheetFilterPluginState>

Document-state export modules owned by this plugin state.

propertyinterestedIn
interestedIn: 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
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<SheetFilterPluginState, SheetFilterPluginState>
propertypluginKeystatic
readonly pluginKey: PluginKey
propertysymbolstatic
readonly symbol: typeof symbol
memberactive
active: unknown
memberversion
version: unknown
methodapply
apply(state: SheetFilterPluginState, transaction: Transaction): SheetFilterPluginState | null

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

state: SheetFilterPluginState
transaction: Transaction
methoddispose
dispose(): void
methodgetPluginConfig
getPluginConfig(): null

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

methodisRowFiltered
isRowFiltered(row: number): boolean
row: number
methodonTransactionCommitted
onTransactionCommitted(transaction: Transaction): void

Runs only after every step in the enclosing pipeline has succeeded and all staged plugin state has been committed. Use it for derived caches, notifications, persistence, and transport; never perform those effects in apply, because a later pipeline step may still fail.

transaction: Transaction

A committed transaction from the completed pipeline.

methodregisterCommands
registerCommands(commands: SheetCommandBus): void
commands: SheetCommandBus
methodregisterQueries
registerQueries(queries: SheetQueryRegistry): void
queries: SheetQueryRegistry
methodregisterSessionState
registerSessionState(registry: SessionStateRegistry): void
registry: SessionStateRegistry
methodregisterState
registerState(): { dataEngine: { dataView: { fieldKey: string; select: (): SheetRowVisibility; viewKey: string }[] }; key: PluginKey; state: SheetFilterPluginState }

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

methodrender
render(): []

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

Inherited members 25

Inherited from Plugin.

interfaceCreateSheetFilterInputsource ↗
interface CreateSheetFilterInput

Sheet range and header policy for a new filter or private view.

propertyfirstRowIsHeader
readonly firstRowIsHeader?: boolean

Treat the first row as a header when true.

propertyrange
readonly range: { end: readonly [number, number]; start: readonly [number, number] }

Inclusive range to filter.

interfaceReadSheetFilterValuesInputsource ↗
interface ReadSheetFilterValuesInput

Parameters for a bounded distinct-value query.

propertycolumn
readonly column: number
propertylimit
readonly limit?: number
interfaceSetSheetColumnFilterInputsource ↗
interface SetSheetColumnFilterInput

Sets or clears a predicate for one column.

propertycolumn
readonly column: number
propertypredicate
readonly predicate: SheetFilterPredicate | null
interfaceSheetFilterColumnRulesource ↗
interface SheetFilterColumnRule

A rule attached to one column within a filter range.

propertycolumn
readonly column: number

Zero-based sheet column index.

propertypredicate
readonly predicate: SheetFilterPredicate

Predicate applied to values in the column.

interfaceSheetFilterDefinitionsource ↗
interface SheetFilterDefinition

Document or private-session filter configuration for one sheet range.

propertyfirstRowIsHeader
readonly firstRowIsHeader: boolean

Whether the first row is always visible as a header.

propertyprivateView
readonly privateView: boolean

Whether this definition belongs to the current editor session.

propertyrange
readonly range: { end: readonly [number, number]; start: readonly [number, number] }

Inclusive sheet coordinates covered by the filter.

propertyrules
readonly rules: readonly SheetFilterColumnRule[]

Active column predicates.

interfaceSheetFilterDependenciessource ↗
interface SheetFilterDependencies extends Omit<SheetFilterCommandSource, "target" | "readMatrix" | "readActiveDefinition" | "readPrivateDefinition" | "setPrivateDefinition" | "normalizeSearch">

Host-neutral dependencies supplied by a Sheet composition root.

propertydataTarget
readonly dataTarget?: PluginKey
propertydisplayedValueChanges
readonly displayedValueChanges?: Pick<SheetDisplayedValueChanges, "subscribe">
propertyinvalidateVisibilityAggregates
readonly invalidateVisibilityAggregates?: (): void
propertyparseDate
readonly parseDate?: (value: unknown): number | null
propertyplatform
readonly platform: Pick<Platform, "toLowerCase">
propertyreadColor
readonly readColor: (row: number, column: number, property: "fill" | "textColor"): string | null
propertyrequestRenderAll
readonly requestRenderAll?: (): void
Inherited members 4
  • renderKeys
  • forEachStoredInRange
  • readShape
  • readValue
interfaceSheetFilterPluginStatesource ↗
interface SheetFilterPluginState

Persisted state owned by the filter plugin.

propertyfilters
readonly filters: SheetFilterMatrix
interfaceSheetFilterValueCountsource ↗
interface SheetFilterValueCount

One distinct displayed value and its occurrence count.

propertycount
readonly count: number
propertyvalue
readonly value: string
interfaceSheetFilterValuePagesource ↗
interface SheetFilterValuePage

Bounded distinct-value query result for a filter column.

propertyitems
readonly items: readonly SheetFilterValueCount[]

Matching values returned within the requested limit.

propertytruncated
readonly truncated: boolean

Whether additional matching values were omitted.

typeSheetFilterCategorysource ↗
type SheetFilterCategory = typeof SheetFilterCategory[keyof typeof SheetFilterCategory]

A condition filter's value category.

typeSheetFilterColorPropertysource ↗
type SheetFilterColorProperty = typeof SheetFilterColorProperty[keyof typeof SheetFilterColorProperty]

A cell visual property used by a color filter.

typeSheetFilterKindsource ↗
type SheetFilterKind = typeof SheetFilterKind[keyof typeof SheetFilterKind]

Supported filter rule kinds.

typeSheetFilterOperatorsource ↗
type SheetFilterOperator = typeof SheetFilterOperator[keyof typeof SheetFilterOperator]

A comparison operator supported by the filter plugin.

typeSheetFilterPredicatesource ↗
type SheetFilterPredicate = { excluded?: boolean; kind: typeof SheetFilterKind.Values; values: readonly string[] } | { category: SheetFilterCategory; kind: typeof SheetFilterKind.Condition; operator: SheetFilterOperator; secondValue?: string; value: string } | { color: string | null; kind: typeof SheetFilterKind.Color; property: SheetFilterColorProperty }

Serializable rule used to decide whether a row remains visible.

variableClearSheetFilterCommandsource ↗
ClearSheetFilterCommand: SheetCommandDefinition<void, SheetCommandResult>

Clears the active filter or private view.

variableCreateSheetFilterCommandsource ↗
CreateSheetFilterCommand: SheetCommandDefinition<CreateSheetFilterInput, SheetCommandResult>

Creates a document-owned filter range.

variableCreateSheetFilterViewCommandsource ↗
CreateSheetFilterViewCommand: SheetCommandDefinition<CreateSheetFilterInput, SheetCommandResult>

Creates a session-owned filter view.

variableReadSheetFilterQuerysource ↗
ReadSheetFilterQuery: SheetQueryDefinition<void, SheetFilterDefinition | null>

Reads the active filter definition.

variableReadSheetFilterValuesQuerysource ↗
ReadSheetFilterValuesQuery: SheetQueryDefinition<ReadSheetFilterValuesInput, SheetFilterValuePage>

Reads a bounded page of distinct displayed values in one column.

variableReapplySheetFilterCommandsource ↗
ReapplySheetFilterCommand: SheetCommandDefinition<void, SheetCommandResult>

Recomputes visibility for the active filter.

variableSetSheetColumnFilterCommandsource ↗
SetSheetColumnFilterCommand: SheetCommandDefinition<SetSheetColumnFilterInput, SheetCommandResult>

Replaces or clears one column predicate.

variableSheetFilterCategorysource ↗
SheetFilterCategory: { Date: "date"; Number: "number"; Text: "text" }

Value categories supported by condition filters.

variableSheetFilterColorPropertysource ↗
SheetFilterColorProperty: { Fill: "fill"; Text: "textColor" }

Cell visual properties available to color filters.

variableSheetFilterKindsource ↗
SheetFilterKind: { Color: "color"; Condition: "condition"; Values: "values" }

Persisted filter modes owned by this plugin.

variableSheetFilterOperatorsource ↗
SheetFilterOperator: { Between: "between"; Contains: "contains"; EndsWith: "endsWith"; Equal: "equal"; Greater: "greater"; GreaterEqual: "greaterEqual"; Less: "less"; LessEqual: "lessEqual"; … }

Operators available to condition filters.

variableSheetFilterViewSessionStateDefinitionsource ↗
SheetFilterViewSessionStateDefinition: SessionStateDefinition<SheetFilterDefinition | null>

Session-state contribution for a private filter view.

variableSheetRowVisibilityFieldKeysource ↗
SheetRowVisibilityFieldKey: "sheet.filter.rowVisibility"

Neutral field contract re-exported by the plugin that owns the contribution.

functionsheetFilterValueKeysource ↗
sheetFilterValueKey(value: unknown): string

Uses display values for distinct-value selection, including an explicit blank key.

value: unknown