@mui/x-data-grid-generator 5.17.4 → 5.17.6
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 +61 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useBasicDemoData.d.ts +2 -0
- package/hooks/useBasicDemoData.js +13 -0
- package/index.js +1 -1
- package/legacy/hooks/index.js +1 -0
- package/legacy/hooks/useBasicDemoData.js +18 -0
- package/legacy/index.js +1 -1
- package/legacy/services/basic-data-service.js +44 -0
- package/legacy/services/index.js +2 -1
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/useBasicDemoData.js +13 -0
- package/modern/index.js +1 -1
- package/modern/services/basic-data-service.js +44 -0
- package/modern/services/index.js +2 -1
- package/node/hooks/index.js +13 -0
- package/node/hooks/useBasicDemoData.js +28 -0
- package/node/index.js +1 -1
- package/node/services/basic-data-service.js +54 -0
- package/node/services/index.js +13 -0
- package/package.json +2 -2
- package/services/basic-data-service.d.ts +13 -0
- package/services/basic-data-service.js +44 -0
- package/services/index.d.ts +1 -0
- package/services/index.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,67 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## 5.17.6
|
|
7
|
+
|
|
8
|
+
_Oct 6, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🌍 Add Japanese (ja-JP) locale to pickers (#6365) @sho918
|
|
13
|
+
- 🎁 Improve support for theme augmentation in the DataGrid (#6406) @cherniavskii
|
|
14
|
+
- 🐞 Bugfixes
|
|
15
|
+
|
|
16
|
+
### `@mui/x-data-grid@v5.17.6` / `@mui/x-data-grid-pro@v5.17.6` / `@mui/x-data-grid-premium@v5.17.6`
|
|
17
|
+
|
|
18
|
+
#### Changes
|
|
19
|
+
|
|
20
|
+
- [DataGrid] Add missing `valueOptions` (#6400) @DanailH
|
|
21
|
+
- [DataGrid] Don't start edit mode when pressing <kbd>Shift</kbd> + <kbd>Space</kbd> (#6380) @m4theushw
|
|
22
|
+
- [DataGrid] Pass generics to the components in the theme augmentation (#6406) @cherniavskii
|
|
23
|
+
|
|
24
|
+
### `@mui/x-date-pickers@v5.0.4` / `@mui/x-date-pickers-pro@v5.0.4`
|
|
25
|
+
|
|
26
|
+
#### Changes
|
|
27
|
+
|
|
28
|
+
- [l10n] Add Japanese (ja-JP) locale to pickers (#6365) (#6382) @sho918
|
|
29
|
+
- [pickers] Prevent `CalendarPicker` getting focus when `autoFocus=false` (#6304) (#6362) @alexfauquette
|
|
30
|
+
- [pickers] Fix git repository location @oliviertassinari
|
|
31
|
+
|
|
32
|
+
### Docs
|
|
33
|
+
|
|
34
|
+
- [docs] Fix customized day rendering demo style (#6342) @Ambrish-git
|
|
35
|
+
|
|
36
|
+
## 5.17.5
|
|
37
|
+
|
|
38
|
+
_Sep 29, 2022_
|
|
39
|
+
|
|
40
|
+
We'd like to offer a big thanks to the 2 contributors who made this release possible. Here are some highlights ✨:
|
|
41
|
+
|
|
42
|
+
- 🎁 Add theme augmentation module to DataGridPremium (#6316) @cherniavskii
|
|
43
|
+
- 👀 Fix blank space when changing page with dynamic row height (#6320) @m4theushw
|
|
44
|
+
- 📚 Improve controlled editing demo to make easier to reuse it (#6306) @cherniavskii
|
|
45
|
+
- 🐞 Bugfixes
|
|
46
|
+
|
|
47
|
+
### `@mui/x-data-grid@v5.17.5` / `@mui/x-data-grid-pro@v5.17.5` / `@mui/x-data-grid-premium@v5.17.5`
|
|
48
|
+
|
|
49
|
+
#### Changes
|
|
50
|
+
|
|
51
|
+
- [DataGrid] Fix `GridPagination` props typing (#6295) @cherniavskii
|
|
52
|
+
- [DataGrid] Fix `GridRow` not forwarding `ref` to the root element (#6303) @cherniavskii
|
|
53
|
+
- [DataGrid] Fix `undefined` value being showed in filter button tooltip text (#6271) @cherniavskii
|
|
54
|
+
- [DataGrid] Fix blank space when changing page with dynamic row height (#6320) @m4theushw
|
|
55
|
+
- [DataGrid] Revert cell/row mode if `processRowUpdate` fails (#6319) @m4theushw
|
|
56
|
+
- [DataGridPremium] Add missing `themeAugmentation` module (#6316) @cherniavskii
|
|
57
|
+
|
|
58
|
+
### Docs
|
|
59
|
+
|
|
60
|
+
- [docs] Pass model change callbacks in controlled grid editing demos (#6306) @cherniavskii
|
|
61
|
+
|
|
62
|
+
### Core
|
|
63
|
+
|
|
64
|
+
- [core] Reduce the amount of updated screenshots reported by Argos (#6310) @cherniavskii
|
|
65
|
+
|
|
66
|
+
## 5.17.4
|
|
7
67
|
|
|
8
68
|
_Sep 22, 2022_
|
|
9
69
|
|
package/hooks/index.d.ts
CHANGED
package/hooks/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getBasicGridData } from '../services';
|
|
3
|
+
export const useBasicDemoData = (nbRows, nbCols) => {
|
|
4
|
+
const [data, setData] = React.useState({
|
|
5
|
+
rows: [],
|
|
6
|
+
columns: []
|
|
7
|
+
});
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
const newData = getBasicGridData(nbRows, nbCols);
|
|
10
|
+
setData(newData);
|
|
11
|
+
}, [nbRows, nbCols]);
|
|
12
|
+
return data;
|
|
13
|
+
};
|
package/index.js
CHANGED
package/legacy/hooks/index.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { getBasicGridData } from '../services';
|
|
4
|
+
export var useBasicDemoData = function useBasicDemoData(nbRows, nbCols) {
|
|
5
|
+
var _React$useState = React.useState({
|
|
6
|
+
rows: [],
|
|
7
|
+
columns: []
|
|
8
|
+
}),
|
|
9
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
10
|
+
data = _React$useState2[0],
|
|
11
|
+
setData = _React$useState2[1];
|
|
12
|
+
|
|
13
|
+
React.useEffect(function () {
|
|
14
|
+
var newData = getBasicGridData(nbRows, nbCols);
|
|
15
|
+
setData(newData);
|
|
16
|
+
}, [nbRows, nbCols]);
|
|
17
|
+
return data;
|
|
18
|
+
};
|
package/legacy/index.js
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export var 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 var getBasicGridData = function getBasicGridData(rowLength, colLength) {
|
|
3
|
+
var data = [];
|
|
4
|
+
var pricesColLength = colLength - 2;
|
|
5
|
+
|
|
6
|
+
for (var i = 0; i < rowLength; i += 1) {
|
|
7
|
+
var idx = i >= currencyPairs.length ? i % currencyPairs.length : i;
|
|
8
|
+
var model = {
|
|
9
|
+
id: i,
|
|
10
|
+
currencyPair: currencyPairs[idx]
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
for (var j = 1; j <= pricesColLength; j += 1) {
|
|
14
|
+
model["price".concat(j, "M")] = Number("".concat(i.toString()).concat(j)); // randomPrice(0.7, 2);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
data.push(model);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var columns = [{
|
|
21
|
+
field: 'id',
|
|
22
|
+
headerName: 'id',
|
|
23
|
+
type: 'number'
|
|
24
|
+
}, {
|
|
25
|
+
field: 'currencyPair',
|
|
26
|
+
headerName: 'Currency Pair'
|
|
27
|
+
}];
|
|
28
|
+
|
|
29
|
+
for (var _j = 1; _j <= pricesColLength; _j += 1) {
|
|
30
|
+
// const y = Math.floor(j / 12);
|
|
31
|
+
columns.push({
|
|
32
|
+
field: "price".concat(_j, "M"),
|
|
33
|
+
headerName: "".concat(_j, "M"),
|
|
34
|
+
type: 'number'
|
|
35
|
+
}); // (y > 0 ? `${y}Y` : '') + `${j - y * 12}M`
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
columns.length = colLength; // we cut the array in case < 2;
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
columns: columns,
|
|
42
|
+
rows: data
|
|
43
|
+
};
|
|
44
|
+
};
|
package/legacy/services/index.js
CHANGED
package/modern/hooks/index.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getBasicGridData } from '../services';
|
|
3
|
+
export const useBasicDemoData = (nbRows, nbCols) => {
|
|
4
|
+
const [data, setData] = React.useState({
|
|
5
|
+
rows: [],
|
|
6
|
+
columns: []
|
|
7
|
+
});
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
const newData = getBasicGridData(nbRows, nbCols);
|
|
10
|
+
setData(newData);
|
|
11
|
+
}, [nbRows, nbCols]);
|
|
12
|
+
return data;
|
|
13
|
+
};
|
package/modern/index.js
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
|
|
6
|
+
for (let i = 0; i < rowLength; i += 1) {
|
|
7
|
+
const idx = i >= currencyPairs.length ? i % currencyPairs.length : i;
|
|
8
|
+
const model = {
|
|
9
|
+
id: i,
|
|
10
|
+
currencyPair: currencyPairs[idx]
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
for (let j = 1; j <= pricesColLength; j += 1) {
|
|
14
|
+
model[`price${j}M`] = Number(`${i.toString()}${j}`); // randomPrice(0.7, 2);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
data.push(model);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const columns = [{
|
|
21
|
+
field: 'id',
|
|
22
|
+
headerName: 'id',
|
|
23
|
+
type: 'number'
|
|
24
|
+
}, {
|
|
25
|
+
field: 'currencyPair',
|
|
26
|
+
headerName: 'Currency Pair'
|
|
27
|
+
}];
|
|
28
|
+
|
|
29
|
+
for (let j = 1; j <= pricesColLength; j += 1) {
|
|
30
|
+
// const y = Math.floor(j / 12);
|
|
31
|
+
columns.push({
|
|
32
|
+
field: `price${j}M`,
|
|
33
|
+
headerName: `${j}M`,
|
|
34
|
+
type: 'number'
|
|
35
|
+
}); // (y > 0 ? `${y}Y` : '') + `${j - y * 12}M`
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
columns.length = colLength; // we cut the array in case < 2;
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
columns,
|
|
42
|
+
rows: data
|
|
43
|
+
};
|
|
44
|
+
};
|
package/modern/services/index.js
CHANGED
package/node/hooks/index.js
CHANGED
|
@@ -17,6 +17,19 @@ Object.keys(_useDemoData).forEach(function (key) {
|
|
|
17
17
|
});
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
+
var _useBasicDemoData = require("./useBasicDemoData");
|
|
21
|
+
|
|
22
|
+
Object.keys(_useBasicDemoData).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _useBasicDemoData[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _useBasicDemoData[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
20
33
|
var _useMovieData = require("./useMovieData");
|
|
21
34
|
|
|
22
35
|
Object.keys(_useMovieData).forEach(function (key) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useBasicDemoData = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _services = require("../services");
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
16
|
+
const useBasicDemoData = (nbRows, nbCols) => {
|
|
17
|
+
const [data, setData] = React.useState({
|
|
18
|
+
rows: [],
|
|
19
|
+
columns: []
|
|
20
|
+
});
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
const newData = (0, _services.getBasicGridData)(nbRows, nbCols);
|
|
23
|
+
setData(newData);
|
|
24
|
+
}, [nbRows, nbCols]);
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.useBasicDemoData = useBasicDemoData;
|
package/node/index.js
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getBasicGridData = exports.currencyPairs = void 0;
|
|
7
|
+
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'];
|
|
8
|
+
exports.currencyPairs = currencyPairs;
|
|
9
|
+
|
|
10
|
+
const getBasicGridData = (rowLength, colLength) => {
|
|
11
|
+
const data = [];
|
|
12
|
+
const pricesColLength = colLength - 2;
|
|
13
|
+
|
|
14
|
+
for (let i = 0; i < rowLength; i += 1) {
|
|
15
|
+
const idx = i >= currencyPairs.length ? i % currencyPairs.length : i;
|
|
16
|
+
const model = {
|
|
17
|
+
id: i,
|
|
18
|
+
currencyPair: currencyPairs[idx]
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
for (let j = 1; j <= pricesColLength; j += 1) {
|
|
22
|
+
model[`price${j}M`] = Number(`${i.toString()}${j}`); // randomPrice(0.7, 2);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
data.push(model);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const columns = [{
|
|
29
|
+
field: 'id',
|
|
30
|
+
headerName: 'id',
|
|
31
|
+
type: 'number'
|
|
32
|
+
}, {
|
|
33
|
+
field: 'currencyPair',
|
|
34
|
+
headerName: 'Currency Pair'
|
|
35
|
+
}];
|
|
36
|
+
|
|
37
|
+
for (let j = 1; j <= pricesColLength; j += 1) {
|
|
38
|
+
// const y = Math.floor(j / 12);
|
|
39
|
+
columns.push({
|
|
40
|
+
field: `price${j}M`,
|
|
41
|
+
headerName: `${j}M`,
|
|
42
|
+
type: 'number'
|
|
43
|
+
}); // (y > 0 ? `${y}Y` : '') + `${j - y * 12}M`
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
columns.length = colLength; // we cut the array in case < 2;
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
columns,
|
|
50
|
+
rows: data
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.getBasicGridData = getBasicGridData;
|
package/node/services/index.js
CHANGED
|
@@ -41,4 +41,17 @@ Object.keys(_realDataService).forEach(function (key) {
|
|
|
41
41
|
return _realDataService[key];
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var _basicDataService = require("./basic-data-service");
|
|
47
|
+
|
|
48
|
+
Object.keys(_basicDataService).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (key in exports && exports[key] === _basicDataService[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _basicDataService[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
44
57
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-generator",
|
|
3
|
-
"version": "5.17.
|
|
3
|
+
"version": "5.17.6",
|
|
4
4
|
"description": "Generate fake data for demo purposes only.",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.18.9",
|
|
23
23
|
"@mui/base": "^5.0.0-alpha.97",
|
|
24
|
-
"@mui/x-data-grid-premium": "5.17.
|
|
24
|
+
"@mui/x-data-grid-premium": "5.17.6",
|
|
25
25
|
"chance": "^1.1.8",
|
|
26
26
|
"clsx": "^1.2.1",
|
|
27
27
|
"lru-cache": "^7.14.0"
|
|
@@ -0,0 +1,13 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
|
|
6
|
+
for (let i = 0; i < rowLength; i += 1) {
|
|
7
|
+
const idx = i >= currencyPairs.length ? i % currencyPairs.length : i;
|
|
8
|
+
const model = {
|
|
9
|
+
id: i,
|
|
10
|
+
currencyPair: currencyPairs[idx]
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
for (let j = 1; j <= pricesColLength; j += 1) {
|
|
14
|
+
model[`price${j}M`] = Number(`${i.toString()}${j}`); // randomPrice(0.7, 2);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
data.push(model);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const columns = [{
|
|
21
|
+
field: 'id',
|
|
22
|
+
headerName: 'id',
|
|
23
|
+
type: 'number'
|
|
24
|
+
}, {
|
|
25
|
+
field: 'currencyPair',
|
|
26
|
+
headerName: 'Currency Pair'
|
|
27
|
+
}];
|
|
28
|
+
|
|
29
|
+
for (let j = 1; j <= pricesColLength; j += 1) {
|
|
30
|
+
// const y = Math.floor(j / 12);
|
|
31
|
+
columns.push({
|
|
32
|
+
field: `price${j}M`,
|
|
33
|
+
headerName: `${j}M`,
|
|
34
|
+
type: 'number'
|
|
35
|
+
}); // (y > 0 ? `${y}Y` : '') + `${j - y * 12}M`
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
columns.length = colLength; // we cut the array in case < 2;
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
columns,
|
|
42
|
+
rows: data
|
|
43
|
+
};
|
|
44
|
+
};
|
package/services/index.d.ts
CHANGED
package/services/index.js
CHANGED