@mui/x-data-grid-pro 6.6.0 → 6.7.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 +72 -0
- package/components/headerFiltering/GridHeaderFilterCell.d.ts +0 -1
- package/components/headerFiltering/GridHeaderFilterCell.js +36 -23
- package/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
- package/components/headerFiltering/GridHeaderFilterMenu.d.ts +5 -2
- package/components/headerFiltering/GridHeaderFilterMenu.js +36 -15
- package/components/headerFiltering/{GridHeaderFilterAdornment.d.ts → GridHeaderFilterMenuContainer.d.ts} +3 -3
- package/{modern/components/headerFiltering/GridHeaderFilterAdornment.js → components/headerFiltering/GridHeaderFilterMenuContainer.js} +23 -24
- package/components/headerFiltering/index.d.ts +2 -1
- package/components/headerFiltering/index.js +3 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +16 -8
- package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
- package/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
- package/index.js +1 -1
- package/legacy/components/headerFiltering/GridHeaderFilterCell.js +39 -27
- package/legacy/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
- package/legacy/components/headerFiltering/GridHeaderFilterMenu.js +36 -15
- package/legacy/components/headerFiltering/{GridHeaderFilterAdornment.js → GridHeaderFilterMenuContainer.js} +23 -25
- package/legacy/components/headerFiltering/index.js +3 -2
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +14 -8
- package/legacy/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
- package/legacy/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
- package/legacy/index.js +1 -1
- package/legacy/material/icons.js +1 -4
- package/legacy/material/index.js +2 -3
- package/legacy/utils/releaseInfo.js +1 -1
- package/legacy/utils/tree/insertDataRowInTree.js +8 -24
- package/legacy/utils/tree/sortRowTree.js +78 -18
- package/legacy/utils/tree/utils.js +27 -40
- package/material/icons.d.ts +0 -3
- package/material/icons.js +1 -4
- package/material/index.d.ts +0 -1
- package/material/index.js +2 -3
- package/models/gridProIconSlotsComponent.d.ts +0 -5
- package/modern/components/headerFiltering/GridHeaderFilterCell.js +36 -23
- package/modern/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
- package/modern/components/headerFiltering/GridHeaderFilterMenu.js +36 -15
- package/{components/headerFiltering/GridHeaderFilterAdornment.js → modern/components/headerFiltering/GridHeaderFilterMenuContainer.js} +22 -25
- package/modern/components/headerFiltering/index.js +3 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +16 -8
- package/modern/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
- package/modern/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
- package/modern/index.js +1 -1
- package/modern/material/icons.js +1 -4
- package/modern/material/index.js +2 -3
- package/modern/utils/releaseInfo.js +1 -1
- package/modern/utils/tree/insertDataRowInTree.js +8 -24
- package/modern/utils/tree/sortRowTree.js +64 -18
- package/modern/utils/tree/utils.js +10 -25
- package/node/components/headerFiltering/GridHeaderFilterCell.js +36 -23
- package/node/components/headerFiltering/GridHeaderFilterClearButton.js +1 -1
- package/node/components/headerFiltering/GridHeaderFilterMenu.js +36 -14
- package/node/components/headerFiltering/{GridHeaderFilterAdornment.js → GridHeaderFilterMenuContainer.js} +22 -24
- package/node/components/headerFiltering/index.js +15 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +15 -7
- package/node/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -2
- package/node/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +1 -6
- package/node/index.js +1 -1
- package/node/material/icons.js +2 -6
- package/node/material/index.js +1 -2
- package/node/utils/releaseInfo.js +1 -1
- package/node/utils/tree/insertDataRowInTree.js +7 -23
- package/node/utils/tree/sortRowTree.js +64 -18
- package/node/utils/tree/utils.js +12 -27
- package/package.json +2 -2
- package/themeAugmentation/overrides.d.ts +1 -1
- package/typeOverloads/modules.d.ts +6 -6
- package/utils/releaseInfo.js +1 -1
- package/utils/tree/insertDataRowInTree.js +8 -24
- package/utils/tree/sortRowTree.js +64 -18
- package/utils/tree/utils.d.ts +3 -38
- package/utils/tree/utils.js +10 -25
- package/components/headerFiltering/constants.d.ts +0 -3
- package/components/headerFiltering/constants.js +0 -30
- package/legacy/components/headerFiltering/constants.js +0 -30
- package/modern/components/headerFiltering/constants.js +0 -30
- package/node/components/headerFiltering/constants.js +0 -37
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
4
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
5
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
6
6
|
import { GRID_ROOT_GROUP_ID } from '@mui/x-data-grid';
|
|
7
7
|
export var getGroupRowIdFromPath = function getGroupRowIdFromPath(path) {
|
|
8
8
|
var pathStr = path.map(function (groupingCriteria) {
|
|
@@ -25,10 +25,7 @@ export var getNodePathInTree = function getNodePathInTree(_ref) {
|
|
|
25
25
|
path.reverse();
|
|
26
26
|
return path;
|
|
27
27
|
};
|
|
28
|
-
export var
|
|
29
|
-
var node = _ref2.node,
|
|
30
|
-
isGroupExpandedByDefault = _ref2.isGroupExpandedByDefault,
|
|
31
|
-
defaultGroupingExpansionDepth = _ref2.defaultGroupingExpansionDepth;
|
|
28
|
+
export var updateGroupDefaultExpansion = function updateGroupDefaultExpansion(node, defaultGroupingExpansionDepth, isGroupExpandedByDefault) {
|
|
32
29
|
var childrenExpanded;
|
|
33
30
|
if (node.id === GRID_ROOT_GROUP_ID) {
|
|
34
31
|
childrenExpanded = true;
|
|
@@ -37,20 +34,15 @@ export var addGroupDefaultExpansion = function addGroupDefaultExpansion(_ref2) {
|
|
|
37
34
|
} else {
|
|
38
35
|
childrenExpanded = defaultGroupingExpansionDepth === -1 || defaultGroupingExpansionDepth > node.depth;
|
|
39
36
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
37
|
+
node.childrenExpanded = childrenExpanded;
|
|
38
|
+
return node;
|
|
43
39
|
};
|
|
44
40
|
|
|
45
41
|
/**
|
|
46
42
|
* Insert a node in the tree
|
|
47
43
|
*/
|
|
48
|
-
export var insertNodeInTree = function insertNodeInTree(
|
|
44
|
+
export var insertNodeInTree = function insertNodeInTree(node, tree, treeDepths, previousTree) {
|
|
49
45
|
var _treeDepths$node$dept;
|
|
50
|
-
var node = _ref3.node,
|
|
51
|
-
previousTree = _ref3.previousTree,
|
|
52
|
-
tree = _ref3.tree,
|
|
53
|
-
treeDepths = _ref3.treeDepths;
|
|
54
46
|
// 1. Insert node in the tree.
|
|
55
47
|
tree[node.id] = node;
|
|
56
48
|
|
|
@@ -59,11 +51,7 @@ export var insertNodeInTree = function insertNodeInTree(_ref3) {
|
|
|
59
51
|
|
|
60
52
|
// 3. Register the new node in its parent.
|
|
61
53
|
var parentNode = tree[node.parent];
|
|
62
|
-
if (node.type === '
|
|
63
|
-
// For footers,
|
|
64
|
-
// Register the node from its parent `footerId` property.
|
|
65
|
-
parentNode.footerId = node.id;
|
|
66
|
-
} else if (node.type === 'group' || node.type === 'leaf') {
|
|
54
|
+
if (node.type === 'group' || node.type === 'leaf') {
|
|
67
55
|
var _groupingField, _groupingKey, _parentNode$childrenF;
|
|
68
56
|
// For groups and leaves,
|
|
69
57
|
// Register the node from its parents `children` and `childrenFromPath` properties.
|
|
@@ -80,16 +68,20 @@ export var insertNodeInTree = function insertNodeInTree(_ref3) {
|
|
|
80
68
|
} else {
|
|
81
69
|
groupingField[groupingKeyName.toString()] = node.id;
|
|
82
70
|
}
|
|
71
|
+
} else if (node.type === 'footer') {
|
|
72
|
+
// For footers,
|
|
73
|
+
// Register the node from its parent `footerId` property.
|
|
74
|
+
parentNode.footerId = node.id;
|
|
83
75
|
}
|
|
84
76
|
};
|
|
85
77
|
|
|
86
78
|
/**
|
|
87
79
|
* Removes a node from the tree
|
|
88
80
|
*/
|
|
89
|
-
export var removeNodeFromTree = function removeNodeFromTree(
|
|
90
|
-
var node =
|
|
91
|
-
tree =
|
|
92
|
-
treeDepths =
|
|
81
|
+
export var removeNodeFromTree = function removeNodeFromTree(_ref2) {
|
|
82
|
+
var node = _ref2.node,
|
|
83
|
+
tree = _ref2.tree,
|
|
84
|
+
treeDepths = _ref2.treeDepths;
|
|
93
85
|
// 1. Remove node from the tree.
|
|
94
86
|
delete tree[node.id];
|
|
95
87
|
|
|
@@ -117,10 +109,10 @@ export var removeNodeFromTree = function removeNodeFromTree(_ref4) {
|
|
|
117
109
|
var _groupingField2, _groupingKey2, _parentNode$childrenF3, _parentNode$childrenF4;
|
|
118
110
|
var groupingField = (_groupingField2 = node.groupingField) != null ? _groupingField2 : '__no_field__';
|
|
119
111
|
var groupingKey = (_groupingKey2 = node.groupingKey) != null ? _groupingKey2 : '__no_key__';
|
|
120
|
-
var
|
|
112
|
+
var _ref3 = (_parentNode$childrenF3 = (_parentNode$childrenF4 = parentNode.childrenFromPath) == null ? void 0 : _parentNode$childrenF4[groupingField]) != null ? _parentNode$childrenF3 : {},
|
|
121
113
|
_groupingKey$toString = groupingKey.toString(),
|
|
122
|
-
childrenToRemove =
|
|
123
|
-
newChildrenFromPathWithField = _objectWithoutProperties(
|
|
114
|
+
childrenToRemove = _ref3[_groupingKey$toString],
|
|
115
|
+
newChildrenFromPathWithField = _objectWithoutProperties(_ref3, [_groupingKey$toString].map(_toPropertyKey));
|
|
124
116
|
|
|
125
117
|
// TODO rows v6: Can we avoid this linear complexity ?
|
|
126
118
|
var children = parentNode.children.filter(function (childId) {
|
|
@@ -142,12 +134,12 @@ export var removeNodeFromTree = function removeNodeFromTree(_ref4) {
|
|
|
142
134
|
/**
|
|
143
135
|
* Updates the `id` and `isAutoGenerated` properties of a group node.
|
|
144
136
|
*/
|
|
145
|
-
export var updateGroupNodeIdAndAutoGenerated = function updateGroupNodeIdAndAutoGenerated(
|
|
146
|
-
var node =
|
|
147
|
-
updatedNode =
|
|
148
|
-
previousTree =
|
|
149
|
-
tree =
|
|
150
|
-
treeDepths =
|
|
137
|
+
export var updateGroupNodeIdAndAutoGenerated = function updateGroupNodeIdAndAutoGenerated(_ref4) {
|
|
138
|
+
var node = _ref4.node,
|
|
139
|
+
updatedNode = _ref4.updatedNode,
|
|
140
|
+
previousTree = _ref4.previousTree,
|
|
141
|
+
tree = _ref4.tree,
|
|
142
|
+
treeDepths = _ref4.treeDepths;
|
|
151
143
|
// 1. Set the new parent for all children from the old group
|
|
152
144
|
node.children.forEach(function (childId) {
|
|
153
145
|
tree[childId] = _extends({}, tree[childId], {
|
|
@@ -164,12 +156,7 @@ export var updateGroupNodeIdAndAutoGenerated = function updateGroupNodeIdAndAuto
|
|
|
164
156
|
|
|
165
157
|
// 3. Add the new group in the tree
|
|
166
158
|
var groupNode = _extends({}, node, updatedNode);
|
|
167
|
-
insertNodeInTree(
|
|
168
|
-
previousTree: previousTree,
|
|
169
|
-
node: groupNode,
|
|
170
|
-
tree: tree,
|
|
171
|
-
treeDepths: treeDepths
|
|
172
|
-
});
|
|
159
|
+
insertNodeInTree(groupNode, tree, treeDepths, previousTree);
|
|
173
160
|
};
|
|
174
161
|
export var createUpdatedGroupsManager = function createUpdatedGroupsManager() {
|
|
175
162
|
return {
|
|
@@ -182,9 +169,9 @@ export var createUpdatedGroupsManager = function createUpdatedGroupsManager() {
|
|
|
182
169
|
}
|
|
183
170
|
};
|
|
184
171
|
};
|
|
185
|
-
export var getVisibleRowsLookup = function getVisibleRowsLookup(
|
|
186
|
-
var tree =
|
|
187
|
-
filteredRowsLookup =
|
|
172
|
+
export var getVisibleRowsLookup = function getVisibleRowsLookup(_ref5) {
|
|
173
|
+
var tree = _ref5.tree,
|
|
174
|
+
filteredRowsLookup = _ref5.filteredRowsLookup;
|
|
188
175
|
if (!filteredRowsLookup) {
|
|
189
176
|
return {};
|
|
190
177
|
}
|
package/material/icons.d.ts
CHANGED
|
@@ -4,6 +4,3 @@ export declare const GridPushPinRightIcon: import("@mui/material/OverridableComp
|
|
|
4
4
|
export declare const GridPushPinLeftIcon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
5
5
|
muiName: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const GridHighlightOffIcon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
8
|
-
muiName: string;
|
|
9
|
-
};
|
package/material/icons.js
CHANGED
|
@@ -14,7 +14,4 @@ export const GridPushPinLeftIcon = createSvgIcon( /*#__PURE__*/_jsx("g", {
|
|
|
14
14
|
d: "M16,9V4l1,0c0.55,0,1-0.45,1-1v0c0-0.55-0.45-1-1-1H7C6.45,2,6,2.45,6,3v0 c0,0.55,0.45,1,1,1l1,0v5c0,1.66-1.34,3-3,3h0v2h5.97v7l1,1l1-1v-7H19v-2h0C17.34,12,16,10.66,16,9z",
|
|
15
15
|
fillRule: "evenodd"
|
|
16
16
|
})
|
|
17
|
-
}), 'PushPinLeft');
|
|
18
|
-
export const GridHighlightOffIcon = createSvgIcon( /*#__PURE__*/_jsx("path", {
|
|
19
|
-
d: "M14.59 8L12 10.59 9.41 8 8 9.41 10.59 12 8 14.59 9.41 16 12 13.41 14.59 16 16 14.59 13.41 12 16 9.41 14.59 8zM12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"
|
|
20
|
-
}), 'HighlightOff');
|
|
17
|
+
}), 'PushPinLeft');
|
package/material/index.d.ts
CHANGED
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
declare const materialSlots: {
|
|
3
3
|
ColumnMenuPinLeftIcon: import("react").JSXElementConstructor<any>;
|
|
4
4
|
ColumnMenuPinRightIcon: import("react").JSXElementConstructor<any>;
|
|
5
|
-
HeaderFilterClearIcon: import("react").JSXElementConstructor<any>;
|
|
6
5
|
};
|
|
7
6
|
export default materialSlots;
|
package/material/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { GridPushPinRightIcon, GridPushPinLeftIcon
|
|
2
|
+
import { GridPushPinRightIcon, GridPushPinLeftIcon } from './icons';
|
|
3
3
|
const iconSlots = {
|
|
4
4
|
ColumnMenuPinRightIcon: GridPushPinRightIcon,
|
|
5
|
-
ColumnMenuPinLeftIcon: GridPushPinLeftIcon
|
|
6
|
-
HeaderFilterClearIcon: GridHighlightOffIcon
|
|
5
|
+
ColumnMenuPinLeftIcon: GridPushPinLeftIcon
|
|
7
6
|
};
|
|
8
7
|
const materialSlots = _extends({}, iconSlots);
|
|
9
8
|
export default materialSlots;
|
|
@@ -10,9 +10,4 @@ export interface GridProIconSlotsComponent {
|
|
|
10
10
|
* @default GridPushPinRightIcon
|
|
11
11
|
*/
|
|
12
12
|
ColumnMenuPinRightIcon: React.JSXElementConstructor<any>;
|
|
13
|
-
/**
|
|
14
|
-
* Component responsible for clear icon in header filter
|
|
15
|
-
* @default GridHighlightOffIcon
|
|
16
|
-
*/
|
|
17
|
-
HeaderFilterClearIcon: React.JSXElementConstructor<any>;
|
|
18
13
|
}
|
|
@@ -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 = ["colIndex", "height", "hasFocus", "
|
|
3
|
+
const _excluded = ["colIndex", "height", "hasFocus", "filterOperators", "width", "headerClassName", "colDef", "item", "headerFilterMenuRef", "InputComponentProps", "showClearIcon"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -8,7 +8,7 @@ import { unstable_useForkRef as useForkRef, unstable_composeClasses as composeCl
|
|
|
8
8
|
import { gridVisibleColumnFieldsSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
9
9
|
import { useGridPrivateApiContext, unstable_gridHeaderFilteringEditFieldSelector, unstable_gridHeaderFilteringMenuSelector, isNavigationKey } from '@mui/x-data-grid/internals';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
|
-
import {
|
|
11
|
+
import { GridHeaderFilterMenuContainer } from './GridHeaderFilterMenuContainer';
|
|
12
12
|
import { GridHeaderFilterClearButton } from './GridHeaderFilterClearButton';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -23,12 +23,16 @@ const useUtilityClasses = ownerState => {
|
|
|
23
23
|
};
|
|
24
24
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
25
25
|
};
|
|
26
|
+
const dateSx = {
|
|
27
|
+
[`& input[value=""]:not(:focus)`]: {
|
|
28
|
+
color: 'transparent'
|
|
29
|
+
}
|
|
30
|
+
};
|
|
26
31
|
const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
27
32
|
const {
|
|
28
33
|
colIndex,
|
|
29
34
|
height,
|
|
30
35
|
hasFocus,
|
|
31
|
-
headerFilterComponent,
|
|
32
36
|
filterOperators,
|
|
33
37
|
width,
|
|
34
38
|
headerClassName,
|
|
@@ -60,6 +64,10 @@ const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
60
64
|
const clearFilterItem = React.useCallback(() => {
|
|
61
65
|
apiRef.current.deleteFilterItem(item);
|
|
62
66
|
}, [apiRef, item]);
|
|
67
|
+
let headerFilterComponent;
|
|
68
|
+
if (colDef.renderHeaderFilter) {
|
|
69
|
+
headerFilterComponent = colDef.renderHeaderFilter(props);
|
|
70
|
+
}
|
|
63
71
|
React.useLayoutEffect(() => {
|
|
64
72
|
if (hasFocus && !isMenuOpen) {
|
|
65
73
|
let focusableElement = cellRef.current.querySelector('[tabindex="0"]');
|
|
@@ -129,7 +137,8 @@ const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
129
137
|
const mouseEventsHandlers = React.useMemo(() => ({
|
|
130
138
|
onKeyDown: publish('headerFilterKeyDown', onKeyDown),
|
|
131
139
|
onClick: publish('headerFilterClick'),
|
|
132
|
-
onMouseDown: publish('headerFilterMouseDown', onMouseDown)
|
|
140
|
+
onMouseDown: publish('headerFilterMouseDown', onMouseDown),
|
|
141
|
+
onBlur: publish('headerFilterBlur')
|
|
133
142
|
}), [onMouseDown, onKeyDown, publish]);
|
|
134
143
|
const ownerState = _extends({}, rootProps, {
|
|
135
144
|
colDef
|
|
@@ -154,30 +163,35 @@ const GridHeaderFilterCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
154
163
|
"aria-colindex": colIndex + 1,
|
|
155
164
|
"aria-label": headerFilterComponent == null ? colDef.headerName ?? colDef.field : undefined
|
|
156
165
|
}, other, mouseEventsHandlers, {
|
|
157
|
-
children: [headerFilterComponent, InputComponent && headerFilterComponent === undefined ? /*#__PURE__*/
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
children: [headerFilterComponent, InputComponent && headerFilterComponent === undefined ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
167
|
+
children: [/*#__PURE__*/_jsx(InputComponent, _extends({
|
|
168
|
+
apiRef: apiRef,
|
|
169
|
+
item: item,
|
|
170
|
+
inputRef: inputRef,
|
|
171
|
+
applyValue: applyFilterChanges,
|
|
172
|
+
onFocus: () => apiRef.current.startHeaderFilterEditMode(colDef.field),
|
|
173
|
+
onBlur: () => apiRef.current.stopHeaderFilterEditMode(),
|
|
174
|
+
label: capitalize(label),
|
|
175
|
+
placeholder: "",
|
|
176
|
+
isFilterActive: isFilterActive,
|
|
177
|
+
clearButton: showClearIcon && isApplied ? /*#__PURE__*/_jsx(GridHeaderFilterClearButton, {
|
|
178
|
+
onClick: clearFilterItem
|
|
179
|
+
}) : null,
|
|
180
|
+
disabled: isNoInputOperator,
|
|
181
|
+
tabIndex: -1,
|
|
182
|
+
InputLabelProps: null,
|
|
183
|
+
sx: colDef.type === 'date' || colDef.type === 'dateTime' ? dateSx : undefined
|
|
184
|
+
}, isNoInputOperator ? {
|
|
185
|
+
value: ''
|
|
186
|
+
} : {}, currentOperator?.InputComponentProps, InputComponentProps)), /*#__PURE__*/_jsx(GridHeaderFilterMenuContainer, {
|
|
168
187
|
operators: filterOperators,
|
|
169
188
|
item: item,
|
|
170
189
|
field: colDef.field,
|
|
171
190
|
applyFilterChanges: applyFilterChanges,
|
|
172
191
|
headerFilterMenuRef: headerFilterMenuRef,
|
|
173
192
|
buttonRef: buttonRef
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
onClick: clearFilterItem
|
|
177
|
-
}) : null,
|
|
178
|
-
disabled: isNoInputOperator,
|
|
179
|
-
tabIndex: -1
|
|
180
|
-
}, currentOperator?.InputComponentProps, InputComponentProps)) : null]
|
|
193
|
+
})]
|
|
194
|
+
}) : null]
|
|
181
195
|
}));
|
|
182
196
|
});
|
|
183
197
|
process.env.NODE_ENV !== "production" ? GridHeaderFilterCell.propTypes = {
|
|
@@ -202,7 +216,6 @@ process.env.NODE_ENV !== "production" ? GridHeaderFilterCell.propTypes = {
|
|
|
202
216
|
* Class name that will be added in the column header cell.
|
|
203
217
|
*/
|
|
204
218
|
headerClassName: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
205
|
-
headerFilterComponent: PropTypes.node,
|
|
206
219
|
headerFilterMenuRef: PropTypes.shape({
|
|
207
220
|
current: PropTypes.object
|
|
208
221
|
}).isRequired,
|
|
@@ -16,7 +16,7 @@ function GridHeaderFilterClearButton({
|
|
|
16
16
|
onClick: onClick,
|
|
17
17
|
sx: sx
|
|
18
18
|
}, rootProps.slotProps?.baseIconButton, {
|
|
19
|
-
children: /*#__PURE__*/_jsx(rootProps.slots.
|
|
19
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuClearIcon, {
|
|
20
20
|
fontSize: "inherit"
|
|
21
21
|
})
|
|
22
22
|
}));
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
3
4
|
import MenuList from '@mui/material/MenuList';
|
|
4
5
|
import MenuItem from '@mui/material/MenuItem';
|
|
5
|
-
import
|
|
6
|
-
import ListItemText from '@mui/material/ListItemText';
|
|
7
|
-
import { unstable_capitalize as capitalize } from '@mui/utils';
|
|
6
|
+
import { unstable_capitalize as capitalize, HTMLElementType } from '@mui/utils';
|
|
8
7
|
import { useGridApiContext, GridMenu } from '@mui/x-data-grid';
|
|
9
|
-
import { OPERATOR_SYMBOL_MAPPING } from './constants';
|
|
10
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
9
|
function GridHeaderFilterMenu({
|
|
13
10
|
open,
|
|
14
11
|
field,
|
|
15
|
-
|
|
12
|
+
target,
|
|
16
13
|
applyFilterChanges,
|
|
17
14
|
operators,
|
|
18
15
|
item,
|
|
@@ -31,13 +28,13 @@ function GridHeaderFilterMenu({
|
|
|
31
28
|
hideMenu();
|
|
32
29
|
}
|
|
33
30
|
}, [hideMenu]);
|
|
34
|
-
if (!
|
|
31
|
+
if (!target) {
|
|
35
32
|
return null;
|
|
36
33
|
}
|
|
37
34
|
return /*#__PURE__*/_jsx(GridMenu, {
|
|
38
|
-
placement: "bottom-
|
|
35
|
+
placement: "bottom-end",
|
|
39
36
|
open: open,
|
|
40
|
-
target:
|
|
37
|
+
target: target,
|
|
41
38
|
onClickAway: hideMenu,
|
|
42
39
|
onExited: hideMenu,
|
|
43
40
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
@@ -46,7 +43,7 @@ function GridHeaderFilterMenu({
|
|
|
46
43
|
onKeyDown: handleListKeyDown,
|
|
47
44
|
children: operators.map((op, i) => {
|
|
48
45
|
const label = op?.headerLabel ?? apiRef.current.getLocaleText(`headerFilterOperator${capitalize(op.value)}`);
|
|
49
|
-
return /*#__PURE__*/
|
|
46
|
+
return /*#__PURE__*/_jsx(MenuItem, {
|
|
50
47
|
onClick: () => {
|
|
51
48
|
applyFilterChanges(_extends({}, item, {
|
|
52
49
|
operator: op.value
|
|
@@ -55,14 +52,38 @@ function GridHeaderFilterMenu({
|
|
|
55
52
|
},
|
|
56
53
|
autoFocus: i === 0 ? open : false,
|
|
57
54
|
selected: op.value === item.operator,
|
|
58
|
-
children:
|
|
59
|
-
children: OPERATOR_SYMBOL_MAPPING[op.value]
|
|
60
|
-
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
61
|
-
children: label
|
|
62
|
-
})]
|
|
55
|
+
children: label
|
|
63
56
|
}, `${field}-${op.value}`);
|
|
64
57
|
})
|
|
65
58
|
})
|
|
66
59
|
});
|
|
67
60
|
}
|
|
61
|
+
process.env.NODE_ENV !== "production" ? GridHeaderFilterMenu.propTypes = {
|
|
62
|
+
// ----------------------------- Warning --------------------------------
|
|
63
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
64
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
65
|
+
// ----------------------------------------------------------------------
|
|
66
|
+
applyFilterChanges: PropTypes.func.isRequired,
|
|
67
|
+
field: PropTypes.string.isRequired,
|
|
68
|
+
id: PropTypes.string.isRequired,
|
|
69
|
+
item: PropTypes.shape({
|
|
70
|
+
field: PropTypes.string.isRequired,
|
|
71
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
72
|
+
operator: PropTypes.string.isRequired,
|
|
73
|
+
value: PropTypes.any
|
|
74
|
+
}).isRequired,
|
|
75
|
+
labelledBy: PropTypes.string.isRequired,
|
|
76
|
+
open: PropTypes.bool.isRequired,
|
|
77
|
+
operators: PropTypes.arrayOf(PropTypes.shape({
|
|
78
|
+
getApplyFilterFn: PropTypes.func.isRequired,
|
|
79
|
+
getValueAsString: PropTypes.func,
|
|
80
|
+
headerLabel: PropTypes.string,
|
|
81
|
+
InputComponent: PropTypes.elementType,
|
|
82
|
+
InputComponentProps: PropTypes.object,
|
|
83
|
+
label: PropTypes.string,
|
|
84
|
+
requiresFilterValue: PropTypes.bool,
|
|
85
|
+
value: PropTypes.string.isRequired
|
|
86
|
+
})).isRequired,
|
|
87
|
+
target: HTMLElementType
|
|
88
|
+
} : void 0;
|
|
68
89
|
export { GridHeaderFilterMenu };
|
|
@@ -7,16 +7,14 @@ import { useGridApiContext } from '@mui/x-data-grid';
|
|
|
7
7
|
import { unstable_useId as useId } from '@mui/utils';
|
|
8
8
|
import { unstable_gridHeaderFilteringMenuSelector } from '@mui/x-data-grid/internals';
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
|
-
import { OPERATOR_SYMBOL_MAPPING } from './constants';
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
12
|
const sx = {
|
|
14
13
|
width: 22,
|
|
15
14
|
height: 22,
|
|
16
|
-
|
|
15
|
+
margin: 'auto 0 10px 5px'
|
|
17
16
|
};
|
|
18
|
-
function
|
|
19
|
-
var _rootProps$slotProps, _OPERATOR_SYMBOL_MAPP;
|
|
17
|
+
function GridHeaderFilterMenuContainer(props) {
|
|
20
18
|
const {
|
|
21
19
|
operators,
|
|
22
20
|
item,
|
|
@@ -38,35 +36,34 @@ function GridHeaderFilterAdornment(props) {
|
|
|
38
36
|
return null;
|
|
39
37
|
}
|
|
40
38
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
41
|
-
children: [/*#__PURE__*/_jsx(rootProps.slots.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}), /*#__PURE__*/_jsx(rootProps.slots.headerFilterMenu, _extends({
|
|
39
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
40
|
+
id: buttonId,
|
|
41
|
+
ref: buttonRef,
|
|
42
|
+
"aria-label": apiRef.current.getLocaleText('filterPanelOperator'),
|
|
43
|
+
title: apiRef.current.getLocaleText('filterPanelOperator'),
|
|
44
|
+
"aria-controls": menuId,
|
|
45
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
46
|
+
"aria-haspopup": "true",
|
|
47
|
+
tabIndex: -1,
|
|
48
|
+
size: "small",
|
|
49
|
+
onClick: handleClick,
|
|
50
|
+
sx: sx
|
|
51
|
+
}, rootProps.slotProps?.baseIconButton, {
|
|
52
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.openFilterButtonIcon, {
|
|
53
|
+
fontSize: "small"
|
|
54
|
+
})
|
|
55
|
+
})), /*#__PURE__*/_jsx(rootProps.slots.headerFilterMenu, _extends({
|
|
59
56
|
field: field,
|
|
60
57
|
open: open,
|
|
61
58
|
item: item,
|
|
62
|
-
|
|
59
|
+
target: headerFilterMenuRef.current,
|
|
63
60
|
operators: operators,
|
|
64
61
|
labelledBy: buttonId,
|
|
65
62
|
id: menuId
|
|
66
63
|
}, others))]
|
|
67
64
|
});
|
|
68
65
|
}
|
|
69
|
-
process.env.NODE_ENV !== "production" ?
|
|
66
|
+
process.env.NODE_ENV !== "production" ? GridHeaderFilterMenuContainer.propTypes = {
|
|
70
67
|
// ----------------------------- Warning --------------------------------
|
|
71
68
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
72
69
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
@@ -96,4 +93,4 @@ process.env.NODE_ENV !== "production" ? GridHeaderFilterAdornment.propTypes = {
|
|
|
96
93
|
value: PropTypes.string.isRequired
|
|
97
94
|
})).isRequired
|
|
98
95
|
} : void 0;
|
|
99
|
-
export {
|
|
96
|
+
export { GridHeaderFilterMenuContainer };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './GridHeaderFilterCell';
|
|
1
|
+
export * from './GridHeaderFilterMenuContainer';
|
|
2
|
+
export * from './GridHeaderFilterCell';
|
|
3
|
+
export * from './GridHeaderFilterMenu';
|
|
@@ -2,18 +2,29 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["getColumnsToRender", "getRootProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { unstable_gridFocusColumnHeaderFilterSelector, useGridSelector, gridFilterModelSelector, unstable_gridTabIndexColumnHeaderFilterSelector } from '@mui/x-data-grid';
|
|
5
|
+
import { unstable_gridFocusColumnHeaderFilterSelector, useGridSelector, gridFilterModelSelector, unstable_gridTabIndexColumnHeaderFilterSelector, getDataGridUtilityClass } from '@mui/x-data-grid';
|
|
6
6
|
import { styled } from '@mui/system';
|
|
7
7
|
import { useGridColumnHeaders as useGridColumnHeadersCommunity, getTotalHeaderHeight, useGridPrivateApiContext, getGridFilter } from '@mui/x-data-grid/internals';
|
|
8
|
+
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
8
9
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
9
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const useUtilityClasses = ownerState => {
|
|
12
|
+
const {
|
|
13
|
+
classes
|
|
14
|
+
} = ownerState;
|
|
15
|
+
return React.useMemo(() => {
|
|
16
|
+
const slots = {
|
|
17
|
+
headerFilterRow: ['headerFilterRow']
|
|
18
|
+
};
|
|
19
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
20
|
+
}, [classes]);
|
|
21
|
+
};
|
|
10
22
|
const GridHeaderFilterRow = styled('div', {
|
|
11
23
|
name: 'MuiDataGrid',
|
|
12
24
|
slot: 'HeaderFilterRow',
|
|
13
25
|
overridesResolver: (props, styles) => styles.headerFilterRow
|
|
14
26
|
})(() => ({
|
|
15
|
-
display: 'flex'
|
|
16
|
-
borderTop: '1px solid rgba(224, 224, 224, 1)'
|
|
27
|
+
display: 'flex'
|
|
17
28
|
}));
|
|
18
29
|
export const useGridColumnHeaders = props => {
|
|
19
30
|
const apiRef = useGridPrivateApiContext();
|
|
@@ -36,6 +47,7 @@ export const useGridColumnHeaders = props => {
|
|
|
36
47
|
});
|
|
37
48
|
const headerFilterMenuRef = React.useRef(null);
|
|
38
49
|
const rootProps = useGridRootProps();
|
|
50
|
+
const classes = useUtilityClasses(rootProps);
|
|
39
51
|
const disableHeaderFiltering = !rootProps.unstable_headerFilters;
|
|
40
52
|
const headerHeight = Math.floor(rootProps.columnHeaderHeight * props.densityFactor);
|
|
41
53
|
const filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
@@ -61,10 +73,6 @@ export const useGridColumnHeaders = props => {
|
|
|
61
73
|
const isFirstColumn = columnIndex === 0;
|
|
62
74
|
const tabIndexField = columnHeaderFilterTabIndexState?.field;
|
|
63
75
|
const tabIndex = tabIndexField === colDef.field || isFirstColumn && !props.hasOtherElementInTabSequence ? 0 : -1;
|
|
64
|
-
let headerFilterComponent;
|
|
65
|
-
if (colDef.renderHeaderFilter) {
|
|
66
|
-
headerFilterComponent = colDef.renderHeaderFilter(apiRef.current.getColumnHeaderParams(colDef.field));
|
|
67
|
-
}
|
|
68
76
|
const headerClassName = typeof colDef.headerClassName === 'function' ? colDef.headerClassName({
|
|
69
77
|
field: colDef.field,
|
|
70
78
|
colDef
|
|
@@ -81,7 +89,6 @@ export const useGridColumnHeaders = props => {
|
|
|
81
89
|
hasFocus: hasFocus,
|
|
82
90
|
tabIndex: tabIndex,
|
|
83
91
|
headerFilterMenuRef: headerFilterMenuRef,
|
|
84
|
-
headerFilterComponent: headerFilterComponent,
|
|
85
92
|
headerClassName: headerClassName,
|
|
86
93
|
filterOperators: filterOperators,
|
|
87
94
|
"data-field": colDef.field,
|
|
@@ -91,6 +98,7 @@ export const useGridColumnHeaders = props => {
|
|
|
91
98
|
return /*#__PURE__*/_jsx(GridHeaderFilterRow, {
|
|
92
99
|
ref: headerFiltersRef,
|
|
93
100
|
ownerState: rootProps,
|
|
101
|
+
className: classes.headerFilterRow,
|
|
94
102
|
role: "row",
|
|
95
103
|
"aria-rowindex": headerGroupingMaxDepth + 2,
|
|
96
104
|
children: filters
|
|
@@ -9,11 +9,11 @@ export const useGridLazyLoaderPreProcessors = (privateApiRef, props) => {
|
|
|
9
9
|
lazyLoading
|
|
10
10
|
} = props.experimentalFeatures ?? {};
|
|
11
11
|
const addSkeletonRows = React.useCallback(groupingParams => {
|
|
12
|
-
const
|
|
13
|
-
const rootGroup = tree[GRID_ROOT_GROUP_ID];
|
|
12
|
+
const rootGroup = groupingParams.tree[GRID_ROOT_GROUP_ID];
|
|
14
13
|
if (!lazyLoading || props.rowsLoadingMode !== 'server' || !props.rowCount || rootGroup.children.length >= props.rowCount) {
|
|
15
14
|
return groupingParams;
|
|
16
15
|
}
|
|
16
|
+
const tree = _extends({}, groupingParams.tree);
|
|
17
17
|
const rootGroupChildren = [...rootGroup.children];
|
|
18
18
|
for (let i = 0; i < props.rowCount - rootGroup.children.length; i += 1) {
|
|
19
19
|
const skeletonId = getSkeletonRowId(i);
|
|
@@ -25,12 +25,7 @@ export function addPinnedRow({
|
|
|
25
25
|
parent: GRID_ROOT_GROUP_ID,
|
|
26
26
|
isAutoGenerated
|
|
27
27
|
};
|
|
28
|
-
insertNodeInTree(
|
|
29
|
-
previousTree: null,
|
|
30
|
-
node,
|
|
31
|
-
tree,
|
|
32
|
-
treeDepths
|
|
33
|
-
});
|
|
28
|
+
insertNodeInTree(node, tree, treeDepths, null);
|
|
34
29
|
if (!isAutoGenerated) {
|
|
35
30
|
dataRowIdToModelLookup[rowId] = rowModel;
|
|
36
31
|
dataRowIdToIdLookup[rowId] = rowId;
|
package/modern/index.js
CHANGED
package/modern/material/icons.js
CHANGED
|
@@ -14,7 +14,4 @@ export const GridPushPinLeftIcon = createSvgIcon( /*#__PURE__*/_jsx("g", {
|
|
|
14
14
|
d: "M16,9V4l1,0c0.55,0,1-0.45,1-1v0c0-0.55-0.45-1-1-1H7C6.45,2,6,2.45,6,3v0 c0,0.55,0.45,1,1,1l1,0v5c0,1.66-1.34,3-3,3h0v2h5.97v7l1,1l1-1v-7H19v-2h0C17.34,12,16,10.66,16,9z",
|
|
15
15
|
fillRule: "evenodd"
|
|
16
16
|
})
|
|
17
|
-
}), 'PushPinLeft');
|
|
18
|
-
export const GridHighlightOffIcon = createSvgIcon( /*#__PURE__*/_jsx("path", {
|
|
19
|
-
d: "M14.59 8L12 10.59 9.41 8 8 9.41 10.59 12 8 14.59 9.41 16 12 13.41 14.59 16 16 14.59 13.41 12 16 9.41 14.59 8zM12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"
|
|
20
|
-
}), 'HighlightOff');
|
|
17
|
+
}), 'PushPinLeft');
|
package/modern/material/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { GridPushPinRightIcon, GridPushPinLeftIcon
|
|
2
|
+
import { GridPushPinRightIcon, GridPushPinLeftIcon } from './icons';
|
|
3
3
|
const iconSlots = {
|
|
4
4
|
ColumnMenuPinRightIcon: GridPushPinRightIcon,
|
|
5
|
-
ColumnMenuPinLeftIcon: GridPushPinLeftIcon
|
|
6
|
-
HeaderFilterClearIcon: GridHighlightOffIcon
|
|
5
|
+
ColumnMenuPinLeftIcon: GridPushPinLeftIcon
|
|
7
6
|
};
|
|
8
7
|
const materialSlots = _extends({}, iconSlots);
|
|
9
8
|
export default materialSlots;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTY4NjI2MTYwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|