@mui/x-data-grid 7.7.1 → 7.9.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 +166 -1
- package/DataGrid/useDataGridComponent.d.ts +0 -1
- package/DataGrid/useDataGridProps.js +9 -2
- package/components/GridFooter.d.ts +1 -1
- package/components/GridLoadingOverlay.d.ts +15 -3
- package/components/GridLoadingOverlay.js +48 -4
- package/components/GridNoResultsOverlay.d.ts +1 -1
- package/components/GridNoRowsOverlay.d.ts +1 -1
- package/components/GridRow.js +2 -1
- package/components/GridRowCount.d.ts +1 -1
- package/components/GridSelectedRowCount.d.ts +1 -1
- package/components/GridSkeletonLoadingOverlay.d.ts +3 -0
- package/components/GridSkeletonLoadingOverlay.js +181 -0
- package/components/base/GridOverlays.d.ts +11 -1
- package/components/base/GridOverlays.js +25 -39
- package/components/cell/GridActionsCellItem.d.ts +3 -3
- package/components/cell/GridSkeletonCell.d.ts +13 -6
- package/components/cell/GridSkeletonCell.js +61 -19
- 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 +19 -2
- 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/GridVirtualScroller.js +7 -5
- 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 +14 -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/overlays/useGridOverlays.d.ts +11 -0
- package/hooks/features/overlays/useGridOverlays.js +35 -0
- 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/features/virtualization/useGridVirtualScroller.js +1 -1
- package/hooks/utils/index.d.ts +0 -1
- package/hooks/utils/index.js +0 -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 +7 -2
- package/models/props/DataGridProps.d.ts +2 -0
- package/modern/DataGrid/useDataGridProps.js +9 -2
- package/modern/components/GridLoadingOverlay.js +48 -4
- package/modern/components/GridRow.js +2 -1
- package/modern/components/GridSkeletonLoadingOverlay.js +181 -0
- package/modern/components/base/GridOverlays.js +25 -39
- package/modern/components/cell/GridSkeletonCell.js +61 -19
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
- package/modern/components/containers/GridRootStyles.js +19 -2
- package/modern/components/virtualization/GridVirtualScroller.js +7 -5
- 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/overlays/useGridOverlays.js +35 -0
- 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/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/modern/hooks/utils/index.js +0 -1
- 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/modern/utils/utils.js +10 -2
- package/node/DataGrid/useDataGridProps.js +9 -2
- package/node/components/GridLoadingOverlay.js +48 -4
- package/node/components/GridRow.js +2 -1
- package/node/components/GridSkeletonLoadingOverlay.js +189 -0
- package/node/components/base/GridOverlays.js +25 -39
- package/node/components/cell/GridSkeletonCell.js +60 -18
- package/node/components/columnHeaders/GridColumnHeaderItem.js +3 -3
- package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
- package/node/components/containers/GridRootStyles.js +19 -2
- package/node/components/virtualization/GridVirtualScroller.js +6 -4
- 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/overlays/useGridOverlays.js +42 -0
- 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/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/node/hooks/utils/index.js +0 -12
- 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/node/utils/utils.js +11 -3
- package/package.json +5 -4
- 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/utils.d.ts +8 -1
- package/utils/utils.js +10 -2
- package/utils/warning.d.ts +1 -1
- package/hooks/utils/useResizeObserver.d.ts +0 -2
- package/hooks/utils/useResizeObserver.js +0 -36
- package/modern/hooks/utils/useResizeObserver.js +0 -36
- package/node/hooks/utils/useResizeObserver.js +0 -44
|
@@ -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;
|
|
@@ -4,11 +4,11 @@ import * as ReactDOM from 'react-dom';
|
|
|
4
4
|
import { unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
5
5
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
6
6
|
import useTimeout from '@mui/utils/useTimeout';
|
|
7
|
+
import { useResizeObserver } from '@mui/x-internals/useResizeObserver';
|
|
7
8
|
import { useTheme } from '@mui/material/styles';
|
|
8
9
|
import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
|
|
9
10
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
10
11
|
import { useGridSelector } from '../../utils/useGridSelector';
|
|
11
|
-
import { useResizeObserver } from '../../utils/useResizeObserver';
|
|
12
12
|
import { useRunOnce } from '../../utils/useRunOnce';
|
|
13
13
|
import { gridVisibleColumnDefinitionsSelector, gridVisiblePinnedColumnDefinitionsSelector, gridColumnPositionsSelector, gridHasColSpanSelector } from '../columns/gridColumnsSelector';
|
|
14
14
|
import { gridDimensionsSelector } from '../dimensions/gridDimensionsSelectors';
|
package/hooks/utils/index.d.ts
CHANGED
package/hooks/utils/index.js
CHANGED
|
@@ -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';
|
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,9 @@ 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 {
|
|
30
|
+
import type { GridLoadingOverlayProps } from '../components/GridLoadingOverlay';
|
|
31
|
+
import type { GridRowCountProps } from '../components/GridRowCount';
|
|
32
|
+
import type { GridColumnHeaderSortIconProps } from '../components/columnHeaders/GridColumnHeaderSortIcon';
|
|
31
33
|
export interface BaseCheckboxPropsOverrides {
|
|
32
34
|
}
|
|
33
35
|
export interface BaseTextFieldPropsOverrides {
|
|
@@ -60,6 +62,8 @@ export interface ToolbarPropsOverrides {
|
|
|
60
62
|
}
|
|
61
63
|
export interface ColumnHeaderFilterIconButtonPropsOverrides {
|
|
62
64
|
}
|
|
65
|
+
export interface ColumnHeaderSortIconPropsOverrides {
|
|
66
|
+
}
|
|
63
67
|
export interface ColumnMenuPropsOverrides {
|
|
64
68
|
}
|
|
65
69
|
export interface ColumnsPanelPropsOverrides {
|
|
@@ -111,6 +115,7 @@ export interface GridSlotProps {
|
|
|
111
115
|
cell: GridCellProps & CellPropsOverrides;
|
|
112
116
|
columnHeaders: GridColumnHeadersProps;
|
|
113
117
|
columnHeaderFilterIconButton: ColumnHeaderFilterIconButtonProps & ColumnHeaderFilterIconButtonPropsOverrides;
|
|
118
|
+
columnHeaderSortIcon: GridColumnHeaderSortIconProps & ColumnHeaderSortIconPropsOverrides;
|
|
114
119
|
columnMenu: GridColumnMenuProps & ColumnMenuPropsOverrides;
|
|
115
120
|
columnsPanel: GridColumnsPanelProps & ColumnsPanelPropsOverrides;
|
|
116
121
|
columnsManagement: GridColumnsManagementProps & ColumnsManagementPropsOverrides;
|
|
@@ -118,7 +123,7 @@ export interface GridSlotProps {
|
|
|
118
123
|
filterPanel: GridFilterPanelProps & FilterPanelPropsOverrides;
|
|
119
124
|
footer: GridFooterContainerProps & FooterPropsOverrides;
|
|
120
125
|
footerRowCount: GridRowCountProps & FooterRowCountOverrides;
|
|
121
|
-
loadingOverlay:
|
|
126
|
+
loadingOverlay: GridLoadingOverlayProps & LoadingOverlayPropsOverrides;
|
|
122
127
|
noResultsOverlay: GridOverlayProps & NoResultsOverlayPropsOverrides;
|
|
123
128
|
noRowsOverlay: GridOverlayProps & NoRowsOverlayPropsOverrides;
|
|
124
129
|
pagination: Partial<TablePaginationProps> & PaginationPropsOverrides;
|
|
@@ -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
|
/**
|
|
@@ -85,8 +85,15 @@ export const useDataGridProps = inProps => {
|
|
|
85
85
|
defaultSlots,
|
|
86
86
|
slots: themedProps.slots
|
|
87
87
|
}), [themedProps.slots]);
|
|
88
|
-
|
|
88
|
+
const injectDefaultProps = React.useMemo(() => {
|
|
89
|
+
return Object.keys(DATA_GRID_PROPS_DEFAULT_VALUES).reduce((acc, key) => {
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
acc[key] = themedProps[key] ?? DATA_GRID_PROPS_DEFAULT_VALUES[key];
|
|
92
|
+
return acc;
|
|
93
|
+
}, {});
|
|
94
|
+
}, [themedProps]);
|
|
95
|
+
return React.useMemo(() => _extends({}, themedProps, injectDefaultProps, {
|
|
89
96
|
localeText,
|
|
90
97
|
slots
|
|
91
|
-
}, DATA_GRID_FORCED_PROPS), [themedProps, localeText, slots]);
|
|
98
|
+
}, DATA_GRID_FORCED_PROPS), [themedProps, localeText, slots, injectDefaultProps]);
|
|
92
99
|
};
|
|
@@ -1,14 +1,48 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["variant", "noRowsVariant", "style"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import LinearProgress from '@mui/material/LinearProgress';
|
|
4
7
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
5
8
|
import { GridOverlay } from './containers/GridOverlay';
|
|
9
|
+
import { GridSkeletonLoadingOverlay } from './GridSkeletonLoadingOverlay';
|
|
10
|
+
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
11
|
+
import { gridRowCountSelector, useGridSelector } from '../hooks';
|
|
6
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const LOADING_VARIANTS = {
|
|
14
|
+
'circular-progress': {
|
|
15
|
+
component: CircularProgress,
|
|
16
|
+
style: {}
|
|
17
|
+
},
|
|
18
|
+
'linear-progress': {
|
|
19
|
+
component: LinearProgress,
|
|
20
|
+
style: {
|
|
21
|
+
display: 'block'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
skeleton: {
|
|
25
|
+
component: GridSkeletonLoadingOverlay,
|
|
26
|
+
style: {
|
|
27
|
+
display: 'block'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
7
31
|
const GridLoadingOverlay = /*#__PURE__*/React.forwardRef(function GridLoadingOverlay(props, ref) {
|
|
32
|
+
const {
|
|
33
|
+
variant = 'circular-progress',
|
|
34
|
+
noRowsVariant = 'circular-progress',
|
|
35
|
+
style
|
|
36
|
+
} = props,
|
|
37
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
38
|
+
const apiRef = useGridApiContext();
|
|
39
|
+
const rowsCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
40
|
+
const activeVariant = LOADING_VARIANTS[rowsCount === 0 ? noRowsVariant : variant];
|
|
8
41
|
return /*#__PURE__*/_jsx(GridOverlay, _extends({
|
|
9
|
-
ref: ref
|
|
10
|
-
|
|
11
|
-
|
|
42
|
+
ref: ref,
|
|
43
|
+
style: _extends({}, activeVariant.style, style)
|
|
44
|
+
}, other, {
|
|
45
|
+
children: /*#__PURE__*/_jsx(activeVariant.component, {})
|
|
12
46
|
}));
|
|
13
47
|
});
|
|
14
48
|
process.env.NODE_ENV !== "production" ? GridLoadingOverlay.propTypes = {
|
|
@@ -16,6 +50,16 @@ process.env.NODE_ENV !== "production" ? GridLoadingOverlay.propTypes = {
|
|
|
16
50
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
17
51
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
18
52
|
// ----------------------------------------------------------------------
|
|
19
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The variant of the overlay when no rows are displayed.
|
|
55
|
+
* @default 'circular-progress'
|
|
56
|
+
*/
|
|
57
|
+
noRowsVariant: PropTypes.oneOf(['circular-progress', 'linear-progress', 'skeleton']),
|
|
58
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
59
|
+
/**
|
|
60
|
+
* The variant of the overlay.
|
|
61
|
+
* @default 'circular-progress'
|
|
62
|
+
*/
|
|
63
|
+
variant: PropTypes.oneOf(['circular-progress', 'linear-progress', 'skeleton'])
|
|
20
64
|
} : void 0;
|
|
21
65
|
export { GridLoadingOverlay };
|
|
@@ -249,10 +249,11 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
249
249
|
const pinnedOffset = getPinnedCellOffset(gridPinnedColumnPositionLookup[pinnedPosition], column.computedWidth, indexRelativeToAllColumns, columnPositions, dimensions);
|
|
250
250
|
if (rowNode?.type === 'skeletonRow') {
|
|
251
251
|
return /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
252
|
+
type: column.type,
|
|
252
253
|
width: width,
|
|
253
254
|
height: rowHeight,
|
|
254
255
|
field: column.field,
|
|
255
|
-
align: column.align
|
|
256
|
+
align: column.align
|
|
256
257
|
}, column.field);
|
|
257
258
|
}
|
|
258
259
|
const editCellState = editRowsState[rowId]?.[column.field] ?? null;
|