@mui/x-data-grid 6.2.0 → 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 +118 -1
- package/components/GridHeader.d.ts +2 -2
- package/components/GridHeader.js +4 -6
- package/components/base/GridBody.d.ts +0 -1
- package/components/base/GridBody.js +39 -15
- package/components/cell/GridActionsCell.d.ts +2 -3
- package/components/cell/GridActionsCell.js +9 -1
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/containers/GridMainContainer.d.ts +3 -1
- package/components/containers/GridMainContainer.js +3 -2
- package/components/containers/GridRoot.js +0 -5
- package/components/containers/GridRootStyles.js +3 -1
- package/components/index.d.ts +0 -1
- package/components/index.js +0 -1
- package/components/panel/GridColumnsPanel.js +3 -2
- package/components/panel/GridPanel.d.ts +3 -3
- package/components/panel/GridPanel.js +2 -1
- package/components/panel/filterPanel/GridFilterPanel.js +5 -2
- package/constants/gridClasses.js +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +22 -15
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +4 -0
- package/hooks/features/dimensions/useGridDimensions.js +49 -10
- package/hooks/features/export/useGridPrintExport.js +3 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -0
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -5
- package/index.js +1 -1
- package/joy/index.d.ts +2 -0
- package/joy/index.js +2 -0
- package/joy/joySlots.d.ts +4 -0
- package/joy/joySlots.js +179 -0
- package/joy/package.json +6 -0
- package/legacy/components/GridHeader.js +4 -6
- package/legacy/components/base/GridBody.js +40 -16
- package/legacy/components/cell/GridActionsCell.js +11 -2
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/legacy/components/containers/GridMainContainer.js +3 -2
- package/legacy/components/containers/GridRoot.js +0 -5
- package/legacy/components/containers/GridRootStyles.js +3 -1
- package/legacy/components/index.js +0 -1
- package/legacy/components/panel/GridColumnsPanel.js +3 -2
- package/legacy/components/panel/GridPanel.js +2 -1
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +5 -2
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +22 -15
- package/legacy/hooks/features/dimensions/useGridDimensions.js +55 -12
- package/legacy/hooks/features/export/useGridPrintExport.js +3 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +12 -6
- package/legacy/index.js +1 -1
- package/legacy/joy/index.js +2 -0
- package/legacy/joy/joySlots.js +180 -0
- 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/models/gridSlotsComponent.d.ts +2 -2
- package/modern/components/GridHeader.js +4 -6
- package/modern/components/base/GridBody.js +39 -15
- package/modern/components/cell/GridActionsCell.js +9 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/modern/components/containers/GridMainContainer.js +3 -2
- package/modern/components/containers/GridRoot.js +0 -5
- package/modern/components/containers/GridRootStyles.js +3 -1
- package/modern/components/index.js +0 -1
- package/modern/components/panel/GridColumnsPanel.js +3 -2
- package/modern/components/panel/GridPanel.js +2 -1
- package/modern/components/panel/filterPanel/GridFilterPanel.js +5 -2
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +21 -14
- package/modern/hooks/features/dimensions/useGridDimensions.js +48 -10
- package/modern/hooks/features/export/useGridPrintExport.js +3 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -5
- package/modern/index.js +1 -1
- package/modern/joy/index.js +2 -0
- package/modern/joy/joySlots.js +177 -0
- package/modern/locales/frFR.js +2 -2
- package/modern/locales/trTR.js +2 -2
- package/modern/locales/zhCN.js +2 -2
- package/node/components/GridHeader.js +5 -8
- package/node/components/base/GridBody.js +39 -15
- package/node/components/cell/GridActionsCell.js +9 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/node/components/containers/GridMainContainer.js +5 -3
- package/node/components/containers/GridRoot.js +0 -5
- package/node/components/containers/GridRootStyles.js +3 -1
- package/node/components/index.js +0 -11
- package/node/components/panel/GridColumnsPanel.js +3 -2
- package/node/components/panel/GridPanel.js +2 -1
- package/node/components/panel/filterPanel/GridFilterPanel.js +5 -2
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +20 -11
- package/node/hooks/features/dimensions/useGridDimensions.js +47 -9
- package/node/hooks/features/export/useGridPrintExport.js +3 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -5
- package/node/index.js +1 -1
- package/node/joy/index.js +13 -0
- package/node/joy/joySlots.js +185 -0
- 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/components/GridAutoSizer.d.ts +0 -44
- package/components/GridAutoSizer.js +0 -126
- package/legacy/components/GridAutoSizer.js +0 -132
- package/modern/components/GridAutoSizer.js +0 -125
- package/node/components/GridAutoSizer.js +0 -132
|
@@ -16,6 +16,7 @@ var _useGridVisibleRows = require("../../utils/useGridVisibleRows");
|
|
|
16
16
|
var _gridRowsMetaSelector = require("../rows/gridRowsMetaSelector");
|
|
17
17
|
var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
18
18
|
var _gridColumnsUtils = require("../columns/gridColumnsUtils");
|
|
19
|
+
var _gridClasses = require("../../../constants/gridClasses");
|
|
19
20
|
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); }
|
|
20
21
|
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; }
|
|
21
22
|
const isTestEnvironment = process.env.NODE_ENV === 'test';
|
|
@@ -121,10 +122,20 @@ function useGridDimensions(apiRef, props) {
|
|
|
121
122
|
apiRef.current.publishEvent('viewportInnerSizeChange', newFullDimensions.viewportInnerSize);
|
|
122
123
|
}
|
|
123
124
|
}, [apiRef, props.scrollbarSize, props.autoHeight, rowsMeta.currentPageTotalHeight, totalHeaderHeight]);
|
|
125
|
+
const [savedSize, setSavedSize] = React.useState();
|
|
126
|
+
const debouncedSetSavedSize = React.useMemo(() => (0, _utils.unstable_debounce)(setSavedSize, 60), []);
|
|
127
|
+
const previousSize = React.useRef();
|
|
128
|
+
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
129
|
+
if (savedSize) {
|
|
130
|
+
updateGridDimensionsRef();
|
|
131
|
+
apiRef.current.publishEvent('debouncedResize', rootDimensionsRef.current);
|
|
132
|
+
}
|
|
133
|
+
}, [apiRef, savedSize, updateGridDimensionsRef]);
|
|
134
|
+
|
|
135
|
+
// This is the function called by apiRef.current.resize()
|
|
124
136
|
const resize = React.useCallback(() => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}, [apiRef, updateGridDimensionsRef]);
|
|
137
|
+
apiRef.current.computeSizeAndPublishResizeEvent();
|
|
138
|
+
}, [apiRef]);
|
|
128
139
|
const getRootDimensions = React.useCallback(() => fullDimensionsRef.current, []);
|
|
129
140
|
const getViewportPageSize = React.useCallback(() => {
|
|
130
141
|
const dimensions = apiRef.current.getRootDimensions();
|
|
@@ -146,17 +157,44 @@ function useGridDimensions(apiRef, props) {
|
|
|
146
157
|
const maximumPageSizeWithoutScrollBar = Math.floor(dimensions.viewportInnerSize.height / rowHeight);
|
|
147
158
|
return Math.min(maximumPageSizeWithoutScrollBar, currentPage.rows.length);
|
|
148
159
|
}, [apiRef, props.pagination, props.paginationMode, props.getRowHeight, rowHeight]);
|
|
160
|
+
const computeSizeAndPublishResizeEvent = React.useCallback(() => {
|
|
161
|
+
const rootEl = apiRef.current.rootElementRef?.current;
|
|
162
|
+
const mainEl = rootEl?.querySelector(`.${_gridClasses.gridClasses.main}`);
|
|
163
|
+
if (!mainEl) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
const height = mainEl.offsetHeight || 0;
|
|
167
|
+
const width = mainEl.offsetWidth || 0;
|
|
168
|
+
const win = (0, _utils.unstable_ownerWindow)(mainEl);
|
|
169
|
+
const computedStyle = win.getComputedStyle(mainEl);
|
|
170
|
+
const paddingLeft = parseInt(computedStyle.paddingLeft, 10) || 0;
|
|
171
|
+
const paddingRight = parseInt(computedStyle.paddingRight, 10) || 0;
|
|
172
|
+
const paddingTop = parseInt(computedStyle.paddingTop, 10) || 0;
|
|
173
|
+
const paddingBottom = parseInt(computedStyle.paddingBottom, 10) || 0;
|
|
174
|
+
const newHeight = height - paddingTop - paddingBottom;
|
|
175
|
+
const newWidth = width - paddingLeft - paddingRight;
|
|
176
|
+
const hasHeightChanged = newHeight !== previousSize.current?.height;
|
|
177
|
+
const hasWidthChanged = newWidth !== previousSize.current?.width;
|
|
178
|
+
if (!previousSize.current || hasHeightChanged || hasWidthChanged) {
|
|
179
|
+
const size = {
|
|
180
|
+
width: newWidth,
|
|
181
|
+
height: newHeight
|
|
182
|
+
};
|
|
183
|
+
apiRef.current.publishEvent('resize', size);
|
|
184
|
+
previousSize.current = size;
|
|
185
|
+
}
|
|
186
|
+
}, [apiRef]);
|
|
149
187
|
const dimensionsApi = {
|
|
150
188
|
resize,
|
|
151
189
|
getRootDimensions
|
|
152
190
|
};
|
|
153
191
|
const dimensionsPrivateApi = {
|
|
154
192
|
getViewportPageSize,
|
|
155
|
-
updateGridDimensionsRef
|
|
193
|
+
updateGridDimensionsRef,
|
|
194
|
+
computeSizeAndPublishResizeEvent
|
|
156
195
|
};
|
|
157
196
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, dimensionsApi, 'public');
|
|
158
197
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, dimensionsPrivateApi, 'private');
|
|
159
|
-
const debounceResize = React.useMemo(() => (0, _utils.unstable_debounce)(resize, 60), [resize]);
|
|
160
198
|
const isFirstSizing = React.useRef(true);
|
|
161
199
|
const handleResize = React.useCallback(size => {
|
|
162
200
|
rootDimensionsRef.current = size;
|
|
@@ -173,18 +211,18 @@ function useGridDimensions(apiRef, props) {
|
|
|
173
211
|
}
|
|
174
212
|
if (isTestEnvironment) {
|
|
175
213
|
// We don't need to debounce the resize for tests.
|
|
176
|
-
|
|
214
|
+
setSavedSize(size);
|
|
177
215
|
isFirstSizing.current = false;
|
|
178
216
|
return;
|
|
179
217
|
}
|
|
180
218
|
if (isFirstSizing.current) {
|
|
181
219
|
// We want to initialize the grid dimensions as soon as possible to avoid flickering
|
|
182
|
-
|
|
220
|
+
setSavedSize(size);
|
|
183
221
|
isFirstSizing.current = false;
|
|
184
222
|
return;
|
|
185
223
|
}
|
|
186
|
-
|
|
187
|
-
}, [props.autoHeight,
|
|
224
|
+
debouncedSetSavedSize(size);
|
|
225
|
+
}, [props.autoHeight, debouncedSetSavedSize, logger]);
|
|
188
226
|
(0, _utils.unstable_useEnhancedEffect)(() => updateGridDimensionsRef(), [updateGridDimensionsRef]);
|
|
189
227
|
(0, _useGridApiEventHandler.useGridApiOptionHandler)(apiRef, 'sortedRowsSet', updateGridDimensionsRef);
|
|
190
228
|
(0, _useGridApiEventHandler.useGridApiOptionHandler)(apiRef, 'paginationModelChange', updateGridDimensionsRef);
|
|
@@ -130,7 +130,9 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
130
130
|
printDoc.body.classList.add(...normalizeOptions.bodyClassName.split(' '));
|
|
131
131
|
}
|
|
132
132
|
if (normalizeOptions.copyStyles) {
|
|
133
|
-
const
|
|
133
|
+
const rootCandidate = gridRootElement.getRootNode();
|
|
134
|
+
const root = rootCandidate.constructor.name === 'ShadowRoot' ? rootCandidate : doc.current;
|
|
135
|
+
const headStyleElements = root.querySelectorAll("style, link[rel='stylesheet']");
|
|
134
136
|
for (let i = 0; i < headStyleElements.length; i += 1) {
|
|
135
137
|
const node = headStyleElements[i];
|
|
136
138
|
if (node.tagName === 'STYLE') {
|
|
@@ -185,11 +185,13 @@ const useGridVirtualScroller = props => {
|
|
|
185
185
|
height: rootRef.current.clientHeight
|
|
186
186
|
});
|
|
187
187
|
}, [rowsMeta.currentPageTotalHeight]);
|
|
188
|
-
const handleResize = React.useCallback(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
const handleResize = React.useCallback(() => {
|
|
189
|
+
if (rootRef.current) {
|
|
190
|
+
setContainerDimensions({
|
|
191
|
+
width: rootRef.current.clientWidth,
|
|
192
|
+
height: rootRef.current.clientHeight
|
|
193
|
+
});
|
|
194
|
+
}
|
|
193
195
|
}, []);
|
|
194
196
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'debouncedResize', handleResize);
|
|
195
197
|
const updateRenderZonePosition = React.useCallback(nextRenderContext => {
|
|
@@ -315,6 +317,7 @@ const useGridVirtualScroller = props => {
|
|
|
315
317
|
renderContext
|
|
316
318
|
}) => {
|
|
317
319
|
const {
|
|
320
|
+
onRowRender,
|
|
318
321
|
renderContext: nextRenderContext,
|
|
319
322
|
minFirstColumn = renderZoneMinColumnIndex,
|
|
320
323
|
maxLastColumn = renderZoneMaxColumnIndex,
|
|
@@ -398,6 +401,9 @@ const useGridVirtualScroller = props => {
|
|
|
398
401
|
} else {
|
|
399
402
|
isSelected = apiRef.current.isRowSelectable(id);
|
|
400
403
|
}
|
|
404
|
+
if (onRowRender) {
|
|
405
|
+
onRowRender(id);
|
|
406
|
+
}
|
|
401
407
|
const focusedCell = cellFocus !== null && cellFocus.id === id ? cellFocus.field : null;
|
|
402
408
|
let tabbableCell = null;
|
|
403
409
|
if (cellTabIndex !== null && cellTabIndex.id === id) {
|
package/node/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "unstable_joySlots", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _joySlots.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
var _joySlots = _interopRequireDefault(require("./joySlots"));
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _Checkbox = _interopRequireDefault(require("@mui/joy/Checkbox"));
|
|
12
|
+
var _Input = _interopRequireDefault(require("@mui/joy/Input"));
|
|
13
|
+
var _FormControl = _interopRequireDefault(require("@mui/joy/FormControl"));
|
|
14
|
+
var _FormLabel = _interopRequireDefault(require("@mui/joy/FormLabel"));
|
|
15
|
+
var _Button = _interopRequireDefault(require("@mui/joy/Button"));
|
|
16
|
+
var _IconButton = _interopRequireDefault(require("@mui/joy/IconButton"));
|
|
17
|
+
var _Switch = _interopRequireDefault(require("@mui/joy/Switch"));
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["touchRippleRef", "inputProps", "onChange", "color", "size", "checked", "sx", "value", "inputRef"],
|
|
20
|
+
_excluded2 = ["startIcon", "color", "endIcon", "size", "sx", "variant"],
|
|
21
|
+
_excluded3 = ["color", "size", "sx"],
|
|
22
|
+
_excluded4 = ["name", "checkedIcon", "color", "disableRipple", "disableFocusRipple", "disableTouchRipple", "edge", "icon", "inputProps", "inputRef", "size", "sx", "onChange", "onClick"];
|
|
23
|
+
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
|
+
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
|
+
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
|
+
return variant ? {
|
|
46
|
+
outlined: 'outlined',
|
|
47
|
+
contained: 'solid',
|
|
48
|
+
text: 'plain',
|
|
49
|
+
standard: 'plain',
|
|
50
|
+
filled: 'soft'
|
|
51
|
+
}[variant] : variant;
|
|
52
|
+
}
|
|
53
|
+
const Checkbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
54
|
+
let {
|
|
55
|
+
inputProps,
|
|
56
|
+
onChange,
|
|
57
|
+
checked,
|
|
58
|
+
inputRef
|
|
59
|
+
} = _ref,
|
|
60
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.default, (0, _extends2.default)({}, props, {
|
|
62
|
+
slotProps: {
|
|
63
|
+
input: (0, _extends2.default)({}, inputProps, {
|
|
64
|
+
ref: inputRef
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
ref: ref,
|
|
68
|
+
checked: checked,
|
|
69
|
+
onChange: onChange
|
|
70
|
+
}));
|
|
71
|
+
});
|
|
72
|
+
const TextField = /*#__PURE__*/React.forwardRef(({
|
|
73
|
+
onChange,
|
|
74
|
+
label,
|
|
75
|
+
placeholder,
|
|
76
|
+
value,
|
|
77
|
+
inputRef,
|
|
78
|
+
type
|
|
79
|
+
}, ref) => {
|
|
80
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FormControl.default, {
|
|
81
|
+
ref: ref,
|
|
82
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FormLabel.default, {
|
|
83
|
+
sx: {
|
|
84
|
+
fontSize: 12
|
|
85
|
+
},
|
|
86
|
+
children: label
|
|
87
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Input.default, {
|
|
88
|
+
type: type,
|
|
89
|
+
value: value,
|
|
90
|
+
onChange: onChange,
|
|
91
|
+
placeholder: placeholder,
|
|
92
|
+
size: "sm",
|
|
93
|
+
slotProps: {
|
|
94
|
+
input: {
|
|
95
|
+
ref: inputRef
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})]
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
const Button = /*#__PURE__*/React.forwardRef(function Button(_ref2, ref) {
|
|
102
|
+
let {
|
|
103
|
+
startIcon,
|
|
104
|
+
color,
|
|
105
|
+
endIcon,
|
|
106
|
+
size,
|
|
107
|
+
sx,
|
|
108
|
+
variant
|
|
109
|
+
} = _ref2,
|
|
110
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
|
|
111
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, (0, _extends2.default)({}, props, {
|
|
112
|
+
size: convertSize(size),
|
|
113
|
+
color: convertColor(color),
|
|
114
|
+
variant: convertVariant(variant) ?? 'plain',
|
|
115
|
+
ref: ref,
|
|
116
|
+
startDecorator: startIcon,
|
|
117
|
+
endDecorator: endIcon,
|
|
118
|
+
sx: sx
|
|
119
|
+
}));
|
|
120
|
+
});
|
|
121
|
+
const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(_ref3, ref) {
|
|
122
|
+
let {
|
|
123
|
+
color,
|
|
124
|
+
size,
|
|
125
|
+
sx
|
|
126
|
+
} = _ref3,
|
|
127
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref3, _excluded3);
|
|
128
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, (0, _extends2.default)({}, props, {
|
|
129
|
+
size: convertSize(size),
|
|
130
|
+
color: convertColor(color) ?? 'neutral',
|
|
131
|
+
variant: "plain",
|
|
132
|
+
ref: ref,
|
|
133
|
+
sx: sx
|
|
134
|
+
}));
|
|
135
|
+
});
|
|
136
|
+
const Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref4, ref) {
|
|
137
|
+
let {
|
|
138
|
+
name,
|
|
139
|
+
color: colorProp,
|
|
140
|
+
edge,
|
|
141
|
+
icon,
|
|
142
|
+
inputProps,
|
|
143
|
+
inputRef,
|
|
144
|
+
size,
|
|
145
|
+
sx,
|
|
146
|
+
onChange,
|
|
147
|
+
onClick
|
|
148
|
+
} = _ref4,
|
|
149
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref4, _excluded4);
|
|
150
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Switch.default, (0, _extends2.default)({}, props, {
|
|
151
|
+
onChange: onChange,
|
|
152
|
+
size: convertSize(size),
|
|
153
|
+
color: convertColor(colorProp),
|
|
154
|
+
ref: ref,
|
|
155
|
+
slotProps: {
|
|
156
|
+
input: (0, _extends2.default)({}, inputProps, {
|
|
157
|
+
name,
|
|
158
|
+
onClick: onClick,
|
|
159
|
+
ref: inputRef
|
|
160
|
+
}),
|
|
161
|
+
thumb: {
|
|
162
|
+
children: icon
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
sx: [(0, _extends2.default)({}, edge === 'start' && {
|
|
166
|
+
ml: '-8px'
|
|
167
|
+
}, edge === 'end' && {
|
|
168
|
+
mr: '-8px'
|
|
169
|
+
}), ...(Array.isArray(sx) ? sx : [sx])]
|
|
170
|
+
}));
|
|
171
|
+
});
|
|
172
|
+
const joySlots = {
|
|
173
|
+
baseCheckbox: Checkbox,
|
|
174
|
+
baseTextField: TextField,
|
|
175
|
+
baseButton: Button,
|
|
176
|
+
baseIconButton: IconButton,
|
|
177
|
+
baseSwitch: Switch
|
|
178
|
+
// BaseFormControl: MUIFormControl,
|
|
179
|
+
// baseSelect: Select,
|
|
180
|
+
// baseSelectOption: Option,
|
|
181
|
+
// BaseTooltip: MUITooltip,
|
|
182
|
+
// BasePopper: MUIPopper,
|
|
183
|
+
};
|
|
184
|
+
var _default = joySlots;
|
|
185
|
+
exports.default = _default;
|
package/node/locales/frFR.js
CHANGED
|
@@ -43,7 +43,7 @@ const frFRGrid = {
|
|
|
43
43
|
columnsPanelHideAllButton: 'Tout cacher',
|
|
44
44
|
// Filter panel text
|
|
45
45
|
filterPanelAddFilter: 'Ajouter un filtre',
|
|
46
|
-
|
|
46
|
+
filterPanelRemoveAll: 'Tout supprimer',
|
|
47
47
|
filterPanelDeleteIconLabel: 'Supprimer',
|
|
48
48
|
filterPanelLogicOperator: 'Opérateur logique',
|
|
49
49
|
filterPanelOperator: 'Opérateur',
|
|
@@ -73,7 +73,7 @@ const frFRGrid = {
|
|
|
73
73
|
// Column menu text
|
|
74
74
|
columnMenuLabel: 'Menu',
|
|
75
75
|
columnMenuShowColumns: 'Afficher les colonnes',
|
|
76
|
-
|
|
76
|
+
columnMenuManageColumns: 'Gérer les colonnes',
|
|
77
77
|
columnMenuFilter: 'Filtrer',
|
|
78
78
|
columnMenuHideColumn: 'Cacher',
|
|
79
79
|
columnMenuUnsort: 'Annuler le tri',
|
package/node/locales/trTR.js
CHANGED
|
@@ -43,7 +43,7 @@ const trTRGrid = {
|
|
|
43
43
|
columnsPanelHideAllButton: 'Hepsini gizle',
|
|
44
44
|
// Filter panel text
|
|
45
45
|
filterPanelAddFilter: 'Filtre Ekle',
|
|
46
|
-
|
|
46
|
+
filterPanelRemoveAll: 'Hepsini kaldır',
|
|
47
47
|
filterPanelDeleteIconLabel: 'Kaldır',
|
|
48
48
|
filterPanelLogicOperator: 'Mantıksal operatörler',
|
|
49
49
|
filterPanelOperator: 'Operatör',
|
|
@@ -73,7 +73,7 @@ const trTRGrid = {
|
|
|
73
73
|
// Column menu text
|
|
74
74
|
columnMenuLabel: 'Menü',
|
|
75
75
|
columnMenuShowColumns: 'Sütunları göster',
|
|
76
|
-
|
|
76
|
+
columnMenuManageColumns: 'Sütunları yönet',
|
|
77
77
|
columnMenuFilter: 'Filtre uygula',
|
|
78
78
|
columnMenuHideColumn: 'Gizle',
|
|
79
79
|
columnMenuUnsort: 'Sıralama',
|
package/node/locales/zhCN.js
CHANGED
|
@@ -43,7 +43,7 @@ const zhCNGrid = {
|
|
|
43
43
|
columnsPanelHideAllButton: '隐藏所有',
|
|
44
44
|
// Filter panel text
|
|
45
45
|
filterPanelAddFilter: '添加筛选器',
|
|
46
|
-
|
|
46
|
+
filterPanelRemoveAll: '清除全部',
|
|
47
47
|
filterPanelDeleteIconLabel: '删除',
|
|
48
48
|
filterPanelLogicOperator: '逻辑操作器',
|
|
49
49
|
filterPanelOperator: '操作器',
|
|
@@ -73,7 +73,7 @@ const zhCNGrid = {
|
|
|
73
73
|
// Column menu text
|
|
74
74
|
columnMenuLabel: '菜单',
|
|
75
75
|
columnMenuShowColumns: '显示',
|
|
76
|
-
|
|
76
|
+
columnMenuManageColumns: '管理列',
|
|
77
77
|
columnMenuFilter: '筛选器',
|
|
78
78
|
columnMenuHideColumn: '隐藏',
|
|
79
79
|
columnMenuUnsort: '恢复默认',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
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,10 +36,10 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@babel/runtime": "^7.21.0",
|
|
39
|
-
"@mui/utils": "^5.
|
|
39
|
+
"@mui/utils": "^5.12.0",
|
|
40
40
|
"clsx": "^1.2.1",
|
|
41
41
|
"prop-types": "^15.8.1",
|
|
42
|
-
"reselect": "^4.1.
|
|
42
|
+
"reselect": "^4.1.8"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@mui/material": "^5.4.1",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface AutoSizerSize {
|
|
3
|
-
height: number;
|
|
4
|
-
width: number;
|
|
5
|
-
}
|
|
6
|
-
export interface AutoSizerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'onResize'> {
|
|
7
|
-
/**
|
|
8
|
-
* Function responsible for rendering children.
|
|
9
|
-
* @param {AutoSizerSize} size The grid's size.
|
|
10
|
-
* @returns {React.ReactNode} The children to render.
|
|
11
|
-
*/
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* Default height to use for initial render; useful for SSR.
|
|
15
|
-
* @default null
|
|
16
|
-
*/
|
|
17
|
-
defaultHeight?: number;
|
|
18
|
-
/**
|
|
19
|
-
* Default width to use for initial render; useful for SSR.
|
|
20
|
-
* @default null
|
|
21
|
-
*/
|
|
22
|
-
defaultWidth?: number;
|
|
23
|
-
/**
|
|
24
|
-
* If `true`, disable dynamic :height property.
|
|
25
|
-
* @default false
|
|
26
|
-
*/
|
|
27
|
-
disableHeight?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* If `true`, disable dynamic :width property.
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
disableWidth?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Nonce of the inlined stylesheet for Content Security Policy.
|
|
35
|
-
*/
|
|
36
|
-
nonce?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Callback to be invoked on-resize.
|
|
39
|
-
* @param {AutoSizerSize} size The grid's size.
|
|
40
|
-
*/
|
|
41
|
-
onResize?: (size: AutoSizerSize) => void;
|
|
42
|
-
}
|
|
43
|
-
declare const GridAutoSizer: React.ForwardRefExoticComponent<AutoSizerProps & React.RefAttributes<HTMLDivElement>>;
|
|
44
|
-
export { GridAutoSizer };
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["children", "defaultHeight", "defaultWidth", "disableHeight", "disableWidth", "nonce", "onResize", "style"];
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { unstable_useForkRef as useForkRef, unstable_ownerWindow as ownerWindow, unstable_useEventCallback as useEventCallback, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
7
|
-
import createDetectElementResize from '../lib/createDetectElementResize';
|
|
8
|
-
// TODO replace with https://caniuse.com/resizeobserver.
|
|
9
|
-
|
|
10
|
-
// Credit to https://github.com/bvaughn/react-virtualized/blob/master/source/AutoSizer/AutoSizer.js
|
|
11
|
-
// for the sources.
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const GridAutoSizer = /*#__PURE__*/React.forwardRef(function AutoSizer(props, ref) {
|
|
14
|
-
const {
|
|
15
|
-
children,
|
|
16
|
-
defaultHeight = null,
|
|
17
|
-
defaultWidth = null,
|
|
18
|
-
disableHeight = false,
|
|
19
|
-
disableWidth = false,
|
|
20
|
-
nonce,
|
|
21
|
-
onResize,
|
|
22
|
-
style
|
|
23
|
-
} = props,
|
|
24
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
25
|
-
const [state, setState] = React.useState({
|
|
26
|
-
height: defaultHeight,
|
|
27
|
-
width: defaultWidth
|
|
28
|
-
});
|
|
29
|
-
const rootRef = React.useRef(null);
|
|
30
|
-
const parentElement = React.useRef(null);
|
|
31
|
-
const handleResize = useEventCallback(() => {
|
|
32
|
-
// Guard against AutoSizer component being removed from the DOM immediately after being added.
|
|
33
|
-
// This can result in invalid style values which can result in NaN values if we don't handle them.
|
|
34
|
-
// See issue #150 for more context.
|
|
35
|
-
if (parentElement.current) {
|
|
36
|
-
const height = parentElement.current.offsetHeight || 0;
|
|
37
|
-
const width = parentElement.current.offsetWidth || 0;
|
|
38
|
-
const win = ownerWindow(parentElement.current);
|
|
39
|
-
const computedStyle = win.getComputedStyle(parentElement.current);
|
|
40
|
-
const paddingLeft = parseInt(computedStyle.paddingLeft, 10) || 0;
|
|
41
|
-
const paddingRight = parseInt(computedStyle.paddingRight, 10) || 0;
|
|
42
|
-
const paddingTop = parseInt(computedStyle.paddingTop, 10) || 0;
|
|
43
|
-
const paddingBottom = parseInt(computedStyle.paddingBottom, 10) || 0;
|
|
44
|
-
const newHeight = height - paddingTop - paddingBottom;
|
|
45
|
-
const newWidth = width - paddingLeft - paddingRight;
|
|
46
|
-
if (!disableHeight && state.height !== newHeight || !disableWidth && state.width !== newWidth) {
|
|
47
|
-
setState({
|
|
48
|
-
height: newHeight,
|
|
49
|
-
width: newWidth
|
|
50
|
-
});
|
|
51
|
-
if (onResize) {
|
|
52
|
-
onResize({
|
|
53
|
-
height: newHeight,
|
|
54
|
-
width: newWidth
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
useEnhancedEffect(() => {
|
|
61
|
-
var _parentElement$curren;
|
|
62
|
-
parentElement.current = rootRef.current.parentElement;
|
|
63
|
-
if (!parentElement) {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
const win = ownerWindow((_parentElement$curren = parentElement.current) != null ? _parentElement$curren : undefined);
|
|
67
|
-
const detectElementResize = createDetectElementResize(nonce, win);
|
|
68
|
-
detectElementResize.addResizeListener(parentElement.current, handleResize);
|
|
69
|
-
handleResize();
|
|
70
|
-
return () => {
|
|
71
|
-
detectElementResize.removeResizeListener(parentElement.current, handleResize);
|
|
72
|
-
};
|
|
73
|
-
}, [nonce, handleResize]);
|
|
74
|
-
const handleRef = useForkRef(rootRef, ref);
|
|
75
|
-
return /*#__PURE__*/_jsx("div", _extends({
|
|
76
|
-
ref: handleRef,
|
|
77
|
-
style: _extends({
|
|
78
|
-
flex: disableHeight ? 0 : '1 1 0px',
|
|
79
|
-
overflow: disableHeight ? 'visible' : 'auto'
|
|
80
|
-
}, style)
|
|
81
|
-
}, other, {
|
|
82
|
-
children: state.height === null && state.width === null ? null : children
|
|
83
|
-
}));
|
|
84
|
-
});
|
|
85
|
-
process.env.NODE_ENV !== "production" ? GridAutoSizer.propTypes = {
|
|
86
|
-
// ----------------------------- Warning --------------------------------
|
|
87
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
88
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
89
|
-
// ----------------------------------------------------------------------
|
|
90
|
-
/**
|
|
91
|
-
* Function responsible for rendering children.
|
|
92
|
-
* @param {AutoSizerSize} size The grid's size.
|
|
93
|
-
* @returns {React.ReactNode} The children to render.
|
|
94
|
-
*/
|
|
95
|
-
children: PropTypes.node,
|
|
96
|
-
/**
|
|
97
|
-
* Default height to use for initial render; useful for SSR.
|
|
98
|
-
* @default null
|
|
99
|
-
*/
|
|
100
|
-
defaultHeight: PropTypes.number,
|
|
101
|
-
/**
|
|
102
|
-
* Default width to use for initial render; useful for SSR.
|
|
103
|
-
* @default null
|
|
104
|
-
*/
|
|
105
|
-
defaultWidth: PropTypes.number,
|
|
106
|
-
/**
|
|
107
|
-
* If `true`, disable dynamic :height property.
|
|
108
|
-
* @default false
|
|
109
|
-
*/
|
|
110
|
-
disableHeight: PropTypes.bool,
|
|
111
|
-
/**
|
|
112
|
-
* If `true`, disable dynamic :width property.
|
|
113
|
-
* @default false
|
|
114
|
-
*/
|
|
115
|
-
disableWidth: PropTypes.bool,
|
|
116
|
-
/**
|
|
117
|
-
* Nonce of the inlined stylesheet for Content Security Policy.
|
|
118
|
-
*/
|
|
119
|
-
nonce: PropTypes.string,
|
|
120
|
-
/**
|
|
121
|
-
* Callback to be invoked on-resize.
|
|
122
|
-
* @param {AutoSizerSize} size The grid's size.
|
|
123
|
-
*/
|
|
124
|
-
onResize: PropTypes.func
|
|
125
|
-
} : void 0;
|
|
126
|
-
export { GridAutoSizer };
|