@mui/x-data-grid-premium 8.17.0 → 8.19.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.
- package/CHANGELOG.md +213 -0
- package/DataGridPremium/DataGridPremium.js +14 -7
- package/DataGridPremium/useDataGridPremiumComponent.js +3 -2
- package/components/GridFooterCell.js +1 -1
- package/esm/DataGridPremium/DataGridPremium.js +14 -7
- package/esm/DataGridPremium/useDataGridPremiumComponent.js +4 -3
- package/esm/components/GridFooterCell.js +1 -1
- package/esm/hooks/features/aggregation/createAggregationLookup.js +3 -3
- package/esm/hooks/features/aggregation/useGridAggregation.js +38 -17
- package/esm/hooks/features/aiAssistant/useGridAiAssistant.js +1 -4
- package/esm/hooks/features/chartsIntegration/useGridChartsIntegration.js +1 -0
- package/esm/hooks/features/rows/useGridParamsOverridableMethods.js +14 -4
- package/esm/hooks/utils/useGridApiRef.d.ts +1 -2
- package/esm/index.js +1 -1
- package/hooks/features/aggregation/createAggregationLookup.js +3 -3
- package/hooks/features/aggregation/useGridAggregation.js +37 -16
- package/hooks/features/aiAssistant/useGridAiAssistant.js +1 -4
- package/hooks/features/chartsIntegration/useGridChartsIntegration.js +1 -0
- package/hooks/features/rows/useGridParamsOverridableMethods.js +14 -4
- package/hooks/utils/useGridApiRef.d.ts +1 -2
- package/index.js +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,219 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.19.0
|
|
9
|
+
|
|
10
|
+
_Nov 20, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🔎 Add pan on `wheel` to the charts zoom
|
|
15
|
+
- ⌨️ Allow opt-in to [tab navigation](https://mui.com/x/react-data-grid/accessibility/#tab-navigation) inside the Data Grid.
|
|
16
|
+
- ⚙️ New way of defining [action columns](https://mui.com/x/react-data-grid/column-definition/#ActionsWithModalGrid.tsx) in the Data Grid that makes it easier to keep `columns` prop stable.
|
|
17
|
+
- 🐞 Bugfixes
|
|
18
|
+
- 📚 Documentation improvements
|
|
19
|
+
|
|
20
|
+
Special thanks go out to these community members for their valuable contributions:
|
|
21
|
+
@lauri865, @noobyogi0010, @sai6855
|
|
22
|
+
|
|
23
|
+
The following team members contributed to this release:
|
|
24
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @mj12albert, @noraleonte, @rita-codes, @siriwatknp, @ZeeshanTamboli
|
|
25
|
+
|
|
26
|
+
### Data Grid
|
|
27
|
+
|
|
28
|
+
#### `@mui/x-data-grid@8.19.0`
|
|
29
|
+
|
|
30
|
+
- [DataGrid] Add `tabNavigation` prop to control tab navigation in the grid (#20286) @arminmeh
|
|
31
|
+
- [DataGrid] Allow to focus disabled checkbox cells (#19959) @mj12albert
|
|
32
|
+
- [DataGrid] Alternative actions column definition API (#15041) @cherniavskii
|
|
33
|
+
- [DataGrid] Fix failing tests (#20332) @cherniavskii
|
|
34
|
+
- [DataGrid] Prevent Safari 26 error in the event handler (#20369) @arminmeh
|
|
35
|
+
- [DataGrid] Undeprecate the `autoHeight` prop (#20363) @cherniavskii
|
|
36
|
+
- [DataGrid] Fix print export grid dimensions with dynamic row height and print styles (#19835) @cherniavskii
|
|
37
|
+
|
|
38
|
+
#### `@mui/x-data-grid-pro@8.19.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
39
|
+
|
|
40
|
+
Same changes as in `@mui/x-data-grid@8.19.0`.
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-data-grid-premium@8.19.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
43
|
+
|
|
44
|
+
Same changes as in `@mui/x-data-grid-pro@8.19.0`, plus:
|
|
45
|
+
|
|
46
|
+
- [DataGridPremium] Fix aggregation with sorting (#19892) @lauri865
|
|
47
|
+
- [DataGridPremium] Lock `ExcelJS` version (#20329) @cherniavskii
|
|
48
|
+
|
|
49
|
+
### Date and Time Pickers
|
|
50
|
+
|
|
51
|
+
#### `@mui/x-date-pickers@8.19.0`
|
|
52
|
+
|
|
53
|
+
- [pickers] Do not loose `slotProps.field.slotProps` (#20322) @flaviendelangle
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-date-pickers-pro@8.19.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
56
|
+
|
|
57
|
+
Same changes as in `@mui/x-date-pickers@8.19.0`.
|
|
58
|
+
|
|
59
|
+
### Charts
|
|
60
|
+
|
|
61
|
+
#### `@mui/x-charts@8.19.0`
|
|
62
|
+
|
|
63
|
+
- [charts] Expose `niceDomain` utility (#20250) @bernardobelchior
|
|
64
|
+
- [charts] Fix benchmark regression by downgrading to JSDOM v26 (#20405) @bernardobelchior
|
|
65
|
+
- [charts] Fix Pie Chart keyboard focus highlight (#20358) @JCQuintas
|
|
66
|
+
- [charts] Memoize series selectors (#20326) @JCQuintas
|
|
67
|
+
- [charts] Relax dataset type (#20294) @bernardobelchior
|
|
68
|
+
- [charts] Remove `touch-action: pan-y` when zoom is disabled (#20204) @bernardobelchior
|
|
69
|
+
- [charts] Use `getBBox()` for correct SVG sizes in firefox (#20309) @JCQuintas
|
|
70
|
+
- [charts] Use directly selector from `@mui/x-internals` (#20365) @alexfauquette
|
|
71
|
+
- [charts] Fix unnecessary errors in dev mode (#20380) @JCQuintas
|
|
72
|
+
|
|
73
|
+
#### `@mui/x-charts-pro@8.19.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
74
|
+
|
|
75
|
+
Same changes as in `@mui/x-charts@8.19.0`, plus:
|
|
76
|
+
|
|
77
|
+
- [charts-pro] Add pan on `wheel` to zoom (#19998) @JCQuintas
|
|
78
|
+
- [charts-pro] Fix zoom slider preview having an opaque background in dark mode (#20367) @bernardobelchior
|
|
79
|
+
|
|
80
|
+
#### `@mui/x-charts-premium@8.19.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
81
|
+
|
|
82
|
+
Same changes as in `@mui/x-charts-pro@8.19.0`.
|
|
83
|
+
|
|
84
|
+
### Tree View
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-tree-view@8.19.0`
|
|
87
|
+
|
|
88
|
+
- [tree view] Enable lazy load when children count is not know in tree view (#18680) @noobyogi0010
|
|
89
|
+
- [tree view] Fix unwanted behaviors on the item re-ordering (#20368) @flaviendelangle
|
|
90
|
+
|
|
91
|
+
#### `@mui/x-tree-view-pro@8.19.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
92
|
+
|
|
93
|
+
Same changes as in `@mui/x-tree-view@8.19.0`.
|
|
94
|
+
|
|
95
|
+
### Codemod
|
|
96
|
+
|
|
97
|
+
#### `@mui/x-codemod@8.19.0`
|
|
98
|
+
|
|
99
|
+
Internal changes.
|
|
100
|
+
|
|
101
|
+
### Docs
|
|
102
|
+
|
|
103
|
+
- [docs] Add minimum Typescript version to migration guide (#20320) @siriwatknp
|
|
104
|
+
- [docs] Fix Autosizing documentation (#20348) @siriwatknp
|
|
105
|
+
- [docs] Fix separator opacity in demo (#20293) @sai6855
|
|
106
|
+
- [docs] Replace deprecated `LoadingButton` with `Button` component (#20208) @Janpot
|
|
107
|
+
|
|
108
|
+
### Core
|
|
109
|
+
|
|
110
|
+
- [code-infra] Add new broken links checker (#20120) @Janpot
|
|
111
|
+
- [code-infra] Disable Codspeed pipeline (#20370) @JCQuintas
|
|
112
|
+
- [code-infra] Optimize `checkMaterialVersion` (#20307) @Janpot
|
|
113
|
+
- [code-infra] Use utils from code-infra for changelog and PR creation (#20406) @brijeshb42
|
|
114
|
+
- [docs-infra] Revert `@docsearch/react` (#20313) @Janpot
|
|
115
|
+
|
|
116
|
+
### Miscellaneous
|
|
117
|
+
|
|
118
|
+
- [test] Fix browser tests skipping some projects (#20318) @cherniavskii
|
|
119
|
+
- [test] Update `use-react-version` pnpm script (#20319) @cherniavskii
|
|
120
|
+
|
|
121
|
+
## 8.18.0
|
|
122
|
+
|
|
123
|
+
<!-- generated comparing v8.17.0..master -->
|
|
124
|
+
|
|
125
|
+
_Nov 13, 2025_
|
|
126
|
+
|
|
127
|
+
We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
128
|
+
|
|
129
|
+
- Add `barLabelPlacement` property to customize the bar label position in bar charts, enabling labels to be placed above bars.
|
|
130
|
+
|
|
131
|
+

|
|
132
|
+
|
|
133
|
+
- Add `source` property to the date/time picker lifecycle and event handler context, enabling clearer differentiation between changes initiated by the picker UI and those from direct field input.
|
|
134
|
+
- 🐞 Bugfixes
|
|
135
|
+
- 📚 Documentation improvements
|
|
136
|
+
|
|
137
|
+
Special thanks go out to these community members for their valuable contributions:
|
|
138
|
+
@htollefsen, @sai6855, @Sigdriv
|
|
139
|
+
|
|
140
|
+
The following team members contributed to this release:
|
|
141
|
+
@arminmeh, @bernardobelchior, @brijeshb42, @cherniavskii, @flaviendelangle, @JCQuintas, @michelengelen, @noraleonte, @prakhargupta1, @rita-codes, @siriwatknp
|
|
142
|
+
|
|
143
|
+
### Data Grid
|
|
144
|
+
|
|
145
|
+
#### `@mui/x-data-grid@8.18.0`
|
|
146
|
+
|
|
147
|
+
- [DataGrid] Allow default event in the column action cell item click event handler (#20272) @arminmeh
|
|
148
|
+
- [DataGrid] Remove unnecessary generic from `useGridApiRef` (#20277) @cherniavskii
|
|
149
|
+
|
|
150
|
+
#### `@mui/x-data-grid-pro@8.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
151
|
+
|
|
152
|
+
Same changes as in `@mui/x-data-grid@8.18.0`.
|
|
153
|
+
|
|
154
|
+
#### `@mui/x-data-grid-premium@8.18.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
155
|
+
|
|
156
|
+
Same changes as in `@mui/x-data-grid-pro@8.18.0`, plus:
|
|
157
|
+
|
|
158
|
+
- [DataGridPremium] Return the correct `cellParams` value from the aggregation cells (#20224) @arminmeh
|
|
159
|
+
|
|
160
|
+
### Date and Time Pickers
|
|
161
|
+
|
|
162
|
+
#### `@mui/x-date-pickers@8.18.0`
|
|
163
|
+
|
|
164
|
+
- [pickers] Keep invalid date state consistent (#20040) @michelengelen
|
|
165
|
+
- [pickers] Adds new `source` property to `onChange` and `onAccept` context object (#20234) @michelengelen
|
|
166
|
+
|
|
167
|
+
#### `@mui/x-date-pickers-pro@8.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
168
|
+
|
|
169
|
+
Same changes as in `@mui/x-date-pickers@8.18.0`.
|
|
170
|
+
|
|
171
|
+
### Charts
|
|
172
|
+
|
|
173
|
+
#### `@mui/x-charts@8.18.0`
|
|
174
|
+
|
|
175
|
+
- [charts] Add prop for positioning a bar label (#20194) @Sigdriv
|
|
176
|
+
- [charts] Fix applying dark mode styles in `ChartAxisZoomSliderThumb` (#20232) @sai6855
|
|
177
|
+
|
|
178
|
+
#### `@mui/x-charts-pro@8.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
179
|
+
|
|
180
|
+
Same changes as in `@mui/x-charts@8.18.0`, plus:
|
|
181
|
+
|
|
182
|
+
- [charts-pro] Allow specifying Content Security Policy nonce on export (#20053) @bernardobelchior
|
|
183
|
+
- [charts-pro] Fix applying dark mode styles to slider (#20220) @sai6855
|
|
184
|
+
- [charts-pro] Sankey should respect node order (#20065) @JCQuintas
|
|
185
|
+
|
|
186
|
+
#### `@mui/x-charts-premium@8.18.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
187
|
+
|
|
188
|
+
Same changes as in `@mui/x-charts-pro@8.18.0`.
|
|
189
|
+
|
|
190
|
+
### Tree View
|
|
191
|
+
|
|
192
|
+
#### `@mui/x-tree-view@8.18.0`
|
|
193
|
+
|
|
194
|
+
- [tree view] Prepare tests for the new store structure (#20225) @flaviendelangle
|
|
195
|
+
- [tree view] Prepare the item plugin files for the store migration (#20240) @flaviendelangle
|
|
196
|
+
- [tree view] Use `TreeItemId` type instead of raw string (#20233) @flaviendelangle
|
|
197
|
+
|
|
198
|
+
#### `@mui/x-tree-view-pro@8.18.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
199
|
+
|
|
200
|
+
Same changes as in `@mui/x-tree-view@8.18.0`.
|
|
201
|
+
|
|
202
|
+
### Codemod
|
|
203
|
+
|
|
204
|
+
#### `@mui/x-codemod@8.18.0`
|
|
205
|
+
|
|
206
|
+
Internal changes.
|
|
207
|
+
|
|
208
|
+
### Docs
|
|
209
|
+
|
|
210
|
+
- [charts] Add a demo for a custom tick label (#20073) @prakhargupta1
|
|
211
|
+
- [charts] Create `useAxes()` hook documentation page (#20229) @JCQuintas
|
|
212
|
+
- [charts] Fix logo alignment (#20228) @JCQuintas
|
|
213
|
+
- [charts] Fixes typo in import example (#20236) @htollefsen
|
|
214
|
+
- [Data Grid] Add recipe for cursor pagination with data source (#19700) @siriwatknp
|
|
215
|
+
- [Data Grid] Add a demo for pinned rows aggregation (#20198) @cherniavskii
|
|
216
|
+
|
|
217
|
+
### Core
|
|
218
|
+
|
|
219
|
+
- [docs-infra] Use deployment config from docs-infra package (#20243) @brijeshb42
|
|
220
|
+
|
|
8
221
|
## 8.17.0
|
|
9
222
|
|
|
10
223
|
_Nov 5, 2025_
|
|
@@ -50,7 +50,7 @@ const configuration = {
|
|
|
50
50
|
useGridParamsOverridableMethods: _useGridParamsOverridableMethods.useGridParamsOverridableMethods
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
const releaseInfo = "
|
|
53
|
+
const releaseInfo = "MTc2MzU5NjgwMDAwMA==";
|
|
54
54
|
const watermark = /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
|
|
55
55
|
packageName: "x-data-grid-premium",
|
|
56
56
|
releaseInfo: releaseInfo
|
|
@@ -168,13 +168,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
168
168
|
*/
|
|
169
169
|
'aria-labelledby': _propTypes.default.string,
|
|
170
170
|
/**
|
|
171
|
-
* If `true`, the Data Grid height is dynamic and
|
|
171
|
+
* If `true`, the Data Grid height is dynamic and takes as much space as it needs to display all rows.
|
|
172
|
+
* Use it instead of a flex parent container approach, if:
|
|
173
|
+
* - you don't need to set a minimum or maximum height for the Data Grid
|
|
174
|
+
* - you want to avoid the scrollbar flickering when the content changes
|
|
172
175
|
* @default false
|
|
173
|
-
* @deprecated Use flex parent container instead: https://mui.com/x/react-data-grid/layout/#flex-parent-container
|
|
174
|
-
* @example
|
|
175
|
-
* <div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
176
|
-
* <DataGrid />
|
|
177
|
-
* </div>
|
|
178
176
|
*/
|
|
179
177
|
autoHeight: _propTypes.default.bool,
|
|
180
178
|
/**
|
|
@@ -1331,6 +1329,15 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
1331
1329
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1332
1330
|
*/
|
|
1333
1331
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
1332
|
+
/**
|
|
1333
|
+
* Sets the tab navigation behavior for the Data Grid.
|
|
1334
|
+
* - "none": No Data Grid specific tab navigation. Pressing the tab key will move the focus to the next element in the tab sequence.
|
|
1335
|
+
* - "content": Pressing the tab key will move the focus to the next cell in the same row or the first cell in the next row. Shift+Tab will move the focus to the previous cell in the same row or the last cell in the previous row. Tab navigation is not enabled for the header.
|
|
1336
|
+
* - "header": Pressing the tab key will move the focus to the next column group, column header or header filter. Shift+Tab will move the focus to the previous column group, column header or header filter. Tab navigation is not enabled for the content.
|
|
1337
|
+
* - "all": Combines the "content" and "header" behavior.
|
|
1338
|
+
* @default "none"
|
|
1339
|
+
*/
|
|
1340
|
+
tabNavigation: _propTypes.default.oneOf(['all', 'content', 'header', 'none']),
|
|
1334
1341
|
/**
|
|
1335
1342
|
* If positive, the Data Grid will throttle updates coming from `apiRef.current.updateRows` and `apiRef.current.setRows`.
|
|
1336
1343
|
* It can be useful if you have a high update rate but do not want to do heavy work like filtering / sorting or rendering on each individual update.
|
|
@@ -100,7 +100,6 @@ const useDataGridPremiumComponent = (apiRef, inProps, configuration) => {
|
|
|
100
100
|
(0, _internals.useGridInitializeState)(_internals.listViewStateInitializer, apiRef, props);
|
|
101
101
|
(0, _internals.useGridInitializeState)(_useGridAiAssistant.aiAssistantStateInitializer, apiRef, props);
|
|
102
102
|
(0, _internals.useGridInitializeState)(_useGridChartsIntegration.chartsIntegrationStateInitializer, apiRef, props);
|
|
103
|
-
(0, _internals.useGridVirtualizer)(apiRef, props);
|
|
104
103
|
(0, _useGridSidebar.useGridSidebar)(apiRef, props);
|
|
105
104
|
(0, _useGridPivoting.useGridPivoting)(apiRef, props, inProps.columns, inProps.rows);
|
|
106
105
|
(0, _useGridRowGrouping.useGridRowGrouping)(apiRef, props);
|
|
@@ -129,7 +128,6 @@ const useDataGridPremiumComponent = (apiRef, inProps, configuration) => {
|
|
|
129
128
|
(0, _internals.useGridColumnReorder)(apiRef, props);
|
|
130
129
|
(0, _internals.useGridColumnResize)(apiRef, props);
|
|
131
130
|
(0, _internals.useGridPagination)(apiRef, props);
|
|
132
|
-
(0, _internals.useGridRowsMeta)(apiRef, props);
|
|
133
131
|
(0, _internals.useGridRowReorder)(apiRef, props);
|
|
134
132
|
(0, _internals.useGridScroll)(apiRef, props);
|
|
135
133
|
(0, _internals.useGridInfiniteLoader)(apiRef, props);
|
|
@@ -152,6 +150,9 @@ const useDataGridPremiumComponent = (apiRef, inProps, configuration) => {
|
|
|
152
150
|
(0, _useGridPivoting.useGridPivotingExportState)(apiRef);
|
|
153
151
|
|
|
154
152
|
// Should be the last thing to run, because all pre-processors should have been registered by now.
|
|
153
|
+
(0, _internals.useFirstRender)(() => {
|
|
154
|
+
apiRef.current.runAppliersForPendingProcessors();
|
|
155
|
+
});
|
|
155
156
|
React.useEffect(() => {
|
|
156
157
|
apiRef.current.runAppliersForPendingProcessors();
|
|
157
158
|
});
|
|
@@ -13,7 +13,7 @@ var _styles = require("@mui/material/styles");
|
|
|
13
13
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
14
14
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
const _excluded = ["formattedValue", "colDef", "cellMode", "row", "api", "id", "value", "rowNode", "field", "
|
|
16
|
+
const _excluded = ["formattedValue", "colDef", "cellMode", "row", "api", "id", "value", "rowNode", "field", "hasFocus", "tabIndex", "isEditable"];
|
|
17
17
|
const GridFooterCellRoot = (0, _styles.styled)('div', {
|
|
18
18
|
name: 'MuiDataGrid',
|
|
19
19
|
slot: 'FooterCell'
|
|
@@ -43,7 +43,7 @@ const configuration = {
|
|
|
43
43
|
useGridParamsOverridableMethods
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
const releaseInfo = "
|
|
46
|
+
const releaseInfo = "MTc2MzU5NjgwMDAwMA==";
|
|
47
47
|
const watermark = /*#__PURE__*/_jsx(Watermark, {
|
|
48
48
|
packageName: "x-data-grid-premium",
|
|
49
49
|
releaseInfo: releaseInfo
|
|
@@ -161,13 +161,11 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
161
161
|
*/
|
|
162
162
|
'aria-labelledby': PropTypes.string,
|
|
163
163
|
/**
|
|
164
|
-
* If `true`, the Data Grid height is dynamic and
|
|
164
|
+
* If `true`, the Data Grid height is dynamic and takes as much space as it needs to display all rows.
|
|
165
|
+
* Use it instead of a flex parent container approach, if:
|
|
166
|
+
* - you don't need to set a minimum or maximum height for the Data Grid
|
|
167
|
+
* - you want to avoid the scrollbar flickering when the content changes
|
|
165
168
|
* @default false
|
|
166
|
-
* @deprecated Use flex parent container instead: https://mui.com/x/react-data-grid/layout/#flex-parent-container
|
|
167
|
-
* @example
|
|
168
|
-
* <div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
169
|
-
* <DataGrid />
|
|
170
|
-
* </div>
|
|
171
169
|
*/
|
|
172
170
|
autoHeight: PropTypes.bool,
|
|
173
171
|
/**
|
|
@@ -1324,6 +1322,15 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
1324
1322
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
1325
1323
|
*/
|
|
1326
1324
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
1325
|
+
/**
|
|
1326
|
+
* Sets the tab navigation behavior for the Data Grid.
|
|
1327
|
+
* - "none": No Data Grid specific tab navigation. Pressing the tab key will move the focus to the next element in the tab sequence.
|
|
1328
|
+
* - "content": Pressing the tab key will move the focus to the next cell in the same row or the first cell in the next row. Shift+Tab will move the focus to the previous cell in the same row or the last cell in the previous row. Tab navigation is not enabled for the header.
|
|
1329
|
+
* - "header": Pressing the tab key will move the focus to the next column group, column header or header filter. Shift+Tab will move the focus to the previous column group, column header or header filter. Tab navigation is not enabled for the content.
|
|
1330
|
+
* - "all": Combines the "content" and "header" behavior.
|
|
1331
|
+
* @default "none"
|
|
1332
|
+
*/
|
|
1333
|
+
tabNavigation: PropTypes.oneOf(['all', 'content', 'header', 'none']),
|
|
1327
1334
|
/**
|
|
1328
1335
|
* If positive, the Data Grid will throttle updates coming from `apiRef.current.updateRows` and `apiRef.current.setRows`.
|
|
1329
1336
|
* It can be useful if you have a high update rate but do not want to do heavy work like filtering / sorting or rendering on each individual update.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { useGridInitialization, useGridInitializeState,
|
|
5
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridLazyLoader, useGridLazyLoaderPreProcessors, useGridDataSourceLazyLoader, useGridInfiniteLoadingIntersection, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization, useGridDataSourceTreeDataPreProcessors, dataSourceStateInitializer, useGridRowSpanning, rowSpanningStateInitializer, useGridListView, listViewStateInitializer, propsStateInitializer, rowReorderStateInitializer, useFirstRender } from '@mui/x-data-grid-pro/internals';
|
|
6
6
|
import { useGridSelector } from '@mui/x-data-grid-pro';
|
|
7
7
|
import { useGridDataSourcePremium as useGridDataSource } from "../hooks/features/dataSource/useGridDataSourcePremium.js";
|
|
8
8
|
// Premium-only features
|
|
@@ -92,7 +92,6 @@ export const useDataGridPremiumComponent = (apiRef, inProps, configuration) => {
|
|
|
92
92
|
useGridInitializeState(listViewStateInitializer, apiRef, props);
|
|
93
93
|
useGridInitializeState(aiAssistantStateInitializer, apiRef, props);
|
|
94
94
|
useGridInitializeState(chartsIntegrationStateInitializer, apiRef, props);
|
|
95
|
-
useGridVirtualizer(apiRef, props);
|
|
96
95
|
useGridSidebar(apiRef, props);
|
|
97
96
|
useGridPivoting(apiRef, props, inProps.columns, inProps.rows);
|
|
98
97
|
useGridRowGrouping(apiRef, props);
|
|
@@ -121,7 +120,6 @@ export const useDataGridPremiumComponent = (apiRef, inProps, configuration) => {
|
|
|
121
120
|
useGridColumnReorder(apiRef, props);
|
|
122
121
|
useGridColumnResize(apiRef, props);
|
|
123
122
|
useGridPagination(apiRef, props);
|
|
124
|
-
useGridRowsMeta(apiRef, props);
|
|
125
123
|
useGridRowReorder(apiRef, props);
|
|
126
124
|
useGridScroll(apiRef, props);
|
|
127
125
|
useGridInfiniteLoader(apiRef, props);
|
|
@@ -144,6 +142,9 @@ export const useDataGridPremiumComponent = (apiRef, inProps, configuration) => {
|
|
|
144
142
|
useGridPivotingExportState(apiRef);
|
|
145
143
|
|
|
146
144
|
// Should be the last thing to run, because all pre-processors should have been registered by now.
|
|
145
|
+
useFirstRender(() => {
|
|
146
|
+
apiRef.current.runAppliersForPendingProcessors();
|
|
147
|
+
});
|
|
147
148
|
React.useEffect(() => {
|
|
148
149
|
apiRef.current.runAppliersForPendingProcessors();
|
|
149
150
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["formattedValue", "colDef", "cellMode", "row", "api", "id", "value", "rowNode", "field", "
|
|
3
|
+
const _excluded = ["formattedValue", "colDef", "cellMode", "row", "api", "id", "value", "rowNode", "field", "hasFocus", "tabIndex", "isEditable"];
|
|
4
4
|
import { getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
5
5
|
import { vars } from '@mui/x-data-grid/internals';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
@@ -36,6 +36,9 @@ const getGroupAggregatedValue = (groupId, apiRef, aggregationRowsScope, aggregat
|
|
|
36
36
|
continue;
|
|
37
37
|
}
|
|
38
38
|
const row = rowLookup[rowId];
|
|
39
|
+
if (!row) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
39
42
|
for (let j = 0; j < aggregatedFields.length; j += 1) {
|
|
40
43
|
const aggregatedField = aggregatedFields[j];
|
|
41
44
|
const columnAggregationRules = aggregationRules[aggregatedField];
|
|
@@ -51,9 +54,6 @@ const getGroupAggregatedValue = (groupId, apiRef, aggregationRowsScope, aggregat
|
|
|
51
54
|
// Since we know that pivoted fields are flat, we can use the row directly, and save lots of processing time
|
|
52
55
|
value = row[field];
|
|
53
56
|
} else {
|
|
54
|
-
if (!row) {
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
57
|
const valueGetter = valueGetters[aggregatedField];
|
|
58
58
|
value = valueGetter(row);
|
|
59
59
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { isObjectEmpty } from '@mui/x-internals/isObjectEmpty';
|
|
6
|
-
import { gridColumnLookupSelector, useGridEvent, useGridApiMethod, useRunOncePerLoop, gridRenderContextSelector, gridVisibleColumnFieldsSelector, gridSortModelSelector } from '@mui/x-data-grid-pro';
|
|
6
|
+
import { gridColumnLookupSelector, useGridEvent, useGridApiMethod, useRunOncePerLoop, gridRenderContextSelector, gridVisibleColumnFieldsSelector, gridSortModelSelector, gridRowMaximumTreeDepthSelector } from '@mui/x-data-grid-pro';
|
|
7
7
|
import { useGridRegisterPipeProcessor, gridPivotActiveSelector } from '@mui/x-data-grid-pro/internals';
|
|
8
8
|
import { gridAggregationLookupSelector, gridAggregationModelSelector } from "./gridAggregationSelectors.js";
|
|
9
9
|
import { getAggregationRules, mergeStateWithAggregationModel, areAggregationRulesEqual } from "./gridAggregationUtils.js";
|
|
@@ -38,8 +38,8 @@ export const useGridAggregation = (apiRef, props) => {
|
|
|
38
38
|
}
|
|
39
39
|
}, [apiRef]);
|
|
40
40
|
const abortControllerRef = React.useRef(null);
|
|
41
|
-
const applyAggregation = React.useCallback(
|
|
42
|
-
// Abort previous if
|
|
41
|
+
const applyAggregation = React.useCallback(() => {
|
|
42
|
+
// Abort previous if we're proceeding
|
|
43
43
|
if (abortControllerRef.current) {
|
|
44
44
|
abortControllerRef.current.abort();
|
|
45
45
|
}
|
|
@@ -48,19 +48,17 @@ export const useGridAggregation = (apiRef, props) => {
|
|
|
48
48
|
const aggregationRules = getAggregationRules(gridColumnLookupSelector(apiRef), gridAggregationModelSelector(apiRef), props.aggregationFunctions, !!props.dataSource);
|
|
49
49
|
const aggregatedFields = Object.keys(aggregationRules);
|
|
50
50
|
const currentAggregationLookup = gridAggregationLookupSelector(apiRef);
|
|
51
|
-
const needsSorting = shouldApplySorting(aggregationRules, aggregatedFields);
|
|
52
|
-
if (reason === 'sort' && !needsSorting) {
|
|
53
|
-
// no need to re-apply aggregation on `sortedRowsSet` if sorting is not needed
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
51
|
const renderContext = gridRenderContextSelector(apiRef);
|
|
57
52
|
const visibleColumns = gridVisibleColumnFieldsSelector(apiRef);
|
|
58
53
|
const chunks = [];
|
|
54
|
+
const sortedAggregatedFields = gridSortModelSelector(apiRef).map(s => s.field).filter(field => aggregatedFields.includes(field));
|
|
59
55
|
const visibleAggregatedFields = visibleColumns.slice(renderContext.firstColumnIndex, renderContext.lastColumnIndex + 1).filter(field => aggregatedFields.includes(field));
|
|
56
|
+
const visibleAggregatedFieldsWithSort = [...visibleAggregatedFields, ...sortedAggregatedFields.filter(field => !visibleAggregatedFields.includes(field))];
|
|
57
|
+
const hasAggregatedSortedField = gridRowMaximumTreeDepthSelector(apiRef) > 1 && sortedAggregatedFields.length > 0;
|
|
60
58
|
if (visibleAggregatedFields.length > 0) {
|
|
61
|
-
chunks.push(
|
|
59
|
+
chunks.push(visibleAggregatedFieldsWithSort);
|
|
62
60
|
}
|
|
63
|
-
const otherAggregatedFields = aggregatedFields.filter(field => !
|
|
61
|
+
const otherAggregatedFields = aggregatedFields.filter(field => !visibleAggregatedFieldsWithSort.includes(field));
|
|
64
62
|
const chunkSize = 20; // columns per chunk
|
|
65
63
|
for (let i = 0; i < otherAggregatedFields.length; i += chunkSize) {
|
|
66
64
|
chunks.push(otherAggregatedFields.slice(i, i + chunkSize));
|
|
@@ -75,11 +73,7 @@ export const useGridAggregation = (apiRef, props) => {
|
|
|
75
73
|
}
|
|
76
74
|
const currentChunk = chunks[chunkIndex];
|
|
77
75
|
if (!currentChunk) {
|
|
78
|
-
|
|
79
|
-
const hasAggregatedSorting = sortModel.some(field => aggregationRules[field]);
|
|
80
|
-
if (hasAggregatedSorting) {
|
|
81
|
-
apiRef.current.applySorting();
|
|
82
|
-
}
|
|
76
|
+
apiRef.current.publishEvent('aggregationLookupSet');
|
|
83
77
|
abortControllerRef.current = null;
|
|
84
78
|
return;
|
|
85
79
|
}
|
|
@@ -106,6 +100,9 @@ export const useGridAggregation = (apiRef, props) => {
|
|
|
106
100
|
lookup: _extends({}, aggregationLookup)
|
|
107
101
|
})
|
|
108
102
|
}));
|
|
103
|
+
if (chunkIndex === 0 && hasAggregatedSortedField) {
|
|
104
|
+
apiRef.current.applySorting();
|
|
105
|
+
}
|
|
109
106
|
chunkIndex += 1;
|
|
110
107
|
if (performance.now() - chunkStartTime < timeLimit) {
|
|
111
108
|
processChunk();
|
|
@@ -136,7 +133,9 @@ export const useGridAggregation = (apiRef, props) => {
|
|
|
136
133
|
}
|
|
137
134
|
};
|
|
138
135
|
}, []);
|
|
139
|
-
const
|
|
136
|
+
const {
|
|
137
|
+
schedule: deferredApplyAggregation
|
|
138
|
+
} = useRunOncePerLoop(applyAggregation);
|
|
140
139
|
const aggregationApi = {
|
|
141
140
|
setAggregationModel
|
|
142
141
|
};
|
|
@@ -177,7 +176,24 @@ export const useGridAggregation = (apiRef, props) => {
|
|
|
177
176
|
useGridEvent(apiRef, 'aggregationModelChange', checkAggregationRulesDiff);
|
|
178
177
|
useGridEvent(apiRef, 'columnsChange', checkAggregationRulesDiff);
|
|
179
178
|
useGridEvent(apiRef, 'filteredRowsSet', deferredApplyAggregation);
|
|
180
|
-
|
|
179
|
+
const lastSortModel = React.useRef(gridSortModelSelector(apiRef));
|
|
180
|
+
useGridEvent(apiRef, 'sortedRowsSet', () => {
|
|
181
|
+
const sortModel = gridSortModelSelector(apiRef);
|
|
182
|
+
if (lastSortModel.current === sortModel) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
lastSortModel.current = sortModel;
|
|
186
|
+
const aggregationRules = getAggregationRules(gridColumnLookupSelector(apiRef), gridAggregationModelSelector(apiRef), props.aggregationFunctions, !!props.dataSource);
|
|
187
|
+
const aggregatedFields = Object.keys(aggregationRules);
|
|
188
|
+
if (!aggregatedFields.length) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const needsSorting = shouldApplySorting(aggregationRules, aggregatedFields);
|
|
192
|
+
if (!needsSorting) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
deferredApplyAggregation();
|
|
196
|
+
});
|
|
181
197
|
|
|
182
198
|
/**
|
|
183
199
|
* EFFECTS
|
|
@@ -187,4 +203,9 @@ export const useGridAggregation = (apiRef, props) => {
|
|
|
187
203
|
apiRef.current.setAggregationModel(props.aggregationModel);
|
|
188
204
|
}
|
|
189
205
|
}, [apiRef, props.aggregationModel]);
|
|
206
|
+
React.useEffect(() => {
|
|
207
|
+
if (props.getAggregationPosition !== undefined) {
|
|
208
|
+
deferredApplyAggregation();
|
|
209
|
+
}
|
|
210
|
+
}, [deferredApplyAggregation, props.getAggregationPosition]);
|
|
190
211
|
};
|
|
@@ -74,10 +74,7 @@ export const useGridAiAssistant = (apiRef, props) => {
|
|
|
74
74
|
length: Math.min(DEFAULT_SAMPLE_COUNT, rows.length)
|
|
75
75
|
}).map(() => {
|
|
76
76
|
const row = rows[Math.floor(Math.random() * rows.length)];
|
|
77
|
-
|
|
78
|
-
return column.valueGetter(row[column.field], row, column, apiRef);
|
|
79
|
-
}
|
|
80
|
-
return row[column.field];
|
|
77
|
+
return apiRef.current.getRowValue(row, column);
|
|
81
78
|
});
|
|
82
79
|
});
|
|
83
80
|
return columnExamples;
|
|
@@ -498,6 +498,7 @@ export const useGridChartsIntegration = (apiRef, props) => {
|
|
|
498
498
|
useGridEvent(apiRef, 'pivotModeChange', runIf(isChartsIntegrationAvailable, () => debouncedHandleColumnDataUpdate(syncedChartIds)));
|
|
499
499
|
useGridEvent(apiRef, 'filteredRowsSet', runIf(isChartsIntegrationAvailable, () => debouncedHandleRowDataUpdate(syncedChartIds)));
|
|
500
500
|
useGridEvent(apiRef, 'sortedRowsSet', runIf(isChartsIntegrationAvailable, () => debouncedHandleRowDataUpdate(syncedChartIds)));
|
|
501
|
+
useGridEvent(apiRef, 'aggregationLookupSet', runIf(isChartsIntegrationAvailable, () => debouncedHandleRowDataUpdate(syncedChartIds)));
|
|
501
502
|
const stateExportPreProcessing = React.useCallback((prevState, exportContext) => {
|
|
502
503
|
if (!props.chartsIntegration || !props.experimentalFeatures?.charts) {
|
|
503
504
|
return prevState;
|
|
@@ -12,10 +12,20 @@ export const useGridParamsOverridableMethods = apiRef => {
|
|
|
12
12
|
id: gridRowIdSelector(apiRef, row),
|
|
13
13
|
field: colDef.field
|
|
14
14
|
})?.value ?? communityMethods.getRowValue(row, colDef), [apiRef, communityMethods]);
|
|
15
|
-
const getRowFormattedValue = React.useCallback((row, colDef) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const getRowFormattedValue = React.useCallback((row, colDef) => {
|
|
16
|
+
const aggregationFormattedValue = gridCellAggregationResultSelector(apiRef, {
|
|
17
|
+
id: gridRowIdSelector(apiRef, row),
|
|
18
|
+
field: colDef.field
|
|
19
|
+
})?.formattedValue;
|
|
20
|
+
if (aggregationFormattedValue !== undefined) {
|
|
21
|
+
return aggregationFormattedValue;
|
|
22
|
+
}
|
|
23
|
+
const value = getRowValue(row, colDef);
|
|
24
|
+
if (!colDef || !colDef.valueFormatter) {
|
|
25
|
+
return value;
|
|
26
|
+
}
|
|
27
|
+
return colDef.valueFormatter(value, row, colDef, apiRef);
|
|
28
|
+
}, [apiRef, getRowValue]);
|
|
19
29
|
return {
|
|
20
30
|
getCellValue,
|
|
21
31
|
getRowValue,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
-
import { GridApiCommon } from '@mui/x-data-grid';
|
|
3
2
|
import { GridApiPremium } from "../../models/gridApiPremium.js";
|
|
4
|
-
export declare const useGridApiRef:
|
|
3
|
+
export declare const useGridApiRef: () => RefObject<GridApiPremium | null>;
|
package/esm/index.js
CHANGED
|
@@ -43,6 +43,9 @@ const getGroupAggregatedValue = (groupId, apiRef, aggregationRowsScope, aggregat
|
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
45
|
const row = rowLookup[rowId];
|
|
46
|
+
if (!row) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
46
49
|
for (let j = 0; j < aggregatedFields.length; j += 1) {
|
|
47
50
|
const aggregatedField = aggregatedFields[j];
|
|
48
51
|
const columnAggregationRules = aggregationRules[aggregatedField];
|
|
@@ -58,9 +61,6 @@ const getGroupAggregatedValue = (groupId, apiRef, aggregationRowsScope, aggregat
|
|
|
58
61
|
// Since we know that pivoted fields are flat, we can use the row directly, and save lots of processing time
|
|
59
62
|
value = row[field];
|
|
60
63
|
} else {
|
|
61
|
-
if (!row) {
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
64
|
const valueGetter = valueGetters[aggregatedField];
|
|
65
65
|
value = valueGetter(row);
|
|
66
66
|
}
|
|
@@ -46,8 +46,8 @@ const useGridAggregation = (apiRef, props) => {
|
|
|
46
46
|
}
|
|
47
47
|
}, [apiRef]);
|
|
48
48
|
const abortControllerRef = React.useRef(null);
|
|
49
|
-
const applyAggregation = React.useCallback(
|
|
50
|
-
// Abort previous if
|
|
49
|
+
const applyAggregation = React.useCallback(() => {
|
|
50
|
+
// Abort previous if we're proceeding
|
|
51
51
|
if (abortControllerRef.current) {
|
|
52
52
|
abortControllerRef.current.abort();
|
|
53
53
|
}
|
|
@@ -56,19 +56,17 @@ const useGridAggregation = (apiRef, props) => {
|
|
|
56
56
|
const aggregationRules = (0, _gridAggregationUtils.getAggregationRules)((0, _xDataGridPro.gridColumnLookupSelector)(apiRef), (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef), props.aggregationFunctions, !!props.dataSource);
|
|
57
57
|
const aggregatedFields = Object.keys(aggregationRules);
|
|
58
58
|
const currentAggregationLookup = (0, _gridAggregationSelectors.gridAggregationLookupSelector)(apiRef);
|
|
59
|
-
const needsSorting = (0, _createAggregationLookup.shouldApplySorting)(aggregationRules, aggregatedFields);
|
|
60
|
-
if (reason === 'sort' && !needsSorting) {
|
|
61
|
-
// no need to re-apply aggregation on `sortedRowsSet` if sorting is not needed
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
59
|
const renderContext = (0, _xDataGridPro.gridRenderContextSelector)(apiRef);
|
|
65
60
|
const visibleColumns = (0, _xDataGridPro.gridVisibleColumnFieldsSelector)(apiRef);
|
|
66
61
|
const chunks = [];
|
|
62
|
+
const sortedAggregatedFields = (0, _xDataGridPro.gridSortModelSelector)(apiRef).map(s => s.field).filter(field => aggregatedFields.includes(field));
|
|
67
63
|
const visibleAggregatedFields = visibleColumns.slice(renderContext.firstColumnIndex, renderContext.lastColumnIndex + 1).filter(field => aggregatedFields.includes(field));
|
|
64
|
+
const visibleAggregatedFieldsWithSort = [...visibleAggregatedFields, ...sortedAggregatedFields.filter(field => !visibleAggregatedFields.includes(field))];
|
|
65
|
+
const hasAggregatedSortedField = (0, _xDataGridPro.gridRowMaximumTreeDepthSelector)(apiRef) > 1 && sortedAggregatedFields.length > 0;
|
|
68
66
|
if (visibleAggregatedFields.length > 0) {
|
|
69
|
-
chunks.push(
|
|
67
|
+
chunks.push(visibleAggregatedFieldsWithSort);
|
|
70
68
|
}
|
|
71
|
-
const otherAggregatedFields = aggregatedFields.filter(field => !
|
|
69
|
+
const otherAggregatedFields = aggregatedFields.filter(field => !visibleAggregatedFieldsWithSort.includes(field));
|
|
72
70
|
const chunkSize = 20; // columns per chunk
|
|
73
71
|
for (let i = 0; i < otherAggregatedFields.length; i += chunkSize) {
|
|
74
72
|
chunks.push(otherAggregatedFields.slice(i, i + chunkSize));
|
|
@@ -83,11 +81,7 @@ const useGridAggregation = (apiRef, props) => {
|
|
|
83
81
|
}
|
|
84
82
|
const currentChunk = chunks[chunkIndex];
|
|
85
83
|
if (!currentChunk) {
|
|
86
|
-
|
|
87
|
-
const hasAggregatedSorting = sortModel.some(field => aggregationRules[field]);
|
|
88
|
-
if (hasAggregatedSorting) {
|
|
89
|
-
apiRef.current.applySorting();
|
|
90
|
-
}
|
|
84
|
+
apiRef.current.publishEvent('aggregationLookupSet');
|
|
91
85
|
abortControllerRef.current = null;
|
|
92
86
|
return;
|
|
93
87
|
}
|
|
@@ -114,6 +108,9 @@ const useGridAggregation = (apiRef, props) => {
|
|
|
114
108
|
lookup: (0, _extends2.default)({}, aggregationLookup)
|
|
115
109
|
})
|
|
116
110
|
}));
|
|
111
|
+
if (chunkIndex === 0 && hasAggregatedSortedField) {
|
|
112
|
+
apiRef.current.applySorting();
|
|
113
|
+
}
|
|
117
114
|
chunkIndex += 1;
|
|
118
115
|
if (performance.now() - chunkStartTime < timeLimit) {
|
|
119
116
|
processChunk();
|
|
@@ -144,7 +141,9 @@ const useGridAggregation = (apiRef, props) => {
|
|
|
144
141
|
}
|
|
145
142
|
};
|
|
146
143
|
}, []);
|
|
147
|
-
const
|
|
144
|
+
const {
|
|
145
|
+
schedule: deferredApplyAggregation
|
|
146
|
+
} = (0, _xDataGridPro.useRunOncePerLoop)(applyAggregation);
|
|
148
147
|
const aggregationApi = {
|
|
149
148
|
setAggregationModel
|
|
150
149
|
};
|
|
@@ -185,7 +184,24 @@ const useGridAggregation = (apiRef, props) => {
|
|
|
185
184
|
(0, _xDataGridPro.useGridEvent)(apiRef, 'aggregationModelChange', checkAggregationRulesDiff);
|
|
186
185
|
(0, _xDataGridPro.useGridEvent)(apiRef, 'columnsChange', checkAggregationRulesDiff);
|
|
187
186
|
(0, _xDataGridPro.useGridEvent)(apiRef, 'filteredRowsSet', deferredApplyAggregation);
|
|
188
|
-
(0, _xDataGridPro.
|
|
187
|
+
const lastSortModel = React.useRef((0, _xDataGridPro.gridSortModelSelector)(apiRef));
|
|
188
|
+
(0, _xDataGridPro.useGridEvent)(apiRef, 'sortedRowsSet', () => {
|
|
189
|
+
const sortModel = (0, _xDataGridPro.gridSortModelSelector)(apiRef);
|
|
190
|
+
if (lastSortModel.current === sortModel) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
lastSortModel.current = sortModel;
|
|
194
|
+
const aggregationRules = (0, _gridAggregationUtils.getAggregationRules)((0, _xDataGridPro.gridColumnLookupSelector)(apiRef), (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef), props.aggregationFunctions, !!props.dataSource);
|
|
195
|
+
const aggregatedFields = Object.keys(aggregationRules);
|
|
196
|
+
if (!aggregatedFields.length) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const needsSorting = (0, _createAggregationLookup.shouldApplySorting)(aggregationRules, aggregatedFields);
|
|
200
|
+
if (!needsSorting) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
deferredApplyAggregation();
|
|
204
|
+
});
|
|
189
205
|
|
|
190
206
|
/**
|
|
191
207
|
* EFFECTS
|
|
@@ -195,5 +211,10 @@ const useGridAggregation = (apiRef, props) => {
|
|
|
195
211
|
apiRef.current.setAggregationModel(props.aggregationModel);
|
|
196
212
|
}
|
|
197
213
|
}, [apiRef, props.aggregationModel]);
|
|
214
|
+
React.useEffect(() => {
|
|
215
|
+
if (props.getAggregationPosition !== undefined) {
|
|
216
|
+
deferredApplyAggregation();
|
|
217
|
+
}
|
|
218
|
+
}, [deferredApplyAggregation, props.getAggregationPosition]);
|
|
198
219
|
};
|
|
199
220
|
exports.useGridAggregation = useGridAggregation;
|
|
@@ -82,10 +82,7 @@ const useGridAiAssistant = (apiRef, props) => {
|
|
|
82
82
|
length: Math.min(DEFAULT_SAMPLE_COUNT, rows.length)
|
|
83
83
|
}).map(() => {
|
|
84
84
|
const row = rows[Math.floor(Math.random() * rows.length)];
|
|
85
|
-
|
|
86
|
-
return column.valueGetter(row[column.field], row, column, apiRef);
|
|
87
|
-
}
|
|
88
|
-
return row[column.field];
|
|
85
|
+
return apiRef.current.getRowValue(row, column);
|
|
89
86
|
});
|
|
90
87
|
});
|
|
91
88
|
return columnExamples;
|
|
@@ -506,6 +506,7 @@ const useGridChartsIntegration = (apiRef, props) => {
|
|
|
506
506
|
(0, _internals.useGridEvent)(apiRef, 'pivotModeChange', (0, _internals.runIf)(isChartsIntegrationAvailable, () => debouncedHandleColumnDataUpdate(syncedChartIds)));
|
|
507
507
|
(0, _internals.useGridEvent)(apiRef, 'filteredRowsSet', (0, _internals.runIf)(isChartsIntegrationAvailable, () => debouncedHandleRowDataUpdate(syncedChartIds)));
|
|
508
508
|
(0, _internals.useGridEvent)(apiRef, 'sortedRowsSet', (0, _internals.runIf)(isChartsIntegrationAvailable, () => debouncedHandleRowDataUpdate(syncedChartIds)));
|
|
509
|
+
(0, _internals.useGridEvent)(apiRef, 'aggregationLookupSet', (0, _internals.runIf)(isChartsIntegrationAvailable, () => debouncedHandleRowDataUpdate(syncedChartIds)));
|
|
509
510
|
const stateExportPreProcessing = React.useCallback((prevState, exportContext) => {
|
|
510
511
|
if (!props.chartsIntegration || !props.experimentalFeatures?.charts) {
|
|
511
512
|
return prevState;
|
|
@@ -19,10 +19,20 @@ const useGridParamsOverridableMethods = apiRef => {
|
|
|
19
19
|
id: (0, _xDataGridPro.gridRowIdSelector)(apiRef, row),
|
|
20
20
|
field: colDef.field
|
|
21
21
|
})?.value ?? communityMethods.getRowValue(row, colDef), [apiRef, communityMethods]);
|
|
22
|
-
const getRowFormattedValue = React.useCallback((row, colDef) =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const getRowFormattedValue = React.useCallback((row, colDef) => {
|
|
23
|
+
const aggregationFormattedValue = (0, _gridAggregationSelectors.gridCellAggregationResultSelector)(apiRef, {
|
|
24
|
+
id: (0, _xDataGridPro.gridRowIdSelector)(apiRef, row),
|
|
25
|
+
field: colDef.field
|
|
26
|
+
})?.formattedValue;
|
|
27
|
+
if (aggregationFormattedValue !== undefined) {
|
|
28
|
+
return aggregationFormattedValue;
|
|
29
|
+
}
|
|
30
|
+
const value = getRowValue(row, colDef);
|
|
31
|
+
if (!colDef || !colDef.valueFormatter) {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
return colDef.valueFormatter(value, row, colDef, apiRef);
|
|
35
|
+
}, [apiRef, getRowValue]);
|
|
26
36
|
return {
|
|
27
37
|
getCellValue,
|
|
28
38
|
getRowValue,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
-
import { GridApiCommon } from '@mui/x-data-grid';
|
|
3
2
|
import { GridApiPremium } from "../../models/gridApiPremium.js";
|
|
4
|
-
export declare const useGridApiRef:
|
|
3
|
+
export declare const useGridApiRef: () => RefObject<GridApiPremium | null>;
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-premium",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.19.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Premium plan edition of the MUI X Data Grid Components.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.28.4",
|
|
37
|
-
"@mui/utils": "^7.3.
|
|
38
|
-
"@mui/x-internal-exceljs-fork": "
|
|
37
|
+
"@mui/utils": "^7.3.5",
|
|
38
|
+
"@mui/x-internal-exceljs-fork": "4.4.3",
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
|
-
"@mui/x-data-grid": "8.
|
|
42
|
-
"@mui/x-data-grid
|
|
43
|
-
"@mui/x-internals": "8.
|
|
44
|
-
"@mui/x-license": "8.
|
|
41
|
+
"@mui/x-data-grid-pro": "8.19.0",
|
|
42
|
+
"@mui/x-data-grid": "8.19.0",
|
|
43
|
+
"@mui/x-internals": "8.19.0",
|
|
44
|
+
"@mui/x-license": "8.19.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@emotion/react": "^11.9.0",
|