@mui/x-data-grid-generator 5.13.1 → 5.15.1
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 +147 -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 +3 -3
- 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,147 @@
|
|
|
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.1
|
|
7
|
+
|
|
8
|
+
_Aug 4, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 📚 New [page presenting the `apiRef`](https://mui.com/x/react-data-grid/api-object/) (#5273) @flaviendelangle
|
|
13
|
+
- ✨ Better keyboard support for start editing cells (#5511) @oliviertassinari
|
|
14
|
+
- 🌍 Improvements to different locales
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
|
|
17
|
+
### `@mui/x-data-grid@v5.15.1` / `@mui/x-data-grid-pro@v5.15.1` / `@mui/x-data-grid-premium@v5.15.1`
|
|
18
|
+
|
|
19
|
+
#### Changes
|
|
20
|
+
|
|
21
|
+
- [DataGrid] Improve start edit UX (#5511) @oliviertassinari
|
|
22
|
+
- [DataGrid] Add `initialOpen` prop to `GridEditSingleSelectCell` to allow overriding initial open state (#5645) @shapaaa
|
|
23
|
+
- [DataGrid] Forward `ref` to root element in `GridEditInputCell` (#5631) @Zenoo
|
|
24
|
+
- [DataGrid] Toggle open state when clicking on buttons in the `GridToolbar` (#5503) @cherniavskii
|
|
25
|
+
- [DataGrid] Improve German (de-DE) locale (#5586) @sebastianfrey
|
|
26
|
+
- [DataGrid] Improve Korean (ko-KR) locale (#5668) @Einere
|
|
27
|
+
- [DataGrid] Complete Italian (it-IT) locale (#5487) @mamodev
|
|
28
|
+
|
|
29
|
+
### `@mui/x-date-pickers@v5.0.0-beta.4` / `@mui/x-date-picker-pro@5.0.0-beta.4`
|
|
30
|
+
|
|
31
|
+
#### Changes
|
|
32
|
+
|
|
33
|
+
- [DatePicker] Customize day formatter in the calendar (#5373) @alexfauquette
|
|
34
|
+
|
|
35
|
+
### Docs
|
|
36
|
+
|
|
37
|
+
- [docs] New location for the legal content (#5595) @oliviertassinari
|
|
38
|
+
- [docs] Update description of `maxDateTime` prop (#5639) @jurecuhalev
|
|
39
|
+
- [docs] Add missing `date-fns` dependency when opening Codesandbox demo (#5692) @cherniavskii
|
|
40
|
+
|
|
41
|
+
### Core
|
|
42
|
+
|
|
43
|
+
- [core] Drop usage of `GRID_EXPERIMENTAL_ENABLED` env variable (#5669) @ar7casper
|
|
44
|
+
- [core] Isolate asset loading under /x/ (#5594) @oliviertassinari
|
|
45
|
+
- [core] Upgrade node to v14 (#4999) @cherniavskii
|
|
46
|
+
|
|
47
|
+
## 5.15.0
|
|
48
|
+
|
|
49
|
+
_Jul 29, 2022_
|
|
50
|
+
|
|
51
|
+
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
52
|
+
|
|
53
|
+
- 🎁 Introduce aggregation (#5592) @flaviendelangle
|
|
54
|
+
|
|
55
|
+
Premium users can now aggregate data in the grid.
|
|
56
|
+
Extract information like sum, average, count, and others with a couple of clicks.
|
|
57
|
+
|
|
58
|
+
https://user-images.githubusercontent.com/45398769/181581503-77cc412e-9d9e-4de1-8bc3-c3bccc54cdaa.mp4
|
|
59
|
+
|
|
60
|
+
To enable this feature, add `experimentalFeatures={{ aggregation: true }}`.
|
|
61
|
+
Aggregation functions are customizable and they combine well with row grouping.
|
|
62
|
+
See the [documentation](https://mui.com/x/react-data-grid/aggregation/) to explore everything it has to offer.
|
|
63
|
+
|
|
64
|
+
- 🚀 Introduce row pinning (#4863) @cherniavskii
|
|
65
|
+
|
|
66
|
+
Pro users can now pin rows on top or bottom of the grid.
|
|
67
|
+
|
|
68
|
+
https://user-images.githubusercontent.com/45398769/181581493-56c733a3-6dd5-4546-bf8d-3f2dff72b14a.mp4
|
|
69
|
+
|
|
70
|
+
To do so, enable the feature with `experimentalFeatures={{ rowPinning: true }}` and provide the pinned rows data to the `pinnedRows` prop.
|
|
71
|
+
For more details, see the [documentation](https://mui.com/x/react-data-grid/row-pinning/).
|
|
72
|
+
|
|
73
|
+
- 🌍 Add simplified Chinese (zh-CN) locale to pickers (#5584) @gamecss
|
|
74
|
+
- 📚 Documentation improvements
|
|
75
|
+
|
|
76
|
+
### `@mui/x-data-grid@v5.15.0` / `@mui/x-data-grid-pro@v5.15.0` / `@mui/x-data-grid-premium@v5.15.0`
|
|
77
|
+
|
|
78
|
+
#### Changes
|
|
79
|
+
|
|
80
|
+
- [DataGrid] Add prop to keep modifications while processing props (#5309) @m4theushw
|
|
81
|
+
- [DataGrid] Fix container width change on React 18 (#5566) @m4theushw
|
|
82
|
+
- [DataGrid] Fix ellipsis style convention (#5587) @oliviertassinari
|
|
83
|
+
- [DataGridPro] Implement row pinning (#4863) @cherniavskii
|
|
84
|
+
- [DataGridPremium] Make aggregation public (#5592) @cherniavskii
|
|
85
|
+
- [l10n] Improve simplified Chinese (zh-CN) locale (#5584) @gamecss
|
|
86
|
+
|
|
87
|
+
### `@mui/x-date-pickers@v5.0.0-beta.3` / `@mui/x-date-picker-pro@5.0.0-beta.3`
|
|
88
|
+
|
|
89
|
+
#### Changes
|
|
90
|
+
|
|
91
|
+
- [l10n] Add simplified Chinese (zh-CN) locale (#5584) @gamecss
|
|
92
|
+
|
|
93
|
+
### Docs
|
|
94
|
+
|
|
95
|
+
- [docs] Split docs page about rows (#5195) @flaviendelangle
|
|
96
|
+
- [docs] Add warning clarifications (#5399) @alexfauquette
|
|
97
|
+
- [docs] Correct slot CSS classes for Pro and Premium components (#5452) @alexfauquette
|
|
98
|
+
- [docs] Fix internal link to `valueParser` (#5450) @alexfauquette
|
|
99
|
+
|
|
100
|
+
### Core
|
|
101
|
+
|
|
102
|
+
- [core] Upgrade monorepo (#5560) @m4theushw
|
|
103
|
+
|
|
104
|
+
## 5.14.0
|
|
105
|
+
|
|
106
|
+
_Jul 21, 2022_
|
|
107
|
+
|
|
108
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
109
|
+
|
|
110
|
+
- 🧪 Export `GridBooleanCell` component from data grid (#5537) @cliedeman
|
|
111
|
+
- ⚙️ Improve accessibility of the Export menu (#5486) @nogalpaulina
|
|
112
|
+
- 🌍 Improvements to different locales
|
|
113
|
+
- 📚 Documentation improvements
|
|
114
|
+
- 🐞 Bugfixes
|
|
115
|
+
|
|
116
|
+
### `@mui/x-data-grid@5.14.0` / `@mui/x-data-grid-pro@5.14.0` / `@mui/x-data-grid-premium@5.14.0`
|
|
117
|
+
|
|
118
|
+
#### Changes
|
|
119
|
+
|
|
120
|
+
- [DataGrid] Add generics to `GridPreProcessEditCellProps` (#5510) @YunosukeY
|
|
121
|
+
- [DataGrid] Avoid inconsistent state export (#5390) @flaviendelangle
|
|
122
|
+
- [DataGrid] Export `GridBooleanCell` component (#5537) @cliedeman
|
|
123
|
+
- [DataGrid] Fix `date`/`dateTime` edit input font size to match view mode (#5304) @cherniavskii
|
|
124
|
+
- [DataGrid] Fix loading overlay position (#5558) @DanailH
|
|
125
|
+
- [DataGrid] Improve accessibility of the Export menu in the toolbar (#5486) @nogalpaulina
|
|
126
|
+
- [DataGridPremium] Implement Aggregation - not publicly released (#4208) @flaviendelangle
|
|
127
|
+
- [DataGridPremium] Fix crash when exporting all columns to Excel (#5425) @cherniavskii
|
|
128
|
+
- [l10n] Add Traditional Chinese (zh-TW) locale (#5498) @happyincent
|
|
129
|
+
|
|
130
|
+
### `@mui/x-date-pickers@v5.0.0-beta.2` / `@mui/x-date-picker-pro@5.0.0-beta.2`
|
|
131
|
+
|
|
132
|
+
#### Changes
|
|
133
|
+
|
|
134
|
+
- [l10n] Add Norwegian (nb-NO) locale (#5475) @elkebab
|
|
135
|
+
|
|
136
|
+
### Docs
|
|
137
|
+
|
|
138
|
+
- [docs] New page presenting the `apiRef` (#5273) @flaviendelangle
|
|
139
|
+
- [docs] Remove blank line @oliviertassinari
|
|
140
|
+
|
|
141
|
+
### Core
|
|
142
|
+
|
|
143
|
+
- [core] Add missing comments on zh-TW translation (#5559) @flaviendelangle
|
|
144
|
+
- [core] Polish on the bug issue template (#5525) @oliviertassinari
|
|
145
|
+
- [test] Add more tests related to `isPrintableKey` (#5458) @mnajdova
|
|
146
|
+
|
|
6
147
|
## 5.13.1
|
|
7
148
|
|
|
8
149
|
_Jul 15, 2022_
|
|
@@ -263,7 +404,7 @@ _May 31, 2022_
|
|
|
263
404
|
|
|
264
405
|
We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
|
|
265
406
|
|
|
266
|
-
- 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/
|
|
407
|
+
- 🎁 Introduce support for [dynamic row height](https://mui.com/x/react-data-grid/row-height/#dynamic-row-height) (#4859) @m4theushw
|
|
267
408
|
|
|
268
409
|
<img src="https://user-images.githubusercontent.com/42154031/171183167-718d7bcd-ec0f-459e-97fe-0f650abb4a99.gif" width="800">
|
|
269
410
|
|
|
@@ -580,7 +721,7 @@ _Apr 25, 2022_
|
|
|
580
721
|
|
|
581
722
|
We'd like to offer a big thanks to the 6 contributors who made this release possible. Here are some highlights ✨:
|
|
582
723
|
|
|
583
|
-
- 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/
|
|
724
|
+
- 🎁 Introduce [Row reorder](https://mui.com/x/react-data-grid/row-ordering/) (#4034) @DanailH
|
|
584
725
|
|
|
585
726
|
<img src="https://user-images.githubusercontent.com/5858539/165091263-23472fbb-a989-44b8-849a-d2185adfe13b.gif" width="800">
|
|
586
727
|
|
|
@@ -844,7 +985,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
|
|
|
844
985
|
<DataGrid getRowSpacing={() => ({ top: 10, bottom: 10 })} />
|
|
845
986
|
```
|
|
846
987
|
|
|
847
|
-
Check the [documentation](https://mui.com/x/react-data-grid/
|
|
988
|
+
Check the [documentation](https://mui.com/x/react-data-grid/row-height/#row-spacing) for more information.
|
|
848
989
|
|
|
849
990
|
### `@mui/x-data-grid@v5.6.1` / `@mui/x-data-grid-pro@v5.6.1`
|
|
850
991
|
|
|
@@ -1098,7 +1239,7 @@ _Jan 28, 2022_
|
|
|
1098
1239
|
|
|
1099
1240
|
A big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
1100
1241
|
|
|
1101
|
-
- 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/
|
|
1242
|
+
- 🚣 Introduce [variable row height](https://mui.com/x/react-data-grid/row-height/#variable-row-height) (#438) @DanailH
|
|
1102
1243
|
|
|
1103
1244
|
Allows for setting a row-specific height.
|
|
1104
1245
|
By default, all rows have the same height, but now you can set the height on a per-row basis.
|
|
@@ -1466,7 +1607,7 @@ A big thanks to the 5 contributors who made this release possible. Here are some
|
|
|
1466
1607
|
- [core] Fix `yarn prettier` script (#3292) @oliviertassinari
|
|
1467
1608
|
- [core] Improve tests for Tree Data (#3366) @flaviendelangle
|
|
1468
1609
|
- [core] Never import directly from the `__modules__` folder in the `x-data-grid-generator` package (#3379) @flaviendelangle
|
|
1469
|
-
- [core] Transition to a new
|
|
1610
|
+
- [core] Transition to a new Stack Overflow tag (#3308) @oliviertassinari
|
|
1470
1611
|
- [core] Update monorepo (#3370) @flaviendelangle
|
|
1471
1612
|
- [core] Use pre-processors for sorting and filtering (#3318) @flaviendelangle
|
|
1472
1613
|
- [test] Replace `useFakeTimers` (#3323) @m4theushw
|
|
@@ -3750,7 +3891,7 @@ Big thanks to the 7 contributors who made this release possible. Here are some h
|
|
|
3750
3891
|
- 🎁 Add `onRowsScrollEnd` to support infinite loading (#1199) @DanailH
|
|
3751
3892
|
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.
|
|
3752
3893
|
|
|
3753
|
-
See the documentation for [more details](https://mui.com/x/react-data-grid/
|
|
3894
|
+
See the documentation for [more details](https://mui.com/x/react-data-grid/row-updates/#infinite-loading).
|
|
3754
3895
|
|
|
3755
3896
|
- 🕹 Provide the ability to sort by multiple columns using Shift+click (#1203) @dtassone
|
|
3756
3897
|
- 🇵🇱 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.1",
|
|
4
4
|
"description": "Generate fake data for demo purposes only.",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
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.1",
|
|
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, {
|