@mui/x-data-grid 7.17.0 → 7.19.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 +208 -5
- package/DataGrid/DataGrid.js +16 -1
- package/DataGrid/useDataGridComponent.js +3 -0
- package/DataGrid/useDataGridProps.js +2 -1
- package/components/GridRow.js +1 -0
- package/components/cell/GridCell.js +33 -9
- package/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/components/columnSelection/GridHeaderCheckbox.d.ts +1 -1
- package/components/containers/GridRoot.js +1 -1
- package/components/containers/GridRootStyles.js +32 -23
- package/components/containers/GridToolbarContainer.js +1 -1
- package/components/menu/GridMenu.js +1 -1
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/GridPanel.js +1 -1
- package/components/panel/GridPanelContent.js +1 -1
- package/components/panel/GridPanelFooter.js +1 -1
- package/components/panel/GridPanelHeader.js +1 -1
- package/components/panel/GridPanelWrapper.js +1 -1
- package/components/panel/filterPanel/filterPanelUtils.d.ts +1 -1
- package/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/components/virtualization/GridBottomContainer.d.ts +1 -1
- package/components/virtualization/GridBottomContainer.js +18 -1
- package/components/virtualization/GridMainContainer.js +3 -1
- package/components/virtualization/GridTopContainer.d.ts +1 -1
- package/components/virtualization/GridTopContainer.js +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/components/virtualization/GridVirtualScroller.js +1 -0
- package/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/hooks/features/columnGrouping/gridColumnGroupsSelector.d.ts +4 -4
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +1 -2
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -11
- package/hooks/features/columnResize/columnResizeSelector.d.ts +1 -1
- package/hooks/features/columnResize/useGridColumnResize.js +6 -6
- package/hooks/features/columns/gridColumnsSelector.d.ts +12 -12
- package/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/hooks/features/density/densitySelector.d.ts +1 -1
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +4 -0
- package/hooks/features/dimensions/useGridDimensions.d.ts +1 -1
- package/hooks/features/dimensions/useGridDimensions.js +4 -1
- package/hooks/features/editing/useGridCellEditing.js +3 -19
- package/hooks/features/editing/useGridRowEditing.js +7 -2
- package/hooks/features/editing/utils.d.ts +2 -0
- package/hooks/features/editing/utils.js +15 -0
- package/hooks/features/export/useGridPrintExport.js +2 -1
- package/hooks/features/filter/gridFilterSelector.d.ts +17 -17
- package/hooks/features/focus/gridFocusStateSelector.d.ts +8 -8
- package/hooks/features/focus/useGridFocus.js +2 -1
- package/hooks/features/headerFiltering/gridHeaderFilteringSelectors.d.ts +3 -3
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +10 -46
- package/hooks/features/keyboardNavigation/utils.d.ts +17 -0
- package/hooks/features/keyboardNavigation/utils.js +58 -0
- package/hooks/features/pagination/gridPaginationSelector.d.ts +9 -9
- package/hooks/features/rowSelection/gridRowSelectionSelector.d.ts +3 -3
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +105 -29
- package/hooks/features/rowSelection/utils.d.ts +10 -0
- package/hooks/features/rowSelection/utils.js +156 -1
- package/hooks/features/rows/gridRowSpanningSelectors.d.ts +4 -0
- package/hooks/features/rows/gridRowSpanningSelectors.js +5 -0
- package/hooks/features/rows/gridRowSpanningUtils.d.ts +10 -0
- package/hooks/features/rows/gridRowSpanningUtils.js +42 -0
- package/hooks/features/rows/gridRowsSelector.d.ts +14 -14
- package/hooks/features/rows/useGridRowSpanning.d.ts +27 -0
- package/hooks/features/rows/useGridRowSpanning.js +257 -0
- package/hooks/features/rows/useGridRows.d.ts +1 -1
- package/hooks/features/rows/useGridRows.js +7 -1
- package/hooks/features/scroll/useGridScroll.js +19 -19
- package/hooks/features/sorting/gridSortingSelector.d.ts +4 -4
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +5 -5
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/hooks/utils/useGridApiEventHandler.js +0 -1
- package/hooks/utils/useGridVisibleRows.d.ts +2 -2
- package/index.js +1 -1
- package/internals/index.d.ts +2 -0
- package/internals/index.js +2 -0
- package/locales/bgBG.js +8 -9
- package/locales/deDE.js +4 -4
- package/locales/frFR.js +4 -4
- package/locales/hrHR.d.ts +1 -1
- package/locales/hrHR.js +69 -46
- package/locales/jaJP.js +1 -2
- package/locales/ptPT.d.ts +1 -1
- package/locales/ptPT.js +4 -4
- package/locales/viVN.js +20 -20
- package/locales/zhHK.d.ts +1 -1
- package/models/colDef/gridColDef.d.ts +4 -0
- package/models/gridRowSelectionModel.d.ts +4 -0
- package/models/gridStateCommunity.d.ts +2 -0
- package/models/props/DataGridProps.d.ts +30 -1
- package/modern/DataGrid/DataGrid.js +16 -1
- package/modern/DataGrid/useDataGridComponent.js +3 -0
- package/modern/DataGrid/useDataGridProps.js +2 -1
- package/modern/components/GridRow.js +1 -0
- package/modern/components/cell/GridCell.js +33 -9
- package/modern/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/modern/components/containers/GridRoot.js +1 -1
- package/modern/components/containers/GridRootStyles.js +32 -23
- package/modern/components/containers/GridToolbarContainer.js +1 -1
- package/modern/components/menu/GridMenu.js +1 -1
- package/modern/components/panel/GridPanel.js +1 -1
- package/modern/components/panel/GridPanelContent.js +1 -1
- package/modern/components/panel/GridPanelFooter.js +1 -1
- package/modern/components/panel/GridPanelHeader.js +1 -1
- package/modern/components/panel/GridPanelWrapper.js +1 -1
- package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/modern/components/virtualization/GridBottomContainer.js +18 -1
- package/modern/components/virtualization/GridMainContainer.js +3 -1
- package/modern/components/virtualization/GridTopContainer.js +1 -1
- package/modern/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/modern/components/virtualization/GridVirtualScroller.js +1 -0
- package/modern/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -11
- package/modern/hooks/features/columnResize/useGridColumnResize.js +6 -6
- package/modern/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/modern/hooks/features/dimensions/useGridDimensions.js +4 -1
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -19
- package/modern/hooks/features/editing/useGridRowEditing.js +7 -2
- package/modern/hooks/features/editing/utils.js +15 -0
- package/modern/hooks/features/export/useGridPrintExport.js +2 -1
- package/modern/hooks/features/focus/useGridFocus.js +2 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +10 -46
- package/modern/hooks/features/keyboardNavigation/utils.js +58 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +105 -29
- package/modern/hooks/features/rowSelection/utils.js +156 -1
- package/modern/hooks/features/rows/gridRowSpanningSelectors.js +5 -0
- package/modern/hooks/features/rows/gridRowSpanningUtils.js +42 -0
- package/modern/hooks/features/rows/useGridRowSpanning.js +257 -0
- package/modern/hooks/features/rows/useGridRows.js +7 -1
- package/modern/hooks/features/scroll/useGridScroll.js +19 -19
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/modern/hooks/utils/useGridApiEventHandler.js +0 -1
- package/modern/index.js +1 -1
- package/modern/internals/index.js +2 -0
- package/modern/locales/bgBG.js +8 -9
- package/modern/locales/deDE.js +4 -4
- package/modern/locales/frFR.js +4 -4
- package/modern/locales/hrHR.js +69 -46
- package/modern/locales/jaJP.js +1 -2
- package/modern/locales/ptPT.js +4 -4
- package/modern/locales/viVN.js +20 -20
- package/modern/utils/createSelector.js +6 -0
- package/modern/utils/domUtils.js +12 -12
- package/node/DataGrid/DataGrid.js +16 -1
- package/node/DataGrid/useDataGridComponent.js +3 -0
- package/node/DataGrid/useDataGridProps.js +2 -1
- package/node/components/GridRow.js +1 -0
- package/node/components/cell/GridCell.js +33 -9
- package/node/components/columnHeaders/GridBaseColumnHeaders.js +1 -1
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +12 -4
- package/node/components/containers/GridRoot.js +1 -1
- package/node/components/containers/GridRootStyles.js +32 -23
- package/node/components/containers/GridToolbarContainer.js +1 -1
- package/node/components/menu/GridMenu.js +1 -1
- package/node/components/panel/GridPanel.js +1 -1
- package/node/components/panel/GridPanelContent.js +1 -1
- package/node/components/panel/GridPanelFooter.js +1 -1
- package/node/components/panel/GridPanelHeader.js +1 -1
- package/node/components/panel/GridPanelWrapper.js +1 -1
- package/node/components/toolbar/GridToolbarQuickFilter.js +1 -1
- package/node/components/virtualization/GridBottomContainer.js +18 -1
- package/node/components/virtualization/GridMainContainer.js +3 -1
- package/node/components/virtualization/GridTopContainer.js +1 -1
- package/node/components/virtualization/GridVirtualScrollbar.js +1 -7
- package/node/components/virtualization/GridVirtualScroller.js +1 -0
- package/node/components/virtualization/GridVirtualScrollerFiller.js +3 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +11 -11
- package/node/hooks/features/columnResize/useGridColumnResize.js +6 -6
- package/node/hooks/features/columns/gridColumnsUtils.js +3 -2
- package/node/hooks/features/dimensions/useGridDimensions.js +4 -1
- package/node/hooks/features/editing/useGridCellEditing.js +3 -19
- package/node/hooks/features/editing/useGridRowEditing.js +7 -2
- package/node/hooks/features/editing/utils.js +22 -0
- package/node/hooks/features/export/useGridPrintExport.js +2 -1
- package/node/hooks/features/focus/useGridFocus.js +2 -1
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +16 -53
- package/node/hooks/features/keyboardNavigation/utils.js +68 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +102 -26
- package/node/hooks/features/rowSelection/utils.js +160 -1
- package/node/hooks/features/rows/gridRowSpanningSelectors.js +11 -0
- package/node/hooks/features/rows/gridRowSpanningUtils.js +52 -0
- package/node/hooks/features/rows/useGridRowSpanning.js +267 -0
- package/node/hooks/features/rows/useGridRows.js +7 -1
- package/node/hooks/features/scroll/useGridScroll.js +19 -19
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +17 -7
- package/node/hooks/utils/useGridApiEventHandler.js +0 -1
- package/node/index.js +1 -1
- package/node/internals/index.js +38 -15
- package/node/locales/bgBG.js +8 -9
- package/node/locales/deDE.js +4 -4
- package/node/locales/frFR.js +4 -4
- package/node/locales/hrHR.js +69 -46
- package/node/locales/jaJP.js +1 -2
- package/node/locales/ptPT.js +4 -4
- package/node/locales/viVN.js +20 -20
- package/node/utils/createSelector.js +6 -0
- package/node/utils/domUtils.js +12 -12
- package/package.json +3 -3
- package/utils/createSelector.js +6 -0
- package/utils/domUtils.d.ts +4 -4
- package/utils/domUtils.js +12 -12
|
@@ -54,7 +54,7 @@ const GridRoot = exports.GridRoot = /*#__PURE__*/React.forwardRef(function GridR
|
|
|
54
54
|
}
|
|
55
55
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GridRootStyles.GridRootStyles, (0, _extends2.default)({
|
|
56
56
|
ref: handleRef,
|
|
57
|
-
className: (0, _clsx.default)(
|
|
57
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
58
58
|
ownerState: ownerState
|
|
59
59
|
}, other));
|
|
60
60
|
});
|
|
@@ -177,14 +177,28 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
177
177
|
const hoverOpacity = (t.vars || t).palette.action.hoverOpacity;
|
|
178
178
|
const hoverColor = (t.vars || t).palette.action.hover;
|
|
179
179
|
const selectedOpacity = (t.vars || t).palette.action.selectedOpacity;
|
|
180
|
+
const selectedHoverOpacity = t.vars ? `calc(${hoverOpacity} + ${selectedOpacity})` // TODO: Improve type
|
|
181
|
+
: hoverOpacity + selectedOpacity;
|
|
180
182
|
const selectedBackground = t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / ${selectedOpacity})` : (0, _styles.alpha)(t.palette.primary.main, selectedOpacity);
|
|
181
|
-
const selectedHoverBackground = t.vars ? `rgba(${t.vars.palette.primary.mainChannel} /
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
183
|
+
const selectedHoverBackground = t.vars ? `rgba(${t.vars.palette.primary.mainChannel} / ${selectedHoverOpacity})` : (0, _styles.alpha)(t.palette.primary.main, selectedHoverOpacity);
|
|
184
|
+
const blendFn = t.vars ? blendCssVars : blend;
|
|
185
|
+
const getPinnedBackgroundStyles = backgroundColor => ({
|
|
186
|
+
[`& .${_gridClasses.gridClasses['cell--pinnedLeft']}, & .${_gridClasses.gridClasses['cell--pinnedRight']}`]: {
|
|
187
|
+
backgroundColor,
|
|
188
|
+
'&.Mui-selected': {
|
|
189
|
+
backgroundColor: blendFn(backgroundColor, selectedBackground, selectedOpacity),
|
|
190
|
+
'&:hover': {
|
|
191
|
+
backgroundColor: blendFn(backgroundColor, selectedBackground, selectedHoverOpacity)
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
const pinnedBackgroundColor = blendFn(pinnedBackground, hoverColor, hoverOpacity);
|
|
197
|
+
const pinnedHoverStyles = getPinnedBackgroundStyles(pinnedBackgroundColor);
|
|
198
|
+
const pinnedSelectedBackgroundColor = blendFn(pinnedBackground, selectedBackground, selectedOpacity);
|
|
199
|
+
const pinnedSelectedStyles = getPinnedBackgroundStyles(pinnedSelectedBackgroundColor);
|
|
200
|
+
const pinnedSelectedHoverBackgroundColor = blendFn(pinnedBackground, selectedHoverBackground, selectedHoverOpacity);
|
|
201
|
+
const pinnedSelectedHoverStyles = getPinnedBackgroundStyles(pinnedSelectedHoverBackgroundColor);
|
|
188
202
|
const selectedStyles = {
|
|
189
203
|
backgroundColor: selectedBackground,
|
|
190
204
|
'&:hover': {
|
|
@@ -624,24 +638,15 @@ const GridRootStyles = exports.GridRootStyles = (0, _styles.styled)('div', {
|
|
|
624
638
|
[`& .${_gridClasses.gridClasses['cell--pinnedLeft']}, & .${_gridClasses.gridClasses['cell--pinnedRight']}`]: {
|
|
625
639
|
position: 'sticky',
|
|
626
640
|
zIndex: 3,
|
|
627
|
-
background: 'var(--DataGrid-pinnedBackground)'
|
|
641
|
+
background: 'var(--DataGrid-pinnedBackground)',
|
|
642
|
+
'&.Mui-selected': {
|
|
643
|
+
backgroundColor: pinnedSelectedBackgroundColor
|
|
644
|
+
}
|
|
628
645
|
},
|
|
629
646
|
[`& .${_gridClasses.gridClasses.virtualScrollerContent} .${_gridClasses.gridClasses.row}`]: {
|
|
630
|
-
'&:hover':
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
}
|
|
634
|
-
},
|
|
635
|
-
[`&.Mui-selected`]: {
|
|
636
|
-
[`& .${_gridClasses.gridClasses['cell--pinnedLeft']}, & .${_gridClasses.gridClasses['cell--pinnedRight']}`]: {
|
|
637
|
-
backgroundColor: pinnedSelectedBackground
|
|
638
|
-
},
|
|
639
|
-
'&:hover': {
|
|
640
|
-
[`& .${_gridClasses.gridClasses['cell--pinnedLeft']}, & .${_gridClasses.gridClasses['cell--pinnedRight']}`]: {
|
|
641
|
-
backgroundColor: pinnedSelectedHoverBackground
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
}
|
|
647
|
+
'&:hover': pinnedHoverStyles,
|
|
648
|
+
'&.Mui-selected': pinnedSelectedStyles,
|
|
649
|
+
'&.Mui-selected:hover': pinnedSelectedHoverStyles
|
|
645
650
|
},
|
|
646
651
|
[`& .${_gridClasses.gridClasses.cellOffsetLeft}`]: {
|
|
647
652
|
flex: '0 0 auto',
|
|
@@ -754,4 +759,8 @@ function blend(background, overlay, opacity, gamma = 1) {
|
|
|
754
759
|
type: 'rgb',
|
|
755
760
|
values: rgb
|
|
756
761
|
});
|
|
762
|
+
}
|
|
763
|
+
const removeOpacity = color => `rgb(from ${color} r g b / 1)`;
|
|
764
|
+
function blendCssVars(background, overlay, opacity) {
|
|
765
|
+
return `color-mix(in srgb,${background}, ${removeOpacity(overlay)} calc(${opacity} * 100%))`;
|
|
757
766
|
}
|
|
@@ -52,7 +52,7 @@ const GridToolbarContainer = exports.GridToolbarContainer = /*#__PURE__*/React.f
|
|
|
52
52
|
}
|
|
53
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridToolbarContainerRoot, (0, _extends2.default)({
|
|
54
54
|
ref: ref,
|
|
55
|
-
className: (0, _clsx.default)(
|
|
55
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
56
56
|
ownerState: rootProps
|
|
57
57
|
}, other, {
|
|
58
58
|
children: children
|
|
@@ -93,7 +93,7 @@ function GridMenu(props) {
|
|
|
93
93
|
};
|
|
94
94
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridMenuRoot, (0, _extends2.default)({
|
|
95
95
|
as: rootProps.slots.basePopper,
|
|
96
|
-
className: (0, _clsx.default)(
|
|
96
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
97
97
|
ownerState: rootProps,
|
|
98
98
|
open: open,
|
|
99
99
|
anchorEl: target,
|
|
@@ -92,7 +92,7 @@ const GridPanel = exports.GridPanel = /*#__PURE__*/React.forwardRef((props, ref)
|
|
|
92
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelRoot, (0, _extends2.default)({
|
|
93
93
|
ref: ref,
|
|
94
94
|
placement: "bottom-start",
|
|
95
|
-
className: (0, _clsx.default)(
|
|
95
|
+
className: (0, _clsx.default)(classes.panel, className),
|
|
96
96
|
ownerState: rootProps,
|
|
97
97
|
anchorEl: anchorEl,
|
|
98
98
|
modifiers: modifiers
|
|
@@ -45,7 +45,7 @@ function GridPanelContent(props) {
|
|
|
45
45
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
46
46
|
const classes = useUtilityClasses(rootProps);
|
|
47
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelContentRoot, (0, _extends2.default)({
|
|
48
|
-
className: (0, _clsx.default)(
|
|
48
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
49
49
|
ownerState: rootProps
|
|
50
50
|
}, other));
|
|
51
51
|
}
|
|
@@ -45,7 +45,7 @@ function GridPanelFooter(props) {
|
|
|
45
45
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
46
46
|
const classes = useUtilityClasses(rootProps);
|
|
47
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelFooterRoot, (0, _extends2.default)({
|
|
48
|
-
className: (0, _clsx.default)(
|
|
48
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
49
49
|
ownerState: rootProps
|
|
50
50
|
}, other));
|
|
51
51
|
}
|
|
@@ -43,7 +43,7 @@ function GridPanelHeader(props) {
|
|
|
43
43
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
44
44
|
const classes = useUtilityClasses(rootProps);
|
|
45
45
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelHeaderRoot, (0, _extends2.default)({
|
|
46
|
-
className: (0, _clsx.default)(
|
|
46
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
47
47
|
ownerState: rootProps
|
|
48
48
|
}, other));
|
|
49
49
|
}
|
|
@@ -56,7 +56,7 @@ const GridPanelWrapper = exports.GridPanelWrapper = /*#__PURE__*/React.forwardRe
|
|
|
56
56
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GridPanelWrapperRoot, (0, _extends2.default)({
|
|
57
57
|
ref: ref,
|
|
58
58
|
tabIndex: -1,
|
|
59
|
-
className: (0, _clsx.default)(
|
|
59
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
60
60
|
ownerState: rootProps
|
|
61
61
|
}, other))
|
|
62
62
|
}));
|
|
@@ -101,7 +101,7 @@ function GridToolbarQuickFilter(props) {
|
|
|
101
101
|
variant: "standard",
|
|
102
102
|
value: searchValue,
|
|
103
103
|
onChange: handleSearchValueChange,
|
|
104
|
-
className: (0, _clsx.default)(
|
|
104
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
105
105
|
placeholder: apiRef.current.getLocaleText('toolbarQuickFilterPlaceholder'),
|
|
106
106
|
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterLabel'),
|
|
107
107
|
type: "search"
|
|
@@ -12,6 +12,9 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
12
12
|
var _system = require("@mui/system");
|
|
13
13
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
14
14
|
var _gridClasses = require("../../constants/gridClasses");
|
|
15
|
+
var _gridDimensionsSelectors = require("../../hooks/features/dimensions/gridDimensionsSelectors");
|
|
16
|
+
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
17
|
+
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
15
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
19
|
const useUtilityClasses = () => {
|
|
17
20
|
const slots = {
|
|
@@ -26,8 +29,22 @@ const Element = (0, _system.styled)('div')({
|
|
|
26
29
|
});
|
|
27
30
|
function GridBottomContainer(props) {
|
|
28
31
|
const classes = useUtilityClasses();
|
|
32
|
+
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
33
|
+
const {
|
|
34
|
+
viewportOuterSize,
|
|
35
|
+
minimumSize,
|
|
36
|
+
hasScrollX,
|
|
37
|
+
scrollbarSize
|
|
38
|
+
} = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridDimensionsSelector);
|
|
39
|
+
const scrollHeight = hasScrollX ? scrollbarSize : 0;
|
|
40
|
+
const offset = Math.max(viewportOuterSize.height - minimumSize.height -
|
|
41
|
+
// Subtract scroll height twice to account for GridVirtualScrollerFiller and horizontal scrollbar
|
|
42
|
+
2 * scrollHeight, 0);
|
|
29
43
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({}, props, {
|
|
30
|
-
className: (0, _clsx.default)(classes.root,
|
|
44
|
+
className: (0, _clsx.default)(classes.root, _gridClasses.gridClasses['container--bottom']),
|
|
45
|
+
style: {
|
|
46
|
+
transform: `translateY(${offset}px)`
|
|
47
|
+
},
|
|
31
48
|
role: "presentation"
|
|
32
49
|
}));
|
|
33
50
|
}
|
|
@@ -24,7 +24,9 @@ const Element = (0, _system.styled)('div', {
|
|
|
24
24
|
})({
|
|
25
25
|
flexGrow: 1,
|
|
26
26
|
position: 'relative',
|
|
27
|
-
overflow: 'hidden'
|
|
27
|
+
overflow: 'hidden',
|
|
28
|
+
display: 'flex',
|
|
29
|
+
flexDirection: 'column'
|
|
28
30
|
});
|
|
29
31
|
const GridMainContainer = exports.GridMainContainer = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
30
32
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -27,7 +27,7 @@ const Element = (0, _system.styled)('div')({
|
|
|
27
27
|
function GridTopContainer(props) {
|
|
28
28
|
const classes = useUtilityClasses();
|
|
29
29
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _extends2.default)({}, props, {
|
|
30
|
-
className: (0, _clsx.default)(classes.root,
|
|
30
|
+
className: (0, _clsx.default)(classes.root, _gridClasses.gridClasses['container--top']),
|
|
31
31
|
role: "presentation"
|
|
32
32
|
}));
|
|
33
33
|
}
|
|
@@ -28,9 +28,6 @@ const Scrollbar = (0, _system.styled)('div')({
|
|
|
28
28
|
position: 'absolute',
|
|
29
29
|
display: 'inline-block',
|
|
30
30
|
zIndex: 6,
|
|
31
|
-
'& > div': {
|
|
32
|
-
display: 'inline-block'
|
|
33
|
-
},
|
|
34
31
|
// In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
|
|
35
32
|
// their size to be 0px throughout all the calculations, but the floating scrollbar container does need
|
|
36
33
|
// to appear and have a real size. We set it to 14px because it seems like an acceptable value and we
|
|
@@ -62,9 +59,6 @@ const ScrollbarHorizontal = (0, _system.styled)(Scrollbar)({
|
|
|
62
59
|
},
|
|
63
60
|
bottom: '0px'
|
|
64
61
|
});
|
|
65
|
-
const Content = (0, _system.styled)('div')({
|
|
66
|
-
display: 'inline-block'
|
|
67
|
-
});
|
|
68
62
|
const GridVirtualScrollbar = exports.GridVirtualScrollbar = /*#__PURE__*/React.forwardRef(function GridVirtualScrollbar(props, ref) {
|
|
69
63
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
70
64
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
@@ -134,7 +128,7 @@ const GridVirtualScrollbar = exports.GridVirtualScrollbar = /*#__PURE__*/React.f
|
|
|
134
128
|
className: classes.root,
|
|
135
129
|
tabIndex: -1,
|
|
136
130
|
"aria-hidden": "true",
|
|
137
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
131
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
138
132
|
ref: contentRef,
|
|
139
133
|
className: classes.content
|
|
140
134
|
})
|
|
@@ -51,10 +51,9 @@ function GridVirtualScrollerFiller({
|
|
|
51
51
|
leftPinnedWidth,
|
|
52
52
|
rightPinnedWidth
|
|
53
53
|
} = (0, _useGridSelector.useGridSelector)(apiRef, _dimensions.gridDimensionsSelector);
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
if (height === 0) {
|
|
54
|
+
const height = hasScrollX ? scrollbarSize : 0;
|
|
55
|
+
const needsLastRowBorder = viewportOuterSize.height - minimumSize.height > 0;
|
|
56
|
+
if (height === 0 && !needsLastRowBorder) {
|
|
58
57
|
return null;
|
|
59
58
|
}
|
|
60
59
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Filler, {
|
|
@@ -61,7 +61,7 @@ const useGridColumnHeaders = props => {
|
|
|
61
61
|
const renderContext = (0, _utils.useGridSelector)(apiRef, _virtualization.gridRenderContextColumnsSelector);
|
|
62
62
|
const pinnedColumns = (0, _utils.useGridSelector)(apiRef, _columns.gridVisiblePinnedColumnDefinitionsSelector);
|
|
63
63
|
const columnsLookup = (0, _utils.useGridSelector)(apiRef, _columns.gridColumnLookupSelector);
|
|
64
|
-
const offsetLeft = (0, _useGridVirtualScroller.computeOffsetLeft)(columnPositions, renderContext,
|
|
64
|
+
const offsetLeft = (0, _useGridVirtualScroller.computeOffsetLeft)(columnPositions, renderContext, pinnedColumns.left.length);
|
|
65
65
|
const gridHasFiller = dimensions.columnsTotalWidth < dimensions.viewportOuterSize.width;
|
|
66
66
|
React.useEffect(() => {
|
|
67
67
|
apiRef.current.columnHeadersContainerRef.current.scrollLeft = 0;
|
|
@@ -91,7 +91,6 @@ const useGridColumnHeaders = props => {
|
|
|
91
91
|
const getColumnsToRender = params => {
|
|
92
92
|
const {
|
|
93
93
|
renderContext: currentContext = renderContext,
|
|
94
|
-
// TODO: `minFirstColumn` is not used anymore, could be refactored out.
|
|
95
94
|
maxLastColumn = visibleColumns.length
|
|
96
95
|
} = params || {};
|
|
97
96
|
const firstColumnToRender = currentContext.firstColumnIndex;
|
|
@@ -131,16 +130,22 @@ const useGridColumnHeaders = props => {
|
|
|
131
130
|
computedWidth
|
|
132
131
|
}) => {
|
|
133
132
|
let style;
|
|
134
|
-
|
|
133
|
+
const isLeftPinned = pinnedPosition === _columns.GridPinnedColumnPosition.LEFT;
|
|
134
|
+
const isRightPinned = pinnedPosition === _columns.GridPinnedColumnPosition.RIGHT;
|
|
135
|
+
if (isLeftPinned || isRightPinned) {
|
|
135
136
|
const pinnedOffset = (0, _getPinnedCellOffset.getPinnedCellOffset)(pinnedPosition, computedWidth, columnIndex, columnPositions, dimensions);
|
|
137
|
+
let side = isLeftPinned ? 'left' : 'right';
|
|
138
|
+
if (isRtl) {
|
|
139
|
+
side = isLeftPinned ? 'right' : 'left';
|
|
140
|
+
}
|
|
136
141
|
if (pinnedPosition === 'left') {
|
|
137
142
|
style = {
|
|
138
|
-
|
|
143
|
+
[side]: pinnedOffset
|
|
139
144
|
};
|
|
140
145
|
}
|
|
141
146
|
if (pinnedPosition === 'right') {
|
|
142
147
|
style = {
|
|
143
|
-
|
|
148
|
+
[side]: pinnedOffset
|
|
144
149
|
};
|
|
145
150
|
}
|
|
146
151
|
}
|
|
@@ -199,18 +204,15 @@ const useGridColumnHeaders = props => {
|
|
|
199
204
|
children: [leftRenderContext && getColumnHeaders({
|
|
200
205
|
position: _columns.GridPinnedColumnPosition.LEFT,
|
|
201
206
|
renderContext: leftRenderContext,
|
|
202
|
-
minFirstColumn: leftRenderContext.firstColumnIndex,
|
|
203
207
|
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
204
208
|
}, {
|
|
205
209
|
disableReorder: true
|
|
206
210
|
}), getColumnHeaders({
|
|
207
211
|
renderContext,
|
|
208
|
-
minFirstColumn: pinnedColumns.left.length,
|
|
209
212
|
maxLastColumn: visibleColumns.length - pinnedColumns.right.length
|
|
210
213
|
}), rightRenderContext && getColumnHeaders({
|
|
211
214
|
position: _columns.GridPinnedColumnPosition.RIGHT,
|
|
212
215
|
renderContext: rightRenderContext,
|
|
213
|
-
minFirstColumn: rightRenderContext.firstColumnIndex,
|
|
214
216
|
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
215
217
|
}, {
|
|
216
218
|
disableReorder: true,
|
|
@@ -290,7 +292,7 @@ const useGridColumnHeaders = props => {
|
|
|
290
292
|
depth: depth,
|
|
291
293
|
isLastColumn: headerInfo.colIndex === visibleColumns.length - headerInfo.fields.length,
|
|
292
294
|
maxDepth: headerGroupingMaxDepth,
|
|
293
|
-
height: dimensions.
|
|
295
|
+
height: dimensions.groupHeaderHeight,
|
|
294
296
|
hasFocus: hasFocus,
|
|
295
297
|
tabIndex: tabIndex,
|
|
296
298
|
pinnedPosition: pinnedPosition,
|
|
@@ -317,7 +319,6 @@ const useGridColumnHeaders = props => {
|
|
|
317
319
|
params: {
|
|
318
320
|
position: _columns.GridPinnedColumnPosition.LEFT,
|
|
319
321
|
renderContext: leftRenderContext,
|
|
320
|
-
minFirstColumn: leftRenderContext.firstColumnIndex,
|
|
321
322
|
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
322
323
|
}
|
|
323
324
|
}), getColumnGroupHeaders({
|
|
@@ -330,7 +331,6 @@ const useGridColumnHeaders = props => {
|
|
|
330
331
|
params: {
|
|
331
332
|
position: _columns.GridPinnedColumnPosition.RIGHT,
|
|
332
333
|
renderContext: rightRenderContext,
|
|
333
|
-
minFirstColumn: rightRenderContext.firstColumnIndex,
|
|
334
334
|
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
335
335
|
}
|
|
336
336
|
})]
|
|
@@ -311,13 +311,13 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
311
311
|
}
|
|
312
312
|
refs.groupHeaderElements = (0, _domUtils.findGroupHeaderElementsFromField)(apiRef.current.columnHeadersContainerRef?.current, colDef.field);
|
|
313
313
|
refs.cellElements = (0, _domUtils.findGridCellElementsFromCol)(refs.columnHeaderElement, apiRef.current);
|
|
314
|
-
refs.fillerLeft = (0, _domUtils.findGridElement)(apiRef.current, 'filler--pinnedLeft');
|
|
315
|
-
refs.fillerRight = (0, _domUtils.findGridElement)(apiRef.current, 'filler--pinnedRight');
|
|
314
|
+
refs.fillerLeft = (0, _domUtils.findGridElement)(apiRef.current, isRtl ? 'filler--pinnedRight' : 'filler--pinnedLeft');
|
|
315
|
+
refs.fillerRight = (0, _domUtils.findGridElement)(apiRef.current, isRtl ? 'filler--pinnedLeft' : 'filler--pinnedRight');
|
|
316
316
|
const pinnedPosition = apiRef.current.unstable_applyPipeProcessors('isColumnPinned', false, refs.colDef.field);
|
|
317
|
-
refs.leftPinnedCellsAfter = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.LEFT ? [] : (0, _domUtils.findLeftPinnedCellsAfterCol)(apiRef.current, refs.columnHeaderElement);
|
|
318
|
-
refs.rightPinnedCellsBefore = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.RIGHT ? [] : (0, _domUtils.findRightPinnedCellsBeforeCol)(apiRef.current, refs.columnHeaderElement);
|
|
319
|
-
refs.leftPinnedHeadersAfter = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.LEFT ? [] : (0, _domUtils.findLeftPinnedHeadersAfterCol)(apiRef.current, refs.columnHeaderElement);
|
|
320
|
-
refs.rightPinnedHeadersBefore = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.RIGHT ? [] : (0, _domUtils.findRightPinnedHeadersBeforeCol)(apiRef.current, refs.columnHeaderElement);
|
|
317
|
+
refs.leftPinnedCellsAfter = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.LEFT ? [] : (0, _domUtils.findLeftPinnedCellsAfterCol)(apiRef.current, refs.columnHeaderElement, isRtl);
|
|
318
|
+
refs.rightPinnedCellsBefore = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.RIGHT ? [] : (0, _domUtils.findRightPinnedCellsBeforeCol)(apiRef.current, refs.columnHeaderElement, isRtl);
|
|
319
|
+
refs.leftPinnedHeadersAfter = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.LEFT ? [] : (0, _domUtils.findLeftPinnedHeadersAfterCol)(apiRef.current, refs.columnHeaderElement, isRtl);
|
|
320
|
+
refs.rightPinnedHeadersBefore = pinnedPosition !== _gridColumnsInterfaces.GridPinnedColumnPosition.RIGHT ? [] : (0, _domUtils.findRightPinnedHeadersBeforeCol)(apiRef.current, refs.columnHeaderElement, isRtl);
|
|
321
321
|
resizeDirection.current = getResizeDirection(separator, isRtl);
|
|
322
322
|
initialOffsetToSeparator.current = computeOffsetToSeparator(xStart, refs.columnHeaderElement.getBoundingClientRect(), resizeDirection.current);
|
|
323
323
|
};
|
|
@@ -11,6 +11,7 @@ exports.getFirstNonSpannedColumnToRender = getFirstNonSpannedColumnToRender;
|
|
|
11
11
|
exports.getTotalHeaderHeight = getTotalHeaderHeight;
|
|
12
12
|
exports.hydrateColumnsWidth = void 0;
|
|
13
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
|
+
var _resolveProps = _interopRequireDefault(require("@mui/utils/resolveProps"));
|
|
14
15
|
var _colDef = require("../../../colDef");
|
|
15
16
|
var _gridColumnsSelector = require("./gridColumnsSelector");
|
|
16
17
|
var _utils = require("../../../utils/utils");
|
|
@@ -289,9 +290,9 @@ const createColumnsState = ({
|
|
|
289
290
|
}
|
|
290
291
|
}
|
|
291
292
|
});
|
|
292
|
-
columnsState.lookup[field] = (0, _extends2.default)({},
|
|
293
|
+
columnsState.lookup[field] = (0, _resolveProps.default)(existingState, (0, _extends2.default)({}, newColumn, {
|
|
293
294
|
hasBeenResized
|
|
294
|
-
});
|
|
295
|
+
}));
|
|
295
296
|
});
|
|
296
297
|
if (keepOnlyColumnsToUpsert && !isInsideStateInitializer) {
|
|
297
298
|
Object.keys(columnsState.lookup).forEach(field => {
|
|
@@ -38,6 +38,7 @@ const EMPTY_DIMENSIONS = {
|
|
|
38
38
|
hasScrollY: false,
|
|
39
39
|
scrollbarSize: 0,
|
|
40
40
|
headerHeight: 0,
|
|
41
|
+
groupHeaderHeight: 0,
|
|
41
42
|
headerFilterHeight: 0,
|
|
42
43
|
rowWidth: 0,
|
|
43
44
|
rowHeight: 0,
|
|
@@ -65,6 +66,7 @@ function useGridDimensions(apiRef, props) {
|
|
|
65
66
|
const densityFactor = (0, _utils2.useGridSelector)(apiRef, _density.gridDensityFactorSelector);
|
|
66
67
|
const rowHeight = Math.floor(props.rowHeight * densityFactor);
|
|
67
68
|
const headerHeight = Math.floor(props.columnHeaderHeight * densityFactor);
|
|
69
|
+
const groupHeaderHeight = Math.floor((props.columnGroupHeaderHeight ?? props.columnHeaderHeight) * densityFactor);
|
|
68
70
|
const headerFilterHeight = Math.floor((props.headerFilterHeight ?? props.columnHeaderHeight) * densityFactor);
|
|
69
71
|
const columnsTotalWidth = roundToDecimalPlaces((0, _columns.gridColumnsTotalWidthSelector)(apiRef), 6);
|
|
70
72
|
const headersTotalHeight = (0, _gridColumnsUtils.getTotalHeaderHeight)(apiRef, props);
|
|
@@ -185,6 +187,7 @@ function useGridDimensions(apiRef, props) {
|
|
|
185
187
|
hasScrollY,
|
|
186
188
|
scrollbarSize,
|
|
187
189
|
headerHeight,
|
|
190
|
+
groupHeaderHeight,
|
|
188
191
|
headerFilterHeight,
|
|
189
192
|
rowWidth,
|
|
190
193
|
rowHeight,
|
|
@@ -201,7 +204,7 @@ function useGridDimensions(apiRef, props) {
|
|
|
201
204
|
apiRef.current.publishEvent('viewportInnerSizeChange', newDimensions.viewportInnerSize);
|
|
202
205
|
}
|
|
203
206
|
apiRef.current.updateRenderContext?.();
|
|
204
|
-
}, [apiRef, setDimensions, props.scrollbarSize, props.autoHeight, rowsMeta.currentPageTotalHeight, rowHeight, headerHeight, headerFilterHeight, columnsTotalWidth, headersTotalHeight, leftPinnedWidth, rightPinnedWidth]);
|
|
207
|
+
}, [apiRef, setDimensions, props.scrollbarSize, props.autoHeight, rowsMeta.currentPageTotalHeight, rowHeight, headerHeight, groupHeaderHeight, headerFilterHeight, columnsTotalWidth, headersTotalHeight, leftPinnedWidth, rightPinnedWidth]);
|
|
205
208
|
const apiPublic = {
|
|
206
209
|
resize,
|
|
207
210
|
getRootDimensions
|
|
@@ -20,6 +20,7 @@ var _keyboardUtils = require("../../../utils/keyboardUtils");
|
|
|
20
20
|
var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
21
21
|
var _utils2 = require("../../../utils/utils");
|
|
22
22
|
var _gridEditCellParams = require("../../../models/params/gridEditCellParams");
|
|
23
|
+
var _utils3 = require("./utils");
|
|
23
24
|
const _excluded = ["id", "field"],
|
|
24
25
|
_excluded2 = ["id", "field"];
|
|
25
26
|
const useGridCellEditing = (apiRef, props) => {
|
|
@@ -75,7 +76,7 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
75
76
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
76
77
|
if (params.cellMode === _gridEditRowModel.GridCellModes.Edit) {
|
|
77
78
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
78
|
-
// TODO:
|
|
79
|
+
// TODO: to replace at one point. See https://github.com/mui/material-ui/pull/39713#discussion_r1381678957.
|
|
79
80
|
if (event.which === 229) {
|
|
80
81
|
return;
|
|
81
82
|
}
|
|
@@ -257,24 +258,7 @@ const useGridCellEditing = (apiRef, props) => {
|
|
|
257
258
|
} = params;
|
|
258
259
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
259
260
|
if (deleteValue) {
|
|
260
|
-
|
|
261
|
-
switch (fieldType) {
|
|
262
|
-
case 'boolean':
|
|
263
|
-
newValue = false;
|
|
264
|
-
break;
|
|
265
|
-
case 'date':
|
|
266
|
-
case 'dateTime':
|
|
267
|
-
case 'number':
|
|
268
|
-
newValue = undefined;
|
|
269
|
-
break;
|
|
270
|
-
case 'singleSelect':
|
|
271
|
-
newValue = null;
|
|
272
|
-
break;
|
|
273
|
-
case 'string':
|
|
274
|
-
default:
|
|
275
|
-
newValue = '';
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
261
|
+
newValue = (0, _utils3.getDefaultCellValue)(apiRef.current.getColumn(field));
|
|
278
262
|
} else if (initialValue) {
|
|
279
263
|
newValue = initialValue;
|
|
280
264
|
}
|
|
@@ -22,6 +22,7 @@ var _gridRowsSelector = require("../rows/gridRowsSelector");
|
|
|
22
22
|
var _utils2 = require("../../../utils/utils");
|
|
23
23
|
var _gridRowParams = require("../../../models/params/gridRowParams");
|
|
24
24
|
var _colDef = require("../../../colDef");
|
|
25
|
+
var _utils3 = require("./utils");
|
|
25
26
|
const _excluded = ["id"],
|
|
26
27
|
_excluded2 = ["id"];
|
|
27
28
|
const useGridRowEditing = (apiRef, props) => {
|
|
@@ -117,7 +118,7 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
117
118
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
118
119
|
if (params.cellMode === _gridEditRowModel.GridRowModes.Edit) {
|
|
119
120
|
// Wait until IME is settled for Asian languages like Japanese and Chinese
|
|
120
|
-
// TODO:
|
|
121
|
+
// TODO: to replace at one point. See https://github.com/mui/material-ui/pull/39713#discussion_r1381678957.
|
|
121
122
|
if (event.which === 229) {
|
|
122
123
|
return;
|
|
123
124
|
}
|
|
@@ -327,7 +328,11 @@ const useGridRowEditing = (apiRef, props) => {
|
|
|
327
328
|
}
|
|
328
329
|
let newValue = apiRef.current.getCellValue(id, field);
|
|
329
330
|
if (fieldToFocus === field && (deleteValue || initialValue)) {
|
|
330
|
-
|
|
331
|
+
if (deleteValue) {
|
|
332
|
+
newValue = (0, _utils3.getDefaultCellValue)(apiRef.current.getColumn(field));
|
|
333
|
+
} else if (initialValue) {
|
|
334
|
+
newValue = initialValue;
|
|
335
|
+
}
|
|
331
336
|
}
|
|
332
337
|
acc[field] = {
|
|
333
338
|
value: newValue,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDefaultCellValue = void 0;
|
|
7
|
+
const getDefaultCellValue = colDef => {
|
|
8
|
+
switch (colDef.type) {
|
|
9
|
+
case 'boolean':
|
|
10
|
+
return false;
|
|
11
|
+
case 'date':
|
|
12
|
+
case 'dateTime':
|
|
13
|
+
case 'number':
|
|
14
|
+
return undefined;
|
|
15
|
+
case 'singleSelect':
|
|
16
|
+
return null;
|
|
17
|
+
case 'string':
|
|
18
|
+
default:
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.getDefaultCellValue = getDefaultCellValue;
|
|
@@ -46,6 +46,7 @@ function buildPrintWindow(title) {
|
|
|
46
46
|
* @requires useGridParamsApi (method)
|
|
47
47
|
*/
|
|
48
48
|
const useGridPrintExport = (apiRef, props) => {
|
|
49
|
+
const hasRootReference = apiRef.current.rootElementRef.current !== null;
|
|
49
50
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridPrintExport');
|
|
50
51
|
const doc = React.useRef(null);
|
|
51
52
|
const previousGridState = React.useRef(null);
|
|
@@ -54,7 +55,7 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
54
55
|
const previousVirtualizationState = React.useRef();
|
|
55
56
|
React.useEffect(() => {
|
|
56
57
|
doc.current = (0, _utils.unstable_ownerDocument)(apiRef.current.rootElementRef.current);
|
|
57
|
-
}, [apiRef]);
|
|
58
|
+
}, [apiRef, hasRootReference]);
|
|
58
59
|
|
|
59
60
|
// Returns a promise because updateColumns triggers state update and
|
|
60
61
|
// the new state needs to be in place before the grid can be sized correctly
|
|
@@ -43,6 +43,7 @@ exports.focusStateInitializer = focusStateInitializer;
|
|
|
43
43
|
const useGridFocus = (apiRef, props) => {
|
|
44
44
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridFocus');
|
|
45
45
|
const lastClickedCell = React.useRef(null);
|
|
46
|
+
const hasRootReference = apiRef.current.rootElementRef.current !== null;
|
|
46
47
|
const publishCellFocusOut = React.useCallback((cell, event) => {
|
|
47
48
|
if (cell) {
|
|
48
49
|
// The row might have been deleted
|
|
@@ -389,7 +390,7 @@ const useGridFocus = (apiRef, props) => {
|
|
|
389
390
|
return () => {
|
|
390
391
|
doc.removeEventListener('mouseup', handleDocumentClick);
|
|
391
392
|
};
|
|
392
|
-
}, [apiRef, handleDocumentClick]);
|
|
393
|
+
}, [apiRef, hasRootReference, handleDocumentClick]);
|
|
393
394
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'columnHeaderBlur', handleBlur);
|
|
394
395
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'cellDoubleClick', handleCellDoubleClick);
|
|
395
396
|
(0, _useGridApiEventHandler.useGridApiEventHandler)(apiRef, 'cellMouseDown', handleCellMouseDown);
|