@mui/x-data-grid 7.0.0-beta.4 → 7.0.0-beta.5

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 (90) hide show
  1. package/CHANGELOG.md +138 -14
  2. package/DataGrid/DataGrid.js +2 -0
  3. package/colDef/gridBooleanOperators.js +1 -1
  4. package/components/GridRow.d.ts +7 -9
  5. package/components/GridRow.js +36 -47
  6. package/components/cell/GridCell.d.ts +2 -1
  7. package/components/cell/GridCell.js +7 -3
  8. package/components/cell/GridSkeletonCell.d.ts +3 -2
  9. package/components/cell/GridSkeletonCell.js +14 -6
  10. package/components/columnSelection/GridCellCheckboxRenderer.js +6 -4
  11. package/components/columnsManagement/GridColumnsManagement.js +1 -1
  12. package/components/containers/GridRootStyles.js +9 -2
  13. package/components/virtualization/GridBottomContainer.js +1 -1
  14. package/components/virtualization/GridTopContainer.js +1 -1
  15. package/components/virtualization/GridVirtualScroller.js +2 -2
  16. package/components/virtualization/GridVirtualScrollerRenderZone.js +9 -3
  17. package/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -8
  18. package/hooks/features/columns/gridColumnsSelector.d.ts +6 -0
  19. package/hooks/features/columns/gridColumnsSelector.js +8 -1
  20. package/hooks/features/columns/useGridColumns.js +4 -0
  21. package/hooks/features/editing/useGridRowEditing.js +1 -2
  22. package/hooks/features/filter/useGridFilter.js +2 -2
  23. package/hooks/features/rows/useGridRows.js +8 -4
  24. package/hooks/features/rows/useGridRowsMeta.js +5 -13
  25. package/hooks/features/sorting/gridSortingUtils.js +9 -1
  26. package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +0 -9
  27. package/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -7
  28. package/hooks/features/virtualization/useGridVirtualScroller.d.ts +3 -0
  29. package/hooks/features/virtualization/useGridVirtualScroller.js +82 -138
  30. package/hooks/features/virtualization/useGridVirtualization.d.ts +0 -8
  31. package/hooks/features/virtualization/useGridVirtualization.js +1 -6
  32. package/hooks/utils/useTimeout.d.ts +5 -3
  33. package/hooks/utils/useTimeout.js +13 -5
  34. package/index.js +1 -1
  35. package/models/colDef/gridColDef.d.ts +7 -0
  36. package/modern/DataGrid/DataGrid.js +2 -0
  37. package/modern/colDef/gridBooleanOperators.js +1 -1
  38. package/modern/components/GridRow.js +35 -46
  39. package/modern/components/cell/GridCell.js +7 -3
  40. package/modern/components/cell/GridSkeletonCell.js +14 -6
  41. package/modern/components/columnSelection/GridCellCheckboxRenderer.js +6 -4
  42. package/modern/components/columnsManagement/GridColumnsManagement.js +1 -1
  43. package/modern/components/containers/GridRootStyles.js +9 -2
  44. package/modern/components/virtualization/GridBottomContainer.js +1 -1
  45. package/modern/components/virtualization/GridTopContainer.js +1 -1
  46. package/modern/components/virtualization/GridVirtualScroller.js +2 -2
  47. package/modern/components/virtualization/GridVirtualScrollerRenderZone.js +8 -3
  48. package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -8
  49. package/modern/hooks/features/columns/gridColumnsSelector.js +8 -1
  50. package/modern/hooks/features/columns/useGridColumns.js +2 -0
  51. package/modern/hooks/features/editing/useGridRowEditing.js +1 -2
  52. package/modern/hooks/features/filter/useGridFilter.js +2 -2
  53. package/modern/hooks/features/rows/useGridRows.js +8 -4
  54. package/modern/hooks/features/rows/useGridRowsMeta.js +5 -13
  55. package/modern/hooks/features/sorting/gridSortingUtils.js +9 -1
  56. package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +0 -7
  57. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +80 -136
  58. package/modern/hooks/features/virtualization/useGridVirtualization.js +1 -6
  59. package/modern/hooks/utils/useTimeout.js +13 -5
  60. package/modern/index.js +1 -1
  61. package/modern/utils/utils.js +9 -0
  62. package/node/DataGrid/DataGrid.js +1 -0
  63. package/node/colDef/gridBooleanOperators.js +1 -1
  64. package/node/components/GridRow.js +35 -46
  65. package/node/components/cell/GridCell.js +7 -3
  66. package/node/components/cell/GridSkeletonCell.js +15 -7
  67. package/node/components/columnSelection/GridCellCheckboxRenderer.js +6 -4
  68. package/node/components/columnsManagement/GridColumnsManagement.js +1 -1
  69. package/node/components/containers/GridRootStyles.js +9 -2
  70. package/node/components/virtualization/GridBottomContainer.js +1 -1
  71. package/node/components/virtualization/GridTopContainer.js +1 -1
  72. package/node/components/virtualization/GridVirtualScroller.js +2 -2
  73. package/node/components/virtualization/GridVirtualScrollerRenderZone.js +7 -2
  74. package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -5
  75. package/node/hooks/features/columns/gridColumnsSelector.js +9 -2
  76. package/node/hooks/features/columns/useGridColumns.js +2 -0
  77. package/node/hooks/features/editing/useGridRowEditing.js +1 -2
  78. package/node/hooks/features/filter/useGridFilter.js +2 -2
  79. package/node/hooks/features/rows/useGridRows.js +8 -4
  80. package/node/hooks/features/rows/useGridRowsMeta.js +5 -13
  81. package/node/hooks/features/sorting/gridSortingUtils.js +9 -1
  82. package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +1 -8
  83. package/node/hooks/features/virtualization/useGridVirtualScroller.js +81 -136
  84. package/node/hooks/features/virtualization/useGridVirtualization.js +2 -7
  85. package/node/hooks/utils/useTimeout.js +13 -4
  86. package/node/index.js +1 -1
  87. package/node/utils/utils.js +12 -1
  88. package/package.json +1 -1
  89. package/utils/utils.d.ts +4 -0
  90. package/utils/utils.js +9 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,89 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 7.0.0-beta.5
