@mui/x-data-grid 6.18.0 → 6.18.2
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 +116 -5
- package/colDef/gridStringOperators.js +6 -1
- package/components/cell/GridActionsCell.js +19 -12
- package/components/cell/GridCell.js +4 -4
- package/hooks/features/filter/gridFilterUtils.d.ts +1 -0
- package/hooks/features/filter/gridFilterUtils.js +10 -7
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +2 -1
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/internals/utils/computeSlots.js +8 -1
- package/legacy/colDef/gridStringOperators.js +6 -1
- package/legacy/components/cell/GridActionsCell.js +21 -12
- package/legacy/components/cell/GridCell.js +6 -4
- package/legacy/hooks/features/filter/gridFilterUtils.js +10 -7
- package/legacy/hooks/features/filter/useGridFilter.js +2 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/internals/utils/computeSlots.js +8 -1
- package/legacy/locales/arSD.js +1 -1
- package/legacy/locales/csCZ.js +2 -2
- package/legacy/locales/heIL.js +1 -2
- package/legacy/utils/getPublicApiRef.js +5 -0
- package/locales/arSD.js +1 -1
- package/locales/csCZ.js +2 -2
- package/locales/heIL.js +1 -2
- package/models/api/gridFilterApi.d.ts +5 -0
- package/modern/colDef/gridStringOperators.js +6 -1
- package/modern/components/cell/GridActionsCell.js +18 -12
- package/modern/components/cell/GridCell.js +3 -3
- package/modern/hooks/features/filter/gridFilterUtils.js +10 -7
- package/modern/hooks/features/filter/useGridFilter.js +2 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/computeSlots.js +8 -1
- package/modern/locales/arSD.js +1 -1
- package/modern/locales/csCZ.js +2 -2
- package/modern/locales/heIL.js +1 -2
- package/modern/utils/getPublicApiRef.js +5 -0
- package/node/colDef/gridStringOperators.js +6 -1
- package/node/components/cell/GridActionsCell.js +18 -12
- package/node/components/cell/GridCell.js +3 -3
- package/node/hooks/features/filter/gridFilterUtils.js +11 -7
- package/node/hooks/features/filter/useGridFilter.js +2 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +12 -0
- package/node/internals/utils/computeSlots.js +8 -1
- package/node/locales/arSD.js +1 -1
- package/node/locales/csCZ.js +2 -2
- package/node/locales/heIL.js +1 -2
- package/node/utils/getPublicApiRef.js +11 -0
- package/package.json +1 -1
- package/utils/getPublicApiRef.d.ts +3 -0
- package/utils/getPublicApiRef.js +5 -0
package/legacy/locales/csCZ.js
CHANGED
|
@@ -150,8 +150,8 @@ var csCZGrid = {
|
|
|
150
150
|
// Actions cell more text
|
|
151
151
|
actionsCellMore: 'více',
|
|
152
152
|
// Column pinning text
|
|
153
|
-
pinToLeft: 'Připnout
|
|
154
|
-
pinToRight: 'Připnout
|
|
153
|
+
pinToLeft: 'Připnout vlevo',
|
|
154
|
+
pinToRight: 'Připnout vpravo',
|
|
155
155
|
unpin: 'Odepnout',
|
|
156
156
|
// Tree Data
|
|
157
157
|
treeDataGroupingHeaderName: 'Skupina',
|
package/legacy/locales/heIL.js
CHANGED
package/locales/arSD.js
CHANGED
|
@@ -93,7 +93,7 @@ const arSDGrid = {
|
|
|
93
93
|
// Column menu text
|
|
94
94
|
columnMenuLabel: 'القائمة',
|
|
95
95
|
columnMenuShowColumns: 'إظهار الأعمدة',
|
|
96
|
-
|
|
96
|
+
columnMenuManageColumns: 'إدارة الأعمدة',
|
|
97
97
|
columnMenuFilter: 'المرشِح',
|
|
98
98
|
columnMenuHideColumn: 'إخفاء',
|
|
99
99
|
columnMenuUnsort: 'الغاء الفرز',
|
package/locales/csCZ.js
CHANGED
|
@@ -150,8 +150,8 @@ const csCZGrid = {
|
|
|
150
150
|
// Actions cell more text
|
|
151
151
|
actionsCellMore: 'více',
|
|
152
152
|
// Column pinning text
|
|
153
|
-
pinToLeft: 'Připnout
|
|
154
|
-
pinToRight: 'Připnout
|
|
153
|
+
pinToLeft: 'Připnout vlevo',
|
|
154
|
+
pinToRight: 'Připnout vpravo',
|
|
155
155
|
unpin: 'Odepnout',
|
|
156
156
|
// Tree Data
|
|
157
157
|
treeDataGroupingHeaderName: 'Skupina',
|
package/locales/heIL.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GridFilterModel } from '../gridFilterModel';
|
|
2
2
|
import { GridFilterItem, GridLogicOperator } from '../gridFilterItem';
|
|
3
3
|
import { GridControlledStateReasonLookup } from '../events';
|
|
4
|
+
import { DataGridProcessedProps } from '../props/DataGridProps';
|
|
4
5
|
/**
|
|
5
6
|
* The filter API interface that is available in the grid [[apiRef]].
|
|
6
7
|
*/
|
|
@@ -52,4 +53,8 @@ export interface GridFilterApi {
|
|
|
52
53
|
* @param {any[]} values The list of element to quick filter
|
|
53
54
|
*/
|
|
54
55
|
setQuickFilterValues: (values: any[]) => void;
|
|
56
|
+
/**
|
|
57
|
+
* Returns the value of the `ignoreDiacritics` prop.
|
|
58
|
+
*/
|
|
59
|
+
ignoreDiacritics: DataGridProcessedProps['ignoreDiacritics'];
|
|
55
60
|
}
|
|
@@ -2,12 +2,17 @@ import { GridFilterInputValue } from '../components/panel/filterPanel/GridFilter
|
|
|
2
2
|
import { escapeRegExp } from '../utils/utils';
|
|
3
3
|
import { GridFilterInputMultipleValue } from '../components/panel/filterPanel/GridFilterInputMultipleValue';
|
|
4
4
|
import { convertLegacyOperators, tagInternalFilter } from './utils';
|
|
5
|
+
import { removeDiacritics } from '../hooks/features/filter/gridFilterUtils';
|
|
5
6
|
export const getGridStringQuickFilterFn = tagInternalFilter(value => {
|
|
6
7
|
if (!value) {
|
|
7
8
|
return null;
|
|
8
9
|
}
|
|
9
10
|
const filterRegex = new RegExp(escapeRegExp(value), 'i');
|
|
10
|
-
return
|
|
11
|
+
return (_, row, column, apiRef) => {
|
|
12
|
+
let columnValue = apiRef.current.getRowFormattedValue(row, column);
|
|
13
|
+
if (apiRef.current.ignoreDiacritics) {
|
|
14
|
+
columnValue = removeDiacritics(columnValue);
|
|
15
|
+
}
|
|
11
16
|
return columnValue != null ? filterRegex.test(columnValue.toString()) : false;
|
|
12
17
|
};
|
|
13
18
|
});
|
|
@@ -72,10 +72,12 @@ function GridActionsCell(props) {
|
|
|
72
72
|
focus() {
|
|
73
73
|
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
74
74
|
if (!ignoreCallToFocus.current) {
|
|
75
|
-
|
|
75
|
+
// find the first focusable button and pass the index to the state
|
|
76
|
+
const focusableButtonIndex = options.findIndex(o => !o.props.disabled);
|
|
77
|
+
setFocusedButtonIndex(focusableButtonIndex);
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
|
-
}), []);
|
|
80
|
+
}), [options]);
|
|
79
81
|
React.useEffect(() => {
|
|
80
82
|
if (focusedButtonIndex >= numberOfButtons) {
|
|
81
83
|
setFocusedButtonIndex(numberOfButtons - 1);
|
|
@@ -103,19 +105,23 @@ function GridActionsCell(props) {
|
|
|
103
105
|
if (numberOfButtons <= 1) {
|
|
104
106
|
return;
|
|
105
107
|
}
|
|
108
|
+
const getNewIndex = (index, direction) => {
|
|
109
|
+
if (index < 0 || index > options.length) {
|
|
110
|
+
return index;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// for rtl mode we need to reverse the direction
|
|
114
|
+
const rtlMod = theme.direction === 'rtl' ? -1 : 1;
|
|
115
|
+
const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
116
|
+
|
|
117
|
+
// if the button that should receive focus is disabled go one more step
|
|
118
|
+
return options[index + indexMod]?.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
|
|
119
|
+
};
|
|
106
120
|
let newIndex = focusedButtonIndex;
|
|
107
121
|
if (event.key === 'ArrowRight') {
|
|
108
|
-
|
|
109
|
-
newIndex -= 1;
|
|
110
|
-
} else {
|
|
111
|
-
newIndex += 1;
|
|
112
|
-
}
|
|
122
|
+
newIndex = getNewIndex(focusedButtonIndex, 'right');
|
|
113
123
|
} else if (event.key === 'ArrowLeft') {
|
|
114
|
-
|
|
115
|
-
newIndex += 1;
|
|
116
|
-
} else {
|
|
117
|
-
newIndex -= 1;
|
|
118
|
-
}
|
|
124
|
+
newIndex = getNewIndex(focusedButtonIndex, 'left');
|
|
119
125
|
}
|
|
120
126
|
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
121
127
|
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
@@ -439,8 +439,8 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
439
439
|
value,
|
|
440
440
|
formattedValue
|
|
441
441
|
} = cellParamsWithAPI;
|
|
442
|
-
const
|
|
443
|
-
const tabIndex = (cellMode === 'view' || !isEditable) && !
|
|
442
|
+
const canManageOwnFocus = column.type === 'actions' && column.getActions?.(apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled);
|
|
443
|
+
const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParamsWithAPI.tabIndex : -1;
|
|
444
444
|
const {
|
|
445
445
|
classes: rootClasses,
|
|
446
446
|
getCellClassName
|
|
@@ -578,7 +578,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
578
578
|
children: valueString
|
|
579
579
|
});
|
|
580
580
|
}
|
|
581
|
-
if ( /*#__PURE__*/React.isValidElement(children) &&
|
|
581
|
+
if ( /*#__PURE__*/React.isValidElement(children) && canManageOwnFocus) {
|
|
582
582
|
children = /*#__PURE__*/React.cloneElement(children, {
|
|
583
583
|
focusElementRef
|
|
584
584
|
});
|
|
@@ -3,6 +3,7 @@ import { GridLogicOperator } from '../../../models';
|
|
|
3
3
|
import { GLOBAL_API_REF, isInternalFilter } from '../../../colDef/utils';
|
|
4
4
|
import { getDefaultGridFilterModel } from './gridFilterState';
|
|
5
5
|
import { buildWarning } from '../../../utils/warning';
|
|
6
|
+
import { getPublicApiRef } from '../../../utils/getPublicApiRef';
|
|
6
7
|
import { gridColumnFieldsSelector, gridColumnLookupSelector, gridVisibleColumnFieldsSelector } from '../columns';
|
|
7
8
|
|
|
8
9
|
// Fixes https://github.com/mui/mui-x/issues/10056
|
|
@@ -69,7 +70,7 @@ export const sanitizeFilterModel = (model, disableMultipleColumnsFiltering, apiR
|
|
|
69
70
|
export const mergeStateWithFilterModel = (filterModel, disableMultipleColumnsFiltering, apiRef) => filteringState => _extends({}, filteringState, {
|
|
70
71
|
filterModel: sanitizeFilterModel(filterModel, disableMultipleColumnsFiltering, apiRef)
|
|
71
72
|
});
|
|
72
|
-
const removeDiacritics = value => {
|
|
73
|
+
export const removeDiacritics = value => {
|
|
73
74
|
if (typeof value === 'string') {
|
|
74
75
|
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
75
76
|
}
|
|
@@ -109,6 +110,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
109
110
|
}
|
|
110
111
|
const hasUserFunctionLegacy = !isInternalFilter(filterOperator.getApplyFilterFn);
|
|
111
112
|
const hasUserFunctionV7 = !isInternalFilter(filterOperator.getApplyFilterFnV7);
|
|
113
|
+
const publicApiRef = getPublicApiRef(apiRef);
|
|
112
114
|
if (filterOperator.getApplyFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
|
|
113
115
|
const applyFilterOnRow = filterOperator.getApplyFilterFnV7(newFilterItem, column);
|
|
114
116
|
if (typeof applyFilterOnRow !== 'function') {
|
|
@@ -122,7 +124,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
122
124
|
if (ignoreDiacritics) {
|
|
123
125
|
value = removeDiacritics(value);
|
|
124
126
|
}
|
|
125
|
-
return applyFilterOnRow(value, row, column,
|
|
127
|
+
return applyFilterOnRow(value, row, column, publicApiRef);
|
|
126
128
|
}
|
|
127
129
|
};
|
|
128
130
|
}
|
|
@@ -135,7 +137,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
135
137
|
item: newFilterItem,
|
|
136
138
|
fn: rowId => {
|
|
137
139
|
const params = apiRef.current.getCellParams(rowId, newFilterItem.field);
|
|
138
|
-
GLOBAL_API_REF.current =
|
|
140
|
+
GLOBAL_API_REF.current = publicApiRef;
|
|
139
141
|
if (ignoreDiacritics) {
|
|
140
142
|
params.value = removeDiacritics(params.value);
|
|
141
143
|
}
|
|
@@ -214,6 +216,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
214
216
|
const {
|
|
215
217
|
ignoreDiacritics
|
|
216
218
|
} = apiRef.current.rootProps;
|
|
219
|
+
const publicApiRef = getPublicApiRef(apiRef);
|
|
217
220
|
columnFields.forEach(field => {
|
|
218
221
|
const column = apiRef.current.getColumn(field);
|
|
219
222
|
const getApplyQuickFilterFn = column?.getApplyQuickFilterFn;
|
|
@@ -227,7 +230,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
227
230
|
const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
228
231
|
return {
|
|
229
232
|
v7: true,
|
|
230
|
-
fn: getApplyQuickFilterFnV7(value, column,
|
|
233
|
+
fn: getApplyQuickFilterFnV7(value, column, publicApiRef)
|
|
231
234
|
};
|
|
232
235
|
})
|
|
233
236
|
});
|
|
@@ -238,7 +241,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
238
241
|
const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
239
242
|
return {
|
|
240
243
|
v7: false,
|
|
241
|
-
fn: getApplyQuickFilterFn(value, column,
|
|
244
|
+
fn: getApplyQuickFilterFn(value, column, publicApiRef)
|
|
242
245
|
};
|
|
243
246
|
})
|
|
244
247
|
});
|
|
@@ -263,7 +266,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
263
266
|
continue;
|
|
264
267
|
}
|
|
265
268
|
const applier = appliers[v];
|
|
266
|
-
let value = apiRef.current.
|
|
269
|
+
let value = apiRef.current.getRowValue(row, column);
|
|
267
270
|
if (applier.fn === null) {
|
|
268
271
|
continue;
|
|
269
272
|
}
|
|
@@ -271,7 +274,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
271
274
|
if (ignoreDiacritics) {
|
|
272
275
|
value = removeDiacritics(value);
|
|
273
276
|
}
|
|
274
|
-
const isMatching = applier.fn(value, row, column,
|
|
277
|
+
const isMatching = applier.fn(value, row, column, publicApiRef);
|
|
275
278
|
if (isMatching) {
|
|
276
279
|
result[filterValue] = true;
|
|
277
280
|
continue outer;
|
|
@@ -212,7 +212,8 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
212
212
|
setFilterModel,
|
|
213
213
|
showFilterPanel,
|
|
214
214
|
hideFilterPanel,
|
|
215
|
-
setQuickFilterValues
|
|
215
|
+
setQuickFilterValues,
|
|
216
|
+
ignoreDiacritics: props.ignoreDiacritics
|
|
216
217
|
};
|
|
217
218
|
useGridApiMethod(apiRef, filterApi, 'public');
|
|
218
219
|
|
package/modern/index.js
CHANGED
|
@@ -59,6 +59,7 @@ export { isNavigationKey } from '../utils/keyboardUtils';
|
|
|
59
59
|
export { clamp, isDeepEqual, isNumber, isFunction, isObject } from '../utils/utils';
|
|
60
60
|
export { buildWarning } from '../utils/warning';
|
|
61
61
|
export { exportAs } from '../utils/exportAs';
|
|
62
|
+
export * from '../utils/getPublicApiRef';
|
|
62
63
|
export { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
|
|
63
64
|
export * from '../hooks/utils/useOnMount';
|
|
64
65
|
export { serializeCellValue } from '../hooks/features/export/serializers/csvSerializer';
|
|
@@ -13,5 +13,12 @@ export function computeSlots({
|
|
|
13
13
|
if (!overrides || Object.keys(overrides).length === 0) {
|
|
14
14
|
return defaultSlots;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const result = _extends({}, defaultSlots);
|
|
17
|
+
Object.keys(overrides).forEach(key => {
|
|
18
|
+
const k = key;
|
|
19
|
+
if (overrides[k] !== undefined) {
|
|
20
|
+
result[k] = overrides[k];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return result;
|
|
17
24
|
}
|
package/modern/locales/arSD.js
CHANGED
|
@@ -93,7 +93,7 @@ const arSDGrid = {
|
|
|
93
93
|
// Column menu text
|
|
94
94
|
columnMenuLabel: 'القائمة',
|
|
95
95
|
columnMenuShowColumns: 'إظهار الأعمدة',
|
|
96
|
-
|
|
96
|
+
columnMenuManageColumns: 'إدارة الأعمدة',
|
|
97
97
|
columnMenuFilter: 'المرشِح',
|
|
98
98
|
columnMenuHideColumn: 'إخفاء',
|
|
99
99
|
columnMenuUnsort: 'الغاء الفرز',
|
package/modern/locales/csCZ.js
CHANGED
|
@@ -150,8 +150,8 @@ const csCZGrid = {
|
|
|
150
150
|
// Actions cell more text
|
|
151
151
|
actionsCellMore: 'více',
|
|
152
152
|
// Column pinning text
|
|
153
|
-
pinToLeft: 'Připnout
|
|
154
|
-
pinToRight: 'Připnout
|
|
153
|
+
pinToLeft: 'Připnout vlevo',
|
|
154
|
+
pinToRight: 'Připnout vpravo',
|
|
155
155
|
unpin: 'Odepnout',
|
|
156
156
|
// Tree Data
|
|
157
157
|
treeDataGroupingHeaderName: 'Skupina',
|
package/modern/locales/heIL.js
CHANGED
|
@@ -8,12 +8,17 @@ var _GridFilterInputValue = require("../components/panel/filterPanel/GridFilterI
|
|
|
8
8
|
var _utils = require("../utils/utils");
|
|
9
9
|
var _GridFilterInputMultipleValue = require("../components/panel/filterPanel/GridFilterInputMultipleValue");
|
|
10
10
|
var _utils2 = require("./utils");
|
|
11
|
+
var _gridFilterUtils = require("../hooks/features/filter/gridFilterUtils");
|
|
11
12
|
const getGridStringQuickFilterFn = exports.getGridStringQuickFilterFn = (0, _utils2.tagInternalFilter)(value => {
|
|
12
13
|
if (!value) {
|
|
13
14
|
return null;
|
|
14
15
|
}
|
|
15
16
|
const filterRegex = new RegExp((0, _utils.escapeRegExp)(value), 'i');
|
|
16
|
-
return
|
|
17
|
+
return (_, row, column, apiRef) => {
|
|
18
|
+
let columnValue = apiRef.current.getRowFormattedValue(row, column);
|
|
19
|
+
if (apiRef.current.ignoreDiacritics) {
|
|
20
|
+
columnValue = (0, _gridFilterUtils.removeDiacritics)(columnValue);
|
|
21
|
+
}
|
|
17
22
|
return columnValue != null ? filterRegex.test(columnValue.toString()) : false;
|
|
18
23
|
};
|
|
19
24
|
});
|
|
@@ -81,10 +81,12 @@ function GridActionsCell(props) {
|
|
|
81
81
|
focus() {
|
|
82
82
|
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
83
83
|
if (!ignoreCallToFocus.current) {
|
|
84
|
-
|
|
84
|
+
// find the first focusable button and pass the index to the state
|
|
85
|
+
const focusableButtonIndex = options.findIndex(o => !o.props.disabled);
|
|
86
|
+
setFocusedButtonIndex(focusableButtonIndex);
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
|
-
}), []);
|
|
89
|
+
}), [options]);
|
|
88
90
|
React.useEffect(() => {
|
|
89
91
|
if (focusedButtonIndex >= numberOfButtons) {
|
|
90
92
|
setFocusedButtonIndex(numberOfButtons - 1);
|
|
@@ -112,19 +114,23 @@ function GridActionsCell(props) {
|
|
|
112
114
|
if (numberOfButtons <= 1) {
|
|
113
115
|
return;
|
|
114
116
|
}
|
|
117
|
+
const getNewIndex = (index, direction) => {
|
|
118
|
+
if (index < 0 || index > options.length) {
|
|
119
|
+
return index;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// for rtl mode we need to reverse the direction
|
|
123
|
+
const rtlMod = theme.direction === 'rtl' ? -1 : 1;
|
|
124
|
+
const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
125
|
+
|
|
126
|
+
// if the button that should receive focus is disabled go one more step
|
|
127
|
+
return options[index + indexMod]?.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
|
|
128
|
+
};
|
|
115
129
|
let newIndex = focusedButtonIndex;
|
|
116
130
|
if (event.key === 'ArrowRight') {
|
|
117
|
-
|
|
118
|
-
newIndex -= 1;
|
|
119
|
-
} else {
|
|
120
|
-
newIndex += 1;
|
|
121
|
-
}
|
|
131
|
+
newIndex = getNewIndex(focusedButtonIndex, 'right');
|
|
122
132
|
} else if (event.key === 'ArrowLeft') {
|
|
123
|
-
|
|
124
|
-
newIndex += 1;
|
|
125
|
-
} else {
|
|
126
|
-
newIndex -= 1;
|
|
127
|
-
}
|
|
133
|
+
newIndex = getNewIndex(focusedButtonIndex, 'left');
|
|
128
134
|
}
|
|
129
135
|
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
130
136
|
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
@@ -447,8 +447,8 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
447
447
|
value,
|
|
448
448
|
formattedValue
|
|
449
449
|
} = cellParamsWithAPI;
|
|
450
|
-
const
|
|
451
|
-
const tabIndex = (cellMode === 'view' || !isEditable) && !
|
|
450
|
+
const canManageOwnFocus = column.type === 'actions' && column.getActions?.(apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled);
|
|
451
|
+
const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParamsWithAPI.tabIndex : -1;
|
|
452
452
|
const {
|
|
453
453
|
classes: rootClasses,
|
|
454
454
|
getCellClassName
|
|
@@ -586,7 +586,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
586
586
|
children: valueString
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
|
-
if ( /*#__PURE__*/React.isValidElement(children) &&
|
|
589
|
+
if ( /*#__PURE__*/React.isValidElement(children) && canManageOwnFocus) {
|
|
590
590
|
children = /*#__PURE__*/React.cloneElement(children, {
|
|
591
591
|
focusElementRef
|
|
592
592
|
});
|
|
@@ -4,12 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.sanitizeFilterModel = exports.passFilterLogic = exports.mergeStateWithFilterModel = exports.cleanFilterItem = exports.buildAggregatedFilterApplier = void 0;
|
|
7
|
+
exports.sanitizeFilterModel = exports.removeDiacritics = exports.passFilterLogic = exports.mergeStateWithFilterModel = exports.cleanFilterItem = exports.buildAggregatedFilterApplier = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _models = require("../../../models");
|
|
10
10
|
var _utils = require("../../../colDef/utils");
|
|
11
11
|
var _gridFilterState = require("./gridFilterState");
|
|
12
12
|
var _warning = require("../../../utils/warning");
|
|
13
|
+
var _getPublicApiRef = require("../../../utils/getPublicApiRef");
|
|
13
14
|
var _columns = require("../columns");
|
|
14
15
|
// Fixes https://github.com/mui/mui-x/issues/10056
|
|
15
16
|
const globalScope = typeof window === 'undefined' ? globalThis : window;
|
|
@@ -84,6 +85,7 @@ const removeDiacritics = value => {
|
|
|
84
85
|
}
|
|
85
86
|
return value;
|
|
86
87
|
};
|
|
88
|
+
exports.removeDiacritics = removeDiacritics;
|
|
87
89
|
const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
88
90
|
if (!filterItem.field || !filterItem.operator) {
|
|
89
91
|
return null;
|
|
@@ -118,6 +120,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
118
120
|
}
|
|
119
121
|
const hasUserFunctionLegacy = !(0, _utils.isInternalFilter)(filterOperator.getApplyFilterFn);
|
|
120
122
|
const hasUserFunctionV7 = !(0, _utils.isInternalFilter)(filterOperator.getApplyFilterFnV7);
|
|
123
|
+
const publicApiRef = (0, _getPublicApiRef.getPublicApiRef)(apiRef);
|
|
121
124
|
if (filterOperator.getApplyFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
|
|
122
125
|
const applyFilterOnRow = filterOperator.getApplyFilterFnV7(newFilterItem, column);
|
|
123
126
|
if (typeof applyFilterOnRow !== 'function') {
|
|
@@ -131,7 +134,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
131
134
|
if (ignoreDiacritics) {
|
|
132
135
|
value = removeDiacritics(value);
|
|
133
136
|
}
|
|
134
|
-
return applyFilterOnRow(value, row, column,
|
|
137
|
+
return applyFilterOnRow(value, row, column, publicApiRef);
|
|
135
138
|
}
|
|
136
139
|
};
|
|
137
140
|
}
|
|
@@ -144,7 +147,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
144
147
|
item: newFilterItem,
|
|
145
148
|
fn: rowId => {
|
|
146
149
|
const params = apiRef.current.getCellParams(rowId, newFilterItem.field);
|
|
147
|
-
_utils.GLOBAL_API_REF.current =
|
|
150
|
+
_utils.GLOBAL_API_REF.current = publicApiRef;
|
|
148
151
|
if (ignoreDiacritics) {
|
|
149
152
|
params.value = removeDiacritics(params.value);
|
|
150
153
|
}
|
|
@@ -223,6 +226,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
223
226
|
const {
|
|
224
227
|
ignoreDiacritics
|
|
225
228
|
} = apiRef.current.rootProps;
|
|
229
|
+
const publicApiRef = (0, _getPublicApiRef.getPublicApiRef)(apiRef);
|
|
226
230
|
columnFields.forEach(field => {
|
|
227
231
|
const column = apiRef.current.getColumn(field);
|
|
228
232
|
const getApplyQuickFilterFn = column?.getApplyQuickFilterFn;
|
|
@@ -236,7 +240,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
236
240
|
const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
237
241
|
return {
|
|
238
242
|
v7: true,
|
|
239
|
-
fn: getApplyQuickFilterFnV7(value, column,
|
|
243
|
+
fn: getApplyQuickFilterFnV7(value, column, publicApiRef)
|
|
240
244
|
};
|
|
241
245
|
})
|
|
242
246
|
});
|
|
@@ -247,7 +251,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
247
251
|
const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
248
252
|
return {
|
|
249
253
|
v7: false,
|
|
250
|
-
fn: getApplyQuickFilterFn(value, column,
|
|
254
|
+
fn: getApplyQuickFilterFn(value, column, publicApiRef)
|
|
251
255
|
};
|
|
252
256
|
})
|
|
253
257
|
});
|
|
@@ -272,7 +276,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
272
276
|
continue;
|
|
273
277
|
}
|
|
274
278
|
const applier = appliers[v];
|
|
275
|
-
let value = apiRef.current.
|
|
279
|
+
let value = apiRef.current.getRowValue(row, column);
|
|
276
280
|
if (applier.fn === null) {
|
|
277
281
|
continue;
|
|
278
282
|
}
|
|
@@ -280,7 +284,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
280
284
|
if (ignoreDiacritics) {
|
|
281
285
|
value = removeDiacritics(value);
|
|
282
286
|
}
|
|
283
|
-
const isMatching = applier.fn(value, row, column,
|
|
287
|
+
const isMatching = applier.fn(value, row, column, publicApiRef);
|
|
284
288
|
if (isMatching) {
|
|
285
289
|
result[filterValue] = true;
|
|
286
290
|
continue outer;
|
|
@@ -222,7 +222,8 @@ const useGridFilter = (apiRef, props) => {
|
|
|
222
222
|
setFilterModel,
|
|
223
223
|
showFilterPanel,
|
|
224
224
|
hideFilterPanel,
|
|
225
|
-
setQuickFilterValues
|
|
225
|
+
setQuickFilterValues,
|
|
226
|
+
ignoreDiacritics: props.ignoreDiacritics
|
|
226
227
|
};
|
|
227
228
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, filterApi, 'public');
|
|
228
229
|
|
package/node/index.js
CHANGED
package/node/internals/index.js
CHANGED
|
@@ -716,6 +716,18 @@ var _keyboardUtils = require("../utils/keyboardUtils");
|
|
|
716
716
|
var _utils2 = require("../utils/utils");
|
|
717
717
|
var _warning = require("../utils/warning");
|
|
718
718
|
var _exportAs = require("../utils/exportAs");
|
|
719
|
+
var _getPublicApiRef = require("../utils/getPublicApiRef");
|
|
720
|
+
Object.keys(_getPublicApiRef).forEach(function (key) {
|
|
721
|
+
if (key === "default" || key === "__esModule") return;
|
|
722
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
723
|
+
if (key in exports && exports[key] === _getPublicApiRef[key]) return;
|
|
724
|
+
Object.defineProperty(exports, key, {
|
|
725
|
+
enumerable: true,
|
|
726
|
+
get: function () {
|
|
727
|
+
return _getPublicApiRef[key];
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
});
|
|
719
731
|
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
720
732
|
var _useOnMount = require("../hooks/utils/useOnMount");
|
|
721
733
|
Object.keys(_useOnMount).forEach(function (key) {
|
|
@@ -19,5 +19,12 @@ function computeSlots({
|
|
|
19
19
|
if (!overrides || Object.keys(overrides).length === 0) {
|
|
20
20
|
return defaultSlots;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
const result = (0, _extends2.default)({}, defaultSlots);
|
|
23
|
+
Object.keys(overrides).forEach(key => {
|
|
24
|
+
const k = key;
|
|
25
|
+
if (overrides[k] !== undefined) {
|
|
26
|
+
result[k] = overrides[k];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return result;
|
|
23
30
|
}
|
package/node/locales/arSD.js
CHANGED
|
@@ -99,7 +99,7 @@ const arSDGrid = {
|
|
|
99
99
|
// Column menu text
|
|
100
100
|
columnMenuLabel: 'القائمة',
|
|
101
101
|
columnMenuShowColumns: 'إظهار الأعمدة',
|
|
102
|
-
|
|
102
|
+
columnMenuManageColumns: 'إدارة الأعمدة',
|
|
103
103
|
columnMenuFilter: 'المرشِح',
|
|
104
104
|
columnMenuHideColumn: 'إخفاء',
|
|
105
105
|
columnMenuUnsort: 'الغاء الفرز',
|
package/node/locales/csCZ.js
CHANGED
|
@@ -156,8 +156,8 @@ const csCZGrid = {
|
|
|
156
156
|
// Actions cell more text
|
|
157
157
|
actionsCellMore: 'více',
|
|
158
158
|
// Column pinning text
|
|
159
|
-
pinToLeft: 'Připnout
|
|
160
|
-
pinToRight: 'Připnout
|
|
159
|
+
pinToLeft: 'Připnout vlevo',
|
|
160
|
+
pinToRight: 'Připnout vpravo',
|
|
161
161
|
unpin: 'Odepnout',
|
|
162
162
|
// Tree Data
|
|
163
163
|
treeDataGroupingHeaderName: 'Skupina',
|
package/node/locales/heIL.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { GridPrivateApiCommunity } from '../models/api/gridApiCommunity';
|
|
3
|
+
export declare function getPublicApiRef<PrivateApi extends GridPrivateApiCommunity>(apiRef: React.MutableRefObject<PrivateApi>): import("react").MutableRefObject<ReturnType<PrivateApi["getPublicApi"]>>;
|