@mui/x-data-grid-premium 6.0.0-alpha.10 → 6.0.0-alpha.12
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 +241 -0
- package/DataGridPremium/DataGridPremium.js +22 -7
- package/DataGridPremium/useDataGridPremiumComponent.js +6 -1
- package/DataGridPremium/useDataGridPremiumProps.js +1 -0
- package/components/GridExcelExportMenuItem.d.ts +1 -1
- package/hooks/features/aggregation/createAggregationLookup.js +4 -1
- package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +7 -5
- package/hooks/features/aggregation/gridAggregationSelectors.d.ts +9 -0
- package/hooks/features/aggregation/gridAggregationSelectors.js +11 -0
- package/hooks/features/aggregation/useGridAggregationPreProcessors.js +5 -4
- package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +1 -1
- package/hooks/features/cellSelection/gridCellSelectionInterfaces.d.ts +40 -0
- package/hooks/features/cellSelection/gridCellSelectionInterfaces.js +1 -0
- package/hooks/features/cellSelection/gridCellSelectionSelector.d.ts +2 -0
- package/hooks/features/cellSelection/gridCellSelectionSelector.js +1 -0
- package/hooks/features/cellSelection/index.d.ts +1 -0
- package/hooks/features/cellSelection/index.js +1 -0
- package/hooks/features/cellSelection/useGridCellSelection.d.ts +6 -0
- package/hooks/features/cellSelection/useGridCellSelection.js +295 -0
- package/hooks/features/export/gridExcelExportInterface.d.ts +2 -2
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +2 -1
- package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +2 -2
- package/index.js +1 -1
- package/legacy/DataGridPremium/DataGridPremium.js +22 -7
- package/legacy/DataGridPremium/useDataGridPremiumComponent.js +6 -1
- package/legacy/DataGridPremium/useDataGridPremiumProps.js +1 -0
- package/legacy/hooks/features/aggregation/createAggregationLookup.js +4 -1
- package/legacy/hooks/features/aggregation/gridAggregationSelectors.js +11 -0
- package/legacy/hooks/features/aggregation/useGridAggregationPreProcessors.js +5 -2
- package/legacy/hooks/features/cellSelection/gridCellSelectionInterfaces.js +1 -0
- package/legacy/hooks/features/cellSelection/gridCellSelectionSelector.js +3 -0
- package/legacy/hooks/features/cellSelection/index.js +1 -0
- package/legacy/hooks/features/cellSelection/useGridCellSelection.js +287 -0
- package/legacy/hooks/features/index.js +2 -1
- package/legacy/index.js +1 -1
- package/legacy/utils/releaseInfo.js +1 -1
- package/models/dataGridPremiumProps.d.ts +18 -2
- package/models/gridApiPremium.d.ts +3 -2
- package/models/gridStatePremium.d.ts +3 -1
- package/modern/DataGridPremium/DataGridPremium.js +22 -7
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +6 -1
- package/modern/DataGridPremium/useDataGridPremiumProps.js +1 -0
- package/modern/hooks/features/aggregation/createAggregationLookup.js +4 -1
- package/modern/hooks/features/aggregation/gridAggregationSelectors.js +11 -0
- package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +5 -4
- package/modern/hooks/features/cellSelection/gridCellSelectionInterfaces.js +1 -0
- package/modern/hooks/features/cellSelection/gridCellSelectionSelector.js +1 -0
- package/modern/hooks/features/cellSelection/index.js +1 -0
- package/modern/hooks/features/cellSelection/useGridCellSelection.js +290 -0
- package/modern/hooks/features/index.js +2 -1
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPremium/DataGridPremium.js +21 -6
- package/node/DataGridPremium/useDataGridPremiumComponent.js +5 -0
- package/node/DataGridPremium/useDataGridPremiumProps.js +1 -0
- package/node/hooks/features/aggregation/createAggregationLookup.js +4 -1
- package/node/hooks/features/aggregation/gridAggregationSelectors.js +11 -0
- package/node/hooks/features/aggregation/useGridAggregationPreProcessors.js +5 -4
- package/node/hooks/features/cellSelection/gridCellSelectionInterfaces.js +5 -0
- package/node/hooks/features/cellSelection/gridCellSelectionSelector.js +8 -0
- package/node/hooks/features/cellSelection/index.js +16 -0
- package/node/hooks/features/cellSelection/useGridCellSelection.js +301 -0
- package/node/hooks/features/index.js +11 -0
- package/node/index.js +1 -1
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +5 -5
- package/typeOverloads/modules.d.ts +7 -1
- package/typeOverloads/reexports.d.ts +3 -3
- package/utils/releaseInfo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,193 @@
|
|
|
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
|
+
## 6.0.0-alpha.12
|
|
7
|
+
|
|
8
|
+
_Dec 16, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🚀 The `apiRef` prop is now available in the `@mui/x-data-grid` package:
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
const apiRef = useGridApiRef();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<DataGrid apiRef={apiRef} {...other} />
|
|
19
|
+
)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
See [the documentation](https://next.mui.com/x/react-data-grid/api-object/) for more information.
|
|
23
|
+
|
|
24
|
+
- 🎁 The `DataGridPremium` now supports cell selection:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
<DataGridPremium unstable_cellSelection />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
See [the documentation](https://next.mui.com/x/react-data-grid/selection/#cell-selection) for more information
|
|
31
|
+
|
|
32
|
+
- 🌍 Support the Right To Left orientation on the fields components
|
|
33
|
+
- 📚 Documentation improvements
|
|
34
|
+
- 🐞 Bugfixes
|
|
35
|
+
|
|
36
|
+
### `@mui/x-data-grid@v6.0.0-alpha.12` / `@mui/x-data-grid-pro@v6.0.0-alpha.12` / `@mui/x-data-grid-premium@v6.0.0-alpha.12`
|
|
37
|
+
|
|
38
|
+
#### Breaking changes
|
|
39
|
+
|
|
40
|
+
- The `showCellRightBorder` was renamed to `showCellVerticalBorder`
|
|
41
|
+
- The `showColumnRightBorder` was renamed to `showColumnVerticalBorder`
|
|
42
|
+
- The `.MuiDataGrid-withBorder` CSS class was renamed to `.MuiDataGrid-withBorderColor` and it only sets `border-color` CSS property now.
|
|
43
|
+
- The following undocumented properties from `apiRef` were removed: `footerRef`, `headerRef`, `columnHeadersElementRef`, `columnHeadersContainerElementRef`
|
|
44
|
+
- The `GridHeaderPlaceholder` component was removed.
|
|
45
|
+
- The `MAX_PAGE_SIZE` constant was removed.
|
|
46
|
+
- The `useGridScrollFn` hook was removed.
|
|
47
|
+
|
|
48
|
+
#### Changes
|
|
49
|
+
|
|
50
|
+
- [DataGrid] Display sort column menu items as per `sortingOrder` prop (#7180) @MBilalShafi
|
|
51
|
+
- [DataGrid] Support `apiRef` in Community package (#6773) @cherniavskii
|
|
52
|
+
- [DataGridPremium] Add support for cell selection (#6567) @m4theushw
|
|
53
|
+
- [DataGridPremium] Use separate cache for aggregation columns pre-processor (#7142) @m4theushw
|
|
54
|
+
- [DataGridPro] Fix missing border in right-pinned columns (#4197) @cherniavskii
|
|
55
|
+
- [DataGridPro] Fix wrong border color on skeleton cells (#7202) @cherniavskii
|
|
56
|
+
|
|
57
|
+
### `@mui/x-date-pickers@v6.0.0-alpha.12` / `@mui/x-date-pickers-pro@v6.0.0-alpha.12`
|
|
58
|
+
|
|
59
|
+
#### Changes
|
|
60
|
+
|
|
61
|
+
- [fields] Fix bug introduced by RTL in single input range fields (#7189) @alexfauquette
|
|
62
|
+
- [fields] Support RTL out of the box (#6715) @alexfauquette
|
|
63
|
+
- [pickers] Clean `autoFocus` behavior on fields and new pickers (#7153) @flaviendelangle
|
|
64
|
+
- [pickers] Fix label on the new range pickers (#7210) @flaviendelangle
|
|
65
|
+
- [pickers] Fix wrong component name on `StaticNextDateTime` (#7187) @flaviendelangle
|
|
66
|
+
|
|
67
|
+
### Docs
|
|
68
|
+
|
|
69
|
+
- [docs] Add docs section about field placeholders' localization (#7139) @flaviendelangle
|
|
70
|
+
- [docs] Create a `DemoGrid` component to unify demos with several components (#7057) @flaviendelangle
|
|
71
|
+
- [docs] Document aggregation selectors (#7148) @cherniavskii
|
|
72
|
+
- [docs] Fix 301 links to demo pages in API pages (#7197) @oliviertassinari
|
|
73
|
+
- [docs] Fix errors and warning in demos (#7209) @LukasTy
|
|
74
|
+
- [docs] Use `DemoContainer` and `DemoItem` on every picker demo (#7149) @flaviendelangle
|
|
75
|
+
|
|
76
|
+
### Core
|
|
77
|
+
|
|
78
|
+
- [core] Fix broken test (#7179) @flaviendelangle
|
|
79
|
+
|
|
80
|
+
## 6.0.0-alpha.11
|
|
81
|
+
|
|
82
|
+
_Dec 8, 2022_
|
|
83
|
+
|
|
84
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
85
|
+
|
|
86
|
+
- 🚀 Add dragging support for the new Date Range Picker (`NextDateRangePicker`) (#6763) @LukasTy
|
|
87
|
+
- ⚡️ Improve performance of the `day` view (#7066) @flaviendelangle
|
|
88
|
+
- ✨ Fix lazy-loading feature not working in `DataGridPremium` (#7124) @m4theushw
|
|
89
|
+
- 🐞 Bugfixes
|
|
90
|
+
|
|
91
|
+
### `@mui/x-data-grid@v6.0.0-alpha.11` / `@mui/x-data-grid-pro@v6.0.0-alpha.11` / `@mui/x-data-grid-premium@v6.0.0-alpha.11`
|
|
92
|
+
|
|
93
|
+
#### Breaking changes
|
|
94
|
+
|
|
95
|
+
- The `filterPanelOperators` translation key was renamed to `filterPanelOperator` (#7062) @MBilalShafi
|
|
96
|
+
- The `components.Header` slot was removed. Use `components.Toolbar` slot instead (#6999) @cherniavskii
|
|
97
|
+
|
|
98
|
+
#### Changes
|
|
99
|
+
|
|
100
|
+
- [DataGrid] Fix rows not rendering properly after height change (#6892) @MBilalShafi
|
|
101
|
+
- [DataGrid] Remove `Header` slot (#6999) @cherniavskii
|
|
102
|
+
- [DataGrid] Rename `filterPanelOperators` -> `filterPanelOperator` (#7062) @MBilalShafi
|
|
103
|
+
- [DataGridPremium] Add support for lazy-loading (#7124) @m4theushw
|
|
104
|
+
- [DataGridPremium] Pass `groupId` to aggregation function (#7003) @m4theushw
|
|
105
|
+
|
|
106
|
+
### `@mui/x-date-pickers@v6.0.0-alpha.11` / `@mui/x-date-pickers-pro@v6.0.0-alpha.11`
|
|
107
|
+
|
|
108
|
+
#### Breaking changes
|
|
109
|
+
|
|
110
|
+
- Remove the callback version of the `action` prop on the `actionBar` slot (#7038) @flaviendelangle
|
|
111
|
+
|
|
112
|
+
The `action` prop of the `actionBar` slot is no longer supporting a callback.
|
|
113
|
+
Instead, you can pass a callback at the slot level:
|
|
114
|
+
|
|
115
|
+
```diff
|
|
116
|
+
<DatePicker
|
|
117
|
+
componentsProps={{
|
|
118
|
+
- actionBar: {
|
|
119
|
+
- actions: (variant) => (variant === 'desktop' ? [] : ['clear']),
|
|
120
|
+
- },
|
|
121
|
+
+ actionBar: ({ wrapperVariant }) => ({
|
|
122
|
+
+ actions: wrapperVariant === 'desktop' ? [] : ['clear'],
|
|
123
|
+
+ }),
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- The `selectedDays` prop has been removed from the `Day` component (#7066) @flaviendelangle
|
|
129
|
+
If you need to access it, you can control the value and pass it to the slot using `componentsProps`:
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
function CustomDay({ selectedDay, ...other }) {
|
|
133
|
+
// do something with 'selectedDay'
|
|
134
|
+
return <PickersDay {...other} />;
|
|
135
|
+
}
|
|
136
|
+
function App() {
|
|
137
|
+
const [value, setValue] = React.useState(null);
|
|
138
|
+
return (
|
|
139
|
+
<DatePicker
|
|
140
|
+
value={value}
|
|
141
|
+
onChange={(newValue) => setValue(newValue)}
|
|
142
|
+
components={{ Day: CustomDay }}
|
|
143
|
+
componentsProps={{
|
|
144
|
+
day: { selectedDay: value },
|
|
145
|
+
}}
|
|
146
|
+
/>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- The `currentlySelectingRangeEnd` / `setCurrentlySelectingRangeEnd` props on the Date Range Picker toolbar have been renamed to `rangePosition` / `onRangePositionChange` (#6989) @flaviendelangle
|
|
152
|
+
|
|
153
|
+
```diff
|
|
154
|
+
const CustomToolbarComponent = props => (
|
|
155
|
+
<div>
|
|
156
|
+
- <button onChange={() => props.setCurrentlySelectingRangeEnd('end')}>Edit end date</button>
|
|
157
|
+
+ <button onClick={() => props.onRangePositionChange('end')}>Edit end date</button>
|
|
158
|
+
- <div>Is editing end date: {props.currentlySelectingRangeEnd === 'end'}</div>
|
|
159
|
+
+ <div>Is editing end date: {props.rangePosition === 'end'}</div>
|
|
160
|
+
</div>
|
|
161
|
+
)
|
|
162
|
+
<DateRangePicker
|
|
163
|
+
components={{
|
|
164
|
+
Toolbar: CustomToolbarComponent
|
|
165
|
+
}}
|
|
166
|
+
/>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### Changes
|
|
170
|
+
|
|
171
|
+
- [DateRangePicker] Add dragging support to edit range (#6763) @LukasTy
|
|
172
|
+
- [pickers] Fix lost props on Date Range Pickers (#7092) @flaviendelangle
|
|
173
|
+
- [pickers] Fix toolbar on the new range pickers (#6989) @flaviendelangle
|
|
174
|
+
- [pickers] Improve performance of `DayCalendar` (#7066) @flaviendelangle
|
|
175
|
+
- [pickers] Initialize date without time when selecting year or month (#7120) @LukasTy
|
|
176
|
+
- [pickers] Remove the callback version of the `action` prop in the `actionBar` component slot (#7038) @flaviendelangle
|
|
177
|
+
|
|
178
|
+
### Docs
|
|
179
|
+
|
|
180
|
+
- [docs] Add `GridCell` change in migration guide (#7087) @MBilalShafi
|
|
181
|
+
- [docs] Fix API page ad space regression (#7051) @oliviertassinari
|
|
182
|
+
- [docs] Update localization doc to use existing locale (#7102) @LukasTy
|
|
183
|
+
|
|
184
|
+
### Core
|
|
185
|
+
|
|
186
|
+
- [core] Add codemod to move l10n translation (#7027) @alexfauquette
|
|
187
|
+
- [core] Add notes to remove the legacy pickers internals (#7133) @flaviendelangle
|
|
188
|
+
- [core] Remove `internals-fields` imports (#7119) @flaviendelangle
|
|
189
|
+
- [core] Remove unused code (#7094) @flaviendelangle
|
|
190
|
+
- [core] Sync `ApiPage.js` with monorepo (#7073) @oliviertassinari
|
|
191
|
+
- [test] Fix karma-mocha assertion error messages (#7054) @cherniavskii
|
|
192
|
+
|
|
6
193
|
## 6.0.0-alpha.10
|
|
7
194
|
|
|
8
195
|
_Dec 1, 2022_
|
|
@@ -1188,6 +1375,60 @@ You can find more information about the new api, including how to set those tran
|
|
|
1188
1375
|
- [test] Skip tests for column pinning and dynamic row height (#5997) @m4theushw
|
|
1189
1376
|
- [website] Improve security header @oliviertassinari
|
|
1190
1377
|
|
|
1378
|
+
## 5.17.16
|
|
1379
|
+
|
|
1380
|
+
_Dec 16, 2022_
|
|
1381
|
+
|
|
1382
|
+
We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
1383
|
+
|
|
1384
|
+
- 🐞 Bugfixes
|
|
1385
|
+
|
|
1386
|
+
### `@mui/x-data-grid@v5.17.16` / `@mui/x-data-grid-pro@v5.17.16` / `@mui/x-data-grid-premium@v5.17.16`
|
|
1387
|
+
|
|
1388
|
+
#### Changes
|
|
1389
|
+
|
|
1390
|
+
- [DataGrid] Display sort column menu items as per `sortingOrder` prop (#7125) @hanbin9775
|
|
1391
|
+
- [DataGrid] Fix flickering on mount (#7155) @cherniavskii
|
|
1392
|
+
- [DataGridPremium] Use separate cache for aggregation columns pre-processor (#7174) @m4theushw
|
|
1393
|
+
|
|
1394
|
+
### `@mui/x-date-pickers@v5.0.11` / `@mui/x-date-pickers-pro@v5.0.11`
|
|
1395
|
+
|
|
1396
|
+
#### Changes
|
|
1397
|
+
|
|
1398
|
+
- [DateTimePicker] Update export pattern (#7172) @kealjones-wk
|
|
1399
|
+
|
|
1400
|
+
### Docs
|
|
1401
|
+
|
|
1402
|
+
- [docs] Document aggregation selectors (#7151) @cherniavskii
|
|
1403
|
+
|
|
1404
|
+
## 5.17.15
|
|
1405
|
+
|
|
1406
|
+
_Dec 8, 2022_
|
|
1407
|
+
|
|
1408
|
+
We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
1409
|
+
|
|
1410
|
+
- ✨ Fix lazy-loading not working in `DataGridPremium` (#7130) @m4theushw
|
|
1411
|
+
- 🐞 Bugfixes
|
|
1412
|
+
|
|
1413
|
+
### `@mui/x-data-grid@v5.17.15` / `@mui/x-data-grid-pro@v5.17.15` / `@mui/x-data-grid-premium@v5.17.15`
|
|
1414
|
+
|
|
1415
|
+
#### Changes
|
|
1416
|
+
|
|
1417
|
+
- [DataGridPremium] Add support for lazy-loading (#7130) @m4theushw
|
|
1418
|
+
- [DataGridPremium] Pass `groupId` to the aggregation function (#7143) @m4theushw
|
|
1419
|
+
|
|
1420
|
+
### `@mui/x-date-pickers@v5.0.10` / `@mui/x-date-pickers-pro@v5.0.10`
|
|
1421
|
+
|
|
1422
|
+
#### Changes
|
|
1423
|
+
|
|
1424
|
+
- [pickers] Initialize date without time when selecting year or month (#7136) @LukasTy
|
|
1425
|
+
|
|
1426
|
+
### Docs
|
|
1427
|
+
|
|
1428
|
+
- [docs] Fix the nested import on the api pages (#7134) @flaviendelangle
|
|
1429
|
+
- [docs] Keep track of the localization completion (#7099) @alexfauquette
|
|
1430
|
+
- [docs] Update localization doc to use existing locale (#7104) @LukasTy
|
|
1431
|
+
|
|
1191
1432
|
## 5.17.14
|
|
1192
1433
|
|
|
1193
1434
|
_Dec 1, 2022_
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
|
|
4
4
|
import { chainPropTypes } from '@mui/utils';
|
|
5
|
-
import { GridBody, GridErrorHandler, GridFooterPlaceholder,
|
|
5
|
+
import { GridBody, GridErrorHandler, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider } from '@mui/x-data-grid-pro';
|
|
6
6
|
import { DataGridProVirtualScroller, DataGridProColumnHeaders } from '@mui/x-data-grid-pro/internals';
|
|
7
7
|
import { useDataGridPremiumComponent } from './useDataGridPremiumComponent';
|
|
8
8
|
import { useDataGridPremiumProps } from './useDataGridPremiumProps';
|
|
@@ -23,7 +23,7 @@ const DataGridPremiumRaw = /*#__PURE__*/React.forwardRef(function DataGridPremiu
|
|
|
23
23
|
sx: props.sx,
|
|
24
24
|
ref: ref,
|
|
25
25
|
children: /*#__PURE__*/_jsxs(GridErrorHandler, {
|
|
26
|
-
children: [/*#__PURE__*/_jsx(
|
|
26
|
+
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
|
|
27
27
|
ColumnHeadersComponent: DataGridProColumnHeaders,
|
|
28
28
|
VirtualScrollerComponent: DataGridProVirtualScroller,
|
|
29
29
|
children: /*#__PURE__*/_jsx(Watermark, {
|
|
@@ -58,7 +58,7 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
58
58
|
*/
|
|
59
59
|
aggregationRowsScope: PropTypes.oneOf(['all', 'filtered']),
|
|
60
60
|
/**
|
|
61
|
-
* The ref object that allows grid manipulation. Can be instantiated with
|
|
61
|
+
* The ref object that allows grid manipulation. Can be instantiated with `useGridApiRef()`.
|
|
62
62
|
*/
|
|
63
63
|
apiRef: PropTypes.shape({
|
|
64
64
|
current: PropTypes.object.isRequired
|
|
@@ -865,15 +865,15 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
865
865
|
*/
|
|
866
866
|
scrollEndThreshold: PropTypes.number,
|
|
867
867
|
/**
|
|
868
|
-
* If `true`, the
|
|
868
|
+
* If `true`, the vertical borders of the cells are displayed.
|
|
869
869
|
* @default false
|
|
870
870
|
*/
|
|
871
|
-
|
|
871
|
+
showCellVerticalBorder: PropTypes.bool,
|
|
872
872
|
/**
|
|
873
873
|
* If `true`, the right border of the column headers are displayed.
|
|
874
874
|
* @default false
|
|
875
875
|
*/
|
|
876
|
-
|
|
876
|
+
showColumnVerticalBorder: PropTypes.bool,
|
|
877
877
|
/**
|
|
878
878
|
* Sorting can be processed on the server or client-side.
|
|
879
879
|
* Set it to 'client' if you would like to handle sorting on the client-side.
|
|
@@ -907,5 +907,20 @@ process.env.NODE_ENV !== "production" ? DataGridPremiumRaw.propTypes = {
|
|
|
907
907
|
* If `true`, the rows will be gathered in a tree structure according to the `getTreeDataPath` prop.
|
|
908
908
|
* @default false
|
|
909
909
|
*/
|
|
910
|
-
treeData: PropTypes.bool
|
|
910
|
+
treeData: PropTypes.bool,
|
|
911
|
+
/**
|
|
912
|
+
* If `true`, the cell selection mode is enabled.
|
|
913
|
+
* @default false
|
|
914
|
+
*/
|
|
915
|
+
unstable_cellSelection: PropTypes.bool,
|
|
916
|
+
/**
|
|
917
|
+
* Set the cell selection model of the grid.
|
|
918
|
+
*/
|
|
919
|
+
unstable_cellSelectionModel: PropTypes.object,
|
|
920
|
+
/**
|
|
921
|
+
* Callback fired when the selection state of one or multiple cells changes.
|
|
922
|
+
* @param {GridCellSelectionModel} cellSelectionModel Object in the shape of [[GridCellSelectionModel]] containg the selected cells.
|
|
923
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
924
|
+
*/
|
|
925
|
+
unstable_onCellSelectionModelChange: PropTypes.func
|
|
911
926
|
} : void 0;
|
|
@@ -1,10 +1,11 @@
|
|
|
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, 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 } from '@mui/x-data-grid-pro/internals';
|
|
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, 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 } from '@mui/x-data-grid-pro/internals';
|
|
2
2
|
// Premium-only features
|
|
3
3
|
import { useGridAggregation, aggregationStateInitializer } from '../hooks/features/aggregation/useGridAggregation';
|
|
4
4
|
import { useGridAggregationPreProcessors } from '../hooks/features/aggregation/useGridAggregationPreProcessors';
|
|
5
5
|
import { useGridRowGrouping, rowGroupingStateInitializer } from '../hooks/features/rowGrouping/useGridRowGrouping';
|
|
6
6
|
import { useGridRowGroupingPreProcessors } from '../hooks/features/rowGrouping/useGridRowGroupingPreProcessors';
|
|
7
7
|
import { useGridExcelExport } from '../hooks/features/export/useGridExcelExport';
|
|
8
|
+
import { cellSelectionStateInitializer, useGridCellSelection } from '../hooks/features/cellSelection/useGridCellSelection';
|
|
8
9
|
export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
9
10
|
const privateApiRef = useGridInitialization(inputApiRef, props);
|
|
10
11
|
|
|
@@ -15,6 +16,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
15
16
|
useGridRowReorderPreProcessors(privateApiRef, props);
|
|
16
17
|
useGridRowGroupingPreProcessors(privateApiRef, props);
|
|
17
18
|
useGridTreeDataPreProcessors(privateApiRef, props);
|
|
19
|
+
useGridLazyLoaderPreProcessors(privateApiRef, props);
|
|
18
20
|
useGridRowPinningPreProcessors(privateApiRef);
|
|
19
21
|
useGridAggregationPreProcessors(privateApiRef, props);
|
|
20
22
|
useGridDetailPanelPreProcessors(privateApiRef, props);
|
|
@@ -29,6 +31,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
29
31
|
useGridInitializeState(rowGroupingStateInitializer, privateApiRef, props);
|
|
30
32
|
useGridInitializeState(aggregationStateInitializer, privateApiRef, props);
|
|
31
33
|
useGridInitializeState(rowSelectionStateInitializer, privateApiRef, props);
|
|
34
|
+
useGridInitializeState(cellSelectionStateInitializer, privateApiRef, props);
|
|
32
35
|
useGridInitializeState(detailPanelStateInitializer, privateApiRef, props);
|
|
33
36
|
useGridInitializeState(columnPinningStateInitializer, privateApiRef, props);
|
|
34
37
|
useGridInitializeState(columnsStateInitializer, privateApiRef, props);
|
|
@@ -51,6 +54,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
51
54
|
useGridAggregation(privateApiRef, props);
|
|
52
55
|
useGridKeyboardNavigation(privateApiRef, props);
|
|
53
56
|
useGridRowSelection(privateApiRef, props);
|
|
57
|
+
useGridCellSelection(privateApiRef, props);
|
|
54
58
|
useGridColumnPinning(privateApiRef, props);
|
|
55
59
|
useGridRowPinning(privateApiRef, props);
|
|
56
60
|
useGridColumns(privateApiRef, props);
|
|
@@ -72,6 +76,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
72
76
|
useGridRowReorder(privateApiRef, props);
|
|
73
77
|
useGridScroll(privateApiRef, props);
|
|
74
78
|
useGridInfiniteLoader(privateApiRef, props);
|
|
79
|
+
useGridLazyLoader(privateApiRef, props);
|
|
75
80
|
useGridColumnMenu(privateApiRef);
|
|
76
81
|
useGridCsvExport(privateApiRef);
|
|
77
82
|
useGridPrintExport(privateApiRef, props);
|
|
@@ -8,6 +8,7 @@ import { GRID_AGGREGATION_FUNCTIONS } from '../hooks/features/aggregation';
|
|
|
8
8
|
* The default values of `DataGridPremiumPropsWithDefaultValue` to inject in the props of DataGridPremium.
|
|
9
9
|
*/
|
|
10
10
|
export const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PRO_PROPS_DEFAULT_VALUES, {
|
|
11
|
+
unstable_cellSelection: false,
|
|
11
12
|
disableAggregation: false,
|
|
12
13
|
disableRowGrouping: false,
|
|
13
14
|
rowGroupingColumnMode: 'single',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridExportMenuItemProps } from '@mui/x-data-grid-pro';
|
|
3
3
|
import { GridExcelExportOptions } from '../hooks/features/export';
|
|
4
|
-
export
|
|
4
|
+
export type GridExcelExportMenuItemProps = GridExportMenuItemProps<GridExcelExportOptions>;
|
|
5
5
|
declare function GridExcelExportMenuItem(props: GridExcelExportMenuItemProps): JSX.Element;
|
|
6
6
|
declare namespace GridExcelExportMenuItem {
|
|
7
7
|
var propTypes: any;
|
|
@@ -39,9 +39,12 @@ const getAggregationCellValue = ({
|
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
41
|
return aggregationFunction.apply({
|
|
42
|
-
values
|
|
42
|
+
values,
|
|
43
|
+
groupId,
|
|
44
|
+
field // Added per user request in https://github.com/mui/mui-x/issues/6995#issuecomment-1327423455
|
|
43
45
|
});
|
|
44
46
|
};
|
|
47
|
+
|
|
45
48
|
const getGroupAggregatedValue = ({
|
|
46
49
|
groupId,
|
|
47
50
|
apiRef,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GridValueFormatterParams, GridRowId, GridRowModel } from '@mui/x-data-grid-pro';
|
|
1
|
+
import { GridValueFormatterParams, GridRowId, GridRowModel, GridColDef } from '@mui/x-data-grid-pro';
|
|
2
2
|
export interface GridAggregationState {
|
|
3
3
|
model: GridAggregationModel;
|
|
4
4
|
lookup: GridAggregationLookup;
|
|
@@ -70,11 +70,13 @@ export interface GridAggregationFunction<V = any, AV = V, FAV = AV> {
|
|
|
70
70
|
}
|
|
71
71
|
interface GridAggregationParams<V = any> {
|
|
72
72
|
values: (V | undefined)[];
|
|
73
|
+
groupId: GridRowId;
|
|
74
|
+
field: GridColDef['field'];
|
|
73
75
|
}
|
|
74
|
-
export
|
|
76
|
+
export type GridAggregationModel = {
|
|
75
77
|
[field: string]: string;
|
|
76
78
|
};
|
|
77
|
-
export
|
|
79
|
+
export type GridAggregationLookup = {
|
|
78
80
|
[rowId: GridRowId]: {
|
|
79
81
|
[field: string]: {
|
|
80
82
|
position: GridAggregationPosition;
|
|
@@ -82,7 +84,7 @@ export declare type GridAggregationLookup = {
|
|
|
82
84
|
};
|
|
83
85
|
};
|
|
84
86
|
};
|
|
85
|
-
export
|
|
87
|
+
export type GridAggregationPosition = 'inline' | 'footer';
|
|
86
88
|
export interface GridAggregationCellMeta {
|
|
87
89
|
/**
|
|
88
90
|
* If `true`, the current aggregated value has the same unit as the value of the other cells of this row.
|
|
@@ -111,7 +113,7 @@ export interface GridAggregationRule {
|
|
|
111
113
|
* - items for non-existing aggregation function
|
|
112
114
|
* - items for non-available aggregation function on the column (GridColDef.availableAggregationFunctions)
|
|
113
115
|
*/
|
|
114
|
-
export
|
|
116
|
+
export type GridAggregationRules = {
|
|
115
117
|
[field: string]: GridAggregationRule;
|
|
116
118
|
};
|
|
117
119
|
export {};
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { GridStatePremium } from '../../../models/gridStatePremium';
|
|
2
2
|
export declare const gridAggregationStateSelector: (state: GridStatePremium) => import("./gridAggregationInterfaces").GridAggregationState;
|
|
3
|
+
/**
|
|
4
|
+
* Get the aggregation model, containing the aggregation function of each column.
|
|
5
|
+
* If a column is not in the model, it is not aggregated.
|
|
6
|
+
* @category Aggregation
|
|
7
|
+
*/
|
|
3
8
|
export declare const gridAggregationModelSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationModel>;
|
|
9
|
+
/**
|
|
10
|
+
* Get the aggregation results as a lookup.
|
|
11
|
+
* @category Aggregation
|
|
12
|
+
*/
|
|
4
13
|
export declare const gridAggregationLookupSelector: import("@mui/x-data-grid").OutputSelector<GridStatePremium, import("./gridAggregationInterfaces").GridAggregationLookup>;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { createSelector } from '@mui/x-data-grid-pro/internals';
|
|
2
2
|
export const gridAggregationStateSelector = state => state.aggregation;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get the aggregation model, containing the aggregation function of each column.
|
|
6
|
+
* If a column is not in the model, it is not aggregated.
|
|
7
|
+
* @category Aggregation
|
|
8
|
+
*/
|
|
3
9
|
export const gridAggregationModelSelector = createSelector(gridAggregationStateSelector, aggregationState => aggregationState.model);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Get the aggregation results as a lookup.
|
|
13
|
+
* @category Aggregation
|
|
14
|
+
*/
|
|
4
15
|
export const gridAggregationLookupSelector = createSelector(gridAggregationStateSelector, aggregationState => aggregationState.lookup);
|
|
@@ -14,10 +14,10 @@ function Divider() {
|
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
export const useGridAggregationPreProcessors = (apiRef, props) => {
|
|
17
|
+
// apiRef.current.caches.aggregation.rulesOnLastColumnHydration is not used because by the time
|
|
18
|
+
// that the pre-processor is called it will already have been updated with the current rules.
|
|
19
|
+
const rulesOnLastColumnHydration = React.useRef({});
|
|
17
20
|
const updateAggregatedColumns = React.useCallback(columnsState => {
|
|
18
|
-
const {
|
|
19
|
-
rulesOnLastColumnHydration
|
|
20
|
-
} = apiRef.current.caches.aggregation;
|
|
21
21
|
const aggregationRules = props.disableAggregation ? {} : getAggregationRules({
|
|
22
22
|
columnsLookup: columnsState.lookup,
|
|
23
23
|
aggregationModel: gridAggregationModelSelector(apiRef),
|
|
@@ -25,7 +25,7 @@ export const useGridAggregationPreProcessors = (apiRef, props) => {
|
|
|
25
25
|
});
|
|
26
26
|
columnsState.orderedFields.forEach(field => {
|
|
27
27
|
const shouldHaveAggregationValue = !!aggregationRules[field];
|
|
28
|
-
const haveAggregationColumnValue = !!rulesOnLastColumnHydration[field];
|
|
28
|
+
const haveAggregationColumnValue = !!rulesOnLastColumnHydration.current[field];
|
|
29
29
|
let column = columnsState.lookup[field];
|
|
30
30
|
if (haveAggregationColumnValue) {
|
|
31
31
|
column = unwrapColumnFromAggregation({
|
|
@@ -41,6 +41,7 @@ export const useGridAggregationPreProcessors = (apiRef, props) => {
|
|
|
41
41
|
}
|
|
42
42
|
columnsState.lookup[field] = column;
|
|
43
43
|
});
|
|
44
|
+
rulesOnLastColumnHydration.current = aggregationRules;
|
|
44
45
|
return columnsState;
|
|
45
46
|
}, [apiRef, props.aggregationFunctions, props.disableAggregation]);
|
|
46
47
|
const addGroupFooterRows = React.useCallback(value => {
|
|
@@ -3,7 +3,7 @@ import { GridColDef } from '@mui/x-data-grid-pro';
|
|
|
3
3
|
import { GridApiPremium } from '../../../models/gridApiPremium';
|
|
4
4
|
import { GridAggregationRule } from './gridAggregationInterfaces';
|
|
5
5
|
declare const AGGREGATION_WRAPPABLE_PROPERTIES: readonly ["valueGetter", "valueFormatter", "renderCell", "renderHeader", "filterOperators"];
|
|
6
|
-
|
|
6
|
+
type WrappableColumnProperty = typeof AGGREGATION_WRAPPABLE_PROPERTIES[number];
|
|
7
7
|
interface GridColDefWithAggregationWrappers extends GridColDef {
|
|
8
8
|
aggregationWrappedProperties?: {
|
|
9
9
|
[P in WrappableColumnProperty]?: {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { GridCellCoordinates, GridColDef, GridRowId } from '@mui/x-data-grid-pro';
|
|
2
|
+
export type GridCellSelectionModel = Record<GridRowId, Record<GridColDef['field'], boolean>>;
|
|
3
|
+
/**
|
|
4
|
+
* The cell selection API interface that is available in the grid [[apiRef]].
|
|
5
|
+
*/
|
|
6
|
+
export interface GridCellSelectionApi {
|
|
7
|
+
/**
|
|
8
|
+
* Determines if a cell is selected or not.
|
|
9
|
+
* @param {GridRowId} id The id of the row.
|
|
10
|
+
* @param {GridColDef['field']} field The field.
|
|
11
|
+
* @returns {boolean} A boolean indicating if the cell is selected.
|
|
12
|
+
*/
|
|
13
|
+
unstable_isCellSelected: (id: GridRowId, field: GridColDef['field']) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Returns an object containing the selection state of the cells.
|
|
16
|
+
* The keys of the object correpond to the row IDs.
|
|
17
|
+
* The value of each key is another object whose keys are the fields and values are the selection state.
|
|
18
|
+
* @returns {GridCellSelectionModel} Object containing the selection state of the cells
|
|
19
|
+
*/
|
|
20
|
+
unstable_getCellSelectionModel: () => GridCellSelectionModel;
|
|
21
|
+
/**
|
|
22
|
+
* Updates the selected cells to be those passed to the `newModel` argument.
|
|
23
|
+
* Any cell already selected will be unselected.
|
|
24
|
+
* @param {GridCellSelectionModel} newModel The cells to select.
|
|
25
|
+
*/
|
|
26
|
+
unstable_setCellSelectionModel: (newModel: GridCellSelectionModel) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Selects all cells that are inside the range given by `start` and `end` coordinates.
|
|
29
|
+
* @param {GridCellCoordinates} start Object containg the row ID and field of the first cell to select.
|
|
30
|
+
* @param {GridCellCoordinates} end Object containg the row ID and field of the last cell to select.
|
|
31
|
+
* @param {boolean} keepOtherSelected Whether to keep current selected cells or discard. Default is false.
|
|
32
|
+
*/
|
|
33
|
+
unstable_selectCellRange: (start: GridCellCoordinates, end: GridCellCoordinates, keepOtherSelected?: boolean) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Returns an array containg only the selected cells.
|
|
36
|
+
* Each item is an object with the ID and field of the cell.
|
|
37
|
+
* @returns {GridCellCoordinates[]} Array with the selected cells.
|
|
38
|
+
*/
|
|
39
|
+
unstable_getSelectedCellsAsArray: () => GridCellCoordinates[];
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const gridCellSelectionStateSelector = state => state.cellSelection;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './gridCellSelectionInterfaces';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './gridCellSelectionInterfaces';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridStateInitializer } from '@mui/x-data-grid-pro/internals';
|
|
3
|
+
import { DataGridPremiumProcessedProps } from '../../../models/dataGridPremiumProps';
|
|
4
|
+
import { GridPrivateApiPremium } from '../../../models/gridApiPremium';
|
|
5
|
+
export declare const cellSelectionStateInitializer: GridStateInitializer<Pick<DataGridPremiumProcessedProps, 'unstable_cellSelectionModel' | 'initialState'>>;
|
|
6
|
+
export declare const useGridCellSelection: (apiRef: React.MutableRefObject<GridPrivateApiPremium>, props: Pick<DataGridPremiumProcessedProps, 'unstable_cellSelection' | 'unstable_cellSelectionModel' | 'unstable_onCellSelectionModelChange' | 'pagination' | 'paginationMode'>) => void;
|