@mui/x-data-grid 6.3.0 → 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 +48 -2
- package/components/GridPagination.js +3 -1
- package/components/base/GridBody.d.ts +1 -0
- package/components/base/GridBody.js +4 -2
- package/components/panel/GridPanel.d.ts +2 -1
- package/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/hooks/features/focus/useGridFocus.js +2 -2
- package/index.js +1 -1
- package/joy/joySlots.js +141 -39
- package/legacy/components/GridPagination.js +3 -1
- package/legacy/components/base/GridBody.js +4 -2
- package/legacy/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/legacy/hooks/features/focus/useGridFocus.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/joy/joySlots.js +156 -51
- package/material/index.d.ts +2 -1
- package/modern/components/GridPagination.js +2 -1
- package/modern/components/base/GridBody.js +4 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/modern/hooks/features/focus/useGridFocus.js +2 -2
- package/modern/index.js +1 -1
- package/modern/joy/joySlots.js +139 -38
- package/node/components/GridPagination.js +2 -1
- package/node/components/base/GridBody.js +4 -2
- package/node/components/toolbar/GridToolbarFilterButton.js +3 -1
- package/node/hooks/features/focus/useGridFocus.js +2 -2
- package/node/index.js +1 -1
- package/node/joy/joySlots.js +139 -38
- package/package.json +2 -2
|
@@ -76,7 +76,9 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
76
76
|
children: activeFilters.map((item, index) => (0, _extends2.default)({}, lookup[item.field] && /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
77
77
|
children: `${lookup[item.field].headerName || item.field}
|
|
78
78
|
${getOperatorLabel(item)}
|
|
79
|
-
${
|
|
79
|
+
${
|
|
80
|
+
// implicit check for null and undefined
|
|
81
|
+
item.value != null ? getFilterItemValue(item) : ''}`
|
|
80
82
|
}, index)))
|
|
81
83
|
})]
|
|
82
84
|
});
|
|
@@ -308,9 +308,9 @@ const useGridFocus = (apiRef, props) => {
|
|
|
308
308
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, focusPrivateApi, 'private');
|
|
309
309
|
React.useEffect(() => {
|
|
310
310
|
const doc = (0, _utils.unstable_ownerDocument)(apiRef.current.rootElementRef.current);
|
|
311
|
-
doc.addEventListener('
|
|
311
|
+
doc.addEventListener('mouseup', handleDocumentClick);
|
|
312
312
|
return () => {
|
|
313
|
-
doc.removeEventListener('
|
|
313
|
+
doc.removeEventListener('mouseup', handleDocumentClick);
|
|
314
314
|
};
|
|
315
315
|
}, [apiRef, handleDocumentClick]);
|
|
316
316
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'columnHeaderBlur', handleBlur);
|
package/node/index.js
CHANGED
package/node/joy/joySlots.js
CHANGED
|
@@ -15,11 +15,18 @@ var _FormLabel = _interopRequireDefault(require("@mui/joy/FormLabel"));
|
|
|
15
15
|
var _Button = _interopRequireDefault(require("@mui/joy/Button"));
|
|
16
16
|
var _IconButton = _interopRequireDefault(require("@mui/joy/IconButton"));
|
|
17
17
|
var _Switch = _interopRequireDefault(require("@mui/joy/Switch"));
|
|
18
|
+
var _Select = _interopRequireDefault(require("@mui/joy/Select"));
|
|
19
|
+
var _Option = _interopRequireDefault(require("@mui/joy/Option"));
|
|
20
|
+
var _utils = require("@mui/utils");
|
|
18
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
22
|
const _excluded = ["touchRippleRef", "inputProps", "onChange", "color", "size", "checked", "sx", "value", "inputRef"],
|
|
20
|
-
_excluded2 = ["
|
|
21
|
-
_excluded3 = ["color", "size", "sx"],
|
|
22
|
-
_excluded4 = ["
|
|
23
|
+
_excluded2 = ["onChange", "label", "placeholder", "value", "inputRef", "type", "size", "variant"],
|
|
24
|
+
_excluded3 = ["startIcon", "color", "endIcon", "size", "sx", "variant"],
|
|
25
|
+
_excluded4 = ["color", "size", "sx", "touchRippleRef"],
|
|
26
|
+
_excluded5 = ["name", "checkedIcon", "color", "disableRipple", "disableFocusRipple", "disableTouchRipple", "edge", "icon", "inputProps", "inputRef", "size", "sx", "onChange", "onClick"],
|
|
27
|
+
_excluded6 = ["open", "onOpen", "value", "onChange", "size", "color", "variant", "inputProps", "MenuProps", "inputRef", "error", "native", "fullWidth", "labelId"],
|
|
28
|
+
_excluded7 = ["native"],
|
|
29
|
+
_excluded8 = ["shrink", "variant", "sx"];
|
|
23
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
31
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
32
|
function convertColor(color) {
|
|
@@ -41,14 +48,17 @@ function convertSize(size) {
|
|
|
41
48
|
large: 'lg'
|
|
42
49
|
}[size] : size;
|
|
43
50
|
}
|
|
44
|
-
function convertVariant(variant) {
|
|
45
|
-
|
|
51
|
+
function convertVariant(variant, defaultVariant = 'plain') {
|
|
52
|
+
if (!variant) {
|
|
53
|
+
return defaultVariant;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
standard: 'outlined',
|
|
46
57
|
outlined: 'outlined',
|
|
47
58
|
contained: 'solid',
|
|
48
59
|
text: 'plain',
|
|
49
|
-
standard: 'plain',
|
|
50
60
|
filled: 'soft'
|
|
51
|
-
}[variant]
|
|
61
|
+
}[variant] || defaultVariant;
|
|
52
62
|
}
|
|
53
63
|
const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
54
64
|
let {
|
|
@@ -69,36 +79,46 @@ const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
69
79
|
onChange: onChange
|
|
70
80
|
}));
|
|
71
81
|
});
|
|
72
|
-
const TextField = /*#__PURE__*/React.forwardRef(({
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
const TextField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
83
|
+
let {
|
|
84
|
+
onChange,
|
|
85
|
+
label,
|
|
86
|
+
placeholder,
|
|
87
|
+
value,
|
|
88
|
+
inputRef,
|
|
89
|
+
type,
|
|
90
|
+
size,
|
|
91
|
+
variant
|
|
92
|
+
} = _ref2,
|
|
93
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
|
|
94
|
+
const rootRef = (0, _utils.unstable_useForkRef)(ref, props.InputProps?.ref);
|
|
95
|
+
const inputForkRef = (0, _utils.unstable_useForkRef)(inputRef, props?.inputProps?.ref);
|
|
96
|
+
const {
|
|
97
|
+
startAdornment,
|
|
98
|
+
endAdornment
|
|
99
|
+
} = props.InputProps || {};
|
|
80
100
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FormControl.default, {
|
|
81
|
-
ref:
|
|
101
|
+
ref: rootRef,
|
|
82
102
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormLabel.default, {
|
|
83
|
-
sx: {
|
|
84
|
-
fontSize: 12
|
|
85
|
-
},
|
|
86
103
|
children: label
|
|
87
104
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Input.default, {
|
|
88
105
|
type: type,
|
|
89
106
|
value: value,
|
|
90
107
|
onChange: onChange,
|
|
91
108
|
placeholder: placeholder,
|
|
92
|
-
|
|
109
|
+
variant: convertVariant(variant, 'outlined'),
|
|
110
|
+
size: convertSize(size),
|
|
93
111
|
slotProps: {
|
|
94
|
-
input: {
|
|
95
|
-
ref:
|
|
96
|
-
}
|
|
97
|
-
}
|
|
112
|
+
input: (0, _extends2.default)({}, props?.inputProps, {
|
|
113
|
+
ref: inputForkRef
|
|
114
|
+
})
|
|
115
|
+
},
|
|
116
|
+
startDecorator: startAdornment,
|
|
117
|
+
endDecorator: endAdornment
|
|
98
118
|
})]
|
|
99
119
|
});
|
|
100
120
|
});
|
|
101
|
-
const Button = /*#__PURE__*/React.forwardRef(function Button(
|
|
121
|
+
const Button = /*#__PURE__*/React.forwardRef(function Button(_ref3, ref) {
|
|
102
122
|
let {
|
|
103
123
|
startIcon,
|
|
104
124
|
color,
|
|
@@ -106,25 +126,25 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(_ref2, ref) {
|
|
|
106
126
|
size,
|
|
107
127
|
sx,
|
|
108
128
|
variant
|
|
109
|
-
} =
|
|
110
|
-
props = (0, _objectWithoutPropertiesLoose2.default)(
|
|
129
|
+
} = _ref3,
|
|
130
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
|
|
111
131
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, (0, _extends2.default)({}, props, {
|
|
112
132
|
size: convertSize(size),
|
|
113
133
|
color: convertColor(color),
|
|
114
|
-
variant: convertVariant(variant)
|
|
134
|
+
variant: convertVariant(variant),
|
|
115
135
|
ref: ref,
|
|
116
136
|
startDecorator: startIcon,
|
|
117
137
|
endDecorator: endIcon,
|
|
118
138
|
sx: sx
|
|
119
139
|
}));
|
|
120
140
|
});
|
|
121
|
-
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(
|
|
141
|
+
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref4, ref) {
|
|
122
142
|
let {
|
|
123
143
|
color,
|
|
124
144
|
size,
|
|
125
145
|
sx
|
|
126
|
-
} =
|
|
127
|
-
props = (0, _objectWithoutPropertiesLoose2.default)(
|
|
146
|
+
} = _ref4,
|
|
147
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref4, _excluded4);
|
|
128
148
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, (0, _extends2.default)({}, props, {
|
|
129
149
|
size: convertSize(size),
|
|
130
150
|
color: convertColor(color) ?? 'neutral',
|
|
@@ -133,7 +153,7 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref3, ref)
|
|
|
133
153
|
sx: sx
|
|
134
154
|
}));
|
|
135
155
|
});
|
|
136
|
-
const Switch = /*#__PURE__*/React.forwardRef(function Switch(
|
|
156
|
+
const Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref5, ref) {
|
|
137
157
|
let {
|
|
138
158
|
name,
|
|
139
159
|
color: colorProp,
|
|
@@ -145,8 +165,8 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref4, ref) {
|
|
|
145
165
|
sx,
|
|
146
166
|
onChange,
|
|
147
167
|
onClick
|
|
148
|
-
} =
|
|
149
|
-
props = (0, _objectWithoutPropertiesLoose2.default)(
|
|
168
|
+
} = _ref5,
|
|
169
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref5, _excluded5);
|
|
150
170
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Switch.default, (0, _extends2.default)({}, props, {
|
|
151
171
|
onChange: onChange,
|
|
152
172
|
size: convertSize(size),
|
|
@@ -169,15 +189,96 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref4, ref) {
|
|
|
169
189
|
}), ...(Array.isArray(sx) ? sx : [sx])]
|
|
170
190
|
}));
|
|
171
191
|
});
|
|
192
|
+
const Select = /*#__PURE__*/React.forwardRef((_ref6, ref) => {
|
|
193
|
+
let {
|
|
194
|
+
open,
|
|
195
|
+
onOpen,
|
|
196
|
+
value,
|
|
197
|
+
onChange,
|
|
198
|
+
size,
|
|
199
|
+
color,
|
|
200
|
+
variant,
|
|
201
|
+
MenuProps,
|
|
202
|
+
inputRef,
|
|
203
|
+
labelId
|
|
204
|
+
} = _ref6,
|
|
205
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref6, _excluded6);
|
|
206
|
+
const handleChange = (event, newValue) => {
|
|
207
|
+
if (event && onChange) {
|
|
208
|
+
// Same as in https://github.com/mui/material-ui/blob/e5558282a8f36856aef1299f3a36f3235e92e770/packages/mui-material/src/Select/SelectInput.js#L288-L300
|
|
209
|
+
|
|
210
|
+
// Redefine target to allow name and value to be read.
|
|
211
|
+
// This allows seamless integration with the most popular form libraries.
|
|
212
|
+
// https://github.com/mui/material-ui/issues/13485#issuecomment-676048492
|
|
213
|
+
// Clone the event to not override `target` of the original event.
|
|
214
|
+
const nativeEvent = event.nativeEvent || event;
|
|
215
|
+
// @ts-ignore The nativeEvent is function, not object
|
|
216
|
+
const clonedEvent = new nativeEvent.constructor(nativeEvent.type, nativeEvent);
|
|
217
|
+
Object.defineProperty(clonedEvent, 'target', {
|
|
218
|
+
writable: true,
|
|
219
|
+
value: {
|
|
220
|
+
value: newValue,
|
|
221
|
+
name: props.name
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
onChange(clonedEvent, null);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, (0, _extends2.default)({}, props, {
|
|
228
|
+
listboxOpen: open,
|
|
229
|
+
onListboxOpenChange: isOpen => {
|
|
230
|
+
if (isOpen) {
|
|
231
|
+
onOpen?.({});
|
|
232
|
+
} else {
|
|
233
|
+
MenuProps?.onClose?.({}, undefined);
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
size: convertSize(size),
|
|
237
|
+
color: convertColor(color),
|
|
238
|
+
variant: convertVariant(variant, 'outlined'),
|
|
239
|
+
ref: ref,
|
|
240
|
+
value: value,
|
|
241
|
+
onChange: handleChange,
|
|
242
|
+
slotProps: {
|
|
243
|
+
button: {
|
|
244
|
+
'aria-labelledby': labelId,
|
|
245
|
+
ref: inputRef
|
|
246
|
+
},
|
|
247
|
+
listbox: {
|
|
248
|
+
disablePortal: false,
|
|
249
|
+
sx: {
|
|
250
|
+
zIndex: 1350
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}));
|
|
255
|
+
});
|
|
256
|
+
const Option = /*#__PURE__*/React.forwardRef((_ref7, ref) => {
|
|
257
|
+
let props = (0, _objectWithoutPropertiesLoose2.default)(_ref7, _excluded7);
|
|
258
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Option.default, (0, _extends2.default)({}, props, {
|
|
259
|
+
ref: ref
|
|
260
|
+
}));
|
|
261
|
+
});
|
|
262
|
+
const InputLabel = /*#__PURE__*/React.forwardRef((_ref8, ref) => {
|
|
263
|
+
let {
|
|
264
|
+
sx
|
|
265
|
+
} = _ref8,
|
|
266
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref8, _excluded8);
|
|
267
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormLabel.default, (0, _extends2.default)({}, props, {
|
|
268
|
+
ref: ref,
|
|
269
|
+
sx: sx
|
|
270
|
+
}));
|
|
271
|
+
});
|
|
172
272
|
const joySlots = {
|
|
173
273
|
baseCheckbox: Checkbox,
|
|
174
274
|
baseTextField: TextField,
|
|
175
275
|
baseButton: Button,
|
|
176
276
|
baseIconButton: IconButton,
|
|
177
|
-
baseSwitch: Switch
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
277
|
+
baseSwitch: Switch,
|
|
278
|
+
baseSelect: Select,
|
|
279
|
+
baseSelectOption: Option,
|
|
280
|
+
baseInputLabel: InputLabel,
|
|
281
|
+
baseFormControl: _FormControl.default
|
|
181
282
|
// BaseTooltip: MUITooltip,
|
|
182
283
|
// BasePopper: MUIPopper,
|
|
183
284
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.1",
|
|
4
4
|
"description": "The community edition of the data grid component (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@babel/runtime": "^7.21.0",
|
|
39
|
-
"@mui/utils": "^5.12.
|
|
39
|
+
"@mui/utils": "^5.12.3",
|
|
40
40
|
"clsx": "^1.2.1",
|
|
41
41
|
"prop-types": "^15.8.1",
|
|
42
42
|
"reselect": "^4.1.8"
|