@mui/x-data-grid-generator 5.13.0 → 5.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +156 -6
- package/columns/commodities.columns.js +1 -0
- package/columns/employees.columns.js +26 -5
- package/columns/index.d.ts +0 -1
- package/columns/index.js +1 -2
- package/hooks/useMovieData.js +2 -1
- package/hooks/useQuery.d.ts +1 -1
- package/index.js +1 -1
- package/legacy/columns/commodities.columns.js +1 -0
- package/legacy/columns/employees.columns.js +27 -4
- package/legacy/columns/index.js +1 -2
- package/legacy/hooks/useMovieData.js +2 -1
- package/legacy/index.js +1 -1
- package/legacy/renderer/renderAvatar.js +3 -3
- package/legacy/renderer/renderCountry.js +7 -1
- package/legacy/renderer/renderPnl.js +1 -1
- package/legacy/renderer/renderProgress.js +7 -1
- package/legacy/renderer/renderRating.js +10 -7
- package/legacy/renderer/renderTotalPrice.js +7 -1
- package/modern/columns/commodities.columns.js +1 -0
- package/modern/columns/employees.columns.js +26 -5
- package/modern/columns/index.js +1 -2
- package/modern/hooks/useMovieData.js +2 -1
- package/modern/index.js +1 -1
- package/modern/renderer/renderAvatar.js +3 -3
- package/modern/renderer/renderCountry.js +7 -1
- package/modern/renderer/renderPnl.js +1 -1
- package/modern/renderer/renderProgress.js +7 -1
- package/modern/renderer/renderRating.js +9 -6
- package/modern/renderer/renderTotalPrice.js +7 -1
- package/node/columns/commodities.columns.js +1 -0
- package/node/columns/employees.columns.js +26 -5
- package/node/columns/index.js +0 -13
- package/node/hooks/useMovieData.js +2 -1
- package/node/index.js +1 -1
- package/node/renderer/renderAvatar.js +3 -3
- package/node/renderer/renderCountry.js +7 -1
- package/node/renderer/renderPnl.js +1 -1
- package/node/renderer/renderProgress.js +7 -1
- package/node/renderer/renderRating.js +9 -6
- package/node/renderer/renderTotalPrice.js +7 -1
- package/package.json +4 -4
- package/renderer/renderAvatar.d.ts +3 -2
- package/renderer/renderAvatar.js +3 -3
- package/renderer/renderCountry.d.ts +1 -1
- package/renderer/renderCountry.js +7 -1
- package/renderer/renderPnl.js +1 -1
- package/renderer/renderProgress.d.ts +1 -1
- package/renderer/renderProgress.js +7 -1
- package/renderer/renderRating.d.ts +1 -1
- package/renderer/renderRating.js +9 -6
- package/renderer/renderTotalPrice.d.ts +1 -1
- package/renderer/renderTotalPrice.js +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,156 @@
|
|
|
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
|
+
## 5.15.0
|
|
7
|
+
|
|
8
|
+
_Jul 29, 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
|
+
- 🎁 Introduce aggregation (#5592) @flaviendelangle
|
|
13
|
+
|
|
14
|
+
Premium users can now aggregate data in the grid.
|
|
15
|
+
Extract information like sum, average, count, and others with a couple of clicks.
|
|
16
|
+
|
|
17
|
+
https://user-images.githubusercontent.com/45398769/181581503-77cc412e-9d9e-4de1-8bc3-c3bccc54cdaa.mp4
|
|
18
|
+
|
|
19
|
+
To enable this feature, add `experimentalFeatures={{ aggregation: true }}`.
|
|
20
|
+
Aggregation functions are customizable and they combine well with row grouping.
|
|
21
|
+
See the [documentation](https://mui.com/x/react-data-grid/aggregation/) to explore everything it has to offer.
|
|
22
|
+
|
|
23
|
+
- 🚀 Introduce row pinning (#4863) @cherniavskii
|
|
24
|
+
|
|
25
|
+
Pro users can now pin rows on top or bottom of the grid.
|
|
26
|
+
|
|
27
|
+
https://user-images.githubusercontent.com/45398769/181581493-56c733a3-6dd5-4546-bf8d-3f2dff72b14a.mp4
|
|
28
|
+
|
|
29
|
+
To do so, enable the feature with `experimentalFeatures={{ rowPinning: true }}` and provide the pinned rows data to the `pinnedRows` prop.
|
|
30
|
+
For more details, see the [documentation](https://mui.com/x/react-data-grid/row-pinning/).
|
|
31
|
+
|
|
32
|
+
- 🌍 Add simplified Chinese (zh-CN) locale to pickers (#5584) @gamecss
|
|
33
|
+
- 📚 Documentation improvements
|
|
34
|
+
|
|
35
|
+
### `@mui/x-data-grid@v5.15.0` / `@mui/x-data-grid-pro@v5.15.0` / `@mui/x-data-grid-premium@v5.15.0`
|
|
36
|
+
|
|
37
|
+
#### Changes
|
|
38
|
+
|
|
39
|
+
- [DataGrid] Add prop to keep modifications while processing props (#5309) @m4theushw
|
|
40
|
+
- [DataGrid] Fix container width change on React 18 (#5566) @m4theushw
|
|
41
|
+
- [DataGrid] Fix ellipsis style convention (#5587) @oliviertassinari
|
|
42
|
+
- [DataGridPro] Implement row pinning (#4863) @cherniavskii
|
|
43
|
+
- [DataGridPremium] Make aggregation public (#5592) @cherniavskii
|
|
44
|
+
- [l10n] Improve simplified Chinese (zh-CN) locale (#5584) @gamecss
|
|
45
|
+
|
|
46
|
+
### `@mui/x-date-pickers@v5.0.0-beta.3` / `@mui/x-date-picker-pro@5.0.0-beta.3`
|
|
47
|
+
|
|
48
|
+
#### Changes
|
|
49
|
+
|
|
50
|
+
- [l10n] Add simplified Chinese (zh-CN) locale (#5584) @gamecss
|
|
51
|
+
|
|
52
|
+
### Docs
|
|
53
|
+
|
|
54
|
+
- [docs] Split docs page about rows (#5195) @flaviendelangle
|
|
55
|
+
- [docs] Add warning clarifications (#5399) @alexfauquette
|
|
56
|
+
- [docs] Correct slot CSS classes for Pro and Premium components (#5452) @alexfauquette
|
|
57
|
+
- [docs] Fix internal link to `valueParser` (#5450) @alexfauquette
|
|
58
|
+
|
|
59
|
+
### Core
|
|
60
|
+
|
|
61
|
+
- [core] Upgrade monorepo (#5560) @m4theushw
|
|
62
|
+
|
|
63
|
+
## 5.14.0
|
|
64
|
+
|
|
65
|
+
_Jul 21, 2022_
|
|
66
|
+
|
|
67
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
68
|
+
|
|
69
|
+
- 🧪 Export `GridBooleanCell` component from data grid (#5537) @cliedeman
|
|
70
|
+
- ⚙️ Improve accessibility of the Export menu (#5486) @nogalpaulina
|
|
71
|
+
- 🌍 Improvements to different locales
|
|
72
|
+
- 📚 Documentation improvements
|
|
73
|
+
- 🐞 Bugfixes
|
|
74
|
+
|
|
75
|
+
### `@mui/x-data-grid@5.14.0` / `@mui/x-data-grid-pro@5.14.0` / `@mui/x-data-grid-premium@5.14.0`
|
|
76
|
+
|
|
77
|
+
#### Changes
|
|
78
|
+
|
|
79
|
+
- [DataGrid] Add generics to `GridPreProcessEditCellProps` (#5510) @YunosukeY
|
|
80
|
+
- [DataGrid] Avoid inconsistent state export (#5390) @flaviendelangle
|
|
81
|
+
- [DataGrid] Export `GridBooleanCell` component (#5537) @cliedeman
|
|
82
|
+
- [DataGrid] Fix `date`/`dateTime` edit input font size to match view mode (#5304) @cherniavskii
|
|
83
|
+
- [DataGrid] Fix loading overlay position (#5558) @DanailH
|
|
84
|
+
- [DataGrid] Improve accessibility of the Export menu in the toolbar (#5486) @nogalpaulina
|
|
85
|
+
- [DataGridPremium] Implement Aggregation - not publicly released (#4208) @flaviendelangle
|
|
86
|
+
- [DataGridPremium] Fix crash when exporting all columns to Excel (#5425) @cherniavskii
|
|
87
|
+
- [l10n] Add Traditional Chinese (zh-TW) locale (#5498) @happyincent
|
|
88
|
+
|
|
89
|
+
### `@mui/x-date-pickers@v5.0.0-beta.2` / `@mui/x-date-picker-pro@5.0.0-beta.2`
|
|
90
|
+
|
|
91
|
+
#### Changes
|
|
92
|
+
|
|
93
|
+
- [l10n] Add Norwegian (nb-NO) locale (#5475) @elkebab
|
|
94
|
+
|
|
95
|
+
### Docs
|
|
96
|
+
|
|
97
|
+
- [docs] New page presenting the `apiRef` (#5273) @flaviendelangle
|
|
98
|
+
- [docs] Remove blank line @oliviertassinari
|
|
99
|
+
|
|
100
|
+
### Core
|
|
101
|
+
|
|
102
|
+
- [core] Add missing comments on zh-TW translation (#5559) @flaviendelangle
|
|
103
|
+
- [core] Polish on the bug issue template (#5525) @oliviertassinari
|
|
104
|
+
- [test] Add more tests related to `isPrintableKey` (#5458) @mnajdova
|
|
105
|
+
|
|
106
|
+
## 5.13.1
|
|
107
|
+
|
|
108
|
+
_Jul 15, 2022_
|
|
109
|
+
|
|
110
|
+
We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
111
|
+
|
|
112
|
+
- ✏️ Enter edit mode when pasting in a cell with Ctrl+V (Cmd+V on macOS) (#5405) @alexfauquette
|
|
113
|
+
- 🌍 Many improvements to the locales
|
|
114
|
+
- 📚 Documentation improvements
|
|
115
|
+
- 🐞 Bugfixes
|
|
116
|
+
|
|
117
|
+
### `@mui/x-data-grid@v5.13.1` / `@mui/x-data-grid-pro@v5.13.1` / `@mui/x-data-grid-premium@v5.13.1`
|
|
118
|
+
|
|
119
|
+
#### Changes
|
|
120
|
+
|
|
121
|
+
- [DataGrid] Fix blank space when using dynamic row height with pagination (#5315) @m4theushw
|
|
122
|
+
- [DataGrid] Start editing with uppercase letter and Ctrl+V (#5405) @alexfauquette
|
|
123
|
+
- [DataGrid] Fix some filters being removed from filter model on filter panel open (#5403) @cherniavskii
|
|
124
|
+
- [DataGridPro] Improve pinned column headers accessibility (#5370) @cherniavskii
|
|
125
|
+
- [l10n] Improve Dutch (nl-NL) locale (#5464) @developenguin
|
|
126
|
+
- [l10n] Improve French (fr-FR) locale (#3211) (#5420) @Zenoo
|
|
127
|
+
- [l10n] Improve German (de-DE) locale (#5448) @sebastianfrey
|
|
128
|
+
- [l10n] Improve Brazilian Portuguese (pt-BR) locale (#5394) @andrepxa
|
|
129
|
+
- [l10n] Improve Romanian (ro-RO) locale (#5449) @rolule
|
|
130
|
+
|
|
131
|
+
### `@mui/x-date-pickers@v5.0.0-beta.1` / `@mui/x-date-picker-pro@5.0.0-beta.1`
|
|
132
|
+
|
|
133
|
+
#### Changes
|
|
134
|
+
|
|
135
|
+
- [pickers] Add Italian (it-IT) locale (#5467) @felixh10r
|
|
136
|
+
- [pickers] Add Spanish (es-ES) locale (#5468) @felixh10r
|
|
137
|
+
- [pickers] Improve French (fr-FR) locale (#5446) @Zenoo
|
|
138
|
+
- [pickers] Improve German (de-DE) locale (#5447) @sebastianfrey
|
|
139
|
+
|
|
140
|
+
### Docs
|
|
141
|
+
|
|
142
|
+
- [docs] Fix typo in the sorting page (#5431) @JosephMarinier
|
|
143
|
+
- [docs] Fix description for "Striped rows" example (#5432) @lindapaiste
|
|
144
|
+
- [docs] Make a clear difference between the license and license key (#5316) @oliviertassinari
|
|
145
|
+
- [docs] Update pickers README files (#5456) @cherniavskii
|
|
146
|
+
- [docs] Clarify the scope of support for MUI X (#5423) @joserodolfofreitas
|
|
147
|
+
|
|
148
|
+
### Core
|
|
149
|
+
|
|
150
|
+
- [core] Add technical support link to \_redirects (#5428) @joserodolfofreitas
|
|
151
|
+
- [core] Improve GitHub bug reproduction template (#5067) @joserodolfofreitas
|
|
152
|
+
- [core] Include playground pages in tsconfig (#5367) @cherniavskii
|
|
153
|
+
- [core] Sort keys like in material-ui @oliviertassinari
|
|
154
|
+
- [test] Wait for flags to load on regression tests (#5473) @m4theushw
|
|
155
|
+
|
|
6
156
|
## 5.13.0
|
|
7
157
|
|
|
8
158
|
_Jul 7, 2022_
|
|
@@ -213,7 +363,7 @@ _May 31, 2022_
|
|
|
213
363
|
|
|
214
364
|
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
215
365
|
|
|
216
|
-
- 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/
|
|
366
|
+
- 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/row-height/#dynamic-row-height) (#4859) @m4theushw
|
|
217
367
|
|
|
218
368
|
<img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
|
|
219
369
|
|
|
@@ -530,7 +680,7 @@ _Apr 25, 2022_
|
|
|
530
680
|
|
|
531
681
|
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
532
682
|
|
|
533
|
-
- 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/
|
|
683
|
+
- 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/row-ordering/) (#4034) @DanailH
|
|
534
684
|
|
|
535
685
|
<img src="https://user-images.githubusercontent.com/5858539/165091263-23472fbb-a989-44b8-849a-d2185adfe13b.gif" width="800">
|
|
536
686
|
|
|
@@ -794,7 +944,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
|
|
|
794
944
|
<DataGrid getRowSpacing={() => ({ top: 10, bottom: 10 })} />
|
|
795
945
|
```
|
|
796
946
|
|
|
797
|
-
Check the [documentation](https://mui.com/x/react-data-grid/
|
|
947
|
+
Check the [documentation](https://mui.com/x/react-data-grid/row-height/#row-spacing) for more information.
|
|
798
948
|
|
|
799
949
|
### `@mui/x-data-grid@v5.6.1` / `@mui/x-data-grid-pro@v5.6.1`
|
|
800
950
|
|
|
@@ -1048,7 +1198,7 @@ _Jan 28, 2022_
|
|
|
1048
1198
|
|
|
1049
1199
|
A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
1050
1200
|
|
|
1051
|
-
- 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/
|
|
1201
|
+
- 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/row-height/#variable-row-height) (#438) @DanailH
|
|
1052
1202
|
|
|
1053
1203
|
Allows for setting a row-specific height.
|
|
1054
1204
|
By default, all rows have the same height, but now you can set the height on a per-row basis.
|
|
@@ -1416,7 +1566,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
|
|
|
1416
1566
|
- [core] Fix `yarn prettier` script (#3292) @oliviertassinari
|
|
1417
1567
|
- [core] Improve tests for Tree Data (#3366) @flaviendelangle
|
|
1418
1568
|
- [core] Never import directly from the `__modules__` folder in the `x-data-grid-generator` package (#3379) @flaviendelangle
|
|
1419
|
-
- [core] Transition to a new
|
|
1569
|
+
- [core] Transition to a new Stack Overflow tag (#3308) @oliviertassinari
|
|
1420
1570
|
- [core] Update monorepo (#3370) @flaviendelangle
|
|
1421
1571
|
- [core] Use pre-processors for sorting and filtering (#3318) @flaviendelangle
|
|
1422
1572
|
- [test] Replace `useFakeTimers` (#3323) @m4theushw
|
|
@@ -3700,7 +3850,7 @@ Big thanks to the 7 contributors who made this release possible. Here are some h
|
|
|
3700
3850
|
- 🎁 Add `onRowsScrollEnd` to support infinite loading (#1199) @DanailH
|
|
3701
3851
|
This is an XGrid feature. Provides the ability to tap into the `onRowsScrollEnd` which is called when the scroll reaches the bottom of the grid viewport allowing developers to load additional data. It can be used with a combination of `scrollBottomThreshold` to control the area in which the `onRowsScrollEnd` is called.
|
|
3702
3852
|
|
|
3703
|
-
See the documentation for [more details](https://mui.com/x/react-data-grid/
|
|
3853
|
+
See the documentation for [more details](https://mui.com/x/react-data-grid/row-updates/#infinite-loading).
|
|
3704
3854
|
|
|
3705
3855
|
- 🕹 Provide the ability to sort by multiple columns using Shift+click (#1203) @dtassone
|
|
3706
3856
|
- 🇵🇱 Added pl-PL locale (#1117) @LarsKumbier
|
|
@@ -44,6 +44,7 @@ export const getCommodityColumns = (editable = false) => [{
|
|
|
44
44
|
generateData: generateFilledQuantity,
|
|
45
45
|
renderCell: renderProgress,
|
|
46
46
|
renderEditCell: renderEditProgress,
|
|
47
|
+
availableAggregationFunctions: ['min', 'max', 'avg', 'size'],
|
|
47
48
|
type: 'number',
|
|
48
49
|
width: 120,
|
|
49
50
|
editable
|
|
@@ -9,10 +9,16 @@ export const getEmployeeColumns = () => [{
|
|
|
9
9
|
}, {
|
|
10
10
|
field: 'avatar',
|
|
11
11
|
headerName: 'Avatar',
|
|
12
|
-
sortable: false,
|
|
13
12
|
generateData: randomColor,
|
|
14
13
|
renderCell: renderAvatar,
|
|
14
|
+
valueGetter: params => params.rowNode.isAutoGenerated ? null : {
|
|
15
|
+
name: params.row.name,
|
|
16
|
+
color: params.row.avatar
|
|
17
|
+
},
|
|
18
|
+
sortable: false,
|
|
15
19
|
filterable: false,
|
|
20
|
+
groupable: false,
|
|
21
|
+
aggregable: false,
|
|
16
22
|
disableExport: true
|
|
17
23
|
}, {
|
|
18
24
|
field: 'name',
|
|
@@ -20,14 +26,18 @@ export const getEmployeeColumns = () => [{
|
|
|
20
26
|
generateData: randomName,
|
|
21
27
|
dataGeneratorUniquenessEnabled: true,
|
|
22
28
|
width: 120,
|
|
23
|
-
editable: true
|
|
29
|
+
editable: true,
|
|
30
|
+
groupable: false,
|
|
31
|
+
aggregable: false
|
|
24
32
|
}, {
|
|
25
33
|
field: 'website',
|
|
26
34
|
headerName: 'Website',
|
|
27
35
|
generateData: randomUrl,
|
|
28
36
|
renderCell: renderLink,
|
|
29
37
|
width: 160,
|
|
30
|
-
editable: true
|
|
38
|
+
editable: true,
|
|
39
|
+
groupable: false,
|
|
40
|
+
aggregable: false
|
|
31
41
|
}, {
|
|
32
42
|
field: 'rating',
|
|
33
43
|
headerName: 'Rating',
|
|
@@ -36,7 +46,8 @@ export const getEmployeeColumns = () => [{
|
|
|
36
46
|
renderEditCell: renderEditRating,
|
|
37
47
|
width: 180,
|
|
38
48
|
type: 'number',
|
|
39
|
-
editable: true
|
|
49
|
+
editable: true,
|
|
50
|
+
availableAggregationFunctions: ['avg', 'min', 'max', 'size']
|
|
40
51
|
}, {
|
|
41
52
|
field: 'email',
|
|
42
53
|
headerName: 'Email',
|
|
@@ -111,5 +122,15 @@ export const getEmployeeColumns = () => [{
|
|
|
111
122
|
}, {
|
|
112
123
|
field: 'salary',
|
|
113
124
|
headerName: 'Salary',
|
|
114
|
-
generateData: () => randomInt(30000, 80000)
|
|
125
|
+
generateData: () => randomInt(30000, 80000),
|
|
126
|
+
type: 'number',
|
|
127
|
+
valueFormatter: ({
|
|
128
|
+
value
|
|
129
|
+
}) => {
|
|
130
|
+
if (!value || typeof value !== 'number') {
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return `${value.toLocaleString()}$`;
|
|
135
|
+
}
|
|
115
136
|
}];
|
package/columns/index.d.ts
CHANGED
package/columns/index.js
CHANGED
package/hooks/useMovieData.js
CHANGED
package/hooks/useQuery.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface QueryOptions {
|
|
|
17
17
|
filterModel?: GridFilterModel;
|
|
18
18
|
sortModel?: GridSortModel;
|
|
19
19
|
}
|
|
20
|
-
export declare const createFakeServer: (dataSetOptions?: Partial<UseDemoDataOptions
|
|
20
|
+
export declare const createFakeServer: (dataSetOptions?: Partial<UseDemoDataOptions>, serverOptions?: Partial<ServerOptions>) => {
|
|
21
21
|
columns: import("..").GridColDefGenerator[];
|
|
22
22
|
initialState: {
|
|
23
23
|
columns: {
|
package/index.js
CHANGED
|
@@ -48,6 +48,7 @@ export var getCommodityColumns = function getCommodityColumns() {
|
|
|
48
48
|
generateData: generateFilledQuantity,
|
|
49
49
|
renderCell: renderProgress,
|
|
50
50
|
renderEditCell: renderEditProgress,
|
|
51
|
+
availableAggregationFunctions: ['min', 'max', 'avg', 'size'],
|
|
51
52
|
type: 'number',
|
|
52
53
|
width: 120,
|
|
53
54
|
editable: editable
|
|
@@ -10,10 +10,18 @@ export var getEmployeeColumns = function getEmployeeColumns() {
|
|
|
10
10
|
}, {
|
|
11
11
|
field: 'avatar',
|
|
12
12
|
headerName: 'Avatar',
|
|
13
|
-
sortable: false,
|
|
14
13
|
generateData: randomColor,
|
|
15
14
|
renderCell: renderAvatar,
|
|
15
|
+
valueGetter: function valueGetter(params) {
|
|
16
|
+
return params.rowNode.isAutoGenerated ? null : {
|
|
17
|
+
name: params.row.name,
|
|
18
|
+
color: params.row.avatar
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
sortable: false,
|
|
16
22
|
filterable: false,
|
|
23
|
+
groupable: false,
|
|
24
|
+
aggregable: false,
|
|
17
25
|
disableExport: true
|
|
18
26
|
}, {
|
|
19
27
|
field: 'name',
|
|
@@ -21,14 +29,18 @@ export var getEmployeeColumns = function getEmployeeColumns() {
|
|
|
21
29
|
generateData: randomName,
|
|
22
30
|
dataGeneratorUniquenessEnabled: true,
|
|
23
31
|
width: 120,
|
|
24
|
-
editable: true
|
|
32
|
+
editable: true,
|
|
33
|
+
groupable: false,
|
|
34
|
+
aggregable: false
|
|
25
35
|
}, {
|
|
26
36
|
field: 'website',
|
|
27
37
|
headerName: 'Website',
|
|
28
38
|
generateData: randomUrl,
|
|
29
39
|
renderCell: renderLink,
|
|
30
40
|
width: 160,
|
|
31
|
-
editable: true
|
|
41
|
+
editable: true,
|
|
42
|
+
groupable: false,
|
|
43
|
+
aggregable: false
|
|
32
44
|
}, {
|
|
33
45
|
field: 'rating',
|
|
34
46
|
headerName: 'Rating',
|
|
@@ -37,7 +49,8 @@ export var getEmployeeColumns = function getEmployeeColumns() {
|
|
|
37
49
|
renderEditCell: renderEditRating,
|
|
38
50
|
width: 180,
|
|
39
51
|
type: 'number',
|
|
40
|
-
editable: true
|
|
52
|
+
editable: true,
|
|
53
|
+
availableAggregationFunctions: ['avg', 'min', 'max', 'size']
|
|
41
54
|
}, {
|
|
42
55
|
field: 'email',
|
|
43
56
|
headerName: 'Email',
|
|
@@ -117,6 +130,16 @@ export var getEmployeeColumns = function getEmployeeColumns() {
|
|
|
117
130
|
headerName: 'Salary',
|
|
118
131
|
generateData: function generateData() {
|
|
119
132
|
return randomInt(30000, 80000);
|
|
133
|
+
},
|
|
134
|
+
type: 'number',
|
|
135
|
+
valueFormatter: function valueFormatter(_ref2) {
|
|
136
|
+
var value = _ref2.value;
|
|
137
|
+
|
|
138
|
+
if (!value || typeof value !== 'number') {
|
|
139
|
+
return value;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return "".concat(value.toLocaleString(), "$");
|
|
120
143
|
}
|
|
121
144
|
}];
|
|
122
145
|
};
|
package/legacy/columns/index.js
CHANGED
package/legacy/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import Avatar from '@mui/material/Avatar';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
export function renderAvatar(params) {
|
|
5
|
-
if (params.
|
|
5
|
+
if (params.value == null) {
|
|
6
6
|
return '';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
return /*#__PURE__*/_jsx(Avatar, {
|
|
10
10
|
style: {
|
|
11
|
-
backgroundColor: params.value
|
|
11
|
+
backgroundColor: params.value.color
|
|
12
12
|
},
|
|
13
|
-
children: params.
|
|
13
|
+
children: params.value.name.toUpperCase().substring(0, 1)
|
|
14
14
|
});
|
|
15
15
|
}
|
|
@@ -32,8 +32,14 @@ var Country = /*#__PURE__*/React.memo(function Country(props) {
|
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
export function renderCountry(params) {
|
|
35
|
-
if (params.
|
|
35
|
+
if (params.value == null) {
|
|
36
36
|
return '';
|
|
37
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
38
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
42
|
+
return null;
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
return /*#__PURE__*/_jsx(Country, {
|
|
@@ -48,8 +48,14 @@ var ProgressBar = /*#__PURE__*/React.memo(function ProgressBar(props) {
|
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
50
|
export function renderProgress(params) {
|
|
51
|
-
if (params.
|
|
51
|
+
if (params.value == null) {
|
|
52
52
|
return '';
|
|
53
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
54
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering a progress bar.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
58
|
+
return null;
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
return /*#__PURE__*/_jsx(ProgressBar, {
|
|
@@ -4,8 +4,7 @@ import Rating from '@mui/material/Rating';
|
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
var RatingValue = /*#__PURE__*/React.memo(function RatingValue(props) {
|
|
7
|
-
var
|
|
8
|
-
value = props.value;
|
|
7
|
+
var value = props.value;
|
|
9
8
|
return /*#__PURE__*/_jsxs(Box, {
|
|
10
9
|
sx: {
|
|
11
10
|
display: 'flex',
|
|
@@ -14,22 +13,26 @@ var RatingValue = /*#__PURE__*/React.memo(function RatingValue(props) {
|
|
|
14
13
|
color: 'text.secondary'
|
|
15
14
|
},
|
|
16
15
|
children: [/*#__PURE__*/_jsx(Rating, {
|
|
17
|
-
name: name,
|
|
18
16
|
value: value,
|
|
19
17
|
sx: {
|
|
20
18
|
mr: 1
|
|
21
19
|
},
|
|
22
20
|
readOnly: true
|
|
23
|
-
}),
|
|
21
|
+
}), " ", Math.round(Number(value) * 10) / 10]
|
|
24
22
|
});
|
|
25
23
|
});
|
|
26
24
|
export function renderRating(params) {
|
|
27
|
-
if (params.
|
|
25
|
+
if (params.value == null) {
|
|
28
26
|
return '';
|
|
27
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
28
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
32
|
+
return null;
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
return /*#__PURE__*/_jsx(RatingValue, {
|
|
32
|
-
value: params.value
|
|
33
|
-
name: params.row.id.toString()
|
|
36
|
+
value: params.value
|
|
34
37
|
});
|
|
35
38
|
}
|
|
@@ -33,8 +33,14 @@ var TotalPrice = /*#__PURE__*/React.memo(function TotalPrice(props) {
|
|
|
33
33
|
});
|
|
34
34
|
});
|
|
35
35
|
export function renderTotalPrice(params) {
|
|
36
|
-
if (params.
|
|
36
|
+
if (params.value == null) {
|
|
37
37
|
return '';
|
|
38
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
39
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
43
|
+
return null;
|
|
38
44
|
}
|
|
39
45
|
|
|
40
46
|
return /*#__PURE__*/_jsx(TotalPrice, {
|
|
@@ -44,6 +44,7 @@ export const getCommodityColumns = (editable = false) => [{
|
|
|
44
44
|
generateData: generateFilledQuantity,
|
|
45
45
|
renderCell: renderProgress,
|
|
46
46
|
renderEditCell: renderEditProgress,
|
|
47
|
+
availableAggregationFunctions: ['min', 'max', 'avg', 'size'],
|
|
47
48
|
type: 'number',
|
|
48
49
|
width: 120,
|
|
49
50
|
editable
|
|
@@ -9,10 +9,16 @@ export const getEmployeeColumns = () => [{
|
|
|
9
9
|
}, {
|
|
10
10
|
field: 'avatar',
|
|
11
11
|
headerName: 'Avatar',
|
|
12
|
-
sortable: false,
|
|
13
12
|
generateData: randomColor,
|
|
14
13
|
renderCell: renderAvatar,
|
|
14
|
+
valueGetter: params => params.rowNode.isAutoGenerated ? null : {
|
|
15
|
+
name: params.row.name,
|
|
16
|
+
color: params.row.avatar
|
|
17
|
+
},
|
|
18
|
+
sortable: false,
|
|
15
19
|
filterable: false,
|
|
20
|
+
groupable: false,
|
|
21
|
+
aggregable: false,
|
|
16
22
|
disableExport: true
|
|
17
23
|
}, {
|
|
18
24
|
field: 'name',
|
|
@@ -20,14 +26,18 @@ export const getEmployeeColumns = () => [{
|
|
|
20
26
|
generateData: randomName,
|
|
21
27
|
dataGeneratorUniquenessEnabled: true,
|
|
22
28
|
width: 120,
|
|
23
|
-
editable: true
|
|
29
|
+
editable: true,
|
|
30
|
+
groupable: false,
|
|
31
|
+
aggregable: false
|
|
24
32
|
}, {
|
|
25
33
|
field: 'website',
|
|
26
34
|
headerName: 'Website',
|
|
27
35
|
generateData: randomUrl,
|
|
28
36
|
renderCell: renderLink,
|
|
29
37
|
width: 160,
|
|
30
|
-
editable: true
|
|
38
|
+
editable: true,
|
|
39
|
+
groupable: false,
|
|
40
|
+
aggregable: false
|
|
31
41
|
}, {
|
|
32
42
|
field: 'rating',
|
|
33
43
|
headerName: 'Rating',
|
|
@@ -36,7 +46,8 @@ export const getEmployeeColumns = () => [{
|
|
|
36
46
|
renderEditCell: renderEditRating,
|
|
37
47
|
width: 180,
|
|
38
48
|
type: 'number',
|
|
39
|
-
editable: true
|
|
49
|
+
editable: true,
|
|
50
|
+
availableAggregationFunctions: ['avg', 'min', 'max', 'size']
|
|
40
51
|
}, {
|
|
41
52
|
field: 'email',
|
|
42
53
|
headerName: 'Email',
|
|
@@ -111,5 +122,15 @@ export const getEmployeeColumns = () => [{
|
|
|
111
122
|
}, {
|
|
112
123
|
field: 'salary',
|
|
113
124
|
headerName: 'Salary',
|
|
114
|
-
generateData: () => randomInt(30000, 80000)
|
|
125
|
+
generateData: () => randomInt(30000, 80000),
|
|
126
|
+
type: 'number',
|
|
127
|
+
valueFormatter: ({
|
|
128
|
+
value
|
|
129
|
+
}) => {
|
|
130
|
+
if (!value || typeof value !== 'number') {
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return `${value.toLocaleString()}$`;
|
|
135
|
+
}
|
|
115
136
|
}];
|
package/modern/columns/index.js
CHANGED
package/modern/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import Avatar from '@mui/material/Avatar';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
export function renderAvatar(params) {
|
|
5
|
-
if (params.
|
|
5
|
+
if (params.value == null) {
|
|
6
6
|
return '';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
return /*#__PURE__*/_jsx(Avatar, {
|
|
10
10
|
style: {
|
|
11
|
-
backgroundColor: params.value
|
|
11
|
+
backgroundColor: params.value.color
|
|
12
12
|
},
|
|
13
|
-
children: params.
|
|
13
|
+
children: params.value.name.toUpperCase().substring(0, 1)
|
|
14
14
|
});
|
|
15
15
|
}
|
|
@@ -34,8 +34,14 @@ const Country = /*#__PURE__*/React.memo(function Country(props) {
|
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
export function renderCountry(params) {
|
|
37
|
-
if (params.
|
|
37
|
+
if (params.value == null) {
|
|
38
38
|
return '';
|
|
39
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
40
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
44
|
+
return null;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
return /*#__PURE__*/_jsx(Country, {
|
|
@@ -49,8 +49,14 @@ const ProgressBar = /*#__PURE__*/React.memo(function ProgressBar(props) {
|
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
51
|
export function renderProgress(params) {
|
|
52
|
-
if (params.
|
|
52
|
+
if (params.value == null) {
|
|
53
53
|
return '';
|
|
54
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
55
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering a progress bar.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
59
|
+
return null;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
return /*#__PURE__*/_jsx(ProgressBar, {
|
|
@@ -5,7 +5,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
const RatingValue = /*#__PURE__*/React.memo(function RatingValue(props) {
|
|
7
7
|
const {
|
|
8
|
-
name,
|
|
9
8
|
value
|
|
10
9
|
} = props;
|
|
11
10
|
return /*#__PURE__*/_jsxs(Box, {
|
|
@@ -16,22 +15,26 @@ const RatingValue = /*#__PURE__*/React.memo(function RatingValue(props) {
|
|
|
16
15
|
color: 'text.secondary'
|
|
17
16
|
},
|
|
18
17
|
children: [/*#__PURE__*/_jsx(Rating, {
|
|
19
|
-
name: name,
|
|
20
18
|
value: value,
|
|
21
19
|
sx: {
|
|
22
20
|
mr: 1
|
|
23
21
|
},
|
|
24
22
|
readOnly: true
|
|
25
|
-
}),
|
|
23
|
+
}), " ", Math.round(Number(value) * 10) / 10]
|
|
26
24
|
});
|
|
27
25
|
});
|
|
28
26
|
export function renderRating(params) {
|
|
29
|
-
if (params.
|
|
27
|
+
if (params.value == null) {
|
|
30
28
|
return '';
|
|
29
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
30
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
34
|
+
return null;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
return /*#__PURE__*/_jsx(RatingValue, {
|
|
34
|
-
value: params.value
|
|
35
|
-
name: params.row.id.toString()
|
|
38
|
+
value: params.value
|
|
36
39
|
});
|
|
37
40
|
}
|
|
@@ -34,8 +34,14 @@ const TotalPrice = /*#__PURE__*/React.memo(function TotalPrice(props) {
|
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
export function renderTotalPrice(params) {
|
|
37
|
-
if (params.
|
|
37
|
+
if (params.value == null) {
|
|
38
38
|
return '';
|
|
39
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
40
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
44
|
+
return null;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
return /*#__PURE__*/_jsx(TotalPrice, {
|
|
@@ -55,6 +55,7 @@ const getCommodityColumns = (editable = false) => [{
|
|
|
55
55
|
generateData: _services.generateFilledQuantity,
|
|
56
56
|
renderCell: _renderer.renderProgress,
|
|
57
57
|
renderEditCell: _renderer.renderEditProgress,
|
|
58
|
+
availableAggregationFunctions: ['min', 'max', 'avg', 'size'],
|
|
58
59
|
type: 'number',
|
|
59
60
|
width: 120,
|
|
60
61
|
editable
|
|
@@ -20,10 +20,16 @@ const getEmployeeColumns = () => [{
|
|
|
20
20
|
}, {
|
|
21
21
|
field: 'avatar',
|
|
22
22
|
headerName: 'Avatar',
|
|
23
|
-
sortable: false,
|
|
24
23
|
generateData: _services.randomColor,
|
|
25
24
|
renderCell: _renderer.renderAvatar,
|
|
25
|
+
valueGetter: params => params.rowNode.isAutoGenerated ? null : {
|
|
26
|
+
name: params.row.name,
|
|
27
|
+
color: params.row.avatar
|
|
28
|
+
},
|
|
29
|
+
sortable: false,
|
|
26
30
|
filterable: false,
|
|
31
|
+
groupable: false,
|
|
32
|
+
aggregable: false,
|
|
27
33
|
disableExport: true
|
|
28
34
|
}, {
|
|
29
35
|
field: 'name',
|
|
@@ -31,14 +37,18 @@ const getEmployeeColumns = () => [{
|
|
|
31
37
|
generateData: _services.randomName,
|
|
32
38
|
dataGeneratorUniquenessEnabled: true,
|
|
33
39
|
width: 120,
|
|
34
|
-
editable: true
|
|
40
|
+
editable: true,
|
|
41
|
+
groupable: false,
|
|
42
|
+
aggregable: false
|
|
35
43
|
}, {
|
|
36
44
|
field: 'website',
|
|
37
45
|
headerName: 'Website',
|
|
38
46
|
generateData: _services.randomUrl,
|
|
39
47
|
renderCell: _renderer.renderLink,
|
|
40
48
|
width: 160,
|
|
41
|
-
editable: true
|
|
49
|
+
editable: true,
|
|
50
|
+
groupable: false,
|
|
51
|
+
aggregable: false
|
|
42
52
|
}, {
|
|
43
53
|
field: 'rating',
|
|
44
54
|
headerName: 'Rating',
|
|
@@ -47,7 +57,8 @@ const getEmployeeColumns = () => [{
|
|
|
47
57
|
renderEditCell: _renderer.renderEditRating,
|
|
48
58
|
width: 180,
|
|
49
59
|
type: 'number',
|
|
50
|
-
editable: true
|
|
60
|
+
editable: true,
|
|
61
|
+
availableAggregationFunctions: ['avg', 'min', 'max', 'size']
|
|
51
62
|
}, {
|
|
52
63
|
field: 'email',
|
|
53
64
|
headerName: 'Email',
|
|
@@ -122,7 +133,17 @@ const getEmployeeColumns = () => [{
|
|
|
122
133
|
}, {
|
|
123
134
|
field: 'salary',
|
|
124
135
|
headerName: 'Salary',
|
|
125
|
-
generateData: () => (0, _services.randomInt)(30000, 80000)
|
|
136
|
+
generateData: () => (0, _services.randomInt)(30000, 80000),
|
|
137
|
+
type: 'number',
|
|
138
|
+
valueFormatter: ({
|
|
139
|
+
value
|
|
140
|
+
}) => {
|
|
141
|
+
if (!value || typeof value !== 'number') {
|
|
142
|
+
return value;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return `${value.toLocaleString()}$`;
|
|
146
|
+
}
|
|
126
147
|
}];
|
|
127
148
|
|
|
128
149
|
exports.getEmployeeColumns = getEmployeeColumns;
|
package/node/columns/index.js
CHANGED
|
@@ -28,17 +28,4 @@ Object.keys(_employees).forEach(function (key) {
|
|
|
28
28
|
return _employees[key];
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var _useKeepGroupedColumnsHidden = require("@mui/x-data-grid-premium/hooks/utils/useKeepGroupedColumnsHidden");
|
|
34
|
-
|
|
35
|
-
Object.keys(_useKeepGroupedColumnsHidden).forEach(function (key) {
|
|
36
|
-
if (key === "default" || key === "__esModule") return;
|
|
37
|
-
if (key in exports && exports[key] === _useKeepGroupedColumnsHidden[key]) return;
|
|
38
|
-
Object.defineProperty(exports, key, {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return _useKeepGroupedColumnsHidden[key];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
31
|
});
|
package/node/index.js
CHANGED
|
@@ -18,14 +18,14 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
19
|
|
|
20
20
|
function renderAvatar(params) {
|
|
21
|
-
if (params.
|
|
21
|
+
if (params.value == null) {
|
|
22
22
|
return '';
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
26
26
|
style: {
|
|
27
|
-
backgroundColor: params.value
|
|
27
|
+
backgroundColor: params.value.color
|
|
28
28
|
},
|
|
29
|
-
children: params.
|
|
29
|
+
children: params.value.name.toUpperCase().substring(0, 1)
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -50,8 +50,14 @@ const Country = /*#__PURE__*/React.memo(function Country(props) {
|
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
function renderCountry(params) {
|
|
53
|
-
if (params.
|
|
53
|
+
if (params.value == null) {
|
|
54
54
|
return '';
|
|
55
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
56
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
60
|
+
return null;
|
|
55
61
|
}
|
|
56
62
|
|
|
57
63
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Country, {
|
|
@@ -66,8 +66,14 @@ const ProgressBar = /*#__PURE__*/React.memo(function ProgressBar(props) {
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
function renderProgress(params) {
|
|
69
|
-
if (params.
|
|
69
|
+
if (params.value == null) {
|
|
70
70
|
return '';
|
|
71
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
72
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering a progress bar.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
76
|
+
return null;
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ProgressBar, {
|
|
@@ -21,7 +21,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
21
21
|
|
|
22
22
|
const RatingValue = /*#__PURE__*/React.memo(function RatingValue(props) {
|
|
23
23
|
const {
|
|
24
|
-
name,
|
|
25
24
|
value
|
|
26
25
|
} = props;
|
|
27
26
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
@@ -32,23 +31,27 @@ const RatingValue = /*#__PURE__*/React.memo(function RatingValue(props) {
|
|
|
32
31
|
color: 'text.secondary'
|
|
33
32
|
},
|
|
34
33
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Rating.default, {
|
|
35
|
-
name: name,
|
|
36
34
|
value: value,
|
|
37
35
|
sx: {
|
|
38
36
|
mr: 1
|
|
39
37
|
},
|
|
40
38
|
readOnly: true
|
|
41
|
-
}),
|
|
39
|
+
}), " ", Math.round(Number(value) * 10) / 10]
|
|
42
40
|
});
|
|
43
41
|
});
|
|
44
42
|
|
|
45
43
|
function renderRating(params) {
|
|
46
|
-
if (params.
|
|
44
|
+
if (params.value == null) {
|
|
47
45
|
return '';
|
|
46
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
47
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
51
|
+
return null;
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RatingValue, {
|
|
51
|
-
value: params.value
|
|
52
|
-
name: params.row.id.toString()
|
|
55
|
+
value: params.value
|
|
53
56
|
});
|
|
54
57
|
}
|
|
@@ -52,8 +52,14 @@ const TotalPrice = /*#__PURE__*/React.memo(function TotalPrice(props) {
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
function renderTotalPrice(params) {
|
|
55
|
-
if (params.
|
|
55
|
+
if (params.value == null) {
|
|
56
56
|
return '';
|
|
57
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
58
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
62
|
+
return null;
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TotalPrice, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-generator",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.15.0",
|
|
4
4
|
"description": "Generate fake data for demo purposes only.",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"directory": "packages/grid/x-data-grid-generator"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@babel/runtime": "^7.
|
|
22
|
+
"@babel/runtime": "^7.18.6",
|
|
23
23
|
"@mui/base": "^5.0.0-alpha.80",
|
|
24
|
-
"@mui/x-data-grid-premium": "5.
|
|
24
|
+
"@mui/x-data-grid-premium": "5.15.0",
|
|
25
25
|
"chance": "^1.1.8",
|
|
26
26
|
"clsx": "^1.2.1",
|
|
27
|
-
"lru-cache": "^7.
|
|
27
|
+
"lru-cache": "^7.13.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@mui/icons-material": "^5.4.1",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridRenderCellParams } from '@mui/x-data-grid-premium';
|
|
3
|
-
export declare function renderAvatar(params: GridRenderCellParams<
|
|
3
|
+
export declare function renderAvatar(params: GridRenderCellParams<{
|
|
4
4
|
name: string;
|
|
5
|
-
|
|
5
|
+
color: string;
|
|
6
|
+
}, any, any>): "" | JSX.Element;
|
package/renderer/renderAvatar.js
CHANGED
|
@@ -2,14 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import Avatar from '@mui/material/Avatar';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
export function renderAvatar(params) {
|
|
5
|
-
if (params.
|
|
5
|
+
if (params.value == null) {
|
|
6
6
|
return '';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
return /*#__PURE__*/_jsx(Avatar, {
|
|
10
10
|
style: {
|
|
11
|
-
backgroundColor: params.value
|
|
11
|
+
backgroundColor: params.value.color
|
|
12
12
|
},
|
|
13
|
-
children: params.
|
|
13
|
+
children: params.value.name.toUpperCase().substring(0, 1)
|
|
14
14
|
});
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridRenderCellParams } from '@mui/x-data-grid-premium';
|
|
3
3
|
import { CountryIsoOption } from '../services/static-data';
|
|
4
|
-
export declare function renderCountry(params: GridRenderCellParams<CountryIsoOption, any, any>): "" | JSX.Element;
|
|
4
|
+
export declare function renderCountry(params: GridRenderCellParams<CountryIsoOption, any, any>): "" | JSX.Element | null;
|
|
@@ -34,8 +34,14 @@ const Country = /*#__PURE__*/React.memo(function Country(props) {
|
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
export function renderCountry(params) {
|
|
37
|
-
if (params.
|
|
37
|
+
if (params.value == null) {
|
|
38
38
|
return '';
|
|
39
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
40
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
44
|
+
return null;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
return /*#__PURE__*/_jsx(Country, {
|
package/renderer/renderPnl.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridRenderCellParams } from '@mui/x-data-grid-premium';
|
|
3
|
-
export declare function renderProgress(params: GridRenderCellParams<number, any, any>): "" | JSX.Element;
|
|
3
|
+
export declare function renderProgress(params: GridRenderCellParams<number, any, any>): "" | JSX.Element | null;
|
|
@@ -49,8 +49,14 @@ const ProgressBar = /*#__PURE__*/React.memo(function ProgressBar(props) {
|
|
|
49
49
|
});
|
|
50
50
|
});
|
|
51
51
|
export function renderProgress(params) {
|
|
52
|
-
if (params.
|
|
52
|
+
if (params.value == null) {
|
|
53
53
|
return '';
|
|
54
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
55
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering a progress bar.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
59
|
+
return null;
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
return /*#__PURE__*/_jsx(ProgressBar, {
|
package/renderer/renderRating.js
CHANGED
|
@@ -5,7 +5,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
const RatingValue = /*#__PURE__*/React.memo(function RatingValue(props) {
|
|
7
7
|
const {
|
|
8
|
-
name,
|
|
9
8
|
value
|
|
10
9
|
} = props;
|
|
11
10
|
return /*#__PURE__*/_jsxs(Box, {
|
|
@@ -16,22 +15,26 @@ const RatingValue = /*#__PURE__*/React.memo(function RatingValue(props) {
|
|
|
16
15
|
color: 'text.secondary'
|
|
17
16
|
},
|
|
18
17
|
children: [/*#__PURE__*/_jsx(Rating, {
|
|
19
|
-
name: name,
|
|
20
18
|
value: value,
|
|
21
19
|
sx: {
|
|
22
20
|
mr: 1
|
|
23
21
|
},
|
|
24
22
|
readOnly: true
|
|
25
|
-
}),
|
|
23
|
+
}), " ", Math.round(Number(value) * 10) / 10]
|
|
26
24
|
});
|
|
27
25
|
});
|
|
28
26
|
export function renderRating(params) {
|
|
29
|
-
if (params.
|
|
27
|
+
if (params.value == null) {
|
|
30
28
|
return '';
|
|
29
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
30
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
34
|
+
return null;
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
return /*#__PURE__*/_jsx(RatingValue, {
|
|
34
|
-
value: params.value
|
|
35
|
-
name: params.row.id.toString()
|
|
38
|
+
value: params.value
|
|
36
39
|
});
|
|
37
40
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridRenderCellParams } from '@mui/x-data-grid-premium';
|
|
3
|
-
export declare function renderTotalPrice(params: GridRenderCellParams<number>): "" | JSX.Element;
|
|
3
|
+
export declare function renderTotalPrice(params: GridRenderCellParams<number>): "" | JSX.Element | null;
|
|
@@ -34,8 +34,14 @@ const TotalPrice = /*#__PURE__*/React.memo(function TotalPrice(props) {
|
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
36
|
export function renderTotalPrice(params) {
|
|
37
|
-
if (params.
|
|
37
|
+
if (params.value == null) {
|
|
38
38
|
return '';
|
|
39
|
+
} // If the aggregated value does not have the same unit as the other cell
|
|
40
|
+
// Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if (params.aggregation && !params.aggregation.hasCellUnit) {
|
|
44
|
+
return null;
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
return /*#__PURE__*/_jsx(TotalPrice, {
|