@mui/x-data-grid 9.13.0 → 9.15.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 +325 -0
- package/DataGrid/DataGrid.js +8 -0
- package/DataGrid/DataGrid.mjs +9 -1
- package/DataGrid/useDataGridComponent.js +2 -2
- package/DataGrid/useDataGridComponent.mjs +2 -2
- package/DataGrid/useDataGridProps.mjs +1 -1
- package/colDef/gridActionsColDef.mjs +1 -1
- package/colDef/gridBooleanColDef.mjs +1 -1
- package/colDef/gridCheckboxSelectionColDef.mjs +1 -1
- package/colDef/gridDateColDef.mjs +1 -1
- package/colDef/gridDefaultColumnTypes.mjs +1 -1
- package/colDef/gridLongTextColDef.mjs +1 -1
- package/colDef/gridNumericColDef.mjs +1 -1
- package/colDef/gridSingleSelectColDef.mjs +1 -1
- package/components/GridColumnHeaders.mjs +2 -2
- package/components/GridColumnSortButton.mjs +2 -2
- package/components/GridColumnUnsortedIcon.mjs +2 -2
- package/components/GridFooter.mjs +1 -1
- package/components/GridHeader.mjs +1 -1
- package/components/GridHeaders.mjs +1 -1
- package/components/GridLoadingOverlay.mjs +2 -2
- package/components/GridNoColumnsOverlay.mjs +1 -1
- package/components/GridNoResultsOverlay.mjs +1 -1
- package/components/GridNoRowsOverlay.mjs +1 -1
- package/components/GridPagination.js +9 -1
- package/components/GridPagination.mjs +10 -2
- package/components/GridRow.mjs +2 -2
- package/components/GridRowCount.mjs +2 -2
- package/components/GridRowDragAndDropOverlay.mjs +1 -1
- package/components/GridScrollArea.js +20 -7
- package/components/GridScrollArea.mjs +22 -9
- package/components/GridSelectedRowCount.mjs +2 -2
- package/components/GridShadowScrollArea.mjs +2 -2
- package/components/GridSkeletonLoadingOverlay.mjs +2 -2
- package/components/base/GridFooterPlaceholder.mjs +1 -1
- package/components/base/GridOverlays.js +6 -5
- package/components/base/GridOverlays.mjs +7 -6
- package/components/cell/GridActionsCell.js +55 -52
- package/components/cell/GridActionsCell.mjs +58 -55
- package/components/cell/GridActionsCellItem.d.mts +20 -6
- package/components/cell/GridActionsCellItem.d.ts +20 -6
- package/components/cell/GridActionsCellItem.js +30 -8
- package/components/cell/GridActionsCellItem.mjs +32 -10
- package/components/cell/GridBooleanCell.mjs +2 -2
- package/components/cell/GridCell.js +9 -1
- package/components/cell/GridCell.mjs +11 -3
- package/components/cell/GridEditBooleanCell.mjs +2 -2
- package/components/cell/GridEditDateCell.mjs +2 -2
- package/components/cell/GridEditInputCell.mjs +2 -2
- package/components/cell/GridEditLongTextCell.mjs +1 -1
- package/components/cell/GridEditSingleSelectCell.mjs +2 -2
- package/components/cell/GridFooterCell.mjs +2 -2
- package/components/cell/GridLongTextCell.mjs +1 -1
- package/components/cell/GridSkeletonCell.mjs +2 -2
- package/components/columnHeaders/ColumnHeaderMenuIcon.mjs +1 -1
- package/components/columnHeaders/GridBaseColumnHeaders.mjs +2 -2
- package/components/columnHeaders/GridColumnGroupHeader.mjs +1 -1
- package/components/columnHeaders/GridColumnHeaderFilterIconButton.mjs +1 -1
- package/components/columnHeaders/GridColumnHeaderItem.mjs +1 -1
- package/components/columnHeaders/GridColumnHeaderSeparator.d.mts +1 -1
- package/components/columnHeaders/GridColumnHeaderSeparator.d.ts +1 -1
- package/components/columnHeaders/GridColumnHeaderSeparator.mjs +2 -2
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +17 -0
- package/components/columnHeaders/GridColumnHeaderSortIcon.mjs +18 -1
- package/components/columnHeaders/GridColumnHeaderTitle.mjs +2 -2
- package/components/columnHeaders/GridGenericColumnHeaderItem.mjs +2 -2
- package/components/columnHeaders/GridIconButtonContainer.mjs +2 -2
- package/components/columnSelection/GridCellCheckboxRenderer.mjs +2 -2
- package/components/columnSelection/GridHeaderCheckbox.mjs +2 -2
- package/components/columnSelection/GridRowCheckbox.js +1 -3
- package/components/columnSelection/GridRowCheckbox.mjs +3 -5
- package/components/columnsManagement/GridColumnsManagement.mjs +1 -1
- package/components/columnsPanel/ColumnsPanelTrigger.mjs +2 -2
- package/components/containers/GridFooterContainer.mjs +2 -2
- package/components/containers/GridOverlay.mjs +2 -2
- package/components/containers/GridRoot.mjs +2 -2
- package/components/containers/GridRootStyles.js +22 -10
- package/components/containers/GridRootStyles.mjs +22 -10
- package/components/containers/GridToolbarContainer.mjs +2 -2
- package/components/export/ExportCsv.mjs +2 -2
- package/components/export/ExportPrint.js +4 -1
- package/components/export/ExportPrint.mjs +6 -3
- package/components/filterPanel/FilterPanelTrigger.mjs +2 -2
- package/components/menu/GridMenu.mjs +2 -2
- package/components/menu/columnMenu/GridColumnHeaderMenu.mjs +1 -1
- package/components/menu/columnMenu/GridColumnMenu.mjs +2 -2
- package/components/menu/columnMenu/GridColumnMenuContainer.mjs +2 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuColumnsItem.mjs +1 -1
- package/components/panel/GridColumnsPanel.mjs +1 -1
- package/components/panel/GridPanel.mjs +2 -2
- package/components/panel/GridPanelContent.mjs +2 -2
- package/components/panel/GridPanelContext.mjs +1 -1
- package/components/panel/GridPanelFooter.mjs +2 -2
- package/components/panel/GridPanelHeader.mjs +2 -2
- package/components/panel/GridPanelWrapper.mjs +2 -2
- package/components/panel/GridPreferencesPanel.mjs +1 -1
- package/components/panel/filterPanel/GridFilterForm.mjs +1 -1
- package/components/panel/filterPanel/GridFilterFormBase.mjs +2 -2
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -12
- package/components/panel/filterPanel/GridFilterInputBoolean.mjs +3 -14
- package/components/panel/filterPanel/GridFilterInputDate.mjs +2 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.mjs +2 -2
- package/components/panel/filterPanel/GridFilterInputMultipleValue.mjs +2 -2
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -12
- package/components/panel/filterPanel/GridFilterInputSingleSelect.mjs +3 -14
- package/components/panel/filterPanel/GridFilterInputValue.mjs +2 -2
- package/components/panel/filterPanel/GridFilterPanel.mjs +1 -1
- package/components/panel/filterPanel/GridFilterPanelBase.mjs +2 -2
- package/components/panel/filterPanel/filterPanelUtils.mjs +1 -1
- package/components/quickFilter/QuickFilter.js +7 -2
- package/components/quickFilter/QuickFilter.mjs +9 -4
- package/components/quickFilter/QuickFilterClear.js +17 -0
- package/components/quickFilter/QuickFilterClear.mjs +19 -2
- package/components/quickFilter/QuickFilterControl.mjs +2 -2
- package/components/quickFilter/QuickFilterTrigger.mjs +2 -2
- package/components/toolbar/GridToolbar.mjs +2 -2
- package/components/toolbar/GridToolbarColumnsButton.mjs +1 -1
- package/components/toolbar/GridToolbarDensitySelector.mjs +1 -1
- package/components/toolbar/GridToolbarExport.js +4 -1
- package/components/toolbar/GridToolbarExport.mjs +6 -3
- package/components/toolbar/GridToolbarExportContainer.mjs +1 -1
- package/components/toolbar/GridToolbarFilterButton.mjs +1 -1
- package/components/toolbar/GridToolbarQuickFilter.mjs +2 -2
- package/components/toolbarV8/GridToolbar.mjs +2 -2
- package/components/toolbarV8/Toolbar.mjs +2 -2
- package/components/toolbarV8/ToolbarButton.js +17 -0
- package/components/toolbarV8/ToolbarButton.mjs +19 -2
- package/components/virtualization/GridBottomContainer.mjs +1 -1
- package/components/virtualization/GridMainContainer.mjs +1 -1
- package/components/virtualization/GridTopContainer.mjs +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +2 -2
- package/components/virtualization/GridVirtualScrollbar.mjs +2 -2
- package/components/virtualization/GridVirtualScroller.js +5 -2
- package/components/virtualization/GridVirtualScroller.mjs +6 -3
- package/components/virtualization/GridVirtualScrollerContent.mjs +1 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.mjs +1 -1
- package/constants/cssVariables.mjs +1 -1
- package/constants/defaultGridSlotsComponents.mjs +1 -1
- package/constants/signature.d.mts +1 -1
- package/constants/signature.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridPipeProcessing.mjs +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.js +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.mjs +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.js +2 -2
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.mjs +2 -2
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.mts +1 -1
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +1 -1
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.js +2 -2
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.mjs +2 -2
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.mjs +2 -2
- package/hooks/core/useGridApiInitialization.js +1 -1
- package/hooks/core/useGridApiInitialization.mjs +1 -1
- package/hooks/core/useGridIsRtl.mjs +1 -1
- package/hooks/core/useGridProps.mjs +1 -1
- package/hooks/core/useGridStateInitialization.mjs +1 -1
- package/hooks/core/useGridVirtualizer.d.mts +2 -2
- package/hooks/core/useGridVirtualizer.d.ts +2 -2
- package/hooks/core/useGridVirtualizer.js +6 -6
- package/hooks/core/useGridVirtualizer.mjs +4 -4
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.mjs +2 -2
- package/hooks/features/columnGrouping/useGridColumnGrouping.mjs +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.mjs +1 -1
- package/hooks/features/columnMenu/getColumnMenuItemKeys.mjs +1 -1
- package/hooks/features/columnMenu/useGridColumnMenu.mjs +1 -1
- package/hooks/features/columnMenu/useGridColumnMenuSlots.mjs +2 -2
- package/hooks/features/columnResize/useGridColumnResize.js +4 -1
- package/hooks/features/columnResize/useGridColumnResize.mjs +5 -2
- package/hooks/features/columns/gridColumnsInterfaces.d.mts +1 -1
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.d.mts +1 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.mjs +1 -1
- package/hooks/features/columns/useGridColumns.js +1 -1
- package/hooks/features/columns/useGridColumns.mjs +2 -2
- package/hooks/features/dataSource/cache.js +1 -1
- package/hooks/features/dataSource/cache.mjs +1 -1
- package/hooks/features/dataSource/useGridDataSourceBase.js +14 -29
- package/hooks/features/dataSource/useGridDataSourceBase.mjs +17 -32
- package/hooks/features/dataSource/useGridDataSourcePolling.d.mts +29 -0
- package/hooks/features/dataSource/useGridDataSourcePolling.d.ts +29 -0
- package/hooks/features/dataSource/useGridDataSourcePolling.js +62 -0
- package/hooks/features/dataSource/useGridDataSourcePolling.mjs +54 -0
- package/hooks/features/dataSource/utils.d.mts +1 -1
- package/hooks/features/dataSource/utils.d.ts +1 -1
- package/hooks/features/dataSource/utils.mjs +1 -1
- package/hooks/features/density/useGridDensity.mjs +1 -1
- package/hooks/features/dimensions/useGridDimensions.d.mts +1 -1
- package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/hooks/features/dimensions/useGridDimensions.mjs +3 -3
- package/hooks/features/editing/useGridCellEditing.js +1 -1
- package/hooks/features/editing/useGridCellEditing.mjs +5 -5
- package/hooks/features/editing/useGridEditing.mjs +1 -1
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/editing/useGridRowEditing.mjs +5 -5
- package/hooks/features/export/serializers/csvSerializer.js +5 -5
- package/hooks/features/export/serializers/csvSerializer.mjs +5 -5
- package/hooks/features/export/useGridPrintExport.js +44 -20
- package/hooks/features/export/useGridPrintExport.mjs +45 -21
- package/hooks/features/filter/gridFilterUtils.js +3 -3
- package/hooks/features/filter/gridFilterUtils.mjs +5 -5
- package/hooks/features/filter/useGridFilter.js +2 -2
- package/hooks/features/filter/useGridFilter.mjs +3 -3
- package/hooks/features/focus/useGridFocus.mjs +1 -1
- package/hooks/features/headerFiltering/useGridHeaderFiltering.mjs +1 -1
- package/hooks/features/listView/useGridListView.d.mts +2 -2
- package/hooks/features/listView/useGridListView.d.ts +2 -2
- package/hooks/features/listView/useGridListView.js +1 -1
- package/hooks/features/listView/useGridListView.mjs +2 -2
- package/hooks/features/pagination/useGridPagination.mjs +1 -1
- package/hooks/features/pagination/useGridPaginationMeta.mjs +1 -1
- package/hooks/features/pagination/useGridPaginationModel.mjs +1 -1
- package/hooks/features/pagination/useGridRowCount.js +2 -2
- package/hooks/features/pagination/useGridRowCount.mjs +2 -2
- package/hooks/features/preferencesPanel/gridPreferencePanelsValue.d.mts +1 -1
- package/hooks/features/preferencesPanel/gridPreferencePanelsValue.d.ts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.mjs +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.d.mts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +50 -9
- package/hooks/features/rowSelection/useGridRowSelection.mjs +52 -11
- package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.mjs +1 -1
- package/hooks/features/rowSelection/utils.js +5 -0
- package/hooks/features/rowSelection/utils.mjs +5 -0
- package/hooks/features/rows/gridRowsUtils.js +2 -2
- package/hooks/features/rows/gridRowsUtils.mjs +3 -3
- package/hooks/features/rows/useGridRowSpanning.mjs +1 -1
- package/hooks/features/rows/useGridRows.mjs +1 -1
- package/hooks/features/rows/useGridRowsMeta.mjs +1 -1
- package/hooks/features/rows/useGridRowsOverridableMethods.mjs +1 -1
- package/hooks/features/rows/useGridRowsPreProcessors.mjs +1 -1
- package/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/hooks/features/sorting/gridSortingUtils.mjs +3 -3
- package/hooks/features/sorting/useGridSorting.js +2 -2
- package/hooks/features/sorting/useGridSorting.mjs +3 -3
- package/hooks/features/virtualization/gridFocusedVirtualCellSelector.mjs +1 -1
- package/hooks/features/virtualization/useGridVirtualization.mjs +1 -1
- package/hooks/utils/index.d.mts +1 -1
- package/hooks/utils/index.d.ts +1 -1
- package/hooks/utils/index.js +8 -12
- package/hooks/utils/index.mjs +2 -1
- package/hooks/utils/useGridSelector.js +2 -2
- package/hooks/utils/useGridSelector.mjs +2 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/constants.d.mts +1 -1
- package/internals/constants.d.ts +1 -1
- package/internals/index.d.mts +1 -0
- package/internals/index.d.ts +1 -0
- package/internals/index.js +8 -0
- package/internals/index.mjs +1 -0
- package/internals/utils/cache.d.mts +0 -1
- package/internals/utils/cache.d.ts +0 -1
- package/internals/utils/cache.js +1 -3
- package/internals/utils/cache.mjs +1 -3
- package/internals/utils/computeSlots.mjs +1 -1
- package/internals/utils/propValidation.js +2 -2
- package/internals/utils/propValidation.mjs +3 -3
- package/material/index.mjs +2 -2
- package/models/api/gridCoreApi.d.mts +1 -1
- package/models/api/gridCoreApi.d.ts +1 -1
- package/models/api/gridEditingApi.d.mts +6 -6
- package/models/api/gridEditingApi.d.ts +6 -6
- package/models/api/gridPrintExportApi.d.mts +2 -1
- package/models/api/gridPrintExportApi.d.ts +2 -1
- package/models/events/gridEventLookup.d.mts +5 -5
- package/models/events/gridEventLookup.d.ts +5 -5
- package/models/gridBaseSlots.d.mts +18 -1
- package/models/gridBaseSlots.d.ts +18 -1
- package/models/gridEditRowModel.d.mts +3 -3
- package/models/gridEditRowModel.d.ts +3 -3
- package/models/gridExport.d.mts +13 -0
- package/models/gridExport.d.ts +13 -0
- package/models/gridFilterItem.d.mts +2 -2
- package/models/gridFilterItem.d.ts +2 -2
- package/models/index.d.mts +2 -1
- package/models/index.d.ts +2 -1
- package/models/params/gridEditCellParams.d.mts +2 -2
- package/models/params/gridEditCellParams.d.ts +2 -2
- package/models/params/gridRowParams.d.mts +2 -2
- package/models/params/gridRowParams.d.ts +2 -2
- package/models/props/DataGridProps.d.mts +8 -0
- package/models/props/DataGridProps.d.ts +8 -0
- package/package.json +6 -6
- package/utils/createSelector.d.mts +1 -1
- package/utils/createSelector.d.ts +1 -1
- package/utils/createSelector.js +1 -1
- package/utils/createSelector.mjs +1 -1
- package/hooks/utils/useFirstRender.d.mts +0 -1
- package/hooks/utils/useFirstRender.d.ts +0 -1
- package/hooks/utils/useFirstRender.js +0 -16
- package/hooks/utils/useFirstRender.mjs +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
|
|
4
|
-
import _extends from "@babel/runtime/helpers/
|
|
4
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
7
7
|
import { GridSignature } from "../../../constants/signature.mjs";
|
|
@@ -9,7 +9,8 @@ import { useGridEvent } from "../../utils/useGridEvent.mjs";
|
|
|
9
9
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.mjs";
|
|
10
10
|
import { useGridLogger } from "../../utils/useGridLogger.mjs";
|
|
11
11
|
import { useGridSelector } from "../../utils/useGridSelector.mjs";
|
|
12
|
-
import { gridRowsLookupSelector, gridRowMaximumTreeDepthSelector, gridRowNodeSelector, gridRowTreeSelector } from "../rows/gridRowsSelector.mjs";
|
|
12
|
+
import { gridDataRowIdsSelector, gridRowsLookupSelector, gridRowMaximumTreeDepthSelector, gridRowNodeSelector, gridRowTreeSelector } from "../rows/gridRowsSelector.mjs";
|
|
13
|
+
import { GRID_ROOT_GROUP_ID } from "../rows/gridRowsUtils.mjs";
|
|
13
14
|
import { gridRowSelectionManagerSelector, gridRowSelectionStateSelector, gridRowSelectionCountSelector, gridRowSelectionIdsSelector } from "./gridRowSelectionSelector.mjs";
|
|
14
15
|
import { gridFocusCellSelector } from "../focus/gridFocusStateSelector.mjs";
|
|
15
16
|
import { gridExpandedSortedRowIdsSelector, gridFilteredRowsLookupSelector, gridFilterModelSelector, gridQuickFilterValuesSelector } from "../filter/gridFilterSelector.mjs";
|
|
@@ -119,6 +120,10 @@ You need to upgrade to DataGridPro or DataGridPremium component to unlock multip
|
|
|
119
120
|
if (props.rowSelection === false) {
|
|
120
121
|
return false;
|
|
121
122
|
}
|
|
123
|
+
const rowNode = gridRowNodeSelector(apiRef, id);
|
|
124
|
+
if (rowNode?.type === 'footer' || rowNode?.type === 'pinnedRow' || rowNode?.type === 'skeletonRow') {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
122
127
|
|
|
123
128
|
// If `keepNonExistentRowsSelected` is true, we might run in a case where row selectability is checked for a row that does not exist.
|
|
124
129
|
// Since that row was previously selected (otherwise it would not be checked at this point), we return true.
|
|
@@ -128,10 +133,6 @@ You need to upgrade to DataGridPro or DataGridPremium component to unlock multip
|
|
|
128
133
|
if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {
|
|
129
134
|
return false;
|
|
130
135
|
}
|
|
131
|
-
const rowNode = gridRowNodeSelector(apiRef, id);
|
|
132
|
-
if (rowNode?.type === 'footer' || rowNode?.type === 'pinnedRow') {
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
136
|
return true;
|
|
136
137
|
}, [apiRef, props.rowSelection, props.keepNonExistentRowsSelected, propIsRowSelectable]);
|
|
137
138
|
const getSelectedRows = React.useCallback(() => gridRowSelectionIdsSelector(apiRef), [apiRef]);
|
|
@@ -307,6 +308,7 @@ You need to upgrade to DataGridPro or DataGridPremium component to unlock multip
|
|
|
307
308
|
* EVENTS
|
|
308
309
|
*/
|
|
309
310
|
const isFirstRender = React.useRef(true);
|
|
311
|
+
const previousRowsLookupRef = React.useRef(null);
|
|
310
312
|
const removeOutdatedSelection = React.useCallback(() => {
|
|
311
313
|
if (isFirstRender.current) {
|
|
312
314
|
return;
|
|
@@ -315,6 +317,11 @@ You need to upgrade to DataGridPro or DataGridPremium component to unlock multip
|
|
|
315
317
|
const rowsLookup = gridRowsLookupSelector(apiRef);
|
|
316
318
|
const rowTree = gridRowTreeSelector(apiRef);
|
|
317
319
|
const filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
|
|
320
|
+
const previousRowsLookup = previousRowsLookupRef.current;
|
|
321
|
+
previousRowsLookupRef.current = rowsLookup;
|
|
322
|
+
// Read the depth at call time. The event that runs this callback can fire in the same
|
|
323
|
+
// tick as the state update that changes the depth, before the render-scope value updates.
|
|
324
|
+
const isNested = gridRowMaximumTreeDepthSelector(apiRef) > 1;
|
|
318
325
|
const isNonExistent = id => {
|
|
319
326
|
if (props.filterMode === 'server') {
|
|
320
327
|
return !rowsLookup[id];
|
|
@@ -342,6 +349,32 @@ You need to upgrade to DataGridPro or DataGridPremium component to unlock multip
|
|
|
342
349
|
return node.children.some(childId => isOrHasSelectableDescendant(childId));
|
|
343
350
|
};
|
|
344
351
|
let hasChanged = false;
|
|
352
|
+
|
|
353
|
+
// Rows can load after their parent was selected (server-side lazy loading).
|
|
354
|
+
// They arrive unselected, so the parent re-derivation below would drop the parent.
|
|
355
|
+
// With `rowSelectionPropagation.descendants`, the rows that appeared since the last run
|
|
356
|
+
// inherit the selection state of their closest previously known ancestor instead.
|
|
357
|
+
if (isNested && props.rowSelectionPropagation?.descendants && currentSelection.type === 'include' && currentSelection.ids.size > 0 && previousRowsLookup !== null && previousRowsLookup !== rowsLookup) {
|
|
358
|
+
const isNewRow = id => rowsLookup[id] !== undefined && previousRowsLookup[id] === undefined;
|
|
359
|
+
const inheritsSelection = id => {
|
|
360
|
+
const parentId = rowTree[id]?.parent;
|
|
361
|
+
if (parentId == null || parentId === GRID_ROOT_GROUP_ID) {
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
if (selectionManager.has(parentId)) {
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
// A row that appeared together with its parent reads the state further up the chain.
|
|
368
|
+
return isNewRow(parentId) ? inheritsSelection(parentId) : false;
|
|
369
|
+
};
|
|
370
|
+
const dataRowIds = gridDataRowIdsSelector(apiRef);
|
|
371
|
+
for (const id of dataRowIds) {
|
|
372
|
+
if (isNewRow(id) && filteredRowsLookup[id] !== false && inheritsSelection(id) && apiRef.current.isRowSelectable(id)) {
|
|
373
|
+
selectionManager.select(id);
|
|
374
|
+
hasChanged = true;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
345
378
|
for (const id of currentSelection.ids) {
|
|
346
379
|
if (isNonExistent(id)) {
|
|
347
380
|
if (props.keepNonExistentRowsSelected) {
|
|
@@ -374,9 +407,10 @@ You need to upgrade to DataGridPro or DataGridPremium component to unlock multip
|
|
|
374
407
|
// For nested data, on row tree updation (filtering, adding rows, etc.) when the selection is
|
|
375
408
|
// not empty, we need to re-run scanning of the tree to propagate the selection changes
|
|
376
409
|
// Example: A parent whose de-selected children are filtered out should now be selected
|
|
377
|
-
|
|
378
|
-
//
|
|
379
|
-
|
|
410
|
+
// With a data source, an `exclude` model is left alone: the grid only knows the loaded
|
|
411
|
+
// subset of the rows, so rewriting the model into an `include` of the known rows would
|
|
412
|
+
// drop the "rows that load later are selected too" semantics of the select-all state.
|
|
413
|
+
const shouldReapplyPropagation = isNested && props.rowSelectionPropagation?.parents && (newSelectionModel.type === 'exclude' ? props.dataSource === undefined : newSelectionModel.ids.size > 0);
|
|
380
414
|
if (hasChanged || shouldReapplyPropagation) {
|
|
381
415
|
if (shouldReapplyPropagation) {
|
|
382
416
|
if (newSelectionModel.type === 'exclude') {
|
|
@@ -390,13 +424,20 @@ You need to upgrade to DataGridPro or DataGridPremium component to unlock multip
|
|
|
390
424
|
}
|
|
391
425
|
apiRef.current.selectRows(selectedRowIds, true, true);
|
|
392
426
|
} else {
|
|
393
|
-
|
|
427
|
+
// `getPropagatedRowSelectionModel` reads the sibling selection state from the model
|
|
428
|
+
// built above, so the rows selected during this run count for the parent derivation.
|
|
429
|
+
// `selectRows` would read the state from before this run instead.
|
|
430
|
+
const propagatedModel = apiRef.current.getPropagatedRowSelectionModel(newSelectionModel);
|
|
431
|
+
const isSelectionValid = propagatedModel.ids.size < 2 || canHaveMultipleSelection;
|
|
432
|
+
if (isSelectionValid && (propagatedModel.type !== currentSelection.type || propagatedModel.ids.size !== currentSelection.ids.size || !Array.from(propagatedModel.ids).every(id => currentSelection.ids.has(id)))) {
|
|
433
|
+
apiRef.current.setRowSelectionModel(propagatedModel, 'multipleRowsSelection');
|
|
434
|
+
}
|
|
394
435
|
}
|
|
395
436
|
} else {
|
|
396
437
|
apiRef.current.setRowSelectionModel(newSelectionModel, 'multipleRowsSelection');
|
|
397
438
|
}
|
|
398
439
|
}
|
|
399
|
-
}, [apiRef,
|
|
440
|
+
}, [apiRef, props.rowSelectionPropagation?.parents, props.rowSelectionPropagation?.descendants, props.keepNonExistentRowsSelected, props.filterMode, props.dataSource, canHaveMultipleSelection, getRowsToBeSelected]);
|
|
400
441
|
const handleSingleRowSelection = React.useCallback((id, event) => {
|
|
401
442
|
const hasCtrlKey = event.metaKey || event.ctrlKey;
|
|
402
443
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import composeClasses from '@mui/utils/composeClasses';
|
|
4
4
|
import { useGridRegisterPipeProcessor } from "../../core/pipeProcessing/index.mjs";
|
|
@@ -67,6 +67,11 @@ const checkboxPropsSelector = exports.checkboxPropsSelector = (0, _createSelecto
|
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
const node = rowTree[itemToTraverseId];
|
|
70
|
+
// Skeleton rows are placeholders for rows that are not loaded yet.
|
|
71
|
+
// They have no selection state, so they do not affect the parent checkbox state.
|
|
72
|
+
if (node?.type === 'skeletonRow') {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
70
75
|
if (node?.type === 'group') {
|
|
71
76
|
node.children.forEach(traverseDescendants);
|
|
72
77
|
}
|
|
@@ -60,6 +60,11 @@ export const checkboxPropsSelector = createSelector(gridColumnDefinitionsSelecto
|
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
const node = rowTree[itemToTraverseId];
|
|
63
|
+
// Skeleton rows are placeholders for rows that are not loaded yet.
|
|
64
|
+
// They have no selection state, so they do not affect the parent checkbox state.
|
|
65
|
+
if (node?.type === 'skeletonRow') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
63
68
|
if (node?.type === 'group') {
|
|
64
69
|
node.children.forEach(traverseDescendants);
|
|
65
70
|
}
|
|
@@ -253,7 +253,7 @@ const warnIfReplaceLosesPrototype = (oldRow, replacement) => {
|
|
|
253
253
|
|
|
254
254
|
// The message must stay free of row-specific details: `warnOnce()` caches by message, so
|
|
255
255
|
// interpolating the id would log once per row and grow the cache with every update.
|
|
256
|
-
(0, _warning.warnOnce)(["MUI X Data Grid: A plain object was provided as the `row` of a `_action: 'replace'` update, but the row it replaces is a class instance.", "Building the replacement with a spread (`{ _action: 'replace', row: { ...row } }`) creates a plain object, dropping the prototype chain and the private fields that `_action: 'replace'` exists to preserve.", "Pass the instance itself instead, for example `{ _action: 'replace', row }`.", 'For more detail, see https://mui.com/x/react-data-grid/row-updates/.']);
|
|
256
|
+
(0, _warning.warnOnce)(["MUI X Data Grid: A plain object was provided as the `row` of a `_action: 'replace'` update, but the row it replaces is a class instance.", "Building the replacement with a spread (`{ _action: 'replace', row: { ...row } }`) creates a plain object, dropping the prototype chain and the private fields that `_action: 'replace'` exists to preserve.", "Pass the instance itself instead, for example `{ _action: 'replace', row }`.", 'For more detail, see https://mui.com/x/react-data-grid/row-updates/.'].join('\n'));
|
|
257
257
|
};
|
|
258
258
|
exports.warnIfReplaceLosesPrototype = warnIfReplaceLosesPrototype;
|
|
259
259
|
const updateCacheWithNewRows = ({
|
|
@@ -286,7 +286,7 @@ const updateCacheWithNewRows = ({
|
|
|
286
286
|
} else if (uniqueUpdates.has(id)) {
|
|
287
287
|
const accumulatedUpdate = uniqueUpdates.get(id);
|
|
288
288
|
if (process.env.NODE_ENV !== 'production' && replaceIds.has(id)) {
|
|
289
|
-
(0, _warning.warnOnce)(["MUI X Data Grid: A row was provided with `_action: 'replace'` but it is not the last update for that row in this batch.", 'The remaining updates are merged onto the replacement, so the row keeps its prototype but is neither the same object nor carries its `#private` fields, which a merge cannot copy.', 'Make the replace the last update for that row if `apiRef.current.getRow(id)` must return the object you passed in.', 'For more detail, see https://mui.com/x/react-data-grid/row-updates/.']);
|
|
289
|
+
(0, _warning.warnOnce)(["MUI X Data Grid: A row was provided with `_action: 'replace'` but it is not the last update for that row in this batch.", 'The remaining updates are merged onto the replacement, so the row keeps its prototype but is neither the same object nor carries its `#private` fields, which a merge cannot copy.', 'Make the replace the last update for that row if `apiRef.current.getRow(id)` must return the object you passed in.', 'For more detail, see https://mui.com/x/react-data-grid/row-updates/.'].join('\n'));
|
|
290
290
|
}
|
|
291
291
|
// The merge keeps the accumulated entry's prototype and the id stays in `replaceIds`,
|
|
292
292
|
// so the result is still applied as a replace.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
|
|
3
3
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
4
4
|
import { gridRowNodeSelector } from "./gridRowsSelector.mjs";
|
|
@@ -231,7 +231,7 @@ export const warnIfReplaceLosesPrototype = (oldRow, replacement) => {
|
|
|
231
231
|
|
|
232
232
|
// The message must stay free of row-specific details: `warnOnce()` caches by message, so
|
|
233
233
|
// interpolating the id would log once per row and grow the cache with every update.
|
|
234
|
-
warnOnce(["MUI X Data Grid: A plain object was provided as the `row` of a `_action: 'replace'` update, but the row it replaces is a class instance.", "Building the replacement with a spread (`{ _action: 'replace', row: { ...row } }`) creates a plain object, dropping the prototype chain and the private fields that `_action: 'replace'` exists to preserve.", "Pass the instance itself instead, for example `{ _action: 'replace', row }`.", 'For more detail, see https://mui.com/x/react-data-grid/row-updates/.']);
|
|
234
|
+
warnOnce(["MUI X Data Grid: A plain object was provided as the `row` of a `_action: 'replace'` update, but the row it replaces is a class instance.", "Building the replacement with a spread (`{ _action: 'replace', row: { ...row } }`) creates a plain object, dropping the prototype chain and the private fields that `_action: 'replace'` exists to preserve.", "Pass the instance itself instead, for example `{ _action: 'replace', row }`.", 'For more detail, see https://mui.com/x/react-data-grid/row-updates/.'].join('\n'));
|
|
235
235
|
};
|
|
236
236
|
export const updateCacheWithNewRows = ({
|
|
237
237
|
previousCache,
|
|
@@ -263,7 +263,7 @@ export const updateCacheWithNewRows = ({
|
|
|
263
263
|
} else if (uniqueUpdates.has(id)) {
|
|
264
264
|
const accumulatedUpdate = uniqueUpdates.get(id);
|
|
265
265
|
if (process.env.NODE_ENV !== 'production' && replaceIds.has(id)) {
|
|
266
|
-
warnOnce(["MUI X Data Grid: A row was provided with `_action: 'replace'` but it is not the last update for that row in this batch.", 'The remaining updates are merged onto the replacement, so the row keeps its prototype but is neither the same object nor carries its `#private` fields, which a merge cannot copy.', 'Make the replace the last update for that row if `apiRef.current.getRow(id)` must return the object you passed in.', 'For more detail, see https://mui.com/x/react-data-grid/row-updates/.']);
|
|
266
|
+
warnOnce(["MUI X Data Grid: A row was provided with `_action: 'replace'` but it is not the last update for that row in this batch.", 'The remaining updates are merged onto the replacement, so the row keeps its prototype but is neither the same object nor carries its `#private` fields, which a merge cannot copy.', 'Make the replace the last update for that row if `apiRef.current.getRow(id)` must return the object you passed in.', 'For more detail, see https://mui.com/x/react-data-grid/row-updates/.'].join('\n'));
|
|
267
267
|
}
|
|
268
268
|
// The merge keeps the accumulated entry's prototype and the id stays in `replaceIds`,
|
|
269
269
|
// so the result is still applied as a replace.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { Rowspan } from '@mui/x-virtualizer/features';
|
|
6
6
|
import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSelector.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
|
|
4
|
-
import _extends from "@babel/runtime/helpers/
|
|
4
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
7
7
|
import { isObjectEmpty } from '@mui/x-internals/isObjectEmpty';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.mjs";
|
|
3
3
|
import { gridPaginationSelector } from "../pagination/gridPaginationSelector.mjs";
|
|
4
4
|
import { useGridRegisterPipeApplier } from "../../core/pipeProcessing/index.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _formatErrorMessage from "@mui/x-internals/formatErrorMessage";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { gridRowTreeSelector, gridRowNodeSelector } from "./gridRowsSelector.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import { GRID_DEFAULT_STRATEGY, useGridRegisterStrategyProcessor } from "../../core/strategyProcessing/index.mjs";
|
|
3
3
|
import { buildRootGroup, GRID_ROOT_GROUP_ID } from "./gridRowsUtils.mjs";
|
|
4
4
|
const createFlatRowTree = rows => {
|
|
@@ -11,7 +11,7 @@ var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
|
11
11
|
const sanitizeSortModel = (model, disableMultipleColumnsSorting) => {
|
|
12
12
|
if (disableMultipleColumnsSorting && model.length > 1) {
|
|
13
13
|
if (process.env.NODE_ENV !== 'production') {
|
|
14
|
-
(0, _warning.
|
|
14
|
+
(0, _warning.errorOnce)(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the Data Grid, this prop is always `true`.'].join('\n'));
|
|
15
15
|
}
|
|
16
16
|
return [model[0]];
|
|
17
17
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/
|
|
2
|
-
import {
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import { errorOnce } from '@mui/x-internals/warning';
|
|
3
3
|
import { gridRowNodeSelector } from "../rows/gridRowsSelector.mjs";
|
|
4
4
|
export const sanitizeSortModel = (model, disableMultipleColumnsSorting) => {
|
|
5
5
|
if (disableMultipleColumnsSorting && model.length > 1) {
|
|
6
6
|
if (process.env.NODE_ENV !== 'production') {
|
|
7
|
-
|
|
7
|
+
errorOnce(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the Data Grid, this prop is always `true`.'].join('\n'));
|
|
8
8
|
}
|
|
9
9
|
return [model[0]];
|
|
10
10
|
}
|
|
@@ -9,13 +9,13 @@ exports.useGridSorting = exports.sortingStateInitializer = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
12
|
+
var _useOnFirstRender = require("@base-ui/utils/useOnFirstRender");
|
|
12
13
|
var _useGridEvent = require("../../utils/useGridEvent");
|
|
13
14
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
14
15
|
var _useGridLogger = require("../../utils/useGridLogger");
|
|
15
16
|
var _gridColumnsSelector = require("../columns/gridColumnsSelector");
|
|
16
17
|
var _gridSortingSelector = require("./gridSortingSelector");
|
|
17
18
|
var _rows = require("../rows");
|
|
18
|
-
var _useFirstRender = require("../../utils/useFirstRender");
|
|
19
19
|
var _strategyProcessing = require("../../core/strategyProcessing");
|
|
20
20
|
var _gridSortingUtils = require("./gridSortingUtils");
|
|
21
21
|
var _pipeProcessing = require("../../core/pipeProcessing");
|
|
@@ -247,7 +247,7 @@ const useGridSorting = (apiRef, props) => {
|
|
|
247
247
|
/**
|
|
248
248
|
* 1ST RENDER
|
|
249
249
|
*/
|
|
250
|
-
(0,
|
|
250
|
+
(0, _useOnFirstRender.useOnFirstRender)(() => {
|
|
251
251
|
if (props.signature === 'DataGrid') {
|
|
252
252
|
apiRef.current.applySorting();
|
|
253
253
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
4
|
+
import { useOnFirstRender } from '@base-ui/utils/useOnFirstRender';
|
|
4
5
|
import { useGridEvent } from "../../utils/useGridEvent.mjs";
|
|
5
6
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.mjs";
|
|
6
7
|
import { useGridLogger } from "../../utils/useGridLogger.mjs";
|
|
7
8
|
import { gridColumnLookupSelector } from "../columns/gridColumnsSelector.mjs";
|
|
8
9
|
import { gridSortedRowEntriesSelector, gridSortedRowIdsSelector, gridSortModelSelector } from "./gridSortingSelector.mjs";
|
|
9
10
|
import { GRID_ROOT_GROUP_ID, gridRowTreeSelector } from "../rows/index.mjs";
|
|
10
|
-
import { useFirstRender } from "../../utils/useFirstRender.mjs";
|
|
11
11
|
import { useGridRegisterStrategyProcessor, GRID_DEFAULT_STRATEGY } from "../../core/strategyProcessing/index.mjs";
|
|
12
12
|
import { buildAggregatedSortingApplier, mergeStateWithSortModel, getNextGridSortDirection, sanitizeSortModel } from "./gridSortingUtils.mjs";
|
|
13
13
|
import { useGridRegisterPipeProcessor } from "../../core/pipeProcessing/index.mjs";
|
|
@@ -238,7 +238,7 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
238
238
|
/**
|
|
239
239
|
* 1ST RENDER
|
|
240
240
|
*/
|
|
241
|
-
|
|
241
|
+
useOnFirstRender(() => {
|
|
242
242
|
if (props.signature === 'DataGrid') {
|
|
243
243
|
apiRef.current.applySorting();
|
|
244
244
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import { createSelector, createSelectorMemoized } from "../../../utils/createSelector.mjs";
|
|
3
3
|
import { gridVisibleColumnDefinitionsSelector } from "../columns/gridColumnsSelector.mjs";
|
|
4
4
|
import { gridRenderContextSelector } from "./gridVirtualizationSelectors.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { EMPTY_RENDER_CONTEXT } from '@mui/x-virtualizer';
|
|
6
6
|
import { platform } from '@base-ui/utils/platform';
|
package/hooks/utils/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export * from '@mui/x-internals/useRunOnce';
|
|
2
|
+
export { useOnFirstRender as useFirstRender } from '@base-ui/utils/useOnFirstRender';
|
|
2
3
|
export { useGridEvent, useGridEventPriority, unstable_resetCleanupTracking } from "./useGridEvent.mjs";
|
|
3
4
|
export * from "./useGridApiMethod.mjs";
|
|
4
5
|
export * from "./useGridLogger.mjs";
|
|
5
6
|
export { useGridSelector } from "./useGridSelector.mjs";
|
|
6
7
|
export * from "./useGridNativeEventListener.mjs";
|
|
7
|
-
export * from "./useFirstRender.mjs";
|
|
8
8
|
export * from "./useOnMount.mjs";
|
|
9
9
|
export * from "./useRunOncePerLoop.mjs";
|
|
10
10
|
export type { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
package/hooks/utils/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export * from '@mui/x-internals/useRunOnce';
|
|
2
|
+
export { useOnFirstRender as useFirstRender } from '@base-ui/utils/useOnFirstRender';
|
|
2
3
|
export { useGridEvent, useGridEventPriority, unstable_resetCleanupTracking } from "./useGridEvent.js";
|
|
3
4
|
export * from "./useGridApiMethod.js";
|
|
4
5
|
export * from "./useGridLogger.js";
|
|
5
6
|
export { useGridSelector } from "./useGridSelector.js";
|
|
6
7
|
export * from "./useGridNativeEventListener.js";
|
|
7
|
-
export * from "./useFirstRender.js";
|
|
8
8
|
export * from "./useOnMount.js";
|
|
9
9
|
export * from "./useRunOncePerLoop.js";
|
|
10
10
|
export type { RenderProp } from '@mui/x-internals/useComponentRenderer';
|
package/hooks/utils/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
+
useFirstRender: true,
|
|
7
8
|
useGridEvent: true,
|
|
8
9
|
useGridEventPriority: true,
|
|
9
10
|
unstable_resetCleanupTracking: true,
|
|
@@ -15,6 +16,12 @@ Object.defineProperty(exports, "unstable_resetCleanupTracking", {
|
|
|
15
16
|
return _useGridEvent.unstable_resetCleanupTracking;
|
|
16
17
|
}
|
|
17
18
|
});
|
|
19
|
+
Object.defineProperty(exports, "useFirstRender", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _useOnFirstRender.useOnFirstRender;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
18
25
|
Object.defineProperty(exports, "useGridEvent", {
|
|
19
26
|
enumerable: true,
|
|
20
27
|
get: function () {
|
|
@@ -45,6 +52,7 @@ Object.keys(_useRunOnce).forEach(function (key) {
|
|
|
45
52
|
}
|
|
46
53
|
});
|
|
47
54
|
});
|
|
55
|
+
var _useOnFirstRender = require("@base-ui/utils/useOnFirstRender");
|
|
48
56
|
var _useGridEvent = require("./useGridEvent");
|
|
49
57
|
var _useGridApiMethod = require("./useGridApiMethod");
|
|
50
58
|
Object.keys(_useGridApiMethod).forEach(function (key) {
|
|
@@ -83,18 +91,6 @@ Object.keys(_useGridNativeEventListener).forEach(function (key) {
|
|
|
83
91
|
}
|
|
84
92
|
});
|
|
85
93
|
});
|
|
86
|
-
var _useFirstRender = require("./useFirstRender");
|
|
87
|
-
Object.keys(_useFirstRender).forEach(function (key) {
|
|
88
|
-
if (key === "default" || key === "__esModule") return;
|
|
89
|
-
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
90
|
-
if (key in exports && exports[key] === _useFirstRender[key]) return;
|
|
91
|
-
Object.defineProperty(exports, key, {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
get: function () {
|
|
94
|
-
return _useFirstRender[key];
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
94
|
var _useOnMount = require("./useOnMount");
|
|
99
95
|
Object.keys(_useOnMount).forEach(function (key) {
|
|
100
96
|
if (key === "default" || key === "__esModule") return;
|
package/hooks/utils/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export * from '@mui/x-internals/useRunOnce';
|
|
2
|
+
// Public re-export kept for backwards compatibility; internals import Base UI directly.
|
|
3
|
+
export { useOnFirstRender as useFirstRender } from '@base-ui/utils/useOnFirstRender';
|
|
2
4
|
export { useGridEvent, useGridEventPriority, unstable_resetCleanupTracking } from "./useGridEvent.mjs";
|
|
3
5
|
export * from "./useGridApiMethod.mjs";
|
|
4
6
|
export * from "./useGridLogger.mjs";
|
|
5
7
|
export { useGridSelector } from "./useGridSelector.mjs";
|
|
6
8
|
export * from "./useGridNativeEventListener.mjs";
|
|
7
|
-
export * from "./useFirstRender.mjs";
|
|
8
9
|
export * from "./useOnMount.mjs";
|
|
9
10
|
export * from "./useRunOncePerLoop.mjs";
|
|
@@ -10,7 +10,7 @@ exports.objectShallowCompare = void 0;
|
|
|
10
10
|
exports.useGridSelector = useGridSelector;
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
13
|
-
var _fastObjectShallowCompare = require("@
|
|
13
|
+
var _fastObjectShallowCompare = require("@base-ui/utils/fastObjectShallowCompare");
|
|
14
14
|
var _warning = require("@mui/x-internals/warning");
|
|
15
15
|
var _useLazyRef = require("./useLazyRef");
|
|
16
16
|
const defaultCompare = Object.is;
|
|
@@ -40,7 +40,7 @@ const createRefs = () => ({
|
|
|
40
40
|
const EMPTY = [];
|
|
41
41
|
function useGridSelector(apiRef, selector, args = undefined, equals = defaultCompare) {
|
|
42
42
|
if (process.env.NODE_ENV !== 'production' && !apiRef.current.state) {
|
|
43
|
-
(0, _warning.warnOnce)(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
|
|
43
|
+
(0, _warning.warnOnce)(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.'].join('\n'));
|
|
44
44
|
}
|
|
45
45
|
const refs = (0, _useLazyRef.useLazyRef)(createRefs);
|
|
46
46
|
const didInit = refs.current.selector !== null;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
5
|
-
import { fastObjectShallowCompare } from '@
|
|
5
|
+
import { fastObjectShallowCompare } from '@base-ui/utils/fastObjectShallowCompare';
|
|
6
6
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
7
7
|
import { useLazyRef } from "./useLazyRef.mjs";
|
|
8
8
|
const defaultCompare = Object.is;
|
|
@@ -32,7 +32,7 @@ const createRefs = () => ({
|
|
|
32
32
|
const EMPTY = [];
|
|
33
33
|
export function useGridSelector(apiRef, selector, args = undefined, equals = defaultCompare) {
|
|
34
34
|
if (process.env.NODE_ENV !== 'production' && !apiRef.current.state) {
|
|
35
|
-
warnOnce(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.']);
|
|
35
|
+
warnOnce(['MUI X: `useGridSelector` has been called before the initialization of the state.', 'This hook can only be used inside the context of the grid.'].join('\n'));
|
|
36
36
|
}
|
|
37
37
|
const refs = useLazyRef(createRefs);
|
|
38
38
|
const didInit = refs.current.selector !== null;
|
package/index.js
CHANGED
package/index.mjs
CHANGED
package/internals/constants.d.ts
CHANGED
package/internals/index.d.mts
CHANGED
|
@@ -102,6 +102,7 @@ export { useGridDataSourceBase } from "../hooks/features/dataSource/useGridDataS
|
|
|
102
102
|
export { CacheChunkManager } from "../hooks/features/dataSource/utils.mjs";
|
|
103
103
|
export { gridGetRowsParamsSelector } from "../hooks/features/dataSource/gridDataSourceSelector.mjs";
|
|
104
104
|
export { useGridDataSourceFilterModelChange } from "../hooks/features/dataSource/useGridDataSourceFilterModelChange.mjs";
|
|
105
|
+
export { useGridDataSourcePolling } from "../hooks/features/dataSource/useGridDataSourcePolling.mjs";
|
|
105
106
|
export { getColumnsToExport, defaultGetRowsToExport } from "../hooks/features/export/utils.mjs";
|
|
106
107
|
export * from "../utils/createControllablePromise.mjs";
|
|
107
108
|
export * from "../utils/focusElement.mjs";
|
package/internals/index.d.ts
CHANGED
|
@@ -102,6 +102,7 @@ export { useGridDataSourceBase } from "../hooks/features/dataSource/useGridDataS
|
|
|
102
102
|
export { CacheChunkManager } from "../hooks/features/dataSource/utils.js";
|
|
103
103
|
export { gridGetRowsParamsSelector } from "../hooks/features/dataSource/gridDataSourceSelector.js";
|
|
104
104
|
export { useGridDataSourceFilterModelChange } from "../hooks/features/dataSource/useGridDataSourceFilterModelChange.js";
|
|
105
|
+
export { useGridDataSourcePolling } from "../hooks/features/dataSource/useGridDataSourcePolling.js";
|
|
105
106
|
export { getColumnsToExport, defaultGetRowsToExport } from "../hooks/features/export/utils.js";
|
|
106
107
|
export * from "../utils/createControllablePromise.js";
|
|
107
108
|
export * from "../utils/focusElement.js";
|
package/internals/index.js
CHANGED
|
@@ -121,6 +121,7 @@ var _exportNames = {
|
|
|
121
121
|
useGridDataSourceBase: true,
|
|
122
122
|
gridGetRowsParamsSelector: true,
|
|
123
123
|
useGridDataSourceFilterModelChange: true,
|
|
124
|
+
useGridDataSourcePolling: true,
|
|
124
125
|
getColumnsToExport: true,
|
|
125
126
|
defaultGetRowsToExport: true,
|
|
126
127
|
NotRendered: true,
|
|
@@ -765,6 +766,12 @@ Object.defineProperty(exports, "useGridDataSourceFilterModelChange", {
|
|
|
765
766
|
return _useGridDataSourceFilterModelChange.useGridDataSourceFilterModelChange;
|
|
766
767
|
}
|
|
767
768
|
});
|
|
769
|
+
Object.defineProperty(exports, "useGridDataSourcePolling", {
|
|
770
|
+
enumerable: true,
|
|
771
|
+
get: function () {
|
|
772
|
+
return _useGridDataSourcePolling.useGridDataSourcePolling;
|
|
773
|
+
}
|
|
774
|
+
});
|
|
768
775
|
Object.defineProperty(exports, "useGridDensity", {
|
|
769
776
|
enumerable: true,
|
|
770
777
|
get: function () {
|
|
@@ -1144,6 +1151,7 @@ var _utils2 = require("../hooks/features/dataSource/utils");
|
|
|
1144
1151
|
var _useGridDataSourceBase = require("../hooks/features/dataSource/useGridDataSourceBase");
|
|
1145
1152
|
var _gridDataSourceSelector = require("../hooks/features/dataSource/gridDataSourceSelector");
|
|
1146
1153
|
var _useGridDataSourceFilterModelChange = require("../hooks/features/dataSource/useGridDataSourceFilterModelChange");
|
|
1154
|
+
var _useGridDataSourcePolling = require("../hooks/features/dataSource/useGridDataSourcePolling");
|
|
1147
1155
|
var _utils3 = require("../hooks/features/export/utils");
|
|
1148
1156
|
var _createControllablePromise = require("../utils/createControllablePromise");
|
|
1149
1157
|
Object.keys(_createControllablePromise).forEach(function (key) {
|
package/internals/index.mjs
CHANGED
|
@@ -80,6 +80,7 @@ export { useGridDataSourceBase } from "../hooks/features/dataSource/useGridDataS
|
|
|
80
80
|
export { CacheChunkManager } from "../hooks/features/dataSource/utils.mjs";
|
|
81
81
|
export { gridGetRowsParamsSelector } from "../hooks/features/dataSource/gridDataSourceSelector.mjs";
|
|
82
82
|
export { useGridDataSourceFilterModelChange } from "../hooks/features/dataSource/useGridDataSourceFilterModelChange.mjs";
|
|
83
|
+
export { useGridDataSourcePolling } from "../hooks/features/dataSource/useGridDataSourcePolling.mjs";
|
|
83
84
|
export { getColumnsToExport, defaultGetRowsToExport } from "../hooks/features/export/utils.mjs";
|
|
84
85
|
export * from "../utils/createControllablePromise.mjs";
|
|
85
86
|
export * from "../utils/focusElement.mjs";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { GridGetRowsParams, GridGetRowsResponse } from "../../models/gridDataSource.mjs";
|
|
2
2
|
export declare class TestCache {
|
|
3
3
|
private cache;
|
|
4
|
-
constructor();
|
|
5
4
|
set(key: GridGetRowsParams, value: GridGetRowsResponse): void;
|
|
6
5
|
get(key: GridGetRowsParams): GridGetRowsResponse | undefined;
|
|
7
6
|
size(): number;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { GridGetRowsParams, GridGetRowsResponse } from "../../models/gridDataSource.js";
|
|
2
2
|
export declare class TestCache {
|
|
3
3
|
private cache;
|
|
4
|
-
constructor();
|
|
5
4
|
set(key: GridGetRowsParams, value: GridGetRowsResponse): void;
|
|
6
5
|
get(key: GridGetRowsParams): GridGetRowsResponse | undefined;
|
|
7
6
|
size(): number;
|
package/internals/utils/cache.js
CHANGED
|
@@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.TestCache = void 0;
|
|
7
7
|
var _cache = require("../../hooks/features/dataSource/cache");
|
|
8
8
|
class TestCache {
|
|
9
|
-
|
|
10
|
-
this.cache = new Map();
|
|
11
|
-
}
|
|
9
|
+
cache = new Map();
|
|
12
10
|
set(key, value) {
|
|
13
11
|
this.cache.set((0, _cache.getKeyDefault)(key), value);
|
|
14
12
|
}
|