@mui/x-data-grid-premium 5.15.1 → 5.16.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 +142 -0
- package/DataGridPremium/DataGridPremium.js +4 -2
- package/DataGridPremium/useDataGridPremiumComponent.js +3 -1
- package/README.md +3 -2
- package/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
- package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +2 -1
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +30 -21
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
- package/index.js +1 -1
- package/legacy/DataGridPremium/DataGridPremium.js +4 -2
- package/legacy/DataGridPremium/useDataGridPremiumComponent.js +3 -1
- package/legacy/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
- package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +35 -21
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
- package/legacy/index.js +1 -1
- package/legacy/utils/releaseInfo.js +1 -1
- package/modern/DataGridPremium/DataGridPremium.js +4 -2
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +3 -1
- package/modern/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +27 -20
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPremium/DataGridPremium.js +4 -2
- package/node/DataGridPremium/useDataGridPremiumComponent.js +2 -0
- package/node/hooks/features/rowGrouping/createGroupingColDef.js +0 -10
- package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +31 -21
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -1
- package/node/index.js +1 -1
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +6 -6
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,148 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 5.16.0
|
|
7
|
+
|
|
8
|
+
_Aug 25, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Introduce column grouping for data grid (#5133) @alexfauquette
|
|
13
|
+
|
|
14
|
+
You can now group columns using the `columnGroupingModel` prop. This lets you to display more structured data.
|
|
15
|
+
|
|
16
|
+
<img src="https://user-images.githubusercontent.com/45398769/186178366-4fba66b2-bf90-4c7a-9d83-940a7fc78704.png" width="800" />
|
|
17
|
+
|
|
18
|
+
To enable this feature, add `experimentalFeatures={{ columnGrouping: true }}`.
|
|
19
|
+
The grouping header can be fully customized.
|
|
20
|
+
See the [documentation](https://mui.com/x/react-data-grid/column-groups/) to explore everything it has to offer.
|
|
21
|
+
|
|
22
|
+
- 🐞 Bugfixes
|
|
23
|
+
- 🌏 New locales for pickers thanks to @tesseractjh and @drastus
|
|
24
|
+
|
|
25
|
+
### `@mui/x-data-grid@v5.16.0` / `@mui/x-data-grid-pro@v5.16.0` / `@mui/x-data-grid-premium@v5.16.0`
|
|
26
|
+
|
|
27
|
+
#### Changes
|
|
28
|
+
|
|
29
|
+
- [DataGrid] Implement column grouping (#5133) @alexfauquette
|
|
30
|
+
- [DataGrid] Handle `disableVirtualization` prop change (#5889) @cherniavskii
|
|
31
|
+
- [DataGrid] Improve `GridRowModel` typing (#5734) @cherniavskii
|
|
32
|
+
- [DataGrid] Update deprecation note for `GridColDef` `hide` property (#5886) @cherniavskii
|
|
33
|
+
|
|
34
|
+
### `@mui/x-date-pickers@v5.0.0-beta.7` / `@mui/x-date-pickers-pro@v5.0.0-beta.7`
|
|
35
|
+
|
|
36
|
+
#### Changes
|
|
37
|
+
|
|
38
|
+
- [DatePicker] Fix to pass down `className` prop provided on DatePicker to `renderInput` (#5471) @CruseCtrl
|
|
39
|
+
- [DatePicker] Improve `a11y` support (#5809) @LukasTy
|
|
40
|
+
- [pickers] Add `PaperContent` component slot (#5801) @LukasTy
|
|
41
|
+
- [pickers] Add a breaking change section in the migration guide (#5805) @alexfauquette
|
|
42
|
+
- [pickers] Add new translations to `localeText` (#5143) @alexfauquette
|
|
43
|
+
- [pickers] Document components slots (#4657) @flaviendelangle
|
|
44
|
+
- [pickers] Add new unstable field components (#5504) @flaviendelangle
|
|
45
|
+
- [pickers] Fallback to default `minDate` / `maxDate` when `null` value is passed (#5397) @flaviendelangle
|
|
46
|
+
- [l10n] Add Korean (ko-KR) locale (#5854) @tesseractjh
|
|
47
|
+
- [l10n] Add Polish (pl-PL) locale (#5833) @drastus
|
|
48
|
+
|
|
49
|
+
### Docs
|
|
50
|
+
|
|
51
|
+
- [docs] Fix typo in `migration from lab` (#5277) @chuckwired
|
|
52
|
+
- [docs] Use `dayjs` instead of `date-fns` in doc examples (#5481) @flaviendelangle
|
|
53
|
+
|
|
54
|
+
### Core
|
|
55
|
+
|
|
56
|
+
- [core] Clarify the scope of the license key used for tests and documentation (#5824) @oliviertassinari
|
|
57
|
+
- [core] Fix Typescript error on field hooks (#5892) @flaviendelangle
|
|
58
|
+
- [core] Memoize `columns` in `useDemoData` hook (#5848) @cherniavskii
|
|
59
|
+
- [core] Remove Firefox from the BrowserStack list (#5874) @DanailH
|
|
60
|
+
- [core] Small changes to the release script (#5840) @m4theushw
|
|
61
|
+
|
|
62
|
+
## 5.15.3
|
|
63
|
+
|
|
64
|
+
_Aug 18, 2022_
|
|
65
|
+
|
|
66
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
67
|
+
|
|
68
|
+
- 📚 Documentation improvements
|
|
69
|
+
- 🐞 Bugfixes
|
|
70
|
+
|
|
71
|
+
### `@mui/x-data-grid@v5.15.3` / `@mui/x-data-grid-pro@v5.15.3` / `@mui/x-data-grid-premium@v5.15.3`
|
|
72
|
+
|
|
73
|
+
#### Changes
|
|
74
|
+
|
|
75
|
+
- [DataGrid] Fix <kbd>Enter</kbd> causing Select to re-open when commiting value (#5756) @m4theushw
|
|
76
|
+
- [DataGrid] Fix `GridOverlays` bypassing pointer events (#5674) @philjones88
|
|
77
|
+
|
|
78
|
+
### `@mui/x-date-pickers@v5.0.0-beta.6` / `@mui/x-date-picker-pro@v5.0.0-beta.6`
|
|
79
|
+
|
|
80
|
+
#### Changes
|
|
81
|
+
|
|
82
|
+
- [DatePicker] Support click on day outside of current month (#5768) @alexfauquette
|
|
83
|
+
- [pickers] Extend `PickersActionBarProps` with `DialogActionProps` (#5798) @LukasTy
|
|
84
|
+
|
|
85
|
+
### Docs
|
|
86
|
+
|
|
87
|
+
- [docs] Fix API anchor link scroll top (#5795) @oliviertassinari
|
|
88
|
+
- [docs] Fix contradiction in the free trial clause (#5732) @oliviertassinari
|
|
89
|
+
- [docs] Fix default value of the DataGrid `logLevel` prop to false (#5784) @HwangTaehyun
|
|
90
|
+
- [docs] Fix typo on the row height page (#5772) @flaviendelangle
|
|
91
|
+
- [docs] Improve "upgrading plans" documentation. (#5683) @joserodolfofreitas
|
|
92
|
+
- [docs] Link the license docs before pricing (#5726) @oliviertassinari
|
|
93
|
+
- [docs] Update packages README files (#5835) @cherniavskii
|
|
94
|
+
- [docs] Use `InputBase` for pickers inputs (#5597) @cherniavskii
|
|
95
|
+
|
|
96
|
+
### Core
|
|
97
|
+
|
|
98
|
+
- [core] Upgrade monorepo (#5771, #5797) @cherniavskii
|
|
99
|
+
- [core] Various TS improvements (#5556) @flaviendelangle
|
|
100
|
+
- [license] Give more context in the missing license (#5731) @oliviertassinari
|
|
101
|
+
- [license] Only log an error type once (#5730) @oliviertassinari
|
|
102
|
+
- [test] Increase timeout to take print screenshot (#5799) @m4theushw
|
|
103
|
+
|
|
104
|
+
## 5.15.2
|
|
105
|
+
|
|
106
|
+
_Aug 11, 2022_
|
|
107
|
+
|
|
108
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
109
|
+
|
|
110
|
+
- ✨ Improve quick filtering with row grouping (#5701) @alexfauquette
|
|
111
|
+
- 📚 Documentation improvements
|
|
112
|
+
- 🐞 Bugfixes
|
|
113
|
+
|
|
114
|
+
### `@mui/x-data-grid@v5.15.2` / `@mui/x-data-grid-pro@v5.15.2` / `@mui/x-data-grid-premium@v5.15.2`
|
|
115
|
+
|
|
116
|
+
#### Changes
|
|
117
|
+
|
|
118
|
+
- [DataGrid] Catch errors if rows freezing is not supported (#5711) @cherniavskii
|
|
119
|
+
- [DataGrid] Preserve cell mode when entering edit mode while commiting (#5686) @m4theushw
|
|
120
|
+
- [DataGridPremium] Let quick filter search in row grouping children (#5701) @alexfauquette
|
|
121
|
+
|
|
122
|
+
### `@mui/x-date-pickers@v5.0.0-beta.5` / `@mui/x-date-picker-pro@5.0.0-beta.5`
|
|
123
|
+
|
|
124
|
+
#### Changes
|
|
125
|
+
|
|
126
|
+
- [pickers] Add `react-dom` to peerDependencies (#5752) @cherniavskii
|
|
127
|
+
- [TimePicker] Set clock focus outline to `none` (#5758) @LukasTy
|
|
128
|
+
- [pickers] Fix theme augmentation with TypeScript (#5596) @alexfauquette
|
|
129
|
+
- [pickers] Reset input value when locale is modified (#5310) @alexfauquette
|
|
130
|
+
- [pickers] Support `disableHighlightToday` on `MonthPicker` and `YearPicker` (#5562) @flaviendelangle
|
|
131
|
+
- [pickers] Fallback to desktop mode when `matchMedia` is unavailable (#5684) @LukasTy
|
|
132
|
+
- [pickers] Trigger `onChange` when clearing or accepting `Invalid date` (#5740) @LukasTy
|
|
133
|
+
|
|
134
|
+
### Docs
|
|
135
|
+
|
|
136
|
+
- [docs] Add RFC GH issue template (#5739) @bytasv
|
|
137
|
+
- [docs] Add description to the `GridExportStateParams` page (#5654) @oliviertassinari
|
|
138
|
+
- [docs] Improve the Events page (#5413) @flaviendelangle
|
|
139
|
+
- [docs] Use new editing API in the introduction demos (#5728) @oliviertassinari
|
|
140
|
+
|
|
141
|
+
### Core
|
|
142
|
+
|
|
143
|
+
- [core] Remove duplicated `FUNDING.yml` file (#5656) @oliviertassinari
|
|
144
|
+
- [core] Remove outdated Next.js options (#5727) @oliviertassinari
|
|
145
|
+
- [core] Update tooling to run with React 18 (#4155) @m4theushw
|
|
146
|
+
- [test] Fix failing dynamic row height tests on Edge (#5707) @m4theushw
|
|
147
|
+
|
|
6
148
|
## 5.15.1
|
|
7
149
|
|
|
8
150
|
_Aug 4, 2022_
|
|
@@ -124,6 +124,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
124
124
|
* @default 3
|
|
125
125
|
*/
|
|
126
126
|
columnBuffer: PropTypes.number,
|
|
127
|
+
columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
|
|
127
128
|
|
|
128
129
|
/**
|
|
129
130
|
* Set of columns of type [[GridColumns]].
|
|
@@ -305,6 +306,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
305
306
|
*/
|
|
306
307
|
experimentalFeatures: PropTypes.shape({
|
|
307
308
|
aggregation: PropTypes.bool,
|
|
309
|
+
columnGrouping: PropTypes.bool,
|
|
308
310
|
newEditingApi: PropTypes.bool,
|
|
309
311
|
preventCommitWhileValidating: PropTypes.bool,
|
|
310
312
|
rowPinning: PropTypes.bool,
|
|
@@ -517,7 +519,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
517
519
|
|
|
518
520
|
/**
|
|
519
521
|
* Allows to pass the logging level or false to turn off logging.
|
|
520
|
-
* @default "
|
|
522
|
+
* @default "error" ("warn" in dev mode)
|
|
521
523
|
*/
|
|
522
524
|
logLevel: PropTypes.oneOf(['debug', 'error', 'info', 'warn', false]),
|
|
523
525
|
|
|
@@ -875,7 +877,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
875
877
|
* @param {GridState} state The new state.
|
|
876
878
|
* @param {MuiEvent<{}>} event The event object.
|
|
877
879
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
878
|
-
* @
|
|
880
|
+
* @ignore - do not document.
|
|
879
881
|
*/
|
|
880
882
|
onStateChange: PropTypes.func,
|
|
881
883
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer } from '@mui/x-data-grid-pro/internals';
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridColumnGroupingPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping } from '@mui/x-data-grid-pro/internals';
|
|
2
2
|
// Premium-only features
|
|
3
3
|
import { useGridAggregation, aggregationStateInitializer } from '../hooks/features/aggregation/useGridAggregation';
|
|
4
4
|
import { useGridAggregationPreProcessors } from '../hooks/features/aggregation/useGridAggregationPreProcessors';
|
|
@@ -13,6 +13,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
13
13
|
* Register all pre-processors called during state initialization here.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
useGridColumnGroupingPreProcessors(apiRef, props);
|
|
16
17
|
useGridSelectionPreProcessors(apiRef, props);
|
|
17
18
|
useGridRowReorderPreProcessors(apiRef, props);
|
|
18
19
|
useGridRowGroupingPreProcessors(apiRef, props);
|
|
@@ -59,6 +60,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
59
60
|
useGridParamsApi(apiRef);
|
|
60
61
|
useGridDetailPanel(apiRef, props);
|
|
61
62
|
useGridColumnSpanning(apiRef);
|
|
63
|
+
useGridColumnGrouping(apiRef, props);
|
|
62
64
|
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
63
65
|
useGridEditing(apiRef, props);
|
|
64
66
|
useGridFocus(apiRef, props);
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @mui/x-data-grid-
|
|
1
|
+
# @mui/x-data-grid-premium
|
|
2
2
|
|
|
3
3
|
This package is the Premium plan edition of the data grid component.
|
|
4
4
|
It's part of MUI X, an open core extension of MUI, with advanced components.
|
|
@@ -21,7 +21,8 @@ This component has the following peer dependencies that you will need to install
|
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@mui/material": "^5.4.1",
|
|
23
23
|
"@mui/system": "^5.4.1",
|
|
24
|
-
"react": "^17.0.2 || ^18.0.0"
|
|
24
|
+
"react": "^17.0.2 || ^18.0.0",
|
|
25
|
+
"react-dom": "^17.0.2 || ^18.0.0"
|
|
25
26
|
},
|
|
26
27
|
```
|
|
27
28
|
|
|
@@ -66,11 +66,6 @@ const getLeafProperties = leafColDef => {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
return params => {
|
|
69
|
-
// We only want to filter leaves
|
|
70
|
-
if (params.rowNode.groupingField != null) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
69
|
return originalFn(params);
|
|
75
70
|
};
|
|
76
71
|
}
|
|
@@ -109,11 +104,6 @@ const getGroupingCriteriaProperties = (groupedByColDef, applyHeaderName) => {
|
|
|
109
104
|
}
|
|
110
105
|
|
|
111
106
|
return params => {
|
|
112
|
-
// We only want to filter the groups of the current grouping criteria
|
|
113
|
-
if (params.rowNode.groupingField !== groupedByColDef.field) {
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
107
|
return originalFn(params);
|
|
118
108
|
};
|
|
119
109
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridRowTreeConfig, GridFilterState } from '@mui/x-data-grid-pro';
|
|
2
|
+
import { GridRowTreeConfig, GridFilterState, GridFilterModel } from '@mui/x-data-grid-pro';
|
|
3
3
|
import { GridAggregatedFilterItemApplier } from '@mui/x-data-grid-pro/internals';
|
|
4
4
|
import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
|
|
5
5
|
import { GridRowGroupingModel } from './gridRowGroupingInterfaces';
|
|
@@ -13,6 +13,7 @@ export declare const isGroupingColumn: (field: string) => boolean;
|
|
|
13
13
|
interface FilterRowTreeFromTreeDataParams {
|
|
14
14
|
rowTree: GridRowTreeConfig;
|
|
15
15
|
isRowMatchingFilters: GridAggregatedFilterItemApplier | null;
|
|
16
|
+
filterModel: GridFilterModel;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* A leaf is visible if it passed the filter
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { passFilterLogic } from '@mui/x-data-grid-pro/internals';
|
|
2
3
|
import { gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
|
|
3
4
|
export const GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = '__row_group_by_columns_group__';
|
|
4
5
|
export const ROW_GROUPING_STRATEGY = 'grouping-columns';
|
|
@@ -42,48 +43,56 @@ const shouldApplyFilterItemOnGroup = (columnField, node) => {
|
|
|
42
43
|
export const filterRowTreeFromGroupingColumns = params => {
|
|
43
44
|
const {
|
|
44
45
|
rowTree,
|
|
45
|
-
isRowMatchingFilters
|
|
46
|
+
isRowMatchingFilters,
|
|
47
|
+
filterModel
|
|
46
48
|
} = params;
|
|
47
49
|
const visibleRowsLookup = {};
|
|
48
50
|
const filteredRowsLookup = {};
|
|
49
51
|
const filteredDescendantCountLookup = {};
|
|
50
52
|
|
|
51
|
-
const filterTreeNode = (node,
|
|
52
|
-
var _node$children
|
|
53
|
+
const filterTreeNode = (node, areAncestorsExpanded, ancestorsResults) => {
|
|
54
|
+
var _node$children;
|
|
53
55
|
|
|
54
|
-
let
|
|
56
|
+
let isPassingFiltering = false;
|
|
57
|
+
let filterResults = {
|
|
58
|
+
passingFilterItems: null,
|
|
59
|
+
passingQuickFilterValues: null
|
|
60
|
+
};
|
|
55
61
|
|
|
56
|
-
if (
|
|
57
|
-
isMatchingFilters = true;
|
|
58
|
-
} else {
|
|
62
|
+
if (isRowMatchingFilters && node.position !== 'footer') {
|
|
59
63
|
const shouldApplyItem = node.isAutoGenerated ? columnField => shouldApplyFilterItemOnGroup(columnField, node) : undefined;
|
|
60
|
-
|
|
64
|
+
filterResults = isRowMatchingFilters(node.id, shouldApplyItem);
|
|
65
|
+
} else {
|
|
66
|
+
isPassingFiltering = true;
|
|
61
67
|
}
|
|
62
68
|
|
|
63
69
|
let filteredDescendantCount = 0;
|
|
64
70
|
(_node$children = node.children) == null ? void 0 : _node$children.forEach(childId => {
|
|
65
71
|
const childNode = rowTree[childId];
|
|
66
|
-
const childSubTreeSize = filterTreeNode(childNode,
|
|
72
|
+
const childSubTreeSize = filterTreeNode(childNode, areAncestorsExpanded && !!node.childrenExpanded, [...ancestorsResults, filterResults]);
|
|
67
73
|
filteredDescendantCount += childSubTreeSize;
|
|
68
74
|
});
|
|
69
|
-
let shouldPassFilters;
|
|
70
75
|
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
if (isPassingFiltering === false) {
|
|
77
|
+
var _node$children2;
|
|
78
|
+
|
|
79
|
+
if ((_node$children2 = node.children) != null && _node$children2.length) {
|
|
80
|
+
// If node has children - it's passing if at least one child passes filters
|
|
81
|
+
isPassingFiltering = filteredDescendantCount > 0;
|
|
82
|
+
} else {
|
|
83
|
+
const allResults = [...ancestorsResults, filterResults];
|
|
84
|
+
isPassingFiltering = passFilterLogic(allResults.map(result => result.passingFilterItems), allResults.map(result => result.passingQuickFilterValues), filterModel);
|
|
85
|
+
}
|
|
77
86
|
}
|
|
78
87
|
|
|
79
|
-
visibleRowsLookup[node.id] =
|
|
80
|
-
filteredRowsLookup[node.id] =
|
|
88
|
+
visibleRowsLookup[node.id] = isPassingFiltering && areAncestorsExpanded;
|
|
89
|
+
filteredRowsLookup[node.id] = isPassingFiltering;
|
|
81
90
|
|
|
82
91
|
if (node.footerId != null) {
|
|
83
|
-
visibleRowsLookup[node.footerId] =
|
|
92
|
+
visibleRowsLookup[node.footerId] = isPassingFiltering && areAncestorsExpanded && !!node.childrenExpanded;
|
|
84
93
|
}
|
|
85
94
|
|
|
86
|
-
if (!
|
|
95
|
+
if (!isPassingFiltering) {
|
|
87
96
|
return 0;
|
|
88
97
|
}
|
|
89
98
|
|
|
@@ -102,7 +111,7 @@ export const filterRowTreeFromGroupingColumns = params => {
|
|
|
102
111
|
const node = nodes[i];
|
|
103
112
|
|
|
104
113
|
if (node.depth === 0) {
|
|
105
|
-
filterTreeNode(node, true,
|
|
114
|
+
filterTreeNode(node, true, []);
|
|
106
115
|
}
|
|
107
116
|
}
|
|
108
117
|
|
|
@@ -136,7 +136,8 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
136
136
|
const rowTree = gridRowTreeSelector(apiRef);
|
|
137
137
|
return filterRowTreeFromGroupingColumns({
|
|
138
138
|
rowTree,
|
|
139
|
-
isRowMatchingFilters: params.isRowMatchingFilters
|
|
139
|
+
isRowMatchingFilters: params.isRowMatchingFilters,
|
|
140
|
+
filterModel: params.filterModel
|
|
140
141
|
});
|
|
141
142
|
}, [apiRef]);
|
|
142
143
|
const sortRows = React.useCallback(params => {
|
package/index.js
CHANGED
|
@@ -124,6 +124,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
124
124
|
* @default 3
|
|
125
125
|
*/
|
|
126
126
|
columnBuffer: PropTypes.number,
|
|
127
|
+
columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
|
|
127
128
|
|
|
128
129
|
/**
|
|
129
130
|
* Set of columns of type [[GridColumns]].
|
|
@@ -305,6 +306,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
305
306
|
*/
|
|
306
307
|
experimentalFeatures: PropTypes.shape({
|
|
307
308
|
aggregation: PropTypes.bool,
|
|
309
|
+
columnGrouping: PropTypes.bool,
|
|
308
310
|
newEditingApi: PropTypes.bool,
|
|
309
311
|
preventCommitWhileValidating: PropTypes.bool,
|
|
310
312
|
rowPinning: PropTypes.bool,
|
|
@@ -517,7 +519,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
517
519
|
|
|
518
520
|
/**
|
|
519
521
|
* Allows to pass the logging level or false to turn off logging.
|
|
520
|
-
* @default "
|
|
522
|
+
* @default "error" ("warn" in dev mode)
|
|
521
523
|
*/
|
|
522
524
|
logLevel: PropTypes.oneOf(['debug', 'error', 'info', 'warn', false]),
|
|
523
525
|
|
|
@@ -875,7 +877,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
875
877
|
* @param {GridState} state The new state.
|
|
876
878
|
* @param {MuiEvent<{}>} event The event object.
|
|
877
879
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
878
|
-
* @
|
|
880
|
+
* @ignore - do not document.
|
|
879
881
|
*/
|
|
880
882
|
onStateChange: PropTypes.func,
|
|
881
883
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer } from '@mui/x-data-grid-pro/internals';
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridColumnGroupingPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping } from '@mui/x-data-grid-pro/internals';
|
|
2
2
|
// Premium-only features
|
|
3
3
|
import { useGridAggregation, aggregationStateInitializer } from '../hooks/features/aggregation/useGridAggregation';
|
|
4
4
|
import { useGridAggregationPreProcessors } from '../hooks/features/aggregation/useGridAggregationPreProcessors';
|
|
@@ -13,6 +13,7 @@ export var useDataGridPremiumComponent = function useDataGridPremiumComponent(in
|
|
|
13
13
|
* Register all pre-processors called during state initialization here.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
useGridColumnGroupingPreProcessors(apiRef, props);
|
|
16
17
|
useGridSelectionPreProcessors(apiRef, props);
|
|
17
18
|
useGridRowReorderPreProcessors(apiRef, props);
|
|
18
19
|
useGridRowGroupingPreProcessors(apiRef, props);
|
|
@@ -59,6 +60,7 @@ export var useDataGridPremiumComponent = function useDataGridPremiumComponent(in
|
|
|
59
60
|
useGridParamsApi(apiRef);
|
|
60
61
|
useGridDetailPanel(apiRef, props);
|
|
61
62
|
useGridColumnSpanning(apiRef);
|
|
63
|
+
useGridColumnGrouping(apiRef, props);
|
|
62
64
|
var useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
63
65
|
useGridEditing(apiRef, props);
|
|
64
66
|
useGridFocus(apiRef, props);
|
|
@@ -68,11 +68,6 @@ var getLeafProperties = function getLeafProperties(leafColDef) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
return function (params) {
|
|
71
|
-
// We only want to filter leaves
|
|
72
|
-
if (params.rowNode.groupingField != null) {
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
71
|
return originalFn(params);
|
|
77
72
|
};
|
|
78
73
|
}
|
|
@@ -113,11 +108,6 @@ var getGroupingCriteriaProperties = function getGroupingCriteriaProperties(group
|
|
|
113
108
|
}
|
|
114
109
|
|
|
115
110
|
return function (params) {
|
|
116
|
-
// We only want to filter the groups of the current grouping criteria
|
|
117
|
-
if (params.rowNode.groupingField !== groupedByColDef.field) {
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
111
|
return originalFn(params);
|
|
122
112
|
};
|
|
123
113
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import { passFilterLogic } from '@mui/x-data-grid-pro/internals';
|
|
2
4
|
import { gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
|
|
3
5
|
export var GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = '__row_group_by_columns_group__';
|
|
4
6
|
export var ROW_GROUPING_STRATEGY = 'grouping-columns';
|
|
@@ -43,49 +45,61 @@ var shouldApplyFilterItemOnGroup = function shouldApplyFilterItemOnGroup(columnF
|
|
|
43
45
|
|
|
44
46
|
export var filterRowTreeFromGroupingColumns = function filterRowTreeFromGroupingColumns(params) {
|
|
45
47
|
var rowTree = params.rowTree,
|
|
46
|
-
isRowMatchingFilters = params.isRowMatchingFilters
|
|
48
|
+
isRowMatchingFilters = params.isRowMatchingFilters,
|
|
49
|
+
filterModel = params.filterModel;
|
|
47
50
|
var visibleRowsLookup = {};
|
|
48
51
|
var filteredRowsLookup = {};
|
|
49
52
|
var filteredDescendantCountLookup = {};
|
|
50
53
|
|
|
51
|
-
var filterTreeNode = function filterTreeNode(node,
|
|
52
|
-
var _node$children
|
|
54
|
+
var filterTreeNode = function filterTreeNode(node, areAncestorsExpanded, ancestorsResults) {
|
|
55
|
+
var _node$children;
|
|
53
56
|
|
|
54
|
-
var
|
|
57
|
+
var isPassingFiltering = false;
|
|
58
|
+
var filterResults = {
|
|
59
|
+
passingFilterItems: null,
|
|
60
|
+
passingQuickFilterValues: null
|
|
61
|
+
};
|
|
55
62
|
|
|
56
|
-
if (
|
|
57
|
-
isMatchingFilters = true;
|
|
58
|
-
} else {
|
|
63
|
+
if (isRowMatchingFilters && node.position !== 'footer') {
|
|
59
64
|
var shouldApplyItem = node.isAutoGenerated ? function (columnField) {
|
|
60
65
|
return shouldApplyFilterItemOnGroup(columnField, node);
|
|
61
66
|
} : undefined;
|
|
62
|
-
|
|
67
|
+
filterResults = isRowMatchingFilters(node.id, shouldApplyItem);
|
|
68
|
+
} else {
|
|
69
|
+
isPassingFiltering = true;
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
var filteredDescendantCount = 0;
|
|
66
73
|
(_node$children = node.children) == null ? void 0 : _node$children.forEach(function (childId) {
|
|
67
74
|
var childNode = rowTree[childId];
|
|
68
|
-
var childSubTreeSize = filterTreeNode(childNode,
|
|
75
|
+
var childSubTreeSize = filterTreeNode(childNode, areAncestorsExpanded && !!node.childrenExpanded, [].concat(_toConsumableArray(ancestorsResults), [filterResults]));
|
|
69
76
|
filteredDescendantCount += childSubTreeSize;
|
|
70
77
|
});
|
|
71
|
-
var shouldPassFilters;
|
|
72
78
|
|
|
73
|
-
if (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
if (isPassingFiltering === false) {
|
|
80
|
+
var _node$children2;
|
|
81
|
+
|
|
82
|
+
if ((_node$children2 = node.children) != null && _node$children2.length) {
|
|
83
|
+
// If node has children - it's passing if at least one child passes filters
|
|
84
|
+
isPassingFiltering = filteredDescendantCount > 0;
|
|
85
|
+
} else {
|
|
86
|
+
var allResults = [].concat(_toConsumableArray(ancestorsResults), [filterResults]);
|
|
87
|
+
isPassingFiltering = passFilterLogic(allResults.map(function (result) {
|
|
88
|
+
return result.passingFilterItems;
|
|
89
|
+
}), allResults.map(function (result) {
|
|
90
|
+
return result.passingQuickFilterValues;
|
|
91
|
+
}), filterModel);
|
|
92
|
+
}
|
|
79
93
|
}
|
|
80
94
|
|
|
81
|
-
visibleRowsLookup[node.id] =
|
|
82
|
-
filteredRowsLookup[node.id] =
|
|
95
|
+
visibleRowsLookup[node.id] = isPassingFiltering && areAncestorsExpanded;
|
|
96
|
+
filteredRowsLookup[node.id] = isPassingFiltering;
|
|
83
97
|
|
|
84
98
|
if (node.footerId != null) {
|
|
85
|
-
visibleRowsLookup[node.footerId] =
|
|
99
|
+
visibleRowsLookup[node.footerId] = isPassingFiltering && areAncestorsExpanded && !!node.childrenExpanded;
|
|
86
100
|
}
|
|
87
101
|
|
|
88
|
-
if (!
|
|
102
|
+
if (!isPassingFiltering) {
|
|
89
103
|
return 0;
|
|
90
104
|
}
|
|
91
105
|
|
|
@@ -104,7 +118,7 @@ export var filterRowTreeFromGroupingColumns = function filterRowTreeFromGrouping
|
|
|
104
118
|
var node = nodes[i];
|
|
105
119
|
|
|
106
120
|
if (node.depth === 0) {
|
|
107
|
-
filterTreeNode(node, true,
|
|
121
|
+
filterTreeNode(node, true, []);
|
|
108
122
|
}
|
|
109
123
|
}
|
|
110
124
|
|
|
@@ -146,7 +146,8 @@ export var useGridRowGroupingPreProcessors = function useGridRowGroupingPreProce
|
|
|
146
146
|
var rowTree = gridRowTreeSelector(apiRef);
|
|
147
147
|
return filterRowTreeFromGroupingColumns({
|
|
148
148
|
rowTree: rowTree,
|
|
149
|
-
isRowMatchingFilters: params.isRowMatchingFilters
|
|
149
|
+
isRowMatchingFilters: params.isRowMatchingFilters,
|
|
150
|
+
filterModel: params.filterModel
|
|
150
151
|
});
|
|
151
152
|
}, [apiRef]);
|
|
152
153
|
var sortRows = React.useCallback(function (params) {
|
package/legacy/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export var getReleaseInfo = function getReleaseInfo() {
|
|
3
|
-
var releaseInfo = "
|
|
3
|
+
var releaseInfo = "MTY2MTM3ODQwMDAwMA==";
|
|
4
4
|
|
|
5
5
|
if (process.env.NODE_ENV !== 'production') {
|
|
6
6
|
// A simple hack to set the value in the test environment (has no build step).
|
|
@@ -124,6 +124,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
124
124
|
* @default 3
|
|
125
125
|
*/
|
|
126
126
|
columnBuffer: PropTypes.number,
|
|
127
|
+
columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
|
|
127
128
|
|
|
128
129
|
/**
|
|
129
130
|
* Set of columns of type [[GridColumns]].
|
|
@@ -305,6 +306,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
305
306
|
*/
|
|
306
307
|
experimentalFeatures: PropTypes.shape({
|
|
307
308
|
aggregation: PropTypes.bool,
|
|
309
|
+
columnGrouping: PropTypes.bool,
|
|
308
310
|
newEditingApi: PropTypes.bool,
|
|
309
311
|
preventCommitWhileValidating: PropTypes.bool,
|
|
310
312
|
rowPinning: PropTypes.bool,
|
|
@@ -517,7 +519,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
517
519
|
|
|
518
520
|
/**
|
|
519
521
|
* Allows to pass the logging level or false to turn off logging.
|
|
520
|
-
* @default "
|
|
522
|
+
* @default "error" ("warn" in dev mode)
|
|
521
523
|
*/
|
|
522
524
|
logLevel: PropTypes.oneOf(['debug', 'error', 'info', 'warn', false]),
|
|
523
525
|
|
|
@@ -875,7 +877,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
875
877
|
* @param {GridState} state The new state.
|
|
876
878
|
* @param {MuiEvent<{}>} event The event object.
|
|
877
879
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
878
|
-
* @
|
|
880
|
+
* @ignore - do not document.
|
|
879
881
|
*/
|
|
880
882
|
onStateChange: PropTypes.func,
|
|
881
883
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer } from '@mui/x-data-grid-pro/internals';
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridColumnGroupingPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping } from '@mui/x-data-grid-pro/internals';
|
|
2
2
|
// Premium-only features
|
|
3
3
|
import { useGridAggregation, aggregationStateInitializer } from '../hooks/features/aggregation/useGridAggregation';
|
|
4
4
|
import { useGridAggregationPreProcessors } from '../hooks/features/aggregation/useGridAggregationPreProcessors';
|
|
@@ -11,6 +11,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
11
11
|
* Register all pre-processors called during state initialization here.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
useGridColumnGroupingPreProcessors(apiRef, props);
|
|
14
15
|
useGridSelectionPreProcessors(apiRef, props);
|
|
15
16
|
useGridRowReorderPreProcessors(apiRef, props);
|
|
16
17
|
useGridRowGroupingPreProcessors(apiRef, props);
|
|
@@ -57,6 +58,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
57
58
|
useGridParamsApi(apiRef);
|
|
58
59
|
useGridDetailPanel(apiRef, props);
|
|
59
60
|
useGridColumnSpanning(apiRef);
|
|
61
|
+
useGridColumnGrouping(apiRef, props);
|
|
60
62
|
const useGridEditing = props.experimentalFeatures?.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
61
63
|
useGridEditing(apiRef, props);
|
|
62
64
|
useGridFocus(apiRef, props);
|
|
@@ -63,11 +63,6 @@ const getLeafProperties = leafColDef => ({
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return params => {
|
|
66
|
-
// We only want to filter leaves
|
|
67
|
-
if (params.rowNode.groupingField != null) {
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
66
|
return originalFn(params);
|
|
72
67
|
};
|
|
73
68
|
}
|
|
@@ -103,11 +98,6 @@ const getGroupingCriteriaProperties = (groupedByColDef, applyHeaderName) => {
|
|
|
103
98
|
}
|
|
104
99
|
|
|
105
100
|
return params => {
|
|
106
|
-
// We only want to filter the groups of the current grouping criteria
|
|
107
|
-
if (params.rowNode.groupingField !== groupedByColDef.field) {
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
101
|
return originalFn(params);
|
|
112
102
|
};
|
|
113
103
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { passFilterLogic } from '@mui/x-data-grid-pro/internals';
|
|
2
3
|
import { gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
|
|
3
4
|
export const GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = '__row_group_by_columns_group__';
|
|
4
5
|
export const ROW_GROUPING_STRATEGY = 'grouping-columns';
|
|
@@ -42,46 +43,52 @@ const shouldApplyFilterItemOnGroup = (columnField, node) => {
|
|
|
42
43
|
export const filterRowTreeFromGroupingColumns = params => {
|
|
43
44
|
const {
|
|
44
45
|
rowTree,
|
|
45
|
-
isRowMatchingFilters
|
|
46
|
+
isRowMatchingFilters,
|
|
47
|
+
filterModel
|
|
46
48
|
} = params;
|
|
47
49
|
const visibleRowsLookup = {};
|
|
48
50
|
const filteredRowsLookup = {};
|
|
49
51
|
const filteredDescendantCountLookup = {};
|
|
50
52
|
|
|
51
|
-
const filterTreeNode = (node,
|
|
52
|
-
let
|
|
53
|
+
const filterTreeNode = (node, areAncestorsExpanded, ancestorsResults) => {
|
|
54
|
+
let isPassingFiltering = false;
|
|
55
|
+
let filterResults = {
|
|
56
|
+
passingFilterItems: null,
|
|
57
|
+
passingQuickFilterValues: null
|
|
58
|
+
};
|
|
53
59
|
|
|
54
|
-
if (
|
|
55
|
-
isMatchingFilters = true;
|
|
56
|
-
} else {
|
|
60
|
+
if (isRowMatchingFilters && node.position !== 'footer') {
|
|
57
61
|
const shouldApplyItem = node.isAutoGenerated ? columnField => shouldApplyFilterItemOnGroup(columnField, node) : undefined;
|
|
58
|
-
|
|
62
|
+
filterResults = isRowMatchingFilters(node.id, shouldApplyItem);
|
|
63
|
+
} else {
|
|
64
|
+
isPassingFiltering = true;
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
let filteredDescendantCount = 0;
|
|
62
68
|
node.children?.forEach(childId => {
|
|
63
69
|
const childNode = rowTree[childId];
|
|
64
|
-
const childSubTreeSize = filterTreeNode(childNode,
|
|
70
|
+
const childSubTreeSize = filterTreeNode(childNode, areAncestorsExpanded && !!node.childrenExpanded, [...ancestorsResults, filterResults]);
|
|
65
71
|
filteredDescendantCount += childSubTreeSize;
|
|
66
72
|
});
|
|
67
|
-
let shouldPassFilters;
|
|
68
73
|
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
if (isPassingFiltering === false) {
|
|
75
|
+
if (node.children?.length) {
|
|
76
|
+
// If node has children - it's passing if at least one child passes filters
|
|
77
|
+
isPassingFiltering = filteredDescendantCount > 0;
|
|
78
|
+
} else {
|
|
79
|
+
const allResults = [...ancestorsResults, filterResults];
|
|
80
|
+
isPassingFiltering = passFilterLogic(allResults.map(result => result.passingFilterItems), allResults.map(result => result.passingQuickFilterValues), filterModel);
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
|
|
77
|
-
visibleRowsLookup[node.id] =
|
|
78
|
-
filteredRowsLookup[node.id] =
|
|
84
|
+
visibleRowsLookup[node.id] = isPassingFiltering && areAncestorsExpanded;
|
|
85
|
+
filteredRowsLookup[node.id] = isPassingFiltering;
|
|
79
86
|
|
|
80
87
|
if (node.footerId != null) {
|
|
81
|
-
visibleRowsLookup[node.footerId] =
|
|
88
|
+
visibleRowsLookup[node.footerId] = isPassingFiltering && areAncestorsExpanded && !!node.childrenExpanded;
|
|
82
89
|
}
|
|
83
90
|
|
|
84
|
-
if (!
|
|
91
|
+
if (!isPassingFiltering) {
|
|
85
92
|
return 0;
|
|
86
93
|
}
|
|
87
94
|
|
|
@@ -100,7 +107,7 @@ export const filterRowTreeFromGroupingColumns = params => {
|
|
|
100
107
|
const node = nodes[i];
|
|
101
108
|
|
|
102
109
|
if (node.depth === 0) {
|
|
103
|
-
filterTreeNode(node, true,
|
|
110
|
+
filterTreeNode(node, true, []);
|
|
104
111
|
}
|
|
105
112
|
}
|
|
106
113
|
|
|
@@ -136,7 +136,8 @@ export const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
136
136
|
const rowTree = gridRowTreeSelector(apiRef);
|
|
137
137
|
return filterRowTreeFromGroupingColumns({
|
|
138
138
|
rowTree,
|
|
139
|
-
isRowMatchingFilters: params.isRowMatchingFilters
|
|
139
|
+
isRowMatchingFilters: params.isRowMatchingFilters,
|
|
140
|
+
filterModel: params.filterModel
|
|
140
141
|
});
|
|
141
142
|
}, [apiRef]);
|
|
142
143
|
const sortRows = React.useCallback(params => {
|
package/modern/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY2MTM3ODQwMDAwMA==";
|
|
4
4
|
|
|
5
5
|
if (process.env.NODE_ENV !== 'production') {
|
|
6
6
|
// A simple hack to set the value in the test environment (has no build step).
|
|
@@ -147,6 +147,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
147
147
|
* @default 3
|
|
148
148
|
*/
|
|
149
149
|
columnBuffer: _propTypes.default.number,
|
|
150
|
+
columnGroupingModel: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
150
151
|
|
|
151
152
|
/**
|
|
152
153
|
* Set of columns of type [[GridColumns]].
|
|
@@ -328,6 +329,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
328
329
|
*/
|
|
329
330
|
experimentalFeatures: _propTypes.default.shape({
|
|
330
331
|
aggregation: _propTypes.default.bool,
|
|
332
|
+
columnGrouping: _propTypes.default.bool,
|
|
331
333
|
newEditingApi: _propTypes.default.bool,
|
|
332
334
|
preventCommitWhileValidating: _propTypes.default.bool,
|
|
333
335
|
rowPinning: _propTypes.default.bool,
|
|
@@ -540,7 +542,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
540
542
|
|
|
541
543
|
/**
|
|
542
544
|
* Allows to pass the logging level or false to turn off logging.
|
|
543
|
-
* @default "
|
|
545
|
+
* @default "error" ("warn" in dev mode)
|
|
544
546
|
*/
|
|
545
547
|
logLevel: _propTypes.default.oneOf(['debug', 'error', 'info', 'warn', false]),
|
|
546
548
|
|
|
@@ -898,7 +900,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
898
900
|
* @param {GridState} state The new state.
|
|
899
901
|
* @param {MuiEvent<{}>} event The event object.
|
|
900
902
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
901
|
-
* @
|
|
903
|
+
* @ignore - do not document.
|
|
902
904
|
*/
|
|
903
905
|
onStateChange: _propTypes.default.func,
|
|
904
906
|
|
|
@@ -26,6 +26,7 @@ const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
26
26
|
* Register all pre-processors called during state initialization here.
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
|
+
(0, _internals.useGridColumnGroupingPreProcessors)(apiRef, props);
|
|
29
30
|
(0, _internals.useGridSelectionPreProcessors)(apiRef, props);
|
|
30
31
|
(0, _internals.useGridRowReorderPreProcessors)(apiRef, props);
|
|
31
32
|
(0, _useGridRowGroupingPreProcessors.useGridRowGroupingPreProcessors)(apiRef, props);
|
|
@@ -72,6 +73,7 @@ const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
72
73
|
(0, _internals.useGridParamsApi)(apiRef);
|
|
73
74
|
(0, _internals.useGridDetailPanel)(apiRef, props);
|
|
74
75
|
(0, _internals.useGridColumnSpanning)(apiRef);
|
|
76
|
+
(0, _internals.useGridColumnGrouping)(apiRef, props);
|
|
75
77
|
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? _internals.useGridEditing_new : _internals.useGridEditing_old;
|
|
76
78
|
useGridEditing(apiRef, props);
|
|
77
79
|
(0, _internals.useGridFocus)(apiRef, props);
|
|
@@ -88,11 +88,6 @@ const getLeafProperties = leafColDef => {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
return params => {
|
|
91
|
-
// We only want to filter leaves
|
|
92
|
-
if (params.rowNode.groupingField != null) {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
91
|
return originalFn(params);
|
|
97
92
|
};
|
|
98
93
|
}
|
|
@@ -131,11 +126,6 @@ const getGroupingCriteriaProperties = (groupedByColDef, applyHeaderName) => {
|
|
|
131
126
|
}
|
|
132
127
|
|
|
133
128
|
return params => {
|
|
134
|
-
// We only want to filter the groups of the current grouping criteria
|
|
135
|
-
if (params.rowNode.groupingField !== groupedByColDef.field) {
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
129
|
return originalFn(params);
|
|
140
130
|
};
|
|
141
131
|
}
|
|
@@ -9,6 +9,8 @@ exports.setStrategyAvailability = exports.mergeStateWithRowGroupingModel = expor
|
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
12
|
+
var _internals = require("@mui/x-data-grid-pro/internals");
|
|
13
|
+
|
|
12
14
|
var _gridRowGroupingSelector = require("./gridRowGroupingSelector");
|
|
13
15
|
|
|
14
16
|
const GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD = '__row_group_by_columns_group__';
|
|
@@ -64,48 +66,56 @@ const shouldApplyFilterItemOnGroup = (columnField, node) => {
|
|
|
64
66
|
const filterRowTreeFromGroupingColumns = params => {
|
|
65
67
|
const {
|
|
66
68
|
rowTree,
|
|
67
|
-
isRowMatchingFilters
|
|
69
|
+
isRowMatchingFilters,
|
|
70
|
+
filterModel
|
|
68
71
|
} = params;
|
|
69
72
|
const visibleRowsLookup = {};
|
|
70
73
|
const filteredRowsLookup = {};
|
|
71
74
|
const filteredDescendantCountLookup = {};
|
|
72
75
|
|
|
73
|
-
const filterTreeNode = (node,
|
|
74
|
-
var _node$children
|
|
76
|
+
const filterTreeNode = (node, areAncestorsExpanded, ancestorsResults) => {
|
|
77
|
+
var _node$children;
|
|
75
78
|
|
|
76
|
-
let
|
|
79
|
+
let isPassingFiltering = false;
|
|
80
|
+
let filterResults = {
|
|
81
|
+
passingFilterItems: null,
|
|
82
|
+
passingQuickFilterValues: null
|
|
83
|
+
};
|
|
77
84
|
|
|
78
|
-
if (
|
|
79
|
-
isMatchingFilters = true;
|
|
80
|
-
} else {
|
|
85
|
+
if (isRowMatchingFilters && node.position !== 'footer') {
|
|
81
86
|
const shouldApplyItem = node.isAutoGenerated ? columnField => shouldApplyFilterItemOnGroup(columnField, node) : undefined;
|
|
82
|
-
|
|
87
|
+
filterResults = isRowMatchingFilters(node.id, shouldApplyItem);
|
|
88
|
+
} else {
|
|
89
|
+
isPassingFiltering = true;
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
let filteredDescendantCount = 0;
|
|
86
93
|
(_node$children = node.children) == null ? void 0 : _node$children.forEach(childId => {
|
|
87
94
|
const childNode = rowTree[childId];
|
|
88
|
-
const childSubTreeSize = filterTreeNode(childNode,
|
|
95
|
+
const childSubTreeSize = filterTreeNode(childNode, areAncestorsExpanded && !!node.childrenExpanded, [...ancestorsResults, filterResults]);
|
|
89
96
|
filteredDescendantCount += childSubTreeSize;
|
|
90
97
|
});
|
|
91
|
-
let shouldPassFilters;
|
|
92
98
|
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
if (isPassingFiltering === false) {
|
|
100
|
+
var _node$children2;
|
|
101
|
+
|
|
102
|
+
if ((_node$children2 = node.children) != null && _node$children2.length) {
|
|
103
|
+
// If node has children - it's passing if at least one child passes filters
|
|
104
|
+
isPassingFiltering = filteredDescendantCount > 0;
|
|
105
|
+
} else {
|
|
106
|
+
const allResults = [...ancestorsResults, filterResults];
|
|
107
|
+
isPassingFiltering = (0, _internals.passFilterLogic)(allResults.map(result => result.passingFilterItems), allResults.map(result => result.passingQuickFilterValues), filterModel);
|
|
108
|
+
}
|
|
99
109
|
}
|
|
100
110
|
|
|
101
|
-
visibleRowsLookup[node.id] =
|
|
102
|
-
filteredRowsLookup[node.id] =
|
|
111
|
+
visibleRowsLookup[node.id] = isPassingFiltering && areAncestorsExpanded;
|
|
112
|
+
filteredRowsLookup[node.id] = isPassingFiltering;
|
|
103
113
|
|
|
104
114
|
if (node.footerId != null) {
|
|
105
|
-
visibleRowsLookup[node.footerId] =
|
|
115
|
+
visibleRowsLookup[node.footerId] = isPassingFiltering && areAncestorsExpanded && !!node.childrenExpanded;
|
|
106
116
|
}
|
|
107
117
|
|
|
108
|
-
if (!
|
|
118
|
+
if (!isPassingFiltering) {
|
|
109
119
|
return 0;
|
|
110
120
|
}
|
|
111
121
|
|
|
@@ -124,7 +134,7 @@ const filterRowTreeFromGroupingColumns = params => {
|
|
|
124
134
|
const node = nodes[i];
|
|
125
135
|
|
|
126
136
|
if (node.depth === 0) {
|
|
127
|
-
filterTreeNode(node, true,
|
|
137
|
+
filterTreeNode(node, true, []);
|
|
128
138
|
}
|
|
129
139
|
}
|
|
130
140
|
|
|
@@ -156,7 +156,8 @@ const useGridRowGroupingPreProcessors = (apiRef, props) => {
|
|
|
156
156
|
const rowTree = (0, _xDataGridPro.gridRowTreeSelector)(apiRef);
|
|
157
157
|
return (0, _gridRowGroupingUtils.filterRowTreeFromGroupingColumns)({
|
|
158
158
|
rowTree,
|
|
159
|
-
isRowMatchingFilters: params.isRowMatchingFilters
|
|
159
|
+
isRowMatchingFilters: params.isRowMatchingFilters,
|
|
160
|
+
filterModel: params.filterModel
|
|
160
161
|
});
|
|
161
162
|
}, [apiRef]);
|
|
162
163
|
const sortRows = React.useCallback(params => {
|
package/node/index.js
CHANGED
|
@@ -8,7 +8,7 @@ exports.getReleaseInfo = void 0;
|
|
|
8
8
|
var _utils = require("@mui/utils");
|
|
9
9
|
|
|
10
10
|
const getReleaseInfo = () => {
|
|
11
|
-
const releaseInfo = "
|
|
11
|
+
const releaseInfo = "MTY2MTM3ODQwMDAwMA==";
|
|
12
12
|
|
|
13
13
|
if (process.env.NODE_ENV !== 'production') {
|
|
14
14
|
// A simple hack to set the value in the test environment (has no build step).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-premium",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.16.0",
|
|
4
4
|
"description": "The Premium plan edition of the data grid component (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"directory": "packages/grid/x-data-grid-premium"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@babel/runtime": "^7.18.
|
|
35
|
-
"@mui/utils": "^5.
|
|
36
|
-
"@mui/x-data-grid": "5.
|
|
37
|
-
"@mui/x-data-grid-pro": "5.
|
|
38
|
-
"@mui/x-license-pro": "5.
|
|
34
|
+
"@babel/runtime": "^7.18.9",
|
|
35
|
+
"@mui/utils": "^5.9.3",
|
|
36
|
+
"@mui/x-data-grid": "5.16.0",
|
|
37
|
+
"@mui/x-data-grid-pro": "5.16.0",
|
|
38
|
+
"@mui/x-license-pro": "5.16.0",
|
|
39
39
|
"@types/format-util": "^1.0.2",
|
|
40
40
|
"clsx": "^1.2.1",
|
|
41
41
|
"exceljs": "^4.3.0",
|
package/utils/releaseInfo.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY2MTM3ODQwMDAwMA==";
|
|
4
4
|
|
|
5
5
|
if (process.env.NODE_ENV !== 'production') {
|
|
6
6
|
// A simple hack to set the value in the test environment (has no build step).
|