@opencorestack/opengridx 1.2.2 → 1.3.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,38 @@
5
5
 
6
6
  ---
7
7
 
8
+ ## [1.3.0] — 2026-09-08
9
+
10
+ ### Added
11
+ - **Grouped export** — all five export functions (`exportToCsv`, `exportToExcel`, `exportToJson`,
12
+ `printGrid`, `exportToPdf`) now accept an optional `groupedRows?: GridGroupedExportRow[]` option.
13
+ When provided, the export preserves the row-grouping structure: group-header rows, indented leaf
14
+ rows, per-group subtotals, and a grand total footer. Flat behavior is unchanged when the option
15
+ is absent, making this a fully backward-compatible addition.
16
+ - **`GridApi.getGroupedExportRows()`** — new method that returns a flat ordered list of
17
+ `GridGroupedExportRow` entries (types: `group-header | leaf | group-subtotal | grand-total`)
18
+ by traversing the active row-grouping tree. Returns `null` when row grouping is not active.
19
+ - **`GridGroupedExportRow` type** — new public interface describing each entry in the grouped
20
+ export list (`type`, `depth`, `groupField?`, `groupValue?`, `aggregatedValues?`, `row?`).
21
+
22
+ ---
23
+
24
+ ## [1.2.3] — 2026-09-08
25
+
26
+ ### Fixed
27
+ - `GridToolbar` Columns panel — columns with `hideable: false` are now excluded from
28
+ the panel list by default. Previously they appeared as permanently disabled rows,
29
+ adding visual noise for no benefit (users can never toggle them). The column still
30
+ renders normally in the grid body and in exports — only the Columns panel list changes.
31
+
32
+ ### Added
33
+ - `GridToolbarProps.showNonHideableColumns?: boolean` — opt-out prop. Set to `true` to
34
+ restore the old behavior and show `hideable: false` columns in the panel as disabled
35
+ rows. Default: `false`. No other API surface changed; this is a backward-compatible
36
+ addition.
37
+
38
+ ---
39
+
8
40
  ## [1.2.2] — 2026-09-08
9
41
 
10
42
  ### 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;
@@ -330,6 +332,8 @@ export declare interface ExcelExportOptions {
330
332
  selectedRows?: (string | number)[];
331
333
  aggregationResult?: Record<string, unknown> | null;
332
334
  aggregationModel?: GridAggregationModel | null;
335
+ /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
336
+ groupedRows?: GridGroupedExportRow[];
333
337
  }
334
338
 
