@mui/x-data-grid-generator 8.0.0-beta.3 → 8.0.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +282 -96
  2. package/columns/commodities.columns.js +1 -1
  3. package/columns/employees.columns.js +1 -0
  4. package/constants/prompts.d.ts +1 -1
  5. package/constants/prompts.js +8 -4
  6. package/esm/columns/commodities.columns.js +1 -1
  7. package/esm/columns/employees.columns.js +1 -0
  8. package/esm/constants/prompts.d.ts +1 -1
  9. package/esm/constants/prompts.js +8 -4
  10. package/esm/hooks/serverUtils.js +15 -7
  11. package/esm/hooks/useDemoData.js +2 -2
  12. package/esm/hooks/useMockServer.d.ts +2 -2
  13. package/esm/hooks/useMockServer.js +64 -12
  14. package/esm/hooks/useQuery.d.ts +6 -3
  15. package/esm/index.js +1 -1
  16. package/esm/renderer/renderCountry.d.ts +1 -2
  17. package/esm/renderer/renderCountry.js +3 -0
  18. package/esm/services/prompt-resolver.d.ts +2 -2
  19. package/esm/services/prompt-resolver.js +3 -2
  20. package/hooks/serverUtils.js +15 -7
  21. package/hooks/useDemoData.js +2 -2
  22. package/hooks/useMockServer.d.ts +2 -2
  23. package/hooks/useMockServer.js +64 -12
  24. package/hooks/useQuery.d.ts +6 -3
  25. package/index.js +1 -1
  26. package/package.json +5 -14
  27. package/renderer/renderCountry.d.ts +1 -2
  28. package/renderer/renderCountry.js +3 -0
  29. package/services/prompt-resolver.d.ts +2 -2
  30. package/services/prompt-resolver.js +3 -2
  31. package/modern/columns/commodities.columns.d.ts +0 -2
  32. package/modern/columns/commodities.columns.js +0 -231
  33. package/modern/columns/employees.columns.d.ts +0 -2
  34. package/modern/columns/employees.columns.js +0 -134
  35. package/modern/columns/index.d.ts +0 -2
  36. package/modern/columns/index.js +0 -2
  37. package/modern/constants/prompts.d.ts +0 -2
  38. package/modern/constants/prompts.js +0 -49
  39. package/modern/hooks/index.d.ts +0 -8
  40. package/modern/hooks/index.js +0 -6
  41. package/modern/hooks/serverUtils.d.ts +0 -61
  42. package/modern/hooks/serverUtils.js +0 -527
  43. package/modern/hooks/useBasicDemoData.d.ts +0 -2
  44. package/modern/hooks/useBasicDemoData.js +0 -5
  45. package/modern/hooks/useDemoData.d.ts +0 -30
  46. package/modern/hooks/useDemoData.js +0 -159
  47. package/modern/hooks/useMockServer.d.ts +0 -31
  48. package/modern/hooks/useMockServer.js +0 -265
  49. package/modern/hooks/useMovieData.d.ts +0 -21
  50. package/modern/hooks/useMovieData.js +0 -500
  51. package/modern/hooks/useQuery.d.ts +0 -169
  52. package/modern/hooks/useQuery.js +0 -84
  53. package/modern/index.d.ts +0 -4
  54. package/modern/index.js +0 -11
  55. package/modern/package.json +0 -1
  56. package/modern/renderer/index.d.ts +0 -16
  57. package/modern/renderer/index.js +0 -16
  58. package/modern/renderer/renderAvatar.d.ts +0 -6
  59. package/modern/renderer/renderAvatar.js +0 -14
  60. package/modern/renderer/renderCountry.d.ts +0 -4
  61. package/modern/renderer/renderCountry.js +0 -57
  62. package/modern/renderer/renderEditCountry.d.ts +0 -4
  63. package/modern/renderer/renderEditCountry.js +0 -80
  64. package/modern/renderer/renderEditCurrency.d.ts +0 -3
  65. package/modern/renderer/renderEditCurrency.js +0 -78
  66. package/modern/renderer/renderEditIncoterm.d.ts +0 -3
  67. package/modern/renderer/renderEditIncoterm.js +0 -75
  68. package/modern/renderer/renderEditProgress.d.ts +0 -3
  69. package/modern/renderer/renderEditProgress.js +0 -109
  70. package/modern/renderer/renderEditRating.d.ts +0 -3
  71. package/modern/renderer/renderEditRating.js +0 -68
  72. package/modern/renderer/renderEditStatus.d.ts +0 -3
  73. package/modern/renderer/renderEditStatus.js +0 -98
  74. package/modern/renderer/renderEmail.d.ts +0 -3
  75. package/modern/renderer/renderEmail.js +0 -11
  76. package/modern/renderer/renderIncoterm.d.ts +0 -3
  77. package/modern/renderer/renderIncoterm.js +0 -40
  78. package/modern/renderer/renderLink.d.ts +0 -10
  79. package/modern/renderer/renderLink.js +0 -31
  80. package/modern/renderer/renderPnl.d.ts +0 -3
  81. package/modern/renderer/renderPnl.js +0 -41
  82. package/modern/renderer/renderProgress.d.ts +0 -3
  83. package/modern/renderer/renderProgress.js +0 -70
  84. package/modern/renderer/renderRating.d.ts +0 -3
  85. package/modern/renderer/renderRating.js +0 -38
  86. package/modern/renderer/renderStatus.d.ts +0 -3
  87. package/modern/renderer/renderStatus.js +0 -74
  88. package/modern/renderer/renderTotalPrice.d.ts +0 -3
  89. package/modern/renderer/renderTotalPrice.js +0 -49
  90. package/modern/services/asyncWorker.d.ts +0 -11
  91. package/modern/services/asyncWorker.js +0 -27
  92. package/modern/services/basic-data-service.d.ts +0 -13
  93. package/modern/services/basic-data-service.js +0 -37
  94. package/modern/services/gridColDefGenerator.d.ts +0 -23
  95. package/modern/services/gridColDefGenerator.js +0 -1
  96. package/modern/services/index.d.ts +0 -5
  97. package/modern/services/index.js +0 -5
  98. package/modern/services/prompt-resolver.d.ts +0 -2
  99. package/modern/services/prompt-resolver.js +0 -13
  100. package/modern/services/random-generator.d.ts +0 -49
  101. package/modern/services/random-generator.js +0 -124
  102. package/modern/services/real-data-service.d.ts +0 -8
  103. package/modern/services/real-data-service.js +0 -49
  104. package/modern/services/static-data.d.ts +0 -18
  105. package/modern/services/static-data.js +0 -1258
  106. package/modern/services/tree-data-generator.d.ts +0 -21
  107. package/modern/services/tree-data-generator.js +0 -70
  108. package/tsconfig.build.tsbuildinfo +0 -1
