@mui/x-data-grid 7.6.1 → 7.7.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 (54) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/components/GridRow.js +0 -6
  3. package/components/columnHeaders/GridColumnGroupHeader.js +1 -1
  4. package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +16 -8
  5. package/components/toolbar/GridToolbarQuickFilter.js +0 -7
  6. package/hooks/features/dimensions/useGridDimensions.js +11 -12
  7. package/hooks/features/filter/gridFilterUtils.js +1 -3
  8. package/hooks/features/filter/useGridFilter.js +16 -8
  9. package/hooks/features/rows/useGridRowsMeta.js +1 -1
  10. package/hooks/features/virtualization/useGridVirtualScroller.js +3 -0
  11. package/index.js +1 -1
  12. package/locales/beBY.js +8 -8
  13. package/locales/faIR.js +1 -2
  14. package/locales/ptBR.js +1 -2
  15. package/locales/ruRU.js +26 -30
  16. package/locales/ukUA.js +6 -5
  17. package/models/api/gridFilterApi.d.ts +7 -0
  18. package/modern/components/GridRow.js +0 -6
  19. package/modern/components/columnHeaders/GridColumnGroupHeader.js +1 -1
  20. package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +16 -8
  21. package/modern/components/toolbar/GridToolbarQuickFilter.js +0 -7
  22. package/modern/hooks/features/dimensions/useGridDimensions.js +11 -12
  23. package/modern/hooks/features/filter/gridFilterUtils.js +1 -3
  24. package/modern/hooks/features/filter/useGridFilter.js +16 -8
  25. package/modern/hooks/features/rows/useGridRowsMeta.js +1 -1
  26. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +3 -0
  27. package/modern/index.js +1 -1
  28. package/modern/locales/beBY.js +8 -8
  29. package/modern/locales/faIR.js +1 -2
  30. package/modern/locales/ptBR.js +1 -2
  31. package/modern/locales/ruRU.js +26 -30
  32. package/modern/locales/ukUA.js +6 -5
  33. package/modern/utils/domUtils.js +3 -0
  34. package/modern/utils/fastObjectShallowCompare.js +0 -4
  35. package/node/components/GridRow.js +0 -6
  36. package/node/components/columnHeaders/GridColumnGroupHeader.js +1 -1
  37. package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +16 -8
  38. package/node/components/toolbar/GridToolbarQuickFilter.js +0 -7
  39. package/node/hooks/features/dimensions/useGridDimensions.js +11 -12
  40. package/node/hooks/features/filter/gridFilterUtils.js +1 -3
  41. package/node/hooks/features/filter/useGridFilter.js +16 -8
  42. package/node/hooks/features/rows/useGridRowsMeta.js +1 -1
  43. package/node/hooks/features/virtualization/useGridVirtualScroller.js +3 -0
  44. package/node/index.js +1 -1
  45. package/node/locales/beBY.js +8 -8
  46. package/node/locales/faIR.js +1 -2
  47. package/node/locales/ptBR.js +1 -2
  48. package/node/locales/ruRU.js +26 -30
  49. package/node/locales/ukUA.js +6 -5
  50. package/node/utils/domUtils.js +3 -0
  51. package/node/utils/fastObjectShallowCompare.js +0 -4
  52. package/package.json +2 -2
  53. package/utils/domUtils.js +3 -0
  54. package/utils/fastObjectShallowCompare.js +0 -4
@@ -6,6 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.ruRU = void 0;
7
7
  var _locale = require("@mui/material/locale");
8
8
  var _getGridLocalization = require("../utils/getGridLocalization");
