@mui/x-data-grid 7.2.0 → 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 (109) hide show
  1. package/CHANGELOG.md +125 -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 +1 -0
  6. package/components/GridScrollArea.js +1 -1
  7. package/components/columnHeaders/GridColumnHeaderItem.d.ts +1 -0
  8. package/components/columnHeaders/GridColumnHeaderItem.js +5 -2
  9. package/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
  10. package/components/containers/GridRootStyles.js +3 -1
  11. package/components/index.d.ts +1 -1
  12. package/components/index.js +1 -1
  13. package/components/panel/GridPanel.js +3 -1
  14. package/constants/gridClasses.d.ts +6 -2
  15. package/constants/gridClasses.js +1 -1
  16. package/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  17. package/hooks/features/columnResize/useGridColumnResize.js +75 -61
  18. package/hooks/features/columns/gridColumnsUtils.d.ts +2 -1
  19. package/hooks/features/columns/gridColumnsUtils.js +4 -3
  20. package/hooks/features/density/useGridDensity.d.ts +1 -1
  21. package/hooks/features/density/useGridDensity.js +30 -4
  22. package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -1
  23. package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
  24. package/hooks/features/dimensions/useGridDimensions.js +5 -2
  25. package/hooks/features/editing/useGridCellEditing.js +14 -1
  26. package/hooks/features/export/useGridPrintExport.d.ts +1 -1
  27. package/hooks/features/export/useGridPrintExport.js +2 -2
  28. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
  29. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
  30. package/hooks/features/pagination/gridPaginationInterfaces.d.ts +14 -2
  31. package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
  32. package/hooks/features/pagination/gridPaginationSelector.js +7 -1
  33. package/hooks/features/pagination/gridPaginationUtils.d.ts +1 -2
  34. package/hooks/features/pagination/gridPaginationUtils.js +5 -3
  35. package/hooks/features/pagination/useGridPagination.d.ts +1 -1
  36. package/hooks/features/pagination/useGridPagination.js +5 -1
  37. package/hooks/features/pagination/useGridPaginationMeta.d.ts +4 -0
  38. package/hooks/features/pagination/useGridPaginationMeta.js +77 -0
  39. package/hooks/features/pagination/useGridPaginationModel.js +2 -1
  40. package/hooks/features/pagination/useGridRowCount.d.ts +0 -4
  41. package/hooks/features/pagination/useGridRowCount.js +32 -18
  42. package/hooks/utils/useGridSelector.d.ts +1 -1
  43. package/index.js +1 -1
  44. package/internals/index.d.ts +1 -1
  45. package/internals/utils/propValidation.js +1 -1
  46. package/locales/daDK.js +3 -4
  47. package/models/api/gridApiCommon.d.ts +1 -1
  48. package/models/api/gridLocaleTextApi.d.ts +7 -3
  49. package/models/api/index.d.ts +1 -1
  50. package/models/api/index.js +0 -1
  51. package/models/events/gridEventLookup.d.ts +7 -1
  52. package/models/gridPaginationProps.d.ts +3 -0
  53. package/models/props/DataGridProps.d.ts +26 -8
  54. package/modern/DataGrid/DataGrid.js +19 -0
  55. package/modern/components/GridPagination.js +60 -9
  56. package/modern/components/GridRow.js +1 -0
  57. package/modern/components/GridScrollArea.js +1 -1
  58. package/modern/components/columnHeaders/GridColumnHeaderItem.js +5 -2
  59. package/modern/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
  60. package/modern/components/containers/GridRootStyles.js +3 -1
  61. package/modern/components/index.js +1 -1
  62. package/modern/components/panel/GridPanel.js +3 -1
  63. package/modern/constants/gridClasses.js +1 -1
  64. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  65. package/modern/hooks/features/columnResize/useGridColumnResize.js +75 -61
  66. package/modern/hooks/features/columns/gridColumnsUtils.js +4 -3
  67. package/modern/hooks/features/density/useGridDensity.js +30 -4
  68. package/modern/hooks/features/dimensions/useGridDimensions.js +5 -2
  69. package/modern/hooks/features/editing/useGridCellEditing.js +14 -1
  70. package/modern/hooks/features/export/useGridPrintExport.js +2 -2
  71. package/modern/hooks/features/pagination/gridPaginationSelector.js +7 -1
  72. package/modern/hooks/features/pagination/gridPaginationUtils.js +5 -3
  73. package/modern/hooks/features/pagination/useGridPagination.js +5 -1
  74. package/modern/hooks/features/pagination/useGridPaginationMeta.js +77 -0
  75. package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -1
  76. package/modern/hooks/features/pagination/useGridRowCount.js +32 -18
  77. package/modern/index.js +1 -1
  78. package/modern/internals/utils/propValidation.js +1 -1
  79. package/modern/locales/daDK.js +3 -4
  80. package/modern/models/api/index.js +0 -1
  81. package/node/DataGrid/DataGrid.js +19 -0
  82. package/node/components/GridPagination.js +59 -8
  83. package/node/components/GridRow.js +1 -0
  84. package/node/components/GridScrollArea.js +1 -1
  85. package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -1
  86. package/node/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
  87. package/node/components/containers/GridRootStyles.js +3 -1
  88. package/node/components/index.js +27 -10
  89. package/node/components/panel/GridPanel.js +3 -1
  90. package/node/constants/gridClasses.js +1 -1
  91. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
  92. package/node/hooks/features/columnResize/useGridColumnResize.js +76 -62
  93. package/node/hooks/features/columns/gridColumnsUtils.js +4 -3
  94. package/node/hooks/features/density/useGridDensity.js +30 -4
  95. package/node/hooks/features/dimensions/useGridDimensions.js +5 -2
  96. package/node/hooks/features/editing/useGridCellEditing.js +14 -1
  97. package/node/hooks/features/export/useGridPrintExport.js +2 -2
  98. package/node/hooks/features/pagination/gridPaginationSelector.js +8 -2
  99. package/node/hooks/features/pagination/gridPaginationUtils.js +6 -4
  100. package/node/hooks/features/pagination/useGridPagination.js +5 -1
  101. package/node/hooks/features/pagination/useGridPaginationMeta.js +87 -0
  102. package/node/hooks/features/pagination/useGridPaginationModel.js +2 -1
  103. package/node/hooks/features/pagination/useGridRowCount.js +30 -15
  104. package/node/index.js +1 -1
  105. package/node/internals/utils/propValidation.js +1 -1
  106. package/node/locales/daDK.js +3 -4
  107. package/node/models/api/index.js +0 -11
  108. package/package.json +1 -1
  109. package/utils/getGridLocalization.d.ts +1 -1
