@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
@@ -1,4 +1,5 @@
1
-
1
+ import type { GridToolbarProps } from '../components/Toolbar/GridToolbar';
2
+ import type { PaginationProps } from '../components/Pagination/Pagination';
2
3
 
3
4
  /** Unique identifier for a row (string or number). */
4
5
  export type GridRowId = string | number;
@@ -16,24 +17,55 @@ export interface GridRowModel {
16
17
  }
17
18
 
18
19
  /**
19
- * Internal hierarchy metadata for a row. Exposed via `params.rowMeta` in `renderCell`.
20
+ * The constraint on the row type `R` of the generic grid types (`DataGridProps<R>`, `GridColDef<R>`,
21
+ * `GridRenderCellParams<R>` …): any object type. Your own interfaces and type aliases can be used as `R`
22
+ * directly; they do not need an index signature or to extend `GridRowModel`. Rows without an `id`
23
+ * field need `getRowId`. `GridRowModel` stays the default `R` (rows with any keys, read as `unknown`).
24
+ * @since v3.0
25
+ */
26
+ export type GridValidRowModel = object;
27
+
28
+ /**
29
+ * A callback that is checked bivariantly in its parameter, like a method. Used for `GridColDef`
30
+ * options that are either a value or a function, so a column typed for your rows (`GridColDef<Row>`)
31
+ * can still be used where an untyped `GridColDef` is expected.
32
+ */
33
+ type GridColDefCallback<P, T> = { bivarianceHack(params: P): T }['bivarianceHack'];
34
+
35
+ /**
36
+ * Hierarchy metadata for a row. Exposed via `params.rowMeta` in `renderCell`.
20
37
  * Not present (`undefined`) for flat rows with no active tree-data or row-grouping.
21
38
  *
22
39
  * @since v1.1 — replaces the `_hasChildren` / `_treeDepth` / `_groupingField` etc.
23
- * properties that were previously (and incorrectly) typed on `GridRowModel`.
24
- * Those underscore fields remain on the row object at runtime for backward
25
- * compatibility; removal was deferred past v2.0 (still present as of v2.1.0)
26
- * to a future major version. Do not rely on them being absent yet.
40
+ * fields that were injected onto row objects. Since v3.0 those fields are no longer
41
+ * added at runtime: row objects reach `renderCell` exactly as you passed them.
27
42
  */
28
43
  export interface GridRowMeta {
44
+ /** The row has children to show: the expand toggle is rendered for it. */
29
45
  hasChildren?: boolean;
30
46
  treeDepth?: number;
31
47
  groupingField?: string;
32
48
  groupingValue?: unknown;
49
+ /** The label the grid shows for a synthetic row: the group label, or the path segment of an auto-created tree parent. */
33
50
  groupLabel?: string;
51
+ /**
52
+ * Data rows below this row at any depth that pass the active filter (row-grouping leaves, or
53
+ * tree-data rows; auto-created tree parents are not counted). The "(n)" shown next to group labels.
54
+ */
34
55
  descendantCount?: number;
35
56
  isExpanded?: boolean;
57
+ /**
58
+ * The row is synthetic: a row-grouping group row, a group subtotal row, or a tree-data parent the
59
+ * grid created for a path segment with no row of its own. Synthetic rows are never selected,
60
+ * edited or given a detail panel, and `valueGetter` is not called for them.
61
+ */
36
62
  isGroupRow?: boolean;
63
+ /**
64
+ * The row is the subtotal row of the group described by `groupingField` / `groupingValue`, shown
65
+ * after the group's children when `getAggregationPosition` returns `'footer'` for it.
66
+ * @since v3.0
67
+ */
68
+ isGroupFooter?: boolean;
37
69
  }
38
70
 
39
71
  export type GridAlignment = 'left' | 'center' | 'right';
