@mui/x-data-grid 7.23.6 → 7.24.1

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 (244) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/DataGrid/DataGrid.js +4 -5
  3. package/DataGrid/useDataGridComponent.d.ts +2 -1
  4. package/DataGrid/useDataGridComponent.js +1 -1
  5. package/components/GridHeaders.js +2 -2
  6. package/components/GridRow.d.ts +5 -9
  7. package/components/GridRow.js +28 -105
  8. package/components/GridSkeletonLoadingOverlay.js +18 -18
  9. package/components/cell/GridCell.d.ts +9 -16
  10. package/components/cell/GridCell.js +17 -35
  11. package/components/columnHeaders/GridColumnGroupHeader.d.ts +5 -5
  12. package/components/columnHeaders/GridColumnGroupHeader.js +7 -10
  13. package/components/columnHeaders/GridColumnHeaderFilterIconButton.d.ts +3 -3
  14. package/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
  15. package/components/columnHeaders/GridColumnHeaderItem.d.ts +5 -5
  16. package/components/columnHeaders/GridColumnHeaderItem.js +13 -12
  17. package/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
  18. package/components/containers/GridRoot.d.ts +2 -2
  19. package/components/containers/GridRoot.js +14 -6
  20. package/components/containers/GridRootStyles.js +1 -0
  21. package/components/panel/GridPanel.js +2 -1
  22. package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +2 -1
  23. package/components/toolbar/GridToolbarColumnsButton.js +6 -1
  24. package/components/toolbar/GridToolbarFilterButton.js +6 -1
  25. package/components/virtualization/GridVirtualScrollbar.js +11 -12
  26. package/components/virtualization/GridVirtualScroller.js +4 -4
  27. package/context/GridContextProvider.d.ts +2 -1
  28. package/hooks/core/pipeProcessing/useGridPipeProcessing.d.ts +2 -2
  29. package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +2 -2
  30. package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +2 -2
  31. package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +2 -2
  32. package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +2 -2
  33. package/hooks/core/useGridApiInitialization.d.ts +2 -2
  34. package/hooks/core/useGridInitialization.d.ts +2 -2
  35. package/hooks/core/useGridIsRtl.d.ts +2 -2
  36. package/hooks/core/useGridLocaleText.d.ts +2 -2
  37. package/hooks/core/useGridLoggerFactory.d.ts +2 -2
  38. package/hooks/core/useGridRefs.d.ts +2 -2
  39. package/hooks/core/useGridStateInitialization.d.ts +2 -2
  40. package/hooks/features/clipboard/useGridClipboard.d.ts +2 -2
  41. package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +2 -2
  42. package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +5 -7
  43. package/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
  44. package/hooks/features/columnMenu/useGridColumnMenu.d.ts +2 -2
  45. package/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
  46. package/hooks/features/columnResize/useGridColumnResize.d.ts +2 -2
  47. package/hooks/features/columnResize/useGridColumnResize.js +4 -2
  48. package/hooks/features/columns/gridColumnsUtils.d.ts +4 -4
  49. package/hooks/features/columns/useGridColumnSpanning.d.ts +2 -2
  50. package/hooks/features/columns/useGridColumns.d.ts +2 -2
  51. package/hooks/features/density/useGridDensity.d.ts +2 -2
  52. package/hooks/features/dimensions/useGridDimensions.d.ts +2 -2
  53. package/hooks/features/dimensions/useGridDimensions.js +1 -3
  54. package/hooks/features/editing/useGridCellEditing.d.ts +2 -2
  55. package/hooks/features/editing/useGridEditing.d.ts +2 -2
  56. package/hooks/features/editing/useGridRowEditing.d.ts +2 -2
  57. package/hooks/features/events/useGridEvents.d.ts +2 -2
  58. package/hooks/features/export/serializers/csvSerializer.d.ts +2 -1
  59. package/hooks/features/export/useGridCsvExport.d.ts +2 -2
  60. package/hooks/features/export/useGridPrintExport.d.ts +2 -2
  61. package/hooks/features/export/utils.d.ts +2 -2
  62. package/hooks/features/filter/gridFilterSelector.js +6 -1
  63. package/hooks/features/filter/gridFilterUtils.d.ts +7 -7
  64. package/hooks/features/filter/gridFilterUtils.js +3 -3
  65. package/hooks/features/filter/useGridFilter.d.ts +2 -2
  66. package/hooks/features/focus/useGridFocus.d.ts +2 -2
  67. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
  68. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
  69. package/hooks/features/keyboardNavigation/utils.d.ts +3 -3
  70. package/hooks/features/listView/useGridListView.d.ts +2 -2
  71. package/hooks/features/pagination/gridPaginationInterfaces.d.ts +3 -0
  72. package/hooks/features/pagination/gridPaginationSelector.d.ts +20 -1
  73. package/hooks/features/pagination/gridPaginationSelector.js +39 -1
  74. package/hooks/features/pagination/useGridPagination.d.ts +3 -3
  75. package/hooks/features/pagination/useGridPagination.js +5 -3
  76. package/hooks/features/pagination/useGridPaginationMeta.d.ts +2 -2
  77. package/hooks/features/pagination/useGridPaginationModel.d.ts +2 -2
  78. package/hooks/features/pagination/useGridPaginationModel.js +23 -1
  79. package/hooks/features/pagination/useGridRowCount.d.ts +2 -2
  80. package/hooks/features/preferencesPanel/gridPreferencePanelSelector.d.ts +1 -0
  81. package/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
  82. package/hooks/features/preferencesPanel/index.d.ts +1 -1
  83. package/hooks/features/preferencesPanel/index.js +1 -1
  84. package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +2 -2
  85. package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
  86. package/hooks/features/rowSelection/useGridRowSelection.d.ts +2 -2
  87. package/hooks/features/rowSelection/useGridRowSelectionPreProcessors.d.ts +2 -2
  88. package/hooks/features/rowSelection/utils.d.ts +3 -2
  89. package/hooks/features/rows/gridRowSpanningUtils.d.ts +2 -2
  90. package/hooks/features/rows/gridRowsSelector.js +1 -1
  91. package/hooks/features/rows/gridRowsUtils.d.ts +4 -4
  92. package/hooks/features/rows/useGridParamsApi.d.ts +2 -2
  93. package/hooks/features/rows/useGridRowSpanning.d.ts +2 -2
  94. package/hooks/features/rows/useGridRows.d.ts +2 -2
  95. package/hooks/features/rows/useGridRows.js +2 -2
  96. package/hooks/features/rows/useGridRowsMeta.d.ts +2 -2
  97. package/hooks/features/rows/useGridRowsPreProcessors.d.ts +2 -2
  98. package/hooks/features/scroll/useGridScroll.d.ts +2 -2
  99. package/hooks/features/sorting/gridSortingUtils.d.ts +3 -3
  100. package/hooks/features/sorting/gridSortingUtils.js +2 -2
  101. package/hooks/features/sorting/useGridSorting.d.ts +2 -2
  102. package/hooks/features/statePersistence/useGridStatePersistence.d.ts +2 -2
  103. package/hooks/features/virtualization/gridFocusedVirtualCellSelector.d.ts +6 -0
  104. package/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
  105. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -1
  106. package/hooks/features/virtualization/useGridVirtualScroller.js +92 -50
  107. package/hooks/features/virtualization/useGridVirtualization.d.ts +2 -2
  108. package/hooks/utils/useGridApiContext.d.ts +2 -2
  109. package/hooks/utils/useGridApiEventHandler.d.ts +4 -4
  110. package/hooks/utils/useGridApiMethod.d.ts +2 -2
  111. package/hooks/utils/useGridApiRef.d.ts +2 -2
  112. package/hooks/utils/useGridApiRef.js +3 -1
  113. package/hooks/utils/useGridInitializeState.d.ts +3 -3
  114. package/hooks/utils/useGridLogger.d.ts +2 -2
  115. package/hooks/utils/useGridNativeEventListener.d.ts +2 -1
  116. package/hooks/utils/useGridPrivateApiContext.d.ts +2 -1
  117. package/hooks/utils/useGridSelector.d.ts +3 -3
  118. package/hooks/utils/useGridVisibleRows.d.ts +8 -6
  119. package/hooks/utils/useGridVisibleRows.js +5 -28
  120. package/index.js +1 -1
  121. package/internals/constants.d.ts +6 -0
  122. package/internals/constants.js +8 -1
  123. package/internals/index.d.ts +1 -0
  124. package/internals/index.js +1 -0
  125. package/internals/utils/attachPinnedStyle.d.ts +2 -0
  126. package/internals/utils/attachPinnedStyle.js +9 -0
  127. package/internals/utils/getPinnedCellOffset.d.ts +3 -3
  128. package/internals/utils/getPinnedCellOffset.js +6 -7
  129. package/internals/utils/index.d.ts +1 -0
  130. package/internals/utils/index.js +2 -1
  131. package/locales/faIR.js +5 -6
  132. package/locales/urPK.js +9 -10
  133. package/models/colDef/gridColDef.d.ts +9 -8
  134. package/models/events/gridEventLookup.d.ts +6 -1
  135. package/models/gridExport.d.ts +2 -2
  136. package/models/gridFilterOperator.d.ts +2 -1
  137. package/models/gridStateCommunity.d.ts +4 -0
  138. package/models/props/DataGridProps.d.ts +2 -1
  139. package/modern/DataGrid/DataGrid.js +4 -5
  140. package/modern/DataGrid/useDataGridComponent.js +1 -1
  141. package/modern/components/GridHeaders.js +2 -2
  142. package/modern/components/GridRow.js +28 -105
  143. package/modern/components/GridSkeletonLoadingOverlay.js +18 -18
  144. package/modern/components/cell/GridCell.js +17 -35
  145. package/modern/components/columnHeaders/GridColumnGroupHeader.js +7 -10
  146. package/modern/components/columnHeaders/GridColumnHeaderFilterIconButton.js +21 -7
  147. package/modern/components/columnHeaders/GridColumnHeaderItem.js +13 -12
  148. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -2
  149. package/modern/components/containers/GridRoot.js +14 -6
  150. package/modern/components/containers/GridRootStyles.js +1 -0
  151. package/modern/components/panel/GridPanel.js +2 -1
  152. package/modern/components/toolbar/GridToolbarColumnsButton.js +6 -1
  153. package/modern/components/toolbar/GridToolbarFilterButton.js +6 -1
  154. package/modern/components/virtualization/GridVirtualScrollbar.js +11 -12
  155. package/modern/components/virtualization/GridVirtualScroller.js +4 -4
  156. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +34 -76
  157. package/modern/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
  158. package/modern/hooks/features/columnResize/useGridColumnResize.js +4 -2
  159. package/modern/hooks/features/dimensions/useGridDimensions.js +1 -3
  160. package/modern/hooks/features/filter/gridFilterSelector.js +6 -1
  161. package/modern/hooks/features/filter/gridFilterUtils.js +3 -3
  162. package/modern/hooks/features/pagination/gridPaginationSelector.js +39 -1
  163. package/modern/hooks/features/pagination/useGridPagination.js +5 -3
  164. package/modern/hooks/features/pagination/useGridPaginationModel.js +23 -1
  165. package/modern/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +8 -1
  166. package/modern/hooks/features/preferencesPanel/index.js +1 -1
  167. package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
  168. package/modern/hooks/features/rows/gridRowsSelector.js +1 -1
  169. package/modern/hooks/features/rows/useGridRows.js +2 -2
  170. package/modern/hooks/features/sorting/gridSortingUtils.js +2 -2
  171. package/modern/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +42 -0
  172. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +92 -50
  173. package/modern/hooks/utils/useGridApiRef.js +3 -1
  174. package/modern/hooks/utils/useGridVisibleRows.js +5 -28
  175. package/modern/index.js +1 -1
  176. package/modern/internals/constants.js +8 -1
  177. package/modern/internals/index.js +1 -0
  178. package/modern/internals/utils/attachPinnedStyle.js +9 -0
  179. package/modern/internals/utils/getPinnedCellOffset.js +6 -7
  180. package/modern/internals/utils/index.js +2 -1
  181. package/modern/locales/faIR.js +5 -6
  182. package/modern/locales/urPK.js +9 -10
  183. package/modern/utils/cellBorderUtils.js +5 -5
  184. package/modern/utils/domUtils.js +7 -2
  185. package/modern/utils/isJSDOM.js +1 -0
  186. package/modern/utils/rtlFlipSide.js +22 -0
  187. package/node/DataGrid/DataGrid.js +2 -3
  188. package/node/DataGrid/useDataGridComponent.js +1 -1
  189. package/node/components/GridHeaders.js +2 -2
  190. package/node/components/GridRow.js +27 -104
  191. package/node/components/GridSkeletonLoadingOverlay.js +17 -17
  192. package/node/components/cell/GridCell.js +18 -36
  193. package/node/components/columnHeaders/GridColumnGroupHeader.js +7 -10
  194. package/node/components/columnHeaders/GridColumnHeaderFilterIconButton.js +20 -6
  195. package/node/components/columnHeaders/GridColumnHeaderItem.js +13 -12
  196. package/node/components/columnSelection/GridCellCheckboxRenderer.js +1 -1
  197. package/node/components/containers/GridRoot.js +14 -6
  198. package/node/components/containers/GridRootStyles.js +1 -0
  199. package/node/components/panel/GridPanel.js +2 -1
  200. package/node/components/toolbar/GridToolbarColumnsButton.js +6 -1
  201. package/node/components/toolbar/GridToolbarFilterButton.js +6 -1
  202. package/node/components/virtualization/GridVirtualScrollbar.js +11 -12
  203. package/node/components/virtualization/GridVirtualScroller.js +4 -4
  204. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +32 -74
  205. package/node/hooks/features/columnMenu/useGridColumnMenu.js +0 -2
  206. package/node/hooks/features/columnResize/useGridColumnResize.js +4 -2
  207. package/node/hooks/features/dimensions/useGridDimensions.js +3 -5
  208. package/node/hooks/features/filter/gridFilterSelector.js +6 -1
  209. package/node/hooks/features/filter/gridFilterUtils.js +3 -3
  210. package/node/hooks/features/pagination/gridPaginationSelector.js +41 -3
  211. package/node/hooks/features/pagination/useGridPagination.js +5 -3
  212. package/node/hooks/features/pagination/useGridPaginationModel.js +23 -1
  213. package/node/hooks/features/preferencesPanel/gridPreferencePanelSelector.js +9 -2
  214. package/node/hooks/features/preferencesPanel/index.js +11 -10
  215. package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +14 -38
  216. package/node/hooks/features/rows/gridRowsSelector.js +1 -1
  217. package/node/hooks/features/rows/useGridRows.js +1 -1
  218. package/node/hooks/features/sorting/gridSortingUtils.js +2 -2
  219. package/node/hooks/features/virtualization/gridFocusedVirtualCellSelector.js +49 -0
  220. package/node/hooks/features/virtualization/useGridVirtualScroller.js +94 -52
  221. package/node/hooks/utils/useGridApiRef.js +3 -1
  222. package/node/hooks/utils/useGridVisibleRows.js +3 -28
  223. package/node/index.js +1 -1
  224. package/node/internals/constants.js +9 -2
  225. package/node/internals/index.js +12 -0
  226. package/node/internals/utils/attachPinnedStyle.js +15 -0
  227. package/node/internals/utils/getPinnedCellOffset.js +6 -7
  228. package/node/internals/utils/index.js +11 -0
  229. package/node/locales/faIR.js +5 -6
  230. package/node/locales/urPK.js +9 -10
  231. package/node/utils/cellBorderUtils.js +5 -5
  232. package/node/utils/domUtils.js +7 -2
  233. package/node/utils/isJSDOM.js +7 -0
  234. package/node/utils/rtlFlipSide.js +29 -0
  235. package/package.json +2 -2
  236. package/utils/cellBorderUtils.d.ts +3 -3
  237. package/utils/cellBorderUtils.js +5 -5
  238. package/utils/createSelector.d.ts +3 -3
  239. package/utils/domUtils.js +7 -2
  240. package/utils/getPublicApiRef.d.ts +2 -1
  241. package/utils/isJSDOM.d.ts +1 -0
  242. package/utils/isJSDOM.js +1 -0
  243. package/utils/rtlFlipSide.d.ts +2 -0
  244. package/utils/rtlFlipSide.js +22 -0
