@mui/x-data-grid 5.15.3 → 5.17.1
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 +150 -1
- package/DataGrid/DataGrid.js +2 -0
- package/DataGrid/useDataGridComponent.js +5 -0
- package/components/DataGridColumnHeaders.js +4 -3
- 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 +3 -3
- package/components/cell/GridBooleanCell.js +2 -1
- package/components/cell/GridCell.js +9 -1
- package/components/cell/GridEditBooleanCell.js +2 -1
- package/components/cell/GridEditDateCell.js +2 -1
- package/components/cell/GridEditInputCell.js +2 -1
- package/components/cell/GridEditSingleSelectCell.js +2 -1
- 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/GridRoot.js +3 -3
- package/components/containers/GridRootStyles.js +16 -2
- package/components/panel/GridColumnsPanel.d.ts +6 -1
- package/components/panel/GridColumnsPanel.js +38 -6
- package/components/panel/GridPanel.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/focus/useGridFocus.js +13 -3
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -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/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +3 -1
- package/internals/index.js +3 -1
- package/legacy/DataGrid/DataGrid.js +2 -0
- package/legacy/DataGrid/useDataGridComponent.js +5 -0
- package/legacy/components/DataGridColumnHeaders.js +4 -3
- package/legacy/components/GridRow.js +138 -85
- package/legacy/components/base/GridBody.js +8 -5
- package/legacy/components/base/GridOverlays.js +3 -3
- package/legacy/components/cell/GridBooleanCell.js +2 -1
- package/legacy/components/cell/GridCell.js +11 -1
- package/legacy/components/cell/GridEditBooleanCell.js +2 -1
- package/legacy/components/cell/GridEditDateCell.js +2 -1
- package/legacy/components/cell/GridEditInputCell.js +2 -1
- package/legacy/components/cell/GridEditSingleSelectCell.js +2 -1
- 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/GridRoot.js +3 -3
- package/legacy/components/containers/GridRootStyles.js +14 -5
- package/legacy/components/panel/GridColumnsPanel.js +41 -6
- 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/focus/useGridFocus.js +13 -3
- package/legacy/hooks/features/index.js +1 -0
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -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/index.js +1 -1
- package/legacy/internals/index.js +3 -1
- 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/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 +6 -0
- package/modern/DataGrid/DataGrid.js +2 -0
- package/modern/DataGrid/useDataGridComponent.js +5 -0
- package/modern/components/DataGridColumnHeaders.js +4 -3
- package/modern/components/GridRow.js +133 -84
- package/modern/components/base/GridBody.js +8 -5
- package/modern/components/base/GridOverlays.js +3 -3
- package/modern/components/cell/GridBooleanCell.js +2 -1
- package/modern/components/cell/GridCell.js +9 -1
- package/modern/components/cell/GridEditBooleanCell.js +2 -1
- package/modern/components/cell/GridEditDateCell.js +2 -1
- package/modern/components/cell/GridEditInputCell.js +2 -1
- package/modern/components/cell/GridEditSingleSelectCell.js +2 -1
- 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/GridRoot.js +3 -3
- package/modern/components/containers/GridRootStyles.js +16 -2
- package/modern/components/panel/GridColumnsPanel.js +38 -6
- 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/focus/useGridFocus.js +13 -3
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -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/index.js +1 -1
- package/modern/internals/index.js +3 -1
- 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 +2 -0
- package/node/DataGrid/useDataGridComponent.js +7 -0
- package/node/components/DataGridColumnHeaders.js +4 -3
- package/node/components/GridRow.js +136 -77
- package/node/components/base/GridBody.js +7 -4
- package/node/components/base/GridOverlays.js +2 -2
- package/node/components/cell/GridBooleanCell.js +2 -1
- package/node/components/cell/GridCell.js +9 -1
- package/node/components/cell/GridEditBooleanCell.js +2 -1
- package/node/components/cell/GridEditDateCell.js +2 -1
- package/node/components/cell/GridEditInputCell.js +2 -1
- package/node/components/cell/GridEditSingleSelectCell.js +2 -1
- 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/GridRoot.js +4 -4
- package/node/components/containers/GridRootStyles.js +16 -2
- package/node/components/panel/GridColumnsPanel.js +36 -5
- 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/focus/useGridFocus.js +13 -3
- package/node/hooks/features/index.js +13 -0
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -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/index.js +1 -1
- package/node/internals/index.js +28 -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
package/internals/index.js
CHANGED
|
@@ -11,6 +11,8 @@ export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridCol
|
|
|
11
11
|
export { useGridColumnMenu, columnMenuStateInitializer } from '../hooks/features/columnMenu/useGridColumnMenu';
|
|
12
12
|
export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
|
|
13
13
|
export { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
|
|
14
|
+
export { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
15
|
+
export { useGridColumnGroupingPreProcessors } from '../hooks/features/columnGrouping/useGridColumnGroupingPreProcessors';
|
|
14
16
|
export { useGridDensity, densityStateInitializer } from '../hooks/features/density/useGridDensity';
|
|
15
17
|
export { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
|
|
16
18
|
export { useGridPrintExport } from '../hooks/features/export/useGridPrintExport';
|
|
@@ -36,7 +38,7 @@ export { useGridScroll } from '../hooks/features/scroll/useGridScroll';
|
|
|
36
38
|
export { useGridEvents } from '../hooks/features/events/useGridEvents';
|
|
37
39
|
export { useGridDimensions } from '../hooks/features/dimensions/useGridDimensions';
|
|
38
40
|
export { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
39
|
-
export { useGridVirtualScroller } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
41
|
+
export { useGridVirtualScroller, getRenderableIndexes } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
40
42
|
export { useGridVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
41
43
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
42
44
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
@@ -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]].
|
|
@@ -196,6 +197,7 @@ DataGridRaw.propTypes = {
|
|
|
196
197
|
* 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.
|
|
197
198
|
*/
|
|
198
199
|
experimentalFeatures: PropTypes.shape({
|
|
200
|
+
columnGrouping: PropTypes.bool,
|
|
199
201
|
newEditingApi: PropTypes.bool,
|
|
200
202
|
preventCommitWhileValidating: PropTypes.bool,
|
|
201
203
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
@@ -25,6 +25,8 @@ 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 var useDataGridComponent = function useDataGridComponent(props) {
|
|
29
31
|
var _props$experimentalFe, _props$experimentalFe2;
|
|
30
32
|
|
|
@@ -33,6 +35,7 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
33
35
|
* Register all pre-processors called during state initialization here.
|
|
34
36
|
*/
|
|
35
37
|
|
|
38
|
+
useGridColumnGroupingPreProcessors(apiRef, props);
|
|
36
39
|
useGridSelectionPreProcessors(apiRef, props);
|
|
37
40
|
useGridRowsPreProcessors(apiRef);
|
|
38
41
|
/**
|
|
@@ -41,6 +44,7 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
41
44
|
|
|
42
45
|
useGridInitializeState(selectionStateInitializer, apiRef, props);
|
|
43
46
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
47
|
+
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
44
48
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
45
49
|
useGridInitializeState((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? editingStateInitializer_new : editingStateInitializer_old, apiRef, props);
|
|
46
50
|
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
@@ -57,6 +61,7 @@ export var useDataGridComponent = function useDataGridComponent(props) {
|
|
|
57
61
|
useGridRows(apiRef, props);
|
|
58
62
|
useGridParamsApi(apiRef);
|
|
59
63
|
useGridColumnSpanning(apiRef);
|
|
64
|
+
useGridColumnGrouping(apiRef, props);
|
|
60
65
|
var useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
61
66
|
useGridEditing(apiRef, props);
|
|
62
67
|
useGridFocus(apiRef, props);
|
|
@@ -19,17 +19,18 @@ export var DataGridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridCo
|
|
|
19
19
|
isDragging = _useGridColumnHeaders.isDragging,
|
|
20
20
|
getRootProps = _useGridColumnHeaders.getRootProps,
|
|
21
21
|
getInnerProps = _useGridColumnHeaders.getInnerProps,
|
|
22
|
-
|
|
22
|
+
getColumnHeaders = _useGridColumnHeaders.getColumnHeaders,
|
|
23
|
+
getColumnGroupHeaders = _useGridColumnHeaders.getColumnGroupHeaders;
|
|
23
24
|
|
|
24
25
|
return /*#__PURE__*/_jsxs(GridColumnHeaders, _extends({
|
|
25
26
|
ref: ref
|
|
26
27
|
}, getRootProps(other), {
|
|
27
28
|
children: [/*#__PURE__*/_jsx(GridScrollArea, {
|
|
28
29
|
scrollDirection: "left"
|
|
29
|
-
}), /*#__PURE__*/
|
|
30
|
+
}), /*#__PURE__*/_jsxs(GridColumnHeadersInner, _extends({
|
|
30
31
|
isDragging: isDragging
|
|
31
32
|
}, getInnerProps(), {
|
|
32
|
-
children:
|
|
33
|
+
children: [getColumnGroupHeaders(), getColumnHeaders()]
|
|
33
34
|
})), /*#__PURE__*/_jsx(GridScrollArea, {
|
|
34
35
|
scrollDirection: "right"
|
|
35
36
|
})]
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["selected", "rowId", "row", "index", "style", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
5
|
-
|
|
6
|
-
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
7
|
-
|
|
8
|
-
/* eslint-disable jsx-a11y/interactive-supports-focus */
|
|
5
|
+
var _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "cellFocus", "cellTabIndex", "editRowsState", "isLastVisible", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
9
6
|
import * as React from 'react';
|
|
10
7
|
import PropTypes from 'prop-types';
|
|
11
8
|
import clsx from 'clsx';
|
|
@@ -23,6 +20,8 @@ import { GRID_ACTIONS_COLUMN_TYPE } from '../colDef/gridActionsColDef';
|
|
|
23
20
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from '../constants/gridDetailPanelToggleField';
|
|
24
21
|
import { gridSortModelSelector } from '../hooks/features/sorting/gridSortingSelector';
|
|
25
22
|
import { gridRowTreeDepthSelector } from '../hooks/features/rows/gridRowsSelector';
|
|
23
|
+
import { gridDensityHeaderGroupingMaxDepthSelector } from '../hooks/features/density/densitySelector';
|
|
24
|
+
import { randomNumberBetween } from '../utils/utils';
|
|
26
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
27
|
|
|
@@ -63,6 +62,7 @@ function GridRow(props) {
|
|
|
63
62
|
row = props.row,
|
|
64
63
|
index = props.index,
|
|
65
64
|
styleProp = props.style,
|
|
65
|
+
position = props.position,
|
|
66
66
|
rowHeight = props.rowHeight,
|
|
67
67
|
className = props.className,
|
|
68
68
|
visibleColumns = props.visibleColumns,
|
|
@@ -81,8 +81,6 @@ function GridRow(props) {
|
|
|
81
81
|
onMouseLeave = props.onMouseLeave,
|
|
82
82
|
other = _objectWithoutProperties(props, _excluded);
|
|
83
83
|
|
|
84
|
-
var ariaRowIndex = index + 2; // 1 for the header row and 1 as it's 1-based
|
|
85
|
-
|
|
86
84
|
var apiRef = useGridApiContext();
|
|
87
85
|
var ref = React.useRef(null);
|
|
88
86
|
var rootProps = useGridRootProps();
|
|
@@ -90,6 +88,8 @@ function GridRow(props) {
|
|
|
90
88
|
var columnsTotalWidth = useGridSelector(apiRef, gridColumnsTotalWidthSelector);
|
|
91
89
|
var sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
92
90
|
var treeDepth = useGridSelector(apiRef, gridRowTreeDepthSelector);
|
|
91
|
+
var headerGroupingMaxDepth = useGridSelector(apiRef, gridDensityHeaderGroupingMaxDepthSelector);
|
|
92
|
+
var ariaRowIndex = index + headerGroupingMaxDepth + 2; // 1 for the header row and 1 as it's 1-based
|
|
93
93
|
|
|
94
94
|
var _ref2 = (_apiRef$current$getRo = apiRef.current.getRootDimensions()) != null ? _apiRef$current$getRo : {
|
|
95
95
|
hasScrollX: false,
|
|
@@ -110,9 +110,9 @@ function GridRow(props) {
|
|
|
110
110
|
React.useLayoutEffect(function () {
|
|
111
111
|
if (rowHeight === 'auto' && ref.current && typeof ResizeObserver === 'undefined') {
|
|
112
112
|
// Fallback for IE
|
|
113
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight);
|
|
113
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, ref.current.clientHeight, position);
|
|
114
114
|
}
|
|
115
|
-
}, [apiRef, rowHeight, rowId]);
|
|
115
|
+
}, [apiRef, rowHeight, rowId, position]);
|
|
116
116
|
React.useLayoutEffect(function () {
|
|
117
117
|
if (currentPage.range) {
|
|
118
118
|
// The index prop is relative to the rows from all pages. As example, the index prop of the
|
|
@@ -139,13 +139,13 @@ function GridRow(props) {
|
|
|
139
139
|
entry = _entries[0];
|
|
140
140
|
|
|
141
141
|
var height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
142
|
-
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
|
|
142
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height, position);
|
|
143
143
|
});
|
|
144
144
|
resizeObserver.observe(rootElement);
|
|
145
145
|
return function () {
|
|
146
146
|
return resizeObserver.disconnect();
|
|
147
147
|
};
|
|
148
|
-
}, [apiRef, currentPage.range, index, rowHeight, rowId]);
|
|
148
|
+
}, [apiRef, currentPage.range, index, rowHeight, rowId, position]);
|
|
149
149
|
var publish = React.useCallback(function (eventName, propHandler) {
|
|
150
150
|
return function (event) {
|
|
151
151
|
// Ignore portal
|
|
@@ -203,48 +203,9 @@ function GridRow(props) {
|
|
|
203
203
|
|
|
204
204
|
publish('rowClick', onClick)(event);
|
|
205
205
|
}, [apiRef, onClick, publish, rowId]);
|
|
206
|
+
var getCell = React.useCallback(function (column, cellProps) {
|
|
207
|
+
var _rootProps$components;
|
|
206
208
|
|
|
207
|
-
var style = _extends({}, styleProp, {
|
|
208
|
-
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
209
|
-
// max-height doesn't support "auto"
|
|
210
|
-
minHeight: rowHeight
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
var sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
214
|
-
|
|
215
|
-
if (sizes != null && sizes.spacingTop) {
|
|
216
|
-
var property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
217
|
-
style[property] = sizes.spacingTop;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (sizes != null && sizes.spacingBottom) {
|
|
221
|
-
var _property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
222
|
-
|
|
223
|
-
style[_property] = sizes.spacingBottom;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
var rowClassName = null;
|
|
227
|
-
|
|
228
|
-
if (typeof rootProps.getRowClassName === 'function') {
|
|
229
|
-
var indexRelativeToCurrentPage = index - currentPage.range.firstRowIndex;
|
|
230
|
-
|
|
231
|
-
var rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
232
|
-
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
233
|
-
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
234
|
-
indexRelativeToCurrentPage: indexRelativeToCurrentPage
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
rowClassName = rootProps.getRowClassName(rowParams);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
var cells = [];
|
|
241
|
-
|
|
242
|
-
for (var i = 0; i < renderedColumns.length; i += 1) {
|
|
243
|
-
var column = renderedColumns[i];
|
|
244
|
-
var indexRelativeToAllColumns = firstColumnToRender + i;
|
|
245
|
-
var isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
246
|
-
var removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
247
|
-
var showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
248
209
|
var cellParams = apiRef.current.getCellParams(rowId, column.field);
|
|
249
210
|
var classNames = [];
|
|
250
211
|
var disableDragEvents = rootProps.disableColumnReorder && column.disableReorder || !rootProps.rowReordering && !!sortModel.length && treeDepth > 1 && Object.keys(editRowsState).length > 0;
|
|
@@ -294,52 +255,143 @@ function GridRow(props) {
|
|
|
294
255
|
|
|
295
256
|
var hasFocus = cellFocus !== null && cellFocus.id === rowId && cellFocus.field === column.field;
|
|
296
257
|
var tabIndex = cellTabIndex !== null && cellTabIndex.id === rowId && cellTabIndex.field === column.field && cellParams.cellMode === 'view' ? 0 : -1;
|
|
258
|
+
return /*#__PURE__*/_jsx(rootProps.components.Cell, _extends({
|
|
259
|
+
value: cellParams.value,
|
|
260
|
+
field: column.field,
|
|
261
|
+
width: cellProps.width,
|
|
262
|
+
rowId: rowId,
|
|
263
|
+
height: rowHeight,
|
|
264
|
+
showRightBorder: cellProps.showRightBorder,
|
|
265
|
+
formattedValue: cellParams.formattedValue,
|
|
266
|
+
align: column.align || 'left',
|
|
267
|
+
cellMode: cellParams.cellMode,
|
|
268
|
+
colIndex: cellProps.indexRelativeToAllColumns,
|
|
269
|
+
isEditable: cellParams.isEditable,
|
|
270
|
+
hasFocus: hasFocus,
|
|
271
|
+
tabIndex: tabIndex,
|
|
272
|
+
className: clsx(classNames),
|
|
273
|
+
colSpan: cellProps.colSpan,
|
|
274
|
+
disableDragEvents: disableDragEvents
|
|
275
|
+
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
|
|
276
|
+
children: content
|
|
277
|
+
}), column.field);
|
|
278
|
+
}, [apiRef, cellTabIndex, editRowsState, cellFocus, rootProps, row, rowHeight, rowId, treeDepth, sortModel.length]);
|
|
279
|
+
var sizes = apiRef.current.unstable_getRowInternalSizes(rowId);
|
|
280
|
+
var minHeight = rowHeight;
|
|
281
|
+
|
|
282
|
+
if (minHeight === 'auto' && sizes) {
|
|
283
|
+
var numberOfBaseSizes = 0;
|
|
284
|
+
var maximumSize = Object.entries(sizes).reduce(function (acc, _ref3) {
|
|
285
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
286
|
+
key = _ref4[0],
|
|
287
|
+
size = _ref4[1];
|
|
288
|
+
|
|
289
|
+
var isBaseHeight = /^base[A-Z]/.test(key);
|
|
290
|
+
|
|
291
|
+
if (!isBaseHeight) {
|
|
292
|
+
return acc;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
numberOfBaseSizes += 1;
|
|
296
|
+
|
|
297
|
+
if (size > acc) {
|
|
298
|
+
return size;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return acc;
|
|
302
|
+
}, 0);
|
|
303
|
+
|
|
304
|
+
if (maximumSize > 0 && numberOfBaseSizes > 1) {
|
|
305
|
+
minHeight = maximumSize;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
var style = _extends({}, styleProp, {
|
|
310
|
+
maxHeight: rowHeight === 'auto' ? 'none' : rowHeight,
|
|
311
|
+
// max-height doesn't support "auto"
|
|
312
|
+
minHeight: minHeight
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
if (sizes != null && sizes.spacingTop) {
|
|
316
|
+
var property = rootProps.rowSpacingType === 'border' ? 'borderTopWidth' : 'marginTop';
|
|
317
|
+
style[property] = sizes.spacingTop;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (sizes != null && sizes.spacingBottom) {
|
|
321
|
+
var _property = rootProps.rowSpacingType === 'border' ? 'borderBottomWidth' : 'marginBottom';
|
|
322
|
+
|
|
323
|
+
style[_property] = sizes.spacingBottom;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
var rowClassNames = apiRef.current.unstable_applyPipeProcessors('rowClassName', [], rowId);
|
|
327
|
+
|
|
328
|
+
if (typeof rootProps.getRowClassName === 'function') {
|
|
329
|
+
var _currentPage$range;
|
|
330
|
+
|
|
331
|
+
var indexRelativeToCurrentPage = index - (((_currentPage$range = currentPage.range) == null ? void 0 : _currentPage$range.firstRowIndex) || 0);
|
|
332
|
+
|
|
333
|
+
var rowParams = _extends({}, apiRef.current.getRowParams(rowId), {
|
|
334
|
+
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
335
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
336
|
+
indexRelativeToCurrentPage: indexRelativeToCurrentPage
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
rowClassNames.push(rootProps.getRowClassName(rowParams));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
var randomNumber = randomNumberBetween(10000, 20, 80);
|
|
343
|
+
var cells = [];
|
|
344
|
+
|
|
345
|
+
for (var i = 0; i < renderedColumns.length; i += 1) {
|
|
346
|
+
var column = renderedColumns[i];
|
|
347
|
+
var indexRelativeToAllColumns = firstColumnToRender + i;
|
|
348
|
+
var isLastColumn = indexRelativeToAllColumns === visibleColumns.length - 1;
|
|
349
|
+
var removeLastBorderRight = isLastColumn && hasScrollX && !hasScrollY;
|
|
350
|
+
var showRightBorder = !isLastColumn ? rootProps.showCellRightBorder : !removeLastBorderRight && rootProps.disableExtendRowFullWidth;
|
|
297
351
|
var cellColSpanInfo = apiRef.current.unstable_getCellColSpanInfo(rowId, indexRelativeToAllColumns);
|
|
298
352
|
|
|
299
353
|
if (cellColSpanInfo && !cellColSpanInfo.spannedByColSpan) {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
disableDragEvents: disableDragEvents
|
|
322
|
-
}, (_rootProps$components = rootProps.componentsProps) == null ? void 0 : _rootProps$components.cell, {
|
|
323
|
-
children: content
|
|
324
|
-
}), column.field));
|
|
354
|
+
if (row) {
|
|
355
|
+
var _cellColSpanInfo$cell = cellColSpanInfo.cellProps,
|
|
356
|
+
colSpan = _cellColSpanInfo$cell.colSpan,
|
|
357
|
+
width = _cellColSpanInfo$cell.width;
|
|
358
|
+
var cellProps = {
|
|
359
|
+
width: width,
|
|
360
|
+
colSpan: colSpan,
|
|
361
|
+
showRightBorder: showRightBorder,
|
|
362
|
+
indexRelativeToAllColumns: indexRelativeToAllColumns
|
|
363
|
+
};
|
|
364
|
+
cells.push(getCell(column, cellProps));
|
|
365
|
+
} else {
|
|
366
|
+
var _width = cellColSpanInfo.cellProps.width;
|
|
367
|
+
var contentWidth = Math.round(randomNumber());
|
|
368
|
+
cells.push( /*#__PURE__*/_jsx(rootProps.components.SkeletonCell, {
|
|
369
|
+
width: _width,
|
|
370
|
+
contentWidth: contentWidth,
|
|
371
|
+
field: column.field,
|
|
372
|
+
align: column.align
|
|
373
|
+
}, column.field));
|
|
374
|
+
}
|
|
325
375
|
}
|
|
326
376
|
}
|
|
327
377
|
|
|
328
378
|
var emptyCellWidth = containerWidth - columnsTotalWidth;
|
|
379
|
+
var eventHandlers = row ? {
|
|
380
|
+
onClick: publishClick,
|
|
381
|
+
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
382
|
+
onMouseEnter: publish('rowMouseEnter', onMouseEnter),
|
|
383
|
+
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
384
|
+
} : null;
|
|
329
385
|
return /*#__PURE__*/_jsxs("div", _extends({
|
|
330
386
|
ref: ref,
|
|
331
387
|
"data-id": rowId,
|
|
332
388
|
"data-rowindex": index,
|
|
333
389
|
role: "row",
|
|
334
|
-
className: clsx(
|
|
390
|
+
className: clsx.apply(void 0, _toConsumableArray(rowClassNames).concat([classes.root, className])),
|
|
335
391
|
"aria-rowindex": ariaRowIndex,
|
|
336
392
|
"aria-selected": selected,
|
|
337
|
-
style: style
|
|
338
|
-
|
|
339
|
-
onDoubleClick: publish('rowDoubleClick', onDoubleClick),
|
|
340
|
-
onMouseEnter: publish('rowMouseEnter', onMouseEnter),
|
|
341
|
-
onMouseLeave: publish('rowMouseLeave', onMouseLeave)
|
|
342
|
-
}, other, {
|
|
393
|
+
style: style
|
|
394
|
+
}, eventHandlers, other, {
|
|
343
395
|
children: [cells, emptyCellWidth > 0 && /*#__PURE__*/_jsx(EmptyCell, {
|
|
344
396
|
width: emptyCellWidth
|
|
345
397
|
})]
|
|
@@ -364,8 +416,9 @@ process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
|
|
|
364
416
|
index: PropTypes.number.isRequired,
|
|
365
417
|
isLastVisible: PropTypes.bool,
|
|
366
418
|
lastColumnToRender: PropTypes.number.isRequired,
|
|
419
|
+
position: PropTypes.oneOf(['center', 'left', 'right']).isRequired,
|
|
367
420
|
renderedColumns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
368
|
-
row: PropTypes.
|
|
421
|
+
row: PropTypes.object,
|
|
369
422
|
rowHeight: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]).isRequired,
|
|
370
423
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
371
424
|
selected: PropTypes.bool.isRequired,
|
|
@@ -7,7 +7,7 @@ import { GridAutoSizer } from '../GridAutoSizer';
|
|
|
7
7
|
import { GridOverlays } from './GridOverlays';
|
|
8
8
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { useGridSelector } from '../../hooks/utils/useGridSelector';
|
|
10
|
-
import {
|
|
10
|
+
import { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
|
|
@@ -17,7 +17,7 @@ function GridBody(props) {
|
|
|
17
17
|
ColumnHeadersComponent = props.ColumnHeadersComponent;
|
|
18
18
|
var apiRef = useGridApiContext();
|
|
19
19
|
var rootProps = useGridRootProps();
|
|
20
|
-
var
|
|
20
|
+
var totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);
|
|
21
21
|
|
|
22
22
|
var _React$useState = React.useState(rootProps.disableVirtualization),
|
|
23
23
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -29,7 +29,10 @@ function GridBody(props) {
|
|
|
29
29
|
}, []);
|
|
30
30
|
var enableVirtualization = React.useCallback(function () {
|
|
31
31
|
setIsVirtualizationDisabled(false);
|
|
32
|
-
}, []);
|
|
32
|
+
}, []);
|
|
33
|
+
React.useEffect(function () {
|
|
34
|
+
setIsVirtualizationDisabled(rootProps.disableVirtualization);
|
|
35
|
+
}, [rootProps.disableVirtualization]); // The `useGridApiMethod` hook can't be used here, because it only installs the
|
|
33
36
|
// method if it doesn't exist yet. Once installed, it's never updated again.
|
|
34
37
|
// This break the methods above, since their closure comes from the first time
|
|
35
38
|
// they were installed. Which means that calling `setIsVirtualizationDisabled`
|
|
@@ -64,8 +67,8 @@ function GridBody(props) {
|
|
|
64
67
|
width: size.width,
|
|
65
68
|
// If `autoHeight` is on, there will be no height value.
|
|
66
69
|
// In this case, let the container to grow whatever it needs.
|
|
67
|
-
height: size.height ? size.height -
|
|
68
|
-
marginTop:
|
|
70
|
+
height: size.height ? size.height - totalHeaderHeight : 'auto',
|
|
71
|
+
marginTop: totalHeaderHeight
|
|
69
72
|
};
|
|
70
73
|
return /*#__PURE__*/_jsx(VirtualScrollerComponent, {
|
|
71
74
|
ref: windowRef,
|
|
@@ -7,7 +7,7 @@ import { gridVisibleRowCountSelector } from '../../hooks/features/filter/gridFil
|
|
|
7
7
|
import { gridRowCountSelector, gridRowsLoadingSelector } from '../../hooks/features/rows/gridRowsSelector';
|
|
8
8
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
9
9
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
10
|
-
import {
|
|
10
|
+
import { gridDensityTotalHeaderHeightSelector } from '../../hooks/features/density/densitySelector';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
|
|
13
13
|
function GridOverlayWrapper(props) {
|
|
@@ -15,7 +15,7 @@ function GridOverlayWrapper(props) {
|
|
|
15
15
|
|
|
16
16
|
var apiRef = useGridApiContext();
|
|
17
17
|
var rootProps = useGridRootProps();
|
|
18
|
-
var
|
|
18
|
+
var totalHeaderHeight = useGridSelector(apiRef, gridDensityTotalHeaderHeightSelector);
|
|
19
19
|
|
|
20
20
|
var _React$useState = React.useState(function () {
|
|
21
21
|
var _apiRef$current$getRo, _apiRef$current$getRo2;
|
|
@@ -49,7 +49,7 @@ function GridOverlayWrapper(props) {
|
|
|
49
49
|
height: height,
|
|
50
50
|
width: (_viewportInnerSize$wi = viewportInnerSize == null ? void 0 : viewportInnerSize.width) != null ? _viewportInnerSize$wi : 0,
|
|
51
51
|
position: 'absolute',
|
|
52
|
-
top:
|
|
52
|
+
top: totalHeaderHeight,
|
|
53
53
|
bottom: height === 'auto' ? 0 : undefined
|
|
54
54
|
}
|
|
55
55
|
}, props));
|
|
@@ -133,7 +133,8 @@ process.env.NODE_ENV !== "production" ? GridBooleanCellRaw.propTypes = {
|
|
|
133
133
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
* The cell value
|
|
136
|
+
* The cell value.
|
|
137
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
137
138
|
*/
|
|
138
139
|
value: PropTypes.any
|
|
139
140
|
} : void 0;
|
|
@@ -99,6 +99,16 @@ function GridCell(props) {
|
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
}, [apiRef, field, onMouseUp, rowId]);
|
|
102
|
+
var publishMouseDown = React.useCallback(function (eventName) {
|
|
103
|
+
return function (event) {
|
|
104
|
+
var params = apiRef.current.getCellParams(rowId, field || '');
|
|
105
|
+
apiRef.current.publishEvent(eventName, params, event);
|
|
106
|
+
|
|
107
|
+
if (onMouseDown) {
|
|
108
|
+
onMouseDown(event);
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}, [apiRef, field, onMouseDown, rowId]);
|
|
102
112
|
var publish = React.useCallback(function (eventName, propHandler) {
|
|
103
113
|
return function (event) {
|
|
104
114
|
// Ignore portal
|
|
@@ -205,7 +215,7 @@ function GridCell(props) {
|
|
|
205
215
|
tabIndex: (cellMode === 'view' || !isEditable) && !managesOwnFocus ? tabIndex : -1,
|
|
206
216
|
onClick: publish('cellClick', onClick),
|
|
207
217
|
onDoubleClick: publish('cellDoubleClick', onDoubleClick),
|
|
208
|
-
onMouseDown:
|
|
218
|
+
onMouseDown: publishMouseDown('cellMouseDown'),
|
|
209
219
|
onMouseUp: publishMouseUp('cellMouseUp'),
|
|
210
220
|
onKeyDown: publish('cellKeyDown', onKeyDown)
|
|
211
221
|
}, draggableEventHandlers, other, {
|
|
@@ -201,7 +201,8 @@ process.env.NODE_ENV !== "production" ? GridEditBooleanCell.propTypes = {
|
|
|
201
201
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
202
202
|
|
|
203
203
|
/**
|
|
204
|
-
* The cell value
|
|
204
|
+
* The cell value.
|
|
205
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
205
206
|
*/
|
|
206
207
|
value: PropTypes.any
|
|
207
208
|
} : void 0;
|
|
@@ -252,7 +252,8 @@ process.env.NODE_ENV !== "production" ? GridEditDateCell.propTypes = {
|
|
|
252
252
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
253
253
|
|
|
254
254
|
/**
|
|
255
|
-
* The cell value
|
|
255
|
+
* The cell value.
|
|
256
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
256
257
|
*/
|
|
257
258
|
value: PropTypes.any
|
|
258
259
|
} : void 0;
|
|
@@ -218,7 +218,8 @@ process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
|
218
218
|
tabIndex: PropTypes.oneOf([-1, 0]),
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
|
-
* The cell value
|
|
221
|
+
* The cell value.
|
|
222
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
222
223
|
*/
|
|
223
224
|
value: PropTypes.any
|
|
224
225
|
} : void 0;
|
|
@@ -321,7 +321,8 @@ process.env.NODE_ENV !== "production" ? GridEditSingleSelectCell.propTypes = {
|
|
|
321
321
|
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
322
322
|
|
|
323
323
|
/**
|
|
324
|
-
* The cell value
|
|
324
|
+
* The cell value.
|
|
325
|
+
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
325
326
|
*/
|
|
326
327
|
value: PropTypes.any
|
|
327
328
|
} : void 0;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _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
|
+
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
14
|
+
var align = ownerState.align,
|
|
15
|
+
classes = ownerState.classes;
|
|
16
|
+
var slots = {
|
|
17
|
+
root: ['cell', 'cellSkeleton', "cell--text".concat(capitalize(align))]
|
|
18
|
+
};
|
|
19
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function GridSkeletonCell(props) {
|
|
23
|
+
var field = props.field,
|
|
24
|
+
align = props.align,
|
|
25
|
+
width = props.width,
|
|
26
|
+
contentWidth = props.contentWidth,
|
|
27
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
28
|
+
|
|
29
|
+
var rootProps = useGridRootProps();
|
|
30
|
+
var ownerState = {
|
|
31
|
+
classes: rootProps.classes,
|
|
32
|
+
align: align
|
|
33
|
+
};
|
|
34
|
+
var classes = useUtilityClasses(ownerState);
|
|
35
|
+
return /*#__PURE__*/_jsx("div", _extends({
|
|
36
|
+
className: classes.root,
|
|
37
|
+
style: {
|
|
38
|
+
width: width
|
|
39
|
+
}
|
|
40
|
+
}, other, {
|
|
41
|
+
children: /*#__PURE__*/_jsx(Skeleton, {
|
|
42
|
+
width: "".concat(contentWidth, "%")
|
|
43
|
+
})
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
process.env.NODE_ENV !== "production" ? GridSkeletonCell.propTypes = {
|
|
48
|
+
// ----------------------------- Warning --------------------------------
|
|
49
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
50
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
51
|
+
// ----------------------------------------------------------------------
|
|
52
|
+
align: PropTypes.string.isRequired,
|
|
53
|
+
contentWidth: PropTypes.number.isRequired,
|
|
54
|
+
field: PropTypes.string.isRequired,
|
|
55
|
+
width: PropTypes.number.isRequired
|
|
56
|
+
} : void 0;
|
|
57
|
+
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';
|