@mui/x-data-grid-generator 9.3.0 → 9.5.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.
- package/CHANGELOG.md +296 -0
- package/LICENSE +21 -0
- package/columns/commodities.columns.js +16 -0
- package/columns/commodities.columns.mjs +18 -2
- package/hooks/serverUtils.d.mts +1 -1
- package/hooks/serverUtils.d.ts +1 -1
- package/hooks/serverUtils.js +68 -39
- package/hooks/serverUtils.mjs +68 -39
- package/hooks/useDemoData.d.mts +2 -1
- package/hooks/useDemoData.d.ts +2 -1
- package/hooks/useDemoData.js +8 -4
- package/hooks/useDemoData.mjs +8 -4
- package/hooks/useMockServer.d.mts +1 -0
- package/hooks/useMockServer.d.ts +1 -0
- package/hooks/useMockServer.js +11 -6
- package/hooks/useMockServer.mjs +11 -6
- package/hooks/useQuery.d.mts +57 -0
- package/hooks/useQuery.d.ts +57 -0
- package/index.js +3 -3
- package/index.mjs +3 -3
- package/package.json +8 -8
- package/services/random-generator.d.mts +3 -0
- package/services/random-generator.d.ts +3 -0
- package/services/random-generator.js +14 -1
- package/services/random-generator.mjs +11 -1
- package/services/static-data.d.mts +2 -0
- package/services/static-data.d.ts +2 -0
- package/services/static-data.js +3 -1
- package/services/static-data.mjs +2 -0
|
@@ -8,6 +8,7 @@ export declare const randomRate: () => number;
|
|
|
8
8
|
export declare const randomDate: (start: Date, end: Date) => Date;
|
|
9
9
|
export declare const randomArrayItem: <T>(arr: T[]) => T;
|
|
10
10
|
export declare const randomBoolean: () => boolean;
|
|
11
|
+
export declare const randomSubarray: <T>(arr: T[], min?: number, max?: number) => T[];
|
|
11
12
|
export declare const randomColor: () => "#e91e63" | "#2196f3" | "#ff9800" | "#f44336" | "#4caf50" | "#03a9f4" | "#9c27b0";
|
|
12
13
|
export declare const randomId: () => string;
|
|
13
14
|
export declare const randomDesk: () => string;
|
|
@@ -40,6 +41,8 @@ export declare const randomUpdatedDate: () => Date;
|
|
|
40
41
|
export declare const randomJobTitle: () => string;
|
|
41
42
|
export declare const randomRating: () => number;
|
|
42
43
|
export declare const randomName: ColumnDataGenerator<string>;
|
|
44
|
+
export declare const randomTradeTags: () => string[];
|
|
45
|
+
export declare const randomCertifications: () => string[];
|
|
43
46
|
export declare const generateFilledQuantity: (data: {
|
|
44
47
|
quantity: number;
|
|
45
48
|
}) => number;
|
|
@@ -8,6 +8,7 @@ export declare const randomRate: () => number;
|
|
|
8
8
|
export declare const randomDate: (start: Date, end: Date) => Date;
|
|
9
9
|
export declare const randomArrayItem: <T>(arr: T[]) => T;
|
|
10
10
|
export declare const randomBoolean: () => boolean;
|
|
11
|
+
export declare const randomSubarray: <T>(arr: T[], min?: number, max?: number) => T[];
|
|
11
12
|
export declare const randomColor: () => "#e91e63" | "#2196f3" | "#ff9800" | "#f44336" | "#4caf50" | "#03a9f4" | "#9c27b0";
|
|
12
13
|
export declare const randomId: () => string;
|
|
13
14
|
export declare const randomDesk: () => string;
|
|
@@ -40,6 +41,8 @@ export declare const randomUpdatedDate: () => Date;
|
|
|
40
41
|
export declare const randomJobTitle: () => string;
|
|
41
42
|
export declare const randomRating: () => number;
|
|
42
43
|
export declare const randomName: ColumnDataGenerator<string>;
|
|
44
|
+
export declare const randomTradeTags: () => string[];
|
|
45
|
+
export declare const randomCertifications: () => string[];
|
|
43
46
|
export declare const generateFilledQuantity: (data: {
|
|
44
47
|
quantity: number;
|
|
45
48
|
}) => number;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.randomUserName = exports.randomUrl = exports.randomUpdatedDate = exports.randomUnitPriceCurrency = exports.randomUnitPrice = exports.randomTraderName = exports.randomTradeDate = exports.randomTaxCode = exports.randomStatusOptions = exports.randomRating = exports.randomRateType = exports.randomRate = exports.randomQuantity = exports.randomPrice = exports.randomPnL = exports.randomPhoneNumber = exports.randomName = exports.randomMaturityDate = exports.randomJobTitle = exports.randomInt = exports.randomIncoterm = exports.randomId = exports.randomFeeRate = exports.randomEmail = exports.randomDesk = exports.randomDate = exports.randomCurrency = exports.randomCreatedDate = exports.randomCountry = exports.randomContractType = exports.randomCompanyName = exports.randomCommodity = exports.randomColor = exports.randomCity = exports.randomBrokerId = exports.randomBoolean = exports.randomArrayItem = exports.randomAddress = exports.random = exports.generateIsFilled = exports.generateFilledQuantity = void 0;
|
|
6
|
+
exports.randomUserName = exports.randomUrl = exports.randomUpdatedDate = exports.randomUnitPriceCurrency = exports.randomUnitPrice = exports.randomTraderName = exports.randomTradeTags = exports.randomTradeDate = exports.randomTaxCode = exports.randomSubarray = exports.randomStatusOptions = exports.randomRating = exports.randomRateType = exports.randomRate = exports.randomQuantity = exports.randomPrice = exports.randomPnL = exports.randomPhoneNumber = exports.randomName = exports.randomMaturityDate = exports.randomJobTitle = exports.randomInt = exports.randomIncoterm = exports.randomId = exports.randomFeeRate = exports.randomEmail = exports.randomDesk = exports.randomDate = exports.randomCurrency = exports.randomCreatedDate = exports.randomCountry = exports.randomContractType = exports.randomCompanyName = exports.randomCommodity = exports.randomColor = exports.randomCity = exports.randomCertifications = exports.randomBrokerId = exports.randomBoolean = exports.randomArrayItem = exports.randomAddress = exports.random = exports.generateIsFilled = exports.generateFilledQuantity = void 0;
|
|
7
7
|
exports.resetRandomGenerators = resetRandomGenerators;
|
|
8
8
|
var _chance = require("chance");
|
|
9
9
|
var _staticData = require("./static-data");
|
|
@@ -105,6 +105,15 @@ const randomArrayItem = arr => arr[randomInt(0, arr.length - 1)];
|
|
|
105
105
|
exports.randomArrayItem = randomArrayItem;
|
|
106
106
|
const randomBoolean = () => randomArrayItem([true, false]);
|
|
107
107
|
exports.randomBoolean = randomBoolean;
|
|
108
|
+
const randomSubarray = (arr, min = 0, max) => {
|
|
109
|
+
const count = randomInt(min, max ?? arr.length);
|
|
110
|
+
const shuffled = [...arr].sort(() => chance.floating({
|
|
111
|
+
min: -1,
|
|
112
|
+
max: 1
|
|
113
|
+
}));
|
|
114
|
+
return shuffled.slice(0, count);
|
|
115
|
+
};
|
|
116
|
+
exports.randomSubarray = randomSubarray;
|
|
108
117
|
const randomColor = () => randomArrayItem(_staticData.COLORS);
|
|
109
118
|
exports.randomColor = randomColor;
|
|
110
119
|
const randomId = () => chanceGuid.guid();
|
|
@@ -171,6 +180,10 @@ exports.randomJobTitle = randomJobTitle;
|
|
|
171
180
|
const randomRating = () => randomInt(1, 5);
|
|
172
181
|
exports.randomRating = randomRating;
|
|
173
182
|
const randomName = exports.randomName = uniquenessHandler(() => chance.name());
|
|
183
|
+
const randomTradeTags = () => randomSubarray(_staticData.TRADE_TAG_OPTIONS, 1, 4);
|
|
184
|
+
exports.randomTradeTags = randomTradeTags;
|
|
185
|
+
const randomCertifications = () => randomSubarray(_staticData.CERTIFICATION_OPTIONS, 0, 3);
|
|
186
|
+
exports.randomCertifications = randomCertifications;
|
|
174
187
|
const generateFilledQuantity = data => Number((data.quantity * randomRate()).toFixed()) / data.quantity;
|
|
175
188
|
exports.generateFilledQuantity = generateFilledQuantity;
|
|
176
189
|
const generateIsFilled = data => data.quantity === data.filledQuantity;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Chance } from 'chance';
|
|
2
|
-
import { COLORS, COMMODITY_OPTIONS, CONTRACT_TYPE_OPTIONS, COUNTRY_ISO_OPTIONS, CURRENCY_OPTIONS, INCOTERM_OPTIONS, RATE_TYPE_OPTIONS, STATUS_OPTIONS, TAXCODE_OPTIONS } from "./static-data.mjs";
|
|
2
|
+
import { CERTIFICATION_OPTIONS, COLORS, COMMODITY_OPTIONS, CONTRACT_TYPE_OPTIONS, COUNTRY_ISO_OPTIONS, CURRENCY_OPTIONS, INCOTERM_OPTIONS, RATE_TYPE_OPTIONS, STATUS_OPTIONS, TAXCODE_OPTIONS, TRADE_TAG_OPTIONS } from "./static-data.mjs";
|
|
3
3
|
let chance;
|
|
4
4
|
let chanceGuid;
|
|
5
5
|
|
|
@@ -91,6 +91,14 @@ export const randomDate = (start, end) => new Date(start.getTime() + chance.floa
|
|
|
91
91
|
}) * (end.getTime() - start.getTime()));
|
|
92
92
|
export const randomArrayItem = arr => arr[randomInt(0, arr.length - 1)];
|
|
93
93
|
export const randomBoolean = () => randomArrayItem([true, false]);
|
|
94
|
+
export const randomSubarray = (arr, min = 0, max) => {
|
|
95
|
+
const count = randomInt(min, max ?? arr.length);
|
|
96
|
+
const shuffled = [...arr].sort(() => chance.floating({
|
|
97
|
+
min: -1,
|
|
98
|
+
max: 1
|
|
99
|
+
}));
|
|
100
|
+
return shuffled.slice(0, count);
|
|
101
|
+
};
|
|
94
102
|
export const randomColor = () => randomArrayItem(COLORS);
|
|
95
103
|
export const randomId = () => chanceGuid.guid();
|
|
96
104
|
export const randomDesk = () => `D-${chance.integer({
|
|
@@ -126,5 +134,7 @@ export const randomUpdatedDate = () => dateRecent();
|
|
|
126
134
|
export const randomJobTitle = () => chance.profession();
|
|
127
135
|
export const randomRating = () => randomInt(1, 5);
|
|
128
136
|
export const randomName = uniquenessHandler(() => chance.name());
|
|
137
|
+
export const randomTradeTags = () => randomSubarray(TRADE_TAG_OPTIONS, 1, 4);
|
|
138
|
+
export const randomCertifications = () => randomSubarray(CERTIFICATION_OPTIONS, 0, 3);
|
|
129
139
|
export const generateFilledQuantity = data => Number((data.quantity * randomRate()).toFixed()) / data.quantity;
|
|
130
140
|
export const generateIsFilled = data => data.quantity === data.filledQuantity;
|
|
@@ -5,6 +5,8 @@ export declare const RATE_TYPE_OPTIONS: string[];
|
|
|
5
5
|
export declare const CONTRACT_TYPE_OPTIONS: string[];
|
|
6
6
|
export declare const INCOTERM_OPTIONS: string[];
|
|
7
7
|
export declare const COMMODITY_OPTIONS: string[];
|
|
8
|
+
export declare const TRADE_TAG_OPTIONS: string[];
|
|
9
|
+
export declare const CERTIFICATION_OPTIONS: string[];
|
|
8
10
|
export declare const CURRENCY_OPTIONS: string[];
|
|
9
11
|
export declare const COUNTRY_OPTIONS: string[];
|
|
10
12
|
export interface CountryIsoOption {
|
|
@@ -5,6 +5,8 @@ export declare const RATE_TYPE_OPTIONS: string[];
|
|
|
5
5
|
export declare const CONTRACT_TYPE_OPTIONS: string[];
|
|
6
6
|
export declare const INCOTERM_OPTIONS: string[];
|
|
7
7
|
export declare const COMMODITY_OPTIONS: string[];
|
|
8
|
+
export declare const TRADE_TAG_OPTIONS: string[];
|
|
9
|
+
export declare const CERTIFICATION_OPTIONS: string[];
|
|
8
10
|
export declare const CURRENCY_OPTIONS: string[];
|
|
9
11
|
export declare const COUNTRY_OPTIONS: string[];
|
|
10
12
|
export interface CountryIsoOption {
|
package/services/static-data.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
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;
|
|
6
|
+
exports.TRADE_TAG_OPTIONS = 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 = exports.CERTIFICATION_OPTIONS = void 0;
|
|
7
7
|
var _colors = require("@mui/material/colors");
|
|
8
8
|
const COLORS = exports.COLORS = [_colors.pink[500], _colors.blue[500], _colors.orange[500], _colors.red[500], _colors.green[500], _colors.lightBlue[500], _colors.purple[500]];
|
|
9
9
|
const STATUS_OPTIONS = exports.STATUS_OPTIONS = ['Open', 'Partially Filled', 'Filled', 'Rejected'];
|
|
@@ -12,6 +12,8 @@ const RATE_TYPE_OPTIONS = exports.RATE_TYPE_OPTIONS = ['Fixed', 'Floating'];
|
|
|
12
12
|
const CONTRACT_TYPE_OPTIONS = exports.CONTRACT_TYPE_OPTIONS = ['FP', 'TM', 'CR'];
|
|
13
13
|
const INCOTERM_OPTIONS = exports.INCOTERM_OPTIONS = ['EXW (Ex Works)', 'FAS (Free Alongside Ship)', 'FCA (Free Carrier)', 'CPT (Carriage Paid To)', 'DAP (Delivered at Place)', 'DPU (Delivered at Place Unloaded)', 'DDP (Delivered Duty Paid)'];
|
|
14
14
|
const COMMODITY_OPTIONS = exports.COMMODITY_OPTIONS = ['Corn', 'Oats', 'Rough Rice', 'Soybeans', 'Rapeseed', 'Soybeans', 'Soybean Meal', 'Soybean Oil', 'Wheat', 'Milk', 'Cocoa', 'Coffee C', 'Cotton No.2', 'Sugar No.11', 'Sugar No.14', 'Frozen Concentrated Orange Juice', 'Adzuki bean', 'Robusta coffee'];
|
|
15
|
+
const TRADE_TAG_OPTIONS = exports.TRADE_TAG_OPTIONS = ['Hedge', 'Speculative', 'Arbitrage', 'Spot', 'Forward', 'Option', 'Swap', 'Futures', 'Derivative', 'Leveraged', 'Short', 'Long', 'Day Trade', 'Swing', 'Scalping', 'Algorithmic', 'OTC', 'Exchange', 'Institutional', 'Retail'];
|
|
16
|
+
const CERTIFICATION_OPTIONS = exports.CERTIFICATION_OPTIONS = ['Fair Trade', 'Organic', 'Rainforest Alliance', 'UTZ', 'Non-GMO'];
|
|
15
17
|
const CURRENCY_OPTIONS = exports.CURRENCY_OPTIONS = ['USD', 'GBP', 'JPY', 'EUR', 'BRL', 'MXN', 'AUD', 'CAD', 'NZD', 'ARS', 'CHF', 'THB', 'HKD', 'TRY'];
|
|
16
18
|
const COUNTRY_OPTIONS = exports.COUNTRY_OPTIONS = ['United States', 'United Kingdom', 'Japan', 'France', 'Brazil', 'Mexico', 'Australia', 'Canada', 'New Zealand', 'Argentina', 'Switzerland', 'Thailand', 'Hong Kong', 'Turkey'];
|
|
17
19
|
const COUNTRY_ISO_OPTIONS = exports.COUNTRY_ISO_OPTIONS = [{
|
package/services/static-data.mjs
CHANGED
|
@@ -6,6 +6,8 @@ export const RATE_TYPE_OPTIONS = ['Fixed', 'Floating'];
|
|
|
6
6
|
export const CONTRACT_TYPE_OPTIONS = ['FP', 'TM', 'CR'];
|
|
7
7
|
export const INCOTERM_OPTIONS = ['EXW (Ex Works)', 'FAS (Free Alongside Ship)', 'FCA (Free Carrier)', 'CPT (Carriage Paid To)', 'DAP (Delivered at Place)', 'DPU (Delivered at Place Unloaded)', 'DDP (Delivered Duty Paid)'];
|
|
8
8
|
export const COMMODITY_OPTIONS = ['Corn', 'Oats', 'Rough Rice', 'Soybeans', 'Rapeseed', 'Soybeans', 'Soybean Meal', 'Soybean Oil', 'Wheat', 'Milk', 'Cocoa', 'Coffee C', 'Cotton No.2', 'Sugar No.11', 'Sugar No.14', 'Frozen Concentrated Orange Juice', 'Adzuki bean', 'Robusta coffee'];
|
|
9
|
+
export const TRADE_TAG_OPTIONS = ['Hedge', 'Speculative', 'Arbitrage', 'Spot', 'Forward', 'Option', 'Swap', 'Futures', 'Derivative', 'Leveraged', 'Short', 'Long', 'Day Trade', 'Swing', 'Scalping', 'Algorithmic', 'OTC', 'Exchange', 'Institutional', 'Retail'];
|
|
10
|
+
export const CERTIFICATION_OPTIONS = ['Fair Trade', 'Organic', 'Rainforest Alliance', 'UTZ', 'Non-GMO'];
|
|
9
11
|
export const CURRENCY_OPTIONS = ['USD', 'GBP', 'JPY', 'EUR', 'BRL', 'MXN', 'AUD', 'CAD', 'NZD', 'ARS', 'CHF', 'THB', 'HKD', 'TRY'];
|
|
10
12
|
export const COUNTRY_OPTIONS = ['United States', 'United Kingdom', 'Japan', 'France', 'Brazil', 'Mexico', 'Australia', 'Canada', 'New Zealand', 'Argentina', 'Switzerland', 'Thailand', 'Hong Kong', 'Turkey'];
|
|
11
13
|
export const COUNTRY_ISO_OPTIONS = [{
|