@mui/x-data-grid 5.11.1 → 5.12.2
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 +199 -20
- package/DataGrid/DataGrid.js +26 -1
- package/README.md +2 -2
- package/colDef/gridCheckboxSelectionColDef.d.ts +1 -0
- package/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/colDef/gridDateOperators.d.ts +1 -1
- package/colDef/gridNumericColDef.js +1 -1
- package/components/GridRow.d.ts +1 -1
- package/components/GridRow.js +51 -12
- package/components/cell/GridActionsCellItem.d.ts +1 -1
- package/components/cell/GridCell.d.ts +2 -1
- package/components/cell/GridCell.js +12 -7
- package/components/columnHeaders/GridColumnHeaderItem.js +9 -6
- package/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/components/containers/GridRootStyles.js +8 -3
- package/components/menu/GridMenu.js +9 -2
- package/components/panel/GridColumnsPanel.js +12 -7
- package/components/panel/GridPanelWrapper.d.ts +1 -1
- package/components/panel/GridPanelWrapper.js +3 -3
- package/components/panel/filterPanel/GridFilterForm.d.ts +61 -4
- package/components/panel/filterPanel/GridFilterForm.js +88 -8
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/components/panel/filterPanel/GridFilterPanel.d.ts +8 -5
- package/components/panel/filterPanel/GridFilterPanel.js +26 -11
- package/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/components/toolbar/GridToolbarQuickFilter.d.ts +7 -0
- package/components/toolbar/GridToolbarQuickFilter.js +57 -4
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +4 -0
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +1 -0
- package/hooks/core/useGridStateInitialization.js +19 -6
- package/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
- package/hooks/features/columns/gridColumnsInterfaces.d.ts +3 -0
- package/hooks/features/columns/useGridColumnSpanning.d.ts +1 -1
- package/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/columns/useGridColumns.js +13 -15
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +5 -0
- package/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/hooks/features/editRows/useGridCellEditing.new.js +11 -4
- package/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/hooks/features/editRows/useGridRowEditing.new.js +10 -4
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +2 -0
- package/hooks/features/filter/gridFilterSelector.d.ts +5 -0
- package/hooks/features/filter/gridFilterSelector.js +6 -0
- package/hooks/features/filter/gridFilterState.d.ts +1 -1
- package/hooks/features/filter/gridFilterUtils.d.ts +10 -2
- package/hooks/features/filter/gridFilterUtils.js +3 -6
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +29 -12
- package/hooks/features/pagination/useGridPage.js +1 -1
- package/hooks/features/pagination/useGridPageSize.js +1 -1
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/rows/useGridRowsMeta.js +133 -67
- package/hooks/features/selection/useGridSelection.js +1 -1
- package/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/sorting/useGridSorting.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +65 -11
- package/index.js +1 -1
- package/internals/index.d.ts +1 -0
- package/legacy/DataGrid/DataGrid.js +26 -1
- package/legacy/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/legacy/colDef/gridNumericColDef.js +1 -1
- package/legacy/components/GridRow.js +56 -12
- package/legacy/components/cell/GridCell.js +12 -7
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +11 -6
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/legacy/components/containers/GridRootStyles.js +10 -7
- package/legacy/components/menu/GridMenu.js +9 -2
- package/legacy/components/panel/GridColumnsPanel.js +14 -7
- package/legacy/components/panel/GridPanelWrapper.js +3 -3
- package/legacy/components/panel/filterPanel/GridFilterForm.js +89 -8
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +28 -12
- package/legacy/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/legacy/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/legacy/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/legacy/components/toolbar/GridToolbarQuickFilter.js +67 -6
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/constants/localeTextConstants.js +1 -0
- package/legacy/hooks/core/useGridStateInitialization.js +18 -6
- package/legacy/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/legacy/hooks/features/columns/useGridColumns.js +13 -15
- package/legacy/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +14 -7
- package/legacy/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +10 -4
- package/legacy/hooks/features/events/useGridEvents.js +2 -0
- package/legacy/hooks/features/filter/gridFilterSelector.js +8 -0
- package/legacy/hooks/features/filter/gridFilterUtils.js +4 -7
- package/legacy/hooks/features/filter/useGridFilter.js +33 -12
- package/legacy/hooks/features/pagination/useGridPage.js +1 -1
- package/legacy/hooks/features/pagination/useGridPageSize.js +1 -1
- package/legacy/hooks/features/rows/useGridRowsMeta.js +133 -66
- package/legacy/hooks/features/selection/useGridSelection.js +1 -1
- package/legacy/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/legacy/hooks/features/sorting/useGridSorting.js +1 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +84 -26
- package/legacy/index.js +1 -1
- package/legacy/locales/arSD.js +1 -0
- package/legacy/locales/bgBG.js +1 -0
- package/legacy/locales/csCZ.js +1 -0
- package/legacy/locales/daDK.js +1 -0
- package/legacy/locales/deDE.js +1 -0
- package/legacy/locales/elGR.js +1 -0
- package/legacy/locales/esES.js +1 -0
- package/legacy/locales/faIR.js +1 -0
- package/legacy/locales/fiFI.js +1 -0
- package/legacy/locales/frFR.js +1 -0
- package/legacy/locales/heIL.js +10 -9
- package/legacy/locales/huHU.js +1 -0
- package/legacy/locales/itIT.js +1 -0
- package/legacy/locales/jaJP.js +29 -24
- package/legacy/locales/koKR.js +1 -0
- package/legacy/locales/nbNO.js +128 -0
- package/legacy/locales/nlNL.js +1 -0
- package/legacy/locales/plPL.js +1 -0
- package/legacy/locales/ptBR.js +1 -0
- package/legacy/locales/ruRU.js +7 -6
- package/legacy/locales/skSK.js +1 -0
- package/legacy/locales/trTR.js +8 -7
- package/legacy/locales/ukUA.js +1 -0
- package/legacy/locales/viVN.js +1 -0
- package/legacy/locales/zhCN.js +1 -0
- package/legacy/models/events/gridEvents.js +2 -0
- package/legacy/models/gridApiCaches.js +1 -0
- package/legacy/models/params/gridMenuParams.js +1 -0
- package/legacy/models/params/index.js +2 -1
- package/locales/arSD.js +1 -0
- package/locales/bgBG.js +1 -0
- package/locales/csCZ.js +1 -0
- package/locales/daDK.js +1 -0
- package/locales/deDE.js +1 -0
- package/locales/elGR.js +1 -0
- package/locales/esES.js +1 -0
- package/locales/faIR.js +1 -0
- package/locales/fiFI.js +1 -0
- package/locales/frFR.js +1 -0
- package/locales/heIL.js +10 -9
- package/locales/huHU.js +1 -0
- package/locales/itIT.js +1 -0
- package/locales/jaJP.js +25 -24
- package/locales/koKR.js +1 -0
- package/locales/nbNO.d.ts +2 -0
- package/locales/nbNO.js +116 -0
- package/locales/nlNL.js +1 -0
- package/locales/plPL.js +1 -0
- package/locales/ptBR.js +1 -0
- package/locales/ruRU.js +7 -6
- package/locales/skSK.js +1 -0
- package/locales/trTR.js +8 -7
- package/locales/ukUA.js +1 -0
- package/locales/viVN.js +1 -0
- package/locales/zhCN.js +1 -0
- package/models/api/gridCallbackDetails.d.ts +6 -1
- package/models/api/gridCoreApi.d.ts +2 -6
- package/models/api/gridFilterApi.d.ts +8 -1
- package/models/api/gridLocaleTextApi.d.ts +1 -0
- package/models/api/gridRowsMetaApi.d.ts +24 -0
- package/models/api/gridStateApi.d.ts +14 -3
- package/models/colDef/gridColDef.d.ts +4 -4
- package/models/events/gridEventLookup.d.ts +16 -1
- package/models/events/gridEvents.d.ts +3 -1
- package/models/events/gridEvents.js +2 -0
- package/models/gridApiCaches.d.ts +6 -0
- package/models/gridApiCaches.js +1 -0
- package/models/gridIconSlotsComponent.d.ts +5 -0
- package/models/params/gridMenuParams.d.ts +7 -0
- package/models/params/gridMenuParams.js +1 -0
- package/models/params/gridRowParams.d.ts +1 -1
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/models/props/DataGridProps.d.ts +24 -2
- package/modern/DataGrid/DataGrid.js +26 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +2 -1
- package/modern/colDef/gridNumericColDef.js +1 -1
- package/modern/components/GridRow.js +51 -12
- package/modern/components/cell/GridCell.js +12 -7
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +9 -6
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/modern/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/modern/components/containers/GridRootStyles.js +8 -3
- package/modern/components/menu/GridMenu.js +9 -2
- package/modern/components/panel/GridColumnsPanel.js +12 -7
- package/modern/components/panel/GridPanelWrapper.js +3 -3
- package/modern/components/panel/filterPanel/GridFilterForm.js +88 -8
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/modern/components/panel/filterPanel/GridFilterPanel.js +26 -11
- package/modern/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/modern/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/modern/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/modern/components/toolbar/GridToolbarQuickFilter.js +57 -4
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +1 -0
- package/modern/hooks/core/useGridStateInitialization.js +19 -6
- package/modern/hooks/features/columnMenu/useGridColumnMenu.js +22 -0
- package/modern/hooks/features/columns/useGridColumnSpanning.js +1 -1
- package/modern/hooks/features/columns/useGridColumns.js +12 -14
- package/modern/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +10 -3
- package/modern/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +9 -3
- package/modern/hooks/features/events/useGridEvents.js +2 -0
- package/modern/hooks/features/filter/gridFilterSelector.js +6 -0
- package/modern/hooks/features/filter/gridFilterUtils.js +3 -6
- package/modern/hooks/features/filter/useGridFilter.js +29 -12
- package/modern/hooks/features/pagination/useGridPage.js +1 -1
- package/modern/hooks/features/pagination/useGridPageSize.js +1 -1
- package/modern/hooks/features/rows/useGridRowsMeta.js +129 -59
- package/modern/hooks/features/selection/useGridSelection.js +1 -1
- package/modern/hooks/features/selection/useGridSelectionPreProcessors.js +8 -6
- package/modern/hooks/features/sorting/useGridSorting.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +65 -11
- package/modern/index.js +1 -1
- package/modern/locales/arSD.js +1 -0
- package/modern/locales/bgBG.js +1 -0
- package/modern/locales/csCZ.js +1 -0
- package/modern/locales/daDK.js +1 -0
- package/modern/locales/deDE.js +1 -0
- package/modern/locales/elGR.js +1 -0
- package/modern/locales/esES.js +1 -0
- package/modern/locales/faIR.js +1 -0
- package/modern/locales/fiFI.js +1 -0
- package/modern/locales/frFR.js +1 -0
- package/modern/locales/heIL.js +10 -9
- package/modern/locales/huHU.js +1 -0
- package/modern/locales/itIT.js +1 -0
- package/modern/locales/jaJP.js +25 -24
- package/modern/locales/koKR.js +1 -0
- package/modern/locales/nbNO.js +116 -0
- package/modern/locales/nlNL.js +1 -0
- package/modern/locales/plPL.js +1 -0
- package/modern/locales/ptBR.js +1 -0
- package/modern/locales/ruRU.js +7 -6
- package/modern/locales/skSK.js +1 -0
- package/modern/locales/trTR.js +8 -7
- package/modern/locales/ukUA.js +1 -0
- package/modern/locales/viVN.js +1 -0
- package/modern/locales/zhCN.js +1 -0
- package/modern/models/events/gridEvents.js +2 -0
- package/modern/models/gridApiCaches.js +1 -0
- package/modern/models/params/gridMenuParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/node/DataGrid/DataGrid.js +26 -1
- package/node/colDef/gridCheckboxSelectionColDef.js +4 -2
- package/node/colDef/gridNumericColDef.js +1 -1
- package/node/components/GridRow.js +53 -12
- package/node/components/cell/GridCell.js +12 -7
- package/node/components/columnHeaders/GridColumnHeaderItem.js +9 -6
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +0 -1
- package/node/components/columnSelection/GridHeaderCheckbox.js +0 -1
- package/node/components/containers/GridRootStyles.js +8 -3
- package/node/components/menu/GridMenu.js +10 -2
- package/node/components/panel/GridColumnsPanel.js +12 -7
- package/node/components/panel/GridPanelWrapper.js +5 -3
- package/node/components/panel/filterPanel/GridFilterForm.js +91 -9
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +0 -1
- package/node/components/panel/filterPanel/GridFilterPanel.js +28 -11
- package/node/components/toolbar/GridToolbarColumnsButton.js +0 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +0 -1
- package/node/components/toolbar/GridToolbarExportContainer.js +0 -1
- package/node/components/toolbar/GridToolbarFilterButton.js +0 -1
- package/node/components/toolbar/GridToolbarQuickFilter.js +61 -4
- package/node/constants/defaultGridSlotsComponents.js +2 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +1 -0
- package/node/hooks/core/useGridStateInitialization.js +19 -6
- package/node/hooks/features/columnMenu/useGridColumnMenu.js +23 -0
- package/node/hooks/features/columns/useGridColumnSpanning.js +11 -16
- package/node/hooks/features/columns/useGridColumns.js +13 -15
- package/node/hooks/features/dimensions/useGridDimensions.js +9 -8
- package/node/hooks/features/editRows/useGridCellEditing.new.js +11 -4
- package/node/hooks/features/editRows/useGridEditing.old.js +1 -1
- package/node/hooks/features/editRows/useGridRowEditing.new.js +10 -4
- package/node/hooks/features/events/useGridEvents.js +2 -0
- package/node/hooks/features/filter/gridFilterSelector.js +9 -2
- package/node/hooks/features/filter/gridFilterUtils.js +4 -5
- package/node/hooks/features/filter/useGridFilter.js +28 -11
- package/node/hooks/features/pagination/useGridPage.js +1 -1
- package/node/hooks/features/pagination/useGridPageSize.js +1 -1
- package/node/hooks/features/rows/useGridRowsMeta.js +136 -69
- package/node/hooks/features/selection/useGridSelection.js +1 -1
- package/node/hooks/features/selection/useGridSelectionPreProcessors.js +7 -5
- package/node/hooks/features/sorting/useGridSorting.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +65 -12
- package/node/index.js +1 -1
- package/node/locales/arSD.js +1 -0
- package/node/locales/bgBG.js +1 -0
- package/node/locales/csCZ.js +1 -0
- package/node/locales/daDK.js +1 -0
- package/node/locales/deDE.js +1 -0
- package/node/locales/elGR.js +1 -0
- package/node/locales/esES.js +1 -0
- package/node/locales/faIR.js +1 -0
- package/node/locales/fiFI.js +1 -0
- package/node/locales/frFR.js +1 -0
- package/node/locales/heIL.js +10 -9
- package/node/locales/huHU.js +1 -0
- package/node/locales/itIT.js +1 -0
- package/node/locales/jaJP.js +25 -24
- package/node/locales/koKR.js +1 -0
- package/node/locales/nbNO.js +126 -0
- package/node/locales/nlNL.js +1 -0
- package/node/locales/plPL.js +1 -0
- package/node/locales/ptBR.js +1 -0
- package/node/locales/ruRU.js +7 -6
- package/node/locales/skSK.js +1 -0
- package/node/locales/trTR.js +8 -7
- package/node/locales/ukUA.js +1 -0
- package/node/locales/viVN.js +1 -0
- package/node/locales/zhCN.js +1 -0
- package/node/models/events/gridEvents.js +2 -0
- package/node/models/gridApiCaches.js +5 -0
- package/node/models/params/gridMenuParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/package.json +6 -5
|
@@ -82,6 +82,8 @@ var GridEvents;
|
|
|
82
82
|
GridEvents["virtualScrollerTouchMove"] = "virtualScrollerTouchMove";
|
|
83
83
|
GridEvents["preferencePanelClose"] = "preferencePanelClose";
|
|
84
84
|
GridEvents["preferencePanelOpen"] = "preferencePanelOpen";
|
|
85
|
+
GridEvents["menuOpen"] = "menuOpen";
|
|
86
|
+
GridEvents["menuClose"] = "menuClose";
|
|
85
87
|
})(GridEvents || (GridEvents = {}));
|
|
86
88
|
|
|
87
89
|
export { GridEvents };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -10,4 +10,5 @@ export * from './gridHeaderSelectionCheckboxParams';
|
|
|
10
10
|
export * from './gridValueOptionsParams';
|
|
11
11
|
export * from './gridCellParams';
|
|
12
12
|
export * from './gridSortModelParams';
|
|
13
|
-
export * from './gridPreferencePanelParams';
|
|
13
|
+
export * from './gridPreferencePanelParams';
|
|
14
|
+
export * from './gridMenuParams';
|
|
@@ -252,6 +252,15 @@ DataGridRaw.propTypes = {
|
|
|
252
252
|
*/
|
|
253
253
|
getDetailPanelContent: _propTypes.default.func,
|
|
254
254
|
|
|
255
|
+
/**
|
|
256
|
+
* Function that returns the estimated height for a row.
|
|
257
|
+
* Only works if dynamic row height is used.
|
|
258
|
+
* Once the row height is measured this value is discarded.
|
|
259
|
+
* @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
|
|
260
|
+
* @returns {number | null} The estimated row height value. If `null` or `undefined` then the default row height, based on the density, is applied.
|
|
261
|
+
*/
|
|
262
|
+
getEstimatedRowHeight: _propTypes.default.func,
|
|
263
|
+
|
|
255
264
|
/**
|
|
256
265
|
* Function that applies CSS classes dynamically on rows.
|
|
257
266
|
* @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
|
|
@@ -262,7 +271,7 @@ DataGridRaw.propTypes = {
|
|
|
262
271
|
/**
|
|
263
272
|
* Function that sets the row height per row.
|
|
264
273
|
* @param {GridRowHeightParams} params With all properties from [[GridRowHeightParams]].
|
|
265
|
-
* @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied.
|
|
274
|
+
* @returns {GridRowHeightReturnValue} The row height value. If `null` or `undefined` then the default row height is applied. If "auto" then the row height is calculated based on the content.
|
|
266
275
|
*/
|
|
267
276
|
getRowHeight: _propTypes.default.func,
|
|
268
277
|
|
|
@@ -529,6 +538,22 @@ DataGridRaw.propTypes = {
|
|
|
529
538
|
*/
|
|
530
539
|
onFilterModelChange: _propTypes.default.func,
|
|
531
540
|
|
|
541
|
+
/**
|
|
542
|
+
* Callback fired when the menu is closed.
|
|
543
|
+
* @param {GridMenuParams} params With all properties from [[GridMenuParams]].
|
|
544
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
545
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
546
|
+
*/
|
|
547
|
+
onMenuClose: _propTypes.default.func,
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Callback fired when the menu is opened.
|
|
551
|
+
* @param {GridMenuParams} params With all properties from [[GridMenuParams]].
|
|
552
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
553
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
554
|
+
*/
|
|
555
|
+
onMenuOpen: _propTypes.default.func,
|
|
556
|
+
|
|
532
557
|
/**
|
|
533
558
|
* Callback fired when the current page has changed.
|
|
534
559
|
* @param {number} page Index of the page displayed on the Grid.
|
|
@@ -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.GRID_CHECKBOX_SELECTION_COL_DEF = void 0;
|
|
8
|
+
exports.GRID_CHECKBOX_SELECTION_FIELD = exports.GRID_CHECKBOX_SELECTION_COL_DEF = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -25,8 +25,10 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
25
25
|
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
27
|
|
|
28
|
+
const GRID_CHECKBOX_SELECTION_FIELD = '__check__';
|
|
29
|
+
exports.GRID_CHECKBOX_SELECTION_FIELD = GRID_CHECKBOX_SELECTION_FIELD;
|
|
28
30
|
const GRID_CHECKBOX_SELECTION_COL_DEF = (0, _extends2.default)({}, _gridBooleanColDef.GRID_BOOLEAN_COL_DEF, {
|
|
29
|
-
field:
|
|
31
|
+
field: GRID_CHECKBOX_SELECTION_FIELD,
|
|
30
32
|
type: 'checkboxSelection',
|
|
31
33
|
width: 50,
|
|
32
34
|
resizable: false,
|
|
@@ -25,7 +25,7 @@ const GRID_NUMERIC_COL_DEF = (0, _extends2.default)({}, _gridStringColDef.GRID_S
|
|
|
25
25
|
valueParser: value => value === '' ? null : Number(value),
|
|
26
26
|
valueFormatter: ({
|
|
27
27
|
value
|
|
28
|
-
}) =>
|
|
28
|
+
}) => (0, _utils.isNumber)(value) ? value.toLocaleString() : value || '',
|
|
29
29
|
filterOperators: (0, _gridNumericOperators.getGridNumericOperators)(),
|
|
30
30
|
getApplyQuickFilterFn: _gridNumericOperators.getGridNumericQuickFilterFn
|
|
31
31
|
});
|
|
@@ -41,6 +41,10 @@ var _gridActionsColDef = require("../colDef/gridActionsColDef");
|
|
|
41
41
|
|
|
42
42
|
var _gridDetailPanelToggleField = require("../constants/gridDetailPanelToggleField");
|
|
43
43
|
|
|
44
|
+
var _gridSortingSelector = require("../hooks/features/sorting/gridSortingSelector");
|
|
45
|
+
|
|
46
|
+
var _gridRowsSelector = require("../hooks/features/rows/gridRowsSelector");
|
|
47
|
+
|
|
44
48
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
45
49
|
|
|
46
50
|
const _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
@@ -55,25 +59,24 @@ const useUtilityClasses = ownerState => {
|
|
|
55
59
|
editing,
|
|
56
60
|
selected,
|
|
57
61
|
isLastVisible,
|
|
62
|
+
rowHeight,
|
|
58
63
|
classes
|
|
59
64
|
} = ownerState;
|
|
60
65
|
const slots = {
|
|
61
|
-
root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isLastVisible && 'row--lastVisible']
|
|
66
|
+
root: ['row', selected && 'selected', editable && 'row--editable', editing && 'row--editing', isLastVisible && 'row--lastVisible', rowHeight === 'auto' && 'row--dynamicHeight']
|
|
62
67
|
};
|
|
63
68
|
return (0, _material.unstable_composeClasses)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
64
69
|
};
|
|
65
70
|
|
|
66
71
|
const EmptyCell = ({
|
|
67
|
-
width
|
|
68
|
-
height
|
|
72
|
+
width
|
|
69
73
|
}) => {
|
|
70
|
-
if (!width
|
|
74
|
+
if (!width) {
|
|
71
75
|
return null;
|
|
72
76
|
}
|
|
73
77
|
|
|
74
78
|
const style = {
|
|
75
|
-
width
|
|
76
|
-
height
|
|
79
|
+
width
|
|
77
80
|
};
|
|
78
81
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
79
82
|
className: "MuiDataGrid-cell",
|
|
@@ -109,9 +112,12 @@ function GridRow(props) {
|
|
|
109
112
|
const ariaRowIndex = index + 2; // 1 for the header row and 1 as it's 1-based
|
|
110
113
|
|
|
111
114
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
115
|
+
const ref = React.useRef(null);
|
|
112
116
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
113
117
|
const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, rootProps);
|
|
114
118
|
const columnsTotalWidth = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridColumnsTotalWidthSelector);
|
|
119
|
+
const sortModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridSortingSelector.gridSortModelSelector);
|
|
120
|
+
const treeDepth = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridRowTreeDepthSelector);
|
|
115
121
|
const {
|
|
116
122
|
hasScrollX,
|
|
117
123
|
hasScrollY
|
|
@@ -124,9 +130,41 @@ function GridRow(props) {
|
|
|
124
130
|
isLastVisible,
|
|
125
131
|
classes: rootProps.classes,
|
|
126
132
|
editing: apiRef.current.getRowMode(rowId) === _gridEditRowModel.GridRowModes.Edit,
|
|
127
|
-
editable: rootProps.editMode === _gridEditRowModel.GridEditModes.Row
|
|
133
|
+
editable: rootProps.editMode === _gridEditRowModel.GridEditModes.Row,
|
|
134
|
+
rowHeight
|
|
128
135
|
};
|
|
129
136
|
const classes = useUtilityClasses(ownerState);
|
|
137
|
+
React.useLayoutEffect(() => {
|
|
138
|
+
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
139
|
+
// Fallback for IE
|
|
140
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
React.useLayoutEffect(() => {
|
|
144
|
+
if (currentPage.range) {
|
|
145
|
+
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
146
|
+
// first row is 5 if pageSize=5 and page=1. However, the index used by the virtualization
|
|
147
|
+
// doesn't care about pagination and considers the rows from the current page only, so the
|
|
148
|
+
// first row always has index=0. We need to subtract the index of the first row to make it
|
|
149
|
+
// compatible with the index used by the virtualization.
|
|
150
|
+
apiRef.current.unstable_setLastMeasuredRowIndex(index - currentPage.range.firstRowIndex);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const rootElement = ref.current;
|
|
154
|
+
const hasFixedHeight = rowHeight !== 'auto';
|
|
155
|
+
|
|
156
|
+
if (!rootElement || hasFixedHeight || typeof ResizeObserver === 'undefined') {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
161
|
+
const [entry] = entries;
|
|
162
|
+
const height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
163
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
|
|
164
|
+
});
|
|
165
|
+
resizeObserver.observe(rootElement);
|
|
166
|
+
return () => resizeObserver.disconnect();
|
|
167
|
+
}, [apiRef, currentPage.range, index, rowHeight, rowId]);
|
|
130
168
|
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
131
169
|
// Ignore portal
|
|
132
170
|
// The target is not an element when triggered by a Select inside the cell
|
|
@@ -183,7 +221,8 @@ function GridRow(props) {
|
|
|
183
221
|
publish('rowClick', onClick)(event);
|
|
184
222
|
}, [apiRef, onClick, publish, rowId]);
|
|
185
223
|
const style = (0, _extends2.default)({}, styleProp, {
|
|
186
|
-
maxHeight: rowHeight,
|
|
224
|
+
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
225
|
+
// max-height doesn't support "auto"
|
|
187
226
|
minHeight: rowHeight
|
|
188
227
|
});
|
|
189
228
|
const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
@@ -220,6 +259,7 @@ function GridRow(props) {
|
|
|
220
259
|
const showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
221
260
|
const cellParams = apiRef.current.getCellParams(rowId, column.field);
|
|
222
261
|
const classNames = [];
|
|
262
|
+
const disableDragEvents = rootProps.disableColumnReorder && column.disableReorder || !rootProps.rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
|
|
223
263
|
|
|
224
264
|
if (column.cellClassName) {
|
|
225
265
|
classNames.push((0, _clsx.default)(typeof column.cellClassName === 'function' ? column.cellClassName(cellParams) : column.cellClassName));
|
|
@@ -289,7 +329,8 @@ function GridRow(props) {
|
|
|
289
329
|
hasFocus: hasFocus,
|
|
290
330
|
tabIndex: tabIndex,
|
|
291
331
|
className: (0, _clsx.default)(classNames),
|
|
292
|
-
colSpan: colSpan
|
|
332
|
+
colSpan: colSpan,
|
|
333
|
+
disableDragEvents: disableDragEvents
|
|
293
334
|
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
|
|
294
335
|
children: content
|
|
295
336
|
}), column.field));
|
|
@@ -298,6 +339,7 @@ function GridRow(props) {
|
|
|
298
339
|
|
|
299
340
|
const emptyCellWidth = containerWidth - columnsTotalWidth;
|
|
300
341
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
|
|
342
|
+
ref: ref,
|
|
301
343
|
"data-id": rowId,
|
|
302
344
|
"data-rowindex": index,
|
|
303
345
|
role: "row",
|
|
@@ -311,8 +353,7 @@ function GridRow(props) {
|
|
|
311
353
|
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
312
354
|
}, other, {
|
|
313
355
|
children: [cells, emptyCellWidth > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyCell, {
|
|
314
|
-
width: emptyCellWidth
|
|
315
|
-
height: rowHeight
|
|
356
|
+
width: emptyCellWidth
|
|
316
357
|
})]
|
|
317
358
|
}));
|
|
318
359
|
}
|
|
@@ -337,7 +378,7 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
337
378
|
lastColumnToRender: _propTypes.default.number.isRequired,
|
|
338
379
|
renderedColumns: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
339
380
|
row: _propTypes.default.any.isRequired,
|
|
340
|
-
rowHeight: _propTypes.default.number.isRequired,
|
|
381
|
+
rowHeight: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]).isRequired,
|
|
341
382
|
rowId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
342
383
|
selected: _propTypes.default.bool.isRequired,
|
|
343
384
|
visibleColumns: _propTypes.default.arrayOf(_propTypes.default.object).isRequired
|
|
@@ -33,7 +33,7 @@ var _gridFocusStateSelector = require("../../hooks/features/focus/gridFocusState
|
|
|
33
33
|
|
|
34
34
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
35
|
|
|
36
|
-
const _excluded = ["align", "children", "colIndex", "colDef", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onKeyDown", "onDragEnter", "onDragOver"];
|
|
36
|
+
const _excluded = ["align", "children", "colIndex", "colDef", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onKeyDown", "onDragEnter", "onDragOver"];
|
|
37
37
|
|
|
38
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
39
|
|
|
@@ -92,6 +92,7 @@ function GridCell(props) {
|
|
|
92
92
|
className,
|
|
93
93
|
showRightBorder,
|
|
94
94
|
colSpan,
|
|
95
|
+
disableDragEvents,
|
|
95
96
|
onClick,
|
|
96
97
|
onDoubleClick,
|
|
97
98
|
onMouseDown,
|
|
@@ -143,7 +144,8 @@ function GridCell(props) {
|
|
|
143
144
|
minWidth: width,
|
|
144
145
|
maxWidth: width,
|
|
145
146
|
minHeight: height,
|
|
146
|
-
maxHeight: height
|
|
147
|
+
maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
|
|
148
|
+
|
|
147
149
|
};
|
|
148
150
|
React.useLayoutEffect(() => {
|
|
149
151
|
if (!hasFocus || cellMode === _models.GridCellModes.Edit) {
|
|
@@ -208,6 +210,10 @@ function GridCell(props) {
|
|
|
208
210
|
return children;
|
|
209
211
|
};
|
|
210
212
|
|
|
213
|
+
const draggableEventHandlers = disableDragEvents ? null : {
|
|
214
|
+
onDragEnter: publish('cellDragEnter', onDragEnter),
|
|
215
|
+
onDragOver: publish('cellDragOver', onDragOver)
|
|
216
|
+
};
|
|
211
217
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", (0, _extends2.default)({
|
|
212
218
|
ref: cellRef,
|
|
213
219
|
className: (0, _clsx.default)(className, classes.root),
|
|
@@ -222,10 +228,8 @@ function GridCell(props) {
|
|
|
222
228
|
onDoubleClick: publish('cellDoubleClick', onDoubleClick),
|
|
223
229
|
onMouseDown: publish('cellMouseDown', onMouseDown),
|
|
224
230
|
onMouseUp: publishMouseUp('cellMouseUp'),
|
|
225
|
-
onKeyDown: publish('cellKeyDown', onKeyDown)
|
|
226
|
-
|
|
227
|
-
onDragOver: publish('cellDragOver', onDragOver)
|
|
228
|
-
}, other, {
|
|
231
|
+
onKeyDown: publish('cellKeyDown', onKeyDown)
|
|
232
|
+
}, draggableEventHandlers, other, {
|
|
229
233
|
onFocus: handleFocus,
|
|
230
234
|
children: renderChildren()
|
|
231
235
|
}));
|
|
@@ -242,10 +246,11 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
242
246
|
className: _propTypes.default.string,
|
|
243
247
|
colIndex: _propTypes.default.number.isRequired,
|
|
244
248
|
colSpan: _propTypes.default.number,
|
|
249
|
+
disableDragEvents: _propTypes.default.bool,
|
|
245
250
|
field: _propTypes.default.string.isRequired,
|
|
246
251
|
formattedValue: _propTypes.default.any,
|
|
247
252
|
hasFocus: _propTypes.default.bool,
|
|
248
|
-
height: _propTypes.default.number.isRequired,
|
|
253
|
+
height: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.number]).isRequired,
|
|
249
254
|
isEditable: _propTypes.default.bool,
|
|
250
255
|
onClick: _propTypes.default.func,
|
|
251
256
|
onDoubleClick: _propTypes.default.func,
|
|
@@ -96,6 +96,7 @@ function GridColumnHeaderItem(props) {
|
|
|
96
96
|
hasScrollX: false,
|
|
97
97
|
hasScrollY: false
|
|
98
98
|
};
|
|
99
|
+
const isDraggable = React.useMemo(() => !rootProps.disableColumnReorder && !disableReorder && !column.disableReorder, [rootProps.disableColumnReorder, disableReorder, column.disableReorder]);
|
|
99
100
|
let headerComponent = null;
|
|
100
101
|
|
|
101
102
|
if (column.renderHeader) {
|
|
@@ -126,12 +127,12 @@ function GridColumnHeaderItem(props) {
|
|
|
126
127
|
onFocus: publish('columnHeaderFocus'),
|
|
127
128
|
onBlur: publish('columnHeaderBlur')
|
|
128
129
|
};
|
|
129
|
-
const draggableEventHandlers = {
|
|
130
|
+
const draggableEventHandlers = isDraggable ? {
|
|
130
131
|
onDragStart: publish('columnHeaderDragStart'),
|
|
131
132
|
onDragEnter: publish('columnHeaderDragEnter'),
|
|
132
133
|
onDragOver: publish('columnHeaderDragOver'),
|
|
133
134
|
onDragEnd: publish('columnHeaderDragEnd')
|
|
134
|
-
};
|
|
135
|
+
} : null;
|
|
135
136
|
const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
136
137
|
const showRightBorder = !isLastColumn ? rootProps.showColumnRightBorder : !removeLastBorderRight && !extendRowFullWidth;
|
|
137
138
|
const ownerState = (0, _extends2.default)({}, props, {
|
|
@@ -186,6 +187,7 @@ function GridColumnHeaderItem(props) {
|
|
|
186
187
|
field: column.field,
|
|
187
188
|
colDef: column
|
|
188
189
|
}) : column.headerClassName;
|
|
190
|
+
const label = (_column$headerName = column.headerName) != null ? _column$headerName : column.field;
|
|
189
191
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
|
|
190
192
|
ref: headerCellRef,
|
|
191
193
|
className: (0, _clsx.default)(classes.root, headerClassName),
|
|
@@ -198,18 +200,19 @@ function GridColumnHeaderItem(props) {
|
|
|
198
200
|
role: "columnheader",
|
|
199
201
|
tabIndex: tabIndex,
|
|
200
202
|
"aria-colindex": colIndex + 1,
|
|
201
|
-
"aria-sort": ariaSort
|
|
203
|
+
"aria-sort": ariaSort,
|
|
204
|
+
"aria-label": column.renderHeader && headerComponent == null ? label : undefined
|
|
202
205
|
}, mouseEventsHandlers, {
|
|
203
206
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _extends2.default)({
|
|
204
207
|
className: classes.draggableContainer,
|
|
205
|
-
draggable:
|
|
208
|
+
draggable: isDraggable
|
|
206
209
|
}, draggableEventHandlers, {
|
|
207
210
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
208
211
|
className: classes.titleContainer,
|
|
209
212
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
210
213
|
className: classes.titleContainerContent,
|
|
211
|
-
children: headerComponent
|
|
212
|
-
label:
|
|
214
|
+
children: column.renderHeader ? headerComponent : /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridColumnHeaderTitle.GridColumnHeaderTitle, {
|
|
215
|
+
label: label,
|
|
213
216
|
description: column.description,
|
|
214
217
|
columnWidth: width
|
|
215
218
|
})
|
|
@@ -176,7 +176,7 @@ const GridRootStyles = (0, _styles.styled)('div', {
|
|
|
176
176
|
minWidth: 0,
|
|
177
177
|
flex: 1,
|
|
178
178
|
whiteSpace: 'nowrap',
|
|
179
|
-
|
|
179
|
+
overflowX: 'hidden'
|
|
180
180
|
},
|
|
181
181
|
[`& .${_gridClasses.gridClasses.columnHeaderTitleContainerContent}`]: {
|
|
182
182
|
overflow: 'hidden',
|
|
@@ -232,6 +232,9 @@ const GridRootStyles = (0, _styles.styled)('div', {
|
|
|
232
232
|
},
|
|
233
233
|
[`&.${_gridClasses.gridClasses['columnSeparator--resizing']}`]: {
|
|
234
234
|
color: theme.palette.text.primary
|
|
235
|
+
},
|
|
236
|
+
'& svg': {
|
|
237
|
+
pointerEvents: 'none'
|
|
235
238
|
}
|
|
236
239
|
},
|
|
237
240
|
[`& .${_gridClasses.gridClasses.iconSeparator}`]: {
|
|
@@ -285,10 +288,12 @@ const GridRootStyles = (0, _styles.styled)('div', {
|
|
|
285
288
|
[`& .${_gridClasses.gridClasses.cell}`]: {
|
|
286
289
|
display: 'flex',
|
|
287
290
|
alignItems: 'center',
|
|
288
|
-
overflow: 'hidden',
|
|
289
|
-
whiteSpace: 'nowrap',
|
|
290
291
|
borderBottom: `1px solid ${borderColor}`
|
|
291
292
|
},
|
|
293
|
+
[`& .${_gridClasses.gridClasses.row}:not(.${_gridClasses.gridClasses['row--dynamicHeight']}) > .${_gridClasses.gridClasses.cell}`]: {
|
|
294
|
+
overflow: 'hidden',
|
|
295
|
+
whiteSpace: 'nowrap'
|
|
296
|
+
},
|
|
292
297
|
[`& .${_gridClasses.gridClasses.cellContent}`]: {
|
|
293
298
|
overflow: 'hidden',
|
|
294
299
|
textOverflow: 'ellipsis'
|
|
@@ -35,6 +35,8 @@ var _gridClasses = require("../../constants/gridClasses");
|
|
|
35
35
|
|
|
36
36
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
37
37
|
|
|
38
|
+
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
39
|
+
|
|
38
40
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
39
41
|
|
|
40
42
|
const _excluded = ["open", "target", "onClickAway", "children", "position", "className", "onExited"];
|
|
@@ -83,6 +85,7 @@ const GridMenu = props => {
|
|
|
83
85
|
onExited
|
|
84
86
|
} = props,
|
|
85
87
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
88
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
86
89
|
const prevTarget = React.useRef(target);
|
|
87
90
|
const prevOpen = React.useRef(open);
|
|
88
91
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -93,11 +96,16 @@ const GridMenu = props => {
|
|
|
93
96
|
React.useEffect(() => {
|
|
94
97
|
if (prevOpen.current && prevTarget.current) {
|
|
95
98
|
prevTarget.current.focus();
|
|
96
|
-
}
|
|
99
|
+
} // Emit menuOpen or menuClose events
|
|
100
|
+
|
|
97
101
|
|
|
102
|
+
const eventName = open ? 'menuOpen' : 'menuClose';
|
|
103
|
+
apiRef.current.publishEvent(eventName, {
|
|
104
|
+
target
|
|
105
|
+
});
|
|
98
106
|
prevOpen.current = open;
|
|
99
107
|
prevTarget.current = target;
|
|
100
|
-
}, [open, target]);
|
|
108
|
+
}, [apiRef, open, target]);
|
|
101
109
|
|
|
102
110
|
const handleExited = popperOnExited => node => {
|
|
103
111
|
if (popperOnExited) {
|
|
@@ -107,8 +107,16 @@ function GridColumnsPanel(props) {
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
const toggleAllColumns = React.useCallback(isVisible => {
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
if (apiRef.current.unstable_caches.columns.isUsingColumnVisibilityModel) {
|
|
111
|
+
if (isVisible) {
|
|
112
|
+
return apiRef.current.setColumnVisibilityModel({});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return apiRef.current.setColumnVisibilityModel(Object.fromEntries(columns.map(col => [col.field, false])));
|
|
116
|
+
} // TODO v6: Remove
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
return apiRef.current.updateColumns(columns.map(col => {
|
|
112
120
|
if (col.hideable !== false) {
|
|
113
121
|
return {
|
|
114
122
|
field: col.field,
|
|
@@ -158,7 +166,6 @@ function GridColumnsPanel(props) {
|
|
|
158
166
|
checked: columnVisibilityModel[column.field] !== false,
|
|
159
167
|
onClick: toggleColumn,
|
|
160
168
|
name: column.field,
|
|
161
|
-
color: "primary",
|
|
162
169
|
size: "small"
|
|
163
170
|
}, (_rootProps$components2 = rootProps.componentsProps) == null ? void 0 : _rootProps$components2.baseSwitch)),
|
|
164
171
|
label: column.headerName || column.field
|
|
@@ -175,13 +182,11 @@ function GridColumnsPanel(props) {
|
|
|
175
182
|
})
|
|
176
183
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GridPanelFooter.GridPanelFooter, {
|
|
177
184
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.BaseButton, (0, _extends2.default)({
|
|
178
|
-
onClick: () => toggleAllColumns(false)
|
|
179
|
-
color: "primary"
|
|
185
|
+
onClick: () => toggleAllColumns(false)
|
|
180
186
|
}, (_rootProps$components3 = rootProps.componentsProps) == null ? void 0 : _rootProps$components3.baseButton, {
|
|
181
187
|
children: apiRef.current.getLocaleText('columnsPanelHideAllButton')
|
|
182
188
|
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.components.BaseButton, (0, _extends2.default)({
|
|
183
|
-
onClick: () => toggleAllColumns(true)
|
|
184
|
-
color: "primary"
|
|
189
|
+
onClick: () => toggleAllColumns(true)
|
|
185
190
|
}, (_rootProps$components4 = rootProps.componentsProps) == null ? void 0 : _rootProps$components4.baseButton, {
|
|
186
191
|
children: apiRef.current.getLocaleText('columnsPanelShowAllButton')
|
|
187
192
|
}))]
|
|
@@ -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.GridPanelWrapper =
|
|
8
|
+
exports.GridPanelWrapper = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -58,7 +58,7 @@ const GridPanelWrapperRoot = (0, _styles.styled)('div', {
|
|
|
58
58
|
|
|
59
59
|
const isEnabled = () => true;
|
|
60
60
|
|
|
61
|
-
function GridPanelWrapper(props) {
|
|
61
|
+
const GridPanelWrapper = /*#__PURE__*/React.forwardRef(function GridPanelWrapper(props, ref) {
|
|
62
62
|
const {
|
|
63
63
|
className
|
|
64
64
|
} = props,
|
|
@@ -73,8 +73,10 @@ function GridPanelWrapper(props) {
|
|
|
73
73
|
disableEnforceFocus: true,
|
|
74
74
|
isEnabled: isEnabled,
|
|
75
75
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelWrapperRoot, (0, _extends2.default)({
|
|
76
|
+
ref: ref,
|
|
76
77
|
tabIndex: -1,
|
|
77
78
|
className: (0, _clsx.default)(className, classes.root)
|
|
78
79
|
}, other))
|
|
79
80
|
});
|
|
80
|
-
}
|
|
81
|
+
});
|
|
82
|
+
exports.GridPanelWrapper = GridPanelWrapper;
|