@mui/x-data-grid 5.17.16 → 5.17.18

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,61 @@
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
+ ## 5.17.18
7
+
8
+ _Jan 5, 2023_
9
+
10
+ We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🐞 Bugfixes
13
+
14
+ ### `@mui/x-data-grid@v5.17.18` / `@mui/x-data-grid-pro@v5.17.18` / `@mui/x-data-grid-premium@v5.17.18`
15
+
16
+ #### Changes
17
+
18
+ - [DataGrid] Fix rows not rendering properly after height change (#7376) @cherniavskii
19
+ - [DataGrid] Fix selected text in cell input not being copied in Firefox (#7330) @cherniavskii
20
+ - [DataGridPremium] Export row grouping column menu components (#7308) @cherniavskii
21
+
22
+ ### `@mui/x-date-pickers@v5.0.13` / `@mui/x-date-pickers-pro@v5.0.13`
23
+
24
+ #### Changes
25
+
26
+ - [pickers] Fix the product license reference name (#7367)
27
+
28
+ ### Docs
29
+
30
+ - [docs] Redirect translated pages (#7370) @cherniavskii
31
+
32
+ ### Core
33
+
34
+ - [core] Fix release date (#7314) @DanailH
35
+ - [core] Fix the product license reference name (#7367) @oliviertassinari
36
+ - [core] Upgrade monorepo (#7344) @cherniavskii
37
+
38
+ ## 5.17.17
39
+
40
+ _Dec 24, 2022_
41
+
42
+ We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
43
+
44
+ - 🌍 Improve Russian (ru-RU) and Korean (ko-KR) locales
45
+ - 🐞 Bugfixes
46
+
47
+ ### `@mui/x-data-grid@v5.17.17` / `@mui/x-data-grid-pro@v5.17.17` / `@mui/x-data-grid-premium@v5.17.17`
48
+
49
+ #### Changes
50
+
51
+ - [DataGrid] Update Russian (ru-RU) locale (#7291) @VeceluXa
52
+ - [DataGridPro] Use row ID as `key` of the detail panels (#7311) @m4theushw
53
+ - [DataGridPremium] Fix `exceljs` import with parcel (#7285) @alexfauquette
54
+
55
+ ### `@mui/x-date-pickers@v5.0.12` / `@mui/x-date-pickers-pro@v5.0.12`
56
+
57
+ #### Changes
58
+
59
+ - [pickers] Improve Korean (ko-KR) locale (#7283) @hanbin9775
60
+
6
61
  ## 5.17.16
7
62
 
8
63
  _Dec 16, 2022_
@@ -20,6 +20,24 @@ function writeToClipboardPolyfill(data) {
20
20
  document.body.removeChild(span);
21
21
  }
22
22
  }
23
+
24
+ function hasNativeSelection(element) {
25
+ var _window$getSelection;
26
+
27
+ if (((_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.toString()) !== '') {
28
+ return true;
29
+ }
30
+
31
+ if (!element) {
32
+ return false;
33
+ }
34
+
35
+ if ((element.selectionEnd || 0) - (element.selectionStart || 0) > 0) {
36
+ return true;
37
+ }
38
+
39
+ return false;
40
+ }
23
41
  /**
24
42
  * @requires useGridCsvExport (method)
25
43
  * @requires useGridSelection (method)
@@ -46,8 +64,6 @@ export const useGridClipboard = apiRef => {
46
64
  }
47
65
  }, [apiRef]);
48
66
  const handleKeydown = React.useCallback(event => {
49
- var _window$getSelection;
50
-
51
67
  const isModifierKeyPressed = event.ctrlKey || event.metaKey || event.altKey; // event.key === 'c' is not enough as alt+c can lead to ©, ç, or other characters on macOS.
52
68
  // event.code === 'KeyC' is not enough as event.code assume a QWERTY keyboard layout which would
53
69
  // be wrong with a Dvorak keyboard (as if pressing J).
@@ -57,7 +73,7 @@ export const useGridClipboard = apiRef => {
57
73
  } // Do nothing if there's a native selection
58
74
 
59
75
 
60
- if (((_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.toString()) !== '') {
76
+ if (hasNativeSelection(event.target)) {
61
77
  return;
62
78
  }
63
79
 
@@ -85,7 +85,10 @@ export const useGridVirtualScroller = props => {
85
85
  top: 0,
86
86
  left: 0
87
87
  });
88
- const [containerWidth, setContainerWidth] = React.useState(null);
88
+ const [containerDimensions, setContainerDimensions] = React.useState({
89
+ width: null,
90
+ height: null
91
+ });
89
92
  const prevTotalWidth = React.useRef(columnsTotalWidth);
90
93
  const getNearestIndexToRender = React.useCallback(offset => {
91
94
  var _currentPage$range, _currentPage$range2;
@@ -129,7 +132,7 @@ export const useGridVirtualScroller = props => {
129
132
  // In the last index, this is not needed because Array.slice doesn't include it.
130
133
 
131
134
  const firstRowIndex = Math.min(getNearestIndexToRender(top), rowsMeta.positions.length - 1);
132
- const lastRowIndex = rootProps.autoHeight ? firstRowIndex + currentPage.rows.length : getNearestIndexToRender(top + rootRef.current.clientHeight);
135
+ const lastRowIndex = rootProps.autoHeight ? firstRowIndex + currentPage.rows.length : getNearestIndexToRender(top + containerDimensions.height);
133
136
  let hasRowWithAutoHeight = false;
134
137
  let firstColumnIndex = 0;
135
138
  let lastColumnIndex = columnPositions.length;
@@ -148,7 +151,7 @@ export const useGridVirtualScroller = props => {
148
151
 
149
152
  if (!hasRowWithAutoHeight) {
150
153
  firstColumnIndex = binarySearch(left, columnPositions);
151
- lastColumnIndex = binarySearch(left + containerWidth, columnPositions);
154
+ lastColumnIndex = binarySearch(left + containerDimensions.width, columnPositions);
152
155
  }
153
156
 
154
157
  return {
@@ -157,7 +160,7 @@ export const useGridVirtualScroller = props => {
157
160
  firstColumnIndex,
158
161
  lastColumnIndex
159
162
  };
160
- }, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerWidth]);
163
+ }, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerDimensions]);
161
164
  useEnhancedEffect(() => {
162
165
  if (disableVirtualization) {
163
166
  renderZoneRef.current.style.transform = `translate3d(0px, 0px, 0px)`;
@@ -168,10 +171,16 @@ export const useGridVirtualScroller = props => {
168
171
  }
169
172
  }, [disableVirtualization]);
170
173
  useEnhancedEffect(() => {
171
- setContainerWidth(rootRef.current.clientWidth);
174
+ setContainerDimensions({
175
+ width: rootRef.current.clientWidth,
176
+ height: rootRef.current.clientHeight
177
+ });
172
178
  }, [rowsMeta.currentPageTotalHeight]);
173
179
  const handleResize = React.useCallback(params => {
174
- setContainerWidth(params.width);
180
+ setContainerDimensions({
181
+ width: params.width,
182
+ height: params.height
183
+ });
175
184
  }, []);
176
185
  useGridApiEventHandler(apiRef, 'resize', handleResize);
177
186
  const updateRenderZonePosition = React.useCallback(nextRenderContext => {
@@ -229,7 +238,7 @@ export const useGridVirtualScroller = props => {
229
238
  prevRenderContext.current = nextRenderContext;
230
239
  }, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
231
240
  useEnhancedEffect(() => {
232
- if (containerWidth == null) {
241
+ if (containerDimensions.width == null) {
233
242
  return;
234
243
  }
235
244
 
@@ -245,7 +254,7 @@ export const useGridVirtualScroller = props => {
245
254
  renderContext: initialRenderContext
246
255
  };
247
256
  apiRef.current.publishEvent('rowsScroll', params);
248
- }, [apiRef, computeRenderContext, containerWidth, updateRenderContext]);
257
+ }, [apiRef, computeRenderContext, containerDimensions.width, updateRenderContext]);
249
258
 
250
259
  const handleScroll = event => {
251
260
  const {
@@ -297,7 +306,7 @@ export const useGridVirtualScroller = props => {
297
306
  renderContext: nextRenderContext,
298
307
  minFirstColumn = renderZoneMinColumnIndex,
299
308
  maxLastColumn = renderZoneMaxColumnIndex,
300
- availableSpace = containerWidth,
309
+ availableSpace = containerDimensions.width,
301
310
  rowIndexOffset = 0,
302
311
  position = 'center'
303
312
  } = params;
@@ -403,7 +412,7 @@ export const useGridVirtualScroller = props => {
403
412
  return rows;
404
413
  };
405
414
 
406
- const needsHorizontalScrollbar = containerWidth && columnsTotalWidth > containerWidth;
415
+ const needsHorizontalScrollbar = containerDimensions.width && columnsTotalWidth > containerDimensions.width;
407
416
  const contentSize = React.useMemo(() => {
408
417
  // In cases where the columns exceed the available width,
409
418
  // the horizontal scrollbar should be shown even when there're no rows.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.17.16
1
+ /** @license MUI X v5.17.18
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.
@@ -20,6 +20,24 @@ function writeToClipboardPolyfill(data) {
20
20
  document.body.removeChild(span);
21
21
  }
22
22
  }
23
+
24
+ function hasNativeSelection(element) {
25
+ var _window$getSelection;
26
+
27
+ if (((_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.toString()) !== '') {
28
+ return true;
29
+ }
30
+
31
+ if (!element) {
32
+ return false;
33
+ }
34
+
35
+ if ((element.selectionEnd || 0) - (element.selectionStart || 0) > 0) {
36
+ return true;
37
+ }
38
+
39
+ return false;
40
+ }
23
41
  /**
24
42
  * @requires useGridCsvExport (method)
25
43
  * @requires useGridSelection (method)
@@ -48,8 +66,6 @@ export var useGridClipboard = function useGridClipboard(apiRef) {
48
66
  }
49
67
  }, [apiRef]);
50
68
  var handleKeydown = React.useCallback(function (event) {
51
- var _window$getSelection;
52
-
53
69
  var isModifierKeyPressed = event.ctrlKey || event.metaKey || event.altKey; // event.key === 'c' is not enough as alt+c can lead to ©, ç, or other characters on macOS.
54
70
  // event.code === 'KeyC' is not enough as event.code assume a QWERTY keyboard layout which would
55
71
  // be wrong with a Dvorak keyboard (as if pressing J).
@@ -59,7 +75,7 @@ export var useGridClipboard = function useGridClipboard(apiRef) {
59
75
  } // Do nothing if there's a native selection
60
76
 
61
77
 
62
- if (((_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.toString()) !== '') {
78
+ if (hasNativeSelection(event.target)) {
63
79
  return;
64
80
  }
65
81
 
@@ -94,10 +94,13 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
94
94
  left: 0
95
95
  });
96
96
 
97
- var _React$useState3 = React.useState(null),
97
+ var _React$useState3 = React.useState({
98
+ width: null,
99
+ height: null
100
+ }),
98
101
  _React$useState4 = _slicedToArray(_React$useState3, 2),
99
- containerWidth = _React$useState4[0],
100
- setContainerWidth = _React$useState4[1];
102
+ containerDimensions = _React$useState4[0],
103
+ setContainerDimensions = _React$useState4[1];
101
104
 
102
105
  var prevTotalWidth = React.useRef(columnsTotalWidth);
103
106
  var getNearestIndexToRender = React.useCallback(function (offset) {
@@ -141,7 +144,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
141
144
  // In the last index, this is not needed because Array.slice doesn't include it.
142
145
 
143
146
  var firstRowIndex = Math.min(getNearestIndexToRender(top), rowsMeta.positions.length - 1);
144
- var lastRowIndex = rootProps.autoHeight ? firstRowIndex + currentPage.rows.length : getNearestIndexToRender(top + rootRef.current.clientHeight);
147
+ var lastRowIndex = rootProps.autoHeight ? firstRowIndex + currentPage.rows.length : getNearestIndexToRender(top + containerDimensions.height);
145
148
  var hasRowWithAutoHeight = false;
146
149
  var firstColumnIndex = 0;
147
150
  var lastColumnIndex = columnPositions.length;
@@ -164,7 +167,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
164
167
 
165
168
  if (!hasRowWithAutoHeight) {
166
169
  firstColumnIndex = binarySearch(left, columnPositions);
167
- lastColumnIndex = binarySearch(left + containerWidth, columnPositions);
170
+ lastColumnIndex = binarySearch(left + containerDimensions.width, columnPositions);
168
171
  }
169
172
 
170
173
  return {
@@ -173,7 +176,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
173
176
  firstColumnIndex: firstColumnIndex,
174
177
  lastColumnIndex: lastColumnIndex
175
178
  };
176
- }, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerWidth]);
179
+ }, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerDimensions]);
177
180
  useEnhancedEffect(function () {
178
181
  if (disableVirtualization) {
179
182
  renderZoneRef.current.style.transform = "translate3d(0px, 0px, 0px)";
@@ -184,10 +187,16 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
184
187
  }
185
188
  }, [disableVirtualization]);
186
189
  useEnhancedEffect(function () {
187
- setContainerWidth(rootRef.current.clientWidth);
190
+ setContainerDimensions({
191
+ width: rootRef.current.clientWidth,
192
+ height: rootRef.current.clientHeight
193
+ });
188
194
  }, [rowsMeta.currentPageTotalHeight]);
189
195
  var handleResize = React.useCallback(function (params) {
190
- setContainerWidth(params.width);
196
+ setContainerDimensions({
197
+ width: params.width,
198
+ height: params.height
199
+ });
191
200
  }, []);
192
201
  useGridApiEventHandler(apiRef, 'resize', handleResize);
193
202
  var updateRenderZonePosition = React.useCallback(function (nextRenderContext) {
@@ -257,7 +266,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
257
266
  prevRenderContext.current = nextRenderContext;
258
267
  }, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
259
268
  useEnhancedEffect(function () {
260
- if (containerWidth == null) {
269
+ if (containerDimensions.width == null) {
261
270
  return;
262
271
  }
263
272
 
@@ -272,7 +281,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
272
281
  renderContext: initialRenderContext
273
282
  };
274
283
  apiRef.current.publishEvent('rowsScroll', params);
275
- }, [apiRef, computeRenderContext, containerWidth, updateRenderContext]);
284
+ }, [apiRef, computeRenderContext, containerDimensions.width, updateRenderContext]);
276
285
 
277
286
  var handleScroll = function handleScroll(event) {
278
287
  var _event$currentTarget = event.currentTarget,
@@ -326,7 +335,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
326
335
  _params$maxLastColumn = params.maxLastColumn,
327
336
  maxLastColumn = _params$maxLastColumn === void 0 ? renderZoneMaxColumnIndex : _params$maxLastColumn,
328
337
  _params$availableSpac = params.availableSpace,
329
- availableSpace = _params$availableSpac === void 0 ? containerWidth : _params$availableSpac,
338
+ availableSpace = _params$availableSpac === void 0 ? containerDimensions.width : _params$availableSpac,
330
339
  _params$rowIndexOffse = params.rowIndexOffset,
331
340
  rowIndexOffset = _params$rowIndexOffse === void 0 ? 0 : _params$rowIndexOffse,
332
341
  _params$position = params.position,
@@ -441,7 +450,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
441
450
  return rows;
442
451
  };
443
452
 
444
- var needsHorizontalScrollbar = containerWidth && columnsTotalWidth > containerWidth;
453
+ var needsHorizontalScrollbar = containerDimensions.width && columnsTotalWidth > containerDimensions.width;
445
454
  var contentSize = React.useMemo(function () {
446
455
  // In cases where the columns exceed the available width,
447
456
  // the horizontal scrollbar should be shown even when there're no rows.
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.17.16
1
+ /** @license MUI X v5.17.18
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.
@@ -50,7 +50,7 @@ var ruRUGrid = {
50
50
  // Filter panel text
51
51
  filterPanelAddFilter: 'Добавить фильтр',
52
52
  filterPanelDeleteIconLabel: 'Удалить',
53
- // filterPanelLinkOperator: 'Logic operator',
53
+ filterPanelLinkOperator: 'Логические операторы',
54
54
  filterPanelOperators: 'Операторы',
55
55
  // TODO v6: rename to filterPanelOperator
56
56
  filterPanelOperatorAnd: 'И',
@@ -120,10 +120,10 @@ var ruRUGrid = {
120
120
  },
121
121
  // Checkbox selection text
122
122
  checkboxSelectionHeaderName: 'Выбор флажка',
123
- // checkboxSelectionSelectAllRows: 'Select all rows',
124
- // checkboxSelectionUnselectAllRows: 'Unselect all rows',
125
- // checkboxSelectionSelectRow: 'Select row',
126
- // checkboxSelectionUnselectRow: 'Unselect row',
123
+ checkboxSelectionSelectAllRows: 'Выбрать все строки',
124
+ checkboxSelectionUnselectAllRows: 'Отменить выбор всех строк',
125
+ checkboxSelectionSelectRow: 'Выбрать строку',
126
+ checkboxSelectionUnselectRow: 'Отменить выбор строки',
127
127
  // Boolean cell text
128
128
  booleanCellTrueLabel: 'истина',
129
129
  booleanCellFalseLabel: 'ложь',
@@ -146,17 +146,17 @@ var ruRUGrid = {
146
146
  return "\u0420\u0430\u0437\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u043F\u043E ".concat(name);
147
147
  },
148
148
  // Master/detail
149
- // detailPanelToggle: 'Detail panel toggle',
149
+ detailPanelToggle: 'Детали',
150
150
  expandDetailPanel: 'Развернуть',
151
- collapseDetailPanel: 'Свернуть' // Row reordering text
152
- // rowReorderingHeaderName: 'Row reordering',
151
+ collapseDetailPanel: 'Свернуть',
152
+ // Row reordering text
153
+ rowReorderingHeaderName: 'Изменение порядка строк',
153
154
  // Aggregation
154
- // aggregationMenuItemHeader: 'Aggregation',
155
- // aggregationFunctionLabelSum: 'sum',
156
- // aggregationFunctionLabelAvg: 'avg',
157
- // aggregationFunctionLabelMin: 'min',
158
- // aggregationFunctionLabelMax: 'max',
159
- // aggregationFunctionLabelSize: 'size',
160
-
155
+ aggregationMenuItemHeader: 'Объединение данных',
156
+ aggregationFunctionLabelSum: 'сумм',
157
+ aggregationFunctionLabelAvg: 'срзнач',
158
+ aggregationFunctionLabelMin: 'мин',
159
+ aggregationFunctionLabelMax: 'макс',
160
+ aggregationFunctionLabelSize: 'счет'
161
161
  };
162
162
  export var ruRU = getGridLocalization(ruRUGrid, ruRUCore);
package/locales/ruRU.js CHANGED
@@ -50,7 +50,7 @@ const ruRUGrid = {
50
50
  // Filter panel text
51
51
  filterPanelAddFilter: 'Добавить фильтр',
52
52
  filterPanelDeleteIconLabel: 'Удалить',
53
- // filterPanelLinkOperator: 'Logic operator',
53
+ filterPanelLinkOperator: 'Логические операторы',
54
54
  filterPanelOperators: 'Операторы',
55
55
  // TODO v6: rename to filterPanelOperator
56
56
  filterPanelOperatorAnd: 'И',
@@ -118,10 +118,10 @@ const ruRUGrid = {
118
118
  footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} из ${totalCount.toLocaleString()}`,
119
119
  // Checkbox selection text
120
120
  checkboxSelectionHeaderName: 'Выбор флажка',
121
- // checkboxSelectionSelectAllRows: 'Select all rows',
122
- // checkboxSelectionUnselectAllRows: 'Unselect all rows',
123
- // checkboxSelectionSelectRow: 'Select row',
124
- // checkboxSelectionUnselectRow: 'Unselect row',
121
+ checkboxSelectionSelectAllRows: 'Выбрать все строки',
122
+ checkboxSelectionUnselectAllRows: 'Отменить выбор всех строк',
123
+ checkboxSelectionSelectRow: 'Выбрать строку',
124
+ checkboxSelectionUnselectRow: 'Отменить выбор строки',
125
125
  // Boolean cell text
126
126
  booleanCellTrueLabel: 'истина',
127
127
  booleanCellFalseLabel: 'ложь',
@@ -140,17 +140,17 @@ const ruRUGrid = {
140
140
  groupColumn: name => `Сгруппировать по ${name}`,
141
141
  unGroupColumn: name => `Разгруппировать по ${name}`,
142
142
  // Master/detail
143
- // detailPanelToggle: 'Detail panel toggle',
143
+ detailPanelToggle: 'Детали',
144
144
  expandDetailPanel: 'Развернуть',
145
- collapseDetailPanel: 'Свернуть' // Row reordering text
146
- // rowReorderingHeaderName: 'Row reordering',
145
+ collapseDetailPanel: 'Свернуть',
146
+ // Row reordering text
147
+ rowReorderingHeaderName: 'Изменение порядка строк',
147
148
  // Aggregation
148
- // aggregationMenuItemHeader: 'Aggregation',
149
- // aggregationFunctionLabelSum: 'sum',
150
- // aggregationFunctionLabelAvg: 'avg',
151
- // aggregationFunctionLabelMin: 'min',
152
- // aggregationFunctionLabelMax: 'max',
153
- // aggregationFunctionLabelSize: 'size',
154
-
149
+ aggregationMenuItemHeader: 'Объединение данных',
150
+ aggregationFunctionLabelSum: 'сумм',
151
+ aggregationFunctionLabelAvg: 'срзнач',
152
+ aggregationFunctionLabelMin: 'мин',
153
+ aggregationFunctionLabelMax: 'макс',
154
+ aggregationFunctionLabelSize: 'счет'
155
155
  };
156
156
  export const ruRU = getGridLocalization(ruRUGrid, ruRUCore);
@@ -20,6 +20,22 @@ function writeToClipboardPolyfill(data) {
20
20
  document.body.removeChild(span);
21
21
  }
22
22
  }
23
+
24
+ function hasNativeSelection(element) {
25
+ if (window.getSelection()?.toString() !== '') {
26
+ return true;
27
+ }
28
+
29
+ if (!element) {
30
+ return false;
31
+ }
32
+
33
+ if ((element.selectionEnd || 0) - (element.selectionStart || 0) > 0) {
34
+ return true;
35
+ }
36
+
37
+ return false;
38
+ }
23
39
  /**
24
40
  * @requires useGridCsvExport (method)
25
41
  * @requires useGridSelection (method)
@@ -55,7 +71,7 @@ export const useGridClipboard = apiRef => {
55
71
  } // Do nothing if there's a native selection
56
72
 
57
73
 
58
- if (window.getSelection()?.toString() !== '') {
74
+ if (hasNativeSelection(event.target)) {
59
75
  return;
60
76
  }
61
77
 
@@ -83,7 +83,10 @@ export const useGridVirtualScroller = props => {
83
83
  top: 0,
84
84
  left: 0
85
85
  });
86
- const [containerWidth, setContainerWidth] = React.useState(null);
86
+ const [containerDimensions, setContainerDimensions] = React.useState({
87
+ width: null,
88
+ height: null
89
+ });
87
90
  const prevTotalWidth = React.useRef(columnsTotalWidth);
88
91
  const getNearestIndexToRender = React.useCallback(offset => {
89
92
  const lastMeasuredIndexRelativeToAllRows = apiRef.current.unstable_getLastMeasuredRowIndex();
@@ -125,7 +128,7 @@ export const useGridVirtualScroller = props => {
125
128
  // In the last index, this is not needed because Array.slice doesn't include it.
126
129
 
127
130
  const firstRowIndex = Math.min(getNearestIndexToRender(top), rowsMeta.positions.length - 1);
128
- const lastRowIndex = rootProps.autoHeight ? firstRowIndex + currentPage.rows.length : getNearestIndexToRender(top + rootRef.current.clientHeight);
131
+ const lastRowIndex = rootProps.autoHeight ? firstRowIndex + currentPage.rows.length : getNearestIndexToRender(top + containerDimensions.height);
129
132
  let hasRowWithAutoHeight = false;
130
133
  let firstColumnIndex = 0;
131
134
  let lastColumnIndex = columnPositions.length;
@@ -144,7 +147,7 @@ export const useGridVirtualScroller = props => {
144
147
 
145
148
  if (!hasRowWithAutoHeight) {
146
149
  firstColumnIndex = binarySearch(left, columnPositions);
147
- lastColumnIndex = binarySearch(left + containerWidth, columnPositions);
150
+ lastColumnIndex = binarySearch(left + containerDimensions.width, columnPositions);
148
151
  }
149
152
 
150
153
  return {
@@ -153,7 +156,7 @@ export const useGridVirtualScroller = props => {
153
156
  firstColumnIndex,
154
157
  lastColumnIndex
155
158
  };
156
- }, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerWidth]);
159
+ }, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerDimensions]);
157
160
  useEnhancedEffect(() => {
158
161
  if (disableVirtualization) {
159
162
  renderZoneRef.current.style.transform = `translate3d(0px, 0px, 0px)`;
@@ -164,10 +167,16 @@ export const useGridVirtualScroller = props => {
164
167
  }
165
168
  }, [disableVirtualization]);
166
169
  useEnhancedEffect(() => {
167
- setContainerWidth(rootRef.current.clientWidth);
170
+ setContainerDimensions({
171
+ width: rootRef.current.clientWidth,
172
+ height: rootRef.current.clientHeight
173
+ });
168
174
  }, [rowsMeta.currentPageTotalHeight]);
169
175
  const handleResize = React.useCallback(params => {
170
- setContainerWidth(params.width);
176
+ setContainerDimensions({
177
+ width: params.width,
178
+ height: params.height
179
+ });
171
180
  }, []);
172
181
  useGridApiEventHandler(apiRef, 'resize', handleResize);
173
182
  const updateRenderZonePosition = React.useCallback(nextRenderContext => {
@@ -225,7 +234,7 @@ export const useGridVirtualScroller = props => {
225
234
  prevRenderContext.current = nextRenderContext;
226
235
  }, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
227
236
  useEnhancedEffect(() => {
228
- if (containerWidth == null) {
237
+ if (containerDimensions.width == null) {
229
238
  return;
230
239
  }
231
240
 
@@ -241,7 +250,7 @@ export const useGridVirtualScroller = props => {
241
250
  renderContext: initialRenderContext
242
251
  };
243
252
  apiRef.current.publishEvent('rowsScroll', params);
244
- }, [apiRef, computeRenderContext, containerWidth, updateRenderContext]);
253
+ }, [apiRef, computeRenderContext, containerDimensions.width, updateRenderContext]);
245
254
 
246
255
  const handleScroll = event => {
247
256
  const {
@@ -293,7 +302,7 @@ export const useGridVirtualScroller = props => {
293
302
  renderContext: nextRenderContext,
294
303
  minFirstColumn = renderZoneMinColumnIndex,
295
304
  maxLastColumn = renderZoneMaxColumnIndex,
296
- availableSpace = containerWidth,
305
+ availableSpace = containerDimensions.width,
297
306
  rowIndexOffset = 0,
298
307
  position = 'center'
299
308
  } = params;
@@ -397,7 +406,7 @@ export const useGridVirtualScroller = props => {
397
406
  return rows;
398
407
  };
399
408
 
400
- const needsHorizontalScrollbar = containerWidth && columnsTotalWidth > containerWidth;
409
+ const needsHorizontalScrollbar = containerDimensions.width && columnsTotalWidth > containerDimensions.width;
401
410
  const contentSize = React.useMemo(() => {
402
411
  // In cases where the columns exceed the available width,
403
412
  // the horizontal scrollbar should be shown even when there're no rows.
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.17.16
1
+ /** @license MUI X v5.17.18
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.
@@ -50,7 +50,7 @@ const ruRUGrid = {
50
50
  // Filter panel text
51
51
  filterPanelAddFilter: 'Добавить фильтр',
52
52
  filterPanelDeleteIconLabel: 'Удалить',
53
- // filterPanelLinkOperator: 'Logic operator',
53
+ filterPanelLinkOperator: 'Логические операторы',
54
54
  filterPanelOperators: 'Операторы',
55
55
  // TODO v6: rename to filterPanelOperator
56
56
  filterPanelOperatorAnd: 'И',
@@ -118,10 +118,10 @@ const ruRUGrid = {
118
118
  footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} из ${totalCount.toLocaleString()}`,
119
119
  // Checkbox selection text
120
120
  checkboxSelectionHeaderName: 'Выбор флажка',
121
- // checkboxSelectionSelectAllRows: 'Select all rows',
122
- // checkboxSelectionUnselectAllRows: 'Unselect all rows',
123
- // checkboxSelectionSelectRow: 'Select row',
124
- // checkboxSelectionUnselectRow: 'Unselect row',
121
+ checkboxSelectionSelectAllRows: 'Выбрать все строки',
122
+ checkboxSelectionUnselectAllRows: 'Отменить выбор всех строк',
123
+ checkboxSelectionSelectRow: 'Выбрать строку',
124
+ checkboxSelectionUnselectRow: 'Отменить выбор строки',
125
125
  // Boolean cell text
126
126
  booleanCellTrueLabel: 'истина',
127
127
  booleanCellFalseLabel: 'ложь',
@@ -140,17 +140,17 @@ const ruRUGrid = {
140
140
  groupColumn: name => `Сгруппировать по ${name}`,
141
141
  unGroupColumn: name => `Разгруппировать по ${name}`,
142
142
  // Master/detail
143
- // detailPanelToggle: 'Detail panel toggle',
143
+ detailPanelToggle: 'Детали',
144
144
  expandDetailPanel: 'Развернуть',
145
- collapseDetailPanel: 'Свернуть' // Row reordering text
146
- // rowReorderingHeaderName: 'Row reordering',
145
+ collapseDetailPanel: 'Свернуть',
146
+ // Row reordering text
147
+ rowReorderingHeaderName: 'Изменение порядка строк',
147
148
  // Aggregation
148
- // aggregationMenuItemHeader: 'Aggregation',
149
- // aggregationFunctionLabelSum: 'sum',
150
- // aggregationFunctionLabelAvg: 'avg',
151
- // aggregationFunctionLabelMin: 'min',
152
- // aggregationFunctionLabelMax: 'max',
153
- // aggregationFunctionLabelSize: 'size',
154
-
149
+ aggregationMenuItemHeader: 'Объединение данных',
150
+ aggregationFunctionLabelSum: 'сумм',
151
+ aggregationFunctionLabelAvg: 'срзнач',
152
+ aggregationFunctionLabelMin: 'мин',
153
+ aggregationFunctionLabelMax: 'макс',
154
+ aggregationFunctionLabelSize: 'счет'
155
155
  };
156
156
  export const ruRU = getGridLocalization(ruRUGrid, ruRUCore);
@@ -32,6 +32,24 @@ function writeToClipboardPolyfill(data) {
32
32
  document.body.removeChild(span);
33
33
  }
34
34
  }
35
+
36
+ function hasNativeSelection(element) {
37
+ var _window$getSelection;
38
+
39
+ if (((_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.toString()) !== '') {
40
+ return true;
41
+ }
42
+
43
+ if (!element) {
44
+ return false;
45
+ }
46
+
47
+ if ((element.selectionEnd || 0) - (element.selectionStart || 0) > 0) {
48
+ return true;
49
+ }
50
+
51
+ return false;
52
+ }
35
53
  /**
36
54
  * @requires useGridCsvExport (method)
37
55
  * @requires useGridSelection (method)
@@ -58,8 +76,6 @@ const useGridClipboard = apiRef => {
58
76
  }
59
77
  }, [apiRef]);
60
78
  const handleKeydown = React.useCallback(event => {
61
- var _window$getSelection;
62
-
63
79
  const isModifierKeyPressed = event.ctrlKey || event.metaKey || event.altKey; // event.key === 'c' is not enough as alt+c can lead to ©, ç, or other characters on macOS.
64
80
  // event.code === 'KeyC' is not enough as event.code assume a QWERTY keyboard layout which would
65
81
  // be wrong with a Dvorak keyboard (as if pressing J).
@@ -69,7 +85,7 @@ const useGridClipboard = apiRef => {
69
85
  } // Do nothing if there's a native selection
70
86
 
71
87
 
72
- if (((_window$getSelection = window.getSelection()) == null ? void 0 : _window$getSelection.toString()) !== '') {
88
+ if (hasNativeSelection(event.target)) {
73
89
  return;
74
90
  }
75
91
 
@@ -122,7 +122,10 @@ const useGridVirtualScroller = props => {
122
122
  top: 0,
123
123
  left: 0
124
124
  });
125
- const [containerWidth, setContainerWidth] = React.useState(null);
125
+ const [containerDimensions, setContainerDimensions] = React.useState({
126
+ width: null,
127
+ height: null
128
+ });
126
129
  const prevTotalWidth = React.useRef(columnsTotalWidth);
127
130
  const getNearestIndexToRender = React.useCallback(offset => {
128
131
  var _currentPage$range, _currentPage$range2;
@@ -166,7 +169,7 @@ const useGridVirtualScroller = props => {
166
169
  // In the last index, this is not needed because Array.slice doesn't include it.
167
170
 
168
171
  const firstRowIndex = Math.min(getNearestIndexToRender(top), rowsMeta.positions.length - 1);
169
- const lastRowIndex = rootProps.autoHeight ? firstRowIndex + currentPage.rows.length : getNearestIndexToRender(top + rootRef.current.clientHeight);
172
+ const lastRowIndex = rootProps.autoHeight ? firstRowIndex + currentPage.rows.length : getNearestIndexToRender(top + containerDimensions.height);
170
173
  let hasRowWithAutoHeight = false;
171
174
  let firstColumnIndex = 0;
172
175
  let lastColumnIndex = columnPositions.length;
@@ -185,7 +188,7 @@ const useGridVirtualScroller = props => {
185
188
 
186
189
  if (!hasRowWithAutoHeight) {
187
190
  firstColumnIndex = binarySearch(left, columnPositions);
188
- lastColumnIndex = binarySearch(left + containerWidth, columnPositions);
191
+ lastColumnIndex = binarySearch(left + containerDimensions.width, columnPositions);
189
192
  }
190
193
 
191
194
  return {
@@ -194,7 +197,7 @@ const useGridVirtualScroller = props => {
194
197
  firstColumnIndex,
195
198
  lastColumnIndex
196
199
  };
197
- }, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerWidth]);
200
+ }, [disableVirtualization, getNearestIndexToRender, rowsMeta.positions.length, rootProps.autoHeight, rootProps.rowBuffer, currentPage.rows, columnPositions, visibleColumns.length, apiRef, containerDimensions]);
198
201
  (0, _utils.unstable_useEnhancedEffect)(() => {
199
202
  if (disableVirtualization) {
200
203
  renderZoneRef.current.style.transform = `translate3d(0px, 0px, 0px)`;
@@ -205,10 +208,16 @@ const useGridVirtualScroller = props => {
205
208
  }
206
209
  }, [disableVirtualization]);
207
210
  (0, _utils.unstable_useEnhancedEffect)(() => {
208
- setContainerWidth(rootRef.current.clientWidth);
211
+ setContainerDimensions({
212
+ width: rootRef.current.clientWidth,
213
+ height: rootRef.current.clientHeight
214
+ });
209
215
  }, [rowsMeta.currentPageTotalHeight]);
210
216
  const handleResize = React.useCallback(params => {
211
- setContainerWidth(params.width);
217
+ setContainerDimensions({
218
+ width: params.width,
219
+ height: params.height
220
+ });
212
221
  }, []);
213
222
  (0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'resize', handleResize);
214
223
  const updateRenderZonePosition = React.useCallback(nextRenderContext => {
@@ -266,7 +275,7 @@ const useGridVirtualScroller = props => {
266
275
  prevRenderContext.current = nextRenderContext;
267
276
  }, [apiRef, setRenderContext, prevRenderContext, currentPage.rows.length, rootProps.rowBuffer]);
268
277
  (0, _utils.unstable_useEnhancedEffect)(() => {
269
- if (containerWidth == null) {
278
+ if (containerDimensions.width == null) {
270
279
  return;
271
280
  }
272
281
 
@@ -282,7 +291,7 @@ const useGridVirtualScroller = props => {
282
291
  renderContext: initialRenderContext
283
292
  };
284
293
  apiRef.current.publishEvent('rowsScroll', params);
285
- }, [apiRef, computeRenderContext, containerWidth, updateRenderContext]);
294
+ }, [apiRef, computeRenderContext, containerDimensions.width, updateRenderContext]);
286
295
 
287
296
  const handleScroll = event => {
288
297
  const {
@@ -334,7 +343,7 @@ const useGridVirtualScroller = props => {
334
343
  renderContext: nextRenderContext,
335
344
  minFirstColumn = renderZoneMinColumnIndex,
336
345
  maxLastColumn = renderZoneMaxColumnIndex,
337
- availableSpace = containerWidth,
346
+ availableSpace = containerDimensions.width,
338
347
  rowIndexOffset = 0,
339
348
  position = 'center'
340
349
  } = params;
@@ -440,7 +449,7 @@ const useGridVirtualScroller = props => {
440
449
  return rows;
441
450
  };
442
451
 
443
- const needsHorizontalScrollbar = containerWidth && columnsTotalWidth > containerWidth;
452
+ const needsHorizontalScrollbar = containerDimensions.width && columnsTotalWidth > containerDimensions.width;
444
453
  const contentSize = React.useMemo(() => {
445
454
  // In cases where the columns exceed the available width,
446
455
  // the horizontal scrollbar should be shown even when there're no rows.
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.17.16
1
+ /** @license MUI X v5.17.18
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.
@@ -59,7 +59,7 @@ const ruRUGrid = {
59
59
  // Filter panel text
60
60
  filterPanelAddFilter: 'Добавить фильтр',
61
61
  filterPanelDeleteIconLabel: 'Удалить',
62
- // filterPanelLinkOperator: 'Logic operator',
62
+ filterPanelLinkOperator: 'Логические операторы',
63
63
  filterPanelOperators: 'Операторы',
64
64
  // TODO v6: rename to filterPanelOperator
65
65
  filterPanelOperatorAnd: 'И',
@@ -127,10 +127,10 @@ const ruRUGrid = {
127
127
  footerTotalVisibleRows: (visibleCount, totalCount) => `${visibleCount.toLocaleString()} из ${totalCount.toLocaleString()}`,
128
128
  // Checkbox selection text
129
129
  checkboxSelectionHeaderName: 'Выбор флажка',
130
- // checkboxSelectionSelectAllRows: 'Select all rows',
131
- // checkboxSelectionUnselectAllRows: 'Unselect all rows',
132
- // checkboxSelectionSelectRow: 'Select row',
133
- // checkboxSelectionUnselectRow: 'Unselect row',
130
+ checkboxSelectionSelectAllRows: 'Выбрать все строки',
131
+ checkboxSelectionUnselectAllRows: 'Отменить выбор всех строк',
132
+ checkboxSelectionSelectRow: 'Выбрать строку',
133
+ checkboxSelectionUnselectRow: 'Отменить выбор строки',
134
134
  // Boolean cell text
135
135
  booleanCellTrueLabel: 'истина',
136
136
  booleanCellFalseLabel: 'ложь',
@@ -149,18 +149,18 @@ const ruRUGrid = {
149
149
  groupColumn: name => `Сгруппировать по ${name}`,
150
150
  unGroupColumn: name => `Разгруппировать по ${name}`,
151
151
  // Master/detail
152
- // detailPanelToggle: 'Detail panel toggle',
152
+ detailPanelToggle: 'Детали',
153
153
  expandDetailPanel: 'Развернуть',
154
- collapseDetailPanel: 'Свернуть' // Row reordering text
155
- // rowReorderingHeaderName: 'Row reordering',
154
+ collapseDetailPanel: 'Свернуть',
155
+ // Row reordering text
156
+ rowReorderingHeaderName: 'Изменение порядка строк',
156
157
  // Aggregation
157
- // aggregationMenuItemHeader: 'Aggregation',
158
- // aggregationFunctionLabelSum: 'sum',
159
- // aggregationFunctionLabelAvg: 'avg',
160
- // aggregationFunctionLabelMin: 'min',
161
- // aggregationFunctionLabelMax: 'max',
162
- // aggregationFunctionLabelSize: 'size',
163
-
158
+ aggregationMenuItemHeader: 'Объединение данных',
159
+ aggregationFunctionLabelSum: 'сумм',
160
+ aggregationFunctionLabelAvg: 'срзнач',
161
+ aggregationFunctionLabelMin: 'мин',
162
+ aggregationFunctionLabelMax: 'макс',
163
+ aggregationFunctionLabelSize: 'счет'
164
164
  };
165
165
  const ruRU = (0, _getGridLocalization.getGridLocalization)(ruRUGrid, _locale.ruRU);
166
166
  exports.ruRU = ruRU;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "5.17.16",
3
+ "version": "5.17.18",
4
4
  "description": "The community edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",