@mui/x-data-grid 9.12.0 → 9.13.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 +152 -0
- package/DataGrid/DataGrid.js +1 -1
- package/DataGrid/DataGrid.mjs +1 -1
- package/components/GridPagination.js +1 -1
- package/components/GridPagination.mjs +1 -1
- package/components/GridRow.d.mts +1 -0
- package/components/GridRow.d.ts +1 -0
- package/components/GridRow.js +41 -6
- package/components/GridRow.mjs +41 -6
- package/components/cell/GridCell.js +7 -4
- package/components/cell/GridCell.mjs +7 -4
- package/components/cell/GridEditBooleanCell.d.mts +1 -1
- package/components/cell/GridEditBooleanCell.d.ts +1 -1
- package/components/cell/GridEditBooleanCell.js +4 -4
- package/components/cell/GridEditBooleanCell.mjs +4 -4
- package/components/cell/GridEditDateCell.d.mts +1 -1
- package/components/cell/GridEditDateCell.d.ts +1 -1
- package/components/cell/GridEditDateCell.js +5 -5
- package/components/cell/GridEditDateCell.mjs +5 -5
- package/components/cell/GridEditInputCell.d.mts +1 -1
- package/components/cell/GridEditInputCell.d.ts +1 -1
- package/components/cell/GridEditInputCell.js +1 -1
- package/components/cell/GridEditInputCell.mjs +1 -1
- package/components/cell/GridEditLongTextCell.d.mts +1 -1
- package/components/cell/GridEditLongTextCell.d.ts +1 -1
- package/components/cell/GridEditLongTextCell.js +2 -2
- package/components/cell/GridEditLongTextCell.mjs +2 -2
- package/components/cell/GridEditSingleSelectCell.d.mts +1 -1
- package/components/cell/GridEditSingleSelectCell.d.ts +1 -1
- package/components/cell/GridEditSingleSelectCell.js +4 -4
- package/components/cell/GridEditSingleSelectCell.mjs +4 -4
- package/components/toolbarV8/Toolbar.d.mts +5 -1
- package/components/toolbarV8/Toolbar.d.ts +5 -1
- package/components/toolbarV8/Toolbar.js +34 -12
- package/components/toolbarV8/Toolbar.mjs +33 -11
- package/hooks/core/useGridVirtualizer.js +14 -1
- package/hooks/core/useGridVirtualizer.mjs +14 -1
- package/hooks/features/dataSource/models.d.mts +2 -2
- package/hooks/features/dataSource/models.d.ts +2 -2
- package/hooks/features/dataSource/useGridDataSourceBase.js +11 -7
- package/hooks/features/dataSource/useGridDataSourceBase.mjs +12 -8
- package/hooks/features/pivoting/gridPivotingInterfaces.d.mts +2 -2
- package/hooks/features/pivoting/gridPivotingInterfaces.d.ts +2 -2
- package/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.mjs +2 -2
- package/hooks/features/rows/gridRowsUtils.d.mts +37 -3
- package/hooks/features/rows/gridRowsUtils.d.ts +37 -3
- package/hooks/features/rows/gridRowsUtils.js +120 -23
- package/hooks/features/rows/gridRowsUtils.mjs +115 -22
- package/hooks/features/rows/useGridRows.js +10 -1
- package/hooks/features/rows/useGridRows.mjs +10 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/index.d.mts +2 -2
- package/internals/index.d.ts +2 -2
- package/internals/index.js +28 -0
- package/internals/index.mjs +2 -2
- package/material/variables.d.mts +6 -1
- package/material/variables.d.ts +6 -1
- package/material/variables.js +17 -3
- package/material/variables.mjs +14 -4
- package/models/api/gridRowApi.d.mts +7 -7
- package/models/api/gridRowApi.d.ts +7 -7
- package/models/gridDataSource.d.mts +3 -0
- package/models/gridDataSource.d.ts +3 -0
- package/models/gridRows.d.mts +28 -1
- package/models/gridRows.d.ts +28 -1
- package/models/props/DataGridProps.d.mts +3 -3
- package/models/props/DataGridProps.d.ts +3 -3
- package/package.json +6 -6
- package/utils/keyboardUtils.d.mts +1 -0
- package/utils/keyboardUtils.d.ts +1 -0
- package/utils/keyboardUtils.js +6 -0
- package/utils/keyboardUtils.mjs +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,157 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 9.13.0
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v9.12.0..master -->
|
|
6
|
+
|
|
7
|
+
_Sep 4, 2026_
|
|
8
|
+
|
|
9
|
+
We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
10
|
+
|
|
11
|
+
- 🦮 Improve keyboard navigation features of the Charts.
|
|
12
|
+
- 🎨 Improved customization of the edit event dialog in the `EventCalendar`
|
|
13
|
+
- 🐞 Bugfixes
|
|
14
|
+
- 📚 Documentation improvements
|
|
15
|
+
|
|
16
|
+
Special thanks go out to these community members for their valuable contributions:
|
|
17
|
+
@Anexus5919, @jvskriubakken, @mustafajw07, @roychan1
|
|
18
|
+
|
|
19
|
+
The following team members contributed to this release:
|
|
20
|
+
@brijeshb42, @flaviendelangle, @hasdfa, @Janpot, @JCQuintas, @LukasTy, @michelengelen, @noraleonte, @rita-codes, @silviuaavram
|
|
21
|
+
|
|
22
|
+
### Data Grid
|
|
23
|
+
|
|
24
|
+
#### `@mui/x-data-grid@9.13.0`
|
|
25
|
+
|
|
26
|
+
- [DataGrid] Call `onValueChange` after `setEditCellValue` in edit cells (#23417) @michelengelen
|
|
27
|
+
- [DataGrid] Add support for replacing rows instead of merging updates (#23323) @jvskriubakken
|
|
28
|
+
- [DataGrid] Always render `rowHeader` in virtualized setups (#23386) @silviuaavram
|
|
29
|
+
- [DataGrid] Export `ToolbarRoot` (#23322) @JCQuintas
|
|
30
|
+
- [DataGrid] Fix `rowsPerPage` selector appearing when `autoPageSize` is enabled and `pageSize` is one of `pageSizeOptions` (#23401) @roychan1
|
|
31
|
+
- [DataGrid] Fix row tree reset when a data source grid becomes visible (#23288) @JCQuintas
|
|
32
|
+
|
|
33
|
+
#### `@mui/x-data-grid-pro@9.13.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
34
|
+
|
|
35
|
+
Same changes as in `@mui/x-data-grid@9.13.0`, plus:
|
|
36
|
+
|
|
37
|
+
- [DataGridPro] Remove rows deleted server-side on nested lazy loading revalidation (#23320) @JCQuintas
|
|
38
|
+
- [DataGridPro] Stop `disableDebounce` from reaching the DOM in multi select filter (#23445) @JCQuintas
|
|
39
|
+
|
|
40
|
+
#### `@mui/x-data-grid-premium@9.13.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
41
|
+
|
|
42
|
+
Same changes as in `@mui/x-data-grid-pro@9.13.0`, plus:
|
|
43
|
+
|
|
44
|
+
- [DataGridPremium] Refine cell selection and speed up clipboard copy (#23473) @michelengelen
|
|
45
|
+
- [DataGridPremium] Select all cells with Ctrl+A (#23415) @michelengelen
|
|
46
|
+
|
|
47
|
+
### Date and Time Pickers
|
|
48
|
+
|
|
49
|
+
#### `@mui/x-date-pickers@9.13.0`
|
|
50
|
+
|
|
51
|
+
Internal changes.
|
|
52
|
+
|
|
53
|
+
#### `@mui/x-date-pickers-pro@9.13.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
54
|
+
|
|
55
|
+
Same changes as in `@mui/x-date-pickers@9.13.0`.
|
|
56
|
+
|
|
57
|
+
### Charts
|
|
58
|
+
|
|
59
|
+
#### `@mui/x-charts@9.13.0`
|
|
60
|
+
|
|
61
|
+
- [charts] Activate the focused axis with Enter/Space (#23219) @JCQuintas
|
|
62
|
+
- [charts] Add keyboard zoom and pan (#23369) @JCQuintas
|
|
63
|
+
- [charts] Fix line mark position under browser zoom in Safari (#23387) @noraleonte
|
|
64
|
+
- [charts] Fix y axis tick labels shortened near the top of the chart (#23435) @JCQuintas
|
|
65
|
+
- [charts] Focus the clicked item on radar charts (#23287) @JCQuintas
|
|
66
|
+
- [charts] Stop text measurements leaking into each other (#23430) @JCQuintas
|
|
67
|
+
|
|
68
|
+
#### `@mui/x-charts-pro@9.13.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
69
|
+
|
|
70
|
+
Same changes as in `@mui/x-charts@9.13.0`.
|
|
71
|
+
|
|
72
|
+
#### `@mui/x-charts-premium@9.13.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
73
|
+
|
|
74
|
+
Same changes as in `@mui/x-charts-pro@9.13.0`.
|
|
75
|
+
|
|
76
|
+
### Tree View
|
|
77
|
+
|
|
78
|
+
#### `@mui/x-tree-view@9.13.0`
|
|
79
|
+
|
|
80
|
+
- [tree view] Add `loading` prop and customizable loading UI (#22251) @michelengelen
|
|
81
|
+
- [tree view] Reduce selector bundle size (#23412) @flaviendelangle
|
|
82
|
+
- [tree view] Remove dead UI from community component (#23487) @noraleonte
|
|
83
|
+
- [tree view] Remove unused dependencies (#23488) @noraleonte
|
|
84
|
+
- [tree view] Use `useId` for the default tree id (#23341) @Anexus5919
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-tree-view-pro@9.13.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
87
|
+
|
|
88
|
+
Same changes as in `@mui/x-tree-view@9.13.0`.
|
|
89
|
+
|
|
90
|
+
### Scheduler
|
|
91
|
+
|
|
92
|
+
#### `@mui/x-scheduler@9.0.0-beta.11`
|
|
93
|
+
|
|
94
|
+
- [scheduler] Absorb un-acted `ResizeObserver` deliveries after rendering the timeline (#23444) @rita-codes
|
|
95
|
+
- [scheduler] Add `EventContextMenu` with Edit and Delete actions (#23379) @mustafajw07
|
|
96
|
+
- [scheduler] Add aria-hidden to collapsed side panel and refactor landmark structure (#23425) @mustafajw07
|
|
97
|
+
- [scheduler] Add the `eventDialogGeneralTab` slot (#23338) @rita-codes
|
|
98
|
+
- [scheduler] Fix the un-awaited act warning in the event dialog slot test (#23446) @JCQuintas
|
|
99
|
+
- [scheduler] Improve timeline event layout performance (#23364) @flaviendelangle
|
|
100
|
+
- [scheduler] Keep `aria-expanded` present when ViewSwitcher and PreferencesMenu menus are closed (#23427) @mustafajw07
|
|
101
|
+
- [scheduler] Make the event dialog General-tab building blocks public (#23398) @rita-codes
|
|
102
|
+
- [scheduler] Migrate to the pragmatic-drag-and-drop v3 entry points (#23442) @rita-codes
|
|
103
|
+
- [scheduler] Reduce selector bundle size (#23413) @flaviendelangle
|
|
104
|
+
- [scheduler] Reuse processed events between updates (#23363) @flaviendelangle
|
|
105
|
+
- [scheduler] Add `aria-expanded` and `aria-controls` to side panel toggle button (#23402) @mustafajw07
|
|
106
|
+
|
|
107
|
+
#### `@mui/x-scheduler-premium@9.0.0-beta.11` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
108
|
+
|
|
109
|
+
Same changes as in `@mui/x-scheduler@9.0.0-beta.11`, plus:
|
|
110
|
+
|
|
111
|
+
- [scheduler-premium] Dependencies - Keep event drags working over the arrow hit-areas (#23441) @rita-codes
|
|
112
|
+
- [scheduler-premium] Dependencies - Reject dependencies that would create a cycle (#23389) @rita-codes
|
|
113
|
+
- [scheduler-premium] Key recurring `exDates` on their data-timezone day (#23467) @rita-codes
|
|
114
|
+
|
|
115
|
+
### Codemod
|
|
116
|
+
|
|
117
|
+
#### `@mui/x-codemod@9.13.0`
|
|
118
|
+
|
|
119
|
+
Internal changes.
|
|
120
|
+
|
|
121
|
+
### Docs
|
|
122
|
+
|
|
123
|
+
- [docs] Add synchronized tooltip and crosshair demo to charts (#23368) @JCQuintas
|
|
124
|
+
- [docs] Add sticky headers recipe to `RichTreeView` customization (#22908) @michelengelen
|
|
125
|
+
- [docs] Pin the visible date of the scheduler preferences demos (#23432) @rita-codes
|
|
126
|
+
- [docs] Star-prefix bare :where() dark-mode selectors (#23419) @Janpot
|
|
127
|
+
- [docs] Consolidate demo data into shared dataset files (#23496) @michelengelen
|
|
128
|
+
|
|
129
|
+
### Core
|
|
130
|
+
|
|
131
|
+
- [code-infra] Consume shared commands from code-infra orb (#23485) @brijeshb42
|
|
132
|
+
- [code-infra] Move the shared spy helpers off Sinon (#23466) @JCQuintas
|
|
133
|
+
- [code-infra] Point the support validator link at frontend-public (#23422) @Janpot
|
|
134
|
+
- [code-infra] Reduce per-page memory in the browser test suite (#23424) @Janpot
|
|
135
|
+
- [code-infra] Remove Sinon (#23476) @JCQuintas
|
|
136
|
+
- [code-infra] Remove the explicit `styled-components` dependency (#23479) @LukasTy
|
|
137
|
+
- [code-infra] Replace the mechanical sinon `spy()` usages with `vi.fn()` (#23443) @JCQuintas
|
|
138
|
+
- [code-infra] Replace the sinon `spy(fn)` usages with `vi.fn(fn)` (#23460) @JCQuintas
|
|
139
|
+
- [code-infra] Replace the sinon spy types with the Vitest ones (#23464) @JCQuintas
|
|
140
|
+
- [code-infra] Replace the sinon spy-on-object calls with `vi.spyOn` (#23474) @JCQuintas
|
|
141
|
+
- [code-infra] Replace the sinon stubs with Vitest mocks (#23472) @JCQuintas
|
|
142
|
+
- [code-infra] Run TypeScript 7 alongside the TS6 JS API (#23471) @brijeshb42
|
|
143
|
+
- [code-infra] Trim the shared browser test setup graph (#23426) @LukasTy
|
|
144
|
+
- [code-infra] Update CircleCI orb (#23418) @JCQuintas
|
|
145
|
+
- [code-infra] Use explicit vitest imports in test files (#23375) @michelengelen
|
|
146
|
+
|
|
147
|
+
### Miscellaneous
|
|
148
|
+
|
|
149
|
+
- [chat] Enforce top-level type imports (#23037) @Janpot
|
|
150
|
+
- [chat] Fix global preload error from the `remend` import (#23263) @hasdfa
|
|
151
|
+
- [ci] Add Claude PR review via mui-public reusable workflow (#23423) @Janpot
|
|
152
|
+
- [telemetry] Fix get-context test leaking mock from sender test (#23447) @JCQuintas
|
|
153
|
+
- [test] Fail the regression run when a webfont does not load (#23376) @LukasTy
|
|
154
|
+
|
|
3
155
|
## 9.12.0
|
|
4
156
|
|
|
5
157
|
_Aug 21, 2026_
|
package/DataGrid/DataGrid.js
CHANGED
|
@@ -777,7 +777,7 @@ process.env.NODE_ENV !== "production" ? DataGridRaw.propTypes /* remove-proptype
|
|
|
777
777
|
* @param {R} newRow Row object with the new values.
|
|
778
778
|
* @param {R} oldRow Row object with the old values.
|
|
779
779
|
* @param {{ rowId: GridRowId }} params Additional parameters.
|
|
780
|
-
* @returns {Promise<R
|
|
780
|
+
* @returns {Promise<R | GridRowModelReplace<R>> | R | GridRowModelReplace<R>} The final values to update the row, or a `{ _action: 'replace', row }` update to store `row` as the new row without merging.
|
|
781
781
|
*/
|
|
782
782
|
processRowUpdate: _propTypes.default.func,
|
|
783
783
|
/**
|
package/DataGrid/DataGrid.mjs
CHANGED
|
@@ -770,7 +770,7 @@ process.env.NODE_ENV !== "production" ? DataGridRaw.propTypes /* remove-proptype
|
|
|
770
770
|
* @param {R} newRow Row object with the new values.
|
|
771
771
|
* @param {R} oldRow Row object with the old values.
|
|
772
772
|
* @param {{ rowId: GridRowId }} params Additional parameters.
|
|
773
|
-
* @returns {Promise<R
|
|
773
|
+
* @returns {Promise<R | GridRowModelReplace<R>> | R | GridRowModelReplace<R>} The final values to update the row, or a `{ _action: 'replace', row }` update to store `row` as the new row without merging.
|
|
774
774
|
*/
|
|
775
775
|
processRowUpdate: PropTypes.func,
|
|
776
776
|
/**
|
|
@@ -71,7 +71,7 @@ function GridPagination() {
|
|
|
71
71
|
warnedOnceMissingInPageSizeOptions.current = true;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
const pageSizeOptions = isPageSizeIncludedInPageSizeOptions(paginationModel.pageSize) ? rootProps.pageSizeOptions : [];
|
|
74
|
+
const pageSizeOptions = !rootProps.autoPageSize && isPageSizeIncludedInPageSizeOptions(paginationModel.pageSize) ? rootProps.pageSizeOptions : [];
|
|
75
75
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPaginationRoot, (0, _extends2.default)({
|
|
76
76
|
as: rootProps.slots.basePagination,
|
|
77
77
|
count: rowCount ?? -1,
|
|
@@ -64,7 +64,7 @@ function GridPagination() {
|
|
|
64
64
|
warnedOnceMissingInPageSizeOptions.current = true;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
const pageSizeOptions = isPageSizeIncludedInPageSizeOptions(paginationModel.pageSize) ? rootProps.pageSizeOptions : [];
|
|
67
|
+
const pageSizeOptions = !rootProps.autoPageSize && isPageSizeIncludedInPageSizeOptions(paginationModel.pageSize) ? rootProps.pageSizeOptions : [];
|
|
68
68
|
return /*#__PURE__*/_jsx(GridPaginationRoot, _extends({
|
|
69
69
|
as: rootProps.slots.basePagination,
|
|
70
70
|
count: rowCount ?? -1,
|
package/components/GridRow.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ export interface GridRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
16
16
|
columnsTotalWidth: number;
|
|
17
17
|
firstColumnIndex: number;
|
|
18
18
|
lastColumnIndex: number;
|
|
19
|
+
retainedColumnIndexes: number[];
|
|
19
20
|
visibleColumns: GridStateColDef[];
|
|
20
21
|
pinnedColumns: GridPinnedColumns;
|
|
21
22
|
/**
|
package/components/GridRow.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface GridRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
16
16
|
columnsTotalWidth: number;
|
|
17
17
|
firstColumnIndex: number;
|
|
18
18
|
lastColumnIndex: number;
|
|
19
|
+
retainedColumnIndexes: number[];
|
|
19
20
|
visibleColumns: GridStateColDef[];
|
|
20
21
|
pinnedColumns: GridPinnedColumns;
|
|
21
22
|
/**
|
package/components/GridRow.js
CHANGED
|
@@ -39,7 +39,7 @@ var _useGridConfiguration = require("../hooks/utils/useGridConfiguration");
|
|
|
39
39
|
var _useGridPrivateApiContext = require("../hooks/utils/useGridPrivateApiContext");
|
|
40
40
|
var _createSelector = require("../utils/createSelector");
|
|
41
41
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
42
|
-
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetLeft", "columnsTotalWidth", "firstColumnIndex", "lastColumnIndex", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "scrollbarWidth", "gridHasFiller", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
42
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetLeft", "columnsTotalWidth", "firstColumnIndex", "lastColumnIndex", "retainedColumnIndexes", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "scrollbarWidth", "gridHasFiller", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
43
43
|
const isRowReorderingEnabledSelector = (0, _createSelector.createSelector)(_gridEditingSelectors.gridEditRowsStateSelector, (editRows, {
|
|
44
44
|
rowReordering,
|
|
45
45
|
treeData
|
|
@@ -65,6 +65,7 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
65
65
|
columnsTotalWidth,
|
|
66
66
|
firstColumnIndex,
|
|
67
67
|
lastColumnIndex,
|
|
68
|
+
retainedColumnIndexes,
|
|
68
69
|
focusedColumnIndex,
|
|
69
70
|
isFirstVisible,
|
|
70
71
|
isLastVisible,
|
|
@@ -231,7 +232,16 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
231
232
|
const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
|
|
232
233
|
const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
|
|
233
234
|
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
|
|
235
|
+
|
|
236
|
+
// Virtual cells stay mounted for focus and accessibility relationships, but GridCell collapses
|
|
237
|
+
// them to zero size so they do not participate in the visible row layout.
|
|
238
|
+
const cellIsNotVisible = pinnedPosition === _constants.PinnedColumnPosition.VIRTUAL;
|
|
234
239
|
if (rowNode.type === 'skeletonRow') {
|
|
240
|
+
// Skeleton cells have no value to expose and don't support the collapsed style, so a virtual
|
|
241
|
+
// one would only add a full-width placeholder that shifts the rest of the row.
|
|
242
|
+
if (cellIsNotVisible) {
|
|
243
|
+
return null;
|
|
244
|
+
}
|
|
235
245
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.skeletonCell, {
|
|
236
246
|
type: column.type,
|
|
237
247
|
width: width,
|
|
@@ -254,7 +264,6 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
254
264
|
const canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
255
265
|
const canReorderRow = isRowReorderingEnabled && !sortModel.length;
|
|
256
266
|
const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow || isRowDragActive);
|
|
257
|
-
const cellIsNotVisible = pinnedPosition === _constants.PinnedColumnPosition.VIRTUAL;
|
|
258
267
|
const showLeftBorder = (0, _cellBorderUtils.shouldCellShowLeftBorder)(pinnedPosition, indexInSection, rootProps.showCellVerticalBorder, rootProps.pinnedColumnsSectionSeparator);
|
|
259
268
|
const showRightBorder = (0, _cellBorderUtils.shouldCellShowRightBorder)(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller, rootProps.pinnedColumnsSectionSeparator);
|
|
260
269
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(slots.cell, (0, _extends2.default)({
|
|
@@ -284,9 +293,27 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
284
293
|
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.right.length, _constants.PinnedColumnPosition.RIGHT);
|
|
285
294
|
});
|
|
286
295
|
const middleColumnsLength = visibleColumns.length - pinnedColumns.left.length - pinnedColumns.right.length;
|
|
296
|
+
|
|
297
|
+
// Build the middle section in visual column order:
|
|
298
|
+
// 1. retained or focused virtual cells before the render context;
|
|
299
|
+
// 2. the cells inside the render context;
|
|
300
|
+
// 3. retained or focused virtual cells after the render context.
|
|
287
301
|
const cells = [];
|
|
288
|
-
|
|
289
|
-
|
|
302
|
+
const firstUnpinnedColumnIndex = pinnedColumns.left.length;
|
|
303
|
+
const lastUnpinnedColumnIndex = visibleColumns.length - pinnedColumns.right.length;
|
|
304
|
+
|
|
305
|
+
// Select retained columns before the render context. The unpinned bounds exclude retained
|
|
306
|
+
// columns already rendered by `leftCells` or `rightCells`.
|
|
307
|
+
const virtualColumnIndexesLeft = retainedColumnIndexes.filter(columnIndex => columnIndex >= firstUnpinnedColumnIndex && columnIndex < firstColumnIndex);
|
|
308
|
+
|
|
309
|
+
// The grid already retains a focused cell outside the render context. Add it to the same ordered
|
|
310
|
+
// list, unless the column is a retained row header and is therefore already present.
|
|
311
|
+
if (hasVirtualFocusCellLeft && !virtualColumnIndexesLeft.includes(focusedColumnIndex)) {
|
|
312
|
+
virtualColumnIndexesLeft.push(focusedColumnIndex);
|
|
313
|
+
virtualColumnIndexesLeft.sort((a, b) => a - b);
|
|
314
|
+
}
|
|
315
|
+
for (const columnIndex of virtualColumnIndexesLeft) {
|
|
316
|
+
cells.push(getCell(visibleColumns[columnIndex], columnIndex - pinnedColumns.left.length, columnIndex, middleColumnsLength, _constants.PinnedColumnPosition.VIRTUAL));
|
|
290
317
|
}
|
|
291
318
|
for (let i = firstColumnIndex; i < lastColumnIndex; i += 1) {
|
|
292
319
|
const column = visibleColumns[i];
|
|
@@ -296,8 +323,15 @@ const GridRow = (0, _forwardRef.forwardRef)(function GridRow(props, refProp) {
|
|
|
296
323
|
}
|
|
297
324
|
cells.push(getCell(column, indexInSection, i, middleColumnsLength));
|
|
298
325
|
}
|
|
299
|
-
|
|
300
|
-
|
|
326
|
+
|
|
327
|
+
// Repeat the retention step for unpinned columns after the render context.
|
|
328
|
+
const virtualColumnIndexesRight = retainedColumnIndexes.filter(columnIndex => columnIndex >= lastColumnIndex && columnIndex < lastUnpinnedColumnIndex);
|
|
329
|
+
if (hasVirtualFocusCellRight && !virtualColumnIndexesRight.includes(focusedColumnIndex)) {
|
|
330
|
+
virtualColumnIndexesRight.push(focusedColumnIndex);
|
|
331
|
+
virtualColumnIndexesRight.sort((a, b) => a - b);
|
|
332
|
+
}
|
|
333
|
+
for (const columnIndex of virtualColumnIndexesRight) {
|
|
334
|
+
cells.push(getCell(visibleColumns[columnIndex], columnIndex - pinnedColumns.left.length, columnIndex, middleColumnsLength, _constants.PinnedColumnPosition.VIRTUAL));
|
|
301
335
|
}
|
|
302
336
|
const eventHandlers = row ? {
|
|
303
337
|
onClick: publishClick,
|
|
@@ -358,6 +392,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes /* remove-proptypes */
|
|
|
358
392
|
onMouseEnter: _propTypes.default.func,
|
|
359
393
|
onMouseLeave: _propTypes.default.func,
|
|
360
394
|
pinnedColumns: _propTypes.default.object.isRequired,
|
|
395
|
+
retainedColumnIndexes: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
|
|
361
396
|
row: _propTypes.default.object.isRequired,
|
|
362
397
|
rowHeight: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]).isRequired,
|
|
363
398
|
rowId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
package/components/GridRow.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetLeft", "columnsTotalWidth", "firstColumnIndex", "lastColumnIndex", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "scrollbarWidth", "gridHasFiller", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
5
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetLeft", "columnsTotalWidth", "firstColumnIndex", "lastColumnIndex", "retainedColumnIndexes", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "scrollbarWidth", "gridHasFiller", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -58,6 +58,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
58
58
|
columnsTotalWidth,
|
|
59
59
|
firstColumnIndex,
|
|
60
60
|
lastColumnIndex,
|
|
61
|
+
retainedColumnIndexes,
|
|
61
62
|
focusedColumnIndex,
|
|
62
63
|
isFirstVisible,
|
|
63
64
|
isLastVisible,
|
|
@@ -224,7 +225,16 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
224
225
|
const width = cellColSpanInfo?.cellProps.width ?? column.computedWidth;
|
|
225
226
|
const colSpan = cellColSpanInfo?.cellProps.colSpan ?? 1;
|
|
226
227
|
const pinnedOffset = getPinnedCellOffset(pinnedPosition, column.computedWidth, indexRelativeToAllColumns, columnPositions, columnsTotalWidth, scrollbarWidth);
|
|
228
|
+
|
|
229
|
+
// Virtual cells stay mounted for focus and accessibility relationships, but GridCell collapses
|
|
230
|
+
// them to zero size so they do not participate in the visible row layout.
|
|
231
|
+
const cellIsNotVisible = pinnedPosition === PinnedColumnPosition.VIRTUAL;
|
|
227
232
|
if (rowNode.type === 'skeletonRow') {
|
|
233
|
+
// Skeleton cells have no value to expose and don't support the collapsed style, so a virtual
|
|
234
|
+
// one would only add a full-width placeholder that shifts the rest of the row.
|
|
235
|
+
if (cellIsNotVisible) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
228
238
|
return /*#__PURE__*/_jsx(slots.skeletonCell, {
|
|
229
239
|
type: column.type,
|
|
230
240
|
width: width,
|
|
@@ -247,7 +257,6 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
247
257
|
const canReorderColumn = !(disableColumnReorder || column.disableReorder);
|
|
248
258
|
const canReorderRow = isRowReorderingEnabled && !sortModel.length;
|
|
249
259
|
const disableDragEvents = !(canReorderColumn || isReorderCell && canReorderRow || isRowDragActive);
|
|
250
|
-
const cellIsNotVisible = pinnedPosition === PinnedColumnPosition.VIRTUAL;
|
|
251
260
|
const showLeftBorder = shouldCellShowLeftBorder(pinnedPosition, indexInSection, rootProps.showCellVerticalBorder, rootProps.pinnedColumnsSectionSeparator);
|
|
252
261
|
const showRightBorder = shouldCellShowRightBorder(pinnedPosition, indexInSection, sectionLength, rootProps.showCellVerticalBorder, gridHasFiller, rootProps.pinnedColumnsSectionSeparator);
|
|
253
262
|
return /*#__PURE__*/_jsx(slots.cell, _extends({
|
|
@@ -277,9 +286,27 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
277
286
|
return getCell(column, i, indexRelativeToAllColumns, pinnedColumns.right.length, PinnedColumnPosition.RIGHT);
|
|
278
287
|
});
|
|
279
288
|
const middleColumnsLength = visibleColumns.length - pinnedColumns.left.length - pinnedColumns.right.length;
|
|
289
|
+
|
|
290
|
+
// Build the middle section in visual column order:
|
|
291
|
+
// 1. retained or focused virtual cells before the render context;
|
|
292
|
+
// 2. the cells inside the render context;
|
|
293
|
+
// 3. retained or focused virtual cells after the render context.
|
|
280
294
|
const cells = [];
|
|
281
|
-
|
|
282
|
-
|
|
295
|
+
const firstUnpinnedColumnIndex = pinnedColumns.left.length;
|
|
296
|
+
const lastUnpinnedColumnIndex = visibleColumns.length - pinnedColumns.right.length;
|
|
297
|
+
|
|
298
|
+
// Select retained columns before the render context. The unpinned bounds exclude retained
|
|
299
|
+
// columns already rendered by `leftCells` or `rightCells`.
|
|
300
|
+
const virtualColumnIndexesLeft = retainedColumnIndexes.filter(columnIndex => columnIndex >= firstUnpinnedColumnIndex && columnIndex < firstColumnIndex);
|
|
301
|
+
|
|
302
|
+
// The grid already retains a focused cell outside the render context. Add it to the same ordered
|
|
303
|
+
// list, unless the column is a retained row header and is therefore already present.
|
|
304
|
+
if (hasVirtualFocusCellLeft && !virtualColumnIndexesLeft.includes(focusedColumnIndex)) {
|
|
305
|
+
virtualColumnIndexesLeft.push(focusedColumnIndex);
|
|
306
|
+
virtualColumnIndexesLeft.sort((a, b) => a - b);
|
|
307
|
+
}
|
|
308
|
+
for (const columnIndex of virtualColumnIndexesLeft) {
|
|
309
|
+
cells.push(getCell(visibleColumns[columnIndex], columnIndex - pinnedColumns.left.length, columnIndex, middleColumnsLength, PinnedColumnPosition.VIRTUAL));
|
|
283
310
|
}
|
|
284
311
|
for (let i = firstColumnIndex; i < lastColumnIndex; i += 1) {
|
|
285
312
|
const column = visibleColumns[i];
|
|
@@ -289,8 +316,15 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
289
316
|
}
|
|
290
317
|
cells.push(getCell(column, indexInSection, i, middleColumnsLength));
|
|
291
318
|
}
|
|
292
|
-
|
|
293
|
-
|
|
319
|
+
|
|
320
|
+
// Repeat the retention step for unpinned columns after the render context.
|
|
321
|
+
const virtualColumnIndexesRight = retainedColumnIndexes.filter(columnIndex => columnIndex >= lastColumnIndex && columnIndex < lastUnpinnedColumnIndex);
|
|
322
|
+
if (hasVirtualFocusCellRight && !virtualColumnIndexesRight.includes(focusedColumnIndex)) {
|
|
323
|
+
virtualColumnIndexesRight.push(focusedColumnIndex);
|
|
324
|
+
virtualColumnIndexesRight.sort((a, b) => a - b);
|
|
325
|
+
}
|
|
326
|
+
for (const columnIndex of virtualColumnIndexesRight) {
|
|
327
|
+
cells.push(getCell(visibleColumns[columnIndex], columnIndex - pinnedColumns.left.length, columnIndex, middleColumnsLength, PinnedColumnPosition.VIRTUAL));
|
|
294
328
|
}
|
|
295
329
|
const eventHandlers = row ? {
|
|
296
330
|
onClick: publishClick,
|
|
@@ -351,6 +385,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes /* remove-proptypes */
|
|
|
351
385
|
onMouseEnter: PropTypes.func,
|
|
352
386
|
onMouseLeave: PropTypes.func,
|
|
353
387
|
pinnedColumns: PropTypes.object.isRequired,
|
|
388
|
+
retainedColumnIndexes: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
354
389
|
row: PropTypes.object.isRequired,
|
|
355
390
|
rowHeight: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
|
|
356
391
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
@@ -101,14 +101,17 @@ const GridCell = (0, _forwardRef.forwardRef)(function GridCell(props, ref) {
|
|
|
101
101
|
value: forcedValue,
|
|
102
102
|
formattedValue: forcedFormattedValue
|
|
103
103
|
} = cellAggregationResult || {};
|
|
104
|
+
const stateTabIndex = (0, _useGridSelector.useGridSelector)(apiRef, () => {
|
|
105
|
+
const cellTabIndex = (0, _gridFocusStateSelector.gridTabIndexCellSelector)(apiRef);
|
|
106
|
+
return cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === rowId ? 0 : -1;
|
|
107
|
+
});
|
|
104
108
|
const cellParams = apiRef.current.getCellParamsForRow(rowId, field, row, {
|
|
105
109
|
colDef: column,
|
|
106
110
|
cellMode,
|
|
107
111
|
rowNode: rowNode,
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}),
|
|
112
|
+
// A cell kept mounted outside the render context is collapsed to zero size, so it must not
|
|
113
|
+
// become the grid's tab stop: tabbing in would move focus to something the user can't see.
|
|
114
|
+
tabIndex: isNotVisible ? -1 : stateTabIndex,
|
|
112
115
|
hasFocus: (0, _useGridSelector.useGridSelector)(apiRef, () => {
|
|
113
116
|
const focus = (0, _gridFocusStateSelector.gridFocusCellSelector)(apiRef);
|
|
114
117
|
return focus?.id === rowId && focus.field === field;
|
|
@@ -94,14 +94,17 @@ const GridCell = forwardRef(function GridCell(props, ref) {
|
|
|
94
94
|
value: forcedValue,
|
|
95
95
|
formattedValue: forcedFormattedValue
|
|
96
96
|
} = cellAggregationResult || {};
|
|
97
|
+
const stateTabIndex = useGridSelector(apiRef, () => {
|
|
98
|
+
const cellTabIndex = gridTabIndexCellSelector(apiRef);
|
|
99
|
+
return cellTabIndex && cellTabIndex.field === field && cellTabIndex.id === rowId ? 0 : -1;
|
|
100
|
+
});
|
|
97
101
|
const cellParams = apiRef.current.getCellParamsForRow(rowId, field, row, {
|
|
98
102
|
colDef: column,
|
|
99
103
|
cellMode,
|
|
100
104
|
rowNode: rowNode,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}),
|
|
105
|
+
// A cell kept mounted outside the render context is collapsed to zero size, so it must not
|
|
106
|
+
// become the grid's tab stop: tabbing in would move focus to something the user can't see.
|
|
107
|
+
tabIndex: isNotVisible ? -1 : stateTabIndex,
|
|
105
108
|
hasFocus: useGridSelector(apiRef, () => {
|
|
106
109
|
const focus = gridFocusCellSelector(apiRef);
|
|
107
110
|
return focus?.id === rowId && focus.field === field;
|
|
@@ -5,7 +5,7 @@ export interface GridEditBooleanCellProps extends GridRenderEditCellParams, Omit
|
|
|
5
5
|
* Callback called when the value is changed by the user.
|
|
6
6
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
7
7
|
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
8
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
8
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
9
9
|
*/
|
|
10
10
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: boolean) => Promise<void> | void;
|
|
11
11
|
}
|
|
@@ -5,7 +5,7 @@ export interface GridEditBooleanCellProps extends GridRenderEditCellParams, Omit
|
|
|
5
5
|
* Callback called when the value is changed by the user.
|
|
6
6
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
7
7
|
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
8
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
8
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
9
9
|
*/
|
|
10
10
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: boolean) => Promise<void> | void;
|
|
11
11
|
}
|
|
@@ -51,15 +51,15 @@ function GridEditBooleanCell(props) {
|
|
|
51
51
|
const classes = useUtilityClasses(ownerState);
|
|
52
52
|
const handleChange = React.useCallback(async event => {
|
|
53
53
|
const newValue = event.target.checked;
|
|
54
|
-
if (onValueChange) {
|
|
55
|
-
await onValueChange(event, newValue);
|
|
56
|
-
}
|
|
57
54
|
setValueState(newValue);
|
|
58
55
|
await apiRef.current.setEditCellValue({
|
|
59
56
|
id: idProp,
|
|
60
57
|
field,
|
|
61
58
|
value: newValue
|
|
62
59
|
}, event);
|
|
60
|
+
if (onValueChange) {
|
|
61
|
+
await onValueChange(event, newValue);
|
|
62
|
+
}
|
|
63
63
|
}, [apiRef, field, idProp, onValueChange]);
|
|
64
64
|
React.useEffect(() => {
|
|
65
65
|
setValueState(value);
|
|
@@ -126,7 +126,7 @@ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes /* remove-
|
|
|
126
126
|
* Callback called when the value is changed by the user.
|
|
127
127
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
128
128
|
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
129
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
129
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
130
130
|
*/
|
|
131
131
|
onValueChange: _propTypes.default.func,
|
|
132
132
|
/**
|
|
@@ -43,15 +43,15 @@ function GridEditBooleanCell(props) {
|
|
|
43
43
|
const classes = useUtilityClasses(ownerState);
|
|
44
44
|
const handleChange = React.useCallback(async event => {
|
|
45
45
|
const newValue = event.target.checked;
|
|
46
|
-
if (onValueChange) {
|
|
47
|
-
await onValueChange(event, newValue);
|
|
48
|
-
}
|
|
49
46
|
setValueState(newValue);
|
|
50
47
|
await apiRef.current.setEditCellValue({
|
|
51
48
|
id: idProp,
|
|
52
49
|
field,
|
|
53
50
|
value: newValue
|
|
54
51
|
}, event);
|
|
52
|
+
if (onValueChange) {
|
|
53
|
+
await onValueChange(event, newValue);
|
|
54
|
+
}
|
|
55
55
|
}, [apiRef, field, idProp, onValueChange]);
|
|
56
56
|
React.useEffect(() => {
|
|
57
57
|
setValueState(value);
|
|
@@ -118,7 +118,7 @@ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes /* remove-
|
|
|
118
118
|
* Callback called when the value is changed by the user.
|
|
119
119
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
120
120
|
* @param {boolean} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
121
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
121
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
122
122
|
*/
|
|
123
123
|
onValueChange: PropTypes.func,
|
|
124
124
|
/**
|
|
@@ -6,7 +6,7 @@ export interface GridEditDateCellProps extends GridRenderEditCellParams {
|
|
|
6
6
|
* Callback called when the value is changed by the user.
|
|
7
7
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
8
8
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
9
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
9
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
10
10
|
*/
|
|
11
11
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: Date | null) => Promise<void> | void;
|
|
12
12
|
slotProps?: {
|
|
@@ -6,7 +6,7 @@ export interface GridEditDateCellProps extends GridRenderEditCellParams {
|
|
|
6
6
|
* Callback called when the value is changed by the user.
|
|
7
7
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
8
8
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
9
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
9
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
10
10
|
*/
|
|
11
11
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: Date | null) => Promise<void> | void;
|
|
12
12
|
slotProps?: {
|
|
@@ -94,18 +94,18 @@ function GridEditDateCell(props) {
|
|
|
94
94
|
const handleChange = React.useCallback(async event => {
|
|
95
95
|
const newFormattedDate = event.target.value;
|
|
96
96
|
const newParsedDate = parseValueToDate(newFormattedDate);
|
|
97
|
-
if (onValueChange) {
|
|
98
|
-
await onValueChange(event, newParsedDate);
|
|
99
|
-
}
|
|
100
97
|
setValueState({
|
|
101
98
|
parsed: newParsedDate,
|
|
102
99
|
formatted: newFormattedDate
|
|
103
100
|
});
|
|
104
|
-
apiRef.current.setEditCellValue({
|
|
101
|
+
await apiRef.current.setEditCellValue({
|
|
105
102
|
id,
|
|
106
103
|
field,
|
|
107
104
|
value: newParsedDate
|
|
108
105
|
}, event);
|
|
106
|
+
if (onValueChange) {
|
|
107
|
+
await onValueChange(event, newParsedDate);
|
|
108
|
+
}
|
|
109
109
|
}, [apiRef, field, id, onValueChange, parseValueToDate]);
|
|
110
110
|
React.useEffect(() => {
|
|
111
111
|
setValueState(state => {
|
|
@@ -180,7 +180,7 @@ process.env.NODE_ENV !== "production" ? GridEditDateCell.propTypes /* remove-pro
|
|
|
180
180
|
* Callback called when the value is changed by the user.
|
|
181
181
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
182
182
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
183
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
183
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
184
184
|
*/
|
|
185
185
|
onValueChange: _propTypes.default.func,
|
|
186
186
|
/**
|
|
@@ -86,18 +86,18 @@ function GridEditDateCell(props) {
|
|
|
86
86
|
const handleChange = React.useCallback(async event => {
|
|
87
87
|
const newFormattedDate = event.target.value;
|
|
88
88
|
const newParsedDate = parseValueToDate(newFormattedDate);
|
|
89
|
-
if (onValueChange) {
|
|
90
|
-
await onValueChange(event, newParsedDate);
|
|
91
|
-
}
|
|
92
89
|
setValueState({
|
|
93
90
|
parsed: newParsedDate,
|
|
94
91
|
formatted: newFormattedDate
|
|
95
92
|
});
|
|
96
|
-
apiRef.current.setEditCellValue({
|
|
93
|
+
await apiRef.current.setEditCellValue({
|
|
97
94
|
id,
|
|
98
95
|
field,
|
|
99
96
|
value: newParsedDate
|
|
100
97
|
}, event);
|
|
98
|
+
if (onValueChange) {
|
|
99
|
+
await onValueChange(event, newParsedDate);
|
|
100
|
+
}
|
|
101
101
|
}, [apiRef, field, id, onValueChange, parseValueToDate]);
|
|
102
102
|
React.useEffect(() => {
|
|
103
103
|
setValueState(state => {
|
|
@@ -172,7 +172,7 @@ process.env.NODE_ENV !== "production" ? GridEditDateCell.propTypes /* remove-pro
|
|
|
172
172
|
* Callback called when the value is changed by the user.
|
|
173
173
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
174
174
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
175
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
175
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
176
176
|
*/
|
|
177
177
|
onValueChange: PropTypes.func,
|
|
178
178
|
/**
|
|
@@ -7,7 +7,7 @@ export interface GridEditInputCellProps extends GridRenderEditCellParams {
|
|
|
7
7
|
* Callback called when the value is changed by the user.
|
|
8
8
|
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
9
9
|
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
10
|
-
* @returns {Promise<void> | void} A promise to be awaited
|
|
10
|
+
* @returns {Promise<void> | void} A promise to be awaited after `apiRef.current.setEditCellValue` is called
|
|
11
11
|
*/
|
|
12
12
|
onValueChange?: (event: React.ChangeEvent<HTMLInputElement>, newValue: string) => Promise<void> | void;
|
|
13
13
|
slotProps?: {
|