@mui/x-data-grid 7.7.1 → 7.9.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 +166 -1
- package/DataGrid/useDataGridComponent.d.ts +0 -1
- package/DataGrid/useDataGridProps.js +9 -2
- package/components/GridFooter.d.ts +1 -1
- package/components/GridLoadingOverlay.d.ts +15 -3
- package/components/GridLoadingOverlay.js +48 -4
- package/components/GridNoResultsOverlay.d.ts +1 -1
- package/components/GridNoRowsOverlay.d.ts +1 -1
- package/components/GridRow.js +2 -1
- package/components/GridRowCount.d.ts +1 -1
- package/components/GridSelectedRowCount.d.ts +1 -1
- package/components/GridSkeletonLoadingOverlay.d.ts +3 -0
- package/components/GridSkeletonLoadingOverlay.js +181 -0
- package/components/base/GridOverlays.d.ts +11 -1
- package/components/base/GridOverlays.js +25 -39
- package/components/cell/GridActionsCellItem.d.ts +3 -3
- package/components/cell/GridSkeletonCell.d.ts +13 -6
- package/components/cell/GridSkeletonCell.js +61 -19
- package/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -0
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
- package/components/containers/GridFooterContainer.d.ts +1 -1
- package/components/containers/GridOverlay.d.ts +1 -1
- package/components/containers/GridRootStyles.d.ts +0 -1
- package/components/containers/GridRootStyles.js +19 -2
- package/components/containers/GridToolbarContainer.d.ts +1 -1
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/components/virtualization/GridMainContainer.d.ts +1 -1
- package/components/virtualization/GridVirtualScroller.js +7 -5
- package/components/virtualization/GridVirtualScrollerContent.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +1 -1
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +14 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
- package/hooks/core/useGridInitialization.d.ts +1 -1
- package/hooks/core/useGridLocaleText.d.ts +1 -1
- package/hooks/core/useGridLoggerFactory.d.ts +1 -1
- package/hooks/features/clipboard/useGridClipboard.d.ts +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
- package/hooks/features/density/useGridDensity.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +15 -15
- package/hooks/features/editing/useGridCellEditing.d.ts +1 -1
- package/hooks/features/editing/useGridEditing.d.ts +1 -1
- package/hooks/features/editing/useGridRowEditing.d.ts +1 -1
- package/hooks/features/export/serializers/csvSerializer.d.ts +0 -1
- package/hooks/features/export/useGridCsvExport.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.js +9 -8
- package/hooks/features/filter/gridFilterUtils.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/focus/useGridFocus.d.ts +1 -1
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/overlays/useGridOverlays.d.ts +11 -0
- package/hooks/features/overlays/useGridOverlays.js +35 -0
- package/hooks/features/pagination/gridPaginationUtils.d.ts +1 -1
- package/hooks/features/pagination/index.d.ts +1 -1
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +1 -1
- package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
- package/hooks/features/pagination/useGridRowCount.d.ts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rows/gridRowsInterfaces.d.ts +10 -2
- package/hooks/features/rows/gridRowsSelector.d.ts +2 -1
- package/hooks/features/rows/gridRowsSelector.js +1 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +8 -6
- package/hooks/features/rows/gridRowsUtils.js +30 -6
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +39 -21
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/hooks/utils/index.d.ts +0 -1
- package/hooks/utils/index.js +0 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
- package/hooks/utils/useGridApiRef.d.ts +1 -1
- package/hooks/utils/useGridInitializeState.d.ts +1 -1
- package/hooks/utils/useGridRootProps.d.ts +1 -1
- package/hooks/utils/useGridSelector.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +1 -0
- package/internals/utils/propValidation.js +1 -1
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridInfiniteLoaderApi.d.ts +0 -1
- package/models/api/gridRowApi.d.ts +14 -0
- package/models/gridColumnGrouping.d.ts +0 -1
- package/models/gridDataSource.d.ts +87 -0
- package/models/gridDataSource.js +1 -0
- package/models/gridRows.d.ts +10 -0
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.ts +7 -2
- package/models/props/DataGridProps.d.ts +2 -0
- package/modern/DataGrid/useDataGridProps.js +9 -2
- package/modern/components/GridLoadingOverlay.js +48 -4
- package/modern/components/GridRow.js +2 -1
- package/modern/components/GridSkeletonLoadingOverlay.js +181 -0
- package/modern/components/base/GridOverlays.js +25 -39
- package/modern/components/cell/GridSkeletonCell.js +61 -19
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
- package/modern/components/containers/GridRootStyles.js +19 -2
- package/modern/components/virtualization/GridVirtualScroller.js +7 -5
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +15 -15
- package/modern/hooks/features/export/useGridPrintExport.js +9 -8
- package/modern/hooks/features/overlays/useGridOverlays.js +35 -0
- package/modern/hooks/features/rows/gridRowsSelector.js +1 -0
- package/modern/hooks/features/rows/gridRowsUtils.js +30 -6
- package/modern/hooks/features/rows/useGridRows.js +39 -21
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/modern/hooks/utils/index.js +0 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/propValidation.js +1 -1
- package/modern/models/gridDataSource.js +1 -0
- package/modern/utils/utils.js +10 -2
- package/node/DataGrid/useDataGridProps.js +9 -2
- package/node/components/GridLoadingOverlay.js +48 -4
- package/node/components/GridRow.js +2 -1
- package/node/components/GridSkeletonLoadingOverlay.js +189 -0
- package/node/components/base/GridOverlays.js +25 -39
- package/node/components/cell/GridSkeletonCell.js +60 -18
- package/node/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
- package/node/components/containers/GridRootStyles.js +19 -2
- package/node/components/virtualization/GridVirtualScroller.js +6 -4
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/dimensions/useGridDimensions.js +15 -15
- package/node/hooks/features/export/useGridPrintExport.js +9 -8
- package/node/hooks/features/overlays/useGridOverlays.js +42 -0
- package/node/hooks/features/rows/gridRowsSelector.js +2 -1
- package/node/hooks/features/rows/gridRowsUtils.js +31 -6
- package/node/hooks/features/rows/useGridRows.js +37 -19
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/node/hooks/utils/index.js +0 -12
- package/node/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/internals/utils/propValidation.js +1 -1
- package/node/models/gridDataSource.js +5 -0
- package/node/utils/utils.js +11 -3
- package/package.json +5 -4
- package/utils/cleanupTracking/TimerBasedCleanupTracking.d.ts +0 -1
- package/utils/domUtils.d.ts +0 -1
- package/utils/getPublicApiRef.d.ts +1 -2
- package/utils/keyboardUtils.d.ts +1 -1
- package/utils/utils.d.ts +8 -1
- package/utils/utils.js +10 -2
- package/utils/warning.d.ts +1 -1
- package/hooks/utils/useResizeObserver.d.ts +0 -2
- package/hooks/utils/useResizeObserver.js +0 -36
- package/modern/hooks/utils/useResizeObserver.js +0 -36
- package/node/hooks/utils/useResizeObserver.js +0 -44
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,171 @@
|
|
|
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
|
+
## 7.9.0
|
|
7
|
+
|
|
8
|
+
_Jul 5, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🔄 Add loading overlay variants, including a skeleton loader option to the Data Grid component. See [Loading overlay docs](https://mui.com/x/react-data-grid/overlays/#loading-overlay) for more details.
|
|
13
|
+
- 🌳 Add `selectItem` and `getItemDOMElement` methods to the TreeView component public API
|
|
14
|
+
- ⛏️ Make the `usePickersTranslations` hook public in the pickers component
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
|
|
17
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
18
|
+
|
|
19
|
+
### Data Grid
|
|
20
|
+
|
|
21
|
+
#### `@mui/x-data-grid@7.9.0`
|
|
22
|
+
|
|
23
|
+
- [DataGrid] Add skeleton loading overlay support (#13293) @KenanYusuf
|
|
24
|
+
- [DataGrid] Fix pagination when `pagination={undefined}` (#13349) @sai6855
|
|
25
|
+
|
|
26
|
+
#### `@mui/x-data-grid-pro@7.9.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
27
|
+
|
|
28
|
+
Same changes as in `@mui/x-data-grid@7.9.0`.
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-premium@7.9.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid-pro@7.9.0`.
|
|
33
|
+
|
|
34
|
+
### Date and Time Pickers
|
|
35
|
+
|
|
36
|
+
#### `@mui/x-date-pickers@7.9.0`
|
|
37
|
+
|
|
38
|
+
- [pickers] Make the `usePickersTranslations` hook public (#13657) @flaviendelangle
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-date-pickers-pro@7.9.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
41
|
+
|
|
42
|
+
Same changes as in `@mui/x-date-pickers@7.9.0`.
|
|
43
|
+
|
|
44
|
+
### Charts
|
|
45
|
+
|
|
46
|
+
#### `@mui/x-charts@7.9.0`
|
|
47
|
+
|
|
48
|
+
- [charts] Add Heatmap (unreleased) (#13209) @alexfauquette
|
|
49
|
+
- [charts] Add initial `Zoom&Pan` to the Pro charts (unreleased) (#13405) @JCQuintas
|
|
50
|
+
- [charts] Fix Axis Highlight on horizontal bar charts regression (#13717) @JCQuintas
|
|
51
|
+
- [charts] Improve charts interaction for mobile users (#13692) @JCQuintas
|
|
52
|
+
- [charts] Add documentation on how to disable the tooltip on charts (#13724) @JCQuintas
|
|
53
|
+
|
|
54
|
+
### Tree View
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-tree-view@7.9.0`
|
|
57
|
+
|
|
58
|
+
- [TreeView] Add `selectItem` and `getItemDOMElement` methods to the public API (#13485) @flaviendelangle
|
|
59
|
+
|
|
60
|
+
### Docs
|
|
61
|
+
|
|
62
|
+
- [docs] Fix custom "no results overlay" demo in dark mode (#13715) @KenanYusuf
|
|
63
|
+
|
|
64
|
+
### Core
|
|
65
|
+
|
|
66
|
+
- [core] Add `react_next` workflow in CircleCI (#13360) @cherniavskii
|
|
67
|
+
- [core] Create a new package to share utils across X packages (#13528) @flaviendelangle
|
|
68
|
+
- [core] Fix dependency setup (#13684) @LukasTy
|
|
69
|
+
- [core] Remove `jscodeshift-add-imports` package (#13720) @LukasTy
|
|
70
|
+
- [code-infra] Cleanup monorepo and `@mui/docs` usage (#13713) @LukasTy
|
|
71
|
+
|
|
72
|
+
## 7.8.0
|
|
73
|
+
|
|
74
|
+
_Jun 28, 2024_
|
|
75
|
+
|
|
76
|
+
We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
|
|
77
|
+
|
|
78
|
+
- 🛰 Introduce server-side data source for improved server integration in the Data Grid.
|
|
79
|
+
|
|
80
|
+
Supports server-side pagination, sorting and filtering on plain and tree data, and automatic caching.
|
|
81
|
+
|
|
82
|
+
To enable, provide a `getRows` function to the `unstable_dataSource` prop on the Data Grid component.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
const dataSource = {
|
|
86
|
+
getRows: async (params: GridServerGetRowsParams) => {
|
|
87
|
+
const data = await fetch(
|
|
88
|
+
`https://api.example.com/data?${new URLSearchParams({
|
|
89
|
+
page: params.page,
|
|
90
|
+
pageSize: params.pageSize,
|
|
91
|
+
sortModel: JSON.stringify(params.sortModel),
|
|
92
|
+
filterModel: JSON.stringify(params.filterModel),
|
|
93
|
+
}).toString()}`,
|
|
94
|
+
);
|
|
95
|
+
return {
|
|
96
|
+
rows: data.rows,
|
|
97
|
+
totalRows: data.totalRows,
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
<DataGridPro
|
|
102
|
+
unstable_dataSource={dataSource}
|
|
103
|
+
{...otherProps}
|
|
104
|
+
/>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
See [server-side data documentation](https://mui.com/x/react-data-grid/server-side-data/) for more details.
|
|
108
|
+
|
|
109
|
+
- 📈 Support Date data on the BarChart component
|
|
110
|
+
- ↕️ Support custom column sort icons on the Data Grid
|
|
111
|
+
- 🖱️ Support modifying the expansion trigger on the Tree View components
|
|
112
|
+
|
|
113
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
114
|
+
|
|
115
|
+
### Data Grid
|
|
116
|
+
|
|
117
|
+
#### `@mui/x-data-grid@7.8.0`
|
|
118
|
+
|
|
119
|
+
- [DataGrid] Add `columnHeaderSortIcon` slot (#13563) @arminmeh
|
|
120
|
+
- [DataGrid] Fix dimensions lag issue after autosize (#13587) @MBilalShafi
|
|
121
|
+
- [DataGrid] Fix print export failure when `hideFooter` option is set (#13034) @tarunrajput
|
|
122
|
+
|
|
123
|
+
#### `@mui/x-data-grid-pro@7.8.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
124
|
+
|
|
125
|
+
Same changes as in `@mui/x-data-grid@7.8.0`, plus:
|
|
126
|
+
|
|
127
|
+
- [DataGridPro] Fix multi-sorting indicator being cut off (#13625) @KenanYusuf
|
|
128
|
+
- [DataGridPro] Server-side tree data support (#12317) @MBilalShafi
|
|
129
|
+
|
|
130
|
+
#### `@mui/x-data-grid-premium@7.8.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
131
|
+
|
|
132
|
+
Same changes as in `@mui/x-data-grid-pro@7.8.0`.
|
|
133
|
+
|
|
134
|
+
### Date and Time Pickers
|
|
135
|
+
|
|
136
|
+
#### `@mui/x-date-pickers@7.8.0`
|
|
137
|
+
|
|
138
|
+
- [fields] Fix section clearing behavior on Android (#13652) @LukasTy
|
|
139
|
+
|
|
140
|
+
#### `@mui/x-date-pickers-pro@7.8.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
141
|
+
|
|
142
|
+
Same changes as in `@mui/x-date-pickers@7.8.0`.
|
|
143
|
+
|
|
144
|
+
### Charts
|
|
145
|
+
|
|
146
|
+
#### `@mui/x-charts@7.8.0`
|
|
147
|
+
|
|
148
|
+
- [charts] Fix line chart props not passing correct event handlers (#13609) @JCQuintas
|
|
149
|
+
- [charts] Support BarChart with `Date` data (#13471) @alexfauquette
|
|
150
|
+
- [charts] Support RTL for y-axis (#13614) @alexfauquette
|
|
151
|
+
- [charts] Use default values instead of non-null assertion to prevent error being thrown (#13637) @JCQuintas
|
|
152
|
+
|
|
153
|
+
### Tree View
|
|
154
|
+
|
|
155
|
+
#### `@mui/x-tree-view@7.8.0`
|
|
156
|
+
|
|
157
|
+
- [TreeView] Add `expansionTrigger` prop (#13533) @noraleonte
|
|
158
|
+
- [TreeView] Support experimental features from plugin's dependencies (#13632) @flaviendelangle
|
|
159
|
+
|
|
160
|
+
### Docs
|
|
161
|
+
|
|
162
|
+
- [docs] Add callout for `Luxon` `throwOnInvalid` support (#13621) @LukasTy
|
|
163
|
+
- [docs] Add "Overlays" section to the Data Grid documentation (#13624) @KenanYusuf
|
|
164
|
+
|
|
165
|
+
### Core
|
|
166
|
+
|
|
167
|
+
- [core] Add eslint rule to restrict import from `../internals` root (#13633) @JCQuintas
|
|
168
|
+
- [docs-infra] Sync `\_app` folder with monorepo (#13582) @Janpot
|
|
169
|
+
- [license] Allow usage of charts and tree view pro package for old premium licenses (#13619) @flaviendelangle
|
|
170
|
+
|
|
6
171
|
## 7.7.1
|
|
7
172
|
|
|
8
173
|
_Jun 21, 2024_
|
|
@@ -44,7 +209,7 @@ Same changes as in `@mui/x-data-grid-pro@7.7.1`.
|
|
|
44
209
|
- [pickers] Always use the same timezone in the field, the view and the layout components (#13481) @flaviendelangle
|
|
45
210
|
- [pickers] Fix `AdapterDateFnsV3` generated method types (#13464) @alexey-kozlenkov
|
|
46
211
|
- [pickers] Fix controlled `view` behavior (#13552) @LukasTy
|
|
47
|
-
- [TimePicker] Improves RTL verification for the time pickers default views
|
|
212
|
+
- [TimePicker] Improves RTL verification for the time pickers default views (#13447) @arthurbalduini
|
|
48
213
|
|
|
49
214
|
#### `@mui/x-date-pickers-pro@7.7.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
50
215
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { DataGridProcessedProps } from '../models/props/DataGridProps';
|
|
3
2
|
import { GridApiCommunity, GridPrivateApiCommunity } from '../models/api/gridApiCommunity';
|
|
4
3
|
export declare const useDataGridComponent: (inputApiRef: React.MutableRefObject<GridApiCommunity> | undefined, props: DataGridProcessedProps) => import("react").MutableRefObject<GridPrivateApiCommunity>;
|
|
@@ -85,8 +85,15 @@ export const useDataGridProps = inProps => {
|
|
|
85
85
|
defaultSlots,
|
|
86
86
|
slots: themedProps.slots
|
|
87
87
|
}), [themedProps.slots]);
|
|
88
|
-
|
|
88
|
+
const injectDefaultProps = React.useMemo(() => {
|
|
89
|
+
return Object.keys(DATA_GRID_PROPS_DEFAULT_VALUES).reduce((acc, key) => {
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
acc[key] = themedProps[key] ?? DATA_GRID_PROPS_DEFAULT_VALUES[key];
|
|
92
|
+
return acc;
|
|
93
|
+
}, {});
|
|
94
|
+
}, [themedProps]);
|
|
95
|
+
return React.useMemo(() => _extends({}, themedProps, injectDefaultProps, {
|
|
89
96
|
localeText,
|
|
90
97
|
slots
|
|
91
|
-
}, DATA_GRID_FORCED_PROPS), [themedProps, localeText, slots]);
|
|
98
|
+
}, DATA_GRID_FORCED_PROPS), [themedProps, localeText, slots, injectDefaultProps]);
|
|
92
99
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
declare const GridFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
-
sx?: import("@mui/system").SxProps<import("@mui/system").Theme
|
|
3
|
+
sx?: import("@mui/system").SxProps<import("@mui/system").Theme>;
|
|
4
4
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export { GridFooter };
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { GridOverlayProps } from './containers/GridOverlay';
|
|
3
|
+
export type GridLoadingOverlayVariant = 'circular-progress' | 'linear-progress' | 'skeleton';
|
|
4
|
+
export interface GridLoadingOverlayProps extends GridOverlayProps {
|
|
5
|
+
/**
|
|
6
|
+
* The variant of the overlay.
|
|
7
|
+
* @default 'circular-progress'
|
|
8
|
+
*/
|
|
9
|
+
variant?: GridLoadingOverlayVariant;
|
|
10
|
+
/**
|
|
11
|
+
* The variant of the overlay when no rows are displayed.
|
|
12
|
+
* @default 'circular-progress'
|
|
13
|
+
*/
|
|
14
|
+
noRowsVariant?: GridLoadingOverlayVariant;
|
|
15
|
+
}
|
|
16
|
+
declare const GridLoadingOverlay: React.ForwardRefExoticComponent<GridLoadingOverlayProps & React.RefAttributes<HTMLDivElement>>;
|
|
5
17
|
export { GridLoadingOverlay };
|
|
@@ -1,14 +1,48 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["variant", "noRowsVariant", "style"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import LinearProgress from '@mui/material/LinearProgress';
|
|
4
7
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
5
8
|
import { GridOverlay } from './containers/GridOverlay';
|
|
9
|
+
import { GridSkeletonLoadingOverlay } from './GridSkeletonLoadingOverlay';
|
|
10
|
+
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
11
|
+
import { gridRowCountSelector, useGridSelector } from '../hooks';
|
|
6
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const LOADING_VARIANTS = {
|
|
14
|
+
'circular-progress': {
|
|
15
|
+
component: CircularProgress,
|
|
16
|
+
style: {}
|
|
17
|
+
},
|
|
18
|
+
'linear-progress': {
|
|
19
|
+
component: LinearProgress,
|
|
20
|
+
style: {
|
|
21
|
+
display: 'block'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
skeleton: {
|
|
25
|
+
component: GridSkeletonLoadingOverlay,
|
|
26
|
+
style: {
|
|
27
|
+
display: 'block'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
7
31
|
const GridLoadingOverlay = /*#__PURE__*/React.forwardRef(function GridLoadingOverlay(props, ref) {
|
|
32
|
+
const {
|
|
33
|
+
variant = 'circular-progress',
|
|
34
|
+
noRowsVariant = 'circular-progress',
|
|
35
|
+
style
|
|
36
|
+
} = props,
|
|
37
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
|
+
const apiRef = useGridApiContext();
|
|
39
|
+
const rowsCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
40
|
+
const activeVariant = LOADING_VARIANTS[rowsCount === 0 ? noRowsVariant : variant];
|
|
8
41
|
return /*#__PURE__*/_jsx(GridOverlay, _extends({
|
|
9
|
-
ref: ref
|
|
10
|
-
|
|
11
|
-
|
|
42
|
+
ref: ref,
|
|
43
|
+
style: _extends({}, activeVariant.style, style)
|
|
44
|
+
}, other, {
|
|
45
|
+
children: /*#__PURE__*/_jsx(activeVariant.component, {})
|
|
12
46
|
}));
|
|
13
47
|
});
|
|
14
48
|
process.env.NODE_ENV !== "production" ? GridLoadingOverlay.propTypes = {
|
|
@@ -16,6 +50,16 @@ process.env.NODE_ENV !== "production" ? GridLoadingOverlay.propTypes = {
|
|
|
16
50
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
17
51
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
18
52
|
// ----------------------------------------------------------------------
|
|
19
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The variant of the overlay when no rows are displayed.
|
|
55
|
+
* @default 'circular-progress'
|
|
56
|
+
*/
|
|
57
|
+
noRowsVariant: PropTypes.oneOf(['circular-progress', 'linear-progress', 'skeleton']),
|
|
58
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
59
|
+
/**
|
|
60
|
+
* The variant of the overlay.
|
|
61
|
+
* @default 'circular-progress'
|
|
62
|
+
*/
|
|
63
|
+
variant: PropTypes.oneOf(['circular-progress', 'linear-progress', 'skeleton'])
|
|
20
64
|
} : void 0;
|
|
21
65
|
export { GridLoadingOverlay };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export declare const GridNoResultsOverlay: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
-
sx?: import("@mui/system").SxProps<import("@mui/system").Theme
|
|
3
|
+
sx?: import("@mui/system").SxProps<import("@mui/system").Theme>;
|
|
4
4
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
declare const GridNoRowsOverlay: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
3
|
-
sx?: import("@mui/system").SxProps<import("@mui/system").Theme
|
|
3
|
+
sx?: import("@mui/system").SxProps<import("@mui/system").Theme>;
|
|
4
4
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export { GridNoRowsOverlay };
|
package/components/GridRow.js
CHANGED
|
@@ -249,10 +249,11 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
249
249
|
const pinnedOffset = getPinnedCellOffset(gridPinnedColumnPositionLookup[pinnedPosition], column.computedWidth, indexRelativeToAllColumns, columnPositions, dimensions);
|
|
250
250
|
if (rowNode?.type === 'skeletonRow') {
|
|
251
251
|
return /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
252
|
+
type: column.type,
|
|
252
253
|
width: width,
|
|
253
254
|
height: rowHeight,
|
|
254
255
|
field: column.field,
|
|
255
|
-
align: column.align
|
|
256
|
+
align: column.align
|
|
256
257
|
}, column.field);
|
|
257
258
|
}
|
|
258
259
|
const editCellState = editRowsState[rowId]?.[column.field] ?? null;
|
|
@@ -8,6 +8,6 @@ export type GridRowCountProps = React.HTMLAttributes<HTMLDivElement> & RowCountP
|
|
|
8
8
|
sx?: SxProps<Theme>;
|
|
9
9
|
};
|
|
10
10
|
declare const GridRowCount: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & RowCountProps & {
|
|
11
|
-
sx?: SxProps<Theme
|
|
11
|
+
sx?: SxProps<Theme>;
|
|
12
12
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
13
13
|
export { GridRowCount };
|
|
@@ -4,6 +4,6 @@ interface SelectedRowCountProps {
|
|
|
4
4
|
selectedRowCount: number;
|
|
5
5
|
}
|
|
6
6
|
declare const GridSelectedRowCount: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & SelectedRowCountProps & {
|
|
7
|
-
sx?: SxProps<Theme
|
|
7
|
+
sx?: SxProps<Theme>;
|
|
8
8
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
9
9
|
export { GridSelectedRowCount };
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { styled } from '@mui/system';
|
|
5
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
6
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
+
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
8
|
+
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
9
|
+
import { GridPinnedColumnPosition, gridColumnPositionsSelector, gridColumnsTotalWidthSelector, gridDimensionsSelector, gridVisibleColumnDefinitionsSelector, gridVisiblePinnedColumnDefinitionsSelector, useGridApiEventHandler, useGridSelector } from '../hooks';
|
|
10
|
+
import { getDataGridUtilityClass, gridClasses } from '../constants/gridClasses';
|
|
11
|
+
import { getPinnedCellOffset } from '../internals/utils/getPinnedCellOffset';
|
|
12
|
+
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from '../utils/cellBorderUtils';
|
|
13
|
+
import { escapeOperandAttributeSelector } from '../utils/domUtils';
|
|
14
|
+
import { GridScrollbarFillerCell } from './GridScrollbarFillerCell';
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
const SkeletonOverlay = styled('div', {
|
|
17
|
+
name: 'MuiDataGrid',
|
|
18
|
+
slot: 'SkeletonLoadingOverlay',
|
|
19
|
+
overridesResolver: (props, styles) => styles.skeletonLoadingOverlay
|
|
20
|
+
})({
|
|
21
|
+
minWidth: '100%',
|
|
22
|
+
width: 'max-content',
|
|
23
|
+
// prevents overflow: clip; cutting off the x axis
|
|
24
|
+
height: '100%',
|
|
25
|
+
overflow: 'clip' // y axis is hidden while the x axis is allowed to overflow
|
|
26
|
+
});
|
|
27
|
+
const useUtilityClasses = ownerState => {
|
|
28
|
+
const {
|
|
29
|
+
classes
|
|
30
|
+
} = ownerState;
|
|
31
|
+
const slots = {
|
|
32
|
+
root: ['skeletonLoadingOverlay']
|
|
33
|
+
};
|
|
34
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
35
|
+
};
|
|
36
|
+
const getColIndex = el => parseInt(el.getAttribute('data-colindex'), 10);
|
|
37
|
+
const GridSkeletonLoadingOverlay = /*#__PURE__*/React.forwardRef(function GridSkeletonLoadingOverlay(props, forwardedRef) {
|
|
38
|
+
const rootProps = useGridRootProps();
|
|
39
|
+
const {
|
|
40
|
+
slots
|
|
41
|
+
} = rootProps;
|
|
42
|
+
const classes = useUtilityClasses({
|
|
43
|
+
classes: rootProps.classes
|
|
44
|
+
});
|
|
45
|
+
const ref = React.useRef(null);
|
|
46
|
+
const handleRef = useForkRef(ref, forwardedRef);
|
|
47
|
+
const apiRef = useGridApiContext();
|
|
48
|
+
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
49
|
+
const viewportHeight = dimensions?.viewportInnerSize.height ?? 0;
|
|
50
|
+
const skeletonRowsCount = Math.ceil(viewportHeight / dimensions.rowHeight);
|
|
51
|
+
const totalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
52
|
+
const positions = useGridSelector(apiRef, gridColumnPositionsSelector);
|
|
53
|
+
const inViewportCount = React.useMemo(() => positions.filter(value => value <= totalWidth).length, [totalWidth, positions]);
|
|
54
|
+
const allVisibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
55
|
+
const columns = React.useMemo(() => allVisibleColumns.slice(0, inViewportCount), [allVisibleColumns, inViewportCount]);
|
|
56
|
+
const pinnedColumns = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
|
|
57
|
+
const getPinnedStyle = React.useCallback((computedWidth, index, position) => {
|
|
58
|
+
const pinnedOffset = getPinnedCellOffset(position, computedWidth, index, positions, dimensions);
|
|
59
|
+
return {
|
|
60
|
+
[position]: pinnedOffset
|
|
61
|
+
};
|
|
62
|
+
}, [dimensions, positions]);
|
|
63
|
+
const getPinnedPosition = React.useCallback(field => {
|
|
64
|
+
if (pinnedColumns.left.findIndex(col => col.field === field) !== -1) {
|
|
65
|
+
return GridPinnedColumnPosition.LEFT;
|
|
66
|
+
}
|
|
67
|
+
if (pinnedColumns.right.findIndex(col => col.field === field) !== -1) {
|
|
68
|
+
return GridPinnedColumnPosition.RIGHT;
|
|
69
|
+
}
|
|
70
|
+
return undefined;
|
|
71
|
+
}, [pinnedColumns.left, pinnedColumns.right]);
|
|
72
|
+
const children = React.useMemo(() => {
|
|
73
|
+
const array = [];
|
|
74
|
+
for (let i = 0; i < skeletonRowsCount; i += 1) {
|
|
75
|
+
const rowCells = [];
|
|
76
|
+
for (let colIndex = 0; colIndex < columns.length; colIndex += 1) {
|
|
77
|
+
const column = columns[colIndex];
|
|
78
|
+
const pinnedPosition = getPinnedPosition(column.field);
|
|
79
|
+
const isPinnedLeft = pinnedPosition === GridPinnedColumnPosition.LEFT;
|
|
80
|
+
const isPinnedRight = pinnedPosition === GridPinnedColumnPosition.RIGHT;
|
|
81
|
+
const sectionLength = pinnedPosition ? pinnedColumns[pinnedPosition].length // pinned section
|
|
82
|
+
: columns.length - pinnedColumns.left.length - pinnedColumns.right.length; // middle section
|
|
83
|
+
const sectionIndex = pinnedPosition ? pinnedColumns[pinnedPosition].findIndex(col => col.field === column.field) // pinned section
|
|
84
|
+
: colIndex - pinnedColumns.left.length; // middle section
|
|
85
|
+
const pinnedStyle = pinnedPosition && getPinnedStyle(column.computedWidth, colIndex, pinnedPosition);
|
|
86
|
+
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
87
|
+
const showRightBorder = shouldCellShowRightBorder(pinnedPosition, sectionIndex, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller);
|
|
88
|
+
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, sectionIndex);
|
|
89
|
+
const isLastColumn = colIndex === columns.length - 1;
|
|
90
|
+
const isFirstPinnedRight = isPinnedRight && sectionIndex === 0;
|
|
91
|
+
const hasFillerBefore = isFirstPinnedRight && gridHasFiller;
|
|
92
|
+
const hasFillerAfter = isLastColumn && !isFirstPinnedRight && gridHasFiller;
|
|
93
|
+
const expandedWidth = dimensions.viewportOuterSize.width - dimensions.columnsTotalWidth;
|
|
94
|
+
const emptyCellWidth = Math.max(0, expandedWidth);
|
|
95
|
+
const emptyCell = /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
96
|
+
width: emptyCellWidth,
|
|
97
|
+
empty: true
|
|
98
|
+
}, `skeleton-filler-column-${i}`);
|
|
99
|
+
const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
|
|
100
|
+
const hasScrollbarFiller = isLastColumn && scrollbarWidth !== 0;
|
|
101
|
+
if (hasFillerBefore) {
|
|
102
|
+
rowCells.push(emptyCell);
|
|
103
|
+
}
|
|
104
|
+
rowCells.push( /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
105
|
+
field: column.field,
|
|
106
|
+
type: column.type,
|
|
107
|
+
align: column.align,
|
|
108
|
+
width: "var(--width)",
|
|
109
|
+
height: dimensions.rowHeight,
|
|
110
|
+
"data-colindex": colIndex,
|
|
111
|
+
className: clsx(isPinnedLeft && gridClasses['cell--pinnedLeft'], isPinnedRight && gridClasses['cell--pinnedRight'], showRightBorder && gridClasses['cell--withRightBorder'], showLeftBorder && gridClasses['cell--withLeftBorder']),
|
|
112
|
+
style: _extends({
|
|
113
|
+
'--width': `${column.computedWidth}px`
|
|
114
|
+
}, pinnedStyle)
|
|
115
|
+
}, `skeleton-column-${i}-${column.field}`));
|
|
116
|
+
if (hasFillerAfter) {
|
|
117
|
+
rowCells.push(emptyCell);
|
|
118
|
+
}
|
|
119
|
+
if (hasScrollbarFiller) {
|
|
120
|
+
rowCells.push( /*#__PURE__*/_jsx(GridScrollbarFillerCell, {
|
|
121
|
+
pinnedRight: pinnedColumns.right.length > 0
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
array.push( /*#__PURE__*/_jsx("div", {
|
|
126
|
+
className: clsx(gridClasses.row, gridClasses.rowSkeleton, i === 0 && gridClasses['row--firstVisible']),
|
|
127
|
+
children: rowCells
|
|
128
|
+
}, `skeleton-row-${i}`));
|
|
129
|
+
}
|
|
130
|
+
return array;
|
|
131
|
+
}, [slots, columns, pinnedColumns, skeletonRowsCount, rootProps.showCellVerticalBorder, dimensions.columnsTotalWidth, dimensions.viewportOuterSize.width, dimensions.rowHeight, dimensions.hasScrollY, dimensions.scrollbarSize, getPinnedPosition, getPinnedStyle]);
|
|
132
|
+
|
|
133
|
+
// Sync the column resize of the overlay columns with the grid
|
|
134
|
+
const handleColumnResize = params => {
|
|
135
|
+
const {
|
|
136
|
+
colDef,
|
|
137
|
+
width
|
|
138
|
+
} = params;
|
|
139
|
+
const cells = ref.current?.querySelectorAll(`[data-field="${escapeOperandAttributeSelector(colDef.field)}"]`);
|
|
140
|
+
if (!cells) {
|
|
141
|
+
throw new Error('MUI X: Expected skeleton cells to be defined with `data-field` attribute.');
|
|
142
|
+
}
|
|
143
|
+
const resizedColIndex = columns.findIndex(col => col.field === colDef.field);
|
|
144
|
+
const pinnedPosition = getPinnedPosition(colDef.field);
|
|
145
|
+
const isPinnedLeft = pinnedPosition === GridPinnedColumnPosition.LEFT;
|
|
146
|
+
const isPinnedRight = pinnedPosition === GridPinnedColumnPosition.RIGHT;
|
|
147
|
+
const currentWidth = getComputedStyle(cells[0]).getPropertyValue('--width');
|
|
148
|
+
const delta = parseInt(currentWidth, 10) - width;
|
|
149
|
+
if (cells) {
|
|
150
|
+
cells.forEach(element => {
|
|
151
|
+
element.style.setProperty('--width', `${width}px`);
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (isPinnedLeft) {
|
|
155
|
+
const pinnedCells = ref.current?.querySelectorAll(`.${gridClasses['cell--pinnedLeft']}`);
|
|
156
|
+
pinnedCells?.forEach(element => {
|
|
157
|
+
const colIndex = getColIndex(element);
|
|
158
|
+
if (colIndex > resizedColIndex) {
|
|
159
|
+
element.style.left = `${parseInt(getComputedStyle(element).left, 10) - delta}px`;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
if (isPinnedRight) {
|
|
164
|
+
const pinnedCells = ref.current?.querySelectorAll(`.${gridClasses['cell--pinnedRight']}`);
|
|
165
|
+
pinnedCells?.forEach(element => {
|
|
166
|
+
const colIndex = getColIndex(element);
|
|
167
|
+
if (colIndex < resizedColIndex) {
|
|
168
|
+
element.style.right = `${parseInt(getComputedStyle(element).right, 10) + delta}px`;
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
useGridApiEventHandler(apiRef, 'columnResize', handleColumnResize);
|
|
174
|
+
return /*#__PURE__*/_jsx(SkeletonOverlay, _extends({
|
|
175
|
+
className: classes.root,
|
|
176
|
+
ref: handleRef
|
|
177
|
+
}, props, {
|
|
178
|
+
children: children
|
|
179
|
+
}));
|
|
180
|
+
});
|
|
181
|
+
export { GridSkeletonLoadingOverlay };
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
import { GridOverlayType } from '../../hooks/features/overlays/useGridOverlays';
|
|
3
|
+
import { GridLoadingOverlayVariant } from '../GridLoadingOverlay';
|
|
4
|
+
interface GridOverlaysProps {
|
|
5
|
+
overlayType: GridOverlayType;
|
|
6
|
+
loadingOverlayVariant: GridLoadingOverlayVariant | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function GridOverlays(props: GridOverlaysProps): React.JSX.Element | null;
|
|
9
|
+
export declare namespace GridOverlays {
|
|
10
|
+
var propTypes: any;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -5,8 +5,6 @@ import { styled } from '@mui/system';
|
|
|
5
5
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
8
|
-
import { gridExpandedRowCountSelector } from '../../hooks/features/filter/gridFilterSelector';
|
|
9
|
-
import { gridRowCountSelector, gridRowsLoadingSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
10
8
|
import { gridDimensionsSelector } from '../../hooks/features/dimensions';
|
|
11
9
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
12
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
@@ -17,11 +15,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
17
15
|
const GridOverlayWrapperRoot = styled('div', {
|
|
18
16
|
name: 'MuiDataGrid',
|
|
19
17
|
slot: 'OverlayWrapper',
|
|
20
|
-
shouldForwardProp: prop => prop !== 'overlayType',
|
|
18
|
+
shouldForwardProp: prop => prop !== 'overlayType' && prop !== 'loadingOverlayVariant',
|
|
21
19
|
overridesResolver: (props, styles) => styles.overlayWrapper
|
|
22
20
|
})(({
|
|
23
|
-
overlayType
|
|
24
|
-
|
|
21
|
+
overlayType,
|
|
22
|
+
loadingOverlayVariant
|
|
23
|
+
}) =>
|
|
24
|
+
// Skeleton overlay should flow with the scroll container and not be sticky
|
|
25
|
+
loadingOverlayVariant !== 'skeleton' ? {
|
|
25
26
|
position: 'sticky',
|
|
26
27
|
// To stay in place while scrolling
|
|
27
28
|
top: 'var(--DataGrid-headersTotalHeight)',
|
|
@@ -32,11 +33,11 @@ const GridOverlayWrapperRoot = styled('div', {
|
|
|
32
33
|
// To stay above the content instead of shifting it down
|
|
33
34
|
zIndex: overlayType === 'loadingOverlay' ? 5 // Should be above pinned columns, pinned rows, and detail panel
|
|
34
35
|
: 4 // Should be above pinned columns and detail panel
|
|
35
|
-
})
|
|
36
|
+
} : {});
|
|
36
37
|
const GridOverlayWrapperInner = styled('div', {
|
|
37
38
|
name: 'MuiDataGrid',
|
|
38
39
|
slot: 'OverlayWrapperInner',
|
|
39
|
-
shouldForwardProp: prop => prop !== 'overlayType',
|
|
40
|
+
shouldForwardProp: prop => prop !== 'overlayType' && prop !== 'loadingOverlayVariant',
|
|
40
41
|
overridesResolver: (props, styles) => styles.overlayWrapperInner
|
|
41
42
|
})({});
|
|
42
43
|
const useUtilityClasses = ownerState => {
|
|
@@ -61,9 +62,9 @@ function GridOverlayWrapper(props) {
|
|
|
61
62
|
const classes = useUtilityClasses(_extends({}, props, {
|
|
62
63
|
classes: rootProps.classes
|
|
63
64
|
}));
|
|
64
|
-
return /*#__PURE__*/_jsx(GridOverlayWrapperRoot, {
|
|
65
|
-
className: clsx(classes.root)
|
|
66
|
-
|
|
65
|
+
return /*#__PURE__*/_jsx(GridOverlayWrapperRoot, _extends({
|
|
66
|
+
className: clsx(classes.root)
|
|
67
|
+
}, props, {
|
|
67
68
|
children: /*#__PURE__*/_jsx(GridOverlayWrapperInner, _extends({
|
|
68
69
|
className: clsx(classes.inner),
|
|
69
70
|
style: {
|
|
@@ -71,42 +72,27 @@ function GridOverlayWrapper(props) {
|
|
|
71
72
|
width: dimensions.viewportOuterSize.width
|
|
72
73
|
}
|
|
73
74
|
}, props))
|
|
74
|
-
});
|
|
75
|
+
}));
|
|
75
76
|
}
|
|
76
|
-
process.env.NODE_ENV !== "production" ?
|
|
77
|
+
process.env.NODE_ENV !== "production" ? GridOverlays.propTypes = {
|
|
77
78
|
// ----------------------------- Warning --------------------------------
|
|
78
79
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
79
80
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
80
81
|
// ----------------------------------------------------------------------
|
|
81
|
-
|
|
82
|
+
loadingOverlayVariant: PropTypes.oneOf(['circular-progress', 'linear-progress', 'skeleton']),
|
|
83
|
+
overlayType: PropTypes.oneOf(['loadingOverlay', 'noResultsOverlay', 'noRowsOverlay'])
|
|
82
84
|
} : void 0;
|
|
83
|
-
export function GridOverlays() {
|
|
84
|
-
const
|
|
85
|
+
export function GridOverlays(props) {
|
|
86
|
+
const {
|
|
87
|
+
overlayType
|
|
88
|
+
} = props;
|
|
85
89
|
const rootProps = useGridRootProps();
|
|
86
|
-
|
|
87
|
-
const visibleRowCount = useGridSelector(apiRef, gridExpandedRowCountSelector);
|
|
88
|
-
const loading = useGridSelector(apiRef, gridRowsLoadingSelector);
|
|
89
|
-
const showNoRowsOverlay = !loading && totalRowCount === 0;
|
|
90
|
-
const showNoResultsOverlay = !loading && totalRowCount > 0 && visibleRowCount === 0;
|
|
91
|
-
let overlay = null;
|
|
92
|
-
let overlayType = '';
|
|
93
|
-
if (showNoRowsOverlay) {
|
|
94
|
-
overlay = /*#__PURE__*/_jsx(rootProps.slots.noRowsOverlay, _extends({}, rootProps.slotProps?.noRowsOverlay));
|
|
95
|
-
overlayType = 'noRowsOverlay';
|
|
96
|
-
}
|
|
97
|
-
if (showNoResultsOverlay) {
|
|
98
|
-
overlay = /*#__PURE__*/_jsx(rootProps.slots.noResultsOverlay, _extends({}, rootProps.slotProps?.noResultsOverlay));
|
|
99
|
-
overlayType = 'noResultsOverlay';
|
|
100
|
-
}
|
|
101
|
-
if (loading) {
|
|
102
|
-
overlay = /*#__PURE__*/_jsx(rootProps.slots.loadingOverlay, _extends({}, rootProps.slotProps?.loadingOverlay));
|
|
103
|
-
overlayType = 'loadingOverlay';
|
|
104
|
-
}
|
|
105
|
-
if (overlay === null) {
|
|
90
|
+
if (!overlayType) {
|
|
106
91
|
return null;
|
|
107
92
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
const Overlay = rootProps.slots?.[overlayType];
|
|
94
|
+
const overlayProps = rootProps.slotProps?.[overlayType];
|
|
95
|
+
return /*#__PURE__*/_jsx(GridOverlayWrapper, _extends({}, props, {
|
|
96
|
+
children: /*#__PURE__*/_jsx(Overlay, _extends({}, overlayProps))
|
|
97
|
+
}));
|
|
112
98
|
}
|