import type { RowNode } from '../types/row.types'; import type { RowTransaction, RowTransactionResult } from '../types/grid.types'; import type { GridStore } from './grid-store'; import type { EventBus } from '../event-bus/event-bus'; export declare class RowModel { private store; private eventBus; private rawData; private idField; private defaultRowHeight; constructor(store: GridStore, eventBus: EventBus); setRowData(data: Record[], rowHeight?: number): void; /** * Builds {@link RowNode}s from raw data **without** publishing to the store or * emitting `DATA_CHANGED` — used by the Server-Side Row Model to materialise a * fetched page into nodes it lays out and publishes itself (avoiding the * `setRowData` side effects: formula discovery, undo-history reset, and the * data-changed event). Pass `rowHeight` to set the default height for the * built nodes; it falls back to the current default when omitted. */ buildNodes(data: Record[], rowHeight?: number): RowNode[]; appendRowData(data: Record[]): void; updateRow(nodeId: string, newData: Partial>): void; /** * Merges field values into a row's data **in place**, without publishing to * the store. * * The primitive behind real-time updates: no new array is allocated, no store * watcher fires, and the row pipeline (filter → sort → group → paginate) is * not re-run. The caller is responsible for repainting — normally by handing * the affected `nodeId`s to the renderer's Virtual DOM, which patches just * the cells whose values changed. * * Use {@link updateRow} or {@link applyTransaction} instead whenever the * change can affect row *membership or order* (a value the grid is currently * filtering or sorting on). * * @param nodeId - Row to mutate. * @param values - Field → value pairs to merge into `row.data`. * @returns The mutated node, or `undefined` when no such row exists. */ mergeRowValues(nodeId: string, values: Readonly>): RowNode | undefined; removeRows(nodeIds: string[]): void; getRowNode(nodeId: string): RowNode | undefined; getRowByIndex(index: number): RowNode | undefined; setVisibleRows(nodes: RowNode[]): void; setRenderedRows(nodes: RowNode[]): void; setRowHeight(nodeId: string, height: number): void; buildGroupHeaderNode(groupKey: string, groupField: string, groupValue: unknown, children: RowNode[], level: number): RowNode; /** * Builds a `type: 'detail'` `RowNode` rendered directly beneath `parentRow`. * Used by `MasterDetailEngine.injectDetailRows` — `height` should come from * the engine's per-parent height cache (auto-measured or manually resized) * so repeated pipeline runs don't reset an already-known detail height. */ createDetailNode(parentRow: RowNode, detail: Record, height?: number): RowNode; getRawData(): Record[]; /** * Applies an add / update / remove {@link RowTransaction} against `allRows` * in a single pass, re-lays-out the surviving rows, and returns the exact * nodes affected. Unlike {@link setRowData}, undo history is preserved — a * transaction is a surgical delta, not a full data swap. * * Semantics: * - **remove** first (by `nodeId`), so an updated-then-removed row nets out. * - **update** merges each object's fields into the matching node's `data` * (matched by `nodeId`, i.e. the row's id field). Objects with no matching * node are ignored. * - **add** appends freshly built nodes; their `selected` flag is seeded from * the current selection set, exactly like {@link setRowData}. * * The caller is responsible for invoking the render pipeline afterward — the * model only mutates the data store, never the DOM. * * @param txn - The batch of mutations to apply. * @returns The `{ add, update, remove }` nodes that were actually affected. */ applyTransaction(txn: RowTransaction): RowTransactionResult; /** * `nodeId` → node index over `allRows`. * * Every lookup in this class used to be a linear scan, which is invisible at * 100 rows and fatal for a real-time feed against 100 000: a stream applying * thousands of updates per second would spend its entire budget in `find`. */ private nodeIndex; /** * The `allRows` array the index was built from. * * The store is written by several subsystems (server row model, clipboard, * row drag), not only by this class, so the index is validated against the * array *reference* rather than trusting local bookkeeping. Rebuilding is * O(n) but happens only when the row list is actually replaced; a stream of * in-place value updates never invalidates it. */ private indexedRef; /** Returns the `nodeId` index, rebuilding it if the row list was replaced. */ private ensureIndex; private buildRowNodes; private layoutNodes; } //# sourceMappingURL=row-model.d.ts.map