@@ -1,19 +1,17 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import useLazyRef from '@mui/utils/useLazyRef';
3
4
  import { gridFilteredTopLevelRowCountSelector } from '../filter';
4
- import { useGridLogger, useGridSelector, useGridApiMethod } from '../../utils';
5
+ import { useGridLogger, useGridSelector, useGridApiMethod, useGridApiEventHandler } from '../../utils';
5
6
  import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
6
- import { gridPaginationRowCountSelector } from './gridPaginationSelector';
7
- import { noRowCountInServerMode } from './gridPaginationUtils';
8
-
9
- /**
10
- * @requires useGridFilter (state)
11
- * @requires useGridDimensions (event) - can be after
12
- */
7
+ import { gridPaginationRowCountSelector, gridPaginationMetaSelector, gridPaginationModelSelector } from './gridPaginationSelector';
13
8
  export const useGridRowCount = (apiRef, props) => {
14
9
  const logger = useGridLogger(apiRef, 'useGridRowCount');
15
10
  const visibleTopLevelRowCount = useGridSelector(apiRef, gridFilteredTopLevelRowCountSelector);
16
- const rowCount = useGridSelector(apiRef, gridPaginationRowCountSelector);
11
+ const rowCountState = useGridSelector(apiRef, gridPaginationRowCountSelector);
12
+ const paginationMeta = useGridSelector(apiRef, gridPaginationMetaSelector);
13
+ const paginationModel = useGridSelector(apiRef, gridPaginationModelSelector);
14
+ const previousPageSize = useLazyRef(() => gridPaginationModelSelector(apiRef).pageSize);
17
15
  apiRef.current.registerControlState({
18
16
  stateId: 'paginationRowCount',
19
17
  propModel: props.rowCount,
@@ -26,7 +24,7 @@ export const useGridRowCount = (apiRef, props) => {
26
24
  * API METHODS
27
25
  */
28
26
  const setRowCount = React.useCallback(newRowCount => {
29
- if (rowCount === newRowCount) {
27
+ if (rowCountState === newRowCount) {
30
28
  return;
31
29
  }
32
30
  logger.debug("Setting 'rowCount' to", newRowCount);
@@ -35,7 +33,7 @@ export const useGridRowCount = (apiRef, props) => {
35
33
  rowCount: newRowCount
36
34
  })
37
35
  }));
38
- }, [apiRef, logger, rowCount]);
36
+ }, [apiRef, logger, rowCountState]);
39
37
  const paginationRowCountApi = {
40
38
  setRowCount
41
39
  };
