@mui/x-data-grid-pro 6.4.0 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +134 -2
- package/DataGridPro/DataGridPro.js +15 -3
- package/DataGridPro/useDataGridProComponent.js +3 -1
- package/DataGridPro/useDataGridProProps.js +7 -13
- package/README.md +2 -2
- package/components/DataGridProVirtualScroller.js +12 -12
- package/components/GridColumnHeaders.js +23 -3
- package/components/GridColumnMenuPinningItem.d.ts +2 -2
- package/components/GridDetailPanel.d.ts +1 -1
- package/components/GridDetailPanel.js +1 -1
- package/components/GridDetailPanelToggleCell.d.ts +2 -2
- package/components/GridRowReorderCell.d.ts +3 -3
- package/components/GridScrollArea.d.ts +10 -0
- package/components/GridScrollArea.js +140 -0
- package/components/GridTreeDataGroupingCell.d.ts +2 -2
- package/components/headerFiltering/GridHeaderFilterAdornment.d.ts +14 -0
- package/components/headerFiltering/GridHeaderFilterAdornment.js +99 -0
- package/components/headerFiltering/GridHeaderFilterCell.d.ts +20 -0
- package/components/headerFiltering/GridHeaderFilterCell.js +224 -0
- package/components/headerFiltering/GridHeaderFilterClearButton.d.ts +6 -0
- package/components/headerFiltering/GridHeaderFilterClearButton.js +25 -0
- package/components/headerFiltering/GridHeaderFilterMenu.d.ts +14 -0
- package/components/headerFiltering/GridHeaderFilterMenu.js +69 -0
- package/components/headerFiltering/constants.d.ts +3 -0
- package/components/headerFiltering/constants.js +30 -0
- package/components/headerFiltering/index.d.ts +2 -0
- package/components/headerFiltering/index.js +2 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +2 -1
- package/constants/dataGridProDefaultSlotsComponents.js +5 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +21 -0
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +111 -0
- package/hooks/features/columnResize/useGridColumnResize.js +23 -13
- package/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
- package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -0
- package/hooks/features/treeData/gridTreeDataUtils.js +0 -8
- package/hooks/features/treeData/useGridTreeDataPreProcessors.js +3 -0
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +5 -1
- package/legacy/DataGridPro/DataGridPro.js +15 -3
- package/legacy/DataGridPro/useDataGridProComponent.js +3 -1
- package/legacy/DataGridPro/useDataGridProProps.js +10 -9
- package/legacy/components/DataGridProVirtualScroller.js +12 -12
- package/legacy/components/GridColumnHeaders.js +23 -3
- package/legacy/components/GridDetailPanel.js +1 -1
- package/legacy/components/GridScrollArea.js +143 -0
- package/legacy/components/headerFiltering/GridHeaderFilterAdornment.js +97 -0
- package/legacy/components/headerFiltering/GridHeaderFilterCell.js +230 -0
- package/legacy/components/headerFiltering/GridHeaderFilterClearButton.js +24 -0
- package/legacy/components/headerFiltering/GridHeaderFilterMenu.js +68 -0
- package/legacy/components/headerFiltering/constants.js +30 -0
- package/legacy/components/headerFiltering/index.js +2 -0
- package/legacy/components/index.js +2 -1
- package/legacy/constants/dataGridProDefaultSlotsComponents.js +5 -1
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +120 -0
- package/legacy/hooks/features/columnResize/useGridColumnResize.js +23 -13
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
- package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -0
- package/legacy/hooks/features/treeData/gridTreeDataUtils.js +0 -8
- package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +3 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +5 -1
- package/legacy/material/icons.js +4 -1
- package/legacy/material/index.js +3 -2
- package/legacy/models/gridProSlotProps.js +1 -0
- package/legacy/utils/releaseInfo.js +1 -1
- package/legacy/utils/tree/createRowTree.js +1 -0
- package/legacy/utils/tree/insertDataRowInTree.js +4 -0
- package/legacy/utils/tree/removeDataRowFromTree.js +1 -0
- package/legacy/utils/tree/updateRowTree.js +2 -0
- package/legacy/utils/tree/utils.js +51 -12
- package/material/icons.d.ts +3 -0
- package/material/icons.js +4 -1
- package/material/index.d.ts +1 -0
- package/material/index.js +3 -2
- package/models/dataGridProProps.d.ts +16 -1
- package/models/gridProIconSlotsComponent.d.ts +5 -0
- package/models/gridProSlotProps.d.ts +9 -0
- package/models/gridProSlotProps.js +1 -0
- package/models/gridProSlotsComponent.d.ts +13 -2
- package/modern/DataGridPro/DataGridPro.js +15 -3
- package/modern/DataGridPro/useDataGridProComponent.js +3 -1
- package/modern/DataGridPro/useDataGridProProps.js +7 -13
- package/modern/components/DataGridProVirtualScroller.js +12 -12
- package/modern/components/GridColumnHeaders.js +23 -3
- package/modern/components/GridDetailPanel.js +1 -1
- package/modern/components/GridScrollArea.js +140 -0
- package/modern/components/headerFiltering/GridHeaderFilterAdornment.js +98 -0
- package/modern/components/headerFiltering/GridHeaderFilterCell.js +222 -0
- package/modern/components/headerFiltering/GridHeaderFilterClearButton.js +24 -0
- package/modern/components/headerFiltering/GridHeaderFilterMenu.js +68 -0
- package/modern/components/headerFiltering/constants.js +30 -0
- package/modern/components/headerFiltering/index.js +2 -0
- package/modern/components/index.js +2 -1
- package/modern/constants/dataGridProDefaultSlotsComponents.js +5 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +110 -0
- package/modern/hooks/features/columnResize/useGridColumnResize.js +22 -12
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
- package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -0
- package/modern/hooks/features/treeData/gridTreeDataUtils.js +0 -8
- package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +3 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +5 -1
- package/modern/material/icons.js +4 -1
- package/modern/material/index.js +3 -2
- package/modern/models/gridProSlotProps.js +1 -0
- package/modern/utils/releaseInfo.js +1 -1
- package/modern/utils/tree/createRowTree.js +1 -0
- package/modern/utils/tree/insertDataRowInTree.js +4 -0
- package/modern/utils/tree/removeDataRowFromTree.js +1 -0
- package/modern/utils/tree/updateRowTree.js +2 -0
- package/modern/utils/tree/utils.js +52 -14
- package/node/DataGridPro/DataGridPro.js +15 -3
- package/node/DataGridPro/useDataGridProComponent.js +2 -0
- package/node/DataGridPro/useDataGridProProps.js +6 -12
- package/node/components/DataGridProVirtualScroller.js +12 -12
- package/node/components/GridColumnHeaders.js +22 -3
- package/node/components/GridDetailPanel.js +2 -2
- package/node/components/GridScrollArea.js +149 -0
- package/node/components/headerFiltering/GridHeaderFilterAdornment.js +105 -0
- package/node/components/headerFiltering/GridHeaderFilterCell.js +230 -0
- package/node/components/headerFiltering/GridHeaderFilterClearButton.js +32 -0
- package/node/components/headerFiltering/GridHeaderFilterMenu.js +75 -0
- package/node/components/headerFiltering/constants.js +37 -0
- package/node/components/headerFiltering/index.js +27 -0
- package/node/components/index.js +11 -0
- package/node/constants/dataGridProDefaultSlotsComponents.js +5 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +120 -0
- package/node/hooks/features/columnResize/useGridColumnResize.js +22 -12
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +4 -6
- package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -0
- package/node/hooks/features/treeData/gridTreeDataUtils.js +0 -8
- package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +3 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +16 -1
- package/node/material/icons.js +6 -2
- package/node/material/index.js +2 -1
- package/node/models/gridProSlotProps.js +5 -0
- package/node/utils/releaseInfo.js +1 -1
- package/node/utils/tree/createRowTree.js +1 -0
- package/node/utils/tree/insertDataRowInTree.js +4 -0
- package/node/utils/tree/removeDataRowFromTree.js +1 -0
- package/node/utils/tree/updateRowTree.js +2 -0
- package/node/utils/tree/utils.js +54 -15
- package/package.json +6 -6
- package/typeOverloads/modules.d.ts +13 -1
- package/utils/releaseInfo.js +1 -1
- package/utils/tree/createRowTree.d.ts +2 -0
- package/utils/tree/createRowTree.js +1 -0
- package/utils/tree/insertDataRowInTree.d.ts +5 -1
- package/utils/tree/insertDataRowInTree.js +4 -0
- package/utils/tree/removeDataRowFromTree.js +1 -0
- package/utils/tree/updateRowTree.js +2 -0
- package/utils/tree/utils.d.ts +9 -3
- package/utils/tree/utils.js +52 -14
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,138 @@
|
|
|
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
|
+
## 6.6.0
|
|
7
|
+
|
|
8
|
+
_Jun 1, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🚀 New date time picking UI on [`DesktopDateTimePicker`](https://mui.com/x/react-date-pickers/date-time-picker/)
|
|
13
|
+
|
|
14
|
+
<img src="https://user-images.githubusercontent.com/4941090/242533399-2b106390-8158-4aba-9ca4-b621c6310977.gif" width="628" />
|
|
15
|
+
|
|
16
|
+
- 🚀 Performance improvements
|
|
17
|
+
- 🐞 Bugfixes
|
|
18
|
+
- 📚 Documentation improvements
|
|
19
|
+
- 🌍 Improve Dutch (nl-NL) and French (fr-FR) locales on the data grid
|
|
20
|
+
- 🌍 Add Vietnamese (vi-VN) locale on the pickers
|
|
21
|
+
|
|
22
|
+
### `@mui/x-data-grid@v6.6.0` / `@mui/x-data-grid-pro@v6.6.0` / `@mui/x-data-grid-premium@v6.6.0`
|
|
23
|
+
|
|
24
|
+
#### Changes
|
|
25
|
+
|
|
26
|
+
- [DataGrid] Support data attributes (#8845) @romgrk
|
|
27
|
+
- [DataGrid] Avoid allocations in `hydrateRowsMeta` (#9121) @romgrk
|
|
28
|
+
- [DataGrid] Fix filter input select accessibility (#9018) @Jul13nT
|
|
29
|
+
- [DataGrid] Fix accessibility issues in panels and toolbar buttons (#8862) @romgrk
|
|
30
|
+
- [DataGrid] Fix `onCellEditStop` not invoked (#8857) @romgrk
|
|
31
|
+
- [DataGridPro] Fix auto-scroll when reordering columns (#8856) @m4theushw
|
|
32
|
+
- [DataGridPro] Fix row ID type casting in detail panels lookup (#8976) @minchaej
|
|
33
|
+
- [DataGridPro] Emit `columnWidthChange` event on `touchEnd` of column resize (#8669) @MBilalShafi
|
|
34
|
+
- [DataGridPro] Do not apply filters on `rowExpansionChange` (#8671) @cherniavskii
|
|
35
|
+
- [DataGridPro] Prevent click event on sorting after a resize (#9117) @romgrk
|
|
36
|
+
- [DataGridPremium] Improve Excel export interface (#9128) @TiagoPortfolio
|
|
37
|
+
- [l10n] Improve Dutch (nl-NL) locale (#9043) @thedutchruben
|
|
38
|
+
- [l10n] Improve French (fr-FR) locale (#9109) @Jul13nT
|
|
39
|
+
|
|
40
|
+
### `@mui/x-date-pickers@v6.6.0` / `@mui/x-date-pickers-pro@v6.6.0`
|
|
41
|
+
|
|
42
|
+
#### Changes
|
|
43
|
+
|
|
44
|
+
- [fields] Allow to explicitly define the reference value and improve its default value (#9019) @flaviendelangle
|
|
45
|
+
- [l10n] Add Vietnamese (vi-VN) locale (#9099) @nhannt201
|
|
46
|
+
- [pickers] Add `DigitalClock` to `DesktopDateTimePicker` (#8946) @LukasTy
|
|
47
|
+
- [pickers] Add support for timezones on the adapters (#9068) @flaviendelangle
|
|
48
|
+
- [pickers] Fix `MonthCalendar` and `YearCalendar` disabled validation (#9149) @LukasTy
|
|
49
|
+
- [pickers] Fix bug when fields have a unique section (#9110) @alexfauquette
|
|
50
|
+
- [pickers] Fix focus jumping on Safari (#9072) @LukasTy
|
|
51
|
+
- [pickers] Use the locale start of the week in `getWeekArray` (#9176) @flaviendelangle
|
|
52
|
+
|
|
53
|
+
### Docs
|
|
54
|
+
|
|
55
|
+
- [docs] Add single input range picker demo (#9159) @LukasTy
|
|
56
|
+
- [docs] Align `DateCalendar` demo views with labels (#9152) @LukasTy
|
|
57
|
+
- [docs] Clarify the peer dependency with React (#9067) @oliviertassinari
|
|
58
|
+
- [docs] Fix Norwegian locale typo (#9168) @LukasTy
|
|
59
|
+
- [docs] Fix column menu item demo (#9071) @MBilalShafi
|
|
60
|
+
- [docs] Improve localization table progress bars (#9033) @noraleonte
|
|
61
|
+
- [docs] Smooth performance animation (#8986) @oliviertassinari
|
|
62
|
+
- [docs] Use responsive time and date time pickers and the views sections (#9127) @flaviendelangle
|
|
63
|
+
- [docs] Reduce layout shift in grid demo (#9132) @oliviertassinari
|
|
64
|
+
- [docs] Fix tree data children lazy-loading demo (#8840) @yaredtsy
|
|
65
|
+
- [docs] Improve filtering docs discoverability (#9074) @MBilalShafi
|
|
66
|
+
|
|
67
|
+
### Core
|
|
68
|
+
|
|
69
|
+
- [core] Allow string literals as keys in `localesText` (#9045) @MBilalShafi
|
|
70
|
+
- [core] Fix `randomInt` producing values exceeding `max` value (#9086) @cherniavskii
|
|
71
|
+
- [core] Fix flaky test on `dateWithTimezone` adapter test (#9129) @flaviendelangle
|
|
72
|
+
- [core] Lock `@types/node` on v18 (#9107) @LukasTy
|
|
73
|
+
- [core] Remove `cross-fetch` dependency (#9108) @LukasTy
|
|
74
|
+
- [core] Remove `createDetectElementResize()` replaced with `ResizeObserver` (#9015) @oliviertassinari
|
|
75
|
+
- [core] Upgrade monorepo (#9027) @m4theushw
|
|
76
|
+
- [core] Upgrade monorepo (#9106) @LukasTy
|
|
77
|
+
- [charts] Fix proptypes (#9125) @LukasTy
|
|
78
|
+
- [charts] Generate the charts proptypes (#9010) @alexfauquette
|
|
79
|
+
- [charts] Manage series stacking (#8888) @alexfauquette
|
|
80
|
+
- [license] List side effects in the license package (#9092) @cherniavskii
|
|
81
|
+
|
|
82
|
+
## v6.5.0
|
|
83
|
+
|
|
84
|
+
_May 19, 2023_
|
|
85
|
+
|
|
86
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
87
|
+
|
|
88
|
+
- 💫 Introduce filtering on column headers for `DataGridPro` and `DataGridPremium`:
|
|
89
|
+
|
|
90
|
+
https://github.com/mui/mui-x/assets/12609561/c4c2bfec-59cf-4cab-932d-dc1983081de9
|
|
91
|
+
|
|
92
|
+
See [the documentation](https://mui.com/x/react-data-grid/filtering/#header-filters) for more information
|
|
93
|
+
|
|
94
|
+
- 🌍 Improve Hebrew (he-IL) and Czech (cs-CZ) locales
|
|
95
|
+
- 📝 Support for editing on pinned rows
|
|
96
|
+
- 🚀 Performance improvements
|
|
97
|
+
- 🐞 Bugfixes
|
|
98
|
+
- 📚 Documentation improvements
|
|
99
|
+
|
|
100
|
+
### `@mui/x-data-grid@6.5.0` / `@mui/x-data-grid-pro@6.5.0` / `@mui/x-data-grid-premium@6.5.0`
|
|
101
|
+
|
|
102
|
+
#### Changes
|
|
103
|
+
|
|
104
|
+
- [DataGrid] Fix grid size calculation when `.MuiDataGrid-main` has border (#8882) @cherniavskii
|
|
105
|
+
- [DataGridPro] Filtering on Column Header (#7760) @MBilalShafi
|
|
106
|
+
- [DataGridPro] Improve `treeData` and `rowGrouping` performance (#8990) @MBilalShafi
|
|
107
|
+
- [DataGridPro] Support pinned rows editing (#8921) @cherniavskii
|
|
108
|
+
- [l10n] Improve Hebrew (he-IL) locale (#8943) @Itzik-Tech
|
|
109
|
+
- [l10n] Improve Czech (cs-CZ) locale (#8829) @harastaivan
|
|
110
|
+
- [l10n] Improve Czech (cs-CZ) locale (#8956) @davidzemancz
|
|
111
|
+
|
|
112
|
+
### `@mui/x-date-pickers@6.5.0` / `@mui/x-date-pickers-pro@6.5.0`
|
|
113
|
+
|
|
114
|
+
#### Changes
|
|
115
|
+
|
|
116
|
+
- [fields] Select the first section instead of last when clicking right of content (#9005) @noraleonte
|
|
117
|
+
- [fields] Refactor prop drilling in fields (#8660) @flaviendelangle
|
|
118
|
+
- [pickers] Allow to render the months before `currentMonth` instead of the one after (#8592) @flaviendelangle
|
|
119
|
+
- [pickers] Fix view management when `openTo` or `views` is modified (#8997) @alexfauquette
|
|
120
|
+
- [l10n] Improve Czech (cs-CZ) locale (#8829) @harastaivan
|
|
121
|
+
|
|
122
|
+
### Docs
|
|
123
|
+
|
|
124
|
+
- [docs] Clarify what Controlled / Uncontrolled means (#8926) @flaviendelangle
|
|
125
|
+
- [docs] Fix docs using wrong service worker (#9030) @cherniavskii
|
|
126
|
+
- [docs] Remove prop-types from JS demos (#9008) @flaviendelangle
|
|
127
|
+
|
|
128
|
+
### Core
|
|
129
|
+
|
|
130
|
+
- [core] Add assertion about checkbox rerenders (#8974) @oliviertassinari
|
|
131
|
+
- [core] Allow selecting a section by type in field tests (#9009) @flaviendelangle
|
|
132
|
+
- [core] Fix `yarn.lock` (#8988) @flaviendelangle
|
|
133
|
+
- [core] Fix flacky adapter test (#8995) @flaviendelangle
|
|
134
|
+
- [charts] Clean the axis rendering (#8948) @alexfauquette
|
|
135
|
+
- [DataGrid] Memoize root props for better performance (#8942) @romgrk
|
|
136
|
+
- [test] Skip flaky unit tests in JSDOM (#8994) @cherniavskii
|
|
137
|
+
|
|
6
138
|
## v6.4.0
|
|
7
139
|
|
|
8
140
|
_May 12, 2023_
|
|
@@ -46,7 +178,7 @@ We'd like to offer a big thanks to the 12 contributors who made this release pos
|
|
|
46
178
|
|
|
47
179
|
### Docs
|
|
48
180
|
|
|
49
|
-
- [docs] Fix date pickers typo in the docs
|
|
181
|
+
- [docs] Fix date pickers typo in the docs (#8939) @richbustos
|
|
50
182
|
- [docs] Fix master detail demo (#8894) @m4theushw
|
|
51
183
|
- [docs] Fix typo in clipboard docs (#8971) @MBilalShafi
|
|
52
184
|
- [docs] Reduce list of dependencies in Codesandbox/Stackblitz demos (#8535) @cherniavskii
|
|
@@ -4384,7 +4516,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
|
|
|
4384
4516
|
|
|
4385
4517
|
- 👔 **Excel export**. You can find this new Premium feature at: https://mui.com/x/react-data-grid/export/#excel-export.
|
|
4386
4518
|
|
|
4387
|
-
- 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering
|
|
4519
|
+
- 🔎 **Quick filtering**. You can now add a quick filtering search bar to your grid. To do so, either pass `showQuickFilter` prop to the `<GridToolbar />` or use the `<GridToolbarQuickFilter />` component in your custom toolbar. More information about how to customize the filtering logic is in the [documentation](https://mui.com/x/react-data-grid/filtering/quick-filter/).
|
|
4388
4520
|
|
|
4389
4521
|
<img src="https://user-images.githubusercontent.com/13808724/167700105-5a5acc7c-5463-4871-8514-3d09e2f365ae.png" width="724">
|
|
4390
4522
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
|
|
@@ -19,11 +20,12 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
|
|
|
19
20
|
return /*#__PURE__*/_jsx(GridContextProvider, {
|
|
20
21
|
privateApiRef: privateApiRef,
|
|
21
22
|
props: props,
|
|
22
|
-
children: /*#__PURE__*/_jsxs(GridRoot, {
|
|
23
|
+
children: /*#__PURE__*/_jsxs(GridRoot, _extends({
|
|
23
24
|
className: props.className,
|
|
24
25
|
style: props.style,
|
|
25
26
|
sx: props.sx,
|
|
26
|
-
ref: ref
|
|
27
|
+
ref: ref
|
|
28
|
+
}, props.forwardedProps, {
|
|
27
29
|
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
|
|
28
30
|
VirtualScrollerComponent: DataGridProVirtualScroller,
|
|
29
31
|
ColumnHeadersProps: {
|
|
@@ -34,7 +36,7 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
|
|
|
34
36
|
releaseInfo: releaseInfo
|
|
35
37
|
})
|
|
36
38
|
}), /*#__PURE__*/_jsx(GridFooterPlaceholder, {})]
|
|
37
|
-
})
|
|
39
|
+
}))
|
|
38
40
|
});
|
|
39
41
|
});
|
|
40
42
|
export const DataGridPro = /*#__PURE__*/React.memo(DataGridProRaw);
|
|
@@ -255,6 +257,11 @@ DataGridProRaw.propTypes = {
|
|
|
255
257
|
quickFilterLogicOperator: PropTypes.oneOf(['and', 'or']),
|
|
256
258
|
quickFilterValues: PropTypes.array
|
|
257
259
|
}),
|
|
260
|
+
/**
|
|
261
|
+
* Forwarded props for the grid root element.
|
|
262
|
+
* @ignore - do not document.
|
|
263
|
+
*/
|
|
264
|
+
forwardedProps: PropTypes.object,
|
|
258
265
|
/**
|
|
259
266
|
* Function that applies CSS classes dynamically on cells.
|
|
260
267
|
* @param {GridCellParams} params With all properties from [[GridCellParams]].
|
|
@@ -827,6 +834,11 @@ DataGridProRaw.propTypes = {
|
|
|
827
834
|
* @default false
|
|
828
835
|
*/
|
|
829
836
|
treeData: PropTypes.bool,
|
|
837
|
+
/**
|
|
838
|
+
* If `true`, enables the data grid filtering on header feature.
|
|
839
|
+
* @default false
|
|
840
|
+
*/
|
|
841
|
+
unstable_headerFilters: PropTypes.bool,
|
|
830
842
|
/**
|
|
831
843
|
* If `true`, the grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
832
844
|
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer } from '@mui/x-data-grid/internals';
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, headerFilteringStateInitializer, useGridHeaderFiltering } from '@mui/x-data-grid/internals';
|
|
2
2
|
// Pro-only features
|
|
3
3
|
import { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
|
|
4
4
|
import { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
@@ -35,6 +35,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
35
35
|
/**
|
|
36
36
|
* Register all state initializers here.
|
|
37
37
|
*/
|
|
38
|
+
useGridInitializeState(headerFilteringStateInitializer, apiRef, props);
|
|
38
39
|
useGridInitializeState(rowSelectionStateInitializer, apiRef, props);
|
|
39
40
|
useGridInitializeState(detailPanelStateInitializer, apiRef, props);
|
|
40
41
|
useGridInitializeState(columnPinningStateInitializer, apiRef, props);
|
|
@@ -53,6 +54,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
53
54
|
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
54
55
|
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
55
56
|
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
57
|
+
useGridHeaderFiltering(apiRef, props);
|
|
56
58
|
useGridTreeData(apiRef);
|
|
57
59
|
useGridKeyboardNavigation(apiRef, props);
|
|
58
60
|
useGridRowSelection(apiRef, props);
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["components", "componentsProps"];
|
|
4
2
|
import * as React from 'react';
|
|
5
3
|
import { useThemeProps } from '@mui/material/styles';
|
|
6
4
|
import { GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES } from '@mui/x-data-grid';
|
|
7
|
-
import { computeSlots, uncapitalizeObjectKeys } from '@mui/x-data-grid/internals';
|
|
5
|
+
import { computeSlots, uncapitalizeObjectKeys, useProps } from '@mui/x-data-grid/internals';
|
|
8
6
|
import { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridProDefaultSlotsComponents';
|
|
9
7
|
|
|
10
8
|
/**
|
|
@@ -20,19 +18,15 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
|
|
|
20
18
|
disableChildrenSorting: false,
|
|
21
19
|
rowReordering: false,
|
|
22
20
|
rowsLoadingMode: 'client',
|
|
23
|
-
getDetailPanelHeight: () => 500
|
|
21
|
+
getDetailPanelHeight: () => 500,
|
|
22
|
+
unstable_headerFilters: false
|
|
24
23
|
});
|
|
25
24
|
const defaultSlots = uncapitalizeObjectKeys(DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS);
|
|
26
25
|
export const useDataGridProProps = inProps => {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
components,
|
|
33
|
-
componentsProps
|
|
34
|
-
} = _useThemeProps,
|
|
35
|
-
themedProps = _objectWithoutPropertiesLoose(_useThemeProps, _excluded);
|
|
26
|
+
const [components, componentsProps, themedProps] = useProps(useThemeProps({
|
|
27
|
+
props: inProps,
|
|
28
|
+
name: 'MuiDataGrid'
|
|
29
|
+
}));
|
|
36
30
|
const localeText = React.useMemo(() => _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
|
|
37
31
|
const slots = React.useMemo(() => computeSlots({
|
|
38
32
|
defaultSlots,
|
package/README.md
CHANGED
|
@@ -21,8 +21,8 @@ This component has the following peer dependencies that you will need to install
|
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@mui/material": "^5.4.1",
|
|
23
23
|
"@mui/system": "^5.4.1",
|
|
24
|
-
"react": "^17.0.
|
|
25
|
-
"react-dom": "^17.0.
|
|
24
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
25
|
+
"react-dom": "^17.0.0 || ^18.0.0"
|
|
26
26
|
},
|
|
27
27
|
```
|
|
28
28
|
|
|
@@ -179,8 +179,17 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
179
179
|
bottomPinnedRowsRenderZoneRef.current.style.transform = `translate3d(${left}px, 0px, 0px)`;
|
|
180
180
|
}
|
|
181
181
|
}, []);
|
|
182
|
+
|
|
183
|
+
// Create a lookup for faster check if the row is expanded
|
|
184
|
+
const expandedRowIdsLookup = React.useMemo(() => {
|
|
185
|
+
const lookup = new Set();
|
|
186
|
+
expandedRowIds.forEach(id => {
|
|
187
|
+
lookup.add(id);
|
|
188
|
+
});
|
|
189
|
+
return lookup;
|
|
190
|
+
}, [expandedRowIds]);
|
|
182
191
|
const getRowProps = React.useCallback(id => {
|
|
183
|
-
if (!
|
|
192
|
+
if (!expandedRowIdsLookup.has(id)) {
|
|
184
193
|
return null;
|
|
185
194
|
}
|
|
186
195
|
const height = detailPanelsHeights[id];
|
|
@@ -189,7 +198,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
189
198
|
marginBottom: height
|
|
190
199
|
}
|
|
191
200
|
};
|
|
192
|
-
}, [detailPanelsHeights,
|
|
201
|
+
}, [detailPanelsHeights, expandedRowIdsLookup]);
|
|
193
202
|
const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector);
|
|
194
203
|
const [leftPinnedColumns, rightPinnedColumns] = filterColumns(pinnedColumns, visibleColumnFields, theme.direction === 'rtl');
|
|
195
204
|
const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
@@ -229,15 +238,6 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
229
238
|
firstColumnIndex: visibleColumnFields.length - rightPinnedColumns.length,
|
|
230
239
|
lastColumnIndex: visibleColumnFields.length
|
|
231
240
|
}) : null;
|
|
232
|
-
|
|
233
|
-
// Create a lookup for faster check if the row is expanded
|
|
234
|
-
const expandedRowIdsLookup = React.useMemo(() => {
|
|
235
|
-
const lookup = {};
|
|
236
|
-
expandedRowIds.forEach(id => {
|
|
237
|
-
lookup[id] = true;
|
|
238
|
-
});
|
|
239
|
-
return lookup;
|
|
240
|
-
}, [expandedRowIds]);
|
|
241
241
|
const getDetailPanel = rowId => {
|
|
242
242
|
const rowsMeta = gridRowsMetaSelector(apiRef.current.state);
|
|
243
243
|
const content = detailPanelsContent[rowId];
|
|
@@ -278,7 +278,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
278
278
|
if (rootProps.getDetailPanelContent == null) {
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
|
-
if (!expandedRowIdsLookup
|
|
281
|
+
if (!expandedRowIdsLookup.has(rowId)) {
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
284
|
const detailPanel = getDetailPanel(rowId);
|
|
@@ -6,12 +6,15 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { unstable_composeClasses as composeClasses, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
7
7
|
import { styled, alpha, useTheme } from '@mui/material/styles';
|
|
8
8
|
import { getDataGridUtilityClass, gridClasses, useGridApiEventHandler, GridColumnHeaderSeparatorSides } from '@mui/x-data-grid';
|
|
9
|
-
import { GridBaseColumnHeaders, GridColumnHeadersInner
|
|
9
|
+
import { GridBaseColumnHeaders, GridColumnHeadersInner } from '@mui/x-data-grid/internals';
|
|
10
10
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
11
11
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
12
12
|
import { GridPinnedPosition } from '../hooks/features/columnPinning';
|
|
13
|
+
import { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
13
14
|
import { filterColumns } from './DataGridProVirtualScroller';
|
|
15
|
+
import { GridScrollArea } from './GridScrollArea';
|
|
14
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
18
|
const useUtilityClasses = ownerState => {
|
|
16
19
|
const {
|
|
17
20
|
leftPinnedColumns,
|
|
@@ -122,6 +125,7 @@ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeade
|
|
|
122
125
|
getRootProps,
|
|
123
126
|
getInnerProps,
|
|
124
127
|
getColumnHeaders,
|
|
128
|
+
getColumnFilters,
|
|
125
129
|
getColumnGroupHeaders
|
|
126
130
|
} = useGridColumnHeaders({
|
|
127
131
|
innerRef,
|
|
@@ -180,8 +184,14 @@ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeade
|
|
|
180
184
|
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
181
185
|
}, {
|
|
182
186
|
disableReorder: true
|
|
187
|
+
}), getColumnFilters({
|
|
188
|
+
renderContext: leftRenderContext,
|
|
189
|
+
minFirstColumn: leftRenderContext.firstColumnIndex,
|
|
190
|
+
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
183
191
|
})]
|
|
184
|
-
})), /*#__PURE__*/
|
|
192
|
+
})), /*#__PURE__*/_jsx(GridScrollArea, {
|
|
193
|
+
scrollDirection: "left"
|
|
194
|
+
}), /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
|
|
185
195
|
isDragging: isDragging
|
|
186
196
|
}, innerProps, {
|
|
187
197
|
children: [getColumnGroupHeaders({
|
|
@@ -192,8 +202,14 @@ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeade
|
|
|
192
202
|
renderContext,
|
|
193
203
|
minFirstColumn: leftPinnedColumns.length,
|
|
194
204
|
maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
|
|
205
|
+
}), getColumnFilters({
|
|
206
|
+
renderContext,
|
|
207
|
+
minFirstColumn: leftPinnedColumns.length,
|
|
208
|
+
maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
|
|
195
209
|
})]
|
|
196
|
-
})),
|
|
210
|
+
})), /*#__PURE__*/_jsx(GridScrollArea, {
|
|
211
|
+
scrollDirection: "right"
|
|
212
|
+
}), rightRenderContext && /*#__PURE__*/_jsxs(GridColumnHeadersPinnedColumnHeaders, _extends({
|
|
197
213
|
ownerState: _extends({}, ownerState, {
|
|
198
214
|
side: GridPinnedPosition.right,
|
|
199
215
|
showCellVerticalBorder: rootProps.showCellVerticalBorder
|
|
@@ -214,6 +230,10 @@ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeade
|
|
|
214
230
|
}, {
|
|
215
231
|
disableReorder: true,
|
|
216
232
|
separatorSide: GridColumnHeaderSeparatorSides.Left
|
|
233
|
+
}), getColumnFilters({
|
|
234
|
+
renderContext: rightRenderContext,
|
|
235
|
+
minFirstColumn: rightRenderContext.firstColumnIndex,
|
|
236
|
+
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
217
237
|
})]
|
|
218
238
|
}))]
|
|
219
239
|
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { GridColumnMenuItemProps } from '@mui/x-data-grid';
|
|
3
|
-
declare function GridColumnMenuPinningItem(props: GridColumnMenuItemProps): JSX.Element | null;
|
|
3
|
+
declare function GridColumnMenuPinningItem(props: GridColumnMenuItemProps): React.JSX.Element | null;
|
|
4
4
|
declare namespace GridColumnMenuPinningItem {
|
|
5
5
|
var propTypes: any;
|
|
6
6
|
}
|
|
@@ -15,5 +15,5 @@ interface GridDetailPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
15
15
|
*/
|
|
16
16
|
rowId: GridRowId;
|
|
17
17
|
}
|
|
18
|
-
declare function GridDetailPanel(props: GridDetailPanelProps): JSX.Element;
|
|
18
|
+
declare function GridDetailPanel(props: GridDetailPanelProps): React.JSX.Element;
|
|
19
19
|
export { GridDetailPanel };
|
|
@@ -4,7 +4,7 @@ const _excluded = ["rowId", "height", "style"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import Box from '@mui/material/Box';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
7
|
-
import { useGridRootProps } from '
|
|
7
|
+
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
8
8
|
import { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
const DetailPanel = styled(Box, {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
|
-
declare function GridDetailPanelToggleCell(props: GridRenderCellParams): JSX.Element;
|
|
3
|
+
declare function GridDetailPanelToggleCell(props: GridRenderCellParams): React.JSX.Element;
|
|
4
4
|
declare namespace GridDetailPanelToggleCell {
|
|
5
5
|
var propTypes: any;
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
|
-
declare function GridRowReorderCell(params: GridRenderCellParams): JSX.Element | null;
|
|
3
|
+
declare function GridRowReorderCell(params: GridRenderCellParams): React.JSX.Element | null;
|
|
4
4
|
export { GridRowReorderCell };
|
|
5
|
-
export declare const renderRowReorderCell: (params: GridRenderCellParams) => JSX.Element | null;
|
|
5
|
+
export declare const renderRowReorderCell: (params: GridRenderCellParams) => React.JSX.Element | null;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface ScrollAreaProps {
|
|
3
|
+
scrollDirection: 'left' | 'right';
|
|
4
|
+
}
|
|
5
|
+
declare function GridScrollAreaRaw(props: ScrollAreaProps): React.JSX.Element | null;
|
|
6
|
+
declare namespace GridScrollAreaRaw {
|
|
7
|
+
var propTypes: any;
|
|
8
|
+
}
|
|
9
|
+
declare const GridScrollArea: React.MemoExoticComponent<typeof GridScrollAreaRaw>;
|
|
10
|
+
export { GridScrollArea };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { unstable_composeClasses as composeClasses, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
6
|
+
import { styled } from '@mui/system';
|
|
7
|
+
import { getTotalHeaderHeight } from '@mui/x-data-grid/internals';
|
|
8
|
+
import { getDataGridUtilityClass, gridClasses, gridDensityFactorSelector, useGridApiContext, useGridApiEventHandler, useGridSelector, gridColumnsTotalWidthSelector } from '@mui/x-data-grid';
|
|
9
|
+
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const CLIFF = 1;
|
|
12
|
+
const SLOP = 1.5;
|
|
13
|
+
const useUtilityClasses = ownerState => {
|
|
14
|
+
const {
|
|
15
|
+
scrollDirection,
|
|
16
|
+
classes
|
|
17
|
+
} = ownerState;
|
|
18
|
+
const slots = {
|
|
19
|
+
root: ['scrollArea', `scrollArea--${scrollDirection}`]
|
|
20
|
+
};
|
|
21
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
22
|
+
};
|
|
23
|
+
const GridScrollAreaRawRoot = styled('div', {
|
|
24
|
+
name: 'MuiDataGrid',
|
|
25
|
+
slot: 'ScrollArea',
|
|
26
|
+
overridesResolver: (props, styles) => [{
|
|
27
|
+
[`&.${gridClasses['scrollArea--left']}`]: styles['scrollArea--left']
|
|
28
|
+
}, {
|
|
29
|
+
[`&.${gridClasses['scrollArea--right']}`]: styles['scrollArea--right']
|
|
30
|
+
}, styles.scrollArea]
|
|
31
|
+
})(() => ({
|
|
32
|
+
position: 'absolute',
|
|
33
|
+
top: 0,
|
|
34
|
+
zIndex: 101,
|
|
35
|
+
width: 20,
|
|
36
|
+
bottom: 0,
|
|
37
|
+
[`&.${gridClasses['scrollArea--left']}`]: {
|
|
38
|
+
left: 0
|
|
39
|
+
},
|
|
40
|
+
[`&.${gridClasses['scrollArea--right']}`]: {
|
|
41
|
+
right: 0
|
|
42
|
+
}
|
|
43
|
+
}));
|
|
44
|
+
function GridScrollAreaRaw(props) {
|
|
45
|
+
const {
|
|
46
|
+
scrollDirection
|
|
47
|
+
} = props;
|
|
48
|
+
const rootRef = React.useRef(null);
|
|
49
|
+
const apiRef = useGridApiContext();
|
|
50
|
+
const timeout = React.useRef();
|
|
51
|
+
const [dragging, setDragging] = React.useState(false);
|
|
52
|
+
const [canScrollMore, setCanScrollMore] = React.useState(true);
|
|
53
|
+
const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
|
|
54
|
+
const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
55
|
+
const scrollPosition = React.useRef({
|
|
56
|
+
left: 0,
|
|
57
|
+
top: 0
|
|
58
|
+
});
|
|
59
|
+
const rootProps = useGridRootProps();
|
|
60
|
+
const ownerState = _extends({}, rootProps, {
|
|
61
|
+
scrollDirection
|
|
62
|
+
});
|
|
63
|
+
const classes = useUtilityClasses(ownerState);
|
|
64
|
+
const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps.columnHeaderHeight);
|
|
65
|
+
const headerHeight = Math.floor(rootProps.columnHeaderHeight * densityFactor);
|
|
66
|
+
const handleScrolling = React.useCallback(newScrollPosition => {
|
|
67
|
+
scrollPosition.current = newScrollPosition;
|
|
68
|
+
const dimensions = apiRef.current.getRootDimensions();
|
|
69
|
+
setCanScrollMore(() => {
|
|
70
|
+
if (scrollDirection === 'left') {
|
|
71
|
+
// Only render if the user has not reached yet the start of the list
|
|
72
|
+
return scrollPosition.current.left > 0;
|
|
73
|
+
}
|
|
74
|
+
if (scrollDirection === 'right') {
|
|
75
|
+
// Only render if the user has not reached yet the end of the list
|
|
76
|
+
const maxScrollLeft = columnsTotalWidth - dimensions.viewportInnerSize.width;
|
|
77
|
+
return scrollPosition.current.left < maxScrollLeft;
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
});
|
|
81
|
+
}, [apiRef, columnsTotalWidth, scrollDirection]);
|
|
82
|
+
const handleDragOver = React.useCallback(event => {
|
|
83
|
+
let offset;
|
|
84
|
+
|
|
85
|
+
// Prevents showing the forbidden cursor
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
if (scrollDirection === 'left') {
|
|
88
|
+
offset = event.clientX - rootRef.current.getBoundingClientRect().right;
|
|
89
|
+
} else if (scrollDirection === 'right') {
|
|
90
|
+
offset = Math.max(1, event.clientX - rootRef.current.getBoundingClientRect().left);
|
|
91
|
+
} else {
|
|
92
|
+
throw new Error('MUI: Wrong drag direction');
|
|
93
|
+
}
|
|
94
|
+
offset = (offset - CLIFF) * SLOP + CLIFF;
|
|
95
|
+
clearTimeout(timeout.current);
|
|
96
|
+
// Avoid freeze and inertia.
|
|
97
|
+
timeout.current = setTimeout(() => {
|
|
98
|
+
apiRef.current.scroll({
|
|
99
|
+
left: scrollPosition.current.left + offset,
|
|
100
|
+
top: scrollPosition.current.top
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}, [scrollDirection, apiRef]);
|
|
104
|
+
React.useEffect(() => {
|
|
105
|
+
return () => {
|
|
106
|
+
clearTimeout(timeout.current);
|
|
107
|
+
};
|
|
108
|
+
}, []);
|
|
109
|
+
const handleColumnHeaderDragStart = useEventCallback(() => {
|
|
110
|
+
setDragging(true);
|
|
111
|
+
});
|
|
112
|
+
const handleColumnHeaderDragEnd = useEventCallback(() => {
|
|
113
|
+
setDragging(false);
|
|
114
|
+
});
|
|
115
|
+
useGridApiEventHandler(apiRef, 'scrollPositionChange', handleScrolling);
|
|
116
|
+
useGridApiEventHandler(apiRef, 'columnHeaderDragStart', handleColumnHeaderDragStart);
|
|
117
|
+
useGridApiEventHandler(apiRef, 'columnHeaderDragEnd', handleColumnHeaderDragEnd);
|
|
118
|
+
if (!dragging || !canScrollMore) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return /*#__PURE__*/_jsx(GridScrollAreaRawRoot, {
|
|
122
|
+
ref: rootRef,
|
|
123
|
+
className: clsx(classes.root),
|
|
124
|
+
ownerState: ownerState,
|
|
125
|
+
onDragOver: handleDragOver,
|
|
126
|
+
style: {
|
|
127
|
+
height: headerHeight,
|
|
128
|
+
top: totalHeaderHeight - headerHeight
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
process.env.NODE_ENV !== "production" ? GridScrollAreaRaw.propTypes = {
|
|
133
|
+
// ----------------------------- Warning --------------------------------
|
|
134
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
135
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
136
|
+
// ----------------------------------------------------------------------
|
|
137
|
+
scrollDirection: PropTypes.oneOf(['left', 'right']).isRequired
|
|
138
|
+
} : void 0;
|
|
139
|
+
const GridScrollArea = /*#__PURE__*/React.memo(GridScrollAreaRaw);
|
|
140
|
+
export { GridScrollArea };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { GridRenderCellParams, GridGroupNode } from '@mui/x-data-grid';
|
|
3
3
|
interface GridTreeDataGroupingCellProps extends GridRenderCellParams<any, any, any, GridGroupNode> {
|
|
4
4
|
hideDescendantCount?: boolean;
|
|
@@ -8,7 +8,7 @@ interface GridTreeDataGroupingCellProps extends GridRenderCellParams<any, any, a
|
|
|
8
8
|
*/
|
|
9
9
|
offsetMultiplier?: number;
|
|
10
10
|
}
|
|
11
|
-
declare function GridTreeDataGroupingCell(props: GridTreeDataGroupingCellProps): JSX.Element;
|
|
11
|
+
declare function GridTreeDataGroupingCell(props: GridTreeDataGroupingCellProps): React.JSX.Element;
|
|
12
12
|
declare namespace GridTreeDataGroupingCell {
|
|
13
13
|
var propTypes: any;
|
|
14
14
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridFilterItem, GridFilterOperator, GridColDef } from '@mui/x-data-grid';
|
|
3
|
+
declare function GridHeaderFilterAdornment(props: {
|
|
4
|
+
operators: GridFilterOperator<any, any, any>[];
|
|
5
|
+
field: GridColDef['field'];
|
|
6
|
+
item: GridFilterItem;
|
|
7
|
+
applyFilterChanges: (item: GridFilterItem) => void;
|
|
8
|
+
headerFilterMenuRef: React.MutableRefObject<HTMLButtonElement | null>;
|
|
9
|
+
buttonRef: React.Ref<HTMLButtonElement>;
|
|
10
|
+
}): React.JSX.Element | null;
|
|
11
|
+
declare namespace GridHeaderFilterAdornment {
|
|
12
|
+
var propTypes: any;
|
|
13
|
+
}
|
|
14
|
+
export { GridHeaderFilterAdornment };
|