335
339
  export declare interface ExcelSheetDefinition {
@@ -404,6 +408,13 @@ export declare interface GridApi {
404
408
  getVisibleRows: () => GridRowModel[];
405
409
  /** Returns all filtered and sorted rows, ignoring pagination. Use this for full-dataset exports. */
406
410
  getAllFilteredRows: () => GridRowModel[];
411
+ /**
412
+ * Returns an ordered flat list of `GridGroupedExportRow` entries that mirrors the
413
+ * on-screen grouping tree: group-headers, leaf rows, per-group subtotals, and a
414
+ * grand-total entry at the end. Returns `null` when no `rowGroupingModel` is active.
415
+ * Pass the result to export functions that accept a `groupedRows` option.
416
+ */
417
+ getGroupedExportRows: () => GridGroupedExportRow[] | null;
407
418
  /** Returns the current aggregation results. */
408
419
  getAggregationResult: () => Record<string, unknown> | null;
409
420
  /** Returns the active aggregation configuration. */
@@ -697,6 +708,25 @@ export declare interface GridGetRowsResponse<R extends GridRowModel = GridRowMod
697
708
  aggregationResults?: Record<string, unknown>;
698
709
  }
699
710
 
711
+ /**
712
+ * A single entry in the ordered list returned by `GridApi.getGroupedExportRows()`.
713
+ * Traverse in array order to reproduce the on-screen grouping structure.
714
+ */
715
+ declare interface GridGroupedExportRow {
716
+ /** Discriminator: the kind of row this entry represents. */
717
+ type: 'group-header' | 'leaf' | 'group-subtotal' | 'grand-total';
718
+ /** Nesting depth (0 = top-level group, 1 = nested group, etc.). */
719
+ depth: number;
720
+ /** The grouping field for this level (absent on 'leaf' and 'grand-total'). */
721
+ groupField?: string;
722
+ /** The raw grouping value for this level (absent on 'leaf' and 'grand-total'). */
723
+ groupValue?: unknown;
724
+ /** Per-group aggregation results (present on 'group-subtotal' and 'grand-total'). */
725
+ aggregatedValues?: Record<string, unknown>;
726
+ /** The original data row (only present when `type === 'leaf'`). */
727
+ row?: GridRowModel;
728
+ }
729
+
700
730
  export declare type GridInitialState = GridState;
701
731
 
702
732
  /** Column definition used exclusively in List View mode. */
@@ -1007,7 +1037,7 @@ export declare interface GridThemeTypography {
1007
1037
  fontSizeXl?: string;
1008
1038
  }
1009
1039
 
1010
- export declare function GridToolbar({ columns, baseColumns, aggregationModel, onAggregationModelChange, pivotModel, onPivotModelChange, filterModel, onFilterModelChange, columnVisibilityModel, onColumnVisibilityModelChange, onColumnReorder, onColumnOrderReset, forceColumnsOpen, onColumnsPanelClose, children, rightContent, style, renderColumnsButton, renderFilterButton, renderAggregationButton, renderExportButton, renderQuickFilter, className, }: GridToolbarProps): JSX.Element;
1040
+ export declare function GridToolbar({ columns, baseColumns, aggregationModel, onAggregationModelChange, pivotModel, onPivotModelChange, filterModel, onFilterModelChange, columnVisibilityModel, onColumnVisibilityModelChange, onColumnReorder, onColumnOrderReset, forceColumnsOpen, onColumnsPanelClose, children, rightContent, style, renderColumnsButton, renderFilterButton, renderAggregationButton, renderExportButton, renderQuickFilter, className, showNonHideableColumns, }: GridToolbarProps): JSX.Element;
1011
1041
 
1012
1042
  export declare interface GridToolbarProps {
1013
1043
  columns?: GridColDef[];
@@ -1058,6 +1088,8 @@ export declare interface GridToolbarProps {
1058
1088
  renderQuickFilter?: (props: ToolbarQuickFilterRenderProps) => default_2.ReactNode;
1059
1089
  /** Additional CSS class applied to the toolbar root element. */
1060
1090
  className?: string;
1091
+ /** Show columns with `hideable: false` in the Columns panel as disabled rows. Default: false. */
1092
+ showNonHideableColumns?: boolean;
1061
1093
  }
1062
1094
 
1063
1095
  export declare function GridTooltip({ title, children, placement, enterDelay, leaveDelay }: GridTooltipProps): JSX.Element;
@@ -1174,6 +1206,8 @@ export declare interface JsonExportOptions {
1174
1206
  selectedRows?: (string | number)[];
1175
1207
  aggregationResult?: Record<string, unknown> | null;
1176
1208
  aggregationModel?: GridAggregationModel | null;
1209
+ /** When provided, emits a nested grouping tree instead of a flat array. */
1210
+ groupedRows?: GridGroupedExportRow[];
1177
1211
  }
1178
1212
 
1179
1213
  /**
@@ -1232,6 +1266,13 @@ export declare interface PdfExportOptions {
1232
1266
  * Base font size in points for table body. Default: 9
1233
1267
  */
1234
1268
  fontSize?: number;
1269
+ /**
1270
+ * Pre-built grouped export rows from `apiRef.current.getGroupedExportRows()`.
1271
+ * When provided, the PDF table reflects the grouping structure (group headers,
1272
+ * leaf rows, per-group subtotals, grand total) instead of a flat row list.
1273
+ * Has no effect when the grid has no active `rowGroupingModel`.
1274
+ */
1275
+ groupedRows?: GridGroupedExportRow[];
1235
1276
  }
1236
1277
 
1237
1278
  /**
@@ -1244,6 +1285,8 @@ export declare interface PrintOptions {
1244
1285
  selectedRows?: (string | number)[];
1245
1286
  aggregationResult?: Record<string, unknown> | null;
1246
1287
  aggregationModel?: GridAggregationModel | null;
1288
+ /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
1289
+ groupedRows?: GridGroupedExportRow[];
1247
1290
  }
1248
1291
 
1249
1292
  export declare const roseTheme: GridTheme;