@mui/x-data-grid 7.0.0-beta.6 → 7.0.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 +311 -12
- package/DataGrid/DataGrid.js +57 -17
- package/DataGrid/useDataGridComponent.js +3 -0
- package/DataGrid/useDataGridProps.js +6 -7
- package/README.md +1 -1
- package/components/GridColumnHeaders.d.ts +1 -2
- package/components/GridColumnHeaders.js +6 -17
- package/components/GridFooter.js +2 -3
- package/components/GridHeader.js +1 -2
- package/components/GridHeaders.js +1 -4
- package/components/GridPagination.d.ts +6 -5
- package/components/GridPagination.js +14 -11
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +17 -36
- package/components/GridScrollArea.d.ts +10 -0
- package/components/GridScrollArea.js +150 -0
- package/components/base/GridFooterPlaceholder.js +1 -2
- package/components/base/GridOverlays.js +3 -6
- package/components/cell/GridActionsCell.js +4 -6
- package/components/cell/GridActionsCellItem.d.ts +8 -25
- package/components/cell/GridActionsCellItem.js +8 -5
- package/components/cell/GridBooleanCell.d.ts +1 -0
- package/components/cell/GridBooleanCell.js +3 -2
- package/components/cell/GridCell.d.ts +7 -0
- package/components/cell/GridCell.js +18 -11
- package/components/cell/GridEditBooleanCell.js +1 -2
- package/components/cell/GridEditDateCell.js +2 -3
- package/components/cell/GridEditInputCell.js +2 -2
- package/components/cell/GridEditSingleSelectCell.js +5 -8
- package/components/columnHeaders/ColumnHeaderMenuIcon.js +2 -3
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +22 -13
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +2 -3
- package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +26 -12
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +1 -2
- package/components/columnHeaders/GridColumnHeaderTitle.js +2 -3
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +1 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +7 -6
- package/components/columnSelection/GridCellCheckboxRenderer.js +3 -5
- package/components/columnSelection/GridHeaderCheckbox.js +1 -2
- package/components/columnsManagement/GridColumnsManagement.js +17 -21
- package/components/containers/GridRoot.js +3 -3
- package/components/containers/GridRootStyles.js +12 -20
- package/components/menu/GridMenu.js +4 -6
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +2 -3
- package/components/panel/GridColumnsPanel.js +1 -2
- package/components/panel/GridPanel.d.ts +1 -10
- package/components/panel/GridPanel.js +1 -2
- package/components/panel/GridPreferencesPanel.js +2 -3
- package/components/panel/filterPanel/GridFilterForm.js +24 -27
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +3 -4
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +11 -15
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +10 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +10 -11
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +5 -7
- package/components/panel/filterPanel/GridFilterPanel.js +5 -9
- package/components/panel/filterPanel/filterPanelUtils.js +1 -1
- package/components/toolbar/GridToolbarColumnsButton.js +3 -5
- package/components/toolbar/GridToolbarDensitySelector.js +8 -10
- package/components/toolbar/GridToolbarExport.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +3 -5
- package/components/toolbar/GridToolbarFilterButton.js +3 -5
- package/components/toolbar/GridToolbarQuickFilter.js +4 -5
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +6 -1
- package/components/virtualization/GridVirtualScrollerContent.js +1 -2
- package/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -2
- package/constants/gridClasses.d.ts +6 -32
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -1
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +1 -2
- package/hooks/core/useGridApiInitialization.js +4 -6
- package/hooks/features/clipboard/useGridClipboard.js +6 -5
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +4 -16
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +4 -8
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +12 -23
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +23 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +186 -101
- package/hooks/features/columnMenu/useGridColumnMenuSlots.js +2 -2
- package/hooks/features/columnResize/columnResizeSelector.d.ts +3 -0
- package/hooks/features/columnResize/columnResizeSelector.js +3 -0
- package/hooks/features/columnResize/columnResizeState.d.ts +3 -0
- package/hooks/features/columnResize/columnResizeState.js +1 -0
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +44 -0
- package/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/hooks/features/columnResize/index.d.ts +3 -0
- package/hooks/features/columnResize/index.js +3 -0
- package/hooks/features/columnResize/useGridColumnResize.d.ts +10 -0
- package/hooks/features/columnResize/useGridColumnResize.js +553 -0
- package/hooks/features/columns/gridColumnsSelector.js +1 -2
- package/hooks/features/columns/gridColumnsUtils.d.ts +0 -9
- package/hooks/features/columns/gridColumnsUtils.js +5 -22
- package/hooks/features/columns/useGridColumnSpanning.js +1 -2
- package/hooks/features/columns/useGridColumns.js +11 -19
- package/hooks/features/density/densitySelector.d.ts +4 -2
- package/hooks/features/density/densitySelector.js +8 -2
- package/hooks/features/density/densityState.d.ts +1 -4
- package/hooks/features/density/useGridDensity.d.ts +2 -4
- package/hooks/features/density/useGridDensity.js +21 -29
- package/hooks/features/dimensions/useGridDimensions.js +7 -10
- package/hooks/features/editing/useGridCellEditing.js +25 -8
- package/hooks/features/editing/useGridEditing.js +1 -2
- package/hooks/features/editing/useGridRowEditing.js +4 -6
- package/hooks/features/export/serializers/csvSerializer.d.ts +2 -0
- package/hooks/features/export/serializers/csvSerializer.js +25 -16
- package/hooks/features/export/useGridCsvExport.js +9 -10
- package/hooks/features/export/useGridPrintExport.js +17 -22
- package/hooks/features/export/utils.js +2 -3
- package/hooks/features/filter/gridFilterSelector.js +15 -22
- package/hooks/features/filter/gridFilterUtils.js +10 -16
- package/hooks/features/filter/useGridFilter.js +9 -15
- package/hooks/features/focus/useGridFocus.js +5 -6
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +1 -0
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -0
- package/hooks/features/headerFiltering/useGridHeaderFiltering.js +23 -5
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -2
- package/hooks/features/pagination/gridPaginationInterfaces.d.ts +19 -2
- package/hooks/features/pagination/gridPaginationSelector.d.ts +5 -0
- package/hooks/features/pagination/gridPaginationSelector.js +9 -4
- package/hooks/features/pagination/useGridPagination.d.ts +1 -6
- package/hooks/features/pagination/useGridPagination.js +9 -158
- package/hooks/features/pagination/useGridPaginationModel.d.ts +11 -0
- package/hooks/features/pagination/useGridPaginationModel.js +165 -0
- package/hooks/features/pagination/useGridRowCount.d.ts +8 -0
- package/hooks/features/pagination/useGridRowCount.js +94 -0
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +7 -12
- package/hooks/features/rowSelection/useGridRowSelection.js +11 -16
- package/hooks/features/rows/gridRowsSelector.js +11 -19
- package/hooks/features/rows/gridRowsUtils.js +7 -9
- package/hooks/features/rows/useGridParamsApi.js +1 -1
- package/hooks/features/rows/useGridRows.js +4 -13
- package/hooks/features/rows/useGridRowsMeta.js +7 -13
- package/hooks/features/scroll/useGridScroll.js +3 -4
- package/hooks/features/sorting/gridSortingSelector.js +4 -7
- package/hooks/features/sorting/useGridSorting.js +8 -14
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +4 -4
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +3 -3
- package/hooks/features/virtualization/useGridVirtualScroller.js +220 -71
- package/hooks/utils/useGridApiEventHandler.js +5 -10
- package/hooks/utils/useGridNativeEventListener.js +1 -2
- package/hooks/utils/useLazyRef.d.ts +1 -2
- package/hooks/utils/useLazyRef.js +1 -11
- package/hooks/utils/useOnMount.d.ts +1 -2
- package/hooks/utils/useOnMount.js +1 -7
- package/hooks/utils/useTimeout.d.ts +1 -11
- package/hooks/utils/useTimeout.js +1 -36
- package/index.js +1 -1
- package/internals/index.d.ts +3 -1
- package/internals/index.js +2 -1
- package/internals/utils/getPinnedCellOffset.d.ts +3 -0
- package/internals/utils/getPinnedCellOffset.js +17 -0
- package/internals/utils/useProps.js +1 -2
- package/joy/joySlots.js +18 -63
- package/locales/jaJP.js +3 -4
- package/material/index.js +0 -2
- package/models/api/gridApiCommon.d.ts +3 -3
- package/models/api/gridCoreApi.d.ts +1 -5
- package/models/api/gridRowsMetaApi.d.ts +1 -1
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -1
- package/models/events/gridEventLookup.d.ts +13 -0
- package/models/gridExport.d.ts +6 -0
- package/models/gridHeaderFilteringModel.d.ts +1 -0
- package/models/gridSlotsComponent.d.ts +0 -5
- package/models/gridStateCommunity.d.ts +3 -0
- package/models/params/gridScrollParams.d.ts +5 -3
- package/models/props/DataGridProps.d.ts +58 -28
- package/modern/DataGrid/DataGrid.js +57 -17
- package/modern/DataGrid/useDataGridComponent.js +3 -0
- package/modern/DataGrid/useDataGridProps.js +6 -7
- package/modern/components/GridColumnHeaders.js +6 -17
- package/modern/components/GridHeaders.js +1 -4
- package/modern/components/GridPagination.js +13 -6
- package/modern/components/GridRow.js +4 -19
- package/modern/components/GridScrollArea.js +150 -0
- package/modern/components/cell/GridActionsCell.js +1 -1
- package/modern/components/cell/GridActionsCellItem.js +4 -0
- package/modern/components/cell/GridBooleanCell.js +3 -2
- package/modern/components/cell/GridCell.js +11 -3
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/modern/components/containers/GridRoot.js +3 -3
- package/modern/components/containers/GridRootStyles.js +12 -20
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +5 -5
- package/modern/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +6 -1
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +184 -97
- package/modern/hooks/features/columnResize/columnResizeSelector.js +3 -0
- package/modern/hooks/features/columnResize/columnResizeState.js +1 -0
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +10 -0
- package/modern/hooks/features/columnResize/index.js +3 -0
- package/modern/hooks/features/columnResize/useGridColumnResize.js +553 -0
- package/modern/hooks/features/columns/gridColumnsUtils.js +4 -20
- package/modern/hooks/features/density/densitySelector.js +8 -2
- package/modern/hooks/features/density/useGridDensity.js +21 -29
- package/modern/hooks/features/dimensions/useGridDimensions.js +4 -5
- package/modern/hooks/features/editing/useGridCellEditing.js +22 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/modern/hooks/features/export/useGridCsvExport.js +2 -1
- package/modern/hooks/features/export/useGridPrintExport.js +8 -7
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +3 -0
- package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +21 -2
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/modern/hooks/features/pagination/useGridPagination.js +8 -149
- package/modern/hooks/features/pagination/useGridPaginationModel.js +165 -0
- package/modern/hooks/features/pagination/useGridRowCount.js +94 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +3 -2
- package/modern/hooks/features/scroll/useGridScroll.js +1 -1
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/modern/hooks/utils/useLazyRef.js +1 -11
- package/modern/hooks/utils/useOnMount.js +1 -7
- package/modern/hooks/utils/useTimeout.js +1 -36
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/internals/utils/getPinnedCellOffset.js +17 -0
- package/modern/joy/joySlots.js +11 -50
- package/modern/locales/jaJP.js +3 -4
- package/modern/material/index.js +0 -2
- package/modern/models/api/index.js +0 -1
- package/modern/utils/cellBorderUtils.js +8 -0
- package/modern/utils/createSelector.js +1 -1
- package/modern/utils/domUtils.js +144 -0
- package/modern/utils/keyboardUtils.js +1 -1
- package/node/DataGrid/DataGrid.js +57 -17
- package/node/DataGrid/useDataGridComponent.js +3 -0
- package/node/DataGrid/useDataGridProps.js +6 -7
- package/node/components/GridColumnHeaders.js +6 -16
- package/node/components/GridHeaders.js +1 -4
- package/node/components/GridPagination.js +10 -4
- package/node/components/GridRow.js +3 -18
- package/node/components/GridScrollArea.js +158 -0
- package/node/components/cell/GridActionsCell.js +1 -1
- package/node/components/cell/GridActionsCellItem.js +4 -0
- package/node/components/cell/GridBooleanCell.js +3 -2
- package/node/components/cell/GridCell.js +12 -4
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -0
- package/node/components/columnHeaders/GridColumnGroupHeader.js +18 -8
- package/node/components/columnHeaders/GridColumnHeaderItem.js +21 -6
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +6 -5
- package/node/components/containers/GridRoot.js +2 -2
- package/node/components/containers/GridRootStyles.js +12 -20
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +4 -4
- package/node/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +6 -1
- package/node/components/virtualization/GridVirtualScrollerFiller.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/clipboard/useGridClipboard.js +4 -2
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +190 -103
- package/node/hooks/features/columnResize/columnResizeSelector.js +10 -0
- package/node/hooks/features/columnResize/columnResizeState.js +5 -0
- package/node/hooks/features/columnResize/gridColumnResizeApi.js +16 -0
- package/node/hooks/features/columnResize/index.js +38 -0
- package/node/hooks/features/columnResize/useGridColumnResize.js +564 -0
- package/node/hooks/features/columns/gridColumnsUtils.js +4 -21
- package/node/hooks/features/density/densitySelector.js +9 -3
- package/node/hooks/features/density/useGridDensity.js +22 -30
- package/node/hooks/features/dimensions/useGridDimensions.js +4 -5
- package/node/hooks/features/editing/useGridCellEditing.js +22 -3
- package/node/hooks/features/editing/useGridRowEditing.js +1 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +23 -12
- package/node/hooks/features/export/useGridCsvExport.js +2 -1
- package/node/hooks/features/export/useGridPrintExport.js +8 -7
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/headerFiltering/gridHeaderFilteringSelectors.js +4 -1
- package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +21 -2
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/pagination/gridPaginationSelector.js +8 -2
- package/node/hooks/features/pagination/useGridPagination.js +9 -153
- package/node/hooks/features/pagination/useGridPaginationModel.js +176 -0
- package/node/hooks/features/pagination/useGridRowCount.js +103 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +2 -1
- package/node/hooks/features/scroll/useGridScroll.js +1 -1
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +211 -57
- package/node/hooks/utils/useLazyRef.js +7 -13
- package/node/hooks/utils/useOnMount.js +8 -10
- package/node/hooks/utils/useTimeout.js +7 -37
- package/node/index.js +1 -1
- package/node/internals/index.js +27 -8
- package/node/internals/utils/getPinnedCellOffset.js +24 -0
- package/node/joy/joySlots.js +11 -50
- package/node/locales/jaJP.js +3 -4
- package/node/material/index.js +0 -2
- package/node/models/api/index.js +0 -11
- package/node/utils/cellBorderUtils.js +16 -0
- package/node/utils/createSelector.js +1 -1
- package/node/utils/domUtils.js +155 -0
- package/node/utils/keyboardUtils.js +1 -1
- package/package.json +4 -4
- package/utils/cellBorderUtils.d.ts +3 -0
- package/utils/cellBorderUtils.js +8 -0
- package/utils/createSelector.js +9 -9
- package/utils/domUtils.d.ts +14 -1
- package/utils/domUtils.js +144 -0
- package/utils/getGridLocalization.js +9 -12
- package/utils/keyboardUtils.js +1 -1
- package/components/columnHeaders/GridColumnHeadersInner.d.ts +0 -8
- package/components/columnHeaders/GridColumnHeadersInner.js +0 -58
- package/modern/components/columnHeaders/GridColumnHeadersInner.js +0 -58
- package/node/components/columnHeaders/GridColumnHeadersInner.js +0 -67
|
@@ -146,7 +146,6 @@ export const updateCacheWithNewRows = ({
|
|
|
146
146
|
getRowId,
|
|
147
147
|
updates
|
|
148
148
|
}) => {
|
|
149
|
-
var _previousCache$update, _previousCache$update2, _previousCache$update3;
|
|
150
149
|
if (previousCache.updates.type === 'full') {
|
|
151
150
|
throw new Error('MUI X: Unable to prepare a partial update if a full update is not applied yet.');
|
|
152
151
|
}
|
|
@@ -165,9 +164,9 @@ export const updateCacheWithNewRows = ({
|
|
|
165
164
|
const partialUpdates = {
|
|
166
165
|
type: 'partial',
|
|
167
166
|
actions: {
|
|
168
|
-
insert: [...(
|
|
169
|
-
modify: [...(
|
|
170
|
-
remove: [...(
|
|
167
|
+
insert: [...(previousCache.updates.actions.insert ?? [])],
|
|
168
|
+
modify: [...(previousCache.updates.actions.modify ?? [])],
|
|
169
|
+
remove: [...(previousCache.updates.actions.remove ?? [])]
|
|
171
170
|
},
|
|
172
171
|
idToActionLookup: _extends({}, previousCache.updates.idToActionLookup)
|
|
173
172
|
};
|
|
@@ -265,16 +264,15 @@ export const updateCacheWithNewRows = ({
|
|
|
265
264
|
};
|
|
266
265
|
};
|
|
267
266
|
export function calculatePinnedRowsHeight(apiRef) {
|
|
268
|
-
var _pinnedRows$top, _pinnedRows$bottom;
|
|
269
267
|
const pinnedRows = gridPinnedRowsSelector(apiRef);
|
|
270
|
-
const topPinnedRowsHeight =
|
|
268
|
+
const topPinnedRowsHeight = pinnedRows?.top?.reduce((acc, value) => {
|
|
271
269
|
acc += apiRef.current.unstable_getRowHeight(value.id);
|
|
272
270
|
return acc;
|
|
273
|
-
}, 0)
|
|
274
|
-
const bottomPinnedRowsHeight =
|
|
271
|
+
}, 0) || 0;
|
|
272
|
+
const bottomPinnedRowsHeight = pinnedRows?.bottom?.reduce((acc, value) => {
|
|
275
273
|
acc += apiRef.current.unstable_getRowHeight(value.id);
|
|
276
274
|
return acc;
|
|
277
|
-
}, 0)
|
|
275
|
+
}, 0) || 0;
|
|
278
276
|
return {
|
|
279
277
|
top: topPinnedRowsHeight,
|
|
280
278
|
bottom: bottomPinnedRowsHeight
|
|
@@ -37,7 +37,7 @@ export function useGridParamsApi(apiRef) {
|
|
|
37
37
|
throw new MissingRowIdError(`No row with id #${id} found`);
|
|
38
38
|
}
|
|
39
39
|
const rawValue = row[field];
|
|
40
|
-
const value = colDef
|
|
40
|
+
const value = colDef?.valueGetter ? colDef.valueGetter(rawValue, row, colDef, apiRef) : rawValue;
|
|
41
41
|
const cellFocus = gridFocusCellSelector(apiRef);
|
|
42
42
|
const cellTabIndex = gridTabIndexCellSelector(apiRef);
|
|
43
43
|
const params = {
|
|
@@ -127,7 +127,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
127
127
|
updates.forEach(update => {
|
|
128
128
|
const id = getRowIdFromRowModel(update, props.getRowId, 'A row was provided without id when calling updateRows():');
|
|
129
129
|
const rowNode = apiRef.current.getRowNode(id);
|
|
130
|
-
if (
|
|
130
|
+
if (rowNode?.type === 'pinnedRow') {
|
|
131
131
|
// @ts-ignore because otherwise `release:build` doesn't work
|
|
132
132
|
const pinnedRowsCache = apiRef.current.caches.pinnedRows;
|
|
133
133
|
const prevModel = pinnedRowsCache.idLookup[id];
|
|
@@ -151,10 +151,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
151
151
|
const getRowModels = React.useCallback(() => {
|
|
152
152
|
const dataRows = gridDataRowIdsSelector(apiRef);
|
|
153
153
|
const idRowsLookup = gridRowsLookupSelector(apiRef);
|
|
154
|
-
return new Map(dataRows.map(id => {
|
|
155
|
-
var _idRowsLookup$id;
|
|
156
|
-
return [id, (_idRowsLookup$id = idRowsLookup[id]) != null ? _idRowsLookup$id : {}];
|
|
157
|
-
}));
|
|
154
|
+
return new Map(dataRows.map(id => [id, idRowsLookup[id] ?? {}]));
|
|
158
155
|
}, [apiRef]);
|
|
159
156
|
const getRowsCount = React.useCallback(() => gridRowCountSelector(apiRef), [apiRef]);
|
|
160
157
|
const getAllRowIds = React.useCallback(() => gridDataRowIdsSelector(apiRef), [apiRef]);
|
|
@@ -182,10 +179,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
182
179
|
apiRef.current.forceUpdate();
|
|
183
180
|
apiRef.current.publishEvent('rowExpansionChange', newNode);
|
|
184
181
|
}, [apiRef]);
|
|
185
|
-
const getRowNode = React.useCallback(id =>
|
|
186
|
-
var _ref;
|
|
187
|
-
return (_ref = gridRowTreeSelector(apiRef)[id]) != null ? _ref : null;
|
|
188
|
-
}, [apiRef]);
|
|
182
|
+
const getRowNode = React.useCallback(id => gridRowTreeSelector(apiRef)[id] ?? null, [apiRef]);
|
|
189
183
|
const getRowGroupChildren = React.useCallback(({
|
|
190
184
|
skipAutoGeneratedRows = true,
|
|
191
185
|
groupId,
|
|
@@ -293,10 +287,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
293
287
|
});
|
|
294
288
|
|
|
295
289
|
// Removes potential remaining skeleton rows from the dataRowIds.
|
|
296
|
-
const dataRowIds = rootGroupChildren.filter(childId =>
|
|
297
|
-
var _tree$childId;
|
|
298
|
-
return ((_tree$childId = tree[childId]) == null ? void 0 : _tree$childId.type) === 'leaf';
|
|
299
|
-
});
|
|
290
|
+
const dataRowIds = rootGroupChildren.filter(childId => tree[childId]?.type === 'leaf');
|
|
300
291
|
apiRef.current.caches.rows.dataRowIdToModelLookup = dataRowIdToModelLookup;
|
|
301
292
|
apiRef.current.caches.rows.dataRowIdToIdLookup = dataRowIdToIdLookup;
|
|
302
293
|
apiRef.current.setState(state => _extends({}, state, {
|
|
@@ -58,7 +58,6 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
58
58
|
const validRowHeight = getValidRowHeight(props.rowHeight, DATA_GRID_PROPS_DEFAULT_VALUES.rowHeight, rowHeightWarning);
|
|
59
59
|
const rowHeight = Math.floor(validRowHeight * densityFactor);
|
|
60
60
|
const hydrateRowsMeta = React.useCallback(() => {
|
|
61
|
-
var _pinnedRows$top, _pinnedRows$bottom;
|
|
62
61
|
hasRowWithAutoHeight.current = false;
|
|
63
62
|
const calculateRowProcessedSizes = row => {
|
|
64
63
|
if (!rowsHeightLookup.current[row.id]) {
|
|
@@ -92,7 +91,7 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
92
91
|
})) : rowHeight;
|
|
93
92
|
|
|
94
93
|
// If the row was not measured yet use the estimated row height
|
|
95
|
-
baseRowHeight = estimatedRowHeight
|
|
94
|
+
baseRowHeight = estimatedRowHeight ?? rowHeight;
|
|
96
95
|
} else {
|
|
97
96
|
baseRowHeight = existingBaseRowHeight;
|
|
98
97
|
}
|
|
@@ -111,15 +110,14 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
111
110
|
baseCenter: baseRowHeight
|
|
112
111
|
};
|
|
113
112
|
if (getRowSpacing) {
|
|
114
|
-
var _spacing$top, _spacing$bottom;
|
|
115
113
|
const indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
|
|
116
114
|
const spacing = getRowSpacing(_extends({}, row, {
|
|
117
115
|
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
118
116
|
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
119
117
|
indexRelativeToCurrentPage
|
|
120
118
|
}));
|
|
121
|
-
initialHeights.spacingTop =
|
|
122
|
-
initialHeights.spacingBottom =
|
|
119
|
+
initialHeights.spacingTop = spacing.top ?? 0;
|
|
120
|
+
initialHeights.spacingBottom = spacing.bottom ?? 0;
|
|
123
121
|
}
|
|
124
122
|
const processedSizes = apiRef.current.unstable_applyPipeProcessors('rowHeight', initialHeights, row);
|
|
125
123
|
rowsHeightLookup.current[row.id].sizes = processedSizes;
|
|
@@ -139,10 +137,10 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
139
137
|
}
|
|
140
138
|
return acc + processedSizes.baseCenter + otherSizes;
|
|
141
139
|
}, 0);
|
|
142
|
-
pinnedRows
|
|
140
|
+
pinnedRows?.top?.forEach(row => {
|
|
143
141
|
calculateRowProcessedSizes(row);
|
|
144
142
|
});
|
|
145
|
-
pinnedRows
|
|
143
|
+
pinnedRows?.bottom?.forEach(row => {
|
|
146
144
|
calculateRowProcessedSizes(row);
|
|
147
145
|
});
|
|
148
146
|
apiRef.current.setState(state => {
|
|
@@ -163,10 +161,7 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
163
161
|
const height = rowsHeightLookup.current[rowId];
|
|
164
162
|
return height ? height.sizes.baseCenter : rowHeight;
|
|
165
163
|
}, [rowHeight]);
|
|
166
|
-
const getRowInternalSizes = rowId =>
|
|
167
|
-
var _rowsHeightLookup$cur;
|
|
168
|
-
return (_rowsHeightLookup$cur = rowsHeightLookup.current[rowId]) == null ? void 0 : _rowsHeightLookup$cur.sizes;
|
|
169
|
-
};
|
|
164
|
+
const getRowInternalSizes = rowId => rowsHeightLookup.current[rowId]?.sizes;
|
|
170
165
|
const setRowHeight = React.useCallback((id, height) => {
|
|
171
166
|
rowsHeightLookup.current[id].sizes.baseCenter = height;
|
|
172
167
|
rowsHeightLookup.current[id].isResized = true;
|
|
@@ -188,8 +183,7 @@ export const useGridRowsMeta = (apiRef, props) => {
|
|
|
188
183
|
}
|
|
189
184
|
}, [debouncedHydrateRowsMeta]);
|
|
190
185
|
const rowHasAutoHeight = React.useCallback(id => {
|
|
191
|
-
|
|
192
|
-
return ((_rowsHeightLookup$cur2 = rowsHeightLookup.current[id]) == null ? void 0 : _rowsHeightLookup$cur2.autoHeight) || false;
|
|
186
|
+
return rowsHeightLookup.current[id]?.autoHeight || false;
|
|
193
187
|
}, []);
|
|
194
188
|
const getLastMeasuredRowIndex = React.useCallback(() => {
|
|
195
189
|
return lastMeasuredRowIndex.current;
|
|
@@ -45,7 +45,7 @@ function scrollIntoView(dimensions) {
|
|
|
45
45
|
export const useGridScroll = (apiRef, props) => {
|
|
46
46
|
const theme = useTheme();
|
|
47
47
|
const logger = useGridLogger(apiRef, 'useGridScroll');
|
|
48
|
-
const colRef = apiRef.current.
|
|
48
|
+
const colRef = apiRef.current.columnHeadersContainerRef;
|
|
49
49
|
const virtualScrollerRef = apiRef.current.virtualScrollerRef;
|
|
50
50
|
const visibleSortedRows = useGridSelector(apiRef, gridExpandedSortedRowEntriesSelector);
|
|
51
51
|
const scrollToIndexes = React.useCallback(params => {
|
|
@@ -62,8 +62,7 @@ export const useGridScroll = (apiRef, props) => {
|
|
|
62
62
|
const columnPositions = gridColumnPositionsSelector(apiRef);
|
|
63
63
|
let cellWidth;
|
|
64
64
|
if (typeof params.rowIndex !== 'undefined') {
|
|
65
|
-
|
|
66
|
-
const rowId = (_visibleSortedRows$pa = visibleSortedRows[params.rowIndex]) == null ? void 0 : _visibleSortedRows$pa.id;
|
|
65
|
+
const rowId = visibleSortedRows[params.rowIndex]?.id;
|
|
67
66
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, params.colIndex);
|
|
68
67
|
if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
|
|
69
68
|
cellWidth = cellColSpanInfo.cellProps.width;
|
|
@@ -114,7 +113,7 @@ export const useGridScroll = (apiRef, props) => {
|
|
|
114
113
|
logger.debug(`Scrolling, updating container, and viewport`);
|
|
115
114
|
}, [virtualScrollerRef, theme.direction, colRef, logger]);
|
|
116
115
|
const getScrollPosition = React.useCallback(() => {
|
|
117
|
-
if (!
|
|
116
|
+
if (!virtualScrollerRef?.current) {
|
|
118
117
|
return {
|
|
119
118
|
top: 0,
|
|
120
119
|
left: 0
|
|
@@ -19,13 +19,10 @@ export const gridSortedRowIdsSelector = createSelector(gridSortingStateSelector,
|
|
|
19
19
|
*/
|
|
20
20
|
export const gridSortedRowEntriesSelector = createSelectorMemoized(gridSortedRowIdsSelector, gridRowsLookupSelector,
|
|
21
21
|
// TODO rows v6: Is this the best approach ?
|
|
22
|
-
(sortedIds, idRowsLookup) => sortedIds.map(id => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
model: (_idRowsLookup$id = idRowsLookup[id]) != null ? _idRowsLookup$id : {}
|
|
27
|
-
};
|
|
28
|
-
}));
|
|
22
|
+
(sortedIds, idRowsLookup) => sortedIds.map(id => ({
|
|
23
|
+
id,
|
|
24
|
+
model: idRowsLookup[id] ?? {}
|
|
25
|
+
})));
|
|
29
26
|
|
|
30
27
|
/**
|
|
31
28
|
* Get the current sorting model.
|
|
@@ -13,8 +13,7 @@ import { buildAggregatedSortingApplier, mergeStateWithSortModel, getNextGridSort
|
|
|
13
13
|
import { useGridRegisterPipeProcessor } from '../../core/pipeProcessing';
|
|
14
14
|
import { getTreeNodeDescendants } from '../rows/gridRowsUtils';
|
|
15
15
|
export const sortingStateInitializer = (state, props) => {
|
|
16
|
-
|
|
17
|
-
const sortModel = (_ref = (_props$sortModel = props.sortModel) != null ? _props$sortModel : (_props$initialState = props.initialState) == null || (_props$initialState = _props$initialState.sorting) == null ? void 0 : _props$initialState.sortModel) != null ? _ref : [];
|
|
16
|
+
const sortModel = props.sortModel ?? props.initialState?.sorting?.sortModel ?? [];
|
|
18
17
|
return _extends({}, state, {
|
|
19
18
|
sorting: {
|
|
20
19
|
sortModel: sanitizeSortModel(sortModel, props.disableMultipleColumnsSorting),
|
|
@@ -28,7 +27,6 @@ export const sortingStateInitializer = (state, props) => {
|
|
|
28
27
|
* @requires useGridColumns (event)
|
|
29
28
|
*/
|
|
30
29
|
export const useGridSorting = (apiRef, props) => {
|
|
31
|
-
var _props$initialState3;
|
|
32
30
|
const logger = useGridLogger(apiRef, 'useGridSorting');
|
|
33
31
|
apiRef.current.registerControlState({
|
|
34
32
|
stateId: 'sortModel',
|
|
@@ -42,7 +40,7 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
42
40
|
const existingIdx = sortModel.findIndex(c => c.field === field);
|
|
43
41
|
let newSortModel = [...sortModel];
|
|
44
42
|
if (existingIdx > -1) {
|
|
45
|
-
if (
|
|
43
|
+
if (sortItem?.sort == null) {
|
|
46
44
|
newSortModel.splice(existingIdx, 1);
|
|
47
45
|
} else {
|
|
48
46
|
newSortModel.splice(existingIdx, 1, sortItem);
|
|
@@ -53,19 +51,17 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
53
51
|
return newSortModel;
|
|
54
52
|
}, [apiRef]);
|
|
55
53
|
const createSortItem = React.useCallback((col, directionOverride) => {
|
|
56
|
-
var _col$sortingOrder2;
|
|
57
54
|
const sortModel = gridSortModelSelector(apiRef);
|
|
58
55
|
const existing = sortModel.find(c => c.field === col.field);
|
|
59
56
|
if (existing) {
|
|
60
|
-
|
|
61
|
-
const nextSort = directionOverride === undefined ? getNextGridSortDirection((_col$sortingOrder = col.sortingOrder) != null ? _col$sortingOrder : props.sortingOrder, existing.sort) : directionOverride;
|
|
57
|
+
const nextSort = directionOverride === undefined ? getNextGridSortDirection(col.sortingOrder ?? props.sortingOrder, existing.sort) : directionOverride;
|
|
62
58
|
return nextSort === undefined ? undefined : _extends({}, existing, {
|
|
63
59
|
sort: nextSort
|
|
64
60
|
});
|
|
65
61
|
}
|
|
66
62
|
return {
|
|
67
63
|
field: col.field,
|
|
68
|
-
sort: directionOverride === undefined ? getNextGridSortDirection(
|
|
64
|
+
sort: directionOverride === undefined ? getNextGridSortDirection(col.sortingOrder ?? props.sortingOrder) : directionOverride
|
|
69
65
|
};
|
|
70
66
|
}, [apiRef, props.sortingOrder]);
|
|
71
67
|
const addColumnMenuItem = React.useCallback((columnMenuItems, colDef) => {
|
|
@@ -120,7 +116,7 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
120
116
|
const sortItem = createSortItem(column, direction);
|
|
121
117
|
let sortModel;
|
|
122
118
|
if (!allowMultipleSorting || props.disableMultipleColumnsSorting) {
|
|
123
|
-
sortModel =
|
|
119
|
+
sortModel = sortItem?.sort == null ? [] : [sortItem];
|
|
124
120
|
} else {
|
|
125
121
|
sortModel = upsertSortModel(column.field, sortItem);
|
|
126
122
|
}
|
|
@@ -148,7 +144,6 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
148
144
|
* PRE-PROCESSING
|
|
149
145
|
*/
|
|
150
146
|
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
151
|
-
var _props$initialState2;
|
|
152
147
|
const sortModelToExport = gridSortModelSelector(apiRef);
|
|
153
148
|
const shouldExportSortModel =
|
|
154
149
|
// Always export if the `exportOnlyDirtyModels` property is not activated
|
|
@@ -156,7 +151,7 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
156
151
|
// Always export if the model is controlled
|
|
157
152
|
props.sortModel != null ||
|
|
158
153
|
// Always export if the model has been initialized
|
|
159
|
-
|
|
154
|
+
props.initialState?.sorting?.sortModel != null ||
|
|
160
155
|
// Export if the model is not empty
|
|
161
156
|
sortModelToExport.length > 0;
|
|
162
157
|
if (!shouldExportSortModel) {
|
|
@@ -167,10 +162,9 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
167
162
|
sortModel: sortModelToExport
|
|
168
163
|
}
|
|
169
164
|
});
|
|
170
|
-
}, [apiRef, props.sortModel,
|
|
165
|
+
}, [apiRef, props.sortModel, props.initialState?.sorting?.sortModel]);
|
|
171
166
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
172
|
-
|
|
173
|
-
const sortModel = (_context$stateToResto = context.stateToRestore.sorting) == null ? void 0 : _context$stateToResto.sortModel;
|
|
167
|
+
const sortModel = context.stateToRestore.sorting?.sortModel;
|
|
174
168
|
if (sortModel == null) {
|
|
175
169
|
return params;
|
|
176
170
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
1
|
+
import type { GridColumnsRenderContext } from '../../../models/params/gridScrollParams';
|
|
2
|
+
import type { GridStateCommunity } from '../../../models/gridStateCommunity';
|
|
3
3
|
/**
|
|
4
4
|
* Get the columns state
|
|
5
5
|
* @category Virtualization
|
|
@@ -20,11 +20,11 @@ export declare const gridVirtualizationColumnEnabledSelector: import("../../../u
|
|
|
20
20
|
* @category Virtualization
|
|
21
21
|
* @ignore - do not document.
|
|
22
22
|
*/
|
|
23
|
-
export declare const gridRenderContextSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, GridRenderContext>;
|
|
23
|
+
export declare const gridRenderContextSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../../models/params/gridScrollParams").GridRenderContext>;
|
|
24
24
|
/**
|
|
25
25
|
* Get the render context, with only columns filled in.
|
|
26
26
|
* This is cached, so it can be used to only re-render when the column interval changes.
|
|
27
27
|
* @category Virtualization
|
|
28
28
|
* @ignore - do not document.
|
|
29
29
|
*/
|
|
30
|
-
export declare const gridRenderContextColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity,
|
|
30
|
+
export declare const gridRenderContextColumnsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, GridColumnsRenderContext>;
|
|
@@ -31,8 +31,6 @@ export const gridRenderContextSelector = createSelector(gridVirtualizationSelect
|
|
|
31
31
|
* @ignore - do not document.
|
|
32
32
|
*/
|
|
33
33
|
export const gridRenderContextColumnsSelector = createSelectorMemoized(state => state.virtualization.renderContext.firstColumnIndex, state => state.virtualization.renderContext.lastColumnIndex, (firstColumnIndex, lastColumnIndex) => ({
|
|
34
|
-
firstRowIndex: -1,
|
|
35
|
-
lastRowIndex: -1,
|
|
36
34
|
firstColumnIndex,
|
|
37
35
|
lastColumnIndex
|
|
38
36
|
}));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { Theme } from '@mui/material/styles';
|
|
3
3
|
import { GridPinnedRowsPosition } from '../rows/gridRowsInterfaces';
|
|
4
|
-
import { GridRenderContext, GridRowEntry, GridRowId } from '../../../models';
|
|
5
|
-
export declare const EMPTY_DETAIL_PANELS: Readonly<Map<GridRowId, React.ReactNode>>;
|
|
4
|
+
import type { GridRenderContext, GridColumnsRenderContext, GridRowEntry, GridRowId } from '../../../models';
|
|
6
5
|
export type VirtualScroller = ReturnType<typeof useGridVirtualScroller>;
|
|
6
|
+
export declare const EMPTY_DETAIL_PANELS: Readonly<Map<GridRowId, React.ReactNode>>;
|
|
7
7
|
export declare const useGridVirtualScroller: () => {
|
|
8
8
|
renderContext: GridRenderContext;
|
|
9
9
|
setPanels: React.Dispatch<React.SetStateAction<Readonly<Map<GridRowId, React.ReactNode>>>>;
|
|
@@ -41,4 +41,4 @@ export declare const useGridVirtualScroller: () => {
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
export declare function areRenderContextsEqual(context1: GridRenderContext, context2: GridRenderContext): boolean;
|
|
44
|
-
export declare function computeOffsetLeft(columnPositions: number[], renderContext:
|
|
44
|
+
export declare function computeOffsetLeft(columnPositions: number[], renderContext: GridColumnsRenderContext, direction: Theme['direction'], pinnedLeftLength: number): number;
|