@@ -75,20 +73,36 @@ export const useGridRowCount = (apiRef, props) => {
75
73
  useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
76
74
 
77
75
  /**
78
- * EFFECTS
76
+ * EVENTS
79
77
  */
80
- React.useEffect(() => {
81
- if (process.env.NODE_ENV !== 'production') {
82
- if (props.paginationMode === 'server' && props.rowCount == null) {
83
- noRowCountInServerMode();
78
+ const handlePaginationModelChange = React.useCallback(model => {
79
+ if (props.paginationMode === 'client' || !previousPageSize.current) {
80
+ return;
81
+ }
82
+ if (model.pageSize !== previousPageSize.current) {
83
+ previousPageSize.current = model.pageSize;
84
+ if (rowCountState === -1) {
85
+ // Row count unknown and page size changed, reset the page
86
+ apiRef.current.setPage(0);
84
87
  }
85
88
  }
86
- }, [props.rowCount, props.paginationMode]);
89
+ }, [props.paginationMode, previousPageSize, rowCountState, apiRef]);
90
+ useGridApiEventHandler(apiRef, 'paginationModelChange', handlePaginationModelChange);
91
+
92
+ /**
93
+ * EFFECTS
94
+ */
87
95
  React.useEffect(() => {
88
96
  if (props.paginationMode === 'client') {
89
97
  apiRef.current.setRowCount(visibleTopLevelRowCount);
90
98
  } else if (props.rowCount != null) {
91
99
  apiRef.current.setRowCount(props.rowCount);
92
100
  }
93
- }, [apiRef, visibleTopLevelRowCount, props.paginationMode, props.rowCount]);
101
+ }, [apiRef, props.paginationMode, visibleTopLevelRowCount, props.rowCount]);
102
+ const isLastPage = paginationMeta.hasNextPage === false;
103
+ React.useEffect(() => {
104
+ if (isLastPage && rowCountState === -1) {
105
+ apiRef.current.setRowCount(paginationModel.pageSize * paginationModel.page + visibleTopLevelRowCount);
106
+ }
107
+ }, [apiRef, visibleTopLevelRowCount, isLastPage, rowCountState, paginationModel]);
94
108
  };
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.2.0
2
+ * @mui/x-data-grid v7.3.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,6 +1,6 @@
1
1
  import { isNumber } from '../../utils/utils';
2
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];
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.paginationMode === 'client' && props.paginationMeta != null && ['MUI X: Usage of the `paginationMeta` prop with client-side pagination (`paginationMode="client"`) has no effect.', '`paginationMeta` is only meant to be used with `paginationMode="server"`.'].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"`.'].join('\n') || undefined, props => props.paginationMode === 'server' && props.rowCount == null && ["MUI X: The `rowCount` prop must be passed using `paginationMode='server'`", 'For more detail, see http://mui.com/components/data-grid/pagination/#index-based-pagination'].join('\n') || undefined];
4
4
  const warnedOnceCache = new Set();
