@opencorestack/opengridx 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/CHANGELOG.md +363 -0
  2. package/README.md +93 -72
  3. package/dist/index.d.ts +573 -124
  4. package/dist/opengridx.css +1 -1
  5. package/dist/opengridx.es.js +7890 -5636
  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 +341 -163
  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 +14 -12
  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 +56 -19
  54. package/docs/features/pinning.md +23 -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 +28 -7
  61. package/docs/migration/v1-to-v2.md +115 -0
  62. package/docs/migration/v2-to-v3.md +1222 -0
  63. package/docs/performance.md +124 -0
  64. package/docs/roadmap.md +4 -4
  65. package/lib/components/Cell/Cell.css +13 -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 +11 -0
  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 +77 -12
  76. package/lib/components/DataGrid/DataGrid.tsx +576 -874
  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 +164 -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 +3 -3
  94. package/lib/components/Header/Header.tsx +179 -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 +15 -3
  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 +82 -1
  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 +299 -109
  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 +260 -163
  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;
@@ -263,24 +349,40 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
263
349
  apiRef?: React.MutableRefObject<GridApi>;
264
350
  /** Custom components to replace internal grid parts. */
265
351
  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>>;
352
+ /**
353
+ * Component rendered as the grid toolbar. Receives `GridToolbarSlotProps` (plus `slotProps.toolbar`),
354
+ * so it can be typed with `GridToolbarProps` or wrap the exported `GridToolbar`.
355
+ */
356
+ toolbar?: React.ComponentType<GridToolbarSlotProps & Record<string, unknown>>;
357
+ /**
358
+ * Component rendered as the pagination control. Receives `PaginationProps` (plus `slotProps.pagination`),
359
+ * so it can be typed with `PaginationProps` or wrap the exported `Pagination`.
360
+ */
361
+ pagination?: React.ComponentType<GridPaginationSlotProps & Record<string, unknown>>;
362
+ /** Component rendered when the grid is empty. Receives only `slotProps.noRowsOverlay`. */
363
+ noRowsOverlay?: React.ComponentType<GridOverlaySlotProps>;
364
+ /** Component rendered during loading states. Receives only `slotProps.loadingOverlay`. */
365
+ loadingOverlay?: React.ComponentType<GridOverlaySlotProps>;
366
+ /**
367
+ * Component rendered at the very bottom of the grid, in place of the pagination area.
368
+ * Receives `GridFooterSlotProps` (plus `slotProps.footer`).
369
+ */
370
+ footer?: React.ComponentType<GridFooterSlotProps & Record<string, unknown>>;
276
371
  };
277
372
  /** Properties passed directly to custom slots. */
278
373
  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>;
374
+ /**
375
+ * Merged over the props the grid passes to the toolbar. Typed as `GridToolbarProps` (so render props
376
+ * such as `renderQuickFilter` are checked and their parameters inferred), plus any extra keys a custom
377
+ * toolbar reads. `columns` / `baseColumns` are not checked, so typed `GridColDef<R>[]` can be passed.
378
+ */
379
+ toolbar?: Omit<Partial<GridToolbarProps>, 'columns' | 'baseColumns'> & Record<string, unknown>;
380
+ /** Merged over the `PaginationProps` the grid passes to the pagination slot. */
381
+ pagination?: Partial<GridPaginationSlotProps> & Record<string, unknown>;
382
+ noRowsOverlay?: GridOverlaySlotProps;
383
+ loadingOverlay?: GridOverlaySlotProps;
384
+ /** Merged over the `GridFooterSlotProps` the grid passes to the footer slot. */
385
+ footer?: Partial<GridFooterSlotProps> & Record<string, unknown>;
284
386
  };
285
387
  /** When true, renders the grid as a single-column list of cards. Perfect for mobile/responsive views. */
286
388
  listView?: boolean;
@@ -302,9 +404,20 @@ export declare interface DataGridThemeProviderProps {
302
404
  style?: default_2.CSSProperties;
303
405
  }
304
406
 
407
+ /**
408
+ * `DataGridProps<R>` with untyped `columns` (`GridColDef[]`, i.e. `GridColDef<GridRowModel>[]`). `DataGrid`
409
+ * accepts these props as well as `DataGridProps<R>`, so columns written without a row type work with rows of
410
+ * any type `R`. Their callbacks then see `params.row` as `GridRowModel`; type the columns as
411
+ * `GridColDef<R>[]` to get your row type there.
412
+ * @since v3.0
413
+ */
414
+ export declare type DataGridUntypedColumnsProps<R extends GridValidRowModel = GridRowModel> = Omit<DataGridProps<R>, 'columns'> & {
415
+ columns: GridColDef[];
416
+ };
417
+
305
418
  export declare const emeraldTheme: GridTheme;
306
419
 
307
- export declare interface ExcelAdvancedExportOptions {
420
+ export declare interface ExcelAdvancedExportOptions<R extends GridValidRowModel = GridRowModel> {
308
421
  /** Output filename (default: 'export.xlsx') */
309
422
  fileName?: string;
310
423
  /**
@@ -332,8 +445,13 @@ export declare interface ExcelAdvancedExportOptions {
332
445
  aggregationResult?: Record<string, unknown> | null;
333
446
  /** Current aggregation model */
334
447
  aggregationModel?: GridAggregationModel | null;
335
- /** Currently selected row IDs */
448
+ /** Currently selected row IDs, written by `rows: 'selected'` sheets */
336
449
  selectedRows?: (string | number)[];
450
+ /**
451
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
452
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
453
+ */
454
+ getRowId?: (row: R) => GridRowId;
337
455
  /**
338
456
  * Grouped row structure, typically from `apiRef.current.getGroupedExportRows()`.
339
457
  * When provided, sheets with `rows: 'all'` are written in grouped order: group-header,
@@ -357,10 +475,10 @@ export declare interface ExcelColumnStyle {
357
475
  /** Horizontal alignment override */
358
476
  alignment?: 'left' | 'center' | 'right';
359
477
  /**
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).
478
+ * If true, the cell value (an image URL string, after `valueGetter`) is fetched and embedded
479
+ * as an inline image in the cell. PNG, JPEG and GIF are supported (detected from the bytes).
480
+ * Requires the image server to serve CORS headers. Falls back to the raw URL string if the
481
+ * fetch fails or the image is in another format (a warning is logged to the console).
364
482
  */
365
483
  embedImage?: boolean;
366
484
  /** Width of the embedded image in pixels (default: 40) */
@@ -369,21 +487,45 @@ export declare interface ExcelColumnStyle {
369
487
  imageHeight?: number;
370
488
  }
371
489
 
372
- export declare interface ExcelExportOptions {
490
+ export declare interface ExcelExportOptions<R extends GridValidRowModel = GridRowModel> {
491
+ /**
492
+ * Output filename. The file is an HTML table that Excel opens as a legacy `.xls` workbook, so a
493
+ * `.xlsx` extension is replaced with `.xls` (Excel refuses HTML content named `.xlsx`). Use
494
+ * `exportToExcelAdvanced` for a real `.xlsx`. Default: `'export.xls'`
495
+ */
373
496
  fileName?: string;
497
+ /** Sheet tab name. Characters Excel rejects are replaced and the name is cut to 31 characters. Default: `'Sheet1'` */
374
498
  sheetName?: string;
375
499
  includeHeaders?: boolean;
500
+ /**
501
+ * Export only these row IDs. A non-empty selection takes precedence over `groupedRows` (the
502
+ * selected rows are exported flat), and the totals rows are recomputed over the selected rows.
503
+ */
376
504
  selectedRows?: (string | number)[];
505
+ /**
506
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
507
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
508
+ */
509
+ getRowId?: (row: R) => GridRowId;
377
510
  aggregationResult?: Record<string, unknown> | null;
378
511
  aggregationModel?: GridAggregationModel | null;
379
512
  /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
380
513
  groupedRows?: GridGroupedExportRow[];
514
+ /**
515
+ * Prefix text cells that start with `=`, `+`, `-`, `@`, tab or carriage return with `'`, so
516
+ * Excel does not run them as formulas. Default: `true`
517
+ * @since v3.0
518
+ */
519
+ escapeFormulas?: boolean;
381
520
  }
382
521
 
383
522
  export declare interface ExcelSheetDefinition {
384
- /** Sheet tab name (max 31 chars) */
523
+ /**
524
+ * Sheet tab name. Characters Excel rejects (`\ / ? * : [ ]`) become `-`, the name is cut to
525
+ * 31 characters, and a duplicate name gets a " (2)" suffix.
526
+ */
385
527
  name: string;
386
- /** Which rows to include. Default: 'all' */
528
+ /** Which rows to include. `'selected'` writes only `selectedRows` (none when nothing is selected). Default: 'all' */
387
529
  rows?: 'all' | 'selected';
388
530
  /** Include header row. Default: true */
389
531
  includeHeaders?: boolean;
@@ -397,9 +539,13 @@ export declare interface ExcelSheetDefinition {
397
539
  alternateRowColor?: string | false;
398
540
  }
399
541
 
400
- export declare function exportToCsv<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: CsvExportOptions): void;
542
+ export declare function exportToCsv<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: CsvExportOptions<R>): void;
401
543
 
402
- export declare function exportToExcel<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: ExcelExportOptions): void;
544
+ export declare function exportToCsv<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: CsvExportOptions<R>): void;
545
+
546
+ export declare function exportToExcel<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: ExcelExportOptions<R>): void;
547
+
548
+ export declare function exportToExcel<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: ExcelExportOptions<R>): void;
403
549
 
