@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
package/internals/index.js
CHANGED
|
@@ -55,6 +55,7 @@ export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
|
55
55
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
56
56
|
export * from '../utils/createControllablePromise';
|
|
57
57
|
export { createSelector, createSelectorMemoized } from '../utils/createSelector';
|
|
58
|
+
export { gridRowGroupsToFetchSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
58
59
|
export { findParentElementFromClassName, getActiveElement, isEventTargetInPortal } from '../utils/domUtils';
|
|
59
60
|
export { isNavigationKey, isPasteShortcut } from '../utils/keyboardUtils';
|
|
60
61
|
export * from '../utils/utils';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isNumber } from '../../utils/utils';
|
|
2
2
|
import { GridSignature } from '../../hooks/utils/useGridApiEventHandler';
|
|
3
|
-
export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined, props => props.paginationMode === 'client' && props.paginationMeta != null && ['MUI X: Usage of the `paginationMeta` prop with client-side pagination (`paginationMode="client"`) has no effect.', '`paginationMeta` is only meant to be used with `paginationMode="server"`.'].join('\n') || undefined, props => props.signature === GridSignature.DataGrid && props.paginationMode === 'client' && isNumber(props.rowCount) && ['MUI X: Usage of the `rowCount` prop with client side pagination (`paginationMode="client"`) has no effect.', '`rowCount` is only meant to be used with `paginationMode="server"`.'].join('\n') || undefined, props => props.paginationMode === 'server' && props.rowCount == null && ["MUI X: The `rowCount` prop must be passed using `paginationMode='server'`", 'For more detail, see http://mui.com/components/data-grid/pagination/#index-based-pagination'].join('\n') || undefined];
|
|
3
|
+
export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined, props => props.paginationMode === 'client' && props.paginationMeta != null && ['MUI X: Usage of the `paginationMeta` prop with client-side pagination (`paginationMode="client"`) has no effect.', '`paginationMeta` is only meant to be used with `paginationMode="server"`.'].join('\n') || undefined, props => props.signature === GridSignature.DataGrid && props.paginationMode === 'client' && isNumber(props.rowCount) && ['MUI X: Usage of the `rowCount` prop with client side pagination (`paginationMode="client"`) has no effect.', '`rowCount` is only meant to be used with `paginationMode="server"`.'].join('\n') || undefined, props => props.paginationMode === 'server' && props.rowCount == null && !props.unstable_dataSource && ["MUI X: The `rowCount` prop must be passed using `paginationMode='server'`", 'For more detail, see http://mui.com/components/data-grid/pagination/#index-based-pagination'].join('\n') || undefined];
|
|
4
4
|
const warnedOnceCache = new Set();
|
|
5
5
|
function warnOnce(message) {
|
|
6
6
|
if (!warnedOnceCache.has(message)) {
|
|
@@ -10,7 +10,7 @@ import type { GridLocaleTextApi } from './gridLocaleTextApi';
|
|
|
10
10
|
import type { GridParamsApi } from './gridParamsApi';
|
|
11
11
|
import { GridPreferencesPanelApi } from './gridPreferencesPanelApi';
|
|
12
12
|
import { GridPrintExportApi } from './gridPrintExportApi';
|
|
13
|
-
import { GridRowApi } from './gridRowApi';
|
|
13
|
+
import { GridRowApi, GridRowProPrivateApi } from './gridRowApi';
|
|
14
14
|
import { GridRowsMetaApi, GridRowsMetaPrivateApi } from './gridRowsMetaApi';
|
|
15
15
|
import { GridRowSelectionApi } from './gridRowSelectionApi';
|
|
16
16
|
import { GridSortApi } from './gridSortApi';
|
|
@@ -31,7 +31,7 @@ import type { DataGridProcessedProps } from '../props/DataGridProps';
|
|
|
31
31
|
import type { GridColumnResizeApi } from '../../hooks/features/columnResize';
|
|
32
32
|
export interface GridApiCommon<GridState extends GridStateCommunity = any, GridInitialState extends GridInitialStateCommunity = any> extends GridCoreApi, GridPipeProcessingApi, GridDensityApi, GridDimensionsApi, GridRowApi, GridRowsMetaApi, GridEditingApi, GridParamsApi, GridColumnApi, GridRowSelectionApi, GridSortApi, GridPaginationApi, GridCsvExportApi, GridFocusApi, GridFilterApi, GridColumnMenuApi, GridPreferencesPanelApi, GridPrintExportApi, GridVirtualizationApi, GridLocaleTextApi, GridScrollApi, GridColumnSpanningApi, GridStateApi<GridState>, GridStatePersistenceApi<GridInitialState>, GridColumnGroupingApi, GridHeaderFilteringApi, GridColumnResizeApi {
|
|
33
33
|
}
|
|
34
|
-
export interface GridPrivateOnlyApiCommon<Api extends GridApiCommon, PrivateApi extends GridPrivateApiCommon, Props extends DataGridProcessedProps> extends GridCorePrivateApi<Api, PrivateApi, Props>, GridStatePrivateApi<PrivateApi['state']>, GridPipeProcessingPrivateApi, GridStrategyProcessingApi, GridColumnSpanningPrivateApi, GridRowsMetaPrivateApi, GridDimensionsPrivateApi, GridEditingPrivateApi, GridLoggerApi, GridFocusPrivateApi, GridHeaderFilteringPrivateApi, GridVirtualizationPrivateApi {
|
|
34
|
+
export interface GridPrivateOnlyApiCommon<Api extends GridApiCommon, PrivateApi extends GridPrivateApiCommon, Props extends DataGridProcessedProps> extends GridCorePrivateApi<Api, PrivateApi, Props>, GridStatePrivateApi<PrivateApi['state']>, GridPipeProcessingPrivateApi, GridStrategyProcessingApi, GridColumnSpanningPrivateApi, GridRowsMetaPrivateApi, GridDimensionsPrivateApi, GridEditingPrivateApi, GridLoggerApi, GridFocusPrivateApi, GridHeaderFilteringPrivateApi, GridVirtualizationPrivateApi, GridRowProPrivateApi {
|
|
35
35
|
}
|
|
36
36
|
export interface GridPrivateApiCommon extends GridApiCommon, GridPrivateOnlyApiCommon<GridApiCommon, GridPrivateApiCommon, DataGridProcessedProps> {
|
|
37
37
|
}
|
|
@@ -40,6 +40,11 @@ export interface GridRowApi {
|
|
|
40
40
|
* @returns {GridRowId[]} A list of ids.
|
|
41
41
|
*/
|
|
42
42
|
getAllRowIds: () => GridRowId[];
|
|
43
|
+
/**
|
|
44
|
+
* Sets the internal loading state.
|
|
45
|
+
* @param {boolean} loading If `true` the loading indicator will be shown over the Data Grid.
|
|
46
|
+
*/
|
|
47
|
+
setLoading: (loading: boolean) => void;
|
|
43
48
|
/**
|
|
44
49
|
* Sets a new set of rows.
|
|
45
50
|
* @param {GridRowModel[]} rows The new rows.
|
|
@@ -103,3 +108,12 @@ export interface GridRowProApi {
|
|
|
103
108
|
*/
|
|
104
109
|
setRowChildrenExpansion: (id: GridRowId, isExpanded: boolean) => void;
|
|
105
110
|
}
|
|
111
|
+
export interface GridRowProPrivateApi {
|
|
112
|
+
/**
|
|
113
|
+
* Allows to update, insert and delete rows at a specific nested level.
|
|
114
|
+
* @param {GridRowModelUpdate[]} updates An array of rows with an `action` specifying what to do.
|
|
115
|
+
* @param {string[]} groupKeys The group keys of the rows to update.
|
|
116
|
+
* @param {boolean} throttle Whether to throttle the updates or not. (default: `true`)
|
|
117
|
+
*/
|
|
118
|
+
updateServerRows: (updates: GridRowModelUpdate[], groupKeys?: string[]) => void;
|
|
119
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { GridSortModel, GridFilterModel, GridColDef, GridRowModel, GridPaginationModel } from '.';
|
|
2
|
+
export interface GridGetRowsParams {
|
|
3
|
+
sortModel: GridSortModel;
|
|
4
|
+
filterModel: GridFilterModel;
|
|
5
|
+
/**
|
|
6
|
+
* Alternate to `start` and `end`, maps to `GridPaginationModel` interface.
|
|
7
|
+
*/
|
|
8
|
+
paginationModel: GridPaginationModel;
|
|
9
|
+
/**
|
|
10
|
+
* First row index to fetch (number) or cursor information (number | string).
|
|
11
|
+
*/
|
|
12
|
+
start: number | string;
|
|
13
|
+
/**
|
|
14
|
+
* Last row index to fetch.
|
|
15
|
+
*/
|
|
16
|
+
end: number;
|
|
17
|
+
/**
|
|
18
|
+
* List of grouped columns (only applicable with `rowGrouping`).
|
|
19
|
+
*/
|
|
20
|
+
groupFields?: GridColDef['field'][];
|
|
21
|
+
/**
|
|
22
|
+
* Array of keys returned by `getGroupKey` of all the parent rows until the row for which the data is requested
|
|
23
|
+
* `getGroupKey` prop must be implemented to use this.
|
|
24
|
+
* Useful for `treeData` and `rowGrouping` only.
|
|
25
|
+
*/
|
|
26
|
+
groupKeys?: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface GridGetRowsResponse {
|
|
29
|
+
rows: GridRowModel[];
|
|
30
|
+
/**
|
|
31
|
+
* To reflect updates in total `rowCount` (optional).
|
|
32
|
+
* Useful when the `rowCount` is inaccurate (for example when filtering) or not available upfront.
|
|
33
|
+
*/
|
|
34
|
+
rowCount?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Additional `pageInfo` for advanced use-cases.
|
|
37
|
+
* `hasNextPage`: When row count is unknown/estimated, `hasNextPage` will be used to check if more records are available on server
|
|
38
|
+
*/
|
|
39
|
+
pageInfo?: {
|
|
40
|
+
hasNextPage?: boolean;
|
|
41
|
+
nextCursor?: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface GridDataSource {
|
|
45
|
+
/**
|
|
46
|
+
* This method will be called when the grid needs to fetch some rows
|
|
47
|
+
* @param {GridGetRowsParams} params The parameters required to fetch the rows
|
|
48
|
+
* @returns {Promise<GridGetRowsResponse>} A promise that resolves to the data of type [GridGetRowsResponse]
|
|
49
|
+
*/
|
|
50
|
+
getRows(params: GridGetRowsParams): Promise<GridGetRowsResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* This method will be called when the user updates a row [Not yet implemented]
|
|
53
|
+
* @param {GridRowModel} updatedRow The updated row
|
|
54
|
+
* @returns {Promise<any>} If resolved (synced on the backend), the grid will update the row and mutate the cache
|
|
55
|
+
*/
|
|
56
|
+
updateRow?(updatedRow: GridRowModel): Promise<any>;
|
|
57
|
+
/**
|
|
58
|
+
* Used to group rows by their parent group. Replaces `getTreeDataPath` used in client side tree-data .
|
|
59
|
+
* @param {GridRowModel} row The row to get the group key of
|
|
60
|
+
* @returns {string} The group key for the row
|
|
61
|
+
*/
|
|
62
|
+
getGroupKey?: (row: GridRowModel) => string;
|
|
63
|
+
/**
|
|
64
|
+
* Used to determine the number of children a row has on server.
|
|
65
|
+
* @param {GridRowModel} row The row to check the number of children
|
|
66
|
+
* @returns {number} The number of children the row has
|
|
67
|
+
*/
|
|
68
|
+
getChildrenCount?: (row: GridRowModel) => number;
|
|
69
|
+
}
|
|
70
|
+
export interface GridDataSourceCache {
|
|
71
|
+
/**
|
|
72
|
+
* Set the cache entry for the given key
|
|
73
|
+
* @param {GridGetRowsParams} key The key of type `GridGetRowsParams`
|
|
74
|
+
* @param {GridGetRowsResponse} value The value to be stored in the cache
|
|
75
|
+
*/
|
|
76
|
+
set: (key: GridGetRowsParams, value: GridGetRowsResponse) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Get the cache entry for the given key
|
|
79
|
+
* @param {GridGetRowsParams} key The key of type `GridGetRowsParams`
|
|
80
|
+
* @returns {GridGetRowsResponse} The value stored in the cache
|
|
81
|
+
*/
|
|
82
|
+
get: (key: GridGetRowsParams) => GridGetRowsResponse | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Clear the cache
|
|
85
|
+
*/
|
|
86
|
+
clear: () => void;
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/models/gridRows.d.ts
CHANGED
|
@@ -102,6 +102,16 @@ export interface GridDataGroupNode extends GridBasicGroupNode {
|
|
|
102
102
|
*/
|
|
103
103
|
isAutoGenerated: false;
|
|
104
104
|
}
|
|
105
|
+
export interface GridDataSourceGroupNode extends GridDataGroupNode {
|
|
106
|
+
/**
|
|
107
|
+
* If true, this node has children on server.
|
|
108
|
+
*/
|
|
109
|
+
hasServerChildren: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* The cached path to be passed on as `groupKey` to the server.
|
|
112
|
+
*/
|
|
113
|
+
path: string[];
|
|
114
|
+
}
|
|
105
115
|
export type GridGroupNode = GridDataGroupNode | GridAutoGeneratedGroupNode;
|
|
106
116
|
export type GridChildrenFromPathLookup = {
|
|
107
117
|
[groupingField: string]: {
|
|
@@ -88,6 +88,11 @@ export interface GridSlotsComponent extends GridBaseSlots, GridIconSlotsComponen
|
|
|
88
88
|
* @default GridColumnHeaderFilterIconButton
|
|
89
89
|
*/
|
|
90
90
|
columnHeaderFilterIconButton: React.JSXElementConstructor<GridSlotProps['columnHeaderFilterIconButton']>;
|
|
91
|
+
/**
|
|
92
|
+
* Sort icon component rendered in each column header.
|
|
93
|
+
* @default GridColumnHeaderSortIcon
|
|
94
|
+
*/
|
|
95
|
+
columnHeaderSortIcon: React.JSXElementConstructor<GridSlotProps['columnHeaderSortIcon']>;
|
|
91
96
|
/**
|
|
92
97
|
* Column menu component rendered by clicking on the 3 dots "kebab" icon in column headers.
|
|
93
98
|
* @default GridColumnMenu
|
|
@@ -27,7 +27,8 @@ import type { GridColumnHeadersProps } from '../components/GridColumnHeaders';
|
|
|
27
27
|
import type { GridDetailPanelsProps } from '../components/GridDetailPanels';
|
|
28
28
|
import type { GridPinnedRowsProps } from '../components/GridPinnedRows';
|
|
29
29
|
import type { GridColumnsManagementProps } from '../components/columnsManagement/GridColumnsManagement';
|
|
30
|
-
import type { GridRowCountProps } from '../components';
|
|
30
|
+
import type { GridRowCountProps } from '../components/GridRowCount';
|
|
31
|
+
import type { GridColumnHeaderSortIconProps } from '../components/columnHeaders/GridColumnHeaderSortIcon';
|
|
31
32
|
export interface BaseCheckboxPropsOverrides {
|
|
32
33
|
}
|
|
33
34
|
export interface BaseTextFieldPropsOverrides {
|
|
@@ -60,6 +61,8 @@ export interface ToolbarPropsOverrides {
|
|
|
60
61
|
}
|
|
61
62
|
export interface ColumnHeaderFilterIconButtonPropsOverrides {
|
|
62
63
|
}
|
|
64
|
+
export interface ColumnHeaderSortIconPropsOverrides {
|
|
65
|
+
}
|
|
63
66
|
export interface ColumnMenuPropsOverrides {
|
|
64
67
|
}
|
|
65
68
|
export interface ColumnsPanelPropsOverrides {
|
|
@@ -111,6 +114,7 @@ export interface GridSlotProps {
|
|
|
111
114
|
cell: GridCellProps & CellPropsOverrides;
|
|
112
115
|
columnHeaders: GridColumnHeadersProps;
|
|
113
116
|
columnHeaderFilterIconButton: ColumnHeaderFilterIconButtonProps & ColumnHeaderFilterIconButtonPropsOverrides;
|
|
117
|
+
columnHeaderSortIcon: GridColumnHeaderSortIconProps & ColumnHeaderSortIconPropsOverrides;
|
|
114
118
|
columnMenu: GridColumnMenuProps & ColumnMenuPropsOverrides;
|
|
115
119
|
columnsPanel: GridColumnsPanelProps & ColumnsPanelPropsOverrides;
|
|
116
120
|
columnsManagement: GridColumnsManagementProps & ColumnsManagementPropsOverrides;
|
|
@@ -25,6 +25,7 @@ import { GridCellModesModel, GridRowModesModel } from '../api/gridEditingApi';
|
|
|
25
25
|
import { GridColumnGroupingModel } from '../gridColumnGrouping';
|
|
26
26
|
import { GridPaginationMeta, GridPaginationModel } from '../gridPaginationProps';
|
|
27
27
|
import type { GridAutosizeOptions } from '../../hooks/features/columnResize';
|
|
28
|
+
import type { GridDataSource } from '../gridDataSource';
|
|
28
29
|
export interface GridExperimentalFeatures {
|
|
29
30
|
/**
|
|
30
31
|
* Emits a warning if the cell receives focus without also syncing the focus state.
|
|
@@ -774,6 +775,7 @@ export interface DataGridProSharedPropsWithoutDefaultValue {
|
|
|
774
775
|
* Override the height of the header filters.
|
|
775
776
|
*/
|
|
776
777
|
headerFilterHeight?: number;
|
|
778
|
+
unstable_dataSource?: GridDataSource;
|
|
777
779
|
}
|
|
778
780
|
export interface DataGridPremiumSharedPropsWithDefaultValue {
|
|
779
781
|
/**
|
|
@@ -5,7 +5,6 @@ import clsx from 'clsx';
|
|
|
5
5
|
import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
|
|
6
6
|
import { fastMemo } from '../../utils/fastMemo';
|
|
7
7
|
import { useGridPrivateApiContext } from '../../hooks/utils/useGridPrivateApiContext';
|
|
8
|
-
import { GridColumnHeaderSortIcon } from './GridColumnHeaderSortIcon';
|
|
9
8
|
import { ColumnHeaderMenuIcon } from './ColumnHeaderMenuIcon';
|
|
10
9
|
import { GridColumnHeaderMenu } from '../menu/columnMenu/GridColumnHeaderMenu';
|
|
11
10
|
import { gridClasses, getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
@@ -142,12 +141,13 @@ function GridColumnHeaderItem(props) {
|
|
|
142
141
|
children: [!rootProps.disableColumnFilter && /*#__PURE__*/_jsx(rootProps.slots.columnHeaderFilterIconButton, _extends({
|
|
143
142
|
field: colDef.field,
|
|
144
143
|
counter: filterItemsCounter
|
|
145
|
-
}, rootProps.slotProps?.columnHeaderFilterIconButton)), showSortIcon && /*#__PURE__*/_jsx(
|
|
144
|
+
}, rootProps.slotProps?.columnHeaderFilterIconButton)), showSortIcon && /*#__PURE__*/_jsx(rootProps.slots.columnHeaderSortIcon, _extends({
|
|
145
|
+
field: colDef.field,
|
|
146
146
|
direction: sortDirection,
|
|
147
147
|
index: sortIndex,
|
|
148
148
|
sortingOrder: sortingOrder,
|
|
149
149
|
disabled: !colDef.sortable
|
|
150
|
-
})]
|
|
150
|
+
}, rootProps.slotProps?.columnHeaderSortIcon))]
|
|
151
151
|
});
|
|
152
152
|
React.useLayoutEffect(() => {
|
|
153
153
|
const columnMenuState = apiRef.current.state.columnMenu;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["direction", "index", "sortingOrder", "disabled"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -35,11 +37,12 @@ function getIcon(icons, direction, className, sortingOrder) {
|
|
|
35
37
|
}
|
|
36
38
|
function GridColumnHeaderSortIconRaw(props) {
|
|
37
39
|
const {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
direction,
|
|
41
|
+
index,
|
|
42
|
+
sortingOrder,
|
|
43
|
+
disabled
|
|
44
|
+
} = props,
|
|
45
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
43
46
|
const apiRef = useGridApiContext();
|
|
44
47
|
const rootProps = useGridRootProps();
|
|
45
48
|
const ownerState = _extends({}, props, {
|
|
@@ -56,13 +59,14 @@ function GridColumnHeaderSortIconRaw(props) {
|
|
|
56
59
|
title: apiRef.current.getLocaleText('columnHeaderSortIconLabel'),
|
|
57
60
|
size: "small",
|
|
58
61
|
disabled: disabled
|
|
59
|
-
}, rootProps.slotProps?.baseIconButton, {
|
|
62
|
+
}, rootProps.slotProps?.baseIconButton, other, {
|
|
60
63
|
children: iconElement
|
|
61
64
|
}));
|
|
62
65
|
return /*#__PURE__*/_jsxs(GridIconButtonContainer, {
|
|
63
66
|
children: [index != null && /*#__PURE__*/_jsx(Badge, {
|
|
64
67
|
badgeContent: index,
|
|
65
68
|
color: "default",
|
|
69
|
+
overlap: "circular",
|
|
66
70
|
children: iconButton
|
|
67
71
|
}), index == null && iconButton]
|
|
68
72
|
});
|
|
@@ -75,6 +79,7 @@ process.env.NODE_ENV !== "production" ? GridColumnHeaderSortIconRaw.propTypes =
|
|
|
75
79
|
// ----------------------------------------------------------------------
|
|
76
80
|
direction: PropTypes.oneOf(['asc', 'desc']),
|
|
77
81
|
disabled: PropTypes.bool,
|
|
82
|
+
field: PropTypes.string.isRequired,
|
|
78
83
|
index: PropTypes.number,
|
|
79
84
|
sortingOrder: PropTypes.arrayOf(PropTypes.oneOf(['asc', 'desc'])).isRequired
|
|
80
85
|
} : void 0;
|
|
@@ -141,6 +141,8 @@ export const GridRootStyles = styled('div', {
|
|
|
141
141
|
[`& .${c.treeDataGroupingCell}`]: styles.treeDataGroupingCell
|
|
142
142
|
}, {
|
|
143
143
|
[`& .${c.treeDataGroupingCellToggle}`]: styles.treeDataGroupingCellToggle
|
|
144
|
+
}, {
|
|
145
|
+
[`& .${c.treeDataGroupingCellLoadingContainer}`]: styles.treeDataGroupingCellLoadingContainer
|
|
144
146
|
}, {
|
|
145
147
|
[`& .${c.detailPanelToggleCell}`]: styles.detailPanelToggleCell
|
|
146
148
|
}, {
|
|
@@ -608,6 +610,12 @@ export const GridRootStyles = styled('div', {
|
|
|
608
610
|
alignSelf: 'stretch',
|
|
609
611
|
marginRight: t.spacing(2)
|
|
610
612
|
},
|
|
613
|
+
[`& .${c.treeDataGroupingCellLoadingContainer}`]: {
|
|
614
|
+
display: 'flex',
|
|
615
|
+
alignItems: 'center',
|
|
616
|
+
justifyContent: 'center',
|
|
617
|
+
height: '100%'
|
|
618
|
+
},
|
|
611
619
|
[`& .${c.groupingCriteriaCell}`]: {
|
|
612
620
|
display: 'flex',
|
|
613
621
|
alignItems: 'center',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridRow, GridColumnHeaderFilterIconButton, GridRowCount, GridColumnsManagement } from '../components';
|
|
2
|
+
import { GridSkeletonCell, GridColumnsPanel, GridFilterPanel, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridPanel, GridRow, GridColumnHeaderFilterIconButton, GridRowCount, GridColumnsManagement, GridColumnHeaderSortIcon } from '../components';
|
|
3
3
|
import { GridCell } from '../components/cell/GridCell';
|
|
4
4
|
import { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
5
5
|
import { GridColumnMenu } from '../components/menu/columnMenu/GridColumnMenu';
|
|
@@ -14,6 +14,7 @@ export const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = _extends({}, materialSlots, {
|
|
|
14
14
|
cell: GridCell,
|
|
15
15
|
skeletonCell: GridSkeletonCell,
|
|
16
16
|
columnHeaderFilterIconButton: GridColumnHeaderFilterIconButton,
|
|
17
|
+
columnHeaderSortIcon: GridColumnHeaderSortIcon,
|
|
17
18
|
columnMenu: GridColumnMenu,
|
|
18
19
|
columnHeaders: GridColumnHeaders,
|
|
19
20
|
detailPanels: GridDetailPanels,
|
|
@@ -2,4 +2,4 @@ import { unstable_generateUtilityClasses as generateUtilityClasses, unstable_gen
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderTop', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'autoHeight', 'autosizing', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementFooter', 'container--top', 'container--bottom', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderTop', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'row--detailPanelExpanded', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--header', 'scrollbarFiller--borderTop', 'scrollbarFiller--pinnedRight', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pinnedRowsRenderZone']);
|
|
@@ -49,6 +49,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
49
49
|
const logger = useGridLogger(apiRef, 'useResizeContainer');
|
|
50
50
|
const errorShown = React.useRef(false);
|
|
51
51
|
const rootDimensionsRef = React.useRef(EMPTY_SIZE);
|
|
52
|
+
const dimensionsState = useGridSelector(apiRef, gridDimensionsSelector);
|
|
52
53
|
const rowsMeta = useGridSelector(apiRef, gridRowsMetaSelector);
|
|
53
54
|
const pinnedColumns = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
|
|
54
55
|
const densityFactor = useGridSelector(apiRef, gridDensityFactorSelector);
|
|
@@ -208,26 +209,25 @@ export function useGridDimensions(apiRef, props) {
|
|
|
208
209
|
}
|
|
209
210
|
}, [apiRef, savedSize, updateDimensions]);
|
|
210
211
|
const root = apiRef.current.rootElementRef.current;
|
|
211
|
-
const dimensions = apiRef.current.state.dimensions;
|
|
212
212
|
useEnhancedEffect(() => {
|
|
213
213
|
if (!root) {
|
|
214
214
|
return;
|
|
215
215
|
}
|
|
216
216
|
const set = (k, v) => root.style.setProperty(k, v);
|
|
217
|
-
set('--DataGrid-width', `${
|
|
218
|
-
set('--DataGrid-hasScrollX', `${Number(
|
|
219
|
-
set('--DataGrid-hasScrollY', `${Number(
|
|
220
|
-
set('--DataGrid-scrollbarSize', `${
|
|
221
|
-
set('--DataGrid-rowWidth', `${
|
|
222
|
-
set('--DataGrid-columnsTotalWidth', `${
|
|
223
|
-
set('--DataGrid-leftPinnedWidth', `${
|
|
224
|
-
set('--DataGrid-rightPinnedWidth', `${
|
|
225
|
-
set('--DataGrid-headerHeight', `${
|
|
226
|
-
set('--DataGrid-headersTotalHeight', `${
|
|
227
|
-
set('--DataGrid-topContainerHeight', `${
|
|
228
|
-
set('--DataGrid-bottomContainerHeight', `${
|
|
229
|
-
set('--height', `${
|
|
230
|
-
}, [root,
|
|
217
|
+
set('--DataGrid-width', `${dimensionsState.viewportOuterSize.width}px`);
|
|
218
|
+
set('--DataGrid-hasScrollX', `${Number(dimensionsState.hasScrollX)}`);
|
|
219
|
+
set('--DataGrid-hasScrollY', `${Number(dimensionsState.hasScrollY)}`);
|
|
220
|
+
set('--DataGrid-scrollbarSize', `${dimensionsState.scrollbarSize}px`);
|
|
221
|
+
set('--DataGrid-rowWidth', `${dimensionsState.rowWidth}px`);
|
|
222
|
+
set('--DataGrid-columnsTotalWidth', `${dimensionsState.columnsTotalWidth}px`);
|
|
223
|
+
set('--DataGrid-leftPinnedWidth', `${dimensionsState.leftPinnedWidth}px`);
|
|
224
|
+
set('--DataGrid-rightPinnedWidth', `${dimensionsState.rightPinnedWidth}px`);
|
|
225
|
+
set('--DataGrid-headerHeight', `${dimensionsState.headerHeight}px`);
|
|
226
|
+
set('--DataGrid-headersTotalHeight', `${dimensionsState.headersTotalHeight}px`);
|
|
227
|
+
set('--DataGrid-topContainerHeight', `${dimensionsState.topContainerHeight}px`);
|
|
228
|
+
set('--DataGrid-bottomContainerHeight', `${dimensionsState.bottomContainerHeight}px`);
|
|
229
|
+
set('--height', `${dimensionsState.rowHeight}px`);
|
|
230
|
+
}, [root, dimensionsState]);
|
|
231
231
|
const isFirstSizing = React.useRef(true);
|
|
232
232
|
const handleResize = React.useCallback(size => {
|
|
233
233
|
rootDimensionsRef.current = size;
|
|
@@ -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
|
|
@@ -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 => {
|
|
@@ -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
|
}
|