@mui/x-data-grid-premium 8.22.1 → 8.23.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 (34) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/DataGridPremium/DataGridPremium.js +2 -1
  3. package/components/GridGroupingColumnFooterCell.js +2 -3
  4. package/esm/DataGridPremium/DataGridPremium.js +2 -1
  5. package/esm/components/GridGroupingColumnFooterCell.js +1 -2
  6. package/esm/hooks/features/aggregation/createAggregationLookup.js +1 -1
  7. package/esm/hooks/features/aggregation/gridAggregationFunctions.d.ts +2 -0
  8. package/esm/hooks/features/aggregation/gridAggregationFunctions.js +35 -1
  9. package/esm/hooks/features/aggregation/gridAggregationInterfaces.d.ts +3 -16
  10. package/esm/hooks/features/aggregation/gridAggregationSelectors.d.ts +2 -2
  11. package/esm/hooks/features/aggregation/gridAggregationSelectors.js +1 -1
  12. package/esm/hooks/features/aggregation/index.d.ts +2 -1
  13. package/esm/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +1 -1
  14. package/esm/hooks/features/aggregation/wrapColumnWithAggregation.js +3 -2
  15. package/esm/hooks/features/dataSource/useGridDataSourcePremium.js +4 -2
  16. package/esm/index.js +1 -1
  17. package/esm/typeOverloads/modules.d.ts +3 -2
  18. package/hooks/features/aggregation/createAggregationLookup.js +1 -1
  19. package/hooks/features/aggregation/gridAggregationFunctions.d.ts +2 -0
  20. package/hooks/features/aggregation/gridAggregationFunctions.js +35 -1
  21. package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +3 -16
  22. package/hooks/features/aggregation/gridAggregationSelectors.d.ts +2 -2
  23. package/hooks/features/aggregation/gridAggregationSelectors.js +2 -2
  24. package/hooks/features/aggregation/index.d.ts +2 -1
  25. package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +1 -1
  26. package/hooks/features/aggregation/wrapColumnWithAggregation.js +4 -3
  27. package/hooks/features/dataSource/useGridDataSourcePremium.js +4 -2
  28. package/index.js +1 -1
  29. package/package.json +5 -5
  30. package/typeOverloads/modules.d.ts +3 -2
  31. package/components/GridFooterCell.d.ts +0 -8
  32. package/components/GridFooterCell.js +0 -47
  33. package/esm/components/GridFooterCell.d.ts +0 -8
  34. package/esm/components/GridFooterCell.js +0 -41