@@ -1,3 +1,4 @@
1
+ import { RefObject } from '@mui/x-internals/types';
1
2
  import type { GridCsvExportOptions, GridRowId } from '../../../../models';
2
3
  import type { GridCellParams } from '../../../../models/params/gridCellParams';
3
4
  import type { GridStateColDef } from '../../../../models/colDef/gridColDef';
@@ -12,7 +13,7 @@ interface BuildCSVOptions {
12
13
  rowIds: GridRowId[];
13
14
  csvOptions: Required<Pick<GridCsvExportOptions, 'delimiter' | 'includeColumnGroupsHeaders' | 'includeHeaders' | 'shouldAppendQuotes' | 'escapeFormulas'>>;
14
15
  ignoreValueFormatter: boolean;
15
- apiRef: React.MutableRefObject<GridApiCommunity>;
16
+ apiRef: RefObject<GridApiCommunity>;
16
17
  }
17
18
  export declare function buildCSV(options: BuildCSVOptions): string;
18
19
  export {};
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import type { DataGridProcessedProps } from '../../../models/props/DataGridProps';
4
4
  /**
@@ -8,4 +8,4 @@ import type { DataGridProcessedProps } from '../../../models/props/DataGridProps
8
8
  * @requires useGridSelection (state)
9
9
  * @requires useGridParamsApi (method)
10
10
  */
