@mui/x-data-grid 7.24.1 → 7.26.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 +148 -0
- package/DataGrid/DataGrid.js +1 -7
- package/DataGrid/useDataGridComponent.js +2 -2
- package/components/GridRow.d.ts +0 -1
- package/components/GridRow.js +32 -20
- package/components/GridScrollArea.d.ts +5 -2
- package/components/GridScrollArea.js +32 -25
- package/components/GridSkeletonLoadingOverlay.js +2 -1
- package/components/cell/GridCell.d.ts +9 -6
- package/components/cell/GridCell.js +29 -52
- package/components/containers/GridRoot.js +11 -9
- package/components/containers/GridRootStyles.js +138 -40
- package/components/toolbar/GridToolbarColumnsButton.js +5 -4
- package/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/components/toolbar/GridToolbarFilterButton.js +4 -3
- package/components/virtualization/GridMainContainer.d.ts +10 -0
- package/components/virtualization/GridMainContainer.js +10 -2
- package/components/virtualization/GridVirtualScrollbar.d.ts +4 -0
- package/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/components/virtualization/GridVirtualScroller.js +36 -16
- package/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/hooks/core/useGridStateInitialization.js +3 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/hooks/features/columns/gridColumnsSelector.d.ts +0 -5
- package/hooks/features/columns/gridColumnsSelector.js +0 -12
- package/hooks/features/columns/useGridColumns.js +7 -3
- package/hooks/features/dimensions/gridDimensionsSelectors.d.ts +16 -0
- package/hooks/features/dimensions/gridDimensionsSelectors.js +26 -1
- package/hooks/features/dimensions/index.d.ts +1 -1
- package/hooks/features/dimensions/index.js +1 -2
- package/hooks/features/dimensions/useGridDimensions.js +102 -77
- package/hooks/features/editing/gridEditingSelectors.d.ts +10 -0
- package/hooks/features/editing/gridEditingSelectors.js +12 -1
- package/hooks/features/editing/index.d.ts +1 -1
- package/hooks/features/editing/index.js +1 -1
- package/hooks/features/editing/useGridCellEditing.js +3 -3
- package/hooks/features/editing/useGridRowEditing.js +8 -9
- package/hooks/features/filter/gridFilterState.d.ts +5 -0
- package/hooks/features/filter/gridFilterState.js +5 -0
- package/hooks/features/filter/useGridFilter.js +6 -13
- package/hooks/features/focus/useGridFocus.js +3 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
- package/hooks/features/keyboardNavigation/utils.d.ts +1 -2
- package/hooks/features/keyboardNavigation/utils.js +0 -5
- package/hooks/features/listView/useGridListView.js +2 -1
- package/hooks/features/pagination/useGridPagination.js +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +4 -4
- package/hooks/features/rowSelection/utils.js +1 -1
- package/hooks/features/rows/gridRowsMetaState.d.ts +8 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +0 -4
- package/hooks/features/rows/gridRowsUtils.js +0 -16
- package/hooks/features/rows/useGridParamsApi.d.ts +1 -1
- package/hooks/features/rows/useGridParamsApi.js +33 -14
- package/hooks/features/rows/useGridRowSpanning.js +94 -91
- package/hooks/features/rows/useGridRows.js +7 -8
- package/hooks/features/rows/useGridRowsMeta.js +36 -19
- package/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +15 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +74 -72
- package/hooks/utils/useGridSelector.d.ts +8 -1
- package/hooks/utils/useGridSelector.js +42 -8
- package/hooks/utils/useIsSSR.d.ts +1 -0
- package/hooks/utils/useIsSSR.js +5 -0
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +2 -1
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridParamsApi.d.ts +29 -2
- package/models/api/gridStateApi.d.ts +1 -0
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +6 -0
- package/modern/DataGrid/DataGrid.js +1 -7
- package/modern/DataGrid/useDataGridComponent.js +2 -2
- package/modern/components/GridRow.js +32 -20
- package/modern/components/GridScrollArea.js +32 -25
- package/modern/components/GridSkeletonLoadingOverlay.js +2 -1
- package/modern/components/cell/GridCell.js +29 -52
- package/modern/components/containers/GridRoot.js +11 -9
- package/modern/components/containers/GridRootStyles.js +138 -40
- package/modern/components/toolbar/GridToolbarColumnsButton.js +5 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/modern/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +4 -3
- package/modern/components/virtualization/GridMainContainer.js +10 -2
- package/modern/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/modern/components/virtualization/GridVirtualScroller.js +36 -16
- package/modern/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/modern/hooks/core/useGridStateInitialization.js +3 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/modern/hooks/features/columns/gridColumnsSelector.js +0 -12
- package/modern/hooks/features/columns/useGridColumns.js +7 -3
- package/modern/hooks/features/dimensions/gridDimensionsSelectors.js +26 -1
- package/modern/hooks/features/dimensions/index.js +1 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +102 -77
- package/modern/hooks/features/editing/gridEditingSelectors.js +12 -1
- package/modern/hooks/features/editing/index.js +1 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +8 -9
- package/modern/hooks/features/filter/gridFilterState.js +5 -0
- package/modern/hooks/features/filter/useGridFilter.js +6 -13
- package/modern/hooks/features/focus/useGridFocus.js +3 -2
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -16
- package/modern/hooks/features/keyboardNavigation/utils.js +0 -5
- package/modern/hooks/features/listView/useGridListView.js +2 -1
- package/modern/hooks/features/pagination/useGridPagination.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +4 -4
- package/modern/hooks/features/rowSelection/utils.js +1 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +0 -16
- package/modern/hooks/features/rows/useGridParamsApi.js +33 -14
- package/modern/hooks/features/rows/useGridRowSpanning.js +94 -91
- package/modern/hooks/features/rows/useGridRows.js +7 -8
- package/modern/hooks/features/rows/useGridRowsMeta.js +36 -19
- package/modern/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +74 -72
- package/modern/hooks/utils/useGridSelector.js +42 -8
- package/modern/hooks/utils/useIsSSR.js +5 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/models/api/index.js +0 -1
- package/modern/utils/roundToDecimalPlaces.js +3 -0
- package/modern/utils/utils.js +6 -1
- package/node/DataGrid/DataGrid.js +1 -7
- package/node/DataGrid/useDataGridComponent.js +2 -2
- package/node/components/GridRow.js +28 -17
- package/node/components/GridScrollArea.js +31 -24
- package/node/components/GridSkeletonLoadingOverlay.js +2 -1
- package/node/components/cell/GridCell.js +27 -50
- package/node/components/containers/GridRoot.js +10 -8
- package/node/components/containers/GridRootStyles.js +138 -40
- package/node/components/toolbar/GridToolbarColumnsButton.js +5 -4
- package/node/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/node/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/node/components/toolbar/GridToolbarFilterButton.js +4 -3
- package/node/components/virtualization/GridMainContainer.js +10 -2
- package/node/components/virtualization/GridVirtualScrollbar.js +5 -5
- package/node/components/virtualization/GridVirtualScroller.js +36 -16
- package/node/components/virtualization/GridVirtualScrollerContent.js +11 -2
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/node/hooks/core/useGridStateInitialization.js +3 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/node/hooks/features/columns/gridColumnsSelector.js +1 -13
- package/node/hooks/features/columns/useGridColumns.js +7 -3
- package/node/hooks/features/dimensions/gridDimensionsSelectors.js +38 -2
- package/node/hooks/features/dimensions/index.js +13 -11
- package/node/hooks/features/dimensions/useGridDimensions.js +99 -74
- package/node/hooks/features/editing/gridEditingSelectors.js +12 -2
- package/node/hooks/features/editing/index.js +7 -11
- package/node/hooks/features/editing/useGridCellEditing.js +2 -2
- package/node/hooks/features/editing/useGridRowEditing.js +6 -7
- package/node/hooks/features/filter/gridFilterState.js +6 -1
- package/node/hooks/features/filter/useGridFilter.js +5 -12
- package/node/hooks/features/focus/useGridFocus.js +3 -2
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +24 -15
- package/node/hooks/features/keyboardNavigation/utils.js +0 -6
- package/node/hooks/features/listView/useGridListView.js +2 -1
- package/node/hooks/features/pagination/useGridPagination.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +3 -3
- package/node/hooks/features/rowSelection/utils.js +1 -1
- package/node/hooks/features/rows/gridRowsUtils.js +0 -17
- package/node/hooks/features/rows/useGridParamsApi.js +33 -14
- package/node/hooks/features/rows/useGridRowSpanning.js +92 -89
- package/node/hooks/features/rows/useGridRows.js +7 -8
- package/node/hooks/features/rows/useGridRowsMeta.js +36 -19
- package/node/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +73 -71
- package/node/hooks/utils/useGridSelector.js +42 -8
- package/node/hooks/utils/useIsSSR.js +12 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +20 -7
- package/node/models/api/index.js +0 -11
- package/node/utils/roundToDecimalPlaces.js +9 -0
- package/node/utils/utils.js +8 -1
- package/package.json +3 -2
- package/utils/roundToDecimalPlaces.d.ts +1 -0
- package/utils/roundToDecimalPlaces.js +3 -0
- package/utils/utils.d.ts +1 -0
- package/utils/utils.js +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,154 @@
|
|
|
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
|
+
## 7.26.0
|
|
7
|
+
|
|
8
|
+
_Feb 7, 2025_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- ⚡ Mount and resize performance improvements for the Data Grid
|
|
13
|
+
- 🐞 Bugfixes
|
|
14
|
+
|
|
15
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
16
|
+
@lauri865.
|
|
17
|
+
Following are all team members who have contributed to this release:
|
|
18
|
+
@arminmeh, @noraleonte, @LukasTy, @KenanYusuf, @flaviendelangle.
|
|
19
|
+
|
|
20
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
21
|
+
|
|
22
|
+
### Data Grid
|
|
23
|
+
|
|
24
|
+
#### `@mui/x-data-grid@7.26.0`
|
|
25
|
+
|
|
26
|
+
- [DataGrid] Avoid `<GridRoot />` double-render pass on mount in SPA mode (#16480) @lauri865
|
|
27
|
+
|
|
28
|
+
#### `@mui/x-data-grid-pro@7.26.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
29
|
+
|
|
30
|
+
Same changes as in `@mui/x-data-grid@7.26.0`, plus:
|
|
31
|
+
|
|
32
|
+
- [DataGridPro] Fix the return type of `useGridApiContext()` for Pro and Premium packages on React < 19 (#16446) @arminmeh
|
|
33
|
+
|
|
34
|
+
#### `@mui/x-data-grid-premium@7.26.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
35
|
+
|
|
36
|
+
Same changes as in `@mui/x-data-grid-pro@7.26.0`, plus:
|
|
37
|
+
|
|
38
|
+
- [DataGridPremium] Fix "no rows" overlay not showing with active aggregation (#16468) @KenanYusuf
|
|
39
|
+
|
|
40
|
+
### Date and Time Pickers
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-date-pickers@7.26.0`
|
|
43
|
+
|
|
44
|
+
Internal changes.
|
|
45
|
+
|
|
46
|
+
#### `@mui/x-date-pickers-pro@7.26.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
47
|
+
|
|
48
|
+
Same changes as in `@mui/x-date-pickers@7.26.0`, plus:
|
|
49
|
+
|
|
50
|
+
- [DateRangePicker] Fix `currentMonthCalendarPosition` prop behavior on mobile (#16457) @LukasTy
|
|
51
|
+
- [DateRangePicker] Fix vertical alignment for multi input fields (#16490) @noraleonte
|
|
52
|
+
|
|
53
|
+
### Charts
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-charts@7.26.0`
|
|
56
|
+
|
|
57
|
+
Internal changes.
|
|
58
|
+
|
|
59
|
+
#### `@mui/x-charts-pro@7.26.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
60
|
+
|
|
61
|
+
Same changes as in `@mui/x-charts@7.26.0`.
|
|
62
|
+
|
|
63
|
+
### Tree View
|
|
64
|
+
|
|
65
|
+
#### `@mui/x-tree-view@7.26.0`
|
|
66
|
+
|
|
67
|
+
Internal changes.
|
|
68
|
+
|
|
69
|
+
#### `@mui/x-tree-view-pro@7.26.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
70
|
+
|
|
71
|
+
Same changes as in `@mui/x-tree-view@7.26.0`.
|
|
72
|
+
|
|
73
|
+
### Core
|
|
74
|
+
|
|
75
|
+
- [core] Fix corepack and pnpm installation in CircleCI (#16452) @flaviendelangle
|
|
76
|
+
|
|
77
|
+
## 7.25.0
|
|
78
|
+
|
|
79
|
+
_Jan 31, 2025_
|
|
80
|
+
|
|
81
|
+
We'd like to offer a big thanks to the 5 contributors who made this release possible. Here are some highlights ✨:
|
|
82
|
+
|
|
83
|
+
- 🐞 Bugfixes
|
|
84
|
+
|
|
85
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
86
|
+
@k-rajat19, @lauri865.
|
|
87
|
+
Following are all team members who have contributed to this release:
|
|
88
|
+
@KenanYusuf, @MBilalShafi, @arminmeh.
|
|
89
|
+
|
|
90
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
91
|
+
|
|
92
|
+
### Data Grid
|
|
93
|
+
|
|
94
|
+
#### `@mui/x-data-grid@7.25.0`
|
|
95
|
+
|
|
96
|
+
- [DataGrid] Fix `renderContext` calculation with scroll bounce / over-scroll (#16368) @lauri865
|
|
97
|
+
- [DataGrid] Refactor row state propagation (#16351) @lauri865
|
|
98
|
+
- [DataGrid] Add missing style overrides (#16272) (#16358) @KenanYusuf
|
|
99
|
+
- [DataGrid] Fix header filters keyboard navigation when there are no rows (#16369) @k-rajat19
|
|
100
|
+
- [DataGrid] Fix order of `onClick` prop on toolbar buttons (#16364) @KenanYusuf
|
|
101
|
+
- [DataGrid] Improve test coverage of server side data source (#15988) @MBilalShafi
|
|
102
|
+
- [DataGrid] Remove outdated warning (#16370) @MBilalShafi
|
|
103
|
+
- [DataGrid] Respect width of `iconContainer` during autosizing (#16409) @michelengelen
|
|
104
|
+
|
|
105
|
+
#### `@mui/x-data-grid-pro@7.25.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
106
|
+
|
|
107
|
+
Same changes as in `@mui/x-data-grid@7.25.0`, plus:
|
|
108
|
+
|
|
109
|
+
- [DataGridPro] Fix the return type of `useGridApiRef` for Pro and Premium packages on React < 19 (#16348) @arminmeh
|
|
110
|
+
- [DataGridPro] Fetch new rows only once when multiple models are changed in one cycle (#16382) @arminmeh
|
|
111
|
+
|
|
112
|
+
#### `@mui/x-data-grid-premium@7.25.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
113
|
+
|
|
114
|
+
Same changes as in `@mui/x-data-grid-pro@7.25.0`.
|
|
115
|
+
|
|
116
|
+
### Date and Time Pickers
|
|
117
|
+
|
|
118
|
+
#### `@mui/x-date-pickers@7.25.0`
|
|
119
|
+
|
|
120
|
+
Internal changes.
|
|
121
|
+
|
|
122
|
+
#### `@mui/x-date-pickers-pro@7.25.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
123
|
+
|
|
124
|
+
Same changes as in `@mui/x-date-pickers@7.25.0`.
|
|
125
|
+
|
|
126
|
+
### Charts
|
|
127
|
+
|
|
128
|
+
#### `@mui/x-charts@7.25.0`
|
|
129
|
+
|
|
130
|
+
Internal changes.
|
|
131
|
+
|
|
132
|
+
#### `@mui/x-charts-pro@7.25.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
133
|
+
|
|
134
|
+
Same changes as in `@mui/x-charts@7.25.0`.
|
|
135
|
+
|
|
136
|
+
### Tree View
|
|
137
|
+
|
|
138
|
+
#### `@mui/x-tree-view@7.25.0`
|
|
139
|
+
|
|
140
|
+
Internal changes.
|
|
141
|
+
|
|
142
|
+
#### `@mui/x-tree-view-pro@7.25.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
143
|
+
|
|
144
|
+
Same changes as in `@mui/x-tree-view@7.25.0`.
|
|
145
|
+
|
|
146
|
+
### Docs
|
|
147
|
+
|
|
148
|
+
- [docs] Improve release documentation (#16322) @MBilalShafi
|
|
149
|
+
|
|
150
|
+
### Core
|
|
151
|
+
|
|
152
|
+
- [test] Fix flaky data source tests in DataGrid (#16382) @lauri865
|
|
153
|
+
|
|
6
154
|
## 7.24.1
|
|
7
155
|
|
|
8
156
|
_Jan 24, 2025_
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -18,17 +18,11 @@ const configuration = {
|
|
|
18
18
|
useGridRowAriaAttributes
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
-
let propValidators;
|
|
22
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
23
|
-
propValidators = [...propValidatorsDataGrid,
|
|
24
|
-
// Only validate in MIT version
|
|
25
|
-
props => props.columns && props.columns.some(column => column.resizable) && [`MUI X: \`column.resizable = true\` is not a valid prop.`, 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n') || undefined];
|
|
26
|
-
}
|
|
27
21
|
const DataGridRaw = forwardRef(function DataGrid(inProps, ref) {
|
|
28
22
|
const props = useDataGridProps(inProps);
|
|
29
23
|
const privateApiRef = useDataGridComponent(props.apiRef, props);
|
|
30
24
|
if (process.env.NODE_ENV !== 'production') {
|
|
31
|
-
validateProps(props,
|
|
25
|
+
validateProps(props, propValidatorsDataGrid);
|
|
32
26
|
}
|
|
33
27
|
return /*#__PURE__*/_jsx(GridContextProvider, {
|
|
34
28
|
privateApiRef: privateApiRef,
|
|
@@ -41,7 +41,6 @@ export const useDataGridComponent = (inputApiRef, props) => {
|
|
|
41
41
|
/**
|
|
42
42
|
* Register all state initializers here.
|
|
43
43
|
*/
|
|
44
|
-
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
|
|
45
44
|
useGridInitializeState(rowSelectionStateInitializer, apiRef, props);
|
|
46
45
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
47
46
|
useGridInitializeState(paginationStateInitializer, apiRef, props);
|
|
@@ -54,10 +53,11 @@ export const useDataGridComponent = (inputApiRef, props) => {
|
|
|
54
53
|
useGridInitializeState(rowSpanningStateInitializer, apiRef, props);
|
|
55
54
|
useGridInitializeState(densityStateInitializer, apiRef, props);
|
|
56
55
|
useGridInitializeState(columnResizeStateInitializer, apiRef, props);
|
|
57
|
-
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
58
56
|
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
59
57
|
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
60
58
|
useGridInitializeState(virtualizationStateInitializer, apiRef, props);
|
|
59
|
+
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
|
|
60
|
+
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
61
61
|
useGridInitializeState(listViewStateInitializer, apiRef, props);
|
|
62
62
|
useGridKeyboardNavigation(apiRef, props);
|
|
63
63
|
useGridRowSelection(apiRef, props);
|
package/components/GridRow.d.ts
CHANGED
package/components/GridRow.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "
|
|
5
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetLeft", "columnsTotalWidth", "firstColumnIndex", "lastColumnIndex", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "scrollbarWidth", "gridHasFiller", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import clsx from 'clsx';
|
|
7
9
|
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
8
10
|
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
9
11
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
10
|
-
import {
|
|
12
|
+
import { isObjectEmpty } from '@mui/x-internals/isObjectEmpty';
|
|
13
|
+
import { GridEditModes, GridCellModes } from "../models/gridEditRowModel.js";
|
|
11
14
|
import { gridClasses } from "../constants/gridClasses.js";
|
|
12
15
|
import { composeGridClasses } from "../utils/composeGridClasses.js";
|
|
13
16
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
14
17
|
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from "../utils/cellBorderUtils.js";
|
|
15
18
|
import { gridColumnPositionsSelector } from "../hooks/features/columns/gridColumnsSelector.js";
|
|
16
|
-
import { useGridSelector, objectShallowCompare } from "../hooks/utils/useGridSelector.js";
|
|
19
|
+
import { useGridSelector, objectShallowCompare, useGridSelectorV8 } from "../hooks/utils/useGridSelector.js";
|
|
17
20
|
import { useGridVisibleRows } from "../hooks/utils/useGridVisibleRows.js";
|
|
18
21
|
import { findParentElementFromClassName, isEventTargetInPortal } from "../utils/domUtils.js";
|
|
19
22
|
import { GRID_CHECKBOX_SELECTION_COL_DEF } from "../colDef/gridCheckboxSelectionColDef.js";
|
|
@@ -21,12 +24,20 @@ import { GRID_ACTIONS_COLUMN_TYPE } from "../colDef/gridActionsColDef.js";
|
|
|
21
24
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD, PinnedColumnPosition } from "../internals/constants.js";
|
|
22
25
|
import { gridSortModelSelector } from "../hooks/features/sorting/gridSortingSelector.js";
|
|
23
26
|
import { gridRowMaximumTreeDepthSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
24
|
-
import { gridEditRowsStateSelector } from "../hooks/features/editing/gridEditingSelectors.js";
|
|
27
|
+
import { gridEditRowsStateSelector, gridRowIsEditingSelector } from "../hooks/features/editing/gridEditingSelectors.js";
|
|
25
28
|
import { GridScrollbarFillerCell as ScrollbarFiller } from "./GridScrollbarFillerCell.js";
|
|
26
29
|
import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
|
|
27
30
|
import { useGridConfiguration } from "../hooks/utils/useGridConfiguration.js";
|
|
28
31
|
import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
|
|
32
|
+
import { createSelectorV8 } from "../utils/createSelector.js";
|
|
29
33
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
34
|
+
const isRowReorderingEnabledSelector = createSelectorV8(gridEditRowsStateSelector, (editRows, rowReordering) => {
|
|
35
|
+
if (!rowReordering) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
const isEditingRows = !isObjectEmpty(editRows);
|
|
39
|
+
return !isEditingRows;
|
|
40
|
+
});
|
|
30
41
|
const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
31
42
|
const {
|
|
32
43
|
selected,
|
|
@@ -65,10 +76,14 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
65
76
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
66
77
|
const treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
67
78
|
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
68
|
-
const
|
|
79
|
+
const rowReordering = rootProps.rowReordering;
|
|
80
|
+
const isRowReorderingEnabled = useGridSelectorV8(apiRef, isRowReorderingEnabledSelector, rowReordering);
|
|
69
81
|
const handleRef = useForkRef(ref, refProp);
|
|
70
82
|
const rowNode = apiRef.current.getRowNode(rowId);
|
|
71
|
-
const editing = apiRef
|
|
83
|
+
const editing = useGridSelectorV8(apiRef, gridRowIsEditingSelector, {
|
|
84
|
+
rowId,
|
|
85
|
+
editMode: rootProps.editMode
|
|
86
|
+
});
|
|
72
87
|
const editable = rootProps.editMode === GridEditModes.Row;
|
|
73
88
|
const hasFocusCell = focusedColumnIndex !== undefined;
|
|
74
89
|
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < firstColumnIndex;
|
|
@@ -145,7 +160,6 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
145
160
|
slotProps,
|
|
146
161
|
disableColumnReorder
|
|
147
162
|
} = rootProps;
|
|
148
|
-
const rowReordering = rootProps.rowReordering;
|
|
149
163
|
const heightEntry = useGridSelector(apiRef, () => _extends({}, apiRef.current.getRowHeightEntry(rowId)), objectShallowCompare);
|
|
150
164
|
const style = React.useMemo(() => {
|
|
151
165
|
if (isNotVisible) {
|
|
@@ -188,6 +202,11 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
188
202
|
});
|
|
189
203
|
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
190
204
|
}
|
|
205
|
+
|
|
206
|
+
/* Start of rendering */
|
|
207
|
+
if (!rowNode) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
191
210
|
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedColumnPosition.NONE) => {
|
|
192
211
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
193
212
|
if (cellColSpanInfo?.spannedByColSpan) {
|
|
@@ -205,14 +224,12 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
205
224
|
align: column.align
|
|
206
225
|
}, column.field);
|
|
207
226
|
}
|
|
208
|
-
const editCellState = editRowsState[rowId]?.[column.field] ?? null;
|
|
209
227
|
|
|
210
228
|
// when the cell is a reorder cell we are not allowing to reorder the col
|
|
211
229
|
// fixes https://github.com/mui/mui-x/issues/11126
|
|
212
230
|
const isReorderCell = column.field === '__reorder__';
|
|
213
|
-
const isEditingRows = Object.keys(editRowsState).length > 0;
|
|
214
231
|
const canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
215
|
-
const canReorderRow =
|
|
232
|
+
const canReorderRow = isRowReorderingEnabled && !sortModel.length && treeDepth <= 1;
|
|
216
233
|
const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
|
|
217
234
|
const cellIsNotVisible = pinnedPosition === PinnedColumnPosition.VIRTUAL;
|
|
218
235
|
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
|
|
@@ -225,20 +242,15 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
225
242
|
colIndex: indexRelativeToAllColumns,
|
|
226
243
|
colSpan: colSpan,
|
|
227
244
|
disableDragEvents: disableDragEvents,
|
|
228
|
-
editCellState: editCellState,
|
|
229
245
|
isNotVisible: cellIsNotVisible,
|
|
230
246
|
pinnedOffset: pinnedOffset,
|
|
231
247
|
pinnedPosition: pinnedPosition,
|
|
232
248
|
showLeftBorder: showLeftBorder,
|
|
233
|
-
showRightBorder: showRightBorder
|
|
249
|
+
showRightBorder: showRightBorder,
|
|
250
|
+
row: row,
|
|
251
|
+
rowNode: rowNode
|
|
234
252
|
}, slotProps?.cell), column.field);
|
|
235
253
|
};
|
|
236
|
-
|
|
237
|
-
/* Start of rendering */
|
|
238
|
-
|
|
239
|
-
if (!rowNode) {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
254
|
const leftCells = pinnedColumns.left.map((column, i) => {
|
|
243
255
|
const indexRelativeToAllColumns = i;
|
|
244
256
|
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.left.length, PinnedColumnPosition.LEFT);
|
|
@@ -289,7 +301,8 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
289
301
|
role: "presentation",
|
|
290
302
|
className: clsx(gridClasses.cell, gridClasses.cellEmpty)
|
|
291
303
|
}), rightCells, scrollbarWidth !== 0 && /*#__PURE__*/_jsx(ScrollbarFiller, {
|
|
292
|
-
pinnedRight: pinnedColumns.right.length > 0
|
|
304
|
+
pinnedRight: pinnedColumns.right.length > 0,
|
|
305
|
+
borderTop: !isFirstVisible
|
|
293
306
|
})]
|
|
294
307
|
}));
|
|
295
308
|
});
|
|
@@ -316,7 +329,6 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
316
329
|
isNotVisible: PropTypes.bool.isRequired,
|
|
317
330
|
lastColumnIndex: PropTypes.number.isRequired,
|
|
318
331
|
offsetLeft: PropTypes.number.isRequired,
|
|
319
|
-
offsetTop: PropTypes.number,
|
|
320
332
|
onClick: PropTypes.func,
|
|
321
333
|
onDoubleClick: PropTypes.func,
|
|
322
334
|
onMouseEnter: PropTypes.func,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
3
|
+
import { GridScrollParams } from '../models/params/gridScrollParams';
|
|
2
4
|
interface ScrollAreaProps {
|
|
3
5
|
scrollDirection: 'left' | 'right';
|
|
6
|
+
scrollPosition: RefObject<GridScrollParams>;
|
|
4
7
|
}
|
|
5
|
-
declare function
|
|
6
|
-
export declare const GridScrollArea: typeof
|
|
8
|
+
declare function GridScrollAreaWrapper(props: ScrollAreaProps): React.JSX.Element | null;
|
|
9
|
+
export declare const GridScrollArea: typeof GridScrollAreaWrapper;
|
|
7
10
|
export {};
|
|
@@ -8,12 +8,12 @@ import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
|
8
8
|
import { getDataGridUtilityClass, gridClasses } from "../constants/index.js";
|
|
9
9
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
10
10
|
import { useGridApiEventHandler } from "../hooks/utils/useGridApiEventHandler.js";
|
|
11
|
-
import { useGridSelector } from "../hooks/utils/useGridSelector.js";
|
|
12
|
-
import { gridDimensionsSelector } from "../hooks/features/dimensions/gridDimensionsSelectors.js";
|
|
11
|
+
import { useGridSelector, useGridSelectorV8 } from "../hooks/utils/useGridSelector.js";
|
|
12
|
+
import { gridDimensionsSelector, gridColumnsTotalWidthSelector } from "../hooks/features/dimensions/gridDimensionsSelectors.js";
|
|
13
13
|
import { gridDensityFactorSelector } from "../hooks/features/density/densitySelector.js";
|
|
14
|
-
import { gridColumnsTotalWidthSelector } from "../hooks/features/columns/gridColumnsSelector.js";
|
|
15
14
|
import { useTimeout } from "../hooks/utils/useTimeout.js";
|
|
16
15
|
import { getTotalHeaderHeight } from "../hooks/features/columns/gridColumnsUtils.js";
|
|
16
|
+
import { createSelectorV8 } from "../utils/createSelector.js";
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
const CLIFF = 1;
|
|
19
19
|
const SLOP = 1.5;
|
|
@@ -48,21 +48,38 @@ const GridScrollAreaRawRoot = styled('div', {
|
|
|
48
48
|
right: 0
|
|
49
49
|
}
|
|
50
50
|
}));
|
|
51
|
-
|
|
51
|
+
const offsetSelector = createSelectorV8(gridDimensionsSelector, (dimensions, direction) => {
|
|
52
|
+
if (direction === 'left') {
|
|
53
|
+
return dimensions.leftPinnedWidth;
|
|
54
|
+
}
|
|
55
|
+
if (direction === 'right') {
|
|
56
|
+
return dimensions.rightPinnedWidth + (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
|
|
57
|
+
}
|
|
58
|
+
return 0;
|
|
59
|
+
});
|
|
60
|
+
function GridScrollAreaWrapper(props) {
|
|
61
|
+
const apiRef = useGridApiContext();
|
|
62
|
+
const [dragging, setDragging] = React.useState(false);
|
|
63
|
+
useGridApiEventHandler(apiRef, 'columnHeaderDragStart', () => setDragging(true));
|
|
64
|
+
useGridApiEventHandler(apiRef, 'columnHeaderDragEnd', () => setDragging(false));
|
|
65
|
+
if (!dragging) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return /*#__PURE__*/_jsx(GridScrollAreaContent, _extends({}, props));
|
|
69
|
+
}
|
|
70
|
+
function GridScrollAreaContent(props) {
|
|
52
71
|
const {
|
|
53
|
-
scrollDirection
|
|
72
|
+
scrollDirection,
|
|
73
|
+
scrollPosition
|
|
54
74
|
} = props;
|
|
55
75
|
const rootRef = React.useRef(null);
|
|
56
76
|
const apiRef = useGridApiContext();
|
|
57
77
|
const timeout = useTimeout();
|
|
58
78
|
const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
|
|
59
79
|
const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
60
|
-
const
|
|
61
|
-
const scrollPosition = React.useRef({
|
|
62
|
-
left: 0,
|
|
63
|
-
top: 0
|
|
64
|
-
});
|
|
80
|
+
const sideOffset = useGridSelectorV8(apiRef, offsetSelector, scrollDirection);
|
|
65
81
|
const getCanScrollMore = () => {
|
|
82
|
+
const dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
66
83
|
if (scrollDirection === 'left') {
|
|
67
84
|
// Only render if the user has not reached yet the start of the list
|
|
68
85
|
return scrollPosition.current.left > 0;
|
|
@@ -74,7 +91,6 @@ function GridScrollAreaRaw(props) {
|
|
|
74
91
|
}
|
|
75
92
|
return false;
|
|
76
93
|
};
|
|
77
|
-
const [dragging, setDragging] = React.useState(false);
|
|
78
94
|
const [canScrollMore, setCanScrollMore] = React.useState(getCanScrollMore);
|
|
79
95
|
const rootProps = useGridRootProps();
|
|
80
96
|
const ownerState = _extends({}, rootProps, {
|
|
@@ -88,12 +104,11 @@ function GridScrollAreaRaw(props) {
|
|
|
88
104
|
top: totalHeaderHeight - headerHeight
|
|
89
105
|
};
|
|
90
106
|
if (scrollDirection === 'left') {
|
|
91
|
-
style.left =
|
|
107
|
+
style.left = sideOffset;
|
|
92
108
|
} else if (scrollDirection === 'right') {
|
|
93
|
-
style.right =
|
|
109
|
+
style.right = sideOffset;
|
|
94
110
|
}
|
|
95
|
-
const handleScrolling =
|
|
96
|
-
scrollPosition.current = newScrollPosition;
|
|
111
|
+
const handleScrolling = () => {
|
|
97
112
|
setCanScrollMore(getCanScrollMore);
|
|
98
113
|
};
|
|
99
114
|
const handleDragOver = useEventCallback(event => {
|
|
@@ -118,16 +133,8 @@ function GridScrollAreaRaw(props) {
|
|
|
118
133
|
});
|
|
119
134
|
});
|
|
120
135
|
});
|
|
121
|
-
const handleColumnHeaderDragStart = useEventCallback(() => {
|
|
122
|
-
setDragging(true);
|
|
123
|
-
});
|
|
124
|
-
const handleColumnHeaderDragEnd = useEventCallback(() => {
|
|
125
|
-
setDragging(false);
|
|
126
|
-
});
|
|
127
136
|
useGridApiEventHandler(apiRef, 'scrollPositionChange', handleScrolling);
|
|
128
|
-
|
|
129
|
-
useGridApiEventHandler(apiRef, 'columnHeaderDragEnd', handleColumnHeaderDragEnd);
|
|
130
|
-
if (!dragging || !canScrollMore) {
|
|
137
|
+
if (!canScrollMore) {
|
|
131
138
|
return null;
|
|
132
139
|
}
|
|
133
140
|
return /*#__PURE__*/_jsx(GridScrollAreaRawRoot, {
|
|
@@ -138,4 +145,4 @@ function GridScrollAreaRaw(props) {
|
|
|
138
145
|
style: style
|
|
139
146
|
});
|
|
140
147
|
}
|
|
141
|
-
export const GridScrollArea = fastMemo(
|
|
148
|
+
export const GridScrollArea = fastMemo(GridScrollAreaWrapper);
|
|
@@ -8,8 +8,9 @@ import { useRtl } from '@mui/system/RtlProvider';
|
|
|
8
8
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
9
9
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
10
10
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
11
|
-
import { gridColumnPositionsSelector,
|
|
11
|
+
import { gridColumnPositionsSelector, gridDimensionsSelector, gridVisibleColumnDefinitionsSelector, gridVisiblePinnedColumnDefinitionsSelector, useGridApiEventHandler, useGridSelector } from "../hooks/index.js";
|
|
12
12
|
import { PinnedColumnPosition } from "../internals/constants.js";
|
|
13
|
+
import { gridColumnsTotalWidthSelector } from "../hooks/features/dimensions/gridDimensionsSelectors.js";
|
|
13
14
|
import { getDataGridUtilityClass, gridClasses } from "../constants/gridClasses.js";
|
|
14
15
|
import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
|
|
15
16
|
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from "../utils/cellBorderUtils.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridRowId
|
|
3
|
-
import {
|
|
2
|
+
import { GridRowId } from '../../models';
|
|
3
|
+
import { GridAlignment, GridStateColDef } from '../../models/colDef/gridColDef';
|
|
4
|
+
import { GridRowModel, GridTreeNode } from '../../models/gridRows';
|
|
4
5
|
import { GridPinnedColumnPosition } from '../../hooks/features/columns/gridColumnsInterfaces';
|
|
5
6
|
import { PinnedColumnPosition } from '../../internals/constants';
|
|
6
7
|
export declare const gridPinnedColumnPositionLookup: {
|
|
@@ -13,13 +14,14 @@ export type GridCellProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
13
14
|
align: GridAlignment;
|
|
14
15
|
className?: string;
|
|
15
16
|
colIndex: number;
|
|
16
|
-
column:
|
|
17
|
+
column: GridStateColDef;
|
|
18
|
+
row: GridRowModel;
|
|
17
19
|
rowId: GridRowId;
|
|
20
|
+
rowNode: GridTreeNode;
|
|
18
21
|
width: number;
|
|
19
22
|
colSpan?: number;
|
|
20
23
|
disableDragEvents?: boolean;
|
|
21
24
|
isNotVisible: boolean;
|
|
22
|
-
editCellState: GridEditCellProps<any> | null;
|
|
23
25
|
pinnedOffset?: number;
|
|
24
26
|
pinnedPosition: PinnedColumnPosition;
|
|
25
27
|
showRightBorder: boolean;
|
|
@@ -45,13 +47,14 @@ declare const MemoizedGridCell: React.ForwardRefExoticComponent<GridCellProps> |
|
|
|
45
47
|
align: GridAlignment;
|
|
46
48
|
className?: string;
|
|
47
49
|
colIndex: number;
|
|
48
|
-
column:
|
|
50
|
+
column: GridStateColDef;
|
|
51
|
+
row: GridRowModel;
|
|
49
52
|
rowId: GridRowId;
|
|
53
|
+
rowNode: GridTreeNode;
|
|
50
54
|
width: number;
|
|
51
55
|
colSpan?: number;
|
|
52
56
|
disableDragEvents?: boolean;
|
|
53
57
|
isNotVisible: boolean;
|
|
54
|
-
editCellState: GridEditCellProps<any> | null;
|
|
55
58
|
pinnedOffset?: number;
|
|
56
59
|
pinnedPosition: PinnedColumnPosition;
|
|
57
60
|
showRightBorder: boolean;
|