@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
|
@@ -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/modern/index.js
CHANGED
package/modern/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/modern/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);
|
package/modern/utils/utils.js
CHANGED
|
@@ -196,4 +196,9 @@ export function deepClone(obj) {
|
|
|
196
196
|
* of a `eslint-disable-next-line react-hooks/exhaustive-deps` because
|
|
197
197
|
* that hint disables checks on all values instead of just one.
|
|
198
198
|
*/
|
|
199
|
-
export function eslintUseValue(_) {}
|
|
199
|
+
export function eslintUseValue(_) {}
|
|
200
|
+
export const runIf = (condition, fn) => params => {
|
|
201
|
+
if (condition) {
|
|
202
|
+
fn(params);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
@@ -10,6 +10,7 @@ exports.DataGrid = void 0;
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
13
14
|
var _components = require("../components");
|
|
14
15
|
var _useGridAriaAttributes = require("../hooks/utils/useGridAriaAttributes");
|
|
15
16
|
var _useGridRowAriaAttributes = require("../hooks/features/rows/useGridRowAriaAttributes");
|
|
@@ -30,7 +31,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
30
31
|
// Only validate in MIT version
|
|
31
32
|
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];
|
|
32
33
|
}
|
|
33
|
-
const DataGridRaw =
|
|
34
|
+
const DataGridRaw = (0, _forwardRef.forwardRef)(function DataGrid(inProps, ref) {
|
|
34
35
|
const props = (0, _useDataGridProps.useDataGridProps)(inProps);
|
|
35
36
|
const privateApiRef = (0, _useDataGridComponent.useDataGridComponent)(props.apiRef, props);
|
|
36
37
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -43,9 +44,9 @@ const DataGridRaw = /*#__PURE__*/React.forwardRef(function DataGrid(inProps, ref
|
|
|
43
44
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.GridRoot, (0, _extends2.default)({
|
|
44
45
|
className: props.className,
|
|
45
46
|
style: props.style,
|
|
46
|
-
sx: props.sx
|
|
47
|
-
ref: ref
|
|
47
|
+
sx: props.sx
|
|
48
48
|
}, props.slotProps?.root, {
|
|
49
|
+
ref: ref,
|
|
49
50
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridHeader, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridBody, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.GridFooterPlaceholder, {})]
|
|
50
51
|
}))
|
|
51
52
|
});
|
|
@@ -11,11 +11,12 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
14
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
14
15
|
var _useGridColumnHeaders = require("../hooks/features/columnHeaders/useGridColumnHeaders");
|
|
15
16
|
var _GridBaseColumnHeaders = require("./columnHeaders/GridBaseColumnHeaders");
|
|
16
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
18
|
const _excluded = ["className", "visibleColumns", "sortColumnLookup", "filterColumnLookup", "columnHeaderTabIndexState", "columnGroupHeaderTabIndexState", "columnHeaderFocus", "columnGroupHeaderFocus", "headerGroupingMaxDepth", "columnMenuState", "columnVisibility", "columnGroupsHeaderStructure", "hasOtherElementInTabSequence"];
|
|
18
|
-
const GridColumnHeaders =
|
|
19
|
+
const GridColumnHeaders = (0, _forwardRef.forwardRef)(function GridColumnHeaders(props, ref) {
|
|
19
20
|
const {
|
|
20
21
|
visibleColumns,
|
|
21
22
|
sortColumnLookup,
|
|
@@ -49,9 +50,8 @@ const GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeade
|
|
|
49
50
|
columnGroupsHeaderStructure,
|
|
50
51
|
hasOtherElementInTabSequence
|
|
51
52
|
});
|
|
52
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridBaseColumnHeaders.GridBaseColumnHeaders, (0, _extends2.default)({
|
|
53
|
-
ref: ref
|
|
54
|
-
}, other, getInnerProps(), {
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridBaseColumnHeaders.GridBaseColumnHeaders, (0, _extends2.default)({}, other, getInnerProps(), {
|
|
54
|
+
ref: ref,
|
|
55
55
|
children: [getColumnGroupHeadersRows(), getColumnHeadersRow()]
|
|
56
56
|
}));
|
|
57
57
|
});
|
|
@@ -9,6 +9,7 @@ exports.GridFooter = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
12
13
|
var _useGridSelector = require("../hooks/utils/useGridSelector");
|
|
13
14
|
var _gridRowsSelector = require("../hooks/features/rows/gridRowsSelector");
|
|
14
15
|
var _gridRowSelectionSelector = require("../hooks/features/rowSelection/gridRowSelectionSelector");
|
|
@@ -18,7 +19,7 @@ var _GridSelectedRowCount = require("./GridSelectedRowCount");
|
|
|
18
19
|
var _GridFooterContainer = require("./containers/GridFooterContainer");
|
|
19
20
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
20
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
const GridFooter = exports.GridFooter =
|
|
22
|
+
const GridFooter = exports.GridFooter = (0, _forwardRef.forwardRef)(function GridFooter(props, ref) {
|
|
22
23
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
23
24
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
24
25
|
const totalTopLevelRowCount = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridTopLevelRowCountSelector);
|
|
@@ -32,9 +33,8 @@ const GridFooter = exports.GridFooter = /*#__PURE__*/React.forwardRef(function G
|
|
|
32
33
|
visibleRowCount: visibleTopLevelRowCount
|
|
33
34
|
})) : null;
|
|
34
35
|
const paginationElement = rootProps.pagination && !rootProps.hideFooterPagination && rootProps.slots.pagination && /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.pagination, (0, _extends2.default)({}, rootProps.slotProps?.pagination));
|
|
35
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridFooterContainer.GridFooterContainer, (0, _extends2.default)({
|
|
36
|
-
ref: ref
|
|
37
|
-
}, props, {
|
|
36
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridFooterContainer.GridFooterContainer, (0, _extends2.default)({}, props, {
|
|
37
|
+
ref: ref,
|
|
38
38
|
children: [selectedRowCountElement, rowCountElement, paginationElement]
|
|
39
39
|
}));
|
|
40
40
|
});
|
|
@@ -10,8 +10,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
14
|
+
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
15
15
|
var _GridOverlay = require("./containers/GridOverlay");
|
|
16
16
|
var _GridSkeletonLoadingOverlay = require("./GridSkeletonLoadingOverlay");
|
|
17
17
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
@@ -20,23 +20,23 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
20
20
|
const _excluded = ["variant", "noRowsVariant", "style"];
|
|
21
21
|
const LOADING_VARIANTS = {
|
|
22
22
|
'circular-progress': {
|
|
23
|
-
component:
|
|
23
|
+
component: rootProps => rootProps.slots.baseCircularProgress,
|
|
24
24
|
style: {}
|
|
25
25
|
},
|
|
26
26
|
'linear-progress': {
|
|
27
|
-
component:
|
|
27
|
+
component: rootProps => rootProps.slots.baseLinearProgress,
|
|
28
28
|
style: {
|
|
29
29
|
display: 'block'
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
skeleton: {
|
|
33
|
-
component: _GridSkeletonLoadingOverlay.GridSkeletonLoadingOverlay,
|
|
33
|
+
component: () => _GridSkeletonLoadingOverlay.GridSkeletonLoadingOverlay,
|
|
34
34
|
style: {
|
|
35
35
|
display: 'block'
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
const GridLoadingOverlay = exports.GridLoadingOverlay =
|
|
39
|
+
const GridLoadingOverlay = exports.GridLoadingOverlay = (0, _forwardRef.forwardRef)(function GridLoadingOverlay(props, ref) {
|
|
40
40
|
const {
|
|
41
41
|
variant = 'linear-progress',
|
|
42
42
|
noRowsVariant = 'skeleton',
|
|
@@ -44,13 +44,15 @@ const GridLoadingOverlay = exports.GridLoadingOverlay = /*#__PURE__*/React.forwa
|
|
|
44
44
|
} = props,
|
|
45
45
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
46
46
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
47
|
+
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
47
48
|
const rowsCount = (0, _hooks.useGridSelector)(apiRef, _hooks.gridRowCountSelector);
|
|
48
49
|
const activeVariant = LOADING_VARIANTS[rowsCount === 0 ? noRowsVariant : variant];
|
|
50
|
+
const Component = activeVariant.component(rootProps);
|
|
49
51
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridOverlay.GridOverlay, (0, _extends2.default)({
|
|
50
|
-
ref: ref,
|
|
51
52
|
style: (0, _extends2.default)({}, activeVariant.style, style)
|
|
52
53
|
}, other, {
|
|
53
|
-
|
|
54
|
+
ref: ref,
|
|
55
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {})
|
|
54
56
|
}));
|
|
55
57
|
});
|
|
56
58
|
process.env.NODE_ENV !== "production" ? GridLoadingOverlay.propTypes = {
|
|
@@ -8,15 +8,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.GridNoResultsOverlay = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
11
12
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
12
13
|
var _GridOverlay = require("./containers/GridOverlay");
|
|
13
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
const GridNoResultsOverlay = exports.GridNoResultsOverlay =
|
|
15
|
+
const GridNoResultsOverlay = exports.GridNoResultsOverlay = (0, _forwardRef.forwardRef)(function GridNoResultsOverlay(props, ref) {
|
|
15
16
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
16
17
|
const noResultsOverlayLabel = apiRef.current.getLocaleText('noResultsOverlayLabel');
|
|
17
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridOverlay.GridOverlay, (0, _extends2.default)({
|
|
18
|
-
ref: ref
|
|
19
|
-
}, props, {
|
|
18
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridOverlay.GridOverlay, (0, _extends2.default)({}, props, {
|
|
19
|
+
ref: ref,
|
|
20
20
|
children: noResultsOverlayLabel
|
|
21
21
|
}));
|
|
22
22
|
});
|
|
@@ -9,15 +9,15 @@ exports.GridNoRowsOverlay = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
12
13
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
13
14
|
var _GridOverlay = require("./containers/GridOverlay");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
const GridNoRowsOverlay = exports.GridNoRowsOverlay =
|
|
16
|
+
const GridNoRowsOverlay = exports.GridNoRowsOverlay = (0, _forwardRef.forwardRef)(function GridNoRowsOverlay(props, ref) {
|
|
16
17
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
17
18
|
const noRowsLabel = apiRef.current.getLocaleText('noRowsLabel');
|
|
18
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridOverlay.GridOverlay, (0, _extends2.default)({
|
|
19
|
-
ref: ref
|
|
20
|
-
}, props, {
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridOverlay.GridOverlay, (0, _extends2.default)({}, props, {
|
|
20
|
+
ref: ref,
|
|
21
21
|
children: noRowsLabel
|
|
22
22
|
}));
|
|
23
23
|
});
|
|
@@ -11,6 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _styles = require("@mui/material/styles");
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _TablePagination = _interopRequireWildcard(require("@mui/material/TablePagination"));
|
|
14
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
14
15
|
var _useGridSelector = require("../hooks/utils/useGridSelector");
|
|
15
16
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
16
17
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
@@ -64,7 +65,7 @@ const defaultLabelDisplayedRows = ({
|
|
|
64
65
|
|
|
65
66
|
// A mutable version of a readonly array.
|
|
66
67
|
|
|
67
|
-
const GridPagination = exports.GridPagination =
|
|
68
|
+
const GridPagination = exports.GridPagination = (0, _forwardRef.forwardRef)(function GridPagination(props, ref) {
|
|
68
69
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
69
70
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
70
71
|
const paginationModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridPaginationSelector.gridPaginationModelSelector);
|
|
@@ -128,7 +129,6 @@ const GridPagination = exports.GridPagination = /*#__PURE__*/React.forwardRef(fu
|
|
|
128
129
|
const locales = apiRef.current.getLocaleText('MuiTablePagination');
|
|
129
130
|
const wrappedLabelDisplayedRows = wrapLabelDisplayedRows(locales.labelDisplayedRows || defaultLabelDisplayedRows, estimatedRowCount);
|
|
130
131
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPaginationRoot, (0, _extends2.default)({
|
|
131
|
-
ref: ref,
|
|
132
132
|
component: "div",
|
|
133
133
|
count: rowCount,
|
|
134
134
|
page: computedPage
|
|
@@ -142,7 +142,9 @@ const GridPagination = exports.GridPagination = /*#__PURE__*/React.forwardRef(fu
|
|
|
142
142
|
onRowsPerPageChange: handlePageSizeChange
|
|
143
143
|
}, computedProps, locales, {
|
|
144
144
|
labelDisplayedRows: wrappedLabelDisplayedRows
|
|
145
|
-
}, props
|
|
145
|
+
}, props, {
|
|
146
|
+
ref: ref
|
|
147
|
+
}));
|
|
146
148
|
});
|
|
147
149
|
process.env.NODE_ENV !== "production" ? GridPagination.propTypes = {
|
|
148
150
|
// ----------------------------- Warning --------------------------------
|
|
@@ -13,6 +13,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
14
|
var _utils = require("@mui/utils");
|
|
15
15
|
var _fastMemo = require("@mui/x-internals/fastMemo");
|
|
16
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
16
17
|
var _gridEditRowModel = require("../models/gridEditRowModel");
|
|
17
18
|
var _gridClasses = require("../constants/gridClasses");
|
|
18
19
|
var _composeGridClasses = require("../utils/composeGridClasses");
|
|
@@ -35,7 +36,7 @@ var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext
|
|
|
35
36
|
var _hooks = require("../hooks");
|
|
36
37
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
37
38
|
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
38
|
-
const GridRow =
|
|
39
|
+
const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
39
40
|
const {
|
|
40
41
|
selected,
|
|
41
42
|
rowId,
|
|
@@ -288,13 +289,13 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
288
289
|
onMouseOver: publish('rowMouseOver', onMouseOver)
|
|
289
290
|
} : null;
|
|
290
291
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
|
|
291
|
-
ref: handleRef,
|
|
292
292
|
"data-id": rowId,
|
|
293
293
|
"data-rowindex": index,
|
|
294
294
|
role: "row",
|
|
295
295
|
className: (0, _clsx.default)(...rowClassNames, classes.root, className),
|
|
296
296
|
style: style
|
|
297
297
|
}, ariaAttributes, eventHandlers, other, {
|
|
298
|
+
ref: handleRef,
|
|
298
299
|
children: [leftCells, /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
299
300
|
role: "presentation",
|
|
300
301
|
className: _gridClasses.gridClasses.cellOffsetLeft,
|
|
@@ -13,6 +13,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
15
|
var _system = require("@mui/system");
|
|
16
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
16
17
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
17
18
|
var _gridClasses = require("../constants/gridClasses");
|
|
18
19
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
@@ -38,7 +39,7 @@ const GridRowCountRoot = (0, _system.styled)('div', {
|
|
|
38
39
|
display: 'flex',
|
|
39
40
|
margin: theme.spacing(0, 2)
|
|
40
41
|
}));
|
|
41
|
-
const GridRowCount = exports.GridRowCount =
|
|
42
|
+
const GridRowCount = exports.GridRowCount = (0, _forwardRef.forwardRef)(function GridRowCount(props, ref) {
|
|
42
43
|
const {
|
|
43
44
|
className,
|
|
44
45
|
rowCount,
|
|
@@ -53,10 +54,10 @@ const GridRowCount = exports.GridRowCount = /*#__PURE__*/React.forwardRef(functi
|
|
|
53
54
|
}
|
|
54
55
|
const text = visibleRowCount < rowCount ? apiRef.current.getLocaleText('footerTotalVisibleRows')(visibleRowCount, rowCount) : rowCount.toLocaleString();
|
|
55
56
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(GridRowCountRoot, (0, _extends2.default)({
|
|
56
|
-
ref: ref,
|
|
57
57
|
className: (0, _clsx.default)(classes.root, className),
|
|
58
58
|
ownerState: ownerState
|
|
59
59
|
}, other, {
|
|
60
|
+
ref: ref,
|
|
60
61
|
children: [apiRef.current.getLocaleText('footerTotalRows'), " ", text]
|
|
61
62
|
}));
|
|
62
63
|
});
|
|
@@ -13,6 +13,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
15
|
var _system = require("@mui/system");
|
|
16
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
16
17
|
var _useGridApiContext = require("../hooks/utils/useGridApiContext");
|
|
17
18
|
var _gridClasses = require("../constants/gridClasses");
|
|
18
19
|
var _useGridRootProps = require("../hooks/utils/useGridRootProps");
|
|
@@ -46,7 +47,7 @@ const GridSelectedRowCountRoot = (0, _system.styled)('div', {
|
|
|
46
47
|
height: 'auto'
|
|
47
48
|
}
|
|
48
49
|
}));
|
|
49
|
-
const GridSelectedRowCount = exports.GridSelectedRowCount =
|
|
50
|
+
const GridSelectedRowCount = exports.GridSelectedRowCount = (0, _forwardRef.forwardRef)(function GridSelectedRowCount(props, ref) {
|
|
50
51
|
const {
|
|
51
52
|
className,
|
|
52
53
|
selectedRowCount
|
|
@@ -57,10 +58,10 @@ const GridSelectedRowCount = exports.GridSelectedRowCount = /*#__PURE__*/React.f
|
|
|
57
58
|
const classes = useUtilityClasses(ownerState);
|
|
58
59
|
const rowSelectedText = apiRef.current.getLocaleText('footerRowSelected')(selectedRowCount);
|
|
59
60
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridSelectedRowCountRoot, (0, _extends2.default)({
|
|
60
|
-
ref: ref,
|
|
61
61
|
className: (0, _clsx.default)(classes.root, className),
|
|
62
62
|
ownerState: ownerState
|
|
63
63
|
}, other, {
|
|
64
|
+
ref: ref,
|
|
64
65
|
children: rowSelectedText
|
|
65
66
|
}));
|
|
66
67
|
});
|