@mui/x-data-grid-generator 9.4.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 +100 -0
- package/columns/commodities.columns.js +16 -0
- package/columns/commodities.columns.mjs +18 -2
- package/hooks/serverUtils.js +25 -17
- package/hooks/serverUtils.mjs +25 -17
- 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 +6 -2
- package/hooks/useMockServer.mjs +6 -2
- package/hooks/useQuery.d.mts +57 -0
- package/hooks/useQuery.d.ts +57 -0
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +4 -4
- 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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,105 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 9.5.0
|
|
4
|
+
|
|
5
|
+
_Jun 11, 2026_
|
|
6
|
+
|
|
7
|
+
We'd like to extend a big thank you to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
8
|
+
|
|
9
|
+
- 🎁 New [`multiSelect` column type for Data Grid Pro](https://mui.com/x/react-data-grid/column-definition/#MultiSelectColumn)
|
|
10
|
+
- 🚀 New [renderer="svg-progressive"](https://mui.com/x/react-charts/scatter/#progressive-renderer) paints scatter points in batched frames so large datasets render smoothly without blocking the main thread.
|
|
11
|
+
- 🐞 Bugfixes
|
|
12
|
+
- 📚 Documentation improvements
|
|
13
|
+
|
|
14
|
+
Special thanks go out to community members @mustafajw07 and @Anexus5919 for their valuable contribution.
|
|
15
|
+
|
|
16
|
+
The following team members contributed to this release:
|
|
17
|
+
@alexfauquette, @JCQuintas, @rita-codes, @rluzists1, @sai6855, @siriwatknp, @arminmeh, @brijeshb42
|
|
18
|
+
|
|
19
|
+
### Data Grid
|
|
20
|
+
|
|
21
|
+
#### `@mui/x-data-grid@9.5.0`
|
|
22
|
+
|
|
23
|
+
- [DataGrid] Restrict warning messages to non-production environments in various components (#22461) @sai6855
|
|
24
|
+
- [DataGrid] Prevent React state update before mount (#22374) @arminmeh
|
|
25
|
+
|
|
26
|
+
#### `@mui/x-data-grid-pro@9.5.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
27
|
+
|
|
28
|
+
Same changes as in `@mui/x-data-grid@9.5.0`, plus:
|
|
29
|
+
|
|
30
|
+
- [DataGridPro] Add new `multiSelect` column type (#21157) @siriwatknp
|
|
31
|
+
|
|
32
|
+
#### `@mui/x-data-grid-premium@9.5.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
33
|
+
|
|
34
|
+
Same changes as in `@mui/x-data-grid-pro@9.5.0`.
|
|
35
|
+
|
|
36
|
+
### Date and Time Pickers
|
|
37
|
+
|
|
38
|
+
#### `@mui/x-date-pickers@9.5.0`
|
|
39
|
+
|
|
40
|
+
- [pickers] Fix missing export of `th-TH` (#22703) @alexfauquette
|
|
41
|
+
|
|
42
|
+
#### `@mui/x-date-pickers-pro@9.5.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
43
|
+
|
|
44
|
+
Same changes as in `@mui/x-date-pickers@9.5.0`.
|
|
45
|
+
|
|
46
|
+
### Charts
|
|
47
|
+
|
|
48
|
+
#### `@mui/x-charts@9.5.0`
|
|
49
|
+
|
|
50
|
+
- [charts] Add `FocusedBar` component to `BarScatterComposition` demo (#22704) @sai6855
|
|
51
|
+
- [charts] Add dedicated Bubble Chart documentation page (#22688) @mustafajw07
|
|
52
|
+
- [charts] Add progressive scatter renderer (#22518) @JCQuintas
|
|
53
|
+
- [charts] Avoid full axis pipeline rebuild on resize (#22695) @JCQuintas
|
|
54
|
+
- [charts] Document focus indicator in composition page (#22712) @JCQuintas
|
|
55
|
+
- [charts] Fix `ChartsTooltip` `container` and `disablePortal` props being ignored (#22690) @JCQuintas
|
|
56
|
+
- [charts] Make ordinal scales O(1) to copy and re-range (#22691) @JCQuintas
|
|
57
|
+
- [charts] Stabilize WebGL bar rendering at sub-pixel widths (#22678) @JCQuintas
|
|
58
|
+
- [charts] Use the series config to define value types (#22693) @sai6855
|
|
59
|
+
- [charts] Decouple interaction hook from the cartesian zoom (#22708) @alexfauquette
|
|
60
|
+
|
|
61
|
+
#### `@mui/x-charts-pro@9.5.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
62
|
+
|
|
63
|
+
Same changes as in `@mui/x-charts@9.5.0`, plus:
|
|
64
|
+
|
|
65
|
+
- [charts-pro] Add missing focus highlight (#22689) @alexfauquette
|
|
66
|
+
|
|
67
|
+
#### `@mui/x-charts-premium@9.5.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
68
|
+
|
|
69
|
+
Same changes as in `@mui/x-charts-pro@9.5.0`, plus:
|
|
70
|
+
|
|
71
|
+
- [charts-premium] Set `Heatmap` WebGL render as stable (#22665) @alexfauquette
|
|
72
|
+
- [charts-premium] Stabilize candlestick charts (#22666) @alexfauquette
|
|
73
|
+
- [charts-premium] Stabilize the radial charts (#22655) @alexfauquette
|
|
74
|
+
|
|
75
|
+
### Scheduler
|
|
76
|
+
|
|
77
|
+
#### `@mui/x-scheduler@9.0.0-beta.1`
|
|
78
|
+
|
|
79
|
+
Internal changes.
|
|
80
|
+
|
|
81
|
+
#### `@mui/x-scheduler-premium@9.0.0-beta.1` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
82
|
+
|
|
83
|
+
Same changes as in `@mui/x-scheduler@9.0.0-beta.1`, plus:
|
|
84
|
+
|
|
85
|
+
- [scheduler] Remove dead CSS variable writes in `EventTimelinePremiumContent` (#22720) @rita-codes
|
|
86
|
+
- [scheduler] Show scope dialog when deleting a recurring event (#22552) @Anexus5919
|
|
87
|
+
|
|
88
|
+
### Core
|
|
89
|
+
|
|
90
|
+
- [docs-infra] Fix immutable cache headers for `/\_next/static` assets (#22747) @brijeshb42
|
|
91
|
+
- [docs-infra] Prefix `/\_next/static` cache header rule with `/x` basePath (#22748) @brijeshb42
|
|
92
|
+
- [code-infra] Update dependencies to resolve Dependabot security alerts (#22714) @Janpot
|
|
93
|
+
|
|
94
|
+
### Docs
|
|
95
|
+
|
|
96
|
+
- [docs] Fix broken links checker crashing on 404 known-targets fetch (#22707) @sai6855
|
|
97
|
+
- [docs] Fix country data (#22716) @alexfauquette
|
|
98
|
+
|
|
99
|
+
### Miscellaneous
|
|
100
|
+
|
|
101
|
+
- [legal] Update EULA links in docs (#22717) @rluzists1
|
|
102
|
+
|
|
3
103
|
## 9.4.0
|
|
4
104
|
|
|
5
105
|
<!-- generated comparing v9.3.0..master -->
|
|
@@ -23,6 +23,14 @@ const getCommodityColumns = (editable = false) => [{
|
|
|
23
23
|
generateData: _services.randomCommodity,
|
|
24
24
|
width: 180,
|
|
25
25
|
editable
|
|
26
|
+
}, {
|
|
27
|
+
field: 'tags',
|
|
28
|
+
headerName: 'Tags',
|
|
29
|
+
generateData: _services.randomTradeTags,
|
|
30
|
+
type: 'multiSelect',
|
|
31
|
+
valueOptions: _staticData.TRADE_TAG_OPTIONS,
|
|
32
|
+
width: 220,
|
|
33
|
+
editable
|
|
26
34
|
}, {
|
|
27
35
|
field: 'traderName',
|
|
28
36
|
headerName: 'Trader Name',
|
|
@@ -238,5 +246,13 @@ const getCommodityColumns = (editable = false) => [{
|
|
|
238
246
|
type: 'date',
|
|
239
247
|
width: 150,
|
|
240
248
|
editable
|
|
249
|
+
}, {
|
|
250
|
+
field: 'certifications',
|
|
251
|
+
headerName: 'Certifications',
|
|
252
|
+
generateData: _services.randomCertifications,
|
|
253
|
+
type: 'multiSelect',
|
|
254
|
+
valueOptions: _staticData.CERTIFICATION_OPTIONS,
|
|
255
|
+
width: 200,
|
|
256
|
+
editable
|
|
241
257
|
}];
|
|
242
258
|
exports.getCommodityColumns = getCommodityColumns;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { gridStringOrNumberComparator } from '@mui/x-data-grid-premium';
|
|
2
|
-
import { randomCommodity, randomDesk, randomEmail, randomFeeRate, generateFilledQuantity, randomId, randomIncoterm, generateIsFilled, randomQuantity, randomTraderName, randomUnitPrice, randomUnitPriceCurrency, randomStatusOptions, randomPnL, randomTradeDate, randomMaturityDate, randomBrokerId, randomCompanyName, randomCountry, randomCurrency, randomAddress, randomCity, randomUpdatedDate, randomCreatedDate, randomRateType, randomContractType, randomTaxCode } from "../services/index.mjs";
|
|
2
|
+
import { randomCommodity, randomDesk, randomEmail, randomFeeRate, generateFilledQuantity, randomId, randomIncoterm, generateIsFilled, randomQuantity, randomTraderName, randomUnitPrice, randomUnitPriceCurrency, randomStatusOptions, randomPnL, randomTradeDate, randomMaturityDate, randomBrokerId, randomCompanyName, randomCountry, randomCurrency, randomAddress, randomCity, randomUpdatedDate, randomCreatedDate, randomRateType, randomContractType, randomTaxCode, randomTradeTags, randomCertifications } from "../services/index.mjs";
|
|
3
3
|
import { renderCountry, renderEmail, renderIncoterm, renderPnl, renderProgress, renderStatus, renderTotalPrice, renderEditCurrency, renderEditProgress, renderEditStatus, renderEditIncoterm, renderEditBoolean, renderEditCountry } from "../renderer/index.mjs";
|
|
4
|
-
import { CONTRACT_TYPE_OPTIONS, COUNTRY_ISO_OPTIONS_SORTED, CURRENCY_OPTIONS, INCOTERM_OPTIONS, RATE_TYPE_OPTIONS, STATUS_OPTIONS, TAXCODE_OPTIONS } from "../services/static-data.mjs";
|
|
4
|
+
import { CONTRACT_TYPE_OPTIONS, COUNTRY_ISO_OPTIONS_SORTED, CURRENCY_OPTIONS, INCOTERM_OPTIONS, RATE_TYPE_OPTIONS, STATUS_OPTIONS, TAXCODE_OPTIONS, TRADE_TAG_OPTIONS, CERTIFICATION_OPTIONS } from "../services/static-data.mjs";
|
|
5
5
|
export const getCommodityColumns = (editable = false) => [{
|
|
6
6
|
field: 'id',
|
|
7
7
|
generateData: randomId,
|
|
@@ -17,6 +17,14 @@ export const getCommodityColumns = (editable = false) => [{
|
|
|
17
17
|
generateData: randomCommodity,
|
|
18
18
|
width: 180,
|
|
19
19
|
editable
|
|
20
|
+
}, {
|
|
21
|
+
field: 'tags',
|
|
22
|
+
headerName: 'Tags',
|
|
23
|
+
generateData: randomTradeTags,
|
|
24
|
+
type: 'multiSelect',
|
|
25
|
+
valueOptions: TRADE_TAG_OPTIONS,
|
|
26
|
+
width: 220,
|
|
27
|
+
editable
|
|
20
28
|
}, {
|
|
21
29
|
field: 'traderName',
|
|
22
30
|
headerName: 'Trader Name',
|
|
@@ -232,4 +240,12 @@ export const getCommodityColumns = (editable = false) => [{
|
|
|
232
240
|
type: 'date',
|
|
233
241
|
width: 150,
|
|
234
242
|
editable
|
|
243
|
+
}, {
|
|
244
|
+
field: 'certifications',
|
|
245
|
+
headerName: 'Certifications',
|
|
246
|
+
generateData: randomCertifications,
|
|
247
|
+
type: 'multiSelect',
|
|
248
|
+
valueOptions: CERTIFICATION_OPTIONS,
|
|
249
|
+
width: 200,
|
|
250
|
+
editable
|
|
235
251
|
}];
|
package/hooks/serverUtils.js
CHANGED
|
@@ -207,12 +207,11 @@ const applyAggregation = (aggregationModel, colDefs, rows, groupId = 'root') =>
|
|
|
207
207
|
return aggregateValues;
|
|
208
208
|
};
|
|
209
209
|
const generateParentRows = pathsToAutogenerate => {
|
|
210
|
-
return Array.from(pathsToAutogenerate).map(
|
|
211
|
-
const pathArray = path.split(',');
|
|
210
|
+
return Array.from(pathsToAutogenerate).map(pathArray => {
|
|
212
211
|
return {
|
|
213
212
|
id: `auto-generated-parent-${pathArray.join('-')}`,
|
|
214
|
-
path: pathArray.slice(
|
|
215
|
-
group: pathArray.
|
|
213
|
+
path: pathArray.slice(),
|
|
214
|
+
group: pathArray[pathArray.length - 1]
|
|
216
215
|
};
|
|
217
216
|
});
|
|
218
217
|
};
|
|
@@ -488,7 +487,7 @@ const processRowGroupingRows = (rows, queryOptions, serverOptions, columnsWithDe
|
|
|
488
487
|
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: serverOptions.groupFields must be defined to compute row grouping data' : (0, _formatErrorMessage2.default)(103));
|
|
489
488
|
}
|
|
490
489
|
const delay = (0, _randomGenerator.randomInt)(minDelay, maxDelay);
|
|
491
|
-
const pathsToAutogenerate = new
|
|
490
|
+
const pathsToAutogenerate = new Map();
|
|
492
491
|
let rowsWithPaths = rows;
|
|
493
492
|
const rowsWithMissingGroups = [];
|
|
494
493
|
|
|
@@ -500,13 +499,22 @@ const processRowGroupingRows = (rows, queryOptions, serverOptions, columnsWithDe
|
|
|
500
499
|
const colDef = columnsWithDefaultColDef.find(({
|
|
501
500
|
field: f
|
|
502
501
|
}) => f === field);
|
|
502
|
+
const rawValue = row[field];
|
|
503
|
+
// multiSelect (array) grouping: empty → missing group, non-empty → sorted-joined
|
|
504
|
+
// key so `['A','B']` and `['B','A']` collapse to one group (matches client).
|
|
505
|
+
if (Array.isArray(rawValue)) {
|
|
506
|
+
if (rawValue.length === 0) {
|
|
507
|
+
return undefined;
|
|
508
|
+
}
|
|
509
|
+
return [...rawValue].sort().join(',');
|
|
510
|
+
}
|
|
503
511
|
if (colDef?.groupingValueGetter) {
|
|
504
|
-
return String(colDef.groupingValueGetter(
|
|
512
|
+
return String(colDef.groupingValueGetter(rawValue, row, colDef, apiRef));
|
|
505
513
|
}
|
|
506
514
|
if (colDef?.valueGetter) {
|
|
507
|
-
return String(colDef.valueGetter(
|
|
515
|
+
return String(colDef.valueGetter(rawValue, row, colDef, apiRef));
|
|
508
516
|
}
|
|
509
|
-
return String(
|
|
517
|
+
return String(rawValue);
|
|
510
518
|
});
|
|
511
519
|
for (let index = 0; index < partialPath.length; index += 1) {
|
|
512
520
|
const value = partialPath[index];
|
|
@@ -519,9 +527,9 @@ const processRowGroupingRows = (rows, queryOptions, serverOptions, columnsWithDe
|
|
|
519
527
|
return acc;
|
|
520
528
|
}
|
|
521
529
|
const parentPath = partialPath.slice(0, index + 1);
|
|
522
|
-
const
|
|
523
|
-
if (!pathsToAutogenerate.has(
|
|
524
|
-
pathsToAutogenerate.
|
|
530
|
+
const key = JSON.stringify(parentPath);
|
|
531
|
+
if (!pathsToAutogenerate.has(key)) {
|
|
532
|
+
pathsToAutogenerate.set(key, parentPath);
|
|
525
533
|
}
|
|
526
534
|
}
|
|
527
535
|
acc.push((0, _extends2.default)({}, row, {
|
|
@@ -534,7 +542,7 @@ const processRowGroupingRows = (rows, queryOptions, serverOptions, columnsWithDe
|
|
|
534
542
|
path: ['']
|
|
535
543
|
}));
|
|
536
544
|
}
|
|
537
|
-
const autogeneratedRows = generateParentRows(pathsToAutogenerate);
|
|
545
|
+
const autogeneratedRows = generateParentRows(pathsToAutogenerate.values());
|
|
538
546
|
|
|
539
547
|
// apply plain filtering
|
|
540
548
|
const filteredRows = getTreeDataFilteredRows([...autogeneratedRows, ...rowsWithPaths, ...rowsWithMissingGroups], queryOptions.filterModel, columnsWithDefaultColDef);
|
|
@@ -742,7 +750,7 @@ const processPivotingRows = (rows, queryOptions, serverOptions, columnsWithDefau
|
|
|
742
750
|
const pivotColumnKeys = Array.from(uniqueColumnGroups.keys());
|
|
743
751
|
|
|
744
752
|
// Add paths and generate parent rows based on `visibleRows` (pivot row fields)
|
|
745
|
-
const pathsToAutogenerate = new
|
|
753
|
+
const pathsToAutogenerate = new Map();
|
|
746
754
|
let rowsWithPaths = filteredRows;
|
|
747
755
|
const rowsWithMissingGroups = [];
|
|
748
756
|
if (visibleRows.length > 0) {
|
|
@@ -769,9 +777,9 @@ const processPivotingRows = (rows, queryOptions, serverOptions, columnsWithDefau
|
|
|
769
777
|
return acc;
|
|
770
778
|
}
|
|
771
779
|
const parentPath = partialPath.slice(0, index + 1);
|
|
772
|
-
const
|
|
773
|
-
if (!pathsToAutogenerate.has(
|
|
774
|
-
pathsToAutogenerate.
|
|
780
|
+
const key = JSON.stringify(parentPath);
|
|
781
|
+
if (!pathsToAutogenerate.has(key)) {
|
|
782
|
+
pathsToAutogenerate.set(key, parentPath);
|
|
775
783
|
}
|
|
776
784
|
}
|
|
777
785
|
acc.push((0, _extends2.default)({}, row, {
|
|
@@ -784,7 +792,7 @@ const processPivotingRows = (rows, queryOptions, serverOptions, columnsWithDefau
|
|
|
784
792
|
path: ['']
|
|
785
793
|
}));
|
|
786
794
|
}
|
|
787
|
-
const autogeneratedRows = generateParentRows(pathsToAutogenerate);
|
|
795
|
+
const autogeneratedRows = generateParentRows(pathsToAutogenerate.values());
|
|
788
796
|
|
|
789
797
|
// Apply tree data filtering to include missing parents and children
|
|
790
798
|
const filteredRowsWithGroups = getTreeDataFilteredRows([...autogeneratedRows, ...rowsWithPaths, ...rowsWithMissingGroups], queryOptions.filterModel, columnsWithDefaultColDef);
|
package/hooks/serverUtils.mjs
CHANGED
|
@@ -200,12 +200,11 @@ const applyAggregation = (aggregationModel, colDefs, rows, groupId = 'root') =>
|
|
|
200
200
|
return aggregateValues;
|
|
201
201
|
};
|
|
202
202
|
const generateParentRows = pathsToAutogenerate => {
|
|
203
|
-
return Array.from(pathsToAutogenerate).map(
|
|
204
|
-
const pathArray = path.split(',');
|
|
203
|
+
return Array.from(pathsToAutogenerate).map(pathArray => {
|
|
205
204
|
return {
|
|
206
205
|
id: `auto-generated-parent-${pathArray.join('-')}`,
|
|
207
|
-
path: pathArray.slice(
|
|
208
|
-
group: pathArray.
|
|
206
|
+
path: pathArray.slice(),
|
|
207
|
+
group: pathArray[pathArray.length - 1]
|
|
209
208
|
};
|
|
210
209
|
});
|
|
211
210
|
};
|
|
@@ -479,7 +478,7 @@ export const processRowGroupingRows = (rows, queryOptions, serverOptions, column
|
|
|
479
478
|
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: serverOptions.groupFields must be defined to compute row grouping data' : _formatErrorMessage(103));
|
|
480
479
|
}
|
|
481
480
|
const delay = randomInt(minDelay, maxDelay);
|
|
482
|
-
const pathsToAutogenerate = new
|
|
481
|
+
const pathsToAutogenerate = new Map();
|
|
483
482
|
let rowsWithPaths = rows;
|
|
484
483
|
const rowsWithMissingGroups = [];
|
|
485
484
|
|
|
@@ -491,13 +490,22 @@ export const processRowGroupingRows = (rows, queryOptions, serverOptions, column
|
|
|
491
490
|
const colDef = columnsWithDefaultColDef.find(({
|
|
492
491
|
field: f
|
|
493
492
|
}) => f === field);
|
|
493
|
+
const rawValue = row[field];
|
|
494
|
+
// multiSelect (array) grouping: empty → missing group, non-empty → sorted-joined
|
|
495
|
+
// key so `['A','B']` and `['B','A']` collapse to one group (matches client).
|
|
496
|
+
if (Array.isArray(rawValue)) {
|
|
497
|
+
if (rawValue.length === 0) {
|
|
498
|
+
return undefined;
|
|
499
|
+
}
|
|
500
|
+
return [...rawValue].sort().join(',');
|
|
501
|
+
}
|
|
494
502
|
if (colDef?.groupingValueGetter) {
|
|
495
|
-
return String(colDef.groupingValueGetter(
|
|
503
|
+
return String(colDef.groupingValueGetter(rawValue, row, colDef, apiRef));
|
|
496
504
|
}
|
|
497
505
|
if (colDef?.valueGetter) {
|
|
498
|
-
return String(colDef.valueGetter(
|
|
506
|
+
return String(colDef.valueGetter(rawValue, row, colDef, apiRef));
|
|
499
507
|
}
|
|
500
|
-
return String(
|
|
508
|
+
return String(rawValue);
|
|
501
509
|
});
|
|
502
510
|
for (let index = 0; index < partialPath.length; index += 1) {
|
|
503
511
|
const value = partialPath[index];
|
|
@@ -510,9 +518,9 @@ export const processRowGroupingRows = (rows, queryOptions, serverOptions, column
|
|
|
510
518
|
return acc;
|
|
511
519
|
}
|
|
512
520
|
const parentPath = partialPath.slice(0, index + 1);
|
|
513
|
-
const
|
|
514
|
-
if (!pathsToAutogenerate.has(
|
|
515
|
-
pathsToAutogenerate.
|
|
521
|
+
const key = JSON.stringify(parentPath);
|
|
522
|
+
if (!pathsToAutogenerate.has(key)) {
|
|
523
|
+
pathsToAutogenerate.set(key, parentPath);
|
|
516
524
|
}
|
|
517
525
|
}
|
|
518
526
|
acc.push(_extends({}, row, {
|
|
@@ -525,7 +533,7 @@ export const processRowGroupingRows = (rows, queryOptions, serverOptions, column
|
|
|
525
533
|
path: ['']
|
|
526
534
|
}));
|
|
527
535
|
}
|
|
528
|
-
const autogeneratedRows = generateParentRows(pathsToAutogenerate);
|
|
536
|
+
const autogeneratedRows = generateParentRows(pathsToAutogenerate.values());
|
|
529
537
|
|
|
530
538
|
// apply plain filtering
|
|
531
539
|
const filteredRows = getTreeDataFilteredRows([...autogeneratedRows, ...rowsWithPaths, ...rowsWithMissingGroups], queryOptions.filterModel, columnsWithDefaultColDef);
|
|
@@ -732,7 +740,7 @@ export const processPivotingRows = (rows, queryOptions, serverOptions, columnsWi
|
|
|
732
740
|
const pivotColumnKeys = Array.from(uniqueColumnGroups.keys());
|
|
733
741
|
|
|
734
742
|
// Add paths and generate parent rows based on `visibleRows` (pivot row fields)
|
|
735
|
-
const pathsToAutogenerate = new
|
|
743
|
+
const pathsToAutogenerate = new Map();
|
|
736
744
|
let rowsWithPaths = filteredRows;
|
|
737
745
|
const rowsWithMissingGroups = [];
|
|
738
746
|
if (visibleRows.length > 0) {
|
|
@@ -759,9 +767,9 @@ export const processPivotingRows = (rows, queryOptions, serverOptions, columnsWi
|
|
|
759
767
|
return acc;
|
|
760
768
|
}
|
|
761
769
|
const parentPath = partialPath.slice(0, index + 1);
|
|
762
|
-
const
|
|
763
|
-
if (!pathsToAutogenerate.has(
|
|
764
|
-
pathsToAutogenerate.
|
|
770
|
+
const key = JSON.stringify(parentPath);
|
|
771
|
+
if (!pathsToAutogenerate.has(key)) {
|
|
772
|
+
pathsToAutogenerate.set(key, parentPath);
|
|
765
773
|
}
|
|
766
774
|
}
|
|
767
775
|
acc.push(_extends({}, row, {
|
|
@@ -774,7 +782,7 @@ export const processPivotingRows = (rows, queryOptions, serverOptions, columnsWi
|
|
|
774
782
|
path: ['']
|
|
775
783
|
}));
|
|
776
784
|
}
|
|
777
|
-
const autogeneratedRows = generateParentRows(pathsToAutogenerate);
|
|
785
|
+
const autogeneratedRows = generateParentRows(pathsToAutogenerate.values());
|
|
778
786
|
|
|
779
787
|
// Apply tree data filtering to include missing parents and children
|
|
780
788
|
const filteredRowsWithGroups = getTreeDataFilteredRows([...autogeneratedRows, ...rowsWithPaths, ...rowsWithMissingGroups], queryOptions.filterModel, columnsWithDefaultColDef);
|
package/hooks/useDemoData.d.mts
CHANGED
|
@@ -15,11 +15,12 @@ export interface UseDemoDataOptions {
|
|
|
15
15
|
maxColumns?: number;
|
|
16
16
|
visibleFields?: string[];
|
|
17
17
|
editable?: boolean;
|
|
18
|
+
multiSelect?: boolean;
|
|
18
19
|
treeData?: AddPathToDemoDataOptions;
|
|
19
20
|
}
|
|
20
21
|
export declare function extrapolateSeed(rowLength: number, data: GridDemoData): Promise<GridDemoData>;
|
|
21
22
|
export declare const deepFreeze: <T>(object: T) => T;
|
|
22
|
-
export interface ColumnsOptions extends Pick<UseDemoDataOptions, 'dataSet' | 'editable' | 'maxColumns' | 'visibleFields'> {}
|
|
23
|
+
export interface ColumnsOptions extends Pick<UseDemoDataOptions, 'dataSet' | 'editable' | 'maxColumns' | 'visibleFields' | 'multiSelect'> {}
|
|
23
24
|
export declare const getColumnsFromOptions: (options: ColumnsOptions) => GridColDefGenerator[];
|
|
24
25
|
export declare const getInitialState: (options: UseDemoDataOptions, columns: GridColDefGenerator[]) => {
|
|
25
26
|
columns: {
|
package/hooks/useDemoData.d.ts
CHANGED
|
@@ -15,11 +15,12 @@ export interface UseDemoDataOptions {
|
|
|
15
15
|
maxColumns?: number;
|
|
16
16
|
visibleFields?: string[];
|
|
17
17
|
editable?: boolean;
|
|
18
|
+
multiSelect?: boolean;
|
|
18
19
|
treeData?: AddPathToDemoDataOptions;
|
|
19
20
|
}
|
|
20
21
|
export declare function extrapolateSeed(rowLength: number, data: GridDemoData): Promise<GridDemoData>;
|
|
21
22
|
export declare const deepFreeze: <T>(object: T) => T;
|
|
22
|
-
export interface ColumnsOptions extends Pick<UseDemoDataOptions, 'dataSet' | 'editable' | 'maxColumns' | 'visibleFields'> {}
|
|
23
|
+
export interface ColumnsOptions extends Pick<UseDemoDataOptions, 'dataSet' | 'editable' | 'maxColumns' | 'visibleFields' | 'multiSelect'> {}
|
|
23
24
|
export declare const getColumnsFromOptions: (options: ColumnsOptions) => GridColDefGenerator[];
|
|
24
25
|
export declare const getInitialState: (options: UseDemoDataOptions, columns: GridColDefGenerator[]) => {
|
|
25
26
|
columns: {
|
package/hooks/useDemoData.js
CHANGED
|
@@ -70,6 +70,9 @@ const deepFreeze = object => {
|
|
|
70
70
|
exports.deepFreeze = deepFreeze;
|
|
71
71
|
const getColumnsFromOptions = options => {
|
|
72
72
|
let columns = options.dataSet === 'Commodity' ? (0, _commodities.getCommodityColumns)(options.editable) : (0, _employees.getEmployeeColumns)();
|
|
73
|
+
if (!options.multiSelect) {
|
|
74
|
+
columns = columns.filter(col => col.type !== 'multiSelect');
|
|
75
|
+
}
|
|
73
76
|
if (options.visibleFields) {
|
|
74
77
|
columns = columns.map(col => (0, _extends2.default)({}, col, {
|
|
75
78
|
hide: !options.visibleFields?.includes(col.field)
|
|
@@ -108,9 +111,10 @@ const useDemoData = options => {
|
|
|
108
111
|
dataSet: options.dataSet,
|
|
109
112
|
editable: options.editable,
|
|
110
113
|
maxColumns: options.maxColumns,
|
|
111
|
-
visibleFields: options.visibleFields
|
|
114
|
+
visibleFields: options.visibleFields,
|
|
115
|
+
multiSelect: options.multiSelect
|
|
112
116
|
});
|
|
113
|
-
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields]);
|
|
117
|
+
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields, options.multiSelect]);
|
|
114
118
|
const [data, setData] = React.useState(() => {
|
|
115
119
|
return (0, _treeDataGenerator.addTreeDataOptionsToDemoData)({
|
|
116
120
|
columns,
|
|
@@ -120,7 +124,7 @@ const useDemoData = options => {
|
|
|
120
124
|
});
|
|
121
125
|
React.useEffect(() => {
|
|
122
126
|
const treeDataKey = (options.treeData?.maxDepth ?? 1) > 1 ? `${options.treeData?.maxDepth}-${options.treeData?.averageChildren ?? 2}-${options.treeData?.groupingField ?? ''}` : 'false';
|
|
123
|
-
const cacheKey = `${options.dataSet}-${rowLength}-${index}-${options.maxColumns}-treeData:${treeDataKey}`;
|
|
127
|
+
const cacheKey = `${options.dataSet}-${rowLength}-${index}-${options.maxColumns}-multiSelect:${options.multiSelect ? 'true' : 'false'}-treeData:${treeDataKey}`;
|
|
124
128
|
|
|
125
129
|
// Cache to allow fast switch between the JavaScript and TypeScript version
|
|
126
130
|
// of the demos.
|
|
@@ -160,7 +164,7 @@ const useDemoData = options => {
|
|
|
160
164
|
return () => {
|
|
161
165
|
active = false;
|
|
162
166
|
};
|
|
163
|
-
}, [rowLength, options.dataSet, options.maxColumns, options.treeData?.maxDepth, options.treeData?.groupingField, options.treeData?.averageChildren, index, columns]);
|
|
167
|
+
}, [rowLength, options.dataSet, options.maxColumns, options.treeData?.maxDepth, options.treeData?.groupingField, options.treeData?.averageChildren, options.multiSelect, index, columns]);
|
|
164
168
|
return {
|
|
165
169
|
data,
|
|
166
170
|
loading,
|
package/hooks/useDemoData.mjs
CHANGED
|
@@ -60,6 +60,9 @@ export const deepFreeze = object => {
|
|
|
60
60
|
};
|
|
61
61
|
export const getColumnsFromOptions = options => {
|
|
62
62
|
let columns = options.dataSet === 'Commodity' ? getCommodityColumns(options.editable) : getEmployeeColumns();
|
|
63
|
+
if (!options.multiSelect) {
|
|
64
|
+
columns = columns.filter(col => col.type !== 'multiSelect');
|
|
65
|
+
}
|
|
63
66
|
if (options.visibleFields) {
|
|
64
67
|
columns = columns.map(col => _extends({}, col, {
|
|
65
68
|
hide: !options.visibleFields?.includes(col.field)
|
|
@@ -96,9 +99,10 @@ export const useDemoData = options => {
|
|
|
96
99
|
dataSet: options.dataSet,
|
|
97
100
|
editable: options.editable,
|
|
98
101
|
maxColumns: options.maxColumns,
|
|
99
|
-
visibleFields: options.visibleFields
|
|
102
|
+
visibleFields: options.visibleFields,
|
|
103
|
+
multiSelect: options.multiSelect
|
|
100
104
|
});
|
|
101
|
-
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields]);
|
|
105
|
+
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields, options.multiSelect]);
|
|
102
106
|
const [data, setData] = React.useState(() => {
|
|
103
107
|
return addTreeDataOptionsToDemoData({
|
|
104
108
|
columns,
|
|
@@ -108,7 +112,7 @@ export const useDemoData = options => {
|
|
|
108
112
|
});
|
|
109
113
|
React.useEffect(() => {
|
|
110
114
|
const treeDataKey = (options.treeData?.maxDepth ?? 1) > 1 ? `${options.treeData?.maxDepth}-${options.treeData?.averageChildren ?? 2}-${options.treeData?.groupingField ?? ''}` : 'false';
|
|
111
|
-
const cacheKey = `${options.dataSet}-${rowLength}-${index}-${options.maxColumns}-treeData:${treeDataKey}`;
|
|
115
|
+
const cacheKey = `${options.dataSet}-${rowLength}-${index}-${options.maxColumns}-multiSelect:${options.multiSelect ? 'true' : 'false'}-treeData:${treeDataKey}`;
|
|
112
116
|
|
|
113
117
|
// Cache to allow fast switch between the JavaScript and TypeScript version
|
|
114
118
|
// of the demos.
|
|
@@ -148,7 +152,7 @@ export const useDemoData = options => {
|
|
|
148
152
|
return () => {
|
|
149
153
|
active = false;
|
|
150
154
|
};
|
|
151
|
-
}, [rowLength, options.dataSet, options.maxColumns, options.treeData?.maxDepth, options.treeData?.groupingField, options.treeData?.averageChildren, index, columns]);
|
|
155
|
+
}, [rowLength, options.dataSet, options.maxColumns, options.treeData?.maxDepth, options.treeData?.groupingField, options.treeData?.averageChildren, options.multiSelect, index, columns]);
|
|
152
156
|
return {
|
|
153
157
|
data,
|
|
154
158
|
loading,
|
package/hooks/useMockServer.d.ts
CHANGED
package/hooks/useMockServer.js
CHANGED
|
@@ -45,6 +45,9 @@ const getColumnsFromOptions = options => {
|
|
|
45
45
|
default:
|
|
46
46
|
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: Unknown dataset' : (0, _formatErrorMessage2.default)(106));
|
|
47
47
|
}
|
|
48
|
+
if (!options.multiSelect) {
|
|
49
|
+
columns = columns.filter(col => col.type !== 'multiSelect');
|
|
50
|
+
}
|
|
48
51
|
if (options.visibleFields) {
|
|
49
52
|
columns = columns.map(col => (0, _extends2.default)({}, col, {
|
|
50
53
|
hide: !options.visibleFields?.includes(col.field)
|
|
@@ -133,9 +136,10 @@ const useMockServer = (dataSetOptions, serverOptions, shouldRequestsFail, nested
|
|
|
133
136
|
editable: options.editable,
|
|
134
137
|
maxColumns: options.maxColumns,
|
|
135
138
|
visibleFields: options.visibleFields,
|
|
136
|
-
derivedColumns: options.derivedColumns
|
|
139
|
+
derivedColumns: options.derivedColumns,
|
|
140
|
+
multiSelect: options.multiSelect
|
|
137
141
|
});
|
|
138
|
-
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields, options.derivedColumns]);
|
|
142
|
+
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields, options.derivedColumns, options.multiSelect]);
|
|
139
143
|
const initialState = React.useMemo(() => getInitialState(columns, options.treeData?.groupingField), [columns, options.treeData?.groupingField]);
|
|
140
144
|
const columnsWithDerivedColDef = React.useMemo(() => columns.map(column => (0, _extends2.default)({}, defaultColDef[column.type || 'string'], column)), [columns]);
|
|
141
145
|
const columnsWithDefaultColDef = React.useMemo(() => columnsWithDerivedColDef.filter(column => !column.derivedFrom), [columnsWithDerivedColDef]);
|
package/hooks/useMockServer.mjs
CHANGED
|
@@ -38,6 +38,9 @@ const getColumnsFromOptions = options => {
|
|
|
38
38
|
default:
|
|
39
39
|
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI X: Unknown dataset' : _formatErrorMessage(106));
|
|
40
40
|
}
|
|
41
|
+
if (!options.multiSelect) {
|
|
42
|
+
columns = columns.filter(col => col.type !== 'multiSelect');
|
|
43
|
+
}
|
|
41
44
|
if (options.visibleFields) {
|
|
42
45
|
columns = columns.map(col => _extends({}, col, {
|
|
43
46
|
hide: !options.visibleFields?.includes(col.field)
|
|
@@ -126,9 +129,10 @@ export const useMockServer = (dataSetOptions, serverOptions, shouldRequestsFail,
|
|
|
126
129
|
editable: options.editable,
|
|
127
130
|
maxColumns: options.maxColumns,
|
|
128
131
|
visibleFields: options.visibleFields,
|
|
129
|
-
derivedColumns: options.derivedColumns
|
|
132
|
+
derivedColumns: options.derivedColumns,
|
|
133
|
+
multiSelect: options.multiSelect
|
|
130
134
|
});
|
|
131
|
-
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields, options.derivedColumns]);
|
|
135
|
+
}, [options.dataSet, options.editable, options.maxColumns, options.visibleFields, options.derivedColumns, options.multiSelect]);
|
|
132
136
|
const initialState = React.useMemo(() => getInitialState(columns, options.treeData?.groupingField), [columns, options.treeData?.groupingField]);
|
|
133
137
|
const columnsWithDerivedColDef = React.useMemo(() => columns.map(column => _extends({}, defaultColDef[column.type || 'string'], column)), [columns]);
|
|
134
138
|
const columnsWithDefaultColDef = React.useMemo(() => columnsWithDerivedColDef.filter(column => !column.derivedFrom), [columnsWithDerivedColDef]);
|
package/hooks/useQuery.d.mts
CHANGED
|
@@ -167,6 +167,63 @@ export declare const createFakeServer: (dataSetOptions?: Partial<UseDemoDataOpti
|
|
|
167
167
|
dataGeneratorUniquenessEnabled?: boolean;
|
|
168
168
|
hide?: boolean;
|
|
169
169
|
derivedFrom?: string;
|
|
170
|
+
} | {
|
|
171
|
+
type: "multiSelect";
|
|
172
|
+
valueOptions?: import("@mui/x-data-grid").ValueOptions[] | ((params: import("@mui/x-data-grid").GridValueOptionsParams<any>) => Array<import("@mui/x-data-grid").ValueOptions>) | undefined;
|
|
173
|
+
getOptionLabel: (value: import("@mui/x-data-grid").ValueOptions) => string;
|
|
174
|
+
getOptionValue: (value: import("@mui/x-data-grid").ValueOptions) => string | number;
|
|
175
|
+
separator?: string;
|
|
176
|
+
field: string;
|
|
177
|
+
headerName?: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
width?: number;
|
|
180
|
+
flex?: number;
|
|
181
|
+
minWidth?: number;
|
|
182
|
+
maxWidth?: number;
|
|
183
|
+
hideable?: boolean;
|
|
184
|
+
sortable?: boolean;
|
|
185
|
+
sortingOrder?: readonly import("@mui/x-data-grid").GridSortDirection[];
|
|
186
|
+
resizable?: boolean;
|
|
187
|
+
editable?: boolean;
|
|
188
|
+
groupable?: boolean;
|
|
189
|
+
pinnable?: boolean;
|
|
190
|
+
sortComparator?: import("@mui/x-data-grid").GridComparatorFn<any> | undefined;
|
|
191
|
+
getSortComparator?: ((sortDirection: import("@mui/x-data-grid").GridSortDirection) => import("@mui/x-data-grid").GridComparatorFn<any> | undefined) | undefined;
|
|
192
|
+
align?: import("@mui/x-data-grid").GridAlignment;
|
|
193
|
+
valueGetter?: import("@mui/x-data-grid").GridValueGetter<any, any, any, never> | undefined;
|
|
194
|
+
rowSpanValueGetter?: import("@mui/x-data-grid").GridValueGetter<any, any, any, never> | undefined;
|
|
195
|
+
valueSetter?: import("@mui/x-data-grid").GridValueSetter<any, any, any> | undefined;
|
|
196
|
+
valueFormatter?: import("@mui/x-data-grid").GridValueFormatter<any, any, any, never> | undefined;
|
|
197
|
+
valueParser?: import("@mui/x-data-grid").GridValueParser<any, any, any> | undefined;
|
|
198
|
+
cellClassName?: import("@mui/x-data-grid").GridCellClassNamePropType<any, any> | undefined;
|
|
199
|
+
display?: "text" | "flex";
|
|
200
|
+
renderCell?: ((params: import("@mui/x-data-grid").GridRenderCellParams<any, any, any, import("@mui/x-data-grid").GridTreeNodeWithRender>) => React.ReactNode) | undefined;
|
|
201
|
+
renderEditCell?: ((params: import("@mui/x-data-grid").GridRenderEditCellParams<any, any, any, import("@mui/x-data-grid").GridTreeNodeWithRender>) => React.ReactNode) | undefined;
|
|
202
|
+
preProcessEditCellProps?: ((params: import("@mui/x-data-grid").GridPreProcessEditCellProps) => import("@mui/x-data-grid").GridEditCellProps | Promise<import("@mui/x-data-grid").GridEditCellProps>) | undefined;
|
|
203
|
+
headerClassName?: import("@mui/x-data-grid").GridColumnHeaderClassNamePropType;
|
|
204
|
+
renderHeader?: ((params: import("@mui/x-data-grid").GridColumnHeaderParams<any, any, any>) => React.ReactNode) | undefined;
|
|
205
|
+
headerAlign?: import("@mui/x-data-grid").GridAlignment;
|
|
206
|
+
hideSortIcons?: boolean;
|
|
207
|
+
disableColumnMenu?: boolean;
|
|
208
|
+
filterable?: boolean;
|
|
209
|
+
filterOperators?: readonly import("@mui/x-data-grid").GridFilterOperator<any, any, any, any>[] | undefined;
|
|
210
|
+
getApplyQuickFilterFn?: import("@mui/x-data-grid").GetApplyQuickFilterFn<any, any> | undefined;
|
|
211
|
+
disableReorder?: boolean;
|
|
212
|
+
disableExport?: boolean;
|
|
213
|
+
colSpan?: number | import("@mui/x-data-grid").GridColSpanFn<any, any, any> | undefined;
|
|
214
|
+
examples?: any[] | undefined;
|
|
215
|
+
renderHeaderFilter?: (params: import("@mui/x-data-grid-pro").GridRenderHeaderFilterProps) => React.ReactNode;
|
|
216
|
+
aggregable?: boolean;
|
|
217
|
+
availableAggregationFunctions?: string[];
|
|
218
|
+
groupingValueGetter?: import("@mui/x-data-grid-premium").GridGroupingValueGetter<any> | undefined;
|
|
219
|
+
groupingValueSetter?: import("@mui/x-data-grid-premium").GridGroupingValueSetter<any> | undefined;
|
|
220
|
+
pastedValueParser?: import("@mui/x-data-grid-premium").GridPastedValueParser<any, any, any> | undefined;
|
|
221
|
+
pivotable?: boolean;
|
|
222
|
+
chartable?: boolean;
|
|
223
|
+
generateData?: (row: any, context: import("../index.mjs").GridDataGeneratorContext) => any;
|
|
224
|
+
dataGeneratorUniquenessEnabled?: boolean;
|
|
225
|
+
hide?: boolean;
|
|
226
|
+
derivedFrom?: string;
|
|
170
227
|
})[];
|
|
171
228
|
initialState: {
|
|
172
229
|
columns: {
|
package/hooks/useQuery.d.ts
CHANGED
|
@@ -167,6 +167,63 @@ export declare const createFakeServer: (dataSetOptions?: Partial<UseDemoDataOpti
|
|
|
167
167
|
dataGeneratorUniquenessEnabled?: boolean;
|
|
168
168
|
hide?: boolean;
|
|
169
169
|
derivedFrom?: string;
|
|
170
|
+
} | {
|
|
171
|
+
type: "multiSelect";
|
|
172
|
+
valueOptions?: import("@mui/x-data-grid").ValueOptions[] | ((params: import("@mui/x-data-grid").GridValueOptionsParams<any>) => Array<import("@mui/x-data-grid").ValueOptions>) | undefined;
|
|
173
|
+
getOptionLabel: (value: import("@mui/x-data-grid").ValueOptions) => string;
|
|
174
|
+
getOptionValue: (value: import("@mui/x-data-grid").ValueOptions) => string | number;
|
|
175
|
+
separator?: string;
|
|
176
|
+
field: string;
|
|
177
|
+
headerName?: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
width?: number;
|
|
180
|
+
flex?: number;
|
|
181
|
+
minWidth?: number;
|
|
182
|
+
maxWidth?: number;
|
|
183
|
+
hideable?: boolean;
|
|
184
|
+
sortable?: boolean;
|
|
185
|
+
sortingOrder?: readonly import("@mui/x-data-grid").GridSortDirection[];
|
|
186
|
+
resizable?: boolean;
|
|
187
|
+
editable?: boolean;
|
|
188
|
+
groupable?: boolean;
|
|
189
|
+
pinnable?: boolean;
|
|
190
|
+
sortComparator?: import("@mui/x-data-grid").GridComparatorFn<any> | undefined;
|
|
191
|
+
getSortComparator?: ((sortDirection: import("@mui/x-data-grid").GridSortDirection) => import("@mui/x-data-grid").GridComparatorFn<any> | undefined) | undefined;
|
|
192
|
+
align?: import("@mui/x-data-grid").GridAlignment;
|
|
193
|
+
valueGetter?: import("@mui/x-data-grid").GridValueGetter<any, any, any, never> | undefined;
|
|
194
|
+
rowSpanValueGetter?: import("@mui/x-data-grid").GridValueGetter<any, any, any, never> | undefined;
|
|
195
|
+
valueSetter?: import("@mui/x-data-grid").GridValueSetter<any, any, any> | undefined;
|
|
196
|
+
valueFormatter?: import("@mui/x-data-grid").GridValueFormatter<any, any, any, never> | undefined;
|
|
197
|
+
valueParser?: import("@mui/x-data-grid").GridValueParser<any, any, any> | undefined;
|
|
198
|
+
cellClassName?: import("@mui/x-data-grid").GridCellClassNamePropType<any, any> | undefined;
|
|
199
|
+
display?: "text" | "flex";
|
|
200
|
+
renderCell?: ((params: import("@mui/x-data-grid").GridRenderCellParams<any, any, any, import("@mui/x-data-grid").GridTreeNodeWithRender>) => React.ReactNode) | undefined;
|
|
201
|
+
renderEditCell?: ((params: import("@mui/x-data-grid").GridRenderEditCellParams<any, any, any, import("@mui/x-data-grid").GridTreeNodeWithRender>) => React.ReactNode) | undefined;
|
|
202
|
+
preProcessEditCellProps?: ((params: import("@mui/x-data-grid").GridPreProcessEditCellProps) => import("@mui/x-data-grid").GridEditCellProps | Promise<import("@mui/x-data-grid").GridEditCellProps>) | undefined;
|
|
203
|
+
headerClassName?: import("@mui/x-data-grid").GridColumnHeaderClassNamePropType;
|
|
204
|
+
renderHeader?: ((params: import("@mui/x-data-grid").GridColumnHeaderParams<any, any, any>) => React.ReactNode) | undefined;
|
|
205
|
+
headerAlign?: import("@mui/x-data-grid").GridAlignment;
|
|
206
|
+
hideSortIcons?: boolean;
|
|
207
|
+
disableColumnMenu?: boolean;
|
|
208
|
+
filterable?: boolean;
|
|
209
|
+
filterOperators?: readonly import("@mui/x-data-grid").GridFilterOperator<any, any, any, any>[] | undefined;
|
|
210
|
+
getApplyQuickFilterFn?: import("@mui/x-data-grid").GetApplyQuickFilterFn<any, any> | undefined;
|
|
211
|
+
disableReorder?: boolean;
|
|
212
|
+
disableExport?: boolean;
|
|
213
|
+
colSpan?: number | import("@mui/x-data-grid").GridColSpanFn<any, any, any> | undefined;
|
|
214
|
+
examples?: any[] | undefined;
|
|
215
|
+
renderHeaderFilter?: (params: import("@mui/x-data-grid-pro").GridRenderHeaderFilterProps) => React.ReactNode;
|
|
216
|
+
aggregable?: boolean;
|
|
217
|
+
availableAggregationFunctions?: string[];
|
|
218
|
+
groupingValueGetter?: import("@mui/x-data-grid-premium").GridGroupingValueGetter<any> | undefined;
|
|
219
|
+
groupingValueSetter?: import("@mui/x-data-grid-premium").GridGroupingValueSetter<any> | undefined;
|
|
220
|
+
pastedValueParser?: import("@mui/x-data-grid-premium").GridPastedValueParser<any, any, any> | undefined;
|
|
221
|
+
pivotable?: boolean;
|
|
222
|
+
chartable?: boolean;
|
|
223
|
+
generateData?: (row: any, context: import("../index.js").GridDataGeneratorContext) => any;
|
|
224
|
+
dataGeneratorUniquenessEnabled?: boolean;
|
|
225
|
+
hide?: boolean;
|
|
226
|
+
derivedFrom?: string;
|
|
170
227
|
})[];
|
|
171
228
|
initialState: {
|
|
172
229
|
columns: {
|
package/index.js
CHANGED
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-generator",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Generate fake data for demo purposes only.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"chance": "^1.1.13",
|
|
26
26
|
"clsx": "^2.1.1",
|
|
27
27
|
"lru-cache": "^11.5.1",
|
|
28
|
-
"@mui/x-data-grid": "^9.
|
|
29
|
-
"@mui/x-data-grid-pro": "^9.
|
|
28
|
+
"@mui/x-data-grid": "^9.5.0",
|
|
29
|
+
"@mui/x-data-grid-pro": "^9.5.0",
|
|
30
30
|
"@mui/x-internals": "^9.1.0",
|
|
31
|
-
"@mui/x-data-grid-premium": "^9.
|
|
31
|
+
"@mui/x-data-grid-premium": "^9.5.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@emotion/react": "^11.9.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 = [{
|