@mui/x-data-grid 6.2.0 → 6.3.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 +118 -1
- package/components/GridHeader.d.ts +2 -2
- package/components/GridHeader.js +4 -6
- package/components/base/GridBody.d.ts +0 -1
- package/components/base/GridBody.js +39 -15
- package/components/cell/GridActionsCell.d.ts +2 -3
- package/components/cell/GridActionsCell.js +9 -1
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/containers/GridMainContainer.d.ts +3 -1
- package/components/containers/GridMainContainer.js +3 -2
- package/components/containers/GridRoot.js +0 -5
- package/components/containers/GridRootStyles.js +3 -1
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/components/panel/GridColumnsPanel.js +3 -2
- package/components/panel/GridPanel.d.ts +3 -3
- package/components/panel/GridPanel.js +2 -1
- package/components/panel/filterPanel/GridFilterPanel.js +5 -2
- package/constants/gridClasses.js +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +22 -15
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +4 -0
- package/hooks/features/dimensions/useGridDimensions.js +49 -10
- package/hooks/features/export/useGridPrintExport.js +3 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -5
- package/index.js +1 -1
- package/joy/index.d.ts +2 -0
- package/joy/index.js +2 -0
- package/joy/joySlots.d.ts +4 -0
- package/joy/joySlots.js +179 -0
- package/joy/package.json +6 -0
- package/legacy/components/GridHeader.js +4 -6
- package/legacy/components/base/GridBody.js +40 -16
- package/legacy/components/cell/GridActionsCell.js +11 -2
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/legacy/components/containers/GridMainContainer.js +3 -2
- package/legacy/components/containers/GridRoot.js +0 -5
- package/legacy/components/containers/GridRootStyles.js +3 -1
- package/legacy/components/index.js +0 -1
- package/legacy/components/panel/GridColumnsPanel.js +3 -2
- package/legacy/components/panel/GridPanel.js +2 -1
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +5 -2
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +22 -15
- package/legacy/hooks/features/dimensions/useGridDimensions.js +55 -12
- package/legacy/hooks/features/export/useGridPrintExport.js +3 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +12 -6
- package/legacy/index.js +1 -1
- package/legacy/joy/index.js +2 -0
- package/legacy/joy/joySlots.js +180 -0
- package/legacy/locales/frFR.js +2 -2
- package/legacy/locales/trTR.js +2 -2
- package/legacy/locales/zhCN.js +2 -2
- package/locales/frFR.js +2 -2
- package/locales/trTR.js +2 -2
- package/locales/zhCN.js +2 -2
- package/material/index.d.ts +2 -2
- package/models/gridSlotsComponent.d.ts +2 -2
- package/modern/components/GridHeader.js +4 -6
- package/modern/components/base/GridBody.js +39 -15
- package/modern/components/cell/GridActionsCell.js +9 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/modern/components/containers/GridMainContainer.js +3 -2
- package/modern/components/containers/GridRoot.js +0 -5
- package/modern/components/containers/GridRootStyles.js +3 -1
- package/modern/components/index.js +0 -1
- package/modern/components/panel/GridColumnsPanel.js +3 -2
- package/modern/components/panel/GridPanel.js +2 -1
- package/modern/components/panel/filterPanel/GridFilterPanel.js +5 -2
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +21 -14
- package/modern/hooks/features/dimensions/useGridDimensions.js +48 -10
- package/modern/hooks/features/export/useGridPrintExport.js +3 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -5
- package/modern/index.js +1 -1
- package/modern/joy/index.js +2 -0
- package/modern/joy/joySlots.js +177 -0
- package/modern/locales/frFR.js +2 -2
- package/modern/locales/trTR.js +2 -2
- package/modern/locales/zhCN.js +2 -2
- package/node/components/GridHeader.js +5 -8
- package/node/components/base/GridBody.js +39 -15
- package/node/components/cell/GridActionsCell.js +9 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/node/components/containers/GridMainContainer.js +5 -3
- package/node/components/containers/GridRoot.js +0 -5
- package/node/components/containers/GridRootStyles.js +3 -1
- package/node/components/index.js +0 -11
- package/node/components/panel/GridColumnsPanel.js +3 -2
- package/node/components/panel/GridPanel.js +2 -1
- package/node/components/panel/filterPanel/GridFilterPanel.js +5 -2
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +20 -11
- package/node/hooks/features/dimensions/useGridDimensions.js +47 -9
- package/node/hooks/features/export/useGridPrintExport.js +3 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -5
- package/node/index.js +1 -1
- package/node/joy/index.js +13 -0
- package/node/joy/joySlots.js +185 -0
- package/node/locales/frFR.js +2 -2
- package/node/locales/trTR.js +2 -2
- package/node/locales/zhCN.js +2 -2
- package/package.json +3 -3
- package/components/GridAutoSizer.d.ts +0 -44
- package/components/GridAutoSizer.js +0 -126
- package/legacy/components/GridAutoSizer.js +0 -132
- package/modern/components/GridAutoSizer.js +0 -125
- package/node/components/GridAutoSizer.js +0 -132
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,126 @@
|
|
|
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.3.0
|
|
7
|
+
|
|
8
|
+
_Apr 28, 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 [time-picking UI](https://mui.com/x/react-date-pickers/digital-clock/) designed for desktops (#7958) @LukasTy
|
|
13
|
+
|
|
14
|
+
<img src="https://user-images.githubusercontent.com/4941090/235072007-de39a397-e4a4-4c98-8e10-5ee4ad440108.gif" width="494" />
|
|
15
|
+
|
|
16
|
+
- ✨ Picker fields [now always include a leading zero](https://mui.com/x/react-date-pickers/adapters-locale/#respect-leading-zeros-in-fields) on digit sections (#8527) @flaviendelangle
|
|
17
|
+
- 🌍 Improve Chinese (zh-CN), French (fr-FR), and Turkish (tr-TR) locales
|
|
18
|
+
- 🐞 Bugfixes
|
|
19
|
+
- 📚 Documentation improvements
|
|
20
|
+
|
|
21
|
+
### `@mui/x-data-grid@v6.3.0` / `@mui/x-data-grid-pro@v6.3.0` / `@mui/x-data-grid-premium@v6.3.0`
|
|
22
|
+
|
|
23
|
+
#### Changes
|
|
24
|
+
|
|
25
|
+
- [DataGrid] Add overlay classes to `gridClasses` (#8686) @lindapaiste
|
|
26
|
+
- [DataGrid] Avoid passing `api` prop to div (#8679) @someden
|
|
27
|
+
- [DataGrid] Fix 'ResizeObserver loop limit exceeded' error (#8744) @m4theushw
|
|
28
|
+
- [DataGrid] Add Joy UI slots (button and switch) (#8699) @siriwatknp
|
|
29
|
+
- [DataGrid] Fix aggregation label alignment (#8694) @joserodolfofreitas
|
|
30
|
+
- [DataGridPremium] Fix infinite loop when updating grouped rows (#8693) @cherniavskii
|
|
31
|
+
- [DataGridPro] Fix error after updating `columns` and `columnGroupingModel` at once (#8730) @cherniavskii
|
|
32
|
+
- [l10n] Improve Chinese (zh-CN) locale (#8753) @SakumyZ
|
|
33
|
+
- [l10n] Improve French (fr-FR) locale (#8704) @Jul13nT
|
|
34
|
+
- [l10n] Improve Turkish (tr-TR) locale (#8783) @cccaaannn
|
|
35
|
+
|
|
36
|
+
### `@mui/x-date-pickers@v6.3.0` / `@mui/x-date-pickers-pro@v6.3.0`
|
|
37
|
+
|
|
38
|
+
#### Changes
|
|
39
|
+
|
|
40
|
+
- [fields] Always add leading zeroes on digit sections (#8527) @flaviendelangle
|
|
41
|
+
- [fields] Pass the `readOnly` prop to `InputProps` instead of `inputProps` (#8659) @flaviendelangle
|
|
42
|
+
- [pickers] Add missing export for `caES` locale (#8782) @flaviendelangle
|
|
43
|
+
- [pickers] Add new `DigitalClock` desktop time picking experience (#7958) @LukasTy
|
|
44
|
+
- [pickers] Do not use `instanceOf DateTime` in `AdapterLuxon` (#8734) @flaviendelangle
|
|
45
|
+
- [pickers] Fix date calendar `selected` & `disabled` day style (#8773) @LukasTy
|
|
46
|
+
- [pickers] Migrate `AdapterDateFns` to our repository (#8736) @flaviendelangle
|
|
47
|
+
- [pickers] Migrate `AdapterLuxon` to our repository (#8600) @flaviendelangle
|
|
48
|
+
- [pickers] Migrate `AdapterMomentHijri` to our repository (#8776) @flaviendelangle
|
|
49
|
+
- [pickers] Migrate `AdapterMomentJalaali` and `AdapterDateFnsJalali` to our repository (#8741) @flaviendelangle
|
|
50
|
+
- [pickers] Migrate `AdapterMoment` to our repository (#8700) @flaviendelangle
|
|
51
|
+
- [pickers] Refactor the validation files (#8622) @flaviendelangle
|
|
52
|
+
- [pickers] Use `en dash` instead of `em dash` in multi input range fields (#8738) @flaviendelangle
|
|
53
|
+
- [l10n] Improve Chinese (zh-CN) locale (#8753) @SakumyZ
|
|
54
|
+
- [l10n] Improve Turkish (tr-TR) locale (#8783) @cccaaannn
|
|
55
|
+
|
|
56
|
+
### Docs
|
|
57
|
+
|
|
58
|
+
- [docs] Add icons for charts menu (#8752) @alexfauquette
|
|
59
|
+
- [docs] Document the supported formats (#8746) @flaviendelangle
|
|
60
|
+
- [docs] Fix Hijri demo (#8698) @alexfauquette
|
|
61
|
+
- [docs] Fix `x-codemod` package version in changelog (#8690) @MBilalShafi
|
|
62
|
+
- [docs] Fix columns special properties code example (#8414) @mikkelhl
|
|
63
|
+
- [docs] Fix error in `minDateTime` `validation` page section (#8777) @LukasTy
|
|
64
|
+
- [docs] Update custom field pickers using theme scoping (#8609) @siriwatknp
|
|
65
|
+
- [docs] Use community version of data grid for column grouping demo (#7346) @ASchwad
|
|
66
|
+
- [docs] Use new `slots` / `slotProps` props in the pickers migration guide (#8341) @flaviendelangle
|
|
67
|
+
|
|
68
|
+
### Core
|
|
69
|
+
|
|
70
|
+
- [core] Cleanup picker tests (#8652) @flaviendelangle
|
|
71
|
+
- [core] Use `adapter.lib` instead of `adapterName` in `describeAdapters` (#8779) @flaviendelangle
|
|
72
|
+
- [charts] Adapt line and scatter plot to the "band" scale type (#8701) @alexfauquette
|
|
73
|
+
- [charts] Link the Gantt Charts issue in the docs (#8739) @flaviendelangle
|
|
74
|
+
|
|
75
|
+
## 6.2.1
|
|
76
|
+
|
|
77
|
+
_Apr 20, 2023_
|
|
78
|
+
|
|
79
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
80
|
+
|
|
81
|
+
- 🚀 Add virtualization to row detail panels (#7969) @yaredtsy
|
|
82
|
+
- 🐞 Bugfixes
|
|
83
|
+
- 📚 Documentation improvements
|
|
84
|
+
|
|
85
|
+
### `@mui/x-data-grid@v6.2.1` / `@mui/x-data-grid-pro@v6.2.1` / `@mui/x-data-grid-premium@v6.2.1`
|
|
86
|
+
|
|
87
|
+
#### Changes
|
|
88
|
+
|
|
89
|
+
- [DataGrid] Add `getTogglableColumns` to `Hide all` and `Show all` actions (#8496) @MBilalShafi
|
|
90
|
+
- [DataGrid] Add Grid + Joy UI experiment page (#8067) @cherniavskii
|
|
91
|
+
- [DataGrid] Fix print style when rendering inside Shadow DOM (#8656) @Bwatermelon
|
|
92
|
+
- [DataGrid] Replace `GridAutoSizer` with `ResizeObserver` (#8091) @m4theushw
|
|
93
|
+
- [DataGrid] Use stable ID for the placeholder filter item (#8603) @m4theushw
|
|
94
|
+
- [DataGridPro] Virtualize row detail panels (#7969) @yaredtsy
|
|
95
|
+
|
|
96
|
+
### `@mui/x-date-pickers@v6.2.1` / `@mui/x-date-pickers-pro@v6.2.1`
|
|
97
|
+
|
|
98
|
+
#### Changes
|
|
99
|
+
|
|
100
|
+
- [pickers] Do not include the time in date components when going to today (#8657) @flaviendelangle
|
|
101
|
+
- [pickers] Sync internal state with controlled value (#8674) @alexfauquette
|
|
102
|
+
|
|
103
|
+
### `@mui/x-codemod@v6.2.1`
|
|
104
|
+
|
|
105
|
+
#### Changes
|
|
106
|
+
|
|
107
|
+
- [codemod] Avoid filter failures on object prototype properties (#8647) @LukasTy
|
|
108
|
+
|
|
109
|
+
### Docs
|
|
110
|
+
|
|
111
|
+
- [docs] Add no-op service worker to fix stale cache issue (#8598) @cherniavskii
|
|
112
|
+
- [docs] Clarify what `AdapterDayjs` is in the Getting Started page (#8219) @flaviendelangle
|
|
113
|
+
- [docs] Fix typo on picker page description (#8611) @maxolasersquad
|
|
114
|
+
- [docs] Improve section title in Getting Started page (#8648) @flaviendelangle
|
|
115
|
+
- [docs] Inform about input format modification (#8458) @alexfauquette
|
|
116
|
+
|
|
117
|
+
### Core
|
|
118
|
+
|
|
119
|
+
- [core] Fix release date (#8618) @flaviendelangle
|
|
120
|
+
- [core] Upgrade monorepo (#8668) @MBilalShafi
|
|
121
|
+
- [charts] Support Tooltip (#8356) @alexfauquette
|
|
122
|
+
|
|
6
123
|
## 6.2.0
|
|
7
124
|
|
|
8
|
-
_Apr
|
|
125
|
+
_Apr 14, 2023_
|
|
9
126
|
|
|
10
127
|
We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
11
128
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function GridHeader(): JSX.Element;
|
package/components/GridHeader.js
CHANGED
|
@@ -3,12 +3,10 @@ import * as React from 'react';
|
|
|
3
3
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
-
export
|
|
6
|
+
export function GridHeader() {
|
|
7
7
|
var _rootProps$slotProps, _rootProps$slotProps2;
|
|
8
8
|
const rootProps = useGridRootProps();
|
|
9
|
-
return /*#__PURE__*/_jsxs(
|
|
10
|
-
ref: ref
|
|
11
|
-
}, props, {
|
|
9
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
12
10
|
children: [/*#__PURE__*/_jsx(rootProps.slots.preferencesPanel, _extends({}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.preferencesPanel)), rootProps.slots.toolbar && /*#__PURE__*/_jsx(rootProps.slots.toolbar, _extends({}, (_rootProps$slotProps2 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps2.toolbar))]
|
|
13
|
-
})
|
|
14
|
-
}
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
4
5
|
import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
|
|
5
6
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
6
7
|
import { GridMainContainer } from '../containers/GridMainContainer';
|
|
7
|
-
import { GridAutoSizer } from '../GridAutoSizer';
|
|
8
8
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { gridColumnPositionsSelector, gridColumnVisibilityModelSelector, gridVisibleColumnDefinitionsSelector } from '../../hooks/features/columns/gridColumnsSelector';
|
|
10
10
|
import { gridFilterActiveItemsLookupSelector } from '../../hooks/features/filter/gridFilterSelector';
|
|
@@ -17,12 +17,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
17
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
18
|
function GridBody(props) {
|
|
19
19
|
const {
|
|
20
|
-
children,
|
|
21
20
|
VirtualScrollerComponent,
|
|
22
21
|
ColumnHeadersProps
|
|
23
22
|
} = props;
|
|
24
23
|
const apiRef = useGridPrivateApiContext();
|
|
25
24
|
const rootProps = useGridRootProps();
|
|
25
|
+
const rootRef = React.useRef(null);
|
|
26
26
|
const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
27
27
|
const filterColumnLookup = useGridSelector(apiRef, gridFilterActiveItemsLookupSelector);
|
|
28
28
|
const sortColumnLookup = useGridSelector(apiRef, gridSortColumnLookupSelector);
|
|
@@ -39,6 +39,31 @@ function GridBody(props) {
|
|
|
39
39
|
const columnGroupsHeaderStructure = useGridSelector(apiRef, gridColumnGroupsHeaderStructureSelector);
|
|
40
40
|
const hasOtherElementInTabSequence = !(columnGroupHeaderTabIndexState === null && columnHeaderTabIndexState === null && cellTabIndexState === null);
|
|
41
41
|
const [isVirtualizationDisabled, setIsVirtualizationDisabled] = React.useState(rootProps.disableVirtualization);
|
|
42
|
+
useEnhancedEffect(() => {
|
|
43
|
+
apiRef.current.computeSizeAndPublishResizeEvent();
|
|
44
|
+
const elementToObserve = rootRef.current;
|
|
45
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
46
|
+
return () => {};
|
|
47
|
+
}
|
|
48
|
+
let animationFrame;
|
|
49
|
+
const observer = new ResizeObserver(() => {
|
|
50
|
+
// See https://github.com/mui/mui-x/issues/8733
|
|
51
|
+
animationFrame = window.requestAnimationFrame(() => {
|
|
52
|
+
apiRef.current.computeSizeAndPublishResizeEvent();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
if (elementToObserve) {
|
|
56
|
+
observer.observe(elementToObserve);
|
|
57
|
+
}
|
|
58
|
+
return () => {
|
|
59
|
+
if (animationFrame) {
|
|
60
|
+
window.cancelAnimationFrame(animationFrame);
|
|
61
|
+
}
|
|
62
|
+
if (elementToObserve) {
|
|
63
|
+
observer.unobserve(elementToObserve);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}, [apiRef]);
|
|
42
67
|
const disableVirtualization = React.useCallback(() => {
|
|
43
68
|
setIsVirtualizationDisabled(true);
|
|
44
69
|
}, []);
|
|
@@ -65,10 +90,9 @@ function GridBody(props) {
|
|
|
65
90
|
columnHeadersElementRef: columnHeadersRef,
|
|
66
91
|
virtualScrollerRef
|
|
67
92
|
});
|
|
68
|
-
const
|
|
69
|
-
apiRef.current.publishEvent('resize', size);
|
|
70
|
-
}, [apiRef]);
|
|
93
|
+
const hasDimensions = !!apiRef.current.getRootDimensions();
|
|
71
94
|
return /*#__PURE__*/_jsxs(GridMainContainer, {
|
|
95
|
+
ref: rootRef,
|
|
72
96
|
children: [/*#__PURE__*/_jsx(rootProps.slots.columnHeaders, _extends({
|
|
73
97
|
ref: columnsContainerRef,
|
|
74
98
|
innerRef: columnHeadersRef,
|
|
@@ -86,15 +110,16 @@ function GridBody(props) {
|
|
|
86
110
|
columnVisibility: columnVisibility,
|
|
87
111
|
columnGroupsHeaderStructure: columnGroupsHeaderStructure,
|
|
88
112
|
hasOtherElementInTabSequence: hasOtherElementInTabSequence
|
|
89
|
-
}, ColumnHeadersProps)), /*#__PURE__*/_jsx(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
113
|
+
}, ColumnHeadersProps)), hasDimensions && /*#__PURE__*/_jsx(VirtualScrollerComponent
|
|
114
|
+
// The content is only rendered after dimensions are computed because
|
|
115
|
+
// the lazy-loading hook is listening to `renderedRowsIntervalChange`,
|
|
116
|
+
// but only does something if the dimensions are also available.
|
|
117
|
+
// If this event is published while dimensions haven't been computed,
|
|
118
|
+
// the `onFetchRows` prop won't be called during mount.
|
|
119
|
+
, {
|
|
120
|
+
ref: virtualScrollerRef,
|
|
121
|
+
disableVirtualization: isVirtualizationDisabled
|
|
122
|
+
})]
|
|
98
123
|
});
|
|
99
124
|
}
|
|
100
125
|
process.env.NODE_ENV !== "production" ? GridBody.propTypes = {
|
|
@@ -102,7 +127,6 @@ process.env.NODE_ENV !== "production" ? GridBody.propTypes = {
|
|
|
102
127
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
103
128
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
104
129
|
// ----------------------------------------------------------------------
|
|
105
|
-
children: PropTypes.node,
|
|
106
130
|
ColumnHeadersProps: PropTypes.object,
|
|
107
131
|
VirtualScrollerComponent: PropTypes.elementType.isRequired
|
|
108
132
|
} : void 0;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridRenderCellParams } from '../../models/params/gridCellParams';
|
|
3
3
|
import { GridMenuProps } from '../menu/GridMenu';
|
|
4
|
-
interface GridActionsCellProps extends Omit<GridRenderCellParams, '
|
|
5
|
-
|
|
6
|
-
formattedValue?: GridRenderCellParams['formattedValue'];
|
|
4
|
+
interface GridActionsCellProps extends Omit<GridRenderCellParams, 'api'> {
|
|
5
|
+
api?: GridRenderCellParams['api'];
|
|
7
6
|
position?: GridMenuProps['position'];
|
|
8
7
|
}
|
|
9
8
|
declare function GridActionsCell(props: GridActionsCellProps): JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "focusElementRef"];
|
|
3
|
+
const _excluded = ["api", "colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "focusElementRef"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import MenuList from '@mui/material/MenuList';
|
|
@@ -189,6 +189,7 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
189
189
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
190
190
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
191
191
|
// ----------------------------------------------------------------------
|
|
192
|
+
api: PropTypes.object,
|
|
192
193
|
/**
|
|
193
194
|
* The mode of the cell.
|
|
194
195
|
*/
|
|
@@ -211,6 +212,9 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
211
212
|
focus: PropTypes.func.isRequired
|
|
212
213
|
})
|
|
213
214
|
})]),
|
|
215
|
+
/**
|
|
216
|
+
* The cell value formatted with the column valueFormatter.
|
|
217
|
+
*/
|
|
214
218
|
formattedValue: PropTypes.any,
|
|
215
219
|
/**
|
|
216
220
|
* If true, the cell is the active element.
|
|
@@ -237,6 +241,10 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
237
241
|
* the tabIndex value.
|
|
238
242
|
*/
|
|
239
243
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
244
|
+
/**
|
|
245
|
+
* The cell value.
|
|
246
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
247
|
+
*/
|
|
240
248
|
value: PropTypes.any
|
|
241
249
|
} : void 0;
|
|
242
250
|
export { GridActionsCell };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridRenderCellParams } from '../../models/params/gridCellParams';
|
|
2
|
+
import type { GridRenderCellParams } from '../../models/params/gridCellParams';
|
|
3
3
|
declare const GridCellCheckboxForwardRef: React.ForwardRefExoticComponent<GridRenderCellParams<any, any, any, import("../..").GridTreeNodeWithRender> & React.RefAttributes<HTMLInputElement>>;
|
|
4
4
|
export { GridCellCheckboxForwardRef };
|
|
5
5
|
export declare const GridCellCheckboxRenderer: React.ForwardRefExoticComponent<GridRenderCellParams<any, any, any, import("../..").GridTreeNodeWithRender> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -36,7 +36,7 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
|
|
|
36
36
|
};
|
|
37
37
|
const classes = useUtilityClasses(ownerState);
|
|
38
38
|
const checkboxElement = React.useRef(null);
|
|
39
|
-
const rippleRef = React.useRef();
|
|
39
|
+
const rippleRef = React.useRef(null);
|
|
40
40
|
const handleRef = useForkRef(checkboxElement, ref);
|
|
41
41
|
const element = apiRef.current.getCellElement(id, field);
|
|
42
42
|
const handleChange = event => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridColumnHeaderParams } from '../../models/params/gridColumnHeaderParams';
|
|
2
|
+
import type { GridColumnHeaderParams } from '../../models/params/gridColumnHeaderParams';
|
|
3
3
|
declare const GridHeaderCheckbox: React.ForwardRefExoticComponent<GridColumnHeaderParams<import("../../models/gridRows").GridValidRowModel, any, any> & React.RefAttributes<HTMLInputElement>>;
|
|
4
4
|
export { GridHeaderCheckbox };
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare
|
|
2
|
+
export declare const GridMainContainer: React.ForwardRefExoticComponent<{
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -24,12 +24,13 @@ const GridMainContainerRoot = styled('div', {
|
|
|
24
24
|
flexDirection: 'column',
|
|
25
25
|
overflow: 'hidden'
|
|
26
26
|
}));
|
|
27
|
-
export
|
|
27
|
+
export const GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
28
28
|
const rootProps = useGridRootProps();
|
|
29
29
|
const classes = useUtilityClasses(rootProps);
|
|
30
30
|
return /*#__PURE__*/_jsx(GridMainContainerRoot, {
|
|
31
|
+
ref: ref,
|
|
31
32
|
className: classes.root,
|
|
32
33
|
ownerState: rootProps,
|
|
33
34
|
children: props.children
|
|
34
35
|
});
|
|
35
|
-
}
|
|
36
|
+
});
|
|
@@ -54,11 +54,6 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
54
54
|
useEnhancedEffect(() => {
|
|
55
55
|
setMountedState(true);
|
|
56
56
|
}, []);
|
|
57
|
-
useEnhancedEffect(() => {
|
|
58
|
-
if (mountedState) {
|
|
59
|
-
apiRef.current.updateGridDimensionsRef();
|
|
60
|
-
}
|
|
61
|
-
}, [apiRef, mountedState]);
|
|
62
57
|
if (!mountedState) {
|
|
63
58
|
return null;
|
|
64
59
|
}
|
|
@@ -204,7 +204,9 @@ export const GridRootStyles = styled('div', {
|
|
|
204
204
|
minWidth: 0,
|
|
205
205
|
flex: 1,
|
|
206
206
|
whiteSpace: 'nowrap',
|
|
207
|
-
overflow: 'hidden'
|
|
207
|
+
overflow: 'hidden',
|
|
208
|
+
// to anchor the aggregation label
|
|
209
|
+
position: 'relative'
|
|
208
210
|
},
|
|
209
211
|
[`& .${gridClasses.columnHeaderTitleContainerContent}`]: {
|
|
210
212
|
overflow: 'hidden',
|
package/components/index.d.ts
CHANGED
package/components/index.js
CHANGED
|
@@ -95,8 +95,9 @@ function GridColumnsPanel(props) {
|
|
|
95
95
|
const toggleAllColumns = React.useCallback(isVisible => {
|
|
96
96
|
const currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
97
97
|
const newModel = _extends({}, currentModel);
|
|
98
|
+
const togglableColumns = getTogglableColumns ? getTogglableColumns(columns) : null;
|
|
98
99
|
columns.forEach(col => {
|
|
99
|
-
if (col.hideable) {
|
|
100
|
+
if (col.hideable && (togglableColumns == null || togglableColumns.includes(col.field))) {
|
|
100
101
|
if (isVisible) {
|
|
101
102
|
// delete the key from the model instead of setting it to `true`
|
|
102
103
|
delete newModel[col.field];
|
|
@@ -106,7 +107,7 @@ function GridColumnsPanel(props) {
|
|
|
106
107
|
}
|
|
107
108
|
});
|
|
108
109
|
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
109
|
-
}, [apiRef, columns]);
|
|
110
|
+
}, [apiRef, columns, getTogglableColumns]);
|
|
110
111
|
const handleSearchValueChange = React.useCallback(event => {
|
|
111
112
|
setSearchValue(event.target.value);
|
|
112
113
|
}, []);
|
|
@@ -16,15 +16,15 @@ export interface GridPanelProps extends Partial<React.ComponentProps<typeof Grid
|
|
|
16
16
|
open: boolean;
|
|
17
17
|
}
|
|
18
18
|
export declare const gridPanelClasses: Record<keyof GridPanelClasses, string>;
|
|
19
|
-
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<Omit<import("@mui/base").
|
|
19
|
+
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<Omit<import("@mui/base").PopperProps<"div", {}>, "direction"> & {
|
|
20
20
|
components?: {
|
|
21
21
|
Root?: React.ElementType<any> | undefined;
|
|
22
22
|
} | undefined;
|
|
23
23
|
componentsProps?: {
|
|
24
|
-
root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").
|
|
24
|
+
root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").PopperRootSlotPropsOverrides, import("@mui/base").PopperOwnProps> | undefined;
|
|
25
25
|
} | undefined;
|
|
26
26
|
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
27
|
-
} & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "sx" | "
|
|
27
|
+
} & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "component" | "sx" | "components" | "placement" | "disablePortal" | "modifiers" | "anchorEl" | "keepMounted" | "popperOptions" | "popperRef" | "slotProps" | "slots" | "componentsProps" | keyof React.RefAttributes<HTMLDivElement>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
28
28
|
ownerState: OwnerState;
|
|
29
29
|
}, {}, {}>;
|
|
30
30
|
declare const GridPanel: React.ForwardRefExoticComponent<Omit<GridPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -116,6 +116,7 @@ process.env.NODE_ENV !== "production" ? GridPanel.propTypes = {
|
|
|
116
116
|
/**
|
|
117
117
|
* If `true`, the component is shown.
|
|
118
118
|
*/
|
|
119
|
-
open: PropTypes.bool.isRequired
|
|
119
|
+
open: PropTypes.bool.isRequired,
|
|
120
|
+
ownerState: PropTypes.object
|
|
120
121
|
} : void 0;
|
|
121
122
|
export { GridPanel };
|
|
@@ -27,6 +27,7 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
27
27
|
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
28
28
|
const filterableColumns = useGridSelector(apiRef, gridFilterableColumnDefinitionsSelector);
|
|
29
29
|
const lastFilterRef = React.useRef(null);
|
|
30
|
+
const placeholderFilter = React.useRef(null);
|
|
30
31
|
const {
|
|
31
32
|
logicOperators = [GridLogicOperator.And, GridLogicOperator.Or],
|
|
32
33
|
columnsSort,
|
|
@@ -93,8 +94,10 @@ const GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(p
|
|
|
93
94
|
if (filterModel.items.length) {
|
|
94
95
|
return filterModel.items;
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
if (!placeholderFilter.current) {
|
|
98
|
+
placeholderFilter.current = getDefaultFilter();
|
|
99
|
+
}
|
|
100
|
+
return placeholderFilter.current ? [placeholderFilter.current] : [];
|
|
98
101
|
}, [filterModel.items, getDefaultFilter]);
|
|
99
102
|
const hasMultipleFilters = items.length > 1;
|
|
100
103
|
const addNewFilter = () => {
|
package/constants/gridClasses.js
CHANGED
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell', 'cellContent', 'cellCheckbox', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorderColor', 'cell--withRightBorder', 'columnHeader--withRightBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell', 'cellContent', 'cellCheckbox', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorderColor', 'cell--withRightBorder', 'columnHeader--withRightBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -7,10 +7,7 @@ import { gridColumnGroupsLookupSelector, gridColumnGroupsUnwrappedModelSelector
|
|
|
7
7
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
8
8
|
import { getColumnGroupsHeaderStructure, unwrapGroupingColumnModel } from './gridColumnGroupsUtils';
|
|
9
9
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
10
|
-
import { gridColumnFieldsSelector,
|
|
11
|
-
// GridColumnsState,
|
|
12
|
-
gridVisibleColumnFieldsSelector } from '../columns';
|
|
13
|
-
import { useGridSelector } from '../../utils/useGridSelector';
|
|
10
|
+
import { gridColumnFieldsSelector, gridVisibleColumnFieldsSelector } from '../columns';
|
|
14
11
|
const createGroupLookup = columnGroupingModel => {
|
|
15
12
|
let groupLookup = {};
|
|
16
13
|
columnGroupingModel.forEach(node => {
|
|
@@ -102,19 +99,15 @@ export const useGridColumnGrouping = (apiRef, props) => {
|
|
|
102
99
|
});
|
|
103
100
|
});
|
|
104
101
|
}, [apiRef, props.columnGroupingModel]);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const visibleColumnFields = useGridSelector(apiRef, gridVisibleColumnFieldsSelector);
|
|
108
|
-
/**
|
|
109
|
-
* EFFECTS
|
|
110
|
-
*/
|
|
111
|
-
React.useEffect(() => {
|
|
112
|
-
var _props$experimentalFe2, _props$columnGrouping4, _props$columnGrouping5;
|
|
102
|
+
const updateColumnGroupingState = React.useCallback(columnGroupingModel => {
|
|
103
|
+
var _props$experimentalFe2;
|
|
113
104
|
if (!((_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.columnGrouping)) {
|
|
114
105
|
return;
|
|
115
106
|
}
|
|
116
|
-
const
|
|
117
|
-
const
|
|
107
|
+
const columnFields = gridColumnFieldsSelector(apiRef);
|
|
108
|
+
const visibleColumnFields = gridVisibleColumnFieldsSelector(apiRef);
|
|
109
|
+
const groupLookup = createGroupLookup(columnGroupingModel != null ? columnGroupingModel : []);
|
|
110
|
+
const unwrappedGroupingModel = unwrapGroupingColumnModel(columnGroupingModel != null ? columnGroupingModel : []);
|
|
118
111
|
const columnGroupsHeaderStructure = getColumnGroupsHeaderStructure(columnFields, unwrappedGroupingModel);
|
|
119
112
|
const maxDepth = visibleColumnFields.length === 0 ? 0 : Math.max(...visibleColumnFields.map(field => {
|
|
120
113
|
var _unwrappedGroupingMod4, _unwrappedGroupingMod5;
|
|
@@ -130,5 +123,19 @@ export const useGridColumnGrouping = (apiRef, props) => {
|
|
|
130
123
|
}
|
|
131
124
|
});
|
|
132
125
|
});
|
|
133
|
-
}, [apiRef,
|
|
126
|
+
}, [apiRef, (_props$experimentalFe3 = props.experimentalFeatures) == null ? void 0 : _props$experimentalFe3.columnGrouping]);
|
|
127
|
+
useGridApiEventHandler(apiRef, 'columnIndexChange', handleColumnIndexChange);
|
|
128
|
+
useGridApiEventHandler(apiRef, 'columnsChange', () => {
|
|
129
|
+
updateColumnGroupingState(props.columnGroupingModel);
|
|
130
|
+
});
|
|
131
|
+
useGridApiEventHandler(apiRef, 'columnVisibilityModelChange', () => {
|
|
132
|
+
updateColumnGroupingState(props.columnGroupingModel);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* EFFECTS
|
|
137
|
+
*/
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
updateColumnGroupingState(props.columnGroupingModel);
|
|
140
|
+
}, [updateColumnGroupingState, props.columnGroupingModel]);
|
|
134
141
|
};
|
|
@@ -43,4 +43,8 @@ export interface GridDimensionsPrivateApi {
|
|
|
43
43
|
* Forces a recalculation of all dimensions.
|
|
44
44
|
*/
|
|
45
45
|
updateGridDimensionsRef: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Computes the size and publishes a `resize` event with the new value.
|
|
48
|
+
*/
|
|
49
|
+
computeSizeAndPublishResizeEvent: () => void;
|
|
46
50
|
}
|