@mui/x-data-grid-pro 5.12.0 → 5.12.3
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 +160 -7
- package/DataGridPro/useDataGridProComponent.js +1 -3
- package/components/DataGridProColumnHeaders.js +10 -7
- package/components/GridRowReorderCell.js +3 -3
- package/hooks/features/columnPinning/useGridColumnPinning.d.ts +1 -1
- package/hooks/features/columnPinning/useGridColumnPinning.js +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +32 -15
- package/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -2
- package/hooks/features/detailPanel/useGridDetailPanel.d.ts +1 -1
- package/hooks/features/detailPanel/useGridDetailPanel.js +78 -18
- package/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +5 -2
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.d.ts +2 -2
- package/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +0 -1
- package/internals/index.js +0 -1
- package/legacy/DataGridPro/useDataGridProComponent.js +1 -3
- package/legacy/components/DataGridProColumnHeaders.js +10 -7
- package/legacy/components/GridRowReorderCell.js +3 -3
- package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +1 -1
- package/legacy/hooks/features/columnResize/useGridColumnResize.js +32 -15
- package/legacy/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +3 -1
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +78 -18
- package/legacy/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +5 -2
- package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +0 -1
- package/legacy/utils/releaseInfo.js +1 -1
- package/modern/DataGridPro/useDataGridProComponent.js +1 -3
- package/modern/components/DataGridProColumnHeaders.js +11 -6
- package/modern/components/GridRowReorderCell.js +3 -3
- package/modern/hooks/features/columnPinning/useGridColumnPinning.js +1 -1
- package/modern/hooks/features/columnResize/useGridColumnResize.js +32 -15
- package/modern/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -2
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +76 -16
- package/modern/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +5 -2
- package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
- package/modern/index.js +1 -1
- package/modern/internals/index.js +0 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPro/useDataGridProComponent.js +1 -4
- package/node/components/DataGridProColumnHeaders.js +11 -7
- package/node/components/GridRowReorderCell.js +3 -3
- package/node/hooks/features/columnPinning/useGridColumnPinning.js +1 -1
- package/node/hooks/features/columnResize/useGridColumnResize.js +32 -14
- package/node/hooks/features/detailPanel/gridDetailPanelToggleColDef.js +2 -2
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +76 -17
- package/node/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +8 -2
- package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +0 -9
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +6 -5
- package/utils/releaseInfo.js +1 -1
- package/hooks/features/detailPanel/useGridDetailPanelCache.d.ts +0 -4
- package/hooks/features/detailPanel/useGridDetailPanelCache.js +0 -57
- package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +0 -57
- package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +0 -57
- package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +0 -74
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,157 @@
|
|
|
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
|
+
## v5.12.3
|
|
7
|
+
|
|
8
|
+
_Jun 23, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Add Swedish (sv-SE) locale on the data grid and the pickers (#5210) @mrxdst
|
|
13
|
+
- 🌍 Add Dutch (nl-NL) locale on the pickers (#5237) @DDukers
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
|
|
17
|
+
### `@mui/x-data-grid@v5.12.3` / `@mui/x-data-grid-pro@v5.12.3` / `@mui/x-data-grid-premium@v5.12.3`
|
|
18
|
+
|
|
19
|
+
#### Changes
|
|
20
|
+
|
|
21
|
+
- [DataGrid] Do not hide non-hideable column when pressing Hide All button (#5298) @flaviendelangle
|
|
22
|
+
- [DataGrid] Do not regenerate the row tree when the `loading` prop changes (#5213) @flaviendelangle
|
|
23
|
+
- [DataGrid] Fix the default filter operator fallback on state initialization (#5266) @flaviendelangle
|
|
24
|
+
- [DataGrid] Stop using the deprecated `api` prop in the grid components (#5205) @flaviendelangle
|
|
25
|
+
- [DataGrid] Add Swedish (sv-SE) locale (#5210) @mrxdst
|
|
26
|
+
- [DataGridPremium] Fix detail panel on `DataGridPremium` (#5264) @flaviendelangle
|
|
27
|
+
- [DataGridPremium] Fix Excel import with Remix / Vite (#5207) @alexfauquette
|
|
28
|
+
- [DataGridPremium] Fix error with quick filter and grouping rows (#5238) @alexfauquette
|
|
29
|
+
|
|
30
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.7` / `@mui/x-date-pickers-pro@v5.0.0-alpha.7`
|
|
31
|
+
|
|
32
|
+
#### Changes
|
|
33
|
+
|
|
34
|
+
- [pickers] Export adapters from both `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` (#5204) @flaviendelangle
|
|
35
|
+
- [pickers] Add Dutch (nl-NL) locale (#5237) @DDukers
|
|
36
|
+
|
|
37
|
+
### Docs
|
|
38
|
+
|
|
39
|
+
- [docs] Add `DataGridPremium` to all API sections (#5196) @flaviendelangle
|
|
40
|
+
- [docs] Add plan badge next to event name in the Events page (#5200) @flaviendelangle
|
|
41
|
+
- [docs] Add section for theme augmentation in the picker docs (#5276) @flaviendelangle
|
|
42
|
+
- [docs] Add waiting for upvote section for row group panel (#5271) @flaviendelangle
|
|
43
|
+
- [docs] Disable ad on main demo page (#5301) @joserodolfofreitas
|
|
44
|
+
- [docs] Fix typo in the `DateRangePicker` documentation (#5259) @flaviendelangle
|
|
45
|
+
|
|
46
|
+
### Core
|
|
47
|
+
|
|
48
|
+
- [core] Allow having multiple playgrounds (#5288) @alexfauquette
|
|
49
|
+
- [core] Improve typing of `GridFilterInputMultipleSingleSelect` (#5206) @flaviendelangle
|
|
50
|
+
- [core] Remove arbitrary new lines (#5245) @oliviertassinari
|
|
51
|
+
- [core] Remove dead logic (#5282) @oliviertassinari
|
|
52
|
+
- [test] Fix `inputFormat` when testing with different date adapters (#5291) @cherniavskii
|
|
53
|
+
- [test] Fix date assertion in Safari 13 (#5221) @m4theushw
|
|
54
|
+
- [test] Throw if date adapter is not found (#5289) @cherniavskii
|
|
55
|
+
- [test] Use mock for `ResizeObserver` (#5215) @m4theushw
|
|
56
|
+
|
|
57
|
+
## v5.12.2
|
|
58
|
+
|
|
59
|
+
_Jun 16, 2022_
|
|
60
|
+
|
|
61
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
62
|
+
|
|
63
|
+
- 🚀 Performance improvement for dynamic row height (#5135) @m4theushw
|
|
64
|
+
- 🕒 Add demo of how to use the data grid with date pickers (#5053) @cherniavskii
|
|
65
|
+
- 📚 Documentation improvements
|
|
66
|
+
- 🐞 Bugfixes
|
|
67
|
+
|
|
68
|
+
### `@mui/x-data-grid@v5.12.2` / `@mui/x-data-grid-pro@v5.12.2` / `@mui/x-data-grid-premium@v5.12.2`
|
|
69
|
+
|
|
70
|
+
#### Changes
|
|
71
|
+
|
|
72
|
+
- [DataGrid] Fix for cosmetic bug on column filter badge (#5170) @simbahandiane
|
|
73
|
+
- [DataGrid] Hide vertical scrollbar if `autoHeight` is enabled (#5164) @m4theushw
|
|
74
|
+
- [DataGrid] Use exponential search to render non-measured rows (#5135) @m4theushw
|
|
75
|
+
- [DataGridPro] Fix label of the detail panel toggle column (#5191) @m4theushw
|
|
76
|
+
- [DataGridPro] Refresh detail panel caches when props change (#5110) @m4theushw
|
|
77
|
+
|
|
78
|
+
### Docs
|
|
79
|
+
|
|
80
|
+
- [docs] Add example with custom checkbox column (#5161) @flaviendelangle
|
|
81
|
+
- [docs] Batch small changes (#5177) @oliviertassinari
|
|
82
|
+
- [docs] Fix demo currency format (#5034) @oliviertassinari
|
|
83
|
+
- [docs] Fix outdated license description to match the EULA (#5219) @joserodolfofreitas
|
|
84
|
+
- [docs] Fix redundant headers (#5104) @oliviertassinari
|
|
85
|
+
- [docs] Fix some capitalization to match the guidelines (#5105) @oliviertassinari
|
|
86
|
+
- [docs] Improve the `getRowId` doc section (#5156) @flaviendelangle
|
|
87
|
+
- [docs] Instruction to deal with invalid license message (#5074) @joserodolfofreitas
|
|
88
|
+
- [docs] Use redirection in the code (#5114) @oliviertassinari
|
|
89
|
+
- [docs] Add demo of how to use the data grid with date pickers (#5053) @cherniavskii
|
|
90
|
+
|
|
91
|
+
### Core
|
|
92
|
+
|
|
93
|
+
- [core] Improve inline code rendering within the details tag (#5166) @Harmouch101
|
|
94
|
+
- [core] Remove unused props from plugin typing (#5185) @flaviendelangle
|
|
95
|
+
- [core] Use the scrollbar size from `useGridDimensions` on `DataGridProColumnHeaders` (#5201) @flaviendelangle
|
|
96
|
+
- [core] Fix `GridColTypeDef` type (#5167) @cherniavskii
|
|
97
|
+
- [core] Fix `GridColTypeDef` usage in demo (#5197) @cherniavskii
|
|
98
|
+
- [test] Add `waitFor` before asserting height (#5203) @m4theushw
|
|
99
|
+
|
|
100
|
+
## v5.12.1
|
|
101
|
+
|
|
102
|
+
_Jun 9, 2022_
|
|
103
|
+
|
|
104
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
105
|
+
|
|
106
|
+
- 🎁 Add `reason` to `onFilterModelChange` (#4938) @m4theushw
|
|
107
|
+
- 🔎 Control quick filter input value via model prop (#5013) @alexfauquette
|
|
108
|
+
- 📚 Documentation improvements
|
|
109
|
+
- 🐞 Bugfixes
|
|
110
|
+
|
|
111
|
+
### `@mui/x-data-grid@v5.12.1` / `@mui/x-data-grid-pro@v5.12.1` / `@mui/x-data-grid-premium@v5.12.1`
|
|
112
|
+
|
|
113
|
+
#### Changes
|
|
114
|
+
|
|
115
|
+
- [DataGrid] Add `reason` to `onFilterModelChange` (#4938) @m4theushw
|
|
116
|
+
- [DataGrid] Restore focus after dismissing the column menu (#5027) @m4theushw
|
|
117
|
+
- [DataGrid] Update quick filter input when model is modified (#5013) @alexfauquette
|
|
118
|
+
- [DataGrid] Fix implicit dependency on react-dom (#5121) @oliviertassinari
|
|
119
|
+
- [DataGrid] Support `getRowId` in row reordering (#5093) @flaviendelangle
|
|
120
|
+
- [DataGridPro] Fix column resizing in RTL mode (#4989) @cherniavskii
|
|
121
|
+
- [DataGridPro] Fix column resizing on touchscreen (#5056) @cherniavskii
|
|
122
|
+
- [l10n] Update Japanese (ja-JP) locale (#5122) @hikotq
|
|
123
|
+
- [l10n] Update Russian (ru-RU) locale (#5069) @Artboomy
|
|
124
|
+
|
|
125
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.6` / `@mui/x-date-pickers-pro@v5.0.0-alpha.6`
|
|
126
|
+
|
|
127
|
+
#### Changes
|
|
128
|
+
|
|
129
|
+
- [pickers] Fix usage of `maxDate` / `minDate` / `disableFuture` and `disablePast` (#5081) @flaviendelangle
|
|
130
|
+
- [pickers] Infer mask from `inputFormat` (#5060) @alexfauquette
|
|
131
|
+
- [pickers] Manage input value without using the focus (#4486) @alexfauquette
|
|
132
|
+
- [pickers] Use new localization for doc examples (#5097) @flaviendelangle
|
|
133
|
+
- [pickers] Fix `shouldDisableDate` in range pickers (#5123) @flaviendelangle
|
|
134
|
+
- [l10n] Add Brazilian Portuguese (pt-BR) locale (#5100) @jardelnovaes
|
|
135
|
+
- [l10n] Use `localText` for remaining texts (#4986) @alexfauquette
|
|
136
|
+
|
|
137
|
+
### Docs
|
|
138
|
+
|
|
139
|
+
- [docs] Implement the focus management on data grid demo links (#5070) @alexfauquette
|
|
140
|
+
- [docs] Fix `301` link to render cell (#5106) @oliviertassinari
|
|
141
|
+
- [docs] Fix broken anchor link @oliviertassinari
|
|
142
|
+
- [docs] Improve movie dataset (#5142) @flaviendelangle
|
|
143
|
+
- [docs] Move all localization documentation in a unique page (#5072) @alexfauquette
|
|
144
|
+
- [docs] Section for overwriting core components i18n keys (#4998) @DanailH
|
|
145
|
+
- [docs] Small grammar and format fixes for Dynamic Row Height section (#5098) @samuelsycamore
|
|
146
|
+
|
|
147
|
+
### Core
|
|
148
|
+
|
|
149
|
+
- [core] Allows to run tests with different date adapters (#5055) @alexfauquette
|
|
150
|
+
- [core] Prettify the l10n issue (#4928) @alexfauquette
|
|
151
|
+
- [core] Set correct `apiRef` type in row reorder pre processors #5125 @DanailH
|
|
152
|
+
- [core] Stop using `GridEvents` in technical doc (#5157) @flaviendelangle
|
|
153
|
+
- [core] Upgrade monorepo (#5101) @oliviertassinari
|
|
154
|
+
- [test] Fix dynamic row height test failing on Chrome (#5147) @m4theushw
|
|
155
|
+
- [test] Remove delay on server demo for regression tests (#5131) @alexfauquette
|
|
156
|
+
|
|
6
157
|
## v5.12.0
|
|
7
158
|
|
|
8
159
|
_May 31, 2022_
|
|
@@ -21,6 +172,8 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
21
172
|
|
|
22
173
|
### `@mui/x-data-grid@v5.12.0` / `@mui/x-data-grid-pro@v5.12.0` / `@mui/x-data-grid-premium@v5.12.0`
|
|
23
174
|
|
|
175
|
+
#### Changes
|
|
176
|
+
|
|
24
177
|
- [DataGrid] Support dynamic row height (#4859) @m4theushw
|
|
25
178
|
- [DataGrid] Add `onMenuOpen` and `onMenuClose` props (#4825) @DanailH
|
|
26
179
|
- [DataGrid] Add generics to `GridActionsColDef` to match `GridColDef` (#4982) @subvertallchris
|
|
@@ -36,7 +189,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
36
189
|
- [l10n] Add Norwegian (Bokmål) (nb-NO) locale (#5001) @spiftire
|
|
37
190
|
- [l10n] Add Turkish (tr-TR) locale (#5026) @Rassilion
|
|
38
191
|
|
|
39
|
-
### `@mui/x-date-pickers@
|
|
192
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.5` / `@mui/x-date-pickers-pro@v5.0.0-alpha.5`
|
|
40
193
|
|
|
41
194
|
#### Breaking changes
|
|
42
195
|
|
|
@@ -109,7 +262,7 @@ We'd like to offer a big thanks to the 6 contributors who made this release poss
|
|
|
109
262
|
- [DataGridPremium] Support column spanning in the Excel export (#4830) @cherniavskii
|
|
110
263
|
- [l10n] Improve Russian (ru-RU) locale (#4864) @arvkonstantin
|
|
111
264
|
|
|
112
|
-
### `@mui/x-date-pickers@
|
|
265
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.4` / `@mui/x-date-pickers-pro@v5.0.0-alpha.4`
|
|
113
266
|
|
|
114
267
|
#### Breaking changes
|
|
115
268
|
|
|
@@ -234,7 +387,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
234
387
|
- [l10n] Improve German (de-DE) locale (#4748) @sebastianfrey
|
|
235
388
|
- [l10n] Improve German (de-DE) locale (#4668) @izu-co
|
|
236
389
|
|
|
237
|
-
### `@mui/x-date-pickers@
|
|
390
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.3` / `@mui/x-date-pickers-pro@v5.0.0-alpha.3`
|
|
238
391
|
|
|
239
392
|
#### Breaking changes
|
|
240
393
|
|
|
@@ -335,7 +488,7 @@ We'd like to offer a big thanks to the 6 contributors who made this release poss
|
|
|
335
488
|
- [DataGrid] Don't close column menu when updating rows (#4498) @m4theushw
|
|
336
489
|
- [DataGridPro] Introduce row reorder (#4034) @DanailH
|
|
337
490
|
|
|
338
|
-
### `@mui/x-date-pickers@
|
|
491
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.2` / `@mui/x-date-pickers-pro@v5.0.0-alpha.2`
|
|
339
492
|
|
|
340
493
|
- [pickers] Pass `PaperProps` to `DesktopWrapper` component (#4584) @alexfauquette
|
|
341
494
|
- [TimePicker] Fix bug when time picker clear value (#4582) @alexfauquette
|
|
@@ -396,7 +549,7 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
|
|
|
396
549
|
- [DataGridPro] Fix toggling detail panel using keyboard (#4409) @cherniavskii
|
|
397
550
|
- [l10n] Add Hungarian (hu-HU) locale (#4458) @x22tri
|
|
398
551
|
|
|
399
|
-
### `@mui/x-date-pickers@
|
|
552
|
+
### `@mui/x-date-pickers@v5.0.0-alpha.1` / `@mui/x-date-pickers-pro@v5.0.0-alpha.1`
|
|
400
553
|
|
|
401
554
|
- [ClockPicker] Should call `shouldDisableTime` with the hours with meridiem (#4404) @flaviendelangle
|
|
402
555
|
- [MonthPicker] Clicking on a `PickersMonth` button should not trigger the form submit (#4402) @flaviendelangle
|
|
@@ -4025,9 +4178,9 @@ Big thanks to the 8 contributors who made this release possible. Here are some h
|
|
|
4025
4178
|
|
|
4026
4179
|
### Docs
|
|
4027
4180
|
|
|
4028
|
-
- [docs] Data
|
|
4181
|
+
- [docs] Data grid depends on side effects (#666) @oliviertassinari
|
|
4029
4182
|
- [docs] Clarify the purpose of x-grid-data-generator (#634) @Elius94
|
|
4030
|
-
- [docs] Data
|
|
4183
|
+
- [docs] Data grid is in the lab (#612) @oliviertassinari
|
|
4031
4184
|
- [docs] Fix Demo app, downgrade webpack-cli, known issue in latest version (#647) @dtassone
|
|
4032
4185
|
- [docs] Fix typo in columns.md @stojy
|
|
4033
4186
|
- [docs] Reduce confusion on /export page (#646) @SerdarMustafa1
|
|
@@ -8,7 +8,6 @@ import { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGrid
|
|
|
8
8
|
import { useGridColumnPinning, columnPinningStateInitializer } from '../hooks/features/columnPinning/useGridColumnPinning';
|
|
9
9
|
import { useGridColumnPinningPreProcessors } from '../hooks/features/columnPinning/useGridColumnPinningPreProcessors';
|
|
10
10
|
import { useGridDetailPanel, detailPanelStateInitializer } from '../hooks/features/detailPanel/useGridDetailPanel';
|
|
11
|
-
import { useGridDetailPanelCache } from '../hooks/features/detailPanel/useGridDetailPanelCache';
|
|
12
11
|
import { useGridDetailPanelPreProcessors } from '../hooks/features/detailPanel/useGridDetailPanelPreProcessors';
|
|
13
12
|
import { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorder';
|
|
14
13
|
import { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
|
|
@@ -51,13 +50,12 @@ export const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
51
50
|
useGridTreeData(apiRef);
|
|
52
51
|
useGridKeyboardNavigation(apiRef, props);
|
|
53
52
|
useGridSelection(apiRef, props);
|
|
54
|
-
useGridDetailPanel(apiRef, props);
|
|
55
53
|
useGridColumnPinning(apiRef, props);
|
|
56
54
|
useGridColumns(apiRef, props);
|
|
57
55
|
useGridRows(apiRef, props);
|
|
58
56
|
useGridParamsApi(apiRef);
|
|
57
|
+
useGridDetailPanel(apiRef, props);
|
|
59
58
|
useGridColumnSpanning(apiRef);
|
|
60
|
-
useGridDetailPanelCache(apiRef, props);
|
|
61
59
|
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
62
60
|
useGridEditing(apiRef, props);
|
|
63
61
|
useGridFocus(apiRef, props);
|
|
@@ -4,6 +4,7 @@ const _excluded = ["style", "className", "innerRef"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
6
6
|
import { styled, alpha } from '@mui/material/styles';
|
|
7
|
+
import { useEventCallback } from '@mui/material/utils';
|
|
7
8
|
import { getDataGridUtilityClass, gridClasses, useGridSelector, useGridApiEventHandler, gridVisibleColumnFieldsSelector, GridColumnHeaderSeparatorSides } from '@mui/x-data-grid';
|
|
8
9
|
import { GridColumnHeaders, GridColumnHeadersInner, useGridColumnHeaders } from '@mui/x-data-grid/internals';
|
|
9
10
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
@@ -76,17 +77,19 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
|
|
|
76
77
|
const apiRef = useGridApiContext();
|
|
77
78
|
const visibleColumnFields = useGridSelector(apiRef, gridVisibleColumnFieldsSelector);
|
|
78
79
|
const [scrollbarSize, setScrollbarSize] = React.useState(0);
|
|
79
|
-
const handleContentSizeChange =
|
|
80
|
-
|
|
80
|
+
const handleContentSizeChange = useEventCallback(() => {
|
|
81
|
+
const rootDimensions = apiRef.current.getRootDimensions();
|
|
81
82
|
|
|
82
|
-
if (!
|
|
83
|
+
if (!rootDimensions) {
|
|
83
84
|
return;
|
|
84
|
-
}
|
|
85
|
+
}
|
|
85
86
|
|
|
87
|
+
const newScrollbarSize = rootDimensions.hasScrollY ? rootDimensions.scrollBarSize : 0;
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
if (scrollbarSize !== newScrollbarSize) {
|
|
90
|
+
setScrollbarSize(newScrollbarSize);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
90
93
|
useGridApiEventHandler(apiRef, 'virtualScrollerContentSizeChange', handleContentSizeChange);
|
|
91
94
|
const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector);
|
|
92
95
|
const [leftPinnedColumns, rightPinnedColumns] = filterColumns(pinnedColumns, visibleColumnFields);
|
|
@@ -42,16 +42,16 @@ const GridRowReorderCell = params => {
|
|
|
42
42
|
} // The row might have been deleted
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
if (!apiRef.current.getRow(params.
|
|
45
|
+
if (!apiRef.current.getRow(params.id)) {
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.
|
|
49
|
+
apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.id), event);
|
|
50
50
|
|
|
51
51
|
if (propHandler) {
|
|
52
52
|
propHandler(event);
|
|
53
53
|
}
|
|
54
|
-
}, [apiRef, params.
|
|
54
|
+
}, [apiRef, params.id]);
|
|
55
55
|
const draggableEventHandlers = isDraggable ? {
|
|
56
56
|
onDragStart: publish('rowDragStart'),
|
|
57
57
|
onDragOver: publish('rowDragOver'),
|
|
@@ -3,4 +3,4 @@ import { GridStateInitializer } from '@mui/x-data-grid/internals';
|
|
|
3
3
|
import { GridApiPro } from '../../../models/gridApiPro';
|
|
4
4
|
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
5
5
|
export declare const columnPinningStateInitializer: GridStateInitializer<Pick<DataGridProProcessedProps, 'pinnedColumns' | 'initialState' | 'disableColumnPinning'>>;
|
|
6
|
-
export declare const useGridColumnPinning: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, '
|
|
6
|
+
export declare const useGridColumnPinning: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'disableColumnPinning' | 'pinnedColumns' | 'onPinnedColumnsChange'>) => void;
|
|
@@ -189,7 +189,7 @@ export const useGridColumnPinning = (apiRef, props) => {
|
|
|
189
189
|
useGridRegisterPipeProcessor(apiRef, 'canBeReordered', checkIfCanBeReordered);
|
|
190
190
|
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
191
191
|
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
192
|
-
apiRef.current.
|
|
192
|
+
apiRef.current.unstable_registerControlState({
|
|
193
193
|
stateId: 'pinnedColumns',
|
|
194
194
|
propModel: props.pinnedColumns,
|
|
195
195
|
propOnChange: props.onPinnedColumnsChange,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ownerDocument, useEventCallback } from '@mui/material/utils';
|
|
4
|
-
import { gridClasses,
|
|
4
|
+
import { gridClasses, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
|
|
5
5
|
import { clamp, findParentElementFromClassName } from '@mui/x-data-grid/internals';
|
|
6
|
+
import { useTheme } from '@mui/material/styles';
|
|
6
7
|
import { findGridCellElementsFromCol, getFieldFromHeaderElem, findHeaderElementFromField } from '../../../utils/domUtils';
|
|
7
8
|
// TODO: remove support for Safari < 13.
|
|
8
9
|
// https://caniuse.com/#search=touch-action
|
|
@@ -50,10 +51,10 @@ function trackFinger(event, currentTouchId) {
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds,
|
|
54
|
+
function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, resizeDirection) {
|
|
54
55
|
let newWidth = initialOffsetToSeparator;
|
|
55
56
|
|
|
56
|
-
if (
|
|
57
|
+
if (resizeDirection === 'Right') {
|
|
57
58
|
newWidth += clickX - columnBounds.left;
|
|
58
59
|
} else {
|
|
59
60
|
newWidth += columnBounds.right - clickX;
|
|
@@ -62,16 +63,31 @@ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, separat
|
|
|
62
63
|
return newWidth;
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
function computeOffsetToSeparator(clickX, columnBounds,
|
|
66
|
-
if (
|
|
66
|
+
function computeOffsetToSeparator(clickX, columnBounds, resizeDirection) {
|
|
67
|
+
if (resizeDirection === 'Left') {
|
|
67
68
|
return clickX - columnBounds.left;
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
return columnBounds.right - clickX;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
function
|
|
74
|
-
|
|
74
|
+
function flipResizeDirection(side) {
|
|
75
|
+
if (side === 'Right') {
|
|
76
|
+
return 'Left';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return 'Right';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function getResizeDirection(element, direction) {
|
|
83
|
+
const side = element.classList.contains(gridClasses['columnSeparator--sideRight']) ? 'Right' : 'Left';
|
|
84
|
+
|
|
85
|
+
if (direction === 'rtl') {
|
|
86
|
+
// Resizing logic should be mirrored in the RTL case
|
|
87
|
+
return flipResizeDirection(side);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return side;
|
|
75
91
|
}
|
|
76
92
|
|
|
77
93
|
export const columnResizeStateInitializer = state => _extends({}, state, {
|
|
@@ -88,12 +104,13 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
88
104
|
const logger = useGridLogger(apiRef, 'useGridColumnResize');
|
|
89
105
|
const colDefRef = React.useRef();
|
|
90
106
|
const colElementRef = React.useRef();
|
|
91
|
-
const colCellElementsRef = React.useRef();
|
|
107
|
+
const colCellElementsRef = React.useRef();
|
|
108
|
+
const theme = useTheme(); // To improve accessibility, the separator has padding on both sides.
|
|
92
109
|
// Clicking inside the padding area should be treated as a click in the separator.
|
|
93
110
|
// This ref stores the offset between the click and the separator.
|
|
94
111
|
|
|
95
112
|
const initialOffsetToSeparator = React.useRef();
|
|
96
|
-
const
|
|
113
|
+
const resizeDirection = React.useRef();
|
|
97
114
|
const stopResizeEventTimeout = React.useRef();
|
|
98
115
|
const touchId = React.useRef();
|
|
99
116
|
|
|
@@ -152,7 +169,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
152
169
|
return;
|
|
153
170
|
}
|
|
154
171
|
|
|
155
|
-
let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(),
|
|
172
|
+
let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
156
173
|
newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
|
|
157
174
|
updateWidth(newWidth);
|
|
158
175
|
const params = {
|
|
@@ -188,8 +205,8 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
188
205
|
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
|
|
189
206
|
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
190
207
|
doc.body.style.cursor = 'col-resize';
|
|
191
|
-
|
|
192
|
-
initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(),
|
|
208
|
+
resizeDirection.current = getResizeDirection(event.currentTarget, theme.direction);
|
|
209
|
+
initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
193
210
|
doc.addEventListener('mousemove', handleResizeMouseMove);
|
|
194
211
|
doc.addEventListener('mouseup', handleResizeMouseUp);
|
|
195
212
|
});
|
|
@@ -222,7 +239,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
222
239
|
return;
|
|
223
240
|
}
|
|
224
241
|
|
|
225
|
-
let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(),
|
|
242
|
+
let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
226
243
|
newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
|
|
227
244
|
updateWidth(newWidth);
|
|
228
245
|
const params = {
|
|
@@ -263,8 +280,8 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
263
280
|
colDefRef.current = colDef;
|
|
264
281
|
colElementRef.current = findHeaderElementFromField((_apiRef$current$colum2 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum2.current, colDef.field);
|
|
265
282
|
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
|
|
266
|
-
|
|
267
|
-
initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(),
|
|
283
|
+
resizeDirection.current = getResizeDirection(event.target, theme.direction);
|
|
284
|
+
initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
|
|
268
285
|
const doc = ownerDocument(event.currentTarget);
|
|
269
286
|
doc.addEventListener('touchmove', handleTouchMove);
|
|
270
287
|
doc.addEventListener('touchend', handleTouchEnd);
|
|
@@ -7,7 +7,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
7
|
export const GRID_DETAIL_PANEL_TOGGLE_FIELD = '__detail_panel_toggle__';
|
|
8
8
|
export const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
9
9
|
field: GRID_DETAIL_PANEL_TOGGLE_FIELD,
|
|
10
|
-
headerName: '',
|
|
11
10
|
type: 'detailPanelToggle',
|
|
12
11
|
editable: false,
|
|
13
12
|
sortable: false,
|
|
@@ -22,5 +21,6 @@ export const GRID_DETAIL_PANEL_TOGGLE_COL_DEF = _extends({}, GRID_STRING_COL_DEF
|
|
|
22
21
|
const expandedRowIds = gridDetailPanelExpandedRowIdsSelector(params.api.state);
|
|
23
22
|
return expandedRowIds.includes(params.id);
|
|
24
23
|
},
|
|
25
|
-
renderCell: params => /*#__PURE__*/_jsx(GridDetailPanelToggleCell, _extends({}, params))
|
|
24
|
+
renderCell: params => /*#__PURE__*/_jsx(GridDetailPanelToggleCell, _extends({}, params)),
|
|
25
|
+
renderHeader: () => null
|
|
26
26
|
});
|
|
@@ -3,4 +3,4 @@ import { GridStateInitializer } from '@mui/x-data-grid/internals';
|
|
|
3
3
|
import { GridApiPro } from '../../../models/gridApiPro';
|
|
4
4
|
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
5
5
|
export declare const detailPanelStateInitializer: GridStateInitializer<Pick<DataGridProProcessedProps, 'initialState' | 'detailPanelExpandedRowIds'>>;
|
|
6
|
-
export declare const useGridDetailPanel: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, '
|
|
6
|
+
export declare const useGridDetailPanel: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'getDetailPanelContent' | 'getDetailPanelHeight' | 'detailPanelExpandedRowIds' | 'onDetailPanelExpandedRowIdsChange'>) => void;
|
|
@@ -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 } from '@mui/x-data-grid';
|
|
3
|
+
import { useGridSelector, useGridApiEventHandler, useGridApiMethod, gridRowIdsSelector } 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 } from './gridDetailPanelSelector';
|
|
@@ -13,6 +13,35 @@ export const detailPanelStateInitializer = (state, props) => {
|
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
|
+
|
|
17
|
+
function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeight) {
|
|
18
|
+
if (typeof getDetailPanelContent !== 'function') {
|
|
19
|
+
return {};
|
|
20
|
+
} // TODO change to lazy approach using a Proxy
|
|
21
|
+
// only call getDetailPanelContent when asked for an id
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const rowIds = gridRowIdsSelector(apiRef);
|
|
25
|
+
const contentCache = rowIds.reduce((acc, id) => {
|
|
26
|
+
const params = apiRef.current.getRowParams(id);
|
|
27
|
+
acc[id] = getDetailPanelContent(params);
|
|
28
|
+
return acc;
|
|
29
|
+
}, {});
|
|
30
|
+
const heightCache = rowIds.reduce((acc, id) => {
|
|
31
|
+
if (contentCache[id] == null) {
|
|
32
|
+
return acc;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const params = apiRef.current.getRowParams(id);
|
|
36
|
+
acc[id] = getDetailPanelHeight(params);
|
|
37
|
+
return acc;
|
|
38
|
+
}, {});
|
|
39
|
+
return {
|
|
40
|
+
contentCache,
|
|
41
|
+
heightCache
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
16
45
|
export const useGridDetailPanel = (apiRef, props) => {
|
|
17
46
|
const expandedRowIds = useGridSelector(apiRef, gridDetailPanelExpandedRowIdsSelector);
|
|
18
47
|
const contentCache = useGridSelector(apiRef, gridDetailPanelExpandedRowsContentCacheSelector);
|
|
@@ -51,23 +80,7 @@ export const useGridDetailPanel = (apiRef, props) => {
|
|
|
51
80
|
}, [apiRef, props.getDetailPanelContent]);
|
|
52
81
|
useGridApiEventHandler(apiRef, 'cellClick', handleCellClick);
|
|
53
82
|
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
54
|
-
|
|
55
|
-
var _heightCache$row$id;
|
|
56
|
-
|
|
57
|
-
if (expandedRowIds.length === 0 || !expandedRowIds.includes(row.id)) {
|
|
58
|
-
return _extends({}, initialValue, {
|
|
59
|
-
detail: 0
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const heightCache = gridDetailPanelExpandedRowsHeightCacheSelector(apiRef.current.state);
|
|
64
|
-
return _extends({}, initialValue, {
|
|
65
|
-
detail: (_heightCache$row$id = heightCache[row.id]) != null ? _heightCache$row$id : 0 // Fallback to zero because the cache might not be ready yet (e.g. page was changed)
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
}, [apiRef, expandedRowIds]);
|
|
69
|
-
useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight);
|
|
70
|
-
apiRef.current.unstable_updateControlState({
|
|
83
|
+
apiRef.current.unstable_registerControlState({
|
|
71
84
|
stateId: 'detailPanels',
|
|
72
85
|
propModel: props.detailPanelExpandedRowIds,
|
|
73
86
|
propOnChange: props.onDetailPanelExpandedRowIdsChange,
|
|
@@ -114,4 +127,51 @@ export const useGridDetailPanel = (apiRef, props) => {
|
|
|
114
127
|
}
|
|
115
128
|
}
|
|
116
129
|
}, [apiRef, props.detailPanelExpandedRowIds]);
|
|
130
|
+
const updateCachesAndForceUpdate = React.useCallback(() => {
|
|
131
|
+
apiRef.current.setState(state => {
|
|
132
|
+
return _extends({}, state, {
|
|
133
|
+
detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight))
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
apiRef.current.forceUpdate();
|
|
137
|
+
}, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
|
|
138
|
+
useGridApiEventHandler(apiRef, 'sortedRowsSet', updateCachesAndForceUpdate);
|
|
139
|
+
const previousGetDetailPanelContentProp = React.useRef();
|
|
140
|
+
const previousGetDetailPanelHeightProp = React.useRef();
|
|
141
|
+
const updateCachesIfNeeded = React.useCallback(() => {
|
|
142
|
+
if (props.getDetailPanelContent === previousGetDetailPanelContentProp.current && props.getDetailPanelHeight === previousGetDetailPanelHeightProp.current) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
apiRef.current.setState(state => {
|
|
147
|
+
return _extends({}, state, {
|
|
148
|
+
detailPanel: _extends({}, state.detailPanel, cacheContentAndHeight(apiRef, props.getDetailPanelContent, props.getDetailPanelHeight))
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
previousGetDetailPanelContentProp.current = props.getDetailPanelContent;
|
|
152
|
+
previousGetDetailPanelHeightProp.current = props.getDetailPanelHeight;
|
|
153
|
+
}, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
|
|
154
|
+
const addDetailHeight = React.useCallback((initialValue, row) => {
|
|
155
|
+
var _heightCache$row$id;
|
|
156
|
+
|
|
157
|
+
if (!expandedRowIds || expandedRowIds.length === 0 || !expandedRowIds.includes(row.id)) {
|
|
158
|
+
return _extends({}, initialValue, {
|
|
159
|
+
detail: 0
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
updateCachesIfNeeded();
|
|
164
|
+
const heightCache = gridDetailPanelExpandedRowsHeightCacheSelector(apiRef.current.state);
|
|
165
|
+
return _extends({}, initialValue, {
|
|
166
|
+
detail: (_heightCache$row$id = heightCache[row.id]) != null ? _heightCache$row$id : 0 // Fallback to zero because the cache might not be ready yet (e.g. page was changed)
|
|
167
|
+
|
|
168
|
+
});
|
|
169
|
+
}, [apiRef, expandedRowIds, updateCachesIfNeeded]);
|
|
170
|
+
useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight);
|
|
171
|
+
const isFirstRender = React.useRef(true);
|
|
172
|
+
|
|
173
|
+
if (isFirstRender.current) {
|
|
174
|
+
isFirstRender.current = false;
|
|
175
|
+
updateCachesIfNeeded();
|
|
176
|
+
}
|
|
117
177
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
3
4
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD, GRID_DETAIL_PANEL_TOGGLE_COL_DEF } from './gridDetailPanelToggleColDef';
|
|
@@ -21,8 +22,10 @@ export const useGridDetailPanelPreProcessors = (apiRef, props) => {
|
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
columnsState.all = [GRID_DETAIL_PANEL_TOGGLE_FIELD, ...columnsState.all];
|
|
24
|
-
columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD] = GRID_DETAIL_PANEL_TOGGLE_COL_DEF
|
|
25
|
+
columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD] = _extends({}, GRID_DETAIL_PANEL_TOGGLE_COL_DEF, {
|
|
26
|
+
headerName: apiRef.current.getLocaleText('detailPanelToggle')
|
|
27
|
+
});
|
|
25
28
|
return columnsState;
|
|
26
|
-
}, [props.getDetailPanelContent]);
|
|
29
|
+
}, [apiRef, props.getDetailPanelContent]);
|
|
27
30
|
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', addToggleColumn);
|
|
28
31
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridApiCommunity } from '@mui/x-data-grid/internals';
|
|
3
2
|
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
4
|
-
|
|
3
|
+
import { GridApiPro } from '../../../models/gridApiPro';
|
|
4
|
+
export declare const useGridRowReorderPreProcessors: (apiRef: React.MutableRefObject<GridApiPro>, props: DataGridProProcessedProps) => void;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["hideDescendantCount"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { gridRowIdsSelector, gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid';
|
|
5
|
+
import { gridRowIdsSelector, gridRowTreeSelector, useFirstRender, GRID_CHECKBOX_SELECTION_FIELD } from '@mui/x-data-grid';
|
|
6
6
|
import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
|
|
7
7
|
import { GRID_TREE_DATA_GROUPING_COL_DEF, GRID_TREE_DATA_GROUPING_COL_DEF_FORCED_PROPERTIES } from './gridTreeDataGroupColDef';
|
|
8
8
|
import { filterRowTreeFromTreeData, TREE_DATA_STRATEGY } from './gridTreeDataUtils';
|
|
@@ -61,7 +61,7 @@ export const useGridTreeDataPreProcessors = (apiRef, props) => {
|
|
|
61
61
|
columnsState.lookup[groupingColDefField] = newGroupingColumn;
|
|
62
62
|
|
|
63
63
|
if (prevGroupingColumn == null) {
|
|
64
|
-
const index = columnsState.all[0] ===
|
|
64
|
+
const index = columnsState.all[0] === GRID_CHECKBOX_SELECTION_FIELD ? 1 : 0;
|
|
65
65
|
columnsState.all = [...columnsState.all.slice(0, index), groupingColDefField, ...columnsState.all.slice(index)];
|
|
66
66
|
}
|
|
67
67
|
} else if (!shouldHaveGroupingColumn && prevGroupingColumn) {
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export { useGridColumnPinning, columnPinningStateInitializer, } from '../hooks/f
|
|
|
6
6
|
export { useGridColumnPinningPreProcessors } from '../hooks/features/columnPinning/useGridColumnPinningPreProcessors';
|
|
7
7
|
export { useGridColumnReorder, columnReorderStateInitializer, } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
8
8
|
export { useGridDetailPanel, detailPanelStateInitializer, } from '../hooks/features/detailPanel/useGridDetailPanel';
|
|
9
|
-
export { useGridDetailPanelCache } from '../hooks/features/detailPanel/useGridDetailPanelCache';
|
|
10
9
|
export { useGridDetailPanelPreProcessors } from '../hooks/features/detailPanel/useGridDetailPanelPreProcessors';
|
|
11
10
|
export { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
|
|
12
11
|
export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorder';
|
package/internals/index.js
CHANGED
|
@@ -6,7 +6,6 @@ export { useGridColumnPinning, columnPinningStateInitializer } from '../hooks/fe
|
|
|
6
6
|
export { useGridColumnPinningPreProcessors } from '../hooks/features/columnPinning/useGridColumnPinningPreProcessors';
|
|
7
7
|
export { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
8
8
|
export { useGridDetailPanel, detailPanelStateInitializer } from '../hooks/features/detailPanel/useGridDetailPanel';
|
|
9
|
-
export { useGridDetailPanelCache } from '../hooks/features/detailPanel/useGridDetailPanelCache';
|
|
10
9
|
export { useGridDetailPanelPreProcessors } from '../hooks/features/detailPanel/useGridDetailPanelPreProcessors';
|
|
11
10
|
export { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
|
|
12
11
|
export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorder';
|