@opencorestack/opengridx 1.2.3 → 2.0.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,63 @@
5
5
 
6
6
  ---
7
7
 
8
+ ## [2.0.0] — 2026-09-08
9
+
10
+ ### Breaking
11
+
12
+ - **Removed dead public API:** `onPinnedRowsChange` and `onRowGroupingModelChange` are removed from
13
+ `DataGridProps`. Both props accepted callbacks that were never invoked — no pin/unpin-row UI and no
14
+ drag-to-group UI exist. Callers that passed these callbacks should simply remove them; grid
15
+ behavior is unchanged.
16
+
17
+ ### Added
18
+
19
+ - **`density` wired** — `density?: 'compact' | 'standard' | 'comfortable'` now sets the
20
+ `--ogx-row-height` CSS variable (compact = 32 px, standard = `rowHeight`, comfortable = 72 px).
21
+ Previously accepted but silently discarded.
22
+ - **`disableRowSelectionOnClick`** — clicking a row no longer triggers selection when this prop is
23
+ `true`. Previously wired to internal state only; `onRowSelectionModelChange` is now also fired.
24
+ - **`disableMultipleRowSelection`** — clicking a row while this prop is `true` caps selection to
25
+ that single row (deselects others). Clicking an already-selected row deselects it.
26
+ - **`groupingColDef` implemented** — passing `groupingColDef` when `rowGroupingModel` is active now
27
+ creates a dedicated `__group__` column at position 0, auto-pinned left. Previously the prop was
28
+ accepted but had no runtime effect.
29
+ - **`groupable: false` honored** — columns with `groupable: false` are now skipped when building the
30
+ grouping tree in `useRowGrouping`. Previously this flag was silently ignored.
31
+ - **`groupingValueFormatter` on `GridColDef`** — new optional field
32
+ `groupingValueFormatter?: (params: { field: string; value: unknown }) => string` customizes the
33
+ label shown for group-header rows at that level. The formatted string flows through
34
+ `GridRowMeta.groupLabel`. Falls back to `"${field}: ${value}"` when omitted.
35
+ - **`availableAggregationFunctions` honored** — per-column `availableAggregationFunctions?: string[]`
36
+ now gates which aggregation functions are computed in `useAggregation`. Functions not in the
37
+ allowed list are skipped for that field.
38
+ - **`multiSort` prop** — new `multiSort?: boolean` on `DataGrid`. When `true`, every click on a
39
+ sortable column header appends/cycles that column in the sort model instead of replacing it — no
40
+ Shift key required. Shift+click continues to work as an append gesture regardless of this prop.
41
+ - **Multi-sort shift-click** — shift-clicking a column header appends the column to `sortModel`
42
+ rather than replacing it. A numbered priority badge appears next to the sort arrow when more than
43
+ one sort key is active. Plain click still replaces with a single-key sort (unless `multiSort` is set).
44
+ - **`description` tooltip** — `description?: string` on `GridColDef` now renders as the native
45
+ `title` attribute on the header cell, providing a browser tooltip on hover.
46
+
47
+ ---
48
+
49
+ ## [1.3.0] — 2026-09-08
50
+
51
+ ### Added
52
+ - **Grouped export** — all five export functions (`exportToCsv`, `exportToExcel`, `exportToJson`,
53
+ `printGrid`, `exportToPdf`) now accept an optional `groupedRows?: GridGroupedExportRow[]` option.
54
+ When provided, the export preserves the row-grouping structure: group-header rows, indented leaf
55
+ rows, per-group subtotals, and a grand total footer. Flat behavior is unchanged when the option
56
+ is absent, making this a fully backward-compatible addition.
57
+ - **`GridApi.getGroupedExportRows()`** — new method that returns a flat ordered list of
58
+ `GridGroupedExportRow` entries (types: `group-header | leaf | group-subtotal | grand-total`)
59
+ by traversing the active row-grouping tree. Returns `null` when row grouping is not active.
60
+ - **`GridGroupedExportRow` type** — new public interface describing each entry in the grouped
61
+ export list (`type`, `depth`, `groupField?`, `groupValue?`, `aggregatedValues?`, `row?`).
62
+
63
+ ---
64
+
8
65
  ## [1.2.3] — 2026-09-08
9
66
 
10
67
  ### Fixed
package/dist/index.d.ts CHANGED
@@ -78,6 +78,8 @@ export declare interface CsvExportOptions {
78
78
  selectedRows?: (string | number)[];
79
79
  aggregationResult?: Record<string, unknown> | null;
80
80
  aggregationModel?: GridAggregationModel | null;
81
+ /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
82
+ groupedRows?: GridGroupedExportRow[];
81
83
  }
