@mui/x-data-grid 6.6.0 → 6.8.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 +147 -13
- package/components/GridColumnHeaders.d.ts +2 -2
- package/components/GridColumnHeaders.js +3 -1
- package/components/GridRow.d.ts +2 -2
- package/components/GridRow.js +23 -69
- package/components/cell/GridCell.d.ts +24 -15
- package/components/cell/GridCell.js +422 -45
- package/components/cell/index.d.ts +2 -1
- package/components/cell/index.js +1 -1
- package/components/containers/GridRootStyles.js +38 -17
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/components/panel/GridColumnsPanel.d.ts +14 -0
- package/components/panel/GridColumnsPanel.js +14 -0
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +0 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
- package/components/panel/filterPanel/GridFilterInputDate.d.ts +0 -1
- package/components/panel/filterPanel/GridFilterInputDate.js +1 -6
- package/components/panel/filterPanel/GridFilterInputSingleSelect.d.ts +0 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +5 -6
- package/components/panel/filterPanel/GridFilterInputValue.d.ts +0 -1
- package/components/panel/filterPanel/GridFilterInputValue.js +1 -6
- package/components/panel/filterPanel/GridFilterPanel.d.ts +8 -0
- package/components/panel/filterPanel/GridFilterPanel.js +8 -0
- package/components/toolbar/GridToolbar.js +2 -2
- package/components/virtualization/GridVirtualScroller.js +4 -9
- package/components/virtualization/GridVirtualScrollerContent.js +11 -20
- package/constants/defaultGridSlotsComponents.js +6 -2
- package/constants/gridClasses.d.ts +4 -0
- package/constants/gridClasses.js +1 -1
- package/constants/localeTextConstants.js +4 -4
- package/hooks/core/useGridApiInitialization.js +4 -1
- package/hooks/core/useGridStateInitialization.js +2 -9
- package/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
- package/hooks/features/editing/useGridCellEditing.js +5 -3
- package/hooks/features/editing/useGridRowEditing.js +14 -6
- package/hooks/features/filter/gridFilterUtils.d.ts +4 -1
- package/hooks/features/filter/gridFilterUtils.js +19 -13
- package/hooks/features/filter/useGridFilter.js +4 -2
- package/hooks/features/focus/useGridFocus.js +10 -4
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -0
- package/hooks/features/rows/useGridParamsApi.js +7 -15
- package/hooks/features/rows/useGridRowsMeta.js +1 -1
- package/hooks/features/sorting/useGridSorting.js +2 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +8 -816
- package/hooks/features/virtualization/useGridVirtualScroller.js +42 -40
- package/hooks/utils/index.d.ts +1 -1
- package/hooks/utils/index.js +1 -1
- package/hooks/utils/useGridSelector.d.ts +3 -1
- package/hooks/utils/useGridSelector.js +37 -6
- package/hooks/utils/useLazyRef.d.ts +2 -0
- package/hooks/utils/useLazyRef.js +9 -0
- package/hooks/utils/useOnMount.d.ts +2 -0
- package/hooks/utils/useOnMount.js +7 -0
- package/index.js +1 -1
- package/legacy/components/GridColumnHeaders.js +3 -1
- package/legacy/components/GridRow.js +25 -69
- package/legacy/components/cell/GridCell.js +425 -46
- package/legacy/components/cell/index.js +1 -1
- package/legacy/components/containers/GridRootStyles.js +25 -18
- package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/legacy/components/panel/GridColumnsPanel.js +14 -0
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +7 -7
- package/legacy/components/panel/filterPanel/GridFilterInputDate.js +1 -5
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +6 -6
- package/legacy/components/panel/filterPanel/GridFilterInputValue.js +1 -5
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +8 -0
- package/legacy/components/toolbar/GridToolbar.js +2 -2
- package/legacy/components/virtualization/GridVirtualScroller.js +4 -7
- package/legacy/components/virtualization/GridVirtualScrollerContent.js +10 -17
- package/legacy/constants/defaultGridSlotsComponents.js +6 -2
- package/legacy/constants/gridClasses.js +1 -1
- package/legacy/constants/localeTextConstants.js +4 -4
- package/legacy/hooks/core/useGridApiInitialization.js +4 -1
- package/legacy/hooks/core/useGridStateInitialization.js +2 -7
- package/legacy/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
- package/legacy/hooks/features/editing/useGridCellEditing.js +5 -3
- package/legacy/hooks/features/editing/useGridRowEditing.js +15 -7
- package/legacy/hooks/features/filter/gridFilterUtils.js +23 -19
- package/legacy/hooks/features/filter/useGridFilter.js +4 -2
- package/legacy/hooks/features/focus/useGridFocus.js +10 -4
- package/legacy/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/legacy/hooks/features/rows/useGridParamsApi.js +23 -15
- package/legacy/hooks/features/rows/useGridRowsMeta.js +1 -1
- package/legacy/hooks/features/sorting/useGridSorting.js +2 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +40 -36
- package/legacy/hooks/utils/index.js +1 -1
- package/legacy/hooks/utils/useGridSelector.js +43 -5
- package/legacy/hooks/utils/useLazyRef.js +9 -0
- package/legacy/hooks/utils/useOnMount.js +7 -0
- package/legacy/index.js +1 -1
- package/legacy/locales/arSD.js +4 -4
- package/legacy/locales/beBY.js +4 -4
- package/legacy/locales/bgBG.js +4 -4
- package/legacy/locales/csCZ.js +25 -27
- package/legacy/locales/daDK.js +4 -4
- package/legacy/locales/deDE.js +25 -27
- package/legacy/locales/elGR.js +70 -79
- package/legacy/locales/esES.js +4 -4
- package/legacy/locales/faIR.js +4 -4
- package/legacy/locales/fiFI.js +4 -4
- package/legacy/locales/heIL.js +4 -4
- package/legacy/locales/huHU.js +4 -4
- package/legacy/locales/itIT.js +4 -4
- package/legacy/locales/jaJP.js +4 -4
- package/legacy/locales/koKR.js +4 -4
- package/legacy/locales/nbNO.js +4 -4
- package/legacy/locales/plPL.js +4 -4
- package/legacy/locales/ptBR.js +4 -4
- package/legacy/locales/roRO.js +4 -4
- package/legacy/locales/ruRU.js +4 -4
- package/legacy/locales/skSK.js +4 -4
- package/legacy/locales/svSE.js +4 -4
- package/legacy/locales/trTR.js +16 -17
- package/legacy/locales/ukUA.js +4 -4
- package/legacy/locales/urPK.js +4 -4
- package/legacy/locales/viVN.js +4 -4
- package/legacy/locales/zhCN.js +4 -4
- package/legacy/locales/zhTW.js +4 -4
- package/legacy/utils/EventManager.js +2 -2
- package/legacy/utils/Store.js +34 -0
- package/legacy/utils/doesSupportPreventScroll.js +13 -0
- package/legacy/utils/fastMemo.js +5 -0
- package/legacy/utils/fastObjectShallowCompare.js +32 -0
- package/legacy/utils/keyboardUtils.js +4 -2
- package/locales/arSD.js +4 -4
- package/locales/beBY.js +4 -4
- package/locales/bgBG.js +4 -4
- package/locales/csCZ.js +25 -27
- package/locales/daDK.js +4 -4
- package/locales/deDE.js +25 -27
- package/locales/elGR.js +66 -79
- package/locales/esES.js +4 -4
- package/locales/faIR.js +4 -4
- package/locales/fiFI.js +4 -4
- package/locales/heIL.js +4 -4
- package/locales/huHU.js +4 -4
- package/locales/itIT.js +4 -4
- package/locales/jaJP.js +4 -4
- package/locales/koKR.js +4 -4
- package/locales/nbNO.js +4 -4
- package/locales/plPL.js +4 -4
- package/locales/ptBR.js +4 -4
- package/locales/roRO.js +4 -4
- package/locales/ruRU.js +4 -4
- package/locales/skSK.js +4 -4
- package/locales/svSE.js +4 -4
- package/locales/trTR.js +16 -17
- package/locales/ukUA.js +4 -4
- package/locales/urPK.js +4 -4
- package/locales/viVN.js +4 -4
- package/locales/zhCN.js +4 -4
- package/locales/zhTW.js +4 -4
- package/models/api/gridCoreApi.d.ts +6 -0
- package/models/colDef/gridColDef.d.ts +4 -3
- package/models/colDef/gridColType.d.ts +3 -1
- package/models/events/gridEventLookup.d.ts +11 -3
- package/modern/components/GridColumnHeaders.js +3 -1
- package/modern/components/GridRow.js +22 -69
- package/modern/components/cell/GridCell.js +421 -45
- package/modern/components/cell/index.js +1 -1
- package/modern/components/containers/GridRootStyles.js +38 -17
- package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/modern/components/panel/GridColumnsPanel.js +14 -0
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
- package/modern/components/panel/filterPanel/GridFilterInputDate.js +1 -6
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +5 -6
- package/modern/components/panel/filterPanel/GridFilterInputValue.js +1 -6
- package/modern/components/panel/filterPanel/GridFilterPanel.js +8 -0
- package/modern/components/toolbar/GridToolbar.js +2 -2
- package/modern/components/virtualization/GridVirtualScroller.js +4 -9
- package/modern/components/virtualization/GridVirtualScrollerContent.js +10 -20
- package/modern/constants/defaultGridSlotsComponents.js +6 -2
- package/modern/constants/gridClasses.js +1 -1
- package/modern/constants/localeTextConstants.js +4 -4
- package/modern/hooks/core/useGridApiInitialization.js +4 -1
- package/modern/hooks/core/useGridStateInitialization.js +2 -9
- package/modern/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +9 -3
- package/modern/hooks/features/editing/useGridCellEditing.js +5 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +14 -6
- package/modern/hooks/features/filter/gridFilterUtils.js +17 -12
- package/modern/hooks/features/filter/useGridFilter.js +4 -2
- package/modern/hooks/features/focus/useGridFocus.js +9 -4
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/modern/hooks/features/rows/useGridParamsApi.js +7 -15
- package/modern/hooks/features/rows/useGridRowsMeta.js +1 -1
- package/modern/hooks/features/sorting/useGridSorting.js +2 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +42 -40
- package/modern/hooks/utils/index.js +1 -1
- package/modern/hooks/utils/useGridSelector.js +37 -6
- package/modern/hooks/utils/useLazyRef.js +9 -0
- package/modern/hooks/utils/useOnMount.js +7 -0
- package/modern/index.js +1 -1
- package/modern/locales/arSD.js +4 -4
- package/modern/locales/beBY.js +4 -4
- package/modern/locales/bgBG.js +4 -4
- package/modern/locales/csCZ.js +25 -27
- package/modern/locales/daDK.js +4 -4
- package/modern/locales/deDE.js +25 -27
- package/modern/locales/elGR.js +66 -79
- package/modern/locales/esES.js +4 -4
- package/modern/locales/faIR.js +4 -4
- package/modern/locales/fiFI.js +4 -4
- package/modern/locales/heIL.js +4 -4
- package/modern/locales/huHU.js +4 -4
- package/modern/locales/itIT.js +4 -4
- package/modern/locales/jaJP.js +4 -4
- package/modern/locales/koKR.js +4 -4
- package/modern/locales/nbNO.js +4 -4
- package/modern/locales/plPL.js +4 -4
- package/modern/locales/ptBR.js +4 -4
- package/modern/locales/roRO.js +4 -4
- package/modern/locales/ruRU.js +4 -4
- package/modern/locales/skSK.js +4 -4
- package/modern/locales/svSE.js +4 -4
- package/modern/locales/trTR.js +16 -17
- package/modern/locales/ukUA.js +4 -4
- package/modern/locales/urPK.js +4 -4
- package/modern/locales/viVN.js +4 -4
- package/modern/locales/zhCN.js +4 -4
- package/modern/locales/zhTW.js +4 -4
- package/modern/utils/EventManager.js +2 -2
- package/modern/utils/Store.js +24 -0
- package/modern/utils/doesSupportPreventScroll.js +13 -0
- package/modern/utils/fastMemo.js +5 -0
- package/modern/utils/fastObjectShallowCompare.js +32 -0
- package/modern/utils/keyboardUtils.js +4 -2
- package/node/components/GridColumnHeaders.js +4 -2
- package/node/components/GridRow.js +22 -69
- package/node/components/cell/GridCell.js +424 -47
- package/node/components/cell/index.js +17 -10
- package/node/components/containers/GridRootStyles.js +38 -17
- package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +1 -1
- package/node/components/panel/GridColumnsPanel.js +14 -0
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +6 -7
- package/node/components/panel/filterPanel/GridFilterInputDate.js +1 -6
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +5 -6
- package/node/components/panel/filterPanel/GridFilterInputValue.js +1 -6
- package/node/components/panel/filterPanel/GridFilterPanel.js +8 -0
- package/node/components/toolbar/GridToolbar.js +2 -2
- package/node/components/virtualization/GridVirtualScroller.js +4 -9
- package/node/components/virtualization/GridVirtualScrollerContent.js +10 -20
- package/node/constants/defaultGridSlotsComponents.js +4 -1
- package/node/constants/gridClasses.js +1 -1
- package/node/constants/localeTextConstants.js +4 -4
- package/node/hooks/core/useGridApiInitialization.js +4 -1
- package/node/hooks/core/useGridStateInitialization.js +2 -9
- package/node/hooks/features/clipboard/useGridClipboard.js +1 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -2
- package/node/hooks/features/editing/useGridCellEditing.js +5 -3
- package/node/hooks/features/editing/useGridRowEditing.js +14 -6
- package/node/hooks/features/filter/gridFilterUtils.js +17 -12
- package/node/hooks/features/filter/useGridFilter.js +7 -5
- package/node/hooks/features/focus/useGridFocus.js +9 -4
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +2 -3
- package/node/hooks/features/rows/useGridParamsApi.js +9 -15
- package/node/hooks/features/rows/useGridRowsMeta.js +1 -1
- package/node/hooks/features/sorting/useGridSorting.js +2 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +42 -38
- package/node/hooks/utils/index.js +14 -10
- package/node/hooks/utils/useGridSelector.js +41 -7
- package/node/hooks/utils/useLazyRef.js +17 -0
- package/node/hooks/utils/useOnMount.js +15 -0
- package/node/index.js +1 -1
- package/node/locales/arSD.js +4 -4
- package/node/locales/beBY.js +4 -4
- package/node/locales/bgBG.js +4 -4
- package/node/locales/csCZ.js +25 -27
- package/node/locales/daDK.js +4 -4
- package/node/locales/deDE.js +25 -27
- package/node/locales/elGR.js +66 -79
- package/node/locales/esES.js +4 -4
- package/node/locales/faIR.js +4 -4
- package/node/locales/fiFI.js +4 -4
- package/node/locales/heIL.js +4 -4
- package/node/locales/huHU.js +4 -4
- package/node/locales/itIT.js +4 -4
- package/node/locales/jaJP.js +4 -4
- package/node/locales/koKR.js +4 -4
- package/node/locales/nbNO.js +4 -4
- package/node/locales/plPL.js +4 -4
- package/node/locales/ptBR.js +4 -4
- package/node/locales/roRO.js +4 -4
- package/node/locales/ruRU.js +4 -4
- package/node/locales/skSK.js +4 -4
- package/node/locales/svSE.js +4 -4
- package/node/locales/trTR.js +16 -17
- package/node/locales/ukUA.js +4 -4
- package/node/locales/urPK.js +4 -4
- package/node/locales/viVN.js +4 -4
- package/node/locales/zhCN.js +4 -4
- package/node/locales/zhTW.js +4 -4
- package/node/utils/EventManager.js +2 -2
- package/node/utils/Store.js +31 -0
- package/node/utils/doesSupportPreventScroll.js +19 -0
- package/node/utils/fastMemo.js +13 -0
- package/node/utils/fastObjectShallowCompare.js +38 -0
- package/node/utils/keyboardUtils.js +4 -2
- package/package.json +1 -1
- package/themeAugmentation/overrides.d.ts +1 -1
- package/utils/EventManager.js +2 -2
- package/utils/Store.d.ts +11 -0
- package/utils/Store.js +24 -0
- package/utils/doesSupportPreventScroll.d.ts +1 -0
- package/utils/doesSupportPreventScroll.js +13 -0
- package/utils/fastMemo.d.ts +1 -0
- package/utils/fastMemo.js +5 -0
- package/utils/fastObjectShallowCompare.d.ts +1 -0
- package/utils/fastObjectShallowCompare.js +32 -0
- package/utils/keyboardUtils.js +4 -2
|
@@ -1,30 +1,48 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["changeReason", "unstable_updateValueOnRender"],
|
|
4
|
+
_excluded2 = ["align", "children", "colIndex", "column", "cellMode", "field", "formattedValue", "hasFocus", "height", "isEditable", "isSelected", "rowId", "tabIndex", "value", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
5
|
+
_excluded3 = ["column", "rowId", "editCellState", "align", "children", "colIndex", "height", "width", "className", "showRightBorder", "extendRowFullWidth", "row", "colSpan", "disableDragEvents", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
6
|
+
_excluded4 = ["changeReason", "unstable_updateValueOnRender"];
|
|
4
7
|
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
5
8
|
import * as React from 'react';
|
|
6
9
|
import PropTypes from 'prop-types';
|
|
7
10
|
import clsx from 'clsx';
|
|
8
11
|
import { unstable_useForkRef as useForkRef, unstable_composeClasses as composeClasses, unstable_ownerDocument as ownerDocument, unstable_capitalize as capitalize } from '@mui/utils';
|
|
9
|
-
import {
|
|
12
|
+
import { fastMemo } from '../../utils/fastMemo';
|
|
13
|
+
import { doesSupportPreventScroll } from '../../utils/doesSupportPreventScroll';
|
|
14
|
+
import { getDataGridUtilityClass, gridClasses } from '../../constants/gridClasses';
|
|
10
15
|
import { GridCellModes } from '../../models';
|
|
16
|
+
import { useGridSelector, objectShallowCompare } from '../../hooks/utils/useGridSelector';
|
|
11
17
|
import { useGridApiContext } from '../../hooks/utils/useGridApiContext';
|
|
12
18
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
13
19
|
import { gridFocusCellSelector } from '../../hooks/features/focus/gridFocusStateSelector';
|
|
20
|
+
import { MissingRowIdError } from '../../hooks/features/rows/useGridParamsApi';
|
|
14
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const EMPTY_CELL_PARAMS = {
|
|
23
|
+
id: -1,
|
|
24
|
+
field: '__unset__',
|
|
25
|
+
row: {},
|
|
26
|
+
rowNode: {
|
|
27
|
+
id: -1,
|
|
28
|
+
depth: 0,
|
|
29
|
+
type: 'leaf',
|
|
30
|
+
parent: -1,
|
|
31
|
+
groupingKey: null
|
|
32
|
+
},
|
|
33
|
+
colDef: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
field: '__unset__',
|
|
36
|
+
computedWidth: 0
|
|
37
|
+
},
|
|
38
|
+
cellMode: GridCellModes.View,
|
|
39
|
+
hasFocus: false,
|
|
40
|
+
tabIndex: -1,
|
|
41
|
+
value: null,
|
|
42
|
+
formattedValue: '__unset__',
|
|
43
|
+
isEditable: false,
|
|
44
|
+
api: {}
|
|
45
|
+
};
|
|
28
46
|
const useUtilityClasses = ownerState => {
|
|
29
47
|
const {
|
|
30
48
|
align,
|
|
@@ -40,11 +58,109 @@ const useUtilityClasses = ownerState => {
|
|
|
40
58
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
41
59
|
};
|
|
42
60
|
let warnedOnce = false;
|
|
61
|
+
|
|
62
|
+
// GridCellWrapper is a compatibility layer for the V6 cell slot. If we can use the more efficient
|
|
63
|
+
// `GridCellV7`, we should. That component is a merge of `GridCellWrapper` and `GridCell`.
|
|
64
|
+
// TODO(v7): Remove the wrapper & cellV6 and use the cellV7 exclusively.
|
|
65
|
+
// TODO(v7): Removing the wrapper will break the docs performance visualization demo.
|
|
66
|
+
const GridCellWrapper = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
67
|
+
const {
|
|
68
|
+
column,
|
|
69
|
+
rowId,
|
|
70
|
+
editCellState
|
|
71
|
+
} = props;
|
|
72
|
+
const apiRef = useGridApiContext();
|
|
73
|
+
const rootProps = useGridRootProps();
|
|
74
|
+
const field = column.field;
|
|
75
|
+
const cellParamsWithAPI = useGridSelector(apiRef, () => {
|
|
76
|
+
// This is required because `.getCellParams` tries to get the `state.rows.tree` entry
|
|
77
|
+
// associated with `rowId`/`fieldId`, but this selector runs after the state has been
|
|
78
|
+
// updated, while `rowId`/`fieldId` reference an entry in the old state.
|
|
79
|
+
try {
|
|
80
|
+
const cellParams = apiRef.current.getCellParams(rowId, field);
|
|
81
|
+
const result = cellParams;
|
|
82
|
+
result.api = apiRef.current;
|
|
83
|
+
return result;
|
|
84
|
+
} catch (e) {
|
|
85
|
+
if (e instanceof MissingRowIdError) {
|
|
86
|
+
return EMPTY_CELL_PARAMS;
|
|
87
|
+
}
|
|
88
|
+
throw e;
|
|
89
|
+
}
|
|
90
|
+
}, objectShallowCompare);
|
|
91
|
+
const isSelected = useGridSelector(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
|
|
92
|
+
id: rowId,
|
|
93
|
+
field
|
|
94
|
+
}));
|
|
95
|
+
if (cellParamsWithAPI === EMPTY_CELL_PARAMS) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
const {
|
|
99
|
+
cellMode,
|
|
100
|
+
hasFocus,
|
|
101
|
+
isEditable,
|
|
102
|
+
value,
|
|
103
|
+
formattedValue
|
|
104
|
+
} = cellParamsWithAPI;
|
|
105
|
+
const managesOwnFocus = column.type === 'actions';
|
|
106
|
+
const tabIndex = (cellMode === 'view' || !isEditable) && !managesOwnFocus ? cellParamsWithAPI.tabIndex : -1;
|
|
107
|
+
const {
|
|
108
|
+
classes: rootClasses,
|
|
109
|
+
getCellClassName
|
|
110
|
+
} = rootProps;
|
|
111
|
+
const classNames = apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
|
|
112
|
+
id: rowId,
|
|
113
|
+
field
|
|
114
|
+
});
|
|
115
|
+
if (column.cellClassName) {
|
|
116
|
+
classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(cellParamsWithAPI) : column.cellClassName);
|
|
117
|
+
}
|
|
118
|
+
if (getCellClassName) {
|
|
119
|
+
classNames.push(getCellClassName(cellParamsWithAPI));
|
|
120
|
+
}
|
|
121
|
+
let children;
|
|
122
|
+
if (editCellState == null && column.renderCell) {
|
|
123
|
+
children = column.renderCell(cellParamsWithAPI);
|
|
124
|
+
classNames.push(gridClasses['cell--withRenderer']);
|
|
125
|
+
classNames.push(rootClasses?.['cell--withRenderer']);
|
|
126
|
+
}
|
|
127
|
+
if (editCellState != null && column.renderEditCell) {
|
|
128
|
+
const updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
|
|
129
|
+
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
131
|
+
const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded);
|
|
132
|
+
const params = _extends({}, cellParamsWithAPI, {
|
|
133
|
+
row: updatedRow
|
|
134
|
+
}, editCellStateRest);
|
|
135
|
+
children = column.renderEditCell(params);
|
|
136
|
+
classNames.push(gridClasses['cell--editing']);
|
|
137
|
+
classNames.push(rootClasses?.['cell--editing']);
|
|
138
|
+
}
|
|
139
|
+
const {
|
|
140
|
+
slots
|
|
141
|
+
} = rootProps;
|
|
142
|
+
const CellComponent = slots.cell;
|
|
143
|
+
const cellProps = _extends({}, props, {
|
|
144
|
+
ref,
|
|
145
|
+
field,
|
|
146
|
+
formattedValue,
|
|
147
|
+
hasFocus,
|
|
148
|
+
isEditable,
|
|
149
|
+
isSelected,
|
|
150
|
+
value,
|
|
151
|
+
cellMode,
|
|
152
|
+
children,
|
|
153
|
+
tabIndex,
|
|
154
|
+
className: clsx(classNames)
|
|
155
|
+
});
|
|
156
|
+
return /*#__PURE__*/React.createElement(CellComponent, cellProps);
|
|
157
|
+
});
|
|
43
158
|
const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
44
159
|
const {
|
|
45
160
|
align,
|
|
46
|
-
children,
|
|
161
|
+
children: childrenProp,
|
|
47
162
|
colIndex,
|
|
163
|
+
column,
|
|
48
164
|
cellMode,
|
|
49
165
|
field,
|
|
50
166
|
formattedValue,
|
|
@@ -70,7 +186,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
70
186
|
onDragEnter,
|
|
71
187
|
onDragOver
|
|
72
188
|
} = props,
|
|
73
|
-
other = _objectWithoutPropertiesLoose(props,
|
|
189
|
+
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
74
190
|
const valueToRender = formattedValue == null ? value : formattedValue;
|
|
75
191
|
const cellRef = React.useRef(null);
|
|
76
192
|
const handleRef = useForkRef(ref, cellRef);
|
|
@@ -152,24 +268,21 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
152
268
|
}
|
|
153
269
|
};
|
|
154
270
|
}
|
|
155
|
-
const column = apiRef.current.getColumn(field);
|
|
156
271
|
const managesOwnFocus = column.type === 'actions';
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return children;
|
|
172
|
-
};
|
|
272
|
+
let children = childrenProp;
|
|
273
|
+
if (children === undefined) {
|
|
274
|
+
const valueString = valueToRender?.toString();
|
|
275
|
+
children = /*#__PURE__*/_jsx("div", {
|
|
276
|
+
className: classes.content,
|
|
277
|
+
title: valueString,
|
|
278
|
+
children: valueString
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
|
|
282
|
+
children = /*#__PURE__*/React.cloneElement(children, {
|
|
283
|
+
focusElementRef
|
|
284
|
+
});
|
|
285
|
+
}
|
|
173
286
|
const draggableEventHandlers = disableDragEvents ? null : {
|
|
174
287
|
onDragEnter: publish('cellDragEnter', onDragEnter),
|
|
175
288
|
onDragOver: publish('cellDragOver', onDragOver)
|
|
@@ -183,7 +296,7 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
183
296
|
"aria-colindex": colIndex + 1,
|
|
184
297
|
"aria-colspan": colSpan,
|
|
185
298
|
style: style,
|
|
186
|
-
tabIndex:
|
|
299
|
+
tabIndex: tabIndex,
|
|
187
300
|
onClick: publish('cellClick', onClick),
|
|
188
301
|
onDoubleClick: publish('cellDoubleClick', onDoubleClick),
|
|
189
302
|
onMouseOver: publish('cellMouseOver', onMouseOver),
|
|
@@ -193,10 +306,33 @@ const GridCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
193
306
|
onKeyUp: publish('cellKeyUp', onKeyUp)
|
|
194
307
|
}, draggableEventHandlers, other, {
|
|
195
308
|
onFocus: handleFocus,
|
|
196
|
-
children:
|
|
309
|
+
children: children
|
|
197
310
|
}));
|
|
198
311
|
});
|
|
199
|
-
const
|
|
312
|
+
const MemoizedCellWrapper = fastMemo(GridCellWrapper);
|
|
313
|
+
process.env.NODE_ENV !== "production" ? GridCellWrapper.propTypes = {
|
|
314
|
+
// ----------------------------- Warning --------------------------------
|
|
315
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
316
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
317
|
+
// ----------------------------------------------------------------------
|
|
318
|
+
align: PropTypes.oneOf(['center', 'left', 'right']),
|
|
319
|
+
className: PropTypes.string,
|
|
320
|
+
colIndex: PropTypes.number,
|
|
321
|
+
colSpan: PropTypes.number,
|
|
322
|
+
column: PropTypes.object,
|
|
323
|
+
disableDragEvents: PropTypes.bool,
|
|
324
|
+
height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
325
|
+
onClick: PropTypes.func,
|
|
326
|
+
onDoubleClick: PropTypes.func,
|
|
327
|
+
onDragEnter: PropTypes.func,
|
|
328
|
+
onDragOver: PropTypes.func,
|
|
329
|
+
onKeyDown: PropTypes.func,
|
|
330
|
+
onMouseDown: PropTypes.func,
|
|
331
|
+
onMouseUp: PropTypes.func,
|
|
332
|
+
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
333
|
+
showRightBorder: PropTypes.bool,
|
|
334
|
+
width: PropTypes.number
|
|
335
|
+
} : void 0;
|
|
200
336
|
process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
201
337
|
// ----------------------------- Warning --------------------------------
|
|
202
338
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -208,13 +344,254 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
208
344
|
className: PropTypes.string,
|
|
209
345
|
colIndex: PropTypes.number,
|
|
210
346
|
colSpan: PropTypes.number,
|
|
347
|
+
column: PropTypes.object,
|
|
348
|
+
disableDragEvents: PropTypes.bool,
|
|
349
|
+
editCellState: PropTypes.shape({
|
|
350
|
+
changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
351
|
+
isProcessingProps: PropTypes.bool,
|
|
352
|
+
isValidating: PropTypes.bool,
|
|
353
|
+
value: PropTypes.any
|
|
354
|
+
}),
|
|
355
|
+
height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
356
|
+
onClick: PropTypes.func,
|
|
357
|
+
onDoubleClick: PropTypes.func,
|
|
358
|
+
onDragEnter: PropTypes.func,
|
|
359
|
+
onDragOver: PropTypes.func,
|
|
360
|
+
onKeyDown: PropTypes.func,
|
|
361
|
+
onMouseDown: PropTypes.func,
|
|
362
|
+
onMouseUp: PropTypes.func,
|
|
363
|
+
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
364
|
+
showRightBorder: PropTypes.bool,
|
|
365
|
+
width: PropTypes.number
|
|
366
|
+
} : void 0;
|
|
367
|
+
export { MemoizedCellWrapper as GridCellWrapper, GridCell };
|
|
368
|
+
const GridCellV7 = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
369
|
+
const {
|
|
370
|
+
column,
|
|
371
|
+
rowId,
|
|
372
|
+
editCellState,
|
|
373
|
+
align,
|
|
374
|
+
colIndex,
|
|
375
|
+
height,
|
|
376
|
+
width,
|
|
377
|
+
className,
|
|
378
|
+
showRightBorder,
|
|
379
|
+
colSpan,
|
|
380
|
+
disableDragEvents,
|
|
381
|
+
onClick,
|
|
382
|
+
onDoubleClick,
|
|
383
|
+
onMouseDown,
|
|
384
|
+
onMouseUp,
|
|
385
|
+
onMouseOver,
|
|
386
|
+
onKeyDown,
|
|
387
|
+
onKeyUp,
|
|
388
|
+
onDragEnter,
|
|
389
|
+
onDragOver
|
|
390
|
+
} = props,
|
|
391
|
+
other = _objectWithoutPropertiesLoose(props, _excluded3);
|
|
392
|
+
const apiRef = useGridApiContext();
|
|
393
|
+
const rootProps = useGridRootProps();
|
|
394
|
+
const field = column.field;
|
|
395
|
+
const cellParamsWithAPI = useGridSelector(apiRef, () => {
|
|
396
|
+
// This is required because `.getCellParams` tries to get the `state.rows.tree` entry
|
|
397
|
+
// associated with `rowId`/`fieldId`, but this selector runs after the state has been
|
|
398
|
+
// updated, while `rowId`/`fieldId` reference an entry in the old state.
|
|
399
|
+
try {
|
|
400
|
+
const cellParams = apiRef.current.getCellParams(rowId, field);
|
|
401
|
+
const result = cellParams;
|
|
402
|
+
result.api = apiRef.current;
|
|
403
|
+
return result;
|
|
404
|
+
} catch (e) {
|
|
405
|
+
if (e instanceof MissingRowIdError) {
|
|
406
|
+
return EMPTY_CELL_PARAMS;
|
|
407
|
+
}
|
|
408
|
+
throw e;
|
|
409
|
+
}
|
|
410
|
+
}, objectShallowCompare);
|
|
411
|
+
const isSelected = useGridSelector(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
|
|
412
|
+
id: rowId,
|
|
413
|
+
field
|
|
414
|
+
}));
|
|
415
|
+
const {
|
|
416
|
+
cellMode,
|
|
417
|
+
hasFocus,
|
|
418
|
+
isEditable,
|
|
419
|
+
value,
|
|
420
|
+
formattedValue
|
|
421
|
+
} = cellParamsWithAPI;
|
|
422
|
+
const managesOwnFocus = column.type === 'actions';
|
|
423
|
+
const tabIndex = (cellMode === 'view' || !isEditable) && !managesOwnFocus ? cellParamsWithAPI.tabIndex : -1;
|
|
424
|
+
const {
|
|
425
|
+
classes: rootClasses,
|
|
426
|
+
getCellClassName
|
|
427
|
+
} = rootProps;
|
|
428
|
+
const classNames = apiRef.current.unstable_applyPipeProcessors('cellClassName', [], {
|
|
429
|
+
id: rowId,
|
|
430
|
+
field
|
|
431
|
+
});
|
|
432
|
+
if (column.cellClassName) {
|
|
433
|
+
classNames.push(typeof column.cellClassName === 'function' ? column.cellClassName(cellParamsWithAPI) : column.cellClassName);
|
|
434
|
+
}
|
|
435
|
+
if (getCellClassName) {
|
|
436
|
+
classNames.push(getCellClassName(cellParamsWithAPI));
|
|
437
|
+
}
|
|
438
|
+
const valueToRender = formattedValue == null ? value : formattedValue;
|
|
439
|
+
const cellRef = React.useRef(null);
|
|
440
|
+
const handleRef = useForkRef(ref, cellRef);
|
|
441
|
+
const focusElementRef = React.useRef(null);
|
|
442
|
+
const ownerState = {
|
|
443
|
+
align,
|
|
444
|
+
showRightBorder,
|
|
445
|
+
isEditable,
|
|
446
|
+
classes: rootProps.classes,
|
|
447
|
+
isSelected
|
|
448
|
+
};
|
|
449
|
+
const classes = useUtilityClasses(ownerState);
|
|
450
|
+
const publishMouseUp = React.useCallback(eventName => event => {
|
|
451
|
+
const params = apiRef.current.getCellParams(rowId, field || '');
|
|
452
|
+
apiRef.current.publishEvent(eventName, params, event);
|
|
453
|
+
if (onMouseUp) {
|
|
454
|
+
onMouseUp(event);
|
|
455
|
+
}
|
|
456
|
+
}, [apiRef, field, onMouseUp, rowId]);
|
|
457
|
+
const publishMouseDown = React.useCallback(eventName => event => {
|
|
458
|
+
const params = apiRef.current.getCellParams(rowId, field || '');
|
|
459
|
+
apiRef.current.publishEvent(eventName, params, event);
|
|
460
|
+
if (onMouseDown) {
|
|
461
|
+
onMouseDown(event);
|
|
462
|
+
}
|
|
463
|
+
}, [apiRef, field, onMouseDown, rowId]);
|
|
464
|
+
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
465
|
+
// The row might have been deleted during the click
|
|
466
|
+
if (!apiRef.current.getRow(rowId)) {
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
const params = apiRef.current.getCellParams(rowId, field || '');
|
|
470
|
+
apiRef.current.publishEvent(eventName, params, event);
|
|
471
|
+
if (propHandler) {
|
|
472
|
+
propHandler(event);
|
|
473
|
+
}
|
|
474
|
+
}, [apiRef, field, rowId]);
|
|
475
|
+
const style = {
|
|
476
|
+
minWidth: width,
|
|
477
|
+
maxWidth: width,
|
|
478
|
+
minHeight: height,
|
|
479
|
+
maxHeight: height === 'auto' ? 'none' : height // max-height doesn't support "auto"
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
React.useEffect(() => {
|
|
483
|
+
if (!hasFocus || cellMode === GridCellModes.Edit) {
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
487
|
+
if (cellRef.current && !cellRef.current.contains(doc.activeElement)) {
|
|
488
|
+
const focusableElement = cellRef.current.querySelector('[tabindex="0"]');
|
|
489
|
+
const elementToFocus = focusElementRef.current || focusableElement || cellRef.current;
|
|
490
|
+
if (doesSupportPreventScroll()) {
|
|
491
|
+
elementToFocus.focus({
|
|
492
|
+
preventScroll: true
|
|
493
|
+
});
|
|
494
|
+
} else {
|
|
495
|
+
const scrollPosition = apiRef.current.getScrollPosition();
|
|
496
|
+
elementToFocus.focus();
|
|
497
|
+
apiRef.current.scroll(scrollPosition);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
}, [hasFocus, cellMode, apiRef]);
|
|
501
|
+
if (cellParamsWithAPI === EMPTY_CELL_PARAMS) {
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
let handleFocus = other.onFocus;
|
|
505
|
+
if (process.env.NODE_ENV === 'test' && rootProps.experimentalFeatures?.warnIfFocusStateIsNotSynced) {
|
|
506
|
+
handleFocus = event => {
|
|
507
|
+
const focusedCell = gridFocusCellSelector(apiRef);
|
|
508
|
+
if (focusedCell?.id === rowId && focusedCell.field === field) {
|
|
509
|
+
if (typeof other.onFocus === 'function') {
|
|
510
|
+
other.onFocus(event);
|
|
511
|
+
}
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
if (!warnedOnce) {
|
|
515
|
+
console.warn([`MUI: The cell with id=${rowId} and field=${field} received focus.`, `According to the state, the focus should be at id=${focusedCell?.id}, field=${focusedCell?.field}.`, "Not syncing the state may cause unwanted behaviors since the `cellFocusIn` event won't be fired.", 'Call `fireEvent.mouseUp` before the `fireEvent.click` to sync the focus with the state.'].join('\n'));
|
|
516
|
+
warnedOnce = true;
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
let children;
|
|
521
|
+
if (editCellState == null && column.renderCell) {
|
|
522
|
+
children = column.renderCell(cellParamsWithAPI);
|
|
523
|
+
classNames.push(gridClasses['cell--withRenderer']);
|
|
524
|
+
classNames.push(rootClasses?.['cell--withRenderer']);
|
|
525
|
+
}
|
|
526
|
+
if (editCellState != null && column.renderEditCell) {
|
|
527
|
+
const updatedRow = apiRef.current.getRowWithUpdatedValues(rowId, column.field);
|
|
528
|
+
|
|
529
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
530
|
+
const editCellStateRest = _objectWithoutPropertiesLoose(editCellState, _excluded4);
|
|
531
|
+
const params = _extends({}, cellParamsWithAPI, {
|
|
532
|
+
row: updatedRow
|
|
533
|
+
}, editCellStateRest);
|
|
534
|
+
children = column.renderEditCell(params);
|
|
535
|
+
classNames.push(gridClasses['cell--editing']);
|
|
536
|
+
classNames.push(rootClasses?.['cell--editing']);
|
|
537
|
+
}
|
|
538
|
+
if (children === undefined) {
|
|
539
|
+
const valueString = valueToRender?.toString();
|
|
540
|
+
children = /*#__PURE__*/_jsx("div", {
|
|
541
|
+
className: classes.content,
|
|
542
|
+
title: valueString,
|
|
543
|
+
children: valueString
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
if ( /*#__PURE__*/React.isValidElement(children) && managesOwnFocus) {
|
|
547
|
+
children = /*#__PURE__*/React.cloneElement(children, {
|
|
548
|
+
focusElementRef
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
const draggableEventHandlers = disableDragEvents ? null : {
|
|
552
|
+
onDragEnter: publish('cellDragEnter', onDragEnter),
|
|
553
|
+
onDragOver: publish('cellDragOver', onDragOver)
|
|
554
|
+
};
|
|
555
|
+
return /*#__PURE__*/_jsx("div", _extends({
|
|
556
|
+
ref: handleRef,
|
|
557
|
+
className: clsx(className, classNames, classes.root),
|
|
558
|
+
role: "cell",
|
|
559
|
+
"data-field": field,
|
|
560
|
+
"data-colindex": colIndex,
|
|
561
|
+
"aria-colindex": colIndex + 1,
|
|
562
|
+
"aria-colspan": colSpan,
|
|
563
|
+
style: style,
|
|
564
|
+
tabIndex: tabIndex,
|
|
565
|
+
onClick: publish('cellClick', onClick),
|
|
566
|
+
onDoubleClick: publish('cellDoubleClick', onDoubleClick),
|
|
567
|
+
onMouseOver: publish('cellMouseOver', onMouseOver),
|
|
568
|
+
onMouseDown: publishMouseDown('cellMouseDown'),
|
|
569
|
+
onMouseUp: publishMouseUp('cellMouseUp'),
|
|
570
|
+
onKeyDown: publish('cellKeyDown', onKeyDown),
|
|
571
|
+
onKeyUp: publish('cellKeyUp', onKeyUp)
|
|
572
|
+
}, draggableEventHandlers, other, {
|
|
573
|
+
onFocus: handleFocus,
|
|
574
|
+
children: children
|
|
575
|
+
}));
|
|
576
|
+
});
|
|
577
|
+
process.env.NODE_ENV !== "production" ? GridCellV7.propTypes = {
|
|
578
|
+
// ----------------------------- Warning --------------------------------
|
|
579
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
580
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
581
|
+
// ----------------------------------------------------------------------
|
|
582
|
+
align: PropTypes.oneOf(['center', 'left', 'right']),
|
|
583
|
+
className: PropTypes.string,
|
|
584
|
+
colIndex: PropTypes.number,
|
|
585
|
+
colSpan: PropTypes.number,
|
|
586
|
+
column: PropTypes.object,
|
|
211
587
|
disableDragEvents: PropTypes.bool,
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
588
|
+
editCellState: PropTypes.shape({
|
|
589
|
+
changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
590
|
+
isProcessingProps: PropTypes.bool,
|
|
591
|
+
isValidating: PropTypes.bool,
|
|
592
|
+
value: PropTypes.any
|
|
593
|
+
}),
|
|
215
594
|
height: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.number]),
|
|
216
|
-
isEditable: PropTypes.bool,
|
|
217
|
-
isSelected: PropTypes.bool,
|
|
218
595
|
onClick: PropTypes.func,
|
|
219
596
|
onDoubleClick: PropTypes.func,
|
|
220
597
|
onDragEnter: PropTypes.func,
|
|
@@ -224,8 +601,7 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
224
601
|
onMouseUp: PropTypes.func,
|
|
225
602
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
226
603
|
showRightBorder: PropTypes.bool,
|
|
227
|
-
tabIndex: PropTypes.oneOf([-1, 0]),
|
|
228
|
-
value: PropTypes.any,
|
|
229
604
|
width: PropTypes.number
|
|
230
605
|
} : void 0;
|
|
231
|
-
|
|
606
|
+
const MemoizedGridCellV7 = fastMemo(GridCellV7);
|
|
607
|
+
export { MemoizedGridCellV7 as GridCellV7 };
|
|
@@ -10,6 +10,22 @@ function getBorderColor(theme) {
|
|
|
10
10
|
}
|
|
11
11
|
return darken(alpha(theme.palette.divider, 1), 0.68);
|
|
12
12
|
}
|
|
13
|
+
const columnHeadersStyles = {
|
|
14
|
+
[`.${gridClasses.columnSeparator}, .${gridClasses['columnSeparator--resizing']}`]: {
|
|
15
|
+
visibility: 'visible',
|
|
16
|
+
width: 'auto'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const columnHeaderStyles = {
|
|
20
|
+
[`& .${gridClasses.iconButtonContainer}`]: {
|
|
21
|
+
visibility: 'visible',
|
|
22
|
+
width: 'auto'
|
|
23
|
+
},
|
|
24
|
+
[`& .${gridClasses.menuIcon}`]: {
|
|
25
|
+
width: 'auto',
|
|
26
|
+
visibility: 'visible'
|
|
27
|
+
}
|
|
28
|
+
};
|
|
13
29
|
export const GridRootStyles = styled('div', {
|
|
14
30
|
name: 'MuiDataGrid',
|
|
15
31
|
slot: 'Root',
|
|
@@ -51,6 +67,8 @@ export const GridRootStyles = styled('div', {
|
|
|
51
67
|
[`& .${gridClasses['cell--rangeLeft']}`]: styles['cell--rangeLeft']
|
|
52
68
|
}, {
|
|
53
69
|
[`& .${gridClasses['cell--rangeRight']}`]: styles['cell--rangeRight']
|
|
70
|
+
}, {
|
|
71
|
+
[`& .${gridClasses['cell--withRightBorder']}`]: styles['cell--withRightBorder']
|
|
54
72
|
}, {
|
|
55
73
|
[`& .${gridClasses.cellContent}`]: styles.cellContent
|
|
56
74
|
}, {
|
|
@@ -75,8 +93,12 @@ export const GridRootStyles = styled('div', {
|
|
|
75
93
|
[`& .${gridClasses['columnHeader--sortable']}`]: styles['columnHeader--sortable']
|
|
76
94
|
}, {
|
|
77
95
|
[`& .${gridClasses['columnHeader--sorted']}`]: styles['columnHeader--sorted']
|
|
96
|
+
}, {
|
|
97
|
+
[`& .${gridClasses['columnHeader--withRightBorder']}`]: styles['columnHeader--withRightBorder']
|
|
78
98
|
}, {
|
|
79
99
|
[`& .${gridClasses.columnHeader}`]: styles.columnHeader
|
|
100
|
+
}, {
|
|
101
|
+
[`& .${gridClasses.headerFilterRow}`]: styles.headerFilterRow
|
|
80
102
|
}, {
|
|
81
103
|
[`& .${gridClasses.columnHeaderCheckbox}`]: styles.columnHeaderCheckbox
|
|
82
104
|
}, {
|
|
@@ -149,7 +171,9 @@ export const GridRootStyles = styled('div', {
|
|
|
149
171
|
outline: 'none',
|
|
150
172
|
height: '100%',
|
|
151
173
|
display: 'flex',
|
|
152
|
-
|
|
174
|
+
minWidth: 0,
|
|
175
|
+
// See https://github.com/mui/mui-x/issues/8547
|
|
176
|
+
minHeight: 0,
|
|
153
177
|
flexDirection: 'column',
|
|
154
178
|
overflowAnchor: 'none',
|
|
155
179
|
// Keep the same scrolling position
|
|
@@ -196,9 +220,6 @@ export const GridRootStyles = styled('div', {
|
|
|
196
220
|
duration: theme.transitions.duration.shorter
|
|
197
221
|
})
|
|
198
222
|
},
|
|
199
|
-
[`& .${gridClasses.columnHeader}:not(.${gridClasses['columnHeader--sorted']}):hover .${gridClasses.sortIcon}`]: {
|
|
200
|
-
opacity: 0.5
|
|
201
|
-
},
|
|
202
223
|
[`& .${gridClasses.columnHeaderTitleContainer}`]: {
|
|
203
224
|
display: 'flex',
|
|
204
225
|
alignItems: 'center',
|
|
@@ -227,6 +248,9 @@ export const GridRootStyles = styled('div', {
|
|
|
227
248
|
borderBottomStyle: 'solid',
|
|
228
249
|
boxSizing: 'border-box'
|
|
229
250
|
},
|
|
251
|
+
[`& .${gridClasses.headerFilterRow}`]: {
|
|
252
|
+
borderTop: `1px solid ${borderColor}`
|
|
253
|
+
},
|
|
230
254
|
[`& .${gridClasses.sortIcon}, & .${gridClasses.filterIcon}`]: {
|
|
231
255
|
fontSize: 'inherit'
|
|
232
256
|
},
|
|
@@ -259,9 +283,16 @@ export const GridRootStyles = styled('div', {
|
|
|
259
283
|
justifyContent: 'center',
|
|
260
284
|
color: borderColor
|
|
261
285
|
},
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
286
|
+
'@media (hover: hover)': {
|
|
287
|
+
[`& .${gridClasses.columnHeaders}:hover`]: columnHeadersStyles,
|
|
288
|
+
[`& .${gridClasses.columnHeader}:hover`]: columnHeaderStyles,
|
|
289
|
+
[`& .${gridClasses.columnHeader}:not(.${gridClasses['columnHeader--sorted']}):hover .${gridClasses.sortIcon}`]: {
|
|
290
|
+
opacity: 0.5
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
'@media (hover: none)': {
|
|
294
|
+
[`& .${gridClasses.columnHeaders}`]: columnHeadersStyles,
|
|
295
|
+
[`& .${gridClasses.columnHeader}`]: columnHeaderStyles
|
|
265
296
|
},
|
|
266
297
|
[`& .${gridClasses['columnSeparator--sideLeft']}`]: {
|
|
267
298
|
left: -12
|
|
@@ -297,16 +328,6 @@ export const GridRootStyles = styled('div', {
|
|
|
297
328
|
display: 'flex',
|
|
298
329
|
alignItems: 'center'
|
|
299
330
|
},
|
|
300
|
-
[`& .${gridClasses.columnHeader}:hover`]: {
|
|
301
|
-
[`& .${gridClasses.iconButtonContainer}`]: {
|
|
302
|
-
visibility: 'visible',
|
|
303
|
-
width: 'auto'
|
|
304
|
-
},
|
|
305
|
-
[`& .${gridClasses.menuIcon}`]: {
|
|
306
|
-
width: 'auto',
|
|
307
|
-
visibility: 'visible'
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
331
|
[`.${gridClasses.menuOpen}`]: {
|
|
311
332
|
visibility: 'visible',
|
|
312
333
|
width: 'auto'
|
|
@@ -194,8 +194,22 @@ process.env.NODE_ENV !== "production" ? GridColumnsPanel.propTypes = {
|
|
|
194
194
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
195
195
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
196
196
|
// ----------------------------------------------------------------------
|
|
197
|
+
/**
|
|
198
|
+
* If `true`, the column search field will be focused automatically.
|
|
199
|
+
* If `false`, the first column switch input will be focused automatically.
|
|
200
|
+
* This helps to avoid input keyboard panel to popup automatically on touch devices.
|
|
201
|
+
* @default true
|
|
202
|
+
*/
|
|
197
203
|
autoFocusSearchField: PropTypes.bool,
|
|
204
|
+
/**
|
|
205
|
+
* If `true`, the `Hide all` button will not be displayed.
|
|
206
|
+
* @default false
|
|
207
|
+
*/
|
|
198
208
|
disableHideAllButton: PropTypes.bool,
|
|
209
|
+
/**
|
|
210
|
+
* If `true`, the `Show all` button will be disabled
|
|
211
|
+
* @default false
|
|
212
|
+
*/
|
|
199
213
|
disableShowAllButton: PropTypes.bool,
|
|
200
214
|
/**
|
|
201
215
|
* Returns the list of togglable columns.
|