@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.
Files changed (162) hide show
  1. package/CHANGELOG.md +166 -1
  2. package/DataGrid/useDataGridComponent.d.ts +0 -1
  3. package/DataGrid/useDataGridProps.js +9 -2
  4. package/components/GridFooter.d.ts +1 -1
  5. package/components/GridLoadingOverlay.d.ts +15 -3
  6. package/components/GridLoadingOverlay.js +48 -4
  7. package/components/GridNoResultsOverlay.d.ts +1 -1
  8. package/components/GridNoRowsOverlay.d.ts +1 -1
  9. package/components/GridRow.js +2 -1
  10. package/components/GridRowCount.d.ts +1 -1
  11. package/components/GridSelectedRowCount.d.ts +1 -1
  12. package/components/GridSkeletonLoadingOverlay.d.ts +3 -0
  13. package/components/GridSkeletonLoadingOverlay.js +181 -0
  14. package/components/base/GridOverlays.d.ts +11 -1
  15. package/components/base/GridOverlays.js +25 -39
  16. package/components/cell/GridActionsCellItem.d.ts +3 -3
  17. package/components/cell/GridSkeletonCell.d.ts +13 -6
  18. package/components/cell/GridSkeletonCell.js +61 -19
  19. package/components/columnHeaders/GridColumnHeaderItem.js +3 -3
  20. package/components/columnHeaders/GridColumnHeaderSortIcon.d.ts +1 -0
  21. package/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
  22. package/components/containers/GridFooterContainer.d.ts +1 -1
  23. package/components/containers/GridOverlay.d.ts +1 -1
  24. package/components/containers/GridRootStyles.d.ts +0 -1
  25. package/components/containers/GridRootStyles.js +19 -2
  26. package/components/containers/GridToolbarContainer.d.ts +1 -1
  27. package/components/panel/GridPanel.d.ts +1 -1
  28. package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
  29. package/components/virtualization/GridMainContainer.d.ts +1 -1
  30. package/components/virtualization/GridVirtualScroller.js +7 -5
  31. package/components/virtualization/GridVirtualScrollerContent.d.ts +1 -1
  32. package/components/virtualization/GridVirtualScrollerRenderZone.d.ts +1 -1
  33. package/constants/defaultGridSlotsComponents.js +2 -1
  34. package/constants/gridClasses.d.ts +14 -0
  35. package/constants/gridClasses.js +1 -1
  36. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -1
  37. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
  38. package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
  39. package/hooks/core/useGridInitialization.d.ts +1 -1
  40. package/hooks/core/useGridLocaleText.d.ts +1 -1
  41. package/hooks/core/useGridLoggerFactory.d.ts +1 -1
  42. package/hooks/features/clipboard/useGridClipboard.d.ts +1 -1
  43. package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -1
  44. package/hooks/features/columnResize/useGridColumnResize.d.ts +1 -1
  45. package/hooks/features/density/useGridDensity.d.ts +1 -1
  46. package/hooks/features/dimensions/useGridDimensions.js +15 -15
  47. package/hooks/features/editing/useGridCellEditing.d.ts +1 -1
  48. package/hooks/features/editing/useGridEditing.d.ts +1 -1
  49. package/hooks/features/editing/useGridRowEditing.d.ts +1 -1
  50. package/hooks/features/export/serializers/csvSerializer.d.ts +0 -1
  51. package/hooks/features/export/useGridCsvExport.d.ts +1 -1
  52. package/hooks/features/export/useGridPrintExport.d.ts +1 -1
  53. package/hooks/features/export/useGridPrintExport.js +9 -8
  54. package/hooks/features/filter/gridFilterUtils.d.ts +1 -1
  55. package/hooks/features/filter/useGridFilter.d.ts +1 -1
  56. package/hooks/features/focus/useGridFocus.d.ts +1 -1
  57. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +1 -1
  58. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
  59. package/hooks/features/overlays/useGridOverlays.d.ts +11 -0
  60. package/hooks/features/overlays/useGridOverlays.js +35 -0
  61. package/hooks/features/pagination/gridPaginationUtils.d.ts +1 -1
  62. package/hooks/features/pagination/index.d.ts +1 -1
  63. package/hooks/features/pagination/useGridPaginationMeta.d.ts +1 -1
  64. package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
  65. package/hooks/features/pagination/useGridRowCount.d.ts +1 -1
  66. package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +1 -1
  67. package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
  68. package/hooks/features/rows/gridRowsInterfaces.d.ts +10 -2
  69. package/hooks/features/rows/gridRowsSelector.d.ts +2 -1
  70. package/hooks/features/rows/gridRowsSelector.js +1 -0
  71. package/hooks/features/rows/gridRowsUtils.d.ts +8 -6
  72. package/hooks/features/rows/gridRowsUtils.js +30 -6
  73. package/hooks/features/rows/useGridRows.d.ts +2 -2
  74. package/hooks/features/rows/useGridRows.js +39 -21
  75. package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
  76. package/hooks/features/scroll/useGridScroll.d.ts +1 -1
  77. package/hooks/features/sorting/useGridSorting.d.ts +1 -1
  78. package/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
  79. package/hooks/utils/index.d.ts +0 -1
  80. package/hooks/utils/index.js +0 -1
  81. package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
  82. package/hooks/utils/useGridApiRef.d.ts +1 -1
  83. package/hooks/utils/useGridInitializeState.d.ts +1 -1
  84. package/hooks/utils/useGridRootProps.d.ts +1 -1
  85. package/hooks/utils/useGridSelector.d.ts +1 -1
  86. package/hooks/utils/useGridVisibleRows.d.ts +2 -2
  87. package/index.js +1 -1
  88. package/internals/index.d.ts +2 -0
  89. package/internals/index.js +1 -0
  90. package/internals/utils/propValidation.js +1 -1
  91. package/models/api/gridApiCommon.d.ts +2 -2
  92. package/models/api/gridInfiniteLoaderApi.d.ts +0 -1
  93. package/models/api/gridRowApi.d.ts +14 -0
  94. package/models/gridColumnGrouping.d.ts +0 -1
  95. package/models/gridDataSource.d.ts +87 -0
  96. package/models/gridDataSource.js +1 -0
  97. package/models/gridRows.d.ts +10 -0
  98. package/models/gridSlotsComponent.d.ts +5 -0
  99. package/models/gridSlotsComponentsProps.d.ts +7 -2
  100. package/models/props/DataGridProps.d.ts +2 -0
  101. package/modern/DataGrid/useDataGridProps.js +9 -2
  102. package/modern/components/GridLoadingOverlay.js +48 -4
  103. package/modern/components/GridRow.js +2 -1
  104. package/modern/components/GridSkeletonLoadingOverlay.js +181 -0
  105. package/modern/components/base/GridOverlays.js +25 -39
  106. package/modern/components/cell/GridSkeletonCell.js +61 -19
  107. package/modern/components/columnHeaders/GridColumnHeaderItem.js +3 -3
  108. package/modern/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
  109. package/modern/components/containers/GridRootStyles.js +19 -2
  110. package/modern/components/virtualization/GridVirtualScroller.js +7 -5
  111. package/modern/constants/defaultGridSlotsComponents.js +2 -1
  112. package/modern/constants/gridClasses.js +1 -1
  113. package/modern/hooks/features/dimensions/useGridDimensions.js +15 -15
  114. package/modern/hooks/features/export/useGridPrintExport.js +9 -8
  115. package/modern/hooks/features/overlays/useGridOverlays.js +35 -0
  116. package/modern/hooks/features/rows/gridRowsSelector.js +1 -0
  117. package/modern/hooks/features/rows/gridRowsUtils.js +30 -6
  118. package/modern/hooks/features/rows/useGridRows.js +39 -21
  119. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
  120. package/modern/hooks/utils/index.js +0 -1
  121. package/modern/index.js +1 -1
  122. package/modern/internals/index.js +1 -0
  123. package/modern/internals/utils/propValidation.js +1 -1
  124. package/modern/models/gridDataSource.js +1 -0
  125. package/modern/utils/utils.js +10 -2
  126. package/node/DataGrid/useDataGridProps.js +9 -2
  127. package/node/components/GridLoadingOverlay.js +48 -4
  128. package/node/components/GridRow.js +2 -1
  129. package/node/components/GridSkeletonLoadingOverlay.js +189 -0
  130. package/node/components/base/GridOverlays.js +25 -39
  131. package/node/components/cell/GridSkeletonCell.js +60 -18
  132. package/node/components/columnHeaders/GridColumnHeaderItem.js +3 -3
  133. package/node/components/columnHeaders/GridColumnHeaderSortIcon.js +11 -6
  134. package/node/components/containers/GridRootStyles.js +19 -2
  135. package/node/components/virtualization/GridVirtualScroller.js +6 -4
  136. package/node/constants/defaultGridSlotsComponents.js +1 -0
  137. package/node/constants/gridClasses.js +1 -1
  138. package/node/hooks/features/dimensions/useGridDimensions.js +15 -15
  139. package/node/hooks/features/export/useGridPrintExport.js +9 -8
  140. package/node/hooks/features/overlays/useGridOverlays.js +42 -0
  141. package/node/hooks/features/rows/gridRowsSelector.js +2 -1
  142. package/node/hooks/features/rows/gridRowsUtils.js +31 -6
  143. package/node/hooks/features/rows/useGridRows.js +37 -19
  144. package/node/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
  145. package/node/hooks/utils/index.js +0 -12
  146. package/node/index.js +1 -1
  147. package/node/internals/index.js +7 -0
  148. package/node/internals/utils/propValidation.js +1 -1
  149. package/node/models/gridDataSource.js +5 -0
  150. package/node/utils/utils.js +11 -3
  151. package/package.json +5 -4
  152. package/utils/cleanupTracking/TimerBasedCleanupTracking.d.ts +0 -1
  153. package/utils/domUtils.d.ts +0 -1
  154. package/utils/getPublicApiRef.d.ts +1 -2
  155. package/utils/keyboardUtils.d.ts +1 -1
  156. package/utils/utils.d.ts +8 -1
  157. package/utils/utils.js +10 -2
  158. package/utils/warning.d.ts +1 -1
  159. package/hooks/utils/useResizeObserver.d.ts +0 -2
  160. package/hooks/utils/useResizeObserver.js +0 -36
  161. package/modern/hooks/utils/useResizeObserver.js +0 -36
  162. 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, 'getRowHeight' | 'getEstimatedRowHeight' | 'getRowSpacing' | 'pagination' | 'paginationMode' | 'rowHeight' | 'rowPositionsDebounceMs'>) => void;
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, 'pagination'>) => void;
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, 'initialState' | 'sortModel' | 'onSortModelChange' | 'sortingOrder' | 'sortingMode' | 'disableColumnSorting' | 'disableMultipleColumnsSorting'>) => void;
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';
@@ -5,5 +5,4 @@ export { useGridSelector } from './useGridSelector';
5
5
  export * from './useGridNativeEventListener';
