@mui/x-data-grid-pro 8.1.0 → 8.2.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 (60) hide show
  1. package/CHANGELOG.md +126 -7
  2. package/DataGridPro/DataGridPro.d.ts +1 -1
  3. package/DataGridPro/DataGridPro.js +1 -1
  4. package/DataGridPro/useDataGridProComponent.js +2 -0
  5. package/DataGridPro/useDataGridProProps.js +5 -4
  6. package/constants/dataGridProDefaultSlotsComponents.d.ts +1 -1
  7. package/esm/DataGridPro/DataGridPro.d.ts +1 -1
  8. package/esm/DataGridPro/DataGridPro.js +1 -1
  9. package/esm/DataGridPro/useDataGridProComponent.js +2 -0
  10. package/esm/DataGridPro/useDataGridProProps.js +6 -5
  11. package/esm/constants/dataGridProDefaultSlotsComponents.d.ts +1 -1
  12. package/esm/hooks/features/columnReorder/columnReorderSelector.d.ts +2 -2
  13. package/esm/hooks/features/columnReorder/index.d.ts +1 -1
  14. package/esm/hooks/features/dataSource/gridDataSourceSelector.d.ts +3 -3
  15. package/esm/hooks/features/detailPanel/gridDetailPanelSelector.d.ts +4 -4
  16. package/esm/hooks/features/index.d.ts +1 -1
  17. package/esm/hooks/features/infiniteLoader/useGridInfiniteLoader.d.ts +1 -1
  18. package/esm/hooks/features/infiniteLoader/useGridInfiniteLoader.js +11 -91
  19. package/esm/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +1 -1
  20. package/esm/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.d.ts +1 -2
  21. package/esm/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.js +18 -23
  22. package/esm/hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.d.ts +7 -0
  23. package/esm/hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.js +95 -0
  24. package/esm/hooks/features/treeData/gridTreeDataUtils.d.ts +1 -1
  25. package/esm/hooks/utils/useGridRootProps.d.ts +1 -1
  26. package/esm/index.d.ts +5 -5
  27. package/esm/index.js +1 -1
  28. package/esm/internals/index.d.ts +3 -2
  29. package/esm/internals/index.js +1 -0
  30. package/esm/models/dataGridProProps.d.ts +2 -2
  31. package/esm/models/gridApiPro.d.ts +3 -3
  32. package/esm/models/gridProSlotProps.d.ts +1 -1
  33. package/esm/models/gridStatePro.d.ts +2 -2
  34. package/esm/typeOverloads/modules.d.ts +4 -4
  35. package/esm/typeOverloads/reexports.d.ts +2 -2
  36. package/hooks/features/columnReorder/columnReorderSelector.d.ts +2 -2
  37. package/hooks/features/columnReorder/index.d.ts +1 -1
  38. package/hooks/features/dataSource/gridDataSourceSelector.d.ts +3 -3
  39. package/hooks/features/detailPanel/gridDetailPanelSelector.d.ts +4 -4
  40. package/hooks/features/index.d.ts +1 -1
  41. package/hooks/features/infiniteLoader/useGridInfiniteLoader.d.ts +1 -1
  42. package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +9 -90
  43. package/hooks/features/rowPinning/useGridRowPinningPreProcessors.d.ts +1 -1
  44. package/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.d.ts +1 -2
  45. package/hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.js +20 -25
  46. package/hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.d.ts +7 -0
  47. package/hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.js +104 -0
  48. package/hooks/features/treeData/gridTreeDataUtils.d.ts +1 -1
  49. package/hooks/utils/useGridRootProps.d.ts +1 -1
  50. package/index.d.ts +5 -5
  51. package/index.js +1 -1
  52. package/internals/index.d.ts +3 -2
  53. package/internals/index.js +8 -0
  54. package/models/dataGridProProps.d.ts +2 -2
  55. package/models/gridApiPro.d.ts +3 -3
  56. package/models/gridProSlotProps.d.ts +1 -1
  57. package/models/gridStatePro.d.ts +2 -2
  58. package/package.json +4 -4
  59. package/typeOverloads/modules.d.ts +4 -4
  60. package/typeOverloads/reexports.d.ts +2 -2
package/CHANGELOG.md CHANGED
@@ -5,13 +5,128 @@
5
5
  All notable changes to this project will be documented in this file.
6
6
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
7
7
 
