@mui/x-data-grid-pro 5.12.0 → 5.12.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,63 @@
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
+ ## v5.12.1
7
+
8
+ _Jun 9, 2022_
9
+
10
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Add `reason` to `onFilterModelChange` (#4938) @m4theushw
13
+ - 🔎 Control quick filter input value via model prop (#5013) @alexfauquette
14
+ - 📚 Documentation improvements
15
+ - 🐞 Bugfixes
16
+
17
+ ### `@mui/x-data-grid@v5.12.1` / `@mui/x-data-grid-pro@v5.12.1` / `@mui/x-data-grid-premium@v5.12.1`
18
+
19
+ #### Changes
20
+
21
+ - [DataGrid] Add `reason` to `onFilterModelChange` (#4938) @m4theushw
22
+ - [DataGrid] Restore focus after dismissing the column menu (#5027) @m4theushw
23
+ - [DataGrid] Update quick filter input when model is modified (#5013) @alexfauquette
24
+ - [DataGrid] Fix implicit dependency on react-dom (#5121) @oliviertassinari
25
+ - [DataGrid] Support `getRowId` in row reordering (#5093) @flaviendelangle
26
+ - [DataGridPro] Fix column resizing in RTL mode (#4989) @cherniavskii
27
+ - [DataGridPro] Fix column resizing on touchscreen (#5056) @cherniavskii
28
+ - [l10n] Update Japanese (ja-JP) locale (#5122) @hikotq
29
+ - [l10n] Update Russian (ru-RU) locale (#5069) @Artboomy
30
+
31
+ ### `@mui/x-date-pickers@5.0.0-alpha.6` / `@mui/x-date-pickers-pro@5.0.0-alpha.6`
32
+
33
+ #### Changes
34
+
35
+ - [pickers] Fix usage of `maxDate` / `minDate` / `disableFuture` and `disablePast` (#5081) @flaviendelangle
36
+ - [pickers] Infer mask from `inputFormat` (#5060) @alexfauquette
37
+ - [pickers] Manage input value without using the focus (#4486) @alexfauquette
38
+ - [pickers] Use new localization for doc examples (#5097) @flaviendelangle
39
+ - [pickers] Fix `shouldDisableDate` in range pickers (#5123) @flaviendelangle
40
+ - [l10n] Add Brazilian Portuguese (pt-BR) locale (#5100) @jardelnovaes
41
+ - [l10n] Use `localText` for remaining texts (#4986) @alexfauquette
42
+
43
+ ### Docs
44
+
45
+ - [docs] Implement the focus management on data grid demo links (#5070) @alexfauquette
46
+ - [docs] Fix `301` link to render cell (#5106) @oliviertassinari
47
+ - [docs] Fix broken anchor link @oliviertassinari
48
+ - [docs] Improve movie dataset (#5142) @flaviendelangle
49
+ - [docs] Move all localization documentation in a unique page (#5072) @alexfauquette
50
+ - [docs] Section for overwriting core components i18n keys (#4998) @DanailH
51
+ - [docs] Small grammar and format fixes for Dynamic Row Height section (#5098) @samuelsycamore
52
+
53
+ ### Core
54
+
55
+ - [core] Allows to run tests with different date adapters (#5055) @alexfauquette
56
+ - [core] Prettify the l10n issue (#4928) @alexfauquette
57
+ - [core] Set correct `apiRef` type in row reorder pre processors #5125 @DanailH
58
+ - [core] Stop using `GridEvents` in technical doc (#5157) @flaviendelangle
59
+ - [core] Upgrade monorepo (#5101) @oliviertassinari
60
+ - [test] Fix dynamic row height test failing on Chrome (#5147) @m4theushw
61
+ - [test] Remove delay on server demo for regression tests (#5131) @alexfauquette
62
+
6
63
  ## v5.12.0
7
64
 
8
65
  _May 31, 2022_
@@ -21,6 +78,8 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
21
78
 
22
79
  ### `@mui/x-data-grid@v5.12.0` / `@mui/x-data-grid-pro@v5.12.0` / `@mui/x-data-grid-premium@v5.12.0`
23
80
 
81
+ #### Changes
82
+
24
83
  - [DataGrid] Support dynamic row height (#4859) @m4theushw
25
84
  - [DataGrid] Add `onMenuOpen` and `onMenuClose` props (#4825) @DanailH
26
85
  - [DataGrid] Add generics to `GridActionsColDef` to match `GridColDef` (#4982) @subvertallchris
@@ -42,16 +42,16 @@ const GridRowReorderCell = params => {
42
42
  } // The row might have been deleted
43
43
 
44
44
 
45
- if (!apiRef.current.getRow(params.row.id)) {
45
+ if (!apiRef.current.getRow(params.id)) {
46
46
  return;
47
47
  }
48
48
 
49
- apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.row.id), event);
49
+ apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.id), event);
50
50
 
51
51
  if (propHandler) {
52
52
  propHandler(event);
53
53
  }
54
- }, [apiRef, params.row.id]);
54
+ }, [apiRef, params.id]);
55
55
  const draggableEventHandlers = isDraggable ? {
56
56
  onDragStart: publish('rowDragStart'),
57
57
  onDragOver: publish('rowDragOver'),
@@ -189,7 +189,7 @@ export const useGridColumnPinning = (apiRef, props) => {
189
189
  useGridRegisterPipeProcessor(apiRef, 'canBeReordered', checkIfCanBeReordered);
190
190
  useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
191
191
  useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
192
- apiRef.current.unstable_updateControlState({
192
+ apiRef.current.unstable_registerControlState({
193
193
  stateId: 'pinnedColumns',
194
194
  propModel: props.pinnedColumns,
195
195
  propOnChange: props.onPinnedColumnsChange,
@@ -1,8 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { ownerDocument, useEventCallback } from '@mui/material/utils';
4
- import { gridClasses, GridColumnHeaderSeparatorSides, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
4
+ import { gridClasses, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
5
5
  import { clamp, findParentElementFromClassName } from '@mui/x-data-grid/internals';
6
+ import { useTheme } from '@mui/material/styles';
6
7
  import { findGridCellElementsFromCol, getFieldFromHeaderElem, findHeaderElementFromField } from '../../../utils/domUtils';
7
8
  // TODO: remove support for Safari < 13.
8
9
  // https://caniuse.com/#search=touch-action
@@ -50,10 +51,10 @@ function trackFinger(event, currentTouchId) {
50
51
  };
51
52
  }
52
53
 
53
- function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, separatorSide) {
54
+ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, resizeDirection) {
54
55
  let newWidth = initialOffsetToSeparator;
55
56
 
56
- if (separatorSide === GridColumnHeaderSeparatorSides.Right) {
57
+ if (resizeDirection === 'Right') {
57
58
  newWidth += clickX - columnBounds.left;
58
59
  } else {
59
60
  newWidth += columnBounds.right - clickX;
@@ -62,16 +63,31 @@ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, separat
62
63
  return newWidth;
63
64
  }
64
65
 
65
- function computeOffsetToSeparator(clickX, columnBounds, separatorSide) {
66
- if (separatorSide === GridColumnHeaderSeparatorSides.Left) {
66
+ function computeOffsetToSeparator(clickX, columnBounds, resizeDirection) {
67
+ if (resizeDirection === 'Left') {
67
68
  return clickX - columnBounds.left;
68
69
  }
69
70
 
70
71
  return columnBounds.right - clickX;
71
72
  }
72
73
 
73
- function getSeparatorSide(element) {
74
- return element.classList.contains(gridClasses['columnSeparator--sideRight']) ? GridColumnHeaderSeparatorSides.Right : GridColumnHeaderSeparatorSides.Left;
74
+ function flipResizeDirection(side) {
75
+ if (side === 'Right') {
76
+ return 'Left';
77
+ }
78
+
79
+ return 'Right';
80
+ }
81
+
82
+ function getResizeDirection(element, direction) {
83
+ const side = element.classList.contains(gridClasses['columnSeparator--sideRight']) ? 'Right' : 'Left';
84
+
85
+ if (direction === 'rtl') {
86
+ // Resizing logic should be mirrored in the RTL case
87
+ return flipResizeDirection(side);
88
+ }
89
+
90
+ return side;
75
91
  }
76
92
 
77
93
  export const columnResizeStateInitializer = state => _extends({}, state, {
@@ -88,12 +104,13 @@ export const useGridColumnResize = (apiRef, props) => {
88
104
  const logger = useGridLogger(apiRef, 'useGridColumnResize');
89
105
  const colDefRef = React.useRef();
90
106
  const colElementRef = React.useRef();
91
- const colCellElementsRef = React.useRef(); // To improve accessibility, the separator has padding on both sides.
107
+ const colCellElementsRef = React.useRef();
108
+ const theme = useTheme(); // To improve accessibility, the separator has padding on both sides.
92
109
  // Clicking inside the padding area should be treated as a click in the separator.
93
110
  // This ref stores the offset between the click and the separator.
94
111
 
95
112
  const initialOffsetToSeparator = React.useRef();
96
- const separatorSide = React.useRef();
113
+ const resizeDirection = React.useRef();
97
114
  const stopResizeEventTimeout = React.useRef();
98
115
  const touchId = React.useRef();
99
116
 
@@ -152,7 +169,7 @@ export const useGridColumnResize = (apiRef, props) => {
152
169
  return;
153
170
  }
154
171
 
155
- let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
172
+ let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
156
173
  newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
157
174
  updateWidth(newWidth);
158
175
  const params = {
@@ -188,8 +205,8 @@ export const useGridColumnResize = (apiRef, props) => {
188
205
  colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
189
206
  const doc = ownerDocument(apiRef.current.rootElementRef.current);
190
207
  doc.body.style.cursor = 'col-resize';
191
- separatorSide.current = getSeparatorSide(event.currentTarget);
192
- initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
208
+ resizeDirection.current = getResizeDirection(event.currentTarget, theme.direction);
209
+ initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
193
210
  doc.addEventListener('mousemove', handleResizeMouseMove);
194
211
  doc.addEventListener('mouseup', handleResizeMouseUp);
195
212
  });
@@ -222,7 +239,7 @@ export const useGridColumnResize = (apiRef, props) => {
222
239
  return;
223
240
  }
224
241
 
225
- let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(), separatorSide.current);
242
+ let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
226
243
  newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
227
244
  updateWidth(newWidth);
228
245
  const params = {
@@ -263,8 +280,8 @@ export const useGridColumnResize = (apiRef, props) => {
263
280
  colDefRef.current = colDef;
264
281
  colElementRef.current = findHeaderElementFromField((_apiRef$current$colum2 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum2.current, colDef.field);
265
282
  colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
266
- separatorSide.current = getSeparatorSide(event.target);
267
- initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
283
+ resizeDirection.current = getResizeDirection(event.target, theme.direction);
284
+ initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
268
285
  const doc = ownerDocument(event.currentTarget);
269
286
  doc.addEventListener('touchmove', handleTouchMove);
270
287
  doc.addEventListener('touchend', handleTouchEnd);
@@ -67,7 +67,7 @@ export const useGridDetailPanel = (apiRef, props) => {
67
67
  });
68
68
  }, [apiRef, expandedRowIds]);
69
69
  useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight);
70
- apiRef.current.unstable_updateControlState({
70
+ apiRef.current.unstable_registerControlState({
71
71
  stateId: 'detailPanels',
72
72
  propModel: props.detailPanelExpandedRowIds,
73
73
  propOnChange: props.onDetailPanelExpandedRowIdsChange,
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
- import { GridApiCommunity } from '@mui/x-data-grid/internals';
3
2
  import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
4
- export declare const useGridRowReorderPreProcessors: (apiRef: React.MutableRefObject<GridApiCommunity>, props: DataGridProProcessedProps) => void;
3
+ import { GridApiPro } from '../../../models/gridApiPro';
4
+ export declare const useGridRowReorderPreProcessors: (apiRef: React.MutableRefObject<GridApiPro>, props: DataGridProProcessedProps) => void;
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.12.0
1
+ /** @license MUI v5.12.1
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -43,17 +43,17 @@ var GridRowReorderCell = function GridRowReorderCell(params) {
43
43
  } // The row might have been deleted
44
44
 
45
45
 
46
- if (!apiRef.current.getRow(params.row.id)) {
46
+ if (!apiRef.current.getRow(params.id)) {
47
47
  return;
48
48
  }
49
49
 
50
- apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.row.id), event);
50
+ apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.id), event);
51
51
 
52
52
  if (propHandler) {
53
53
  propHandler(event);
54
54
  }
55
55
  };
56
- }, [apiRef, params.row.id]);
56
+ }, [apiRef, params.id]);
57
57
  var draggableEventHandlers = isDraggable ? {
58
58
  onDragStart: publish('rowDragStart'),
59
59
  onDragOver: publish('rowDragOver'),
@@ -208,7 +208,7 @@ export var useGridColumnPinning = function useGridColumnPinning(apiRef, props) {
208
208
  useGridRegisterPipeProcessor(apiRef, 'canBeReordered', checkIfCanBeReordered);
209
209
  useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
210
210
  useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
211
- apiRef.current.unstable_updateControlState({
211
+ apiRef.current.unstable_registerControlState({
212
212
  stateId: 'pinnedColumns',
213
213
  propModel: props.pinnedColumns,
214
214
  propOnChange: props.onPinnedColumnsChange,
@@ -1,8 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { ownerDocument, useEventCallback } from '@mui/material/utils';
4
- import { gridClasses, GridColumnHeaderSeparatorSides, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
4
+ import { gridClasses, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
5
5
  import { clamp, findParentElementFromClassName } from '@mui/x-data-grid/internals';
6
+ import { useTheme } from '@mui/material/styles';
6
7
  import { findGridCellElementsFromCol, getFieldFromHeaderElem, findHeaderElementFromField } from '../../../utils/domUtils';
7
8
  // TODO: remove support for Safari < 13.
8
9
  // https://caniuse.com/#search=touch-action
@@ -50,10 +51,10 @@ function trackFinger(event, currentTouchId) {
50
51
  };
51
52
  }
52
53
 
53
- function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, separatorSide) {
54
+ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, resizeDirection) {
54
55
  var newWidth = initialOffsetToSeparator;
55
56
 
56
- if (separatorSide === GridColumnHeaderSeparatorSides.Right) {
57
+ if (resizeDirection === 'Right') {
57
58
  newWidth += clickX - columnBounds.left;
58
59
  } else {
59
60
  newWidth += columnBounds.right - clickX;
@@ -62,16 +63,31 @@ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, separat
62
63
  return newWidth;
63
64
  }
64
65
 
65
- function computeOffsetToSeparator(clickX, columnBounds, separatorSide) {
66
- if (separatorSide === GridColumnHeaderSeparatorSides.Left) {
66
+ function computeOffsetToSeparator(clickX, columnBounds, resizeDirection) {
67
+ if (resizeDirection === 'Left') {
67
68
  return clickX - columnBounds.left;
68
69
  }
69
70
 
70
71
  return columnBounds.right - clickX;
71
72
  }
72
73
 
73
- function getSeparatorSide(element) {
74
- return element.classList.contains(gridClasses['columnSeparator--sideRight']) ? GridColumnHeaderSeparatorSides.Right : GridColumnHeaderSeparatorSides.Left;
74
+ function flipResizeDirection(side) {
75
+ if (side === 'Right') {
76
+ return 'Left';
77
+ }
78
+
79
+ return 'Right';
80
+ }
81
+
82
+ function getResizeDirection(element, direction) {
83
+ var side = element.classList.contains(gridClasses['columnSeparator--sideRight']) ? 'Right' : 'Left';
84
+
85
+ if (direction === 'rtl') {
86
+ // Resizing logic should be mirrored in the RTL case
87
+ return flipResizeDirection(side);
88
+ }
89
+
90
+ return side;
75
91
  }
76
92
 
77
93
  export var columnResizeStateInitializer = function columnResizeStateInitializer(state) {
@@ -90,12 +106,13 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
90
106
  var logger = useGridLogger(apiRef, 'useGridColumnResize');
91
107
  var colDefRef = React.useRef();
92
108
  var colElementRef = React.useRef();
93
- var colCellElementsRef = React.useRef(); // To improve accessibility, the separator has padding on both sides.
109
+ var colCellElementsRef = React.useRef();
110
+ var theme = useTheme(); // To improve accessibility, the separator has padding on both sides.
94
111
  // Clicking inside the padding area should be treated as a click in the separator.
95
112
  // This ref stores the offset between the click and the separator.
96
113
 
97
114
  var initialOffsetToSeparator = React.useRef();
98
- var separatorSide = React.useRef();
115
+ var resizeDirection = React.useRef();
99
116
  var stopResizeEventTimeout = React.useRef();
100
117
  var touchId = React.useRef();
101
118
 
@@ -154,7 +171,7 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
154
171
  return;
155
172
  }
156
173
 
157
- var newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
174
+ var newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
158
175
  newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
159
176
  updateWidth(newWidth);
160
177
  var params = {
@@ -190,8 +207,8 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
190
207
  colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
191
208
  var doc = ownerDocument(apiRef.current.rootElementRef.current);
192
209
  doc.body.style.cursor = 'col-resize';
193
- separatorSide.current = getSeparatorSide(event.currentTarget);
194
- initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
210
+ resizeDirection.current = getResizeDirection(event.currentTarget, theme.direction);
211
+ initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
195
212
  doc.addEventListener('mousemove', handleResizeMouseMove);
196
213
  doc.addEventListener('mouseup', handleResizeMouseUp);
197
214
  });
@@ -224,7 +241,7 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
224
241
  return;
225
242
  }
226
243
 
227
- var newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(), separatorSide.current);
244
+ var newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
228
245
  newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
229
246
  updateWidth(newWidth);
230
247
  var params = {
@@ -265,8 +282,8 @@ export var useGridColumnResize = function useGridColumnResize(apiRef, props) {
265
282
  colDefRef.current = colDef;
266
283
  colElementRef.current = findHeaderElementFromField((_apiRef$current$colum2 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum2.current, colDef.field);
267
284
  colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
268
- separatorSide.current = getSeparatorSide(event.target);
269
- initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
285
+ resizeDirection.current = getResizeDirection(event.target, theme.direction);
286
+ initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
270
287
  var doc = ownerDocument(event.currentTarget);
271
288
  doc.addEventListener('touchmove', handleTouchMove);
272
289
  doc.addEventListener('touchend', handleTouchEnd);
@@ -68,7 +68,7 @@ export var useGridDetailPanel = function useGridDetailPanel(apiRef, props) {
68
68
  });
69
69
  }, [apiRef, expandedRowIds]);
70
70
  useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight);
71
- apiRef.current.unstable_updateControlState({
71
+ apiRef.current.unstable_registerControlState({
72
72
  stateId: 'detailPanels',
73
73
  propModel: props.detailPanelExpandedRowIds,
74
74
  propOnChange: props.onDetailPanelExpandedRowIdsChange,
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.12.0
1
+ /** @license MUI v5.12.1
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export var getReleaseInfo = function getReleaseInfo() {
3
- var releaseInfo = "MTY1Mzk0ODAwMDAwMA==";
3
+ var releaseInfo = "MTY1NDgxMjAwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).
@@ -42,16 +42,16 @@ const GridRowReorderCell = params => {
42
42
  } // The row might have been deleted
43
43
 
44
44
 
45
- if (!apiRef.current.getRow(params.row.id)) {
45
+ if (!apiRef.current.getRow(params.id)) {
46
46
  return;
47
47
  }
48
48
 
49
- apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.row.id), event);
49
+ apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.id), event);
50
50
 
51
51
  if (propHandler) {
52
52
  propHandler(event);
53
53
  }
54
- }, [apiRef, params.row.id]);
54
+ }, [apiRef, params.id]);
55
55
  const draggableEventHandlers = isDraggable ? {
56
56
  onDragStart: publish('rowDragStart'),
57
57
  onDragOver: publish('rowDragOver'),
@@ -183,7 +183,7 @@ export const useGridColumnPinning = (apiRef, props) => {
183
183
  useGridRegisterPipeProcessor(apiRef, 'canBeReordered', checkIfCanBeReordered);
184
184
  useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
185
185
  useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
186
- apiRef.current.unstable_updateControlState({
186
+ apiRef.current.unstable_registerControlState({
187
187
  stateId: 'pinnedColumns',
188
188
  propModel: props.pinnedColumns,
189
189
  propOnChange: props.onPinnedColumnsChange,
@@ -1,8 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { ownerDocument, useEventCallback } from '@mui/material/utils';
4
- import { gridClasses, GridColumnHeaderSeparatorSides, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
4
+ import { gridClasses, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
5
5
  import { clamp, findParentElementFromClassName } from '@mui/x-data-grid/internals';
6
+ import { useTheme } from '@mui/material/styles';
6
7
  import { findGridCellElementsFromCol, getFieldFromHeaderElem, findHeaderElementFromField } from '../../../utils/domUtils';
7
8
  // TODO: remove support for Safari < 13.
8
9
  // https://caniuse.com/#search=touch-action
@@ -50,10 +51,10 @@ function trackFinger(event, currentTouchId) {
50
51
  };
51
52
  }
52
53
 
53
- function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, separatorSide) {
54
+ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, resizeDirection) {
54
55
  let newWidth = initialOffsetToSeparator;
55
56
 
56
- if (separatorSide === GridColumnHeaderSeparatorSides.Right) {
57
+ if (resizeDirection === 'Right') {
57
58
  newWidth += clickX - columnBounds.left;
58
59
  } else {
59
60
  newWidth += columnBounds.right - clickX;
@@ -62,16 +63,31 @@ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, separat
62
63
  return newWidth;
63
64
  }
64
65
 
65
- function computeOffsetToSeparator(clickX, columnBounds, separatorSide) {
66
- if (separatorSide === GridColumnHeaderSeparatorSides.Left) {
66
+ function computeOffsetToSeparator(clickX, columnBounds, resizeDirection) {
67
+ if (resizeDirection === 'Left') {
67
68
  return clickX - columnBounds.left;
68
69
  }
69
70
 
70
71
  return columnBounds.right - clickX;
71
72
  }
72
73
 
73
- function getSeparatorSide(element) {
74
- return element.classList.contains(gridClasses['columnSeparator--sideRight']) ? GridColumnHeaderSeparatorSides.Right : GridColumnHeaderSeparatorSides.Left;
74
+ function flipResizeDirection(side) {
75
+ if (side === 'Right') {
76
+ return 'Left';
77
+ }
78
+
79
+ return 'Right';
80
+ }
81
+
82
+ function getResizeDirection(element, direction) {
83
+ const side = element.classList.contains(gridClasses['columnSeparator--sideRight']) ? 'Right' : 'Left';
84
+
85
+ if (direction === 'rtl') {
86
+ // Resizing logic should be mirrored in the RTL case
87
+ return flipResizeDirection(side);
88
+ }
89
+
90
+ return side;
75
91
  }
76
92
 
77
93
  export const columnResizeStateInitializer = state => _extends({}, state, {
@@ -88,12 +104,13 @@ export const useGridColumnResize = (apiRef, props) => {
88
104
  const logger = useGridLogger(apiRef, 'useGridColumnResize');
89
105
  const colDefRef = React.useRef();
90
106
  const colElementRef = React.useRef();
91
- const colCellElementsRef = React.useRef(); // To improve accessibility, the separator has padding on both sides.
107
+ const colCellElementsRef = React.useRef();
108
+ const theme = useTheme(); // To improve accessibility, the separator has padding on both sides.
92
109
  // Clicking inside the padding area should be treated as a click in the separator.
93
110
  // This ref stores the offset between the click and the separator.
94
111
 
95
112
  const initialOffsetToSeparator = React.useRef();
96
- const separatorSide = React.useRef();
113
+ const resizeDirection = React.useRef();
97
114
  const stopResizeEventTimeout = React.useRef();
98
115
  const touchId = React.useRef();
99
116
 
@@ -150,7 +167,7 @@ export const useGridColumnResize = (apiRef, props) => {
150
167
  return;
151
168
  }
152
169
 
153
- let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
170
+ let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
154
171
  newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
155
172
  updateWidth(newWidth);
156
173
  const params = {
@@ -184,8 +201,8 @@ export const useGridColumnResize = (apiRef, props) => {
184
201
  colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
185
202
  const doc = ownerDocument(apiRef.current.rootElementRef.current);
186
203
  doc.body.style.cursor = 'col-resize';
187
- separatorSide.current = getSeparatorSide(event.currentTarget);
188
- initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
204
+ resizeDirection.current = getResizeDirection(event.currentTarget, theme.direction);
205
+ initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
189
206
  doc.addEventListener('mousemove', handleResizeMouseMove);
190
207
  doc.addEventListener('mouseup', handleResizeMouseUp);
191
208
  });
@@ -218,7 +235,7 @@ export const useGridColumnResize = (apiRef, props) => {
218
235
  return;
219
236
  }
220
237
 
221
- let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(), separatorSide.current);
238
+ let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
222
239
  newWidth = clamp(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
223
240
  updateWidth(newWidth);
224
241
  const params = {
@@ -257,8 +274,8 @@ export const useGridColumnResize = (apiRef, props) => {
257
274
  colDefRef.current = colDef;
258
275
  colElementRef.current = findHeaderElementFromField(apiRef.current.columnHeadersElementRef?.current, colDef.field);
259
276
  colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
260
- separatorSide.current = getSeparatorSide(event.target);
261
- initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
277
+ resizeDirection.current = getResizeDirection(event.target, theme.direction);
278
+ initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
262
279
  const doc = ownerDocument(event.currentTarget);
263
280
  doc.addEventListener('touchmove', handleTouchMove);
264
281
  doc.addEventListener('touchend', handleTouchEnd);
@@ -63,7 +63,7 @@ export const useGridDetailPanel = (apiRef, props) => {
63
63
  });
64
64
  }, [apiRef, expandedRowIds]);
65
65
  useGridRegisterPipeProcessor(apiRef, 'rowHeight', addDetailHeight);
66
- apiRef.current.unstable_updateControlState({
66
+ apiRef.current.unstable_registerControlState({
67
67
  stateId: 'detailPanels',
68
68
  propModel: props.detailPanelExpandedRowIds,
69
69
  propOnChange: props.onDetailPanelExpandedRowIdsChange,
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.12.0
1
+ /** @license MUI v5.12.1
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY1Mzk0ODAwMDAwMA==";
3
+ const releaseInfo = "MTY1NDgxMjAwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).
@@ -59,16 +59,16 @@ const GridRowReorderCell = params => {
59
59
  } // The row might have been deleted
60
60
 
61
61
 
62
- if (!apiRef.current.getRow(params.row.id)) {
62
+ if (!apiRef.current.getRow(params.id)) {
63
63
  return;
64
64
  }
65
65
 
66
- apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.row.id), event);
66
+ apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.id), event);
67
67
 
68
68
  if (propHandler) {
69
69
  propHandler(event);
70
70
  }
71
- }, [apiRef, params.row.id]);
71
+ }, [apiRef, params.id]);
72
72
  const draggableEventHandlers = isDraggable ? {
73
73
  onDragStart: publish('rowDragStart'),
74
74
  onDragOver: publish('rowDragOver'),
@@ -213,7 +213,7 @@ const useGridColumnPinning = (apiRef, props) => {
213
213
  (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'canBeReordered', checkIfCanBeReordered);
214
214
  (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'exportState', stateExportPreProcessing);
215
215
  (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'restoreState', stateRestorePreProcessing);
216
- apiRef.current.unstable_updateControlState({
216
+ apiRef.current.unstable_registerControlState({
217
217
  stateId: 'pinnedColumns',
218
218
  propModel: props.pinnedColumns,
219
219
  propOnChange: props.onPinnedColumnsChange,
@@ -17,6 +17,8 @@ var _xDataGrid = require("@mui/x-data-grid");
17
17
 
18
18
  var _internals = require("@mui/x-data-grid/internals");
19
19
 
20
+ var _styles = require("@mui/material/styles");
21
+
20
22
  var _domUtils = require("../../../utils/domUtils");
21
23
 
22
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -69,10 +71,10 @@ function trackFinger(event, currentTouchId) {
69
71
  };
70
72
  }
71
73
 
72
- function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, separatorSide) {
74
+ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, resizeDirection) {
73
75
  let newWidth = initialOffsetToSeparator;
74
76
 
75
- if (separatorSide === _xDataGrid.GridColumnHeaderSeparatorSides.Right) {
77
+ if (resizeDirection === 'Right') {
76
78
  newWidth += clickX - columnBounds.left;
77
79
  } else {
78
80
  newWidth += columnBounds.right - clickX;
@@ -81,16 +83,31 @@ function computeNewWidth(initialOffsetToSeparator, clickX, columnBounds, separat
81
83
  return newWidth;
82
84
  }
83
85
 
84
- function computeOffsetToSeparator(clickX, columnBounds, separatorSide) {
85
- if (separatorSide === _xDataGrid.GridColumnHeaderSeparatorSides.Left) {
86
+ function computeOffsetToSeparator(clickX, columnBounds, resizeDirection) {
87
+ if (resizeDirection === 'Left') {
86
88
  return clickX - columnBounds.left;
87
89
  }
88
90
 
89
91
  return columnBounds.right - clickX;
90
92
  }
91
93
 
92
- function getSeparatorSide(element) {
93
- return element.classList.contains(_xDataGrid.gridClasses['columnSeparator--sideRight']) ? _xDataGrid.GridColumnHeaderSeparatorSides.Right : _xDataGrid.GridColumnHeaderSeparatorSides.Left;
94
+ function flipResizeDirection(side) {
95
+ if (side === 'Right') {
96
+ return 'Left';
97
+ }
98
+
99
+ return 'Right';
100
+ }
101
+
102
+ function getResizeDirection(element, direction) {
103
+ const side = element.classList.contains(_xDataGrid.gridClasses['columnSeparator--sideRight']) ? 'Right' : 'Left';
104
+
105
+ if (direction === 'rtl') {
106
+ // Resizing logic should be mirrored in the RTL case
107
+ return flipResizeDirection(side);
108
+ }
109
+
110
+ return side;
94
111
  }
95
112
 
96
113
  const columnResizeStateInitializer = state => (0, _extends2.default)({}, state, {
@@ -110,12 +127,13 @@ const useGridColumnResize = (apiRef, props) => {
110
127
  const logger = (0, _xDataGrid.useGridLogger)(apiRef, 'useGridColumnResize');
111
128
  const colDefRef = React.useRef();
112
129
  const colElementRef = React.useRef();
113
- const colCellElementsRef = React.useRef(); // To improve accessibility, the separator has padding on both sides.
130
+ const colCellElementsRef = React.useRef();
131
+ const theme = (0, _styles.useTheme)(); // To improve accessibility, the separator has padding on both sides.
114
132
  // Clicking inside the padding area should be treated as a click in the separator.
115
133
  // This ref stores the offset between the click and the separator.
116
134
 
117
135
  const initialOffsetToSeparator = React.useRef();
118
- const separatorSide = React.useRef();
136
+ const resizeDirection = React.useRef();
119
137
  const stopResizeEventTimeout = React.useRef();
120
138
  const touchId = React.useRef();
121
139
 
@@ -174,7 +192,7 @@ const useGridColumnResize = (apiRef, props) => {
174
192
  return;
175
193
  }
176
194
 
177
- let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
195
+ let newWidth = computeNewWidth(initialOffsetToSeparator.current, nativeEvent.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
178
196
  newWidth = (0, _internals.clamp)(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
179
197
  updateWidth(newWidth);
180
198
  const params = {
@@ -210,8 +228,8 @@ const useGridColumnResize = (apiRef, props) => {
210
228
  colCellElementsRef.current = (0, _domUtils.findGridCellElementsFromCol)(colElementRef.current, apiRef.current);
211
229
  const doc = (0, _utils.ownerDocument)(apiRef.current.rootElementRef.current);
212
230
  doc.body.style.cursor = 'col-resize';
213
- separatorSide.current = getSeparatorSide(event.currentTarget);
214
- initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
231
+ resizeDirection.current = getResizeDirection(event.currentTarget, theme.direction);
232
+ initialOffsetToSeparator.current = computeOffsetToSeparator(event.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
215
233
  doc.addEventListener('mousemove', handleResizeMouseMove);
216
234
  doc.addEventListener('mouseup', handleResizeMouseUp);
217
235
  });
@@ -244,7 +262,7 @@ const useGridColumnResize = (apiRef, props) => {
244
262
  return;
245
263
  }
246
264
 
247
- let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(), separatorSide.current);
265
+ let newWidth = computeNewWidth(initialOffsetToSeparator.current, finger.x, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
248
266
  newWidth = (0, _internals.clamp)(newWidth, colDefRef.current.minWidth, colDefRef.current.maxWidth);
249
267
  updateWidth(newWidth);
250
268
  const params = {
@@ -285,8 +303,8 @@ const useGridColumnResize = (apiRef, props) => {
285
303
  colDefRef.current = colDef;
286
304
  colElementRef.current = (0, _domUtils.findHeaderElementFromField)((_apiRef$current$colum2 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum2.current, colDef.field);
287
305
  colCellElementsRef.current = (0, _domUtils.findGridCellElementsFromCol)(colElementRef.current, apiRef.current);
288
- separatorSide.current = getSeparatorSide(event.target);
289
- initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
306
+ resizeDirection.current = getResizeDirection(event.target, theme.direction);
307
+ initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), resizeDirection.current);
290
308
  const doc = (0, _utils.ownerDocument)(event.currentTarget);
291
309
  doc.addEventListener('touchmove', handleTouchMove);
292
310
  doc.addEventListener('touchend', handleTouchEnd);
@@ -89,7 +89,7 @@ const useGridDetailPanel = (apiRef, props) => {
89
89
  });
90
90
  }, [apiRef, expandedRowIds]);
91
91
  (0, _internals.useGridRegisterPipeProcessor)(apiRef, 'rowHeight', addDetailHeight);
92
- apiRef.current.unstable_updateControlState({
92
+ apiRef.current.unstable_registerControlState({
93
93
  stateId: 'detailPanels',
94
94
  propModel: props.detailPanelExpandedRowIds,
95
95
  propOnChange: props.onDetailPanelExpandedRowIdsChange,
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.12.0
1
+ /** @license MUI v5.12.1
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -8,7 +8,7 @@ exports.getReleaseInfo = void 0;
8
8
  var _utils = require("@mui/utils");
9
9
 
10
10
  const getReleaseInfo = () => {
11
- const releaseInfo = "MTY1Mzk0ODAwMDAwMA==";
11
+ const releaseInfo = "MTY1NDgxMjAwMDAwMA==";
12
12
 
13
13
  if (process.env.NODE_ENV !== 'production') {
14
14
  // A simple hack to set the value in the test environment (has no build step).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-pro",
3
- "version": "5.12.0",
3
+ "version": "5.12.1",
4
4
  "description": "The Pro plan edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -33,8 +33,8 @@
33
33
  "dependencies": {
34
34
  "@babel/runtime": "^7.17.2",
35
35
  "@mui/utils": "^5.4.1",
36
- "@mui/x-data-grid": "5.12.0",
37
- "@mui/x-license-pro": "5.12.0",
36
+ "@mui/x-data-grid": "5.12.1",
37
+ "@mui/x-license-pro": "5.12.1",
38
38
  "@types/format-util": "^1.0.2",
39
39
  "clsx": "^1.0.4",
40
40
  "prop-types": "^15.8.1",
@@ -43,7 +43,8 @@
43
43
  "peerDependencies": {
44
44
  "@mui/material": "^5.4.1",
45
45
  "@mui/system": "^5.4.1",
46
- "react": "^17.0.2 || ^18.0.0"
46
+ "react": "^17.0.2 || ^18.0.0",
47
+ "react-dom": "^17.0.2 || ^18.0.0"
47
48
  },
48
49
  "setupFiles": [
49
50
  "<rootDir>/src/setupTests.js"
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTY1Mzk0ODAwMDAwMA==";
3
+ const releaseInfo = "MTY1NDgxMjAwMDAwMA==";
4
4
 
5
5
  if (process.env.NODE_ENV !== 'production') {
6
6
  // A simple hack to set the value in the test environment (has no build step).