@mui/x-data-grid 7.6.2 → 7.7.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +163 -0
  2. package/components/columnHeaders/GridColumnGroupHeader.js +1 -1
  3. package/hooks/features/export/serializers/csvSerializer.d.ts +1 -1
  4. package/hooks/features/export/serializers/csvSerializer.js +13 -15
  5. package/hooks/features/filter/gridFilterUtils.js +1 -3
  6. package/hooks/features/filter/useGridFilter.js +16 -8
  7. package/hooks/features/rows/useGridRowsMeta.js +1 -1
  8. package/hooks/features/virtualization/useGridVirtualScroller.js +3 -0
  9. package/index.js +1 -1
  10. package/locales/beBY.js +8 -8
  11. package/locales/faIR.js +1 -2
  12. package/locales/ptBR.js +1 -2
  13. package/locales/ptPT.js +13 -14
  14. package/locales/ruRU.js +26 -30
  15. package/locales/ukUA.js +6 -5
  16. package/models/api/gridFilterApi.d.ts +7 -0
  17. package/modern/components/columnHeaders/GridColumnGroupHeader.js +1 -1
  18. package/modern/hooks/features/export/serializers/csvSerializer.js +13 -15
  19. package/modern/hooks/features/filter/gridFilterUtils.js +1 -3
  20. package/modern/hooks/features/filter/useGridFilter.js +16 -8
  21. package/modern/hooks/features/rows/useGridRowsMeta.js +1 -1
  22. package/modern/hooks/features/virtualization/useGridVirtualScroller.js +3 -0
  23. package/modern/index.js +1 -1
  24. package/modern/locales/beBY.js +8 -8
  25. package/modern/locales/faIR.js +1 -2
  26. package/modern/locales/ptBR.js +1 -2
  27. package/modern/locales/ptPT.js +13 -14
  28. package/modern/locales/ruRU.js +26 -30
  29. package/modern/locales/ukUA.js +6 -5
  30. package/modern/utils/fastObjectShallowCompare.js +0 -4
  31. package/node/components/columnHeaders/GridColumnGroupHeader.js +1 -1
  32. package/node/hooks/features/export/serializers/csvSerializer.js +13 -15
  33. package/node/hooks/features/filter/gridFilterUtils.js +1 -3
  34. package/node/hooks/features/filter/useGridFilter.js +16 -8
  35. package/node/hooks/features/rows/useGridRowsMeta.js +1 -1
  36. package/node/hooks/features/virtualization/useGridVirtualScroller.js +3 -0
  37. package/node/index.js +1 -1
  38. package/node/locales/beBY.js +8 -8
  39. package/node/locales/faIR.js +1 -2
  40. package/node/locales/ptBR.js +1 -2
  41. package/node/locales/ptPT.js +13 -14
  42. package/node/locales/ruRU.js +26 -30
  43. package/node/locales/ukUA.js +6 -5
  44. package/node/utils/fastObjectShallowCompare.js +0 -4
  45. package/package.json +4 -4
  46. package/utils/fastObjectShallowCompare.js +0 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,169 @@
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
+ ## 7.7.1
7
+
8
+ _Jun 21, 2024_
9
+
10
+ We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🌍 Improve Portuguese (pt-PT) locale on the Data Grid
13
+ - 🌍 Improve Danish (da-DK) locale on the Date and Time Pickers
14
+ - 🐞 Bugfixes
15
+ - 📚 Documentation improvements
16
+
17
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
18
+
19
+ ### Data Grid
20
+
21
+ #### `@mui/x-data-grid@7.7.1`
22
+
23
+ - [DataGrid][docs] Clarify enabling pagination (#13350) @oliviertassinari
24
+ - [DataGrid] Fix CSV export escaping for non-string values (#13560) @joeycumines-scw
25
+ - [l10n] Improve Portuguese (pt-PT) locale (#13348) @joaosreis
26
+
27
+ #### `@mui/x-data-grid-pro@7.7.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
28
+
29
+ Same changes as in `@mui/x-data-grid@7.7.1`, plus:
30
+
31
+ - [DataGrid] Warn about `getTreeDataPath` reference (#13519) @cherniavskii
32
+
33
+ #### `@mui/x-data-grid-premium@7.7.1` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
34
+
35
+ Same changes as in `@mui/x-data-grid-pro@7.7.1`.
36
+
37
+ ### Date and Time Pickers
38
+
39
+ #### `@mui/x-date-pickers@7.7.1`
40
+
41
+ - [fields] Prevent digit editing on the `Space` key down (#13510) @flaviendelangle
42
+ - [l10n] Improve Danish (da-DK) locale (#13375) @jacrowland1
43
+ - [pickers] Add context to `onAccept` callback (#13511) @flaviendelangle
44
+ - [pickers] Always use the same timezone in the field, the view and the layout components (#13481) @flaviendelangle
45
+ - [pickers] Fix `AdapterDateFnsV3` generated method types (#13464) @alexey-kozlenkov
46
+ - [pickers] Fix controlled `view` behavior (#13552) @LukasTy
47
+ - [TimePicker] Improves RTL verification for the time pickers default views (#13447) @arthurbalduini
48
+
49
+ #### `@mui/x-date-pickers-pro@7.7.1` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
50
+
51
+ Same changes as in `@mui/x-date-pickers@7.7.1`, plus:
52
+
53
+ - [DateRangePicker] Add accessible name to calendar grid (#13538) @LukasTy
54
+
55
+ ### Charts
56
+
57
+ #### `@mui/x-charts@7.7.1`
58
+
59
+ - [charts] Divide `CartesianProvider` to use logic in Pro package (#13531) @JCQuintas
60
+ - [charts] Do not publish the pro package (#13539) @alexfauquette
61
+ - [charts] Export `Pro` versions of regular charts (#13547) @JCQuintas
62
+ - [charts] Prepare `ChartContainerPro` for future Zoom changes (#13532) @JCQuintas
63
+ - [charts] Remove unnecessary proptypes from internal component (#13518) @JCQuintas
64
+
65
+ ### Tree View
66
+
67
+ #### `@mui/x-tree-view@7.7.1`
68
+
69
+ - [TreeView] Improve typing to support optional dependencies in plugins and in the item (#13523) @flaviendelangle
70
+ - [TreeView] Move `useTreeViewId` to the core plugins (#13566) @flaviendelangle
71
+ - [TreeView] Remove unused state from `useTreeViewId` (#13579) @flaviendelangle
72
+ - [TreeView] Support `itemId` with escaping characters when using `SimpleTreeView` (#13487) @oukunan
73
+
74
+ ### Docs
75
+
76
+ - [docs] Add section about the new uncovered product watermark (#13568) @michelengelen
77
+ - [docs] Document the `PickerValidDate` type override (#13476) @flaviendelangle
78
+ - [docs] Fix typo (#13507) @anshtiwatne
79
+ - [docs] Remove "-" in heat-map and tree-map urls (#13569) @alexfauquette
80
+ - [docs] Use dedicated tab for weather dataset (#13513) @alexfauquette
81
+ - [x-license] license update proposal (#13459) @michelengelen
82
+
83
+ ### Core
84
+
85
+ - [core] Fix failing CI test (#13574) @alexfauquette
86
+ - [infra] Remove explicit `@testing-library/react` dependency (#13478) @LukasTy
87
+
88
+ ## 7.7.0
89
+
90
+ _Jun 13, 2024_
91
+
92
+ We'd like to offer a big thanks to the 12 contributors who made this release possible. Here are some highlights ✨:
93
+
94
+ - 🎁 Allow customization of the Pickers month and the year buttons
95
+ - 🌍 Improve Persian (fa-IR), Portuguese (pt-PT), and Russian (ru-RU) locales on the Data Grid
96
+ - 🌍 Improve Korean (ko-KR) and Persian (fa-IR) locales on the Date and Time Pickers
97
+ - 🐞 Bugfixes
98
+ - 📚 Documentation improvements
99
+
100
+ <!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
101
+
102
+ ### Data Grid
103
+
104
+ #### `@mui/x-data-grid@7.7.0`
105
+
106
+ - [DataGrid] Add `getFilterState` method (#13418) @cherniavskii
107
+ - [DataGrid] Do not show resize separators for column groups (#13455) @cherniavskii
108
+ - [l10n] Improve Persian (fa-IR) locale (#13402) @fakhamatia
109
+ - [l10n] Improve Portuguese (pt-PT) locale (#13384) @olavocarvalho
110
+ - [l10n] Improve Russian (ru-RU) locale (#11210) @dastan-akhmetov-scity
111
+
112
+ #### `@mui/x-data-grid-pro@7.7.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
113
+
114
+ Same changes as in `@mui/x-data-grid@7.7.0`, plus:
115
+
116
+ - [DataGridPro] Do not render detail panel if the focused cell is not visible (#13456) @cherniavskii
117
+
118
+ #### `@mui/x-data-grid-premium@7.7.0` [![premium](https://mui.com/r/x-premium-svg)](https://mui.com/r/x-premium-svg-link 'Premium plan')
119
+
120
+ Same changes as in `@mui/x-data-grid-pro@7.7.0`.
121
+
122
+ ### Date and Time Pickers
123
+
124
+ #### `@mui/x-date-pickers@7.7.0`
125
+
126
+ - [l10n] Improve Korean (ko-KR) locale (#13452) @ryxxn
127
+ - [l10n] Improve Persian (fa-IR) locale (#13402) @fakhamatia
128
+ - [pickers] Allow to customize the month and the year buttons (#13321) @flaviendelangle
129
+
130
+ #### `@mui/x-date-pickers-pro@7.7.0` [![pro](https://mui.com/r/x-pro-svg)](https://mui.com/r/x-pro-svg-link 'Pro plan')
131
+
132
+ Same changes as in `@mui/x-date-pickers@7.7.0`.
133
+
134
+ ### Charts
135
+
136
+ #### `@mui/x-charts@7.7.0`
137
+
138
+ - [charts] Add watermark on the pro `ResponsiveChartContainer` (#13398) @alexfauquette
139
+ - [charts] Allow to specify y-axis configuration (#13438) @alexfauquette
140
+ - [charts] Fix eslint for react compiler (#13444) @alexfauquette
141
+ - [charts] Improve themeAugmentation typing (#13433) @noraleonte
142
+ - [charts] Move the `ZAxisContextProvider` by default in the `ChartContainer` (#13465) @alexfauquette
143
+ - [charts] Use plugins to define series extremum and colors (#13397) @alexfauquette
144
+
145
+ ### Tree View
146
+
147
+ #### `@mui/x-tree-view@7.7.0`
148
+
149
+ - [TreeView] Improve TypeScript for plugins (#13380) @flaviendelangle
150
+ - [TreeView] Improve the typing of the cancelable events (#13152) @flaviendelangle
151
+ - [TreeView] Prepare support for PigmentCSS (#13412) @flaviendelangle
152
+ - [TreeView] Refactor the tree view internals to prepare for headless API (#13311) @flaviendelangle
153
+
154
+ ### Docs
155
+
156
+ - [docs] Add `renderHeader` recipe to the Master Details docs (#13370) @michelengelen
157
+ - [docs] Add lazy loading detail panel demo (#13453) @cherniavskii
158
+ - [docs] Add small edits to the Data Grid overview page (#13060) @danilo-leal
159
+ - [docs] Update a11y pages description (#13417) @danilo-leal
160
+ - [docs] improve the writing on the "Quick filter outside of the grid" example (#13155) @michelengelen
161
+
162
+ ### Core
163
+
164
+ - [core] Add `eslint-plugin-react-compiler` experimental version and rules (#13415) @JCQuintas
165
+ - [core] Minor setup cleanup (#13467) @LukasTy
166
+ - [infra] Adjust CI setup (#13448) @LukasTy
167
+ - [test] Add tests for the custom slots of `TreeItem2` (#13314) @flaviendelangle
168
+
6
169
  ## 7.6.2
7
170
 
8
171
  _Jun 6, 2024_
@@ -127,7 +127,7 @@ function GridColumnGroupHeader(props) {
127
127
  width: width,
128
128
  columnMenuIconButton: null,
129
129
  columnTitleIconButtons: null,
130
- resizable: true,
130
+ resizable: false,
131
131
  label: label,
132
132
  "aria-colspan": fields.length
133
133
  // The fields are wrapped between |-...-| to avoid confusion between fields "id" and "id2" when using selector data-fields~=
@@ -6,7 +6,7 @@ import type { GridApiCommunity } from '../../../../models/api/gridApiCommunity';
6
6
  export declare const serializeCellValue: (cellParams: GridCellParams, options: {
7
7
  csvOptions: CSVOptions;
8
8
  ignoreValueFormatter: boolean;
9
- }) => any;
9
+ }) => string;
10
10
  type CSVOptions = Required<Pick<GridCsvExportOptions, 'delimiter' | 'shouldAppendQuotes' | 'escapeFormulas'>>;
11
11
  interface BuildCSVOptions {
12
12
  columns: GridStateColDef[];
@@ -1,24 +1,22 @@
1
1
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../../colDef';
2
2
  import { buildWarning } from '../../../../utils/warning';
3
3
  function sanitizeCellValue(value, csvOptions) {
4
- if (typeof value === 'string') {
5
- if (csvOptions.shouldAppendQuotes || csvOptions.escapeFormulas) {
6
- const escapedValue = value.replace(/"/g, '""');
7
- // Make sure value containing delimiter or line break won't be split into multiple cells
8
- if ([csvOptions.delimiter, '\n', '\r', '"'].some(delimiter => value.includes(delimiter))) {
9
- return `"${escapedValue}"`;
10
- }
11
- if (csvOptions.escapeFormulas) {
12
- // See https://owasp.org/www-community/attacks/CSV_Injection
13
- if (['=', '+', '-', '@', '\t', '\r'].includes(escapedValue[0])) {
14
- return `'${escapedValue}`;
15
- }
4
+ const valueStr = typeof value === 'string' ? value : `${value}`;
5
+ if (csvOptions.shouldAppendQuotes || csvOptions.escapeFormulas) {
6
+ const escapedValue = valueStr.replace(/"/g, '""');
7
+ // Make sure value containing delimiter or line break won't be split into multiple cells
8
+ if ([csvOptions.delimiter, '\n', '\r', '"'].some(delimiter => valueStr.includes(delimiter))) {
9
+ return `"${escapedValue}"`;
10
+ }
11
+ if (csvOptions.escapeFormulas) {
12
+ // See https://owasp.org/www-community/attacks/CSV_Injection
13
+ if (['=', '+', '-', '@', '\t', '\r'].includes(escapedValue[0])) {
14
+ return `'${escapedValue}`;
16
15
  }
17
- return escapedValue;
18
16
  }
19
- return value;
17
+ return escapedValue;
20
18
  }
21
- return value;
19
+ return valueStr;
22
20
  }
23
21
  export const serializeCellValue = (cellParams, options) => {
24
22
  const {
@@ -210,7 +210,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
210
210
  return function isRowMatchingQuickFilter(row, shouldApplyFilter) {
211
211
  const result = {};
212
212
 
213
- /* eslint-disable no-restricted-syntax, no-labels */
213
+ /* eslint-disable no-labels */
214
214
  outer: for (let v = 0; v < quickFilterValues.length; v += 1) {
215
215
  const filterValue = quickFilterValues[v];
216
216
  for (let i = 0; i < appliersPerField.length; i += 1) {
@@ -240,8 +240,6 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
240
240
  }
241
241
  result[filterValue] = false;
242
242
  }
243
- /* eslint-enable no-restricted-syntax, no-labels */
244
-
245
243
  return result;
246
244
  };
247
245
  };
@@ -59,13 +59,9 @@ export const useGridFilter = (apiRef, props) => {
59
59
  const updateFilteredRows = React.useCallback(() => {
60
60
  apiRef.current.setState(state => {
61
61
  const filterModel = gridFilterModelSelector(state, apiRef.current.instanceId);
62
- const isRowMatchingFilters = props.filterMode === 'client' ? buildAggregatedFilterApplier(filterModel, apiRef, props.disableEval) : null;
63
- const filteringResult = apiRef.current.applyStrategyProcessor('filtering', {
64
- isRowMatchingFilters,
65
- filterModel: filterModel ?? getDefaultGridFilterModel()
66
- });
62
+ const filterState = apiRef.current.getFilterState(filterModel);
67
63
  const newState = _extends({}, state, {
68
- filter: _extends({}, state.filter, filteringResult)
64
+ filter: _extends({}, state.filter, filterState)
69
65
  });
70
66
  const visibleRowsLookupState = getVisibleRowsLookupState(apiRef, newState);
71
67
  return _extends({}, newState, {
@@ -73,7 +69,7 @@ export const useGridFilter = (apiRef, props) => {
73
69
  });
74
70
  });
75
71
  apiRef.current.publishEvent('filteredRowsSet');
76
- }, [apiRef, props.filterMode, props.disableEval]);
72
+ }, [apiRef]);
77
73
  const addColumnMenuItem = React.useCallback((columnMenuItems, colDef) => {
78
74
  if (colDef == null || colDef.filterable === false || props.disableColumnFilter) {
79
75
  return columnMenuItems;
@@ -203,6 +199,17 @@ export const useGridFilter = (apiRef, props) => {
203
199
  apiRef.current.unstable_applyFilters();
204
200
  }
205
201
  }, [apiRef, logger, props.disableMultipleColumnsFiltering]);
202
+ const getFilterState = React.useCallback(inputFilterModel => {
203
+ const filterModel = sanitizeFilterModel(inputFilterModel, props.disableMultipleColumnsFiltering, apiRef);
204
+ const isRowMatchingFilters = props.filterMode === 'client' ? buildAggregatedFilterApplier(filterModel, apiRef, props.disableEval) : null;
205
+ const filterResult = apiRef.current.applyStrategyProcessor('filtering', {
206
+ isRowMatchingFilters,
207
+ filterModel: filterModel ?? getDefaultGridFilterModel()
208
+ });
209
+ return _extends({}, filterResult, {
210
+ filterModel
211
+ });
212
+ }, [props.disableMultipleColumnsFiltering, props.filterMode, props.disableEval, apiRef]);
206
213
  const filterApi = {
207
214
  setFilterLogicOperator,
208
215
  unstable_applyFilters: applyFilters,
@@ -213,7 +220,8 @@ export const useGridFilter = (apiRef, props) => {
213
220
  showFilterPanel,
214
221
  hideFilterPanel,
215
222
  setQuickFilterValues,
216
- ignoreDiacritics: props.ignoreDiacritics
223
+ ignoreDiacritics: props.ignoreDiacritics,
224
+ getFilterState
217
225
  };
218
226
  useGridApiMethod(apiRef, filterApi, 'public');
219
227
 
@@ -128,7 +128,7 @@ export const useGridRowsMeta = (apiRef, props) => {
128
128
  positions.push(acc);
129
129
  let otherSizes = 0;
130
130
  const processedSizes = calculateRowProcessedSizes(row);
131
- /* eslint-disable-next-line no-restricted-syntax, guard-for-in */
131
+ /* eslint-disable-next-line guard-for-in */
132
132
  for (const key in processedSizes) {
133
133
  const value = processedSizes[key];
134
134
  if (key !== 'baseCenter') {
@@ -340,6 +340,9 @@ export const useGridVirtualScroller = () => {
340
340
  isLastVisible: isLastVisible,
341
341
  isNotVisible: isNotVisible
342
342
  }, rowProps), id));
343
+ if (isNotVisible) {
344
+ return;
345
+ }
343
346
  const panel = panels.get(id);
344
347
  if (panel) {
345
348
  rows.push(panel);
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-data-grid v7.6.2
2
+ * @mui/x-data-grid v7.7.1
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
package/locales/beBY.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { beBYCore } from './coreLocales';
2
2
  import { getGridLocalization } from '../utils/getGridLocalization';
3
3
  const getPluralForm = (count, options) => {
4
- let pluralForm = options.other;
4
+ let pluralForm = options.many;
5
5
  const lastDigit = count % 10;
6
6
  if (lastDigit > 1 && lastDigit < 5 && (count < 10 || count > 20)) {
7
- pluralForm = options.twoToFour;
7
+ pluralForm = options.few;
8
8
  } else if (lastDigit === 1 && count % 100 !== 11) {
9
9
  pluralForm = options.one;
10
10
  }
@@ -30,8 +30,8 @@ const beBYGrid = {
30
30
  toolbarFiltersTooltipShow: 'Паказаць фільтры',
31
31
  toolbarFiltersTooltipActive: count => getPluralForm(count, {
32
32
  one: 'актыўны фільтр',
33
- twoToFour: 'актыўных фільтра',
34
- other: 'актыўных фільтраў'
33
+ few: 'актыўных фільтра',
34
+ many: 'актыўных фільтраў'
35
35
  }),
36
36
  // Quick filter toolbar field
37
37
  toolbarQuickFilterPlaceholder: 'Пошук…',
@@ -118,16 +118,16 @@ const beBYGrid = {
118
118
  // Column header text
119
119
  columnHeaderFiltersTooltipActive: count => getPluralForm(count, {
120
120
  one: 'актыўны фільтр',
121
- twoToFour: 'актыўных фільтра',
122
- other: 'актыўных фільтраў'
121
+ few: 'актыўных фільтра',
122
+ many: 'актыўных фільтраў'
123
123
  }),
124
124
  columnHeaderFiltersLabel: 'Паказаць фільтры',
125
125
  columnHeaderSortIconLabel: 'Сартыраваць',
126
126
  // Rows selected footer text
127
127
  footerRowSelected: count => getPluralForm(count, {
128
128
  one: 'абраны радок',
129
- twoToFour: 'абраных радка',
130
- other: 'абраных радкоў'
129
+ few: 'абраных радка',
130
+ many: 'абраных радкоў'
131
131
  }),
132
132
  // Total row amount footer text
133
133
  footerTotalRows: 'Усяго радкоў:',
package/locales/faIR.js CHANGED
@@ -33,8 +33,7 @@ const faIRGrid = {
33
33
  columnsManagementSearchTitle: 'جستجو',
34
34
  columnsManagementNoColumns: 'بدون سطر',
35
35
  columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
36
- // columnsManagementReset: 'Reset',
37
-
36
+ columnsManagementReset: 'بازنشانی',
38
37
  // Filter panel text
39
38
  filterPanelAddFilter: 'افزودن فیلتر',
40
39
  filterPanelRemoveAll: 'حذف همه',
package/locales/ptBR.js CHANGED
@@ -33,8 +33,7 @@ const ptBRGrid = {
33
33
  columnsManagementSearchTitle: 'Buscar',
34
34
  columnsManagementNoColumns: 'Nenhuma coluna',
35
35
  columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
36
- // columnsManagementReset: 'Reset',
37
-
36
+ columnsManagementReset: 'Redefinir',
38
37
  // Filter panel text
39
38
  filterPanelAddFilter: 'Adicionar filtro',
40
39
  filterPanelRemoveAll: 'Remover todos',
package/locales/ptPT.js CHANGED
@@ -26,18 +26,17 @@ const ptPTGrid = {
26
26
  // Export selector toolbar button text
27
27
  toolbarExport: 'Exportar',
28
28
  toolbarExportLabel: 'Exportar',
29
- toolbarExportCSV: 'Baixar como CSV',
29
+ toolbarExportCSV: 'Descarregar como CSV',
30
30
  toolbarExportPrint: 'Imprimir',
31
- toolbarExportExcel: 'Baixe como Excel',
31
+ toolbarExportExcel: 'Descarregar como Excel',
32
32
  // Columns management text
33
- // columnsManagementSearchTitle: 'Search',
34
- // columnsManagementNoColumns: 'No columns',
35
- // columnsManagementShowHideAllText: 'Show/Hide All',
36
- // columnsManagementReset: 'Reset',
37
-
33
+ columnsManagementSearchTitle: 'Procurar',
34
+ columnsManagementNoColumns: 'Sem colunas',
35
+ columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
36
+ columnsManagementReset: 'Repor',
38
37
  // Filter panel text
39
38
  filterPanelAddFilter: 'Adicionar filtro',
40
- filterPanelRemoveAll: 'Deletar tudo',
39
+ filterPanelRemoveAll: 'Excluir todos',
41
40
  filterPanelDeleteIconLabel: 'Excluir',
42
41
  filterPanelLogicOperator: 'Operador lógico',
43
42
  filterPanelOperator: 'Operador',
@@ -91,9 +90,9 @@ const ptPTGrid = {
91
90
  filterValueTrue: 'verdadeiro',
92
91
  filterValueFalse: 'falso',
93
92
  // Column menu text
94
- columnMenuLabel: 'Cardápio',
93
+ columnMenuLabel: 'Menu',
95
94
  columnMenuShowColumns: 'Mostrar colunas',
96
- columnMenuManageColumns: 'Gerenciar colunas',
95
+ columnMenuManageColumns: 'Gerir colunas',
97
96
  columnMenuFilter: 'Filtro',
98
97
  columnMenuHideColumn: 'Ocultar coluna',
99
98
  columnMenuUnsort: 'Desclassificar',
@@ -123,10 +122,10 @@ const ptPTGrid = {
123
122
  // Column pinning text
124
123
  pinToLeft: 'Fixar à esquerda',
125
124
  pinToRight: 'Fixar à direita',
126
- unpin: 'Liberar',
125
+ unpin: 'Desafixar',
127
126
  // Tree Data
128
- treeDataGroupingHeaderName: 'Group',
129
- treeDataExpand: 'veja crianças',
127
+ treeDataGroupingHeaderName: 'Grupo',
128
+ treeDataExpand: 'ver crianças',
130
129
  treeDataCollapse: 'esconder crianças',
131
130
  // Grouping columns
132
131
  groupingColumnHeaderName: 'Grupo',
@@ -135,7 +134,7 @@ const ptPTGrid = {
135
134
  // Master/detail
136
135
  detailPanelToggle: 'Alternar painel de detalhes',
137
136
  expandDetailPanel: 'Expandir',
138
- collapseDetailPanel: 'Colapso',
137
+ collapseDetailPanel: 'Colapsar',
139
138
  // Row reordering text
140
139
  rowReorderingHeaderName: 'Reordenação de linhas',
141
140
  // Aggregation
package/locales/ruRU.js CHANGED
@@ -1,5 +1,16 @@
1
1
  import { ruRU as ruRUCore } from '@mui/material/locale';
2
2
  import { getGridLocalization } from '../utils/getGridLocalization';
3
+ function getPluralForm(count, options) {
4
+ const penultimateDigit = Math.floor(count / 10) % 10;
5
+ const lastDigit = count % 10;
6
+ let pluralForm = options.many;
7
+ if (penultimateDigit !== 1 && lastDigit > 1 && lastDigit < 5) {
8
+ pluralForm = options.few;
9
+ } else if (penultimateDigit !== 1 && lastDigit === 1) {
10
+ pluralForm = options.one;
11
+ }
12
+ return `${count} ${pluralForm}`;
13
+ }
3
14
  const ruRUGrid = {
4
15
  // Root
5
16
  noRowsLabel: 'Нет строк',
@@ -18,16 +29,11 @@ const ruRUGrid = {
18
29
  toolbarFiltersLabel: 'Показать фильтры',
19
30
  toolbarFiltersTooltipHide: 'Скрыть фильтры',
20
31
  toolbarFiltersTooltipShow: 'Показать фильтры',
21
- toolbarFiltersTooltipActive: count => {
22
- let pluralForm = 'активных фильтров';
23
- const lastDigit = count % 10;
24
- if (lastDigit > 1 && lastDigit < 5) {
25
- pluralForm = 'активных фильтра';
26
- } else if (lastDigit === 1) {
27
- pluralForm = 'активный фильтр';
28
- }
29
- return `${count} ${pluralForm}`;
30
- },
32
+ toolbarFiltersTooltipActive: count => getPluralForm(count, {
33
+ one: 'активный фильтр',
34
+ few: 'активных фильтра',
35
+ many: 'активных фильтров'
36
+ }),
31
37
  // Quick filter toolbar field
32
38
  toolbarQuickFilterPlaceholder: 'Поиск…',
33
39
  toolbarQuickFilterLabel: 'Поиск',
@@ -109,29 +115,19 @@ const ruRUGrid = {
109
115
  columnMenuSortAsc: 'Сортировать по возрастанию',
110
116
  columnMenuSortDesc: 'Сортировать по убыванию',
111
117
  // Column header text
112
- columnHeaderFiltersTooltipActive: count => {
113
- let pluralForm = 'активных фильтров';
114
- const lastDigit = count % 10;
115
- if (lastDigit > 1 && lastDigit < 5) {
116
- pluralForm = 'активных фильтра';
117
- } else if (lastDigit === 1) {
118
- pluralForm = 'активный фильтр';
119
- }
120
- return `${count} ${pluralForm}`;
121
- },
118
+ columnHeaderFiltersTooltipActive: count => getPluralForm(count, {
119
+ one: 'активный фильтр',
120
+ few: 'активных фильтра',
121
+ many: 'активных фильтров'
122
+ }),
122
123
  columnHeaderFiltersLabel: 'Показать фильтры',
123
124
  columnHeaderSortIconLabel: 'Сортировать',
124
125
  // Rows selected footer text
125
- footerRowSelected: count => {
126
- let pluralForm = 'строк выбрано';
127
- const lastDigit = count % 10;
128
- if (lastDigit > 1 && lastDigit < 5) {
129
- pluralForm = 'строки выбраны';
130
- } else if (lastDigit === 1) {
131
- pluralForm = 'строка выбрана';
132
- }
133
- return `${count} ${pluralForm}`;
134
- },
126
+ footerRowSelected: count => getPluralForm(count, {
127
+ one: 'строка выбрана',
128
+ few: 'строки выбраны',
129
+ many: 'строк выбрано'
130
+ }),
135
131
  // Total row amount footer text
136
132
  footerTotalRows: 'Всего строк:',
137
133
  // Total visible row amount footer text
package/locales/ukUA.js CHANGED
@@ -1,15 +1,16 @@
1
1
  import { ukUA as ukUACore } from '@mui/material/locale';
2
2
  import { getGridLocalization } from '../utils/getGridLocalization';
3
- const getPluralForm = (count, options) => {
4
- let pluralForm = options.many;
3
+ function getPluralForm(count, options) {
4
+ const penultimateDigit = Math.floor(count / 10) % 10;
5
5
  const lastDigit = count % 10;
6
- if (lastDigit > 1 && lastDigit < 5) {
6
+ let pluralForm = options.many;
7
+ if (penultimateDigit !== 1 && lastDigit > 1 && lastDigit < 5) {
7
8
  pluralForm = options.few;
8
- } else if (lastDigit === 1) {
9
+ } else if (penultimateDigit !== 1 && lastDigit === 1) {
9
10
  pluralForm = options.one;
10
11
  }
11
12
  return `${count} ${pluralForm}`;
12
- };
13
+ }
13
14
  const ukUAGrid = {
14
15
  // Root
15
16
  noRowsLabel: 'Немає рядків',
@@ -2,6 +2,7 @@ import { GridFilterModel } from '../gridFilterModel';
2
2
  import { GridFilterItem, GridLogicOperator } from '../gridFilterItem';
3
3
  import { GridControlledStateReasonLookup } from '../events';
4
4
  import type { DataGridProcessedProps } from '../props/DataGridProps';
5
+ import { GridStateCommunity } from '../gridStateCommunity';
5
6
  /**
6
7
  * The filter API interface that is available in the grid [[apiRef]].
7
8
  */
@@ -57,4 +58,10 @@ export interface GridFilterApi {
57
58
  * Returns the value of the `ignoreDiacritics` prop.
58
59
  */
59
60
  ignoreDiacritics: DataGridProcessedProps['ignoreDiacritics'];
61
+ /**
62
+ * Returns the filter state for the given filter model without applying it to the data grid.
63
+ * @param {GridFilterModel} filterModel The filter model to get the state for.
64
+ * @returns {GridStateCommunity['filter']} The filter state.
65
+ */
66
+ getFilterState: (filterModel: GridFilterModel) => GridStateCommunity['filter'];
60
67
  }
@@ -127,7 +127,7 @@ function GridColumnGroupHeader(props) {
127
127
  width: width,
128
128
  columnMenuIconButton: null,
129
129
  columnTitleIconButtons: null,
130
- resizable: true,
130
+ resizable: false,
131
131
  label: label,
132
132
  "aria-colspan": fields.length
133
133
  // The fields are wrapped between |-...-| to avoid confusion between fields "id" and "id2" when using selector data-fields~=
@@ -1,24 +1,22 @@
1
1
  import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../../colDef';
2
2
  import { buildWarning } from '../../../../utils/warning';
3
3
  function sanitizeCellValue(value, csvOptions) {
4
- if (typeof value === 'string') {
5
- if (csvOptions.shouldAppendQuotes || csvOptions.escapeFormulas) {
6
- const escapedValue = value.replace(/"/g, '""');
7
- // Make sure value containing delimiter or line break won't be split into multiple cells
8
- if ([csvOptions.delimiter, '\n', '\r', '"'].some(delimiter => value.includes(delimiter))) {
9
- return `"${escapedValue}"`;
10
- }
11
- if (csvOptions.escapeFormulas) {
12
- // See https://owasp.org/www-community/attacks/CSV_Injection
13
- if (['=', '+', '-', '@', '\t', '\r'].includes(escapedValue[0])) {
14
- return `'${escapedValue}`;
15
- }
4
+ const valueStr = typeof value === 'string' ? value : `${value}`;
5
+ if (csvOptions.shouldAppendQuotes || csvOptions.escapeFormulas) {
6
+ const escapedValue = valueStr.replace(/"/g, '""');
7
+ // Make sure value containing delimiter or line break won't be split into multiple cells
8
+ if ([csvOptions.delimiter, '\n', '\r', '"'].some(delimiter => valueStr.includes(delimiter))) {
9
+ return `"${escapedValue}"`;
10
+ }
11
+ if (csvOptions.escapeFormulas) {
12
+ // See https://owasp.org/www-community/attacks/CSV_Injection
13
+ if (['=', '+', '-', '@', '\t', '\r'].includes(escapedValue[0])) {
14
+ return `'${escapedValue}`;
16
15
  }
17
- return escapedValue;
18
16
  }
19
- return value;
17
+ return escapedValue;
20
18
  }
21
- return value;
19
+ return valueStr;
22
20
  }
23
21
  export const serializeCellValue = (cellParams, options) => {
24
22
  const {
@@ -210,7 +210,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
210
210
  return function isRowMatchingQuickFilter(row, shouldApplyFilter) {
211
211
  const result = {};
212
212
 
213
- /* eslint-disable no-restricted-syntax, no-labels */
213
+ /* eslint-disable no-labels */
214
214
  outer: for (let v = 0; v < quickFilterValues.length; v += 1) {
215
215
  const filterValue = quickFilterValues[v];
216
216
  for (let i = 0; i < appliersPerField.length; i += 1) {
@@ -240,8 +240,6 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
240
240
  }
241
241
  result[filterValue] = false;
242
242
  }
243
- /* eslint-enable no-restricted-syntax, no-labels */
244
-
245
243
  return result;
246
244
  };
247
245
  };