View as Markdown

API reference: @salmonui/data-grid/engine

AggregatesModuletype

import type { AggregatesModule } from '@salmonui/data-grid/engine';

Also exported from @salmonui/data-grid/engine/aggregates.

type AggregatesModule<Row> = DataGridModule<Row, AggregatesState, AggregatesCommand, 'aggregates', AggregatesMethods<Row>>;
AggregatesModule members (18, 18 inherited)
NameSignatureDescription
nameinheritedname: "aggregates";
dependenciesoptionalinheriteddependencies?: readonly string[];

Validated at engine creation.

inSnapshotoptionalinheritedinSnapshot?: boolean;

When true (default) the slice lives in snapshot.modules[name] and every change replaces the grid snapshot. High-churn modules (focus, selection, drafts) set false and notify through row/cell/header/module channels only.

commandsinheritedcommands: readonly ("aggregates.set" | "aggregates.setScope")[];

Declared, validated, serializable. Every type must start with ${name}..

initialStateinheritedinitialState: (options: DataGridOptions<Row>) => AggregatesState;
reduceoptionalinheritedreduce?: ((state: AggregatesState, command: AggregatesCommand, ctx: ModuleContext<Row>) => AggregatesState | CommandRejection);
extendColumnsoptionalinheritedextendColumns?: ((columns: readonly CompiledColumn<Row>[], ctx: ModuleContext<Row>) => readonly CompiledColumn<Row>[]);
extendQueryoptionalinheritedextendQuery?: ((query: DataQuery, state: AggregatesState) => DataQuery);
pipelineoptionalinheritedpipeline?: readonly PipelineStage<Row, AggregatesState>[];
selectorsoptionalinheritedselectors?: Readonly<Record<string, (snapshot: DataGridSnapshot<Row>) => unknown>>;
methodsoptionalinheritedmethods?: AggregatesMethods<Row>;

Reads that need more than the snapshot (facets, pager totals). Must not change state; names may not collide with command actions.

notifyoptionalinheritednotify?: ((previous: AggregatesState, next: AggregatesState, ctx: ModuleContext<Row>) => NotificationScope);
hiddenColumnsoptionalinheritedhiddenColumns?: ((state: AggregatesState) => readonly string[]);

Leaf columns this module hides from the visible column set (grouped columns with showGroupedColumns: false).

interceptReadoptionalinheritedinterceptRead?: ((query: DataQuery, state: AggregatesState, ctx: ModuleContext<Row>) => boolean);

Remote sources only: return true to serve the main read of query yourself (lazy grouping loads group levels instead of rows). The engine then shows no source rows and runs only the stages the source did not perform.

onQueryChangeoptionalinheritedonQueryChange?: ((previous: DataQuery, next: DataQuery, ctx: ModuleContext<Row>) => void);

Called after the effective query changed (sort, filter, search, page, group). Runs inside the dispatch of the command that changed it; may dispatch commands through ctx (selection clears itself here when it does not persist).

onConnectoptionalinheritedonConnect?: ((ctx: ModuleContext<Row>) => void);

engine.connect() ran (deferDataSource): start loads that were held while disconnected.

onSourceEventoptionalinheritedonSourceEvent?: ((event: DataSourceEvent<Row>, state: AggregatesState, ctx: ModuleContext<Row>) => boolean);

A data source event (patch or reset). Return true to consume it: the engine then leaves its source rows unchanged (infinite scroll applies write echoes to the blocks it owns).

disposeoptionalinheriteddispose?: (() => void);