@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.
- package/CHANGELOG.md +147 -0
- package/components/GridRow.js +0 -6
- package/components/columnHeaders/GridColumnGroupHeader.js +1 -1
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +16 -8
- package/components/toolbar/GridToolbarQuickFilter.js +0 -7
- package/hooks/features/dimensions/useGridDimensions.js +11 -12
- 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/ruRU.js +26 -30
- package/locales/ukUA.js +6 -5
- package/models/api/gridFilterApi.d.ts +7 -0
- package/modern/components/GridRow.js +0 -6
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +16 -8
- package/modern/components/toolbar/GridToolbarQuickFilter.js +0 -7
- package/modern/hooks/features/dimensions/useGridDimensions.js +11 -12
- 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/ruRU.js +26 -30
- package/modern/locales/ukUA.js +6 -5
- package/modern/utils/domUtils.js +3 -0
- package/modern/utils/fastObjectShallowCompare.js +0 -4
- package/node/components/GridRow.js +0 -6
- package/node/components/columnHeaders/GridColumnGroupHeader.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +16 -8
- package/node/components/toolbar/GridToolbarQuickFilter.js +0 -7
- package/node/hooks/features/dimensions/useGridDimensions.js +11 -12
- 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/ruRU.js +26 -30
- package/node/locales/ukUA.js +6 -5
- package/node/utils/domUtils.js +3 -0
- package/node/utils/fastObjectShallowCompare.js +0 -4
- package/package.json +2 -2
- package/utils/domUtils.js +3 -0
- package/utils/fastObjectShallowCompare.js +0 -4
|
@@ -74,17 +74,13 @@ export function useGridDimensions(apiRef, props) {
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
const computedStyle = ownerWindow(element).getComputedStyle(element);
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (!previousSize.current ||
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
height
|
|
85
|
-
};
|
|
86
|
-
apiRef.current.publishEvent('resize', size);
|
|
87
|
-
previousSize.current = size;
|
|
77
|
+
const newSize = {
|
|
78
|
+
width: parseFloat(computedStyle.width) || 0,
|
|
79
|
+
height: parseFloat(computedStyle.height) || 0
|
|
80
|
+
};
|
|
81
|
+
if (!previousSize.current || !areElementSizesEqual(previousSize.current, newSize)) {
|
|
82
|
+
apiRef.current.publishEvent('resize', newSize);
|
|
83
|
+
previousSize.current = newSize;
|
|
88
84
|
}
|
|
89
85
|
}, [apiRef]);
|
|
90
86
|
const getViewportPageSize = React.useCallback(() => {
|
|
@@ -190,7 +186,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
190
186
|
};
|
|
191
187
|
const prevDimensions = apiRef.current.state.dimensions;
|
|
192
188
|
setDimensions(newDimensions);
|
|
193
|
-
if (newDimensions.viewportInnerSize
|
|
189
|
+
if (!areElementSizesEqual(newDimensions.viewportInnerSize, prevDimensions.viewportInnerSize)) {
|
|
194
190
|
apiRef.current.publishEvent('viewportInnerSizeChange', newDimensions.viewportInnerSize);
|
|
195
191
|
}
|
|
196
192
|
apiRef.current.updateRenderContext?.();
|
|
@@ -285,4 +281,7 @@ function measureScrollbarSize(rootElement, columnsTotalWidth, scrollbarSize) {
|
|
|
285
281
|
// https://github.com/mui/mui-x/issues/9550#issuecomment-1619020477
|
|
286
282
|
function roundToDecimalPlaces(value, decimals) {
|
|
287
283
|
return Math.round(value * 10 ** decimals) / 10 ** decimals;
|
|
284
|
+
}
|
|
285
|
+
function areElementSizesEqual(a, b) {
|
|
286
|
+
return a.width === b.width && a.height === b.height;
|
|
288
287
|
}
|
|
@@ -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-
|
|
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
|
|
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/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: 'Немає рядків',
|
package/modern/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
|
}
|
|
@@ -117,12 +117,6 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
117
117
|
rowHeight
|
|
118
118
|
};
|
|
119
119
|
const classes = useUtilityClasses(ownerState);
|
|
120
|
-
React.useLayoutEffect(() => {
|
|
121
|
-
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
122
|
-
// Fallback for IE
|
|
123
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
124
|
-
}
|
|
125
|
-
}, [apiRef, rowHeight, rowId]);
|
|
126
120
|
React.useLayoutEffect(() => {
|
|
127
121
|
if (currentPage.range) {
|
|
128
122
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -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~=
|
|
@@ -14,7 +14,8 @@ var _utils = require("@mui/utils");
|
|
|
14
14
|
var _filterPanelUtils = require("./filterPanelUtils");
|
|
15
15
|
var _useGridRootProps = require("../../../hooks/utils/useGridRootProps");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"]
|
|
17
|
+
const _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "color", "error", "helperText", "size", "variant"],
|
|
18
|
+
_excluded2 = ["key"];
|
|
18
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
21
|
const filter = (0, _Autocomplete.createFilterOptions)();
|
|
@@ -82,13 +83,20 @@ function GridFilterInputMultipleSingleSelect(props) {
|
|
|
82
83
|
value: filteredValues,
|
|
83
84
|
onChange: handleChange,
|
|
84
85
|
getOptionLabel: getOptionLabel,
|
|
85
|
-
renderTags: (value, getTagProps) => value.map((option, index) =>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
renderTags: (value, getTagProps) => value.map((option, index) => {
|
|
87
|
+
const _getTagProps = getTagProps({
|
|
88
|
+
index
|
|
89
|
+
}),
|
|
90
|
+
{
|
|
91
|
+
key
|
|
92
|
+
} = _getTagProps,
|
|
93
|
+
tagProps = (0, _objectWithoutPropertiesLoose2.default)(_getTagProps, _excluded2);
|
|
94
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseChip, (0, _extends2.default)({
|
|
95
|
+
variant: "outlined",
|
|
96
|
+
size: "small",
|
|
97
|
+
label: getOptionLabel(option)
|
|
98
|
+
}, tagProps), key);
|
|
99
|
+
}),
|
|
92
100
|
renderInput: params => /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTextField, (0, _extends2.default)({}, params, {
|
|
93
101
|
label: apiRef.current.getLocaleText('filterPanelInputLabel'),
|
|
94
102
|
placeholder: apiRef.current.getLocaleText('filterPanelInputPlaceholder'),
|
|
@@ -48,13 +48,6 @@ const GridToolbarQuickFilterRoot = (0, _styles.styled)(_TextField.default, {
|
|
|
48
48
|
'& .MuiInput-underline:before': {
|
|
49
49
|
borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`
|
|
50
50
|
},
|
|
51
|
-
[`& input[type=search]::-ms-clear,
|
|
52
|
-
& input[type=search]::-ms-reveal`]: {
|
|
53
|
-
/* clears the 'X' icon from IE */
|
|
54
|
-
display: 'none',
|
|
55
|
-
width: 0,
|
|
56
|
-
height: 0
|
|
57
|
-
},
|
|
58
51
|
[`& input[type="search"]::-webkit-search-decoration,
|
|
59
52
|
& input[type="search"]::-webkit-search-cancel-button,
|
|
60
53
|
& input[type="search"]::-webkit-search-results-button,
|
|
@@ -85,17 +85,13 @@ function useGridDimensions(apiRef, props) {
|
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
const computedStyle = (0, _utils.unstable_ownerWindow)(element).getComputedStyle(element);
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (!previousSize.current ||
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
height
|
|
96
|
-
};
|
|
97
|
-
apiRef.current.publishEvent('resize', size);
|
|
98
|
-
previousSize.current = size;
|
|
88
|
+
const newSize = {
|
|
89
|
+
width: parseFloat(computedStyle.width) || 0,
|
|
90
|
+
height: parseFloat(computedStyle.height) || 0
|
|
91
|
+
};
|
|
92
|
+
if (!previousSize.current || !areElementSizesEqual(previousSize.current, newSize)) {
|
|
93
|
+
apiRef.current.publishEvent('resize', newSize);
|
|
94
|
+
previousSize.current = newSize;
|
|
99
95
|
}
|
|
100
96
|
}, [apiRef]);
|
|
101
97
|
const getViewportPageSize = React.useCallback(() => {
|
|
@@ -201,7 +197,7 @@ function useGridDimensions(apiRef, props) {
|
|
|
201
197
|
};
|
|
202
198
|
const prevDimensions = apiRef.current.state.dimensions;
|
|
203
199
|
setDimensions(newDimensions);
|
|
204
|
-
if (newDimensions.viewportInnerSize
|
|
200
|
+
if (!areElementSizesEqual(newDimensions.viewportInnerSize, prevDimensions.viewportInnerSize)) {
|
|
205
201
|
apiRef.current.publishEvent('viewportInnerSizeChange', newDimensions.viewportInnerSize);
|
|
206
202
|
}
|
|
207
203
|
apiRef.current.updateRenderContext?.();
|
|
@@ -296,4 +292,7 @@ function measureScrollbarSize(rootElement, columnsTotalWidth, scrollbarSize) {
|
|
|
296
292
|
// https://github.com/mui/mui-x/issues/9550#issuecomment-1619020477
|
|
297
293
|
function roundToDecimalPlaces(value, decimals) {
|
|
298
294
|
return Math.round(value * 10 ** decimals) / 10 ** decimals;
|
|
295
|
+
}
|
|
296
|
+
function areElementSizesEqual(a, b) {
|
|
297
|
+
return a.width === b.width && a.height === b.height;
|
|
299
298
|
}
|
|
@@ -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',
|