5
5
  const warnOnce = message => {
6
6
  if (!warnedOnceCache.has(message)) {
@@ -30,10 +30,9 @@ const daDKGrid = {
30
30
  toolbarExportPrint: 'Print',
31
31
  toolbarExportExcel: 'Download som Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'Søg',
34
+ columnsManagementNoColumns: 'Ingen søjler',
35
+ columnsManagementShowHideAllText: 'Vis/Shjul Alle',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'Tilføj filter',
39
38
  filterPanelRemoveAll: 'Fjern alle',
@@ -4,7 +4,6 @@ export * from './gridDensityApi';
4
4
  export * from './gridRowApi';
5
5
  export * from './gridRowSelectionApi';
6
6
  export * from './gridSortApi';
7
- export * from './gridLocaleTextApi';
8
7
  export * from './gridCsvExportApi';
9
8
  export * from './gridFilterApi';
10
9
  export * from './gridColumnMenuApi';
@@ -193,6 +193,12 @@ DataGridRaw.propTypes = {
193
193
  * @default "cell"
194
194
  */
195
195
  editMode: _propTypes.default.oneOf(['cell', 'row']),
196
+ /**
197
+ * Use if the actual rowCount is not known upfront, but an estimation is available.
198
+ * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
199
+ * Applicable only with `paginationMode="server"` and when `rowCount="-1"`
200
+ */
201
+ estimatedRowCount: _propTypes.default.number,
196
202
  /**
197
203
  * Unstable features, breaking changes might be introduced.
198
204
  * 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.
@@ -494,6 +500,11 @@ DataGridRaw.propTypes = {
494
500
  * @param {GridCallbackDetails} details Additional details for this callback.
495
501
  */
496
502
  onMenuOpen: _propTypes.default.func,
503
+ /**
504
+ * Callback fired when the pagination meta has changed.
505
+ * @param {GridPaginationMeta} paginationMeta Updated pagination meta.
506
+ */
507
+ onPaginationMetaChange: _propTypes.default.func,
497
508
  /**
498
509
  * Callback fired when the pagination model has changed.
499
510
  * @param {GridPaginationModel} model Updated pagination model.
@@ -593,6 +604,13 @@ DataGridRaw.propTypes = {
593
604
  value: _propTypes.default.number.isRequired
594
605
  })]).isRequired),
595
606
  pagination: _propTypes.default.oneOf([true]),
607
+ /**
608
+ * The extra information about the pagination state of the Data Grid.
609
+ * Only applicable with `paginationMode="server"`.
610
+ */
611
+ paginationMeta: _propTypes.default.shape({
612
+ hasNextPage: _propTypes.default.bool
613
+ }),
596
614
  /**
597
615
  * Pagination can be processed on the server or client-side.
598
616
  * Set it to 'client' if you would like to handle the pagination on the client-side.
@@ -628,6 +646,7 @@ DataGridRaw.propTypes = {
628
646
  /**
629
647
  * Set the total number of rows, if it is different from the length of the value `rows` prop.
630
648
  * If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
649
+ * Only works with `paginationMode="server"`, ignored when `paginationMode="client"`.
631
650
  */
632
651
  rowCount: _propTypes.default.number,
633
652
  /**
@@ -7,9 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.GridPagination = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var React = _interopRequireWildcard(require("react"));
10
+ var _styles = require("@mui/material/styles");
10
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
12
  var _TablePagination = _interopRequireWildcard(require("@mui/material/TablePagination"));
12
- var _styles = require("@mui/material/styles");
13
13
  var _useGridSelector = require("../hooks/utils/useGridSelector");
14
14
  var _useGridApiContext = require("../hooks/utils/useGridApiContext");
15
15
  var _useGridRootProps = require("../hooks/utils/useGridRootProps");
@@ -33,6 +33,31 @@ const GridPaginationRoot = (0, _styles.styled)(_TablePagination.default)(({
33
33
  }
34
34
  }
35
35
  }));
36
+ const wrapLabelDisplayedRows = (labelDisplayedRows, estimated) => {
37
+ return ({
38
+ from,
39
+ to,
40
+ count,
41
+ page
42
+ }) => labelDisplayedRows({
43
+ from,
44
+ to,
45
+ count,
46
+ page,
47
+ estimated
48
+ });
49
+ };
50
+ const defaultLabelDisplayedRows = ({
51
+ from,
52
+ to,
53
+ count,
54
+ estimated
55
+ }) => {
56
+ if (!estimated) {
57
+ return `${from}–${to} of ${count !== -1 ? count : `more than ${to}`}`;
58
+ }
59
+ return `${from}–${to} of ${count !== -1 ? count : `more than ${estimated > to ? estimated : to}`}`;
60
+ };
36
61
 
37
62
  // A mutable version of a readonly array.
38
63
 
@@ -41,10 +66,32 @@ const GridPagination = exports.GridPagination = /*#__PURE__*/React.forwardRef(fu
41
66
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
42
67
  const paginationModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridPaginationSelector.gridPaginationModelSelector);
43
68
  const rowCount = (0, _useGridSelector.useGridSelector)(apiRef, _gridPaginationSelector.gridPaginationRowCountSelector);
44
- const lastPage = React.useMemo(() => {
45
- const calculatedValue = Math.ceil(rowCount / (paginationModel.pageSize || 1)) - 1;
46
- return Math.max(0, calculatedValue);
47
- }, [rowCount, paginationModel.pageSize]);
69
+ const pageCount = (0, _useGridSelector.useGridSelector)(apiRef, _gridPaginationSelector.gridPageCountSelector);
70
+ const {
71
+ paginationMode,
72
+ loading,
73
+ estimatedRowCount
74
+ } = rootProps;
75
+ const computedProps = React.useMemo(() => {
76
+ if (rowCount === -1 && paginationMode === 'server' && loading) {
77
+ return {
78
+ backIconButtonProps: {
79
+ disabled: true
80
+ },
81
+ nextIconButtonProps: {
82
+ disabled: true
83
+ }
84
+ };
85
+ }
86
+ return {};
87
+ }, [loading, paginationMode, rowCount]);
88
+ const lastPage = React.useMemo(() => Math.max(0, pageCount - 1), [pageCount]);
89
+ const computedPage = React.useMemo(() => {
90
+ if (rowCount === -1) {
91
+ return paginationModel.page;
92
+ }
93
+ return paginationModel.page <= lastPage ? paginationModel.page : lastPage;
94
+ }, [lastPage, paginationModel.page, rowCount]);
48
95
  const handlePageSizeChange = React.useCallback(event => {
49
96
  const pageSize = Number(event.target.value);
50
97
  apiRef.current.setPageSize(pageSize);
@@ -70,16 +117,18 @@ const GridPagination = exports.GridPagination = /*#__PURE__*/React.forwardRef(fu
70
117
  const warnedOnceMissingInPageSizeOptions = React.useRef(false);
71
118
  const pageSize = rootProps.paginationModel?.pageSize ?? paginationModel.pageSize;
72
119
  if (!warnedOnceMissingInPageSizeOptions.current && !rootProps.autoPageSize && !isPageSizeIncludedInPageSizeOptions(pageSize)) {
73
- console.warn([`MUI X: The page size \`${paginationModel.pageSize}\` is not preset in the \`pageSizeOptions\`.`, `Add it to show the pagination select.`].join('\n'));
120
+ console.warn([`MUI X: The page size \`${paginationModel.pageSize}\` is not present in the \`pageSizeOptions\`.`, `Add it to show the pagination select.`].join('\n'));
74
121
  warnedOnceMissingInPageSizeOptions.current = true;
75
122
  }
76
123
  }
77
124
  const pageSizeOptions = isPageSizeIncludedInPageSizeOptions(paginationModel.pageSize) ? rootProps.pageSizeOptions : [];
125
+ const locales = apiRef.current.getLocaleText('MuiTablePagination');
126
+ const wrappedLabelDisplayedRows = wrapLabelDisplayedRows(locales.labelDisplayedRows || defaultLabelDisplayedRows, estimatedRowCount);
78
127
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPaginationRoot, (0, _extends2.default)({
79
128
  ref: ref,
80
129
  component: "div",
81
130
  count: rowCount,
82
- page: paginationModel.page <= lastPage ? paginationModel.page : lastPage
131
+ page: computedPage
83
132
  // TODO: Remove the cast once the type is fixed in Material UI and that the min Material UI version
84
133
  // for x-data-grid is past the fix.
85
134
  // Note that Material UI will not mutate the array, so this is safe.
@@ -88,7 +137,9 @@ const GridPagination = exports.GridPagination = /*#__PURE__*/React.forwardRef(fu
88
137
  rowsPerPage: paginationModel.pageSize,
89
138
  onPageChange: handlePageChange,
90
139
  onRowsPerPageChange: handlePageSizeChange
91
- }, apiRef.current.getLocaleText('MuiTablePagination'), props));
140
+ }, computedProps, locales, {
141
+ labelDisplayedRows: wrappedLabelDisplayedRows
142
+ }, props));
92
143
  });
93
144
  process.env.NODE_ENV !== "production" ? GridPagination.propTypes = {
94
145
  // ----------------------------- Warning --------------------------------
@@ -374,6 +374,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
374
374
  }).isRequired,
