@mui/x-data-grid 8.0.0-alpha.10 → 8.0.0-alpha.11
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 +107 -2
- package/DataGrid/useDataGridComponent.js +2 -2
- package/components/GridRow.js +6 -2
- package/components/GridScrollArea.d.ts +5 -2
- package/components/GridScrollArea.js +31 -24
- package/components/GridSkeletonLoadingOverlay.js +2 -1
- package/components/containers/GridRoot.js +11 -9
- package/components/containers/GridRootStyles.js +3 -3
- package/components/menu/columnMenu/GridColumnMenuContainer.js +5 -2
- package/components/virtualization/GridMainContainer.d.ts +2 -2
- package/components/virtualization/GridMainContainer.js +1 -1
- package/components/virtualization/GridVirtualScroller.js +21 -14
- package/constants/index.d.ts +1 -0
- package/constants/index.js +2 -1
- package/constants/signature.d.ts +9 -0
- package/constants/signature.js +10 -0
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/hooks/core/useGridApiInitialization.js +1 -1
- package/hooks/core/useGridStateInitialization.js +3 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/hooks/features/columns/gridColumnsSelector.d.ts +0 -5
- package/hooks/features/columns/gridColumnsSelector.js +0 -12
- package/hooks/features/columns/useGridColumns.js +2 -1
- 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 +97 -70
- package/hooks/features/editing/gridEditingSelectors.d.ts +5 -1
- package/hooks/features/editing/gridEditingSelectors.js +6 -1
- package/hooks/features/editing/useGridRowEditing.js +4 -4
- package/hooks/features/filter/gridFilterSelector.d.ts +2 -2
- package/hooks/features/filter/gridFilterSelector.js +4 -3
- package/hooks/features/filter/gridFilterState.d.ts +8 -3
- package/hooks/features/filter/gridFilterState.js +5 -0
- package/hooks/features/filter/useGridFilter.js +9 -14
- package/hooks/features/overlays/useGridOverlays.js +1 -1
- package/hooks/features/pagination/gridPaginationUtils.js +1 -1
- package/hooks/features/pagination/useGridPagination.js +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/hooks/features/rowSelection/utils.js +2 -2
- 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/useGridRows.js +4 -2
- package/hooks/features/rows/useGridRowsMeta.js +33 -17
- package/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +6 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +43 -27
- package/hooks/utils/index.d.ts +1 -1
- package/hooks/utils/index.js +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +7 -17
- package/hooks/utils/useGridApiEventHandler.js +68 -75
- package/hooks/utils/useGridSelector.js +23 -5
- 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 +3 -1
- package/internals/index.js +3 -1
- package/internals/utils/propValidation.js +1 -1
- package/models/api/gridStateApi.d.ts +1 -0
- package/models/events/gridEventLookup.d.ts +6 -0
- package/modern/DataGrid/useDataGridComponent.js +2 -2
- package/modern/components/GridRow.js +6 -2
- package/modern/components/GridScrollArea.js +31 -24
- package/modern/components/GridSkeletonLoadingOverlay.js +2 -1
- package/modern/components/containers/GridRoot.js +11 -9
- package/modern/components/containers/GridRootStyles.js +3 -3
- package/modern/components/menu/columnMenu/GridColumnMenuContainer.js +5 -2
- package/modern/components/virtualization/GridMainContainer.js +1 -1
- package/modern/components/virtualization/GridVirtualScroller.js +21 -14
- package/modern/constants/index.js +2 -1
- package/modern/constants/signature.js +10 -0
- package/modern/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/modern/hooks/core/useGridApiInitialization.js +1 -1
- package/modern/hooks/core/useGridStateInitialization.js +3 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/modern/hooks/features/columns/gridColumnsSelector.js +0 -12
- package/modern/hooks/features/columns/useGridColumns.js +2 -1
- 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 +97 -70
- package/modern/hooks/features/editing/gridEditingSelectors.js +6 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +4 -4
- package/modern/hooks/features/filter/gridFilterSelector.js +4 -3
- package/modern/hooks/features/filter/gridFilterState.js +5 -0
- package/modern/hooks/features/filter/useGridFilter.js +9 -14
- package/modern/hooks/features/overlays/useGridOverlays.js +1 -1
- package/modern/hooks/features/pagination/gridPaginationUtils.js +1 -1
- package/modern/hooks/features/pagination/useGridPagination.js +1 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/modern/hooks/features/rowSelection/utils.js +2 -2
- package/modern/hooks/features/rows/gridRowsUtils.js +0 -16
- package/modern/hooks/features/rows/useGridRows.js +4 -2
- package/modern/hooks/features/rows/useGridRowsMeta.js +33 -17
- package/modern/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +43 -27
- package/modern/hooks/utils/index.js +1 -1
- package/modern/hooks/utils/useGridApiEventHandler.js +68 -75
- package/modern/hooks/utils/useGridSelector.js +23 -5
- package/modern/hooks/utils/useIsSSR.js +5 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +3 -1
- package/modern/internals/utils/propValidation.js +1 -1
- package/node/DataGrid/useDataGridComponent.js +2 -2
- package/node/components/GridRow.js +6 -2
- package/node/components/GridScrollArea.js +31 -24
- package/node/components/GridSkeletonLoadingOverlay.js +2 -1
- package/node/components/containers/GridRoot.js +10 -8
- package/node/components/containers/GridRootStyles.js +3 -3
- package/node/components/menu/columnMenu/GridColumnMenuContainer.js +5 -2
- package/node/components/virtualization/GridMainContainer.js +1 -1
- package/node/components/virtualization/GridVirtualScroller.js +21 -14
- package/node/constants/index.js +11 -0
- package/node/constants/signature.js +16 -0
- package/node/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +6 -4
- package/node/hooks/core/useGridApiInitialization.js +2 -2
- package/node/hooks/core/useGridStateInitialization.js +3 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -14
- package/node/hooks/features/columns/gridColumnsSelector.js +1 -13
- package/node/hooks/features/columns/useGridColumns.js +2 -1
- 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 +94 -67
- package/node/hooks/features/editing/gridEditingSelectors.js +5 -1
- package/node/hooks/features/editing/useGridRowEditing.js +4 -4
- package/node/hooks/features/filter/gridFilterSelector.js +4 -3
- package/node/hooks/features/filter/gridFilterState.js +6 -1
- package/node/hooks/features/filter/useGridFilter.js +8 -13
- package/node/hooks/features/overlays/useGridOverlays.js +1 -1
- package/node/hooks/features/pagination/gridPaginationUtils.js +2 -2
- package/node/hooks/features/pagination/useGridPagination.js +1 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +5 -4
- package/node/hooks/features/rowSelection/utils.js +3 -3
- package/node/hooks/features/rows/gridRowsUtils.js +0 -17
- package/node/hooks/features/rows/useGridRows.js +6 -4
- package/node/hooks/features/rows/useGridRowsMeta.js +31 -15
- package/node/hooks/features/sorting/gridSortingSelector.js +10 -9
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +42 -26
- package/node/hooks/utils/index.js +21 -11
- package/node/hooks/utils/useGridApiEventHandler.js +71 -78
- package/node/hooks/utils/useGridSelector.js +23 -5
- package/node/hooks/utils/useIsSSR.js +12 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +32 -7
- package/node/internals/utils/propValidation.js +2 -2
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,110 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## **8.0.0-alpha.11**
|
|
9
|
+
|
|
10
|
+
_Feb 7, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- ⚡ Mount and resize performance improvements for the Data Grid
|
|
15
|
+
|
|
16
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
17
|
+
@lauri865.
|
|
18
|
+
Following are all team members who have contributed to this release:
|
|
19
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @flaviendelangle, @Janpot, @KenanYusuf, @LukasTy, @MBilalShafi, @noraleonte, @romgrk.
|
|
20
|
+
|
|
21
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
22
|
+
|
|
23
|
+
### Data Grid
|
|
24
|
+
|
|
25
|
+
#### Breaking changes
|
|
26
|
+
|
|
27
|
+
- `createUseGridApiEventHandler()` is not exported anymore.
|
|
28
|
+
- The `filteredRowsLookup` object of the filter state does not contain `true` values anymore. If the row is filtered out, the value is `false`. Otherwise, the row id is not present in the object.
|
|
29
|
+
This change only impacts you if you relied on `filteredRowsLookup` to get ids of filtered rows. In this case,use `gridDataRowIdsSelector` selector to get row ids and check `filteredRowsLookup` for `false` values:
|
|
30
|
+
|
|
31
|
+
```diff
|
|
32
|
+
const filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
|
|
33
|
+
-const filteredRowIds = Object.keys(filteredRowsLookup).filter((rowId) => filteredRowsLookup[rowId] === true);
|
|
34
|
+
+const rowIds = gridDataRowIdsSelector(apiRef);
|
|
35
|
+
+const filteredRowIds = rowIds.filter((rowId) => filteredRowsLookup[rowId] !== false);
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
- The `visibleRowsLookup` state does not contain `true` values anymore. If the row is not visible, the value is `false`. Otherwise, the row id is not present in the object:
|
|
39
|
+
|
|
40
|
+
```diff
|
|
41
|
+
const visibleRowsLookup = gridVisibleRowsLookupSelector(apiRef);
|
|
42
|
+
-const isRowVisible = visibleRowsLookup[rowId] === true;
|
|
43
|
+
+const isRowVisible = visibleRowsLookup[rowId] !== false;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
#### `@mui/x-data-grid@8.0.0-alpha.11`
|
|
47
|
+
|
|
48
|
+
- [DataGrid] Avoid `<GridRoot />` double-render pass on mount in SPA mode (#15648) @lauri865
|
|
49
|
+
- [DataGrid] Fix loading overlay not in sync with scroll (#16437) @MBilalShafi
|
|
50
|
+
- [DataGrid] Refactor: remove material `MenuList` import (#16444) @romgrk
|
|
51
|
+
- [DataGrid] Refactor: simplify `useGridApiEventHandler()` (#16479) @romgrk
|
|
52
|
+
|
|
53
|
+
#### `@mui/x-data-grid-pro@8.0.0-alpha.11` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
54
|
+
|
|
55
|
+
Same changes as in `@mui/x-data-grid@8.0.0-alpha.11`, plus:
|
|
56
|
+
|
|
57
|
+
- [DataGridPro] Fix the return type of `useGridApiContext()` for Pro and Premium packages on React < 19 (#16441) @arminmeh
|
|
58
|
+
|
|
59
|
+
#### `@mui/x-data-grid-premium@8.0.0-alpha.11` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
60
|
+
|
|
61
|
+
Same changes as in `@mui/x-data-grid-pro@8.0.0-alpha.11`, plus:
|
|
62
|
+
|
|
63
|
+
- [DataGridPremium] Fix "no rows" overlay not showing with active aggregation (#16466) @KenanYusuf
|
|
64
|
+
|
|
65
|
+
### Date and Time Pickers
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-date-pickers@8.0.0-alpha.11`
|
|
68
|
+
|
|
69
|
+
Internal changes.
|
|
70
|
+
|
|
71
|
+
#### `@mui/x-date-pickers-pro@8.0.0-alpha.11` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
72
|
+
|
|
73
|
+
Same changes as in `@mui/x-date-pickers@8.0.0-alpha.11`, plus:
|
|
74
|
+
|
|
75
|
+
- [DateRangeCalendar] Support arrow navigation with multiple months rendered (#16363) @flaviendelangle
|
|
76
|
+
- [DateRangePicker] Fix `currentMonthCalendarPosition` prop behavior on mobile (#16455) @LukasTy
|
|
77
|
+
- [DateRangePicker] Fix vertical alignment for multi input fields (#16489) @noraleonte
|
|
78
|
+
|
|
79
|
+
### Charts
|
|
80
|
+
|
|
81
|
+
#### `@mui/x-charts@8.0.0-alpha.11`
|
|
82
|
+
|
|
83
|
+
- [charts] Add `color` prop to `Sparkline` and deprecate `colors` (#16477) @bernardobelchior
|
|
84
|
+
- [charts] Make typescript more flexible about plugins and their params (#16478) @alexfauquette
|
|
85
|
+
- [charts] Remove component for axis event listener (#16314) @alexfauquette
|
|
86
|
+
|
|
87
|
+
#### `@mui/x-charts-pro@8.0.0-alpha.11` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
88
|
+
|
|
89
|
+
Same changes as in `@mui/x-charts@8.0.0-alpha.11`.
|
|
90
|
+
|
|
91
|
+
### Tree View
|
|
92
|
+
|
|
93
|
+
#### `@mui/x-tree-view@8.0.0-alpha.11`
|
|
94
|
+
|
|
95
|
+
Internal changes.
|
|
96
|
+
|
|
97
|
+
#### `@mui/x-tree-view-pro@8.0.0-alpha.11` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
98
|
+
|
|
99
|
+
Same changes as in `@mui/x-tree-view@8.0.0-alpha.11`.
|
|
100
|
+
|
|
101
|
+
### Docs
|
|
102
|
+
|
|
103
|
+
- [docs] Update charts colors default value (#16484) @bernardobelchior
|
|
104
|
+
|
|
105
|
+
### Core
|
|
106
|
+
|
|
107
|
+
- [core] Fix corepack and pnpm installation in CircleCI (#16434) @flaviendelangle
|
|
108
|
+
- [code-infra] Update monorepo (#16112) @Janpot
|
|
109
|
+
- [test] Avoid test warning when running on React 18 (#16486) @LukasTy
|
|
110
|
+
- [test] Disable `react-transition-group` transitions in unit testing (#16288) @lauri865
|
|
111
|
+
|
|
8
112
|
## 8.0.0-alpha.10
|
|
9
113
|
|
|
10
114
|
_Jan 30, 2025_
|
|
@@ -50,6 +154,7 @@ Following are all team members who have contributed to this release:
|
|
|
50
154
|
+ },
|
|
51
155
|
});
|
|
52
156
|
```
|
|
157
|
+
|
|
53
158
|
- The `detailPanels`, `pinnedColumns`, and `pinnedRowsRenderZone` classes have been removed.
|
|
54
159
|
- Return type of the `useGridApiRef()` hook and the type of `apiRef` prop are updated to explicitly include the possibilty of `null`. In addition to this, `useGridApiRef()` returns a reference that is initialized with `null` instead of `{}`.
|
|
55
160
|
|
|
@@ -91,7 +196,7 @@ Same changes as in `@mui/x-data-grid-pro@8.0.0-alpha.10`.
|
|
|
91
196
|
|
|
92
197
|
#### Breaking changes
|
|
93
198
|
|
|
94
|
-
- The component passed to the `field` slot no longer receives the `ref`,
|
|
199
|
+
- The component passed to the `field` slot no longer receives the `ref`, `disabled`, `className`, `sx`, `label`, `name`, `formatDensity`, `enableAccessibleFieldDOMStructure`, `selectedSections`, `onSelectedSectionsChange` and `inputRef` props — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-field)
|
|
95
200
|
- The `MuiPickersPopper` theme entry have been renamed `MuiPickerPopper` and some of its props have been removed — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#muipickerspopper)
|
|
96
201
|
|
|
97
202
|
#### `@mui/x-date-pickers@8.0.0-alpha.10`
|
|
@@ -111,7 +216,7 @@ Same changes as in `@mui/x-date-pickers@8.0.0-alpha.10`.
|
|
|
111
216
|
|
|
112
217
|
- Replace `legend.position.horizontal` from `"left" | "middle" | "right"` to `"start" | "center" | "end"`.
|
|
113
218
|
This is to align with the CSS values and reflect the RTL ability of the legend component.
|
|
114
|
-
- The default colors have changed. To keep using the old palette. It is possible to import `blueberryTwilightPalette` from
|
|
219
|
+
- The default colors have changed. To keep using the old palette. It is possible to import `blueberryTwilightPalette` from `@mui/x-charts/colorPalettes` and set it on the `colors` property of charts.
|
|
115
220
|
- The `id` property is now optional on the `Pie` and `Scatter` data types.
|
|
116
221
|
|
|
117
222
|
#### `@mui/x-charts@8.0.0-alpha.10`
|
|
@@ -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.js
CHANGED
|
@@ -80,7 +80,10 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
80
80
|
const isRowReorderingEnabled = useGridSelector(apiRef, isRowReorderingEnabledSelector, rowReordering);
|
|
81
81
|
const handleRef = useForkRef(ref, refProp);
|
|
82
82
|
const rowNode = apiRef.current.getRowNode(rowId);
|
|
83
|
-
const editing = useGridSelector(apiRef, gridRowIsEditingSelector,
|
|
83
|
+
const editing = useGridSelector(apiRef, gridRowIsEditingSelector, {
|
|
84
|
+
rowId,
|
|
85
|
+
editMode: rootProps.editMode
|
|
86
|
+
});
|
|
84
87
|
const editable = rootProps.editMode === GridEditModes.Row;
|
|
85
88
|
const hasFocusCell = focusedColumnIndex !== undefined;
|
|
86
89
|
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < firstColumnIndex;
|
|
@@ -298,7 +301,8 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
298
301
|
role: "presentation",
|
|
299
302
|
className: clsx(gridClasses.cell, gridClasses.cellEmpty)
|
|
300
303
|
}), rightCells, scrollbarWidth !== 0 && /*#__PURE__*/_jsx(ScrollbarFiller, {
|
|
301
|
-
pinnedRight: pinnedColumns.right.length > 0
|
|
304
|
+
pinnedRight: pinnedColumns.right.length > 0,
|
|
305
|
+
borderTop: !isFirstVisible
|
|
302
306
|
})]
|
|
303
307
|
}));
|
|
304
308
|
});
|
|
@@ -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 {};
|
|
@@ -11,11 +11,11 @@ import { getDataGridUtilityClass, gridClasses } from "../constants/index.js";
|
|
|
11
11
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
12
12
|
import { useGridApiEventHandler } from "../hooks/utils/useGridApiEventHandler.js";
|
|
13
13
|
import { useGridSelector } from "../hooks/utils/useGridSelector.js";
|
|
14
|
-
import { gridDimensionsSelector } from "../hooks/features/dimensions/gridDimensionsSelectors.js";
|
|
14
|
+
import { gridDimensionsSelector, gridColumnsTotalWidthSelector } from "../hooks/features/dimensions/gridDimensionsSelectors.js";
|
|
15
15
|
import { gridDensityFactorSelector } from "../hooks/features/density/densitySelector.js";
|
|
16
|
-
import { gridColumnsTotalWidthSelector } from "../hooks/features/columns/gridColumnsSelector.js";
|
|
17
16
|
import { useTimeout } from "../hooks/utils/useTimeout.js";
|
|
18
17
|
import { getTotalHeaderHeight } from "../hooks/features/columns/gridColumnsUtils.js";
|
|
18
|
+
import { createSelector } from "../utils/createSelector.js";
|
|
19
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
20
|
const CLIFF = 1;
|
|
21
21
|
const SLOP = 1.5;
|
|
@@ -50,21 +50,38 @@ const GridScrollAreaRawRoot = styled('div', {
|
|
|
50
50
|
right: 0
|
|
51
51
|
}
|
|
52
52
|
}));
|
|
53
|
-
|
|
53
|
+
const offsetSelector = createSelector(gridDimensionsSelector, (dimensions, direction) => {
|
|
54
|
+
if (direction === 'left') {
|
|
55
|
+
return dimensions.leftPinnedWidth;
|
|
56
|
+
}
|
|
57
|
+
if (direction === 'right') {
|
|
58
|
+
return dimensions.rightPinnedWidth + (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
|
|
59
|
+
}
|
|
60
|
+
return 0;
|
|
61
|
+
});
|
|
62
|
+
function GridScrollAreaWrapper(props) {
|
|
63
|
+
const apiRef = useGridApiContext();
|
|
64
|
+
const [dragging, setDragging] = React.useState(false);
|
|
65
|
+
useGridApiEventHandler(apiRef, 'columnHeaderDragStart', () => setDragging(true));
|
|
66
|
+
useGridApiEventHandler(apiRef, 'columnHeaderDragEnd', () => setDragging(false));
|
|
67
|
+
if (!dragging) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return /*#__PURE__*/_jsx(GridScrollAreaContent, _extends({}, props));
|
|
71
|
+
}
|
|
72
|
+
function GridScrollAreaContent(props) {
|
|
54
73
|
const {
|
|
55
|
-
scrollDirection
|
|
74
|
+
scrollDirection,
|
|
75
|
+
scrollPosition
|
|
56
76
|
} = props;
|
|
57
77
|
const rootRef = React.useRef(null);
|
|
58
78
|
const apiRef = useGridApiContext();
|
|
59
79
|
const timeout = useTimeout();
|
|
60
80
|
const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
|
|
61
81
|
const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
62
|
-
const
|
|
63
|
-
const scrollPosition = React.useRef({
|
|
64
|
-
left: 0,
|
|
65
|
-
top: 0
|
|
66
|
-
});
|
|
82
|
+
const sideOffset = useGridSelector(apiRef, offsetSelector, scrollDirection);
|
|
67
83
|
const getCanScrollMore = () => {
|
|
84
|
+
const dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
68
85
|
if (scrollDirection === 'left') {
|
|
69
86
|
// Only render if the user has not reached yet the start of the list
|
|
70
87
|
return scrollPosition.current.left > 0;
|
|
@@ -76,7 +93,6 @@ function GridScrollAreaRaw(props) {
|
|
|
76
93
|
}
|
|
77
94
|
return false;
|
|
78
95
|
};
|
|
79
|
-
const [dragging, setDragging] = React.useState(false);
|
|
80
96
|
const [canScrollMore, setCanScrollMore] = React.useState(getCanScrollMore);
|
|
81
97
|
const rootProps = useGridRootProps();
|
|
82
98
|
const ownerState = _extends({}, rootProps, {
|
|
@@ -90,12 +106,11 @@ function GridScrollAreaRaw(props) {
|
|
|
90
106
|
top: totalHeaderHeight - headerHeight
|
|
91
107
|
};
|
|
92
108
|
if (scrollDirection === 'left') {
|
|
93
|
-
style.left =
|
|
109
|
+
style.left = sideOffset;
|
|
94
110
|
} else if (scrollDirection === 'right') {
|
|
95
|
-
style.right =
|
|
111
|
+
style.right = sideOffset;
|
|
96
112
|
}
|
|
97
|
-
const handleScrolling =
|
|
98
|
-
scrollPosition.current = newScrollPosition;
|
|
113
|
+
const handleScrolling = () => {
|
|
99
114
|
setCanScrollMore(getCanScrollMore);
|
|
100
115
|
};
|
|
101
116
|
const handleDragOver = useEventCallback(event => {
|
|
@@ -120,16 +135,8 @@ function GridScrollAreaRaw(props) {
|
|
|
120
135
|
});
|
|
121
136
|
});
|
|
122
137
|
});
|
|
123
|
-
const handleColumnHeaderDragStart = useEventCallback(() => {
|
|
124
|
-
setDragging(true);
|
|
125
|
-
});
|
|
126
|
-
const handleColumnHeaderDragEnd = useEventCallback(() => {
|
|
127
|
-
setDragging(false);
|
|
128
|
-
});
|
|
129
138
|
useGridApiEventHandler(apiRef, 'scrollPositionChange', handleScrolling);
|
|
130
|
-
|
|
131
|
-
useGridApiEventHandler(apiRef, 'columnHeaderDragEnd', handleColumnHeaderDragEnd);
|
|
132
|
-
if (!dragging || !canScrollMore) {
|
|
139
|
+
if (!canScrollMore) {
|
|
133
140
|
return null;
|
|
134
141
|
}
|
|
135
142
|
return /*#__PURE__*/_jsx(GridScrollAreaRawRoot, {
|
|
@@ -140,4 +147,4 @@ function GridScrollAreaRaw(props) {
|
|
|
140
147
|
style: style
|
|
141
148
|
});
|
|
142
149
|
}
|
|
143
|
-
export const GridScrollArea = fastMemo(
|
|
150
|
+
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";
|
|
@@ -4,7 +4,7 @@ const _excluded = ["className", "children"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import { unstable_useForkRef as useForkRef,
|
|
7
|
+
import { unstable_useForkRef as useForkRef, unstable_capitalize as capitalize, unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
8
8
|
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
9
9
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
10
10
|
import { GridRootStyles } from "./GridRootStyles.js";
|
|
@@ -13,6 +13,7 @@ import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiCon
|
|
|
13
13
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
14
14
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
15
15
|
import { gridDensitySelector } from "../../hooks/features/density/densitySelector.js";
|
|
16
|
+
import { useIsSSR } from "../../hooks/utils/useIsSSR.js";
|
|
16
17
|
import { GridHeader } from "../GridHeader.js";
|
|
17
18
|
import { GridBody, GridFooterPlaceholder } from "../base/index.js";
|
|
18
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -37,16 +38,17 @@ const GridRoot = forwardRef(function GridRoot(props, ref) {
|
|
|
37
38
|
const apiRef = useGridPrivateApiContext();
|
|
38
39
|
const density = useGridSelector(apiRef, gridDensitySelector);
|
|
39
40
|
const rootElementRef = apiRef.current.rootElementRef;
|
|
40
|
-
const
|
|
41
|
+
const rootMountCallback = React.useCallback(node => {
|
|
42
|
+
if (node === null) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
apiRef.current.publishEvent('rootMount', node);
|
|
46
|
+
}, [apiRef]);
|
|
47
|
+
const handleRef = useForkRef(rootElementRef, ref, rootMountCallback);
|
|
41
48
|
const ownerState = rootProps;
|
|
42
49
|
const classes = useUtilityClasses(ownerState, density);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const [mountedState, setMountedState] = React.useState(false);
|
|
46
|
-
useEnhancedEffect(() => {
|
|
47
|
-
setMountedState(true);
|
|
48
|
-
}, []);
|
|
49
|
-
if (!mountedState) {
|
|
50
|
+
const isSSR = useIsSSR();
|
|
51
|
+
if (isSSR) {
|
|
50
52
|
return null;
|
|
51
53
|
}
|
|
52
54
|
return /*#__PURE__*/_jsxs(GridRootStyles, _extends({
|
|
@@ -3,7 +3,6 @@ import { alpha, styled, darken, lighten, decomposeColor, recomposeColor } from '
|
|
|
3
3
|
import { gridClasses as c } from "../../constants/gridClasses.js";
|
|
4
4
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
5
5
|
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
6
|
-
import { gridDimensionsSelector } from "../../hooks/features/dimensions/gridDimensionsSelectors.js";
|
|
7
6
|
function getBorderColor(theme) {
|
|
8
7
|
if (theme.vars) {
|
|
9
8
|
return theme.vars.palette.TableCell.border;
|
|
@@ -35,6 +34,7 @@ const separatorIconDragStyles = {
|
|
|
35
34
|
// Emotion thinks it knows better than us which selector we should use.
|
|
36
35
|
// https://github.com/emotion-js/emotion/issues/1105#issuecomment-1722524968
|
|
37
36
|
const ignoreSsrWarning = '/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */';
|
|
37
|
+
const shouldShowBorderTopRightRadiusSelector = state => state.dimensions.hasScrollX && (!state.dimensions.hasScrollY || state.dimensions.scrollbarSize === 0);
|
|
38
38
|
export const GridRootStyles = styled('div', {
|
|
39
39
|
name: 'MuiDataGrid',
|
|
40
40
|
slot: 'Root',
|
|
@@ -265,7 +265,7 @@ export const GridRootStyles = styled('div', {
|
|
|
265
265
|
theme: t
|
|
266
266
|
}) => {
|
|
267
267
|
const apiRef = useGridPrivateApiContext();
|
|
268
|
-
const
|
|
268
|
+
const shouldShowBorderTopRightRadius = useGridSelector(apiRef, shouldShowBorderTopRightRadiusSelector);
|
|
269
269
|
const borderColor = getBorderColor(t);
|
|
270
270
|
const radius = t.shape.borderRadius;
|
|
271
271
|
const background = (t.vars || t).palette.DataGrid?.bg ?? (t.vars || t).palette.background.default;
|
|
@@ -420,7 +420,7 @@ export const GridRootStyles = styled('div', {
|
|
|
420
420
|
borderTopLeftRadius: 'calc(var(--unstable_DataGrid-radius) - 1px)'
|
|
421
421
|
},
|
|
422
422
|
[`&.${c['root--noToolbar']} [aria-rowindex="1"] .${c['columnHeader--last']}`]: {
|
|
423
|
-
borderTopRightRadius:
|
|
423
|
+
borderTopRightRadius: shouldShowBorderTopRightRadius ? 'calc(var(--unstable_DataGrid-radius) - 1px)' : undefined
|
|
424
424
|
},
|
|
425
425
|
[`& .${c.columnHeaderCheckbox}, & .${c.cellCheckbox}`]: {
|
|
426
426
|
padding: 0,
|
|
@@ -4,13 +4,14 @@ const _excluded = ["hideMenu", "colDef", "id", "labelledby", "className", "child
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import MenuList from '@mui/material/MenuList';
|
|
8
7
|
import { styled } from '@mui/material/styles';
|
|
9
8
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
10
9
|
import { isHideMenuKey } from "../../../utils/keyboardUtils.js";
|
|
10
|
+
import { NotRendered } from "../../../utils/assert.js";
|
|
11
11
|
import { gridClasses } from "../../../constants/gridClasses.js";
|
|
12
|
+
import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.js";
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const StyledMenuList = styled(
|
|
14
|
+
const StyledMenuList = styled(NotRendered)(() => ({
|
|
14
15
|
minWidth: 248
|
|
15
16
|
}));
|
|
16
17
|
const GridColumnMenuContainer = forwardRef(function GridColumnMenuContainer(props, ref) {
|
|
@@ -23,6 +24,7 @@ const GridColumnMenuContainer = forwardRef(function GridColumnMenuContainer(prop
|
|
|
23
24
|
open
|
|
24
25
|
} = props,
|
|
25
26
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
27
|
+
const rootProps = useGridRootProps();
|
|
26
28
|
const handleListKeyDown = React.useCallback(event => {
|
|
27
29
|
if (event.key === 'Tab') {
|
|
28
30
|
event.preventDefault();
|
|
@@ -32,6 +34,7 @@ const GridColumnMenuContainer = forwardRef(function GridColumnMenuContainer(prop
|
|
|
32
34
|
}
|
|
33
35
|
}, [hideMenu]);
|
|
34
36
|
return /*#__PURE__*/_jsx(StyledMenuList, _extends({
|
|
37
|
+
as: rootProps.slots.baseMenuList,
|
|
35
38
|
id: id,
|
|
36
39
|
className: clsx(gridClasses.menuList, className),
|
|
37
40
|
"aria-labelledby": labelledby,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
3
|
-
import { GridDimensions } from '../../hooks/features/dimensions';
|
|
4
3
|
import { GridLoadingOverlayVariant } from '../GridLoadingOverlay';
|
|
5
4
|
type OwnerState = Pick<DataGridProcessedProps, 'classes'> & {
|
|
6
|
-
|
|
5
|
+
hasScrollX: boolean;
|
|
6
|
+
hasPinnedRight: boolean;
|
|
7
7
|
loadingOverlayVariant: GridLoadingOverlayVariant | null;
|
|
8
8
|
};
|
|
9
9
|
export declare const GridMainContainer: React.ForwardRefExoticComponent<React.PropsWithChildren<{
|
|
@@ -18,7 +18,7 @@ const Element = styled('div', {
|
|
|
18
18
|
const {
|
|
19
19
|
ownerState
|
|
20
20
|
} = props;
|
|
21
|
-
return [styles.main, ownerState.
|
|
21
|
+
return [styles.main, ownerState.hasPinnedRight && styles['main--hasPinnedRight'], ownerState.loadingOverlayVariant === 'skeleton' && styles['main--hasSkeletonLoadingOverlay']];
|
|
22
22
|
}
|
|
23
23
|
})({
|
|
24
24
|
flexGrow: 1,
|
|
@@ -2,12 +2,12 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { styled } from '@mui/system';
|
|
4
4
|
import composeClasses from '@mui/utils/composeClasses';
|
|
5
|
+
import { gridHasBottomFillerSelector, gridHasScrollXSelector, gridHasScrollYSelector } from "../../hooks/features/dimensions/gridDimensionsSelectors.js";
|
|
5
6
|
import { GridScrollArea } from "../GridScrollArea.js";
|
|
6
7
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
7
8
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
8
9
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
9
10
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
10
|
-
import { gridDimensionsSelector } from "../../hooks/features/dimensions/index.js";
|
|
11
11
|
import { useGridVirtualScroller } from "../../hooks/features/virtualization/useGridVirtualScroller.js";
|
|
12
12
|
import { useGridOverlays } from "../../hooks/features/overlays/useGridOverlays.js";
|
|
13
13
|
import { GridHeaders } from "../GridHeaders.js";
|
|
@@ -22,12 +22,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
22
22
|
const useUtilityClasses = ownerState => {
|
|
23
23
|
const {
|
|
24
24
|
classes,
|
|
25
|
-
|
|
25
|
+
hasScrollX,
|
|
26
|
+
hasPinnedRight,
|
|
26
27
|
loadingOverlayVariant
|
|
27
28
|
} = ownerState;
|
|
28
29
|
const slots = {
|
|
29
|
-
root: ['main',
|
|
30
|
-
scroller: ['virtualScroller',
|
|
30
|
+
root: ['main', hasPinnedRight && 'main--hasPinnedRight', loadingOverlayVariant === 'skeleton' && 'main--hasSkeletonLoadingOverlay'],
|
|
31
|
+
scroller: ['virtualScroller', hasScrollX && 'virtualScroller--hasScrollX']
|
|
31
32
|
};
|
|
32
33
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
33
34
|
};
|
|
@@ -38,7 +39,7 @@ const Scroller = styled('div', {
|
|
|
38
39
|
const {
|
|
39
40
|
ownerState
|
|
40
41
|
} = props;
|
|
41
|
-
return [styles.virtualScroller, ownerState.
|
|
42
|
+
return [styles.virtualScroller, ownerState.hasScrollX && styles['virtualScroller--hasScrollX']];
|
|
42
43
|
}
|
|
43
44
|
})({
|
|
44
45
|
position: 'relative',
|
|
@@ -57,17 +58,22 @@ const Scroller = styled('div', {
|
|
|
57
58
|
// See https://github.com/mui/mui-x/issues/10547
|
|
58
59
|
zIndex: 0
|
|
59
60
|
});
|
|
61
|
+
const hasPinnedRightSelector = state => state.dimensions.rightPinnedWidth > 0;
|
|
60
62
|
function GridVirtualScroller(props) {
|
|
61
63
|
const apiRef = useGridApiContext();
|
|
62
64
|
const rootProps = useGridRootProps();
|
|
63
|
-
const
|
|
65
|
+
const hasScrollY = useGridSelector(apiRef, gridHasScrollYSelector);
|
|
66
|
+
const hasScrollX = useGridSelector(apiRef, gridHasScrollXSelector);
|
|
67
|
+
const hasPinnedRight = useGridSelector(apiRef, hasPinnedRightSelector);
|
|
68
|
+
const hasBottomFiller = useGridSelector(apiRef, gridHasBottomFillerSelector);
|
|
64
69
|
const {
|
|
65
70
|
getOverlay,
|
|
66
71
|
overlaysProps
|
|
67
72
|
} = useGridOverlays();
|
|
68
73
|
const ownerState = {
|
|
69
74
|
classes: rootProps.classes,
|
|
70
|
-
|
|
75
|
+
hasScrollX,
|
|
76
|
+
hasPinnedRight,
|
|
71
77
|
loadingOverlayVariant: overlaysProps.loadingOverlayVariant
|
|
72
78
|
};
|
|
73
79
|
const classes = useUtilityClasses(ownerState);
|
|
@@ -79,18 +85,19 @@ function GridVirtualScroller(props) {
|
|
|
79
85
|
getRenderZoneProps,
|
|
80
86
|
getScrollbarVerticalProps,
|
|
81
87
|
getScrollbarHorizontalProps,
|
|
82
|
-
getRows
|
|
88
|
+
getRows,
|
|
89
|
+
getScrollAreaProps
|
|
83
90
|
} = virtualScroller;
|
|
84
91
|
const rows = getRows();
|
|
85
92
|
return /*#__PURE__*/_jsxs(Container, _extends({
|
|
86
93
|
className: classes.root
|
|
87
94
|
}, getContainerProps(), {
|
|
88
95
|
ownerState: ownerState,
|
|
89
|
-
children: [/*#__PURE__*/_jsx(GridScrollArea, {
|
|
96
|
+
children: [/*#__PURE__*/_jsx(GridScrollArea, _extends({
|
|
90
97
|
scrollDirection: "left"
|
|
91
|
-
}), /*#__PURE__*/_jsx(GridScrollArea, {
|
|
98
|
+
}, getScrollAreaProps())), /*#__PURE__*/_jsx(GridScrollArea, _extends({
|
|
92
99
|
scrollDirection: "right"
|
|
93
|
-
}), /*#__PURE__*/_jsxs(Scroller, _extends({
|
|
100
|
+
}, getScrollAreaProps())), /*#__PURE__*/_jsxs(Scroller, _extends({
|
|
94
101
|
className: classes.scroller
|
|
95
102
|
}, getScrollerProps(), {
|
|
96
103
|
ownerState: ownerState,
|
|
@@ -105,7 +112,7 @@ function GridVirtualScroller(props) {
|
|
|
105
112
|
virtualScroller: virtualScroller
|
|
106
113
|
})]
|
|
107
114
|
}))
|
|
108
|
-
})), /*#__PURE__*/_jsx(SpaceFiller, {
|
|
115
|
+
})), hasBottomFiller && /*#__PURE__*/_jsx(SpaceFiller, {
|
|
109
116
|
rowsLength: rows.length
|
|
110
117
|
}), /*#__PURE__*/_jsx(BottomContainer, {
|
|
111
118
|
children: /*#__PURE__*/_jsx(rootProps.slots.pinnedRows, {
|
|
@@ -113,9 +120,9 @@ function GridVirtualScroller(props) {
|
|
|
113
120
|
virtualScroller: virtualScroller
|
|
114
121
|
})
|
|
115
122
|
})]
|
|
116
|
-
})),
|
|
123
|
+
})), hasScrollX && !rootProps.unstable_listView && /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
117
124
|
position: "horizontal"
|
|
118
|
-
}, getScrollbarHorizontalProps())),
|
|
125
|
+
}, getScrollbarHorizontalProps())), hasScrollY && /*#__PURE__*/_jsx(Scrollbar, _extends({
|
|
119
126
|
position: "vertical"
|
|
120
127
|
}, getScrollbarVerticalProps())), props.children]
|
|
121
128
|
}));
|
package/constants/index.d.ts
CHANGED
package/constants/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signal to the underlying logic what version of the public component API
|
|
3
|
+
* of the Data Grid is exposed.
|
|
4
|
+
*/
|
|
5
|
+
export let GridSignature = /*#__PURE__*/function (GridSignature) {
|
|
6
|
+
GridSignature["DataGrid"] = "DataGrid";
|
|
7
|
+
GridSignature["DataGridPro"] = "DataGridPro";
|
|
8
|
+
GridSignature["DataGridPremium"] = "DataGridPremium";
|
|
9
|
+
return GridSignature;
|
|
10
|
+
}({});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RefObject } from '@mui/x-internals/types';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../../models/api/gridApiCommon';
|
|
3
3
|
import { GridPipeProcessorGroup, GridPipeProcessor } from './gridPipeProcessingApi';
|
|
4
|
-
export declare const useGridRegisterPipeProcessor: <PrivateApi extends GridPrivateApiCommon, G extends GridPipeProcessorGroup>(apiRef: RefObject<PrivateApi>, group: G, callback: GridPipeProcessor<G
|
|
4
|
+
export declare const useGridRegisterPipeProcessor: <PrivateApi extends GridPrivateApiCommon, G extends GridPipeProcessorGroup>(apiRef: RefObject<PrivateApi>, group: G, callback: GridPipeProcessor<G>, enabled?: boolean) => void;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useFirstRender } from "../../utils/useFirstRender.js";
|
|
3
|
-
export const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
|
|
3
|
+
export const useGridRegisterPipeProcessor = (apiRef, group, callback, enabled = true) => {
|
|
4
4
|
const cleanup = React.useRef(null);
|
|
5
5
|
const id = React.useRef(`mui-${Math.round(Math.random() * 1e9)}`);
|
|
6
6
|
const registerPreProcessor = React.useCallback(() => {
|
|
7
7
|
cleanup.current = apiRef.current.registerPipeProcessor(group, id.current, callback);
|
|
8
8
|
}, [apiRef, callback, group]);
|
|
9
9
|
useFirstRender(() => {
|
|
10
|
-
|
|
10
|
+
if (enabled) {
|
|
11
|
+
registerPreProcessor();
|
|
12
|
+
}
|
|
11
13
|
});
|
|
12
14
|
const isFirstRender = React.useRef(true);
|
|
13
15
|
React.useEffect(() => {
|
|
14
16
|
if (isFirstRender.current) {
|
|
15
17
|
isFirstRender.current = false;
|
|
16
|
-
} else {
|
|
18
|
+
} else if (enabled) {
|
|
17
19
|
registerPreProcessor();
|
|
18
20
|
}
|
|
19
21
|
return () => {
|
|
@@ -22,5 +24,5 @@ export const useGridRegisterPipeProcessor = (apiRef, group, callback) => {
|
|
|
22
24
|
cleanup.current = null;
|
|
23
25
|
}
|
|
24
26
|
};
|
|
25
|
-
}, [registerPreProcessor]);
|
|
27
|
+
}, [registerPreProcessor, enabled]);
|
|
26
28
|
};
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { EventManager } from '@mui/x-internals/EventManager';
|
|
3
3
|
import { Store } from "../../utils/Store.js";
|
|
4
4
|
import { useGridApiMethod } from "../utils/useGridApiMethod.js";
|
|
5
|
-
import { GridSignature } from "
|
|
5
|
+
import { GridSignature } from "../../constants/signature.js";
|
|
6
6
|
const SYMBOL_API_PRIVATE = Symbol('mui.api_private');
|
|
7
7
|
const isSyntheticEvent = event => {
|
|
8
8
|
return event.isPropagationStopped !== undefined;
|