@mui/x-data-grid-generator 6.0.0-alpha.8 → 6.0.0-alpha.9

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +129 -15
  2. package/columns/commodities.columns.js +0 -1
  3. package/columns/employees.columns.js +0 -1
  4. package/hooks/useDemoData.js +9 -31
  5. package/hooks/useMovieData.js +0 -1
  6. package/hooks/useQuery.js +6 -34
  7. package/index.js +1 -1
  8. package/legacy/columns/commodities.columns.js +0 -1
  9. package/legacy/columns/employees.columns.js +0 -2
  10. package/legacy/hooks/useBasicDemoData.js +6 -7
  11. package/legacy/hooks/useDemoData.js +28 -70
  12. package/legacy/hooks/useMovieData.js +0 -2
  13. package/legacy/hooks/useQuery.js +27 -64
  14. package/legacy/index.js +1 -1
  15. package/legacy/renderer/renderAvatar.js +0 -1
  16. package/legacy/renderer/renderCountry.js +3 -4
  17. package/legacy/renderer/renderEditCountry.js +2 -8
  18. package/legacy/renderer/renderEditCurrency.js +2 -8
  19. package/legacy/renderer/renderEditIncoterm.js +2 -10
  20. package/legacy/renderer/renderEditProgress.js +7 -17
  21. package/legacy/renderer/renderEditRating.js +2 -10
  22. package/legacy/renderer/renderEditStatus.js +2 -15
  23. package/legacy/renderer/renderEmail.js +0 -1
  24. package/legacy/renderer/renderIncoterm.js +0 -2
  25. package/legacy/renderer/renderLink.js +0 -2
  26. package/legacy/renderer/renderPnl.js +0 -3
  27. package/legacy/renderer/renderProgress.js +4 -5
  28. package/legacy/renderer/renderRating.js +3 -4
  29. package/legacy/renderer/renderStatus.js +8 -13
  30. package/legacy/renderer/renderTotalPrice.js +5 -6
  31. package/legacy/services/asyncWorker.js +4 -7
  32. package/legacy/services/basic-data-service.js +0 -5
  33. package/legacy/services/random-generator.js +6 -20
  34. package/legacy/services/real-data-service.js +0 -9
  35. package/legacy/services/tree-data-generator.js +6 -22
  36. package/modern/columns/commodities.columns.js +0 -1
  37. package/modern/columns/employees.columns.js +0 -1
  38. package/modern/hooks/useDemoData.js +9 -27
  39. package/modern/hooks/useMovieData.js +0 -1
  40. package/modern/hooks/useQuery.js +6 -32
  41. package/modern/index.js +1 -1
  42. package/modern/renderer/renderAvatar.js +0 -1
  43. package/modern/renderer/renderCountry.js +3 -4
  44. package/modern/renderer/renderEditCountry.js +0 -3
  45. package/modern/renderer/renderEditCurrency.js +0 -3
  46. package/modern/renderer/renderEditIncoterm.js +0 -5
  47. package/modern/renderer/renderEditProgress.js +0 -7
  48. package/modern/renderer/renderEditRating.js +0 -5
  49. package/modern/renderer/renderEditStatus.js +0 -10
  50. package/modern/renderer/renderIncoterm.js +0 -2
  51. package/modern/renderer/renderLink.js +0 -2
  52. package/modern/renderer/renderPnl.js +0 -3
  53. package/modern/renderer/renderProgress.js +4 -5
  54. package/modern/renderer/renderRating.js +3 -4
  55. package/modern/renderer/renderStatus.js +8 -13
  56. package/modern/renderer/renderTotalPrice.js +5 -6
  57. package/modern/services/asyncWorker.js +2 -4
  58. package/modern/services/basic-data-service.js +0 -5
  59. package/modern/services/random-generator.js +6 -19
  60. package/modern/services/real-data-service.js +0 -9
  61. package/modern/services/tree-data-generator.js +0 -14
  62. package/node/columns/commodities.columns.js +1 -8
  63. package/node/columns/employees.columns.js +1 -8
  64. package/node/columns/index.js +0 -4
  65. package/node/hooks/index.js +0 -8
  66. package/node/hooks/useBasicDemoData.js +0 -6
  67. package/node/hooks/useDemoData.js +17 -62
  68. package/node/hooks/useMovieData.js +0 -3
  69. package/node/hooks/useQuery.js +8 -48
  70. package/node/index.js +1 -9
  71. package/node/renderer/index.js +0 -32
  72. package/node/renderer/renderAvatar.js +0 -8
  73. package/node/renderer/renderCountry.js +3 -12
  74. package/node/renderer/renderEditCountry.js +0 -16
  75. package/node/renderer/renderEditCurrency.js +0 -16
  76. package/node/renderer/renderEditIncoterm.js +0 -17
  77. package/node/renderer/renderEditProgress.js +0 -20
  78. package/node/renderer/renderEditRating.js +0 -14
  79. package/node/renderer/renderEditStatus.js +0 -26
  80. package/node/renderer/renderEmail.js +1 -9
  81. package/node/renderer/renderIncoterm.js +0 -12
  82. package/node/renderer/renderLink.js +0 -9
  83. package/node/renderer/renderPnl.js +0 -12
  84. package/node/renderer/renderProgress.js +4 -14
  85. package/node/renderer/renderRating.js +3 -13
  86. package/node/renderer/renderStatus.js +8 -26
  87. package/node/renderer/renderTotalPrice.js +5 -15
  88. package/node/services/asyncWorker.js +2 -5
  89. package/node/services/basic-data-service.js +0 -7
  90. package/node/services/index.js +0 -8
  91. package/node/services/random-generator.js +7 -105
  92. package/node/services/real-data-service.js +0 -12
  93. package/node/services/static-data.js +0 -2
  94. package/node/services/tree-data-generator.js +1 -22
  95. package/package.json +4 -4
  96. package/renderer/renderAvatar.js +0 -1
  97. package/renderer/renderCountry.js +3 -4
  98. package/renderer/renderEditCountry.js +0 -3
  99. package/renderer/renderEditCurrency.js +0 -3
  100. package/renderer/renderEditIncoterm.js +0 -5
  101. package/renderer/renderEditProgress.js +0 -7
  102. package/renderer/renderEditRating.js +0 -5
  103. package/renderer/renderEditStatus.js +0 -10
  104. package/renderer/renderEmail.js +0 -1
  105. package/renderer/renderIncoterm.js +0 -2
  106. package/renderer/renderLink.js +0 -2
  107. package/renderer/renderPnl.js +0 -3
  108. package/renderer/renderProgress.js +4 -5
  109. package/renderer/renderRating.js +3 -4
  110. package/renderer/renderStatus.js +8 -13
  111. package/renderer/renderTotalPrice.js +5 -6
  112. package/services/asyncWorker.js +2 -4
  113. package/services/basic-data-service.js +0 -5
  114. package/services/random-generator.js +6 -20
  115. package/services/real-data-service.js +0 -9
  116. package/services/tree-data-generator.js +0 -15
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.getRealGridData = getRealGridData;
9
-
10
8
  var _asyncWorker = _interopRequireDefault(require("./asyncWorker"));