8
+ ## 8.2.0
9
+
10
+ _May 1, 2025_
11
+
12
+ We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
13
+
14
+ - 📊 `<FunnelChart/>` now uses the `strawberrySky` sequential color palette by default.
15
+ <img width="481" alt="Screenshot 2025-04-29 at 13 55 21" src="https://github.com/user-attachments/assets/182085d1-a7ce-4e4d-9d8d-a4fe87f27167" />
16
+ - 📊 Add API to export a chart as an image: `apiRef.exportAsImage` — [Learn more](https://mui.com/x/react-charts/export/#export-as-image).
17
+
18
+ Special thanks go out to the community members for their valuable contributions:
19
+ @federico-ntr, @nusr.
20
+ Following are all team members who have contributed to this release:
21
+ @alexfauquette, @arminmeh, @bernardobelchior, @hasdfa, @Janpot, @JCQuintas, @KenanYusuf, @LukasTy, @MBilalShafi, @michelengelen, @oliviertassinari, @romgrk.
22
+
23
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
24
+
25
+ ### Data Grid
26
+
27
+ #### `@mui/x-data-grid@8.2.0`
28
+
29
+ - [DataGrid] Fix panel alignment (#17625) @KenanYusuf
30
+ - [DataGrid] Fix theme `defaultProps` causing unwanted re-renders (#17490) @KenanYusuf
31
+ - [DataGrid] Fix circular reference error (#17591) @romgrk
32
+ - [DataGrid] Fix `<GridEditInputCell />` break input (#16773) @nusr
33
+
34
+ #### `@mui/x-data-grid-pro@8.2.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
35
+
36
+ Same changes as in `@mui/x-data-grid@8.2.0`, plus:
37
+
38
+ - [DataGridPro] Use intersection observer to trigger server-side infinite loading (#17369) @arminmeh
39
+
40
+ #### `@mui/x-data-grid-premium@8.2.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
41
+
42
+ Same changes as in `@mui/x-data-grid-pro@8.2.0`.
43
+
44
+ ### Date and Time Pickers
45
+
46
+ #### `@mui/x-date-pickers@8.2.0`
47
+
48
+ - [l10n] Improve Italian (it-IT) locale (#17600) @federico-ntr
49
+ - [pickers] Refactor owner state typing (#17517) @LukasTy
50
+
51
+ #### `@mui/x-date-pickers-pro@8.2.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
52
+
53
+ Same changes as in `@mui/x-date-pickers@8.2.0`.
54
+
55
+ ### Charts
56
+
57
+ #### `@mui/x-charts@8.2.0`
58
+
59
+ - [charts] Add library name to errors (#17547) @bernardobelchior
60
+ - [charts] Add monochrome palettes (#17610) @JCQuintas
61
+ - [charts] Add screenshot of the tooltip (#17395) @alexfauquette
62
+ - [charts] Default bar chart x-axis scale type to band (#17519) @bernardobelchior
63
+ - [charts] Document axis ID uniqueness constraints (#17630) @bernardobelchior
64
+ - [charts] Refactor axis types (#17632) @bernardobelchior
65
+ - [charts] Use `<circle />` for circular legend mark (#17590) @alexfauquette
66
+
67
+ #### `@mui/x-charts-pro@8.2.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
68
+
69
+ Same changes as in `@mui/x-charts@8.2.0`, plus:
70
+
71
+ - [charts-pro] Add `gap` option to `<FunnelChart />` (#17642) @JCQuintas
72
+ - [charts-pro] Export charts as image (#17353) @bernardobelchior
73
+ - [charts-pro] Simplify zoom testing (#17525) @JCQuintas
74
+ - [charts-pro] Use new sequential color palette in `<FunnelChart />` (#17606) @JCQuintas
75
+
76
+ ### Tree View
77
+
78
+ #### `@mui/x-tree-view@8.2.0`
79
+
80
+ Internal changes.
81
+
82
+ #### `@mui/x-tree-view-pro@8.2.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
83
+
84
+ Same changes as in `@mui/x-tree-view@8.2.0`.
85
+
86
+ ### Docs
87
+
88
+ - [docs][charts] Add composition sections (#17377) @alexfauquette
89
+ - [docs][charts] Add docs on tooltip style (#17601) @bernardobelchior
90
+ - [docs][charts] Fix highlighting heading structure (#17581) @oliviertassinari
91
+ - [docs][charts] Improve export docs (#17538) @oliviertassinari
92
+ - [docs][charts] Similar introduction on most charts pages (#17374) @alexfauquette
93
+ - [docs][DataGrid] Clear component docs (#17540) @oliviertassinari
94
+ - [docs] Explicitly state that `groupingColDef` reference needs to be stable (#17544) @arminmeh
95
+ - [docs] Fix <kbd> a11y (#17536) @oliviertassinari
96
+ - [docs] Fix CodeSandbox spelling @oliviertassinari
97
+ - [docs] Fix coding style function @oliviertassinari
98
+ - [docs] Fix migration guide format (#17450) @oliviertassinari
99
+ - [docs] Improve data grid export docs (#17551) @MBilalShafi
100
+ - [docs] Remove leftover `@next` usages (#17542) @LukasTy
101
+
102
+ ### Core
103
+
104
+ - [core] Add security label to dependabot PRs @oliviertassinari
105
+ - [core] Allow post-install vale @oliviertassinari
106
+ - [core] Component consistency @oliviertassinari
107
+ - [core] Fix all Vale errors @oliviertassinari
108
+ - [core] Move `loadStyleSheets` to internals and use it in data grid and charts (#17548) @bernardobelchior
109
+ - [core] Remove empty version (#17582) @oliviertassinari
110
+ - [core] Remove eslint from codemod spec files (#17443) @alexfauquette
111
+ - [core] Remove unnecessary versions (#17597) @oliviertassinari
112
+ - [code-infra] Allow postinstall scripts for packages requesting it (#17635) @LukasTy
113
+ - [code-infra] Data Grid `vitest` changes (#17619) @JCQuintas
114
+ - [code-infra] Fix date-time sensitive tests (#17644) @JCQuintas
115
+ - [code-infra] Fix extension handling for type imports (#17636) @Janpot
116
+ - [code-infra] Further remove `clock=fake` and add `async act` for datagrid (#17563) @JCQuintas
117
+ - [code-infra] Latest vitest picker changes (#17577) @JCQuintas
118
+ - [docs-infra] Fix Vale no longer working (#17602) @alexfauquette
119
+ - [docs-infra] Uniformize Vale between repositories @oliviertassinari
120
+ - [infra] Updates to `branch switch comments` (#17589) @michelengelen
121
+ - [x-telemetry] Fix issue with get machineid hash (#17614) @hasdfa
122
+
8
123
  ## 8.1.0
9
124
 
10
125
  _Apr 24, 2025_
11
126
 
12
127
  We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
13
128
 
14
- - 📊 Add API to print a chart or export it as PDF: `apiRef.exportAsPrint`.
129
+ - 📊 Add API to print a chart or export it as PDF: `apiRef.exportAsPrint()`.
15
130
  - 📚 Documentation improvements
16
131
  - 🐞 Bugfixes
17
132
 
@@ -56,7 +171,7 @@ Same changes as in `@mui/x-date-pickers@8.1.0`.
56
171
 
57
172
  ### Charts
58
173
 
59
- - Add API to print a chart or export it as PDF: `apiRef.exportAsPrint`.
174
+ - Add API to print a chart or export it as PDF: `apiRef.exportAsPrint()`.
60
175
 
61
176
  #### `@mui/x-charts@8.1.0`
62
177
 
@@ -1821,7 +1936,7 @@ Same changes as in `@mui/x-tree-view@8.0.0-alpha.8`.
1821
1936
  - [docs] Add example for custom legend (#16169) @alexfauquette
1822
1937
  - [docs] Add full custom field creation example (#15194) @flaviendelangle
1823
1938
  - [docs] Copyedit the Data Grid cell selection page (#16099) @samuelsycamore
1824
- - [docs] Fix demo rendering issue on Codesandbox (#16118) @arminmeh
1939
+ - [docs] Fix demo rendering issue on CodeSandbox (#16118) @arminmeh
1825
1940
  - [docs] Remove broken links (#16167) @alexfauquette
1826
1941
  - [docs] Split the Data Grid editing page (#14931) @MBilalShafi
1827
1942
  - [docs] Fix wrong props warnings (#16119) @JCQuintas
@@ -2268,7 +2383,7 @@ Releasing to benefit from license package fix (#15814).
2268
2383
 
2269
2384
  - [code-infra] Add Charts sandbox generation (#15830) @JCQuintas
2270
2385
  - [code-infra] Remove redundant `@type/react-test-renderer` dep (#15766) @LukasTy
2271
- - [license] Use `console.log` for the error message on Codesandbox to avoid rendering error (#15814) @arminmeh
2386
+ - [license] Use `console.log` for the error message on CodeSandbox to avoid rendering error (#15814) @arminmeh
2272
2387
 
2273
2388
  ## 8.0.0-alpha.3
2274
2389
 
@@ -2484,6 +2599,8 @@ Same changes as in `@mui/x-tree-view@v8.0.0-alpha.2`.
2484
2599
 
2485
2600
  ### Docs
2486
2601
 
2602
+ <!-- vale MUI.CorrectRererenceCased = NO -->
2603
+
2487
2604
  - [docs] Fix 404 links (#15575) @oliviertassinari
2488
2605
  - [docs] Fix bash comments (#15571) @oliviertassinari
2489
2606
  - [docs] Fix Pickers theme augmentation example (#15672) @LukasTy
@@ -2493,6 +2610,8 @@ Same changes as in `@mui/x-tree-view@v8.0.0-alpha.2`.
2493
2610
  - [docs] Fix `anchorEl` API page for charts (#15625) @oliviertassinari
2494
2611
  - [docs] Add documentation for the list view feature (#15344) @KenanYusuf
2495
2612
 
2613
+ <!-- vale MUI.CorrectRererenceCased = YES -->
2614
+
2496
2615
  ### Core
2497
2616
 
2498
2617
  - [core] Follow `()` function convention for docs @oliviertassinari
@@ -3401,7 +3520,7 @@ Same changes as in `@mui/x-tree-view@7.24.0`.
3401
3520
  ### Docs
3402
3521
 
3403
3522
  - [docs] Copyedit the Data Grid cell selection page (#16213) @samuelsycamore
3404
- - [docs] Fix demo rendering issue on Codesandbox (#16129) @arminmeh
3523
+ - [docs] Fix demo rendering issue on CodeSandbox (#16129) @arminmeh
3405
3524
 
3406
3525
  ### Core
3407
3526
 
@@ -3679,7 +3798,7 @@ Releasing to benefit from license package fix (#15818).
3679
3798
  ### Core
3680
3799
 
3681
3800
  - [core] Add `@mui/x-tree-view-pro` to `releaseChangelog` (#15747) @flaviendelangle
3682
- - [license] Use `console.log` for the error message on Codesandbox to avoid rendering error (#15818) @arminmeh
3801
+ - [license] Use `console.log` for the error message on CodeSandbox to avoid rendering error (#15818) @arminmeh
3683
3802
 
3684
3803
  ## 7.23.1
3685
3804
 
@@ -7020,7 +7139,7 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.4`.
7020
7139
  />
7021
7140
  ```
7022
7141
 
7023
- - The headless field hooks (e.g.: `useDateField`) now returns a new prop called `enableAccessibleFieldDOMStructure`.
7142
+ - The headless field hooks (for example `useDateField()`) now returns a new prop called `enableAccessibleFieldDOMStructure`.
7024
7143
  This property is utilized to determine whether the anticipated UI is constructed using an accessible DOM structure.
7025
7144
  Learn more about this new accessible DOM structure in the [v8 migration guide](https://v7.mui.com/x/migration/migration-pickers-v7/#new-dom-structure-for-the-field).
7026
7145
 
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { GridValidRowModel } from '@mui/x-data-grid';
3
3
  import { DataGridProProps } from "../models/dataGridProProps.js";
4
- export type { GridProSlotsComponent as GridSlots } from '../models';
4
+ export type { GridProSlotsComponent as GridSlots } from "../models/index.js";
5
5
  interface DataGridProComponent {
6
6
  <R extends GridValidRowModel = any>(props: DataGridProProps<R> & React.RefAttributes<HTMLDivElement>): React.JSX.Element;
7
7
  propTypes?: any;
@@ -29,7 +29,7 @@ const configuration = {
29
29
  useCellAggregationResult: () => null
30
30
  }
31
31
  };
32
- const releaseInfo = "MTc0NTQ0NTYwMDAwMA==";
32
+ const releaseInfo = "MTc0NjA0NjgwMDAwMA==";
33
33
  const watermark = /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicense.Watermark, {
34
34
  packageName: "x-data-grid-pro",
35
35
  releaseInfo: releaseInfo
@@ -22,6 +22,7 @@ var _useGridRowPinning = require("../hooks/features/rowPinning/useGridRowPinning
22
22
  var _useGridRowPinningPreProcessors = require("../hooks/features/rowPinning/useGridRowPinningPreProcessors");
23
23
  var _useGridDataSourcePro = require("../hooks/features/dataSource/useGridDataSourcePro");
24
24
  var _useGridDataSourceLazyLoader = require("../hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader");
25
+ var _useGridInfiniteLoadingIntersection = require("../hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection");
25
26
  // Pro-only features
26
27
 
27
28
  const useDataGridProComponent = (apiRef, props) => {
@@ -98,6 +99,7 @@ const useDataGridProComponent = (apiRef, props) => {
98
99
  (0, _useGridInfiniteLoader.useGridInfiniteLoader)(apiRef, props);
99
100
  (0, _useGridLazyLoader.useGridLazyLoader)(apiRef, props);
100
101
  (0, _useGridDataSourceLazyLoader.useGridDataSourceLazyLoader)(apiRef, props);
102
+ (0, _useGridInfiniteLoadingIntersection.useGridInfiniteLoadingIntersection)(apiRef, props);
101
103
  (0, _internals.useGridColumnMenu)(apiRef);
102
104
  (0, _internals.useGridCsvExport)(apiRef, props);
103
105
  (0, _internals.useGridPrintExport)(apiRef, props);
@@ -9,6 +9,7 @@ exports.useDataGridProProps = exports.DATA_GRID_PRO_PROPS_DEFAULT_VALUES = void
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _styles = require("@mui/material/styles");
12
+ var _system = require("@mui/system");
12
13
  var _xDataGrid = require("@mui/x-data-grid");
13
14
  var _internals = require("@mui/x-data-grid/internals");
14
15
  var _dataGridProDefaultSlotsComponents = require("../constants/dataGridProDefaultSlotsComponents");
@@ -44,12 +45,12 @@ const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PRO_PROPS_DEFAULT_V
44
45
  });
45
46
  const defaultSlots = _dataGridProDefaultSlotsComponents.DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS;
46
47
  const useDataGridProProps = inProps => {
47
- const themedProps =
48
- // eslint-disable-next-line material-ui/mui-name-matches-component-name
49
- (0, _styles.useThemeProps)({
48
+ const theme = (0, _styles.useTheme)();
49
+ const themedProps = React.useMemo(() => (0, _system.getThemeProps)({
50
50
  props: inProps,
51
+ theme,
51
52
  name: 'MuiDataGrid'
52
- });
53
+ }), [theme, inProps]);
53
54
  const localeText = React.useMemo(() => (0, _extends2.default)({}, _xDataGrid.GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
54
55
  const slots = React.useMemo(() => (0, _internals.computeSlots)({
55
56
  defaultSlots,
@@ -1,2 +1,2 @@
1
- import type { GridProSlotsComponent } from '../models';
1
+ import type { GridProSlotsComponent } from "../models/index.js";
2
2
  export declare const DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS: GridProSlotsComponent;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { GridValidRowModel } from '@mui/x-data-grid';
3
3
  import { DataGridProProps } from "../models/dataGridProProps.js";
4
- export type { GridProSlotsComponent as GridSlots } from '../models';
4
+ export type { GridProSlotsComponent as GridSlots } from "../models/index.js";
5
5
  interface DataGridProComponent {
6
6
  <R extends GridValidRowModel = any>(props: DataGridProProps<R> & React.RefAttributes<HTMLDivElement>): React.JSX.Element;
7
7
  propTypes?: any;
@@ -22,7 +22,7 @@ const configuration = {
22
22
  useCellAggregationResult: () => null
23
23
  }
24
24
  };
25
- const releaseInfo = "MTc0NTQ0NTYwMDAwMA==";
25
+ const releaseInfo = "MTc0NjA0NjgwMDAwMA==";
26
26
  const watermark = /*#__PURE__*/_jsx(Watermark, {
27
27
  packageName: "x-data-grid-pro",
28
28
  releaseInfo: releaseInfo
@@ -17,6 +17,7 @@ import { useGridRowPinning, rowPinningStateInitializer } from "../hooks/features
17
17
  import { useGridRowPinningPreProcessors } from "../hooks/features/rowPinning/useGridRowPinningPreProcessors.js";
18
18
  import { useGridDataSourcePro as useGridDataSource, dataSourceStateInitializer } from "../hooks/features/dataSource/useGridDataSourcePro.js";
19
19
  import { useGridDataSourceLazyLoader } from "../hooks/features/serverSideLazyLoader/useGridDataSourceLazyLoader.js";
20
+ import { useGridInfiniteLoadingIntersection } from "../hooks/features/serverSideLazyLoader/useGridInfiniteLoadingIntersection.js";
20
21
  export const useDataGridProComponent = (apiRef, props) => {
21
22
  useGridInitialization(apiRef, props);
22
23
 
@@ -91,6 +92,7 @@ export const useDataGridProComponent = (apiRef, props) => {
91
92
  useGridInfiniteLoader(apiRef, props);
92
93
  useGridLazyLoader(apiRef, props);
93
94
  useGridDataSourceLazyLoader(apiRef, props);
95
+ useGridInfiniteLoadingIntersection(apiRef, props);
94
96
  useGridColumnMenu(apiRef);
95
97
  useGridCsvExport(apiRef, props);
96
98
  useGridPrintExport(apiRef, props);
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
- import { useThemeProps } from '@mui/material/styles';
3
+ import { useTheme } from '@mui/material/styles';
4
+ import { getThemeProps } from '@mui/system';
4
5
  import { GRID_DEFAULT_LOCALE_TEXT, DATA_GRID_PROPS_DEFAULT_VALUES } from '@mui/x-data-grid';
5
6
  import { computeSlots, ROW_SELECTION_PROPAGATION_DEFAULT } from '@mui/x-data-grid/internals';
6
7
  import { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from "../constants/dataGridProDefaultSlotsComponents.js";
@@ -36,12 +37,12 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
36
37
  });
37
38
  const defaultSlots = DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS;
38
39
  export const useDataGridProProps = inProps => {
39
- const themedProps =
40
- // eslint-disable-next-line material-ui/mui-name-matches-component-name
41
- useThemeProps({
40
+ const theme = useTheme();
41
+ const themedProps = React.useMemo(() => getThemeProps({
42
42
  props: inProps,
43
+ theme,
43
44
  name: 'MuiDataGrid'
44
- });
45
+ }), [theme, inProps]);
45
46
  const localeText = React.useMemo(() => _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
46
47
  const slots = React.useMemo(() => computeSlots({
47
48
  defaultSlots,
@@ -1,2 +1,2 @@
1
- import type { GridProSlotsComponent } from '../models';
1
+ import type { GridProSlotsComponent } from "../models/index.js";
2
2
  export declare const DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS: GridProSlotsComponent;
@@ -1,3 +1,3 @@
1
1
  import { GridStatePro } from "../../../models/gridStatePro.js";
2
- export declare const gridColumnReorderSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, unknown, import("./columnReorderInterfaces").GridColumnReorderState>;
3
- export declare const gridColumnReorderDragColSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./columnReorderInterfaces").GridColumnReorderState, string>;
2
+ export declare const gridColumnReorderSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, unknown, import("./columnReorderInterfaces.js").GridColumnReorderState>;
3
+ export declare const gridColumnReorderDragColSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./columnReorderInterfaces.js").GridColumnReorderState, string>;
@@ -1,2 +1,2 @@
1
1
  export * from "./columnReorderSelector.js";
2
- export type { GridColumnReorderState } from './columnReorderInterfaces';
2
+ export type { GridColumnReorderState } from "./columnReorderInterfaces.js";
@@ -1,7 +1,7 @@
1
1
  import type { GridRowId } from '@mui/x-data-grid';
2
2
  import { GridStatePro } from "../../../models/gridStatePro.js";
3
- export declare const gridDataSourceStateSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, unknown, import("./models").GridDataSourceState>;
4
- export declare const gridDataSourceLoadingSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./models").GridDataSourceState, Record<GridRowId, boolean>>;
3
+ export declare const gridDataSourceStateSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, unknown, import("./models.js").GridDataSourceState>;
4
+ export declare const gridDataSourceLoadingSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./models.js").GridDataSourceState, Record<GridRowId, boolean>>;
5
5
  export declare const gridDataSourceLoadingIdSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, GridRowId, boolean>;
6
- export declare const gridDataSourceErrorsSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./models").GridDataSourceState, Record<GridRowId, any>>;
6
+ export declare const gridDataSourceErrorsSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./models.js").GridDataSourceState, Record<GridRowId, any>>;
7
7
  export declare const gridDataSourceErrorSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, GridRowId, any>;
@@ -1,8 +1,8 @@
1
1
  import { GridStatePro } from "../../../models/gridStatePro.js";
2
- export declare const gridDetailPanelStateSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, unknown, import("./gridDetailPanelInterface").GridDetailPanelState>;
3
- export declare const gridDetailPanelExpandedRowIdsSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./gridDetailPanelInterface").GridDetailPanelState, Set<import("@mui/x-data-grid").GridRowId>>;
4
- export declare const gridDetailPanelExpandedRowsContentCacheSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./gridDetailPanelInterface").GridDetailPanelState, Record<import("@mui/x-data-grid").GridRowId, import("react").ReactNode>>;
5
- export declare const gridDetailPanelRawHeightCacheSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./gridDetailPanelInterface").GridDetailPanelState, {
2
+ export declare const gridDetailPanelStateSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, unknown, import("./gridDetailPanelInterface.js").GridDetailPanelState>;
3
+ export declare const gridDetailPanelExpandedRowIdsSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./gridDetailPanelInterface.js").GridDetailPanelState, Set<import("@mui/x-data-grid").GridRowId>>;
4
+ export declare const gridDetailPanelExpandedRowsContentCacheSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./gridDetailPanelInterface.js").GridDetailPanelState, Record<import("@mui/x-data-grid").GridRowId, import("react").ReactNode>>;
5
+ export declare const gridDetailPanelRawHeightCacheSelector: import("@mui/x-data-grid").OutputSelector<GridStatePro, import("./gridDetailPanelInterface.js").GridDetailPanelState, {
6
6
  [x: string]: {
7
7
  autoHeight: boolean;
8
8
  height: number;
@@ -4,4 +4,4 @@ export * from "./rowReorder/index.js";
4
4
  export * from "./treeData/index.js";
5
5
  export * from "./detailPanel/index.js";
6
6
  export * from "./rowPinning/index.js";
7
- export type { GridDataSourceState } from './dataSource/models';
7
+ export type { GridDataSourceState } from "./dataSource/models.js";
@@ -6,4 +6,4 @@ import { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
6
6
  * @requires useGridDimensions (method) - can be after
7
7
  * @requires useGridScroll (method
8
8
  */
9
- export declare const useGridInfiniteLoader: (apiRef: RefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, "onRowsScrollEnd" | "pagination" | "paginationMode" | "rowsLoadingMode" | "scrollEndThreshold">) => void;
9
+ export declare const useGridInfiniteLoader: (apiRef: RefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, "onRowsScrollEnd" | "pagination" | "paginationMode" | "rowsLoadingMode">) => void;
@@ -1,104 +1,24 @@
1
- import * as React from 'react';
2
- import { useGridSelector, useGridEventPriority, gridVisibleColumnDefinitionsSelector, useGridApiMethod, gridDimensionsSelector } from '@mui/x-data-grid';
3
- import { useGridVisibleRows, useTimeout, gridHorizontalScrollbarHeightSelector } from '@mui/x-data-grid/internals';
1
+ import { useGridSelector, useGridEventPriority, gridVisibleColumnDefinitionsSelector, useGridEvent } from '@mui/x-data-grid';
2
+ import { useGridVisibleRows, runIf } from '@mui/x-data-grid/internals';
4
3
  import useEventCallback from '@mui/utils/useEventCallback';
5
- import { styled } from '@mui/system';
6
- import { jsx as _jsx } from "react/jsx-runtime";
7
- const InfiniteLoadingTriggerElement = styled('div')({
8
- position: 'sticky',
9
- left: 0,
10
- width: 0,
11
- height: 0
12
- });
13
-
14
4
  /**
15
5
  * @requires useGridColumns (state)
16
6
  * @requires useGridDimensions (method) - can be after
17
7
  * @requires useGridScroll (method
18
8
  */
19
9
  export const useGridInfiniteLoader = (apiRef, props) => {
20
- const isReady = useGridSelector(apiRef, gridDimensionsSelector).isReady;
21
10
  const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
22
11
  const currentPage = useGridVisibleRows(apiRef, props);
23
- const observer = React.useRef(null);
24
- const updateTargetTimeout = useTimeout();
25
- const triggerElement = React.useRef(null);
26
12
  const isEnabled = props.rowsLoadingMode === 'client' && !!props.onRowsScrollEnd;
27
- const handleLoadMoreRows = useEventCallback(([entry]) => {
28
- const currentRatio = entry.intersectionRatio;
29
- const isIntersecting = entry.isIntersecting;
30
- if (isIntersecting && currentRatio === 1) {
31
- const viewportPageSize = apiRef.current.getViewportPageSize();
32
- const rowScrollEndParams = {
33
- visibleColumns,
34
- viewportPageSize,
35
- visibleRowsCount: currentPage.rows.length
36
- };
37
- apiRef.current.publishEvent('rowsScrollEnd', rowScrollEndParams);
38
- observer.current?.disconnect();
39
- // do not observe this node anymore
40
- triggerElement.current = null;
41
- }
13
+ const handleLoadMoreRows = useEventCallback(() => {
14
+ const viewportPageSize = apiRef.current.getViewportPageSize();
15
+ const rowScrollEndParams = {
16
+ visibleColumns,
17
+ viewportPageSize,
18
+ visibleRowsCount: currentPage.rows.length
19
+ };
20
+ apiRef.current.publishEvent('rowsScrollEnd', rowScrollEndParams);
42
21
  });
43
- React.useEffect(() => {
44
- const virtualScroller = apiRef.current.virtualScrollerRef.current;
45
- if (!isEnabled || !isReady || !virtualScroller) {
46
- return;
47
- }
48
- observer.current?.disconnect();
49
- const horizontalScrollbarHeight = gridHorizontalScrollbarHeightSelector(apiRef);
50
- const marginBottom = props.scrollEndThreshold - horizontalScrollbarHeight;
51
- observer.current = new IntersectionObserver(handleLoadMoreRows, {
52
- threshold: 1,
53
- root: virtualScroller,
54
- rootMargin: `0px 0px ${marginBottom}px 0px`
55
- });
56
- if (triggerElement.current) {
57
- observer.current.observe(triggerElement.current);
58
- }
59
- }, [apiRef, isReady, handleLoadMoreRows, isEnabled, props.scrollEndThreshold]);
60
- const updateTarget = node => {
61
- if (triggerElement.current !== node) {
62
- observer.current?.disconnect();
63
- triggerElement.current = node;
64
- if (triggerElement.current) {
65
- observer.current?.observe(triggerElement.current);
66
- }
67
- }
68
- };
69
- const triggerRef = React.useCallback(node => {
70
- // Prevent the infite loading working in combination with lazy loading
71
- if (!isEnabled) {
72
- return;
73
- }
74
-
75
- // If the user scrolls through the grid too fast it might happen that the observer is connected to the trigger element
76
- // that will be intersecting the root inside the same render cycle (but not intersecting at the time of the connection).
77
- // This will cause the observer to not call the callback with `isIntersecting` set to `true`.
78
- // https://www.w3.org/TR/intersection-observer/#event-loop
79
- // Delaying the connection to the next cycle helps since the observer will always call the callback the first time it is connected.
80
- // https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/observe
81
- // Related to
82
- // https://github.com/mui/mui-x/issues/14116
83
- updateTargetTimeout.start(0, () => updateTarget(node));
84
- }, [isEnabled, updateTargetTimeout]);
85
- const getInfiniteLoadingTriggerElement = React.useCallback(({
86
- lastRowId
87
- }) => {
88
- if (!isEnabled) {
89
- return null;
90
- }
91
- return /*#__PURE__*/_jsx(InfiniteLoadingTriggerElement, {
92
- ref: triggerRef
93
- // Force rerender on last row change to start observing the new trigger
94
- ,
95
-
96
- role: "presentation"
97
- }, `trigger-${lastRowId}`);
98
- }, [isEnabled, triggerRef]);
99
- const infiniteLoaderPrivateApi = {
100
- getInfiniteLoadingTriggerElement
101
- };
102
- useGridApiMethod(apiRef, infiniteLoaderPrivateApi, 'private');
103
22
  useGridEventPriority(apiRef, 'rowsScrollEnd', props.onRowsScrollEnd);
23
+ useGridEvent(apiRef, 'rowsScrollEndIntersection', runIf(isEnabled, handleLoadMoreRows));
104
24
  };
@@ -2,7 +2,7 @@ import { RefObject } from '@mui/x-internals/types';
2
2
  import { GridHydrateRowsValue } from '@mui/x-data-grid/internals';
3
3
  import { GridRowId, GridRowModel } from '@mui/x-data-grid';
4
4
  import { GridPrivateApiPro } from "../../../models/gridApiPro.js";
5
- import type { GridPinnedRowsProp } from './gridRowPinningInterface';
5
+ import type { GridPinnedRowsProp } from "./gridRowPinningInterface.js";
6
6
  type GridPinnedRowPosition = keyof GridPinnedRowsProp;
7
7
  export declare function addPinnedRow({
8
8
  groupingParams,
@@ -4,7 +4,6 @@ import { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
4
4
  /**
5
5
  * @requires useGridRows (state)
6
6
  * @requires useGridPagination (state)
7
- * @requires useGridDimensions (method) - can be after
8
7
  * @requires useGridScroll (method
9
8
  */
10
- export declare const useGridDataSourceLazyLoader: (privateApiRef: RefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, "pagination" | "paginationMode" | "dataSource" | "lazyLoading" | "lazyLoadingRequestThrottleMs" | "scrollEndThreshold">) => void;
9
+ export declare const useGridDataSourceLazyLoader: (privateApiRef: RefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, "dataSource" | "lazyLoading" | "lazyLoadingRequestThrottleMs">) => void;
@@ -1,8 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { throttle } from '@mui/x-internals/throttle';
4
- import { unstable_debounce as debounce } from '@mui/utils';
5
- import { useGridEvent, gridSortModelSelector, gridFilterModelSelector, GRID_ROOT_GROUP_ID, gridPaginationModelSelector, gridDimensionsSelector, gridFilteredSortedRowIdsSelector, gridRowIdSelector } from '@mui/x-data-grid';
4
+ import useEventCallback from '@mui/utils/useEventCallback';
5
+ import debounce from '@mui/utils/debounce';
6
+ import { useGridEvent, gridSortModelSelector, gridFilterModelSelector, GRID_ROOT_GROUP_ID, gridPaginationModelSelector, gridFilteredSortedRowIdsSelector, gridRowIdSelector } from '@mui/x-data-grid';
6
7
  import { getVisibleRows, gridRenderContextSelector, GridStrategyGroup, useGridRegisterStrategyProcessor, runIf, DataSourceRowsUpdateStrategy } from '@mui/x-data-grid/internals';
7
8
  import { findSkeletonRowsSection } from "../lazyLoader/utils.js";
8
9
  import { GRID_SKELETON_ROW_ROOT_ID } from "../lazyLoader/useGridLazyLoaderPreProcessors.js";
@@ -20,7 +21,6 @@ const getSkeletonRowId = index => `${GRID_SKELETON_ROW_ROOT_ID}-${index}`;
20
21
  /**
21
22
  * @requires useGridRows (state)
22
23
  * @requires useGridPagination (state)
23
- * @requires useGridDimensions (method) - can be after
24
24
  * @requires useGridScroll (method
25
25
  */
26
26
  export const useGridDataSourceLazyLoader = (privateApiRef, props) => {
@@ -249,7 +249,7 @@ export const useGridDataSourceLazyLoader = (privateApiRef, props) => {
249
249
  addSkeletonRows();
250
250
  privateApiRef.current.requestPipeProcessorsApplication('hydrateRows');
251
251
  }, [privateApiRef, updateLoadingTrigger, addSkeletonRows]);
252
- const handleScrolling = React.useCallback(newScrollPosition => {
252
+ const handleIntersection = useEventCallback(() => {
253
253
  if (rowsStale.current || loadingTrigger.current !== LoadingTrigger.SCROLL_END) {
254
254
  return;
255
255
  }
@@ -257,24 +257,19 @@ export const useGridDataSourceLazyLoader = (privateApiRef, props) => {
257
257
  if (previousLastRowIndex.current >= renderContext.lastRowIndex) {
258
258
  return;
259
259
  }
260
- const dimensions = gridDimensionsSelector(privateApiRef);
261
- const position = newScrollPosition.top + dimensions.viewportInnerSize.height;
262
- const target = dimensions.contentSize.height - props.scrollEndThreshold;
263
- if (position >= target) {
264
- previousLastRowIndex.current = renderContext.lastRowIndex;
265
- const paginationModel = gridPaginationModelSelector(privateApiRef);
266
- const sortModel = gridSortModelSelector(privateApiRef);
267
- const filterModel = gridFilterModelSelector(privateApiRef);
268
- const getRowsParams = {
269
- start: renderContext.lastRowIndex,
270
- end: renderContext.lastRowIndex + paginationModel.pageSize - 1,
271
- sortModel,
272
- filterModel
273
- };
274
- privateApiRef.current.setLoading(true);
275
- fetchRows(adjustRowParams(getRowsParams));
276
- }
277
- }, [privateApiRef, props.scrollEndThreshold, adjustRowParams, fetchRows]);
260
+ previousLastRowIndex.current = renderContext.lastRowIndex;
261
+ const paginationModel = gridPaginationModelSelector(privateApiRef);
262
+ const sortModel = gridSortModelSelector(privateApiRef);
263
+ const filterModel = gridFilterModelSelector(privateApiRef);
264
+ const getRowsParams = {
265
+ start: renderContext.lastRowIndex,
266
+ end: renderContext.lastRowIndex + paginationModel.pageSize - 1,
267
+ sortModel,
268
+ filterModel
269
+ };
270
+ privateApiRef.current.setLoading(true);
271
+ fetchRows(adjustRowParams(getRowsParams));
272
+ });
278
273
  const handleRenderedRowsIntervalChange = React.useCallback(params => {
279
274
  if (rowsStale.current) {
280
275
  return;
@@ -352,7 +347,7 @@ export const useGridDataSourceLazyLoader = (privateApiRef, props) => {
352
347
  useGridRegisterStrategyProcessor(privateApiRef, DataSourceRowsUpdateStrategy.LazyLoading, 'dataSourceRowsUpdate', handleDataUpdate);
353
348
  useGridEvent(privateApiRef, 'strategyAvailabilityChange', handleStrategyActivityChange);
354
349
  useGridEvent(privateApiRef, 'rowCountChange', runIf(lazyLoadingRowsUpdateStrategyActive, handleRowCountChange));
355
- useGridEvent(privateApiRef, 'scrollPositionChange', runIf(lazyLoadingRowsUpdateStrategyActive, handleScrolling));
350
+ useGridEvent(privateApiRef, 'rowsScrollEndIntersection', runIf(lazyLoadingRowsUpdateStrategyActive, handleIntersection));
356
351
  useGridEvent(privateApiRef, 'renderedRowsIntervalChange', runIf(lazyLoadingRowsUpdateStrategyActive, throttledHandleRenderedRowsIntervalChange));
357
352
  useGridEvent(privateApiRef, 'sortModelChange', runIf(lazyLoadingRowsUpdateStrategyActive, handleGridSortModelChange));
358
353
  useGridEvent(privateApiRef, 'filterModelChange', runIf(lazyLoadingRowsUpdateStrategyActive, handleGridFilterModelChange));
@@ -0,0 +1,7 @@
1
+ import { RefObject } from '@mui/x-internals/types';
2
+ import { GridPrivateApiPro } from "../../../models/gridApiPro.js";
3
+ import { DataGridProProcessedProps } from "../../../models/dataGridProProps.js";
4
+ /**
5
+ * @requires useGridDimensions (method) - can be after
6
+ */
7
+ export declare const useGridInfiniteLoadingIntersection: (apiRef: RefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, "onRowsScrollEnd" | "dataSource" | "lazyLoading" | "rowsLoadingMode" | "scrollEndThreshold">) => void;