@mui/x-data-grid-pro 7.23.0 → 7.23.2
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 +147 -0
- package/esm/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +17 -0
- package/esm/hooks/features/rowReorder/useGridRowReorder.js +8 -7
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +1 -1
- package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +17 -0
- package/hooks/features/rowReorder/useGridRowReorder.js +7 -6
- package/index.js +1 -1
- package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +17 -0
- package/modern/hooks/features/rowReorder/useGridRowReorder.js +8 -7
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +3 -3
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,153 @@
|
|
|
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.23.2
|
|
7
|
+
|
|
8
|
+
_Dec 12, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Improve Romanian and Turkish locales on the Data Grid
|
|
13
|
+
- 🌍 Improve Romanian locale on the Pickers
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
|
|
17
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
18
|
+
@ihsanberkozcan, @k-rajat19, @lhilgert9, @nusr, @rares985.
|
|
19
|
+
|
|
20
|
+
Following are all team members who have contributed to this release:
|
|
21
|
+
@alexfauquette, @arminmeh, @flaviendelangle, @JCQuintas, @KenanYusuf, @LukasTy.
|
|
22
|
+
|
|
23
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
24
|
+
|
|
25
|
+
### Data Grid
|
|
26
|
+
|
|
27
|
+
#### `@mui/x-data-grid@7.23.2`
|
|
28
|
+
|
|
29
|
+
- [DataGrid] Fix "No rows" displaying when all rows are pinned (#15851) @nusr
|
|
30
|
+
- [DataGrid] Use `columnsManagement` slot (#15821) @k-rajat19
|
|
31
|
+
- [l10n] Improve Romanian (ro-RO) locale (#15751) @rares985
|
|
32
|
+
- [l10n] Improve Turkish (tr-TR) locale (#15748) @ihsanberkozcan
|
|
33
|
+
|
|
34
|
+
#### `@mui/x-data-grid-pro@7.23.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
35
|
+
|
|
36
|
+
Same changes as in `@mui/x-data-grid@7.23.2`, plus:
|
|
37
|
+
|
|
38
|
+
- [DataGridPro] Make Row reordering work with pagination (#15782) @k-rajat19
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-data-grid-premium@7.23.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
41
|
+
|
|
42
|
+
Same changes as in `@mui/x-data-grid-pro@7.23.2`, plus:
|
|
43
|
+
|
|
44
|
+
- [DataGridPremium] Fix group column ignoring `valueOptions` for `singleSelect` column type (#15754) @arminmeh
|
|
45
|
+
|
|
46
|
+
### Date and Time Pickers
|
|
47
|
+
|
|
48
|
+
#### `@mui/x-date-pickers@7.23.2`
|
|
49
|
+
|
|
50
|
+
- [l10n] Improve Romanian (ro-RO) locale (#15751) @rares985
|
|
51
|
+
|
|
52
|
+
#### `@mui/x-date-pickers-pro@7.23.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
53
|
+
|
|
54
|
+
Same changes as in `@mui/x-date-pickers@7.23.2`.
|
|
55
|
+
|
|
56
|
+
### Charts
|
|
57
|
+
|
|
58
|
+
#### `@mui/x-charts@7.23.2`
|
|
59
|
+
|
|
60
|
+
- [charts] Fix key generation for the ChartsGrid (#15864) @alexfauquette
|
|
61
|
+
- [charts] Fix scatter dataset with missing data (#15804) @alexfauquette
|
|
62
|
+
|
|
63
|
+
#### `@mui/x-charts-pro@7.23.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
64
|
+
|
|
65
|
+
Same changes as in `@mui/x-charts@7.23.2`.
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-tree-view@v7.23.2`
|
|
68
|
+
|
|
69
|
+
No changes, releasing to keep the versions in sync.
|
|
70
|
+
|
|
71
|
+
#### `@mui/x-tree-view-pro@7.23.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
72
|
+
|
|
73
|
+
Releasing to benefit from license package fix (#15818).
|
|
74
|
+
|
|
75
|
+
### Docs
|
|
76
|
+
|
|
77
|
+
- [docs] Fix typo in charts axis documentation (#15746) @JCQuintas
|
|
78
|
+
- [docs] Improve Pickers accessible DOM structure description (#15752) @LukasTy
|
|
79
|
+
- [docs] Use `updateRows` method for list view demos (#15824) @KenanYusuf
|
|
80
|
+
- [docs] Use date library version from package dev dependencies for sandboxes (#15767) @LukasTy
|
|
81
|
+
|
|
82
|
+
### Core
|
|
83
|
+
|
|
84
|
+
- [core] Add `@mui/x-tree-view-pro` to `releaseChangelog` (#15747) @flaviendelangle
|
|
85
|
+
- [license] Use `console.log` for the error message on Codesandbox to avoid rendering error (#15818) @arminmeh
|
|
86
|
+
|
|
87
|
+
## 7.23.1
|
|
88
|
+
|
|
89
|
+
_Dec 5, 2024_
|
|
90
|
+
|
|
91
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
92
|
+
|
|
93
|
+
- 🌍 Improve German locale on the Data Grid component
|
|
94
|
+
- 🐞 Bugfixes
|
|
95
|
+
|
|
96
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
97
|
+
@lhilgert9.
|
|
98
|
+
|
|
99
|
+
Following are all team members who have contributed to this release:
|
|
100
|
+
@arthurbalduini, @cherniavskii, @flaviendelangle, @JCQuintas, @LukasTy and @MBilalShafi.
|
|
101
|
+
|
|
102
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
103
|
+
|
|
104
|
+
### Data Grid
|
|
105
|
+
|
|
106
|
+
#### `@mui/x-data-grid@7.23.1`
|
|
107
|
+
|
|
108
|
+
- [DataGrid] Make column autosizing work with flex columns (#15712) @cherniavskii
|
|
109
|
+
- [l10n] Improve German (de-DE) locale (#15641) @lhilgert9
|
|
110
|
+
|
|
111
|
+
#### `@mui/x-data-grid-pro@7.23.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
112
|
+
|
|
113
|
+
Same changes as in `@mui/x-data-grid@7.23.1`, plus:
|
|
114
|
+
|
|
115
|
+
- [DataGridPro] Cleanup pinned rows on removal (#15702) @cherniavskii
|
|
116
|
+
|
|
117
|
+
#### `@mui/x-data-grid-premium@7.23.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
118
|
+
|
|
119
|
+
Same changes as in `@mui/x-data-grid-pro@7.23.1`.
|
|
120
|
+
|
|
121
|
+
### Date and Time Pickers
|
|
122
|
+
|
|
123
|
+
#### `@mui/x-date-pickers@7.23.1`
|
|
124
|
+
|
|
125
|
+
- [TimePicker] Prevent mouse events after `touchend` event (#15430) @arthurbalduini
|
|
126
|
+
|
|
127
|
+
#### `@mui/x-date-pickers-pro@7.23.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
128
|
+
|
|
129
|
+
Same changes as in `@mui/x-date-pickers@7.23.1`.
|
|
130
|
+
|
|
131
|
+
### Charts
|
|
132
|
+
|
|
133
|
+
#### `@mui/x-charts@7.23.1`
|
|
134
|
+
|
|
135
|
+
- [charts] Improve SVG `pattern` and `gradient` support (#15724) @JCQuintas
|
|
136
|
+
|
|
137
|
+
#### `@mui/x-charts-pro@7.23.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
138
|
+
|
|
139
|
+
Same changes as in `@mui/x-charts@7.23.1`.
|
|
140
|
+
|
|
141
|
+
### Docs
|
|
142
|
+
|
|
143
|
+
- [docs] Fix Pickers theme augmentation example (#15675) @LukasTy
|
|
144
|
+
- [docs] Remove duplicated warning (#15715) @cherniavskii
|
|
145
|
+
- [test] Force hover in headless Chrome (#15711) @cherniavskii
|
|
146
|
+
- [docs-infra] Bump `@mui/internal-markdown` to support nested demo imports (#15738) @alexfauquette
|
|
147
|
+
- [docs] Improve SEO titles for the Data Grid (#15695) @MBilalShafi
|
|
148
|
+
|
|
149
|
+
### Core
|
|
150
|
+
|
|
151
|
+
- [core] Add `@mui/x-tree-view-pro` to `releaseChangelog` (#15747) @flaviendelangle
|
|
152
|
+
|
|
6
153
|
## 7.23.0
|
|
7
154
|
|
|
8
155
|
_Nov 29, 2024_
|
|
@@ -60,14 +60,31 @@ export function addPinnedRow({
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
export const useGridRowPinningPreProcessors = apiRef => {
|
|
63
|
+
const prevPinnedRowsCacheRef = React.useRef(null);
|
|
63
64
|
const addPinnedRows = React.useCallback(groupingParams => {
|
|
64
65
|
const pinnedRowsCache = apiRef.current.caches.pinnedRows || {};
|
|
66
|
+
const prevPinnedRowsCache = prevPinnedRowsCacheRef.current;
|
|
67
|
+
prevPinnedRowsCacheRef.current = pinnedRowsCache;
|
|
65
68
|
let newGroupingParams = _extends({}, groupingParams, {
|
|
66
69
|
additionalRowGroups: _extends({}, groupingParams.additionalRowGroups, {
|
|
67
70
|
// reset pinned rows state
|
|
68
71
|
pinnedRows: {}
|
|
69
72
|
})
|
|
70
73
|
});
|
|
74
|
+
if (prevPinnedRowsCache) {
|
|
75
|
+
const pinnedRowCleanup = rowId => {
|
|
76
|
+
const node = newGroupingParams.tree[rowId];
|
|
77
|
+
if (node?.type === 'pinnedRow') {
|
|
78
|
+
delete newGroupingParams.tree[rowId];
|
|
79
|
+
delete newGroupingParams.dataRowIdToModelLookup[rowId];
|
|
80
|
+
delete newGroupingParams.dataRowIdToIdLookup[rowId];
|
|
81
|
+
delete apiRef.current.caches.rows.dataRowIdToIdLookup[rowId];
|
|
82
|
+
delete apiRef.current.caches.rows.dataRowIdToModelLookup[rowId];
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
prevPinnedRowsCache.topIds?.forEach(pinnedRowCleanup);
|
|
86
|
+
prevPinnedRowsCache.bottomIds?.forEach(pinnedRowCleanup);
|
|
87
|
+
}
|
|
71
88
|
pinnedRowsCache.topIds?.forEach(rowId => {
|
|
72
89
|
newGroupingParams = addPinnedRow({
|
|
73
90
|
groupingParams: newGroupingParams,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import composeClasses from '@mui/utils/composeClasses';
|
|
3
3
|
import { useGridLogger, useGridApiEventHandler, getDataGridUtilityClass, useGridSelector, gridSortModelSelector, gridRowMaximumTreeDepthSelector, useGridApiOptionHandler } from '@mui/x-data-grid';
|
|
4
|
-
import { gridEditRowsStateSelector } from '@mui/x-data-grid/internals';
|
|
4
|
+
import { gridEditRowsStateSelector, gridSortedRowIndexLookupSelector } from '@mui/x-data-grid/internals';
|
|
5
5
|
import { GRID_REORDER_COL_DEF } from "./gridRowReorderColDef.js";
|
|
6
6
|
var Direction = /*#__PURE__*/function (Direction) {
|
|
7
7
|
Direction[Direction["UP"] = 0] = "UP";
|
|
@@ -39,6 +39,7 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
39
39
|
};
|
|
40
40
|
const classes = useUtilityClasses(ownerState);
|
|
41
41
|
const [dragRowId, setDragRowId] = React.useState('');
|
|
42
|
+
const sortedRowIndexLookup = useGridSelector(apiRef, gridSortedRowIndexLookupSelector);
|
|
42
43
|
React.useEffect(() => {
|
|
43
44
|
return () => {
|
|
44
45
|
clearTimeout(removeDnDStylesTimeout.current);
|
|
@@ -66,9 +67,9 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
66
67
|
removeDnDStylesTimeout.current = setTimeout(() => {
|
|
67
68
|
dragRowNode.current.classList.remove(classes.rowDragging);
|
|
68
69
|
});
|
|
69
|
-
originRowIndex.current =
|
|
70
|
+
originRowIndex.current = sortedRowIndexLookup[params.id];
|
|
70
71
|
apiRef.current.setCellFocus(params.id, GRID_REORDER_COL_DEF.field);
|
|
71
|
-
}, [isRowReorderDisabled, classes.rowDragging,
|
|
72
|
+
}, [apiRef, isRowReorderDisabled, logger, classes.rowDragging, sortedRowIndexLookup]);
|
|
72
73
|
const handleDragOver = React.useCallback((params, event) => {
|
|
73
74
|
if (dragRowId === '') {
|
|
74
75
|
return;
|
|
@@ -84,7 +85,7 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
84
85
|
event.stopPropagation();
|
|
85
86
|
const mouseMovementDiff = previousMousePosition ? previousMousePosition.y - event.clientY : event.clientY;
|
|
86
87
|
if (params.id !== dragRowId) {
|
|
87
|
-
const targetRowIndex =
|
|
88
|
+
const targetRowIndex = sortedRowIndexLookup[params.id];
|
|
88
89
|
const dragDirection = mouseMovementDiff > 0 ? Direction.DOWN : Direction.UP;
|
|
89
90
|
const currentReorderState = {
|
|
90
91
|
dragDirection,
|
|
@@ -100,7 +101,7 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
100
101
|
x: event.clientX,
|
|
101
102
|
y: event.clientY
|
|
102
103
|
};
|
|
103
|
-
}, [apiRef, logger,
|
|
104
|
+
}, [dragRowId, apiRef, logger, sortedRowIndexLookup]);
|
|
104
105
|
const handleDragEnd = React.useCallback((params, event) => {
|
|
105
106
|
// Call the gridEditRowsStateSelector directly to avoid infnite loop
|
|
106
107
|
const editRowsState = gridEditRowsStateSelector(apiRef.current.state);
|
|
@@ -125,13 +126,13 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
125
126
|
// Emit the rowOrderChange event only once when the reordering stops.
|
|
126
127
|
const rowOrderChangeParams = {
|
|
127
128
|
row: apiRef.current.getRow(dragRowId),
|
|
128
|
-
targetIndex:
|
|
129
|
+
targetIndex: sortedRowIndexLookup[params.id],
|
|
129
130
|
oldIndex: originRowIndex.current
|
|
130
131
|
};
|
|
131
132
|
apiRef.current.publishEvent('rowOrderChange', rowOrderChangeParams);
|
|
132
133
|
}
|
|
133
134
|
setDragRowId('');
|
|
134
|
-
}, [isRowReorderDisabled, logger,
|
|
135
|
+
}, [apiRef, dragRowId, isRowReorderDisabled, logger, sortedRowIndexLookup]);
|
|
135
136
|
useGridApiEventHandler(apiRef, 'rowDragStart', handleDragStart);
|
|
136
137
|
useGridApiEventHandler(apiRef, 'rowDragOver', handleDragOver);
|
|
137
138
|
useGridApiEventHandler(apiRef, 'rowDragEnd', handleDragEnd);
|
package/esm/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczMzk1NDQwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { GridHydrateRowsValue } from '@mui/x-data-grid/internals';
|
|
3
3
|
import { GridRowId, GridRowModel } from '@mui/x-data-grid';
|
|
4
4
|
import { GridPrivateApiPro } from '../../../models/gridApiPro';
|
|
5
|
-
import { GridPinnedRowsProp } from './gridRowPinningInterface';
|
|
5
|
+
import type { GridPinnedRowsProp } from './gridRowPinningInterface';
|
|
6
6
|
type GridPinnedRowPosition = keyof GridPinnedRowsProp;
|
|
7
7
|
export declare function addPinnedRow({ groupingParams, rowModel, rowId, position, apiRef, isAutoGenerated, }: {
|
|
8
8
|
groupingParams: GridHydrateRowsValue;
|
|
@@ -69,14 +69,31 @@ function addPinnedRow({
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
const useGridRowPinningPreProcessors = apiRef => {
|
|
72
|
+
const prevPinnedRowsCacheRef = React.useRef(null);
|
|
72
73
|
const addPinnedRows = React.useCallback(groupingParams => {
|
|
73
74
|
const pinnedRowsCache = apiRef.current.caches.pinnedRows || {};
|
|
75
|
+
const prevPinnedRowsCache = prevPinnedRowsCacheRef.current;
|
|
76
|
+
prevPinnedRowsCacheRef.current = pinnedRowsCache;
|
|
74
77
|
let newGroupingParams = (0, _extends2.default)({}, groupingParams, {
|
|
75
78
|
additionalRowGroups: (0, _extends2.default)({}, groupingParams.additionalRowGroups, {
|
|
76
79
|
// reset pinned rows state
|
|
77
80
|
pinnedRows: {}
|
|
78
81
|
})
|
|
79
82
|
});
|
|
83
|
+
if (prevPinnedRowsCache) {
|
|
84
|
+
const pinnedRowCleanup = rowId => {
|
|
85
|
+
const node = newGroupingParams.tree[rowId];
|
|
86
|
+
if (node?.type === 'pinnedRow') {
|
|
87
|
+
delete newGroupingParams.tree[rowId];
|
|
88
|
+
delete newGroupingParams.dataRowIdToModelLookup[rowId];
|
|
89
|
+
delete newGroupingParams.dataRowIdToIdLookup[rowId];
|
|
90
|
+
delete apiRef.current.caches.rows.dataRowIdToIdLookup[rowId];
|
|
91
|
+
delete apiRef.current.caches.rows.dataRowIdToModelLookup[rowId];
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
prevPinnedRowsCache.topIds?.forEach(pinnedRowCleanup);
|
|
95
|
+
prevPinnedRowsCache.bottomIds?.forEach(pinnedRowCleanup);
|
|
96
|
+
}
|
|
80
97
|
pinnedRowsCache.topIds?.forEach(rowId => {
|
|
81
98
|
newGroupingParams = addPinnedRow({
|
|
82
99
|
groupingParams: newGroupingParams,
|
|
@@ -47,6 +47,7 @@ const useGridRowReorder = (apiRef, props) => {
|
|
|
47
47
|
};
|
|
48
48
|
const classes = useUtilityClasses(ownerState);
|
|
49
49
|
const [dragRowId, setDragRowId] = React.useState('');
|
|
50
|
+
const sortedRowIndexLookup = (0, _xDataGrid.useGridSelector)(apiRef, _internals.gridSortedRowIndexLookupSelector);
|
|
50
51
|
React.useEffect(() => {
|
|
51
52
|
return () => {
|
|
52
53
|
clearTimeout(removeDnDStylesTimeout.current);
|
|
@@ -74,9 +75,9 @@ const useGridRowReorder = (apiRef, props) => {
|
|
|
74
75
|
removeDnDStylesTimeout.current = setTimeout(() => {
|
|
75
76
|
dragRowNode.current.classList.remove(classes.rowDragging);
|
|
76
77
|
});
|
|
77
|
-
originRowIndex.current =
|
|
78
|
+
originRowIndex.current = sortedRowIndexLookup[params.id];
|
|
78
79
|
apiRef.current.setCellFocus(params.id, _gridRowReorderColDef.GRID_REORDER_COL_DEF.field);
|
|
79
|
-
}, [isRowReorderDisabled, classes.rowDragging,
|
|
80
|
+
}, [apiRef, isRowReorderDisabled, logger, classes.rowDragging, sortedRowIndexLookup]);
|
|
80
81
|
const handleDragOver = React.useCallback((params, event) => {
|
|
81
82
|
if (dragRowId === '') {
|
|
82
83
|
return;
|
|
@@ -92,7 +93,7 @@ const useGridRowReorder = (apiRef, props) => {
|
|
|
92
93
|
event.stopPropagation();
|
|
93
94
|
const mouseMovementDiff = previousMousePosition ? previousMousePosition.y - event.clientY : event.clientY;
|
|
94
95
|
if (params.id !== dragRowId) {
|
|
95
|
-
const targetRowIndex =
|
|
96
|
+
const targetRowIndex = sortedRowIndexLookup[params.id];
|
|
96
97
|
const dragDirection = mouseMovementDiff > 0 ? Direction.DOWN : Direction.UP;
|
|
97
98
|
const currentReorderState = {
|
|
98
99
|
dragDirection,
|
|
@@ -108,7 +109,7 @@ const useGridRowReorder = (apiRef, props) => {
|
|
|
108
109
|
x: event.clientX,
|
|
109
110
|
y: event.clientY
|
|
110
111
|
};
|
|
111
|
-
}, [apiRef, logger,
|
|
112
|
+
}, [dragRowId, apiRef, logger, sortedRowIndexLookup]);
|
|
112
113
|
const handleDragEnd = React.useCallback((params, event) => {
|
|
113
114
|
// Call the gridEditRowsStateSelector directly to avoid infnite loop
|
|
114
115
|
const editRowsState = (0, _internals.gridEditRowsStateSelector)(apiRef.current.state);
|
|
@@ -133,13 +134,13 @@ const useGridRowReorder = (apiRef, props) => {
|
|
|
133
134
|
// Emit the rowOrderChange event only once when the reordering stops.
|
|
134
135
|
const rowOrderChangeParams = {
|
|
135
136
|
row: apiRef.current.getRow(dragRowId),
|
|
136
|
-
targetIndex:
|
|
137
|
+
targetIndex: sortedRowIndexLookup[params.id],
|
|
137
138
|
oldIndex: originRowIndex.current
|
|
138
139
|
};
|
|
139
140
|
apiRef.current.publishEvent('rowOrderChange', rowOrderChangeParams);
|
|
140
141
|
}
|
|
141
142
|
setDragRowId('');
|
|
142
|
-
}, [isRowReorderDisabled, logger,
|
|
143
|
+
}, [apiRef, dragRowId, isRowReorderDisabled, logger, sortedRowIndexLookup]);
|
|
143
144
|
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'rowDragStart', handleDragStart);
|
|
144
145
|
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'rowDragOver', handleDragOver);
|
|
145
146
|
(0, _xDataGrid.useGridApiEventHandler)(apiRef, 'rowDragEnd', handleDragEnd);
|
package/index.js
CHANGED
|
@@ -60,14 +60,31 @@ export function addPinnedRow({
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
export const useGridRowPinningPreProcessors = apiRef => {
|
|
63
|
+
const prevPinnedRowsCacheRef = React.useRef(null);
|
|
63
64
|
const addPinnedRows = React.useCallback(groupingParams => {
|
|
64
65
|
const pinnedRowsCache = apiRef.current.caches.pinnedRows || {};
|
|
66
|
+
const prevPinnedRowsCache = prevPinnedRowsCacheRef.current;
|
|
67
|
+
prevPinnedRowsCacheRef.current = pinnedRowsCache;
|
|
65
68
|
let newGroupingParams = _extends({}, groupingParams, {
|
|
66
69
|
additionalRowGroups: _extends({}, groupingParams.additionalRowGroups, {
|
|
67
70
|
// reset pinned rows state
|
|
68
71
|
pinnedRows: {}
|
|
69
72
|
})
|
|
70
73
|
});
|
|
74
|
+
if (prevPinnedRowsCache) {
|
|
75
|
+
const pinnedRowCleanup = rowId => {
|
|
76
|
+
const node = newGroupingParams.tree[rowId];
|
|
77
|
+
if (node?.type === 'pinnedRow') {
|
|
78
|
+
delete newGroupingParams.tree[rowId];
|
|
79
|
+
delete newGroupingParams.dataRowIdToModelLookup[rowId];
|
|
80
|
+
delete newGroupingParams.dataRowIdToIdLookup[rowId];
|
|
81
|
+
delete apiRef.current.caches.rows.dataRowIdToIdLookup[rowId];
|
|
82
|
+
delete apiRef.current.caches.rows.dataRowIdToModelLookup[rowId];
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
prevPinnedRowsCache.topIds?.forEach(pinnedRowCleanup);
|
|
86
|
+
prevPinnedRowsCache.bottomIds?.forEach(pinnedRowCleanup);
|
|
87
|
+
}
|
|
71
88
|
pinnedRowsCache.topIds?.forEach(rowId => {
|
|
72
89
|
newGroupingParams = addPinnedRow({
|
|
73
90
|
groupingParams: newGroupingParams,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import composeClasses from '@mui/utils/composeClasses';
|
|
3
3
|
import { useGridLogger, useGridApiEventHandler, getDataGridUtilityClass, useGridSelector, gridSortModelSelector, gridRowMaximumTreeDepthSelector, useGridApiOptionHandler } from '@mui/x-data-grid';
|
|
4
|
-
import { gridEditRowsStateSelector } from '@mui/x-data-grid/internals';
|
|
4
|
+
import { gridEditRowsStateSelector, gridSortedRowIndexLookupSelector } from '@mui/x-data-grid/internals';
|
|
5
5
|
import { GRID_REORDER_COL_DEF } from "./gridRowReorderColDef.js";
|
|
6
6
|
var Direction = /*#__PURE__*/function (Direction) {
|
|
7
7
|
Direction[Direction["UP"] = 0] = "UP";
|
|
@@ -39,6 +39,7 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
39
39
|
};
|
|
40
40
|
const classes = useUtilityClasses(ownerState);
|
|
41
41
|
const [dragRowId, setDragRowId] = React.useState('');
|
|
42
|
+
const sortedRowIndexLookup = useGridSelector(apiRef, gridSortedRowIndexLookupSelector);
|
|
42
43
|
React.useEffect(() => {
|
|
43
44
|
return () => {
|
|
44
45
|
clearTimeout(removeDnDStylesTimeout.current);
|
|
@@ -66,9 +67,9 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
66
67
|
removeDnDStylesTimeout.current = setTimeout(() => {
|
|
67
68
|
dragRowNode.current.classList.remove(classes.rowDragging);
|
|
68
69
|
});
|
|
69
|
-
originRowIndex.current =
|
|
70
|
+
originRowIndex.current = sortedRowIndexLookup[params.id];
|
|
70
71
|
apiRef.current.setCellFocus(params.id, GRID_REORDER_COL_DEF.field);
|
|
71
|
-
}, [isRowReorderDisabled, classes.rowDragging,
|
|
72
|
+
}, [apiRef, isRowReorderDisabled, logger, classes.rowDragging, sortedRowIndexLookup]);
|
|
72
73
|
const handleDragOver = React.useCallback((params, event) => {
|
|
73
74
|
if (dragRowId === '') {
|
|
74
75
|
return;
|
|
@@ -84,7 +85,7 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
84
85
|
event.stopPropagation();
|
|
85
86
|
const mouseMovementDiff = previousMousePosition ? previousMousePosition.y - event.clientY : event.clientY;
|
|
86
87
|
if (params.id !== dragRowId) {
|
|
87
|
-
const targetRowIndex =
|
|
88
|
+
const targetRowIndex = sortedRowIndexLookup[params.id];
|
|
88
89
|
const dragDirection = mouseMovementDiff > 0 ? Direction.DOWN : Direction.UP;
|
|
89
90
|
const currentReorderState = {
|
|
90
91
|
dragDirection,
|
|
@@ -100,7 +101,7 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
100
101
|
x: event.clientX,
|
|
101
102
|
y: event.clientY
|
|
102
103
|
};
|
|
103
|
-
}, [apiRef, logger,
|
|
104
|
+
}, [dragRowId, apiRef, logger, sortedRowIndexLookup]);
|
|
104
105
|
const handleDragEnd = React.useCallback((params, event) => {
|
|
105
106
|
// Call the gridEditRowsStateSelector directly to avoid infnite loop
|
|
106
107
|
const editRowsState = gridEditRowsStateSelector(apiRef.current.state);
|
|
@@ -125,13 +126,13 @@ export const useGridRowReorder = (apiRef, props) => {
|
|
|
125
126
|
// Emit the rowOrderChange event only once when the reordering stops.
|
|
126
127
|
const rowOrderChangeParams = {
|
|
127
128
|
row: apiRef.current.getRow(dragRowId),
|
|
128
|
-
targetIndex:
|
|
129
|
+
targetIndex: sortedRowIndexLookup[params.id],
|
|
129
130
|
oldIndex: originRowIndex.current
|
|
130
131
|
};
|
|
131
132
|
apiRef.current.publishEvent('rowOrderChange', rowOrderChangeParams);
|
|
132
133
|
}
|
|
133
134
|
setDragRowId('');
|
|
134
|
-
}, [isRowReorderDisabled, logger,
|
|
135
|
+
}, [apiRef, dragRowId, isRowReorderDisabled, logger, sortedRowIndexLookup]);
|
|
135
136
|
useGridApiEventHandler(apiRef, 'rowDragStart', handleDragStart);
|
|
136
137
|
useGridApiEventHandler(apiRef, 'rowDragOver', handleDragOver);
|
|
137
138
|
useGridApiEventHandler(apiRef, 'rowDragEnd', handleDragEnd);
|
package/modern/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczMzk1NDQwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-pro",
|
|
3
|
-
"version": "7.23.
|
|
3
|
+
"version": "7.23.2",
|
|
4
4
|
"description": "The Pro plan edition of the Data Grid components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
41
|
"reselect": "^5.1.1",
|
|
42
|
-
"@mui/x-data-grid": "7.23.0",
|
|
43
42
|
"@mui/x-internals": "7.23.0",
|
|
44
|
-
"@mui/x-
|
|
43
|
+
"@mui/x-data-grid": "7.23.2",
|
|
44
|
+
"@mui/x-license": "7.23.2"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@emotion/react": "^11.9.0",
|
package/utils/releaseInfo.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getReleaseInfo = void 0;
|
|
7
7
|
var _utils = require("@mui/utils");
|
|
8
8
|
const getReleaseInfo = () => {
|
|
9
|
-
const releaseInfo = "
|
|
9
|
+
const releaseInfo = "MTczMzk1NDQwMDAwMA==";
|
|
10
10
|
if (process.env.NODE_ENV !== 'production') {
|
|
11
11
|
// A simple hack to set the value in the test environment (has no build step).
|
|
12
12
|
// eslint-disable-next-line no-useless-concat
|