@mui/x-data-grid 5.0.0-beta.4 → 5.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.
- package/CHANGELOG.md +418 -18
- package/LICENSE +1 -1
- package/README.md +0 -1
- package/index-cjs.js +2 -2
- package/index-esm.js +2 -2
- package/package.json +6 -7
- package/{data-grid.d.ts → x-data-grid.d.ts} +1427 -426
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,406 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 5.0.0
|
|
7
|
+
|
|
8
|
+
_Nov 15, 2021_
|
|
9
|
+
|
|
10
|
+
🎉 This is the new stable release of the data grid component 🎉!
|
|
11
|
+
|
|
12
|
+
If you want to migrate the DataGrid or DataGridPro from v4 to v5, take a look at the [migration guide](https://mui.com/components/data-grid/migration-v4/).
|
|
13
|
+
This version is fully compatible with `@mui/material@5.X` and can be used with `@material-ui/core@4.x` with some additional steps as described [here](https://mui.com/components/data-grid/migration-v4/#using-mui-x-v5-with-mui-core-v4)
|
|
14
|
+
|
|
15
|
+
A big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
16
|
+
|
|
17
|
+
- ⌨️ Enhance keyboard navigation when pagination is enabled
|
|
18
|
+
- 👁 Better support for flex columns
|
|
19
|
+
- 📚 Documentation improvements
|
|
20
|
+
- 🐞 Bugfixes
|
|
21
|
+
|
|
22
|
+
### `@mui/x-data-grid@v5.0.0` / `@mui/x-data-grid-pro@v5.0.0`
|
|
23
|
+
|
|
24
|
+
#### Breaking changes
|
|
25
|
+
|
|
26
|
+
- [DataGrid] The following CSS classes were renamed to follow the internal convention:
|
|
27
|
+
|
|
28
|
+
- `MuiDataGrid-columnsContainer` was renamed to `MuiDataGrid-columnHeaders`
|
|
29
|
+
- `MuiDataGrid-columnHeaderWrapper` was renamed to `MuiDataGrid-columnHeadersInner`
|
|
30
|
+
- The `scroll` class applied to `MuiDataGrid-columnHeaderWrapper` was renamed to `MuiDataGrid-columnHeadersInner--scrollable`
|
|
31
|
+
|
|
32
|
+
- [DataGrid] The `props.components.Checkbox` and `props.componentsProps.checkbox` props were renamed to `props.components.BaseCheckbox` and `props.componentsProps.baseCheckbox` respectively.
|
|
33
|
+
|
|
34
|
+
As a first step for [#3066](https://github.com/mui-org/material-ui-x/issues/3066), these slots were renamed to clearly indicate that they are meant to replace a core component.
|
|
35
|
+
|
|
36
|
+
```diff
|
|
37
|
+
<DataGrid
|
|
38
|
+
components={{
|
|
39
|
+
- checkbox: MyCustomCheckbox,
|
|
40
|
+
+ BaseCheckbox: MyCustomCheckbox,
|
|
41
|
+
}}
|
|
42
|
+
componentsProps={{
|
|
43
|
+
- checkbox: {},
|
|
44
|
+
+ baseCheckbox: {},
|
|
45
|
+
}}
|
|
46
|
+
/>;
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Note**: these changes apply to both the `DataGrid` and `DataGridPro` components.
|
|
50
|
+
|
|
51
|
+
#### Changes
|
|
52
|
+
|
|
53
|
+
- [DataGrid] Block multi-rows updates in `apiRef.current.updateRows` on the Community plan (#3095) @flaviendelangle
|
|
54
|
+
- [DataGrid] Fix filter not working after deleting the value (#3018) @m4theushw
|
|
55
|
+
- [DataGrid] Fix performance regression when selecting 100k rows (#3077) @m4theushw
|
|
56
|
+
- [DataGrid] Fix `apiRef.current.updateRows` to not share rows from other instances (#3127) @m4theushw
|
|
57
|
+
- [DataGrid] Fix flex space allocation to not cause a horizontal scroll when there is enough space (#3099) @flaviendelangle
|
|
58
|
+
- [DataGrid] Improve the filter panel behaviors (#3080) @flaviendelangle
|
|
59
|
+
- [DataGrid] Fix keyboard navigation between column headers and rows when not on the first page (#3086) @flaviendelangle
|
|
60
|
+
- [DataGrid] Fix keyboard navigation between rows when not on the first page (#3074) @flaviendelangle
|
|
61
|
+
- [DataGrid] Prevents bubbling in menu header (#3000) @alexfauquette
|
|
62
|
+
- [DataGrid] Remove unused rendering state and selectors (#3133) @flaviendelangle
|
|
63
|
+
- [DataGrid] Rename `Checkbox` component and props slots to `BaseCheckbox` (#3142) @DanailH
|
|
64
|
+
|
|
65
|
+
### Core
|
|
66
|
+
|
|
67
|
+
- [core] Adapt changelog script to GitHub DOM modification (#3087) @alexfauquette
|
|
68
|
+
- [core] Automatically close issues that are incomplete and inactive (#3029) @oliviertassinari
|
|
69
|
+
- [core] Improve the typing of `LicenseStatus` (#3141) @Himself65
|
|
70
|
+
- [core] Make `useGridColumnsPreProcessing` generic (#3092) @m4theushw
|
|
71
|
+
- [core] Move column headers virtualization to hook (#3078) @m4theushw
|
|
72
|
+
- [core] Move virtualization logic to hook (#3079) @m4theushw
|
|
73
|
+
- [core] Rename directories to match new packages new names (#3088) @flaviendelangle
|
|
74
|
+
- [core] Replace `createClientRender` with new `createRenderer` API (#3125) @flaviendelangle
|
|
75
|
+
- [core] Store the event manager in a key of `GridApi` instead of making the whole `GridApi` extend it (#3069) @flaviendelangle
|
|
76
|
+
- [core] Update monorepo (#3139) @m4theushw
|
|
77
|
+
- [core] Use `unstable_` prefix instead of `unsafe_` for private APIs (#3090) @flaviendelangle
|
|
78
|
+
- [core] Use official MUI repo as monorepo (#3084) @m4theushw
|
|
79
|
+
|
|
80
|
+
### Docs
|
|
81
|
+
|
|
82
|
+
- [docs] Fix broken example in the component slot example (#3123) @Himself65
|
|
83
|
+
- [docs] Fix inline previews (#3081) @DanailH
|
|
84
|
+
- [docs] Fix the client-side validation link clarity (#3100) @oliviertassinari
|
|
85
|
+
- [docs] Improve `rowCount` CSS class description (#3072) @ZeeshanTamboli
|
|
86
|
+
- [docs] Use core repo constants for doc internationalization (#3143) @flaviendelangle
|
|
87
|
+
|
|
88
|
+
## 5.0.0-beta.7
|
|
89
|
+
|
|
90
|
+
_Nov 4, 2021_
|
|
91
|
+
|
|
92
|
+
- 💅 Reduce styles specificity to make simpler to override (#3012) @DanailH
|
|
93
|
+
- 🌍 Add Hebrew (heIL) locale (#3028) @ColdAtNight
|
|
94
|
+
- 📚 Documentation improvements
|
|
95
|
+
- 🐞 Bugfixes
|
|
96
|
+
|
|
97
|
+
### `@mui/x-data-grid@v5.0.0-beta.7` / `@mui/x-data-grid-pro@v5.0.0-beta.7`
|
|
98
|
+
|
|
99
|
+
#### Breaking changes
|
|
100
|
+
|
|
101
|
+
- [core] Prefix selectors from `useGridContainerProps` with `unsafe` (#3002) @flaviendelangle
|
|
102
|
+
|
|
103
|
+
The dimension API is being temporarily made private to allow to clean it in future minor releases. The current approach causes useless re-renders.
|
|
104
|
+
If you relay on any of these selectors, open an issue explaining the use case so that will be taken into account when refactoring them.
|
|
105
|
+
|
|
106
|
+
The following selectors were prefixed by `unstable_`. Use the provided alternatives.
|
|
107
|
+
|
|
108
|
+
1. `gridContainerSizesSelector` was renamed to `unstable_gridContainerSizesSelector`
|
|
109
|
+
2. `gridViewportSizesSelector` was renamed to `unstable_gridViewportSizesSelector`
|
|
110
|
+
3. `gridScrollBarSizeSelector` was renamed to `unstable_gridScrollBarSizeSelector`
|
|
111
|
+
|
|
112
|
+
The following selectors were removed. You can hard-code their logic in your application if you really need them.
|
|
113
|
+
|
|
114
|
+
1. `gridDataContainerSizesSelector`
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
const dataContainerSizes = gridContainerSizesSelector(state)?.dataContainerSizes ?? null;
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
2. `gridDataContainerHeightSelector`
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
const dataContainerHeight = gridContainerSizesSelector(state)?.dataContainerSizes.height ?? null;
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
The selector `gridViewportSizeStateSelector` was a duplicate and has been removed, you can use the selector `unstable_gridViewportSizesSelector` instead.
|
|
127
|
+
|
|
128
|
+
#### Changes
|
|
129
|
+
|
|
130
|
+
- [DataGrid] Add Hebrew (heIL) locale (#3028) @ColdAtNight
|
|
131
|
+
- [DataGrid] Move virtualization logic to hook (#3079) @m4theushw
|
|
132
|
+
- [DataGrid] Revert year change in the MIT license (#3059) @oliviertassinari
|
|
133
|
+
- [DataGrid] Fix filtering of nullish numeric cells (#3070) @flaviendelangle
|
|
134
|
+
- [DataGrid] Improve performance when selecting 100k rows (#3077) @m4theushw
|
|
135
|
+
- [DataGrid] Fix `GridEditDateCell` to handle timezone correctly (#2918) @flaviendelangle
|
|
136
|
+
- [DataGrid] Fix keyboard navigation on page > 0 (#3074) @flaviendelangle
|
|
137
|
+
- [DataGrid] Prevents bubbling in menu header (#3000) @alexfauquette
|
|
138
|
+
- [DataGrid] Fix wrong params provided to `cellModeChange` when `setCellMode` is called (#3025) @flaviendelangle
|
|
139
|
+
|
|
140
|
+
### Core
|
|
141
|
+
|
|
142
|
+
- [core] Adapt `useDemoData` for Tree Data (#2978) @flaviendelangle
|
|
143
|
+
- [core] Group update of MUI Core (#3055) @oliviertassinari
|
|
144
|
+
- [core] Ignore `*.tsbuildinfo` files (#3068) @m4theushw
|
|
145
|
+
- [core] Implement tree-based row management (#2996) @flaviendelangle
|
|
146
|
+
- [core] Invert Codesandbox examples on README (#3073) @flaviendelangle
|
|
147
|
+
- [core] Prefix selectors from `useGridContainerProps` with `unsafe` (#3002) @flaviendelangle
|
|
148
|
+
- [core] Reduce `setGridState` and `applyFilters` call when updating `filterModel` (#3023) @flaviendelangle
|
|
149
|
+
- [core] Reduce styles complexity (#3012) @DanailH
|
|
150
|
+
- [core] Upgrade monorepo (#3067) @m4theushw
|
|
151
|
+
- [core] Use official MUI repo as monorepo (#3084) @m4theushw
|
|
152
|
+
- [test] Retry each expect until success (#3027) @m4theushw
|
|
153
|
+
- [core] Adapt changelog script to new GitHub DOM (#3087) @alexfauquette
|
|
154
|
+
|
|
155
|
+
### Docs
|
|
156
|
+
|
|
157
|
+
- [docs] Explain how to use `valueGetter` to transform type (#3003) @alexfauquette
|
|
158
|
+
- [docs] Fix the outdated demo of the docs (#3058) @oliviertassinari
|
|
159
|
+
- [docs] Fix inline previews #3081) @DanailH
|
|
160
|
+
|
|
161
|
+
## 5.0.0-beta.6
|
|
162
|
+
|
|
163
|
+
_Oct 29, 2021_
|
|
164
|
+
|
|
165
|
+
A big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
166
|
+
|
|
167
|
+
- ✨ Allow `valueOptions` from `GridColDef` to accept a function (#2850) @alexfauquette
|
|
168
|
+
- 💅 Prefix undocumented `apiRef` methods with `unsafe_` (#2985) @flaviendelangle
|
|
169
|
+
- 👁 Unify filtering, sorting, and rows selectors names (#2942) @flaviendelangle
|
|
170
|
+
- 💡 Support style overrides added in the theme (#2995) @DanailH
|
|
171
|
+
- 📚 Documentation improvements
|
|
172
|
+
- 🐞 Bugfixes
|
|
173
|
+
|
|
174
|
+
### `@mui/x-data-grid@v5.0.0-beta.6` / `@mui/x-data-grid-pro@v5.0.0-beta.6`
|
|
175
|
+
|
|
176
|
+
#### Breaking changes
|
|
177
|
+
|
|
178
|
+
- [DataGridPro] The following methods from `apiRef` were renamed. Use the provided alternatives. (#2870) @flaviendelangle
|
|
179
|
+
|
|
180
|
+
1. `apiRef.current.applyFilters` was renamed to `apiRef.current.unsafe_applyFilters`
|
|
181
|
+
2. `apiRef.current.applyFilterLinkOperator` was renamed to `apiRef.current.setFilterLinkOperator`
|
|
182
|
+
3. `apiRef.current.upsertFilter` was renamed to `apiRef.current.upsertFilterItem`
|
|
183
|
+
4. `apiRef.current.deleteFilter` was renamed to `apiRef.current.deleteFilterItem`
|
|
184
|
+
|
|
185
|
+
- [DataGridPro] The `apiRef.current.applyFilter` method was removed. (#2870) @flaviendelangle
|
|
186
|
+
You should never have to call it directly since the filters are already applied when the `filterModel` prop changes.
|
|
187
|
+
To manually apply the filters, use `apiRef.current.unsafe_applyFilters`.
|
|
188
|
+
|
|
189
|
+
```diff
|
|
190
|
+
-apiRef.current.applyFilter
|
|
191
|
+
+apiRef.current.unsafe_applyFilters
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
- [DataGridPro] Rename filtering, sorting, and rows selectors to match the naming convention (#2942) @flaviendelangle
|
|
195
|
+
|
|
196
|
+
1. `unorderedGridRowIdsSelector` was renamed to `gridRowIdsSelector`
|
|
197
|
+
2. `sortingGridStateSelector` was renamed to `gridSortingStateSelector`
|
|
198
|
+
3. `sortedGridRowIdsSelector` was renamed to `gridSortedRowIdsSelector`
|
|
199
|
+
4. `visibleSortedGridRowIdsSelector` was renamed to `gridVisibleSortedRowIdsSelector`
|
|
200
|
+
5. `visibleGridRowCountSelector` was renamed to `gridVisibleRowCountSelector`
|
|
201
|
+
6. `filterGridColumnLookupSelector` was renamed to `gridFilterActiveItemsSelector`
|
|
202
|
+
|
|
203
|
+
- [DataGridPro] The `sortedGridRowsSelector` was renamed to `gridSortedRowEntriesSelector` (#2942) @flaviendelangle
|
|
204
|
+
|
|
205
|
+
The return value was also changed as below:
|
|
206
|
+
|
|
207
|
+
```diff
|
|
208
|
+
-sortedGridRowsSelector: (state: GridState) => Map<GridRowId, GridRowModel>
|
|
209
|
+
-const map = sortedGridRowsSelector(state);
|
|
210
|
+
+gridSortedRowEntriesSelector: (state: GridState) => GridRowEntry[]
|
|
211
|
+
+const map = new Map(gridSortedRowEntriesSelector(state).map(row => [row.id, row.model]));
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
- [DataGridPro] The `visibleSortedGridRowsSelector` was replaced with `gridVisibleSortedRowEntriesSelector` (#2942) @flaviendelangle
|
|
215
|
+
|
|
216
|
+
The return value was also changed as below:
|
|
217
|
+
|
|
218
|
+
```diff
|
|
219
|
+
-visibleSortedGridRowsSelector: (state: GridState) => Map<GridRowId, GridRowModel>;
|
|
220
|
+
-const map = visibleSortedGridRowsSelector(state);
|
|
221
|
+
+gridVisibleSortedRowEntriesSelector: (state: GridState) => GridRowEntry[]
|
|
222
|
+
+const map = new Map(gridVisibleSortedRowEntriesSelector(state).map(row => [row.id, row.model]));
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
- [DataGridPro] The `visibleSortedGridRowsAsArraySelector` was replaced with `gridVisibleSortedRowEntriesSelector` (#2942) @flaviendelangle
|
|
226
|
+
|
|
227
|
+
The return value was also changed as below:
|
|
228
|
+
|
|
229
|
+
```diff
|
|
230
|
+
-visibleSortedGridRowsAsArraySelector: (state: GridState) => [GridRowId, GridRowData][];
|
|
231
|
+
+gridVisibleSortedRowEntriesSelector: (state: GridState) => GridRowEntry[]
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
- [DataGridPro] The `filterGridItemsCounterSelector` selector was removed. (#2942) @flaviendelangle
|
|
235
|
+
Use `gridFilterActiveItemsSelector` as replacement.
|
|
236
|
+
|
|
237
|
+
```diff
|
|
238
|
+
-const filterCount = filterGridItemsCounterSelector(state);
|
|
239
|
+
+const filterCount = gridFilterActiveItemsSelector(state).length;
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
- [DataGridPro] The `unorderedGridRowModelsSelector` selector was removed. (#2942) @flaviendelangle
|
|
243
|
+
Use `apiRef.current.getRowModels` or `gridRowIdsSelector` and `gridRowsLookupSelector`.
|
|
244
|
+
|
|
245
|
+
#### Changes
|
|
246
|
+
|
|
247
|
+
- [DataGrid] Allow `valueOptions` to accept a function (#2850) @alexfauquette
|
|
248
|
+
- [DataGrid] Add `overridesResolver` (#2995) @DanailH
|
|
249
|
+
- [DataGrid] Unify filtering, sorting, and rows selectors names (#2942) @flaviendelangle
|
|
250
|
+
- [DataGridPro] Prefix undocumented `apiRef` methods with `unsafe_` (#2985) @flaviendelangle
|
|
251
|
+
|
|
252
|
+
### Docs
|
|
253
|
+
|
|
254
|
+
- [docs] Explain how to use MUI X v5 with MUI Core v4 (#2846) @m4theushw
|
|
255
|
+
- [docs] Generate docs for components (#2465) @m4theushw
|
|
256
|
+
- [docs] Improve `scrollEndThreshold` API docs (#3001) @ZeeshanTamboli
|
|
257
|
+
- [docs] Fix CodeSandbox and feature request templates (#2986) @flaviendelangle
|
|
258
|
+
|
|
259
|
+
### Core
|
|
260
|
+
|
|
261
|
+
- [core] Add step for announcing the releases on Twitter (#2997) @DanailH
|
|
262
|
+
- [core] Apply all filters to a row before moving to the next one (#2870) @flaviendelangle
|
|
263
|
+
- [core] Change monorepo repository URL (#2983) @m4theushw
|
|
264
|
+
- [core] Clean Storybook examples (#2805) @flaviendelangle
|
|
265
|
+
- [core] Generate list of all grid exports (#2801) @flaviendelangle
|
|
266
|
+
- [core] Improve typing of `buildApi.ts` (#2922) @flaviendelangle
|
|
267
|
+
- [core] Add additional test for `checkboxSelection` toggling (#2979) @flaviendelangle
|
|
268
|
+
- [test] Fix flaky visual regression test (#2981) @m4theushw
|
|
269
|
+
|
|
270
|
+
## 5.0.0-beta.5
|
|
271
|
+
|
|
272
|
+
_Oct 22, 2021_
|
|
273
|
+
|
|
274
|
+
A big thanks to the 5 contributors who made this release possible. Here are some highlights ✨:
|
|
275
|
+
|
|
276
|
+
- 💅 Remove dependency on `@mui/styles` and use the same styling solution from MUI Core (#2784) @DanailH
|
|
277
|
+
- ✨ Add support for generics in `GridRowParams`, `GridCellParams` and `GridRenderCellParams` (#2436) @ZeeshanTamboli
|
|
278
|
+
- 👁 Rework the virtualization engine (#2673) @m4theushw
|
|
279
|
+
- 💡 Enhance internal code structure
|
|
280
|
+
- 🐞 Bugfixes
|
|
281
|
+
|
|
282
|
+
### `@mui/x-data-grid@v5.0.0-beta.5` / `@mui/x-data-grid-pro@v5.0.0-beta.5`
|
|
283
|
+
|
|
284
|
+
#### Breaking changes
|
|
285
|
+
|
|
286
|
+
- The `DataGrid` and `DataGridPro` no longer depends on `@mui/styles`. Use `styled` to provide custom styling. (#2784) @DanailH
|
|
287
|
+
|
|
288
|
+
```diff
|
|
289
|
+
-import { createTheme } from '@mui/material/styles';
|
|
290
|
+
-import { makeStyles } from '@mui/styles';
|
|
291
|
+
+import { styled } from '@mui/material/styles';
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
The following CSS classes were renamed:
|
|
295
|
+
|
|
296
|
+
- `.MuiDataGrid-gridMenuList` was renamed to `.MuiDataGrid-menuList`
|
|
297
|
+
- `.MuiGridToolbarContainer-root` was renamed to `.MuiDataGrid-toolbarContainer`
|
|
298
|
+
- `.MuiGridMenu-root` was renamed to `.MuiDataGrid-menu`
|
|
299
|
+
- `.MuiDataGridColumnsPanel-root` was renamed to `.MuiDataGrid-columnsPanel`
|
|
300
|
+
- `.MuiGridPanel-root` was renamed to `.MuiDataGrid-panel`
|
|
301
|
+
- `.MuiGridPanelContent-root` was renamed to `.MuiDataGrid-panelContent`
|
|
302
|
+
- `.MuiGridPanelFooter-root` was renamed to `.MuiDataGrid-panelFooter`
|
|
303
|
+
- `.MuiDataGridPanelHeader-root` was renamed to `.MuiDataGrid-panelHeader`
|
|
304
|
+
- `.MuiGridPanelWrapper-root` was renamed to `.MuiDataGrid-panelWrapper`
|
|
305
|
+
- `.MuiGridFilterForm-root` was renamed to `.MuiDataGrid-filterForm`
|
|
306
|
+
- `.MuiGridToolbarFilterButton-root` was renamed to `.MuiDataGrid-toolbarFilterList`
|
|
307
|
+
|
|
308
|
+
- [DataGrid] The CSS classes `.MuiDataGrid-window` and `.MuiDataGrid-windowContainer` were removed (#2673) @m4theushw
|
|
309
|
+
|
|
310
|
+
The following CSS classes were renamed:
|
|
311
|
+
|
|
312
|
+
- `.MuiDataGrid-viewport` was renamed to `.MuiDataGrid-virtualScroller`
|
|
313
|
+
- `.MuiDataGrid-dataContainer` was renamed to `.MuiDataGrid-virtualScrollerContent`
|
|
314
|
+
- `.MuiDataGrid-renderingZone` was renamed to `.MuiDataGrid-virtualScrollerRenderZone`
|
|
315
|
+
|
|
316
|
+
- [DataGrid] Remove the `useGridSlotComponentProps` hook and replace it as below: (#2856) @flaviendelangle
|
|
317
|
+
|
|
318
|
+
```diff
|
|
319
|
+
-const { apiRef, state, rootElement } = useGridSlotComponentProps();
|
|
320
|
+
+const apiRef = useGridApiContext();
|
|
321
|
+
+const [state] = useGridState(apiRef);
|
|
322
|
+
+const rootElement = apiRef.current.rootElementRef;
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
- [DataGrid] Remove the `state` prop and use the `initialState` prop (#2848) @flaviendelangle
|
|
326
|
+
|
|
327
|
+
Note that `initialState` only allows the `preferencePanel`, `filter.filterModel` and `sort.sortModel` keys.
|
|
328
|
+
To fully control the state, use the the feature's model prop and change callback (e.g. `filterModel` and `onFilterModelChange`).
|
|
329
|
+
|
|
330
|
+
```diff
|
|
331
|
+
<DataGrid
|
|
332
|
+
- state={{
|
|
333
|
+
+ initialState={{
|
|
334
|
+
preferencePanel: {
|
|
335
|
+
open: true,
|
|
336
|
+
openedPanelValue: GridPreferencePanelsValue.filters,
|
|
337
|
+
},
|
|
338
|
+
}}
|
|
339
|
+
/>
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
- [DataGridPro] Remove the `onViewportRowsChange` prop and the `viewportRowsChange` event (#2673) @m4theushw
|
|
343
|
+
|
|
344
|
+
A listener on the `rowsScroll` event, as shown below, can be used to replace the prop:
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
const apiRef = useGridApiRef();
|
|
348
|
+
const prevRenderContext = React.useRef(null);
|
|
349
|
+
|
|
350
|
+
React.useEffect(() => {
|
|
351
|
+
return apiRef.current.subscribeEvent('rowsScroll', ({ renderContext }) => {
|
|
352
|
+
if (
|
|
353
|
+
!prevRenderContext.current ||
|
|
354
|
+
renderContext.firstRowIdx !== prevRenderContext.current.firstRowIndex ||
|
|
355
|
+
renderContext.lastRowIdx !== prevRenderContext.current.lastRowIndex
|
|
356
|
+
) {
|
|
357
|
+
prevRenderContext.current = renderContext;
|
|
358
|
+
const params = {
|
|
359
|
+
firstRowIndex: renderContext.firstRowIndex,
|
|
360
|
+
lastRowIndex: renderContext.lastRowIndex,
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
}, [apiRef]);
|
|
365
|
+
|
|
366
|
+
<DataGridPro apiRef={apiRef} />;
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
#### Changes
|
|
370
|
+
|
|
371
|
+
- [DataGrid] Add `valueSetter` (#2876) @m4theushw
|
|
372
|
+
- [DataGrid] Add support for generic types in `GridRowParams`, `GridCellParams`, `GridRenderCellParams` (#2436) @ZeeshanTamboli
|
|
373
|
+
- [DataGrid] Fix `actions` column type to not select the row when clicking on an item (#2862) @m4theushw
|
|
374
|
+
- [DataGrid] Fix column headers misalignment when the render context changes (#2937) @m4theushw
|
|
375
|
+
- [DataGrid] Rework virtualization (#2673) @m4theushw
|
|
376
|
+
- [DataGrid] Remove `@mui/styles` dependency (#2784) @DanailH
|
|
377
|
+
- [DataGrid] Remove `useGridSlotComponentProps` (#2856) @flaviendelangle
|
|
378
|
+
- [DataGrid] Replace `prop.state` with `prop.initialState` (#2848) @flaviendelangle
|
|
379
|
+
- [DataGrid] Use true content height to dispatch `rowsScrollEnd` (#2938) @m4theushw
|
|
380
|
+
- [DataGrid] Fix the typing of `GridToolbarFilterButton` (#2841) @alexfauquette
|
|
381
|
+
|
|
382
|
+
### Docs
|
|
383
|
+
|
|
384
|
+
- [docs] Improve the README for releases (#2908) @flaviendelangle
|
|
385
|
+
- [docs] Re-add Pro icon (#2928) @m4theushw
|
|
386
|
+
- [docs] Fix to not commit changes when clicking outside the cell (#2906) @ZeeshanTamboli
|
|
387
|
+
- [docs] Update link to Quick Filter issue (#2909) @m4theushw
|
|
388
|
+
|
|
389
|
+
### Core
|
|
390
|
+
|
|
391
|
+
- [core] Small fixes on the Components page (#2877) @flaviendelangle
|
|
392
|
+
- [core] Make each feature hook responsible for its column pre-processing (#2839) @flaviendelangle
|
|
393
|
+
- [core] Add `useGridRowGroupsPreProcessing` internal hook (#2840) @flaviendelangle
|
|
394
|
+
- [core] Register events async if not registered (#2916) @m4theushw
|
|
395
|
+
- [core] Remove `material-ui-utils.ts` (#2872) @DanailH
|
|
396
|
+
- [core] Remove outdated hooks requirements (#2939) @flaviendelangle
|
|
397
|
+
- [core] Remove test event (#2912) @m4theushw
|
|
398
|
+
- [core] Remove unused `GridSlotComponentProps` interface (#2911) @flaviendelangle
|
|
399
|
+
- [core] Rename 'UNSTABLE_' prefix to 'unstable_' (#2931) @flaviendelangle
|
|
400
|
+
- [core] Replace usage of `GridRowData` with `GridRowModel` (#2936) @flaviendelangle
|
|
401
|
+
- [core] Revert hardcoded typings (#2907) @DanailH
|
|
402
|
+
- [core] Simplify the CSV export (#2941) @flaviendelangle
|
|
403
|
+
- [core] Update monorepo version (#2927) @m4theushw
|
|
404
|
+
- [test] Take screenshot of the print export (#2881) @m4theushw
|
|
405
|
+
|
|
6
406
|
## 5.0.0-beta.4
|
|
7
407
|
|
|
8
408
|
_Oct 14, 2021_
|
|
@@ -10,7 +410,7 @@ _Oct 14, 2021_
|
|
|
10
410
|
A big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
411
|
|
|
12
412
|
- 🎁 Add the ability to print the grid (#2519) @DanailH
|
|
13
|
-
|
|
413
|
+
|
|
14
414
|
This new feature adds a button to the toolbar to generate a printer-friendly layout. Check the [documentation](https://mui.com/components/data-grid/export/#print) about it.
|
|
15
415
|
|
|
16
416
|
- 💡 Enhance internal code structure
|
|
@@ -46,11 +446,11 @@ A big thanks to the 7 contributors who made this release possible. Here are some
|
|
|
46
446
|
+ }}
|
|
47
447
|
+/>;
|
|
48
448
|
```
|
|
49
|
-
|
|
449
|
+
|
|
50
450
|
The `data-rowindex` and `data-rowselected` attributes were removed from the cell element. Equivalent attributes can be found in the row element.
|
|
51
|
-
|
|
451
|
+
|
|
52
452
|
The `data-editable` attribute was removed from the cell element. Use the `.MuiDataGrid-cell--editable` CSS class.
|
|
53
|
-
|
|
453
|
+
|
|
54
454
|
The `data-mode` attribute was removed from the cell element. Use the `.MuiDataGrid-cell--editing` CSS class.
|
|
55
455
|
|
|
56
456
|
- [DataGrid] The `state.filter` and `state.visibleRows` were merged into a single `state.filter` sub-state (#2782) @flaviendelangle
|
|
@@ -62,12 +462,12 @@ A big thanks to the 7 contributors who made this release possible. Here are some
|
|
|
62
462
|
-const filterModel = gridFilterStateSelector(state)
|
|
63
463
|
+const filterModel = state.filter.filterModel
|
|
64
464
|
+const filterModel = gridFilterModelSelector(state) // preferred method
|
|
65
|
-
|
|
465
|
+
|
|
66
466
|
-const visibleRowsLookup = state.visibleRows.visibleRowsLookup
|
|
67
467
|
-const visibleRowsLookup = visibleGridRowsStateSelector(state).visibleRowsLookup
|
|
68
468
|
+const visibleRowsLookup = state.filter.visibleRowsLookup
|
|
69
469
|
+const visibleRowsLookup = gridVisibleRowsLookupSelector(state).visibleRowsLookup // preferred method
|
|
70
|
-
|
|
470
|
+
|
|
71
471
|
-const visibleRows = state.visibleRows.visibleRows
|
|
72
472
|
+const visibleRows = state.filter.visibleRows
|
|
73
473
|
+const visibleRows = gridVisibleRowsLookupSelector(state).visibleRows // preferred method
|
|
@@ -78,22 +478,22 @@ A big thanks to the 7 contributors who made this release possible. Here are some
|
|
|
78
478
|
```diff
|
|
79
479
|
-const columnHeaderClass = GRID_COLUMN_HEADER_CSS_CLASS
|
|
80
480
|
+const columnHeaderClass = gridClasses.columnHeader
|
|
81
|
-
|
|
481
|
+
|
|
82
482
|
-const rowClass = GRID_ROW_CSS_CLASS
|
|
83
483
|
+const rowClass = gridClasses.row
|
|
84
|
-
|
|
484
|
+
|
|
85
485
|
-const cellClass = GRID_CELL_CSS_CLASS
|
|
86
486
|
+const cellClass = gridClasses.cell
|
|
87
|
-
|
|
487
|
+
|
|
88
488
|
-const columnSeparatorClass = GRID_COLUMN_HEADER_SEPARATOR_RESIZABLE_CSS_CLASS
|
|
89
489
|
+const columnSeparatorClass = gridClasses['columnSeparator--resizable']
|
|
90
|
-
|
|
490
|
+
|
|
91
491
|
-const columnHeaderTitleClass = GRID_COLUMN_HEADER_TITLE_CSS_CLASS
|
|
92
492
|
+const columnHeaderTitleClass = gridClasses.columnHeaderTitle
|
|
93
|
-
|
|
493
|
+
|
|
94
494
|
-const columnHeaderDropZoneClass = GRID_COLUMN_HEADER_DROP_ZONE_CSS_CLASS
|
|
95
495
|
+const columnHeaderDropZoneClass = gridClasses.columnHeaderDropZone
|
|
96
|
-
|
|
496
|
+
|
|
97
497
|
-const columnHeaderDraggingClass = GRID_COLUMN_HEADER_DRAGGING_CSS_CLASS
|
|
98
498
|
+const columnHeaderDraggingClass = gridClasses["columnHeader--dragging"]
|
|
99
499
|
```
|
|
@@ -111,16 +511,16 @@ A big thanks to the 7 contributors who made this release possible. Here are some
|
|
|
111
511
|
```diff
|
|
112
512
|
-const isColumnString = column.type === GRID_STRING_COLUMN_TYPE;
|
|
113
513
|
+const isColumnString = col.type === 'string';
|
|
114
|
-
|
|
514
|
+
|
|
115
515
|
-const isColumnNumber = col.type === GRID_NUMBER_COLUMN_TYPE;
|
|
116
516
|
+const isColumnNumber = col.type === 'number';
|
|
117
|
-
|
|
517
|
+
|
|
118
518
|
-const isColumnDate = col.type === GRID_DATE_COLUMN_TYPE;
|
|
119
519
|
+const isColumnDate = col.type === 'date';
|
|
120
|
-
|
|
520
|
+
|
|
121
521
|
-const isColumnDateTime = col.type === GRID_DATETIME_COLUMN_TYPE;
|
|
122
522
|
+const isColumnDateTime = col.type === 'dateTime';
|
|
123
|
-
|
|
523
|
+
|
|
124
524
|
-const isColumnBoolean = col.type === GRID_BOOLEAN_COLUMN_TYPE;
|
|
125
525
|
+const isColumnBoolean = col.type === 'boolean';
|
|
126
526
|
```
|
|
@@ -133,13 +533,13 @@ A big thanks to the 7 contributors who made this release possible. Here are some
|
|
|
133
533
|
-const [filterModel, setFilterModel] = React.useState(getInitialGridFilterState);
|
|
134
534
|
+const [filterModel, setFilterModel] = React.useState(getDefaultGridFilterModel);
|
|
135
535
|
```
|
|
136
|
-
|
|
536
|
+
|
|
137
537
|
For the other methods, you can hardcode the value you want to apply:
|
|
138
538
|
|
|
139
539
|
```diff
|
|
140
540
|
-const [sortModel, setSortModel] = React.useState(() => getInitialGridSortingState().sortModel);
|
|
141
541
|
+const [sortModel, setSortModel] React.useState([]);
|
|
142
|
-
|
|
542
|
+
|
|
143
543
|
-getInitialGridColumnReorderState
|
|
144
544
|
-getInitialGridColumnResizeState
|
|
145
545
|
-getInitialGridColumnsState
|
package/LICENSE
CHANGED