11
-
12
9
  function getRealGridData(rowLength, columns) {
13
10
  return new Promise(resolve => {
14
11
  const tasks = {
@@ -16,35 +13,26 @@ function getRealGridData(rowLength, columns) {
16
13
  };
17
14
  const rows = [];
18
15
  const indexedValues = {};
19
-
20
16
  function work() {
21
17
  const row = {};
22
-
23
18
  for (let j = 0; j < columns.length; j += 1) {
24
19
  const column = columns[j];
25
-
26
20
  if (column.generateData) {
27
21
  const context = {};
28
-
29
22
  if (column.dataGeneratorUniquenessEnabled) {
30
23
  let fieldValues = indexedValues[column.field];
31
-
32
24
  if (!fieldValues) {
33
25
  fieldValues = {};
34
26
  indexedValues[column.field] = fieldValues;
35
27
  }
36
-
37
28
  context.values = fieldValues;
38
29
  }
39
-
40
30
  row[column.field] = column.generateData(row, context);
41
31
  }
42
32
  }
43
-
44
33
  rows.push(row);
45
34
  tasks.current -= 1;
46
35
  }
47
-
48
36
  const columnVisibilityModel = {};
49
37
  columns.forEach(col => {
50
38
  if (col.hide) {
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TAXCODE_OPTIONS = exports.STATUS_OPTIONS = exports.RATE_TYPE_OPTIONS = exports.INCOTERM_OPTIONS = exports.CURRENCY_OPTIONS = exports.COUNTRY_OPTIONS = exports.COUNTRY_ISO_OPTIONS_SORTED = exports.COUNTRY_ISO_OPTIONS = exports.CONTRACT_TYPE_OPTIONS = exports.COMMODITY_OPTIONS = exports.COLORS = void 0;
7
-
8
7
  var _colors = require("@mui/material/colors");
9
-
10
8
  const COLORS = [_colors.pink[500], _colors.blue[500], _colors.orange[500], _colors.red[500], _colors.green[500], _colors.lightBlue[500], _colors.purple[500]];
11
9
  exports.COLORS = COLORS;
12
10
  const STATUS_OPTIONS = ['Open', 'PartiallyFilled', 'Filled', 'Rejected'];
@@ -1,63 +1,48 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.addTreeDataOptionsToDemoData = void 0;
9
-
10
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
9
  var _randomGenerator = require("./random-generator");
13
-
14
10
  const addTreeDataOptionsToDemoData = (data, options = {}) => {
15
- var _groupingCol$headerNa;
16
-
17
11
  const {
18
12
  averageChildren = 2,
19
13
  maxDepth = 1,
20
14
  groupingField
21
15
  } = options;
22
16
  const hasTreeData = maxDepth > 1 && groupingField != null;
23
-
24
17
  if (!hasTreeData) {
25
18
  return data;
26
19
  }
27
-
28
20
  if (data.rows.length > 1000) {
29
21
  throw new Error('MUI: useDemoData tree data mode only works up to 1000 rows.');
30
22
  }
31
-
32
23
  const rowsByTreeDepth = {};
33
24
  const rowsCount = data.rows.length;
34
25
  const groupingCol = data.columns.find(col => col.field === options.groupingField);
35
-
36
26
  if (!groupingCol) {
37
27
  throw new Error('MUI: The tree data grouping field does not exist');
38
28
  }
39
-
40
29
  data.initialState.columns.columnVisibilityModel[groupingField] = false;
41
-
42
30
  for (let i = 0; i < rowsCount; i += 1) {
43
31
  const row = data.rows[i];
44
32
  const currentChunk = Math.floor(i * (averageChildren ** maxDepth - 1) / rowsCount) + 1;
45
33
  const currentDepth = Math.floor(Math.log(currentChunk) / Math.log(averageChildren));
46
-
47
34
  if (!rowsByTreeDepth[currentDepth]) {
48
35
  rowsByTreeDepth[currentDepth] = {
49
36
  rows: {},
50
37
  rowIndexes: []
51
38
  };
52
39
  }
53
-
54
40
  rowsByTreeDepth[currentDepth].rows[i] = {
55
41
  value: row,
56
42
  parentIndex: null
57
43
  };
58
44
  rowsByTreeDepth[currentDepth].rowIndexes.push(i);
59
45
  }
60
-
61
46
  Object.entries(rowsByTreeDepth).forEach(([depthStr, {
62
47
  rows
63
48
  }]) => {
@@ -65,35 +50,29 @@ const addTreeDataOptionsToDemoData = (data, options = {}) => {
65
50
  Object.values(rows).forEach(row => {
66
51
  const path = [];
67
52
  let previousRow = null;
68
-
69
53
  for (let k = depth; k >= 0; k -= 1) {
70
54
  let rowTemp;
71
-
72
55
  if (k === depth) {
73
56
  if (depth > 0) {
74
57
  row.parentIndex = Number((0, _randomGenerator.randomArrayItem)(rowsByTreeDepth[depth - 1].rowIndexes));
75
58
  }
76
-
77
59
  rowTemp = row;
78
60
  } else {
79
61
  rowTemp = rowsByTreeDepth[k].rows[previousRow.parentIndex];
80
62
  }
81
-
82
63
  path.unshift(rowTemp.value[groupingField]);
83
64
  previousRow = rowTemp;
84
65
  }
85
-
86
66
  row.value.path = path;
87
67
  });
88
68
  });
89
69
  return (0, _extends2.default)({}, data, {
90
70
  groupingColDef: {
91
- headerName: (_groupingCol$headerNa = groupingCol.headerName) != null ? _groupingCol$headerNa : groupingCol.field,
71
+ headerName: groupingCol.headerName ?? groupingCol.field,
92
72
  width: 250
93
73
  },
94
74
  getTreeDataPath: row => row.path,
95
75
  treeData: true
96
76
  });
97
77
  };
98
-
99
78
  exports.addTreeDataOptionsToDemoData = addTreeDataOptionsToDemoData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-generator",
3
- "version": "6.0.0-alpha.8",
3
+ "version": "6.0.0-alpha.9",
4
4
  "description": "Generate fake data for demo purposes only.",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -19,9 +19,9 @@
19
19
  "directory": "packages/grid/x-data-grid-generator"
20
20
  },
21
21
  "dependencies": {
22
- "@babel/runtime": "^7.19.0",
22
+ "@babel/runtime": "^7.20.1",
23
23
  "@mui/base": "^5.0.0-alpha.106",
24
- "@mui/x-data-grid-premium": "6.0.0-alpha.8",
24
+ "@mui/x-data-grid-premium": "6.0.0-alpha.9",
25
25
  "chance": "^1.1.9",
26
26
  "clsx": "^1.2.1",
27
27
  "lru-cache": "^7.14.1"
@@ -35,7 +35,7 @@
35
35
  "<rootDir>/src/setupTests.js"
36
36
  ],
37
37
  "engines": {
38
- "node": ">=12.0.0"
38
+ "node": ">=14.0.0"
39
39
  },
40
40
  "private": false,
41
41
  "module": "./index.js",
@@ -5,7 +5,6 @@ export function renderAvatar(params) {
5
5
  if (params.value == null) {
6
6
  return '';
7
7
  }
8
-
9
8
  return /*#__PURE__*/_jsx(Avatar, {
10
9
  style: {
11
10
  backgroundColor: params.value.color
@@ -36,14 +36,13 @@ const Country = /*#__PURE__*/React.memo(function Country(props) {
36
36
  export function renderCountry(params) {
37
37
  if (params.value == null) {
38
38
  return '';
39
- } // If the aggregated value does not have the same unit as the other cell
40
- // Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
41
-
39
+ }
42
40
 
41
+ // If the aggregated value does not have the same unit as the other cell
42
+ // Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
43
43
  if (params.aggregation && !params.aggregation.hasCellUnit) {
44
44
  return null;
45
45
  }
46
-
47
46
  return /*#__PURE__*/_jsx(Country, {
48
47
  value: params.value
49
48
  });
@@ -21,7 +21,6 @@ const StyledAutocomplete = styled(Autocomplete)(({
21
21
  }
22
22
  })
23
23
  }));
24
-
25
24
  function EditCountry(props) {
26
25
  const {
27
26
  id,
@@ -72,12 +71,10 @@ function EditCountry(props) {
72
71
  id: params.id,
73
72
  inputProps: _extends({}, params.inputProps, {
74
73
  autoComplete: 'new-password' // disable autocomplete and autofill
75
-
76
74
  })
77
75
  }, params.InputProps))
78
76
  });
79
77
  }
80
-
81
78
  export function renderEditCountry(params) {
82
79
  return /*#__PURE__*/_jsx(EditCountry, _extends({}, params));
83
80
  }
@@ -21,7 +21,6 @@ const StyledAutocomplete = styled(Autocomplete)(({
21
21
  }
22
22
  })
23
23
  }));
24
-
25
24
  function EditCurrency(props) {
26
25
  const {
27
26
  id,
@@ -71,12 +70,10 @@ function EditCurrency(props) {
71
70
  id: params.id,
72
71
  inputProps: _extends({}, params.inputProps, {
73
72
  autoComplete: 'new-password' // disable autocomplete and autofill
74
-
75
73
  })
76
74
  }, params.InputProps))
77
75
  });
78
76
  }
79
-
80
77
  export function renderEditCurrency(params) {
81
78
  return /*#__PURE__*/_jsx(EditCurrency, _extends({}, params));
82
79
  }
@@ -8,7 +8,6 @@ import ListItemText from '@mui/material/ListItemText';
8
8
  import { INCOTERM_OPTIONS } from '../services/static-data';
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
-
12
11
  function EditIncoterm(props) {
13
12
  const {
14
13
  id,
@@ -16,7 +15,6 @@ function EditIncoterm(props) {
16
15
  field
17
16
  } = props;
18
17
  const apiRef = useGridApiContext();
19
-
20
18
  const handleChange = async event => {
21
19
  await apiRef.current.setEditCellValue({
22
20
  id,
@@ -28,7 +26,6 @@ function EditIncoterm(props) {
28
26
  field
29
27
  });
30
28
  };
31
-
32
29
  const handleClose = (event, reason) => {
33
30
  if (reason === 'backdropClick') {
34
31
  apiRef.current.stopCellEditMode({
@@ -37,7 +34,6 @@ function EditIncoterm(props) {
37
34
  });
38
35
  }
39
36
  };
40
-
41
37
  return /*#__PURE__*/_jsx(Select, {
42
38
  value: value,
43
39
  onChange: handleChange,
@@ -75,7 +71,6 @@ function EditIncoterm(props) {
75
71
  })
76
72
  });
77
73
  }
78
-
79
74
  export function renderEditIncoterm(params) {
80
75
  return /*#__PURE__*/_jsx(EditIncoterm, _extends({}, params));
81
76
  }
@@ -44,7 +44,6 @@ const StyledSlider = styled(Slider)(({
44
44
  backgroundColor: alpha('#000000', 0.2)
45
45
  }
46
46
  }));
47
-
48
47
  function ValueLabelComponent(props) {
49
48
  const {
50
49
  children,
@@ -59,7 +58,6 @@ function ValueLabelComponent(props) {
59
58
  children: children
60
59
  });
61
60
  }
62
-
63
61
  function EditProgress(props) {
64
62
  const {
65
63
  id,
@@ -76,22 +74,18 @@ function EditProgress(props) {
76
74
  });
77
75
  }, [apiRef, field, id]);
78
76
  const debouncedUpdateCellEditProps = React.useMemo(() => debounce(updateCellEditProps, 60), [updateCellEditProps]);
79
-
80
77
  const handleChange = (event, newValue) => {
81
78
  setValueState(newValue);
82
79
  debouncedUpdateCellEditProps(newValue);
83
80
  };
84
-
85
81
  React.useEffect(() => {
86
82
  setValueState(Number(value));
87
83
  }, [value]);
88
-
89
84
  const handleRef = element => {
90
85
  if (element) {
91
86
  element.querySelector('[type="range"]').focus();
92
87
  }
93
88
  };
94
-
95
89
  return /*#__PURE__*/_jsx(StyledSlider, {
96
90
  ref: handleRef,
97
91
  classes: {
@@ -108,7 +102,6 @@ function EditProgress(props) {
108
102
  valueLabelFormat: newValue => `${(newValue * 100).toLocaleString()} %`
109
103
  });
110
104
  }
111
-
112
105
  export function renderEditProgress(params) {
113
106
  return /*#__PURE__*/_jsx(EditProgress, _extends({}, params));
114
107
  }
@@ -5,7 +5,6 @@ import Rating from '@mui/material/Rating';
5
5
  import { useGridApiContext } from '@mui/x-data-grid-premium';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
-
9
8
  function EditRating(props) {
10
9
  const {
11
10
  id,
@@ -13,7 +12,6 @@ function EditRating(props) {
13
12
  field
14
13
  } = props;
15
14
  const apiRef = useGridApiContext();
16
-
17
15
  const handleChange = async event => {
18
16
  await apiRef.current.setEditCellValue({
19
17
  id,
@@ -25,13 +23,11 @@ function EditRating(props) {
25
23
  field
26
24
  });
27
25
  };
28
-
29
26
  const handleRef = element => {
30
27
  if (element) {
31
28
  element.querySelector(`input[value="${value}"]`).focus();
32
29
  }
33
30
  };
34
-
35
31
  return /*#__PURE__*/_jsxs(Box, {
36
32
  sx: {
37
33
  display: 'flex',
@@ -52,7 +48,6 @@ function EditRating(props) {
52
48
  }), Number(value)]
53
49
  });
54
50
  }
55
-
56
51
  export function renderEditRating(params) {
57
52
  return /*#__PURE__*/_jsx(EditRating, _extends({}, params));
58
53
  }
@@ -12,7 +12,6 @@ import DoneIcon from '@mui/icons-material/Done';
12
12
  import { STATUS_OPTIONS } from '../services/static-data';
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
-
16
15
  function EditStatus(props) {
17
16
  const {
18
17
  id,
@@ -21,14 +20,12 @@ function EditStatus(props) {
21
20
  } = props;
22
21
  const rootProps = useGridRootProps();
23
22
  const apiRef = useGridApiContext();
24
-
25
23
  const handleChange = async event => {
26
24
  const isValid = await apiRef.current.setEditCellValue({
27
25
  id,
28
26
  field,
29
27
  value: event.target.value
30
28
  });
31
-
32
29
  if (isValid && rootProps.editMode === GridEditModes.Cell) {
33
30
  apiRef.current.stopCellEditMode({
34
31
  id,
@@ -37,7 +34,6 @@ function EditStatus(props) {
37
34
  });
38
35
  }
39
36
  };
40
-
41
37
  const handleClose = (event, reason) => {
42
38
  if (reason === 'backdropClick') {
43
39
  apiRef.current.stopCellEditMode({
@@ -47,7 +43,6 @@ function EditStatus(props) {
47
43
  });
48
44
  }
49
45
  };
50
-
51
46
  return /*#__PURE__*/_jsx(Select, {
52
47
  value: value,
53
48
  onChange: handleChange,
@@ -67,7 +62,6 @@ function EditStatus(props) {
67
62
  open: true,
68
63
  children: STATUS_OPTIONS.map(option => {
69
64
  let IconComponent = null;
70
-
71
65
  if (option === 'Rejected') {
72
66
  IconComponent = ReportProblemIcon;
73
67
  } else if (option === 'Open') {
@@ -77,13 +71,10 @@ function EditStatus(props) {
77
71
  } else if (option === 'Filled') {
78
72
  IconComponent = DoneIcon;
79
73
  }
80
-
81
74
  let label = option;
82
-
83
75
  if (option === 'PartiallyFilled') {
84
76
  label = 'Partially Filled';
85
77
  }
86
-
87
78
  return /*#__PURE__*/_jsxs(MenuItem, {
88
79
  value: option,
89
80
  children: [/*#__PURE__*/_jsx(ListItemIcon, {
@@ -103,7 +94,6 @@ function EditStatus(props) {
103
94
  })
104
95
  });
105
96
  }
106
-
107
97
  export function renderEditStatus(params) {
108
98
  return /*#__PURE__*/_jsx(EditStatus, _extends({}, params));
109
99
  }
@@ -3,7 +3,6 @@ import { DemoLink } from './renderLink';
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  export function renderEmail(params) {
5
5
  var _params$value;
6
-
7
6
  const email = (_params$value = params.value) != null ? _params$value : '';
8
7
  return /*#__PURE__*/_jsx(DemoLink, {
9
8
  href: `mailto:${email}`,
@@ -8,11 +8,9 @@ const Incoterm = /*#__PURE__*/React.memo(function Incoterm(props) {
8
8
  const {
9
9
  value
10
10
  } = props;
11
-
12
11
  if (!value) {
13
12
  return null;
14
13
  }
15
-
16
14
  const valueStr = value.toString();
17
15
  const tooltip = valueStr.slice(valueStr.indexOf('(') + 1, valueStr.indexOf(')'));
18
16
  const code = valueStr.slice(0, valueStr.indexOf('(')).trim();
@@ -12,7 +12,6 @@ export const DemoLink = /*#__PURE__*/React.memo(function DemoLink(props) {
12
12
  event.preventDefault();
13
13
  event.stopPropagation();
14
14
  };
15
-
16
15
  return /*#__PURE__*/_jsx(Link, {
17
16
  tabIndex: props.tabIndex,
18
17
  onClick: handleClick,
@@ -24,7 +23,6 @@ export function renderLink(params) {
24
23
  if (params.value == null) {
25
24
  return '';
26
25
  }
27
-
28
26
  return /*#__PURE__*/_jsx(DemoLink, {
29
27
  href: params.value,
30
28
  tabIndex: params.tabIndex,
@@ -14,11 +14,9 @@ const Value = styled('div')(({
14
14
  color: theme.palette.mode === 'light' ? theme.palette.error.dark : theme.palette.error.light
15
15
  }
16
16
  }));
17
-
18
17
  function pnlFormatter(value) {
19
18
  return value < 0 ? `(${Math.abs(value).toLocaleString()})` : value.toLocaleString();
20
19
  }
21
-
22
20
  const Pnl = /*#__PURE__*/React.memo(function Pnl(props) {
23
21
  const {
24
22
  value
@@ -32,7 +30,6 @@ export function renderPnl(params) {
32
30
  if (params.value == null) {
33
31
  return '';
34
32
  }
35
-
36
33
  return /*#__PURE__*/_jsx(Pnl, {
37
34
  value: params.value
38
35
  });
@@ -6,7 +6,7 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
6
6
  const Root = styled('div')(({
7
7
  theme
8
8
  }) => ({
9
- border: `1px solid ${theme.palette.divider}`,
9
+ border: `1px solid ${(theme.vars || theme).palette.divider}`,
10
10
  position: 'relative',
11
11
  overflow: 'hidden',
12
12
  width: '100%',
@@ -51,14 +51,13 @@ const ProgressBar = /*#__PURE__*/React.memo(function ProgressBar(props) {
51
51
  export function renderProgress(params) {
52
52
  if (params.value == null) {
53
53
  return '';
54
- } // If the aggregated value does not have the same unit as the other cell
55
- // Then we fall back to the default rendering based on `valueGetter` instead of rendering a progress bar.
56
-
54
+ }
57
55
 
56
+ // If the aggregated value does not have the same unit as the other cell
57
+ // Then we fall back to the default rendering based on `valueGetter` instead of rendering a progress bar.
58
58
  if (params.aggregation && !params.aggregation.hasCellUnit) {
59
59
  return null;
60
60
  }
61
-
62
61
  return /*#__PURE__*/_jsx(ProgressBar, {
63
62
  value: params.value
64
63
  });
@@ -26,14 +26,13 @@ const RatingValue = /*#__PURE__*/React.memo(function RatingValue(props) {
26
26
  export function renderRating(params) {
27
27
  if (params.value == null) {
28
28
  return '';
29
- } // If the aggregated value does not have the same unit as the other cell
30
- // Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
31
-
29
+ }
32
30
 
31
+ // If the aggregated value does not have the same unit as the other cell
32
+ // Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
33
33
  if (params.aggregation && !params.aggregation.hasCellUnit) {
34
34
  return null;
35
35
  }
36
-
37
36
  return /*#__PURE__*/_jsx(RatingValue, {
38
37
  value: params.value
39
38
  });
@@ -14,20 +14,20 @@ const StyledChip = styled(Chip)(({
14
14
  color: 'inherit'
15
15
  },
16
16
  '&.Open': {
17
- color: theme.palette.info.dark,
18
- border: `1px solid ${theme.palette.info.main}`
17
+ color: (theme.vars || theme).palette.info.dark,
18
+ border: `1px solid ${(theme.vars || theme).palette.info.main}`
19
19
  },
20
20
  '&.Filled': {
21
- color: theme.palette.success.dark,
22
- border: `1px solid ${theme.palette.success.main}`
21
+ color: (theme.vars || theme).palette.success.dark,
22
+ border: `1px solid ${(theme.vars || theme).palette.success.main}`
23
23
  },
24
24
  '&.PartiallyFilled': {
25
- color: theme.palette.warning.dark,
26
- border: `1px solid ${theme.palette.warning.main}`
25
+ color: (theme.vars || theme).palette.warning.dark,
26
+ border: `1px solid ${(theme.vars || theme).palette.warning.main}`
27
27
  },
28
28
  '&.Rejected': {
29
- color: theme.palette.error.dark,
30
- border: `1px solid ${theme.palette.error.main}`
29
+ color: (theme.vars || theme).palette.error.dark,
30
+ border: `1px solid ${(theme.vars || theme).palette.error.main}`
31
31
  }
32
32
  }));
33
33
  const Status = /*#__PURE__*/React.memo(props => {
@@ -35,7 +35,6 @@ const Status = /*#__PURE__*/React.memo(props => {
35
35
  status
36
36
  } = props;
37
37
  let icon = null;
38
-
39
38
  if (status === 'Rejected') {
40
39
  icon = /*#__PURE__*/_jsx(ReportProblemIcon, {
41
40
  className: "icon"
@@ -53,13 +52,10 @@ const Status = /*#__PURE__*/React.memo(props => {
53
52
  className: "icon"
54
53
  });
55
54
  }
56
-
57
55
  let label = status;
58
-
59
56
  if (status === 'PartiallyFilled') {
60
57
  label = 'Partially Filled';
61
58
  }
62
-
63
59
  return /*#__PURE__*/_jsx(StyledChip, {
64
60
  className: status,
65
61
  icon: icon,
@@ -72,7 +68,6 @@ export function renderStatus(params) {
72
68
  if (params.value == null) {
73
69
  return '';
74
70
  }
75
-
76
71
  return /*#__PURE__*/_jsx(Status, {
77
72
  status: params.value
78
73
  });
@@ -14,10 +14,10 @@ const Value = styled('div')(({
14
14
  alignItems: 'center',
15
15
  justifyContent: 'flex-end',
16
16
  '&.good': {
17
- backgroundColor: alpha(theme.palette.success.main, 0.3)
17
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette.success.mainChannel} / 0.3)` : alpha(theme.palette.success.main, 0.3)
18
18
  },
19
19
  '&.bad': {
20
- backgroundColor: alpha(theme.palette.error.main, 0.3)
20
+ backgroundColor: theme.vars ? `rgba(${theme.vars.palette.error.mainChannel} / 0.3)` : alpha(theme.palette.error.main, 0.3)
21
21
  }
22
22
  }));
23
23
  const currencyFormatter = new Intl.NumberFormat('en-US', {
@@ -36,14 +36,13 @@ const TotalPrice = /*#__PURE__*/React.memo(function TotalPrice(props) {
36
36
  export function renderTotalPrice(params) {
37
37
  if (params.value == null) {
38
38
  return '';
39
- } // If the aggregated value does not have the same unit as the other cell
40
- // Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
41
-
39
+ }
42
40
 
41
+ // If the aggregated value does not have the same unit as the other cell
42
+ // Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
43
43
  if (params.aggregation && !params.aggregation.hasCellUnit) {
44
44
  return null;
45
45
  }
46
-
47
46
  return /*#__PURE__*/_jsx(TotalPrice, {
48
47
  value: params.value
49
48
  });
@@ -8,22 +8,20 @@ export default function asyncWorker({
8
8
  while ((deadline.timeRemaining() > 0 || deadline.didTimeout) && tasks.current > 0) {
9
9
  work();
10
10
  }
11
-
12
11
  if (tasks.current > 0) {
13
12
  requestIdleCallback(myNonEssentialWork);
14
13
  } else {
15
14
  done();
16
15
  }
17
- }; // Don't use requestIdleCallback if the time is mock, better to run synchronously in such case.
18
-
16
+ };
19
17
 
18
+ // Don't use requestIdleCallback if the time is mock, better to run synchronously in such case.
20
19
  if (typeof requestIdleCallback === 'function' && !requestIdleCallback.clock) {
21
20
  requestIdleCallback(myNonEssentialWork);
22
21
  } else {
23
22
  while (tasks.current > 0) {
24
23
  work();
25
24
  }
26
-
27
25
  done();
28
26
  }
29
27
  }