@mui/x-data-grid-generator 5.15.1 → 5.16.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 +142 -0
- package/README.md +1 -1
- package/hooks/useDemoData.js +4 -5
- package/index.js +1 -1
- package/legacy/hooks/useDemoData.js +4 -5
- package/legacy/index.js +1 -1
- package/legacy/renderer/renderEditStatus.js +45 -19
- package/modern/hooks/useDemoData.js +4 -5
- package/modern/index.js +1 -1
- package/modern/renderer/renderEditStatus.js +15 -13
- package/node/hooks/useDemoData.js +4 -5
- package/node/index.js +1 -1
- package/node/renderer/renderEditStatus.js +14 -12
- package/package.json +5 -5
- package/renderer/renderEditStatus.js +15 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,148 @@
|
|
|
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
|
+
## 5.16.0
|
|
7
|
+
|
|
8
|
+
_Aug 25, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 Introduce column grouping for data grid (#5133) @alexfauquette
|
|
13
|
+
|
|
14
|
+
You can now group columns using the `columnGroupingModel` prop. This lets you to display more structured data.
|
|
15
|
+
|
|
16
|
+
<img src="https://user-images.githubusercontent.com/45398769/186178366-4fba66b2-bf90-4c7a-9d83-940a7fc78704.png" width="800" />
|
|
17
|
+
|
|
18
|
+
To enable this feature, add `experimentalFeatures={{ columnGrouping: true }}`.
|
|
19
|
+
The grouping header can be fully customized.
|
|
20
|
+
See the [documentation](https://mui.com/x/react-data-grid/column-groups/) to explore everything it has to offer.
|
|
21
|
+
|
|
22
|
+
- 🐞 Bugfixes
|
|
23
|
+
- 🌏 New locales for pickers thanks to @tesseractjh and @drastus
|
|
24
|
+
|
|
25
|
+
### `@mui/x-data-grid@v5.16.0` / `@mui/x-data-grid-pro@v5.16.0` / `@mui/x-data-grid-premium@v5.16.0`
|
|
26
|
+
|
|
27
|
+
#### Changes
|
|
28
|
+
|
|
29
|
+
- [DataGrid] Implement column grouping (#5133) @alexfauquette
|
|
30
|
+
- [DataGrid] Handle `disableVirtualization` prop change (#5889) @cherniavskii
|
|
31
|
+
- [DataGrid] Improve `GridRowModel` typing (#5734) @cherniavskii
|
|
32
|
+
- [DataGrid] Update deprecation note for `GridColDef` `hide` property (#5886) @cherniavskii
|
|
33
|
+
|
|
34
|
+
### `@mui/x-date-pickers@v5.0.0-beta.7` / `@mui/x-date-pickers-pro@v5.0.0-beta.7`
|
|
35
|
+
|
|
36
|
+
#### Changes
|
|
37
|
+
|
|
38
|
+
- [DatePicker] Fix to pass down `className` prop provided on DatePicker to `renderInput` (#5471) @CruseCtrl
|
|
39
|
+
- [DatePicker] Improve `a11y` support (#5809) @LukasTy
|
|
40
|
+
- [pickers] Add `PaperContent` component slot (#5801) @LukasTy
|
|
41
|
+
- [pickers] Add a breaking change section in the migration guide (#5805) @alexfauquette
|
|
42
|
+
- [pickers] Add new translations to `localeText` (#5143) @alexfauquette
|
|
43
|
+
- [pickers] Document components slots (#4657) @flaviendelangle
|
|
44
|
+
- [pickers] Add new unstable field components (#5504) @flaviendelangle
|
|
45
|
+
- [pickers] Fallback to default `minDate` / `maxDate` when `null` value is passed (#5397) @flaviendelangle
|
|
46
|
+
- [l10n] Add Korean (ko-KR) locale (#5854) @tesseractjh
|
|
47
|
+
- [l10n] Add Polish (pl-PL) locale (#5833) @drastus
|
|
48
|
+
|
|
49
|
+
### Docs
|
|
50
|
+
|
|
51
|
+
- [docs] Fix typo in `migration from lab` (#5277) @chuckwired
|
|
52
|
+
- [docs] Use `dayjs` instead of `date-fns` in doc examples (#5481) @flaviendelangle
|
|
53
|
+
|
|
54
|
+
### Core
|
|
55
|
+
|
|
56
|
+
- [core] Clarify the scope of the license key used for tests and documentation (#5824) @oliviertassinari
|
|
57
|
+
- [core] Fix Typescript error on field hooks (#5892) @flaviendelangle
|
|
58
|
+
- [core] Memoize `columns` in `useDemoData` hook (#5848) @cherniavskii
|
|
59
|
+
- [core] Remove Firefox from the BrowserStack list (#5874) @DanailH
|
|
60
|
+
- [core] Small changes to the release script (#5840) @m4theushw
|
|
61
|
+
|
|
62
|
+
## 5.15.3
|
|
63
|
+
|
|
64
|
+
_Aug 18, 2022_
|
|
65
|
+
|
|
66
|
+
We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
67
|
+
|
|
68
|
+
- 📚 Documentation improvements
|
|
69
|
+
- 🐞 Bugfixes
|
|
70
|
+
|
|
71
|
+
### `@mui/x-data-grid@v5.15.3` / `@mui/x-data-grid-pro@v5.15.3` / `@mui/x-data-grid-premium@v5.15.3`
|
|
72
|
+
|
|
73
|
+
#### Changes
|
|
74
|
+
|
|
75
|
+
- [DataGrid] Fix <kbd>Enter</kbd> causing Select to re-open when commiting value (#5756) @m4theushw
|
|
76
|
+
- [DataGrid] Fix `GridOverlays` bypassing pointer events (#5674) @philjones88
|
|
77
|
+
|
|
78
|
+
### `@mui/x-date-pickers@v5.0.0-beta.6` / `@mui/x-date-picker-pro@v5.0.0-beta.6`
|
|
79
|
+
|
|
80
|
+
#### Changes
|
|
81
|
+
|
|
82
|
+
- [DatePicker] Support click on day outside of current month (#5768) @alexfauquette
|
|
83
|
+
- [pickers] Extend `PickersActionBarProps` with `DialogActionProps` (#5798) @LukasTy
|
|
84
|
+
|
|
85
|
+
### Docs
|
|
86
|
+
|
|
87
|
+
- [docs] Fix API anchor link scroll top (#5795) @oliviertassinari
|
|
88
|
+
- [docs] Fix contradiction in the free trial clause (#5732) @oliviertassinari
|
|
89
|
+
- [docs] Fix default value of the DataGrid `logLevel` prop to false (#5784) @HwangTaehyun
|
|
90
|
+
- [docs] Fix typo on the row height page (#5772) @flaviendelangle
|
|
91
|
+
- [docs] Improve "upgrading plans" documentation. (#5683) @joserodolfofreitas
|
|
92
|
+
- [docs] Link the license docs before pricing (#5726) @oliviertassinari
|
|
93
|
+
- [docs] Update packages README files (#5835) @cherniavskii
|
|
94
|
+
- [docs] Use `InputBase` for pickers inputs (#5597) @cherniavskii
|
|
95
|
+
|
|
96
|
+
### Core
|
|
97
|
+
|
|
98
|
+
- [core] Upgrade monorepo (#5771, #5797) @cherniavskii
|
|
99
|
+
- [core] Various TS improvements (#5556) @flaviendelangle
|
|
100
|
+
- [license] Give more context in the missing license (#5731) @oliviertassinari
|
|
101
|
+
- [license] Only log an error type once (#5730) @oliviertassinari
|
|
102
|
+
- [test] Increase timeout to take print screenshot (#5799) @m4theushw
|
|
103
|
+
|
|
104
|
+
## 5.15.2
|
|
105
|
+
|
|
106
|
+
_Aug 11, 2022_
|
|
107
|
+
|
|
108
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
109
|
+
|
|
110
|
+
- ✨ Improve quick filtering with row grouping (#5701) @alexfauquette
|
|
111
|
+
- 📚 Documentation improvements
|
|
112
|
+
- 🐞 Bugfixes
|
|
113
|
+
|
|
114
|
+
### `@mui/x-data-grid@v5.15.2` / `@mui/x-data-grid-pro@v5.15.2` / `@mui/x-data-grid-premium@v5.15.2`
|
|
115
|
+
|
|
116
|
+
#### Changes
|
|
117
|
+
|
|
118
|
+
- [DataGrid] Catch errors if rows freezing is not supported (#5711) @cherniavskii
|
|
119
|
+
- [DataGrid] Preserve cell mode when entering edit mode while commiting (#5686) @m4theushw
|
|
120
|
+
- [DataGridPremium] Let quick filter search in row grouping children (#5701) @alexfauquette
|
|
121
|
+
|
|
122
|
+
### `@mui/x-date-pickers@v5.0.0-beta.5` / `@mui/x-date-picker-pro@5.0.0-beta.5`
|
|
123
|
+
|
|
124
|
+
#### Changes
|
|
125
|
+
|
|
126
|
+
- [pickers] Add `react-dom` to peerDependencies (#5752) @cherniavskii
|
|
127
|
+
- [TimePicker] Set clock focus outline to `none` (#5758) @LukasTy
|
|
128
|
+
- [pickers] Fix theme augmentation with TypeScript (#5596) @alexfauquette
|
|
129
|
+
- [pickers] Reset input value when locale is modified (#5310) @alexfauquette
|
|
130
|
+
- [pickers] Support `disableHighlightToday` on `MonthPicker` and `YearPicker` (#5562) @flaviendelangle
|
|
131
|
+
- [pickers] Fallback to desktop mode when `matchMedia` is unavailable (#5684) @LukasTy
|
|
132
|
+
- [pickers] Trigger `onChange` when clearing or accepting `Invalid date` (#5740) @LukasTy
|
|
133
|
+
|
|
134
|
+
### Docs
|
|
135
|
+
|
|
136
|
+
- [docs] Add RFC GH issue template (#5739) @bytasv
|
|
137
|
+
- [docs] Add description to the `GridExportStateParams` page (#5654) @oliviertassinari
|
|
138
|
+
- [docs] Improve the Events page (#5413) @flaviendelangle
|
|
139
|
+
- [docs] Use new editing API in the introduction demos (#5728) @oliviertassinari
|
|
140
|
+
|
|
141
|
+
### Core
|
|
142
|
+
|
|
143
|
+
- [core] Remove duplicated `FUNDING.yml` file (#5656) @oliviertassinari
|
|
144
|
+
- [core] Remove outdated Next.js options (#5727) @oliviertassinari
|
|
145
|
+
- [core] Update tooling to run with React 18 (#4155) @m4theushw
|
|
146
|
+
- [test] Fix failing dynamic row height tests on Edge (#5707) @m4theushw
|
|
147
|
+
|
|
6
148
|
## 5.15.1
|
|
7
149
|
|
|
8
150
|
_Aug 4, 2022_
|
package/README.md
CHANGED
package/hooks/useDemoData.js
CHANGED
|
@@ -113,7 +113,7 @@ export const useDemoData = options => {
|
|
|
113
113
|
const [rowLength, setRowLength] = React.useState(options.rowLength);
|
|
114
114
|
const [index, setIndex] = React.useState(0);
|
|
115
115
|
const [loading, setLoading] = React.useState(true);
|
|
116
|
-
const
|
|
116
|
+
const columns = React.useMemo(() => {
|
|
117
117
|
return getColumnsFromOptions({
|
|
118
118
|
dataSet: options.dataSet,
|
|
119
119
|
editable: options.editable,
|
|
@@ -122,7 +122,6 @@ export const useDemoData = options => {
|
|
|
122
122
|
});
|
|
123
123
|
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields]);
|
|
124
124
|
const [data, setData] = React.useState(() => {
|
|
125
|
-
const columns = getColumns();
|
|
126
125
|
return addTreeDataOptionsToDemoData({
|
|
127
126
|
columns,
|
|
128
127
|
rows: [],
|
|
@@ -149,10 +148,10 @@ export const useDemoData = options => {
|
|
|
149
148
|
let newData;
|
|
150
149
|
|
|
151
150
|
if (rowLength > 1000) {
|
|
152
|
-
newData = await getRealGridData(1000,
|
|
151
|
+
newData = await getRealGridData(1000, columns);
|
|
153
152
|
newData = await extrapolateSeed(rowLength, newData);
|
|
154
153
|
} else {
|
|
155
|
-
newData = await getRealGridData(rowLength,
|
|
154
|
+
newData = await getRealGridData(rowLength, columns);
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
if (!active) {
|
|
@@ -177,7 +176,7 @@ export const useDemoData = options => {
|
|
|
177
176
|
return () => {
|
|
178
177
|
active = false;
|
|
179
178
|
};
|
|
180
|
-
}, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index,
|
|
179
|
+
}, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index, columns]);
|
|
181
180
|
return {
|
|
182
181
|
data,
|
|
183
182
|
loading,
|
package/index.js
CHANGED
|
@@ -166,7 +166,7 @@ export var useDemoData = function useDemoData(options) {
|
|
|
166
166
|
loading = _React$useState6[0],
|
|
167
167
|
setLoading = _React$useState6[1];
|
|
168
168
|
|
|
169
|
-
var
|
|
169
|
+
var columns = React.useMemo(function () {
|
|
170
170
|
return getColumnsFromOptions({
|
|
171
171
|
dataSet: options.dataSet,
|
|
172
172
|
editable: options.editable,
|
|
@@ -176,7 +176,6 @@ export var useDemoData = function useDemoData(options) {
|
|
|
176
176
|
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields]);
|
|
177
177
|
|
|
178
178
|
var _React$useState7 = React.useState(function () {
|
|
179
|
-
var columns = getColumns();
|
|
180
179
|
return addTreeDataOptionsToDemoData({
|
|
181
180
|
columns: columns,
|
|
182
181
|
rows: [],
|
|
@@ -216,7 +215,7 @@ export var useDemoData = function useDemoData(options) {
|
|
|
216
215
|
}
|
|
217
216
|
|
|
218
217
|
_context.next = 4;
|
|
219
|
-
return getRealGridData(1000,
|
|
218
|
+
return getRealGridData(1000, columns);
|
|
220
219
|
|
|
221
220
|
case 4:
|
|
222
221
|
newData = _context.sent;
|
|
@@ -230,7 +229,7 @@ export var useDemoData = function useDemoData(options) {
|
|
|
230
229
|
|
|
231
230
|
case 10:
|
|
232
231
|
_context.next = 12;
|
|
233
|
-
return getRealGridData(rowLength,
|
|
232
|
+
return getRealGridData(rowLength, columns);
|
|
234
233
|
|
|
235
234
|
case 12:
|
|
236
235
|
newData = _context.sent;
|
|
@@ -269,7 +268,7 @@ export var useDemoData = function useDemoData(options) {
|
|
|
269
268
|
return function () {
|
|
270
269
|
active = false;
|
|
271
270
|
};
|
|
272
|
-
}, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index,
|
|
271
|
+
}, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index, columns]);
|
|
273
272
|
return {
|
|
274
273
|
data: data,
|
|
275
274
|
loading: loading,
|
package/legacy/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
4
|
import * as React from 'react';
|
|
3
|
-
import { useGridApiContext } from '@mui/x-data-grid-premium';
|
|
5
|
+
import { useGridApiContext, useGridRootProps, GridEditModes } from '@mui/x-data-grid-premium';
|
|
4
6
|
import Select from '@mui/material/Select';
|
|
5
7
|
import MenuItem from '@mui/material/MenuItem';
|
|
6
8
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
@@ -17,30 +19,54 @@ function EditStatus(props) {
|
|
|
17
19
|
var id = props.id,
|
|
18
20
|
value = props.value,
|
|
19
21
|
field = props.field;
|
|
22
|
+
var rootProps = useGridRootProps();
|
|
20
23
|
var apiRef = useGridApiContext();
|
|
21
24
|
|
|
22
|
-
var handleChange = function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
var handleChange = /*#__PURE__*/function () {
|
|
26
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
27
|
+
var isValid;
|
|
28
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
29
|
+
while (1) {
|
|
30
|
+
switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
_context.next = 2;
|
|
33
|
+
return apiRef.current.setEditCellValue({
|
|
34
|
+
id: id,
|
|
35
|
+
field: field,
|
|
36
|
+
value: event.target.value
|
|
37
|
+
});
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
case 2:
|
|
40
|
+
isValid = _context.sent;
|
|
41
|
+
|
|
42
|
+
if (isValid && rootProps.editMode === GridEditModes.Cell) {
|
|
43
|
+
apiRef.current.stopCellEditMode({
|
|
44
|
+
id: id,
|
|
45
|
+
field: field,
|
|
46
|
+
cellToFocusAfter: 'below'
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
case 4:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context.stop();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, _callee);
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
return function handleChange(_x) {
|
|
59
|
+
return _ref.apply(this, arguments);
|
|
60
|
+
};
|
|
61
|
+
}();
|
|
40
62
|
|
|
41
63
|
var handleClose = function handleClose(event, reason) {
|
|
42
64
|
if (reason === 'backdropClick') {
|
|
43
|
-
apiRef.current.
|
|
65
|
+
apiRef.current.stopCellEditMode({
|
|
66
|
+
id: id,
|
|
67
|
+
field: field,
|
|
68
|
+
ignoreModifications: true
|
|
69
|
+
});
|
|
44
70
|
}
|
|
45
71
|
};
|
|
46
72
|
|
|
@@ -105,7 +105,7 @@ export const useDemoData = options => {
|
|
|
105
105
|
const [rowLength, setRowLength] = React.useState(options.rowLength);
|
|
106
106
|
const [index, setIndex] = React.useState(0);
|
|
107
107
|
const [loading, setLoading] = React.useState(true);
|
|
108
|
-
const
|
|
108
|
+
const columns = React.useMemo(() => {
|
|
109
109
|
return getColumnsFromOptions({
|
|
110
110
|
dataSet: options.dataSet,
|
|
111
111
|
editable: options.editable,
|
|
@@ -114,7 +114,6 @@ export const useDemoData = options => {
|
|
|
114
114
|
});
|
|
115
115
|
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields]);
|
|
116
116
|
const [data, setData] = React.useState(() => {
|
|
117
|
-
const columns = getColumns();
|
|
118
117
|
return addTreeDataOptionsToDemoData({
|
|
119
118
|
columns,
|
|
120
119
|
rows: [],
|
|
@@ -139,10 +138,10 @@ export const useDemoData = options => {
|
|
|
139
138
|
let newData;
|
|
140
139
|
|
|
141
140
|
if (rowLength > 1000) {
|
|
142
|
-
newData = await getRealGridData(1000,
|
|
141
|
+
newData = await getRealGridData(1000, columns);
|
|
143
142
|
newData = await extrapolateSeed(rowLength, newData);
|
|
144
143
|
} else {
|
|
145
|
-
newData = await getRealGridData(rowLength,
|
|
144
|
+
newData = await getRealGridData(rowLength, columns);
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
if (!active) {
|
|
@@ -167,7 +166,7 @@ export const useDemoData = options => {
|
|
|
167
166
|
return () => {
|
|
168
167
|
active = false;
|
|
169
168
|
};
|
|
170
|
-
}, [rowLength, options.dataSet, options.maxColumns, options.treeData?.maxDepth, options.treeData?.groupingField, options.treeData?.averageChildren, index,
|
|
169
|
+
}, [rowLength, options.dataSet, options.maxColumns, options.treeData?.maxDepth, options.treeData?.groupingField, options.treeData?.averageChildren, index, columns]);
|
|
171
170
|
return {
|
|
172
171
|
data,
|
|
173
172
|
loading,
|
package/modern/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useGridApiContext } from '@mui/x-data-grid-premium';
|
|
3
|
+
import { useGridApiContext, useGridRootProps, GridEditModes } from '@mui/x-data-grid-premium';
|
|
4
4
|
import Select from '@mui/material/Select';
|
|
5
5
|
import MenuItem from '@mui/material/MenuItem';
|
|
6
6
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
@@ -19,30 +19,32 @@ function EditStatus(props) {
|
|
|
19
19
|
value,
|
|
20
20
|
field
|
|
21
21
|
} = props;
|
|
22
|
+
const rootProps = useGridRootProps();
|
|
22
23
|
const apiRef = useGridApiContext();
|
|
23
24
|
|
|
24
|
-
const handleChange = event => {
|
|
25
|
-
apiRef.current.setEditCellValue({
|
|
25
|
+
const handleChange = async event => {
|
|
26
|
+
const isValid = await apiRef.current.setEditCellValue({
|
|
26
27
|
id,
|
|
27
28
|
field,
|
|
28
29
|
value: event.target.value
|
|
29
|
-
}, event);
|
|
30
|
-
apiRef.current.commitCellChange({
|
|
31
|
-
id,
|
|
32
|
-
field
|
|
33
30
|
});
|
|
34
|
-
apiRef.current.setCellMode(id, field, 'view');
|
|
35
31
|
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
if (isValid && rootProps.editMode === GridEditModes.Cell) {
|
|
33
|
+
apiRef.current.stopCellEditMode({
|
|
34
|
+
id,
|
|
35
|
+
field,
|
|
36
|
+
cellToFocusAfter: 'below'
|
|
37
|
+
});
|
|
40
38
|
}
|
|
41
39
|
};
|
|
42
40
|
|
|
43
41
|
const handleClose = (event, reason) => {
|
|
44
42
|
if (reason === 'backdropClick') {
|
|
45
|
-
apiRef.current.
|
|
43
|
+
apiRef.current.stopCellEditMode({
|
|
44
|
+
id,
|
|
45
|
+
field,
|
|
46
|
+
ignoreModifications: true
|
|
47
|
+
});
|
|
46
48
|
}
|
|
47
49
|
};
|
|
48
50
|
|
|
@@ -140,7 +140,7 @@ const useDemoData = options => {
|
|
|
140
140
|
const [rowLength, setRowLength] = React.useState(options.rowLength);
|
|
141
141
|
const [index, setIndex] = React.useState(0);
|
|
142
142
|
const [loading, setLoading] = React.useState(true);
|
|
143
|
-
const
|
|
143
|
+
const columns = React.useMemo(() => {
|
|
144
144
|
return getColumnsFromOptions({
|
|
145
145
|
dataSet: options.dataSet,
|
|
146
146
|
editable: options.editable,
|
|
@@ -149,7 +149,6 @@ const useDemoData = options => {
|
|
|
149
149
|
});
|
|
150
150
|
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields]);
|
|
151
151
|
const [data, setData] = React.useState(() => {
|
|
152
|
-
const columns = getColumns();
|
|
153
152
|
return (0, _treeDataGenerator.addTreeDataOptionsToDemoData)({
|
|
154
153
|
columns,
|
|
155
154
|
rows: [],
|
|
@@ -176,10 +175,10 @@ const useDemoData = options => {
|
|
|
176
175
|
let newData;
|
|
177
176
|
|
|
178
177
|
if (rowLength > 1000) {
|
|
179
|
-
newData = await (0, _realDataService.getRealGridData)(1000,
|
|
178
|
+
newData = await (0, _realDataService.getRealGridData)(1000, columns);
|
|
180
179
|
newData = await extrapolateSeed(rowLength, newData);
|
|
181
180
|
} else {
|
|
182
|
-
newData = await (0, _realDataService.getRealGridData)(rowLength,
|
|
181
|
+
newData = await (0, _realDataService.getRealGridData)(rowLength, columns);
|
|
183
182
|
}
|
|
184
183
|
|
|
185
184
|
if (!active) {
|
|
@@ -204,7 +203,7 @@ const useDemoData = options => {
|
|
|
204
203
|
return () => {
|
|
205
204
|
active = false;
|
|
206
205
|
};
|
|
207
|
-
}, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index,
|
|
206
|
+
}, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index, columns]);
|
|
208
207
|
return {
|
|
209
208
|
data,
|
|
210
209
|
loading,
|
package/node/index.js
CHANGED
|
@@ -43,30 +43,32 @@ function EditStatus(props) {
|
|
|
43
43
|
value,
|
|
44
44
|
field
|
|
45
45
|
} = props;
|
|
46
|
+
const rootProps = (0, _xDataGridPremium.useGridRootProps)();
|
|
46
47
|
const apiRef = (0, _xDataGridPremium.useGridApiContext)();
|
|
47
48
|
|
|
48
|
-
const handleChange = event => {
|
|
49
|
-
apiRef.current.setEditCellValue({
|
|
49
|
+
const handleChange = async event => {
|
|
50
|
+
const isValid = await apiRef.current.setEditCellValue({
|
|
50
51
|
id,
|
|
51
52
|
field,
|
|
52
53
|
value: event.target.value
|
|
53
|
-
}, event);
|
|
54
|
-
apiRef.current.commitCellChange({
|
|
55
|
-
id,
|
|
56
|
-
field
|
|
57
54
|
});
|
|
58
|
-
apiRef.current.setCellMode(id, field, 'view');
|
|
59
55
|
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
if (isValid && rootProps.editMode === _xDataGridPremium.GridEditModes.Cell) {
|
|
57
|
+
apiRef.current.stopCellEditMode({
|
|
58
|
+
id,
|
|
59
|
+
field,
|
|
60
|
+
cellToFocusAfter: 'below'
|
|
61
|
+
});
|
|
64
62
|
}
|
|
65
63
|
};
|
|
66
64
|
|
|
67
65
|
const handleClose = (event, reason) => {
|
|
68
66
|
if (reason === 'backdropClick') {
|
|
69
|
-
apiRef.current.
|
|
67
|
+
apiRef.current.stopCellEditMode({
|
|
68
|
+
id,
|
|
69
|
+
field,
|
|
70
|
+
ignoreModifications: true
|
|
71
|
+
});
|
|
70
72
|
}
|
|
71
73
|
};
|
|
72
74
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-generator",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.16.0",
|
|
4
4
|
"description": "Generate fake data for demo purposes only.",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"directory": "packages/grid/x-data-grid-generator"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@babel/runtime": "^7.18.
|
|
23
|
-
"@mui/base": "^5.0.0-alpha.
|
|
24
|
-
"@mui/x-data-grid-premium": "5.
|
|
22
|
+
"@babel/runtime": "^7.18.9",
|
|
23
|
+
"@mui/base": "^5.0.0-alpha.94",
|
|
24
|
+
"@mui/x-data-grid-premium": "5.16.0",
|
|
25
25
|
"chance": "^1.1.8",
|
|
26
26
|
"clsx": "^1.2.1",
|
|
27
|
-
"lru-cache": "^7.
|
|
27
|
+
"lru-cache": "^7.14.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@mui/icons-material": "^5.4.1",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { useGridApiContext } from '@mui/x-data-grid-premium';
|
|
3
|
+
import { useGridApiContext, useGridRootProps, GridEditModes } from '@mui/x-data-grid-premium';
|
|
4
4
|
import Select from '@mui/material/Select';
|
|
5
5
|
import MenuItem from '@mui/material/MenuItem';
|
|
6
6
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
@@ -19,30 +19,32 @@ function EditStatus(props) {
|
|
|
19
19
|
value,
|
|
20
20
|
field
|
|
21
21
|
} = props;
|
|
22
|
+
const rootProps = useGridRootProps();
|
|
22
23
|
const apiRef = useGridApiContext();
|
|
23
24
|
|
|
24
|
-
const handleChange = event => {
|
|
25
|
-
apiRef.current.setEditCellValue({
|
|
25
|
+
const handleChange = async event => {
|
|
26
|
+
const isValid = await apiRef.current.setEditCellValue({
|
|
26
27
|
id,
|
|
27
28
|
field,
|
|
28
29
|
value: event.target.value
|
|
29
|
-
}, event);
|
|
30
|
-
apiRef.current.commitCellChange({
|
|
31
|
-
id,
|
|
32
|
-
field
|
|
33
30
|
});
|
|
34
|
-
apiRef.current.setCellMode(id, field, 'view');
|
|
35
31
|
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
32
|
+
if (isValid && rootProps.editMode === GridEditModes.Cell) {
|
|
33
|
+
apiRef.current.stopCellEditMode({
|
|
34
|
+
id,
|
|
35
|
+
field,
|
|
36
|
+
cellToFocusAfter: 'below'
|
|
37
|
+
});
|
|
40
38
|
}
|
|
41
39
|
};
|
|
42
40
|
|
|
43
41
|
const handleClose = (event, reason) => {
|
|
44
42
|
if (reason === 'backdropClick') {
|
|
45
|
-
apiRef.current.
|
|
43
|
+
apiRef.current.stopCellEditMode({
|
|
44
|
+
id,
|
|
45
|
+
field,
|
|
46
|
+
ignoreModifications: true
|
|
47
|
+
});
|
|
46
48
|
}
|
|
47
49
|
};
|
|
48
50
|
|