@mui/x-data-grid 5.0.0-beta.5 → 5.0.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 +343 -21
- package/LICENSE +1 -1
- package/index-cjs.js +2 -2
- package/index-esm.js +2 -2
- package/package.json +7 -7
- package/{data-grid.d.ts → x-data-grid.d.ts} +1324 -417
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,328 @@
|
|
|
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.1
|
|
7
|
+
|
|
8
|
+
_Nov 17, 2021_
|
|
9
|
+
|
|
10
|
+
A big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 New API to validate the editing values (#3006) @m4theushw
|
|
13
|
+
|
|
14
|
+
You can now use the `preProcessEditCellProps` key in `GridColDef` to synchronously or asynchronously validate the values committed.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
const columns: GridColDef[] = [
|
|
18
|
+
{
|
|
19
|
+
field: 'firstName',
|
|
20
|
+
preProcessEditCellProps: (params: GridEditCellPropsChangeParams) => {
|
|
21
|
+
const hasError = params.props.value.length < 3;
|
|
22
|
+
return { ...params.props, error: hasError };
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
field: 'email',
|
|
27
|
+
preProcessEditCellProps: async (params: GridEditCellPropsChangeParams) => {
|
|
28
|
+
const userWithEmail = await fetchUserByEmail(params.value);
|
|
29
|
+
const hasError = !!userWithEmail;
|
|
30
|
+
return { ...params.props, error: hasError };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
];
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- ✨ New method `getRootDimensions` to access the size of the grid (#3007) @flaviendelangle
|
|
37
|
+
|
|
38
|
+
It contains the size of the viewport (which is the scrollable container containing the rows and columns) considering scrollbars or not.
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
const dimensions = apiRef.current.getRootDimensions();
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### `@mui/x-data-grid@v5.0.1` / `@mui/x-data-grid-pro@v5.0.1`
|
|
45
|
+
|
|
46
|
+
#### Changes
|
|
47
|
+
|
|
48
|
+
- [DataGrid] New API to validate the editing values (#3006) @m4theushw
|
|
49
|
+
- [DataGrid] Use color-scheme to set dark mode on native components (#3146) @alexfauquette
|
|
50
|
+
- [DataGrid] Fix the `@mui/x-data-grid` type entrypoint (#3196) @flaviendelangle
|
|
51
|
+
|
|
52
|
+
### Core
|
|
53
|
+
|
|
54
|
+
- [core] Drop `useGridContainerProps` (#3007) @flaviendelangle
|
|
55
|
+
- [core] Move `getRowIdFromRowIndex` and `getRowIndex` to the sorting API (#3126) @flaviendelangle
|
|
56
|
+
- [core] Polish v5 CHANGELOG (#3194) @oliviertassinari
|
|
57
|
+
- [core] Remove the `index.ts` of the export hooks (#3165) @flaviendelangle
|
|
58
|
+
- [core] Set the correct release date for v5.0.0 in the CHANGELOG.md (#3192) @flaviendelangle
|
|
59
|
+
|
|
60
|
+
### Docs
|
|
61
|
+
|
|
62
|
+
- [docs] Move sentence about disabling multi rows selection (#3167) @alexfauquette
|
|
63
|
+
|
|
64
|
+
## 5.0.0
|
|
65
|
+
|
|
66
|
+
_Nov 16, 2021_
|
|
67
|
+
|
|
68
|
+
🎉 We are execited to introduce [MUI X v5.0.0](https://mui.com/blog/mui-x-v5/) 🎉!
|
|
69
|
+
|
|
70
|
+
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/).
|
|
71
|
+
This version is fully compatible with `@mui/material@5.X` and can be used with `@material-ui/core@4.x` with some [additional steps](https://mui.com/components/data-grid/migration-v4/#using-mui-x-v5-with-mui-core-v4).
|
|
72
|
+
|
|
73
|
+
A big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
74
|
+
|
|
75
|
+
- ⌨️ Enhance keyboard navigation when pagination is enabled
|
|
76
|
+
- 👁 Better support for flex columns
|
|
77
|
+
- 📚 Documentation improvements
|
|
78
|
+
- 🐞 Bugfixes
|
|
79
|
+
|
|
80
|
+
### `@mui/x-data-grid@v5.0.0` / `@mui/x-data-grid-pro@v5.0.0`
|
|
81
|
+
|
|
82
|
+
#### Breaking changes
|
|
83
|
+
|
|
84
|
+
- [DataGrid] The following CSS classes were renamed to follow the internal convention:
|
|
85
|
+
|
|
86
|
+
- `MuiDataGrid-columnsContainer` was renamed to `MuiDataGrid-columnHeaders`
|
|
87
|
+
- `MuiDataGrid-columnHeaderWrapper` was renamed to `MuiDataGrid-columnHeadersInner`
|
|
88
|
+
- The `scroll` class applied to `MuiDataGrid-columnHeaderWrapper` was renamed to `MuiDataGrid-columnHeadersInner--scrollable`
|
|
89
|
+
|
|
90
|
+
- [DataGrid] The `props.components.Checkbox` and `props.componentsProps.checkbox` props were renamed to `props.components.BaseCheckbox` and `props.componentsProps.baseCheckbox` respectively.
|
|
91
|
+
|
|
92
|
+
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.
|
|
93
|
+
|
|
94
|
+
```diff
|
|
95
|
+
<DataGrid
|
|
96
|
+
components={{
|
|
97
|
+
- checkbox: MyCustomCheckbox,
|
|
98
|
+
+ BaseCheckbox: MyCustomCheckbox,
|
|
99
|
+
}}
|
|
100
|
+
componentsProps={{
|
|
101
|
+
- checkbox: {},
|
|
102
|
+
+ baseCheckbox: {},
|
|
103
|
+
}}
|
|
104
|
+
/>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Note**: these changes apply to both the `DataGrid` and `DataGridPro` components.
|
|
108
|
+
|
|
109
|
+
#### Changes
|
|
110
|
+
|
|
111
|
+
- [DataGrid] Block multi-rows updates in `apiRef.current.updateRows` on the Community plan (#3095) @flaviendelangle
|
|
112
|
+
- [DataGrid] Fix filter not working after deleting the value (#3018) @m4theushw
|
|
113
|
+
- [DataGrid] Fix performance regression when selecting 100k rows (#3077) @m4theushw
|
|
114
|
+
- [DataGrid] Fix `apiRef.current.updateRows` to not share rows from other instances (#3127) @m4theushw
|
|
115
|
+
- [DataGrid] Fix flex space allocation to not cause a horizontal scroll when there is enough space (#3099) @flaviendelangle
|
|
116
|
+
- [DataGrid] Improve the filter panel behaviors (#3080) @flaviendelangle
|
|
117
|
+
- [DataGrid] Fix keyboard navigation between column headers and rows when not on the first page (#3086) @flaviendelangle
|
|
118
|
+
- [DataGrid] Fix keyboard navigation between rows when not on the first page (#3074) @flaviendelangle
|
|
119
|
+
- [DataGrid] Prevents bubbling in menu header (#3000) @alexfauquette
|
|
120
|
+
- [DataGrid] Remove unused rendering state and selectors (#3133) @flaviendelangle
|
|
121
|
+
- [DataGrid] Rename `Checkbox` component and props slots to `BaseCheckbox` (#3142) @DanailH
|
|
122
|
+
|
|
123
|
+
### Core
|
|
124
|
+
|
|
125
|
+
- [core] Adapt changelog script to GitHub DOM modification (#3087) @alexfauquette
|
|
126
|
+
- [core] Automatically close issues that are incomplete and inactive (#3029) @oliviertassinari
|
|
127
|
+
- [core] Improve the typing of `LicenseStatus` (#3141) @Himself65
|
|
128
|
+
- [core] Make `useGridColumnsPreProcessing` generic (#3092) @m4theushw
|
|
129
|
+
- [core] Move column headers virtualization to hook (#3078) @m4theushw
|
|
130
|
+
- [core] Move virtualization logic to hook (#3079) @m4theushw
|
|
131
|
+
- [core] Rename directories to match new packages new names (#3088) @flaviendelangle
|
|
132
|
+
- [core] Replace `createClientRender` with new `createRenderer` API (#3125) @flaviendelangle
|
|
133
|
+
- [core] Store the event manager in a key of `GridApi` instead of making the whole `GridApi` extend it (#3069) @flaviendelangle
|
|
134
|
+
- [core] Update monorepo (#3139) @m4theushw
|
|
135
|
+
- [core] Use `unstable_` prefix instead of `unsafe_` for private APIs (#3090) @flaviendelangle
|
|
136
|
+
- [core] Use official MUI repo as monorepo (#3084) @m4theushw
|
|
137
|
+
|
|
138
|
+
### Docs
|
|
139
|
+
|
|
140
|
+
- [docs] Fix broken example in the component slot example (#3123) @Himself65
|
|
141
|
+
- [docs] Fix inline previews (#3081) @DanailH
|
|
142
|
+
- [docs] Fix the client-side validation link clarity (#3100) @oliviertassinari
|
|
143
|
+
- [docs] Improve `rowCount` CSS class description (#3072) @ZeeshanTamboli
|
|
144
|
+
- [docs] Use core repo constants for doc internationalization (#3143) @flaviendelangle
|
|
145
|
+
|
|
146
|
+
## 5.0.0-beta.7
|
|
147
|
+
|
|
148
|
+
_Nov 4, 2021_
|
|
149
|
+
|
|
150
|
+
- 💅 Reduce styles specificity to make simpler to override (#3012) @DanailH
|
|
151
|
+
- 🌍 Add Hebrew (heIL) locale (#3028) @ColdAtNight
|
|
152
|
+
- 📚 Documentation improvements
|
|
153
|
+
- 🐞 Bugfixes
|
|
154
|
+
|
|
155
|
+
### `@mui/x-data-grid@v5.0.0-beta.7` / `@mui/x-data-grid-pro@v5.0.0-beta.7`
|
|
156
|
+
|
|
157
|
+
#### Breaking changes
|
|
158
|
+
|
|
159
|
+
- [core] Prefix selectors from `useGridContainerProps` with `unsafe` (#3002) @flaviendelangle
|
|
160
|
+
|
|
161
|
+
The dimension API is being temporarily made private to allow to clean it in future minor releases. The current approach causes useless re-renders.
|
|
162
|
+
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.
|
|
163
|
+
|
|
164
|
+
The following selectors were prefixed by `unstable_`. Use the provided alternatives.
|
|
165
|
+
|
|
166
|
+
1. `gridContainerSizesSelector` was renamed to `unstable_gridContainerSizesSelector`
|
|
167
|
+
2. `gridViewportSizesSelector` was renamed to `unstable_gridViewportSizesSelector`
|
|
168
|
+
3. `gridScrollBarSizeSelector` was renamed to `unstable_gridScrollBarSizeSelector`
|
|
169
|
+
|
|
170
|
+
The following selectors were removed. You can hard-code their logic in your application if you really need them.
|
|
171
|
+
|
|
172
|
+
1. `gridDataContainerSizesSelector`
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
const dataContainerSizes = gridContainerSizesSelector(state)?.dataContainerSizes ?? null;
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
2. `gridDataContainerHeightSelector`
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
const dataContainerHeight = gridContainerSizesSelector(state)?.dataContainerSizes.height ?? null;
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The selector `gridViewportSizeStateSelector` was a duplicate and has been removed, you can use the selector `unstable_gridViewportSizesSelector` instead.
|
|
185
|
+
|
|
186
|
+
#### Changes
|
|
187
|
+
|
|
188
|
+
- [DataGrid] Add Hebrew (heIL) locale (#3028) @ColdAtNight
|
|
189
|
+
- [DataGrid] Move virtualization logic to hook (#3079) @m4theushw
|
|
190
|
+
- [DataGrid] Revert year change in the MIT license (#3059) @oliviertassinari
|
|
191
|
+
- [DataGrid] Fix filtering of nullish numeric cells (#3070) @flaviendelangle
|
|
192
|
+
- [DataGrid] Improve performance when selecting 100k rows (#3077) @m4theushw
|
|
193
|
+
- [DataGrid] Fix `GridEditDateCell` to handle timezone correctly (#2918) @flaviendelangle
|
|
194
|
+
- [DataGrid] Fix keyboard navigation on page > 0 (#3074) @flaviendelangle
|
|
195
|
+
- [DataGrid] Prevents bubbling in menu header (#3000) @alexfauquette
|
|
196
|
+
- [DataGrid] Fix wrong params provided to `cellModeChange` when `setCellMode` is called (#3025) @flaviendelangle
|
|
197
|
+
|
|
198
|
+
### Core
|
|
199
|
+
|
|
200
|
+
- [core] Adapt `useDemoData` for Tree Data (#2978) @flaviendelangle
|
|
201
|
+
- [core] Group update of MUI Core (#3055) @oliviertassinari
|
|
202
|
+
- [core] Ignore `*.tsbuildinfo` files (#3068) @m4theushw
|
|
203
|
+
- [core] Implement tree-based row management (#2996) @flaviendelangle
|
|
204
|
+
- [core] Invert Codesandbox examples on README (#3073) @flaviendelangle
|
|
205
|
+
- [core] Prefix selectors from `useGridContainerProps` with `unsafe` (#3002) @flaviendelangle
|
|
206
|
+
- [core] Reduce `setGridState` and `applyFilters` call when updating `filterModel` (#3023) @flaviendelangle
|
|
207
|
+
- [core] Reduce styles complexity (#3012) @DanailH
|
|
208
|
+
- [core] Upgrade monorepo (#3067) @m4theushw
|
|
209
|
+
- [core] Use official MUI repo as monorepo (#3084) @m4theushw
|
|
210
|
+
- [test] Retry each expect until success (#3027) @m4theushw
|
|
211
|
+
- [core] Adapt changelog script to new GitHub DOM (#3087) @alexfauquette
|
|
212
|
+
|
|
213
|
+
### Docs
|
|
214
|
+
|
|
215
|
+
- [docs] Explain how to use `valueGetter` to transform type (#3003) @alexfauquette
|
|
216
|
+
- [docs] Fix the outdated demo of the docs (#3058) @oliviertassinari
|
|
217
|
+
- [docs] Fix inline previews #3081) @DanailH
|
|
218
|
+
|
|
219
|
+
## 5.0.0-beta.6
|
|
220
|
+
|
|
221
|
+
_Oct 29, 2021_
|
|
222
|
+
|
|
223
|
+
A big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
224
|
+
|
|
225
|
+
- ✨ Allow `valueOptions` from `GridColDef` to accept a function (#2850) @alexfauquette
|
|
226
|
+
- 💅 Prefix undocumented `apiRef` methods with `unsafe_` (#2985) @flaviendelangle
|
|
227
|
+
- 👁 Unify filtering, sorting, and rows selectors names (#2942) @flaviendelangle
|
|
228
|
+
- 💡 Support style overrides added in the theme (#2995) @DanailH
|
|
229
|
+
- 📚 Documentation improvements
|
|
230
|
+
- 🐞 Bugfixes
|
|
231
|
+
|
|
232
|
+
### `@mui/x-data-grid@v5.0.0-beta.6` / `@mui/x-data-grid-pro@v5.0.0-beta.6`
|
|
233
|
+
|
|
234
|
+
#### Breaking changes
|
|
235
|
+
|
|
236
|
+
- [DataGridPro] The following methods from `apiRef` were renamed. Use the provided alternatives. (#2870) @flaviendelangle
|
|
237
|
+
|
|
238
|
+
1. `apiRef.current.applyFilters` was renamed to `apiRef.current.unsafe_applyFilters`
|
|
239
|
+
2. `apiRef.current.applyFilterLinkOperator` was renamed to `apiRef.current.setFilterLinkOperator`
|
|
240
|
+
3. `apiRef.current.upsertFilter` was renamed to `apiRef.current.upsertFilterItem`
|
|
241
|
+
4. `apiRef.current.deleteFilter` was renamed to `apiRef.current.deleteFilterItem`
|
|
242
|
+
|
|
243
|
+
- [DataGridPro] The `apiRef.current.applyFilter` method was removed. (#2870) @flaviendelangle
|
|
244
|
+
You should never have to call it directly since the filters are already applied when the `filterModel` prop changes.
|
|
245
|
+
To manually apply the filters, use `apiRef.current.unsafe_applyFilters`.
|
|
246
|
+
|
|
247
|
+
```diff
|
|
248
|
+
-apiRef.current.applyFilter
|
|
249
|
+
+apiRef.current.unsafe_applyFilters
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
- [DataGridPro] Rename filtering, sorting, and rows selectors to match the naming convention (#2942) @flaviendelangle
|
|
253
|
+
|
|
254
|
+
1. `unorderedGridRowIdsSelector` was renamed to `gridRowIdsSelector`
|
|
255
|
+
2. `sortingGridStateSelector` was renamed to `gridSortingStateSelector`
|
|
256
|
+
3. `sortedGridRowIdsSelector` was renamed to `gridSortedRowIdsSelector`
|
|
257
|
+
4. `visibleSortedGridRowIdsSelector` was renamed to `gridVisibleSortedRowIdsSelector`
|
|
258
|
+
5. `visibleGridRowCountSelector` was renamed to `gridVisibleRowCountSelector`
|
|
259
|
+
6. `filterGridColumnLookupSelector` was renamed to `gridFilterActiveItemsSelector`
|
|
260
|
+
|
|
261
|
+
- [DataGridPro] The `sortedGridRowsSelector` was renamed to `gridSortedRowEntriesSelector` (#2942) @flaviendelangle
|
|
262
|
+
|
|
263
|
+
The return value was also changed as below:
|
|
264
|
+
|
|
265
|
+
```diff
|
|
266
|
+
-sortedGridRowsSelector: (state: GridState) => Map<GridRowId, GridRowModel>
|
|
267
|
+
-const map = sortedGridRowsSelector(state);
|
|
268
|
+
+gridSortedRowEntriesSelector: (state: GridState) => GridRowEntry[]
|
|
269
|
+
+const map = new Map(gridSortedRowEntriesSelector(state).map(row => [row.id, row.model]));
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
- [DataGridPro] The `visibleSortedGridRowsSelector` was replaced with `gridVisibleSortedRowEntriesSelector` (#2942) @flaviendelangle
|
|
273
|
+
|
|
274
|
+
The return value was also changed as below:
|
|
275
|
+
|
|
276
|
+
```diff
|
|
277
|
+
-visibleSortedGridRowsSelector: (state: GridState) => Map<GridRowId, GridRowModel>;
|
|
278
|
+
-const map = visibleSortedGridRowsSelector(state);
|
|
279
|
+
+gridVisibleSortedRowEntriesSelector: (state: GridState) => GridRowEntry[]
|
|
280
|
+
+const map = new Map(gridVisibleSortedRowEntriesSelector(state).map(row => [row.id, row.model]));
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
- [DataGridPro] The `visibleSortedGridRowsAsArraySelector` was replaced with `gridVisibleSortedRowEntriesSelector` (#2942) @flaviendelangle
|
|
284
|
+
|
|
285
|
+
The return value was also changed as below:
|
|
286
|
+
|
|
287
|
+
```diff
|
|
288
|
+
-visibleSortedGridRowsAsArraySelector: (state: GridState) => [GridRowId, GridRowData][];
|
|
289
|
+
+gridVisibleSortedRowEntriesSelector: (state: GridState) => GridRowEntry[]
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
- [DataGridPro] The `filterGridItemsCounterSelector` selector was removed. (#2942) @flaviendelangle
|
|
293
|
+
Use `gridFilterActiveItemsSelector` as replacement.
|
|
294
|
+
|
|
295
|
+
```diff
|
|
296
|
+
-const filterCount = filterGridItemsCounterSelector(state);
|
|
297
|
+
+const filterCount = gridFilterActiveItemsSelector(state).length;
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
- [DataGridPro] The `unorderedGridRowModelsSelector` selector was removed. (#2942) @flaviendelangle
|
|
301
|
+
Use `apiRef.current.getRowModels` or `gridRowIdsSelector` and `gridRowsLookupSelector`.
|
|
302
|
+
|
|
303
|
+
#### Changes
|
|
304
|
+
|
|
305
|
+
- [DataGrid] Allow `valueOptions` to accept a function (#2850) @alexfauquette
|
|
306
|
+
- [DataGrid] Add `overridesResolver` (#2995) @DanailH
|
|
307
|
+
- [DataGrid] Unify filtering, sorting, and rows selectors names (#2942) @flaviendelangle
|
|
308
|
+
- [DataGridPro] Prefix undocumented `apiRef` methods with `unsafe_` (#2985) @flaviendelangle
|
|
309
|
+
|
|
310
|
+
### Docs
|
|
311
|
+
|
|
312
|
+
- [docs] Explain how to use MUI X v5 with MUI Core v4 (#2846) @m4theushw
|
|
313
|
+
- [docs] Generate docs for components (#2465) @m4theushw
|
|
314
|
+
- [docs] Improve `scrollEndThreshold` API docs (#3001) @ZeeshanTamboli
|
|
315
|
+
- [docs] Fix CodeSandbox and feature request templates (#2986) @flaviendelangle
|
|
316
|
+
|
|
317
|
+
### Core
|
|
318
|
+
|
|
319
|
+
- [core] Add step for announcing the releases on Twitter (#2997) @DanailH
|
|
320
|
+
- [core] Apply all filters to a row before moving to the next one (#2870) @flaviendelangle
|
|
321
|
+
- [core] Change monorepo repository URL (#2983) @m4theushw
|
|
322
|
+
- [core] Clean Storybook examples (#2805) @flaviendelangle
|
|
323
|
+
- [core] Generate list of all grid exports (#2801) @flaviendelangle
|
|
324
|
+
- [core] Improve typing of `buildApi.ts` (#2922) @flaviendelangle
|
|
325
|
+
- [core] Add additional test for `checkboxSelection` toggling (#2979) @flaviendelangle
|
|
326
|
+
- [test] Fix flaky visual regression test (#2981) @m4theushw
|
|
327
|
+
|
|
6
328
|
## 5.0.0-beta.5
|
|
7
329
|
|
|
8
330
|
_Oct 22, 2021_
|
|
@@ -84,7 +406,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
|
|
|
84
406
|
const prevRenderContext = React.useRef(null);
|
|
85
407
|
|
|
86
408
|
React.useEffect(() => {
|
|
87
|
-
return apiRef.current.subscribeEvent(
|
|
409
|
+
return apiRef.current.subscribeEvent('rowsScroll', ({ renderContext }) => {
|
|
88
410
|
if (
|
|
89
411
|
!prevRenderContext.current ||
|
|
90
412
|
renderContext.firstRowIdx !== prevRenderContext.current.firstRowIndex ||
|
|
@@ -93,13 +415,13 @@ A big thanks to the 5 contributors who made this release possible. Here are some
|
|
|
93
415
|
prevRenderContext.current = renderContext;
|
|
94
416
|
const params = {
|
|
95
417
|
firstRowIndex: renderContext.firstRowIndex,
|
|
96
|
-
lastRowIndex: renderContext.lastRowIndex
|
|
418
|
+
lastRowIndex: renderContext.lastRowIndex,
|
|
97
419
|
};
|
|
98
420
|
}
|
|
99
421
|
});
|
|
100
422
|
}, [apiRef]);
|
|
101
423
|
|
|
102
|
-
<DataGridPro apiRef={apiRef}
|
|
424
|
+
<DataGridPro apiRef={apiRef} />;
|
|
103
425
|
```
|
|
104
426
|
|
|
105
427
|
#### Changes
|
|
@@ -146,7 +468,7 @@ _Oct 14, 2021_
|
|
|
146
468
|
A big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
147
469
|
|
|
148
470
|
- 🎁 Add the ability to print the grid (#2519) @DanailH
|
|
149
|
-
|
|
471
|
+
|
|
150
472
|
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.
|
|
151
473
|
|
|
152
474
|
- 💡 Enhance internal code structure
|
|
@@ -182,11 +504,11 @@ A big thanks to the 7 contributors who made this release possible. Here are some
|
|
|
182
504
|
+ }}
|
|
183
505
|
+/>;
|
|
184
506
|
```
|
|
185
|
-
|
|
507
|
+
|
|
186
508
|
The `data-rowindex` and `data-rowselected` attributes were removed from the cell element. Equivalent attributes can be found in the row element.
|
|
187
|
-
|
|
509
|
+
|
|
188
510
|
The `data-editable` attribute was removed from the cell element. Use the `.MuiDataGrid-cell--editable` CSS class.
|
|
189
|
-
|
|
511
|
+
|
|
190
512
|
The `data-mode` attribute was removed from the cell element. Use the `.MuiDataGrid-cell--editing` CSS class.
|
|
191
513
|
|
|
192
514
|
- [DataGrid] The `state.filter` and `state.visibleRows` were merged into a single `state.filter` sub-state (#2782) @flaviendelangle
|
|
@@ -198,12 +520,12 @@ A big thanks to the 7 contributors who made this release possible. Here are some
|
|
|
198
520
|
-const filterModel = gridFilterStateSelector(state)
|
|
199
521
|
+const filterModel = state.filter.filterModel
|
|
200
522
|
+const filterModel = gridFilterModelSelector(state) // preferred method
|
|
201
|
-
|
|
523
|
+
|
|
202
524
|
-const visibleRowsLookup = state.visibleRows.visibleRowsLookup
|
|
203
525
|
-const visibleRowsLookup = visibleGridRowsStateSelector(state).visibleRowsLookup
|
|
204
526
|
+const visibleRowsLookup = state.filter.visibleRowsLookup
|
|
205
527
|
+const visibleRowsLookup = gridVisibleRowsLookupSelector(state).visibleRowsLookup // preferred method
|
|
206
|
-
|
|
528
|
+
|
|
207
529
|
-const visibleRows = state.visibleRows.visibleRows
|
|
208
530
|
+const visibleRows = state.filter.visibleRows
|
|
209
531
|
+const visibleRows = gridVisibleRowsLookupSelector(state).visibleRows // preferred method
|
|
@@ -214,22 +536,22 @@ A big thanks to the 7 contributors who made this release possible. Here are some
|
|
|
214
536
|
```diff
|
|
215
537
|
-const columnHeaderClass = GRID_COLUMN_HEADER_CSS_CLASS
|
|
216
538
|
+const columnHeaderClass = gridClasses.columnHeader
|
|
217
|
-
|
|
539
|
+
|
|
218
540
|
-const rowClass = GRID_ROW_CSS_CLASS
|
|
219
541
|
+const rowClass = gridClasses.row
|
|
220
|
-
|
|
542
|
+
|
|
221
543
|
-const cellClass = GRID_CELL_CSS_CLASS
|
|
222
544
|
+const cellClass = gridClasses.cell
|
|
223
|
-
|
|
545
|
+
|
|
224
546
|
-const columnSeparatorClass = GRID_COLUMN_HEADER_SEPARATOR_RESIZABLE_CSS_CLASS
|
|
225
547
|
+const columnSeparatorClass = gridClasses['columnSeparator--resizable']
|
|
226
|
-
|
|
548
|
+
|
|
227
549
|
-const columnHeaderTitleClass = GRID_COLUMN_HEADER_TITLE_CSS_CLASS
|
|
228
550
|
+const columnHeaderTitleClass = gridClasses.columnHeaderTitle
|
|
229
|
-
|
|
551
|
+
|
|
230
552
|
-const columnHeaderDropZoneClass = GRID_COLUMN_HEADER_DROP_ZONE_CSS_CLASS
|
|
231
553
|
+const columnHeaderDropZoneClass = gridClasses.columnHeaderDropZone
|
|
232
|
-
|
|
554
|
+
|
|
233
555
|
-const columnHeaderDraggingClass = GRID_COLUMN_HEADER_DRAGGING_CSS_CLASS
|
|
234
556
|
+const columnHeaderDraggingClass = gridClasses["columnHeader--dragging"]
|
|
235
557
|
```
|
|
@@ -247,16 +569,16 @@ A big thanks to the 7 contributors who made this release possible. Here are some
|
|
|
247
569
|
```diff
|
|
248
570
|
-const isColumnString = column.type === GRID_STRING_COLUMN_TYPE;
|
|
249
571
|
+const isColumnString = col.type === 'string';
|
|
250
|
-
|
|
572
|
+
|
|
251
573
|
-const isColumnNumber = col.type === GRID_NUMBER_COLUMN_TYPE;
|
|
252
574
|
+const isColumnNumber = col.type === 'number';
|
|
253
|
-
|
|
575
|
+
|
|
254
576
|
-const isColumnDate = col.type === GRID_DATE_COLUMN_TYPE;
|
|
255
577
|
+const isColumnDate = col.type === 'date';
|
|
256
|
-
|
|
578
|
+
|
|
257
579
|
-const isColumnDateTime = col.type === GRID_DATETIME_COLUMN_TYPE;
|
|
258
580
|
+const isColumnDateTime = col.type === 'dateTime';
|
|
259
|
-
|
|
581
|
+
|
|
260
582
|
-const isColumnBoolean = col.type === GRID_BOOLEAN_COLUMN_TYPE;
|
|
261
583
|
+const isColumnBoolean = col.type === 'boolean';
|
|
262
584
|
```
|
|
@@ -269,13 +591,13 @@ A big thanks to the 7 contributors who made this release possible. Here are some
|
|
|
269
591
|
-const [filterModel, setFilterModel] = React.useState(getInitialGridFilterState);
|
|
270
592
|
+const [filterModel, setFilterModel] = React.useState(getDefaultGridFilterModel);
|
|
271
593
|
```
|
|
272
|
-
|
|
594
|
+
|
|
273
595
|
For the other methods, you can hardcode the value you want to apply:
|
|
274
596
|
|
|
275
597
|
```diff
|
|
276
598
|
-const [sortModel, setSortModel] = React.useState(() => getInitialGridSortingState().sortModel);
|
|
277
599
|
+const [sortModel, setSortModel] React.useState([]);
|
|
278
|
-
|
|
600
|
+
|
|
279
601
|
-getInitialGridColumnReorderState
|
|
280
602
|
-getInitialGridColumnResizeState
|
|
281
603
|
-getInitialGridColumnsState
|
package/LICENSE
CHANGED