@mui/x-data-grid-generator 5.15.3 → 5.17.1

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,6 +3,155 @@
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
+ ## 5.17.1
7
+
8
+ _Sep 5, 2022_
9
+
10
+ We'd like to offer a big thanks to the 3 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🐞 Bugfixes
13
+
14
+ ### `@mui/x-data-grid@v5.17.1` / `@mui/x-data-grid-pro@v5.17.1` / `@mui/x-data-grid-premium@v5.17.1`
15
+
16
+ #### Changes
17
+
18
+ - [DataGrid] Fix cells being focused on mouseUp (#5980) @cherniavskii
19
+ - [DataGrid] Fix focused cell if column is spanned and new editing API is used (#5962) @m4theushw
20
+ - [DataGridPro] Fix import in lazy-loading causing a bundling error (#6031) @flaviendelangle
21
+
22
+ ## 5.17.0
23
+
24
+ _Sep 2, 2022_
25
+
26
+ 🎉 We are excited to finally introduce a stable release (v5.0.0) for the `@mui/x-date-pickers` and `@mui/x-date-pickers-pro` packages!
27
+
28
+ If you are still using picker components from the `lab`, take a look at the [migration guide](https://mui.com/x/react-date-pickers/migration-lab/).
29
+
30
+ We'd like to offer a big thanks to the 9 contributors who made this release possible. Here are some highlights ✨:
31
+
32
+ - 🎁 Implement Lazy loading (#5214) @DanailH
33
+
34
+ Pro users now can try the experimental lazy loading feature.
35
+ In a few steps, you can load your data on demand, as the rows are displayed.
36
+
37
+ To enable this feature, add `experimentalFeatures={{ lazyLoading: true }}`.
38
+ Lazy Loading requires a few other settings.
39
+ See the [documentation](https://mui.com/x/react-data-grid/row-updates/#lazy-loading) to explore the example in detail.
40
+
41
+ - 🚀 Improve `pickers` focus management (#5820) @alexfauquette
42
+ - 🎉 Enable disabling `day` on date range picker depending on `position` (#5773) @alexfauquette
43
+ - ✨ Various improvements
44
+ - 📚 Documentation improvements
45
+ - 🐞 Bugfixes
46
+
47
+ ### `@mui/x-data-grid@v5.17.0` / `@mui/x-data-grid-pro@v5.17.0` / `@mui/x-data-grid-premium@v5.17.0`
48
+
49
+ #### Changes
50
+
51
+ - [DataGrid] Add `sort` prop to columns panel slot (#5888) @gavbrennan
52
+ - [DataGrid] Do not throw if `fieldToFocus` cannot be found (#5871) @cherniavskii
53
+ - [DataGrid] Support `getRowId` in the `replaceRows` method (#5988) @flaviendelangle
54
+ - [DataGridPro] Add class name to row with open detail panel (#5924) @m4theushw
55
+ - [DataGridPro] Fix crash when using `pinnedRows` + `getRowClassName` props and `rows=[]` (#5851) @cherniavskii
56
+ - [DataGridPro] Fix filtering with inactive filter items (#5993) @alexfauquette
57
+ - [DataGridPro] Implement Lazy loading (#5214) @DanailH
58
+ - [DataGridPro] Support pinned columns and dynamic row height (#5782) @m4theushw
59
+ - [DataGridPremium] Add state initializer for column groups (#5963) @alexfauquette
60
+ - [DataGridPremium] Update grouping when `groupingValueGetter` changes (#5919) @flaviendelangle
61
+ - [DataGridPremium] Use the aggregated value on tree data real groups (#5953) @flaviendelangle
62
+
63
+ ### `@mui/x-date-pickers@v5.0.0` / `@mui/x-date-pickers-pro@v5.0.0`
64
+
65
+ #### Changes
66
+
67
+ - [DatePicker] Improve focus management (#5820) @alexfauquette
68
+ - [DateRangePicker] Enable disabling `day` depending on `position` (#5773) @alexfauquette
69
+ - [DateTimePicker] Create a new `tabs` component slot (#5972) @LukasTy
70
+ - [pickers] Do not forward validation props to the DOM on field components (#5971) @flaviendelangle
71
+ - [pickers] Do not hardcode `date-fns` elements in field components (#5975) @flaviendelangle
72
+ - [pickers] Do not require `date-fns` in `@mui/x-date-pickers-pro` (#5941) @flaviendelangle
73
+ - [pickers] Fix mobile picker not opening on label click (#5651) @LukasTy
74
+ - [pickers] Improve DOM event management on `useField` (#5901) @flaviendelangle
75
+ - [pickers] Include `community` package `themeAugmentation` in `pro` package types (#5969) @LukasTy
76
+ - [pickers] Rename `DateRangeField` into `SingleInputDateRangeField` (#5961) @flaviendelangle
77
+ - [pickers] Support `isSameError` on field components (#5984) @flaviendelangle
78
+
79
+ ### Docs
80
+
81
+ - [docs] Add `description` and `default` to pickers slots (#5893) @alexfauquette
82
+ - [docs] Fix typo (#5945) @wettopa
83
+ - [docs] Fix typo `onYearPicker` to `onYearChange` (#5954) @alexfauquette
84
+ - [docs] Update `GridCellParams`'s `value` description (#5849) @cherniavskii
85
+ - [docs] Update `README.md` to match Introduction section of the docs (#5754) @samuelsycamore
86
+
87
+ ### Core
88
+
89
+ - [core] Fix typo (#5990) @flaviendelangle
90
+ - [core] Remove old babel resolve rule (#5939) @oliviertassinari
91
+ - [core] Remove outdated TODO (#5956) @flaviendelangle
92
+ - [core] Upgrade monorepo (#5960) @cherniavskii
93
+ - [core] Fix statics (#5986) @DanailH
94
+ - [core] Remove unused dependencies (#5937) @oliviertassinari
95
+ - [license] Remove CLI (#5757) @flaviendelangle
96
+ - [test] Fix time zone sensitive test (#5955) @LukasTy
97
+ - [test] Use `userEvent.mousePress` instead of `fireClickEvent` (#5920) @cherniavskii
98
+
99
+ ## 5.16.0
100
+
101
+ _Aug 25, 2022_
102
+
103
+ We'd like to offer a big thanks to the 11 contributors who made this release possible. Here are some highlights ✨:
104
+
105
+ - 🎁 Introduce column grouping for data grid (#5133) @alexfauquette
106
+
107
+ You can now group columns using the `columnGroupingModel` prop. This lets you to display more structured data.
108
+
109
+ <img src="https://user-images.githubusercontent.com/45398769/186178366-4fba66b2-bf90-4c7a-9d83-940a7fc78704.png" width="800" />
110
+
111
+ To enable this feature, add `experimentalFeatures={{ columnGrouping: true }}`.
112
+ The grouping header can be fully customized.
113
+ See the [documentation](https://mui.com/x/react-data-grid/column-groups/) to explore everything it has to offer.
114
+
115
+ - 🐞 Bugfixes
116
+ - 🌏 New locales for pickers thanks to @tesseractjh and @drastus
117
+
118
+ ### `@mui/x-data-grid@v5.16.0` / `@mui/x-data-grid-pro@v5.16.0` / `@mui/x-data-grid-premium@v5.16.0`
119
+
120
+ #### Changes
121
+
122
+ - [DataGrid] Implement column grouping (#5133) @alexfauquette
123
+ - [DataGrid] Handle `disableVirtualization` prop change (#5889) @cherniavskii
124
+ - [DataGrid] Improve `GridRowModel` typing (#5734) @cherniavskii
125
+ - [DataGrid] Update deprecation note for `GridColDef` `hide` property (#5886) @cherniavskii
126
+
127
+ ### `@mui/x-date-pickers@v5.0.0-beta.7` / `@mui/x-date-pickers-pro@v5.0.0-beta.7`
128
+
129
+ #### Changes
130
+
131
+ - [DatePicker] Fix to pass down `className` prop provided on DatePicker to `renderInput` (#5471) @CruseCtrl
132
+ - [DatePicker] Improve `a11y` support (#5809) @LukasTy
133
+ - [pickers] Add `PaperContent` component slot (#5801) @LukasTy
134
+ - [pickers] Add a breaking change section in the migration guide (#5805) @alexfauquette
135
+ - [pickers] Add new translations to `localeText` (#5143) @alexfauquette
136
+ - [pickers] Document components slots (#4657) @flaviendelangle
137
+ - [pickers] Add new unstable field components (#5504) @flaviendelangle
138
+ - [pickers] Fallback to default `minDate` / `maxDate` when `null` value is passed (#5397) @flaviendelangle
139
+ - [l10n] Add Korean (ko-KR) locale (#5854) @tesseractjh
140
+ - [l10n] Add Polish (pl-PL) locale (#5833) @drastus
141
+
142
+ ### Docs
143
+
144
+ - [docs] Fix typo in `migration from lab` (#5277) @chuckwired
145
+ - [docs] Use `dayjs` instead of `date-fns` in doc examples (#5481) @flaviendelangle
146
+
147
+ ### Core
148
+
149
+ - [core] Clarify the scope of the license key used for tests and documentation (#5824) @oliviertassinari
150
+ - [core] Fix Typescript error on field hooks (#5892) @flaviendelangle
151
+ - [core] Memoize `columns` in `useDemoData` hook (#5848) @cherniavskii
152
+ - [core] Remove Firefox from the BrowserStack list (#5874) @DanailH
153
+ - [core] Small changes to the release script (#5840) @m4theushw
154
+
6
155
  ## 5.15.3
7
156
 
8
157
  _Aug 18, 2022_
@@ -529,7 +678,7 @@ We'd like to offer a big thanks to the 15 contributors who made this release pos
529
678
 
530
679
  **MonthPicker**: The prop `onMonthChange` has been removed, you can use `onChange` instead since every change is a month change
531
680
 
532
- **YearPicker**: The prop `onYearPicker` has been removed, you can use `onChange` instead since every change is a year change
681
+ **YearPicker**: The prop `onYearChange` has been removed, you can use `onChange` instead since every change is a year change
533
682
 
534
683
  **DayPicker**: The prop `isDateDisabled` has been removed, you can now use the same validation props as for the other components (`maxDate`, `minDate`, `shouldDisableDate`, `disableFuture` and `disablePast`)
535
684
 
@@ -113,7 +113,7 @@ export const useDemoData = options => {
113
113
  const [rowLength, setRowLength] = React.useState(options.rowLength);
114
114
  const [index, setIndex] = React.useState(0);
115
115
  const [loading, setLoading] = React.useState(true);
116
- const getColumns = React.useCallback(() => {
116
+ const columns = React.useMemo(() => {
117
117
  return getColumnsFromOptions({
118
118
  dataSet: options.dataSet,
119
119
  editable: options.editable,
@@ -122,7 +122,6 @@ export const useDemoData = options => {
122
122
  });
123
123
  }, [options.dataSet, options.editable, options.maxColumns, options.visibleFields]);
124
124
  const [data, setData] = React.useState(() => {
125
- const columns = getColumns();
126
125
  return addTreeDataOptionsToDemoData({
127
126
  columns,
128
127
  rows: [],
@@ -149,10 +148,10 @@ export const useDemoData = options => {
149
148
  let newData;
150
149
 
151
150
  if (rowLength > 1000) {
152
- newData = await getRealGridData(1000, getColumns());
151
+ newData = await getRealGridData(1000, columns);
153
152
  newData = await extrapolateSeed(rowLength, newData);
154
153
  } else {
155
- newData = await getRealGridData(rowLength, getColumns());
154
+ newData = await getRealGridData(rowLength, columns);
156
155
  }
157
156
 
158
157
  if (!active) {
@@ -177,7 +176,7 @@ export const useDemoData = options => {
177
176
  return () => {
178
177
  active = false;
179
178
  };
180
- }, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index, getColumns]);
179
+ }, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index, columns]);
181
180
  return {
182
181
  data,
183
182
  loading,
@@ -1,24 +1,83 @@
1
- import { GridRowModel, GridFilterModel, GridSortModel, GridRowId } from '@mui/x-data-grid-pro';
1
+ import * as React from 'react';
2
+ import { GridRowModel, GridFilterModel, GridSortModel, GridRowId, GridFilterOperator, GridColDef } from '@mui/x-data-grid-pro';
2
3
  import { UseDemoDataOptions } from './useDemoData';
4
+ /**
5
+ * Simulates server data loading
6
+ */
7
+ export declare const loadServerRows: (rows: GridRowModel[], queryOptions: QueryOptions, serverOptions: ServerOptions, columnsWithDefaultColDef: GridColDef[]) => Promise<FakeServerResponse>;
8
+ interface FakeServerResponse {
9
+ returnedRows: GridRowModel[];
10
+ nextCursor?: string;
11
+ totalRowCount: number;
12
+ }
3
13
  interface PageInfo {
4
14
  totalRowCount?: number;
5
15
  nextCursor?: string;
6
16
  pageSize?: number;
7
17
  }
8
- export interface ServerOptions {
18
+ interface DefaultServerOptions {
9
19
  minDelay: number;
10
20
  maxDelay: number;
11
21
  useCursorPagination?: boolean;
12
22
  }
23
+ declare type ServerOptions = Partial<DefaultServerOptions>;
13
24
  export interface QueryOptions {
14
25
  cursor?: GridRowId;
15
26
  page?: number;
16
27
  pageSize?: number;
17
28
  filterModel?: GridFilterModel;
18
29
  sortModel?: GridSortModel;
30
+ firstRowToRender?: number;
31
+ lastRowToRender?: number;
19
32
  }
20
- export declare const createFakeServer: (dataSetOptions?: Partial<UseDemoDataOptions>, serverOptions?: Partial<ServerOptions>) => {
33
+ export declare const createFakeServer: (dataSetOptions?: Partial<UseDemoDataOptions>, serverOptions?: ServerOptions) => {
21
34
  columns: import("..").GridColDefGenerator[];
35
+ columnsWithDefaultColDef: {
36
+ generateData?: ((row: any, context: import("..").GridDataGeneratorContext) => any) | undefined;
37
+ dataGeneratorUniquenessEnabled?: boolean | undefined;
38
+ field: string;
39
+ headerName?: string | undefined;
40
+ description?: string | undefined;
41
+ width?: number | undefined;
42
+ flex?: number | undefined;
43
+ minWidth?: number | undefined;
44
+ maxWidth?: number | undefined;
45
+ hide?: boolean | undefined;
46
+ hideable?: boolean | undefined;
47
+ sortable?: boolean | undefined;
48
+ sortingOrder?: import("@mui/x-data-grid-pro").GridSortDirection[] | undefined;
49
+ resizable?: boolean | undefined;
50
+ editable?: boolean | undefined;
51
+ groupable?: boolean | undefined;
52
+ pinnable?: boolean | undefined;
53
+ sortComparator?: import("@mui/x-data-grid-pro").GridComparatorFn<any> | undefined;
54
+ type?: string | undefined;
55
+ valueOptions?: import("@mui/x-data-grid-pro").ValueOptions[] | ((params: import("@mui/x-data-grid-pro").GridValueOptionsParams<any>) => import("@mui/x-data-grid-pro").ValueOptions[]) | undefined;
56
+ align?: import("@mui/x-data-grid-pro").GridAlignment | undefined;
57
+ valueGetter?: ((params: import("@mui/x-data-grid-pro").GridValueGetterParams<any, any>) => any) | undefined;
58
+ valueSetter?: ((params: import("@mui/x-data-grid-pro").GridValueSetterParams<any, any>) => any) | undefined;
59
+ valueFormatter?: ((params: import("@mui/x-data-grid-pro").GridValueFormatterParams<any>) => any) | undefined;
60
+ valueParser?: ((value: any, params?: import("@mui/x-data-grid-pro").GridCellParams<any, any, any> | undefined) => any) | undefined;
61
+ cellClassName?: import("@mui/x-data-grid-pro").GridCellClassNamePropType | undefined;
62
+ renderCell?: ((params: import("@mui/x-data-grid-pro").GridRenderCellParams<any, any, any>) => React.ReactNode) | undefined;
63
+ renderEditCell?: ((params: import("@mui/x-data-grid-pro").GridRenderEditCellParams<any, any, any>) => React.ReactNode) | undefined;
64
+ preProcessEditCellProps?: ((params: import("@mui/x-data-grid-pro").GridPreProcessEditCellProps<any, any>) => import("@mui/x-data-grid-pro").GridEditCellProps<any> | Promise<import("@mui/x-data-grid-pro").GridEditCellProps<any>>) | undefined;
65
+ headerClassName?: import("@mui/x-data-grid-pro").GridColumnHeaderClassNamePropType | undefined;
66
+ renderHeader?: ((params: import("@mui/x-data-grid-pro").GridColumnHeaderParams<any, any, any>) => React.ReactNode) | undefined;
67
+ headerAlign?: import("@mui/x-data-grid-pro").GridAlignment | undefined;
68
+ hideSortIcons?: boolean | undefined;
69
+ disableColumnMenu?: boolean | undefined;
70
+ filterable?: boolean | undefined;
71
+ filterOperators?: GridFilterOperator<any, any, any>[] | undefined;
72
+ getApplyQuickFilterFn?: ((value: any, colDef: import("@mui/x-data-grid-pro").GridStateColDef<any, any, any>, apiRef: React.MutableRefObject<import("@mui/x-data-grid/internals").GridApiCommunity>) => ((params: import("@mui/x-data-grid-pro").GridCellParams<any, any, any>) => boolean) | null) | undefined;
73
+ disableReorder?: boolean | undefined;
74
+ disableExport?: boolean | undefined;
75
+ colSpan?: number | ((params: import("@mui/x-data-grid-pro").GridCellParams<any, any, any>) => number | undefined) | undefined;
76
+ aggregable?: boolean | undefined;
77
+ availableAggregationFunctions?: string[] | undefined;
78
+ groupingValueGetter?: ((params: import("@mui/x-data-grid-premium").GridGroupingValueGetterParams<any, any>) => import("@mui/x-data-grid-pro").GridKeyValue | null | undefined) | undefined;
79
+ extendType?: import("@mui/x-data-grid-pro").GridNativeColTypes | undefined;
80
+ }[];
22
81
  initialState: {
23
82
  columns: {
24
83
  columnVisibilityModel: import("@mui/x-data-grid-pro").GridColumnVisibilityModel;
package/hooks/useQuery.js CHANGED
@@ -109,7 +109,7 @@ const getFilteredRows = (rows, filterModel, columnsWithDefaultColDef) => {
109
109
  */
110
110
 
111
111
 
112
- const loadServerRows = (rows, queryOptions, serverOptions, columnsWithDefaultColDef) => {
112
+ export const loadServerRows = (rows, queryOptions, serverOptions, columnsWithDefaultColDef) => {
113
113
  const {
114
114
  minDelay = 100,
115
115
  maxDelay = 300,
@@ -161,7 +161,6 @@ const loadServerRows = (rows, queryOptions, serverOptions, columnsWithDefaultCol
161
161
  }, delay); // simulate network latency
162
162
  });
163
163
  };
164
-
165
164
  const DEFAULT_DATASET_OPTIONS = {
166
165
  dataSet: 'Commodity',
167
166
  rowLength: 100,
@@ -245,6 +244,7 @@ export const createFakeServer = (dataSetOptions, serverOptions) => {
245
244
 
246
245
  return {
247
246
  columns,
247
+ columnsWithDefaultColDef,
248
248
  initialState,
249
249
  useQuery
250
250
  };
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.15.3
1
+ /** @license MUI v5.17.1
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.
@@ -166,7 +166,7 @@ export var useDemoData = function useDemoData(options) {
166
166
  loading = _React$useState6[0],
167
167
  setLoading = _React$useState6[1];
168
168
 
169
- var getColumns = React.useCallback(function () {
169
+ var columns = React.useMemo(function () {
170
170
  return getColumnsFromOptions({
171
171
  dataSet: options.dataSet,
172
172
  editable: options.editable,
@@ -176,7 +176,6 @@ export var useDemoData = function useDemoData(options) {
176
176
  }, [options.dataSet, options.editable, options.maxColumns, options.visibleFields]);
177
177
 
178
178
  var _React$useState7 = React.useState(function () {
179
- var columns = getColumns();
180
179
  return addTreeDataOptionsToDemoData({
181
180
  columns: columns,
182
181
  rows: [],
@@ -216,7 +215,7 @@ export var useDemoData = function useDemoData(options) {
216
215
  }
217
216
 
218
217
  _context.next = 4;
219
- return getRealGridData(1000, getColumns());
218
+ return getRealGridData(1000, columns);
220
219
 
221
220
  case 4:
222
221
  newData = _context.sent;
@@ -230,7 +229,7 @@ export var useDemoData = function useDemoData(options) {
230
229
 
231
230
  case 10:
232
231
  _context.next = 12;
233
- return getRealGridData(rowLength, getColumns());
232
+ return getRealGridData(rowLength, columns);
234
233
 
235
234
  case 12:
236
235
  newData = _context.sent;
@@ -269,7 +268,7 @@ export var useDemoData = function useDemoData(options) {
269
268
  return function () {
270
269
  active = false;
271
270
  };
272
- }, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index, getColumns]);
271
+ }, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index, columns]);
273
272
  return {
274
273
  data: data,
275
274
  loading: loading,
@@ -128,7 +128,7 @@ var getFilteredRows = function getFilteredRows(rows, filterModel, columnsWithDef
128
128
  */
129
129
 
130
130
 
131
- var loadServerRows = function loadServerRows(rows, queryOptions, serverOptions, columnsWithDefaultColDef) {
131
+ export var loadServerRows = function loadServerRows(rows, queryOptions, serverOptions, columnsWithDefaultColDef) {
132
132
  var _serverOptions$minDel = serverOptions.minDelay,
133
133
  minDelay = _serverOptions$minDel === void 0 ? 100 : _serverOptions$minDel,
134
134
  _serverOptions$maxDel = serverOptions.maxDelay,
@@ -180,7 +180,6 @@ var loadServerRows = function loadServerRows(rows, queryOptions, serverOptions,
180
180
  }, delay); // simulate network latency
181
181
  });
182
182
  };
183
-
184
183
  var DEFAULT_DATASET_OPTIONS = {
185
184
  dataSet: 'Commodity',
186
185
  rowLength: 100,
@@ -303,6 +302,7 @@ export var createFakeServer = function createFakeServer(dataSetOptions, serverOp
303
302
 
304
303
  return {
305
304
  columns: columns,
305
+ columnsWithDefaultColDef: columnsWithDefaultColDef,
306
306
  initialState: initialState,
307
307
  useQuery: useQuery
308
308
  };
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.15.3
1
+ /** @license MUI v5.17.1
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.
@@ -105,7 +105,7 @@ export const useDemoData = options => {
105
105
  const [rowLength, setRowLength] = React.useState(options.rowLength);
106
106
  const [index, setIndex] = React.useState(0);
107
107
  const [loading, setLoading] = React.useState(true);
108
- const getColumns = React.useCallback(() => {
108
+ const columns = React.useMemo(() => {
109
109
  return getColumnsFromOptions({
110
110
  dataSet: options.dataSet,
111
111
  editable: options.editable,
@@ -114,7 +114,6 @@ export const useDemoData = options => {
114
114
  });
115
115
  }, [options.dataSet, options.editable, options.maxColumns, options.visibleFields]);
116
116
  const [data, setData] = React.useState(() => {
117
- const columns = getColumns();
118
117
  return addTreeDataOptionsToDemoData({
119
118
  columns,
120
119
  rows: [],
@@ -139,10 +138,10 @@ export const useDemoData = options => {
139
138
  let newData;
140
139
 
141
140
  if (rowLength > 1000) {
142
- newData = await getRealGridData(1000, getColumns());
141
+ newData = await getRealGridData(1000, columns);
143
142
  newData = await extrapolateSeed(rowLength, newData);
144
143
  } else {
145
- newData = await getRealGridData(rowLength, getColumns());
144
+ newData = await getRealGridData(rowLength, columns);
146
145
  }
147
146
 
148
147
  if (!active) {
@@ -167,7 +166,7 @@ export const useDemoData = options => {
167
166
  return () => {
168
167
  active = false;
169
168
  };
170
- }, [rowLength, options.dataSet, options.maxColumns, options.treeData?.maxDepth, options.treeData?.groupingField, options.treeData?.averageChildren, index, getColumns]);
169
+ }, [rowLength, options.dataSet, options.maxColumns, options.treeData?.maxDepth, options.treeData?.groupingField, options.treeData?.averageChildren, index, columns]);
171
170
  return {
172
171
  data,
173
172
  loading,
@@ -105,7 +105,7 @@ const getFilteredRows = (rows, filterModel, columnsWithDefaultColDef) => {
105
105
  */
106
106
 
107
107
 
108
- const loadServerRows = (rows, queryOptions, serverOptions, columnsWithDefaultColDef) => {
108
+ export const loadServerRows = (rows, queryOptions, serverOptions, columnsWithDefaultColDef) => {
109
109
  const {
110
110
  minDelay = 100,
111
111
  maxDelay = 300,
@@ -157,7 +157,6 @@ const loadServerRows = (rows, queryOptions, serverOptions, columnsWithDefaultCol
157
157
  }, delay); // simulate network latency
158
158
  });
159
159
  };
160
-
161
160
  const DEFAULT_DATASET_OPTIONS = {
162
161
  dataSet: 'Commodity',
163
162
  rowLength: 100,
@@ -241,6 +240,7 @@ export const createFakeServer = (dataSetOptions, serverOptions) => {
241
240
 
242
241
  return {
243
242
  columns,
243
+ columnsWithDefaultColDef,
244
244
  initialState,
245
245
  useQuery
246
246
  };
package/modern/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.15.3
1
+ /** @license MUI v5.17.1
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.
@@ -140,7 +140,7 @@ const useDemoData = options => {
140
140
  const [rowLength, setRowLength] = React.useState(options.rowLength);
141
141
  const [index, setIndex] = React.useState(0);
142
142
  const [loading, setLoading] = React.useState(true);
143
- const getColumns = React.useCallback(() => {
143
+ const columns = React.useMemo(() => {
144
144
  return getColumnsFromOptions({
145
145
  dataSet: options.dataSet,
146
146
  editable: options.editable,
@@ -149,7 +149,6 @@ const useDemoData = options => {
149
149
  });
150
150
  }, [options.dataSet, options.editable, options.maxColumns, options.visibleFields]);
151
151
  const [data, setData] = React.useState(() => {
152
- const columns = getColumns();
153
152
  return (0, _treeDataGenerator.addTreeDataOptionsToDemoData)({
154
153
  columns,
155
154
  rows: [],
@@ -176,10 +175,10 @@ const useDemoData = options => {
176
175
  let newData;
177
176
 
178
177
  if (rowLength > 1000) {
179
- newData = await (0, _realDataService.getRealGridData)(1000, getColumns());
178
+ newData = await (0, _realDataService.getRealGridData)(1000, columns);
180
179
  newData = await extrapolateSeed(rowLength, newData);
181
180
  } else {
182
- newData = await (0, _realDataService.getRealGridData)(rowLength, getColumns());
181
+ newData = await (0, _realDataService.getRealGridData)(rowLength, columns);
183
182
  }
184
183
 
185
184
  if (!active) {
@@ -204,7 +203,7 @@ const useDemoData = options => {
204
203
  return () => {
205
204
  active = false;
206
205
  };
207
- }, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index, getColumns]);
206
+ }, [rowLength, options.dataSet, options.maxColumns, (_options$treeData5 = options.treeData) == null ? void 0 : _options$treeData5.maxDepth, (_options$treeData6 = options.treeData) == null ? void 0 : _options$treeData6.groupingField, (_options$treeData7 = options.treeData) == null ? void 0 : _options$treeData7.averageChildren, index, columns]);
208
207
  return {
209
208
  data,
210
209
  loading,
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.createFakeServer = void 0;
8
+ exports.loadServerRows = exports.createFakeServer = void 0;
9
9
 
10
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
11
 
@@ -179,6 +179,7 @@ const loadServerRows = (rows, queryOptions, serverOptions, columnsWithDefaultCol
179
179
  });
180
180
  };
181
181
 
182
+ exports.loadServerRows = loadServerRows;
182
183
  const DEFAULT_DATASET_OPTIONS = {
183
184
  dataSet: 'Commodity',
184
185
  rowLength: 100,
@@ -261,6 +262,7 @@ const createFakeServer = (dataSetOptions, serverOptions) => {
261
262
 
262
263
  return {
263
264
  columns,
265
+ columnsWithDefaultColDef,
264
266
  initialState,
265
267
  useQuery
266
268
  };
package/node/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.15.3
1
+ /** @license MUI v5.17.1
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-data-grid-generator",
3
- "version": "5.15.3",
3
+ "version": "5.17.1",
4
4
  "description": "Generate fake data for demo purposes only.",
5
5
  "author": "MUI Team",
6
6
  "main": "./node/index.js",
@@ -19,12 +19,12 @@
19
19
  "directory": "packages/grid/x-data-grid-generator"
20
20
  },
21
21
  "dependencies": {
22
- "@babel/runtime": "^7.18.6",
23
- "@mui/base": "^5.0.0-alpha.80",
24
- "@mui/x-data-grid-premium": "5.15.3",
22
+ "@babel/runtime": "^7.18.9",
23
+ "@mui/base": "^5.0.0-alpha.94",
24
+ "@mui/x-data-grid-premium": "5.17.1",
25
25
  "chance": "^1.1.8",
26
26
  "clsx": "^1.2.1",
27
- "lru-cache": "^7.13.2"
27
+ "lru-cache": "^7.14.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@mui/icons-material": "^5.4.1",