@mui/x-data-grid 7.1.0 → 7.1.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 (44) hide show
  1. package/CHANGELOG.md +175 -4
  2. package/README.md +1 -1
  3. package/components/cell/GridCell.js +0 -1
  4. package/components/virtualization/GridMainContainer.js +8 -1
  5. package/components/virtualization/GridTopContainer.js +1 -0
  6. package/hooks/features/headerFiltering/useGridHeaderFiltering.d.ts +2 -2
  7. package/hooks/features/headerFiltering/useGridHeaderFiltering.js +4 -7
  8. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +2 -2
  9. package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -3
  10. package/hooks/features/virtualization/useGridVirtualScroller.js +17 -6
  11. package/index.js +1 -1
  12. package/internals/index.d.ts +1 -1
  13. package/internals/utils/propValidation.d.ts +1 -0
  14. package/internals/utils/propValidation.js +9 -4
  15. package/locales/esES.js +3 -4
  16. package/locales/faIR.js +3 -4
  17. package/locales/ptBR.js +3 -4
  18. package/models/gridExport.d.ts +2 -2
  19. package/models/gridFilterModel.d.ts +3 -3
  20. package/models/params/gridCellParams.d.ts +0 -22
  21. package/models/props/DataGridProps.d.ts +19 -0
  22. package/modern/components/cell/GridCell.js +0 -1
  23. package/modern/components/virtualization/GridMainContainer.js +8 -1
  24. package/modern/components/virtualization/GridTopContainer.js +1 -0
  25. package/modern/hooks/features/headerFiltering/useGridHeaderFiltering.js +4 -7
  26. package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -3
  27. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +17 -6
  28. package/modern/index.js +1 -1
  29. package/modern/internals/utils/propValidation.js +9 -4
  30. package/modern/locales/esES.js +3 -4
  31. package/modern/locales/faIR.js +3 -4
  32. package/modern/locales/ptBR.js +3 -4
  33. package/node/components/cell/GridCell.js +0 -1
  34. package/node/components/virtualization/GridMainContainer.js +8 -1
  35. package/node/components/virtualization/GridTopContainer.js +1 -0
  36. package/node/hooks/features/headerFiltering/useGridHeaderFiltering.js +4 -7
  37. package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +1 -3
  38. package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -6
  39. package/node/index.js +1 -1
  40. package/node/internals/utils/propValidation.js +12 -6
  41. package/node/locales/esES.js +3 -4
  42. package/node/locales/faIR.js +3 -4
  43. package/node/locales/ptBR.js +3 -4
  44. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,107 @@
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.1.1
7
+
8
+ _Apr 5, 2024_
9
+
10
+ We'd like to offer a big thanks to the 19 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🚀 Add `setItemExpansion` Tree View API method (#12595) @flaviendelangle
13
+ - 🌍 Improve Persian (fa-IR), Portuguese (pt-BR), and Spanish (es-ES) locale on the Data Grid
14
+ - 🌍 Improve Persian (fa-IR), Portuguese (pt-BR), and Ukrainian (uk-UA) locale on the Pickers
15
+ - 🐞 Bugfixes
16
+ - 📚 Documentation improvements
17
+
18
+ ### Data Grid
19
+
20
+ #### `@mui/x-data-grid@7.1.1`
21
+
22
+ - [DataGrid] Allow higher packages' props to be used in MIT (#12365) @MBilalShafi
23
+ - [DataGrid] Fix RTL mode (#12583) @romgrk
24
+ - [DataGrid] Fix `ColDefChangesGridNoSnap` demo crash (#12663) @MBilalShafi
25
+ - [DataGrid] Fix server-side filter demo not working (#12662) @MBilalShafi
26
+ - [DataGrid] Log error if `rowCount` is used with client-side pagination (#12448) @michelengelen
27
+ - [DataGrid] Remove `GridFormatterParams` completely (#12660) @romgrk
28
+ - [DataGrid] Restore main slot (#12657) @romgrk
29
+ - [l10n] Improve Persian (fa-IR) locale (#12630) @amirhosseinzf
30
+ - [l10n] Improve Portuguese (pt-BR) locale (#12618) @hugoalkimim
31
+ - [l10n] Improve Spanish (es-ES) locale (#12606) @aitor40
32
+
33
+ #### `@mui/x-data-grid-pro@7.1.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
34
+
35
+ Same changes as in `@mui/x-data-grid@7.1.1`.
36
+
37
+ #### `@mui/x-data-grid-premium@7.1.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
38
+
39
+ Same changes as in `@mui/x-data-grid-pro@7.1.1`.
40
+
41
+ ### Date and Time Pickers
42
+
43
+ #### `@mui/x-date-pickers@7.1.1`
44
+
45
+ - [fields] Fix `readOnly` behavior (#12609) @LukasTy
46
+ - [l10n] Improve Persian (fa-IR) locale (#12632) @misafari
47
+ - [l10n] Improve Portuguese (pt-BR) locale (#12613) @cnHealth
48
+ - [l10n] Improve Ukrainian (uk-UA) locale (#12627) @alexkobylansky
49
+
50
+ #### `@mui/x-date-pickers-pro@7.1.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
51
+
52
+ Same changes as in `@mui/x-date-pickers@7.1.1`, plus:
53
+
54
+ - [DateTimeRangePicker] Fix selection on same day (#12604) @LukasTy
55
+
56
+ ### Charts
57
+
58
+ #### `@mui/x-charts@7.1.1`
59
+
60
+ - [charts] Fix `tickInterval` usage for y-axis (#12592) @alexfauquette
61
+ - [charts] Fix Scatter series highlight when `id` is a `number` (#12677) @JCQuintas
62
+ - [charts] Fix TS error when using `sx` property on `ChartsTooltip` (#12659) @JCQuintas
63
+
64
+ ### Tree View
65
+
66
+ #### `@mui/x-tree-view@7.1.1`
67
+
68
+ - [TreeView] Add JSDoc to all `publicAPI` methods (#12649) @flaviendelangle
69
+ - [TreeView] Create `RichTreeViewPro` component (not released yet) (#12610) @flaviendelangle
70
+ - [TreeView] Create pro package (not released yet) (#12240) @flaviendelangle
71
+ - [TreeView] Fix typo in errors (#12623) @alissa-tung
72
+ - [TreeView] New API method: `setItemExpansion` (#12595) @flaviendelangle
73
+
74
+ ### Docs
75
+
76
+ - [docs] Add a recipe for the `checkboxSelectionVisibleOnly` prop (#12646) @michelengelen
77
+ - [docs] Explain the use of `_action: 'delete'` in `processRowUpdate` (#12670) @michelengelen
78
+ - [docs] Fix formatting and typo on migration guide @oliviertassinari
79
+ - [docs] Fix formatting in changelog @oliviertassinari
80
+ - [docs] Fix grammar in TreeView migration doc (#12615) @joshkel
81
+ - [docs] Fix missing closing props in `PieShapeNoSnap` demo (#12636) @alp-ex
82
+ - [docs] Fix type arguments in Custom Field page (#12619) @Juneezee
83
+ - [docs] Fix typo in `getItemId` prop description (#12637) @flaviendelangle
84
+ - [docs] Make the Charts `margin` usage more visible (#12591) @alexfauquette
85
+ - [docs] Match IE 11 spacing with Material UI @oliviertassinari
86
+ - [docs] Move data grid interfaces to standard API page layout (#12016) @alexfauquette
87
+ - [docs] Remove ` around @default values (#12158) @alexfauquette
88
+ - [docs] Remove `day` from the default `dayOfWeekFormatter` function params (#12644) @LukasTy
89
+ - [docs] Use `TreeItem2` for icon expansion example on `RichTreeView` (#12563) @flaviendelangle
90
+
91
+ ### Core
92
+
93
+ - [core] Add cherry-pick `master` to `v6` action (#12648) @LukasTy
94
+ - [core] Fix typo in `@mui/x-tree-view-pro/themeAugmentation` (#12674) @flaviendelangle
95
+ - [core] Introduce `describeTreeView` to run test on `SimpleTreeView` and `RichTreeView`, using `TreeItem` and `TreeItem2` + migrate expansion tests (#12428) @flaviendelangle
96
+ - [core] Limit `test-types` CI step allowed memory (#12651) @LukasTy
97
+ - [core] Remove explicit `express` package (#12602) @LukasTy
98
+ - [core] Update to new embedded translations in the docs package (#12232) @Janpot
99
+ - [core] Use PR labels to identify the package a `l10n` PR belongs to (#12639) @LukasTy
100
+ - [core] Use `describeTreeView` for selection tests (#12647) @flaviendelangle
101
+ - [docs-infra] Adjust the links to search for issues (#11995) @michelengelen
102
+ - [infra] Polish support survey experience (#12624) @oliviertassinari
103
+ - [support-infra] Replace author association with a permission check in survey action (#12068) @michelengelen
104
+ - [support-infra] Fix user permission check (#12669) @michelengelen
105
+ - [test] Fix Tree View test import (#12668) @LukasTy
106
+
6
107
  ## 7.1.0
7
108
 
8
109
  _Mar 28, 2024_
@@ -74,7 +175,7 @@ Same changes as in `@mui/x-date-pickers@7.1.0`, plus:
74
175
  - [core] Include `DateTimeRangePicker` tag in `releaseChangelog` (#12526) @LukasTy
75
176
  - [core] Upgrade monorepo (#12536) @cherniavskii
76
177
 
77
- ## v7.0.0
178
+ ## 7.0.0
78
179
 
79
180
  _Mar 22, 2024_
80
181
 
@@ -530,13 +631,13 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
530
631
 
531
632
  - 🎁 Introduce a new DOM structure for the field components that provides a better accessibility
532
633
  - 🚀 Simplify Data Grid DOM structure for improved performance (#12013) @romgrk
533
- - 🕥 The support for IE11 has been removed (#12151) @flaviendelangle
634
+ - 🕥 The support for IE 11 has been removed (#12151) @flaviendelangle
534
635
  - 🐞 Bugfixes
535
636
  - 📚 Documentation improvements
536
637
 
537
638
  ### Breaking changes
538
639
 
539
- - The support for IE11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE11 is no longer included.
640
+ - The support for IE 11 has been removed from all MUI X packages. The `legacy` bundle that used to support old browsers like IE 11 is no longer included.
540
641
 
541
642
  ### Data Grid
542
643
 
@@ -641,7 +742,7 @@ These components are no longer exported from `@mui/x-charts`:
641
742
 
642
743
  ### Tree View / `@mui/x-tree-view@7.0.0-beta.4`
643
744
 
644
- - [TreeView] Stop using custom `findIndex` to support IE11 (#12129) @flaviendelangle
745
+ - [TreeView] Stop using custom `findIndex` to support IE 11 (#12129) @flaviendelangle
645
746
 
646
747
  ### Docs
647
748
 
@@ -2871,6 +2972,76 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
2871
2972
  - [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
2872
2973
  - [license] Correctly throw errors (#10924) @oliviertassinari
2873
2974
 
2975
+ ## 6.19.9
2976
+
2977
+ _Apr 5, 2024_
2978
+
2979
+ We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
2980
+
2981
+ - 🐞 Bugfixes
2982
+ - 📚 Documentation improvements
2983
+
2984
+ ### Data Grid
2985
+
2986
+ #### `@mui/x-data-grid@6.19.9`
2987
+
2988
+ - [DataGrid] Remove legacy editing API event: `rowEditCommit` (#12087) @MBilalShafi
2989
+
2990
+ #### `@mui/x-data-grid-pro@6.19.9` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
2991
+
2992
+ Same changes as in `@mui/x-data-grid@6.19.9`.
2993
+
2994
+ #### `@mui/x-data-grid-premium@6.19.9` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
2995
+
2996
+ Same changes as in `@mui/x-data-grid-pro@6.19.9`.
2997
+
2998
+ ### Date Pickers
2999
+
3000
+ #### `@mui/x-date-pickers@6.19.9`
3001
+
3002
+ No changes.
3003
+
3004
+ #### `@mui/x-date-pickers-pro@6.19.9` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
3005
+
3006
+ - [DateRangePicker] Fix selection behavior with single input field when `readOnly` (#12605) @LukasTy
3007
+
3008
+ ### Docs
3009
+
3010
+ - [docs] Add a recipe for the `checkboxSelectionVisibleOnly` prop (#12667) @michelengelen
3011
+ - [docs] Explain the use of `_action: 'delete'` in `processRowUpdate` (#12673) @michelengelen
3012
+
3013
+ ### Core
3014
+
3015
+ - [core] Use Circle CI context (#12607) @cherniavskii
3016
+
3017
+ ## 6.19.8
3018
+
3019
+ _Mar 20, 2024_
3020
+
3021
+ We'd like to offer a big thanks to the 3 contributors who made this release possible.
3022
+
3023
+ ### Data Grid
3024
+
3025
+ #### `@mui/x-data-grid@6.19.8`
3026
+
3027
+ - [DataGrid] Fix `ElementType` usage (#12505) @cherniavskii
3028
+ - [DataGrid] Fix cell value formatting on copy (#12483) @sai6855
3029
+ - [DataGrid] Fix checkbox selection when filtering (#12485) @g1mishra
3030
+
3031
+ #### `@mui/x-data-grid-pro@6.19.8` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
3032
+
3033
+ Same changes as in `@mui/x-data-grid@6.19.8`.
3034
+
3035
+ #### `@mui/x-data-grid-premium@6.19.8` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
3036
+
3037
+ Same changes as in `@mui/x-data-grid-pro@6.19.8`, plus:
3038
+
3039
+ - [DataGridPremium] Add support for confirmation before clipboard paste (#12466) @cherniavskii
3040
+
3041
+ ### Docs
3042
+
3043
+ - [docs] Update links to v7 (#12495) @cherniavskii
3044
+
2874
3045
  ## 6.19.7
2875
3046
 
2876
3047
  _Mar 14, 2024_
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # MUI X Data Grid
2
2
 
3
- This package is the Community plan edition of the data grid component.
3
+ This package is the Community plan edition of the Data Grid components.
4
4
  It's part of [MUI X](https://mui.com/x/), an open-core extension of MUI Core, with advanced components.
5
5
 
6
6
  ## Installation
@@ -159,7 +159,6 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
159
159
  const cellRef = React.useRef(null);
160
160
  const handleRef = useForkRef(ref, cellRef);
161
161
  const focusElementRef = React.useRef(null);
162
- // @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
163
162
  const isSelectionMode = rootProps.cellSelection ?? false;
164
163
  const position = gridPinnedColumnPositionLookup[pinnedPosition];
165
164
  const showLeftBorder = shouldCellShowLeftBorder(position, sectionIndex);
@@ -1,17 +1,24 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { styled } from '@mui/system';
4
+ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
4
5
  import { useGridAriaAttributes } from '../../hooks/utils/useGridAriaAttributes';
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
6
- const Element = styled('div')({
7
+ const Element = styled('div', {
8
+ name: 'MuiDataGrid',
9
+ slot: 'Main',
10
+ overridesResolver: (props, styles) => styles.main
11
+ })({
7
12
  flexGrow: 1,
8
13
  position: 'relative',
9
14
  overflow: 'hidden'
10
15
  });
11
16
  export const GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
12
17
  const ariaAttributes = useGridAriaAttributes();
18
+ const rootProps = useGridRootProps();
13
19
  return /*#__PURE__*/_jsx(Element, _extends({
14
20
  ref: ref,
21
+ ownerState: rootProps,
15
22
  className: props.className,
16
23
  tabIndex: -1
17
24
  }, ariaAttributes, {
@@ -21,6 +21,7 @@ const Element = styled('div')({
21
21
  zIndex: 5,
22
22
  bottom: 0,
23
23
  left: 0,
24
+ right: 0,
24
25
  height: 1,
25
26
  width: 'var(--DataGrid-rowWidth)',
26
27
  backgroundColor: 'var(--DataGrid-rowBorderColor)'
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
- import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
3
+ import { DataGridProcessedPropsWithShared } 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'>) => void;
6
+ export declare const useGridHeaderFiltering: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedPropsWithShared, 'signature' | 'headerFilters'>) => void;
@@ -4,7 +4,6 @@ import { useGridApiMethod } from '../../utils/useGridApiMethod';
4
4
  import { useGridLogger } from '../../utils';
5
5
  import { gridColumnLookupSelector, gridColumnVisibilityModelSelector, gridColumnFieldsSelector } from '../columns/gridColumnsSelector';
6
6
  export const headerFilteringStateInitializer = (state, props) => _extends({}, state, {
7
- // @ts-expect-error Access `Pro` prop in MIT
8
7
  headerFiltering: {
9
8
  enabled: props.headerFilters ?? false,
10
9
  editing: null,
@@ -13,8 +12,6 @@ export const headerFilteringStateInitializer = (state, props) => _extends({}, st
13
12
  });
14
13
  export const useGridHeaderFiltering = (apiRef, props) => {
15
14
  const logger = useGridLogger(apiRef, 'useGridHeaderFiltering');
16
- // @ts-expect-error Access `Pro` prop in MIT
17
- const isHeaderFilteringEnabled = props.headerFilters ?? false;
18
15
  const setHeaderFilterState = React.useCallback(headerFilterState => {
19
16
  apiRef.current.setState(state => {
20
17
  // Safety check to avoid MIT users from using it
@@ -24,14 +21,14 @@ export const useGridHeaderFiltering = (apiRef, props) => {
24
21
  }
25
22
  return _extends({}, state, {
26
23
  headerFiltering: {
27
- enabled: isHeaderFilteringEnabled ?? false,
24
+ enabled: props.headerFilters ?? false,
28
25
  editing: headerFilterState.editing ?? null,
29
26
  menuOpen: headerFilterState.menuOpen ?? null
30
27
  }
31
28
  });
32
29
  });
33
30
  apiRef.current.forceUpdate();
34
- }, [apiRef, props.signature, isHeaderFilteringEnabled]);
31
+ }, [apiRef, props.signature, props.headerFilters]);
35
32
  const startHeaderFilterEditMode = React.useCallback(field => {
36
33
  logger.debug(`Starting edit mode on header filter for field: ${field}`);
37
34
  apiRef.current.setHeaderFilterState({
@@ -102,8 +99,8 @@ export const useGridHeaderFiltering = (apiRef, props) => {
102
99
  isFirstRender.current = false;
103
100
  } else {
104
101
  apiRef.current.setHeaderFilterState({
105
- enabled: isHeaderFilteringEnabled
102
+ enabled: props.headerFilters ?? false
106
103
  });
107
104
  }
108
- }, [apiRef, isHeaderFilteringEnabled]);
105
+ }, [apiRef, props.headerFilters]);
109
106
  };
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { GridPrivateApiCommunity } from '../../../models/api/gridApiCommunity';
3
- import { DataGridProcessedProps } from '../../../models/props/DataGridProps';
3
+ import { DataGridProcessedPropsWithShared } from '../../../models/props/DataGridProps';
4
4
  /**
5
5
  * @requires useGridSorting (method) - can be after
6
6
  * @requires useGridFilter (state) - can be after
@@ -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.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'pagination' | 'paginationMode' | 'getRowId' | 'experimentalFeatures' | 'signature'>) => void;
13
+ export declare const useGridKeyboardNavigation: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedPropsWithShared, 'pagination' | 'paginationMode' | 'getRowId' | 'experimentalFeatures' | 'signature' | 'headerFilters'>) => void;
@@ -69,9 +69,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
69
69
  const initialCurrentPageRows = useGridVisibleRows(apiRef, props).rows;
70
70
  const theme = useTheme();
71
71
  const currentPageRows = React.useMemo(() => enrichPageRowsWithPinnedRows(apiRef, initialCurrentPageRows), [apiRef, initialCurrentPageRows]);
72
- const headerFilteringEnabled =
73
- // @ts-expect-error // TODO move relevant code to the `DataGridPro`
74
- props.signature !== 'DataGrid' && props.headerFilters;
72
+ const headerFilteringEnabled = props.signature !== 'DataGrid' && props.headerFilters;
75
73
 
76
74
  /**
77
75
  * @param {number} colIndex Index of the column to focus
@@ -38,9 +38,9 @@ const EMPTY_SCROLL_POSITION = {
38
38
  left: 0
39
39
  };
40
40
  export const EMPTY_DETAIL_PANELS = Object.freeze(new Map());
41
- const createScrollCache = (rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) => ({
41
+ const createScrollCache = (mode, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) => ({
42
42
  direction: ScrollDirection.NONE,
43
- buffer: bufferForDirection(ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
43
+ buffer: bufferForDirection(mode, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
44
44
  });
45
45
  const isJSDOM = typeof window !== 'undefined' ? /jsdom/.test(window.navigator.userAgent) : false;
46
46
  export const useGridVirtualScroller = () => {
@@ -92,7 +92,7 @@ export const useGridVirtualScroller = () => {
92
92
  const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
93
93
  const scrollTimeout = useTimeout();
94
94
  const frozenContext = React.useRef(undefined);
95
- const scrollCache = useLazyRef(() => createScrollCache(rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
95
+ const scrollCache = useLazyRef(() => createScrollCache(theme.direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
96
96
  const focusedCell = {
97
97
  rowIndex: React.useMemo(() => cellFocus ? currentPage.rows.findIndex(row => row.id === cellFocus.id) : -1, [cellFocus, currentPage.rows]),
98
98
  columnIndex: React.useMemo(() => cellFocus ? visibleColumns.findIndex(column => column.field === cellFocus.field) : -1, [cellFocus, visibleColumns])
@@ -157,7 +157,7 @@ export const useGridVirtualScroller = () => {
157
157
  }
158
158
  }
159
159
  scrollCache.direction = direction;
160
- scrollCache.buffer = bufferForDirection(direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6);
160
+ scrollCache.buffer = bufferForDirection(theme.direction, direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6);
161
161
  const inputs = inputsSelector(apiRef, rootProps, enabled, enabledForColumns);
162
162
  const nextRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
163
163
 
@@ -638,7 +638,7 @@ export function areRenderContextsEqual(context1, context2) {
638
638
  export function computeOffsetLeft(columnPositions, renderContext, direction, pinnedLeftLength) {
639
639
  const factor = direction === 'ltr' ? 1 : -1;
640
640
  const left = factor * (columnPositions[renderContext.firstColumnIndex] ?? 0) - (columnPositions[pinnedLeftLength] ?? 0);
641
- return left;
641
+ return Math.abs(left);
642
642
  }
643
643
  function directionForDelta(dx, dy) {
644
644
  if (dx === 0 && dy === 0) {
@@ -660,7 +660,18 @@ function directionForDelta(dx, dy) {
660
660
  }
661
661
  /* eslint-enable */
662
662
  }
663
- function bufferForDirection(direction, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) {
663
+ function bufferForDirection(mode, direction, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) {
664
+ if (mode === 'rtl') {
665
+ switch (direction) {
666
+ case ScrollDirection.LEFT:
667
+ direction = ScrollDirection.RIGHT;
668
+ break;
669
+ case ScrollDirection.RIGHT:
670
+ direction = ScrollDirection.LEFT;
671
+ break;
672
+ default:
673
+ }
674
+ }
664
675
  switch (direction) {
665
676
  case ScrollDirection.NONE:
666
677
  return {
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.1.0
2
+ * @mui/x-data-grid v7.1.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -65,7 +65,7 @@ export { useTimeout } from '../hooks/utils/useTimeout';
65
65
  export { useGridVisibleRows, getVisibleRows } from '../hooks/utils/useGridVisibleRows';
66
66
  export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
67
67
  export type { GridStateInitializer } from '../hooks/utils/useGridInitializeState';
68
- export type { GridExperimentalFeatures, DataGridPropsWithoutDefaultValue, DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing, } from '../models/props/DataGridProps';
68
+ export type { DataGridProSharedPropsWithDefaultValue, DataGridPremiumSharedPropsWithDefaultValue, GridExperimentalFeatures, DataGridPropsWithoutDefaultValue, DataGridPropsWithDefaultValues, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing, } from '../models/props/DataGridProps';
69
69
  export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
70
70
  export * from '../utils/createControllablePromise';
71
71
  export { createSelector, createSelectorMemoized } from '../utils/createSelector';
@@ -2,3 +2,4 @@ import { DataGridProcessedProps } from '../../models/props/DataGridProps';
2
2
  export type PropValidator<TProps> = (props: TProps) => string | undefined;
3
3
  export declare const propValidatorsDataGrid: PropValidator<DataGridProcessedProps>[];
4
4
  export declare const validateProps: <TProps>(props: TProps, validators: PropValidator<TProps>[]) => void;
5
+ export declare const clearWarningsCache: () => void;
@@ -1,9 +1,11 @@
1
- export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined];
2
- const warnedOnceMap = new Set();
1
+ import { isNumber } from '../../utils/utils';
2
+ import { GridSignature } from '../../hooks/utils/useGridApiEventHandler';
3
+ export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined, props => props.signature === GridSignature.DataGrid && props.paginationMode === 'client' && isNumber(props.rowCount) && 'MUI X: Usage of the `rowCount` prop with client side pagination (`paginationMode="client"`) has no effect. `rowCount` is only meant to be used with `paginationMode="server"`.' || undefined];
4
+ const warnedOnceCache = new Set();
3
5
  const warnOnce = message => {
4
- if (!warnedOnceMap.has(message)) {
6
+ if (!warnedOnceCache.has(message)) {
5
7
  console.error(message);
6
- warnedOnceMap.add(message);
8
+ warnedOnceCache.add(message);
7
9
  }
8
10
  };
9
11
  export const validateProps = (props, validators) => {
@@ -16,4 +18,7 @@ export const validateProps = (props, validators) => {
16
18
  warnOnce(warning);
17
19
  }
18
20
  });
21
+ };
22
+ export const clearWarningsCache = () => {
23
+ warnedOnceCache.clear();
19
24
  };
package/locales/esES.js CHANGED
@@ -30,10 +30,9 @@ const esESGrid = {
30
30
  toolbarExportPrint: 'Imprimir',
31
31
  toolbarExportExcel: 'Descargar como Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'Buscar',
34
+ columnsManagementNoColumns: 'Sin columnas',
35
+ columnsManagementShowHideAllText: 'Mostrar/Ocultar todas',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'Agregar filtro',
39
38
  filterPanelRemoveAll: 'Remover todos',
package/locales/faIR.js CHANGED
@@ -30,10 +30,9 @@ const faIRGrid = {
30
30
  toolbarExportPrint: 'چاپ',
31
31
  toolbarExportExcel: 'دانلود به صورت اکسل',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'جستجو',
34
+ columnsManagementNoColumns: 'بدون سطر',
35
+ columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'افزودن فیلتر',
39
38
  filterPanelRemoveAll: 'حذف همه',
package/locales/ptBR.js CHANGED
@@ -30,10 +30,9 @@ const ptBRGrid = {
30
30
  toolbarExportPrint: 'Imprimir',
31
31
  toolbarExportExcel: 'Baixar como Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'Buscar',
34
+ columnsManagementNoColumns: 'Nenhuma coluna',
35
+ columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'Adicionar filtro',
39
38
  filterPanelRemoveAll: 'Remover todos',
@@ -23,7 +23,7 @@ export interface GridExportOptions {
23
23
  export interface GridFileExportOptions<Api extends GridApiCommon = GridApiCommunity> extends GridExportOptions {
24
24
  /**
25
25
  * The string used as the file name.
26
- * @default `document.title`
26
+ * @default document.title
27
27
  */
28
28
  fileName?: string;
29
29
  /**
@@ -61,7 +61,7 @@ export interface GridCsvExportOptions extends GridFileExportOptions {
61
61
  delimiter?: string;
62
62
  /**
63
63
  * The string used as the file name.
64
- * @default `document.title`
64
+ * @default document.title
65
65
  */
66
66
  fileName?: string;
67
67
  /**
@@ -12,18 +12,18 @@ export interface GridFilterModel {
12
12
  /**
13
13
  * - `GridLogicOperator.And`: the row must pass all the filter items.
14
14
  * - `GridLogicOperator.Or`: the row must pass at least on filter item.
15
- * @default `GridLogicOperator.And`
15
+ * @default GridLogicOperator.And
16
16
  */
17
17
  logicOperator?: GridLogicOperator;
18
18
  /**
19
19
  * values used to quick filter rows
20
- * @default `[]`
20
+ * @default []
21
21
  */
22
22
  quickFilterValues?: any[];
23
23
  /**
24
24
  * - `GridLogicOperator.And`: the row must pass all the values.
25
25
  * - `GridLogicOperator.Or`: the row must pass at least one value.
26
- * @default `GridLogicOperator.And`
26
+ * @default GridLogicOperator.And
27
27
  */
28
28
  quickFilterLogicOperator?: GridLogicOperator;
29
29
  /**
@@ -81,28 +81,6 @@ export interface GridRenderEditCellParams<R extends GridValidRowModel = any, V =
81
81
  */
82
82
  api: GridApiCommunity;
83
83
  }
84
- /**
85
- * Object passed as parameter in the column [[GridColDef]] value formatter callback.
86
- */
87
- export interface GridValueFormatterParams<V = any> {
88
- /**
89
- * The grid row id.
90
- * It is not available when the value formatter is called by the filter panel.
91
- */
92
- id?: GridRowId;
93
- /**
94
- * The column field of the cell that triggered the event.
95
- */
96
- field: string;
97
- /**
98
- * The cell value, if the column has valueGetter it is the value returned by it.
99
- */
100
- value: V;
101
- /**
102
- * GridApi that let you manipulate the grid.
103
- */
104
- api: GridApiCommunity;
105
- }
106
84
  /**
107
85
  * Object passed as parameter in the column [[GridColDef]] edit cell props change callback.
108
86
  */
@@ -750,3 +750,22 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
750
750
  */
751
751
  onColumnWidthChange?: GridEventListener<'columnWidthChange'>;
752
752
  }
753
+ export interface DataGridProSharedPropsWithDefaultValue {
754
+ /**
755
+ * If `true`, enables the data grid filtering on header feature.
756
+ * @default false
757
+ */
758
+ headerFilters: boolean;
759
+ }
760
+ export interface DataGridPremiumSharedPropsWithDefaultValue {
761
+ /**
762
+ * If `true`, the cell selection mode is enabled.
763
+ * @default false
764
+ */
765
+ cellSelection: boolean;
766
+ }
767
+ /**
768
+ * Contains the commercial packages' props shared in the MIT version.
769
+ */
770
+ export interface DataGridProcessedPropsWithShared extends DataGridProcessedProps, Partial<DataGridProSharedPropsWithDefaultValue>, Partial<DataGridPremiumSharedPropsWithDefaultValue> {
771
+ }
@@ -159,7 +159,6 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
159
159
  const cellRef = React.useRef(null);
160
160
  const handleRef = useForkRef(ref, cellRef);
161
161
  const focusElementRef = React.useRef(null);
162
- // @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
163
162
  const isSelectionMode = rootProps.cellSelection ?? false;
164
163
  const position = gridPinnedColumnPositionLookup[pinnedPosition];
165
164
  const showLeftBorder = shouldCellShowLeftBorder(position, sectionIndex);
@@ -1,17 +1,24 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { styled } from '@mui/system';
4
+ import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
4
5
  import { useGridAriaAttributes } from '../../hooks/utils/useGridAriaAttributes';
5
6
  import { jsx as _jsx } from "react/jsx-runtime";
6
- const Element = styled('div')({
7
+ const Element = styled('div', {
8
+ name: 'MuiDataGrid',
9
+ slot: 'Main',
10
+ overridesResolver: (props, styles) => styles.main
11
+ })({
7
12
  flexGrow: 1,
8
13
  position: 'relative',
9
14
  overflow: 'hidden'
10
15
  });
11
16
  export const GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
12
17
  const ariaAttributes = useGridAriaAttributes();
18
+ const rootProps = useGridRootProps();
13
19
  return /*#__PURE__*/_jsx(Element, _extends({
14
20
  ref: ref,
21
+ ownerState: rootProps,
15
22
  className: props.className,
16
23
  tabIndex: -1
17
24
  }, ariaAttributes, {
@@ -21,6 +21,7 @@ const Element = styled('div')({
21
21
  zIndex: 5,
22
22
  bottom: 0,
23
23
  left: 0,
24
+ right: 0,
24
25
  height: 1,
25
26
  width: 'var(--DataGrid-rowWidth)',
26
27
  backgroundColor: 'var(--DataGrid-rowBorderColor)'
@@ -4,7 +4,6 @@ import { useGridApiMethod } from '../../utils/useGridApiMethod';
4
4
  import { useGridLogger } from '../../utils';
5
5
  import { gridColumnLookupSelector, gridColumnVisibilityModelSelector, gridColumnFieldsSelector } from '../columns/gridColumnsSelector';
6
6
  export const headerFilteringStateInitializer = (state, props) => _extends({}, state, {
7
- // @ts-expect-error Access `Pro` prop in MIT
8
7
  headerFiltering: {
9
8
  enabled: props.headerFilters ?? false,
10
9
  editing: null,
@@ -13,8 +12,6 @@ export const headerFilteringStateInitializer = (state, props) => _extends({}, st
13
12
  });
14
13
  export const useGridHeaderFiltering = (apiRef, props) => {
15
14
  const logger = useGridLogger(apiRef, 'useGridHeaderFiltering');
16
- // @ts-expect-error Access `Pro` prop in MIT
17
- const isHeaderFilteringEnabled = props.headerFilters ?? false;
18
15
  const setHeaderFilterState = React.useCallback(headerFilterState => {
19
16
  apiRef.current.setState(state => {
20
17
  // Safety check to avoid MIT users from using it
@@ -24,14 +21,14 @@ export const useGridHeaderFiltering = (apiRef, props) => {
24
21
  }
25
22
  return _extends({}, state, {
26
23
  headerFiltering: {
27
- enabled: isHeaderFilteringEnabled ?? false,
24
+ enabled: props.headerFilters ?? false,
28
25
  editing: headerFilterState.editing ?? null,
29
26
  menuOpen: headerFilterState.menuOpen ?? null
30
27
  }
31
28
  });
32
29
  });
33
30
  apiRef.current.forceUpdate();
34
- }, [apiRef, props.signature, isHeaderFilteringEnabled]);
31
+ }, [apiRef, props.signature, props.headerFilters]);
35
32
  const startHeaderFilterEditMode = React.useCallback(field => {
36
33
  logger.debug(`Starting edit mode on header filter for field: ${field}`);
37
34
  apiRef.current.setHeaderFilterState({
@@ -102,8 +99,8 @@ export const useGridHeaderFiltering = (apiRef, props) => {
102
99
  isFirstRender.current = false;
103
100
  } else {
104
101
  apiRef.current.setHeaderFilterState({
105
- enabled: isHeaderFilteringEnabled
102
+ enabled: props.headerFilters ?? false
106
103
  });
107
104
  }
108
- }, [apiRef, isHeaderFilteringEnabled]);
105
+ }, [apiRef, props.headerFilters]);
109
106
  };
@@ -69,9 +69,7 @@ export const useGridKeyboardNavigation = (apiRef, props) => {
69
69
  const initialCurrentPageRows = useGridVisibleRows(apiRef, props).rows;
70
70
  const theme = useTheme();
71
71
  const currentPageRows = React.useMemo(() => enrichPageRowsWithPinnedRows(apiRef, initialCurrentPageRows), [apiRef, initialCurrentPageRows]);
72
- const headerFilteringEnabled =
73
- // @ts-expect-error // TODO move relevant code to the `DataGridPro`
74
- props.signature !== 'DataGrid' && props.headerFilters;
72
+ const headerFilteringEnabled = props.signature !== 'DataGrid' && props.headerFilters;
75
73
 
76
74
  /**
77
75
  * @param {number} colIndex Index of the column to focus
@@ -38,9 +38,9 @@ const EMPTY_SCROLL_POSITION = {
38
38
  left: 0
39
39
  };
40
40
  export const EMPTY_DETAIL_PANELS = Object.freeze(new Map());
41
- const createScrollCache = (rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) => ({
41
+ const createScrollCache = (mode, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) => ({
42
42
  direction: ScrollDirection.NONE,
43
- buffer: bufferForDirection(ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
43
+ buffer: bufferForDirection(mode, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
44
44
  });
45
45
  const isJSDOM = typeof window !== 'undefined' ? /jsdom/.test(window.navigator.userAgent) : false;
46
46
  export const useGridVirtualScroller = () => {
@@ -92,7 +92,7 @@ export const useGridVirtualScroller = () => {
92
92
  const renderContext = useGridSelector(apiRef, gridRenderContextSelector);
93
93
  const scrollTimeout = useTimeout();
94
94
  const frozenContext = React.useRef(undefined);
95
- const scrollCache = useLazyRef(() => createScrollCache(rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
95
+ const scrollCache = useLazyRef(() => createScrollCache(theme.direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
96
96
  const focusedCell = {
97
97
  rowIndex: React.useMemo(() => cellFocus ? currentPage.rows.findIndex(row => row.id === cellFocus.id) : -1, [cellFocus, currentPage.rows]),
98
98
  columnIndex: React.useMemo(() => cellFocus ? visibleColumns.findIndex(column => column.field === cellFocus.field) : -1, [cellFocus, visibleColumns])
@@ -157,7 +157,7 @@ export const useGridVirtualScroller = () => {
157
157
  }
158
158
  }
159
159
  scrollCache.direction = direction;
160
- scrollCache.buffer = bufferForDirection(direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6);
160
+ scrollCache.buffer = bufferForDirection(theme.direction, direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6);
161
161
  const inputs = inputsSelector(apiRef, rootProps, enabled, enabledForColumns);
162
162
  const nextRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
163
163
 
@@ -638,7 +638,7 @@ export function areRenderContextsEqual(context1, context2) {
638
638
  export function computeOffsetLeft(columnPositions, renderContext, direction, pinnedLeftLength) {
639
639
  const factor = direction === 'ltr' ? 1 : -1;
640
640
  const left = factor * (columnPositions[renderContext.firstColumnIndex] ?? 0) - (columnPositions[pinnedLeftLength] ?? 0);
641
- return left;
641
+ return Math.abs(left);
642
642
  }
643
643
  function directionForDelta(dx, dy) {
644
644
  if (dx === 0 && dy === 0) {
@@ -660,7 +660,18 @@ function directionForDelta(dx, dy) {
660
660
  }
661
661
  /* eslint-enable */
662
662
  }
663
- function bufferForDirection(direction, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) {
663
+ function bufferForDirection(mode, direction, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) {
664
+ if (mode === 'rtl') {
665
+ switch (direction) {
666
+ case ScrollDirection.LEFT:
667
+ direction = ScrollDirection.RIGHT;
668
+ break;
669
+ case ScrollDirection.RIGHT:
670
+ direction = ScrollDirection.LEFT;
671
+ break;
672
+ default:
673
+ }
674
+ }
664
675
  switch (direction) {
665
676
  case ScrollDirection.NONE:
666
677
  return {
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.1.0
2
+ * @mui/x-data-grid v7.1.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,9 +1,11 @@
1
- export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined];
2
- const warnedOnceMap = new Set();
1
+ import { isNumber } from '../../utils/utils';
2
+ import { GridSignature } from '../../hooks/utils/useGridApiEventHandler';
3
+ export const propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined, props => props.signature === GridSignature.DataGrid && props.paginationMode === 'client' && isNumber(props.rowCount) && 'MUI X: Usage of the `rowCount` prop with client side pagination (`paginationMode="client"`) has no effect. `rowCount` is only meant to be used with `paginationMode="server"`.' || undefined];
4
+ const warnedOnceCache = new Set();
3
5
  const warnOnce = message => {
4
- if (!warnedOnceMap.has(message)) {
6
+ if (!warnedOnceCache.has(message)) {
5
7
  console.error(message);
6
- warnedOnceMap.add(message);
8
+ warnedOnceCache.add(message);
7
9
  }
8
10
  };
9
11
  export const validateProps = (props, validators) => {
@@ -16,4 +18,7 @@ export const validateProps = (props, validators) => {
16
18
  warnOnce(warning);
17
19
  }
18
20
  });
21
+ };
22
+ export const clearWarningsCache = () => {
23
+ warnedOnceCache.clear();
19
24
  };
@@ -30,10 +30,9 @@ const esESGrid = {
30
30
  toolbarExportPrint: 'Imprimir',
31
31
  toolbarExportExcel: 'Descargar como Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'Buscar',
34
+ columnsManagementNoColumns: 'Sin columnas',
35
+ columnsManagementShowHideAllText: 'Mostrar/Ocultar todas',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'Agregar filtro',
39
38
  filterPanelRemoveAll: 'Remover todos',
@@ -30,10 +30,9 @@ const faIRGrid = {
30
30
  toolbarExportPrint: 'چاپ',
31
31
  toolbarExportExcel: 'دانلود به صورت اکسل',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'جستجو',
34
+ columnsManagementNoColumns: 'بدون سطر',
35
+ columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'افزودن فیلتر',
39
38
  filterPanelRemoveAll: 'حذف همه',
@@ -30,10 +30,9 @@ const ptBRGrid = {
30
30
  toolbarExportPrint: 'Imprimir',
31
31
  toolbarExportExcel: 'Baixar como Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
-
33
+ columnsManagementSearchTitle: 'Buscar',
34
+ columnsManagementNoColumns: 'Nenhuma coluna',
35
+ columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
37
36
  // Filter panel text
38
37
  filterPanelAddFilter: 'Adicionar filtro',
39
38
  filterPanelRemoveAll: 'Remover todos',
@@ -168,7 +168,6 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
168
168
  const cellRef = React.useRef(null);
169
169
  const handleRef = (0, _utils.unstable_useForkRef)(ref, cellRef);
170
170
  const focusElementRef = React.useRef(null);
171
- // @ts-expect-error To access `cellSelection` flag as it's a `premium` feature
172
171
  const isSelectionMode = rootProps.cellSelection ?? false;
173
172
  const position = gridPinnedColumnPositionLookup[pinnedPosition];
174
173
  const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(position, sectionIndex);
@@ -8,19 +8,26 @@ exports.GridMainContainer = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var React = _interopRequireWildcard(require("react"));
10
10
  var _system = require("@mui/system");
11
+ var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
11
12
  var _useGridAriaAttributes = require("../../hooks/utils/useGridAriaAttributes");
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
15
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
- const Element = (0, _system.styled)('div')({
16
+ const Element = (0, _system.styled)('div', {
17
+ name: 'MuiDataGrid',
18
+ slot: 'Main',
19
+ overridesResolver: (props, styles) => styles.main
20
+ })({
16
21
  flexGrow: 1,
17
22
  position: 'relative',
18
23
  overflow: 'hidden'
19
24
  });
20
25
  const GridMainContainer = exports.GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
21
26
  const ariaAttributes = (0, _useGridAriaAttributes.useGridAriaAttributes)();
27
+ const rootProps = (0, _useGridRootProps.useGridRootProps)();
22
28
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({
23
29
  ref: ref,
30
+ ownerState: rootProps,
24
31
  className: props.className,
25
32
  tabIndex: -1
26
33
  }, ariaAttributes, {
@@ -30,6 +30,7 @@ const Element = (0, _system.styled)('div')({
30
30
  zIndex: 5,
31
31
  bottom: 0,
32
32
  left: 0,
33
+ right: 0,
33
34
  height: 1,
34
35
  width: 'var(--DataGrid-rowWidth)',
35
36
  backgroundColor: 'var(--DataGrid-rowBorderColor)'
@@ -13,7 +13,6 @@ var _gridColumnsSelector = require("../columns/gridColumnsSelector");
13
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
15
  const headerFilteringStateInitializer = (state, props) => (0, _extends2.default)({}, state, {
16
- // @ts-expect-error Access `Pro` prop in MIT
17
16
  headerFiltering: {
18
17
  enabled: props.headerFilters ?? false,
19
18
  editing: null,
@@ -23,8 +22,6 @@ const headerFilteringStateInitializer = (state, props) => (0, _extends2.default)
23
22
  exports.headerFilteringStateInitializer = headerFilteringStateInitializer;
24
23
  const useGridHeaderFiltering = (apiRef, props) => {
25
24
  const logger = (0, _utils.useGridLogger)(apiRef, 'useGridHeaderFiltering');
26
- // @ts-expect-error Access `Pro` prop in MIT
27
- const isHeaderFilteringEnabled = props.headerFilters ?? false;
28
25
  const setHeaderFilterState = React.useCallback(headerFilterState => {
29
26
  apiRef.current.setState(state => {
30
27
  // Safety check to avoid MIT users from using it
@@ -34,14 +31,14 @@ const useGridHeaderFiltering = (apiRef, props) => {
34
31
  }
35
32
  return (0, _extends2.default)({}, state, {
36
33
  headerFiltering: {
37
- enabled: isHeaderFilteringEnabled ?? false,
34
+ enabled: props.headerFilters ?? false,
38
35
  editing: headerFilterState.editing ?? null,
39
36
  menuOpen: headerFilterState.menuOpen ?? null
40
37
  }
41
38
  });
42
39
  });
43
40
  apiRef.current.forceUpdate();
44
- }, [apiRef, props.signature, isHeaderFilteringEnabled]);
41
+ }, [apiRef, props.signature, props.headerFilters]);
45
42
  const startHeaderFilterEditMode = React.useCallback(field => {
46
43
  logger.debug(`Starting edit mode on header filter for field: ${field}`);
47
44
  apiRef.current.setHeaderFilterState({
@@ -112,9 +109,9 @@ const useGridHeaderFiltering = (apiRef, props) => {
112
109
  isFirstRender.current = false;
113
110
  } else {
114
111
  apiRef.current.setHeaderFilterState({
115
- enabled: isHeaderFilteringEnabled
112
+ enabled: props.headerFilters ?? false
116
113
  });
117
114
  }
118
- }, [apiRef, isHeaderFilteringEnabled]);
115
+ }, [apiRef, props.headerFilters]);
119
116
  };
120
117
  exports.useGridHeaderFiltering = useGridHeaderFiltering;
@@ -77,9 +77,7 @@ const useGridKeyboardNavigation = (apiRef, props) => {
77
77
  const initialCurrentPageRows = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, props).rows;
78
78
  const theme = (0, _styles.useTheme)();
79
79
  const currentPageRows = React.useMemo(() => enrichPageRowsWithPinnedRows(apiRef, initialCurrentPageRows), [apiRef, initialCurrentPageRows]);
80
- const headerFilteringEnabled =
81
- // @ts-expect-error // TODO move relevant code to the `DataGridPro`
82
- props.signature !== 'DataGrid' && props.headerFilters;
80
+ const headerFilteringEnabled = props.signature !== 'DataGrid' && props.headerFilters;
83
81
 
84
82
  /**
85
83
  * @param {number} colIndex Index of the column to focus
@@ -50,9 +50,9 @@ const EMPTY_SCROLL_POSITION = {
50
50
  left: 0
51
51
  };
52
52
  const EMPTY_DETAIL_PANELS = exports.EMPTY_DETAIL_PANELS = Object.freeze(new Map());
53
- const createScrollCache = (rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) => ({
53
+ const createScrollCache = (mode, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) => ({
54
54
  direction: ScrollDirection.NONE,
55
- buffer: bufferForDirection(ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
55
+ buffer: bufferForDirection(mode, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
56
56
  });
57
57
  const isJSDOM = typeof window !== 'undefined' ? /jsdom/.test(window.navigator.userAgent) : false;
58
58
  const useGridVirtualScroller = () => {
@@ -104,7 +104,7 @@ const useGridVirtualScroller = () => {
104
104
  const renderContext = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridRenderContextSelector);
105
105
  const scrollTimeout = (0, _useTimeout.default)();
106
106
  const frozenContext = React.useRef(undefined);
107
- const scrollCache = (0, _useLazyRef.default)(() => createScrollCache(rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
107
+ const scrollCache = (0, _useLazyRef.default)(() => createScrollCache(theme.direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6)).current;
108
108
  const focusedCell = {
109
109
  rowIndex: React.useMemo(() => cellFocus ? currentPage.rows.findIndex(row => row.id === cellFocus.id) : -1, [cellFocus, currentPage.rows]),
110
110
  columnIndex: React.useMemo(() => cellFocus ? visibleColumns.findIndex(column => column.field === cellFocus.field) : -1, [cellFocus, visibleColumns])
@@ -169,7 +169,7 @@ const useGridVirtualScroller = () => {
169
169
  }
170
170
  }
171
171
  scrollCache.direction = direction;
172
- scrollCache.buffer = bufferForDirection(direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6);
172
+ scrollCache.buffer = bufferForDirection(theme.direction, direction, rootProps.rowBufferPx, rootProps.columnBufferPx, dimensions.rowHeight * 15, MINIMUM_COLUMN_WIDTH * 6);
173
173
  const inputs = inputsSelector(apiRef, rootProps, enabled, enabledForColumns);
174
174
  const nextRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
175
175
 
@@ -651,7 +651,7 @@ function areRenderContextsEqual(context1, context2) {
651
651
  function computeOffsetLeft(columnPositions, renderContext, direction, pinnedLeftLength) {
652
652
  const factor = direction === 'ltr' ? 1 : -1;
653
653
  const left = factor * (columnPositions[renderContext.firstColumnIndex] ?? 0) - (columnPositions[pinnedLeftLength] ?? 0);
654
- return left;
654
+ return Math.abs(left);
655
655
  }
656
656
  function directionForDelta(dx, dy) {
657
657
  if (dx === 0 && dy === 0) {
@@ -673,7 +673,18 @@ function directionForDelta(dx, dy) {
673
673
  }
674
674
  /* eslint-enable */
675
675
  }
676
- function bufferForDirection(direction, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) {
676
+ function bufferForDirection(mode, direction, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer) {
677
+ if (mode === 'rtl') {
678
+ switch (direction) {
679
+ case ScrollDirection.LEFT:
680
+ direction = ScrollDirection.RIGHT;
681
+ break;
682
+ case ScrollDirection.RIGHT:
683
+ direction = ScrollDirection.LEFT;
684
+ break;
685
+ default:
686
+ }
687
+ }
677
688
  switch (direction) {
678
689
  case ScrollDirection.NONE:
679
690
  return {
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.1.0
2
+ * @mui/x-data-grid v7.1.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -3,13 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.validateProps = exports.propValidatorsDataGrid = void 0;
7
- const propValidatorsDataGrid = exports.propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined];
8
- const warnedOnceMap = new Set();
6
+ exports.validateProps = exports.propValidatorsDataGrid = exports.clearWarningsCache = void 0;
7
+ var _utils = require("../../utils/utils");
8
+ var _useGridApiEventHandler = require("../../hooks/utils/useGridApiEventHandler");
9
+ const propValidatorsDataGrid = exports.propValidatorsDataGrid = [props => props.autoPageSize && props.autoHeight && ['MUI X: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You cannot use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n') || undefined, props => props.signature === _useGridApiEventHandler.GridSignature.DataGrid && props.paginationMode === 'client' && (0, _utils.isNumber)(props.rowCount) && 'MUI X: Usage of the `rowCount` prop with client side pagination (`paginationMode="client"`) has no effect. `rowCount` is only meant to be used with `paginationMode="server"`.' || undefined];
10
+ const warnedOnceCache = new Set();
9
11
  const warnOnce = message => {
10
- if (!warnedOnceMap.has(message)) {
12
+ if (!warnedOnceCache.has(message)) {
11
13
  console.error(message);
12
- warnedOnceMap.add(message);
14
+ warnedOnceCache.add(message);
13
15
  }
14
16
  };
15
17
  const validateProps = (props, validators) => {
@@ -23,4 +25,8 @@ const validateProps = (props, validators) => {
23
25
  }
24
26
  });
25
27
  };
26
- exports.validateProps = validateProps;
28
+ exports.validateProps = validateProps;
29
+ const clearWarningsCache = () => {
30
+ warnedOnceCache.clear();
31
+ };
32
+ exports.clearWarningsCache = clearWarningsCache;
@@ -36,10 +36,9 @@ const esESGrid = {
36
36
  toolbarExportPrint: 'Imprimir',
37
37
  toolbarExportExcel: 'Descargar como Excel',
38
38
  // Columns management text
39
- // columnsManagementSearchTitle: 'Search',
40
- // columnsManagementNoColumns: 'No columns',
41
- // columnsManagementShowHideAllText: 'Show/Hide All',
42
-
39
+ columnsManagementSearchTitle: 'Buscar',
40
+ columnsManagementNoColumns: 'Sin columnas',
41
+ columnsManagementShowHideAllText: 'Mostrar/Ocultar todas',
43
42
  // Filter panel text
44
43
  filterPanelAddFilter: 'Agregar filtro',
45
44
  filterPanelRemoveAll: 'Remover todos',
@@ -36,10 +36,9 @@ const faIRGrid = {
36
36
  toolbarExportPrint: 'چاپ',
37
37
  toolbarExportExcel: 'دانلود به صورت اکسل',
38
38
  // Columns management text
39
- // columnsManagementSearchTitle: 'Search',
40
- // columnsManagementNoColumns: 'No columns',
41
- // columnsManagementShowHideAllText: 'Show/Hide All',
42
-
39
+ columnsManagementSearchTitle: 'جستجو',
40
+ columnsManagementNoColumns: 'بدون سطر',
41
+ columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
43
42
  // Filter panel text
44
43
  filterPanelAddFilter: 'افزودن فیلتر',
45
44
  filterPanelRemoveAll: 'حذف همه',
@@ -36,10 +36,9 @@ const ptBRGrid = {
36
36
  toolbarExportPrint: 'Imprimir',
37
37
  toolbarExportExcel: 'Baixar como Excel',
38
38
  // Columns management text
39
- // columnsManagementSearchTitle: 'Search',
40
- // columnsManagementNoColumns: 'No columns',
41
- // columnsManagementShowHideAllText: 'Show/Hide All',
42
-
39
+ columnsManagementSearchTitle: 'Buscar',
40
+ columnsManagementNoColumns: 'Nenhuma coluna',
41
+ columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
43
42
  // Filter panel text
44
43
  filterPanelAddFilter: 'Adicionar filtro',
45
44
  filterPanelRemoveAll: 'Remover todos',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "7.1.0",
4
- "description": "The community edition of the data grid component (MUI X).",
3
+ "version": "7.1.1",
4
+ "description": "The Community plan edition of the Data Grid components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
7
7
  "license": "MIT",