@mui/x-data-grid 7.1.1 → 7.3.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 (145) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/DataGrid/DataGrid.js +19 -0
  3. package/components/GridPagination.d.ts +4 -1
  4. package/components/GridPagination.js +60 -9
  5. package/components/GridRow.js +4 -1
  6. package/components/GridScrollArea.js +1 -1
  7. package/components/cell/GridCell.d.ts +1 -0
  8. package/components/cell/GridCell.js +4 -2
  9. package/components/columnHeaders/GridColumnGroupHeader.d.ts +1 -0
  10. package/components/columnHeaders/GridColumnGroupHeader.js +3 -2
  11. package/components/columnHeaders/GridColumnHeaderItem.d.ts +2 -0
  12. package/components/columnHeaders/GridColumnHeaderItem.js +9 -4
  13. package/components/containers/GridRootStyles.js +8 -4
  14. package/components/index.d.ts +1 -1
  15. package/components/index.js +1 -1
  16. package/components/panel/GridPanel.js +3 -1
  17. package/components/panel/filterPanel/GridFilterInputDate.js +5 -1
  18. package/constants/gridClasses.d.ts +11 -2
  19. package/constants/gridClasses.js +1 -1
  20. package/hooks/core/useGridInitialization.js +1 -1
  21. package/hooks/core/useGridStateInitialization.d.ts +1 -2
  22. package/hooks/core/useGridStateInitialization.js +6 -10
  23. package/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -5
  24. package/hooks/features/columnResize/useGridColumnResize.js +75 -61
  25. package/hooks/features/columns/gridColumnsUtils.d.ts +2 -1
  26. package/hooks/features/columns/gridColumnsUtils.js +4 -3
  27. package/hooks/features/density/useGridDensity.d.ts +1 -1
  28. package/hooks/features/density/useGridDensity.js +30 -4
  29. package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -1
  30. package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
  31. package/hooks/features/dimensions/useGridDimensions.js +5 -2
  32. package/hooks/features/editing/useGridCellEditing.js +17 -2
  33. package/hooks/features/editing/useGridRowEditing.js +3 -1
  34. package/hooks/features/export/serializers/csvSerializer.js +6 -5
  35. package/hooks/features/export/useGridPrintExport.d.ts +1 -1
  36. package/hooks/features/export/useGridPrintExport.js +2 -2
  37. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
  38. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
  39. package/hooks/features/pagination/gridPaginationInterfaces.d.ts +14 -2
  40. package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
  41. package/hooks/features/pagination/gridPaginationSelector.js +7 -1
  42. package/hooks/features/pagination/gridPaginationUtils.d.ts +1 -2
  43. package/hooks/features/pagination/gridPaginationUtils.js +5 -3
  44. package/hooks/features/pagination/useGridPagination.d.ts +1 -1
  45. package/hooks/features/pagination/useGridPagination.js +5 -1
  46. package/hooks/features/pagination/useGridPaginationMeta.d.ts +4 -0
  47. package/hooks/features/pagination/useGridPaginationMeta.js +77 -0
  48. package/hooks/features/pagination/useGridPaginationModel.js +2 -1
  49. package/hooks/features/pagination/useGridRowCount.d.ts +0 -4
  50. package/hooks/features/pagination/useGridRowCount.js +32 -18
  51. package/hooks/utils/useGridSelector.d.ts +1 -1
  52. package/index.js +1 -1
  53. package/internals/index.d.ts +1 -1
  54. package/internals/utils/propValidation.js +1 -1
  55. package/locales/daDK.js +3 -4
  56. package/locales/deDE.js +3 -4
  57. package/locales/frFR.js +5 -6
  58. package/locales/svSE.js +3 -4
  59. package/models/api/gridApiCommon.d.ts +1 -1
  60. package/models/api/gridCallbackDetails.d.ts +5 -0
  61. package/models/api/gridLocaleTextApi.d.ts +7 -3
  62. package/models/api/index.d.ts +1 -1
  63. package/models/api/index.js +0 -1
  64. package/models/events/gridEventLookup.d.ts +7 -1
  65. package/models/gridPaginationProps.d.ts +3 -0
  66. package/models/props/DataGridProps.d.ts +26 -8
  67. package/modern/DataGrid/DataGrid.js +19 -0
  68. package/modern/components/GridPagination.js +60 -9
  69. package/modern/components/GridRow.js +4 -1
  70. package/modern/components/GridScrollArea.js +1 -1
  71. package/modern/components/cell/GridCell.js +4 -2
  72. package/modern/components/columnHeaders/GridColumnGroupHeader.js +3 -2
  73. package/modern/components/columnHeaders/GridColumnHeaderItem.js +9 -4
  74. package/modern/components/containers/GridRootStyles.js +8 -4
  75. package/modern/components/index.js +1 -1
  76. package/modern/components/panel/GridPanel.js +3 -1
  77. package/modern/components/panel/filterPanel/GridFilterInputDate.js +5 -1
  78. package/modern/constants/gridClasses.js +1 -1
  79. package/modern/hooks/core/useGridInitialization.js +1 -1
  80. package/modern/hooks/core/useGridStateInitialization.js +6 -10
  81. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -5
  82. package/modern/hooks/features/columnResize/useGridColumnResize.js +75 -61
  83. package/modern/hooks/features/columns/gridColumnsUtils.js +4 -3
  84. package/modern/hooks/features/density/useGridDensity.js +30 -4
  85. package/modern/hooks/features/dimensions/useGridDimensions.js +5 -2
  86. package/modern/hooks/features/editing/useGridCellEditing.js +17 -2
  87. package/modern/hooks/features/editing/useGridRowEditing.js +3 -1
  88. package/modern/hooks/features/export/serializers/csvSerializer.js +6 -5
  89. package/modern/hooks/features/export/useGridPrintExport.js +2 -2
  90. package/modern/hooks/features/pagination/gridPaginationSelector.js +7 -1
  91. package/modern/hooks/features/pagination/gridPaginationUtils.js +5 -3
  92. package/modern/hooks/features/pagination/useGridPagination.js +5 -1
  93. package/modern/hooks/features/pagination/useGridPaginationMeta.js +77 -0
  94. package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -1
  95. package/modern/hooks/features/pagination/useGridRowCount.js +32 -18
  96. package/modern/index.js +1 -1
  97. package/modern/internals/utils/propValidation.js +1 -1
  98. package/modern/locales/daDK.js +3 -4
  99. package/modern/locales/deDE.js +3 -4
  100. package/modern/locales/frFR.js +5 -6
  101. package/modern/locales/svSE.js +3 -4
  102. package/modern/models/api/index.js +0 -1
  103. package/modern/utils/cellBorderUtils.js +15 -2
  104. package/node/DataGrid/DataGrid.js +19 -0
  105. package/node/components/GridPagination.js +59 -8
  106. package/node/components/GridRow.js +4 -1
  107. package/node/components/GridScrollArea.js +1 -1
  108. package/node/components/cell/GridCell.js +4 -2
  109. package/node/components/columnHeaders/GridColumnGroupHeader.js +3 -2
  110. package/node/components/columnHeaders/GridColumnHeaderItem.js +8 -3
  111. package/node/components/containers/GridRootStyles.js +8 -4
  112. package/node/components/index.js +27 -10
  113. package/node/components/panel/GridPanel.js +3 -1
  114. package/node/components/panel/filterPanel/GridFilterInputDate.js +5 -1
  115. package/node/constants/gridClasses.js +1 -1
  116. package/node/hooks/core/useGridInitialization.js +1 -1
  117. package/node/hooks/core/useGridStateInitialization.js +6 -10
  118. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -5
  119. package/node/hooks/features/columnResize/useGridColumnResize.js +76 -62
  120. package/node/hooks/features/columns/gridColumnsUtils.js +4 -3
  121. package/node/hooks/features/density/useGridDensity.js +30 -4
  122. package/node/hooks/features/dimensions/useGridDimensions.js +5 -2
  123. package/node/hooks/features/editing/useGridCellEditing.js +17 -2
  124. package/node/hooks/features/editing/useGridRowEditing.js +3 -1
  125. package/node/hooks/features/export/serializers/csvSerializer.js +6 -5
  126. package/node/hooks/features/export/useGridPrintExport.js +2 -2
  127. package/node/hooks/features/pagination/gridPaginationSelector.js +8 -2
  128. package/node/hooks/features/pagination/gridPaginationUtils.js +6 -4
  129. package/node/hooks/features/pagination/useGridPagination.js +5 -1
  130. package/node/hooks/features/pagination/useGridPaginationMeta.js +87 -0
  131. package/node/hooks/features/pagination/useGridPaginationModel.js +2 -1
  132. package/node/hooks/features/pagination/useGridRowCount.js +30 -15
  133. package/node/index.js +1 -1
  134. package/node/internals/utils/propValidation.js +1 -1
  135. package/node/locales/daDK.js +3 -4
  136. package/node/locales/deDE.js +3 -4
  137. package/node/locales/frFR.js +5 -6
  138. package/node/locales/svSE.js +3 -4
  139. package/node/models/api/index.js +0 -11
  140. package/node/utils/cellBorderUtils.js +15 -2
  141. package/package.json +1 -1
  142. package/themeAugmentation/overrides.d.ts +6 -0
  143. package/utils/cellBorderUtils.d.ts +1 -1
  144. package/utils/cellBorderUtils.js +15 -2
  145. package/utils/getGridLocalization.d.ts +1 -1
