@mui/x-data-grid 6.16.3 → 6.18.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 (65) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/DataGrid/DataGrid.js +13 -0
  3. package/DataGrid/useDataGridProps.js +3 -1
  4. package/colDef/gridStringOperators.js +1 -2
  5. package/components/containers/GridRootStyles.js +2 -1
  6. package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +6 -2
  7. package/hooks/core/useGridInitialization.d.ts +1 -1
  8. package/hooks/core/useGridInitialization.js +3 -0
  9. package/hooks/features/filter/gridFilterUtils.d.ts +8 -25
  10. package/hooks/features/filter/gridFilterUtils.js +55 -24
  11. package/hooks/features/filter/useGridFilter.js +2 -2
  12. package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
  13. package/hooks/features/rows/useGridRowsMeta.js +1 -1
  14. package/hooks/features/virtualization/useGridVirtualScroller.js +9 -1
  15. package/index.js +1 -1
  16. package/legacy/DataGrid/DataGrid.js +13 -0
  17. package/legacy/DataGrid/useDataGridProps.js +3 -1
  18. package/legacy/colDef/gridStringOperators.js +1 -2
  19. package/legacy/components/containers/GridRootStyles.js +2 -1
  20. package/legacy/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +6 -2
  21. package/legacy/hooks/core/useGridInitialization.js +3 -0
  22. package/legacy/hooks/features/filter/gridFilterUtils.js +40 -17
  23. package/legacy/hooks/features/filter/useGridFilter.js +2 -2
  24. package/legacy/hooks/features/rows/useGridRowsMeta.js +2 -2
  25. package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +9 -1
  26. package/legacy/index.js +1 -1
  27. package/legacy/locales/ptBR.js +13 -14
  28. package/legacy/utils/utils.js +1 -1
  29. package/locales/ptBR.js +13 -14
  30. package/models/api/gridApiCommon.d.ts +3 -2
  31. package/models/api/gridApiCommunity.d.ts +2 -1
  32. package/models/api/gridCoreApi.d.ts +7 -1
  33. package/models/api/gridEditingApi.d.ts +2 -2
  34. package/models/api/gridFilterApi.d.ts +1 -1
  35. package/models/api/gridLocaleTextApi.d.ts +3 -2
  36. package/models/props/DataGridProps.d.ts +13 -0
  37. package/modern/DataGrid/DataGrid.js +13 -0
  38. package/modern/DataGrid/useDataGridProps.js +3 -1
  39. package/modern/colDef/gridStringOperators.js +1 -2
  40. package/modern/components/containers/GridRootStyles.js +2 -1
  41. package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +6 -2
  42. package/modern/hooks/core/useGridInitialization.js +3 -0
  43. package/modern/hooks/features/filter/gridFilterUtils.js +55 -24
  44. package/modern/hooks/features/filter/useGridFilter.js +2 -2
  45. package/modern/hooks/features/rows/useGridRowsMeta.js +1 -1
  46. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +9 -1
  47. package/modern/index.js +1 -1
  48. package/modern/locales/ptBR.js +13 -14
  49. package/modern/utils/utils.js +1 -1
  50. package/node/DataGrid/DataGrid.js +13 -0
  51. package/node/DataGrid/useDataGridProps.js +3 -1
  52. package/node/colDef/gridStringOperators.js +1 -2
  53. package/node/components/containers/GridRootStyles.js +2 -1
  54. package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +6 -2
  55. package/node/hooks/core/useGridInitialization.js +3 -0
  56. package/node/hooks/features/filter/gridFilterUtils.js +56 -27
  57. package/node/hooks/features/filter/useGridFilter.js +2 -2
  58. package/node/hooks/features/rows/useGridRowsMeta.js +1 -1
  59. package/node/hooks/features/virtualization/useGridVirtualScroller.js +9 -1
  60. package/node/index.js +1 -1
  61. package/node/locales/ptBR.js +13 -14
  62. package/node/utils/utils.js +1 -1
  63. package/package.json +2 -2
  64. package/utils/utils.d.ts +1 -1
  65. package/utils/utils.js +1 -1
@@ -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.18.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.18.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",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@babel/runtime": "^7.23.2",
39
- "@mui/utils": "^5.14.14",
39
+ "@mui/utils": "^5.14.16",
40
40
  "clsx": "^2.0.0",
41
41
  "prop-types": "^15.8.1",
42
42
  "reselect": "^4.1.8"
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';