@mui/x-data-grid-generator 6.0.0-alpha.2 → 6.0.0-alpha.4

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v6.0.0-alpha.2
1
+ /** @license MUI v6.0.0-alpha.4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v6.0.0-alpha.2
1
+ /** @license MUI v6.0.0-alpha.4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -1,5 +1,7 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
1
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
5
  import * as React from 'react';
4
6
  import { useGridApiContext } from '@mui/x-data-grid-premium';
5
7
  import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete';
@@ -28,21 +30,37 @@ function EditCountry(props) {
28
30
  value = props.value,
29
31
  field = props.field;
30
32
  var apiRef = useGridApiContext();
31
- var handleChange = React.useCallback(function (event, newValue) {
32
- apiRef.current.setEditCellValue({
33
- id: id,
34
- field: field,
35
- value: newValue
36
- }, event);
33
+ var handleChange = React.useCallback( /*#__PURE__*/function () {
34
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event, newValue) {
35
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
36
+ while (1) {
37
+ switch (_context.prev = _context.next) {
38
+ case 0:
39
+ _context.next = 2;
40
+ return apiRef.current.setEditCellValue({
41
+ id: id,
42
+ field: field,
43
+ value: newValue
44
+ }, event);
37
45
 
38
- if (!event.key) {
39
- apiRef.current.commitCellChange({
40
- id: id,
41
- field: field
42
- });
43
- apiRef.current.setCellMode(id, field, 'view');
44
- }
45
- }, [apiRef, field, id]);
46
+ case 2:
47
+ apiRef.current.stopCellEditMode({
48
+ id: id,
49
+ field: field
50
+ });
51
+
52
+ case 3:
53
+ case "end":
54
+ return _context.stop();
55
+ }
56
+ }
57
+ }, _callee);
58
+ }));
59
+
60
+ return function (_x, _x2) {
61
+ return _ref3.apply(this, arguments);
62
+ };
63
+ }(), [apiRef, field, id]);
46
64
  return /*#__PURE__*/_jsx(StyledAutocomplete, {
47
65
  value: value,
48
66
  onChange: handleChange,
@@ -1,5 +1,7 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
1
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
3
5
  import * as React from 'react';
4
6
  import { useGridApiContext } from '@mui/x-data-grid-premium';
5
7
  import Autocomplete, { autocompleteClasses } from '@mui/material/Autocomplete';
@@ -28,21 +30,37 @@ function EditCurrency(props) {
28
30
  value = props.value,
29
31
  field = props.field;
30
32
  var apiRef = useGridApiContext();
31
- var handleChange = React.useCallback(function (event, newValue) {
32
- apiRef.current.setEditCellValue({
33
- id: id,
34
- field: field,
35
- value: newValue.toUpperCase()
36
- }, event);
33
+ var handleChange = React.useCallback( /*#__PURE__*/function () {
34
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event, newValue) {
35
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
36
+ while (1) {
37
+ switch (_context.prev = _context.next) {
38
+ case 0:
39
+ _context.next = 2;
40
+ return apiRef.current.setEditCellValue({
41
+ id: id,
42
+ field: field,
43
+ value: newValue.toUpperCase()
44
+ }, event);
37
45
 
38
- if (!event.key) {
39
- apiRef.current.commitCellChange({
40
- id: id,
41
- field: field
42
- });
43
- apiRef.current.setCellMode(id, field, 'view');
44
- }
45
- }, [apiRef, field, id]);
46
+ case 2:
47
+ apiRef.current.stopCellEditMode({
48
+ id: id,
49
+ field: field
50
+ });
51
+
52
+ case 3:
53
+ case "end":
54
+ return _context.stop();
55
+ }
56
+ }
57
+ }, _callee);
58
+ }));
59
+
60
+ return function (_x, _x2) {
61
+ return _ref3.apply(this, arguments);
62
+ };
63
+ }(), [apiRef, field, id]);
46
64
  return /*#__PURE__*/_jsx(StyledAutocomplete, {
47
65
  value: value,
48
66
  onChange: handleChange,
@@ -1,4 +1,6 @@
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
5
  import { useGridApiContext } from '@mui/x-data-grid-premium';
4
6
  import Select from '@mui/material/Select';
@@ -15,28 +17,44 @@ function EditIncoterm(props) {
15
17
  field = props.field;
16
18
  var apiRef = useGridApiContext();
17
19
 
18
- var handleChange = function handleChange(event) {
19
- apiRef.current.setEditCellValue({
20
- id: id,
21
- field: field,
22
- value: event.target.value
23
- }, event);
24
- apiRef.current.commitCellChange({
25
- id: id,
26
- field: field
27
- });
28
- apiRef.current.setCellMode(id, field, 'view');
20
+ var handleChange = /*#__PURE__*/function () {
21
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
22
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
23
+ while (1) {
24
+ switch (_context.prev = _context.next) {
25
+ case 0:
26
+ _context.next = 2;
27
+ return apiRef.current.setEditCellValue({
28
+ id: id,
29
+ field: field,
30
+ value: event.target.value
31
+ }, event);
29
32
 
30
- if (event.key) {
31
- // TODO v6: remove once we stop ignoring events fired from portals
32
- var params = apiRef.current.getCellParams(id, field);
33
- apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
34
- }
35
- };
33
+ case 2:
34
+ apiRef.current.stopCellEditMode({
35
+ id: id,
36
+ field: field
37
+ });
38
+
39
+ case 3:
40
+ case "end":
41
+ return _context.stop();
42
+ }
43
+ }
44
+ }, _callee);
45
+ }));
46
+
47
+ return function handleChange(_x) {
48
+ return _ref.apply(this, arguments);
49
+ };
50
+ }();
36
51
 
