@mui/x-data-grid 7.13.0 → 7.15.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 +151 -2
- package/components/cell/GridActionsCell.js +3 -3
- package/components/cell/GridCell.js +11 -12
- package/components/cell/GridEditSingleSelectCell.js +2 -3
- package/components/menu/columnMenu/GridColumnMenuContainer.js +2 -2
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/GridPanel.js +1 -2
- package/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/components/toolbar/GridToolbarQuickFilter.js +5 -3
- package/hooks/core/gridCoreSelector.d.ts +1 -1
- package/hooks/core/gridCoreSelector.js +1 -1
- package/hooks/core/useGridInitialization.js +2 -2
- package/hooks/core/{useGridTheme.d.ts → useGridIsRtl.d.ts} +1 -1
- package/hooks/core/{useGridTheme.js → useGridIsRtl.js} +7 -7
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -3
- package/hooks/features/columnResize/useGridColumnResize.js +5 -5
- package/hooks/features/columns/gridColumnsSelector.js +3 -3
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +19 -20
- package/hooks/features/rows/useGridParamsApi.js +2 -1
- package/hooks/features/scroll/useGridScroll.js +4 -4
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +13 -13
- package/hooks/utils/useGridSelector.d.ts +4 -1
- package/hooks/utils/useGridSelector.js +38 -0
- package/index.js +1 -1
- package/internals/index.d.ts +2 -1
- package/internals/index.js +2 -1
- package/locales/csCZ.js +4 -5
- package/locales/heIL.js +4 -5
- package/models/gridDataSource.d.ts +6 -6
- package/models/gridStateCommunity.d.ts +1 -2
- package/models/params/gridCellParams.d.ts +4 -0
- package/modern/components/cell/GridActionsCell.js +3 -3
- package/modern/components/cell/GridCell.js +11 -12
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -3
- package/modern/components/menu/columnMenu/GridColumnMenuContainer.js +2 -2
- package/modern/components/panel/GridPanel.js +1 -2
- package/modern/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -2
- package/modern/components/toolbar/GridToolbarExportContainer.js +2 -2
- package/modern/components/toolbar/GridToolbarQuickFilter.js +5 -3
- package/modern/hooks/core/gridCoreSelector.js +1 -1
- package/modern/hooks/core/useGridInitialization.js +2 -2
- package/modern/hooks/core/{useGridTheme.js → useGridIsRtl.js} +7 -7
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +4 -3
- package/modern/hooks/features/columnResize/useGridColumnResize.js +5 -5
- package/modern/hooks/features/columns/gridColumnsSelector.js +3 -3
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +19 -20
- package/modern/hooks/features/rows/useGridParamsApi.js +2 -1
- package/modern/hooks/features/scroll/useGridScroll.js +4 -4
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +13 -13
- package/modern/hooks/utils/useGridSelector.js +38 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -1
- package/modern/locales/csCZ.js +4 -5
- package/modern/locales/heIL.js +4 -5
- package/modern/utils/createSelector.js +116 -0
- package/modern/utils/keyboardUtils.js +1 -11
- package/node/components/cell/GridActionsCell.js +3 -3
- package/node/components/cell/GridCell.js +11 -12
- package/node/components/cell/GridEditSingleSelectCell.js +2 -3
- package/node/components/menu/columnMenu/GridColumnMenuContainer.js +1 -1
- package/node/components/panel/GridPanel.js +1 -2
- package/node/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/node/components/toolbar/GridToolbarDensitySelector.js +1 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +1 -1
- package/node/components/toolbar/GridToolbarQuickFilter.js +5 -3
- package/node/hooks/core/gridCoreSelector.js +3 -3
- package/node/hooks/core/useGridInitialization.js +2 -2
- package/node/hooks/core/{useGridTheme.js → useGridIsRtl.js} +9 -9
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -2
- package/node/hooks/features/columnResize/useGridColumnResize.js +5 -5
- package/node/hooks/features/columns/gridColumnsSelector.js +2 -2
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +19 -20
- package/node/hooks/features/rows/useGridParamsApi.js +2 -1
- package/node/hooks/features/scroll/useGridScroll.js +4 -4
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +13 -13
- package/node/hooks/utils/useGridSelector.js +41 -2
- package/node/index.js +1 -1
- package/node/internals/index.js +22 -0
- package/node/locales/csCZ.js +4 -5
- package/node/locales/heIL.js +4 -5
- package/node/utils/createSelector.js +119 -2
- package/node/utils/keyboardUtils.js +2 -15
- package/package.json +6 -6
- package/utils/createSelector.d.ts +19 -0
- package/utils/createSelector.js +116 -0
- package/utils/keyboardUtils.d.ts +1 -9
- package/utils/keyboardUtils.js +1 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,155 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.15.0
|
|
7
|
+
|
|
8
|
+
_Aug 29, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 💫 Support Material UI v6 (`@mui/material@6`) peer dependency (#14142) @cherniavskii
|
|
13
|
+
|
|
14
|
+
You can now use MUI X components with either v5 or v6 of `@mui/material` package 🎉
|
|
15
|
+
|
|
16
|
+
- 🐞 Bugfixes
|
|
17
|
+
|
|
18
|
+
### Data Grid
|
|
19
|
+
|
|
20
|
+
#### `@mui/x-data-grid-pro@7.15.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
21
|
+
|
|
22
|
+
- [DataGridPro] Export `GridRowReorderCell` component (#14079) @genepaul
|
|
23
|
+
|
|
24
|
+
#### `@mui/x-data-grid-premium@7.15.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
25
|
+
|
|
26
|
+
Same changes as in `@mui/x-data-grid-pro@7.15.0`.
|
|
27
|
+
|
|
28
|
+
### Date and Time Pickers
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-date-pickers@7.15.0`
|
|
31
|
+
|
|
32
|
+
- [pickers] Add `onTouchStart` handler for `TimeClock` (#14305) @arthurbalduini
|
|
33
|
+
|
|
34
|
+
#### `@mui/x-date-pickers-pro@7.15.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
35
|
+
|
|
36
|
+
Same changes as in `@mui/x-date-pickers@7.15.0`, plus:
|
|
37
|
+
|
|
38
|
+
- [DateTimeRangePicker] Fix date format resolving from views on 24hr locales (#14341) @arthurbalduini
|
|
39
|
+
|
|
40
|
+
### Charts
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-charts@7.15.0`
|
|
43
|
+
|
|
44
|
+
- [charts] Add missing `themeAugmentation` in pro plan (#14313) @lhilgert9
|
|
45
|
+
- [charts] Fix `LineChart` transition stopping before completion (#14366) @JCQuintas
|
|
46
|
+
- [charts] Fix tooltip with horizontal layout (#14337) @alexfauquette
|
|
47
|
+
- [charts] Keep axis root classe usage explicit (#14378) @alexfauquette
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-charts-pro@7.0.0-alpha.3` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
50
|
+
|
|
51
|
+
Same changes as in `@mui/x-charts@7.15.0`, plus:
|
|
52
|
+
|
|
53
|
+
- [charts pro] Avoid relative reference to `@mui/x-charts` package (#14335) @LukasTy
|
|
54
|
+
|
|
55
|
+
### Docs
|
|
56
|
+
|
|
57
|
+
- [docs] Fix sentence case `h2` @oliviertassinari
|
|
58
|
+
- [docs] Clarify contribution guide references @oliviertassinari
|
|
59
|
+
- [docs] Fix Stack Overflow issue canned response @oliviertassinari
|
|
60
|
+
- [docs] Fix outdated link to support page @oliviertassinari
|
|
61
|
+
- [docs] Fix use of Material UI @oliviertassinari
|
|
62
|
+
- [docs] Update deprecated props in docs (#14295) @JCQuintas
|
|
63
|
+
|
|
64
|
+
### Core
|
|
65
|
+
|
|
66
|
+
- [core] Allow only v5.x for `MUI Core` renovate group (#14382) @LukasTy
|
|
67
|
+
- [core] Avoid visual regression when using `@mui/material@6` (#14357) @cherniavskii
|
|
68
|
+
- [core] Remove renovate rule targeting only `next` releases of `@mui/docs` (#14364) @LukasTy
|
|
69
|
+
- [core] Support `@mui/material@6` peer dependency (#14142) @cherniavskii
|
|
70
|
+
- [core] Use `useRtl` instead of `useTheme` to access direction (#14359) @LukasTy
|
|
71
|
+
- [code-infra] Typecheck nested folders in playground (#14352) @JCQuintas
|
|
72
|
+
- [infra] Fix Issue cleanup action @oliviertassinari
|
|
73
|
+
- [license] Prepare renaming of argument names @oliviertassinari
|
|
74
|
+
|
|
75
|
+
## 7.14.0
|
|
76
|
+
|
|
77
|
+
_Aug 23, 2024_
|
|
78
|
+
|
|
79
|
+
We'd like to offer a big thanks to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
80
|
+
|
|
81
|
+
- 💫 Allow [filtering the axis on zoom](https://mui.com/x/react-charts/zoom-and-pan/#zoom-filtering), making the axis adapt by removing values outside the view.
|
|
82
|
+
|
|
83
|
+
<img width="600" src="https://github.com/user-attachments/assets/e65bbd00-d2a8-4136-81cd-3598f1373c16" alt="filtering the axis on zoom" />
|
|
84
|
+
|
|
85
|
+
- 📊 Improve bar chart performances
|
|
86
|
+
- 🌍 Improve Czech (cs-CZ) and Hebrew (he-IL) locales on the Data Grid
|
|
87
|
+
- 🌍 Improve Chinese (zh-HK), Hebrew (he-IL), and Vietnamese (vi-VN) locales on the Date and Time Pickers
|
|
88
|
+
- 🐞 Bugfixes
|
|
89
|
+
|
|
90
|
+
<!--/ HIGHLIGHT_ABOVE_SEPARATOR /-->
|
|
91
|
+
|
|
92
|
+
### Data Grid
|
|
93
|
+
|
|
94
|
+
#### `@mui/x-data-grid@7.14.0`
|
|
95
|
+
|
|
96
|
+
- [DataGrid] Use readonly array result for `getTreeDataPath` (#11743) @pcorpet
|
|
97
|
+
- [DataGrid] Use `event.key` for `Tab` and `Escape` keys (#14170) @k-rajat19
|
|
98
|
+
- [DataGrid] Introduce selectors with arguments (#14236) @MBilalShafi
|
|
99
|
+
- [DataGrid] include `api` in `gridCellParams` interface (#14201) @k-rajat19
|
|
100
|
+
- [l10n] Improve Czech (cs-CZ) locale (#14135) @chirimiri22
|
|
101
|
+
- [l10n] Improve Hebrew (he-IL) locale (#14287) @rotembarsela
|
|
102
|
+
|
|
103
|
+
#### `@mui/x-data-grid-pro@7.14.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
104
|
+
|
|
105
|
+
Same changes as in `@mui/x-data-grid@7.14.0`.
|
|
106
|
+
|
|
107
|
+
#### `@mui/x-data-grid-premium@7.14.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
108
|
+
|
|
109
|
+
Same changes as in `@mui/x-data-grid-pro@7.14.0`, plus:
|
|
110
|
+
|
|
111
|
+
- [DataGridPremium] Fix clipboard paste not working for a single cell on non-first page (#14261) @arminmeh
|
|
112
|
+
- [DataGridPremium] Fix `onCellSelectionModelChange` not triggered when additional cell range is selected (#14199) @arminmeh
|
|
113
|
+
|
|
114
|
+
### Date and Time Pickers
|
|
115
|
+
|
|
116
|
+
#### `@mui/x-date-pickers@7.14.0`
|
|
117
|
+
|
|
118
|
+
- [l10n] Improve Chinese (zh-HK) locale (#13289) @yeeharn
|
|
119
|
+
- [l10n] Improve Hebrew (he-IL) locale (#14287) @rotembarsela
|
|
120
|
+
- [l10n] Improve Vietnamese (vi-VN) locale (#14238) @locnbk2002
|
|
121
|
+
- [TimePicker] Handle `Space` and `Enter` on the `TimeClock` component @arthurbalduini
|
|
122
|
+
|
|
123
|
+
#### `@mui/x-date-pickers-pro@7.14.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
124
|
+
|
|
125
|
+
Same changes as in `@mui/x-date-pickers@7.14.0`.
|
|
126
|
+
|
|
127
|
+
### Charts
|
|
128
|
+
|
|
129
|
+
#### `@mui/x-charts@7.14.0`
|
|
130
|
+
|
|
131
|
+
- [charts] Fix grid overflow with zooming (#14280) @alexfauquette
|
|
132
|
+
- [charts] Improve bar chart performances (#14278) @alexfauquette
|
|
133
|
+
- [charts] Test pointer events (#14042) @alexfauquette
|
|
134
|
+
- [charts] Use `isPointInside` function for both graphs and axis (#14222) @JCQuintas
|
|
135
|
+
|
|
136
|
+
#### `@mui/x-charts-pro@7.0.0-alpha.2` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
137
|
+
|
|
138
|
+
Same changes as in `@mui/x-charts@7.14.0`, plus:
|
|
139
|
+
|
|
140
|
+
- [charts-pro] Zoom axis filtering (#14121) @JCQuintas
|
|
141
|
+
|
|
142
|
+
### Docs
|
|
143
|
+
|
|
144
|
+
- [docs] Consistent use of UTC and timezones (#14250) @oliviertassinari
|
|
145
|
+
- [docs] Fix missing leading slashes in URLs (#14249) @oliviertassinari
|
|
146
|
+
- [docs] Dash usage revision on pickers pages (#14260) @arthurbalduini
|
|
147
|
+
|
|
148
|
+
### Core
|
|
149
|
+
|
|
150
|
+
- [core] Follow JSDocs convention @oliviertassinari
|
|
151
|
+
- [core] Prepare for material v6 (#14143) @LukasTy
|
|
152
|
+
- [code-infra] Set up `eslint-plugin-testing-library` (#14232) @LukasTy
|
|
153
|
+
- [infra] Updated mui-x roadmap links with new project URL (#14271) @michelengelen
|
|
154
|
+
|
|
6
155
|
## 7.13.0
|
|
7
156
|
|
|
8
157
|
_Aug 16, 2024_
|
|
@@ -58,7 +207,7 @@ Same changes as in `@mui/x-date-pickers@7.13.0`.
|
|
|
58
207
|
- [charts] Rename `CartesianContextProvider` to `CartesianProvider` (#14102) @JCQuintas
|
|
59
208
|
- [charts] Support axis with the same value for all data points (#14191) @alexfauquette
|
|
60
209
|
|
|
61
|
-
#### `@mui/x-
|
|
210
|
+
#### `@mui/x-charts-pro@7.0.0-alpha.1` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
62
211
|
|
|
63
212
|
Same changes as in `@mui/x-charts@7.13.0`.
|
|
64
213
|
|
|
@@ -132,7 +281,7 @@ Same changes as in `@mui/x-date-pickers@7.12.1`.
|
|
|
132
281
|
- [charts] Fix charts vendor publish config (#14073) @JCQuintas
|
|
133
282
|
- [charts] Move `plugins` to `PluginProvider` (#14056) @JCQuintas
|
|
134
283
|
|
|
135
|
-
#### `@mui/x-
|
|
284
|
+
#### `@mui/x-charts-pro@7.0.0-alpha.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
136
285
|
|
|
137
286
|
Same changes as in `@mui/x-charts@7.12.1`, plus:
|
|
138
287
|
|
|
@@ -4,7 +4,7 @@ const _excluded = ["api", "colDef", "id", "hasFocus", "isEditable", "field", "va
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import MenuList from '@mui/material/MenuList';
|
|
7
|
-
import {
|
|
7
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
8
8
|
import { unstable_useId as useId } from '@mui/utils';
|
|
9
9
|
import { gridClasses } from '../../constants/gridClasses';
|
|
10
10
|
import { GridMenu } from '../menu/GridMenu';
|
|
@@ -29,7 +29,7 @@ function GridActionsCell(props) {
|
|
|
29
29
|
const buttonRef = React.useRef(null);
|
|
30
30
|
const ignoreCallToFocus = React.useRef(false);
|
|
31
31
|
const touchRippleRefs = React.useRef({});
|
|
32
|
-
const
|
|
32
|
+
const isRtl = useRtl();
|
|
33
33
|
const menuId = useId();
|
|
34
34
|
const buttonId = useId();
|
|
35
35
|
const rootProps = useGridRootProps();
|
|
@@ -110,7 +110,7 @@ function GridActionsCell(props) {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
// for rtl mode we need to reverse the direction
|
|
113
|
-
const rtlMod =
|
|
113
|
+
const rtlMod = isRtl ? -1 : 1;
|
|
114
114
|
const indexMod = (direction === 'left' ? -1 : 1) * rtlMod;
|
|
115
115
|
|
|
116
116
|
// if the button that should receive focus is disabled go one more step
|
|
@@ -107,13 +107,12 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
107
107
|
const apiRef = useGridApiContext();
|
|
108
108
|
const rootProps = useGridRootProps();
|
|
109
109
|
const field = column.field;
|
|
110
|
-
const
|
|
110
|
+
const cellParams = useGridSelector(apiRef, () => {
|
|
111
111
|
// This is required because `.getCellParams` tries to get the `state.rows.tree` entry
|
|
112
112
|
// associated with `rowId`/`fieldId`, but this selector runs after the state has been
|
|
113
113
|
// updated, while `rowId`/`fieldId` reference an entry in the old state.
|
|
114
114
|
try {
|
|
115
|
-
const
|
|
116
|
-
const result = cellParams;
|
|
115
|
+
const result = apiRef.current.getCellParams(rowId, field);
|
|
117
116
|
result.api = apiRef.current;
|
|
118
117
|
return result;
|
|
119
118
|
} catch (e) {
|
|
@@ -132,9 +131,9 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
132
131
|
hasFocus,
|
|
133
132
|
isEditable = false,
|
|
134
133
|
value
|
|
135
|
-
} =
|
|
134
|
+
} = cellParams;
|
|
136
135
|
const canManageOwnFocus = column.type === 'actions' && column.getActions?.(apiRef.current.getRowParams(rowId)).some(action => !action.props.disabled);
|
|
137
|
-
const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ?
|
|
136
|
+
const tabIndex = (cellMode === 'view' || !isEditable) && !canManageOwnFocus ? cellParams.tabIndex : -1;
|
|
138
137
|
const {
|
|
139
138
|
classes: rootClasses,
|
|
140
139
|
getCellClassName
|
|
@@ -147,15 +146,15 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
147
146
|
}).filter(Boolean).join(' '));
|
|
148
147
|
const classNames = [pipesClassName];
|
|
149
148
|
if (column.cellClassName) {
|
|
150
|
-
classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(
|
|
149
|
+
classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(cellParams) : column.cellClassName);
|
|
151
150
|
}
|
|
152
151
|
if (column.display === 'flex') {
|
|
153
152
|
classNames.push(gridClasses['cell--flex']);
|
|
154
153
|
}
|
|
155
154
|
if (getCellClassName) {
|
|
156
|
-
classNames.push(getCellClassName(
|
|
155
|
+
classNames.push(getCellClassName(cellParams));
|
|
157
156
|
}
|
|
158
|
-
const valueToRender =
|
|
157
|
+
const valueToRender = cellParams.formattedValue ?? value;
|
|
159
158
|
const cellRef = React.useRef(null);
|
|
160
159
|
const handleRef = useForkRef(ref, cellRef);
|
|
161
160
|
const focusElementRef = React.useRef(null);
|
|
@@ -238,7 +237,7 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
238
237
|
}
|
|
239
238
|
}
|
|
240
239
|
}, [hasFocus, cellMode, apiRef]);
|
|
241
|
-
if (
|
|
240
|
+
if (cellParams === EMPTY_CELL_PARAMS) {
|
|
242
241
|
return null;
|
|
243
242
|
}
|
|
244
243
|
let handleFocus = other.onFocus;
|
|
@@ -260,15 +259,15 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
260
259
|
let children;
|
|
261
260
|
let title;
|
|
262
261
|
if (editCellState === null && column.renderCell) {
|
|
263
|
-
children = column.renderCell(
|
|
262
|
+
children = column.renderCell(cellParams);
|
|
264
263
|
}
|
|
265
264
|
if (editCellState !== null && column.renderEditCell) {
|
|
266
265
|
const updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
|
|
267
266
|
|
|
268
267
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
269
268
|
const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded2);
|
|
270
|
-
const formattedValue = column.valueFormatter ? column.valueFormatter(editCellState.value, updatedRow, column, apiRef) :
|
|
271
|
-
const params = _extends({},
|
|
269
|
+
const formattedValue = column.valueFormatter ? column.valueFormatter(editCellState.value, updatedRow, column, apiRef) : cellParams.formattedValue;
|
|
270
|
+
const params = _extends({}, cellParams, {
|
|
272
271
|
row: updatedRow,
|
|
273
272
|
formattedValue
|
|
274
273
|
}, editCellStateRest);
|
|
@@ -6,7 +6,6 @@ import * as React from 'react';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
8
8
|
import { GridCellEditStopReasons } from '../../models/params/gridEditCellParams';
|
|
9
|
-
import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
10
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
10
|
import { GridEditModes } from '../../models/gridEditRowModel';
|
|
12
11
|
import { getValueFromValueOptions, getValueOptions, isSingleSelectColDef } from '../panel/filterPanel/filterPanelUtils';
|
|
@@ -80,10 +79,10 @@ function GridEditSingleSelectCell(props) {
|
|
|
80
79
|
setOpen(false);
|
|
81
80
|
return;
|
|
82
81
|
}
|
|
83
|
-
if (reason === 'backdropClick' ||
|
|
82
|
+
if (reason === 'backdropClick' || event.key === 'Escape') {
|
|
84
83
|
const params = apiRef.current.getCellParams(id, field);
|
|
85
84
|
apiRef.current.publishEvent('cellEditStop', _extends({}, params, {
|
|
86
|
-
reason:
|
|
85
|
+
reason: event.key === 'Escape' ? GridCellEditStopReasons.escapeKeyDown : GridCellEditStopReasons.cellFocusOut
|
|
87
86
|
}));
|
|
88
87
|
}
|
|
89
88
|
};
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import MenuList from '@mui/material/MenuList';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
|
-
import { isHideMenuKey
|
|
9
|
+
import { isHideMenuKey } from '../../../utils/keyboardUtils';
|
|
10
10
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
const StyledMenuList = styled(MenuList)(() => ({
|
|
@@ -23,7 +23,7 @@ const GridColumnMenuContainer = /*#__PURE__*/React.forwardRef(function GridColum
|
|
|
23
23
|
} = props,
|
|
24
24
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
25
25
|
const handleListKeyDown = React.useCallback(event => {
|
|
26
|
-
if (
|
|
26
|
+
if (event.key === 'Tab') {
|
|
27
27
|
event.preventDefault();
|
|
28
28
|
}
|
|
29
29
|
if (isHideMenuKey(event.key)) {
|
|
@@ -16,7 +16,7 @@ export interface GridPanelProps extends Partial<React.ComponentProps<typeof Grid
|
|
|
16
16
|
open: boolean;
|
|
17
17
|
}
|
|
18
18
|
export declare const gridPanelClasses: Record<keyof GridPanelClasses, string>;
|
|
19
|
-
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Popper").PopperProps & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "ref" | "suppressHydrationWarning" | "className" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "component" | "sx" | "components" | "
|
|
19
|
+
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Popper").PopperProps & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "ref" | "suppressHydrationWarning" | "className" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "component" | "sx" | "components" | "componentsProps" | "placement" | "disablePortal" | "modifiers" | "anchorEl" | "keepMounted" | "popperOptions" | "popperRef" | "slotProps" | "slots"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
20
20
|
ownerState: OwnerState;
|
|
21
21
|
}, {}, {}>;
|
|
22
22
|
declare const GridPanel: React.ForwardRefExoticComponent<Omit<GridPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -10,7 +10,6 @@ import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
|
10
10
|
import Paper from '@mui/material/Paper';
|
|
11
11
|
import Popper from '@mui/material/Popper';
|
|
12
12
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
13
|
-
import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
14
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
15
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
15
|
export const gridPanelClasses = generateUtilityClasses('MuiDataGrid', ['panel', 'paper']);
|
|
@@ -51,7 +50,7 @@ const GridPanel = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
51
50
|
apiRef.current.hidePreferences();
|
|
52
51
|
}, [apiRef]);
|
|
53
52
|
const handleKeyDown = React.useCallback(event => {
|
|
54
|
-
if (
|
|
53
|
+
if (event.key === 'Escape') {
|
|
55
54
|
apiRef.current.hidePreferences();
|
|
56
55
|
}
|
|
57
56
|
}, [apiRef]);
|
|
@@ -281,10 +281,15 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
281
281
|
variant: "standard",
|
|
282
282
|
as: rootProps.slots.baseFormControl
|
|
283
283
|
}, baseFormControlProps, logicOperatorInputProps, {
|
|
284
|
-
sx:
|
|
285
|
-
display:
|
|
286
|
-
|
|
287
|
-
|
|
284
|
+
sx: [hasLogicOperatorColumn ? {
|
|
285
|
+
display: 'flex'
|
|
286
|
+
} : {
|
|
287
|
+
display: 'none'
|
|
288
|
+
}, showMultiFilterOperators ? {
|
|
289
|
+
visibility: 'visible'
|
|
290
|
+
} : {
|
|
291
|
+
visibility: 'hidden'
|
|
292
|
+
}, baseFormControlProps.sx, logicOperatorInputProps.sx],
|
|
288
293
|
className: clsx(classes.logicOperatorInput, baseFormControlProps.className, logicOperatorInputProps.className),
|
|
289
294
|
ownerState: rootProps,
|
|
290
295
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseSelect, _extends({
|
|
@@ -6,7 +6,7 @@ import MenuList from '@mui/material/MenuList';
|
|
|
6
6
|
import MenuItem from '@mui/material/MenuItem';
|
|
7
7
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
8
8
|
import { gridDensitySelector } from '../../hooks/features/density/densitySelector';
|
|
9
|
-
import { isHideMenuKey
|
|
9
|
+
import { isHideMenuKey } from '../../utils/keyboardUtils';
|
|
10
10
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
11
11
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
12
12
|
import { GridMenu } from '../menu/GridMenu';
|
|
@@ -62,7 +62,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
62
62
|
setOpen(false);
|
|
63
63
|
};
|
|
64
64
|
const handleListKeyDown = event => {
|
|
65
|
-
if (
|
|
65
|
+
if (event.key === 'Tab') {
|
|
66
66
|
event.preventDefault();
|
|
67
67
|
}
|
|
68
68
|
if (isHideMenuKey(event.key)) {
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { unstable_useId as useId, unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
5
5
|
import MenuList from '@mui/material/MenuList';
|
|
6
|
-
import { isHideMenuKey
|
|
6
|
+
import { isHideMenuKey } from '../../utils/keyboardUtils';
|
|
7
7
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
8
|
import { GridMenu } from '../menu/GridMenu';
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
@@ -29,7 +29,7 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
29
29
|
};
|
|
30
30
|
const handleMenuClose = () => setOpen(false);
|
|
31
31
|
const handleListKeyDown = event => {
|
|
32
|
-
if (
|
|
32
|
+
if (event.key === 'Tab') {
|
|
33
33
|
event.preventDefault();
|
|
34
34
|
}
|
|
35
35
|
if (isHideMenuKey(event.key)) {
|
|
@@ -105,9 +105,11 @@ function GridToolbarQuickFilter(props) {
|
|
|
105
105
|
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, _extends({
|
|
106
106
|
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterDeleteIconLabel'),
|
|
107
107
|
size: "small",
|
|
108
|
-
sx: {
|
|
109
|
-
visibility:
|
|
110
|
-
}
|
|
108
|
+
sx: [searchValue ? {
|
|
109
|
+
visibility: 'visible'
|
|
110
|
+
} : {
|
|
111
|
+
visibility: 'hidden'
|
|
112
|
+
}],
|
|
111
113
|
onClick: handleSearchReset
|
|
112
114
|
}, rootProps.slotProps?.baseIconButton, {
|
|
113
115
|
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterClearIcon, {
|
|
@@ -3,4 +3,4 @@ import { GridStateCommunity } from '../../models/gridStateCommunity';
|
|
|
3
3
|
* Get the theme state
|
|
4
4
|
* @category Core
|
|
5
5
|
*/
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const gridIsRtlSelector: (state: GridStateCommunity) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useGridRefs } from './useGridRefs';
|
|
2
|
-
import {
|
|
2
|
+
import { useGridIsRtl } from './useGridIsRtl';
|
|
3
3
|
import { useGridLoggerFactory } from './useGridLoggerFactory';
|
|
4
4
|
import { useGridApiInitialization } from './useGridApiInitialization';
|
|
5
5
|
import { useGridLocaleText } from './useGridLocaleText';
|
|
@@ -13,7 +13,7 @@ import { useGridStateInitialization } from './useGridStateInitialization';
|
|
|
13
13
|
export const useGridInitialization = (inputApiRef, props) => {
|
|
14
14
|
const privateApiRef = useGridApiInitialization(inputApiRef, props);
|
|
15
15
|
useGridRefs(privateApiRef);
|
|
16
|
-
|
|
16
|
+
useGridIsRtl(privateApiRef);
|
|
17
17
|
useGridLoggerFactory(privateApiRef, props);
|
|
18
18
|
useGridStateInitialization(privateApiRef);
|
|
19
19
|
useGridPipeProcessing(privateApiRef);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridPrivateApiCommon } from '../../models/api/gridApiCommon';
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const useGridIsRtl: (apiRef: React.MutableRefObject<GridPrivateApiCommon>) => void;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export const
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
apiRef.current.state.
|
|
3
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
4
|
+
export const useGridIsRtl = apiRef => {
|
|
5
|
+
const isRtl = useRtl();
|
|
6
|
+
if (apiRef.current.state.isRtl === undefined) {
|
|
7
|
+
apiRef.current.state.isRtl = isRtl;
|
|
8
8
|
}
|
|
9
9
|
const isFirstEffect = React.useRef(true);
|
|
10
10
|
React.useEffect(() => {
|
|
@@ -12,8 +12,8 @@ export const useGridTheme = apiRef => {
|
|
|
12
12
|
isFirstEffect.current = false;
|
|
13
13
|
} else {
|
|
14
14
|
apiRef.current.setState(state => _extends({}, state, {
|
|
15
|
-
|
|
15
|
+
isRtl
|
|
16
16
|
}));
|
|
17
17
|
}
|
|
18
|
-
}, [apiRef,
|
|
18
|
+
}, [apiRef, isRtl]);
|
|
19
19
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { styled
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
5
6
|
import { useGridSelector } from '../../utils';
|
|
6
7
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
7
8
|
import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
|
|
@@ -44,7 +45,7 @@ export const useGridColumnHeaders = props => {
|
|
|
44
45
|
const [dragCol, setDragCol] = React.useState('');
|
|
45
46
|
const [resizeCol, setResizeCol] = React.useState('');
|
|
46
47
|
const apiRef = useGridPrivateApiContext();
|
|
47
|
-
const
|
|
48
|
+
const isRtl = useRtl();
|
|
48
49
|
const rootProps = useGridRootProps();
|
|
49
50
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
50
51
|
const hasVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
|
|
@@ -53,7 +54,7 @@ export const useGridColumnHeaders = props => {
|
|
|
53
54
|
const renderContext = useGridSelector(apiRef, gridRenderContextColumnsSelector);
|
|
54
55
|
const pinnedColumns = useGridSelector(apiRef, gridVisiblePinnedColumnDefinitionsSelector);
|
|
55
56
|
const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
|
|
56
|
-
const offsetLeft = computeOffsetLeft(columnPositions, renderContext,
|
|
57
|
+
const offsetLeft = computeOffsetLeft(columnPositions, renderContext, isRtl, pinnedColumns.left.length);
|
|
57
58
|
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
58
59
|
React.useEffect(() => {
|
|
59
60
|
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_ownerDocument as ownerDocument, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
4
4
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
5
|
-
import {
|
|
5
|
+
import { useRtl } from '@mui/system/RtlProvider';
|
|
6
6
|
import { findGridCellElementsFromCol, findGridElement, findLeftPinnedCellsAfterCol, findRightPinnedCellsBeforeCol, getFieldFromHeaderElem, findHeaderElementFromField, getFieldsFromGroupHeaderElem, findGroupHeaderElementsFromField, findGridHeader, findGridCells, findParentElementFromClassName, findLeftPinnedHeadersAfterCol, findRightPinnedHeadersBeforeCol, escapeOperandAttributeSelector } from '../../../utils/domUtils';
|
|
7
7
|
import { DEFAULT_GRID_AUTOSIZE_OPTIONS } from './gridColumnResizeApi';
|
|
8
8
|
import { gridClasses } from '../../../constants/gridClasses';
|
|
@@ -52,9 +52,9 @@ function flipResizeDirection(side) {
|
|
|
52
52
|
}
|
|
53
53
|
return 'Right';
|
|
54
54
|
}
|
|
55
|
-
function getResizeDirection(separator,
|
|
55
|
+
function getResizeDirection(separator, isRtl) {
|
|
56
56
|
const side = separator.classList.contains(gridClasses['columnSeparator--sideRight']) ? 'Right' : 'Left';
|
|
57
|
-
if (
|
|
57
|
+
if (isRtl) {
|
|
58
58
|
// Resizing logic should be mirrored in the RTL case
|
|
59
59
|
return flipResizeDirection(side);
|
|
60
60
|
}
|
|
@@ -177,7 +177,7 @@ function createResizeRefs() {
|
|
|
177
177
|
* TODO: improve experience for last column
|
|
178
178
|
*/
|
|
179
179
|
export const useGridColumnResize = (apiRef, props) => {
|
|
180
|
-
const
|
|
180
|
+
const isRtl = useRtl();
|
|
181
181
|
const logger = useGridLogger(apiRef, 'useGridColumnResize');
|
|
182
182
|
const refs = useLazyRef(createResizeRefs).current;
|
|
183
183
|
|
|
@@ -317,7 +317,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
317
317
|
refs.rightPinnedCellsBefore = pinnedPosition !== GridPinnedColumnPosition.RIGHT ? [] : findRightPinnedCellsBeforeCol(apiRef.current, refs.columnHeaderElement);
|
|
318
318
|
refs.leftPinnedHeadersAfter = pinnedPosition !== GridPinnedColumnPosition.LEFT ? [] : findLeftPinnedHeadersAfterCol(apiRef.current, refs.columnHeaderElement);
|
|
319
319
|
refs.rightPinnedHeadersBefore = pinnedPosition !== GridPinnedColumnPosition.RIGHT ? [] : findRightPinnedHeadersBeforeCol(apiRef.current, refs.columnHeaderElement);
|
|
320
|
-
resizeDirection.current = getResizeDirection(separator,
|
|
320
|
+
resizeDirection.current = getResizeDirection(separator, isRtl);
|
|
321
321
|
initialOffsetToSeparator.current = computeOffsetToSeparator(xStart, refs.columnHeaderElement.getBoundingClientRect(), resizeDirection.current);
|
|
322
322
|
};
|
|
323
323
|
const handleResizeMouseUp = useEventCallback(finishResize);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSelector, createSelectorMemoized } from '../../../utils/createSelector';
|
|
2
2
|
import { EMPTY_PINNED_COLUMN_FIELDS } from './gridColumnsInterfaces';
|
|
3
|
-
import {
|
|
3
|
+
import { gridIsRtlSelector } from '../../core/gridCoreSelector';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Get the columns state
|
|
@@ -55,8 +55,8 @@ export const gridPinnedColumnsSelector = state => state.pinnedColumns;
|
|
|
55
55
|
* Get the visible pinned columns.
|
|
56
56
|
* @category Visible Columns
|
|
57
57
|
*/
|
|
58
|
-
export const gridVisiblePinnedColumnDefinitionsSelector = createSelectorMemoized(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector,
|
|
59
|
-
const visiblePinnedFields = filterVisibleColumns(model, visibleColumnFields,
|
|
58
|
+
export const gridVisiblePinnedColumnDefinitionsSelector = createSelectorMemoized(gridColumnsStateSelector, gridPinnedColumnsSelector, gridVisibleColumnFieldsSelector, gridIsRtlSelector, (columnsState, model, visibleColumnFields, isRtl) => {
|
|
59
|
+
const visiblePinnedFields = filterVisibleColumns(model, visibleColumnFields, isRtl);
|
|
60
60
|
const visiblePinnedColumns = {
|
|
61
61
|
left: visiblePinnedFields.left.map(field => columnsState.lookup[field]),
|
|
62
62
|
right: visiblePinnedFields.right.map(field => columnsState.lookup[field])
|