@mui/x-data-grid 6.2.1 → 6.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +118 -3
- package/components/GridPagination.js +3 -1
- package/components/base/GridBody.d.ts +1 -0
- package/components/base/GridBody.js +12 -3
- 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 +3 -2
- package/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/constants/gridClasses.js +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +22 -15
- package/hooks/features/focus/useGridFocus.js +2 -2
- package/index.js +1 -1
- package/joy/joySlots.js +234 -24
- package/legacy/components/GridPagination.js +3 -1
- package/legacy/components/base/GridBody.js +12 -3
- package/legacy/components/cell/GridActionsCell.js +11 -2
- package/legacy/components/containers/GridRootStyles.js +3 -1
- package/legacy/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +22 -15
- package/legacy/hooks/features/focus/useGridFocus.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/joy/joySlots.js +229 -17
- 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 +3 -2
- package/modern/components/GridPagination.js +2 -1
- package/modern/components/base/GridBody.js +12 -3
- package/modern/components/cell/GridActionsCell.js +9 -1
- package/modern/components/containers/GridRootStyles.js +3 -1
- package/modern/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +21 -14
- package/modern/hooks/features/focus/useGridFocus.js +2 -2
- package/modern/index.js +1 -1
- package/modern/joy/joySlots.js +231 -24
- package/modern/locales/frFR.js +2 -2
- package/modern/locales/trTR.js +2 -2
- package/modern/locales/zhCN.js +2 -2
- package/node/components/GridPagination.js +2 -1
- package/node/components/base/GridBody.js +12 -3
- package/node/components/cell/GridActionsCell.js +9 -1
- package/node/components/containers/GridRootStyles.js +3 -1
- package/node/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +20 -11
- package/node/hooks/features/focus/useGridFocus.js +2 -2
- package/node/index.js +1 -1
- package/node/joy/joySlots.js +231 -24
- 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,59 @@
|
|
|
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 = ["onChange", "label", "placeholder", "value", "inputRef", "type", "size", "variant"],
|
|
6
|
+
_excluded3 = ["startIcon", "color", "endIcon", "size", "sx", "variant"],
|
|
7
|
+
_excluded4 = ["color", "size", "sx", "touchRippleRef"],
|
|
8
|
+
_excluded5 = ["name", "checkedIcon", "color", "disableRipple", "disableFocusRipple", "disableTouchRipple", "edge", "icon", "inputProps", "inputRef", "size", "sx", "onChange", "onClick"],
|
|
9
|
+
_excluded6 = ["open", "onOpen", "value", "onChange", "size", "color", "variant", "inputProps", "MenuProps", "inputRef", "error", "native", "fullWidth", "labelId"],
|
|
10
|
+
_excluded7 = ["native"],
|
|
11
|
+
_excluded8 = ["shrink", "variant", "sx"];
|
|
4
12
|
import * as React from 'react';
|
|
5
13
|
import JoyCheckbox from '@mui/joy/Checkbox';
|
|
6
14
|
import JoyInput from '@mui/joy/Input';
|
|
7
15
|
import JoyFormControl from '@mui/joy/FormControl';
|
|
8
16
|
import JoyFormLabel from '@mui/joy/FormLabel';
|
|
17
|
+
import JoyButton from '@mui/joy/Button';
|
|
18
|
+
import JoyIconButton from '@mui/joy/IconButton';
|
|
19
|
+
import JoySwitch from '@mui/joy/Switch';
|
|
20
|
+
import JoySelect from '@mui/joy/Select';
|
|
21
|
+
import JoyOption from '@mui/joy/Option';
|
|
22
|
+
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
9
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
function convertColor(color) {
|
|
26
|
+
if (color === 'secondary') {
|
|
27
|
+
return 'primary';
|
|
28
|
+
}
|
|
29
|
+
if (color === 'error') {
|
|
30
|
+
return 'danger';
|
|
31
|
+
}
|
|
32
|
+
if (color === 'default' || color === 'inherit') {
|
|
33
|
+
return 'neutral';
|
|
34
|
+
}
|
|
35
|
+
return color;
|
|
36
|
+
}
|
|
37
|
+
function convertSize(size) {
|
|
38
|
+
return size ? {
|
|
39
|
+
small: 'sm',
|
|
40
|
+
medium: 'md',
|
|
41
|
+
large: 'lg'
|
|
42
|
+
}[size] : size;
|
|
43
|
+
}
|
|
44
|
+
function convertVariant(variant) {
|
|
45
|
+
var defaultVariant = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'plain';
|
|
46
|
+
if (!variant) {
|
|
47
|
+
return defaultVariant;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
standard: 'outlined',
|
|
51
|
+
outlined: 'outlined',
|
|
52
|
+
contained: 'solid',
|
|
53
|
+
text: 'plain',
|
|
54
|
+
filled: 'soft'
|
|
55
|
+
}[variant] || defaultVariant;
|
|
56
|
+
}
|
|
11
57
|
var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
12
58
|
var touchRippleRef = _ref.touchRippleRef,
|
|
13
59
|
inputProps = _ref.inputProps,
|
|
@@ -31,41 +77,207 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
31
77
|
}));
|
|
32
78
|
});
|
|
33
79
|
var TextField = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
80
|
+
var _props$InputProps, _props$inputProps;
|
|
34
81
|
var onChange = _ref2.onChange,
|
|
35
82
|
label = _ref2.label,
|
|
36
83
|
placeholder = _ref2.placeholder,
|
|
37
84
|
value = _ref2.value,
|
|
38
85
|
inputRef = _ref2.inputRef,
|
|
39
|
-
type = _ref2.type
|
|
86
|
+
type = _ref2.type,
|
|
87
|
+
size = _ref2.size,
|
|
88
|
+
variant = _ref2.variant,
|
|
89
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
90
|
+
var rootRef = useForkRef(ref, (_props$InputProps = props.InputProps) == null ? void 0 : _props$InputProps.ref);
|
|
91
|
+
var inputForkRef = useForkRef(inputRef, props == null ? void 0 : (_props$inputProps = props.inputProps) == null ? void 0 : _props$inputProps.ref);
|
|
92
|
+
var _ref3 = props.InputProps || {},
|
|
93
|
+
startAdornment = _ref3.startAdornment,
|
|
94
|
+
endAdornment = _ref3.endAdornment;
|
|
40
95
|
return /*#__PURE__*/_jsxs(JoyFormControl, {
|
|
41
|
-
ref:
|
|
96
|
+
ref: rootRef,
|
|
42
97
|
children: [/*#__PURE__*/_jsx(JoyFormLabel, {
|
|
43
|
-
sx: {
|
|
44
|
-
fontSize: 12
|
|
45
|
-
},
|
|
46
98
|
children: label
|
|
47
99
|
}), /*#__PURE__*/_jsx(JoyInput, {
|
|
48
100
|
type: type,
|
|
49
101
|
value: value,
|
|
50
102
|
onChange: onChange,
|
|
51
103
|
placeholder: placeholder,
|
|
52
|
-
|
|
104
|
+
variant: convertVariant(variant, 'outlined'),
|
|
105
|
+
size: convertSize(size),
|
|
53
106
|
slotProps: {
|
|
54
|
-
input: {
|
|
55
|
-
ref:
|
|
56
|
-
}
|
|
57
|
-
}
|
|
107
|
+
input: _extends({}, props == null ? void 0 : props.inputProps, {
|
|
108
|
+
ref: inputForkRef
|
|
109
|
+
})
|
|
110
|
+
},
|
|
111
|
+
startDecorator: startAdornment,
|
|
112
|
+
endDecorator: endAdornment
|
|
58
113
|
})]
|
|
59
114
|
});
|
|
60
115
|
});
|
|
116
|
+
var Button = /*#__PURE__*/React.forwardRef(function Button(_ref4, ref) {
|
|
117
|
+
var startIcon = _ref4.startIcon,
|
|
118
|
+
color = _ref4.color,
|
|
119
|
+
endIcon = _ref4.endIcon,
|
|
120
|
+
size = _ref4.size,
|
|
121
|
+
sx = _ref4.sx,
|
|
122
|
+
variant = _ref4.variant,
|
|
123
|
+
props = _objectWithoutProperties(_ref4, _excluded3);
|
|
124
|
+
return /*#__PURE__*/_jsx(JoyButton, _extends({}, props, {
|
|
125
|
+
size: convertSize(size),
|
|
126
|
+
color: convertColor(color),
|
|
127
|
+
variant: convertVariant(variant),
|
|
128
|
+
ref: ref,
|
|
129
|
+
startDecorator: startIcon,
|
|
130
|
+
endDecorator: endIcon,
|
|
131
|
+
sx: sx
|
|
132
|
+
}));
|
|
133
|
+
});
|
|
134
|
+
var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref5, ref) {
|
|
135
|
+
var _convertColor;
|
|
136
|
+
var color = _ref5.color,
|
|
137
|
+
size = _ref5.size,
|
|
138
|
+
sx = _ref5.sx,
|
|
139
|
+
touchRippleRef = _ref5.touchRippleRef,
|
|
140
|
+
props = _objectWithoutProperties(_ref5, _excluded4);
|
|
141
|
+
return /*#__PURE__*/_jsx(JoyIconButton, _extends({}, props, {
|
|
142
|
+
size: convertSize(size),
|
|
143
|
+
color: (_convertColor = convertColor(color)) != null ? _convertColor : 'neutral',
|
|
144
|
+
variant: "plain",
|
|
145
|
+
ref: ref,
|
|
146
|
+
sx: sx
|
|
147
|
+
}));
|
|
148
|
+
});
|
|
149
|
+
var Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref6, ref) {
|
|
150
|
+
var name = _ref6.name,
|
|
151
|
+
checkedIcon = _ref6.checkedIcon,
|
|
152
|
+
colorProp = _ref6.color,
|
|
153
|
+
disableRipple = _ref6.disableRipple,
|
|
154
|
+
disableFocusRipple = _ref6.disableFocusRipple,
|
|
155
|
+
disableTouchRipple = _ref6.disableTouchRipple,
|
|
156
|
+
edge = _ref6.edge,
|
|
157
|
+
icon = _ref6.icon,
|
|
158
|
+
inputProps = _ref6.inputProps,
|
|
159
|
+
inputRef = _ref6.inputRef,
|
|
160
|
+
size = _ref6.size,
|
|
161
|
+
sx = _ref6.sx,
|
|
162
|
+
onChange = _ref6.onChange,
|
|
163
|
+
onClick = _ref6.onClick,
|
|
164
|
+
props = _objectWithoutProperties(_ref6, _excluded5);
|
|
165
|
+
return /*#__PURE__*/_jsx(JoySwitch, _extends({}, props, {
|
|
166
|
+
onChange: onChange,
|
|
167
|
+
size: convertSize(size),
|
|
168
|
+
color: convertColor(colorProp),
|
|
169
|
+
ref: ref,
|
|
170
|
+
slotProps: {
|
|
171
|
+
input: _extends({}, inputProps, {
|
|
172
|
+
name: name,
|
|
173
|
+
onClick: onClick,
|
|
174
|
+
ref: inputRef
|
|
175
|
+
}),
|
|
176
|
+
thumb: {
|
|
177
|
+
children: icon
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
sx: [_extends({}, edge === 'start' && {
|
|
181
|
+
ml: '-8px'
|
|
182
|
+
}, edge === 'end' && {
|
|
183
|
+
mr: '-8px'
|
|
184
|
+
})].concat(_toConsumableArray(Array.isArray(sx) ? sx : [sx]))
|
|
185
|
+
}));
|
|
186
|
+
});
|
|
187
|
+
var Select = /*#__PURE__*/React.forwardRef(function (_ref7, ref) {
|
|
188
|
+
var open = _ref7.open,
|
|
189
|
+
onOpen = _ref7.onOpen,
|
|
190
|
+
value = _ref7.value,
|
|
191
|
+
onChange = _ref7.onChange,
|
|
192
|
+
size = _ref7.size,
|
|
193
|
+
color = _ref7.color,
|
|
194
|
+
variant = _ref7.variant,
|
|
195
|
+
inputProps = _ref7.inputProps,
|
|
196
|
+
MenuProps = _ref7.MenuProps,
|
|
197
|
+
inputRef = _ref7.inputRef,
|
|
198
|
+
error = _ref7.error,
|
|
199
|
+
native = _ref7.native,
|
|
200
|
+
fullWidth = _ref7.fullWidth,
|
|
201
|
+
labelId = _ref7.labelId,
|
|
202
|
+
props = _objectWithoutProperties(_ref7, _excluded6);
|
|
203
|
+
var handleChange = function handleChange(event, newValue) {
|
|
204
|
+
if (event && onChange) {
|
|
205
|
+
// Same as in https://github.com/mui/material-ui/blob/e5558282a8f36856aef1299f3a36f3235e92e770/packages/mui-material/src/Select/SelectInput.js#L288-L300
|
|
206
|
+
|
|
207
|
+
// Redefine target to allow name and value to be read.
|
|
208
|
+
// This allows seamless integration with the most popular form libraries.
|
|
209
|
+
// https://github.com/mui/material-ui/issues/13485#issuecomment-676048492
|
|
210
|
+
// Clone the event to not override `target` of the original event.
|
|
211
|
+
var nativeEvent = event.nativeEvent || event;
|
|
212
|
+
// @ts-ignore The nativeEvent is function, not object
|
|
213
|
+
var clonedEvent = new nativeEvent.constructor(nativeEvent.type, nativeEvent);
|
|
214
|
+
Object.defineProperty(clonedEvent, 'target', {
|
|
215
|
+
writable: true,
|
|
216
|
+
value: {
|
|
217
|
+
value: newValue,
|
|
218
|
+
name: props.name
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
onChange(clonedEvent, null);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
return /*#__PURE__*/_jsx(JoySelect, _extends({}, props, {
|
|
225
|
+
listboxOpen: open,
|
|
226
|
+
onListboxOpenChange: function onListboxOpenChange(isOpen) {
|
|
227
|
+
if (isOpen) {
|
|
228
|
+
onOpen == null ? void 0 : onOpen({});
|
|
229
|
+
} else {
|
|
230
|
+
var _MenuProps$onClose;
|
|
231
|
+
MenuProps == null ? void 0 : (_MenuProps$onClose = MenuProps.onClose) == null ? void 0 : _MenuProps$onClose.call(MenuProps, {}, undefined);
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
size: convertSize(size),
|
|
235
|
+
color: convertColor(color),
|
|
236
|
+
variant: convertVariant(variant, 'outlined'),
|
|
237
|
+
ref: ref,
|
|
238
|
+
value: value,
|
|
239
|
+
onChange: handleChange,
|
|
240
|
+
slotProps: {
|
|
241
|
+
button: {
|
|
242
|
+
'aria-labelledby': labelId,
|
|
243
|
+
ref: inputRef
|
|
244
|
+
},
|
|
245
|
+
listbox: {
|
|
246
|
+
disablePortal: false,
|
|
247
|
+
sx: {
|
|
248
|
+
zIndex: 1350
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}));
|
|
253
|
+
});
|
|
254
|
+
var Option = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
|
|
255
|
+
var native = _ref8.native,
|
|
256
|
+
props = _objectWithoutProperties(_ref8, _excluded7);
|
|
257
|
+
return /*#__PURE__*/_jsx(JoyOption, _extends({}, props, {
|
|
258
|
+
ref: ref
|
|
259
|
+
}));
|
|
260
|
+
});
|
|
261
|
+
var InputLabel = /*#__PURE__*/React.forwardRef(function (_ref9, ref) {
|
|
262
|
+
var shrink = _ref9.shrink,
|
|
263
|
+
variant = _ref9.variant,
|
|
264
|
+
sx = _ref9.sx,
|
|
265
|
+
props = _objectWithoutProperties(_ref9, _excluded8);
|
|
266
|
+
return /*#__PURE__*/_jsx(JoyFormLabel, _extends({}, props, {
|
|
267
|
+
ref: ref,
|
|
268
|
+
sx: sx
|
|
269
|
+
}));
|
|
270
|
+
});
|
|
61
271
|
var joySlots = {
|
|
62
272
|
baseCheckbox: Checkbox,
|
|
63
|
-
baseTextField: TextField
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
273
|
+
baseTextField: TextField,
|
|
274
|
+
baseButton: Button,
|
|
275
|
+
baseIconButton: IconButton,
|
|
276
|
+
baseSwitch: Switch,
|
|
277
|
+
baseSelect: Select,
|
|
278
|
+
baseSelectOption: Option,
|
|
279
|
+
baseInputLabel: InputLabel,
|
|
280
|
+
baseFormControl: JoyFormControl
|
|
69
281
|
// BaseTooltip: MUITooltip,
|
|
70
282
|
// BasePopper: MUIPopper,
|
|
71
283
|
};
|
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,13 @@ 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
|
+
component?: import("react").ElementType<any> | undefined;
|
|
19
20
|
components?: {
|
|
20
21
|
Root?: import("react").ElementType<any> | undefined;
|
|
21
22
|
} | undefined;
|
|
22
23
|
componentsProps?: {
|
|
23
|
-
root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").
|
|
24
|
+
root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").PopperRootSlotPropsOverrides, import("@mui/base").PopperOwnProps> | undefined;
|
|
24
25
|
} | undefined;
|
|
25
26
|
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
26
27
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -41,7 +41,8 @@ export const GridPagination = /*#__PURE__*/React.forwardRef(function GridPaginat
|
|
|
41
41
|
if (process.env.NODE_ENV !== 'production') {
|
|
42
42
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
43
43
|
const warnedOnceMissingInPageSizeOptions = React.useRef(false);
|
|
44
|
-
|
|
44
|
+
const pageSize = rootProps.paginationModel?.pageSize ?? paginationModel.pageSize;
|
|
45
|
+
if (!warnedOnceMissingInPageSizeOptions.current && !rootProps.autoPageSize && !rootProps.pageSizeOptions.includes(pageSize)) {
|
|
45
46
|
console.warn([`MUI: The page size \`${paginationModel.pageSize}\` is not preset in the \`pageSizeOptions\``, `Add it to show the pagination select.`].join('\n'));
|
|
46
47
|
warnedOnceMissingInPageSizeOptions.current = true;
|
|
47
48
|
}
|
|
@@ -18,7 +18,8 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
18
18
|
function GridBody(props) {
|
|
19
19
|
const {
|
|
20
20
|
VirtualScrollerComponent,
|
|
21
|
-
ColumnHeadersProps
|
|
21
|
+
ColumnHeadersProps,
|
|
22
|
+
children
|
|
22
23
|
} = props;
|
|
23
24
|
const apiRef = useGridPrivateApiContext();
|
|
24
25
|
const rootProps = useGridRootProps();
|
|
@@ -45,13 +46,20 @@ function GridBody(props) {
|
|
|
45
46
|
if (typeof ResizeObserver === 'undefined') {
|
|
46
47
|
return () => {};
|
|
47
48
|
}
|
|
49
|
+
let animationFrame;
|
|
48
50
|
const observer = new ResizeObserver(() => {
|
|
49
|
-
|
|
51
|
+
// See https://github.com/mui/mui-x/issues/8733
|
|
52
|
+
animationFrame = window.requestAnimationFrame(() => {
|
|
53
|
+
apiRef.current.computeSizeAndPublishResizeEvent();
|
|
54
|
+
});
|
|
50
55
|
});
|
|
51
56
|
if (elementToObserve) {
|
|
52
57
|
observer.observe(elementToObserve);
|
|
53
58
|
}
|
|
54
59
|
return () => {
|
|
60
|
+
if (animationFrame) {
|
|
61
|
+
window.cancelAnimationFrame(animationFrame);
|
|
62
|
+
}
|
|
55
63
|
if (elementToObserve) {
|
|
56
64
|
observer.unobserve(elementToObserve);
|
|
57
65
|
}
|
|
@@ -112,7 +120,7 @@ function GridBody(props) {
|
|
|
112
120
|
, {
|
|
113
121
|
ref: virtualScrollerRef,
|
|
114
122
|
disableVirtualization: isVirtualizationDisabled
|
|
115
|
-
})]
|
|
123
|
+
}), children]
|
|
116
124
|
});
|
|
117
125
|
}
|
|
118
126
|
process.env.NODE_ENV !== "production" ? GridBody.propTypes = {
|
|
@@ -120,6 +128,7 @@ process.env.NODE_ENV !== "production" ? GridBody.propTypes = {
|
|
|
120
128
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
121
129
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
122
130
|
// ----------------------------------------------------------------------
|
|
131
|
+
children: PropTypes.node,
|
|
123
132
|
ColumnHeadersProps: PropTypes.object,
|
|
124
133
|
VirtualScrollerComponent: PropTypes.elementType.isRequired
|
|
125
134
|
} : void 0;
|
|
@@ -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',
|
|
@@ -68,7 +68,9 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
68
68
|
children: activeFilters.map((item, index) => _extends({}, lookup[item.field] && /*#__PURE__*/_jsx("li", {
|
|
69
69
|
children: `${lookup[item.field].headerName || item.field}
|
|
70
70
|
${getOperatorLabel(item)}
|
|
71
|
-
${
|
|
71
|
+
${
|
|
72
|
+
// implicit check for null and undefined
|
|
73
|
+
item.value != null ? getFilterItemValue(item) : ''}`
|
|
72
74
|
}, index)))
|
|
73
75
|
})]
|
|
74
76
|
});
|
|
@@ -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
|
};
|
|
@@ -298,9 +298,9 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
298
298
|
useGridApiMethod(apiRef, focusPrivateApi, 'private');
|
|
299
299
|
React.useEffect(() => {
|
|
300
300
|
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
301
|
-
doc.addEventListener('
|
|
301
|
+
doc.addEventListener('mouseup', handleDocumentClick);
|
|
302
302
|
return () => {
|
|
303
|
-
doc.removeEventListener('
|
|
303
|
+
doc.removeEventListener('mouseup', handleDocumentClick);
|
|
304
304
|
};
|
|
305
305
|
}, [apiRef, handleDocumentClick]);
|
|
306
306
|
useGridApiEventHandler(apiRef, 'columnHeaderBlur', handleBlur);
|
package/modern/index.js
CHANGED