37
52
  var handleClose = function handleClose(event, reason) {
38
53
  if (reason === 'backdropClick') {
39
- apiRef.current.setCellMode(id, field, 'view');
54
+ apiRef.current.stopCellEditMode({
55
+ id: id,
56
+ field: field
57
+ });
40
58
  }
41
59
  };
42
60
 
@@ -1,4 +1,6 @@
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
5
  import Box from '@mui/material/Box';
4
6
  import Rating from '@mui/material/Rating';
@@ -12,22 +14,37 @@ function EditRating(props) {
12
14
  field = props.field;
13
15
  var apiRef = useGridApiContext();
14
16
 
15
- var handleChange = function handleChange(event) {
16
- apiRef.current.setEditCellValue({
17
- id: id,
18
- field: field,
19
- value: Number(event.target.value)
20
- }, event); // Check if the event is not from the keyboard
21
- // https://github.com/facebook/react/issues/7407
22
-
23
- if (event.nativeEvent.clientX !== 0 && event.nativeEvent.clientY !== 0) {
24
- apiRef.current.commitCellChange({
25
- id: id,
26
- field: field
27
- });
28
- apiRef.current.setCellMode(id, field, 'view');
29
- }
30
- };
17
+ var handleChange = /*#__PURE__*/function () {
18
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
19
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
20
+ while (1) {
21
+ switch (_context.prev = _context.next) {
22
+ case 0:
23
+ _context.next = 2;
24
+ return apiRef.current.setEditCellValue({
25
+ id: id,
26
+ field: field,
27
+ value: Number(event.target.value)
28
+ }, event);
29
+
30
+ case 2:
31
+ apiRef.current.stopCellEditMode({
32
+ id: id,
33
+ field: field
34
+ });
35
+
36
+ case 3:
37
+ case "end":
38
+ return _context.stop();
39
+ }
40
+ }
41
+ }, _callee);
42
+ }));
43
+
44
+ return function handleChange(_x) {
45
+ return _ref.apply(this, arguments);
46
+ };
47
+ }();
31
48
 
