@omnigrid/core 0.1.23 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/grid.d.ts CHANGED
@@ -2,7 +2,9 @@ import type { FilterCondition, FilterModel } from "./filtering";
2
2
  import type { UIPopupAnchor, UIPopupDescriptor } from "./ui";
3
3
  import { IconRegistry } from "./icons";
4
4
  import { SlotManager } from "./slots";
5
- import type { ColumnLeafDef, DataProcessor, GridApi, GridEvents, GridOptions, GridPlugin, GridState, RowClickEvent, RowHeightUpdateOptions, RowHoverEvent, RowId, RowSpanLayout, ScrollPosition, SlotMount, SlotName, TransactionResult, RowTransaction, ViewportData, ViewportState } from "./types";
5
+ import { type StateUpdater } from "./store";
6
+ import { DataPipeline } from "./pipeline";
7
+ import type { AggregationFunc, ColumnLeafDef, DataProcessor, GridApi, GridEvents, GridOptions, GridPlugin, GridState, RowClickEvent, RowHeightUpdateOptions, RowHoverEvent, RowHierarchy, RowId, RowSpanLayout, ScrollPosition, SlotMount, SlotName, TransactionResult, TreeRowNode, RowTransaction, ViewportData, ViewportState } from "./types";
6
8
  import type { OverlayOptions, OverlayState } from "./overlays";
