@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
package/DataGrid/DataGrid.js
CHANGED
|
@@ -166,7 +166,7 @@ DataGridRaw.propTypes = {
|
|
|
166
166
|
* If `true`, the selection on click on a row or cell is disabled.
|
|
167
167
|
* @default false
|
|
168
168
|
*/
|
|
169
|
-
|
|
169
|
+
disableRowSelectionOnClick: PropTypes.bool,
|
|
170
170
|
|
|
171
171
|
/**
|
|
172
172
|
* If `true`, the virtualization is disabled.
|
|
@@ -196,8 +196,6 @@ DataGridRaw.propTypes = {
|
|
|
196
196
|
*/
|
|
197
197
|
experimentalFeatures: PropTypes.shape({
|
|
198
198
|
columnGrouping: PropTypes.bool,
|
|
199
|
-
newEditingApi: PropTypes.bool,
|
|
200
|
-
preventCommitWhileValidating: PropTypes.bool,
|
|
201
199
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
202
200
|
}),
|
|
203
201
|
|
|
@@ -374,14 +372,6 @@ DataGridRaw.propTypes = {
|
|
|
374
372
|
*/
|
|
375
373
|
onCellDoubleClick: PropTypes.func,
|
|
376
374
|
|
|
377
|
-
/**
|
|
378
|
-
* Callback fired when the cell changes are committed.
|
|
379
|
-
* @param {GridCellEditCommitParams} params With all properties from [[GridCellEditCommitParams]].
|
|
380
|
-
* @param {MuiEvent<MuiBaseEvent>} event The event that caused this prop to be called.
|
|
381
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
382
|
-
*/
|
|
383
|
-
onCellEditCommit: PropTypes.func,
|
|
384
|
-
|
|
385
375
|
/**
|
|
386
376
|
* Callback fired when the cell turns to edit mode.
|
|
387
377
|
* @param {GridCellParams} params With all properties from [[GridCellParams]].
|
|
@@ -482,15 +472,6 @@ DataGridRaw.propTypes = {
|
|
|
482
472
|
*/
|
|
483
473
|
onColumnVisibilityModelChange: PropTypes.func,
|
|
484
474
|
|
|
485
|
-
/**
|
|
486
|
-
* Callback fired when the edit cell value changes.
|
|
487
|
-
* @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
|
|
488
|
-
* @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
|
|
489
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
490
|
-
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/x/api/data-grid/grid-col-def/)
|
|
491
|
-
*/
|
|
492
|
-
onEditCellPropsChange: PropTypes.func,
|
|
493
|
-
|
|
494
475
|
/**
|
|
495
476
|
* Callback fired when the `editRowsModel` changes.
|
|
496
477
|
* @param {GridEditRowsModel} editRowsModel With all properties from [[GridEditRowsModel]].
|
|
@@ -620,10 +601,10 @@ DataGridRaw.propTypes = {
|
|
|
620
601
|
|
|
621
602
|
/**
|
|
622
603
|
* Callback fired when the selection state of one or multiple rows changes.
|
|
623
|
-
* @param {
|
|
604
|
+
* @param {GridRowSelectionModel} rowSelectionModel With all the row ids [[GridSelectionModel]].
|
|
624
605
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
625
606
|
*/
|
|
626
|
-
|
|
607
|
+
onRowSelectionModelChange: PropTypes.func,
|
|
627
608
|
|
|
628
609
|
/**
|
|
629
610
|
* Callback fired when the sort model changes before a column is sorted.
|
|
@@ -677,7 +658,6 @@ DataGridRaw.propTypes = {
|
|
|
677
658
|
|
|
678
659
|
/**
|
|
679
660
|
* Callback called before updating a row with new values in the row and cell editing.
|
|
680
|
-
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
681
661
|
* @template R
|
|
682
662
|
* @param {R} newRow Row object with the new values.
|
|
683
663
|
* @param {R} oldRow Row object with the old values.
|
|
@@ -713,6 +693,17 @@ DataGridRaw.propTypes = {
|
|
|
713
693
|
*/
|
|
714
694
|
rows: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
715
695
|
|
|
696
|
+
/**
|
|
697
|
+
* Sets the row selection model of the grid.
|
|
698
|
+
*/
|
|
699
|
+
rowSelectionModel: chainPropTypes(PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.array]), props => {
|
|
700
|
+
if (!props.checkboxSelection && Array.isArray(props.rowSelectionModel) && props.rowSelectionModel.length > 1) {
|
|
701
|
+
return new Error([`MUI: \`<DataGrid rowSelectionModel={${JSON.stringify(props.rowSelectionModel)}} />\` is not a valid prop.`, 'rowSelectionModel can only be of 1 item in DataGrid.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
return null;
|
|
705
|
+
}),
|
|
706
|
+
|
|
716
707
|
/**
|
|
717
708
|
* Sets the type of space between rows added by `getRowSpacing`.
|
|
718
709
|
* @default "margin"
|
|
@@ -736,17 +727,6 @@ DataGridRaw.propTypes = {
|
|
|
736
727
|
*/
|
|
737
728
|
scrollbarSize: PropTypes.number,
|
|
738
729
|
|
|
739
|
-
/**
|
|
740
|
-
* Set the selection model of the grid.
|
|
741
|
-
*/
|
|
742
|
-
selectionModel: chainPropTypes(PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.array]), props => {
|
|
743
|
-
if (!props.checkboxSelection && Array.isArray(props.selectionModel) && props.selectionModel.length > 1) {
|
|
744
|
-
return new Error([`MUI: \`<DataGrid selectionModel={${JSON.stringify(props.selectionModel)}} />\` is not a valid prop.`, 'selectionModel can only be of 1 item in DataGrid.', '', 'You need to upgrade to DataGridPro or DataGridPremium component to unlock multiple selection.'].join('\n'));
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
return null;
|
|
748
|
-
}),
|
|
749
|
-
|
|
750
730
|
/**
|
|
751
731
|
* If `true`, the right border of the cells are displayed.
|
|
752
732
|
* @default false
|
|
@@ -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 const useDataGridComponent = props => {
|
|
31
|
-
var _props$experimentalFe, _props$experimentalFe2;
|
|
32
|
-
|
|
33
29
|
const 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 const 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
|
-
const 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);
|
|
@@ -7,7 +7,7 @@ const DATA_GRID_FORCED_PROPS = {
|
|
|
7
7
|
apiRef: undefined,
|
|
8
8
|
disableMultipleColumnsFiltering: true,
|
|
9
9
|
disableMultipleColumnsSorting: true,
|
|
10
|
-
|
|
10
|
+
disableMultipleRowSelection: true,
|
|
11
11
|
throttleRowsMs: undefined,
|
|
12
12
|
hideFooterRowCount: false,
|
|
13
13
|
pagination: true,
|
|
@@ -37,9 +37,9 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
37
37
|
disableColumnSelector: false,
|
|
38
38
|
disableDensitySelector: false,
|
|
39
39
|
disableMultipleColumnsFiltering: false,
|
|
40
|
-
|
|
40
|
+
disableMultipleRowSelection: false,
|
|
41
41
|
disableMultipleColumnsSorting: false,
|
|
42
|
-
|
|
42
|
+
disableRowSelectionOnClick: false,
|
|
43
43
|
disableVirtualization: false,
|
|
44
44
|
disableIgnoreModificationsIfProcessingProps: false,
|
|
45
45
|
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 const GRID_CHECKBOX_SELECTION_FIELD = '__check__';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GridFilterOperator } from '../models/gridFilterOperator';
|
|
2
2
|
import { GridCellParams } from '../models';
|
|
3
|
-
export declare const getGridNumericQuickFilterFn: (value: any) => (({ value }: GridCellParams) => boolean) | null;
|
|
3
|
+
export declare const getGridNumericQuickFilterFn: (value: any) => (({ value: columnValue }: GridCellParams) => boolean) | null;
|
|
4
4
|
export declare const getGridNumericOperators: () => GridFilterOperator<any, number | string | null, any>[];
|
|
5
5
|
/**
|
|
6
6
|
* @deprecated Use `getGridNumericOperators` instead.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GridFilterOperator } from '../models/gridFilterOperator';
|
|
2
2
|
import { GridCellParams, GridColDef } from '../models';
|
|
3
3
|
import { GridApiCommunity } from '../models/api/gridApiCommunity';
|
|
4
|
-
export declare const getGridSingleSelectQuickFilterFn: (value: any, column: GridColDef, apiRef: React.MutableRefObject<GridApiCommunity>) => (({ value }: GridCellParams) => boolean) | null;
|
|
4
|
+
export declare const getGridSingleSelectQuickFilterFn: (value: any, column: GridColDef, apiRef: React.MutableRefObject<GridApiCommunity>) => (({ value: columnValue }: GridCellParams) => boolean) | null;
|
|
5
5
|
export declare const getGridSingleSelectOperators: () => GridFilterOperator[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { GridFilterOperator } from '../models/gridFilterOperator';
|
|
2
2
|
import { GridCellParams } from '../models';
|
|
3
|
-
export declare const getGridStringQuickFilterFn: (value: any) => (({ value }: GridCellParams) => boolean) | null;
|
|
3
|
+
export declare const getGridStringQuickFilterFn: (value: any) => (({ value: columnValue }: GridCellParams) => boolean) | null;
|
|
4
4
|
export declare const getGridStringOperators: (disableTrim?: boolean) => GridFilterOperator<any, number | string | null, any>[];
|
package/components/GridFooter.js
CHANGED
|
@@ -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';
|
package/components/GridRow.js
CHANGED
|
@@ -19,7 +19,7 @@ import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
|
19
19
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
20
20
|
import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
|
|
21
21
|
import { gridRowMaximumTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
22
|
-
import {
|
|
22
|
+
import { gridColumnGroupsHeaderMaxDepthSelector } from '../hooks/features/columnGrouping/gridColumnGroupsSelector';
|
|
23
23
|
import { randomNumberBetween } from '../utils/utils';
|
|
24
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -89,7 +89,7 @@ const GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
89
89
|
const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
90
90
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
91
91
|
const treeDepth = useGridSelector(apiRef, gridRowMaximumTreeDepthSelector);
|
|
92
|
-
const headerGroupingMaxDepth = useGridSelector(apiRef,
|
|
92
|
+
const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
|
|
93
93
|
const handleRef = useForkRef(ref, refProp);
|
|
94
94
|
const ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
95
95
|
|
|
@@ -5,7 +5,7 @@ import { GridMainContainer } from '../containers/GridMainContainer';
|
|
|
5
5
|
import { GridAutoSizer } from '../GridAutoSizer';
|
|
6
6
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
7
7
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
8
|
-
import {
|
|
8
|
+
import { gridTotalHeaderHeightSelector } from '../../hooks/features/columnGrouping/gridColumnGroupsSelector';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
|
|
@@ -17,7 +17,7 @@ function GridBody(props) {
|
|
|
17
17
|
} = props;
|
|
18
18
|
const apiRef = useGridApiContext();
|
|
19
19
|
const rootProps = useGridRootProps();
|
|
20
|
-
const totalHeaderHeight = useGridSelector(apiRef,
|
|
20
|
+
const totalHeaderHeight = useGridSelector(apiRef, gridTotalHeaderHeightSelector);
|
|
21
21
|
const [isVirtualizationDisabled, setIsVirtualizationDisabled] = React.useState(rootProps.disableVirtualization);
|
|
22
22
|
const disableVirtualization = React.useCallback(() => {
|
|
23
23
|
setIsVirtualizationDisabled(true);
|
|
@@ -10,7 +10,6 @@ import InputBase from '@mui/material/InputBase';
|
|
|
10
10
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
11
11
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
12
12
|
import { GridLoadIcon } from '../icons/index';
|
|
13
|
-
import { SUBMIT_FILTER_STROKE_TIME } from '../panel/filterPanel/GridFilterInputValue';
|
|
14
13
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
15
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
15
|
|
|
@@ -38,8 +37,6 @@ const GridEditInputCellRoot = styled(InputBase, {
|
|
|
38
37
|
}
|
|
39
38
|
}));
|
|
40
39
|
const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
41
|
-
var _rootProps$experiment, _rootProps$experiment3;
|
|
42
|
-
|
|
43
40
|
const rootProps = useGridRootProps();
|
|
44
41
|
|
|
45
42
|
const {
|
|
@@ -48,7 +45,7 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
48
45
|
field,
|
|
49
46
|
colDef,
|
|
50
47
|
hasFocus,
|
|
51
|
-
debounceMs =
|
|
48
|
+
debounceMs = 200,
|
|
52
49
|
isProcessingProps,
|
|
53
50
|
onValueChange
|
|
54
51
|
} = props,
|
|
@@ -62,8 +59,6 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
62
59
|
};
|
|
63
60
|
const classes = useUtilityClasses(ownerState);
|
|
64
61
|
const handleChange = React.useCallback(async event => {
|
|
65
|
-
var _rootProps$experiment2;
|
|
66
|
-
|
|
67
62
|
const newValue = event.target.value;
|
|
68
63
|
|
|
69
64
|
if (onValueChange) {
|
|
@@ -73,7 +68,7 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
73
68
|
const column = apiRef.current.getColumn(field);
|
|
74
69
|
let parsedValue = newValue;
|
|
75
70
|
|
|
76
|
-
if (column.valueParser
|
|
71
|
+
if (column.valueParser) {
|
|
77
72
|
parsedValue = column.valueParser(newValue, apiRef.current.getCellParams(id, field));
|
|
78
73
|
}
|
|
79
74
|
|
|
@@ -85,7 +80,7 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
85
80
|
debounceMs,
|
|
86
81
|
unstable_skipValueParser: true
|
|
87
82
|
}, event);
|
|
88
|
-
}, [apiRef, debounceMs, field, id, onValueChange
|
|
83
|
+
}, [apiRef, debounceMs, field, id, onValueChange]);
|
|
89
84
|
const meta = apiRef.current.unstable_getEditCellMeta ? apiRef.current.unstable_getEditCellMeta(id, field) : {};
|
|
90
85
|
React.useEffect(() => {
|
|
91
86
|
if (meta.changeReason !== 'debouncedSetEditCellValue') {
|
|
@@ -83,8 +83,6 @@ function GridEditSingleSelectCell(props) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
const handleChange = async event => {
|
|
86
|
-
var _rootProps$experiment;
|
|
87
|
-
|
|
88
86
|
setOpen(false);
|
|
89
87
|
const target = event.target; // NativeSelect casts the value to a string.
|
|
90
88
|
|
|
@@ -94,35 +92,11 @@ function GridEditSingleSelectCell(props) {
|
|
|
94
92
|
await onValueChange(event, formattedTargetValue);
|
|
95
93
|
}
|
|
96
94
|
|
|
97
|
-
|
|
95
|
+
await apiRef.current.setEditCellValue({
|
|
98
96
|
id,
|
|
99
97
|
field,
|
|
100
98
|
value: formattedTargetValue
|
|
101
99
|
}, event);
|
|
102
|
-
|
|
103
|
-
if ((_rootProps$experiment = rootProps.experimentalFeatures) != null && _rootProps$experiment.newEditingApi) {
|
|
104
|
-
return;
|
|
105
|
-
} // We use isValid === false because the default return is undefined which evaluates to true with !isValid
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
if (rootProps.editMode === GridEditModes.Row || isValid === false) {
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const canCommit = await Promise.resolve(apiRef.current.commitCellChange({
|
|
113
|
-
id,
|
|
114
|
-
field
|
|
115
|
-
}, event));
|
|
116
|
-
|
|
117
|
-
if (canCommit) {
|
|
118
|
-
apiRef.current.setCellMode(id, field, 'view');
|
|
119
|
-
|
|
120
|
-
if (event.key) {
|
|
121
|
-
// TODO v6: remove once we stop ignoring events fired from portals
|
|
122
|
-
const params = apiRef.current.getCellParams(id, field);
|
|
123
|
-
apiRef.current.publishEvent('cellNavigationKeyDown', params, event);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
100
|
};
|
|
127
101
|
|
|
128
102
|
const handleClose = (event, reason) => {
|
|
@@ -132,17 +106,11 @@ function GridEditSingleSelectCell(props) {
|
|
|
132
106
|
}
|
|
133
107
|
|
|
134
108
|
if (reason === 'backdropClick' || isEscapeKey(event.key)) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
field,
|
|
141
|
-
ignoreModifications: true
|
|
142
|
-
});
|
|
143
|
-
} else {
|
|
144
|
-
apiRef.current.setCellMode(id, field, 'view');
|
|
145
|
-
}
|
|
109
|
+
apiRef.current.stopCellEditMode({
|
|
110
|
+
id,
|
|
111
|
+
field,
|
|
112
|
+
ignoreModifications: true
|
|
113
|
+
});
|
|
146
114
|
}
|
|
147
115
|
};
|
|
148
116
|
|
|
@@ -9,6 +9,8 @@ interface GridColumnGroupHeaderProps {
|
|
|
9
9
|
depth: number;
|
|
10
10
|
maxDepth: number;
|
|
11
11
|
height: number;
|
|
12
|
+
hasFocus?: boolean;
|
|
13
|
+
tabIndex: 0 | -1;
|
|
12
14
|
}
|
|
13
15
|
declare function GridColumnGroupHeader(props: GridColumnGroupHeaderProps): JSX.Element;
|
|
14
16
|
export { GridColumnGroupHeader };
|
|
@@ -39,10 +39,13 @@ function GridColumnGroupHeader(props) {
|
|
|
39
39
|
fields,
|
|
40
40
|
height,
|
|
41
41
|
colIndex,
|
|
42
|
+
hasFocus,
|
|
43
|
+
tabIndex,
|
|
42
44
|
isLastColumn,
|
|
43
45
|
extendRowFullWidth
|
|
44
46
|
} = props;
|
|
45
47
|
const rootProps = useGridRootProps();
|
|
48
|
+
const headerCellRef = React.useRef(null);
|
|
46
49
|
const apiRef = useGridApiContext();
|
|
47
50
|
const columnGroupsLookup = useGridSelector(apiRef, gridColumnGroupsLookupSelector);
|
|
48
51
|
const {
|
|
@@ -60,7 +63,7 @@ function GridColumnGroupHeader(props) {
|
|
|
60
63
|
} = group;
|
|
61
64
|
let headerComponent;
|
|
62
65
|
const render = groupId && ((_columnGroupsLookup$g = columnGroupsLookup[groupId]) == null ? void 0 : _columnGroupsLookup$g.renderHeaderGroup);
|
|
63
|
-
const renderParams = {
|
|
66
|
+
const renderParams = React.useMemo(() => ({
|
|
64
67
|
groupId,
|
|
65
68
|
headerName,
|
|
66
69
|
description,
|
|
@@ -69,7 +72,7 @@ function GridColumnGroupHeader(props) {
|
|
|
69
72
|
fields,
|
|
70
73
|
colIndex,
|
|
71
74
|
isLastColumn
|
|
72
|
-
};
|
|
75
|
+
}), [groupId, headerName, description, depth, maxDepth, fields, colIndex, isLastColumn]);
|
|
73
76
|
|
|
74
77
|
if (groupId && render) {
|
|
75
78
|
headerComponent = render(renderParams);
|
|
@@ -92,8 +95,32 @@ function GridColumnGroupHeader(props) {
|
|
|
92
95
|
const id = useId();
|
|
93
96
|
const elementId = groupId === null ? `empty-group-cell-${id}` : groupId;
|
|
94
97
|
const classes = useUtilityClasses(ownerState);
|
|
98
|
+
React.useLayoutEffect(() => {
|
|
99
|
+
if (hasFocus) {
|
|
100
|
+
const focusableElement = headerCellRef.current.querySelector('[tabindex="0"]');
|
|
101
|
+
const elementToFocus = focusableElement || headerCellRef.current;
|
|
102
|
+
elementToFocus == null ? void 0 : elementToFocus.focus();
|
|
103
|
+
}
|
|
104
|
+
}, [apiRef, hasFocus]);
|
|
105
|
+
const publish = React.useCallback(eventName => event => {
|
|
106
|
+
// Ignore portal
|
|
107
|
+
// See https://github.com/mui/mui-x/issues/1721
|
|
108
|
+
if (!event.currentTarget.contains(event.target)) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
apiRef.current.publishEvent(eventName, renderParams, event);
|
|
113
|
+
}, // For now this is stupid, because renderParams change all the time.
|
|
114
|
+
// Need to move it's computation in the api, such that for a given depth+columnField, I can get the group parameters
|
|
115
|
+
[apiRef, renderParams]);
|
|
116
|
+
const mouseEventsHandlers = React.useMemo(() => ({
|
|
117
|
+
onKeyDown: publish('columnGroupHeaderKeyDown'),
|
|
118
|
+
onFocus: publish('columnGroupHeaderFocus'),
|
|
119
|
+
onBlur: publish('columnGroupHeaderBlur')
|
|
120
|
+
}), [publish]);
|
|
95
121
|
const headerClassName = typeof group.headerClassName === 'function' ? group.headerClassName(renderParams) : group.headerClassName;
|
|
96
|
-
return /*#__PURE__*/_jsx(GridGenericColumnHeaderItem, {
|
|
122
|
+
return /*#__PURE__*/_jsx(GridGenericColumnHeaderItem, _extends({
|
|
123
|
+
ref: headerCellRef,
|
|
97
124
|
classes: classes,
|
|
98
125
|
columnMenuOpen: false,
|
|
99
126
|
colIndex: colIndex,
|
|
@@ -101,7 +128,7 @@ function GridColumnGroupHeader(props) {
|
|
|
101
128
|
isResizing: false,
|
|
102
129
|
sortDirection: null,
|
|
103
130
|
hasFocus: false,
|
|
104
|
-
tabIndex:
|
|
131
|
+
tabIndex: tabIndex,
|
|
105
132
|
isDraggable: false,
|
|
106
133
|
headerComponent: headerComponent,
|
|
107
134
|
headerClassName: headerClassName,
|
|
@@ -116,7 +143,7 @@ function GridColumnGroupHeader(props) {
|
|
|
116
143
|
,
|
|
117
144
|
"data-fields": `|-${fields.join('-|-')}-|`,
|
|
118
145
|
disableHeaderSeparator: true
|
|
119
|
-
});
|
|
146
|
+
}, mouseEventsHandlers));
|
|
120
147
|
}
|
|
121
148
|
|
|
122
149
|
export { GridColumnGroupHeader };
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
7
7
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
8
8
|
import { gridTabIndexColumnHeaderSelector } from '../../hooks/features/focus/gridFocusStateSelector';
|
|
9
|
-
import {
|
|
9
|
+
import { gridRowSelectionStateSelector } from '../../hooks/features/rowSelection/gridRowSelectionSelector';
|
|
10
10
|
import { isNavigationKey } from '../../utils/keyboardUtils';
|
|
11
11
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
12
12
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
@@ -38,7 +38,7 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
|
|
|
38
38
|
};
|
|
39
39
|
const classes = useUtilityClasses(ownerState);
|
|
40
40
|
const tabIndexState = useGridSelector(apiRef, gridTabIndexColumnHeaderSelector);
|
|
41
|
-
const selection = useGridSelector(apiRef,
|
|
41
|
+
const selection = useGridSelector(apiRef, gridRowSelectionStateSelector);
|
|
42
42
|
const visibleRowIds = useGridSelector(apiRef, gridVisibleSortedRowIdsSelector);
|
|
43
43
|
const paginatedVisibleRowIds = useGridSelector(apiRef, gridPaginatedVisibleSortedGridRowIdsSelector);
|
|
44
44
|
const filteredSelection = React.useMemo(() => {
|
|
@@ -102,7 +102,7 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
|
|
|
102
102
|
forceUpdate(p => !p);
|
|
103
103
|
}, []);
|
|
104
104
|
React.useEffect(() => {
|
|
105
|
-
return apiRef.current.subscribeEvent('
|
|
105
|
+
return apiRef.current.subscribeEvent('rowSelectionChange', handleSelectionChange);
|
|
106
106
|
}, [apiRef, handleSelectionChange]);
|
|
107
107
|
const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
|
|
108
108
|
return /*#__PURE__*/_jsx(rootProps.components.BaseCheckbox, _extends({
|
|
@@ -12,7 +12,8 @@ import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
|
12
12
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
13
13
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
14
14
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
15
|
-
import {
|
|
15
|
+
import { gridDensityValueSelector } from '../../hooks/features/density/densitySelector';
|
|
16
|
+
import { gridColumnGroupsHeaderMaxDepthSelector } from '../../hooks/features/columnGrouping/gridColumnGroupsSelector';
|
|
16
17
|
import { gridPinnedRowsCountSelector, gridRowCountSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
|
|
@@ -41,7 +42,7 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
41
42
|
const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
42
43
|
const totalRowCount = useGridSelector(apiRef, gridRowCountSelector);
|
|
43
44
|
const densityValue = useGridSelector(apiRef, gridDensityValueSelector);
|
|
44
|
-
const headerGroupingMaxDepth = useGridSelector(apiRef,
|
|
45
|
+
const headerGroupingMaxDepth = useGridSelector(apiRef, gridColumnGroupsHeaderMaxDepthSelector);
|
|
45
46
|
const rootContainerRef = React.useRef(null);
|
|
46
47
|
const handleRef = useForkRef(rootContainerRef, ref);
|
|
47
48
|
const pinnedRowsCount = useGridSelector(apiRef, gridPinnedRowsCountSelector);
|
|
@@ -73,7 +74,7 @@ const GridRoot = /*#__PURE__*/React.forwardRef(function GridRoot(props, ref) {
|
|
|
73
74
|
role: "grid",
|
|
74
75
|
"aria-colcount": visibleColumns.length,
|
|
75
76
|
"aria-rowcount": headerGroupingMaxDepth + 1 + pinnedRowsCount + totalRowCount,
|
|
76
|
-
"aria-multiselectable": !rootProps.
|
|
77
|
+
"aria-multiselectable": !rootProps.disableMultipleRowSelection,
|
|
77
78
|
"aria-label": rootProps['aria-label'],
|
|
78
79
|
"aria-labelledby": rootProps['aria-labelledby']
|
|
79
80
|
}, other, {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { GridPanelWrapperProps } from './GridPanelWrapper';
|
|
3
|
+
import { GridStateColDef } from '../../models/colDef/gridColDef';
|
|
3
4
|
export interface GridColumnsPanelProps extends GridPanelWrapperProps {
|
|
4
5
|
sort?: 'asc' | 'desc';
|
|
6
|
+
searchPredicate?: (column: GridStateColDef, searchValue: string) => boolean;
|
|
5
7
|
}
|
|
6
8
|
declare function GridColumnsPanel(props: GridColumnsPanelProps): JSX.Element;
|
|
7
9
|
declare namespace GridColumnsPanel {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["sort"];
|
|
3
|
+
const _excluded = ["sort", "searchPredicate"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
@@ -59,6 +59,10 @@ const GridIconButtonRoot = styled(IconButton)({
|
|
|
59
59
|
});
|
|
60
60
|
const collator = new Intl.Collator();
|
|
61
61
|
|
|
62
|
+
const defaultSearchPredicate = (column, searchValue) => {
|
|
63
|
+
return (column.headerName || column.field).toLowerCase().indexOf(searchValue) > -1;
|
|
64
|
+
};
|
|
65
|
+
|
|
62
66
|
function GridColumnsPanel(props) {
|
|
63
67
|
var _rootProps$components, _rootProps$components3, _rootProps$components4;
|
|
64
68
|
|
|
@@ -74,7 +78,8 @@ function GridColumnsPanel(props) {
|
|
|
74
78
|
const classes = useUtilityClasses(ownerState);
|
|
75
79
|
|
|
76
80
|
const {
|
|
77
|
-
sort
|
|
81
|
+
sort,
|
|
82
|
+
searchPredicate = defaultSearchPredicate
|
|
78
83
|
} = props,
|
|
79
84
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
80
85
|
|
|
@@ -114,8 +119,8 @@ function GridColumnsPanel(props) {
|
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
const searchValueToCheck = searchValue.toLowerCase();
|
|
117
|
-
return sortedColumns.filter(column => (column
|
|
118
|
-
}, [sortedColumns, searchValue]);
|
|
122
|
+
return sortedColumns.filter(column => searchPredicate(column, searchValueToCheck));
|
|
123
|
+
}, [sortedColumns, searchValue, searchPredicate]);
|
|
119
124
|
React.useEffect(() => {
|
|
120
125
|
searchInputRef.current.focus();
|
|
121
126
|
}, []);
|
|
@@ -177,6 +182,7 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
177
182
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
178
183
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
179
184
|
// ----------------------------------------------------------------------
|
|
185
|
+
searchPredicate: PropTypes.func,
|
|
180
186
|
sort: PropTypes.oneOf(['asc', 'desc'])
|
|
181
187
|
} : void 0;
|
|
182
188
|
export { GridColumnsPanel };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GridFilterItem, GridLinkOperator } from '../../../models/gridFilterItem';
|
|
3
|
+
import { GridColDef, GridStateColDef } from '../../../models/colDef/gridColDef';
|
|
4
|
+
export interface FilterColumnsArgs {
|
|
5
|
+
field: GridColDef['field'];
|
|
6
|
+
columns: GridStateColDef[];
|
|
7
|
+
currentFilters: GridFilterItem[];
|
|
8
|
+
}
|
|
3
9
|
export interface GridFilterFormProps {
|
|
4
10
|
/**
|
|
5
11
|
* The [[GridFilterItem]] representing this form.
|
|
@@ -42,6 +48,12 @@ export interface GridFilterFormProps {
|
|
|
42
48
|
* @param {GridFilterItem} item The deleted [[GridFilterItem]].
|
|
43
49
|
*/
|
|
44
50
|
deleteFilter: (item: GridFilterItem) => void;
|
|
51
|
+
/**
|
|
52
|
+
* Allows to filter the columns displayed in the filter form.
|
|
53
|
+
* @param {FilterColumnsArgs} args The columns of the grid and name of field.
|
|
54
|
+
* @returns {GridColDef['field'][]} The filtered fields array.
|
|
55
|
+
*/
|
|
56
|
+
filterColumns?: (args: FilterColumnsArgs) => GridColDef['field'][];
|
|
45
57
|
/**
|
|
46
58
|
* Sets the available logic operators.
|
|
47
59
|
* @default [GridLinkOperator.And, GridLinkOperator.Or]
|