375
375
  hasScrollX: _propTypes.default.bool.isRequired,
376
376
  hasScrollY: _propTypes.default.bool.isRequired,
377
+ headerFilterHeight: _propTypes.default.number.isRequired,
377
378
  headerHeight: _propTypes.default.number.isRequired,
378
379
  headersTotalHeight: _propTypes.default.number.isRequired,
379
380
  isReady: _propTypes.default.bool.isRequired,
@@ -91,7 +91,7 @@ function GridScrollAreaRaw(props) {
91
91
  scrollDirection
92
92
  });
93
93
  const classes = useUtilityClasses(ownerState);
94
- const totalHeaderHeight = (0, _gridColumnsUtils.getTotalHeaderHeight)(apiRef, rootProps.columnHeaderHeight);
94
+ const totalHeaderHeight = (0, _gridColumnsUtils.getTotalHeaderHeight)(apiRef, rootProps);
95
95
  const headerHeight = Math.floor(rootProps.columnHeaderHeight * densityFactor);
96
96
  const style = {
97
97
  height: headerHeight,
@@ -8,6 +8,7 @@ exports.GridColumnHeaderItem = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var React = _interopRequireWildcard(require("react"));
10
10
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ var _clsx = _interopRequireDefault(require("clsx"));
11
12
  var _utils = require("@mui/utils");
12
13
  var _fastMemo = require("../../utils/fastMemo");
13
14
  var _useGridPrivateApiContext = require("../../hooks/utils/useGridPrivateApiContext");
@@ -52,6 +53,7 @@ function GridColumnHeaderItem(props) {
52
53
  colIndex,
53
54
  headerHeight,
54
55
  isResizing,
56
+ isLast,
55
57
  sortDirection,
56
58
  sortIndex,
57
59
  filterItemsCounter,
@@ -190,7 +192,7 @@ function GridColumnHeaderItem(props) {
190
192
  width: colDef.computedWidth,
191
193
  columnMenuIconButton: columnMenuIconButton,
192
194
  columnTitleIconButtons: columnTitleIconButtons,
193
- headerClassName: headerClassName,
195
+ headerClassName: (0, _clsx.default)(headerClassName, isLast && _gridClasses.gridClasses['columnHeader--last']),
194
196
  label: label,
195
197
  resizable: !rootProps.disableColumnResize && !!colDef.resizable,
196
198
  "data-field": colDef.field,
@@ -215,6 +217,7 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderItem.propTypes = {
215
217
  headerHeight: _propTypes.default.number.isRequired,
216
218
  indexInSection: _propTypes.default.number.isRequired,
217
219
  isDragging: _propTypes.default.bool.isRequired,
220
+ isLast: _propTypes.default.bool.isRequired,
218
221
  isResizing: _propTypes.default.bool.isRequired,
219
222
  pinnedPosition: _propTypes.default.oneOf(['left', 'right']),
220
223
  sectionLength: _propTypes.default.number.isRequired,
@@ -57,7 +57,7 @@ function GridColumnHeaderSeparatorRaw(props) {
57
57
  className: classes.root,
58
58
  style: {
59
59
  minHeight: height,
60
- opacity: rootProps.showColumnVerticalBorder ? 1 : 0
60
+ opacity: rootProps.showColumnVerticalBorder ? 0 : 1
61
61
  }
62
62
  }, other, {
63
63
  onClick: stopClick,
@@ -281,7 +281,9 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
281
281
  [`& .${_gridClasses.gridClasses.columnHeader}`]: {
282
282
  position: 'relative',
283
283
  display: 'flex',
284
- alignItems: 'center',
284
+ alignItems: 'center'
285
+ },
286
+ [`& .${_gridClasses.gridClasses['columnHeader--last']}`]: {
285
287
  overflow: 'hidden'
286
288
  },
287
289
  [`& .${_gridClasses.gridClasses['columnHeader--sorted']} .${_gridClasses.gridClasses.iconButtonContainer}, & .${_gridClasses.gridClasses['columnHeader--filtered']} .${_gridClasses.gridClasses.iconButtonContainer}`]: {
@@ -3,9 +3,19 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ GridPagination: true
8
+ };
9
+ Object.defineProperty(exports, "GridPagination", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _GridPagination.GridPagination;
13
+ }
14
+ });
6
15
  var _base = require("./base");
7
16
  Object.keys(_base).forEach(function (key) {
8
17
  if (key === "default" || key === "__esModule") return;
18
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
9
19
  if (key in exports && exports[key] === _base[key]) return;
10
20
  Object.defineProperty(exports, key, {
11
21
  enumerable: true,
@@ -17,6 +27,7 @@ Object.keys(_base).forEach(function (key) {
17
27
  var _cell = require("./cell");
18
28
  Object.keys(_cell).forEach(function (key) {
19
29
  if (key === "default" || key === "__esModule") return;
30
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
31
  if (key in exports && exports[key] === _cell[key]) return;
21
32
  Object.defineProperty(exports, key, {
22
33
  enumerable: true,
@@ -28,6 +39,7 @@ Object.keys(_cell).forEach(function (key) {
28
39
  var _containers = require("./containers");
29
40
  Object.keys(_containers).forEach(function (key) {
30
41
  if (key === "default" || key === "__esModule") return;
42
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
31
43
  if (key in exports && exports[key] === _containers[key]) return;
32
44
  Object.defineProperty(exports, key, {
33
45
  enumerable: true,
@@ -39,6 +51,7 @@ Object.keys(_containers).forEach(function (key) {
39
51
  var _columnHeaders = require("./columnHeaders");
40
52
  Object.keys(_columnHeaders).forEach(function (key) {
41
53
  if (key === "default" || key === "__esModule") return;
54
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
42
55
  if (key in exports && exports[key] === _columnHeaders[key]) return;
43
56
  Object.defineProperty(exports, key, {
44
57
  enumerable: true,
@@ -50,6 +63,7 @@ Object.keys(_columnHeaders).forEach(function (key) {
50
63
  var _columnSelection = require("./columnSelection");
51
64
  Object.keys(_columnSelection).forEach(function (key) {
52
65
  if (key === "default" || key === "__esModule") return;
66
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
53
67
  if (key in exports && exports[key] === _columnSelection[key]) return;
54
68
  Object.defineProperty(exports, key, {
55
69
  enumerable: true,
@@ -61,6 +75,7 @@ Object.keys(_columnSelection).forEach(function (key) {
61
75
  var _icons = require("../material/icons");
62
76
  Object.keys(_icons).forEach(function (key) {
63
77
  if (key === "default" || key === "__esModule") return;
78
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
64
79
  if (key in exports && exports[key] === _icons[key]) return;
65
80
  Object.defineProperty(exports, key, {
66
81
  enumerable: true,
@@ -72,6 +87,7 @@ Object.keys(_icons).forEach(function (key) {
72
87
  var _menu = require("./menu");
73
88
  Object.keys(_menu).forEach(function (key) {
74
89
  if (key === "default" || key === "__esModule") return;
90
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
75
91
  if (key in exports && exports[key] === _menu[key]) return;
76
92
  Object.defineProperty(exports, key, {
77
93
  enumerable: true,
@@ -83,6 +99,7 @@ Object.keys(_menu).forEach(function (key) {
83
99
  var _panel = require("./panel");
84
100
  Object.keys(_panel).forEach(function (key) {
85
101
  if (key === "default" || key === "__esModule") return;
102
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
86
103
  if (key in exports && exports[key] === _panel[key]) return;
87
104
  Object.defineProperty(exports, key, {
88
105
  enumerable: true,
@@ -94,6 +111,7 @@ Object.keys(_panel).forEach(function (key) {
94
111
  var _columnsManagement = require("./columnsManagement");
95
112
  Object.keys(_columnsManagement).forEach(function (key) {
96
113
  if (key === "default" || key === "__esModule") return;
114
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
97
115
  if (key in exports && exports[key] === _columnsManagement[key]) return;
98
116
  Object.defineProperty(exports, key, {
99
117
  enumerable: true,
@@ -105,6 +123,7 @@ Object.keys(_columnsManagement).forEach(function (key) {
105
123
  var _toolbar = require("./toolbar");
106
124
  Object.keys(_toolbar).forEach(function (key) {
107
125
  if (key === "default" || key === "__esModule") return;
126
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
108
127
  if (key in exports && exports[key] === _toolbar[key]) return;
109
128
  Object.defineProperty(exports, key, {
110
129
  enumerable: true,
@@ -116,6 +135,7 @@ Object.keys(_toolbar).forEach(function (key) {
116
135
  var _GridApiContext = require("./GridApiContext");
117
136
  Object.keys(_GridApiContext).forEach(function (key) {
118
137
  if (key === "default" || key === "__esModule") return;
138
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
119
139
  if (key in exports && exports[key] === _GridApiContext[key]) return;
120
140
  Object.defineProperty(exports, key, {
121
141
  enumerable: true,
@@ -127,6 +147,7 @@ Object.keys(_GridApiContext).forEach(function (key) {
127
147
  var _GridFooter = require("./GridFooter");
128
148
  Object.keys(_GridFooter).forEach(function (key) {
129
149
  if (key === "default" || key === "__esModule") return;
150
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
130
151
  if (key in exports && exports[key] === _GridFooter[key]) return;
131
152
  Object.defineProperty(exports, key, {
132
153
  enumerable: true,
@@ -138,6 +159,7 @@ Object.keys(_GridFooter).forEach(function (key) {
138
159
  var _GridHeader = require("./GridHeader");
139
160
  Object.keys(_GridHeader).forEach(function (key) {
140
161
  if (key === "default" || key === "__esModule") return;
162
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
141
163
  if (key in exports && exports[key] === _GridHeader[key]) return;
142
164
  Object.defineProperty(exports, key, {
143
165
  enumerable: true,
@@ -149,6 +171,7 @@ Object.keys(_GridHeader).forEach(function (key) {
149
171
  var _GridLoadingOverlay = require("./GridLoadingOverlay");
150
172
  Object.keys(_GridLoadingOverlay).forEach(function (key) {
151
173
  if (key === "default" || key === "__esModule") return;
174
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
152
175
  if (key in exports && exports[key] === _GridLoadingOverlay[key]) return;
153
176
  Object.defineProperty(exports, key, {
154
177
  enumerable: true,
@@ -160,6 +183,7 @@ Object.keys(_GridLoadingOverlay).forEach(function (key) {
160
183
  var _GridNoRowsOverlay = require("./GridNoRowsOverlay");
161
184
  Object.keys(_GridNoRowsOverlay).forEach(function (key) {
162
185
  if (key === "default" || key === "__esModule") return;
186
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
163
187
  if (key in exports && exports[key] === _GridNoRowsOverlay[key]) return;
164
188
  Object.defineProperty(exports, key, {
165
189
  enumerable: true,
@@ -169,19 +193,10 @@ Object.keys(_GridNoRowsOverlay).forEach(function (key) {
169
193
  });
170
194
  });
171
195
  var _GridPagination = require("./GridPagination");
172
- Object.keys(_GridPagination).forEach(function (key) {
173
- if (key === "default" || key === "__esModule") return;
174
- if (key in exports && exports[key] === _GridPagination[key]) return;
175
- Object.defineProperty(exports, key, {
176
- enumerable: true,
177
- get: function () {
178
- return _GridPagination[key];
179
- }
180
- });
181
- });
182
196
  var _GridRowCount = require("./GridRowCount");
183
197
  Object.keys(_GridRowCount).forEach(function (key) {
184
198
  if (key === "default" || key === "__esModule") return;
199
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
185
200
  if (key in exports && exports[key] === _GridRowCount[key]) return;
186
201
  Object.defineProperty(exports, key, {
187
202
  enumerable: true,
@@ -193,6 +208,7 @@ Object.keys(_GridRowCount).forEach(function (key) {
193
208
  var _GridRow = require("./GridRow");
194
209
  Object.keys(_GridRow).forEach(function (key) {
195
210
  if (key === "default" || key === "__esModule") return;
211
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
196
212
  if (key in exports && exports[key] === _GridRow[key]) return;
197
213
  Object.defineProperty(exports, key, {
198
214
  enumerable: true,
@@ -204,6 +220,7 @@ Object.keys(_GridRow).forEach(function (key) {
204
220
  var _GridSelectedRowCount = require("./GridSelectedRowCount");
205
221
  Object.keys(_GridSelectedRowCount).forEach(function (key) {
206
222
  if (key === "default" || key === "__esModule") return;
223
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
207
224
  if (key in exports && exports[key] === _GridSelectedRowCount[key]) return;
208
225
  Object.defineProperty(exports, key, {
209
226
  enumerable: true,
@@ -42,7 +42,9 @@ const GridPaperRoot = (0, _styles.styled)(_Paper.default, {
42
42
  backgroundColor: (theme.vars || theme).palette.background.paper,
43
43
  minWidth: 300,
44
44
  maxHeight: 450,
45
- display: 'flex'
45
+ display: 'flex',
46
+ maxWidth: `calc(100vw - ${theme.spacing(0.5)})`,
47
+ overflow: 'auto'
46
48
  }));
47
49
  const GridPanel = exports.GridPanel = /*#__PURE__*/React.forwardRef((props, ref) => {
48
50
  const {
@@ -9,4 +9,4 @@ var _utils = require("@mui/utils");
9
9
  function getDataGridUtilityClass(slot) {
10
10
  return (0, _utils.unstable_generateUtilityClass)('MuiDataGrid', slot);
11
11
  }
12
- const gridClasses = exports.gridClasses = (0, _utils.unstable_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--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']);
12
+ const gridClasses = exports.gridClasses = (0, _utils.unstable_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']);
@@ -31,8 +31,7 @@ const GridColumnHeaderRow = exports.GridColumnHeaderRow = (0, _styles.styled)('d
31
31
  slot: 'ColumnHeaderRow',
32
32
  overridesResolver: (_, styles) => styles.columnHeaderRow
33
33
  })({
34
- display: 'flex',
35
- height: 'var(--DataGrid-headerHeight)'
34
+ display: 'flex'
36
35
  });
37
36
  const useGridColumnHeaders = props => {
38
37
  const {
@@ -170,6 +169,7 @@ const useGridColumnHeaders = props => {
170
169
  colDef: colDef,
171
170
  colIndex: columnIndex,
172
171
  isResizing: resizeCol === colDef.field,
172
+ isLast: columnIndex === columnPositions.length - 1,
173
173
  hasFocus: hasFocus,
174
174
  tabIndex: tabIndex,
175
175
  pinnedPosition: pinnedPosition,