@mui/x-data-grid 6.16.3 → 6.17.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 (34) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/DataGrid/DataGrid.js +7 -0
  3. package/DataGrid/useDataGridProps.js +2 -1
  4. package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
  5. package/hooks/features/rows/useGridRowsMeta.js +1 -1
  6. package/hooks/features/virtualization/useGridVirtualScroller.js +9 -1
  7. package/index.js +1 -1
  8. package/legacy/DataGrid/DataGrid.js +7 -0
  9. package/legacy/DataGrid/useDataGridProps.js +2 -1
  10. package/legacy/hooks/features/rows/useGridRowsMeta.js +2 -2
  11. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +9 -1
  12. package/legacy/index.js +1 -1
  13. package/legacy/locales/ptBR.js +13 -14
  14. package/legacy/utils/utils.js +1 -1
  15. package/locales/ptBR.js +13 -14
  16. package/models/api/gridEditingApi.d.ts +2 -2
  17. package/models/props/DataGridProps.d.ts +7 -0
  18. package/modern/DataGrid/DataGrid.js +7 -0
  19. package/modern/DataGrid/useDataGridProps.js +2 -1
  20. package/modern/hooks/features/rows/useGridRowsMeta.js +1 -1
  21. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +9 -1
  22. package/modern/index.js +1 -1
  23. package/modern/locales/ptBR.js +13 -14
  24. package/modern/utils/utils.js +1 -1
  25. package/node/DataGrid/DataGrid.js +7 -0
  26. package/node/DataGrid/useDataGridProps.js +2 -1
  27. package/node/hooks/features/rows/useGridRowsMeta.js +1 -1
  28. package/node/hooks/features/virtualization/useGridVirtualScroller.js +9 -1
  29. package/node/index.js +1 -1
  30. package/node/locales/ptBR.js +13 -14
  31. package/node/utils/utils.js +1 -1
  32. package/package.json +1 -1
  33. package/utils/utils.d.ts +1 -1
  34. package/utils/utils.js +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,72 @@
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
+ ## 6.17.0
7
+
8
+ _Oct 27, 2023_
9
+
10
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 The Tree View package is now officially stable!
13
+
14
+ ![tree-view-example](https://github.com/mui/mui-x/assets/550141/77d1fe66-d912-49ba-b38f-b853fb90446a)
15
+
16
+ - ✨ Improve the handling of non-numeric values by Data Grid aggregation
17
+ - 🚀 Support lines with different domains on the line charts
18
+ - 🐞 Bugfixes
19
+ - 📚 Documentation improvements
20
+
21
+ ### Data Grid
22
+
23
+ #### `@mui/x-data-grid@6.17.0`
24
+
25
+ - [DataGrid] Allow custom debounce time for row positions calculation (#10708) @cherniavskii
26
+ - [DataGrid] Persist stable row index for focused row (#10674) @cherniavskii
27
+
28
+ #### `@mui/x-data-grid-pro@6.17.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
29
+
30
+ Same changes as in `@mui/x-data-grid@6.17.0`, plus:
31
+
32
+ - [DataGridPro] Fix `undefined` values passed to `valueFormatter` for tree leaf nodes (#10748) @cherniavskii
33
+
34
+ #### `@mui/x-data-grid-premium@6.17.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@6.17.0`, plus:
37
+
38
+ - [DataGridPremium] Fix `avg` aggregation to ignore non-numeric values (#10787) @cherniavskii
39
+ - [DataGridPremium] Fix `size` aggregation to ignore `undefined` values (#10745) @cherniavskii
40
+ - [DataGridPremium] Fix `sum` aggregation to ignore non-numeric values (#10730) @cherniavskii
41
+ - [DataGridPremium] Fix cell selection throwing index error on second page and beyond (#10784) @MBilalShafi
42
+
43
+ ### Date Pickers
44
+
45
+ #### `@mui/x-date-pickers@6.17.0`
46
+
47
+ - [fields] POC: Use `contentEditable` on `FakeTextField` (#10779) @flaviendelangle
48
+ - [pickers] Fix weekday label localization (#10809) @LukasTy
49
+
50
+ #### `@mui/x-date-pickers-pro@6.17.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
51
+
52
+ Same changes as in `@mui/x-date-pickers@6.17.0`.
53
+
54
+ ### Charts / `@mui/x-charts@6.0.0-alpha.17`
55
+
56
+ - [charts] Fix text position in Safari (#10815) @lhilgert9
57
+ - [charts] Support lines with different domains (#10801) @alexfauquette
58
+
59
+ ### Tree View / `@mui/x-tree-view@6.17.0`
60
+
61
+ No change
62
+
63
+ ### Docs
64
+
65
+ - [docs] Correct editing related props' description (#10798) @MBilalShafi
66
+ - [docs] Fix RTL data grid demo (#10728) @oliviertassinari
67
+ - [docs] Fix unclosed warning (#10796) @flaviendelangle
68
+ - [docs] Improve performance of `Save and restore the state from external storage` recipe (#10811) @michelengelen
69
+
70
+ - [test] Add missing type on `cleanText` utility function (#10780) @flaviendelangle
71
+
6
72
  ## 6.16.3
7
73
 
8
74
  _Oct 20, 2023_
@@ -596,6 +596,13 @@ DataGridRaw.propTypes = {
596
596
  * Controls the modes of the rows.
597
597
  */
598
598
  rowModesModel: PropTypes.object,
599
+ /**
600
+ * The milliseconds delay to wait after measuring the row height before recalculating row positions.
601
+ * Setting it to a lower value could be useful when using dynamic row height,
602
+ * but might reduce performance when displaying a large number of rows.
603
+ * @default 166
604
+ */
605
+ rowPositionsDebounceMs: PropTypes.number,
599
606
  /**
600
607
  * Set of rows of type [[GridRowsProp]].
601
608
  */
@@ -68,7 +68,8 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
68
68
  keepNonExistentRowsSelected: false,
69
69
  keepColumnPositionIfDraggedOutside: false,
70
70
  unstable_ignoreValueFormatterDuringExport: false,
71
- clipboardCopyCellDelimiter: '\t'
71
+ clipboardCopyCellDelimiter: '\t',
72
+ rowPositionsDebounceMs: 166
72
73
  };
73
74
  const defaultSlots = uncapitalizeObjectKeys(DATA_GRID_DEFAULT_SLOTS_COMPONENTS);
74
75
  export const useDataGridProps = inProps => {
@@ -7,4 +7,4 @@ export declare const rowsMetaStateInitializer: GridStateInitializer;
7
7
  * @requires useGridPageSize (method)
8
8
  * @requires useGridPage (method)
9
9
  */
10
- export declare const useGridRowsMeta: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'getRowHeight' | 'getEstimatedRowHeight' | 'getRowSpacing' | 'pagination' | 'paginationMode' | 'rowHeight'>) => void;
10
+ export declare const useGridRowsMeta: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'getRowHeight' | 'getEstimatedRowHeight' | 'getRowSpacing' | 'pagination' | 'paginationMode' | 'rowHeight' | 'rowPositionsDebounceMs'>) => void;
@@ -179,7 +179,7 @@ export const useGridRowsMeta = (apiRef, props) => {
179
179
  rowsHeightLookup.current[id].needsFirstMeasurement = false;
180
180
  hydrateRowsMeta();
181
181
  }, [hydrateRowsMeta]);
182
- const debouncedHydrateRowsMeta = React.useMemo(() => debounce(hydrateRowsMeta), [hydrateRowsMeta]);
182
+ const debouncedHydrateRowsMeta = React.useMemo(() => debounce(hydrateRowsMeta, props.rowPositionsDebounceMs), [hydrateRowsMeta, props.rowPositionsDebounceMs]);
183
183
  const storeMeasuredRowHeight = React.useCallback((id, height, position) => {
184
184
  if (!rowsHeightLookup.current[id] || !rowsHeightLookup.current[id].autoHeight) {
185
185
  return;
@@ -468,6 +468,7 @@ export const useGridVirtualScroller = props => {
468
468
  rowStyleCache.current = Object.create(null);
469
469
  }
470
470
  const rows = [];
471
+ let isRowWithFocusedCellRendered = false;
471
472
  for (let i = 0; i < renderedRows.length; i += 1) {
472
473
  var _currentPage$range5;
473
474
  const {
@@ -503,6 +504,13 @@ export const useGridVirtualScroller = props => {
503
504
  const style = _extends({}, rowStyle, rootRowStyle);
504
505
  rowStyleCache.current[id] = style;
505
506
  }
507
+ let index = rowIndexOffset + ((currentPage == null || (_currentPage$range5 = currentPage.range) == null ? void 0 : _currentPage$range5.firstRowIndex) || 0) + firstRowToRender + i;
508
+ if (isRowWithFocusedCellNotInRange && (cellFocus == null ? void 0 : cellFocus.id) === id) {
509
+ index = indexOfRowWithFocusedCell;
510
+ isRowWithFocusedCellRendered = true;
511
+ } else if (isRowWithFocusedCellRendered) {
512
+ index -= 1;
513
+ }
506
514
  rows.push( /*#__PURE__*/_jsx(rootProps.slots.row, _extends({
507
515
  row: model,
508
516
  rowId: id,
@@ -516,7 +524,7 @@ export const useGridVirtualScroller = props => {
516
524
  firstColumnToRender: firstColumnToRender,
517
525
  lastColumnToRender: lastColumnToRender,
518
526
  selected: isSelected,
519
- index: rowIndexOffset + ((currentPage == null || (_currentPage$range5 = currentPage.range) == null ? void 0 : _currentPage$range5.firstRowIndex) || 0) + firstRowToRender + i,
527
+ index: index,
520
528
  containerWidth: availableSpace,
521
529
  isLastVisible: lastVisibleRowIndex,
522
530
  position: position
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.16.3
2
+ * @mui/x-data-grid v6.17.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -598,6 +598,13 @@ DataGridRaw.propTypes = {
598
598
  * Controls the modes of the rows.
599
599
  */
600
600
  rowModesModel: PropTypes.object,
601
+ /**
602
+ * The milliseconds delay to wait after measuring the row height before recalculating row positions.
603
+ * Setting it to a lower value could be useful when using dynamic row height,
604
+ * but might reduce performance when displaying a large number of rows.
605
+ * @default 166
606
+ */
607
+ rowPositionsDebounceMs: PropTypes.number,
601
608
  /**
602
609
  * Set of rows of type [[GridRowsProp]].
603
610
  */
@@ -69,7 +69,8 @@ export var DATA_GRID_PROPS_DEFAULT_VALUES = {
69
69
  keepNonExistentRowsSelected: false,
70
70
  keepColumnPositionIfDraggedOutside: false,
71
71
  unstable_ignoreValueFormatterDuringExport: false,
72
- clipboardCopyCellDelimiter: '\t'
72
+ clipboardCopyCellDelimiter: '\t',
73
+ rowPositionsDebounceMs: 166
73
74
  };
74
75
  var defaultSlots = uncapitalizeObjectKeys(DATA_GRID_DEFAULT_SLOTS_COMPONENTS);
75
76
  export var useDataGridProps = function useDataGridProps(inProps) {
@@ -179,8 +179,8 @@ export var useGridRowsMeta = function useGridRowsMeta(apiRef, props) {
179
179
  hydrateRowsMeta();
180
180
  }, [hydrateRowsMeta]);
181
181
  var debouncedHydrateRowsMeta = React.useMemo(function () {
182
- return debounce(hydrateRowsMeta);
183
- }, [hydrateRowsMeta]);
182
+ return debounce(hydrateRowsMeta, props.rowPositionsDebounceMs);
183
+ }, [hydrateRowsMeta, props.rowPositionsDebounceMs]);
184
184
  var storeMeasuredRowHeight = React.useCallback(function (id, height, position) {
185
185
  if (!rowsHeightLookup.current[id] || !rowsHeightLookup.current[id].autoHeight) {
186
186
  return;
@@ -501,6 +501,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
501
501
  rowStyleCache.current = Object.create(null);
502
502
  }
503
503
  var rows = [];
504
+ var isRowWithFocusedCellRendered = false;
504
505
  for (var _i = 0; _i < renderedRows.length; _i += 1) {
505
506
  var _currentPage$range5;
506
507
  var _renderedRows$_i = renderedRows[_i],
@@ -533,6 +534,13 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
533
534
  var style = _extends({}, rowStyle, rootRowStyle);
534
535
  rowStyleCache.current[_id] = style;
535
536
  }
537
+ var index = rowIndexOffset + ((currentPage == null || (_currentPage$range5 = currentPage.range) == null ? void 0 : _currentPage$range5.firstRowIndex) || 0) + firstRowToRender + _i;
538
+ if (isRowWithFocusedCellNotInRange && (cellFocus == null ? void 0 : cellFocus.id) === _id) {
539
+ index = indexOfRowWithFocusedCell;
540
+ isRowWithFocusedCellRendered = true;
541
+ } else if (isRowWithFocusedCellRendered) {
542
+ index -= 1;
543
+ }
536
544
  rows.push( /*#__PURE__*/_jsx(rootProps.slots.row, _extends({
537
545
  row: _model,
538
546
  rowId: _id,
@@ -546,7 +554,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
546
554
  firstColumnToRender: firstColumnToRender,
547
555
  lastColumnToRender: lastColumnToRender,
548
556
  selected: isSelected,
549
- index: rowIndexOffset + ((currentPage == null || (_currentPage$range5 = currentPage.range) == null ? void 0 : _currentPage$range5.firstRowIndex) || 0) + firstRowToRender + _i,
557
+ index: index,
550
558
  containerWidth: availableSpace,
551
559
  isLastVisible: lastVisibleRowIndex,
552
560
  position: position
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.16.3
2
+ * @mui/x-data-grid v6.17.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -62,13 +62,12 @@ var ptBRGrid = {
62
62
  filterOperatorIsEmpty: 'está vazio',
63
63
  filterOperatorIsNotEmpty: 'não está vazio',
64
64
  filterOperatorIsAnyOf: 'é qualquer um dos',
65
- // 'filterOperator=': '=',
66
- // 'filterOperator!=': '!=',
67
- // 'filterOperator>': '>',
68
- // 'filterOperator>=': '>=',
69
- // 'filterOperator<': '<',
70
- // 'filterOperator<=': '<=',
71
-
65
+ 'filterOperator=': 'igual à',
66
+ 'filterOperator!=': 'diferente de',
67
+ 'filterOperator>': 'maior que',
68
+ 'filterOperator>=': 'maior ou igual que',
69
+ 'filterOperator<': 'menor que',
70
+ 'filterOperator<=': 'menor ou igual que',
72
71
  // Header filter operators text
73
72
  headerFilterOperatorContains: 'Contém',
74
73
  headerFilterOperatorEquals: 'Igual',
@@ -76,13 +75,13 @@ var ptBRGrid = {
76
75
  headerFilterOperatorEndsWith: 'Termina com',
77
76
  headerFilterOperatorIs: 'É',
78
77
  headerFilterOperatorNot: 'Não é',
79
- // headerFilterOperatorAfter: 'Is after',
80
- // headerFilterOperatorOnOrAfter: 'Is on or after',
81
- // headerFilterOperatorBefore: 'Is before',
82
- // headerFilterOperatorOnOrBefore: 'Is on or before',
83
- // headerFilterOperatorIsEmpty: 'Is empty',
84
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
85
- // headerFilterOperatorIsAnyOf: 'Is any of',
78
+ headerFilterOperatorAfter: 'Depois de',
79
+ headerFilterOperatorOnOrAfter: 'Está entre ou depois de',
80
+ headerFilterOperatorBefore: 'Antes de',
81
+ headerFilterOperatorOnOrBefore: 'Está entre ou antes de',
82
+ headerFilterOperatorIsEmpty: 'É vazio',
83
+ headerFilterOperatorIsNotEmpty: 'Não é vazio',
84
+ headerFilterOperatorIsAnyOf: 'É algum',
86
85
  'headerFilterOperator=': 'Igual',
87
86
  'headerFilterOperator!=': 'Não igual',
88
87
  'headerFilterOperator>': 'Maior que',
@@ -1,6 +1,6 @@
1
1
  import _typeof from "@babel/runtime/helpers/esm/typeof";
2
2
  export function isNumber(value) {
3
- return typeof value === 'number';
3
+ return typeof value === 'number' && !Number.isNaN(value);
4
4
  }
5
5
  export function isFunction(value) {
6
6
  return typeof value === 'function';
package/locales/ptBR.js CHANGED
@@ -60,13 +60,12 @@ const ptBRGrid = {
60
60
  filterOperatorIsEmpty: 'está vazio',
61
61
  filterOperatorIsNotEmpty: 'não está vazio',
62
62
  filterOperatorIsAnyOf: 'é qualquer um dos',
63
- // 'filterOperator=': '=',
64
- // 'filterOperator!=': '!=',
65
- // 'filterOperator>': '>',
66
- // 'filterOperator>=': '>=',
67
- // 'filterOperator<': '<',
68
- // 'filterOperator<=': '<=',
69
-
63
+ 'filterOperator=': 'igual à',
64
+ 'filterOperator!=': 'diferente de',
65
+ 'filterOperator>': 'maior que',
66
+ 'filterOperator>=': 'maior ou igual que',
67
+ 'filterOperator<': 'menor que',
68
+ 'filterOperator<=': 'menor ou igual que',
70
69
  // Header filter operators text
71
70
  headerFilterOperatorContains: 'Contém',
72
71
  headerFilterOperatorEquals: 'Igual',
@@ -74,13 +73,13 @@ const ptBRGrid = {
74
73
  headerFilterOperatorEndsWith: 'Termina com',
75
74
  headerFilterOperatorIs: 'É',
76
75
  headerFilterOperatorNot: 'Não é',
77
- // headerFilterOperatorAfter: 'Is after',
78
- // headerFilterOperatorOnOrAfter: 'Is on or after',
79
- // headerFilterOperatorBefore: 'Is before',
80
- // headerFilterOperatorOnOrBefore: 'Is on or before',
81
- // headerFilterOperatorIsEmpty: 'Is empty',
82
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
83
- // headerFilterOperatorIsAnyOf: 'Is any of',
76
+ headerFilterOperatorAfter: 'Depois de',
77
+ headerFilterOperatorOnOrAfter: 'Está entre ou depois de',
78
+ headerFilterOperatorBefore: 'Antes de',
79
+ headerFilterOperatorOnOrBefore: 'Está entre ou antes de',
80
+ headerFilterOperatorIsEmpty: 'É vazio',
81
+ headerFilterOperatorIsNotEmpty: 'Não é vazio',
82
+ headerFilterOperatorIsAnyOf: 'É algum',
84
83
  'headerFilterOperator=': 'Igual',
85
84
  'headerFilterOperator!=': 'Não igual',
86
85
  'headerFilterOperator>': 'Maior que',
@@ -172,7 +172,7 @@ export interface GridCellEditingApi extends GridEditingSharedApi {
172
172
  startCellEditMode(params: GridStartCellEditModeParams): void;
173
173
  /**
174
174
  * Puts the cell corresponding to the given row id and field into view mode and updates the original row with the new value stored.
175
- * If `params.ignoreModifications` is `false` it will discard the modifications made.
175
+ * If `params.ignoreModifications` is `true` it will discard the modifications made.
176
176
  * @param {GridStopCellEditModeParams} params The row id and field of the cell to stop editing.
177
177
  */
178
178
  stopCellEditMode(params: GridStopCellEditModeParams): void;
@@ -210,7 +210,7 @@ export interface GridRowEditingApi extends GridEditingSharedApi {
210
210
  startRowEditMode(params: GridStartRowEditModeParams): void;
211
211
  /**
212
212
  * Puts the row corresponding to the given id and into view mode and updates the original row with the new values stored.
213
- * If `params.ignoreModifications` is `false` it will discard the modifications made.
213
+ * If `params.ignoreModifications` is `true` it will discard the modifications made.
214
214
  * @param {GridStopCellEditModeParams} params The row id and field of the cell to stop editing.
215
215
  */
216
216
  stopRowEditMode(params: GridStopRowEditModeParams): void;
@@ -340,6 +340,13 @@ export interface DataGridPropsWithDefaultValues {
340
340
  * @default '\t'
341
341
  */
342
342
  clipboardCopyCellDelimiter: string;
343
+ /**
344
+ * The milliseconds delay to wait after measuring the row height before recalculating row positions.
345
+ * Setting it to a lower value could be useful when using dynamic row height,
346
+ * but might reduce performance when displaying a large number of rows.
347
+ * @default 166
348
+ */
349
+ rowPositionsDebounceMs: number;
343
350
  }
344
351
  /**
345
352
  * The `DataGrid` props with no default value.
@@ -596,6 +596,13 @@ DataGridRaw.propTypes = {
596
596
  * Controls the modes of the rows.
597
597
  */
598
598
  rowModesModel: PropTypes.object,
599
+ /**
600
+ * The milliseconds delay to wait after measuring the row height before recalculating row positions.
601
+ * Setting it to a lower value could be useful when using dynamic row height,
602
+ * but might reduce performance when displaying a large number of rows.
603
+ * @default 166
604
+ */
605
+ rowPositionsDebounceMs: PropTypes.number,
599
606
  /**
600
607
  * Set of rows of type [[GridRowsProp]].
601
608
  */
@@ -68,7 +68,8 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
68
68
  keepNonExistentRowsSelected: false,
69
69
  keepColumnPositionIfDraggedOutside: false,
70
70
  unstable_ignoreValueFormatterDuringExport: false,
71
- clipboardCopyCellDelimiter: '\t'
71
+ clipboardCopyCellDelimiter: '\t',
72
+ rowPositionsDebounceMs: 166
72
73
  };
73
74
  const defaultSlots = uncapitalizeObjectKeys(DATA_GRID_DEFAULT_SLOTS_COMPONENTS);
74
75
  export const useDataGridProps = inProps => {
@@ -174,7 +174,7 @@ export const useGridRowsMeta = (apiRef, props) => {
174
174
  rowsHeightLookup.current[id].needsFirstMeasurement = false;
175
175
  hydrateRowsMeta();
176
176
  }, [hydrateRowsMeta]);
177
- const debouncedHydrateRowsMeta = React.useMemo(() => debounce(hydrateRowsMeta), [hydrateRowsMeta]);
177
+ const debouncedHydrateRowsMeta = React.useMemo(() => debounce(hydrateRowsMeta, props.rowPositionsDebounceMs), [hydrateRowsMeta, props.rowPositionsDebounceMs]);
178
178
  const storeMeasuredRowHeight = React.useCallback((id, height, position) => {
179
179
  if (!rowsHeightLookup.current[id] || !rowsHeightLookup.current[id].autoHeight) {
180
180
  return;
@@ -464,6 +464,7 @@ export const useGridVirtualScroller = props => {
464
464
  rowStyleCache.current = Object.create(null);
465
465
  }
466
466
  const rows = [];
467
+ let isRowWithFocusedCellRendered = false;
467
468
  for (let i = 0; i < renderedRows.length; i += 1) {
468
469
  const {
469
470
  id,
@@ -498,6 +499,13 @@ export const useGridVirtualScroller = props => {
498
499
  const style = _extends({}, rowStyle, rootRowStyle);
499
500
  rowStyleCache.current[id] = style;
500
501
  }
502
+ let index = rowIndexOffset + (currentPage?.range?.firstRowIndex || 0) + firstRowToRender + i;
503
+ if (isRowWithFocusedCellNotInRange && cellFocus?.id === id) {
504
+ index = indexOfRowWithFocusedCell;
505
+ isRowWithFocusedCellRendered = true;
506
+ } else if (isRowWithFocusedCellRendered) {
507
+ index -= 1;
508
+ }
501
509
  rows.push( /*#__PURE__*/_jsx(rootProps.slots.row, _extends({
502
510
  row: model,
503
511
  rowId: id,
@@ -511,7 +519,7 @@ export const useGridVirtualScroller = props => {
511
519
  firstColumnToRender: firstColumnToRender,
512
520
  lastColumnToRender: lastColumnToRender,
513
521
  selected: isSelected,
514
- index: rowIndexOffset + (currentPage?.range?.firstRowIndex || 0) + firstRowToRender + i,
522
+ index: index,
515
523
  containerWidth: availableSpace,
516
524
  isLastVisible: lastVisibleRowIndex,
517
525
  position: position
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.16.3
2
+ * @mui/x-data-grid v6.17.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -60,13 +60,12 @@ const ptBRGrid = {
60
60
  filterOperatorIsEmpty: 'está vazio',
61
61
  filterOperatorIsNotEmpty: 'não está vazio',
62
62
  filterOperatorIsAnyOf: 'é qualquer um dos',
63
- // 'filterOperator=': '=',
64
- // 'filterOperator!=': '!=',
65
- // 'filterOperator>': '>',
66
- // 'filterOperator>=': '>=',
67
- // 'filterOperator<': '<',
68
- // 'filterOperator<=': '<=',
69
-
63
+ 'filterOperator=': 'igual à',
64
+ 'filterOperator!=': 'diferente de',
65
+ 'filterOperator>': 'maior que',
66
+ 'filterOperator>=': 'maior ou igual que',
67
+ 'filterOperator<': 'menor que',
68
+ 'filterOperator<=': 'menor ou igual que',
70
69
  // Header filter operators text
71
70
  headerFilterOperatorContains: 'Contém',
72
71
  headerFilterOperatorEquals: 'Igual',
@@ -74,13 +73,13 @@ const ptBRGrid = {
74
73
  headerFilterOperatorEndsWith: 'Termina com',
75
74
  headerFilterOperatorIs: 'É',
76
75
  headerFilterOperatorNot: 'Não é',
77
- // headerFilterOperatorAfter: 'Is after',
78
- // headerFilterOperatorOnOrAfter: 'Is on or after',
79
- // headerFilterOperatorBefore: 'Is before',
80
- // headerFilterOperatorOnOrBefore: 'Is on or before',
81
- // headerFilterOperatorIsEmpty: 'Is empty',
82
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
83
- // headerFilterOperatorIsAnyOf: 'Is any of',
76
+ headerFilterOperatorAfter: 'Depois de',
77
+ headerFilterOperatorOnOrAfter: 'Está entre ou depois de',
78
+ headerFilterOperatorBefore: 'Antes de',
79
+ headerFilterOperatorOnOrBefore: 'Está entre ou antes de',
80
+ headerFilterOperatorIsEmpty: 'É vazio',
81
+ headerFilterOperatorIsNotEmpty: 'Não é vazio',
82
+ headerFilterOperatorIsAnyOf: 'É algum',
84
83
  'headerFilterOperator=': 'Igual',
85
84
  'headerFilterOperator!=': 'Não igual',
86
85
  'headerFilterOperator>': 'Maior que',
@@ -1,5 +1,5 @@
1
1
  export function isNumber(value) {
2
- return typeof value === 'number';
2
+ return typeof value === 'number' && !Number.isNaN(value);
3
3
  }
4
4
  export function isFunction(value) {
5
5
  return typeof value === 'function';
@@ -604,6 +604,13 @@ DataGridRaw.propTypes = {
604
604
  * Controls the modes of the rows.
605
605
  */
606
606
  rowModesModel: _propTypes.default.object,
607
+ /**
608
+ * The milliseconds delay to wait after measuring the row height before recalculating row positions.
609
+ * Setting it to a lower value could be useful when using dynamic row height,
610
+ * but might reduce performance when displaying a large number of rows.
611
+ * @default 166
612
+ */
613
+ rowPositionsDebounceMs: _propTypes.default.number,
607
614
  /**
608
615
  * Set of rows of type [[GridRowsProp]].
609
616
  */
@@ -77,7 +77,8 @@ const DATA_GRID_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PROPS_DEFAULT_VALUES =
77
77
  keepNonExistentRowsSelected: false,
78
78
  keepColumnPositionIfDraggedOutside: false,
79
79
  unstable_ignoreValueFormatterDuringExport: false,
80
- clipboardCopyCellDelimiter: '\t'
80
+ clipboardCopyCellDelimiter: '\t',
81
+ rowPositionsDebounceMs: 166
81
82
  };
82
83
  const defaultSlots = (0, _utils.uncapitalizeObjectKeys)(_defaultGridSlotsComponents.DATA_GRID_DEFAULT_SLOTS_COMPONENTS);
83
84
  const useDataGridProps = inProps => {
@@ -184,7 +184,7 @@ const useGridRowsMeta = (apiRef, props) => {
184
184
  rowsHeightLookup.current[id].needsFirstMeasurement = false;
185
185
  hydrateRowsMeta();
186
186
  }, [hydrateRowsMeta]);
187
- const debouncedHydrateRowsMeta = React.useMemo(() => (0, _utils.unstable_debounce)(hydrateRowsMeta), [hydrateRowsMeta]);
187
+ const debouncedHydrateRowsMeta = React.useMemo(() => (0, _utils.unstable_debounce)(hydrateRowsMeta, props.rowPositionsDebounceMs), [hydrateRowsMeta, props.rowPositionsDebounceMs]);
188
188
  const storeMeasuredRowHeight = React.useCallback((id, height, position) => {
189
189
  if (!rowsHeightLookup.current[id] || !rowsHeightLookup.current[id].autoHeight) {
190
190
  return;
@@ -475,6 +475,7 @@ const useGridVirtualScroller = props => {
475
475
  rowStyleCache.current = Object.create(null);
476
476
  }
477
477
  const rows = [];
478
+ let isRowWithFocusedCellRendered = false;
478
479
  for (let i = 0; i < renderedRows.length; i += 1) {
479
480
  const {
480
481
  id,
@@ -509,6 +510,13 @@ const useGridVirtualScroller = props => {
509
510
  const style = (0, _extends2.default)({}, rowStyle, rootRowStyle);
510
511
  rowStyleCache.current[id] = style;
511
512
  }
513
+ let index = rowIndexOffset + (currentPage?.range?.firstRowIndex || 0) + firstRowToRender + i;
514
+ if (isRowWithFocusedCellNotInRange && cellFocus?.id === id) {
515
+ index = indexOfRowWithFocusedCell;
516
+ isRowWithFocusedCellRendered = true;
517
+ } else if (isRowWithFocusedCellRendered) {
518
+ index -= 1;
519
+ }
512
520
  rows.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.row, (0, _extends2.default)({
513
521
  row: model,
514
522
  rowId: id,
@@ -522,7 +530,7 @@ const useGridVirtualScroller = props => {
522
530
  firstColumnToRender: firstColumnToRender,
523
531
  lastColumnToRender: lastColumnToRender,
524
532
  selected: isSelected,
525
- index: rowIndexOffset + (currentPage?.range?.firstRowIndex || 0) + firstRowToRender + i,
533
+ index: index,
526
534
  containerWidth: availableSpace,
527
535
  isLastVisible: lastVisibleRowIndex,
528
536
  position: position
package/node/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v6.16.3
2
+ * @mui/x-data-grid v6.17.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -66,13 +66,12 @@ const ptBRGrid = {
66
66
  filterOperatorIsEmpty: 'está vazio',
67
67
  filterOperatorIsNotEmpty: 'não está vazio',
68
68
  filterOperatorIsAnyOf: 'é qualquer um dos',
69
- // 'filterOperator=': '=',
70
- // 'filterOperator!=': '!=',
71
- // 'filterOperator>': '>',
72
- // 'filterOperator>=': '>=',
73
- // 'filterOperator<': '<',
74
- // 'filterOperator<=': '<=',
75
-
69
+ 'filterOperator=': 'igual à',
70
+ 'filterOperator!=': 'diferente de',
71
+ 'filterOperator>': 'maior que',
72
+ 'filterOperator>=': 'maior ou igual que',
73
+ 'filterOperator<': 'menor que',
74
+ 'filterOperator<=': 'menor ou igual que',
76
75
  // Header filter operators text
77
76
  headerFilterOperatorContains: 'Contém',
78
77
  headerFilterOperatorEquals: 'Igual',
@@ -80,13 +79,13 @@ const ptBRGrid = {
80
79
  headerFilterOperatorEndsWith: 'Termina com',
81
80
  headerFilterOperatorIs: 'É',
82
81
  headerFilterOperatorNot: 'Não é',
83
- // headerFilterOperatorAfter: 'Is after',
84
- // headerFilterOperatorOnOrAfter: 'Is on or after',
85
- // headerFilterOperatorBefore: 'Is before',
86
- // headerFilterOperatorOnOrBefore: 'Is on or before',
87
- // headerFilterOperatorIsEmpty: 'Is empty',
88
- // headerFilterOperatorIsNotEmpty: 'Is not empty',
89
- // headerFilterOperatorIsAnyOf: 'Is any of',
82
+ headerFilterOperatorAfter: 'Depois de',
83
+ headerFilterOperatorOnOrAfter: 'Está entre ou depois de',
84
+ headerFilterOperatorBefore: 'Antes de',
85
+ headerFilterOperatorOnOrBefore: 'Está entre ou antes de',
86
+ headerFilterOperatorIsEmpty: 'É vazio',
87
+ headerFilterOperatorIsNotEmpty: 'Não é vazio',
88
+ headerFilterOperatorIsAnyOf: 'É algum',
90
89
  'headerFilterOperator=': 'Igual',
91
90
  'headerFilterOperator!=': 'Não igual',
92
91
  'headerFilterOperator>': 'Maior que',
@@ -13,7 +13,7 @@ exports.isObject = isObject;
13
13
  exports.localStorageAvailable = localStorageAvailable;
14
14
  exports.randomNumberBetween = randomNumberBetween;
15
15
  function isNumber(value) {
16
- return typeof value === 'number';
16
+ return typeof value === 'number' && !Number.isNaN(value);
17
17
  }
18
18
  function isFunction(value) {
19
19
  return typeof value === 'function';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "6.16.3",
3
+ "version": "6.17.0",
4
4
  "description": "The community edition of the data grid component (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
package/utils/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare function isNumber(value: any): value is number;
1
+ export declare function isNumber(value: unknown): value is number;
2
2
  export declare function isFunction(value: any): value is Function;
3
3
  export declare function isObject<TObject = Record<PropertyKey, any>>(value: unknown): value is TObject;
4
4
  export declare function localStorageAvailable(): boolean;
package/utils/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export function isNumber(value) {
2
- return typeof value === 'number';
2
+ return typeof value === 'number' && !Number.isNaN(value);
3
3
  }
4
4
  export function isFunction(value) {
5
5
  return typeof value === 'function';