@mui/x-data-grid 6.2.1 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -1
- package/components/base/GridBody.js +8 -1
- package/components/cell/GridActionsCell.d.ts +2 -3
- package/components/cell/GridActionsCell.js +9 -1
- package/components/containers/GridRootStyles.js +3 -1
- package/components/panel/GridPanel.d.ts +2 -2
- package/constants/gridClasses.js +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +22 -15
- package/index.js +1 -1
- package/joy/joySlots.js +114 -6
- package/legacy/components/base/GridBody.js +8 -1
- package/legacy/components/cell/GridActionsCell.js +11 -2
- package/legacy/components/containers/GridRootStyles.js +3 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +22 -15
- package/legacy/index.js +1 -1
- package/legacy/joy/joySlots.js +113 -6
- package/legacy/locales/frFR.js +2 -2
- package/legacy/locales/trTR.js +2 -2
- package/legacy/locales/zhCN.js +2 -2
- package/locales/frFR.js +2 -2
- package/locales/trTR.js +2 -2
- package/locales/zhCN.js +2 -2
- package/material/index.d.ts +2 -2
- package/modern/components/base/GridBody.js +8 -1
- package/modern/components/cell/GridActionsCell.js +9 -1
- package/modern/components/containers/GridRootStyles.js +3 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +21 -14
- package/modern/index.js +1 -1
- package/modern/joy/joySlots.js +112 -6
- package/modern/locales/frFR.js +2 -2
- package/modern/locales/trTR.js +2 -2
- package/modern/locales/zhCN.js +2 -2
- package/node/components/base/GridBody.js +8 -1
- package/node/components/cell/GridActionsCell.js +9 -1
- package/node/components/containers/GridRootStyles.js +3 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +20 -11
- package/node/index.js +1 -1
- package/node/joy/joySlots.js +112 -6
- package/node/locales/frFR.js +2 -2
- package/node/locales/trTR.js +2 -2
- package/node/locales/zhCN.js +2 -2
- package/package.json +3 -3
package/legacy/joy/joySlots.js
CHANGED
|
@@ -1,13 +1,48 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["touchRippleRef", "inputProps", "onChange", "color", "size", "checked", "sx", "value", "inputRef"]
|
|
4
|
+
var _excluded = ["touchRippleRef", "inputProps", "onChange", "color", "size", "checked", "sx", "value", "inputRef"],
|
|
5
|
+
_excluded2 = ["startIcon", "color", "endIcon", "size", "sx", "variant"],
|
|
6
|
+
_excluded3 = ["color", "size", "sx"],
|
|
7
|
+
_excluded4 = ["name", "checkedIcon", "color", "disableRipple", "disableFocusRipple", "disableTouchRipple", "edge", "icon", "inputProps", "inputRef", "size", "sx", "onChange", "onClick"];
|
|
4
8
|
import * as React from 'react';
|
|
5
9
|
import JoyCheckbox from '@mui/joy/Checkbox';
|
|
6
10
|
import JoyInput from '@mui/joy/Input';
|
|
7
11
|
import JoyFormControl from '@mui/joy/FormControl';
|
|
8
12
|
import JoyFormLabel from '@mui/joy/FormLabel';
|
|
13
|
+
import JoyButton from '@mui/joy/Button';
|
|
14
|
+
import JoyIconButton from '@mui/joy/IconButton';
|
|
15
|
+
import JoySwitch from '@mui/joy/Switch';
|
|
9
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
function convertColor(color) {
|
|
19
|
+
if (color === 'secondary') {
|
|
20
|
+
return 'primary';
|
|
21
|
+
}
|
|
22
|
+
if (color === 'error') {
|
|
23
|
+
return 'danger';
|
|
24
|
+
}
|
|
25
|
+
if (color === 'default' || color === 'inherit') {
|
|
26
|
+
return 'neutral';
|
|
27
|
+
}
|
|
28
|
+
return color;
|
|
29
|
+
}
|
|
30
|
+
function convertSize(size) {
|
|
31
|
+
return size ? {
|
|
32
|
+
small: 'sm',
|
|
33
|
+
medium: 'md',
|
|
34
|
+
large: 'lg'
|
|
35
|
+
}[size] : size;
|
|
36
|
+
}
|
|
37
|
+
function convertVariant(variant) {
|
|
38
|
+
return variant ? {
|
|
39
|
+
outlined: 'outlined',
|
|
40
|
+
contained: 'solid',
|
|
41
|
+
text: 'plain',
|
|
42
|
+
standard: 'plain',
|
|
43
|
+
filled: 'soft'
|
|
44
|
+
}[variant] : variant;
|
|
45
|
+
}
|
|
11
46
|
var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
12
47
|
var touchRippleRef = _ref.touchRippleRef,
|
|
13
48
|
inputProps = _ref.inputProps,
|
|
@@ -58,14 +93,86 @@ var TextField = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
|
58
93
|
})]
|
|
59
94
|
});
|
|
60
95
|
});
|
|
96
|
+
var Button = /*#__PURE__*/React.forwardRef(function Button(_ref3, ref) {
|
|
97
|
+
var _convertVariant;
|
|
98
|
+
var startIcon = _ref3.startIcon,
|
|
99
|
+
color = _ref3.color,
|
|
100
|
+
endIcon = _ref3.endIcon,
|
|
101
|
+
size = _ref3.size,
|
|
102
|
+
sx = _ref3.sx,
|
|
103
|
+
variant = _ref3.variant,
|
|
104
|
+
props = _objectWithoutProperties(_ref3, _excluded2);
|
|
105
|
+
return /*#__PURE__*/_jsx(JoyButton, _extends({}, props, {
|
|
106
|
+
size: convertSize(size),
|
|
107
|
+
color: convertColor(color),
|
|
108
|
+
variant: (_convertVariant = convertVariant(variant)) != null ? _convertVariant : 'plain',
|
|
109
|
+
ref: ref,
|
|
110
|
+
startDecorator: startIcon,
|
|
111
|
+
endDecorator: endIcon,
|
|
112
|
+
sx: sx
|
|
113
|
+
}));
|
|
114
|
+
});
|
|
115
|
+
var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref4, ref) {
|
|
116
|
+
var _convertColor;
|
|
117
|
+
var color = _ref4.color,
|
|
118
|
+
size = _ref4.size,
|
|
119
|
+
sx = _ref4.sx,
|
|
120
|
+
props = _objectWithoutProperties(_ref4, _excluded3);
|
|
121
|
+
return /*#__PURE__*/_jsx(JoyIconButton, _extends({}, props, {
|
|
122
|
+
size: convertSize(size),
|
|
123
|
+
color: (_convertColor = convertColor(color)) != null ? _convertColor : 'neutral',
|
|
124
|
+
variant: "plain",
|
|
125
|
+
ref: ref,
|
|
126
|
+
sx: sx
|
|
127
|
+
}));
|
|
128
|
+
});
|
|
129
|
+
var Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref5, ref) {
|
|
130
|
+
var name = _ref5.name,
|
|
131
|
+
checkedIcon = _ref5.checkedIcon,
|
|
132
|
+
colorProp = _ref5.color,
|
|
133
|
+
disableRipple = _ref5.disableRipple,
|
|
134
|
+
disableFocusRipple = _ref5.disableFocusRipple,
|
|
135
|
+
disableTouchRipple = _ref5.disableTouchRipple,
|
|
136
|
+
edge = _ref5.edge,
|
|
137
|
+
icon = _ref5.icon,
|
|
138
|
+
inputProps = _ref5.inputProps,
|
|
139
|
+
inputRef = _ref5.inputRef,
|
|
140
|
+
size = _ref5.size,
|
|
141
|
+
sx = _ref5.sx,
|
|
142
|
+
onChange = _ref5.onChange,
|
|
143
|
+
onClick = _ref5.onClick,
|
|
144
|
+
props = _objectWithoutProperties(_ref5, _excluded4);
|
|
145
|
+
return /*#__PURE__*/_jsx(JoySwitch, _extends({}, props, {
|
|
146
|
+
onChange: onChange,
|
|
147
|
+
size: convertSize(size),
|
|
148
|
+
color: convertColor(colorProp),
|
|
149
|
+
ref: ref,
|
|
150
|
+
slotProps: {
|
|
151
|
+
input: _extends({}, inputProps, {
|
|
152
|
+
name: name,
|
|
153
|
+
onClick: onClick,
|
|
154
|
+
ref: inputRef
|
|
155
|
+
}),
|
|
156
|
+
thumb: {
|
|
157
|
+
children: icon
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
sx: [_extends({}, edge === 'start' && {
|
|
161
|
+
ml: '-8px'
|
|
162
|
+
}, edge === 'end' && {
|
|
163
|
+
mr: '-8px'
|
|
164
|
+
})].concat(_toConsumableArray(Array.isArray(sx) ? sx : [sx]))
|
|
165
|
+
}));
|
|
166
|
+
});
|
|
61
167
|
var joySlots = {
|
|
62
168
|
baseCheckbox: Checkbox,
|
|
63
|
-
baseTextField: TextField
|
|
169
|
+
baseTextField: TextField,
|
|
170
|
+
baseButton: Button,
|
|
171
|
+
baseIconButton: IconButton,
|
|
172
|
+
baseSwitch: Switch
|
|
64
173
|
// BaseFormControl: MUIFormControl,
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
// BaseButton: MUIButton,
|
|
68
|
-
// BaseIconButton: MUIIconButton,
|
|
174
|
+
// baseSelect: Select,
|
|
175
|
+
// baseSelectOption: Option,
|
|
69
176
|
// BaseTooltip: MUITooltip,
|
|
70
177
|
// BasePopper: MUIPopper,
|
|
71
178
|
};
|
package/legacy/locales/frFR.js
CHANGED
|
@@ -39,7 +39,7 @@ var frFRGrid = {
|
|
|
39
39
|
columnsPanelHideAllButton: 'Tout cacher',
|
|
40
40
|
// Filter panel text
|
|
41
41
|
filterPanelAddFilter: 'Ajouter un filtre',
|
|
42
|
-
|
|
42
|
+
filterPanelRemoveAll: 'Tout supprimer',
|
|
43
43
|
filterPanelDeleteIconLabel: 'Supprimer',
|
|
44
44
|
filterPanelLogicOperator: 'Opérateur logique',
|
|
45
45
|
filterPanelOperator: 'Opérateur',
|
|
@@ -69,7 +69,7 @@ var frFRGrid = {
|
|
|
69
69
|
// Column menu text
|
|
70
70
|
columnMenuLabel: 'Menu',
|
|
71
71
|
columnMenuShowColumns: 'Afficher les colonnes',
|
|
72
|
-
|
|
72
|
+
columnMenuManageColumns: 'Gérer les colonnes',
|
|
73
73
|
columnMenuFilter: 'Filtrer',
|
|
74
74
|
columnMenuHideColumn: 'Cacher',
|
|
75
75
|
columnMenuUnsort: 'Annuler le tri',
|
package/legacy/locales/trTR.js
CHANGED
|
@@ -39,7 +39,7 @@ var trTRGrid = {
|
|
|
39
39
|
columnsPanelHideAllButton: 'Hepsini gizle',
|
|
40
40
|
// Filter panel text
|
|
41
41
|
filterPanelAddFilter: 'Filtre Ekle',
|
|
42
|
-
|
|
42
|
+
filterPanelRemoveAll: 'Hepsini kaldır',
|
|
43
43
|
filterPanelDeleteIconLabel: 'Kaldır',
|
|
44
44
|
filterPanelLogicOperator: 'Mantıksal operatörler',
|
|
45
45
|
filterPanelOperator: 'Operatör',
|
|
@@ -69,7 +69,7 @@ var trTRGrid = {
|
|
|
69
69
|
// Column menu text
|
|
70
70
|
columnMenuLabel: 'Menü',
|
|
71
71
|
columnMenuShowColumns: 'Sütunları göster',
|
|
72
|
-
|
|
72
|
+
columnMenuManageColumns: 'Sütunları yönet',
|
|
73
73
|
columnMenuFilter: 'Filtre uygula',
|
|
74
74
|
columnMenuHideColumn: 'Gizle',
|
|
75
75
|
columnMenuUnsort: 'Sıralama',
|
package/legacy/locales/zhCN.js
CHANGED
|
@@ -39,7 +39,7 @@ var zhCNGrid = {
|
|
|
39
39
|
columnsPanelHideAllButton: '隐藏所有',
|
|
40
40
|
// Filter panel text
|
|
41
41
|
filterPanelAddFilter: '添加筛选器',
|
|
42
|
-
|
|
42
|
+
filterPanelRemoveAll: '清除全部',
|
|
43
43
|
filterPanelDeleteIconLabel: '删除',
|
|
44
44
|
filterPanelLogicOperator: '逻辑操作器',
|
|
45
45
|
filterPanelOperator: '操作器',
|
|
@@ -69,7 +69,7 @@ var zhCNGrid = {
|
|
|
69
69
|
// Column menu text
|
|
70
70
|
columnMenuLabel: '菜单',
|
|
71
71
|
columnMenuShowColumns: '显示',
|
|
72
|
-
|
|
72
|
+
columnMenuManageColumns: '管理列',
|
|
73
73
|
columnMenuFilter: '筛选器',
|
|
74
74
|
columnMenuHideColumn: '隐藏',
|
|
75
75
|
columnMenuUnsort: '恢复默认',
|
package/locales/frFR.js
CHANGED
|
@@ -37,7 +37,7 @@ const frFRGrid = {
|
|
|
37
37
|
columnsPanelHideAllButton: 'Tout cacher',
|
|
38
38
|
// Filter panel text
|
|
39
39
|
filterPanelAddFilter: 'Ajouter un filtre',
|
|
40
|
-
|
|
40
|
+
filterPanelRemoveAll: 'Tout supprimer',
|
|
41
41
|
filterPanelDeleteIconLabel: 'Supprimer',
|
|
42
42
|
filterPanelLogicOperator: 'Opérateur logique',
|
|
43
43
|
filterPanelOperator: 'Opérateur',
|
|
@@ -67,7 +67,7 @@ const frFRGrid = {
|
|
|
67
67
|
// Column menu text
|
|
68
68
|
columnMenuLabel: 'Menu',
|
|
69
69
|
columnMenuShowColumns: 'Afficher les colonnes',
|
|
70
|
-
|
|
70
|
+
columnMenuManageColumns: 'Gérer les colonnes',
|
|
71
71
|
columnMenuFilter: 'Filtrer',
|
|
72
72
|
columnMenuHideColumn: 'Cacher',
|
|
73
73
|
columnMenuUnsort: 'Annuler le tri',
|
package/locales/trTR.js
CHANGED
|
@@ -37,7 +37,7 @@ const trTRGrid = {
|
|
|
37
37
|
columnsPanelHideAllButton: 'Hepsini gizle',
|
|
38
38
|
// Filter panel text
|
|
39
39
|
filterPanelAddFilter: 'Filtre Ekle',
|
|
40
|
-
|
|
40
|
+
filterPanelRemoveAll: 'Hepsini kaldır',
|
|
41
41
|
filterPanelDeleteIconLabel: 'Kaldır',
|
|
42
42
|
filterPanelLogicOperator: 'Mantıksal operatörler',
|
|
43
43
|
filterPanelOperator: 'Operatör',
|
|
@@ -67,7 +67,7 @@ const trTRGrid = {
|
|
|
67
67
|
// Column menu text
|
|
68
68
|
columnMenuLabel: 'Menü',
|
|
69
69
|
columnMenuShowColumns: 'Sütunları göster',
|
|
70
|
-
|
|
70
|
+
columnMenuManageColumns: 'Sütunları yönet',
|
|
71
71
|
columnMenuFilter: 'Filtre uygula',
|
|
72
72
|
columnMenuHideColumn: 'Gizle',
|
|
73
73
|
columnMenuUnsort: 'Sıralama',
|
package/locales/zhCN.js
CHANGED
|
@@ -37,7 +37,7 @@ const zhCNGrid = {
|
|
|
37
37
|
columnsPanelHideAllButton: '隐藏所有',
|
|
38
38
|
// Filter panel text
|
|
39
39
|
filterPanelAddFilter: '添加筛选器',
|
|
40
|
-
|
|
40
|
+
filterPanelRemoveAll: '清除全部',
|
|
41
41
|
filterPanelDeleteIconLabel: '删除',
|
|
42
42
|
filterPanelLogicOperator: '逻辑操作器',
|
|
43
43
|
filterPanelOperator: '操作器',
|
|
@@ -67,7 +67,7 @@ const zhCNGrid = {
|
|
|
67
67
|
// Column menu text
|
|
68
68
|
columnMenuLabel: '菜单',
|
|
69
69
|
columnMenuShowColumns: '显示',
|
|
70
|
-
|
|
70
|
+
columnMenuManageColumns: '管理列',
|
|
71
71
|
columnMenuFilter: '筛选器',
|
|
72
72
|
columnMenuHideColumn: '隐藏',
|
|
73
73
|
columnMenuUnsort: '恢复默认',
|
package/material/index.d.ts
CHANGED
|
@@ -15,12 +15,12 @@ declare const materialSlots: {
|
|
|
15
15
|
BaseButton: import("@mui/material").ExtendButtonBase<import("@mui/material/Button").ButtonTypeMap<{}, "button">>;
|
|
16
16
|
BaseIconButton: import("@mui/material").ExtendButtonBase<import("@mui/material/IconButton").IconButtonTypeMap<{}, "button">>;
|
|
17
17
|
BaseTooltip: typeof MUITooltip;
|
|
18
|
-
BasePopper: import("react").ForwardRefExoticComponent<Omit<import("@mui/base").
|
|
18
|
+
BasePopper: import("react").ForwardRefExoticComponent<Omit<import("@mui/base").PopperProps<"div", {}>, "direction"> & {
|
|
19
19
|
components?: {
|
|
20
20
|
Root?: import("react").ElementType<any> | undefined;
|
|
21
21
|
} | undefined;
|
|
22
22
|
componentsProps?: {
|
|
23
|
-
root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").
|
|
23
|
+
root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").PopperRootSlotPropsOverrides, import("@mui/base").PopperOwnProps> | undefined;
|
|
24
24
|
} | undefined;
|
|
25
25
|
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
26
26
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -45,13 +45,20 @@ function GridBody(props) {
|
|
|
45
45
|
if (typeof ResizeObserver === 'undefined') {
|
|
46
46
|
return () => {};
|
|
47
47
|
}
|
|
48
|
+
let animationFrame;
|
|
48
49
|
const observer = new ResizeObserver(() => {
|
|
49
|
-
|
|
50
|
+
// See https://github.com/mui/mui-x/issues/8733
|
|
51
|
+
animationFrame = window.requestAnimationFrame(() => {
|
|
52
|
+
apiRef.current.computeSizeAndPublishResizeEvent();
|
|
53
|
+
});
|
|
50
54
|
});
|
|
51
55
|
if (elementToObserve) {
|
|
52
56
|
observer.observe(elementToObserve);
|
|
53
57
|
}
|
|
54
58
|
return () => {
|
|
59
|
+
if (animationFrame) {
|
|
60
|
+
window.cancelAnimationFrame(animationFrame);
|
|
61
|
+
}
|
|
55
62
|
if (elementToObserve) {
|
|
56
63
|
observer.unobserve(elementToObserve);
|
|
57
64
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "focusElementRef"];
|
|
3
|
+
const _excluded = ["api", "colDef", "id", "hasFocus", "isEditable", "field", "value", "formattedValue", "row", "rowNode", "cellMode", "tabIndex", "position", "focusElementRef"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import MenuList from '@mui/material/MenuList';
|
|
@@ -188,6 +188,7 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
188
188
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
189
189
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
190
190
|
// ----------------------------------------------------------------------
|
|
191
|
+
api: PropTypes.object,
|
|
191
192
|
/**
|
|
192
193
|
* The mode of the cell.
|
|
193
194
|
*/
|
|
@@ -210,6 +211,9 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
210
211
|
focus: PropTypes.func.isRequired
|
|
211
212
|
})
|
|
212
213
|
})]),
|
|
214
|
+
/**
|
|
215
|
+
* The cell value formatted with the column valueFormatter.
|
|
216
|
+
*/
|
|
213
217
|
formattedValue: PropTypes.any,
|
|
214
218
|
/**
|
|
215
219
|
* If true, the cell is the active element.
|
|
@@ -236,6 +240,10 @@ process.env.NODE_ENV !== "production" ? GridActionsCell.propTypes = {
|
|
|
236
240
|
* the tabIndex value.
|
|
237
241
|
*/
|
|
238
242
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
243
|
+
/**
|
|
244
|
+
* The cell value.
|
|
245
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
246
|
+
*/
|
|
239
247
|
value: PropTypes.any
|
|
240
248
|
} : void 0;
|
|
241
249
|
export { GridActionsCell };
|
|
@@ -204,7 +204,9 @@ export const GridRootStyles = styled('div', {
|
|
|
204
204
|
minWidth: 0,
|
|
205
205
|
flex: 1,
|
|
206
206
|
whiteSpace: 'nowrap',
|
|
207
|
-
overflow: 'hidden'
|
|
207
|
+
overflow: 'hidden',
|
|
208
|
+
// to anchor the aggregation label
|
|
209
|
+
position: 'relative'
|
|
208
210
|
},
|
|
209
211
|
[`& .${gridClasses.columnHeaderTitleContainerContent}`]: {
|
|
210
212
|
overflow: 'hidden',
|
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell', 'cellContent', 'cellCheckbox', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorderColor', 'cell--withRightBorder', 'columnHeader--withRightBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell', 'cellContent', 'cellCheckbox', 'cellSkeleton', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnGroupHeader', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeader--showColumnBorder', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorderColor', 'cell--withRightBorder', 'columnHeader--withRightBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -7,10 +7,7 @@ import { gridColumnGroupsLookupSelector, gridColumnGroupsUnwrappedModelSelector
|
|
|
7
7
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
8
8
|
import { getColumnGroupsHeaderStructure, unwrapGroupingColumnModel } from './gridColumnGroupsUtils';
|
|
9
9
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
10
|
-
import { gridColumnFieldsSelector,
|
|
11
|
-
// GridColumnsState,
|
|
12
|
-
gridVisibleColumnFieldsSelector } from '../columns';
|
|
13
|
-
import { useGridSelector } from '../../utils/useGridSelector';
|
|
10
|
+
import { gridColumnFieldsSelector, gridVisibleColumnFieldsSelector } from '../columns';
|
|
14
11
|
const createGroupLookup = columnGroupingModel => {
|
|
15
12
|
let groupLookup = {};
|
|
16
13
|
columnGroupingModel.forEach(node => {
|
|
@@ -94,18 +91,14 @@ export const useGridColumnGrouping = (apiRef, props) => {
|
|
|
94
91
|
});
|
|
95
92
|
});
|
|
96
93
|
}, [apiRef, props.columnGroupingModel]);
|
|
97
|
-
|
|
98
|
-
const columnFields = useGridSelector(apiRef, gridColumnFieldsSelector);
|
|
99
|
-
const visibleColumnFields = useGridSelector(apiRef, gridVisibleColumnFieldsSelector);
|
|
100
|
-
/**
|
|
101
|
-
* EFFECTS
|
|
102
|
-
*/
|
|
103
|
-
React.useEffect(() => {
|
|
94
|
+
const updateColumnGroupingState = React.useCallback(columnGroupingModel => {
|
|
104
95
|
if (!props.experimentalFeatures?.columnGrouping) {
|
|
105
96
|
return;
|
|
106
97
|
}
|
|
107
|
-
const
|
|
108
|
-
const
|
|
98
|
+
const columnFields = gridColumnFieldsSelector(apiRef);
|
|
99
|
+
const visibleColumnFields = gridVisibleColumnFieldsSelector(apiRef);
|
|
100
|
+
const groupLookup = createGroupLookup(columnGroupingModel ?? []);
|
|
101
|
+
const unwrappedGroupingModel = unwrapGroupingColumnModel(columnGroupingModel ?? []);
|
|
109
102
|
const columnGroupsHeaderStructure = getColumnGroupsHeaderStructure(columnFields, unwrappedGroupingModel);
|
|
110
103
|
const maxDepth = visibleColumnFields.length === 0 ? 0 : Math.max(...visibleColumnFields.map(field => unwrappedGroupingModel[field]?.length ?? 0));
|
|
111
104
|
apiRef.current.setState(state => {
|
|
@@ -118,5 +111,19 @@ export const useGridColumnGrouping = (apiRef, props) => {
|
|
|
118
111
|
}
|
|
119
112
|
});
|
|
120
113
|
});
|
|
121
|
-
}, [apiRef,
|
|
114
|
+
}, [apiRef, props.experimentalFeatures?.columnGrouping]);
|
|
115
|
+
useGridApiEventHandler(apiRef, 'columnIndexChange', handleColumnIndexChange);
|
|
116
|
+
useGridApiEventHandler(apiRef, 'columnsChange', () => {
|
|
117
|
+
updateColumnGroupingState(props.columnGroupingModel);
|
|
118
|
+
});
|
|
119
|
+
useGridApiEventHandler(apiRef, 'columnVisibilityModelChange', () => {
|
|
120
|
+
updateColumnGroupingState(props.columnGroupingModel);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* EFFECTS
|
|
125
|
+
*/
|
|
126
|
+
React.useEffect(() => {
|
|
127
|
+
updateColumnGroupingState(props.columnGroupingModel);
|
|
128
|
+
}, [updateColumnGroupingState, props.columnGroupingModel]);
|
|
122
129
|
};
|
package/modern/index.js
CHANGED
package/modern/joy/joySlots.js
CHANGED
|
@@ -1,13 +1,47 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["touchRippleRef", "inputProps", "onChange", "color", "size", "checked", "sx", "value", "inputRef"]
|
|
3
|
+
const _excluded = ["touchRippleRef", "inputProps", "onChange", "color", "size", "checked", "sx", "value", "inputRef"],
|
|
4
|
+
_excluded2 = ["startIcon", "color", "endIcon", "size", "sx", "variant"],
|
|
5
|
+
_excluded3 = ["color", "size", "sx"],
|
|
6
|
+
_excluded4 = ["name", "checkedIcon", "color", "disableRipple", "disableFocusRipple", "disableTouchRipple", "edge", "icon", "inputProps", "inputRef", "size", "sx", "onChange", "onClick"];
|
|
4
7
|
import * as React from 'react';
|
|
5
8
|
import JoyCheckbox from '@mui/joy/Checkbox';
|
|
6
9
|
import JoyInput from '@mui/joy/Input';
|
|
7
10
|
import JoyFormControl from '@mui/joy/FormControl';
|
|
8
11
|
import JoyFormLabel from '@mui/joy/FormLabel';
|
|
12
|
+
import JoyButton from '@mui/joy/Button';
|
|
13
|
+
import JoyIconButton from '@mui/joy/IconButton';
|
|
14
|
+
import JoySwitch from '@mui/joy/Switch';
|
|
9
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
+
function convertColor(color) {
|
|
18
|
+
if (color === 'secondary') {
|
|
19
|
+
return 'primary';
|
|
20
|
+
}
|
|
21
|
+
if (color === 'error') {
|
|
22
|
+
return 'danger';
|
|
23
|
+
}
|
|
24
|
+
if (color === 'default' || color === 'inherit') {
|
|
25
|
+
return 'neutral';
|
|
26
|
+
}
|
|
27
|
+
return color;
|
|
28
|
+
}
|
|
29
|
+
function convertSize(size) {
|
|
30
|
+
return size ? {
|
|
31
|
+
small: 'sm',
|
|
32
|
+
medium: 'md',
|
|
33
|
+
large: 'lg'
|
|
34
|
+
}[size] : size;
|
|
35
|
+
}
|
|
36
|
+
function convertVariant(variant) {
|
|
37
|
+
return variant ? {
|
|
38
|
+
outlined: 'outlined',
|
|
39
|
+
contained: 'solid',
|
|
40
|
+
text: 'plain',
|
|
41
|
+
standard: 'plain',
|
|
42
|
+
filled: 'soft'
|
|
43
|
+
}[variant] : variant;
|
|
44
|
+
}
|
|
11
45
|
const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
12
46
|
let {
|
|
13
47
|
inputProps,
|
|
@@ -56,14 +90,86 @@ const TextField = /*#__PURE__*/React.forwardRef(({
|
|
|
56
90
|
})]
|
|
57
91
|
});
|
|
58
92
|
});
|
|
93
|
+
const Button = /*#__PURE__*/React.forwardRef(function Button(_ref2, ref) {
|
|
94
|
+
let {
|
|
95
|
+
startIcon,
|
|
96
|
+
color,
|
|
97
|
+
endIcon,
|
|
98
|
+
size,
|
|
99
|
+
sx,
|
|
100
|
+
variant
|
|
101
|
+
} = _ref2,
|
|
102
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
103
|
+
return /*#__PURE__*/_jsx(JoyButton, _extends({}, props, {
|
|
104
|
+
size: convertSize(size),
|
|
105
|
+
color: convertColor(color),
|
|
106
|
+
variant: convertVariant(variant) ?? 'plain',
|
|
107
|
+
ref: ref,
|
|
108
|
+
startDecorator: startIcon,
|
|
109
|
+
endDecorator: endIcon,
|
|
110
|
+
sx: sx
|
|
111
|
+
}));
|
|
112
|
+
});
|
|
113
|
+
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref3, ref) {
|
|
114
|
+
let {
|
|
115
|
+
color,
|
|
116
|
+
size,
|
|
117
|
+
sx
|
|
118
|
+
} = _ref3,
|
|
119
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
120
|
+
return /*#__PURE__*/_jsx(JoyIconButton, _extends({}, props, {
|
|
121
|
+
size: convertSize(size),
|
|
122
|
+
color: convertColor(color) ?? 'neutral',
|
|
123
|
+
variant: "plain",
|
|
124
|
+
ref: ref,
|
|
125
|
+
sx: sx
|
|
126
|
+
}));
|
|
127
|
+
});
|
|
128
|
+
const Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref4, ref) {
|
|
129
|
+
let {
|
|
130
|
+
name,
|
|
131
|
+
color: colorProp,
|
|
132
|
+
edge,
|
|
133
|
+
icon,
|
|
134
|
+
inputProps,
|
|
135
|
+
inputRef,
|
|
136
|
+
size,
|
|
137
|
+
sx,
|
|
138
|
+
onChange,
|
|
139
|
+
onClick
|
|
140
|
+
} = _ref4,
|
|
141
|
+
props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
|
|
142
|
+
return /*#__PURE__*/_jsx(JoySwitch, _extends({}, props, {
|
|
143
|
+
onChange: onChange,
|
|
144
|
+
size: convertSize(size),
|
|
145
|
+
color: convertColor(colorProp),
|
|
146
|
+
ref: ref,
|
|
147
|
+
slotProps: {
|
|
148
|
+
input: _extends({}, inputProps, {
|
|
149
|
+
name,
|
|
150
|
+
onClick: onClick,
|
|
151
|
+
ref: inputRef
|
|
152
|
+
}),
|
|
153
|
+
thumb: {
|
|
154
|
+
children: icon
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
sx: [_extends({}, edge === 'start' && {
|
|
158
|
+
ml: '-8px'
|
|
159
|
+
}, edge === 'end' && {
|
|
160
|
+
mr: '-8px'
|
|
161
|
+
}), ...(Array.isArray(sx) ? sx : [sx])]
|
|
162
|
+
}));
|
|
163
|
+
});
|
|
59
164
|
const joySlots = {
|
|
60
165
|
baseCheckbox: Checkbox,
|
|
61
|
-
baseTextField: TextField
|
|
166
|
+
baseTextField: TextField,
|
|
167
|
+
baseButton: Button,
|
|
168
|
+
baseIconButton: IconButton,
|
|
169
|
+
baseSwitch: Switch
|
|
62
170
|
// BaseFormControl: MUIFormControl,
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
// BaseButton: MUIButton,
|
|
66
|
-
// BaseIconButton: MUIIconButton,
|
|
171
|
+
// baseSelect: Select,
|
|
172
|
+
// baseSelectOption: Option,
|
|
67
173
|
// BaseTooltip: MUITooltip,
|
|
68
174
|
// BasePopper: MUIPopper,
|
|
69
175
|
};
|
package/modern/locales/frFR.js
CHANGED
|
@@ -37,7 +37,7 @@ const frFRGrid = {
|
|
|
37
37
|
columnsPanelHideAllButton: 'Tout cacher',
|
|
38
38
|
// Filter panel text
|
|
39
39
|
filterPanelAddFilter: 'Ajouter un filtre',
|
|
40
|
-
|
|
40
|
+
filterPanelRemoveAll: 'Tout supprimer',
|
|
41
41
|
filterPanelDeleteIconLabel: 'Supprimer',
|
|
42
42
|
filterPanelLogicOperator: 'Opérateur logique',
|
|
43
43
|
filterPanelOperator: 'Opérateur',
|
|
@@ -67,7 +67,7 @@ const frFRGrid = {
|
|
|
67
67
|
// Column menu text
|
|
68
68
|
columnMenuLabel: 'Menu',
|
|
69
69
|
columnMenuShowColumns: 'Afficher les colonnes',
|
|
70
|
-
|
|
70
|
+
columnMenuManageColumns: 'Gérer les colonnes',
|
|
71
71
|
columnMenuFilter: 'Filtrer',
|
|
72
72
|
columnMenuHideColumn: 'Cacher',
|
|
73
73
|
columnMenuUnsort: 'Annuler le tri',
|
package/modern/locales/trTR.js
CHANGED
|
@@ -37,7 +37,7 @@ const trTRGrid = {
|
|
|
37
37
|
columnsPanelHideAllButton: 'Hepsini gizle',
|
|
38
38
|
// Filter panel text
|
|
39
39
|
filterPanelAddFilter: 'Filtre Ekle',
|
|
40
|
-
|
|
40
|
+
filterPanelRemoveAll: 'Hepsini kaldır',
|
|
41
41
|
filterPanelDeleteIconLabel: 'Kaldır',
|
|
42
42
|
filterPanelLogicOperator: 'Mantıksal operatörler',
|
|
43
43
|
filterPanelOperator: 'Operatör',
|
|
@@ -67,7 +67,7 @@ const trTRGrid = {
|
|
|
67
67
|
// Column menu text
|
|
68
68
|
columnMenuLabel: 'Menü',
|
|
69
69
|
columnMenuShowColumns: 'Sütunları göster',
|
|
70
|
-
|
|
70
|
+
columnMenuManageColumns: 'Sütunları yönet',
|
|
71
71
|
columnMenuFilter: 'Filtre uygula',
|
|
72
72
|
columnMenuHideColumn: 'Gizle',
|
|
73
73
|
columnMenuUnsort: 'Sıralama',
|
package/modern/locales/zhCN.js
CHANGED
|
@@ -37,7 +37,7 @@ const zhCNGrid = {
|
|
|
37
37
|
columnsPanelHideAllButton: '隐藏所有',
|
|
38
38
|
// Filter panel text
|
|
39
39
|
filterPanelAddFilter: '添加筛选器',
|
|
40
|
-
|
|
40
|
+
filterPanelRemoveAll: '清除全部',
|
|
41
41
|
filterPanelDeleteIconLabel: '删除',
|
|
42
42
|
filterPanelLogicOperator: '逻辑操作器',
|
|
43
43
|
filterPanelOperator: '操作器',
|
|
@@ -67,7 +67,7 @@ const zhCNGrid = {
|
|
|
67
67
|
// Column menu text
|
|
68
68
|
columnMenuLabel: '菜单',
|
|
69
69
|
columnMenuShowColumns: '显示',
|
|
70
|
-
|
|
70
|
+
columnMenuManageColumns: '管理列',
|
|
71
71
|
columnMenuFilter: '筛选器',
|
|
72
72
|
columnMenuHideColumn: '隐藏',
|
|
73
73
|
columnMenuUnsort: '恢复默认',
|
|
@@ -53,13 +53,20 @@ function GridBody(props) {
|
|
|
53
53
|
if (typeof ResizeObserver === 'undefined') {
|
|
54
54
|
return () => {};
|
|
55
55
|
}
|
|
56
|
+
let animationFrame;
|
|
56
57
|
const observer = new ResizeObserver(() => {
|
|
57
|
-
|
|
58
|
+
// See https://github.com/mui/mui-x/issues/8733
|
|
59
|
+
animationFrame = window.requestAnimationFrame(() => {
|
|
60
|
+
apiRef.current.computeSizeAndPublishResizeEvent();
|
|
61
|
+
});
|
|
58
62
|
});
|
|
59
63
|
if (elementToObserve) {
|
|
60
64
|
observer.observe(elementToObserve);
|
|
61
65
|
}
|
|
62
66
|
return () => {
|
|
67
|
+
if (animationFrame) {
|
|
68
|
+
window.cancelAnimationFrame(animationFrame);
|
|
69
|
+
}
|
|
63
70
|
if (elementToObserve) {
|
|
64
71
|
observer.unobserve(elementToObserve);
|
|
65
72
|
}
|