@opencorestack/opengridx 2.1.0 → 3.0.1

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.
Files changed (225) hide show
  1. package/CHANGELOG.md +399 -0
  2. package/README.md +95 -72
  3. package/dist/index.d.ts +590 -131
  4. package/dist/opengridx.css +1 -1
  5. package/dist/opengridx.es.js +7891 -5631
  6. package/dist/opengridx.es.js.map +1 -1
  7. package/dist/opengridx.umd.js +17 -23
  8. package/dist/opengridx.umd.js.map +1 -1
  9. package/docs/API_REFERENCE.md +348 -166
  10. package/docs/README.md +6 -1
  11. package/docs/architecture/datagrid-orchestration.md +81 -0
  12. package/docs/architecture/grid-row-meta.md +102 -0
  13. package/docs/architecture/use-grid-columns.md +128 -0
  14. package/docs/architecture/use-grid-controlled-state.md +157 -0
  15. package/docs/architecture/use-grid-row-pipeline.md +120 -0
  16. package/docs/architecture/use-grid-scroll-sync.md +111 -0
  17. package/docs/architecture/use-grid-state-snapshot.md +90 -0
  18. package/docs/architecture/use-grid-virtualization.md +115 -0
  19. package/docs/architecture/use-grid-visible-rows.md +85 -0
  20. package/docs/assets/banner-alt.png +0 -0
  21. package/docs/assets/banner.png +0 -0
  22. package/docs/assets/hero.png +0 -0
  23. package/docs/assets/logo.png +0 -0
  24. package/docs/components/aggregation-footer.md +15 -10
  25. package/docs/components/cell.md +16 -6
  26. package/docs/components/column-group-header.md +55 -28
  27. package/docs/components/column-resize.md +17 -13
  28. package/docs/components/column-visibility.md +6 -7
  29. package/docs/components/datagrid.md +15 -13
  30. package/docs/components/empty-state.md +2 -1
  31. package/docs/components/error-overlay.md +12 -7
  32. package/docs/components/filter-panel.md +28 -8
  33. package/docs/components/header.md +28 -9
  34. package/docs/components/pagination.md +14 -8
  35. package/docs/components/row.md +21 -5
  36. package/docs/components/toolbar.md +27 -9
  37. package/docs/components/tooltip.md +16 -7
  38. package/docs/customization/slots-api.md +90 -38
  39. package/docs/customization/theming.md +66 -18
  40. package/docs/features/aggregation-pivot.md +75 -9
  41. package/docs/features/cell-spanning.md +80 -125
  42. package/docs/features/clipboard.md +41 -16
  43. package/docs/features/custom-pagination.md +38 -18
  44. package/docs/features/data-source.md +36 -13
  45. package/docs/features/editing-reordering.md +125 -16
  46. package/docs/features/export-guide.md +126 -39
  47. package/docs/features/filtering.md +44 -6
  48. package/docs/features/infinite-scroll.md +54 -46
  49. package/docs/features/keyboard-navigation.md +83 -0
  50. package/docs/features/list-view.md +58 -5
  51. package/docs/features/loading-states.md +18 -20
  52. package/docs/features/master-detail.md +18 -5
  53. package/docs/features/pdf-export.md +72 -19
  54. package/docs/features/pinning.md +24 -5
  55. package/docs/features/selection.md +50 -10
  56. package/docs/features/sorting-pagination.md +64 -14
  57. package/docs/features/state-persistence.md +78 -10
  58. package/docs/features/toolbar-customization.md +26 -17
  59. package/docs/features/tree-data-grouping.md +36 -8
  60. package/docs/features/virtualization.md +37 -14
  61. package/docs/migration/v1-to-v2.md +115 -0
  62. package/docs/migration/v2-to-v3.md +1233 -0
  63. package/docs/performance.md +124 -0
  64. package/docs/roadmap.md +5 -5
  65. package/lib/components/Cell/Cell.css +17 -1
  66. package/lib/components/Cell/Cell.tsx +129 -57
  67. package/lib/components/Cell/CellErrorBoundary.tsx +12 -6
  68. package/lib/components/Cell/GridEditInputCell.tsx +114 -41
  69. package/lib/components/ColumnGroupHeader/ColumnGroupHeader.css +7 -1
  70. package/lib/components/ColumnResizeHandle/ColumnResizeHandle.css +15 -2
  71. package/lib/components/ColumnResizeHandle/ColumnResizeHandle.tsx +104 -38
  72. package/lib/components/ColumnResizeHandle/clampResizeWidth.ts +13 -0
  73. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.css +6 -0
  74. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.tsx +21 -13
  75. package/lib/components/DataGrid/DataGrid.css +85 -12
  76. package/lib/components/DataGrid/DataGrid.tsx +582 -876
  77. package/lib/components/DataGrid/GridAggregationFooter.tsx +53 -17
  78. package/lib/components/DataGrid/GridErrorOverlay.tsx +15 -12
  79. package/lib/components/DataGrid/GridListView.tsx +165 -24
  80. package/lib/components/DataGrid/GridLiveRegion.tsx +31 -0
  81. package/lib/components/DataGrid/GridLoadingOverlay.tsx +27 -0
  82. package/lib/components/DataGrid/GridPaginationArea.tsx +44 -0
  83. package/lib/components/DataGrid/GridPinnedRows.tsx +62 -11
  84. package/lib/components/DataGrid/GridStandaloneColumnPanel.tsx +40 -38
  85. package/lib/components/DataGrid/GridToolbarSlot.tsx +51 -0
  86. package/lib/components/DataGrid/GridVirtualRows.tsx +40 -24
  87. package/lib/components/DetailPanel/DetailPanel.css +0 -6
  88. package/lib/components/DetailPanel/DetailPanel.tsx +34 -5
  89. package/lib/components/DetailPanel/DetailPanelContent.tsx +17 -0
  90. package/lib/components/FilterPanel/FilterPanel.css +13 -2
  91. package/lib/components/FilterPanel/FilterPanel.tsx +272 -99
  92. package/lib/components/Header/ColumnMenu.tsx +91 -39
  93. package/lib/components/Header/Header.css +6 -3
  94. package/lib/components/Header/Header.tsx +181 -160
  95. package/lib/components/ListView/ListView.css +25 -0
  96. package/lib/components/ListView/ListViewRow.tsx +76 -10
  97. package/lib/components/Pagination/Pagination.tsx +15 -7
  98. package/lib/components/Row/Row.tsx +177 -77
  99. package/lib/components/Toolbar/GlobalSearch.css +6 -3
  100. package/lib/components/Toolbar/GlobalSearch.tsx +26 -27
  101. package/lib/components/Toolbar/GridToolbar.css +12 -11
  102. package/lib/components/Toolbar/GridToolbar.tsx +133 -89
  103. package/lib/components/Toolbar/PivotPanel.tsx +89 -49
  104. package/lib/components/Tooltip/Tooltip.css +20 -0
  105. package/lib/components/Tooltip/Tooltip.tsx +68 -35
  106. package/lib/components/ui/Button.tsx +3 -0
  107. package/lib/components/ui/Checkbox.tsx +2 -1
  108. package/lib/components/ui/ExpandIcon.css +0 -9
  109. package/lib/components/ui/ExpandIcon.tsx +4 -1
  110. package/lib/hooks/core/gridApiPlaceholder.ts +34 -0
  111. package/lib/hooks/core/gridToolbarHostContext.ts +14 -0
  112. package/lib/hooks/core/useDataGrid.ts +115 -173
  113. package/lib/hooks/core/useGridAggregationApi.ts +72 -0
  114. package/lib/hooks/core/useGridApiMethods.ts +115 -0
  115. package/lib/hooks/core/useGridApiRef.ts +19 -4
  116. package/lib/hooks/core/useGridApiRefBinding.ts +18 -0
  117. package/lib/hooks/core/useGridAriaRows.ts +38 -0
  118. package/lib/hooks/core/useGridClipboardApi.ts +38 -0
  119. package/lib/hooks/core/useGridColumnLookup.ts +30 -0
  120. package/lib/hooks/core/useGridColumns.tsx +279 -76
  121. package/lib/hooks/core/useGridColumnsPanel.ts +77 -0
  122. package/lib/hooks/core/useGridControlledState.ts +99 -6
  123. package/lib/hooks/core/useGridDetailPanel.ts +51 -0
  124. package/lib/hooks/core/useGridDevWarnings.ts +104 -5
  125. package/lib/hooks/core/useGridFocusHandlers.ts +50 -0
  126. package/lib/hooks/core/useGridGroupingColumn.ts +62 -0
  127. package/lib/hooks/core/useGridHeaderHandlers.ts +92 -0
  128. package/lib/hooks/core/useGridHierarchy.ts +81 -0
  129. package/lib/hooks/core/useGridKeyboardNavigation.ts +447 -243
  130. package/lib/hooks/core/useGridLiveRowSelection.ts +67 -0
  131. package/lib/hooks/core/useGridPageCorrection.ts +55 -0
  132. package/lib/hooks/core/useGridRowIdOf.ts +32 -0
  133. package/lib/hooks/core/useGridRowInteractions.ts +81 -0
  134. package/lib/hooks/core/useGridRowPipeline.ts +69 -39
  135. package/lib/hooks/core/useGridRowSelection.ts +91 -0
  136. package/lib/hooks/core/useGridScrollSync.ts +80 -32
  137. package/lib/hooks/core/useGridScrollToIndexesApi.ts +45 -0
  138. package/lib/hooks/core/useGridStateSnapshot.ts +40 -5
  139. package/lib/hooks/core/useGridThemeDimensions.ts +49 -0
  140. package/lib/hooks/core/useGridToolbarProps.ts +97 -0
  141. package/lib/hooks/core/useGridViewport.ts +38 -0
  142. package/lib/hooks/core/useGridViewportSize.ts +26 -0
  143. package/lib/hooks/core/useGridVisibleRows.ts +17 -5
  144. package/lib/hooks/core/useLayout.ts +215 -195
  145. package/lib/hooks/core/useRowsScrollEndLatch.ts +41 -0
  146. package/lib/hooks/core/useStableColumns.ts +34 -0
  147. package/lib/hooks/features/useAggregation.ts +82 -51
  148. package/lib/hooks/features/useColumnGroupReorderGuard.ts +34 -0
  149. package/lib/hooks/features/useDetailPanelHeights.ts +29 -0
  150. package/lib/hooks/features/useGridClipboard.ts +133 -73
  151. package/lib/hooks/features/useGridDataSource.ts +354 -128
  152. package/lib/hooks/features/useGridEditing.ts +211 -51
  153. package/lib/hooks/features/useGridPivot.ts +92 -0
  154. package/lib/hooks/features/useGridSpanRenderWindow.ts +104 -0
  155. package/lib/hooks/features/useGridSpanning.ts +410 -306
  156. package/lib/hooks/features/usePivot.ts +0 -0
  157. package/lib/hooks/features/useServerTreeChildren.ts +50 -0
  158. package/lib/hooks/useColumnReorder.ts +38 -44
  159. package/lib/hooks/useRowGrouping.ts +298 -160
  160. package/lib/hooks/useRowReorder.ts +62 -31
  161. package/lib/hooks/useTreeData.ts +287 -220
  162. package/lib/index.ts +28 -2
  163. package/lib/state/index.ts +1 -0
  164. package/lib/state/types.ts +7 -1
  165. package/lib/state/useGridStateStorage.ts +88 -29
  166. package/lib/theme/DataGridThemeProvider.tsx +143 -38
  167. package/lib/theme/gridThemeContext.ts +5 -0
  168. package/lib/theme/index.ts +5 -0
  169. package/lib/theme/presets.ts +5 -4
  170. package/lib/theme/types.ts +40 -2
  171. package/lib/types/index.ts +313 -116
  172. package/lib/utils/aggregation/index.ts +119 -24
  173. package/lib/utils/aria/index.ts +40 -0
  174. package/lib/utils/columnGroups.ts +110 -0
  175. package/lib/utils/columnLookup.ts +33 -0
  176. package/lib/utils/columnWidth.ts +22 -0
  177. package/lib/utils/dataSource/index.ts +46 -0
  178. package/lib/utils/detailPanel.ts +66 -0
  179. package/lib/utils/dragData.ts +44 -0
  180. package/lib/utils/editing/index.ts +30 -0
  181. package/lib/utils/export/exportShared.ts +197 -0
  182. package/lib/utils/export/exportToExcelAdvanced.ts +278 -139
  183. package/lib/utils/export/exportToPdf.ts +143 -92
  184. package/lib/utils/export/groupLabel.ts +14 -0
  185. package/lib/utils/export/index.ts +278 -272
  186. package/lib/utils/export/pdfText.ts +50 -0
  187. package/lib/utils/filtering/index.ts +277 -148
  188. package/lib/utils/focus/index.ts +115 -0
  189. package/lib/utils/gridApiRows.ts +35 -0
  190. package/lib/utils/gridModes.ts +77 -0
  191. package/lib/utils/grouping/groupedExportRows.ts +91 -0
  192. package/lib/utils/pagination/index.ts +56 -0
  193. package/lib/utils/pinning/index.ts +77 -33
  194. package/lib/utils/pivot/index.ts +368 -0
  195. package/lib/utils/scroll/index.ts +55 -5
  196. package/lib/utils/scroll/scrollEnd.ts +18 -0
  197. package/lib/utils/sorting/index.ts +154 -30
  198. package/lib/utils/syntheticRows.ts +12 -0
  199. package/lib/utils/values.ts +206 -0
  200. package/lib/utils/viewport.ts +14 -0
  201. package/llms.txt +261 -164
  202. package/package.json +13 -5
  203. package/lib/components/ColumnGroupHeader/ColumnGroupHeader.tsx +0 -220
  204. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.test.tsx +0 -85
  205. package/lib/components/DataGrid/DataGrid.defects.test.tsx +0 -103
  206. package/lib/components/DataGrid/DataGrid.regression.test.tsx +0 -132
  207. package/lib/components/DataGrid/DataGrid.smoke.test.tsx +0 -58
  208. package/lib/components/DataGrid/DataGrid.v2.test.tsx +0 -127
  209. package/lib/components/DataGrid/DataGrid.virtualization.browser.test.tsx +0 -183
  210. package/lib/components/Header/Header.test.tsx +0 -135
  211. package/lib/components/Pagination/Pagination.test.tsx +0 -64
  212. package/lib/hooks/core/useDataGrid.regression.test.ts +0 -66
  213. package/lib/hooks/core/useGridControlledState.test.ts +0 -86
  214. package/lib/hooks/core/useGridKeyboardNavigation.test.ts +0 -176
  215. package/lib/hooks/core/useGridRowPipeline.test.ts +0 -117
  216. package/lib/hooks/features/useAggregation.test.ts +0 -175
  217. package/lib/hooks/features/usePivot.test.ts +0 -202
  218. package/lib/hooks/useRowGrouping.test.ts +0 -298
  219. package/lib/hooks/useTreeData.test.ts +0 -83
  220. package/lib/utils/aggregation/aggregation.test.ts +0 -16
  221. package/lib/utils/export/exportToExcelAdvanced.test.ts +0 -109
  222. package/lib/utils/export/exportToPdf.test.ts +0 -120
  223. package/lib/utils/export/groupedExport.test.ts +0 -144
  224. package/lib/utils/filtering/filtering.test.ts +0 -178
  225. package/lib/utils/sorting/sorting.test.ts +0 -88
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { default as default_2 } from 'react';
2
2
  import { JSX } from 'react/jsx-runtime';
