@mui/x-data-grid-premium 8.0.0-alpha.6 → 8.0.0-alpha.7
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 +127 -1
- package/DataGridPremium/DataGridPremium.js +2 -1
- package/DataGridPremium/useDataGridPremiumComponent.d.ts +1 -1
- package/DataGridPremium/useDataGridPremiumComponent.js +2 -1
- package/DataGridPremium/useDataGridPremiumProps.js +3 -1
- package/components/GridColumnMenuAggregationItem.js +53 -20
- package/esm/DataGridPremium/DataGridPremium.js +2 -1
- package/esm/DataGridPremium/useDataGridPremiumComponent.js +3 -2
- package/esm/DataGridPremium/useDataGridPremiumProps.js +3 -1
- package/esm/components/GridColumnMenuAggregationItem.js +51 -18
- package/esm/hooks/features/aggregation/createAggregationLookup.js +52 -55
- package/esm/hooks/features/aggregation/gridAggregationUtils.js +17 -13
- package/esm/hooks/features/aggregation/index.js +0 -1
- package/esm/hooks/features/aggregation/useGridAggregation.js +22 -10
- package/esm/hooks/features/aggregation/useGridAggregationPreProcessors.js +7 -14
- package/esm/hooks/features/cellSelection/useGridCellSelection.js +3 -3
- package/esm/hooks/features/dataSource/cache.js +3 -0
- package/esm/hooks/features/dataSource/models.js +1 -0
- package/esm/hooks/features/dataSource/useGridDataSourcePremium.js +53 -0
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/aggregation/createAggregationLookup.d.ts +6 -5
- package/hooks/features/aggregation/createAggregationLookup.js +52 -55
- package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +18 -5
- package/hooks/features/aggregation/gridAggregationUtils.d.ts +9 -10
- package/hooks/features/aggregation/gridAggregationUtils.js +17 -13
- package/hooks/features/aggregation/index.d.ts +1 -1
- package/hooks/features/aggregation/index.js +0 -12
- package/hooks/features/aggregation/useGridAggregation.d.ts +1 -1
- package/hooks/features/aggregation/useGridAggregation.js +22 -10
- package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +1 -1
- package/hooks/features/aggregation/useGridAggregationPreProcessors.js +7 -14
- package/hooks/features/cellSelection/useGridCellSelection.d.ts +1 -1
- package/hooks/features/cellSelection/useGridCellSelection.js +3 -3
- package/hooks/features/dataSource/cache.d.ts +2 -0
- package/hooks/features/dataSource/cache.js +9 -0
- package/hooks/features/dataSource/models.d.ts +47 -0
- package/hooks/features/dataSource/models.js +5 -0
- package/hooks/features/dataSource/useGridDataSourcePremium.d.ts +4 -0
- package/hooks/features/dataSource/useGridDataSourcePremium.js +62 -0
- package/hooks/utils/useGridApiRef.d.ts +1 -1
- package/index.d.ts +2 -0
- package/index.js +1 -1
- package/models/dataGridPremiumProps.d.ts +6 -4
- package/models/gridApiPremium.d.ts +5 -3
- package/modern/DataGridPremium/DataGridPremium.js +2 -1
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +3 -2
- package/modern/DataGridPremium/useDataGridPremiumProps.js +3 -1
- package/modern/components/GridColumnMenuAggregationItem.js +51 -18
- package/modern/hooks/features/aggregation/createAggregationLookup.js +52 -55
- package/modern/hooks/features/aggregation/gridAggregationUtils.js +17 -13
- package/modern/hooks/features/aggregation/index.js +0 -1
- package/modern/hooks/features/aggregation/useGridAggregation.js +22 -10
- package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +7 -14
- package/modern/hooks/features/cellSelection/useGridCellSelection.js +3 -3
- package/modern/hooks/features/dataSource/cache.js +3 -0
- package/modern/hooks/features/dataSource/models.js +1 -0
- package/modern/hooks/features/dataSource/useGridDataSourcePremium.js +53 -0
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +5 -5
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,132 @@
|
|
|
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.0.0-alpha.7
|
|
9
|
+
|
|
10
|
+
_Jan 9, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 📊 Charts legend is now an HTML element which can be styled more easily
|
|
15
|
+
- 💫 Support [aggregation with server-side data](/x/react-data-grid/server-side-data/aggregation/)
|
|
16
|
+
- 🏎️ Improve Data Grid aggregation performance
|
|
17
|
+
- 🌍 Add Chinese (Taiwan) (zh-TW) locale on the Date and Time Pickers
|
|
18
|
+
- 🌍 Improve Norwegian (nb-NO) locale on the Date and Time Pickers
|
|
19
|
+
- 🐞 Bugfixes
|
|
20
|
+
|
|
21
|
+
Special thanks go out to the community contributors who have helped make this release possible:
|
|
22
|
+
@derek-0000, @josteinjhauge, @k-rajat19, @nusr, @tomashauser.
|
|
23
|
+
Following are all team members who have contributed to this release:
|
|
24
|
+
@cherniavskii, @flaviendelangle, @JCQuintas, @LukasTy, @MBilalShafi, @arminmeh, @romgrk, @oliviertassinari.
|
|
25
|
+
|
|
26
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
27
|
+
|
|
28
|
+
### Data Grid
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid@8.0.0-alpha.7`
|
|
31
|
+
|
|
32
|
+
- [DataGrid] Improve React 19 support (#15769) @LukasTy
|
|
33
|
+
- [DataGrid] Add `name` attribute to the checkbox selection column (#15178) @derek-0000
|
|
34
|
+
- [DataGrid] Fix number filter field formatting values while typing (#16062) @arminmeh
|
|
35
|
+
- [DataGrid] Fix select all checkbox state reset with server side data (#16034) @MBilalShafi
|
|
36
|
+
- [DataGrid] Refactor: create base button props (#15930) @romgrk
|
|
37
|
+
- [DataGrid] Refactor: create tooltip props (#16086) @romgrk
|
|
38
|
+
- [DataGrid] Fix TS error (#16046) @cherniavskii
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-data-grid-pro@8.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
41
|
+
|
|
42
|
+
Same changes as in `@mui/x-data-grid@8.0.0-alpha.7`.
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-data-grid-premium@8.0.0-alpha.7` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
45
|
+
|
|
46
|
+
Same changes as in `@mui/x-data-grid-pro@8.0.0-alpha.7`, plus:
|
|
47
|
+
|
|
48
|
+
- [DataGridPremium] Improve aggregation performance for multiple columns (#16097) @cherniavskii
|
|
49
|
+
- [DataGridPremium] Make Aggregation keyboard accessible in the column menu (#15934) @k-rajat19
|
|
50
|
+
- [DataGridPremium] Server-side aggregation with data source (#15741) @MBilalShafi
|
|
51
|
+
|
|
52
|
+
### Date and Time Pickers
|
|
53
|
+
|
|
54
|
+
#### Breaking changes
|
|
55
|
+
|
|
56
|
+
- The `date-fns` and `date-fns-jalali` date library adapters have been renamed to better align with the current stable major versions — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#✅-rename-date-fns-adapter-imports)
|
|
57
|
+
- Update default `closeOnSelect` and Action Bar `actions` values - [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#update-default-closeonselect-and-action-bar-actions-values)
|
|
58
|
+
- The component passed to the `layout` slot no longer receives the `value`, `onChange` and `onSelectShortcut` props — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-layout).
|
|
59
|
+
- The component passed to the `toolbar` slot no longer receives the `value`, `onChange` and `isLandscape` props — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-toolbar).
|
|
60
|
+
- The component passed to the `shortcuts` slot no longer receives the `onChange`, `isValid` and `isLandscape` props — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-shortcuts).
|
|
61
|
+
- The `PickerShortcutChangeImportance` type has been renamed `PickerChangeImportance` — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#renamed-variables-and-types).
|
|
62
|
+
- The component passed to the `layout` slot no longer receives the `rangePosition` and `onRangePositionChange` on range pickers — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-layout).
|
|
63
|
+
- The component passed to the `toolbar` slot no longer receives the `rangePosition` and `onRangePositionChange` on range pickers — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-toolbar).
|
|
64
|
+
- The component passed to the `tabs` slot no longer receives the `rangePosition` and `onRangePositionChange` on range pickers — [Learn more](https://next.mui.com/x/migration/migration-pickers-v7/#slot-tabs).
|
|
65
|
+
|
|
66
|
+
#### `@mui/x-date-pickers@8.0.0-alpha.7`
|
|
67
|
+
|
|
68
|
+
- [fields] Handle focusing container with `inputRef.current.focus` on `accessibleFieldDOMStructure` (#15985) @LukasTy
|
|
69
|
+
- [pickers] Always use `setValue` internally to update the picker value (#16056) @flaviendelangle
|
|
70
|
+
- [pickers] Create a new context to pass the range position props to the layout components and to the views (#15846) @flaviendelangle
|
|
71
|
+
- [pickers] Introduce a new concept of `manager` (#15339) @flaviendelangle
|
|
72
|
+
- [pickers] Improve React 19 support (#15769) @LukasTy
|
|
73
|
+
- [pickers] Memoize `<PickersActionBar />` (#16071) @LukasTy
|
|
74
|
+
- [pickers] Remove `NonEmptyDateRange` type (#16035) @flaviendelangle
|
|
75
|
+
- [pickers] Rename `AdapterDateFns` into `AdapterDateFnsV2` and `AdapterDateFnsV3` into `AdapterDateFns` (#16082) @LukasTy
|
|
76
|
+
- [pickers] Rename `ctx.onViewChange` to `ctx.setView` and add it to the actions context (#16044) @flaviendelangle
|
|
77
|
+
- [pickers] Support `date-fns-jalali` v4 (#16011) @LukasTy
|
|
78
|
+
- [pickers] Update `closeOnSelect` and `actionBar.actions` default values (#15944) @LukasTy
|
|
79
|
+
- [pickers] Use `usePickerContext()` and `usePickerActionsContext()` instead of passing props to the `shortcuts` and `toolbar` slots (#15948) @flaviendelangle
|
|
80
|
+
- [l10n] Add Chinese (Taiwan) (zh-TW) locale (#16033) @nusr
|
|
81
|
+
- [l10n] Improve Norwegian (nb-NO) locale (#16089) @josteinjhauge
|
|
82
|
+
|
|
83
|
+
#### `@mui/x-date-pickers-pro@8.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
84
|
+
|
|
85
|
+
Same changes as in `@mui/x-date-pickers@8.0.0-alpha.7`.
|
|
86
|
+
|
|
87
|
+
### Charts
|
|
88
|
+
|
|
89
|
+
#### Breaking changes
|
|
90
|
+
|
|
91
|
+
- Removed `DefaultChartsLegend` component, since it is now easier to create custom legends — [Learn more](https://next.mui.com/x/react-charts/components/#html-components).
|
|
92
|
+
- The default legend is now an HTML element and can be styled more easily.
|
|
93
|
+
- The `width` and `height` properties of the charts now only apply to the `svg` element, and not their wrappers, this might cause some layout shifts.
|
|
94
|
+
- `slotProps.legend.direction` now accepts `'horizontal' | 'vertical'` instead of `'row' | 'column'` — [Learn more](https://next.mui.com/x/migration/migration-charts-v7/#legend-direction-value-change-✅).
|
|
95
|
+
- The `getSeriesToDisplay` function was removed in favor of the `useLegend` hook. — [Learn more](https://next.mui.com/x/migration/migration-charts-v7/#the-getseriestodisplay-function-was-removed).
|
|
96
|
+
|
|
97
|
+
#### `@mui/x-charts@8.0.0-alpha.7`
|
|
98
|
+
|
|
99
|
+
- [charts] New HTML legend & styles (#15733) @JCQuintas
|
|
100
|
+
- [charts] Improve React 19 support (#15769) @LukasTy
|
|
101
|
+
- [charts] Fix 301 redirection in the API documentation @oliviertassinari
|
|
102
|
+
|
|
103
|
+
#### `@mui/x-charts-pro@8.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
104
|
+
|
|
105
|
+
Same changes as in `@mui/x-charts@8.0.0-alpha.7`.
|
|
106
|
+
|
|
107
|
+
### Tree View
|
|
108
|
+
|
|
109
|
+
#### `@mui/x-tree-view@8.0.0-alpha.7`
|
|
110
|
+
|
|
111
|
+
- [TreeView] Improve React 19 support (#15769) @LukasTy
|
|
112
|
+
|
|
113
|
+
#### `@mui/x-tree-view-pro@8.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
114
|
+
|
|
115
|
+
Same changes as in `@mui/x-tree-view@8.0.0-alpha.7`.
|
|
116
|
+
|
|
117
|
+
### Docs
|
|
118
|
+
|
|
119
|
+
- [docs] Fix `EditingWithDatePickers` demo (#15967) @k-rajat19
|
|
120
|
+
- [docs] Fix inconsistent multi input range field separators (#16043) @flaviendelangle
|
|
121
|
+
- [docs] Fix non-existing "adapter" property of `LocalizationProvider` (#16084) @tomashauser
|
|
122
|
+
- [docs] Refactor Data Grid with Date Pickers example (#15992) @LukasTy
|
|
123
|
+
- [docs] Unify the wording of the pickers slots breaking changes (#16036) @flaviendelangle
|
|
124
|
+
|
|
125
|
+
### Core
|
|
126
|
+
|
|
127
|
+
- [core] Clarify the release strategy (#16014) @MBilalShafi
|
|
128
|
+
- [core] Small fixes on docs @oliviertassinari
|
|
129
|
+
- [core] Sync with other repos @oliviertassinari
|
|
130
|
+
- [core] Update the `release:version` docs (#16038) @cherniavskii
|
|
131
|
+
- [code-infra] Add `testSkipIf` and `describeSkipIf` (#16049) @JCQuintas
|
|
132
|
+
- [test] Stabilize flaky Data Grid tests (#16053) @LukasTy
|
|
133
|
+
|
|
8
134
|
## 8.0.0-alpha.6
|
|
9
135
|
|
|
10
136
|
_Dec 26, 2024_
|
|
@@ -104,7 +230,7 @@ Following are all team members who have contributed to this release:
|
|
|
104
230
|
|
|
105
231
|
#### Breaking changes
|
|
106
232
|
|
|
107
|
-
- Passing additional props (like `data-*`, `aria-*`) directly on the Data Grid component is no longer supported. To pass the props, use `slotProps
|
|
233
|
+
- Passing additional props (like `data-*`, `aria-*`) directly on the Data Grid component is no longer supported. To pass the props, use `slotProps`:
|
|
108
234
|
|
|
109
235
|
- For `.root` element, use `slotProps.root`.
|
|
110
236
|
- For `.main` element (the one with `role="grid"`), use `slotProps.main`.
|
|
@@ -64,7 +64,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
64
64
|
// ----------------------------------------------------------------------
|
|
65
65
|
/**
|
|
66
66
|
* Aggregation functions available on the grid.
|
|
67
|
-
* @default GRID_AGGREGATION_FUNCTIONS
|
|
67
|
+
* @default GRID_AGGREGATION_FUNCTIONS when `unstable_dataSource` is not provided, `{}` when `unstable_dataSource` is provided
|
|
68
68
|
*/
|
|
69
69
|
aggregationFunctions: _propTypes.default.object,
|
|
70
70
|
/**
|
|
@@ -1044,6 +1044,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
1044
1044
|
*/
|
|
1045
1045
|
treeData: _propTypes.default.bool,
|
|
1046
1046
|
unstable_dataSource: _propTypes.default.shape({
|
|
1047
|
+
getAggregatedValue: _propTypes.default.func,
|
|
1047
1048
|
getChildrenCount: _propTypes.default.func,
|
|
1048
1049
|
getGroupKey: _propTypes.default.func,
|
|
1049
1050
|
getRows: _propTypes.default.func.isRequired,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridApiPremium, GridPrivateApiPremium } from '../models/gridApiPremium';
|
|
3
3
|
import { DataGridPremiumProcessedProps } from '../models/dataGridPremiumProps';
|
|
4
|
-
export declare const useDataGridPremiumComponent: (inputApiRef: React.MutableRefObject<GridApiPremium> | undefined, props: DataGridPremiumProcessedProps) => React.
|
|
4
|
+
export declare const useDataGridPremiumComponent: (inputApiRef: React.MutableRefObject<GridApiPremium> | undefined, props: DataGridPremiumProcessedProps) => React.RefObject<GridPrivateApiPremium>;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.useDataGridPremiumComponent = void 0;
|
|
7
7
|
var _internals = require("@mui/x-data-grid-pro/internals");
|
|
8
|
+
var _useGridDataSourcePremium = require("../hooks/features/dataSource/useGridDataSourcePremium");
|
|
8
9
|
var _useGridAggregation = require("../hooks/features/aggregation/useGridAggregation");
|
|
9
10
|
var _useGridAggregationPreProcessors = require("../hooks/features/aggregation/useGridAggregationPreProcessors");
|
|
10
11
|
var _useGridRowGrouping = require("../hooks/features/rowGrouping/useGridRowGrouping");
|
|
@@ -69,6 +70,7 @@ const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
69
70
|
(0, _useGridRowGrouping.useGridRowGrouping)(apiRef, props);
|
|
70
71
|
(0, _internals.useGridHeaderFiltering)(apiRef, props);
|
|
71
72
|
(0, _internals.useGridTreeData)(apiRef, props);
|
|
73
|
+
(0, _useGridDataSourcePremium.useGridDataSourcePremium)(apiRef, props);
|
|
72
74
|
(0, _useGridAggregation.useGridAggregation)(apiRef, props);
|
|
73
75
|
(0, _internals.useGridKeyboardNavigation)(apiRef, props);
|
|
74
76
|
(0, _internals.useGridRowSelection)(apiRef, props);
|
|
@@ -106,7 +108,6 @@ const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
106
108
|
(0, _internals.useGridDimensions)(apiRef, props);
|
|
107
109
|
(0, _internals.useGridEvents)(apiRef, props);
|
|
108
110
|
(0, _internals.useGridStatePersistence)(apiRef);
|
|
109
|
-
(0, _internals.useGridDataSource)(apiRef, props);
|
|
110
111
|
(0, _internals.useGridVirtualization)(apiRef, props);
|
|
111
112
|
(0, _internals.useGridListView)(apiRef, props);
|
|
112
113
|
return apiRef;
|
|
@@ -53,7 +53,9 @@ const useDataGridPremiumProps = inProps => {
|
|
|
53
53
|
defaultSlots,
|
|
54
54
|
slots: themedProps.slots
|
|
55
55
|
}), [themedProps.slots]);
|
|
56
|
-
return React.useMemo(() => (0, _extends2.default)({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps
|
|
56
|
+
return React.useMemo(() => (0, _extends2.default)({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps.unstable_dataSource ? {
|
|
57
|
+
aggregationFunctions: {}
|
|
58
|
+
} : {}, themedProps, {
|
|
57
59
|
localeText,
|
|
58
60
|
slots
|
|
59
61
|
}, getDataGridPremiumForcedProps(themedProps)), [themedProps, localeText, slots]);
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.GridColumnMenuAggregationItem = GridColumnMenuAggregationItem;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
10
|
var _toPropertyKey2 = _interopRequireDefault(require("@babel/runtime/helpers/toPropertyKey"));
|
|
12
|
-
var
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var React = _react;
|
|
13
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
15
|
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
15
16
|
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
@@ -20,18 +21,27 @@ var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
|
20
21
|
var _gridAggregationUtils = require("../hooks/features/aggregation/gridAggregationUtils");
|
|
21
22
|
var _gridAggregationSelectors = require("../hooks/features/aggregation/gridAggregationSelectors");
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
+
const _excluded = ["native"];
|
|
23
25
|
function GridColumnMenuAggregationItem(props) {
|
|
24
26
|
const {
|
|
25
27
|
colDef
|
|
26
28
|
} = props;
|
|
27
29
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
30
|
+
const inputRef = React.useRef(null);
|
|
28
31
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
29
32
|
const id = (0, _utils.unstable_useId)();
|
|
30
33
|
const aggregationModel = (0, _xDataGridPro.useGridSelector)(apiRef, _gridAggregationSelectors.gridAggregationModelSelector);
|
|
31
34
|
const availableAggregationFunctions = React.useMemo(() => (0, _gridAggregationUtils.getAvailableAggregationFunctions)({
|
|
32
35
|
aggregationFunctions: rootProps.aggregationFunctions,
|
|
33
|
-
colDef
|
|
34
|
-
|
|
36
|
+
colDef,
|
|
37
|
+
isDataSource: !!rootProps.unstable_dataSource
|
|
38
|
+
}), [colDef, rootProps.aggregationFunctions, rootProps.unstable_dataSource]);
|
|
39
|
+
const _ref = rootProps.slotProps?.baseSelect || {},
|
|
40
|
+
{
|
|
41
|
+
native: isBaseSelectNative = false
|
|
42
|
+
} = _ref,
|
|
43
|
+
baseSelectProps = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
44
|
+
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
35
45
|
const selectedAggregationRule = React.useMemo(() => {
|
|
36
46
|
if (!colDef || !aggregationModel[colDef.field]) {
|
|
37
47
|
return '';
|
|
@@ -40,12 +50,13 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
40
50
|
if ((0, _gridAggregationUtils.canColumnHaveAggregationFunction)({
|
|
41
51
|
colDef,
|
|
42
52
|
aggregationFunctionName,
|
|
43
|
-
aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName]
|
|
53
|
+
aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName],
|
|
54
|
+
isDataSource: !!rootProps.unstable_dataSource
|
|
44
55
|
})) {
|
|
45
56
|
return aggregationFunctionName;
|
|
46
57
|
}
|
|
47
58
|
return '';
|
|
48
|
-
}, [rootProps.aggregationFunctions, aggregationModel, colDef]);
|
|
59
|
+
}, [rootProps.aggregationFunctions, rootProps.unstable_dataSource, aggregationModel, colDef]);
|
|
49
60
|
const handleAggregationItemChange = event => {
|
|
50
61
|
const newAggregationItem = event.target?.value || undefined;
|
|
51
62
|
const currentModel = (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef);
|
|
@@ -58,11 +69,22 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
58
69
|
apiRef.current.hideColumnMenu();
|
|
59
70
|
};
|
|
60
71
|
const label = apiRef.current.getLocaleText('aggregationMenuItemHeader');
|
|
72
|
+
const handleMenuItemKeyDown = React.useCallback(event => {
|
|
73
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
74
|
+
inputRef.current.focus();
|
|
75
|
+
}
|
|
76
|
+
}, []);
|
|
77
|
+
const handleSelectKeyDown = React.useCallback(event => {
|
|
78
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === ' ') {
|
|
79
|
+
event.stopPropagation();
|
|
80
|
+
}
|
|
81
|
+
}, []);
|
|
61
82
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseMenuItem, {
|
|
62
83
|
inert: true,
|
|
63
84
|
iconStart: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.columnMenuAggregationIcon, {
|
|
64
85
|
fontSize: "small"
|
|
65
86
|
}),
|
|
87
|
+
onKeyDown: handleMenuItemKeyDown,
|
|
66
88
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_FormControl.default, {
|
|
67
89
|
size: "small",
|
|
68
90
|
fullWidth: true,
|
|
@@ -71,30 +93,41 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
71
93
|
},
|
|
72
94
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_InputLabel.default, {
|
|
73
95
|
id: `${id}-label`,
|
|
96
|
+
htmlFor: `${id}-input`,
|
|
74
97
|
children: label
|
|
75
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(rootProps.slots.baseSelect, {
|
|
98
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(rootProps.slots.baseSelect, (0, _extends2.default)({
|
|
76
99
|
labelId: `${id}-label`,
|
|
100
|
+
inputRef: inputRef,
|
|
77
101
|
id: `${id}-input`,
|
|
78
102
|
value: selectedAggregationRule,
|
|
79
103
|
label: label,
|
|
80
104
|
color: "primary",
|
|
81
105
|
onChange: handleAggregationItemChange,
|
|
106
|
+
MenuProps: {
|
|
107
|
+
PaperProps: {
|
|
108
|
+
onKeyDown: handleSelectKeyDown
|
|
109
|
+
}
|
|
110
|
+
},
|
|
82
111
|
onBlur: event => event.stopPropagation(),
|
|
83
|
-
|
|
84
|
-
|
|
112
|
+
native: isBaseSelectNative,
|
|
113
|
+
fullWidth: true
|
|
114
|
+
}, baseSelectProps, {
|
|
115
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
116
|
+
native: isBaseSelectNative,
|
|
85
117
|
value: "",
|
|
86
118
|
children: "..."
|
|
87
|
-
}), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/(0,
|
|
119
|
+
})), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/(0, _react.createElement)(rootProps.slots.baseSelectOption, (0, _extends2.default)({}, baseSelectOptionProps, {
|
|
120
|
+
key: aggFunc,
|
|
88
121
|
value: aggFunc,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
})]
|
|
122
|
+
native: isBaseSelectNative
|
|
123
|
+
}), (0, _gridAggregationUtils.getAggregationFunctionLabel)({
|
|
124
|
+
apiRef,
|
|
125
|
+
aggregationRule: {
|
|
126
|
+
aggregationFunctionName: aggFunc,
|
|
127
|
+
aggregationFunction: rootProps.aggregationFunctions[aggFunc]
|
|
128
|
+
}
|
|
129
|
+
})))]
|
|
130
|
+
}))]
|
|
98
131
|
})
|
|
99
132
|
});
|
|
100
133
|
}
|
|
@@ -57,7 +57,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
57
57
|
// ----------------------------------------------------------------------
|
|
58
58
|
/**
|
|
59
59
|
* Aggregation functions available on the grid.
|
|
60
|
-
* @default GRID_AGGREGATION_FUNCTIONS
|
|
60
|
+
* @default GRID_AGGREGATION_FUNCTIONS when `unstable_dataSource` is not provided, `{}` when `unstable_dataSource` is provided
|
|
61
61
|
*/
|
|
62
62
|
aggregationFunctions: PropTypes.object,
|
|
63
63
|
/**
|
|
@@ -1037,6 +1037,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
1037
1037
|
*/
|
|
1038
1038
|
treeData: PropTypes.bool,
|
|
1039
1039
|
unstable_dataSource: PropTypes.shape({
|
|
1040
|
+
getAggregatedValue: PropTypes.func,
|
|
1040
1041
|
getChildrenCount: PropTypes.func,
|
|
1041
1042
|
getGroupKey: PropTypes.func,
|
|
1042
1043
|
getRows: PropTypes.func.isRequired,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridLazyLoader, useGridLazyLoaderPreProcessors, useGridDataSourceLazyLoader, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization, useGridDataSourceTreeDataPreProcessors,
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridLazyLoader, useGridLazyLoaderPreProcessors, useGridDataSourceLazyLoader, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization, useGridDataSourceTreeDataPreProcessors, dataSourceStateInitializer, useGridRowSpanning, rowSpanningStateInitializer, useGridListView, listViewStateInitializer } from '@mui/x-data-grid-pro/internals';
|
|
2
|
+
import { useGridDataSourcePremium as useGridDataSource } from "../hooks/features/dataSource/useGridDataSourcePremium.js";
|
|
2
3
|
// Premium-only features
|
|
3
4
|
import { useGridAggregation, aggregationStateInitializer } from "../hooks/features/aggregation/useGridAggregation.js";
|
|
4
5
|
import { useGridAggregationPreProcessors } from "../hooks/features/aggregation/useGridAggregationPreProcessors.js";
|
|
@@ -62,6 +63,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
62
63
|
useGridRowGrouping(apiRef, props);
|
|
63
64
|
useGridHeaderFiltering(apiRef, props);
|
|
64
65
|
useGridTreeData(apiRef, props);
|
|
66
|
+
useGridDataSource(apiRef, props);
|
|
65
67
|
useGridAggregation(apiRef, props);
|
|
66
68
|
useGridKeyboardNavigation(apiRef, props);
|
|
67
69
|
useGridRowSelection(apiRef, props);
|
|
@@ -99,7 +101,6 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
99
101
|
useGridDimensions(apiRef, props);
|
|
100
102
|
useGridEvents(apiRef, props);
|
|
101
103
|
useGridStatePersistence(apiRef);
|
|
102
|
-
useGridDataSource(apiRef, props);
|
|
103
104
|
useGridVirtualization(apiRef, props);
|
|
104
105
|
useGridListView(apiRef, props);
|
|
105
106
|
return apiRef;
|
|
@@ -45,7 +45,9 @@ export const useDataGridPremiumProps = inProps => {
|
|
|
45
45
|
defaultSlots,
|
|
46
46
|
slots: themedProps.slots
|
|
47
47
|
}), [themedProps.slots]);
|
|
48
|
-
return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps
|
|
48
|
+
return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps.unstable_dataSource ? {
|
|
49
|
+
aggregationFunctions: {}
|
|
50
|
+
} : {}, themedProps, {
|
|
49
51
|
localeText,
|
|
50
52
|
slots
|
|
51
53
|
}, getDataGridPremiumForcedProps(themedProps)), [themedProps, localeText, slots]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
2
|
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
3
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
+
const _excluded = ["native"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import { useGridSelector } from '@mui/x-data-grid-pro';
|
|
@@ -12,18 +13,27 @@ import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
|
12
13
|
import { canColumnHaveAggregationFunction, getAggregationFunctionLabel, getAvailableAggregationFunctions } from "../hooks/features/aggregation/gridAggregationUtils.js";
|
|
13
14
|
import { gridAggregationModelSelector } from "../hooks/features/aggregation/gridAggregationSelectors.js";
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { createElement as _createElement } from "react";
|
|
15
17
|
function GridColumnMenuAggregationItem(props) {
|
|
16
18
|
const {
|
|
17
19
|
colDef
|
|
18
20
|
} = props;
|
|
19
21
|
const apiRef = useGridApiContext();
|
|
22
|
+
const inputRef = React.useRef(null);
|
|
20
23
|
const rootProps = useGridRootProps();
|
|
21
24
|
const id = useId();
|
|
22
25
|
const aggregationModel = useGridSelector(apiRef, gridAggregationModelSelector);
|
|
23
26
|
const availableAggregationFunctions = React.useMemo(() => getAvailableAggregationFunctions({
|
|
24
27
|
aggregationFunctions: rootProps.aggregationFunctions,
|
|
25
|
-
colDef
|
|
26
|
-
|
|
28
|
+
colDef,
|
|
29
|
+
isDataSource: !!rootProps.unstable_dataSource
|
|
30
|
+
}), [colDef, rootProps.aggregationFunctions, rootProps.unstable_dataSource]);
|
|
31
|
+
const _ref = rootProps.slotProps?.baseSelect || {},
|
|
32
|
+
{
|
|
33
|
+
native: isBaseSelectNative = false
|
|
34
|
+
} = _ref,
|
|
35
|
+
baseSelectProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
36
|
+
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
27
37
|
const selectedAggregationRule = React.useMemo(() => {
|
|
28
38
|
if (!colDef || !aggregationModel[colDef.field]) {
|
|
29
39
|
return '';
|
|
@@ -32,12 +42,13 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
32
42
|
if (canColumnHaveAggregationFunction({
|
|
33
43
|
colDef,
|
|
34
44
|
aggregationFunctionName,
|
|
35
|
-
aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName]
|
|
45
|
+
aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName],
|
|
46
|
+
isDataSource: !!rootProps.unstable_dataSource
|
|
36
47
|
})) {
|
|
37
48
|
return aggregationFunctionName;
|
|
38
49
|
}
|
|
39
50
|
return '';
|
|
40
|
-
}, [rootProps.aggregationFunctions, aggregationModel, colDef]);
|
|
51
|
+
}, [rootProps.aggregationFunctions, rootProps.unstable_dataSource, aggregationModel, colDef]);
|
|
41
52
|
const handleAggregationItemChange = event => {
|
|
42
53
|
const newAggregationItem = event.target?.value || undefined;
|
|
43
54
|
const currentModel = gridAggregationModelSelector(apiRef);
|
|
@@ -50,11 +61,22 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
50
61
|
apiRef.current.hideColumnMenu();
|
|
51
62
|
};
|
|
52
63
|
const label = apiRef.current.getLocaleText('aggregationMenuItemHeader');
|
|
64
|
+
const handleMenuItemKeyDown = React.useCallback(event => {
|
|
65
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
66
|
+
inputRef.current.focus();
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
const handleSelectKeyDown = React.useCallback(event => {
|
|
70
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === ' ') {
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
}
|
|
73
|
+
}, []);
|
|
53
74
|
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
54
75
|
inert: true,
|
|
55
76
|
iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
|
|
56
77
|
fontSize: "small"
|
|
57
78
|
}),
|
|
79
|
+
onKeyDown: handleMenuItemKeyDown,
|
|
58
80
|
children: /*#__PURE__*/_jsxs(FormControl, {
|
|
59
81
|
size: "small",
|
|
60
82
|
fullWidth: true,
|
|
@@ -63,30 +85,41 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
63
85
|
},
|
|
64
86
|
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
65
87
|
id: `${id}-label`,
|
|
88
|
+
htmlFor: `${id}-input`,
|
|
66
89
|
children: label
|
|
67
|
-
}), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, {
|
|
90
|
+
}), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
|
|
68
91
|
labelId: `${id}-label`,
|
|
92
|
+
inputRef: inputRef,
|
|
69
93
|
id: `${id}-input`,
|
|
70
94
|
value: selectedAggregationRule,
|
|
71
95
|
label: label,
|
|
72
96
|
color: "primary",
|
|
73
97
|
onChange: handleAggregationItemChange,
|
|
98
|
+
MenuProps: {
|
|
99
|
+
PaperProps: {
|
|
100
|
+
onKeyDown: handleSelectKeyDown
|
|
101
|
+
}
|
|
102
|
+
},
|
|
74
103
|
onBlur: event => event.stopPropagation(),
|
|
75
|
-
|
|
76
|
-
|
|
104
|
+
native: isBaseSelectNative,
|
|
105
|
+
fullWidth: true
|
|
106
|
+
}, baseSelectProps, {
|
|
107
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
108
|
+
native: isBaseSelectNative,
|
|
77
109
|
value: "",
|
|
78
110
|
children: "..."
|
|
79
|
-
}), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/
|
|
111
|
+
})), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
112
|
+
key: aggFunc,
|
|
80
113
|
value: aggFunc,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
})]
|
|
114
|
+
native: isBaseSelectNative
|
|
115
|
+
}), getAggregationFunctionLabel({
|
|
116
|
+
apiRef,
|
|
117
|
+
aggregationRule: {
|
|
118
|
+
aggregationFunctionName: aggFunc,
|
|
119
|
+
aggregationFunction: rootProps.aggregationFunctions[aggFunc]
|
|
120
|
+
}
|
|
121
|
+
})))]
|
|
122
|
+
}))]
|
|
90
123
|
})
|
|
91
124
|
});
|
|
92
125
|
}
|