@mui/x-data-grid 7.1.0 → 7.2.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +261 -4
  2. package/README.md +1 -1
  3. package/components/GridRow.js +3 -1
  4. package/components/cell/GridCell.d.ts +1 -0
  5. package/components/cell/GridCell.js +4 -3
  6. package/components/columnHeaders/GridColumnGroupHeader.d.ts +1 -0
  7. package/components/columnHeaders/GridColumnGroupHeader.js +3 -2
  8. package/components/columnHeaders/GridColumnHeaderItem.d.ts +1 -0
  9. package/components/columnHeaders/GridColumnHeaderItem.js +4 -2
  10. package/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
  11. package/components/containers/GridRootStyles.js +5 -3
  12. package/components/panel/filterPanel/GridFilterInputDate.js +5 -1
  13. package/components/virtualization/GridMainContainer.js +8 -1
  14. package/components/virtualization/GridTopContainer.js +1 -0
  15. package/constants/gridClasses.d.ts +5 -0
  16. package/constants/gridClasses.js +1 -1
  17. package/hooks/core/useGridInitialization.js +1 -1
  18. package/hooks/core/useGridStateInitialization.d.ts +1 -2
  19. package/hooks/core/useGridStateInitialization.js +6 -10
  20. package/hooks/features/columnHeaders/useGridColumnHeaders.js +7 -3
  21. package/hooks/features/editing/useGridCellEditing.js +3 -1
  22. package/hooks/features/editing/useGridRowEditing.js +3 -1
  23. package/hooks/features/export/serializers/csvSerializer.js +6 -5
  24. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
  25. package/hooks/features/headerFiltering/useGridHeaderFiltering.js +4 -7
  26. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
  27. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -3
  28. package/hooks/features/virtualization/useGridVirtualScroller.js +17 -6
  29. package/index.js +1 -1
  30. package/internals/index.d.ts +1 -1
  31. package/internals/utils/propValidation.d.ts +1 -0
  32. package/internals/utils/propValidation.js +9 -4
  33. package/locales/deDE.js +3 -4
  34. package/locales/esES.js +3 -4
  35. package/locales/faIR.js +3 -4
  36. package/locales/frFR.js +5 -6
  37. package/locales/ptBR.js +3 -4
  38. package/locales/svSE.js +3 -4
  39. package/models/api/gridCallbackDetails.d.ts +5 -0
  40. package/models/gridExport.d.ts +2 -2
  41. package/models/gridFilterModel.d.ts +3 -3
  42. package/models/params/gridCellParams.d.ts +0 -22
  43. package/models/props/DataGridProps.d.ts +19 -0
  44. package/modern/components/GridRow.js +3 -1
  45. package/modern/components/cell/GridCell.js +4 -3
  46. package/modern/components/columnHeaders/GridColumnGroupHeader.js +3 -2
  47. package/modern/components/columnHeaders/GridColumnHeaderItem.js +4 -2
  48. package/modern/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
  49. package/modern/components/containers/GridRootStyles.js +5 -3
  50. package/modern/components/panel/filterPanel/GridFilterInputDate.js +5 -1
  51. package/modern/components/virtualization/GridMainContainer.js +8 -1
  52. package/modern/components/virtualization/GridTopContainer.js +1 -0
  53. package/modern/constants/gridClasses.js +1 -1
  54. package/modern/hooks/core/useGridInitialization.js +1 -1
  55. package/modern/hooks/core/useGridStateInitialization.js +6 -10
  56. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +7 -3
  57. package/modern/hooks/features/editing/useGridCellEditing.js +3 -1
  58. package/modern/hooks/features/editing/useGridRowEditing.js +3 -1
  59. package/modern/hooks/features/export/serializers/csvSerializer.js +6 -5
  60. package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +4 -7
  61. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -3
  62. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +17 -6
  63. package/modern/index.js +1 -1
  64. package/modern/internals/utils/propValidation.js +9 -4
  65. package/modern/locales/deDE.js +3 -4
  66. package/modern/locales/esES.js +3 -4
  67. package/modern/locales/faIR.js +3 -4
  68. package/modern/locales/frFR.js +5 -6
  69. package/modern/locales/ptBR.js +3 -4
  70. package/modern/locales/svSE.js +3 -4
  71. package/modern/utils/cellBorderUtils.js +15 -2
  72. package/node/components/GridRow.js +3 -1
  73. package/node/components/cell/GridCell.js +4 -3
  74. package/node/components/columnHeaders/GridColumnGroupHeader.js +3 -2
  75. package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -2
  76. package/node/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
  77. package/node/components/containers/GridRootStyles.js +5 -3
  78. package/node/components/panel/filterPanel/GridFilterInputDate.js +5 -1
  79. package/node/components/virtualization/GridMainContainer.js +8 -1
  80. package/node/components/virtualization/GridTopContainer.js +1 -0
  81. package/node/constants/gridClasses.js +1 -1
  82. package/node/hooks/core/useGridInitialization.js +1 -1
  83. package/node/hooks/core/useGridStateInitialization.js +6 -10
  84. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +7 -3
  85. package/node/hooks/features/editing/useGridCellEditing.js +3 -1
  86. package/node/hooks/features/editing/useGridRowEditing.js +3 -1
  87. package/node/hooks/features/export/serializers/csvSerializer.js +6 -5
  88. package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +4 -7
  89. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -3
  90. package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -6
  91. package/node/index.js +1 -1
  92. package/node/internals/utils/propValidation.js +12 -6
  93. package/node/locales/deDE.js +3 -4
  94. package/node/locales/esES.js +3 -4
  95. package/node/locales/faIR.js +3 -4
  96. package/node/locales/frFR.js +5 -6
  97. package/node/locales/ptBR.js +3 -4
  98. package/node/locales/svSE.js +3 -4
  99. package/node/utils/cellBorderUtils.js +15 -2
  100. package/package.json +2 -2
  101. package/themeAugmentation/overrides.d.ts +6 -0
  102. package/utils/cellBorderUtils.d.ts +1 -1
  103. package/utils/cellBorderUtils.js +15 -2
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import clsx from 'clsx';
3
4
  import { styled, useTheme } from '@mui/material/styles';