32
49
  var handleRef = function handleRef(element) {
33
50
  if (element) {
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v6.0.0-alpha.2
1
+ /** @license MUI v6.0.0-alpha.4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -29,20 +29,16 @@ function EditCountry(props) {
29
29
  field
30
30
  } = props;
31
31
  const apiRef = useGridApiContext();
32
- const handleChange = React.useCallback((event, newValue) => {
33
- apiRef.current.setEditCellValue({
32
+ const handleChange = React.useCallback(async (event, newValue) => {
33
+ await apiRef.current.setEditCellValue({
34
34
  id,
35
35
  field,
36
36
  value: newValue
37
37
  }, event);
38
-
39
- if (!event.key) {
40
- apiRef.current.commitCellChange({
41
- id,
42
- field
43
- });
44
- apiRef.current.setCellMode(id, field, 'view');
45
- }
38
+ apiRef.current.stopCellEditMode({
39
+ id,
40
+ field
41
+ });
46
42
  }, [apiRef, field, id]);
47
43
  return /*#__PURE__*/_jsx(StyledAutocomplete, {
48
44
  value: value,
@@ -29,20 +29,16 @@ function EditCurrency(props) {
29
29
  field
30
30
  } = props;
31
31
  const apiRef = useGridApiContext();
32
- const handleChange = React.useCallback((event, newValue) => {
33
- apiRef.current.setEditCellValue({
32
+ const handleChange = React.useCallback(async (event, newValue) => {
33
+ await apiRef.current.setEditCellValue({
34
34
  id,
35
35
  field,
36
36
  value: newValue.toUpperCase()
37
37
  }, event);
38
-
39
- if (!event.key) {
40
- apiRef.current.commitCellChange({
41
- id,
42
- field
43
- });
44
- apiRef.current.setCellMode(id, field, 'view');
45
- }
38
+ apiRef.current.stopCellEditMode({
39
+ id,
40
+ field
41
+ });
46
42
  }, [apiRef, field, id]);
47
43
  return /*#__PURE__*/_jsx(StyledAutocomplete, {
48
44
  value: value,
@@ -17,28 +17,24 @@ function EditIncoterm(props) {
17
17
  } = props;
18
18
  const apiRef = useGridApiContext();
19
19
 
20
- const handleChange = event => {
21
- apiRef.current.setEditCellValue({
20
+ const handleChange = async event => {
21
+ await apiRef.current.setEditCellValue({
22
22
  id,
23
23
  field,
24
24
  value: event.target.value
25
25
  }, event);
26
- apiRef.current.commitCellChange({
26
+ apiRef.current.stopCellEditMode({
27
27
  id,
28
28
  field
29
29
  });
30
- apiRef.current.setCellMode(id, field, 'view');
31
-
32
- if (event.key) {
33
- // TODO v6: remove once we stop ignoring events fired from portals
34
- const params = apiRef.current.getCellParams(id, field);
35
- apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
36
- }
37
30
  };
38
31
 
39
32
  const handleClose = (event, reason) => {
40
33
  if (reason === 'backdropClick') {
41
- apiRef.current.setCellMode(id, field, 'view');
34
+ apiRef.current.stopCellEditMode({
35
+ id,
36
+ field
37
+ });
42
38
  }
43
39
  };
44
40
 
@@ -14,21 +14,16 @@ function EditRating(props) {
14
14
  } = props;
15
15
  const apiRef = useGridApiContext();
16
16
 
17
- const handleChange = event => {
18
- apiRef.current.setEditCellValue({
17
+ const handleChange = async event => {
18
+ await apiRef.current.setEditCellValue({
19
19
  id,
20
20
  field,
21
21
  value: Number(event.target.value)
22
- }, event); // Check if the event is not from the keyboard
23
- // https://github.com/facebook/react/issues/7407
24
-
25
- if (event.nativeEvent.clientX !== 0 && event.nativeEvent.clientY !== 0) {
26
- apiRef.current.commitCellChange({
27
- id,
28
- field
29
- });
30
- apiRef.current.setCellMode(id, field, 'view');
31
- }
22
+ }, event);
23
+ apiRef.current.stopCellEditMode({
24
+ id,
25
+ field
26
+ });
32
27
  };
33
28
 
34
29
  const handleRef = element => {
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v6.0.0-alpha.2
1
+ /** @license MUI v6.0.0-alpha.4
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -50,20 +50,16 @@ function EditCountry(props) {
50
50
  field
51
51
  } = props;
52
52
  const apiRef = (0, _xDataGridPremium.useGridApiContext)();
53
- const handleChange = React.useCallback((event, newValue) => {
54
- apiRef.current.setEditCellValue({
53
+ const handleChange = React.useCallback(async (event, newValue) => {
54
+ await apiRef.current.setEditCellValue({
55
55
  id,
56
56
  field,
57
57
  value: newValue
58
58
  }, event);
59
-
60
- if (!event.key) {
61
- apiRef.current.commitCellChange({
62
- id,
63
- field
64
- });
65
- apiRef.current.setCellMode(id, field, 'view');
66
- }
59
+ apiRef.current.stopCellEditMode({
60
+ id,
61
+ field
62
+ });
67
63
  }, [apiRef, field, id]);
68
64
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledAutocomplete, {
69
65
  value: value,
@@ -50,20 +50,16 @@ function EditCurrency(props) {
50
50
  field
51
51
  } = props;
52
52
  const apiRef = (0, _xDataGridPremium.useGridApiContext)();
53
- const handleChange = React.useCallback((event, newValue) => {
54
- apiRef.current.setEditCellValue({
53
+ const handleChange = React.useCallback(async (event, newValue) => {
54
+ await apiRef.current.setEditCellValue({
55
55
  id,
56
56
  field,
57
57
  value: newValue.toUpperCase()
58
58
  }, event);
59
-
60
- if (!event.key) {
61
- apiRef.current.commitCellChange({
62
- id,
63
- field
64
- });
65
- apiRef.current.setCellMode(id, field, 'view');
66
- }
59
+ apiRef.current.stopCellEditMode({
60
+ id,
61
+ field
62
+ });
67
63
  }, [apiRef, field, id]);
68
64
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledAutocomplete, {
69
65
  value: value,
@@ -37,28 +37,24 @@ function EditIncoterm(props) {
37
37
  } = props;
38
38
  const apiRef = (0, _xDataGridPremium.useGridApiContext)();
39
39
 
40
- const handleChange = event => {
41
- apiRef.current.setEditCellValue({
40
+ const handleChange = async event => {
41
+ await apiRef.current.setEditCellValue({
42
42
  id,
43
43
  field,
44
44
  value: event.target.value
45
45
  }, event);
46
- apiRef.current.commitCellChange({
46
+ apiRef.current.stopCellEditMode({
47
47
  id,
48
48
  field
49
49
  });
50
- apiRef.current.setCellMode(id, field, 'view');
51
-
52
- if (event.key) {
53
- // TODO v6: remove once we stop ignoring events fired from portals
54
- const params = apiRef.current.getCellParams(id, field);
55
- apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
56
- }
57
50
  };
58
51
 
59
52
  const handleClose = (event, reason) => {
60
53
  if (reason === 'backdropClick') {
61
- apiRef.current.setCellMode(id, field, 'view');
54
+ apiRef.current.stopCellEditMode({
55
+ id,
56
+ field
57
+ });
62
58
  }
63
59
  };
64
60
 
@@ -31,21 +31,16 @@ function EditRating(props) {
31
31
  } = props;
32
32
  const apiRef = (0, _xDataGridPremium.useGridApiContext)();
33
33
 
34
- const handleChange = event => {
35
- apiRef.current.setEditCellValue({
34
+ const handleChange = async event => {
35
+ await apiRef.current.setEditCellValue({
36
36
  id,
37
37
  field,
38
38
  value: Number(event.target.value)
39
- }, event); // Check if the event is not from the keyboard
40
- // https://github.com/facebook/react/issues/7407
41
-
42
- if (event.nativeEvent.clientX !== 0 && event.nativeEvent.clientY !== 0) {
43
- apiRef.current.commitCellChange({
44
- id,
45
- field
46
- });
47
- apiRef.current.setCellMode(id, field, 'view');
48
- }
39
+ }, event);
40
+ apiRef.current.stopCellEditMode({
41
+ id,
42
+ field
43
+ });
49
44
  };
50
45
 
51
46
  const handleRef = element => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-generator",
3
- "version": "6.0.0-alpha.2",
3
+ "version": "6.0.0-alpha.4",
4
4
  "description": "Generate fake data for demo purposes only.",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -20,8 +20,8 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@babel/runtime": "^7.19.0",
23
- "@mui/base": "^5.0.0-alpha.98",
24
- "@mui/x-data-grid-premium": "6.0.0-alpha.2",
23
+ "@mui/base": "^5.0.0-alpha.101",
24
+ "@mui/x-data-grid-premium": "6.0.0-alpha.4",
25
25
  "chance": "^1.1.8",
26
26
  "clsx": "^1.2.1",
27
27
  "lru-cache": "^7.14.0"
@@ -29,20 +29,16 @@ function EditCountry(props) {
29
29
  field
30
30
  } = props;
31
31
  const apiRef = useGridApiContext();
32
- const handleChange = React.useCallback((event, newValue) => {
33
- apiRef.current.setEditCellValue({
32
+ const handleChange = React.useCallback(async (event, newValue) => {
33
+ await apiRef.current.setEditCellValue({
34
34
  id,
35
35
  field,
36
36
  value: newValue
37
37
  }, event);
38
-
39
- if (!event.key) {
40
- apiRef.current.commitCellChange({
41
- id,
42
- field
43
- });
44
- apiRef.current.setCellMode(id, field, 'view');
45
- }
38
+ apiRef.current.stopCellEditMode({
39
+ id,
40
+ field
41
+ });
46
42
  }, [apiRef, field, id]);
47
43
  return /*#__PURE__*/_jsx(StyledAutocomplete, {
48
44
  value: value,
@@ -29,20 +29,16 @@ function EditCurrency(props) {
29
29
  field
30
30
  } = props;
31
31
  const apiRef = useGridApiContext();
32
- const handleChange = React.useCallback((event, newValue) => {
33
- apiRef.current.setEditCellValue({
32
+ const handleChange = React.useCallback(async (event, newValue) => {
33
+ await apiRef.current.setEditCellValue({
34
34
  id,
35
35
  field,
36
36
  value: newValue.toUpperCase()
37
37
  }, event);
38
-
39
- if (!event.key) {
40
- apiRef.current.commitCellChange({
41
- id,
42
- field
43
- });
44
- apiRef.current.setCellMode(id, field, 'view');
45
- }
38
+ apiRef.current.stopCellEditMode({
39
+ id,
40
+ field
41
+ });
46
42
  }, [apiRef, field, id]);
47
43
  return /*#__PURE__*/_jsx(StyledAutocomplete, {
48
44
  value: value,
@@ -17,28 +17,24 @@ function EditIncoterm(props) {
17
17
  } = props;
18
18
  const apiRef = useGridApiContext();
19
19
 
20
- const handleChange = event => {
21
- apiRef.current.setEditCellValue({
20
+ const handleChange = async event => {
21
+ await apiRef.current.setEditCellValue({
22
22
  id,
23
23
  field,
24
24
  value: event.target.value
25
25
  }, event);
26
- apiRef.current.commitCellChange({
26
+ apiRef.current.stopCellEditMode({
27
27
  id,
28
28
  field
29
29
  });
30
- apiRef.current.setCellMode(id, field, 'view');
31
-
32
- if (event.key) {
33
- // TODO v6: remove once we stop ignoring events fired from portals
34
- const params = apiRef.current.getCellParams(id, field);
35
- apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
36
- }
37
30
  };
38
31
 
39
32
  const handleClose = (event, reason) => {
40
33
  if (reason === 'backdropClick') {
41
- apiRef.current.setCellMode(id, field, 'view');
34
+ apiRef.current.stopCellEditMode({
35
+ id,
36
+ field
37
+ });
42
38
  }
43
39
  };
44
40
 
@@ -14,21 +14,16 @@ function EditRating(props) {
14
14
  } = props;
15
15
  const apiRef = useGridApiContext();
16
16
 
17
- const handleChange = event => {
18
- apiRef.current.setEditCellValue({
17
+ const handleChange = async event => {
18
+ await apiRef.current.setEditCellValue({
19
19
  id,
20
20
  field,
21
21
  value: Number(event.target.value)
22
- }, event); // Check if the event is not from the keyboard
23
- // https://github.com/facebook/react/issues/7407
24
-
25
- if (event.nativeEvent.clientX !== 0 && event.nativeEvent.clientY !== 0) {
26
- apiRef.current.commitCellChange({
27
- id,
28
- field
29
- });
30
- apiRef.current.setCellMode(id, field, 'view');
31
- }
22
+ }, event);
23
+ apiRef.current.stopCellEditMode({
24
+ id,
25
+ field
26
+ });
32
27
  };
33
28
 
34
29
  const handleRef = element => {