@mui/x-data-grid-premium 5.15.1 → 5.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/DataGridPremium/DataGridPremium.js +1 -1
- 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 +1 -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 +1 -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 +1 -1
- 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 +3 -3
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,50 @@
|
|
|
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.15.2
|
|
7
|
+
|
|
8
|
+
_Aug 11, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- ✨ Improve quick filtering with row grouping (#5701) @alexfauquette
|
|
13
|
+
- 📚 Documentation improvements
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
|
|
16
|
+
### `@mui/x-data-grid@5.15.2` / `@mui/x-data-grid-pro@5.15.2` / `@mui/x-data-grid-premium@5.15.2`
|
|
17
|
+
|
|
18
|
+
#### Changes
|
|
19
|
+
|
|
20
|
+
- [DataGrid] Catch errors if rows freezing is not supported (#5711) @cherniavskii
|
|
21
|
+
- [DataGrid] Preserve cell mode when entering edit mode while commiting (#5686) @m4theushw
|
|
22
|
+
- [DataGridPremium] Let quick filter search in row grouping children (#5701) @alexfauquette
|
|
23
|
+
|
|
24
|
+
### `@mui/x-date-pickers@v5.0.0-beta.5` / `@mui/x-date-picker-pro@5.0.0-beta.5`
|
|
25
|
+
|
|
26
|
+
#### Changes
|
|
27
|
+
|
|
28
|
+
- [pickers] Add `react-dom` to peerDependencies (#5752) @cherniavskii
|
|
29
|
+
- [TimePicker] Set clock focus outline to `none` (#5758) @LukasTy
|
|
30
|
+
- [pickers] Fix theme augmentation with TypeScript (#5596) @alexfauquette
|
|
31
|
+
- [pickers] Reset input value when locale is modified (#5310) @alexfauquette
|
|
32
|
+
- [pickers] Support `disableHighlightToday` on `MonthPicker` and `YearPicker` (#5562) @flaviendelangle
|
|
33
|
+
- [pickers] Fallback to desktop mode when `matchMedia` is unavailable (#5684) @LukasTy
|
|
34
|
+
- [pickers] Trigger `onChange` when clearing or accepting `Invalid date` (#5740) @LukasTy
|
|
35
|
+
|
|
36
|
+
### Docs
|
|
37
|
+
|
|
38
|
+
- [docs] Add RFC GH issue template (#5739) @bytasv
|
|
39
|
+
- [docs] Add description to the `GridExportStateParams` page (#5654) @oliviertassinari
|
|
40
|
+
- [docs] Improve the Events page (#5413) @flaviendelangle
|
|
41
|
+
- [docs] Use new editing API in the introduction demos (#5728) @oliviertassinari
|
|
42
|
+
|
|
43
|
+
### Core
|
|
44
|
+
|
|
45
|
+
- [core] Remove duplicated `FUNDING.yml` file (#5656) @oliviertassinari
|
|
46
|
+
- [core] Remove outdated Next.js options (#5727) @oliviertassinari
|
|
47
|
+
- [core] Update tooling to run with React 18 (#4155) @m4theushw
|
|
48
|
+
- [test] Fix failing dynamic row height tests on Edge (#5707) @m4theushw
|
|
49
|
+
|
|
6
50
|
## 5.15.1
|
|
7
51
|
|
|
8
52
|
_Aug 4, 2022_
|
|
@@ -875,7 +875,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
875
875
|
* @param {GridState} state The new state.
|
|
876
876
|
* @param {MuiEvent<{}>} event The event object.
|
|
877
877
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
878
|
-
* @
|
|
878
|
+
* @ignore - do not document.
|
|
879
879
|
*/
|
|
880
880
|
onStateChange: PropTypes.func,
|
|
881
881
|
|
|
@@ -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
|
@@ -875,7 +875,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
875
875
|
* @param {GridState} state The new state.
|
|
876
876
|
* @param {MuiEvent<{}>} event The event object.
|
|
877
877
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
878
|
-
* @
|
|
878
|
+
* @ignore - do not document.
|
|
879
879
|
*/
|
|
880
880
|
onStateChange: PropTypes.func,
|
|
881
881
|
|
|
@@ -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 = "MTY2MDE2NTIwMDAwMA==";
|
|
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).
|
|
@@ -875,7 +875,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
875
875
|
* @param {GridState} state The new state.
|
|
876
876
|
* @param {MuiEvent<{}>} event The event object.
|
|
877
877
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
878
|
-
* @
|
|
878
|
+
* @ignore - do not document.
|
|
879
879
|
*/
|
|
880
880
|
onStateChange: PropTypes.func,
|
|
881
881
|
|
|
@@ -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 = "MTY2MDE2NTIwMDAwMA==";
|
|
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).
|
|
@@ -898,7 +898,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
898
898
|
* @param {GridState} state The new state.
|
|
899
899
|
* @param {MuiEvent<{}>} event The event object.
|
|
900
900
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
901
|
-
* @
|
|
901
|
+
* @ignore - do not document.
|
|
902
902
|
*/
|
|
903
903
|
onStateChange: _propTypes.default.func,
|
|
904
904
|
|
|
@@ -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 = "MTY2MDE2NTIwMDAwMA==";
|
|
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.15.
|
|
3
|
+
"version": "5.15.2",
|
|
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",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.18.6",
|
|
35
35
|
"@mui/utils": "^5.4.1",
|
|
36
|
-
"@mui/x-data-grid": "5.15.
|
|
37
|
-
"@mui/x-data-grid-pro": "5.15.
|
|
36
|
+
"@mui/x-data-grid": "5.15.2",
|
|
37
|
+
"@mui/x-data-grid-pro": "5.15.2",
|
|
38
38
|
"@mui/x-license-pro": "5.15.0",
|
|
39
39
|
"@types/format-util": "^1.0.2",
|
|
40
40
|
"clsx": "^1.2.1",
|
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 = "MTY2MDE2NTIwMDAwMA==";
|
|
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).
|