package/CHANGELOG.md CHANGED
@@ -5,6 +5,107 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.23.0
9
+
10
+ _Dec 23, 2025_
11
+
12
+ We'd like to extend a big thank you to the 12 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 🧮 Support Data Grid `size`, `size(true)`, and `size(false)` [aggregations for `'boolean'` column type](https://mui.com/x/react-data-grid/aggregation/#usage-with-row-grouping)
15
+ - 🔎 Allow zooming a heatmap
16
+
17
+ Special thanks go out to these community members for their valuable contributions:
18
+ @henkerik, @sai6855
19
+
20
+ The following team members contributed to this release:
21
+ @alelthomas, @alexfauquette, @arminmeh, @bernardobelchior, @brijeshb42, @flaviendelangle, @JCQuintas, @mapache-salvaje, @MBilalShafi, @siriwatknp
22
+
23
+ ### Data Grid
24
+
25
+ #### `@mui/x-data-grid@8.23.0`
26
+
27
+ - [DataGrid] Fix columns state and columns prop sync issue (#20703) @arminmeh
28
+ - [DataGrid] Fix filter datetime with seconds (#20557) @siriwatknp
29
+ - [DataGrid] Add new `includeHeaderFilters` flag to include header filters when autosizing columns (#20510) @siriwatknp
30
+ - [DataGrid] Prevent default on `Enter` key down when starting editing (#20751) @siriwatknp
31
+ - [l10n] Improve Portuguese from Portugal (pt-PT) locale (#20722) @Copilot
32
+
33
+ #### `@mui/x-data-grid-pro@8.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
34
+
35
+ Same changes as in `@mui/x-data-grid@8.23.0`, plus:
36
+
37
+ - [DataGridPro] Fix crash on rows change in tree data with pagination (#20215) @Copilot
38
+
39
+ #### `@mui/x-data-grid-premium@8.23.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
40
+
41
+ Same changes as in `@mui/x-data-grid-pro@8.23.0`, plus:
42
+
43
+ - [DataGridPremium] Add aggregation for `'boolean'` column type (#20683) @arminmeh
44
+ - [DataGridPremium] Fix strategy value computation with row grouping (#20725) @MBilalShafi
45
+ - [DataGridPremium] Handle `isRowSelectable()` checks for the rows missing due to `keepNonExistentRowsSelected` (#20668) @arminmeh
46
+
47
+ ### Date and Time Pickers
48
+
49
+ #### `@mui/x-date-pickers@8.23.0`
50
+
51
+ Internal changes.
52
+
53
+ #### `@mui/x-date-pickers-pro@8.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
54
+
55
+ Same changes as in `@mui/x-date-pickers@8.23.0`.
56
+
57
+ ### Charts
58
+
59
+ #### `@mui/x-charts@8.23.0`
60
+
61
+ - [charts] Custom stack functions implementation (#20679) @JCQuintas
62
+ - [charts] Extract keyboard focus navigation to the series config (#20693) @alexfauquette
63
+ - [charts] Fix demo not wrapping in mobile (#20713) @JCQuintas
64
+ - [charts] Fix missing dependencies in `x-charts-vendor` (#20685) @henkerik
65
+ - [charts] Remove webkit test differences (#20707) @JCQuintas
66
+
67
+ #### `@mui/x-charts-pro@8.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
68
+
69
+ Same changes as in `@mui/x-charts@8.23.0`, plus:
70
+
71
+ - [charts-pro] Allow registering preview plots from higher tier packages (#20716) @bernardobelchior
72
+ - [charts-pro] Fix erroneous behavior when adding/removing pointers from zoom&pan gestures (#20698) @JCQuintas
73
+ - [charts-pro] Move heatmap highlight handling to plot component (#20701) @bernardobelchior
74
+ - [charts-pro] Add zoom to heatmap (#20708) @bernardobelchior
75
+
76
+ #### `@mui/x-charts-premium@8.23.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
77
+
78
+ Same changes as in `@mui/x-charts-pro@8.23.0`.
79
+
80
+ ### Tree View
81
+
82
+ #### `@mui/x-tree-view@8.23.0`
83
+
84
+ - [tree view] Add new APIs to disable selection feature for tree view item (#20666) @siriwatknp
85
+
86
+ #### `@mui/x-tree-view-pro@8.23.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
87
+
88
+ Same changes as in `@mui/x-tree-view@8.23.0`.
89
+
90
+ ### Codemod
91
+
92
+ #### `@mui/x-codemod@8.23.0`
93
+
94
+ Internal changes.
95
+
96
+ ### Docs
97
+
98
+ - [docs] Clarify feature availability and relationship between Community and Pro/Premium docs (#20714) @mapache-salvaje
99
+ - [docs] Copyedit Tree View docs and apply new component style rules (DX-19) (#20652) @mapache-salvaje
100
+ - [docs] Fix `ColumnPinningDynamicRowHeight` demo (#20750) @sai6855
101
+ - [docs] Clean up Charts docs sidebar (DX-97) (#20700) @alelthomas
102
+ - [docs] Fix tick labels not being shown on a demo (#20718) @sai6855
103
+
104
+ ### Core
105
+
106
+ - [code-infra] Bump prettier to 3.7.4 (#20709) @JCQuintas
107
+ - [code-infra] Fix contributor generation logic in changelog script (#20705) @brijeshb42
108
+
8
109
  ## 8.22.1
9
110
 
10
111
  _Dec 17, 2025_
@@ -50,7 +50,7 @@ const configuration = {
50
50
  useGridParamsOverridableMethods: _useGridParamsOverridableMethods.useGridParamsOverridableMethods
51
51
  }
52
52
  };
53
- const releaseInfo = "MTc2NjAxNjAwMDAwMA==";
53
+ const releaseInfo = "MTc2NjUzNDQwMDAwMA==";
54
54
  const watermark = /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
55
55
  packageName: "x-data-grid-premium",
56
56
  releaseInfo: releaseInfo
@@ -192,6 +192,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
192
192
  columns: _propTypes.default.arrayOf(_propTypes.default.string),
193
193
  disableColumnVirtualization: _propTypes.default.bool,
194
194
  expand: _propTypes.default.bool,
195
+ includeHeaderFilters: _propTypes.default.bool,
195
196
  includeHeaders: _propTypes.default.bool,
196
197
  includeOutliers: _propTypes.default.bool,
197
198
  outliersFactor: _propTypes.default.number
@@ -6,9 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.GridGroupingColumnFooterCell = GridGroupingColumnFooterCell;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _internals = require("@mui/x-data-grid/internals");
9
+ var _internals = require("@mui/x-data-grid-pro/internals");
10
10
  var _useGridRootProps = require("../hooks/utils/useGridRootProps");
11
- var _GridFooterCell = require("./GridFooterCell");
12
11
  var _jsxRuntime = require("react/jsx-runtime");
13
12
  function GridGroupingColumnFooterCell(props) {
14
13
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
@@ -22,7 +21,7 @@ function GridGroupingColumnFooterCell(props) {
22
21
  } else {
23
22
  sx.ml = `calc(var(--DataGrid-cellOffsetMultiplier) * ${_internals.vars.spacing(props.rowNode.depth)})`;
24
23
  }
25
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridFooterCell.GridFooterCell, (0, _extends2.default)({
24
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.GridFooterCell, (0, _extends2.default)({
26
25
  sx: sx
27
26
  }, props));
28
27
  }
@@ -43,7 +43,7 @@ const configuration = {
43
43
  useGridParamsOverridableMethods
44
44
  }
45
45
  };
46
- const releaseInfo = "MTc2NjAxNjAwMDAwMA==";
46
+ const releaseInfo = "MTc2NjUzNDQwMDAwMA==";
47
47
  const watermark = /*#__PURE__*/_jsx(Watermark, {
48
48
  packageName: "x-data-grid-premium",
49
49
  releaseInfo: releaseInfo
@@ -185,6 +185,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
185
185
  columns: PropTypes.arrayOf(PropTypes.string),
186
186
  disableColumnVirtualization: PropTypes.bool,
187
187
  expand: PropTypes.bool,
188
+ includeHeaderFilters: PropTypes.bool,
188
189
  includeHeaders: PropTypes.bool,
189
190
  includeOutliers: PropTypes.bool,
190
191
  outliersFactor: PropTypes.number
@@ -1,7 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { vars } from '@mui/x-data-grid/internals';
2
+ import { vars, GridFooterCell } from '@mui/x-data-grid-pro/internals';
3
3
  import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
4
- import { GridFooterCell } from "./GridFooterCell.js";
5
4
  import { jsx as _jsx } from "react/jsx-runtime";
6
5
  function GridGroupingColumnFooterCell(props) {
7
6
  const rootProps = useGridRootProps();
@@ -1,5 +1,5 @@
1
1
  import { gridColumnLookupSelector, gridRowTreeSelector, GRID_ROOT_GROUP_ID, gridRowsLookupSelector } from '@mui/x-data-grid-pro';
2
- import { getVisibleRows } from '@mui/x-data-grid/internals';
2
+ import { getVisibleRows } from '@mui/x-data-grid-pro/internals';
3
3
  export const shouldApplySorting = (aggregationRules, aggregatedFields) => {
4
4
  return aggregatedFields.some(field => aggregationRules[field].aggregationFunction.applySorting);
5
5
  };
@@ -5,4 +5,6 @@ export declare const GRID_AGGREGATION_FUNCTIONS: {
5
5
  min: GridAggregationFunction<number | Date, number | Date>;
6
6
  max: GridAggregationFunction<number | Date, number | Date>;
7
7
  size: GridAggregationFunction<unknown, number>;
8
+ sizeTrue: GridAggregationFunction<unknown, number>;
9
+ sizeFalse: GridAggregationFunction<unknown, number>;
8
10
  };
@@ -97,10 +97,44 @@ const sizeAgg = {
97
97
  },
98
98
  hasCellUnit: false
99
99
  };
100
+ const sizeTrueAgg = {
101
+ apply: ({
102
+ values
103
+ }) => {
104
+ return values.filter(value => value === true).length;
105
+ },
106
+ columnTypes: ['boolean'],
107
+ label: 'size(true)',
108
+ valueFormatter: value => {
109
+ if (value == null || !isNumber(value)) {
110
+ return value;
111
+ }
112
+ return value.toLocaleString();
113
+ },
114
+ hasCellUnit: false
115
+ };
116
+ const sizeFalseAgg = {
117
+ apply: ({
118
+ values
119
+ }) => {
120
+ return values.filter(value => value === false).length;
121
+ },
122
+ columnTypes: ['boolean'],
123
+ label: 'size(false)',
124
+ valueFormatter: value => {
125
+ if (value == null || !isNumber(value)) {
126
+ return value;
127
+ }
128
+ return value.toLocaleString();
129
+ },
130
+ hasCellUnit: false
131
+ };
100
132
  export const GRID_AGGREGATION_FUNCTIONS = {
101
133
  sum: sumAgg,
102
134
  avg: avgAgg,
103
135
  min: minAgg,
104
136
  max: maxAgg,
105
- size: sizeAgg
137
+ size: sizeAgg,
138
+ sizeTrue: sizeTrueAgg,
139
+ sizeFalse: sizeFalseAgg
106
140
  };
@@ -1,5 +1,6 @@
1
- import { GridRowId, GridRowModel, GridColDef, GridValueFormatter } from '@mui/x-data-grid-pro';
2
- import { GridApiPremium } from "../../../models/gridApiPremium.js";
1
+ import type { GridRowId, GridRowModel, GridColDef, GridValueFormatter } from '@mui/x-data-grid-pro';
2
+ import type { GridAggregationPosition } from '@mui/x-data-grid-pro/internals';
3
+ import type { GridApiPremium } from "../../../models/gridApiPremium.js";
3
4
  export interface GridAggregationState {
4
5
  model: GridAggregationModel;
5
6
  lookup: GridAggregationLookup;
@@ -108,20 +109,6 @@ export type GridAggregationLookup = {
108
109
  };
109
110
  };
110
111
  };
111
- export type GridAggregationPosition = 'inline' | 'footer';
112
- export interface GridAggregationCellMeta {
113
- /**
114
- * If `true`, the current aggregated value has the same unit as the value of the other cells of this row.
115
- * For instance, "min" / "max" aggregation have the same unit as the other cells.
116
- * If `false`, the current aggregated value has another unit or not unit.
117
- * For instance, "size" aggregation has no unit.
118
- */
119
- hasCellUnit: boolean;
120
- /**
121
- * Name of the aggregation function currently applied on this cell.
122
- */
123
- aggregationFunctionName: string;
124
- }
125
112
  export interface GridAggregationHeaderMeta {
126
113
  aggregationRule: GridAggregationRule;
127
114
  }
@@ -1,6 +1,6 @@
1
- import { GridRowId } from '@mui/x-data-grid';
1
+ import { GridAggregationPosition } from '@mui/x-data-grid-pro/internals';
2
+ import { GridRowId } from '@mui/x-data-grid-pro';
2
3
  import { GridStatePremium } from "../../../models/gridStatePremium.js";
3
- import { GridAggregationPosition } from "./gridAggregationInterfaces.js";
4
4
  export declare const gridAggregationStateSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, unknown, import("./gridAggregationInterfaces.js").GridAggregationState>;
5
5
  /**
6
6
  * Get the aggregation model, containing the aggregation function of each column.
@@ -1,5 +1,5 @@
1
1
  import { createSelector, createRootSelector } from '@mui/x-data-grid-pro/internals';
2
- import { gridRowTreeSelector } from '@mui/x-data-grid';
2
+ import { gridRowTreeSelector } from '@mui/x-data-grid-pro';
3
3
  export const gridAggregationStateSelector = createRootSelector(state => state.aggregation);
4
4
 
5
5
  /**
@@ -1,4 +1,5 @@
1
- export type { GridAggregationState, GridAggregationInitialState, GridAggregationInternalCache, GridAggregationApi, GridAggregationGetCellValueParams, GridAggregationFunction, GridAggregationFunctionDataSource, GridAggregationParams, GridAggregationModel, GridAggregationLookup, GridAggregationPosition, GridAggregationCellMeta, GridAggregationHeaderMeta, GridAggregationRule, GridAggregationRules } from "./gridAggregationInterfaces.js";
1
+ export type { GridAggregationPosition, GridAggregationCellMeta } from '@mui/x-data-grid-pro/internals';
2
+ export type { GridAggregationState, GridAggregationInitialState, GridAggregationInternalCache, GridAggregationApi, GridAggregationGetCellValueParams, GridAggregationFunction, GridAggregationFunctionDataSource, GridAggregationParams, GridAggregationModel, GridAggregationLookup, GridAggregationHeaderMeta, GridAggregationRule, GridAggregationRules } from "./gridAggregationInterfaces.js";
2
3
  export { gridAggregationStateSelector, gridAggregationLookupSelector, gridAggregationModelSelector } from "./gridAggregationSelectors.js";
3
4
  export * from "./gridAggregationFunctions.js";
4
5
  export { GRID_AGGREGATION_ROOT_FOOTER_ROW_ID, getAggregationFooterRowIdFromGroupId } from "./gridAggregationUtils.js";
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridColDef } from '@mui/x-data-grid-pro';
3
- import type { GridBaseColDef } from '@mui/x-data-grid-pro/internals';
3
+ import { GridBaseColDef } from '@mui/x-data-grid-pro/internals';
4
4
  import { GridApiPremium } from "../../../models/gridApiPremium.js";
5
5
  import type { GridAggregationRule } from "./gridAggregationInterfaces.js";
6
6
  /**
@@ -2,8 +2,8 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
3
  const _excluded = ["aggregationWrappedProperties"];
4
4
  import { gridRowNodeSelector } from '@mui/x-data-grid-pro';
5
+ import { GridFooterCell } from '@mui/x-data-grid-pro/internals';
5
6
  import { gridAggregationLookupSelector } from "./gridAggregationSelectors.js";
6
- import { GridFooterCell } from "../../../components/GridFooterCell.js";
7
7
  import { GridAggregationHeader } from "../../../components/GridAggregationHeader.js";
8
8
  import { gridPivotActiveSelector } from "../pivoting/gridPivotingSelectors.js";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -31,7 +31,8 @@ const getAggregationValueWrappedRenderCell = ({
31
31
  }
32
32
  const aggregationMeta = {
33
33
  hasCellUnit: aggregationRule.aggregationFunction.hasCellUnit ?? true,
34
- aggregationFunctionName: aggregationRule.aggregationFunctionName
34
+ aggregationFunctionName: aggregationRule.aggregationFunctionName,
35
+ position: cellAggregationResult.position
35
36
  };
36
37
  return renderCell(_extends({}, params, {
37
38
  aggregation: aggregationMeta
@@ -21,8 +21,10 @@ export const useGridDataSourcePremium = (apiRef, props) => {
21
21
  const aggregationModel = gridAggregationModelSelector(apiRef);
22
22
  const groupingModelSize = gridRowGroupingSanitizedModelSelector(apiRef).length;
23
23
  const setStrategyAvailability = React.useCallback(() => {
24
- const targetStrategy = props.treeData || !props.disableRowGrouping && groupingModelSize > 0 ? DataSourceRowsUpdateStrategy.GroupedData : DataSourceRowsUpdateStrategy.Default;
25
- apiRef.current.setStrategyAvailability(GridStrategyGroup.DataSource, targetStrategy, props.dataSource && !props.lazyLoading ? () => true : () => false);
24
+ const currentStrategy = props.treeData || !props.disableRowGrouping && groupingModelSize > 0 ? DataSourceRowsUpdateStrategy.GroupedData : DataSourceRowsUpdateStrategy.Default;
25
+ const prevStrategy = currentStrategy === DataSourceRowsUpdateStrategy.GroupedData ? DataSourceRowsUpdateStrategy.Default : DataSourceRowsUpdateStrategy.GroupedData;
26
+ apiRef.current.setStrategyAvailability(GridStrategyGroup.DataSource, prevStrategy, () => false);
27
+ apiRef.current.setStrategyAvailability(GridStrategyGroup.DataSource, currentStrategy, props.dataSource && !props.lazyLoading ? () => true : () => false);
26
28
  }, [apiRef, props.dataSource, props.lazyLoading, props.treeData, props.disableRowGrouping, groupingModelSize]);
27
29
  const handleEditRowWithAggregation = React.useCallback((params, updatedRow) => {
28
30
  const rowTree = gridRowTreeSelector(apiRef);
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-premium v8.22.1
2
+ * @mui/x-data-grid-premium v8.23.0
3
3
  *
4
4
  * @license SEE LICENSE IN LICENSE
5
5
  * This source code is licensed under the SEE LICENSE IN LICENSE license found in the
@@ -1,7 +1,8 @@
1
- import { GridExportDisplayOptions, GridValidRowModel } from '@mui/x-data-grid-pro';
1
+ import type { GridExportDisplayOptions, GridValidRowModel } from '@mui/x-data-grid-pro';
2
+ import type { GridAggregationCellMeta } from '@mui/x-data-grid-pro/internals';
2
3
  import type { GridPipeProcessingLookupPro, GridControlledStateEventLookupPro, GridApiCachesPro, GridEventLookupPro } from '@mui/x-data-grid-pro/typeOverloads';
3
4
  import type { GridGroupingValueGetter, GridGroupingValueSetter, GridPastedValueParser } from "../models/index.js";
4
- import type { GridRowGroupingModel, GridAggregationModel, GridAggregationCellMeta, GridAggregationHeaderMeta, GridCellSelectionModel, Conversation } from "../hooks/index.js";
5
+ import type { GridRowGroupingModel, GridAggregationModel, GridAggregationHeaderMeta, GridCellSelectionModel, Conversation } from "../hooks/index.js";
5
6
  import { GridRowGroupingInternalCache } from "../hooks/features/rowGrouping/gridRowGroupingInterfaces.js";
6
7
  import { GridAggregationInternalCache } from "../hooks/features/aggregation/gridAggregationInterfaces.js";
7
8
  import type { GridExcelExportOptions } from "../hooks/features/export/gridExcelExportInterface.js";
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.shouldApplySorting = exports.createAggregationLookup = void 0;
7
7
  var _xDataGridPro = require("@mui/x-data-grid-pro");
8
- var _internals = require("@mui/x-data-grid/internals");
8
+ var _internals = require("@mui/x-data-grid-pro/internals");
9
9
  const shouldApplySorting = (aggregationRules, aggregatedFields) => {
10
10
  return aggregatedFields.some(field => aggregationRules[field].aggregationFunction.applySorting);
11
11
  };
@@ -5,4 +5,6 @@ export declare const GRID_AGGREGATION_FUNCTIONS: {
5
5
  min: GridAggregationFunction<number | Date, number | Date>;
6
6
  max: GridAggregationFunction<number | Date, number | Date>;
7
7
  size: GridAggregationFunction<unknown, number>;
8
+ sizeTrue: GridAggregationFunction<unknown, number>;
9
+ sizeFalse: GridAggregationFunction<unknown, number>;
8
10
  };
@@ -103,10 +103,44 @@ const sizeAgg = {
103
103
  },
104
104
  hasCellUnit: false
105
105
  };
106
+ const sizeTrueAgg = {
107
+ apply: ({
108
+ values
109
+ }) => {
110
+ return values.filter(value => value === true).length;
111
+ },
112
+ columnTypes: ['boolean'],
113
+ label: 'size(true)',
114
+ valueFormatter: value => {
115
+ if (value == null || !(0, _internals.isNumber)(value)) {
116
+ return value;
117
+ }
118
+ return value.toLocaleString();
119
+ },
120
+ hasCellUnit: false
121
+ };
122
+ const sizeFalseAgg = {
123
+ apply: ({
124
+ values
125
+ }) => {
126
+ return values.filter(value => value === false).length;
127
+ },
128
+ columnTypes: ['boolean'],
129
+ label: 'size(false)',
130
+ valueFormatter: value => {
131
+ if (value == null || !(0, _internals.isNumber)(value)) {
132
+ return value;
133
+ }
134
+ return value.toLocaleString();
135
+ },
136
+ hasCellUnit: false
137
+ };
106
138
  const GRID_AGGREGATION_FUNCTIONS = exports.GRID_AGGREGATION_FUNCTIONS = {
107
139
  sum: sumAgg,
108
140
  avg: avgAgg,
109
141
  min: minAgg,
110
142
  max: maxAgg,
111
- size: sizeAgg
143
+ size: sizeAgg,
144
+ sizeTrue: sizeTrueAgg,
145
+ sizeFalse: sizeFalseAgg
112
146
  };
@@ -1,5 +1,6 @@
1
- import { GridRowId, GridRowModel, GridColDef, GridValueFormatter } from '@mui/x-data-grid-pro';
2
- import { GridApiPremium } from "../../../models/gridApiPremium.js";
1
+ import type { GridRowId, GridRowModel, GridColDef, GridValueFormatter } from '@mui/x-data-grid-pro';
2
+ import type { GridAggregationPosition } from '@mui/x-data-grid-pro/internals';
3
+ import type { GridApiPremium } from "../../../models/gridApiPremium.js";
3
4
  export interface GridAggregationState {
4
5
  model: GridAggregationModel;
5
6
  lookup: GridAggregationLookup;
@@ -108,20 +109,6 @@ export type GridAggregationLookup = {
108
109
  };
109
110
  };
110
111
  };
111
- export type GridAggregationPosition = 'inline' | 'footer';
112
- export interface GridAggregationCellMeta {
113
- /**
114
- * If `true`, the current aggregated value has the same unit as the value of the other cells of this row.
115
- * For instance, "min" / "max" aggregation have the same unit as the other cells.
116
- * If `false`, the current aggregated value has another unit or not unit.
117
- * For instance, "size" aggregation has no unit.
118
- */
119
- hasCellUnit: boolean;
120
- /**
121
- * Name of the aggregation function currently applied on this cell.
122
- */
123
- aggregationFunctionName: string;
124
- }
125
112
  export interface GridAggregationHeaderMeta {
126
113
  aggregationRule: GridAggregationRule;
127
114
  }
@@ -1,6 +1,6 @@
1
- import { GridRowId } from '@mui/x-data-grid';
1
+ import { GridAggregationPosition } from '@mui/x-data-grid-pro/internals';
2
+ import { GridRowId } from '@mui/x-data-grid-pro';
2
3
  import { GridStatePremium } from "../../../models/gridStatePremium.js";
3
- import { GridAggregationPosition } from "./gridAggregationInterfaces.js";
4
4
  export declare const gridAggregationStateSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, unknown, import("./gridAggregationInterfaces.js").GridAggregationState>;
5
5
  /**
6
6
  * Get the aggregation model, containing the aggregation function of each column.
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.gridCellAggregationResultSelector = exports.gridAggregationStateSelector = exports.gridAggregationModelSelector = exports.gridAggregationLookupSelector = void 0;
7
7
  var _internals = require("@mui/x-data-grid-pro/internals");
8
- var _xDataGrid = require("@mui/x-data-grid");
8
+ var _xDataGridPro = require("@mui/x-data-grid-pro");
9
9
  const gridAggregationStateSelector = exports.gridAggregationStateSelector = (0, _internals.createRootSelector)(state => state.aggregation);
10
10
 
11
11
  /**
@@ -20,7 +20,7 @@ const gridAggregationModelSelector = exports.gridAggregationModelSelector = (0,
20
20
  * @category Aggregation
21
21
  */
22
22
  const gridAggregationLookupSelector = exports.gridAggregationLookupSelector = (0, _internals.createSelector)(gridAggregationStateSelector, aggregationState => aggregationState.lookup);
23
- const gridCellAggregationResultSelector = exports.gridCellAggregationResultSelector = (0, _internals.createSelector)(_xDataGrid.gridRowTreeSelector, gridAggregationLookupSelector, (rowTree, aggregationLookup, {
23
+ const gridCellAggregationResultSelector = exports.gridCellAggregationResultSelector = (0, _internals.createSelector)(_xDataGridPro.gridRowTreeSelector, gridAggregationLookupSelector, (rowTree, aggregationLookup, {
24
24
  id,
25
25
  field
26
26
  }) => {
@@ -1,4 +1,5 @@
1
- export type { GridAggregationState, GridAggregationInitialState, GridAggregationInternalCache, GridAggregationApi, GridAggregationGetCellValueParams, GridAggregationFunction, GridAggregationFunctionDataSource, GridAggregationParams, GridAggregationModel, GridAggregationLookup, GridAggregationPosition, GridAggregationCellMeta, GridAggregationHeaderMeta, GridAggregationRule, GridAggregationRules } from "./gridAggregationInterfaces.js";
1
+ export type { GridAggregationPosition, GridAggregationCellMeta } from '@mui/x-data-grid-pro/internals';
2
+ export type { GridAggregationState, GridAggregationInitialState, GridAggregationInternalCache, GridAggregationApi, GridAggregationGetCellValueParams, GridAggregationFunction, GridAggregationFunctionDataSource, GridAggregationParams, GridAggregationModel, GridAggregationLookup, GridAggregationHeaderMeta, GridAggregationRule, GridAggregationRules } from "./gridAggregationInterfaces.js";
2
3
  export { gridAggregationStateSelector, gridAggregationLookupSelector, gridAggregationModelSelector } from "./gridAggregationSelectors.js";
3
4
  export * from "./gridAggregationFunctions.js";
4
5
  export { GRID_AGGREGATION_ROOT_FOOTER_ROW_ID, getAggregationFooterRowIdFromGroupId } from "./gridAggregationUtils.js";
@@ -1,6 +1,6 @@
1
1
  import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridColDef } from '@mui/x-data-grid-pro';
3
- import type { GridBaseColDef } from '@mui/x-data-grid-pro/internals';
3
+ import { GridBaseColDef } from '@mui/x-data-grid-pro/internals';
4
4
  import { GridApiPremium } from "../../../models/gridApiPremium.js";
5
5
  import type { GridAggregationRule } from "./gridAggregationInterfaces.js";
6
6
  /**
@@ -8,8 +8,8 @@ exports.wrapColumnWithAggregationValue = exports.unwrapColumnFromAggregation = v
8
8
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _xDataGridPro = require("@mui/x-data-grid-pro");
11
+ var _internals = require("@mui/x-data-grid-pro/internals");
11
12
  var _gridAggregationSelectors = require("./gridAggregationSelectors");
12
- var _GridFooterCell = require("../../../components/GridFooterCell");
13
13
  var _GridAggregationHeader = require("../../../components/GridAggregationHeader");
14
14
  var _gridPivotingSelectors = require("../pivoting/gridPivotingSelectors");
15
15
  var _jsxRuntime = require("react/jsx-runtime");
@@ -26,7 +26,7 @@ const getAggregationValueWrappedRenderCell = ({
26
26
  if (cellAggregationResult != null) {
27
27
  if (!renderCell) {
28
28
  if (cellAggregationResult.position === 'footer') {
29
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridFooterCell.GridFooterCell, (0, _extends2.default)({}, params));
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.GridFooterCell, (0, _extends2.default)({}, params));
30
30
  }
31
31
  if (pivotActive && cellAggregationResult.value === 0) {
32
32
  return null;
@@ -38,7 +38,8 @@ const getAggregationValueWrappedRenderCell = ({
38
38
  }
39
39
  const aggregationMeta = {
40
40
  hasCellUnit: aggregationRule.aggregationFunction.hasCellUnit ?? true,
41
- aggregationFunctionName: aggregationRule.aggregationFunctionName
41
+ aggregationFunctionName: aggregationRule.aggregationFunctionName,
42
+ position: cellAggregationResult.position
42
43
  };
43
44
  return renderCell((0, _extends2.default)({}, params, {
44
45
  aggregation: aggregationMeta
@@ -28,8 +28,10 @@ const useGridDataSourcePremium = (apiRef, props) => {
28
28
  const aggregationModel = (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef);
29
29
  const groupingModelSize = (0, _gridRowGroupingSelector.gridRowGroupingSanitizedModelSelector)(apiRef).length;
30
30
  const setStrategyAvailability = React.useCallback(() => {
31
- const targetStrategy = props.treeData || !props.disableRowGrouping && groupingModelSize > 0 ? _internals.DataSourceRowsUpdateStrategy.GroupedData : _internals.DataSourceRowsUpdateStrategy.Default;
32
- apiRef.current.setStrategyAvailability(_internals.GridStrategyGroup.DataSource, targetStrategy, props.dataSource && !props.lazyLoading ? () => true : () => false);
31
+ const currentStrategy = props.treeData || !props.disableRowGrouping && groupingModelSize > 0 ? _internals.DataSourceRowsUpdateStrategy.GroupedData : _internals.DataSourceRowsUpdateStrategy.Default;
32
+ const prevStrategy = currentStrategy === _internals.DataSourceRowsUpdateStrategy.GroupedData ? _internals.DataSourceRowsUpdateStrategy.Default : _internals.DataSourceRowsUpdateStrategy.GroupedData;
33
+ apiRef.current.setStrategyAvailability(_internals.GridStrategyGroup.DataSource, prevStrategy, () => false);
34
+ apiRef.current.setStrategyAvailability(_internals.GridStrategyGroup.DataSource, currentStrategy, props.dataSource && !props.lazyLoading ? () => true : () => false);
33
35
  }, [apiRef, props.dataSource, props.lazyLoading, props.treeData, props.disableRowGrouping, groupingModelSize]);
34
36
  const handleEditRowWithAggregation = React.useCallback((params, updatedRow) => {
35
37
  const rowTree = (0, _xDataGridPro.gridRowTreeSelector)(apiRef);
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid-premium v8.22.1
2
+ * @mui/x-data-grid-premium v8.23.0
3
3
  *
4
4
  * @license SEE LICENSE IN LICENSE
5
5
  * This source code is licensed under the SEE LICENSE IN LICENSE license found in the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-premium",
3
- "version": "8.22.1",
3
+ "version": "8.23.0",
4
4
  "author": "MUI Team",
5
5
  "description": "The Premium plan edition of the MUI X Data Grid Components.",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -38,10 +38,10 @@
38
38
  "@mui/x-internal-exceljs-fork": "4.4.3",
39
39
  "clsx": "^2.1.1",
40
40
  "prop-types": "^15.8.1",
41
- "@mui/x-data-grid": "8.22.1",
42
- "@mui/x-data-grid-pro": "8.22.1",
43
- "@mui/x-internals": "8.22.0",
44
- "@mui/x-license": "8.22.0"
41
+ "@mui/x-data-grid": "8.23.0",
42
+ "@mui/x-internals": "8.23.0",
43
+ "@mui/x-license": "8.23.0",
44
+ "@mui/x-data-grid-pro": "8.23.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@emotion/react": "^11.9.0",
@@ -1,7 +1,8 @@
1
- import { GridExportDisplayOptions, GridValidRowModel } from '@mui/x-data-grid-pro';
1
+ import type { GridExportDisplayOptions, GridValidRowModel } from '@mui/x-data-grid-pro';
2
+ import type { GridAggregationCellMeta } from '@mui/x-data-grid-pro/internals';
2
3
  import type { GridPipeProcessingLookupPro, GridControlledStateEventLookupPro, GridApiCachesPro, GridEventLookupPro } from '@mui/x-data-grid-pro/typeOverloads';
3
4
  import type { GridGroupingValueGetter, GridGroupingValueSetter, GridPastedValueParser } from "../models/index.js";
4
- import type { GridRowGroupingModel, GridAggregationModel, GridAggregationCellMeta, GridAggregationHeaderMeta, GridCellSelectionModel, Conversation } from "../hooks/index.js";
5
+ import type { GridRowGroupingModel, GridAggregationModel, GridAggregationHeaderMeta, GridCellSelectionModel, Conversation } from "../hooks/index.js";
5
6
  import { GridRowGroupingInternalCache } from "../hooks/features/rowGrouping/gridRowGroupingInterfaces.js";
6
7
  import { GridAggregationInternalCache } from "../hooks/features/aggregation/gridAggregationInterfaces.js";
7
8
  import type { GridExcelExportOptions } from "../hooks/features/export/gridExcelExportInterface.js";
@@ -1,8 +0,0 @@
1
- import { GridRenderCellParams } from '@mui/x-data-grid';
2
- import { Theme } from '@mui/material/styles';
3
- import { SxProps } from '@mui/system';
4
- interface GridFooterCellProps extends GridRenderCellParams {
5
- sx?: SxProps<Theme>;
6
- }
7
- declare function GridFooterCell(props: GridFooterCellProps): import("react/jsx-runtime").JSX.Element;
8
- export { GridFooterCell };
@@ -1,47 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.GridFooterCell = GridFooterCell;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
- var _xDataGrid = require("@mui/x-data-grid");
11
- var _internals = require("@mui/x-data-grid/internals");
12
- var _styles = require("@mui/material/styles");
13
- var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
14
- var _useGridRootProps = require("../hooks/utils/useGridRootProps");
15
- var _jsxRuntime = require("react/jsx-runtime");
16
- const _excluded = ["formattedValue", "colDef", "cellMode", "row", "api", "id", "value", "rowNode", "field", "hasFocus", "tabIndex", "isEditable"];
17
- const GridFooterCellRoot = (0, _styles.styled)('div', {
18
- name: 'MuiDataGrid',
19
- slot: 'FooterCell'
20
- })({
21
- fontWeight: _internals.vars.typography.fontWeight.medium,
22
- color: _internals.vars.colors.foreground.accent
23
- });
24
- const useUtilityClasses = ownerState => {
25
- const {
26
- classes
27
- } = ownerState;
28
- const slots = {
29
- root: ['footerCell']
30
- };
31
- return (0, _composeClasses.default)(slots, _xDataGrid.getDataGridUtilityClass, classes);
32
- };
33
- function GridFooterCell(props) {
34
- const {
35
- formattedValue
36
- } = props,
37
- other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
38
- const rootProps = (0, _useGridRootProps.useGridRootProps)();
39
- const ownerState = rootProps;
40
- const classes = useUtilityClasses(ownerState);
41
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridFooterCellRoot, (0, _extends2.default)({
42
- ownerState: ownerState,
43
- className: classes.root
44
- }, other, {
45
- children: formattedValue
46
- }));
47
- }
@@ -1,8 +0,0 @@
1
- import { GridRenderCellParams } from '@mui/x-data-grid';
2
- import { Theme } from '@mui/material/styles';
3
- import { SxProps } from '@mui/system';
4
- interface GridFooterCellProps extends GridRenderCellParams {
5
- sx?: SxProps<Theme>;
6
- }
7
- declare function GridFooterCell(props: GridFooterCellProps): import("react/jsx-runtime").JSX.Element;
8
- export { GridFooterCell };
@@ -1,41 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["formattedValue", "colDef", "cellMode", "row", "api", "id", "value", "rowNode", "field", "hasFocus", "tabIndex", "isEditable"];
4
- import { getDataGridUtilityClass } from '@mui/x-data-grid';
5
- import { vars } from '@mui/x-data-grid/internals';
6
- import { styled } from '@mui/material/styles';
7
- import composeClasses from '@mui/utils/composeClasses';
8
- import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- const GridFooterCellRoot = styled('div', {
11
- name: 'MuiDataGrid',
12
- slot: 'FooterCell'
13
- })({
14
- fontWeight: vars.typography.fontWeight.medium,
15
- color: vars.colors.foreground.accent
16
- });
17
- const useUtilityClasses = ownerState => {
18
- const {
19
- classes
20
- } = ownerState;
21
- const slots = {
22
- root: ['footerCell']
23
- };
24
- return composeClasses(slots, getDataGridUtilityClass, classes);
25
- };
26
- function GridFooterCell(props) {
27
- const {
28
- formattedValue
29
- } = props,
30
- other = _objectWithoutPropertiesLoose(props, _excluded);
31
- const rootProps = useGridRootProps();
32
- const ownerState = rootProps;
33
- const classes = useUtilityClasses(ownerState);
34
- return /*#__PURE__*/_jsx(GridFooterCellRoot, _extends({
35
- ownerState: ownerState,
36
- className: classes.root
37
- }, other, {
38
- children: formattedValue
39
- }));
40
- }
41
- export { GridFooterCell };