@@ -11,3 +11,6 @@ export interface GridPaginationModel {
11
11
  */
12
12
  page: number;
13
13
  }
14
+ export interface GridPaginationMeta {
15
+ hasNextPage?: boolean;
16
+ }
@@ -23,7 +23,7 @@ import { GridSlotsComponentsProps } from '../gridSlotsComponentsProps';
23
23
  import { GridColumnVisibilityModel } from '../../hooks/features/columns/gridColumnsInterfaces';
24
24
  import { GridCellModesModel, GridRowModesModel } from '../api/gridEditingApi';
25
25
  import { GridColumnGroupingModel } from '../gridColumnGrouping';
26
- import { GridPaginationModel } from '../gridPaginationProps';
26
+ import { GridPaginationMeta, GridPaginationModel } from '../gridPaginationProps';
27
27
  import type { GridAutosizeOptions } from '../../hooks/features/columnResize';
28
28
  export interface GridExperimentalFeatures {
29
29
  /**
@@ -38,11 +38,6 @@ export interface GridExperimentalFeatures {
38
38
  export type DataGridProps<R extends GridValidRowModel = any> = Omit<Partial<DataGridPropsWithDefaultValues<R>> & DataGridPropsWithComplexDefaultValueBeforeProcessing & DataGridPropsWithoutDefaultValue<R>, DataGridForcedPropsKey> & {
39
39
  pagination?: true;
40
40
  };
41
- /**
42
- * The props of the `DataGrid` component after the pre-processing phase.
43
- */
44
- export interface DataGridProcessedProps<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithoutDefaultValue<R> {
45
- }
46
41
  /**
47
42
  * The props of the `DataGrid` component after the pre-processing phase that the user should not be able to override.
48
43
  * Those are usually used in feature-hook for which the pro-plan has more advanced features (eg: multi-sorting, multi-filtering, ...).
@@ -380,8 +375,15 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
380
375
  /**
381
376
  * Set the total number of rows, if it is different from the length of the value `rows` prop.
382
377
  * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
378
+ * Only works with `paginationMode="server"`, ignored when `paginationMode="client"`.
383
379
  */
384
380
  rowCount?: number;
381
+ /**
382
+ * Use if the actual rowCount is not known upfront, but an estimation is available.
383
+ * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
384
+ * Applicable only with `paginationMode="server"` and when `rowCount="-1"`
385
+ */
386
+ estimatedRowCount?: number;
385
387
  /**
386
388
  * Override the height/width of the Data Grid inner scrollbar.
387
389
  */
@@ -569,6 +571,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
569
571
  * The pagination model of type [[GridPaginationModel]] which refers to current `page` and `pageSize`.
570
572
  */
571
573
  paginationModel?: GridPaginationModel;
574
+ /**
575
+ * The extra information about the pagination state of the Data Grid.
576
+ * Only applicable with `paginationMode="server"`.
577
+ */
578
+ paginationMeta?: GridPaginationMeta;
572
579
  /**
573
580
  * Callback fired when the pagination model has changed.
574
581
  * @param {GridPaginationModel} model Updated pagination model.
@@ -580,6 +587,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
580
587
  * @param {number} count Updated row count.
581
588
  */
582
589
  onRowCountChange?: (count: number) => void;
590
+ /**
591
+ * Callback fired when the pagination meta has changed.
592
+ * @param {GridPaginationMeta} paginationMeta Updated pagination meta.
593
+ */
594
+ onPaginationMetaChange?: (paginationMeta: GridPaginationMeta) => void;
583
595
  /**
584
596
  * Callback fired when the preferences panel is closed.
585
597
  * @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
@@ -757,6 +769,12 @@ export interface DataGridProSharedPropsWithDefaultValue {
757
769
  */
758
770
  headerFilters: boolean;
759
771
  }
