@mui/x-data-grid 7.22.2 → 7.23.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 +169 -0
- package/DataGrid/DataGrid.js +9 -1
- package/README.md +3 -3
- package/components/GridDetailPanels.js +0 -1
- package/components/GridPinnedRows.js +0 -1
- package/components/GridRow.d.ts +2 -2
- package/components/GridRow.js +1 -1
- package/components/base/GridOverlays.js +5 -6
- package/components/cell/GridCell.d.ts +41 -3
- package/components/cell/GridCell.js +11 -19
- package/components/cell/GridEditInputCell.js +0 -67
- package/components/columnsManagement/GridColumnsManagement.d.ts +2 -0
- package/components/columnsManagement/GridColumnsManagement.js +53 -6
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/toolbar/GridToolbar.d.ts +2 -2
- package/components/toolbar/GridToolbar.js +12 -4
- package/components/toolbar/GridToolbarColumnsButton.js +3 -4
- package/components/toolbar/GridToolbarDensitySelector.js +3 -4
- package/components/toolbar/GridToolbarExport.d.ts +2 -2
- package/components/toolbar/GridToolbarExport.js +4 -3
- package/components/toolbar/GridToolbarExportContainer.js +3 -4
- package/components/toolbar/GridToolbarFilterButton.d.ts +2 -0
- package/components/toolbar/GridToolbarFilterButton.js +7 -6
- package/components/toolbar/GridToolbarQuickFilter.js +1 -0
- package/components/toolbar/index.d.ts +1 -1
- package/constants/dataGridPropsDefaultValues.js +2 -1
- package/constants/gridClasses.d.ts +4 -0
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +1 -0
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/hooks/features/export/useGridCsvExport.js +1 -1
- package/hooks/features/export/useGridPrintExport.js +1 -1
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/listView/gridListViewSelectors.d.ts +3 -1
- package/hooks/features/listView/gridListViewSelectors.js +3 -1
- package/hooks/features/listView/index.d.ts +1 -0
- package/hooks/features/listView/index.js +1 -0
- package/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/hooks/features/rowSelection/useGridRowSelection.js +0 -9
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.js +1 -5
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +59 -19
- package/hooks/utils/useGridSelector.d.ts +3 -2
- package/hooks/utils/useGridSelector.js +27 -2
- package/index.d.ts +0 -1
- package/index.js +1 -1
- package/joy/joySlots.js +7 -2
- package/locales/arSD.js +1 -0
- package/locales/beBY.js +1 -0
- package/locales/bgBG.js +2 -0
- package/locales/csCZ.js +2 -0
- package/locales/daDK.js +2 -0
- package/locales/deDE.js +2 -0
- package/locales/elGR.js +1 -0
- package/locales/esES.js +5 -4
- package/locales/faIR.js +2 -0
- package/locales/fiFI.js +2 -0
- package/locales/frFR.js +2 -0
- package/locales/heIL.js +2 -0
- package/locales/hrHR.js +2 -0
- package/locales/huHU.js +2 -0
- package/locales/isIS.js +1 -0
- package/locales/itIT.js +2 -0
- package/locales/jaJP.js +2 -0
- package/locales/koKR.js +1 -0
- package/locales/nbNO.js +2 -0
- package/locales/nlNL.js +2 -0
- package/locales/nnNO.js +2 -0
- package/locales/plPL.js +1 -0
- package/locales/ptBR.js +1 -0
- package/locales/ptPT.js +1 -0
- package/locales/roRO.js +1 -0
- package/locales/ruRU.js +2 -0
- package/locales/skSK.js +1 -0
- package/locales/svSE.js +6 -5
- package/locales/trTR.js +4 -2
- package/locales/ukUA.js +1 -0
- package/locales/urPK.js +1 -0
- package/locales/viVN.js +2 -0
- package/locales/zhCN.js +5 -4
- package/locales/zhHK.js +1 -0
- package/locales/zhTW.js +1 -0
- package/models/api/gridCoreApi.d.ts +1 -1
- package/models/api/gridLocaleTextApi.d.ts +1 -0
- package/models/colDef/gridColDef.d.ts +24 -24
- package/models/gridDataSource.d.ts +12 -12
- package/models/props/DataGridProps.d.ts +9 -1
- package/modern/DataGrid/DataGrid.js +9 -1
- package/modern/components/GridDetailPanels.js +0 -1
- package/modern/components/GridPinnedRows.js +0 -1
- package/modern/components/GridRow.js +1 -1
- package/modern/components/base/GridOverlays.js +5 -6
- package/modern/components/cell/GridCell.js +11 -19
- package/modern/components/cell/GridEditInputCell.js +0 -67
- package/modern/components/columnsManagement/GridColumnsManagement.js +53 -6
- package/modern/components/toolbar/GridToolbar.js +12 -4
- package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -4
- package/modern/components/toolbar/GridToolbarExport.js +4 -3
- package/modern/components/toolbar/GridToolbarExportContainer.js +3 -4
- package/modern/components/toolbar/GridToolbarFilterButton.js +7 -6
- package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -0
- package/modern/constants/dataGridPropsDefaultValues.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +1 -0
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/modern/hooks/features/export/useGridCsvExport.js +1 -1
- package/modern/hooks/features/export/useGridPrintExport.js +1 -1
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/listView/gridListViewSelectors.js +3 -1
- package/modern/hooks/features/listView/index.js +1 -0
- package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +0 -9
- package/modern/hooks/features/rows/gridRowsUtils.js +1 -5
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +59 -19
- package/modern/hooks/utils/useGridSelector.js +27 -2
- package/modern/index.js +1 -1
- package/modern/joy/joySlots.js +7 -2
- package/modern/locales/arSD.js +1 -0
- package/modern/locales/beBY.js +1 -0
- package/modern/locales/bgBG.js +2 -0
- package/modern/locales/csCZ.js +2 -0
- package/modern/locales/daDK.js +2 -0
- package/modern/locales/deDE.js +2 -0
- package/modern/locales/elGR.js +1 -0
- package/modern/locales/esES.js +5 -4
- package/modern/locales/faIR.js +2 -0
- package/modern/locales/fiFI.js +2 -0
- package/modern/locales/frFR.js +2 -0
- package/modern/locales/heIL.js +2 -0
- package/modern/locales/hrHR.js +2 -0
- package/modern/locales/huHU.js +2 -0
- package/modern/locales/isIS.js +1 -0
- package/modern/locales/itIT.js +2 -0
- package/modern/locales/jaJP.js +2 -0
- package/modern/locales/koKR.js +1 -0
- package/modern/locales/nbNO.js +2 -0
- package/modern/locales/nlNL.js +2 -0
- package/modern/locales/nnNO.js +2 -0
- package/modern/locales/plPL.js +1 -0
- package/modern/locales/ptBR.js +1 -0
- package/modern/locales/ptPT.js +1 -0
- package/modern/locales/roRO.js +1 -0
- package/modern/locales/ruRU.js +2 -0
- package/modern/locales/skSK.js +1 -0
- package/modern/locales/svSE.js +6 -5
- package/modern/locales/trTR.js +4 -2
- package/modern/locales/ukUA.js +1 -0
- package/modern/locales/urPK.js +1 -0
- package/modern/locales/viVN.js +2 -0
- package/modern/locales/zhCN.js +5 -4
- package/modern/locales/zhHK.js +1 -0
- package/modern/locales/zhTW.js +1 -0
- package/modern/utils/createSelector.js +11 -1
- package/modern/utils/utils.js +1 -3
- package/node/DataGrid/DataGrid.js +9 -1
- package/node/components/GridDetailPanels.js +0 -1
- package/node/components/GridPinnedRows.js +0 -1
- package/node/components/GridRow.js +1 -1
- package/node/components/base/GridOverlays.js +5 -6
- package/node/components/cell/GridCell.js +11 -19
- package/node/components/cell/GridEditInputCell.js +0 -67
- package/node/components/columnsManagement/GridColumnsManagement.js +53 -6
- package/node/components/toolbar/GridToolbar.js +12 -4
- package/node/components/toolbar/GridToolbarColumnsButton.js +3 -4
- package/node/components/toolbar/GridToolbarDensitySelector.js +3 -4
- package/node/components/toolbar/GridToolbarExport.js +4 -3
- package/node/components/toolbar/GridToolbarExportContainer.js +3 -4
- package/node/components/toolbar/GridToolbarFilterButton.js +7 -6
- package/node/components/toolbar/GridToolbarQuickFilter.js +1 -0
- package/node/constants/dataGridPropsDefaultValues.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +1 -0
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +2 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -1
- package/node/hooks/features/export/useGridCsvExport.js +2 -2
- package/node/hooks/features/export/useGridPrintExport.js +2 -2
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/listView/gridListViewSelectors.js +3 -1
- package/node/hooks/features/listView/index.js +16 -0
- package/node/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/node/hooks/features/rowSelection/useGridRowSelection.js +0 -9
- package/node/hooks/features/rows/gridRowsUtils.js +2 -8
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +59 -19
- package/node/hooks/utils/useGridSelector.js +29 -3
- package/node/index.js +1 -1
- package/node/joy/joySlots.js +7 -2
- package/node/locales/arSD.js +1 -0
- package/node/locales/beBY.js +1 -0
- package/node/locales/bgBG.js +2 -0
- package/node/locales/csCZ.js +2 -0
- package/node/locales/daDK.js +2 -0
- package/node/locales/deDE.js +2 -0
- package/node/locales/elGR.js +1 -0
- package/node/locales/esES.js +5 -4
- package/node/locales/faIR.js +2 -0
- package/node/locales/fiFI.js +2 -0
- package/node/locales/frFR.js +2 -0
- package/node/locales/heIL.js +2 -0
- package/node/locales/hrHR.js +2 -0
- package/node/locales/huHU.js +2 -0
- package/node/locales/isIS.js +1 -0
- package/node/locales/itIT.js +2 -0
- package/node/locales/jaJP.js +2 -0
- package/node/locales/koKR.js +1 -0
- package/node/locales/nbNO.js +2 -0
- package/node/locales/nlNL.js +2 -0
- package/node/locales/nnNO.js +2 -0
- package/node/locales/plPL.js +1 -0
- package/node/locales/ptBR.js +1 -0
- package/node/locales/ptPT.js +1 -0
- package/node/locales/roRO.js +1 -0
- package/node/locales/ruRU.js +2 -0
- package/node/locales/skSK.js +1 -0
- package/node/locales/svSE.js +6 -5
- package/node/locales/trTR.js +4 -2
- package/node/locales/ukUA.js +1 -0
- package/node/locales/urPK.js +1 -0
- package/node/locales/viVN.js +2 -0
- package/node/locales/zhCN.js +5 -4
- package/node/locales/zhHK.js +1 -0
- package/node/locales/zhTW.js +1 -0
- package/node/utils/createSelector.js +11 -1
- package/node/utils/utils.js +1 -3
- package/package.json +4 -4
- package/utils/createSelector.d.ts +1 -1
- package/utils/createSelector.js +11 -1
- package/utils/utils.js +1 -3
package/locales/zhCN.js
CHANGED
|
@@ -34,6 +34,7 @@ const zhCNGrid = {
|
|
|
34
34
|
columnsManagementNoColumns: '没有列',
|
|
35
35
|
columnsManagementShowHideAllText: '显示/隐藏所有',
|
|
36
36
|
columnsManagementReset: '重置',
|
|
37
|
+
columnsManagementDeleteIconLabel: '清除',
|
|
37
38
|
// Filter panel text
|
|
38
39
|
filterPanelAddFilter: '添加筛选器',
|
|
39
40
|
filterPanelRemoveAll: '清除全部',
|
|
@@ -47,9 +48,9 @@ const zhCNGrid = {
|
|
|
47
48
|
filterPanelInputPlaceholder: '筛选值',
|
|
48
49
|
// Filter operators text
|
|
49
50
|
filterOperatorContains: '包含',
|
|
50
|
-
|
|
51
|
+
filterOperatorDoesNotContain: '不包含',
|
|
51
52
|
filterOperatorEquals: '等于',
|
|
52
|
-
|
|
53
|
+
filterOperatorDoesNotEqual: '不等于',
|
|
53
54
|
filterOperatorStartsWith: '开始于',
|
|
54
55
|
filterOperatorEndsWith: '结束于',
|
|
55
56
|
filterOperatorIs: '是',
|
|
@@ -69,9 +70,9 @@ const zhCNGrid = {
|
|
|
69
70
|
'filterOperator<=': '<=',
|
|
70
71
|
// Header filter operators text
|
|
71
72
|
headerFilterOperatorContains: '包含',
|
|
72
|
-
|
|
73
|
+
headerFilterOperatorDoesNotContain: '不包含',
|
|
73
74
|
headerFilterOperatorEquals: '等于',
|
|
74
|
-
|
|
75
|
+
headerFilterOperatorDoesNotEqual: '不等于',
|
|
75
76
|
headerFilterOperatorStartsWith: '开始于',
|
|
76
77
|
headerFilterOperatorEndsWith: '结束于',
|
|
77
78
|
headerFilterOperatorIs: '是',
|
package/locales/zhHK.js
CHANGED
|
@@ -34,6 +34,7 @@ const zhHKGrid = {
|
|
|
34
34
|
// columnsManagementNoColumns: 'No columns',
|
|
35
35
|
// columnsManagementShowHideAllText: 'Show/Hide All',
|
|
36
36
|
// columnsManagementReset: 'Reset',
|
|
37
|
+
// columnsManagementDeleteIconLabel: 'Clear',
|
|
37
38
|
|
|
38
39
|
// Filter panel text
|
|
39
40
|
filterPanelAddFilter: '新增過濾器',
|
package/locales/zhTW.js
CHANGED
|
@@ -34,6 +34,7 @@ const zhTWGrid = {
|
|
|
34
34
|
// columnsManagementNoColumns: 'No columns',
|
|
35
35
|
// columnsManagementShowHideAllText: 'Show/Hide All',
|
|
36
36
|
// columnsManagementReset: 'Reset',
|
|
37
|
+
// columnsManagementDeleteIconLabel: 'Clear',
|
|
37
38
|
|
|
38
39
|
// Filter panel text
|
|
39
40
|
filterPanelAddFilter: '增加篩選器',
|
|
@@ -59,7 +59,7 @@ export interface GridCorePrivateApi<GridPublicApi extends GridApiCommon, GridPri
|
|
|
59
59
|
/**
|
|
60
60
|
* The React ref of the grid main container div element.
|
|
61
61
|
*/
|
|
62
|
-
mainElementRef: React.
|
|
62
|
+
mainElementRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
63
63
|
/**
|
|
64
64
|
* The React ref of the grid's virtual scroller container element.
|
|
65
65
|
*/
|
|
@@ -35,6 +35,7 @@ export interface GridLocaleText {
|
|
|
35
35
|
columnsManagementNoColumns: string;
|
|
36
36
|
columnsManagementShowHideAllText: string;
|
|
37
37
|
columnsManagementReset: string;
|
|
38
|
+
columnsManagementDeleteIconLabel: string;
|
|
38
39
|
filterPanelAddFilter: React.ReactNode;
|
|
39
40
|
filterPanelRemoveAll: React.ReactNode;
|
|
40
41
|
filterPanelDeleteIconLabel: string;
|
|
@@ -36,43 +36,43 @@ export type GridColSpanFn<R extends GridValidRowModel = GridValidRowModel, V = a
|
|
|
36
36
|
*/
|
|
37
37
|
export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel, V = any, F = V> {
|
|
38
38
|
/**
|
|
39
|
-
* The
|
|
39
|
+
* The unique identifier of the column. Used to map with [[GridRowModel]] values.
|
|
40
40
|
*/
|
|
41
41
|
field: string;
|
|
42
42
|
/**
|
|
43
|
-
* The title
|
|
43
|
+
* The title displayed in the column header cell.
|
|
44
44
|
*/
|
|
45
45
|
headerName?: string;
|
|
46
46
|
/**
|
|
47
|
-
* The
|
|
47
|
+
* The tooltip text shown when the column header name is truncated.
|
|
48
48
|
*/
|
|
49
49
|
description?: string;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* The width of the column in pixels.
|
|
52
52
|
* @default 100
|
|
53
53
|
*/
|
|
54
54
|
width?: number;
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* The flex grow factor of the column. Must be a positive number.
|
|
57
57
|
*/
|
|
58
58
|
flex?: number;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* The minimum width of the column in pixels.
|
|
61
61
|
* @default 50
|
|
62
62
|
*/
|
|
63
63
|
minWidth?: number;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* The maximum width of the column in pixels.
|
|
66
66
|
* @default Infinity
|
|
67
67
|
*/
|
|
68
68
|
maxWidth?: number;
|
|
69
69
|
/**
|
|
70
|
-
* If `false`, removes the
|
|
70
|
+
* If `false`, removes the option to hide this column.
|
|
71
71
|
* @default true
|
|
72
72
|
*/
|
|
73
73
|
hideable?: boolean;
|
|
74
74
|
/**
|
|
75
|
-
* If `
|
|
75
|
+
* If `false`, disables sorting for this column.
|
|
76
76
|
* @default true
|
|
77
77
|
*/
|
|
78
78
|
sortable?: boolean;
|
|
@@ -81,7 +81,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
|
|
|
81
81
|
*/
|
|
82
82
|
sortingOrder?: readonly GridSortDirection[];
|
|
83
83
|
/**
|
|
84
|
-
* If `
|
|
84
|
+
* If `false`, disables resizing for this column.
|
|
85
85
|
* @default true
|
|
86
86
|
*/
|
|
87
87
|
resizable?: boolean;
|
|
@@ -109,7 +109,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
|
|
|
109
109
|
*/
|
|
110
110
|
sortComparator?: GridComparatorFn<V>;
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* Provide an alternative comparator function for sorting.
|
|
113
113
|
* Takes precedence over `sortComparator`.
|
|
114
114
|
* @param {GridSortDirection} sortDirection The direction of the sort.
|
|
115
115
|
* @returns {GridComparatorFn<V>} The comparator function to use.
|
|
@@ -122,25 +122,25 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
|
|
|
122
122
|
*/
|
|
123
123
|
type?: GridColType;
|
|
124
124
|
/**
|
|
125
|
-
*
|
|
125
|
+
* Align cell content.
|
|
126
126
|
*/
|
|
127
127
|
align?: GridAlignment;
|
|
128
128
|
/**
|
|
129
|
-
* Function that
|
|
129
|
+
* Function that returns specific data to render in the cell instead of using the field value.
|
|
130
130
|
*/
|
|
131
131
|
valueGetter?: GridValueGetter<R, V, F>;
|
|
132
132
|
/**
|
|
133
|
-
* Function that
|
|
133
|
+
* Function that returns a specific value to be used in row spanning.
|
|
134
134
|
*/
|
|
135
135
|
rowSpanValueGetter?: GridValueGetter<R, V, F>;
|
|
136
136
|
/**
|
|
137
|
-
* Function that
|
|
138
|
-
*
|
|
137
|
+
* Function that customizes how the entered value is stored in the row.
|
|
138
|
+
* Only works with cell/row editing.
|
|
139
139
|
* @returns {R} The row with the updated field.
|
|
140
140
|
*/
|
|
141
141
|
valueSetter?: GridValueSetter<R, V, F>;
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* Formats the cell value before rendering.
|
|
144
144
|
*/
|
|
145
145
|
valueFormatter?: GridValueFormatter<R, V, F>;
|
|
146
146
|
/**
|
|
@@ -149,7 +149,7 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
|
|
|
149
149
|
*/
|
|
150
150
|
valueParser?: GridValueParser<R, V, F>;
|
|
151
151
|
/**
|
|
152
|
-
* Class name
|
|
152
|
+
* Class name added to cells in this column.
|
|
153
153
|
*/
|
|
154
154
|
cellClassName?: GridCellClassNamePropType<R, V>;
|
|
155
155
|
/**
|
|
@@ -159,38 +159,38 @@ export interface GridBaseColDef<R extends GridValidRowModel = GridValidRowModel,
|
|
|
159
159
|
*/
|
|
160
160
|
display?: 'text' | 'flex';
|
|
161
161
|
/**
|
|
162
|
-
*
|
|
162
|
+
* Override the component rendered as cell for this column.
|
|
163
163
|
* @template R, V, F
|
|
164
164
|
* @param {GridRenderCellParams<R, V, F>} params Object containing parameters for the renderer.
|
|
165
165
|
* @returns {React.ReactNode} The element to be rendered.
|
|
166
166
|
*/
|
|
167
167
|
renderCell?: (params: GridRenderCellParams<R, V, F>) => React.ReactNode;
|
|
168
168
|
/**
|
|
169
|
-
*
|
|
169
|
+
* Override the component rendered in edit cell mode for this column.
|
|
170
170
|
* @param {GridRenderEditCellParams} params Object containing parameters for the renderer.
|
|
171
171
|
* @returns {React.ReactNode} The element to be rendered.
|
|
172
172
|
*/
|
|
173
173
|
renderEditCell?: (params: GridRenderEditCellParams<R, V, F>) => React.ReactNode;
|
|
174
174
|
/**
|
|
175
175
|
* Callback fired when the edit props of the cell changes.
|
|
176
|
-
*
|
|
176
|
+
* Processes the props before being saved into the state.
|
|
177
177
|
* @param {GridPreProcessEditCellProps} params Object containing parameters of the cell being edited.
|
|
178
178
|
* @returns {GridEditCellProps | Promise<GridEditCellProps>} The new edit cell props.
|
|
179
179
|
*/
|
|
180
180
|
preProcessEditCellProps?: (params: GridPreProcessEditCellProps) => GridEditCellProps | Promise<GridEditCellProps>;
|
|
181
181
|
/**
|
|
182
|
-
* Class name
|
|
182
|
+
* Class name added to the column header cell.
|
|
183
183
|
*/
|
|
184
184
|
headerClassName?: GridColumnHeaderClassNamePropType;
|
|
185
185
|
/**
|
|
186
|
-
*
|
|
186
|
+
* Override the component rendered in the column header cell.
|
|
187
187
|
* @template R, V, F
|
|
188
188
|
* @param {GridColumnHeaderParams<R, V, F>} params Object containing parameters for the renderer.
|
|
189
189
|
* @returns {React.ReactNode} The element to be rendered.
|
|
190
190
|
*/
|
|
191
191
|
renderHeader?: (params: GridColumnHeaderParams<R, V, F>) => React.ReactNode;
|
|
192
192
|
/**
|
|
193
|
-
*
|
|
193
|
+
* Align column header content.
|
|
194
194
|
*/
|
|
195
195
|
headerAlign?: GridAlignment;
|
|
196
196
|
/**
|
|
@@ -34,7 +34,7 @@ export interface GridGetRowsResponse {
|
|
|
34
34
|
rowCount?: number;
|
|
35
35
|
/**
|
|
36
36
|
* Additional `pageInfo` for advanced use-cases.
|
|
37
|
-
* `hasNextPage`: When row count is unknown/estimated, `hasNextPage` will be used to check if more records are available on server
|
|
37
|
+
* `hasNextPage`: When row count is unknown/estimated, `hasNextPage` will be used to check if more records are available on server.
|
|
38
38
|
*/
|
|
39
39
|
pageInfo?: {
|
|
40
40
|
hasNextPage?: boolean;
|
|
@@ -44,25 +44,25 @@ export interface GridGetRowsResponse {
|
|
|
44
44
|
export interface GridDataSource {
|
|
45
45
|
/**
|
|
46
46
|
* This method will be called when the grid needs to fetch some rows.
|
|
47
|
-
* @param {GridGetRowsParams} params The parameters required to fetch the rows
|
|
48
|
-
* @returns {Promise<GridGetRowsResponse>} A promise that resolves to the data of type [GridGetRowsResponse]
|
|
47
|
+
* @param {GridGetRowsParams} params The parameters required to fetch the rows.
|
|
48
|
+
* @returns {Promise<GridGetRowsResponse>} A promise that resolves to the data of type [GridGetRowsResponse].
|
|
49
49
|
*/
|
|
50
50
|
getRows(params: GridGetRowsParams): Promise<GridGetRowsResponse>;
|
|
51
51
|
/**
|
|
52
52
|
* This method will be called when the user updates a row [Not yet implemented].
|
|
53
|
-
* @param {GridRowModel} updatedRow The updated row
|
|
54
|
-
* @returns {Promise<any>} If resolved (synced on the backend), the grid will update the row and mutate the cache
|
|
53
|
+
* @param {GridRowModel} updatedRow The updated row.
|
|
54
|
+
* @returns {Promise<any>} If resolved (synced on the backend), the grid will update the row and mutate the cache.
|
|
55
55
|
*/
|
|
56
56
|
updateRow?(updatedRow: GridRowModel): Promise<any>;
|
|
57
57
|
/**
|
|
58
58
|
* Used to group rows by their parent group. Replaces `getTreeDataPath` used in client side tree-data.
|
|
59
|
-
* @param {GridRowModel} row The row to get the group key of
|
|
60
|
-
* @returns {string} The group key for the row
|
|
59
|
+
* @param {GridRowModel} row The row to get the group key of.
|
|
60
|
+
* @returns {string} The group key for the row.
|
|
61
61
|
*/
|
|
62
62
|
getGroupKey?: (row: GridRowModel) => string;
|
|
63
63
|
/**
|
|
64
64
|
* Used to determine the number of children a row has on server.
|
|
65
|
-
* @param {GridRowModel} row The row to check the number of children
|
|
65
|
+
* @param {GridRowModel} row The row to check the number of children.
|
|
66
66
|
* @returns {number} The number of children the row has.
|
|
67
67
|
* If the children count is not available for some reason, but there are some children, `getChildrenCount` should return `-1`.
|
|
68
68
|
*/
|
|
@@ -71,14 +71,14 @@ export interface GridDataSource {
|
|
|
71
71
|
export interface GridDataSourceCache {
|
|
72
72
|
/**
|
|
73
73
|
* Set the cache entry for the given key.
|
|
74
|
-
* @param {GridGetRowsParams} key The key of type `GridGetRowsParams
|
|
75
|
-
* @param {GridGetRowsResponse} value The value to be stored in the cache
|
|
74
|
+
* @param {GridGetRowsParams} key The key of type `GridGetRowsParams`.
|
|
75
|
+
* @param {GridGetRowsResponse} value The value to be stored in the cache.
|
|
76
76
|
*/
|
|
77
77
|
set: (key: GridGetRowsParams, value: GridGetRowsResponse) => void;
|
|
78
78
|
/**
|
|
79
79
|
* Get the cache entry for the given key.
|
|
80
|
-
* @param {GridGetRowsParams} key The key of type `GridGetRowsParams
|
|
81
|
-
* @returns {GridGetRowsResponse} The value stored in the cache
|
|
80
|
+
* @param {GridGetRowsParams} key The key of type `GridGetRowsParams`.
|
|
81
|
+
* @returns {GridGetRowsResponse} The value stored in the cache.
|
|
82
82
|
*/
|
|
83
83
|
get: (key: GridGetRowsParams) => GridGetRowsResponse | undefined;
|
|
84
84
|
/**
|
|
@@ -369,6 +369,14 @@ export interface DataGridPropsWithDefaultValues<R extends GridValidRowModel = an
|
|
|
369
369
|
* @default false
|
|
370
370
|
*/
|
|
371
371
|
unstable_rowSpanning: boolean;
|
|
372
|
+
/**
|
|
373
|
+
* If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
|
|
374
|
+
* By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
|
|
375
|
+
* For datasets with a large number of columns, this can cause performance issues.
|
|
376
|
+
* The downside of enabling this prop is that the row height will be estimated based the cells that are currently rendered, which can cause row height change when scrolling horizontally.
|
|
377
|
+
* @default false
|
|
378
|
+
*/
|
|
379
|
+
virtualizeColumnsWithAutoRowHeight: boolean;
|
|
372
380
|
}
|
|
373
381
|
/**
|
|
374
382
|
* The Data Grid props with no default value.
|
|
@@ -613,7 +621,7 @@ export interface DataGridPropsWithoutDefaultValue<R extends GridValidRowModel =
|
|
|
613
621
|
* @param {GridPaginationModel} model Updated pagination model.
|
|
614
622
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
615
623
|
*/
|
|
616
|
-
onPaginationModelChange?: (model: GridPaginationModel, details: GridCallbackDetails) => void;
|
|
624
|
+
onPaginationModelChange?: (model: GridPaginationModel, details: GridCallbackDetails<'pagination'>) => void;
|
|
617
625
|
/**
|
|
618
626
|
* Callback fired when the row count has changed.
|
|
619
627
|
* @param {number} count Updated row count.
|
|
@@ -766,5 +766,13 @@ DataGridRaw.propTypes = {
|
|
|
766
766
|
* If `true`, the Data Grid will auto span the cells over the rows having the same value.
|
|
767
767
|
* @default false
|
|
768
768
|
*/
|
|
769
|
-
unstable_rowSpanning: PropTypes.bool
|
|
769
|
+
unstable_rowSpanning: PropTypes.bool,
|
|
770
|
+
/**
|
|
771
|
+
* If `true`, the Data Grid enables column virtualization when `getRowHeight` is set to `() => 'auto'`.
|
|
772
|
+
* By default, column virtualization is disabled when dynamic row height is enabled to measure the row height correctly.
|
|
773
|
+
* For datasets with a large number of columns, this can cause performance issues.
|
|
774
|
+
* The downside of enabling this prop is that the row height will be estimated based the cells that are currently rendered, which can cause row height change when scrolling horizontally.
|
|
775
|
+
* @default false
|
|
776
|
+
*/
|
|
777
|
+
virtualizeColumnsWithAutoRowHeight: PropTypes.bool
|
|
770
778
|
};
|
|
@@ -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 = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "
|
|
3
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "pinnedColumns", "offsetTop", "offsetLeft", "dimensions", "renderContext", "focusedColumnIndex", "isFirstVisible", "isLastVisible", "isNotVisible", "showBottomBorder", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -4,12 +4,11 @@ import PropTypes from 'prop-types';
|
|
|
4
4
|
import { styled } from '@mui/system';
|
|
5
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
+
import { minimalContentHeight } from "../../hooks/features/rows/gridRowsUtils.js";
|
|
7
8
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
8
9
|
import { gridDimensionsSelector } from "../../hooks/features/dimensions/index.js";
|
|
9
10
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
10
11
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
11
|
-
import { useGridVisibleRows } from "../../hooks/utils/useGridVisibleRows.js";
|
|
12
|
-
import { getMinimalContentHeight } from "../../hooks/features/rows/gridRowsUtils.js";
|
|
13
12
|
import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
const GridOverlayWrapperRoot = styled('div', {
|
|
@@ -26,6 +25,7 @@ loadingOverlayVariant !== 'skeleton' ? {
|
|
|
26
25
|
position: 'sticky',
|
|
27
26
|
// To stay in place while scrolling
|
|
28
27
|
top: 'var(--DataGrid-headersTotalHeight)',
|
|
28
|
+
// TODO: take pinned rows into account
|
|
29
29
|
left: 0,
|
|
30
30
|
width: 0,
|
|
31
31
|
// To stay above the content instead of shifting it down
|
|
@@ -53,11 +53,10 @@ const useUtilityClasses = ownerState => {
|
|
|
53
53
|
function GridOverlayWrapper(props) {
|
|
54
54
|
const apiRef = useGridApiContext();
|
|
55
55
|
const rootProps = useGridRootProps();
|
|
56
|
-
const currentPage = useGridVisibleRows(apiRef, rootProps);
|
|
57
56
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
58
|
-
let height = dimensions.viewportOuterSize.height - dimensions.topContainerHeight - dimensions.bottomContainerHeight - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0);
|
|
59
|
-
if (
|
|
60
|
-
height =
|
|
57
|
+
let height = Math.max(dimensions.viewportOuterSize.height - dimensions.topContainerHeight - dimensions.bottomContainerHeight - (dimensions.hasScrollX ? dimensions.scrollbarSize : 0), 0);
|
|
58
|
+
if (height === 0) {
|
|
59
|
+
height = minimalContentHeight;
|
|
61
60
|
}
|
|
62
61
|
const classes = useUtilityClasses(_extends({}, props, {
|
|
63
62
|
classes: rootProps.classes
|
|
@@ -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 = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "
|
|
3
|
+
const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "sectionIndex", "sectionLength", "gridHasFiller", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
4
4
|
_excluded2 = ["changeReason", "unstable_updateValueOnRender"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -15,7 +15,6 @@ import { useGridSelector, objectShallowCompare } from "../../hooks/utils/useGrid
|
|
|
15
15
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
16
16
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
17
17
|
import { gridFocusCellSelector } from "../../hooks/features/focus/gridFocusStateSelector.js";
|
|
18
|
-
import { MissingRowIdError } from "../../hooks/features/rows/useGridParamsApi.js";
|
|
19
18
|
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from "../../utils/cellBorderUtils.js";
|
|
20
19
|
import { GridPinnedColumnPosition } from "../../hooks/features/columns/gridColumnsInterfaces.js";
|
|
21
20
|
import { gridRowSpanningHiddenCellsSelector, gridRowSpanningSpannedCellsSelector } from "../../hooks/features/rows/gridRowSpanningSelectors.js";
|
|
@@ -114,16 +113,13 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
114
113
|
// This is required because `.getCellParams` tries to get the `state.rows.tree` entry
|
|
115
114
|
// associated with `rowId`/`fieldId`, but this selector runs after the state has been
|
|
116
115
|
// updated, while `rowId`/`fieldId` reference an entry in the old state.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return result;
|
|
121
|
-
} catch (error) {
|
|
122
|
-
if (error instanceof MissingRowIdError) {
|
|
123
|
-
return EMPTY_CELL_PARAMS;
|
|
124
|
-
}
|
|
125
|
-
throw error;
|
|
116
|
+
const row = apiRef.current.getRow(rowId);
|
|
117
|
+
if (!row) {
|
|
118
|
+
return EMPTY_CELL_PARAMS;
|
|
126
119
|
}
|
|
120
|
+
const result = apiRef.current.getCellParams(rowId, field);
|
|
121
|
+
result.api = apiRef.current;
|
|
122
|
+
return result;
|
|
127
123
|
}, objectShallowCompare);
|
|
128
124
|
const isSelected = useGridSelector(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
|
|
129
125
|
id: rowId,
|
|
@@ -211,6 +207,7 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
211
207
|
padding: 0,
|
|
212
208
|
opacity: 0,
|
|
213
209
|
width: 0,
|
|
210
|
+
height: 0,
|
|
214
211
|
border: 0
|
|
215
212
|
};
|
|
216
213
|
}
|
|
@@ -229,6 +226,9 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
229
226
|
if (rowSpan > 1) {
|
|
230
227
|
cellStyle.height = `calc(var(--height) * ${rowSpan})`;
|
|
231
228
|
cellStyle.zIndex = 5;
|
|
229
|
+
if (isLeftPinned || isRightPinned) {
|
|
230
|
+
cellStyle.zIndex = 6;
|
|
231
|
+
}
|
|
232
232
|
}
|
|
233
233
|
return cellStyle;
|
|
234
234
|
}, [width, isNotVisible, styleProp, pinnedOffset, pinnedPosition, isRtl, rowSpan]);
|
|
@@ -342,7 +342,6 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
342
342
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
343
343
|
// ----------------------------------------------------------------------
|
|
344
344
|
align: PropTypes.oneOf(['center', 'left', 'right']).isRequired,
|
|
345
|
-
className: PropTypes.string,
|
|
346
345
|
colIndex: PropTypes.number.isRequired,
|
|
347
346
|
colSpan: PropTypes.number,
|
|
348
347
|
column: PropTypes.object.isRequired,
|
|
@@ -355,13 +354,6 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
355
354
|
}),
|
|
356
355
|
gridHasFiller: PropTypes.bool.isRequired,
|
|
357
356
|
isNotVisible: PropTypes.bool.isRequired,
|
|
358
|
-
onClick: PropTypes.func,
|
|
359
|
-
onDoubleClick: PropTypes.func,
|
|
360
|
-
onDragEnter: PropTypes.func,
|
|
361
|
-
onDragOver: PropTypes.func,
|
|
362
|
-
onKeyDown: PropTypes.func,
|
|
363
|
-
onMouseDown: PropTypes.func,
|
|
364
|
-
onMouseUp: PropTypes.func,
|
|
365
357
|
pinnedOffset: PropTypes.number.isRequired,
|
|
366
358
|
pinnedPosition: PropTypes.oneOf([0, 1, 2, 3]).isRequired,
|
|
367
359
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
@@ -2,7 +2,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "hasFocus", "isValidating", "debounceMs", "isProcessingProps", "onValueChange"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import { unstable_composeClasses as composeClasses, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
7
6
|
import { styled } from '@mui/material/styles';
|
|
8
7
|
import InputBase from '@mui/material/InputBase';
|
|
@@ -94,71 +93,5 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
94
93
|
}) : undefined
|
|
95
94
|
}, other));
|
|
96
95
|
});
|
|
97
|
-
process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
98
|
-
// ----------------------------- Warning --------------------------------
|
|
99
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
100
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
101
|
-
// ----------------------------------------------------------------------
|
|
102
|
-
/**
|
|
103
|
-
* GridApi that let you manipulate the grid.
|
|
104
|
-
*/
|
|
105
|
-
api: PropTypes.object.isRequired,
|
|
106
|
-
/**
|
|
107
|
-
* The mode of the cell.
|
|
108
|
-
*/
|
|
109
|
-
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
|
|
110
|
-
changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
111
|
-
/**
|
|
112
|
-
* The column of the row that the current cell belongs to.
|
|
113
|
-
*/
|
|
114
|
-
colDef: PropTypes.object.isRequired,
|
|
115
|
-
debounceMs: PropTypes.number,
|
|
116
|
-
/**
|
|
117
|
-
* The column field of the cell that triggered the event.
|
|
118
|
-
*/
|
|
119
|
-
field: PropTypes.string.isRequired,
|
|
120
|
-
/**
|
|
121
|
-
* The cell value formatted with the column valueFormatter.
|
|
122
|
-
*/
|
|
123
|
-
formattedValue: PropTypes.any,
|
|
124
|
-
/**
|
|
125
|
-
* If true, the cell is the active element.
|
|
126
|
-
*/
|
|
127
|
-
hasFocus: PropTypes.bool.isRequired,
|
|
128
|
-
/**
|
|
129
|
-
* The grid row id.
|
|
130
|
-
*/
|
|
131
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
132
|
-
/**
|
|
133
|
-
* If true, the cell is editable.
|
|
134
|
-
*/
|
|
135
|
-
isEditable: PropTypes.bool,
|
|
136
|
-
isProcessingProps: PropTypes.bool,
|
|
137
|
-
isValidating: PropTypes.bool,
|
|
138
|
-
/**
|
|
139
|
-
* Callback called when the value is changed by the user.
|
|
140
|
-
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
141
|
-
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
142
|
-
* @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
|
|
143
|
-
*/
|
|
144
|
-
onValueChange: PropTypes.func,
|
|
145
|
-
/**
|
|
146
|
-
* The row model of the row that the current cell belongs to.
|
|
147
|
-
*/
|
|
148
|
-
row: PropTypes.any.isRequired,
|
|
149
|
-
/**
|
|
150
|
-
* The node of the row that the current cell belongs to.
|
|
151
|
-
*/
|
|
152
|
-
rowNode: PropTypes.object.isRequired,
|
|
153
|
-
/**
|
|
154
|
-
* the tabIndex value.
|
|
155
|
-
*/
|
|
156
|
-
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
157
|
-
/**
|
|
158
|
-
* The cell value.
|
|
159
|
-
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
160
|
-
*/
|
|
161
|
-
value: PropTypes.any
|
|
162
|
-
} : void 0;
|
|
163
96
|
export { GridEditInputCell };
|
|
164
97
|
export const renderEditInputCell = params => /*#__PURE__*/_jsx(GridEditInputCell, _extends({}, params));
|