@mui/x-data-grid 7.20.0 → 7.22.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 +200 -31
- package/DataGrid/DataGrid.js +1 -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/cell/GridBooleanCell.d.ts +3 -3
- package/components/cell/GridBooleanCell.js +11 -1
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +1 -2
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/components/containers/GridRootStyles.js +5 -2
- package/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +2 -2
- package/components/panel/filterPanel/GridFilterInputValue.js +2 -2
- package/components/toolbar/GridToolbar.js +2 -3
- package/components/toolbar/GridToolbarExport.d.ts +9 -3
- package/components/toolbar/GridToolbarExport.js +43 -3
- package/components/toolbar/GridToolbarFilterButton.js +1 -2
- package/components/virtualization/GridBottomContainer.js +0 -17
- package/components/virtualization/GridMainContainer.js +2 -1
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +4 -2
- package/constants/dataGridPropsDefaultValues.d.ts +5 -0
- package/constants/dataGridPropsDefaultValues.js +60 -0
- package/constants/gridClasses.d.ts +5 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +6 -1
- package/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/hooks/features/columnMenu/useGridColumnMenuSlots.js +4 -3
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/hooks/features/dimensions/useGridDimensions.js +4 -2
- package/hooks/features/focus/useGridFocus.js +18 -3
- 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/pagination/gridPaginationSelector.js +2 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/hooks/features/rowSelection/utils.js +1 -1
- 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 +14 -1
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -1
- package/hooks/features/rows/useGridParamsApi.js +4 -3
- package/hooks/features/rows/useGridRowsMeta.js +135 -154
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.js +3 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +25 -10
- package/hooks/utils/useGridApiMethod.js +2 -1
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +2 -1
- package/joy/joySlots.js +45 -27
- package/locales/daDK.js +5 -6
- package/locales/itIT.js +27 -28
- package/locales/ptBR.js +4 -4
- package/material/index.js +4 -0
- 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/gridApiCaches.d.ts +2 -0
- package/models/gridExport.d.ts +1 -1
- package/models/gridSlotsComponent.d.ts +10 -0
- package/models/gridSlotsComponentsProps.d.ts +9 -0
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/props/DataGridProps.d.ts +14 -3
- package/modern/DataGrid/DataGrid.js +1 -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/cell/GridBooleanCell.js +11 -1
- package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +1 -2
- package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/modern/components/containers/GridRootStyles.js +5 -2
- package/modern/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +2 -2
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +2 -2
- package/modern/components/toolbar/GridToolbar.js +2 -3
- package/modern/components/toolbar/GridToolbarExport.js +43 -3
- package/modern/components/toolbar/GridToolbarFilterButton.js +1 -2
- package/modern/components/virtualization/GridBottomContainer.js +0 -17
- package/modern/components/virtualization/GridMainContainer.js +2 -1
- package/modern/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +4 -2
- package/modern/constants/dataGridPropsDefaultValues.js +60 -0
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/modern/hooks/features/columnMenu/useGridColumnMenuSlots.js +4 -3
- package/modern/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/modern/hooks/features/dimensions/useGridDimensions.js +4 -2
- package/modern/hooks/features/focus/useGridFocus.js +18 -3
- 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/pagination/gridPaginationSelector.js +2 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/modern/hooks/features/rowSelection/utils.js +1 -1
- package/modern/hooks/features/rows/gridRowsMetaInterfaces.js +1 -0
- package/modern/hooks/features/rows/gridRowsUtils.js +14 -1
- package/modern/hooks/features/rows/useGridParamsApi.js +4 -3
- package/modern/hooks/features/rows/useGridRowsMeta.js +135 -154
- package/modern/hooks/features/scroll/useGridScroll.js +3 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +25 -10
- package/modern/hooks/utils/useGridApiMethod.js +2 -1
- package/modern/index.js +2 -1
- package/modern/internals/index.js +2 -1
- package/modern/joy/joySlots.js +45 -27
- package/modern/locales/daDK.js +5 -6
- package/modern/locales/itIT.js +27 -28
- package/modern/locales/ptBR.js +4 -4
- package/modern/material/index.js +4 -0
- package/modern/utils/ResizeObserver.js +10 -0
- package/modern/utils/keyboardUtils.js +12 -4
- package/node/DataGrid/DataGrid.js +1 -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/cell/GridBooleanCell.js +11 -1
- package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +1 -2
- package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/node/components/containers/GridRootStyles.js +5 -2
- package/node/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +2 -2
- package/node/components/panel/filterPanel/GridFilterInputValue.js +2 -2
- package/node/components/toolbar/GridToolbar.js +2 -3
- package/node/components/toolbar/GridToolbarExport.js +40 -0
- package/node/components/toolbar/GridToolbarFilterButton.js +1 -2
- package/node/components/virtualization/GridBottomContainer.js +0 -17
- package/node/components/virtualization/GridMainContainer.js +2 -1
- package/node/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +4 -2
- package/node/constants/dataGridPropsDefaultValues.js +66 -0
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/node/hooks/features/columnMenu/useGridColumnMenuSlots.js +4 -3
- package/node/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -1
- package/node/hooks/features/focus/useGridFocus.js +18 -3
- 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/pagination/gridPaginationSelector.js +3 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/node/hooks/features/rowSelection/utils.js +1 -1
- package/node/hooks/features/rows/gridRowsMetaInterfaces.js +5 -0
- package/node/hooks/features/rows/gridRowsUtils.js +16 -2
- package/node/hooks/features/rows/useGridParamsApi.js +4 -3
- package/node/hooks/features/rows/useGridRowsMeta.js +136 -154
- package/node/hooks/features/scroll/useGridScroll.js +3 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +25 -10
- package/node/hooks/utils/useGridApiMethod.js +3 -1
- package/node/index.js +13 -1
- package/node/internals/index.js +22 -0
- package/node/joy/joySlots.js +45 -27
- package/node/locales/daDK.js +5 -6
- package/node/locales/itIT.js +27 -28
- package/node/locales/ptBR.js +4 -4
- package/node/material/index.js +4 -0
- package/node/utils/ResizeObserver.js +16 -0
- package/node/utils/keyboardUtils.js +15 -5
- package/package.json +2 -2
- package/utils/ResizeObserver.d.ts +4 -0
- package/utils/ResizeObserver.js +10 -0
- package/utils/keyboardUtils.d.ts +1 -0
- package/utils/keyboardUtils.js +12 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { GridEditModes } from "../models/gridEditRowModel.js";
|
|
2
|
+
/**
|
|
3
|
+
* The default values of `DataGridPropsWithDefaultValues` to inject in the props of DataGrid.
|
|
4
|
+
*/
|
|
5
|
+
export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
6
|
+
autoHeight: false,
|
|
7
|
+
autoPageSize: false,
|
|
8
|
+
autosizeOnMount: false,
|
|
9
|
+
checkboxSelection: false,
|
|
10
|
+
checkboxSelectionVisibleOnly: false,
|
|
11
|
+
clipboardCopyCellDelimiter: '\t',
|
|
12
|
+
columnBufferPx: 150,
|
|
13
|
+
columnHeaderHeight: 56,
|
|
14
|
+
disableAutosize: false,
|
|
15
|
+
disableColumnFilter: false,
|
|
16
|
+
disableColumnMenu: false,
|
|
17
|
+
disableColumnReorder: false,
|
|
18
|
+
disableColumnResize: false,
|
|
19
|
+
disableColumnSelector: false,
|
|
20
|
+
disableColumnSorting: false,
|
|
21
|
+
disableDensitySelector: false,
|
|
22
|
+
disableEval: false,
|
|
23
|
+
disableMultipleColumnsFiltering: false,
|
|
24
|
+
disableMultipleColumnsSorting: false,
|
|
25
|
+
disableMultipleRowSelection: false,
|
|
26
|
+
disableRowSelectionOnClick: false,
|
|
27
|
+
disableVirtualization: false,
|
|
28
|
+
editMode: GridEditModes.Cell,
|
|
29
|
+
filterDebounceMs: 150,
|
|
30
|
+
filterMode: 'client',
|
|
31
|
+
hideFooter: false,
|
|
32
|
+
hideFooterPagination: false,
|
|
33
|
+
hideFooterRowCount: false,
|
|
34
|
+
hideFooterSelectedRowCount: false,
|
|
35
|
+
ignoreDiacritics: false,
|
|
36
|
+
ignoreValueFormatterDuringExport: false,
|
|
37
|
+
// TODO v8: Update to 'select'
|
|
38
|
+
indeterminateCheckboxAction: 'deselect',
|
|
39
|
+
keepColumnPositionIfDraggedOutside: false,
|
|
40
|
+
keepNonExistentRowsSelected: false,
|
|
41
|
+
loading: false,
|
|
42
|
+
logger: console,
|
|
43
|
+
logLevel: process.env.NODE_ENV === 'production' ? 'error' : 'warn',
|
|
44
|
+
pageSizeOptions: [25, 50, 100],
|
|
45
|
+
pagination: false,
|
|
46
|
+
paginationMode: 'client',
|
|
47
|
+
resizeThrottleMs: 60,
|
|
48
|
+
rowBufferPx: 150,
|
|
49
|
+
rowHeight: 52,
|
|
50
|
+
rowPositionsDebounceMs: 166,
|
|
51
|
+
rows: [],
|
|
52
|
+
rowSelection: true,
|
|
53
|
+
rowSpacingType: 'margin',
|
|
54
|
+
showCellVerticalBorder: false,
|
|
55
|
+
showColumnVerticalBorder: false,
|
|
56
|
+
sortingMode: 'client',
|
|
57
|
+
sortingOrder: ['asc', 'desc', null],
|
|
58
|
+
throttleRowsMs: 0,
|
|
59
|
+
unstable_rowSpanning: false
|
|
60
|
+
};
|
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hasSkeletonLoadingOverlay', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--lastUnpinned', 'columnHeader--siblingFocused', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hasSkeletonLoadingOverlay', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--borderBottom', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { useGridApiOptionHandler, useGridNativeEventListener } from "../../utils/index.js";
|
|
3
3
|
import { gridFocusCellSelector } from "../focus/gridFocusStateSelector.js";
|
|
4
4
|
import { serializeCellValue } from "../export/serializers/csvSerializer.js";
|
|
5
|
+
import { isCopyShortcut } from "../../../utils/keyboardUtils.js";
|
|
5
6
|
function writeToClipboardPolyfill(data) {
|
|
6
7
|
const span = document.createElement('span');
|
|
7
8
|
span.style.whiteSpace = 'pre';
|
|
@@ -53,7 +54,7 @@ export const useGridClipboard = (apiRef, props) => {
|
|
|
53
54
|
const ignoreValueFormatter = (typeof ignoreValueFormatterProp === 'object' ? ignoreValueFormatterProp?.clipboardExport : ignoreValueFormatterProp) || false;
|
|
54
55
|
const clipboardCopyCellDelimiter = props.clipboardCopyCellDelimiter;
|
|
55
56
|
const handleCopy = React.useCallback(event => {
|
|
56
|
-
if (!(
|
|
57
|
+
if (!isCopyShortcut(event)) {
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -56,7 +56,9 @@ export const useGridColumnHeaders = props => {
|
|
|
56
56
|
const offsetLeft = computeOffsetLeft(columnPositions, renderContext, pinnedColumns.left.length);
|
|
57
57
|
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
58
58
|
React.useEffect(() => {
|
|
59
|
-
apiRef.current.columnHeadersContainerRef.current
|
|
59
|
+
if (apiRef.current.columnHeadersContainerRef.current) {
|
|
60
|
+
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
61
|
+
}
|
|
60
62
|
}, [apiRef]);
|
|
61
63
|
const handleColumnResizeStart = React.useCallback(params => setResizeCol(params.field), []);
|
|
62
64
|
const handleColumnResizeStop = React.useCallback(() => setResizeCol(''), []);
|
|
@@ -2,10 +2,11 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["displayOrder"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import
|
|
5
|
+
import { useGridRootProps } from "../../utils/useGridRootProps.js";
|
|
6
6
|
import { useGridPrivateApiContext } from "../../utils/useGridPrivateApiContext.js";
|
|
7
7
|
const useGridColumnMenuSlots = props => {
|
|
8
8
|
const apiRef = useGridPrivateApiContext();
|
|
9
|
+
const rootProps = useGridRootProps();
|
|
9
10
|
const {
|
|
10
11
|
defaultSlots,
|
|
11
12
|
defaultSlotProps,
|
|
@@ -51,8 +52,8 @@ const useGridColumnMenuSlots = props => {
|
|
|
51
52
|
const customProps = _objectWithoutPropertiesLoose(processedComponentProps, _excluded);
|
|
52
53
|
itemProps = _extends({}, itemProps, customProps);
|
|
53
54
|
}
|
|
54
|
-
return addDividers && index !== sorted.length - 1 ? [...acc, [processedComponents[key], itemProps], [
|
|
55
|
+
return addDividers && index !== sorted.length - 1 ? [...acc, [processedComponents[key], itemProps], [rootProps.slots.baseDivider, {}]] : [...acc, [processedComponents[key], itemProps]];
|
|
55
56
|
}, []);
|
|
56
|
-
}, [addDividers, colDef, defaultItems, hideMenu, processedComponents, processedSlotProps, userItems]);
|
|
57
|
+
}, [addDividers, colDef, defaultItems, hideMenu, processedComponents, processedSlotProps, userItems, rootProps.slots.baseDivider]);
|
|
57
58
|
};
|
|
58
59
|
export { useGridColumnMenuSlots };
|
|
@@ -312,6 +312,9 @@ export function getFirstNonSpannedColumnToRender({
|
|
|
312
312
|
return firstNonSpannedColumnToRender;
|
|
313
313
|
}
|
|
314
314
|
export function getTotalHeaderHeight(apiRef, props) {
|
|
315
|
+
if (props.unstable_listView) {
|
|
316
|
+
return 0;
|
|
317
|
+
}
|
|
315
318
|
const densityFactor = gridDensityFactorSelector(apiRef);
|
|
316
319
|
const maxDepth = gridColumnGroupsHeaderMaxDepthSelector(apiRef);
|
|
317
320
|
const isHeaderFilteringEnabled = gridHeaderFilteringEnabledSelector(apiRef);
|
|
@@ -12,8 +12,9 @@ import { gridRenderContextSelector } from "../virtualization/index.js";
|
|
|
12
12
|
import { useGridSelector } from "../../utils/index.js";
|
|
13
13
|
import { getVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
14
14
|
import { gridRowsMetaSelector } from "../rows/gridRowsMetaSelector.js";
|
|
15
|
-
import { calculatePinnedRowsHeight } from "../rows/gridRowsUtils.js";
|
|
15
|
+
import { calculatePinnedRowsHeight, getValidRowHeight, rowHeightWarning } from "../rows/gridRowsUtils.js";
|
|
16
16
|
import { getTotalHeaderHeight } from "../columns/gridColumnsUtils.js";
|
|
17
|
+
import { DATA_GRID_PROPS_DEFAULT_VALUES } from "../../../constants/dataGridPropsDefaultValues.js";
|
|
17
18
|
const EMPTY_SIZE = {
|
|
18
19
|
width: 0,
|
|
19
20
|
height: 0
|
|
@@ -54,7 +55,8 @@ export function useGridDimensions(apiRef, props) {
|
|
|
54
55
|
const rowsMeta = useGridSelector(apiRef, gridRowsMetaSelector);
|
|
55
56
|
const pinnedColumns = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
|
|
56
57
|
const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
|
|
57
|
-
const
|
|
58
|
+
const validRowHeight = React.useMemo(() => getValidRowHeight(props.rowHeight, DATA_GRID_PROPS_DEFAULT_VALUES.rowHeight, rowHeightWarning), [props.rowHeight]);
|
|
59
|
+
const rowHeight = Math.floor(validRowHeight * densityFactor);
|
|
58
60
|
const headerHeight = Math.floor(props.columnHeaderHeight * densityFactor);
|
|
59
61
|
const groupHeaderHeight = Math.floor((props.columnGroupHeaderHeight ?? props.columnHeaderHeight) * densityFactor);
|
|
60
62
|
const headerFilterHeight = Math.floor((props.headerFilterHeight ?? props.columnHeaderHeight) * densityFactor);
|
|
@@ -323,18 +323,33 @@ export const useGridFocus = (apiRef, props) => {
|
|
|
323
323
|
const handleRowSet = React.useCallback(() => {
|
|
324
324
|
const cell = gridFocusCellSelector(apiRef);
|
|
325
325
|
|
|
326
|
-
// If the focused cell is in a row which does not exist anymore,
|
|
326
|
+
// If the focused cell is in a row which does not exist anymore,
|
|
327
|
+
// focus previous row or remove the focus
|
|
327
328
|
if (cell && !apiRef.current.getRow(cell.id)) {
|
|
329
|
+
const lastFocusedRowId = gridFocusCellSelector(apiRef)?.id;
|
|
330
|
+
let nextRowId = null;
|
|
331
|
+
if (typeof lastFocusedRowId !== 'undefined') {
|
|
332
|
+
const lastFocusedRowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(lastFocusedRowId);
|
|
333
|
+
const currentPage = getVisibleRows(apiRef, {
|
|
334
|
+
pagination: props.pagination,
|
|
335
|
+
paginationMode: props.paginationMode
|
|
336
|
+
});
|
|
337
|
+
const nextRow = currentPage.rows[clamp(lastFocusedRowIndex, 0, currentPage.rows.length - 1)];
|
|
338
|
+
nextRowId = nextRow.id ?? null;
|
|
339
|
+
}
|
|
328
340
|
apiRef.current.setState(state => _extends({}, state, {
|
|
329
341
|
focus: {
|
|
330
|
-
cell: null
|
|
342
|
+
cell: nextRowId === null ? null : {
|
|
343
|
+
id: nextRowId,
|
|
344
|
+
field: cell.field
|
|
345
|
+
},
|
|
331
346
|
columnHeader: null,
|
|
332
347
|
columnHeaderFilter: null,
|
|
333
348
|
columnGroupHeader: null
|
|
334
349
|
}
|
|
335
350
|
}));
|
|
336
351
|
}
|
|
337
|
-
}, [apiRef]);
|
|
352
|
+
}, [apiRef, props.pagination, props.paginationMode]);
|
|
338
353
|
const handlePaginationModelChange = useEventcallback(() => {
|
|
339
354
|
const currentFocusedCell = gridFocusCellSelector(apiRef);
|
|
340
355
|
if (!currentFocusedCell) {
|
|
@@ -16,6 +16,7 @@ import { gridHeaderFilteringEditFieldSelector, gridHeaderFilteringMenuSelector }
|
|
|
16
16
|
import { useGridRegisterPipeProcessor } from "../../core/pipeProcessing/index.js";
|
|
17
17
|
import { isEventTargetInPortal } from "../../../utils/domUtils.js";
|
|
18
18
|
import { enrichPageRowsWithPinnedRows, getLeftColumnIndex, getRightColumnIndex, findNonRowSpannedCell } from "./utils.js";
|
|
19
|
+
import { gridListColumnSelector } from "../listView/gridListViewSelectors.js";
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* @requires useGridSorting (method) - can be after
|
|
@@ -30,6 +31,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
30
31
|
const logger = useGridLogger(apiRef, 'useGridKeyboardNavigation');
|
|
31
32
|
const initialCurrentPageRows = useGridVisibleRows(apiRef, props).rows;
|
|
32
33
|
const isRtl = useRtl();
|
|
34
|
+
const listView = props.unstable_listView;
|
|
33
35
|
const currentPageRows = React.useMemo(() => enrichPageRowsWithPinnedRows(apiRef, initialCurrentPageRows), [apiRef, initialCurrentPageRows]);
|
|
34
36
|
const headerFilteringEnabled = props.signature !== 'DataGrid' && props.headerFilters;
|
|
35
37
|
|
|
@@ -50,7 +52,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
50
52
|
colIndex = nextCellColSpanInfo.rightVisibleCellIndex;
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
|
-
const field = gridVisibleColumnFieldsSelector(apiRef)[colIndex];
|
|
55
|
+
const field = listView ? gridListColumnSelector(apiRef.current.state).field : gridVisibleColumnFieldsSelector(apiRef)[colIndex];
|
|
54
56
|
const nonRowSpannedRowId = findNonRowSpannedCell(apiRef, rowId, field, rowSpanScanDirection);
|
|
55
57
|
// `scrollToIndexes` requires a rowIndex relative to all visible rows.
|
|
56
58
|
// Those rows do not include pinned rows, but pinned rows do not need scroll anyway.
|
|
@@ -61,7 +63,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
61
63
|
rowIndex: rowIndexRelativeToAllRows
|
|
62
64
|
});
|
|
63
65
|
apiRef.current.setCellFocus(nonRowSpannedRowId, field);
|
|
64
|
-
}, [apiRef, logger]);
|
|
66
|
+
}, [apiRef, logger, listView]);
|
|
65
67
|
const goToHeader = React.useCallback((colIndex, event) => {
|
|
66
68
|
logger.debug(`Navigating to header col ${colIndex}`);
|
|
67
69
|
apiRef.current.scrollToIndexes({
|
|
@@ -384,12 +386,14 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
384
386
|
return;
|
|
385
387
|
}
|
|
386
388
|
const viewportPageSize = apiRef.current.getViewportPageSize();
|
|
387
|
-
const
|
|
389
|
+
const getColumnIndexFn = listView ? () => 0 : apiRef.current.getColumnIndex;
|
|
390
|
+
const colIndexBefore = params.field ? getColumnIndexFn(params.field) : 0;
|
|
388
391
|
const rowIndexBefore = currentPageRows.findIndex(row => row.id === params.id);
|
|
389
392
|
const firstRowIndexInPage = 0;
|
|
390
393
|
const lastRowIndexInPage = currentPageRows.length - 1;
|
|
391
394
|
const firstColIndex = 0;
|
|
392
|
-
const
|
|
395
|
+
const visibleColumns = listView ? [gridListColumnSelector(apiRef.current.state)] : gridVisibleColumnDefinitionsSelector(apiRef);
|
|
396
|
+
const lastColIndex = visibleColumns.length - 1;
|
|
393
397
|
let shouldPreventDefault = true;
|
|
394
398
|
switch (event.key) {
|
|
395
399
|
case 'ArrowDown':
|
|
@@ -508,7 +512,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
|
|
|
508
512
|
if (shouldPreventDefault) {
|
|
509
513
|
event.preventDefault();
|
|
510
514
|
}
|
|
511
|
-
}, [apiRef, currentPageRows, isRtl, goToCell, getRowIdFromIndex, headerFilteringEnabled, goToHeaderFilter, goToHeader]);
|
|
515
|
+
}, [apiRef, currentPageRows, isRtl, goToCell, getRowIdFromIndex, headerFilteringEnabled, goToHeaderFilter, goToHeader, listView]);
|
|
512
516
|
const checkIfCanStartEditing = React.useCallback((initialValue, {
|
|
513
517
|
event
|
|
514
518
|
}) => {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { gridDimensionsSelector } from "../dimensions/index.js";
|
|
4
|
+
import { useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
|
|
5
|
+
export const listViewStateInitializer = (state, props, apiRef) => _extends({}, state, {
|
|
6
|
+
listViewColumn: _extends({}, props.unstable_listColumn, {
|
|
7
|
+
computedWidth: getListColumnWidth(apiRef)
|
|
8
|
+
})
|
|
9
|
+
});
|
|
10
|
+
export function useGridListView(apiRef, props) {
|
|
11
|
+
/*
|
|
12
|
+
* EVENTS
|
|
13
|
+
*/
|
|
14
|
+
const updateListColumnWidth = () => {
|
|
15
|
+
apiRef.current.setState(state => {
|
|
16
|
+
if (!state.listViewColumn) {
|
|
17
|
+
return state;
|
|
18
|
+
}
|
|
19
|
+
return _extends({}, state, {
|
|
20
|
+
listViewColumn: _extends({}, state.listViewColumn, {
|
|
21
|
+
computedWidth: getListColumnWidth(apiRef)
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const prevInnerWidth = React.useRef(null);
|
|
27
|
+
const handleGridSizeChange = viewportInnerSize => {
|
|
28
|
+
if (prevInnerWidth.current !== viewportInnerSize.width) {
|
|
29
|
+
prevInnerWidth.current = viewportInnerSize.width;
|
|
30
|
+
updateListColumnWidth();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
useGridApiEventHandler(apiRef, 'viewportInnerSizeChange', handleGridSizeChange);
|
|
34
|
+
useGridApiEventHandler(apiRef, 'columnVisibilityModelChange', updateListColumnWidth);
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* EFFECTS
|
|
38
|
+
*/
|
|
39
|
+
React.useEffect(() => {
|
|
40
|
+
const listColumn = props.unstable_listColumn;
|
|
41
|
+
if (listColumn) {
|
|
42
|
+
apiRef.current.setState(state => {
|
|
43
|
+
return _extends({}, state, {
|
|
44
|
+
listViewColumn: _extends({}, listColumn, {
|
|
45
|
+
computedWidth: getListColumnWidth(apiRef)
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}, [apiRef, props.unstable_listColumn]);
|
|
51
|
+
}
|
|
52
|
+
function getListColumnWidth(apiRef) {
|
|
53
|
+
return gridDimensionsSelector(apiRef.current.state).viewportInnerSize.width;
|
|
54
|
+
}
|
|
@@ -2,6 +2,7 @@ import { createSelector, createSelectorMemoized } from "../../../utils/createSel
|
|
|
2
2
|
import { gridExpandedSortedRowEntriesSelector, gridExpandedSortedRowIdsSelector, gridFilteredSortedTopLevelRowEntriesSelector } from "../filter/gridFilterSelector.js";
|
|
3
3
|
import { gridRowMaximumTreeDepthSelector, gridRowTreeSelector } from "../rows/gridRowsSelector.js";
|
|
4
4
|
import { getPageCount } from "./gridPaginationUtils.js";
|
|
5
|
+
const ALL_RESULTS_PAGE_VALUE = -1;
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @category Pagination
|
|
@@ -52,7 +53,7 @@ export const gridPageCountSelector = createSelector(gridPaginationModelSelector,
|
|
|
52
53
|
export const gridPaginationRowRangeSelector = createSelectorMemoized(gridPaginationModelSelector, gridRowTreeSelector, gridRowMaximumTreeDepthSelector, gridExpandedSortedRowEntriesSelector, gridFilteredSortedTopLevelRowEntriesSelector, (paginationModel, rowTree, rowTreeDepth, visibleSortedRowEntries, visibleSortedTopLevelRowEntries) => {
|
|
53
54
|
const visibleTopLevelRowCount = visibleSortedTopLevelRowEntries.length;
|
|
54
55
|
const topLevelFirstRowIndex = Math.min(paginationModel.pageSize * paginationModel.page, visibleTopLevelRowCount - 1);
|
|
55
|
-
const topLevelLastRowIndex = Math.min(topLevelFirstRowIndex + paginationModel.pageSize - 1, visibleTopLevelRowCount - 1);
|
|
56
|
+
const topLevelLastRowIndex = paginationModel.pageSize === ALL_RESULTS_PAGE_VALUE ? visibleTopLevelRowCount - 1 : Math.min(topLevelFirstRowIndex + paginationModel.pageSize - 1, visibleTopLevelRowCount - 1);
|
|
56
57
|
|
|
57
58
|
// The range contains no element
|
|
58
59
|
if (topLevelFirstRowIndex === -1 || topLevelLastRowIndex === -1) {
|
|
@@ -246,7 +246,11 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
246
246
|
/*
|
|
247
247
|
* EVENTS
|
|
248
248
|
*/
|
|
249
|
+
const isFirstRender = React.useRef(true);
|
|
249
250
|
const removeOutdatedSelection = React.useCallback((sortModelUpdated = false) => {
|
|
251
|
+
if (isFirstRender.current) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
250
254
|
const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
|
|
251
255
|
const filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
|
|
252
256
|
|
|
@@ -254,7 +258,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
254
258
|
const selectionLookup = _extends({}, selectedIdsLookupSelector(apiRef));
|
|
255
259
|
let hasChanged = false;
|
|
256
260
|
currentSelection.forEach(id => {
|
|
257
|
-
if (filteredRowsLookup[id]
|
|
261
|
+
if (filteredRowsLookup[id] !== true) {
|
|
258
262
|
if (props.keepNonExistentRowsSelected) {
|
|
259
263
|
return;
|
|
260
264
|
}
|
|
@@ -408,7 +412,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
408
412
|
handleSingleRowSelection(params.id, event);
|
|
409
413
|
return;
|
|
410
414
|
}
|
|
411
|
-
if (event.
|
|
415
|
+
if (String.fromCharCode(event.keyCode) === 'A' && (event.ctrlKey || event.metaKey)) {
|
|
412
416
|
event.preventDefault();
|
|
413
417
|
selectRows(apiRef.current.getAllRowIds(), true);
|
|
414
418
|
}
|
|
@@ -462,4 +466,9 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
462
466
|
React.useEffect(() => {
|
|
463
467
|
runIfRowSelectionIsEnabled(removeOutdatedSelection);
|
|
464
468
|
}, [removeOutdatedSelection, runIfRowSelectionIsEnabled]);
|
|
469
|
+
React.useEffect(() => {
|
|
470
|
+
if (isFirstRender.current) {
|
|
471
|
+
isFirstRender.current = false;
|
|
472
|
+
}
|
|
473
|
+
}, []);
|
|
465
474
|
};
|
|
@@ -57,7 +57,7 @@ export function getCheckboxPropsSelector(groupId, autoSelectParents) {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
return {
|
|
60
|
-
isIndeterminate: selectedDescendantsCount > 0 && selectedDescendantsCount < selectableDescendantsCount ||
|
|
60
|
+
isIndeterminate: selectedDescendantsCount > 0 && (selectedDescendantsCount < selectableDescendantsCount || rowSelectionLookup[groupId] === undefined),
|
|
61
61
|
isChecked: autoSelectParents ? selectedDescendantsCount > 0 : rowSelectionLookup[groupId] === groupId
|
|
62
62
|
};
|
|
63
63
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -306,4 +306,17 @@ export function computeRowsUpdates(apiRef, updates, getRowId) {
|
|
|
306
306
|
}
|
|
307
307
|
});
|
|
308
308
|
return nonPinnedRowsUpdates;
|
|
309
|
-
}
|
|
309
|
+
}
|
|
310
|
+
let warnedOnceInvalidRowHeight = false;
|
|
311
|
+
export const getValidRowHeight = (rowHeightProp, defaultRowHeight, warningMessage) => {
|
|
312
|
+
if (typeof rowHeightProp === 'number' && rowHeightProp > 0) {
|
|
313
|
+
return rowHeightProp;
|
|
314
|
+
}
|
|
315
|
+
if (process.env.NODE_ENV !== 'production' && !warnedOnceInvalidRowHeight && typeof rowHeightProp !== 'undefined' && rowHeightProp !== null) {
|
|
316
|
+
console.warn(warningMessage);
|
|
317
|
+
warnedOnceInvalidRowHeight = true;
|
|
318
|
+
}
|
|
319
|
+
return defaultRowHeight;
|
|
320
|
+
};
|
|
321
|
+
export const rowHeightWarning = [`MUI X: The \`rowHeight\` prop should be a number greater than 0.`, `The default value will be used instead.`].join('\n');
|
|
322
|
+
export const getRowHeightWarning = [`MUI X: The \`getRowHeight\` prop should return a number greater than 0 or 'auto'.`, `The default value will be used instead.`].join('\n');
|
|
@@ -2,6 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { getGridCellElement, getGridColumnHeaderElement, getGridRowElement } from "../../../utils/domUtils.js";
|
|
3
3
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
4
4
|
import { gridFocusCellSelector, gridTabIndexCellSelector } from "../focus/gridFocusStateSelector.js";
|
|
5
|
+
import { gridListColumnSelector } from "../listView/gridListViewSelectors.js";
|
|
5
6
|
export class MissingRowIdError extends Error {}
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -12,7 +13,7 @@ export class MissingRowIdError extends Error {}
|
|
|
12
13
|
* TODO: Impossible priority - useGridEditing also needs to be after useGridParamsApi
|
|
13
14
|
* TODO: Impossible priority - useGridFocus also needs to be after useGridParamsApi
|
|
14
15
|
*/
|
|
15
|
-
export function useGridParamsApi(apiRef) {
|
|
16
|
+
export function useGridParamsApi(apiRef, props) {
|
|
16
17
|
const getColumnHeaderParams = React.useCallback(field => ({
|
|
17
18
|
field,
|
|
18
19
|
colDef: apiRef.current.getColumn(field)
|
|
@@ -30,7 +31,7 @@ export function useGridParamsApi(apiRef) {
|
|
|
30
31
|
return params;
|
|
31
32
|
}, [apiRef]);
|
|
32
33
|
const getCellParams = React.useCallback((id, field) => {
|
|
33
|
-
const colDef = apiRef.current.getColumn(field);
|
|
34
|
+
const colDef = props.unstable_listView ? gridListColumnSelector(apiRef.current.state) : apiRef.current.getColumn(field);
|
|
34
35
|
const row = apiRef.current.getRow(id);
|
|
35
36
|
const rowNode = apiRef.current.getRowNode(id);
|
|
36
37
|
if (!row || !rowNode) {
|
|
@@ -59,7 +60,7 @@ export function useGridParamsApi(apiRef) {
|
|
|
59
60
|
}
|
|
60
61
|
params.isEditable = colDef && apiRef.current.isCellEditable(params);
|
|
61
62
|
return params;
|
|
62
|
-
}, [apiRef]);
|
|
63
|
+
}, [apiRef, props.unstable_listView]);
|
|
63
64
|
const getCellValue = React.useCallback((id, field) => {
|
|
64
65
|
const colDef = apiRef.current.getColumn(field);
|
|
65
66
|
const row = apiRef.current.getRow(id);
|