@mui/x-data-grid-generator 5.17.4 → 5.17.5

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 CHANGED
@@ -3,7 +3,37 @@
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
- ## v5.17.4
6
+ ## 5.17.5
7
+
8
+ _Sep 29, 2022_
9
+
10
+ We'd like to offer a big thanks to the 2 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🎁 Add theme augmentation module to DataGridPremium (#6316) @cherniavskii
13
+ - 👀 Fix blank space when changing page with dynamic row height (#6320) @m4theushw
14
+ - 📚 Improve controlled editing demo to make easier to reuse it (#6306) @cherniavskii
15
+ - 🐞 Bugfixes
16
+
17
+ ### `@mui/x-data-grid@v5.17.5` / `@mui/x-data-grid-pro@v5.17.5` / `@mui/x-data-grid-premium@v5.17.5`
18
+
19
+ #### Changes
20
+
21
+ - [DataGrid] Fix `GridPagination` props typing (#6295) @cherniavskii
22
+ - [DataGrid] Fix `GridRow` not forwarding `ref` to the root element (#6303) @cherniavskii
23
+ - [DataGrid] Fix `undefined` value being showed in filter button tooltip text (#6271) @cherniavskii
24
+ - [DataGrid] Fix blank space when changing page with dynamic row height (#6320) @m4theushw
25
+ - [DataGrid] Revert cell/row mode if `processRowUpdate` fails (#6319) @m4theushw
26
+ - [DataGridPremium] Add missing `themeAugmentation` module (#6316) @cherniavskii
27
+
28
+ ### Docs
29
+
30
+ - [docs] Pass model change callbacks in controlled grid editing demos (#6306) @cherniavskii
31
+
32
+ ### Core
33
+
34
+ - [core] Reduce the amount of updated screenshots reported by Argos (#6310) @cherniavskii
35
+
36
+ ## 5.17.4
7
37
 
8
38
  _Sep 22, 2022_
9
39
 
package/hooks/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './useDemoData';
2
+ export * from './useBasicDemoData';
2
3
  export * from './useMovieData';
3
4
  export * from './useQuery';
package/hooks/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './useDemoData';
2
+ export * from './useBasicDemoData';
2
3
  export * from './useMovieData';
3
4
  export * from './useQuery';
@@ -0,0 +1,2 @@
1
+ import { GridBasicData } from '../services';
2
+ export declare const useBasicDemoData: (nbRows: number, nbCols: number) => GridBasicData;
@@ -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
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.17.4
1
+ /** @license MUI v5.17.5
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,3 +1,4 @@
1
1
  export * from './useDemoData';
2
+ export * from './useBasicDemoData';
2
3
  export * from './useMovieData';
3
4
  export * from './useQuery';
@@ -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
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.17.4
1
+ /** @license MUI v5.17.5
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.
@@ -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
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './gridColDefGenerator';
2
2
  export * from './random-generator';
3
- export * from './real-data-service';
3
+ export * from './real-data-service';
4
+ export * from './basic-data-service';
@@ -1,3 +1,4 @@
1
1
  export * from './useDemoData';
2
+ export * from './useBasicDemoData';
2
3
  export * from './useMovieData';
3
4
  export * from './useQuery';
@@ -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
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.17.4
1
+ /** @license MUI v5.17.5
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.
@@ -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
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './gridColDefGenerator';
2
2
  export * from './random-generator';
3
- export * from './real-data-service';
3
+ export * from './real-data-service';
4
+ export * from './basic-data-service';
@@ -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
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.17.4
1
+ /** @license MUI v5.17.5
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.
@@ -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;
@@ -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.4",
3
+ "version": "5.17.5",
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.4",
24
+ "@mui/x-data-grid-premium": "5.17.5",
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
+ };
@@ -1,3 +1,4 @@
1
1
  export * from './gridColDefGenerator';
2
2
  export * from './random-generator';
3
3
  export * from './real-data-service';
4
+ export * from './basic-data-service';
package/services/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './gridColDefGenerator';
2
2
  export * from './random-generator';
3
- export * from './real-data-service';
3
+ export * from './real-data-service';
4
+ export * from './basic-data-service';