@mui/x-data-grid 8.18.0 → 8.20.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 +175 -0
- package/DataGrid/useDataGridComponent.js +4 -3
- package/components/GridRow.js +5 -2
- package/components/GridRowDragAndDropOverlay.d.ts +7 -0
- package/components/GridRowDragAndDropOverlay.js +73 -0
- package/components/cell/GridActionsCell.d.ts +9 -0
- package/components/cell/GridActionsCell.js +54 -34
- package/components/cell/GridBooleanCell.js +0 -10
- package/components/cell/GridCell.js +4 -10
- package/components/columnHeaders/GridColumnHeaderItem.js +2 -2
- package/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
- package/components/containers/GridRootStyles.js +17 -40
- package/components/toolbarV8/Toolbar.js +1 -1
- package/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
- package/components/virtualization/GridVirtualScrollbar.js +13 -8
- package/components/virtualization/GridVirtualScroller.js +2 -1
- package/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
- package/constants/dataGridPropsDefaultValues.js +2 -1
- package/constants/gridClasses.d.ts +0 -8
- package/constants/gridClasses.js +1 -1
- package/esm/DataGrid/useDataGridComponent.js +5 -4
- package/esm/components/GridRow.js +5 -2
- package/esm/components/GridRowDragAndDropOverlay.d.ts +7 -0
- package/esm/components/GridRowDragAndDropOverlay.js +66 -0
- package/esm/components/cell/GridActionsCell.d.ts +9 -0
- package/esm/components/cell/GridActionsCell.js +55 -34
- package/esm/components/cell/GridBooleanCell.js +0 -10
- package/esm/components/cell/GridCell.js +4 -10
- package/esm/components/columnHeaders/GridColumnHeaderItem.js +2 -2
- package/esm/components/columnSelection/GridCellCheckboxRenderer.js +37 -22
- package/esm/components/containers/GridRootStyles.js +17 -40
- package/esm/components/toolbarV8/Toolbar.js +1 -1
- package/esm/components/virtualization/GridVirtualScrollbar.d.ts +1 -0
- package/esm/components/virtualization/GridVirtualScrollbar.js +12 -7
- package/esm/components/virtualization/GridVirtualScroller.js +2 -1
- package/esm/components/virtualization/GridVirtualScrollerRenderZone.js +1 -1
- package/esm/constants/dataGridPropsDefaultValues.js +2 -1
- package/esm/constants/gridClasses.d.ts +0 -8
- package/esm/constants/gridClasses.js +1 -1
- package/esm/hooks/core/gridPropsSelectors.d.ts +2 -1
- package/esm/hooks/core/gridPropsSelectors.js +3 -0
- package/esm/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
- package/esm/hooks/core/useGridProps.js +8 -2
- package/esm/hooks/core/useGridVirtualizer.d.ts +80 -6
- package/esm/hooks/core/useGridVirtualizer.js +27 -12
- package/esm/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
- package/esm/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
- package/esm/hooks/features/columns/useGridColumnSpanning.js +9 -4
- package/esm/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
- package/esm/hooks/features/dimensions/useGridDimensions.js +12 -6
- package/esm/hooks/features/editing/useGridCellEditing.js +1 -1
- package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
- package/esm/hooks/features/export/serializers/csvSerializer.js +2 -4
- package/esm/hooks/features/export/useGridPrintExport.js +18 -18
- package/esm/hooks/features/filter/gridFilterUtils.js +5 -11
- package/esm/hooks/features/filter/index.d.ts +1 -1
- package/esm/hooks/features/filter/index.js +1 -1
- package/esm/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/esm/hooks/features/filter/useGridFilter.js +3 -1
- package/esm/hooks/features/focus/useGridFocus.js +0 -1
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/esm/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
- package/esm/hooks/features/pagination/useGridPaginationMeta.js +3 -3
- package/esm/hooks/features/pagination/useGridPaginationModel.js +7 -4
- package/esm/hooks/features/pagination/useGridRowCount.js +31 -15
- package/esm/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
- package/esm/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
- package/esm/hooks/features/rowReorder/gridRowReorderSelector.js +19 -1
- package/esm/hooks/features/rowSelection/useGridRowSelection.js +17 -8
- package/esm/hooks/features/rowSelection/utils.d.ts +1 -0
- package/esm/hooks/features/rowSelection/utils.js +17 -4
- package/esm/hooks/features/rows/useGridRowSpanning.js +23 -60
- package/esm/hooks/features/rows/useGridRows.js +3 -1
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
- package/esm/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
- package/esm/hooks/features/scroll/useGridScroll.js +2 -3
- package/esm/hooks/features/sorting/gridSortingUtils.js +1 -3
- package/esm/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/esm/hooks/features/sorting/useGridSorting.js +3 -1
- package/esm/hooks/features/virtualization/useGridVirtualization.js +24 -5
- package/esm/hooks/utils/useGridEvent.js +6 -2
- package/esm/hooks/utils/useGridSelector.js +2 -4
- package/esm/hooks/utils/useRunOncePerLoop.d.ts +4 -1
- package/esm/hooks/utils/useRunOncePerLoop.js +28 -18
- package/esm/index.js +1 -1
- package/esm/internals/index.d.ts +5 -4
- package/esm/internals/index.js +3 -3
- package/esm/material/index.js +1 -4
- package/esm/models/api/gridRowApi.d.ts +14 -1
- package/esm/models/api/index.d.ts +1 -1
- package/esm/models/api/index.js +0 -1
- package/esm/models/colDef/gridColDef.d.ts +14 -0
- package/esm/models/configuration/gridConfiguration.d.ts +2 -2
- package/esm/models/configuration/gridRowConfiguration.d.ts +6 -5
- package/esm/models/events/gridEventLookup.d.ts +5 -0
- package/esm/models/gridStateCommunity.d.ts +1 -1
- package/esm/models/params/gridCellParams.d.ts +0 -10
- package/esm/models/props/DataGridProps.d.ts +13 -6
- package/esm/utils/keyboardUtils.d.ts +1 -8
- package/esm/utils/keyboardUtils.js +0 -7
- package/hooks/core/gridPropsSelectors.d.ts +2 -1
- package/hooks/core/gridPropsSelectors.js +4 -1
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +4 -3
- package/hooks/core/useGridProps.js +8 -2
- package/hooks/core/useGridVirtualizer.d.ts +80 -6
- package/hooks/core/useGridVirtualizer.js +26 -11
- package/hooks/features/columnGrouping/useGridColumnGrouping.js +6 -1
- package/hooks/features/columnMenu/useGridColumnMenu.js +14 -4
- package/hooks/features/columns/useGridColumnSpanning.js +9 -4
- package/hooks/features/dataSource/useGridDataSourceBase.js +2 -2
- package/hooks/features/dimensions/useGridDimensions.js +12 -6
- package/hooks/features/editing/useGridCellEditing.js +1 -1
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/export/serializers/csvSerializer.js +2 -4
- package/hooks/features/export/useGridPrintExport.js +18 -18
- package/hooks/features/filter/gridFilterUtils.js +5 -11
- package/hooks/features/filter/index.d.ts +1 -1
- package/hooks/features/filter/index.js +6 -0
- package/hooks/features/filter/useGridFilter.d.ts +1 -1
- package/hooks/features/filter/useGridFilter.js +3 -1
- package/hooks/features/focus/useGridFocus.js +0 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +189 -25
- package/hooks/features/pagination/useGridPaginationMeta.js +2 -2
- package/hooks/features/pagination/useGridPaginationModel.js +7 -4
- package/hooks/features/pagination/useGridRowCount.js +30 -14
- package/hooks/features/rowReorder/gridRowReorderInterfaces.d.ts +19 -0
- package/hooks/features/rowReorder/gridRowReorderSelector.d.ts +20 -1
- package/hooks/features/rowReorder/gridRowReorderSelector.js +20 -2
- package/hooks/features/rowSelection/useGridRowSelection.js +17 -8
- package/hooks/features/rowSelection/utils.d.ts +1 -0
- package/hooks/features/rowSelection/utils.js +16 -3
- package/hooks/features/rows/useGridRowSpanning.js +23 -60
- package/hooks/features/rows/useGridRows.js +3 -1
- package/hooks/features/rows/useGridRowsOverridableMethods.d.ts +1 -0
- package/hooks/features/rows/useGridRowsOverridableMethods.js +57 -7
- package/hooks/features/scroll/useGridScroll.js +2 -3
- package/hooks/features/sorting/gridSortingUtils.js +1 -3
- package/hooks/features/sorting/useGridSorting.d.ts +1 -1
- package/hooks/features/sorting/useGridSorting.js +3 -1
- package/hooks/features/virtualization/useGridVirtualization.js +24 -5
- package/hooks/utils/useGridEvent.js +6 -2
- package/hooks/utils/useGridSelector.js +2 -4
- package/hooks/utils/useRunOncePerLoop.d.ts +4 -1
- package/hooks/utils/useRunOncePerLoop.js +27 -18
- package/index.js +1 -1
- package/internals/index.d.ts +5 -4
- package/internals/index.js +16 -9
- package/material/index.js +1 -4
- package/models/api/gridRowApi.d.ts +14 -1
- package/models/api/index.d.ts +1 -1
- package/models/api/index.js +0 -11
- package/models/colDef/gridColDef.d.ts +14 -0
- package/models/configuration/gridConfiguration.d.ts +2 -2
- package/models/configuration/gridRowConfiguration.d.ts +6 -5
- package/models/events/gridEventLookup.d.ts +5 -0
- package/models/gridStateCommunity.d.ts +1 -1
- package/models/params/gridCellParams.d.ts +0 -10
- package/models/props/DataGridProps.d.ts +13 -6
- package/package.json +3 -3
- package/utils/keyboardUtils.d.ts +1 -8
- package/utils/keyboardUtils.js +1 -13
|
@@ -11,7 +11,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
15
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
16
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
15
17
|
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
16
18
|
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
17
19
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
@@ -43,7 +45,19 @@ const GridCellCheckboxForwardRef = exports.GridCellCheckboxForwardRef = (0, _for
|
|
|
43
45
|
classes: rootProps.classes
|
|
44
46
|
};
|
|
45
47
|
const classes = useUtilityClasses(ownerState);
|
|
48
|
+
const {
|
|
49
|
+
isIndeterminate,
|
|
50
|
+
isChecked,
|
|
51
|
+
isSelectable
|
|
52
|
+
} = (0, _useGridSelector.useGridSelector)(apiRef, _utils.checkboxPropsSelector, {
|
|
53
|
+
groupId: id,
|
|
54
|
+
autoSelectParents: rootProps.rowSelectionPropagation?.parents ?? false
|
|
55
|
+
});
|
|
56
|
+
const disabled = !isSelectable;
|
|
46
57
|
const handleChange = event => {
|
|
58
|
+
if (disabled) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
47
61
|
const params = {
|
|
48
62
|
value: event.target.checked,
|
|
49
63
|
id
|
|
@@ -58,20 +72,26 @@ const GridCellCheckboxForwardRef = exports.GridCellCheckboxForwardRef = (0, _for
|
|
|
58
72
|
}
|
|
59
73
|
}
|
|
60
74
|
}, [apiRef, tabIndex, id, field]);
|
|
61
|
-
const handleKeyDown =
|
|
75
|
+
const handleKeyDown = (0, _useEventCallback.default)(event => {
|
|
62
76
|
if (event.key === ' ') {
|
|
63
77
|
// We call event.stopPropagation to avoid selecting the row and also scrolling to bottom
|
|
64
78
|
// TODO: Remove and add a check inside useGridKeyboardNavigation
|
|
65
79
|
event.stopPropagation();
|
|
66
80
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
if (disabled) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const handleClick = (0, _useEventCallback.default)(event => {
|
|
86
|
+
if (disabled) {
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
const handleMouseDown = (0, _useEventCallback.default)(() => {
|
|
92
|
+
if (disabled) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
75
95
|
});
|
|
76
96
|
if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
77
97
|
return null;
|
|
@@ -81,16 +101,21 @@ const GridCellCheckboxForwardRef = exports.GridCellCheckboxForwardRef = (0, _for
|
|
|
81
101
|
tabIndex: tabIndex,
|
|
82
102
|
checked: isChecked && !isIndeterminate,
|
|
83
103
|
onChange: handleChange,
|
|
84
|
-
|
|
104
|
+
onClick: handleClick,
|
|
105
|
+
onMouseDown: handleMouseDown,
|
|
106
|
+
className: (0, _clsx.default)(classes.root, disabled && 'Mui-disabled'),
|
|
107
|
+
material: {
|
|
108
|
+
disableRipple: disabled
|
|
109
|
+
},
|
|
85
110
|
slotProps: {
|
|
86
111
|
htmlInput: {
|
|
112
|
+
'aria-disabled': disabled || undefined,
|
|
87
113
|
'aria-label': label,
|
|
88
114
|
name: 'select_row'
|
|
89
115
|
}
|
|
90
116
|
},
|
|
91
117
|
onKeyDown: handleKeyDown,
|
|
92
|
-
indeterminate: isIndeterminate
|
|
93
|
-
disabled: !isSelectable
|
|
118
|
+
indeterminate: isIndeterminate
|
|
94
119
|
}, rootProps.slotProps?.baseCheckbox, other, {
|
|
95
120
|
ref: ref
|
|
96
121
|
}));
|
|
@@ -117,16 +142,6 @@ process.env.NODE_ENV !== "production" ? GridCellCheckboxForwardRef.propTypes = {
|
|
|
117
142
|
* The column field of the cell that triggered the event.
|
|
118
143
|
*/
|
|
119
144
|
field: _propTypes.default.string.isRequired,
|
|
120
|
-
/**
|
|
121
|
-
* A ref allowing to set imperative focus.
|
|
122
|
-
* It can be passed to the element that should receive focus.
|
|
123
|
-
* @ignore - do not document.
|
|
124
|
-
*/
|
|
125
|
-
focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
126
|
-
current: _propTypes.default.shape({
|
|
127
|
-
focus: _propTypes.default.func.isRequired
|
|
128
|
-
})
|
|
129
|
-
})]),
|
|
130
145
|
/**
|
|
131
146
|
* The cell value formatted with the column valueFormatter.
|
|
132
147
|
*/
|
|
@@ -21,7 +21,7 @@ const separatorIconDragStyles = {
|
|
|
21
21
|
// Emotion thinks it knows better than us which selector we should use.
|
|
22
22
|
// https://github.com/emotion-js/emotion/issues/1105#issuecomment-1722524968
|
|
23
23
|
const ignoreSsrWarning = '/* emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason */';
|
|
24
|
-
const shouldShowBorderTopRightRadiusSelector = apiRef => apiRef.current.state.dimensions.hasScrollX && (!apiRef.current.state.dimensions.hasScrollY || apiRef.current.state.dimensions.scrollbarSize === 0);
|
|
24
|
+
const shouldShowBorderTopRightRadiusSelector = apiRef => !apiRef.current.state.dimensions.isReady ? apiRef.current.state.dimensions.scrollbarSize === 0 : apiRef.current.state.dimensions.hasScrollX && (!apiRef.current.state.dimensions.hasScrollY || apiRef.current.state.dimensions.scrollbarSize === 0);
|
|
25
25
|
const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
26
26
|
name: 'MuiDataGrid',
|
|
27
27
|
slot: 'Root',
|
|
@@ -239,10 +239,6 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
239
239
|
[`& .${_gridClasses.gridClasses.treeDataGroupingCellToggle}`]: styles.treeDataGroupingCellToggle
|
|
240
240
|
}, {
|
|
241
241
|
[`& .${_gridClasses.gridClasses.withBorderColor}`]: styles.withBorderColor
|
|
242
|
-
}, {
|
|
243
|
-
[`& .${_gridClasses.gridClasses['row--dropAbove']}`]: styles['row--dropAbove']
|
|
244
|
-
}, {
|
|
245
|
-
[`& .${_gridClasses.gridClasses['row--dropBelow']}`]: styles['row--dropBelow']
|
|
246
242
|
}, {
|
|
247
243
|
[`& .${_gridClasses.gridClasses['row--beingDragged']}`]: styles['row--beingDragged']
|
|
248
244
|
}]
|
|
@@ -420,6 +416,9 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
420
416
|
alignItems: 'center',
|
|
421
417
|
backgroundColor: headerBackground
|
|
422
418
|
},
|
|
419
|
+
[`& .${_gridClasses.gridClasses.columnHeader} .${_gridClasses.gridClasses.sortButton}`]: {
|
|
420
|
+
backgroundColor: _cssVariables.vars.header.background.base
|
|
421
|
+
},
|
|
423
422
|
[`& .${_gridClasses.gridClasses['columnHeader--filter']}`]: {
|
|
424
423
|
paddingTop: 8,
|
|
425
424
|
paddingBottom: 8,
|
|
@@ -519,7 +518,16 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
519
518
|
[`& .${_gridClasses.gridClasses.columnHeader}:not(.${_gridClasses.gridClasses['columnHeader--sorted']}):hover .${_gridClasses.gridClasses.sortButton},
|
|
520
519
|
& .${_gridClasses.gridClasses.pivotPanelField}:not(.${_gridClasses.gridClasses['pivotPanelField--sorted']}):hover .${_gridClasses.gridClasses.sortButton},
|
|
521
520
|
& .${_gridClasses.gridClasses.pivotPanelField}:not(.${_gridClasses.gridClasses['pivotPanelField--sorted']}) .${_gridClasses.gridClasses.sortButton}:focus-visible`]: {
|
|
522
|
-
opacity:
|
|
521
|
+
opacity: 1
|
|
522
|
+
},
|
|
523
|
+
// Add opacity only to the button content to avoid affecting the background color
|
|
524
|
+
[`& .${_gridClasses.gridClasses.columnHeader}:not(.${_gridClasses.gridClasses['columnHeader--sorted']}):hover .${_gridClasses.gridClasses.sortButton} > *,
|
|
525
|
+
& .${_gridClasses.gridClasses.pivotPanelField}:not(.${_gridClasses.gridClasses['pivotPanelField--sorted']}):hover .${_gridClasses.gridClasses.sortButton} > *,
|
|
526
|
+
& .${_gridClasses.gridClasses.pivotPanelField}:not(.${_gridClasses.gridClasses['pivotPanelField--sorted']}) .${_gridClasses.gridClasses.sortButton}:focus-visible > *`]: {
|
|
527
|
+
opacity: 0.78
|
|
528
|
+
},
|
|
529
|
+
[`& .${_gridClasses.gridClasses.pivotPanelFieldActionContainer} button:hover`]: {
|
|
530
|
+
backgroundColor: _cssVariables.vars.colors.background.base
|
|
523
531
|
}
|
|
524
532
|
},
|
|
525
533
|
'@media (hover: none)': {
|
|
@@ -534,7 +542,7 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
534
542
|
}
|
|
535
543
|
},
|
|
536
544
|
[`& .${_gridClasses.gridClasses.pivotPanelField}:not(.${_gridClasses.gridClasses['pivotPanelField--sorted']}) .${_gridClasses.gridClasses.sortButton}`]: {
|
|
537
|
-
opacity: 0.
|
|
545
|
+
opacity: 0.78
|
|
538
546
|
}
|
|
539
547
|
},
|
|
540
548
|
// Hide the column separator when the column has border and it is not resizable
|
|
@@ -628,7 +636,8 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
628
636
|
[`&.${_gridClasses.gridClasses.rowSkeleton}:hover`]: {
|
|
629
637
|
backgroundColor: 'transparent'
|
|
630
638
|
},
|
|
631
|
-
'&.Mui-selected': selectedStyles
|
|
639
|
+
'&.Mui-selected': selectedStyles,
|
|
640
|
+
position: 'relative'
|
|
632
641
|
},
|
|
633
642
|
/* Cell styles */
|
|
634
643
|
[`& .${_gridClasses.gridClasses.cell}`]: {
|
|
@@ -873,38 +882,6 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
873
882
|
display: 'none'
|
|
874
883
|
}
|
|
875
884
|
},
|
|
876
|
-
[`& .${_gridClasses.gridClasses['row--dropAbove']}`]: {
|
|
877
|
-
position: 'relative',
|
|
878
|
-
'&::before': {
|
|
879
|
-
pointerEvents: 'none',
|
|
880
|
-
content: '""',
|
|
881
|
-
position: 'absolute',
|
|
882
|
-
top: 0,
|
|
883
|
-
left: 0,
|
|
884
|
-
width: '100%',
|
|
885
|
-
height: '2px',
|
|
886
|
-
backgroundColor: _cssVariables.vars.colors.interactive.selected
|
|
887
|
-
}
|
|
888
|
-
},
|
|
889
|
-
[`& .${_gridClasses.gridClasses['row--dropBelow']}`]: {
|
|
890
|
-
position: 'relative',
|
|
891
|
-
'&::after': {
|
|
892
|
-
zIndex: 100,
|
|
893
|
-
pointerEvents: 'none',
|
|
894
|
-
content: '""',
|
|
895
|
-
position: 'absolute',
|
|
896
|
-
bottom: '-2px',
|
|
897
|
-
left: 0,
|
|
898
|
-
width: '100%',
|
|
899
|
-
height: '2px',
|
|
900
|
-
backgroundColor: _cssVariables.vars.colors.interactive.selected
|
|
901
|
-
},
|
|
902
|
-
[`&.${_gridClasses.gridClasses['row--lastVisible']}`]: {
|
|
903
|
-
'&::after': {
|
|
904
|
-
bottom: 'calc(var(--DataGrid-hasScrollY) * 0px + (1 - var(--DataGrid-hasScrollY)) * -2px)'
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
},
|
|
908
885
|
[`& .${_gridClasses.gridClasses['row--beingDragged']}`]: {
|
|
909
886
|
color: _cssVariables.vars.colors.foreground.disabled,
|
|
910
887
|
'&:hover': {
|
|
@@ -7,6 +7,7 @@ type GridVirtualScrollbarProps = {
|
|
|
7
7
|
top: number;
|
|
8
8
|
}>;
|
|
9
9
|
};
|
|
10
|
+
export declare const scrollbarSizeCssExpression = "calc(max(var(--DataGrid-scrollbarSize), 14px))";
|
|
10
11
|
export declare const ScrollbarCorner: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme> & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>, {}, {}>;
|
|
11
12
|
declare const GridVirtualScrollbar: React.ForwardRefExoticComponent<GridVirtualScrollbarProps> | React.ForwardRefExoticComponent<GridVirtualScrollbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
13
|
export { GridVirtualScrollbar };
|
|
@@ -6,7 +6,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.ScrollbarCorner = exports.GridVirtualScrollbar = void 0;
|
|
9
|
+
exports.scrollbarSizeCssExpression = exports.ScrollbarCorner = exports.GridVirtualScrollbar = void 0;
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _system = require("@mui/system");
|
|
12
12
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
@@ -29,6 +29,12 @@ const useUtilityClasses = (ownerState, position) => {
|
|
|
29
29
|
};
|
|
30
30
|
return (0, _composeClasses.default)(slots, _gridClasses.getDataGridUtilityClass, classes);
|
|
31
31
|
};
|
|
32
|
+
|
|
33
|
+
// In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
|
|
34
|
+
// their size to be 0px throughout all the calculations, but the floating scrollbar container does need
|
|
35
|
+
// to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
|
|
36
|
+
// don't have a method to find the required size for scrollbars on those platforms.
|
|
37
|
+
const scrollbarSizeCssExpression = exports.scrollbarSizeCssExpression = 'calc(max(var(--DataGrid-scrollbarSize), 14px))';
|
|
32
38
|
const Scrollbar = (0, _system.styled)('div')({
|
|
33
39
|
position: 'absolute',
|
|
34
40
|
display: 'inline-block',
|
|
@@ -36,11 +42,7 @@ const Scrollbar = (0, _system.styled)('div')({
|
|
|
36
42
|
'&:hover': {
|
|
37
43
|
zIndex: 70
|
|
38
44
|
},
|
|
39
|
-
|
|
40
|
-
// their size to be 0px throughout all the calculations, but the floating scrollbar container does need
|
|
41
|
-
// to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
|
|
42
|
-
// don't have a method to find the required size for scrollbars on those platforms.
|
|
43
|
-
'--size': 'calc(max(var(--DataGrid-scrollbarSize), 14px))'
|
|
45
|
+
'--size': scrollbarSizeCssExpression
|
|
44
46
|
});
|
|
45
47
|
const ScrollbarVertical = (0, _system.styled)(Scrollbar)({
|
|
46
48
|
width: 'var(--size)',
|
|
@@ -72,7 +74,10 @@ const ScrollbarCorner = exports.ScrollbarCorner = (0, _system.styled)(Scrollbar)
|
|
|
72
74
|
height: 'var(--size)',
|
|
73
75
|
right: 0,
|
|
74
76
|
bottom: 0,
|
|
75
|
-
overflow: 'scroll'
|
|
77
|
+
overflow: 'scroll',
|
|
78
|
+
'@media print': {
|
|
79
|
+
display: 'none'
|
|
80
|
+
}
|
|
76
81
|
});
|
|
77
82
|
const GridVirtualScrollbar = exports.GridVirtualScrollbar = (0, _forwardRef.forwardRef)(function GridVirtualScrollbar(props, ref) {
|
|
78
83
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
@@ -101,7 +106,7 @@ const GridVirtualScrollbar = exports.GridVirtualScrollbar = (0, _forwardRef.forw
|
|
|
101
106
|
return;
|
|
102
107
|
}
|
|
103
108
|
isLocked.current = true;
|
|
104
|
-
scrollbar[propertyScroll] = scrollPosition[propertyScrollPosition];
|
|
109
|
+
scrollbar[propertyScroll] = props.scrollPosition.current[propertyScrollPosition];
|
|
105
110
|
});
|
|
106
111
|
const onScrollbarScroll = (0, _useEventCallback.default)(() => {
|
|
107
112
|
const scroller = apiRef.current.virtualScrollerRef.current;
|
|
@@ -27,6 +27,7 @@ var _GridVirtualScrollerRenderZone = require("./GridVirtualScrollerRenderZone");
|
|
|
27
27
|
var _GridVirtualScrollbar = require("./GridVirtualScrollbar");
|
|
28
28
|
var _GridScrollShadows = require("../GridScrollShadows");
|
|
29
29
|
var _GridOverlays = require("../base/GridOverlays");
|
|
30
|
+
var _useGridVirtualizer = require("../../hooks/core/useGridVirtualizer");
|
|
30
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
32
|
const useUtilityClasses = ownerState => {
|
|
32
33
|
const {
|
|
@@ -90,7 +91,7 @@ function GridVirtualScroller(props) {
|
|
|
90
91
|
loadingOverlayVariant
|
|
91
92
|
};
|
|
92
93
|
const classes = useUtilityClasses(ownerState);
|
|
93
|
-
const virtualScroller =
|
|
94
|
+
const virtualScroller = (0, _useGridVirtualizer.useGridVirtualizer)().api.getters;
|
|
94
95
|
const {
|
|
95
96
|
getContainerProps,
|
|
96
97
|
getScrollerProps,
|
|
@@ -44,7 +44,7 @@ const GridVirtualScrollerRenderZone = exports.GridVirtualScrollerRenderZone = (0
|
|
|
44
44
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
45
45
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
46
46
|
const classes = useUtilityClasses(rootProps);
|
|
47
|
-
const offsetTop = apiRef.current.virtualizer.api.
|
|
47
|
+
const offsetTop = apiRef.current.virtualizer.api.getters.getOffsetTop();
|
|
48
48
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerRenderZoneRoot, (0, _extends2.default)({
|
|
49
49
|
className: (0, _clsx.default)(classes.root, className),
|
|
50
50
|
ownerState: rootProps,
|
|
@@ -63,5 +63,6 @@ const DATA_GRID_PROPS_DEFAULT_VALUES = exports.DATA_GRID_PROPS_DEFAULT_VALUES =
|
|
|
63
63
|
sortingMode: 'client',
|
|
64
64
|
sortingOrder: ['asc', 'desc', null],
|
|
65
65
|
throttleRowsMs: 0,
|
|
66
|
-
virtualizeColumnsWithAutoRowHeight: false
|
|
66
|
+
virtualizeColumnsWithAutoRowHeight: false,
|
|
67
|
+
tabNavigation: 'none'
|
|
67
68
|
};
|
|
@@ -572,14 +572,6 @@ export interface GridClasses {
|
|
|
572
572
|
* Styles applied to the floating special row reorder cell element when it is dragged.
|
|
573
573
|
*/
|
|
574
574
|
'row--dragging': string;
|
|
575
|
-
/**
|
|
576
|
-
* Styles applied to the row element when it is a drop target above.
|
|
577
|
-
*/
|
|
578
|
-
'row--dropAbove': string;
|
|
579
|
-
/**
|
|
580
|
-
* Styles applied to the row element when it is a drop target below.
|
|
581
|
-
*/
|
|
582
|
-
'row--dropBelow': string;
|
|
583
575
|
/**
|
|
584
576
|
* Styles applied to the row element when it is being dragged (entire row).
|
|
585
577
|
*/
|
package/constants/gridClasses.js
CHANGED
|
@@ -13,4 +13,4 @@ function getDataGridUtilityClass(slot) {
|
|
|
13
13
|
}
|
|
14
14
|
const gridClasses = exports.gridClasses = (0, _generateUtilityClasses.default)('MuiDataGrid', ['aiAssistantPanel', 'aiAssistantPanelHeader', 'aiAssistantPanelTitleContainer', 'aiAssistantPanelTitle', 'aiAssistantPanelBody', 'aiAssistantPanelEmptyText', 'aiAssistantPanelFooter', 'aiAssistantPanelConversation', 'aiAssistantPanelConversationList', 'aiAssistantPanelConversationTitle', 'aiAssistantPanelSuggestions', 'aiAssistantPanelSuggestionsList', 'aiAssistantPanelSuggestionsItem', 'aiAssistantPanelSuggestionsLabel', 'actionsCell', 'aggregationColumnHeader', 'aggregationColumnHeader--alignLeft', 'aggregationColumnHeader--alignCenter', 'aggregationColumnHeader--alignRight', 'aggregationColumnHeaderLabel', 'aggregationRowOverlayWrapper', 'autoHeight', 'autosizing', 'mainContent', 'withSidePanel', 'booleanCell', 'cell--editable', 'cell--editing', 'cell--flex', 'cell--textCenter', 'cell--textLeft', 'cell--textRight', 'cell--rangeTop', 'cell--rangeBottom', 'cell--rangeLeft', 'cell--rangeRight', 'cell--pinnedLeft', 'cell--pinnedRight', 'cell--selectionMode', 'cell', 'cellCheckbox', 'cellEmpty', 'cellSkeleton', 'cellOffsetLeft', 'checkboxInput', 'collapsible', 'collapsibleTrigger', 'collapsibleIcon', 'collapsiblePanel', 'columnHeader', 'columnHeader--alignCenter', 'columnHeader--alignLeft', 'columnHeader--alignRight', 'columnHeader--dragging', 'columnHeader--moving', 'columnHeader--numeric', 'columnHeader--sortable', 'columnHeader--sorted', 'columnHeader--filtered', 'columnHeader--pinnedLeft', 'columnHeader--pinnedRight', 'columnHeader--last', 'columnHeader--siblingFocused', 'columnHeader--filter', 'columnHeaderFilterInput', 'columnHeaderFilterOperatorLabel', 'columnHeaderCheckbox', 'columnHeaderDraggableContainer', 'columnHeaderTitle', 'columnHeaderTitleContainer', 'columnHeaderTitleContainerContent', 'columnHeader--filledGroup', 'columnHeader--emptyGroup', 'columnHeaders', 'columnSeparator--resizable', 'columnSeparator--resizing', 'columnSeparator--sideLeft', 'columnSeparator--sideRight', 'columnSeparator', 'columnsManagement', 'columnsManagementRow', 'columnsManagementHeader', 'columnsManagementSearchInput', 'columnsManagementFooter', 'columnsManagementScrollArea', 'columnsManagementEmptyText', 'container--top', 'container--bottom', 'detailPanel', 'detailPanelToggleCell', 'detailPanelToggleCell--expanded', 'footerCell', 'panel', 'panelHeader', 'panelWrapper', 'panelContent', 'panelFooter', 'paper', 'editBooleanCell', 'editInputCell', 'filler', 'filler--borderBottom', 'filler--pinnedLeft', 'filler--pinnedRight', 'filterForm', 'filterFormDeleteIcon', 'filterFormLogicOperatorInput', 'filterFormColumnInput', 'filterFormOperatorInput', 'filterFormValueInput', 'filterIcon', 'footerContainer', 'headerFilterRow', 'iconButtonContainer', 'iconSeparator', 'main', 'main--hasPinnedRight', 'main--hiddenContent', 'menu', 'menuIcon', 'menuIconButton', 'menuOpen', 'menuList', 'overlay', 'overlayWrapper', 'overlayWrapperInner', 'root', 'root--densityStandard', 'root--densityComfortable', 'root--densityCompact', 'root--disableUserSelection', 'root--noToolbar', 'row', 'row--editable', 'row--editing', 'row--firstVisible', 'row--lastVisible',
|
|
15
15
|
// TODO v9: Rename to `cell--dragging`
|
|
16
|
-
'row--dragging', 'row--
|
|
16
|
+
'row--dragging', 'row--beingDragged', 'row--dynamicHeight', 'row--detailPanelExpanded', 'row--borderBottom', 'rowReorderCellPlaceholder', 'rowCount', 'rowReorderCellContainer', 'rowReorderCell', 'rowReorderCell--draggable', 'rowReorderIcon', 'rowSkeleton', 'scrollArea--left', 'scrollArea--right', 'scrollArea--up', 'scrollArea--down', 'scrollArea', 'scrollbar', 'scrollbar--vertical', 'scrollbar--horizontal', 'scrollbarFiller', 'scrollbarFiller--pinnedRight', 'scrollShadow', 'scrollShadow--vertical', 'scrollShadow--horizontal', 'selectedRowCount', 'sortButton', 'sortIcon', 'shadowScrollArea', 'sidebar', 'sidebarHeader', 'toolbarContainer', 'toolbar', 'toolbarLabel', 'toolbarDivider', 'toolbarFilterList', 'toolbarQuickFilter', 'toolbarQuickFilterTrigger', 'toolbarQuickFilterControl', 'virtualScroller', 'virtualScroller--hasScrollX', 'virtualScrollerContent', 'virtualScrollerContent--overflowed', 'virtualScrollerRenderZone', 'withVerticalBorder', 'withBorderColor', 'cell--withRightBorder', 'cell--withLeftBorder', 'columnHeader--withRightBorder', 'columnHeader--withLeftBorder', 'treeDataGroupingCell', 'treeDataGroupingCellToggle', 'treeDataGroupingCellLoadingContainer', 'groupingCriteriaCell', 'groupingCriteriaCellToggle', 'groupingCriteriaCellLoadingContainer', 'pinnedRows', 'pinnedRows--top', 'pinnedRows--bottom', 'pivotPanelAvailableFields', 'pivotPanelField', 'pivotPanelField--sorted', 'pivotPanelFieldActionContainer', 'pivotPanelFieldCheckbox', 'pivotPanelFieldDragIcon', 'pivotPanelFieldList', 'pivotPanelFieldName', 'pivotPanelHeader', 'pivotPanelPlaceholder', 'pivotPanelScrollArea', 'pivotPanelSearchContainer', 'pivotPanelSection', 'pivotPanelSectionTitle', 'pivotPanelSections', 'pivotPanelSwitch', 'pivotPanelSwitchLabel', 'prompt', 'promptContent', 'promptText', 'promptFeedback', 'promptChangeList', 'promptChangesToggle', 'promptChangesToggleIcon', 'promptIcon', 'promptIconContainer', 'promptError', 'promptAction']);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { useFirstRender } from '@mui/x-internals/useFirstRender';
|
|
4
5
|
import { useGridInitialization } from "../hooks/core/useGridInitialization.js";
|
|
5
|
-
import { useGridVirtualizer } from "../hooks/core/useGridVirtualizer.js";
|
|
6
6
|
import { useGridInitializeState } from "../hooks/utils/useGridInitializeState.js";
|
|
7
7
|
import { useGridClipboard } from "../hooks/features/clipboard/useGridClipboard.js";
|
|
8
8
|
import { columnMenuStateInitializer, useGridColumnMenu } from "../hooks/features/columnMenu/useGridColumnMenu.js";
|
|
@@ -25,7 +25,7 @@ import { useGridSorting, sortingStateInitializer } from "../hooks/features/sorti
|
|
|
25
25
|
import { useGridScroll } from "../hooks/features/scroll/useGridScroll.js";
|
|
26
26
|
import { useGridEvents } from "../hooks/features/events/useGridEvents.js";
|
|
27
27
|
import { dimensionsStateInitializer, useGridDimensions } from "../hooks/features/dimensions/useGridDimensions.js";
|
|
28
|
-
import { rowsMetaStateInitializer
|
|
28
|
+
import { rowsMetaStateInitializer } from "../hooks/features/rows/useGridRowsMeta.js";
|
|
29
29
|
import { useGridStatePersistence } from "../hooks/features/statePersistence/useGridStatePersistence.js";
|
|
30
30
|
import { useGridColumnSpanning } from "../hooks/features/columns/useGridColumnSpanning.js";
|
|
31
31
|
import { useGridColumnGrouping, columnGroupsStateInitializer } from "../hooks/features/columnGrouping/useGridColumnGrouping.js";
|
|
@@ -66,7 +66,6 @@ export const useDataGridComponent = (apiRef, props, configuration) => {
|
|
|
66
66
|
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
|
|
67
67
|
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
68
68
|
useGridInitializeState(listViewStateInitializer, apiRef, props);
|
|
69
|
-
useGridVirtualizer(apiRef, props);
|
|
70
69
|
useGridKeyboardNavigation(apiRef, props);
|
|
71
70
|
useGridRowSelection(apiRef, props);
|
|
72
71
|
useGridColumns(apiRef, props);
|
|
@@ -83,7 +82,6 @@ export const useDataGridComponent = (apiRef, props, configuration) => {
|
|
|
83
82
|
useGridDensity(apiRef, props);
|
|
84
83
|
useGridColumnResize(apiRef, props);
|
|
85
84
|
useGridPagination(apiRef, props);
|
|
86
|
-
useGridRowsMeta(apiRef, props);
|
|
87
85
|
useGridScroll(apiRef, props);
|
|
88
86
|
useGridColumnMenu(apiRef);
|
|
89
87
|
useGridCsvExport(apiRef, props);
|
|
@@ -97,6 +95,9 @@ export const useDataGridComponent = (apiRef, props, configuration) => {
|
|
|
97
95
|
useGridDataSource(apiRef, props);
|
|
98
96
|
|
|
99
97
|
// Should be the last thing to run, because all pre-processors should have been registered by now.
|
|
98
|
+
useFirstRender(() => {
|
|
99
|
+
apiRef.current.runAppliersForPendingProcessors();
|
|
100
|
+
});
|
|
100
101
|
React.useEffect(() => {
|
|
101
102
|
apiRef.current.runAppliersForPendingProcessors();
|
|
102
103
|
});
|
|
@@ -26,6 +26,7 @@ import { gridSortModelSelector } from "../hooks/features/sorting/gridSortingSele
|
|
|
26
26
|
import { gridRowNodeSelector } from "../hooks/features/rows/gridRowsSelector.js";
|
|
27
27
|
import { gridEditRowsStateSelector, gridRowIsEditingSelector } from "../hooks/features/editing/gridEditingSelectors.js";
|
|
28
28
|
import { gridIsRowDragActiveSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
|
|
29
|
+
import { GridRowDragAndDropOverlay } from "./GridRowDragAndDropOverlay.js";
|
|
29
30
|
import { getPinnedCellOffset } from "../internals/utils/getPinnedCellOffset.js";
|
|
30
31
|
import { useGridConfiguration } from "../hooks/utils/useGridConfiguration.js";
|
|
31
32
|
import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
|
|
@@ -197,7 +198,7 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
197
198
|
rowStyle[property] = propertyValue;
|
|
198
199
|
}
|
|
199
200
|
return rowStyle;
|
|
200
|
-
}, [isNotVisible, rowHeight, styleProp, heightEntry, rootProps.rowSpacingType]);
|
|
201
|
+
}, [isNotVisible, rowHeight, styleProp, heightEntry.spacingTop, heightEntry.spacingBottom, rootProps.rowSpacingType]);
|
|
201
202
|
|
|
202
203
|
// HACK: Sometimes, the rowNode has already been removed from the state but the row is still rendered.
|
|
203
204
|
if (!rowNode) {
|
|
@@ -308,7 +309,9 @@ const GridRow = forwardRef(function GridRow(props, refProp) {
|
|
|
308
309
|
}), cells, /*#__PURE__*/_jsx("div", {
|
|
309
310
|
role: "presentation",
|
|
310
311
|
className: clsx(gridClasses.cell, gridClasses.cellEmpty)
|
|
311
|
-
}), rightCells
|
|
312
|
+
}), rightCells, /*#__PURE__*/_jsx(GridRowDragAndDropOverlay, {
|
|
313
|
+
rowId: rowId
|
|
314
|
+
})]
|
|
312
315
|
}));
|
|
313
316
|
});
|
|
314
317
|
if (process.env.NODE_ENV !== "production") GridRow.displayName = "GridRow";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { GridRowId } from "../models/gridRows.js";
|
|
3
|
+
export interface GridRowDragAndDropOverlayProps {
|
|
4
|
+
rowId: GridRowId;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const GridRowDragAndDropOverlay: React.NamedExoticComponent<GridRowDragAndDropOverlayProps>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { styled, alpha } from '@mui/material/styles';
|
|
6
|
+
import { shouldForwardProp } from '@mui/system/createStyled';
|
|
7
|
+
import { useGridPrivateApiContext } from "../hooks/utils/useGridPrivateApiContext.js";
|
|
8
|
+
import { useGridSelector } from "../hooks/utils/useGridSelector.js";
|
|
9
|
+
import { gridRowDropPositionSelector } from "../hooks/features/rowReorder/gridRowReorderSelector.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const GridRowDragAndDropOverlayRoot = styled('div', {
|
|
12
|
+
name: 'MuiDataGrid',
|
|
13
|
+
slot: 'RowDragOverlay',
|
|
14
|
+
shouldForwardProp: prop => shouldForwardProp(prop) && prop !== 'action'
|
|
15
|
+
})(({
|
|
16
|
+
theme,
|
|
17
|
+
action
|
|
18
|
+
}) => _extends({
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
left: 0,
|
|
21
|
+
right: 0,
|
|
22
|
+
top: 0,
|
|
23
|
+
bottom: 0,
|
|
24
|
+
pointerEvents: 'none',
|
|
25
|
+
zIndex: 1
|
|
26
|
+
}, action === 'above' && {
|
|
27
|
+
'&::before': {
|
|
28
|
+
pointerEvents: 'none',
|
|
29
|
+
content: '""',
|
|
30
|
+
position: 'absolute',
|
|
31
|
+
top: 0,
|
|
32
|
+
left: 0,
|
|
33
|
+
right: 0,
|
|
34
|
+
height: '2px',
|
|
35
|
+
backgroundColor: (theme.vars || theme).palette.primary.main
|
|
36
|
+
}
|
|
37
|
+
}, action === 'below' && {
|
|
38
|
+
'&::after': {
|
|
39
|
+
pointerEvents: 'none',
|
|
40
|
+
content: '""',
|
|
41
|
+
position: 'absolute',
|
|
42
|
+
bottom: '-2px',
|
|
43
|
+
left: 0,
|
|
44
|
+
right: 0,
|
|
45
|
+
height: '2px',
|
|
46
|
+
backgroundColor: (theme.vars || theme).palette.primary.main
|
|
47
|
+
}
|
|
48
|
+
}, action === 'inside' && {
|
|
49
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.primary.mainChannel} / 0.1)` : alpha(theme.palette.primary.main, 0.1)
|
|
50
|
+
}));
|
|
51
|
+
export const GridRowDragAndDropOverlay = /*#__PURE__*/React.memo(function GridRowDragAndDropOverlay(props) {
|
|
52
|
+
const {
|
|
53
|
+
rowId,
|
|
54
|
+
className
|
|
55
|
+
} = props;
|
|
56
|
+
const apiRef = useGridPrivateApiContext();
|
|
57
|
+
const dropPosition = useGridSelector(apiRef, gridRowDropPositionSelector, rowId);
|
|
58
|
+
if (!dropPosition) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return /*#__PURE__*/_jsx(GridRowDragAndDropOverlayRoot, {
|
|
62
|
+
action: dropPosition,
|
|
63
|
+
className: className
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
if (process.env.NODE_ENV !== "production") GridRowDragAndDropOverlay.displayName = "GridRowDragAndDropOverlay";
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { GridRenderCellParams } from "../../models/params/gridCellParams.js";
|
|
2
3
|
import { GridMenuProps } from "../menu/GridMenu.js";
|
|
3
4
|
interface GridActionsCellProps extends Omit<GridRenderCellParams, 'api'> {
|
|
4
5
|
api?: GridRenderCellParams['api'];
|
|
5
6
|
position?: GridMenuProps['position'];
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* If true, the children passed to the component will not be validated.
|
|
10
|
+
* If false, only `GridActionsCellItem` and `React.Fragment` are allowed as children.
|
|
11
|
+
* Only use this prop if you know what you are doing.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
suppressChildrenValidation?: boolean;
|
|
6
15
|
}
|
|
7
16
|
declare function GridActionsCell(props: GridActionsCellProps): import("react/jsx-runtime").JSX.Element;
|
|
8
17
|
declare namespace GridActionsCell {
|