772
+ export interface DataGridProSharedPropsWithoutDefaultValue {
773
+ /**
774
+ * Override the height of the header filters.
775
+ */
776
+ headerFilterHeight?: number;
777
+ }
760
778
  export interface DataGridPremiumSharedPropsWithDefaultValue {
761
779
  /**
762
780
  * If `true`, the cell selection mode is enabled.
@@ -765,7 +783,7 @@ export interface DataGridPremiumSharedPropsWithDefaultValue {
765
783
  cellSelection: boolean;
766
784
  }
767
785
  /**
768
- * Contains the commercial packages' props shared in the MIT version.
786
+ * The props of the `DataGrid` component after the pre-processing phase.
769
787
  */
770
- export interface DataGridProcessedPropsWithShared extends DataGridProcessedProps, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {
788
+ export interface DataGridProcessedProps<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithoutDefaultValue<R>, DataGridProSharedPropsWithoutDefaultValue, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {
771
789
  }
@@ -186,6 +186,12 @@ DataGridRaw.propTypes = {
186
186
  * @default "cell"
187
187
  */
188
188
  editMode: PropTypes.oneOf(['cell', 'row']),
189
+ /**
190
+ * Use if the actual rowCount is not known upfront, but an estimation is available.
191
+ * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
192
+ * Applicable only with `paginationMode="server"` and when `rowCount="-1"`
193
+ */
194
+ estimatedRowCount: PropTypes.number,
189
195
  /**
190
196
  * Unstable features, breaking changes might be introduced.
191
197
  * For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
@@ -487,6 +493,11 @@ DataGridRaw.propTypes = {
487
493
  * @param {GridCallbackDetails} details Additional details for this callback.
488
494
  */
489
495
  onMenuOpen: PropTypes.func,
496
+ /**
497
+ * Callback fired when the pagination meta has changed.
498
+ * @param {GridPaginationMeta} paginationMeta Updated pagination meta.
499
+ */
500
+ onPaginationMetaChange: PropTypes.func,
490
501
  /**
491
502
  * Callback fired when the pagination model has changed.
492
503
  * @param {GridPaginationModel} model Updated pagination model.
@@ -586,6 +597,13 @@ DataGridRaw.propTypes = {
586
597
  value: PropTypes.number.isRequired
587
598
  })]).isRequired),
588
599
  pagination: PropTypes.oneOf([true]),
600
+ /**
601
+ * The extra information about the pagination state of the Data Grid.
602
+ * Only applicable with `paginationMode="server"`.
603
+ */
604
+ paginationMeta: PropTypes.shape({
605
+ hasNextPage: PropTypes.bool
606
+ }),
589
607
  /**
590
608
  * Pagination can be processed on the server or client-side.
591
609
  * Set it to 'client' if you would like to handle the pagination on the client-side.
@@ -621,6 +639,7 @@ DataGridRaw.propTypes = {
621
639
  /**
622
640
  * Set the total number of rows, if it is different from the length of the value `rows` prop.
623
641
  * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
642
+ * Only works with `paginationMode="server"`, ignored when `paginationMode="client"`.
624
643
  */
625
644
  rowCount: PropTypes.number,
626
645
  /**
@@ -1,12 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import { styled } from '@mui/material/styles';
3
4
  import PropTypes from 'prop-types';
4
5
  import TablePagination, { tablePaginationClasses } from '@mui/material/TablePagination';
5
- import { styled } from '@mui/material/styles';
6
6
  import { useGridSelector } from '../hooks/utils/useGridSelector';
7
7
  import { useGridApiContext } from '../hooks/utils/useGridApiContext';
8
8
  import { useGridRootProps } from '../hooks/utils/useGridRootProps';
9
- import { gridPaginationModelSelector, gridPaginationRowCountSelector } from '../hooks/features/pagination/gridPaginationSelector';
9
+ import { gridPaginationModelSelector, gridPaginationRowCountSelector, gridPageCountSelector } from '../hooks/features/pagination/gridPaginationSelector';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  const GridPaginationRoot = styled(TablePagination)(({
12
12
  theme
@@ -24,6 +24,31 @@ const GridPaginationRoot = styled(TablePagination)(({
24
24
  }
25
25
  }
26
26
  }));
27
+ const wrapLabelDisplayedRows = (labelDisplayedRows, estimated) => {
28
+ return ({
29
+ from,
30
+ to,
31
+ count,
32
+ page
33
+ }) => labelDisplayedRows({
34
+ from,
35
+ to,
36
+ count,
37
+ page,
38
+ estimated
39
+ });
40
+ };
41
+ const defaultLabelDisplayedRows = ({
42
+ from,
43
+ to,
44
+ count,
45
+ estimated
46
+ }) => {
47
+ if (!estimated) {
48
+ return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;
49
+ }
50
+ return `${from}–${to} of ${count !== -1 ? count : `more than ${estimated > to ? estimated : to}`}`;
51
+ };
27
52
 
28
53
  // A mutable version of a readonly array.
29
54
 
@@ -32,10 +57,32 @@ const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(pro
32
57
  const rootProps = useGridRootProps();
33
58
  const paginationModel = useGridSelector(apiRef, gridPaginationModelSelector);
34
59
  const rowCount = useGridSelector(apiRef, gridPaginationRowCountSelector);
35
- const lastPage = React.useMemo(() => {
36
- const calculatedValue = Math.ceil(rowCount / (paginationModel.pageSize || 1)) - 1;
37
- return Math.max(0, calculatedValue);
38
- }, [rowCount, paginationModel.pageSize]);
60
+ const pageCount = useGridSelector(apiRef, gridPageCountSelector);
61
+ const {
62
+ paginationMode,
63
+ loading,
64
+ estimatedRowCount
65
+ } = rootProps;
66
+ const computedProps = React.useMemo(() => {
67
+ if (rowCount === -1 && paginationMode === 'server' && loading) {
68
+ return {
69
+ backIconButtonProps: {
70
+ disabled: true
71
+ },
72
+ nextIconButtonProps: {
73
+ disabled: true
74
+ }
75
+ };
76
+ }
77
+ return {};
78
+ }, [loading, paginationMode, rowCount]);
79
+ const lastPage = React.useMemo(() => Math.max(0, pageCount - 1), [pageCount]);
80
+ const computedPage = React.useMemo(() => {
81
+ if (rowCount === -1) {
82
+ return paginationModel.page;
83
+ }
84
+ return paginationModel.page <= lastPage ? paginationModel.page : lastPage;
85
+ }, [lastPage, paginationModel.page, rowCount]);
39
86
  const handlePageSizeChange = React.useCallback(event => {
40
87
  const pageSize = Number(event.target.value);
41
88
  apiRef.current.setPageSize(pageSize);
@@ -61,16 +108,18 @@ const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(pro
61
108
  const warnedOnceMissingInPageSizeOptions = React.useRef(false);
62
109
  const pageSize = rootProps.paginationModel?.pageSize ?? paginationModel.pageSize;
63
110
  if (!warnedOnceMissingInPageSizeOptions.current && !rootProps.autoPageSize && !isPageSizeIncludedInPageSizeOptions(pageSize)) {
64
- console.warn([`MUI X: The page size \`${paginationModel.pageSize}\` is not preset in the \`pageSizeOptions\`.`, `Add it to show the pagination select.`].join('\n'));
111
+ console.warn([`MUI X: The page size \`${paginationModel.pageSize}\` is not present in the \`pageSizeOptions\`.`, `Add it to show the pagination select.`].join('\n'));
65
112
  warnedOnceMissingInPageSizeOptions.current = true;
66
113
  }
67
114
  }
68
115
  const pageSizeOptions = isPageSizeIncludedInPageSizeOptions(paginationModel.pageSize) ? rootProps.pageSizeOptions : [];
116
+ const locales = apiRef.current.getLocaleText('MuiTablePagination');
117
+ const wrappedLabelDisplayedRows = wrapLabelDisplayedRows(locales.labelDisplayedRows || defaultLabelDisplayedRows, estimatedRowCount);
69
118
  return /*#__PURE__*/_jsx(GridPaginationRoot, _extends({
70
119
  ref: ref,
71
120
  component: "div",
72
121
  count: rowCount,
73
- page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
122
+ page: computedPage
74
123
  // TODO: Remove the cast once the type is fixed in Material UI and that the min Material UI version
75
124
  // for x-data-grid is past the fix.
76
125
  // Note that Material UI will not mutate the array, so this is safe.
@@ -79,7 +128,9 @@ const GridPagination = /*#__PURE__*/React.forwardRef(function GridPagination(pro
79
128
  rowsPerPage: paginationModel.pageSize,
80
129
  onPageChange: handlePageChange,
81
130
  onRowsPerPageChange: handlePageSizeChange
82
- }, apiRef.current.getLocaleText('MuiTablePagination'), props));
131
+ }, computedProps, locales, {
132
+ labelDisplayedRows: wrappedLabelDisplayedRows
133
+ }, props));
83
134
  });
