@mui/x-data-grid 6.10.0 → 6.10.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 +136 -3
- package/components/GridRow.d.ts +2 -0
- package/components/GridRow.js +50 -22
- package/components/cell/GridCell.d.ts +2 -2
- package/components/cell/GridCell.js +38 -14
- package/components/containers/GridRootStyles.js +1 -0
- package/components/panel/GridPanel.js +2 -2
- package/components/panel/filterPanel/GridFilterForm.js +2 -2
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +2 -2
- package/hooks/features/columns/gridColumnsUtils.js +17 -7
- package/hooks/features/columns/useGridColumns.js +4 -4
- package/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/hooks/features/editing/useGridCellEditing.js +4 -4
- package/hooks/features/export/serializers/csvSerializer.js +3 -5
- package/hooks/features/export/useGridPrintExport.js +10 -3
- package/hooks/features/export/utils.js +2 -2
- package/hooks/features/filter/gridFilterSelector.js +1 -1
- package/hooks/features/filter/gridFilterUtils.js +37 -10
- package/hooks/features/filter/useGridFilter.js +14 -9
- package/hooks/features/focus/useGridFocus.js +30 -1
- package/hooks/features/pagination/useGridPagination.js +6 -6
- package/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/hooks/features/rows/gridRowsSelector.js +3 -3
- package/hooks/features/rows/gridRowsUtils.js +2 -2
- package/hooks/features/rows/useGridRowsMeta.js +2 -2
- package/hooks/features/sorting/useGridSorting.js +6 -6
- package/hooks/features/virtualization/useGridVirtualScroller.js +70 -6
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/joy/joySlots.js +2 -2
- package/legacy/components/GridRow.js +47 -21
- package/legacy/components/cell/GridCell.js +38 -14
- package/legacy/components/containers/GridRootStyles.js +1 -0
- package/legacy/components/panel/GridPanel.js +2 -2
- package/legacy/components/panel/filterPanel/GridFilterForm.js +2 -2
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +2 -2
- package/legacy/hooks/features/columns/gridColumnsUtils.js +17 -7
- package/legacy/hooks/features/columns/useGridColumns.js +4 -4
- package/legacy/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/legacy/hooks/features/editing/useGridCellEditing.js +4 -4
- package/legacy/hooks/features/export/serializers/csvSerializer.js +4 -6
- package/legacy/hooks/features/export/useGridPrintExport.js +16 -4
- package/legacy/hooks/features/export/utils.js +2 -2
- package/legacy/hooks/features/filter/gridFilterSelector.js +1 -1
- package/legacy/hooks/features/filter/gridFilterUtils.js +30 -10
- package/legacy/hooks/features/filter/useGridFilter.js +14 -11
- package/legacy/hooks/features/focus/useGridFocus.js +32 -1
- package/legacy/hooks/features/pagination/useGridPagination.js +6 -6
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/legacy/hooks/features/rows/gridRowsSelector.js +3 -3
- package/legacy/hooks/features/rows/gridRowsUtils.js +2 -2
- package/legacy/hooks/features/rows/useGridRowsMeta.js +2 -2
- package/legacy/hooks/features/sorting/useGridSorting.js +6 -6
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +74 -6
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +1 -1
- package/legacy/joy/joySlots.js +2 -2
- package/legacy/locales/fiFI.js +1 -1
- package/legacy/utils/getGridLocalization.js +2 -2
- package/locales/fiFI.js +1 -1
- package/modern/components/GridRow.js +50 -22
- package/modern/components/cell/GridCell.js +38 -14
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/hooks/features/columns/gridColumnsUtils.js +15 -5
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/modern/hooks/features/export/serializers/csvSerializer.js +3 -5
- package/modern/hooks/features/export/useGridPrintExport.js +8 -1
- package/modern/hooks/features/filter/gridFilterUtils.js +37 -10
- package/modern/hooks/features/filter/useGridFilter.js +8 -3
- package/modern/hooks/features/focus/useGridFocus.js +30 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +69 -5
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/locales/fiFI.js +1 -1
- package/node/components/GridRow.js +50 -22
- package/node/components/cell/GridCell.js +38 -14
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/hooks/features/columns/gridColumnsUtils.js +15 -5
- package/node/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/node/hooks/features/export/serializers/csvSerializer.js +3 -5
- package/node/hooks/features/export/useGridPrintExport.js +8 -1
- package/node/hooks/features/filter/gridFilterUtils.js +37 -10
- package/node/hooks/features/filter/useGridFilter.js +8 -3
- package/node/hooks/features/focus/useGridFocus.js +29 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +69 -5
- package/node/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/locales/fiFI.js +1 -1
- package/package.json +3 -3
- package/utils/getGridLocalization.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,139 @@
|
|
|
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.10.2
|
|
7
|
+
|
|
8
|
+
_Jul 27, 2023_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 13 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🚀 Improve scatter charts performance
|
|
13
|
+
- 📚 Redesigned component API documentation and side navigation
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
|
|
16
|
+
### Data Grid
|
|
17
|
+
|
|
18
|
+
#### `@mui/x-data-grid@v6.10.2`
|
|
19
|
+
|
|
20
|
+
- [DataGrid] Fix quick filter & aggregation error (#9729) @romgrk
|
|
21
|
+
- [DataGrid] Fix row click propagation causing error in nested grid (#9741) @cherniavskii
|
|
22
|
+
- [DataGrid] Keep focused cell in the DOM (#7357) @yaredtsy
|
|
23
|
+
- [l10n] Improve Finnish (fi-FI) locale (#9746) @sambbaahh
|
|
24
|
+
|
|
25
|
+
#### `@mui/x-data-grid-pro@v6.10.2` [](https://mui.com/r/x-pro-svg-link)
|
|
26
|
+
|
|
27
|
+
Same changes as in `@mui/x-data-grid@v6.10.2`.
|
|
28
|
+
|
|
29
|
+
#### `@mui/x-data-grid-premium@v6.10.2` [](https://mui.com/r/x-premium-svg-link)
|
|
30
|
+
|
|
31
|
+
Same changes as in `@mui/x-data-grid-pro@v6.10.2`, plus:
|
|
32
|
+
|
|
33
|
+
- [DataGridPremium] Allow to customize grouping cell offset (#9417) @cherniavskii
|
|
34
|
+
|
|
35
|
+
### Date Pickers
|
|
36
|
+
|
|
37
|
+
#### `@mui/x-date-pickers@v6.10.2`
|
|
38
|
+
|
|
39
|
+
- [pickers] Remove the `endOfDate` from `DigitalClock` timeOptions (#9800) @noraleonte
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-date-pickers-pro@v6.10.2` [](https://mui.com/r/x-pro-svg-link)
|
|
42
|
+
|
|
43
|
+
Same changes as in `@mui/x-date-pickers@v6.10.2`.
|
|
44
|
+
|
|
45
|
+
### Charts / `@mui/x-charts@v6.0.0-alpha.5`
|
|
46
|
+
|
|
47
|
+
- [charts] Improve JSDoc for axis-related props (#9779) @flaviendelangle
|
|
48
|
+
- [charts] Improve performances of Scatter component (#9527) @flaviendelangle
|
|
49
|
+
|
|
50
|
+
### Docs
|
|
51
|
+
|
|
52
|
+
- [docs] Add `pnpm` in more places @oliviertassinari
|
|
53
|
+
- [docs] Add `pnpm` installation instructions for MUI X (#9707) @richbustos
|
|
54
|
+
- [docs] Align pickers "uncontrolled vs controlled" sections (#9772) @LukasTy
|
|
55
|
+
- [docs] Apply style guide to the data grid Layout page (#9673) @richbustos
|
|
56
|
+
- [docs] Differentiate between packages in `slotProps` docs (#9668) @cherniavskii
|
|
57
|
+
- [docs] Fix charts width in axis pages (#9801) @alexfauquette
|
|
58
|
+
- [docs] Fix wrong prop name in the Editing page (#9753) @m4theushw
|
|
59
|
+
- [docs] New component API page and side nav design (#9187) @alexfauquette
|
|
60
|
+
- [docs] Update overview page with up to date information about the plans (#9512) @joserodolfofreitas
|
|
61
|
+
|
|
62
|
+
### Core
|
|
63
|
+
|
|
64
|
+
- [core] Use PR charts version in preview (#9787) @alexfauquette
|
|
65
|
+
- [license] Allow overriding the license on specific parts of the page (#9717) @Janpot
|
|
66
|
+
- [license] Throw in dev mode after 30 days (#9701) @oliviertassinari
|
|
67
|
+
- [license] Only throw in dev mode (#9803) @oliviertassinari
|
|
68
|
+
- [test] Fail the CI when new unexpected files are created (#9728) @oliviertassinari
|
|
69
|
+
|
|
70
|
+
## 6.10.1
|
|
71
|
+
|
|
72
|
+
_Jul 20, 2023_
|
|
73
|
+
|
|
74
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
75
|
+
|
|
76
|
+
- 🎁 Fix CSV export for values containing double quotes
|
|
77
|
+
- 🚀 Improve tree data performance
|
|
78
|
+
- 🐞 Bugfixes
|
|
79
|
+
- 📚 Documentation improvements
|
|
80
|
+
|
|
81
|
+
### Data Grid
|
|
82
|
+
|
|
83
|
+
#### `@mui/x-data-grid@v6.10.1`
|
|
84
|
+
|
|
85
|
+
- [DataGrid] Filtering performance: compile filter applier with `eval` (#9635) @romgrk
|
|
86
|
+
- [DataGrid] Fix CSV export for values containing double quotes (#9667) @cherniavskii
|
|
87
|
+
- [DataGrid] Fix column type change not working correctly (#9594) @cherniavskii
|
|
88
|
+
- [DataGrid] Fix quick filter `undefined` row error (#9708) @romgrk
|
|
89
|
+
- [DataGrid] Prevent `viewportOuterSize.height` going negative (#9664) @gitstart
|
|
90
|
+
- [DataGrid] Update focused cell on page change via keyboard (#9203) @m4theushw
|
|
91
|
+
- [DataGrid] Wait for remote stylesheets to load before print (#9665) @cherniavskii
|
|
92
|
+
|
|
93
|
+
#### `@mui/x-data-grid-pro@v6.10.1` [](https://mui.com/r/x-pro-svg-link)
|
|
94
|
+
|
|
95
|
+
Same changes as in `@mui/x-data-grid@v6.10.1`, plus:
|
|
96
|
+
|
|
97
|
+
- [DataGridPro] Improve tree data performance (#9682) @cherniavskii
|
|
98
|
+
- [DataGridPro] Prevent affecting cells from child DataGrid when resizing a column (#9670) @m4theushw
|
|
99
|
+
|
|
100
|
+
#### `@mui/x-data-grid-premium@v6.10.1` [](https://mui.com/r/x-premium-svg-link)
|
|
101
|
+
|
|
102
|
+
Same changes as in `@mui/x-data-grid-pro@v6.10.1`.
|
|
103
|
+
|
|
104
|
+
### Date Pickers
|
|
105
|
+
|
|
106
|
+
#### `@mui/x-date-pickers@v6.10.1`
|
|
107
|
+
|
|
108
|
+
- [fields] Fix `format` and `value` update order (#9715) @LukasTy
|
|
109
|
+
- [pickers] Remove `require` usage in comment (#9675) @LukasTy
|
|
110
|
+
|
|
111
|
+
#### `@mui/x-date-pickers-pro@v6.10.1` [](https://mui.com/r/x-pro-svg-link)
|
|
112
|
+
|
|
113
|
+
Same changes as in `@mui/x-date-pickers@v6.10.1`.
|
|
114
|
+
|
|
115
|
+
### Charts / `@mui/x-charts@v6.0.0-alpha.4`
|
|
116
|
+
|
|
117
|
+
- [charts] Fix blinking in responsive charts and extremums computation for line charts (#9734) @alexfauquette
|
|
118
|
+
- [charts] Use ESM with imports (#9645) @alexfauquette
|
|
119
|
+
|
|
120
|
+
### Docs
|
|
121
|
+
|
|
122
|
+
- [docs] Add additional note for license key installation on Next.js (#9575) @joserodolfofreitas
|
|
123
|
+
- [docs] Add paragraph about managing focus of custom edit components (#9658) @m4theushw
|
|
124
|
+
- [docs] Add unsorted icon slot to the custom sort icons demo (#9169) @d4rekanguok
|
|
125
|
+
- [docs] Disable ad for onboarding pages (#9700) @oliviertassinari
|
|
126
|
+
- [docs] Disabling ads without toolbar has no effect @oliviertassinari
|
|
127
|
+
- [docs] Fix Date Pickers usage to Title Case (#9680) @richbustos
|
|
128
|
+
- [docs] Fix sorting in `CustomSortIcons` demo (#9656) @MBilalShafi
|
|
129
|
+
- [docs] Improve the UI for pickers introduction (#9644) @alexfauquette
|
|
130
|
+
- [docs] Improve the demo design @oliviertassinari
|
|
131
|
+
- [docs] Localization progress, polish (#9672) @oliviertassinari
|
|
132
|
+
- [docs] Normalize the WIP items (#9671) @oliviertassinari
|
|
133
|
+
|
|
134
|
+
### Core
|
|
135
|
+
|
|
136
|
+
- [core] Add `validate` command (#9714) @romgrk
|
|
137
|
+
- [CHANGELOG] Update generator to new format @oliviertassinari
|
|
138
|
+
|
|
6
139
|
## 6.10.0
|
|
7
140
|
|
|
8
141
|
_Jul 13, 2023_
|
|
@@ -26,11 +159,11 @@ We'd like to offer a big thanks to the 10 contributors who made this release pos
|
|
|
26
159
|
- [DataGrid] Make `rowExpansionChange` event public (#9611) @MBilalShafi
|
|
27
160
|
- [l10n] Improve Polish (pl-PL) locale (#9625) @ch1llysense
|
|
28
161
|
|
|
29
|
-
#### `@mui/x-data-grid-pro@6.10.0`
|
|
162
|
+
#### `@mui/x-data-grid-pro@6.10.0` [](https://mui.com/r/x-pro-svg-link)
|
|
30
163
|
|
|
31
164
|
Same changes as in `@mui/x-data-grid@6.10.0`.
|
|
32
165
|
|
|
33
|
-
#### `@mui/x-data-grid-premium@6.10.0`
|
|
166
|
+
#### `@mui/x-data-grid-premium@6.10.0` [](https://mui.com/r/x-premium-svg-link)
|
|
34
167
|
|
|
35
168
|
Same changes as in `@mui/x-data-grid-pro@6.10.0`.
|
|
36
169
|
|
|
@@ -41,7 +174,7 @@ Same changes as in `@mui/x-data-grid-pro@6.10.0`.
|
|
|
41
174
|
- [pickers] Fix date calendar issues (#9652) @LukasTy
|
|
42
175
|
- [l10n] Improve Norwegian (nb-NO) locale (#9608) @JosteinBrevik
|
|
43
176
|
|
|
44
|
-
#### `@mui/x-date-pickers-pro@6.10.0`
|
|
177
|
+
#### `@mui/x-date-pickers-pro@6.10.0` [](https://mui.com/r/x-pro-svg-link)
|
|
45
178
|
|
|
46
179
|
Same changes as in `@mui/x-date-pickers@6.10.0`.
|
|
47
180
|
|
package/components/GridRow.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export interface GridRowProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
28
28
|
tabbableCell: string | null;
|
|
29
29
|
row?: GridRowModel;
|
|
30
30
|
isLastVisible?: boolean;
|
|
31
|
+
focusedCellColumnIndexNotInRange?: number;
|
|
32
|
+
isNotVisible?: boolean;
|
|
31
33
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
32
34
|
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
33
35
|
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
package/components/GridRow.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
3
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCellColumnIndexNotInRange", "isNotVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -64,10 +64,14 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
64
64
|
position,
|
|
65
65
|
rowHeight,
|
|
66
66
|
className,
|
|
67
|
+
visibleColumns,
|
|
67
68
|
renderedColumns,
|
|
68
69
|
containerWidth,
|
|
69
70
|
firstColumnToRender,
|
|
70
71
|
isLastVisible = false,
|
|
72
|
+
focusedCellColumnIndexNotInRange,
|
|
73
|
+
isNotVisible,
|
|
74
|
+
focusedCell,
|
|
71
75
|
onClick,
|
|
72
76
|
onDoubleClick,
|
|
73
77
|
onMouseEnter,
|
|
@@ -173,7 +177,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
173
177
|
|
|
174
178
|
// User clicked a button from the "actions" column type
|
|
175
179
|
const column = apiRef.current.getColumn(field);
|
|
176
|
-
if (column.type === GRID_ACTIONS_COLUMN_TYPE) {
|
|
180
|
+
if ((column == null ? void 0 : column.type) === GRID_ACTIONS_COLUMN_TYPE) {
|
|
177
181
|
return;
|
|
178
182
|
}
|
|
179
183
|
}
|
|
@@ -190,6 +194,10 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
190
194
|
var _editRowsState$rowId$, _editRowsState$rowId;
|
|
191
195
|
const disableDragEvents = disableColumnReorder && column.disableReorder || !rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
|
|
192
196
|
const editCellState = (_editRowsState$rowId$ = (_editRowsState$rowId = editRowsState[rowId]) == null ? void 0 : _editRowsState$rowId[column.field]) != null ? _editRowsState$rowId$ : null;
|
|
197
|
+
let cellIsNotVisible = false;
|
|
198
|
+
if (focusedCellColumnIndexNotInRange !== undefined && visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
|
|
199
|
+
cellIsNotVisible = true;
|
|
200
|
+
}
|
|
193
201
|
return /*#__PURE__*/_jsx(CellComponent, _extends({
|
|
194
202
|
column: column,
|
|
195
203
|
width: cellProps.width,
|
|
@@ -200,7 +208,8 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
200
208
|
colIndex: cellProps.indexRelativeToAllColumns,
|
|
201
209
|
colSpan: cellProps.colSpan,
|
|
202
210
|
disableDragEvents: disableDragEvents,
|
|
203
|
-
editCellState: editCellState
|
|
211
|
+
editCellState: editCellState,
|
|
212
|
+
isNotVisible: cellIsNotVisible
|
|
204
213
|
}, slotProps == null ? void 0 : slotProps.cell), column.field);
|
|
205
214
|
};
|
|
206
215
|
const sizes = useGridSelector(apiRef, () => _extends({}, apiRef.current.unstable_getRowInternalSizes(rowId)), objectShallowCompare);
|
|
@@ -222,25 +231,35 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
222
231
|
minHeight = maximumSize;
|
|
223
232
|
}
|
|
224
233
|
}
|
|
225
|
-
const style =
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
style[property] = sizes.spacingTop;
|
|
233
|
-
}
|
|
234
|
-
if (sizes != null && sizes.spacingBottom) {
|
|
235
|
-
const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
236
|
-
let propertyValue = style[property];
|
|
237
|
-
// avoid overriding existing value
|
|
238
|
-
if (typeof propertyValue !== 'number') {
|
|
239
|
-
propertyValue = parseInt(propertyValue || '0', 10);
|
|
234
|
+
const style = React.useMemo(() => {
|
|
235
|
+
if (isNotVisible) {
|
|
236
|
+
return {
|
|
237
|
+
opacity: 0,
|
|
238
|
+
width: 0,
|
|
239
|
+
height: 0
|
|
240
|
+
};
|
|
240
241
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
const rowStyle = _extends({}, styleProp, {
|
|
243
|
+
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
244
|
+
// max-height doesn't support "auto"
|
|
245
|
+
minHeight
|
|
246
|
+
});
|
|
247
|
+
if (sizes != null && sizes.spacingTop) {
|
|
248
|
+
const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
249
|
+
rowStyle[property] = sizes.spacingTop;
|
|
250
|
+
}
|
|
251
|
+
if (sizes != null && sizes.spacingBottom) {
|
|
252
|
+
const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
253
|
+
let propertyValue = rowStyle[property];
|
|
254
|
+
// avoid overriding existing value
|
|
255
|
+
if (typeof propertyValue !== 'number') {
|
|
256
|
+
propertyValue = parseInt(propertyValue || '0', 10);
|
|
257
|
+
}
|
|
258
|
+
propertyValue += sizes.spacingBottom;
|
|
259
|
+
rowStyle[property] = propertyValue;
|
|
260
|
+
}
|
|
261
|
+
return rowStyle;
|
|
262
|
+
}, [isNotVisible, rowHeight, styleProp, minHeight, sizes, rootProps.rowSpacingType]);
|
|
244
263
|
const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
245
264
|
if (typeof rootProps.getRowClassName === 'function') {
|
|
246
265
|
var _currentPage$range;
|
|
@@ -261,7 +280,14 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
261
280
|
const cells = [];
|
|
262
281
|
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
263
282
|
const column = renderedColumns[i];
|
|
264
|
-
|
|
283
|
+
let indexRelativeToAllColumns = firstColumnToRender + i;
|
|
284
|
+
if (focusedCellColumnIndexNotInRange !== undefined && focusedCell) {
|
|
285
|
+
if (visibleColumns[focusedCellColumnIndexNotInRange].field === column.field) {
|
|
286
|
+
indexRelativeToAllColumns = focusedCellColumnIndexNotInRange;
|
|
287
|
+
} else {
|
|
288
|
+
indexRelativeToAllColumns -= 1;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
265
291
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
266
292
|
if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
|
|
267
293
|
if (rowType !== 'skeletonRow') {
|
|
@@ -324,12 +350,14 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
324
350
|
* If `null`, no cell in this row has focus.
|
|
325
351
|
*/
|
|
326
352
|
focusedCell: PropTypes.string,
|
|
353
|
+
focusedCellColumnIndexNotInRange: PropTypes.number,
|
|
327
354
|
/**
|
|
328
355
|
* Index of the row in the whole sorted and filtered dataset.
|
|
329
356
|
* If some rows above have expanded children, this index also take those children into account.
|
|
330
357
|
*/
|
|
331
358
|
index: PropTypes.number.isRequired,
|
|
332
359
|
isLastVisible: PropTypes.bool,
|
|
360
|
+
isNotVisible: PropTypes.bool,
|
|
333
361
|
lastColumnToRender: PropTypes.number.isRequired,
|
|
334
362
|
onClick: PropTypes.func,
|
|
335
363
|
onDoubleClick: PropTypes.func,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { GridRowId, GridCellMode } from '../../models';
|
|
2
|
+
import { GridRowId, GridCellMode, GridEditCellProps } from '../../models';
|
|
3
3
|
import { GridColDef, GridAlignment } from '../../models/colDef/gridColDef';
|
|
4
|
-
import { GridEditCellProps } from '../../models/gridEditRowModel';
|
|
5
4
|
type GridCellV7Props = {
|
|
6
5
|
align: GridAlignment;
|
|
7
6
|
className?: string;
|
|
@@ -13,6 +12,7 @@ type GridCellV7Props = {
|
|
|
13
12
|
width: number;
|
|
14
13
|
colSpan?: number;
|
|
15
14
|
disableDragEvents?: boolean;
|
|
15
|
+
isNotVisible?: boolean;
|
|
16
16
|
editCellState: GridEditCellProps<any> | null;
|
|
17
17
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
18
18
|
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["changeReason", "unstable_updateValueOnRender"],
|
|
4
|
-
_excluded2 = ["align", "children", "editCellState", "colIndex", "column", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "isSelected", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
5
|
-
_excluded3 = ["column", "rowId", "editCellState", "align", "children", "colIndex", "height", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
4
|
+
_excluded2 = ["align", "children", "editCellState", "colIndex", "column", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "isSelected", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "isNotVisible", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
5
|
+
_excluded3 = ["column", "rowId", "editCellState", "align", "children", "colIndex", "height", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "isNotVisible", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
6
6
|
_excluded4 = ["changeReason", "unstable_updateValueOnRender"];
|
|
7
7
|
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
8
8
|
import * as React from 'react';
|
|
@@ -177,6 +177,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
177
177
|
showRightBorder,
|
|
178
178
|
colSpan,
|
|
179
179
|
disableDragEvents,
|
|
180
|
+
isNotVisible,
|
|
180
181
|
onClick,
|
|
181
182
|
onDoubleClick,
|
|
182
183
|
onMouseDown,
|
|
@@ -227,13 +228,23 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
227
228
|
propHandler(event);
|
|
228
229
|
}
|
|
229
230
|
}, [apiRef, field, rowId]);
|
|
230
|
-
const style = {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
231
|
+
const style = React.useMemo(() => {
|
|
232
|
+
if (isNotVisible) {
|
|
233
|
+
return {
|
|
234
|
+
padding: 0,
|
|
235
|
+
opacity: 0,
|
|
236
|
+
width: 0
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const cellStyle = {
|
|
240
|
+
minWidth: width,
|
|
241
|
+
maxWidth: width,
|
|
242
|
+
minHeight: height,
|
|
243
|
+
maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
|
|
244
|
+
};
|
|
236
245
|
|
|
246
|
+
return cellStyle;
|
|
247
|
+
}, [width, height, isNotVisible]);
|
|
237
248
|
React.useEffect(() => {
|
|
238
249
|
if (!hasFocus || cellMode === GridCellModes.Edit) {
|
|
239
250
|
return;
|
|
@@ -353,6 +364,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
353
364
|
isValidating: PropTypes.bool,
|
|
354
365
|
value: PropTypes.any
|
|
355
366
|
}),
|
|
367
|
+
isNotVisible: PropTypes.bool,
|
|
356
368
|
height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
357
369
|
onClick: PropTypes.func,
|
|
358
370
|
onDoubleClick: PropTypes.func,
|
|
@@ -380,6 +392,7 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
380
392
|
showRightBorder,
|
|
381
393
|
colSpan,
|
|
382
394
|
disableDragEvents,
|
|
395
|
+
isNotVisible,
|
|
383
396
|
onClick,
|
|
384
397
|
onDoubleClick,
|
|
385
398
|
onMouseDown,
|
|
@@ -474,13 +487,23 @@ const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
474
487
|
propHandler(event);
|
|
475
488
|
}
|
|
476
489
|
}, [apiRef, field, rowId]);
|
|
477
|
-
const style = {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
490
|
+
const style = React.useMemo(() => {
|
|
491
|
+
if (isNotVisible) {
|
|
492
|
+
return {
|
|
493
|
+
padding: 0,
|
|
494
|
+
opacity: 0,
|
|
495
|
+
width: 0
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
const cellStyle = {
|
|
499
|
+
minWidth: width,
|
|
500
|
+
maxWidth: width,
|
|
501
|
+
minHeight: height,
|
|
502
|
+
maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
|
|
503
|
+
};
|
|
483
504
|
|
|
505
|
+
return cellStyle;
|
|
506
|
+
}, [width, height, isNotVisible]);
|
|
484
507
|
React.useEffect(() => {
|
|
485
508
|
if (!hasFocus || cellMode === GridCellModes.Edit) {
|
|
486
509
|
return;
|
|
@@ -594,6 +617,7 @@ process.env.NODE_ENV !== "production" ? GridCellV7.propTypes = {
|
|
|
594
617
|
value: PropTypes.any
|
|
595
618
|
}),
|
|
596
619
|
height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
|
|
620
|
+
isNotVisible: PropTypes.bool,
|
|
597
621
|
onClick: PropTypes.func,
|
|
598
622
|
onDoubleClick: PropTypes.func,
|
|
599
623
|
onDragEnter: PropTypes.func,
|
|
@@ -159,6 +159,7 @@ export const GridRootStyles = styled('div', {
|
|
|
159
159
|
'--unstable_DataGrid-radius': typeof radius === 'number' ? `${radius}px` : radius,
|
|
160
160
|
'--unstable_DataGrid-headWeight': theme.typography.fontWeightMedium,
|
|
161
161
|
'--unstable_DataGrid-overlayBackground': theme.vars ? `rgba(${theme.vars.palette.background.defaultChannel} / ${theme.vars.palette.action.disabledOpacity})` : alpha(theme.palette.background.default, theme.palette.action.disabledOpacity),
|
|
162
|
+
'--DataGrid-cellOffsetMultiplier': 2,
|
|
162
163
|
flex: 1,
|
|
163
164
|
boxSizing: 'border-box',
|
|
164
165
|
position: 'relative',
|
|
@@ -70,8 +70,8 @@ const GridPanel = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
70
70
|
}], []);
|
|
71
71
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
72
72
|
React.useEffect(() => {
|
|
73
|
-
var _apiRef$current$rootE
|
|
74
|
-
const columnHeadersElement = (_apiRef$current$rootE = apiRef.current.rootElementRef) == null
|
|
73
|
+
var _apiRef$current$rootE;
|
|
74
|
+
const columnHeadersElement = (_apiRef$current$rootE = apiRef.current.rootElementRef) == null || (_apiRef$current$rootE = _apiRef$current$rootE.current) == null ? void 0 : _apiRef$current$rootE.querySelector(`.${gridClasses.columnHeaders}`);
|
|
75
75
|
if (columnHeadersElement) {
|
|
76
76
|
setAnchorEl(columnHeadersElement);
|
|
77
77
|
}
|
|
@@ -217,7 +217,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
217
217
|
focus: () => {
|
|
218
218
|
if (currentOperator != null && currentOperator.InputComponent) {
|
|
219
219
|
var _valueRef$current;
|
|
220
|
-
valueRef == null
|
|
220
|
+
valueRef == null || (_valueRef$current = valueRef.current) == null ? void 0 : _valueRef$current.focus();
|
|
221
221
|
} else {
|
|
222
222
|
filterSelectorRef.current.focus();
|
|
223
223
|
}
|
|
@@ -313,7 +313,7 @@ const GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(pro
|
|
|
313
313
|
native: isBaseSelectNative,
|
|
314
314
|
inputRef: filterSelectorRef
|
|
315
315
|
}, (_rootProps$slotProps8 = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps8.baseSelect, {
|
|
316
|
-
children: currentColumn == null
|
|
316
|
+
children: currentColumn == null || (_currentColumn$filter2 = currentColumn.filterOperators) == null ? void 0 : _currentColumn$filter2.map(operator => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
317
317
|
native: isBaseSelectNative,
|
|
318
318
|
key: operator.value,
|
|
319
319
|
value: operator.value
|
|
@@ -43,7 +43,7 @@ const SingleSelectOperatorContainer = styled('div')({
|
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
function GridFilterInputSingleSelect(props) {
|
|
46
|
-
var _item$value, _rootProps$slotProps$, _rootProps$slotProps,
|
|
46
|
+
var _item$value, _rootProps$slotProps$, _rootProps$slotProps, _resolvedColumn, _resolvedColumn2, _rootProps$slotProps2, _rootProps$slotProps3, _rootProps$slotProps4;
|
|
47
47
|
const {
|
|
48
48
|
item,
|
|
49
49
|
applyValue,
|
|
@@ -62,7 +62,7 @@ function GridFilterInputSingleSelect(props) {
|
|
|
62
62
|
const id = useId();
|
|
63
63
|
const labelId = useId();
|
|
64
64
|
const rootProps = useGridRootProps();
|
|
65
|
-
const isSelectNative = (_rootProps$slotProps$ = (_rootProps$slotProps = rootProps.slotProps) == null
|
|
65
|
+
const isSelectNative = (_rootProps$slotProps$ = (_rootProps$slotProps = rootProps.slotProps) == null || (_rootProps$slotProps = _rootProps$slotProps.baseSelect) == null ? void 0 : _rootProps$slotProps.native) != null ? _rootProps$slotProps$ : true;
|
|
66
66
|
let resolvedColumn = null;
|
|
67
67
|
if (item.field) {
|
|
68
68
|
const column = apiRef.current.getColumn(item.field);
|
|
@@ -197,6 +197,13 @@ export const applyInitialState = (columnsState, initialState) => {
|
|
|
197
197
|
});
|
|
198
198
|
return newColumnsState;
|
|
199
199
|
};
|
|
200
|
+
function getDefaultColTypeDef(columnTypes, type) {
|
|
201
|
+
let colDef = columnTypes[DEFAULT_GRID_COL_TYPE_KEY];
|
|
202
|
+
if (type && columnTypes[type]) {
|
|
203
|
+
colDef = columnTypes[type];
|
|
204
|
+
}
|
|
205
|
+
return colDef;
|
|
206
|
+
}
|
|
200
207
|
export const createColumnsState = ({
|
|
201
208
|
apiRef,
|
|
202
209
|
columnsToUpsert,
|
|
@@ -205,7 +212,7 @@ export const createColumnsState = ({
|
|
|
205
212
|
columnVisibilityModel = gridColumnVisibilityModelSelector(apiRef),
|
|
206
213
|
keepOnlyColumnsToUpsert = false
|
|
207
214
|
}) => {
|
|
208
|
-
var _apiRef$current$getRo, _apiRef$current$getRo2, _apiRef$current
|
|
215
|
+
var _apiRef$current$getRo, _apiRef$current$getRo2, _apiRef$current;
|
|
209
216
|
const isInsideStateInitializer = !apiRef.current.state.columns;
|
|
210
217
|
let columnsState;
|
|
211
218
|
if (isInsideStateInitializer) {
|
|
@@ -238,11 +245,7 @@ export const createColumnsState = ({
|
|
|
238
245
|
columnsToKeep[field] = true;
|
|
239
246
|
let existingState = columnsState.lookup[field];
|
|
240
247
|
if (existingState == null) {
|
|
241
|
-
|
|
242
|
-
if (newColumn.type && columnTypes[newColumn.type]) {
|
|
243
|
-
colDef = columnTypes[newColumn.type];
|
|
244
|
-
}
|
|
245
|
-
existingState = _extends({}, colDef, {
|
|
248
|
+
existingState = _extends({}, getDefaultColTypeDef(columnTypes, newColumn.type), {
|
|
246
249
|
field,
|
|
247
250
|
hasBeenResized: false
|
|
248
251
|
});
|
|
@@ -250,6 +253,13 @@ export const createColumnsState = ({
|
|
|
250
253
|
} else if (keepOnlyColumnsToUpsert) {
|
|
251
254
|
columnsState.orderedFields.push(field);
|
|
252
255
|
}
|
|
256
|
+
|
|
257
|
+
// If the column type has changed - merge the existing state with the default column type definition
|
|
258
|
+
if (existingState && existingState.type !== newColumn.type) {
|
|
259
|
+
existingState = _extends({}, existingState, getDefaultColTypeDef(columnTypes, newColumn.type), {
|
|
260
|
+
field
|
|
261
|
+
});
|
|
262
|
+
}
|
|
253
263
|
let hasBeenResized = existingState.hasBeenResized;
|
|
254
264
|
COLUMNS_DIMENSION_PROPERTIES.forEach(key => {
|
|
255
265
|
if (newColumn[key] !== undefined) {
|
|
@@ -272,7 +282,7 @@ export const createColumnsState = ({
|
|
|
272
282
|
}
|
|
273
283
|
const columnsStateWithPreProcessing = apiRef.current.unstable_applyPipeProcessors('hydrateColumns', columnsState);
|
|
274
284
|
const columnsStateWithPortableColumns = applyInitialState(columnsStateWithPreProcessing, initialState);
|
|
275
|
-
return hydrateColumnsWidth(columnsStateWithPortableColumns, (_apiRef$current$getRo = (_apiRef$current$getRo2 = (_apiRef$current = apiRef.current).getRootDimensions) == null
|
|
285
|
+
return hydrateColumnsWidth(columnsStateWithPortableColumns, (_apiRef$current$getRo = (_apiRef$current$getRo2 = (_apiRef$current = apiRef.current).getRootDimensions) == null || (_apiRef$current$getRo2 = _apiRef$current$getRo2.call(_apiRef$current)) == null ? void 0 : _apiRef$current$getRo2.viewportInnerSize.width) != null ? _apiRef$current$getRo : 0);
|
|
276
286
|
};
|
|
277
287
|
export const mergeColumnsState = columnsState => state => _extends({}, state, {
|
|
278
288
|
columns: columnsState
|
|
@@ -11,13 +11,13 @@ import { getGridDefaultColumnTypes } from '../../../colDef';
|
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
const defaultColumnTypes = getGridDefaultColumnTypes();
|
|
13
13
|
export const columnsStateInitializer = (state, props, apiRef) => {
|
|
14
|
-
var _props$initialState, _ref, _props$columnVisibili, _props$initialState2
|
|
14
|
+
var _props$initialState, _ref, _props$columnVisibili, _props$initialState2;
|
|
15
15
|
const columnsState = createColumnsState({
|
|
16
16
|
apiRef,
|
|
17
17
|
columnTypes: defaultColumnTypes,
|
|
18
18
|
columnsToUpsert: props.columns,
|
|
19
19
|
initialState: (_props$initialState = props.initialState) == null ? void 0 : _props$initialState.columns,
|
|
20
|
-
columnVisibilityModel: (_ref = (_props$columnVisibili = props.columnVisibilityModel) != null ? _props$columnVisibili : (_props$initialState2 = props.initialState) == null
|
|
20
|
+
columnVisibilityModel: (_ref = (_props$columnVisibili = props.columnVisibilityModel) != null ? _props$columnVisibili : (_props$initialState2 = props.initialState) == null || (_props$initialState2 = _props$initialState2.columns) == null ? void 0 : _props$initialState2.columnVisibilityModel) != null ? _ref : {},
|
|
21
21
|
keepOnlyColumnsToUpsert: true
|
|
22
22
|
});
|
|
23
23
|
return _extends({}, state, {
|
|
@@ -160,7 +160,7 @@ export function useGridColumns(apiRef, props) {
|
|
|
160
160
|
* PRE-PROCESSING
|
|
161
161
|
*/
|
|
162
162
|
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
163
|
-
var _props$initialState$c, _props$initialState3
|
|
163
|
+
var _props$initialState$c, _props$initialState3;
|
|
164
164
|
const columnsStateToExport = {};
|
|
165
165
|
const columnVisibilityModelToExport = gridColumnVisibilityModelSelector(apiRef);
|
|
166
166
|
const shouldExportColumnVisibilityModel =
|
|
@@ -170,7 +170,7 @@ export function useGridColumns(apiRef, props) {
|
|
|
170
170
|
props.columnVisibilityModel != null ||
|
|
171
171
|
// Always export if the model has been initialized
|
|
172
172
|
// TODO v6 Do a nullish check instead to export even if the initial model equals "{}"
|
|
173
|
-
Object.keys((_props$initialState$c = (_props$initialState3 = props.initialState) == null
|
|
173
|
+
Object.keys((_props$initialState$c = (_props$initialState3 = props.initialState) == null || (_props$initialState3 = _props$initialState3.columns) == null ? void 0 : _props$initialState3.columnVisibilityModel) != null ? _props$initialState$c : {}).length > 0 ||
|
|
174
174
|
// Always export if the model is not empty
|
|
175
175
|
Object.keys(columnVisibilityModelToExport).length > 0;
|
|
176
176
|
if (shouldExportColumnVisibilityModel) {
|
|
@@ -81,7 +81,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
81
81
|
} else {
|
|
82
82
|
viewportOuterSize = {
|
|
83
83
|
width: rootDimensionsRef.current.width,
|
|
84
|
-
height: rootDimensionsRef.current.height - totalHeaderHeight
|
|
84
|
+
height: Math.max(rootDimensionsRef.current.height - totalHeaderHeight, 0)
|
|
85
85
|
};
|
|
86
86
|
const scrollInformation = hasScroll({
|
|
87
87
|
content: {
|
|
@@ -338,7 +338,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
340
|
const setCellEditingEditCellValue = React.useCallback(async params => {
|
|
341
|
-
var _editingState$id
|
|
341
|
+
var _editingState$id;
|
|
342
342
|
const {
|
|
343
343
|
id,
|
|
344
344
|
field,
|
|
@@ -388,7 +388,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
388
388
|
newProps.value = column.preProcessEditCellProps ? editingState[id][field].value : parsedValue;
|
|
389
389
|
updateOrDeleteFieldState(id, field, newProps);
|
|
390
390
|
editingState = gridEditRowsStateSelector(apiRef.current.state);
|
|
391
|
-
return !((_editingState$id = editingState[id]) != null && (_editingState$id
|
|
391
|
+
return !((_editingState$id = editingState[id]) != null && (_editingState$id = _editingState$id[field]) != null && _editingState$id.error);
|
|
392
392
|
}, [apiRef, throwIfNotEditable, throwIfNotInMode, updateOrDeleteFieldState]);
|
|
393
393
|
const getRowWithUpdatedValuesFromCellEditing = React.useCallback((id, field) => {
|
|
394
394
|
const column = apiRef.current.getColumn(field);
|
|
@@ -432,8 +432,8 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
432
432
|
|
|
433
433
|
Object.entries(cellModesModel).forEach(([id, fields]) => {
|
|
434
434
|
Object.entries(fields).forEach(([field, params]) => {
|
|
435
|
-
var _copyOfPrevCellModes$,
|
|
436
|
-
const prevMode = ((_copyOfPrevCellModes$ = copyOfPrevCellModes[id]) == null
|
|
435
|
+
var _copyOfPrevCellModes$, _idToIdLookup$id;
|
|
436
|
+
const prevMode = ((_copyOfPrevCellModes$ = copyOfPrevCellModes[id]) == null || (_copyOfPrevCellModes$ = _copyOfPrevCellModes$[field]) == null ? void 0 : _copyOfPrevCellModes$.mode) || GridCellModes.View;
|
|
437
437
|
const originalId = (_idToIdLookup$id = idToIdLookup[id]) != null ? _idToIdLookup$id : id;
|
|
438
438
|
if (params.mode === GridCellModes.Edit && prevMode === GridCellModes.View) {
|
|
439
439
|
updateStateToStartCellEditMode(_extends({
|
|
@@ -2,13 +2,11 @@ import { GRID_CHECKBOX_SELECTION_COL_DEF } from '../../../../colDef';
|
|
|
2
2
|
import { buildWarning } from '../../../../utils/warning';
|
|
3
3
|
function sanitizeCellValue(value, delimiterCharacter) {
|
|
4
4
|
if (typeof value === 'string') {
|
|
5
|
-
const formattedValue = value.replace(/"/g, '""');
|
|
6
|
-
|
|
7
5
|
// Make sure value containing delimiter or line break won't be split into multiple rows
|
|
8
|
-
if ([delimiterCharacter, '\n', '\r'].some(delimiter =>
|
|
9
|
-
return `"${
|
|
6
|
+
if ([delimiterCharacter, '\n', '\r', '"'].some(delimiter => value.includes(delimiter))) {
|
|
7
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
10
8
|
}
|
|
11
|
-
return
|
|
9
|
+
return value;
|
|
12
10
|
}
|
|
13
11
|
return value;
|
|
14
12
|
}
|