@mui/x-data-grid 7.5.1 → 7.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +87 -1
  2. package/DataGrid/DataGrid.js +1 -1
  3. package/components/cell/GridCell.js +1 -1
  4. package/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -7
  5. package/hooks/features/columnResize/useGridColumnResize.js +5 -26
  6. package/hooks/features/columns/gridColumnsUtils.js +18 -13
  7. package/hooks/features/columns/useGridColumnSpanning.js +5 -5
  8. package/hooks/features/virtualization/useGridVirtualScroller.js +8 -1
  9. package/index.d.ts +1 -0
  10. package/index.js +1 -2
  11. package/locales/faIR.js +4 -4
  12. package/locales/fiFI.js +4 -5
  13. package/models/api/gridColumnSpanning.d.ts +2 -0
  14. package/models/gridSlotsComponent.d.ts +1 -1
  15. package/models/props/DataGridProps.d.ts +1 -1
  16. package/modern/DataGrid/DataGrid.js +1 -1
  17. package/modern/components/cell/GridCell.js +1 -1
  18. package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -7
  19. package/modern/hooks/features/columnResize/useGridColumnResize.js +5 -26
  20. package/modern/hooks/features/columns/gridColumnsUtils.js +18 -13
  21. package/modern/hooks/features/columns/useGridColumnSpanning.js +5 -5
  22. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +8 -1
  23. package/modern/index.js +1 -2
  24. package/modern/locales/faIR.js +4 -4
  25. package/modern/locales/fiFI.js +4 -5
  26. package/modern/utils/domUtils.js +1 -2
  27. package/node/DataGrid/DataGrid.js +1 -1
  28. package/node/components/cell/GridCell.js +1 -1
  29. package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +0 -7
  30. package/node/hooks/features/columnResize/useGridColumnResize.js +5 -26
  31. package/node/hooks/features/columns/gridColumnsUtils.js +18 -13
  32. package/node/hooks/features/columns/useGridColumnSpanning.js +5 -5
  33. package/node/hooks/features/virtualization/useGridVirtualScroller.js +8 -1
  34. package/node/index.js +1 -1
  35. package/node/locales/faIR.js +4 -4
  36. package/node/locales/fiFI.js +4 -5
  37. package/node/utils/domUtils.js +1 -2
  38. package/package.json +4 -3
  39. package/utils/domUtils.js +1 -2
