@mui/x-data-grid 8.9.1 → 8.9.2
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 +96 -2
- package/DataGrid/DataGrid.js +5 -0
- package/DataGrid/useDataGridComponent.js +2 -0
- package/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/components/GridDetailPanels.d.ts +2 -2
- package/components/GridPinnedRows.d.ts +2 -2
- package/components/GridRow.js +5 -0
- package/components/cell/GridCell.js +7 -5
- package/components/cell/GridEditSingleSelectCell.js +1 -1
- package/components/columnsManagement/GridColumnsManagement.d.ts +6 -0
- package/components/columnsManagement/GridColumnsManagement.js +17 -5
- package/components/containers/GridRootStyles.d.ts +1 -1
- package/components/toolbarV8/Toolbar.d.ts +1 -1
- package/components/virtualization/GridVirtualScroller.js +5 -5
- package/constants/dataGridPropsDefaultValues.js +1 -0
- package/esm/DataGrid/DataGrid.js +5 -0
- package/esm/DataGrid/useDataGridComponent.js +2 -0
- package/esm/colDef/gridCheckboxSelectionColDef.js +1 -0
- package/esm/components/GridDetailPanels.d.ts +2 -2
- package/esm/components/GridPinnedRows.d.ts +2 -2
- package/esm/components/GridRow.js +5 -0
- package/esm/components/cell/GridCell.js +7 -5
- package/esm/components/cell/GridEditSingleSelectCell.js +1 -1
- package/esm/components/columnsManagement/GridColumnsManagement.d.ts +6 -0
- package/esm/components/columnsManagement/GridColumnsManagement.js +17 -5
- package/esm/components/containers/GridRootStyles.d.ts +1 -1
- package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
- package/esm/components/virtualization/GridVirtualScroller.js +5 -5
- package/esm/constants/dataGridPropsDefaultValues.js +1 -0
- package/esm/hooks/core/useGridVirtualizer.d.ts +9 -0
- package/esm/hooks/core/useGridVirtualizer.js +223 -0
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -2
- package/esm/hooks/features/columns/useGridColumnSpanning.js +5 -90
- package/esm/hooks/features/dimensions/useGridDimensions.js +18 -188
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -1
- package/esm/hooks/features/keyboardNavigation/utils.d.ts +3 -3
- package/esm/hooks/features/keyboardNavigation/utils.js +5 -5
- package/esm/hooks/features/pivoting/gridPivotingInterfaces.d.ts +0 -1
- package/esm/hooks/features/pivoting/gridPivotingSelectors.d.ts +1 -4
- package/esm/hooks/features/pivoting/gridPivotingSelectors.js +1 -2
- package/esm/hooks/features/rows/gridRowsMetaInterfaces.d.ts +2 -8
- package/esm/hooks/features/rows/gridRowsMetaState.d.ts +2 -18
- package/esm/hooks/features/rows/useGridRowAriaAttributes.js +3 -1
- package/esm/hooks/features/rows/useGridRowSpanning.d.ts +2 -12
- package/esm/hooks/features/rows/useGridRowSpanning.js +54 -85
- package/esm/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/esm/hooks/features/rows/useGridRowsMeta.js +17 -187
- package/esm/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +1 -1
- package/esm/hooks/features/virtualization/index.d.ts +1 -0
- package/esm/hooks/features/virtualization/index.js +1 -0
- package/esm/hooks/features/virtualization/useGridVirtualization.d.ts +5 -16
- package/esm/hooks/features/virtualization/useGridVirtualization.js +41 -22
- package/esm/hooks/utils/index.d.ts +1 -1
- package/esm/hooks/utils/index.js +1 -1
- package/esm/hooks/utils/useFirstRender.d.ts +1 -1
- package/esm/hooks/utils/useFirstRender.js +1 -8
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +1 -1
- package/esm/internals/index.js +1 -1
- package/esm/internals/utils/getPinnedCellOffset.js +5 -0
- package/esm/locales/frFR.js +18 -21
- package/esm/locales/heIL.js +12 -12
- package/esm/locales/plPL.js +22 -24
- package/esm/models/api/gridApiCommon.d.ts +4 -1
- package/esm/models/api/gridColumnSpanning.d.ts +5 -11
- package/esm/models/props/DataGridProps.d.ts +5 -0
- package/esm/utils/roundToDecimalPlaces.d.ts +1 -1
- package/esm/utils/roundToDecimalPlaces.js +1 -3
- package/hooks/core/useGridVirtualizer.d.ts +9 -0
- package/hooks/core/useGridVirtualizer.js +231 -0
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -3
- package/hooks/features/columns/useGridColumnSpanning.js +5 -91
- package/hooks/features/dimensions/useGridDimensions.js +18 -188
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -1
- package/hooks/features/keyboardNavigation/utils.d.ts +3 -3
- package/hooks/features/keyboardNavigation/utils.js +5 -5
- package/hooks/features/pivoting/gridPivotingInterfaces.d.ts +0 -1
- package/hooks/features/pivoting/gridPivotingSelectors.d.ts +1 -4
- package/hooks/features/pivoting/gridPivotingSelectors.js +2 -3
- package/hooks/features/rows/gridRowsMetaInterfaces.d.ts +2 -8
- package/hooks/features/rows/gridRowsMetaState.d.ts +2 -18
- package/hooks/features/rows/useGridRowAriaAttributes.js +3 -1
- package/hooks/features/rows/useGridRowSpanning.d.ts +2 -12
- package/hooks/features/rows/useGridRowSpanning.js +54 -85
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/rows/useGridRowsMeta.js +15 -186
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +1 -1
- package/hooks/features/virtualization/index.d.ts +1 -0
- package/hooks/features/virtualization/index.js +12 -0
- package/hooks/features/virtualization/useGridVirtualization.d.ts +5 -16
- package/hooks/features/virtualization/useGridVirtualization.js +42 -24
- package/hooks/utils/index.d.ts +1 -1
- package/hooks/utils/index.js +12 -12
- package/hooks/utils/useFirstRender.d.ts +1 -1
- package/hooks/utils/useFirstRender.js +11 -11
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +4 -11
- package/internals/utils/getPinnedCellOffset.js +5 -0
- package/locales/frFR.js +18 -21
- package/locales/heIL.js +12 -12
- package/locales/plPL.js +22 -24
- package/models/api/gridApiCommon.d.ts +4 -1
- package/models/api/gridColumnSpanning.d.ts +5 -11
- package/models/props/DataGridProps.d.ts +5 -0
- package/package.json +5 -5
- package/utils/roundToDecimalPlaces.d.ts +1 -1
- package/utils/roundToDecimalPlaces.js +7 -4
- package/esm/hooks/features/rows/gridRowSpanningSelectors.d.ts +0 -10
- package/esm/hooks/features/rows/gridRowSpanningSelectors.js +0 -5
- package/esm/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -56
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +0 -843
- package/esm/hooks/utils/useRunOnce.d.ts +0 -5
- package/esm/hooks/utils/useRunOnce.js +0 -18
- package/esm/utils/platform.d.ts +0 -1
- package/esm/utils/platform.js +0 -2
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +0 -10
- package/hooks/features/rows/gridRowSpanningSelectors.js +0 -11
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -56
- package/hooks/features/virtualization/useGridVirtualScroller.js +0 -854
- package/hooks/utils/useRunOnce.d.ts +0 -5
- package/hooks/utils/useRunOnce.js +0 -27
- package/utils/platform.d.ts +0 -1
- package/utils/platform.js +0 -8
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,100 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.9.2
|
|
9
|
+
|
|
10
|
+
_Jul 31, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 23 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🌎 Improve French (fr-FR), Hebrew (he-IL) and Polish (pl-PL) locales on the Data Grid
|
|
15
|
+
- 🌎 Improve Korean (ko-KR) locale on the Date and Time Pickers
|
|
16
|
+
- 📈 Add symlog scale to charts
|
|
17
|
+
- 📊 Fix bar border radius on Firefox
|
|
18
|
+
- 🐞 Bugfixes
|
|
19
|
+
- 📚 Documentation improvements
|
|
20
|
+
|
|
21
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
22
|
+
@AmrElnaggar99, @atlanteh, @ddolcimascolo, @Jiseoup, @leonaha5, @noherczeg, @sai6855
|
|
23
|
+
|
|
24
|
+
The following are all team members who have contributed to this release:
|
|
25
|
+
@alexfauquette, @arminmeh, @bernardobelchior, @bharatkashyap, @brijeshb42, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @KenanYusuf, @LukasTy, @mapache-salvaje, @MBilalShafi, @rita-codes, @romgrk, @siriwatknp
|
|
26
|
+
|
|
27
|
+
### Data Grid
|
|
28
|
+
|
|
29
|
+
#### `@mui/x-data-grid@8.9.2`
|
|
30
|
+
|
|
31
|
+
- [DataGrid] Add debounce for columns panel search (#18719) @noherczeg
|
|
32
|
+
- [DataGrid] Extract virtualization engine (#18275) @romgrk
|
|
33
|
+
- [DataGrid] Improve types in `<GridEditSingleSelect />` (#18184) @sai6855
|
|
34
|
+
- [l10n] Improve French (fr-FR) locale (#18905) @ddolcimascolo
|
|
35
|
+
- [l10n] Improve Hebrew (he-IL) locale (#18665) @atlanteh
|
|
36
|
+
- [l10n] Improve Polish (pl-PL) locale (#18068) @leonaha5
|
|
37
|
+
|
|
38
|
+
#### `@mui/x-data-grid-pro@8.9.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
39
|
+
|
|
40
|
+
Same changes as in `@mui/x-data-grid@8.9.2`, plus:
|
|
41
|
+
|
|
42
|
+
- [DataGridPro] Fix duplicate nested rows for dynamically updated row IDs (#18526) @MBilalShafi
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-data-grid-premium@8.9.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
45
|
+
|
|
46
|
+
Same changes as in `@mui/x-data-grid-pro@8.9.2`, plus:
|
|
47
|
+
|
|
48
|
+
- [DataGridPremium] Add `privateMode` to AI assistant prompt resolver (#18759) @bharatkashyap
|
|
49
|
+
- [DataGridPremium] Fix empty nested group values caused by main criterial `valueFormatter()` (#18916) @cherniavskii
|
|
50
|
+
- [DataGridPremium] Sidebar content and state is managed the same way as for preference panel (#18741) @arminmeh
|
|
51
|
+
- [DataGridPremium] Make `api` param for the aggregation function optional (#18984) @arminmeh
|
|
52
|
+
|
|
53
|
+
### Date and Time Pickers
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-date-pickers@8.9.2`
|
|
56
|
+
|
|
57
|
+
- [l10n] Improve Korean (ko-KR) locale (#18664) @Jiseoup
|
|
58
|
+
- [pickers] Fix popper click-away behavior (#18804) @LukasTy
|
|
59
|
+
- [pickers] Fix usage not in main document (#18944) @LukasTy
|
|
60
|
+
|
|
61
|
+
#### `@mui/x-date-pickers-pro@8.9.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
62
|
+
|
|
63
|
+
Same changes as in `@mui/x-date-pickers@8.9.2`.
|
|
64
|
+
|
|
65
|
+
### Charts
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-charts@8.9.2`
|
|
68
|
+
|
|
69
|
+
- [charts] Add symlog scale to charts (#18729) @bernardobelchior
|
|
70
|
+
- [charts] Fix bar border radius on Firefox (#18824) @bernardobelchior
|
|
71
|
+
- [charts] Fix crash when rendering large scatter dataset (#18845) @bernardobelchior
|
|
72
|
+
- [charts] Remove unnecessary type assertion in tooltip `valueFormatter()` (#18877) @sai6855
|
|
73
|
+
- [charts] Export `ChartsWrapper` from `'./ChartsWrapper'` rather than `'./internals'` (#18966) @JCQuintas
|
|
74
|
+
|
|
75
|
+
#### `@mui/x-charts-pro@8.9.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
76
|
+
|
|
77
|
+
Same changes as in `@mui/x-charts@8.9.2`, plus:
|
|
78
|
+
|
|
79
|
+
- [charts-pro] Fix voronoi interaction with zoom (#18950) @alexfauquette
|
|
80
|
+
- [charts-pro] Hide toolbar by default when exporting (#18764) @bernardobelchior
|
|
81
|
+
|
|
82
|
+
### Codemod
|
|
83
|
+
|
|
84
|
+
#### `@mui/x-codemod@8.9.2`
|
|
85
|
+
|
|
86
|
+
Internal changes.
|
|
87
|
+
|
|
88
|
+
### Docs
|
|
89
|
+
|
|
90
|
+
- [docs] Add Data Grid demo pages (#18180) @KenanYusuf
|
|
91
|
+
- [docs] Copyedit the Charts Overview page (#18840) @mapache-salvaje
|
|
92
|
+
- [docs] Fix incorrect parameter name in pickers "Custom components" page from `variant` to `pickerVariant` (#18919) @AmrElnaggar99
|
|
93
|
+
|
|
94
|
+
### Miscellaneous
|
|
95
|
+
|
|
96
|
+
- [code-infra] Auto-generate deep exports to prevent asymmetric exports (#18917) @JCQuintas
|
|
97
|
+
- [docs-infra] Turn on "Edit in Chat" for X docs (#18869) @siriwatknp
|
|
98
|
+
- [infra] Add specific bundle size tracking (#18884) @Janpot
|
|
99
|
+
- [infra] Fix markdown formatting in llms generation (#18914) @Janpot
|
|
100
|
+
- [infra] Use CI action from mui-public (#18709) @brijeshb42
|
|
101
|
+
|
|
8
102
|
## 8.9.1
|
|
9
103
|
|
|
10
104
|
_Jul 21, 2025_
|
|
@@ -23,11 +117,11 @@ The following are all team members who have contributed to this release:
|
|
|
23
117
|
- [DataGrid] Move conditional list view column logic into `gridVisibleColumnDefinitionsSelector` (#18724) @KenanYusuf
|
|
24
118
|
- [DataGrid] Fix row selection "exclude" model inconsistency (#18844) @MBilalShafi
|
|
25
119
|
|
|
26
|
-
#### `@mui/x-data-grid-pro@8.9.1` [](https://mui.com/r/x-pro-svg-link
|
|
120
|
+
#### `@mui/x-data-grid-pro@8.9.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
27
121
|
|
|
28
122
|
Same changes as in `@mui/x-data-grid@8.9.1`.
|
|
29
123
|
|
|
30
|
-
#### `@mui/x-data-grid-premium@8.9.1` [](https://mui.com/r/x-premium-svg-link
|
|
124
|
+
#### `@mui/x-data-grid-premium@8.9.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
31
125
|
|
|
32
126
|
Same changes as in `@mui/x-data-grid-pro@8.9.1`.
|
|
33
127
|
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -133,6 +133,11 @@ DataGridRaw.propTypes = {
|
|
|
133
133
|
* @default 150
|
|
134
134
|
*/
|
|
135
135
|
columnBufferPx: _propTypes.default.number,
|
|
136
|
+
/**
|
|
137
|
+
* The milliseconds delay to wait after a keystroke before triggering filtering in the columns menu.
|
|
138
|
+
* @default 150
|
|
139
|
+
*/
|
|
140
|
+
columnFilterDebounceMs: _propTypes.default.number,
|
|
136
141
|
/**
|
|
137
142
|
* Sets the height in pixels of the column group headers in the Data Grid.
|
|
138
143
|
* Inherits the `columnHeaderHeight` value if not set.
|
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useDataGridComponent = void 0;
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _useGridInitialization = require("../hooks/core/useGridInitialization");
|
|
11
|
+
var _useGridVirtualizer = require("../hooks/core/useGridVirtualizer");
|
|
11
12
|
var _useGridInitializeState = require("../hooks/utils/useGridInitializeState");
|
|
12
13
|
var _useGridClipboard = require("../hooks/features/clipboard/useGridClipboard");
|
|
13
14
|
var _useGridColumnMenu = require("../hooks/features/columnMenu/useGridColumnMenu");
|
|
@@ -71,6 +72,7 @@ const useDataGridComponent = (apiRef, props) => {
|
|
|
71
72
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridDimensions.dimensionsStateInitializer, apiRef, props);
|
|
72
73
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridRowsMeta.rowsMetaStateInitializer, apiRef, props);
|
|
73
74
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridListView.listViewStateInitializer, apiRef, props);
|
|
75
|
+
(0, _useGridVirtualizer.useGridVirtualizer)(apiRef, props);
|
|
74
76
|
(0, _useGridKeyboardNavigation.useGridKeyboardNavigation)(apiRef, props);
|
|
75
77
|
(0, _useGridRowSelection.useGridRowSelection)(apiRef, props);
|
|
76
78
|
(0, _useGridColumns.useGridColumns)(apiRef, props);
|
|
@@ -32,6 +32,7 @@ const GRID_CHECKBOX_SELECTION_COL_DEF = exports.GRID_CHECKBOX_SELECTION_COL_DEF
|
|
|
32
32
|
const rowId = (0, _gridPropsSelectors.gridRowIdSelector)(apiRef, row);
|
|
33
33
|
return apiRef.current.isRowSelected(rowId);
|
|
34
34
|
},
|
|
35
|
+
rowSpanValueGetter: (_, row, column, apiRef) => (0, _gridPropsSelectors.gridRowIdSelector)(apiRef, row),
|
|
35
36
|
renderHeader: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridHeaderCheckbox.GridHeaderCheckbox, (0, _extends2.default)({}, params)),
|
|
36
37
|
renderCell: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridCellCheckboxRenderer.GridCellCheckboxRenderer, (0, _extends2.default)({}, params))
|
|
37
38
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VirtualScrollerCompat } from '@mui/x-virtualizer';
|
|
2
2
|
export interface GridDetailPanelsProps {
|
|
3
|
-
virtualScroller:
|
|
3
|
+
virtualScroller: VirtualScrollerCompat;
|
|
4
4
|
}
|
|
5
5
|
export declare function GridDetailPanels(_: GridDetailPanelsProps): null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VirtualScrollerCompat } from '@mui/x-virtualizer';
|
|
2
2
|
export interface GridPinnedRowsProps {
|
|
3
3
|
position: 'top' | 'bottom';
|
|
4
|
-
virtualScroller:
|
|
4
|
+
virtualScroller: VirtualScrollerCompat;
|
|
5
5
|
}
|
|
6
6
|
export declare function GridPinnedRows(_: GridPinnedRowsProps): null;
|
package/components/GridRow.js
CHANGED
|
@@ -209,6 +209,11 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
209
209
|
});
|
|
210
210
|
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
211
211
|
}
|
|
212
|
+
|
|
213
|
+
// XXX: fix this properly
|
|
214
|
+
if (!rowNode) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
212
217
|
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = _constants.PinnedColumnPosition.NONE) => {
|
|
213
218
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
214
219
|
if (cellColSpanInfo?.spannedByColSpan) {
|
|
@@ -19,6 +19,8 @@ var _capitalize = _interopRequireDefault(require("@mui/utils/capitalize"));
|
|
|
19
19
|
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
20
20
|
var _RtlProvider = require("@mui/system/RtlProvider");
|
|
21
21
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
22
|
+
var _store = require("@mui/x-internals/store");
|
|
23
|
+
var _xVirtualizer = require("@mui/x-virtualizer");
|
|
22
24
|
var _doesSupportPreventScroll = require("../../utils/doesSupportPreventScroll");
|
|
23
25
|
var _gridClasses = require("../../constants/gridClasses");
|
|
24
26
|
var _models = require("../../models");
|
|
@@ -27,7 +29,6 @@ var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
|
27
29
|
var _gridFocusStateSelector = require("../../hooks/features/focus/gridFocusStateSelector");
|
|
28
30
|
var _gridColumnsInterfaces = require("../../hooks/features/columns/gridColumnsInterfaces");
|
|
29
31
|
var _constants = require("../../internals/constants");
|
|
30
|
-
var _gridRowSpanningSelectors = require("../../hooks/features/rows/gridRowSpanningSelectors");
|
|
31
32
|
var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
|
|
32
33
|
var _gridEditingSelectors = require("../../hooks/features/editing/gridEditingSelectors");
|
|
33
34
|
var _utils = require("../../internals/utils");
|
|
@@ -123,8 +124,9 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
123
124
|
id: rowId,
|
|
124
125
|
field
|
|
125
126
|
}));
|
|
126
|
-
const
|
|
127
|
-
const
|
|
127
|
+
const store = apiRef.current.virtualizer.store;
|
|
128
|
+
const hiddenCells = (0, _store.useStore)(store, _xVirtualizer.Rowspan.selectors.hiddenCells);
|
|
129
|
+
const spannedCells = (0, _store.useStore)(store, _xVirtualizer.Rowspan.selectors.spannedCells);
|
|
128
130
|
const {
|
|
129
131
|
hasFocus,
|
|
130
132
|
isEditable = false,
|
|
@@ -193,8 +195,8 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
193
195
|
propHandler(event);
|
|
194
196
|
}
|
|
195
197
|
}, [apiRef, field, rowId]);
|
|
196
|
-
const isCellRowSpanned = hiddenCells[rowId]?.[
|
|
197
|
-
const rowSpan = spannedCells[rowId]?.[
|
|
198
|
+
const isCellRowSpanned = hiddenCells[rowId]?.[colIndex] ?? false;
|
|
199
|
+
const rowSpan = spannedCells[rowId]?.[colIndex] ?? 1;
|
|
198
200
|
const style = React.useMemo(() => {
|
|
199
201
|
if (isNotVisible) {
|
|
200
202
|
return {
|
|
@@ -22,7 +22,7 @@ var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen", "slotProps"];
|
|
24
24
|
function isKeyboardEvent(event) {
|
|
25
|
-
return !!event.key;
|
|
25
|
+
return 'key' in event && !!event.key;
|
|
26
26
|
}
|
|
27
27
|
function GridEditSingleSelectCell(props) {
|
|
28
28
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TextFieldProps } from "../../models/gridBaseSlots.js";
|
|
3
|
+
import type { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
|
|
3
4
|
import type { GridColDef } from "../../models/colDef/gridColDef.js";
|
|
4
5
|
export interface GridColumnsManagementProps {
|
|
5
6
|
sort?: 'asc' | 'desc';
|
|
6
7
|
searchPredicate?: (column: GridColDef, searchValue: string) => boolean;
|
|
7
8
|
searchInputProps?: Partial<TextFieldProps>;
|
|
9
|
+
/**
|
|
10
|
+
* The milliseconds delay to wait after a keystroke before triggering filtering in the columns menu.
|
|
11
|
+
* @default 150
|
|
12
|
+
*/
|
|
13
|
+
searchDebounceMs?: DataGridProcessedProps['columnFilterDebounceMs'];
|
|
8
14
|
/**
|
|
9
15
|
* If `true`, the column search field will be focused automatically.
|
|
10
16
|
* If `false`, the first column switch input will be focused automatically.
|
|
@@ -12,6 +12,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
|
+
var _debounce = _interopRequireDefault(require("@mui/utils/debounce"));
|
|
15
16
|
var _styles = require("@mui/material/styles");
|
|
16
17
|
var _InputBase = require("@mui/material/InputBase");
|
|
17
18
|
var _cssVariables = require("../../constants/cssVariables");
|
|
@@ -59,8 +60,12 @@ function GridColumnsManagement(props) {
|
|
|
59
60
|
disableResetButton = false,
|
|
60
61
|
toggleAllMode = 'all',
|
|
61
62
|
getTogglableColumns,
|
|
62
|
-
searchInputProps
|
|
63
|
+
searchInputProps,
|
|
64
|
+
searchDebounceMs = rootProps.columnFilterDebounceMs
|
|
63
65
|
} = props;
|
|
66
|
+
const debouncedFilter = React.useMemo(() => (0, _debounce.default)(value => {
|
|
67
|
+
setSearchValue(value);
|
|
68
|
+
}, searchDebounceMs ?? 150), [searchDebounceMs]);
|
|
64
69
|
const isResetDisabled = React.useMemo(() => (0, _utils.checkColumnVisibilityModelsSame)(columnVisibilityModel, initialColumnVisibilityModel), [columnVisibilityModel, initialColumnVisibilityModel]);
|
|
65
70
|
const sortedColumns = React.useMemo(() => {
|
|
66
71
|
switch (sort) {
|
|
@@ -105,8 +110,8 @@ function GridColumnsManagement(props) {
|
|
|
105
110
|
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
106
111
|
}, [apiRef, columns, getTogglableColumns, toggleAllMode, currentColumns]);
|
|
107
112
|
const handleSearchValueChange = React.useCallback(event => {
|
|
108
|
-
|
|
109
|
-
}, []);
|
|
113
|
+
debouncedFilter(event.target.value);
|
|
114
|
+
}, [debouncedFilter]);
|
|
110
115
|
const hideableColumns = React.useMemo(() => currentColumns.filter(col => col.hideable), [currentColumns]);
|
|
111
116
|
const allHideableColumnsVisible = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] == null || columnVisibilityModel[column.field] !== false), [columnVisibilityModel, hideableColumns]);
|
|
112
117
|
const allHideableColumnsHidden = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] === false), [columnVisibilityModel, hideableColumns]);
|
|
@@ -128,7 +133,10 @@ function GridColumnsManagement(props) {
|
|
|
128
133
|
};
|
|
129
134
|
const handleSearchReset = React.useCallback(() => {
|
|
130
135
|
setSearchValue('');
|
|
131
|
-
searchInputRef.current
|
|
136
|
+
if (searchInputRef.current) {
|
|
137
|
+
searchInputRef.current.value = '';
|
|
138
|
+
searchInputRef.current.focus();
|
|
139
|
+
}
|
|
132
140
|
}, []);
|
|
133
141
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
134
142
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(GridColumnsManagementHeader, {
|
|
@@ -140,7 +148,6 @@ function GridColumnsManagement(props) {
|
|
|
140
148
|
placeholder: apiRef.current.getLocaleText('columnsManagementSearchTitle'),
|
|
141
149
|
inputRef: searchInputRef,
|
|
142
150
|
className: classes.searchInput,
|
|
143
|
-
value: searchValue,
|
|
144
151
|
onChange: handleSearchValueChange,
|
|
145
152
|
size: "small",
|
|
146
153
|
type: "search",
|
|
@@ -243,6 +250,11 @@ process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
|
|
|
243
250
|
* @returns {GridColDef['field'][]} The list of togglable columns' field names.
|
|
244
251
|
*/
|
|
245
252
|
getTogglableColumns: _propTypes.default.func,
|
|
253
|
+
/**
|
|
254
|
+
* The milliseconds delay to wait after a keystroke before triggering filtering in the columns menu.
|
|
255
|
+
* @default 150
|
|
256
|
+
*/
|
|
257
|
+
searchDebounceMs: _propTypes.default.number,
|
|
246
258
|
searchInputProps: _propTypes.default.object,
|
|
247
259
|
searchPredicate: _propTypes.default.func,
|
|
248
260
|
sort: _propTypes.default.oneOf(['asc', 'desc']),
|
|
@@ -2,4 +2,4 @@ import { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
|
|
|
2
2
|
export type OwnerState = DataGridProcessedProps;
|
|
3
3
|
export declare const GridRootStyles: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
4
4
|
ownerState: OwnerState;
|
|
5
|
-
}, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").
|
|
5
|
+
}, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
@@ -6,7 +6,7 @@ export type ToolbarProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
6
6
|
*/
|
|
7
7
|
render?: RenderProp<React.ComponentProps<typeof ToolbarRoot>>;
|
|
8
8
|
};
|
|
9
|
-
declare const ToolbarRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.
|
|
9
|
+
declare const ToolbarRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
10
10
|
/**
|
|
11
11
|
* The top level Toolbar component that provides context to child components.
|
|
12
12
|
* It renders a styled `<div />` element.
|
|
@@ -11,12 +11,12 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _system = require("@mui/system");
|
|
12
12
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
13
13
|
var _gridDimensionsSelectors = require("../../hooks/features/dimensions/gridDimensionsSelectors");
|
|
14
|
+
var _rows = require("../../hooks/features/rows");
|
|
14
15
|
var _GridScrollArea = require("../GridScrollArea");
|
|
15
16
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
16
|
-
var
|
|
17
|
+
var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
|
|
17
18
|
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
18
19
|
var _gridClasses = require("../../constants/gridClasses");
|
|
19
|
-
var _useGridVirtualScroller = require("../../hooks/features/virtualization/useGridVirtualScroller");
|
|
20
20
|
var _useGridOverlays = require("../../hooks/features/overlays/useGridOverlays");
|
|
21
21
|
var _GridHeaders = require("../GridHeaders");
|
|
22
22
|
var _GridMainContainer = require("./GridMainContainer");
|
|
@@ -69,7 +69,7 @@ const Scroller = (0, _system.styled)('div', {
|
|
|
69
69
|
});
|
|
70
70
|
const hasPinnedRightSelector = apiRef => apiRef.current.state.dimensions.rightPinnedWidth > 0;
|
|
71
71
|
function GridVirtualScroller(props) {
|
|
72
|
-
const apiRef = (0,
|
|
72
|
+
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
73
73
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
74
74
|
const hasScrollY = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridHasScrollYSelector);
|
|
75
75
|
const hasScrollX = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridHasScrollXSelector);
|
|
@@ -85,7 +85,7 @@ function GridVirtualScroller(props) {
|
|
|
85
85
|
hasPinnedRight
|
|
86
86
|
}, overlaysProps);
|
|
87
87
|
const classes = useUtilityClasses(ownerState);
|
|
88
|
-
const virtualScroller =
|
|
88
|
+
const virtualScroller = apiRef.current.virtualizer.api.useVirtualization().getters;
|
|
89
89
|
const {
|
|
90
90
|
getContainerProps,
|
|
91
91
|
getScrollerProps,
|
|
@@ -96,7 +96,7 @@ function GridVirtualScroller(props) {
|
|
|
96
96
|
getRows,
|
|
97
97
|
getScrollAreaProps
|
|
98
98
|
} = virtualScroller;
|
|
99
|
-
const rows = getRows();
|
|
99
|
+
const rows = getRows(undefined, (0, _rows.gridRowTreeSelector)(apiRef));
|
|
100
100
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridMainContainer.GridMainContainer, (0, _extends2.default)({
|
|
101
101
|
className: classes.root
|
|
102
102
|
}, getContainerProps(), {
|
|
@@ -16,6 +16,7 @@ const DATA_GRID_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PROPS_DEFAULT_VALUES =
|
|
|
16
16
|
checkboxSelectionVisibleOnly: false,
|
|
17
17
|
clipboardCopyCellDelimiter: '\t',
|
|
18
18
|
columnBufferPx: 150,
|
|
19
|
+
columnFilterDebounceMs: 150,
|
|
19
20
|
columnHeaderHeight: 56,
|
|
20
21
|
disableAutosize: false,
|
|
21
22
|
disableColumnFilter: false,
|
package/esm/DataGrid/DataGrid.js
CHANGED
|
@@ -126,6 +126,11 @@ DataGridRaw.propTypes = {
|
|
|
126
126
|
* @default 150
|
|
127
127
|
*/
|
|
128
128
|
columnBufferPx: PropTypes.number,
|
|
129
|
+
/**
|
|
130
|
+
* The milliseconds delay to wait after a keystroke before triggering filtering in the columns menu.
|
|
131
|
+
* @default 150
|
|
132
|
+
*/
|
|
133
|
+
columnFilterDebounceMs: PropTypes.number,
|
|
129
134
|
/**
|
|
130
135
|
* Sets the height in pixels of the column group headers in the Data Grid.
|
|
131
136
|
* Inherits the `columnHeaderHeight` value if not set.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useGridInitialization } from "../hooks/core/useGridInitialization.js";
|
|
5
|
+
import { useGridVirtualizer } from "../hooks/core/useGridVirtualizer.js";
|
|
5
6
|
import { useGridInitializeState } from "../hooks/utils/useGridInitializeState.js";
|
|
6
7
|
import { useGridClipboard } from "../hooks/features/clipboard/useGridClipboard.js";
|
|
7
8
|
import { columnMenuStateInitializer, useGridColumnMenu } from "../hooks/features/columnMenu/useGridColumnMenu.js";
|
|
@@ -65,6 +66,7 @@ export const useDataGridComponent = (apiRef, props) => {
|
|
|
65
66
|
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
|
|
66
67
|
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
67
68
|
useGridInitializeState(listViewStateInitializer, apiRef, props);
|
|
69
|
+
useGridVirtualizer(apiRef, props);
|
|
68
70
|
useGridKeyboardNavigation(apiRef, props);
|
|
69
71
|
useGridRowSelection(apiRef, props);
|
|
70
72
|
useGridColumns(apiRef, props);
|
|
@@ -24,6 +24,7 @@ export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF
|
|
|
24
24
|
const rowId = gridRowIdSelector(apiRef, row);
|
|
25
25
|
return apiRef.current.isRowSelected(rowId);
|
|
26
26
|
},
|
|
27
|
+
rowSpanValueGetter: (_, row, column, apiRef) => gridRowIdSelector(apiRef, row),
|
|
27
28
|
renderHeader: params => /*#__PURE__*/_jsx(GridHeaderCheckbox, _extends({}, params)),
|
|
28
29
|
renderCell: params => /*#__PURE__*/_jsx(GridCellCheckboxRenderer, _extends({}, params))
|
|
29
30
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VirtualScrollerCompat } from '@mui/x-virtualizer';
|
|
2
2
|
export interface GridDetailPanelsProps {
|
|
3
|
-
virtualScroller:
|
|
3
|
+
virtualScroller: VirtualScrollerCompat;
|
|
4
4
|
}
|
|
5
5
|
export declare function GridDetailPanels(_: GridDetailPanelsProps): null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VirtualScrollerCompat } from '@mui/x-virtualizer';
|
|
2
2
|
export interface GridPinnedRowsProps {
|
|
3
3
|
position: 'top' | 'bottom';
|
|
4
|
-
virtualScroller:
|
|
4
|
+
virtualScroller: VirtualScrollerCompat;
|
|
5
5
|
}
|
|
6
6
|
export declare function GridPinnedRows(_: GridPinnedRowsProps): null;
|
|
@@ -202,6 +202,11 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
202
202
|
});
|
|
203
203
|
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
204
204
|
}
|
|
205
|
+
|
|
206
|
+
// XXX: fix this properly
|
|
207
|
+
if (!rowNode) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
205
210
|
const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedColumnPosition.NONE) => {
|
|
206
211
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
207
212
|
if (cellColSpanInfo?.spannedByColSpan) {
|
|
@@ -14,6 +14,8 @@ import capitalize from '@mui/utils/capitalize';
|
|
|
14
14
|
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
15
15
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
16
16
|
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
17
|
+
import { useStore } from '@mui/x-internals/store';
|
|
18
|
+
import { Rowspan } from '@mui/x-virtualizer';
|
|
17
19
|
import { doesSupportPreventScroll } from "../../utils/doesSupportPreventScroll.js";
|
|
18
20
|
import { getDataGridUtilityClass, gridClasses } from "../../constants/gridClasses.js";
|
|
19
21
|
import { GridCellModes } from "../../models/index.js";
|
|
@@ -22,7 +24,6 @@ import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
|
22
24
|
import { gridFocusCellSelector, gridTabIndexCellSelector } from "../../hooks/features/focus/gridFocusStateSelector.js";
|
|
23
25
|
import { GridPinnedColumnPosition } from "../../hooks/features/columns/gridColumnsInterfaces.js";
|
|
24
26
|
import { PinnedColumnPosition } from "../../internals/constants.js";
|
|
25
|
-
import { gridRowSpanningHiddenCellsSelector, gridRowSpanningSpannedCellsSelector } from "../../hooks/features/rows/gridRowSpanningSelectors.js";
|
|
26
27
|
import { useGridPrivateApiContext } from "../../hooks/utils/useGridPrivateApiContext.js";
|
|
27
28
|
import { gridEditCellStateSelector } from "../../hooks/features/editing/gridEditingSelectors.js";
|
|
28
29
|
import { attachPinnedStyle } from "../../internals/utils/index.js";
|
|
@@ -116,8 +117,9 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
116
117
|
id: rowId,
|
|
117
118
|
field
|
|
118
119
|
}));
|
|
119
|
-
const
|
|
120
|
-
const
|
|
120
|
+
const store = apiRef.current.virtualizer.store;
|
|
121
|
+
const hiddenCells = useStore(store, Rowspan.selectors.hiddenCells);
|
|
122
|
+
const spannedCells = useStore(store, Rowspan.selectors.spannedCells);
|
|
121
123
|
const {
|
|
122
124
|
hasFocus,
|
|
123
125
|
isEditable = false,
|
|
@@ -186,8 +188,8 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
186
188
|
propHandler(event);
|
|
187
189
|
}
|
|
188
190
|
}, [apiRef, field, rowId]);
|
|
189
|
-
const isCellRowSpanned = hiddenCells[rowId]?.[
|
|
190
|
-
const rowSpan = spannedCells[rowId]?.[
|
|
191
|
+
const isCellRowSpanned = hiddenCells[rowId]?.[colIndex] ?? false;
|
|
192
|
+
const rowSpan = spannedCells[rowId]?.[colIndex] ?? 1;
|
|
191
193
|
const style = React.useMemo(() => {
|
|
192
194
|
if (isNotVisible) {
|
|
193
195
|
return {
|
|
@@ -14,7 +14,7 @@ import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
|
14
14
|
import { createElement as _createElement } from "react";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
function isKeyboardEvent(event) {
|
|
17
|
-
return !!event.key;
|
|
17
|
+
return 'key' in event && !!event.key;
|
|
18
18
|
}
|
|
19
19
|
function GridEditSingleSelectCell(props) {
|
|
20
20
|
const rootProps = useGridRootProps();
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TextFieldProps } from "../../models/gridBaseSlots.js";
|
|
3
|
+
import type { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
|
|
3
4
|
import type { GridColDef } from "../../models/colDef/gridColDef.js";
|
|
4
5
|
export interface GridColumnsManagementProps {
|
|
5
6
|
sort?: 'asc' | 'desc';
|
|
6
7
|
searchPredicate?: (column: GridColDef, searchValue: string) => boolean;
|
|
7
8
|
searchInputProps?: Partial<TextFieldProps>;
|
|
9
|
+
/**
|
|
10
|
+
* The milliseconds delay to wait after a keystroke before triggering filtering in the columns menu.
|
|
11
|
+
* @default 150
|
|
12
|
+
*/
|
|
13
|
+
searchDebounceMs?: DataGridProcessedProps['columnFilterDebounceMs'];
|
|
8
14
|
/**
|
|
9
15
|
* If `true`, the column search field will be focused automatically.
|
|
10
16
|
* If `false`, the first column switch input will be focused automatically.
|
|
@@ -5,6 +5,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import debounce from '@mui/utils/debounce';
|
|
8
9
|
import { styled } from '@mui/material/styles';
|
|
9
10
|
import { inputBaseClasses } from '@mui/material/InputBase';
|
|
10
11
|
import { vars } from "../../constants/cssVariables.js";
|
|
@@ -52,8 +53,12 @@ function GridColumnsManagement(props) {
|
|
|
52
53
|
disableResetButton = false,
|
|
53
54
|
toggleAllMode = 'all',
|
|
54
55
|
getTogglableColumns,
|
|
55
|
-
searchInputProps
|
|
56
|
+
searchInputProps,
|
|
57
|
+
searchDebounceMs = rootProps.columnFilterDebounceMs
|
|
56
58
|
} = props;
|
|
59
|
+
const debouncedFilter = React.useMemo(() => debounce(value => {
|
|
60
|
+
setSearchValue(value);
|
|
61
|
+
}, searchDebounceMs ?? 150), [searchDebounceMs]);
|
|
57
62
|
const isResetDisabled = React.useMemo(() => checkColumnVisibilityModelsSame(columnVisibilityModel, initialColumnVisibilityModel), [columnVisibilityModel, initialColumnVisibilityModel]);
|
|
58
63
|
const sortedColumns = React.useMemo(() => {
|
|
59
64
|
switch (sort) {
|
|
@@ -98,8 +103,8 @@ function GridColumnsManagement(props) {
|
|
|
98
103
|
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
99
104
|
}, [apiRef, columns, getTogglableColumns, toggleAllMode, currentColumns]);
|
|
100
105
|
const handleSearchValueChange = React.useCallback(event => {
|
|
101
|
-
|
|
102
|
-
}, []);
|
|
106
|
+
debouncedFilter(event.target.value);
|
|
107
|
+
}, [debouncedFilter]);
|
|
103
108
|
const hideableColumns = React.useMemo(() => currentColumns.filter(col => col.hideable), [currentColumns]);
|
|
104
109
|
const allHideableColumnsVisible = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] == null || columnVisibilityModel[column.field] !== false), [columnVisibilityModel, hideableColumns]);
|
|
105
110
|
const allHideableColumnsHidden = React.useMemo(() => hideableColumns.every(column => columnVisibilityModel[column.field] === false), [columnVisibilityModel, hideableColumns]);
|
|
@@ -121,7 +126,10 @@ function GridColumnsManagement(props) {
|
|
|
121
126
|
};
|
|
122
127
|
const handleSearchReset = React.useCallback(() => {
|
|
123
128
|
setSearchValue('');
|
|
124
|
-
searchInputRef.current
|
|
129
|
+
if (searchInputRef.current) {
|
|
130
|
+
searchInputRef.current.value = '';
|
|
131
|
+
searchInputRef.current.focus();
|
|
132
|
+
}
|
|
125
133
|
}, []);
|
|
126
134
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
127
135
|
children: [/*#__PURE__*/_jsx(GridColumnsManagementHeader, {
|
|
@@ -133,7 +141,6 @@ function GridColumnsManagement(props) {
|
|
|
133
141
|
placeholder: apiRef.current.getLocaleText('columnsManagementSearchTitle'),
|
|
134
142
|
inputRef: searchInputRef,
|
|
135
143
|
className: classes.searchInput,
|
|
136
|
-
value: searchValue,
|
|
137
144
|
onChange: handleSearchValueChange,
|
|
138
145
|
size: "small",
|
|
139
146
|
type: "search",
|
|
@@ -236,6 +243,11 @@ process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
|
|
|
236
243
|
* @returns {GridColDef['field'][]} The list of togglable columns' field names.
|
|
237
244
|
*/
|
|
238
245
|
getTogglableColumns: PropTypes.func,
|
|
246
|
+
/**
|
|
247
|
+
* The milliseconds delay to wait after a keystroke before triggering filtering in the columns menu.
|
|
248
|
+
* @default 150
|
|
249
|
+
*/
|
|
250
|
+
searchDebounceMs: PropTypes.number,
|
|
239
251
|
searchInputProps: PropTypes.object,
|
|
240
252
|
searchPredicate: PropTypes.func,
|
|
241
253
|
sort: PropTypes.oneOf(['asc', 'desc']),
|
|
@@ -2,4 +2,4 @@ import { DataGridProcessedProps } from "../../models/props/DataGridProps.js";
|
|
|
2
2
|
export type OwnerState = DataGridProcessedProps;
|
|
3
3
|
export declare const GridRootStyles: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
4
4
|
ownerState: OwnerState;
|
|
5
|
-
}, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").
|
|
5
|
+
}, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("react").ClassAttributes<HTMLDivElement> | keyof import("react").HTMLAttributes<HTMLDivElement>>, {}>;
|
|
@@ -6,7 +6,7 @@ export type ToolbarProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
6
6
|
*/
|
|
7
7
|
render?: RenderProp<React.ComponentProps<typeof ToolbarRoot>>;
|
|
8
8
|
};
|
|
9
|
-
declare const ToolbarRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.
|
|
9
|
+
declare const ToolbarRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
10
10
|
/**
|
|
11
11
|
* The top level Toolbar component that provides context to child components.
|
|
12
12
|
* It renders a styled `<div />` element.
|