11
- export declare const useGridCsvExport: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "ignoreValueFormatterDuringExport">) => void;
11
+ export declare const useGridCsvExport: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "ignoreValueFormatterDuringExport">) => void;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
4
4
  /**
@@ -7,4 +7,4 @@ import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
7
7
  * @requires useGridSorting (state)
8
8
  * @requires useGridParamsApi (method)
9
9
  */
10
- export declare const useGridPrintExport: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "columnHeaderHeight" | "headerFilterHeight">) => void;
10
+ export declare const useGridPrintExport: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "columnHeaderHeight" | "headerFilterHeight">) => void;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { GridExportOptions, GridCsvGetRowsToExportParams } from '../../../models/gridExport';
4
4
  import { GridStateColDef } from '../../../models/colDef/gridColDef';
@@ -7,7 +7,7 @@ interface GridGetColumnsToExportParams {
7
7
  /**
8
8
  * The API of the grid.
9
9
  */
10
- apiRef: React.MutableRefObject<GridApiCommunity>;
10
+ apiRef: RefObject<GridApiCommunity>;
11
11
  options: GridExportOptions;
12
12
  }
13
13
  export declare const getColumnsToExport: ({ apiRef, options, }: GridGetColumnsToExportParams) => GridStateColDef[];
@@ -49,7 +49,12 @@ export const gridFilteredDescendantCountLookupSelector = createSelector(gridFilt
49
49
  * Does not contain the collapsed children.
50
50
  * @category Filtering
51
51
  */
52
- export const gridExpandedSortedRowEntriesSelector = createSelectorMemoized(gridVisibleRowsLookupSelector, gridSortedRowEntriesSelector, (visibleRowsLookup, sortedRows) => sortedRows.filter(row => visibleRowsLookup[row.id] !== false));
52
+ export const gridExpandedSortedRowEntriesSelector = createSelectorMemoized(gridVisibleRowsLookupSelector, gridSortedRowEntriesSelector, gridRowMaximumTreeDepthSelector, gridFilterModelSelector, gridQuickFilterValuesSelector, (visibleRowsLookup, sortedRows, maxDepth, filterModel, quickFilterValues) => {
53
+ if (maxDepth < 2 && !filterModel.items.length && !quickFilterValues?.length) {
54
+ return sortedRows;
55
+ }
56
+ return sortedRows.filter(row => visibleRowsLookup[row.id] !== false);
57
+ });
53
58
 
54
59
  /**
55
60
  * Get the id of the rows accessible after the filtering process.
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridFilterItem, GridFilterModel } from '../../../models';
3
3
  import type { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
4
4
  import { GridStateCommunity } from '../../../models/gridStateCommunity';
@@ -6,18 +6,18 @@ import { GridAggregatedFilterItemApplier, GridFilterItemResult, GridQuickFilterV
6
6
  /**
7
7
  * Adds default values to the optional fields of a filter items.
8
8
  * @param {GridFilterItem} item The raw filter item.
9
- * @param {React.MutableRefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
9
+ * @param {RefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
10
10
  * @return {GridFilterItem} The clean filter item with an uniq ID and an always-defined operator.
11
11
  * TODO: Make the typing reflect the different between GridFilterInputItem and GridFilterItem.
12
12
  */
13
- export declare const cleanFilterItem: (item: GridFilterItem, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => GridFilterItem;
14
- export declare const sanitizeFilterModel: (model: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => GridFilterModel;
15
- export declare const mergeStateWithFilterModel: (filterModel: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => (filteringState: GridStateCommunity["filter"]) => GridStateCommunity["filter"];
13
+ export declare const cleanFilterItem: (item: GridFilterItem, apiRef: RefObject<GridPrivateApiCommunity>) => GridFilterItem;
14
+ export declare const sanitizeFilterModel: (model: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: RefObject<GridPrivateApiCommunity>) => GridFilterModel;
15
+ export declare const mergeStateWithFilterModel: (filterModel: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: RefObject<GridPrivateApiCommunity>) => (filteringState: GridStateCommunity["filter"]) => GridStateCommunity["filter"];
16
16
  export declare const removeDiacritics: (value: unknown) => unknown;
17
17
  export declare const shouldQuickFilterExcludeHiddenColumns: (filterModel: GridFilterModel) => boolean;
18
- export declare const buildAggregatedFilterApplier: (filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridPrivateApiCommunity>, disableEval: boolean) => GridAggregatedFilterItemApplier;
18
+ export declare const buildAggregatedFilterApplier: (filterModel: GridFilterModel, apiRef: RefObject<GridPrivateApiCommunity>, disableEval: boolean) => GridAggregatedFilterItemApplier;
19
19
  type FilterCache = {
20
20
  cleanedFilterItems?: GridFilterItem[];
21
21
  };
22
- export declare const passFilterLogic: (allFilterItemResults: (null | GridFilterItemResult)[], allQuickFilterResults: (null | GridQuickFilterValueResult)[], filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridPrivateApiCommunity>, cache: FilterCache) => boolean;
22
+ export declare const passFilterLogic: (allFilterItemResults: (null | GridFilterItemResult)[], allQuickFilterResults: (null | GridQuickFilterValueResult)[], filterModel: GridFilterModel, apiRef: RefObject<GridPrivateApiCommunity>, cache: FilterCache) => boolean;
23
23
  export {};
@@ -19,7 +19,7 @@ function getHasEval() {
19
19
  /**
20
20
  * Adds default values to the optional fields of a filter items.
21
21
  * @param {GridFilterItem} item The raw filter item.
22
- * @param {React.MutableRefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
22
+ * @param {RefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
23
23
  * @return {GridFilterItem} The clean filter item with an uniq ID and an always-defined operator.
24
24
  * TODO: Make the typing reflect the different between GridFilterInputItem and GridFilterItem.
25
25
  */
@@ -133,7 +133,7 @@ let filterItemsApplierId = 1;
133
133
  /**
134
134
  * Generates a method to easily check if a row is matching the current filter model.
135
135
  * @param {GridFilterModel} filterModel The model with which we want to filter the rows.
136
- * @param {React.MutableRefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
136
+ * @param {RefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
137
137
  * @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
138
138
  */
139
139
  const buildAggregatedFilterItemsApplier = (filterModel, apiRef, disableEval) => {
@@ -181,7 +181,7 @@ export const shouldQuickFilterExcludeHiddenColumns = filterModel => {
181
181
  /**
182
182
  * Generates a method to easily check if a row is matching the current quick filter.
183
183
  * @param {any[]} filterModel The model with which we want to filter the rows.
184
- * @param {React.MutableRefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
184
+ * @param {RefObject<GridPrivateApiCommunity>} apiRef The API of the grid.
185
185
  * @returns {GridAggregatedFilterItemApplier | null} A method that checks if a row is matching the current filter model. If `null`, we consider that all the rows are matching the filters.
186
186
  */
187
187
  const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
3
3
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
4
4
  import { GridStateInitializer } from '../../utils/useGridInitializeState';
@@ -8,4 +8,4 @@ export declare const filterStateInitializer: GridStateInitializer<Pick<DataGridP
8
8
  * @requires useGridParamsApi (method)
9
9
  * @requires useGridRows (event)
10
10
  */
11
- export declare const useGridFilter: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rows" | "initialState" | "filterModel" | "getRowId" | "onFilterModelChange" | "filterMode" | "disableMultipleColumnsFiltering" | "slots" | "slotProps" | "disableColumnFilter" | "disableEval" | "ignoreDiacritics">) => void;
11
+ export declare const useGridFilter: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rows" | "initialState" | "filterModel" | "getRowId" | "onFilterModelChange" | "filterMode" | "disableMultipleColumnsFiltering" | "slots" | "slotProps" | "disableColumnFilter" | "disableEval" | "ignoreDiacritics">) => void;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
4
4
  import { GridStateInitializer } from '../../utils/useGridInitializeState';
@@ -8,4 +8,4 @@ export declare const focusStateInitializer: GridStateInitializer;
8
8
  * @requires useGridRows (method)
9
9
  * @requires useGridEditing (event)
10
10
  */
11
- export declare const useGridFocus: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => void;
11
+ export declare const useGridFocus: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode">) => void;
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
4
4
  import { GridStateInitializer } from '../../utils/useGridInitializeState';
5
5
  export declare const headerFilteringStateInitializer: GridStateInitializer;
6
- export declare const useGridHeaderFiltering: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "signature" | "headerFilters">) => void;
6
+ export declare const useGridHeaderFiltering: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "signature" | "headerFilters">) => void;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
4
4
  /**
@@ -10,4 +10,4 @@ import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
10
10
  * @requires useGridScroll (method) - can be after
11
11
  * @requires useGridColumnSpanning (method) - can be after
12
12
  */
13
- export declare const useGridKeyboardNavigation: (apiRef: React.RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode" | "getRowId" | "experimentalFeatures" | "signature" | "headerFilters" | "unstable_listView">) => void;
13
+ export declare const useGridKeyboardNavigation: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "pagination" | "paginationMode" | "getRowId" | "experimentalFeatures" | "signature" | "headerFilters" | "unstable_listView">) => void;
@@ -1,7 +1,7 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridColDef, GridRowEntry, GridRowId } from '../../../models';
3
3
  import { GridApiCommunity } from '../../../models/api/gridApiCommunity';
4
- export declare function enrichPageRowsWithPinnedRows(apiRef: React.MutableRefObject<GridApiCommunity>, rows: GridRowEntry[]): GridRowEntry<import("../../..").GridValidRowModel>[];
4
+ export declare function enrichPageRowsWithPinnedRows(apiRef: RefObject<GridApiCommunity>, rows: GridRowEntry[]): GridRowEntry<import("../../..").GridValidRowModel>[];
5
5
  export declare const getLeftColumnIndex: ({ currentColIndex, firstColIndex, lastColIndex, isRtl, }: {
6
6
  currentColIndex: number;
7
7
  firstColIndex: number;
@@ -14,4 +14,4 @@ export declare const getRightColumnIndex: ({ currentColIndex, firstColIndex, las
14
14
  lastColIndex: number;
15
15
  isRtl: boolean;
16
16
  }) => number | null;
17
- export declare function findNonRowSpannedCell(apiRef: React.MutableRefObject<GridApiCommunity>, rowId: GridRowId, field: GridColDef['field'], rowSpanScanDirection: 'up' | 'down'): GridRowId;
17
+ export declare function findNonRowSpannedCell(apiRef: RefObject<GridApiCommunity>, rowId: GridRowId, field: GridColDef['field'], rowSpanScanDirection: 'up' | 'down'): GridRowId;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import type { GridListColDef } from '../../../models/colDef/gridColDef';
3
3
  import { GridStateInitializer } from '../../utils/useGridInitializeState';
4
4
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
@@ -7,4 +7,4 @@ export type GridListViewState = (GridListColDef & {
7
7
  computedWidth: number;
8
8
  }) | undefined;
9
9
  export declare const listViewStateInitializer: GridStateInitializer<Pick<DataGridProcessedProps, 'unstable_listColumn'>>;
10
- export declare function useGridListView(apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'unstable_listView' | 'unstable_listColumn'>): void;
10
+ export declare function useGridListView(apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'unstable_listView' | 'unstable_listColumn'>): void;
@@ -1,8 +1,11 @@
1
+ import { GridFeatureMode } from '../../../models/gridFeatureMode';
1
2
  import { GridPaginationMeta, GridPaginationModel } from '../../../models/gridPaginationProps';
2
3
  export interface GridPaginationState {
3
4
  paginationModel: GridPaginationModel;
4
5
  rowCount: number;
5
6
  meta: GridPaginationMeta;
7
+ enabled: boolean;
8
+ paginationMode: GridFeatureMode;
6
9
  }
7
10
  export interface GridPaginationInitialState {
8
11
  paginationModel?: Partial<GridPaginationModel>;
@@ -1,9 +1,15 @@
1
1
  import { GridStateCommunity } from '../../../models/gridStateCommunity';
2
+ import { GridValidRowModel } from '../../../models/gridRows';
2
3
  /**
3
4
  * @category Pagination
4
5
  * @ignore - do not document.
5
6
  */
6
7
  export declare const gridPaginationSelector: (state: GridStateCommunity) => import("./gridPaginationInterfaces").GridPaginationState;
8
+ /**
9
+ * @category Pagination
10
+ * @ignore - do not document.
11
+ */
12
+ export declare const gridPaginationEnabledClientSideSelector: import("../../..").OutputSelector<GridStateCommunity, boolean>;
7
13
  /**
8
14
  * Get the pagination model
9
15
  * @category Pagination
@@ -46,9 +52,22 @@ export declare const gridPaginationRowRangeSelector: import("../../..").OutputSe
46
52
  * Get the id and the model of each row to include in the current page if the pagination is enabled.
47
53
  * @category Pagination
48
54
  */
49
- export declare const gridPaginatedVisibleSortedGridRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<import("../../..").GridValidRowModel>[]>;
55
+ export declare const gridPaginatedVisibleSortedGridRowEntriesSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowEntry<GridValidRowModel>[]>;
50
56
  /**
51
57
  * Get the id of each row to include in the current page if the pagination is enabled.
52
58
  * @category Pagination
53
59
  */
54
60
  export declare const gridPaginatedVisibleSortedGridRowIdsSelector: import("../../..").OutputSelector<GridStateCommunity, import("../../..").GridRowId[]>;
61
+ /**
62
+ * Get the rows, range and rowIndex lookup map after filtering and sorting.
63
+ * Does not contain the collapsed children.
64
+ * @category Pagination
65
+ */
66
+ export declare const gridVisibleRowsSelector: import("../../..").OutputSelector<GridStateCommunity, {
67
+ rows: import("../../..").GridRowEntry<GridValidRowModel>[];
68
+ range: {
69
+ firstRowIndex: number;
70
+ lastRowIndex: number;
71
+ } | null;
72
+ rowToIndexMap: Map<GridValidRowModel, number>;
73
+ }>;
@@ -10,6 +10,12 @@ const ALL_RESULTS_PAGE_VALUE = -1;
10
10
  */
11
11
  export const gridPaginationSelector = state => state.pagination;
12
12
 
13
+ /**
14
+ * @category Pagination
15
+ * @ignore - do not document.
16
+ */
17
+ export const gridPaginationEnabledClientSideSelector = createSelector(gridPaginationSelector, pagination => pagination.enabled && pagination.paginationMode === 'client');
18
+
13
19
  /**
14
20
  * Get the pagination model
15
21
  * @category Pagination
@@ -50,7 +56,10 @@ export const gridPageCountSelector = createSelector(gridPaginationModelSelector,
50
56
  * Get the index of the first and the last row to include in the current page if the pagination is enabled.
51
57
  * @category Pagination
52
58
  */
53
- export const gridPaginationRowRangeSelector = createSelectorMemoized(gridPaginationModelSelector, gridRowTreeSelector, gridRowMaximumTreeDepthSelector, gridExpandedSortedRowEntriesSelector, gridFilteredSortedTopLevelRowEntriesSelector, (paginationModel, rowTree, rowTreeDepth, visibleSortedRowEntries, visibleSortedTopLevelRowEntries) => {
59
+ export const gridPaginationRowRangeSelector = createSelectorMemoized(gridPaginationEnabledClientSideSelector, gridPaginationModelSelector, gridRowTreeSelector, gridRowMaximumTreeDepthSelector, gridExpandedSortedRowEntriesSelector, gridFilteredSortedTopLevelRowEntriesSelector, (clientSidePaginationEnabled, paginationModel, rowTree, rowTreeDepth, visibleSortedRowEntries, visibleSortedTopLevelRowEntries) => {
60
+ if (!clientSidePaginationEnabled) {
61
+ return null;
62
+ }
54
63
  const visibleTopLevelRowCount = visibleSortedTopLevelRowEntries.length;
55
64
  const topLevelFirstRowIndex = Math.min(paginationModel.pageSize * paginationModel.page, visibleTopLevelRowCount - 1);
56
65
  const topLevelLastRowIndex = paginationModel.pageSize === ALL_RESULTS_PAGE_VALUE ? visibleTopLevelRowCount - 1 : Math.min(topLevelFirstRowIndex + paginationModel.pageSize - 1, visibleTopLevelRowCount - 1);
@@ -112,4 +121,33 @@ export const gridPaginatedVisibleSortedGridRowIdsSelector = createSelectorMemoiz
112
121
  return [];
113
122
  }
114
123
  return visibleSortedRowIds.slice(paginationRange.firstRowIndex, paginationRange.lastRowIndex + 1);
124
+ });
125
+
126
+ /**
127
+ * Get the rows, range and rowIndex lookup map after filtering and sorting.
128
+ * Does not contain the collapsed children.
129
+ * @category Pagination
130
+ */
131
+ export const gridVisibleRowsSelector = createSelectorMemoized(gridPaginationEnabledClientSideSelector, gridPaginationRowRangeSelector, gridPaginatedVisibleSortedGridRowEntriesSelector, gridExpandedSortedRowEntriesSelector, (clientPaginationEnabled, paginationRowRange, paginationRows, expandedSortedRowEntries) => {
132
+ if (clientPaginationEnabled) {
133
+ return {
134
+ rows: paginationRows,
135
+ range: paginationRowRange,
136
+ rowToIndexMap: paginationRows.reduce((lookup, row, index) => {
137
+ lookup.set(row.model, index);
138
+ return lookup;
139
+ }, new Map())
140
+ };
141
+ }
142
+ return {
143
+ rows: expandedSortedRowEntries,
144
+ range: expandedSortedRowEntries.length === 0 ? null : {
145
+ firstRowIndex: 0,
146
+ lastRowIndex: expandedSortedRowEntries.length - 1
147
+ },
148
+ rowToIndexMap: expandedSortedRowEntries.reduce((lookup, row, index) => {
149
+ lookup.set(row.model, index);
150
+ return lookup;
151
+ }, new Map())
152
+ };
115
153
  });
@@ -1,10 +1,10 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
4
4
  import { GridStateInitializer } from '../../utils/useGridInitializeState';
5
- export declare const paginationStateInitializer: GridStateInitializer<Pick<DataGridProcessedProps, 'paginationModel' | 'rowCount' | 'initialState' | 'autoPageSize' | 'signature' | 'paginationMeta'>>;
5
+ export declare const paginationStateInitializer: GridStateInitializer<Pick<DataGridProcessedProps, 'paginationModel' | 'rowCount' | 'initialState' | 'autoPageSize' | 'signature' | 'paginationMeta' | 'pagination' | 'paginationMode'>>;
6
6
  /**
7
7
  * @requires useGridFilter (state)
8
8
  * @requires useGridDimensions (event) - can be after
9
9
  */
10
- export declare const useGridPagination: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: DataGridProcessedProps) => void;
10
+ export declare const useGridPagination: (apiRef: RefObject<GridPrivateApiCommunity>, props: DataGridProcessedProps) => void;
@@ -9,11 +9,13 @@ export const paginationStateInitializer = (state, props) => {
9
9
  const rowCount = props.rowCount ?? props.initialState?.pagination?.rowCount;
10
10
  const meta = props.paginationMeta ?? props.initialState?.pagination?.meta ?? {};
11
11
  return _extends({}, state, {
12
- pagination: {
12
+ pagination: _extends({}, state.pagination, {
13
13
  paginationModel,
14
14
  rowCount,
15
- meta
16
- }
15
+ meta,
16
+ enabled: props.pagination === true,
17
+ paginationMode: props.paginationMode
18
+ })
17
19
  });
18
20
  };
19
21
 
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
4
- export declare const useGridPaginationMeta: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "paginationMeta" | "initialState" | "paginationMode" | "onPaginationMetaChange">) => void;
4
+ export declare const useGridPaginationMeta: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "paginationMeta" | "initialState" | "paginationMode" | "onPaginationMetaChange">) => void;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
4
4
  import { GridPaginationState } from './gridPaginationInterfaces';
@@ -8,4 +8,4 @@ export declare const getDerivedPaginationModel: (paginationState: GridPagination
8
8
  * @requires useGridFilter (state)
9
9
  * @requires useGridDimensions (event) - can be after
10
10
  */
11
- export declare const useGridPaginationModel: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "paginationModel" | "onPaginationModelChange" | "autoPageSize" | "initialState" | "paginationMode" | "signature" | "rowHeight">) => void;
11
+ export declare const useGridPaginationModel: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "paginationModel" | "onPaginationModelChange" | "autoPageSize" | "initialState" | "paginationMode" | "pagination" | "signature" | "rowHeight">) => void;
@@ -155,12 +155,34 @@ export const useGridPaginationModel = (apiRef, props) => {
155
155
  /**
156
156
  * EFFECTS
157
157
  */
158
+ const isFirstRender = React.useRef(true);
158
159
  React.useEffect(() => {
160
+ if (isFirstRender.current) {
161
+ isFirstRender.current = false;
162
+ return;
163
+ }
164
+ if (!props.pagination) {
165
+ return;
166
+ }
159
167
  apiRef.current.setState(state => _extends({}, state, {
160
168
  pagination: _extends({}, state.pagination, {
161
169
  paginationModel: getDerivedPaginationModel(state.pagination, props.signature, props.paginationModel)
162
170
  })
163
171
  }));
164
- }, [apiRef, props.paginationModel, props.paginationMode, props.signature]);
172
+ }, [apiRef, props.paginationModel, props.signature, props.pagination]);
173
+ React.useEffect(() => {
174
+ apiRef.current.setState(state => {
175
+ const isEnabled = props.pagination === true;
176
+ if (state.pagination.paginationMode === props.paginationMode || state.pagination.enabled === isEnabled) {
177
+ return state;
178
+ }
179
+ return _extends({}, state, {
180
+ pagination: _extends({}, state.pagination, {
181
+ paginationMode: props.paginationMode,
182
+ enabled: props.pagination === true
183
+ })
184
+ });
185
+ });
186
+ }, [apiRef, props.paginationMode, props.pagination]);
165
187
  React.useEffect(handleUpdateAutoPageSize, [handleUpdateAutoPageSize]);
166
188
  };
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
4
- export declare const useGridRowCount: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rowCount" | "initialState" | "paginationMode" | "onRowCountChange">) => void;
4
+ export declare const useGridRowCount: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "rowCount" | "initialState" | "paginationMode" | "onRowCountChange">) => void;
@@ -1,2 +1,3 @@
1
1
  import { GridStateCommunity } from '../../../models/gridStateCommunity';
2
2
  export declare const gridPreferencePanelStateSelector: (state: GridStateCommunity) => import("./gridPreferencePanelState").GridPreferencePanelState;
3
+ export declare const gridPreferencePanelSelectorWithLabel: import("../../../utils/createSelector").OutputSelectorV8<GridStateCommunity, string, boolean>;
@@ -1 +1,8 @@
1
- export const gridPreferencePanelStateSelector = state => state.preferencePanel;
1
+ import { createSelectorV8 } from "../../../utils/createSelector.js";
2
+ export const gridPreferencePanelStateSelector = state => state.preferencePanel;
3
+ export const gridPreferencePanelSelectorWithLabel = createSelectorV8(gridPreferencePanelStateSelector, (panel, labelId) => {
4
+ if (panel.open && panel.labelId === labelId) {
5
+ return true;
6
+ }
7
+ return false;
8
+ });
@@ -1,3 +1,3 @@
1
- export * from './gridPreferencePanelSelector';
1
+ export { gridPreferencePanelStateSelector } from './gridPreferencePanelSelector';
2
2
  export * from './gridPreferencePanelState';
3
3
  export * from './gridPreferencePanelsValue';
@@ -1,3 +1,3 @@
1
- export * from "./gridPreferencePanelSelector.js";
1
+ export { gridPreferencePanelStateSelector } from "./gridPreferencePanelSelector.js";
2
2
  export * from "./gridPreferencePanelState.js";
3
3
  export * from "./gridPreferencePanelsValue.js";
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
3
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
4
4
  import { GridStateInitializer } from '../../utils/useGridInitializeState';
@@ -6,4 +6,4 @@ export declare const preferencePanelStateInitializer: GridStateInitializer<Pick<
6
6
  /**
7
7
  * TODO: Add a single `setPreferencePanel` method to avoid multiple `setState`
8
8
  */
9
- export declare const useGridPreferencesPanel: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "initialState">) => void;
9
+ export declare const useGridPreferencesPanel: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "initialState">) => void;
@@ -15,42 +15,29 @@ export const preferencePanelStateInitializer = (state, props) => _extends({}, st
15
15
  */
16
16
  export const useGridPreferencesPanel = (apiRef, props) => {
17
17
  const logger = useGridLogger(apiRef, 'useGridPreferencesPanel');
18
- const hideTimeout = React.useRef(undefined);
19
- const immediateTimeout = React.useRef(undefined);
20
18
 
21
19
  /**
22
20
  * API METHODS
23
21
  */
24
22
  const hidePreferences = React.useCallback(() => {
25
- logger.debug('Hiding Preferences Panel');
26
- const preferencePanelState = gridPreferencePanelStateSelector(apiRef.current.state);
27
- if (preferencePanelState.openedPanelValue) {
23
+ apiRef.current.setState(state => {
24
+ if (!state.preferencePanel.open) {
25
+ return state;
26
+ }
27
+ logger.debug('Hiding Preferences Panel');
28
+ const preferencePanelState = gridPreferencePanelStateSelector(state);
28
29
  apiRef.current.publishEvent('preferencePanelClose', {
29
30
  openedPanelValue: preferencePanelState.openedPanelValue
30
31
  });
31
- }
32
- apiRef.current.setState(state => _extends({}, state, {
33
- preferencePanel: {
34
- open: false
35
- }
36
- }));
37
- apiRef.current.forceUpdate();
32
+ return _extends({}, state, {
33
+ preferencePanel: {
34
+ open: false
35
+ }
36
+ });
37
+ });
38
38
  }, [apiRef, logger]);
39
-
40
- // This is to prevent the preferences from closing when you open a select box or another panel,
41
- // The issue is in MUI core V4 => Fixed in V5
42
- const doNotHidePanel = React.useCallback(() => {
43
- immediateTimeout.current = setTimeout(() => clearTimeout(hideTimeout.current), 0);
44
- }, []);
45
-
46
- // This is a hack for the issue with Core V4, by delaying hiding the panel on the clickAwayListener,
47
- // we can cancel the action if the trigger element still need the panel...
48
- const hidePreferencesDelayed = React.useCallback(() => {
49
- hideTimeout.current = setTimeout(hidePreferences, 100);
50
- }, [hidePreferences]);
51
39
  const showPreferences = React.useCallback((newValue, panelId, labelId) => {
52
40
  logger.debug('Opening Preferences Panel');
53
- doNotHidePanel();
54
41
  apiRef.current.setState(state => _extends({}, state, {
55
42
  preferencePanel: _extends({}, state.preferencePanel, {
56
43
  open: true,
@@ -62,11 +49,10 @@ export const useGridPreferencesPanel = (apiRef, props) => {
62
49
  apiRef.current.publishEvent('preferencePanelOpen', {
63
50
  openedPanelValue: newValue
64
51
  });
65
- apiRef.current.forceUpdate();
66
- }, [logger, doNotHidePanel, apiRef]);
52
+ }, [logger, apiRef]);
67
53
  useGridApiMethod(apiRef, {
68
54
  showPreferences,
69
- hidePreferences: hidePreferencesDelayed
55
+ hidePreferences
70
56
  }, 'public');
71
57
 
72
58
  /**
@@ -99,14 +85,4 @@ export const useGridPreferencesPanel = (apiRef, props) => {
99
85
  }, [apiRef]);
100
86
  useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
101
87
  useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
102
-
103
- /**
104
- * EFFECTS
105
- */
106
- React.useEffect(() => {
107
- return () => {
108
- clearTimeout(hideTimeout.current);
109
- clearTimeout(immediateTimeout.current);
110
- };
111
- }, []);
112
88
  };
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
3
3
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
4
4
  import { GridStateInitializer } from '../../utils/useGridInitializeState';
@@ -9,4 +9,4 @@ export declare const rowSelectionStateInitializer: GridStateInitializer<Pick<Dat
9
9
  * @requires useGridFocus (state) - can be after
10
10
  * @requires useGridKeyboardNavigation (`cellKeyDown` event must first be consumed by it)
11
11
  */
12
- export declare const useGridRowSelection: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "checkboxSelection" | "rowSelectionModel" | "onRowSelectionModelChange" | "disableMultipleRowSelection" | "disableRowSelectionOnClick" | "isRowSelectable" | "checkboxSelectionVisibleOnly" | "pagination" | "paginationMode" | "filterMode" | "classes" | "keepNonExistentRowsSelected" | "rowSelection" | "rowSelectionPropagation" | "signature">) => void;
12
+ export declare const useGridRowSelection: (apiRef: RefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, "checkboxSelection" | "rowSelectionModel" | "onRowSelectionModelChange" | "disableMultipleRowSelection" | "disableRowSelectionOnClick" | "isRowSelectable" | "checkboxSelectionVisibleOnly" | "pagination" | "paginationMode" | "filterMode" | "classes" | "keepNonExistentRowsSelected" | "rowSelection" | "rowSelectionPropagation" | "signature">) => void;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
3
3
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
4
- export declare const useGridRowSelectionPreProcessors: (apiRef: React.RefObject<GridPrivateApiCommunity>, props: DataGridProcessedProps) => void;
4
+ export declare const useGridRowSelectionPreProcessors: (apiRef: RefObject<GridPrivateApiCommunity>, props: DataGridProcessedProps) => void;
@@ -1,3 +1,4 @@
1
+ import { RefObject } from '@mui/x-internals/types';
1
2
  import type { GridRowId, GridRowTreeConfig } from '../../../models/gridRows';
2
3
  import type { DataGridProcessedProps } from '../../../models/props/DataGridProps';
3
4
  import type { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
@@ -8,5 +9,5 @@ export declare function getCheckboxPropsSelector(groupId: GridRowId, autoSelectP
8
9
  isChecked: boolean;
9
10
  }>;
10
11
  export declare function isMultipleRowSelectionEnabled(props: Pick<DataGridProcessedProps, 'signature' | 'disableMultipleRowSelection' | 'checkboxSelection'>): boolean;
11
- export declare const findRowsToSelect: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, tree: GridRowTreeConfig, selectedRow: GridRowId, autoSelectDescendants: boolean, autoSelectParents: boolean, addRow: (rowId: GridRowId) => void) => void;
12
- export declare const findRowsToDeselect: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, tree: GridRowTreeConfig, deselectedRow: GridRowId, autoSelectDescendants: boolean, autoSelectParents: boolean, removeRow: (rowId: GridRowId) => void) => void;
12
+ export declare const findRowsToSelect: (apiRef: RefObject<GridPrivateApiCommunity>, tree: GridRowTreeConfig, selectedRow: GridRowId, autoSelectDescendants: boolean, autoSelectParents: boolean, addRow: (rowId: GridRowId) => void) => void;
13
+ export declare const findRowsToDeselect: (apiRef: RefObject<GridPrivateApiCommunity>, tree: GridRowTreeConfig, deselectedRow: GridRowId, autoSelectDescendants: boolean, autoSelectParents: boolean, removeRow: (rowId: GridRowId) => void) => void;
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { RefObject } from '@mui/x-internals/types';
2
2
  import type { GridRenderContext } from '../../../models';
3
3
  import type { GridValidRowModel } from '../../../models/gridRows';
4
4
  import type { GridColDef } from '../../../models/colDef';
@@ -7,4 +7,4 @@ import type { RowRange } from './useGridRowSpanning';
7
7
  export declare function getUnprocessedRange(testRange: RowRange, processedRange: RowRange): RowRange | null;
8
8
  export declare function isRowContextInitialized(renderContext: GridRenderContext): boolean;
9
9
  export declare function isRowRangeUpdated(range1: RowRange, range2: RowRange): boolean;
10
- export declare const getCellValue: (row: GridValidRowModel, colDef: GridColDef, apiRef: React.MutableRefObject<GridApiCommunity>) => any;
10
+ export declare const getCellValue: (row: GridValidRowModel, colDef: GridColDef, apiRef: RefObject<GridApiCommunity>) => any;
@@ -16,7 +16,7 @@ export const gridRowMaximumTreeDepthSelector = createSelectorMemoized(gridRowsSt
16
16
  if (entries.length === 0) {
17
17
  return 1;
18
18
  }
19
- return entries.filter(([, nodeCount]) => nodeCount > 0).map(([depth]) => Number(depth)).sort((a, b) => b - a)[0] + 1;
19
+ return (entries.filter(([, nodeCount]) => nodeCount > 0).map(([depth]) => Number(depth)).sort((a, b) => b - a)[0] ?? 0) + 1;
20
20
  });
21
21
  export const gridDataRowIdsSelector = createSelector(gridRowsStateSelector, rows => rows.dataRowIds);
22
22