3
- import { RefObject } from 'react';
3
+ import { MutableRefObject } from 'react';
4
4
 
5
5
  export declare const amberTheme: GridTheme;
6
6
 
@@ -8,7 +8,7 @@ export declare type BuiltInAggFn = 'sum' | 'avg' | 'count' | 'min' | 'max' | 'un
8
8
 
9
9
  export declare const Button: default_2.FC<ButtonProps>;
10
10
 
11
- declare interface ButtonProps extends default_2.ButtonHTMLAttributes<HTMLButtonElement> {
11
+ export declare interface ButtonProps extends default_2.ButtonHTMLAttributes<HTMLButtonElement> {
12
12
  variant?: 'text' | 'outlined' | 'contained';
13
13
  size?: 'small' | 'medium' | 'large';
14
14
  color?: 'primary' | 'secondary' | 'default';
@@ -18,6 +18,16 @@ declare interface ButtonProps extends default_2.ButtonHTMLAttributes<HTMLButtonE
18
18
 
19
19
  export declare const Cell: typeof CellImpl;
20
20
 
21
+ /**
22
+ * Column-span information for one cell.
23
+ *
24
+ * Only span origins (colSpan > 1) and the cells they cover have an entry; every other cell has none
25
+ * and renders at its own resolved width. `leftVisibleCellIndex` / `rightVisibleCellIndex` are indices
26
+ * into the rendered data columns (left-pinned, then unpinned, then right-pinned).
27
+ *
28
+ * The hook stores only `colSpan` for an origin. `Row` adds the merged `width` and `flexGrow` from the
29
+ * columns it renders, so resizing a column never recomputes the spans.
30
+ */
21
31
  declare type CellColSpanInfo = {
22
32
  spannedByColSpan: true;
23
33
  rightVisibleCellIndex: number;
@@ -26,13 +36,14 @@ declare type CellColSpanInfo = {
26
36
  spannedByColSpan: false;
27
37
  cellProps: {
28
38
  colSpan: number;
29
- width: number;
39
+ width?: number;
40
+ flexGrow?: number;
30
41
  };
31
42
  };
32
43
 
33
44
  declare function CellImpl<R extends GridRowModel = GridRowModel>(props: CellProps<R>): JSX.Element | null;
34
45
 
35
- declare interface CellProps<R extends GridRowModel = GridRowModel> {
46
+ export declare interface CellProps<R extends GridRowModel = GridRowModel> {
36
47
  onCellClick?: (params: GridCellParams<R>) => void;
37
48
  onCellEditStart?: (field: string, value: unknown) => void;
38
49
  onCellValueChange?: (field: string, newValue: unknown) => void;
@@ -41,27 +52,38 @@ declare interface CellProps<R extends GridRowModel = GridRowModel> {
41
52
  colDef: GridColDef<R>;
42
53
  rowIndex: number;
43
54
  colIndex: number;
55
+ /** 1-based `aria-colindex` (system columns included). Defaults to `colIndex + 1`. */
56
+ ariaColIndex?: number;
44
57
  isSelected?: boolean;
45
58
  onClick?: (event: default_2.MouseEvent) => void;
46
59
  width?: number;
47
60
  pinnedPosition?: GridPinnedPosition | null;
48
61
  pinnedOffset?: number;
62
+ /**
63
+ * The cell is the last left-pinned or first right-pinned cell of its row: it gets
64
+ * `ogx__cell--pinned-left-last` / `ogx__cell--pinned-right-first` (the section edge shadow).
65
+ */
66
+ isPinnedEdge?: boolean;
49
67
  isFocused?: boolean;
50
68
  isFocusVisible?: boolean;
69
+ /** Whether this cell may enter edit mode (column, row and `isCellEditable` already resolved). */
51
70
  isEditable?: boolean;
52
71
  isEditing?: boolean;
53
72
  onEditStart?: () => void;
54
- onEditStop?: (cancel?: boolean) => void;
73
+ /** Ends this cell's edit. `field` identifies the cell, so a late call cannot end another cell's edit. */
74
+ onEditStop?: (cancel?: boolean, field?: string) => void;
55
75
  onValueChange?: (newValue: unknown) => void;
56
76
  colSpanInfo?: CellColSpanInfo;
57
77
  rowSpan?: number;
58
78
  isHiddenByRowSpan?: boolean;
59
79
  rowMeta?: GridRowMeta;
80
+ /** The error the column's valueGetter threw for this cell (computed by Row); shown as a cell error. */
81
+ valueError?: unknown;
60
82
  }
61
83
 
62
84
  export declare const Checkbox: default_2.FC<CheckboxProps>;
63
85
 
64
- declare interface CheckboxProps extends Omit<default_2.InputHTMLAttributes<HTMLInputElement>, 'type'> {
86
+ export declare interface CheckboxProps extends Omit<default_2.InputHTMLAttributes<HTMLInputElement>, 'type'> {
65
87
  indeterminate?: boolean;
66
88
  label?: string;
67
89
  inputRef?: default_2.Ref<HTMLInputElement>;
@@ -69,9 +91,9 @@ declare interface CheckboxProps extends Omit<default_2.InputHTMLAttributes<HTMLI
69
91
 
70
92
  declare type ColumnKey = string;
71
93
 
72
- export declare function ColumnVisibilityPanel<R extends GridRowModel = GridRowModel>(props: ColumnVisibilityPanelProps<R>): JSX.Element;
94
+ export declare function ColumnVisibilityPanel<R extends GridValidRowModel = GridRowModel>(props: ColumnVisibilityPanelProps<R>): JSX.Element;
73
95
 
74
- export declare interface ColumnVisibilityPanelProps<R extends GridRowModel = GridRowModel> {
96
+ export declare interface ColumnVisibilityPanelProps<R extends GridValidRowModel = GridRowModel> {
75
97
  columns: GridColDef<R>[];
76
98
  visibleColumns: Set<string>;
77
99
  onVisibilityChange: (field: string, isVisible: boolean) => void;
@@ -85,25 +107,53 @@ export declare interface ColumnVisibilityPanelProps<R extends GridRowModel = Gri
85
107
 
86
108
  export declare const compactTheme: GridTheme;
87
109
 
88
- export declare interface CsvExportOptions {
110
+ export declare interface CsvExportOptions<R extends GridValidRowModel = GridRowModel> {
89
111
  fileName?: string;
90
112
  includeHeaders?: boolean;
91
113
  delimiter?: string;
114
+ /**
115
+ * Export only these row IDs. A non-empty selection takes precedence over `groupedRows` (the
116
+ * selected rows are exported flat), and the totals row is recomputed over the selected rows.
117
+ */
92
118
  selectedRows?: (string | number)[];
119
+ /**
120
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
121
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
122
+ */
123
+ getRowId?: (row: R) => GridRowId;
93
124
  aggregationResult?: Record<string, unknown> | null;
94
125
  aggregationModel?: GridAggregationModel | null;
95
126
  /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
96
127
  groupedRows?: GridGroupedExportRow[];
128
+ /**
129
+ * Prefix text cells that start with `=`, `+`, `-`, `@`, tab or carriage return with `'`, so
130
+ * spreadsheet apps show them as text instead of running them as formulas (CSV injection).
131
+ * Plain signed numbers are left alone. Default: `true`
132
+ * @since v3.0
133
+ */
134
+ escapeFormulas?: boolean;
135
+ /**
136
+ * Start the file with a UTF-8 byte-order mark, so Excel reads non-ASCII text (é, ü, ₹, 中文)
137
+ * correctly. Default: `true`
138
+ * @since v3.0
139
+ */
140
+ bom?: boolean;
97
141
  }
98
142
 
99
143
  export declare const darkTheme: GridTheme;
100
144
 
101
- export declare function DataGrid<R extends GridRowModel = GridRowModel>(props: DataGridProps<R>): JSX.Element;
145
+ /**
146
+ * The grid. `R` is your row type: any object type (an interface works), inferred from `rows`. `columns`
147
+ * can be typed for it (`GridColDef<R>[]`, so callbacks see `params.row` as `R`) or untyped (`GridColDef[]`).
148
+ */
149
+ export declare function DataGrid<R extends GridValidRowModel = GridRowModel>(props: DataGridProps<R>): default_2.JSX.Element;
150
+
151
+ export declare function DataGrid<R extends GridValidRowModel = GridRowModel>(props: DataGridUntypedColumnsProps<R>): default_2.JSX.Element;
102
152
 
103
153
  /**
104
154
  * Main properties for the DataGrid component.
105
155
  */
106
- export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
156
+ export declare interface DataGridProps<R extends GridValidRowModel = GridRowModel> {
107
157
  /** The dataset to display in the grid. */
108
158
  rows: R[];
109
159
  /** Column definitions governing how data is displayed and interacted with. */
@@ -178,7 +228,12 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
178
228
  disableRowSelectionOnClick?: boolean;
179
229
  /** If true, the user can only select a single row at a time. */
180
230
  disableMultipleRowSelection?: boolean;
181
- /** If true, a loading shimmer/skeleton is displayed. */
231
+ /**
232
+ * If true, Ctrl/Cmd+C does not copy the selected rows, so the page (or your own handler) owns
233
+ * the shortcut. `apiRef.current.copySelectedRows()` still works. Default: false.
234
+ */
235
+ disableClipboardCopy?: boolean;
236
+ /** Loading state. With no rows the body shows skeleton rows (or `slots.loadingOverlay`); with rows, they stay and a progress bar (or `slots.loadingOverlay`) is shown over them. */
182
237
  loading?: boolean;
183
238
  /** Visual density of the grid. */
184
239
  density?: 'compact' | 'standard' | 'comfortable';
@@ -196,9 +251,16 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
196
251
  localeText?: GridLocaleText;
197
252
  /** Advanced: The starting internal state of the grid. */
198
253
  initialState?: GridInitialState;
199
- /** Advanced: Callback fired for every internal state update. */
254
+ /**
255
+ * Called on mount and whenever the value of the sorting, filter, pagination, columns (widths, order,
256
+ * visibility, pinning) or density state changes. Selection, expansion and editing do not call it.
257
+ */
200
258
  onStateChange?: (state: GridState) => void;
201
- /** Callback fired when a row is clicked. */
259
+ /**
260
+ * Callback fired when a row is clicked. Tree-data parent rows are real rows: a click fires this and
261
+ * selects them like any row (the chevron expands them). Synthetic rows (row-grouping group rows,
262
+ * subtotal rows and auto-created tree parents) do not fire it: clicking a group row toggles it.
263
+ */
202
264
  onRowClick?: (params: GridRowParams<R>) => void;
203
265
  /**
204
266
  * Callback fired when a row is double-clicked. Also fires for group rows; check
@@ -209,9 +271,12 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
209
271
  onRowDoubleClick?: (params: GridRowParams<R>) => void;
210
272
  /** Callback fired when a cell is clicked. */
211
273
  onCellClick?: (params: GridCellParams<R>) => void;
212
- /** Renders the detail panel content for a row in Master-Detail mode. */
274
+ /**
275
+ * Renders the detail panel content for a row in Master-Detail mode. Called for data rows only:
276
+ * synthetic group, subtotal and auto-created tree-parent rows have no detail panel.
277
+ */
213
278
  getDetailPanelContent?: (params: GridDetailPanelParams<R>) => React.ReactNode;
214
- /** Defines the height of the detail panel. */
279
+ /** Defines the height of the detail panel. Called for data rows only, like `getDetailPanelContent`. */
215
280
  getDetailPanelHeight?: (params: GridDetailPanelParams<R>) => GridDetailPanelHeight;
216
281
  /** Controlled state for expanded detail panels. */
217
282
  detailPanelExpandedRowIds?: Set<GridRowId>;
@@ -221,18 +286,34 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
221
286
  disableColumnReorder?: boolean;
222
287
  /** Controlled horizontal order of column fields. */
223
288
  columnOrder?: GridColumnOrder;
224
- /** Callback fired when column order changes. */
289
+ /**
290
+ * Fired when the user moves one column (header drag or Columns panel). `oldIndex` / `targetIndex`
291
+ * are positions in the grid's full column order: every current column, in order.
292
+ */
225
293
  onColumnOrderChange?: (params: GridColumnOrderChangeParams) => void;
294
+ /**
295
+ * Fired with the whole new column order after every change: a header drag, a Columns panel drag
296
+ * and the panel's Reset. The easiest way to keep a controlled `columnOrder` in sync.
297
+ * Not fired for the generated columns of pivot mode.
298
+ */
299
+ onColumnOrderModelChange?: (columnOrder: GridColumnOrder) => void;
226
300
  /** If true, rows can be reordered via drag-and-drop. */
227
301
  rowReordering?: boolean;
228
302
  /** Callback fired when rows are reordered. */
229
303
  onRowOrderChange?: (params: GridRowOrderChangeParams<R>) => void;
230
304
  /** If true, enables hierarchical tree data display. */
231
305
  treeData?: boolean;
232
- /** Function to get the path (array of strings) for a row in Tree Data mode. */
306
+ /**
307
+ * Function to get the path (array of strings) for a row in Tree Data mode. Required with `treeData`:
308
+ * without it the rows are shown flat. Segments may contain any character, including '/'. Keep the
309
+ * function identity stable (module scope or useCallback); a new function rebuilds the tree.
310
+ */
233
311
  getTreeDataPath?: (row: R) => string[];
234
- /** Optional override for the grouping column. */
235
- groupingColDef?: GridColDef<R>;
312
+ /**
313
+ * Adds a dedicated grouping column (pinned left) under row grouping or tree data, configured by these
314
+ * fields. Every key is optional: `field` is always `'__group__'` (a `field` you pass is ignored).
315
+ */
316
+ groupingColDef?: Partial<GridColDef<R>>;
236
317
  /** Initial expansion depth for Tree Data. */
237
318
  defaultGroupingExpansionDepth?: number;
238
319
  /** Controlled state for row grouping. */
@@ -241,7 +322,12 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
241
322
  aggregationModel?: GridAggregationModel;
242
323
  /** Callback fired when aggregation model changes. */
243
324
  onAggregationModelChange?: (model: GridAggregationModel) => void;
244
- /** Advanced: Controls where aggregation results appear relative to groups. */
325
+ /**
326
+ * Advanced: where aggregation results appear. Called for every group node (with its current
327
+ * `isExpanded`) and once with `null` for the grand total. `'inline'` (default for groups) shows them
328
+ * on the group row; `'footer'` on a subtotal row after the group's children while it is expanded
329
+ * (inline while collapsed); `null` hides them. For the grand total, `null` hides the footer row.
330
+ */
245
331
  getAggregationPosition?: (groupNode: GridTreeNode | null) => 'inline' | 'footer' | null;
246
332
  /** If true, switches the grid to multidimensional Pivot Mode. */
247
333
  pivotMode?: boolean;
@@ -259,28 +345,47 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
259
345
  dataSource?: GridDataSource<R>;
260
346
  /** Callback fired when scrolling reaches the bottom of the grid viewport. */
261
347
  onRowsScrollEnd?: (params: GridRowScrollEndParams) => void;
262
- /** Advanced: Reactive reference to the internal API for imperative control. */
263
- apiRef?: React.MutableRefObject<GridApi>;
348
+ /**
349
+ * Advanced: reactive reference to the internal API for imperative control. Pass
350
+ * `useGridApiRef<MyRow>()` to have the row getters typed as `MyRow`; a plain `useGridApiRef()` also works.
351
+ */
352
+ apiRef?: React.MutableRefObject<GridApi<R>> | React.MutableRefObject<GridApi>;
264
353
  /** Custom components to replace internal grid parts. */
265
354
  slots?: {
266
- /** Component rendered as the grid toolbar. */
267
- toolbar?: React.ComponentType<Record<string, unknown>>;
268
- /** Component rendered as the pagination control. */
269
- pagination?: React.ComponentType<Record<string, unknown>>;
270
- /** Component rendered when the grid is empty. */
271
- noRowsOverlay?: React.ComponentType<Record<string, unknown>>;
272
- /** Component rendered during loading states. */
273
- loadingOverlay?: React.ComponentType<Record<string, unknown>>;
274
- /** Component rendered at the very bottom of the grid. */
275
- footer?: React.ComponentType<Record<string, unknown>>;
355
+ /**
356
+ * Component rendered as the grid toolbar. Receives `GridToolbarSlotProps` (plus `slotProps.toolbar`),
357
+ * so it can be typed with `GridToolbarProps` or wrap the exported `GridToolbar`.
358
+ */
359
+ toolbar?: React.ComponentType<GridToolbarSlotProps & Record<string, unknown>>;
360
+ /**
361
+ * Component rendered as the pagination control. Receives `PaginationProps` (plus `slotProps.pagination`),
362
+ * so it can be typed with `PaginationProps` or wrap the exported `Pagination`.
363
+ */
364
+ pagination?: React.ComponentType<GridPaginationSlotProps & Record<string, unknown>>;
365
+ /** Component rendered when the grid is empty. Receives only `slotProps.noRowsOverlay`. */
366
+ noRowsOverlay?: React.ComponentType<GridOverlaySlotProps>;
367
+ /** Component rendered during loading states. Receives only `slotProps.loadingOverlay`. */
368
+ loadingOverlay?: React.ComponentType<GridOverlaySlotProps>;
369
+ /**
370
+ * Component rendered at the very bottom of the grid, in place of the pagination area.
371
+ * Receives `GridFooterSlotProps` (plus `slotProps.footer`).
372
+ */
373
+ footer?: React.ComponentType<GridFooterSlotProps & Record<string, unknown>>;
276
374
  };
277
375
  /** Properties passed directly to custom slots. */
278
376
  slotProps?: {
279
- toolbar?: Record<string, unknown>;
280
- pagination?: Record<string, unknown>;
281
- noRowsOverlay?: Record<string, unknown>;
282
- loadingOverlay?: Record<string, unknown>;
283
- footer?: Record<string, unknown>;
377
+ /**
378
+ * Merged over the props the grid passes to the toolbar. Typed as `GridToolbarProps` (so render props
379
+ * such as `renderQuickFilter` are checked and their parameters inferred), plus any extra keys a custom
380
+ * toolbar reads. `columns` / `baseColumns` are not checked, so typed `GridColDef<R>[]` can be passed.
381
+ */
382
+ toolbar?: Omit<Partial<GridToolbarProps>, 'columns' | 'baseColumns'> & Record<string, unknown>;
383
+ /** Merged over the `PaginationProps` the grid passes to the pagination slot. */
384
+ pagination?: Partial<GridPaginationSlotProps> & Record<string, unknown>;
385
+ noRowsOverlay?: GridOverlaySlotProps;
386
+ loadingOverlay?: GridOverlaySlotProps;
387
+ /** Merged over the `GridFooterSlotProps` the grid passes to the footer slot. */
388
+ footer?: Partial<GridFooterSlotProps> & Record<string, unknown>;
284
389
  };
285
390
  /** When true, renders the grid as a single-column list of cards. Perfect for mobile/responsive views. */
286
391
  listView?: boolean;
@@ -302,9 +407,20 @@ export declare interface DataGridThemeProviderProps {
302
407
  style?: default_2.CSSProperties;
303
408
  }
304
409
 
410
+ /**
411
+ * `DataGridProps<R>` with untyped `columns` (`GridColDef[]`, i.e. `GridColDef<GridRowModel>[]`). `DataGrid`
412
+ * accepts these props as well as `DataGridProps<R>`, so columns written without a row type work with rows of
413
+ * any type `R`. Their callbacks then see `params.row` as `GridRowModel`; type the columns as
414
+ * `GridColDef<R>[]` to get your row type there.
415
+ * @since v3.0
416
+ */
417
+ export declare type DataGridUntypedColumnsProps<R extends GridValidRowModel = GridRowModel> = Omit<DataGridProps<R>, 'columns'> & {
418
+ columns: GridColDef[];
419
+ };
420
+
305
421
  export declare const emeraldTheme: GridTheme;
306
422
 
307
- export declare interface ExcelAdvancedExportOptions {
423
+ export declare interface ExcelAdvancedExportOptions<R extends GridValidRowModel = GridRowModel> {
308
424
  /** Output filename (default: 'export.xlsx') */
309
425
  fileName?: string;
310
426
  /**
@@ -332,8 +448,13 @@ export declare interface ExcelAdvancedExportOptions {
332
448
  aggregationResult?: Record<string, unknown> | null;
333
449
  /** Current aggregation model */
334
450
  aggregationModel?: GridAggregationModel | null;
335
- /** Currently selected row IDs */
451
+ /** Currently selected row IDs, written by `rows: 'selected'` sheets */
336
452
  selectedRows?: (string | number)[];
453
+ /**
454
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
455
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
456
+ */
457
+ getRowId?: (row: R) => GridRowId;
337
458
  /**
338
459
  * Grouped row structure, typically from `apiRef.current.getGroupedExportRows()`.
339
460
  * When provided, sheets with `rows: 'all'` are written in grouped order: group-header,
@@ -357,10 +478,10 @@ export declare interface ExcelColumnStyle {
357
478
  /** Horizontal alignment override */
358
479
  alignment?: 'left' | 'center' | 'right';
359
480
  /**
360
- * If true, the cell value (expected to be an image URL string) will be
361
- * fetched and embedded as an inline image in the cell.
362
- * Requires the image server to serve CORS headers. Falls back to the
363
- * raw URL string if the fetch fails (a warning is logged to the console).
481
+ * If true, the cell value (an image URL string, after `valueGetter`) is fetched and embedded
482
+ * as an inline image in the cell. PNG, JPEG and GIF are supported (detected from the bytes).
483
+ * Requires the image server to serve CORS headers. Falls back to the raw URL string if the
484
+ * fetch fails or the image is in another format (a warning is logged to the console).
364
485
  */
365
486
  embedImage?: boolean;
366
487
  /** Width of the embedded image in pixels (default: 40) */
@@ -369,21 +490,45 @@ export declare interface ExcelColumnStyle {
369
490
  imageHeight?: number;
370
491
  }
371
492
 
372
- export declare interface ExcelExportOptions {
493
+ export declare interface ExcelExportOptions<R extends GridValidRowModel = GridRowModel> {
494
+ /**
495
+ * Output filename. The file is an HTML table that Excel opens as a legacy `.xls` workbook, so a
496
+ * `.xlsx` extension is replaced with `.xls` (Excel refuses HTML content named `.xlsx`). Use
497
+ * `exportToExcelAdvanced` for a real `.xlsx`. Default: `'export.xls'`
498
+ */
373
499
  fileName?: string;
500
+ /** Sheet tab name. Characters Excel rejects are replaced and the name is cut to 31 characters. Default: `'Sheet1'` */
374
501
  sheetName?: string;
375
502
  includeHeaders?: boolean;
503
+ /**
504
+ * Export only these row IDs. A non-empty selection takes precedence over `groupedRows` (the
505
+ * selected rows are exported flat), and the totals rows are recomputed over the selected rows.
506
+ */
376
507
  selectedRows?: (string | number)[];
508
+ /**
509
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
510
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
511
+ */
512
+ getRowId?: (row: R) => GridRowId;
377
513
  aggregationResult?: Record<string, unknown> | null;
378
514
  aggregationModel?: GridAggregationModel | null;
379
515
  /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
380
516
  groupedRows?: GridGroupedExportRow[];
517
+ /**
518
+ * Prefix text cells that start with `=`, `+`, `-`, `@`, tab or carriage return with `'`, so
519
+ * Excel does not run them as formulas. Default: `true`
520
+ * @since v3.0
521
+ */
522
+ escapeFormulas?: boolean;
381
523
  }
382
524
 
383
525
  export declare interface ExcelSheetDefinition {
384
- /** Sheet tab name (max 31 chars) */
526
+ /**
527
+ * Sheet tab name. Characters Excel rejects (`\ / ? * : [ ]`) become `-`, the name is cut to
528
+ * 31 characters, and a duplicate name gets a " (2)" suffix.
529
+ */
385
530
  name: string;
386
- /** Which rows to include. Default: 'all' */
531
+ /** Which rows to include. `'selected'` writes only `selectedRows` (none when nothing is selected). Default: 'all' */
387
532
  rows?: 'all' | 'selected';
388
533
  /** Include header row. Default: true */
389
534
  includeHeaders?: boolean;
@@ -397,9 +542,13 @@ export declare interface ExcelSheetDefinition {
397
542
  alternateRowColor?: string | false;
398
543
  }
399
544
 
400
- export declare function exportToCsv<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: CsvExportOptions): void;
545
+ export declare function exportToCsv<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: CsvExportOptions<R>): void;
401
546
 
402
- export declare function exportToExcel<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: ExcelExportOptions): void;
547
+ export declare function exportToCsv<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: CsvExportOptions<R>): void;
548
+
549
+ export declare function exportToExcel<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: ExcelExportOptions<R>): void;
550
+
551
+ export declare function exportToExcel<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: ExcelExportOptions<R>): void;
403
552
 
404
553
  /**
405
554
  * Export the grid data to a real XLSX file using ExcelJS.
@@ -409,29 +558,43 @@ export declare function exportToExcel<R extends GridRowModel>(rows: R[], columns
409
558
  * ExcelJS is loaded lazily so it does not affect bundle size for apps
410
559
  * that only use CSV/JSON export.
411
560
  */
412
- export declare function exportToExcelAdvanced<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: ExcelAdvancedExportOptions): Promise<void>;
561
+ export declare function exportToExcelAdvanced<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: ExcelAdvancedExportOptions<R>): Promise<void>;
562
+
563
+ export declare function exportToExcelAdvanced<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: ExcelAdvancedExportOptions<R>): Promise<void>;
413
564
 
414
565
  /**
415
- * Export data to JSON format
566
+ * Export data to JSON format. Values are written raw (after `valueGetter`, without
567
+ * `valueFormatter`), including aggregation values, so the output can be parsed as data.
416
568
  */
417
- export declare function exportToJson<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: JsonExportOptions): void;
569
+ export declare function exportToJson<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: JsonExportOptions<R>): void;
418
570
 
419
- export declare function exportToPdf<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: PdfExportOptions): Promise<void>;
571
+ export declare function exportToJson<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: JsonExportOptions<R>): void;
572
+
573
+ export declare function exportToPdf<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: PdfExportOptions<R>): Promise<void>;
574
+
575
+ export declare function exportToPdf<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: PdfExportOptions<R>): Promise<void>;
420
576
 
