@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.
- package/CHANGELOG.md +163 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +1 -1
- package/hooks/features/export/serializers/csvSerializer.d.ts +1 -1
- package/hooks/features/export/serializers/csvSerializer.js +13 -15
- package/hooks/features/filter/gridFilterUtils.js +1 -3
- package/hooks/features/filter/useGridFilter.js +16 -8
- package/hooks/features/rows/useGridRowsMeta.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +3 -0
- package/index.js +1 -1
- package/locales/beBY.js +8 -8
- package/locales/faIR.js +1 -2
- package/locales/ptBR.js +1 -2
- package/locales/ptPT.js +13 -14
- package/locales/ruRU.js +26 -30
- package/locales/ukUA.js +6 -5
- package/models/api/gridFilterApi.d.ts +7 -0
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +1 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +13 -15
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -3
- package/modern/hooks/features/filter/useGridFilter.js +16 -8
- package/modern/hooks/features/rows/useGridRowsMeta.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +3 -0
- package/modern/index.js +1 -1
- package/modern/locales/beBY.js +8 -8
- package/modern/locales/faIR.js +1 -2
- package/modern/locales/ptBR.js +1 -2
- package/modern/locales/ptPT.js +13 -14
- package/modern/locales/ruRU.js +26 -30
- package/modern/locales/ukUA.js +6 -5
- package/modern/utils/fastObjectShallowCompare.js +0 -4
- package/node/components/columnHeaders/GridColumnGroupHeader.js +1 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +13 -15
- package/node/hooks/features/filter/gridFilterUtils.js +1 -3
- package/node/hooks/features/filter/useGridFilter.js +16 -8
- package/node/hooks/features/rows/useGridRowsMeta.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +3 -0
- package/node/index.js +1 -1
- package/node/locales/beBY.js +8 -8
- package/node/locales/faIR.js +1 -2
- package/node/locales/ptBR.js +1 -2
- package/node/locales/ptPT.js +13 -14
- package/node/locales/ruRU.js +26 -30
- package/node/locales/ukUA.js +6 -5
- package/node/utils/fastObjectShallowCompare.js +0 -4
- package/package.json +4 -4
- package/utils/fastObjectShallowCompare.js +0 -4
|
@@ -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
|
|
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,
|
|
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
|
|
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
|
|
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') {
|
package/modern/index.js
CHANGED
package/modern/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.
|
|
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.
|
|
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
|
-
|
|
34
|
-
|
|
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
|
-
|
|
122
|
-
|
|
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
|
-
|
|
130
|
-
|
|
129
|
+
few: 'абраных радка',
|
|
130
|
+
many: 'абраных радкоў'
|
|
131
131
|
}),
|
|
132
132
|
// Total row amount footer text
|
|
133
133
|
footerTotalRows: 'Усяго радкоў:',
|
package/modern/locales/faIR.js
CHANGED
|
@@ -33,8 +33,7 @@ const faIRGrid = {
|
|
|
33
33
|
columnsManagementSearchTitle: 'جستجو',
|
|
34
34
|
columnsManagementNoColumns: 'بدون سطر',
|
|
35
35
|
columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
columnsManagementReset: 'بازنشانی',
|
|
38
37
|
// Filter panel text
|
|
39
38
|
filterPanelAddFilter: 'افزودن فیلتر',
|
|
40
39
|
filterPanelRemoveAll: 'حذف همه',
|
package/modern/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
|
-
|
|
37
|
-
|
|
36
|
+
columnsManagementReset: 'Redefinir',
|
|
38
37
|
// Filter panel text
|
|
39
38
|
filterPanelAddFilter: 'Adicionar filtro',
|
|
40
39
|
filterPanelRemoveAll: 'Remover todos',
|
package/modern/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: '
|
|
29
|
+
toolbarExportCSV: 'Descarregar como CSV',
|
|
30
30
|
toolbarExportPrint: 'Imprimir',
|
|
31
|
-
toolbarExportExcel: '
|
|
31
|
+
toolbarExportExcel: 'Descarregar como Excel',
|
|
32
32
|
// Columns management text
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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: '
|
|
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: '
|
|
93
|
+
columnMenuLabel: 'Menu',
|
|
95
94
|
columnMenuShowColumns: 'Mostrar colunas',
|
|
96
|
-
columnMenuManageColumns: '
|
|
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: '
|
|
125
|
+
unpin: 'Desafixar',
|
|
127
126
|
// Tree Data
|
|
128
|
-
treeDataGroupingHeaderName: '
|
|
129
|
-
treeDataExpand: '
|
|
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: '
|
|
137
|
+
collapseDetailPanel: 'Colapsar',
|
|
139
138
|
// Row reordering text
|
|
140
139
|
rowReorderingHeaderName: 'Reordenação de linhas',
|
|
141
140
|
// Aggregation
|
package/modern/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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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/modern/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
|
-
|
|
4
|
-
|
|
3
|
+
function getPluralForm(count, options) {
|
|
4
|
+
const penultimateDigit = Math.floor(count / 10) % 10;
|
|
5
5
|
const lastDigit = count % 10;
|
|
6
|
-
|
|
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: 'Немає рядків',
|
|
@@ -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
|
}
|
|
@@ -136,7 +136,7 @@ function GridColumnGroupHeader(props) {
|
|
|
136
136
|
width: width,
|
|
137
137
|
columnMenuIconButton: null,
|
|
138
138
|
columnTitleIconButtons: null,
|
|
139
|
-
resizable:
|
|
139
|
+
resizable: false,
|
|
140
140
|
label: label,
|
|
141
141
|
"aria-colspan": fields.length
|
|
142
142
|
// The fields are wrapped between |-...-| to avoid confusion between fields "id" and "id2" when using selector data-fields~=
|
|
@@ -8,24 +8,22 @@ exports.serializeCellValue = void 0;
|
|
|
8
8
|
var _colDef = require("../../../../colDef");
|
|
9
9
|
var _warning = require("../../../../utils/warning");
|
|
10
10
|
function sanitizeCellValue(value, csvOptions) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
11
|
+
const valueStr = typeof value === 'string' ? value : `${value}`;
|
|
12
|
+
if (csvOptions.shouldAppendQuotes || csvOptions.escapeFormulas) {
|
|
13
|
+
const escapedValue = valueStr.replace(/"/g, '""');
|
|
14
|
+
// Make sure value containing delimiter or line break won't be split into multiple cells
|
|
15
|
+
if ([csvOptions.delimiter, '\n', '\r', '"'].some(delimiter => valueStr.includes(delimiter))) {
|
|
16
|
+
return `"${escapedValue}"`;
|
|
17
|
+
}
|
|
18
|
+
if (csvOptions.escapeFormulas) {
|
|
19
|
+
// See https://owasp.org/www-community/attacks/CSV_Injection
|
|
20
|
+
if (['=', '+', '-', '@', '\t', '\r'].includes(escapedValue[0])) {
|
|
21
|
+
return `'${escapedValue}`;
|
|
23
22
|
}
|
|
24
|
-
return escapedValue;
|
|
25
23
|
}
|
|
26
|
-
return
|
|
24
|
+
return escapedValue;
|
|
27
25
|
}
|
|
28
|
-
return
|
|
26
|
+
return valueStr;
|
|
29
27
|
}
|
|
30
28
|
const serializeCellValue = (cellParams, options) => {
|
|
31
29
|
const {
|
|
@@ -222,7 +222,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
222
222
|
return function isRowMatchingQuickFilter(row, shouldApplyFilter) {
|
|
223
223
|
const result = {};
|
|
224
224
|
|
|
225
|
-
/* eslint-disable no-
|
|
225
|
+
/* eslint-disable no-labels */
|
|
226
226
|
outer: for (let v = 0; v < quickFilterValues.length; v += 1) {
|
|
227
227
|
const filterValue = quickFilterValues[v];
|
|
228
228
|
for (let i = 0; i < appliersPerField.length; i += 1) {
|
|
@@ -252,8 +252,6 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
252
252
|
}
|
|
253
253
|
result[filterValue] = false;
|
|
254
254
|
}
|
|
255
|
-
/* eslint-enable no-restricted-syntax, no-labels */
|
|
256
|
-
|
|
257
255
|
return result;
|
|
258
256
|
};
|
|
259
257
|
};
|
|
@@ -69,13 +69,9 @@ const useGridFilter = (apiRef, props) => {
|
|
|
69
69
|
const updateFilteredRows = React.useCallback(() => {
|
|
70
70
|
apiRef.current.setState(state => {
|
|
71
71
|
const filterModel = (0, _gridFilterSelector.gridFilterModelSelector)(state, apiRef.current.instanceId);
|
|
72
|
-
const
|
|
73
|
-
const filteringResult = apiRef.current.applyStrategyProcessor('filtering', {
|
|
74
|
-
isRowMatchingFilters,
|
|
75
|
-
filterModel: filterModel ?? (0, _gridFilterState.getDefaultGridFilterModel)()
|
|
76
|
-
});
|
|
72
|
+
const filterState = apiRef.current.getFilterState(filterModel);
|
|
77
73
|
const newState = (0, _extends2.default)({}, state, {
|
|
78
|
-
filter: (0, _extends2.default)({}, state.filter,
|
|
74
|
+
filter: (0, _extends2.default)({}, state.filter, filterState)
|
|
79
75
|
});
|
|
80
76
|
const visibleRowsLookupState = getVisibleRowsLookupState(apiRef, newState);
|
|
81
77
|
return (0, _extends2.default)({}, newState, {
|
|
@@ -83,7 +79,7 @@ const useGridFilter = (apiRef, props) => {
|
|
|
83
79
|
});
|
|
84
80
|
});
|
|
85
81
|
apiRef.current.publishEvent('filteredRowsSet');
|
|
86
|
-
}, [apiRef
|
|
82
|
+
}, [apiRef]);
|
|
87
83
|
const addColumnMenuItem = React.useCallback((columnMenuItems, colDef) => {
|
|
88
84
|
if (colDef == null || colDef.filterable === false || props.disableColumnFilter) {
|
|
89
85
|
return columnMenuItems;
|
|
@@ -213,6 +209,17 @@ const useGridFilter = (apiRef, props) => {
|
|
|
213
209
|
apiRef.current.unstable_applyFilters();
|
|
214
210
|
}
|
|
215
211
|
}, [apiRef, logger, props.disableMultipleColumnsFiltering]);
|
|
212
|
+
const getFilterState = React.useCallback(inputFilterModel => {
|
|
213
|
+
const filterModel = (0, _gridFilterUtils.sanitizeFilterModel)(inputFilterModel, props.disableMultipleColumnsFiltering, apiRef);
|
|
214
|
+
const isRowMatchingFilters = props.filterMode === 'client' ? (0, _gridFilterUtils.buildAggregatedFilterApplier)(filterModel, apiRef, props.disableEval) : null;
|
|
215
|
+
const filterResult = apiRef.current.applyStrategyProcessor('filtering', {
|
|
216
|
+
isRowMatchingFilters,
|
|
217
|
+
filterModel: filterModel ?? (0, _gridFilterState.getDefaultGridFilterModel)()
|
|
218
|
+
});
|
|
219
|
+
return (0, _extends2.default)({}, filterResult, {
|
|
220
|
+
filterModel
|
|
221
|
+
});
|
|
222
|
+
}, [props.disableMultipleColumnsFiltering, props.filterMode, props.disableEval, apiRef]);
|
|
216
223
|
const filterApi = {
|
|
217
224
|
setFilterLogicOperator,
|
|
218
225
|
unstable_applyFilters: applyFilters,
|
|
@@ -223,7 +230,8 @@ const useGridFilter = (apiRef, props) => {
|
|
|
223
230
|
showFilterPanel,
|
|
224
231
|
hideFilterPanel,
|
|
225
232
|
setQuickFilterValues,
|
|
226
|
-
ignoreDiacritics: props.ignoreDiacritics
|
|
233
|
+
ignoreDiacritics: props.ignoreDiacritics,
|
|
234
|
+
getFilterState
|
|
227
235
|
};
|
|
228
236
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, filterApi, 'public');
|
|
229
237
|
|
|
@@ -137,7 +137,7 @@ const useGridRowsMeta = (apiRef, props) => {
|
|
|
137
137
|
positions.push(acc);
|
|
138
138
|
let otherSizes = 0;
|
|
139
139
|
const processedSizes = calculateRowProcessedSizes(row);
|
|
140
|
-
/* eslint-disable-next-line
|
|
140
|
+
/* eslint-disable-next-line guard-for-in */
|
|
141
141
|
for (const key in processedSizes) {
|
|
142
142
|
const value = processedSizes[key];
|
|
143
143
|
if (key !== 'baseCenter') {
|
package/node/index.js
CHANGED
package/node/locales/beBY.js
CHANGED
|
@@ -7,10 +7,10 @@ exports.beBY = void 0;
|
|
|
7
7
|
var _coreLocales = require("./coreLocales");
|
|
8
8
|
var _getGridLocalization = require("../utils/getGridLocalization");
|
|
9
9
|
const getPluralForm = (count, options) => {
|
|
10
|
-
let pluralForm = options.
|
|
10
|
+
let pluralForm = options.many;
|
|
11
11
|
const lastDigit = count % 10;
|
|
12
12
|
if (lastDigit > 1 && lastDigit < 5 && (count < 10 || count > 20)) {
|
|
13
|
-
pluralForm = options.
|
|
13
|
+
pluralForm = options.few;
|
|
14
14
|
} else if (lastDigit === 1 && count % 100 !== 11) {
|
|
15
15
|
pluralForm = options.one;
|
|
16
16
|
}
|
|
@@ -36,8 +36,8 @@ const beBYGrid = {
|
|
|
36
36
|
toolbarFiltersTooltipShow: 'Паказаць фільтры',
|
|
37
37
|
toolbarFiltersTooltipActive: count => getPluralForm(count, {
|
|
38
38
|
one: 'актыўны фільтр',
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
few: 'актыўных фільтра',
|
|
40
|
+
many: 'актыўных фільтраў'
|
|
41
41
|
}),
|
|
42
42
|
// Quick filter toolbar field
|
|
43
43
|
toolbarQuickFilterPlaceholder: 'Пошук…',
|
|
@@ -124,16 +124,16 @@ const beBYGrid = {
|
|
|
124
124
|
// Column header text
|
|
125
125
|
columnHeaderFiltersTooltipActive: count => getPluralForm(count, {
|
|
126
126
|
one: 'актыўны фільтр',
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
few: 'актыўных фільтра',
|
|
128
|
+
many: 'актыўных фільтраў'
|
|
129
129
|
}),
|
|
130
130
|
columnHeaderFiltersLabel: 'Паказаць фільтры',
|
|
131
131
|
columnHeaderSortIconLabel: 'Сартыраваць',
|
|
132
132
|
// Rows selected footer text
|
|
133
133
|
footerRowSelected: count => getPluralForm(count, {
|
|
134
134
|
one: 'абраны радок',
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
few: 'абраных радка',
|
|
136
|
+
many: 'абраных радкоў'
|
|
137
137
|
}),
|
|
138
138
|
// Total row amount footer text
|
|
139
139
|
footerTotalRows: 'Усяго радкоў:',
|
package/node/locales/faIR.js
CHANGED
|
@@ -39,8 +39,7 @@ const faIRGrid = {
|
|
|
39
39
|
columnsManagementSearchTitle: 'جستجو',
|
|
40
40
|
columnsManagementNoColumns: 'بدون سطر',
|
|
41
41
|
columnsManagementShowHideAllText: 'نمایش/مخفی کردن همه',
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
columnsManagementReset: 'بازنشانی',
|
|
44
43
|
// Filter panel text
|
|
45
44
|
filterPanelAddFilter: 'افزودن فیلتر',
|
|
46
45
|
filterPanelRemoveAll: 'حذف همه',
|
package/node/locales/ptBR.js
CHANGED
|
@@ -39,8 +39,7 @@ const ptBRGrid = {
|
|
|
39
39
|
columnsManagementSearchTitle: 'Buscar',
|
|
40
40
|
columnsManagementNoColumns: 'Nenhuma coluna',
|
|
41
41
|
columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
columnsManagementReset: 'Redefinir',
|
|
44
43
|
// Filter panel text
|
|
45
44
|
filterPanelAddFilter: 'Adicionar filtro',
|
|
46
45
|
filterPanelRemoveAll: 'Remover todos',
|
package/node/locales/ptPT.js
CHANGED
|
@@ -32,18 +32,17 @@ const ptPTGrid = {
|
|
|
32
32
|
// Export selector toolbar button text
|
|
33
33
|
toolbarExport: 'Exportar',
|
|
34
34
|
toolbarExportLabel: 'Exportar',
|
|
35
|
-
toolbarExportCSV: '
|
|
35
|
+
toolbarExportCSV: 'Descarregar como CSV',
|
|
36
36
|
toolbarExportPrint: 'Imprimir',
|
|
37
|
-
toolbarExportExcel: '
|
|
37
|
+
toolbarExportExcel: 'Descarregar como Excel',
|
|
38
38
|
// Columns management text
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
columnsManagementSearchTitle: 'Procurar',
|
|
40
|
+
columnsManagementNoColumns: 'Sem colunas',
|
|
41
|
+
columnsManagementShowHideAllText: 'Mostrar/Ocultar Todas',
|
|
42
|
+
columnsManagementReset: 'Repor',
|
|
44
43
|
// Filter panel text
|
|
45
44
|
filterPanelAddFilter: 'Adicionar filtro',
|
|
46
|
-
filterPanelRemoveAll: '
|
|
45
|
+
filterPanelRemoveAll: 'Excluir todos',
|
|
47
46
|
filterPanelDeleteIconLabel: 'Excluir',
|
|
48
47
|
filterPanelLogicOperator: 'Operador lógico',
|
|
49
48
|
filterPanelOperator: 'Operador',
|
|
@@ -97,9 +96,9 @@ const ptPTGrid = {
|
|
|
97
96
|
filterValueTrue: 'verdadeiro',
|
|
98
97
|
filterValueFalse: 'falso',
|
|
99
98
|
// Column menu text
|
|
100
|
-
columnMenuLabel: '
|
|
99
|
+
columnMenuLabel: 'Menu',
|
|
101
100
|
columnMenuShowColumns: 'Mostrar colunas',
|
|
102
|
-
columnMenuManageColumns: '
|
|
101
|
+
columnMenuManageColumns: 'Gerir colunas',
|
|
103
102
|
columnMenuFilter: 'Filtro',
|
|
104
103
|
columnMenuHideColumn: 'Ocultar coluna',
|
|
105
104
|
columnMenuUnsort: 'Desclassificar',
|
|
@@ -129,10 +128,10 @@ const ptPTGrid = {
|
|
|
129
128
|
// Column pinning text
|
|
130
129
|
pinToLeft: 'Fixar à esquerda',
|
|
131
130
|
pinToRight: 'Fixar à direita',
|
|
132
|
-
unpin: '
|
|
131
|
+
unpin: 'Desafixar',
|
|
133
132
|
// Tree Data
|
|
134
|
-
treeDataGroupingHeaderName: '
|
|
135
|
-
treeDataExpand: '
|
|
133
|
+
treeDataGroupingHeaderName: 'Grupo',
|
|
134
|
+
treeDataExpand: 'ver crianças',
|
|
136
135
|
treeDataCollapse: 'esconder crianças',
|
|
137
136
|
// Grouping columns
|
|
138
137
|
groupingColumnHeaderName: 'Grupo',
|
|
@@ -141,7 +140,7 @@ const ptPTGrid = {
|
|
|
141
140
|
// Master/detail
|
|
142
141
|
detailPanelToggle: 'Alternar painel de detalhes',
|
|
143
142
|
expandDetailPanel: 'Expandir',
|
|
144
|
-
collapseDetailPanel: '
|
|
143
|
+
collapseDetailPanel: 'Colapsar',
|
|
145
144
|
// Row reordering text
|
|
146
145
|
rowReorderingHeaderName: 'Reordenação de linhas',
|
|
147
146
|
// Aggregation
|