@mui/x-data-grid 7.19.0 → 7.21.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 +224 -43
- package/DataGrid/DataGrid.js +8 -0
- package/DataGrid/index.d.ts +0 -1
- package/DataGrid/index.js +1 -2
- package/DataGrid/useDataGridComponent.js +4 -1
- package/DataGrid/useDataGridProps.d.ts +1 -5
- package/DataGrid/useDataGridProps.js +3 -62
- package/components/GridPagination.js +1 -0
- package/components/GridRow.js +25 -36
- package/components/base/GridOverlays.js +8 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/components/containers/GridRootStyles.js +1 -0
- package/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/components/toolbar/GridToolbarExport.d.ts +9 -3
- package/components/toolbar/GridToolbarExport.js +55 -3
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +2 -2
- package/constants/dataGridPropsDefaultValues.d.ts +5 -0
- package/constants/dataGridPropsDefaultValues.js +60 -0
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +2 -1
- package/hooks/core/useGridRefs.js +4 -0
- package/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/hooks/features/dimensions/useGridDimensions.js +6 -4
- package/hooks/features/editing/useGridCellEditing.js +3 -1
- package/hooks/features/editing/useGridRowEditing.js +3 -1
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +1 -0
- package/hooks/features/filter/gridFilterUtils.js +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -5
- package/hooks/features/listView/gridListViewSelectors.d.ts +5 -0
- package/hooks/features/listView/gridListViewSelectors.js +4 -0
- package/hooks/features/listView/useGridListView.d.ts +10 -0
- package/hooks/features/listView/useGridListView.js +54 -0
- package/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/hooks/features/rowSelection/utils.js +6 -6
- package/hooks/features/rows/gridRowsMetaInterfaces.d.ts +16 -0
- package/hooks/features/rows/gridRowsMetaInterfaces.js +1 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +3 -0
- package/hooks/features/rows/gridRowsUtils.js +15 -2
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -1
- package/hooks/features/rows/useGridParamsApi.js +4 -3
- package/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/hooks/features/rows/useGridRowsMeta.js +135 -154
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.js +10 -5
- package/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +25 -11
- package/hooks/utils/useGridApiContext.js +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +1 -1
- package/hooks/utils/useGridApiEventHandler.js +1 -1
- package/hooks/utils/useGridApiMethod.js +2 -1
- package/hooks/utils/useGridConfiguration.js +1 -1
- package/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/index.d.ts +3 -2
- package/index.js +4 -3
- package/internals/index.d.ts +2 -1
- package/internals/index.js +2 -1
- package/joy/icons.js +0 -1
- package/locales/jaJP.js +4 -4
- package/models/api/gridApiCommunity.d.ts +1 -1
- package/models/api/gridCoreApi.d.ts +9 -1
- package/models/api/gridFilterApi.d.ts +1 -1
- package/models/api/gridRowsMetaApi.d.ts +15 -14
- package/models/colDef/gridColDef.d.ts +6 -0
- package/models/colDef/index.d.ts +1 -1
- package/models/events/gridEventLookup.d.ts +7 -0
- package/models/gridApiCaches.d.ts +2 -0
- package/models/gridStateCommunity.d.ts +4 -2
- package/models/props/DataGridProps.d.ts +37 -17
- package/modern/DataGrid/DataGrid.js +8 -0
- package/modern/DataGrid/index.js +1 -2
- package/modern/DataGrid/useDataGridComponent.js +4 -1
- package/modern/DataGrid/useDataGridProps.js +3 -62
- package/modern/components/GridPagination.js +1 -0
- package/modern/components/GridRow.js +25 -36
- package/modern/components/base/GridOverlays.js +8 -0
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/modern/components/toolbar/GridToolbarExport.js +55 -3
- package/modern/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +2 -2
- package/modern/constants/dataGridPropsDefaultValues.js +60 -0
- package/modern/hooks/core/useGridRefs.js +4 -0
- package/modern/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/modern/hooks/features/dimensions/useGridDimensions.js +6 -4
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +3 -1
- package/modern/hooks/features/events/useGridEvents.js +1 -0
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -5
- package/modern/hooks/features/listView/gridListViewSelectors.js +4 -0
- package/modern/hooks/features/listView/useGridListView.js +54 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/modern/hooks/features/rowSelection/utils.js +6 -6
- package/modern/hooks/features/rows/gridRowsMetaInterfaces.js +1 -0
- package/modern/hooks/features/rows/gridRowsUtils.js +15 -2
- package/modern/hooks/features/rows/useGridParamsApi.js +4 -3
- package/modern/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/modern/hooks/features/rows/useGridRowsMeta.js +135 -154
- package/modern/hooks/features/scroll/useGridScroll.js +10 -5
- package/modern/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +25 -11
- package/modern/hooks/utils/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridApiEventHandler.js +1 -1
- package/modern/hooks/utils/useGridApiMethod.js +2 -1
- package/modern/hooks/utils/useGridConfiguration.js +1 -1
- package/modern/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/modern/index.js +4 -3
- package/modern/internals/index.js +2 -1
- package/modern/joy/icons.js +0 -1
- package/modern/locales/jaJP.js +4 -4
- package/modern/utils/ResizeObserver.js +10 -0
- package/modern/utils/domUtils.js +1 -1
- package/modern/utils/keyboardUtils.js +12 -4
- package/node/DataGrid/DataGrid.js +8 -0
- package/node/DataGrid/index.js +1 -12
- package/node/DataGrid/useDataGridComponent.js +4 -1
- package/node/DataGrid/useDataGridProps.js +6 -65
- package/node/components/GridPagination.js +1 -0
- package/node/components/GridRow.js +25 -36
- package/node/components/base/GridOverlays.js +8 -0
- package/node/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/node/components/toolbar/GridToolbarExport.js +52 -0
- package/node/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +2 -2
- package/node/constants/dataGridPropsDefaultValues.js +66 -0
- package/node/hooks/core/useGridRefs.js +4 -0
- package/node/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/node/hooks/features/dimensions/useGridDimensions.js +5 -3
- package/node/hooks/features/editing/useGridCellEditing.js +3 -1
- package/node/hooks/features/editing/useGridRowEditing.js +3 -1
- package/node/hooks/features/events/useGridEvents.js +1 -0
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -5
- package/node/hooks/features/listView/gridListViewSelectors.js +11 -0
- package/node/hooks/features/listView/useGridListView.js +64 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/node/hooks/features/rowSelection/utils.js +6 -6
- package/node/hooks/features/rows/gridRowsMetaInterfaces.js +5 -0
- package/node/hooks/features/rows/gridRowsUtils.js +17 -3
- package/node/hooks/features/rows/useGridParamsApi.js +4 -3
- package/node/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/node/hooks/features/rows/useGridRowsMeta.js +136 -154
- package/node/hooks/features/scroll/useGridScroll.js +10 -5
- package/node/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +25 -11
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridApiEventHandler.js +1 -1
- package/node/hooks/utils/useGridApiMethod.js +3 -1
- package/node/hooks/utils/useGridConfiguration.js +1 -1
- package/node/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/node/index.js +13 -1
- package/node/internals/index.js +22 -0
- package/node/joy/icons.js +0 -1
- package/node/locales/jaJP.js +4 -4
- package/node/utils/ResizeObserver.js +16 -0
- package/node/utils/domUtils.js +1 -1
- package/node/utils/keyboardUtils.js +15 -5
- package/package.json +4 -4
- package/utils/ResizeObserver.d.ts +4 -0
- package/utils/ResizeObserver.js +10 -0
- package/utils/domUtils.js +1 -1
- package/utils/keyboardUtils.d.ts +1 -0
- package/utils/keyboardUtils.js +12 -4
|
@@ -25,6 +25,7 @@ import { getMinimalContentHeight } from "../rows/gridRowsUtils.js";
|
|
|
25
25
|
import { gridRenderContextSelector, gridVirtualizationRowEnabledSelector, gridVirtualizationColumnEnabledSelector } from "./gridVirtualizationSelectors.js";
|
|
26
26
|
import { EMPTY_RENDER_CONTEXT } from "./useGridVirtualization.js";
|
|
27
27
|
import { gridRowSpanningHiddenCellsOriginMapSelector } from "../rows/gridRowSpanningSelectors.js";
|
|
28
|
+
import { gridListColumnSelector } from "../listView/gridListViewSelectors.js";
|
|
28
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
30
|
const MINIMUM_COLUMN_WIDTH = 50;
|
|
30
31
|
var ScrollDirection = /*#__PURE__*/function (ScrollDirection) {
|
|
@@ -55,13 +56,20 @@ try {
|
|
|
55
56
|
export const useGridVirtualScroller = () => {
|
|
56
57
|
const apiRef = useGridPrivateApiContext();
|
|
57
58
|
const rootProps = useGridRootProps();
|
|
58
|
-
const
|
|
59
|
+
const {
|
|
60
|
+
unstable_listView: listView
|
|
61
|
+
} = rootProps;
|
|
62
|
+
const visibleColumns = useGridSelector(apiRef, () => listView ? [gridListColumnSelector(apiRef.current.state)] : gridVisibleColumnDefinitionsSelector(apiRef));
|
|
59
63
|
const enabledForRows = useGridSelector(apiRef, gridVirtualizationRowEnabledSelector) && !isJSDOM;
|
|
60
64
|
const enabledForColumns = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector) && !isJSDOM;
|
|
61
65
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
62
66
|
const outerSize = dimensions.viewportOuterSize;
|
|
63
67
|
const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
64
|
-
const
|
|
68
|
+
const pinnedColumnDefinitions = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
|
|
69
|
+
const pinnedColumns = listView ? {
|
|
70
|
+
left: [],
|
|
71
|
+
right: []
|
|
72
|
+
} : pinnedColumnDefinitions;
|
|
65
73
|
const hasBottomPinnedRows = pinnedRows.bottom.length > 0;
|
|
66
74
|
const [panels, setPanels] = React.useState(EMPTY_DETAIL_PANELS);
|
|
67
75
|
const isRtl = useRtl();
|
|
@@ -73,8 +81,8 @@ export const useGridVirtualScroller = () => {
|
|
|
73
81
|
const gridRootRef = apiRef.current.rootElementRef;
|
|
74
82
|
const mainRef = apiRef.current.mainElementRef;
|
|
75
83
|
const scrollerRef = apiRef.current.virtualScrollerRef;
|
|
76
|
-
const scrollbarVerticalRef =
|
|
77
|
-
const scrollbarHorizontalRef =
|
|
84
|
+
const scrollbarVerticalRef = apiRef.current.virtualScrollbarVerticalRef;
|
|
85
|
+
const scrollbarHorizontalRef = apiRef.current.virtualScrollbarHorizontalRef;
|
|
78
86
|
const contentHeight = dimensions.contentSize.height;
|
|
79
87
|
const columnsTotalWidth = dimensions.columnsTotalWidth;
|
|
80
88
|
const hasColSpan = useGridSelector(apiRef, gridHasColSpanSelector);
|
|
@@ -128,7 +136,7 @@ export const useGridVirtualScroller = () => {
|
|
|
128
136
|
}
|
|
129
137
|
previousContextScrollPosition.current = scrollPosition.current;
|
|
130
138
|
}, [apiRef, dimensions.isReady]);
|
|
131
|
-
const triggerUpdateRenderContext = () => {
|
|
139
|
+
const triggerUpdateRenderContext = useEventCallback(() => {
|
|
132
140
|
const newScroll = {
|
|
133
141
|
top: scrollerRef.current.scrollTop,
|
|
134
142
|
left: scrollerRef.current.scrollLeft
|
|
@@ -176,7 +184,7 @@ export const useGridVirtualScroller = () => {
|
|
|
176
184
|
});
|
|
177
185
|
scrollTimeout.start(1000, triggerUpdateRenderContext);
|
|
178
186
|
return nextRenderContext;
|
|
179
|
-
};
|
|
187
|
+
});
|
|
180
188
|
const forceUpdateRenderContext = () => {
|
|
181
189
|
const inputs = inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns);
|
|
182
190
|
const nextRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
|
|
@@ -362,11 +370,11 @@ export const useGridVirtualScroller = () => {
|
|
|
362
370
|
});
|
|
363
371
|
return rows;
|
|
364
372
|
};
|
|
365
|
-
const needsHorizontalScrollbar = outerSize.width && columnsTotalWidth
|
|
373
|
+
const needsHorizontalScrollbar = outerSize.width && columnsTotalWidth > outerSize.width;
|
|
366
374
|
const scrollerStyle = React.useMemo(() => ({
|
|
367
|
-
overflowX: !needsHorizontalScrollbar ? 'hidden' : undefined,
|
|
375
|
+
overflowX: !needsHorizontalScrollbar || listView ? 'hidden' : undefined,
|
|
368
376
|
overflowY: rootProps.autoHeight ? 'hidden' : undefined
|
|
369
|
-
}), [needsHorizontalScrollbar, rootProps.autoHeight]);
|
|
377
|
+
}), [needsHorizontalScrollbar, rootProps.autoHeight, listView]);
|
|
370
378
|
const contentSize = React.useMemo(() => {
|
|
371
379
|
const size = {
|
|
372
380
|
width: needsHorizontalScrollbar ? columnsTotalWidth : 'auto',
|
|
@@ -393,6 +401,11 @@ export const useGridVirtualScroller = () => {
|
|
|
393
401
|
scrollerRef.current.scrollTop = 0;
|
|
394
402
|
}
|
|
395
403
|
}, [enabledForColumns, enabledForRows, gridRootRef, scrollerRef]);
|
|
404
|
+
useEnhancedEffect(() => {
|
|
405
|
+
if (listView) {
|
|
406
|
+
scrollerRef.current.scrollLeft = 0;
|
|
407
|
+
}
|
|
408
|
+
}, [listView, scrollerRef]);
|
|
396
409
|
useRunOnce(outerSize.width !== 0, () => {
|
|
397
410
|
const inputs = inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns);
|
|
398
411
|
const initialRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
|
|
@@ -447,7 +460,7 @@ export const useGridVirtualScroller = () => {
|
|
|
447
460
|
function inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns) {
|
|
448
461
|
const dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
449
462
|
const currentPage = getVisibleRows(apiRef, rootProps);
|
|
450
|
-
const visibleColumns = gridVisibleColumnDefinitionsSelector(apiRef);
|
|
463
|
+
const visibleColumns = rootProps.unstable_listView ? [gridListColumnSelector(apiRef.current.state)] : gridVisibleColumnDefinitionsSelector(apiRef);
|
|
451
464
|
const hiddenCellsOriginMap = gridRowSpanningHiddenCellsOriginMapSelector(apiRef);
|
|
452
465
|
const lastRowId = apiRef.current.state.rows.dataRowIds.at(-1);
|
|
453
466
|
const lastColumn = visibleColumns.at(-1);
|
|
@@ -470,7 +483,8 @@ function inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns) {
|
|
|
470
483
|
range: currentPage.range,
|
|
471
484
|
pinnedColumns: gridVisiblePinnedColumnDefinitionsSelector(apiRef),
|
|
472
485
|
visibleColumns,
|
|
473
|
-
hiddenCellsOriginMap
|
|
486
|
+
hiddenCellsOriginMap,
|
|
487
|
+
listView: rootProps.unstable_listView ?? false
|
|
474
488
|
};
|
|
475
489
|
}
|
|
476
490
|
function computeRenderContext(inputs, scrollPosition, scrollCache) {
|
|
@@ -3,7 +3,7 @@ import { GridApiContext } from "../../components/GridApiContext.js";
|
|
|
3
3
|
export function useGridApiContext() {
|
|
4
4
|
const apiRef = React.useContext(GridApiContext);
|
|
5
5
|
if (apiRef === undefined) {
|
|
6
|
-
throw new Error(['MUI X: Could not find the
|
|
6
|
+
throw new Error(['MUI X: Could not find the Data Grid context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the Data Grid.'].join('\n'));
|
|
7
7
|
}
|
|
8
8
|
return apiRef;
|
|
9
9
|
}
|
|
@@ -3,7 +3,7 @@ import { TimerBasedCleanupTracking } from "../../utils/cleanupTracking/TimerBase
|
|
|
3
3
|
import { FinalizationRegistryBasedCleanupTracking } from "../../utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js";
|
|
4
4
|
/**
|
|
5
5
|
* Signal to the underlying logic what version of the public component API
|
|
6
|
-
* of the
|
|
6
|
+
* of the Data Grid is exposed.
|
|
7
7
|
*/
|
|
8
8
|
var GridSignature = /*#__PURE__*/function (GridSignature) {
|
|
9
9
|
GridSignature["DataGrid"] = "DataGrid";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
2
3
|
export function useGridApiMethod(privateApiRef, apiMethods, visibility) {
|
|
3
4
|
const isFirstRender = React.useRef(true);
|
|
4
|
-
|
|
5
|
+
useEnhancedEffect(() => {
|
|
5
6
|
isFirstRender.current = false;
|
|
6
7
|
privateApiRef.current.register(visibility, apiMethods);
|
|
7
8
|
}, [privateApiRef, visibility, apiMethods]);
|
|
@@ -3,7 +3,7 @@ import { GridConfigurationContext } from "../../components/GridConfigurationCont
|
|
|
3
3
|
export const useGridConfiguration = () => {
|
|
4
4
|
const configuration = React.useContext(GridConfigurationContext);
|
|
5
5
|
if (configuration === undefined) {
|
|
6
|
-
throw new Error(['MUI X: Could not find the
|
|
6
|
+
throw new Error(['MUI X: Could not find the Data Grid configuration context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the Data Grid.'].join('\n'));
|
|
7
7
|
}
|
|
8
8
|
return configuration;
|
|
9
9
|
};
|
|
@@ -6,7 +6,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
6
6
|
export function useGridPrivateApiContext() {
|
|
7
7
|
const privateApiRef = React.useContext(GridPrivateApiContext);
|
|
8
8
|
if (privateApiRef === undefined) {
|
|
9
|
-
throw new Error(['MUI X: Could not find the
|
|
9
|
+
throw new Error(['MUI X: Could not find the Data Grid private context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the Data Grid.'].join('\n'));
|
|
10
10
|
}
|
|
11
11
|
return privateApiRef;
|
|
12
12
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-data-grid v7.
|
|
2
|
+
* @mui/x-data-grid v7.21.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -11,6 +11,7 @@ export { useGridRootProps } from "./hooks/utils/useGridRootProps.js";
|
|
|
11
11
|
export * from "./DataGrid/index.js";
|
|
12
12
|
export * from "./components/index.js";
|
|
13
13
|
export * from "./constants/index.js";
|
|
14
|
+
export * from "./constants/dataGridPropsDefaultValues.js";
|
|
14
15
|
export * from "./hooks/index.js";
|
|
15
16
|
export * from "./models/index.js";
|
|
16
17
|
export * from "./context/index.js";
|
|
@@ -29,9 +30,9 @@ export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } f
|
|
|
29
30
|
*/
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
|
-
* The state of
|
|
33
|
+
* The state of Data Grid.
|
|
33
34
|
*/
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
|
-
* The initial state of
|
|
37
|
+
* The initial state of Data Grid.
|
|
37
38
|
*/
|
|
@@ -54,6 +54,7 @@ export { useGridVirtualScroller, EMPTY_DETAIL_PANELS } from "../hooks/features/v
|
|
|
54
54
|
export * from "../hooks/features/virtualization/index.js";
|
|
55
55
|
export { useGridColumnResize, columnResizeStateInitializer } from "../hooks/features/columnResize/useGridColumnResize.js";
|
|
56
56
|
export { ROW_SELECTION_PROPAGATION_DEFAULT } from "../hooks/features/rowSelection/utils.js";
|
|
57
|
+
export { useGridListView, listViewStateInitializer } from "../hooks/features/listView/useGridListView.js";
|
|
57
58
|
export { useTimeout } from "../hooks/utils/useTimeout.js";
|
|
58
59
|
export { useGridVisibleRows, getVisibleRows } from "../hooks/utils/useGridVisibleRows.js";
|
|
59
60
|
export { useGridInitializeState } from "../hooks/utils/useGridInitializeState.js";
|
|
@@ -63,7 +64,7 @@ export { createSelector, createSelectorV8, createSelectorMemoized, createSelecto
|
|
|
63
64
|
export { useGridSelectorV8 } from "../hooks/utils/useGridSelector.js";
|
|
64
65
|
export { gridRowGroupsToFetchSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
65
66
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal } from "../utils/domUtils.js";
|
|
66
|
-
export { isNavigationKey, isPasteShortcut } from "../utils/keyboardUtils.js";
|
|
67
|
+
export { isNavigationKey, isPasteShortcut, isCopyShortcut } from "../utils/keyboardUtils.js";
|
|
67
68
|
export * from "../utils/utils.js";
|
|
68
69
|
export { exportAs } from "../utils/exportAs.js";
|
|
69
70
|
export * from "../utils/getPublicApiRef.js";
|
package/modern/joy/icons.js
CHANGED
package/modern/locales/jaJP.js
CHANGED
|
@@ -47,9 +47,9 @@ const jaJPGrid = {
|
|
|
47
47
|
filterPanelInputPlaceholder: '値を入力…',
|
|
48
48
|
// Filter operators text
|
|
49
49
|
filterOperatorContains: '...を含む',
|
|
50
|
-
|
|
50
|
+
filterOperatorDoesNotContain: '...を含まない',
|
|
51
51
|
filterOperatorEquals: '...に等しい',
|
|
52
|
-
|
|
52
|
+
filterOperatorDoesNotEqual: '...に等しくない',
|
|
53
53
|
filterOperatorStartsWith: '...で始まる',
|
|
54
54
|
filterOperatorEndsWith: '...で終わる',
|
|
55
55
|
filterOperatorIs: '...である',
|
|
@@ -69,9 +69,9 @@ const jaJPGrid = {
|
|
|
69
69
|
'filterOperator<=': '<=',
|
|
70
70
|
// Header filter operators text
|
|
71
71
|
headerFilterOperatorContains: '含む',
|
|
72
|
-
|
|
72
|
+
headerFilterOperatorDoesNotContain: '含まない',
|
|
73
73
|
headerFilterOperatorEquals: '等しい',
|
|
74
|
-
|
|
74
|
+
headerFilterOperatorDoesNotEqual: '等しくない',
|
|
75
75
|
headerFilterOperatorStartsWith: 'で始まる',
|
|
76
76
|
headerFilterOperatorEndsWith: 'で終わる',
|
|
77
77
|
headerFilterOperatorIs: 'である',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* HACK: Minimal shim to get jsdom to work.
|
|
5
|
+
*/
|
|
6
|
+
export const ResizeObserver = typeof globalThis.ResizeObserver !== 'undefined' ? globalThis.ResizeObserver : class ResizeObserver {
|
|
7
|
+
observe() {}
|
|
8
|
+
unobserve() {}
|
|
9
|
+
disconnect() {}
|
|
10
|
+
};
|
package/modern/utils/domUtils.js
CHANGED
|
@@ -187,7 +187,7 @@ export function findGridCells(api, field) {
|
|
|
187
187
|
}
|
|
188
188
|
function queryRows(api) {
|
|
189
189
|
return api.virtualScrollerRef.current.querySelectorAll(
|
|
190
|
-
// Use > to ignore rows from nested
|
|
190
|
+
// Use > to ignore rows from nested Data Grids (for example in detail panel)
|
|
191
191
|
`:scope > div > div > .${gridClasses.row}`);
|
|
192
192
|
}
|
|
193
193
|
function parseCellColIndex(col) {
|
|
@@ -22,8 +22,16 @@ export const isHideMenuKey = key => key === 'Tab' || key === 'Escape';
|
|
|
22
22
|
// In theory, on macOS, ctrl + v doesn't trigger a paste, so the function should return false.
|
|
23
23
|
// However, maybe it's overkill to fix, so let's be lazy.
|
|
24
24
|
export function isPasteShortcut(event) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
return (event.ctrlKey || event.metaKey) &&
|
|
26
|
+
// We can't use event.code === 'KeyV' as event.code assumes a QWERTY keyboard layout,
|
|
27
|
+
// for example, it would be another letter on a Dvorak physical keyboard.
|
|
28
|
+
// We can't use event.key === 'v' as event.key is not stable with key modifiers and keyboard layouts,
|
|
29
|
+
// for example, it would be ה on a Hebrew keyboard layout.
|
|
30
|
+
// https://github.com/w3c/uievents/issues/377 could be a long-term solution
|
|
31
|
+
String.fromCharCode(event.keyCode) === 'V' && !event.shiftKey && !event.altKey;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Checks if the keyboard event corresponds to the copy shortcut (CTRL+C or CMD+C) across different localization keyboards.
|
|
35
|
+
export function isCopyShortcut(event) {
|
|
36
|
+
return (event.ctrlKey || event.metaKey) && String.fromCharCode(event.keyCode) === 'C' && !event.shiftKey && !event.altKey;
|
|
29
37
|
}
|
|
@@ -445,6 +445,12 @@ DataGridRaw.propTypes = {
|
|
|
445
445
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
446
446
|
*/
|
|
447
447
|
onColumnHeaderClick: _propTypes.default.func,
|
|
448
|
+
/**
|
|
449
|
+
* Callback fired when a contextmenu event comes from a column header element.
|
|
450
|
+
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
451
|
+
* @param {MuiEvent<React.MouseEvent>} event The event object.
|
|
452
|
+
*/
|
|
453
|
+
onColumnHeaderContextMenu: _propTypes.default.func,
|
|
448
454
|
/**
|
|
449
455
|
* Callback fired when a double click event comes from a column header element.
|
|
450
456
|
* @param {GridColumnHeaderParams} params With all properties from [[GridColumnHeaderParams]].
|
|
@@ -662,6 +668,7 @@ DataGridRaw.propTypes = {
|
|
|
662
668
|
* @template R
|
|
663
669
|
* @param {R} newRow Row object with the new values.
|
|
664
670
|
* @param {R} oldRow Row object with the old values.
|
|
671
|
+
* @param {{ rowId: GridRowId }} params Additional parameters.
|
|
665
672
|
* @returns {Promise<R> | R} The final values to update the row.
|
|
666
673
|
*/
|
|
667
674
|
processRowUpdate: _propTypes.default.func,
|
|
@@ -695,6 +702,7 @@ DataGridRaw.propTypes = {
|
|
|
695
702
|
* Setting it to a lower value could be useful when using dynamic row height,
|
|
696
703
|
* but might reduce performance when displaying a large number of rows.
|
|
697
704
|
* @default 166
|
|
705
|
+
* @deprecated
|
|
698
706
|
*/
|
|
699
707
|
rowPositionsDebounceMs: _propTypes.default.number,
|
|
700
708
|
/**
|
package/node/DataGrid/index.js
CHANGED
|
@@ -3,19 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
var _exportNames = {
|
|
7
|
-
DATA_GRID_PROPS_DEFAULT_VALUES: true
|
|
8
|
-
};
|
|
9
|
-
Object.defineProperty(exports, "DATA_GRID_PROPS_DEFAULT_VALUES", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () {
|
|
12
|
-
return _useDataGridProps.DATA_GRID_PROPS_DEFAULT_VALUES;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
6
|
var _DataGrid = require("./DataGrid");
|
|
16
7
|
Object.keys(_DataGrid).forEach(function (key) {
|
|
17
8
|
if (key === "default" || key === "__esModule") return;
|
|
18
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
19
9
|
if (key in exports && exports[key] === _DataGrid[key]) return;
|
|
20
10
|
Object.defineProperty(exports, key, {
|
|
21
11
|
enumerable: true,
|
|
@@ -23,5 +13,4 @@ Object.keys(_DataGrid).forEach(function (key) {
|
|
|
23
13
|
return _DataGrid[key];
|
|
24
14
|
}
|
|
25
15
|
});
|
|
26
|
-
});
|
|
27
|
-
var _useDataGridProps = require("./useDataGridProps");
|
|
16
|
+
});
|
|
@@ -34,6 +34,7 @@ var _useGridColumnGrouping = require("../hooks/features/columnGrouping/useGridCo
|
|
|
34
34
|
var _virtualization = require("../hooks/features/virtualization");
|
|
35
35
|
var _useGridColumnResize = require("../hooks/features/columnResize/useGridColumnResize");
|
|
36
36
|
var _useGridRowSpanning = require("../hooks/features/rows/useGridRowSpanning");
|
|
37
|
+
var _useGridListView = require("../hooks/features/listView/useGridListView");
|
|
37
38
|
const useDataGridComponent = (inputApiRef, props) => {
|
|
38
39
|
const apiRef = (0, _useGridInitialization.useGridInitialization)(inputApiRef, props);
|
|
39
40
|
|
|
@@ -63,12 +64,13 @@ const useDataGridComponent = (inputApiRef, props) => {
|
|
|
63
64
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumnMenu.columnMenuStateInitializer, apiRef, props);
|
|
64
65
|
(0, _useGridInitializeState.useGridInitializeState)(_useGridColumnGrouping.columnGroupsStateInitializer, apiRef, props);
|
|
65
66
|
(0, _useGridInitializeState.useGridInitializeState)(_virtualization.virtualizationStateInitializer, apiRef, props);
|
|
67
|
+
(0, _useGridInitializeState.useGridInitializeState)(_useGridListView.listViewStateInitializer, apiRef, props);
|
|
66
68
|
(0, _useGridKeyboardNavigation.useGridKeyboardNavigation)(apiRef, props);
|
|
67
69
|
(0, _useGridRowSelection.useGridRowSelection)(apiRef, props);
|
|
68
70
|
(0, _useGridColumns.useGridColumns)(apiRef, props);
|
|
69
71
|
(0, _useGridRows.useGridRows)(apiRef, props);
|
|
70
72
|
(0, _useGridRowSpanning.useGridRowSpanning)(apiRef, props);
|
|
71
|
-
(0, _useGridParamsApi.useGridParamsApi)(apiRef);
|
|
73
|
+
(0, _useGridParamsApi.useGridParamsApi)(apiRef, props);
|
|
72
74
|
(0, _useGridColumnSpanning.useGridColumnSpanning)(apiRef);
|
|
73
75
|
(0, _useGridColumnGrouping.useGridColumnGrouping)(apiRef, props);
|
|
74
76
|
(0, _useGridEditing.useGridEditing)(apiRef, props);
|
|
@@ -89,6 +91,7 @@ const useDataGridComponent = (inputApiRef, props) => {
|
|
|
89
91
|
(0, _useGridEvents.useGridEvents)(apiRef, props);
|
|
90
92
|
(0, _useGridStatePersistence.useGridStatePersistence)(apiRef);
|
|
91
93
|
(0, _virtualization.useGridVirtualization)(apiRef, props);
|
|
94
|
+
(0, _useGridListView.useGridListView)(apiRef, props);
|
|
92
95
|
return apiRef;
|
|
93
96
|
};
|
|
94
97
|
exports.useDataGridComponent = useDataGridComponent;
|
|
@@ -5,14 +5,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.useDataGridProps =
|
|
8
|
+
exports.useDataGridProps = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _styles = require("@mui/material/styles");
|
|
12
12
|
var _constants = require("../constants");
|
|
13
13
|
var _defaultGridSlotsComponents = require("../constants/defaultGridSlotsComponents");
|
|
14
|
-
var _models = require("../models");
|
|
15
14
|
var _utils = require("../internals/utils");
|
|
15
|
+
var _dataGridPropsDefaultValues = require("../constants/dataGridPropsDefaultValues");
|
|
16
16
|
const DATA_GRID_FORCED_PROPS = {
|
|
17
17
|
disableMultipleColumnsFiltering: true,
|
|
18
18
|
disableMultipleColumnsSorting: true,
|
|
@@ -22,67 +22,8 @@ const DATA_GRID_FORCED_PROPS = {
|
|
|
22
22
|
checkboxSelectionVisibleOnly: false,
|
|
23
23
|
disableColumnReorder: true,
|
|
24
24
|
keepColumnPositionIfDraggedOutside: false,
|
|
25
|
-
signature: 'DataGrid'
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* The default values of `DataGridPropsWithDefaultValues` to inject in the props of DataGrid.
|
|
30
|
-
*/
|
|
31
|
-
const DATA_GRID_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
32
|
-
autoHeight: false,
|
|
33
|
-
autoPageSize: false,
|
|
34
|
-
autosizeOnMount: false,
|
|
35
|
-
checkboxSelection: false,
|
|
36
|
-
checkboxSelectionVisibleOnly: false,
|
|
37
|
-
clipboardCopyCellDelimiter: '\t',
|
|
38
|
-
columnBufferPx: 150,
|
|
39
|
-
columnHeaderHeight: 56,
|
|
40
|
-
disableAutosize: false,
|
|
41
|
-
disableColumnFilter: false,
|
|
42
|
-
disableColumnMenu: false,
|
|
43
|
-
disableColumnReorder: false,
|
|
44
|
-
disableColumnResize: false,
|
|
45
|
-
disableColumnSelector: false,
|
|
46
|
-
disableColumnSorting: false,
|
|
47
|
-
disableDensitySelector: false,
|
|
48
|
-
disableEval: false,
|
|
49
|
-
disableMultipleColumnsFiltering: false,
|
|
50
|
-
disableMultipleColumnsSorting: false,
|
|
51
|
-
disableMultipleRowSelection: false,
|
|
52
|
-
disableRowSelectionOnClick: false,
|
|
53
|
-
disableVirtualization: false,
|
|
54
|
-
editMode: _models.GridEditModes.Cell,
|
|
55
|
-
filterDebounceMs: 150,
|
|
56
|
-
filterMode: 'client',
|
|
57
|
-
hideFooter: false,
|
|
58
|
-
hideFooterPagination: false,
|
|
59
|
-
hideFooterRowCount: false,
|
|
60
|
-
hideFooterSelectedRowCount: false,
|
|
61
|
-
ignoreDiacritics: false,
|
|
62
|
-
ignoreValueFormatterDuringExport: false,
|
|
63
|
-
// TODO v8: Update to 'select'
|
|
64
|
-
indeterminateCheckboxAction: 'deselect',
|
|
65
|
-
keepColumnPositionIfDraggedOutside: false,
|
|
66
|
-
keepNonExistentRowsSelected: false,
|
|
67
|
-
loading: false,
|
|
68
|
-
logger: console,
|
|
69
|
-
logLevel: process.env.NODE_ENV === 'production' ? 'error' : 'warn',
|
|
70
|
-
pageSizeOptions: [25, 50, 100],
|
|
71
|
-
pagination: false,
|
|
72
|
-
paginationMode: 'client',
|
|
73
|
-
resizeThrottleMs: 60,
|
|
74
|
-
rowBufferPx: 150,
|
|
75
|
-
rowHeight: 52,
|
|
76
|
-
rowPositionsDebounceMs: 166,
|
|
77
|
-
rows: [],
|
|
78
|
-
rowSelection: true,
|
|
79
|
-
rowSpacingType: 'margin',
|
|
80
|
-
showCellVerticalBorder: false,
|
|
81
|
-
showColumnVerticalBorder: false,
|
|
82
|
-
sortingMode: 'client',
|
|
83
|
-
sortingOrder: ['asc', 'desc', null],
|
|
84
|
-
throttleRowsMs: 0,
|
|
85
|
-
unstable_rowSpanning: false
|
|
25
|
+
signature: 'DataGrid',
|
|
26
|
+
unstable_listView: false
|
|
86
27
|
};
|
|
87
28
|
const defaultSlots = _defaultGridSlotsComponents.DATA_GRID_DEFAULT_SLOTS_COMPONENTS;
|
|
88
29
|
const useDataGridProps = inProps => {
|
|
@@ -98,9 +39,9 @@ const useDataGridProps = inProps => {
|
|
|
98
39
|
slots: themedProps.slots
|
|
99
40
|
}), [themedProps.slots]);
|
|
100
41
|
const injectDefaultProps = React.useMemo(() => {
|
|
101
|
-
return Object.keys(DATA_GRID_PROPS_DEFAULT_VALUES).reduce((acc, key) => {
|
|
42
|
+
return Object.keys(_dataGridPropsDefaultValues.DATA_GRID_PROPS_DEFAULT_VALUES).reduce((acc, key) => {
|
|
102
43
|
// @ts-ignore
|
|
103
|
-
acc[key] = themedProps[key] ?? DATA_GRID_PROPS_DEFAULT_VALUES[key];
|
|
44
|
+
acc[key] = themedProps[key] ?? _dataGridPropsDefaultValues.DATA_GRID_PROPS_DEFAULT_VALUES[key];
|
|
104
45
|
return acc;
|
|
105
46
|
}, {});
|
|
106
47
|
}, [themedProps]);
|
|
@@ -21,6 +21,7 @@ const GridPaginationRoot = (0, _styles.styled)(_TablePagination.default)(({
|
|
|
21
21
|
}) => ({
|
|
22
22
|
maxHeight: 'calc(100% + 1px)',
|
|
23
23
|
// border width
|
|
24
|
+
flexGrow: 1,
|
|
24
25
|
[`& .${_TablePagination.tablePaginationClasses.selectLabel}`]: {
|
|
25
26
|
display: 'none',
|
|
26
27
|
[theme.breakpoints.up('sm')]: {
|
|
@@ -14,7 +14,6 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
14
14
|
var _utils = require("@mui/utils");
|
|
15
15
|
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
16
16
|
var _gridEditRowModel = require("../models/gridEditRowModel");
|
|
17
|
-
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
18
17
|
var _gridClasses = require("../constants/gridClasses");
|
|
19
18
|
var _composeGridClasses = require("../utils/composeGridClasses");
|
|
20
19
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
@@ -32,6 +31,7 @@ var _GridCell = require("./cell/GridCell");
|
|
|
32
31
|
var _GridScrollbarFillerCell = require("./GridScrollbarFillerCell");
|
|
33
32
|
var _getPinnedCellOffset = require("../internals/utils/getPinnedCellOffset");
|
|
34
33
|
var _useGridConfiguration = require("../hooks/utils/useGridConfiguration");
|
|
34
|
+
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
35
35
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
36
36
|
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
37
37
|
function EmptyCell({
|
|
@@ -48,6 +48,13 @@ function EmptyCell({
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
+
process.env.NODE_ENV !== "production" ? EmptyCell.propTypes = {
|
|
52
|
+
// ----------------------------- Warning --------------------------------
|
|
53
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
54
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
55
|
+
// ----------------------------------------------------------------------
|
|
56
|
+
width: _propTypes.default.number.isRequired
|
|
57
|
+
} : void 0;
|
|
51
58
|
const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
52
59
|
const {
|
|
53
60
|
selected,
|
|
@@ -75,7 +82,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
75
82
|
onMouseOver
|
|
76
83
|
} = props,
|
|
77
84
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
78
|
-
const apiRef = (0,
|
|
85
|
+
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
79
86
|
const configuration = (0, _useGridConfiguration.useGridConfiguration)();
|
|
80
87
|
const ref = React.useRef(null);
|
|
81
88
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -99,30 +106,17 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
99
106
|
const getRowAriaAttributes = configuration.hooks.useGridRowAriaAttributes();
|
|
100
107
|
React.useLayoutEffect(() => {
|
|
101
108
|
if (currentPage.range) {
|
|
102
|
-
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
103
|
-
// first row is 5 if `paginationModel.pageSize=5` and `paginationModel.page=1`. However, the index used by the virtualization
|
|
104
|
-
// doesn't care about pagination and considers the rows from the current page only, so the
|
|
105
|
-
// first row always has index=0. We need to subtract the index of the first row to make it
|
|
106
|
-
// compatible with the index used by the virtualization.
|
|
107
109
|
const rowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(rowId);
|
|
108
|
-
//
|
|
109
|
-
if (rowIndex
|
|
110
|
+
// Pinned rows are not part of the visible rows
|
|
111
|
+
if (rowIndex !== undefined) {
|
|
110
112
|
apiRef.current.unstable_setLastMeasuredRowIndex(rowIndex);
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (!rootElement || hasFixedHeight || typeof ResizeObserver === 'undefined') {
|
|
116
|
-
return undefined;
|
|
115
|
+
if (ref.current && rowHeight === 'auto') {
|
|
116
|
+
return apiRef.current.observeRowHeight(ref.current, rowId);
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
121
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
|
|
122
|
-
});
|
|
123
|
-
resizeObserver.observe(rootElement);
|
|
124
|
-
return () => resizeObserver.disconnect();
|
|
125
|
-
}, [apiRef, currentPage.range, index, rowHeight, rowId]);
|
|
118
|
+
return undefined;
|
|
119
|
+
}, [apiRef, currentPage.range, rowHeight, rowId]);
|
|
126
120
|
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
127
121
|
// Ignore portal
|
|
128
122
|
if ((0, _domUtils.isEventTargetInPortal)(event)) {
|
|
@@ -179,15 +173,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
179
173
|
disableColumnReorder
|
|
180
174
|
} = rootProps;
|
|
181
175
|
const rowReordering = rootProps.rowReordering;
|
|
182
|
-
const
|
|
183
|
-
let minHeight = rowHeight;
|
|
184
|
-
if (minHeight === 'auto' && sizes) {
|
|
185
|
-
const numberOfBaseSizes = 1;
|
|
186
|
-
const maximumSize = sizes.baseCenter ?? 0;
|
|
187
|
-
if (maximumSize > 0 && numberOfBaseSizes > 1) {
|
|
188
|
-
minHeight = maximumSize;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
176
|
+
const heightEntry = (0, _useGridSelector.useGridSelector)(apiRef, () => (0, _extends2.default)({}, apiRef.current.getRowHeightEntry(rowId)), _useGridSelector.objectShallowCompare);
|
|
191
177
|
const style = React.useMemo(() => {
|
|
192
178
|
if (isNotVisible) {
|
|
193
179
|
return {
|
|
@@ -199,25 +185,25 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
199
185
|
const rowStyle = (0, _extends2.default)({}, styleProp, {
|
|
200
186
|
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
201
187
|
// max-height doesn't support "auto"
|
|
202
|
-
minHeight,
|
|
188
|
+
minHeight: rowHeight,
|
|
203
189
|
'--height': typeof rowHeight === 'number' ? `${rowHeight}px` : rowHeight
|
|
204
190
|
});
|
|
205
|
-
if (
|
|
191
|
+
if (heightEntry.spacingTop) {
|
|
206
192
|
const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
207
|
-
rowStyle[property] =
|
|
193
|
+
rowStyle[property] = heightEntry.spacingTop;
|
|
208
194
|
}
|
|
209
|
-
if (
|
|
195
|
+
if (heightEntry.spacingBottom) {
|
|
210
196
|
const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
211
197
|
let propertyValue = rowStyle[property];
|
|
212
198
|
// avoid overriding existing value
|
|
213
199
|
if (typeof propertyValue !== 'number') {
|
|
214
200
|
propertyValue = parseInt(propertyValue || '0', 10);
|
|
215
201
|
}
|
|
216
|
-
propertyValue +=
|
|
202
|
+
propertyValue += heightEntry.spacingBottom;
|
|
217
203
|
rowStyle[property] = propertyValue;
|
|
218
204
|
}
|
|
219
205
|
return rowStyle;
|
|
220
|
-
}, [isNotVisible, rowHeight, styleProp,
|
|
206
|
+
}, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
|
|
221
207
|
const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
222
208
|
const ariaAttributes = rowNode ? getRowAriaAttributes(rowNode, index) : undefined;
|
|
223
209
|
if (typeof rootProps.getRowClassName === 'function') {
|
|
@@ -295,6 +281,9 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
295
281
|
for (let i = renderContext.firstColumnIndex; i < renderContext.lastColumnIndex; i += 1) {
|
|
296
282
|
const column = visibleColumns[i];
|
|
297
283
|
const indexInSection = i - pinnedColumns.left.length;
|
|
284
|
+
if (!column) {
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
298
287
|
cells.push(getCell(column, indexInSection, i, middleColumnsLength));
|
|
299
288
|
}
|
|
300
289
|
if (hasVirtualFocusCellRight) {
|
|
@@ -82,6 +82,14 @@ function GridOverlayWrapper(props) {
|
|
|
82
82
|
}, props))
|
|
83
83
|
}));
|
|
84
84
|
}
|
|
85
|
+
process.env.NODE_ENV !== "production" ? GridOverlayWrapper.propTypes = {
|
|
86
|
+
// ----------------------------- Warning --------------------------------
|
|
87
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
88
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
89
|
+
// ----------------------------------------------------------------------
|
|
90
|
+
loadingOverlayVariant: _propTypes.default.oneOf(['circular-progress', 'linear-progress', 'skeleton']),
|
|
91
|
+
overlayType: _propTypes.default.oneOf(['loadingOverlay', 'noResultsOverlay', 'noRowsOverlay'])
|
|
92
|
+
} : void 0;
|
|
85
93
|
process.env.NODE_ENV !== "production" ? GridOverlays.propTypes = {
|
|
86
94
|
// ----------------------------- Warning --------------------------------
|
|
87
95
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -100,6 +100,7 @@ function GridColumnHeaderItem(props) {
|
|
|
100
100
|
}, [apiRef, colDef.field]);
|
|
101
101
|
const mouseEventsHandlers = React.useMemo(() => ({
|
|
102
102
|
onClick: publish('columnHeaderClick'),
|
|
103
|
+
onContextMenu: publish('columnHeaderContextMenu'),
|
|
103
104
|
onDoubleClick: publish('columnHeaderDoubleClick'),
|
|
104
105
|
onMouseOver: publish('columnHeaderOver'),
|
|
105
106
|
// TODO remove as it's not used
|
|
@@ -520,6 +520,7 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
520
520
|
},
|
|
521
521
|
/* Cell styles */
|
|
522
522
|
[`& .${_gridClasses.gridClasses.cell}`]: {
|
|
523
|
+
flex: '0 0 auto',
|
|
523
524
|
height: 'var(--height)',
|
|
524
525
|
width: 'var(--width)',
|
|
525
526
|
lineHeight: 'calc(var(--height) - 1px)',
|