@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
|
@@ -23,7 +23,9 @@ var _GridToolbarExportContainer = require("./GridToolbarExportContainer");
|
|
|
23
23
|
|
|
24
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
|
|
26
|
-
const _excluded = ["
|
|
26
|
+
const _excluded = ["hideMenu", "options"],
|
|
27
|
+
_excluded2 = ["hideMenu", "options"],
|
|
28
|
+
_excluded3 = ["csvOptions", "printOptions", "excelOptions"];
|
|
27
29
|
|
|
28
30
|
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); }
|
|
29
31
|
|
|
@@ -34,14 +36,16 @@ const GridCsvExportMenuItem = props => {
|
|
|
34
36
|
const {
|
|
35
37
|
hideMenu,
|
|
36
38
|
options
|
|
37
|
-
} = props
|
|
38
|
-
|
|
39
|
+
} = props,
|
|
40
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, (0, _extends2.default)({
|
|
39
42
|
onClick: () => {
|
|
40
43
|
apiRef.current.exportDataAsCsv(options);
|
|
41
44
|
hideMenu == null ? void 0 : hideMenu();
|
|
42
|
-
}
|
|
45
|
+
}
|
|
46
|
+
}, other, {
|
|
43
47
|
children: apiRef.current.getLocaleText('toolbarExportCSV')
|
|
44
|
-
});
|
|
48
|
+
}));
|
|
45
49
|
};
|
|
46
50
|
|
|
47
51
|
exports.GridCsvExportMenuItem = GridCsvExportMenuItem;
|
|
@@ -51,14 +55,16 @@ const GridPrintExportMenuItem = props => {
|
|
|
51
55
|
const {
|
|
52
56
|
hideMenu,
|
|
53
57
|
options
|
|
54
|
-
} = props
|
|
55
|
-
|
|
58
|
+
} = props,
|
|
59
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded2);
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, (0, _extends2.default)({
|
|
56
61
|
onClick: () => {
|
|
57
62
|
apiRef.current.exportDataAsPrint(options);
|
|
58
63
|
hideMenu == null ? void 0 : hideMenu();
|
|
59
|
-
}
|
|
64
|
+
}
|
|
65
|
+
}, other, {
|
|
60
66
|
children: apiRef.current.getLocaleText('toolbarExportPrint')
|
|
61
|
-
});
|
|
67
|
+
}));
|
|
62
68
|
};
|
|
63
69
|
|
|
64
70
|
exports.GridPrintExportMenuItem = GridPrintExportMenuItem;
|
|
@@ -68,7 +74,7 @@ const GridToolbarExport = /*#__PURE__*/React.forwardRef(function GridToolbarExpo
|
|
|
68
74
|
printOptions = {},
|
|
69
75
|
excelOptions
|
|
70
76
|
} = props,
|
|
71
|
-
other = (0, _objectWithoutPropertiesLoose2.default)(props,
|
|
77
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded3);
|
|
72
78
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
73
79
|
const preProcessedButtons = apiRef.current.unstable_applyPipeProcessors('exportMenu', [], {
|
|
74
80
|
excelOptions,
|
|
@@ -12,5 +12,5 @@ function getDataGridUtilityClass(slot) {
|
|
|
12
12
|
return (0, _material.generateUtilityClass)('MuiDataGrid', slot);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const gridClasses = (0, _material.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']);
|
|
15
|
+
const gridClasses = (0, _material.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']);
|
|
16
16
|
exports.gridClasses = gridClasses;
|
|
@@ -117,6 +117,13 @@ const GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
117
117
|
// Used core components translation keys
|
|
118
118
|
MuiTablePagination: {},
|
|
119
119
|
// Row reordering text
|
|
120
|
-
rowReorderingHeaderName: 'Row reordering'
|
|
120
|
+
rowReorderingHeaderName: 'Row reordering',
|
|
121
|
+
// Aggregation
|
|
122
|
+
aggregationMenuItemHeader: 'Aggregation',
|
|
123
|
+
aggregationFunctionLabelSum: 'sum',
|
|
124
|
+
aggregationFunctionLabelAvg: 'avg',
|
|
125
|
+
aggregationFunctionLabelMin: 'min',
|
|
126
|
+
aggregationFunctionLabelMax: 'max',
|
|
127
|
+
aggregationFunctionLabelSize: 'size'
|
|
121
128
|
};
|
|
122
129
|
exports.GRID_DEFAULT_LOCALE_TEXT = GRID_DEFAULT_LOCALE_TEXT;
|
|
@@ -41,11 +41,11 @@ const useGridColumnSpanning = apiRef => {
|
|
|
41
41
|
columnIndex,
|
|
42
42
|
rowId,
|
|
43
43
|
minFirstColumnIndex,
|
|
44
|
-
maxLastColumnIndex
|
|
44
|
+
maxLastColumnIndex,
|
|
45
|
+
columns
|
|
45
46
|
} = params;
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const column = visibleColumns[columnIndex];
|
|
47
|
+
const columnsLength = columns.length;
|
|
48
|
+
const column = columns[columnIndex];
|
|
49
49
|
const colSpan = typeof column.colSpan === 'function' ? column.colSpan(apiRef.current.getCellParams(rowId, column.field)) : column.colSpan;
|
|
50
50
|
|
|
51
51
|
if (!colSpan || colSpan === 1) {
|
|
@@ -67,7 +67,7 @@ const useGridColumnSpanning = apiRef => {
|
|
|
67
67
|
const nextColumnIndex = columnIndex + j; // Cells should be spanned only within their column section (left-pinned, right-pinned and unpinned).
|
|
68
68
|
|
|
69
69
|
if (nextColumnIndex >= minFirstColumnIndex && nextColumnIndex < maxLastColumnIndex) {
|
|
70
|
-
const nextColumn =
|
|
70
|
+
const nextColumn = columns[nextColumnIndex];
|
|
71
71
|
width += nextColumn.computedWidth;
|
|
72
72
|
setCellColSpanInfo(rowId, columnIndex + j, {
|
|
73
73
|
spannedByColSpan: true,
|
|
@@ -93,14 +93,16 @@ const useGridColumnSpanning = apiRef => {
|
|
|
93
93
|
const calculateColSpan = React.useCallback(({
|
|
94
94
|
rowId,
|
|
95
95
|
minFirstColumn,
|
|
96
|
-
maxLastColumn
|
|
96
|
+
maxLastColumn,
|
|
97
|
+
columns
|
|
97
98
|
}) => {
|
|
98
99
|
for (let i = minFirstColumn; i < maxLastColumn; i += 1) {
|
|
99
100
|
const cellProps = calculateCellColSpan({
|
|
100
101
|
columnIndex: i,
|
|
101
102
|
rowId,
|
|
102
103
|
minFirstColumnIndex: minFirstColumn,
|
|
103
|
-
maxLastColumnIndex: maxLastColumn
|
|
104
|
+
maxLastColumnIndex: maxLastColumn,
|
|
105
|
+
columns
|
|
104
106
|
});
|
|
105
107
|
|
|
106
108
|
if (cellProps.colSpan > 1) {
|
|
@@ -63,7 +63,7 @@ const columnsStateInitializer = (state, props, apiRef) => {
|
|
|
63
63
|
exports.columnsStateInitializer = columnsStateInitializer;
|
|
64
64
|
|
|
65
65
|
function useGridColumns(apiRef, props) {
|
|
66
|
-
var _props$componentsProp2;
|
|
66
|
+
var _props$initialState5, _props$componentsProp2;
|
|
67
67
|
|
|
68
68
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridColumns');
|
|
69
69
|
const columnTypes = React.useMemo(() => (0, _gridColumnsUtils.computeColumnTypes)(props.columnTypes), [props.columnTypes]);
|
|
@@ -214,14 +214,21 @@ function useGridColumns(apiRef, props) {
|
|
|
214
214
|
* PRE-PROCESSING
|
|
215
215
|
*/
|
|
216
216
|
|
|
217
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
217
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
218
218
|
const columnsStateToExport = {};
|
|
219
219
|
|
|
220
220
|
if (apiRef.current.unstable_caches.columns.isUsingColumnVisibilityModel) {
|
|
221
|
-
|
|
222
|
-
const hasHiddenColumns = Object.values(columnVisibilityModelToExport).some(value => value === false);
|
|
221
|
+
var _props$initialState$c2, _props$initialState4, _props$initialState4$;
|
|
223
222
|
|
|
224
|
-
|
|
223
|
+
const columnVisibilityModelToExport = (0, _gridColumnsSelector.gridColumnVisibilityModelSelector)(apiRef);
|
|
224
|
+
const shouldExportColumnVisibilityModel = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
225
|
+
!context.exportOnlyDirtyModels || // Always export if the model is controlled
|
|
226
|
+
props.columnVisibilityModel != null || // Always export if the model has been initialized
|
|
227
|
+
// TODO v6 Do a nullish check instead to export even if the initial model equals "{}"
|
|
228
|
+
Object.keys((_props$initialState$c2 = (_props$initialState4 = props.initialState) == null ? void 0 : (_props$initialState4$ = _props$initialState4.columns) == null ? void 0 : _props$initialState4$.columnVisibilityModel) != null ? _props$initialState$c2 : {}).length > 0 || // Always export if the model is not empty
|
|
229
|
+
Object.keys(columnVisibilityModelToExport).length > 0;
|
|
230
|
+
|
|
231
|
+
if (shouldExportColumnVisibilityModel) {
|
|
225
232
|
columnsStateToExport.columnVisibilityModel = columnVisibilityModelToExport;
|
|
226
233
|
}
|
|
227
234
|
}
|
|
@@ -254,7 +261,7 @@ function useGridColumns(apiRef, props) {
|
|
|
254
261
|
return (0, _extends2.default)({}, prevState, {
|
|
255
262
|
columns: columnsStateToExport
|
|
256
263
|
});
|
|
257
|
-
}, [apiRef]);
|
|
264
|
+
}, [apiRef, props.columnVisibilityModel, (_props$initialState5 = props.initialState) == null ? void 0 : _props$initialState5.columns]);
|
|
258
265
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
259
266
|
var _context$stateToResto;
|
|
260
267
|
|
|
@@ -92,21 +92,34 @@ function useGridDimensions(apiRef, props) {
|
|
|
92
92
|
rootElement.removeChild(scrollDiv);
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
95
|
+
let viewportOuterSize;
|
|
96
|
+
let hasScrollX;
|
|
97
|
+
let hasScrollY;
|
|
98
|
+
|
|
99
|
+
if (props.autoHeight) {
|
|
100
|
+
hasScrollY = false;
|
|
101
|
+
hasScrollX = Math.round(columnsTotalWidth) > rootDimensionsRef.current.width;
|
|
102
|
+
viewportOuterSize = {
|
|
103
|
+
width: rootDimensionsRef.current.width,
|
|
104
|
+
height: rowsMeta.currentPageTotalHeight + (hasScrollX ? scrollBarSize : 0)
|
|
105
|
+
};
|
|
106
|
+
} else {
|
|
107
|
+
viewportOuterSize = {
|
|
108
|
+
width: rootDimensionsRef.current.width,
|
|
109
|
+
height: rootDimensionsRef.current.height - headerHeight
|
|
110
|
+
};
|
|
111
|
+
const scrollInformation = hasScroll({
|
|
112
|
+
content: {
|
|
113
|
+
width: Math.round(columnsTotalWidth),
|
|
114
|
+
height: rowsMeta.currentPageTotalHeight
|
|
115
|
+
},
|
|
116
|
+
container: viewportOuterSize,
|
|
117
|
+
scrollBarSize
|
|
118
|
+
});
|
|
119
|
+
hasScrollY = scrollInformation.hasScrollY;
|
|
120
|
+
hasScrollX = scrollInformation.hasScrollX;
|
|
121
|
+
}
|
|
122
|
+
|
|
110
123
|
const viewportInnerSize = {
|
|
111
124
|
width: viewportOuterSize.width - (hasScrollY ? scrollBarSize : 0),
|
|
112
125
|
height: viewportOuterSize.height - (hasScrollX ? scrollBarSize : 0)
|
|
@@ -95,6 +95,12 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
95
95
|
}, [apiRef]);
|
|
96
96
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
97
97
|
if (params.cellMode === _gridEditRowModel.GridCellModes.Edit) {
|
|
98
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
99
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
100
|
+
if (event.which === 229) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
98
104
|
let reason;
|
|
99
105
|
|
|
100
106
|
if (event.key === 'Escape') {
|
|
@@ -116,7 +122,7 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
116
122
|
let reason;
|
|
117
123
|
|
|
118
124
|
if ((0, _keyboardUtils.isPrintableKey)(event.key)) {
|
|
119
|
-
if (event.
|
|
125
|
+
if (event.ctrlKey && event.key !== 'v' || event.metaKey && event.key !== 'v' || event.altKey) {
|
|
120
126
|
return;
|
|
121
127
|
}
|
|
122
128
|
|
|
@@ -199,6 +199,12 @@ const useCellEditing = (apiRef, props) => {
|
|
|
199
199
|
};
|
|
200
200
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, cellEditingApi, 'EditRowApi');
|
|
201
201
|
const handleCellKeyDown = React.useCallback(async (params, event) => {
|
|
202
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
203
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
204
|
+
if (event.which === 229) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
202
208
|
const {
|
|
203
209
|
id,
|
|
204
210
|
field,
|
|
@@ -134,6 +134,12 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
134
134
|
}, []);
|
|
135
135
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
136
136
|
if (params.cellMode === _gridEditRowModel.GridRowModes.Edit) {
|
|
137
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
138
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
139
|
+
if (event.which === 229) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
137
143
|
let reason;
|
|
138
144
|
|
|
139
145
|
if (event.key === 'Escape') {
|
|
@@ -170,7 +176,7 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
170
176
|
let reason;
|
|
171
177
|
|
|
172
178
|
if ((0, _keyboardUtils.isPrintableKey)(event.key)) {
|
|
173
|
-
if (event.
|
|
179
|
+
if (event.ctrlKey && event.key !== 'v' || event.metaKey && event.key !== 'v' || event.altKey) {
|
|
174
180
|
return;
|
|
175
181
|
}
|
|
176
182
|
|
|
@@ -199,6 +199,12 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
199
199
|
};
|
|
200
200
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, rowEditingApi, 'EditRowApi');
|
|
201
201
|
const handleCellKeyDown = React.useCallback(async (params, event) => {
|
|
202
|
+
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
203
|
+
// TODO: `event.which` is depricated but this is a temporary workaround
|
|
204
|
+
if (event.which === 229) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
202
208
|
const {
|
|
203
209
|
cellMode,
|
|
204
210
|
isEditable
|
|
@@ -9,6 +9,8 @@ var _columns = require("../columns");
|
|
|
9
9
|
|
|
10
10
|
var _filter = require("../filter");
|
|
11
11
|
|
|
12
|
+
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
13
|
+
|
|
12
14
|
const getColumnsToExport = ({
|
|
13
15
|
apiRef,
|
|
14
16
|
options
|
|
@@ -29,13 +31,19 @@ const defaultGetRowsToExport = ({
|
|
|
29
31
|
apiRef
|
|
30
32
|
}) => {
|
|
31
33
|
const filteredSortedRowIds = (0, _filter.gridFilteredSortedRowIdsSelector)(apiRef);
|
|
34
|
+
const rowTree = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef);
|
|
32
35
|
const selectedRows = apiRef.current.getSelectedRows();
|
|
36
|
+
const bodyRows = filteredSortedRowIds.filter(id => {
|
|
37
|
+
var _rowTree$id$position;
|
|
38
|
+
|
|
39
|
+
return ((_rowTree$id$position = rowTree[id].position) != null ? _rowTree$id$position : 'body') === 'body';
|
|
40
|
+
});
|
|
33
41
|
|
|
34
42
|
if (selectedRows.size > 0) {
|
|
35
|
-
return
|
|
43
|
+
return bodyRows.filter(id => selectedRows.has(id));
|
|
36
44
|
}
|
|
37
45
|
|
|
38
|
-
return
|
|
46
|
+
return bodyRows;
|
|
39
47
|
};
|
|
40
48
|
|
|
41
49
|
exports.defaultGetRowsToExport = defaultGetRowsToExport;
|
|
@@ -15,6 +15,8 @@ var _warning = require("../../../utils/warning");
|
|
|
15
15
|
|
|
16
16
|
var _columns = require("../columns");
|
|
17
17
|
|
|
18
|
+
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
21
|
* Adds default values to the optional fields of a filter items.
|
|
20
22
|
* @param {GridFilterItem} item The raw filter item.
|
|
@@ -101,6 +103,7 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef) => {
|
|
|
101
103
|
items,
|
|
102
104
|
linkOperator = _models.GridLinkOperator.And
|
|
103
105
|
} = filterModel;
|
|
106
|
+
const tree = (0, _gridRowsSelector.gridRowTreeSelector)(apiRef);
|
|
104
107
|
|
|
105
108
|
const getFilterCallbackFromItem = filterItem => {
|
|
106
109
|
if (!filterItem.columnField || !filterItem.operatorValue) {
|
|
@@ -163,6 +166,10 @@ const buildAggregatedFilterItemsApplier = (filterModel, apiRef) => {
|
|
|
163
166
|
}
|
|
164
167
|
|
|
165
168
|
return (rowId, shouldApplyFilter) => {
|
|
169
|
+
if (tree[rowId].position === 'footer') {
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
172
|
+
|
|
166
173
|
const filteredAppliers = shouldApplyFilter ? appliers.filter(applier => shouldApplyFilter(applier.item.columnField)) : appliers; // Return `false` as soon as we have a failing filter
|
|
167
174
|
|
|
168
175
|
if (linkOperator === _models.GridLinkOperator.And) {
|
|
@@ -67,7 +67,7 @@ const filterStateInitializer = (state, props, apiRef) => {
|
|
|
67
67
|
exports.filterStateInitializer = filterStateInitializer;
|
|
68
68
|
|
|
69
69
|
const useGridFilter = (apiRef, props) => {
|
|
70
|
-
var _props$componentsProp2;
|
|
70
|
+
var _props$initialState3, _props$initialState3$, _props$componentsProp2;
|
|
71
71
|
|
|
72
72
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridFilter');
|
|
73
73
|
apiRef.current.unstable_registerControlState({
|
|
@@ -146,7 +146,25 @@ const useGridFilter = (apiRef, props) => {
|
|
|
146
146
|
|
|
147
147
|
if (targetColumnField) {
|
|
148
148
|
const filterModel = (0, _gridFilterSelector.gridFilterModelSelector)(apiRef);
|
|
149
|
-
const filterItemsWithValue = filterModel.items.filter(item =>
|
|
149
|
+
const filterItemsWithValue = filterModel.items.filter(item => {
|
|
150
|
+
var _column$filterOperato;
|
|
151
|
+
|
|
152
|
+
if (item.value !== undefined) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const column = apiRef.current.getColumn(item.columnField);
|
|
157
|
+
const filterOperator = (_column$filterOperato = column.filterOperators) == null ? void 0 : _column$filterOperato.find(operator => operator.value === item.operatorValue);
|
|
158
|
+
const requiresFilterValue = typeof (filterOperator == null ? void 0 : filterOperator.requiresFilterValue) === 'undefined' ? true : filterOperator == null ? void 0 : filterOperator.requiresFilterValue; // Operators like `isEmpty` don't have and don't require `item.value`.
|
|
159
|
+
// So we don't want to remove them from the filter model if `item.value === undefined`.
|
|
160
|
+
// See https://github.com/mui/mui-x/issues/5402
|
|
161
|
+
|
|
162
|
+
if (requiresFilterValue) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return true;
|
|
167
|
+
});
|
|
150
168
|
let newFilterItems;
|
|
151
169
|
const filterItemOnTarget = filterItemsWithValue.find(item => item.columnField === targetColumnField);
|
|
152
170
|
|
|
@@ -225,10 +243,17 @@ const useGridFilter = (apiRef, props) => {
|
|
|
225
243
|
* PRE-PROCESSING
|
|
226
244
|
*/
|
|
227
245
|
|
|
228
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
246
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
247
|
+
var _props$initialState2, _props$initialState2$;
|
|
248
|
+
|
|
229
249
|
const filterModelToExport = (0, _gridFilterSelector.gridFilterModelSelector)(apiRef);
|
|
250
|
+
const shouldExportFilterModel = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
251
|
+
!context.exportOnlyDirtyModels || // Always export if the model is controlled
|
|
252
|
+
props.filterModel != null || // Always export if the model has been initialized
|
|
253
|
+
((_props$initialState2 = props.initialState) == null ? void 0 : (_props$initialState2$ = _props$initialState2.filter) == null ? void 0 : _props$initialState2$.filterModel) != null || // Export if the model is not equal to the default value
|
|
254
|
+
!(0, _utils.isDeepEqual)(filterModelToExport, (0, _gridFilterState.getDefaultGridFilterModel)());
|
|
230
255
|
|
|
231
|
-
if (
|
|
256
|
+
if (!shouldExportFilterModel) {
|
|
232
257
|
return prevState;
|
|
233
258
|
}
|
|
234
259
|
|
|
@@ -237,7 +262,7 @@ const useGridFilter = (apiRef, props) => {
|
|
|
237
262
|
filterModel: filterModelToExport
|
|
238
263
|
}
|
|
239
264
|
});
|
|
240
|
-
}, [apiRef]);
|
|
265
|
+
}, [apiRef, props.filterModel, (_props$initialState3 = props.initialState) == null ? void 0 : (_props$initialState3$ = _props$initialState3.filter) == null ? void 0 : _props$initialState3$.filterModel]);
|
|
241
266
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
242
267
|
var _context$stateToResto;
|
|
243
268
|
|
|
@@ -85,13 +85,14 @@ const useGridPage = (apiRef, props) => {
|
|
|
85
85
|
* PRE-PROCESSING
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
88
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
89
89
|
var _props$initialState, _props$initialState$p;
|
|
90
90
|
|
|
91
91
|
const pageToExport = (0, _gridPaginationSelector.gridPageSelector)(apiRef);
|
|
92
|
-
const shouldExportPage = // Always export if the
|
|
92
|
+
const shouldExportPage = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
93
|
+
!context.exportOnlyDirtyModels || // Always export if the page is controlled
|
|
93
94
|
props.page != null || // Always export if the page has been initialized
|
|
94
|
-
((_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$p = _props$initialState.pagination) == null ? void 0 : _props$initialState$p.page) != null || // Export if the page
|
|
95
|
+
((_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$p = _props$initialState.pagination) == null ? void 0 : _props$initialState$p.page) != null || // Export if the page is not equal to the default value
|
|
95
96
|
pageToExport !== 0;
|
|
96
97
|
|
|
97
98
|
if (!shouldExportPage) {
|
|
@@ -70,13 +70,14 @@ const useGridPageSize = (apiRef, props) => {
|
|
|
70
70
|
* PRE-PROCESSING
|
|
71
71
|
*/
|
|
72
72
|
|
|
73
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
73
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
74
74
|
var _props$initialState, _props$initialState$p;
|
|
75
75
|
|
|
76
76
|
const pageSizeToExport = (0, _gridPaginationSelector.gridPageSizeSelector)(apiRef);
|
|
77
|
-
const shouldExportPageSize = // Always export if the
|
|
77
|
+
const shouldExportPageSize = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
78
|
+
!context.exportOnlyDirtyModels || // Always export if the page size is controlled
|
|
78
79
|
props.pageSize != null || // Always export if the page size has been initialized
|
|
79
|
-
((_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$p = _props$initialState.pagination) == null ? void 0 : _props$initialState$p.pageSize) != null || // Export if the page size
|
|
80
|
+
((_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$p = _props$initialState.pagination) == null ? void 0 : _props$initialState$p.pageSize) != null || // Export if the page size is not equal to the default value
|
|
80
81
|
pageSizeToExport !== defaultPageSize(props.autoPageSize);
|
|
81
82
|
|
|
82
83
|
if (!shouldExportPageSize) {
|
|
@@ -39,7 +39,9 @@ const preferencePanelStateInitializer = (state, props) => {
|
|
|
39
39
|
|
|
40
40
|
exports.preferencePanelStateInitializer = preferencePanelStateInitializer;
|
|
41
41
|
|
|
42
|
-
const useGridPreferencesPanel = apiRef => {
|
|
42
|
+
const useGridPreferencesPanel = (apiRef, props) => {
|
|
43
|
+
var _props$initialState3;
|
|
44
|
+
|
|
43
45
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridPreferencesPanel');
|
|
44
46
|
const hideTimeout = React.useRef();
|
|
45
47
|
const immediateTimeout = React.useRef();
|
|
@@ -96,17 +98,23 @@ const useGridPreferencesPanel = apiRef => {
|
|
|
96
98
|
* PRE-PROCESSING
|
|
97
99
|
*/
|
|
98
100
|
|
|
99
|
-
const stateExportPreProcessing = React.useCallback(prevState => {
|
|
101
|
+
const stateExportPreProcessing = React.useCallback((prevState, context) => {
|
|
102
|
+
var _props$initialState2;
|
|
103
|
+
|
|
100
104
|
const preferencePanelToExport = (0, _gridPreferencePanelSelector.gridPreferencePanelStateSelector)(apiRef.current.state);
|
|
105
|
+
const shouldExportPreferencePanel = // Always export if the `exportOnlyDirtyModels` property is activated
|
|
106
|
+
!context.exportOnlyDirtyModels || // Always export if the panel was initialized
|
|
107
|
+
((_props$initialState2 = props.initialState) == null ? void 0 : _props$initialState2.preferencePanel) != null || // Always export if the panel is opened
|
|
108
|
+
preferencePanelToExport.open;
|
|
101
109
|
|
|
102
|
-
if (!
|
|
110
|
+
if (!shouldExportPreferencePanel) {
|
|
103
111
|
return prevState;
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
return (0, _extends2.default)({}, prevState, {
|
|
107
115
|
preferencePanel: preferencePanelToExport
|
|
108
116
|
});
|
|
109
|
-
}, [apiRef]);
|
|
117
|
+
}, [apiRef, (_props$initialState3 = props.initialState) == null ? void 0 : _props$initialState3.preferencePanel]);
|
|
110
118
|
const stateRestorePreProcessing = React.useCallback((params, context) => {
|
|
111
119
|
const preferencePanel = context.stateToRestore.preferencePanel;
|
|
112
120
|
|
|
@@ -124,7 +124,7 @@ const useGridRows = (apiRef, props) => {
|
|
|
124
124
|
const updateRows = React.useCallback(updates => {
|
|
125
125
|
if (props.signature === _useGridApiEventHandler.GridSignature.DataGrid && updates.length > 1) {
|
|
126
126
|
// TODO: Add test with direct call to `apiRef.current.updateRows` in DataGrid after enabling the `apiRef` on the free plan.
|
|
127
|
-
throw new Error(["MUI: You can't update several rows at once in `apiRef.current.updateRows` on the DataGrid.", 'You need to upgrade to
|
|
127
|
+
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'));
|
|
128
128
|
} // we remove duplicate updates. A server can batch updates, and send several updates for the same row in one fn call.
|
|
129
129
|
|
|
130
130
|
|
|
@@ -18,7 +18,7 @@ const flatRowTreeCreationMethod = ({
|
|
|
18
18
|
for (let i = 0; i < ids.length; i += 1) {
|
|
19
19
|
const rowId = ids[i];
|
|
20
20
|
|
|
21
|
-
if (previousTree && previousTree[rowId]) {
|
|
21
|
+
if (previousTree && previousTree[rowId] && previousTree[rowId].depth === 0 && previousTree[rowId].parent == null) {
|
|
22
22
|
tree[rowId] = previousTree[rowId];
|
|
23
23
|
} else {
|
|
24
24
|
tree[rowId] = {
|
|
@@ -91,9 +91,9 @@ const useGridSelection = (apiRef, props) => {
|
|
|
91
91
|
checkboxSelection,
|
|
92
92
|
disableMultipleSelection,
|
|
93
93
|
disableSelectionOnClick,
|
|
94
|
-
isRowSelectable,
|
|
95
94
|
pagination,
|
|
96
|
-
paginationMode
|
|
95
|
+
paginationMode,
|
|
96
|
+
isRowSelectable: propIsRowSelectable
|
|
97
97
|
} = props;
|
|
98
98
|
const canHaveMultipleSelection = !disableMultipleSelection || checkboxSelection;
|
|
99
99
|
const visibleRows = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, props);
|
|
@@ -142,9 +142,22 @@ const useGridSelection = (apiRef, props) => {
|
|
|
142
142
|
}
|
|
143
143
|
}, [apiRef, logger]);
|
|
144
144
|
const isRowSelected = React.useCallback(id => (0, _gridSelectionSelector.gridSelectionStateSelector)(apiRef.current.state).includes(id), [apiRef]);
|
|
145
|
+
const isRowSelectable = React.useCallback(id => {
|
|
146
|
+
var _apiRef$current$getRo;
|
|
147
|
+
|
|
148
|
+
if (propIsRowSelectable && !propIsRowSelectable(apiRef.current.getRowParams(id))) {
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (((_apiRef$current$getRo = apiRef.current.getRowNode(id)) == null ? void 0 : _apiRef$current$getRo.position) === 'footer') {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return true;
|
|
157
|
+
}, [apiRef, propIsRowSelectable]);
|
|
145
158
|
const getSelectedRows = React.useCallback(() => (0, _gridSelectionSelector.selectedGridRowsSelector)(apiRef), [apiRef]);
|
|
146
159
|
const selectRow = React.useCallback((id, isSelected = true, resetSelection = false) => {
|
|
147
|
-
if (
|
|
160
|
+
if (!apiRef.current.isRowSelectable(id)) {
|
|
148
161
|
return;
|
|
149
162
|
}
|
|
150
163
|
|
|
@@ -168,10 +181,10 @@ const useGridSelection = (apiRef, props) => {
|
|
|
168
181
|
apiRef.current.setSelectionModel(newSelection);
|
|
169
182
|
}
|
|
170
183
|
}
|
|
171
|
-
}, [apiRef,
|
|
184
|
+
}, [apiRef, logger, canHaveMultipleSelection]);
|
|
172
185
|
const selectRows = React.useCallback((ids, isSelected = true, resetSelection = false) => {
|
|
173
186
|
logger.debug(`Setting selection for several rows`);
|
|
174
|
-
const selectableIds =
|
|
187
|
+
const selectableIds = ids.filter(id => apiRef.current.isRowSelectable(id));
|
|
175
188
|
let newSelection;
|
|
176
189
|
|
|
177
190
|
if (resetSelection) {
|
|
@@ -194,7 +207,7 @@ const useGridSelection = (apiRef, props) => {
|
|
|
194
207
|
if (isSelectionValid) {
|
|
195
208
|
apiRef.current.setSelectionModel(newSelection);
|
|
196
209
|
}
|
|
197
|
-
}, [apiRef,
|
|
210
|
+
}, [apiRef, logger, canHaveMultipleSelection]);
|
|
198
211
|
const selectRowRange = React.useCallback(({
|
|
199
212
|
startId,
|
|
200
213
|
endId
|
|
@@ -218,7 +231,8 @@ const useGridSelection = (apiRef, props) => {
|
|
|
218
231
|
selectRowRange,
|
|
219
232
|
setSelectionModel,
|
|
220
233
|
getSelectedRows,
|
|
221
|
-
isRowSelected
|
|
234
|
+
isRowSelected,
|
|
235
|
+
isRowSelectable
|
|
222
236
|
};
|
|
223
237
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, selectionApi, 'GridSelectionApi');
|
|
224
238
|
/**
|
|
@@ -399,13 +413,13 @@ const useGridSelection = (apiRef, props) => {
|
|
|
399
413
|
React.useEffect(() => {
|
|
400
414
|
if (isStateControlled) {
|
|
401
415
|
return;
|
|
402
|
-
} // isRowSelectable changed
|
|
416
|
+
} // props.isRowSelectable changed
|
|
403
417
|
|
|
404
418
|
|
|
405
419
|
const currentSelection = (0, _gridSelectionSelector.gridSelectionStateSelector)(apiRef.current.state);
|
|
406
420
|
|
|
407
421
|
if (isRowSelectable) {
|
|
408
|
-
const newSelection = currentSelection.filter(id => isRowSelectable(
|
|
422
|
+
const newSelection = currentSelection.filter(id => isRowSelectable(id));
|
|
409
423
|
|
|
410
424
|
if (newSelection.length < currentSelection.length) {
|
|
411
425
|
apiRef.current.setSelectionModel(newSelection);
|
|
@@ -432,7 +446,7 @@ const useGridSelection = (apiRef, props) => {
|
|
|
432
446
|
let isSelectable = true;
|
|
433
447
|
|
|
434
448
|
if (isRowSelectable) {
|
|
435
|
-
isSelectable = isRowSelectable(
|
|
449
|
+
isSelectable = isRowSelectable(id);
|
|
436
450
|
}
|
|
437
451
|
|
|
438
452
|
return isSelectable && currentPageRowsLookup[id]; // Check if the row is in the current page
|