@mui/x-data-grid-pro 5.17.5 → 6.0.0-alpha.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 +297 -19
- package/DataGridPro/DataGridPro.js +4 -14
- package/DataGridPro/useDataGridProProps.js +2 -2
- package/components/DataGridProVirtualScroller.js +2 -2
- package/components/GridDetailPanelToggleCell.js +1 -1
- package/components/GridRowReorderCell.js +4 -6
- package/components/GridTreeDataGroupingCell.d.ts +2 -2
- package/components/GridTreeDataGroupingCell.js +1 -1
- package/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
- package/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/hooks/features/lazyLoader/useGridLazyLoader.js +20 -9
- package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.d.ts +1 -1
- package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +20 -6
- package/hooks/features/rowPinning/gridRowPinningInterface.d.ts +2 -2
- package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +16 -16
- package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +62 -25
- package/hooks/features/rowReorder/useGridRowReorder.js +5 -5
- package/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/hooks/features/treeData/gridTreeDataUtils.js +14 -12
- package/hooks/features/treeData/useGridTreeData.js +2 -6
- package/hooks/features/treeData/useGridTreeDataPreProcessors.js +35 -18
- package/index.js +1 -1
- package/internals/index.d.ts +4 -2
- package/internals/index.js +4 -2
- package/legacy/DataGridPro/DataGridPro.js +4 -14
- package/legacy/DataGridPro/useDataGridProProps.js +2 -2
- package/legacy/components/DataGridProVirtualScroller.js +2 -2
- package/legacy/components/GridDetailPanelToggleCell.js +1 -1
- package/legacy/components/GridRowReorderCell.js +4 -6
- package/legacy/components/GridTreeDataGroupingCell.js +1 -1
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
- package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/legacy/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/legacy/hooks/features/lazyLoader/useGridLazyLoader.js +25 -15
- package/legacy/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +21 -7
- package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +62 -25
- package/legacy/hooks/features/rowReorder/useGridRowReorder.js +5 -5
- package/legacy/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/legacy/hooks/features/treeData/gridTreeDataUtils.js +14 -12
- package/legacy/hooks/features/treeData/useGridTreeData.js +2 -6
- package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +37 -22
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +4 -2
- package/legacy/utils/tree/createRowTree.js +36 -0
- package/legacy/utils/tree/index.js +1 -1
- package/legacy/utils/tree/insertDataRowInTree.js +127 -0
- package/legacy/utils/tree/models.js +1 -0
- package/legacy/utils/tree/removeDataRowFromTree.js +97 -0
- package/legacy/utils/tree/sortRowTree.js +49 -43
- package/legacy/utils/tree/updateRowTree.js +81 -0
- package/legacy/utils/tree/utils.js +184 -0
- package/models/dataGridProProps.d.ts +3 -3
- package/modern/DataGridPro/DataGridPro.js +4 -14
- package/modern/DataGridPro/useDataGridProProps.js +2 -2
- package/modern/components/DataGridProVirtualScroller.js +2 -2
- package/modern/components/GridDetailPanelToggleCell.js +1 -1
- package/modern/components/GridRowReorderCell.js +4 -4
- package/modern/components/GridTreeDataGroupingCell.js +1 -1
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +2 -2
- package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/modern/hooks/features/lazyLoader/useGridLazyLoader.js +20 -9
- package/modern/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +20 -6
- package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +60 -23
- package/modern/hooks/features/rowReorder/useGridRowReorder.js +5 -3
- package/modern/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/modern/hooks/features/treeData/gridTreeDataUtils.js +13 -9
- package/modern/hooks/features/treeData/useGridTreeData.js +2 -4
- package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +35 -18
- package/modern/index.js +1 -1
- package/modern/internals/index.js +4 -2
- package/modern/utils/tree/createRowTree.js +35 -0
- package/modern/utils/tree/index.js +1 -1
- package/modern/utils/tree/insertDataRowInTree.js +127 -0
- package/modern/utils/tree/models.js +1 -0
- package/modern/utils/tree/removeDataRowFromTree.js +100 -0
- package/modern/utils/tree/sortRowTree.js +46 -40
- package/modern/utils/tree/updateRowTree.js +83 -0
- package/modern/utils/tree/utils.js +180 -0
- package/node/DataGridPro/DataGridPro.js +4 -14
- package/node/DataGridPro/useDataGridProProps.js +1 -1
- package/node/components/DataGridProVirtualScroller.js +1 -1
- package/node/components/GridDetailPanelToggleCell.js +1 -1
- package/node/components/GridRowReorderCell.js +3 -5
- package/node/components/GridTreeDataGroupingCell.js +1 -1
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +1 -1
- package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
- package/node/hooks/features/infiniteLoader/useGridInfiniteLoader.js +1 -1
- package/node/hooks/features/lazyLoader/useGridLazyLoader.js +19 -8
- package/node/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +18 -5
- package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +63 -26
- package/node/hooks/features/rowReorder/useGridRowReorder.js +4 -4
- package/node/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/node/hooks/features/treeData/gridTreeDataUtils.js +14 -12
- package/node/hooks/features/treeData/useGridTreeData.js +1 -5
- package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +35 -17
- package/node/index.js +1 -1
- package/node/internals/index.js +35 -10
- package/node/utils/tree/createRowTree.js +46 -0
- package/node/utils/tree/index.js +2 -2
- package/node/utils/tree/insertDataRowInTree.js +139 -0
- package/node/utils/tree/models.js +5 -0
- package/node/utils/tree/removeDataRowFromTree.js +110 -0
- package/node/utils/tree/sortRowTree.js +50 -43
- package/node/utils/tree/updateRowTree.js +98 -0
- package/node/utils/tree/utils.js +217 -0
- package/package.json +5 -5
- package/utils/tree/createRowTree.d.ts +15 -0
- package/utils/tree/createRowTree.js +35 -0
- package/utils/tree/index.d.ts +1 -1
- package/utils/tree/index.js +1 -1
- package/utils/tree/insertDataRowInTree.d.ts +51 -0
- package/utils/tree/insertDataRowInTree.js +129 -0
- package/utils/tree/models.d.ts +13 -0
- package/utils/tree/models.js +1 -0
- package/utils/tree/removeDataRowFromTree.d.ts +40 -0
- package/utils/tree/removeDataRowFromTree.js +100 -0
- package/utils/tree/sortRowTree.d.ts +6 -1
- package/utils/tree/sortRowTree.js +46 -40
- package/utils/tree/updateRowTree.d.ts +19 -0
- package/utils/tree/updateRowTree.js +83 -0
- package/utils/tree/utils.d.ts +66 -0
- package/utils/tree/utils.js +186 -0
- package/legacy/utils/tree/buildRowTree.js +0 -195
- package/modern/utils/tree/buildRowTree.js +0 -174
- package/node/utils/tree/buildRowTree.js +0 -195
- package/utils/tree/buildRowTree.d.ts +0 -48
- package/utils/tree/buildRowTree.js +0 -186
package/CHANGELOG.md
CHANGED
|
@@ -3,37 +3,315 @@
|
|
|
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
|
-
##
|
|
6
|
+
## 6.0.0-alpha.1
|
|
7
7
|
|
|
8
8
|
_Sep 29, 2022_
|
|
9
9
|
|
|
10
|
-
We'd like to offer a big thanks to the
|
|
10
|
+
We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
12
|
+
- 🚀 Better support for custom overlays (#5808) @cherniavskii
|
|
13
|
+
- 🖨️ Improve print export (#6273) @oliviertassinari
|
|
14
|
+
- 🎁 Reduce confusion when initializing pickers with a date value (#6170) @flaviendelangle
|
|
15
|
+
- 📚 Documentation improvements
|
|
15
16
|
- 🐞 Bugfixes
|
|
16
17
|
|
|
17
|
-
### `@mui/x-data-grid@
|
|
18
|
+
### `@mui/x-data-grid@v6.0.0-alpha.1` / `@mui/x-data-grid-pro@v6.0.0-alpha.1` / `@mui/x-data-grid-premium@v6.0.0-alpha.1`
|
|
19
|
+
|
|
20
|
+
#### Breaking changes
|
|
21
|
+
|
|
22
|
+
- New internal rows structure for v6 (#4927) @flaviendelangle
|
|
23
|
+
|
|
24
|
+
Some selectors related to the rows have been renamed to better describe the type of rows they are returning:
|
|
25
|
+
|
|
26
|
+
```diff
|
|
27
|
+
-const result = gridRowsIdToIdLookupSelector(apiRef);
|
|
28
|
+
+const result = gridRowsDataRowIdToIdLookupSelector(apiRef);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```diff
|
|
32
|
+
-const result = gridRowTreeDepthSelector(apiRef);
|
|
33
|
+
+const result = gridRowMaximumTreeDepthSelector(apiRef);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
The format of the tree nodes (the element accessible in `params.node` or with the `apiRef.current.getRowNode` method) have changed.
|
|
37
|
+
You have a new `type` property, which can be useful, for example, to apply custom behavior on groups.
|
|
38
|
+
Here is an example of the old and new approach showing how to apply a custom value formatter in groups for the grouping column:
|
|
39
|
+
|
|
40
|
+
```diff
|
|
41
|
+
<DataGridPremium
|
|
42
|
+
groupingColDef={() => ({
|
|
43
|
+
valueFormatter: (params) => {
|
|
44
|
+
if (params.id == null) {
|
|
45
|
+
return params.value;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const rowNode = apiRef.current.getRowNode(params.id!)!;
|
|
49
|
+
- if (rowNode.children?.length) {
|
|
50
|
+
+ if (rowNode.type === 'group') {
|
|
51
|
+
return `by ${rowNode.groupingKey ?? ''}`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return params.value;
|
|
55
|
+
}
|
|
56
|
+
})}
|
|
57
|
+
/>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
- The `GridFeatureModeConstant` constant no longer exists (#6077) @DanailH
|
|
61
|
+
|
|
62
|
+
```diff
|
|
63
|
+
-import { GridFeatureModeConstant } from '@mui/x-data-grid';
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### Changes
|
|
67
|
+
|
|
68
|
+
- [DataGrid] Fix `GridPagination` props typing (#6238) @cherniavskii
|
|
69
|
+
- [DataGrid] Fix `GridRow` not forwarding `ref` to the root element (#6274) @cherniavskii
|
|
70
|
+
- [DataGrid] Fix `undefined` value being showed in filter button tooltip text (#6259) @cherniavskii
|
|
71
|
+
- [DataGrid] Fix blank space when changing page with dynamic row height (#6049) @m4theushw
|
|
72
|
+
- [DataGrid] New internal rows structure for v6 (#4927) @flaviendelangle
|
|
73
|
+
- [DataGrid] Revert cell/row mode if `processRowUpdate` fails (#6185) @m4theushw
|
|
74
|
+
- [DataGrid] Rework overlays layout (#5808) @cherniavskii
|
|
75
|
+
- [DataGrid] Improve print support (#6273) @oliviertassinari
|
|
76
|
+
- [DataGridPremium] Add missing `themeAugmentation` module (#6270) @cherniavskii
|
|
77
|
+
|
|
78
|
+
### `@mui/x-date-pickers@v6.0.0-alpha.1` / `@mui/x-date-pickers-pro@v6.0.0-alpha.1`
|
|
79
|
+
|
|
80
|
+
#### Breaking changes
|
|
81
|
+
|
|
82
|
+
- [pickers] Do not support unparsed date formats anymore (#6170) @flaviendelangle
|
|
83
|
+
|
|
84
|
+
The `value` prop of the pickers now expects a parsed value.
|
|
85
|
+
Until now, it was possible to provide any format that your date management library was able to parse.
|
|
86
|
+
For instance, you could pass `value={new Date()}` when using `AdapterDayjs`.
|
|
87
|
+
|
|
88
|
+
This brought a lot of confusion so we decided to remove this behavior.
|
|
89
|
+
The format expected by the `value` prop is now the same as for any other prop holding a date.
|
|
90
|
+
Here is the syntax to initialize a date picker at the current date for each adapter:
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
// Date-fns
|
|
94
|
+
<DatePicker value={new Date()} />
|
|
95
|
+
|
|
96
|
+
// Dayjs
|
|
97
|
+
import dayjs from 'dayjs'
|
|
98
|
+
<DatePicker value={dayjs()} />
|
|
99
|
+
|
|
100
|
+
// Moment
|
|
101
|
+
import moment from 'moment'
|
|
102
|
+
<DatePicker value={moment()} />
|
|
103
|
+
|
|
104
|
+
// Luxon
|
|
105
|
+
import { DateTime } from 'luxon'
|
|
106
|
+
<DatePicker value={DateTime.now()} />
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### Changes
|
|
110
|
+
|
|
111
|
+
- [DatePicker] Respect `minDate` and `maxDate` when opening a `DatePicker` or `DateTimePicker` (#6309) @alexfauquette
|
|
112
|
+
- [DateTimePicker] Fix validation with `shouldDisableMonth` and `shouldDisableYear` (#6266) @flaviendelangle
|
|
113
|
+
- [TimePicker] Add support for `disablePast` and `disableFuture` validation props (#6226) @LukasTy
|
|
114
|
+
- [CalendarPicker] Prevent getting focus when `autoFocus=false` (#6304) @alexfauquette
|
|
115
|
+
- [DateField] Extend moment adapter to support `expandFormat` and `formatTokenMap` (#6215) @alexfauquette
|
|
116
|
+
- [pickers] Allow to control the selected sections (#6209, #6307) @flaviendelangle
|
|
117
|
+
- [pickers] Do not loose the value of date sections not present in the format in the new field components (#6141) @flaviendelangle
|
|
118
|
+
- [pickers] Do not support unparsed date formats anymore (#6170) @flaviendelangle
|
|
119
|
+
- [pickers] Support slots on the `DateField` component (#6048) @flaviendelangle
|
|
120
|
+
- [pickers] Support Luxon v3 in `AdapterLuxon` (#6069) @alexfauquette
|
|
121
|
+
- [pickers] New components `TimeField` and `DateTimeField` (#6312) @flaviendelangle
|
|
122
|
+
- [pickers] Support basic mobile edition on new field components (#5958) @flaviendelangle
|
|
123
|
+
|
|
124
|
+
### Docs
|
|
125
|
+
|
|
126
|
+
- [docs] Fix issue in DataGrid/DataGridPro row styling demo (#6264) @MBilalShafi
|
|
127
|
+
- [docs] Improve pickers Getting Started examples (#6292) @flaviendelangle
|
|
128
|
+
- [docs] Pass model change callbacks in controlled grid editing demos (#6296) @cherniavskii
|
|
129
|
+
- [docs] Update the CodeSandbox to use the `next` branch (#6275) @oliviertassinari
|
|
130
|
+
|
|
131
|
+
### Core
|
|
132
|
+
|
|
133
|
+
- [core] Fix typing error (#6291) @flaviendelangle
|
|
134
|
+
- [core] Fix typo in the state updater of `useField` (#6311) @flaviendelangle
|
|
135
|
+
- [core] Remove `GridFeatureModeConstant` (#6077) @DanailH
|
|
136
|
+
- [core] Simplify testing architecture (#6043) @flaviendelangle
|
|
137
|
+
- [test] Skip test in Chrome non-headless and Edge (#6318) @m4theushw
|
|
138
|
+
|
|
139
|
+
## 6.0.0-alpha.0
|
|
140
|
+
|
|
141
|
+
_Sep 22, 2022_
|
|
142
|
+
|
|
143
|
+
We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
|
|
144
|
+
|
|
145
|
+
- 🌍 Add a `localeText` prop to all pickers to customize the translations (#6212) @flaviendelangle
|
|
146
|
+
- 🌍 Add Finnish (fi-FI) locale to the pickers (#6219) @PetroSilenius
|
|
147
|
+
- 🌍 Add Persian (fa-IR) locale to the pickers (#6181) @fakhamatia
|
|
148
|
+
- 📚 Documentation improvements
|
|
149
|
+
- 🐞 Bugfixes
|
|
150
|
+
|
|
151
|
+
### `@mui/x-data-grid@v6.0.0-alpha.0` / `@mui/x-data-grid-pro@v6.0.0-alpha.0` / `@mui/x-data-grid-premium@v6.0.0-alpha.0`
|
|
152
|
+
|
|
153
|
+
#### Breaking changes
|
|
154
|
+
|
|
155
|
+
- The deprecated `hide` column property has been removed in favor of the `columnVisibilityModel` prop and initial state.
|
|
156
|
+
|
|
157
|
+
```diff
|
|
158
|
+
<DataGrid
|
|
159
|
+
columns={[
|
|
160
|
+
field: 'id,
|
|
161
|
+
- hide: true,
|
|
162
|
+
]}
|
|
163
|
+
+ initialState={{
|
|
164
|
+
+ columns: {
|
|
165
|
+
+ columnVisibilityModel: { id: false },
|
|
166
|
+
+ }
|
|
167
|
+
+ }}
|
|
168
|
+
/>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
You can find more information about this new API on our [documentation](https://next.mui.com/x/react-data-grid/column-visibility/).
|
|
172
|
+
|
|
173
|
+
- The `GridEvents` enum is now a TypeScript type.
|
|
174
|
+
|
|
175
|
+
```diff
|
|
176
|
+
- apiRef.current.subscribeEvent(GridEvents.rowClick', handleRowClick)
|
|
177
|
+
+ apiRef.current.subscribeEvent('rowClick', handleRowClick)
|
|
178
|
+
```
|
|
18
179
|
|
|
19
180
|
#### Changes
|
|
20
181
|
|
|
21
|
-
- [DataGrid]
|
|
22
|
-
- [DataGrid] Fix
|
|
23
|
-
- [DataGrid]
|
|
24
|
-
- [DataGrid]
|
|
25
|
-
- [DataGrid]
|
|
26
|
-
|
|
182
|
+
- [DataGrid] Do not publish `cellFocusOut` event if the row was removed (#6251) @cherniavskii
|
|
183
|
+
- [DataGrid] Fix scroll anchoring with master details (#6054) @oliviertassinari
|
|
184
|
+
- [DataGrid] Improve Polish (pl-PL) locale on the data grid (#6245) @grzegorz-bach
|
|
185
|
+
- [DataGrid] Remove the `GridEvents` enum (#6003) @flaviendelangle
|
|
186
|
+
- [DataGrid] Remove the deprecated `hide` column property (#5999) @flaviendelangle
|
|
187
|
+
|
|
188
|
+
### `@mui/x-date-pickers@v6.0.0-alpha.0` / `@mui/x-date-pickers-pro@v6.0.0-alpha.0`
|
|
189
|
+
|
|
190
|
+
#### Breaking changes
|
|
191
|
+
|
|
192
|
+
- All the deprecated props that allowed you to set the text displayed in the pickers have been removed.
|
|
193
|
+
|
|
194
|
+
You can now use the `localText` prop available on all picker components:
|
|
195
|
+
|
|
196
|
+
| Removed prop | Property in the new `localText` prop |
|
|
197
|
+
|------------------------------|-----------------------------------------------------------------------------------|
|
|
198
|
+
| `endText` | `end` |
|
|
199
|
+
| `getClockLabelText` | `clockLabelText` |
|
|
200
|
+
| `getHoursClockNumberText` | `hoursClockNumberText` |
|
|
201
|
+
| `getMinutesClockNumberText` | `minutesClockNumberText` |
|
|
202
|
+
| `getSecondsClockNumberText` | `secondsClockNumberText` |
|
|
203
|
+
| `getViewSwitchingButtonText` | `calendarViewSwitchingButtonAriaLabel` |
|
|
204
|
+
| `leftArrowButtonText` | `openPreviousView` (or `previousMonth` when the button changes the visible month) |
|
|
205
|
+
| `rightArrowButtonText` | `openNextView` (or `nextMonth` when the button changes the visible month) |
|
|
206
|
+
| `startText` | `start` |
|
|
207
|
+
|
|
208
|
+
For instance if you want to replace the `startText` / `endText`
|
|
209
|
+
|
|
210
|
+
```diff
|
|
211
|
+
<DateRangePicker
|
|
212
|
+
- startText="From"
|
|
213
|
+
- endText="To"
|
|
214
|
+
+ localeText={{
|
|
215
|
+
+ start: 'From',
|
|
216
|
+
+ end: 'To',
|
|
217
|
+
+ }}
|
|
218
|
+
/>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
You can find more information about the new api, including how to set those translations on all your components at once in the [documentation](https://next.mui.com/x/react-date-pickers/localization/)
|
|
222
|
+
|
|
223
|
+
- The component slots `LeftArrowButton` and `RightArrowButton` have been renamed `PreviousIconButton` and `NextIconButton` to better describe there usage:
|
|
224
|
+
|
|
225
|
+
```diff
|
|
226
|
+
<DatePicker
|
|
227
|
+
components={{
|
|
228
|
+
- LeftArrowButton: CustomButton,
|
|
229
|
+
+ PreviousIconButton: CustomButton,
|
|
230
|
+
|
|
231
|
+
- RightArrowButton: CustomButton,
|
|
232
|
+
+ NextIconButton: CustomButton,
|
|
233
|
+
}}
|
|
234
|
+
|
|
235
|
+
componentsProps={{
|
|
236
|
+
- leftArrowButton: {},
|
|
237
|
+
+ previousIconButton: {},
|
|
238
|
+
|
|
239
|
+
- rightArrowButton: {},
|
|
240
|
+
+ nextIconButton: {},
|
|
241
|
+
}}
|
|
242
|
+
/>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
- The `date` prop has been renamed `value` on `MonthPicker` / `YearPicker`, `ClockPicker` and `CalendarPicker`.
|
|
246
|
+
|
|
247
|
+
```diff
|
|
248
|
+
- <MonthPicker date={dayjs()} onChange={handleMonthChange} />
|
|
249
|
+
+ <MonthPicker value={dayjs()} onChange={handleMonthChange} />
|
|
250
|
+
|
|
251
|
+
- <YearPicker date={dayjs()} onChange={handleYearChange} />
|
|
252
|
+
+ <YearPicker value={dayjs()} onChange={handleYearChange} />
|
|
253
|
+
|
|
254
|
+
- <ClockPicker date={dayjs()} onChange={handleTimeChange} />
|
|
255
|
+
+ <ClockPicker value={dayjs()} onChange={handleTimeChange} />
|
|
256
|
+
|
|
257
|
+
- <CalendarPicker date={dayjs()} onChange={handleDateChange} />
|
|
258
|
+
+ <CalendarPicker value={dayjs()} onChange={handleDateChange} />
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### Changes
|
|
262
|
+
|
|
263
|
+
- [CalendarPicker] Don't move to closest enabled date when `props.date` contains a disabled date (#6146) @flaviendelangle
|
|
264
|
+
- [DateRangePicker] Switch to new month when changing the value from the outside (#6166) @flaviendelangle
|
|
265
|
+
- [pickers] Add a `localeText` prop to all pickers to customize the translations (#6212) @flaviendelangle
|
|
266
|
+
- [pickers] Add Finnish (fi-FI) locale to the pickers (#6219) (#6230) @PetroSilenius
|
|
267
|
+
- [pickers] Add Persian (fa-IR) locale to the pickers (#6181) @fakhamatia
|
|
268
|
+
- [pickers] Allow nested `LocalizationProvider` (#6011) @flaviendelangle
|
|
269
|
+
- [pickers] Clean slots on `PickersArrowSwitcher` component (#5890) @flaviendelangle
|
|
270
|
+
- [pickers] Fix invalid date error when decreasing `DateField` day (#6071) @alexfauquette
|
|
271
|
+
- [pickers] Fix mobile section selection (#6207) @oliviertassinari
|
|
272
|
+
- [pickers] Fix usage with Typescript 4.8 (#6229) @flaviendelangle
|
|
273
|
+
- [pickers] Improve error message when no adapter context is found (#6211) @flaviendelangle
|
|
274
|
+
- [pickers] Remove `valueStr` from the field state (#6142) @flaviendelangle
|
|
275
|
+
- [pickers] Remove remaining deprecated locale props (#6233) @flaviendelangle
|
|
276
|
+
- [pickers] Rename the `date` prop `value` on `MonthPicker` / `YearPicker`, `ClockPicker` and `CalendarPicker` (#6128) @flaviendelangle
|
|
277
|
+
- [pickers] Rename the `onClose` prop of `PickersPopper` `onDismiss` to simplify typing (#6155) @flaviendelangle
|
|
278
|
+
- [pickers] Support the `sx` prop on all public component with a root HTML elements (#5944) @flaviendelangle
|
|
279
|
+
- [pickers] Unify `PickersMonth` and `PickersYear` behaviors (#6034) @flaviendelangle
|
|
280
|
+
- [pickers] Use `shouldDisableMonth` and `shouldDisableYear` for date validation (#6066) @flaviendelangle
|
|
281
|
+
- [YearPicker] Scroll to the current year even with `autoFocus=false` (#6224) @alexfauquette
|
|
27
282
|
|
|
28
283
|
### Docs
|
|
29
284
|
|
|
30
|
-
- [docs]
|
|
285
|
+
- [docs] Add automatic vale check (#5429) @alexfauquette
|
|
286
|
+
- [docs] Add Pro logo in "column ordering" link (#6127) @alexfauquette
|
|
287
|
+
- [docs] Fix 301 link (#6239) @oliviertassinari
|
|
288
|
+
- [docs] Fix broken link (#6163) @alexfauquette
|
|
289
|
+
- [docs] Fix broken links (#6101) @alexfauquette
|
|
290
|
+
- [docs] Fix demonstration date to avoid hydration errors (#6032) @alexfauquette
|
|
291
|
+
- [docs] Fix hidden popper in restore state example (#6191) @heyfirst
|
|
292
|
+
- [docs] Fix invalid links causing 404 & 301 errors (#6105) @oliviertassinari
|
|
293
|
+
- [docs] Fix npm repository url in the pickers `package.json` (#6172) @oliviertassinari
|
|
294
|
+
- [docs] Fix typo in linked issue (#6162) @flaviendelangle
|
|
295
|
+
- [docs] Import `generateUtilityClass` from `@mui/utils` (#6216) @michaldudak
|
|
296
|
+
- [docs] Improve Upgrade plan docs (#6018) @oliviertassinari
|
|
297
|
+
- [docs] Link the OpenSSF Best Practices card (#6171) @oliviertassinari
|
|
31
298
|
|
|
32
299
|
### Core
|
|
33
300
|
|
|
34
|
-
- [core]
|
|
301
|
+
- [core] Add `v5.17.3` changelog to next branch (#6250) @flaviendelangle
|
|
302
|
+
- [core] Add link to the security page on the `README` (#6073) @oliviertassinari
|
|
303
|
+
- [core] Fix scroll restoration in the docs (#5938) @oliviertassinari
|
|
304
|
+
- [core] Remove the Storybook (#6099) @flaviendelangle
|
|
305
|
+
- [core] Tag release as `next` in NPM (#6256) @m4theushw
|
|
306
|
+
- [core] Update monorepo (#6180) @flaviendelangle
|
|
307
|
+
- [core] Use the `next` branch for Prettier (#6097) @flaviendelangle
|
|
308
|
+
- [core] Use the official repository for `@mui/monorepo` instead of a fork (#6189) @oliviertassinari
|
|
309
|
+
- [test] Fix logic to skip column pinning tests (#6133) @m4theushw
|
|
310
|
+
- [test] Hide the date on the print regression test (#6120) @flaviendelangle
|
|
311
|
+
- [test] Skip tests for column pinning and dynamic row height (#5997) @m4theushw
|
|
312
|
+
- [website] Improve security header @oliviertassinari
|
|
35
313
|
|
|
36
|
-
##
|
|
314
|
+
## v5.17.4
|
|
37
315
|
|
|
38
316
|
_Sep 22, 2022_
|
|
39
317
|
|
|
@@ -165,7 +443,7 @@ We'd like to offer a big thanks to the 3 contributors who made this release poss
|
|
|
165
443
|
|
|
166
444
|
_Sep 2, 2022_
|
|
167
445
|
|
|
168
|
-
🎉 We are excited to finally introduce a stable release (v5.0.0) for the `@mui/x-date-pickers` and
|
|
446
|
+
🎉 We are excited to finally introduce a stable release (v5.0.0) for the `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` packages!
|
|
169
447
|
|
|
170
448
|
If you are still using picker components from the `lab`, take a look at the [migration guide](https://mui.com/x/react-date-pickers/migration-lab/).
|
|
171
449
|
|
|
@@ -1470,7 +1748,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
1470
1748
|
- [DataGrid] Stop checkbox ripple on blur (#3835) @m4theushw
|
|
1471
1749
|
- [DataGrid] Stop calling `onRowClick` when clicking in cells with interactive elements (#3929) @m4theushw
|
|
1472
1750
|
- [DataGrid] Use only `headerName` when available to search column (#3959) @pkratz
|
|
1473
|
-
- [DataGrid] Use the bundling scripts as the packages published by the [https://github.com/mui/material-ui
|
|
1751
|
+
- [DataGrid] Use the bundling scripts as the packages published by the [material-ui](https://github.com/mui/material-ui) repository (#3965) @flaviendelangle
|
|
1474
1752
|
- [DataGridPro] Add `unstable_setRowHeight` method to `apiRef` (#3751) @cherniavskii
|
|
1475
1753
|
- [DataGridPro] Always export the `pageSize` and `page` when it has been initialized or is being controlled (#3908) @flaviendelangle
|
|
1476
1754
|
- [DataGridPro] Disable export for detail panel column (#4057) @gustavhagland
|
|
@@ -4115,7 +4393,7 @@ Big thanks to the 7 contributors who made this release possible. Here are some h
|
|
|
4115
4393
|
|
|
4116
4394
|
- 💄 Release the cell editing feature (#1287) @dtassone
|
|
4117
4395
|
|
|
4118
|
-
This is the first release of the Cell editing feature. You can find the documentation [following this link](https://mui.com/x/react-data-grid/editing
|
|
4396
|
+
This is the first release of the Cell editing feature. You can find the documentation [following this link](https://mui.com/x/react-data-grid/editing/). We have spent the last three months working on it.
|
|
4119
4397
|
|
|
4120
4398
|

|
|
4121
4399
|
|
|
@@ -4725,7 +5003,7 @@ _Dec 9, 2020_
|
|
|
4725
5003
|
|
|
4726
5004
|
Big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
4727
5005
|
|
|
4728
|
-
- 🔍 Add a new data grid [density selector](https://mui.com/x/react-data-grid/
|
|
5006
|
+
- 🔍 Add a new data grid [density selector](https://mui.com/x/react-data-grid/accessibility/#density) feature (#606) @DanailH.
|
|
4729
5007
|
- 💄 A first iteration on the data grid's toolbar.
|
|
4730
5008
|
- 🧪 Continue the iteration on the data grid filtering feature, soon to be released @dtassone.
|
|
4731
5009
|
|
|
@@ -437,7 +437,7 @@ DataGridProRaw.propTypes = {
|
|
|
437
437
|
/**
|
|
438
438
|
* Determines if a group should be expanded after its creation.
|
|
439
439
|
* This prop takes priority over the `defaultGroupingExpansionDepth` prop.
|
|
440
|
-
* @param {
|
|
440
|
+
* @param {GridGroupNode} node The node of the group to test.
|
|
441
441
|
* @returns {boolean} A boolean indicating if the group is expanded.
|
|
442
442
|
*/
|
|
443
443
|
isGroupExpandedByDefault: PropTypes.func,
|
|
@@ -615,16 +615,6 @@ DataGridProRaw.propTypes = {
|
|
|
615
615
|
*/
|
|
616
616
|
onColumnResize: PropTypes.func,
|
|
617
617
|
|
|
618
|
-
/**
|
|
619
|
-
* Callback fired when a column visibility changes.
|
|
620
|
-
* Only works when no `columnVisibilityModel` is provided and if we change the visibility of a single column at a time.
|
|
621
|
-
* @param {GridColumnVisibilityChangeParams} params With all properties from [[GridColumnVisibilityChangeParams]].
|
|
622
|
-
* @param {MuiEvent<{}>} event The event object.
|
|
623
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
624
|
-
* @deprecated Use `onColumnVisibilityModelChange` instead.
|
|
625
|
-
*/
|
|
626
|
-
onColumnVisibilityChange: PropTypes.func,
|
|
627
|
-
|
|
628
618
|
/**
|
|
629
619
|
* Callback fired when the column visibility model changes.
|
|
630
620
|
* @param {GridColumnVisibilityModel} model The new model.
|
|
@@ -876,8 +866,8 @@ DataGridProRaw.propTypes = {
|
|
|
876
866
|
* Rows data to pin on top or bottom.
|
|
877
867
|
*/
|
|
878
868
|
pinnedRows: PropTypes.shape({
|
|
879
|
-
bottom: PropTypes.
|
|
880
|
-
top: PropTypes.
|
|
869
|
+
bottom: PropTypes.arrayOf(PropTypes.object),
|
|
870
|
+
top: PropTypes.arrayOf(PropTypes.object)
|
|
881
871
|
}),
|
|
882
872
|
|
|
883
873
|
/**
|
|
@@ -922,7 +912,7 @@ DataGridProRaw.propTypes = {
|
|
|
922
912
|
/**
|
|
923
913
|
* Set of rows of type [[GridRowsProp]].
|
|
924
914
|
*/
|
|
925
|
-
rows: PropTypes.
|
|
915
|
+
rows: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
926
916
|
|
|
927
917
|
/**
|
|
928
918
|
* Loading rows can be processed on the server or client-side.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useThemeProps } from '@mui/material/styles';
|
|
4
|
-
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES
|
|
4
|
+
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS, GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES } from '@mui/x-data-grid';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The default values of `DataGridProPropsWithDefaultValue` to inject in the props of DataGridPro.
|
|
@@ -14,7 +14,7 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
|
|
|
14
14
|
disableChildrenFiltering: false,
|
|
15
15
|
disableChildrenSorting: false,
|
|
16
16
|
rowReordering: false,
|
|
17
|
-
rowsLoadingMode:
|
|
17
|
+
rowsLoadingMode: 'client',
|
|
18
18
|
getDetailPanelHeight: () => 500
|
|
19
19
|
});
|
|
20
20
|
export const useDataGridProProps = inProps => {
|
|
@@ -4,7 +4,7 @@ const _excluded = ["className", "disableVirtualization"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { styled, alpha } from '@mui/material/styles';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
7
|
-
import { useGridSelector, getDataGridUtilityClass, gridClasses, gridVisibleColumnFieldsSelector, gridRowsMetaSelector, useGridApiEventHandler } from '@mui/x-data-grid';
|
|
7
|
+
import { useGridSelector, getDataGridUtilityClass, gridClasses, gridVisibleColumnFieldsSelector, gridRowsMetaSelector, useGridApiEventHandler, GridOverlays } from '@mui/x-data-grid';
|
|
8
8
|
import { GridVirtualScroller, GridVirtualScrollerContent, GridVirtualScrollerRenderZone, useGridVirtualScroller, calculatePinnedRowsHeight } from '@mui/x-data-grid/internals';
|
|
9
9
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
10
10
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
@@ -299,7 +299,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
return /*#__PURE__*/_jsxs(GridVirtualScroller, _extends({}, getRootProps(other), {
|
|
302
|
-
children: [topPinnedRowsData.length > 0 ? /*#__PURE__*/_jsxs(VirtualScrollerPinnedRows, {
|
|
302
|
+
children: [/*#__PURE__*/_jsx(GridOverlays, {}), topPinnedRowsData.length > 0 ? /*#__PURE__*/_jsxs(VirtualScrollerPinnedRows, {
|
|
303
303
|
className: classes.topPinnedRows,
|
|
304
304
|
ownerState: {
|
|
305
305
|
position: 'top'
|
|
@@ -116,7 +116,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
116
116
|
/**
|
|
117
117
|
* The row model of the row that the current cell belongs to.
|
|
118
118
|
*/
|
|
119
|
-
row: PropTypes.
|
|
119
|
+
row: PropTypes.any.isRequired,
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
122
|
* The node of the row that the current cell belongs to.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
4
|
-
import {
|
|
4
|
+
import { gridRowMaximumTreeDepthSelector, gridSortModelSelector, useGridApiContext, useGridSelector, getDataGridUtilityClass, gridEditRowsStateSelector } from '@mui/x-data-grid';
|
|
5
5
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -19,12 +19,10 @@ const useUtilityClasses = ownerState => {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const GridRowReorderCell = params => {
|
|
22
|
-
var _params$rowNode$posit;
|
|
23
|
-
|
|
24
22
|
const apiRef = useGridApiContext();
|
|
25
23
|
const rootProps = useGridRootProps();
|
|
26
24
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
27
|
-
const treeDepth = useGridSelector(apiRef,
|
|
25
|
+
const treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
28
26
|
const editRowsState = useGridSelector(apiRef, gridEditRowsStateSelector); // eslint-disable-next-line no-underscore-dangle
|
|
29
27
|
|
|
30
28
|
const cellValue = params.row.__reorder__ || params.id; // TODO: remove sortModel and treeDepth checks once row reorder is compatible
|
|
@@ -60,7 +58,7 @@ const GridRowReorderCell = params => {
|
|
|
60
58
|
onDragEnd: publish('rowDragEnd')
|
|
61
59
|
} : null;
|
|
62
60
|
|
|
63
|
-
if (
|
|
61
|
+
if (params.rowNode.type === 'footer') {
|
|
64
62
|
return null;
|
|
65
63
|
}
|
|
66
64
|
|
|
@@ -77,7 +75,7 @@ const GridRowReorderCell = params => {
|
|
|
77
75
|
|
|
78
76
|
export { GridRowReorderCell };
|
|
79
77
|
export const renderRowReorderCell = params => {
|
|
80
|
-
if (params.rowNode.
|
|
78
|
+
if (params.rowNode.type === 'footer' || params.rowNode.type === 'pinnedRow') {
|
|
81
79
|
return null;
|
|
82
80
|
}
|
|
83
81
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
|
-
interface GridTreeDataGroupingCellProps extends GridRenderCellParams {
|
|
2
|
+
import { GridRenderCellParams, GridGroupNode } from '@mui/x-data-grid';
|
|
3
|
+
interface GridTreeDataGroupingCellProps extends GridRenderCellParams<any, any, any, GridGroupNode> {
|
|
4
4
|
hideDescendantCount?: boolean;
|
|
5
5
|
}
|
|
6
6
|
declare const GridTreeDataGroupingCell: {
|
|
@@ -151,7 +151,7 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
151
151
|
/**
|
|
152
152
|
* The row model of the row that the current cell belongs to.
|
|
153
153
|
*/
|
|
154
|
-
row: PropTypes.
|
|
154
|
+
row: PropTypes.any.isRequired,
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
157
|
* The node of the row that the current cell belongs to.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useGridSelector, useGridApiEventHandler, useGridApiMethod,
|
|
3
|
+
import { useGridSelector, useGridApiEventHandler, useGridApiMethod, gridDataRowIdsSelector } from '@mui/x-data-grid';
|
|
4
4
|
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
5
5
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from './gridDetailPanelToggleColDef';
|
|
6
6
|
import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector, gridDetailPanelRawHeightCacheSelector } from './gridDetailPanelSelector';
|
|
@@ -22,7 +22,7 @@ function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeig
|
|
|
22
22
|
// only call getDetailPanelContent when asked for an id
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
const rowIds =
|
|
25
|
+
const rowIds = gridDataRowIdsSelector(apiRef);
|
|
26
26
|
const contentCache = rowIds.reduce((acc, id) => {
|
|
27
27
|
const params = apiRef.current.getRowParams(id);
|
|
28
28
|
acc[id] = getDetailPanelContent(params);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useGridApiEventHandler,
|
|
3
|
+
import { useGridApiEventHandler, gridDataRowIdsSelector } from '@mui/x-data-grid';
|
|
4
4
|
|
|
5
5
|
function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeight, previousHeightCache) {
|
|
6
6
|
if (typeof getDetailPanelContent !== 'function') {
|
|
@@ -9,7 +9,7 @@ function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeig
|
|
|
9
9
|
// only call getDetailPanelContent when asked for an id
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
const rowIds =
|
|
12
|
+
const rowIds = gridDataRowIdsSelector(apiRef);
|
|
13
13
|
const contentCache = rowIds.reduce((acc, id) => {
|
|
14
14
|
const params = apiRef.current.getRowParams(id);
|
|
15
15
|
acc[id] = getDetailPanelContent(params);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useGridSelector, useGridApiEventHandler, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, gridRowsMetaSelector
|
|
2
|
+
import { useGridSelector, useGridApiEventHandler, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, gridRowsMetaSelector } from '@mui/x-data-grid';
|
|
3
3
|
import { useGridVisibleRows } from '@mui/x-data-grid/internals';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -16,7 +16,7 @@ export const useGridInfiniteLoader = (apiRef, props) => {
|
|
|
16
16
|
const handleRowsScrollEnd = React.useCallback(scrollPosition => {
|
|
17
17
|
const dimensions = apiRef.current.getRootDimensions(); // Prevent the infite loading working in combination with lazy loading
|
|
18
18
|
|
|
19
|
-
if (!dimensions || props.rowsLoadingMode !==
|
|
19
|
+
if (!dimensions || props.rowsLoadingMode !== 'client') {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useGridApiEventHandler,
|
|
2
|
+
import { useGridApiEventHandler, useGridSelector, gridSortModelSelector, gridFilterModelSelector, useGridApiOptionHandler } from '@mui/x-data-grid';
|
|
3
3
|
import { useGridVisibleRows, getRenderableIndexes } from '@mui/x-data-grid/internals';
|
|
4
4
|
|
|
5
|
-
function findSkeletonRowsSection(
|
|
5
|
+
function findSkeletonRowsSection({
|
|
6
|
+
apiRef,
|
|
7
|
+
visibleRows,
|
|
8
|
+
range
|
|
9
|
+
}) {
|
|
6
10
|
let {
|
|
7
11
|
firstRowIndex,
|
|
8
12
|
lastRowIndex
|
|
@@ -13,16 +17,19 @@ function findSkeletonRowsSection(visibleRows, range) {
|
|
|
13
17
|
let isSkeletonSectionFound = false;
|
|
14
18
|
|
|
15
19
|
while (!isSkeletonSectionFound && firstRowIndex < lastRowIndex) {
|
|
16
|
-
|
|
20
|
+
const isStartingWithASkeletonRow = apiRef.current.getRowNode(visibleRowsSection[startIndex].id).type === 'skeletonRow';
|
|
21
|
+
const isEndingWithASkeletonRow = apiRef.current.getRowNode(visibleRowsSection[endIndex].id).type === 'skeletonRow';
|
|
22
|
+
|
|
23
|
+
if (isStartingWithASkeletonRow && isEndingWithASkeletonRow) {
|
|
17
24
|
isSkeletonSectionFound = true;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
|
-
if (
|
|
27
|
+
if (!isStartingWithASkeletonRow) {
|
|
21
28
|
startIndex += 1;
|
|
22
29
|
firstRowIndex += 1;
|
|
23
30
|
}
|
|
24
31
|
|
|
25
|
-
if (
|
|
32
|
+
if (!isEndingWithASkeletonRow) {
|
|
26
33
|
endIndex -= 1;
|
|
27
34
|
lastRowIndex -= 1;
|
|
28
35
|
}
|
|
@@ -43,7 +50,7 @@ function isLazyLoadingDisabled({
|
|
|
43
50
|
return true;
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
if (rowsLoadingMode !==
|
|
53
|
+
if (rowsLoadingMode !== 'server') {
|
|
47
54
|
return true;
|
|
48
55
|
}
|
|
49
56
|
|
|
@@ -107,9 +114,13 @@ export const useGridLazyLoader = (apiRef, props) => {
|
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
if (sortModel.length === 0 && filterModel.items.length === 0) {
|
|
110
|
-
const skeletonRowsSection = findSkeletonRowsSection(
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
const skeletonRowsSection = findSkeletonRowsSection({
|
|
118
|
+
apiRef,
|
|
119
|
+
visibleRows: visibleRows.rows,
|
|
120
|
+
range: {
|
|
121
|
+
firstRowIndex: params.firstRowToRender,
|
|
122
|
+
lastRowIndex: params.lastRowToRender
|
|
123
|
+
}
|
|
113
124
|
});
|
|
114
125
|
|
|
115
126
|
if (!skeletonRowsSection) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
3
2
|
import { GridApiPro } from '../../../models/gridApiPro';
|
|
3
|
+
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
4
4
|
export declare const GRID_SKELETON_ROW_ROOT_ID = "auto-generated-skeleton-row-root";
|
|
5
5
|
export declare const useGridLazyLoaderPreProcessors: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'rowCount' | 'rowsLoadingMode' | 'experimentalFeatures'>) => void;
|