@mui/x-data-grid 7.0.0-alpha.5 → 7.0.0-alpha.7
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 +408 -6
- package/DataGrid/DataGrid.js +31 -21
- package/DataGrid/useDataGridProps.js +0 -1
- package/colDef/gridDateOperators.js +13 -6
- package/colDef/gridSingleSelectColDef.js +6 -15
- package/components/GridPagination.d.ts +2 -2
- package/components/cell/GridEditSingleSelectCell.d.ts +1 -2
- package/components/cell/GridEditSingleSelectCell.js +9 -29
- package/components/columnSelection/GridHeaderCheckbox.js +3 -1
- package/components/panel/filterPanel/GridFilterForm.js +44 -9
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +25 -8
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +2 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +7 -48
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +1 -2
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +15 -57
- package/components/panel/filterPanel/filterPanelUtils.d.ts +3 -2
- package/components/panel/filterPanel/filterPanelUtils.js +10 -5
- package/hooks/features/filter/gridFilterUtils.js +21 -24
- package/hooks/features/rowSelection/useGridRowSelection.js +9 -9
- package/hooks/features/rowSelection/utils.d.ts +2 -0
- package/hooks/features/rowSelection/utils.js +8 -0
- package/hooks/utils/useGridAriaAttributes.js +2 -1
- package/index.js +1 -1
- package/legacy/DataGrid/DataGrid.js +31 -21
- package/legacy/DataGrid/useDataGridProps.js +0 -1
- package/legacy/colDef/gridDateOperators.js +13 -13
- package/legacy/colDef/gridSingleSelectColDef.js +6 -15
- package/legacy/components/cell/GridEditSingleSelectCell.js +8 -28
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +3 -1
- package/legacy/components/panel/filterPanel/GridFilterForm.js +51 -19
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +27 -8
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -53
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +14 -59
- package/legacy/components/panel/filterPanel/filterPanelUtils.js +10 -6
- package/legacy/hooks/features/filter/gridFilterUtils.js +20 -17
- package/legacy/hooks/features/rowSelection/useGridRowSelection.js +9 -9
- package/legacy/hooks/features/rowSelection/utils.js +8 -0
- package/legacy/hooks/utils/useGridAriaAttributes.js +2 -1
- package/legacy/index.js +1 -1
- package/legacy/locales/csCZ.js +2 -2
- package/locales/csCZ.js +2 -2
- package/models/props/DataGridProps.d.ts +26 -26
- package/modern/DataGrid/DataGrid.js +31 -21
- package/modern/DataGrid/useDataGridProps.js +0 -1
- package/modern/colDef/gridDateOperators.js +13 -6
- package/modern/colDef/gridSingleSelectColDef.js +6 -15
- package/modern/components/cell/GridEditSingleSelectCell.js +9 -29
- package/modern/components/columnSelection/GridHeaderCheckbox.js +3 -1
- package/modern/components/panel/filterPanel/GridFilterForm.js +44 -9
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +24 -6
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +7 -47
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +15 -56
- package/modern/components/panel/filterPanel/filterPanelUtils.js +10 -5
- package/modern/hooks/features/filter/gridFilterUtils.js +21 -24
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +9 -9
- package/modern/hooks/features/rowSelection/utils.js +8 -0
- package/modern/hooks/utils/useGridAriaAttributes.js +2 -1
- package/modern/index.js +1 -1
- package/modern/locales/csCZ.js +2 -2
- package/node/DataGrid/DataGrid.js +31 -21
- package/node/DataGrid/useDataGridProps.js +0 -1
- package/node/colDef/gridDateOperators.js +13 -6
- package/node/colDef/gridSingleSelectColDef.js +5 -14
- package/node/components/cell/GridEditSingleSelectCell.js +8 -28
- package/node/components/columnSelection/GridHeaderCheckbox.js +3 -1
- package/node/components/panel/filterPanel/GridFilterForm.js +44 -9
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +24 -6
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +6 -46
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +14 -55
- package/node/components/panel/filterPanel/filterPanelUtils.js +12 -7
- package/node/hooks/features/filter/gridFilterUtils.js +21 -23
- package/node/hooks/features/rowSelection/useGridRowSelection.js +9 -9
- package/node/hooks/features/rowSelection/utils.js +14 -0
- package/node/hooks/utils/useGridAriaAttributes.js +2 -1
- package/node/index.js +1 -1
- package/node/locales/csCZ.js +2 -2
- package/package.json +4 -4
package/legacy/locales/csCZ.js
CHANGED
|
@@ -160,10 +160,10 @@ var csCZGrid = {
|
|
|
160
160
|
// Grouping columns
|
|
161
161
|
groupingColumnHeaderName: 'Skupina',
|
|
162
162
|
groupColumn: function groupColumn(name) {
|
|
163
|
-
return "
|
|
163
|
+
return "Seskupit podle ".concat(name);
|
|
164
164
|
},
|
|
165
165
|
unGroupColumn: function unGroupColumn(name) {
|
|
166
|
-
return "P\u0159estat
|
|
166
|
+
return "P\u0159estat seskupovat podle ".concat(name);
|
|
167
167
|
},
|
|
168
168
|
// Master/detail
|
|
169
169
|
detailPanelToggle: 'Přepnout detail panelu',
|
package/locales/csCZ.js
CHANGED
|
@@ -159,8 +159,8 @@ const csCZGrid = {
|
|
|
159
159
|
treeDataCollapse: 'skrýt potomky',
|
|
160
160
|
// Grouping columns
|
|
161
161
|
groupingColumnHeaderName: 'Skupina',
|
|
162
|
-
groupColumn: name => `
|
|
163
|
-
unGroupColumn: name => `Přestat
|
|
162
|
+
groupColumn: name => `Seskupit podle ${name}`,
|
|
163
|
+
unGroupColumn: name => `Přestat seskupovat podle ${name}`,
|
|
164
164
|
// Master/detail
|
|
165
165
|
detailPanelToggle: 'Přepnout detail panelu',
|
|
166
166
|
expandDetailPanel: 'Rozbalit',
|
|
@@ -56,7 +56,7 @@ export interface DataGridProcessedProps<R extends GridValidRowModel = any> exten
|
|
|
56
56
|
* The props of the `DataGrid` component after the pre-processing phase that the user should not be able to override.
|
|
57
57
|
* Those are usually used in feature-hook for which the pro-plan has more advanced features (eg: multi-sorting, multi-filtering, ...).
|
|
58
58
|
*/
|
|
59
|
-
export type DataGridForcedPropsKey = 'checkboxSelectionVisibleOnly' | 'disableMultipleColumnsFiltering' | 'disableMultipleColumnsSorting' | '
|
|
59
|
+
export type DataGridForcedPropsKey = 'checkboxSelectionVisibleOnly' | 'disableMultipleColumnsFiltering' | 'disableMultipleColumnsSorting' | 'disableColumnReorder' | 'disableColumnResize' | 'keepColumnPositionIfDraggedOutside' | 'throttleRowsMs' | 'hideFooterRowCount' | 'pagination' | 'signature';
|
|
60
60
|
/**
|
|
61
61
|
* The `DataGrid` options with a default value that must be merged with the value given through props.
|
|
62
62
|
*/
|
|
@@ -73,7 +73,7 @@ export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
|
|
|
73
73
|
*/
|
|
74
74
|
slots?: Partial<GridSlotsComponent>;
|
|
75
75
|
/**
|
|
76
|
-
* Set the locale text of the
|
|
76
|
+
* Set the locale text of the Data Grid.
|
|
77
77
|
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
|
|
78
78
|
*/
|
|
79
79
|
localeText?: Partial<GridLocaleText>;
|
|
@@ -86,7 +86,7 @@ export interface DataGridPropsWithComplexDefaultValueBeforeProcessing {
|
|
|
86
86
|
*/
|
|
87
87
|
export interface DataGridPropsWithDefaultValues {
|
|
88
88
|
/**
|
|
89
|
-
* If `true`, the
|
|
89
|
+
* If `true`, the Data Grid height is dynamic and follow the number of rows in the Data Grid.
|
|
90
90
|
* @default false
|
|
91
91
|
*/
|
|
92
92
|
autoHeight: boolean;
|
|
@@ -96,7 +96,7 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
96
96
|
*/
|
|
97
97
|
autoPageSize: boolean;
|
|
98
98
|
/**
|
|
99
|
-
* If `true`, the
|
|
99
|
+
* If `true`, the Data Grid will display an extra column with checkboxes for selecting rows.
|
|
100
100
|
* @default false
|
|
101
101
|
*/
|
|
102
102
|
checkboxSelection: boolean;
|
|
@@ -132,7 +132,7 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
132
132
|
*/
|
|
133
133
|
columnThreshold: number;
|
|
134
134
|
/**
|
|
135
|
-
* Set the density of the
|
|
135
|
+
* Set the density of the Data Grid.
|
|
136
136
|
* @default "standard"
|
|
137
137
|
*/
|
|
138
138
|
density: GridDensity;
|
|
@@ -159,7 +159,6 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
159
159
|
/**
|
|
160
160
|
* If `true`, `eval()` is not used for performance optimization.
|
|
161
161
|
* @default false
|
|
162
|
-
* @ignore - do not document
|
|
163
162
|
*/
|
|
164
163
|
disableEval: boolean;
|
|
165
164
|
/**
|
|
@@ -168,8 +167,9 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
168
167
|
*/
|
|
169
168
|
disableMultipleColumnsFiltering: boolean;
|
|
170
169
|
/**
|
|
171
|
-
* If `true`, multiple selection using the Ctrl or
|
|
172
|
-
*
|
|
170
|
+
* If `true`, multiple selection using the Ctrl/CMD or Shift key is disabled.
|
|
171
|
+
* The MIT DataGrid will ignore this prop, unless `checkboxSelection` is enabled.
|
|
172
|
+
* @default false (`!props.checkboxSelection` for MIT Data Grid)
|
|
173
173
|
*/
|
|
174
174
|
disableMultipleRowSelection: boolean;
|
|
175
175
|
/**
|
|
@@ -204,7 +204,7 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
204
204
|
*/
|
|
205
205
|
filterDebounceMs: number;
|
|
206
206
|
/**
|
|
207
|
-
* Sets the height in pixel of the column headers in the
|
|
207
|
+
* Sets the height in pixel of the column headers in the Data Grid.
|
|
208
208
|
* @default 56
|
|
209
209
|
*/
|
|
210
210
|
columnHeaderHeight: number;
|
|
@@ -265,7 +265,7 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
265
265
|
*/
|
|
266
266
|
paginationMode: GridFeatureMode;
|
|
267
267
|
/**
|
|
268
|
-
* Sets the height in pixel of a row in the
|
|
268
|
+
* Sets the height in pixel of a row in the Data Grid.
|
|
269
269
|
* @default 52
|
|
270
270
|
*/
|
|
271
271
|
rowHeight: number;
|
|
@@ -305,7 +305,7 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
305
305
|
*/
|
|
306
306
|
sortingMode: GridFeatureMode;
|
|
307
307
|
/**
|
|
308
|
-
* If positive, the Grid will throttle updates coming from `apiRef.current.updateRows` and `apiRef.current.setRows`.
|
|
308
|
+
* If positive, the Data Grid will throttle updates coming from `apiRef.current.updateRows` and `apiRef.current.setRows`.
|
|
309
309
|
* It can be useful if you have a high update rate but do not want to do heavy work like filtering / sorting or rendering on each individual update.
|
|
310
310
|
* @default 0
|
|
311
311
|
*/
|
|
@@ -321,13 +321,13 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
321
321
|
*/
|
|
322
322
|
disableColumnResize: boolean;
|
|
323
323
|
/**
|
|
324
|
-
* If `true`, moving the mouse pointer outside the
|
|
324
|
+
* If `true`, moving the mouse pointer outside the Data Grid before releasing the mouse button
|
|
325
325
|
* in a column re-order action will not cause the column to jump back to its original position.
|
|
326
326
|
* @default false
|
|
327
327
|
*/
|
|
328
328
|
keepColumnPositionIfDraggedOutside: boolean;
|
|
329
329
|
/**
|
|
330
|
-
* If `true`, the
|
|
330
|
+
* If `true`, the Data Grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
331
331
|
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
332
332
|
* @default false
|
|
333
333
|
*/
|
|
@@ -353,17 +353,17 @@ export interface DataGridPropsWithDefaultValues {
|
|
|
353
353
|
*/
|
|
354
354
|
export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel = any> extends CommonProps {
|
|
355
355
|
/**
|
|
356
|
-
* The ref object that allows
|
|
356
|
+
* The ref object that allows Data Grid manipulation. Can be instantiated with `useGridApiRef()`.
|
|
357
357
|
*/
|
|
358
358
|
apiRef?: React.MutableRefObject<GridApiCommunity>;
|
|
359
359
|
/**
|
|
360
|
-
* Forwarded props for the
|
|
360
|
+
* Forwarded props for the Data Grid root element.
|
|
361
361
|
* @ignore - do not document.
|
|
362
362
|
*/
|
|
363
363
|
forwardedProps?: Record<string, unknown>;
|
|
364
364
|
/**
|
|
365
365
|
* Signal to the underlying logic what version of the public component API
|
|
366
|
-
* of the
|
|
366
|
+
* of the Data Grid is exposed [[GridSignature]].
|
|
367
367
|
* @ignore - do not document.
|
|
368
368
|
*/
|
|
369
369
|
signature?: string;
|
|
@@ -377,7 +377,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
377
377
|
*/
|
|
378
378
|
rowCount?: number;
|
|
379
379
|
/**
|
|
380
|
-
* Override the height/width of the
|
|
380
|
+
* Override the height/width of the Data Grid inner scrollbar.
|
|
381
381
|
*/
|
|
382
382
|
scrollbarSize?: number;
|
|
383
383
|
/**
|
|
@@ -546,14 +546,14 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
546
546
|
*/
|
|
547
547
|
onRowDoubleClick?: GridEventListener<'rowDoubleClick'>;
|
|
548
548
|
/**
|
|
549
|
-
* Callback fired when the
|
|
549
|
+
* Callback fired when the Data Grid is resized.
|
|
550
550
|
* @param {ElementSize} containerSize With all properties from [[ElementSize]].
|
|
551
551
|
* @param {MuiEvent<{}>} event The event object.
|
|
552
552
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
553
553
|
*/
|
|
554
554
|
onResize?: GridEventListener<'debouncedResize'>;
|
|
555
555
|
/**
|
|
556
|
-
* Callback fired when the state of the
|
|
556
|
+
* Callback fired when the state of the Data Grid is updated.
|
|
557
557
|
* @param {GridState} state The new state.
|
|
558
558
|
* @param {MuiEvent<{}>} event The event object.
|
|
559
559
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
@@ -619,7 +619,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
619
619
|
*/
|
|
620
620
|
onRowModesModelChange?: (rowModesModel: GridRowModesModel, details: GridCallbackDetails) => void;
|
|
621
621
|
/**
|
|
622
|
-
* Set the filter model of the
|
|
622
|
+
* Set the filter model of the Data Grid.
|
|
623
623
|
*/
|
|
624
624
|
filterModel?: GridFilterModel;
|
|
625
625
|
/**
|
|
@@ -629,7 +629,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
629
629
|
*/
|
|
630
630
|
onFilterModelChange?: (model: GridFilterModel, details: GridCallbackDetails<'filter'>) => void;
|
|
631
631
|
/**
|
|
632
|
-
* Sets the row selection model of the
|
|
632
|
+
* Sets the row selection model of the Data Grid.
|
|
633
633
|
*/
|
|
634
634
|
rowSelectionModel?: GridInputRowSelectionModel;
|
|
635
635
|
/**
|
|
@@ -639,8 +639,8 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
639
639
|
*/
|
|
640
640
|
onRowSelectionModelChange?: (rowSelectionModel: GridRowSelectionModel, details: GridCallbackDetails) => void;
|
|
641
641
|
/**
|
|
642
|
-
* Set the column visibility model of the
|
|
643
|
-
* If defined, the
|
|
642
|
+
* Set the column visibility model of the Data Grid.
|
|
643
|
+
* If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
|
|
644
644
|
*/
|
|
645
645
|
columnVisibilityModel?: GridColumnVisibilityModel;
|
|
646
646
|
/**
|
|
@@ -650,7 +650,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
650
650
|
*/
|
|
651
651
|
onColumnVisibilityModelChange?: (model: GridColumnVisibilityModel, details: GridCallbackDetails) => void;
|
|
652
652
|
/**
|
|
653
|
-
* Set the sort model of the
|
|
653
|
+
* Set the sort model of the Data Grid.
|
|
654
654
|
*/
|
|
655
655
|
sortModel?: GridSortModel;
|
|
656
656
|
/**
|
|
@@ -660,11 +660,11 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
660
660
|
*/
|
|
661
661
|
onSortModelChange?: (model: GridSortModel, details: GridCallbackDetails) => void;
|
|
662
662
|
/**
|
|
663
|
-
* The label of the
|
|
663
|
+
* The label of the Data Grid.
|
|
664
664
|
*/
|
|
665
665
|
'aria-label'?: string;
|
|
666
666
|
/**
|
|
667
|
-
* The id of the element containing a label for the
|
|
667
|
+
* The id of the element containing a label for the Data Grid.
|
|
668
668
|
*/
|
|
669
669
|
'aria-labelledby'?: string;
|
|
670
670
|
/**
|
|
@@ -41,21 +41,21 @@ DataGridRaw.propTypes = {
|
|
|
41
41
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
42
42
|
// ----------------------------------------------------------------------
|
|
43
43
|
/**
|
|
44
|
-
* The ref object that allows
|
|
44
|
+
* The ref object that allows Data Grid manipulation. Can be instantiated with `useGridApiRef()`.
|
|
45
45
|
*/
|
|
46
46
|
apiRef: PropTypes.shape({
|
|
47
47
|
current: PropTypes.object.isRequired
|
|
48
48
|
}),
|
|
49
49
|
/**
|
|
50
|
-
* The label of the
|
|
50
|
+
* The label of the Data Grid.
|
|
51
51
|
*/
|
|
52
52
|
'aria-label': PropTypes.string,
|
|
53
53
|
/**
|
|
54
|
-
* The id of the element containing a label for the
|
|
54
|
+
* The id of the element containing a label for the Data Grid.
|
|
55
55
|
*/
|
|
56
56
|
'aria-labelledby': PropTypes.string,
|
|
57
57
|
/**
|
|
58
|
-
* If `true`, the
|
|
58
|
+
* If `true`, the Data Grid height is dynamic and follow the number of rows in the Data Grid.
|
|
59
59
|
* @default false
|
|
60
60
|
*/
|
|
61
61
|
autoHeight: PropTypes.bool,
|
|
@@ -63,13 +63,18 @@ DataGridRaw.propTypes = {
|
|
|
63
63
|
* If `true`, the pageSize is calculated according to the container size and the max number of rows to avoid rendering a vertical scroll bar.
|
|
64
64
|
* @default false
|
|
65
65
|
*/
|
|
66
|
-
autoPageSize: PropTypes.bool,
|
|
66
|
+
autoPageSize: chainPropTypes(PropTypes.bool, props => {
|
|
67
|
+
if (props.autoHeight && props.autoPageSize) {
|
|
68
|
+
return new Error(['MUI: `<DataGrid autoPageSize={true} autoHeight={true} />` are not valid props.', 'You can not use both the `autoPageSize` and `autoHeight` props at the same time because `autoHeight` scales the height of the Data Grid according to the `pageSize`.', '', 'Please remove one of these two props.'].join('\n'));
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}),
|
|
67
72
|
/**
|
|
68
73
|
* Controls the modes of the cells.
|
|
69
74
|
*/
|
|
70
75
|
cellModesModel: PropTypes.object,
|
|
71
76
|
/**
|
|
72
|
-
* If `true`, the
|
|
77
|
+
* If `true`, the Data Grid will display an extra column with checkboxes for selecting rows.
|
|
73
78
|
* @default false
|
|
74
79
|
*/
|
|
75
80
|
checkboxSelection: PropTypes.bool,
|
|
@@ -89,7 +94,7 @@ DataGridRaw.propTypes = {
|
|
|
89
94
|
columnBuffer: PropTypes.number,
|
|
90
95
|
columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
|
|
91
96
|
/**
|
|
92
|
-
* Sets the height in pixel of the column headers in the
|
|
97
|
+
* Sets the height in pixel of the column headers in the Data Grid.
|
|
93
98
|
* @default 56
|
|
94
99
|
*/
|
|
95
100
|
columnHeaderHeight: PropTypes.number,
|
|
@@ -109,12 +114,12 @@ DataGridRaw.propTypes = {
|
|
|
109
114
|
*/
|
|
110
115
|
columnThreshold: PropTypes.number,
|
|
111
116
|
/**
|
|
112
|
-
* Set the column visibility model of the
|
|
113
|
-
* If defined, the
|
|
117
|
+
* Set the column visibility model of the Data Grid.
|
|
118
|
+
* If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
|
|
114
119
|
*/
|
|
115
120
|
columnVisibilityModel: PropTypes.object,
|
|
116
121
|
/**
|
|
117
|
-
* Set the density of the
|
|
122
|
+
* Set the density of the Data Grid.
|
|
118
123
|
* @default "standard"
|
|
119
124
|
*/
|
|
120
125
|
density: PropTypes.oneOf(['comfortable', 'compact', 'standard']),
|
|
@@ -141,9 +146,14 @@ DataGridRaw.propTypes = {
|
|
|
141
146
|
/**
|
|
142
147
|
* If `true`, `eval()` is not used for performance optimization.
|
|
143
148
|
* @default false
|
|
144
|
-
* @ignore - do not document
|
|
145
149
|
*/
|
|
146
150
|
disableEval: PropTypes.bool,
|
|
151
|
+
/**
|
|
152
|
+
* If `true`, multiple selection using the Ctrl/CMD or Shift key is disabled.
|
|
153
|
+
* The MIT DataGrid will ignore this prop, unless `checkboxSelection` is enabled.
|
|
154
|
+
* @default false (`!props.checkboxSelection` for MIT Data Grid)
|
|
155
|
+
*/
|
|
156
|
+
disableMultipleRowSelection: PropTypes.bool,
|
|
147
157
|
/**
|
|
148
158
|
* If `true`, the selection on click on a row or cell is disabled.
|
|
149
159
|
* @default false
|
|
@@ -180,7 +190,7 @@ DataGridRaw.propTypes = {
|
|
|
180
190
|
*/
|
|
181
191
|
filterMode: PropTypes.oneOf(['client', 'server']),
|
|
182
192
|
/**
|
|
183
|
-
* Set the filter model of the
|
|
193
|
+
* Set the filter model of the Data Grid.
|
|
184
194
|
*/
|
|
185
195
|
filterModel: PropTypes.shape({
|
|
186
196
|
items: PropTypes.arrayOf(PropTypes.shape({
|
|
@@ -195,7 +205,7 @@ DataGridRaw.propTypes = {
|
|
|
195
205
|
quickFilterValues: PropTypes.array
|
|
196
206
|
}),
|
|
197
207
|
/**
|
|
198
|
-
* Forwarded props for the
|
|
208
|
+
* Forwarded props for the Data Grid root element.
|
|
199
209
|
* @ignore - do not document.
|
|
200
210
|
*/
|
|
201
211
|
forwardedProps: PropTypes.object,
|
|
@@ -263,7 +273,7 @@ DataGridRaw.propTypes = {
|
|
|
263
273
|
*/
|
|
264
274
|
ignoreDiacritics: PropTypes.bool,
|
|
265
275
|
/**
|
|
266
|
-
* If `true`, the
|
|
276
|
+
* If `true`, the Data Grid will not use `valueFormatter` when exporting to CSV or copying to clipboard.
|
|
267
277
|
* If an object is provided, you can choose to ignore the `valueFormatter` for CSV export or clipboard export.
|
|
268
278
|
* @default false
|
|
269
279
|
*/
|
|
@@ -301,7 +311,7 @@ DataGridRaw.propTypes = {
|
|
|
301
311
|
*/
|
|
302
312
|
loading: PropTypes.bool,
|
|
303
313
|
/**
|
|
304
|
-
* Set the locale text of the
|
|
314
|
+
* Set the locale text of the Data Grid.
|
|
305
315
|
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
|
|
306
316
|
*/
|
|
307
317
|
localeText: PropTypes.object,
|
|
@@ -469,7 +479,7 @@ DataGridRaw.propTypes = {
|
|
|
469
479
|
*/
|
|
470
480
|
onProcessRowUpdateError: PropTypes.func,
|
|
471
481
|
/**
|
|
472
|
-
* Callback fired when the
|
|
482
|
+
* Callback fired when the Data Grid is resized.
|
|
473
483
|
* @param {ElementSize} containerSize With all properties from [[ElementSize]].
|
|
474
484
|
* @param {MuiEvent<{}>} event The event object.
|
|
475
485
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
@@ -527,7 +537,7 @@ DataGridRaw.propTypes = {
|
|
|
527
537
|
*/
|
|
528
538
|
onSortModelChange: PropTypes.func,
|
|
529
539
|
/**
|
|
530
|
-
* Callback fired when the state of the
|
|
540
|
+
* Callback fired when the state of the Data Grid is updated.
|
|
531
541
|
* @param {GridState} state The new state.
|
|
532
542
|
* @param {MuiEvent<{}>} event The event object.
|
|
533
543
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
@@ -581,7 +591,7 @@ DataGridRaw.propTypes = {
|
|
|
581
591
|
*/
|
|
582
592
|
rowCount: PropTypes.number,
|
|
583
593
|
/**
|
|
584
|
-
* Sets the height in pixel of a row in the
|
|
594
|
+
* Sets the height in pixel of a row in the Data Grid.
|
|
585
595
|
* @default 52
|
|
586
596
|
*/
|
|
587
597
|
rowHeight: PropTypes.number,
|
|
@@ -606,7 +616,7 @@ DataGridRaw.propTypes = {
|
|
|
606
616
|
*/
|
|
607
617
|
rowSelection: PropTypes.bool,
|
|
608
618
|
/**
|
|
609
|
-
* Sets the row selection model of the
|
|
619
|
+
* Sets the row selection model of the Data Grid.
|
|
610
620
|
*/
|
|
611
621
|
rowSelectionModel: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired), PropTypes.number, PropTypes.string]),
|
|
612
622
|
/**
|
|
@@ -620,7 +630,7 @@ DataGridRaw.propTypes = {
|
|
|
620
630
|
*/
|
|
621
631
|
rowThreshold: PropTypes.number,
|
|
622
632
|
/**
|
|
623
|
-
* Override the height/width of the
|
|
633
|
+
* Override the height/width of the Data Grid inner scrollbar.
|
|
624
634
|
*/
|
|
625
635
|
scrollbarSize: PropTypes.number,
|
|
626
636
|
/**
|
|
@@ -654,7 +664,7 @@ DataGridRaw.propTypes = {
|
|
|
654
664
|
*/
|
|
655
665
|
sortingOrder: PropTypes.arrayOf(PropTypes.oneOf(['asc', 'desc'])),
|
|
656
666
|
/**
|
|
657
|
-
* Set the sort model of the
|
|
667
|
+
* Set the sort model of the Data Grid.
|
|
658
668
|
*/
|
|
659
669
|
sortModel: PropTypes.arrayOf(PropTypes.shape({
|
|
660
670
|
field: PropTypes.string.isRequired,
|
|
@@ -8,7 +8,6 @@ import { computeSlots, useProps } from '../internals/utils';
|
|
|
8
8
|
const DATA_GRID_FORCED_PROPS = {
|
|
9
9
|
disableMultipleColumnsFiltering: true,
|
|
10
10
|
disableMultipleColumnsSorting: true,
|
|
11
|
-
disableMultipleRowSelection: true,
|
|
12
11
|
throttleRowsMs: undefined,
|
|
13
12
|
hideFooterRowCount: false,
|
|
14
13
|
pagination: true,
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { GridFilterInputDate } from '../components/panel/filterPanel/GridFilterInputDate';
|
|
2
|
-
const dateRegex = /(\d+)-(\d+)-(\d+)/;
|
|
3
|
-
const dateTimeRegex = /(\d+)-(\d+)-(\d+)T(\d+):(\d+)/;
|
|
4
2
|
function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
5
3
|
if (!filterItem.value) {
|
|
6
4
|
return null;
|
|
7
5
|
}
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
const date = new Date(filterItem.value);
|
|
7
|
+
if (showTime) {
|
|
8
|
+
date.setSeconds(0, 0);
|
|
9
|
+
} else {
|
|
10
|
+
date.setHours(0, 0, 0, 0);
|
|
11
|
+
}
|
|
12
|
+
const time = date.getTime();
|
|
10
13
|
return value => {
|
|
11
14
|
if (!value) {
|
|
12
15
|
return false;
|
|
@@ -17,8 +20,12 @@ function buildApplyFilterFn(filterItem, compareFn, showTime, keepHours) {
|
|
|
17
20
|
|
|
18
21
|
// Make a copy of the date to not reset the hours in the original object
|
|
19
22
|
const dateCopy = new Date(value);
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
if (showTime) {
|
|
24
|
+
dateCopy.setSeconds(0, 0);
|
|
25
|
+
} else {
|
|
26
|
+
dateCopy.setHours(0, 0, 0, 0);
|
|
27
|
+
}
|
|
28
|
+
return compareFn(dateCopy.getTime(), time);
|
|
22
29
|
};
|
|
23
30
|
}
|
|
24
31
|
export const getGridDateOperators = showTime => [{
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { GRID_STRING_COL_DEF } from './gridStringColDef';
|
|
3
3
|
import { renderEditSingleSelectCell } from '../components/cell/GridEditSingleSelectCell';
|
|
4
4
|
import { getGridSingleSelectOperators } from './gridSingleSelectOperators';
|
|
5
|
-
import { isSingleSelectColDef } from '../components/panel/filterPanel/filterPanelUtils';
|
|
5
|
+
import { getValueOptions, isSingleSelectColDef } from '../components/panel/filterPanel/filterPanelUtils';
|
|
6
6
|
import { isObject } from '../utils/utils';
|
|
7
7
|
const isArrayOfObjects = options => {
|
|
8
8
|
return typeof options[0] === 'object';
|
|
@@ -28,16 +28,10 @@ export const GRID_SINGLE_SELECT_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
28
28
|
if (!isSingleSelectColDef(colDef)) {
|
|
29
29
|
return '';
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
row: id ? api.getRow(id) : null,
|
|
36
|
-
field
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
valueOptions = colDef.valueOptions;
|
|
40
|
-
}
|
|
31
|
+
const valueOptions = getValueOptions(colDef, {
|
|
32
|
+
id,
|
|
33
|
+
row: id ? api.getRow(id) : null
|
|
34
|
+
});
|
|
41
35
|
if (value == null) {
|
|
42
36
|
return '';
|
|
43
37
|
}
|
|
@@ -55,10 +49,7 @@ export const GRID_SINGLE_SELECT_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
55
49
|
// @ts-ignore
|
|
56
50
|
pastedValueParser: (value, params) => {
|
|
57
51
|
const colDef = params.colDef;
|
|
58
|
-
const
|
|
59
|
-
const valueOptions = typeof colDefValueOptions === 'function' ? colDefValueOptions({
|
|
60
|
-
field: colDef.field
|
|
61
|
-
}) : colDefValueOptions || [];
|
|
52
|
+
const valueOptions = getValueOptions(colDef) || [];
|
|
62
53
|
const getOptionValue = colDef.getOptionValue;
|
|
63
54
|
const valueOption = valueOptions.find(option => {
|
|
64
55
|
if (getOptionValue(option) === value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen"
|
|
3
|
+
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "className", "hasFocus", "isValidating", "isProcessingProps", "error", "onValueChange", "initialOpen"],
|
|
4
4
|
_excluded2 = ["MenuProps"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -9,7 +9,7 @@ import { GridCellEditStopReasons } from '../../models/params/gridEditCellParams'
|
|
|
9
9
|
import { isEscapeKey } from '../../utils/keyboardUtils';
|
|
10
10
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
11
11
|
import { GridEditModes } from '../../models/gridEditRowModel';
|
|
12
|
-
import { getValueFromValueOptions, isSingleSelectColDef } from '../panel/filterPanel/filterPanelUtils';
|
|
12
|
+
import { getValueFromValueOptions, getValueOptions, isSingleSelectColDef } from '../panel/filterPanel/filterPanelUtils';
|
|
13
13
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
14
|
import { createElement as _createElement } from "react";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -27,9 +27,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
27
27
|
hasFocus,
|
|
28
28
|
error,
|
|
29
29
|
onValueChange,
|
|
30
|
-
initialOpen = rootProps.editMode === GridEditModes.Cell
|
|
31
|
-
getOptionLabel: getOptionLabelProp,
|
|
32
|
-
getOptionValue: getOptionValueProp
|
|
30
|
+
initialOpen = rootProps.editMode === GridEditModes.Cell
|
|
33
31
|
} = props,
|
|
34
32
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
35
33
|
const apiRef = useGridApiContext();
|
|
@@ -51,21 +49,15 @@ function GridEditSingleSelectCell(props) {
|
|
|
51
49
|
if (!isSingleSelectColDef(colDef)) {
|
|
52
50
|
return null;
|
|
53
51
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
row,
|
|
59
|
-
field
|
|
60
|
-
});
|
|
61
|
-
} else {
|
|
62
|
-
valueOptions = colDef?.valueOptions;
|
|
63
|
-
}
|
|
52
|
+
const valueOptions = getValueOptions(colDef, {
|
|
53
|
+
id,
|
|
54
|
+
row
|
|
55
|
+
});
|
|
64
56
|
if (!valueOptions) {
|
|
65
57
|
return null;
|
|
66
58
|
}
|
|
67
|
-
const getOptionValue =
|
|
68
|
-
const getOptionLabel =
|
|
59
|
+
const getOptionValue = colDef.getOptionValue;
|
|
60
|
+
const getOptionLabel = colDef.getOptionLabel;
|
|
69
61
|
const handleChange = async event => {
|
|
70
62
|
if (!isSingleSelectColDef(colDef) || !valueOptions) {
|
|
71
63
|
return;
|
|
@@ -154,18 +146,6 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
154
146
|
* The cell value formatted with the column valueFormatter.
|
|
155
147
|
*/
|
|
156
148
|
formattedValue: PropTypes.any,
|
|
157
|
-
/**
|
|
158
|
-
* Used to determine the label displayed for a given value option.
|
|
159
|
-
* @param {ValueOptions} value The current value option.
|
|
160
|
-
* @returns {string} The text to be displayed.
|
|
161
|
-
*/
|
|
162
|
-
getOptionLabel: PropTypes.func,
|
|
163
|
-
/**
|
|
164
|
-
* Used to determine the value used for a value option.
|
|
165
|
-
* @param {ValueOptions} value The current value option.
|
|
166
|
-
* @returns {string} The value to be used.
|
|
167
|
-
*/
|
|
168
|
-
getOptionValue: PropTypes.func,
|
|
169
149
|
/**
|
|
170
150
|
* If true, the cell is the active element.
|
|
171
151
|
*/
|
|
@@ -4,6 +4,7 @@ const _excluded = ["field", "colDef"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
7
|
+
import { isMultipleRowSelectionEnabled } from '../../hooks/features/rowSelection/utils';
|
|
7
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
8
9
|
import { gridTabIndexColumnHeaderSelector } from '../../hooks/features/focus/gridFocusStateSelector';
|
|
9
10
|
import { gridRowSelectionStateSelector } from '../../hooks/features/rowSelection/gridRowSelectionSelector';
|
|
@@ -102,7 +103,8 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
|
|
|
102
103
|
'aria-label': label
|
|
103
104
|
},
|
|
104
105
|
tabIndex: tabIndex,
|
|
105
|
-
onKeyDown: handleKeyDown
|
|
106
|
+
onKeyDown: handleKeyDown,
|
|
107
|
+
disabled: !isMultipleRowSelectionEnabled(rootProps)
|
|
106
108
|
}, rootProps.slotProps?.baseCheckbox, other));
|
|
107
109
|
});
|
|
108
110
|
process.env.NODE_ENV !== "production" ? GridHeaderCheckbox.propTypes = {
|