@mui/x-data-grid-pro 5.8.0 → 5.11.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 +333 -66
- package/DataGridPro/DataGridPro.d.ts +1 -1
- package/DataGridPro/DataGridPro.js +51 -3
- package/DataGridPro/useDataGridProComponent.js +9 -4
- package/DataGridPro/useDataGridProProps.js +20 -5
- package/LICENSE +12 -0
- package/README.md +7 -5
- package/components/DataGridProColumnHeaders.js +2 -8
- package/components/DataGridProVirtualScroller.js +7 -7
- package/components/GridDetailPanelToggleCell.js +13 -2
- package/components/GridGroupingCriteriaCell.js +2 -2
- package/components/GridRowReorderCell.d.ts +5 -0
- package/components/GridRowReorderCell.js +72 -0
- package/components/GridTreeDataGroupingCell.js +15 -4
- package/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
- package/hooks/features/columnReorder/useGridColumnReorder.d.ts +0 -1
- package/hooks/features/columnReorder/useGridColumnReorder.js +8 -9
- package/hooks/features/columnResize/useGridColumnResize.d.ts +0 -1
- package/hooks/features/columnResize/useGridColumnResize.js +31 -20
- package/hooks/features/detailPanel/useGridDetailPanel.js +14 -6
- package/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/hooks/features/index.d.ts +1 -1
- package/hooks/features/index.js +1 -1
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.d.ts +0 -1
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -5
- package/hooks/features/rowGrouping/createGroupingColDef.d.ts +1 -1
- package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +1 -1
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -4
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +0 -2
- package/hooks/features/rowGrouping/useGridRowGrouping.js +8 -12
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/hooks/features/rowReorder/gridRowReorderColDef.d.ts +2 -0
- package/hooks/features/rowReorder/gridRowReorderColDef.js +18 -0
- package/hooks/features/rowReorder/index.d.ts +1 -0
- package/hooks/features/rowReorder/index.js +1 -0
- package/hooks/features/rowReorder/useGridRowReorder.d.ts +8 -0
- package/hooks/features/rowReorder/useGridRowReorder.js +111 -0
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.d.ts +4 -0
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +51 -0
- package/hooks/features/treeData/useGridTreeData.d.ts +0 -3
- package/hooks/features/treeData/useGridTreeData.js +2 -8
- package/index.d.ts +6 -1
- package/index.js +7 -3
- package/internals/index.d.ts +19 -0
- package/internals/index.js +17 -0
- package/internals/package.json +6 -0
- package/legacy/DataGridPro/DataGridPro.js +51 -3
- package/legacy/DataGridPro/useDataGridProComponent.js +9 -4
- package/legacy/DataGridPro/useDataGridProProps.js +20 -5
- package/legacy/components/DataGridProColumnHeaders.js +2 -8
- package/legacy/components/DataGridProVirtualScroller.js +7 -7
- package/legacy/components/GridDetailPanelToggleCell.js +13 -2
- package/legacy/components/GridGroupingCriteriaCell.js +2 -2
- package/legacy/components/GridRowReorderCell.js +74 -0
- package/legacy/components/GridTreeDataGroupingCell.js +15 -4
- package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
- package/legacy/hooks/features/columnReorder/useGridColumnReorder.js +8 -9
- package/legacy/hooks/features/columnResize/useGridColumnResize.js +31 -20
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +14 -6
- package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/legacy/hooks/features/index.js +1 -1
- package/legacy/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -5
- package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -5
- package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +8 -12
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/legacy/hooks/features/rowReorder/gridRowReorderColDef.js +20 -0
- package/legacy/hooks/features/rowReorder/index.js +1 -0
- package/legacy/hooks/features/rowReorder/useGridRowReorder.js +115 -0
- package/legacy/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +52 -0
- package/legacy/hooks/features/treeData/useGridTreeData.js +2 -8
- package/legacy/index.js +7 -3
- package/legacy/internals/index.js +17 -0
- package/legacy/models/gridRowOrderChangeParams.js +1 -0
- package/legacy/models/index.js +1 -2
- package/legacy/typeOverloads/index.js +1 -0
- package/legacy/utils/domUtils.js +30 -3
- package/legacy/utils/index.js +1 -0
- package/legacy/utils/releaseInfo.js +1 -1
- package/legacy/utils/tree/buildRowTree.js +11 -4
- package/legacy/utils/tree/index.js +1 -0
- package/models/dataGridProProps.d.ts +36 -24
- package/models/gridApiPro.d.ts +3 -2
- package/models/gridRowOrderChangeParams.d.ts +18 -0
- package/models/gridRowOrderChangeParams.js +1 -0
- package/models/gridStatePro.d.ts +4 -3
- package/models/index.d.ts +1 -2
- package/models/index.js +1 -2
- package/modern/DataGridPro/DataGridPro.js +51 -3
- package/modern/DataGridPro/useDataGridProComponent.js +9 -4
- package/modern/DataGridPro/useDataGridProProps.js +16 -3
- package/modern/components/DataGridProColumnHeaders.js +2 -8
- package/modern/components/DataGridProVirtualScroller.js +7 -7
- package/modern/components/GridDetailPanelToggleCell.js +13 -2
- package/modern/components/GridGroupingCriteriaCell.js +2 -2
- package/modern/components/GridRowReorderCell.js +72 -0
- package/modern/components/GridTreeDataGroupingCell.js +15 -4
- package/modern/hooks/features/columnPinning/useGridColumnPinning.js +4 -4
- package/modern/hooks/features/columnReorder/useGridColumnReorder.js +8 -9
- package/modern/hooks/features/columnResize/useGridColumnResize.js +31 -20
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +14 -6
- package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +2 -2
- package/modern/hooks/features/index.js +1 -1
- package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +4 -5
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -4
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +8 -12
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/modern/hooks/features/rowReorder/gridRowReorderColDef.js +18 -0
- package/modern/hooks/features/rowReorder/index.js +1 -0
- package/modern/hooks/features/rowReorder/useGridRowReorder.js +111 -0
- package/modern/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +51 -0
- package/modern/hooks/features/treeData/useGridTreeData.js +2 -8
- package/modern/index.js +7 -3
- package/modern/internals/index.js +17 -0
- package/modern/models/gridRowOrderChangeParams.js +1 -0
- package/modern/models/index.js +1 -2
- package/modern/typeOverloads/index.js +1 -0
- package/modern/utils/domUtils.js +30 -3
- package/modern/utils/index.js +1 -0
- package/modern/utils/releaseInfo.js +1 -1
- package/modern/utils/tree/buildRowTree.js +9 -2
- package/modern/utils/tree/index.js +1 -0
- package/node/DataGridPro/DataGridPro.js +51 -3
- package/node/DataGridPro/useDataGridProComponent.js +12 -5
- package/node/DataGridPro/useDataGridProProps.js +21 -5
- package/node/components/DataGridProColumnHeaders.js +1 -7
- package/node/components/DataGridProVirtualScroller.js +6 -6
- package/node/components/GridDetailPanelToggleCell.js +13 -2
- package/node/components/GridGroupingCriteriaCell.js +1 -1
- package/node/components/GridRowReorderCell.js +92 -0
- package/node/components/GridTreeDataGroupingCell.js +14 -3
- package/node/hooks/features/columnPinning/useGridColumnPinning.js +3 -3
- package/node/hooks/features/columnReorder/useGridColumnReorder.js +7 -8
- package/node/hooks/features/columnResize/useGridColumnResize.js +30 -19
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +13 -5
- package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
- package/node/hooks/features/index.js +4 -4
- package/node/hooks/features/infiniteLoader/useGridInfiniteLoader.js +3 -4
- package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -4
- package/node/hooks/features/rowGrouping/useGridRowGrouping.js +7 -11
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +4 -4
- package/node/hooks/features/rowReorder/gridRowReorderColDef.js +31 -0
- package/node/hooks/features/rowReorder/index.js +18 -0
- package/node/hooks/features/rowReorder/useGridRowReorder.js +126 -0
- package/node/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +70 -0
- package/node/hooks/features/treeData/useGridTreeData.js +1 -6
- package/node/index.js +45 -3
- package/node/internals/index.js +193 -0
- package/node/models/gridRowOrderChangeParams.js +5 -0
- package/node/models/index.js +4 -4
- package/node/typeOverloads/index.js +18 -0
- package/node/utils/domUtils.js +30 -3
- package/node/utils/index.js +18 -0
- package/node/utils/releaseInfo.js +1 -1
- package/node/utils/tree/buildRowTree.js +12 -2
- package/node/utils/tree/index.js +13 -0
- package/package.json +8 -8
- package/typeOverloads/index.d.ts +1 -0
- package/typeOverloads/index.js +1 -0
- package/typeOverloads/modules.d.ts +41 -15
- package/typeOverloads/package.json +6 -0
- package/utils/domUtils.d.ts +2 -1
- package/utils/domUtils.js +30 -3
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/package.json +6 -0
- package/utils/releaseInfo.js +1 -1
- package/utils/tree/buildRowTree.d.ts +1 -0
- package/utils/tree/buildRowTree.js +9 -2
- package/utils/tree/index.d.ts +1 -0
- package/utils/tree/index.js +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ownerDocument, useEventCallback } from '@mui/material/utils';
|
|
4
|
-
import {
|
|
4
|
+
import { gridClasses, GridColumnHeaderSeparatorSides, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
|
|
5
5
|
import { clamp, findParentElementFromClassName } from '@mui/x-data-grid/internals';
|
|
6
6
|
import { findGridCellElementsFromCol, getFieldFromHeaderElem, findHeaderElementFromField } from '../../../utils/domUtils';
|
|
7
7
|
// TODO: remove support for Safari < 13.
|
|
@@ -82,7 +82,6 @@ export var columnResizeStateInitializer = function columnResizeStateInitializer(
|
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
84
|
/**
|
|
85
|
-
* Only available in DataGridPro
|
|
86
85
|
* @requires useGridColumns (method, event)
|
|
87
86
|
* TODO: improve experience for last column
|
|
88
87
|
*/
|
|
@@ -102,17 +101,29 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
|
|
|
102
101
|
|
|
103
102
|
var updateWidth = function updateWidth(newWidth) {
|
|
104
103
|
logger.debug("Updating width to ".concat(newWidth, " for col ").concat(colDefRef.current.field));
|
|
104
|
+
var prevWidth = colElementRef.current.offsetWidth;
|
|
105
|
+
var widthDiff = newWidth - prevWidth;
|
|
105
106
|
colDefRef.current.computedWidth = newWidth;
|
|
106
107
|
colDefRef.current.width = newWidth;
|
|
107
|
-
colDefRef.current.flex =
|
|
108
|
+
colDefRef.current.flex = 0;
|
|
108
109
|
colElementRef.current.style.width = "".concat(newWidth, "px");
|
|
109
110
|
colElementRef.current.style.minWidth = "".concat(newWidth, "px");
|
|
110
111
|
colElementRef.current.style.maxWidth = "".concat(newWidth, "px");
|
|
111
112
|
colCellElementsRef.current.forEach(function (element) {
|
|
112
113
|
var div = element;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
div.
|
|
114
|
+
var finalWidth;
|
|
115
|
+
|
|
116
|
+
if (div.getAttribute('aria-colspan') === '1') {
|
|
117
|
+
finalWidth = "".concat(newWidth, "px");
|
|
118
|
+
} else {
|
|
119
|
+
// Cell with colspan > 1 cannot be just updated width new width.
|
|
120
|
+
// Instead, we add width diff to the current width.
|
|
121
|
+
finalWidth = "".concat(div.offsetWidth + widthDiff, "px");
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
div.style.width = finalWidth;
|
|
125
|
+
div.style.minWidth = finalWidth;
|
|
126
|
+
div.style.maxWidth = finalWidth;
|
|
116
127
|
});
|
|
117
128
|
};
|
|
118
129
|
|
|
@@ -122,12 +133,12 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
|
|
|
122
133
|
apiRef.current.updateColumn(colDefRef.current);
|
|
123
134
|
clearTimeout(stopResizeEventTimeout.current);
|
|
124
135
|
stopResizeEventTimeout.current = setTimeout(function () {
|
|
125
|
-
apiRef.current.publishEvent(
|
|
136
|
+
apiRef.current.publishEvent('columnResizeStop', null, nativeEvent);
|
|
126
137
|
|
|
127
138
|
if (colDefRef.current) {
|
|
128
139
|
var _colDefRef$current;
|
|
129
140
|
|
|
130
|
-
apiRef.current.publishEvent(
|
|
141
|
+
apiRef.current.publishEvent('columnWidthChange', {
|
|
131
142
|
element: colElementRef.current,
|
|
132
143
|
colDef: colDefRef.current,
|
|
133
144
|
width: (_colDefRef$current = colDefRef.current) == null ? void 0 : _colDefRef$current.computedWidth
|
|
@@ -151,7 +162,7 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
|
|
|
151
162
|
colDef: colDefRef.current,
|
|
152
163
|
width: newWidth
|
|
153
164
|
};
|
|
154
|
-
apiRef.current.publishEvent(
|
|
165
|
+
apiRef.current.publishEvent('columnResize', params, nativeEvent);
|
|
155
166
|
});
|
|
156
167
|
var handleColumnResizeMouseDown = useEventCallback(function (_ref, event) {
|
|
157
168
|
var _apiRef$current$colum;
|
|
@@ -171,12 +182,12 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
|
|
|
171
182
|
|
|
172
183
|
event.preventDefault();
|
|
173
184
|
logger.debug("Start Resize on col ".concat(colDef.field));
|
|
174
|
-
apiRef.current.publishEvent(
|
|
185
|
+
apiRef.current.publishEvent('columnResizeStart', {
|
|
175
186
|
field: colDef.field
|
|
176
187
|
}, event);
|
|
177
188
|
colDefRef.current = colDef;
|
|
178
189
|
colElementRef.current = (_apiRef$current$colum = apiRef.current.columnHeadersContainerElementRef) == null ? void 0 : _apiRef$current$colum.current.querySelector("[data-field=\"".concat(colDef.field, "\"]"));
|
|
179
|
-
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current);
|
|
190
|
+
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
|
|
180
191
|
var doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
181
192
|
doc.body.style.cursor = 'col-resize';
|
|
182
193
|
separatorSide.current = getSeparatorSide(event.currentTarget);
|
|
@@ -196,7 +207,7 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
|
|
|
196
207
|
apiRef.current.updateColumn(colDefRef.current);
|
|
197
208
|
clearTimeout(stopResizeEventTimeout.current);
|
|
198
209
|
stopResizeEventTimeout.current = setTimeout(function () {
|
|
199
|
-
apiRef.current.publishEvent(
|
|
210
|
+
apiRef.current.publishEvent('columnResizeStop', null, nativeEvent);
|
|
200
211
|
});
|
|
201
212
|
logger.debug("Updating col ".concat(colDefRef.current.field, " with new width: ").concat(colDefRef.current.width));
|
|
202
213
|
});
|
|
@@ -221,7 +232,7 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
|
|
|
221
232
|
colDef: colDefRef.current,
|
|
222
233
|
width: newWidth
|
|
223
234
|
};
|
|
224
|
-
apiRef.current.publishEvent(
|
|
235
|
+
apiRef.current.publishEvent('columnResize', params, nativeEvent);
|
|
225
236
|
});
|
|
226
237
|
var handleTouchStart = useEventCallback(function (event) {
|
|
227
238
|
var _apiRef$current$colum2;
|
|
@@ -248,12 +259,12 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
|
|
|
248
259
|
var field = getFieldFromHeaderElem(colElementRef.current);
|
|
249
260
|
var colDef = apiRef.current.getColumn(field);
|
|
250
261
|
logger.debug("Start Resize on col ".concat(colDef.field));
|
|
251
|
-
apiRef.current.publishEvent(
|
|
262
|
+
apiRef.current.publishEvent('columnResizeStart', {
|
|
252
263
|
field: field
|
|
253
264
|
}, event);
|
|
254
265
|
colDefRef.current = colDef;
|
|
255
266
|
colElementRef.current = findHeaderElementFromField((_apiRef$current$colum2 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum2.current, colDef.field);
|
|
256
|
-
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current);
|
|
267
|
+
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
|
|
257
268
|
separatorSide.current = getSeparatorSide(event.target);
|
|
258
269
|
initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
|
|
259
270
|
var doc = ownerDocument(event.currentTarget);
|
|
@@ -302,9 +313,9 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
|
|
|
302
313
|
}, 'touchstart', handleTouchStart, {
|
|
303
314
|
passive: doesSupportTouchActionNone()
|
|
304
315
|
});
|
|
305
|
-
useGridApiEventHandler(apiRef,
|
|
306
|
-
useGridApiEventHandler(apiRef,
|
|
307
|
-
useGridApiEventHandler(apiRef,
|
|
308
|
-
useGridApiOptionHandler(apiRef,
|
|
309
|
-
useGridApiOptionHandler(apiRef,
|
|
316
|
+
useGridApiEventHandler(apiRef, 'columnSeparatorMouseDown', handleColumnResizeMouseDown);
|
|
317
|
+
useGridApiEventHandler(apiRef, 'columnResizeStart', handleResizeStart);
|
|
318
|
+
useGridApiEventHandler(apiRef, 'columnResizeStop', handleResizeStop);
|
|
319
|
+
useGridApiOptionHandler(apiRef, 'columnResize', props.onColumnResize);
|
|
320
|
+
useGridApiOptionHandler(apiRef, 'columnWidthChange', props.onColumnWidthChange);
|
|
310
321
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { useGridSelector, useGridApiEventHandler, useGridApiMethod } from '@mui/x-data-grid';
|
|
5
5
|
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
6
6
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from './gridDetailPanelToggleColDef';
|
|
7
7
|
import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector } from './gridDetailPanelSelector';
|
|
@@ -36,14 +36,22 @@ export var useGridDetailPanel = function useGridDetailPanel(apiRef, props) {
|
|
|
36
36
|
apiRef.current.toggleDetailPanel(params.id);
|
|
37
37
|
}, [apiRef, contentCache, props.getDetailPanelContent]);
|
|
38
38
|
var handleCellKeyDown = React.useCallback(function (params, event) {
|
|
39
|
-
if (
|
|
39
|
+
if (props.getDetailPanelContent == null) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
if ((event.ctrlKey || event.metaKey) && event.key === 'Enter') {
|
|
44
|
+
// TODO v6: only support Space on the detail toggle
|
|
45
|
+
apiRef.current.toggleDetailPanel(params.id);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (params.field === GRID_DETAIL_PANEL_TOGGLE_FIELD && event.key === ' ') {
|
|
50
|
+
apiRef.current.toggleDetailPanel(params.id);
|
|
51
|
+
}
|
|
44
52
|
}, [apiRef, props.getDetailPanelContent]);
|
|
45
|
-
useGridApiEventHandler(apiRef,
|
|
46
|
-
useGridApiEventHandler(apiRef,
|
|
53
|
+
useGridApiEventHandler(apiRef, 'cellClick', handleCellClick);
|
|
54
|
+
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
47
55
|
var addDetailHeight = React.useCallback(function (initialValue, row) {
|
|
48
56
|
var _heightCache$row$id;
|
|
49
57
|
|
|
@@ -65,7 +73,7 @@ export var useGridDetailPanel = function useGridDetailPanel(apiRef, props) {
|
|
|
65
73
|
propModel: props.detailPanelExpandedRowIds,
|
|
66
74
|
propOnChange: props.onDetailPanelExpandedRowIdsChange,
|
|
67
75
|
stateSelector: gridDetailPanelExpandedRowIdsSelector,
|
|
68
|
-
changeEvent:
|
|
76
|
+
changeEvent: 'detailPanelsExpandedRowIdsChange'
|
|
69
77
|
});
|
|
70
78
|
var toggleDetailPanel = React.useCallback(function (id) {
|
|
71
79
|
if (props.getDetailPanelContent == null) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useGridApiEventHandler, gridRowIdsSelector
|
|
3
|
+
import { useGridApiEventHandler, gridRowIdsSelector } from '@mui/x-data-grid';
|
|
4
4
|
|
|
5
5
|
function cacheContentAndHeight(apiRef, getDetailPanelContent, getDetailPanelHeight) {
|
|
6
6
|
if (typeof getDetailPanelContent !== 'function') {
|
|
@@ -39,7 +39,7 @@ export var useGridDetailPanelCache = function useGridDetailPanelCache(apiRef, pr
|
|
|
39
39
|
});
|
|
40
40
|
apiRef.current.forceUpdate();
|
|
41
41
|
}, [apiRef, props.getDetailPanelContent, props.getDetailPanelHeight]);
|
|
42
|
-
useGridApiEventHandler(apiRef,
|
|
42
|
+
useGridApiEventHandler(apiRef, 'sortedRowsSet', updateCaches);
|
|
43
43
|
var isFirstRender = React.useRef(true);
|
|
44
44
|
|
|
45
45
|
if (isFirstRender.current) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useGridSelector,
|
|
2
|
+
import { useGridSelector, useGridApiEventHandler, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, gridRowsMetaSelector } from '@mui/x-data-grid';
|
|
3
3
|
import { useGridVisibleRows } from '@mui/x-data-grid/internals';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Only available in DataGridPro
|
|
7
6
|
* @requires useGridColumns (state)
|
|
8
7
|
* @requires useGridDimensions (method) - can be after
|
|
9
8
|
* @requires useGridScroll (method
|
|
@@ -34,7 +33,7 @@ export var useGridInfiniteLoader = function useGridInfiniteLoader(apiRef, props)
|
|
|
34
33
|
viewportPageSize: viewportPageSize,
|
|
35
34
|
virtualRowsCount: currentPage.rows.length
|
|
36
35
|
};
|
|
37
|
-
apiRef.current.publishEvent(
|
|
36
|
+
apiRef.current.publishEvent('rowsScrollEnd', rowScrollEndParam);
|
|
38
37
|
isInScrollBottomArea.current = true;
|
|
39
38
|
}
|
|
40
39
|
}, [contentHeight, props.scrollEndThreshold, visibleColumns, apiRef, currentPage.rows.length]);
|
|
@@ -46,6 +45,6 @@ export var useGridInfiniteLoader = function useGridInfiniteLoader(apiRef, props)
|
|
|
46
45
|
top: top
|
|
47
46
|
});
|
|
48
47
|
}, [handleRowsScrollEnd]);
|
|
49
|
-
useGridApiEventHandler(apiRef,
|
|
50
|
-
useGridApiOptionHandler(apiRef,
|
|
48
|
+
useGridApiEventHandler(apiRef, 'rowsScroll', handleGridScroll);
|
|
49
|
+
useGridApiOptionHandler(apiRef, 'rowsScrollEnd', props.onRowsScrollEnd);
|
|
51
50
|
};
|
|
@@ -25,12 +25,12 @@ export var isGroupingColumn = function isGroupingColumn(field) {
|
|
|
25
25
|
/**
|
|
26
26
|
* When filtering a group, we only want to filter according to the items related to this grouping column.
|
|
27
27
|
*/
|
|
28
|
-
var shouldApplyFilterItemOnGroup = function shouldApplyFilterItemOnGroup(
|
|
29
|
-
if (
|
|
28
|
+
var shouldApplyFilterItemOnGroup = function shouldApplyFilterItemOnGroup(columnField, node) {
|
|
29
|
+
if (columnField === GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD) {
|
|
30
30
|
return true;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
var groupingCriteriaField = getRowGroupingCriteriaFromGroupingField(
|
|
33
|
+
var groupingCriteriaField = getRowGroupingCriteriaFromGroupingField(columnField);
|
|
34
34
|
return groupingCriteriaField === node.groupingField;
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
@@ -56,8 +56,8 @@ export var filterRowTreeFromGroupingColumns = function filterRowTreeFromGrouping
|
|
|
56
56
|
if (!isRowMatchingFilters) {
|
|
57
57
|
isMatchingFilters = true;
|
|
58
58
|
} else {
|
|
59
|
-
var shouldApplyItem = node.isAutoGenerated ? function (
|
|
60
|
-
return shouldApplyFilterItemOnGroup(
|
|
59
|
+
var shouldApplyItem = node.isAutoGenerated ? function (columnField) {
|
|
60
|
+
return shouldApplyFilterItemOnGroup(columnField, node);
|
|
61
61
|
} : undefined;
|
|
62
62
|
isMatchingFilters = isRowMatchingFilters(node.id, shouldApplyItem);
|
|
63
63
|
}
|
|
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import Divider from '@mui/material/Divider';
|
|
5
|
-
import {
|
|
5
|
+
import { useGridApiEventHandler, useGridApiMethod, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid';
|
|
6
6
|
import { useGridRegisterPipeProcessor, isDeepEqual } from '@mui/x-data-grid/internals';
|
|
7
7
|
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector, gridRowGroupingStateSelector } from './gridRowGroupingSelector';
|
|
8
8
|
import { getRowGroupingFieldFromGroupingCriteria, ROW_GROUPING_STRATEGY, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability } from './gridRowGroupingUtils';
|
|
@@ -20,11 +20,9 @@ export var rowGroupingStateInitializer = function rowGroupingStateInitializer(st
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
* Only available in DataGridPro
|
|
24
23
|
* @requires useGridColumns (state, method) - can be after, async only
|
|
25
24
|
* @requires useGridRows (state, method) - can be after, async only
|
|
26
25
|
* @requires useGridParamsApi (method) - can be after, async only
|
|
27
|
-
* TODO: Move the the Premium plan once available and remove the `experimentalFeatures.rowGrouping` flag
|
|
28
26
|
*/
|
|
29
27
|
|
|
30
28
|
export var useGridRowGrouping = function useGridRowGrouping(apiRef, props) {
|
|
@@ -33,7 +31,7 @@ export var useGridRowGrouping = function useGridRowGrouping(apiRef, props) {
|
|
|
33
31
|
propModel: props.rowGroupingModel,
|
|
34
32
|
propOnChange: props.onRowGroupingModelChange,
|
|
35
33
|
stateSelector: gridRowGroupingModelSelector,
|
|
36
|
-
changeEvent:
|
|
34
|
+
changeEvent: 'rowGroupingModelChange'
|
|
37
35
|
});
|
|
38
36
|
/**
|
|
39
37
|
* API METHODS
|
|
@@ -183,21 +181,19 @@ export var useGridRowGrouping = function useGridRowGrouping(apiRef, props) {
|
|
|
183
181
|
unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
|
|
184
182
|
})
|
|
185
183
|
});
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
apiRef.current.updateColumns([]);
|
|
184
|
+
});
|
|
185
|
+
apiRef.current.unstable_requestPipeProcessorsApplication('hydrateColumns');
|
|
190
186
|
setStrategyAvailability(apiRef, props.disableRowGrouping); // Refresh the row tree creation strategy processing
|
|
191
187
|
// TODO: Add a clean way to re-run a strategy processing without publishing a private event
|
|
192
188
|
|
|
193
189
|
if (apiRef.current.unstable_getActiveStrategy('rowTree') === ROW_GROUPING_STRATEGY) {
|
|
194
|
-
apiRef.current.publishEvent(
|
|
190
|
+
apiRef.current.publishEvent('activeStrategyProcessorChange', 'rowTreeCreation');
|
|
195
191
|
}
|
|
196
192
|
}
|
|
197
193
|
}, [apiRef, props.disableRowGrouping]);
|
|
198
|
-
useGridApiEventHandler(apiRef,
|
|
199
|
-
useGridApiEventHandler(apiRef,
|
|
200
|
-
useGridApiEventHandler(apiRef,
|
|
194
|
+
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
195
|
+
useGridApiEventHandler(apiRef, 'columnsChange', checkGroupingColumnsModelDiff);
|
|
196
|
+
useGridApiEventHandler(apiRef, 'rowGroupingModelChange', checkGroupingColumnsModelDiff);
|
|
201
197
|
/**
|
|
202
198
|
* EFFECTS
|
|
203
199
|
*/
|
|
@@ -3,11 +3,11 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { gridColumnLookupSelector, gridRowIdsSelector, gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid';
|
|
5
5
|
import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor } from '@mui/x-data-grid/internals';
|
|
6
|
+
import { sortRowTree } from '../../../utils/tree/sortRowTree';
|
|
7
|
+
import { buildRowTree } from '../../../utils/tree/buildRowTree';
|
|
6
8
|
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
|
|
7
9
|
import { createGroupingColDefForAllGroupingCriteria, createGroupingColDefForOneGroupingCriteria } from './createGroupingColDef';
|
|
8
10
|
import { filterRowTreeFromGroupingColumns, getColDefOverrides, ROW_GROUPING_STRATEGY, isGroupingColumn, setStrategyAvailability } from './gridRowGroupingUtils';
|
|
9
|
-
import { buildRowTree } from '../../../utils/tree/buildRowTree';
|
|
10
|
-
import { sortRowTree } from '../../../utils/tree/sortRowTree';
|
|
11
11
|
export var useGridRowGroupingPreProcessors = function useGridRowGroupingPreProcessors(apiRef, props) {
|
|
12
12
|
var getGroupingColDefs = React.useCallback(function (columnsState) {
|
|
13
13
|
if (props.disableRowGrouping) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { GRID_STRING_COL_DEF } from '@mui/x-data-grid';
|
|
3
|
+
import { renderRowReorderCell } from '../../../components/GridRowReorderCell';
|
|
4
|
+
export var GRID_REORDER_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
5
|
+
field: '__reorder__',
|
|
6
|
+
type: 'reorder',
|
|
7
|
+
sortable: false,
|
|
8
|
+
filterable: false,
|
|
9
|
+
width: 50,
|
|
10
|
+
align: 'center',
|
|
11
|
+
headerAlign: 'center',
|
|
12
|
+
disableColumnMenu: true,
|
|
13
|
+
disableExport: true,
|
|
14
|
+
disableReorder: true,
|
|
15
|
+
resizable: false,
|
|
16
|
+
renderHeader: function renderHeader() {
|
|
17
|
+
return ' ';
|
|
18
|
+
},
|
|
19
|
+
renderCell: renderRowReorderCell
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './gridRowReorderColDef';
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
4
|
+
import { useGridLogger, useGridApiEventHandler, getDataGridUtilityClass, useGridSelector, gridSortModelSelector, gridRowTreeDepthSelector, useGridApiOptionHandler, gridEditRowsStateSelector } from '@mui/x-data-grid';
|
|
5
|
+
|
|
6
|
+
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
7
|
+
var classes = ownerState.classes;
|
|
8
|
+
var slots = {
|
|
9
|
+
rowDragging: ['row--dragging']
|
|
10
|
+
};
|
|
11
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Only available in DataGridPro
|
|
15
|
+
* @requires useGridRows (method)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export var useGridRowReorder = function useGridRowReorder(apiRef, props) {
|
|
20
|
+
var logger = useGridLogger(apiRef, 'useGridRowReorder');
|
|
21
|
+
var sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
22
|
+
var treeDepth = useGridSelector(apiRef, gridRowTreeDepthSelector);
|
|
23
|
+
var dragRowNode = React.useRef(null);
|
|
24
|
+
var originRowIndex = React.useRef(null);
|
|
25
|
+
var removeDnDStylesTimeout = React.useRef();
|
|
26
|
+
var ownerState = {
|
|
27
|
+
classes: props.classes
|
|
28
|
+
};
|
|
29
|
+
var classes = useUtilityClasses(ownerState);
|
|
30
|
+
|
|
31
|
+
var _React$useState = React.useState(''),
|
|
32
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
33
|
+
dragRowId = _React$useState2[0],
|
|
34
|
+
setDragRowId = _React$useState2[1];
|
|
35
|
+
|
|
36
|
+
React.useEffect(function () {
|
|
37
|
+
return function () {
|
|
38
|
+
clearTimeout(removeDnDStylesTimeout.current);
|
|
39
|
+
};
|
|
40
|
+
}, []); // TODO: remove sortModel check once row reorder is sorting compatible
|
|
41
|
+
// remove treeDepth once row reorder is tree compatible
|
|
42
|
+
|
|
43
|
+
var isRowReorderDisabled = React.useMemo(function () {
|
|
44
|
+
return !props.rowReordering || !!sortModel.length || treeDepth !== 1;
|
|
45
|
+
}, [props.rowReordering, sortModel, treeDepth]);
|
|
46
|
+
var handleDragStart = React.useCallback(function (params, event) {
|
|
47
|
+
// Call the gridEditRowsStateSelector directly to avoid infnite loop
|
|
48
|
+
var editRowsState = gridEditRowsStateSelector(apiRef.current.state);
|
|
49
|
+
|
|
50
|
+
if (isRowReorderDisabled || Object.keys(editRowsState).length !== 0) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
logger.debug("Start dragging row ".concat(params.id)); // Prevent drag events propagation.
|
|
55
|
+
// For more information check here https://github.com/mui/mui-x/issues/2680.
|
|
56
|
+
|
|
57
|
+
event.stopPropagation();
|
|
58
|
+
dragRowNode.current = event.currentTarget;
|
|
59
|
+
dragRowNode.current.classList.add(classes.rowDragging);
|
|
60
|
+
setDragRowId(params.id);
|
|
61
|
+
removeDnDStylesTimeout.current = setTimeout(function () {
|
|
62
|
+
dragRowNode.current.classList.remove(classes.rowDragging);
|
|
63
|
+
});
|
|
64
|
+
originRowIndex.current = apiRef.current.getRowIndex(params.id);
|
|
65
|
+
}, [isRowReorderDisabled, classes.rowDragging, logger, apiRef]);
|
|
66
|
+
var handleDragOver = React.useCallback(function (params, event) {
|
|
67
|
+
logger.debug("Dragging over row ".concat(params.id));
|
|
68
|
+
event.preventDefault(); // Prevent drag events propagation.
|
|
69
|
+
// For more information check here https://github.com/mui/mui-x/issues/2680.
|
|
70
|
+
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
|
|
73
|
+
if (params.id !== dragRowId) {
|
|
74
|
+
var targetRowIndex = apiRef.current.getRowIndex(params.id);
|
|
75
|
+
apiRef.current.setRowIndex(dragRowId, targetRowIndex);
|
|
76
|
+
}
|
|
77
|
+
}, [apiRef, logger, dragRowId]);
|
|
78
|
+
var handleDragEnd = React.useCallback(function (params, event) {
|
|
79
|
+
// Call the gridEditRowsStateSelector directly to avoid infnite loop
|
|
80
|
+
var editRowsState = gridEditRowsStateSelector(apiRef.current.state);
|
|
81
|
+
|
|
82
|
+
if (isRowReorderDisabled || Object.keys(editRowsState).length !== 0) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
logger.debug('End dragging row');
|
|
87
|
+
event.preventDefault(); // Prevent drag events propagation.
|
|
88
|
+
// For more information check here https://github.com/mui/mui-x/issues/2680.
|
|
89
|
+
|
|
90
|
+
event.stopPropagation();
|
|
91
|
+
clearTimeout(removeDnDStylesTimeout.current);
|
|
92
|
+
dragRowNode.current = null; // Check if the row was dropped outside the grid.
|
|
93
|
+
|
|
94
|
+
if (event.dataTransfer.dropEffect === 'none') {
|
|
95
|
+
// Accessing params.field may contain the wrong field as header elements are reused
|
|
96
|
+
apiRef.current.setRowIndex(dragRowId, originRowIndex.current);
|
|
97
|
+
originRowIndex.current = null;
|
|
98
|
+
} else {
|
|
99
|
+
// Emit the rowOrderChange event only once when the reordering stops.
|
|
100
|
+
var rowOrderChangeParams = {
|
|
101
|
+
row: apiRef.current.getRow(dragRowId),
|
|
102
|
+
targetIndex: apiRef.current.getRowIndex(params.id),
|
|
103
|
+
oldIndex: originRowIndex.current
|
|
104
|
+
};
|
|
105
|
+
apiRef.current.publishEvent('rowOrderChange', rowOrderChangeParams);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
setDragRowId('');
|
|
109
|
+
}, [isRowReorderDisabled, logger, apiRef, dragRowId]);
|
|
110
|
+
useGridApiEventHandler(apiRef, 'rowDragStart', handleDragStart);
|
|
111
|
+
useGridApiEventHandler(apiRef, 'rowDragOver', handleDragOver);
|
|
112
|
+
useGridApiEventHandler(apiRef, 'rowDragEnd', handleDragEnd);
|
|
113
|
+
useGridApiEventHandler(apiRef, 'cellDragOver', handleDragOver);
|
|
114
|
+
useGridApiOptionHandler(apiRef, 'rowOrderChange', props.onRowOrderChange);
|
|
115
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
5
|
+
import { getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
6
|
+
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
7
|
+
import { GRID_REORDER_COL_DEF } from './gridRowReorderColDef';
|
|
8
|
+
|
|
9
|
+
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
10
|
+
var classes = ownerState.classes;
|
|
11
|
+
return React.useMemo(function () {
|
|
12
|
+
var slots = {
|
|
13
|
+
rowReorderCellContainer: ['rowReorderCellContainer'],
|
|
14
|
+
columnHeaderReorder: ['columnHeaderReorder']
|
|
15
|
+
};
|
|
16
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
17
|
+
}, [classes]);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export var useGridRowReorderPreProcessors = function useGridRowReorderPreProcessors(apiRef, props) {
|
|
21
|
+
var ownerState = {
|
|
22
|
+
classes: props.classes
|
|
23
|
+
};
|
|
24
|
+
var classes = useUtilityClasses(ownerState);
|
|
25
|
+
var updateReorderColumn = React.useCallback(function (columnsState) {
|
|
26
|
+
var reorderColumn = _extends({}, GRID_REORDER_COL_DEF, {
|
|
27
|
+
cellClassName: classes.rowReorderCellContainer,
|
|
28
|
+
headerClassName: classes.columnHeaderReorder,
|
|
29
|
+
headerName: apiRef.current.getLocaleText('rowReorderingHeaderName')
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
var shouldHaveReorderColumn = props.rowReordering;
|
|
33
|
+
var haveReorderColumn = columnsState.lookup[reorderColumn.field] != null;
|
|
34
|
+
|
|
35
|
+
if (shouldHaveReorderColumn && haveReorderColumn) {
|
|
36
|
+
return columnsState;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (shouldHaveReorderColumn && !haveReorderColumn) {
|
|
40
|
+
columnsState.lookup[reorderColumn.field] = reorderColumn;
|
|
41
|
+
columnsState.all = [reorderColumn.field].concat(_toConsumableArray(columnsState.all));
|
|
42
|
+
} else if (!shouldHaveReorderColumn && haveReorderColumn) {
|
|
43
|
+
delete columnsState.lookup[reorderColumn.field];
|
|
44
|
+
columnsState.all = columnsState.all.filter(function (field) {
|
|
45
|
+
return field !== reorderColumn.field;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return columnsState;
|
|
50
|
+
}, [apiRef, classes, props.rowReordering]);
|
|
51
|
+
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateReorderColumn);
|
|
52
|
+
};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useGridApiEventHandler,
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Only available in DataGridPro
|
|
6
|
-
*/
|
|
2
|
+
import { useGridApiEventHandler, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid';
|
|
7
3
|
export var useGridTreeData = function useGridTreeData(apiRef) {
|
|
8
4
|
/**
|
|
9
5
|
* EVENTS
|
|
@@ -14,8 +10,6 @@ export var useGridTreeData = function useGridTreeData(apiRef) {
|
|
|
14
10
|
if (cellParams.colDef.type === 'treeDataGroup' && event.key === ' ' && !event.shiftKey) {
|
|
15
11
|
var _gridFilteredDescenda;
|
|
16
12
|
|
|
17
|
-
event.stopPropagation();
|
|
18
|
-
event.preventDefault();
|
|
19
13
|
var filteredDescendantCount = (_gridFilteredDescenda = gridFilteredDescendantCountLookupSelector(apiRef)[params.id]) != null ? _gridFilteredDescenda : 0;
|
|
20
14
|
|
|
21
15
|
if (filteredDescendantCount === 0) {
|
|
@@ -25,5 +19,5 @@ export var useGridTreeData = function useGridTreeData(apiRef) {
|
|
|
25
19
|
apiRef.current.setRowChildrenExpansion(params.id, !params.rowNode.childrenExpanded);
|
|
26
20
|
}
|
|
27
21
|
}, [apiRef]);
|
|
28
|
-
useGridApiEventHandler(apiRef,
|
|
22
|
+
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
29
23
|
};
|
package/legacy/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/** @license MUI v5.
|
|
1
|
+
/** @license MUI v5.11.0
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
5
5
|
*/
|
|
6
|
-
import './typeOverloads
|
|
6
|
+
import './typeOverloads';
|
|
7
7
|
export { LicenseInfo } from '@mui/x-license-pro';
|
|
8
8
|
export * from '@mui/x-data-grid/components';
|
|
9
9
|
export * from '@mui/x-data-grid/constants';
|
|
@@ -17,4 +17,8 @@ export * from './DataGridPro';
|
|
|
17
17
|
export * from './hooks';
|
|
18
18
|
export * from './models';
|
|
19
19
|
export * from './components';
|
|
20
|
-
export
|
|
20
|
+
export * from './utils';
|
|
21
|
+
export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
|
|
22
|
+
// We export them from here to avoid export duplication between pro and premium
|
|
23
|
+
export * from './hooks/features/rowGrouping';
|
|
24
|
+
export * from './models/gridGroupingValueGetterParams';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from '@mui/x-data-grid/internals';
|
|
2
|
+
export { DataGridProVirtualScroller } from '../components/DataGridProVirtualScroller';
|
|
3
|
+
export { DataGridProColumnHeaders } from '../components/DataGridProColumnHeaders';
|
|
4
|
+
export { useGridColumnResize, columnResizeStateInitializer } from '../hooks/features/columnResize/useGridColumnResize';
|
|
5
|
+
export { useGridColumnPinning, columnPinningStateInitializer } from '../hooks/features/columnPinning/useGridColumnPinning';
|
|
6
|
+
export { useGridColumnPinningPreProcessors } from '../hooks/features/columnPinning/useGridColumnPinningPreProcessors';
|
|
7
|
+
export { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
8
|
+
export { useGridDetailPanel, detailPanelStateInitializer } from '../hooks/features/detailPanel/useGridDetailPanel';
|
|
9
|
+
export { useGridDetailPanelCache } from '../hooks/features/detailPanel/useGridDetailPanelCache';
|
|
10
|
+
export { useGridDetailPanelPreProcessors } from '../hooks/features/detailPanel/useGridDetailPanelPreProcessors';
|
|
11
|
+
export { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
|
|
12
|
+
export { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorder';
|
|
13
|
+
export { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
|
|
14
|
+
export { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
|
|
15
|
+
export { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
|
|
16
|
+
export { buildRowTree } from '../utils/tree/buildRowTree';
|
|
17
|
+
export { sortRowTree } from '../utils/tree/sortRowTree';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/legacy/models/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './modules';
|