@mui/x-data-grid 6.0.0-beta.0 → 6.0.0-beta.2
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 +186 -5
- package/components/GridAutoSizer.js +1 -1
- package/components/cell/GridCell.js +3 -1
- package/components/panel/GridColumnsPanel.js +13 -4
- package/hooks/features/export/useGridPrintExport.js +7 -3
- package/hooks/features/rows/useGridRowsMeta.js +19 -4
- package/hooks/features/virtualization/useGridVirtualScroller.js +21 -7
- package/index.js +1 -1
- package/legacy/components/GridAutoSizer.js +1 -1
- package/legacy/components/cell/GridCell.js +3 -1
- package/legacy/components/panel/GridColumnsPanel.js +13 -8
- package/legacy/hooks/features/export/useGridPrintExport.js +7 -3
- package/legacy/hooks/features/rows/useGridRowsMeta.js +19 -4
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +21 -11
- package/legacy/index.js +1 -1
- package/legacy/lib/createDetectElementResize/index.js +5 -5
- package/legacy/locales/beBY.js +156 -0
- package/legacy/locales/coreLocales.js +62 -0
- package/legacy/locales/esES.js +18 -18
- package/legacy/locales/frFR.js +1 -1
- package/legacy/locales/index.js +2 -0
- package/legacy/locales/jaJP.js +16 -20
- package/legacy/locales/skSK.js +7 -9
- package/legacy/locales/urPK.js +134 -0
- package/legacy/locales/viVN.js +21 -23
- package/lib/createDetectElementResize/index.js +5 -5
- package/locales/beBY.d.ts +2 -0
- package/locales/beBY.js +144 -0
- package/locales/coreLocales.d.ts +3 -0
- package/locales/coreLocales.js +60 -0
- package/locales/esES.js +14 -18
- package/locales/frFR.js +1 -1
- package/locales/index.d.ts +2 -0
- package/locales/index.js +2 -0
- package/locales/jaJP.js +16 -20
- package/locales/skSK.js +7 -9
- package/locales/urPK.d.ts +2 -0
- package/locales/urPK.js +122 -0
- package/locales/viVN.js +17 -23
- package/modern/components/GridAutoSizer.js +1 -1
- package/modern/components/cell/GridCell.js +3 -1
- package/modern/components/panel/GridColumnsPanel.js +13 -4
- package/modern/hooks/features/export/useGridPrintExport.js +7 -3
- package/modern/hooks/features/rows/useGridRowsMeta.js +19 -4
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +20 -6
- package/modern/index.js +1 -1
- package/modern/lib/createDetectElementResize/index.js +5 -5
- package/modern/locales/beBY.js +144 -0
- package/modern/locales/coreLocales.js +60 -0
- package/modern/locales/esES.js +14 -18
- package/modern/locales/frFR.js +1 -1
- package/modern/locales/index.js +2 -0
- package/modern/locales/jaJP.js +16 -20
- package/modern/locales/skSK.js +7 -9
- package/modern/locales/urPK.js +122 -0
- package/modern/locales/viVN.js +17 -23
- package/node/components/GridAutoSizer.js +1 -1
- package/node/components/cell/GridCell.js +3 -1
- package/node/components/panel/GridColumnsPanel.js +13 -4
- package/node/hooks/features/export/useGridPrintExport.js +7 -3
- package/node/hooks/features/rows/useGridRowsMeta.js +20 -5
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +20 -6
- package/node/index.js +1 -1
- package/node/lib/createDetectElementResize/index.js +5 -5
- package/node/locales/beBY.js +151 -0
- package/node/locales/coreLocales.js +68 -0
- package/node/locales/esES.js +14 -18
- package/node/locales/frFR.js +1 -1
- package/node/locales/index.js +22 -0
- package/node/locales/jaJP.js +16 -20
- package/node/locales/skSK.js +7 -9
- package/node/locales/urPK.js +129 -0
- package/node/locales/viVN.js +17 -23
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,124 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.0.0-beta.2
|
|
7
|
+
|
|
8
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
9
|
+
|
|
10
|
+
- 🚀 Support week day formats in the field components
|
|
11
|
+
- 🌍 Add Hungarian (hu-HU) and Urdu (ur-PK) locales
|
|
12
|
+
- 🌍 Improve French (fr-FR) and Italian (it-IT) locales
|
|
13
|
+
- ✨ New codemods for migrating to v6
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
- 🐞 Bug fixes
|
|
16
|
+
|
|
17
|
+
### `@mui/x-data-grid@v6.0.0-beta.2` / `@mui/x-data-grid-pro@v6.0.0-beta.2` / `@mui/x-data-grid-premium@v6.0.0-beta.2`
|
|
18
|
+
|
|
19
|
+
#### Changes
|
|
20
|
+
|
|
21
|
+
- [DataGrid] Handle non-numeric values returned by `getRowHeight` prop (#7703) @cherniavskii
|
|
22
|
+
- [DataGrid] Merge row styles with `componentsProps.row.style` (#7641) @marktoman
|
|
23
|
+
- [l10n] Add Hungarian (hu-HU) locale (#7776) @noherczeg
|
|
24
|
+
- [l10n] Add Urdu (ur-PK) locale (#6866) @MBilalShafi
|
|
25
|
+
- [l10n] Improve French (fr-FR) locale (#7777) @Vivek-Prajapatii
|
|
26
|
+
- [l10n] Improve Italian (it-IT) locale (#7761) @simonecervini
|
|
27
|
+
|
|
28
|
+
### `@mui/x-date-pickers@v6.0.0-beta.2` / `@mui/x-date-pickers-pro@v6.0.0-beta.2`
|
|
29
|
+
|
|
30
|
+
#### Changes
|
|
31
|
+
|
|
32
|
+
- [fields] Support week day formats (#7392) @flaviendelangle
|
|
33
|
+
- [pickers] Allow to initialize and control the `rangePosition` on all range components (#7764) @flaviendelangle
|
|
34
|
+
- [pickers] Fix theme augmentation (#7800) @LukasTy
|
|
35
|
+
- [pickers] Hide scrollbars in the date calendar container (#7766) @Vivek-Prajapatii
|
|
36
|
+
- [pickers] Remove the dependency on `rifm` (#7785) @alexfauquette
|
|
37
|
+
|
|
38
|
+
### `@mui/x-codemod@v6.0.0-beta.2`
|
|
39
|
+
|
|
40
|
+
#### Changes
|
|
41
|
+
|
|
42
|
+
- [codemod] Add pickers `rename-default-toolbar-title-localeText` codemod (#7752) @LukasTy
|
|
43
|
+
- [codemod] Add pickers `rename-inputFormat-prop` codemod (#7736) @LukasTy
|
|
44
|
+
|
|
45
|
+
### Docs
|
|
46
|
+
|
|
47
|
+
- [docs] Fix a typo in data grid layout page (#7113) @sfbaker7
|
|
48
|
+
- [docs] Fix require context path to avoid duplicate key creation (#7781) @LukasTy
|
|
49
|
+
- [docs] Polish pickers migration docs (#7737) @LukasTy
|
|
50
|
+
- [docs] Rename `next` translation docs and remove duplicates with `-next` (#7729) @LukasTy
|
|
51
|
+
|
|
52
|
+
### Core
|
|
53
|
+
|
|
54
|
+
- [core] Fix l10n data file (#7804) @flaviendelangle
|
|
55
|
+
- [core] Fix Next.js warning (#7754) @oliviertassinari
|
|
56
|
+
- [core] Remove unused demos (#7758) @flaviendelangle
|
|
57
|
+
|
|
58
|
+
## 6.0.0-beta.1
|
|
59
|
+
|
|
60
|
+
_Jan 27, 2023_
|
|
61
|
+
|
|
62
|
+
We'd like to offer a big thanks to the 17 contributors who made this release possible. Here are some highlights ✨:
|
|
63
|
+
|
|
64
|
+
- 🚀 New shortcuts component for the date pickers (#7154) @alexfauquette
|
|
65
|
+
- 🌍 Add Belarusian (be-BY), Czech (cs-CZ) and Russian (ru-RU) locales
|
|
66
|
+
- 🌍 Improve Spanish (es-ES), Japanese (ja-JP), Slovak (sk-SK), and Vietnamese (vi-VN) locales
|
|
67
|
+
- ✨ New codemods for migrating to v6
|
|
68
|
+
- 📚 Documentation improvements
|
|
69
|
+
- 🐞 Bug fixes
|
|
70
|
+
|
|
71
|
+
### `@mui/x-data-grid@v6.0.0-beta.1` / `@mui/x-data-grid-pro@v6.0.0-beta.1` / `@mui/x-data-grid-premium@v6.0.0-beta.1`
|
|
72
|
+
|
|
73
|
+
#### Changes
|
|
74
|
+
|
|
75
|
+
- [DataGrid] Add `title` attribute to cells (#7682) @thupi
|
|
76
|
+
- [DataGrid] Fix `autoHeight` not working properly inside of a flex container (#7701) @cherniavskii
|
|
77
|
+
- [DataGrid] Fix grid state not being updated after print preview is closed (#7642) @cherniavskii
|
|
78
|
+
- [DataGrid] Fix non-hideable columns visibility toggling (#7637) @cherniavskii
|
|
79
|
+
- [DataGrid] Fix scrolling on resize for data grids inside shadow root (#7298) @akiradev
|
|
80
|
+
- [l10n] Add Slovak (sk-SK) translation for aggregation functions (#7702) @msidlo
|
|
81
|
+
- [l10n] Add missing core locales for `MuiTablePagination` (#7717) @MBilalShafi
|
|
82
|
+
- [l10n] Improve Spanish (es-ES) and Vietnamese (vi-VN) locale (#7634) @WiXSL and @SpacerZ
|
|
83
|
+
- [l10n] Add Belarusian (be-BY) locale (#7646) @volhalink
|
|
84
|
+
|
|
85
|
+
### `@mui/x-date-pickers@v6.0.0-beta.1` / `@mui/x-date-pickers-pro@v6.0.0-beta.1`
|
|
86
|
+
|
|
87
|
+
#### Changes
|
|
88
|
+
|
|
89
|
+
- [pickers] Fix `aria-labelledby` assignment to dialog (#7608) @LukasTy
|
|
90
|
+
- [pickers] Support `UTC` with `dayjs` (#7610) @flaviendelangle
|
|
91
|
+
- [pickers] Update focus when opening a UI view (#7620) @alexfauquette
|
|
92
|
+
- [DateRangePickers] Add shortcuts component (#7154) @alexfauquette
|
|
93
|
+
- [l10n] Add Czech (cs-CZ) locale (#7645) @OndrejHj04
|
|
94
|
+
- [l10n] Add Russian (ru-RU) locale (#7706) @rstmzh
|
|
95
|
+
- [l10n] Improve Japanese (ja-JP) locale (#7624) @makoto14
|
|
96
|
+
|
|
97
|
+
### `@mui/x-codemod@v6.0.0-beta.1`
|
|
98
|
+
|
|
99
|
+
#### Changes
|
|
100
|
+
|
|
101
|
+
- [codemod] Add pickers `replace-toolbar-props-by-slot` codemod (#7687) @alexfauquette
|
|
102
|
+
- [codemod] Add `GridColumnMenuItemProps` to `column-menu-components-rename` codemod (#7710) @MBilalShafi
|
|
103
|
+
- [codemod] Add `headerHeight` prop update to `row-selection-props-rename` codemod (#7711) @MBilalShafi
|
|
104
|
+
- [codemod] Add pickers codemod for `components` to `slots` renaming (#7533) @alexfauquette
|
|
105
|
+
- [codemod] Add pickers `migrate-to-components-componentsProps` and `replace-arrows-button-slot` codemods (#7698) @alexfauquette
|
|
106
|
+
- [codemod] Add data grid codemod renaming `rowsPerPageOptions` prop to `pageSizeOptions` (#7603) @MBilalShafi
|
|
107
|
+
- [codemod] Add pickers `rename-should-disable-time` codemod (#7709) @alexfauquette
|
|
108
|
+
- [codemod] Add data grid `row-selection-props-rename` codemod (#7485) @MBilalShafi
|
|
109
|
+
- [codemod] Add data grid `rename-selectors-and-events` codemod (#7699) @MBilalShafi
|
|
110
|
+
- [codemod] Add pickers `replace-tabs-props` codemod (#7639) @alexfauquette
|
|
111
|
+
|
|
112
|
+
### Docs
|
|
113
|
+
|
|
114
|
+
- [docs] Add info callout about available component `slots` (#7714) @Vivek-Prajapatii
|
|
115
|
+
- [docs] Add recipe for pinning grouped column (#7712) @MBilalShafi
|
|
116
|
+
- [docs] Fix 404 links to picker API page @oliviertassinari
|
|
117
|
+
- [docs] Update `DemoContainer` `components` prop using a codemod (#7574) @alexfauquette
|
|
118
|
+
|
|
119
|
+
### Core
|
|
120
|
+
|
|
121
|
+
- [core] Fix `innerslotProps` typo (#7697) @LukasTy
|
|
122
|
+
- [core] Upgrade monorepo (#7676) @cherniavskii
|
|
123
|
+
|
|
6
124
|
## 6.0.0-beta.0
|
|
7
125
|
|
|
8
126
|
_Jan 19, 2023_
|
|
@@ -342,7 +460,7 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
|
|
|
342
460
|
```diff
|
|
343
461
|
<DateTimePicker
|
|
344
462
|
- shouldDisableTime={(timeValue, view) => view === 'hours' && timeValue < 12}
|
|
345
|
-
+ shouldDisableTime={(
|
|
463
|
+
+ shouldDisableTime={(value, view) => view === 'hours' && value.hour() < 12}
|
|
346
464
|
/>
|
|
347
465
|
```
|
|
348
466
|
|
|
@@ -1302,8 +1420,7 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
|
|
|
1302
1420
|
- The toolbar related translation keys have been renamed to better fit their usage:
|
|
1303
1421
|
|
|
1304
1422
|
```diff
|
|
1305
|
-
|
|
1306
|
-
<DatePicker
|
|
1423
|
+
<LocalizationProvider
|
|
1307
1424
|
localeText={{
|
|
1308
1425
|
- datePickerDefaultToolbarTitle: 'Date Picker',
|
|
1309
1426
|
+ datePickerToolbarTitle: 'Date Picker',
|
|
@@ -1426,7 +1543,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
|
|
|
1426
1543
|
// TimePicker, MobileTimePicker, DateRangePicker and MobileDateRangePicker.
|
|
1427
1544
|
<DatePicker
|
|
1428
1545
|
- DialogProps={{ backgroundColor: 'red' }}
|
|
1429
|
-
+ componentsProps={{ dialog: { backgroundColor: 'red }}}
|
|
1546
|
+
+ componentsProps={{ dialog: { backgroundColor: 'red' }}}
|
|
1430
1547
|
/>
|
|
1431
1548
|
```
|
|
1432
1549
|
|
|
@@ -1437,7 +1554,7 @@ We'd like to offer a big thanks to the 8 contributors who made this release poss
|
|
|
1437
1554
|
// TimePicker, DesktopTimePicker, DateRangePicker and DesktopDateRangePicker.
|
|
1438
1555
|
<DatePicker
|
|
1439
1556
|
- PaperProps={{ backgroundColor: 'red' }}
|
|
1440
|
-
+ componentsProps={{ desktopPaper: { backgroundColor: 'red }}}
|
|
1557
|
+
+ componentsProps={{ desktopPaper: { backgroundColor: 'red' }}}
|
|
1441
1558
|
/>
|
|
1442
1559
|
```
|
|
1443
1560
|
|
|
@@ -1956,6 +2073,70 @@ You can find more information about the new api, including how to set those tran
|
|
|
1956
2073
|
- [test] Skip tests for column pinning and dynamic row height (#5997) @m4theushw
|
|
1957
2074
|
- [website] Improve security header @oliviertassinari
|
|
1958
2075
|
|
|
2076
|
+
## 5.17.22
|
|
2077
|
+
|
|
2078
|
+
_Feb 2, 2023_
|
|
2079
|
+
|
|
2080
|
+
We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
2081
|
+
|
|
2082
|
+
- 🌍 Add Urdu (ur-PK) locale
|
|
2083
|
+
- 🌍 Improve French (fr-FR) and Italian (it-IT) locales
|
|
2084
|
+
- 🐞 Bugfixes
|
|
2085
|
+
|
|
2086
|
+
### `@mui/x-data-grid@v5.17.22` / `@mui/x-data-grid-pro@v5.17.22` / `@mui/x-data-grid-premium@v5.17.22`
|
|
2087
|
+
|
|
2088
|
+
#### Changes
|
|
2089
|
+
|
|
2090
|
+
- [DataGrid] Fix an error when deleting pinned row using the buttons in the `actions` column (#7767) @cherniavskii
|
|
2091
|
+
- [DataGrid] Fix print preview regression in Chrome browser (#7405) @cherniavskii
|
|
2092
|
+
- [l10n] Add Urdu (ur-PK) locale (#7778) @MBilalShafi
|
|
2093
|
+
- [l10n] Improve French (fr-FR) locale (#7795) @Vivek-Prajapatii
|
|
2094
|
+
|
|
2095
|
+
### `@mui/x-date-pickers@v5.0.17` / `@mui/x-date-pickers-pro@v5.0.17`
|
|
2096
|
+
|
|
2097
|
+
#### Changes
|
|
2098
|
+
|
|
2099
|
+
- [TimePicker] Add missing `themeAugmentation` entry (#7732) @LukasTy
|
|
2100
|
+
- [l10n] Improve Italian (it-IT) locale (#7761) @simonecervini
|
|
2101
|
+
|
|
2102
|
+
## 5.17.21
|
|
2103
|
+
|
|
2104
|
+
_Jan 27, 2023_
|
|
2105
|
+
|
|
2106
|
+
We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
2107
|
+
|
|
2108
|
+
- 🌍 Add Belarusian (be-BY), Czech (cs-CZ), and Russian (ru-RU) locales
|
|
2109
|
+
- 🌍 Improve Slovak (sk-SK), Japanese (ja-JP), Vietnamese (vi-VN), and Spanish (es-ES) locales
|
|
2110
|
+
- 🐞 Bugfixes
|
|
2111
|
+
|
|
2112
|
+
### `@mui/x-data-grid@v5.17.21` / `@mui/x-data-grid-pro@v5.17.21` / `@mui/x-data-grid-premium@v5.17.21`
|
|
2113
|
+
|
|
2114
|
+
#### Changes
|
|
2115
|
+
|
|
2116
|
+
- [DataGrid] Add `title` attribute to cells (#7695) @thupi
|
|
2117
|
+
- [DataGrid] Fix grid state not being updated after print preview is closed (#7680) @cherniavskii
|
|
2118
|
+
- [DataGrid] Fix non-hideable columns visibility toggling (#7716) @cherniavskii
|
|
2119
|
+
- [DataGrid] Fix scrolling on resize for data grids inside shadow root (#7722) @cherniavskii
|
|
2120
|
+
- [DataGridPremium] Create aggregation footer row with `isAutoGenerated: true` (#7681) @m4theushw
|
|
2121
|
+
- [l10n] Add Belarusian (be-BY) locale (#7718) @volhalink
|
|
2122
|
+
- [l10n] Add Slovak (sk-SK) translation for aggregation functions (#7690) @msidlo
|
|
2123
|
+
- [l10n] Add missing core locales for `MuiTablePagination` (#7719) @MBilalShafi
|
|
2124
|
+
- [l10n] Improve Japanese (ja-JP) locale (#7627) @makoto14
|
|
2125
|
+
- [l10n] Improve Vietnamese (vi-VN) locale (#7601) @SpacerZ
|
|
2126
|
+
|
|
2127
|
+
### `@mui/x-date-pickers@v5.0.16` / `@mui/x-date-pickers-pro@v5.0.16`
|
|
2128
|
+
|
|
2129
|
+
#### Changes
|
|
2130
|
+
|
|
2131
|
+
- [pickers] Add missing components to `themeAugmentation` (#7677) @LukasTy
|
|
2132
|
+
- [l10n] Add Czech (cs-CZ) locale (#7666) @OndrejHj04
|
|
2133
|
+
- [l10n] Add Russian (ru-RU) locale (#7708) @rstmzh
|
|
2134
|
+
- [l10n] Improve Spanish (es-ES) locale (#7614) @WiXSL
|
|
2135
|
+
|
|
2136
|
+
### Docs
|
|
2137
|
+
|
|
2138
|
+
- [docs] Add info callout about available component `slots` (#7723) @Vivek-Prajapatii
|
|
2139
|
+
|
|
1959
2140
|
## 5.17.20
|
|
1960
2141
|
|
|
1961
2142
|
_Jan 19, 2023_
|
|
@@ -73,7 +73,7 @@ const GridAutoSizer = /*#__PURE__*/React.forwardRef(function AutoSizer(props, re
|
|
|
73
73
|
ref: handleRef,
|
|
74
74
|
style: _extends({
|
|
75
75
|
flex: disableHeight ? 0 : '1 1 0px',
|
|
76
|
-
overflow: 'auto'
|
|
76
|
+
overflow: disableHeight ? 'visible' : 'auto'
|
|
77
77
|
}, style)
|
|
78
78
|
}, other, {
|
|
79
79
|
children: state.height === null && state.width === null ? null : children
|
|
@@ -156,9 +156,11 @@ function GridCell(props) {
|
|
|
156
156
|
const managesOwnFocus = column.type === 'actions';
|
|
157
157
|
const renderChildren = () => {
|
|
158
158
|
if (children === undefined) {
|
|
159
|
+
const valueString = valueToRender == null ? void 0 : valueToRender.toString();
|
|
159
160
|
return /*#__PURE__*/_jsx("div", {
|
|
160
161
|
className: classes.content,
|
|
161
|
-
|
|
162
|
+
title: valueString,
|
|
163
|
+
children: valueString
|
|
162
164
|
});
|
|
163
165
|
}
|
|
164
166
|
if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
|
|
@@ -96,10 +96,19 @@ function GridColumnsPanel(props) {
|
|
|
96
96
|
apiRef.current.setColumnVisibility(field, columnVisibilityModel[field] === false);
|
|
97
97
|
};
|
|
98
98
|
const toggleAllColumns = React.useCallback(isVisible => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
const currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
100
|
+
const newModel = _extends({}, currentModel);
|
|
101
|
+
columns.forEach(col => {
|
|
102
|
+
if (col.hideable) {
|
|
103
|
+
if (isVisible) {
|
|
104
|
+
// delete the key from the model instead of setting it to `true`
|
|
105
|
+
delete newModel[col.field];
|
|
106
|
+
} else {
|
|
107
|
+
newModel[col.field] = false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
103
112
|
}, [apiRef, columns]);
|
|
104
113
|
const handleSearchValueChange = React.useCallback(event => {
|
|
105
114
|
setSearchValue(event.target.value);
|
|
@@ -203,9 +203,13 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
203
203
|
} else {
|
|
204
204
|
printWindow.onload = () => {
|
|
205
205
|
handlePrintWindowLoad(printWindow, options);
|
|
206
|
-
printWindow.contentWindow.
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
const mediaQueryList = printWindow.contentWindow.matchMedia('print');
|
|
207
|
+
mediaQueryList.addEventListener('change', mql => {
|
|
208
|
+
const isAfterPrint = mql.matches === false;
|
|
209
|
+
if (isAfterPrint) {
|
|
210
|
+
handlePrintWindowAfterPrint(printWindow);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
209
213
|
};
|
|
210
214
|
doc.current.body.appendChild(printWindow);
|
|
211
215
|
}
|
|
@@ -10,12 +10,26 @@ import { gridPaginationSelector } from '../pagination/gridPaginationSelector';
|
|
|
10
10
|
import { gridSortModelSelector } from '../sorting/gridSortingSelector';
|
|
11
11
|
import { useGridRegisterPipeApplier } from '../../core/pipeProcessing';
|
|
12
12
|
import { gridPinnedRowsSelector } from './gridRowsSelector';
|
|
13
|
+
import { DATA_GRID_PROPS_DEFAULT_VALUES } from '../../../DataGrid/useDataGridProps';
|
|
13
14
|
export const rowsMetaStateInitializer = state => _extends({}, state, {
|
|
14
15
|
rowsMeta: {
|
|
15
16
|
currentPageTotalHeight: 0,
|
|
16
17
|
positions: []
|
|
17
18
|
}
|
|
18
19
|
});
|
|
20
|
+
let warnedOnceInvalidRowHeight = false;
|
|
21
|
+
const getValidRowHeight = (rowHeightProp, defaultRowHeight, warningMessage) => {
|
|
22
|
+
if (typeof rowHeightProp === 'number' && rowHeightProp > 0) {
|
|
23
|
+
return rowHeightProp;
|
|
24
|
+
}
|
|
25
|
+
if (process.env.NODE_ENV !== 'production' && !warnedOnceInvalidRowHeight && typeof rowHeightProp !== 'undefined' && rowHeightProp !== null) {
|
|
26
|
+
console.warn(warningMessage);
|
|
27
|
+
warnedOnceInvalidRowHeight = true;
|
|
28
|
+
}
|
|
29
|
+
return defaultRowHeight;
|
|
30
|
+
};
|
|
31
|
+
const rowHeightWarning = [`MUI: The \`rowHeight\` prop should be a number greater than 0.`, `The default value will be used instead.`].join('\n');
|
|
32
|
+
const getRowHeightWarning = [`MUI: The \`getRowHeight\` prop should return a number greater than 0 or 'auto'.`, `The default value will be used instead.`].join('\n');
|
|
19
33
|
|
|
20
34
|
/**
|
|
21
35
|
* @requires useGridPageSize (method)
|
|
@@ -38,7 +52,8 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
38
52
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
39
53
|
const currentPage = useGridVisibleRows(apiRef, props);
|
|
40
54
|
const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
41
|
-
const
|
|
55
|
+
const validRowHeight = getValidRowHeight(props.rowHeight, DATA_GRID_PROPS_DEFAULT_VALUES.rowHeight, rowHeightWarning);
|
|
56
|
+
const rowHeight = Math.floor(validRowHeight * densityFactor);
|
|
42
57
|
const hydrateRowsMeta = React.useCallback(() => {
|
|
43
58
|
var _pinnedRows$top, _pinnedRows$bottom;
|
|
44
59
|
hasRowWithAutoHeight.current = false;
|
|
@@ -59,7 +74,7 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
59
74
|
needsFirstMeasurement,
|
|
60
75
|
sizes
|
|
61
76
|
} = rowsHeightLookup.current[row.id];
|
|
62
|
-
let baseRowHeight = rowHeight;
|
|
77
|
+
let baseRowHeight = typeof rowHeight === 'number' && rowHeight > 0 ? rowHeight : 52;
|
|
63
78
|
const existingBaseRowHeight = sizes.baseCenter;
|
|
64
79
|
if (isResized) {
|
|
65
80
|
// Do not recalculate resized row height and use the value from the lookup
|
|
@@ -82,8 +97,8 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
82
97
|
hasRowWithAutoHeight.current = true;
|
|
83
98
|
rowsHeightLookup.current[row.id].autoHeight = true;
|
|
84
99
|
} else {
|
|
85
|
-
// Default back to base rowHeight if getRowHeight returns
|
|
86
|
-
baseRowHeight = rowHeightFromUser
|
|
100
|
+
// Default back to base rowHeight if getRowHeight returns invalid value.
|
|
101
|
+
baseRowHeight = getValidRowHeight(rowHeightFromUser, rowHeight, getRowHeightWarning);
|
|
87
102
|
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
88
103
|
rowsHeightLookup.current[row.id].autoHeight = false;
|
|
89
104
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["style"],
|
|
4
|
+
_excluded2 = ["style"],
|
|
5
|
+
_excluded3 = ["style"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import * as ReactDOM from 'react-dom';
|
|
6
8
|
import { unstable_useForkRef as useForkRef, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
@@ -339,7 +341,7 @@ export const useGridVirtualScroller = props => {
|
|
|
339
341
|
const renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
|
|
340
342
|
const rows = [];
|
|
341
343
|
for (let i = 0; i < renderedRows.length; i += 1) {
|
|
342
|
-
var
|
|
344
|
+
var _rootProps$components, _currentPage$range5;
|
|
343
345
|
const {
|
|
344
346
|
id,
|
|
345
347
|
model
|
|
@@ -352,6 +354,16 @@ export const useGridVirtualScroller = props => {
|
|
|
352
354
|
} else {
|
|
353
355
|
isSelected = apiRef.current.isRowSelectable(id);
|
|
354
356
|
}
|
|
357
|
+
const _ref = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.row) || {},
|
|
358
|
+
{
|
|
359
|
+
style: rootRowStyle
|
|
360
|
+
} = _ref,
|
|
361
|
+
rootRowProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
362
|
+
const _ref2 = typeof getRowProps === 'function' && getRowProps(id, model) || {},
|
|
363
|
+
{
|
|
364
|
+
style: rowStyle
|
|
365
|
+
} = _ref2,
|
|
366
|
+
rowProps = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
355
367
|
rows.push( /*#__PURE__*/_jsx(rootProps.components.Row, _extends({
|
|
356
368
|
row: model,
|
|
357
369
|
rowId: id,
|
|
@@ -371,7 +383,9 @@ export const useGridVirtualScroller = props => {
|
|
|
371
383
|
containerWidth: availableSpace,
|
|
372
384
|
isLastVisible: lastVisibleRowIndex,
|
|
373
385
|
position: position
|
|
374
|
-
},
|
|
386
|
+
}, rowProps, rootRowProps, {
|
|
387
|
+
style: _extends({}, rowStyle, rootRowStyle)
|
|
388
|
+
}), id));
|
|
375
389
|
}
|
|
376
390
|
return rows;
|
|
377
391
|
};
|
|
@@ -416,11 +430,11 @@ export const useGridVirtualScroller = props => {
|
|
|
416
430
|
renderContext,
|
|
417
431
|
updateRenderZonePosition,
|
|
418
432
|
getRows,
|
|
419
|
-
getRootProps: (
|
|
433
|
+
getRootProps: (_ref3 = {}) => {
|
|
420
434
|
let {
|
|
421
435
|
style = {}
|
|
422
|
-
} =
|
|
423
|
-
other = _objectWithoutPropertiesLoose(
|
|
436
|
+
} = _ref3,
|
|
437
|
+
other = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
424
438
|
return _extends({
|
|
425
439
|
ref: handleRef,
|
|
426
440
|
onScroll: handleScroll,
|
package/index.js
CHANGED
|
@@ -79,7 +79,7 @@ var GridAutoSizer = /*#__PURE__*/React.forwardRef(function AutoSizer(props, ref)
|
|
|
79
79
|
ref: handleRef,
|
|
80
80
|
style: _extends({
|
|
81
81
|
flex: disableHeight ? 0 : '1 1 0px',
|
|
82
|
-
overflow: 'auto'
|
|
82
|
+
overflow: disableHeight ? 'visible' : 'auto'
|
|
83
83
|
}, style)
|
|
84
84
|
}, other, {
|
|
85
85
|
children: state.height === null && state.width === null ? null : children
|
|
@@ -161,9 +161,11 @@ function GridCell(props) {
|
|
|
161
161
|
var managesOwnFocus = column.type === 'actions';
|
|
162
162
|
var renderChildren = function renderChildren() {
|
|
163
163
|
if (children === undefined) {
|
|
164
|
+
var valueString = valueToRender == null ? void 0 : valueToRender.toString();
|
|
164
165
|
return /*#__PURE__*/_jsx("div", {
|
|
165
166
|
className: classes.content,
|
|
166
|
-
|
|
167
|
+
title: valueString,
|
|
168
|
+
children: valueString
|
|
167
169
|
});
|
|
168
170
|
}
|
|
169
171
|
if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
|
|
@@ -111,14 +111,19 @@ function GridColumnsPanel(props) {
|
|
|
111
111
|
apiRef.current.setColumnVisibility(field, columnVisibilityModel[field] === false);
|
|
112
112
|
};
|
|
113
113
|
var toggleAllColumns = React.useCallback(function (isVisible) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
var currentModel = gridColumnVisibilityModelSelector(apiRef);
|
|
115
|
+
var newModel = _extends({}, currentModel);
|
|
116
|
+
columns.forEach(function (col) {
|
|
117
|
+
if (col.hideable) {
|
|
118
|
+
if (isVisible) {
|
|
119
|
+
// delete the key from the model instead of setting it to `true`
|
|
120
|
+
delete newModel[col.field];
|
|
121
|
+
} else {
|
|
122
|
+
newModel[col.field] = false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
return apiRef.current.setColumnVisibilityModel(newModel);
|
|
122
127
|
}, [apiRef, columns]);
|
|
123
128
|
var handleSearchValueChange = React.useCallback(function (event) {
|
|
124
129
|
setSearchValue(event.target.value);
|
|
@@ -225,9 +225,13 @@ export var useGridPrintExport = function useGridPrintExport(apiRef, props) {
|
|
|
225
225
|
} else {
|
|
226
226
|
printWindow.onload = function () {
|
|
227
227
|
handlePrintWindowLoad(printWindow, options);
|
|
228
|
-
printWindow.contentWindow.
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
var mediaQueryList = printWindow.contentWindow.matchMedia('print');
|
|
229
|
+
mediaQueryList.addEventListener('change', function (mql) {
|
|
230
|
+
var isAfterPrint = mql.matches === false;
|
|
231
|
+
if (isAfterPrint) {
|
|
232
|
+
handlePrintWindowAfterPrint(printWindow);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
231
235
|
};
|
|
232
236
|
doc.current.body.appendChild(printWindow);
|
|
233
237
|
}
|
|
@@ -11,6 +11,7 @@ import { gridPaginationSelector } from '../pagination/gridPaginationSelector';
|
|
|
11
11
|
import { gridSortModelSelector } from '../sorting/gridSortingSelector';
|
|
12
12
|
import { useGridRegisterPipeApplier } from '../../core/pipeProcessing';
|
|
13
13
|
import { gridPinnedRowsSelector } from './gridRowsSelector';
|
|
14
|
+
import { DATA_GRID_PROPS_DEFAULT_VALUES } from '../../../DataGrid/useDataGridProps';
|
|
14
15
|
export var rowsMetaStateInitializer = function rowsMetaStateInitializer(state) {
|
|
15
16
|
return _extends({}, state, {
|
|
16
17
|
rowsMeta: {
|
|
@@ -19,6 +20,19 @@ export var rowsMetaStateInitializer = function rowsMetaStateInitializer(state) {
|
|
|
19
20
|
}
|
|
20
21
|
});
|
|
21
22
|
};
|
|
23
|
+
var warnedOnceInvalidRowHeight = false;
|
|
24
|
+
var getValidRowHeight = function getValidRowHeight(rowHeightProp, defaultRowHeight, warningMessage) {
|
|
25
|
+
if (typeof rowHeightProp === 'number' && rowHeightProp > 0) {
|
|
26
|
+
return rowHeightProp;
|
|
27
|
+
}
|
|
28
|
+
if (process.env.NODE_ENV !== 'production' && !warnedOnceInvalidRowHeight && typeof rowHeightProp !== 'undefined' && rowHeightProp !== null) {
|
|
29
|
+
console.warn(warningMessage);
|
|
30
|
+
warnedOnceInvalidRowHeight = true;
|
|
31
|
+
}
|
|
32
|
+
return defaultRowHeight;
|
|
33
|
+
};
|
|
34
|
+
var rowHeightWarning = ["MUI: The `rowHeight` prop should be a number greater than 0.", "The default value will be used instead."].join('\n');
|
|
35
|
+
var getRowHeightWarning = ["MUI: The `getRowHeight` prop should return a number greater than 0 or 'auto'.", "The default value will be used instead."].join('\n');
|
|
22
36
|
|
|
23
37
|
/**
|
|
24
38
|
* @requires useGridPageSize (method)
|
|
@@ -39,7 +53,8 @@ export var useGridRowsMeta = function useGridRowsMeta(apiRef, props) {
|
|
|
39
53
|
var sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
40
54
|
var currentPage = useGridVisibleRows(apiRef, props);
|
|
41
55
|
var pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
42
|
-
var
|
|
56
|
+
var validRowHeight = getValidRowHeight(props.rowHeight, DATA_GRID_PROPS_DEFAULT_VALUES.rowHeight, rowHeightWarning);
|
|
57
|
+
var rowHeight = Math.floor(validRowHeight * densityFactor);
|
|
43
58
|
var hydrateRowsMeta = React.useCallback(function () {
|
|
44
59
|
var _pinnedRows$top, _pinnedRows$bottom;
|
|
45
60
|
hasRowWithAutoHeight.current = false;
|
|
@@ -59,7 +74,7 @@ export var useGridRowsMeta = function useGridRowsMeta(apiRef, props) {
|
|
|
59
74
|
isResized = _rowsHeightLookup$cur.isResized,
|
|
60
75
|
needsFirstMeasurement = _rowsHeightLookup$cur.needsFirstMeasurement,
|
|
61
76
|
sizes = _rowsHeightLookup$cur.sizes;
|
|
62
|
-
var baseRowHeight = rowHeight;
|
|
77
|
+
var baseRowHeight = typeof rowHeight === 'number' && rowHeight > 0 ? rowHeight : 52;
|
|
63
78
|
var existingBaseRowHeight = sizes.baseCenter;
|
|
64
79
|
if (isResized) {
|
|
65
80
|
// Do not recalculate resized row height and use the value from the lookup
|
|
@@ -82,8 +97,8 @@ export var useGridRowsMeta = function useGridRowsMeta(apiRef, props) {
|
|
|
82
97
|
hasRowWithAutoHeight.current = true;
|
|
83
98
|
rowsHeightLookup.current[row.id].autoHeight = true;
|
|
84
99
|
} else {
|
|
85
|
-
// Default back to base rowHeight if getRowHeight returns
|
|
86
|
-
baseRowHeight = rowHeightFromUser
|
|
100
|
+
// Default back to base rowHeight if getRowHeight returns invalid value.
|
|
101
|
+
baseRowHeight = getValidRowHeight(rowHeightFromUser, rowHeight, getRowHeightWarning);
|
|
87
102
|
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
88
103
|
rowsHeightLookup.current[row.id].autoHeight = false;
|
|
89
104
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
-
var _excluded = ["style"]
|
|
4
|
+
var _excluded = ["style"],
|
|
5
|
+
_excluded2 = ["style"],
|
|
6
|
+
_excluded3 = ["style"];
|
|
5
7
|
import * as React from 'react';
|
|
6
8
|
import * as ReactDOM from 'react-dom';
|
|
7
9
|
import { unstable_useForkRef as useForkRef, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
@@ -365,7 +367,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
365
367
|
var renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
|
|
366
368
|
var rows = [];
|
|
367
369
|
for (var i = 0; i < renderedRows.length; i += 1) {
|
|
368
|
-
var
|
|
370
|
+
var _rootProps$components, _currentPage$range5;
|
|
369
371
|
var _renderedRows$i = renderedRows[i],
|
|
370
372
|
_id = _renderedRows$i.id,
|
|
371
373
|
_model = _renderedRows$i.model;
|
|
@@ -377,6 +379,12 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
377
379
|
} else {
|
|
378
380
|
isSelected = apiRef.current.isRowSelectable(_id);
|
|
379
381
|
}
|
|
382
|
+
var _ref4 = ((_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.row) || {},
|
|
383
|
+
rootRowStyle = _ref4.style,
|
|
384
|
+
rootRowProps = _objectWithoutProperties(_ref4, _excluded);
|
|
385
|
+
var _ref5 = typeof getRowProps === 'function' && getRowProps(_id, _model) || {},
|
|
386
|
+
rowStyle = _ref5.style,
|
|
387
|
+
rowProps = _objectWithoutProperties(_ref5, _excluded2);
|
|
380
388
|
rows.push( /*#__PURE__*/_jsx(rootProps.components.Row, _extends({
|
|
381
389
|
row: _model,
|
|
382
390
|
rowId: _id,
|
|
@@ -396,7 +404,9 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
396
404
|
containerWidth: availableSpace,
|
|
397
405
|
isLastVisible: lastVisibleRowIndex,
|
|
398
406
|
position: position
|
|
399
|
-
},
|
|
407
|
+
}, rowProps, rootRowProps, {
|
|
408
|
+
style: _extends({}, rowStyle, rootRowStyle)
|
|
409
|
+
}), _id));
|
|
400
410
|
}
|
|
401
411
|
return rows;
|
|
402
412
|
};
|
|
@@ -442,10 +452,10 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
442
452
|
updateRenderZonePosition: updateRenderZonePosition,
|
|
443
453
|
getRows: getRows,
|
|
444
454
|
getRootProps: function getRootProps() {
|
|
445
|
-
var
|
|
446
|
-
var
|
|
447
|
-
style =
|
|
448
|
-
other = _objectWithoutProperties(
|
|
455
|
+
var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
456
|
+
var _ref6$style = _ref6.style,
|
|
457
|
+
style = _ref6$style === void 0 ? {} : _ref6$style,
|
|
458
|
+
other = _objectWithoutProperties(_ref6, _excluded3);
|
|
449
459
|
return _extends({
|
|
450
460
|
ref: handleRef,
|
|
451
461
|
onScroll: handleScroll,
|
|
@@ -455,9 +465,9 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
455
465
|
}, other);
|
|
456
466
|
},
|
|
457
467
|
getContentProps: function getContentProps() {
|
|
458
|
-
var
|
|
459
|
-
|
|
460
|
-
style =
|
|
468
|
+
var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
469
|
+
_ref7$style = _ref7.style,
|
|
470
|
+
style = _ref7$style === void 0 ? {} : _ref7$style;
|
|
461
471
|
return {
|
|
462
472
|
style: _extends({}, style, contentSize)
|
|
463
473
|
};
|
package/legacy/index.js
CHANGED