@mui/x-data-grid 6.0.0-alpha.2 → 6.0.0-alpha.4
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 +493 -141
- package/DataGrid/DataGrid.js +14 -34
- package/DataGrid/useDataGridComponent.js +8 -14
- package/DataGrid/useDataGridProps.js +3 -3
- package/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/colDef/gridNumericOperators.d.ts +1 -1
- package/colDef/gridSingleSelectOperators.d.ts +1 -1
- package/colDef/gridStringOperators.d.ts +1 -1
- package/components/GridFooter.js +1 -1
- package/components/GridRow.js +2 -2
- package/components/base/GridBody.js +2 -2
- package/components/cell/GridEditInputCell.js +3 -8
- package/components/cell/GridEditSingleSelectCell.js +6 -38
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +2 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +32 -5
- package/components/columnSelection/GridHeaderCheckbox.js +3 -3
- package/components/containers/GridRoot.js +4 -3
- package/components/panel/GridColumnsPanel.d.ts +2 -0
- package/components/panel/GridColumnsPanel.js +10 -4
- package/components/panel/filterPanel/GridFilterForm.d.ts +12 -0
- package/components/panel/filterPanel/GridFilterForm.js +29 -7
- package/components/panel/filterPanel/GridFilterPanel.d.ts +12 -0
- package/components/panel/filterPanel/GridFilterPanel.js +64 -19
- package/hooks/core/pipeProcessing/useGridRegisterPipeApplier.d.ts +1 -1
- package/hooks/core/pipeProcessing/useGridRegisterPipeProcessor.d.ts +1 -1
- package/hooks/core/strategyProcessing/useGridRegisterStrategyProcessor.d.ts +1 -1
- package/hooks/core/useGridInitialization.d.ts +1 -1
- package/hooks/core/useGridStateInitialization.d.ts +1 -1
- package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +10 -1
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +6 -0
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +34 -1
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.d.ts +15 -0
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +89 -0
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +1 -15
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +66 -66
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +60 -116
- package/hooks/features/density/densitySelector.d.ts +0 -2
- package/hooks/features/density/densitySelector.js +1 -3
- package/hooks/features/density/densityState.d.ts +0 -1
- package/hooks/features/density/useGridDensity.d.ts +1 -1
- package/hooks/features/density/useGridDensity.js +9 -45
- package/hooks/features/dimensions/useGridDimensions.js +3 -2
- package/hooks/features/{editRows/gridEditRowsSelector.d.ts → editing/gridEditingSelectors.d.ts} +0 -0
- package/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
- package/hooks/features/editing/index.d.ts +1 -0
- package/hooks/features/editing/index.js +1 -0
- package/hooks/features/{editRows/useGridCellEditing.new.d.ts → editing/useGridCellEditing.d.ts} +0 -0
- package/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +21 -6
- package/hooks/features/{editRows/useGridEditing.new.d.ts → editing/useGridEditing.d.ts} +0 -0
- package/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +3 -3
- package/hooks/features/{editRows/useGridRowEditing.new.d.ts → editing/useGridRowEditing.d.ts} +0 -0
- package/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +20 -6
- package/hooks/features/export/useGridPrintExport.js +2 -2
- package/hooks/features/focus/gridFocusState.d.ts +6 -0
- package/hooks/features/focus/gridFocusStateSelector.d.ts +2 -0
- package/hooks/features/focus/gridFocusStateSelector.js +6 -2
- package/hooks/features/focus/useGridFocus.js +69 -11
- package/hooks/features/index.d.ts +2 -2
- package/hooks/features/index.js +2 -2
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +135 -1
- package/hooks/features/{selection/gridSelectionSelector.d.ts → rowSelection/gridRowSelectionSelector.d.ts} +1 -1
- package/hooks/features/rowSelection/gridRowSelectionSelector.js +9 -0
- package/hooks/features/rowSelection/index.d.ts +1 -0
- package/hooks/features/rowSelection/index.js +1 -0
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +12 -0
- package/hooks/features/{selection/useGridSelection.js → rowSelection/useGridRowSelection.js} +37 -37
- package/hooks/features/{selection/useGridSelectionPreProcessors.d.ts → rowSelection/useGridRowSelectionPreProcessors.d.ts} +1 -1
- package/hooks/features/{selection/useGridSelectionPreProcessors.js → rowSelection/useGridRowSelectionPreProcessors.js} +1 -1
- package/hooks/features/rows/gridRowsInterfaces.d.ts +4 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.js +5 -2
- package/hooks/features/rows/useGridRows.js +23 -7
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
- package/hooks/utils/useGridApi.d.ts +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +2 -2
- package/hooks/utils/useGridApiRef.d.ts +1 -1
- package/hooks/utils/useGridInitializeState.d.ts +1 -1
- package/hooks/utils/useGridNativeEventListener.d.ts +1 -1
- package/hooks/utils/useGridSelector.d.ts +1 -1
- package/hooks/utils/useGridState.d.ts +1 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +3 -5
- package/internals/index.js +3 -5
- package/legacy/DataGrid/DataGrid.js +14 -34
- package/legacy/DataGrid/useDataGridComponent.js +8 -14
- package/legacy/DataGrid/useDataGridProps.js +3 -3
- package/legacy/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/legacy/components/GridFooter.js +1 -1
- package/legacy/components/GridRow.js +2 -2
- package/legacy/components/base/GridBody.js +2 -2
- package/legacy/components/cell/GridEditInputCell.js +3 -8
- package/legacy/components/cell/GridEditSingleSelectCell.js +6 -52
- package/legacy/components/columnHeaders/GridColumnGroupHeader.js +46 -13
- package/legacy/components/columnSelection/GridHeaderCheckbox.js +3 -3
- package/legacy/components/containers/GridRoot.js +4 -3
- package/legacy/components/panel/GridColumnsPanel.js +10 -3
- package/legacy/components/panel/filterPanel/GridFilterForm.js +31 -7
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +67 -18
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsSelector.js +33 -1
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsUtils.js +96 -0
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +64 -64
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +70 -122
- package/legacy/hooks/features/density/densitySelector.js +0 -6
- package/legacy/hooks/features/density/useGridDensity.js +6 -44
- package/legacy/hooks/features/dimensions/useGridDimensions.js +3 -2
- package/legacy/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
- package/legacy/hooks/features/editing/index.js +1 -0
- package/legacy/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +21 -6
- package/legacy/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +3 -3
- package/legacy/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +20 -6
- package/legacy/hooks/features/export/useGridPrintExport.js +2 -2
- package/legacy/hooks/features/focus/gridFocusStateSelector.js +8 -0
- package/legacy/hooks/features/focus/useGridFocus.js +72 -11
- package/legacy/hooks/features/index.js +2 -2
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +129 -1
- package/legacy/hooks/features/rowSelection/gridRowSelectionSelector.js +19 -0
- package/legacy/hooks/features/rowSelection/index.js +1 -0
- package/legacy/hooks/features/{selection/useGridSelection.js → rowSelection/useGridRowSelection.js} +37 -37
- package/legacy/hooks/features/{selection/useGridSelectionPreProcessors.js → rowSelection/useGridRowSelectionPreProcessors.js} +1 -1
- package/legacy/hooks/features/rows/gridRowsUtils.js +5 -2
- package/legacy/hooks/features/rows/useGridRows.js +25 -7
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +3 -5
- package/legacy/locales/trTR.js +17 -17
- package/legacy/models/api/{gridSelectionApi.js → gridRowSelectionApi.js} +0 -0
- package/legacy/models/api/index.js +1 -1
- package/legacy/models/{gridSelectionModel.js → gridRowSelectionModel.js} +0 -0
- package/legacy/models/index.js +1 -1
- package/{models/api/gridSelectionApi.js → legacy/models/params/gridColumnGroupHeaderParams.js} +0 -0
- package/legacy/models/params/gridEditCellParams.js +0 -4
- package/legacy/models/params/index.js +1 -0
- package/locales/trTR.js +17 -17
- package/models/api/gridApiCommon.d.ts +3 -6
- package/models/api/gridApiCommunity.d.ts +1 -7
- package/models/api/gridEditingApi.d.ts +36 -121
- package/models/api/gridFocusApi.d.ts +13 -0
- package/models/api/{gridSelectionApi.d.ts → gridRowSelectionApi.d.ts} +2 -2
- package/models/{gridSelectionModel.js → api/gridRowSelectionApi.js} +0 -0
- package/models/api/index.d.ts +2 -2
- package/models/api/index.js +1 -1
- package/models/colDef/gridColDef.d.ts +0 -8
- package/models/events/gridEventLookup.d.ts +30 -19
- package/models/gridColumnGrouping.d.ts +1 -26
- package/models/gridRowSelectionModel.d.ts +3 -0
- package/{modern/models/api/gridSelectionApi.js → models/gridRowSelectionModel.js} +0 -0
- package/models/gridStateCommunity.d.ts +2 -2
- package/models/index.d.ts +1 -1
- package/models/index.js +1 -1
- package/models/params/gridColumnGroupHeaderParams.d.ts +30 -0
- package/{modern/models/gridSelectionModel.js → models/params/gridColumnGroupHeaderParams.js} +0 -0
- package/models/params/gridEditCellParams.d.ts +4 -17
- package/models/params/gridEditCellParams.js +0 -4
- package/models/params/gridRowParams.d.ts +4 -4
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +1 -0
- package/models/props/DataGridProps.d.ts +8 -32
- package/modern/DataGrid/DataGrid.js +14 -34
- package/modern/DataGrid/useDataGridComponent.js +8 -12
- package/modern/DataGrid/useDataGridProps.js +3 -3
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/modern/components/GridFooter.js +1 -1
- package/modern/components/GridRow.js +2 -2
- package/modern/components/base/GridBody.js +2 -2
- package/modern/components/cell/GridEditInputCell.js +3 -4
- package/modern/components/cell/GridEditSingleSelectCell.js +6 -34
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +32 -5
- package/modern/components/columnSelection/GridHeaderCheckbox.js +3 -3
- package/modern/components/containers/GridRoot.js +4 -3
- package/modern/components/panel/GridColumnsPanel.js +10 -4
- package/modern/components/panel/filterPanel/GridFilterForm.js +29 -7
- package/modern/components/panel/filterPanel/GridFilterPanel.js +62 -17
- package/modern/hooks/features/columnGrouping/gridColumnGroupsSelector.js +14 -1
- package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +83 -0
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +50 -62
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +58 -98
- package/modern/hooks/features/density/densitySelector.js +1 -3
- package/modern/hooks/features/density/useGridDensity.js +9 -37
- package/modern/hooks/features/dimensions/useGridDimensions.js +3 -2
- package/modern/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
- package/modern/hooks/features/editing/index.js +1 -0
- package/modern/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +21 -6
- package/modern/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +3 -3
- package/modern/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +20 -6
- package/modern/hooks/features/export/useGridPrintExport.js +2 -2
- package/modern/hooks/features/focus/gridFocusStateSelector.js +6 -2
- package/modern/hooks/features/focus/useGridFocus.js +69 -11
- package/modern/hooks/features/index.js +2 -2
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +135 -1
- package/modern/hooks/features/rowSelection/gridRowSelectionSelector.js +9 -0
- package/modern/hooks/features/rowSelection/index.js +1 -0
- package/modern/hooks/features/{selection/useGridSelection.js → rowSelection/useGridRowSelection.js} +37 -37
- package/modern/hooks/features/{selection/useGridSelectionPreProcessors.js → rowSelection/useGridRowSelectionPreProcessors.js} +1 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +5 -2
- package/modern/hooks/features/rows/useGridRows.js +23 -7
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +2 -2
- package/modern/index.js +1 -1
- package/modern/internals/index.js +3 -5
- package/modern/locales/trTR.js +17 -17
- package/modern/models/api/gridRowSelectionApi.js +1 -0
- package/modern/models/api/index.js +1 -1
- package/modern/models/gridRowSelectionModel.js +1 -0
- package/modern/models/index.js +1 -1
- package/modern/models/params/gridColumnGroupHeaderParams.js +1 -0
- package/modern/models/params/gridEditCellParams.js +0 -4
- package/modern/models/params/index.js +1 -0
- package/node/DataGrid/DataGrid.js +14 -34
- package/node/DataGrid/useDataGridComponent.js +9 -17
- package/node/DataGrid/useDataGridProps.js +3 -3
- package/node/colDef/gridCheckboxSelectionColDef.js +2 -2
- package/node/components/GridFooter.js +2 -2
- package/node/components/GridRow.js +2 -2
- package/node/components/base/GridBody.js +2 -2
- package/node/components/cell/GridEditInputCell.js +3 -9
- package/node/components/cell/GridEditSingleSelectCell.js +6 -38
- package/node/components/columnHeaders/GridColumnGroupHeader.js +32 -5
- package/node/components/columnSelection/GridHeaderCheckbox.js +3 -3
- package/node/components/containers/GridRoot.js +4 -2
- package/node/components/panel/GridColumnsPanel.js +10 -4
- package/node/components/panel/filterPanel/GridFilterForm.js +30 -7
- package/node/components/panel/filterPanel/GridFilterPanel.js +63 -19
- package/node/hooks/features/columnGrouping/gridColumnGroupsSelector.js +40 -3
- package/node/hooks/features/columnGrouping/gridColumnGroupsUtils.js +102 -0
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +68 -71
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +57 -113
- package/node/hooks/features/density/densitySelector.js +2 -6
- package/node/hooks/features/density/useGridDensity.js +9 -48
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -1
- package/node/hooks/features/{editRows/gridEditRowsSelector.js → editing/gridEditingSelectors.js} +0 -0
- package/node/hooks/features/{editRows → editing}/index.js +4 -4
- package/node/hooks/features/{editRows/useGridCellEditing.new.js → editing/useGridCellEditing.js} +28 -13
- package/node/hooks/features/{editRows/useGridEditing.new.js → editing/useGridEditing.js} +4 -4
- package/node/hooks/features/{editRows/useGridRowEditing.new.js → editing/useGridRowEditing.js} +28 -14
- package/node/hooks/features/export/useGridPrintExport.js +2 -2
- package/node/hooks/features/focus/gridFocusStateSelector.js +10 -4
- package/node/hooks/features/focus/useGridFocus.js +68 -10
- package/node/hooks/features/index.js +8 -8
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +138 -1
- package/node/hooks/features/{selection/gridSelectionSelector.js → rowSelection/gridRowSelectionSelector.js} +6 -6
- package/node/hooks/features/rowSelection/index.js +18 -0
- package/node/hooks/features/{selection/useGridSelection.js → rowSelection/useGridRowSelection.js} +43 -43
- package/node/hooks/features/{selection/useGridSelectionPreProcessors.js → rowSelection/useGridRowSelectionPreProcessors.js} +3 -3
- package/node/hooks/features/rows/gridRowsUtils.js +5 -2
- package/node/hooks/features/rows/useGridRows.js +23 -7
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/node/index.js +1 -1
- package/node/internals/index.js +23 -45
- package/node/locales/trTR.js +17 -17
- package/node/models/api/{gridSelectionApi.js → gridRowSelectionApi.js} +0 -0
- package/node/models/api/index.js +4 -4
- package/node/models/{gridSelectionModel.js → gridRowSelectionModel.js} +0 -0
- package/node/models/index.js +4 -4
- package/node/models/params/gridColumnGroupHeaderParams.js +5 -0
- package/node/models/params/gridEditCellParams.js +0 -3
- package/node/models/params/index.js +13 -0
- package/package.json +2 -2
- package/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.d.ts +0 -4
- package/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +0 -35
- package/hooks/features/editRows/index.d.ts +0 -1
- package/hooks/features/editRows/index.js +0 -1
- package/hooks/features/editRows/useGridCellEditing.old.d.ts +0 -4
- package/hooks/features/editRows/useGridCellEditing.old.js +0 -359
- package/hooks/features/editRows/useGridEditing.old.d.ts +0 -11
- package/hooks/features/editRows/useGridEditing.old.js +0 -167
- package/hooks/features/editRows/useGridRowEditing.old.d.ts +0 -4
- package/hooks/features/editRows/useGridRowEditing.old.js +0 -334
- package/hooks/features/selection/gridSelectionSelector.js +0 -9
- package/hooks/features/selection/index.d.ts +0 -1
- package/hooks/features/selection/index.js +0 -1
- package/hooks/features/selection/useGridSelection.d.ts +0 -12
- package/legacy/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +0 -35
- package/legacy/hooks/features/editRows/index.js +0 -1
- package/legacy/hooks/features/editRows/useGridCellEditing.old.js +0 -411
- package/legacy/hooks/features/editRows/useGridEditing.old.js +0 -184
- package/legacy/hooks/features/editRows/useGridRowEditing.old.js +0 -505
- package/legacy/hooks/features/selection/gridSelectionSelector.js +0 -19
- package/legacy/hooks/features/selection/index.js +0 -1
- package/models/gridSelectionModel.d.ts +0 -3
- package/modern/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +0 -29
- package/modern/hooks/features/editRows/index.js +0 -1
- package/modern/hooks/features/editRows/useGridCellEditing.old.js +0 -355
- package/modern/hooks/features/editRows/useGridEditing.old.js +0 -163
- package/modern/hooks/features/editRows/useGridRowEditing.old.js +0 -326
- package/modern/hooks/features/selection/gridSelectionSelector.js +0 -9
- package/modern/hooks/features/selection/index.js +0 -1
- package/node/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +0 -55
- package/node/hooks/features/editRows/useGridCellEditing.old.js +0 -380
- package/node/hooks/features/editRows/useGridEditing.old.js +0 -193
- package/node/hooks/features/editRows/useGridRowEditing.old.js +0 -358
- package/node/hooks/features/selection/index.js +0 -18
|
@@ -11,13 +11,12 @@ import { focusStateInitializer, useGridFocus } from '../hooks/features/focus/use
|
|
|
11
11
|
import { useGridKeyboardNavigation } from '../hooks/features/keyboardNavigation/useGridKeyboardNavigation';
|
|
12
12
|
import { useGridPagination, paginationStateInitializer } from '../hooks/features/pagination/useGridPagination';
|
|
13
13
|
import { useGridPreferencesPanel, preferencePanelStateInitializer } from '../hooks/features/preferencesPanel/useGridPreferencesPanel';
|
|
14
|
-
import { useGridEditing
|
|
15
|
-
import { useGridEditing as useGridEditing_new, editingStateInitializer as editingStateInitializer_new } from '../hooks/features/editRows/useGridEditing.new';
|
|
14
|
+
import { useGridEditing, editingStateInitializer } from '../hooks/features/editing/useGridEditing';
|
|
16
15
|
import { useGridRows, rowsStateInitializer } from '../hooks/features/rows/useGridRows';
|
|
17
16
|
import { useGridRowsPreProcessors } from '../hooks/features/rows/useGridRowsPreProcessors';
|
|
18
17
|
import { useGridParamsApi } from '../hooks/features/rows/useGridParamsApi';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
18
|
+
import { rowSelectionStateInitializer, useGridRowSelection } from '../hooks/features/rowSelection/useGridRowSelection';
|
|
19
|
+
import { useGridRowSelectionPreProcessors } from '../hooks/features/rowSelection/useGridRowSelectionPreProcessors';
|
|
21
20
|
import { useGridSorting, sortingStateInitializer } from '../hooks/features/sorting/useGridSorting';
|
|
22
21
|
import { useGridScroll } from '../hooks/features/scroll/useGridScroll';
|
|
23
22
|
import { useGridEvents } from '../hooks/features/events/useGridEvents';
|
|
@@ -26,27 +25,22 @@ import { rowsMetaStateInitializer, useGridRowsMeta } from '../hooks/features/row
|
|
|
26
25
|
import { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
27
26
|
import { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
|
|
28
27
|
import { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
29
|
-
import { useGridColumnGroupingPreProcessors } from '../hooks/features/columnGrouping/useGridColumnGroupingPreProcessors';
|
|
30
28
|
export var useDataGridComponent = function useDataGridComponent(props) {
|
|
31
|
-
var _props$experimentalFe, _props$experimentalFe2;
|
|
32
|
-
|
|
33
29
|
var apiRef = useGridInitialization(undefined, props);
|
|
34
30
|
/**
|
|
35
31
|
* Register all pre-processors called during state initialization here.
|
|
36
32
|
*/
|
|
37
33
|
|
|
38
|
-
|
|
39
|
-
useGridSelectionPreProcessors(apiRef, props);
|
|
34
|
+
useGridRowSelectionPreProcessors(apiRef, props);
|
|
40
35
|
useGridRowsPreProcessors(apiRef);
|
|
41
36
|
/**
|
|
42
37
|
* Register all state initializers here.
|
|
43
38
|
*/
|
|
44
39
|
|
|
45
|
-
useGridInitializeState(
|
|
40
|
+
useGridInitializeState(rowSelectionStateInitializer, apiRef, props);
|
|
46
41
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
47
|
-
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
48
42
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
49
|
-
useGridInitializeState(
|
|
43
|
+
useGridInitializeState(editingStateInitializer, apiRef, props);
|
|
50
44
|
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
51
45
|
useGridInitializeState(sortingStateInitializer, apiRef, props);
|
|
52
46
|
useGridInitializeState(preferencePanelStateInitializer, apiRef, props);
|
|
@@ -55,14 +49,14 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
55
49
|
useGridInitializeState(paginationStateInitializer, apiRef, props);
|
|
56
50
|
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
57
51
|
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
52
|
+
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
58
53
|
useGridKeyboardNavigation(apiRef, props);
|
|
59
|
-
|
|
54
|
+
useGridRowSelection(apiRef, props);
|
|
60
55
|
useGridColumns(apiRef, props);
|
|
61
56
|
useGridRows(apiRef, props);
|
|
62
57
|
useGridParamsApi(apiRef);
|
|
63
58
|
useGridColumnSpanning(apiRef);
|
|
64
59
|
useGridColumnGrouping(apiRef, props);
|
|
65
|
-
var useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
66
60
|
useGridEditing(apiRef, props);
|
|
67
61
|
useGridFocus(apiRef, props);
|
|
68
62
|
useGridPreferencesPanel(apiRef, props);
|
|
@@ -8,7 +8,7 @@ var DATA_GRID_FORCED_PROPS = {
|
|
|
8
8
|
apiRef: undefined,
|
|
9
9
|
disableMultipleColumnsFiltering: true,
|
|
10
10
|
disableMultipleColumnsSorting: true,
|
|
11
|
-
|
|
11
|
+
disableMultipleRowSelection: true,
|
|
12
12
|
throttleRowsMs: undefined,
|
|
13
13
|
hideFooterRowCount: false,
|
|
14
14
|
pagination: true,
|
|
@@ -38,9 +38,9 @@ export var DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
38
38
|
disableColumnSelector: false,
|
|
39
39
|
disableDensitySelector: false,
|
|
40
40
|
disableMultipleColumnsFiltering: false,
|
|
41
|
-
|
|
41
|
+
disableMultipleRowSelection: false,
|
|
42
42
|
disableMultipleColumnsSorting: false,
|
|
43
|
-
|
|
43
|
+
disableRowSelectionOnClick: false,
|
|
44
44
|
disableVirtualization: false,
|
|
45
45
|
disableIgnoreModificationsIfProcessingProps: false,
|
|
46
46
|
editMode: GridEditModes.Cell,
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { GridCellCheckboxRenderer } from '../components/columnSelection/GridCellCheckboxRenderer';
|
|
4
4
|
import { GridHeaderCheckbox } from '../components/columnSelection/GridHeaderCheckbox';
|
|
5
|
-
import { selectedIdsLookupSelector } from '../hooks/features/
|
|
5
|
+
import { selectedIdsLookupSelector } from '../hooks/features/rowSelection/gridRowSelectionSelector';
|
|
6
6
|
import { GRID_BOOLEAN_COL_DEF } from './gridBooleanColDef';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
export var GRID_CHECKBOX_SELECTION_FIELD = '__check__';
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { useGridSelector } from '../hooks/utils/useGridSelector';
|
|
5
5
|
import { gridTopLevelRowCountSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
6
|
-
import { selectedGridRowsCountSelector } from '../hooks/features/
|
|
6
|
+
import { selectedGridRowsCountSelector } from '../hooks/features/rowSelection/gridRowSelectionSelector';
|
|
7
7
|
import { gridVisibleTopLevelRowCountSelector } from '../hooks/features/filter/gridFilterSelector';
|
|
8
8
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
9
9
|
import { GridRowCount } from './GridRowCount';
|
|
@@ -21,7 +21,7 @@ import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
|
21
21
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
22
22
|
import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
|
|
23
23
|
import { gridRowMaximumTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
24
|
-
import {
|
|
24
|
+
import { gridColumnGroupsHeaderMaxDepthSelector } from '../hooks/features/columnGrouping/gridColumnGroupsSelector';
|
|
25
25
|
import { randomNumberBetween } from '../utils/utils';
|
|
26
26
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -89,7 +89,7 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
89
89
|
var columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
90
90
|
var sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
91
91
|
var treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
92
|
-
var headerGroupingMaxDepth = useGridSelector(apiRef,
|
|
92
|
+
var headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
|
|
93
93
|
var handleRef = useForkRef(ref, refProp);
|
|
94
94
|
var ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
95
95
|
|
|
@@ -6,7 +6,7 @@ import { GridMainContainer } from '../containers/GridMainContainer';
|
|
|
6
6
|
import { GridAutoSizer } from '../GridAutoSizer';
|
|
7
7
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
8
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
9
|
-
import {
|
|
9
|
+
import { gridTotalHeaderHeightSelector } from '../../hooks/features/columnGrouping/gridColumnGroupsSelector';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ function GridBody(props) {
|
|
|
16
16
|
ColumnHeadersComponent = props.ColumnHeadersComponent;
|
|
17
17
|
var apiRef = useGridApiContext();
|
|
18
18
|
var rootProps = useGridRootProps();
|
|
19
|
-
var totalHeaderHeight = useGridSelector(apiRef,
|
|
19
|
+
var totalHeaderHeight = useGridSelector(apiRef, gridTotalHeaderHeightSelector);
|
|
20
20
|
|
|
21
21
|
var _React$useState = React.useState(rootProps.disableVirtualization),
|
|
22
22
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -13,7 +13,6 @@ import InputBase from '@mui/material/InputBase';
|
|
|
13
13
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
14
14
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
15
15
|
import { GridLoadIcon } from '../icons/index';
|
|
16
|
-
import { SUBMIT_FILTER_STROKE_TIME } from '../panel/filterPanel/GridFilterInputValue';
|
|
17
16
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
18
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
18
|
|
|
@@ -42,8 +41,6 @@ var GridEditInputCellRoot = styled(InputBase, {
|
|
|
42
41
|
});
|
|
43
42
|
});
|
|
44
43
|
var GridEditInputCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
45
|
-
var _rootProps$experiment, _rootProps$experiment3;
|
|
46
|
-
|
|
47
44
|
var rootProps = useGridRootProps();
|
|
48
45
|
|
|
49
46
|
var id = props.id,
|
|
@@ -61,7 +58,7 @@ var GridEditInputCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
61
58
|
getValue = props.getValue,
|
|
62
59
|
isValidating = props.isValidating,
|
|
63
60
|
_props$debounceMs = props.debounceMs,
|
|
64
|
-
debounceMs = _props$debounceMs === void 0 ?
|
|
61
|
+
debounceMs = _props$debounceMs === void 0 ? 200 : _props$debounceMs,
|
|
65
62
|
isProcessingProps = props.isProcessingProps,
|
|
66
63
|
onValueChange = props.onValueChange,
|
|
67
64
|
other = _objectWithoutProperties(props, _excluded);
|
|
@@ -80,8 +77,6 @@ var GridEditInputCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
80
77
|
var classes = useUtilityClasses(ownerState);
|
|
81
78
|
var handleChange = React.useCallback( /*#__PURE__*/function () {
|
|
82
79
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
83
|
-
var _rootProps$experiment2;
|
|
84
|
-
|
|
85
80
|
var newValue, column, parsedValue;
|
|
86
81
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
87
82
|
while (1) {
|
|
@@ -101,7 +96,7 @@ var GridEditInputCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
101
96
|
column = apiRef.current.getColumn(field);
|
|
102
97
|
parsedValue = newValue;
|
|
103
98
|
|
|
104
|
-
if (column.valueParser
|
|
99
|
+
if (column.valueParser) {
|
|
105
100
|
parsedValue = column.valueParser(newValue, apiRef.current.getCellParams(id, field));
|
|
106
101
|
}
|
|
107
102
|
|
|
@@ -125,7 +120,7 @@ var GridEditInputCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
125
120
|
return function (_x) {
|
|
126
121
|
return _ref2.apply(this, arguments);
|
|
127
122
|
};
|
|
128
|
-
}(), [apiRef, debounceMs, field, id, onValueChange
|
|
123
|
+
}(), [apiRef, debounceMs, field, id, onValueChange]);
|
|
129
124
|
var meta = apiRef.current.unstable_getEditCellMeta ? apiRef.current.unstable_getEditCellMeta(id, field) : {};
|
|
130
125
|
React.useEffect(function () {
|
|
131
126
|
if (meta.changeReason !== 'debouncedSetEditCellValue') {
|
|
@@ -101,9 +101,7 @@ function GridEditSingleSelectCell(props) {
|
|
|
101
101
|
|
|
102
102
|
var handleChange = /*#__PURE__*/function () {
|
|
103
103
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
var target, formattedTargetValue, isValid, canCommit, params;
|
|
104
|
+
var target, formattedTargetValue;
|
|
107
105
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
108
106
|
while (1) {
|
|
109
107
|
switch (_context.prev = _context.next) {
|
|
@@ -130,44 +128,6 @@ function GridEditSingleSelectCell(props) {
|
|
|
130
128
|
}, event);
|
|
131
129
|
|
|
132
130
|
case 8:
|
|
133
|
-
isValid = _context.sent;
|
|
134
|
-
|
|
135
|
-
if (!((_rootProps$experiment = rootProps.experimentalFeatures) != null && _rootProps$experiment.newEditingApi)) {
|
|
136
|
-
_context.next = 11;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
return _context.abrupt("return");
|
|
141
|
-
|
|
142
|
-
case 11:
|
|
143
|
-
if (!(rootProps.editMode === GridEditModes.Row || isValid === false)) {
|
|
144
|
-
_context.next = 13;
|
|
145
|
-
break;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return _context.abrupt("return");
|
|
149
|
-
|
|
150
|
-
case 13:
|
|
151
|
-
_context.next = 15;
|
|
152
|
-
return Promise.resolve(apiRef.current.commitCellChange({
|
|
153
|
-
id: id,
|
|
154
|
-
field: field
|
|
155
|
-
}, event));
|
|
156
|
-
|
|
157
|
-
case 15:
|
|
158
|
-
canCommit = _context.sent;
|
|
159
|
-
|
|
160
|
-
if (canCommit) {
|
|
161
|
-
apiRef.current.setCellMode(id, field, 'view');
|
|
162
|
-
|
|
163
|
-
if (event.key) {
|
|
164
|
-
// TODO v6: remove once we stop ignoring events fired from portals
|
|
165
|
-
params = apiRef.current.getCellParams(id, field);
|
|
166
|
-
apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
case 17:
|
|
171
131
|
case "end":
|
|
172
132
|
return _context.stop();
|
|
173
133
|
}
|
|
@@ -187,17 +147,11 @@ function GridEditSingleSelectCell(props) {
|
|
|
187
147
|
}
|
|
188
148
|
|
|
189
149
|
if (reason === 'backdropClick' || isEscapeKey(event.key)) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
field: field,
|
|
196
|
-
ignoreModifications: true
|
|
197
|
-
});
|
|
198
|
-
} else {
|
|
199
|
-
apiRef.current.setCellMode(id, field, 'view');
|
|
200
|
-
}
|
|
150
|
+
apiRef.current.stopCellEditMode({
|
|
151
|
+
id: id,
|
|
152
|
+
field: field,
|
|
153
|
+
ignoreModifications: true
|
|
154
|
+
});
|
|
201
155
|
}
|
|
202
156
|
};
|
|
203
157
|
|
|
@@ -36,9 +36,12 @@ function GridColumnGroupHeader(props) {
|
|
|
36
36
|
fields = props.fields,
|
|
37
37
|
height = props.height,
|
|
38
38
|
colIndex = props.colIndex,
|
|
39
|
+
hasFocus = props.hasFocus,
|
|
40
|
+
tabIndex = props.tabIndex,
|
|
39
41
|
isLastColumn = props.isLastColumn,
|
|
40
42
|
extendRowFullWidth = props.extendRowFullWidth;
|
|
41
43
|
var rootProps = useGridRootProps();
|
|
44
|
+
var headerCellRef = React.useRef(null);
|
|
42
45
|
var apiRef = useGridApiContext();
|
|
43
46
|
var columnGroupsLookup = useGridSelector(apiRef, gridColumnGroupsLookupSelector);
|
|
44
47
|
|
|
@@ -58,16 +61,18 @@ function GridColumnGroupHeader(props) {
|
|
|
58
61
|
headerAlign = _group$headerAlign === void 0 ? undefined : _group$headerAlign;
|
|
59
62
|
var headerComponent;
|
|
60
63
|
var render = groupId && ((_columnGroupsLookup$g = columnGroupsLookup[groupId]) == null ? void 0 : _columnGroupsLookup$g.renderHeaderGroup);
|
|
61
|
-
var renderParams = {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
var renderParams = React.useMemo(function () {
|
|
65
|
+
return {
|
|
66
|
+
groupId: groupId,
|
|
67
|
+
headerName: headerName,
|
|
68
|
+
description: description,
|
|
69
|
+
depth: depth,
|
|
70
|
+
maxDepth: maxDepth,
|
|
71
|
+
fields: fields,
|
|
72
|
+
colIndex: colIndex,
|
|
73
|
+
isLastColumn: isLastColumn
|
|
74
|
+
};
|
|
75
|
+
}, [groupId, headerName, description, depth, maxDepth, fields, colIndex, isLastColumn]);
|
|
71
76
|
|
|
72
77
|
if (groupId && render) {
|
|
73
78
|
headerComponent = render(renderParams);
|
|
@@ -90,8 +95,36 @@ function GridColumnGroupHeader(props) {
|
|
|
90
95
|
var id = useId();
|
|
91
96
|
var elementId = groupId === null ? "empty-group-cell-".concat(id) : groupId;
|
|
92
97
|
var classes = useUtilityClasses(ownerState);
|
|
98
|
+
React.useLayoutEffect(function () {
|
|
99
|
+
if (hasFocus) {
|
|
100
|
+
var focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
101
|
+
var elementToFocus = focusableElement || headerCellRef.current;
|
|
102
|
+
elementToFocus == null ? void 0 : elementToFocus.focus();
|
|
103
|
+
}
|
|
104
|
+
}, [apiRef, hasFocus]);
|
|
105
|
+
var publish = React.useCallback(function (eventName) {
|
|
106
|
+
return function (event) {
|
|
107
|
+
// Ignore portal
|
|
108
|
+
// See https://github.com/mui/mui-x/issues/1721
|
|
109
|
+
if (!event.currentTarget.contains(event.target)) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
apiRef.current.publishEvent(eventName, renderParams, event);
|
|
114
|
+
};
|
|
115
|
+
}, // For now this is stupid, because renderParams change all the time.
|
|
116
|
+
// Need to move it's computation in the api, such that for a given depth+columnField, I can get the group parameters
|
|
117
|
+
[apiRef, renderParams]);
|
|
118
|
+
var mouseEventsHandlers = React.useMemo(function () {
|
|
119
|
+
return {
|
|
120
|
+
onKeyDown: publish('columnGroupHeaderKeyDown'),
|
|
121
|
+
onFocus: publish('columnGroupHeaderFocus'),
|
|
122
|
+
onBlur: publish('columnGroupHeaderBlur')
|
|
123
|
+
};
|
|
124
|
+
}, [publish]);
|
|
93
125
|
var headerClassName = typeof group.headerClassName === 'function' ? group.headerClassName(renderParams) : group.headerClassName;
|
|
94
|
-
return /*#__PURE__*/_jsx(GridGenericColumnHeaderItem, {
|
|
126
|
+
return /*#__PURE__*/_jsx(GridGenericColumnHeaderItem, _extends({
|
|
127
|
+
ref: headerCellRef,
|
|
95
128
|
classes: classes,
|
|
96
129
|
columnMenuOpen: false,
|
|
97
130
|
colIndex: colIndex,
|
|
@@ -99,7 +132,7 @@ function GridColumnGroupHeader(props) {
|
|
|
99
132
|
isResizing: false,
|
|
100
133
|
sortDirection: null,
|
|
101
134
|
hasFocus: false,
|
|
102
|
-
tabIndex:
|
|
135
|
+
tabIndex: tabIndex,
|
|
103
136
|
isDraggable: false,
|
|
104
137
|
headerComponent: headerComponent,
|
|
105
138
|
headerClassName: headerClassName,
|
|
@@ -114,7 +147,7 @@ function GridColumnGroupHeader(props) {
|
|
|
114
147
|
,
|
|
115
148
|
"data-fields": "|-".concat(fields.join('-|-'), "-|"),
|
|
116
149
|
disableHeaderSeparator: true
|
|
117
|
-
});
|
|
150
|
+
}, mouseEventsHandlers));
|
|
118
151
|
}
|
|
119
152
|
|
|
120
153
|
export { GridColumnGroupHeader };
|
|
@@ -7,7 +7,7 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
8
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
9
9
|
import { gridTabIndexColumnHeaderSelector } from '../../hooks/features/focus/gridFocusStateSelector';
|
|
10
|
-
import {
|
|
10
|
+
import { gridRowSelectionStateSelector } from '../../hooks/features/rowSelection/gridRowSelectionSelector';
|
|
11
11
|
import { isNavigationKey } from '../../utils/keyboardUtils';
|
|
12
12
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
13
13
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
@@ -42,7 +42,7 @@ var GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderCheckb
|
|
|
42
42
|
};
|
|
43
43
|
var classes = useUtilityClasses(ownerState);
|
|
44
44
|
var tabIndexState = useGridSelector(apiRef, gridTabIndexColumnHeaderSelector);
|
|
45
|
-
var selection = useGridSelector(apiRef,
|
|
45
|
+
var selection = useGridSelector(apiRef, gridRowSelectionStateSelector);
|
|
46
46
|
var visibleRowIds = useGridSelector(apiRef, gridVisibleSortedRowIdsSelector);
|
|
47
47
|
var paginatedVisibleRowIds = useGridSelector(apiRef, gridPaginatedVisibleSortedGridRowIdsSelector);
|
|
48
48
|
var filteredSelection = React.useMemo(function () {
|
|
@@ -112,7 +112,7 @@ var GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderCheckb
|
|
|
112
112
|
});
|
|
113
113
|
}, []);
|
|
114
114
|
React.useEffect(function () {
|
|
115
|
-
return apiRef.current.subscribeEvent('
|
|
115
|
+
return apiRef.current.subscribeEvent('rowSelectionChange', handleSelectionChange);
|
|
116
116
|
}, [apiRef, handleSelectionChange]);
|
|
117
117
|
var label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
|
|
118
118
|
return /*#__PURE__*/_jsx(rootProps.components.BaseCheckbox, _extends({
|
|
@@ -13,7 +13,8 @@ import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
|
13
13
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
14
14
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
15
15
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
16
|
-
import {
|
|
16
|
+
import { gridDensityValueSelector } from '../../hooks/features/density/densitySelector';
|
|
17
|
+
import { gridColumnGroupsHeaderMaxDepthSelector } from '../../hooks/features/columnGrouping/gridColumnGroupsSelector';
|
|
17
18
|
import { gridPinnedRowsCountSelector, gridRowCountSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
|
|
@@ -38,7 +39,7 @@ var GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
38
39
|
var visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
39
40
|
var totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
40
41
|
var densityValue = useGridSelector(apiRef, gridDensityValueSelector);
|
|
41
|
-
var headerGroupingMaxDepth = useGridSelector(apiRef,
|
|
42
|
+
var headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
|
|
42
43
|
var rootContainerRef = React.useRef(null);
|
|
43
44
|
var handleRef = useForkRef(rootContainerRef, ref);
|
|
44
45
|
var pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
|
|
@@ -74,7 +75,7 @@ var GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
74
75
|
role: "grid",
|
|
75
76
|
"aria-colcount": visibleColumns.length,
|
|
76
77
|
"aria-rowcount": headerGroupingMaxDepth + 1 + pinnedRowsCount + totalRowCount,
|
|
77
|
-
"aria-multiselectable": !rootProps.
|
|
78
|
+
"aria-multiselectable": !rootProps.disableMultipleRowSelection,
|
|
78
79
|
"aria-label": rootProps['aria-label'],
|
|
79
80
|
"aria-labelledby": rootProps['aria-labelledby']
|
|
80
81
|
}, other, {
|
|
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
-
var _excluded = ["sort"];
|
|
6
|
+
var _excluded = ["sort", "searchPredicate"];
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -66,6 +66,10 @@ var GridIconButtonRoot = styled(IconButton)({
|
|
|
66
66
|
});
|
|
67
67
|
var collator = new Intl.Collator();
|
|
68
68
|
|
|
69
|
+
var defaultSearchPredicate = function defaultSearchPredicate(column, searchValue) {
|
|
70
|
+
return (column.headerName || column.field).toLowerCase().indexOf(searchValue) > -1;
|
|
71
|
+
};
|
|
72
|
+
|
|
69
73
|
function GridColumnsPanel(props) {
|
|
70
74
|
var _rootProps$components, _rootProps$components3, _rootProps$components4;
|
|
71
75
|
|
|
@@ -86,6 +90,8 @@ function GridColumnsPanel(props) {
|
|
|
86
90
|
var classes = useUtilityClasses(ownerState);
|
|
87
91
|
|
|
88
92
|
var sort = props.sort,
|
|
93
|
+
_props$searchPredicat = props.searchPredicate,
|
|
94
|
+
searchPredicate = _props$searchPredicat === void 0 ? defaultSearchPredicate : _props$searchPredicat,
|
|
89
95
|
other = _objectWithoutProperties(props, _excluded);
|
|
90
96
|
|
|
91
97
|
var sortedColumns = React.useMemo(function () {
|
|
@@ -132,9 +138,9 @@ function GridColumnsPanel(props) {
|
|
|
132
138
|
|
|
133
139
|
var searchValueToCheck = searchValue.toLowerCase();
|
|
134
140
|
return sortedColumns.filter(function (column) {
|
|
135
|
-
return (column
|
|
141
|
+
return searchPredicate(column, searchValueToCheck);
|
|
136
142
|
});
|
|
137
|
-
}, [sortedColumns, searchValue]);
|
|
143
|
+
}, [sortedColumns, searchValue, searchPredicate]);
|
|
138
144
|
React.useEffect(function () {
|
|
139
145
|
searchInputRef.current.focus();
|
|
140
146
|
}, []);
|
|
@@ -200,6 +206,7 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
200
206
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
201
207
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
202
208
|
// ----------------------------------------------------------------------
|
|
209
|
+
searchPredicate: PropTypes.func,
|
|
203
210
|
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
204
211
|
} : void 0;
|
|
205
212
|
export { GridColumnsPanel };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"],
|
|
3
|
+
var _excluded = ["item", "hasMultipleFilters", "deleteFilter", "applyFilterChanges", "multiFilterOperator", "showMultiFilterOperators", "disableMultiFilterOperator", "applyMultiFilterOperatorChanges", "focusElementRef", "linkOperators", "columnsSort", "filterColumns", "deleteIconProps", "linkOperatorInputProps", "operatorInputProps", "columnInputProps", "valueInputProps", "children"],
|
|
4
4
|
_excluded2 = ["InputComponentProps"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -13,6 +13,7 @@ import { capitalize, unstable_useId as useId } from '@mui/material/utils';
|
|
|
13
13
|
import { styled } from '@mui/material/styles';
|
|
14
14
|
import clsx from 'clsx';
|
|
15
15
|
import { gridFilterableColumnDefinitionsSelector } from '../../../hooks/features/columns/gridColumnsSelector';
|
|
16
|
+
import { gridFilterModelSelector } from '../../../hooks/features/filter/gridFilterSelector';
|
|
16
17
|
import { useGridSelector } from '../../../hooks/utils/useGridSelector';
|
|
17
18
|
import { GridLinkOperator } from '../../../models/gridFilterItem';
|
|
18
19
|
import { useGridApiContext } from '../../../hooks/utils/useGridApiContext';
|
|
@@ -134,6 +135,7 @@ var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props
|
|
|
134
135
|
_props$linkOperators = props.linkOperators,
|
|
135
136
|
linkOperators = _props$linkOperators === void 0 ? [GridLinkOperator.And, GridLinkOperator.Or] : _props$linkOperators,
|
|
136
137
|
columnsSort = props.columnsSort,
|
|
138
|
+
filterColumns = props.filterColumns,
|
|
137
139
|
_props$deleteIconProp = props.deleteIconProps,
|
|
138
140
|
deleteIconProps = _props$deleteIconProp === void 0 ? {} : _props$deleteIconProp,
|
|
139
141
|
_props$linkOperatorIn = props.linkOperatorInputProps,
|
|
@@ -149,6 +151,7 @@ var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props
|
|
|
149
151
|
|
|
150
152
|
var apiRef = useGridApiContext();
|
|
151
153
|
var filterableColumns = useGridSelector(apiRef, gridFilterableColumnDefinitionsSelector);
|
|
154
|
+
var filterModel = useGridSelector(apiRef, gridFilterModelSelector);
|
|
152
155
|
var columnSelectId = useId();
|
|
153
156
|
var columnSelectLabelId = useId();
|
|
154
157
|
var operatorSelectId = useId();
|
|
@@ -169,22 +172,36 @@ var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props
|
|
|
169
172
|
var InputComponentProps = valueInputProps.InputComponentProps,
|
|
170
173
|
valueInputPropsOther = _objectWithoutProperties(valueInputProps, _excluded2);
|
|
171
174
|
|
|
172
|
-
var
|
|
175
|
+
var filteredColumns = React.useMemo(function () {
|
|
176
|
+
if (filterColumns === undefined || typeof filterColumns !== 'function') {
|
|
177
|
+
return filterableColumns;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
var filteredFields = filterColumns({
|
|
181
|
+
field: item.columnField,
|
|
182
|
+
columns: filterableColumns,
|
|
183
|
+
currentFilters: (filterModel == null ? void 0 : filterModel.items) || []
|
|
184
|
+
});
|
|
185
|
+
return filterableColumns.filter(function (column) {
|
|
186
|
+
return filteredFields.includes(column.field);
|
|
187
|
+
});
|
|
188
|
+
}, [filterColumns, filterModel == null ? void 0 : filterModel.items, filterableColumns, item.columnField]);
|
|
189
|
+
var sortedFilteredColumns = React.useMemo(function () {
|
|
173
190
|
switch (columnsSort) {
|
|
174
191
|
case 'asc':
|
|
175
|
-
return
|
|
192
|
+
return filteredColumns.sort(function (a, b) {
|
|
176
193
|
return collator.compare(getColumnLabel(a), getColumnLabel(b));
|
|
177
194
|
});
|
|
178
195
|
|
|
179
196
|
case 'desc':
|
|
180
|
-
return
|
|
197
|
+
return filteredColumns.sort(function (a, b) {
|
|
181
198
|
return -collator.compare(getColumnLabel(a), getColumnLabel(b));
|
|
182
199
|
});
|
|
183
200
|
|
|
184
201
|
default:
|
|
185
|
-
return
|
|
202
|
+
return filteredColumns;
|
|
186
203
|
}
|
|
187
|
-
}, [
|
|
204
|
+
}, [filteredColumns, columnsSort]);
|
|
188
205
|
var currentColumn = item.columnField ? apiRef.current.getColumn(item.columnField) : null;
|
|
189
206
|
var currentOperator = React.useMemo(function () {
|
|
190
207
|
var _currentColumn$filter;
|
|
@@ -323,7 +340,7 @@ var GridFilterForm = /*#__PURE__*/React.forwardRef(function GridFilterForm(props
|
|
|
323
340
|
onChange: changeColumn,
|
|
324
341
|
native: isBaseSelectNative
|
|
325
342
|
}, (_rootProps$components4 = rootProps.componentsProps) == null ? void 0 : _rootProps$components4.baseSelect, {
|
|
326
|
-
children:
|
|
343
|
+
children: sortedFilteredColumns.map(function (col) {
|
|
327
344
|
return /*#__PURE__*/_jsx(OptionComponent, {
|
|
328
345
|
value: col.field,
|
|
329
346
|
children: getColumnLabel(col)
|
|
@@ -421,6 +438,13 @@ process.env.NODE_ENV !== "production" ? GridFilterForm.propTypes = {
|
|
|
421
438
|
*/
|
|
422
439
|
disableMultiFilterOperator: PropTypes.bool,
|
|
423
440
|
|
|
441
|
+
/**
|
|
442
|
+
* Allows to filter the columns displayed in the filter form.
|
|
443
|
+
* @param {FilterColumnsArgs} args The columns of the grid and name of field.
|
|
444
|
+
* @returns {GridColDef['field'][]} The filtered fields array.
|
|
445
|
+
*/
|
|
446
|
+
filterColumns: PropTypes.func,
|
|
447
|
+
|
|
424
448
|
/**
|
|
425
449
|
* A ref allowing to set imperative focus.
|
|
426
450
|
* It can be passed to the el
|