@mui/x-data-grid 7.23.1 → 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 +129 -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/panel/GridColumnsPanel.js +1 -2
- 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/overlays/useGridOverlays.js +3 -1
- package/hooks/features/rows/useGridRowSpanning.js +13 -5
- package/hooks/features/sorting/gridSortingSelector.d.ts +7 -2
- package/hooks/features/sorting/gridSortingSelector.js +11 -0
- package/hooks/features/sorting/index.d.ts +2 -1
- package/hooks/features/sorting/index.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/internals/utils/useProps.js +3 -0
- package/locales/koKR.js +36 -39
- package/locales/roRO.js +9 -10
- package/locales/trTR.js +3 -4
- 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/panel/GridColumnsPanel.js +1 -2
- 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/overlays/useGridOverlays.js +3 -1
- package/modern/hooks/features/rows/useGridRowSpanning.js +13 -5
- package/modern/hooks/features/sorting/gridSortingSelector.js +11 -0
- package/modern/hooks/features/sorting/index.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/useProps.js +3 -0
- package/modern/locales/koKR.js +36 -39
- package/modern/locales/roRO.js +9 -10
- package/modern/locales/trTR.js +3 -4
- 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/panel/GridColumnsPanel.js +1 -2
- 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/overlays/useGridOverlays.js +3 -1
- package/node/hooks/features/rows/useGridRowSpanning.js +13 -5
- package/node/hooks/features/sorting/gridSortingSelector.js +12 -1
- package/node/hooks/features/sorting/index.js +24 -16
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +11 -8
- package/node/index.js +1 -1
- package/node/internals/index.js +8 -0
- package/node/internals/utils/useProps.js +3 -0
- package/node/locales/koKR.js +36 -39
- package/node/locales/roRO.js +9 -10
- package/node/locales/trTR.js +3 -4
- package/package.json +1 -1
package/modern/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: '정렬 해제',
|
package/modern/locales/roRO.js
CHANGED
|
@@ -30,12 +30,11 @@ const roROGrid = {
|
|
|
30
30
|
toolbarExportPrint: 'Printare',
|
|
31
31
|
toolbarExportExcel: 'Download în format Excel',
|
|
32
32
|
// Columns management text
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
columnsManagementSearchTitle: 'Caută',
|
|
34
|
+
columnsManagementNoColumns: 'Nicio coloană',
|
|
35
|
+
columnsManagementShowHideAllText: 'Arată/Ascunde tot',
|
|
36
|
+
columnsManagementReset: 'Resetează',
|
|
37
|
+
columnsManagementDeleteIconLabel: 'Șterge',
|
|
39
38
|
// Filter panel text
|
|
40
39
|
filterPanelAddFilter: 'Adăugare filtru',
|
|
41
40
|
filterPanelRemoveAll: 'Șterge tot',
|
|
@@ -49,9 +48,9 @@ const roROGrid = {
|
|
|
49
48
|
filterPanelInputPlaceholder: 'Filtrare valoare',
|
|
50
49
|
// Filter operators text
|
|
51
50
|
filterOperatorContains: 'conține',
|
|
52
|
-
|
|
51
|
+
filterOperatorDoesNotContain: 'nu conține',
|
|
53
52
|
filterOperatorEquals: 'este egal cu',
|
|
54
|
-
|
|
53
|
+
filterOperatorDoesNotEqual: 'nu este egal cu',
|
|
55
54
|
filterOperatorStartsWith: 'începe cu',
|
|
56
55
|
filterOperatorEndsWith: 'se termină cu',
|
|
57
56
|
filterOperatorIs: 'este',
|
|
@@ -71,9 +70,9 @@ const roROGrid = {
|
|
|
71
70
|
'filterOperator<=': '<=',
|
|
72
71
|
// Header filter operators text
|
|
73
72
|
headerFilterOperatorContains: 'Conține',
|
|
74
|
-
|
|
73
|
+
headerFilterOperatorDoesNotContain: 'Nu conține',
|
|
75
74
|
headerFilterOperatorEquals: 'Egal cu',
|
|
76
|
-
|
|
75
|
+
headerFilterOperatorDoesNotEqual: 'Nu este egal cu',
|
|
77
76
|
headerFilterOperatorStartsWith: 'Începe cu',
|
|
78
77
|
headerFilterOperatorEndsWith: 'Se termină cu',
|
|
79
78
|
headerFilterOperatorIs: 'Este',
|
package/modern/locales/trTR.js
CHANGED
|
@@ -34,8 +34,7 @@ const trTRGrid = {
|
|
|
34
34
|
columnsManagementNoColumns: 'Kolon yok',
|
|
35
35
|
columnsManagementShowHideAllText: 'Hepsini Göster/Gizle',
|
|
36
36
|
columnsManagementReset: 'Sıfırla',
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
columnsManagementDeleteIconLabel: 'Temizle',
|
|
39
38
|
// Filter panel text
|
|
40
39
|
filterPanelAddFilter: 'Filtre Ekle',
|
|
41
40
|
filterPanelRemoveAll: 'Hepsini kaldır',
|
|
@@ -49,9 +48,9 @@ const trTRGrid = {
|
|
|
49
48
|
filterPanelInputPlaceholder: 'Filtre değeri',
|
|
50
49
|
// Filter operators text
|
|
51
50
|
filterOperatorContains: 'içerir',
|
|
52
|
-
|
|
51
|
+
filterOperatorDoesNotContain: 'içermiyor',
|
|
53
52
|
filterOperatorEquals: 'eşittir',
|
|
54
|
-
|
|
53
|
+
filterOperatorDoesNotEqual: 'eşit değil',
|
|
55
54
|
filterOperatorStartsWith: 'ile başlar',
|
|
56
55
|
filterOperatorEndsWith: 'ile biter',
|
|
57
56
|
filterOperatorIs: 'eşittir',
|
|
@@ -45,7 +45,7 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
|
|
|
45
45
|
style: props.style,
|
|
46
46
|
sx: props.sx,
|
|
47
47
|
ref: ref
|
|
48
|
-
}, props.forwardedProps, {
|
|
48
|
+
}, props.forwardedProps, props.slotProps?.root, {
|
|
49
49
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridHeader, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridBody, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridFooterPlaceholder, {})]
|
|
50
50
|
}))
|
|
51
51
|
});
|
|
@@ -102,6 +102,7 @@ DataGridRaw.propTypes = {
|
|
|
102
102
|
*/
|
|
103
103
|
autosizeOptions: _propTypes.default.shape({
|
|
104
104
|
columns: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
105
|
+
disableColumnVirtualization: _propTypes.default.bool,
|
|
105
106
|
expand: _propTypes.default.bool,
|
|
106
107
|
includeHeaders: _propTypes.default.bool,
|
|
107
108
|
includeOutliers: _propTypes.default.bool,
|
|
@@ -338,6 +339,7 @@ DataGridRaw.propTypes = {
|
|
|
338
339
|
* If `deselect`, it will deselect all the rows under it.
|
|
339
340
|
* Works only if `checkboxSelection` is enabled.
|
|
340
341
|
* @default "deselect"
|
|
342
|
+
* @deprecated `select` will be the default behavior from v8 onwards
|
|
341
343
|
*/
|
|
342
344
|
indeterminateCheckboxAction: _propTypes.default.oneOf(['deselect', 'select']),
|
|
343
345
|
/**
|
|
@@ -32,6 +32,7 @@ var _GridScrollbarFillerCell = require("./GridScrollbarFillerCell");
|
|
|
32
32
|
var _getPinnedCellOffset = require("../internals/utils/getPinnedCellOffset");
|
|
33
33
|
var _useGridConfiguration = require("../hooks/utils/useGridConfiguration");
|
|
34
34
|
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
35
|
+
var _hooks = require("../hooks");
|
|
35
36
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
36
37
|
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
37
38
|
function EmptyCell({
|
|
@@ -97,6 +98,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
97
98
|
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
98
99
|
const editing = apiRef.current.getRowMode(rowId) === _gridEditRowModel.GridRowModes.Edit;
|
|
99
100
|
const editable = rootProps.editMode === _gridEditRowModel.GridEditModes.Row;
|
|
101
|
+
const hasColumnVirtualization = (0, _useGridSelector.useGridSelector)(apiRef, _hooks.gridVirtualizationColumnEnabledSelector);
|
|
100
102
|
const hasFocusCell = focusedColumnIndex !== undefined;
|
|
101
103
|
const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < renderContext.firstColumnIndex;
|
|
102
104
|
const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= renderContext.lastColumnIndex;
|
|
@@ -278,7 +280,16 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
278
280
|
if (hasVirtualFocusCellLeft) {
|
|
279
281
|
cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, _GridCell.PinnedPosition.VIRTUAL));
|
|
280
282
|
}
|
|
281
|
-
|
|
283
|
+
let firstColumnIndex;
|
|
284
|
+
let lastColumnIndex;
|
|
285
|
+
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
286
|
+
firstColumnIndex = 0;
|
|
287
|
+
lastColumnIndex = visibleColumns.length;
|
|
288
|
+
} else {
|
|
289
|
+
firstColumnIndex = renderContext.firstColumnIndex;
|
|
290
|
+
lastColumnIndex = renderContext.lastColumnIndex;
|
|
291
|
+
}
|
|
292
|
+
for (let i = firstColumnIndex; i < lastColumnIndex; i += 1) {
|
|
282
293
|
const column = visibleColumns[i];
|
|
283
294
|
const indexInSection = i - pinnedColumns.left.length;
|
|
284
295
|
if (!column) {
|
|
@@ -99,6 +99,13 @@ function GridActionsCell(props) {
|
|
|
99
99
|
const hideMenu = () => {
|
|
100
100
|
setOpen(false);
|
|
101
101
|
};
|
|
102
|
+
const toggleMenu = () => {
|
|
103
|
+
if (open) {
|
|
104
|
+
hideMenu();
|
|
105
|
+
} else {
|
|
106
|
+
showMenu();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
102
109
|
const handleTouchRippleRef = index => instance => {
|
|
103
110
|
touchRippleRefs.current[index] = instance;
|
|
104
111
|
};
|
|
@@ -169,7 +176,7 @@ function GridActionsCell(props) {
|
|
|
169
176
|
"aria-controls": open ? menuId : undefined,
|
|
170
177
|
role: "menuitem",
|
|
171
178
|
size: "small",
|
|
172
|
-
onClick:
|
|
179
|
+
onClick: toggleMenu,
|
|
173
180
|
touchRippleRef: handleTouchRippleRef(buttonId),
|
|
174
181
|
tabIndex: focusedButtonIndex === iconButtons.length ? tabIndex : -1
|
|
175
182
|
}, rootProps.slotProps?.baseIconButton, {
|
|
@@ -87,8 +87,8 @@ const GridCellCheckboxForwardRef = exports.GridCellCheckboxForwardRef = /*#__PUR
|
|
|
87
87
|
if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
-
const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
|
|
91
90
|
const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
|
|
91
|
+
const label = apiRef.current.getLocaleText(checked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
|
|
92
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseCheckbox, (0, _extends2.default)({
|
|
93
93
|
ref: handleRef,
|
|
94
94
|
tabIndex: tabIndex,
|
|
@@ -100,8 +100,8 @@ const GridHeaderCheckbox = exports.GridHeaderCheckbox = /*#__PURE__*/React.forwa
|
|
|
100
100
|
React.useEffect(() => {
|
|
101
101
|
return apiRef.current.subscribeEvent('rowSelectionChange', handleSelectionChange);
|
|
102
102
|
}, [apiRef, handleSelectionChange]);
|
|
103
|
-
const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
|
|
104
103
|
const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
|
|
104
|
+
const label = apiRef.current.getLocaleText(checked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
|
|
105
105
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseCheckbox, (0, _extends2.default)({
|
|
106
106
|
ref: ref,
|
|
107
107
|
indeterminate: isIndeterminate,
|
|
@@ -10,13 +10,12 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _GridPanelWrapper = require("./GridPanelWrapper");
|
|
13
|
-
var _columnsManagement = require("../columnsManagement");
|
|
14
13
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
15
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
15
|
function GridColumnsPanel(props) {
|
|
17
16
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
18
17
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridPanelWrapper.GridPanelWrapper, (0, _extends2.default)({}, props, {
|
|
19
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
18
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnsManagement, (0, _extends2.default)({}, rootProps.slotProps?.columnsManagement))
|
|
20
19
|
}));
|
|
21
20
|
}
|
|
22
21
|
process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
@@ -38,7 +38,7 @@ const GridMainContainer = exports.GridMainContainer = /*#__PURE__*/React.forward
|
|
|
38
38
|
ownerState: rootProps,
|
|
39
39
|
className: props.className,
|
|
40
40
|
tabIndex: -1
|
|
41
|
-
}, ariaAttributes, {
|
|
41
|
+
}, ariaAttributes, rootProps.slotProps?.main, {
|
|
42
42
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelAnchor, {
|
|
43
43
|
role: "presentation",
|
|
44
44
|
"data-id": "gridPanelAnchor"
|
|
@@ -55,7 +55,7 @@ const useGridColumnHeaders = props => {
|
|
|
55
55
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
56
56
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
57
57
|
const dimensions = (0, _utils.useGridSelector)(apiRef, _dimensions.gridDimensionsSelector);
|
|
58
|
-
const
|
|
58
|
+
const hasColumnVirtualization = (0, _utils.useGridSelector)(apiRef, _virtualization.gridVirtualizationColumnEnabledSelector);
|
|
59
59
|
const columnGroupsModel = (0, _utils.useGridSelector)(apiRef, _gridColumnGroupsSelector.gridColumnGroupsUnwrappedModelSelector);
|
|
60
60
|
const columnPositions = (0, _utils.useGridSelector)(apiRef, _columns.gridColumnPositionsSelector);
|
|
61
61
|
const renderContext = (0, _utils.useGridSelector)(apiRef, _virtualization.gridRenderContextColumnsSelector);
|
|
@@ -95,8 +95,15 @@ const useGridColumnHeaders = props => {
|
|
|
95
95
|
renderContext: currentContext = renderContext,
|
|
96
96
|
maxLastColumn = visibleColumns.length
|
|
97
97
|
} = params || {};
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
let firstColumnToRender;
|
|
99
|
+
let lastColumnToRender;
|
|
100
|
+
if (!rootProps.disableVirtualization && !hasColumnVirtualization) {
|
|
101
|
+
firstColumnToRender = 0;
|
|
102
|
+
lastColumnToRender = maxLastColumn;
|
|
103
|
+
} else {
|
|
104
|
+
firstColumnToRender = currentContext.firstColumnIndex;
|
|
105
|
+
lastColumnToRender = currentContext.lastColumnIndex;
|
|
106
|
+
}
|
|
100
107
|
const renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
|
|
101
108
|
return {
|
|
102
109
|
renderedColumns,
|
|
@@ -467,6 +467,7 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
apiRef.current.autosizeColumns((0, _extends2.default)({}, props.autosizeOptions, {
|
|
470
|
+
disableColumnVirtualization: false,
|
|
470
471
|
columns: [column.field]
|
|
471
472
|
}));
|
|
472
473
|
});
|
|
@@ -493,8 +494,10 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
493
494
|
options.columns = options.columns.filter(c => state.columnVisibilityModel[c] !== false);
|
|
494
495
|
const columns = options.columns.map(c => apiRef.current.state.columns.lookup[c]);
|
|
495
496
|
try {
|
|
496
|
-
|
|
497
|
-
|
|
497
|
+
if (!props.disableVirtualization && options.disableColumnVirtualization) {
|
|
498
|
+
apiRef.current.unstable_setColumnVirtualization(false);
|
|
499
|
+
await columnVirtualizationDisabled();
|
|
500
|
+
}
|
|
498
501
|
const widthByField = extractColumnWidths(apiRef, options, columns);
|
|
499
502
|
const newColumns = columns.map(column => (0, _extends2.default)({}, column, {
|
|
500
503
|
width: widthByField[column.field],
|
|
@@ -526,10 +529,12 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
526
529
|
}
|
|
527
530
|
});
|
|
528
531
|
} finally {
|
|
529
|
-
|
|
532
|
+
if (!props.disableVirtualization) {
|
|
533
|
+
apiRef.current.unstable_setColumnVirtualization(true);
|
|
534
|
+
}
|
|
530
535
|
isAutosizingRef.current = false;
|
|
531
536
|
}
|
|
532
|
-
}, [apiRef, columnVirtualizationDisabled]);
|
|
537
|
+
}, [apiRef, columnVirtualizationDisabled, props.disableVirtualization]);
|
|
533
538
|
|
|
534
539
|
/**
|
|
535
540
|
* EFFECTS
|
|
@@ -334,6 +334,7 @@ function getTotalHeaderHeight(apiRef, props) {
|
|
|
334
334
|
const maxDepth = (0, _gridColumnGroupsSelector.gridColumnGroupsHeaderMaxDepthSelector)(apiRef);
|
|
335
335
|
const isHeaderFilteringEnabled = (0, _gridHeaderFilteringSelectors.gridHeaderFilteringEnabledSelector)(apiRef);
|
|
336
336
|
const columnHeadersHeight = Math.floor(props.columnHeaderHeight * densityFactor);
|
|
337
|
+
const columnGroupHeadersHeight = Math.floor((props.columnGroupHeaderHeight ?? props.columnHeaderHeight) * densityFactor);
|
|
337
338
|
const filterHeadersHeight = isHeaderFilteringEnabled ? Math.floor((props.headerFilterHeight ?? props.columnHeaderHeight) * densityFactor) : 0;
|
|
338
|
-
return columnHeadersHeight
|
|
339
|
+
return columnHeadersHeight + columnGroupHeadersHeight * maxDepth + filterHeadersHeight;
|
|
339
340
|
}
|
|
@@ -9,6 +9,7 @@ var _useGridApiContext = require("../../utils/useGridApiContext");
|
|
|
9
9
|
var _useGridRootProps = require("../../utils/useGridRootProps");
|
|
10
10
|
var _filter = require("../filter");
|
|
11
11
|
var _rows = require("../rows");
|
|
12
|
+
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
12
13
|
/**
|
|
13
14
|
* Uses the grid state to determine which overlay to display.
|
|
14
15
|
* Returns the active overlay type and the active loading overlay variant.
|
|
@@ -18,7 +19,8 @@ const useGridOverlays = () => {
|
|
|
18
19
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
19
20
|
const totalRowCount = (0, _utils.useGridSelector)(apiRef, _rows.gridRowCountSelector);
|
|
20
21
|
const visibleRowCount = (0, _utils.useGridSelector)(apiRef, _filter.gridExpandedRowCountSelector);
|
|
21
|
-
const
|
|
22
|
+
const pinnedRowsCount = (0, _utils.useGridSelector)(apiRef, _gridRowsSelector.gridPinnedRowsCountSelector);
|
|
23
|
+
const noRows = totalRowCount === 0 && pinnedRowsCount === 0;
|
|
22
24
|
const loading = (0, _utils.useGridSelector)(apiRef, _rows.gridRowsLoadingSelector);
|
|
23
25
|
const showNoRowsOverlay = !loading && noRows;
|
|
24
26
|
const showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
|
|
@@ -14,6 +14,7 @@ var _gridColumnsSelector = require("../columns/gridColumnsSelector");
|
|
|
14
14
|
var _useGridVisibleRows = require("../../utils/useGridVisibleRows");
|
|
15
15
|
var _gridVirtualizationSelectors = require("../virtualization/gridVirtualizationSelectors");
|
|
16
16
|
var _useGridSelector = require("../../utils/useGridSelector");
|
|
17
|
+
var _gridRowsSelector = require("./gridRowsSelector");
|
|
17
18
|
var _gridRowSpanningUtils = require("./gridRowSpanningUtils");
|
|
18
19
|
var _gridCheckboxSelectionColDef = require("../../../colDef/gridCheckboxSelectionColDef");
|
|
19
20
|
const EMPTY_STATE = {
|
|
@@ -43,7 +44,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
43
44
|
if (skippedFields.has(colDef.field)) {
|
|
44
45
|
return;
|
|
45
46
|
}
|
|
46
|
-
for (let index = rangeToProcess.firstRowIndex; index
|
|
47
|
+
for (let index = rangeToProcess.firstRowIndex; index < rangeToProcess.lastRowIndex; index += 1) {
|
|
47
48
|
const row = visibleRows[index];
|
|
48
49
|
if (hiddenCells[row.id]?.[colDef.field]) {
|
|
49
50
|
continue;
|
|
@@ -150,7 +151,7 @@ const rowSpanningStateInitializer = (state, props, apiRef) => {
|
|
|
150
151
|
}
|
|
151
152
|
const rangeToProcess = {
|
|
152
153
|
firstRowIndex: 0,
|
|
153
|
-
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS
|
|
154
|
+
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
|
|
154
155
|
};
|
|
155
156
|
const rows = rowIds.map(id => ({
|
|
156
157
|
id,
|
|
@@ -182,10 +183,11 @@ const useGridRowSpanning = (apiRef, props) => {
|
|
|
182
183
|
} = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, props);
|
|
183
184
|
const renderContext = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridRenderContextSelector);
|
|
184
185
|
const colDefs = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector);
|
|
186
|
+
const tree = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowTreeSelector);
|
|
185
187
|
const processedRange = (0, _useLazyRef.default)(() => {
|
|
186
188
|
return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
|
|
187
189
|
firstRowIndex: 0,
|
|
188
|
-
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS
|
|
190
|
+
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
|
|
189
191
|
} : EMPTY_RANGE;
|
|
190
192
|
});
|
|
191
193
|
const lastRange = React.useRef(EMPTY_RANGE);
|
|
@@ -213,7 +215,7 @@ const useGridRowSpanning = (apiRef, props) => {
|
|
|
213
215
|
}
|
|
214
216
|
const rangeToProcess = (0, _gridRowSpanningUtils.getUnprocessedRange)({
|
|
215
217
|
firstRowIndex: renderContext.firstRowIndex,
|
|
216
|
-
lastRowIndex: Math.min(renderContext.lastRowIndex
|
|
218
|
+
lastRowIndex: Math.min(renderContext.lastRowIndex, range.lastRowIndex + 1)
|
|
217
219
|
}, processedRange.current);
|
|
218
220
|
if (rangeToProcess === null) {
|
|
219
221
|
return;
|
|
@@ -246,11 +248,17 @@ const useGridRowSpanning = (apiRef, props) => {
|
|
|
246
248
|
const prevRenderContext = React.useRef(renderContext);
|
|
247
249
|
const isFirstRender = React.useRef(true);
|
|
248
250
|
const shouldResetState = React.useRef(false);
|
|
251
|
+
const previousTree = React.useRef(tree);
|
|
249
252
|
React.useEffect(() => {
|
|
250
253
|
const firstRender = isFirstRender.current;
|
|
251
254
|
if (isFirstRender.current) {
|
|
252
255
|
isFirstRender.current = false;
|
|
253
256
|
}
|
|
257
|
+
if (tree !== previousTree.current) {
|
|
258
|
+
previousTree.current = tree;
|
|
259
|
+
updateRowSpanningState(true);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
254
262
|
if (range && lastRange.current && (0, _gridRowSpanningUtils.isRowRangeUpdated)(range, lastRange.current)) {
|
|
255
263
|
lastRange.current = range;
|
|
256
264
|
shouldResetState.current = true;
|
|
@@ -264,6 +272,6 @@ const useGridRowSpanning = (apiRef, props) => {
|
|
|
264
272
|
return;
|
|
265
273
|
}
|
|
266
274
|
updateRowSpanningState();
|
|
267
|
-
}, [updateRowSpanningState, renderContext, range, lastRange]);
|
|
275
|
+
}, [updateRowSpanningState, renderContext, range, lastRange, tree]);
|
|
268
276
|
};
|
|
269
277
|
exports.useGridRowSpanning = useGridRowSpanning;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.gridSortedRowIdsSelector = exports.gridSortedRowEntriesSelector = exports.gridSortModelSelector = exports.gridSortColumnLookupSelector = void 0;
|
|
6
|
+
exports.gridSortedRowIndexLookupSelector = exports.gridSortedRowIdsSelector = exports.gridSortedRowEntriesSelector = exports.gridSortModelSelector = exports.gridSortColumnLookupSelector = void 0;
|
|
7
7
|
var _createSelector = require("../../../utils/createSelector");
|
|
8
8
|
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
9
9
|
var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
@@ -61,4 +61,15 @@ const gridSortColumnLookupSelector = exports.gridSortColumnLookupSelector = (0,
|
|
|
61
61
|
return res;
|
|
62
62
|
}, {});
|
|
63
63
|
return result;
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @category Sorting
|
|
68
|
+
* @ignore - do not document.
|
|
69
|
+
*/
|
|
70
|
+
const gridSortedRowIndexLookupSelector = exports.gridSortedRowIndexLookupSelector = (0, _createSelector.createSelectorMemoized)(gridSortedRowIdsSelector, sortedIds => {
|
|
71
|
+
return sortedIds.reduce((acc, id, index) => {
|
|
72
|
+
acc[id] = index;
|
|
73
|
+
return acc;
|
|
74
|
+
}, Object.create(null));
|
|
64
75
|
});
|
|
@@ -3,11 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
gridDateComparator: true,
|
|
8
|
-
gridNumberComparator: true,
|
|
9
|
-
gridStringOrNumberComparator: true
|
|
10
|
-
};
|
|
11
6
|
Object.defineProperty(exports, "gridDateComparator", {
|
|
12
7
|
enumerable: true,
|
|
13
8
|
get: function () {
|
|
@@ -20,6 +15,30 @@ Object.defineProperty(exports, "gridNumberComparator", {
|
|
|
20
15
|
return _gridSortingUtils.gridNumberComparator;
|
|
21
16
|
}
|
|
22
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "gridSortColumnLookupSelector", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _gridSortingSelector.gridSortColumnLookupSelector;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "gridSortModelSelector", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _gridSortingSelector.gridSortModelSelector;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "gridSortedRowEntriesSelector", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _gridSortingSelector.gridSortedRowEntriesSelector;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "gridSortedRowIdsSelector", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _gridSortingSelector.gridSortedRowIdsSelector;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
23
42
|
Object.defineProperty(exports, "gridStringOrNumberComparator", {
|
|
24
43
|
enumerable: true,
|
|
25
44
|
get: function () {
|
|
@@ -27,15 +46,4 @@ Object.defineProperty(exports, "gridStringOrNumberComparator", {
|
|
|
27
46
|
}
|
|
28
47
|
});
|
|
29
48
|
var _gridSortingSelector = require("./gridSortingSelector");
|
|
30
|
-
Object.keys(_gridSortingSelector).forEach(function (key) {
|
|
31
|
-
if (key === "default" || key === "__esModule") return;
|
|
32
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
33
|
-
if (key in exports && exports[key] === _gridSortingSelector[key]) return;
|
|
34
|
-
Object.defineProperty(exports, key, {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function () {
|
|
37
|
-
return _gridSortingSelector[key];
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
49
|
var _gridSortingUtils = require("./gridSortingUtils");
|
|
@@ -103,10 +103,7 @@ const useGridVirtualScroller = () => {
|
|
|
103
103
|
return undefined;
|
|
104
104
|
}
|
|
105
105
|
const initialRect = node.getBoundingClientRect();
|
|
106
|
-
let lastSize =
|
|
107
|
-
width: initialRect.width,
|
|
108
|
-
height: initialRect.height
|
|
109
|
-
};
|
|
106
|
+
let lastSize = roundDimensions(initialRect);
|
|
110
107
|
apiRef.current.publishEvent('resize', lastSize);
|
|
111
108
|
if (typeof ResizeObserver === 'undefined') {
|
|
112
109
|
return undefined;
|
|
@@ -116,10 +113,7 @@ const useGridVirtualScroller = () => {
|
|
|
116
113
|
if (!entry) {
|
|
117
114
|
return;
|
|
118
115
|
}
|
|
119
|
-
const newSize =
|
|
120
|
-
width: entry.contentRect.width,
|
|
121
|
-
height: entry.contentRect.height
|
|
122
|
-
};
|
|
116
|
+
const newSize = roundDimensions(entry.contentRect);
|
|
123
117
|
if (newSize.width === lastSize.width && newSize.height === lastSize.height) {
|
|
124
118
|
return;
|
|
125
119
|
}
|
|
@@ -796,4 +790,13 @@ function bufferForDirection(isRtl, direction, rowBufferPx, columnBufferPx, verti
|
|
|
796
790
|
// eslint unable to figure out enum exhaustiveness
|
|
797
791
|
throw new Error('unreachable');
|
|
798
792
|
}
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
// Round to avoid issues with subpixel rendering
|
|
796
|
+
// https://github.com/mui/mui-x/issues/15721
|
|
797
|
+
function roundDimensions(dimensions) {
|
|
798
|
+
return {
|
|
799
|
+
width: Math.round(dimensions.width * 10) / 10,
|
|
800
|
+
height: Math.round(dimensions.height * 10) / 10
|
|
801
|
+
};
|
|
799
802
|
}
|
package/node/index.js
CHANGED
package/node/internals/index.js
CHANGED
|
@@ -71,6 +71,7 @@ var _exportNames = {
|
|
|
71
71
|
useGridRowSelectionPreProcessors: true,
|
|
72
72
|
useGridSorting: true,
|
|
73
73
|
sortingStateInitializer: true,
|
|
74
|
+
gridSortedRowIndexLookupSelector: true,
|
|
74
75
|
useGridScroll: true,
|
|
75
76
|
useGridEvents: true,
|
|
76
77
|
dimensionsStateInitializer: true,
|
|
@@ -356,6 +357,12 @@ Object.defineProperty(exports, "gridRowGroupsToFetchSelector", {
|
|
|
356
357
|
return _gridRowsSelector.gridRowGroupsToFetchSelector;
|
|
357
358
|
}
|
|
358
359
|
});
|
|
360
|
+
Object.defineProperty(exports, "gridSortedRowIndexLookupSelector", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function () {
|
|
363
|
+
return _gridSortingSelector.gridSortedRowIndexLookupSelector;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
359
366
|
Object.defineProperty(exports, "headerFilteringStateInitializer", {
|
|
360
367
|
enumerable: true,
|
|
361
368
|
get: function () {
|
|
@@ -777,6 +784,7 @@ var _useGridHeaderFiltering = require("../hooks/features/headerFiltering/useGrid
|
|
|
777
784
|
var _useGridRowSelection = require("../hooks/features/rowSelection/useGridRowSelection");
|
|
778
785
|
var _useGridRowSelectionPreProcessors = require("../hooks/features/rowSelection/useGridRowSelectionPreProcessors");
|
|
779
786
|
var _useGridSorting = require("../hooks/features/sorting/useGridSorting");
|
|
787
|
+
var _gridSortingSelector = require("../hooks/features/sorting/gridSortingSelector");
|
|
780
788
|
var _useGridScroll = require("../hooks/features/scroll/useGridScroll");
|
|
781
789
|
var _useGridEvents = require("../hooks/features/events/useGridEvents");
|
|
782
790
|
var _useGridDimensions = require("../hooks/features/dimensions/useGridDimensions");
|