7
9
  export declare class Grid<T> implements GridApi<T> {
8
10
  private readonly store;
@@ -11,12 +13,20 @@ export declare class Grid<T> implements GridApi<T> {
11
13
  private readonly cleanupPlugins;
12
14
  private readonly pluginRegistrations;
13
15
  private readonly dataProcessors;
16
+ private rowHierarchy?;
14
17
  private readonly resolveRowId;
15
18
  readonly slots: SlotManager<T>;
16
19
  readonly icons: IconRegistry<T>;
20
+ readonly pipeline: DataPipeline<T>;
21
+ readonly methods: Record<string, unknown>;
17
22
  private processedDataCache;
18
23
  /** Output of the built-in filter stage; sits in front of every data processor. */
19
24
  private filteredDataCache;
25
+ /** Flattened grouped rows (TreeRowNode[]), invalidated on structural/group changes. */
26
+ private groupedRowsCache;
27
+ private groupedRowsRevision;
28
+ /** Column id -> aggregation function map, registered by aggregation plugins. */
29
+ private aggregationFuncs;
20
30
  private filterModel;
21
31
  private filterMenuProviders;
22
32
  private readonly popups;
@@ -37,6 +47,10 @@ export declare class Grid<T> implements GridApi<T> {
37
47
  private overlayManual;
38
48
  /** Grid-level `wrapText` flag — applied to every column without an explicit one. */
39
49
  private wrapTextAll;
50
+ /** Normalized cell flash configuration. `false` when disabled. */
51
+ private cellFlash;
52
+ /** Cells currently flashed: key `${rowId}:${columnId}` → expiry timestamp. */
53
+ private flashedCells;
40
54
  /**
41
55
  * Separate ephemeral scroll position that is NOT stored in the Store.
42
56
  *
@@ -50,6 +64,30 @@ export declare class Grid<T> implements GridApi<T> {
50
64
  /** Returns the calculated width for a visible column, including off-screen columns. */
51
65
  getColumnWidth(columnId: string): number | undefined;
52
66
  getState(): GridState<T>;
67
+ /** Returns the row hierarchy capability registered by the active row-model plugin. @api */
68
+ getRowHierarchy(): RowHierarchy<T> | undefined;
69
+ /**
70
+ * Registers the row hierarchy capability for composite row models.
71
+ * @param hierarchy - The active row hierarchy implementation.
72
+ * @returns Cleanup callback to unregister the provider.
73
+ * @api
74
+ */
75
+ registerRowHierarchy(hierarchy: RowHierarchy<T>): () => void;
76
+ /**
77
+ * Updates the grid state via partial patch or functional updater.
78
+ * Accessible by plugins to update their contributed state slices.
79
+ * @param updater - Partial state patch or reducer function.
80
+ * @api
81
+ */
82
+ setState(updater: StateUpdater<GridState<T>>): void;
83
+ /**
84
+ * Registers methods dynamically contributed by plugins.
85
+ * These methods are attached both to `api.methods` and directly to `api`.
86
+ * @param methods - Methods to register.
87
+ * @returns Cleanup callback to unregister the methods.
88
+ * @api
89
+ */
90
+ registerMethods(methods: Record<string, unknown>): () => void;
53
91
  /** Returns the current ephemeral scroll position (not part of Store state). */
54
92
  getScrollPosition(): ScrollPosition;
55
93
  /**
@@ -58,6 +96,14 @@ export declare class Grid<T> implements GridApi<T> {
58
96
  * @api
59
97
  */
60
98
  scrollTo(position: Partial<ScrollPosition>): void;
99
+ /**
100
+ * Returns the flat array of visible leaf columns.
101
+ *
102
+ * A column is visible when it is not explicitly `hidden`. In `'single'` group
103
+ * column mode with active grouping, all grouped columns except the primary
104
+ * one are hidden.
105
+ */
106
+ private getVisibleLeafColumns;
61
107
  getViewportData(): ViewportData<T>;
62
108
  /**
63
109
  * Expands the shared scrollable column window so `colSpan` origins stay
@@ -113,7 +159,62 @@ export declare class Grid<T> implements GridApi<T> {
113
159
  */
114
160
  resolveColSpan(data: T, index: number, column: ColumnLeafDef<T>, columnIndex: number, columnCount: number): number;
115
161
  getProcessedData(): T[];
116
- private getFilteredData;
162
+ /**
163
+ * Returns the active dataset consumed by the virtualizer and DOM pool.
164
+ * When grouping or a custom row model is active, returns the transformed rows;
165
+ * otherwise returns the processed data rows.
166
+ * @api
167
+ */
168
+ getRows(): unknown[];
169
+ /**
170
+ * Returns the flattened `TreeRowNode[]` consumed by the virtualizer when
171
+ * grouping is active. Rebuilds the tree + aggregates only when the
172
+ * structural revision changes (data / columns / groupBy / expanded state).
173
+ *
174
+ * @returns The flattened group/data rows, empty when grouping is disabled.
175
+ * @api
176
+ */
177
+ getGroupedRows(): TreeRowNode<T>[];
178
+ /**
179
+ * Sets the grouping fields. Replaces any existing grouping and resets the
180
+ * expanded state to all-expanded. Scroll position is reset to the top.
181
+ *
182
+ * @param fields - Grouping fields in nesting order, or empty/null to disable grouping.
183
+ * @api
184
+ */
185
+ setGroupBy(fields: string[] | null | undefined, expandedGroups?: Record<string, boolean>): void;
186
+ /**
187
+ * Toggles the expanded state of a single group.
188
+ *
189
+ * @param groupId - Stable group id (the `id` field of a `GroupRowNode`).
190
+ * @api
191
+ */
192
+ toggleGroup(groupId: string): void;
193
+ /** Expands every group. @api */
194
+ expandAll(): void;
195
+ /** Collapses every group. @api */
196
+ collapseAll(): void;
197
+ /** Replaces the expanded-state map for groups. @api */
198
+ setExpandedGroups(expandedGroups: Record<string, boolean>): void;
199
+ /**
200
+ * Registers column id -> aggregation function mappings. Called by
201
+ * aggregation plugins (e.g. `@omnigrid/aggregation-plugin`). Replaces any
202
+ * previously registered functions.
203
+ * @param funcs - Column id to aggregation function map.
204
+ * @returns Unregister function.
205
+ * @api
206
+ */
207
+ registerAggregationFuncs(funcs: Record<string, AggregationFunc<T>>): () => void;
208
+ /** Configures the group column UI mode and header. @api */
209
+ setGroupColumnConfig(config: {
210
+ mode: 'single' | 'perLevel';
211
+ header?: string;
212
+ showChildCount?: boolean;
213
+ groupRowRenderer?: any;
214
+ }): void;
215
+ /** Sets or clears the custom group row renderer. @api */
216
+ setGroupRowRenderer(): void;
217
+ getFilteredData(): T[];
117
218
  private static cloneFilterModel;
118
219
  setFilterModel(model: FilterModel): void;
119
220
  getFilterModel(): FilterModel;