@mui/x-data-grid 5.15.2 → 5.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +177 -2
- package/DataGrid/DataGrid.js +3 -1
- package/DataGrid/useDataGridComponent.js +5 -0
- package/README.md +2 -1
- package/components/DataGridColumnHeaders.js +4 -3
- package/components/ErrorBoundary.d.ts +1 -0
- package/components/GridAutoSizer.js +7 -0
- package/components/GridRow.d.ts +2 -1
- package/components/GridRow.js +136 -85
- package/components/base/GridBody.js +8 -5
- package/components/base/GridOverlays.js +4 -7
- package/components/cell/GridActionsCellItem.d.ts +2 -2
- package/components/cell/GridBooleanCell.js +2 -1
- package/components/cell/GridEditBooleanCell.js +2 -1
- package/components/cell/GridEditDateCell.js +3 -2
- package/components/cell/GridEditInputCell.js +2 -1
- package/components/cell/GridEditSingleSelectCell.js +11 -2
- package/components/cell/GridSkeletonCell.d.ts +12 -0
- package/components/cell/GridSkeletonCell.js +60 -0
- package/components/cell/index.d.ts +1 -0
- package/components/cell/index.js +2 -1
- package/components/columnHeaders/GridColumnGroupHeader.d.ts +14 -0
- package/components/columnHeaders/GridColumnGroupHeader.js +122 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +55 -71
- package/components/columnHeaders/GridColumnHeadersInner.js +2 -1
- package/components/columnHeaders/GridGenericColumnHeaderItem.d.ts +32 -0
- package/components/columnHeaders/GridGenericColumnHeaderItem.js +104 -0
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/components/containers/GridOverlay.js +7 -1
- package/components/containers/GridRoot.js +3 -3
- package/components/containers/GridRootStyles.js +16 -2
- package/components/menu/GridMenu.d.ts +3 -2
- package/components/menu/GridMenu.js +1 -0
- package/components/menu/columnMenu/GridColumnHeaderMenu.d.ts +1 -1
- package/components/panel/GridColumnsPanel.d.ts +6 -1
- package/components/panel/GridColumnsPanel.js +38 -6
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/GridPanel.js +1 -0
- package/components/panel/filterPanel/GridFilterForm.d.ts +4 -0
- package/components/panel/filterPanel/GridFilterForm.js +5 -0
- package/components/panel/filterPanel/GridFilterInputMultipleValue.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterPanel.d.ts +4 -0
- package/components/panel/filterPanel/GridFilterPanel.js +5 -0
- package/components/toolbar/GridToolbarColumnsButton.d.ts +1 -1
- package/components/toolbar/GridToolbarDensitySelector.d.ts +1 -1
- package/components/toolbar/GridToolbarExportContainer.d.ts +1 -1
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +24 -0
- package/constants/gridClasses.js +1 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +5 -1
- package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.d.ts +7 -0
- package/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +1 -0
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +7 -0
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.js +8 -0
- package/hooks/features/columnGrouping/index.d.ts +2 -0
- package/hooks/features/columnGrouping/index.js +2 -0
- package/hooks/features/columnGrouping/useGridColumnGrouping.d.ts +24 -0
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +153 -0
- package/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.d.ts +4 -0
- package/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +35 -0
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +7 -6
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +204 -9
- package/hooks/features/density/densitySelector.d.ts +2 -0
- package/hooks/features/density/densitySelector.js +3 -1
- package/hooks/features/density/densityState.d.ts +1 -0
- package/hooks/features/density/useGridDensity.d.ts +1 -1
- package/hooks/features/density/useGridDensity.js +45 -9
- package/hooks/features/dimensions/useGridDimensions.js +4 -4
- package/hooks/features/export/useGridPrintExport.js +3 -3
- package/hooks/features/filter/gridFilterSelector.d.ts +3 -3
- package/hooks/features/filter/gridFilterUtils.d.ts +1 -1
- package/hooks/features/filter/gridFilterUtils.js +55 -54
- package/hooks/features/filter/useGridFilter.js +1 -1
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/pagination/gridPaginationSelector.d.ts +1 -1
- package/hooks/features/rows/gridRowsSelector.d.ts +1 -1
- package/hooks/features/rows/useGridParamsApi.js +1 -1
- package/hooks/features/rows/useGridRows.js +65 -8
- package/hooks/features/rows/useGridRowsMeta.js +36 -16
- package/hooks/features/selection/gridSelectionSelector.d.ts +1 -1
- package/hooks/features/sorting/gridSortingSelector.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/hooks/utils/useGridNativeEventListener.d.ts +1 -1
- package/hooks/utils/useGridNativeEventListener.js +2 -2
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +2 -0
- package/legacy/DataGrid/DataGrid.js +3 -1
- package/legacy/DataGrid/useDataGridComponent.js +5 -0
- package/legacy/components/DataGridColumnHeaders.js +4 -3
- package/legacy/components/GridAutoSizer.js +7 -0
- package/legacy/components/GridRow.js +138 -85
- package/legacy/components/base/GridBody.js +8 -5
- package/legacy/components/base/GridOverlays.js +4 -7
- package/legacy/components/cell/GridBooleanCell.js +2 -1
- package/legacy/components/cell/GridEditBooleanCell.js +2 -1
- package/legacy/components/cell/GridEditDateCell.js +3 -2
- package/legacy/components/cell/GridEditInputCell.js +2 -1
- package/legacy/components/cell/GridEditSingleSelectCell.js +11 -2
- package/legacy/components/cell/GridSkeletonCell.js +57 -0
- package/legacy/components/cell/index.js +2 -1
- package/legacy/components/columnHeaders/GridColumnGroupHeader.js +120 -0
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +78 -88
- package/legacy/components/columnHeaders/GridColumnHeadersInner.js +2 -1
- package/legacy/components/columnHeaders/GridGenericColumnHeaderItem.js +112 -0
- package/legacy/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/legacy/components/containers/GridOverlay.js +7 -1
- package/legacy/components/containers/GridRoot.js +3 -3
- package/legacy/components/containers/GridRootStyles.js +14 -5
- package/legacy/components/menu/GridMenu.js +1 -0
- package/legacy/components/panel/GridColumnsPanel.js +41 -6
- package/legacy/components/panel/GridPanel.js +1 -0
- package/legacy/components/panel/filterPanel/GridFilterForm.js +5 -0
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +5 -0
- package/legacy/constants/defaultGridSlotsComponents.js +2 -1
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +1 -0
- package/legacy/hooks/features/columnGrouping/gridColumnGroupsSelector.js +12 -0
- package/legacy/hooks/features/columnGrouping/index.js +2 -0
- package/legacy/hooks/features/columnGrouping/useGridColumnGrouping.js +151 -0
- package/legacy/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +35 -0
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +213 -12
- package/legacy/hooks/features/density/densitySelector.js +6 -0
- package/legacy/hooks/features/density/useGridDensity.js +44 -6
- package/legacy/hooks/features/dimensions/useGridDimensions.js +4 -4
- package/legacy/hooks/features/export/useGridPrintExport.js +3 -3
- package/legacy/hooks/features/filter/gridFilterUtils.js +61 -56
- package/legacy/hooks/features/filter/useGridFilter.js +1 -1
- package/legacy/hooks/features/index.js +1 -0
- package/legacy/hooks/features/rows/useGridParamsApi.js +1 -1
- package/legacy/hooks/features/rows/useGridRows.js +73 -8
- package/legacy/hooks/features/rows/useGridRowsMeta.js +45 -18
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +31 -13
- package/legacy/hooks/utils/useGridNativeEventListener.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +2 -0
- package/legacy/models/api/gridColumnGroupingApi.js +1 -0
- package/legacy/models/events/gridEvents.js +2 -0
- package/legacy/models/gridColumnGrouping.js +6 -0
- package/legacy/models/index.js +2 -1
- package/legacy/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/legacy/models/params/index.js +2 -1
- package/legacy/utils/utils.js +18 -0
- package/models/api/gridApiCommon.d.ts +2 -1
- package/models/api/gridColumnGroupingApi.d.ts +19 -0
- package/models/api/gridColumnGroupingApi.js +1 -0
- package/models/api/gridDensityApi.d.ts +2 -1
- package/models/api/gridParamsApi.d.ts +1 -1
- package/models/api/gridRowApi.d.ts +6 -0
- package/models/api/gridRowsMetaApi.d.ts +6 -1
- package/models/colDef/gridColDef.d.ts +15 -1
- package/models/events/gridEventLookup.d.ts +7 -1
- package/models/events/gridEvents.d.ts +3 -1
- package/models/events/gridEvents.js +2 -0
- package/models/gridColumnGrouping.d.ts +67 -0
- package/models/gridColumnGrouping.js +6 -0
- package/models/gridRows.d.ts +5 -5
- package/models/gridSlotsComponent.d.ts +5 -0
- package/models/gridStateCommunity.d.ts +2 -1
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/models/params/gridCellParams.d.ts +7 -2
- package/models/params/gridMenuParams.d.ts +1 -2
- package/models/params/gridRenderedRowsIntervalChangeParams.d.ts +10 -0
- package/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/models/params/index.d.ts +1 -0
- package/models/params/index.js +2 -1
- package/models/props/DataGridProps.d.ts +7 -1
- package/modern/DataGrid/DataGrid.js +3 -1
- package/modern/DataGrid/useDataGridComponent.js +5 -0
- package/modern/components/DataGridColumnHeaders.js +4 -3
- package/modern/components/GridAutoSizer.js +7 -0
- package/modern/components/GridRow.js +133 -84
- package/modern/components/base/GridBody.js +8 -5
- package/modern/components/base/GridOverlays.js +4 -7
- package/modern/components/cell/GridBooleanCell.js +2 -1
- package/modern/components/cell/GridEditBooleanCell.js +2 -1
- package/modern/components/cell/GridEditDateCell.js +3 -2
- package/modern/components/cell/GridEditInputCell.js +2 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +11 -2
- package/modern/components/cell/GridSkeletonCell.js +60 -0
- package/modern/components/cell/index.js +2 -1
- package/modern/components/columnHeaders/GridColumnGroupHeader.js +120 -0
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +53 -69
- package/modern/components/columnHeaders/GridColumnHeadersInner.js +2 -1
- package/modern/components/columnHeaders/GridGenericColumnHeaderItem.js +104 -0
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/modern/components/containers/GridOverlay.js +7 -1
- package/modern/components/containers/GridRoot.js +3 -3
- package/modern/components/containers/GridRootStyles.js +16 -2
- package/modern/components/menu/GridMenu.js +1 -0
- package/modern/components/panel/GridColumnsPanel.js +38 -6
- package/modern/components/panel/GridPanel.js +1 -0
- package/modern/components/panel/filterPanel/GridFilterForm.js +5 -0
- package/modern/components/panel/filterPanel/GridFilterPanel.js +5 -0
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +1 -0
- package/modern/hooks/features/columnGrouping/gridColumnGroupsSelector.js +8 -0
- package/modern/hooks/features/columnGrouping/index.js +2 -0
- package/modern/hooks/features/columnGrouping/useGridColumnGrouping.js +145 -0
- package/modern/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +29 -0
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +186 -9
- package/modern/hooks/features/density/densitySelector.js +3 -1
- package/modern/hooks/features/density/useGridDensity.js +37 -9
- package/modern/hooks/features/dimensions/useGridDimensions.js +4 -4
- package/modern/hooks/features/export/useGridPrintExport.js +3 -3
- package/modern/hooks/features/filter/gridFilterUtils.js +54 -53
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/rows/useGridParamsApi.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +65 -8
- package/modern/hooks/features/rows/useGridRowsMeta.js +36 -16
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/modern/hooks/utils/useGridNativeEventListener.js +2 -2
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -0
- package/modern/models/api/gridColumnGroupingApi.js +1 -0
- package/modern/models/events/gridEvents.js +2 -0
- package/modern/models/gridColumnGrouping.js +6 -0
- package/modern/models/index.js +2 -1
- package/modern/models/params/gridRenderedRowsIntervalChangeParams.js +1 -0
- package/modern/models/params/index.js +2 -1
- package/modern/utils/utils.js +16 -0
- package/node/DataGrid/DataGrid.js +3 -1
- package/node/DataGrid/useDataGridComponent.js +7 -0
- package/node/components/DataGridColumnHeaders.js +4 -3
- package/node/components/GridAutoSizer.js +7 -0
- package/node/components/GridRow.js +136 -77
- package/node/components/base/GridBody.js +7 -4
- package/node/components/base/GridOverlays.js +3 -6
- package/node/components/cell/GridBooleanCell.js +2 -1
- package/node/components/cell/GridEditBooleanCell.js +2 -1
- package/node/components/cell/GridEditDateCell.js +3 -2
- package/node/components/cell/GridEditInputCell.js +2 -1
- package/node/components/cell/GridEditSingleSelectCell.js +11 -2
- package/node/components/cell/GridSkeletonCell.js +81 -0
- package/node/components/cell/index.js +13 -0
- package/node/components/columnHeaders/GridColumnGroupHeader.js +141 -0
- package/node/components/columnHeaders/GridColumnHeaderItem.js +53 -72
- package/node/components/columnHeaders/GridColumnHeadersInner.js +2 -1
- package/node/components/columnHeaders/GridGenericColumnHeaderItem.js +126 -0
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -1
- package/node/components/containers/GridOverlay.js +7 -1
- package/node/components/containers/GridRoot.js +4 -4
- package/node/components/containers/GridRootStyles.js +16 -2
- package/node/components/menu/GridMenu.js +1 -0
- package/node/components/panel/GridColumnsPanel.js +36 -5
- package/node/components/panel/GridPanel.js +1 -0
- package/node/components/panel/filterPanel/GridFilterForm.js +5 -0
- package/node/components/panel/filterPanel/GridFilterPanel.js +5 -0
- package/node/constants/defaultGridSlotsComponents.js +1 -0
- package/node/constants/gridClasses.js +1 -1
- package/node/hooks/features/columnGrouping/gridColumnGroupsInterfaces.js +5 -0
- package/node/hooks/features/columnGrouping/gridColumnGroupsSelector.js +18 -0
- package/node/hooks/features/columnGrouping/index.js +18 -0
- package/node/hooks/features/columnGrouping/useGridColumnGrouping.js +182 -0
- package/node/hooks/features/columnGrouping/useGridColumnGroupingPreProcessors.js +55 -0
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +207 -8
- package/node/hooks/features/density/densitySelector.js +6 -2
- package/node/hooks/features/density/useGridDensity.js +48 -9
- package/node/hooks/features/dimensions/useGridDimensions.js +3 -3
- package/node/hooks/features/export/useGridPrintExport.js +2 -2
- package/node/hooks/features/filter/gridFilterUtils.js +55 -55
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/index.js +13 -0
- package/node/hooks/features/rows/useGridParamsApi.js +1 -1
- package/node/hooks/features/rows/useGridRows.js +60 -7
- package/node/hooks/features/rows/useGridRowsMeta.js +35 -15
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -5
- package/node/hooks/utils/useGridNativeEventListener.js +2 -2
- package/node/index.js +1 -1
- package/node/internals/index.js +22 -0
- package/node/models/api/gridColumnGroupingApi.js +5 -0
- package/node/models/events/gridEvents.js +2 -0
- package/node/models/gridColumnGrouping.js +13 -0
- package/node/models/index.js +13 -0
- package/node/models/params/gridRenderedRowsIntervalChangeParams.js +5 -0
- package/node/models/params/index.js +13 -0
- package/node/utils/utils.js +18 -0
- package/package.json +3 -3
- package/utils/utils.d.ts +1 -0
- package/utils/utils.js +16 -0
|
@@ -79,6 +79,7 @@ DataGridRaw.propTypes = {
|
|
|
79
79
|
* @default 3
|
|
80
80
|
*/
|
|
81
81
|
columnBuffer: PropTypes.number,
|
|
82
|
+
columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
|
|
82
83
|
|
|
83
84
|
/**
|
|
84
85
|
* Set of columns of type [[GridColumns]].
|
|
@@ -194,6 +195,7 @@ DataGridRaw.propTypes = {
|
|
|
194
195
|
* For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
|
|
195
196
|
*/
|
|
196
197
|
experimentalFeatures: PropTypes.shape({
|
|
198
|
+
columnGrouping: PropTypes.bool,
|
|
197
199
|
newEditingApi: PropTypes.bool,
|
|
198
200
|
preventCommitWhileValidating: PropTypes.bool,
|
|
199
201
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
@@ -347,7 +349,7 @@ DataGridRaw.propTypes = {
|
|
|
347
349
|
|
|
348
350
|
/**
|
|
349
351
|
* Allows to pass the logging level or false to turn off logging.
|
|
350
|
-
* @default "
|
|
352
|
+
* @default "error" ("warn" in dev mode)
|
|
351
353
|
*/
|
|
352
354
|
logLevel: PropTypes.oneOf(['debug', 'error', 'info', 'warn', false]),
|
|
353
355
|
|
|
@@ -25,12 +25,15 @@ import { useGridDimensions } from '../hooks/features/dimensions/useGridDimension
|
|
|
25
25
|
import { rowsMetaStateInitializer, useGridRowsMeta } from '../hooks/features/rows/useGridRowsMeta';
|
|
26
26
|
import { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
27
27
|
import { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
|
|
28
|
+
import { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
29
|
+
import { useGridColumnGroupingPreProcessors } from '../hooks/features/columnGrouping/useGridColumnGroupingPreProcessors';
|
|
28
30
|
export const useDataGridComponent = props => {
|
|
29
31
|
const apiRef = useGridInitialization(undefined, props);
|
|
30
32
|
/**
|
|
31
33
|
* Register all pre-processors called during state initialization here.
|
|
32
34
|
*/
|
|
33
35
|
|
|
36
|
+
useGridColumnGroupingPreProcessors(apiRef, props);
|
|
34
37
|
useGridSelectionPreProcessors(apiRef, props);
|
|
35
38
|
useGridRowsPreProcessors(apiRef);
|
|
36
39
|
/**
|
|
@@ -39,6 +42,7 @@ export const useDataGridComponent = props => {
|
|
|
39
42
|
|
|
40
43
|
useGridInitializeState(selectionStateInitializer, apiRef, props);
|
|
41
44
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
45
|
+
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
42
46
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
43
47
|
useGridInitializeState(props.experimentalFeatures?.newEditingApi ? editingStateInitializer_new : editingStateInitializer_old, apiRef, props);
|
|
44
48
|
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
@@ -55,6 +59,7 @@ export const useDataGridComponent = props => {
|
|
|
55
59
|
useGridRows(apiRef, props);
|
|
56
60
|
useGridParamsApi(apiRef);
|
|
57
61
|
useGridColumnSpanning(apiRef);
|
|
62
|
+
useGridColumnGrouping(apiRef, props);
|
|
58
63
|
const useGridEditing = props.experimentalFeatures?.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
59
64
|
useGridEditing(apiRef, props);
|
|
60
65
|
useGridFocus(apiRef, props);
|
|
@@ -18,7 +18,8 @@ export const DataGridColumnHeaders = /*#__PURE__*/React.forwardRef(function Grid
|
|
|
18
18
|
isDragging,
|
|
19
19
|
getRootProps,
|
|
20
20
|
getInnerProps,
|
|
21
|
-
|
|
21
|
+
getColumnHeaders,
|
|
22
|
+
getColumnGroupHeaders
|
|
22
23
|
} = useGridColumnHeaders({
|
|
23
24
|
innerRef
|
|
24
25
|
});
|
|
@@ -27,10 +28,10 @@ export const DataGridColumnHeaders = /*#__PURE__*/React.forwardRef(function Grid
|
|
|
27
28
|
}, getRootProps(other), {
|
|
28
29
|
children: [/*#__PURE__*/_jsx(GridScrollArea, {
|
|
29
30
|
scrollDirection: "left"
|
|
30
|
-
}), /*#__PURE__*/
|
|
31
|
+
}), /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
|
|
31
32
|
isDragging: isDragging
|
|
32
33
|
}, getInnerProps(), {
|
|
33
|
-
children:
|
|
34
|
+
children: [getColumnGroupHeaders(), getColumnHeaders()]
|
|
34
35
|
})), /*#__PURE__*/_jsx(GridScrollArea, {
|
|
35
36
|
scrollDirection: "right"
|
|
36
37
|
})]
|
|
@@ -104,6 +104,13 @@ process.env.NODE_ENV !== "production" ? GridAutoSizer.propTypes = {
|
|
|
104
104
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
105
105
|
// ----------------------------------------------------------------------
|
|
106
106
|
|
|
107
|
+
/**
|
|
108
|
+
* Function responsible for rendering children.
|
|
109
|
+
* @param {AutoSizerSize} size The grid's size.
|
|
110
|
+
* @returns {React.ReactNode} The children to render.
|
|
111
|
+
*/
|
|
112
|
+
children: PropTypes.func.isRequired,
|
|
113
|
+
|
|
107
114
|
/**
|
|
108
115
|
* Default height to use for initial render; useful for SSR.
|
|
109
116
|
* @default null
|
|
@@ -1,10 +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 = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
4
|
-
|
|
5
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
6
|
-
|
|
7
|
-
/* eslint-disable jsx-a11y/interactive-supports-focus */
|
|
3
|
+
const _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
8
4
|
import * as React from 'react';
|
|
9
5
|
import PropTypes from 'prop-types';
|
|
10
6
|
import clsx from 'clsx';
|
|
@@ -22,6 +18,8 @@ import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
|
22
18
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
23
19
|
import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
|
|
24
20
|
import { gridRowTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
21
|
+
import { gridDensityHeaderGroupingMaxDepthSelector } from '../hooks/features/density/densitySelector';
|
|
22
|
+
import { randomNumberBetween } from '../utils/utils';
|
|
25
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
25
|
|
|
@@ -63,6 +61,7 @@ function GridRow(props) {
|
|
|
63
61
|
row,
|
|
64
62
|
index,
|
|
65
63
|
style: styleProp,
|
|
64
|
+
position,
|
|
66
65
|
rowHeight,
|
|
67
66
|
className,
|
|
68
67
|
visibleColumns,
|
|
@@ -80,8 +79,6 @@ function GridRow(props) {
|
|
|
80
79
|
} = props,
|
|
81
80
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
82
81
|
|
|
83
|
-
const ariaRowIndex = index + 2; // 1 for the header row and 1 as it's 1-based
|
|
84
|
-
|
|
85
82
|
const apiRef = useGridApiContext();
|
|
86
83
|
const ref = React.useRef(null);
|
|
87
84
|
const rootProps = useGridRootProps();
|
|
@@ -89,6 +86,9 @@ function GridRow(props) {
|
|
|
89
86
|
const columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
90
87
|
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
91
88
|
const treeDepth = useGridSelector(apiRef, gridRowTreeDepthSelector);
|
|
89
|
+
const headerGroupingMaxDepth = useGridSelector(apiRef, gridDensityHeaderGroupingMaxDepthSelector);
|
|
90
|
+
const ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
91
|
+
|
|
92
92
|
const {
|
|
93
93
|
hasScrollX,
|
|
94
94
|
hasScrollY
|
|
@@ -108,9 +108,9 @@ function GridRow(props) {
|
|
|
108
108
|
React.useLayoutEffect(() => {
|
|
109
109
|
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
110
110
|
// Fallback for IE
|
|
111
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
111
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight, position);
|
|
112
112
|
}
|
|
113
|
-
}, [apiRef, rowHeight, rowId]);
|
|
113
|
+
}, [apiRef, rowHeight, rowId, position]);
|
|
114
114
|
React.useLayoutEffect(() => {
|
|
115
115
|
if (currentPage.range) {
|
|
116
116
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -135,11 +135,11 @@ function GridRow(props) {
|
|
|
135
135
|
const resizeObserver = new ResizeObserver(entries => {
|
|
136
136
|
const [entry] = entries;
|
|
137
137
|
const height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
138
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
|
|
138
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height, position);
|
|
139
139
|
});
|
|
140
140
|
resizeObserver.observe(rootElement);
|
|
141
141
|
return () => resizeObserver.disconnect();
|
|
142
|
-
}, [apiRef, currentPage.range, index, rowHeight, rowId]);
|
|
142
|
+
}, [apiRef, currentPage.range, index, rowHeight, rowId, position]);
|
|
143
143
|
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
144
144
|
// Ignore portal
|
|
145
145
|
// The target is not an element when triggered by a Select inside the cell
|
|
@@ -195,47 +195,7 @@ function GridRow(props) {
|
|
|
195
195
|
|
|
196
196
|
publish('rowClick', onClick)(event);
|
|
197
197
|
}, [apiRef, onClick, publish, rowId]);
|
|
198
|
-
|
|
199
|
-
const style = _extends({}, styleProp, {
|
|
200
|
-
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
201
|
-
// max-height doesn't support "auto"
|
|
202
|
-
minHeight: rowHeight
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
206
|
-
|
|
207
|
-
if (sizes?.spacingTop) {
|
|
208
|
-
const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
209
|
-
style[property] = sizes.spacingTop;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (sizes?.spacingBottom) {
|
|
213
|
-
const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
214
|
-
style[property] = sizes.spacingBottom;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
let rowClassName = null;
|
|
218
|
-
|
|
219
|
-
if (typeof rootProps.getRowClassName === 'function') {
|
|
220
|
-
const indexRelativeToCurrentPage = index - currentPage.range.firstRowIndex;
|
|
221
|
-
|
|
222
|
-
const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
223
|
-
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
224
|
-
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
225
|
-
indexRelativeToCurrentPage
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
rowClassName = rootProps.getRowClassName(rowParams);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
const cells = [];
|
|
232
|
-
|
|
233
|
-
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
234
|
-
const column = renderedColumns[i];
|
|
235
|
-
const indexRelativeToAllColumns = firstColumnToRender + i;
|
|
236
|
-
const isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
237
|
-
const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
238
|
-
const showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
198
|
+
const getCell = React.useCallback((column, cellProps) => {
|
|
239
199
|
const cellParams = apiRef.current.getCellParams(rowId, column.field);
|
|
240
200
|
const classNames = [];
|
|
241
201
|
const disableDragEvents = rootProps.disableColumnReorder && column.disableReorder || !rootProps.rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
|
|
@@ -281,51 +241,139 @@ function GridRow(props) {
|
|
|
281
241
|
|
|
282
242
|
const hasFocus = cellFocus !== null && cellFocus.id === rowId && cellFocus.field === column.field;
|
|
283
243
|
const tabIndex = cellTabIndex !== null && cellTabIndex.id === rowId && cellTabIndex.field === column.field && cellParams.cellMode === 'view' ? 0 : -1;
|
|
244
|
+
return /*#__PURE__*/_jsx(rootProps.components.Cell, _extends({
|
|
245
|
+
value: cellParams.value,
|
|
246
|
+
field: column.field,
|
|
247
|
+
width: cellProps.width,
|
|
248
|
+
rowId: rowId,
|
|
249
|
+
height: rowHeight,
|
|
250
|
+
showRightBorder: cellProps.showRightBorder,
|
|
251
|
+
formattedValue: cellParams.formattedValue,
|
|
252
|
+
align: column.align || 'left',
|
|
253
|
+
cellMode: cellParams.cellMode,
|
|
254
|
+
colIndex: cellProps.indexRelativeToAllColumns,
|
|
255
|
+
isEditable: cellParams.isEditable,
|
|
256
|
+
hasFocus: hasFocus,
|
|
257
|
+
tabIndex: tabIndex,
|
|
258
|
+
className: clsx(classNames),
|
|
259
|
+
colSpan: cellProps.colSpan,
|
|
260
|
+
disableDragEvents: disableDragEvents
|
|
261
|
+
}, rootProps.componentsProps?.cell, {
|
|
262
|
+
children: content
|
|
263
|
+
}), column.field);
|
|
264
|
+
}, [apiRef, cellTabIndex, editRowsState, cellFocus, rootProps, row, rowHeight, rowId, treeDepth, sortModel.length]);
|
|
265
|
+
const sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
266
|
+
let minHeight = rowHeight;
|
|
267
|
+
|
|
268
|
+
if (minHeight === 'auto' && sizes) {
|
|
269
|
+
let numberOfBaseSizes = 0;
|
|
270
|
+
const maximumSize = Object.entries(sizes).reduce((acc, [key, size]) => {
|
|
271
|
+
const isBaseHeight = /^base[A-Z]/.test(key);
|
|
272
|
+
|
|
273
|
+
if (!isBaseHeight) {
|
|
274
|
+
return acc;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
numberOfBaseSizes += 1;
|
|
278
|
+
|
|
279
|
+
if (size > acc) {
|
|
280
|
+
return size;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return acc;
|
|
284
|
+
}, 0);
|
|
285
|
+
|
|
286
|
+
if (maximumSize > 0 && numberOfBaseSizes > 1) {
|
|
287
|
+
minHeight = maximumSize;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
const style = _extends({}, styleProp, {
|
|
292
|
+
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
293
|
+
// max-height doesn't support "auto"
|
|
294
|
+
minHeight
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
if (sizes?.spacingTop) {
|
|
298
|
+
const property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
299
|
+
style[property] = sizes.spacingTop;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (sizes?.spacingBottom) {
|
|
303
|
+
const property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
304
|
+
style[property] = sizes.spacingBottom;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
const rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
308
|
+
|
|
309
|
+
if (typeof rootProps.getRowClassName === 'function') {
|
|
310
|
+
const indexRelativeToCurrentPage = index - (currentPage.range?.firstRowIndex || 0);
|
|
311
|
+
|
|
312
|
+
const rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
313
|
+
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
314
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
315
|
+
indexRelativeToCurrentPage
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const randomNumber = randomNumberBetween(10000, 20, 80);
|
|
322
|
+
const cells = [];
|
|
323
|
+
|
|
324
|
+
for (let i = 0; i < renderedColumns.length; i += 1) {
|
|
325
|
+
const column = renderedColumns[i];
|
|
326
|
+
const indexRelativeToAllColumns = firstColumnToRender + i;
|
|
327
|
+
const isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
328
|
+
const removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
329
|
+
const showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
284
330
|
const cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
285
331
|
|
|
286
332
|
if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
333
|
+
if (row) {
|
|
334
|
+
const {
|
|
335
|
+
colSpan,
|
|
336
|
+
width
|
|
337
|
+
} = cellColSpanInfo.cellProps;
|
|
338
|
+
const cellProps = {
|
|
339
|
+
width,
|
|
340
|
+
colSpan,
|
|
341
|
+
showRightBorder,
|
|
342
|
+
indexRelativeToAllColumns
|
|
343
|
+
};
|
|
344
|
+
cells.push(getCell(column, cellProps));
|
|
345
|
+
} else {
|
|
346
|
+
const {
|
|
347
|
+
width
|
|
348
|
+
} = cellColSpanInfo.cellProps;
|
|
349
|
+
const contentWidth = Math.round(randomNumber());
|
|
350
|
+
cells.push( /*#__PURE__*/_jsx(rootProps.components.SkeletonCell, {
|
|
351
|
+
width: width,
|
|
352
|
+
contentWidth: contentWidth,
|
|
353
|
+
field: column.field,
|
|
354
|
+
align: column.align
|
|
355
|
+
}, column.field));
|
|
356
|
+
}
|
|
311
357
|
}
|
|
312
358
|
}
|
|
313
359
|
|
|
314
360
|
const emptyCellWidth = containerWidth - columnsTotalWidth;
|
|
361
|
+
const eventHandlers = row ? {
|
|
362
|
+
onClick: publishClick,
|
|
363
|
+
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
364
|
+
onMouseEnter: publish('rowMouseEnter', onMouseEnter),
|
|
365
|
+
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
366
|
+
} : null;
|
|
315
367
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
316
368
|
ref: ref,
|
|
317
369
|
"data-id": rowId,
|
|
318
370
|
"data-rowindex": index,
|
|
319
371
|
role: "row",
|
|
320
|
-
className: clsx(
|
|
372
|
+
className: clsx(...rowClassNames, classes.root, className),
|
|
321
373
|
"aria-rowindex": ariaRowIndex,
|
|
322
374
|
"aria-selected": selected,
|
|
323
|
-
style: style
|
|
324
|
-
|
|
325
|
-
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
326
|
-
onMouseEnter: publish('rowMouseEnter', onMouseEnter),
|
|
327
|
-
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
328
|
-
}, other, {
|
|
375
|
+
style: style
|
|
376
|
+
}, eventHandlers, other, {
|
|
329
377
|
children: [cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
|
|
330
378
|
width: emptyCellWidth
|
|
331
379
|
})]
|
|
@@ -350,8 +398,9 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
350
398
|
index: PropTypes.number.isRequired,
|
|
351
399
|
isLastVisible: PropTypes.bool,
|
|
352
400
|
lastColumnToRender: PropTypes.number.isRequired,
|
|
401
|
+
position: PropTypes.oneOf(['center', 'left', 'right']).isRequired,
|
|
353
402
|
renderedColumns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
354
|
-
row: PropTypes.
|
|
403
|
+
row: PropTypes.object,
|
|
355
404
|
rowHeight: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
|
|
356
405
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
357
406
|
selected: PropTypes.bool.isRequired,
|
|
@@ -6,7 +6,7 @@ import { GridAutoSizer } from '../GridAutoSizer';
|
|
|
6
6
|
import { GridOverlays } from './GridOverlays';
|
|
7
7
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
8
8
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
9
|
-
import {
|
|
9
|
+
import { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
|
|
@@ -18,14 +18,17 @@ function GridBody(props) {
|
|
|
18
18
|
} = props;
|
|
19
19
|
const apiRef = useGridApiContext();
|
|
20
20
|
const rootProps = useGridRootProps();
|
|
21
|
-
const
|
|
21
|
+
const totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);
|
|
22
22
|
const [isVirtualizationDisabled, setIsVirtualizationDisabled] = React.useState(rootProps.disableVirtualization);
|
|
23
23
|
const disableVirtualization = React.useCallback(() => {
|
|
24
24
|
setIsVirtualizationDisabled(true);
|
|
25
25
|
}, []);
|
|
26
26
|
const enableVirtualization = React.useCallback(() => {
|
|
27
27
|
setIsVirtualizationDisabled(false);
|
|
28
|
-
}, []);
|
|
28
|
+
}, []);
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
setIsVirtualizationDisabled(rootProps.disableVirtualization);
|
|
31
|
+
}, [rootProps.disableVirtualization]); // The `useGridApiMethod` hook can't be used here, because it only installs the
|
|
29
32
|
// method if it doesn't exist yet. Once installed, it's never updated again.
|
|
30
33
|
// This break the methods above, since their closure comes from the first time
|
|
31
34
|
// they were installed. Which means that calling `setIsVirtualizationDisabled`
|
|
@@ -60,8 +63,8 @@ function GridBody(props) {
|
|
|
60
63
|
width: size.width,
|
|
61
64
|
// If `autoHeight` is on, there will be no height value.
|
|
62
65
|
// In this case, let the container to grow whatever it needs.
|
|
63
|
-
height: size.height ? size.height -
|
|
64
|
-
marginTop:
|
|
66
|
+
height: size.height ? size.height - totalHeaderHeight : 'auto',
|
|
67
|
+
marginTop: totalHeaderHeight
|
|
65
68
|
};
|
|
66
69
|
return /*#__PURE__*/_jsx(VirtualScrollerComponent, {
|
|
67
70
|
ref: windowRef,
|
|
@@ -6,13 +6,13 @@ import { gridVisibleRowCountSelector } from '../../hooks/features/filter/gridFil
|
|
|
6
6
|
import { gridRowCountSelector, gridRowsLoadingSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
7
7
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
8
8
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
|
-
import {
|
|
9
|
+
import { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
|
|
12
12
|
function GridOverlayWrapper(props) {
|
|
13
13
|
const apiRef = useGridApiContext();
|
|
14
14
|
const rootProps = useGridRootProps();
|
|
15
|
-
const
|
|
15
|
+
const totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);
|
|
16
16
|
const [viewportInnerSize, setViewportInnerSize] = React.useState(() => apiRef.current.getRootDimensions()?.viewportInnerSize ?? null);
|
|
17
17
|
const handleViewportSizeChange = React.useCallback(() => {
|
|
18
18
|
setViewportInnerSize(apiRef.current.getRootDimensions()?.viewportInnerSize ?? null);
|
|
@@ -35,11 +35,8 @@ function GridOverlayWrapper(props) {
|
|
|
35
35
|
height,
|
|
36
36
|
width: viewportInnerSize?.width ?? 0,
|
|
37
37
|
position: 'absolute',
|
|
38
|
-
top:
|
|
39
|
-
bottom: height === 'auto' ? 0 : undefined
|
|
40
|
-
zIndex: 4,
|
|
41
|
-
// should be above pinned columns, pinned rows and detail panel
|
|
42
|
-
pointerEvents: 'none'
|
|
38
|
+
top: totalHeaderHeight,
|
|
39
|
+
bottom: height === 'auto' ? 0 : undefined
|
|
43
40
|
}
|
|
44
41
|
}, props));
|
|
45
42
|
}
|
|
@@ -123,7 +123,8 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
123
123
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
124
124
|
|
|
125
125
|
/**
|
|
126
|
-
* The cell value
|
|
126
|
+
* The cell value.
|
|
127
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
127
128
|
*/
|
|
128
129
|
value: PropTypes.any
|
|
129
130
|
} : void 0;
|
|
@@ -159,7 +159,8 @@ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes = {
|
|
|
159
159
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
|
-
* The cell value
|
|
162
|
+
* The cell value.
|
|
163
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
163
164
|
*/
|
|
164
165
|
value: PropTypes.any
|
|
165
166
|
} : void 0;
|
|
@@ -81,7 +81,7 @@ function GridEditDateCell(props) {
|
|
|
81
81
|
const [date, time] = newFormattedDate.split('T');
|
|
82
82
|
const [year, month, day] = date.split('-');
|
|
83
83
|
newParsedDate = new Date();
|
|
84
|
-
newParsedDate.setFullYear(year, Number(month) - 1, day);
|
|
84
|
+
newParsedDate.setFullYear(Number(year), Number(month) - 1, Number(day));
|
|
85
85
|
newParsedDate.setHours(0, 0, 0, 0);
|
|
86
86
|
|
|
87
87
|
if (time) {
|
|
@@ -213,7 +213,8 @@ process.env.NODE_ENV !== "production" ? GridEditDateCell.propTypes = {
|
|
|
213
213
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
214
214
|
|
|
215
215
|
/**
|
|
216
|
-
* The cell value
|
|
216
|
+
* The cell value.
|
|
217
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
217
218
|
*/
|
|
218
219
|
value: PropTypes.any
|
|
219
220
|
} : void 0;
|
|
@@ -176,7 +176,8 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
176
176
|
tabIndex: PropTypes.oneOf([-1, 0]),
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
|
-
* The cell value
|
|
179
|
+
* The cell value.
|
|
180
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
180
181
|
*/
|
|
181
182
|
value: PropTypes.any
|
|
182
183
|
} : void 0;
|
|
@@ -23,6 +23,10 @@ const renderSingleSelectOptions = (option, OptionComponent) => {
|
|
|
23
23
|
}, key);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
function isKeyboardEvent(event) {
|
|
27
|
+
return !!event.key;
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
function GridEditSingleSelectCell(props) {
|
|
27
31
|
const rootProps = useGridRootProps();
|
|
28
32
|
|
|
@@ -136,7 +140,11 @@ function GridEditSingleSelectCell(props) {
|
|
|
136
140
|
}
|
|
137
141
|
};
|
|
138
142
|
|
|
139
|
-
const handleOpen =
|
|
143
|
+
const handleOpen = event => {
|
|
144
|
+
if (isKeyboardEvent(event) && event.key === 'Enter') {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
|
|
140
148
|
setOpen(true);
|
|
141
149
|
};
|
|
142
150
|
|
|
@@ -250,7 +258,8 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
250
258
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
251
259
|
|
|
252
260
|
/**
|
|
253
|
-
* The cell value
|
|
261
|
+
* The cell value.
|
|
262
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
254
263
|
*/
|
|
255
264
|
value: PropTypes.any
|
|
256
265
|
} : void 0;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["field", "align", "width", "contentWidth"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import Skeleton from '@mui/material/Skeleton';
|
|
7
|
+
import { capitalize } from '@mui/material/utils';
|
|
8
|
+
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
9
|
+
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
|
+
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
|
|
13
|
+
const useUtilityClasses = ownerState => {
|
|
14
|
+
const {
|
|
15
|
+
align,
|
|
16
|
+
classes
|
|
17
|
+
} = ownerState;
|
|
18
|
+
const slots = {
|
|
19
|
+
root: ['cell', 'cellSkeleton', `cell--text${capitalize(align)}`]
|
|
20
|
+
};
|
|
21
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function GridSkeletonCell(props) {
|
|
25
|
+
const {
|
|
26
|
+
align,
|
|
27
|
+
width,
|
|
28
|
+
contentWidth
|
|
29
|
+
} = props,
|
|
30
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
|
+
|
|
32
|
+
const rootProps = useGridRootProps();
|
|
33
|
+
const ownerState = {
|
|
34
|
+
classes: rootProps.classes,
|
|
35
|
+
align
|
|
36
|
+
};
|
|
37
|
+
const classes = useUtilityClasses(ownerState);
|
|
38
|
+
return /*#__PURE__*/_jsx("div", _extends({
|
|
39
|
+
className: classes.root,
|
|
40
|
+
style: {
|
|
41
|
+
width
|
|
42
|
+
}
|
|
43
|
+
}, other, {
|
|
44
|
+
children: /*#__PURE__*/_jsx(Skeleton, {
|
|
45
|
+
width: `${contentWidth}%`
|
|
46
|
+
})
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
process.env.NODE_ENV !== "production" ? GridSkeletonCell.propTypes = {
|
|
51
|
+
// ----------------------------- Warning --------------------------------
|
|
52
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
53
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
54
|
+
// ----------------------------------------------------------------------
|
|
55
|
+
align: PropTypes.string.isRequired,
|
|
56
|
+
contentWidth: PropTypes.number.isRequired,
|
|
57
|
+
field: PropTypes.string.isRequired,
|
|
58
|
+
width: PropTypes.number.isRequired
|
|
59
|
+
} : void 0;
|
|
60
|
+
export { GridSkeletonCell };
|
|
@@ -5,4 +5,5 @@ export * from './GridEditDateCell';
|
|
|
5
5
|
export * from './GridEditInputCell';
|
|
6
6
|
export * from './GridEditSingleSelectCell';
|
|
7
7
|
export * from './GridActionsCell';
|
|
8
|
-
export * from './GridActionsCellItem';
|
|
8
|
+
export * from './GridActionsCellItem';
|
|
9
|
+
export * from './GridSkeletonCell';
|