9
+ function getPluralForm(count, options) {
10
+ const penultimateDigit = Math.floor(count / 10) % 10;
11
+ const lastDigit = count % 10;
12
+ let pluralForm = options.many;
13
+ if (penultimateDigit !== 1 && lastDigit > 1 && lastDigit < 5) {
14
+ pluralForm = options.few;
15
+ } else if (penultimateDigit !== 1 && lastDigit === 1) {
16
+ pluralForm = options.one;
17
+ }
18
+ return `${count} ${pluralForm}`;
19
+ }
9
20
  const ruRUGrid = {
10
21
  // Root
11
22
  noRowsLabel: 'Нет строк',
@@ -24,16 +35,11 @@ const ruRUGrid = {
24
35
  toolbarFiltersLabel: 'Показать фильтры',
25
36
  toolbarFiltersTooltipHide: 'Скрыть фильтры',
26
37
  toolbarFiltersTooltipShow: 'Показать фильтры',
27
- toolbarFiltersTooltipActive: count => {
28
- let pluralForm = 'активных фильтров';
29
- const lastDigit = count % 10;
30
- if (lastDigit > 1 && lastDigit < 5) {
31
- pluralForm = 'активных фильтра';
32
- } else if (lastDigit === 1) {
33
- pluralForm = 'активный фильтр';
34
- }
35
- return `${count} ${pluralForm}`;
36
- },
38
+ toolbarFiltersTooltipActive: count => getPluralForm(count, {
39
+ one: 'активный фильтр',
40
+ few: 'активных фильтра',
41
+ many: 'активных фильтров'
42
+ }),
37
43
  // Quick filter toolbar field
38
44
  toolbarQuickFilterPlaceholder: 'Поиск…',
39
45
  toolbarQuickFilterLabel: 'Поиск',
@@ -115,29 +121,19 @@ const ruRUGrid = {
115
121
  columnMenuSortAsc: 'Сортировать по возрастанию',
116
122
  columnMenuSortDesc: 'Сортировать по убыванию',
117
123
  // Column header text
118
- columnHeaderFiltersTooltipActive: count => {
119
- let pluralForm = 'активных фильтров';
120
- const lastDigit = count % 10;
121
- if (lastDigit > 1 && lastDigit < 5) {
122
- pluralForm = 'активных фильтра';
123
- } else if (lastDigit === 1) {
124
- pluralForm = 'активный фильтр';
125
- }
126
- return `${count} ${pluralForm}`;
127
- },
124
+ columnHeaderFiltersTooltipActive: count => getPluralForm(count, {
125
+ one: 'активный фильтр',
126
+ few: 'активных фильтра',
127
+ many: 'активных фильтров'
128
+ }),
128
129
  columnHeaderFiltersLabel: 'Показать фильтры',
129
130
  columnHeaderSortIconLabel: 'Сортировать',
130
131
  // Rows selected footer text
131
- footerRowSelected: count => {
132
- let pluralForm = 'строк выбрано';
133
- const lastDigit = count % 10;
134
- if (lastDigit > 1 && lastDigit < 5) {
135
- pluralForm = 'строки выбраны';
136
- } else if (lastDigit === 1) {
137
- pluralForm = 'строка выбрана';
138
- }
139
- return `${count} ${pluralForm}`;
140
- },
132
+ footerRowSelected: count => getPluralForm(count, {
133
+ one: 'строка выбрана',
134
+ few: 'строки выбраны',
135
+ many: 'строк выбрано'
136
+ }),
141
137
  // Total row amount footer text
142
138
  footerTotalRows: 'Всего строк:',
143
139
  // Total visible row amount footer text
@@ -6,16 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.ukUA = void 0;
7
7
  var _locale = require("@mui/material/locale");
8
8
  var _getGridLocalization = require("../utils/getGridLocalization");
9
- const getPluralForm = (count, options) => {
10
- let pluralForm = options.many;
9
+ function getPluralForm(count, options) {
10
+ const penultimateDigit = Math.floor(count / 10) % 10;
11
11
  const lastDigit = count % 10;
12
- if (lastDigit > 1 && lastDigit < 5) {
12
+ let pluralForm = options.many;
13
+ if (penultimateDigit !== 1 && lastDigit > 1 && lastDigit < 5) {
13
14
  pluralForm = options.few;
14
- } else if (lastDigit === 1) {
15
+ } else if (penultimateDigit !== 1 && lastDigit === 1) {
15
16
  pluralForm = options.one;
16
17
  }
17
18
  return `${count} ${pluralForm}`;
18
- };
19
+ }
19
20
  const ukUAGrid = {
20
21
  // Root
21
22
  noRowsLabel: 'Немає рядків',
@@ -30,6 +30,9 @@ function isOverflown(element) {
30
30
  function findParentElementFromClassName(elem, className) {
31
31
  return elem.closest(`.${className}`);
32
32
  }
33
+
34
+ // TODO, eventually replaces this function with CSS.escape, once available in jsdom, either added manually or built in
35
+ // https://github.com/jsdom/jsdom/issues/1550#issuecomment-236734471
33
36
  function escapeOperandAttributeSelector(operand) {
34
37
  return operand.replace(/["\\]/g, '\\$&');
35
38
  }
@@ -15,7 +15,6 @@ function fastObjectShallowCompare(a, b) {
15
15
  let aLength = 0;
16
16
  let bLength = 0;
17
17
 
18
- /* eslint-disable no-restricted-syntax */
19
18
  /* eslint-disable guard-for-in */
20
19
  for (const key in a) {
21
20
  aLength += 1;
@@ -31,8 +30,5 @@ function fastObjectShallowCompare(a, b) {
31
30
  for (const _ in b) {
32
31
  bLength += 1;
33
32
  }
34
- /* eslint-enable no-restricted-syntax */
35
- /* eslint-enable guard-for-in */
36
-
37
33
  return aLength === bLength;
38
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid",
3
- "version": "7.6.1",
3
+ "version": "7.7.0",
4
4
  "description": "The Community plan edition of the Data Grid components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -37,7 +37,7 @@
37
37
  "directory": "packages/x-data-grid"
38
38
  },
39
39
  "dependencies": {
40
- "@babel/runtime": "^7.24.6",
40
+ "@babel/runtime": "^7.24.7",
41
41
  "@mui/system": "^5.15.15",
42
42
  "@mui/utils": "^5.15.14",
43
43
  "clsx": "^2.1.1",
package/utils/domUtils.js CHANGED
@@ -5,6 +5,9 @@ export function isOverflown(element) {
5
5
  export function findParentElementFromClassName(elem, className) {
6
6
  return elem.closest(`.${className}`);
7
7
  }
8
+
9
+ // TODO, eventually replaces this function with CSS.escape, once available in jsdom, either added manually or built in
10
+ // https://github.com/jsdom/jsdom/issues/1550#issuecomment-236734471
8
11
  export function escapeOperandAttributeSelector(operand) {
9
12
  return operand.replace(/["\\]/g, '\\$&');
10
13
  }
@@ -9,7 +9,6 @@ export function fastObjectShallowCompare(a, b) {
9
9
  let aLength = 0;
10
10
  let bLength = 0;
11
11
 
12
- /* eslint-disable no-restricted-syntax */
13
12
  /* eslint-disable guard-for-in */
14
13
  for (const key in a) {
15
14
  aLength += 1;
@@ -25,8 +24,5 @@ export function fastObjectShallowCompare(a, b) {
25
24
  for (const _ in b) {
26
25
  bLength += 1;
27
26
  }
28
- /* eslint-enable no-restricted-syntax */
29
- /* eslint-enable guard-for-in */
30
-
31
27
  return aLength === bLength;
32
28
  }