404
550
  /**
405
551
  * Export the grid data to a real XLSX file using ExcelJS.
@@ -409,29 +555,43 @@ export declare function exportToExcel<R extends GridRowModel>(rows: R[], columns
409
555
  * ExcelJS is loaded lazily so it does not affect bundle size for apps
410
556
  * that only use CSV/JSON export.
411
557
  */
412
- export declare function exportToExcelAdvanced<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: ExcelAdvancedExportOptions): Promise<void>;
558
+ export declare function exportToExcelAdvanced<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: ExcelAdvancedExportOptions<R>): Promise<void>;
559
+
560
+ export declare function exportToExcelAdvanced<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: ExcelAdvancedExportOptions<R>): Promise<void>;
413
561
 
414
562
  /**
415
- * Export data to JSON format
563
+ * Export data to JSON format. Values are written raw (after `valueGetter`, without
564
+ * `valueFormatter`), including aggregation values, so the output can be parsed as data.
416
565
  */
417
- export declare function exportToJson<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: JsonExportOptions): void;
566
+ export declare function exportToJson<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: JsonExportOptions<R>): void;
418
567
 
419
- export declare function exportToPdf<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: PdfExportOptions): Promise<void>;
568
+ export declare function exportToJson<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: JsonExportOptions<R>): void;
569
+
570
+ export declare function exportToPdf<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: PdfExportOptions<R>): Promise<void>;
571
+
572
+ export declare function exportToPdf<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: PdfExportOptions<R>): Promise<void>;
420
573
 
421
574
  export declare const FilterPanel: default_2.FC<FilterPanelProps>;
422
575
 
423
- declare interface FilterPanelProps {
576
+ export declare interface FilterPanelProps {
424
577
  filterModel: GridFilterModel;
425
578
  columns: GridColDef[];
426
579
  onFilterModelChange: (model: GridFilterModel) => void;
427
580
  }
428
581
 
582
+ /** Default display string for an aggregate: `—` when missing, locale-grouped numbers, avg to 2 decimals. */
429
583
  export declare function formatAggregationValue(value: unknown, fnName: string): string;
430
584
 
431
585
  export declare interface GridAggregationModel {
432
586
  [field: string]: string;
433
587
  }
434
588
 
589
+ /**
590
+ * Where a group's aggregates are shown, as returned by `getAggregationPosition`: `'inline'` on the group row,
591
+ * `'footer'` on a subtotal row after the group's children, `null` hidden.
592
+ */
593
+ export declare type GridAggregationPosition = 'inline' | 'footer' | null;
594
+
435
595
  export declare type GridAggregationResult = Record<string, unknown>;
436
596
 
437
597
  export declare type GridAlignment = 'left' | 'center' | 'right';
@@ -505,14 +665,16 @@ export declare interface GridApi {
505
665
  colIndex?: number;
506
666
  }) => void;
507
667
  /**
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.
668
+ * Programmatically copies all currently selected rows to the clipboard as TSV: every selected
669
+ * row that passes the filter (other pages, collapsed groups and pinned rows included), with the
670
+ * visible columns in screen order. Equivalent to the user pressing Ctrl+C / Cmd+C.
671
+ * @returns A Promise that resolves when the text is written (or when no selected row was found,
672
+ * in which case nothing is written) and rejects when the clipboard write fails.
511
673
  */
512
674
  copySelectedRows: () => Promise<void>;
513
675
  }
514
676
 