84
135
  process.env.NODE_ENV !== "production" ? GridPagination.propTypes = {
85
136
  // ----------------------------- Warning --------------------------------
@@ -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
 
@@ -364,6 +366,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
364
366
  }).isRequired,
365
367
  hasScrollX: PropTypes.bool.isRequired,
366
368
  hasScrollY: PropTypes.bool.isRequired,
369
+ headerFilterHeight: PropTypes.number.isRequired,
367
370
  headerHeight: PropTypes.number.isRequired,
368
371
  headersTotalHeight: PropTypes.number.isRequired,
369
372
  isReady: PropTypes.bool.isRequired,
@@ -82,7 +82,7 @@ function GridScrollAreaRaw(props) {
82
82
  scrollDirection
83
83
  });
84
84
  const classes = useUtilityClasses(ownerState);
85
- const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps.columnHeaderHeight);
85
+ const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps);
86
86
  const headerHeight = Math.floor(rootProps.columnHeaderHeight * densityFactor);
87
87
  const style = {
88
88
  height: headerHeight,
@@ -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,
@@ -162,7 +163,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
162
163
  const isSelectionMode = rootProps.cellSelection ?? false;
163
164
  const position = gridPinnedColumnPositionLookup[pinnedPosition];
164
165
  const showLeftBorder = shouldCellShowLeftBorder(position, sectionIndex);
165
- const showRightBorder = shouldCellShowRightBorder(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder);
166
+ const showRightBorder = shouldCellShowRightBorder(position, sectionIndex, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
166
167
  const ownerState = {
167
168
  align,
168
169
  showLeftBorder,
@@ -328,6 +329,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
328
329
  isValidating: PropTypes.bool,
329
330
  value: PropTypes.any
330
331
  }),
332
+ gridHasFiller: PropTypes.bool.isRequired,
331
333
  isNotVisible: PropTypes.bool.isRequired,
332
334
  onClick: PropTypes.func,
333
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,
@@ -1,13 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
+ import clsx from 'clsx';
4
5
  import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
5
6
  import { fastMemo } from '../../utils/fastMemo';
6
7
  import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
7
8
  import { GridColumnHeaderSortIcon } from './GridColumnHeaderSortIcon';
8
9
  import { ColumnHeaderMenuIcon } from './ColumnHeaderMenuIcon';
9
10
  import { GridColumnHeaderMenu } from '../menu/columnMenu/GridColumnHeaderMenu';
10
- import { getDataGridUtilityClass } from '../../constants/gridClasses';
11
+ import { gridClasses, getDataGridUtilityClass } from '../../constants/gridClasses';
11
12
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
12
13
  import { GridGenericColumnHeaderItem } from './GridGenericColumnHeaderItem';
13
14
  import { isEventTargetInPortal } from '../../utils/domUtils';
@@ -44,6 +45,7 @@ function GridColumnHeaderItem(props) {
44
45
  colIndex,
45
46
  headerHeight,
46
47
  isResizing,
48
+ isLast,
47
49
  sortDirection,
48
50
  sortIndex,
49
51
  filterItemsCounter,
@@ -54,7 +56,8 @@ function GridColumnHeaderItem(props) {
54
56
  style,
55
57
  pinnedPosition,
56
58
  indexInSection,
57
- sectionLength
59
+ sectionLength,
60
+ gridHasFiller
58
61
  } = props;
59
62
  const apiRef = useGridPrivateApiContext();
60
63
  const rootProps = useGridRootProps();
@@ -69,7 +72,7 @@ function GridColumnHeaderItem(props) {
69
72
  headerComponent = colDef.renderHeader(apiRef.current.getColumnHeaderParams(colDef.field));
70
73
  }
71
74
  const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection);
72
- const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder);
75
+ const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
73
76
  const ownerState = _extends({}, props, {
74
77
  classes: rootProps.classes,
75
78
  showRightBorder,
@@ -181,7 +184,7 @@ function GridColumnHeaderItem(props) {
181
184
  width: colDef.computedWidth,
182
185
  columnMenuIconButton: columnMenuIconButton,
183
186
  columnTitleIconButtons: columnTitleIconButtons,
184
- headerClassName: headerClassName,
187
+ headerClassName: clsx(headerClassName, isLast && gridClasses['columnHeader--last']),
185
188
  label: label,
186
189
  resizable: !rootProps.disableColumnResize && !!colDef.resizable,
187
190
  "data-field": colDef.field,
@@ -201,10 +204,12 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderItem.propTypes = {
201
204
  columnMenuOpen: PropTypes.bool.isRequired,
202
205
  disableReorder: PropTypes.bool,
203
206
  filterItemsCounter: PropTypes.number,
207
+ gridHasFiller: PropTypes.bool.isRequired,
204
208
  hasFocus: PropTypes.bool,
205
209
  headerHeight: PropTypes.number.isRequired,
206
210
  indexInSection: PropTypes.number.isRequired,
207
211
  isDragging: PropTypes.bool.isRequired,
212
+ isLast: PropTypes.bool.isRequired,
208
213
  isResizing: PropTypes.bool.isRequired,
209
214
  pinnedPosition: PropTypes.oneOf(['left', 'right']),
210
215
  sectionLength: PropTypes.number.isRequired,
@@ -151,8 +151,8 @@ export const GridRootStyles = styled('div', {
151
151
  }) => {
152
152
  const borderColor = getBorderColor(t);
153
153
  const radius = t.shape.borderRadius;
154
- const containerBackground = t.vars ? t.vars.palette.background.default : t.palette.background.default;
155
- const pinnedBackground = containerBackground;
154
+ const containerBackground = t.vars ? t.vars.palette.background.default : t.mixins.MuiDataGrid?.containerBackground ?? t.palette.background.default;
155
+ const pinnedBackground = t.mixins.MuiDataGrid?.pinnedBackground ?? containerBackground;
156
156
  const overlayBackground = t.vars ? `rgba(${t.vars.palette.background.defaultChannel} / ${t.vars.palette.action.disabledOpacity})` : alpha(t.palette.background.default, t.palette.action.disabledOpacity);
157
157
  const hoverOpacity = (t.vars || t).palette.action.hoverOpacity;
158
158
  const hoverColor = (t.vars || t).palette.action.hover;
@@ -274,7 +274,9 @@ export const GridRootStyles = styled('div', {
274
274
  [`& .${c.columnHeader}`]: {
275
275
  position: 'relative',
276
276
  display: 'flex',
277
- alignItems: 'center',
277
+ alignItems: 'center'
278
+ },
279
+ [`& .${c['columnHeader--last']}`]: {
278
280
  overflow: 'hidden'
279
281
  },
280
282
  [`& .${c['columnHeader--sorted']} .${c.iconButtonContainer}, & .${c['columnHeader--filtered']} .${c.iconButtonContainer}`]: {
@@ -450,7 +452,6 @@ export const GridRootStyles = styled('div', {
450
452
  userSelect: 'none'
451
453
  },
452
454
  [`& .${c['row--dynamicHeight']} > .${c.cell}`]: {
453
- overflow: 'initial',
454
455
  whiteSpace: 'initial',
455
456
  lineHeight: 'inherit'
456
457
  },
@@ -632,6 +633,9 @@ export const GridRootStyles = styled('div', {
632
633
  },
633
634
  [`& .${c.filler}`]: {
634
635
  flex: 1
636
+ },
637
+ [`& .${c['filler--borderTop']}`]: {
638
+ borderTop: '1px solid var(--DataGrid-rowBorderColor)'
635
639
  }
636
640
  });
637
641
  return gridStyle;
@@ -13,7 +13,7 @@ export * from './GridFooter';
13
13
  export * from './GridHeader';
14
14
  export * from './GridLoadingOverlay';
15
15
  export * from './GridNoRowsOverlay';
16
- export * from './GridPagination';
16
+ export { GridPagination } from './GridPagination';
17
17
  export * from './GridRowCount';
18
18
  export * from './GridRow';
19
19
  export * from './GridSelectedRowCount';
@@ -33,7 +33,9 @@ const GridPaperRoot = styled(Paper, {
33
33
  backgroundColor: (theme.vars || theme).palette.background.paper,
34
34
  minWidth: 300,
35
35
  maxHeight: 450,
36
- display: 'flex'
36
+ display: 'flex',
37
+ maxWidth: `calc(100vw - ${theme.spacing(0.5)})`,
38
+ overflow: 'auto'
37
39
  }));
38
40
  const GridPanel = /*#__PURE__*/React.forwardRef((props, ref) => {
39
41
  const {
@@ -12,6 +12,9 @@ function convertFilterItemValueToInputValue(itemValue, inputType) {
12
12
  return '';
13
13
  }
14
14
  const dateCopy = new Date(itemValue);
15
+ if (Number.isNaN(dateCopy.getTime())) {
16
+ return '';
17
+ }
15
18
  // The date picker expects the date to be in the local timezone.
16
19
  // But .toISOString() converts it to UTC with zero offset.
17
20
  // So we need to subtract the timezone offset.
@@ -48,8 +51,9 @@ function GridFilterInputDate(props) {
48
51
  setFilterValueState(value);
49
52
  setIsApplying(true);
50
53
  filterTimeout.start(rootProps.filterDebounceMs, () => {
54
+ const date = new Date(value);
51
55
  applyValue(_extends({}, item, {
52
- value: new Date(value)
56
+ value: Number.isNaN(date.getTime()) ? undefined : date
53
57
  }));
54
58
  setIsApplying(false);
55
59
  });
@@ -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--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader', '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--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', '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', '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--borderTop', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
@@ -15,7 +15,7 @@ export const useGridInitialization = (inputApiRef, props) => {
15
15
  useGridRefs(privateApiRef);
16
16
  useGridTheme(privateApiRef);
17
17
  useGridLoggerFactory(privateApiRef, props);
18
- useGridStateInitialization(privateApiRef, props);
18
+ useGridStateInitialization(privateApiRef);
19
19
  useGridPipeProcessing(privateApiRef);
20
20
  useGridStrategyProcessing(privateApiRef);
21
21
  useGridLocaleText(privateApiRef, props);
@@ -1,9 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { GridSignature } from '../utils/useGridApiEventHandler';
4
3
  import { useGridApiMethod } from '../utils';
5
4
  import { isFunction } from '../../utils/utils';
6
- export const useGridStateInitialization = (apiRef, props) => {
5
+ export const useGridStateInitialization = apiRef => {
7
6
  const controlStateMapRef = React.useRef({});
8
7
  const [, rawForceUpdate] = React.useState();
9
8
  const registerControlState = React.useCallback(controlStateItem => {
@@ -62,13 +61,10 @@ export const useGridStateInitialization = (apiRef, props) => {
62
61
  const controlState = controlStateMapRef.current[stateId];
63
62
  const model = controlState.stateSelector(newState, apiRef.current.instanceId);
64
63
  if (controlState.propOnChange && hasPropChanged) {
65
- const details = props.signature === GridSignature.DataGridPro ? {
66
- api: apiRef.current,
67
- reason
68
- } : {
69
- reason
70
- };
71
- controlState.propOnChange(model, details);
64
+ controlState.propOnChange(model, {
65
+ reason,
66
+ api: apiRef.current
67
+ });
72
68
  }
73
69
  if (!ignoreSetState) {
74
70
  apiRef.current.publishEvent(controlState.changeEvent, model, {
@@ -77,7 +73,7 @@ export const useGridStateInitialization = (apiRef, props) => {
77
73
  }
78
74
  }
79
75
  return !ignoreSetState;
80
- }, [apiRef, props.signature]);
76
+ }, [apiRef]);
81
77
  const updateControlState = React.useCallback((key, state, reason) => {
82
78
  return apiRef.current.setState(previousState => {
83
79
  return _extends({}, previousState, {
@@ -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';
@@ -22,8 +23,7 @@ export const GridColumnHeaderRow = styled('div', {
22
23
  slot: 'ColumnHeaderRow',
23
24
  overridesResolver: (_, styles) => styles.columnHeaderRow
24
25
  })({
25
- display: 'flex',
26
- height: 'var(--DataGrid-headerHeight)'
26
+ display: 'flex'
27
27
  });
28
28
  export const useGridColumnHeaders = props => {
29
29
  const {
@@ -51,6 +51,7 @@ export const useGridColumnHeaders = props => {
51
51
  const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
52
52
  const pinnedColumns = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
53
53
  const offsetLeft = computeOffsetLeft(columnPositions, renderContext, theme.direction, pinnedColumns.left.length);
54
+ const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
54
55
  React.useEffect(() => {
55
56
  apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
56
57
  }, [apiRef]);
@@ -104,7 +105,7 @@ export const useGridColumnHeaders = props => {
104
105
  }
105
106
  }), children, isNotPinned && /*#__PURE__*/_jsx("div", {
106
107
  role: "presentation",
107
- className: gridClasses.filler
108
+ className: clsx(gridClasses.filler, borderTop && gridClasses['filler--borderTop'])
108
109
  }), hasScrollbarFiller && /*#__PURE__*/_jsx(ScrollbarFiller, {
109
110
  header: true,
110
111
  borderTop: borderTop,
@@ -160,12 +161,14 @@ export const useGridColumnHeaders = props => {
160
161
  colDef: colDef,
161
162
  colIndex: columnIndex,
162
163
  isResizing: resizeCol === colDef.field,
164
+ isLast: columnIndex === columnPositions.length - 1,
163
165
  hasFocus: hasFocus,
164
166
  tabIndex: tabIndex,
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);