@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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,117 @@
|
|
|
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
|
+
## 6.18.2
|
|
7
|
+
|
|
8
|
+
_Nov 23, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Improve Arabic (ar-SD), Czech (cs-CZ), and Hebrew (he-IL) locales on Data Grid
|
|
13
|
+
- 🌍 Add Basque (eu) and Macedonian (mk) locales on Pickers
|
|
14
|
+
- 🌍 Improve German (de-DE) and Spanish (es-ES) locales on Pickers
|
|
15
|
+
- 🐞 Bugfixes
|
|
16
|
+
- 📚 Documentation improvements
|
|
17
|
+
|
|
18
|
+
### Data Grid
|
|
19
|
+
|
|
20
|
+
#### `@mui/x-data-grid@6.18.2`
|
|
21
|
+
|
|
22
|
+
- [l10n] Improve Arabic (ar-SD) locale (#11096) @OmarWebDev
|
|
23
|
+
- [l10n] Improve Czech (cs-CZ) locale (#10968) @luborepka
|
|
24
|
+
- [l10n] Improve Hebrew (he-IL) locale (#11056) @LironKiloma
|
|
25
|
+
|
|
26
|
+
#### `@mui/x-data-grid-pro@6.18.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
27
|
+
|
|
28
|
+
Same changes as in `@mui/x-data-grid@6.18.2`.
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid-premium@6.18.2` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
31
|
+
|
|
32
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.2`.
|
|
33
|
+
|
|
34
|
+
### Date Pickers
|
|
35
|
+
|
|
36
|
+
#### `@mui/x-date-pickers@6.18.2`
|
|
37
|
+
|
|
38
|
+
- [l10n] Add Basque (eu) locale and improve Spanish (es-ES) locale (#10985) @lajtomekadimon
|
|
39
|
+
- [l10n] Add Macedonian (mk) locale (#11155) @brsnik
|
|
40
|
+
- [l10n] Improve German (de-DE) locale (#11104) @jho-vema
|
|
41
|
+
- [pickers] Deprecate `defaultCalendarMonth` prop (#11138) @flaviendelangle
|
|
42
|
+
- [pickers] Fix `DateCalendar` crashing when given an invalid value (#11101) @flaviendelangle
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-date-pickers-pro@6.18.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
45
|
+
|
|
46
|
+
Same changes as in `@mui/x-date-pickers@6.18.2`.
|
|
47
|
+
|
|
48
|
+
### Charts / `@mui/x-charts@6.18.2`
|
|
49
|
+
|
|
50
|
+
- [charts] Fix `ChartsTooltip` component setup (#11157) @LukasTy
|
|
51
|
+
- [charts] Remove outdated prop-types (#10998) @alexfauquette
|
|
52
|
+
|
|
53
|
+
### Docs
|
|
54
|
+
|
|
55
|
+
- [docs] Fix incoherent naming of a component in `Custom slots and subcomponents` page (#11003) @lhilgert9
|
|
56
|
+
- [test] Skip flaky e2e test in webkit (#11115) @cherniavskii
|
|
57
|
+
- [test] Wait for images to load (#11109) @cherniavskii
|
|
58
|
+
|
|
59
|
+
## 6.18.1
|
|
60
|
+
|
|
61
|
+
_Nov 9, 2023_
|
|
62
|
+
|
|
63
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
64
|
+
|
|
65
|
+
- ✨ Fix aggregation label not showing when `renderHeader` is used (#10961) @cherniavskii
|
|
66
|
+
- 📘 Server side data source [early documentation](https://mui.com/x/react-data-grid/server-side-data/) published
|
|
67
|
+
- 📈 `<ChartsReferenceLine />` component is now available
|
|
68
|
+
- 🐞 Bugfixes
|
|
69
|
+
- 📚 Documentation improvements
|
|
70
|
+
|
|
71
|
+
### Data Grid
|
|
72
|
+
|
|
73
|
+
#### `@mui/x-data-grid@6.18.1`
|
|
74
|
+
|
|
75
|
+
- [DataGrid] Fix cell value type in quick filtering v7 (#10884) @cherniavskii
|
|
76
|
+
- [DataGrid] Fix keyboard navigation for actions cell with disabled buttons (#10947) @michelengelen
|
|
77
|
+
- [DataGrid] Fix `undefined` slot values (#10934) @romgrk
|
|
78
|
+
|
|
79
|
+
#### `@mui/x-data-grid-pro@6.18.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
80
|
+
|
|
81
|
+
Same changes as in `@mui/x-data-grid@6.18.1`, plus:
|
|
82
|
+
|
|
83
|
+
- [DataGridPro] Add data source interface and basic documentation (#10543) @MBilalShafi
|
|
84
|
+
|
|
85
|
+
#### `@mui/x-data-grid-premium@6.18.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
86
|
+
|
|
87
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.1`, plus:
|
|
88
|
+
|
|
89
|
+
- [DataGridPremium] Render aggregation label when `renderHeader` is used (#10961) @cherniavskii
|
|
90
|
+
|
|
91
|
+
### Date Pickers
|
|
92
|
+
|
|
93
|
+
#### `@mui/x-date-pickers@6.18.1`
|
|
94
|
+
|
|
95
|
+
- [fields] Fix multi input date time field section selection (#10915) @noraleonte
|
|
96
|
+
- [pickers] Always use up-to-date `defaultView` (#10889) @LukasTy
|
|
97
|
+
|
|
98
|
+
#### `@mui/x-date-pickers-pro@6.18.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
99
|
+
|
|
100
|
+
Same changes as in `@mui/x-date-pickers@6.18.1`.
|
|
101
|
+
|
|
102
|
+
### Charts / `@mui/x-charts@6.18.1`
|
|
103
|
+
|
|
104
|
+
- [charts] Add `<ChartsReferenceLine />` component (#10597) @wascou
|
|
105
|
+
- [charts] Improve properties JSDoc (#10931) @alexfauquette
|
|
106
|
+
|
|
107
|
+
### Docs
|
|
108
|
+
|
|
109
|
+
- [docs] Fix charts docs as stable (#10888) @alexfauquette
|
|
110
|
+
- [docs] Document how to hide the legend (#10954) @alexfauquette
|
|
111
|
+
|
|
112
|
+
### Core
|
|
113
|
+
|
|
114
|
+
- [core] Adds new alpha version to version select on the docs (#10944) @michelengelen
|
|
115
|
+
- [core] Fix GitHub title tag consistency @oliviertassinari
|
|
116
|
+
|
|
6
117
|
## 6.18.0
|
|
7
118
|
|
|
8
119
|
_Nov 3, 2023_
|
|
@@ -357,7 +468,7 @@ Same changes as in `@mui/x-date-pickers@6.16.1`, plus:
|
|
|
357
468
|
|
|
358
469
|
- [core] Fix casing consistency with legal and marketing content @oliviertassinari
|
|
359
470
|
- [core] Revert the link in the priority support ticket description (#10517) @michelengelen
|
|
360
|
-
- [
|
|
471
|
+
- [changelog] Polish image @oliviertassinari
|
|
361
472
|
|
|
362
473
|
## 6.16.0
|
|
363
474
|
|
|
@@ -1149,7 +1260,7 @@ Same changes as in `@mui/x-date-pickers@6.10.1`.
|
|
|
1149
1260
|
### Core
|
|
1150
1261
|
|
|
1151
1262
|
- [core] Add `validate` command (#9714) @romgrk
|
|
1152
|
-
- [
|
|
1263
|
+
- [changelog] Update generator to new format @oliviertassinari
|
|
1153
1264
|
|
|
1154
1265
|
## 6.10.0
|
|
1155
1266
|
|
|
@@ -1207,7 +1318,7 @@ Same changes as in `@mui/x-date-pickers@6.10.0`.
|
|
|
1207
1318
|
|
|
1208
1319
|
- [core] Disambiguate eslint plugin name @oliviertassinari
|
|
1209
1320
|
- [core] Update priority support issue template and prompt (#9574) @DanailH
|
|
1210
|
-
- [
|
|
1321
|
+
- [changelog] Clarify each plan (#9446) @oliviertassinari
|
|
1211
1322
|
- [license] Fix error terminology (#9614) @oliviertassinari
|
|
1212
1323
|
|
|
1213
1324
|
## 6.9.2
|
|
@@ -1356,8 +1467,8 @@ Same changes as in `@mui/x-date-pickers@6.9.1`.
|
|
|
1356
1467
|
- [core] Fix priority support prompt action (#9472) @DanailH
|
|
1357
1468
|
- [core] Update `uses` for priority support action (#9480) @DanailH
|
|
1358
1469
|
- [core] Bumb update monorepo (#9476) @alexfauquette
|
|
1359
|
-
- [
|
|
1360
|
-
- [
|
|
1470
|
+
- [changelog] Fix media quality (#9439) @oliviertassinari
|
|
1471
|
+
- [changelog] Remove height img attribute @oliviertassinari
|
|
1361
1472
|
- [test] Skip flaky row pinning tests in JSDOM (#9511) @cherniavskii
|
|
1362
1473
|
|
|
1363
1474
|
## 6.9.0
|
|
@@ -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
|
});
|
|
@@ -73,10 +73,12 @@ function GridActionsCell(props) {
|
|
|
73
73
|
focus() {
|
|
74
74
|
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
75
75
|
if (!ignoreCallToFocus.current) {
|
|
76
|
-
|
|
76
|
+
// find the first focusable button and pass the index to the state
|
|
77
|
+
const focusableButtonIndex = options.findIndex(o => !o.props.disabled);
|
|
78
|
+
setFocusedButtonIndex(focusableButtonIndex);
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
|
-
}), []);
|
|
81
|
+
}), [options]);
|
|
80
82
|
React.useEffect(() => {
|
|
81
83
|
if (focusedButtonIndex >= numberOfButtons) {
|
|
82
84
|
setFocusedButtonIndex(numberOfButtons - 1);
|
|
@@ -104,19 +106,24 @@ function GridActionsCell(props) {
|
|
|
104
106
|
if (numberOfButtons <= 1) {
|
|
105
107
|
return;
|
|
106
108
|
}
|
|
109
|
+
const getNewIndex = (index, direction) => {
|
|
110
|
+
var _options;
|
|
111
|
+
if (index < 0 || index > options.length) {
|
|
112
|
+
return index;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// for rtl mode we need to reverse the direction
|
|
116
|
+
const rtlMod = theme.direction === 'rtl' ? -1 : 1;
|
|
117
|
+
const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
118
|
+
|
|
119
|
+
// if the button that should receive focus is disabled go one more step
|
|
120
|
+
return (_options = options[index + indexMod]) != null && _options.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
|
|
121
|
+
};
|
|
107
122
|
let newIndex = focusedButtonIndex;
|
|
108
123
|
if (event.key === 'ArrowRight') {
|
|
109
|
-
|
|
110
|
-
newIndex -= 1;
|
|
111
|
-
} else {
|
|
112
|
-
newIndex += 1;
|
|
113
|
-
}
|
|
124
|
+
newIndex = getNewIndex(focusedButtonIndex, 'right');
|
|
114
125
|
} else if (event.key === 'ArrowLeft') {
|
|
115
|
-
|
|
116
|
-
newIndex += 1;
|
|
117
|
-
} else {
|
|
118
|
-
newIndex -= 1;
|
|
119
|
-
}
|
|
126
|
+
newIndex = getNewIndex(focusedButtonIndex, 'left');
|
|
120
127
|
}
|
|
121
128
|
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
122
129
|
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
@@ -386,7 +386,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
386
386
|
} : void 0;
|
|
387
387
|
export { MemoizedCellWrapper as GridCellWrapper, GridCell };
|
|
388
388
|
const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
389
|
-
var _rootProps$unstable_c, _rootProps$experiment3, _rootProps$experiment4;
|
|
389
|
+
var _getActions, _ref, _rootProps$unstable_c, _rootProps$experiment3, _rootProps$experiment4;
|
|
390
390
|
const {
|
|
391
391
|
column,
|
|
392
392
|
rowId,
|
|
@@ -441,8 +441,8 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
441
441
|
value,
|
|
442
442
|
formattedValue
|
|
443
443
|
} = cellParamsWithAPI;
|
|
444
|
-
const
|
|
445
|
-
const tabIndex = (cellMode === 'view' || !isEditable) && !
|
|
444
|
+
const canManageOwnFocus = column.type === 'actions' && ((_getActions = (_ref = column).getActions) == null ? void 0 : _getActions.call(_ref, apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled));
|
|
445
|
+
const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParamsWithAPI.tabIndex : -1;
|
|
446
446
|
const {
|
|
447
447
|
classes: rootClasses,
|
|
448
448
|
getCellClassName
|
|
@@ -580,7 +580,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
580
580
|
children: valueString
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
|
-
if ( /*#__PURE__*/React.isValidElement(children) &&
|
|
583
|
+
if ( /*#__PURE__*/React.isValidElement(children) && canManageOwnFocus) {
|
|
584
584
|
children = /*#__PURE__*/React.cloneElement(children, {
|
|
585
585
|
focusElementRef
|
|
586
586
|
});
|
|
@@ -13,6 +13,7 @@ import { GridAggregatedFilterItemApplier, GridFilterItemResult, GridQuickFilterV
|
|
|
13
13
|
export declare const cleanFilterItem: (item: GridFilterItem, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => GridFilterItem;
|
|
14
14
|
export declare const sanitizeFilterModel: (model: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => GridFilterModel;
|
|
15
15
|
export declare const mergeStateWithFilterModel: (filterModel: GridFilterModel, disableMultipleColumnsFiltering: boolean, apiRef: React.MutableRefObject<GridPrivateApiCommunity>) => (filteringState: GridStateCommunity['filter']) => GridStateCommunity['filter'];
|
|
16
|
+
export declare const removeDiacritics: (value: unknown) => unknown;
|
|
16
17
|
export declare const buildAggregatedFilterApplier: (filterModel: GridFilterModel, apiRef: React.MutableRefObject<GridPrivateApiCommunity>, disableEval: boolean) => GridAggregatedFilterItemApplier;
|
|
17
18
|
type FilterCache = {
|
|
18
19
|
cleanedFilterItems?: GridFilterItem[];
|
|
@@ -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
|
}
|
|
@@ -110,6 +111,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
110
111
|
}
|
|
111
112
|
const hasUserFunctionLegacy = !isInternalFilter(filterOperator.getApplyFilterFn);
|
|
112
113
|
const hasUserFunctionV7 = !isInternalFilter(filterOperator.getApplyFilterFnV7);
|
|
114
|
+
const publicApiRef = getPublicApiRef(apiRef);
|
|
113
115
|
if (filterOperator.getApplyFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
|
|
114
116
|
const applyFilterOnRow = filterOperator.getApplyFilterFnV7(newFilterItem, column);
|
|
115
117
|
if (typeof applyFilterOnRow !== 'function') {
|
|
@@ -123,7 +125,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
123
125
|
if (ignoreDiacritics) {
|
|
124
126
|
value = removeDiacritics(value);
|
|
125
127
|
}
|
|
126
|
-
return applyFilterOnRow(value, row, column,
|
|
128
|
+
return applyFilterOnRow(value, row, column, publicApiRef);
|
|
127
129
|
}
|
|
128
130
|
};
|
|
129
131
|
}
|
|
@@ -136,7 +138,7 @@ const getFilterCallbackFromItem = (filterItem, apiRef) => {
|
|
|
136
138
|
item: newFilterItem,
|
|
137
139
|
fn: rowId => {
|
|
138
140
|
const params = apiRef.current.getCellParams(rowId, newFilterItem.field);
|
|
139
|
-
GLOBAL_API_REF.current =
|
|
141
|
+
GLOBAL_API_REF.current = publicApiRef;
|
|
140
142
|
if (ignoreDiacritics) {
|
|
141
143
|
params.value = removeDiacritics(params.value);
|
|
142
144
|
}
|
|
@@ -216,6 +218,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
216
218
|
const {
|
|
217
219
|
ignoreDiacritics
|
|
218
220
|
} = apiRef.current.rootProps;
|
|
221
|
+
const publicApiRef = getPublicApiRef(apiRef);
|
|
219
222
|
columnFields.forEach(field => {
|
|
220
223
|
const column = apiRef.current.getColumn(field);
|
|
221
224
|
const getApplyQuickFilterFn = column == null ? void 0 : column.getApplyQuickFilterFn;
|
|
@@ -229,7 +232,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
229
232
|
const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
230
233
|
return {
|
|
231
234
|
v7: true,
|
|
232
|
-
fn: getApplyQuickFilterFnV7(value, column,
|
|
235
|
+
fn: getApplyQuickFilterFnV7(value, column, publicApiRef)
|
|
233
236
|
};
|
|
234
237
|
})
|
|
235
238
|
});
|
|
@@ -240,7 +243,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
240
243
|
const value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
241
244
|
return {
|
|
242
245
|
v7: false,
|
|
243
|
-
fn: getApplyQuickFilterFn(value, column,
|
|
246
|
+
fn: getApplyQuickFilterFn(value, column, publicApiRef)
|
|
244
247
|
};
|
|
245
248
|
})
|
|
246
249
|
});
|
|
@@ -265,7 +268,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
265
268
|
continue;
|
|
266
269
|
}
|
|
267
270
|
const applier = appliers[v];
|
|
268
|
-
let value = apiRef.current.
|
|
271
|
+
let value = apiRef.current.getRowValue(row, column);
|
|
269
272
|
if (applier.fn === null) {
|
|
270
273
|
continue;
|
|
271
274
|
}
|
|
@@ -273,7 +276,7 @@ const buildAggregatedQuickFilterApplier = (filterModel, apiRef) => {
|
|
|
273
276
|
if (ignoreDiacritics) {
|
|
274
277
|
value = removeDiacritics(value);
|
|
275
278
|
}
|
|
276
|
-
const isMatching = applier.fn(value, row, column,
|
|
279
|
+
const isMatching = applier.fn(value, row, column, publicApiRef);
|
|
277
280
|
if (isMatching) {
|
|
278
281
|
result[filterValue] = true;
|
|
279
282
|
continue outer;
|
|
@@ -8,4 +8,4 @@ export declare const filterStateInitializer: GridStateInitializer<Pick<DataGridP
|
|
|
8
8
|
* @requires useGridParamsApi (method)
|
|
9
9
|
* @requires useGridRows (event)
|
|
10
10
|
*/
|
|
11
|
-
export declare const useGridFilter: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'rows' | 'initialState' | 'filterModel' | 'getRowId' | 'onFilterModelChange' | 'filterMode' | 'disableMultipleColumnsFiltering' | 'slots' | 'slotProps' | 'disableColumnFilter' | 'disableEval'>) => void;
|
|
11
|
+
export declare const useGridFilter: (apiRef: React.MutableRefObject<GridPrivateApiCommunity>, props: Pick<DataGridProcessedProps, 'rows' | 'initialState' | 'filterModel' | 'getRowId' | 'onFilterModelChange' | 'filterMode' | 'disableMultipleColumnsFiltering' | 'slots' | 'slotProps' | 'disableColumnFilter' | 'disableEval' | 'ignoreDiacritics'>) => void;
|
|
@@ -215,7 +215,8 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
215
215
|
setFilterModel,
|
|
216
216
|
showFilterPanel,
|
|
217
217
|
hideFilterPanel,
|
|
218
|
-
setQuickFilterValues
|
|
218
|
+
setQuickFilterValues,
|
|
219
|
+
ignoreDiacritics: props.ignoreDiacritics
|
|
219
220
|
};
|
|
220
221
|
useGridApiMethod(apiRef, filterApi, 'public');
|
|
221
222
|
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -72,6 +72,7 @@ export { isNavigationKey } from '../utils/keyboardUtils';
|
|
|
72
72
|
export { clamp, isDeepEqual, isNumber, isFunction, isObject } from '../utils/utils';
|
|
73
73
|
export { buildWarning } from '../utils/warning';
|
|
74
74
|
export { exportAs } from '../utils/exportAs';
|
|
75
|
+
export * from '../utils/getPublicApiRef';
|
|
75
76
|
export type { GridPrivateOnlyApiCommon } from '../models/api/gridApiCommon';
|
|
76
77
|
export { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
|
|
77
78
|
export * from '../hooks/utils/useOnMount';
|
package/internals/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
|
}
|
|
@@ -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 var getGridStringQuickFilterFn = tagInternalFilter(function (value) {
|
|
6
7
|
if (!value) {
|
|
7
8
|
return null;
|
|
8
9
|
}
|
|
9
10
|
var filterRegex = new RegExp(escapeRegExp(value), 'i');
|
|
10
|
-
return function (
|
|
11
|
+
return function (_, row, column, apiRef) {
|
|
12
|
+
var 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
|
});
|
|
@@ -97,11 +97,15 @@ function GridActionsCell(props) {
|
|
|
97
97
|
focus: function focus() {
|
|
98
98
|
// If ignoreCallToFocus is true, then one of the buttons was clicked and the focus is already set
|
|
99
99
|
if (!ignoreCallToFocus.current) {
|
|
100
|
-
|
|
100
|
+
// find the first focusable button and pass the index to the state
|
|
101
|
+
var focusableButtonIndex = options.findIndex(function (o) {
|
|
102
|
+
return !o.props.disabled;
|
|
103
|
+
});
|
|
104
|
+
setFocusedButtonIndex(focusableButtonIndex);
|
|
101
105
|
}
|
|
102
106
|
}
|
|
103
107
|
};
|
|
104
|
-
}, []);
|
|
108
|
+
}, [options]);
|
|
105
109
|
React.useEffect(function () {
|
|
106
110
|
if (focusedButtonIndex >= numberOfButtons) {
|
|
107
111
|
setFocusedButtonIndex(numberOfButtons - 1);
|
|
@@ -133,19 +137,24 @@ function GridActionsCell(props) {
|
|
|
133
137
|
if (numberOfButtons <= 1) {
|
|
134
138
|
return;
|
|
135
139
|
}
|
|
140
|
+
var getNewIndex = function getNewIndex(index, direction) {
|
|
141
|
+
var _options;
|
|
142
|
+
if (index < 0 || index > options.length) {
|
|
143
|
+
return index;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// for rtl mode we need to reverse the direction
|
|
147
|
+
var rtlMod = theme.direction === 'rtl' ? -1 : 1;
|
|
148
|
+
var indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
149
|
+
|
|
150
|
+
// if the button that should receive focus is disabled go one more step
|
|
151
|
+
return (_options = options[index + indexMod]) != null && _options.props.disabled ? getNewIndex(index + indexMod, direction) : index + indexMod;
|
|
152
|
+
};
|
|
136
153
|
var newIndex = focusedButtonIndex;
|
|
137
154
|
if (event.key === 'ArrowRight') {
|
|
138
|
-
|
|
139
|
-
newIndex -= 1;
|
|
140
|
-
} else {
|
|
141
|
-
newIndex += 1;
|
|
142
|
-
}
|
|
155
|
+
newIndex = getNewIndex(focusedButtonIndex, 'right');
|
|
143
156
|
} else if (event.key === 'ArrowLeft') {
|
|
144
|
-
|
|
145
|
-
newIndex += 1;
|
|
146
|
-
} else {
|
|
147
|
-
newIndex -= 1;
|
|
148
|
-
}
|
|
157
|
+
newIndex = getNewIndex(focusedButtonIndex, 'left');
|
|
149
158
|
}
|
|
150
159
|
if (newIndex < 0 || newIndex >= numberOfButtons) {
|
|
151
160
|
return; // We're already in the first or last item = do nothing and let the grid listen the event
|
|
@@ -387,7 +387,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
387
387
|
} : void 0;
|
|
388
388
|
export { MemoizedCellWrapper as GridCellWrapper, GridCell };
|
|
389
389
|
var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
390
|
-
var _rootProps$unstable_c, _rootProps$experiment3, _rootProps$experiment4;
|
|
390
|
+
var _getActions, _ref, _rootProps$unstable_c, _rootProps$experiment3, _rootProps$experiment4;
|
|
391
391
|
var column = props.column,
|
|
392
392
|
rowId = props.rowId,
|
|
393
393
|
editCellState = props.editCellState,
|
|
@@ -443,8 +443,10 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
443
443
|
isEditable = cellParamsWithAPI.isEditable,
|
|
444
444
|
value = cellParamsWithAPI.value,
|
|
445
445
|
formattedValue = cellParamsWithAPI.formattedValue;
|
|
446
|
-
var
|
|
447
|
-
|
|
446
|
+
var canManageOwnFocus = column.type === 'actions' && ((_getActions = (_ref = column).getActions) == null ? void 0 : _getActions.call(_ref, apiRef.current.getRowParams(rowId)).some(function (action) {
|
|
447
|
+
return !action.props.disabled;
|
|
448
|
+
}));
|
|
449
|
+
var tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParamsWithAPI.tabIndex : -1;
|
|
448
450
|
var rootClasses = rootProps.classes,
|
|
449
451
|
getCellClassName = rootProps.getCellClassName;
|
|
450
452
|
var classNames = apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
|
|
@@ -588,7 +590,7 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
588
590
|
children: valueString
|
|
589
591
|
});
|
|
590
592
|
}
|
|
591
|
-
if ( /*#__PURE__*/React.isValidElement(children) &&
|
|
593
|
+
if ( /*#__PURE__*/React.isValidElement(children) && canManageOwnFocus) {
|
|
592
594
|
children = /*#__PURE__*/React.cloneElement(children, {
|
|
593
595
|
focusElementRef: focusElementRef
|
|
594
596
|
});
|
|
@@ -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
|
|
@@ -79,7 +80,7 @@ export var mergeStateWithFilterModel = function mergeStateWithFilterModel(filter
|
|
|
79
80
|
});
|
|
80
81
|
};
|
|
81
82
|
};
|
|
82
|
-
var removeDiacritics = function removeDiacritics(value) {
|
|
83
|
+
export var removeDiacritics = function removeDiacritics(value) {
|
|
83
84
|
if (typeof value === 'string') {
|
|
84
85
|
return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
|
|
85
86
|
}
|
|
@@ -122,6 +123,7 @@ var getFilterCallbackFromItem = function getFilterCallbackFromItem(filterItem, a
|
|
|
122
123
|
}
|
|
123
124
|
var hasUserFunctionLegacy = !isInternalFilter(filterOperator.getApplyFilterFn);
|
|
124
125
|
var hasUserFunctionV7 = !isInternalFilter(filterOperator.getApplyFilterFnV7);
|
|
126
|
+
var publicApiRef = getPublicApiRef(apiRef);
|
|
125
127
|
if (filterOperator.getApplyFilterFnV7 && !(hasUserFunctionLegacy && !hasUserFunctionV7)) {
|
|
126
128
|
var _applyFilterOnRow = filterOperator.getApplyFilterFnV7(newFilterItem, column);
|
|
127
129
|
if (typeof _applyFilterOnRow !== 'function') {
|
|
@@ -135,7 +137,7 @@ var getFilterCallbackFromItem = function getFilterCallbackFromItem(filterItem, a
|
|
|
135
137
|
if (ignoreDiacritics) {
|
|
136
138
|
value = removeDiacritics(value);
|
|
137
139
|
}
|
|
138
|
-
return _applyFilterOnRow(value, row, column,
|
|
140
|
+
return _applyFilterOnRow(value, row, column, publicApiRef);
|
|
139
141
|
}
|
|
140
142
|
};
|
|
141
143
|
}
|
|
@@ -148,7 +150,7 @@ var getFilterCallbackFromItem = function getFilterCallbackFromItem(filterItem, a
|
|
|
148
150
|
item: newFilterItem,
|
|
149
151
|
fn: function fn(rowId) {
|
|
150
152
|
var params = apiRef.current.getCellParams(rowId, newFilterItem.field);
|
|
151
|
-
GLOBAL_API_REF.current =
|
|
153
|
+
GLOBAL_API_REF.current = publicApiRef;
|
|
152
154
|
if (ignoreDiacritics) {
|
|
153
155
|
params.value = removeDiacritics(params.value);
|
|
154
156
|
}
|
|
@@ -221,6 +223,7 @@ var buildAggregatedQuickFilterApplier = function buildAggregatedQuickFilterAppli
|
|
|
221
223
|
var columnFields = quickFilterExcludeHiddenColumns ? gridVisibleColumnFieldsSelector(apiRef) : gridColumnFieldsSelector(apiRef);
|
|
222
224
|
var appliersPerField = [];
|
|
223
225
|
var ignoreDiacritics = apiRef.current.rootProps.ignoreDiacritics;
|
|
226
|
+
var publicApiRef = getPublicApiRef(apiRef);
|
|
224
227
|
columnFields.forEach(function (field) {
|
|
225
228
|
var column = apiRef.current.getColumn(field);
|
|
226
229
|
var getApplyQuickFilterFn = column == null ? void 0 : column.getApplyQuickFilterFn;
|
|
@@ -234,7 +237,7 @@ var buildAggregatedQuickFilterApplier = function buildAggregatedQuickFilterAppli
|
|
|
234
237
|
var value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
235
238
|
return {
|
|
236
239
|
v7: true,
|
|
237
|
-
fn: getApplyQuickFilterFnV7(value, column,
|
|
240
|
+
fn: getApplyQuickFilterFnV7(value, column, publicApiRef)
|
|
238
241
|
};
|
|
239
242
|
})
|
|
240
243
|
});
|
|
@@ -245,7 +248,7 @@ var buildAggregatedQuickFilterApplier = function buildAggregatedQuickFilterAppli
|
|
|
245
248
|
var value = ignoreDiacritics ? removeDiacritics(quickFilterValue) : quickFilterValue;
|
|
246
249
|
return {
|
|
247
250
|
v7: false,
|
|
248
|
-
fn: getApplyQuickFilterFn(value, column,
|
|
251
|
+
fn: getApplyQuickFilterFn(value, column, publicApiRef)
|
|
249
252
|
};
|
|
250
253
|
})
|
|
251
254
|
});
|
|
@@ -267,7 +270,7 @@ var buildAggregatedQuickFilterApplier = function buildAggregatedQuickFilterAppli
|
|
|
267
270
|
continue;
|
|
268
271
|
}
|
|
269
272
|
var applier = appliers[v];
|
|
270
|
-
var value = apiRef.current.
|
|
273
|
+
var value = apiRef.current.getRowValue(row, column);
|
|
271
274
|
if (applier.fn === null) {
|
|
272
275
|
continue;
|
|
273
276
|
}
|
|
@@ -275,7 +278,7 @@ var buildAggregatedQuickFilterApplier = function buildAggregatedQuickFilterAppli
|
|
|
275
278
|
if (ignoreDiacritics) {
|
|
276
279
|
value = removeDiacritics(value);
|
|
277
280
|
}
|
|
278
|
-
var isMatching = applier.fn(value, row, column,
|
|
281
|
+
var isMatching = applier.fn(value, row, column, publicApiRef);
|
|
279
282
|
if (isMatching) {
|
|
280
283
|
result[filterValue] = true;
|
|
281
284
|
continue outer;
|
|
@@ -226,7 +226,8 @@ export var useGridFilter = function useGridFilter(apiRef, props) {
|
|
|
226
226
|
setFilterModel: setFilterModel,
|
|
227
227
|
showFilterPanel: showFilterPanel,
|
|
228
228
|
hideFilterPanel: hideFilterPanel,
|
|
229
|
-
setQuickFilterValues: setQuickFilterValues
|
|
229
|
+
setQuickFilterValues: setQuickFilterValues,
|
|
230
|
+
ignoreDiacritics: props.ignoreDiacritics
|
|
230
231
|
};
|
|
231
232
|
useGridApiMethod(apiRef, filterApi, 'public');
|
|
232
233
|
|
package/legacy/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';
|
|
@@ -12,5 +12,12 @@ export function computeSlots(_ref) {
|
|
|
12
12
|
if (!overrides || Object.keys(overrides).length === 0) {
|
|
13
13
|
return defaultSlots;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
var result = _extends({}, defaultSlots);
|
|
16
|
+
Object.keys(overrides).forEach(function (key) {
|
|
17
|
+
var k = key;
|
|
18
|
+
if (overrides[k] !== undefined) {
|
|
19
|
+
result[k] = overrides[k];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return result;
|
|
16
23
|
}
|
package/legacy/locales/arSD.js
CHANGED
|
@@ -95,7 +95,7 @@ var arSDGrid = {
|
|
|
95
95
|
// Column menu text
|
|
96
96
|
columnMenuLabel: 'القائمة',
|
|
97
97
|
columnMenuShowColumns: 'إظهار الأعمدة',
|
|
98
|
-
|
|
98
|
+
columnMenuManageColumns: 'إدارة الأعمدة',
|
|
99
99
|
columnMenuFilter: 'المرشِح',
|
|
100
100
|
columnMenuHideColumn: 'إخفاء',
|
|
101
101
|
columnMenuUnsort: 'الغاء الفرز',
|