515
- export declare interface GridCellParams<R extends GridRowModel = GridRowModel> {
677
+ export declare interface GridCellParams<R extends GridValidRowModel = GridRowModel> {
516
678
  row: R;
517
679
  field: string;
518
680
  value: unknown;
@@ -525,7 +687,7 @@ export declare interface GridCellParams<R extends GridRowModel = GridRowModel> {
525
687
  * Metadata for a single column.
526
688
  * Governs rendering, sorting, filtering, and data transformation.
527
689
  */
528
- export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
690
+ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel> {
529
691
  /** The unique identifier for the column, typically matching a row object key. */
530
692
  field: string;
531
693
  /** Text displayed in the column header. */
@@ -579,25 +741,41 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
579
741
  label: string;
580
742
  }>;
581
743
  /** Function to compute a cell value from raw row data. */
582
- valueGetter?: (params: GridValueGetterParams<R>) => unknown;
744
+ valueGetter?(params: GridValueGetterParams<R>): unknown;
745
+ /**
746
+ * Maps an edited value back onto the row when an edit is committed; return the updated row.
747
+ * Needed for editable columns with a `valueGetter`, whose value is not stored in `row[field]`.
748
+ * Without it the commit writes `row[field] = value`.
749
+ * @since v3.0
750
+ */
751
+ valueSetter?(params: GridValueSetterParams<R>): R;
583
752
  /** Function to format a value into a human-readable string. */
584
- valueFormatter?: (params: GridValueFormatterParams<R>) => string;
753
+ valueFormatter?(params: GridValueFormatterParams<R>): string;
585
754
  /** Custom component or element to render in the cell. */
586
- renderCell?: (params: GridRenderCellParams<R>) => React.ReactNode;
755
+ renderCell?(params: GridRenderCellParams<R>): React.ReactNode;
587
756
  /** 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;
757
+ renderHeader?(params: GridRenderHeaderParams): React.ReactNode;
758
+ /** Component to render when the cell is in edit mode. Receives `onValueChange`, `onCommit` and `onCancel`. */
759
+ renderEditCell?(params: GridRenderEditCellParams<R>): React.ReactNode;
591
760
  /** If true, the cell's value can be modified by the user. */
592
761
  editable?: boolean;
593
762
  /** Optional stacking order (CSS z-index). */
594
763
  zIndex?: number;
595
764
  /** If true, the column kebab/hamburger menu is disabled. */
596
765
  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);
766
+ /**
767
+ * Number of columns this cell should occupy horizontally: the origin plus the next visible columns
768
+ * in render order, clamped to the end of the origin's pinned section. Fractions are floored,
769
+ * `Infinity` means "to the end", and NaN / values below 1 mean no span. `params.value` is the
770
+ * `valueGetter` result. A function that throws is treated as 1.
771
+ */
772
+ colSpan?: number | GridColDefCallback<GridRenderCellParams<R>, number>;
773
+ /**
774
+ * Number of rows this cell should occupy vertically, clamped to the end of its row section
775
+ * (top-pinned, scrolling or bottom-pinned rows) and to the first row with an expanded detail
776
+ * panel. Normalised like `colSpan`. With both set, the origin covers the whole rectangle.
777
+ */
778
+ rowSpan?: number | GridColDefCallback<GridRenderCellParams<R>, number>;
601
779
  /**
602
780
  * Custom CSS class applied to every cell in this column.
603
781
  * Can be a static string or a function that receives the cell params and returns a string.
@@ -606,7 +784,7 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
606
784
  * cellClassName: 'my-class'
607
785
  * cellClassName: ({ value }) => value > 100 ? 'cell--high' : 'cell--low'
608
786
  */
609
- cellClassName?: string | ((params: GridRenderCellParams<R>) => string);
787
+ cellClassName?: string | GridColDefCallback<GridRenderCellParams<R>, string>;
610
788
  /**
611
789
  * Custom CSS class applied to the header cell of this column.
612
790
  * @example
@@ -621,6 +799,15 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
621
799
  exportable?: boolean;
622
800
  }
623
801
 
802
+ /**
803
+ * A callback that is checked bivariantly in its parameter, like a method. Used for `GridColDef`
804
+ * options that are either a value or a function, so a column typed for your rows (`GridColDef<Row>`)
805
+ * can still be used where an untyped `GridColDef` is expected.
806
+ */
807
+ declare type GridColDefCallback<P, T> = {
808
+ bivarianceHack(params: P): T;
809
+ }['bivarianceHack'];
810
+
624
811
  /**
625
812
  * Describes one level of column grouping.
626
813
  * Groups can be nested by placing child GridColumnGroup objects in `children`.
@@ -639,7 +826,7 @@ export declare interface GridColumnGroup {
639
826
  groupId: string;
640
827
  /** Text displayed in the group header cell. */
641
828
  headerName: string;
642
- /** Optional override for the header cell background color. */
829
+ /** CSS class(es) added to this group's header cell(s). */
643
830
  headerClassName?: string;
644
831
  /**
645
832
  * Either an array of column field strings (leaf group)
@@ -650,7 +837,7 @@ export declare interface GridColumnGroup {
650
837
 
651
838
  export declare type GridColumnGroupingModel = GridColumnGroup[];
652
839
 
653
- declare type GridColumnOrder = string[];
840
+ export declare type GridColumnOrder = string[];
654
841
 
655
842
  export declare interface GridColumnOrderChangeParams {
656
843
  column: GridColDef;
@@ -679,7 +866,7 @@ export declare type GridColumnVisibilityModel = Record<string, boolean>;
679
866
  * Interface for providing data to the grid from a remote source.
680
867
  * Enables server-side sorting, filtering, and pagination.
681
868
  */
682
- export declare interface GridDataSource<R extends GridRowModel = GridRowModel> {
869
+ export declare interface GridDataSource<R extends GridValidRowModel = GridRowModel> {
683
870
  /**
684
871
  * Fetches a chunk of rows based on current grid state.
685
872
  * @param params Sorting, filtering, and range parameters.
@@ -691,7 +878,7 @@ export declare interface GridDataSource<R extends GridRowModel = GridRowModel> {
691
878
  getAggregations?: (params: Omit<GridGetRowsParams, 'startRow' | 'endRow'>) => Promise<Record<string, unknown>>;
692
879
  }
693
880
 
694
- declare interface GridDataSourceState {
881
+ export declare interface GridDataSourceState {
695
882
  loading: boolean;
696
883
  error?: unknown;
697
884
  }
@@ -700,9 +887,9 @@ export declare interface GridDensityState {
700
887
  density: 'compact' | 'standard' | 'comfortable';
701
888
  }
702
889
 
703
- declare type GridDetailPanelHeight = number | 'auto';
890
+ export declare type GridDetailPanelHeight = number | 'auto';
704
891
 
705
- export declare interface GridDetailPanelParams<R extends GridRowModel = GridRowModel> {
892
+ export declare interface GridDetailPanelParams<R extends GridValidRowModel = GridRowModel> {
706
893
  row: R;
707
894
  id: GridRowId;
708
895
  rowIndex: number;
@@ -740,12 +927,34 @@ export declare interface GridFilterModel {
740
927
  quickFilterValues?: string[];
741
928
  }
742
929
 
743
- export declare type GridFilterOperator = 'contains' | 'equals' | 'startsWith' | 'endsWith' | 'isEmpty' | 'isNotEmpty' | 'isAnyOf' | '>' | '>=' | '<' | '<=' | '!=' | 'is' | 'not';
930
+ export declare type GridFilterOperator = 'contains' | 'equals' | 'startsWith' | 'endsWith' | 'isEmpty' | 'isNotEmpty' | 'isAnyOf' | '=' | '>' | '>=' | '<' | '<=' | '!=' | 'is' | 'not' | 'after' | 'onOrAfter' | 'before' | 'onOrBefore';
744
931
 
745
932
  export declare interface GridFilterState {
746
933
  filterModel: GridFilterModel;
747
934
  }
748
935
 
936
+ /**
937
+ * Props the grid passes to `slots.footer`, before `slotProps.footer` is merged over them.
938
+ * @since v3.0
939
+ */
940
+ export declare interface GridFooterSlotProps {
941
+ apiRef: React.MutableRefObject<GridApi>;
942
+ /** The active aggregation model (`{}` when none). */
943
+ aggregationModel: GridAggregationModel;
944
+ /** The grand-total aggregation result, or `null` when no aggregation is active. */
945
+ aggregationResult: GridAggregationResult | null;
946
+ /**
947
+ * The built-in pager's count: rows after filtering, pinned rows excluded (`rowCount` from the
948
+ * server in server pagination mode). Under tree data / row grouping: the filtered data rows.
949
+ */
950
+ rowCount: number;
951
+ /** Whether pagination is in effect (false under row grouping and infinite scroll). */
952
+ pagination: boolean;
953
+ paginationModel: GridPaginationModel;
954
+ pageSizeOptions: number[];
955
+ onPaginationModelChange: (model: GridPaginationModel) => void;
956
+ }
957
+
749
958
  export declare interface GridGetRowsParams {
750
959
  startRow: number;
751
960
  endRow: number;
@@ -755,7 +964,7 @@ export declare interface GridGetRowsParams {
755
964
  aggregationModel?: GridAggregationModel;
756
965
  }
757
966
 
758
- export declare interface GridGetRowsResponse<R extends GridRowModel = GridRowModel> {
967
+ export declare interface GridGetRowsResponse<R extends GridValidRowModel = GridRowModel> {
759
968
  rows: R[];
760
969
  rowCount?: number;
761
970
  aggregationResults?: Record<string, unknown>;
@@ -765,7 +974,7 @@ export declare interface GridGetRowsResponse<R extends GridRowModel = GridRowMod
765
974
  * A single entry in the ordered list returned by `GridApi.getGroupedExportRows()`.
766
975
  * Traverse in array order to reproduce the on-screen grouping structure.
767
976
  */
768
- declare interface GridGroupedExportRow {
977
+ export declare interface GridGroupedExportRow {
769
978
  /** Discriminator: the kind of row this entry represents. */
770
979
  type: 'group-header' | 'leaf' | 'group-subtotal' | 'grand-total';
771
980
  /** Nesting depth (0 = top-level group, 1 = nested group, etc.). */
@@ -774,18 +983,31 @@ declare interface GridGroupedExportRow {
774
983
  groupField?: string;
775
984
  /** The raw grouping value for this level (absent on 'leaf' and 'grand-total'). */
776
985
  groupValue?: unknown;
986
+ /**
987
+ * The group label exactly as the grid shows it (from `groupingValueFormatter`, else `"field: value"`),
988
+ * on 'group-header' and 'group-subtotal' entries from `getGroupedExportRows()`. Exporters use it for
989
+ * group-header rows; when absent they apply the column's `groupingValueFormatter` themselves.
990
+ * @since v3.0
991
+ */
992
+ groupLabel?: string;
777
993
  /** Per-group aggregation results (present on 'group-subtotal' and 'grand-total'). */
778
994
  aggregatedValues?: Record<string, unknown>;
779
995
  /** The original data row (only present when `type === 'leaf'`). */
780
996
  row?: GridRowModel;
781
997
  }
782
998
 
783
- export declare type GridInitialState = GridState;
999
+ /**
1000
+ * The state the grid starts from. Every part is optional, including each column field, so a
1001
+ * partial state such as `{ columns: { columnVisibilityModel: { age: false } } }` is valid.
1002
+ */
1003
+ export declare interface GridInitialState extends Omit<GridState, 'columns'> {
1004
+ columns?: Partial<GridColumnsState>;
1005
+ }
784
1006
 
785
1007
  /** Column definition used exclusively in List View mode. */
786
- export declare interface GridListViewColDef<R extends GridRowModel = GridRowModel> {
1008
+ export declare interface GridListViewColDef<R extends GridValidRowModel = GridRowModel> {
787
1009
  field: string;
788
- renderCell: (params: GridRenderCellParams<R>) => React.ReactNode;
1010
+ renderCell(params: GridRenderCellParams<R>): React.ReactNode;
789
1011
  }
790
1012
 
791
1013
  /** Overrideable user-visible strings for internationalisation. All fields are optional; defaults match the built-in English strings. */
@@ -800,11 +1022,24 @@ export declare interface GridLocaleText {
800
1022
  noRowsLabel?: string;
801
1023
  }
802
1024
 
1025
+ /**
1026
+ * Props of `slots.noRowsOverlay` and `slots.loadingOverlay`: the grid passes none of its own, only
1027
+ * `slotProps.noRowsOverlay` / `slotProps.loadingOverlay`.
1028
+ * @since v3.0
1029
+ */
1030
+ export declare type GridOverlaySlotProps = Record<string, unknown>;
1031
+
803
1032
  export declare interface GridPaginationModel {
804
1033
  page: number;
805
1034
  pageSize: number;
806
1035
  }
807
1036
 
1037
+ /**
1038
+ * Props the grid passes to `slots.pagination`, before `slotProps.pagination` is merged over them.
1039
+ * @since v3.0
1040
+ */
1041
+ export declare type GridPaginationSlotProps = PaginationProps;
1042
+
808
1043
  export declare interface GridPaginationState {
809
1044
  paginationModel: GridPaginationModel;
810
1045
  rowCount?: number;
@@ -827,7 +1062,7 @@ export declare interface GridPivotValueField {
827
1062
  }
828
1063
 
829
1064
  /** Parameters passed to the `renderCell` function. */
830
- export declare interface GridRenderCellParams<R extends GridRowModel = GridRowModel> {
1065
+ export declare interface GridRenderCellParams<R extends GridValidRowModel = GridRowModel> {
831
1066
  /** The current cell value. */
832
1067
  value: unknown;
833
1068
  /**
@@ -852,6 +1087,19 @@ export declare interface GridRenderCellParams<R extends GridRowModel = GridRowMo
852
1087
  rowMeta?: GridRowMeta;
853
1088
  }
854
1089
 
1090
+ /**
1091
+ * Parameters passed to `renderEditCell`. `value` is the pending (uncommitted) value.
1092
+ * @since v3.0
1093
+ */
1094
+ export declare interface GridRenderEditCellParams<R extends GridValidRowModel = GridRowModel> extends GridRenderCellParams<R> {
1095
+ /** Updates the pending value. Call it on every change; nothing is saved until `onCommit`. */
1096
+ onValueChange: (value: unknown) => void;
1097
+ /** Commits the pending value (runs `processRowUpdate`) and leaves edit mode. */
1098
+ onCommit: () => void;
1099
+ /** Discards the pending value and leaves edit mode. */
1100
+ onCancel: () => void;
1101
+ }
1102
+
855
1103
  export declare interface GridRenderHeaderParams {
856
1104
  field: string;
857
1105
  colDef: GridColDef;
@@ -864,24 +1112,39 @@ export declare type GridRowGroupingModel = string[];
864
1112
  export declare type GridRowId = string | number;
865
1113
 
866
1114
  /**
867
- * Internal hierarchy metadata for a row. Exposed via `params.rowMeta` in `renderCell`.
1115
+ * Hierarchy metadata for a row. Exposed via `params.rowMeta` in `renderCell`.
868
1116
  * Not present (`undefined`) for flat rows with no active tree-data or row-grouping.
869
1117
  *
870
1118
  * @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.
1119
+ * fields that were injected onto row objects. Since v3.0 those fields are no longer
1120
+ * added at runtime: row objects reach `renderCell` exactly as you passed them.
875
1121
  */
876
1122
  export declare interface GridRowMeta {
1123
+ /** The row has children to show: the expand toggle is rendered for it. */
877
1124
  hasChildren?: boolean;
878
1125
  treeDepth?: number;
879
1126
  groupingField?: string;
880
1127
  groupingValue?: unknown;
1128
+ /** The label the grid shows for a synthetic row: the group label, or the path segment of an auto-created tree parent. */
881
1129
  groupLabel?: string;
1130
+ /**
1131
+ * Data rows below this row at any depth that pass the active filter (row-grouping leaves, or
1132
+ * tree-data rows; auto-created tree parents are not counted). The "(n)" shown next to group labels.
1133
+ */
882
1134
  descendantCount?: number;
883
1135
  isExpanded?: boolean;
1136
+ /**
1137
+ * The row is synthetic: a row-grouping group row, a group subtotal row, or a tree-data parent the
1138
+ * grid created for a path segment with no row of its own. Synthetic rows are never selected,
1139
+ * edited or given a detail panel, and `valueGetter` is not called for them.
1140
+ */
884
1141
  isGroupRow?: boolean;
1142
+ /**
1143
+ * The row is the subtotal row of the group described by `groupingField` / `groupingValue`, shown
1144
+ * after the group's children when `getAggregationPosition` returns `'footer'` for it.
1145
+ * @since v3.0
1146
+ */
1147
+ isGroupFooter?: boolean;
885
1148
  }
886
1149
 
887
1150
  /** Base interface for a grid row data object. */
@@ -896,13 +1159,13 @@ export declare interface GridRowModel {
896
1159
  [key: string]: unknown;
897
1160
  }
898
1161
 
899
- export declare interface GridRowOrderChangeParams<R extends GridRowModel = GridRowModel> {
1162
+ export declare interface GridRowOrderChangeParams<R extends GridValidRowModel = GridRowModel> {
900
1163
  row: R;
901
1164
  oldIndex: number;
902
1165
  targetIndex: number;
903
1166
  }
904
1167
 
905
- export declare interface GridRowParams<R extends GridRowModel = GridRowModel> {
1168
+ export declare interface GridRowParams<R extends GridValidRowModel = GridRowModel> {
906
1169
  row: R;
907
1170
  id: GridRowId;
908
1171
  rowIndex: number;
@@ -916,7 +1179,7 @@ export declare interface GridRowPinning {
916
1179
  bottom?: GridRowId[];
917
1180
  }
918
1181
 
919
- declare interface GridRowScrollEndParams {
1182
+ export declare interface GridRowScrollEndParams {
920
1183
  visibleTop: number;
921
1184
  visibleBottom: number;
922
1185
  viewportHeight: number;
@@ -924,6 +1187,12 @@ declare interface GridRowScrollEndParams {
924
1187
 
925
1188
  export declare type GridRowSelectionModel = GridRowId[];
926
1189
 
1190
+ /** The `slotProps` prop of `DataGrid`: props for each slot, keyed like `GridSlots`. */
1191
+ export declare type GridSlotProps = NonNullable<DataGridProps['slotProps']>;
1192
+
1193
+ /** The `slots` prop of `DataGrid`: components that replace built-in parts of the grid. */
1194
+ export declare type GridSlots = NonNullable<DataGridProps['slots']>;
1195
+
927
1196
  export declare type GridSortDirection = 'asc' | 'desc' | null;
928
1197
 
929
1198
  export declare interface GridSortingState {
@@ -950,6 +1219,12 @@ export declare interface GridState {
950
1219
  }
951
1220
 
952
1221
  export declare interface GridTheme {
1222
+ /**
1223
+ * The complete base palette the theme starts from (default `'light'`). The provider pins every
1224
+ * colour token, so the grid follows the theme whatever the operating-system colour scheme is.
1225
+ * Use `'dark'` for a dark theme; the other keys override single tokens on top of it.
1226
+ */
1227
+ mode?: 'light' | 'dark';
953
1228
  colors?: GridThemeColors;
954
1229
  typography?: GridThemeTypography;
955
1230
  spacing?: GridThemeSpacing;
@@ -987,13 +1262,46 @@ export declare interface GridThemeColors {
987
1262
  warning?: string;
988
1263
  error?: string;
989
1264
  info?: string;
1265
+ /** Page-level surface colour (`--ogx-color-white`): inputs, buttons, checkbox fallbacks. */
1266
+ white?: string;
1267
+ /** Strongest text colour (`--ogx-color-black`). */
1268
+ black?: string;
1269
+ /**
1270
+ * The neutral scale (`--ogx-color-gray-50` … `--ogx-color-gray-900`) used by group rows, detail
1271
+ * panels, inputs, buttons and panels. The theme's `mode` supplies a complete scale; override
1272
+ * single steps here.
1273
+ */
1274
+ gray?: GridThemeGrayScale;
1275
+ }
1276
+
1277
+ /** Steps of the neutral scale; 50 is the lightest surface in light mode, the darkest in dark mode. */
1278
+ export declare interface GridThemeGrayScale {
1279
+ 50?: string;
1280
+ 100?: string;
1281
+ 200?: string;
1282
+ 300?: string;
1283
+ 400?: string;
1284
+ 500?: string;
1285
+ 600?: string;
1286
+ 700?: string;
1287
+ 800?: string;
1288
+ 900?: string;
990
1289
  }
991
1290
 
1291
+ /**
1292
+ * Row and header heights are read by the grid itself (they drive virtualization), so they must be
1293
+ * pixel values such as `'36px'` or `'36'`. The `rowHeight` / `headerHeight` props win over them;
1294
+ * `rowHeightCompact` / `rowHeightComfortable` apply with `density="compact"` / `"comfortable"`.
1295
+ */
992
1296
  export declare interface GridThemeGrid {
993
1297
  rowHeightCompact?: string;
994
1298
  rowHeightStandard?: string;
995
1299
  rowHeightComfortable?: string;
996
1300
  headerHeight?: string;
1301
+ /** Font size of body cells (`--ogx-grid-cell-font-size`, default 13px). */
1302
+ cellFontSize?: string;
1303
+ /** Font size of header cells (`--ogx-grid-header-font-size`, default 13px). */
1304
+ headerFontSize?: string;
997
1305
  cellPaddingX?: string;
998
1306
  cellPaddingY?: string;
999
1307
  background?: string;
@@ -1014,7 +1322,7 @@ export declare interface GridThemeGrid {
1014
1322
  checkboxBorder?: string;
1015
1323
  }
1016
1324
 
1017
- declare interface GridThemeOverlays {
1325
+ export declare interface GridThemeOverlays {
1018
1326
  background?: string;
1019
1327
  text?: string;
1020
1328
  border?: string;
@@ -1027,7 +1335,7 @@ declare interface GridThemeOverlays {
1027
1335
  itemDangerText?: string;
1028
1336
  }
1029
1337
 
1030
- declare interface GridThemeScrollbar {
1338
+ export declare interface GridThemeScrollbar {
1031
1339
  thumbColor?: string;
1032
1340
  trackColor?: string;
1033
1341
  size?: string;
@@ -1040,11 +1348,9 @@ export declare interface GridThemeShadows {
1040
1348
  xl?: string;
1041
1349
  }
1042
1350
 
1043
- declare interface GridThemeSkeleton {
1351
+ export declare interface GridThemeSkeleton {
1044
1352
  baseColor?: string;
1045
1353
  highlightColor?: string;
1046
- darkBaseColor?: string;
1047
- darkHighlightColor?: string;
1048
1354
  }
1049
1355
 
1050
1356
  export declare interface GridThemeSpacing {
@@ -1056,7 +1362,7 @@ export declare interface GridThemeSpacing {
1056
1362
  xxl?: string;
1057
1363
  }
1058
1364
 
1059
- declare interface GridThemeToolbar {
1365
+ export declare interface GridThemeToolbar {
1060
1366
  background?: string;
1061
1367
  text?: string;
1062
1368
  border?: string;
@@ -1152,11 +1458,20 @@ export declare interface GridToolbarProps {
1152
1458
  showNonHideableColumns?: boolean;
1153
1459
  }
1154
1460
 
1461
+ /**
1462
+ * Props the grid passes to `slots.toolbar`, before `slotProps.toolbar` is merged over them: the
1463
+ * `GridToolbarProps` it controls (columns, models and their change handlers) plus `apiRef`.
1464
+ * @since v3.0
1465
+ */
1466
+ export declare interface GridToolbarSlotProps extends GridToolbarProps {
1467
+ apiRef: React.MutableRefObject<GridApi>;
1468
+ }
1469
+
1155
1470
  export declare function GridTooltip({ title, children, placement, enterDelay, leaveDelay }: GridTooltipProps): JSX.Element;
1156
1471
 
1157
- declare interface GridTooltipProps {
1158
- title: React.ReactNode;
1159
- children: React.ReactElement;
1472
+ export declare interface GridTooltipProps {
1473
+ title: default_2.ReactNode;
1474
+ children: default_2.ReactElement;
1160
1475
  placement?: 'top' | 'bottom' | 'left' | 'right';
1161
1476
  enterDelay?: number;
1162
1477
  leaveDelay?: number;
@@ -1186,14 +1501,23 @@ export declare interface GridTreeNode {
1186
1501
  children?: GridRowId[];
1187
1502
  /** Display label for the group. */
1188
1503
  label?: string;
1189
- /** Total count of all descendants (recursive). */
1504
+ /** Row grouping: the number of leaf rows in the group that pass the active filter (recursive). */
1190
1505
  descendantCount?: number;
1191
1506
  /** Count of children on the server (for lazy loading). */
1192
1507
  serverChildrenCount?: number;
1193
1508
  }
1194
1509
 
1510
+ /**
1511
+ * The constraint on the row type `R` of the generic grid types (`DataGridProps<R>`, `GridColDef<R>`,
1512
+ * `GridRenderCellParams<R>` …): any object type. Your own interfaces and type aliases can be used as `R`
1513
+ * directly; they do not need an index signature or to extend `GridRowModel`. Rows without an `id`
1514
+ * field need `getRowId`. `GridRowModel` stays the default `R` (rows with any keys, read as `unknown`).
1515
+ * @since v3.0
1516
+ */
1517
+ export declare type GridValidRowModel = object;
1518
+
1195
1519
  /** Parameters passed to the `valueFormatter` function. */
1196
- export declare interface GridValueFormatterParams<R extends GridRowModel = GridRowModel> {
1520
+ export declare interface GridValueFormatterParams<R extends GridValidRowModel = GridRowModel> {
1197
1521
  /** The raw value to format. */
1198
1522
  value: unknown;
1199
1523
  /** The row object. */
@@ -1203,7 +1527,7 @@ export declare interface GridValueFormatterParams<R extends GridRowModel = GridR
1203
1527
  }
1204
1528
 
1205
1529
  /** Parameters passed to the `valueGetter` function. */
1206
- export declare interface GridValueGetterParams<R extends GridRowModel = GridRowModel> {
1530
+ export declare interface GridValueGetterParams<R extends GridValidRowModel = GridRowModel> {
1207
1531
  /** The row object. */
1208
1532
  row: R;
1209
1533
  /** The field name. */
@@ -1212,10 +1536,27 @@ export declare interface GridValueGetterParams<R extends GridRowModel = GridRowM
1212
1536
  value: unknown;
1213
1537
  }
1214
1538
 
1539
+ /**
1540
+ * Parameters passed to the `valueSetter` function.
1541
+ * @since v3.0
1542
+ */
1543
+ export declare interface GridValueSetterParams<R extends GridValidRowModel = GridRowModel> {
1544
+ /** The committed value from the editor. */
1545
+ value: unknown;
1546
+ /** The row as it was before the edit. */
1547
+ row: R;
1548
+ /** The field name. */
1549
+ field: string;
1550
+ }
1551
+
1215
1552
  export declare function Header<R extends GridRowModel = GridRowModel>(props: HeaderProps<R>): JSX.Element;
1216
1553
 
1217
- declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1554
+ export declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1218
1555
  columns: GridColDef<R>[];
1556
+ /**
1557
+ * Every rendered data column in render order (left-pinned, unpinned, right-pinned) with its
1558
+ * resolved width. Column group header rows are laid out over these; defaults to `columns`.
1559
+ */
1219
1560
  allColumns?: GridColDef<R>[];
1220
1561
  columnGroupingModel?: GridColumnGroupingModel;
1221
1562
  checkboxSelection?: boolean;
@@ -1241,8 +1582,9 @@ declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1241
1582
  onDragOver?: (field: string) => (event: default_2.DragEvent) => void;
1242
1583
  onDragEnd?: () => void;
1243
1584
  onDrop?: (targetField: string) => (event: default_2.DragEvent) => void;
1585
+ /** The grid's focus position; `id: null` means a header cell is focused. */
1244
1586
  focusedCell?: {
1245
- id: string | number;
1587
+ id: string | number | null;
1246
1588
  field: string;
1247
1589
  } | null;
1248
1590
  onHeaderClick?: (field: string) => void;
@@ -1251,32 +1593,57 @@ declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1251
1593
  onHideColumn?: (field: string) => void;
1252
1594
  onPinColumn?: (field: string, side: 'left' | 'right' | null) => void;
1253
1595
  onManageColumns?: () => void;
1596
+ /** Position of each visible data column in render order, for `colIndex` and `aria-colindex`. */
1597
+ columnIndexMap?: Map<string, number>;
1254
1598
  }
1255
1599
 
1256
1600
  export declare const Input: default_2.FC<InputProps>;
1257
1601
 
1258
- declare interface InputProps extends default_2.InputHTMLAttributes<HTMLInputElement> {
1602
+ export declare interface InputProps extends default_2.InputHTMLAttributes<HTMLInputElement> {
1259
1603
  fullWidth?: boolean;
1260
1604
  error?: boolean;
1261
1605
  startAdornment?: default_2.ReactNode;
1262
1606
  endAdornment?: default_2.ReactNode;
1263
1607
  }
1264
1608
 
1265
- export declare interface JsonExportOptions {
1609
+ export declare interface JsonExportOptions<R extends GridValidRowModel = GridRowModel> {
1266
1610
  fileName?: string;
1267
1611
  pretty?: boolean;
1612
+ /**
1613
+ * Export only these row IDs. A non-empty selection takes precedence over `groupedRows` (the
1614
+ * selected rows are exported flat), and the aggregation values are recomputed over them.
1615
+ */
1268
1616
  selectedRows?: (string | number)[];
1617
+ /**
1618
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
1619
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
1620
+ */
1621
+ getRowId?: (row: R) => GridRowId;
1269
1622
  aggregationResult?: Record<string, unknown> | null;
1270
1623
  aggregationModel?: GridAggregationModel | null;
1271
1624
  /** When provided, emits a nested grouping tree instead of a flat array. */
1272
1625
  groupedRows?: GridGroupedExportRow[];
1273
1626
  }
1274
1627
 
1628
+ export declare function Pagination(props: PaginationProps): JSX.Element;
1629
+
1630
+ export declare interface PaginationProps {
1631
+ page: number;
1632
+ pageSize: number;
1633
+ rowCount: number;
1634
+ onPageChange: (page: number) => void;
1635
+ onPageSizeChange: (pageSize: number) => void;
1636
+ pageSizeOptions?: number[];
1637
+ showFirstButton?: boolean;
1638
+ showLastButton?: boolean;
1639
+ localeText?: Pick<GridLocaleText, 'paginationRowsPerPage' | 'paginationOf' | 'paginationPage'>;
1640
+ }
1641
+
1275
1642
  /**
1276
1643
  * Configuration options for exporting the DataGrid to PDF format.
1277
1644
  * Requires jspdf and jspdf-autotable peer dependencies.
1278
1645
  */
1279
- export declare interface PdfExportOptions {
1646
+ export declare interface PdfExportOptions<R extends GridValidRowModel = GridRowModel> {
1280
1647
  /**
1281
1648
  * Output filename without extension. Default: 'export'
1282
1649
  */
@@ -1296,9 +1663,16 @@ export declare interface PdfExportOptions {
1296
1663
  */
1297
1664
  orientation?: 'portrait' | 'landscape';
1298
1665
  /**
1299
- * If provided, only rows whose id is in this array are exported.
1666
+ * If provided, only rows whose id is in this array are exported. A non-empty selection takes
1667
+ * precedence over `groupedRows` (the selected rows are exported flat), and the footer totals
1668
+ * are recomputed over the selected rows.
1300
1669
  */
1301
1670
  selectedRows?: (string | number)[];
1671
+ /**
1672
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
1673
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
1674
+ */
1675
+ getRowId?: (row: R) => GridRowId;
1302
1676
  /**
1303
1677
  * Aggregation result from apiRef.current.getAggregationResult().
1304
1678
  * When provided alongside aggregationModel, appends a footer row.
@@ -1328,23 +1702,63 @@ export declare interface PdfExportOptions {
1328
1702
  * Base font size in points for table body. Default: 9
1329
1703
  */
1330
1704
  fontSize?: number;
1705
+ /**
1706
+ * A TrueType font for the whole document. The built-in Helvetica font only covers Latin-1 and
1707
+ * WinAnsi punctuation (é, ü, €, “ ”, •). Without this option other characters (₹, Greek,
1708
+ * Cyrillic, CJK, Devanagari, U+202F used by some locales as a thousands separator) are
1709
+ * replaced with `?` (spaces and minus signs with their ASCII forms) and a warning is logged.
1710
+ * `data` is the `.ttf` file as a base64 string; `boldData` is an optional bold face for the
1711
+ * title, header and totals (the regular face is used when omitted). jsPDF does not shape
1712
+ * complex scripts, so Devanagari or Arabic ligatures may not join.
1713
+ * @since v3.0
1714
+ */
1715
+ font?: {
1716
+ /** Font family name, e.g. 'NotoSans'. */
1717
+ name: string;
1718
+ /** Base64-encoded .ttf file. */
1719
+ data: string;
1720
+ /** Base64-encoded bold .ttf file. Default: `data`. */
1721
+ boldData?: string;
1722
+ };
1331
1723
  /**
1332
1724
  * Pre-built grouped export rows from `apiRef.current.getGroupedExportRows()`.
1333
1725
  * When provided, the PDF table reflects the grouping structure (group headers,
1334
1726
  * leaf rows, per-group subtotals, grand total) instead of a flat row list.
1335
- * Has no effect when the grid has no active `rowGroupingModel`.
1727
+ * Has no effect when the grid has no active `rowGroupingModel`, or when `selectedRows` is non-empty.
1336
1728
  */
1337
1729
  groupedRows?: GridGroupedExportRow[];
1338
1730
  }
1339
1731
 
1732
+ declare interface PivotResult {
1733
+ /** Pivot data rows followed by the Grand Total row (omitted when there are no data rows). */
1734
+ pivotRows: GridRowModel[];
1735
+ /** Row-label columns (one per row field) followed by one value column per column key and value field. */
1736
+ pivotColumns: GridColDef[];
1737
+ /** The distinct column-field value combinations, in display order. */
1738
+ colKeys: string[];
1739
+ /** `false` when the model has no usable row field or value field. */
1740
+ isValid: boolean;
1741
+ }
1742
+
1340
1743
  /**
1341
1744
  * Open print dialog with formatted table
1342
1745
  */
1343
- export declare function printGrid<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], titleOrOptions?: string | PrintOptions): Promise<void>;
1746
+ export declare function printGrid<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef<R>[], titleOrOptions?: string | PrintOptions<R>): Promise<void>;
1747
+
1748
+ export declare function printGrid<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], titleOrOptions?: string | PrintOptions<R>): Promise<void>;
1344
1749
 
1345
- export declare interface PrintOptions {
1750
+ export declare interface PrintOptions<R extends GridValidRowModel = GridRowModel> {
1346
1751
  title?: string;
1752
+ /**
1753
+ * Print only these row IDs. A non-empty selection takes precedence over `groupedRows` (the
1754
+ * selected rows are printed flat), and the totals are recomputed over the selected rows.
1755
+ */
1347
1756
  selectedRows?: (string | number)[];
1757
+ /**
1758
+ * The grid's `getRowId`, when it has one: `selectedRows` holds those ids, and the grid does not
1759
+ * copy them onto `row.id` (v3.0+). Defaults to `row.id`.
1760
+ */
1761
+ getRowId?: (row: R) => GridRowId;
1348
1762
  aggregationResult?: Record<string, unknown> | null;
1349
1763
  aggregationModel?: GridAggregationModel | null;
1350
1764
  /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
@@ -1355,8 +1769,10 @@ export declare const roseTheme: GridTheme;
1355
1769
 
1356
1770
  export declare function Row<R extends GridRowModel = GridRowModel>(props: RowProps<R>): JSX.Element;
1357
1771
 
1358
- declare interface RowProps<R extends GridRowModel = GridRowModel> {
1772
+ export declare interface RowProps<R extends GridRowModel = GridRowModel> {
1359
1773
  row: R;
1774
+ /** The row's id (from getRowId). Defaults to `row.id`; the grid always passes it. */
1775
+ rowId?: GridRowId;
1360
1776
  columns: GridColDef<R>[];
1361
1777
  rowIndex: number;
1362
1778
  isSelected?: boolean;
@@ -1373,6 +1789,8 @@ declare interface RowProps<R extends GridRowModel = GridRowModel> {
1373
1789
  onDetailPanelToggle?: (rowId: GridRowId) => void;
1374
1790
  detailPanelContent?: default_2.ReactNode;
1375
1791
  detailPanelHeight?: GridDetailPanelHeight;
1792
+ /** Called with the rendered height of an `'auto'` detail panel whenever it changes. */
1793
+ onDetailPanelHeightChange?: (rowId: GridRowId, height: number) => void;
1376
1794
  pinCheckboxColumn?: boolean;
1377
1795
  pinExpandColumn?: boolean;
1378
1796
  rowReordering?: boolean;
@@ -1392,31 +1810,43 @@ declare interface RowProps<R extends GridRowModel = GridRowModel> {
1392
1810
  field: string;
1393
1811
  value: unknown;
1394
1812
  }) => void;
1813
+ /** `id` / `field` name the cell whose editor asked to stop. */
1395
1814
  onEditStop?: (params?: {
1396
1815
  cancel?: boolean;
1816
+ id?: GridRowId;
1817
+ field?: string;
1397
1818
  }) => void;
1398
1819
  onEditCellValueChange?: (params: {
1399
1820
  id: GridRowId;
1400
1821
  field: string;
1401
1822
  value: unknown;
1402
1823
  }) => void;
1824
+ /** Per-cell editability predicate (`DataGrid.isCellEditable`). */
1825
+ isCellEditable?: (params: GridCellParams<R>) => boolean;
1403
1826
  focusedCellField?: string | null;
1404
1827
  isFocusVisible?: boolean;
1405
1828
  colspanMap?: Map<GridRowId, Record<string, CellColSpanInfo>>;
1406
1829
  rowSpanningCaches?: RowSpanningCaches;
1407
1830
  rowHeight?: number;
1408
1831
  rowMeta?: GridRowMeta;
1832
+ /** Position of each visible data column in render order, for `colIndex` and `aria-colindex`. */
1833
+ columnIndexMap?: Map<string, number>;
1834
+ /** 1-based `aria-rowindex` of this row in the whole grid (header rows included). Defaults to `rowIndex + 2`. */
1835
+ ariaRowIndex?: number;
1409
1836
  }
1410
1837
 
1411
1838
  declare interface RowSpanningCaches {
1839
+ /** Row id → field → number of rows the origin cell spans (only entries > 1). */
1412
1840
  spannedCells: Record<GridRowId, Record<ColumnKey, number>>;
1841
+ /** Row id → field → `true` for cells covered by a row span that starts in a row above. */
1413
1842
  hiddenCells: Record<GridRowId, Record<ColumnKey, boolean>>;
1414
- hiddenCellOriginMap: Record<number, Record<ColumnKey, number>>;
1843
+ /** Row id → field → id of the row whose span covers the hidden cell. */
1844
+ hiddenCellOriginMap: Record<GridRowId, Record<ColumnKey, GridRowId>>;
1415
1845
  }
1416
1846
 
1417
1847
  export declare function Skeleton({ rows, columns }: SkeletonProps): JSX.Element;
1418
1848
 
1419
- declare interface SkeletonProps {
1849
+ export declare interface SkeletonProps {
1420
1850
  rows?: number;
1421
1851
  columns?: number;
1422
1852
  }
@@ -1439,11 +1869,15 @@ export declare interface ToolbarQuickFilterRenderProps {
1439
1869
  onChange: (value: string) => void;
1440
1870
  }
1441
1871
 
1442
- export declare function useAggregation<R extends GridRowModel>(params: UseAggregationParams<R>): UseAggregationReturn;
1872
+ export declare function useAggregation<R extends GridValidRowModel = GridRowModel>(params: UseAggregationParams<R>): UseAggregationReturn;
1443
1873
 
1444
- export declare interface UseAggregationParams<R extends GridRowModel> {
1445
- rows: R[];
1874
+ export declare function useAggregation<R extends GridValidRowModel = GridRowModel>(params: Omit<UseAggregationParams<R>, 'columns'> & {
1446
1875
  columns?: GridColDef[];
1876
+ }): UseAggregationReturn;
1877
+
1878
+ export declare interface UseAggregationParams<R extends GridValidRowModel = GridRowModel> {
1879
+ rows: R[];
1880
+ columns?: GridColDef<R>[];
1447
1881
  aggregationModel: GridAggregationModel;
1448
1882
  isServerSide: boolean;
1449
1883
  dataSource?: GridDataSource<R>;
@@ -1461,12 +1895,25 @@ export declare interface UseAggregationReturn {
1461
1895
  /**
1462
1896
  * Hook to create a ref for the DataGrid API.
1463
1897
  * This ref can be passed to the `apiRef` prop of the `DataGrid` component.
1898
+ *
1899
+ * `apiRef.current` is never null: until the grid mounts it holds an API whose methods are
1900
+ * no-ops (getters return empty values), and the grid swaps in the live API in a layout
1901
+ * effect, so it is available to the parent's layout effects and effects.
1902
+ *
1903
+ * The return type is spelled out so the published declaration is `MutableRefObject<GridApi>`,
1904
+ * which matches `DataGridProps.apiRef` under both @types/react 18 and 19. Left to inference,
1905
+ * React 19's types emit `RefObject<GridApi>`, which React 18's types treat as read-only and
1906
+ * nullable, so `apiRef={useGridApiRef()}` failed to type-check on React 18.
1464
1907
  */
1465
- export declare function useGridApiRef(): RefObject<GridApi>;
1908
+ export declare function useGridApiRef(): MutableRefObject<GridApi>;
1466
1909
 
1467
1910
  export declare function useGridStateStorage(options: UseGridStateStorageOptions | string): UseGridStateStorageReturn;
1468
1911
 
1469
1912
  export declare interface UseGridStateStorageOptions {
1913
+ /**
1914
+ * Storage key. The grid reads `initialState` only when it mounts, so when the key can
1915
+ * change (per user, per view) remount the grid with it: `<DataGrid key={key} … />`.
1916
+ */
1470
1917
  key: string;
1471
1918
  debounceMs?: number;
1472
1919
  include?: (keyof GridState)[];
@@ -1483,13 +1930,15 @@ export declare interface UseGridStateStorageReturn {
1483
1930
  clearState: () => void;
1484
1931
  }
1485
1932
 
1486
- export declare function usePivot(rawRows: GridRowModel[], rawCols: GridColDef[], model: GridPivotModel, enabled: boolean): UsePivotReturn;
1933
+ /**
1934
+ * Headless pivot: turns flat rows into pivot rows (one per row-field combination, then a Grand Total
1935
+ * row) and generated columns (row-label columns, then one value column per column key and value field).
1936
+ * `DataGrid`'s `pivotMode` uses the same engine.
1937
+ */
1938
+ export declare function usePivot<R extends GridValidRowModel = GridRowModel>(rawRows: R[], rawCols: GridColDef<R>[], model: GridPivotModel, enabled: boolean): UsePivotReturn;
1487
1939
 
1488
- export declare interface UsePivotReturn {
1489
- pivotRows: GridRowModel[];
1490
- pivotColumns: GridColDef[];
1491
- colKeys: string[];
1492
- isValid: boolean;
1493
- }
1940
+ export declare function usePivot<R extends GridValidRowModel = GridRowModel>(rawRows: R[], rawCols: GridColDef[], model: GridPivotModel, enabled: boolean): UsePivotReturn;
1941
+
1942
+ export declare type UsePivotReturn = PivotResult;
1494
1943
 
1495
1944
  export { }