@@ -65,7 +97,7 @@ export interface GridTreeNode {
65
97
  /** Display label for the group. */
66
98
  label?: string;
67
99
 
68
- /** Total count of all descendants (recursive). */
100
+ /** Row grouping: the number of leaf rows in the group that pass the active filter (recursive). */
69
101
  descendantCount?: number;
70
102
 
71
103
  /** Count of children on the server (for lazy loading). */
@@ -78,7 +110,7 @@ export type GridSortDirection = 'asc' | 'desc' | null;
78
110
  * Metadata for a single column.
79
111
  * Governs rendering, sorting, filtering, and data transformation.
80
112
  */
81
- export interface GridColDef<R extends GridRowModel = GridRowModel> {
113
+ export interface GridColDef<R extends GridValidRowModel = GridRowModel> {
82
114
  /** The unique identifier for the column, typically matching a row object key. */
83
115
  field: string;
84
116
  /** Text displayed in the column header. */
@@ -129,16 +161,25 @@ export interface GridColDef<R extends GridRowModel = GridRowModel> {
129
161
  /** Options used for 'singleSelect' type. */
130
162
  valueOptions?: Array<string | number | { value: unknown; label: string }>;
131
163
 
164
+ // The row callbacks below are declared as methods so that `GridColDef<Row>` stays assignable to an
165
+ // untyped `GridColDef` (method parameters are checked bivariantly).
132
166
  /** Function to compute a cell value from raw row data. */
133
- valueGetter?: (params: GridValueGetterParams<R>) => unknown;
167
+ valueGetter?(params: GridValueGetterParams<R>): unknown;
168
+ /**
169
+ * Maps an edited value back onto the row when an edit is committed; return the updated row.
170
+ * Needed for editable columns with a `valueGetter`, whose value is not stored in `row[field]`.
171
+ * Without it the commit writes `row[field] = value`.
172
+ * @since v3.0
173
+ */
174
+ valueSetter?(params: GridValueSetterParams<R>): R;
134
175
  /** Function to format a value into a human-readable string. */
135
- valueFormatter?: (params: GridValueFormatterParams<R>) => string;
176
+ valueFormatter?(params: GridValueFormatterParams<R>): string;
136
177
  /** Custom component or element to render in the cell. */
137
- renderCell?: (params: GridRenderCellParams<R>) => React.ReactNode;
178
+ renderCell?(params: GridRenderCellParams<R>): React.ReactNode;
138
179
  /** Custom component or element to render in the header. */
139
- renderHeader?: (params: GridRenderHeaderParams) => React.ReactNode;
140
- /** Component to render when the cell is in edit mode. */
141
- renderEditCell?: (params: GridRenderCellParams<R>) => React.ReactNode;
180
+ renderHeader?(params: GridRenderHeaderParams): React.ReactNode;
181
+ /** Component to render when the cell is in edit mode. Receives `onValueChange`, `onCommit` and `onCancel`. */
182
+ renderEditCell?(params: GridRenderEditCellParams<R>): React.ReactNode;
142
183
  /** If true, the cell's value can be modified by the user. */
143
184
  editable?: boolean;
144
185
  /** Optional stacking order (CSS z-index). */
@@ -146,10 +187,19 @@ export interface GridColDef<R extends GridRowModel = GridRowModel> {
146
187
  /** If true, the column kebab/hamburger menu is disabled. */
147
188
  disableColumnMenu?: boolean;
148
189
 
149
- /** Number of columns this cell should occupy horizontally. */
150
- colSpan?: number | ((params: GridRenderCellParams<R>) => number);
151
- /** Number of rows this cell should occupy vertically. */
152
- rowSpan?: number | ((params: GridRenderCellParams<R>) => number);
190
+ /**
191
+ * Number of columns this cell should occupy horizontally: the origin plus the next visible columns
192
+ * in render order, clamped to the end of the origin's pinned section. Fractions are floored,
193
+ * `Infinity` means "to the end", and NaN / values below 1 mean no span. `params.value` is the
194
+ * `valueGetter` result. A function that throws is treated as 1.
195
+ */
196
+ colSpan?: number | GridColDefCallback<GridRenderCellParams<R>, number>;
197
+ /**
198
+ * Number of rows this cell should occupy vertically, clamped to the end of its row section
199
+ * (top-pinned, scrolling or bottom-pinned rows) and to the first row with an expanded detail
200
+ * panel. Normalised like `colSpan`. With both set, the origin covers the whole rectangle.
201
+ */
202
+ rowSpan?: number | GridColDefCallback<GridRenderCellParams<R>, number>;
153
203
 
154
204
  /**
155
205
  * Custom CSS class applied to every cell in this column.
@@ -159,7 +209,7 @@ export interface GridColDef<R extends GridRowModel = GridRowModel> {
159
209
  * cellClassName: 'my-class'
160
210
  * cellClassName: ({ value }) => value > 100 ? 'cell--high' : 'cell--low'
161
211
  */
162
- cellClassName?: string | ((params: GridRenderCellParams<R>) => string);
212
+ cellClassName?: string | GridColDefCallback<GridRenderCellParams<R>, string>;
163
213
 
164
214
  /**
165
215
  * Custom CSS class applied to the header cell of this column.
@@ -177,9 +227,9 @@ export interface GridColDef<R extends GridRowModel = GridRowModel> {
177
227
  }
178
228
 
179
229
  /** Column definition used exclusively in List View mode. */
180
- export interface GridListViewColDef<R extends GridRowModel = GridRowModel> {
230
+ export interface GridListViewColDef<R extends GridValidRowModel = GridRowModel> {
181
231
  field: string;
182
- renderCell: (params: GridRenderCellParams<R>) => React.ReactNode;
232
+ renderCell(params: GridRenderCellParams<R>): React.ReactNode;
183
233
  }
184
234
 
185
235
  /**
@@ -200,7 +250,7 @@ export interface GridColumnGroup {
200
250
  groupId: string;
201
251
  /** Text displayed in the group header cell. */
202
252
  headerName: string;
203
- /** Optional override for the header cell background color. */
253
+ /** CSS class(es) added to this group's header cell(s). */
204
254
  headerClassName?: string;
205
255
  /**
206
256
  * Either an array of column field strings (leaf group)
@@ -213,7 +263,7 @@ export type GridColumnGroupingModel = GridColumnGroup[];
213
263
 
214
264
 
215
265
  /** Parameters passed to the `valueGetter` function. */
216
- export interface GridValueGetterParams<R extends GridRowModel = GridRowModel> {
266
+ export interface GridValueGetterParams<R extends GridValidRowModel = GridRowModel> {
217
267
  /** The row object. */
218
268
  row: R;
219
269
  /** The field name. */
@@ -222,8 +272,21 @@ export interface GridValueGetterParams<R extends GridRowModel = GridRowModel> {
222
272
  value: unknown;
223
273
  }
224
274
 
275
+ /**
276
+ * Parameters passed to the `valueSetter` function.
277
+ * @since v3.0
278
+ */
279
+ export interface GridValueSetterParams<R extends GridValidRowModel = GridRowModel> {
280
+ /** The committed value from the editor. */
281
+ value: unknown;
282
+ /** The row as it was before the edit. */
283
+ row: R;
284
+ /** The field name. */
285
+ field: string;
286
+ }
287
+
225
288
  /** Parameters passed to the `valueFormatter` function. */
226
- export interface GridValueFormatterParams<R extends GridRowModel = GridRowModel> {
289
+ export interface GridValueFormatterParams<R extends GridValidRowModel = GridRowModel> {
227
290
  /** The raw value to format. */
228
291
  value: unknown;
229
292
  /** The row object. */
@@ -233,7 +296,7 @@ export interface GridValueFormatterParams<R extends GridRowModel = GridRowModel>
233
296
  }
234
297
 
235
298
  /** Parameters passed to the `renderCell` function. */
236
- export interface GridRenderCellParams<R extends GridRowModel = GridRowModel> {
299
+ export interface GridRenderCellParams<R extends GridValidRowModel = GridRowModel> {
237
300
  /** The current cell value. */
238
301
  value: unknown;
239
302
  /**
@@ -258,6 +321,19 @@ export interface GridRenderCellParams<R extends GridRowModel = GridRowModel> {
258
321
  rowMeta?: GridRowMeta;
259
322
  }
260
323
 
324
+ /**
325
+ * Parameters passed to `renderEditCell`. `value` is the pending (uncommitted) value.
326
+ * @since v3.0
327
+ */
328
+ export interface GridRenderEditCellParams<R extends GridValidRowModel = GridRowModel> extends GridRenderCellParams<R> {
329
+ /** Updates the pending value. Call it on every change; nothing is saved until `onCommit`. */
330
+ onValueChange: (value: unknown) => void;
331
+ /** Commits the pending value (runs `processRowUpdate`) and leaves edit mode. */
332
+ onCommit: () => void;
333
+ /** Discards the pending value and leaves edit mode. */
334
+ onCancel: () => void;
335
+ }
336
+
261
337
  export interface GridRenderHeaderParams {
262
338
  field: string;
263
339
  colDef: GridColDef;
@@ -282,13 +358,18 @@ export type GridFilterOperator =
282
358
  | 'isEmpty'
283
359
  | 'isNotEmpty'
284
360
  | 'isAnyOf'
361
+ | '='
285
362
  | '>'
286
363
  | '>='
287
364
  | '<'
288
365
  | '<='
289
366
  | '!='
290
367
  | 'is'
291
- | 'not';
368
+ | 'not'
369
+ | 'after'
370
+ | 'onOrAfter'
371
+ | 'before'
372
+ | 'onOrBefore';
292
373
 
293
374
  /** Describes a filter condition for a specific column. */
294
375
  export interface GridFilterItem {
@@ -326,7 +407,7 @@ export interface GridFilterModel {
326
407
  * Configuration options for exporting the DataGrid to PDF format.
327
408
  * Requires jspdf and jspdf-autotable peer dependencies.
328
409
  */
329
- export interface PdfExportOptions {
410
+ export interface PdfExportOptions<R extends GridValidRowModel = GridRowModel> {
330
411
  /**
331
412
  * Output filename without extension. Default: 'export'
332
413
  */
@@ -350,10 +431,18 @@ export interface PdfExportOptions {
350
431
  orientation?: 'portrait' | 'landscape';
351
432
 
352
433
  /**
353
- * If provided, only rows whose id is in this array are exported.
434
+ * If provided, only rows whose id is in this array are exported. A non-empty selection takes
435
+ * precedence over `groupedRows` (the selected rows are exported flat), and the footer totals
436
+ * are recomputed over the selected rows.
354
437
  */
355
438
  selectedRows?: (string | number)[];
356
439
 
440
+ /**
441
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
442
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
443
+ */
444
+ getRowId?: (row: R) => GridRowId;
445
+
357
446
  /**
358
447
  * Aggregation result from apiRef.current.getAggregationResult().
359
448
  * When provided alongside aggregationModel, appends a footer row.
@@ -390,11 +479,30 @@ export interface PdfExportOptions {
390
479
  */
391
480
  fontSize?: number;
392
481
 
482
+ /**
483
+ * A TrueType font for the whole document. The built-in Helvetica font only covers Latin-1 and
484
+ * WinAnsi punctuation (é, ü, €, “ ”, •). Without this option other characters (₹, Greek,
485
+ * Cyrillic, CJK, Devanagari, U+202F used by some locales as a thousands separator) are
486
+ * replaced with `?` (spaces and minus signs with their ASCII forms) and a warning is logged.
487
+ * `data` is the `.ttf` file as a base64 string; `boldData` is an optional bold face for the
488
+ * title, header and totals (the regular face is used when omitted). jsPDF does not shape
489
+ * complex scripts, so Devanagari or Arabic ligatures may not join.
490
+ * @since v3.0
491
+ */
492
+ font?: {
493
+ /** Font family name, e.g. 'NotoSans'. */
494
+ name: string;
495
+ /** Base64-encoded .ttf file. */
496
+ data: string;
497
+ /** Base64-encoded bold .ttf file. Default: `data`. */
498
+ boldData?: string;
499
+ };
500
+
393
501
  /**
394
502
  * Pre-built grouped export rows from `apiRef.current.getGroupedExportRows()`.
395
503
  * When provided, the PDF table reflects the grouping structure (group headers,
396
504
  * leaf rows, per-group subtotals, grand total) instead of a flat row list.
397
- * Has no effect when the grid has no active `rowGroupingModel`.
505
+ * Has no effect when the grid has no active `rowGroupingModel`, or when `selectedRows` is non-empty.
398
506
  */
399
507
  groupedRows?: GridGroupedExportRow[];
400
508
  }
@@ -412,6 +520,13 @@ export interface GridGroupedExportRow {
412
520
  groupField?: string;
413
521
  /** The raw grouping value for this level (absent on 'leaf' and 'grand-total'). */
414
522
  groupValue?: unknown;
523
+ /**
524
+ * The group label exactly as the grid shows it (from `groupingValueFormatter`, else `"field: value"`),
525
+ * on 'group-header' and 'group-subtotal' entries from `getGroupedExportRows()`. Exporters use it for
526
+ * group-header rows; when absent they apply the column's `groupingValueFormatter` themselves.
527
+ * @since v3.0
528
+ */
529
+ groupLabel?: string;
415
530
  /** Per-group aggregation results (present on 'group-subtotal' and 'grand-total'). */
416
531
  aggregatedValues?: Record<string, unknown>;
417
532
  /** The original data row (only present when `type === 'leaf'`). */
@@ -446,7 +561,7 @@ export interface GridColumnOrderChangeParams {
446
561
 
447
562
  export type GridColumnOrder = string[];
448
563
 
449
- export interface GridRowOrderChangeParams<R extends GridRowModel = GridRowModel> {
564
+ export interface GridRowOrderChangeParams<R extends GridValidRowModel = GridRowModel> {
450
565
  row: R;
451
566
  oldIndex: number;
452
567
  targetIndex: number;
@@ -461,7 +576,7 @@ export interface GridGetRowsParams {
461
576
  aggregationModel?: GridAggregationModel;
462
577
  }
463
578
 
464
- export interface GridGetRowsResponse<R extends GridRowModel = GridRowModel> {
579
+ export interface GridGetRowsResponse<R extends GridValidRowModel = GridRowModel> {
465
580
  rows: R[];
466
581
  rowCount?: number;
467
582
  aggregationResults?: Record<string, unknown>;
@@ -471,7 +586,7 @@ export interface GridGetRowsResponse<R extends GridRowModel = GridRowModel> {
471
586
  * Interface for providing data to the grid from a remote source.
472
587
  * Enables server-side sorting, filtering, and pagination.
473
588
  */
474
- export interface GridDataSource<R extends GridRowModel = GridRowModel> {
589
+ export interface GridDataSource<R extends GridValidRowModel = GridRowModel> {
475
590
  /**
476
591
  * Fetches a chunk of rows based on current grid state.
477
592
  * @param params Sorting, filtering, and range parameters.
@@ -495,26 +610,24 @@ export interface GridPinnedColumns {
495
610
  right?: string[];
496
611
  }
497
612
 
498
- export interface GridPinnedRows<R extends GridRowModel = GridRowModel> {
613
+ export interface GridPinnedRows<R extends GridValidRowModel = GridRowModel> {
499
614
  top?: R[];
500
615
  bottom?: R[];
501
616
  }
502
617
 
503
- export interface GridVirtualizationState {
504
- renderContext: GridRenderContext;
505
- }
506
-
507
618
  export type GridRowGroupingModel = string[];
508
619
 
509
- export type GridAggregationFunction = (values: unknown[]) => unknown;
510
-
511
620
  export interface GridAggregationModel {
512
621
  [field: string]: string;
513
622
  }
514
623
 
515
624
  export type GridAggregationResult = Record<string, unknown>;
516
625
 
517
- export type GridAggregationPosition = 'footer' | 'inline' | 'both';
626
+ /**
627
+ * Where a group's aggregates are shown, as returned by `getAggregationPosition`: `'inline'` on the group row,
628
+ * `'footer'` on a subtotal row after the group's children, `null` hidden.
629
+ */
630
+ export type GridAggregationPosition = 'inline' | 'footer' | null;
518
631
 
519
632
  export type GridPivotAggFn = 'sum' | 'avg' | 'count' | 'min' | 'max';
520
633
 
@@ -530,27 +643,16 @@ export interface GridPivotModel {
530
643
  valueFields: GridPivotValueField[];
531
644
  }
532
645
 
533
- export interface GridRenderContext {
534
- firstRowIndex: number;
535
- lastRowIndex: number;
536
- firstColumnIndex: number;
537
- lastColumnIndex: number;
538
- }
539
-
540
646
  export interface GridInternalState {
541
647
  rows: {
542
648
  idRowsLookup: Map<GridRowId, GridRowModel>;
543
649
  allRows: GridRowId[];
544
- };
545
- sorting: {
546
- sortModel: GridSortItem[];
547
- };
548
- filter: {
549
- filterModel: GridFilterModel;
650
+ /** Row object → its getRowId() key. Rows are stored untouched, so this is how ids are resolved. */
651
+ idByRow: Map<GridRowModel, GridRowId>;
550
652
  };
551
653
  pagination: {
552
- paginationModel: GridPaginationModel;
553
- rowCount: number;
654
+ /** Server-reported total (dataSource responses); undefined until one arrives. */
655
+ rowCount?: number;
554
656
  };
555
657
  columns: {
556
658
  all: GridColDef[];
@@ -558,14 +660,10 @@ export interface GridInternalState {
558
660
  orderedFields: string[];
559
661
  columnVisibilityModel: GridColumnVisibilityModel;
560
662
  };
561
- selection: {
562
- selectedRows: Set<GridRowId>;
563
- };
564
663
  pinning: {
565
664
  pinnedColumns: GridPinnedColumns;
566
665
  pinnedRows: GridPinnedRows;
567
666
  };
568
- virtualization: GridVirtualizationState;
569
667
  dimensions: {
570
668
  rowHeight: number;
571
669
  headerHeight: number;
@@ -599,7 +697,7 @@ export interface GridLocaleText {
599
697
  /**
600
698
  * Main properties for the DataGrid component.
601
699
  */
602
- export interface DataGridProps<R extends GridRowModel = GridRowModel> {
700
+ export interface DataGridProps<R extends GridValidRowModel = GridRowModel> {
603
701
  /** The dataset to display in the grid. */
604
702
  rows: R[];
605
703
  /** Column definitions governing how data is displayed and interacted with. */
@@ -683,8 +781,13 @@ export interface DataGridProps<R extends GridRowModel = GridRowModel> {
683
781
  disableRowSelectionOnClick?: boolean;
684
782
  /** If true, the user can only select a single row at a time. */
685
783
  disableMultipleRowSelection?: boolean;
784
+ /**
785
+ * If true, Ctrl/Cmd+C does not copy the selected rows, so the page (or your own handler) owns
786
+ * the shortcut. `apiRef.current.copySelectedRows()` still works. Default: false.
787
+ */
788
+ disableClipboardCopy?: boolean;
686
789
 
687
- /** If true, a loading shimmer/skeleton is displayed. */
790
+ /** 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. */
688
791
  loading?: boolean;
689
792
  /** Visual density of the grid. */
690
793
  density?: 'compact' | 'standard' | 'comfortable';
@@ -705,10 +808,17 @@ export interface DataGridProps<R extends GridRowModel = GridRowModel> {
705
808
 
706
809
  /** Advanced: The starting internal state of the grid. */
707
810
  initialState?: import('../state/types').GridInitialState;
708
- /** Advanced: Callback fired for every internal state update. */
811
+ /**
812
+ * Called on mount and whenever the value of the sorting, filter, pagination, columns (widths, order,
813
+ * visibility, pinning) or density state changes. Selection, expansion and editing do not call it.
814
+ */
709
815
  onStateChange?: (state: import('../state/types').GridState) => void;
710
816
 
711
- /** Callback fired when a row is clicked. */
817
+ /**
818
+ * Callback fired when a row is clicked. Tree-data parent rows are real rows: a click fires this and
819
+ * selects them like any row (the chevron expands them). Synthetic rows (row-grouping group rows,
820
+ * subtotal rows and auto-created tree parents) do not fire it: clicking a group row toggles it.
821
+ */
712
822
  onRowClick?: (params: GridRowParams<R>) => void;
713
823
  /**
714
824
  * Callback fired when a row is double-clicked. Also fires for group rows; check
@@ -720,9 +830,12 @@ export interface DataGridProps<R extends GridRowModel = GridRowModel> {
720
830
  /** Callback fired when a cell is clicked. */
721
831
  onCellClick?: (params: GridCellParams<R>) => void;
722
832
 
723
- /** Renders the detail panel content for a row in Master-Detail mode. */
833
+ /**
834
+ * Renders the detail panel content for a row in Master-Detail mode. Called for data rows only:
835
+ * synthetic group, subtotal and auto-created tree-parent rows have no detail panel.
836
+ */
724
837
  getDetailPanelContent?: (params: GridDetailPanelParams<R>) => React.ReactNode;
725
- /** Defines the height of the detail panel. */
838
+ /** Defines the height of the detail panel. Called for data rows only, like `getDetailPanelContent`. */
726
839
  getDetailPanelHeight?: (params: GridDetailPanelParams<R>) => GridDetailPanelHeight;
727
840
  /** Controlled state for expanded detail panels. */
728
841
  detailPanelExpandedRowIds?: Set<GridRowId>;
@@ -733,8 +846,17 @@ export interface DataGridProps<R extends GridRowModel = GridRowModel> {
733
846
  disableColumnReorder?: boolean;
734
847
  /** Controlled horizontal order of column fields. */
735
848
  columnOrder?: GridColumnOrder;
736
- /** Callback fired when column order changes. */
737
- onColumnOrderChange?: (params: GridColumnOrderChangeParams) => void;
849
+ /**
850
+ * Fired when the user moves one column (header drag or Columns panel). `oldIndex` / `targetIndex`
851
+ * are positions in the grid's full column order: every current column, in order.
852
+ */
853
+ onColumnOrderChange?: (params: GridColumnOrderChangeParams) => void;
854
+ /**
855
+ * Fired with the whole new column order after every change: a header drag, a Columns panel drag
856
+ * and the panel's Reset. The easiest way to keep a controlled `columnOrder` in sync.
857
+ * Not fired for the generated columns of pivot mode.
858
+ */
859
+ onColumnOrderModelChange?: (columnOrder: GridColumnOrder) => void;
738
860
 
739
861
  /** If true, rows can be reordered via drag-and-drop. */
740
862
  rowReordering?: boolean;
@@ -743,10 +865,17 @@ export interface DataGridProps<R extends GridRowModel = GridRowModel> {
743
865
 
744
866
  /** If true, enables hierarchical tree data display. */
745
867
  treeData?: boolean;
746
- /** Function to get the path (array of strings) for a row in Tree Data mode. */
868
+ /**
869
+ * Function to get the path (array of strings) for a row in Tree Data mode. Required with `treeData`:
870
+ * without it the rows are shown flat. Segments may contain any character, including '/'. Keep the
871
+ * function identity stable (module scope or useCallback); a new function rebuilds the tree.
872
+ */
747
873
  getTreeDataPath?: (row: R) => string[];
748
- /** Optional override for the grouping column. */
749
- groupingColDef?: GridColDef<R>;
874
+ /**
875
+ * Adds a dedicated grouping column (pinned left) under row grouping or tree data, configured by these
876
+ * fields. Every key is optional: `field` is always `'__group__'` (a `field` you pass is ignored).
877
+ */
878
+ groupingColDef?: Partial<GridColDef<R>>;
750
879
  /** Initial expansion depth for Tree Data. */
751
880
  defaultGroupingExpansionDepth?: number;
752
881
 
@@ -756,7 +885,12 @@ export interface DataGridProps<R extends GridRowModel = GridRowModel> {
756
885
  aggregationModel?: GridAggregationModel;
757
886
  /** Callback fired when aggregation model changes. */
758
887
  onAggregationModelChange?: (model: GridAggregationModel) => void;
759
- /** Advanced: Controls where aggregation results appear relative to groups. */
888
+ /**
889
+ * Advanced: where aggregation results appear. Called for every group node (with its current
890
+ * `isExpanded`) and once with `null` for the grand total. `'inline'` (default for groups) shows them
891
+ * on the group row; `'footer'` on a subtotal row after the group's children while it is expanded
892
+ * (inline while collapsed); `null` hides them. For the grand total, `null` hides the footer row.
893
+ */
760
894
  getAggregationPosition?: (groupNode: GridTreeNode | null) => 'inline' | 'footer' | null;
761
895
 
762
896
  /** If true, switches the grid to multidimensional Pivot Mode. */
@@ -778,29 +912,48 @@ export interface DataGridProps<R extends GridRowModel = GridRowModel> {
778
912
  /** Callback fired when scrolling reaches the bottom of the grid viewport. */
779
913
  onRowsScrollEnd?: (params: GridRowScrollEndParams) => void;
780
914
 
781
- /** Advanced: Reactive reference to the internal API for imperative control. */
782
- apiRef?: React.MutableRefObject<GridApi>;
915
+ /**
916
+ * Advanced: reactive reference to the internal API for imperative control. Pass
917
+ * `useGridApiRef<MyRow>()` to have the row getters typed as `MyRow`; a plain `useGridApiRef()` also works.
918
+ */
919
+ apiRef?: React.MutableRefObject<GridApi<R>> | React.MutableRefObject<GridApi>;
783
920
 
784
921
  /** Custom components to replace internal grid parts. */
785
922
  slots?: {
786
- /** Component rendered as the grid toolbar. */
787
- toolbar?: React.ComponentType<Record<string, unknown>>;
788
- /** Component rendered as the pagination control. */
789
- pagination?: React.ComponentType<Record<string, unknown>>;
790
- /** Component rendered when the grid is empty. */
791
- noRowsOverlay?: React.ComponentType<Record<string, unknown>>;
792
- /** Component rendered during loading states. */
793
- loadingOverlay?: React.ComponentType<Record<string, unknown>>;
794
- /** Component rendered at the very bottom of the grid. */
795
- footer?: React.ComponentType<Record<string, unknown>>;
923
+ /**
924
+ * Component rendered as the grid toolbar. Receives `GridToolbarSlotProps` (plus `slotProps.toolbar`),
925
+ * so it can be typed with `GridToolbarProps` or wrap the exported `GridToolbar`.
926
+ */
927
+ toolbar?: React.ComponentType<GridToolbarSlotProps & Record<string, unknown>>;
928
+ /**
929
+ * Component rendered as the pagination control. Receives `PaginationProps` (plus `slotProps.pagination`),
930
+ * so it can be typed with `PaginationProps` or wrap the exported `Pagination`.
931
+ */
932
+ pagination?: React.ComponentType<GridPaginationSlotProps & Record<string, unknown>>;
933
+ /** Component rendered when the grid is empty. Receives only `slotProps.noRowsOverlay`. */
934
+ noRowsOverlay?: React.ComponentType<GridOverlaySlotProps>;
935
+ /** Component rendered during loading states. Receives only `slotProps.loadingOverlay`. */
936
+ loadingOverlay?: React.ComponentType<GridOverlaySlotProps>;
937
+ /**
938
+ * Component rendered at the very bottom of the grid, in place of the pagination area.
939
+ * Receives `GridFooterSlotProps` (plus `slotProps.footer`).
940
+ */
941
+ footer?: React.ComponentType<GridFooterSlotProps & Record<string, unknown>>;
796
942
  };
797
943
  /** Properties passed directly to custom slots. */
798
944
  slotProps?: {
799
- toolbar?: Record<string, unknown>;
800
- pagination?: Record<string, unknown>;
801
- noRowsOverlay?: Record<string, unknown>;
802
- loadingOverlay?: Record<string, unknown>;
803
- footer?: Record<string, unknown>;
945
+ /**
946
+ * Merged over the props the grid passes to the toolbar. Typed as `GridToolbarProps` (so render props
947
+ * such as `renderQuickFilter` are checked and their parameters inferred), plus any extra keys a custom
948
+ * toolbar reads. `columns` / `baseColumns` are not checked, so typed `GridColDef<R>[]` can be passed.
949
+ */
950
+ toolbar?: Omit<Partial<GridToolbarProps>, 'columns' | 'baseColumns'> & Record<string, unknown>;
951
+ /** Merged over the `PaginationProps` the grid passes to the pagination slot. */
952
+ pagination?: Partial<GridPaginationSlotProps> & Record<string, unknown>;
953
+ noRowsOverlay?: GridOverlaySlotProps;
954
+ loadingOverlay?: GridOverlaySlotProps;
955
+ /** Merged over the `GridFooterSlotProps` the grid passes to the footer slot. */
956
+ footer?: Partial<GridFooterSlotProps> & Record<string, unknown>;
804
957
  };
805
958
 
806
959
  /** When true, renders the grid as a single-column list of cards. Perfect for mobile/responsive views. */
@@ -815,26 +968,73 @@ export interface DataGridProps<R extends GridRowModel = GridRowModel> {
815
968
  columnGroupingModel?: GridColumnGroupingModel;
816
969
  }
817
970
 
818
- export interface GridEditCellProps<V = unknown> {
819
- id: GridRowId;
820
- field: string;
821
- value?: V;
822
- formattedValue?: string;
971
+ /**
972
+ * `DataGridProps<R>` with untyped `columns` (`GridColDef[]`, i.e. `GridColDef<GridRowModel>[]`). `DataGrid`
973
+ * accepts these props as well as `DataGridProps<R>`, so columns written without a row type work with rows of
974
+ * any type `R`. Their callbacks then see `params.row` as `GridRowModel`; type the columns as
975
+ * `GridColDef<R>[]` to get your row type there.
976
+ * @since v3.0
977
+ */
978
+ export type DataGridUntypedColumnsProps<R extends GridValidRowModel = GridRowModel> =
979
+ Omit<DataGridProps<R>, 'columns'> & { columns: GridColDef[] };
980
+
981
+ /**
982
+ * Props the grid passes to `slots.toolbar`, before `slotProps.toolbar` is merged over them: the
983
+ * `GridToolbarProps` it controls (columns, models and their change handlers) plus `apiRef`.
984
+ * @since v3.0
985
+ */
986
+ export interface GridToolbarSlotProps extends GridToolbarProps {
987
+ apiRef: React.MutableRefObject<GridApi>;
823
988
  }
824
989
 
825
- export type GridRowModes = 'view' | 'edit';
990
+ /**
991
+ * Props the grid passes to `slots.pagination`, before `slotProps.pagination` is merged over them.
992
+ * @since v3.0
993
+ */
994
+ export type GridPaginationSlotProps = PaginationProps;
995
+
996
+ /**
997
+ * Props of `slots.noRowsOverlay` and `slots.loadingOverlay`: the grid passes none of its own, only
998
+ * `slotProps.noRowsOverlay` / `slotProps.loadingOverlay`.
999
+ * @since v3.0
1000
+ */
1001
+ export type GridOverlaySlotProps = Record<string, unknown>;
826
1002
 
827
- export interface GridRowModesModel {
828
- [id: GridRowId]: { mode: GridRowModes; fieldToFocus?: string };
1003
+ /**
1004
+ * Props the grid passes to `slots.footer`, before `slotProps.footer` is merged over them.
1005
+ * @since v3.0
1006
+ */
1007
+ export interface GridFooterSlotProps {
1008
+ apiRef: React.MutableRefObject<GridApi>;
1009
+ /** The active aggregation model (`{}` when none). */
1010
+ aggregationModel: GridAggregationModel;
1011
+ /** The grand-total aggregation result, or `null` when no aggregation is active. */
1012
+ aggregationResult: GridAggregationResult | null;
1013
+ /**
1014
+ * The built-in pager's count: rows after filtering, pinned rows excluded (`rowCount` from the
1015
+ * server in server pagination mode). Under tree data / row grouping: the filtered data rows.
1016
+ */
1017
+ rowCount: number;
1018
+ /** Whether pagination is in effect (false under row grouping and infinite scroll). */
1019
+ pagination: boolean;
1020
+ paginationModel: GridPaginationModel;
1021
+ pageSizeOptions: number[];
1022
+ onPaginationModelChange: (model: GridPaginationModel) => void;
829
1023
  }
830
1024
 
831
- export interface GridRowParams<R extends GridRowModel = GridRowModel> {
1025
+ /** The `slots` prop of `DataGrid`: components that replace built-in parts of the grid. */
1026
+ export type GridSlots = NonNullable<DataGridProps['slots']>;
1027
+
1028
+ /** The `slotProps` prop of `DataGrid`: props for each slot, keyed like `GridSlots`. */
1029
+ export type GridSlotProps = NonNullable<DataGridProps['slotProps']>;
1030
+
1031
+ export interface GridRowParams<R extends GridValidRowModel = GridRowModel> {
832
1032
  row: R;
833
1033
  id: GridRowId;
834
1034
  rowIndex: number;
835
1035
  }
836
1036
 
837
- export interface GridCellParams<R extends GridRowModel = GridRowModel> {
1037
+ export interface GridCellParams<R extends GridValidRowModel = GridRowModel> {
838
1038
  row: R;
839
1039
  field: string;
840
1040
  value: unknown;
@@ -843,7 +1043,7 @@ export interface GridCellParams<R extends GridRowModel = GridRowModel> {
843
1043
  colIndex: number;
844
1044
  }
845
1045
 
846
- export interface GridDetailPanelParams<R extends GridRowModel = GridRowModel> {
1046
+ export interface GridDetailPanelParams<R extends GridValidRowModel = GridRowModel> {
847
1047
  row: R;
848
1048
  id: GridRowId;
849
1049
  rowIndex: number;
@@ -851,31 +1051,26 @@ export interface GridDetailPanelParams<R extends GridRowModel = GridRowModel> {
851
1051
 
852
1052
  export type GridDetailPanelHeight = number | 'auto';
853
1053
 
854
- export type GridDetailPanelContent<R extends GridRowModel = GridRowModel> =
855
- | React.ReactNode
856
- | ((params: GridDetailPanelParams<R>) => React.ReactNode);
857
-
858
- export interface GridDetailPanelState {
859
- expandedRowIds: Set<GridRowId>;
860
- contentCache: Map<GridRowId, React.ReactNode>;
861
- }
862
-
863
1054
  /**
864
1055
  * The Imperative API for interacting with the DataGrid.
865
1056
  * Access this via the `apiRef` prop or a ref passed to the component.
866
1057
  */
867
- export interface GridApi {
1058
+ /**
1059
+ * The imperative grid API. `R` types the row getters (`getRow`, `getAllRows`, `getVisibleRows`,
1060
+ * `getAllFilteredRows`); it defaults to `GridRowModel`, so `GridApi` alone keeps working.
1061
+ */
1062
+ export interface GridApi<R extends GridValidRowModel = GridRowModel> {
868
1063
  /**
869
1064
  * Returns the row model with the given ID.
870
1065
  * @param id The row unique ID.
871
1066
  */
872
- getRow: (id: GridRowId) => GridRowModel | null;
1067
+ getRow: (id: GridRowId) => R | null;
873
1068
  /** Returns all rows currently loaded into the grid. */
874
- getAllRows: () => GridRowModel[];
1069
+ getAllRows: () => R[];
875
1070
  /** Returns all rows currently visible after filtering and sorting. */
876
- getVisibleRows: () => GridRowModel[];
1071
+ getVisibleRows: () => R[];
877
1072
  /** Returns all filtered and sorted rows, ignoring pagination. Use this for full-dataset exports. */
878
- getAllFilteredRows: () => GridRowModel[];
1073
+ getAllFilteredRows: () => R[];
879
1074
  /**
880
1075
  * Returns an ordered flat list of `GridGroupedExportRow` entries that mirrors the
881
1076
  * on-screen grouping tree: group-headers, leaf rows, per-group subtotals, and a
@@ -933,9 +1128,11 @@ export interface GridApi {
933
1128
  scrollToIndexes: (params: { rowIndex?: number; colIndex?: number }) => void;
934
1129
 
935
1130
  /**
936
- * Programmatically copies all currently selected rows to the clipboard as TSV.
937
- * Equivalent to the user pressing Ctrl+C / Cmd+C.
938
- * @returns A Promise that resolves when the copy completes.
1131
+ * Programmatically copies all currently selected rows to the clipboard as TSV: every selected
1132
+ * row that passes the filter (other pages, collapsed groups and pinned rows included), with the
1133
+ * visible columns in screen order. Equivalent to the user pressing Ctrl+C / Cmd+C.
1134
+ * @returns A Promise that resolves when the text is written (or when no selected row was found,
1135
+ * in which case nothing is written) and rejects when the clipboard write fails.
939
1136
  */
940
1137
  copySelectedRows: () => Promise<void>;
941
1138
  }