82
84
 
83
85
  export declare const darkTheme: GridTheme;
@@ -106,6 +108,13 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
106
108
  sortModel?: GridSortItem[];
107
109
  /** Callback fired when the sorting model changes. */
108
110
  onSortModelChange?: (model: GridSortItem[]) => void;
111
+ /**
112
+ * When true, clicking any sortable column header appends/cycles that column in the
113
+ * sort model instead of replacing it — no Shift key required. Plain click still
114
+ * cycles asc → desc → removed for that column while all other active sort keys stay.
115
+ * Shift+click continues to work regardless of this prop.
116
+ */
117
+ multiSort?: boolean;
109
118
  /** Filtering mode: 'client' (default) or 'server'. */
110
119
  filterMode?: 'client' | 'server';
111
120
  /** The current filter model. */
@@ -134,8 +143,6 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
134
143
  onColumnVisibilityModelChange?: (model: GridColumnVisibilityModel) => void;
135
144
  /** Defines which rows are pinned to the top or bottom. */
136
145
  pinnedRows?: GridRowPinning;
137
- /** Callback fired when row pinning changes. */
138
- onPinnedRowsChange?: (model: GridRowPinning) => void;
139
146
  /** If true, a column of checkboxes is added for row selection. */
140
147
  checkboxSelection?: boolean;
141
148
  /** If true, the checkbox column remains visible during horizontal scrolling. */
@@ -202,8 +209,6 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
202
209
  defaultGroupingExpansionDepth?: number;
203
210
  /** Controlled state for row grouping. */
204
211
  rowGroupingModel?: GridRowGroupingModel;
205
- /** Callback fired when row grouping changes. */
206
- onRowGroupingModelChange?: (model: GridRowGroupingModel) => void;
207
212
  /** Controlled state for data aggregation (e.g., { salary: 'sum' }). */
208
213
  aggregationModel?: GridAggregationModel;
209
214
  /** Callback fired when aggregation model changes. */
@@ -330,6 +335,8 @@ export declare interface ExcelExportOptions {
330
335
  selectedRows?: (string | number)[];
331
336
  aggregationResult?: Record<string, unknown> | null;
332
337
  aggregationModel?: GridAggregationModel | null;
338
+ /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
339
+ groupedRows?: GridGroupedExportRow[];
333
340
  }
334
341
 