421
577
  export declare const FilterPanel: default_2.FC<FilterPanelProps>;
422
578
 
423
- declare interface FilterPanelProps {
579
+ export declare interface FilterPanelProps {
424
580
  filterModel: GridFilterModel;
425
581
  columns: GridColDef[];
426
582
  onFilterModelChange: (model: GridFilterModel) => void;
427
583
  }
428
584
 
585
+ /** Default display string for an aggregate: `—` when missing, locale-grouped numbers, avg to 2 decimals. */
429
586
  export declare function formatAggregationValue(value: unknown, fnName: string): string;
430
587
 
431
588
  export declare interface GridAggregationModel {
432
589
  [field: string]: string;
433
590
  }
434
591
 
592
+ /**
593
+ * Where a group's aggregates are shown, as returned by `getAggregationPosition`: `'inline'` on the group row,
594
+ * `'footer'` on a subtotal row after the group's children, `null` hidden.
595
+ */
596
+ export declare type GridAggregationPosition = 'inline' | 'footer' | null;
597
+
435
598
  export declare type GridAggregationResult = Record<string, unknown>;
436
599
 
437
600
  export declare type GridAlignment = 'left' | 'center' | 'right';
@@ -440,18 +603,22 @@ export declare type GridAlignment = 'left' | 'center' | 'right';
440
603
  * The Imperative API for interacting with the DataGrid.
441
604
  * Access this via the `apiRef` prop or a ref passed to the component.
442
605
  */
443
- export declare interface GridApi {
606
+ /**
607
+ * The imperative grid API. `R` types the row getters (`getRow`, `getAllRows`, `getVisibleRows`,
608
+ * `getAllFilteredRows`); it defaults to `GridRowModel`, so `GridApi` alone keeps working.
609
+ */
610
+ export declare interface GridApi<R extends GridValidRowModel = GridRowModel> {
444
611
  /**
445
612
  * Returns the row model with the given ID.
446
613
  * @param id The row unique ID.
447
614
  */
448
- getRow: (id: GridRowId) => GridRowModel | null;
615
+ getRow: (id: GridRowId) => R | null;
449
616
  /** Returns all rows currently loaded into the grid. */
450
- getAllRows: () => GridRowModel[];
617
+ getAllRows: () => R[];
451
618
  /** Returns all rows currently visible after filtering and sorting. */
452
- getVisibleRows: () => GridRowModel[];
619
+ getVisibleRows: () => R[];
453
620
  /** Returns all filtered and sorted rows, ignoring pagination. Use this for full-dataset exports. */
454
- getAllFilteredRows: () => GridRowModel[];
621
+ getAllFilteredRows: () => R[];
455
622
  /**
456
623
  * Returns an ordered flat list of `GridGroupedExportRow` entries that mirrors the
457
624
  * on-screen grouping tree: group-headers, leaf rows, per-group subtotals, and a
@@ -505,14 +672,16 @@ export declare interface GridApi {
505
672
  colIndex?: number;
506
673
  }) => void;
507
674
  /**
508
- * Programmatically copies all currently selected rows to the clipboard as TSV.
509
- * Equivalent to the user pressing Ctrl+C / Cmd+C.
510
- * @returns A Promise that resolves when the copy completes.
675
+ * Programmatically copies all currently selected rows to the clipboard as TSV: every selected
676
+ * row that passes the filter (other pages, collapsed groups and pinned rows included), with the
677
+ * visible columns in screen order. Equivalent to the user pressing Ctrl+C / Cmd+C.
678
+ * @returns A Promise that resolves when the text is written (or when no selected row was found,
679
+ * in which case nothing is written) and rejects when the clipboard write fails.
511
680
  */
512
681
  copySelectedRows: () => Promise<void>;
513
682
  }
514
683
 
515
- export declare interface GridCellParams<R extends GridRowModel = GridRowModel> {
684
+ export declare interface GridCellParams<R extends GridValidRowModel = GridRowModel> {
516
685
  row: R;
517
686
  field: string;
518
687
  value: unknown;
@@ -525,7 +694,7 @@ export declare interface GridCellParams<R extends GridRowModel = GridRowModel> {
525
694
  * Metadata for a single column.
526
695
  * Governs rendering, sorting, filtering, and data transformation.
527
696
  */
528
- export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
697
+ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel> {
529
698
  /** The unique identifier for the column, typically matching a row object key. */
530
699
  field: string;
531
700
  /** Text displayed in the column header. */
@@ -579,25 +748,41 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
579
748
  label: string;
580
749
  }>;
581
750
  /** Function to compute a cell value from raw row data. */
582
- valueGetter?: (params: GridValueGetterParams<R>) => unknown;
751
+ valueGetter?(params: GridValueGetterParams<R>): unknown;
752
+ /**
753
+ * Maps an edited value back onto the row when an edit is committed; return the updated row.
754
+ * Needed for editable columns with a `valueGetter`, whose value is not stored in `row[field]`.
755
+ * Without it the commit writes `row[field] = value`.
756
+ * @since v3.0
757
+ */
758
+ valueSetter?(params: GridValueSetterParams<R>): R;
583
759
  /** Function to format a value into a human-readable string. */
584
- valueFormatter?: (params: GridValueFormatterParams<R>) => string;
760
+ valueFormatter?(params: GridValueFormatterParams<R>): string;
585
761
  /** Custom component or element to render in the cell. */
586
- renderCell?: (params: GridRenderCellParams<R>) => React.ReactNode;
762
+ renderCell?(params: GridRenderCellParams<R>): React.ReactNode;
587
763
  /** Custom component or element to render in the header. */
588
- renderHeader?: (params: GridRenderHeaderParams) => React.ReactNode;
589
- /** Component to render when the cell is in edit mode. */
590
- renderEditCell?: (params: GridRenderCellParams<R>) => React.ReactNode;
764
+ renderHeader?(params: GridRenderHeaderParams): React.ReactNode;
765
+ /** Component to render when the cell is in edit mode. Receives `onValueChange`, `onCommit` and `onCancel`. */
766
+ renderEditCell?(params: GridRenderEditCellParams<R>): React.ReactNode;
591
767
  /** If true, the cell's value can be modified by the user. */
592
768
  editable?: boolean;
593
769
  /** Optional stacking order (CSS z-index). */
594
770
  zIndex?: number;
595
771
  /** If true, the column kebab/hamburger menu is disabled. */
596
772
  disableColumnMenu?: boolean;
597
- /** Number of columns this cell should occupy horizontally. */
598
- colSpan?: number | ((params: GridRenderCellParams<R>) => number);
599
- /** Number of rows this cell should occupy vertically. */
600
- rowSpan?: number | ((params: GridRenderCellParams<R>) => number);
773
+ /**
774
+ * Number of columns this cell should occupy horizontally: the origin plus the next visible columns
775
+ * in render order, clamped to the end of the origin's pinned section. Fractions are floored,
776
+ * `Infinity` means "to the end", and NaN / values below 1 mean no span. `params.value` is the
777
+ * `valueGetter` result. A function that throws is treated as 1.
778
+ */
779
+ colSpan?: number | GridColDefCallback<GridRenderCellParams<R>, number>;
780
+ /**
781
+ * Number of rows this cell should occupy vertically, clamped to the end of its row section
782
+ * (top-pinned, scrolling or bottom-pinned rows) and to the first row with an expanded detail
783
+ * panel. Normalised like `colSpan`. With both set, the origin covers the whole rectangle.
784
+ */
785
+ rowSpan?: number | GridColDefCallback<GridRenderCellParams<R>, number>;
601
786
  /**
602
787
  * Custom CSS class applied to every cell in this column.
603
788
  * Can be a static string or a function that receives the cell params and returns a string.
@@ -606,7 +791,7 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
606
791
  * cellClassName: 'my-class'
607
792
  * cellClassName: ({ value }) => value > 100 ? 'cell--high' : 'cell--low'
608
793
  */
609
- cellClassName?: string | ((params: GridRenderCellParams<R>) => string);
794
+ cellClassName?: string | GridColDefCallback<GridRenderCellParams<R>, string>;
610
795
  /**
611
796
  * Custom CSS class applied to the header cell of this column.
612
797
  * @example
@@ -621,6 +806,15 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
621
806
  exportable?: boolean;
622
807
  }
623
808
 
809
+ /**
810
+ * A callback that is checked bivariantly in its parameter, like a method. Used for `GridColDef`
811
+ * options that are either a value or a function, so a column typed for your rows (`GridColDef<Row>`)
812
+ * can still be used where an untyped `GridColDef` is expected.
813
+ */
814
+ declare type GridColDefCallback<P, T> = {
815
+ bivarianceHack(params: P): T;
816
+ }['bivarianceHack'];
817
+
624
818
  /**
625
819
  * Describes one level of column grouping.
626
820
  * Groups can be nested by placing child GridColumnGroup objects in `children`.
@@ -639,7 +833,7 @@ export declare interface GridColumnGroup {
639
833
  groupId: string;
640
834
  /** Text displayed in the group header cell. */
641
835
  headerName: string;
642
- /** Optional override for the header cell background color. */
836
+ /** CSS class(es) added to this group's header cell(s). */
643
837
  headerClassName?: string;
644
838
  /**
645
839
  * Either an array of column field strings (leaf group)
@@ -650,7 +844,7 @@ export declare interface GridColumnGroup {
650
844
 
651
845
  export declare type GridColumnGroupingModel = GridColumnGroup[];
652
846
 
653
- declare type GridColumnOrder = string[];
847
+ export declare type GridColumnOrder = string[];
654
848
 
655
849
  export declare interface GridColumnOrderChangeParams {
656
850
  column: GridColDef;
@@ -679,7 +873,7 @@ export declare type GridColumnVisibilityModel = Record<string, boolean>;
679
873
  * Interface for providing data to the grid from a remote source.
680
874
  * Enables server-side sorting, filtering, and pagination.
681
875
  */
682
- export declare interface GridDataSource<R extends GridRowModel = GridRowModel> {
876
+ export declare interface GridDataSource<R extends GridValidRowModel = GridRowModel> {
683
877
  /**
684
878
  * Fetches a chunk of rows based on current grid state.
685
879
  * @param params Sorting, filtering, and range parameters.
@@ -691,7 +885,7 @@ export declare interface GridDataSource<R extends GridRowModel = GridRowModel> {
691
885
  getAggregations?: (params: Omit<GridGetRowsParams, 'startRow' | 'endRow'>) => Promise<Record<string, unknown>>;
692
886
  }
693
887
 
694
- declare interface GridDataSourceState {
888
+ export declare interface GridDataSourceState {
695
889
  loading: boolean;
696
890
  error?: unknown;
697
891
  }
@@ -700,9 +894,9 @@ export declare interface GridDensityState {
700
894
  density: 'compact' | 'standard' | 'comfortable';
701
895
  }
702
896
 
703
- declare type GridDetailPanelHeight = number | 'auto';
897
+ export declare type GridDetailPanelHeight = number | 'auto';
704
898
 
705
- export declare interface GridDetailPanelParams<R extends GridRowModel = GridRowModel> {
899
+ export declare interface GridDetailPanelParams<R extends GridValidRowModel = GridRowModel> {
706
900
  row: R;
707
901
  id: GridRowId;
708
902
  rowIndex: number;
@@ -740,12 +934,34 @@ export declare interface GridFilterModel {
740
934
  quickFilterValues?: string[];
741
935
  }
742
936
 
743
- export declare type GridFilterOperator = 'contains' | 'equals' | 'startsWith' | 'endsWith' | 'isEmpty' | 'isNotEmpty' | 'isAnyOf' | '>' | '>=' | '<' | '<=' | '!=' | 'is' | 'not';
937
+ export declare type GridFilterOperator = 'contains' | 'equals' | 'startsWith' | 'endsWith' | 'isEmpty' | 'isNotEmpty' | 'isAnyOf' | '=' | '>' | '>=' | '<' | '<=' | '!=' | 'is' | 'not' | 'after' | 'onOrAfter' | 'before' | 'onOrBefore';
744
938
 
745
939
  export declare interface GridFilterState {
746
940
  filterModel: GridFilterModel;
747
941
  }
748
942
 
943
+ /**
944
+ * Props the grid passes to `slots.footer`, before `slotProps.footer` is merged over them.
945
+ * @since v3.0
946
+ */
947
+ export declare interface GridFooterSlotProps {
948
+ apiRef: React.MutableRefObject<GridApi>;
949
+ /** The active aggregation model (`{}` when none). */
950
+ aggregationModel: GridAggregationModel;
951
+ /** The grand-total aggregation result, or `null` when no aggregation is active. */
952
+ aggregationResult: GridAggregationResult | null;
953
+ /**
954
+ * The built-in pager's count: rows after filtering, pinned rows excluded (`rowCount` from the
955
+ * server in server pagination mode). Under tree data / row grouping: the filtered data rows.
956
+ */
957
+ rowCount: number;
958
+ /** Whether pagination is in effect (false under row grouping and infinite scroll). */
959
+ pagination: boolean;
960
+ paginationModel: GridPaginationModel;
961
+ pageSizeOptions: number[];
962
+ onPaginationModelChange: (model: GridPaginationModel) => void;
963
+ }
964
+
749
965
  export declare interface GridGetRowsParams {
750
966
  startRow: number;
751
967
  endRow: number;
@@ -755,7 +971,7 @@ export declare interface GridGetRowsParams {
755
971
  aggregationModel?: GridAggregationModel;
756
972
  }
757
973
 
758
- export declare interface GridGetRowsResponse<R extends GridRowModel = GridRowModel> {
974
+ export declare interface GridGetRowsResponse<R extends GridValidRowModel = GridRowModel> {
759
975
  rows: R[];
760
976
  rowCount?: number;
761
977
  aggregationResults?: Record<string, unknown>;
@@ -765,7 +981,7 @@ export declare interface GridGetRowsResponse<R extends GridRowModel = GridRowMod
765
981
  * A single entry in the ordered list returned by `GridApi.getGroupedExportRows()`.
766
982
  * Traverse in array order to reproduce the on-screen grouping structure.
767
983
  */
768
- declare interface GridGroupedExportRow {
984
+ export declare interface GridGroupedExportRow {
769
985
  /** Discriminator: the kind of row this entry represents. */
770
986
  type: 'group-header' | 'leaf' | 'group-subtotal' | 'grand-total';
771
987
  /** Nesting depth (0 = top-level group, 1 = nested group, etc.). */
@@ -774,18 +990,31 @@ declare interface GridGroupedExportRow {
774
990
  groupField?: string;
775
991
  /** The raw grouping value for this level (absent on 'leaf' and 'grand-total'). */
776
992
  groupValue?: unknown;
993
+ /**
994
+ * The group label exactly as the grid shows it (from `groupingValueFormatter`, else `"field: value"`),
995
+ * on 'group-header' and 'group-subtotal' entries from `getGroupedExportRows()`. Exporters use it for
996
+ * group-header rows; when absent they apply the column's `groupingValueFormatter` themselves.
997
+ * @since v3.0
998
+ */
999
+ groupLabel?: string;
777
1000
  /** Per-group aggregation results (present on 'group-subtotal' and 'grand-total'). */
778
1001
  aggregatedValues?: Record<string, unknown>;
779
1002
  /** The original data row (only present when `type === 'leaf'`). */
780
1003
  row?: GridRowModel;
781
1004
  }
782
1005
 
783
- export declare type GridInitialState = GridState;
1006
+ /**
1007
+ * The state the grid starts from. Every part is optional, including each column field, so a
1008
+ * partial state such as `{ columns: { columnVisibilityModel: { age: false } } }` is valid.
1009
+ */
1010
+ export declare interface GridInitialState extends Omit<GridState, 'columns'> {
1011
+ columns?: Partial<GridColumnsState>;
1012
+ }
784
1013
 
785
1014
  /** Column definition used exclusively in List View mode. */
786
- export declare interface GridListViewColDef<R extends GridRowModel = GridRowModel> {
1015
+ export declare interface GridListViewColDef<R extends GridValidRowModel = GridRowModel> {
787
1016
  field: string;
788
- renderCell: (params: GridRenderCellParams<R>) => React.ReactNode;
1017
+ renderCell(params: GridRenderCellParams<R>): React.ReactNode;
789
1018
  }
790
1019
 
791
1020
  /** Overrideable user-visible strings for internationalisation. All fields are optional; defaults match the built-in English strings. */
@@ -800,11 +1029,24 @@ export declare interface GridLocaleText {
800
1029
  noRowsLabel?: string;
801
1030
  }
802
1031
 
1032
+ /**
1033
+ * Props of `slots.noRowsOverlay` and `slots.loadingOverlay`: the grid passes none of its own, only
1034
+ * `slotProps.noRowsOverlay` / `slotProps.loadingOverlay`.
1035
+ * @since v3.0
1036
+ */
1037
+ export declare type GridOverlaySlotProps = Record<string, unknown>;
1038
+
803
1039
  export declare interface GridPaginationModel {
804
1040
  page: number;
805
1041
  pageSize: number;
806
1042
  }
807
1043
 
1044
+ /**
1045
+ * Props the grid passes to `slots.pagination`, before `slotProps.pagination` is merged over them.
1046
+ * @since v3.0
1047
+ */
1048
+ export declare type GridPaginationSlotProps = PaginationProps;
1049
+
808
1050
  export declare interface GridPaginationState {
809
1051
  paginationModel: GridPaginationModel;
810
1052
  rowCount?: number;
@@ -827,7 +1069,7 @@ export declare interface GridPivotValueField {
827
1069
  }
828
1070
 
829
1071
  /** Parameters passed to the `renderCell` function. */
830
- export declare interface GridRenderCellParams<R extends GridRowModel = GridRowModel> {
1072
+ export declare interface GridRenderCellParams<R extends GridValidRowModel = GridRowModel> {
831
1073
  /** The current cell value. */
832
1074
  value: unknown;
833
1075
  /**
@@ -852,6 +1094,19 @@ export declare interface GridRenderCellParams<R extends GridRowModel = GridRowMo
852
1094
  rowMeta?: GridRowMeta;
853
1095
  }
854
1096
 
1097
+ /**
1098
+ * Parameters passed to `renderEditCell`. `value` is the pending (uncommitted) value.
1099
+ * @since v3.0
1100
+ */
1101
+ export declare interface GridRenderEditCellParams<R extends GridValidRowModel = GridRowModel> extends GridRenderCellParams<R> {
1102
+ /** Updates the pending value. Call it on every change; nothing is saved until `onCommit`. */
1103
+ onValueChange: (value: unknown) => void;
1104
+ /** Commits the pending value (runs `processRowUpdate`) and leaves edit mode. */
1105
+ onCommit: () => void;
1106
+ /** Discards the pending value and leaves edit mode. */
1107
+ onCancel: () => void;
1108
+ }
1109
+
855
1110
  export declare interface GridRenderHeaderParams {
856
1111
  field: string;
857
1112
  colDef: GridColDef;
@@ -864,24 +1119,39 @@ export declare type GridRowGroupingModel = string[];
864
1119
  export declare type GridRowId = string | number;
865
1120
 
866
1121
  /**
867
- * Internal hierarchy metadata for a row. Exposed via `params.rowMeta` in `renderCell`.
1122
+ * Hierarchy metadata for a row. Exposed via `params.rowMeta` in `renderCell`.
868
1123
  * Not present (`undefined`) for flat rows with no active tree-data or row-grouping.
869
1124
  *
870
1125
  * @since v1.1 — replaces the `_hasChildren` / `_treeDepth` / `_groupingField` etc.
871
- * properties that were previously (and incorrectly) typed on `GridRowModel`.
872
- * Those underscore fields remain on the row object at runtime for backward
873
- * compatibility; removal was deferred past v2.0 (still present as of v2.1.0)
874
- * to a future major version. Do not rely on them being absent yet.
1126
+ * fields that were injected onto row objects. Since v3.0 those fields are no longer
1127
+ * added at runtime: row objects reach `renderCell` exactly as you passed them.
875
1128
  */
876
1129
  export declare interface GridRowMeta {
1130
+ /** The row has children to show: the expand toggle is rendered for it. */
877
1131
  hasChildren?: boolean;
878
1132
  treeDepth?: number;
879
1133
  groupingField?: string;
880
1134
  groupingValue?: unknown;
1135
+ /** The label the grid shows for a synthetic row: the group label, or the path segment of an auto-created tree parent. */
881
1136
  groupLabel?: string;
1137
+ /**
1138
+ * Data rows below this row at any depth that pass the active filter (row-grouping leaves, or
1139
+ * tree-data rows; auto-created tree parents are not counted). The "(n)" shown next to group labels.
1140
+ */
882
1141
  descendantCount?: number;
883
1142
  isExpanded?: boolean;
1143
+ /**
1144
+ * The row is synthetic: a row-grouping group row, a group subtotal row, or a tree-data parent the
1145
+ * grid created for a path segment with no row of its own. Synthetic rows are never selected,
1146
+ * edited or given a detail panel, and `valueGetter` is not called for them.
1147
+ */
884
1148
  isGroupRow?: boolean;
1149
+ /**
1150
+ * The row is the subtotal row of the group described by `groupingField` / `groupingValue`, shown
1151
+ * after the group's children when `getAggregationPosition` returns `'footer'` for it.
1152
+ * @since v3.0
1153
+ */
1154
+ isGroupFooter?: boolean;
885
1155
  }
886
1156
 
887
1157
  /** Base interface for a grid row data object. */
@@ -896,13 +1166,13 @@ export declare interface GridRowModel {
896
1166
  [key: string]: unknown;
897
1167
  }
898
1168
 
899
- export declare interface GridRowOrderChangeParams<R extends GridRowModel = GridRowModel> {
1169
+ export declare interface GridRowOrderChangeParams<R extends GridValidRowModel = GridRowModel> {
900
1170
  row: R;
901
1171
  oldIndex: number;
902
1172
  targetIndex: number;
903
1173
  }
904
1174
 
905
- export declare interface GridRowParams<R extends GridRowModel = GridRowModel> {
1175
+ export declare interface GridRowParams<R extends GridValidRowModel = GridRowModel> {
906
1176
  row: R;
907
1177
  id: GridRowId;
908
1178
  rowIndex: number;
@@ -916,7 +1186,7 @@ export declare interface GridRowPinning {
916
1186
  bottom?: GridRowId[];
917
1187
  }
918
1188
 
919
- declare interface GridRowScrollEndParams {
1189
+ export declare interface GridRowScrollEndParams {
920
1190
  visibleTop: number;
921
1191
  visibleBottom: number;
922
1192
  viewportHeight: number;
@@ -924,6 +1194,12 @@ declare interface GridRowScrollEndParams {
924
1194
 
925
1195
  export declare type GridRowSelectionModel = GridRowId[];
926
1196
 
1197
+ /** The `slotProps` prop of `DataGrid`: props for each slot, keyed like `GridSlots`. */
1198
+ export declare type GridSlotProps = NonNullable<DataGridProps['slotProps']>;
1199
+
1200
+ /** The `slots` prop of `DataGrid`: components that replace built-in parts of the grid. */
1201
+ export declare type GridSlots = NonNullable<DataGridProps['slots']>;
1202
+
927
1203
  export declare type GridSortDirection = 'asc' | 'desc' | null;
928
1204
 
929
1205
  export declare interface GridSortingState {
@@ -950,6 +1226,12 @@ export declare interface GridState {
950
1226
  }
951
1227
 
952
1228
  export declare interface GridTheme {
1229
+ /**
1230
+ * The complete base palette the theme starts from (default `'light'`). The provider pins every
1231
+ * colour token, so the grid follows the theme whatever the operating-system colour scheme is.
1232
+ * Use `'dark'` for a dark theme; the other keys override single tokens on top of it.
1233
+ */
1234
+ mode?: 'light' | 'dark';
953
1235
  colors?: GridThemeColors;
954
1236
  typography?: GridThemeTypography;
955
1237
  spacing?: GridThemeSpacing;
@@ -987,13 +1269,46 @@ export declare interface GridThemeColors {
987
1269
  warning?: string;
988
1270
  error?: string;
989
1271
  info?: string;
1272
+ /** Page-level surface colour (`--ogx-color-white`): inputs, buttons, checkbox fallbacks. */
1273
+ white?: string;
1274
+ /** Strongest text colour (`--ogx-color-black`). */
1275
+ black?: string;
1276
+ /**
1277
+ * The neutral scale (`--ogx-color-gray-50` … `--ogx-color-gray-900`) used by group rows, detail
1278
+ * panels, inputs, buttons and panels. The theme's `mode` supplies a complete scale; override
1279
+ * single steps here.
1280
+ */
1281
+ gray?: GridThemeGrayScale;
990
1282
  }
991
1283
 
1284
+ /** Steps of the neutral scale; 50 is the lightest surface in light mode, the darkest in dark mode. */
1285
+ export declare interface GridThemeGrayScale {
1286
+ 50?: string;
1287
+ 100?: string;
1288
+ 200?: string;
1289
+ 300?: string;
1290
+ 400?: string;
1291
+ 500?: string;
1292
+ 600?: string;
1293
+ 700?: string;
1294
+ 800?: string;
1295
+ 900?: string;
1296
+ }
1297
+
1298
+ /**
1299
+ * Row and header heights are read by the grid itself (they drive virtualization), so they must be
1300
+ * pixel values such as `'36px'` or `'36'`. The `rowHeight` / `headerHeight` props win over them;
1301
+ * `rowHeightCompact` / `rowHeightComfortable` apply with `density="compact"` / `"comfortable"`.
1302
+ */
992
1303
  export declare interface GridThemeGrid {
993
1304
  rowHeightCompact?: string;
994
1305
  rowHeightStandard?: string;
995
1306
  rowHeightComfortable?: string;
996
1307
  headerHeight?: string;
1308
+ /** Font size of body cells (`--ogx-grid-cell-font-size`, default 13px). */
1309
+ cellFontSize?: string;
1310
+ /** Font size of header cells (`--ogx-grid-header-font-size`, default 13px). */
1311
+ headerFontSize?: string;
997
1312
  cellPaddingX?: string;
998
1313
  cellPaddingY?: string;
999
1314
  background?: string;
@@ -1014,7 +1329,7 @@ export declare interface GridThemeGrid {
1014
1329
  checkboxBorder?: string;
1015
1330
  }
1016
1331
 
1017
- declare interface GridThemeOverlays {
1332
+ export declare interface GridThemeOverlays {
1018
1333
  background?: string;
1019
1334
  text?: string;
1020
1335
  border?: string;
@@ -1027,7 +1342,7 @@ declare interface GridThemeOverlays {
1027
1342
  itemDangerText?: string;
1028
1343
  }
1029
1344
 
1030
- declare interface GridThemeScrollbar {
1345
+ export declare interface GridThemeScrollbar {
1031
1346
  thumbColor?: string;
1032
1347
  trackColor?: string;
1033
1348
  size?: string;
@@ -1040,11 +1355,9 @@ export declare interface GridThemeShadows {
1040
1355
  xl?: string;
1041
1356
  }
1042
1357
 
1043
- declare interface GridThemeSkeleton {
1358
+ export declare interface GridThemeSkeleton {
1044
1359
  baseColor?: string;
1045
1360
  highlightColor?: string;
1046
- darkBaseColor?: string;
1047
- darkHighlightColor?: string;
1048
1361
  }
1049
1362
 
1050
1363
  export declare interface GridThemeSpacing {
@@ -1056,7 +1369,7 @@ export declare interface GridThemeSpacing {
1056
1369
  xxl?: string;
1057
1370
  }
1058
1371
 
1059
- declare interface GridThemeToolbar {
1372
+ export declare interface GridThemeToolbar {
1060
1373
  background?: string;
1061
1374
  text?: string;
1062
1375
  border?: string;
@@ -1152,11 +1465,20 @@ export declare interface GridToolbarProps {
1152
1465
  showNonHideableColumns?: boolean;
1153
1466
  }
1154
1467
 
1468
+ /**
1469
+ * Props the grid passes to `slots.toolbar`, before `slotProps.toolbar` is merged over them: the
1470
+ * `GridToolbarProps` it controls (columns, models and their change handlers) plus `apiRef`.
1471
+ * @since v3.0
1472
+ */
1473
+ export declare interface GridToolbarSlotProps extends GridToolbarProps {
1474
+ apiRef: React.MutableRefObject<GridApi>;
1475
+ }
1476
+
1155
1477
  export declare function GridTooltip({ title, children, placement, enterDelay, leaveDelay }: GridTooltipProps): JSX.Element;
1156
1478
 
1157
- declare interface GridTooltipProps {
1158
- title: React.ReactNode;
1159
- children: React.ReactElement;
1479
+ export declare interface GridTooltipProps {
1480
+ title: default_2.ReactNode;
1481
+ children: default_2.ReactElement;
1160
1482
  placement?: 'top' | 'bottom' | 'left' | 'right';
1161
1483
  enterDelay?: number;
1162
1484
  leaveDelay?: number;
@@ -1186,14 +1508,23 @@ export declare interface GridTreeNode {
1186
1508
  children?: GridRowId[];
1187
1509
  /** Display label for the group. */
1188
1510
  label?: string;
1189
- /** Total count of all descendants (recursive). */
1511
+ /** Row grouping: the number of leaf rows in the group that pass the active filter (recursive). */
1190
1512
  descendantCount?: number;
1191
1513
  /** Count of children on the server (for lazy loading). */
1192
1514
  serverChildrenCount?: number;
1193
1515
  }
1194
1516
 
1517
+ /**
1518
+ * The constraint on the row type `R` of the generic grid types (`DataGridProps<R>`, `GridColDef<R>`,
1519
+ * `GridRenderCellParams<R>` …): any object type. Your own interfaces and type aliases can be used as `R`
1520
+ * directly; they do not need an index signature or to extend `GridRowModel`. Rows without an `id`
1521
+ * field need `getRowId`. `GridRowModel` stays the default `R` (rows with any keys, read as `unknown`).
1522
+ * @since v3.0
1523
+ */
1524
+ export declare type GridValidRowModel = object;
1525
+
1195
1526
  /** Parameters passed to the `valueFormatter` function. */
1196
- export declare interface GridValueFormatterParams<R extends GridRowModel = GridRowModel> {
1527
+ export declare interface GridValueFormatterParams<R extends GridValidRowModel = GridRowModel> {
1197
1528
  /** The raw value to format. */
1198
1529
  value: unknown;
1199
1530
  /** The row object. */
@@ -1203,7 +1534,7 @@ export declare interface GridValueFormatterParams<R extends GridRowModel = GridR
1203
1534
  }
1204
1535
 
1205
1536
  /** Parameters passed to the `valueGetter` function. */
1206
- export declare interface GridValueGetterParams<R extends GridRowModel = GridRowModel> {
1537
+ export declare interface GridValueGetterParams<R extends GridValidRowModel = GridRowModel> {
1207
1538
  /** The row object. */
1208
1539
  row: R;
1209
1540
  /** The field name. */
@@ -1212,10 +1543,27 @@ export declare interface GridValueGetterParams<R extends GridRowModel = GridRowM
1212
1543
  value: unknown;
1213
1544
  }
1214
1545
 
1546
+ /**
1547
+ * Parameters passed to the `valueSetter` function.
1548
+ * @since v3.0
1549
+ */
1550
+ export declare interface GridValueSetterParams<R extends GridValidRowModel = GridRowModel> {
1551
+ /** The committed value from the editor. */
1552
+ value: unknown;
1553
+ /** The row as it was before the edit. */
1554
+ row: R;
1555
+ /** The field name. */
1556
+ field: string;
1557
+ }
1558
+
1215
1559
  export declare function Header<R extends GridRowModel = GridRowModel>(props: HeaderProps<R>): JSX.Element;
1216
1560
 
1217
- declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1561
+ export declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1218
1562
  columns: GridColDef<R>[];
1563
+ /**
1564
+ * Every rendered data column in render order (left-pinned, unpinned, right-pinned) with its
1565
+ * resolved width. Column group header rows are laid out over these; defaults to `columns`.
1566
+ */
1219
1567
  allColumns?: GridColDef<R>[];
1220
1568
  columnGroupingModel?: GridColumnGroupingModel;
1221
1569
  checkboxSelection?: boolean;
@@ -1241,8 +1589,9 @@ declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1241
1589
  onDragOver?: (field: string) => (event: default_2.DragEvent) => void;
1242
1590
  onDragEnd?: () => void;
1243
1591
  onDrop?: (targetField: string) => (event: default_2.DragEvent) => void;
1592
+ /** The grid's focus position; `id: null` means a header cell is focused. */
1244
1593
  focusedCell?: {
1245
- id: string | number;
1594
+ id: string | number | null;
1246
1595
  field: string;
1247
1596
  } | null;
1248
1597
  onHeaderClick?: (field: string) => void;
@@ -1251,32 +1600,57 @@ declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1251
1600
  onHideColumn?: (field: string) => void;
1252
1601
  onPinColumn?: (field: string, side: 'left' | 'right' | null) => void;
1253
1602
  onManageColumns?: () => void;
1603
+ /** Position of each visible data column in render order, for `colIndex` and `aria-colindex`. */
1604
+ columnIndexMap?: Map<string, number>;
1254
1605
  }
1255
1606
 
1256
1607
  export declare const Input: default_2.FC<InputProps>;
1257
1608
 
1258
- declare interface InputProps extends default_2.InputHTMLAttributes<HTMLInputElement> {
1609
+ export declare interface InputProps extends default_2.InputHTMLAttributes<HTMLInputElement> {
1259
1610
  fullWidth?: boolean;
1260
1611
  error?: boolean;
1261
1612
  startAdornment?: default_2.ReactNode;
1262
1613
  endAdornment?: default_2.ReactNode;
1263
1614
  }
1264
1615
 
1265
- export declare interface JsonExportOptions {
1616
+ export declare interface JsonExportOptions<R extends GridValidRowModel = GridRowModel> {
1266
1617
  fileName?: string;
1267
1618
  pretty?: boolean;
1619
+ /**
1620
+ * Export only these row IDs. A non-empty selection takes precedence over `groupedRows` (the
1621
+ * selected rows are exported flat), and the aggregation values are recomputed over them.
1622
+ */
1268
1623
  selectedRows?: (string | number)[];
1624
+ /**
1625
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
1626
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
1627
+ */
1628
+ getRowId?: (row: R) => GridRowId;
1269
1629
  aggregationResult?: Record<string, unknown> | null;
1270
1630
  aggregationModel?: GridAggregationModel | null;
1271
1631
  /** When provided, emits a nested grouping tree instead of a flat array. */
1272
1632
  groupedRows?: GridGroupedExportRow[];
1273
1633
  }
1274
1634
 
1635
+ export declare function Pagination(props: PaginationProps): JSX.Element;
1636
+
1637
+ export declare interface PaginationProps {
1638
+ page: number;
1639
+ pageSize: number;
1640
+ rowCount: number;
1641
+ onPageChange: (page: number) => void;
1642
+ onPageSizeChange: (pageSize: number) => void;
1643
+ pageSizeOptions?: number[];
1644
+ showFirstButton?: boolean;
1645
+ showLastButton?: boolean;
1646
+ localeText?: Pick<GridLocaleText, 'paginationRowsPerPage' | 'paginationOf' | 'paginationPage'>;
1647
+ }
1648
+
1275
1649
  /**
1276
1650
  * Configuration options for exporting the DataGrid to PDF format.
1277
1651
  * Requires jspdf and jspdf-autotable peer dependencies.
1278
1652
  */
1279
- export declare interface PdfExportOptions {
1653
+ export declare interface PdfExportOptions<R extends GridValidRowModel = GridRowModel> {
1280
1654
  /**
1281
1655
  * Output filename without extension. Default: 'export'
1282
1656
  */
@@ -1296,9 +1670,16 @@ export declare interface PdfExportOptions {
1296
1670
  */
1297
1671
  orientation?: 'portrait' | 'landscape';
1298
1672
  /**
1299
- * If provided, only rows whose id is in this array are exported.
1673
+ * If provided, only rows whose id is in this array are exported. A non-empty selection takes
1674
+ * precedence over `groupedRows` (the selected rows are exported flat), and the footer totals
1675
+ * are recomputed over the selected rows.
1300
1676
  */
1301
1677
  selectedRows?: (string | number)[];
1678
+ /**
1679
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
1680
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
1681
+ */
1682
+ getRowId?: (row: R) => GridRowId;
1302
1683
  /**
1303
1684
  * Aggregation result from apiRef.current.getAggregationResult().
1304
1685
  * When provided alongside aggregationModel, appends a footer row.
@@ -1328,23 +1709,63 @@ export declare interface PdfExportOptions {
1328
1709
  * Base font size in points for table body. Default: 9
1329
1710
  */
1330
1711
  fontSize?: number;
1712
+ /**
1713
+ * A TrueType font for the whole document. The built-in Helvetica font only covers Latin-1 and
1714
+ * WinAnsi punctuation (é, ü, €, “ ”, •). Without this option other characters (₹, Greek,
1715
+ * Cyrillic, CJK, Devanagari, U+202F used by some locales as a thousands separator) are
1716
+ * replaced with `?` (spaces and minus signs with their ASCII forms) and a warning is logged.
1717
+ * `data` is the `.ttf` file as a base64 string; `boldData` is an optional bold face for the
1718
+ * title, header and totals (the regular face is used when omitted). jsPDF does not shape
1719
+ * complex scripts, so Devanagari or Arabic ligatures may not join.
1720
+ * @since v3.0
1721
+ */
1722
+ font?: {
1723
+ /** Font family name, e.g. 'NotoSans'. */
1724
+ name: string;
1725
+ /** Base64-encoded .ttf file. */
1726
+ data: string;
1727
+ /** Base64-encoded bold .ttf file. Default: `data`. */
1728
+ boldData?: string;
1729
+ };
1331
1730
  /**
1332
1731
  * Pre-built grouped export rows from `apiRef.current.getGroupedExportRows()`.
1333
1732
  * When provided, the PDF table reflects the grouping structure (group headers,
1334
1733
  * leaf rows, per-group subtotals, grand total) instead of a flat row list.
1335
- * Has no effect when the grid has no active `rowGroupingModel`.
1734
+ * Has no effect when the grid has no active `rowGroupingModel`, or when `selectedRows` is non-empty.
1336
1735
  */
1337
1736
  groupedRows?: GridGroupedExportRow[];
1338
1737
  }
1339
1738
 
1739
+ declare interface PivotResult {
1740
+ /** Pivot data rows followed by the Grand Total row (omitted when there are no data rows). */
1741
+ pivotRows: GridRowModel[];
1742
+ /** Row-label columns (one per row field) followed by one value column per column key and value field. */
1743
+ pivotColumns: GridColDef[];
1744
+ /** The distinct column-field value combinations, in display order. */
1745
+ colKeys: string[];
1746
+ /** `false` when the model has no usable row field or value field. */
1747
+ isValid: boolean;
1748
+ }
1749
+
1340
1750
  /**
1341
1751
  * Open print dialog with formatted table
1342
1752
  */
1343
- export declare function printGrid<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], titleOrOptions?: string | PrintOptions): Promise<void>;
1753
+ export declare function printGrid<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], titleOrOptions?: string | PrintOptions<R>): Promise<void>;
1754
+
1755
+ export declare function printGrid<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], titleOrOptions?: string | PrintOptions<R>): Promise<void>;
1344
1756
 
1345
- export declare interface PrintOptions {
1757
+ export declare interface PrintOptions<R extends GridValidRowModel = GridRowModel> {
1346
1758
  title?: string;
1759
+ /**
1760
+ * Print only these row IDs. A non-empty selection takes precedence over `groupedRows` (the
1761
+ * selected rows are printed flat), and the totals are recomputed over the selected rows.
1762
+ */
1347
1763
  selectedRows?: (string | number)[];
1764
+ /**
1765
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
1766
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
1767
+ */
1768
+ getRowId?: (row: R) => GridRowId;
1348
1769
  aggregationResult?: Record<string, unknown> | null;
1349
1770
  aggregationModel?: GridAggregationModel | null;
1350
1771
  /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
@@ -1355,8 +1776,10 @@ export declare const roseTheme: GridTheme;
1355
1776
 
1356
1777
  export declare function Row<R extends GridRowModel = GridRowModel>(props: RowProps<R>): JSX.Element;
1357
1778
 
1358
- declare interface RowProps<R extends GridRowModel = GridRowModel> {
1779
+ export declare interface RowProps<R extends GridRowModel = GridRowModel> {
1359
1780
  row: R;
1781
+ /** The row's id (from getRowId). Defaults to `row.id`; the grid always passes it. */
1782
+ rowId?: GridRowId;
1360
1783
  columns: GridColDef<R>[];
1361
1784
  rowIndex: number;
1362
1785
  isSelected?: boolean;
@@ -1373,6 +1796,8 @@ declare interface RowProps<R extends GridRowModel = GridRowModel> {
1373
1796
  onDetailPanelToggle?: (rowId: GridRowId) => void;
1374
1797
  detailPanelContent?: default_2.ReactNode;
1375
1798
  detailPanelHeight?: GridDetailPanelHeight;
1799
+ /** Called with the rendered height of an `'auto'` detail panel whenever it changes. */
1800
+ onDetailPanelHeightChange?: (rowId: GridRowId, height: number) => void;
1376
1801
  pinCheckboxColumn?: boolean;
1377
1802
  pinExpandColumn?: boolean;
1378
1803
  rowReordering?: boolean;
@@ -1392,31 +1817,43 @@ declare interface RowProps<R extends GridRowModel = GridRowModel> {
1392
1817
  field: string;
1393
1818
  value: unknown;
1394
1819
  }) => void;
1820
+ /** `id` / `field` name the cell whose editor asked to stop. */
1395
1821
  onEditStop?: (params?: {
1396
1822
  cancel?: boolean;
1823
+ id?: GridRowId;
1824
+ field?: string;
1397
1825
  }) => void;
1398
1826
  onEditCellValueChange?: (params: {
1399
1827
  id: GridRowId;
1400
1828
  field: string;
1401
1829
  value: unknown;
1402
1830
  }) => void;
1831
+ /** Per-cell editability predicate (`DataGrid.isCellEditable`). */
1832
+ isCellEditable?: (params: GridCellParams<R>) => boolean;
1403
1833
  focusedCellField?: string | null;
1404
1834
  isFocusVisible?: boolean;
1405
1835
  colspanMap?: Map<GridRowId, Record<string, CellColSpanInfo>>;
1406
1836
  rowSpanningCaches?: RowSpanningCaches;
1407
1837
  rowHeight?: number;
1408
1838
  rowMeta?: GridRowMeta;
1839
+ /** Position of each visible data column in render order, for `colIndex` and `aria-colindex`. */
1840
+ columnIndexMap?: Map<string, number>;
1841
+ /** 1-based `aria-rowindex` of this row in the whole grid (header rows included). Defaults to `rowIndex + 2`. */
1842
+ ariaRowIndex?: number;
1409
1843
  }
1410
1844
 
1411
1845
  declare interface RowSpanningCaches {
1846
+ /** Row id → field → number of rows the origin cell spans (only entries > 1). */
1412
1847
  spannedCells: Record<GridRowId, Record<ColumnKey, number>>;
1848
+ /** Row id → field → `true` for cells covered by a row span that starts in a row above. */
1413
1849
  hiddenCells: Record<GridRowId, Record<ColumnKey, boolean>>;
1414
- hiddenCellOriginMap: Record<number, Record<ColumnKey, number>>;
1850
+ /** Row id → field → id of the row whose span covers the hidden cell. */
1851
+ hiddenCellOriginMap: Record<GridRowId, Record<ColumnKey, GridRowId>>;
1415
1852
  }
1416
1853
 
1417
1854
  export declare function Skeleton({ rows, columns }: SkeletonProps): JSX.Element;
1418
1855
 
1419
- declare interface SkeletonProps {
1856
+ export declare interface SkeletonProps {
1420
1857
  rows?: number;
1421
1858
  columns?: number;
1422
1859
  }
@@ -1439,11 +1876,15 @@ export declare interface ToolbarQuickFilterRenderProps {
1439
1876
  onChange: (value: string) => void;
1440
1877
  }
1441
1878
 
1442
- export declare function useAggregation<R extends GridRowModel>(params: UseAggregationParams<R>): UseAggregationReturn;
1879
+ export declare function useAggregation<R extends GridValidRowModel = GridRowModel>(params: UseAggregationParams<R>): UseAggregationReturn;
1443
1880
 
1444
- export declare interface UseAggregationParams<R extends GridRowModel> {
1445
- rows: R[];
1881
+ export declare function useAggregation<R extends GridValidRowModel = GridRowModel>(params: Omit<UseAggregationParams<R>, 'columns'> & {
1446
1882
  columns?: GridColDef[];
1883
+ }): UseAggregationReturn;
1884
+
1885
+ export declare interface UseAggregationParams<R extends GridValidRowModel = GridRowModel> {
1886
+ rows: R[];
1887
+ columns?: GridColDef<R>[];
1447
1888
  aggregationModel: GridAggregationModel;
1448
1889
  isServerSide: boolean;
1449
1890
  dataSource?: GridDataSource<R>;
@@ -1461,12 +1902,28 @@ export declare interface UseAggregationReturn {
1461
1902
  /**
1462
1903
  * Hook to create a ref for the DataGrid API.
1463
1904
  * This ref can be passed to the `apiRef` prop of the `DataGrid` component.
1905
+ *
1906
+ * `apiRef.current` is never null: until the grid mounts it holds an API whose methods are
1907
+ * no-ops (getters return empty values), and the grid swaps in the live API in a layout
1908
+ * effect, so it is available to the parent's layout effects and effects.
1909
+ *
1910
+ * The return type is spelled out so the published declaration is `MutableRefObject<GridApi>`,
1911
+ * which matches `DataGridProps.apiRef` under both @types/react 18 and 19. Left to inference,
1912
+ * React 19's types emit `RefObject<GridApi>`, which React 18's types treat as read-only and
1913
+ * nullable, so `apiRef={useGridApiRef()}` failed to type-check on React 18.
1914
+ *
1915
+ * Pass your row type to have the row getters typed: `useGridApiRef<Invoice>().current.getRow(id)`
1916
+ * returns `Invoice | null`.
1464
1917
  */
1465
- export declare function useGridApiRef(): RefObject<GridApi>;
1918
+ export declare function useGridApiRef<R extends GridValidRowModel = GridRowModel>(): MutableRefObject<GridApi<R>>;
1466
1919
 
1467
1920
  export declare function useGridStateStorage(options: UseGridStateStorageOptions | string): UseGridStateStorageReturn;
1468
1921
 
1469
1922
  export declare interface UseGridStateStorageOptions {
1923
+ /**
1924
+ * Storage key. The grid reads `initialState` only when it mounts, so when the key can
1925
+ * change (per user, per view) remount the grid with it: `<DataGrid key={key} … />`.
1926
+ */
1470
1927
  key: string;
1471
1928
  debounceMs?: number;
1472
1929
  include?: (keyof GridState)[];
@@ -1483,13 +1940,15 @@ export declare interface UseGridStateStorageReturn {
1483
1940
  clearState: () => void;
1484
1941
  }
1485
1942
 
1486
- export declare function usePivot(rawRows: GridRowModel[], rawCols: GridColDef[], model: GridPivotModel, enabled: boolean): UsePivotReturn;
1943
+ /**
1944
+ * Headless pivot: turns flat rows into pivot rows (one per row-field combination, then a Grand Total
1945
+ * row) and generated columns (row-label columns, then one value column per column key and value field).
1946
+ * `DataGrid`'s `pivotMode` uses the same engine.
1947
+ */
1948
+ export declare function usePivot<R extends GridValidRowModel = GridRowModel>(rawRows: R[], rawCols: GridColDef<R>[], model: GridPivotModel, enabled: boolean): UsePivotReturn;
1487
1949
 
1488
- export declare interface UsePivotReturn {
1489
- pivotRows: GridRowModel[];
1490
- pivotColumns: GridColDef[];
1491
- colKeys: string[];
1492
- isValid: boolean;
1493
- }
1950
+ export declare function usePivot<R extends GridValidRowModel = GridRowModel>(rawRows: R[], rawCols: GridColDef[], model: GridPivotModel, enabled: boolean): UsePivotReturn;
1951
+
1952
+ export declare type UsePivotReturn = PivotResult;
1494
1953
 
1495
1954
  export { }