@mui/x-data-grid 8.0.0-alpha.5 → 8.0.0-alpha.6
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 +79 -0
- package/DataGrid/DataGrid.js +4 -3
- package/components/GridColumnHeaders.d.ts +1 -1
- package/components/GridColumnHeaders.js +4 -4
- package/components/GridFooter.d.ts +2 -1
- package/components/GridFooter.js +4 -4
- package/components/GridLoadingOverlay.d.ts +1 -1
- package/components/GridLoadingOverlay.js +10 -8
- package/components/GridNoResultsOverlay.d.ts +2 -1
- package/components/GridNoResultsOverlay.js +4 -4
- package/components/GridNoRowsOverlay.d.ts +2 -1
- package/components/GridNoRowsOverlay.js +4 -4
- package/components/GridPagination.d.ts +1 -1
- package/components/GridPagination.js +5 -3
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +3 -2
- package/components/GridRowCount.d.ts +1 -1
- package/components/GridRowCount.js +3 -2
- package/components/GridSelectedRowCount.d.ts +4 -1
- package/components/GridSelectedRowCount.js +3 -2
- package/components/GridSkeletonLoadingOverlay.d.ts +1 -1
- package/components/GridSkeletonLoadingOverlay.js +4 -3
- package/components/cell/GridActionsCellItem.d.ts +1 -1
- package/components/cell/GridActionsCellItem.js +3 -2
- package/components/cell/GridCell.d.ts +1 -1
- package/components/cell/GridCell.js +3 -2
- package/components/cell/GridEditInputCell.d.ts +1 -1
- package/components/cell/GridEditInputCell.js +72 -3
- package/components/cell/GridSkeletonCell.js +1 -2
- package/components/columnHeaders/GridBaseColumnHeaders.d.ts +1 -1
- package/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
- package/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -1
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
- package/components/columnHeaders/GridIconButtonContainer.d.ts +1 -1
- package/components/columnHeaders/GridIconButtonContainer.js +5 -3
- package/components/columnSelection/GridCellCheckboxRenderer.d.ts +2 -2
- package/components/columnSelection/GridCellCheckboxRenderer.js +5 -3
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/columnSelection/GridHeaderCheckbox.js +5 -3
- package/components/containers/GridFooterContainer.d.ts +1 -1
- package/components/containers/GridFooterContainer.js +5 -3
- package/components/containers/GridOverlay.d.ts +1 -1
- package/components/containers/GridOverlay.js +5 -3
- package/components/containers/GridRoot.d.ts +1 -1
- package/components/containers/GridRoot.js +5 -3
- package/components/containers/GridToolbarContainer.d.ts +1 -1
- package/components/containers/GridToolbarContainer.js +3 -2
- package/components/menu/columnMenu/GridColumnMenu.d.ts +2 -2
- package/components/menu/columnMenu/GridColumnMenu.js +5 -5
- package/components/menu/columnMenu/GridColumnMenuContainer.d.ts +1 -1
- package/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/GridPanel.js +3 -2
- package/components/panel/GridPanelWrapper.d.ts +1 -1
- package/components/panel/GridPanelWrapper.js +5 -3
- package/components/panel/filterPanel/GridFilterForm.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +3 -2
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +9 -9
- package/components/panel/filterPanel/GridFilterInputValue.js +17 -10
- package/components/panel/filterPanel/GridFilterPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterPanel.js +4 -4
- package/components/panel/filterPanel/index.d.ts +2 -1
- package/components/panel/filterPanel/index.js +1 -1
- package/components/toolbar/GridToolbar.d.ts +1 -1
- package/components/toolbar/GridToolbar.js +4 -4
- package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +3 -2
- package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
- package/components/toolbar/GridToolbarDensitySelector.js +3 -2
- package/components/toolbar/GridToolbarExport.d.ts +1 -1
- package/components/toolbar/GridToolbarExport.js +2 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/components/toolbar/GridToolbarExportContainer.js +3 -2
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.js +3 -2
- package/components/virtualization/GridMainContainer.d.ts +3 -1
- package/components/virtualization/GridMainContainer.js +3 -2
- package/components/virtualization/GridVirtualScrollbar.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +2 -1
- package/components/virtualization/GridVirtualScrollerContent.d.ts +2 -0
- package/components/virtualization/GridVirtualScrollerContent.js +5 -5
- package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +2 -0
- package/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
- package/hooks/features/rows/useGridRowSpanning.js +76 -87
- package/index.js +1 -1
- package/locales/nlNL.js +5 -6
- package/material/index.js +6 -0
- package/models/gridBaseSlots.d.ts +15 -0
- package/models/gridSlotsComponent.d.ts +16 -1
- package/models/gridSlotsComponentsProps.d.ts +14 -1
- package/modern/DataGrid/DataGrid.js +4 -3
- package/modern/components/GridColumnHeaders.js +4 -4
- package/modern/components/GridFooter.js +4 -4
- package/modern/components/GridLoadingOverlay.js +10 -8
- package/modern/components/GridNoResultsOverlay.js +4 -4
- package/modern/components/GridNoRowsOverlay.js +4 -4
- package/modern/components/GridPagination.js +5 -3
- package/modern/components/GridRow.js +3 -2
- package/modern/components/GridRowCount.js +3 -2
- package/modern/components/GridSelectedRowCount.js +3 -2
- package/modern/components/GridSkeletonLoadingOverlay.js +4 -3
- package/modern/components/cell/GridActionsCellItem.js +3 -2
- package/modern/components/cell/GridCell.js +3 -2
- package/modern/components/cell/GridEditInputCell.js +72 -3
- package/modern/components/cell/GridSkeletonCell.js +1 -2
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
- package/modern/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
- package/modern/components/columnHeaders/GridIconButtonContainer.js +5 -3
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +5 -3
- package/modern/components/columnSelection/GridHeaderCheckbox.js +5 -3
- package/modern/components/containers/GridFooterContainer.js +5 -3
- package/modern/components/containers/GridOverlay.js +5 -3
- package/modern/components/containers/GridRoot.js +5 -3
- package/modern/components/containers/GridToolbarContainer.js +3 -2
- package/modern/components/menu/columnMenu/GridColumnMenu.js +5 -5
- package/modern/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
- package/modern/components/panel/GridPanel.js +3 -2
- package/modern/components/panel/GridPanelWrapper.js +5 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +3 -2
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +9 -9
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +17 -10
- package/modern/components/panel/filterPanel/GridFilterPanel.js +4 -4
- package/modern/components/panel/filterPanel/index.js +1 -1
- package/modern/components/toolbar/GridToolbar.js +4 -4
- package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -2
- package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -2
- package/modern/components/toolbar/GridToolbarExport.js +2 -1
- package/modern/components/toolbar/GridToolbarExportContainer.js +3 -2
- package/modern/components/toolbar/GridToolbarFilterButton.js +3 -2
- package/modern/components/virtualization/GridMainContainer.js +3 -2
- package/modern/components/virtualization/GridVirtualScrollbar.js +2 -1
- package/modern/components/virtualization/GridVirtualScrollerContent.js +5 -5
- package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
- package/modern/hooks/features/rows/useGridRowSpanning.js +76 -87
- package/modern/index.js +1 -1
- package/modern/locales/nlNL.js +5 -6
- package/modern/material/index.js +6 -0
- package/modern/utils/utils.js +6 -1
- package/node/DataGrid/DataGrid.js +4 -3
- package/node/components/GridColumnHeaders.js +4 -4
- package/node/components/GridFooter.js +4 -4
- package/node/components/GridLoadingOverlay.js +10 -8
- package/node/components/GridNoResultsOverlay.js +4 -4
- package/node/components/GridNoRowsOverlay.js +4 -4
- package/node/components/GridPagination.js +5 -3
- package/node/components/GridRow.js +3 -2
- package/node/components/GridRowCount.js +3 -2
- package/node/components/GridSelectedRowCount.js +3 -2
- package/node/components/GridSkeletonLoadingOverlay.js +4 -3
- package/node/components/cell/GridActionsCellItem.js +3 -2
- package/node/components/cell/GridCell.js +3 -2
- package/node/components/cell/GridEditInputCell.js +72 -3
- package/node/components/cell/GridSkeletonCell.js +1 -2
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +4 -3
- package/node/components/columnHeaders/GridColumnHeaderTitle.js +5 -3
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +3 -2
- package/node/components/columnHeaders/GridIconButtonContainer.js +5 -3
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +5 -3
- package/node/components/columnSelection/GridHeaderCheckbox.js +5 -3
- package/node/components/containers/GridFooterContainer.js +5 -3
- package/node/components/containers/GridOverlay.js +5 -3
- package/node/components/containers/GridRoot.js +5 -3
- package/node/components/containers/GridToolbarContainer.js +3 -2
- package/node/components/menu/columnMenu/GridColumnMenu.js +5 -5
- package/node/components/menu/columnMenu/GridColumnMenuContainer.js +3 -2
- package/node/components/panel/GridPanel.js +3 -2
- package/node/components/panel/GridPanelWrapper.js +5 -3
- package/node/components/panel/filterPanel/GridFilterForm.js +3 -2
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +10 -11
- package/node/components/panel/filterPanel/GridFilterInputValue.js +17 -10
- package/node/components/panel/filterPanel/GridFilterPanel.js +4 -4
- package/node/components/panel/filterPanel/index.js +7 -11
- package/node/components/toolbar/GridToolbar.js +4 -4
- package/node/components/toolbar/GridToolbarColumnsButton.js +3 -2
- package/node/components/toolbar/GridToolbarDensitySelector.js +3 -2
- package/node/components/toolbar/GridToolbarExport.js +2 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +3 -2
- package/node/components/toolbar/GridToolbarFilterButton.js +3 -2
- package/node/components/virtualization/GridMainContainer.js +3 -2
- package/node/components/virtualization/GridVirtualScrollbar.js +2 -1
- package/node/components/virtualization/GridVirtualScrollerContent.js +5 -5
- package/node/components/virtualization/GridVirtualScrollerRenderZone.js +5 -3
- package/node/hooks/features/rows/useGridRowSpanning.js +74 -85
- package/node/index.js +1 -1
- package/node/locales/nlNL.js +5 -6
- package/node/material/index.js +6 -0
- package/node/utils/utils.js +8 -1
- package/package.json +2 -2
- package/utils/utils.d.ts +1 -0
- package/utils/utils.js +6 -1
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { styled } from '@mui/system';
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
8
9
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
9
10
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
10
11
|
import { gridRowsMetaSelector } from "../../hooks/features/rows/index.js";
|
|
@@ -31,7 +32,7 @@ const VirtualScrollerRenderZoneRoot = styled('div', {
|
|
|
31
32
|
// Prevents margin collapsing when using `getRowSpacing`
|
|
32
33
|
flexDirection: 'column'
|
|
33
34
|
});
|
|
34
|
-
const GridVirtualScrollerRenderZone =
|
|
35
|
+
const GridVirtualScrollerRenderZone = forwardRef(function GridVirtualScrollerRenderZone(props, ref) {
|
|
35
36
|
const {
|
|
36
37
|
className
|
|
37
38
|
} = props,
|
|
@@ -45,12 +46,13 @@ const GridVirtualScrollerRenderZone = /*#__PURE__*/React.forwardRef(function Gri
|
|
|
45
46
|
return rowsMeta.positions[renderContext.firstRowIndex] ?? 0;
|
|
46
47
|
});
|
|
47
48
|
return /*#__PURE__*/_jsx(VirtualScrollerRenderZoneRoot, _extends({
|
|
48
|
-
ref: ref,
|
|
49
49
|
className: clsx(classes.root, className),
|
|
50
50
|
ownerState: rootProps,
|
|
51
51
|
style: {
|
|
52
52
|
transform: `translate3d(0, ${offsetTop}px, 0)`
|
|
53
53
|
}
|
|
54
|
-
}, other
|
|
54
|
+
}, other, {
|
|
55
|
+
ref: ref
|
|
56
|
+
}));
|
|
55
57
|
});
|
|
56
58
|
export { GridVirtualScrollerRenderZone };
|
|
@@ -3,12 +3,12 @@ import * as React from 'react';
|
|
|
3
3
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
4
4
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from "../../../internals/constants.js";
|
|
5
5
|
import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSelector.js";
|
|
6
|
-
import {
|
|
6
|
+
import { getVisibleRows } from "../../utils/useGridVisibleRows.js";
|
|
7
7
|
import { gridRenderContextSelector } from "../virtualization/gridVirtualizationSelectors.js";
|
|
8
|
-
import {
|
|
9
|
-
import { gridRowTreeSelector } from "./gridRowsSelector.js";
|
|
10
|
-
import { getUnprocessedRange, isRowRangeUpdated, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
|
|
8
|
+
import { getUnprocessedRange, isRowContextInitialized, getCellValue } from "./gridRowSpanningUtils.js";
|
|
11
9
|
import { GRID_CHECKBOX_SELECTION_FIELD } from "../../../colDef/gridCheckboxSelectionColDef.js";
|
|
10
|
+
import { useGridApiEventHandler } from "../../utils/useGridApiEventHandler.js";
|
|
11
|
+
import { runIf } from "../../../utils/utils.js";
|
|
12
12
|
const EMPTY_STATE = {
|
|
13
13
|
spannedCells: {},
|
|
14
14
|
hiddenCells: {},
|
|
@@ -53,8 +53,8 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
53
53
|
const backwardsHiddenCells = [];
|
|
54
54
|
if (index === rangeToProcess.firstRowIndex) {
|
|
55
55
|
let prevIndex = index - 1;
|
|
56
|
-
|
|
57
|
-
while (prevIndex >= range.firstRowIndex && getCellValue(prevRowEntry.model, colDef, apiRef) === cellValue) {
|
|
56
|
+
let prevRowEntry = visibleRows[prevIndex];
|
|
57
|
+
while (prevIndex >= range.firstRowIndex && prevRowEntry && getCellValue(prevRowEntry.model, colDef, apiRef) === cellValue) {
|
|
58
58
|
const currentRow = visibleRows[prevIndex + 1];
|
|
59
59
|
if (hiddenCells[currentRow.id]) {
|
|
60
60
|
hiddenCells[currentRow.id][colDef.field] = true;
|
|
@@ -68,6 +68,7 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
68
68
|
spannedRowId = prevRowEntry.id;
|
|
69
69
|
spannedRowIndex = prevIndex;
|
|
70
70
|
prevIndex -= 1;
|
|
71
|
+
prevRowEntry = visibleRows[prevIndex];
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
backwardsHiddenCells.forEach(hiddenCellIndex => {
|
|
@@ -130,74 +131,58 @@ const computeRowSpanningState = (apiRef, colDefs, visibleRows, range, rangeToPro
|
|
|
130
131
|
* @requires filterStateInitializer (method) - should be initialized before
|
|
131
132
|
*/
|
|
132
133
|
export const rowSpanningStateInitializer = (state, props, apiRef) => {
|
|
133
|
-
if (props.rowSpanning) {
|
|
134
|
-
const rowIds = state.rows.dataRowIds || [];
|
|
135
|
-
const orderedFields = state.columns.orderedFields || [];
|
|
136
|
-
const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
|
|
137
|
-
const columnsLookup = state.columns.lookup;
|
|
138
|
-
const isFilteringPending = Boolean(state.filter.filterModel.items.length) || Boolean(state.filter.filterModel.quickFilterValues?.length);
|
|
139
|
-
if (!rowIds.length || !orderedFields.length || !dataRowIdToModelLookup || !columnsLookup || isFilteringPending) {
|
|
140
|
-
return _extends({}, state, {
|
|
141
|
-
rowSpanning: EMPTY_STATE
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
const rangeToProcess = {
|
|
145
|
-
firstRowIndex: 0,
|
|
146
|
-
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
|
|
147
|
-
};
|
|
148
|
-
const rows = rowIds.map(id => ({
|
|
149
|
-
id,
|
|
150
|
-
model: dataRowIdToModelLookup[id]
|
|
151
|
-
}));
|
|
152
|
-
const colDefs = orderedFields.map(field => columnsLookup[field]);
|
|
153
|
-
const {
|
|
154
|
-
spannedCells,
|
|
155
|
-
hiddenCells,
|
|
156
|
-
hiddenCellOriginMap
|
|
157
|
-
} = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true, EMPTY_RANGE);
|
|
134
|
+
if (!props.rowSpanning) {
|
|
158
135
|
return _extends({}, state, {
|
|
159
|
-
rowSpanning:
|
|
160
|
-
spannedCells,
|
|
161
|
-
hiddenCells,
|
|
162
|
-
hiddenCellOriginMap
|
|
163
|
-
}
|
|
136
|
+
rowSpanning: EMPTY_STATE
|
|
164
137
|
});
|
|
165
138
|
}
|
|
139
|
+
const rowIds = state.rows.dataRowIds || [];
|
|
140
|
+
const orderedFields = state.columns.orderedFields || [];
|
|
141
|
+
const dataRowIdToModelLookup = state.rows.dataRowIdToModelLookup;
|
|
142
|
+
const columnsLookup = state.columns.lookup;
|
|
143
|
+
const isFilteringPending = Boolean(state.filter.filterModel.items.length) || Boolean(state.filter.filterModel.quickFilterValues?.length);
|
|
144
|
+
if (!rowIds.length || !orderedFields.length || !dataRowIdToModelLookup || !columnsLookup || isFilteringPending) {
|
|
145
|
+
return _extends({}, state, {
|
|
146
|
+
rowSpanning: EMPTY_STATE
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
const rangeToProcess = {
|
|
150
|
+
firstRowIndex: 0,
|
|
151
|
+
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(rowIds.length, 0))
|
|
152
|
+
};
|
|
153
|
+
const rows = rowIds.map(id => ({
|
|
154
|
+
id,
|
|
155
|
+
model: dataRowIdToModelLookup[id]
|
|
156
|
+
}));
|
|
157
|
+
const colDefs = orderedFields.map(field => columnsLookup[field]);
|
|
158
|
+
const {
|
|
159
|
+
spannedCells,
|
|
160
|
+
hiddenCells,
|
|
161
|
+
hiddenCellOriginMap
|
|
162
|
+
} = computeRowSpanningState(apiRef, colDefs, rows, rangeToProcess, rangeToProcess, true, EMPTY_RANGE);
|
|
166
163
|
return _extends({}, state, {
|
|
167
|
-
rowSpanning:
|
|
164
|
+
rowSpanning: {
|
|
165
|
+
spannedCells,
|
|
166
|
+
hiddenCells,
|
|
167
|
+
hiddenCellOriginMap
|
|
168
|
+
}
|
|
168
169
|
});
|
|
169
170
|
};
|
|
170
171
|
export const useGridRowSpanning = (apiRef, props) => {
|
|
171
|
-
const {
|
|
172
|
-
range,
|
|
173
|
-
rows: visibleRows
|
|
174
|
-
} = useGridVisibleRows(apiRef, props);
|
|
175
|
-
const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
|
|
176
|
-
const colDefs = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
177
|
-
const tree = useGridSelector(apiRef, gridRowTreeSelector);
|
|
178
172
|
const processedRange = useLazyRef(() => {
|
|
179
173
|
return Object.keys(apiRef.current.state.rowSpanning.spannedCells).length > 0 ? {
|
|
180
174
|
firstRowIndex: 0,
|
|
181
175
|
lastRowIndex: Math.min(DEFAULT_ROWS_TO_PROCESS, Math.max(apiRef.current.state.rows.dataRowIds.length, 0))
|
|
182
176
|
} : EMPTY_RANGE;
|
|
183
177
|
});
|
|
184
|
-
const
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
(resetState = true) => {
|
|
193
|
-
if (!props.rowSpanning) {
|
|
194
|
-
if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
|
|
195
|
-
apiRef.current.setState(state => _extends({}, state, {
|
|
196
|
-
rowSpanning: EMPTY_STATE
|
|
197
|
-
}));
|
|
198
|
-
}
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
178
|
+
const updateRowSpanningState = React.useCallback((renderContext, resetState = false) => {
|
|
179
|
+
const {
|
|
180
|
+
range,
|
|
181
|
+
rows: visibleRows
|
|
182
|
+
} = getVisibleRows(apiRef, {
|
|
183
|
+
pagination: props.pagination,
|
|
184
|
+
paginationMode: props.paginationMode
|
|
185
|
+
});
|
|
201
186
|
if (range === null || !isRowContextInitialized(renderContext)) {
|
|
202
187
|
return;
|
|
203
188
|
}
|
|
@@ -211,6 +196,7 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
211
196
|
if (rangeToProcess === null) {
|
|
212
197
|
return;
|
|
213
198
|
}
|
|
199
|
+
const colDefs = gridVisibleColumnDefinitionsSelector(apiRef);
|
|
214
200
|
const {
|
|
215
201
|
spannedCells,
|
|
216
202
|
hiddenCells,
|
|
@@ -223,7 +209,8 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
223
209
|
const currentSpannedCellsCount = Object.keys(apiRef.current.state.rowSpanning.spannedCells).length;
|
|
224
210
|
const currentHiddenCellsCount = Object.keys(apiRef.current.state.rowSpanning.hiddenCells).length;
|
|
225
211
|
const shouldUpdateState = resetState || newSpannedCellsCount !== currentSpannedCellsCount || newHiddenCellsCount !== currentHiddenCellsCount;
|
|
226
|
-
|
|
212
|
+
const hasNoSpannedCells = newSpannedCellsCount === 0 && currentSpannedCellsCount === 0;
|
|
213
|
+
if (!shouldUpdateState || hasNoSpannedCells) {
|
|
227
214
|
return;
|
|
228
215
|
}
|
|
229
216
|
apiRef.current.setState(state => {
|
|
@@ -235,33 +222,35 @@ export const useGridRowSpanning = (apiRef, props) => {
|
|
|
235
222
|
}
|
|
236
223
|
});
|
|
237
224
|
});
|
|
238
|
-
}, [apiRef, props.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if (
|
|
249
|
-
previousTree.current = tree;
|
|
250
|
-
updateRowSpanningState(true);
|
|
225
|
+
}, [apiRef, processedRange, props.pagination, props.paginationMode]);
|
|
226
|
+
|
|
227
|
+
// Reset events trigger a full re-computation of the row spanning state:
|
|
228
|
+
// - The `unstable_rowSpanning` prop is updated (feature flag)
|
|
229
|
+
// - The filtering is applied
|
|
230
|
+
// - The sorting is applied
|
|
231
|
+
// - The `paginationModel` is updated
|
|
232
|
+
// - The rows are updated
|
|
233
|
+
const resetRowSpanningState = React.useCallback(() => {
|
|
234
|
+
const renderContext = gridRenderContextSelector(apiRef);
|
|
235
|
+
if (!isRowContextInitialized(renderContext)) {
|
|
251
236
|
return;
|
|
252
237
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
238
|
+
updateRowSpanningState(renderContext, true);
|
|
239
|
+
}, [apiRef, updateRowSpanningState]);
|
|
240
|
+
useGridApiEventHandler(apiRef, 'renderedRowsIntervalChange', runIf(props.rowSpanning, updateRowSpanningState));
|
|
241
|
+
useGridApiEventHandler(apiRef, 'sortedRowsSet', runIf(props.rowSpanning, resetRowSpanningState));
|
|
242
|
+
useGridApiEventHandler(apiRef, 'paginationModelChange', runIf(props.rowSpanning, resetRowSpanningState));
|
|
243
|
+
useGridApiEventHandler(apiRef, 'filteredRowsSet', runIf(props.rowSpanning, resetRowSpanningState));
|
|
244
|
+
useGridApiEventHandler(apiRef, 'columnsChange', runIf(props.rowSpanning, resetRowSpanningState));
|
|
245
|
+
React.useEffect(() => {
|
|
246
|
+
if (!props.rowSpanning) {
|
|
247
|
+
if (apiRef.current.state.rowSpanning !== EMPTY_STATE) {
|
|
248
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
249
|
+
rowSpanning: EMPTY_STATE
|
|
250
|
+
}));
|
|
261
251
|
}
|
|
262
|
-
|
|
263
|
-
|
|
252
|
+
} else if (apiRef.current.state.rowSpanning === EMPTY_STATE) {
|
|
253
|
+
resetRowSpanningState();
|
|
264
254
|
}
|
|
265
|
-
|
|
266
|
-
}, [updateRowSpanningState, renderContext, range, lastRange, tree]);
|
|
255
|
+
}, [apiRef, resetRowSpanningState, props.rowSpanning]);
|
|
267
256
|
};
|
package/index.js
CHANGED
package/locales/nlNL.js
CHANGED
|
@@ -45,8 +45,7 @@ const nlNLGrid = {
|
|
|
45
45
|
columnsManagementNoColumns: 'Geen kolommen',
|
|
46
46
|
columnsManagementShowHideAllText: 'Toon/Verberg Alle',
|
|
47
47
|
columnsManagementReset: 'Reset',
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
columnsManagementDeleteIconLabel: 'Verwijderen',
|
|
50
49
|
// Filter panel text
|
|
51
50
|
filterPanelAddFilter: 'Filter toevoegen',
|
|
52
51
|
filterPanelRemoveAll: 'Alles verwijderen',
|
|
@@ -60,9 +59,9 @@ const nlNLGrid = {
|
|
|
60
59
|
filterPanelInputPlaceholder: 'Filter waarde',
|
|
61
60
|
// Filter operators text
|
|
62
61
|
filterOperatorContains: 'bevat',
|
|
63
|
-
|
|
62
|
+
filterOperatorDoesNotContain: 'bevat niet',
|
|
64
63
|
filterOperatorEquals: 'gelijk aan',
|
|
65
|
-
|
|
64
|
+
filterOperatorDoesNotEqual: 'niet gelijk aan',
|
|
66
65
|
filterOperatorStartsWith: 'begint met',
|
|
67
66
|
filterOperatorEndsWith: 'eindigt met',
|
|
68
67
|
filterOperatorIs: 'is',
|
|
@@ -82,9 +81,9 @@ const nlNLGrid = {
|
|
|
82
81
|
'filterOperator<=': '<=',
|
|
83
82
|
// Header filter operators text
|
|
84
83
|
headerFilterOperatorContains: 'Bevat',
|
|
85
|
-
|
|
84
|
+
headerFilterOperatorDoesNotContain: 'Bevat niet',
|
|
86
85
|
headerFilterOperatorEquals: 'Gelijk aan',
|
|
87
|
-
|
|
86
|
+
headerFilterOperatorDoesNotEqual: 'Niet gelijk aan',
|
|
88
87
|
headerFilterOperatorStartsWith: 'Begint met',
|
|
89
88
|
headerFilterOperatorEndsWith: 'Eindigt met',
|
|
90
89
|
headerFilterOperatorIs: 'Is',
|
package/material/index.js
CHANGED
|
@@ -4,7 +4,9 @@ const _excluded = ["inert", "iconStart", "iconEnd", "children"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import MUIBadge from '@mui/material/Badge';
|
|
6
6
|
import MUICheckbox from '@mui/material/Checkbox';
|
|
7
|
+
import MUICircularProgress from '@mui/material/CircularProgress';
|
|
7
8
|
import MUIDivider from '@mui/material/Divider';
|
|
9
|
+
import MUILinearProgress from '@mui/material/LinearProgress';
|
|
8
10
|
import MUIListItemIcon from '@mui/material/ListItemIcon';
|
|
9
11
|
import MUIListItemText from '@mui/material/ListItemText';
|
|
10
12
|
import MUIMenuList from '@mui/material/MenuList';
|
|
@@ -19,6 +21,7 @@ import MUITooltip from '@mui/material/Tooltip';
|
|
|
19
21
|
import MUIPopper from '@mui/material/Popper';
|
|
20
22
|
import MUIInputLabel from '@mui/material/InputLabel';
|
|
21
23
|
import MUIChip from '@mui/material/Chip';
|
|
24
|
+
import MUISkeleton from '@mui/material/Skeleton';
|
|
22
25
|
import { GridColumnUnsortedIcon } from "./icons/GridColumnUnsortedIcon.js";
|
|
23
26
|
import { GridAddIcon, GridArrowDownwardIcon, GridArrowUpwardIcon, GridCheckIcon, GridCloseIcon, GridColumnIcon, GridDragIcon, GridExpandMoreIcon, GridFilterAltIcon, GridFilterListIcon, GridKeyboardArrowRight, GridMoreVertIcon, GridRemoveIcon, GridSaveAltIcon, GridSearchIcon, GridSeparatorIcon, GridTableRowsIcon, GridTripleDotsVerticalIcon, GridViewHeadlineIcon, GridViewStreamIcon, GridVisibilityOffIcon, GridViewColumnIcon, GridClearIcon, GridLoadIcon, GridDeleteForeverIcon } from "./icons/index.js";
|
|
24
27
|
import MUISelectOption from "./components/MUISelectOption.js";
|
|
@@ -63,7 +66,9 @@ const iconSlots = {
|
|
|
63
66
|
const baseSlots = {
|
|
64
67
|
baseBadge: MUIBadge,
|
|
65
68
|
baseCheckbox: MUICheckbox,
|
|
69
|
+
baseCircularProgress: MUICircularProgress,
|
|
66
70
|
baseDivider: MUIDivider,
|
|
71
|
+
baseLinearProgress: MUILinearProgress,
|
|
67
72
|
baseMenuList: MUIMenuList,
|
|
68
73
|
baseMenuItem: BaseMenuItem,
|
|
69
74
|
baseTextField: MUITextField,
|
|
@@ -76,6 +81,7 @@ const baseSlots = {
|
|
|
76
81
|
basePopper: MUIPopper,
|
|
77
82
|
baseInputLabel: MUIInputLabel,
|
|
78
83
|
baseSelectOption: MUISelectOption,
|
|
84
|
+
baseSkeleton: MUISkeleton,
|
|
79
85
|
baseChip: MUIChip
|
|
80
86
|
};
|
|
81
87
|
const materialSlots = _extends({}, baseSlots, iconSlots);
|
|
@@ -19,3 +19,18 @@ export type MenuItemProps = {
|
|
|
19
19
|
selected?: boolean;
|
|
20
20
|
value?: number | string | readonly string[];
|
|
21
21
|
};
|
|
22
|
+
export type CircularProgressProps = {
|
|
23
|
+
/**
|
|
24
|
+
* Pixels or CSS value.
|
|
25
|
+
* @default 40
|
|
26
|
+
*/
|
|
27
|
+
size?: number | string;
|
|
28
|
+
/** @default 'primary' */
|
|
29
|
+
color?: 'inherit' | 'primary';
|
|
30
|
+
};
|
|
31
|
+
export type LinearProgressProps = {};
|
|
32
|
+
export type SkeletonProps = {
|
|
33
|
+
variant?: 'circular' | 'text';
|
|
34
|
+
width?: number | string;
|
|
35
|
+
height?: number | string;
|
|
36
|
+
};
|
|
@@ -13,6 +13,11 @@ export interface GridBaseSlots {
|
|
|
13
13
|
* @default Checkbox
|
|
14
14
|
*/
|
|
15
15
|
baseCheckbox: React.JSXElementConstructor<GridSlotProps['baseCheckbox']>;
|
|
16
|
+
/**
|
|
17
|
+
* The custom CircularProgress component used in the grid.
|
|
18
|
+
* @default CircularProgress
|
|
19
|
+
*/
|
|
20
|
+
baseCircularProgress: React.JSXElementConstructor<GridSlotProps['baseCircularProgress']>;
|
|
16
21
|
/**
|
|
17
22
|
* The custom Chip component used in the grid.
|
|
18
23
|
* @default Chip
|
|
@@ -23,6 +28,11 @@ export interface GridBaseSlots {
|
|
|
23
28
|
* @default Divider
|
|
24
29
|
*/
|
|
25
30
|
baseDivider: React.JSXElementConstructor<GridSlotProps['baseDivider']>;
|
|
31
|
+
/**
|
|
32
|
+
* The custom LinearProgress component used in the grid.
|
|
33
|
+
* @default LinearProgress
|
|
34
|
+
*/
|
|
35
|
+
baseLinearProgress: React.JSXElementConstructor<GridSlotProps['baseLinearProgress']>;
|
|
26
36
|
/**
|
|
27
37
|
* The custom MenuList component used in the grid.
|
|
28
38
|
* @default MenuList
|
|
@@ -80,9 +90,14 @@ export interface GridBaseSlots {
|
|
|
80
90
|
baseInputLabel: React.JSXElementConstructor<GridSlotProps['baseInputLabel']>;
|
|
81
91
|
/**
|
|
82
92
|
* The custom SelectOption component used in the grid.
|
|
83
|
-
* @default
|
|
93
|
+
* @default SelectOption
|
|
84
94
|
*/
|
|
85
95
|
baseSelectOption: React.JSXElementConstructor<GridSlotProps['baseSelectOption']>;
|
|
96
|
+
/**
|
|
97
|
+
* The custom Skeleton component used in the grid.
|
|
98
|
+
* @default Skeleton
|
|
99
|
+
*/
|
|
100
|
+
baseSkeleton: React.JSXElementConstructor<GridSlotProps['baseSkeleton']>;
|
|
86
101
|
}
|
|
87
102
|
/**
|
|
88
103
|
* Grid components React prop interface containing all the overridable components.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { BadgeProps as MUIBadgeProps } from '@mui/material/Badge';
|
|
3
3
|
import type { CheckboxProps } from '@mui/material/Checkbox';
|
|
4
|
+
import type { CircularProgressProps as MUICircularProgressProps } from '@mui/material/CircularProgress';
|
|
5
|
+
import type { LinearProgressProps as MUILinearProgressProps } from '@mui/material/LinearProgress';
|
|
4
6
|
import type { MenuListProps } from '@mui/material/MenuList';
|
|
5
7
|
import type { MenuItemProps as MUIMenuItemProps } from '@mui/material/MenuItem';
|
|
6
8
|
import type { TextFieldProps } from '@mui/material/TextField';
|
|
@@ -33,15 +35,19 @@ import type { GridColumnsManagementProps } from '../components/columnsManagement
|
|
|
33
35
|
import type { GridLoadingOverlayProps } from '../components/GridLoadingOverlay';
|
|
34
36
|
import type { GridRowCountProps } from '../components/GridRowCount';
|
|
35
37
|
import type { GridColumnHeaderSortIconProps } from '../components/columnHeaders/GridColumnHeaderSortIcon';
|
|
36
|
-
import type { BadgeProps, DividerProps, MenuItemProps } from './gridBaseSlots';
|
|
38
|
+
import type { BadgeProps, CircularProgressProps, DividerProps, LinearProgressProps, MenuItemProps, SkeletonProps } from './gridBaseSlots';
|
|
37
39
|
type RootProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
|
|
38
40
|
type MainProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
|
|
39
41
|
export interface BaseBadgePropsOverrides {
|
|
40
42
|
}
|
|
41
43
|
export interface BaseCheckboxPropsOverrides {
|
|
42
44
|
}
|
|
45
|
+
export interface BaseCircularProgressPropsOverrides {
|
|
46
|
+
}
|
|
43
47
|
export interface BaseDividerPropsOverrides {
|
|
44
48
|
}
|
|
49
|
+
export interface BaseLinearProgressPropsOverrides {
|
|
50
|
+
}
|
|
45
51
|
export interface BaseMenuListPropsOverrides {
|
|
46
52
|
}
|
|
47
53
|
export interface BaseMenuItemPropsOverrides {
|
|
@@ -68,6 +74,8 @@ export interface BaseInputLabelPropsOverrides {
|
|
|
68
74
|
}
|
|
69
75
|
export interface BaseSelectOptionPropsOverrides {
|
|
70
76
|
}
|
|
77
|
+
export interface BaseSkeletonPropsOverrides {
|
|
78
|
+
}
|
|
71
79
|
export interface BaseChipPropsOverrides {
|
|
72
80
|
}
|
|
73
81
|
export interface CellPropsOverrides {
|
|
@@ -111,7 +119,9 @@ export interface RowPropsOverrides {
|
|
|
111
119
|
interface BaseSlotProps {
|
|
112
120
|
baseBadge: BadgeProps & BaseBadgePropsOverrides;
|
|
113
121
|
baseCheckbox: CheckboxProps & BaseCheckboxPropsOverrides;
|
|
122
|
+
baseCircularProgress: CircularProgressProps & BaseCircularProgressPropsOverrides;
|
|
114
123
|
baseDivider: DividerProps & BaseDividerPropsOverrides;
|
|
124
|
+
baseLinearProgress: LinearProgressProps & BaseLinearProgressPropsOverrides;
|
|
115
125
|
baseMenuList: MenuListProps & BaseMenuListPropsOverrides;
|
|
116
126
|
baseMenuItem: MenuItemProps & BaseMenuItemPropsOverrides;
|
|
117
127
|
baseTextField: TextFieldProps & BaseTextFieldPropsOverrides;
|
|
@@ -129,10 +139,13 @@ interface BaseSlotProps {
|
|
|
129
139
|
value: any;
|
|
130
140
|
children?: React.ReactNode;
|
|
131
141
|
} & BaseSelectOptionPropsOverrides;
|
|
142
|
+
baseSkeleton: SkeletonProps & BaseSkeletonPropsOverrides;
|
|
132
143
|
baseChip: ChipProps & BaseChipPropsOverrides;
|
|
133
144
|
}
|
|
134
145
|
interface MaterialSlotProps {
|
|
135
146
|
baseBadge: MUIBadgeProps;
|
|
147
|
+
baseCircularProgress: MUICircularProgressProps;
|
|
148
|
+
baseLinearProgress: MUILinearProgressProps;
|
|
136
149
|
baseMenuItem: MUIMenuItemProps;
|
|
137
150
|
}
|
|
138
151
|
interface ElementSlotProps {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
6
7
|
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot } from "../components/index.js";
|
|
7
8
|
import { useGridAriaAttributes } from "../hooks/utils/useGridAriaAttributes.js";
|
|
8
9
|
import { useGridRowAriaAttributes } from "../hooks/features/rows/useGridRowAriaAttributes.js";
|
|
@@ -23,7 +24,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
23
24
|
// Only validate in MIT version
|
|
24
25
|
props => props.columns && props.columns.some(column => column.resizable) && [`MUI X: \`column.resizable = true\` is not a valid prop.`, 'Column resizing is not available in the MIT version.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n') || undefined];
|
|
25
26
|
}
|
|
26
|
-
const DataGridRaw =
|
|
27
|
+
const DataGridRaw = forwardRef(function DataGrid(inProps, ref) {
|
|
27
28
|
const props = useDataGridProps(inProps);
|
|
28
29
|
const privateApiRef = useDataGridComponent(props.apiRef, props);
|
|
29
30
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -36,9 +37,9 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
|
|
|
36
37
|
children: /*#__PURE__*/_jsxs(GridRoot, _extends({
|
|
37
38
|
className: props.className,
|
|
38
39
|
style: props.style,
|
|
39
|
-
sx: props.sx
|
|
40
|
-
ref: ref
|
|
40
|
+
sx: props.sx
|
|
41
41
|
}, props.slotProps?.root, {
|
|
42
|
+
ref: ref,
|
|
42
43
|
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {}), /*#__PURE__*/_jsx(GridFooterPlaceholder, {})]
|
|
43
44
|
}))
|
|
44
45
|
});
|
|
@@ -4,10 +4,11 @@ const _excluded = ["className", "visibleColumns", "sortColumnLookup", "filterCol
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { fastMemo } from '@mui/x-internals/fastMemo';
|
|
7
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
7
8
|
import { useGridColumnHeaders } from "../hooks/features/columnHeaders/useGridColumnHeaders.js";
|
|
8
9
|
import { GridBaseColumnHeaders } from "./columnHeaders/GridBaseColumnHeaders.js";
|
|
9
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
const GridColumnHeaders =
|
|
11
|
+
const GridColumnHeaders = forwardRef(function GridColumnHeaders(props, ref) {
|
|
11
12
|
const {
|
|
12
13
|
visibleColumns,
|
|
13
14
|
sortColumnLookup,
|
|
@@ -41,9 +42,8 @@ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeade
|
|
|
41
42
|
columnGroupsHeaderStructure,
|
|
42
43
|
hasOtherElementInTabSequence
|
|
43
44
|
});
|
|
44
|
-
return /*#__PURE__*/_jsxs(GridBaseColumnHeaders, _extends({
|
|
45
|
-
ref: ref
|
|
46
|
-
}, other, getInnerProps(), {
|
|
45
|
+
return /*#__PURE__*/_jsxs(GridBaseColumnHeaders, _extends({}, other, getInnerProps(), {
|
|
46
|
+
ref: ref,
|
|
47
47
|
children: [getColumnGroupHeadersRows(), getColumnHeadersRow()]
|
|
48
48
|
}));
|
|
49
49
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
4
5
|
import { useGridSelector } from "../hooks/utils/useGridSelector.js";
|
|
5
6
|
import { gridTopLevelRowCountSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
6
7
|
import { selectedGridRowsCountSelector } from "../hooks/features/rowSelection/gridRowSelectionSelector.js";
|
|
@@ -10,7 +11,7 @@ import { GridSelectedRowCount } from "./GridSelectedRowCount.js";
|
|
|
10
11
|
import { GridFooterContainer } from "./containers/GridFooterContainer.js";
|
|
11
12
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
12
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
const GridFooter =
|
|
14
|
+
const GridFooter = forwardRef(function GridFooter(props, ref) {
|
|
14
15
|
const apiRef = useGridApiContext();
|
|
15
16
|
const rootProps = useGridRootProps();
|
|
16
17
|
const totalTopLevelRowCount = useGridSelector(apiRef, gridTopLevelRowCountSelector);
|
|
@@ -24,9 +25,8 @@ const GridFooter = /*#__PURE__*/React.forwardRef(function GridFooter(props, ref)
|
|
|
24
25
|
visibleRowCount: visibleTopLevelRowCount
|
|
25
26
|
})) : null;
|
|
26
27
|
const paginationElement = rootProps.pagination && !rootProps.hideFooterPagination && rootProps.slots.pagination && /*#__PURE__*/_jsx(rootProps.slots.pagination, _extends({}, rootProps.slotProps?.pagination));
|
|
27
|
-
return /*#__PURE__*/_jsxs(GridFooterContainer, _extends({
|
|
28
|
-
ref: ref
|
|
29
|
-
}, props, {
|
|
28
|
+
return /*#__PURE__*/_jsxs(GridFooterContainer, _extends({}, props, {
|
|
29
|
+
ref: ref,
|
|
30
30
|
children: [selectedRowCountElement, rowCountElement, paginationElement]
|
|
31
31
|
}));
|
|
32
32
|
});
|
|
@@ -3,8 +3,8 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["variant", "noRowsVariant", "style"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
7
|
+
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
8
8
|
import { GridOverlay } from "./containers/GridOverlay.js";
|
|
9
9
|
import { GridSkeletonLoadingOverlay } from "./GridSkeletonLoadingOverlay.js";
|
|
10
10
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
@@ -12,23 +12,23 @@ import { gridRowCountSelector, useGridSelector } from "../hooks/index.js";
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
const LOADING_VARIANTS = {
|
|
14
14
|
'circular-progress': {
|
|
15
|
-
component:
|
|
15
|
+
component: rootProps => rootProps.slots.baseCircularProgress,
|
|
16
16
|
style: {}
|
|
17
17
|
},
|
|
18
18
|
'linear-progress': {
|
|
19
|
-
component:
|
|
19
|
+
component: rootProps => rootProps.slots.baseLinearProgress,
|
|
20
20
|
style: {
|
|
21
21
|
display: 'block'
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
skeleton: {
|
|
25
|
-
component: GridSkeletonLoadingOverlay,
|
|
25
|
+
component: () => GridSkeletonLoadingOverlay,
|
|
26
26
|
style: {
|
|
27
27
|
display: 'block'
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
const GridLoadingOverlay =
|
|
31
|
+
const GridLoadingOverlay = forwardRef(function GridLoadingOverlay(props, ref) {
|
|
32
32
|
const {
|
|
33
33
|
variant = 'linear-progress',
|
|
34
34
|
noRowsVariant = 'skeleton',
|
|
@@ -36,13 +36,15 @@ const GridLoadingOverlay = /*#__PURE__*/React.forwardRef(function GridLoadingOve
|
|
|
36
36
|
} = props,
|
|
37
37
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
38
|
const apiRef = useGridApiContext();
|
|
39
|
+
const rootProps = useGridRootProps();
|
|
39
40
|
const rowsCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
40
41
|
const activeVariant = LOADING_VARIANTS[rowsCount === 0 ? noRowsVariant : variant];
|
|
42
|
+
const Component = activeVariant.component(rootProps);
|
|
41
43
|
return /*#__PURE__*/_jsx(GridOverlay, _extends({
|
|
42
|
-
ref: ref,
|
|
43
44
|
style: _extends({}, activeVariant.style, style)
|
|
44
45
|
}, other, {
|
|
45
|
-
|
|
46
|
+
ref: ref,
|
|
47
|
+
children: /*#__PURE__*/_jsx(Component, {})
|
|
46
48
|
}));
|
|
47
49
|
});
|
|
48
50
|
process.env.NODE_ENV !== "production" ? GridLoadingOverlay.propTypes = {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
3
4
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
4
5
|
import { GridOverlay } from "./containers/GridOverlay.js";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
export const GridNoResultsOverlay =
|
|
7
|
+
export const GridNoResultsOverlay = forwardRef(function GridNoResultsOverlay(props, ref) {
|
|
7
8
|
const apiRef = useGridApiContext();
|
|
8
9
|
const noResultsOverlayLabel = apiRef.current.getLocaleText('noResultsOverlayLabel');
|
|
9
|
-
return /*#__PURE__*/_jsx(GridOverlay, _extends({
|
|
10
|
-
ref: ref
|
|
11
|
-
}, props, {
|
|
10
|
+
return /*#__PURE__*/_jsx(GridOverlay, _extends({}, props, {
|
|
11
|
+
ref: ref,
|
|
12
12
|
children: noResultsOverlayLabel
|
|
13
13
|
}));
|
|
14
14
|
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
4
5
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
5
6
|
import { GridOverlay } from "./containers/GridOverlay.js";
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const GridNoRowsOverlay =
|
|
8
|
+
const GridNoRowsOverlay = forwardRef(function GridNoRowsOverlay(props, ref) {
|
|
8
9
|
const apiRef = useGridApiContext();
|
|
9
10
|
const noRowsLabel = apiRef.current.getLocaleText('noRowsLabel');
|
|
10
|
-
return /*#__PURE__*/_jsx(GridOverlay, _extends({
|
|
11
|
-
ref: ref
|
|
12
|
-
}, props, {
|
|
11
|
+
return /*#__PURE__*/_jsx(GridOverlay, _extends({}, props, {
|
|
12
|
+
ref: ref,
|
|
13
13
|
children: noRowsLabel
|
|
14
14
|
}));
|
|
15
15
|
});
|