@mui/x-data-grid 7.7.1 → 7.8.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 +100 -1
- package/DataGrid/useDataGridComponent.d.ts +0 -1
- package/components/GridFooter.d.ts +1 -1
- package/components/GridLoadingOverlay.d.ts +1 -1
- package/components/GridNoResultsOverlay.d.ts +1 -1
- package/components/GridNoRowsOverlay.d.ts +1 -1
- package/components/GridRowCount.d.ts +1 -1
- package/components/GridSelectedRowCount.d.ts +1 -1
- package/components/cell/GridActionsCellItem.d.ts +3 -3
- package/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -0
- package/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
- package/components/containers/GridFooterContainer.d.ts +1 -1
- package/components/containers/GridOverlay.d.ts +1 -1
- package/components/containers/GridRootStyles.d.ts +0 -1
- package/components/containers/GridRootStyles.js +8 -0
- package/components/containers/GridToolbarContainer.d.ts +1 -1
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/components/virtualization/GridMainContainer.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollerContent.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +1 -1
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +5 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
- package/hooks/core/useGridInitialization.d.ts +1 -1
- package/hooks/core/useGridLocaleText.d.ts +1 -1
- package/hooks/core/useGridLoggerFactory.d.ts +1 -1
- package/hooks/features/clipboard/useGridClipboard.d.ts +1 -1
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
- package/hooks/features/density/useGridDensity.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +15 -15
- package/hooks/features/editing/useGridCellEditing.d.ts +1 -1
- package/hooks/features/editing/useGridEditing.d.ts +1 -1
- package/hooks/features/editing/useGridRowEditing.d.ts +1 -1
- package/hooks/features/export/serializers/csvSerializer.d.ts +0 -1
- package/hooks/features/export/useGridCsvExport.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.d.ts +1 -1
- package/hooks/features/export/useGridPrintExport.js +9 -8
- package/hooks/features/filter/gridFilterUtils.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/focus/useGridFocus.d.ts +1 -1
- package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/pagination/gridPaginationUtils.d.ts +1 -1
- package/hooks/features/pagination/index.d.ts +1 -1
- package/hooks/features/pagination/useGridPaginationMeta.d.ts +1 -1
- package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
- package/hooks/features/pagination/useGridRowCount.d.ts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rows/gridRowsInterfaces.d.ts +10 -2
- package/hooks/features/rows/gridRowsSelector.d.ts +2 -1
- package/hooks/features/rows/gridRowsSelector.js +1 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +8 -6
- package/hooks/features/rows/gridRowsUtils.js +30 -6
- package/hooks/features/rows/useGridRows.d.ts +2 -2
- package/hooks/features/rows/useGridRows.js +39 -21
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
- package/hooks/utils/useGridApiRef.d.ts +1 -1
- package/hooks/utils/useGridInitializeState.d.ts +1 -1
- package/hooks/utils/useGridRootProps.d.ts +1 -1
- package/hooks/utils/useGridSelector.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +1 -0
- package/internals/utils/propValidation.js +1 -1
- package/models/api/gridApiCommon.d.ts +2 -2
- package/models/api/gridInfiniteLoaderApi.d.ts +0 -1
- package/models/api/gridRowApi.d.ts +14 -0
- package/models/gridColumnGrouping.d.ts +0 -1
- package/models/gridDataSource.d.ts +87 -0
- package/models/gridDataSource.js +1 -0
- package/models/gridRows.d.ts +10 -0
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridSlotsComponentsProps.d.ts +5 -1
- package/models/props/DataGridProps.d.ts +2 -0
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
- package/modern/components/containers/GridRootStyles.js +8 -0
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +15 -15
- package/modern/hooks/features/export/useGridPrintExport.js +9 -8
- package/modern/hooks/features/rows/gridRowsSelector.js +1 -0
- package/modern/hooks/features/rows/gridRowsUtils.js +30 -6
- package/modern/hooks/features/rows/useGridRows.js +39 -21
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/propValidation.js +1 -1
- package/modern/models/gridDataSource.js +1 -0
- package/node/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
- package/node/components/containers/GridRootStyles.js +8 -0
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/dimensions/useGridDimensions.js +15 -15
- package/node/hooks/features/export/useGridPrintExport.js +9 -8
- package/node/hooks/features/rows/gridRowsSelector.js +2 -1
- package/node/hooks/features/rows/gridRowsUtils.js +31 -6
- package/node/hooks/features/rows/useGridRows.js +37 -19
- package/node/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/internals/utils/propValidation.js +1 -1
- package/node/models/gridDataSource.js +5 -0
- package/package.json +1 -1
- package/utils/cleanupTracking/TimerBasedCleanupTracking.d.ts +0 -1
- package/utils/domUtils.d.ts +0 -1
- package/utils/getPublicApiRef.d.ts +1 -2
- package/utils/keyboardUtils.d.ts +1 -1
- package/utils/warning.d.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
3
3
|
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
4
|
-
export declare const useGridRowEditing: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
4
|
+
export declare const useGridRowEditing: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "editMode" | "processRowUpdate" | "onRowEditStart" | "onRowEditStop" | "onProcessRowUpdateError" | "rowModesModel" | "onRowModesModelChange" | "signature">) => void;
|
|
@@ -8,4 +8,4 @@ import type { DataGridProcessedProps } from '../../../models/props/DataGridProps
|
|
|
8
8
|
* @requires useGridSelection (state)
|
|
9
9
|
* @requires useGridParamsApi (method)
|
|
10
10
|
*/
|
|
11
|
-
export declare const useGridCsvExport: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
11
|
+
export declare const useGridCsvExport: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "ignoreValueFormatterDuringExport">) => void;
|
|
@@ -7,4 +7,4 @@ import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
|
7
7
|
* @requires useGridSorting (state)
|
|
8
8
|
* @requires useGridParamsApi (method)
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridPrintExport: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
10
|
+
export declare const useGridPrintExport: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "columnHeaderHeight" | "headerFilterHeight">) => void;
|
|
@@ -119,14 +119,15 @@ export const useGridPrintExport = (apiRef, props) => {
|
|
|
119
119
|
gridClone.style.height = `${computedTotalHeight}px`;
|
|
120
120
|
// The height above does not include grid border width, so we need to exclude it
|
|
121
121
|
gridClone.style.boxSizing = 'content-box';
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
if (!normalizeOptions.hideFooter) {
|
|
123
|
+
// the footer is always being placed at the bottom of the page as if all rows are exported
|
|
124
|
+
// so if getRowsToExport is being used to only export a subset of rows then we need to
|
|
125
|
+
// adjust the footer position to be correctly placed at the bottom of the grid
|
|
126
|
+
const gridFooterElement = gridClone.querySelector(`.${gridClasses.footerContainer}`);
|
|
127
|
+
gridFooterElement.style.position = 'absolute';
|
|
128
|
+
gridFooterElement.style.width = '100%';
|
|
129
|
+
gridFooterElement.style.top = `${computedTotalHeight - gridFooterElementHeight}px`;
|
|
130
|
+
}
|
|
130
131
|
|
|
131
132
|
// printDoc.body.appendChild(gridClone); should be enough but a clone isolation bug in Safari
|
|
132
133
|
// prevents us to do it
|
|
@@ -12,7 +12,7 @@ import { GridAggregatedFilterItemApplier, GridFilterItemResult, GridQuickFilterV
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const cleanFilterItem: (item: GridFilterItem, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => GridFilterItem;
|
|
14
14
|
export declare const sanitizeFilterModel: (model: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => GridFilterModel;
|
|
15
|
-
export declare const mergeStateWithFilterModel: (filterModel: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => (filteringState: GridStateCommunity[
|
|
15
|
+
export declare const mergeStateWithFilterModel: (filterModel: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => (filteringState: GridStateCommunity["filter"]) => GridStateCommunity["filter"];
|
|
16
16
|
export declare const removeDiacritics: (value: unknown) => unknown;
|
|
17
17
|
export declare const shouldQuickFilterExcludeHiddenColumns: (filterModel: GridFilterModel) => boolean;
|
|
18
18
|
export declare const buildAggregatedFilterApplier: (filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridPrivateApiCommunity>, disableEval: boolean) => GridAggregatedFilterItemApplier;
|
|
@@ -8,4 +8,4 @@ export declare const filterStateInitializer: GridStateInitializer<Pick<DataGridP
|
|
|
8
8
|
* @requires useGridParamsApi (method)
|
|
9
9
|
* @requires useGridRows (event)
|
|
10
10
|
*/
|
|
11
|
-
export declare const useGridFilter: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
11
|
+
export declare const useGridFilter: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rows" | "initialState" | "filterModel" | "getRowId" | "onFilterModelChange" | "filterMode" | "disableMultipleColumnsFiltering" | "slots" | "slotProps" | "disableColumnFilter" | "disableEval" | "ignoreDiacritics">) => void;
|
|
@@ -8,4 +8,4 @@ export declare const focusStateInitializer: GridStateInitializer;
|
|
|
8
8
|
* @requires useGridRows (method)
|
|
9
9
|
* @requires useGridEditing (event)
|
|
10
10
|
*/
|
|
11
|
-
export declare const useGridFocus: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
11
|
+
export declare const useGridFocus: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => void;
|
|
@@ -3,4 +3,4 @@ import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
|
3
3
|
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
4
4
|
import { GridStateInitializer } from '../../utils/useGridInitializeState';
|
|
5
5
|
export declare const headerFilteringStateInitializer: GridStateInitializer;
|
|
6
|
-
export declare const useGridHeaderFiltering: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
6
|
+
export declare const useGridHeaderFiltering: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "signature" | "headerFilters">) => void;
|
|
@@ -10,4 +10,4 @@ import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
|
10
10
|
* @requires useGridScroll (method) - can be after
|
|
11
11
|
* @requires useGridColumnSpanning (method) - can be after
|
|
12
12
|
*/
|
|
13
|
-
export declare const useGridKeyboardNavigation: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
13
|
+
export declare const useGridKeyboardNavigation: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode" | "getRowId" | "experimentalFeatures" | "signature" | "headerFilters">) => void;
|
|
@@ -6,4 +6,4 @@ export declare const getDefaultGridPaginationModel: (autoPageSize: boolean) => {
|
|
|
6
6
|
pageSize: number;
|
|
7
7
|
};
|
|
8
8
|
export declare const getValidPage: (page: number, pageCount?: number) => number;
|
|
9
|
-
export declare const throwIfPageSizeExceedsTheLimit: (pageSize: number, signatureProp: DataGridProcessedProps[
|
|
9
|
+
export declare const throwIfPageSizeExceedsTheLimit: (pageSize: number, signatureProp: DataGridProcessedProps["signature"]) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './gridPaginationSelector';
|
|
2
|
-
export type { GridPaginationApi, GridPaginationState, GridPaginationInitialState, } from './gridPaginationInterfaces';
|
|
2
|
+
export type { GridPaginationModelApi, GridPaginationRowCountApi, GridPaginationApi, GridPaginationState, GridPaginationInitialState, } from './gridPaginationInterfaces';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
3
3
|
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
4
|
-
export declare const useGridPaginationMeta: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
4
|
+
export declare const useGridPaginationMeta: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "paginationMeta" | "initialState" | "paginationMode" | "onPaginationMetaChange">) => void;
|
|
@@ -3,9 +3,9 @@ import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
|
3
3
|
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
4
4
|
import { GridPaginationState } from './gridPaginationInterfaces';
|
|
5
5
|
import { GridPaginationModel } from '../../../models/gridPaginationProps';
|
|
6
|
-
export declare const getDerivedPaginationModel: (paginationState: GridPaginationState, signature: DataGridProcessedProps[
|
|
6
|
+
export declare const getDerivedPaginationModel: (paginationState: GridPaginationState, signature: DataGridProcessedProps["signature"], paginationModelProp?: GridPaginationModel) => GridPaginationModel;
|
|
7
7
|
/**
|
|
8
8
|
* @requires useGridFilter (state)
|
|
9
9
|
* @requires useGridDimensions (event) - can be after
|
|
10
10
|
*/
|
|
11
|
-
export declare const useGridPaginationModel: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
11
|
+
export declare const useGridPaginationModel: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "paginationModel" | "onPaginationModelChange" | "autoPageSize" | "initialState" | "paginationMode" | "signature" | "rowHeight">) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
3
3
|
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
4
|
-
export declare const useGridRowCount: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
4
|
+
export declare const useGridRowCount: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rowCount" | "initialState" | "paginationMode" | "onRowCountChange">) => void;
|
|
@@ -6,4 +6,4 @@ export declare const preferencePanelStateInitializer: GridStateInitializer<Pick<
|
|
|
6
6
|
/**
|
|
7
7
|
* TODO: Add a single `setPreferencePanel` method to avoid multiple `setState`
|
|
8
8
|
*/
|
|
9
|
-
export declare const useGridPreferencesPanel: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
9
|
+
export declare const useGridPreferencesPanel: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "initialState">) => void;
|
|
@@ -9,4 +9,4 @@ export declare const rowSelectionStateInitializer: GridStateInitializer<Pick<Dat
|
|
|
9
9
|
* @requires useGridFocus (state) - can be after
|
|
10
10
|
* @requires useGridKeyboardNavigation (`cellKeyDown` event must first be consumed by it)
|
|
11
11
|
*/
|
|
12
|
-
export declare const useGridRowSelection: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
12
|
+
export declare const useGridRowSelection: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "checkboxSelection" | "rowSelectionModel" | "onRowSelectionModelChange" | "disableMultipleRowSelection" | "disableRowSelectionOnClick" | "isRowSelectable" | "checkboxSelectionVisibleOnly" | "pagination" | "paginationMode" | "classes" | "keepNonExistentRowsSelected" | "rowSelection" | "signature">) => void;
|
|
@@ -43,7 +43,7 @@ export interface GridRowsState {
|
|
|
43
43
|
treeDepths: GridTreeDepths;
|
|
44
44
|
dataRowIds: GridRowId[];
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* The loading status of the rows.
|
|
47
47
|
*/
|
|
48
48
|
loading?: boolean;
|
|
49
49
|
/**
|
|
@@ -63,6 +63,12 @@ export interface GridRowsState {
|
|
|
63
63
|
additionalRowGroups?: {
|
|
64
64
|
pinnedRows?: GridPinnedRowsState;
|
|
65
65
|
};
|
|
66
|
+
/**
|
|
67
|
+
* Contains some values of type `GridRowId` that have been requested to be fetched
|
|
68
|
+
* either by `defaultGroupingExpansionDepth` or `isGroupExpandedByDefault` props.
|
|
69
|
+
* Applicable with server-side grouped data and `unstable_dataSource` only.
|
|
70
|
+
*/
|
|
71
|
+
groupsToFetch?: GridRowId[];
|
|
66
72
|
}
|
|
67
73
|
export interface GridRowTreeCreationParams {
|
|
68
74
|
previousTree: GridRowTreeConfig | null;
|
|
@@ -70,6 +76,7 @@ export interface GridRowTreeCreationParams {
|
|
|
70
76
|
updates: GridRowsPartialUpdates | GridRowsFullUpdate;
|
|
71
77
|
dataRowIdToIdLookup: GridRowIdToIdLookup;
|
|
72
78
|
dataRowIdToModelLookup: GridRowIdToModelLookup;
|
|
79
|
+
previousGroupsToFetch?: GridRowId[];
|
|
73
80
|
}
|
|
74
81
|
export type GridRowTreeUpdateGroupAction = 'removeChildren' | 'insertChildren' | 'modifyChildren';
|
|
75
82
|
export type GridRowTreeUpdatedGroupsValue = {
|
|
@@ -81,7 +88,7 @@ export type GridRowTreeUpdatedGroupsManager = {
|
|
|
81
88
|
value: GridRowTreeUpdatedGroupsValue;
|
|
82
89
|
addAction: (groupId: GridRowId, action: GridRowTreeUpdateGroupAction) => void;
|
|
83
90
|
};
|
|
84
|
-
export type GridRowTreeCreationValue = Pick<GridRowsState, 'groupingName' | 'tree' | 'treeDepths' | 'dataRowIds'> & {
|
|
91
|
+
export type GridRowTreeCreationValue = Pick<GridRowsState, 'groupingName' | 'tree' | 'treeDepths' | 'dataRowIds' | 'groupsToFetch'> & {
|
|
85
92
|
updatedGroupsManager?: GridRowTreeUpdatedGroupsManager;
|
|
86
93
|
};
|
|
87
94
|
export type GridHydrateRowsValue = Pick<GridRowsState, 'tree' | 'treeDepths' | 'dataRowIds' | 'dataRowIdToIdLookup' | 'dataRowIdToModelLookup' | 'additionalRowGroups'>;
|
|
@@ -103,6 +110,7 @@ export interface GridRowsPartialUpdates {
|
|
|
103
110
|
idToActionLookup: {
|
|
104
111
|
[id: GridRowId]: GridRowsPartialUpdateAction | undefined;
|
|
105
112
|
};
|
|
113
|
+
groupKeys?: string[];
|
|
106
114
|
}
|
|
107
115
|
export interface GridPinnedRowsState {
|
|
108
116
|
top?: GridRowEntry[];
|
|
@@ -5,6 +5,7 @@ export declare const gridTopLevelRowCountSelector: import("../../../utils/create
|
|
|
5
5
|
export declare const gridRowsLookupSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowIdToModelLookup<import("../../..").GridValidRowModel>>;
|
|
6
6
|
export declare const gridRowsDataRowIdToIdLookupSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridRowIdToIdLookup>;
|
|
7
7
|
export declare const gridRowTreeSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridRowTreeConfig>;
|
|
8
|
+
export declare const gridRowGroupsToFetchSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("../../..").GridRowId[] | undefined>;
|
|
8
9
|
export declare const gridRowGroupingNameSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, string>;
|
|
9
10
|
export declare const gridRowTreeDepthsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, import("./gridRowsInterfaces").GridTreeDepths>;
|
|
10
11
|
export declare const gridRowMaximumTreeDepthSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, number>;
|
|
@@ -13,7 +14,7 @@ export declare const gridDataRowIdsSelector: import("../../../utils/createSelect
|
|
|
13
14
|
* @ignore - do not document.
|
|
14
15
|
*/
|
|
15
16
|
export declare const gridAdditionalRowGroupsSelector: import("../../../utils/createSelector").OutputSelector<GridStateCommunity, {
|
|
16
|
-
pinnedRows?: import("./gridRowsInterfaces").GridPinnedRowsState
|
|
17
|
+
pinnedRows?: import("./gridRowsInterfaces").GridPinnedRowsState;
|
|
17
18
|
} | undefined>;
|
|
18
19
|
/**
|
|
19
20
|
* @ignore - do not document.
|
|
@@ -8,6 +8,7 @@ export const gridTopLevelRowCountSelector = createSelector(gridRowsStateSelector
|
|
|
8
8
|
export const gridRowsLookupSelector = createSelector(gridRowsStateSelector, rows => rows.dataRowIdToModelLookup);
|
|
9
9
|
export const gridRowsDataRowIdToIdLookupSelector = createSelector(gridRowsStateSelector, rows => rows.dataRowIdToIdLookup);
|
|
10
10
|
export const gridRowTreeSelector = createSelector(gridRowsStateSelector, rows => rows.tree);
|
|
11
|
+
export const gridRowGroupsToFetchSelector = createSelector(gridRowsStateSelector, rows => rows.groupsToFetch);
|
|
11
12
|
export const gridRowGroupingNameSelector = createSelector(gridRowsStateSelector, rows => rows.groupingName);
|
|
12
13
|
export const gridRowTreeDepthsSelector = createSelector(gridRowsStateSelector, rows => rows.treeDepths);
|
|
13
14
|
export const gridRowMaximumTreeDepthSelector = createSelectorMemoized(gridRowsStateSelector, rows => {
|
|
@@ -14,25 +14,27 @@ export declare const buildRootGroup: () => GridGroupNode;
|
|
|
14
14
|
*/
|
|
15
15
|
export declare function checkGridRowIdIsValid(id: GridRowId, row: GridRowModel | Partial<GridRowModel>, detailErrorMessage?: string): void;
|
|
16
16
|
export declare const getRowIdFromRowModel: (rowModel: GridRowModel, getRowId?: GridRowIdGetter, detailErrorMessage?: string) => GridRowId;
|
|
17
|
-
export declare const createRowsInternalCache: ({ rows, getRowId, loading, rowCount, }: Pick<DataGridProcessedProps,
|
|
17
|
+
export declare const createRowsInternalCache: ({ rows, getRowId, loading, rowCount, }: Pick<DataGridProcessedProps, "rows" | "getRowId" | "loading" | "rowCount">) => GridRowsInternalCache;
|
|
18
18
|
export declare const getTopLevelRowCount: ({ tree, rowCountProp, }: {
|
|
19
19
|
tree: GridRowTreeConfig;
|
|
20
|
-
rowCountProp: DataGridProcessedProps[
|
|
20
|
+
rowCountProp: DataGridProcessedProps["rowCount"];
|
|
21
21
|
}) => number;
|
|
22
|
-
export declare const getRowsStateFromCache: ({ apiRef, rowCountProp, loadingProp, previousTree, previousTreeDepths, }: Pick<GridRowTreeCreationParams,
|
|
22
|
+
export declare const getRowsStateFromCache: ({ apiRef, rowCountProp, loadingProp, previousTree, previousTreeDepths, previousGroupsToFetch, }: Pick<GridRowTreeCreationParams, "previousTree" | "previousTreeDepths" | "previousGroupsToFetch"> & {
|
|
23
23
|
apiRef: React.MutableRefObject<GridPrivateApiCommunity>;
|
|
24
24
|
rowCountProp: number | undefined;
|
|
25
25
|
loadingProp: boolean | undefined;
|
|
26
26
|
}) => GridRowsState;
|
|
27
|
-
export declare const isAutoGeneratedRow: (rowNode: GridTreeNode) => rowNode is
|
|
27
|
+
export declare const isAutoGeneratedRow: (rowNode: GridTreeNode) => rowNode is GridFooterNode | GridSkeletonRowNode | GridAutoGeneratedGroupNode | GridAutoGeneratedPinnedRowNode;
|
|
28
28
|
export declare const getTreeNodeDescendants: (tree: GridRowTreeConfig, parentId: GridRowId, skipAutoGeneratedRows: boolean) => GridRowId[];
|
|
29
|
-
export declare const updateCacheWithNewRows: ({ previousCache, getRowId, updates, }: {
|
|
29
|
+
export declare const updateCacheWithNewRows: ({ previousCache, getRowId, updates, groupKeys, }: {
|
|
30
30
|
previousCache: GridRowsInternalCache;
|
|
31
|
-
getRowId: DataGridProcessedProps[
|
|
31
|
+
getRowId: DataGridProcessedProps["getRowId"];
|
|
32
32
|
updates: GridRowModelUpdate[];
|
|
33
|
+
groupKeys?: string[];
|
|
33
34
|
}) => GridRowsInternalCache;
|
|
34
35
|
export declare function calculatePinnedRowsHeight(apiRef: React.MutableRefObject<GridApiCommunity>): {
|
|
35
36
|
top: number;
|
|
36
37
|
bottom: number;
|
|
37
38
|
};
|
|
38
39
|
export declare function getMinimalContentHeight(apiRef: React.MutableRefObject<GridApiCommunity>): string;
|
|
40
|
+
export declare function computeRowsUpdates(apiRef: React.MutableRefObject<GridApiCommunity>, updates: GridRowModelUpdate[], getRowId: DataGridProcessedProps['getRowId']): GridRowModelUpdate[];
|
|
@@ -72,7 +72,8 @@ export const getRowsStateFromCache = ({
|
|
|
72
72
|
rowCountProp = 0,
|
|
73
73
|
loadingProp,
|
|
74
74
|
previousTree,
|
|
75
|
-
previousTreeDepths
|
|
75
|
+
previousTreeDepths,
|
|
76
|
+
previousGroupsToFetch
|
|
76
77
|
}) => {
|
|
77
78
|
const cache = apiRef.current.caches.rows;
|
|
78
79
|
|
|
@@ -81,13 +82,15 @@ export const getRowsStateFromCache = ({
|
|
|
81
82
|
tree: unProcessedTree,
|
|
82
83
|
treeDepths: unProcessedTreeDepths,
|
|
83
84
|
dataRowIds: unProcessedDataRowIds,
|
|
84
|
-
groupingName
|
|
85
|
+
groupingName,
|
|
86
|
+
groupsToFetch = []
|
|
85
87
|
} = apiRef.current.applyStrategyProcessor('rowTreeCreation', {
|
|
86
88
|
previousTree,
|
|
87
89
|
previousTreeDepths,
|
|
88
90
|
updates: cache.updates,
|
|
89
91
|
dataRowIdToIdLookup: cache.dataRowIdToIdLookup,
|
|
90
|
-
dataRowIdToModelLookup: cache.dataRowIdToModelLookup
|
|
92
|
+
dataRowIdToModelLookup: cache.dataRowIdToModelLookup,
|
|
93
|
+
previousGroupsToFetch
|
|
91
94
|
});
|
|
92
95
|
|
|
93
96
|
// 2. Apply the "hydrateRows" pipe-processing.
|
|
@@ -116,7 +119,8 @@ export const getRowsStateFromCache = ({
|
|
|
116
119
|
rowCountProp
|
|
117
120
|
}),
|
|
118
121
|
groupingName,
|
|
119
|
-
loading: loadingProp
|
|
122
|
+
loading: loadingProp,
|
|
123
|
+
groupsToFetch
|
|
120
124
|
});
|
|
121
125
|
};
|
|
122
126
|
export const isAutoGeneratedRow = rowNode => rowNode.type === 'skeletonRow' || rowNode.type === 'footer' || rowNode.type === 'group' && rowNode.isAutoGenerated || rowNode.type === 'pinnedRow' && rowNode.isAutoGenerated;
|
|
@@ -144,7 +148,8 @@ export const getTreeNodeDescendants = (tree, parentId, skipAutoGeneratedRows) =>
|
|
|
144
148
|
export const updateCacheWithNewRows = ({
|
|
145
149
|
previousCache,
|
|
146
150
|
getRowId,
|
|
147
|
-
updates
|
|
151
|
+
updates,
|
|
152
|
+
groupKeys
|
|
148
153
|
}) => {
|
|
149
154
|
if (previousCache.updates.type === 'full') {
|
|
150
155
|
throw new Error('MUI X: Unable to prepare a partial update if a full update is not applied yet.');
|
|
@@ -168,7 +173,8 @@ export const updateCacheWithNewRows = ({
|
|
|
168
173
|
modify: [...(previousCache.updates.actions.modify ?? [])],
|
|
169
174
|
remove: [...(previousCache.updates.actions.remove ?? [])]
|
|
170
175
|
},
|
|
171
|
-
idToActionLookup: _extends({}, previousCache.updates.idToActionLookup)
|
|
176
|
+
idToActionLookup: _extends({}, previousCache.updates.idToActionLookup),
|
|
177
|
+
groupKeys
|
|
172
178
|
};
|
|
173
179
|
const dataRowIdToModelLookup = _extends({}, previousCache.dataRowIdToModelLookup);
|
|
174
180
|
const dataRowIdToIdLookup = _extends({}, previousCache.dataRowIdToIdLookup);
|
|
@@ -281,4 +287,22 @@ export function calculatePinnedRowsHeight(apiRef) {
|
|
|
281
287
|
export function getMinimalContentHeight(apiRef) {
|
|
282
288
|
const dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
283
289
|
return `var(--DataGrid-overlayHeight, ${2 * dimensions.rowHeight}px)`;
|
|
290
|
+
}
|
|
291
|
+
export function computeRowsUpdates(apiRef, updates, getRowId) {
|
|
292
|
+
const nonPinnedRowsUpdates = [];
|
|
293
|
+
updates.forEach(update => {
|
|
294
|
+
const id = getRowIdFromRowModel(update, getRowId, 'A row was provided without id when calling updateRows():');
|
|
295
|
+
const rowNode = apiRef.current.getRowNode(id);
|
|
296
|
+
if (rowNode?.type === 'pinnedRow') {
|
|
297
|
+
// @ts-ignore because otherwise `release:build` doesn't work
|
|
298
|
+
const pinnedRowsCache = apiRef.current.caches.pinnedRows;
|
|
299
|
+
const prevModel = pinnedRowsCache.idLookup[id];
|
|
300
|
+
if (prevModel) {
|
|
301
|
+
pinnedRowsCache.idLookup[id] = _extends({}, prevModel, update);
|
|
302
|
+
}
|
|
303
|
+
} else {
|
|
304
|
+
nonPinnedRowsUpdates.push(update);
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
return nonPinnedRowsUpdates;
|
|
284
308
|
}
|
|
@@ -2,5 +2,5 @@ import * as React from 'react';
|
|
|
2
2
|
import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
3
3
|
import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
|
|
4
4
|
import { GridStateInitializer } from '../../utils/useGridInitializeState';
|
|
5
|
-
export declare const rowsStateInitializer: GridStateInitializer<Pick<DataGridProcessedProps, 'rows' | 'rowCount' | 'getRowId' | 'loading'>>;
|
|
6
|
-
export declare const useGridRows: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
5
|
+
export declare const rowsStateInitializer: GridStateInitializer<Pick<DataGridProcessedProps, 'unstable_dataSource' | 'rows' | 'rowCount' | 'getRowId' | 'loading'>>;
|
|
6
|
+
export declare const useGridRows: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rows" | "getRowId" | "rowCount" | "throttleRowsMs" | "signature" | "pagination" | "paginationMode" | "loading">) => void;
|
|
@@ -2,17 +2,18 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useGridApiMethod } from '../../utils/useGridApiMethod';
|
|
4
4
|
import { useGridLogger } from '../../utils/useGridLogger';
|
|
5
|
-
import { gridRowCountSelector, gridRowsLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridDataRowIdsSelector, gridRowsDataRowIdToIdLookupSelector, gridRowMaximumTreeDepthSelector } from './gridRowsSelector';
|
|
5
|
+
import { gridRowCountSelector, gridRowsLookupSelector, gridRowTreeSelector, gridRowGroupingNameSelector, gridRowTreeDepthsSelector, gridDataRowIdsSelector, gridRowsDataRowIdToIdLookupSelector, gridRowMaximumTreeDepthSelector, gridRowGroupsToFetchSelector } from './gridRowsSelector';
|
|
6
6
|
import { useTimeout } from '../../utils/useTimeout';
|
|
7
7
|
import { GridSignature, useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
8
8
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
9
9
|
import { gridSortedRowIdsSelector } from '../sorting/gridSortingSelector';
|
|
10
10
|
import { gridFilteredRowsLookupSelector } from '../filter/gridFilterSelector';
|
|
11
|
-
import { getTreeNodeDescendants, createRowsInternalCache, getRowsStateFromCache, isAutoGeneratedRow, GRID_ROOT_GROUP_ID, GRID_ID_AUTOGENERATED, updateCacheWithNewRows, getTopLevelRowCount, getRowIdFromRowModel } from './gridRowsUtils';
|
|
11
|
+
import { getTreeNodeDescendants, createRowsInternalCache, getRowsStateFromCache, isAutoGeneratedRow, GRID_ROOT_GROUP_ID, GRID_ID_AUTOGENERATED, updateCacheWithNewRows, getTopLevelRowCount, getRowIdFromRowModel, computeRowsUpdates } from './gridRowsUtils';
|
|
12
12
|
import { useGridRegisterPipeApplier } from '../../core/pipeProcessing';
|
|
13
13
|
export const rowsStateInitializer = (state, props, apiRef) => {
|
|
14
|
+
const isDataSourceAvailable = !!props.unstable_dataSource;
|
|
14
15
|
apiRef.current.caches.rows = createRowsInternalCache({
|
|
15
|
-
rows: props.rows,
|
|
16
|
+
rows: isDataSourceAvailable ? [] : props.rows,
|
|
16
17
|
getRowId: props.getRowId,
|
|
17
18
|
loading: props.loading,
|
|
18
19
|
rowCount: props.rowCount
|
|
@@ -21,7 +22,7 @@ export const rowsStateInitializer = (state, props, apiRef) => {
|
|
|
21
22
|
rows: getRowsStateFromCache({
|
|
22
23
|
apiRef,
|
|
23
24
|
rowCountProp: props.rowCount,
|
|
24
|
-
loadingProp: props.loading,
|
|
25
|
+
loadingProp: isDataSourceAvailable ? true : props.loading,
|
|
25
26
|
previousTree: null,
|
|
26
27
|
previousTreeDepths: null
|
|
27
28
|
})
|
|
@@ -82,7 +83,8 @@ export const useGridRows = (apiRef, props) => {
|
|
|
82
83
|
rowCountProp: props.rowCount,
|
|
83
84
|
loadingProp: props.loading,
|
|
84
85
|
previousTree: gridRowTreeSelector(apiRef),
|
|
85
|
-
previousTreeDepths: gridRowTreeDepthsSelector(apiRef)
|
|
86
|
+
previousTreeDepths: gridRowTreeDepthsSelector(apiRef),
|
|
87
|
+
previousGroupsToFetch: gridRowGroupsToFetchSelector(apiRef)
|
|
86
88
|
})
|
|
87
89
|
}));
|
|
88
90
|
apiRef.current.publishEvent('rowsSet');
|
|
@@ -124,21 +126,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
124
126
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
125
127
|
throw new Error(['MUI X: You cannot update several rows at once in `apiRef.current.updateRows` on the DataGrid.', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
126
128
|
}
|
|
127
|
-
const nonPinnedRowsUpdates =
|
|
128
|
-
updates.forEach(update => {
|
|
129
|
-
const id = getRowIdFromRowModel(update, props.getRowId, 'A row was provided without id when calling updateRows():');
|
|
130
|
-
const rowNode = apiRef.current.getRowNode(id);
|
|
131
|
-
if (rowNode?.type === 'pinnedRow') {
|
|
132
|
-
// @ts-ignore because otherwise `release:build` doesn't work
|
|
133
|
-
const pinnedRowsCache = apiRef.current.caches.pinnedRows;
|
|
134
|
-
const prevModel = pinnedRowsCache.idLookup[id];
|
|
135
|
-
if (prevModel) {
|
|
136
|
-
pinnedRowsCache.idLookup[id] = _extends({}, prevModel, update);
|
|
137
|
-
}
|
|
138
|
-
} else {
|
|
139
|
-
nonPinnedRowsUpdates.push(update);
|
|
140
|
-
}
|
|
141
|
-
});
|
|
129
|
+
const nonPinnedRowsUpdates = computeRowsUpdates(apiRef, updates, props.getRowId);
|
|
142
130
|
const cache = updateCacheWithNewRows({
|
|
143
131
|
updates: nonPinnedRowsUpdates,
|
|
144
132
|
getRowId: props.getRowId,
|
|
@@ -149,6 +137,31 @@ export const useGridRows = (apiRef, props) => {
|
|
|
149
137
|
throttle: true
|
|
150
138
|
});
|
|
151
139
|
}, [props.signature, props.getRowId, throttledRowsChange, apiRef]);
|
|
140
|
+
const updateServerRows = React.useCallback((updates, groupKeys) => {
|
|
141
|
+
const nonPinnedRowsUpdates = computeRowsUpdates(apiRef, updates, props.getRowId);
|
|
142
|
+
const cache = updateCacheWithNewRows({
|
|
143
|
+
updates: nonPinnedRowsUpdates,
|
|
144
|
+
getRowId: props.getRowId,
|
|
145
|
+
previousCache: apiRef.current.caches.rows,
|
|
146
|
+
groupKeys: groupKeys ?? []
|
|
147
|
+
});
|
|
148
|
+
throttledRowsChange({
|
|
149
|
+
cache,
|
|
150
|
+
throttle: false
|
|
151
|
+
});
|
|
152
|
+
}, [props.getRowId, throttledRowsChange, apiRef]);
|
|
153
|
+
const setLoading = React.useCallback(loading => {
|
|
154
|
+
if (loading === props.loading) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
logger.debug(`Setting loading to ${loading}`);
|
|
158
|
+
apiRef.current.setState(state => _extends({}, state, {
|
|
159
|
+
rows: _extends({}, state.rows, {
|
|
160
|
+
loading
|
|
161
|
+
})
|
|
162
|
+
}));
|
|
163
|
+
apiRef.current.caches.rows.loadingPropBeforePartialUpdates = loading;
|
|
164
|
+
}, [props.loading, apiRef, logger]);
|
|
152
165
|
const getRowModels = React.useCallback(() => {
|
|
153
166
|
const dataRows = gridDataRowIdsSelector(apiRef);
|
|
154
167
|
const idRowsLookup = gridRowsLookupSelector(apiRef);
|
|
@@ -303,6 +316,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
303
316
|
}, [apiRef, props.signature, props.getRowId]);
|
|
304
317
|
const rowApi = {
|
|
305
318
|
getRow,
|
|
319
|
+
setLoading,
|
|
306
320
|
getRowId,
|
|
307
321
|
getRowModels,
|
|
308
322
|
getRowsCount,
|
|
@@ -318,6 +332,9 @@ export const useGridRows = (apiRef, props) => {
|
|
|
318
332
|
setRowChildrenExpansion,
|
|
319
333
|
getRowGroupChildren
|
|
320
334
|
};
|
|
335
|
+
const rowProPrivateApi = {
|
|
336
|
+
updateServerRows
|
|
337
|
+
};
|
|
321
338
|
|
|
322
339
|
/**
|
|
323
340
|
* EVENTS
|
|
@@ -392,6 +409,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
392
409
|
useGridRegisterPipeApplier(apiRef, 'hydrateRows', applyHydrateRowsProcessor);
|
|
393
410
|
useGridApiMethod(apiRef, rowApi, 'public');
|
|
394
411
|
useGridApiMethod(apiRef, rowProApi, props.signature === GridSignature.DataGrid ? 'private' : 'public');
|
|
412
|
+
useGridApiMethod(apiRef, rowProPrivateApi, 'private');
|
|
395
413
|
|
|
396
414
|
// The effect do not track any value defined synchronously during the 1st render by hooks called after `useGridRows`
|
|
397
415
|
// As a consequence, the state generated by the 1st run of this useEffect will always be equal to the initialization one
|
|
@@ -436,7 +454,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
436
454
|
return;
|
|
437
455
|
}
|
|
438
456
|
}
|
|
439
|
-
logger.debug(`Updating all rows, new length ${props.rows
|
|
457
|
+
logger.debug(`Updating all rows, new length ${props.rows?.length}`);
|
|
440
458
|
throttledRowsChange({
|
|
441
459
|
cache: createRowsInternalCache({
|
|
442
460
|
rows: props.rows,
|
|
@@ -7,4 +7,4 @@ export declare const rowsMetaStateInitializer: GridStateInitializer;
|
|
|
7
7
|
* @requires useGridPageSize (method)
|
|
8
8
|
* @requires useGridPage (method)
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridRowsMeta: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
10
|
+
export declare const useGridRowsMeta: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "getRowHeight" | "getEstimatedRowHeight" | "getRowSpacing" | "pagination" | "paginationMode" | "rowHeight" | "rowPositionsDebounceMs">) => void;
|
|
@@ -9,4 +9,4 @@ import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
|
|
|
9
9
|
* @requires useGridFilter (state)
|
|
10
10
|
* @requires useGridColumnSpanning (method)
|
|
11
11
|
*/
|
|
12
|
-
export declare const useGridScroll: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
12
|
+
export declare const useGridScroll: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination">) => void;
|
|
@@ -7,4 +7,4 @@ export declare const sortingStateInitializer: GridStateInitializer<Pick<DataGrid
|
|
|
7
7
|
* @requires useGridRows (event)
|
|
8
8
|
* @requires useGridColumns (event)
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridSorting: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps,
|
|
10
|
+
export declare const useGridSorting: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "initialState" | "sortModel" | "onSortModelChange" | "sortingOrder" | "sortingMode" | "disableColumnSorting" | "disableMultipleColumnsSorting">) => void;
|
|
@@ -14,8 +14,8 @@ declare enum GridSignature {
|
|
|
14
14
|
interface RegistryContainer {
|
|
15
15
|
registry: CleanupTracking | null;
|
|
16
16
|
}
|
|
17
|
-
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon
|
|
17
|
+
export declare function createUseGridApiEventHandler(registryContainer: RegistryContainer): <Api extends GridApiCommon, E extends GridEvents>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>, options?: EventListenerOptions) => void;
|
|
18
18
|
export declare const unstable_resetCleanupTracking: () => void;
|
|
19
|
-
export declare const useGridApiEventHandler: <Api extends GridApiCommon
|
|
19
|
+
export declare const useGridApiEventHandler: <Api extends GridApiCommon, E extends GridEvents>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>, options?: EventListenerOptions) => void;
|
|
20
20
|
export declare function useGridApiOptionHandler<Api extends GridApiCommon, E extends GridEvents>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>): void;
|
|
21
21
|
export { GridSignature };
|
|
@@ -4,4 +4,4 @@ import { GridApiCommunity } from '../../models/api/gridApiCommunity';
|
|
|
4
4
|
/**
|
|
5
5
|
* Hook that instantiate a [[GridApiRef]].
|
|
6
6
|
*/
|
|
7
|
-
export declare const useGridApiRef: <Api extends GridApiCommon
|
|
7
|
+
export declare const useGridApiRef: <Api extends GridApiCommon = GridApiCommunity>() => React.MutableRefObject<Api>;
|
|
@@ -6,5 +6,5 @@ type DeepPartial<T> = {
|
|
|
6
6
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
7
7
|
};
|
|
8
8
|
export type GridStateInitializer<P extends Partial<DataGridProcessedProps> = DataGridProcessedProps, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity> = (state: DeepPartial<PrivateApi['state']>, props: P, privateApiRef: React.MutableRefObject<PrivateApi>) => DeepPartial<PrivateApi['state']>;
|
|
9
|
-
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps
|
|
9
|
+
export declare const useGridInitializeState: <P extends Partial<DataGridProcessedProps>, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(initializer: GridStateInitializer<P, PrivateApi>, privateApiRef: React.MutableRefObject<PrivateApi>, props: P) => void;
|
|
10
10
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
2
|
-
export declare const useGridRootProps: () => DataGridProcessedProps
|
|
2
|
+
export declare const useGridRootProps: () => DataGridProcessedProps;
|
|
@@ -3,4 +3,4 @@ import type { GridApiCommon } from '../../models/api/gridApiCommon';
|
|
|
3
3
|
import { OutputSelector } from '../../utils/createSelector';
|
|
4
4
|
import { fastObjectShallowCompare } from '../../utils/fastObjectShallowCompare';
|
|
5
5
|
export declare const objectShallowCompare: typeof fastObjectShallowCompare;
|
|
6
|
-
export declare const useGridSelector: <Api extends GridApiCommon
|
|
6
|
+
export declare const useGridSelector: <Api extends GridApiCommon, T>(apiRef: React.MutableRefObject<Api>, selector: ((state: Api["state"]) => T) | OutputSelector<Api["state"], T>, equals?: (a: T, b: T) => boolean) => T;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DataGridProcessedProps } from '../../models/props/DataGridProps';
|
|
3
3
|
import type { GridApiCommon, GridRowEntry } from '../../models';
|
|
4
|
-
export declare const getVisibleRows: <Api extends GridApiCommon
|
|
4
|
+
export declare const getVisibleRows: <Api extends GridApiCommon>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => {
|
|
5
5
|
rows: GridRowEntry<import("../../models").GridValidRowModel>[];
|
|
6
6
|
range: {
|
|
7
7
|
firstRowIndex: number;
|
|
@@ -15,7 +15,7 @@ export declare const getVisibleRows: <Api extends GridApiCommon<any, any>>(apiRe
|
|
|
15
15
|
* - If the row tree has several layers, it contains up to `state.pageSize` top level rows and all their descendants.
|
|
16
16
|
* - If the row tree is flat, it only contains up to `state.pageSize` rows.
|
|
17
17
|
*/
|
|
18
|
-
export declare const useGridVisibleRows: <Api extends GridApiCommon
|
|
18
|
+
export declare const useGridVisibleRows: <Api extends GridApiCommon>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => {
|
|
19
19
|
rows: GridRowEntry<import("../../models").GridValidRowModel>[];
|
|
20
20
|
range: {
|
|
21
21
|
firstRowIndex: number;
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -66,9 +66,11 @@ export { useGridVisibleRows, getVisibleRows } from '../hooks/utils/useGridVisibl
|
|
|
66
66
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
67
67
|
export type { GridStateInitializer } from '../hooks/utils/useGridInitializeState';
|
|
68
68
|
export type * from '../models/props/DataGridProps';
|
|
69
|
+
export type * from '../models/gridDataSource';
|
|
69
70
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
70
71
|
export * from '../utils/createControllablePromise';
|
|
71
72
|
export { createSelector, createSelectorMemoized } from '../utils/createSelector';
|
|
73
|
+
export { gridRowGroupsToFetchSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
72
74
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal, } from '../utils/domUtils';
|
|
73
75
|
export { isNavigationKey, isPasteShortcut } from '../utils/keyboardUtils';
|
|
74
76
|
export * from '../utils/utils';
|