@mui/x-data-grid 8.18.0 → 8.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +175 -0
- package/DataGrid/useDataGridComponent.js +4 -3
- package/components/GridRow.js +5 -2
- package/components/GridRowDragAndDropOverlay.d.ts +7 -0
- package/components/GridRowDragAndDropOverlay.js +73 -0
- package/components/cell/GridActionsCell.d.ts +9 -0
- package/components/cell/GridActionsCell.js +54 -34
- package/components/cell/GridBooleanCell.js +0 -10
- package/components/cell/GridCell.js +4 -10
- package/components/columnHeaders/GridColumnHeaderItem.js +2 -2
- package/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
- package/components/containers/GridRootStyles.js +17 -40
- package/components/toolbarV8/Toolbar.js +1 -1
- package/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
- package/components/virtualization/GridVirtualScrollbar.js +13 -8
- package/components/virtualization/GridVirtualScroller.js +2 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
- package/constants/dataGridPropsDefaultValues.js +2 -1
- package/constants/gridClasses.d.ts +0 -8
- package/constants/gridClasses.js +1 -1
- package/esm/DataGrid/useDataGridComponent.js +5 -4
- package/esm/components/GridRow.js +5 -2
- package/esm/components/GridRowDragAndDropOverlay.d.ts +7 -0
- package/esm/components/GridRowDragAndDropOverlay.js +66 -0
- package/esm/components/cell/GridActionsCell.d.ts +9 -0
- package/esm/components/cell/GridActionsCell.js +55 -34
- package/esm/components/cell/GridBooleanCell.js +0 -10
- package/esm/components/cell/GridCell.js +4 -10
- package/esm/components/columnHeaders/GridColumnHeaderItem.js +2 -2
- package/esm/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
- package/esm/components/containers/GridRootStyles.js +17 -40
- package/esm/components/toolbarV8/Toolbar.js +1 -1
- package/esm/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
- package/esm/components/virtualization/GridVirtualScrollbar.js +12 -7
- package/esm/components/virtualization/GridVirtualScroller.js +2 -1
- package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
- package/esm/constants/dataGridPropsDefaultValues.js +2 -1
- package/esm/constants/gridClasses.d.ts +0 -8
- package/esm/constants/gridClasses.js +1 -1
- package/esm/hooks/core/gridPropsSelectors.d.ts +2 -1
- package/esm/hooks/core/gridPropsSelectors.js +3 -0
- package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
- package/esm/hooks/core/useGridProps.js +8 -2
- package/esm/hooks/core/useGridVirtualizer.d.ts +80 -6
- package/esm/hooks/core/useGridVirtualizer.js +27 -12
- package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
- package/esm/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
- package/esm/hooks/features/columns/useGridColumnSpanning.js +9 -4
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
- package/esm/hooks/features/dimensions/useGridDimensions.js +12 -6
- package/esm/hooks/features/editing/useGridCellEditing.js +1 -1
- package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
- package/esm/hooks/features/export/serializers/csvSerializer.js +2 -4
- package/esm/hooks/features/export/useGridPrintExport.js +18 -18
- package/esm/hooks/features/filter/gridFilterUtils.js +5 -11
- package/esm/hooks/features/filter/index.d.ts +1 -1
- package/esm/hooks/features/filter/index.js +1 -1
- package/esm/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/esm/hooks/features/filter/useGridFilter.js +3 -1
- package/esm/hooks/features/focus/useGridFocus.js +0 -1
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
- package/esm/hooks/features/pagination/useGridPaginationMeta.js +3 -3
- package/esm/hooks/features/pagination/useGridPaginationModel.js +7 -4
- package/esm/hooks/features/pagination/useGridRowCount.js +31 -15
- package/esm/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
- package/esm/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
- package/esm/hooks/features/rowReorder/gridRowReorderSelector.js +19 -1
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +17 -8
- package/esm/hooks/features/rowSelection/utils.d.ts +1 -0
- package/esm/hooks/features/rowSelection/utils.js +17 -4
- package/esm/hooks/features/rows/useGridRowSpanning.js +23 -60
- package/esm/hooks/features/rows/useGridRows.js +3 -1
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
- package/esm/hooks/features/scroll/useGridScroll.js +2 -3
- package/esm/hooks/features/sorting/gridSortingUtils.js +1 -3
- package/esm/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/esm/hooks/features/sorting/useGridSorting.js +3 -1
- package/esm/hooks/features/virtualization/useGridVirtualization.js +24 -5
- package/esm/hooks/utils/useGridEvent.js +6 -2
- package/esm/hooks/utils/useGridSelector.js +2 -4
- package/esm/hooks/utils/useRunOncePerLoop.d.ts +4 -1
- package/esm/hooks/utils/useRunOncePerLoop.js +28 -18
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +5 -4
- package/esm/internals/index.js +3 -3
- package/esm/material/index.js +1 -4
- package/esm/models/api/gridRowApi.d.ts +14 -1
- package/esm/models/api/index.d.ts +1 -1
- package/esm/models/api/index.js +0 -1
- package/esm/models/colDef/gridColDef.d.ts +14 -0
- package/esm/models/configuration/gridConfiguration.d.ts +2 -2
- package/esm/models/configuration/gridRowConfiguration.d.ts +6 -5
- package/esm/models/events/gridEventLookup.d.ts +5 -0
- package/esm/models/gridStateCommunity.d.ts +1 -1
- package/esm/models/params/gridCellParams.d.ts +0 -10
- package/esm/models/props/DataGridProps.d.ts +13 -6
- package/esm/utils/keyboardUtils.d.ts +1 -8
- package/esm/utils/keyboardUtils.js +0 -7
- package/hooks/core/gridPropsSelectors.d.ts +2 -1
- package/hooks/core/gridPropsSelectors.js +4 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
- package/hooks/core/useGridProps.js +8 -2
- package/hooks/core/useGridVirtualizer.d.ts +80 -6
- package/hooks/core/useGridVirtualizer.js +26 -11
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
- package/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
- package/hooks/features/columns/useGridColumnSpanning.js +9 -4
- package/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +12 -6
- package/hooks/features/editing/useGridCellEditing.js +1 -1
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/export/serializers/csvSerializer.js +2 -4
- package/hooks/features/export/useGridPrintExport.js +18 -18
- package/hooks/features/filter/gridFilterUtils.js +5 -11
- package/hooks/features/filter/index.d.ts +1 -1
- package/hooks/features/filter/index.js +6 -0
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +3 -1
- package/hooks/features/focus/useGridFocus.js +0 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
- package/hooks/features/pagination/useGridPaginationMeta.js +2 -2
- package/hooks/features/pagination/useGridPaginationModel.js +7 -4
- package/hooks/features/pagination/useGridRowCount.js +30 -14
- package/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
- package/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
- package/hooks/features/rowReorder/gridRowReorderSelector.js +20 -2
- package/hooks/features/rowSelection/useGridRowSelection.js +17 -8
- package/hooks/features/rowSelection/utils.d.ts +1 -0
- package/hooks/features/rowSelection/utils.js +16 -3
- package/hooks/features/rows/useGridRowSpanning.js +23 -60
- package/hooks/features/rows/useGridRows.js +3 -1
- package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
- package/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
- package/hooks/features/scroll/useGridScroll.js +2 -3
- package/hooks/features/sorting/gridSortingUtils.js +1 -3
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/sorting/useGridSorting.js +3 -1
- package/hooks/features/virtualization/useGridVirtualization.js +24 -5
- package/hooks/utils/useGridEvent.js +6 -2
- package/hooks/utils/useGridSelector.js +2 -4
- package/hooks/utils/useRunOncePerLoop.d.ts +4 -1
- package/hooks/utils/useRunOncePerLoop.js +27 -18
- package/index.js +1 -1
- package/internals/index.d.ts +5 -4
- package/internals/index.js +16 -9
- package/material/index.js +1 -4
- package/models/api/gridRowApi.d.ts +14 -1
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -11
- package/models/colDef/gridColDef.d.ts +14 -0
- package/models/configuration/gridConfiguration.d.ts +2 -2
- package/models/configuration/gridRowConfiguration.d.ts +6 -5
- package/models/events/gridEventLookup.d.ts +5 -0
- package/models/gridStateCommunity.d.ts +1 -1
- package/models/params/gridCellParams.d.ts +0 -10
- package/models/props/DataGridProps.d.ts +13 -6
- package/package.json +3 -3
- package/utils/keyboardUtils.d.ts +1 -8
- package/utils/keyboardUtils.js +1 -13
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,181 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.20.0
|
|
9
|
+
|
|
10
|
+
_Nov 26, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🔃 Data Grid tree data now supports row reordering. See the [Drag-and-drop tree data reordering](https://mui.com/x/react-data-grid/tree-data/#drag-and-drop-tree-data-reordering) section for more details.
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
|
|
17
|
+
The following team members contributed to this release:
|
|
18
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @cherniavskii, @siriwatknp, @JCQuintas, @MBilalShafi, @prakhargupta1
|
|
19
|
+
|
|
20
|
+
### Data Grid
|
|
21
|
+
|
|
22
|
+
#### `@mui/x-data-grid@8.20.0`
|
|
23
|
+
|
|
24
|
+
- [DataGrid] Fix RTL virtualization to display columns when viewport width is larger than the grid (#20409) @siriwatknp
|
|
25
|
+
- [DataGrid] Fix row range selection (#20442) @arminmeh
|
|
26
|
+
- [DataGrid] Initialize data grid core packages (#20276) @cherniavskii
|
|
27
|
+
- [DataGrid] Improve accessibility of the sort icon (#20430) @arminmeh
|
|
28
|
+
- [DataGrid] Use `viewport` as a boundary for the `BasePopper` flip (#20311) @arminmeh
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-pro@8.20.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid@8.20.0`, plus:
|
|
33
|
+
|
|
34
|
+
- [DataGridPro] Avoid automatic scroll back to the focused header filter after it leaves the viewport (#20416) @arminmeh
|
|
35
|
+
- [DataGridPro] Tree data row reordering (#19401) @MBilalShafi
|
|
36
|
+
|
|
37
|
+
#### `@mui/x-data-grid-premium@8.20.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
38
|
+
|
|
39
|
+
Same changes as in `@mui/x-data-grid-pro@8.20.0`.
|
|
40
|
+
|
|
41
|
+
### Charts
|
|
42
|
+
|
|
43
|
+
#### `@mui/x-charts@8.20.0`
|
|
44
|
+
|
|
45
|
+
- [charts] Fix item tooltip position with node anchor (#20421) @alexfauquette
|
|
46
|
+
- [charts] Fix radar item tooltip closing bug (#20429) @alexfauquette
|
|
47
|
+
- [charts] Move series processing to selector (#20388) @JCQuintas
|
|
48
|
+
- [charts] Prevent pointer out from removing controlled highlight (#20385) @alexfauquette
|
|
49
|
+
|
|
50
|
+
#### `@mui/x-charts-pro@8.20.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
51
|
+
|
|
52
|
+
Same changes as in `@mui/x-charts@8.20.0`, plus:
|
|
53
|
+
|
|
54
|
+
- [charts-pro] Fix Content-Security-Policy nonce not being correctly set on export (#20395) @bernardobelchior
|
|
55
|
+
- [charts-pro] Improve vertical zoom slider thumb on mobile (#20439) @bernardobelchior
|
|
56
|
+
- [charts-pro] Provide arguments to the `AreaPlotRoot` styled component (#20414) @arminmeh
|
|
57
|
+
- [charts-pro] Remove grid outside the drawing area (#20412) @alexfauquette
|
|
58
|
+
|
|
59
|
+
#### `@mui/x-charts-premium@8.20.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
60
|
+
|
|
61
|
+
Same changes as in `@mui/x-charts-pro@8.20.0`, plus:
|
|
62
|
+
|
|
63
|
+
- [charts-premium] Add explicit return type to `ChartsRenderer` for better compatibility with React 18 (#20413) @arminmeh
|
|
64
|
+
|
|
65
|
+
### Docs
|
|
66
|
+
|
|
67
|
+
- [docs] Add `llms.txt` link to the sidebar (#20312) @siriwatknp
|
|
68
|
+
- [docs] Add a line chart demo for the Overview section (#20239) @prakhargupta1
|
|
69
|
+
|
|
70
|
+
## 8.19.0
|
|
71
|
+
|
|
72
|
+
_Nov 20, 2025_
|
|
73
|
+
|
|
74
|
+
We'd like to extend a big thank you to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
75
|
+
|
|
76
|
+
- 🔎 Add pan on `wheel` to the charts zoom
|
|
77
|
+
- ⌨️ Allow opt-in to [tab navigation](https://mui.com/x/react-data-grid/accessibility/#tab-navigation) inside the Data Grid.
|
|
78
|
+
- ⚙️ New way of defining [action columns](https://mui.com/x/react-data-grid/column-definition/#ActionsWithModalGrid.tsx) in the Data Grid that makes it easier to keep `columns` prop stable.
|
|
79
|
+
- 🐞 Bugfixes
|
|
80
|
+
- 📚 Documentation improvements
|
|
81
|
+
|
|
82
|
+
Special thanks go out to these community members for their valuable contributions:
|
|
83
|
+
@lauri865, @noobyogi0010, @sai6855
|
|
84
|
+
|
|
85
|
+
The following team members contributed to this release:
|
|
86
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @mj12albert, @noraleonte, @rita-codes, @siriwatknp, @ZeeshanTamboli
|
|
87
|
+
|
|
88
|
+
### Data Grid
|
|
89
|
+
|
|
90
|
+
#### `@mui/x-data-grid@8.19.0`
|
|
91
|
+
|
|
92
|
+
- [DataGrid] Add `tabNavigation` prop to control tab navigation in the grid (#20286) @arminmeh
|
|
93
|
+
- [DataGrid] Allow to focus disabled checkbox cells (#19959) @mj12albert
|
|
94
|
+
- [DataGrid] Alternative actions column definition API (#15041) @cherniavskii
|
|
95
|
+
- [DataGrid] Fix failing tests (#20332) @cherniavskii
|
|
96
|
+
- [DataGrid] Prevent Safari 26 error in the event handler (#20369) @arminmeh
|
|
97
|
+
- [DataGrid] Undeprecate the `autoHeight` prop (#20363) @cherniavskii
|
|
98
|
+
- [DataGrid] Fix print export grid dimensions with dynamic row height and print styles (#19835) @cherniavskii
|
|
99
|
+
|
|
100
|
+
#### `@mui/x-data-grid-pro@8.19.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
101
|
+
|
|
102
|
+
Same changes as in `@mui/x-data-grid@8.19.0`.
|
|
103
|
+
|
|
104
|
+
#### `@mui/x-data-grid-premium@8.19.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
105
|
+
|
|
106
|
+
Same changes as in `@mui/x-data-grid-pro@8.19.0`, plus:
|
|
107
|
+
|
|
108
|
+
- [DataGridPremium] Fix aggregation with sorting (#19892) @lauri865
|
|
109
|
+
- [DataGridPremium] Lock `ExcelJS` version (#20329) @cherniavskii
|
|
110
|
+
|
|
111
|
+
### Date and Time Pickers
|
|
112
|
+
|
|
113
|
+
#### `@mui/x-date-pickers@8.19.0`
|
|
114
|
+
|
|
115
|
+
- [pickers] Do not loose `slotProps.field.slotProps` (#20322) @flaviendelangle
|
|
116
|
+
|
|
117
|
+
#### `@mui/x-date-pickers-pro@8.19.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
118
|
+
|
|
119
|
+
Same changes as in `@mui/x-date-pickers@8.19.0`.
|
|
120
|
+
|
|
121
|
+
### Charts
|
|
122
|
+
|
|
123
|
+
#### `@mui/x-charts@8.19.0`
|
|
124
|
+
|
|
125
|
+
- [charts] Expose `niceDomain` utility (#20250) @bernardobelchior
|
|
126
|
+
- [charts] Fix benchmark regression by downgrading to JSDOM v26 (#20405) @bernardobelchior
|
|
127
|
+
- [charts] Fix Pie Chart keyboard focus highlight (#20358) @JCQuintas
|
|
128
|
+
- [charts] Memoize series selectors (#20326) @JCQuintas
|
|
129
|
+
- [charts] Relax dataset type (#20294) @bernardobelchior
|
|
130
|
+
- [charts] Remove `touch-action: pan-y` when zoom is disabled (#20204) @bernardobelchior
|
|
131
|
+
- [charts] Use `getBBox()` for correct SVG sizes in firefox (#20309) @JCQuintas
|
|
132
|
+
- [charts] Use directly selector from `@mui/x-internals` (#20365) @alexfauquette
|
|
133
|
+
- [charts] Fix unnecessary errors in dev mode (#20380) @JCQuintas
|
|
134
|
+
|
|
135
|
+
#### `@mui/x-charts-pro@8.19.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
136
|
+
|
|
137
|
+
Same changes as in `@mui/x-charts@8.19.0`, plus:
|
|
138
|
+
|
|
139
|
+
- [charts-pro] Add pan on `wheel` to zoom (#19998) @JCQuintas
|
|
140
|
+
- [charts-pro] Fix zoom slider preview having an opaque background in dark mode (#20367) @bernardobelchior
|
|
141
|
+
|
|
142
|
+
#### `@mui/x-charts-premium@8.19.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
143
|
+
|
|
144
|
+
Same changes as in `@mui/x-charts-pro@8.19.0`.
|
|
145
|
+
|
|
146
|
+
### Tree View
|
|
147
|
+
|
|
148
|
+
#### `@mui/x-tree-view@8.19.0`
|
|
149
|
+
|
|
150
|
+
- [tree view] Enable lazy load when children count is not know in tree view (#18680) @noobyogi0010
|
|
151
|
+
- [tree view] Fix unwanted behaviors on the item re-ordering (#20368) @flaviendelangle
|
|
152
|
+
|
|
153
|
+
#### `@mui/x-tree-view-pro@8.19.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
154
|
+
|
|
155
|
+
Same changes as in `@mui/x-tree-view@8.19.0`.
|
|
156
|
+
|
|
157
|
+
### Codemod
|
|
158
|
+
|
|
159
|
+
#### `@mui/x-codemod@8.19.0`
|
|
160
|
+
|
|
161
|
+
Internal changes.
|
|
162
|
+
|
|
163
|
+
### Docs
|
|
164
|
+
|
|
165
|
+
- [docs] Add minimum Typescript version to migration guide (#20320) @siriwatknp
|
|
166
|
+
- [docs] Fix Autosizing documentation (#20348) @siriwatknp
|
|
167
|
+
- [docs] Fix separator opacity in demo (#20293) @sai6855
|
|
168
|
+
- [docs] Replace deprecated `LoadingButton` with `Button` component (#20208) @Janpot
|
|
169
|
+
|
|
170
|
+
### Core
|
|
171
|
+
|
|
172
|
+
- [code-infra] Add new broken links checker (#20120) @Janpot
|
|
173
|
+
- [code-infra] Disable Codspeed pipeline (#20370) @JCQuintas
|
|
174
|
+
- [code-infra] Optimize `checkMaterialVersion` (#20307) @Janpot
|
|
175
|
+
- [code-infra] Use utils from code-infra for changelog and PR creation (#20406) @brijeshb42
|
|
176
|
+
- [docs-infra] Revert `@docsearch/react` (#20313) @Janpot
|
|
177
|
+
|
|
178
|
+
### Miscellaneous
|
|
179
|
+
|
|
180
|
+
- [test] Fix browser tests skipping some projects (#20318) @cherniavskii
|
|
181
|
+
- [test] Update `use-react-version` pnpm script (#20319) @cherniavskii
|
|
182
|
+
|
|
8
183
|
## 8.18.0
|
|
9
184
|
|
|
10
185
|
<!-- generated comparing v8.17.0..master -->
|
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.useDataGridComponent = void 0;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _useFirstRender = require("@mui/x-internals/useFirstRender");
|
|
10
11
|
var _useGridInitialization = require("../hooks/core/useGridInitialization");
|
|
11
|
-
var _useGridVirtualizer = require("../hooks/core/useGridVirtualizer");
|
|
12
12
|
var _useGridInitializeState = require("../hooks/utils/useGridInitializeState");
|
|
13
13
|
var _useGridClipboard = require("../hooks/features/clipboard/useGridClipboard");
|
|
14
14
|
var _useGridColumnMenu = require("../hooks/features/columnMenu/useGridColumnMenu");
|
|
@@ -72,7 +72,6 @@ const useDataGridComponent = (apiRef, props, configuration) => {
|
|
|
72
72
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridDimensions.dimensionsStateInitializer, apiRef, props);
|
|
73
73
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRowsMeta.rowsMetaStateInitializer, apiRef, props);
|
|
74
74
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridListView.listViewStateInitializer, apiRef, props);
|
|
75
|
-
(0, _useGridVirtualizer.useGridVirtualizer)(apiRef, props);
|
|
76
75
|
(0, _useGridKeyboardNavigation.useGridKeyboardNavigation)(apiRef, props);
|
|
77
76
|
(0, _useGridRowSelection.useGridRowSelection)(apiRef, props);
|
|
78
77
|
(0, _useGridColumns.useGridColumns)(apiRef, props);
|
|
@@ -89,7 +88,6 @@ const useDataGridComponent = (apiRef, props, configuration) => {
|
|
|
89
88
|
(0, _useGridDensity.useGridDensity)(apiRef, props);
|
|
90
89
|
(0, _useGridColumnResize.useGridColumnResize)(apiRef, props);
|
|
91
90
|
(0, _useGridPagination.useGridPagination)(apiRef, props);
|
|
92
|
-
(0, _useGridRowsMeta.useGridRowsMeta)(apiRef, props);
|
|
93
91
|
(0, _useGridScroll.useGridScroll)(apiRef, props);
|
|
94
92
|
(0, _useGridColumnMenu.useGridColumnMenu)(apiRef);
|
|
95
93
|
(0, _useGridCsvExport.useGridCsvExport)(apiRef, props);
|
|
@@ -103,6 +101,9 @@ const useDataGridComponent = (apiRef, props, configuration) => {
|
|
|
103
101
|
(0, _useGridDataSource.useGridDataSource)(apiRef, props);
|
|
104
102
|
|
|
105
103
|
// Should be the last thing to run, because all pre-processors should have been registered by now.
|
|
104
|
+
(0, _useFirstRender.useFirstRender)(() => {
|
|
105
|
+
apiRef.current.runAppliersForPendingProcessors();
|
|
106
|
+
});
|
|
106
107
|
React.useEffect(() => {
|
|
107
108
|
apiRef.current.runAppliersForPendingProcessors();
|
|
108
109
|
});
|
package/components/GridRow.js
CHANGED
|
@@ -32,6 +32,7 @@ var _gridSortingSelector = require("../hooks/features/sorting/gridSortingSelecto
|
|
|
32
32
|
var _gridRowsSelector = require("../hooks/features/rows/gridRowsSelector");
|
|
33
33
|
var _gridEditingSelectors = require("../hooks/features/editing/gridEditingSelectors");
|
|
34
34
|
var _gridRowReorderSelector = require("../hooks/features/rowReorder/gridRowReorderSelector");
|
|
35
|
+
var _GridRowDragAndDropOverlay = require("./GridRowDragAndDropOverlay");
|
|
35
36
|
var _getPinnedCellOffset = require("../internals/utils/getPinnedCellOffset");
|
|
36
37
|
var _useGridConfiguration = require("../hooks/utils/useGridConfiguration");
|
|
37
38
|
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
@@ -204,7 +205,7 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
204
205
|
rowStyle[property] = propertyValue;
|
|
205
206
|
}
|
|
206
207
|
return rowStyle;
|
|
207
|
-
}, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
|
|
208
|
+
}, [isNotVisible, rowHeight, styleProp, heightEntry.spacingTop, heightEntry.spacingBottom, rootProps.rowSpacingType]);
|
|
208
209
|
|
|
209
210
|
// HACK: Sometimes, the rowNode has already been removed from the state but the row is still rendered.
|
|
210
211
|
if (!rowNode) {
|
|
@@ -315,7 +316,9 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
315
316
|
}), cells, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
316
317
|
role: "presentation",
|
|
317
318
|
className: (0, _clsx.default)(_gridClasses.gridClasses.cell, _gridClasses.gridClasses.cellEmpty)
|
|
318
|
-
}), rightCells
|
|
319
|
+
}), rightCells, /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridRowDragAndDropOverlay.GridRowDragAndDropOverlay, {
|
|
320
|
+
rowId: rowId
|
|
321
|
+
})]
|
|
319
322
|
}));
|
|
320
323
|
});
|
|
321
324
|
if (process.env.NODE_ENV !== "production") GridRow.displayName = "GridRow";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { GridRowId } from "../models/gridRows.js";
|
|
3
|
+
export interface GridRowDragAndDropOverlayProps {
|
|
4
|
+
rowId: GridRowId;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const GridRowDragAndDropOverlay: React.NamedExoticComponent<GridRowDragAndDropOverlayProps>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.GridRowDragAndDropOverlay = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _createStyled = require("@mui/system/createStyled");
|
|
14
|
+
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
15
|
+
var _useGridSelector = require("../hooks/utils/useGridSelector");
|
|
16
|
+
var _gridRowReorderSelector = require("../hooks/features/rowReorder/gridRowReorderSelector");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
const GridRowDragAndDropOverlayRoot = (0, _styles.styled)('div', {
|
|
19
|
+
name: 'MuiDataGrid',
|
|
20
|
+
slot: 'RowDragOverlay',
|
|
21
|
+
shouldForwardProp: prop => (0, _createStyled.shouldForwardProp)(prop) && prop !== 'action'
|
|
22
|
+
})(({
|
|
23
|
+
theme,
|
|
24
|
+
action
|
|
25
|
+
}) => (0, _extends2.default)({
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
left: 0,
|
|
28
|
+
right: 0,
|
|
29
|
+
top: 0,
|
|
30
|
+
bottom: 0,
|
|
31
|
+
pointerEvents: 'none',
|
|
32
|
+
zIndex: 1
|
|
33
|
+
}, action === 'above' && {
|
|
34
|
+
'&::before': {
|
|
35
|
+
pointerEvents: 'none',
|
|
36
|
+
content: '""',
|
|
37
|
+
position: 'absolute',
|
|
38
|
+
top: 0,
|
|
39
|
+
left: 0,
|
|
40
|
+
right: 0,
|
|
41
|
+
height: '2px',
|
|
42
|
+
backgroundColor: (theme.vars || theme).palette.primary.main
|
|
43
|
+
}
|
|
44
|
+
}, action === 'below' && {
|
|
45
|
+
'&::after': {
|
|
46
|
+
pointerEvents: 'none',
|
|
47
|
+
content: '""',
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
bottom: '-2px',
|
|
50
|
+
left: 0,
|
|
51
|
+
right: 0,
|
|
52
|
+
height: '2px',
|
|
53
|
+
backgroundColor: (theme.vars || theme).palette.primary.main
|
|
54
|
+
}
|
|
55
|
+
}, action === 'inside' && {
|
|
56
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / 0.1)` : (0, _styles.alpha)(theme.palette.primary.main, 0.1)
|
|
57
|
+
}));
|
|
58
|
+
const GridRowDragAndDropOverlay = exports.GridRowDragAndDropOverlay = /*#__PURE__*/React.memo(function GridRowDragAndDropOverlay(props) {
|
|
59
|
+
const {
|
|
60
|
+
rowId,
|
|
61
|
+
className
|
|
62
|
+
} = props;
|
|
63
|
+
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
64
|
+
const dropPosition = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowReorderSelector.gridRowDropPositionSelector, rowId);
|
|
65
|
+
if (!dropPosition) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridRowDragAndDropOverlayRoot, {
|
|
69
|
+
action: dropPosition,
|
|
70
|
+
className: className
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
if (process.env.NODE_ENV !== "production") GridRowDragAndDropOverlay.displayName = "GridRowDragAndDropOverlay";
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { GridRenderCellParams } from "../../models/params/gridCellParams.js";
|
|
2
3
|
import { GridMenuProps } from "../menu/GridMenu.js";
|
|
3
4
|
interface GridActionsCellProps extends Omit<GridRenderCellParams, 'api'> {
|
|
4
5
|
api?: GridRenderCellParams['api'];
|
|
5
6
|
position?: GridMenuProps['position'];
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* If true, the children passed to the component will not be validated.
|
|
10
|
+
* If false, only `GridActionsCellItem` and `React.Fragment` are allowed as children.
|
|
11
|
+
* Only use this prop if you know what you are doing.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
suppressChildrenValidation?: boolean;
|
|
6
15
|
}
|
|
7
16
|
declare function GridActionsCell(props: GridActionsCellProps): import("react/jsx-runtime").JSX.Element;
|
|
8
17
|
declare namespace GridActionsCell {
|
|
@@ -14,21 +14,22 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
16
16
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
17
|
+
var _warning = require("@mui/x-internals/warning");
|
|
17
18
|
var _gridClasses = require("../../constants/gridClasses");
|
|
18
19
|
var _GridMenu = require("../menu/GridMenu");
|
|
19
20
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
20
21
|
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
22
|
+
var _GridActionsCellItem = require("./GridActionsCellItem");
|
|
21
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _excluded = ["api", "colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "
|
|
24
|
+
const _excluded = ["api", "colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "children", "suppressChildrenValidation"];
|
|
23
25
|
const hasActions = colDef => typeof colDef.getActions === 'function';
|
|
24
26
|
function GridActionsCell(props) {
|
|
25
27
|
const {
|
|
26
|
-
colDef,
|
|
27
|
-
id,
|
|
28
28
|
hasFocus,
|
|
29
29
|
tabIndex,
|
|
30
30
|
position = 'bottom-end',
|
|
31
|
-
|
|
31
|
+
children,
|
|
32
|
+
suppressChildrenValidation
|
|
32
33
|
} = props,
|
|
33
34
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
34
35
|
const [focusedButtonIndex, setFocusedButtonIndex] = React.useState(-1);
|
|
@@ -42,12 +43,27 @@ function GridActionsCell(props) {
|
|
|
42
43
|
const menuId = (0, _useId.default)();
|
|
43
44
|
const buttonId = (0, _useId.default)();
|
|
44
45
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
const actions = [];
|
|
47
|
+
React.Children.forEach(children, child => {
|
|
48
|
+
// Unwrap React.Fragment
|
|
49
|
+
if (/*#__PURE__*/React.isValidElement(child)) {
|
|
50
|
+
if (child.type === React.Fragment) {
|
|
51
|
+
React.Children.forEach(child.props.children, fragChild => {
|
|
52
|
+
if (/*#__PURE__*/React.isValidElement(fragChild)) {
|
|
53
|
+
actions.push(fragChild);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
} else if (child.type === _GridActionsCellItem.GridActionsCellItem || suppressChildrenValidation) {
|
|
57
|
+
actions.push(child);
|
|
58
|
+
} else {
|
|
59
|
+
const childType = typeof child.type === 'function' ? child.type.name : child.type;
|
|
60
|
+
(0, _warning.warnOnce)(`MUI X: Invalid child type in \`GridActionsCell\`. Expected \`GridActionsCellItem\` or \`React.Fragment\`, got \`${childType}\`.
|
|
61
|
+
If this is intentional, you can suppress this warning by passing the \`suppressChildrenValidation\` prop to \`GridActionsCell\`.`, 'error');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
const iconButtons = actions.filter(option => !option.props.showInMenu);
|
|
66
|
+
const menuButtons = actions.filter(option => option.props.showInMenu);
|
|
51
67
|
const numberOfButtons = iconButtons.length + (menuButtons.length ? 1 : 0);
|
|
52
68
|
React.useLayoutEffect(() => {
|
|
53
69
|
if (!hasFocus) {
|
|
@@ -70,22 +86,16 @@ function GridActionsCell(props) {
|
|
|
70
86
|
preventScroll: true
|
|
71
87
|
});
|
|
72
88
|
}, [focusedButtonIndex]);
|
|
89
|
+
const firstFocusableButtonIndex = actions.findIndex(o => !o.props.disabled);
|
|
73
90
|
React.useEffect(() => {
|
|
91
|
+
if (hasFocus && focusedButtonIndex === -1) {
|
|
92
|
+
setFocusedButtonIndex(firstFocusableButtonIndex);
|
|
93
|
+
}
|
|
74
94
|
if (!hasFocus) {
|
|
75
95
|
setFocusedButtonIndex(-1);
|
|
76
96
|
ignoreCallToFocus.current = false;
|
|
77
97
|
}
|
|
78
|
-
}, [hasFocus]);
|
|
79
|
-
React.useImperativeHandle(focusElementRef, () => ({
|
|
80
|
-
focus() {
|
|
81
|
-
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
82
|
-
if (!ignoreCallToFocus.current) {
|
|
83
|
-
// find the first focusable button and pass the index to the state
|
|
84
|
-
const focusableButtonIndex = options.findIndex(o => !o.props.disabled);
|
|
85
|
-
setFocusedButtonIndex(focusableButtonIndex);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}), [options]);
|
|
98
|
+
}, [hasFocus, focusedButtonIndex, firstFocusableButtonIndex]);
|
|
89
99
|
React.useEffect(() => {
|
|
90
100
|
if (focusedButtonIndex >= numberOfButtons) {
|
|
91
101
|
setFocusedButtonIndex(numberOfButtons - 1);
|
|
@@ -123,7 +133,7 @@ function GridActionsCell(props) {
|
|
|
123
133
|
return;
|
|
124
134
|
}
|
|
125
135
|
const getNewIndex = (index, direction) => {
|
|
126
|
-
if (index < 0 || index >
|
|
136
|
+
if (index < 0 || index > actions.length) {
|
|
127
137
|
return index;
|
|
128
138
|
}
|
|
129
139
|
|
|
@@ -132,7 +142,7 @@ function GridActionsCell(props) {
|
|
|
132
142
|
const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
133
143
|
|
|
134
144
|
// if the button that should receive focus is disabled go one more step
|
|
135
|
-
return
|
|
145
|
+
return actions[index + indexMod]?.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
|
|
136
146
|
};
|
|
137
147
|
let newIndex = focusedButtonIndex;
|
|
138
148
|
if (event.key === 'ArrowRight') {
|
|
@@ -209,6 +219,7 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
209
219
|
* The mode of the cell.
|
|
210
220
|
*/
|
|
211
221
|
cellMode: _propTypes.default.oneOf(['edit', 'view']).isRequired,
|
|
222
|
+
children: _propTypes.default.node.isRequired,
|
|
212
223
|
/**
|
|
213
224
|
* The column of the row that the current cell belongs to.
|
|
214
225
|
*/
|
|
@@ -217,16 +228,6 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
217
228
|
* The column field of the cell that triggered the event.
|
|
218
229
|
*/
|
|
219
230
|
field: _propTypes.default.string.isRequired,
|
|
220
|
-
/**
|
|
221
|
-
* A ref allowing to set imperative focus.
|
|
222
|
-
* It can be passed to the element that should receive focus.
|
|
223
|
-
* @ignore - do not document.
|
|
224
|
-
*/
|
|
225
|
-
focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
226
|
-
current: _propTypes.default.shape({
|
|
227
|
-
focus: _propTypes.default.func.isRequired
|
|
228
|
-
})
|
|
229
|
-
})]),
|
|
230
231
|
/**
|
|
231
232
|
* The cell value formatted with the column valueFormatter.
|
|
232
233
|
*/
|
|
@@ -262,6 +263,25 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
262
263
|
*/
|
|
263
264
|
value: _propTypes.default.any
|
|
264
265
|
} : void 0;
|
|
265
|
-
|
|
266
|
+
// Temporary wrapper for backward compatibility.
|
|
267
|
+
// Only used to support `getActions` method in `GridColDef`.
|
|
268
|
+
// TODO(v9): Remove this wrapper and the default `renderCell` in gridActionsColDef
|
|
269
|
+
function GridActionsCellWrapper(props) {
|
|
270
|
+
const {
|
|
271
|
+
colDef,
|
|
272
|
+
id
|
|
273
|
+
} = props;
|
|
274
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
275
|
+
if (!hasActions(colDef)) {
|
|
276
|
+
throw new Error('MUI X: Missing the `getActions` property in the `GridColDef`.');
|
|
277
|
+
}
|
|
278
|
+
const actions = colDef.getActions(apiRef.current.getRowParams(id));
|
|
279
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridActionsCell, (0, _extends2.default)({
|
|
280
|
+
suppressChildrenValidation: true
|
|
281
|
+
}, props, {
|
|
282
|
+
children: actions
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
const renderActionsCell = params => /*#__PURE__*/(0, _jsxRuntime.jsx)(GridActionsCellWrapper, (0, _extends2.default)({}, params));
|
|
266
286
|
exports.renderActionsCell = renderActionsCell;
|
|
267
287
|
if (process.env.NODE_ENV !== "production") renderActionsCell.displayName = "renderActionsCell";
|
|
@@ -77,16 +77,6 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
77
77
|
* The column field of the cell that triggered the event.
|
|
78
78
|
*/
|
|
79
79
|
field: _propTypes.default.string.isRequired,
|
|
80
|
-
/**
|
|
81
|
-
* A ref allowing to set imperative focus.
|
|
82
|
-
* It can be passed to the element that should receive focus.
|
|
83
|
-
* @ignore - do not document.
|
|
84
|
-
*/
|
|
85
|
-
focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
86
|
-
current: _propTypes.default.shape({
|
|
87
|
-
focus: _propTypes.default.func.isRequired
|
|
88
|
-
})
|
|
89
|
-
})]),
|
|
90
80
|
/**
|
|
91
81
|
* The cell value formatted with the column valueFormatter.
|
|
92
82
|
*/
|
|
@@ -21,6 +21,7 @@ var _RtlProvider = require("@mui/system/RtlProvider");
|
|
|
21
21
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
22
22
|
var _store = require("@mui/x-internals/store");
|
|
23
23
|
var _xVirtualizer = require("@mui/x-virtualizer");
|
|
24
|
+
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
24
25
|
var _doesSupportPreventScroll = require("../../utils/doesSupportPreventScroll");
|
|
25
26
|
var _gridClasses = require("../../constants/gridClasses");
|
|
26
27
|
var _models = require("../../models");
|
|
@@ -142,8 +143,7 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
142
143
|
isEditable = false,
|
|
143
144
|
value
|
|
144
145
|
} = cellParams;
|
|
145
|
-
const
|
|
146
|
-
const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParams.tabIndex : -1;
|
|
146
|
+
const tabIndex = (cellMode === 'view' || !isEditable) && column.type !== 'actions' ? cellParams.tabIndex : -1;
|
|
147
147
|
const {
|
|
148
148
|
classes: rootClasses,
|
|
149
149
|
getCellClassName
|
|
@@ -167,7 +167,6 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
167
167
|
const valueToRender = cellParams.formattedValue ?? value;
|
|
168
168
|
const cellRef = React.useRef(null);
|
|
169
169
|
const handleRef = (0, _useForkRef.default)(ref, cellRef);
|
|
170
|
-
const focusElementRef = React.useRef(null);
|
|
171
170
|
const isSelectionMode = rootProps.cellSelection ?? false;
|
|
172
171
|
const ownerState = {
|
|
173
172
|
align,
|
|
@@ -231,14 +230,14 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
231
230
|
}
|
|
232
231
|
return cellStyle;
|
|
233
232
|
}, [width, isNotVisible, styleProp, pinnedOffset, pinnedPosition, isRtl, rowSpan]);
|
|
234
|
-
|
|
233
|
+
(0, _useEnhancedEffect.default)(() => {
|
|
235
234
|
if (!hasFocus || cellMode === _models.GridCellModes.Edit) {
|
|
236
235
|
return;
|
|
237
236
|
}
|
|
238
237
|
const doc = (0, _ownerDocument.default)(apiRef.current.rootElementRef.current);
|
|
239
238
|
if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
|
|
240
239
|
const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
|
|
241
|
-
const elementToFocus =
|
|
240
|
+
const elementToFocus = focusableElement || cellRef.current;
|
|
242
241
|
if ((0, _doesSupportPreventScroll.doesSupportPreventScroll)()) {
|
|
243
242
|
elementToFocus.focus({
|
|
244
243
|
preventScroll: true
|
|
@@ -299,11 +298,6 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
299
298
|
children = valueString;
|
|
300
299
|
title = valueString;
|
|
301
300
|
}
|
|
302
|
-
if (/*#__PURE__*/React.isValidElement(children) && canManageOwnFocus) {
|
|
303
|
-
children = /*#__PURE__*/React.cloneElement(children, {
|
|
304
|
-
focusElementRef
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
301
|
const draggableEventHandlers = disableDragEvents ? null : {
|
|
308
302
|
onDragEnter: publish('cellDragEnter', onDragEnter),
|
|
309
303
|
onDragOver: publish('cellDragOver', onDragOver)
|
|
@@ -85,7 +85,7 @@ function GridColumnHeaderItem(props) {
|
|
|
85
85
|
const columnMenuButtonId = (0, _useId.default)();
|
|
86
86
|
const iconButtonRef = React.useRef(null);
|
|
87
87
|
const [showColumnMenuIcon, setShowColumnMenuIcon] = React.useState(columnMenuOpen);
|
|
88
|
-
const isDraggable =
|
|
88
|
+
const isDraggable = !rootProps.disableColumnReorder && !disableReorder && !colDef.disableReorder;
|
|
89
89
|
let headerComponent;
|
|
90
90
|
if (colDef.renderHeader) {
|
|
91
91
|
headerComponent = colDef.renderHeader(apiRef.current.getColumnHeaderParams(colDef.field));
|
|
@@ -131,7 +131,7 @@ function GridColumnHeaderItem(props) {
|
|
|
131
131
|
onDoubleClick: publish('columnSeparatorDoubleClick')
|
|
132
132
|
}), [publish]);
|
|
133
133
|
React.useEffect(() => {
|
|
134
|
-
if (!showColumnMenuIcon) {
|
|
134
|
+
if (!showColumnMenuIcon && columnMenuOpen) {
|
|
135
135
|
setShowColumnMenuIcon(columnMenuOpen);
|
|
136
136
|
}
|
|
137
137
|
}, [showColumnMenuIcon, columnMenuOpen]);
|