7
+
8
+ _Mar 1, 2024_
9
+
10
+ We'd like to offer a big thanks to the 15 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Add `getSortComparator` for more advanced sorting behaviors (#12215) @cherniavskii
13
+ - 🚀 Add `use client` directive to the Grid packages (#11803) @MBilalShafi
14
+ - 🌍 Improve Korean (ko-KR) and Chinese (zh-CN) locales on the Pickers
15
+ - 🐞 Bugfixes
16
+ - 📚 Documentation improvements
17
+
18
+ ### Data Grid
19
+
20
+ #### `@mui/x-data-grid@7.0.0-beta.5`
21
+
22
+ - [DataGrid] Add `getSortComparator` for more advanced sorting behaviors (#12215) @cherniavskii
23
+ - [DataGrid] Add `use client` directive to the Grid packages (#11803) @MBilalShafi
24
+ - [DataGrid] Fix `disableResetButton` and `disableShowHideToggle` flags to not exclude each other (#12169) @adyry
25
+ - [DataGrid] Fix cell range classnames (#12230) @romgrk
26
+ - [DataGrid] Fix wrong offset for right-pinned columns when toggling dark/light modes (#12233) @cherniavskii
27
+ - [DataGrid] Improve row virtualization and rendering performance (#12247) @romgrk
28
+ - [DataGrid] Improve performance by removing `querySelector` call (#12229) @romgrk
29
+ - [DataGrid] Fix `onColumnWidthChange` called before autosize affects column width (#12140) @shaharyar-shamshi
30
+ - [DataGrid] Fix boolean "is" filter (#12117) @shaharyar-shamshi
31
+ - [DataGrid] Fix `upsertFilterItems` removing filters that are not part of the update (#11954) @gitstart
32
+ - [DataGrid] Render scrollbars only if there is scroll (#12265) @cherniavskii
33
+
34
+ #### `@mui/x-data-grid-pro@7.0.0-beta.5` [![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@7.0.0-beta.5`, plus:
37
+
38
+ - [DataGridPro] Fix column resize errors on MacOS with automatic scrollbars enabled (#12217) @cherniavskii
39
+ - [DataGridPro] Fix lazy-loading crash (#12080) @romgrk
40
+ - [DataGridPro] Fix useGridRows not giving error on reversed data (#10821) @martijn-basesoft
41
+
42
+ #### `@mui/x-data-grid-premium@7.0.0-beta.5` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
43
+
44
+ Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.5`, plus:
45
+
46
+ - [DataGridPremium] Make clipboard copy respect the sorting during cell selection (#12235) @MBilalShafi
47
+
48
+ ### Date Pickers
49
+
50
+ #### `@mui/x-date-pickers@7.0.0-beta.5`
51
+
52
+ - [pickers] Fix toolbar components props handling (#12211) @LukasTy
53
+ - [l10n] Improve Chinese (zh-CN) locale (#12245) @headironc
54
+ - [l10n] Improve Korean (ko-KR) locale (#12192) @Luzi
55
+
56
+ #### `@mui/x-date-pickers-pro@7.0.0-beta.5` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
57
+
58
+ Same changes as in `@mui/x-date-pickers@7.0.0-beta.5`.
59
+
60
+ - [DateTimeRangePicker] Fix validation behavior (#12243) @LukasTy
61
+
62
+ ### Charts / `@mui/x-charts@7.0.0-beta.5`
63
+
64
+ - [charts] Fix grid duplicated key (#12208) @alexfauquette
65
+
66
+ ### Tree View / `@mui/x-tree-view@7.0.0-beta.5`
67
+
68
+ - [TreeView] Add public API and expose focus method (#12143) @noraleonte
69
+
70
+ ### Docs
71
+
72
+ - [docs] Fix image layout shift when loading @oliviertassinari
73
+ - [docs] Match Material UI repo comment for redirections @oliviertassinari
74
+ - [docs] Non breaking spaces @oliviertassinari
75
+ - [docs] Polish the Date Picker playground (#11869) @zanivan
76
+ - [docs] Standardize WAI-ARIA references @oliviertassinari
77
+
78
+ ### Core
79
+
80
+ - [core] Allow local docs next.js settings (#12227) @romgrk
81
+ - [core] Remove grid folder from `getComponentInfo` RegExp (#12241) @flaviendelangle
82
+ - [core] Remove `window.` reference for common globals @oliviertassinari
83
+ - [core] Use runtime agnostic setTimeout type @oliviertassinari
84
+ - [docs-infra] Fix Stack Overflow breaking space @oliviertassinari
85
+ - [docs-infra] Fix missing non breaking spaces @oliviertassinari
86
+ - [github] Update `no-response` workflow (#12193) @MBilalShafi
87
+ - [infra] Fix missing permission reset @oliviertassinari
88
+
6
89
  ## 7.0.0-beta.4
7
90
 
8
91
  _Feb 23, 2024_
@@ -49,7 +132,7 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.4`.
49
132
  <DateField
50
133
  - selectedSections={{ startIndex: 0, endIndex: 0 }}
51
134
  + selectedSections={0}
52
-
135
+
53
136
  // If the field has 3 sections
54
137
  - selectedSections={{ startIndex: 0, endIndex: 2 }}
55
138
  + selectedSections="all"
@@ -68,20 +151,20 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-beta.4`.
68
151
  + enableAccessibleFieldDOMStructure,
69
152
  // ... rest of the props you are using
70
153
  } = props;
71
-
154
+
72
155
  return ( /* Some UI to edit the date */ )
73
156
  }
74
-
157
+
75
158
  function MyCustomField(props) {
76
159
  const fieldResponse = useDateField<Dayjs, false, typeof textFieldProps>({
77
160
  ...props,
78
161
  + // If you only support one DOM structure, we advise you to hardcode it here to avoid unwanted switches in your application
79
162
  + enableAccessibleFieldDOMStructure: false,
80
163
  });
81
-
164
+
82
165
  return <MyCustomTextField ref={ref} {...fieldResponse} />;
83
166
  }
84
-
167
+
85
168
  function App() {
86
169
  return <DatePicker slots={{ field: MyCustomField }} />;
87
170
  }
@@ -2352,6 +2435,47 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
2352
2435
  - [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
2353
2436
  - [license] Correctly throw errors (#10924) @oliviertassinari
2354
2437
 
2438
+ ## 6.19.6
2439
+
2440
+ _Mar 1, 2024_
2441
+
2442
+ We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
2443
+
2444
+ - 🌍 Improve Korean (ko-KR) and Chinese (zh-CN) locales on the Pickers
2445
+ - 🐞 Bugfixes
2446
+ - 📚 Documentation improvements
2447
+
2448
+ ### Data Grid
2449
+
2450
+ #### `@mui/x-data-grid@6.19.6`
2451
+
2452
+ - [DataGrid] Fix error when existing rows are passed to `replaceRows` (@martijn-basesoft)
2453
+
2454
+ #### `@mui/x-data-grid-pro@6.19.6` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
2455
+
2456
+ Same changes as in `@mui/x-data-grid@6.19.6`.
2457
+
2458
+ #### `@mui/x-data-grid-premium@6.19.6` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
2459
+
2460
+ Same changes as in `@mui/x-data-grid-pro@6.19.6`, plus:
2461
+
2462
+ - [DataGridPremium] Make clipboard copy respect the sorting during cell selection (#12255) @MBilalShafi
2463
+
2464
+ ### Date Pickers
2465
+
2466
+ #### `@mui/x-date-pickers@6.19.6`
2467
+
2468
+ - [l10n] Improve Chinese (zh-CN) locale (#12250) @headironc
2469
+ - [l10n] Improve Korean (ko-KR) locale (#12186) @Luzi
2470
+
2471
+ #### `@mui/x-date-pickers-pro@6.19.6` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
2472
+
2473
+ Same changes as in `@mui/x-date-pickers@6.19.6`.
2474
+
2475
+ ### Docs
2476
+
2477
+ - [docs] Update lazy loading demo to show skeleton rows during initial rows fetch (#12062) @cherniavskii
2478
+
2355
2479
  ## 6.19.5
2356
2480
 
2357
2481
  _Feb 23, 2024_
@@ -2394,8 +2518,8 @@ Same changes as in `@mui/x-date-pickers@6.19.5`.
2394
2518
 
2395
2519
  - [docs] Clarify Pickers 'Component composition' section (#12147) @LukasTy
2396
2520
  - [docs] Fix 301 redirection to StackBlitz @oliviertassinari
2397
- - [docs] Fix 301 to Material UI @oliviertassinari
2398
- - [docs] Fix 301 to Material UI @oliviertassinari
2521
+ - [docs] Fix 301 to Material UI @oliviertassinari
2522
+ - [docs] Fix 301 to Material UI @oliviertassinari
2399
2523
  - [docs] Fix 404 links to translation source @oliviertassinari
2400
2524
  - [docs] Fix dead link to translations @oliviertassinari
2401
2525
  - [docs] Fix the Treemap illustration (#12189) @danilo-leal
@@ -4264,7 +4388,7 @@ We'd like to offer a big thanks to the 13 contributors who made this release pos
4264
4388
 
4265
4389
  #### `@mui/x-data-grid@6.9.1`
4266
4390
 
4267
- - [DataGrid] Add Joy UI `tooltip` and `loadingOverlay` slots (#9028) @cherniavskii
4391
+ - [DataGrid] Add Joy UI `tooltip` and `loadingOverlay` slots (#9028) @cherniavskii
4268
4392
  - [DataGrid] Add section about enabling pagination on Pro and Premium (#8759) @joserodolfofreitas
4269
4393
  - [DataGrid] Don't forward `editCellState` prop to DOM element (#9501) @m4theushw
4270
4394
  - [DataGrid] Add experimental API for faster filtering performance (#9254) @romgrk
@@ -4395,7 +4519,7 @@ Same changes as in `@mui/x-date-pickers@6.9.0`.
4395
4519
  - [docs] Fix random screenshot generation (#9364) @cherniavskii
4396
4520
  - [docs] Remove random generation from chart doc example (#9343) @flaviendelangle
4397
4521
  - [docs] Sync h1 with sidenav link (#9252) @oliviertassinari
4398
- - [docs] Use the mui-x Stack Overflow tag (#9352) @oliviertassinari
4522
+ - [docs] Use the mui-x Stack Overflow tag (#9352) @oliviertassinari
4399
4523
 
4400
4524
  ### Core
4401
4525
 
@@ -4722,8 +4846,8 @@ We'd like to offer a big thanks to the 12 contributors who made this release pos
4722
4846
 
4723
4847
  - [DataGrid] Fix DataGrid rendering in JSDOM (#8968) @cherniavskii
4724
4848
  - [DataGrid] Fix layout when rendered inside a parent with `display: grid` (#8577) @cherniavskii
4725
- - [DataGrid] Add Joy UI icon slots (#8940) @siriwatknp
4726
- - [DataGrid] Add Joy UI pagination slot (#8871) @cherniavskii
4849
+ - [DataGrid] Add Joy UI icon slots (#8940) @siriwatknp
4850
+ - [DataGrid] Add Joy UI pagination slot (#8871) @cherniavskii
4727
4851
  - [DataGrid] Extract `baseChip` slot (#8748) @cherniavskii
4728
4852
  - [DataGridPremium] Implement Clipboard import (#7389) @cherniavskii
4729
4853
  - [l10n] Improve French (fr-FR) locale (#8825) @allereaugabriel
@@ -4773,7 +4897,7 @@ We'd like to offer a big thanks to the 7 contributors who made this release poss
4773
4897
  - [DataGrid] Fix falsy filter values not showing in filter button tooltip (#8550) @ithrforu
4774
4898
  - [DataGrid] Fix missing watermark in Pro and Premium packages (#8797) @cherniavskii
4775
4899
  - [DataGrid] Remove unwarranted warning log (#8847) @romgrk
4776
- - [DataGrid] Add Joy UI slots (`Select`, `SelectOption`, `InputLabel`, `FormControl`) (#8747) @cherniavskii
4900
+ - [DataGrid] Add Joy UI slots (`Select`, `SelectOption`, `InputLabel`, `FormControl`) (#8747) @cherniavskii
4777
4901
  - [DataGridPremium] Fix expanded groups being collapsed after calling `updateRows` (#8823) @cherniavskii
4778
4902
 
4779
4903
  ### `@mui/x-date-pickers@6.3.1` / `@mui/x-date-pickers-pro@6.3.1`
@@ -4824,7 +4948,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
4824
4948
  - [DataGrid] Add overlay classes to `gridClasses` (#8686) @lindapaiste
4825
4949
  - [DataGrid] Avoid passing `api` prop to div (#8679) @someden
4826
4950
  - [DataGrid] Fix 'ResizeObserver loop limit exceeded' error (#8744) @m4theushw
4827
- - [DataGrid] Add Joy UI slots (button and switch) (#8699) @siriwatknp
4951
+ - [DataGrid] Add Joy UI slots (button and switch) (#8699) @siriwatknp
4828
4952
  - [DataGrid] Fix aggregation label alignment (#8694) @joserodolfofreitas
4829
4953
  - [DataGridPremium] Fix infinite loop when updating grouped rows (#8693) @cherniavskii
4830
4954
  - [DataGridPro] Fix error after updating `columns` and `columnGroupingModel` at once (#8730) @cherniavskii
@@ -4886,7 +5010,7 @@ We'd like to offer a big thanks to the 9 contributors who made this release poss
4886
5010
  #### Changes
4887
5011
 
4888
5012
  - [DataGrid] Add `getTogglableColumns` to `Hide all` and `Show all` actions (#8496) @MBilalShafi
4889
- - [DataGrid] Add Grid + Joy UI experiment page (#8067) @cherniavskii
5013
+ - [DataGrid] Add Grid + Joy UI experiment page (#8067) @cherniavskii
4890
5014
  - [DataGrid] Fix print style when rendering inside Shadow DOM (#8656) @Bwatermelon
4891
5015
  - [DataGrid] Replace `GridAutoSizer` with `ResizeObserver` (#8091) @m4theushw
4892
5016
  - [DataGrid] Use stable ID for the placeholder filter item (#8603) @m4theushw
@@ -1,3 +1,5 @@
1
+ 'use client';
2
+
1
3
  import _extends from "@babel/runtime/helpers/esm/extends";
2
4
  import * as React from 'react';
3
5
  import PropTypes from 'prop-types';
@@ -5,7 +5,7 @@ export const getGridBooleanOperators = () => [{
5
5
  if (!filterItem.value) {
6
6
  return null;
7
7
  }
8
- const valueAsBoolean = filterItem.value === 'true';
8
+ const valueAsBoolean = String(filterItem.value) === 'true';
9
9
  return value => {
10
10
  return Boolean(value) === valueAsBoolean;
11
11
  };
@@ -2,9 +2,10 @@ import * as React from 'react';
2
2
  import { GridRowId, GridRowModel } from '../models/gridRows';
3
3
  import type { GridPinnedColumns } from '../hooks/features/columns';
4
4
  import type { GridStateColDef } from '../models/colDef/gridColDef';
5
- import type { GridVirtualizationState } from '../hooks/features/virtualization';
5
+ import type { GridRenderContext } from '../models/params/gridScrollParams';
6
6
  import type { GridDimensions } from '../hooks/features/dimensions';
7
7
  export interface GridRowProps extends React.HTMLAttributes<HTMLDivElement> {
8
+ row: GridRowModel;
8
9
  rowId: GridRowId;
9
10
  selected: boolean;
10
11
  /**
@@ -13,28 +14,25 @@ export interface GridRowProps extends React.HTMLAttributes<HTMLDivElement> {
13
14
  */
14
15
  index: number;
15
16
  rowHeight: number | 'auto';
16
- offsets: GridVirtualizationState['offsets'];
17
+ offsetTop: number | undefined;
18
+ offsetLeft: number;
17
19
  dimensions: GridDimensions;
18
- firstColumnToRender: number;
19
- lastColumnToRender: number;
20
+ renderContext: GridRenderContext;
20
21
  visibleColumns: GridStateColDef[];
21
- renderedColumns: GridStateColDef[];
22
22
  pinnedColumns: GridPinnedColumns;
23
23
  /**
24
24
  * Determines which cell has focus.
25
25
  * If `null`, no cell in this row has focus.
26
26
  */
27
- focusedCell: string | null;
27
+ focusedColumnIndex: number | undefined;
28
28
  /**
29
29
  * Determines which cell should be tabbable by having tabIndex=0.
30
30
  * If `null`, no cell in this row is in the tab sequence.
31
31
  */
32
32
  tabbableCell: string | null;
33
- row?: GridRowModel;
34
33
  isFirstVisible: boolean;
35
34
  isLastVisible: boolean;
36
- focusedCellColumnIndexNotInRange?: number;
37
- isNotVisible?: boolean;
35
+ isNotVisible: boolean;
38
36
  onClick?: React.MouseEventHandler<HTMLDivElement>;
39
37
  onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
40
38
  onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "pinnedColumns", "offsets", "dimensions", "firstColumnToRender", "lastColumnToRender", "isFirstVisible", "isLastVisible", "focusedCellColumnIndexNotInRange", "isNotVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
3
+ const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -21,7 +21,6 @@ import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSele
21
21
  import { gridRowMaximumTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
22
22
  import { gridColumnGroupsHeaderMaxDepthSelector } from '../hooks/features/columnGrouping/gridColumnGroupsSelector';
23
23
  import { gridEditRowsStateSelector } from '../hooks/features/editing/gridEditingSelectors';
24
- import { randomNumberBetween } from '../utils/utils';
25
24
  import { PinnedPosition } from './cell/GridCell';
26
25
  import { GridScrollbarFillerCell as ScrollbarFiller } from './GridScrollbarFillerCell';
27
26
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -65,16 +64,14 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
65
64
  rowHeight,
66
65
  className,
67
66
  visibleColumns,
68
- renderedColumns,
69
67
  pinnedColumns,
70
- offsets,
68
+ offsetLeft,
71
69
  dimensions,
72
- firstColumnToRender,
70
+ renderContext,
71
+ focusedColumnIndex,
73
72
  isFirstVisible,
74
73
  isLastVisible,
75
- focusedCellColumnIndexNotInRange,
76
74
  isNotVisible,
77
- focusedCell,
78
75
  onClick,
79
76
  onDoubleClick,
80
77
  onMouseEnter,
@@ -95,6 +92,9 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
95
92
  const handleRef = useForkRef(ref, refProp);
96
93
  const rowNode = apiRef.current.getRowNode(rowId);
97
94
  const scrollbarWidth = dimensions.hasScrollY ? dimensions.scrollbarSize : 0;
95
+ const hasFocusCell = focusedColumnIndex !== undefined;
96
+ const hasVirtualFocusCellLeft = hasFocusCell && focusedColumnIndex >= pinnedColumns.left.length && focusedColumnIndex < renderContext.firstColumnIndex;
97
+ const hasVirtualFocusCellRight = hasFocusCell && focusedColumnIndex < visibleColumns.length - pinnedColumns.right.length && focusedColumnIndex >= renderContext.lastColumnIndex;
98
98
  const ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
99
99
 
100
100
  const ownerState = {
@@ -245,13 +245,14 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
245
245
  });
246
246
  rowClassNames.push(rootProps.getRowClassName(rowParams));
247
247
  }
248
- const randomNumber = randomNumberBetween(10000, 20, 80);
249
248
  const getCell = (column, indexInSection, indexRelativeToAllColumns, sectionLength, pinnedPosition = PinnedPosition.NONE) => {
250
- var _editRowsState$rowId$, _editRowsState$rowId;
249
+ var _cellColSpanInfo$cell, _cellColSpanInfo$cell2, _editRowsState$rowId$, _editRowsState$rowId;
251
250
  const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
252
- if (!cellColSpanInfo || cellColSpanInfo.spannedByColSpan) {
251
+ if (cellColSpanInfo != null && cellColSpanInfo.spannedByColSpan) {
253
252
  return null;
254
253
  }
254
+ const width = (_cellColSpanInfo$cell = cellColSpanInfo == null ? void 0 : cellColSpanInfo.cellProps.width) != null ? _cellColSpanInfo$cell : column.computedWidth;
255
+ const colSpan = (_cellColSpanInfo$cell2 = cellColSpanInfo == null ? void 0 : cellColSpanInfo.cellProps.colSpan) != null ? _cellColSpanInfo$cell2 : 1;
255
256
  let pinnedOffset;
256
257
  // FIXME: Why is the switch check exhaustiveness not validated with typescript-eslint?
257
258
  // eslint-disable-next-line default-case
@@ -263,26 +264,19 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
263
264
  pinnedOffset = dimensions.columnsTotalWidth - columnPositions[indexRelativeToAllColumns] - column.computedWidth + scrollbarWidth;
264
265
  break;
265
266
  case PinnedPosition.NONE:
267
+ case PinnedPosition.VIRTUAL:
266
268
  pinnedOffset = 0;
267
269
  break;
268
270
  }
269
271
  if ((rowNode == null ? void 0 : rowNode.type) === 'skeletonRow') {
270
272
  var _column$align;
271
- const {
272
- width
273
- } = cellColSpanInfo.cellProps;
274
- const contentWidth = Math.round(randomNumber());
275
273
  return /*#__PURE__*/_jsx(slots.skeletonCell, {
276
274
  width: width,
277
- contentWidth: contentWidth,
275
+ height: rowHeight,
278
276
  field: column.field,
279
277
  align: (_column$align = column.align) != null ? _column$align : 'left'
280
278
  }, column.field);
281
279
  }
282
- const {
283
- colSpan,
284
- width
285
- } = cellColSpanInfo.cellProps;
286
280
  const editCellState = (_editRowsState$rowId$ = (_editRowsState$rowId = editRowsState[rowId]) == null ? void 0 : _editRowsState$rowId[column.field]) != null ? _editRowsState$rowId$ : null;
287
281
 
288
282
  // when the cell is a reorder cell we are not allowing to reorder the col
@@ -292,10 +286,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
292
286
  const canReorderColumn = !(disableColumnReorder || column.disableReorder);
293
287
  const canReorderRow = rowReordering && !sortModel.length && treeDepth <= 1 && !isEditingRows;
294
288
  const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow);
295
- let cellIsNotVisible = false;
296
- if (focusedCellColumnIndexNotInRange !== undefined && visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
297
- cellIsNotVisible = true;
298
- }
289
+ const cellIsNotVisible = pinnedPosition === PinnedPosition.VIRTUAL;
299
290
  return /*#__PURE__*/_jsx(slots.cell, _extends({
300
291
  column: column,
301
292
  width: width,
@@ -331,18 +322,16 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
331
322
  });
332
323
  const middleColumnsLength = visibleColumns.length - pinnedColumns.left.length - pinnedColumns.right.length;
333
324
  const cells = [];
334
- for (let i = 0; i < renderedColumns.length; i += 1) {
335
- const column = renderedColumns[i];
336
- let indexRelativeToAllColumns = firstColumnToRender + i;
337
- if (focusedCellColumnIndexNotInRange !== undefined && focusedCell) {
338
- if (visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
339
- indexRelativeToAllColumns = focusedCellColumnIndexNotInRange;
340
- } else {
341
- indexRelativeToAllColumns -= 1;
342
- }
343
- }
344
- const indexInSection = indexRelativeToAllColumns - pinnedColumns.left.length;
345
- cells.push(getCell(column, indexInSection, indexRelativeToAllColumns, middleColumnsLength));
325
+ if (hasVirtualFocusCellLeft) {
326
+ cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, PinnedPosition.VIRTUAL));
327
+ }
328
+ for (let i = renderContext.firstColumnIndex; i < renderContext.lastColumnIndex; i += 1) {
329
+ const column = visibleColumns[i];
330
+ const indexInSection = i - pinnedColumns.left.length;
331
+ cells.push(getCell(column, indexInSection, i, middleColumnsLength));
332
+ }
333
+ if (hasVirtualFocusCellRight) {
334
+ cells.push(getCell(visibleColumns[focusedColumnIndex], focusedColumnIndex - pinnedColumns.left.length, focusedColumnIndex, middleColumnsLength, PinnedPosition.VIRTUAL));
346
335
  }
347
336
  const eventHandlers = row ? {
348
337
  onClick: publishClick,
@@ -368,7 +357,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
368
357
  role: "presentation",
369
358
  className: gridClasses.cellOffsetLeft,
370
359
  style: {
371
- width: offsets.left
360
+ width: offsetLeft
372
361
  }
373
362
  }), cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
374
363
  width: emptyCellWidth
@@ -422,13 +411,11 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
422
411
  width: PropTypes.number.isRequired
423
412
  }).isRequired
424
413
  }).isRequired,
425
- firstColumnToRender: PropTypes.number.isRequired,
426
414
  /**
427
415
  * Determines which cell has focus.
428
416
  * If `null`, no cell in this row has focus.
429
417
  */
430
- focusedCell: PropTypes.string,
431
- focusedCellColumnIndexNotInRange: PropTypes.number,
418
+ focusedColumnIndex: PropTypes.number,
432
419
  /**
433
420
  * Index of the row in the whole sorted and filtered dataset.
434
421
  * If some rows above have expanded children, this index also take those children into account.
@@ -436,19 +423,21 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
436
423
  index: PropTypes.number.isRequired,
437
424
  isFirstVisible: PropTypes.bool.isRequired,
438
425
  isLastVisible: PropTypes.bool.isRequired,
439
- isNotVisible: PropTypes.bool,
440
- lastColumnToRender: PropTypes.number.isRequired,
441
- offsets: PropTypes.shape({
442
- left: PropTypes.number.isRequired,
443
- top: PropTypes.number.isRequired
444
- }).isRequired,
426
+ isNotVisible: PropTypes.bool.isRequired,
427
+ offsetLeft: PropTypes.number.isRequired,
428
+ offsetTop: PropTypes.number,
445
429
  onClick: PropTypes.func,
446
430
  onDoubleClick: PropTypes.func,
447
431
  onMouseEnter: PropTypes.func,
448
432
  onMouseLeave: PropTypes.func,
449
433
  pinnedColumns: PropTypes.object.isRequired,
450
- renderedColumns: PropTypes.arrayOf(PropTypes.object).isRequired,
451
- row: PropTypes.object,
434
+ renderContext: PropTypes.shape({
435
+ firstColumnIndex: PropTypes.number.isRequired,
436
+ firstRowIndex: PropTypes.number.isRequired,
437
+ lastColumnIndex: PropTypes.number.isRequired,
438
+ lastRowIndex: PropTypes.number.isRequired
439
+ }).isRequired,
440
+ row: PropTypes.object.isRequired,
452
441
  rowHeight: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
453
442
  rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
454
443
  selected: PropTypes.bool.isRequired,
@@ -4,7 +4,8 @@ import { GridColDef, GridAlignment } from '../../models/colDef/gridColDef';
4
4
  export declare enum PinnedPosition {
5
5
  NONE = 0,
6
6
  LEFT = 1,
7
- RIGHT = 2
7
+ RIGHT = 2,
8
+ VIRTUAL = 3
8
9
  }
9
10
  export type GridCellProps = {
10
11
  align: GridAlignment;
@@ -20,6 +20,7 @@ export let PinnedPosition = /*#__PURE__*/function (PinnedPosition) {
20
20
  PinnedPosition[PinnedPosition["NONE"] = 0] = "NONE";
21
21
  PinnedPosition[PinnedPosition["LEFT"] = 1] = "LEFT";
22
22
  PinnedPosition[PinnedPosition["RIGHT"] = 2] = "RIGHT";
23
+ PinnedPosition[PinnedPosition["VIRTUAL"] = 3] = "VIRTUAL";
23
24
  return PinnedPosition;
24
25
  }({});
25
26
  const EMPTY_CELL_PARAMS = {
@@ -132,10 +133,13 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
132
133
  classes: rootClasses,
133
134
  getCellClassName
134
135
  } = rootProps;
135
- const classNames = apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
136
+
137
+ // There is a hidden grid state access in `applyPipeProcessor('cellClassName', ...)`
138
+ const pipesClassName = useGridSelector(apiRef, () => apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
136
139
  id: rowId,
137
140
  field
138
- });
141
+ }).filter(Boolean).join(' '));
142
+ const classNames = [pipesClassName];
139
143
  if (column.cellClassName) {
140
144
  classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(cellParamsWithAPI) : column.cellClassName);
141
145
  }
@@ -331,7 +335,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
331
335
  onMouseDown: PropTypes.func,
332
336
  onMouseUp: PropTypes.func,
333
337
  pinnedOffset: PropTypes.number.isRequired,
334
- pinnedPosition: PropTypes.oneOf([0, 1, 2]).isRequired,
338
+ pinnedPosition: PropTypes.oneOf([0, 1, 2, 3]).isRequired,
335
339
  rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
336
340
  sectionIndex: PropTypes.number.isRequired,
337
341
  sectionLength: PropTypes.number.isRequired,
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  export interface GridSkeletonCellProps {
3
3
  width: number;
4
- contentWidth: number;
4
+ height: number | 'auto';
5
5
  field: string;
6
6
  align: string;
7
7
  }
@@ -9,4 +9,5 @@ declare function GridSkeletonCell(props: React.HTMLAttributes<HTMLDivElement> &
9
9
  declare namespace GridSkeletonCell {
10
10
  var propTypes: any;
11
11
  }
12
- export { GridSkeletonCell };
12
+ declare const Memoized: typeof GridSkeletonCell;
13
+ export { Memoized as GridSkeletonCell };
@@ -1,13 +1,16 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["field", "align", "width", "contentWidth"];
3
+ const _excluded = ["field", "align", "width", "height"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import Skeleton from '@mui/material/Skeleton';
7
7
  import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
8
+ import { fastMemo } from '../../utils/fastMemo';
9
+ import { randomNumberBetween } from '../../utils/utils';
8
10
  import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
9
11
  import { getDataGridUtilityClass } from '../../constants/gridClasses';
10
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ const randomWidth = randomNumberBetween(10000, 20, 80);
11
14
  const useUtilityClasses = ownerState => {
12
15
  const {
13
16
  align,
@@ -22,7 +25,7 @@ function GridSkeletonCell(props) {
22
25
  const {
23
26
  align,
24
27
  width,
25
- contentWidth
28
+ height
26
29
  } = props,
27
30
  other = _objectWithoutPropertiesLoose(props, _excluded);
28
31
  const rootProps = useGridRootProps();
@@ -31,14 +34,18 @@ function GridSkeletonCell(props) {
31
34
  align
32
35
  };
33
36
  const classes = useUtilityClasses(ownerState);
37
+ const contentWidth = Math.round(randomWidth());
34
38
  return /*#__PURE__*/_jsx("div", _extends({
35
39
  className: classes.root,
36
40
  style: {
37
- width
41
+ height,
42
+ maxWidth: width,
43
+ minWidth: width
38
44
  }
39
45
  }, other, {
40
46
  children: /*#__PURE__*/_jsx(Skeleton, {
41
- width: `${contentWidth}%`
47
+ width: `${contentWidth}%`,
48
+ height: 25
42
49
  })
43
50
  }));
44
51
  }
@@ -48,8 +55,9 @@ process.env.NODE_ENV !== "production" ? GridSkeletonCell.propTypes = {
48
55
  // | To update them edit the TypeScript types and run "yarn proptypes" |
49
56
  // ----------------------------------------------------------------------
50
57
  align: PropTypes.string.isRequired,
51
- contentWidth: PropTypes.number.isRequired,
52
58
  field: PropTypes.string.isRequired,
59
+ height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
53
60
  width: PropTypes.number.isRequired
54
61
  } : void 0;
55
- export { GridSkeletonCell };
62
+ const Memoized = fastMemo(GridSkeletonCell);
63
+ export { Memoized as GridSkeletonCell };
@@ -37,7 +37,6 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
37
37
  const checkboxElement = React.useRef(null);
38
38
  const rippleRef = React.useRef(null);
39
39
  const handleRef = useForkRef(checkboxElement, ref);
40
- const element = apiRef.current.getCellElement(id, field);
41
40
  const handleChange = event => {
42
41
  const params = {
43
42
  value: event.target.checked,
@@ -46,10 +45,13 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
46
45
  apiRef.current.publishEvent('rowSelectionCheckboxChange', params, event);
47
46
  };
48
47
  React.useLayoutEffect(() => {
49
- if (tabIndex === 0 && element) {
50
- element.tabIndex = -1;
48
+ if (tabIndex === 0) {
49
+ const element = apiRef.current.getCellElement(id, field);
50
+ if (element) {
51
+ element.tabIndex = -1;
52
+ }
51
53
  }
52
- }, [element, tabIndex]);
54
+ }, [apiRef, tabIndex, id, field]);
53
55
  React.useEffect(() => {
54
56
  if (hasFocus) {
55
57
  var _checkboxElement$curr;
@@ -156,7 +156,7 @@ function GridColumnsManagement(props) {
156
156
  ownerState: rootProps,
157
157
  children: apiRef.current.getLocaleText('columnsManagementNoColumns')
158
158
  })]
159
- }), !disableShowHideToggle && !disableResetButton && currentColumns.length > 0 ? /*#__PURE__*/_jsxs(GridColumnsManagementFooter, {
159
+ }), (!disableShowHideToggle || !disableResetButton) && currentColumns.length > 0 ? /*#__PURE__*/_jsxs(GridColumnsManagementFooter, {
160
160
  ownerState: rootProps,
161
161
  className: classes.footer,
162
162
  children: [!disableShowHideToggle ? /*#__PURE__*/_jsx(FormControlLabel, {