4
5
  import { useGridSelector } from '../../utils';
5
6
  import { useGridRootProps } from '../../utils/useGridRootProps';
@@ -51,6 +52,7 @@ export const useGridColumnHeaders = props => {
51
52
  const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
52
53
  const pinnedColumns = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
53
54
  const offsetLeft = computeOffsetLeft(columnPositions, renderContext, theme.direction, pinnedColumns.left.length);
55
+ const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
54
56
  React.useEffect(() => {
55
57
  apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
56
58
  }, [apiRef]);
@@ -104,7 +106,7 @@ export const useGridColumnHeaders = props => {
104
106
  }
105
107
  }), children, isNotPinned && /*#__PURE__*/_jsx("div", {
106
108
  role: "presentation",
107
- className: gridClasses.filler
109
+ className: clsx(gridClasses.filler, borderTop && gridClasses['filler--borderTop'])
108
110
  }), hasScrollbarFiller && /*#__PURE__*/_jsx(ScrollbarFiller, {
109
111
  header: true,
110
112
  borderTop: borderTop,
@@ -165,7 +167,8 @@ export const useGridColumnHeaders = props => {
165
167
  pinnedPosition: pinnedPosition,
166
168
  style: style,
167
169
  indexInSection: i,
168
- sectionLength: renderedColumns.length
170
+ sectionLength: renderedColumns.length,
171
+ gridHasFiller: gridHasFiller
169
172
  }, other), colDef.field));
170
173
  }
171
174
  return getFillers(params, columns, 0);
@@ -275,7 +278,8 @@ export const useGridColumnHeaders = props => {
275
278
  pinnedPosition: pinnedPosition,
276
279
  style: style,
277
280
  indexInSection: indexInSection,
278
- sectionLength: renderedColumns.length
281
+ sectionLength: renderedColumns.length,
282
+ gridHasFiller: gridHasFiller
279
283
  }, index);
280
284
  });
281
285
  return getFillers(params, children, leftOverflow);
