@opencorestack/opengridx 2.0.4 → 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 (221) hide show
  1. package/CHANGELOG.md +408 -3
  2. package/README.md +93 -72
  3. package/dist/index.d.ts +611 -121
  4. package/dist/opengridx.css +1 -1
  5. package/dist/opengridx.es.js +7992 -5650
  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 -161
  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 +45 -22
  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 +100 -36
  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 +147 -41
  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 +66 -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 +44 -9
  60. package/docs/features/virtualization.md +64 -15
  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 +16 -10
  65. package/lib/components/Cell/Cell.css +13 -1
  66. package/lib/components/Cell/Cell.tsx +130 -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 +84 -12
  76. package/lib/components/DataGrid/DataGrid.tsx +606 -872
  77. package/lib/components/DataGrid/GridAggregationFooter.tsx +53 -17
  78. package/lib/components/DataGrid/GridEmptyState.tsx +7 -1
  79. package/lib/components/DataGrid/GridErrorOverlay.tsx +15 -12
  80. package/lib/components/DataGrid/GridListView.tsx +166 -23
  81. package/lib/components/DataGrid/GridLiveRegion.tsx +31 -0
  82. package/lib/components/DataGrid/GridLoadingOverlay.tsx +27 -0
  83. package/lib/components/DataGrid/GridPaginationArea.tsx +44 -0
  84. package/lib/components/DataGrid/GridPinnedRows.tsx +65 -11
  85. package/lib/components/DataGrid/GridStandaloneColumnPanel.tsx +40 -38
  86. package/lib/components/DataGrid/GridToolbarSlot.tsx +51 -0
  87. package/lib/components/DataGrid/GridVirtualRows.tsx +48 -25
  88. package/lib/components/DetailPanel/DetailPanel.css +0 -6
  89. package/lib/components/DetailPanel/DetailPanel.tsx +34 -5
  90. package/lib/components/DetailPanel/DetailPanelContent.tsx +17 -0
  91. package/lib/components/FilterPanel/FilterPanel.css +13 -2
  92. package/lib/components/FilterPanel/FilterPanel.tsx +272 -99
  93. package/lib/components/Header/ColumnMenu.tsx +91 -39
  94. package/lib/components/Header/Header.css +3 -3
  95. package/lib/components/Header/Header.tsx +179 -160
  96. package/lib/components/ListView/ListView.css +25 -0
  97. package/lib/components/ListView/ListViewRow.tsx +79 -10
  98. package/lib/components/Pagination/Pagination.tsx +15 -7
  99. package/lib/components/Row/Row.tsx +185 -75
  100. package/lib/components/Toolbar/GlobalSearch.css +6 -3
  101. package/lib/components/Toolbar/GlobalSearch.tsx +26 -27
  102. package/lib/components/Toolbar/GridToolbar.css +12 -11
  103. package/lib/components/Toolbar/GridToolbar.tsx +133 -89
  104. package/lib/components/Toolbar/PivotPanel.tsx +89 -49
  105. package/lib/components/Tooltip/Tooltip.css +20 -0
  106. package/lib/components/Tooltip/Tooltip.tsx +68 -35
  107. package/lib/components/ui/Button.tsx +3 -0
  108. package/lib/components/ui/Checkbox.tsx +2 -1
  109. package/lib/components/ui/ExpandIcon.css +0 -9
  110. package/lib/components/ui/ExpandIcon.tsx +4 -1
  111. package/lib/hooks/core/gridApiPlaceholder.ts +34 -0
  112. package/lib/hooks/core/gridToolbarHostContext.ts +14 -0
  113. package/lib/hooks/core/useDataGrid.ts +115 -173
  114. package/lib/hooks/core/useGridAggregationApi.ts +72 -0
  115. package/lib/hooks/core/useGridApiMethods.ts +115 -0
  116. package/lib/hooks/core/useGridApiRef.ts +15 -3
  117. package/lib/hooks/core/useGridApiRefBinding.ts +18 -0
  118. package/lib/hooks/core/useGridAriaRows.ts +38 -0
  119. package/lib/hooks/core/useGridClipboardApi.ts +38 -0
  120. package/lib/hooks/core/useGridColumnLookup.ts +30 -0
  121. package/lib/hooks/core/useGridColumns.tsx +284 -76
  122. package/lib/hooks/core/useGridColumnsPanel.ts +77 -0
  123. package/lib/hooks/core/useGridControlledState.ts +99 -6
  124. package/lib/hooks/core/useGridDetailPanel.ts +51 -0
  125. package/lib/hooks/core/useGridDevWarnings.ts +123 -0
  126. package/lib/hooks/core/useGridFocusHandlers.ts +50 -0
  127. package/lib/hooks/core/useGridGroupingColumn.ts +62 -0
  128. package/lib/hooks/core/useGridHeaderHandlers.ts +92 -0
  129. package/lib/hooks/core/useGridHierarchy.ts +81 -0
  130. package/lib/hooks/core/useGridKeyboardNavigation.ts +452 -250
  131. package/lib/hooks/core/useGridLiveRowSelection.ts +67 -0
  132. package/lib/hooks/core/useGridPageCorrection.ts +55 -0
  133. package/lib/hooks/core/useGridRowIdOf.ts +32 -0
  134. package/lib/hooks/core/useGridRowInteractions.ts +81 -0
  135. package/lib/hooks/core/useGridRowPipeline.ts +69 -39
  136. package/lib/hooks/core/useGridRowSelection.ts +91 -0
  137. package/lib/hooks/core/useGridScrollSync.ts +80 -32
  138. package/lib/hooks/core/useGridScrollToIndexesApi.ts +45 -0
  139. package/lib/hooks/core/useGridStateSnapshot.ts +40 -5
  140. package/lib/hooks/core/useGridThemeDimensions.ts +49 -0
  141. package/lib/hooks/core/useGridToolbarProps.ts +97 -0
  142. package/lib/hooks/core/useGridViewport.ts +38 -0
  143. package/lib/hooks/core/useGridViewportSize.ts +26 -0
  144. package/lib/hooks/core/useGridVisibleRows.ts +20 -7
  145. package/lib/hooks/core/useLayout.ts +215 -195
  146. package/lib/hooks/core/useRowsScrollEndLatch.ts +41 -0
  147. package/lib/hooks/core/useStableColumns.ts +34 -0
  148. package/lib/hooks/features/useAggregation.ts +86 -90
  149. package/lib/hooks/features/useColumnGroupReorderGuard.ts +34 -0
  150. package/lib/hooks/features/useDetailPanelHeights.ts +29 -0
  151. package/lib/hooks/features/useGridClipboard.ts +133 -73
  152. package/lib/hooks/features/useGridDataSource.ts +354 -128
  153. package/lib/hooks/features/useGridEditing.ts +211 -51
  154. package/lib/hooks/features/useGridPivot.ts +92 -0
  155. package/lib/hooks/features/useGridSpanRenderWindow.ts +104 -0
  156. package/lib/hooks/features/useGridSpanning.ts +410 -306
  157. package/lib/hooks/features/usePivot.ts +0 -0
  158. package/lib/hooks/features/useServerTreeChildren.ts +50 -0
  159. package/lib/hooks/useColumnReorder.ts +38 -44
  160. package/lib/hooks/useRowGrouping.ts +335 -214
  161. package/lib/hooks/useRowReorder.ts +62 -31
  162. package/lib/hooks/useTreeData.ts +330 -262
  163. package/lib/index.ts +30 -2
  164. package/lib/state/index.ts +1 -0
  165. package/lib/state/types.ts +7 -1
  166. package/lib/state/useGridStateStorage.ts +88 -29
  167. package/lib/theme/DataGridThemeProvider.tsx +143 -38
  168. package/lib/theme/gridThemeContext.ts +5 -0
  169. package/lib/theme/index.ts +5 -0
  170. package/lib/theme/presets.ts +5 -4
  171. package/lib/theme/types.ts +40 -2
  172. package/lib/types/index.ts +311 -108
  173. package/lib/utils/aggregation/index.ts +157 -0
  174. package/lib/utils/aria/index.ts +40 -0
  175. package/lib/utils/columnGroups.ts +110 -0
  176. package/lib/utils/columnLookup.ts +33 -0
  177. package/lib/utils/columnWidth.ts +22 -0
  178. package/lib/utils/dataSource/index.ts +46 -0
  179. package/lib/utils/detailPanel.ts +66 -0
  180. package/lib/utils/dragData.ts +44 -0
  181. package/lib/utils/editing/index.ts +30 -0
  182. package/lib/utils/export/exportShared.ts +197 -0
  183. package/lib/utils/export/exportToExcelAdvanced.ts +344 -121
  184. package/lib/utils/export/exportToPdf.ts +143 -92
  185. package/lib/utils/export/groupLabel.ts +14 -0
  186. package/lib/utils/export/index.ts +278 -272
  187. package/lib/utils/export/pdfText.ts +50 -0
  188. package/lib/utils/filtering/index.ts +277 -148
  189. package/lib/utils/focus/index.ts +115 -0
  190. package/lib/utils/gridApiRows.ts +35 -0
  191. package/lib/utils/gridModes.ts +77 -0
  192. package/lib/utils/grouping/groupedExportRows.ts +91 -0
  193. package/lib/utils/pagination/index.ts +56 -0
  194. package/lib/utils/pinning/index.ts +77 -33
  195. package/lib/utils/pivot/index.ts +368 -0
  196. package/lib/utils/scroll/index.ts +78 -0
  197. package/lib/utils/scroll/scrollEnd.ts +18 -0
  198. package/lib/utils/sorting/index.ts +154 -30
  199. package/lib/utils/syntheticRows.ts +12 -0
  200. package/lib/utils/values.ts +206 -0
  201. package/lib/utils/viewport.ts +14 -0
  202. package/llms.txt +272 -166
  203. package/package.json +18 -6
  204. package/lib/components/ColumnGroupHeader/ColumnGroupHeader.tsx +0 -220
  205. package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.test.tsx +0 -85
  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/Header/Header.test.tsx +0 -135
  210. package/lib/components/Pagination/Pagination.test.tsx +0 -64
  211. package/lib/hooks/core/useDataGrid.regression.test.ts +0 -66
  212. package/lib/hooks/core/useGridControlledState.test.ts +0 -86
  213. package/lib/hooks/core/useGridKeyboardNavigation.test.ts +0 -176
  214. package/lib/hooks/core/useGridRowPipeline.test.ts +0 -117
  215. package/lib/hooks/features/useAggregation.test.ts +0 -175
  216. package/lib/hooks/features/usePivot.test.ts +0 -202
  217. package/lib/hooks/useRowGrouping.test.ts +0 -137
  218. package/lib/utils/export/exportToPdf.test.ts +0 -120
  219. package/lib/utils/export/groupedExport.test.ts +0 -144
  220. package/lib/utils/filtering/filtering.test.ts +0 -178
  221. 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,27 +91,69 @@ declare interface CheckboxProps extends Omit<default_2.InputHTMLAttributes<HTMLI
