@mui/x-data-grid 7.23.2 β 7.23.3
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 -0
- package/DataGrid/DataGrid.js +3 -1
- package/components/GridRow.js +12 -1
- package/components/cell/GridActionsCell.js +8 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/components/columnSelection/GridHeaderCheckbox.js +1 -1
- package/components/virtualization/GridMainContainer.js +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +6 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/hooks/features/rows/useGridRowSpanning.js +13 -5
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/index.js +1 -1
- package/internals/utils/useProps.js +3 -0
- package/locales/koKR.js +36 -39
- package/models/gridSlotsComponentsProps.d.ts +10 -0
- package/models/props/DataGridProps.d.ts +1 -0
- package/modern/DataGrid/DataGrid.js +3 -1
- package/modern/components/GridRow.js +12 -1
- package/modern/components/cell/GridActionsCell.js +8 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/modern/components/columnSelection/GridHeaderCheckbox.js +1 -1
- package/modern/components/virtualization/GridMainContainer.js +1 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/modern/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/modern/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/modern/hooks/features/rows/useGridRowSpanning.js +13 -5
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/modern/index.js +1 -1
- package/modern/internals/utils/useProps.js +3 -0
- package/modern/locales/koKR.js +36 -39
- package/node/DataGrid/DataGrid.js +3 -1
- package/node/components/GridRow.js +12 -1
- package/node/components/cell/GridActionsCell.js +8 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
- package/node/components/columnSelection/GridHeaderCheckbox.js +1 -1
- package/node/components/virtualization/GridMainContainer.js +1 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +10 -3
- package/node/hooks/features/columnResize/gridColumnResizeApi.js +2 -1
- package/node/hooks/features/columnResize/useGridColumnResize.js +9 -4
- package/node/hooks/features/columns/gridColumnsUtils.js +2 -1
- package/node/hooks/features/rows/useGridRowSpanning.js +13 -5
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/node/index.js +1 -1
- package/node/internals/utils/useProps.js +3 -0
- package/node/locales/koKR.js +36 -39
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,54 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.23.3
|
|
7
|
+
|
|
8
|
+
_Dec 19, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights β¨:
|
|
11
|
+
|
|
12
|
+
- π Improve Korean (ko-KR) locale on the Data Grid
|
|
13
|
+
- π Bugfixes
|
|
14
|
+
|
|
15
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
16
|
+
@k-rajat19, @good-jinu.
|
|
17
|
+
Following are all team members who have contributed to this release:
|
|
18
|
+
@KenanYusuf, @MBilalShafi, @arminmeh, @flaviendelangle.
|
|
19
|
+
|
|
20
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
21
|
+
|
|
22
|
+
### Data Grid
|
|
23
|
+
|
|
24
|
+
#### `@mui/x-data-grid@7.23.3`
|
|
25
|
+
|
|
26
|
+
- [DataGrid] Allow passing custom props to `.main` element (#15919) @MBilalShafi
|
|
27
|
+
- [DataGrid] Consider `columnGroupHeaderHeight` prop in `getTotalHeaderHeight` method (#15927) @k-rajat19
|
|
28
|
+
- [DataGrid] Deprecate `indeterminateCheckboxAction` prop (#15862) @MBilalShafi
|
|
29
|
+
- [DataGrid] Fix `aria-label` value for group checkboxes (#15861) @MBilalShafi
|
|
30
|
+
- [DataGrid] Fix autosizing with virtualized columns (#15929) @k-rajat19
|
|
31
|
+
- [DataGrid] Round dimensions to avoid subpixel rendering error (#15873) @KenanYusuf
|
|
32
|
+
- [DataGrid] Toggle menu on click in `<GridActionsCell />` (#15871) @k-rajat19
|
|
33
|
+
- [DataGrid] Trigger row spanning computation on rows update (#15872) @MBilalShafi
|
|
34
|
+
- [l10n] Improve Korean (ko-KR) locale (#15906) @good-jinu
|
|
35
|
+
|
|
36
|
+
#### `@mui/x-data-grid-pro@7.23.3` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
37
|
+
|
|
38
|
+
Same changes as in `@mui/x-data-grid@7.23.3`.
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-data-grid-premium@7.23.3` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
41
|
+
|
|
42
|
+
Same changes as in `@mui/x-data-grid-pro@7.23.3`.
|
|
43
|
+
|
|
44
|
+
### Date and Time Pickers
|
|
45
|
+
|
|
46
|
+
#### `@mui/x-date-pickers@7.23.3`
|
|
47
|
+
|
|
48
|
+
- [pickers] Add verification to disable skipped hours in spring forward DST (#15918) @flaviendelangle
|
|
49
|
+
|
|
50
|
+
#### `@mui/x-date-pickers-pro@7.23.3` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
51
|
+
|
|
52
|
+
Same changes as in `@mui/x-date-pickers@7.23.3`.
|
|
53
|
+
|
|
6
54
|
## 7.23.2
|
|
7
55
|
|
|
8
56
|
_Dec 12, 2024_
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -38,7 +38,7 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
|
|
|
38
38
|
style: props.style,
|
|
39
39
|
sx: props.sx,
|
|
40
40
|
ref: ref
|
|
41
|
-
}, props.forwardedProps, {
|
|
41
|
+
}, props.forwardedProps, props.slotProps?.root, {
|
|
42
42
|
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {}), /*#__PURE__*/_jsx(GridFooterPlaceholder, {})]
|
|
43
43
|
}))
|
|
44
44
|
});
|
|
@@ -95,6 +95,7 @@ DataGridRaw.propTypes = {
|
|
|
95
95
|
*/
|
|
96
96
|
autosizeOptions: PropTypes.shape({
|
|
97
97
|
columns: PropTypes.arrayOf(PropTypes.string),
|
|
98
|
+
disableColumnVirtualization: PropTypes.bool,
|
|
98
99
|
expand: PropTypes.bool,
|
|
99
100
|
includeHeaders: PropTypes.bool,
|
|
100
101
|
includeOutliers: PropTypes.bool,
|
|
@@ -331,6 +332,7 @@ DataGridRaw.propTypes = {
|
|
|
331
332
|
* If `deselect`, it will deselect all the rows under it.
|
|
332
333
|
* Works only if `checkboxSelection` is enabled.
|
|
333
334
|
* @default "deselect"
|
|
335
|
+
* @deprecated `select` will be the default behavior from v8 onwards
|
|
334
336
|
*/
|
|
335
337
|
indeterminateCheckboxAction: PropTypes.oneOf(['deselect', 'select']),
|
|
336
338
|
/**
|
package/components/GridRow.js
CHANGED
|
@@ -25,6 +25,7 @@ import { GridScrollbarFillerCell as ScrollbarFiller } from "./GridScrollbarFille
|
|
|
25
25
|
import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
|
|
26
26
|
import { useGridConfiguration } from "../hooks/utils/useGridConfiguration.js";
|
|
27
27
|
import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
|
|
28
|
+
import { gridVirtualizationColumnEnabledSelector } from "../hooks/index.js";
|
|
28
29
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
30
|
function EmptyCell({
|
|
30
31
|
width
|
|
@@ -89,6 +90,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
89
90
|
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
90
91
|
const editing = apiRef.current.getRowMode(rowId) === GridRowModes.Edit;
|
|
91
92
|
const editable = rootProps.editMode === GridEditModes.Row;
|
|
93
|
+
const hasColumnVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
|
|
92
94
|
const hasFocusCell = focusedColumnIndex !== undefined;
|
|
93
95
|
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < renderContext.firstColumnIndex;
|
|
94
96
|
const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= renderContext.lastColumnIndex;
|
|
@@ -270,7 +272,16 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
270
272
|
if (hasVirtualFocusCellLeft) {
|
|
271
273
|
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, PinnedPosition.VIRTUAL));
|
|
272
274
|
}
|
|
273
|
-
|
|
275
|
+
let firstColumnIndex;
|
|
276
|
+
let lastColumnIndex;
|
|
277
|
+
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
278
|
+
firstColumnIndex = 0;
|
|
279
|
+
lastColumnIndex = visibleColumns.length;
|
|
280
|
+
} else {
|
|
281
|
+
firstColumnIndex = renderContext.firstColumnIndex;
|
|
282
|
+
lastColumnIndex = renderContext.lastColumnIndex;
|
|
283
|
+
}
|
|
284
|
+
for (let i = firstColumnIndex; i < lastColumnIndex; i += 1) {
|
|
274
285
|
const column = visibleColumns[i];
|
|
275
286
|
const indexInSection = i - pinnedColumns.left.length;
|
|
276
287
|
if (!column) {
|
|
@@ -90,6 +90,13 @@ function GridActionsCell(props) {
|
|
|
90
90
|
const hideMenu = () => {
|
|
91
91
|
setOpen(false);
|
|
92
92
|
};
|
|
93
|
+
const toggleMenu = () => {
|
|
94
|
+
if (open) {
|
|
95
|
+
hideMenu();
|
|
96
|
+
} else {
|
|
97
|
+
showMenu();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
93
100
|
const handleTouchRippleRef = index => instance => {
|
|
94
101
|
touchRippleRefs.current[index] = instance;
|
|
95
102
|
};
|
|
@@ -160,7 +167,7 @@ function GridActionsCell(props) {
|
|
|
160
167
|
"aria-controls": open ? menuId : undefined,
|
|
161
168
|
role: "menuitem",
|
|
162
169
|
size: "small",
|
|
163
|
-
onClick:
|
|
170
|
+
onClick: toggleMenu,
|
|
164
171
|
touchRippleRef: handleTouchRippleRef(buttonId),
|
|
165
172
|
tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1
|
|
166
173
|
}, rootProps.slotProps?.baseIconButton, {
|
|
@@ -79,8 +79,8 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
|
|
|
79
79
|
if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
80
80
|
return null;
|
|
81
81
|
}
|
|
82
|
-
const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
|
|
83
82
|
const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
|
|
83
|
+
const label = apiRef.current.getLocaleText(checked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
|
|
84
84
|
return /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
85
85
|
ref: handleRef,
|
|
86
86
|
tabIndex: tabIndex,
|
|
@@ -92,8 +92,8 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
|
|
|
92
92
|
React.useEffect(() => {
|
|
93
93
|
return apiRef.current.subscribeEvent('rowSelectionChange', handleSelectionChange);
|
|
94
94
|
}, [apiRef, handleSelectionChange]);
|
|
95
|
-
const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
|
|
96
95
|
const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
|
|
96
|
+
const label = apiRef.current.getLocaleText(checked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
|
|
97
97
|
return /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
98
98
|
ref: ref,
|
|
99
99
|
indeterminate: isIndeterminate,
|
|
@@ -30,7 +30,7 @@ export const GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
30
30
|
ownerState: rootProps,
|
|
31
31
|
className: props.className,
|
|
32
32
|
tabIndex: -1
|
|
33
|
-
}, ariaAttributes, {
|
|
33
|
+
}, ariaAttributes, rootProps.slotProps?.main, {
|
|
34
34
|
children: [/*#__PURE__*/_jsx(GridPanelAnchor, {
|
|
35
35
|
role: "presentation",
|
|
36
36
|
"data-id": "gridPanelAnchor"
|
|
@@ -47,7 +47,7 @@ export const useGridColumnHeaders = props => {
|
|
|
47
47
|
const isRtl = useRtl();
|
|
48
48
|
const rootProps = useGridRootProps();
|
|
49
49
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
50
|
-
const
|
|
50
|
+
const hasColumnVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
|
|
51
51
|
const columnGroupsModel = useGridSelector(apiRef, gridColumnGroupsUnwrappedModelSelector);
|
|
52
52
|
const columnPositions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
53
53
|
const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
|
|
@@ -87,8 +87,15 @@ export const useGridColumnHeaders = props => {
|
|
|
87
87
|
renderContext: currentContext = renderContext,
|
|
88
88
|
maxLastColumn = visibleColumns.length
|
|
89
89
|
} = params || {};
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
let firstColumnToRender;
|
|
91
|
+
let lastColumnToRender;
|
|
92
|
+
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
93
|
+
firstColumnToRender = 0;
|
|
94
|
+
lastColumnToRender = maxLastColumn;
|
|
95
|
+
} else {
|
|
96
|
+
firstColumnToRender = currentContext.firstColumnIndex;
|
|
97
|
+
lastColumnToRender = currentContext.lastColumnIndex;
|
|
98
|
+
}
|
|
92
99
|
const renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
|
|
93
100
|
return {
|
|
94
101
|
renderedColumns,
|
|
@@ -4,6 +4,7 @@ export declare const DEFAULT_GRID_AUTOSIZE_OPTIONS: {
|
|
|
4
4
|
includeOutliers: boolean;
|
|
5
5
|
outliersFactor: number;
|
|
6
6
|
expand: boolean;
|
|
7
|
+
disableColumnVirtualization: boolean;
|
|
7
8
|
};
|
|
8
9
|
export type GridAutosizeOptions = {
|
|
9
10
|
/**
|
|
@@ -30,6 +31,11 @@ export type GridAutosizeOptions = {
|
|
|
30
31
|
* @default false
|
|
31
32
|
*/
|
|
32
33
|
expand?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* If false, column virtualization is not disabled while resizing.
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
disableColumnVirtualization?: boolean;
|
|
33
39
|
};
|
|
34
40
|
/**
|
|
35
41
|
* The Resize API interface that is available in the grid `apiRef`.
|
|
@@ -7,4 +7,4 @@ export declare const columnResizeStateInitializer: GridStateInitializer;
|
|
|
7
7
|
* @requires useGridColumns (method, event)
|
|
8
8
|
* TODO: improve experience for last column
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridColumnResize: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "autosizeOptions" | "autosizeOnMount" | "disableAutosize" | "onColumnResize" | "onColumnWidthChange">) => void;
|
|
10
|
+
export declare const useGridColumnResize: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "autosizeOptions" | "autosizeOnMount" | "disableAutosize" | "onColumnResize" | "onColumnWidthChange" | "disableVirtualization">) => void;
|
|
@@ -458,6 +458,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
458
458
|
return;
|
|
459
459
|
}
|
|
460
460
|
apiRef.current.autosizeColumns(_extends({}, props.autosizeOptions, {
|
|
461
|
+
disableColumnVirtualization: false,
|
|
461
462
|
columns: [column.field]
|
|
462
463
|
}));
|
|
463
464
|
});
|
|
@@ -484,8 +485,10 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
484
485
|
options.columns = options.columns.filter(c => state.columnVisibilityModel[c] !== false);
|
|
485
486
|
const columns = options.columns.map(c => apiRef.current.state.columns.lookup[c]);
|
|
486
487
|
try {
|
|
487
|
-
|
|
488
|
-
|
|
488
|
+
if (!props.disableVirtualization && options.disableColumnVirtualization) {
|
|
489
|
+
apiRef.current.unstable_setColumnVirtualization(false);
|
|
490
|
+
await columnVirtualizationDisabled();
|
|
491
|
+
}
|
|
489
492
|
const widthByField = extractColumnWidths(apiRef, options, columns);
|
|
490
493
|
const newColumns = columns.map(column => _extends({}, column, {
|
|
491
494
|
width: widthByField[column.field],
|
|
@@ -517,10 +520,12 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
517
520
|
}
|
|
518
521
|
});
|
|
519
522
|
} finally {
|
|
520
|
-
|
|
523
|
+
if (!props.disableVirtualization) {
|
|
524
|
+
apiRef.current.unstable_setColumnVirtualization(true);
|
|
525
|
+
}
|
|
521
526
|
isAutosizingRef.current = false;
|
|
522
527
|
}
|
|
523
|
-
}, [apiRef, columnVirtualizationDisabled]);
|
|
528
|
+
}, [apiRef, columnVirtualizationDisabled, props.disableVirtualization]);
|
|
524
529
|
|
|
525
530
|
/**
|
|
526
531
|
* EFFECTS
|
|
@@ -53,4 +53,4 @@ export declare function getFirstNonSpannedColumnToRender({ firstColumnToRender,
|
|
|
53
53
|
lastRowToRender: number;
|
|
54
54
|
visibleRows: GridRowEntry[];
|
|
55
55
|
}): number;
|
|
56
|
-
export declare function getTotalHeaderHeight(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'columnHeaderHeight' | 'headerFilterHeight' | 'unstable_listView'>): number;
|
|
56
|
+
export declare function getTotalHeaderHeight(apiRef: React.MutableRefObject<GridApiCommunity>, props: Pick<DataGridProcessedProps, 'columnHeaderHeight' | 'headerFilterHeight' | 'unstable_listView' | 'columnGroupHeaderHeight'>): number;
|
|
@@ -319,6 +319,7 @@ export function getTotalHeaderHeight(apiRef, props) {
|
|
|
319
319
|
const maxDepth = gridColumnGroupsHeaderMaxDepthSelector(apiRef);
|
|
320
320
|
const isHeaderFilteringEnabled = gridHeaderFilteringEnabledSelector(apiRef);
|
|
321
321
|
const columnHeadersHeight = Math.floor(props.columnHeaderHeight * densityFactor);
|
|
322
|
+
const columnGroupHeadersHeight = Math.floor((props.columnGroupHeaderHeight ?? props.columnHeaderHeight) * densityFactor);
|
|
322
323
|
const filterHeadersHeight = isHeaderFilteringEnabled ? Math.floor((props.headerFilterHeight ?? props.columnHeaderHeight) * densityFactor) : 0;
|
|
323
|
-
return columnHeadersHeight
|
|
324
|
+
return columnHeadersHeight + columnGroupHeadersHeight * maxDepth + filterHeadersHeight;
|
|
324
325
|
}
|
|
@@ -6,6 +6,7 @@ import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSele
|
|
|
6
6
|
import { useGridVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
7
7
|
import { gridRenderContextSelector } from "../virtualization/gridVirtualizationSelectors.js";
|
|
8
8
|
import { useGridSelector } from "../../utils/useGridSelector.js";
|
|
9
|
+
import { gridRowTreeSelector } from "./gridRowsSelector.js";
|
|
9
10
|
import { getUnprocessedRange, isRowRangeUpdated, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
|
|
10
11
|
import { GRID_CHECKBOX_SELECTION_FIELD } from "../../../colDef/gridCheckboxSelectionColDef.js";
|
|
11
12
|
const EMPTY_STATE = {
|
|
@@ -35,7 +36,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
35
36
|
if (skippedFields.has(colDef.field)) {
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
|
-
for (let index = rangeToProcess.firstRowIndex; index
|
|
39
|
+
for (let index = rangeToProcess.firstRowIndex; index < rangeToProcess.lastRowIndex; index += 1) {
|
|
39
40
|
const row = visibleRows[index];
|
|
40
41
|
if (hiddenCells[row.id]?.[colDef.field]) {
|
|
41
42
|
continue;
|
|
@@ -142,7 +143,7 @@ export const rowSpanningStateInitializer = (state, props, apiRef) => {
|
|
|
142
143
|
}
|
|
143
144
|
const rangeToProcess = {
|
|
144
145
|
firstRowIndex: 0,
|
|
145
|
-
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS
|
|
146
|
+
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
|
|
146
147
|
};
|
|
147
148
|
const rows = rowIds.map(id => ({
|
|
148
149
|
id,
|
|
@@ -173,10 +174,11 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
173
174
|
} = useGridVisibleRows(apiRef, props);
|
|
174
175
|
const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
|
|
175
176
|
const colDefs = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
177
|
+
const tree = useGridSelector(apiRef, gridRowTreeSelector);
|
|
176
178
|
const processedRange = useLazyRef(() => {
|
|
177
179
|
return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
|
|
178
180
|
firstRowIndex: 0,
|
|
179
|
-
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS
|
|
181
|
+
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
|
|
180
182
|
} : EMPTY_RANGE;
|
|
181
183
|
});
|
|
182
184
|
const lastRange = React.useRef(EMPTY_RANGE);
|
|
@@ -204,7 +206,7 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
204
206
|
}
|
|
205
207
|
const rangeToProcess = getUnprocessedRange({
|
|
206
208
|
firstRowIndex: renderContext.firstRowIndex,
|
|
207
|
-
lastRowIndex: Math.min(renderContext.lastRowIndex
|
|
209
|
+
lastRowIndex: Math.min(renderContext.lastRowIndex, range.lastRowIndex + 1)
|
|
208
210
|
}, processedRange.current);
|
|
209
211
|
if (rangeToProcess === null) {
|
|
210
212
|
return;
|
|
@@ -237,11 +239,17 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
237
239
|
const prevRenderContext = React.useRef(renderContext);
|
|
238
240
|
const isFirstRender = React.useRef(true);
|
|
239
241
|
const shouldResetState = React.useRef(false);
|
|
242
|
+
const previousTree = React.useRef(tree);
|
|
240
243
|
React.useEffect(() => {
|
|
241
244
|
const firstRender = isFirstRender.current;
|
|
242
245
|
if (isFirstRender.current) {
|
|
243
246
|
isFirstRender.current = false;
|
|
244
247
|
}
|
|
248
|
+
if (tree !== previousTree.current) {
|
|
249
|
+
previousTree.current = tree;
|
|
250
|
+
updateRowSpanningState(true);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
245
253
|
if (range && lastRange.current && isRowRangeUpdated(range, lastRange.current)) {
|
|
246
254
|
lastRange.current = range;
|
|
247
255
|
shouldResetState.current = true;
|
|
@@ -255,5 +263,5 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
255
263
|
return;
|
|
256
264
|
}
|
|
257
265
|
updateRowSpanningState();
|
|
258
|
-
}, [updateRowSpanningState, renderContext, range, lastRange]);
|
|
266
|
+
}, [updateRowSpanningState, renderContext, range, lastRange, tree]);
|
|
259
267
|
};
|
|
@@ -92,10 +92,7 @@ export const useGridVirtualScroller = () => {
|
|
|
92
92
|
return undefined;
|
|
93
93
|
}
|
|
94
94
|
const initialRect = node.getBoundingClientRect();
|
|
95
|
-
let lastSize =
|
|
96
|
-
width: initialRect.width,
|
|
97
|
-
height: initialRect.height
|
|
98
|
-
};
|
|
95
|
+
let lastSize = roundDimensions(initialRect);
|
|
99
96
|
apiRef.current.publishEvent('resize', lastSize);
|
|
100
97
|
if (typeof ResizeObserver === 'undefined') {
|
|
101
98
|
return undefined;
|
|
@@ -105,10 +102,7 @@ export const useGridVirtualScroller = () => {
|
|
|
105
102
|
if (!entry) {
|
|
106
103
|
return;
|
|
107
104
|
}
|
|
108
|
-
const newSize =
|
|
109
|
-
width: entry.contentRect.width,
|
|
110
|
-
height: entry.contentRect.height
|
|
111
|
-
};
|
|
105
|
+
const newSize = roundDimensions(entry.contentRect);
|
|
112
106
|
if (newSize.width === lastSize.width && newSize.height === lastSize.height) {
|
|
113
107
|
return;
|
|
114
108
|
}
|
|
@@ -784,4 +778,13 @@ function bufferForDirection(isRtl, direction, rowBufferPx, columnBufferPx, verti
|
|
|
784
778
|
// eslint unable to figure out enum exhaustiveness
|
|
785
779
|
throw new Error('unreachable');
|
|
786
780
|
}
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// Round to avoid issues with subpixel rendering
|
|
784
|
+
// https://github.com/mui/mui-x/issues/15721
|
|
785
|
+
function roundDimensions(dimensions) {
|
|
786
|
+
return {
|
|
787
|
+
width: Math.round(dimensions.width * 10) / 10,
|
|
788
|
+
height: Math.round(dimensions.height * 10) / 10
|
|
789
|
+
};
|
|
787
790
|
}
|
package/index.js
CHANGED
|
@@ -2,6 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
|
|
3
3
|
/** Gathers props for the root element into a single `.forwardedProps` field */
|
|
4
4
|
function groupForwardedProps(props) {
|
|
5
|
+
if (props.slotProps?.root) {
|
|
6
|
+
return props;
|
|
7
|
+
}
|
|
5
8
|
const keys = Object.keys(props);
|
|
6
9
|
if (!keys.some(key => key.startsWith('aria-') || key.startsWith('data-'))) {
|
|
7
10
|
return props;
|
package/locales/koKR.js
CHANGED
|
@@ -30,15 +30,14 @@ const koKRGrid = {
|
|
|
30
30
|
toolbarExportPrint: 'νλ¦°νΈ',
|
|
31
31
|
toolbarExportExcel: 'Excelλ‘ λ΄λ³΄λ΄κΈ°',
|
|
32
32
|
// Columns management text
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
columnsManagementSearchTitle: 'κ²μ',
|
|
34
|
+
columnsManagementNoColumns: 'μ΄μ΄ μμ΅λλ€.',
|
|
35
|
+
columnsManagementShowHideAllText: 'λͺ¨λ 보기/μ¨κΈ°κΈ°',
|
|
36
|
+
columnsManagementReset: 'μ΄κΈ°ν',
|
|
37
|
+
columnsManagementDeleteIconLabel: 'μ κ±°',
|
|
39
38
|
// Filter panel text
|
|
40
39
|
filterPanelAddFilter: 'νν° μΆκ°',
|
|
41
|
-
|
|
40
|
+
filterPanelRemoveAll: 'λͺ¨λ μμ ',
|
|
42
41
|
filterPanelDeleteIconLabel: 'μμ ',
|
|
43
42
|
filterPanelLogicOperator: 'λ
Όλ¦¬ μ°μ°μ',
|
|
44
43
|
filterPanelOperator: 'μ°μ°μ',
|
|
@@ -49,9 +48,9 @@ const koKRGrid = {
|
|
|
49
48
|
filterPanelInputPlaceholder: 'κ° μ
λ ₯',
|
|
50
49
|
// Filter operators text
|
|
51
50
|
filterOperatorContains: 'ν¬ν¨νλ',
|
|
52
|
-
|
|
51
|
+
filterOperatorDoesNotContain: 'ν¬ν¨νμ§ μλ',
|
|
53
52
|
filterOperatorEquals: 'κ°μ΄ κ°μ',
|
|
54
|
-
|
|
53
|
+
filterOperatorDoesNotEqual: 'κ°μ΄ λ€λ₯Έ',
|
|
55
54
|
filterOperatorStartsWith: 'μμνλ',
|
|
56
55
|
filterOperatorEndsWith: 'λλλ',
|
|
57
56
|
filterOperatorIs: '~μΈ',
|
|
@@ -63,36 +62,34 @@ const koKRGrid = {
|
|
|
63
62
|
filterOperatorIsEmpty: 'κ°μ΄ μλ',
|
|
64
63
|
filterOperatorIsNotEmpty: 'κ°μ΄ μλ',
|
|
65
64
|
filterOperatorIsAnyOf: 'κ° μ€ νλμΈ',
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
'filterOperator=': '=',
|
|
66
|
+
'filterOperator!=': '!=',
|
|
67
|
+
'filterOperator>': '>',
|
|
68
|
+
'filterOperator>=': '>=',
|
|
69
|
+
'filterOperator<': '<',
|
|
70
|
+
'filterOperator<=': '<=',
|
|
73
71
|
// Header filter operators text
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
72
|
+
headerFilterOperatorContains: 'ν¬ν¨νλ',
|
|
73
|
+
headerFilterOperatorDoesNotContain: 'ν¬ν¨νμ§ μλ',
|
|
74
|
+
headerFilterOperatorEquals: 'κ°μ΄ κ°μ',
|
|
75
|
+
headerFilterOperatorDoesNotEqual: 'κ°μ΄ λ€λ₯Έ',
|
|
76
|
+
headerFilterOperatorStartsWith: 'μμνλ',
|
|
77
|
+
headerFilterOperatorEndsWith: 'λλλ',
|
|
78
|
+
headerFilterOperatorIs: '~μΈ',
|
|
79
|
+
headerFilterOperatorNot: '~μλ',
|
|
80
|
+
headerFilterOperatorAfter: 'λ μ΄ν',
|
|
81
|
+
headerFilterOperatorOnOrAfter: 'μ΄ν',
|
|
82
|
+
headerFilterOperatorBefore: 'λ μ΄μ ',
|
|
83
|
+
headerFilterOperatorOnOrBefore: 'μ΄μ ',
|
|
84
|
+
headerFilterOperatorIsEmpty: 'κ°μ΄ μλ',
|
|
85
|
+
headerFilterOperatorIsNotEmpty: 'κ°μ΄ μλ',
|
|
86
|
+
headerFilterOperatorIsAnyOf: 'κ° μ€ νλμΈ',
|
|
87
|
+
'headerFilterOperator=': 'κ°μ΄ κ°μ',
|
|
88
|
+
'headerFilterOperator!=': 'κ°μ΄ λ€λ₯Έ',
|
|
89
|
+
'headerFilterOperator>': 'λ ν°',
|
|
90
|
+
'headerFilterOperator>=': 'κ°κ±°λ λ ν°',
|
|
91
|
+
'headerFilterOperator<': 'λ μμ',
|
|
92
|
+
'headerFilterOperator<=': 'κ°κ±°λ λ μμ',
|
|
96
93
|
// Filter values text
|
|
97
94
|
filterValueAny: 'μ무κ°',
|
|
98
95
|
filterValueTrue: 'μ°Έ',
|
|
@@ -100,7 +97,7 @@ const koKRGrid = {
|
|
|
100
97
|
// Column menu text
|
|
101
98
|
columnMenuLabel: 'λ©λ΄',
|
|
102
99
|
columnMenuShowColumns: 'μ΄ νμ',
|
|
103
|
-
|
|
100
|
+
columnMenuManageColumns: 'μ΄ κ΄λ¦¬',
|
|
104
101
|
columnMenuFilter: 'νν°',
|
|
105
102
|
columnMenuHideColumn: 'μ΄ μ¨κΈ°κΈ°',
|
|
106
103
|
columnMenuUnsort: 'μ λ ¬ ν΄μ ',
|
|
@@ -32,6 +32,8 @@ import type { GridLoadingOverlayProps } from '../components/GridLoadingOverlay';
|
|
|
32
32
|
import type { GridRowCountProps } from '../components/GridRowCount';
|
|
33
33
|
import type { GridColumnHeaderSortIconProps } from '../components/columnHeaders/GridColumnHeaderSortIcon';
|
|
34
34
|
type DividerProps = {};
|
|
35
|
+
type RootProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
|
|
36
|
+
type MainProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
|
|
35
37
|
export interface BaseBadgePropsOverrides {
|
|
36
38
|
}
|
|
37
39
|
export interface BaseCheckboxPropsOverrides {
|
|
@@ -140,6 +142,14 @@ export interface GridSlotProps {
|
|
|
140
142
|
row: GridRowProps & RowPropsOverrides;
|
|
141
143
|
skeletonCell: GridSkeletonCellProps & SkeletonCellPropsOverrides;
|
|
142
144
|
toolbar: GridToolbarProps & ToolbarPropsOverrides;
|
|
145
|
+
/**
|
|
146
|
+
* Props passed to the `.main` (role="grid") element
|
|
147
|
+
*/
|
|
148
|
+
main: MainProps;
|
|
149
|
+
/**
|
|
150
|
+
* Props passed to the `.root` element
|
|
151
|
+
*/
|
|
152
|
+
root: RootProps;
|
|
143
153
|
}
|
|
144
154
|
/**
|
|
145
155
|
* Overridable components props dynamically passed to the component at rendering.
|
|
@@ -229,6 +229,7 @@ export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = an
|
|
|
229
229
|
* If `deselect`, it will deselect all the rows under it.
|
|
230
230
|
* Works only if `checkboxSelection` is enabled.
|
|
231
231
|
* @default "deselect"
|
|
232
|
+
* @deprecated `select` will be the default behavior from v8 onwards
|
|
232
233
|
*/
|
|
233
234
|
indeterminateCheckboxAction: 'select' | 'deselect';
|
|
234
235
|
/**
|
|
@@ -38,7 +38,7 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
|
|
|
38
38
|
style: props.style,
|
|
39
39
|
sx: props.sx,
|
|
40
40
|
ref: ref
|
|
41
|
-
}, props.forwardedProps, {
|
|
41
|
+
}, props.forwardedProps, props.slotProps?.root, {
|
|
42
42
|
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {}), /*#__PURE__*/_jsx(GridFooterPlaceholder, {})]
|
|
43
43
|
}))
|
|
44
44
|
});
|
|
@@ -95,6 +95,7 @@ DataGridRaw.propTypes = {
|
|
|
95
95
|
*/
|
|
96
96
|
autosizeOptions: PropTypes.shape({
|
|
97
97
|
columns: PropTypes.arrayOf(PropTypes.string),
|
|
98
|
+
disableColumnVirtualization: PropTypes.bool,
|
|
98
99
|
expand: PropTypes.bool,
|
|
99
100
|
includeHeaders: PropTypes.bool,
|
|
100
101
|
includeOutliers: PropTypes.bool,
|
|
@@ -331,6 +332,7 @@ DataGridRaw.propTypes = {
|
|
|
331
332
|
* If `deselect`, it will deselect all the rows under it.
|
|
332
333
|
* Works only if `checkboxSelection` is enabled.
|
|
333
334
|
* @default "deselect"
|
|
335
|
+
* @deprecated `select` will be the default behavior from v8 onwards
|
|
334
336
|
*/
|
|
335
337
|
indeterminateCheckboxAction: PropTypes.oneOf(['deselect', 'select']),
|
|
336
338
|
/**
|
|
@@ -25,6 +25,7 @@ import { GridScrollbarFillerCell as ScrollbarFiller } from "./GridScrollbarFille
|
|
|
25
25
|
import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
|
|
26
26
|
import { useGridConfiguration } from "../hooks/utils/useGridConfiguration.js";
|
|
27
27
|
import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
|
|
28
|
+
import { gridVirtualizationColumnEnabledSelector } from "../hooks/index.js";
|
|
28
29
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
29
30
|
function EmptyCell({
|
|
30
31
|
width
|
|
@@ -89,6 +90,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
89
90
|
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
90
91
|
const editing = apiRef.current.getRowMode(rowId) === GridRowModes.Edit;
|
|
91
92
|
const editable = rootProps.editMode === GridEditModes.Row;
|
|
93
|
+
const hasColumnVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
|
|
92
94
|
const hasFocusCell = focusedColumnIndex !== undefined;
|
|
93
95
|
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < renderContext.firstColumnIndex;
|
|
94
96
|
const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= renderContext.lastColumnIndex;
|
|
@@ -270,7 +272,16 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
270
272
|
if (hasVirtualFocusCellLeft) {
|
|
271
273
|
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, PinnedPosition.VIRTUAL));
|
|
272
274
|
}
|
|
273
|
-
|
|
275
|
+
let firstColumnIndex;
|
|
276
|
+
let lastColumnIndex;
|
|
277
|
+
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
278
|
+
firstColumnIndex = 0;
|
|
279
|
+
lastColumnIndex = visibleColumns.length;
|
|
280
|
+
} else {
|
|
281
|
+
firstColumnIndex = renderContext.firstColumnIndex;
|
|
282
|
+
lastColumnIndex = renderContext.lastColumnIndex;
|
|
283
|
+
}
|
|
284
|
+
for (let i = firstColumnIndex; i < lastColumnIndex; i += 1) {
|
|
274
285
|
const column = visibleColumns[i];
|
|
275
286
|
const indexInSection = i - pinnedColumns.left.length;
|
|
276
287
|
if (!column) {
|
|
@@ -90,6 +90,13 @@ function GridActionsCell(props) {
|
|
|
90
90
|
const hideMenu = () => {
|
|
91
91
|
setOpen(false);
|
|
92
92
|
};
|
|
93
|
+
const toggleMenu = () => {
|
|
94
|
+
if (open) {
|
|
95
|
+
hideMenu();
|
|
96
|
+
} else {
|
|
97
|
+
showMenu();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
93
100
|
const handleTouchRippleRef = index => instance => {
|
|
94
101
|
touchRippleRefs.current[index] = instance;
|
|
95
102
|
};
|
|
@@ -160,7 +167,7 @@ function GridActionsCell(props) {
|
|
|
160
167
|
"aria-controls": open ? menuId : undefined,
|
|
161
168
|
role: "menuitem",
|
|
162
169
|
size: "small",
|
|
163
|
-
onClick:
|
|
170
|
+
onClick: toggleMenu,
|
|
164
171
|
touchRippleRef: handleTouchRippleRef(buttonId),
|
|
165
172
|
tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1
|
|
166
173
|
}, rootProps.slotProps?.baseIconButton, {
|