@mui/x-data-grid-pro 6.13.0 → 6.15.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 +162 -1
- package/DataGridPro/DataGridPro.js +20 -0
- package/DataGridPro/useDataGridProComponent.js +3 -1
- package/DataGridPro/useDataGridProProps.js +2 -0
- package/README.md +3 -7
- package/components/GridColumnHeaders.js +2 -4
- package/components/headerFiltering/GridHeaderFilterCell.js +16 -2
- package/components/headerFiltering/GridHeaderFilterMenu.js +1 -1
- package/components/headerFiltering/GridHeaderFilterMenuContainer.js +2 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +19 -2
- package/hooks/features/columnPinning/useGridColumnPinning.js +1 -44
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +44 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/hooks/features/columnResize/index.d.ts +1 -0
- package/hooks/features/columnResize/index.js +2 -1
- package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +236 -56
- package/index.js +1 -1
- package/legacy/DataGridPro/DataGridPro.js +20 -0
- package/legacy/DataGridPro/useDataGridProComponent.js +3 -1
- package/legacy/DataGridPro/useDataGridProProps.js +2 -0
- package/legacy/components/GridColumnHeaders.js +2 -4
- package/legacy/components/headerFiltering/GridHeaderFilterCell.js +17 -3
- package/legacy/components/headerFiltering/GridHeaderFilterMenu.js +1 -1
- package/legacy/components/headerFiltering/GridHeaderFilterMenuContainer.js +2 -4
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +22 -8
- package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +1 -44
- package/legacy/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/legacy/hooks/features/columnResize/index.js +2 -1
- package/legacy/hooks/features/columnResize/useGridColumnResize.js +279 -57
- package/legacy/index.js +1 -1
- package/legacy/models/index.js +1 -0
- package/legacy/utils/domUtils.js +12 -0
- package/legacy/utils/releaseInfo.js +1 -1
- package/models/dataGridProProps.d.ts +15 -0
- package/models/gridApiPro.d.ts +2 -2
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/modern/DataGridPro/DataGridPro.js +20 -0
- package/modern/DataGridPro/useDataGridProComponent.js +3 -1
- package/modern/DataGridPro/useDataGridProProps.js +2 -0
- package/modern/components/GridColumnHeaders.js +2 -4
- package/modern/components/headerFiltering/GridHeaderFilterCell.js +15 -2
- package/modern/components/headerFiltering/GridHeaderFilterMenu.js +1 -1
- package/modern/components/headerFiltering/GridHeaderFilterMenuContainer.js +2 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +18 -1
- package/modern/hooks/features/columnPinning/useGridColumnPinning.js +1 -43
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/modern/hooks/features/columnResize/index.js +2 -1
- package/modern/hooks/features/columnResize/useGridColumnResize.js +225 -52
- package/modern/index.js +1 -1
- package/modern/models/index.js +1 -0
- package/modern/utils/domUtils.js +10 -0
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPro/DataGridPro.js +20 -0
- package/node/DataGridPro/useDataGridProComponent.js +2 -0
- package/node/DataGridPro/useDataGridProProps.js +2 -0
- package/node/components/GridColumnHeaders.js +1 -3
- package/node/components/headerFiltering/GridHeaderFilterCell.js +15 -2
- package/node/components/headerFiltering/GridHeaderFilterMenu.js +1 -1
- package/node/components/headerFiltering/GridHeaderFilterMenuContainer.js +1 -3
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +18 -1
- package/node/hooks/features/columnPinning/useGridColumnPinning.js +0 -42
- package/node/hooks/features/columnResize/gridColumnResizeApi.js +17 -0
- package/node/hooks/features/columnResize/index.js +11 -0
- package/node/hooks/features/columnResize/useGridColumnResize.js +222 -49
- package/node/index.js +1 -1
- package/node/models/index.js +11 -0
- package/node/utils/domUtils.js +12 -0
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +3 -3
- package/utils/domUtils.d.ts +2 -0
- package/utils/domUtils.js +10 -0
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,166 @@
|
|
|
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.15.0
|
|
7
|
+
|
|
8
|
+
_Sep 22, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🚀 Implement columns auto-sizing (#10180) @romgrk
|
|
13
|
+
- 🎁 Add support for `getRowsToExport` option to print export on the data grid (#10084) @zreecespieces
|
|
14
|
+
- 🌍 Improve Finnish (fi-FI) locale
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
- 📚 Documentation improvements
|
|
17
|
+
|
|
18
|
+
### Data Grid
|
|
19
|
+
|
|
20
|
+
#### `@mui/x-data-grid@6.15.0`
|
|
21
|
+
|
|
22
|
+
- [DataGrid] Add support for `getRowsToExport` option to print export (#10084) @zreecespieces
|
|
23
|
+
- [DataGrid] Fix dev warning about `InputLabelProps` (#10413) @romgrk
|
|
24
|
+
- [DataGrid] Refactor `GridMenu` prop `onClickAway` to `onClose` (#10411) @romgrk
|
|
25
|
+
- [DataGrid] Restore focus after `GridMenu` closes (#10412) @romgrk
|
|
26
|
+
- [DataGrid] Fix typing of `GridActionsCellItem` (#10344) @romgrk
|
|
27
|
+
- [DataGrid] Hide `eval` from bundlers (#10329) @romgrk
|
|
28
|
+
- [DataGrid] Add `border: 0` to unmounted focused cell to avoid layout shifts in that row (#10318) @lauri865
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-pro@6.15.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid@6.15.0`, plus:
|
|
33
|
+
|
|
34
|
+
- [DataGridPro] Implement columns auto-sizing (#10180) @romgrk
|
|
35
|
+
- [DataGridPro] Fix keyboard navigation issue in header filters (#10358) @MBilalShafi
|
|
36
|
+
- [DataGridPro] Add missing row hover styles (#10252) @cherniavskii
|
|
37
|
+
- [DataGridPro] Make default filter items have stable references in header filters (#10338) @MBilalShafi
|
|
38
|
+
|
|
39
|
+
#### `@mui/x-data-grid-premium@6.15.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
40
|
+
|
|
41
|
+
Same changes as in `@mui/x-data-grid-pro@6.15.0`.
|
|
42
|
+
|
|
43
|
+
### Date Pickers
|
|
44
|
+
|
|
45
|
+
#### `@mui/x-date-pickers@6.15.0`
|
|
46
|
+
|
|
47
|
+
- [pickers] Support tokens without spaces (#10185) @alexfauquette
|
|
48
|
+
- [l10n] Improve Finnish (fi-FI) locale (#10346) @samijouppila
|
|
49
|
+
|
|
50
|
+
#### `@mui/x-date-pickers-pro@6.15.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
51
|
+
|
|
52
|
+
Same changes as in `@mui/x-date-pickers@6.15.0`.
|
|
53
|
+
|
|
54
|
+
### Charts / `@mui/x-charts@6.0.0-alpha.12`
|
|
55
|
+
|
|
56
|
+
- [charts] Fix sparkline scale and rendering (#10402) @alexfauquette
|
|
57
|
+
- [charts] Remove components from `@mui/material` (#10115) @alexfauquette
|
|
58
|
+
|
|
59
|
+
### Tree View / `@mui/x-tree-view@6.0.0-alpha.4`
|
|
60
|
+
|
|
61
|
+
- [TreeView] Split features into plugins to prepare for Pro version (#10123) @flaviendelangle
|
|
62
|
+
|
|
63
|
+
### Docs
|
|
64
|
+
|
|
65
|
+
- [docs] Add charts documentation pages to complete pricing table (#10394) @alexfauquette
|
|
66
|
+
- [docs] Add missing MIT packages on the Licensing page (#10348) @flaviendelangle
|
|
67
|
+
- [docs] Clearer component pattern @oliviertassinari
|
|
68
|
+
- [docs] Easier to understand demo (#10370) @oliviertassinari
|
|
69
|
+
- [docs] Fix `301` to Material UI @oliviertassinari
|
|
70
|
+
- [docs] Improve the column visibility section (#10327) @MBilalShafi
|
|
71
|
+
- [docs] Improve the documentation section `rowIdentifier` (#10326) @MBilalShafi
|
|
72
|
+
- [docs] Improve pickers localization documentation (#10202) @flaviendelangle
|
|
73
|
+
- [docs] Polish typescript ref usage (#10359) @oliviertassinari
|
|
74
|
+
- [docs] Improve charts tooltip wording (#10406) @alexfauquette
|
|
75
|
+
|
|
76
|
+
### Core
|
|
77
|
+
|
|
78
|
+
- [core] Cleanup GitHub issues template (#10372) @romgrk
|
|
79
|
+
- [core] Fix Circle CI OOM (#10385) @romgrk
|
|
80
|
+
- [core] Improve sleep test helper @oliviertassinari
|
|
81
|
+
- [core] Remove unwanted prefixes @oliviertassinari
|
|
82
|
+
- [core] Remove duplicate label @oliviertassinari
|
|
83
|
+
- [core] Simplify source @oliviertassinari
|
|
84
|
+
- [core] Upgrade monorepo (#10425) @cherniavskii
|
|
85
|
+
- [core] Upgrade monorepo to have the new typescript-to-proptype (#10224) @flaviendelangle
|
|
86
|
+
- [test] Do not use deprecated adapter methods (#10416) @flaviendelangle
|
|
87
|
+
- [test] Name test suites according to sentence case (#10429) @alexfauquette
|
|
88
|
+
|
|
89
|
+
## 6.14.0
|
|
90
|
+
|
|
91
|
+
_Sep 14, 2023_
|
|
92
|
+
|
|
93
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
94
|
+
|
|
95
|
+
- 🎁 Fix `YearCalendar` and `MonthCalendar` accessibility (#10312) @LukasTy
|
|
96
|
+
|
|
97
|
+
The `YearCalendar` and `MonthCalendar` items role has been changed from `button` to `radio` in order to improve the component's a11y support.
|
|
98
|
+
If you were relying on the mentioned components having a `button` role for items, you will need to update your usage to expect a `radio` role instead.
|
|
99
|
+
|
|
100
|
+
- 🌍 Improve Japanese (ja-JP), Persian (fa-IR), and Vietnamese (vi-VN) locales on the data grid
|
|
101
|
+
- 🐞 Bugfixes
|
|
102
|
+
- 📚 Documentation improvements
|
|
103
|
+
|
|
104
|
+
### Data Grid
|
|
105
|
+
|
|
106
|
+
#### `@mui/x-data-grid@6.14.0`
|
|
107
|
+
|
|
108
|
+
- [l10n] Improve Japanese (ja-JP) locale (#10299) @makoto14
|
|
109
|
+
- [l10n] Improve Persian (fa-IR) locale (#10277) @aminsaedi
|
|
110
|
+
- [l10n] Improve Vietnamese (vi-VN) locale (#10280) @khangnguyen2100
|
|
111
|
+
|
|
112
|
+
#### `@mui/x-data-grid-pro@6.14.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
113
|
+
|
|
114
|
+
Same changes as in `@mui/x-data-grid@6.14.0`.
|
|
115
|
+
|
|
116
|
+
#### `@mui/x-data-grid-premium@6.14.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
117
|
+
|
|
118
|
+
Same changes as in `@mui/x-data-grid-pro@6.14.0`, plus:
|
|
119
|
+
|
|
120
|
+
- [DataGridPremium] Fix clipboard import cutting off at 100 rows (#9930) @gitstart
|
|
121
|
+
|
|
122
|
+
### Date Pickers
|
|
123
|
+
|
|
124
|
+
#### `@mui/x-date-pickers@6.14.0`
|
|
125
|
+
|
|
126
|
+
- [pickers] Fix `YearCalendar` and `MonthCalendar` a11y (#10312) @LukasTy
|
|
127
|
+
- [pickers] Localize `TimeClock` meridiem text (#10324) @LukasTy
|
|
128
|
+
|
|
129
|
+
#### `@mui/x-date-pickers-pro@6.14.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
130
|
+
|
|
131
|
+
Same changes as in `@mui/x-date-pickers@6.14.0`.
|
|
132
|
+
|
|
133
|
+
### Charts / `@mui/x-charts@6.0.0-alpha.11`
|
|
134
|
+
|
|
135
|
+
- [charts] Add default `barGapRatio` and increase `categoryGapRatio` (#10317) @LukasTy
|
|
136
|
+
- [charts] Enable `eslint` on the package (#10330) @LukasTy
|
|
137
|
+
|
|
138
|
+
### Tree View / `@mui/x-tree-view@6.0.0-alpha.3`
|
|
139
|
+
|
|
140
|
+
- [TreeView] Fix box-sizing dependency (#10255) @oliviertassinari
|
|
141
|
+
|
|
142
|
+
### Docs
|
|
143
|
+
|
|
144
|
+
- [docs] Add conditional range picker props example (#10227) @LukasTy
|
|
145
|
+
- [docs] Add toolbar to the multi-filters demo (#10223) @MBilalShafi
|
|
146
|
+
- [docs] Avoid the use of "We" @oliviertassinari
|
|
147
|
+
- [docs] Clarify MUI vs. MUI Core difference @oliviertassinari
|
|
148
|
+
- [docs] Enable `ariaV7` flag for demos using `useDemoData` hook (#10204) @cherniavskii
|
|
149
|
+
- [docs] Fix Tree View link to API references (#10282) @oliviertassinari
|
|
150
|
+
- [docs] Fix image layout shift (#10313) @oliviertassinari
|
|
151
|
+
- [docs] Fix link to MUI X from readme logo @oliviertassinari
|
|
152
|
+
- [docs] Fix redirection to Base UI URLs @oliviertassinari
|
|
153
|
+
- [docs] Improve Tree View demos (#10268) @oliviertassinari
|
|
154
|
+
- [docs] Improve docs for ref type props (#10273) @michelengelen
|
|
155
|
+
- [docs] Improve npm package README (#10269) @oliviertassinari
|
|
156
|
+
- [docs] Improve the clarity of the npm links @oliviertassinari
|
|
157
|
+
- [docs] Keep installation readme simple @oliviertassinari
|
|
158
|
+
- [docs] Make each component feel more standalone @oliviertassinari
|
|
159
|
+
|
|
160
|
+
### Core
|
|
161
|
+
|
|
162
|
+
- [core] Add types extension for clarity @oliviertassinari
|
|
163
|
+
- [core] Set logo height to fix layout shift in GitHub @oliviertassinari
|
|
164
|
+
- [core] TrapFocus was renamed to FocusTrap @oliviertassinari
|
|
165
|
+
|
|
6
166
|
## 6.13.0
|
|
7
167
|
|
|
8
168
|
_Sep 8, 2023_
|
|
@@ -12,6 +172,7 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
|
|
|
12
172
|
- 🎁 Fix `anchorRef` behavior on range pickers (#10077) @LukasTy
|
|
13
173
|
|
|
14
174
|
The range picker popup will now be anchored to the first input element and left aligned like other pickers.
|
|
175
|
+
|
|
15
176
|
- 🌍 Improve Slovak (sk-SK) locale on the data grid
|
|
16
177
|
- 🐞 Bugfixes
|
|
17
178
|
- 📚 Documentation improvements
|
|
@@ -1838,7 +1999,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
|
|
|
1838
1999
|
#### Changes
|
|
1839
2000
|
|
|
1840
2001
|
- [DataGrid] Add interface for `singleSelect` column (#7685) @m4theushw
|
|
1841
|
-
- [DataGrid] Allow to pass props to the `
|
|
2002
|
+
- [DataGrid] Allow to pass props to the `FocusTrap` inside the panel wrapper (#7733) @ivek-Prajapatii
|
|
1842
2003
|
- [DataGrid] Avoid unnecessary rerenders after `updateRows` (#7857) @cherniavskii
|
|
1843
2004
|
- [DataGridPro] Change cursor when dragging a column (#7725) @sai6855
|
|
1844
2005
|
- [DataGridPremium] Fix `leafField` to have correct focus value (#7950) @MBilalShafi
|
|
@@ -69,6 +69,21 @@ DataGridProRaw.propTypes = {
|
|
|
69
69
|
* @default false
|
|
70
70
|
*/
|
|
71
71
|
autoPageSize: PropTypes.bool,
|
|
72
|
+
/**
|
|
73
|
+
* If `true`, columns are autosized after the datagrid is mounted.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
autosizeOnMount: PropTypes.bool,
|
|
77
|
+
/**
|
|
78
|
+
* The options for autosize when user-initiated.
|
|
79
|
+
*/
|
|
80
|
+
autosizeOptions: PropTypes.shape({
|
|
81
|
+
columns: PropTypes.arrayOf(PropTypes.string),
|
|
82
|
+
expand: PropTypes.bool,
|
|
83
|
+
includeHeaders: PropTypes.bool,
|
|
84
|
+
includeOutliers: PropTypes.bool,
|
|
85
|
+
outliersFactor: PropTypes.number
|
|
86
|
+
}),
|
|
72
87
|
/**
|
|
73
88
|
* Controls the modes of the cells.
|
|
74
89
|
*/
|
|
@@ -148,6 +163,11 @@ DataGridProRaw.propTypes = {
|
|
|
148
163
|
* The row ids to show the detail panel.
|
|
149
164
|
*/
|
|
150
165
|
detailPanelExpandedRowIds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired),
|
|
166
|
+
/**
|
|
167
|
+
* If `true`, column autosizing on header separator double-click is disabled.
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
disableAutosize: PropTypes.bool,
|
|
151
171
|
/**
|
|
152
172
|
* If `true`, the filtering will only be applied to the top level rows when grouping rows with the `treeData` prop.
|
|
153
173
|
* @default false
|
|
@@ -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, headerFilteringStateInitializer, useGridHeaderFiltering } 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, virtualizationStateInitializer, useGridVirtualization } 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';
|
|
@@ -54,6 +54,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
54
54
|
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
55
55
|
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
56
56
|
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
57
|
+
useGridInitializeState(virtualizationStateInitializer, apiRef, props);
|
|
57
58
|
useGridHeaderFiltering(apiRef, props);
|
|
58
59
|
useGridTreeData(apiRef);
|
|
59
60
|
useGridKeyboardNavigation(apiRef, props);
|
|
@@ -87,5 +88,6 @@ export const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
87
88
|
useGridDimensions(apiRef, props);
|
|
88
89
|
useGridEvents(apiRef, props);
|
|
89
90
|
useGridStatePersistence(apiRef);
|
|
91
|
+
useGridVirtualization(apiRef, props);
|
|
90
92
|
return apiRef;
|
|
91
93
|
};
|
|
@@ -12,6 +12,8 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
|
|
|
12
12
|
scrollEndThreshold: 80,
|
|
13
13
|
treeData: false,
|
|
14
14
|
defaultGroupingExpansionDepth: 0,
|
|
15
|
+
autosizeOnMount: false,
|
|
16
|
+
disableAutosize: false,
|
|
15
17
|
disableColumnPinning: false,
|
|
16
18
|
keepColumnPositionIfDraggedOutside: false,
|
|
17
19
|
disableChildrenFiltering: false,
|
package/README.md
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MUI X Data Grid Pro
|
|
2
2
|
|
|
3
3
|
This package is the Pro plan edition of the data grid component.
|
|
4
|
-
It's part of MUI X, an open
|
|
4
|
+
It's part of [MUI X](https://mui.com/x/), an open-core extension of MUI Core, with advanced components.
|
|
5
5
|
|
|
6
6
|
## Installation
|
|
7
7
|
|
|
8
8
|
Install the package in your project directory with:
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
// with npm
|
|
12
11
|
npm install @mui/x-data-grid-pro
|
|
13
|
-
|
|
14
|
-
// with yarn
|
|
15
|
-
yarn add @mui/x-data-grid-pro
|
|
16
12
|
```
|
|
17
13
|
|
|
18
14
|
This component has the following peer dependencies that you will need to install as well.
|
|
@@ -28,4 +24,4 @@ This component has the following peer dependencies that you will need to install
|
|
|
28
24
|
|
|
29
25
|
## Documentation
|
|
30
26
|
|
|
31
|
-
[
|
|
27
|
+
Visit [https://mui.com/x/react-data-grid/](https://mui.com/x/react-data-grid/) to view the full documentation.
|
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
const _excluded = ["style", "className", "innerRef", "visibleColumns", "sortColumnLookup", "filterColumnLookup", "columnPositions", "columnHeaderTabIndexState", "columnGroupHeaderTabIndexState", "columnHeaderFocus", "columnGroupHeaderFocus", "densityFactor", "headerGroupingMaxDepth", "columnMenuState", "columnVisibility", "columnGroupsHeaderStructure", "hasOtherElementInTabSequence", "pinnedColumns"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { unstable_composeClasses as composeClasses, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
6
|
+
import { refType, 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
9
|
import { GridBaseColumnHeaders, GridColumnHeadersInner } from '@mui/x-data-grid/internals';
|
|
@@ -271,9 +271,7 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaders.propTypes = {
|
|
|
271
271
|
filterColumnLookup: PropTypes.object.isRequired,
|
|
272
272
|
hasOtherElementInTabSequence: PropTypes.bool.isRequired,
|
|
273
273
|
headerGroupingMaxDepth: PropTypes.number.isRequired,
|
|
274
|
-
innerRef:
|
|
275
|
-
current: PropTypes.object
|
|
276
|
-
})]),
|
|
274
|
+
innerRef: refType,
|
|
277
275
|
minColumnIndex: PropTypes.number,
|
|
278
276
|
pinnedColumns: PropTypes.shape({
|
|
279
277
|
left: PropTypes.arrayOf(PropTypes.string),
|
|
@@ -130,7 +130,7 @@ const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
130
130
|
}, [apiRef, colDef.field]);
|
|
131
131
|
const onMouseDown = React.useCallback(event => {
|
|
132
132
|
if (!hasFocus) {
|
|
133
|
-
if (inputRef.current) {
|
|
133
|
+
if (inputRef.current && inputRef.current.contains(event.target)) {
|
|
134
134
|
inputRef.current.focus();
|
|
135
135
|
}
|
|
136
136
|
apiRef.current.setColumnHeaderFilterFocus(colDef.field, event);
|
|
@@ -172,7 +172,21 @@ const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
172
172
|
inputRef: inputRef,
|
|
173
173
|
applyValue: applyFilterChanges,
|
|
174
174
|
onFocus: () => apiRef.current.startHeaderFilterEditMode(colDef.field),
|
|
175
|
-
onBlur:
|
|
175
|
+
onBlur: event => {
|
|
176
|
+
var _event$relatedTarget;
|
|
177
|
+
apiRef.current.stopHeaderFilterEditMode();
|
|
178
|
+
// Blurring an input element should reset focus state only if `relatedTarget` is not the header filter cell
|
|
179
|
+
if (!((_event$relatedTarget = event.relatedTarget) != null && _event$relatedTarget.className.includes('columnHeader'))) {
|
|
180
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
181
|
+
focus: {
|
|
182
|
+
cell: null,
|
|
183
|
+
columnHeader: null,
|
|
184
|
+
columnHeaderFilter: null,
|
|
185
|
+
columnGroupHeader: null
|
|
186
|
+
}
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
},
|
|
176
190
|
label: capitalize(label),
|
|
177
191
|
placeholder: "",
|
|
178
192
|
isFilterActive: isFilterActive,
|
|
@@ -4,7 +4,7 @@ const _excluded = ["operators", "item", "field", "buttonRef", "headerFilterMenuR
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useGridApiContext } from '@mui/x-data-grid';
|
|
7
|
-
import { unstable_useId as useId } from '@mui/utils';
|
|
7
|
+
import { refType, unstable_useId as useId } from '@mui/utils';
|
|
8
8
|
import { unstable_gridHeaderFilteringMenuSelector } from '@mui/x-data-grid/internals';
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -70,9 +70,7 @@ process.env.NODE_ENV !== "production" ? GridHeaderFilterMenuContainer.propTypes
|
|
|
70
70
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
71
71
|
// ----------------------------------------------------------------------
|
|
72
72
|
applyFilterChanges: PropTypes.func.isRequired,
|
|
73
|
-
buttonRef:
|
|
74
|
-
current: PropTypes.object
|
|
75
|
-
})]),
|
|
73
|
+
buttonRef: refType,
|
|
76
74
|
field: PropTypes.string.isRequired,
|
|
77
75
|
headerFilterMenuRef: PropTypes.shape({
|
|
78
76
|
current: PropTypes.object
|
|
@@ -26,6 +26,7 @@ const GridHeaderFilterRow = styled('div', {
|
|
|
26
26
|
})(() => ({
|
|
27
27
|
display: 'flex'
|
|
28
28
|
}));
|
|
29
|
+
const filterItemsCache = Object.create(null);
|
|
29
30
|
export const useGridColumnHeaders = props => {
|
|
30
31
|
const apiRef = useGridPrivateApiContext();
|
|
31
32
|
const {
|
|
@@ -53,6 +54,22 @@ export const useGridColumnHeaders = props => {
|
|
|
53
54
|
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
54
55
|
const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps.columnHeaderHeight) + (disableHeaderFiltering ? 0 : headerHeight);
|
|
55
56
|
const columnHeaderFilterFocus = useGridSelector(apiRef, unstable_gridFocusColumnHeaderFilterSelector);
|
|
57
|
+
const getFilterItem = React.useCallback(colDef => {
|
|
58
|
+
const filterModelItem = filterModel == null ? void 0 : filterModel.items.find(it => it.field === colDef.field && it.operator !== 'isAnyOf');
|
|
59
|
+
if (filterModelItem != null) {
|
|
60
|
+
// there's a valid `filterModelItem` for this column
|
|
61
|
+
return filterModelItem;
|
|
62
|
+
}
|
|
63
|
+
const defaultCachedItem = filterItemsCache[colDef.field];
|
|
64
|
+
if (defaultCachedItem != null) {
|
|
65
|
+
// there's a cached `defaultItem` for this column
|
|
66
|
+
return defaultCachedItem;
|
|
67
|
+
}
|
|
68
|
+
// there's no cached `defaultItem` for this column, let's generate one and cache it
|
|
69
|
+
const defaultItem = getGridFilter(colDef);
|
|
70
|
+
filterItemsCache[colDef.field] = defaultItem;
|
|
71
|
+
return defaultItem;
|
|
72
|
+
}, [filterModel]);
|
|
56
73
|
const getColumnFilters = (params, other = {}) => {
|
|
57
74
|
if (disableHeaderFiltering) {
|
|
58
75
|
return null;
|
|
@@ -67,7 +84,7 @@ export const useGridColumnHeaders = props => {
|
|
|
67
84
|
} = columnsToRender;
|
|
68
85
|
const filters = [];
|
|
69
86
|
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
70
|
-
var _colDef$filterOperato, _colDef$filterOperato2,
|
|
87
|
+
var _colDef$filterOperato, _colDef$filterOperato2, _rootProps$slotProps;
|
|
71
88
|
const colDef = renderedColumns[i];
|
|
72
89
|
const columnIndex = firstColumnToRender + i;
|
|
73
90
|
const hasFocus = (columnHeaderFilterFocus == null ? void 0 : columnHeaderFilterFocus.field) === colDef.field;
|
|
@@ -81,7 +98,7 @@ export const useGridColumnHeaders = props => {
|
|
|
81
98
|
|
|
82
99
|
// TODO: Support for `isAnyOf` operator
|
|
83
100
|
const filterOperators = (_colDef$filterOperato = (_colDef$filterOperato2 = colDef.filterOperators) == null ? void 0 : _colDef$filterOperato2.filter(operator => operator.value !== 'isAnyOf')) != null ? _colDef$filterOperato : [];
|
|
84
|
-
const item = (
|
|
101
|
+
const item = getFilterItem(colDef);
|
|
85
102
|
filters.push( /*#__PURE__*/_jsx(rootProps.slots.headerFilterCell, _extends({
|
|
86
103
|
colIndex: columnIndex,
|
|
87
104
|
height: headerHeight,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useTheme } from '@mui/material/styles';
|
|
4
|
-
import { useGridSelector, gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gridColumnPositionsSelector, gridVisibleColumnFieldsSelector,
|
|
4
|
+
import { useGridSelector, gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gridColumnPositionsSelector, gridVisibleColumnFieldsSelector, useGridApiMethod, useGridApiEventHandler, gridColumnFieldsSelector } from '@mui/x-data-grid';
|
|
5
5
|
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
6
6
|
import { GridPinnedPosition } from './gridColumnPinningInterface';
|
|
7
7
|
import { gridPinnedColumnsSelector } from './gridColumnPinningSelector';
|
|
@@ -33,49 +33,6 @@ export const useGridColumnPinning = (apiRef, props) => {
|
|
|
33
33
|
var _props$initialState4;
|
|
34
34
|
const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector);
|
|
35
35
|
const theme = useTheme();
|
|
36
|
-
// Each visible row (not to be confused with a filter result) is composed of a central .MuiDataGrid-row element
|
|
37
|
-
// and up to two additional .MuiDataGrid-row's, one for the columns pinned to the left and another
|
|
38
|
-
// for those on the right side. When hovering any of these elements, the :hover styles are applied only to
|
|
39
|
-
// the row element that was actually hovered, not its additional siblings. To make it look like a contiguous row,
|
|
40
|
-
// this method adds/removes the .Mui-hovered class to all of the row elements inside one visible row.
|
|
41
|
-
const updateHoveredClassOnSiblingRows = React.useCallback(event => {
|
|
42
|
-
var _pinnedColumns$left$l, _pinnedColumns$left, _pinnedColumns$right$, _pinnedColumns$right;
|
|
43
|
-
if (props.disableColumnPinning) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (!Array.isArray(pinnedColumns.left) && !Array.isArray(pinnedColumns.right)) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const nbLeftPinnedColumns = (_pinnedColumns$left$l = (_pinnedColumns$left = pinnedColumns.left) == null ? void 0 : _pinnedColumns$left.length) != null ? _pinnedColumns$left$l : 0;
|
|
50
|
-
const nbRightPinnedColumns = (_pinnedColumns$right$ = (_pinnedColumns$right = pinnedColumns.right) == null ? void 0 : _pinnedColumns$right.length) != null ? _pinnedColumns$right$ : 0;
|
|
51
|
-
if (nbLeftPinnedColumns + nbRightPinnedColumns === 0) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const rowContainer = apiRef.current.virtualScrollerRef.current;
|
|
55
|
-
if (!rowContainer) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
const index = event.currentTarget.dataset.rowindex;
|
|
59
|
-
const rowElements = rowContainer.querySelectorAll(`.${gridClasses.row}[data-rowindex="${index}"]`);
|
|
60
|
-
rowElements.forEach(row => {
|
|
61
|
-
// Ignore rows from other grid inside the hovered row
|
|
62
|
-
if (row.closest(`.${gridClasses.virtualScroller}`) === apiRef.current.virtualScrollerRef.current) {
|
|
63
|
-
if (event.type === 'mouseenter') {
|
|
64
|
-
row.classList.add('Mui-hovered');
|
|
65
|
-
} else {
|
|
66
|
-
row.classList.remove('Mui-hovered');
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}, [apiRef, pinnedColumns.left, pinnedColumns.right, props.disableColumnPinning]);
|
|
71
|
-
const handleMouseEnter = React.useCallback((params, event) => {
|
|
72
|
-
updateHoveredClassOnSiblingRows(event);
|
|
73
|
-
}, [updateHoveredClassOnSiblingRows]);
|
|
74
|
-
const handleMouseLeave = React.useCallback((params, event) => {
|
|
75
|
-
updateHoveredClassOnSiblingRows(event);
|
|
76
|
-
}, [updateHoveredClassOnSiblingRows]);
|
|
77
|
-
useGridApiEventHandler(apiRef, 'rowMouseEnter', handleMouseEnter);
|
|
78
|
-
useGridApiEventHandler(apiRef, 'rowMouseLeave', handleMouseLeave);
|
|
79
36
|
|
|
80
37
|
/**
|
|
81
38
|
* PRE-PROCESSING
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { GridColDef } from '@mui/x-data-grid';
|
|
2
|
+
export declare const DEFAULT_GRID_AUTOSIZE_OPTIONS: {
|
|
3
|
+
includeHeaders: boolean;
|
|
4
|
+
includeOutliers: boolean;
|
|
5
|
+
outliersFactor: number;
|
|
6
|
+
expand: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type GridAutosizeOptions = {
|
|
9
|
+
/**
|
|
10
|
+
* The columns to autosize. By default, applies to all columns.
|
|
11
|
+
*/
|
|
12
|
+
columns?: GridColDef['field'][];
|
|
13
|
+
/**
|
|
14
|
+
* If true, include the header widths in the calculation.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
includeHeaders?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If true, width outliers will be ignored.
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
includeOutliers?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The IQR factor range to detect outliers.
|
|
25
|
+
* @default 1.5
|
|
26
|
+
*/
|
|
27
|
+
outliersFactor?: number;
|
|
28
|
+
/**
|
|
29
|
+
* If the total width is less than the available width, expand columns to fill it.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
expand?: boolean;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The Resize API interface that is available in the grid `apiRef`.
|
|
36
|
+
*/
|
|
37
|
+
export interface GridColumnResizeApi {
|
|
38
|
+
/**
|
|
39
|
+
* Auto-size the columns of the grid based on the cells' content and the space available.
|
|
40
|
+
* @param {GridAutosizeOptions} options The autosizing options
|
|
41
|
+
* @returns {Promise} A promise that resolves when autosizing is completed
|
|
42
|
+
*/
|
|
43
|
+
autosizeColumns: (options?: GridAutosizeOptions) => Promise<void>;
|
|
44
|
+
}
|
|
@@ -7,4 +7,4 @@ export declare const columnResizeStateInitializer: GridStateInitializer;
|
|
|
7
7
|
* @requires useGridColumns (method, event)
|
|
8
8
|
* TODO: improve experience for last column
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridColumnResize: (apiRef: React.MutableRefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, 'onColumnResize' | 'onColumnWidthChange'>) => void;
|
|
10
|
+
export declare const useGridColumnResize: (apiRef: React.MutableRefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, 'autosizeOptions' | 'autosizeOnMount' | 'disableAutosize' | 'onColumnResize' | 'onColumnWidthChange'>) => void;
|