@opencorestack/opengridx 3.6.0 → 3.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/dist/ai.cjs +3 -3
- package/dist/ai.cjs.map +1 -1
- package/dist/ai.es.js +3 -3
- package/dist/ai.es.js.map +1 -1
- package/dist/index.d.ts +30 -0
- package/dist/opengridx.css +1 -1
- package/dist/opengridx.es.js +8756 -8244
- package/dist/opengridx.es.js.map +1 -1
- package/dist/opengridx.umd.js +15 -15
- package/dist/opengridx.umd.js.map +1 -1
- package/docs/API_REFERENCE.md +3 -2
- package/docs/architecture/datagrid-orchestration.md +46 -29
- package/docs/architecture/grid-row-meta.md +1 -1
- package/docs/customization/slots-api.md +1 -1
- package/docs/customization/theming.md +43 -0
- package/docs/features/virtualization.md +16 -2
- package/docs/performance.md +3 -1
- package/lib/components/AiAssistant/GridAiAssistantPanel.css +3 -1
- package/lib/components/Cell/Cell.css +4 -2
- package/lib/components/ColumnGroupHeader/ColumnGroupHeader.css +2 -2
- package/lib/components/ColumnVisibilityPanel/ColumnVisibilityPanel.css +3 -1
- package/lib/components/DataGrid/DataGrid.css +9 -12
- package/lib/components/DataGrid/DataGrid.tsx +163 -671
- package/lib/components/DataGrid/GridRoot.tsx +239 -0
- package/lib/components/DataGrid/GridViewport.tsx +314 -0
- package/lib/components/FilterPanel/FilterPanel.css +9 -8
- package/lib/components/Header/ColumnMenu.css +4 -3
- package/lib/components/Header/Header.css +5 -4
- package/lib/components/HeaderFilter/HeaderFilter.css +1 -1
- package/lib/components/ListView/ListView.css +4 -4
- package/lib/components/Pagination/Pagination.css +1 -1
- package/lib/components/Row/Row.css +2 -2
- package/lib/components/Toolbar/GridToolbar.css +8 -7
- package/lib/components/Toolbar/PivotPanel.css +3 -3
- package/lib/hooks/core/useGridDevWarnings.ts +3 -1
- package/lib/hooks/core/useGridEditPipeline.ts +55 -0
- package/lib/hooks/core/useGridRangeEditing.ts +129 -0
- package/lib/hooks/core/useGridRenderWindow.ts +66 -0
- package/lib/hooks/core/useGridScrollViewport.ts +42 -0
- package/lib/hooks/core/useGridSelectionAndStateApi.ts +61 -0
- package/lib/hooks/core/useGridToolbarStack.ts +49 -0
- package/lib/hooks/core/useGridViewApis.ts +46 -0
- package/lib/hooks/core/useLayout.ts +34 -24
- package/lib/styles/base/reset.css +5 -3
- package/lib/styles/base/variables.css +12 -0
- package/lib/theme/DataGridThemeProvider.tsx +15 -0
- package/lib/theme/__baseline__/default-theme.darwin.chromium.json +1503 -0
- package/lib/theme/__baseline__/default-theme.darwin.firefox.json +1503 -0
- package/lib/theme/__baseline__/default-theme.darwin.webkit.json +1503 -0
- package/lib/theme/types.ts +31 -0
- package/lib/types/ai.ts +109 -0
- package/lib/types/api.ts +169 -0
- package/lib/types/columns.ts +341 -0
- package/lib/types/dataSource.ts +40 -0
- package/lib/types/editing.ts +77 -0
- package/lib/types/export.ts +164 -0
- package/lib/types/filtering.ts +52 -0
- package/lib/types/grouping.ts +27 -0
- package/lib/types/index.ts +18 -1702
- package/lib/types/locale.ts +51 -0
- package/lib/types/props.ts +405 -0
- package/lib/types/rows.ts +132 -0
- package/lib/types/selection.ts +66 -0
- package/lib/types/slots.ts +56 -0
- package/lib/types/sorting.ts +25 -0
- package/lib/types/state.ts +35 -0
- package/lib/utils/export/exportShared.ts +22 -4
- package/lib/utils/export/index.ts +8 -4
- package/lib/utils/filtering/index.ts +8 -2
- package/lib/utils/parsing.ts +24 -1
- package/lib/utils/values.ts +31 -0
- package/llms.txt +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { GridFilterOperator } from './filtering';
|
|
2
|
+
|
|
3
|
+
/** Overrideable user-visible strings for internationalisation. All fields are optional; defaults match the built-in English strings. */
|
|
4
|
+
export interface GridLocaleText {
|
|
5
|
+
/** Label before the rows-per-page select. Default: `"Rows per page:"` */
|
|
6
|
+
paginationRowsPerPage?: string;
|
|
7
|
+
/** Range label. Receives (from, to, count). Default: `` (f, t, c) => `${f}–${t} of ${c}` `` */
|
|
8
|
+
paginationOf?: (from: number, to: number, count: number) => string;
|
|
9
|
+
/** Page counter label. Receives (page, pageCount). Default: `` (p, pc) => `Page ${p} of ${pc}` `` */
|
|
10
|
+
paginationPage?: (page: number, pageCount: number) => string;
|
|
11
|
+
/** Empty-state label. When set, overrides the `noRowsLabel` prop on DataGrid. Default: `"No Data"` */
|
|
12
|
+
noRowsLabel?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Screen-reader announcement after the cell range changes (`cellSelection`). Receives (cells, rows,
|
|
15
|
+
* columns). Default: `` (c, r, col) => `${c} cells selected, ${r} rows by ${col} columns` `` (singular for 1).
|
|
16
|
+
* @since v3.3
|
|
17
|
+
*/
|
|
18
|
+
cellSelectionAnnouncement?: (cellCount: number, rowCount: number, columnCount: number) => string;
|
|
19
|
+
/** Label of the toolbar button that opens the `aiAssistant` panel. Default: `"Ask AI"` @since v3.5 */
|
|
20
|
+
aiAssistantButton?: string;
|
|
21
|
+
/** Header filter cell whose column has a filter the row cannot edit. Default: `"Custom filter"` @since v3.6 */
|
|
22
|
+
headerFilterCustom?: string;
|
|
23
|
+
/** Tooltip of the "Custom filter" cell. Default: `"Set in the filter panel"` @since v3.6 */
|
|
24
|
+
headerFilterCustomTooltip?: string;
|
|
25
|
+
/** `aria-label` of a header filter cell. Receives the column header. Default: `` (h) => `Filter ${h}` `` @since v3.6 */
|
|
26
|
+
headerFilterCellLabel?: (header: string) => string;
|
|
27
|
+
/** `aria-label` of the value input or select. Default: `` (h) => `Filter value for ${h}` `` @since v3.6 */
|
|
28
|
+
headerFilterValueLabel?: (header: string) => string;
|
|
29
|
+
/**
|
|
30
|
+
* `aria-label` of the operator button. Receives the header and the operator's label.
|
|
31
|
+
* Default: `` (h, op) => `Filter operator for ${h}: ${op}` `` @since v3.6
|
|
32
|
+
*/
|
|
33
|
+
headerFilterOperatorButtonLabel?: (header: string, operatorLabel: string) => string;
|
|
34
|
+
/** `aria-label` of the operator menu. Default: `` (h) => `Filter operator for ${h}` `` @since v3.6 */
|
|
35
|
+
headerFilterOperatorMenuLabel?: (header: string) => string;
|
|
36
|
+
/** `aria-label` of the clear button. Default: `` (h) => `Clear filter for ${h}` `` @since v3.6 */
|
|
37
|
+
headerFilterClearLabel?: (header: string) => string;
|
|
38
|
+
/** Tooltip of the clear button. Default: `"Clear"` @since v3.6 */
|
|
39
|
+
headerFilterClearTooltip?: string;
|
|
40
|
+
/** Empty choice of the boolean and single-select filters. Default: `"Any"` @since v3.6 */
|
|
41
|
+
headerFilterAny?: string;
|
|
42
|
+
/** "true" choice of the boolean filter. Default: `"Yes"` @since v3.6 */
|
|
43
|
+
headerFilterTrue?: string;
|
|
44
|
+
/** "false" choice of the boolean filter. Default: `"No"` @since v3.6 */
|
|
45
|
+
headerFilterFalse?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Operator names in the header filter menu, tooltips and no-value cells ("Is empty"). Missing
|
|
48
|
+
* operators keep their English name. @since v3.6
|
|
49
|
+
*/
|
|
50
|
+
headerFilterOperators?: Partial<Record<GridFilterOperator, string>>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import type { GridToolbarProps } from '../components/Toolbar/GridToolbar';
|
|
2
|
+
import type { GridRowId, GridRowModel, GridValidRowModel, GridTreeNode, GridRowPinning, GridRowOrderChangeParams, GridRowScrollEndParams, GridRowParams, GridDetailPanelParams, GridDetailPanelHeight } from './rows';
|
|
3
|
+
import type { GridColDef, GridListViewColDef, GridColumnGroupingModel, GridColumnVisibilityModel, GridColumnPinning, GridColumnOrderChangeParams, GridColumnOrder, GridCellParams } from './columns';
|
|
4
|
+
import type { GridSortItem } from './sorting';
|
|
5
|
+
import type { GridFilterModel } from './filtering';
|
|
6
|
+
import type { GridFillResult, GridClipboardPasteResult, GridBeforeClipboardPasteParams, GridHistoryChangeParams, GridUndoRedoOptions } from './editing';
|
|
7
|
+
import type { GridDataSource, GridPaginationModel } from './dataSource';
|
|
8
|
+
import type { GridRowSelectionModel, GridCellSelectionModel, GridCellSelectionChangeDetails, GridCellSelectionStatsSlotProps } from './selection';
|
|
9
|
+
import type { GridRowGroupingModel, GridAggregationModel, GridPivotModel } from './grouping';
|
|
10
|
+
import type { GridLocaleText } from './locale';
|
|
11
|
+
import type { GridToolbarSlotProps, GridPaginationSlotProps, GridOverlaySlotProps, GridFooterSlotProps } from './slots';
|
|
12
|
+
import type { GridApi } from './api';
|
|
13
|
+
import type { GridAiPromptResult, GridAiAssistantOptions, GridAiAssistantPanelProps } from './ai';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Main properties for the DataGrid component.
|
|
17
|
+
*/
|
|
18
|
+
export interface DataGridProps<R extends GridValidRowModel = GridRowModel> {
|
|
19
|
+
/** The dataset to display in the grid. */
|
|
20
|
+
rows: R[];
|
|
21
|
+
/** Column definitions governing how data is displayed and interacted with. */
|
|
22
|
+
columns: GridColDef<R>[];
|
|
23
|
+
|
|
24
|
+
/** Function to extract a unique ID from a row object. Defaults to `row.id`. */
|
|
25
|
+
getRowId?: (row: R) => GridRowId;
|
|
26
|
+
|
|
27
|
+
/** Height of each row in pixels. Defaults to 52. */
|
|
28
|
+
rowHeight?: number;
|
|
29
|
+
/** Height of the header row in pixels. Defaults to 56. */
|
|
30
|
+
headerHeight?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Wraps header titles onto several lines instead of cutting them with an ellipsis. The header
|
|
33
|
+
* keeps `headerHeight` (2 lines at the default 56px, 3 at 72px, 4 at 88px); a title that still
|
|
34
|
+
* does not fit ends in an ellipsis. `GridColDef.wrapHeaderText` overrides it per column.
|
|
35
|
+
* Defaults to `false`.
|
|
36
|
+
*/
|
|
37
|
+
wrapHeaderText?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Adds a filter row under the column headers: one control per column (text, number, date, a Yes / No
|
|
40
|
+
* select for booleans, the `valueOptions` for singleSelect) with an operator menu and a clear button.
|
|
41
|
+
* It reads and writes `filterModel`: each cell owns the root-level item with `id: 'header:<field>'`,
|
|
42
|
+
* so the filter panel, quick filter and `filterMode="server"` keep working. A model the row cannot
|
|
43
|
+
* show (root `logicOperator: 'or'`, other conditions on the column, nested groups) is shown as
|
|
44
|
+
* "Custom filter" and left untouched. See `docs/features/header-filters.md`. Defaults to `false`.
|
|
45
|
+
* @since v3.5
|
|
46
|
+
*/
|
|
47
|
+
headerFilters?: boolean;
|
|
48
|
+
/** Height of the header filter row (`headerFilters`) in pixels. Defaults to 40. @since v3.5 */
|
|
49
|
+
headerFilterHeight?: number;
|
|
50
|
+
/** If true, the grid height will adjust to match the total height of its rows. */
|
|
51
|
+
autoHeight?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Minimum number of rows to render outside the visible viewport (overscan buffer).
|
|
54
|
+
* The grid adapts this value upward automatically based on scroll velocity to prevent
|
|
55
|
+
* blank flashes during fast scrolling. This prop sets the floor — the buffer never
|
|
56
|
+
* drops below this value regardless of scroll speed. Defaults to `3`.
|
|
57
|
+
*/
|
|
58
|
+
overscanRowCount?: number;
|
|
59
|
+
|
|
60
|
+
/** Sorting mode: 'client' (default) or 'server'. */
|
|
61
|
+
sortingMode?: 'client' | 'server';
|
|
62
|
+
/** The current sorting model. */
|
|
63
|
+
sortModel?: GridSortItem[];
|
|
64
|
+
/** Callback fired when the sorting model changes. */
|
|
65
|
+
onSortModelChange?: (model: GridSortItem[]) => void;
|
|
66
|
+
/**
|
|
67
|
+
* When true, clicking any sortable column header appends/cycles that column in the
|
|
68
|
+
* sort model instead of replacing it — no Shift key required. Plain click still
|
|
69
|
+
* cycles asc → desc → removed for that column while all other active sort keys stay.
|
|
70
|
+
* Shift+click continues to work regardless of this prop.
|
|
71
|
+
*/
|
|
72
|
+
multiSort?: boolean;
|
|
73
|
+
|
|
74
|
+
/** Filtering mode: 'client' (default) or 'server'. */
|
|
75
|
+
filterMode?: 'client' | 'server';
|
|
76
|
+
/** The current filter model. */
|
|
77
|
+
filterModel?: GridFilterModel;
|
|
78
|
+
/** Callback fired when the filter model changes. */
|
|
79
|
+
onFilterModelChange?: (model: GridFilterModel) => void;
|
|
80
|
+
|
|
81
|
+
/** If true, pagination UI and logic are enabled. */
|
|
82
|
+
pagination?: boolean;
|
|
83
|
+
/** Pagination mode: 'client' (default), 'server', or 'infinite'. */
|
|
84
|
+
paginationMode?: 'client' | 'server' | 'infinite';
|
|
85
|
+
/** The current pagination state (page and pageSize). */
|
|
86
|
+
paginationModel?: GridPaginationModel;
|
|
87
|
+
/** Callback fired when the pagination model changes. */
|
|
88
|
+
onPaginationModelChange?: (model: GridPaginationModel) => void;
|
|
89
|
+
/** Array of available page sizes (e.g., [10, 25, 50]). */
|
|
90
|
+
pageSizeOptions?: number[];
|
|
91
|
+
/** Total number of rows (required for server-side pagination). */
|
|
92
|
+
rowCount?: number;
|
|
93
|
+
|
|
94
|
+
/** Defines which columns are pinned to the sides. */
|
|
95
|
+
pinnedColumns?: GridColumnPinning;
|
|
96
|
+
/** Callback fired when column pinning changes. */
|
|
97
|
+
onPinnedColumnsChange?: (model: GridColumnPinning) => void;
|
|
98
|
+
|
|
99
|
+
/** Controls which columns are visible. */
|
|
100
|
+
columnVisibilityModel?: GridColumnVisibilityModel;
|
|
101
|
+
/** Callback fired when column visibility changes. */
|
|
102
|
+
onColumnVisibilityModelChange?: (model: GridColumnVisibilityModel) => void;
|
|
103
|
+
|
|
104
|
+
/** Defines which rows are pinned to the top or bottom. */
|
|
105
|
+
pinnedRows?: GridRowPinning;
|
|
106
|
+
|
|
107
|
+
/** If true, a column of checkboxes is added for row selection. */
|
|
108
|
+
checkboxSelection?: boolean;
|
|
109
|
+
/** If true, the checkbox column remains visible during horizontal scrolling. */
|
|
110
|
+
pinCheckboxColumn?: boolean;
|
|
111
|
+
/** If true, the expansion column (for Master-Detail) remains visible during horizontal scrolling. */
|
|
112
|
+
pinExpandColumn?: boolean;
|
|
113
|
+
/** The current selection state (array of row IDs). */
|
|
114
|
+
rowSelectionModel?: GridRowSelectionModel;
|
|
115
|
+
/** Callback fired when the selection model changes. */
|
|
116
|
+
onRowSelectionModelChange?: (model: GridRowSelectionModel) => void;
|
|
117
|
+
/** If true, clicking a row won't toggle its selection. */
|
|
118
|
+
disableRowSelectionOnClick?: boolean;
|
|
119
|
+
/** If true, the user can only select a single row at a time. */
|
|
120
|
+
disableMultipleRowSelection?: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* If true, Ctrl/Cmd+C does not copy the selected rows, so the page (or your own handler) owns
|
|
123
|
+
* the shortcut. `apiRef.current.copySelectedRows()` still works. Default: false.
|
|
124
|
+
*/
|
|
125
|
+
disableClipboardCopy?: boolean;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Lets users select a rectangle of cells (drag, Shift+click, Shift+arrows, Ctrl/Cmd+A) and copy it
|
|
129
|
+
* with Ctrl/Cmd+C as tab-separated text. While on, Ctrl/Cmd+C copies the cell range (the focused
|
|
130
|
+
* cell at minimum) instead of the selected rows; `apiRef.copySelectedRows()` still copies rows.
|
|
131
|
+
* Default: false. @since v3.3
|
|
132
|
+
*/
|
|
133
|
+
cellSelection?: boolean;
|
|
134
|
+
/** Controlled cell selection (zero or one range). Needs `cellSelection`. @since v3.3 */
|
|
135
|
+
cellSelectionModel?: GridCellSelectionModel;
|
|
136
|
+
/** Fired when the cell selection changes, with what changed it. @since v3.3 */
|
|
137
|
+
onCellSelectionModelChange?: (model: GridCellSelectionModel, details: GridCellSelectionChangeDetails) => void;
|
|
138
|
+
/**
|
|
139
|
+
* Shows a status bar under the grid with the count of non-empty cells and the sum and average of the
|
|
140
|
+
* numeric cells in the range, while more than one cell is selected. Replaceable through
|
|
141
|
+
* `slots.cellSelectionStats`. Needs `cellSelection`. Default: false. @since v3.3
|
|
142
|
+
*/
|
|
143
|
+
showCellSelectionStats?: boolean;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* With `cellSelection` on, Ctrl/Cmd+V pastes tab-separated text (Excel, Google Sheets) into the
|
|
147
|
+
* editable cells from the range's top-left cell (or the focused cell), through `valueSetter` and
|
|
148
|
+
* `processRowUpdate`. `true` turns the shortcut off; `apiRef.pasteText()` still works. Default: false.
|
|
149
|
+
* @since v3.4
|
|
150
|
+
*/
|
|
151
|
+
disableClipboardPaste?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Fired after every paste with the result (`updated` rows, `failed` rows, `skipped` cells and why)
|
|
154
|
+
* and the pasted text. @since v3.4
|
|
155
|
+
*/
|
|
156
|
+
onClipboardPaste?: (result: GridClipboardPasteResult) => void;
|
|
157
|
+
/**
|
|
158
|
+
* Called before a paste is applied. Return `false` to cancel it, or a string to paste instead of the
|
|
159
|
+
* clipboard text. A throw cancels the paste. @since v3.4
|
|
160
|
+
*/
|
|
161
|
+
onBeforeClipboardPaste?: (params: GridBeforeClipboardPasteParams) => boolean | string;
|
|
162
|
+
/**
|
|
163
|
+
* With `cellSelection` on, Delete / Backspace on a range of more than one cell empties its editable
|
|
164
|
+
* cells (`null`, or `''` in string columns) as one edit. `true` turns that off. Default: false.
|
|
165
|
+
* @since v3.4
|
|
166
|
+
*/
|
|
167
|
+
disableRangeClear?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Undo and redo of cell edits, pastes and range clears: Ctrl/Cmd+Z, Ctrl/Cmd+Shift+Z and Ctrl+Y while
|
|
170
|
+
* focus is in the grid and no editor is open, and `apiRef.undo()` / `redo()`. Undo and redo write
|
|
171
|
+
* through `valueSetter` and `processRowUpdate`, like an edit. `{ limit }` sets how many actions are
|
|
172
|
+
* kept (default 100). Default: false. @since v3.4
|
|
173
|
+
*/
|
|
174
|
+
undoRedo?: boolean | GridUndoRedoOptions;
|
|
175
|
+
/** Fired when what can be undone or redone changes (`undoRedo`). @since v3.4 */
|
|
176
|
+
onHistoryChange?: (params: GridHistoryChangeParams) => void;
|
|
177
|
+
/**
|
|
178
|
+
* With `cellSelection` on, a fill handle sits on the bottom-right corner of the range: dragging it
|
|
179
|
+
* down, up, right or left fills the new cells from the range (a series of numbers or dates with an
|
|
180
|
+
* equal step continues, anything else repeats; Alt at release copies), and Ctrl/Cmd+D / Ctrl/Cmd+R
|
|
181
|
+
* fill down from the range's top row / right from its left column. `true` hides the handle and turns
|
|
182
|
+
* the shortcuts off. Default: false. @since v3.5
|
|
183
|
+
*/
|
|
184
|
+
disableFillHandle?: boolean;
|
|
185
|
+
/** Fired after every fill with the result and its direction. @since v3.5 */
|
|
186
|
+
onFill?: (result: GridFillResult) => void;
|
|
187
|
+
|
|
188
|
+
/** 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. */
|
|
189
|
+
loading?: boolean;
|
|
190
|
+
/** Visual density of the grid. */
|
|
191
|
+
density?: 'compact' | 'standard' | 'comfortable';
|
|
192
|
+
|
|
193
|
+
/** Optional custom CSS class for the grid container. */
|
|
194
|
+
className?: string;
|
|
195
|
+
/** Optional custom inline styles for the grid container. */
|
|
196
|
+
style?: React.CSSProperties;
|
|
197
|
+
/** Total height of the grid container (pixels or percentage). */
|
|
198
|
+
height?: number | string;
|
|
199
|
+
|
|
200
|
+
/** ARIA label for accessibility. */
|
|
201
|
+
ariaLabel?: string;
|
|
202
|
+
/** Message displayed when there are no rows to show. */
|
|
203
|
+
noRowsLabel?: string;
|
|
204
|
+
/** Overrides for user-visible strings (i18n). All fields are optional. */
|
|
205
|
+
localeText?: GridLocaleText;
|
|
206
|
+
|
|
207
|
+
/** Advanced: The starting internal state of the grid. */
|
|
208
|
+
initialState?: import('../state/types').GridInitialState;
|
|
209
|
+
/**
|
|
210
|
+
* Called on mount and whenever the value of the sorting, filter, pagination, columns (widths, order,
|
|
211
|
+
* visibility, pinning) or density state changes. Selection, expansion and editing do not call it.
|
|
212
|
+
*/
|
|
213
|
+
onStateChange?: (state: import('../state/types').GridState) => void;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Callback fired when a row is clicked. Tree-data parent rows are real rows: a click fires this and
|
|
217
|
+
* selects them like any row (the chevron expands them). Synthetic rows (row-grouping group rows,
|
|
218
|
+
* subtotal rows and auto-created tree parents) do not fire it: clicking a group row toggles it.
|
|
219
|
+
*/
|
|
220
|
+
onRowClick?: (params: GridRowParams<R>) => void;
|
|
221
|
+
/**
|
|
222
|
+
* Callback fired when a row is double-clicked. Also fires for group rows; check
|
|
223
|
+
* `apiRef` / `rowMeta` if you only want leaf rows. Not fired when the double-click
|
|
224
|
+
* lands on the checkbox, expand icon, drag handle, or an open cell editor.
|
|
225
|
+
* @since v2.1
|
|
226
|
+
*/
|
|
227
|
+
onRowDoubleClick?: (params: GridRowParams<R>) => void;
|
|
228
|
+
/** Callback fired when a cell is clicked. */
|
|
229
|
+
onCellClick?: (params: GridCellParams<R>) => void;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Renders the detail panel content for a row in Master-Detail mode. Called for data rows only:
|
|
233
|
+
* synthetic group, subtotal and auto-created tree-parent rows have no detail panel.
|
|
234
|
+
*/
|
|
235
|
+
getDetailPanelContent?: (params: GridDetailPanelParams<R>) => React.ReactNode;
|
|
236
|
+
/** Defines the height of the detail panel. Called for data rows only, like `getDetailPanelContent`. */
|
|
237
|
+
getDetailPanelHeight?: (params: GridDetailPanelParams<R>) => GridDetailPanelHeight;
|
|
238
|
+
/** Controlled state for expanded detail panels. */
|
|
239
|
+
detailPanelExpandedRowIds?: Set<GridRowId>;
|
|
240
|
+
/** Callback fired when expanded detail panels change. */
|
|
241
|
+
onDetailPanelExpandedRowIdsChange?: (expandedRowIds: Set<GridRowId>) => void;
|
|
242
|
+
|
|
243
|
+
/** If true, manual column reordering via drag-and-drop is disabled. */
|
|
244
|
+
disableColumnReorder?: boolean;
|
|
245
|
+
/** Controlled horizontal order of column fields. */
|
|
246
|
+
columnOrder?: GridColumnOrder;
|
|
247
|
+
/**
|
|
248
|
+
* Fired when the user moves one column (header drag or Columns panel). `oldIndex` / `targetIndex`
|
|
249
|
+
* are positions in the grid's full column order: every current column, in order.
|
|
250
|
+
*/
|
|
251
|
+
onColumnOrderChange?: (params: GridColumnOrderChangeParams) => void;
|
|
252
|
+
/**
|
|
253
|
+
* Fired with the whole new column order after every change: a header drag, a Columns panel drag
|
|
254
|
+
* and the panel's Reset. The easiest way to keep a controlled `columnOrder` in sync.
|
|
255
|
+
* Not fired for the generated columns of pivot mode.
|
|
256
|
+
*/
|
|
257
|
+
onColumnOrderModelChange?: (columnOrder: GridColumnOrder) => void;
|
|
258
|
+
|
|
259
|
+
/** If true, rows can be reordered via drag-and-drop. */
|
|
260
|
+
rowReordering?: boolean;
|
|
261
|
+
/** Callback fired when rows are reordered. */
|
|
262
|
+
onRowOrderChange?: (params: GridRowOrderChangeParams<R>) => void;
|
|
263
|
+
|
|
264
|
+
/** If true, enables hierarchical tree data display. */
|
|
265
|
+
treeData?: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* Function to get the path (array of strings) for a row in Tree Data mode. Required with `treeData`:
|
|
268
|
+
* without it the rows are shown flat. Segments may contain any character, including '/'. Keep the
|
|
269
|
+
* function identity stable (module scope or useCallback); a new function rebuilds the tree.
|
|
270
|
+
*/
|
|
271
|
+
getTreeDataPath?: (row: R) => string[];
|
|
272
|
+
/**
|
|
273
|
+
* Adds a dedicated grouping column (pinned left) under row grouping or tree data, configured by these
|
|
274
|
+
* fields. Every key is optional: `field` is always `'__group__'` (a `field` you pass is ignored).
|
|
275
|
+
*/
|
|
276
|
+
groupingColDef?: Partial<GridColDef<R>>;
|
|
277
|
+
/** Initial expansion depth for Tree Data. */
|
|
278
|
+
defaultGroupingExpansionDepth?: number;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* The row grouping model: the fields to group by, outermost first. Passing it controls grouping;
|
|
282
|
+
* without it the grid keeps its own model, which `apiRef.setRowGroupingModel` and the AI assistant change.
|
|
283
|
+
*/
|
|
284
|
+
rowGroupingModel?: GridRowGroupingModel;
|
|
285
|
+
/** Fired when the row grouping model changes (`apiRef.setRowGroupingModel`, the AI assistant). @since v3.5 */
|
|
286
|
+
onRowGroupingModelChange?: (model: GridRowGroupingModel) => void;
|
|
287
|
+
/** Controlled state for data aggregation (e.g., { salary: 'sum' }). */
|
|
288
|
+
aggregationModel?: GridAggregationModel;
|
|
289
|
+
/** Callback fired when aggregation model changes. */
|
|
290
|
+
onAggregationModelChange?: (model: GridAggregationModel) => void;
|
|
291
|
+
/**
|
|
292
|
+
* Advanced: where aggregation results appear. Called for every group node (with its current
|
|
293
|
+
* `isExpanded`) and once with `null` for the grand total. `'inline'` (default for groups) shows them
|
|
294
|
+
* on the group row; `'footer'` on a subtotal row after the group's children while it is expanded
|
|
295
|
+
* (inline while collapsed); `null` hides them. For the grand total, `null` hides the footer row.
|
|
296
|
+
*/
|
|
297
|
+
getAggregationPosition?: (groupNode: GridTreeNode | null) => 'inline' | 'footer' | null;
|
|
298
|
+
|
|
299
|
+
/** If true, switches the grid to multidimensional Pivot Mode. */
|
|
300
|
+
pivotMode?: boolean;
|
|
301
|
+
/** Controlled state for pivot configuration (rows, columns, values). */
|
|
302
|
+
pivotModel?: GridPivotModel;
|
|
303
|
+
/** Callback fired when pivot model changes. */
|
|
304
|
+
onPivotModelChange?: (model: GridPivotModel) => void;
|
|
305
|
+
|
|
306
|
+
/** Predicate to control cell editability on a per-cell basis. */
|
|
307
|
+
isCellEditable?: (params: GridCellParams<R>) => boolean;
|
|
308
|
+
/** Callback to process an updated row after inline editing. Supports promises and validation. */
|
|
309
|
+
processRowUpdate?: (newRow: R, oldRow: R) => R | Promise<R>;
|
|
310
|
+
/** Callback fired if `processRowUpdate` throws or rejects. */
|
|
311
|
+
onProcessRowUpdateError?: (error: unknown) => void;
|
|
312
|
+
|
|
313
|
+
/** Interface for connecting the grid to an external (server-side) data source. */
|
|
314
|
+
dataSource?: GridDataSource<R>;
|
|
315
|
+
/** Callback fired when scrolling reaches the bottom of the grid viewport. */
|
|
316
|
+
onRowsScrollEnd?: (params: GridRowScrollEndParams) => void;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Advanced: reactive reference to the internal API for imperative control. Pass
|
|
320
|
+
* `useGridApiRef<MyRow>()` to have the row getters typed as `MyRow`; a plain `useGridApiRef()` also works.
|
|
321
|
+
*/
|
|
322
|
+
apiRef?: React.MutableRefObject<GridApi<R>> | React.MutableRefObject<GridApi>;
|
|
323
|
+
|
|
324
|
+
/** Custom components to replace internal grid parts. */
|
|
325
|
+
slots?: {
|
|
326
|
+
/**
|
|
327
|
+
* Component rendered as the grid toolbar. Receives `GridToolbarSlotProps` (plus `slotProps.toolbar`),
|
|
328
|
+
* so it can be typed with `GridToolbarProps` or wrap the exported `GridToolbar`.
|
|
329
|
+
*/
|
|
330
|
+
toolbar?: React.ComponentType<GridToolbarSlotProps & Record<string, unknown>>;
|
|
331
|
+
/**
|
|
332
|
+
* Component rendered as the pagination control. Receives `PaginationProps` (plus `slotProps.pagination`),
|
|
333
|
+
* so it can be typed with `PaginationProps` or wrap the exported `Pagination`.
|
|
334
|
+
*/
|
|
335
|
+
pagination?: React.ComponentType<GridPaginationSlotProps & Record<string, unknown>>;
|
|
336
|
+
/** Component rendered when the grid is empty. Receives only `slotProps.noRowsOverlay`. */
|
|
337
|
+
noRowsOverlay?: React.ComponentType<GridOverlaySlotProps>;
|
|
338
|
+
/** Component rendered during loading states. Receives only `slotProps.loadingOverlay`. */
|
|
339
|
+
loadingOverlay?: React.ComponentType<GridOverlaySlotProps>;
|
|
340
|
+
/**
|
|
341
|
+
* Component rendered at the very bottom of the grid, in place of the pagination area.
|
|
342
|
+
* Receives `GridFooterSlotProps` (plus `slotProps.footer`).
|
|
343
|
+
*/
|
|
344
|
+
footer?: React.ComponentType<GridFooterSlotProps & Record<string, unknown>>;
|
|
345
|
+
/**
|
|
346
|
+
* Replaces the status bar of `showCellSelectionStats`. Receives `GridCellSelectionStatsSlotProps`
|
|
347
|
+
* (plus `slotProps.cellSelectionStats`). @since v3.3
|
|
348
|
+
*/
|
|
349
|
+
cellSelectionStats?: React.ComponentType<GridCellSelectionStatsSlotProps & Record<string, unknown>>;
|
|
350
|
+
/** Replaces the `aiAssistant` panel. Receives `GridAiAssistantPanelProps` while the panel is open. @since v3.5 */
|
|
351
|
+
aiAssistantPanel?: React.ComponentType<GridAiAssistantPanelProps & Record<string, unknown>>;
|
|
352
|
+
};
|
|
353
|
+
/** Properties passed directly to custom slots. */
|
|
354
|
+
slotProps?: {
|
|
355
|
+
/**
|
|
356
|
+
* Merged over the props the grid passes to the toolbar. Typed as `GridToolbarProps` (so render props
|
|
357
|
+
* such as `renderQuickFilter` are checked and their parameters inferred), plus any extra keys a custom
|
|
358
|
+
* toolbar reads. `columns` / `baseColumns` are not checked, so typed `GridColDef<R>[]` can be passed.
|
|
359
|
+
*/
|
|
360
|
+
toolbar?: Omit<Partial<GridToolbarProps>, 'columns' | 'baseColumns'> & Record<string, unknown>;
|
|
361
|
+
/** Merged over the `PaginationProps` the grid passes to the pagination slot. */
|
|
362
|
+
pagination?: Partial<GridPaginationSlotProps> & Record<string, unknown>;
|
|
363
|
+
noRowsOverlay?: GridOverlaySlotProps;
|
|
364
|
+
loadingOverlay?: GridOverlaySlotProps;
|
|
365
|
+
/** Merged over the `GridFooterSlotProps` the grid passes to the footer slot. */
|
|
366
|
+
footer?: Partial<GridFooterSlotProps> & Record<string, unknown>;
|
|
367
|
+
/** Merged over the `GridCellSelectionStatsSlotProps` the grid passes to the status bar. */
|
|
368
|
+
cellSelectionStats?: Partial<GridCellSelectionStatsSlotProps> & Record<string, unknown>;
|
|
369
|
+
/** Extra props for `slots.aiAssistantPanel`. */
|
|
370
|
+
aiAssistantPanel?: Record<string, unknown>;
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
/** When true, renders the grid as a single-column list of cards. Perfect for mobile/responsive views. */
|
|
374
|
+
listView?: boolean;
|
|
375
|
+
/** The column definition used in list view. Must supply a `renderCell` function. */
|
|
376
|
+
listViewColumn?: GridListViewColDef<R>;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Defines column groups rendered as spanning header rows above the normal
|
|
380
|
+
* column headers, supporting multiple levels of nesting.
|
|
381
|
+
*/
|
|
382
|
+
columnGroupingModel?: GridColumnGroupingModel;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* The "Ask AI" prompt panel: users describe the view they want and the grid applies the validated
|
|
386
|
+
* reply as one undoable step, shown as removable chips. The built-in toolbar shows an **Ask AI**
|
|
387
|
+
* button; `apiRef.openAiAssistant()` opens it without one. Build `onPrompt` with
|
|
388
|
+
* `createGridAiPromptHandler` from `@opencorestack/opengridx/ai`. @since v3.5
|
|
389
|
+
*/
|
|
390
|
+
aiAssistant?: GridAiAssistantOptions;
|
|
391
|
+
/** Fired after the assistant applied a reply. @since v3.5 */
|
|
392
|
+
onAiAssistantApply?: (result: GridAiPromptResult) => void;
|
|
393
|
+
/** Fired when `onPrompt` fails or returns a result that was not validated. @since v3.5 */
|
|
394
|
+
onAiAssistantError?: (error: unknown) => void;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* `DataGridProps<R>` with untyped `columns` (`GridColDef[]`, i.e. `GridColDef<GridRowModel>[]`). `DataGrid`
|
|
399
|
+
* accepts these props as well as `DataGridProps<R>`, so columns written without a row type work with rows of
|
|
400
|
+
* any type `R`. Their callbacks then see `params.row` as `GridRowModel`; type the columns as
|
|
401
|
+
* `GridColDef<R>[]` to get your row type there.
|
|
402
|
+
* @since v3.0
|
|
403
|
+
*/
|
|
404
|
+
export type DataGridUntypedColumnsProps<R extends GridValidRowModel = GridRowModel> =
|
|
405
|
+
Omit<DataGridProps<R>, 'columns'> & { columns: GridColDef[] };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/** Unique identifier for a row (string or number). */
|
|
2
|
+
export type GridRowId = string | number;
|
|
3
|
+
|
|
4
|
+
/** Base interface for a grid row data object. */
|
|
5
|
+
export interface GridRowModel {
|
|
6
|
+
/** Uniquely identifies the row. */
|
|
7
|
+
id: GridRowId;
|
|
8
|
+
/** Internal: row is a skeleton placeholder during infinite-scroll loading. */
|
|
9
|
+
_isSkeleton?: boolean;
|
|
10
|
+
/** Internal: server-reported child count for lazy-loaded tree nodes. */
|
|
11
|
+
serverChildrenCount?: number;
|
|
12
|
+
/** Any other dynamic row properties. */
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The constraint on the row type `R` of the generic grid types (`DataGridProps<R>`, `GridColDef<R>`,
|
|
18
|
+
* `GridRenderCellParams<R>` …): any object type. Your own interfaces and type aliases can be used as `R`
|
|
19
|
+
* directly; they do not need an index signature or to extend `GridRowModel`. Rows without an `id`
|
|
20
|
+
* field need `getRowId`. `GridRowModel` stays the default `R` (rows with any keys, read as `unknown`).
|
|
21
|
+
* @since v3.0
|
|
22
|
+
*/
|
|
23
|
+
export type GridValidRowModel = object;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Hierarchy metadata for a row. Exposed via `params.rowMeta` in `renderCell`.
|
|
27
|
+
* Not present (`undefined`) for flat rows with no active tree-data or row-grouping.
|
|
28
|
+
*
|
|
29
|
+
* @since v1.1 — replaces the `_hasChildren` / `_treeDepth` / `_groupingField` etc.
|
|
30
|
+
* fields that were injected onto row objects. Since v3.0 those fields are no longer
|
|
31
|
+
* added at runtime: row objects reach `renderCell` exactly as you passed them.
|
|
32
|
+
*/
|
|
33
|
+
export interface GridRowMeta {
|
|
34
|
+
/** The row has children to show: the expand toggle is rendered for it. */
|
|
35
|
+
hasChildren?: boolean;
|
|
36
|
+
treeDepth?: number;
|
|
37
|
+
groupingField?: string;
|
|
38
|
+
groupingValue?: unknown;
|
|
39
|
+
/** The label the grid shows for a synthetic row: the group label, or the path segment of an auto-created tree parent. */
|
|
40
|
+
groupLabel?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Data rows below this row at any depth that pass the active filter (row-grouping leaves, or
|
|
43
|
+
* tree-data rows; auto-created tree parents are not counted). The "(n)" shown next to group labels.
|
|
44
|
+
*/
|
|
45
|
+
descendantCount?: number;
|
|
46
|
+
isExpanded?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* The row is synthetic: a row-grouping group row, a group subtotal row, or a tree-data parent the
|
|
49
|
+
* grid created for a path segment with no row of its own. Synthetic rows are never selected,
|
|
50
|
+
* edited or given a detail panel, and `valueGetter` is not called for them.
|
|
51
|
+
*/
|
|
52
|
+
isGroupRow?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The row is the subtotal row of the group described by `groupingField` / `groupingValue`, shown
|
|
55
|
+
* after the group's children when `getAggregationPosition` returns `'footer'` for it.
|
|
56
|
+
* @since v3.0
|
|
57
|
+
*/
|
|
58
|
+
isGroupFooter?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Represents a row node in the grid's hierarchical tree structure. */
|
|
62
|
+
export interface GridTreeNode {
|
|
63
|
+
/** Unique ID of the row. */
|
|
64
|
+
id: GridRowId;
|
|
65
|
+
/** ID of the parent node, or null if root. */
|
|
66
|
+
parentId: GridRowId | null;
|
|
67
|
+
/** Current depth in the tree (0 for root). */
|
|
68
|
+
depth: number;
|
|
69
|
+
/** The key used for grouping at this level. */
|
|
70
|
+
groupingKey: string;
|
|
71
|
+
|
|
72
|
+
/** The field this node is grouping by. */
|
|
73
|
+
groupingField?: string;
|
|
74
|
+
/** The actual value being grouped. */
|
|
75
|
+
groupingValue?: unknown;
|
|
76
|
+
|
|
77
|
+
/** Computed aggregation results for this group. */
|
|
78
|
+
aggregatedValues?: Record<string, unknown>;
|
|
79
|
+
/** Position of the aggregation row relative to the group. */
|
|
80
|
+
aggregationPosition?: 'inline' | 'footer' | null;
|
|
81
|
+
/** Current expansion state. */
|
|
82
|
+
isExpanded: boolean;
|
|
83
|
+
/** IDs of the direct child nodes. */
|
|
84
|
+
children?: GridRowId[];
|
|
85
|
+
/** Display label for the group. */
|
|
86
|
+
label?: string;
|
|
87
|
+
|
|
88
|
+
/** Row grouping: the number of leaf rows in the group that pass the active filter (recursive). */
|
|
89
|
+
descendantCount?: number;
|
|
90
|
+
|
|
91
|
+
/** Count of children on the server (for lazy loading). */
|
|
92
|
+
serverChildrenCount?: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Configuration for pinning rows to the grid viewport. */
|
|
96
|
+
export interface GridRowPinning {
|
|
97
|
+
/** Row IDs to pin to the top. */
|
|
98
|
+
top?: GridRowId[];
|
|
99
|
+
/** Row IDs to pin to the bottom. */
|
|
100
|
+
bottom?: GridRowId[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface GridRowOrderChangeParams<R extends GridValidRowModel = GridRowModel> {
|
|
104
|
+
row: R;
|
|
105
|
+
oldIndex: number;
|
|
106
|
+
targetIndex: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export interface GridPinnedRows<R extends GridValidRowModel = GridRowModel> {
|
|
110
|
+
top?: R[];
|
|
111
|
+
bottom?: R[];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface GridRowScrollEndParams {
|
|
115
|
+
visibleTop: number;
|
|
116
|
+
visibleBottom: number;
|
|
117
|
+
viewportHeight: number;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface GridRowParams<R extends GridValidRowModel = GridRowModel> {
|
|
121
|
+
row: R;
|
|
122
|
+
id: GridRowId;
|
|
123
|
+
rowIndex: number;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface GridDetailPanelParams<R extends GridValidRowModel = GridRowModel> {
|
|
127
|
+
row: R;
|
|
128
|
+
id: GridRowId;
|
|
129
|
+
rowIndex: number;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export type GridDetailPanelHeight = number | 'auto';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { GridRowId } from './rows';
|
|
2
|
+
import type { GridApi } from './api';
|
|
3
|
+
|
|
4
|
+
export type GridRowSelectionModel = GridRowId[];
|
|
5
|
+
|
|
6
|
+
/** One cell, addressed by its row id and column field. @since v3.3 */
|
|
7
|
+
export interface GridCellCoordinates {
|
|
8
|
+
id: GridRowId;
|
|
9
|
+
field: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A rectangle of cells between two corners. `anchor` is the active cell: it keeps focus, is the cell
|
|
14
|
+
* an edit starts in, and stays put while the range is extended. `head` is the corner that moves with
|
|
15
|
+
* Shift+arrows or the pointer, and the one scrolled into view. A single cell has `anchor` equal to `head`.
|
|
16
|
+
* @since v3.3
|
|
17
|
+
*/
|
|
18
|
+
export interface GridCellRange {
|
|
19
|
+
anchor: GridCellCoordinates;
|
|
20
|
+
head: GridCellCoordinates;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The cell selection: zero or one range in 3.3 (the array form leaves room for several ranges later).
|
|
25
|
+
* Corners are ids and fields, so the rectangle follows its corner rows through sorting and filtering.
|
|
26
|
+
* @since v3.3
|
|
27
|
+
*/
|
|
28
|
+
export type GridCellSelectionModel = readonly GridCellRange[];
|
|
29
|
+
|
|
30
|
+
/** What changed the cell selection. @since v3.3 */
|
|
31
|
+
export type GridCellSelectionReason = 'pointer' | 'keyboard' | 'selectAll' | 'api' | 'clear' | 'dataChange';
|
|
32
|
+
|
|
33
|
+
/** Second argument of `onCellSelectionModelChange`. @since v3.3 */
|
|
34
|
+
export interface GridCellSelectionChangeDetails {
|
|
35
|
+
reason: GridCellSelectionReason;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** One cell of the selected range, as returned by `apiRef.getSelectedCells()`. @since v3.3 */
|
|
39
|
+
export interface GridSelectedCell {
|
|
40
|
+
id: GridRowId;
|
|
41
|
+
field: string;
|
|
42
|
+
/** The cell's value, read through the column's `valueGetter`. */
|
|
43
|
+
value: unknown;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Props the grid passes to `slots.cellSelectionStats` (the status bar of `showCellSelectionStats`),
|
|
48
|
+
* before `slotProps.cellSelectionStats` is merged over them. Rendered only while more than one cell
|
|
49
|
+
* is selected.
|
|
50
|
+
* @since v3.3
|
|
51
|
+
*/
|
|
52
|
+
export interface GridCellSelectionStatsSlotProps {
|
|
53
|
+
apiRef: React.MutableRefObject<GridApi>;
|
|
54
|
+
/** Cells in the rectangle (rows × columns), synthetic rows and span-covered positions included. */
|
|
55
|
+
cellCount: number;
|
|
56
|
+
rowCount: number;
|
|
57
|
+
columnCount: number;
|
|
58
|
+
/** Non-empty cells of data rows. */
|
|
59
|
+
count: number;
|
|
60
|
+
/** Cells holding a number. */
|
|
61
|
+
numericCount: number;
|
|
62
|
+
/** Sum of the numeric cells, or `null` when there are none. */
|
|
63
|
+
sum: number | null;
|
|
64
|
+
/** Average of the numeric cells, or `null` when there are none. */
|
|
65
|
+
average: number | null;
|
|
66
|
+
}
|