@mui/x-data-grid 5.15.3 → 5.17.1
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 +150 -1
- package/DataGrid/DataGrid.js +2 -0
- package/DataGrid/useDataGridComponent.js +5 -0
- package/components/DataGridColumnHeaders.js +4 -3
- package/components/GridRow.d.ts +2 -1
- package/components/GridRow.js +136 -85
- package/components/base/GridBody.js +8 -5
- package/components/base/GridOverlays.js +3 -3
- package/components/cell/GridBooleanCell.js +2 -1
- package/components/cell/GridCell.js +9 -1
- package/components/cell/GridEditBooleanCell.js +2 -1
- package/components/cell/GridEditDateCell.js +2 -1
- package/components/cell/GridEditInputCell.js +2 -1
- package/components/cell/GridEditSingleSelectCell.js +2 -1
- package/components/cell/GridSkeletonCell.d.ts +12 -0
- package/components/cell/GridSkeletonCell.js +60 -0
- package/components/cell/index.d.ts +1 -0
- package/components/cell/index.js +2 -1
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +14 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +122 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +55 -71
- package/components/columnHeaders/GridColumnHeadersInner.js +2 -1
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +32 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +104 -0
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/components/containers/GridRoot.js +3 -3
- package/components/containers/GridRootStyles.js +16 -2
- package/components/panel/GridColumnsPanel.d.ts +6 -1
- package/components/panel/GridColumnsPanel.js +38 -6
- package/components/panel/GridPanel.d.ts +1 -1
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +24 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -1
- package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +7 -0
- package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +1 -0
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +7 -0
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +8 -0
- package/hooks/features/columnGrouping/index.d.ts +2 -0
- package/hooks/features/columnGrouping/index.js +2 -0
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +24 -0
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +153 -0
- package/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.d.ts +4 -0
- package/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +35 -0
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +7 -6
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +204 -9
- package/hooks/features/density/densitySelector.d.ts +2 -0
- package/hooks/features/density/densitySelector.js +3 -1
- package/hooks/features/density/densityState.d.ts +1 -0
- package/hooks/features/density/useGridDensity.d.ts +1 -1
- package/hooks/features/density/useGridDensity.js +45 -9
- package/hooks/features/dimensions/useGridDimensions.js +4 -4
- package/hooks/features/export/useGridPrintExport.js +3 -3
- package/hooks/features/filter/gridFilterSelector.d.ts +3 -3
- package/hooks/features/filter/gridFilterUtils.d.ts +1 -1
- package/hooks/features/filter/gridFilterUtils.js +55 -54
- package/hooks/features/filter/useGridFilter.js +1 -1
- package/hooks/features/focus/useGridFocus.js +13 -3
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/hooks/features/pagination/gridPaginationSelector.d.ts +1 -1
- package/hooks/features/rows/gridRowsSelector.d.ts +1 -1
- package/hooks/features/rows/useGridParamsApi.js +1 -1
- package/hooks/features/rows/useGridRows.js +65 -8
- package/hooks/features/rows/useGridRowsMeta.js +36 -16
- package/hooks/features/selection/gridSelectionSelector.d.ts +1 -1
- package/hooks/features/sorting/gridSortingSelector.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +3 -1
- package/internals/index.js +3 -1
- package/legacy/DataGrid/DataGrid.js +2 -0
- package/legacy/DataGrid/useDataGridComponent.js +5 -0
- package/legacy/components/DataGridColumnHeaders.js +4 -3
- package/legacy/components/GridRow.js +138 -85
- package/legacy/components/base/GridBody.js +8 -5
- package/legacy/components/base/GridOverlays.js +3 -3
- package/legacy/components/cell/GridBooleanCell.js +2 -1
- package/legacy/components/cell/GridCell.js +11 -1
- package/legacy/components/cell/GridEditBooleanCell.js +2 -1
- package/legacy/components/cell/GridEditDateCell.js +2 -1
- package/legacy/components/cell/GridEditInputCell.js +2 -1
- package/legacy/components/cell/GridEditSingleSelectCell.js +2 -1
- package/legacy/components/cell/GridSkeletonCell.js +57 -0
- package/legacy/components/cell/index.js +2 -1
- package/legacy/components/columnHeaders/GridColumnGroupHeader.js +120 -0
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +78 -88
- package/legacy/components/columnHeaders/GridColumnHeadersInner.js +2 -1
- package/legacy/components/columnHeaders/GridGenericColumnHeaderItem.js +112 -0
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/legacy/components/containers/GridRoot.js +3 -3
- package/legacy/components/containers/GridRootStyles.js +14 -5
- package/legacy/components/panel/GridColumnsPanel.js +41 -6
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +1 -0
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsSelector.js +12 -0
- package/legacy/hooks/features/columnGrouping/index.js +2 -0
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +151 -0
- package/legacy/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +35 -0
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +213 -12
- package/legacy/hooks/features/density/densitySelector.js +6 -0
- package/legacy/hooks/features/density/useGridDensity.js +44 -6
- package/legacy/hooks/features/dimensions/useGridDimensions.js +4 -4
- package/legacy/hooks/features/export/useGridPrintExport.js +3 -3
- package/legacy/hooks/features/filter/gridFilterUtils.js +61 -56
- package/legacy/hooks/features/filter/useGridFilter.js +1 -1
- package/legacy/hooks/features/focus/useGridFocus.js +13 -3
- package/legacy/hooks/features/index.js +1 -0
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/legacy/hooks/features/rows/useGridParamsApi.js +1 -1
- package/legacy/hooks/features/rows/useGridRows.js +73 -8
- package/legacy/hooks/features/rows/useGridRowsMeta.js +45 -18
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +31 -13
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +3 -1
- package/legacy/models/api/gridColumnGroupingApi.js +1 -0
- package/legacy/models/events/gridEvents.js +2 -0
- package/legacy/models/gridColumnGrouping.js +6 -0
- package/legacy/models/index.js +2 -1
- package/legacy/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/legacy/models/params/index.js +2 -1
- package/legacy/utils/utils.js +18 -0
- package/models/api/gridApiCommon.d.ts +2 -1
- package/models/api/gridColumnGroupingApi.d.ts +19 -0
- package/models/api/gridColumnGroupingApi.js +1 -0
- package/models/api/gridDensityApi.d.ts +2 -1
- package/models/api/gridParamsApi.d.ts +1 -1
- package/models/api/gridRowApi.d.ts +6 -0
- package/models/api/gridRowsMetaApi.d.ts +6 -1
- package/models/colDef/gridColDef.d.ts +15 -1
- package/models/events/gridEventLookup.d.ts +7 -1
- package/models/events/gridEvents.d.ts +3 -1
- package/models/events/gridEvents.js +2 -0
- package/models/gridColumnGrouping.d.ts +67 -0
- package/models/gridColumnGrouping.js +6 -0
- package/models/gridRows.d.ts +5 -5
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridStateCommunity.d.ts +2 -1
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/models/params/gridCellParams.d.ts +7 -2
- package/models/params/gridRenderedRowsIntervalChangeParams.d.ts +10 -0
- package/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/models/props/DataGridProps.d.ts +6 -0
- package/modern/DataGrid/DataGrid.js +2 -0
- package/modern/DataGrid/useDataGridComponent.js +5 -0
- package/modern/components/DataGridColumnHeaders.js +4 -3
- package/modern/components/GridRow.js +133 -84
- package/modern/components/base/GridBody.js +8 -5
- package/modern/components/base/GridOverlays.js +3 -3
- package/modern/components/cell/GridBooleanCell.js +2 -1
- package/modern/components/cell/GridCell.js +9 -1
- package/modern/components/cell/GridEditBooleanCell.js +2 -1
- package/modern/components/cell/GridEditDateCell.js +2 -1
- package/modern/components/cell/GridEditInputCell.js +2 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -1
- package/modern/components/cell/GridSkeletonCell.js +60 -0
- package/modern/components/cell/index.js +2 -1
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +120 -0
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +53 -69
- package/modern/components/columnHeaders/GridColumnHeadersInner.js +2 -1
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +104 -0
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/modern/components/containers/GridRoot.js +3 -3
- package/modern/components/containers/GridRootStyles.js +16 -2
- package/modern/components/panel/GridColumnsPanel.js +38 -6
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +1 -0
- package/modern/hooks/features/columnGrouping/gridColumnGroupsSelector.js +8 -0
- package/modern/hooks/features/columnGrouping/index.js +2 -0
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +145 -0
- package/modern/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +29 -0
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +186 -9
- package/modern/hooks/features/density/densitySelector.js +3 -1
- package/modern/hooks/features/density/useGridDensity.js +37 -9
- package/modern/hooks/features/dimensions/useGridDimensions.js +4 -4
- package/modern/hooks/features/export/useGridPrintExport.js +3 -3
- package/modern/hooks/features/filter/gridFilterUtils.js +54 -53
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/focus/useGridFocus.js +13 -3
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/modern/hooks/features/rows/useGridParamsApi.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +65 -8
- package/modern/hooks/features/rows/useGridRowsMeta.js +36 -16
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/modern/index.js +1 -1
- package/modern/internals/index.js +3 -1
- package/modern/models/api/gridColumnGroupingApi.js +1 -0
- package/modern/models/events/gridEvents.js +2 -0
- package/modern/models/gridColumnGrouping.js +6 -0
- package/modern/models/index.js +2 -1
- package/modern/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/modern/utils/utils.js +16 -0
- package/node/DataGrid/DataGrid.js +2 -0
- package/node/DataGrid/useDataGridComponent.js +7 -0
- package/node/components/DataGridColumnHeaders.js +4 -3
- package/node/components/GridRow.js +136 -77
- package/node/components/base/GridBody.js +7 -4
- package/node/components/base/GridOverlays.js +2 -2
- package/node/components/cell/GridBooleanCell.js +2 -1
- package/node/components/cell/GridCell.js +9 -1
- package/node/components/cell/GridEditBooleanCell.js +2 -1
- package/node/components/cell/GridEditDateCell.js +2 -1
- package/node/components/cell/GridEditInputCell.js +2 -1
- package/node/components/cell/GridEditSingleSelectCell.js +2 -1
- package/node/components/cell/GridSkeletonCell.js +81 -0
- package/node/components/cell/index.js +13 -0
- package/node/components/columnHeaders/GridColumnGroupHeader.js +141 -0
- package/node/components/columnHeaders/GridColumnHeaderItem.js +53 -72
- package/node/components/columnHeaders/GridColumnHeadersInner.js +2 -1
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +126 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/node/components/containers/GridRoot.js +4 -4
- package/node/components/containers/GridRootStyles.js +16 -2
- package/node/components/panel/GridColumnsPanel.js +36 -5
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +5 -0
- package/node/hooks/features/columnGrouping/gridColumnGroupsSelector.js +18 -0
- package/node/hooks/features/columnGrouping/index.js +18 -0
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +182 -0
- package/node/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +55 -0
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +207 -8
- package/node/hooks/features/density/densitySelector.js +6 -2
- package/node/hooks/features/density/useGridDensity.js +48 -9
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/node/hooks/features/export/useGridPrintExport.js +2 -2
- package/node/hooks/features/filter/gridFilterUtils.js +55 -55
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/focus/useGridFocus.js +13 -3
- package/node/hooks/features/index.js +13 -0
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -0
- package/node/hooks/features/rows/useGridParamsApi.js +1 -1
- package/node/hooks/features/rows/useGridRows.js +60 -7
- package/node/hooks/features/rows/useGridRowsMeta.js +35 -15
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/node/index.js +1 -1
- package/node/internals/index.js +28 -0
- package/node/models/api/gridColumnGroupingApi.js +5 -0
- package/node/models/events/gridEvents.js +2 -0
- package/node/models/gridColumnGrouping.js +13 -0
- package/node/models/index.js +13 -0
- package/node/models/params/gridRenderedRowsIntervalChangeParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/node/utils/utils.js +18 -0
- package/package.json +3 -3
- package/utils/utils.d.ts +1 -0
- package/utils/utils.js +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,155 @@
|
|
|
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
|
+
## 5.17.1
|
|
7
|
+
|
|
8
|
+
_Sep 5, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🐞 Bugfixes
|
|
13
|
+
|
|
14
|
+
### `@mui/x-data-grid@v5.17.1` / `@mui/x-data-grid-pro@v5.17.1` / `@mui/x-data-grid-premium@v5.17.1`
|
|
15
|
+
|
|
16
|
+
#### Changes
|
|
17
|
+
|
|
18
|
+
- [DataGrid] Fix cells being focused on mouseUp (#5980) @cherniavskii
|
|
19
|
+
- [DataGrid] Fix focused cell if column is spanned and new editing API is used (#5962) @m4theushw
|
|
20
|
+
- [DataGridPro] Fix import in lazy-loading causing a bundling error (#6031) @flaviendelangle
|
|
21
|
+
|
|
22
|
+
## 5.17.0
|
|
23
|
+
|
|
24
|
+
_Sep 2, 2022_
|
|
25
|
+
|
|
26
|
+
🎉 We are excited to finally introduce a stable release (v5.0.0) for the `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` packages!
|
|
27
|
+
|
|
28
|
+
If you are still using picker components from the `lab`, take a look at the [migration guide](https://mui.com/x/react-date-pickers/migration-lab/).
|
|
29
|
+
|
|
30
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
31
|
+
|
|
32
|
+
- 🎁 Implement Lazy loading (#5214) @DanailH
|
|
33
|
+
|
|
34
|
+
Pro users now can try the experimental lazy loading feature.
|
|
35
|
+
In a few steps, you can load your data on demand, as the rows are displayed.
|
|
36
|
+
|
|
37
|
+
To enable this feature, add `experimentalFeatures={{ lazyLoading: true }}`.
|
|
38
|
+
Lazy Loading requires a few other settings.
|
|
39
|
+
See the [documentation](https://mui.com/x/react-data-grid/row-updates/#lazy-loading) to explore the example in detail.
|
|
40
|
+
|
|
41
|
+
- 🚀 Improve `pickers` focus management (#5820) @alexfauquette
|
|
42
|
+
- 🎉 Enable disabling `day` on date range picker depending on `position` (#5773) @alexfauquette
|
|
43
|
+
- ✨ Various improvements
|
|
44
|
+
- 📚 Documentation improvements
|
|
45
|
+
- 🐞 Bugfixes
|
|
46
|
+
|
|
47
|
+
### `@mui/x-data-grid@v5.17.0` / `@mui/x-data-grid-pro@v5.17.0` / `@mui/x-data-grid-premium@v5.17.0`
|
|
48
|
+
|
|
49
|
+
#### Changes
|
|
50
|
+
|
|
51
|
+
- [DataGrid] Add `sort` prop to columns panel slot (#5888) @gavbrennan
|
|
52
|
+
- [DataGrid] Do not throw if `fieldToFocus` cannot be found (#5871) @cherniavskii
|
|
53
|
+
- [DataGrid] Support `getRowId` in the `replaceRows` method (#5988) @flaviendelangle
|
|
54
|
+
- [DataGridPro] Add class name to row with open detail panel (#5924) @m4theushw
|
|
55
|
+
- [DataGridPro] Fix crash when using `pinnedRows` + `getRowClassName` props and `rows=[]` (#5851) @cherniavskii
|
|
56
|
+
- [DataGridPro] Fix filtering with inactive filter items (#5993) @alexfauquette
|
|
57
|
+
- [DataGridPro] Implement Lazy loading (#5214) @DanailH
|
|
58
|
+
- [DataGridPro] Support pinned columns and dynamic row height (#5782) @m4theushw
|
|
59
|
+
- [DataGridPremium] Add state initializer for column groups (#5963) @alexfauquette
|
|
60
|
+
- [DataGridPremium] Update grouping when `groupingValueGetter` changes (#5919) @flaviendelangle
|
|
61
|
+
- [DataGridPremium] Use the aggregated value on tree data real groups (#5953) @flaviendelangle
|
|
62
|
+
|
|
63
|
+
### `@mui/x-date-pickers@v5.0.0` / `@mui/x-date-pickers-pro@v5.0.0`
|
|
64
|
+
|
|
65
|
+
#### Changes
|
|
66
|
+
|
|
67
|
+
- [DatePicker] Improve focus management (#5820) @alexfauquette
|
|
68
|
+
- [DateRangePicker] Enable disabling `day` depending on `position` (#5773) @alexfauquette
|
|
69
|
+
- [DateTimePicker] Create a new `tabs` component slot (#5972) @LukasTy
|
|
70
|
+
- [pickers] Do not forward validation props to the DOM on field components (#5971) @flaviendelangle
|
|
71
|
+
- [pickers] Do not hardcode `date-fns` elements in field components (#5975) @flaviendelangle
|
|
72
|
+
- [pickers] Do not require `date-fns` in `@mui/x-date-pickers-pro` (#5941) @flaviendelangle
|
|
73
|
+
- [pickers] Fix mobile picker not opening on label click (#5651) @LukasTy
|
|
74
|
+
- [pickers] Improve DOM event management on `useField` (#5901) @flaviendelangle
|
|
75
|
+
- [pickers] Include `community` package `themeAugmentation` in `pro` package types (#5969) @LukasTy
|
|
76
|
+
- [pickers] Rename `DateRangeField` into `SingleInputDateRangeField` (#5961) @flaviendelangle
|
|
77
|
+
- [pickers] Support `isSameError` on field components (#5984) @flaviendelangle
|
|
78
|
+
|
|
79
|
+
### Docs
|
|
80
|
+
|
|
81
|
+
- [docs] Add `description` and `default` to pickers slots (#5893) @alexfauquette
|
|
82
|
+
- [docs] Fix typo (#5945) @wettopa
|
|
83
|
+
- [docs] Fix typo `onYearPicker` to `onYearChange` (#5954) @alexfauquette
|
|
84
|
+
- [docs] Update `GridCellParams`'s `value` description (#5849) @cherniavskii
|
|
85
|
+
- [docs] Update `README.md` to match Introduction section of the docs (#5754) @samuelsycamore
|
|
86
|
+
|
|
87
|
+
### Core
|
|
88
|
+
|
|
89
|
+
- [core] Fix typo (#5990) @flaviendelangle
|
|
90
|
+
- [core] Remove old babel resolve rule (#5939) @oliviertassinari
|
|
91
|
+
- [core] Remove outdated TODO (#5956) @flaviendelangle
|
|
92
|
+
- [core] Upgrade monorepo (#5960) @cherniavskii
|
|
93
|
+
- [core] Fix statics (#5986) @DanailH
|
|
94
|
+
- [core] Remove unused dependencies (#5937) @oliviertassinari
|
|
95
|
+
- [license] Remove CLI (#5757) @flaviendelangle
|
|
96
|
+
- [test] Fix time zone sensitive test (#5955) @LukasTy
|
|
97
|
+
- [test] Use `userEvent.mousePress` instead of `fireClickEvent` (#5920) @cherniavskii
|
|
98
|
+
|
|
99
|
+
## 5.16.0
|
|
100
|
+
|
|
101
|
+
_Aug 25, 2022_
|
|
102
|
+
|
|
103
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
104
|
+
|
|
105
|
+
- 🎁 Introduce column grouping for data grid (#5133) @alexfauquette
|
|
106
|
+
|
|
107
|
+
You can now group columns using the `columnGroupingModel` prop. This lets you to display more structured data.
|
|
108
|
+
|
|
109
|
+
<img src="https://user-images.githubusercontent.com/45398769/186178366-4fba66b2-bf90-4c7a-9d83-940a7fc78704.png" width="800" />
|
|
110
|
+
|
|
111
|
+
To enable this feature, add `experimentalFeatures={{ columnGrouping: true }}`.
|
|
112
|
+
The grouping header can be fully customized.
|
|
113
|
+
See the [documentation](https://mui.com/x/react-data-grid/column-groups/) to explore everything it has to offer.
|
|
114
|
+
|
|
115
|
+
- 🐞 Bugfixes
|
|
116
|
+
- 🌏 New locales for pickers thanks to @tesseractjh and @drastus
|
|
117
|
+
|
|
118
|
+
### `@mui/x-data-grid@v5.16.0` / `@mui/x-data-grid-pro@v5.16.0` / `@mui/x-data-grid-premium@v5.16.0`
|
|
119
|
+
|
|
120
|
+
#### Changes
|
|
121
|
+
|
|
122
|
+
- [DataGrid] Implement column grouping (#5133) @alexfauquette
|
|
123
|
+
- [DataGrid] Handle `disableVirtualization` prop change (#5889) @cherniavskii
|
|
124
|
+
- [DataGrid] Improve `GridRowModel` typing (#5734) @cherniavskii
|
|
125
|
+
- [DataGrid] Update deprecation note for `GridColDef` `hide` property (#5886) @cherniavskii
|
|
126
|
+
|
|
127
|
+
### `@mui/x-date-pickers@v5.0.0-beta.7` / `@mui/x-date-pickers-pro@v5.0.0-beta.7`
|
|
128
|
+
|
|
129
|
+
#### Changes
|
|
130
|
+
|
|
131
|
+
- [DatePicker] Fix to pass down `className` prop provided on DatePicker to `renderInput` (#5471) @CruseCtrl
|
|
132
|
+
- [DatePicker] Improve `a11y` support (#5809) @LukasTy
|
|
133
|
+
- [pickers] Add `PaperContent` component slot (#5801) @LukasTy
|
|
134
|
+
- [pickers] Add a breaking change section in the migration guide (#5805) @alexfauquette
|
|
135
|
+
- [pickers] Add new translations to `localeText` (#5143) @alexfauquette
|
|
136
|
+
- [pickers] Document components slots (#4657) @flaviendelangle
|
|
137
|
+
- [pickers] Add new unstable field components (#5504) @flaviendelangle
|
|
138
|
+
- [pickers] Fallback to default `minDate` / `maxDate` when `null` value is passed (#5397) @flaviendelangle
|
|
139
|
+
- [l10n] Add Korean (ko-KR) locale (#5854) @tesseractjh
|
|
140
|
+
- [l10n] Add Polish (pl-PL) locale (#5833) @drastus
|
|
141
|
+
|
|
142
|
+
### Docs
|
|
143
|
+
|
|
144
|
+
- [docs] Fix typo in `migration from lab` (#5277) @chuckwired
|
|
145
|
+
- [docs] Use `dayjs` instead of `date-fns` in doc examples (#5481) @flaviendelangle
|
|
146
|
+
|
|
147
|
+
### Core
|
|
148
|
+
|
|
149
|
+
- [core] Clarify the scope of the license key used for tests and documentation (#5824) @oliviertassinari
|
|
150
|
+
- [core] Fix Typescript error on field hooks (#5892) @flaviendelangle
|
|
151
|
+
- [core] Memoize `columns` in `useDemoData` hook (#5848) @cherniavskii
|
|
152
|
+
- [core] Remove Firefox from the BrowserStack list (#5874) @DanailH
|
|
153
|
+
- [core] Small changes to the release script (#5840) @m4theushw
|
|
154
|
+
|
|
6
155
|
## 5.15.3
|
|
7
156
|
|
|
8
157
|
_Aug 18, 2022_
|
|
@@ -529,7 +678,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
529
678
|
|
|
530
679
|
**MonthPicker**: The prop `onMonthChange` has been removed, you can use `onChange` instead since every change is a month change
|
|
531
680
|
|
|
532
|
-
**YearPicker**: The prop `
|
|
681
|
+
**YearPicker**: The prop `onYearChange` has been removed, you can use `onChange` instead since every change is a year change
|
|
533
682
|
|
|
534
683
|
**DayPicker**: The prop `isDateDisabled` has been removed, you can now use the same validation props as for the other components (`maxDate`, `minDate`, `shouldDisableDate`, `disableFuture` and `disablePast`)
|
|
535
684
|
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -79,6 +79,7 @@ DataGridRaw.propTypes = {
|
|
|
79
79
|
* @default 3
|
|
80
80
|
*/
|
|
81
81
|
columnBuffer: PropTypes.number,
|
|
82
|
+
columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
|
|
82
83
|
|
|
83
84
|
/**
|
|
84
85
|
* Set of columns of type [[GridColumns]].
|
|
@@ -194,6 +195,7 @@ DataGridRaw.propTypes = {
|
|
|
194
195
|
* For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
|
|
195
196
|
*/
|
|
196
197
|
experimentalFeatures: PropTypes.shape({
|
|
198
|
+
columnGrouping: PropTypes.bool,
|
|
197
199
|
newEditingApi: PropTypes.bool,
|
|
198
200
|
preventCommitWhileValidating: PropTypes.bool,
|
|
199
201
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
@@ -25,6 +25,8 @@ import { useGridDimensions } from '../hooks/features/dimensions/useGridDimension
|
|
|
25
25
|
import { rowsMetaStateInitializer, useGridRowsMeta } from '../hooks/features/rows/useGridRowsMeta';
|
|
26
26
|
import { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
27
27
|
import { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
|
|
28
|
+
import { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
29
|
+
import { useGridColumnGroupingPreProcessors } from '../hooks/features/columnGrouping/useGridColumnGroupingPreProcessors';
|
|
28
30
|
export const useDataGridComponent = props => {
|
|
29
31
|
var _props$experimentalFe, _props$experimentalFe2;
|
|
30
32
|
|
|
@@ -33,6 +35,7 @@ export const useDataGridComponent = props => {
|
|
|
33
35
|
* Register all pre-processors called during state initialization here.
|
|
34
36
|
*/
|
|
35
37
|
|
|
38
|
+
useGridColumnGroupingPreProcessors(apiRef, props);
|
|
36
39
|
useGridSelectionPreProcessors(apiRef, props);
|
|
37
40
|
useGridRowsPreProcessors(apiRef);
|
|
38
41
|
/**
|
|
@@ -41,6 +44,7 @@ export const useDataGridComponent = props => {
|
|
|
41
44
|
|
|
42
45
|
useGridInitializeState(selectionStateInitializer, apiRef, props);
|
|
43
46
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
47
|
+
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
44
48
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
45
49
|
useGridInitializeState((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? editingStateInitializer_new : editingStateInitializer_old, apiRef, props);
|
|
46
50
|
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
@@ -57,6 +61,7 @@ export const useDataGridComponent = props => {
|
|
|
57
61
|
useGridRows(apiRef, props);
|
|
58
62
|
useGridParamsApi(apiRef);
|
|
59
63
|
useGridColumnSpanning(apiRef);
|
|
64
|
+
useGridColumnGrouping(apiRef, props);
|
|
60
65
|
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
61
66
|
useGridEditing(apiRef, props);
|
|
62
67
|
useGridFocus(apiRef, props);
|
|
@@ -18,7 +18,8 @@ export const DataGridColumnHeaders = /*#__PURE__*/React.forwardRef(function Grid
|
|
|
18
18
|
isDragging,
|
|
19
19
|
getRootProps,
|
|
20
20
|
getInnerProps,
|
|
21
|
-
|
|
21
|
+
getColumnHeaders,
|
|
22
|
+
getColumnGroupHeaders
|
|
22
23
|
} = useGridColumnHeaders({
|
|
23
24
|
innerRef
|
|
24
25
|
});
|
|
@@ -27,10 +28,10 @@ export const DataGridColumnHeaders = /*#__PURE__*/React.forwardRef(function Grid
|
|
|
27
28
|
}, getRootProps(other), {
|
|
28
29
|
children: [/*#__PURE__*/_jsx(GridScrollArea, {
|
|
29
30
|
scrollDirection: "left"
|
|
30
|
-
}), /*#__PURE__*/
|
|
31
|
+
}), /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
|
|
31
32
|
isDragging: isDragging
|
|
32
33
|
}, getInnerProps(), {
|
|
33
|
-
children:
|
|
34
|
+
children: [getColumnGroupHeaders(), getColumnHeaders()]
|
|
34
35
|
})), /*#__PURE__*/_jsx(GridScrollArea, {
|
|
35
36
|
scrollDirection: "right"
|
|
36
37
|
})]
|
package/components/GridRow.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export interface GridRowProps {
|
|
|
13
13
|
index: number;
|
|
14
14
|
rowHeight: number | 'auto';
|
|
15
15
|
containerWidth: number;
|
|
16
|
-
row: GridRowModel;
|
|
17
16
|
firstColumnToRender: number;
|
|
18
17
|
lastColumnToRender: number;
|
|
19
18
|
visibleColumns: GridStateColDef[];
|
|
@@ -21,6 +20,8 @@ export interface GridRowProps {
|
|
|
21
20
|
cellFocus: GridCellIdentifier | null;
|
|
22
21
|
cellTabIndex: GridCellIdentifier | null;
|
|
23
22
|
editRowsState: GridEditRowsModel;
|
|
23
|
+
position: 'left' | 'center' | 'right';
|
|
24
|
+
row?: GridRowModel;
|
|
24
25
|
isLastVisible?: boolean;
|
|
25
26
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
26
27
|
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
|
package/components/GridRow.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
4
|
-
|
|
5
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
6
|
-
|
|
7
|
-
/* eslint-disable jsx-a11y/interactive-supports-focus */
|
|
3
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
8
4
|
import * as React from 'react';
|
|
9
5
|
import PropTypes from 'prop-types';
|
|
10
6
|
import clsx from 'clsx';
|
|
@@ -22,6 +18,8 @@ import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
|
22
18
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
23
19
|
import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
|
|
24
20
|
import { gridRowTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
21
|
+
import { gridDensityHeaderGroupingMaxDepthSelector } from '../hooks/features/density/densitySelector';
|
|
22
|
+
import { randomNumberBetween } from '../utils/utils';
|
|
25
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
25
|
|
|
@@ -65,6 +63,7 @@ function GridRow(props) {
|
|
|
65
63
|
row,
|
|
66
64
|
index,
|
|
67
65
|
style: styleProp,
|
|
66
|
+
position,
|
|
68
67
|
rowHeight,
|
|
69
68
|
className,
|
|
70
69
|
visibleColumns,
|
|
@@ -82,8 +81,6 @@ function GridRow(props) {
|
|
|
82
81
|
} = props,
|
|
83
82
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
84
83
|
|
|
85
|
-
const ariaRowIndex = index + 2; // 1 for the header row and 1 as it's 1-based
|
|
86
|
-
|
|
87
84
|
const apiRef = useGridApiContext();
|
|
88
85
|
const ref = React.useRef(null);
|
|
89
86
|
const rootProps = useGridRootProps();
|
|
@@ -91,6 +88,9 @@ function GridRow(props) {
|
|
|
91
88
|
const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
92
89
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
93
90
|
const treeDepth = useGridSelector(apiRef, gridRowTreeDepthSelector);
|
|
91
|
+
const headerGroupingMaxDepth = useGridSelector(apiRef, gridDensityHeaderGroupingMaxDepthSelector);
|
|
92
|
+
const ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
93
|
+
|
|
94
94
|
const {
|
|
95
95
|
hasScrollX,
|
|
96
96
|
hasScrollY
|
|
@@ -110,9 +110,9 @@ function GridRow(props) {
|
|
|
110
110
|
React.useLayoutEffect(() => {
|
|
111
111
|
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
112
112
|
// Fallback for IE
|
|
113
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
113
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight, position);
|
|
114
114
|
}
|
|
115
|
-
}, [apiRef, rowHeight, rowId]);
|
|
115
|
+
}, [apiRef, rowHeight, rowId, position]);
|
|
116
116
|
React.useLayoutEffect(() => {
|
|
117
117
|
if (currentPage.range) {
|
|
118
118
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -137,11 +137,11 @@ function GridRow(props) {
|
|
|
137
137
|
const resizeObserver = new ResizeObserver(entries => {
|
|
138
138
|
const [entry] = entries;
|
|
139
139
|
const height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
140
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
|
|
140
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height, position);
|
|
141
141
|
});
|
|
142
142
|
resizeObserver.observe(rootElement);
|
|
143
143
|
return () => resizeObserver.disconnect();
|
|
144
|
-
}, [apiRef, currentPage.range, index, rowHeight, rowId]);
|
|
144
|
+
}, [apiRef, currentPage.range, index, rowHeight, rowId, position]);
|
|
145
145
|
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
146
146
|
// Ignore portal
|
|
147
147
|
// The target is not an element when triggered by a Select inside the cell
|
|
@@ -197,47 +197,9 @@ function GridRow(props) {
|
|
|
197
197
|
|
|
198
198
|
publish('rowClick', onClick)(event);
|
|
199
199
|
}, [apiRef, onClick, publish, rowId]);
|
|
200
|
+
const getCell = React.useCallback((column, cellProps) => {
|
|
201
|
+
var _rootProps$components;
|
|
200
202
|
|
|
201
|
-
const style = _extends({}, styleProp, {
|
|
202
|
-
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
203
|
-
// max-height doesn't support "auto"
|
|
204
|
-
minHeight: rowHeight
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
208
|
-
|
|
209
|
-
if (sizes != null && sizes.spacingTop) {
|
|
210
|
-
const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
211
|
-
style[property] = sizes.spacingTop;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (sizes != null && sizes.spacingBottom) {
|
|
215
|
-
const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
216
|
-
style[property] = sizes.spacingBottom;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
let rowClassName = null;
|
|
220
|
-
|
|
221
|
-
if (typeof rootProps.getRowClassName === 'function') {
|
|
222
|
-
const indexRelativeToCurrentPage = index - currentPage.range.firstRowIndex;
|
|
223
|
-
|
|
224
|
-
const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
225
|
-
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
226
|
-
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
227
|
-
indexRelativeToCurrentPage
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
rowClassName = rootProps.getRowClassName(rowParams);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
const cells = [];
|
|
234
|
-
|
|
235
|
-
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
236
|
-
const column = renderedColumns[i];
|
|
237
|
-
const indexRelativeToAllColumns = firstColumnToRender + i;
|
|
238
|
-
const isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
239
|
-
const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
240
|
-
const showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
241
203
|
const cellParams = apiRef.current.getCellParams(rowId, column.field);
|
|
242
204
|
const classNames = [];
|
|
243
205
|
const disableDragEvents = rootProps.disableColumnReorder && column.disableReorder || !rootProps.rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
|
|
@@ -287,53 +249,141 @@ function GridRow(props) {
|
|
|
287
249
|
|
|
288
250
|
const hasFocus = cellFocus !== null && cellFocus.id === rowId && cellFocus.field === column.field;
|
|
289
251
|
const tabIndex = cellTabIndex !== null && cellTabIndex.id === rowId && cellTabIndex.field === column.field && cellParams.cellMode === 'view' ? 0 : -1;
|
|
252
|
+
return /*#__PURE__*/_jsx(rootProps.components.Cell, _extends({
|
|
253
|
+
value: cellParams.value,
|
|
254
|
+
field: column.field,
|
|
255
|
+
width: cellProps.width,
|
|
256
|
+
rowId: rowId,
|
|
257
|
+
height: rowHeight,
|
|
258
|
+
showRightBorder: cellProps.showRightBorder,
|
|
259
|
+
formattedValue: cellParams.formattedValue,
|
|
260
|
+
align: column.align || 'left',
|
|
261
|
+
cellMode: cellParams.cellMode,
|
|
262
|
+
colIndex: cellProps.indexRelativeToAllColumns,
|
|
263
|
+
isEditable: cellParams.isEditable,
|
|
264
|
+
hasFocus: hasFocus,
|
|
265
|
+
tabIndex: tabIndex,
|
|
266
|
+
className: clsx(classNames),
|
|
267
|
+
colSpan: cellProps.colSpan,
|
|
268
|
+
disableDragEvents: disableDragEvents
|
|
269
|
+
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
|
|
270
|
+
children: content
|
|
271
|
+
}), column.field);
|
|
272
|
+
}, [apiRef, cellTabIndex, editRowsState, cellFocus, rootProps, row, rowHeight, rowId, treeDepth, sortModel.length]);
|
|
273
|
+
const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
274
|
+
let minHeight = rowHeight;
|
|
275
|
+
|
|
276
|
+
if (minHeight === 'auto' && sizes) {
|
|
277
|
+
let numberOfBaseSizes = 0;
|
|
278
|
+
const maximumSize = Object.entries(sizes).reduce((acc, [key, size]) => {
|
|
279
|
+
const isBaseHeight = /^base[A-Z]/.test(key);
|
|
280
|
+
|
|
281
|
+
if (!isBaseHeight) {
|
|
282
|
+
return acc;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
numberOfBaseSizes += 1;
|
|
286
|
+
|
|
287
|
+
if (size > acc) {
|
|
288
|
+
return size;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return acc;
|
|
292
|
+
}, 0);
|
|
293
|
+
|
|
294
|
+
if (maximumSize > 0 && numberOfBaseSizes > 1) {
|
|
295
|
+
minHeight = maximumSize;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
const style = _extends({}, styleProp, {
|
|
300
|
+
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
301
|
+
// max-height doesn't support "auto"
|
|
302
|
+
minHeight
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
if (sizes != null && sizes.spacingTop) {
|
|
306
|
+
const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
307
|
+
style[property] = sizes.spacingTop;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (sizes != null && sizes.spacingBottom) {
|
|
311
|
+
const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
312
|
+
style[property] = sizes.spacingBottom;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
316
|
+
|
|
317
|
+
if (typeof rootProps.getRowClassName === 'function') {
|
|
318
|
+
var _currentPage$range;
|
|
319
|
+
|
|
320
|
+
const indexRelativeToCurrentPage = index - (((_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0);
|
|
321
|
+
|
|
322
|
+
const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
323
|
+
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
324
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
325
|
+
indexRelativeToCurrentPage
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const randomNumber = randomNumberBetween(10000, 20, 80);
|
|
332
|
+
const cells = [];
|
|
333
|
+
|
|
334
|
+
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
335
|
+
const column = renderedColumns[i];
|
|
336
|
+
const indexRelativeToAllColumns = firstColumnToRender + i;
|
|
337
|
+
const isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
338
|
+
const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
339
|
+
const showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
290
340
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
291
341
|
|
|
292
342
|
if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
}
|
|
317
|
-
children: content
|
|
318
|
-
}), column.field));
|
|
343
|
+
if (row) {
|
|
344
|
+
const {
|
|
345
|
+
colSpan,
|
|
346
|
+
width
|
|
347
|
+
} = cellColSpanInfo.cellProps;
|
|
348
|
+
const cellProps = {
|
|
349
|
+
width,
|
|
350
|
+
colSpan,
|
|
351
|
+
showRightBorder,
|
|
352
|
+
indexRelativeToAllColumns
|
|
353
|
+
};
|
|
354
|
+
cells.push(getCell(column, cellProps));
|
|
355
|
+
} else {
|
|
356
|
+
const {
|
|
357
|
+
width
|
|
358
|
+
} = cellColSpanInfo.cellProps;
|
|
359
|
+
const contentWidth = Math.round(randomNumber());
|
|
360
|
+
cells.push( /*#__PURE__*/_jsx(rootProps.components.SkeletonCell, {
|
|
361
|
+
width: width,
|
|
362
|
+
contentWidth: contentWidth,
|
|
363
|
+
field: column.field,
|
|
364
|
+
align: column.align
|
|
365
|
+
}, column.field));
|
|
366
|
+
}
|
|
319
367
|
}
|
|
320
368
|
}
|
|
321
369
|
|
|
322
370
|
const emptyCellWidth = containerWidth - columnsTotalWidth;
|
|
371
|
+
const eventHandlers = row ? {
|
|
372
|
+
onClick: publishClick,
|
|
373
|
+
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
374
|
+
onMouseEnter: publish('rowMouseEnter', onMouseEnter),
|
|
375
|
+
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
376
|
+
} : null;
|
|
323
377
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
324
378
|
ref: ref,
|
|
325
379
|
"data-id": rowId,
|
|
326
380
|
"data-rowindex": index,
|
|
327
381
|
role: "row",
|
|
328
|
-
className: clsx(
|
|
382
|
+
className: clsx(...rowClassNames, classes.root, className),
|
|
329
383
|
"aria-rowindex": ariaRowIndex,
|
|
330
384
|
"aria-selected": selected,
|
|
331
|
-
style: style
|
|
332
|
-
|
|
333
|
-
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
334
|
-
onMouseEnter: publish('rowMouseEnter', onMouseEnter),
|
|
335
|
-
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
336
|
-
}, other, {
|
|
385
|
+
style: style
|
|
386
|
+
}, eventHandlers, other, {
|
|
337
387
|
children: [cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
|
|
338
388
|
width: emptyCellWidth
|
|
339
389
|
})]
|
|
@@ -358,8 +408,9 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
358
408
|
index: PropTypes.number.isRequired,
|
|
359
409
|
isLastVisible: PropTypes.bool,
|
|
360
410
|
lastColumnToRender: PropTypes.number.isRequired,
|
|
411
|
+
position: PropTypes.oneOf(['center', 'left', 'right']).isRequired,
|
|
361
412
|
renderedColumns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
362
|
-
row: PropTypes.
|
|
413
|
+
row: PropTypes.object,
|
|
363
414
|
rowHeight: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
|
|
364
415
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
365
416
|
selected: PropTypes.bool.isRequired,
|
|
@@ -6,7 +6,7 @@ import { GridAutoSizer } from '../GridAutoSizer';
|
|
|
6
6
|
import { GridOverlays } from './GridOverlays';
|
|
7
7
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
8
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
9
|
-
import {
|
|
9
|
+
import { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
|
|
@@ -18,14 +18,17 @@ function GridBody(props) {
|
|
|
18
18
|
} = props;
|
|
19
19
|
const apiRef = useGridApiContext();
|
|
20
20
|
const rootProps = useGridRootProps();
|
|
21
|
-
const
|
|
21
|
+
const totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);
|
|
22
22
|
const [isVirtualizationDisabled, setIsVirtualizationDisabled] = React.useState(rootProps.disableVirtualization);
|
|
23
23
|
const disableVirtualization = React.useCallback(() => {
|
|
24
24
|
setIsVirtualizationDisabled(true);
|
|
25
25
|
}, []);
|
|
26
26
|
const enableVirtualization = React.useCallback(() => {
|
|
27
27
|
setIsVirtualizationDisabled(false);
|
|
28
|
-
}, []);
|
|
28
|
+
}, []);
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
setIsVirtualizationDisabled(rootProps.disableVirtualization);
|
|
31
|
+
}, [rootProps.disableVirtualization]); // The `useGridApiMethod` hook can't be used here, because it only installs the
|
|
29
32
|
// method if it doesn't exist yet. Once installed, it's never updated again.
|
|
30
33
|
// This break the methods above, since their closure comes from the first time
|
|
31
34
|
// they were installed. Which means that calling `setIsVirtualizationDisabled`
|
|
@@ -60,8 +63,8 @@ function GridBody(props) {
|
|
|
60
63
|
width: size.width,
|
|
61
64
|
// If `autoHeight` is on, there will be no height value.
|
|
62
65
|
// In this case, let the container to grow whatever it needs.
|
|
63
|
-
height: size.height ? size.height -
|
|
64
|
-
marginTop:
|
|
66
|
+
height: size.height ? size.height - totalHeaderHeight : 'auto',
|
|
67
|
+
marginTop: totalHeaderHeight
|
|
65
68
|
};
|
|
66
69
|
return /*#__PURE__*/_jsx(VirtualScrollerComponent, {
|
|
67
70
|
ref: windowRef,
|
|
@@ -6,7 +6,7 @@ import { gridVisibleRowCountSelector } from '../../hooks/features/filter/gridFil
|
|
|
6
6
|
import { gridRowCountSelector, gridRowsLoadingSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
7
7
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
8
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
|
-
import {
|
|
9
|
+
import { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
|
|
12
12
|
function GridOverlayWrapper(props) {
|
|
@@ -14,7 +14,7 @@ function GridOverlayWrapper(props) {
|
|
|
14
14
|
|
|
15
15
|
const apiRef = useGridApiContext();
|
|
16
16
|
const rootProps = useGridRootProps();
|
|
17
|
-
const
|
|
17
|
+
const totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);
|
|
18
18
|
const [viewportInnerSize, setViewportInnerSize] = React.useState(() => {
|
|
19
19
|
var _apiRef$current$getRo, _apiRef$current$getRo2;
|
|
20
20
|
|
|
@@ -43,7 +43,7 @@ function GridOverlayWrapper(props) {
|
|
|
43
43
|
height,
|
|
44
44
|
width: (_viewportInnerSize$wi = viewportInnerSize == null ? void 0 : viewportInnerSize.width) != null ? _viewportInnerSize$wi : 0,
|
|
45
45
|
position: 'absolute',
|
|
46
|
-
top:
|
|
46
|
+
top: totalHeaderHeight,
|
|
47
47
|
bottom: height === 'auto' ? 0 : undefined
|
|
48
48
|
}
|
|
49
49
|
}, props));
|
|
@@ -123,7 +123,8 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
123
123
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
|
-
* The cell value
|
|
126
|
+
* The cell value.
|
|
127
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
127
128
|
*/
|
|
128
129
|
value: PropTypes.any
|
|
129
130
|
} : void 0;
|
|
@@ -98,6 +98,14 @@ function GridCell(props) {
|
|
|
98
98
|
onMouseUp(event);
|
|
99
99
|
}
|
|
100
100
|
}, [apiRef, field, onMouseUp, rowId]);
|
|
101
|
+
const publishMouseDown = React.useCallback(eventName => event => {
|
|
102
|
+
const params = apiRef.current.getCellParams(rowId, field || '');
|
|
103
|
+
apiRef.current.publishEvent(eventName, params, event);
|
|
104
|
+
|
|
105
|
+
if (onMouseDown) {
|
|
106
|
+
onMouseDown(event);
|
|
107
|
+
}
|
|
108
|
+
}, [apiRef, field, onMouseDown, rowId]);
|
|
101
109
|
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
102
110
|
// Ignore portal
|
|
103
111
|
if (!event.currentTarget.contains(event.target)) {
|
|
@@ -202,7 +210,7 @@ function GridCell(props) {
|
|
|
202
210
|
tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
|
|
203
211
|
onClick: publish('cellClick', onClick),
|
|
204
212
|
onDoubleClick: publish('cellDoubleClick', onDoubleClick),
|
|
205
|
-
onMouseDown:
|
|
213
|
+
onMouseDown: publishMouseDown('cellMouseDown'),
|
|
206
214
|
onMouseUp: publishMouseUp('cellMouseUp'),
|
|
207
215
|
onKeyDown: publish('cellKeyDown', onKeyDown)
|
|
208
216
|
}, draggableEventHandlers, other, {
|