69
91
 
70
92
  declare type ColumnKey = string;
71
93
 
94
+ export declare function ColumnVisibilityPanel<R extends GridValidRowModel = GridRowModel>(props: ColumnVisibilityPanelProps<R>): JSX.Element;
95
+
96
+ export declare interface ColumnVisibilityPanelProps<R extends GridValidRowModel = GridRowModel> {
97
+ columns: GridColDef<R>[];
98
+ visibleColumns: Set<string>;
99
+ onVisibilityChange: (field: string, isVisible: boolean) => void;
100
+ onShowAll: () => void;
101
+ onHideAll: () => void;
102
+ onColumnReorder?: (fromField: string, toField: string) => void;
103
+ onColumnOrderReset?: () => void;
104
+ /** Show columns with `hideable: false` in the panel as disabled rows. Default: false. */
105
+ showNonHideableColumns?: boolean;
106
+ }
107
+
72
108
  export declare const compactTheme: GridTheme;
73
109
 
74
- export declare interface CsvExportOptions {
110
+ export declare interface CsvExportOptions<R extends GridValidRowModel = GridRowModel> {
75
111
  fileName?: string;
76
112
  includeHeaders?: boolean;
77
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
+ */
78
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;
79
124
  aggregationResult?: Record<string, unknown> | null;
80
125
  aggregationModel?: GridAggregationModel | null;
81
126
  /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
82
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;
83
141
  }
84
142
 
85
143
  export declare const darkTheme: GridTheme;
86
144
 
87
- 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;
88
152
 
89
153
  /**
90
154
  * Main properties for the DataGrid component.
91
155
  */
92
- export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
156
+ export declare interface DataGridProps<R extends GridValidRowModel = GridRowModel> {
93
157
  /** The dataset to display in the grid. */
94
158
  rows: R[];
95
159
  /** Column definitions governing how data is displayed and interacted with. */
@@ -164,7 +228,12 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
164
228
  disableRowSelectionOnClick?: boolean;
165
229
  /** If true, the user can only select a single row at a time. */
166
230
  disableMultipleRowSelection?: boolean;
167
- /** 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. */
168
237
  loading?: boolean;
169
238
  /** Visual density of the grid. */
170
239
  density?: 'compact' | 'standard' | 'comfortable';
@@ -182,15 +251,32 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
182
251
  localeText?: GridLocaleText;
183
252
  /** Advanced: The starting internal state of the grid. */
184
253
  initialState?: GridInitialState;
185
- /** 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
+ */
186
258
  onStateChange?: (state: GridState) => void;
187
- /** 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
+ */
188
264
  onRowClick?: (params: GridRowParams<R>) => void;
265
+ /**
266
+ * Callback fired when a row is double-clicked. Also fires for group rows; check
267
+ * `apiRef` / `rowMeta` if you only want leaf rows. Not fired when the double-click
268
+ * lands on the checkbox, expand icon, drag handle, or an open cell editor.
269
+ * @since v2.1
270
+ */
271
+ onRowDoubleClick?: (params: GridRowParams<R>) => void;
189
272
  /** Callback fired when a cell is clicked. */
190
273
  onCellClick?: (params: GridCellParams<R>) => void;
191
- /** 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
+ */
192
278
  getDetailPanelContent?: (params: GridDetailPanelParams<R>) => React.ReactNode;
193
- /** Defines the height of the detail panel. */
279
+ /** Defines the height of the detail panel. Called for data rows only, like `getDetailPanelContent`. */
194
280
  getDetailPanelHeight?: (params: GridDetailPanelParams<R>) => GridDetailPanelHeight;
195
281
  /** Controlled state for expanded detail panels. */
196
282
  detailPanelExpandedRowIds?: Set<GridRowId>;
@@ -200,18 +286,34 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
200
286
  disableColumnReorder?: boolean;
201
287
  /** Controlled horizontal order of column fields. */
202
288
  columnOrder?: GridColumnOrder;
203
- /** 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
+ */
204
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;
205
300
  /** If true, rows can be reordered via drag-and-drop. */
206
301
  rowReordering?: boolean;
207
302
  /** Callback fired when rows are reordered. */
208
303
  onRowOrderChange?: (params: GridRowOrderChangeParams<R>) => void;
209
304
  /** If true, enables hierarchical tree data display. */
210
305
  treeData?: boolean;
211
- /** 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
+ */
212
311
  getTreeDataPath?: (row: R) => string[];
213
- /** Optional override for the grouping column. */
214
- 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>>;
215
317
  /** Initial expansion depth for Tree Data. */
216
318
  defaultGroupingExpansionDepth?: number;
217
319
  /** Controlled state for row grouping. */
@@ -220,7 +322,12 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
220
322
  aggregationModel?: GridAggregationModel;
221
323
  /** Callback fired when aggregation model changes. */
222
324
  onAggregationModelChange?: (model: GridAggregationModel) => void;
223
- /** 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
+ */
224
331
  getAggregationPosition?: (groupNode: GridTreeNode | null) => 'inline' | 'footer' | null;
225
332
  /** If true, switches the grid to multidimensional Pivot Mode. */
226
333
  pivotMode?: boolean;
@@ -242,24 +349,40 @@ export declare interface DataGridProps<R extends GridRowModel = GridRowModel> {
242
349
  apiRef?: React.MutableRefObject<GridApi>;
243
350
  /** Custom components to replace internal grid parts. */
244
351
  slots?: {
245
- /** Component rendered as the grid toolbar. */
246
- toolbar?: React.ComponentType<Record<string, unknown>>;
247
- /** Component rendered as the pagination control. */
248
- pagination?: React.ComponentType<Record<string, unknown>>;
249
- /** Component rendered when the grid is empty. */
250
- noRowsOverlay?: React.ComponentType<Record<string, unknown>>;
251
- /** Component rendered during loading states. */
252
- loadingOverlay?: React.ComponentType<Record<string, unknown>>;
253
- /** Component rendered at the very bottom of the grid. */
254
- 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>>;
255
371
  };
256
372
  /** Properties passed directly to custom slots. */
257
373
  slotProps?: {
258
- toolbar?: Record<string, unknown>;
259
- pagination?: Record<string, unknown>;
260
- noRowsOverlay?: Record<string, unknown>;
261
- loadingOverlay?: Record<string, unknown>;
262
- 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>;
263
386
  };
264
387
  /** When true, renders the grid as a single-column list of cards. Perfect for mobile/responsive views. */
265
388
  listView?: boolean;
@@ -281,9 +404,20 @@ export declare interface DataGridThemeProviderProps {
281
404
  style?: default_2.CSSProperties;
282
405
  }
283
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
+
284
418
  export declare const emeraldTheme: GridTheme;
285
419
 
286
- export declare interface ExcelAdvancedExportOptions {
420
+ export declare interface ExcelAdvancedExportOptions<R extends GridValidRowModel = GridRowModel> {
287
421
  /** Output filename (default: 'export.xlsx') */
288
422
  fileName?: string;
289
423
  /**
@@ -311,8 +445,26 @@ export declare interface ExcelAdvancedExportOptions {
311
445
  aggregationResult?: Record<string, unknown> | null;
312
446
  /** Current aggregation model */
313
447
  aggregationModel?: GridAggregationModel | null;
314
- /** Currently selected row IDs */
448
+ /** Currently selected row IDs, written by `rows: 'selected'` sheets */
315
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;
455
+ /**
456
+ * Grouped row structure, typically from `apiRef.current.getGroupedExportRows()`.
457
+ * When provided, sheets with `rows: 'all'` are written in grouped order: group-header,
458
+ * leaf, group-subtotal and grand-total rows, using Excel row outlining so groups
459
+ * collapse natively. A `grand-total` entry replaces the sheet's `includeSummary` row.
460
+ * Ignored for `rows: 'selected'` sheets.
461
+ * @since v2.1
462
+ */
463
+ groupedRows?: GridGroupedExportRow[];
464
+ /** Fill color for group-header rows in grouped export (default: '#e8eaf6') */
465
+ groupHeaderFillColor?: string;
466
+ /** Fill color for group-subtotal rows in grouped export (default: '#f0f4ff') */
467
+ groupSubtotalFillColor?: string;
316
468
  }
317
469
 
318
470
  export declare interface ExcelColumnStyle {
@@ -323,10 +475,10 @@ export declare interface ExcelColumnStyle {
323
475
  /** Horizontal alignment override */
324
476
  alignment?: 'left' | 'center' | 'right';
325
477
  /**
326
- * If true, the cell value (expected to be an image URL string) will be
327
- * fetched and embedded as an inline image in the cell.
328
- * Requires the image server to serve CORS headers. Falls back to the
329
- * 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).
330
482
  */
331
483
  embedImage?: boolean;
332
484
  /** Width of the embedded image in pixels (default: 40) */
@@ -335,21 +487,45 @@ export declare interface ExcelColumnStyle {
335
487
  imageHeight?: number;
336
488
  }
337
489
 
338
- 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
+ */
339
496
  fileName?: string;
497
+ /** Sheet tab name. Characters Excel rejects are replaced and the name is cut to 31 characters. Default: `'Sheet1'` */
340
498
  sheetName?: string;
341
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
+ */
342
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;
343
510
  aggregationResult?: Record<string, unknown> | null;
344
511
  aggregationModel?: GridAggregationModel | null;
345
512
  /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
346
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;
347
520
  }
348
521
 
349
522
  export declare interface ExcelSheetDefinition {
350
- /** 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
+ */
351
527
  name: string;
352
- /** Which rows to include. Default: 'all' */
528
+ /** Which rows to include. `'selected'` writes only `selectedRows` (none when nothing is selected). Default: 'all' */
353
529
  rows?: 'all' | 'selected';
354
530
  /** Include header row. Default: true */
355
531
  includeHeaders?: boolean;
@@ -363,9 +539,13 @@ export declare interface ExcelSheetDefinition {
363
539
  alternateRowColor?: string | false;
364
540
  }
365
541
 
366
- 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;
543
+
544
+ export declare function exportToCsv<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: CsvExportOptions<R>): void;
367
545
 
368
- export declare function exportToExcel<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: ExcelExportOptions): void;
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;
369
549
 
370
550
  /**
371
551
  * Export the grid data to a real XLSX file using ExcelJS.
@@ -375,29 +555,43 @@ export declare function exportToExcel<R extends GridRowModel>(rows: R[], columns
375
555
  * ExcelJS is loaded lazily so it does not affect bundle size for apps
376
556
  * that only use CSV/JSON export.
377
557
  */
378
- 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>;
379
561
 
380
562
  /**
381
- * 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.
382
565
  */
383
- 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;
567
+
568
+ export declare function exportToJson<R extends GridValidRowModel = GridRowModel>(rows: R[], columns: GridColDef[], options?: JsonExportOptions<R>): void;
384
569
 
385
- export declare function exportToPdf<R extends GridRowModel>(rows: R[], columns: GridColDef<R>[], options?: PdfExportOptions): Promise<void>;
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>;
386
573
 
387
574
  export declare const FilterPanel: default_2.FC<FilterPanelProps>;
388
575
 
389
- declare interface FilterPanelProps {
576
+ export declare interface FilterPanelProps {
390
577
  filterModel: GridFilterModel;
391
578
  columns: GridColDef[];
392
579
  onFilterModelChange: (model: GridFilterModel) => void;
393
580
  }
394
581
 
582
+ /** Default display string for an aggregate: `—` when missing, locale-grouped numbers, avg to 2 decimals. */
395
583
  export declare function formatAggregationValue(value: unknown, fnName: string): string;
396
584
 
397
585
  export declare interface GridAggregationModel {
398
586
  [field: string]: string;
399
587
  }
400
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
+
401
595
  export declare type GridAggregationResult = Record<string, unknown>;
402
596
 
403
597
  export declare type GridAlignment = 'left' | 'center' | 'right';
@@ -471,14 +665,16 @@ export declare interface GridApi {
471
665
  colIndex?: number;
472
666
  }) => void;
473
667
  /**
474
- * Programmatically copies all currently selected rows to the clipboard as TSV.
475
- * Equivalent to the user pressing Ctrl+C / Cmd+C.
476
- * @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.
477
673
  */
478
674
  copySelectedRows: () => Promise<void>;
479
675
  }
480
676
 
481
- export declare interface GridCellParams<R extends GridRowModel = GridRowModel> {
677
+ export declare interface GridCellParams<R extends GridValidRowModel = GridRowModel> {
482
678
  row: R;
483
679
  field: string;
484
680
  value: unknown;
@@ -491,7 +687,7 @@ export declare interface GridCellParams<R extends GridRowModel = GridRowModel> {
491
687
  * Metadata for a single column.
492
688
  * Governs rendering, sorting, filtering, and data transformation.
493
689
  */
494
- export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
690
+ export declare interface GridColDef<R extends GridValidRowModel = GridRowModel> {
495
691
  /** The unique identifier for the column, typically matching a row object key. */
496
692
  field: string;
497
693
  /** Text displayed in the column header. */
@@ -545,25 +741,41 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
545
741
  label: string;
546
742
  }>;
547
743
  /** Function to compute a cell value from raw row data. */
548
- 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;
549
752
  /** Function to format a value into a human-readable string. */
550
- valueFormatter?: (params: GridValueFormatterParams<R>) => string;
753
+ valueFormatter?(params: GridValueFormatterParams<R>): string;
551
754
  /** Custom component or element to render in the cell. */
552
- renderCell?: (params: GridRenderCellParams<R>) => React.ReactNode;
755
+ renderCell?(params: GridRenderCellParams<R>): React.ReactNode;
553
756
  /** Custom component or element to render in the header. */
554
- renderHeader?: (params: GridRenderHeaderParams) => React.ReactNode;
555
- /** Component to render when the cell is in edit mode. */
556
- 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;
557
760
  /** If true, the cell's value can be modified by the user. */
558
761
  editable?: boolean;
559
762
  /** Optional stacking order (CSS z-index). */
560
763
  zIndex?: number;
561
764
  /** If true, the column kebab/hamburger menu is disabled. */
562
765
  disableColumnMenu?: boolean;
563
- /** Number of columns this cell should occupy horizontally. */
564
- colSpan?: number | ((params: GridRenderCellParams<R>) => number);
565
- /** Number of rows this cell should occupy vertically. */
566
- 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>;
567
779
  /**
568
780
  * Custom CSS class applied to every cell in this column.
569
781
  * Can be a static string or a function that receives the cell params and returns a string.
@@ -572,7 +784,7 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
572
784
  * cellClassName: 'my-class'
573
785
  * cellClassName: ({ value }) => value > 100 ? 'cell--high' : 'cell--low'
574
786
  */
575
- cellClassName?: string | ((params: GridRenderCellParams<R>) => string);
787
+ cellClassName?: string | GridColDefCallback<GridRenderCellParams<R>, string>;
576
788
  /**
577
789
  * Custom CSS class applied to the header cell of this column.
578
790
  * @example
@@ -587,6 +799,15 @@ export declare interface GridColDef<R extends GridRowModel = GridRowModel> {
587
799
  exportable?: boolean;
588
800
  }
589
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
+
590
811
  /**
591
812
  * Describes one level of column grouping.
592
813
  * Groups can be nested by placing child GridColumnGroup objects in `children`.
@@ -605,7 +826,7 @@ export declare interface GridColumnGroup {
605
826
  groupId: string;
606
827
  /** Text displayed in the group header cell. */
607
828
  headerName: string;
608
- /** Optional override for the header cell background color. */
829
+ /** CSS class(es) added to this group's header cell(s). */
609
830
  headerClassName?: string;
610
831
  /**
611
832
  * Either an array of column field strings (leaf group)
@@ -616,7 +837,7 @@ export declare interface GridColumnGroup {
616
837
 
617
838
  export declare type GridColumnGroupingModel = GridColumnGroup[];
618
839
 
619
- declare type GridColumnOrder = string[];
840
+ export declare type GridColumnOrder = string[];
620
841
 
621
842
  export declare interface GridColumnOrderChangeParams {
622
843
  column: GridColDef;
@@ -645,7 +866,7 @@ export declare type GridColumnVisibilityModel = Record<string, boolean>;
645
866
  * Interface for providing data to the grid from a remote source.
646
867
  * Enables server-side sorting, filtering, and pagination.
647
868
  */
648
- export declare interface GridDataSource<R extends GridRowModel = GridRowModel> {
869
+ export declare interface GridDataSource<R extends GridValidRowModel = GridRowModel> {
649
870
  /**
650
871
  * Fetches a chunk of rows based on current grid state.
651
872
  * @param params Sorting, filtering, and range parameters.
@@ -657,7 +878,7 @@ export declare interface GridDataSource<R extends GridRowModel = GridRowModel> {
657
878
  getAggregations?: (params: Omit<GridGetRowsParams, 'startRow' | 'endRow'>) => Promise<Record<string, unknown>>;
658
879
  }
659
880
 
660
- declare interface GridDataSourceState {
881
+ export declare interface GridDataSourceState {
661
882
  loading: boolean;
662
883
  error?: unknown;
663
884
  }
@@ -666,9 +887,9 @@ export declare interface GridDensityState {
666
887
  density: 'compact' | 'standard' | 'comfortable';
667
888
  }
668
889
 
669
- declare type GridDetailPanelHeight = number | 'auto';
890
+ export declare type GridDetailPanelHeight = number | 'auto';
670
891
 
671
- export declare interface GridDetailPanelParams<R extends GridRowModel = GridRowModel> {
892
+ export declare interface GridDetailPanelParams<R extends GridValidRowModel = GridRowModel> {
672
893
  row: R;
673
894
  id: GridRowId;
674
895
  rowIndex: number;
@@ -706,12 +927,34 @@ export declare interface GridFilterModel {
706
927
  quickFilterValues?: string[];
707
928
  }
708
929
 
709
- 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';
710
931
 
711
932
  export declare interface GridFilterState {
712
933
  filterModel: GridFilterModel;
713
934
  }
714
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
+
715
958
  export declare interface GridGetRowsParams {
716
959
  startRow: number;
717
960
  endRow: number;
@@ -721,7 +964,7 @@ export declare interface GridGetRowsParams {
721
964
  aggregationModel?: GridAggregationModel;
722
965
  }
723
966
 
724
- export declare interface GridGetRowsResponse<R extends GridRowModel = GridRowModel> {
967
+ export declare interface GridGetRowsResponse<R extends GridValidRowModel = GridRowModel> {
725
968
  rows: R[];
726
969
  rowCount?: number;
727
970
  aggregationResults?: Record<string, unknown>;
@@ -731,7 +974,7 @@ export declare interface GridGetRowsResponse<R extends GridRowModel = GridRowMod
731
974
  * A single entry in the ordered list returned by `GridApi.getGroupedExportRows()`.
732
975
  * Traverse in array order to reproduce the on-screen grouping structure.
733
976
  */
734
- declare interface GridGroupedExportRow {
977
+ export declare interface GridGroupedExportRow {
735
978
  /** Discriminator: the kind of row this entry represents. */
736
979
  type: 'group-header' | 'leaf' | 'group-subtotal' | 'grand-total';
737
980
  /** Nesting depth (0 = top-level group, 1 = nested group, etc.). */
@@ -740,18 +983,31 @@ declare interface GridGroupedExportRow {
740
983
  groupField?: string;
741
984
  /** The raw grouping value for this level (absent on 'leaf' and 'grand-total'). */
742
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;
743
993
  /** Per-group aggregation results (present on 'group-subtotal' and 'grand-total'). */
744
994
  aggregatedValues?: Record<string, unknown>;
745
995
  /** The original data row (only present when `type === 'leaf'`). */
746
996
  row?: GridRowModel;
747
997
  }
748
998
 
749
- 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
+ }
750
1006
 
751
1007
  /** Column definition used exclusively in List View mode. */
752
- export declare interface GridListViewColDef<R extends GridRowModel = GridRowModel> {
1008
+ export declare interface GridListViewColDef<R extends GridValidRowModel = GridRowModel> {
753
1009
  field: string;
754
- renderCell: (params: GridRenderCellParams<R>) => React.ReactNode;
1010
+ renderCell(params: GridRenderCellParams<R>): React.ReactNode;
755
1011
  }
756
1012
 
757
1013
  /** Overrideable user-visible strings for internationalisation. All fields are optional; defaults match the built-in English strings. */
@@ -766,11 +1022,24 @@ export declare interface GridLocaleText {
766
1022
  noRowsLabel?: string;
767
1023
  }
768
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
+
769
1032
  export declare interface GridPaginationModel {
770
1033
  page: number;
771
1034
  pageSize: number;
772
1035
  }
773
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
+
774
1043
  export declare interface GridPaginationState {
775
1044
  paginationModel: GridPaginationModel;
776
1045
  rowCount?: number;
@@ -793,9 +1062,14 @@ export declare interface GridPivotValueField {
793
1062
  }
794
1063
 
795
1064
  /** Parameters passed to the `renderCell` function. */
796
- export declare interface GridRenderCellParams<R extends GridRowModel = GridRowModel> {
1065
+ export declare interface GridRenderCellParams<R extends GridValidRowModel = GridRowModel> {
797
1066
  /** The current cell value. */
798
1067
  value: unknown;
1068
+ /**
1069
+ * The value after `colDef.valueFormatter` (or `String(value)` when no formatter is set; `''` for null/undefined).
1070
+ * @since v2.1
1071
+ */
1072
+ formattedValue?: string;
799
1073
  /** The row object. */
800
1074
  row: R;
801
1075
  /** The field name and unique ID. */
@@ -813,6 +1087,19 @@ export declare interface GridRenderCellParams<R extends GridRowModel = GridRowMo
813
1087
  rowMeta?: GridRowMeta;
814
1088
  }
815
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
+
816
1103
  export declare interface GridRenderHeaderParams {
817
1104
  field: string;
818
1105
  colDef: GridColDef;
@@ -825,23 +1112,39 @@ export declare type GridRowGroupingModel = string[];
825
1112
  export declare type GridRowId = string | number;
826
1113
 
827
1114
  /**
828
- * Internal hierarchy metadata for a row. Exposed via `params.rowMeta` in `renderCell`.
1115
+ * Hierarchy metadata for a row. Exposed via `params.rowMeta` in `renderCell`.
829
1116
  * Not present (`undefined`) for flat rows with no active tree-data or row-grouping.
830
1117
  *
831
1118
  * @since v1.1 — replaces the `_hasChildren` / `_treeDepth` / `_groupingField` etc.
832
- * properties that were previously (and incorrectly) typed on `GridRowModel`.
833
- * Those underscore fields remain on the row object at runtime in v1.1 for
834
- * backward compatibility; they will be removed from the runtime in v2.0.
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.
835
1121
  */
836
1122
  export declare interface GridRowMeta {
1123
+ /** The row has children to show: the expand toggle is rendered for it. */
837
1124
  hasChildren?: boolean;
838
1125
  treeDepth?: number;
839
1126
  groupingField?: string;
840
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. */
841
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
+ */
842
1134
  descendantCount?: number;
843
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
+ */
844
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;
845
1148
  }
846
1149
 
847
1150
  /** Base interface for a grid row data object. */
@@ -856,13 +1159,13 @@ export declare interface GridRowModel {
856
1159
  [key: string]: unknown;
857
1160
  }
858
1161
 
859
- export declare interface GridRowOrderChangeParams<R extends GridRowModel = GridRowModel> {
1162
+ export declare interface GridRowOrderChangeParams<R extends GridValidRowModel = GridRowModel> {
860
1163
  row: R;
861
1164
  oldIndex: number;
862
1165
  targetIndex: number;
863
1166
  }
864
1167
 
865
- export declare interface GridRowParams<R extends GridRowModel = GridRowModel> {
1168
+ export declare interface GridRowParams<R extends GridValidRowModel = GridRowModel> {
866
1169
  row: R;
867
1170
  id: GridRowId;
868
1171
  rowIndex: number;
@@ -876,7 +1179,7 @@ export declare interface GridRowPinning {
876
1179
  bottom?: GridRowId[];
877
1180
  }
878
1181
 
879
- declare interface GridRowScrollEndParams {
1182
+ export declare interface GridRowScrollEndParams {
880
1183
  visibleTop: number;
881
1184
  visibleBottom: number;
882
1185
  viewportHeight: number;
@@ -884,6 +1187,12 @@ declare interface GridRowScrollEndParams {
884
1187
 
885
1188
  export declare type GridRowSelectionModel = GridRowId[];
886
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
+
887
1196
  export declare type GridSortDirection = 'asc' | 'desc' | null;
888
1197
 
889
1198
  export declare interface GridSortingState {
@@ -910,6 +1219,12 @@ export declare interface GridState {
910
1219
  }
911
1220
 
912
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';
913
1228
  colors?: GridThemeColors;
914
1229
  typography?: GridThemeTypography;
915
1230
  spacing?: GridThemeSpacing;
@@ -947,13 +1262,46 @@ export declare interface GridThemeColors {
947
1262
  warning?: string;
948
1263
  error?: string;
949
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;
950
1289
  }
951
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
+ */
952
1296
  export declare interface GridThemeGrid {
953
1297
  rowHeightCompact?: string;
954
1298
  rowHeightStandard?: string;
955
1299
  rowHeightComfortable?: string;
956
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;
957
1305
  cellPaddingX?: string;
958
1306
  cellPaddingY?: string;
959
1307
  background?: string;
@@ -974,7 +1322,7 @@ export declare interface GridThemeGrid {
974
1322
  checkboxBorder?: string;
975
1323
  }
976
1324
 
977
- declare interface GridThemeOverlays {
1325
+ export declare interface GridThemeOverlays {
978
1326
  background?: string;
979
1327
  text?: string;
980
1328
  border?: string;
@@ -987,7 +1335,7 @@ declare interface GridThemeOverlays {
987
1335
  itemDangerText?: string;
988
1336
  }
989
1337
 
990
- declare interface GridThemeScrollbar {
1338
+ export declare interface GridThemeScrollbar {
991
1339
  thumbColor?: string;
992
1340
  trackColor?: string;
993
1341
  size?: string;
@@ -1000,11 +1348,9 @@ export declare interface GridThemeShadows {
1000
1348
  xl?: string;
1001
1349
  }
1002
1350
 
1003
- declare interface GridThemeSkeleton {
1351
+ export declare interface GridThemeSkeleton {
1004
1352
  baseColor?: string;
1005
1353
  highlightColor?: string;
1006
- darkBaseColor?: string;
1007
- darkHighlightColor?: string;
1008
1354
  }
1009
1355
 
1010
1356
  export declare interface GridThemeSpacing {
@@ -1016,7 +1362,7 @@ export declare interface GridThemeSpacing {
1016
1362
  xxl?: string;
1017
1363
  }
1018
1364
 
1019
- declare interface GridThemeToolbar {
1365
+ export declare interface GridThemeToolbar {
1020
1366
  background?: string;
1021
1367
  text?: string;
1022
1368
  border?: string;
@@ -1112,11 +1458,20 @@ export declare interface GridToolbarProps {
1112
1458
  showNonHideableColumns?: boolean;
1113
1459
  }
1114
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
+
1115
1470
  export declare function GridTooltip({ title, children, placement, enterDelay, leaveDelay }: GridTooltipProps): JSX.Element;
1116
1471
 
1117
- declare interface GridTooltipProps {
1118
- title: React.ReactNode;
1119
- children: React.ReactElement;
1472
+ export declare interface GridTooltipProps {
1473
+ title: default_2.ReactNode;
1474
+ children: default_2.ReactElement;
1120
1475
  placement?: 'top' | 'bottom' | 'left' | 'right';
1121
1476
  enterDelay?: number;
1122
1477
  leaveDelay?: number;
@@ -1146,14 +1501,23 @@ export declare interface GridTreeNode {
1146
1501
  children?: GridRowId[];
1147
1502
  /** Display label for the group. */
1148
1503
  label?: string;
1149
- /** Total count of all descendants (recursive). */
1504
+ /** Row grouping: the number of leaf rows in the group that pass the active filter (recursive). */
1150
1505
  descendantCount?: number;
1151
1506
  /** Count of children on the server (for lazy loading). */
1152
1507
  serverChildrenCount?: number;
1153
1508
  }
1154
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
+
1155
1519
  /** Parameters passed to the `valueFormatter` function. */
1156
- export declare interface GridValueFormatterParams<R extends GridRowModel = GridRowModel> {
1520
+ export declare interface GridValueFormatterParams<R extends GridValidRowModel = GridRowModel> {
1157
1521
  /** The raw value to format. */
1158
1522
  value: unknown;
1159
1523
  /** The row object. */
@@ -1163,7 +1527,7 @@ export declare interface GridValueFormatterParams<R extends GridRowModel = GridR
1163
1527
  }
1164
1528
 
1165
1529
  /** Parameters passed to the `valueGetter` function. */
1166
- export declare interface GridValueGetterParams<R extends GridRowModel = GridRowModel> {
1530
+ export declare interface GridValueGetterParams<R extends GridValidRowModel = GridRowModel> {
1167
1531
  /** The row object. */
1168
1532
  row: R;
1169
1533
  /** The field name. */
@@ -1172,10 +1536,27 @@ export declare interface GridValueGetterParams<R extends GridRowModel = GridRowM
1172
1536
  value: unknown;
1173
1537
  }
1174
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
+
1175
1552
  export declare function Header<R extends GridRowModel = GridRowModel>(props: HeaderProps<R>): JSX.Element;
1176
1553
 
1177
- declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1554
+ export declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1178
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
+ */
1179
1560
  allColumns?: GridColDef<R>[];
1180
1561
  columnGroupingModel?: GridColumnGroupingModel;
1181
1562
  checkboxSelection?: boolean;
@@ -1201,8 +1582,9 @@ declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1201
1582
  onDragOver?: (field: string) => (event: default_2.DragEvent) => void;
1202
1583
  onDragEnd?: () => void;
1203
1584
  onDrop?: (targetField: string) => (event: default_2.DragEvent) => void;
1585
+ /** The grid's focus position; `id: null` means a header cell is focused. */
1204
1586
  focusedCell?: {
1205
- id: string | number;
1587
+ id: string | number | null;
1206
1588
  field: string;
1207
1589
  } | null;
1208
1590
  onHeaderClick?: (field: string) => void;
@@ -1211,32 +1593,57 @@ declare interface HeaderProps<R extends GridRowModel = GridRowModel> {
1211
1593
  onHideColumn?: (field: string) => void;
1212
1594
  onPinColumn?: (field: string, side: 'left' | 'right' | null) => void;
1213
1595
  onManageColumns?: () => void;
1596
+ /** Position of each visible data column in render order, for `colIndex` and `aria-colindex`. */
1597
+ columnIndexMap?: Map<string, number>;
1214
1598
  }
1215
1599
 
1216
1600
  export declare const Input: default_2.FC<InputProps>;
1217
1601
 
1218
- declare interface InputProps extends default_2.InputHTMLAttributes<HTMLInputElement> {
1602
+ export declare interface InputProps extends default_2.InputHTMLAttributes<HTMLInputElement> {
1219
1603
  fullWidth?: boolean;
1220
1604
  error?: boolean;
1221
1605
  startAdornment?: default_2.ReactNode;
1222
1606
  endAdornment?: default_2.ReactNode;
1223
1607
  }
1224
1608
 
1225
- export declare interface JsonExportOptions {
1609
+ export declare interface JsonExportOptions<R extends GridValidRowModel = GridRowModel> {
1226
1610
  fileName?: string;
1227
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
+ */
1228
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;
1229
1622
  aggregationResult?: Record<string, unknown> | null;
1230
1623
  aggregationModel?: GridAggregationModel | null;
1231
1624
  /** When provided, emits a nested grouping tree instead of a flat array. */
1232
1625
  groupedRows?: GridGroupedExportRow[];
1233
1626
  }
1234
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
+
1235
1642
  /**
1236
1643
  * Configuration options for exporting the DataGrid to PDF format.
1237
1644
  * Requires jspdf and jspdf-autotable peer dependencies.
1238
1645
  */
1239
- export declare interface PdfExportOptions {
1646
+ export declare interface PdfExportOptions<R extends GridValidRowModel = GridRowModel> {
1240
1647
  /**
1241
1648
  * Output filename without extension. Default: 'export'
1242
1649
  */
@@ -1256,9 +1663,16 @@ export declare interface PdfExportOptions {
1256
1663
  */
1257
1664
  orientation?: 'portrait' | 'landscape';
1258
1665
  /**
1259
- * 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.
1260
1669
  */
1261
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;
1262
1676
  /**
1263
1677
  * Aggregation result from apiRef.current.getAggregationResult().
1264
1678
  * When provided alongside aggregationModel, appends a footer row.
@@ -1288,23 +1702,63 @@ export declare interface PdfExportOptions {
1288
1702
  * Base font size in points for table body. Default: 9
1289
1703
  */
1290
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
+ };
1291
1723
  /**
1292
1724
  * Pre-built grouped export rows from `apiRef.current.getGroupedExportRows()`.
1293
1725
  * When provided, the PDF table reflects the grouping structure (group headers,
1294
1726
  * leaf rows, per-group subtotals, grand total) instead of a flat row list.
1295
- * 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.
1296
1728
  */
1297
1729
  groupedRows?: GridGroupedExportRow[];
1298
1730
  }
1299
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
+
1300
1743
  /**
1301
1744
  * Open print dialog with formatted table
1302
1745
  */
1303
- 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>;
1304
1749
 
1305
- export declare interface PrintOptions {
1750
+ export declare interface PrintOptions<R extends GridValidRowModel = GridRowModel> {
1306
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
+ */
1307
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;
1308
1762
  aggregationResult?: Record<string, unknown> | null;
1309
1763
  aggregationModel?: GridAggregationModel | null;
1310
1764
  /** When provided, emits group headers, leaf rows, subtotals, and a grand total instead of a flat row list. */
@@ -1315,13 +1769,16 @@ export declare const roseTheme: GridTheme;
1315
1769
 
1316
1770
  export declare function Row<R extends GridRowModel = GridRowModel>(props: RowProps<R>): JSX.Element;
1317
1771
 
1318
- declare interface RowProps<R extends GridRowModel = GridRowModel> {
1772
+ export declare interface RowProps<R extends GridRowModel = GridRowModel> {
1319
1773
  row: R;
1774
+ /** The row's id (from getRowId). Defaults to `row.id`; the grid always passes it. */
1775
+ rowId?: GridRowId;
1320
1776
  columns: GridColDef<R>[];
1321
1777
  rowIndex: number;
1322
1778
  isSelected?: boolean;
1323
1779
  checkboxSelection?: boolean;
1324
1780
  onRowClick?: (params: GridRowParams<R>) => void;
1781
+ onRowDoubleClick?: (params: GridRowParams<R>) => void;
1325
1782
  onCellClick?: (params: GridCellParams<R>) => void;
1326
1783
  onSelectionChange?: (rowId: GridRowId, isSelected: boolean) => void;
1327
1784
  columnWidths?: Record<string, number>;
@@ -1332,6 +1789,8 @@ declare interface RowProps<R extends GridRowModel = GridRowModel> {
1332
1789
  onDetailPanelToggle?: (rowId: GridRowId) => void;
1333
1790
  detailPanelContent?: default_2.ReactNode;
1334
1791
  detailPanelHeight?: GridDetailPanelHeight;
1792
+ /** Called with the rendered height of an `'auto'` detail panel whenever it changes. */
1793
+ onDetailPanelHeightChange?: (rowId: GridRowId, height: number) => void;
1335
1794
  pinCheckboxColumn?: boolean;
1336
1795
  pinExpandColumn?: boolean;
1337
1796
  rowReordering?: boolean;
@@ -1351,31 +1810,43 @@ declare interface RowProps<R extends GridRowModel = GridRowModel> {
1351
1810
  field: string;
1352
1811
  value: unknown;
1353
1812
  }) => void;
1813
+ /** `id` / `field` name the cell whose editor asked to stop. */
1354
1814
  onEditStop?: (params?: {
1355
1815
  cancel?: boolean;
1816
+ id?: GridRowId;
1817
+ field?: string;
1356
1818
  }) => void;
1357
1819
  onEditCellValueChange?: (params: {
1358
1820
  id: GridRowId;
1359
1821
  field: string;
1360
1822
  value: unknown;
1361
1823
  }) => void;
1824
+ /** Per-cell editability predicate (`DataGrid.isCellEditable`). */
1825
+ isCellEditable?: (params: GridCellParams<R>) => boolean;
1362
1826
  focusedCellField?: string | null;
1363
1827
  isFocusVisible?: boolean;
1364
1828
  colspanMap?: Map<GridRowId, Record<string, CellColSpanInfo>>;
1365
1829
  rowSpanningCaches?: RowSpanningCaches;
1366
1830
  rowHeight?: number;
1367
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;
1368
1836
  }
1369
1837
 
1370
1838
  declare interface RowSpanningCaches {
1839
+ /** Row id → field → number of rows the origin cell spans (only entries > 1). */
1371
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. */
1372
1842
  hiddenCells: Record<GridRowId, Record<ColumnKey, boolean>>;
1373
- 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>>;
1374
1845
  }
1375
1846
 
1376
1847
  export declare function Skeleton({ rows, columns }: SkeletonProps): JSX.Element;
1377
1848
 
1378
- declare interface SkeletonProps {
1849
+ export declare interface SkeletonProps {
1379
1850
  rows?: number;
1380
1851
  columns?: number;
1381
1852
  }
@@ -1398,11 +1869,15 @@ export declare interface ToolbarQuickFilterRenderProps {
1398
1869
  onChange: (value: string) => void;
1399
1870
  }
1400
1871
 
1401
- export declare function useAggregation<R extends GridRowModel>(params: UseAggregationParams<R>): UseAggregationReturn;
1872
+ export declare function useAggregation<R extends GridValidRowModel = GridRowModel>(params: UseAggregationParams<R>): UseAggregationReturn;
1402
1873
 
1403
- export declare interface UseAggregationParams<R extends GridRowModel> {
1404
- rows: R[];
1874
+ export declare function useAggregation<R extends GridValidRowModel = GridRowModel>(params: Omit<UseAggregationParams<R>, 'columns'> & {
1405
1875
  columns?: GridColDef[];
1876
+ }): UseAggregationReturn;
1877
+
1878
+ export declare interface UseAggregationParams<R extends GridValidRowModel = GridRowModel> {
1879
+ rows: R[];
1880
+ columns?: GridColDef<R>[];
1406
1881
  aggregationModel: GridAggregationModel;
1407
1882
  isServerSide: boolean;
1408
1883
  dataSource?: GridDataSource<R>;
@@ -1420,12 +1895,25 @@ export declare interface UseAggregationReturn {
1420
1895
  /**
1421
1896
  * Hook to create a ref for the DataGrid API.
1422
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.
1423
1907
  */
1424
- export declare function useGridApiRef(): RefObject<GridApi>;
1908
+ export declare function useGridApiRef(): MutableRefObject<GridApi>;
1425
1909
 
1426
1910
  export declare function useGridStateStorage(options: UseGridStateStorageOptions | string): UseGridStateStorageReturn;
1427
1911
 
1428
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
+ */
1429
1917
  key: string;
1430
1918
  debounceMs?: number;
1431
1919
  include?: (keyof GridState)[];
@@ -1442,13 +1930,15 @@ export declare interface UseGridStateStorageReturn {
1442
1930
  clearState: () => void;
1443
1931
  }
1444
1932
 
1445
- 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;
1446
1939
 
1447
- export declare interface UsePivotReturn {
1448
- pivotRows: GridRowModel[];
1449
- pivotColumns: GridColDef[];
1450
- colKeys: string[];
1451
- isValid: boolean;
1452
- }
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;
1453
1943
 
1454
1944
  export { }