@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.
- package/CHANGELOG.md +125 -0
- package/DataGrid/DataGrid.js +19 -0
- package/components/GridPagination.d.ts +4 -1
- package/components/GridPagination.js +60 -9
- package/components/GridRow.js +1 -0
- package/components/GridScrollArea.js +1 -1
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +1 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +5 -2
- package/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/components/containers/GridRootStyles.js +3 -1
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/components/panel/GridPanel.js +3 -1
- package/constants/gridClasses.d.ts +6 -2
- package/constants/gridClasses.js +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +75 -61
- package/hooks/features/columns/gridColumnsUtils.d.ts +2 -1
- package/hooks/features/columns/gridColumnsUtils.js +4 -3
- package/hooks/features/density/useGridDensity.d.ts +1 -1
- package/hooks/features/density/useGridDensity.js +30 -4
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -1
- package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +5 -2
- package/hooks/features/editing/useGridCellEditing.js +14 -1
- package/hooks/features/export/useGridPrintExport.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.js +2 -2
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +14 -2
- package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
- package/hooks/features/pagination/gridPaginationSelector.js +7 -1
- package/hooks/features/pagination/gridPaginationUtils.d.ts +1 -2
- package/hooks/features/pagination/gridPaginationUtils.js +5 -3
- package/hooks/features/pagination/useGridPagination.d.ts +1 -1
- package/hooks/features/pagination/useGridPagination.js +5 -1
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +4 -0
- package/hooks/features/pagination/useGridPaginationMeta.js +77 -0
- package/hooks/features/pagination/useGridPaginationModel.js +2 -1
- package/hooks/features/pagination/useGridRowCount.d.ts +0 -4
- package/hooks/features/pagination/useGridRowCount.js +32 -18
- package/hooks/utils/useGridSelector.d.ts +1 -1
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/utils/propValidation.js +1 -1
- package/locales/daDK.js +3 -4
- package/models/api/gridApiCommon.d.ts +1 -1
- package/models/api/gridLocaleTextApi.d.ts +7 -3
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +7 -1
- package/models/gridPaginationProps.d.ts +3 -0
- package/models/props/DataGridProps.d.ts +26 -8
- package/modern/DataGrid/DataGrid.js +19 -0
- package/modern/components/GridPagination.js +60 -9
- package/modern/components/GridRow.js +1 -0
- package/modern/components/GridScrollArea.js +1 -1
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +5 -2
- package/modern/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/modern/components/containers/GridRootStyles.js +3 -1
- package/modern/components/index.js +1 -1
- package/modern/components/panel/GridPanel.js +3 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/modern/hooks/features/columnResize/useGridColumnResize.js +75 -61
- package/modern/hooks/features/columns/gridColumnsUtils.js +4 -3
- package/modern/hooks/features/density/useGridDensity.js +30 -4
- package/modern/hooks/features/dimensions/useGridDimensions.js +5 -2
- package/modern/hooks/features/editing/useGridCellEditing.js +14 -1
- package/modern/hooks/features/export/useGridPrintExport.js +2 -2
- package/modern/hooks/features/pagination/gridPaginationSelector.js +7 -1
- package/modern/hooks/features/pagination/gridPaginationUtils.js +5 -3
- package/modern/hooks/features/pagination/useGridPagination.js +5 -1
- package/modern/hooks/features/pagination/useGridPaginationMeta.js +77 -0
- package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -1
- package/modern/hooks/features/pagination/useGridRowCount.js +32 -18
- package/modern/index.js +1 -1
- package/modern/internals/utils/propValidation.js +1 -1
- package/modern/locales/daDK.js +3 -4
- package/modern/models/api/index.js +0 -1
- package/node/DataGrid/DataGrid.js +19 -0
- package/node/components/GridPagination.js +59 -8
- package/node/components/GridRow.js +1 -0
- package/node/components/GridScrollArea.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaderItem.js +4 -1
- package/node/components/columnHeaders/GridColumnHeaderSeparator.js +1 -1
- package/node/components/containers/GridRootStyles.js +3 -1
- package/node/components/index.js +27 -10
- package/node/components/panel/GridPanel.js +3 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +76 -62
- package/node/hooks/features/columns/gridColumnsUtils.js +4 -3
- package/node/hooks/features/density/useGridDensity.js +30 -4
- package/node/hooks/features/dimensions/useGridDimensions.js +5 -2
- package/node/hooks/features/editing/useGridCellEditing.js +14 -1
- package/node/hooks/features/export/useGridPrintExport.js +2 -2
- package/node/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/node/hooks/features/pagination/gridPaginationUtils.js +6 -4
- package/node/hooks/features/pagination/useGridPagination.js +5 -1
- package/node/hooks/features/pagination/useGridPaginationMeta.js +87 -0
- package/node/hooks/features/pagination/useGridPaginationModel.js +2 -1
- package/node/hooks/features/pagination/useGridRowCount.js +30 -15
- package/node/index.js +1 -1
- package/node/internals/utils/propValidation.js +1 -1
- package/node/locales/daDK.js +3 -4
- package/node/models/api/index.js +0 -11
- package/package.json +1 -1
- package/utils/getGridLocalization.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,81 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.3.0
|
|
7
|
+
|
|
8
|
+
_Apr 18, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 📄 Support [unknown and estimated row count in server-side pagination](https://mui.com/x/react-data-grid/pagination/#index-based-pagination) (#12490) @MBilalShafi
|
|
13
|
+
- 🎨 Support color scales in Charts (#12490) @alexfauquette
|
|
14
|
+
Add a [`colorMap` configuration](https://mui.com/x/react-charts/styling/#values-color) to an axis, and the chart will use it to select colors.
|
|
15
|
+
Each impacted chart ([bar charts](https://mui.com/x/react-charts/bars/#color-scale), [line charts](https://mui.com/x/react-charts/lines/#color-scale), [scatter charts](https://mui.com/x/react-charts/scatter/#color-scale)) has a dedicated section explaining how this color map is impacting it.
|
|
16
|
+
|
|
17
|
+
<img src="https://github.com/mui/mui-x/assets/45398769/f0066606-3486-4c4e-b3be-7fdd56d763c3" alt="scatter chart with gradient along y-axis" />
|
|
18
|
+
|
|
19
|
+
- 🌍 Improve Danish (da-DK) locale on the Data Grid
|
|
20
|
+
- 🐞 Bugfixes
|
|
21
|
+
- 📚 Documentation improvements
|
|
22
|
+
|
|
23
|
+
### Data Grid
|
|
24
|
+
|
|
25
|
+
#### `@mui/x-data-grid@7.3.0`
|
|
26
|
+
|
|
27
|
+
- [DataGrid] Fix calling `onCellEditStop` on error (#12747) @sai6855
|
|
28
|
+
- [DataGrid] Fix column resize (#12792) @romgrk
|
|
29
|
+
- [DataGrid] Fix column separators (#12808) @romgrk
|
|
30
|
+
- [DataGrid] Limit panel width to not exceed screen width (#12799) @cherniavskii
|
|
31
|
+
- [DataGrid] Support advanced server-side pagination use cases (#12474) @MBilalShafi
|
|
32
|
+
- [DataGrid] Support state export and restore on grid density (#12671) @MBilalShafi
|
|
33
|
+
- [l10n] Improve Danish (da-DK) locale (#12784) @EmilBahnsen
|
|
34
|
+
|
|
35
|
+
#### `@mui/x-data-grid-pro@7.3.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
36
|
+
|
|
37
|
+
Same changes as in `@mui/x-data-grid@7.3.0`, plus:
|
|
38
|
+
|
|
39
|
+
- [DataGridPro] Implement header filter height (#12666) @romgrk
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-data-grid-premium@7.3.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
42
|
+
|
|
43
|
+
Same changes as in `@mui/x-data-grid-pro@7.3.0`.
|
|
44
|
+
|
|
45
|
+
### Charts
|
|
46
|
+
|
|
47
|
+
#### Breaking change
|
|
48
|
+
|
|
49
|
+
A typo fix:
|
|
50
|
+
|
|
51
|
+
```diff
|
|
52
|
+
- ContinuouseScaleName
|
|
53
|
+
+ ContinuousScaleName
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-charts@7.3.0`
|
|
57
|
+
|
|
58
|
+
- [charts] Add `dataIndex` to series `valueFormatter` (#12745) @JCQuintas
|
|
59
|
+
- [charts] Add color scale (#12490) @alexfauquette
|
|
60
|
+
- [charts] Do not document the usage of `DEFAULT_X_AXIS_KEY` and `DEFAULT_Y_AXIS_KEY` (#12780) @alexfauquette
|
|
61
|
+
- [charts] Export more utils (#12744) @alexfauquette
|
|
62
|
+
- [charts] Fix passing slot props down to `PieArcLabel` (#12806) @JCQuintas
|
|
63
|
+
|
|
64
|
+
### Tree View
|
|
65
|
+
|
|
66
|
+
#### `@mui/x-tree-view@7.3.0`
|
|
67
|
+
|
|
68
|
+
- [TreeView] Support `defaultMuiPrevented` on the `onFocus` prop of the root slot (#12813) @flaviendelangle
|
|
69
|
+
|
|
70
|
+
### Docs
|
|
71
|
+
|
|
72
|
+
- [docs] Add grid cell display example to the migration guide (#12793) @romgrk
|
|
73
|
+
- [docs] Use charts classes objects (#12781) @alexfauquette
|
|
74
|
+
- [docs] Fix layout shift on demos (#12816) @zanivan
|
|
75
|
+
- [test] Increase timeout for test that sometimes fail on `DateTimeRangePicker` (#12786) @LukasTy
|
|
76
|
+
|
|
77
|
+
### Core
|
|
78
|
+
|
|
79
|
+
- [docs-infra] Prepare infra to document charts interfaces (#12653) @alexfauquette
|
|
80
|
+
|
|
6
81
|
## 7.2.0
|
|
7
82
|
|
|
8
83
|
_Apr 12, 2024_
|
|
@@ -3058,6 +3133,56 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
|
|
|
3058
3133
|
- [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
|
|
3059
3134
|
- [license] Correctly throw errors (#10924) @oliviertassinari
|
|
3060
3135
|
|
|
3136
|
+
## 6.19.11
|
|
3137
|
+
|
|
3138
|
+
_Apr 18, 2024_
|
|
3139
|
+
|
|
3140
|
+
We'd like to offer a big thanks to the 1 contributor who made this release possible. Here are some highlights ✨:
|
|
3141
|
+
|
|
3142
|
+
- 🐞 Bugfixes
|
|
3143
|
+
|
|
3144
|
+
### Data Grid
|
|
3145
|
+
|
|
3146
|
+
#### `@mui/x-data-grid@6.19.11`
|
|
3147
|
+
|
|
3148
|
+
- [DataGrid] Fix virtualization memory leak (#12812) @romgrk
|
|
3149
|
+
|
|
3150
|
+
#### `@mui/x-data-grid-pro@6.19.11` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
3151
|
+
|
|
3152
|
+
Same changes as in `@mui/x-data-grid@6.19.11`.
|
|
3153
|
+
|
|
3154
|
+
#### `@mui/x-data-grid-premium@6.19.11` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
3155
|
+
|
|
3156
|
+
Same changes as in `@mui/x-data-grid-pro@6.19.11`.
|
|
3157
|
+
|
|
3158
|
+
## 6.19.10
|
|
3159
|
+
|
|
3160
|
+
_Apr 12, 2024_
|
|
3161
|
+
|
|
3162
|
+
We'd like to offer a big thanks to the 2 contributors who made this release possible. Here are some highlights ✨:
|
|
3163
|
+
|
|
3164
|
+
- 🐞 Bugfixes
|
|
3165
|
+
- 📚 Documentation improvements
|
|
3166
|
+
|
|
3167
|
+
### Data Grid
|
|
3168
|
+
|
|
3169
|
+
#### `@mui/x-data-grid@6.19.10`
|
|
3170
|
+
|
|
3171
|
+
- [DataGrid] Do not escape double quotes when copying to clipboard (#12734) @cherniavskii
|
|
3172
|
+
- [DataGrid] Fix bug in suspense (#12754) @cherniavskii
|
|
3173
|
+
|
|
3174
|
+
#### `@mui/x-data-grid-pro@6.19.10` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
3175
|
+
|
|
3176
|
+
Same changes as in `@mui/x-data-grid@6.19.10`.
|
|
3177
|
+
|
|
3178
|
+
#### `@mui/x-data-grid-premium@6.19.10` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
3179
|
+
|
|
3180
|
+
Same changes as in `@mui/x-data-grid-pro@6.19.10`.
|
|
3181
|
+
|
|
3182
|
+
### Core
|
|
3183
|
+
|
|
3184
|
+
- [core] Update the docs release source branch (#12685) @LukasTy
|
|
3185
|
+
|
|
3061
3186
|
## 6.19.9
|
|
3062
3187
|
|
|
3063
3188
|
_Apr 5, 2024_
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -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,5 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { TablePaginationProps } from '@mui/material/TablePagination';
|
|
2
|
+
import { TablePaginationProps, LabelDisplayedRowsArgs } from '@mui/material/TablePagination';
|
|
3
|
+
export type WrappedLabelDisplayedRows = (args: LabelDisplayedRowsArgs & {
|
|
4
|
+
estimated?: number;
|
|
5
|
+
}) => React.ReactNode;
|
|
3
6
|
interface GridPaginationOwnProps {
|
|
4
7
|
component?: React.ElementType;
|
|
5
8
|
}
|
|
@@ -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
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
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:
|
|
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
|
-
},
|
|
131
|
+
}, computedProps, locales, {
|
|
132
|
+
labelDisplayedRows: wrappedLabelDisplayedRows
|
|
133
|
+
}, props));
|
|
83
134
|
});
|
|
84
135
|
process.env.NODE_ENV !== "production" ? GridPagination.propTypes = {
|
|
85
136
|
// ----------------------------- Warning --------------------------------
|
package/components/GridRow.js
CHANGED
|
@@ -366,6 +366,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
366
366
|
}).isRequired,
|
|
367
367
|
hasScrollX: PropTypes.bool.isRequired,
|
|
368
368
|
hasScrollY: PropTypes.bool.isRequired,
|
|
369
|
+
headerFilterHeight: PropTypes.number.isRequired,
|
|
369
370
|
headerHeight: PropTypes.number.isRequired,
|
|
370
371
|
headersTotalHeight: PropTypes.number.isRequired,
|
|
371
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
|
|
85
|
+
const totalHeaderHeight = getTotalHeaderHeight(apiRef, rootProps);
|
|
86
86
|
const headerHeight = Math.floor(rootProps.columnHeaderHeight * densityFactor);
|
|
87
87
|
const style = {
|
|
88
88
|
height: headerHeight,
|
|
@@ -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,
|
|
@@ -182,7 +184,7 @@ function GridColumnHeaderItem(props) {
|
|
|
182
184
|
width: colDef.computedWidth,
|
|
183
185
|
columnMenuIconButton: columnMenuIconButton,
|
|
184
186
|
columnTitleIconButtons: columnTitleIconButtons,
|
|
185
|
-
headerClassName: headerClassName,
|
|
187
|
+
headerClassName: clsx(headerClassName, isLast && gridClasses['columnHeader--last']),
|
|
186
188
|
label: label,
|
|
187
189
|
resizable: !rootProps.disableColumnResize && !!colDef.resizable,
|
|
188
190
|
"data-field": colDef.field,
|
|
@@ -207,6 +209,7 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderItem.propTypes = {
|
|
|
207
209
|
headerHeight: PropTypes.number.isRequired,
|
|
208
210
|
indexInSection: PropTypes.number.isRequired,
|
|
209
211
|
isDragging: PropTypes.bool.isRequired,
|
|
212
|
+
isLast: PropTypes.bool.isRequired,
|
|
210
213
|
isResizing: PropTypes.bool.isRequired,
|
|
211
214
|
pinnedPosition: PropTypes.oneOf(['left', 'right']),
|
|
212
215
|
sectionLength: 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 ?
|
|
51
|
+
opacity: rootProps.showColumnVerticalBorder ? 0 : 1
|
|
52
52
|
}
|
|
53
53
|
}, other, {
|
|
54
54
|
onClick: stopClick,
|
|
@@ -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}`]: {
|
package/components/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export * from './GridFooter';
|
|
|
13
13
|
export * from './GridHeader';
|
|
14
14
|
export * from './GridLoadingOverlay';
|
|
15
15
|
export * from './GridNoRowsOverlay';
|
|
16
|
-
export
|
|
16
|
+
export { GridPagination } from './GridPagination';
|
|
17
17
|
export * from './GridRowCount';
|
|
18
18
|
export * from './GridRow';
|
|
19
19
|
export * from './GridSelectedRowCount';
|
package/components/index.js
CHANGED
|
@@ -13,7 +13,7 @@ export * from './GridFooter';
|
|
|
13
13
|
export * from './GridHeader';
|
|
14
14
|
export * from './GridLoadingOverlay';
|
|
15
15
|
export * from './GridNoRowsOverlay';
|
|
16
|
-
export
|
|
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 {
|
|
@@ -112,6 +112,10 @@ export interface GridClasses {
|
|
|
112
112
|
* Styles applied to the selection checkbox element.
|
|
113
113
|
*/
|
|
114
114
|
checkboxInput: string;
|
|
115
|
+
/**
|
|
116
|
+
* Styles applied to the column header element.
|
|
117
|
+
*/
|
|
118
|
+
columnHeader: string;
|
|
115
119
|
/**
|
|
116
120
|
* Styles applied to the column header if `headerAlign="center"`.
|
|
117
121
|
*/
|
|
@@ -151,9 +155,9 @@ export interface GridClasses {
|
|
|
151
155
|
'columnHeader--pinnedLeft': string;
|
|
152
156
|
'columnHeader--pinnedRight': string;
|
|
153
157
|
/**
|
|
154
|
-
* Styles applied to the column header element.
|
|
158
|
+
* Styles applied to the last column header element.
|
|
155
159
|
*/
|
|
156
|
-
columnHeader: string;
|
|
160
|
+
'columnHeader--last': string;
|
|
157
161
|
/**
|
|
158
162
|
* Styles applied to the header checkbox cell element.
|
|
159
163
|
*/
|
package/constants/gridClasses.js
CHANGED
|
@@ -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--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']);
|
|
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']);
|
|
@@ -23,8 +23,7 @@ export const GridColumnHeaderRow = styled('div', {
|
|
|
23
23
|
slot: 'ColumnHeaderRow',
|
|
24
24
|
overridesResolver: (_, styles) => styles.columnHeaderRow
|
|
25
25
|
})({
|
|
26
|
-
display: 'flex'
|
|
27
|
-
height: 'var(--DataGrid-headerHeight)'
|
|
26
|
+
display: 'flex'
|
|
28
27
|
});
|
|
29
28
|
export const useGridColumnHeaders = props => {
|
|
30
29
|
const {
|
|
@@ -162,6 +161,7 @@ export const useGridColumnHeaders = props => {
|
|
|
162
161
|
colDef: colDef,
|
|
163
162
|
colIndex: columnIndex,
|
|
164
163
|
isResizing: resizeCol === colDef.field,
|
|
164
|
+
isLast: columnIndex === columnPositions.length - 1,
|
|
165
165
|
hasFocus: hasFocus,
|
|
166
166
|
tabIndex: tabIndex,
|
|
167
167
|
pinnedPosition: pinnedPosition,
|