@mui/x-data-grid 5.12.3 → 5.14.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 +147 -1
- package/DataGrid/DataGrid.js +4 -4
- package/DataGrid/useDataGridComponent.js +1 -1
- package/colDef/gridActionsColDef.js +2 -0
- package/colDef/gridBooleanColDef.js +3 -1
- package/colDef/gridCheckboxSelectionColDef.js +2 -0
- package/colDef/gridDateOperators.d.ts +1 -1
- package/colDef/gridDateOperators.js +4 -2
- package/colDef/gridNumericOperators.js +4 -2
- package/colDef/gridStringColDef.d.ts +3 -0
- package/colDef/gridStringColDef.js +6 -0
- package/colDef/gridStringOperators.d.ts +1 -1
- package/colDef/gridStringOperators.js +15 -8
- package/components/GridRow.js +1 -1
- package/components/base/GridOverlays.js +4 -1
- package/components/cell/GridActionsCellItem.d.ts +2 -2
- package/components/cell/GridBooleanCell.d.ts +5 -2
- package/components/cell/GridBooleanCell.js +93 -2
- package/components/cell/GridEditDateCell.js +5 -1
- package/components/cell/index.d.ts +1 -0
- package/components/cell/index.js +1 -0
- package/components/columnSelection/GridCellCheckboxRenderer.js +7 -1
- package/components/containers/GridRootStyles.js +10 -0
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterForm.js +11 -4
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.d.ts +3 -8
- package/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +30 -14
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +3 -7
- package/components/panel/filterPanel/GridFilterInputMultipleValue.js +32 -14
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/components/panel/filterPanel/GridFilterInputValueProps.d.ts +6 -3
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
- package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
- package/components/toolbar/GridToolbarExport.js +20 -10
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/components/toolbar/GridToolbarFilterButton.d.ts +1 -1
- package/constants/gridClasses.d.ts +25 -1
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +8 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +2 -1
- package/hooks/features/columns/useGridColumnSpanning.js +9 -7
- package/hooks/features/columns/useGridColumns.d.ts +1 -1
- package/hooks/features/columns/useGridColumns.js +13 -6
- package/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/hooks/features/export/utils.d.ts +1 -1
- package/hooks/features/export/utils.js +9 -2
- package/hooks/features/filter/gridFilterUtils.js +6 -0
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +30 -5
- package/hooks/features/pagination/useGridPage.js +4 -3
- package/hooks/features/pagination/useGridPageSize.js +4 -3
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.d.ts +1 -1
- package/hooks/features/preferencesPanel/useGridPreferencesPanel.js +12 -4
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/rows/useGridRows.js +1 -1
- package/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/hooks/features/selection/useGridSelection.js +24 -10
- package/hooks/features/sorting/gridSortingUtils.d.ts +1 -0
- package/hooks/features/sorting/gridSortingUtils.js +10 -11
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/sorting/useGridSorting.js +34 -6
- package/hooks/features/statePersistence/gridStatePersistenceInterface.d.ts +12 -1
- package/hooks/features/statePersistence/index.d.ts +1 -1
- package/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/hooks/utils/useGridApiContext.js +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
- package/hooks/utils/useGridNativeEventListener.d.ts +1 -1
- package/hooks/utils/useGridNativeEventListener.js +1 -1
- package/hooks/utils/useGridRootProps.js +1 -1
- package/index.js +1 -1
- package/internals/index.d.ts +2 -2
- package/internals/index.js +2 -2
- package/legacy/DataGrid/DataGrid.js +4 -4
- package/legacy/DataGrid/useDataGridComponent.js +1 -1
- package/legacy/colDef/gridActionsColDef.js +2 -0
- package/legacy/colDef/gridBooleanColDef.js +3 -1
- package/legacy/colDef/gridCheckboxSelectionColDef.js +2 -0
- package/legacy/colDef/gridDateOperators.js +4 -2
- package/legacy/colDef/gridNumericOperators.js +4 -2
- package/legacy/colDef/gridStringColDef.js +6 -0
- package/legacy/colDef/gridStringOperators.js +17 -7
- package/legacy/components/GridRow.js +1 -1
- package/legacy/components/base/GridOverlays.js +4 -1
- package/legacy/components/cell/GridBooleanCell.js +93 -2
- package/legacy/components/cell/GridEditDateCell.js +5 -1
- package/legacy/components/cell/index.js +1 -0
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +6 -1
- package/legacy/components/containers/GridRootStyles.js +3 -3
- package/legacy/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +22 -7
- package/legacy/components/panel/filterPanel/GridFilterInputMultipleValue.js +24 -7
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/legacy/components/toolbar/GridToolbarExport.js +20 -10
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/constants/localeTextConstants.js +8 -1
- package/legacy/hooks/features/columns/useGridColumnSpanning.js +9 -7
- package/legacy/hooks/features/columns/useGridColumns.js +13 -8
- package/legacy/hooks/features/dimensions/useGridDimensions.js +27 -15
- package/legacy/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.old.js +16 -8
- package/legacy/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/legacy/hooks/features/editRows/useGridRowEditing.old.js +22 -14
- package/legacy/hooks/features/export/utils.js +9 -2
- package/legacy/hooks/features/filter/gridFilterUtils.js +6 -0
- package/legacy/hooks/features/filter/useGridFilter.js +30 -5
- package/legacy/hooks/features/pagination/useGridPage.js +4 -3
- package/legacy/hooks/features/pagination/useGridPageSize.js +4 -3
- package/legacy/hooks/features/preferencesPanel/useGridPreferencesPanel.js +12 -4
- package/legacy/hooks/features/rows/useGridRows.js +1 -1
- package/legacy/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/legacy/hooks/features/selection/useGridSelection.js +26 -12
- package/legacy/hooks/features/sorting/gridSortingUtils.js +11 -12
- package/legacy/hooks/features/sorting/useGridSorting.js +34 -6
- package/legacy/hooks/features/statePersistence/useGridStatePersistence.js +2 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +22 -12
- package/legacy/hooks/utils/useGridApiContext.js +1 -1
- package/legacy/hooks/utils/useGridNativeEventListener.js +1 -1
- package/legacy/hooks/utils/useGridRootProps.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +2 -2
- package/legacy/locales/arSD.js +7 -0
- package/legacy/locales/bgBG.js +7 -0
- package/legacy/locales/csCZ.js +7 -0
- package/legacy/locales/daDK.js +7 -0
- package/legacy/locales/deDE.js +12 -5
- package/legacy/locales/elGR.js +7 -0
- package/legacy/locales/esES.js +7 -0
- package/legacy/locales/faIR.js +7 -0
- package/legacy/locales/fiFI.js +7 -0
- package/legacy/locales/frFR.js +17 -10
- package/legacy/locales/heIL.js +8 -1
- package/legacy/locales/huHU.js +7 -0
- package/legacy/locales/index.js +4 -1
- package/legacy/locales/itIT.js +7 -0
- package/legacy/locales/jaJP.js +8 -1
- package/legacy/locales/koKR.js +7 -0
- package/legacy/locales/nbNO.js +8 -1
- package/legacy/locales/nlNL.js +21 -14
- package/legacy/locales/plPL.js +7 -0
- package/legacy/locales/ptBR.js +17 -10
- package/legacy/locales/roRO.js +135 -0
- package/legacy/locales/ruRU.js +7 -0
- package/legacy/locales/skSK.js +22 -15
- package/legacy/locales/svSE.js +8 -1
- package/legacy/locales/trTR.js +7 -0
- package/legacy/locales/ukUA.js +7 -0
- package/legacy/locales/viVN.js +7 -0
- package/legacy/locales/zhCN.js +7 -0
- package/legacy/locales/zhTW.js +135 -0
- package/legacy/models/events/gridEvents.js +1 -0
- package/legacy/utils/keyboardUtils.js +4 -3
- package/locales/arSD.js +7 -0
- package/locales/bgBG.js +7 -0
- package/locales/csCZ.js +7 -0
- package/locales/daDK.js +7 -0
- package/locales/deDE.js +12 -5
- package/locales/elGR.js +7 -0
- package/locales/esES.js +7 -0
- package/locales/faIR.js +7 -0
- package/locales/fiFI.js +7 -0
- package/locales/frFR.js +17 -10
- package/locales/heIL.js +8 -1
- package/locales/huHU.js +7 -0
- package/locales/index.d.ts +3 -0
- package/locales/index.js +4 -1
- package/locales/itIT.js +7 -0
- package/locales/jaJP.js +8 -1
- package/locales/koKR.js +7 -0
- package/locales/nbNO.js +8 -1
- package/locales/nlNL.js +21 -14
- package/locales/plPL.js +7 -0
- package/locales/ptBR.js +17 -10
- package/locales/roRO.d.ts +2 -0
- package/locales/roRO.js +123 -0
- package/locales/ruRU.js +7 -0
- package/locales/skSK.js +22 -15
- package/locales/svSE.js +8 -1
- package/locales/trTR.js +7 -0
- package/locales/ukUA.js +7 -0
- package/locales/viVN.js +7 -0
- package/locales/zhCN.js +7 -0
- package/locales/zhTW.d.ts +2 -0
- package/locales/zhTW.js +123 -0
- package/models/api/gridColumnSpanning.d.ts +2 -0
- package/models/api/gridLocaleTextApi.d.ts +8 -2
- package/models/api/gridSelectionApi.d.ts +6 -0
- package/models/events/gridEvents.d.ts +1 -0
- package/models/events/gridEvents.js +1 -0
- package/models/gridFilterOperator.d.ts +6 -0
- package/models/gridRows.d.ts +10 -1
- package/models/params/gridCellParams.d.ts +4 -4
- package/modern/DataGrid/DataGrid.js +4 -4
- package/modern/DataGrid/useDataGridComponent.js +1 -1
- package/modern/colDef/gridActionsColDef.js +2 -0
- package/modern/colDef/gridBooleanColDef.js +3 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +2 -0
- package/modern/colDef/gridDateOperators.js +4 -2
- package/modern/colDef/gridNumericOperators.js +4 -2
- package/modern/colDef/gridStringColDef.js +6 -0
- package/modern/colDef/gridStringOperators.js +15 -8
- package/modern/components/GridRow.js +1 -1
- package/modern/components/base/GridOverlays.js +4 -1
- package/modern/components/cell/GridBooleanCell.js +93 -2
- package/modern/components/cell/GridEditDateCell.js +5 -1
- package/modern/components/cell/index.js +1 -0
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +7 -1
- package/modern/components/containers/GridRootStyles.js +10 -0
- package/modern/components/panel/filterPanel/GridFilterForm.js +11 -4
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/modern/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +20 -8
- package/modern/components/panel/filterPanel/GridFilterInputMultipleValue.js +22 -8
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/modern/components/toolbar/GridToolbarExport.js +20 -10
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +8 -1
- package/modern/hooks/features/columns/useGridColumnSpanning.js +9 -7
- package/modern/hooks/features/columns/useGridColumns.js +10 -5
- package/modern/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/modern/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/modern/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/modern/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/modern/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/modern/hooks/features/export/utils.js +5 -2
- package/modern/hooks/features/filter/gridFilterUtils.js +6 -0
- package/modern/hooks/features/filter/useGridFilter.js +25 -4
- package/modern/hooks/features/pagination/useGridPage.js +4 -3
- package/modern/hooks/features/pagination/useGridPageSize.js +4 -3
- package/modern/hooks/features/preferencesPanel/useGridPreferencesPanel.js +8 -4
- package/modern/hooks/features/rows/useGridRows.js +1 -1
- package/modern/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/modern/hooks/features/selection/useGridSelection.js +22 -10
- package/modern/hooks/features/sorting/gridSortingUtils.js +10 -11
- package/modern/hooks/features/sorting/useGridSorting.js +30 -6
- package/modern/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +13 -7
- package/modern/hooks/utils/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridNativeEventListener.js +1 -1
- package/modern/hooks/utils/useGridRootProps.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -2
- package/modern/locales/arSD.js +7 -0
- package/modern/locales/bgBG.js +7 -0
- package/modern/locales/csCZ.js +7 -0
- package/modern/locales/daDK.js +7 -0
- package/modern/locales/deDE.js +12 -5
- package/modern/locales/elGR.js +7 -0
- package/modern/locales/esES.js +7 -0
- package/modern/locales/faIR.js +7 -0
- package/modern/locales/fiFI.js +7 -0
- package/modern/locales/frFR.js +17 -10
- package/modern/locales/heIL.js +8 -1
- package/modern/locales/huHU.js +7 -0
- package/modern/locales/index.js +4 -1
- package/modern/locales/itIT.js +7 -0
- package/modern/locales/jaJP.js +8 -1
- package/modern/locales/koKR.js +7 -0
- package/modern/locales/nbNO.js +8 -1
- package/modern/locales/nlNL.js +21 -14
- package/modern/locales/plPL.js +7 -0
- package/modern/locales/ptBR.js +17 -10
- package/modern/locales/roRO.js +123 -0
- package/modern/locales/ruRU.js +7 -0
- package/modern/locales/skSK.js +22 -15
- package/modern/locales/svSE.js +8 -1
- package/modern/locales/trTR.js +7 -0
- package/modern/locales/ukUA.js +7 -0
- package/modern/locales/viVN.js +7 -0
- package/modern/locales/zhCN.js +7 -0
- package/modern/locales/zhTW.js +123 -0
- package/modern/models/events/gridEvents.js +1 -0
- package/modern/utils/keyboardUtils.js +4 -3
- package/node/DataGrid/DataGrid.js +4 -4
- package/node/DataGrid/useDataGridComponent.js +1 -1
- package/node/colDef/gridActionsColDef.js +2 -0
- package/node/colDef/gridBooleanColDef.js +3 -1
- package/node/colDef/gridCheckboxSelectionColDef.js +2 -0
- package/node/colDef/gridDateOperators.js +4 -2
- package/node/colDef/gridNumericOperators.js +4 -2
- package/node/colDef/gridStringColDef.js +5 -0
- package/node/colDef/gridStringOperators.js +15 -8
- package/node/components/GridRow.js +1 -1
- package/node/components/base/GridOverlays.js +4 -1
- package/node/components/cell/GridBooleanCell.js +93 -2
- package/node/components/cell/GridEditDateCell.js +7 -1
- package/node/components/cell/index.js +13 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +7 -1
- package/node/components/containers/GridRootStyles.js +10 -0
- package/node/components/panel/filterPanel/GridFilterForm.js +9 -4
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputDate.js +4 -2
- package/node/components/panel/filterPanel/GridFilterInputMultipleSingleSelect.js +31 -15
- package/node/components/panel/filterPanel/GridFilterInputMultipleValue.js +33 -15
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +8 -2
- package/node/components/panel/filterPanel/GridFilterInputValue.js +4 -2
- package/node/components/toolbar/GridToolbarExport.js +16 -10
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +8 -1
- package/node/hooks/features/columns/useGridColumnSpanning.js +9 -7
- package/node/hooks/features/columns/useGridColumns.js +13 -6
- package/node/hooks/features/dimensions/useGridDimensions.js +28 -15
- package/node/hooks/features/editRows/useGridCellEditing.new.js +7 -1
- package/node/hooks/features/editRows/useGridCellEditing.old.js +6 -0
- package/node/hooks/features/editRows/useGridRowEditing.new.js +7 -1
- package/node/hooks/features/editRows/useGridRowEditing.old.js +6 -0
- package/node/hooks/features/export/utils.js +10 -2
- package/node/hooks/features/filter/gridFilterUtils.js +7 -0
- package/node/hooks/features/filter/useGridFilter.js +30 -5
- package/node/hooks/features/pagination/useGridPage.js +4 -3
- package/node/hooks/features/pagination/useGridPageSize.js +4 -3
- package/node/hooks/features/preferencesPanel/useGridPreferencesPanel.js +12 -4
- package/node/hooks/features/rows/useGridRows.js +1 -1
- package/node/hooks/features/rows/useGridRowsPreProcessors.js +1 -1
- package/node/hooks/features/selection/useGridSelection.js +24 -10
- package/node/hooks/features/sorting/gridSortingUtils.js +10 -11
- package/node/hooks/features/sorting/useGridSorting.js +34 -6
- package/node/hooks/features/statePersistence/useGridStatePersistence.js +2 -2
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridNativeEventListener.js +1 -1
- package/node/hooks/utils/useGridRootProps.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +18 -0
- package/node/locales/arSD.js +7 -0
- package/node/locales/bgBG.js +7 -0
- package/node/locales/csCZ.js +7 -0
- package/node/locales/daDK.js +7 -0
- package/node/locales/deDE.js +12 -5
- package/node/locales/elGR.js +7 -0
- package/node/locales/esES.js +7 -0
- package/node/locales/faIR.js +7 -0
- package/node/locales/fiFI.js +7 -0
- package/node/locales/frFR.js +17 -10
- package/node/locales/heIL.js +8 -1
- package/node/locales/huHU.js +7 -0
- package/node/locales/index.js +39 -0
- package/node/locales/itIT.js +7 -0
- package/node/locales/jaJP.js +8 -1
- package/node/locales/koKR.js +7 -0
- package/node/locales/nbNO.js +8 -1
- package/node/locales/nlNL.js +21 -14
- package/node/locales/plPL.js +7 -0
- package/node/locales/ptBR.js +17 -10
- package/node/locales/roRO.js +133 -0
- package/node/locales/ruRU.js +7 -0
- package/node/locales/skSK.js +22 -15
- package/node/locales/svSE.js +8 -1
- package/node/locales/trTR.js +7 -0
- package/node/locales/ukUA.js +7 -0
- package/node/locales/viVN.js +7 -0
- package/node/locales/zhCN.js +7 -0
- package/node/locales/zhTW.js +133 -0
- package/node/models/events/gridEvents.js +1 -0
- package/node/utils/keyboardUtils.js +4 -3
- package/package.json +3 -3
- package/utils/getGridLocalization.d.ts +1 -1
- package/utils/keyboardUtils.js +4 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["hideMenu", "options"],
|
|
4
|
+
_excluded2 = ["hideMenu", "options"],
|
|
5
|
+
_excluded3 = ["csvOptions", "printOptions", "excelOptions"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import MenuItem from '@mui/material/MenuItem';
|
|
@@ -9,31 +11,39 @@ import { GridToolbarExportContainer } from './GridToolbarExportContainer';
|
|
|
9
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
12
|
export const GridCsvExportMenuItem = props => {
|
|
11
13
|
const apiRef = useGridApiContext();
|
|
14
|
+
|
|
12
15
|
const {
|
|
13
16
|
hideMenu,
|
|
14
17
|
options
|
|
15
|
-
} = props
|
|
16
|
-
|
|
18
|
+
} = props,
|
|
19
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
20
|
+
|
|
21
|
+
return /*#__PURE__*/_jsx(MenuItem, _extends({
|
|
17
22
|
onClick: () => {
|
|
18
23
|
apiRef.current.exportDataAsCsv(options);
|
|
19
24
|
hideMenu?.();
|
|
20
|
-
}
|
|
25
|
+
}
|
|
26
|
+
}, other, {
|
|
21
27
|
children: apiRef.current.getLocaleText('toolbarExportCSV')
|
|
22
|
-
});
|
|
28
|
+
}));
|
|
23
29
|
};
|
|
24
30
|
export const GridPrintExportMenuItem = props => {
|
|
25
31
|
const apiRef = useGridApiContext();
|
|
32
|
+
|
|
26
33
|
const {
|
|
27
34
|
hideMenu,
|
|
28
35
|
options
|
|
29
|
-
} = props
|
|
30
|
-
|
|
36
|
+
} = props,
|
|
37
|
+
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
38
|
+
|
|
39
|
+
return /*#__PURE__*/_jsx(MenuItem, _extends({
|
|
31
40
|
onClick: () => {
|
|
32
41
|
apiRef.current.exportDataAsPrint(options);
|
|
33
42
|
hideMenu?.();
|
|
34
|
-
}
|
|
43
|
+
}
|
|
44
|
+
}, other, {
|
|
35
45
|
children: apiRef.current.getLocaleText('toolbarExportPrint')
|
|
36
|
-
});
|
|
46
|
+
}));
|
|
37
47
|
};
|
|
38
48
|
const GridToolbarExport = /*#__PURE__*/React.forwardRef(function GridToolbarExport(props, ref) {
|
|
39
49
|
const {
|
|
@@ -41,7 +51,7 @@ const GridToolbarExport = /*#__PURE__*/React.forwardRef(function GridToolbarExpo
|
|
|
41
51
|
printOptions = {},
|
|
42
52
|
excelOptions
|
|
43
53
|
} = props,
|
|
44
|
-
other = _objectWithoutPropertiesLoose(props,
|
|
54
|
+
other = _objectWithoutPropertiesLoose(props, _excluded3);
|
|
45
55
|
|
|
46
56
|
const apiRef = useGridApiContext();
|
|
47
57
|
const preProcessedButtons = apiRef.current.unstable_applyPipeProcessors('exportMenu', [], {
|
|
@@ -2,4 +2,4 @@ import { generateUtilityClasses, generateUtilityClass } from '@mui/material';
|
|
|
2
2
|
export function getDataGridUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiDataGrid', slot);
|
|
4
4
|
}
|
|
5
|
-
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
|
|
5
|
+
export const gridClasses = generateUtilityClasses('MuiDataGrid', ['actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'autoHeight', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--withRenderer', 'cell', 'cellContent', 'cellCheckbox', 'checkboxInput', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderDropZone', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeaders', 'columnHeadersInner', 'columnHeadersInner--scrollable', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsPanel', 'columnsPanelRow', 'detailPanel', 'detailPanels', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filterForm', 'filterFormDeleteIcon', 'filterFormLinkOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'iconButtonContainer', 'iconSeparator', 'main', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'row', 'row--editable', 'row--editing', 'row--lastVisible', 'row--dragging', 'row--dynamicHeight', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'scrollArea--left', 'scrollArea--right', 'scrollArea', 'selectedRowCount', 'sortIcon', 'toolbarContainer', 'toolbarFilterList', 'virtualScroller', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'pinnedColumns', 'pinnedColumns--left', 'pinnedColumns--right', 'pinnedColumnHeaders', 'pinnedColumnHeaders--left', 'pinnedColumnHeaders--right', 'withBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'groupingCriteriaCell', 'groupingCriteriaCellToggle']);
|
|
@@ -111,5 +111,12 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
111
111
|
// Used core components translation keys
|
|
112
112
|
MuiTablePagination: {},
|
|
113
113
|
// Row reordering text
|
|
114
|
-
rowReorderingHeaderName: 'Row reordering'
|
|
114
|
+
rowReorderingHeaderName: 'Row reordering',
|
|
115
|
+
// Aggregation
|
|
116
|
+
aggregationMenuItemHeader: 'Aggregation',
|
|
117
|
+
aggregationFunctionLabelSum: 'sum',
|
|
118
|
+
aggregationFunctionLabelAvg: 'avg',
|
|
119
|
+
aggregationFunctionLabelMin: 'min',
|
|
120
|
+
aggregationFunctionLabelMax: 'max',
|
|
121
|
+
aggregationFunctionLabelSize: 'size'
|
|
115
122
|
};
|
|
@@ -26,11 +26,11 @@ export const useGridColumnSpanning = apiRef => {
|
|
|
26
26
|
columnIndex,
|
|
27
27
|
rowId,
|
|
28
28
|
minFirstColumnIndex,
|
|
29
|
-
maxLastColumnIndex
|
|
29
|
+
maxLastColumnIndex,
|
|
30
|
+
columns
|
|
30
31
|
} = params;
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const column = visibleColumns[columnIndex];
|
|
32
|
+
const columnsLength = columns.length;
|
|
33
|
+
const column = columns[columnIndex];
|
|
34
34
|
const colSpan = typeof column.colSpan === 'function' ? column.colSpan(apiRef.current.getCellParams(rowId, column.field)) : column.colSpan;
|
|
35
35
|
|
|
36
36
|
if (!colSpan || colSpan === 1) {
|
|
@@ -52,7 +52,7 @@ export const useGridColumnSpanning = apiRef => {
|
|
|
52
52
|
const nextColumnIndex = columnIndex + j; // Cells should be spanned only within their column section (left-pinned, right-pinned and unpinned).
|
|
53
53
|
|
|
54
54
|
if (nextColumnIndex >= minFirstColumnIndex && nextColumnIndex < maxLastColumnIndex) {
|
|
55
|
-
const nextColumn =
|
|
55
|
+
const nextColumn = columns[nextColumnIndex];
|
|
56
56
|
width += nextColumn.computedWidth;
|
|
57
57
|
setCellColSpanInfo(rowId, columnIndex + j, {
|
|
58
58
|
spannedByColSpan: true,
|
|
@@ -78,14 +78,16 @@ export const useGridColumnSpanning = apiRef => {
|
|
|
78
78
|
const calculateColSpan = React.useCallback(({
|
|
79
79
|
rowId,
|
|
80
80
|
minFirstColumn,
|
|
81
|
-
maxLastColumn
|
|
81
|
+
maxLastColumn,
|
|
82
|
+
columns
|
|
82
83
|
}) => {
|
|
83
84
|
for (let i = minFirstColumn; i < maxLastColumn; i += 1) {
|
|
84
85
|
const cellProps = calculateCellColSpan({
|
|
85
86
|
columnIndex: i,
|
|
86
87
|
rowId,
|
|
87
88
|
minFirstColumnIndex: minFirstColumn,
|
|
88
|
-
maxLastColumnIndex: maxLastColumn
|
|
89
|
+
maxLastColumnIndex: maxLastColumn,
|
|
90
|
+
columns
|
|
89
91
|
});
|
|
90
92
|
|
|
91
93
|
if (cellProps.colSpan > 1) {
|
|
@@ -186,14 +186,19 @@ export function useGridColumns(apiRef, props) {
|
|
|
186
186
|
* PRE-PROCESSING
|
|
187
187
|
*/
|
|
188
188
|
|
|
189
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
189
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
190
190
|
const columnsStateToExport = {};
|
|
191
191
|
|
|
192
192
|
if (apiRef.current.unstable_caches.columns.isUsingColumnVisibilityModel) {
|
|
193
193
|
const columnVisibilityModelToExport = gridColumnVisibilityModelSelector(apiRef);
|
|
194
|
-
const
|
|
195
|
-
|
|
196
|
-
if
|
|
194
|
+
const shouldExportColumnVisibilityModel = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
195
|
+
!context.exportOnlyDirtyModels || // Always export if the model is controlled
|
|
196
|
+
props.columnVisibilityModel != null || // Always export if the model has been initialized
|
|
197
|
+
// TODO v6 Do a nullish check instead to export even if the initial model equals "{}"
|
|
198
|
+
Object.keys(props.initialState?.columns?.columnVisibilityModel ?? {}).length > 0 || // Always export if the model is not empty
|
|
199
|
+
Object.keys(columnVisibilityModelToExport).length > 0;
|
|
200
|
+
|
|
201
|
+
if (shouldExportColumnVisibilityModel) {
|
|
197
202
|
columnsStateToExport.columnVisibilityModel = columnVisibilityModelToExport;
|
|
198
203
|
}
|
|
199
204
|
}
|
|
@@ -224,7 +229,7 @@ export function useGridColumns(apiRef, props) {
|
|
|
224
229
|
return _extends({}, prevState, {
|
|
225
230
|
columns: columnsStateToExport
|
|
226
231
|
});
|
|
227
|
-
}, [apiRef]);
|
|
232
|
+
}, [apiRef, props.columnVisibilityModel, props.initialState?.columns]);
|
|
228
233
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
229
234
|
const columnVisibilityModelToImport = apiRef.current.unstable_caches.columns.isUsingColumnVisibilityModel ? context.stateToRestore.columns?.columnVisibilityModel : undefined;
|
|
230
235
|
const initialState = context.stateToRestore.columns;
|
|
@@ -69,21 +69,34 @@ export function useGridDimensions(apiRef, props) {
|
|
|
69
69
|
rootElement.removeChild(scrollDiv);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
let viewportOuterSize;
|
|
73
|
+
let hasScrollX;
|
|
74
|
+
let hasScrollY;
|
|
75
|
+
|
|
76
|
+
if (props.autoHeight) {
|
|
77
|
+
hasScrollY = false;
|
|
78
|
+
hasScrollX = Math.round(columnsTotalWidth) > rootDimensionsRef.current.width;
|
|
79
|
+
viewportOuterSize = {
|
|
80
|
+
width: rootDimensionsRef.current.width,
|
|
81
|
+
height: rowsMeta.currentPageTotalHeight + (hasScrollX ? scrollBarSize : 0)
|
|
82
|
+
};
|
|
83
|
+
} else {
|
|
84
|
+
viewportOuterSize = {
|
|
85
|
+
width: rootDimensionsRef.current.width,
|
|
86
|
+
height: rootDimensionsRef.current.height - headerHeight
|
|
87
|
+
};
|
|
88
|
+
const scrollInformation = hasScroll({
|
|
89
|
+
content: {
|
|
90
|
+
width: Math.round(columnsTotalWidth),
|
|
91
|
+
height: rowsMeta.currentPageTotalHeight
|
|
92
|
+
},
|
|
93
|
+
container: viewportOuterSize,
|
|
94
|
+
scrollBarSize
|
|
95
|
+
});
|
|
96
|
+
hasScrollY = scrollInformation.hasScrollY;
|
|
97
|
+
hasScrollX = scrollInformation.hasScrollX;
|
|
98
|
+
}
|
|
99
|
+
|
|
87
100
|
const viewportInnerSize = {
|
|
88
101
|
width: viewportOuterSize.width - (hasScrollY ? scrollBarSize : 0),
|
|
89
102
|
height: viewportOuterSize.height - (hasScrollX ? scrollBarSize : 0)
|
|
@@ -70,6 +70,12 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
70
70
|
}, [apiRef]);
|
|
71
71
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
72
72
|
if (params.cellMode === GridCellModes.Edit) {
|
|
73
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
74
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
75
|
+
if (event.which === 229) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
let reason;
|
|
74
80
|
|
|
75
81
|
if (event.key === 'Escape') {
|
|
@@ -92,7 +98,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
92
98
|
let reason;
|
|
93
99
|
|
|
94
100
|
if (isPrintableKey(event.key)) {
|
|
95
|
-
if (event.
|
|
101
|
+
if (event.ctrlKey && event.key !== 'v' || event.metaKey && event.key !== 'v' || event.altKey) {
|
|
96
102
|
return;
|
|
97
103
|
}
|
|
98
104
|
|
|
@@ -175,6 +175,12 @@ export const useCellEditing = (apiRef, props) => {
|
|
|
175
175
|
};
|
|
176
176
|
useGridApiMethod(apiRef, cellEditingApi, 'EditRowApi');
|
|
177
177
|
const handleCellKeyDown = React.useCallback(async (params, event) => {
|
|
178
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
179
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
180
|
+
if (event.which === 229) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
178
184
|
const {
|
|
179
185
|
id,
|
|
180
186
|
field,
|
|
@@ -108,6 +108,12 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
108
108
|
}, []);
|
|
109
109
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
110
110
|
if (params.cellMode === GridRowModes.Edit) {
|
|
111
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
112
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
113
|
+
if (event.which === 229) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
111
117
|
let reason;
|
|
112
118
|
|
|
113
119
|
if (event.key === 'Escape') {
|
|
@@ -146,7 +152,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
146
152
|
let reason;
|
|
147
153
|
|
|
148
154
|
if (isPrintableKey(event.key)) {
|
|
149
|
-
if (event.
|
|
155
|
+
if (event.ctrlKey && event.key !== 'v' || event.metaKey && event.key !== 'v' || event.altKey) {
|
|
150
156
|
return;
|
|
151
157
|
}
|
|
152
158
|
|
|
@@ -172,6 +172,12 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
172
172
|
};
|
|
173
173
|
useGridApiMethod(apiRef, rowEditingApi, 'EditRowApi');
|
|
174
174
|
const handleCellKeyDown = React.useCallback(async (params, event) => {
|
|
175
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
176
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
177
|
+
if (event.which === 229) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
175
181
|
const {
|
|
176
182
|
cellMode,
|
|
177
183
|
isEditable
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { gridColumnDefinitionsSelector, gridVisibleColumnDefinitionsSelector } from '../columns';
|
|
2
2
|
import { gridFilteredSortedRowIdsSelector } from '../filter';
|
|
3
|
+
import { gridRowTreeSelector } from '../rows/gridRowsSelector';
|
|
3
4
|
export const getColumnsToExport = ({
|
|
4
5
|
apiRef,
|
|
5
6
|
options
|
|
@@ -17,11 +18,13 @@ export const defaultGetRowsToExport = ({
|
|
|
17
18
|
apiRef
|
|
18
19
|
}) => {
|
|
19
20
|
const filteredSortedRowIds = gridFilteredSortedRowIdsSelector(apiRef);
|
|
21
|
+
const rowTree = gridRowTreeSelector(apiRef);
|
|
20
22
|
const selectedRows = apiRef.current.getSelectedRows();
|
|
23
|
+
const bodyRows = filteredSortedRowIds.filter(id => (rowTree[id].position ?? 'body') === 'body');
|
|
21
24
|
|
|
22
25
|
if (selectedRows.size > 0) {
|
|
23
|
-
return
|
|
26
|
+
return bodyRows.filter(id => selectedRows.has(id));
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
return
|
|
29
|
+
return bodyRows;
|
|
27
30
|
};
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { GridLinkOperator } from '../../../models';
|
|
3
3
|
import { buildWarning } from '../../../utils/warning';
|
|
4
4
|
import { gridColumnFieldsSelector, gridColumnLookupSelector } from '../columns';
|
|
5
|
+
import { gridRowTreeSelector } from '../rows/gridRowsSelector';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Adds default values to the optional fields of a filter items.
|
|
@@ -80,6 +81,7 @@ export const buildAggregatedFilterItemsApplier = (filterModel, apiRef) => {
|
|
|
80
81
|
items,
|
|
81
82
|
linkOperator = GridLinkOperator.And
|
|
82
83
|
} = filterModel;
|
|
84
|
+
const tree = gridRowTreeSelector(apiRef);
|
|
83
85
|
|
|
84
86
|
const getFilterCallbackFromItem = filterItem => {
|
|
85
87
|
if (!filterItem.columnField || !filterItem.operatorValue) {
|
|
@@ -141,6 +143,10 @@ export const buildAggregatedFilterItemsApplier = (filterModel, apiRef) => {
|
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
return (rowId, shouldApplyFilter) => {
|
|
146
|
+
if (tree[rowId].position === 'footer') {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
|
|
144
150
|
const filteredAppliers = shouldApplyFilter ? appliers.filter(applier => shouldApplyFilter(applier.item.columnField)) : appliers; // Return `false` as soon as we have a failing filter
|
|
145
151
|
|
|
146
152
|
if (linkOperator === GridLinkOperator.And) {
|
|
@@ -109,7 +109,23 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
109
109
|
|
|
110
110
|
if (targetColumnField) {
|
|
111
111
|
const filterModel = gridFilterModelSelector(apiRef);
|
|
112
|
-
const filterItemsWithValue = filterModel.items.filter(item =>
|
|
112
|
+
const filterItemsWithValue = filterModel.items.filter(item => {
|
|
113
|
+
if (item.value !== undefined) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const column = apiRef.current.getColumn(item.columnField);
|
|
118
|
+
const filterOperator = column.filterOperators?.find(operator => operator.value === item.operatorValue);
|
|
119
|
+
const requiresFilterValue = typeof filterOperator?.requiresFilterValue === 'undefined' ? true : filterOperator?.requiresFilterValue; // Operators like `isEmpty` don't have and don't require `item.value`.
|
|
120
|
+
// So we don't want to remove them from the filter model if `item.value === undefined`.
|
|
121
|
+
// See https://github.com/mui/mui-x/issues/5402
|
|
122
|
+
|
|
123
|
+
if (requiresFilterValue) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return true;
|
|
128
|
+
});
|
|
113
129
|
let newFilterItems;
|
|
114
130
|
const filterItemOnTarget = filterItemsWithValue.find(item => item.columnField === targetColumnField);
|
|
115
131
|
|
|
@@ -188,10 +204,15 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
188
204
|
* PRE-PROCESSING
|
|
189
205
|
*/
|
|
190
206
|
|
|
191
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
207
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
192
208
|
const filterModelToExport = gridFilterModelSelector(apiRef);
|
|
209
|
+
const shouldExportFilterModel = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
210
|
+
!context.exportOnlyDirtyModels || // Always export if the model is controlled
|
|
211
|
+
props.filterModel != null || // Always export if the model has been initialized
|
|
212
|
+
props.initialState?.filter?.filterModel != null || // Export if the model is not equal to the default value
|
|
213
|
+
!isDeepEqual(filterModelToExport, getDefaultGridFilterModel());
|
|
193
214
|
|
|
194
|
-
if (
|
|
215
|
+
if (!shouldExportFilterModel) {
|
|
195
216
|
return prevState;
|
|
196
217
|
}
|
|
197
218
|
|
|
@@ -200,7 +221,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
200
221
|
filterModel: filterModelToExport
|
|
201
222
|
}
|
|
202
223
|
});
|
|
203
|
-
}, [apiRef]);
|
|
224
|
+
}, [apiRef, props.filterModel, props.initialState?.filter?.filterModel]);
|
|
204
225
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
205
226
|
const filterModel = context.stateToRestore.filter?.filterModel;
|
|
206
227
|
|
|
@@ -61,11 +61,12 @@ export const useGridPage = (apiRef, props) => {
|
|
|
61
61
|
* PRE-PROCESSING
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
64
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
65
65
|
const pageToExport = gridPageSelector(apiRef);
|
|
66
|
-
const shouldExportPage = // Always export if the
|
|
66
|
+
const shouldExportPage = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
67
|
+
!context.exportOnlyDirtyModels || // Always export if the page is controlled
|
|
67
68
|
props.page != null || // Always export if the page has been initialized
|
|
68
|
-
props.initialState?.pagination?.page != null || // Export if the page
|
|
69
|
+
props.initialState?.pagination?.page != null || // Export if the page is not equal to the default value
|
|
69
70
|
pageToExport !== 0;
|
|
70
71
|
|
|
71
72
|
if (!shouldExportPage) {
|
|
@@ -47,11 +47,12 @@ export const useGridPageSize = (apiRef, props) => {
|
|
|
47
47
|
* PRE-PROCESSING
|
|
48
48
|
*/
|
|
49
49
|
|
|
50
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
50
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
51
51
|
const pageSizeToExport = gridPageSizeSelector(apiRef);
|
|
52
|
-
const shouldExportPageSize = // Always export if the
|
|
52
|
+
const shouldExportPageSize = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
53
|
+
!context.exportOnlyDirtyModels || // Always export if the page size is controlled
|
|
53
54
|
props.pageSize != null || // Always export if the page size has been initialized
|
|
54
|
-
props.initialState?.pagination?.pageSize != null || // Export if the page size
|
|
55
|
+
props.initialState?.pagination?.pageSize != null || // Export if the page size is not equal to the default value
|
|
55
56
|
pageSizeToExport !== defaultPageSize(props.autoPageSize);
|
|
56
57
|
|
|
57
58
|
if (!shouldExportPageSize) {
|
|
@@ -13,7 +13,7 @@ export const preferencePanelStateInitializer = (state, props) => _extends({}, st
|
|
|
13
13
|
* TODO: Add a single `setPreferencePanel` method to avoid multiple `setState`
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
export const useGridPreferencesPanel = apiRef => {
|
|
16
|
+
export const useGridPreferencesPanel = (apiRef, props) => {
|
|
17
17
|
const logger = useGridLogger(apiRef, 'useGridPreferencesPanel');
|
|
18
18
|
const hideTimeout = React.useRef();
|
|
19
19
|
const immediateTimeout = React.useRef();
|
|
@@ -70,17 +70,21 @@ export const useGridPreferencesPanel = apiRef => {
|
|
|
70
70
|
* PRE-PROCESSING
|
|
71
71
|
*/
|
|
72
72
|
|
|
73
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
73
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
74
74
|
const preferencePanelToExport = gridPreferencePanelStateSelector(apiRef.current.state);
|
|
75
|
+
const shouldExportPreferencePanel = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
76
|
+
!context.exportOnlyDirtyModels || // Always export if the panel was initialized
|
|
77
|
+
props.initialState?.preferencePanel != null || // Always export if the panel is opened
|
|
78
|
+
preferencePanelToExport.open;
|
|
75
79
|
|
|
76
|
-
if (!
|
|
80
|
+
if (!shouldExportPreferencePanel) {
|
|
77
81
|
return prevState;
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
return _extends({}, prevState, {
|
|
81
85
|
preferencePanel: preferencePanelToExport
|
|
82
86
|
});
|
|
83
|
-
}, [apiRef]);
|
|
87
|
+
}, [apiRef, props.initialState?.preferencePanel]);
|
|
84
88
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
85
89
|
const preferencePanel = context.stateToRestore.preferencePanel;
|
|
86
90
|
|
|
@@ -93,7 +93,7 @@ export const useGridRows = (apiRef, props) => {
|
|
|
93
93
|
const updateRows = React.useCallback(updates => {
|
|
94
94
|
if (props.signature === GridSignature.DataGrid && updates.length > 1) {
|
|
95
95
|
// TODO: Add test with direct call to `apiRef.current.updateRows` in DataGrid after enabling the `apiRef` on the free plan.
|
|
96
|
-
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to
|
|
96
|
+
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to DataGridPro or DataGridPremium component to unlock this feature.'].join('\n'));
|
|
97
97
|
} // we remove duplicate updates. A server can batch updates, and send several updates for the same row in one fn call.
|
|
98
98
|
|
|
99
99
|
|
|
@@ -11,7 +11,7 @@ const flatRowTreeCreationMethod = ({
|
|
|
11
11
|
for (let i = 0; i < ids.length; i += 1) {
|
|
12
12
|
const rowId = ids[i];
|
|
13
13
|
|
|
14
|
-
if (previousTree && previousTree[rowId]) {
|
|
14
|
+
if (previousTree && previousTree[rowId] && previousTree[rowId].depth === 0 && previousTree[rowId].parent == null) {
|
|
15
15
|
tree[rowId] = previousTree[rowId];
|
|
16
16
|
} else {
|
|
17
17
|
tree[rowId] = {
|
|
@@ -57,9 +57,9 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
57
57
|
checkboxSelection,
|
|
58
58
|
disableMultipleSelection,
|
|
59
59
|
disableSelectionOnClick,
|
|
60
|
-
isRowSelectable,
|
|
61
60
|
pagination,
|
|
62
|
-
paginationMode
|
|
61
|
+
paginationMode,
|
|
62
|
+
isRowSelectable: propIsRowSelectable
|
|
63
63
|
} = props;
|
|
64
64
|
const canHaveMultipleSelection = !disableMultipleSelection || checkboxSelection;
|
|
65
65
|
const visibleRows = useGridVisibleRows(apiRef, props);
|
|
@@ -106,9 +106,20 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
106
106
|
}
|
|
107
107
|
}, [apiRef, logger]);
|
|
108
108
|
const isRowSelected = React.useCallback(id => gridSelectionStateSelector(apiRef.current.state).includes(id), [apiRef]);
|
|
109
|
+
const isRowSelectable = React.useCallback(id => {
|
|
110
|
+
if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (apiRef.current.getRowNode(id)?.position === 'footer') {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return true;
|
|
119
|
+
}, [apiRef, propIsRowSelectable]);
|
|
109
120
|
const getSelectedRows = React.useCallback(() => selectedGridRowsSelector(apiRef), [apiRef]);
|
|
110
121
|
const selectRow = React.useCallback((id, isSelected = true, resetSelection = false) => {
|
|
111
|
-
if (
|
|
122
|
+
if (!apiRef.current.isRowSelectable(id)) {
|
|
112
123
|
return;
|
|
113
124
|
}
|
|
114
125
|
|
|
@@ -132,10 +143,10 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
132
143
|
apiRef.current.setSelectionModel(newSelection);
|
|
133
144
|
}
|
|
134
145
|
}
|
|
135
|
-
}, [apiRef,
|
|
146
|
+
}, [apiRef, logger, canHaveMultipleSelection]);
|
|
136
147
|
const selectRows = React.useCallback((ids, isSelected = true, resetSelection = false) => {
|
|
137
148
|
logger.debug(`Setting selection for several rows`);
|
|
138
|
-
const selectableIds =
|
|
149
|
+
const selectableIds = ids.filter(id => apiRef.current.isRowSelectable(id));
|
|
139
150
|
let newSelection;
|
|
140
151
|
|
|
141
152
|
if (resetSelection) {
|
|
@@ -159,7 +170,7 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
159
170
|
if (isSelectionValid) {
|
|
160
171
|
apiRef.current.setSelectionModel(newSelection);
|
|
161
172
|
}
|
|
162
|
-
}, [apiRef,
|
|
173
|
+
}, [apiRef, logger, canHaveMultipleSelection]);
|
|
163
174
|
const selectRowRange = React.useCallback(({
|
|
164
175
|
startId,
|
|
165
176
|
endId
|
|
@@ -183,7 +194,8 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
183
194
|
selectRowRange,
|
|
184
195
|
setSelectionModel,
|
|
185
196
|
getSelectedRows,
|
|
186
|
-
isRowSelected
|
|
197
|
+
isRowSelected,
|
|
198
|
+
isRowSelectable
|
|
187
199
|
};
|
|
188
200
|
useGridApiMethod(apiRef, selectionApi, 'GridSelectionApi');
|
|
189
201
|
/**
|
|
@@ -363,13 +375,13 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
363
375
|
React.useEffect(() => {
|
|
364
376
|
if (isStateControlled) {
|
|
365
377
|
return;
|
|
366
|
-
} // isRowSelectable changed
|
|
378
|
+
} // props.isRowSelectable changed
|
|
367
379
|
|
|
368
380
|
|
|
369
381
|
const currentSelection = gridSelectionStateSelector(apiRef.current.state);
|
|
370
382
|
|
|
371
383
|
if (isRowSelectable) {
|
|
372
|
-
const newSelection = currentSelection.filter(id => isRowSelectable(
|
|
384
|
+
const newSelection = currentSelection.filter(id => isRowSelectable(id));
|
|
373
385
|
|
|
374
386
|
if (newSelection.length < currentSelection.length) {
|
|
375
387
|
apiRef.current.setSelectionModel(newSelection);
|
|
@@ -396,7 +408,7 @@ export const useGridSelection = (apiRef, props) => {
|
|
|
396
408
|
let isSelectable = true;
|
|
397
409
|
|
|
398
410
|
if (isRowSelectable) {
|
|
399
|
-
isSelectable = isRowSelectable(
|
|
411
|
+
isSelectable = isRowSelectable(id);
|
|
400
412
|
}
|
|
401
413
|
|
|
402
414
|
return isSelectable && currentPageRowsLookup[id]; // Check if the row is in the current page
|
|
@@ -46,25 +46,24 @@ const parseSortItem = (sortItem, apiRef) => {
|
|
|
46
46
|
comparator
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
|
+
|
|
49
50
|
/**
|
|
50
51
|
* Compare two rows according to a list of valid sort items.
|
|
51
52
|
* The `row1Params` and `row2Params` must have the same length as `parsedSortItems`,
|
|
52
53
|
* and each of their index must contain the `GridSortCellParams` of the sort item with the same index.
|
|
53
54
|
* @param {GridParsedSortItem[]} parsedSortItems All the sort items with which we want to compare the rows.
|
|
54
|
-
* @param {
|
|
55
|
-
* @param {
|
|
55
|
+
* @param {GridRowAggregatedSortingParams} row1 The node and params of the 1st row for each sort item.
|
|
56
|
+
* @param {GridRowAggregatedSortingParams} row2 The node and params of the 2nd row for each sort item.
|
|
56
57
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const compareRows = (parsedSortItems, row1Params, row2Params) => {
|
|
58
|
+
const compareRows = (parsedSortItems, row1, row2) => {
|
|
60
59
|
return parsedSortItems.reduce((res, item, index) => {
|
|
61
60
|
if (res !== 0) {
|
|
62
61
|
// return the results of the first comparator which distinguish the two rows
|
|
63
62
|
return res;
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
const sortCellParams1 =
|
|
67
|
-
const sortCellParams2 =
|
|
65
|
+
const sortCellParams1 = row1.params[index];
|
|
66
|
+
const sortCellParams2 = row2.params[index];
|
|
68
67
|
res = item.comparator(sortCellParams1.value, sortCellParams2.value, sortCellParams1, sortCellParams2);
|
|
69
68
|
return res;
|
|
70
69
|
}, 0);
|
|
@@ -84,10 +83,10 @@ export const buildAggregatedSortingApplier = (sortModel, apiRef) => {
|
|
|
84
83
|
return null;
|
|
85
84
|
}
|
|
86
85
|
|
|
87
|
-
return rowList => rowList.map(
|
|
88
|
-
|
|
89
|
-
params: comparatorList.map(el => el.getSortCellParams(
|
|
90
|
-
})).sort((a, b) => compareRows(comparatorList, a
|
|
86
|
+
return rowList => rowList.map(node => ({
|
|
87
|
+
node,
|
|
88
|
+
params: comparatorList.map(el => el.getSortCellParams(node.id))
|
|
89
|
+
})).sort((a, b) => compareRows(comparatorList, a, b)).map(row => row.node.id);
|
|
91
90
|
};
|
|
92
91
|
export const getNextGridSortDirection = (sortingOrder, current) => {
|
|
93
92
|
const currentIdx = sortingOrder.indexOf(current);
|