6
6
  export * from './useFirstRender';
7
7
  export * from './useOnMount';
8
- export * from './useResizeObserver';
9
8
  export * from './useRunOnce';
@@ -5,5 +5,4 @@ export { useGridSelector } from './useGridSelector';
5
5
  export * from './useGridNativeEventListener';
6
6
  export * from './useFirstRender';
7
7
  export * from './useOnMount';
8
- export * from './useResizeObserver';
9
8
  export * from './useRunOnce';
@@ -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<any, any>, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>, options?: EventListenerOptions) => void;
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<any, any>, E extends keyof import("../../models").GridEventLookup>(apiRef: React.MutableRefObject<Api>, eventName: E, handler?: GridEventListener<E>, options?: EventListenerOptions) => void;
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<any, any> = GridApiCommunity>() => React.MutableRefObject<Api>;
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<any>>, PrivateApi extends GridPrivateApiCommon = GridPrivateApiCommunity>(initializer: GridStateInitializer<P, PrivateApi>, privateApiRef: React.MutableRefObject<PrivateApi>, props: P) => void;
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<any>;
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<any, any>, T>(apiRef: React.MutableRefObject<Api>, selector: ((state: Api['state']) => T) | OutputSelector<Api['state'], T>, equals?: (a: T, b: T) => boolean) => T;
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<any, any>>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode'>) => {
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<any, any>>(apiRef: React.MutableRefObject<Api>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode'>) => {
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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.7.1
2
+ * @mui/x-data-grid v7.9.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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';
@@ -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
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export interface GridInfiniteLoaderPrivateApi {
3
2
  getInfiniteLoadingTriggerElement?: ({ lastRowId, }: {
4
3
  lastRowId: string | number;
@@ -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
+ }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { GridColDef } from './colDef';
3
2
  import type { GridColumnGroupHeaderParams } from './params/gridColumnGroupHeaderParams';
4
3
  export interface GridLeafColumn {
@@ -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 {};
@@ -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 { GridRowCountProps } from '../components';
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: GridOverlayProps & LoadingOverlayPropsOverrides;
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
- return React.useMemo(() => _extends({}, DATA_GRID_PROPS_DEFAULT_VALUES, themedProps, {
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
- }, props, {
11
- children: /*#__PURE__*/_jsx(CircularProgress, {})
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
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
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 ?? 'left'
256
+ align: column.align
256
257
  }, column.field);
257
258
  }
258
259
  const editCellState = editRowsState[rowId]?.[column.field] ?? null;