@@ -168,7 +168,9 @@ export const useGridCellEditing = (apiRef, props) => {
168
168
  const updateCellModesModel = useEventCallback(newModel => {
169
169
  const isNewModelDifferentFromProp = newModel !== props.cellModesModel;
170
170
  if (onCellModesModelChange && isNewModelDifferentFromProp) {
171
- onCellModesModelChange(newModel, {});
171
+ onCellModesModelChange(newModel, {
172
+ api: apiRef.current
173
+ });
172
174
  }
173
175
  if (props.cellModesModel && isNewModelDifferentFromProp) {
174
176
  return; // The prop always win
@@ -242,7 +242,9 @@ export const useGridRowEditing = (apiRef, props) => {
242
242
  const updateRowModesModel = useEventCallback(newModel => {
243
243
  const isNewModelDifferentFromProp = newModel !== props.rowModesModel;
244
244
  if (onRowModesModelChange && isNewModelDifferentFromProp) {
245
- onRowModesModelChange(newModel, {});
245
+ onRowModesModelChange(newModel, {
246
+ api: apiRef.current
247
+ });
246
248
  }
247
249
  if (props.rowModesModel && isNewModelDifferentFromProp) {
248
250
  return; // The prop always win
@@ -2,12 +2,13 @@ import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../../colDef';
2
2
  import { buildWarning } from '../../../../utils/warning';
3
3
  function sanitizeCellValue(value, delimiterCharacter, shouldAppendQuotes) {
4
4
  if (typeof value === 'string') {
5
- // Make sure value containing delimiter or line break won't be split into multiple rows
6
- if ([delimiterCharacter, '\n', '\r', '"'].some(delimiter => value.includes(delimiter))) {
7
- if (shouldAppendQuotes) {
8
- return `"${value.replace(/"/g, '""')}"`;
5
+ if (shouldAppendQuotes) {
6
+ const escapedValue = value.replace(/"/g, '""');
7
+ // Make sure value containing delimiter or line break won't be split into multiple rows
8
+ if ([delimiterCharacter, '\n', '\r', '"'].some(delimiter => value.includes(delimiter))) {
9
+ return `"${escapedValue}"`;
9
10
  }
10
- return `${value.replace(/"/g, '""')}`;
11
+ return escapedValue;
11
12
  }
12
13
  return value;
13
14
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
- import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
3
+ import { DataGridProcessedPropsWithShared } from '../../../models/props/DataGridProps';
4
4
  import { GridStateInitializer } from '../../utils/useGridInitializeState';
5
5
  export declare const headerFilteringStateInitializer: GridStateInitializer;
6
- export declare const useGridHeaderFiltering: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'signature'>) => void;
6
+ export declare const useGridHeaderFiltering: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedPropsWithShared, 'signature' | 'headerFilters'>) => void;
@@ -4,7 +4,6 @@ import { useGridApiMethod } from '../../utils/useGridApiMethod';
4
4
  import { useGridLogger } from '../../utils';
5
5
  import { gridColumnLookupSelector, gridColumnVisibilityModelSelector, gridColumnFieldsSelector } from '../columns/gridColumnsSelector';
6
6
  export const headerFilteringStateInitializer = (state, props) => _extends({}, state, {
7
- // @ts-expect-error Access `Pro` prop in MIT
8
7
  headerFiltering: {
9
8
  enabled: props.headerFilters ?? false,
10
9
  editing: null,
@@ -13,8 +12,6 @@ export const headerFilteringStateInitializer = (state, props) => _extends({}, st
13
12
  });
14
13
  export const useGridHeaderFiltering = (apiRef, props) => {
15
14
  const logger = useGridLogger(apiRef, 'useGridHeaderFiltering');
16
- // @ts-expect-error Access `Pro` prop in MIT
17
- const isHeaderFilteringEnabled = props.headerFilters ?? false;
18
15
  const setHeaderFilterState = React.useCallback(headerFilterState => {
19
16
  apiRef.current.setState(state => {
20
17
  // Safety check to avoid MIT users from using it
@@ -24,14 +21,14 @@ export const useGridHeaderFiltering = (apiRef, props) => {
24
21
  }
25
22
  return _extends({}, state, {
26
23
  headerFiltering: {
27
- enabled: isHeaderFilteringEnabled ?? false,
24
+ enabled: props.headerFilters ?? false,
28
25
  editing: headerFilterState.editing ?? null,
29
26
  menuOpen: headerFilterState.menuOpen ?? null
30
27
  }
31
28
  });
32
29
  });
33
30
  apiRef.current.forceUpdate();
34
- }, [apiRef, props.signature, isHeaderFilteringEnabled]);
31
+ }, [apiRef, props.signature, props.headerFilters]);
35
32
  const startHeaderFilterEditMode = React.useCallback(field => {
36
33
  logger.debug(`Starting edit mode on header filter for field: ${field}`);
37
34
  apiRef.current.setHeaderFilterState({
@@ -102,8 +99,8 @@ export const useGridHeaderFiltering = (apiRef, props) => {
102
99
  isFirstRender.current = false;
103
100
  } else {
104
101
  apiRef.current.setHeaderFilterState({
105
- enabled: isHeaderFilteringEnabled
102
+ enabled: props.headerFilters ?? false
106
103
  });
107
104
  }
108
- }, [apiRef, isHeaderFilteringEnabled]);
105
+ }, [apiRef, props.headerFilters]);
109
106
  };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
- import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
3
+ import { DataGridProcessedPropsWithShared } from '../../../models/props/DataGridProps';
4
4
  /**
5
5
  * @requires useGridSorting (method) - can be after
6
6
  * @requires useGridFilter (state) - can be after
@@ -10,4 +10,4 @@ import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
10
10
  * @requires useGridScroll (method) - can be after
11
11
  * @requires useGridColumnSpanning (method) - can be after
12
12
  */
13
- export declare const useGridKeyboardNavigation: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode' | 'getRowId' | 'experimentalFeatures' | 'signature'>) => void;
13
+ export declare const useGridKeyboardNavigation: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedPropsWithShared, 'pagination' | 'paginationMode' | 'getRowId' | 'experimentalFeatures' | 'signature' | 'headerFilters'>) => void;
@@ -69,9 +69,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
69
69
  const initialCurrentPageRows = useGridVisibleRows(apiRef, props).rows;
70
70
  const theme = useTheme();
71
71
  const currentPageRows = React.useMemo(() => enrichPageRowsWithPinnedRows(apiRef, initialCurrentPageRows), [apiRef, initialCurrentPageRows]);
72
- const headerFilteringEnabled =
73
- // @ts-expect-error // TODO move relevant code to the `DataGridPro`
74
- props.signature !== 'DataGrid' && props.headerFilters;
72
+ const headerFilteringEnabled = props.signature !== 'DataGrid' && props.headerFilters;
75
73
 
76
74
  /**
77
75
  * @param {number} colIndex Index of the column to focus
@@ -38,9 +38,9 @@ const EMPTY_SCROLL_POSITION = {
38
38
  left: 0
39
39
  };
40
40
  export const EMPTY_DETAIL_PANELS = Object.freeze(new Map());
41
- const createScrollCache = (rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) => ({
41
+ const createScrollCache = (mode, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) => ({
42
42
  direction: ScrollDirection.NONE,
43
- buffer: bufferForDirection(ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
43
+ buffer: bufferForDirection(mode, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
44
44
  });
45
45
  const isJSDOM = typeof window !== 'undefined' ? /jsdom/.test(window.navigator.userAgent) : false;
46
46
  export const useGridVirtualScroller = () => {
@@ -92,7 +92,7 @@ export const useGridVirtualScroller = () => {
92
92
  const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
93
93
  const scrollTimeout = useTimeout();
94
94
  const frozenContext = React.useRef(undefined);
95
- const scrollCache = useLazyRef(() => createScrollCache(rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
95
+ const scrollCache = useLazyRef(() => createScrollCache(theme.direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
96
96
  const focusedCell = {
97
97
  rowIndex: React.useMemo(() => cellFocus ? currentPage.rows.findIndex(row => row.id === cellFocus.id) : -1, [cellFocus, currentPage.rows]),
98
98
  columnIndex: React.useMemo(() => cellFocus ? visibleColumns.findIndex(column => column.field === cellFocus.field) : -1, [cellFocus, visibleColumns])
@@ -157,7 +157,7 @@ export const useGridVirtualScroller = () => {
157
157
  }
158
158
  }
159
159
  scrollCache.direction = direction;
160
- scrollCache.buffer = bufferForDirection(direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6);
160
+ scrollCache.buffer = bufferForDirection(theme.direction, direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6);
161
161
  const inputs = inputsSelector(apiRef, rootProps, enabled, enabledForColumns);
162
162
  const nextRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
163
163
 
@@ -638,7 +638,7 @@ export function areRenderContextsEqual(context1, context2) {
638
638
  export function computeOffsetLeft(columnPositions, renderContext, direction, pinnedLeftLength) {
639
639
  const factor = direction === 'ltr' ? 1 : -1;
640
640
  const left = factor * (columnPositions[renderContext.firstColumnIndex] ?? 0) - (columnPositions[pinnedLeftLength] ?? 0);
641
- return left;
641
+ return Math.abs(left);
642
642
  }
643
643
  function directionForDelta(dx, dy) {
644
644
  if (dx === 0 && dy === 0) {
@@ -660,7 +660,18 @@ function directionForDelta(dx, dy) {
660
660
  }
661
661
  /* eslint-enable */
662
662
  }
663
- function bufferForDirection(direction, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) {
663
+ function bufferForDirection(mode, direction, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) {
664
+ if (mode === 'rtl') {
665
+ switch (direction) {
666
+ case ScrollDirection.LEFT:
667
+ direction = ScrollDirection.RIGHT;
668
+ break;
669
+ case ScrollDirection.RIGHT:
670
+ direction = ScrollDirection.LEFT;
671
+ break;
672
+ default:
673
+ }
674
+ }
664
675
  switch (direction) {
665
676
  case ScrollDirection.NONE:
666
677
  return {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.1.0
2
+ * @mui/x-data-grid v7.2.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -65,7 +65,7 @@ export { useTimeout } from '../hooks/utils/useTimeout';
65
65
  export { useGridVisibleRows, getVisibleRows } from '../hooks/utils/useGridVisibleRows';
66
66
  export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
67
67
  export type { GridStateInitializer } from '../hooks/utils/useGridInitializeState';
68
- export type { GridExperimentalFeatures, DataGridPropsWithoutDefaultValue, DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing, } from '../models/props/DataGridProps';
68
+ export type { DataGridProSharedPropsWithDefaultValue, DataGridPremiumSharedPropsWithDefaultValue, GridExperimentalFeatures, DataGridPropsWithoutDefaultValue, DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing, } from '../models/props/DataGridProps';
69
69
  export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
70
70
  export * from '../utils/createControllablePromise';
71
71
  export { createSelector, createSelectorMemoized } from '../utils/createSelector';
@@ -2,3 +2,4 @@ import { DataGridProcessedProps } from '../../models/props/DataGridProps';
2
2
  export type PropValidator<TProps> = (props: TProps) => string | undefined;
3
3
  export declare const propValidatorsDataGrid: PropValidator<DataGridProcessedProps>[];
4
4
  export declare const validateProps: <TProps>(props: TProps, validators: PropValidator<TProps>[]) => void;
5
+ export declare const clearWarningsCache: () => void;
@@ -1,9 +1,11 @@
1
- export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined];
2
- const warnedOnceMap = new Set();
1
+ import { isNumber } from '../../utils/utils';
2
+ import { GridSignature } from '../../hooks/utils/useGridApiEventHandler';
3
+ export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined, props => props.signature === GridSignature.DataGrid && props.paginationMode === 'client' && isNumber(props.rowCount) && 'MUI X: Usage of the `rowCount` prop with client side pagination (`paginationMode="client"`) has no effect. `rowCount` is only meant to be used with `paginationMode="server"`.' || undefined];
4
+ const warnedOnceCache = new Set();
3
5
  const warnOnce = message => {
4
- if (!warnedOnceMap.has(message)) {
6
+ if (!warnedOnceCache.has(message)) {
5
7
  console.error(message);
6
- warnedOnceMap.add(message);
8
+ warnedOnceCache.add(message);
7
9
  }
8
10
  };
9
11
  export const validateProps = (props, validators) => {
@@ -16,4 +18,7 @@ export const validateProps = (props, validators) => {
16
18
  warnOnce(warning);
17
19
  }
18
20
  });
21
+ };
22
+ export const clearWarningsCache = () => {
23
+ warnedOnceCache.clear();
19
24
  };
package/locales/deDE.js CHANGED
@@ -30,10 +30,9 @@ const deDEGrid = {
30
30
  toolbarExportPrint: 'Drucken',
31
31
  toolbarExportExcel: 'Download als Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'Suche',
34
+ columnsManagementNoColumns: 'Keine Spalten',
35
+ columnsManagementShowHideAllText: 'Alle anzeigen/verbergen',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'Filter hinzufügen',
39
38
  filterPanelRemoveAll: 'Alle entfernen',
package/locales/esES.js CHANGED
@@ -30,10 +30,9 @@ const esESGrid = {
30
30
  toolbarExportPrint: 'Imprimir',
31
31
  toolbarExportExcel: 'Descargar como Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'Buscar',
34
+ columnsManagementNoColumns: 'Sin columnas',
35
+ columnsManagementShowHideAllText: 'Mostrar/Ocultar todas',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'Agregar filtro',
39
38
  filterPanelRemoveAll: 'Remover todos',
package/locales/faIR.js CHANGED
@@ -30,10 +30,9 @@ const faIRGrid = {
30
30
  toolbarExportPrint: 'چاپ',
31
31
  toolbarExportExcel: 'دانلود به صورت اکسل',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'جستجو',
34
+ columnsManagementNoColumns: 'بدون سطر',
35
+ columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'افزودن فیلتر',
39
38
  filterPanelRemoveAll: 'حذف همه',
package/locales/frFR.js CHANGED
@@ -16,7 +16,7 @@ const frFRGrid = {
16
16
  // Filters toolbar button text
17
17
  toolbarFilters: 'Filtres',
18
18
  toolbarFiltersLabel: 'Afficher les filtres',
19
- toolbarFiltersTooltipHide: 'Cacher les filtres',
19
+ toolbarFiltersTooltipHide: 'Masquer les filtres',
20
20
  toolbarFiltersTooltipShow: 'Afficher les filtres',
21
21
  toolbarFiltersTooltipActive: count => count > 1 ? `${count} filtres actifs` : `${count} filtre actif`,
22
22
  // Quick filter toolbar field
@@ -30,10 +30,9 @@ const frFRGrid = {
30
30
  toolbarExportPrint: 'Imprimer',
31
31
  toolbarExportExcel: 'Télécharger pour Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'Rechercher',
34
+ columnsManagementNoColumns: 'Pas de colonnes',
35
+ columnsManagementShowHideAllText: 'Afficher/masquer toutes',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'Ajouter un filtre',
39
38
  filterPanelRemoveAll: 'Tout supprimer',
@@ -94,7 +93,7 @@ const frFRGrid = {
94
93
  columnMenuShowColumns: 'Afficher les colonnes',
95
94
  columnMenuManageColumns: 'Gérer les colonnes',
96
95
  columnMenuFilter: 'Filtrer',
97
- columnMenuHideColumn: 'Cacher',
96
+ columnMenuHideColumn: 'Masquer',
98
97
  columnMenuUnsort: 'Annuler le tri',
99
98
  columnMenuSortAsc: 'Tri ascendant',
100
99
  columnMenuSortDesc: 'Tri descendant',
package/locales/ptBR.js CHANGED
@@ -30,10 +30,9 @@ const ptBRGrid = {
30
30
  toolbarExportPrint: 'Imprimir',
31
31
  toolbarExportExcel: 'Baixar como Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'Buscar',
34
+ columnsManagementNoColumns: 'Nenhuma coluna',
35
+ columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'Adicionar filtro',
39
38
  filterPanelRemoveAll: 'Remover todos',
package/locales/svSE.js CHANGED
@@ -30,10 +30,9 @@ const svSEGrid = {
30
30
  toolbarExportPrint: 'Skriv ut',
31
31
  toolbarExportExcel: 'Ladda ner som Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'Sök',
34
+ columnsManagementNoColumns: 'Inga kolumner',
35
+ columnsManagementShowHideAllText: 'Visa/Dölj alla',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'Lägg till filter',
39
38
  filterPanelRemoveAll: 'Ta bort alla',
@@ -1,4 +1,5 @@
1
1
  import { GridControlledStateReasonLookup } from '../events/gridEventLookup';
2
+ import { GridApiCommunity } from './gridApiCommunity';
2
3
  /**
3
4
  * Additional details passed to the callbacks
4
5
  */
@@ -7,4 +8,8 @@ export interface GridCallbackDetails<K extends keyof GridControlledStateReasonLo
7
8
  * The reason for this callback to have been called.
8
9
  */
9
10
  reason?: GridControlledStateReasonLookup[K];
11
+ /**
12
+ * GridApi that let you manipulate the grid.
13
+ */
14
+ api: GridApiCommunity;
10
15
  }
@@ -23,7 +23,7 @@ export interface GridExportOptions {
23
23
  export interface GridFileExportOptions<Api extends GridApiCommon = GridApiCommunity> extends GridExportOptions {
24
24
  /**
25
25
  * The string used as the file name.
26
- * @default `document.title`
26
+ * @default document.title
27
27
  */
28
28
  fileName?: string;
29
29
  /**
@@ -61,7 +61,7 @@ export interface GridCsvExportOptions extends GridFileExportOptions {
61
61
  delimiter?: string;
62
62
  /**
63
63
  * The string used as the file name.
64
- * @default `document.title`
64
+ * @default document.title
65
65
  */
66
66
  fileName?: string;
67
67
  /**
@@ -12,18 +12,18 @@ export interface GridFilterModel {
12
12
  /**
13
13
  * - `GridLogicOperator.And`: the row must pass all the filter items.
14
14
  * - `GridLogicOperator.Or`: the row must pass at least on filter item.
15
- * @default `GridLogicOperator.And`
15
+ * @default GridLogicOperator.And
16
16
  */
17
17
  logicOperator?: GridLogicOperator;
18
18
  /**
19
19
  * values used to quick filter rows
20
- * @default `[]`
20
+ * @default []
21
21
  */
22
22
  quickFilterValues?: any[];
23
23
  /**
24
24
  * - `GridLogicOperator.And`: the row must pass all the values.
25
25
  * - `GridLogicOperator.Or`: the row must pass at least one value.
26
- * @default `GridLogicOperator.And`
26
+ * @default GridLogicOperator.And
27
27
  */
28
28
  quickFilterLogicOperator?: GridLogicOperator;
29
29
  /**
@@ -81,28 +81,6 @@ export interface GridRenderEditCellParams<R extends GridValidRowModel = any, V =
81
81
  */
82
82
  api: GridApiCommunity;
83
83
  }
84
- /**
85
- * Object passed as parameter in the column [[GridColDef]] value formatter callback.
86
- */
87
- export interface GridValueFormatterParams<V = any> {
88
- /**
89
- * The grid row id.
90
- * It is not available when the value formatter is called by the filter panel.
91
- */
92
- id?: GridRowId;
93
- /**
94
- * The column field of the cell that triggered the event.
95
- */
96
- field: string;
97
- /**
98
- * The cell value, if the column has valueGetter it is the value returned by it.
99
- */
100
- value: V;
101
- /**
102
- * GridApi that let you manipulate the grid.
103
- */
104
- api: GridApiCommunity;
105
- }
106
84
  /**
107
85
  * Object passed as parameter in the column [[GridColDef]] edit cell props change callback.
108
86
  */
@@ -750,3 +750,22 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
750
750
  */
751
751
  onColumnWidthChange?: GridEventListener<'columnWidthChange'>;
752
752
  }
753
+ export interface DataGridProSharedPropsWithDefaultValue {
754
+ /**
755
+ * If `true`, enables the data grid filtering on header feature.
756
+ * @default false
757
+ */
758
+ headerFilters: boolean;
759
+ }
760
+ export interface DataGridPremiumSharedPropsWithDefaultValue {
761
+ /**
762
+ * If `true`, the cell selection mode is enabled.
763
+ * @default false
764
+ */
765
+ cellSelection: boolean;
766
+ }
767
+ /**
768
+ * Contains the commercial packages' props shared in the MIT version.
769
+ */
770
+ export interface DataGridProcessedPropsWithShared extends DataGridProcessedProps, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {
771
+ }
@@ -93,6 +93,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
93
93
  const handleRef = useForkRef(ref, refProp);
94
94
  const rowNode = apiRef.current.getRowNode(rowId);
95
95
  const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
96
+ const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
96
97
  const hasFocusCell = focusedColumnIndex !== undefined;
97
98
  const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < renderContext.firstColumnIndex;
98
99
  const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= renderContext.lastColumnIndex;
@@ -284,7 +285,8 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
284
285
  pinnedOffset: pinnedOffset,
285
286
  pinnedPosition: pinnedPosition,
286
287
  sectionIndex: indexInSection,
287
- sectionLength: sectionLength
288
+ sectionLength: sectionLength,
289
+ gridHasFiller: gridHasFiller
288
290
  }, slotProps?.cell), column.field);
289
291
  };
290
292
 
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "gridHasScrollX", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "sectionIndex", "sectionLength", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
3
+ const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "gridHasScrollX", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "sectionIndex", "sectionLength", "gridHasFiller", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
4
4
  _excluded2 = ["changeReason", "unstable_updateValueOnRender"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
@@ -92,6 +92,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
92
92
  pinnedPosition,
93
93
  sectionIndex,
94
94
  sectionLength,
95
+ gridHasFiller,
95
96
  onClick,
96
97
  onDoubleClick,
97
98
  onMouseDown,
@@ -159,11 +160,10 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
159
160
  const cellRef = React.useRef(null);
160
161
  const handleRef = useForkRef(ref, cellRef);
161
162
  const focusElementRef = React.useRef(null);
162
- // @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
163
163
  const isSelectionMode = rootProps.cellSelection ?? false;
164
164
  const position = gridPinnedColumnPositionLookup[pinnedPosition];
165
165
  const showLeftBorder = shouldCellShowLeftBorder(position, sectionIndex);
166
- const showRightBorder = shouldCellShowRightBorder(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder);
166
+ const showRightBorder = shouldCellShowRightBorder(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
167
167
  const ownerState = {
168
168
  align,
169
169
  showLeftBorder,
@@ -329,6 +329,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
329
329
  isValidating: PropTypes.bool,
330
330
  value: PropTypes.any
331
331
  }),
332
+ gridHasFiller: PropTypes.bool.isRequired,
332
333
  isNotVisible: PropTypes.bool.isRequired,
333
334
  onClick: PropTypes.func,
334
335
  onDoubleClick: PropTypes.func,
@@ -43,7 +43,8 @@ function GridColumnGroupHeader(props) {
43
43
  pinnedPosition,
44
44
  style,
45
45
  indexInSection,
46
- sectionLength
46
+ sectionLength,
47
+ gridHasFiller
47
48
  } = props;
48
49
  const rootProps = useGridRootProps();
49
50
  const headerCellRef = React.useRef(null);
@@ -71,7 +72,7 @@ function GridColumnGroupHeader(props) {
71
72
  headerComponent = render(renderParams);
72
73
  }
73
74
  const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
74
- const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder);
75
+ const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
75
76
  const ownerState = _extends({}, props, {
76
77
  classes: rootProps.classes,
77
78
  showLeftBorder,
@@ -54,7 +54,8 @@ function GridColumnHeaderItem(props) {
54
54
  style,
55
55
  pinnedPosition,
56
56
  indexInSection,
57
- sectionLength
57
+ sectionLength,
58
+ gridHasFiller
58
59
  } = props;
59
60
  const apiRef = useGridPrivateApiContext();
60
61
  const rootProps = useGridRootProps();
@@ -69,7 +70,7 @@ function GridColumnHeaderItem(props) {
69
70
  headerComponent = colDef.renderHeader(apiRef.current.getColumnHeaderParams(colDef.field));
70
71
  }
71
72
  const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
72
- const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder);
73
+ const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
73
74
  const ownerState = _extends({}, props, {
74
75
  classes: rootProps.classes,
75
76
  showRightBorder,
@@ -201,6 +202,7 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderItem.propTypes = {
201
202
  columnMenuOpen: PropTypes.bool.isRequired,
202
203
  disableReorder: PropTypes.bool,
203
204
  filterItemsCounter: PropTypes.number,
205
+ gridHasFiller: PropTypes.bool.isRequired,
204
206
  hasFocus: PropTypes.bool,
205
207
  headerHeight: PropTypes.number.isRequired,
206
208
  indexInSection: PropTypes.number.isRequired,
@@ -48,7 +48,7 @@ function GridColumnHeaderSeparatorRaw(props) {
48
48
  className: classes.root,
49
49
  style: {
50
50
  minHeight: height,
51
- opacity: rootProps.showColumnVerticalBorder ? 0 : 1
51
+ opacity: rootProps.showColumnVerticalBorder ? 1 : 0
52
52
  }
53
53
  }, other, {
54
54
  onClick: stopClick,