package/CHANGELOG.md CHANGED
@@ -3,6 +3,92 @@
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.6.0
7
+
8
+ _May 30, 2024_
9
+
10
+ We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Allow to define and customize the indentation of nested items in the Tree View
13
+ - ✨ Allow charts highlights to be controlled
14
+ - 🌍 Improve Persian (fa-IR) locale on the Data Grid
15
+ - 🐞 Bugfixes
16
+ - 📚 Documentation improvements
17
+
18
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
19
+
20
+ ### Data Grid
21
+
22
+ #### `@mui/x-data-grid@7.6.0`
23
+
24
+ - [DataGrid] Avoid re-rendering all cells on column change (#12980) @romgrk
25
+ - [DataGrid] Export `GridColumnHeadersProps` (#13229) @cherniavskii
26
+ - [DataGrid] Fix header filters' issue with custom filters (#13255) @MBilalShafi
27
+ - [DataGrid] Remove dead logic to support Safari < 13 (#13249) @oliviertassinari
28
+ - [l10n] Improve Persian (fa-IR) locale (#12994) @amiryxe
29
+
30
+ #### `@mui/x-data-grid-pro@7.6.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
31
+
32
+ Same changes as in `@mui/x-data-grid@7.6.0`.
33
+
34
+ #### `@mui/x-data-grid-premium@7.6.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
35
+
36
+ Same changes as in `@mui/x-data-grid-pro@7.6.0`, plus:
37
+
38
+ - [DataGridPremium] Fix excel export causing column with wrong width (#13191) @romgrk
39
+
40
+ ### Date and Time Pickers
41
+
42
+ #### `@mui/x-date-pickers@7.6.0`
43
+
44
+ - [pickers] Fix `DateBuilderReturnType` when the date is `undefined` (#13244) @alexey-kozlenkov
45
+
46
+ #### `@mui/x-date-pickers-pro@7.6.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
47
+
48
+ Same changes as in `@mui/x-date-pickers@7.6.0`.
49
+
50
+ ### Charts
51
+
52
+ #### `@mui/x-charts@7.6.0`
53
+
54
+ - [charts] Allow charts highlights to be controlled (#12828) @JCQuintas
55
+ - [charts] Refactor axis band scaleType check (#13295) @JCQuintas
56
+ - [charts] Refactor checkScaleErrors to improve readability and simplify axis message logic (#13305) @JCQuintas
57
+
58
+ ### Tree View
59
+
60
+ #### `@mui/x-tree-view@7.6.0`
61
+
62
+ - [TreeView] Add JSDoc to every instance method (#13219) @flaviendelangle
63
+ - [TreeView] Allow to customize the indentation of nested items (#13225) @flaviendelangle
64
+ - [TreeView] Allow to define indentation at the item level (#13126) @flaviendelangle
65
+
66
+ ### Docs
67
+
68
+ - [docs] Add Bulk editing demo for the Community plan (#12800) @cherniavskii
69
+ - [docs] Add conditional label formatting on tooltip page and link to label page (#13235) @JCQuintas
70
+ - [docs] Add information about key combinations on a11y sections (#13234) @arthurbalduini
71
+ - [docs] Cleanup of the Tree View demos (#13237) @flaviendelangle
72
+ - [docs] Document how to customize a subsection of a line chart (#13210) @alexfauquette
73
+ - [docs] Fix Pickers FAQ callout (#13238) @LukasTy
74
+ - [docs] Fix Vale errors @oliviertassinari
75
+ - [docs] Fix a small typo in property comment (#13245) @Janpot
76
+ - [docs] Improve the Data Grid FAQ page (#13258) @MBilalShafi
77
+ - [docs] Removes unused lines in TreeItem2 styling (#13264) @arthurbalduini
78
+ - [docs] Small improvements on accessibility data grid doc (#13233) @arthurbalduini
79
+ - [docs] Update Pickers demo configurations (#13303) @LukasTy
80
+
81
+ ### Core
82
+
83
+ - [core] Add comment on why logic to sync column header (#13248) @oliviertassinari
84
+ - [core] Fix `l10n` script execution with arguments (#13297) @LukasTy
85
+ - [core] Prevent "Add reviewers" workflow from triggering since it doesn't work (#13236) @JCQuintas
86
+ - [docs-infra] Fix `@mui/material` version used in sandboxes (#13260) @LukasTy
87
+ - [test] Use `describeTreeView` for keyboard navigation tests on disabled items (#13184) @flaviendelangle
88
+ - [test] Use `describeTreeView` for remaining items tests (#13262) @flaviendelangle
89
+ - [test] Use test-utils from npm (#12880) @michaldudak
90
+ - [typescript] Remove duplicate `DateRangePosition` type in favor of `RangePosition` (#13288) @LukasTy
91
+
6
92
  ## v7.5.1
7
93
 
8
94
  _May 23, 2024_
@@ -339,7 +425,7 @@ Same changes as in `@mui/x-date-pickers@7.3.1`.
339
425
  ### Core
340
426
 
341
427
  - [core] Fix `l10n` GH workflow (#12895) @LukasTy
342
- - [core] Match Base UI and Toolpad @oliviertassinari
428
+ - [core] Match Base UI and Toolpad @oliviertassinari
343
429
  - [core] Remove redundant `setupFiles` entries in `package.json` (#12899) @LukasTy
344
430
  - [core] Use `describeTreeView` for focus tests (#12698) @flaviendelangle
345
431
  - [core] Use `describeTreeView` for type-ahead tests (#12811) @flaviendelangle
@@ -62,7 +62,7 @@ DataGridRaw.propTypes = {
62
62
  */
63
63
  'aria-labelledby': PropTypes.string,
64
64
  /**
65
- * If `true`, the Data Grid height is dynamic and follow the number of rows in the Data Grid.
65
+ * If `true`, the Data Grid height is dynamic and follows the number of rows in the Data Grid.
66
66
  * @default false
67
67
  */
68
68
  autoHeight: PropTypes.bool,
@@ -75,7 +75,7 @@ let warnedOnce = false;
75
75
 
76
76
  // TODO(v7): Removing the wrapper will break the docs performance visualization demo.
77
77
 
78
- const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
78
+ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
79
79
  const {
80
80
  column,
81
81
  rowId,
@@ -12,7 +12,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridGenericColumnHeaderItem(props, ref) {
13
13
  const {
14
14
  classes,
15
- columnMenuOpen,
16
15
  colIndex,
17
16
  height,
18
17
  isResizing,
@@ -38,17 +37,11 @@ const GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridG
38
37
  const apiRef = useGridPrivateApiContext();
39
38
  const rootProps = useGridRootProps();
40
39
  const headerCellRef = React.useRef(null);
41
- const [showColumnMenuIcon, setShowColumnMenuIcon] = React.useState(columnMenuOpen);
42
40
  const handleRef = useForkRef(headerCellRef, ref);
43
41
  let ariaSort = 'none';
44
42
  if (sortDirection != null) {
45
43
  ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
46
44
  }
47
- React.useEffect(() => {
48
- if (!showColumnMenuIcon) {
49
- setShowColumnMenuIcon(columnMenuOpen);
50
- }
51
- }, [showColumnMenuIcon, columnMenuOpen]);
52
45
  React.useLayoutEffect(() => {
53
46
  const columnMenuState = apiRef.current.state.columnMenu;
54
47
  if (hasFocus && !columnMenuState.open) {
@@ -13,27 +13,6 @@ import { clamp } from '../../../utils/utils';
13
13
  import { useTimeout } from '../../utils/useTimeout';
14
14
  import { GridPinnedColumnPosition } from '../columns/gridColumnsInterfaces';
15
15
  import { gridColumnsStateSelector } from '../columns';
16
- // TODO: remove support for Safari < 13.
17
- // https://caniuse.com/#search=touch-action
18
- //
19
- // Safari, on iOS, supports touch action since v13.
20
- // Over 80% of the iOS phones are compatible
21
- // in August 2020.
22
- // Utilizing the CSS.supports method to check if touch-action is supported.
23
- // Since CSS.supports is supported on all but Edge@12 and IE and touch-action
24
- // is supported on both Edge@12 and IE if CSS.supports is not available that means that
25
- // touch-action will be supported
26
- let cachedSupportsTouchActionNone = false;
27
- function doesSupportTouchActionNone() {
28
- if (cachedSupportsTouchActionNone === undefined) {
29
- if (typeof CSS !== 'undefined' && typeof CSS.supports === 'function') {
30
- cachedSupportsTouchActionNone = CSS.supports('touch-action', 'none');
31
- } else {
32
- cachedSupportsTouchActionNone = true;
33
- }
34
- }
35
- return cachedSupportsTouchActionNone;
36
- }
37
16
  function trackFinger(event, currentTouchId) {
38
17
  if (currentTouchId !== undefined && event.changedTouches) {
39
18
  for (let i = 0; i < event.changedTouches.length; i += 1) {
@@ -294,6 +273,10 @@ export const useGridColumnResize = (apiRef, props) => {
294
273
  if (refs.colDef) {
295
274
  apiRef.current.setColumnWidth(refs.colDef.field, refs.colDef.width);
296
275
  logger.debug(`Updating col ${refs.colDef.field} with new width: ${refs.colDef.width}`);
276
+
277
+ // Since during resizing we update the columns width outside of React, React is unable to
278
+ // reapply the right style properties. We need to sync the state manually.
279
+ // So we reapply the same logic as in https://github.com/mui/mui-x/blob/0511bf65543ca05d2602a5a3e0a6156f2fc8e759/packages/x-data-grid/src/hooks/features/columnHeaders/useGridColumnHeaders.tsx#L405
297
280
  const columnsState = gridColumnsStateSelector(apiRef.current.state);
298
281
  refs.groupHeaderElements.forEach(element => {
299
282
  const fields = getFieldsFromGroupHeaderElem(element);
@@ -387,10 +370,6 @@ export const useGridColumnResize = (apiRef, props) => {
387
370
  if (!cellSeparator) {
388
371
  return;
389
372
  }
390
- // If touch-action: none; is not supported we need to prevent the scroll manually.
391
- if (!doesSupportTouchActionNone()) {
392
- event.preventDefault();
393
- }
394
373
  const touch = event.changedTouches[0];
395
374
  if (touch != null) {
396
375
  // A number that uniquely identifies the current finger in the touch session.
@@ -562,7 +541,7 @@ export const useGridColumnResize = (apiRef, props) => {
562
541
  }
563
542
  });
564
543
  useGridNativeEventListener(apiRef, () => apiRef.current.columnHeadersContainerRef?.current, 'touchstart', handleTouchStart, {
565
- passive: doesSupportTouchActionNone()
544
+ passive: true
566
545
  });
567
546
  useGridApiMethod(apiRef, {
568
547
  autosizeColumns
@@ -117,24 +117,29 @@ export const hydrateColumnsWidth = (rawState, dimensions) => {
117
117
  const flexColumns = [];
118
118
 
119
119
  // For the non-flex columns, compute their width
120
- // For the flex columns, compute there minimum width and how much width must be allocated during the flex allocation
120
+ // For the flex columns, compute their minimum width and how much width must be allocated during the flex allocation
121
121
  rawState.orderedFields.forEach(columnField => {
122
- const newColumn = _extends({}, rawState.lookup[columnField]);
123
- if (rawState.columnVisibilityModel[columnField] === false) {
124
- newColumn.computedWidth = 0;
125
- } else {
126
- let computedWidth;
127
- if (newColumn.flex && newColumn.flex > 0) {
128
- totalFlexUnits += newColumn.flex;
129
- computedWidth = 0;
130
- flexColumns.push(newColumn);
122
+ let column = rawState.lookup[columnField];
123
+ let computedWidth = 0;
124
+ let isFlex = false;
125
+ if (rawState.columnVisibilityModel[columnField] !== false) {
126
+ if (column.flex && column.flex > 0) {
127
+ totalFlexUnits += column.flex;
128
+ isFlex = true;
131
129
  } else {
132
- computedWidth = clamp(newColumn.width || GRID_STRING_COL_DEF.width, newColumn.minWidth || GRID_STRING_COL_DEF.minWidth, newColumn.maxWidth || GRID_STRING_COL_DEF.maxWidth);
130
+ computedWidth = clamp(column.width || GRID_STRING_COL_DEF.width, column.minWidth || GRID_STRING_COL_DEF.minWidth, column.maxWidth || GRID_STRING_COL_DEF.maxWidth);
133
131
  }
134
132
  widthAllocatedBeforeFlex += computedWidth;
135
- newColumn.computedWidth = computedWidth;
136
133
  }
137
- columnsLookup[columnField] = newColumn;
134
+ if (column.computedWidth !== computedWidth) {
135
+ column = _extends({}, column, {
136
+ computedWidth
137
+ });
138
+ }
139
+ if (isFlex) {
140
+ flexColumns.push(column);
141
+ }
142
+ columnsLookup[columnField] = column;
138
143
  });
139
144
  const availableWidth = dimensions === undefined ? 0 : dimensions.viewportOuterSize.width - (dimensions.hasScrollY ? dimensions.scrollbarSize : 0);
140
145
  const initialFreeSpace = Math.max(availableWidth - widthAllocatedBeforeFlex, 0);
@@ -10,6 +10,9 @@ export const useGridColumnSpanning = apiRef => {
10
10
  const getCellColSpanInfo = (rowId, columnIndex) => {
11
11
  return lookup.current[rowId]?.[columnIndex];
12
12
  };
13
+ const resetColSpan = () => {
14
+ lookup.current = {};
15
+ };
13
16
 
14
17
  // Calculate `colSpan` for each cell in the row
15
18
  const calculateColSpan = React.useCallback(({
@@ -37,15 +40,12 @@ export const useGridColumnSpanning = apiRef => {
37
40
  unstable_getCellColSpanInfo: getCellColSpanInfo
38
41
  };
39
42
  const columnSpanningPrivateApi = {
43
+ resetColSpan,
40
44
  calculateColSpan
41
45
  };
42
46
  useGridApiMethod(apiRef, columnSpanningPublicApi, 'public');
43
47
  useGridApiMethod(apiRef, columnSpanningPrivateApi, 'private');
44
- const handleColumnReorderChange = React.useCallback(() => {
45
- // `colSpan` needs to be recalculated after column reordering
46
- lookup.current = {};
47
- }, []);
48
- useGridApiEventHandler(apiRef, 'columnOrderChange', handleColumnReorderChange);
48
+ useGridApiEventHandler(apiRef, 'columnOrderChange', resetColSpan);
49
49
  };
50
50
  function calculateCellColSpan(params) {
51
51
  const {
@@ -42,7 +42,14 @@ const createScrollCache = (mode, rowBufferPx, columnBufferPx, verticalBuffer, ho
42
42
  direction: ScrollDirection.NONE,
43
43
  buffer: bufferForDirection(mode, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
44
44
  });
45
- const isJSDOM = typeof window !== 'undefined' ? /jsdom/.test(window.navigator.userAgent) : false;
45
+ let isJSDOM = false;
46
+ try {
47
+ if (typeof window !== 'undefined') {
48
+ isJSDOM = /jsdom/.test(window.navigator.userAgent);
49
+ }
50
+ } catch (_) {
51
+ /* ignore */
52
+ }
46
53
  export const useGridVirtualScroller = () => {
47
54
  const apiRef = useGridPrivateApiContext();
48
55
  const rootProps = useGridRootProps();
package/index.d.ts CHANGED
@@ -15,6 +15,7 @@ export type { DataGridProps, GridExperimentalFeatures } from './models/props/Dat
15
15
  export type { GridToolbarExportProps } from './components/toolbar/GridToolbarExport';
16
16
  export type { GridExportFormat, GridExportExtension } from './models/gridExport';
17
17
  export { GridColumnHeaders } from './components/GridColumnHeaders';
18
+ export type { GridColumnHeadersProps } from './components/GridColumnHeaders';
18
19
  /**
19
20
  * Reexportable components.
20
21
  */
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.5.1
2
+ * @mui/x-data-grid v7.6.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -17,7 +17,6 @@ export * from './context';
17
17
  export * from './colDef';
18
18
  export * from './utils';
19
19
  export { GridColumnHeaders } from './components/GridColumnHeaders';
20
-
21
20
  /**
22
21
  * Reexportable components.
23
22
  */
package/locales/faIR.js CHANGED
@@ -3,7 +3,7 @@ import { getGridLocalization } from '../utils/getGridLocalization';
3
3
  const faIRGrid = {
4
4
  // Root
5
5
  noRowsLabel: 'بدون سطر',
6
- noResultsOverlayLabel: 'نتیجه ای پیدا نشد.',
6
+ noResultsOverlayLabel: 'نتیجه‌ای پیدا نشد.',
7
7
  // Density selector toolbar button text
8
8
  toolbarDensity: 'تراکم',
9
9
  toolbarDensityLabel: 'تراکم',
@@ -97,12 +97,12 @@ const faIRGrid = {
97
97
  columnMenuFilter: 'فیلتر',
98
98
  columnMenuHideColumn: 'مخفی',
99
99
  columnMenuUnsort: 'نامرتب‌کردن',
100
- columnMenuSortAsc: 'مرتب‌کردن صعودی',
101
- columnMenuSortDesc: 'مرتب‌کردن نزولی',
100
+ columnMenuSortAsc: 'مرتب‌سازی صعودی',
101
+ columnMenuSortDesc: 'مرتب‌سازی نزولی',
102
102
  // Column header text
103
103
  columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} فیلتر‌های فعال` : `${count} فیلتر فعال`,
104
104
  columnHeaderFiltersLabel: 'نمایش فیلترها',
105
- columnHeaderSortIconLabel: 'مرتب‌کردن',
105
+ columnHeaderSortIconLabel: 'مرتب‌سازی',
106
106
  // Rows selected footer text
107
107
  footerRowSelected: count => count !== 1 ? `${count.toLocaleString()} سطرهای انتخاب شده` : `${count.toLocaleString()} سطر انتخاب شده`,
108
108
  // Total row amount footer text
package/locales/fiFI.js CHANGED
@@ -30,11 +30,10 @@ const fiFIGrid = {
30
30
  toolbarExportPrint: 'Tulosta',
31
31
  toolbarExportExcel: 'Lataa Excel-muodossa',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
- // columnsManagementReset: 'Reset',
37
-
33
+ columnsManagementSearchTitle: 'Hae',
34
+ columnsManagementNoColumns: 'Ei sarakkeita näytettäväksi',
35
+ columnsManagementShowHideAllText: 'Näytä/Piilota kaikki',
36
+ columnsManagementReset: 'Palauta',
38
37
  // Filter panel text
39
38
  filterPanelAddFilter: 'Lisää suodatin',
40
39
  filterPanelRemoveAll: 'Poista kaikki',
@@ -15,6 +15,8 @@ export interface GridColumnSpanningApi {
15
15
  unstable_getCellColSpanInfo: (rowId: GridRowId, columnIndex: GridColumnIndex) => GridCellColSpanInfo | undefined;
16
16
  }
17
17
  export interface GridColumnSpanningPrivateApi {
18
+ /** Reset the colspan cache */
19
+ resetColSpan: () => void;
18
20
  /**
19
21
  * Calculate column spanning for each cell in the row
20
22
  * @param {Object} options The options to apply on the calculation.
@@ -95,7 +95,7 @@ export interface GridSlotsComponent extends GridBaseSlots, GridIconSlotsComponen
95
95
  columnMenu: React.JSXElementConstructor<GridSlotProps['columnMenu']>;
96
96
  /**
97
97
  * Component responsible for rendering the column headers.
98
- * @default DataGridColumnHeaders
98
+ * @default GridColumnHeaders
99
99
  */
100
100
  columnHeaders: React.JSXElementConstructor<GridSlotProps['columnHeaders']>;
101
101
  /**
@@ -72,7 +72,7 @@ export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
72
72
  */
73
73
  export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = any> {
74
74
  /**
75
- * If `true`, the Data Grid height is dynamic and follow the number of rows in the Data Grid.
75
+ * If `true`, the Data Grid height is dynamic and follows the number of rows in the Data Grid.
76
76
  * @default false
77
77
  */
78
78
  autoHeight: boolean;
@@ -62,7 +62,7 @@ DataGridRaw.propTypes = {
62
62
  */
63
63
  'aria-labelledby': PropTypes.string,
64
64
  /**
65
- * If `true`, the Data Grid height is dynamic and follow the number of rows in the Data Grid.
65
+ * If `true`, the Data Grid height is dynamic and follows the number of rows in the Data Grid.
66
66
  * @default false
67
67
  */
68
68
  autoHeight: PropTypes.bool,
@@ -75,7 +75,7 @@ let warnedOnce = false;
75
75
 
76
76
  // TODO(v7): Removing the wrapper will break the docs performance visualization demo.
77
77
 
78
- const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
78
+ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
79
79
  const {
80
80
  column,
81
81
  rowId,
@@ -12,7 +12,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
12
  const GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridGenericColumnHeaderItem(props, ref) {
13
13
  const {
14
14
  classes,
15
- columnMenuOpen,
16
15
  colIndex,
17
16
  height,
18
17
  isResizing,
@@ -38,17 +37,11 @@ const GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridG
38
37
  const apiRef = useGridPrivateApiContext();
39
38
  const rootProps = useGridRootProps();
40
39
  const headerCellRef = React.useRef(null);
41
- const [showColumnMenuIcon, setShowColumnMenuIcon] = React.useState(columnMenuOpen);
42
40
  const handleRef = useForkRef(headerCellRef, ref);
43
41
  let ariaSort = 'none';
44
42
  if (sortDirection != null) {
45
43
  ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
46
44
  }
47
- React.useEffect(() => {
48
- if (!showColumnMenuIcon) {
49
- setShowColumnMenuIcon(columnMenuOpen);
50
- }
51
- }, [showColumnMenuIcon, columnMenuOpen]);
52
45
  React.useLayoutEffect(() => {
53
46
  const columnMenuState = apiRef.current.state.columnMenu;
54
47
  if (hasFocus && !columnMenuState.open) {
@@ -13,27 +13,6 @@ import { clamp } from '../../../utils/utils';
13
13
  import { useTimeout } from '../../utils/useTimeout';
14
14
  import { GridPinnedColumnPosition } from '../columns/gridColumnsInterfaces';
15
15
  import { gridColumnsStateSelector } from '../columns';
16
- // TODO: remove support for Safari < 13.
17
- // https://caniuse.com/#search=touch-action
18
- //
19
- // Safari, on iOS, supports touch action since v13.
20
- // Over 80% of the iOS phones are compatible
21
- // in August 2020.
22
- // Utilizing the CSS.supports method to check if touch-action is supported.
23
- // Since CSS.supports is supported on all but Edge@12 and IE and touch-action
24
- // is supported on both Edge@12 and IE if CSS.supports is not available that means that
25
- // touch-action will be supported
26
- let cachedSupportsTouchActionNone = false;
27
- function doesSupportTouchActionNone() {
28
- if (cachedSupportsTouchActionNone === undefined) {
29
- if (typeof CSS !== 'undefined' && typeof CSS.supports === 'function') {
30
- cachedSupportsTouchActionNone = CSS.supports('touch-action', 'none');
31
- } else {
32
- cachedSupportsTouchActionNone = true;
33
- }
34
- }
35
- return cachedSupportsTouchActionNone;
36
- }
37
16
  function trackFinger(event, currentTouchId) {
38
17
  if (currentTouchId !== undefined && event.changedTouches) {
39
18
  for (let i = 0; i < event.changedTouches.length; i += 1) {
@@ -294,6 +273,10 @@ export const useGridColumnResize = (apiRef, props) => {
294
273
  if (refs.colDef) {
295
274
  apiRef.current.setColumnWidth(refs.colDef.field, refs.colDef.width);
296
275
  logger.debug(`Updating col ${refs.colDef.field} with new width: ${refs.colDef.width}`);
276
+
277
+ // Since during resizing we update the columns width outside of React, React is unable to
278
+ // reapply the right style properties. We need to sync the state manually.
279
+ // So we reapply the same logic as in https://github.com/mui/mui-x/blob/0511bf65543ca05d2602a5a3e0a6156f2fc8e759/packages/x-data-grid/src/hooks/features/columnHeaders/useGridColumnHeaders.tsx#L405
297
280
  const columnsState = gridColumnsStateSelector(apiRef.current.state);
298
281
  refs.groupHeaderElements.forEach(element => {
299
282
  const fields = getFieldsFromGroupHeaderElem(element);
@@ -387,10 +370,6 @@ export const useGridColumnResize = (apiRef, props) => {
387
370
  if (!cellSeparator) {
388
371
  return;
389
372
  }
390
- // If touch-action: none; is not supported we need to prevent the scroll manually.
391
- if (!doesSupportTouchActionNone()) {
392
- event.preventDefault();
393
- }
394
373
  const touch = event.changedTouches[0];
395
374
  if (touch != null) {
396
375
  // A number that uniquely identifies the current finger in the touch session.
@@ -562,7 +541,7 @@ export const useGridColumnResize = (apiRef, props) => {
562
541
  }
563
542
  });
564
543
  useGridNativeEventListener(apiRef, () => apiRef.current.columnHeadersContainerRef?.current, 'touchstart', handleTouchStart, {
565
- passive: doesSupportTouchActionNone()
544
+ passive: true
566
545
  });
567
546
  useGridApiMethod(apiRef, {
568
547
  autosizeColumns
@@ -117,24 +117,29 @@ export const hydrateColumnsWidth = (rawState, dimensions) => {
117
117
  const flexColumns = [];
118
118
 
119
119
  // For the non-flex columns, compute their width
120
- // For the flex columns, compute there minimum width and how much width must be allocated during the flex allocation
120
+ // For the flex columns, compute their minimum width and how much width must be allocated during the flex allocation
121
121
  rawState.orderedFields.forEach(columnField => {
122
- const newColumn = _extends({}, rawState.lookup[columnField]);
123
- if (rawState.columnVisibilityModel[columnField] === false) {
124
- newColumn.computedWidth = 0;
125
- } else {
126
- let computedWidth;
127
- if (newColumn.flex && newColumn.flex > 0) {
128
- totalFlexUnits += newColumn.flex;
129
- computedWidth = 0;
130
- flexColumns.push(newColumn);
122
+ let column = rawState.lookup[columnField];
123
+ let computedWidth = 0;
124
+ let isFlex = false;
125
+ if (rawState.columnVisibilityModel[columnField] !== false) {
126
+ if (column.flex && column.flex > 0) {
127
+ totalFlexUnits += column.flex;
128
+ isFlex = true;
131
129
  } else {
132
- computedWidth = clamp(newColumn.width || GRID_STRING_COL_DEF.width, newColumn.minWidth || GRID_STRING_COL_DEF.minWidth, newColumn.maxWidth || GRID_STRING_COL_DEF.maxWidth);
130
+ computedWidth = clamp(column.width || GRID_STRING_COL_DEF.width, column.minWidth || GRID_STRING_COL_DEF.minWidth, column.maxWidth || GRID_STRING_COL_DEF.maxWidth);
133
131
  }
134
132
  widthAllocatedBeforeFlex += computedWidth;
135
- newColumn.computedWidth = computedWidth;
136
133
  }
137
- columnsLookup[columnField] = newColumn;
134
+ if (column.computedWidth !== computedWidth) {
135
+ column = _extends({}, column, {
136
+ computedWidth
137
+ });
138
+ }
139
+ if (isFlex) {
140
+ flexColumns.push(column);
141
+ }
142
+ columnsLookup[columnField] = column;
138
143
  });
139
144
  const availableWidth = dimensions === undefined ? 0 : dimensions.viewportOuterSize.width - (dimensions.hasScrollY ? dimensions.scrollbarSize : 0);
140
145
  const initialFreeSpace = Math.max(availableWidth - widthAllocatedBeforeFlex, 0);
@@ -10,6 +10,9 @@ export const useGridColumnSpanning = apiRef => {
10
10
  const getCellColSpanInfo = (rowId, columnIndex) => {
11
11
  return lookup.current[rowId]?.[columnIndex];
12
12
  };
13
+ const resetColSpan = () => {
14
+ lookup.current = {};
15
+ };
13
16
 
14
17
  // Calculate `colSpan` for each cell in the row
15
18
  const calculateColSpan = React.useCallback(({
@@ -37,15 +40,12 @@ export const useGridColumnSpanning = apiRef => {
37
40
  unstable_getCellColSpanInfo: getCellColSpanInfo
38
41
  };
39
42
  const columnSpanningPrivateApi = {
43
+ resetColSpan,
40
44
  calculateColSpan
41
45
  };
42
46
  useGridApiMethod(apiRef, columnSpanningPublicApi, 'public');
43
47
  useGridApiMethod(apiRef, columnSpanningPrivateApi, 'private');
44
- const handleColumnReorderChange = React.useCallback(() => {
45
- // `colSpan` needs to be recalculated after column reordering
46
- lookup.current = {};
47
- }, []);
48
- useGridApiEventHandler(apiRef, 'columnOrderChange', handleColumnReorderChange);
48
+ useGridApiEventHandler(apiRef, 'columnOrderChange', resetColSpan);
49
49
  };
50
50
  function calculateCellColSpan(params) {
51
51
  const {
@@ -42,7 +42,14 @@ const createScrollCache = (mode, rowBufferPx, columnBufferPx, verticalBuffer, ho
42
42
  direction: ScrollDirection.NONE,
43
43
  buffer: bufferForDirection(mode, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
44
44
  });
45
- const isJSDOM = typeof window !== 'undefined' ? /jsdom/.test(window.navigator.userAgent) : false;
45
+ let isJSDOM = false;
46
+ try {
47
+ if (typeof window !== 'undefined') {
48
+ isJSDOM = /jsdom/.test(window.navigator.userAgent);
49
+ }
50
+ } catch (_) {
51
+ /* ignore */
52
+ }
46
53
  export const useGridVirtualScroller = () => {
47
54
  const apiRef = useGridPrivateApiContext();
48
55
  const rootProps = useGridRootProps();
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.5.1
2
+ * @mui/x-data-grid v7.6.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -17,7 +17,6 @@ export * from './context';
17
17
  export * from './colDef';
18
18
  export * from './utils';
19
19
  export { GridColumnHeaders } from './components/GridColumnHeaders';
20
-
21
20
  /**
22
21
  * Reexportable components.
23
22
  */
@@ -3,7 +3,7 @@ import { getGridLocalization } from '../utils/getGridLocalization';
3
3
  const faIRGrid = {
4
4
  // Root
5
5
  noRowsLabel: 'بدون سطر',
6
- noResultsOverlayLabel: 'نتیجه ای پیدا نشد.',
6
+ noResultsOverlayLabel: 'نتیجه‌ای پیدا نشد.',
7
7
  // Density selector toolbar button text
8
8
  toolbarDensity: 'تراکم',
9
9
  toolbarDensityLabel: 'تراکم',
@@ -97,12 +97,12 @@ const faIRGrid = {
97
97
  columnMenuFilter: 'فیلتر',
98
98
  columnMenuHideColumn: 'مخفی',
99
99
  columnMenuUnsort: 'نامرتب‌کردن',
100
- columnMenuSortAsc: 'مرتب‌کردن صعودی',
101
- columnMenuSortDesc: 'مرتب‌کردن نزولی',
100
+ columnMenuSortAsc: 'مرتب‌سازی صعودی',
101
+ columnMenuSortDesc: 'مرتب‌سازی نزولی',
102
102
  // Column header text
103
103
  columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} فیلتر‌های فعال` : `${count} فیلتر فعال`,
104
104
  columnHeaderFiltersLabel: 'نمایش فیلترها',
105
- columnHeaderSortIconLabel: 'مرتب‌کردن',
105
+ columnHeaderSortIconLabel: 'مرتب‌سازی',
106
106
  // Rows selected footer text
107
107
  footerRowSelected: count => count !== 1 ? `${count.toLocaleString()} سطرهای انتخاب شده` : `${count.toLocaleString()} سطر انتخاب شده`,
108
108
  // Total row amount footer text
@@ -30,11 +30,10 @@ const fiFIGrid = {
30
30
  toolbarExportPrint: 'Tulosta',
31
31
  toolbarExportExcel: 'Lataa Excel-muodossa',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
- // columnsManagementReset: 'Reset',
37
-
33
+ columnsManagementSearchTitle: 'Hae',
34
+ columnsManagementNoColumns: 'Ei sarakkeita näytettäväksi',
35
+ columnsManagementShowHideAllText: 'Näytä/Piilota kaikki',
36
+ columnsManagementReset: 'Palauta',
38
37
  // Filter panel text
39
38
  filterPanelAddFilter: 'Lisää suodatin',
40
39
  filterPanelRemoveAll: 'Poista kaikki',
@@ -54,8 +54,7 @@ export function findHeaderElementFromField(elem, field) {
54
54
  return elem.querySelector(`[data-field="${field}"]`);
55
55
  }
56
56
  export function getFieldsFromGroupHeaderElem(colCellEl) {
57
- const fieldsString = colCellEl.getAttribute('data-fields');
58
- return fieldsString?.startsWith('|-') ? fieldsString.slice(2, -2).split('-|-') : [];
57
+ return colCellEl.getAttribute('data-fields').slice(2, -2).split('-|-');
59
58
  }
60
59
  export function findGroupHeaderElementsFromField(elem, field) {
61
60
  return Array.from(elem.querySelectorAll(`[data-fields*="|-${field}-|"]`) ?? []);
@@ -70,7 +70,7 @@ DataGridRaw.propTypes = {
70
70
  */
71
71
  'aria-labelledby': _propTypes.default.string,
72
72
  /**
73
- * If `true`, the Data Grid height is dynamic and follow the number of rows in the Data Grid.
73
+ * If `true`, the Data Grid height is dynamic and follows the number of rows in the Data Grid.
74
74
  * @default false
75
75
  */
76
76
  autoHeight: _propTypes.default.bool,
@@ -84,7 +84,7 @@ let warnedOnce = false;
84
84
 
85
85
  // TODO(v7): Removing the wrapper will break the docs performance visualization demo.
86
86
 
87
- const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
87
+ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
88
88
  const {
89
89
  column,
90
90
  rowId,
@@ -21,7 +21,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
21
21
  const GridGenericColumnHeaderItem = exports.GridGenericColumnHeaderItem = /*#__PURE__*/React.forwardRef(function GridGenericColumnHeaderItem(props, ref) {
22
22
  const {
23
23
  classes,
24
- columnMenuOpen,
25
24
  colIndex,
26
25
  height,
27
26
  isResizing,
@@ -47,17 +46,11 @@ const GridGenericColumnHeaderItem = exports.GridGenericColumnHeaderItem = /*#__P
47
46
  const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
48
47
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
49
48
  const headerCellRef = React.useRef(null);
50
- const [showColumnMenuIcon, setShowColumnMenuIcon] = React.useState(columnMenuOpen);
51
49
  const handleRef = (0, _utils.unstable_useForkRef)(headerCellRef, ref);
52
50
  let ariaSort = 'none';
53
51
  if (sortDirection != null) {
54
52
  ariaSort = sortDirection === 'asc' ? 'ascending' : 'descending';
55
53
  }
56
- React.useEffect(() => {
57
- if (!showColumnMenuIcon) {
58
- setShowColumnMenuIcon(columnMenuOpen);
59
- }
60
- }, [showColumnMenuIcon, columnMenuOpen]);
61
54
  React.useLayoutEffect(() => {
62
55
  const columnMenuState = apiRef.current.state.columnMenu;
63
56
  if (hasFocus && !columnMenuState.open) {
@@ -22,27 +22,6 @@ var _gridColumnsInterfaces = require("../columns/gridColumnsInterfaces");
22
22
  var _columns = require("../columns");
23
23
  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); }
24
24
  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 && {}.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; }
25
- // TODO: remove support for Safari < 13.
26
- // https://caniuse.com/#search=touch-action
27
- //
28
- // Safari, on iOS, supports touch action since v13.
29
- // Over 80% of the iOS phones are compatible
30
- // in August 2020.
31
- // Utilizing the CSS.supports method to check if touch-action is supported.
32
- // Since CSS.supports is supported on all but Edge@12 and IE and touch-action
33
- // is supported on both Edge@12 and IE if CSS.supports is not available that means that
34
- // touch-action will be supported
35
- let cachedSupportsTouchActionNone = false;
36
- function doesSupportTouchActionNone() {
37
- if (cachedSupportsTouchActionNone === undefined) {
38
- if (typeof CSS !== 'undefined' && typeof CSS.supports === 'function') {
39
- cachedSupportsTouchActionNone = CSS.supports('touch-action', 'none');
40
- } else {
41
- cachedSupportsTouchActionNone = true;
42
- }
43
- }
44
- return cachedSupportsTouchActionNone;
45
- }
46
25
  function trackFinger(event, currentTouchId) {
47
26
  if (currentTouchId !== undefined && event.changedTouches) {
48
27
  for (let i = 0; i < event.changedTouches.length; i += 1) {
@@ -304,6 +283,10 @@ const useGridColumnResize = (apiRef, props) => {
304
283
  if (refs.colDef) {
305
284
  apiRef.current.setColumnWidth(refs.colDef.field, refs.colDef.width);
306
285
  logger.debug(`Updating col ${refs.colDef.field} with new width: ${refs.colDef.width}`);
286
+
287
+ // Since during resizing we update the columns width outside of React, React is unable to
288
+ // reapply the right style properties. We need to sync the state manually.
289
+ // So we reapply the same logic as in https://github.com/mui/mui-x/blob/0511bf65543ca05d2602a5a3e0a6156f2fc8e759/packages/x-data-grid/src/hooks/features/columnHeaders/useGridColumnHeaders.tsx#L405
307
290
  const columnsState = (0, _columns.gridColumnsStateSelector)(apiRef.current.state);
308
291
  refs.groupHeaderElements.forEach(element => {
309
292
  const fields = (0, _domUtils.getFieldsFromGroupHeaderElem)(element);
@@ -397,10 +380,6 @@ const useGridColumnResize = (apiRef, props) => {
397
380
  if (!cellSeparator) {
398
381
  return;
399
382
  }
400
- // If touch-action: none; is not supported we need to prevent the scroll manually.
401
- if (!doesSupportTouchActionNone()) {
402
- event.preventDefault();
403
- }
404
383
  const touch = event.changedTouches[0];
405
384
  if (touch != null) {
406
385
  // A number that uniquely identifies the current finger in the touch session.
@@ -572,7 +551,7 @@ const useGridColumnResize = (apiRef, props) => {
572
551
  }
573
552
  });
574
553
  (0, _utils2.useGridNativeEventListener)(apiRef, () => apiRef.current.columnHeadersContainerRef?.current, 'touchstart', handleTouchStart, {
575
- passive: doesSupportTouchActionNone()
554
+ passive: true
576
555
  });
577
556
  (0, _utils2.useGridApiMethod)(apiRef, {
578
557
  autosizeColumns
@@ -129,24 +129,29 @@ const hydrateColumnsWidth = (rawState, dimensions) => {
129
129
  const flexColumns = [];
130
130
 
131
131
  // For the non-flex columns, compute their width
132
- // For the flex columns, compute there minimum width and how much width must be allocated during the flex allocation
132
+ // For the flex columns, compute their minimum width and how much width must be allocated during the flex allocation
133
133
  rawState.orderedFields.forEach(columnField => {
134
- const newColumn = (0, _extends2.default)({}, rawState.lookup[columnField]);
135
- if (rawState.columnVisibilityModel[columnField] === false) {
136
- newColumn.computedWidth = 0;
137
- } else {
138
- let computedWidth;
139
- if (newColumn.flex && newColumn.flex > 0) {
140
- totalFlexUnits += newColumn.flex;
141
- computedWidth = 0;
142
- flexColumns.push(newColumn);
134
+ let column = rawState.lookup[columnField];
135
+ let computedWidth = 0;
136
+ let isFlex = false;
137
+ if (rawState.columnVisibilityModel[columnField] !== false) {
138
+ if (column.flex && column.flex > 0) {
139
+ totalFlexUnits += column.flex;
140
+ isFlex = true;
143
141
  } else {
144
- computedWidth = (0, _utils.clamp)(newColumn.width || _colDef.GRID_STRING_COL_DEF.width, newColumn.minWidth || _colDef.GRID_STRING_COL_DEF.minWidth, newColumn.maxWidth || _colDef.GRID_STRING_COL_DEF.maxWidth);
142
+ computedWidth = (0, _utils.clamp)(column.width || _colDef.GRID_STRING_COL_DEF.width, column.minWidth || _colDef.GRID_STRING_COL_DEF.minWidth, column.maxWidth || _colDef.GRID_STRING_COL_DEF.maxWidth);
145
143
  }
146
144
  widthAllocatedBeforeFlex += computedWidth;
147
- newColumn.computedWidth = computedWidth;
148
145
  }
149
- columnsLookup[columnField] = newColumn;
146
+ if (column.computedWidth !== computedWidth) {
147
+ column = (0, _extends2.default)({}, column, {
148
+ computedWidth
149
+ });
150
+ }
151
+ if (isFlex) {
152
+ flexColumns.push(column);
153
+ }
154
+ columnsLookup[columnField] = column;
150
155
  });
151
156
  const availableWidth = dimensions === undefined ? 0 : dimensions.viewportOuterSize.width - (dimensions.hasScrollY ? dimensions.scrollbarSize : 0);
152
157
  const initialFreeSpace = Math.max(availableWidth - widthAllocatedBeforeFlex, 0);
@@ -18,6 +18,9 @@ const useGridColumnSpanning = apiRef => {
18
18
  const getCellColSpanInfo = (rowId, columnIndex) => {
19
19
  return lookup.current[rowId]?.[columnIndex];
20
20
  };
21
+ const resetColSpan = () => {
22
+ lookup.current = {};
23
+ };
21
24
 
22
25
  // Calculate `colSpan` for each cell in the row
23
26
  const calculateColSpan = React.useCallback(({
@@ -45,15 +48,12 @@ const useGridColumnSpanning = apiRef => {
45
48
  unstable_getCellColSpanInfo: getCellColSpanInfo
46
49
  };
47
50
  const columnSpanningPrivateApi = {
51
+ resetColSpan,
48
52
  calculateColSpan
49
53
  };
50
54
  (0, _useGridApiMethod.useGridApiMethod)(apiRef, columnSpanningPublicApi, 'public');
51
55
  (0, _useGridApiMethod.useGridApiMethod)(apiRef, columnSpanningPrivateApi, 'private');
52
- const handleColumnReorderChange = React.useCallback(() => {
53
- // `colSpan` needs to be recalculated after column reordering
54
- lookup.current = {};
55
- }, []);
56
- (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'columnOrderChange', handleColumnReorderChange);
56
+ (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'columnOrderChange', resetColSpan);
57
57
  };
58
58
  exports.useGridColumnSpanning = useGridColumnSpanning;
59
59
  function calculateCellColSpan(params) {
@@ -54,7 +54,14 @@ const createScrollCache = (mode, rowBufferPx, columnBufferPx, verticalBuffer, ho
54
54
  direction: ScrollDirection.NONE,
55
55
  buffer: bufferForDirection(mode, ScrollDirection.NONE, rowBufferPx, columnBufferPx, verticalBuffer, horizontalBuffer)
56
56
  });
57
- const isJSDOM = typeof window !== 'undefined' ? /jsdom/.test(window.navigator.userAgent) : false;
57
+ let isJSDOM = false;
58
+ try {
59
+ if (typeof window !== 'undefined') {
60
+ isJSDOM = /jsdom/.test(window.navigator.userAgent);
61
+ }
62
+ } catch (_) {
63
+ /* ignore */
64
+ }
58
65
  const useGridVirtualScroller = () => {
59
66
  const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
60
67
  const rootProps = (0, _useGridRootProps.useGridRootProps)();
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.5.1
2
+ * @mui/x-data-grid v7.6.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -9,7 +9,7 @@ var _getGridLocalization = require("../utils/getGridLocalization");
9
9
  const faIRGrid = {
10
10
  // Root
11
11
  noRowsLabel: 'بدون سطر',
12
- noResultsOverlayLabel: 'نتیجه ای پیدا نشد.',
12
+ noResultsOverlayLabel: 'نتیجه‌ای پیدا نشد.',
13
13
  // Density selector toolbar button text
14
14
  toolbarDensity: 'تراکم',
15
15
  toolbarDensityLabel: 'تراکم',
@@ -103,12 +103,12 @@ const faIRGrid = {
103
103
  columnMenuFilter: 'فیلتر',
104
104
  columnMenuHideColumn: 'مخفی',
105
105
  columnMenuUnsort: 'نامرتب‌کردن',
106
- columnMenuSortAsc: 'مرتب‌کردن صعودی',
107
- columnMenuSortDesc: 'مرتب‌کردن نزولی',
106
+ columnMenuSortAsc: 'مرتب‌سازی صعودی',
107
+ columnMenuSortDesc: 'مرتب‌سازی نزولی',
108
108
  // Column header text
109
109
  columnHeaderFiltersTooltipActive: count => count !== 1 ? `${count} فیلتر‌های فعال` : `${count} فیلتر فعال`,
110
110
  columnHeaderFiltersLabel: 'نمایش فیلترها',
111
- columnHeaderSortIconLabel: 'مرتب‌کردن',
111
+ columnHeaderSortIconLabel: 'مرتب‌سازی',
112
112
  // Rows selected footer text
113
113
  footerRowSelected: count => count !== 1 ? `${count.toLocaleString()} سطرهای انتخاب شده` : `${count.toLocaleString()} سطر انتخاب شده`,
114
114
  // Total row amount footer text
@@ -36,11 +36,10 @@ const fiFIGrid = {
36
36
  toolbarExportPrint: 'Tulosta',
37
37
  toolbarExportExcel: 'Lataa Excel-muodossa',
38
38
  // Columns management text
39
- // columnsManagementSearchTitle: 'Search',
40
- // columnsManagementNoColumns: 'No columns',
41
- // columnsManagementShowHideAllText: 'Show/Hide All',
42
- // columnsManagementReset: 'Reset',
43
-
39
+ columnsManagementSearchTitle: 'Hae',
40
+ columnsManagementNoColumns: 'Ei sarakkeita näytettäväksi',
41
+ columnsManagementShowHideAllText: 'Näytä/Piilota kaikki',
42
+ columnsManagementReset: 'Palauta',
44
43
  // Filter panel text
45
44
  filterPanelAddFilter: 'Lisää suodatin',
46
45
  filterPanelRemoveAll: 'Poista kaikki',
@@ -79,8 +79,7 @@ function findHeaderElementFromField(elem, field) {
79
79
  return elem.querySelector(`[data-field="${field}"]`);
80
80
  }
81
81
  function getFieldsFromGroupHeaderElem(colCellEl) {
82
- const fieldsString = colCellEl.getAttribute('data-fields');
83
- return fieldsString?.startsWith('|-') ? fieldsString.slice(2, -2).split('-|-') : [];
82
+ return colCellEl.getAttribute('data-fields').slice(2, -2).split('-|-');
84
83
  }
85
84
  function findGroupHeaderElementsFromField(elem, field) {
86
85
  return Array.from(elem.querySelectorAll(`[data-fields*="|-${field}-|"]`) ?? []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "7.5.1",
3
+ "version": "7.6.0",
4
4
  "description": "The Community plan edition of the Data Grid components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -37,8 +37,9 @@
37
37
  "directory": "packages/x-data-grid"
38
38
  },
39
39
  "dependencies": {
40
- "@babel/runtime": "^7.24.5",
41
- "@mui/system": "^5.15.14",
40
+ "@babel/runtime": "^7.24.6",
41
+ "@mui/internal-test-utils": "1.0.0-dev.20240529-082515-213b5e33ab",
42
+ "@mui/system": "^5.15.15",
42
43
  "@mui/utils": "^5.15.14",
43
44
  "clsx": "^2.1.1",
44
45
  "prop-types": "^15.8.1",
package/utils/domUtils.js CHANGED
@@ -54,8 +54,7 @@ export function findHeaderElementFromField(elem, field) {
54
54
  return elem.querySelector(`[data-field="${field}"]`);
55
55
  }
56
56
  export function getFieldsFromGroupHeaderElem(colCellEl) {
57
- const fieldsString = colCellEl.getAttribute('data-fields');
58
- return fieldsString?.startsWith('|-') ? fieldsString.slice(2, -2).split('-|-') : [];
57
+ return colCellEl.getAttribute('data-fields').slice(2, -2).split('-|-');
59
58
  }
60
59
  export function findGroupHeaderElementsFromField(elem, field) {
61
60
  return Array.from(elem.querySelectorAll(`[data-fields*="|-${field}-|"]`) ?? []);