@@ -1,98 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import * as React from 'react';
3
- import { useGridApiContext, useGridRootProps, GridEditModes } from '@mui/x-data-grid-premium';
4
- import Select from '@mui/material/Select';
5
- import MenuItem from '@mui/material/MenuItem';
6
- import ListItemIcon from '@mui/material/ListItemIcon';
7
- import ListItemText from '@mui/material/ListItemText';
8
- import ReportProblemIcon from '@mui/icons-material/ReportProblem';
9
- import InfoIcon from '@mui/icons-material/Info';
10
- import AutorenewIcon from '@mui/icons-material/Autorenew';
11
- import DoneIcon from '@mui/icons-material/Done';
12
- import { STATUS_OPTIONS } from "../services/static-data.js";
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- function EditStatus(props) {
15
- const {
16
- id,
17
- value,
18
- field
19
- } = props;
20
- const rootProps = useGridRootProps();
21
- const apiRef = useGridApiContext();
22
- const handleChange = async event => {
23
- const isValid = await apiRef.current.setEditCellValue({
24
- id,
25
- field,
26
- value: event.target.value
27
- });
28
- if (isValid && rootProps.editMode === GridEditModes.Cell) {
29
- apiRef.current.stopCellEditMode({
30
- id,
31
- field,
32
- cellToFocusAfter: 'below'
33
- });
34
- }
35
- };
36
- const handleClose = (event, reason) => {
37
- if (reason === 'backdropClick') {
38
- apiRef.current.stopCellEditMode({
39
- id,
40
- field,
41
- ignoreModifications: true
42
- });
43
- }
44
- };
45
- return /*#__PURE__*/_jsx(Select, {
46
- value: value,
47
- onChange: handleChange,
48
- MenuProps: {
49
- onClose: handleClose
50
- },
51
- sx: {
52
- height: '100%',
53
- '& .MuiSelect-select': {
54
- display: 'flex',
55
- alignItems: 'center',
56
- pl: 1
57
- }
58
- },
59
- autoFocus: true,
60
- fullWidth: true,
61
- open: true,
62
- children: STATUS_OPTIONS.map(option => {
63
- let IconComponent = null;
64
- if (option === 'Rejected') {
65
- IconComponent = ReportProblemIcon;
66
- } else if (option === 'Open') {
67
- IconComponent = InfoIcon;
68
- } else if (option === 'PartiallyFilled') {
69
- IconComponent = AutorenewIcon;
70
- } else if (option === 'Filled') {
71
- IconComponent = DoneIcon;
72
- }
73
- let label = option;
74
- if (option === 'PartiallyFilled') {
75
- label = 'Partially Filled';
76
- }
77
- return /*#__PURE__*/_jsxs(MenuItem, {
78
- value: option,
79
- children: [/*#__PURE__*/_jsx(ListItemIcon, {
80
- sx: {
81
- minWidth: 36
82
- },
83
- children: /*#__PURE__*/_jsx(IconComponent, {
84
- fontSize: "small"
85
- })
86
- }), /*#__PURE__*/_jsx(ListItemText, {
87
- primary: label,
88
- sx: {
89
- overflow: 'hidden'
90
- }
91
- })]
92
- }, option);
93
- })
94
- });
95
- }
96
- export function renderEditStatus(params) {
97
- return /*#__PURE__*/_jsx(EditStatus, _extends({}, params));
98
- }
@@ -1,3 +0,0 @@
1
- import * as React from 'react';
2
- import { GridRenderCellParams } from '@mui/x-data-grid-premium';
3
- export declare function renderEmail(params: GridRenderCellParams<any, string, any>): React.JSX.Element;
@@ -1,11 +0,0 @@
1
- import * as React from 'react';
2
- import { DemoLink } from "./renderLink.js";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- export function renderEmail(params) {
5
- const email = params.value ?? '';
6
- return /*#__PURE__*/_jsx(DemoLink, {
7
- href: `mailto:${email}`,
8
- tabIndex: params.tabIndex,
9
- children: email
10
- });
11
- }
@@ -1,3 +0,0 @@
1
- import * as React from 'react';
2
- import { GridRenderCellParams } from '@mui/x-data-grid-premium';
3
- export declare function renderIncoterm(params: GridRenderCellParams<any, string | null, any>): React.JSX.Element;
@@ -1,40 +0,0 @@
1
- import * as React from 'react';
2
- import Tooltip from '@mui/material/Tooltip';
3
- import Box from '@mui/material/Box';
4
- import InfoIcon from '@mui/icons-material/Info';
5
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
- const Incoterm = /*#__PURE__*/React.memo(function Incoterm(props) {
7
- const {
8
- value
9
- } = props;
10
- if (!value) {
11
- return null;
12
- }
13
- const valueStr = value.toString();
14
- const tooltip = valueStr.slice(valueStr.indexOf('(') + 1, valueStr.indexOf(')'));
15
- const code = valueStr.slice(0, valueStr.indexOf('(')).trim();
16
- return /*#__PURE__*/_jsxs(Box, {
17
- sx: {
18
- display: 'flex',
19
- alignItems: 'center',
20
- justifyContent: 'space-between'
21
- },
22
- children: [/*#__PURE__*/_jsx("span", {
23
- children: code
24
- }), /*#__PURE__*/_jsx(Tooltip, {
25
- title: tooltip,
26
- children: /*#__PURE__*/_jsx(InfoIcon, {
27
- sx: {
28
- color: '#2196f3',
29
- alignSelf: 'center',
30
- ml: '8px'
31
- }
32
- })
33
- })]
34
- });
35
- });
36
- export function renderIncoterm(params) {
37
- return /*#__PURE__*/_jsx(Incoterm, {
38
- value: params.value
39
- });
40
- }
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import { GridRenderCellParams } from '@mui/x-data-grid-premium';
3
- interface DemoLinkProps {
4
- href: string;
5
- children: string;
6
- tabIndex: number;
7
- }
8
- export declare const DemoLink: React.NamedExoticComponent<DemoLinkProps>;
9
- export declare function renderLink(params: GridRenderCellParams<any, string, any>): "" | React.JSX.Element;
10
- export {};
@@ -1,31 +0,0 @@
1
- import * as React from 'react';
2
- import { styled } from '@mui/material/styles';
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- const Link = styled('a')({
5
- textOverflow: 'ellipsis',
6
- whiteSpace: 'nowrap',
7
- overflow: 'hidden',
8
- color: 'inherit'
9
- });
10
- export const DemoLink = /*#__PURE__*/React.memo(function DemoLink(props) {
11
- const handleClick = event => {
12
- event.preventDefault();
13
- event.stopPropagation();
14
- };
15
- return /*#__PURE__*/_jsx(Link, {
16
- tabIndex: props.tabIndex,
17
- onClick: handleClick,
18
- href: props.href,
19
- children: props.children
20
- });
21
- });
22
- export function renderLink(params) {
23
- if (params.value == null) {
24
- return '';
25
- }
26
- return /*#__PURE__*/_jsx(DemoLink, {
27
- href: params.value,
28
- tabIndex: params.tabIndex,
29
- children: params.value
30
- });
31
- }
@@ -1,3 +0,0 @@
1
- import * as React from 'react';
2
- import { GridRenderCellParams } from '@mui/x-data-grid-premium';
3
- export declare function renderPnl(params: GridRenderCellParams<any, number, any>): "" | React.JSX.Element;
@@ -1,41 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import * as React from 'react';
3
- import clsx from 'clsx';
4
- import { styled } from '@mui/material/styles';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const Value = styled('div')(({
7
- theme
8
- }) => ({
9
- width: '100%',
10
- fontVariantNumeric: 'tabular-nums',
11
- '&.positive': _extends({
12
- color: theme.palette.success.light
13
- }, theme.applyStyles('light', {
14
- color: theme.palette.success.dark
15
- })),
16
- '&.negative': _extends({
17
- color: theme.palette.error.light
18
- }, theme.applyStyles('light', {
19
- color: theme.palette.error.dark
20
- }))
21
- }));
22
- function pnlFormatter(value) {
23
- return value < 0 ? `(${Math.abs(value).toLocaleString()})` : value.toLocaleString();
24
- }
25
- const Pnl = /*#__PURE__*/React.memo(function Pnl(props) {
26
- const {
27
- value
28
- } = props;
29
- return /*#__PURE__*/_jsx(Value, {
30
- className: clsx(value > 0 && "positive", value < 0 && "negative"),
31
- children: pnlFormatter(value)
32
- });
33
- });
34
- export function renderPnl(params) {
35
- if (params.value == null) {
36
- return '';
37
- }
38
- return /*#__PURE__*/_jsx(Pnl, {
39
- value: params.value
40
- });
41
- }
@@ -1,3 +0,0 @@
1
- import * as React from 'react';
2
- import { GridRenderCellParams } from '@mui/x-data-grid-premium';
3
- export declare function renderProgress(params: GridRenderCellParams<any, number, any>): "" | React.JSX.Element | null;
@@ -1,70 +0,0 @@
1
- import * as React from 'react';
2
- import clsx from 'clsx';
3
- import { styled } from '@mui/material/styles';
4
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- const Center = styled('div')({
6
- height: '100%',
7
- display: 'flex',
8
- alignItems: 'center'
9
- });
10
- const Element = styled('div')(({
11
- theme
12
- }) => ({
13
- border: `1px solid ${(theme.vars || theme).palette.divider}`,
14
- position: 'relative',
15
- overflow: 'hidden',
16
- width: '100%',
17
- height: 26,
18
- borderRadius: 2
19
- }));
20
- const Value = styled('div')({
21
- position: 'absolute',
22
- lineHeight: '24px',
23
- width: '100%',
24
- display: 'flex',
25
- justifyContent: 'center'
26
- });
27
- const Bar = styled('div')({
28
- height: '100%',
29
- '&.low': {
30
- backgroundColor: '#f44336'
31
- },
32
- '&.medium': {
33
- backgroundColor: '#efbb5aa3'
34
- },
35
- '&.high': {
36
- backgroundColor: '#088208a3'
37
- }
38
- });
39
- const ProgressBar = /*#__PURE__*/React.memo(function ProgressBar(props) {
40
- const {
41
- value
42
- } = props;
43
- const valueInPercent = value * 100;
44
- return /*#__PURE__*/_jsxs(Element, {
45
- children: [/*#__PURE__*/_jsx(Value, {
46
- children: `${valueInPercent.toLocaleString()} %`
47
- }), /*#__PURE__*/_jsx(Bar, {
48
- className: clsx(valueInPercent < 30 && "low", valueInPercent >= 30 && valueInPercent <= 70 && "medium", valueInPercent > 70 && "high"),
49
- style: {
50
- maxWidth: `${valueInPercent}%`
51
- }
52
- })]
53
- });
54
- });
55
- export function renderProgress(params) {
56
- if (params.value == null) {
57
- return '';
58
- }
59
-
60
- // If the aggregated value does not have the same unit as the other cell
61
- // Then we fall back to the default rendering based on `valueGetter` instead of rendering a progress bar.
62
- if (params.aggregation && !params.aggregation.hasCellUnit) {
63
- return null;
64
- }
65
- return /*#__PURE__*/_jsx(Center, {
66
- children: /*#__PURE__*/_jsx(ProgressBar, {
67
- value: params.value
68
- })
69
- });
70
- }
@@ -1,3 +0,0 @@
1
- import * as React from 'react';
2
- import { GridRenderCellParams } from '@mui/x-data-grid-premium';
3
- export declare function renderRating(params: GridRenderCellParams<any, number, any>): "" | React.JSX.Element | null;
@@ -1,38 +0,0 @@
1
- import * as React from 'react';
2
- import Box from '@mui/material/Box';
3
- import Rating from '@mui/material/Rating';
4
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- const RatingValue = /*#__PURE__*/React.memo(function RatingValue(props) {
6
- const {
7
- value
8
- } = props;
9
- return /*#__PURE__*/_jsxs(Box, {
10
- sx: {
11
- display: 'flex',
12
- alignItems: 'center',
13
- lineHeight: '24px',
14
- color: 'text.secondary'
15
- },
16
- children: [/*#__PURE__*/_jsx(Rating, {
17
- value: value,
18
- sx: {
19
- mr: 1
20
- },
21
- readOnly: true
22
- }), " ", Math.round(Number(value) * 10) / 10]
23
- });
24
- });
25
- export function renderRating(params) {
26
- if (params.value == null) {
27
- return '';
28
- }
29
-
30
- // If the aggregated value does not have the same unit as the other cell
31
- // Then we fall back to the default rendering based on `valueGetter` instead of rendering the total price UI.
32
- if (params.aggregation && !params.aggregation.hasCellUnit) {
33
- return null;
34
- }
35
- return /*#__PURE__*/_jsx(RatingValue, {
36
- value: params.value
37
- });
38
- }
@@ -1,3 +0,0 @@
1
- import * as React from 'react';
2
- import { GridRenderCellParams } from '@mui/x-data-grid-premium';
3
- export declare function renderStatus(params: GridRenderCellParams<any, string>): "" | React.JSX.Element;
@@ -1,74 +0,0 @@
1
- import * as React from 'react';
2
- import ReportProblemIcon from '@mui/icons-material/ReportProblem';
3
- import InfoIcon from '@mui/icons-material/Info';
4
- import AutorenewIcon from '@mui/icons-material/Autorenew';
5
- import DoneIcon from '@mui/icons-material/Done';
6
- import Chip from '@mui/material/Chip';
7
- import { styled } from '@mui/material/styles';
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- const StyledChip = styled(Chip)(({
10
- theme
11
- }) => ({
12
- justifyContent: 'left',
13
- '& .icon': {
14
- color: 'inherit'
15
- },
16
- '&.Open': {
17
- color: (theme.vars || theme).palette.info.dark,
18
- border: `1px solid ${(theme.vars || theme).palette.info.main}`
19
- },
20
- '&.Filled': {
21
- color: (theme.vars || theme).palette.success.dark,
22
- border: `1px solid ${(theme.vars || theme).palette.success.main}`
23
- },
24
- '&.PartiallyFilled': {
25
- color: (theme.vars || theme).palette.warning.dark,
26
- border: `1px solid ${(theme.vars || theme).palette.warning.main}`
27
- },
28
- '&.Rejected': {
29
- color: (theme.vars || theme).palette.error.dark,
30
- border: `1px solid ${(theme.vars || theme).palette.error.main}`
31
- }
32
- }));
33
- const Status = /*#__PURE__*/React.memo(props => {
34
- const {
35
- status
36
- } = props;
37
- let icon = null;
38
- if (status === 'Rejected') {
39
- icon = /*#__PURE__*/_jsx(ReportProblemIcon, {
40
- className: "icon"
41
- });
42
- } else if (status === 'Open') {
43
- icon = /*#__PURE__*/_jsx(InfoIcon, {
44
- className: "icon"
45
- });
46
- } else if (status === 'PartiallyFilled') {
47
- icon = /*#__PURE__*/_jsx(AutorenewIcon, {
48
- className: "icon"
49
- });
50
- } else if (status === 'Filled') {
51
- icon = /*#__PURE__*/_jsx(DoneIcon, {
52
- className: "icon"
53
- });
54
- }
55
- let label = status;
56
- if (status === 'PartiallyFilled') {
57
- label = 'Partially Filled';
58
- }
59
- return /*#__PURE__*/_jsx(StyledChip, {
60
- className: status,
61
- icon: icon,
62
- size: "small",
63
- label: label,
64
- variant: "outlined"
65
- });
66
- });
67
- export function renderStatus(params) {
68
- if (params.value == null) {
69
- return '';
70
- }
71
- return /*#__PURE__*/_jsx(Status, {
72
- status: params.value
73
- });
74
- }
@@ -1,3 +0,0 @@
1
- import * as React from 'react';
2
- import { GridRenderCellParams } from '@mui/x-data-grid-premium';
3
- export declare function renderTotalPrice(params: GridRenderCellParams<any, number>): "" | React.JSX.Element | null;
@@ -1,49 +0,0 @@
1
- import * as React from 'react';
2
- import clsx from 'clsx';
3
- import { alpha, styled } from '@mui/material/styles';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- const Value = styled('div')(({
6
- theme
7
- }) => ({
8
- width: '100%',
9
- height: '100%',
10
- lineHeight: '100%',
11
- paddingRight: 8,
12
- fontVariantNumeric: 'tabular-nums',
13
- display: 'flex',
14
- alignItems: 'center',
15
- justifyContent: 'flex-end',
16
- '&.good': {
17
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.success.mainChannel} / 0.3)` : alpha(theme.palette.success.main, 0.3)
18
- },
19
- '&.bad': {
20
- backgroundColor: theme.vars ? `rgba(${theme.vars.palette.error.mainChannel} / 0.3)` : alpha(theme.palette.error.main, 0.3)
21
- }
22
- }));
23
- const currencyFormatter = new Intl.NumberFormat('en-US', {
24
- style: 'currency',
25
- currency: 'USD'
26
- });
27
- const TotalPrice = /*#__PURE__*/React.memo(function TotalPrice(props) {
28
- const {
29
- value
30
- } = props;
31
- return /*#__PURE__*/_jsx(Value, {
32
- className: clsx(value > 1000000 && "good", value < 1000000 && "bad"),
33
- children: currencyFormatter.format(value)
34
- });
35
- });
36
- export function renderTotalPrice(params) {
37
- if (params.value == null) {
38
- return '';
39
- }
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
- if (params.aggregation && !params.aggregation.hasCellUnit) {
44
- return null;
45
- }
46
- return /*#__PURE__*/_jsx(TotalPrice, {
47
- value: params.value
48
- });
49
- }
@@ -1,11 +0,0 @@
1
- export default function asyncWorker({
2
- work,
3
- tasks,
4
- done
5
- }: {
6
- work: () => void;
7
- tasks: {
8
- current: number;
9
- };
10
- done: () => void;
11
- }): void;
@@ -1,27 +0,0 @@
1
- export default function asyncWorker({
2
- work,
3
- tasks,
4
- done
5
- }) {
6
- const myNonEssentialWork = deadline => {
7
- // If there is a surplus time in the frame, or timeout
8
- while ((deadline.timeRemaining() > 0 || deadline.didTimeout) && tasks.current > 0) {
9
- work();
10
- }
11
- if (tasks.current > 0) {
12
- requestIdleCallback(myNonEssentialWork);
13
- } else {
14
- done();
15
- }
16
- };
17
-
18
- // Don't use requestIdleCallback if the time is mock, better to run synchronously in such case.
19
- if (typeof requestIdleCallback === 'function' && !requestIdleCallback.clock) {
20
- requestIdleCallback(myNonEssentialWork);
21
- } else {
22
- while (tasks.current > 0) {
23
- work();
24
- }
25
- done();
26
- }
27
- }
@@ -1,13 +0,0 @@
1
- import { GridColDef, GridRowId } from '@mui/x-data-grid';
2
- export declare const currencyPairs: string[];
3
- interface GridBasicRowModel {
4
- id: GridRowId;
5
- currencyPair: string;
6
- [price: string]: number | string;
7
- }
8
- export interface GridBasicData {
9
- columns: GridColDef[];
10
- rows: GridBasicRowModel[];
11
- }
12
- export declare const getBasicGridData: (rowLength: number, colLength: number) => GridBasicData;
13
- export {};
@@ -1,37 +0,0 @@
1
- export const currencyPairs = ['USDGBP', 'USDEUR', 'GBPEUR', 'JPYUSD', 'MXNUSD', 'BTCUSD', 'USDCAD', 'EURJPY', 'EURUSD', 'EURCHF', 'USDCHF', 'EURGBP', 'GBPUSD', 'AUDCAD', 'NZDUSD', 'GBPCHF', 'AUDUSD', 'GBPJPY', 'USDJPY', 'CHFJPY', 'EURCAD', 'AUDJPY', 'EURAUD', 'AUDNZD', 'CADEUR', 'CHFMXN', 'ETHUSD', 'BCHUSD', 'ETHBTC', 'XRPUSD', 'XRPBTC', 'USDLTC', 'USDXRP', 'USDDSH', 'USDBCH', 'JPYEUR', 'JPYUSD', 'JPYGBP', 'JPYCAD', 'JPYCHF', 'JPYAUD', 'JPYNZD', 'JPYSGD', 'JPYNOK', 'JPYRUB', 'JPYSEK', 'JPYTRY', 'JPYZAR', 'JPYHKD', 'JPYCNH', 'JPYDKK', 'JPYMXN', 'JPYPLN', 'JPYXAG', 'JPYXAU', 'JPYBTC', 'JPYETH', 'JPYLTC', 'JPYXRP', 'JPYDSH', 'JPYBCH', 'GBPEUR', 'GBPRUB', 'GBPTRY'];
2
- export const getBasicGridData = (rowLength, colLength) => {
3
- const data = [];
4
- const pricesColLength = colLength - 2;
5
- for (let i = 0; i < rowLength; i += 1) {
6
- const idx = i >= currencyPairs.length ? i % currencyPairs.length : i;
7
- const model = {
8
- id: i,
9
- currencyPair: currencyPairs[idx]
10
- };
11
- for (let j = 1; j <= pricesColLength; j += 1) {
12
- model[`price${j}M`] = Number(`${i.toString()}${j}`); // randomPrice(0.7, 2);
13
- }
14
- data.push(model);
15
- }
16
- const columns = [{
17
- field: 'id',
18
- headerName: 'id',
19
- type: 'number'
20
- }, {
21
- field: 'currencyPair',
22
- headerName: 'Currency Pair'
23
- }];
24
- for (let j = 1; j <= pricesColLength; j += 1) {
25
- // const y = Math.floor(j / 12);
26
- columns.push({
27
- field: `price${j}M`,
28
- headerName: `${j}M`,
29
- type: 'number'
30
- }); // (y > 0 ? `${y}Y` : '') + `${j - y * 12}M`
31
- }
32
- columns.length = colLength; // we cut the array in case < 2;
33
- return {
34
- columns,
35
- rows: data
36
- };
37
- };
@@ -1,23 +0,0 @@
1
- import { GridColDef } from '@mui/x-data-grid-pro';
2
- export interface GridDataGeneratorContext {
3
- /**
4
- * Values already attributed to this column.
5
- * Only defined if the column has the uniqueness mode activated.
6
- * The keys represent the random value and the value represents the amount of rows that already have this value.
7
- * This allows to data generators to add a suffix to the returned value to force the uniqueness.
8
- */
9
- values?: Record<string, number>;
10
- }
11
- export type GridColDefGenerator = GridColDef & {
12
- generateData?: (row: any, context: GridDataGeneratorContext) => any;
13
- /**
14
- * If `true`, each row will have a distinct value
15
- * If several rows are generated with the same value, then a suffix will be added to the 2nd, 3rd, ...
16
- * @default false
17
- */
18
- dataGeneratorUniquenessEnabled?: boolean;
19
- /**
20
- * If `true`, the column will be marked as hidden in the `columnVisibilityModel`.
21
- */
22
- hide?: boolean;
23
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export * from "./gridColDefGenerator.js";
2
- export * from "./random-generator.js";
3
- export * from "./real-data-service.js";
4
- export * from "./basic-data-service.js";
5
- export * from "./prompt-resolver.js";
@@ -1,5 +0,0 @@
1
- export * from "./gridColDefGenerator.js";
2
- export * from "./random-generator.js";
3
- export * from "./real-data-service.js";
4
- export * from "./basic-data-service.js";
5
- export * from "./prompt-resolver.js";
@@ -1,2 +0,0 @@
1
- import { unstable_PromptResponse as PromptResponse } from '@mui/x-data-grid-premium';
2
- export declare const mockPromptResolver: (_: string, query: string) => Promise<PromptResponse>;
@@ -1,13 +0,0 @@
1
- import { mockPrompts } from "../constants/prompts.js";
2
- export const mockPromptResolver = (_, query) => {
3
- const resolved = mockPrompts.get(query.toLowerCase().trim());
4
- return new Promise((resolve, reject) => {
5
- setTimeout(() => {
6
- if (resolved) {
7
- resolve(resolved);
8
- } else {
9
- reject(new Error('Unknown query'));
10
- }
11
- }, 1000);
12
- });
13
- };