335
342
  export declare interface ExcelSheetDefinition {
@@ -404,6 +411,13 @@ export declare interface GridApi {
404
411
  getVisibleRows: () => GridRowModel[];
405
412
  /** Returns all filtered and sorted rows, ignoring pagination. Use this for full-dataset exports. */
406
413
  getAllFilteredRows: () => GridRowModel[];
414
+ /**
415
+ * Returns an ordered flat list of `GridGroupedExportRow` entries that mirrors the
416
+ * on-screen grouping tree: group-headers, leaf rows, per-group subtotals, and a
417
+ * grand-total entry at the end. Returns `null` when no `rowGroupingModel` is active.
418
+ * Pass the result to export functions that accept a `groupedRows` option.
419
+ */
420
+ getGroupedExportRows: () => GridGroupedExportRow[] | null;
407
421
  /** Returns the current aggregation results. */
408
422
  getAggregationResult: () => Record<string, unknown> | null;
409
423
  /** Returns the active aggregation configuration. */
@@ -475,13 +489,22 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
475
489
  field: string;
476
490
  /** Text displayed in the column header. */
477
491
  headerName?: string;
478
- /** Tooltip or accessible description for the header. */
492
+ /** Tooltip shown on header hover — used as the column's accessibility label. */
479
493
  description?: string;
480
494
  /** If true, this column can be used as a grouping dimension. */
481
495
  groupable?: boolean;
496
+ /**
497
+ * Custom formatter for the group-header label when this column is used as a grouping field.
498
+ * Receives the field name and grouped value; return the string to display.
499
+ * Falls back to `"field: value"` when omitted.
500
+ */
501
+ groupingValueFormatter?: (params: {
502
+ field: string;
503
+ value: unknown;
504
+ }) => string;
482
505
  /** If true, this column can be summarized using aggregation functions. */
483
506
  aggregable?: boolean;
484
- /** List of allowed aggregation functions (e.g., ['sum', 'avg']). */
507
+ /** Restricts which aggregation functions are offered for this column (e.g., ['sum', 'avg']). */
485
508
  availableAggregationFunctions?: string[];
486
509
  /** Width in pixels or a percentage string. Defaults to automatic calculation. */
487
510
  width?: number | string;
@@ -697,6 +720,25 @@ export declare interface GridGetRowsResponse<R extends GridRowModel = GridRowMod
697
720
  aggregationResults?: Record<string, unknown>;
698
721
  }
699
722
 
723
+ /**
724
+ * A single entry in the ordered list returned by `GridApi.getGroupedExportRows()`.
725
+ * Traverse in array order to reproduce the on-screen grouping structure.
726
+ */
727
+ declare interface GridGroupedExportRow {
728
+ /** Discriminator: the kind of row this entry represents. */
729
+ type: 'group-header' | 'leaf' | 'group-subtotal' | 'grand-total';
730
+ /** Nesting depth (0 = top-level group, 1 = nested group, etc.). */
731
+ depth: number;
732
+ /** The grouping field for this level (absent on 'leaf' and 'grand-total'). */
733
+ groupField?: string;
734
+ /** The raw grouping value for this level (absent on 'leaf' and 'grand-total'). */
735
+ groupValue?: unknown;
736
+ /** Per-group aggregation results (present on 'group-subtotal' and 'grand-total'). */
737
+ aggregatedValues?: Record<string, unknown>;
738
+ /** The original data row (only present when `type === 'leaf'`). */
739
+ row?: GridRowModel;
740
+ }
741
+
700
742
  export declare type GridInitialState = GridState;
701
743
 
702
744
  /** Column definition used exclusively in List View mode. */
@@ -789,6 +831,7 @@ export declare interface GridRowMeta {
789
831
  treeDepth?: number;
790
832
  groupingField?: string;
791
833
  groupingValue?: unknown;
834
+ groupLabel?: string;
792
835
  descendantCount?: number;
793
836
  isExpanded?: boolean;
794
837
  isGroupRow?: boolean;
@@ -1156,6 +1199,8 @@ declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1156
1199
  field: string;
1157
1200
  } | null;
1158
1201
  onHeaderClick?: (field: string) => void;
1202
+ onSortAdd?: (field: string, direction: GridSortDirection) => void;
1203
+ multiSort?: boolean;
1159
1204
  onHideColumn?: (field: string) => void;
1160
1205
  onPinColumn?: (field: string, side: 'left' | 'right' | null) => void;
1161
1206
  onManageColumns?: () => void;
@@ -1176,6 +1221,8 @@ export declare interface JsonExportOptions {
1176
1221
  selectedRows?: (string | number)[];
1177
1222
  aggregationResult?: Record<string, unknown> | null;
1178
1223
  aggregationModel?: GridAggregationModel | null;
1224
+ /** When provided, emits a nested grouping tree instead of a flat array. */
1225
+ groupedRows?: GridGroupedExportRow[];
1179
1226
  }
1180
1227
 
1181
1228
  /**
@@ -1234,6 +1281,13 @@ export declare interface PdfExportOptions {
1234
1281
  * Base font size in points for table body. Default: 9
1235
1282
  */
1236
1283
  fontSize?: number;
1284
+ /**
1285
+ * Pre-built grouped export rows from `apiRef.current.getGroupedExportRows()`.
1286
+ * When provided, the PDF table reflects the grouping structure (group headers,
1287
+ * leaf rows, per-group subtotals, grand total) instead of a flat row list.
1288
+ * Has no effect when the grid has no active `rowGroupingModel`.
1289
+ */
1290
+ groupedRows?: GridGroupedExportRow[];
1237
1291
  }
1238
1292
 
1239
1293
  /**
@@ -1246,6 +1300,8 @@ export declare interface PrintOptions {
1246
1300
  selectedRows?: (string | number)[];
1247
1301
  aggregationResult?: Record<string, unknown> | null;
1248
1302
  aggregationModel?: GridAggregationModel | null;
1303
+ /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
1304
+ groupedRows?: GridGroupedExportRow[];
1249
1305
  }
1250
1306
 
1251
1307
  export declare const roseTheme: GridTheme;
@@ -1339,6 +1395,7 @@ export declare function useAggregation<R extends GridRowModel>(params: UseAggreg
1339
1395
 
1340
1396
  export declare interface UseAggregationParams<R extends GridRowModel> {
1341
1397
  rows: R[];
1398
+ columns?: GridColDef[];
1342
1399
  aggregationModel: GridAggregationModel;
1343
1400
  isServerSide: boolean;
1344
1401
  dataSource?: GridDataSource<R>;