@mui/x-data-grid 8.0.0-alpha.1 → 8.0.0-alpha.3
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 +330 -7
- package/DataGrid/DataGrid.js +9 -17
- package/components/GridPagination.js +2 -1
- package/components/base/GridOverlays.d.ts +4 -3
- package/components/base/GridOverlays.js +2 -24
- package/components/base/index.d.ts +0 -1
- package/components/base/index.js +1 -2
- package/components/cell/GridCell.js +7 -10
- package/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
- package/components/columnSelection/GridHeaderCheckbox.js +6 -4
- package/components/toolbar/GridToolbarColumnsButton.js +3 -4
- package/components/toolbar/GridToolbarDensitySelector.js +3 -4
- package/components/toolbar/GridToolbarExportContainer.js +3 -4
- package/components/toolbar/GridToolbarFilterButton.d.ts +2 -0
- package/components/toolbar/GridToolbarFilterButton.js +7 -6
- package/components/toolbar/GridToolbarQuickFilter.js +1 -0
- package/components/virtualization/GridVirtualScroller.js +5 -3
- package/constants/dataGridPropsDefaultValues.js +2 -4
- package/constants/localeTextConstants.js +0 -1
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.d.ts +25 -9
- package/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +5 -1
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.d.ts +3 -6
- package/hooks/core/strategyProcessing/useGridStrategyProcessing.js +7 -8
- package/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +0 -4
- package/hooks/features/dimensions/useGridDimensions.js +3 -19
- package/hooks/features/editing/useGridCellEditing.js +3 -3
- package/hooks/features/editing/useGridRowEditing.js +3 -3
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/listView/gridListViewSelectors.d.ts +3 -1
- package/hooks/features/listView/gridListViewSelectors.js +3 -1
- package/hooks/features/listView/index.d.ts +1 -0
- package/hooks/features/listView/index.js +1 -0
- package/hooks/features/overlays/useGridOverlays.d.ts +7 -4
- package/hooks/features/overlays/useGridOverlays.js +19 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +0 -9
- package/hooks/features/rowSelection/utils.js +2 -2
- package/hooks/features/rows/gridRowsInterfaces.d.ts +1 -8
- package/hooks/features/rows/gridRowsSelector.d.ts +0 -1
- package/hooks/features/rows/gridRowsSelector.js +0 -1
- package/hooks/features/rows/gridRowsUtils.js +0 -9
- package/hooks/features/rows/index.d.ts +1 -1
- package/hooks/features/rows/index.js +1 -1
- package/hooks/features/rows/useGridRows.js +12 -14
- package/hooks/features/rows/useGridRowsMeta.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
- package/index.js +1 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/locales/arSD.js +0 -1
- package/locales/beBY.js +0 -1
- package/locales/bgBG.js +0 -1
- package/locales/csCZ.js +0 -1
- package/locales/daDK.js +0 -1
- package/locales/deDE.js +10 -13
- package/locales/elGR.js +0 -1
- package/locales/esES.js +10 -13
- package/locales/faIR.js +0 -1
- package/locales/fiFI.js +0 -1
- package/locales/frFR.js +0 -1
- package/locales/heIL.js +14 -17
- package/locales/hrHR.js +0 -1
- package/locales/huHU.js +0 -1
- package/locales/isIS.js +0 -1
- package/locales/itIT.js +0 -1
- package/locales/jaJP.js +0 -1
- package/locales/koKR.js +0 -1
- package/locales/nbNO.js +0 -1
- package/locales/nlNL.js +0 -1
- package/locales/nnNO.js +0 -1
- package/locales/plPL.js +0 -1
- package/locales/ptBR.js +10 -13
- package/locales/ptPT.js +10 -13
- package/locales/roRO.js +0 -1
- package/locales/ruRU.js +0 -1
- package/locales/skSK.js +0 -1
- package/locales/svSE.js +0 -1
- package/locales/trTR.js +12 -15
- package/locales/ukUA.js +0 -1
- package/locales/urPK.js +0 -1
- package/locales/viVN.js +0 -1
- package/locales/zhCN.js +10 -13
- package/locales/zhHK.js +0 -1
- package/locales/zhTW.js +0 -1
- package/models/api/gridCoreApi.d.ts +1 -1
- package/models/api/gridLocaleTextApi.d.ts +0 -1
- package/models/colDef/gridColDef.d.ts +24 -24
- package/models/events/gridEventLookup.d.ts +1 -0
- package/models/gridDataSource.d.ts +1 -1
- package/models/props/DataGridProps.d.ts +9 -17
- package/modern/DataGrid/DataGrid.js +9 -17
- package/modern/components/GridPagination.js +2 -1
- package/modern/components/base/GridOverlays.js +2 -24
- package/modern/components/base/index.js +1 -2
- package/modern/components/cell/GridCell.js +7 -10
- package/modern/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
- package/modern/components/columnSelection/GridHeaderCheckbox.js +6 -4
- package/modern/components/toolbar/GridToolbarColumnsButton.js +3 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.js +3 -4
- package/modern/components/toolbar/GridToolbarExportContainer.js +3 -4
- package/modern/components/toolbar/GridToolbarFilterButton.js +7 -6
- package/modern/components/toolbar/GridToolbarQuickFilter.js +1 -0
- package/modern/components/virtualization/GridVirtualScroller.js +5 -3
- package/modern/constants/dataGridPropsDefaultValues.js +2 -4
- package/modern/constants/localeTextConstants.js +0 -1
- package/modern/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +5 -1
- package/modern/hooks/core/strategyProcessing/useGridStrategyProcessing.js +7 -8
- package/modern/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +3 -19
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -3
- package/modern/hooks/features/editing/useGridRowEditing.js +3 -3
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/listView/gridListViewSelectors.js +3 -1
- package/modern/hooks/features/listView/index.js +1 -0
- package/modern/hooks/features/overlays/useGridOverlays.js +19 -1
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +0 -9
- package/modern/hooks/features/rowSelection/utils.js +2 -2
- package/modern/hooks/features/rows/gridRowsSelector.js +0 -1
- package/modern/hooks/features/rows/gridRowsUtils.js +0 -9
- package/modern/hooks/features/rows/index.js +1 -1
- package/modern/hooks/features/rows/useGridRows.js +12 -14
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
- package/modern/index.js +1 -1
- package/modern/internals/index.js +1 -1
- package/modern/locales/arSD.js +0 -1
- package/modern/locales/beBY.js +0 -1
- package/modern/locales/bgBG.js +0 -1
- package/modern/locales/csCZ.js +0 -1
- package/modern/locales/daDK.js +0 -1
- package/modern/locales/deDE.js +10 -13
- package/modern/locales/elGR.js +0 -1
- package/modern/locales/esES.js +10 -13
- package/modern/locales/faIR.js +0 -1
- package/modern/locales/fiFI.js +0 -1
- package/modern/locales/frFR.js +0 -1
- package/modern/locales/heIL.js +14 -17
- package/modern/locales/hrHR.js +0 -1
- package/modern/locales/huHU.js +0 -1
- package/modern/locales/isIS.js +0 -1
- package/modern/locales/itIT.js +0 -1
- package/modern/locales/jaJP.js +0 -1
- package/modern/locales/koKR.js +0 -1
- package/modern/locales/nbNO.js +0 -1
- package/modern/locales/nlNL.js +0 -1
- package/modern/locales/nnNO.js +0 -1
- package/modern/locales/plPL.js +0 -1
- package/modern/locales/ptBR.js +10 -13
- package/modern/locales/ptPT.js +10 -13
- package/modern/locales/roRO.js +0 -1
- package/modern/locales/ruRU.js +0 -1
- package/modern/locales/skSK.js +0 -1
- package/modern/locales/svSE.js +0 -1
- package/modern/locales/trTR.js +12 -15
- package/modern/locales/ukUA.js +0 -1
- package/modern/locales/urPK.js +0 -1
- package/modern/locales/viVN.js +0 -1
- package/modern/locales/zhCN.js +10 -13
- package/modern/locales/zhHK.js +0 -1
- package/modern/locales/zhTW.js +0 -1
- package/node/DataGrid/DataGrid.js +9 -17
- package/node/components/GridPagination.js +2 -1
- package/node/components/base/GridOverlays.js +2 -24
- package/node/components/base/index.js +0 -11
- package/node/components/cell/GridCell.js +7 -10
- package/node/components/columnSelection/GridCellCheckboxRenderer.js +2 -3
- package/node/components/columnSelection/GridHeaderCheckbox.js +6 -4
- package/node/components/toolbar/GridToolbarColumnsButton.js +3 -4
- package/node/components/toolbar/GridToolbarDensitySelector.js +3 -4
- package/node/components/toolbar/GridToolbarExportContainer.js +3 -4
- package/node/components/toolbar/GridToolbarFilterButton.js +7 -6
- package/node/components/toolbar/GridToolbarQuickFilter.js +1 -0
- package/node/components/virtualization/GridVirtualScroller.js +5 -3
- package/node/constants/dataGridPropsDefaultValues.js +2 -4
- package/node/constants/localeTextConstants.js +0 -1
- package/node/hooks/core/strategyProcessing/gridStrategyProcessingApi.js +7 -1
- package/node/hooks/core/strategyProcessing/useGridStrategyProcessing.js +7 -8
- package/node/hooks/features/columnResize/useGridColumnResize.js +2 -1
- package/node/hooks/features/dimensions/useGridDimensions.js +2 -18
- package/node/hooks/features/editing/useGridCellEditing.js +2 -2
- package/node/hooks/features/editing/useGridRowEditing.js +2 -2
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/listView/gridListViewSelectors.js +3 -1
- package/node/hooks/features/listView/index.js +16 -0
- package/node/hooks/features/overlays/useGridOverlays.js +21 -1
- package/node/hooks/features/rowSelection/useGridRowSelection.js +0 -9
- package/node/hooks/features/rowSelection/utils.js +2 -2
- package/node/hooks/features/rows/gridRowsSelector.js +1 -2
- package/node/hooks/features/rows/gridRowsUtils.js +0 -9
- package/node/hooks/features/rows/index.js +0 -7
- package/node/hooks/features/rows/useGridRows.js +11 -13
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +55 -15
- package/node/index.js +1 -1
- package/node/internals/index.js +7 -0
- package/node/locales/arSD.js +0 -1
- package/node/locales/beBY.js +0 -1
- package/node/locales/bgBG.js +0 -1
- package/node/locales/csCZ.js +0 -1
- package/node/locales/daDK.js +0 -1
- package/node/locales/deDE.js +10 -13
- package/node/locales/elGR.js +0 -1
- package/node/locales/esES.js +10 -13
- package/node/locales/faIR.js +0 -1
- package/node/locales/fiFI.js +0 -1
- package/node/locales/frFR.js +0 -1
- package/node/locales/heIL.js +14 -17
- package/node/locales/hrHR.js +0 -1
- package/node/locales/huHU.js +0 -1
- package/node/locales/isIS.js +0 -1
- package/node/locales/itIT.js +0 -1
- package/node/locales/jaJP.js +0 -1
- package/node/locales/koKR.js +0 -1
- package/node/locales/nbNO.js +0 -1
- package/node/locales/nlNL.js +0 -1
- package/node/locales/nnNO.js +0 -1
- package/node/locales/plPL.js +0 -1
- package/node/locales/ptBR.js +10 -13
- package/node/locales/ptPT.js +10 -13
- package/node/locales/roRO.js +0 -1
- package/node/locales/ruRU.js +0 -1
- package/node/locales/skSK.js +0 -1
- package/node/locales/svSE.js +0 -1
- package/node/locales/trTR.js +12 -15
- package/node/locales/ukUA.js +0 -1
- package/node/locales/urPK.js +0 -1
- package/node/locales/viVN.js +0 -1
- package/node/locales/zhCN.js +10 -13
- package/node/locales/zhHK.js +0 -1
- package/node/locales/zhTW.js +0 -1
- package/package.json +2 -2
|
@@ -52,7 +52,7 @@ const useUtilityClasses = ownerState => {
|
|
|
52
52
|
};
|
|
53
53
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
54
54
|
};
|
|
55
|
-
function GridOverlayWrapper(props) {
|
|
55
|
+
export function GridOverlayWrapper(props) {
|
|
56
56
|
const apiRef = useGridApiContext();
|
|
57
57
|
const rootProps = useGridRootProps();
|
|
58
58
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
@@ -83,26 +83,4 @@ process.env.NODE_ENV !== "production" ? GridOverlayWrapper.propTypes = {
|
|
|
83
83
|
// ----------------------------------------------------------------------
|
|
84
84
|
loadingOverlayVariant: PropTypes.oneOf(['circular-progress', 'linear-progress', 'skeleton']),
|
|
85
85
|
overlayType: PropTypes.oneOf(['loadingOverlay', 'noResultsOverlay', 'noRowsOverlay'])
|
|
86
|
-
} : void 0;
|
|
87
|
-
process.env.NODE_ENV !== "production" ? GridOverlays.propTypes = {
|
|
88
|
-
// ----------------------------- Warning --------------------------------
|
|
89
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
90
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
91
|
-
// ----------------------------------------------------------------------
|
|
92
|
-
loadingOverlayVariant: PropTypes.oneOf(['circular-progress', 'linear-progress', 'skeleton']),
|
|
93
|
-
overlayType: PropTypes.oneOf(['loadingOverlay', 'noResultsOverlay', 'noRowsOverlay'])
|
|
94
|
-
} : void 0;
|
|
95
|
-
export function GridOverlays(props) {
|
|
96
|
-
const {
|
|
97
|
-
overlayType
|
|
98
|
-
} = props;
|
|
99
|
-
const rootProps = useGridRootProps();
|
|
100
|
-
if (!overlayType) {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
const Overlay = rootProps.slots?.[overlayType];
|
|
104
|
-
const overlayProps = rootProps.slotProps?.[overlayType];
|
|
105
|
-
return /*#__PURE__*/_jsx(GridOverlayWrapper, _extends({}, props, {
|
|
106
|
-
children: /*#__PURE__*/_jsx(Overlay, _extends({}, overlayProps))
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
86
|
+
} : void 0;
|
|
@@ -15,7 +15,6 @@ import { useGridSelector, objectShallowCompare } from "../../hooks/utils/useGrid
|
|
|
15
15
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
16
16
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
17
17
|
import { gridFocusCellSelector } from "../../hooks/features/focus/gridFocusStateSelector.js";
|
|
18
|
-
import { MissingRowIdError } from "../../hooks/features/rows/useGridParamsApi.js";
|
|
19
18
|
import { shouldCellShowLeftBorder, shouldCellShowRightBorder } from "../../utils/cellBorderUtils.js";
|
|
20
19
|
import { GridPinnedColumnPosition } from "../../hooks/features/columns/gridColumnsInterfaces.js";
|
|
21
20
|
import { gridRowSpanningHiddenCellsSelector, gridRowSpanningSpannedCellsSelector } from "../../hooks/features/rows/gridRowSpanningSelectors.js";
|
|
@@ -114,16 +113,13 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
114
113
|
// This is required because `.getCellParams` tries to get the `state.rows.tree` entry
|
|
115
114
|
// associated with `rowId`/`fieldId`, but this selector runs after the state has been
|
|
116
115
|
// updated, while `rowId`/`fieldId` reference an entry in the old state.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return result;
|
|
121
|
-
} catch (error) {
|
|
122
|
-
if (error instanceof MissingRowIdError) {
|
|
123
|
-
return EMPTY_CELL_PARAMS;
|
|
124
|
-
}
|
|
125
|
-
throw error;
|
|
116
|
+
const row = apiRef.current.getRow(rowId);
|
|
117
|
+
if (!row) {
|
|
118
|
+
return EMPTY_CELL_PARAMS;
|
|
126
119
|
}
|
|
120
|
+
const result = apiRef.current.getCellParams(rowId, field);
|
|
121
|
+
result.api = apiRef.current;
|
|
122
|
+
return result;
|
|
127
123
|
}, objectShallowCompare);
|
|
128
124
|
const isSelected = useGridSelector(apiRef, () => apiRef.current.unstable_applyPipeProcessors('isCellSelected', false, {
|
|
129
125
|
id: rowId,
|
|
@@ -211,6 +207,7 @@ const GridCell = /*#__PURE__*/React.forwardRef(function GridCell(props, ref) {
|
|
|
211
207
|
padding: 0,
|
|
212
208
|
opacity: 0,
|
|
213
209
|
width: 0,
|
|
210
|
+
height: 0,
|
|
214
211
|
border: 0
|
|
215
212
|
};
|
|
216
213
|
}
|
|
@@ -79,12 +79,11 @@ const GridCellCheckboxForwardRef = /*#__PURE__*/React.forwardRef(function GridCe
|
|
|
79
79
|
if (rowNode.type === 'footer' || rowNode.type === 'pinnedRow') {
|
|
80
80
|
return null;
|
|
81
81
|
}
|
|
82
|
-
const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
|
|
83
|
-
const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
|
|
82
|
+
const label = apiRef.current.getLocaleText(isChecked && !isIndeterminate ? 'checkboxSelectionUnselectRow' : 'checkboxSelectionSelectRow');
|
|
84
83
|
return /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
85
84
|
ref: handleRef,
|
|
86
85
|
tabIndex: tabIndex,
|
|
87
|
-
checked:
|
|
86
|
+
checked: isChecked && !isIndeterminate,
|
|
88
87
|
onChange: handleChange,
|
|
89
88
|
className: classes.root,
|
|
90
89
|
inputProps: {
|
|
@@ -56,10 +56,13 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
|
|
|
56
56
|
// Convert to an object to make O(1) checking if a row exists or not
|
|
57
57
|
// TODO create selector that returns visibleRowIds/paginatedVisibleRowIds as an object
|
|
58
58
|
return rowIds.reduce((acc, id) => {
|
|
59
|
+
if (!apiRef.current.isRowSelectable(id)) {
|
|
60
|
+
return acc;
|
|
61
|
+
}
|
|
59
62
|
acc[id] = true;
|
|
60
63
|
return acc;
|
|
61
64
|
}, {});
|
|
62
|
-
}, [rootProps.pagination, rootProps.checkboxSelectionVisibleOnly, paginatedVisibleRowIds, visibleRowIds]);
|
|
65
|
+
}, [apiRef, rootProps.pagination, rootProps.checkboxSelectionVisibleOnly, paginatedVisibleRowIds, visibleRowIds]);
|
|
63
66
|
|
|
64
67
|
// Amount of rows selected and that are visible in the current page
|
|
65
68
|
const currentSelectionSize = React.useMemo(() => filteredSelection.filter(id => selectionCandidates[id]).length, [filteredSelection, selectionCandidates]);
|
|
@@ -92,12 +95,11 @@ const GridHeaderCheckbox = /*#__PURE__*/React.forwardRef(function GridHeaderChec
|
|
|
92
95
|
React.useEffect(() => {
|
|
93
96
|
return apiRef.current.subscribeEvent('rowSelectionChange', handleSelectionChange);
|
|
94
97
|
}, [apiRef, handleSelectionChange]);
|
|
95
|
-
const label = apiRef.current.getLocaleText(isChecked ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
|
|
96
|
-
const checked = rootProps.indeterminateCheckboxAction === 'select' ? isChecked && !isIndeterminate : isChecked;
|
|
98
|
+
const label = apiRef.current.getLocaleText(isChecked && !isIndeterminate ? 'checkboxSelectionUnselectAllRows' : 'checkboxSelectionSelectAllRows');
|
|
97
99
|
return /*#__PURE__*/_jsx(rootProps.slots.baseCheckbox, _extends({
|
|
98
100
|
ref: ref,
|
|
99
101
|
indeterminate: isIndeterminate,
|
|
100
|
-
checked:
|
|
102
|
+
checked: isChecked && !isIndeterminate,
|
|
101
103
|
onChange: handleChange,
|
|
102
104
|
className: classes.root,
|
|
103
105
|
inputProps: {
|
|
@@ -36,7 +36,7 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
36
36
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
37
37
|
title: apiRef.current.getLocaleText('toolbarColumnsLabel'),
|
|
38
38
|
enterDelay: 1000
|
|
39
|
-
},
|
|
39
|
+
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
40
40
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
41
41
|
ref: ref,
|
|
42
42
|
id: columnButtonId,
|
|
@@ -45,10 +45,9 @@ const GridToolbarColumnsButton = /*#__PURE__*/React.forwardRef(function GridTool
|
|
|
45
45
|
"aria-haspopup": "menu",
|
|
46
46
|
"aria-expanded": isOpen,
|
|
47
47
|
"aria-controls": isOpen ? columnPanelId : undefined,
|
|
48
|
-
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {})
|
|
49
|
-
}, buttonProps, {
|
|
48
|
+
startIcon: /*#__PURE__*/_jsx(rootProps.slots.columnSelectorIcon, {}),
|
|
50
49
|
onClick: showColumns
|
|
51
|
-
}, rootProps.slotProps?.baseButton, {
|
|
50
|
+
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
52
51
|
children: apiRef.current.getLocaleText('toolbarColumns')
|
|
53
52
|
}))
|
|
54
53
|
}));
|
|
@@ -83,7 +83,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
83
83
|
children: [/*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
84
84
|
title: apiRef.current.getLocaleText('toolbarDensityLabel'),
|
|
85
85
|
enterDelay: 1000
|
|
86
|
-
},
|
|
86
|
+
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
87
87
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
88
88
|
ref: handleRef,
|
|
89
89
|
size: "small",
|
|
@@ -92,10 +92,9 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
92
92
|
"aria-haspopup": "menu",
|
|
93
93
|
"aria-expanded": open,
|
|
94
94
|
"aria-controls": open ? densityMenuId : undefined,
|
|
95
|
-
id: densityButtonId
|
|
96
|
-
}, buttonProps, {
|
|
95
|
+
id: densityButtonId,
|
|
97
96
|
onClick: handleDensitySelectorOpen
|
|
98
|
-
}, rootProps.slotProps?.baseButton, {
|
|
97
|
+
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
99
98
|
children: apiRef.current.getLocaleText('toolbarDensity')
|
|
100
99
|
}))
|
|
101
100
|
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
@@ -42,7 +42,7 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
42
42
|
children: [/*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
43
43
|
title: apiRef.current.getLocaleText('toolbarExportLabel'),
|
|
44
44
|
enterDelay: 1000
|
|
45
|
-
},
|
|
45
|
+
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
46
46
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
47
47
|
ref: handleRef,
|
|
48
48
|
size: "small",
|
|
@@ -51,10 +51,9 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
51
51
|
"aria-label": apiRef.current.getLocaleText('toolbarExportLabel'),
|
|
52
52
|
"aria-haspopup": "menu",
|
|
53
53
|
"aria-controls": open ? exportMenuId : undefined,
|
|
54
|
-
id: exportButtonId
|
|
55
|
-
}, buttonProps, {
|
|
54
|
+
id: exportButtonId,
|
|
56
55
|
onClick: handleMenuOpen
|
|
57
|
-
}, rootProps.slotProps?.baseButton, {
|
|
56
|
+
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
58
57
|
children: apiRef.current.getLocaleText('toolbarExport')
|
|
59
58
|
}))
|
|
60
59
|
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
@@ -37,6 +37,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
37
37
|
} = props;
|
|
38
38
|
const buttonProps = slotProps.button || {};
|
|
39
39
|
const tooltipProps = slotProps.tooltip || {};
|
|
40
|
+
const badgeProps = slotProps.badge || {};
|
|
40
41
|
const apiRef = useGridApiContext();
|
|
41
42
|
const rootProps = useGridRootProps();
|
|
42
43
|
const activeFilters = useGridSelector(apiRef, gridFilterActiveItemsSelector);
|
|
@@ -94,7 +95,7 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
94
95
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
95
96
|
title: tooltipContentNode,
|
|
96
97
|
enterDelay: 1000
|
|
97
|
-
},
|
|
98
|
+
}, rootProps.slotProps?.baseTooltip, tooltipProps, {
|
|
98
99
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
99
100
|
ref: ref,
|
|
100
101
|
id: filterButtonId,
|
|
@@ -103,14 +104,14 @@ const GridToolbarFilterButton = /*#__PURE__*/React.forwardRef(function GridToolb
|
|
|
103
104
|
"aria-controls": isOpen ? filterPanelId : undefined,
|
|
104
105
|
"aria-expanded": isOpen,
|
|
105
106
|
"aria-haspopup": true,
|
|
106
|
-
startIcon: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, {
|
|
107
|
+
startIcon: /*#__PURE__*/_jsx(rootProps.slots.baseBadge, _extends({
|
|
107
108
|
badgeContent: activeFilters.length,
|
|
108
|
-
color: "primary"
|
|
109
|
+
color: "primary"
|
|
110
|
+
}, rootProps.slotProps?.baseBadge, badgeProps, {
|
|
109
111
|
children: /*#__PURE__*/_jsx(rootProps.slots.openFilterButtonIcon, {})
|
|
110
|
-
})
|
|
111
|
-
}, buttonProps, {
|
|
112
|
+
})),
|
|
112
113
|
onClick: toggleFilter
|
|
113
|
-
}, rootProps.slotProps?.baseButton, {
|
|
114
|
+
}, rootProps.slotProps?.baseButton, buttonProps, {
|
|
114
115
|
children: apiRef.current.getLocaleText('toolbarFilters')
|
|
115
116
|
}))
|
|
116
117
|
}));
|
|
@@ -78,6 +78,7 @@ function GridToolbarQuickFilter(props) {
|
|
|
78
78
|
apiRef.current.setQuickFilterValues(newQuickFilterValues);
|
|
79
79
|
}, [apiRef, quickFilterParser]);
|
|
80
80
|
const debouncedUpdateSearchValue = React.useMemo(() => debounce(updateSearchValue, debounceMs), [updateSearchValue, debounceMs]);
|
|
81
|
+
React.useEffect(() => debouncedUpdateSearchValue.clear, [debouncedUpdateSearchValue]);
|
|
81
82
|
const handleSearchValueChange = React.useCallback(event => {
|
|
82
83
|
const newSearchValue = event.target.value;
|
|
83
84
|
setSearchValue(newSearchValue);
|
|
@@ -10,7 +10,6 @@ import { getDataGridUtilityClass } from "../../constants/gridClasses.js";
|
|
|
10
10
|
import { gridDimensionsSelector } from "../../hooks/features/dimensions/index.js";
|
|
11
11
|
import { useGridVirtualScroller } from "../../hooks/features/virtualization/useGridVirtualScroller.js";
|
|
12
12
|
import { useGridOverlays } from "../../hooks/features/overlays/useGridOverlays.js";
|
|
13
|
-
import { GridOverlays as Overlays } from "../base/GridOverlays.js";
|
|
14
13
|
import { GridHeaders } from "../GridHeaders.js";
|
|
15
14
|
import { GridMainContainer as Container } from "./GridMainContainer.js";
|
|
16
15
|
import { GridTopContainer as TopContainer } from "./GridTopContainer.js";
|
|
@@ -55,7 +54,10 @@ function GridVirtualScroller(props) {
|
|
|
55
54
|
const apiRef = useGridApiContext();
|
|
56
55
|
const rootProps = useGridRootProps();
|
|
57
56
|
const dimensions = useGridSelector(apiRef, gridDimensionsSelector);
|
|
58
|
-
const
|
|
57
|
+
const {
|
|
58
|
+
getOverlay,
|
|
59
|
+
overlaysProps
|
|
60
|
+
} = useGridOverlays();
|
|
59
61
|
const classes = useUtilityClasses(rootProps, dimensions, overlaysProps.loadingOverlayVariant);
|
|
60
62
|
const virtualScroller = useGridVirtualScroller();
|
|
61
63
|
const {
|
|
@@ -84,7 +86,7 @@ function GridVirtualScroller(props) {
|
|
|
84
86
|
position: "top",
|
|
85
87
|
virtualScroller: virtualScroller
|
|
86
88
|
})]
|
|
87
|
-
}),
|
|
89
|
+
}), getOverlay(), /*#__PURE__*/_jsx(Content, _extends({}, getContentProps(), {
|
|
88
90
|
children: /*#__PURE__*/_jsxs(RenderZone, _extends({}, getRenderZoneProps(), {
|
|
89
91
|
children: [rows, /*#__PURE__*/_jsx(rootProps.slots.detailPanels, {
|
|
90
92
|
virtualScroller: virtualScroller
|
|
@@ -34,8 +34,6 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
34
34
|
hideFooterSelectedRowCount: false,
|
|
35
35
|
ignoreDiacritics: false,
|
|
36
36
|
ignoreValueFormatterDuringExport: false,
|
|
37
|
-
// TODO v8: Update to 'select'
|
|
38
|
-
indeterminateCheckboxAction: 'deselect',
|
|
39
37
|
keepColumnPositionIfDraggedOutside: false,
|
|
40
38
|
keepNonExistentRowsSelected: false,
|
|
41
39
|
loading: false,
|
|
@@ -47,7 +45,6 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
47
45
|
resizeThrottleMs: 60,
|
|
48
46
|
rowBufferPx: 150,
|
|
49
47
|
rowHeight: 52,
|
|
50
|
-
rowPositionsDebounceMs: 166,
|
|
51
48
|
rows: [],
|
|
52
49
|
rowSelection: true,
|
|
53
50
|
rowSpacingType: 'margin',
|
|
@@ -56,5 +53,6 @@ export const DATA_GRID_PROPS_DEFAULT_VALUES = {
|
|
|
56
53
|
sortingMode: 'client',
|
|
57
54
|
sortingOrder: ['asc', 'desc', null],
|
|
58
55
|
throttleRowsMs: 0,
|
|
59
|
-
unstable_rowSpanning: false
|
|
56
|
+
unstable_rowSpanning: false,
|
|
57
|
+
virtualizeColumnsWithAutoRowHeight: false
|
|
60
58
|
};
|
|
@@ -26,7 +26,6 @@ export const GRID_DEFAULT_LOCALE_TEXT = {
|
|
|
26
26
|
toolbarPromptControlWithRecordingPlaceholder: 'Type or record a prompt…',
|
|
27
27
|
toolbarPromptControlRecordingPlaceholder: 'Listening for prompt…',
|
|
28
28
|
toolbarPromptControlLabel: 'Prompt input',
|
|
29
|
-
toolbarPromptControlDeleteIconLabel: 'Clear',
|
|
30
29
|
toolbarPromptControlRecordButtonDefaultLabel: 'Record',
|
|
31
30
|
toolbarPromptControlRecordButtonActiveLabel: 'Stop recording',
|
|
32
31
|
toolbarPromptControlSendActionLabel: 'Send',
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { GridStrategyGroup } from "./gridStrategyProcessingApi.js";
|
|
4
5
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
5
6
|
export const GRID_DEFAULT_STRATEGY = 'none';
|
|
6
7
|
export const GRID_STRATEGIES_PROCESSORS = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
dataSourceRowsUpdate: GridStrategyGroup.DataSource,
|
|
9
|
+
rowTreeCreation: GridStrategyGroup.RowTree,
|
|
10
|
+
filtering: GridStrategyGroup.RowTree,
|
|
11
|
+
sorting: GridStrategyGroup.RowTree,
|
|
12
|
+
visibleRowsLookupCreation: GridStrategyGroup.RowTree
|
|
11
13
|
};
|
|
12
14
|
/**
|
|
13
15
|
* Implements a variant of the Strategy Pattern (see https://en.wikipedia.org/wiki/Strategy_pattern)
|
|
@@ -44,10 +46,7 @@ export const GRID_STRATEGIES_PROCESSORS = {
|
|
|
44
46
|
* =====================================================================================================================
|
|
45
47
|
*
|
|
46
48
|
* Each processor name is part of a strategy group which can only have one active strategy at the time.
|
|
47
|
-
*
|
|
48
|
-
* - row tree creation algorithm.
|
|
49
|
-
* - sorting algorithm.
|
|
50
|
-
* - filtering algorithm.
|
|
49
|
+
* There are two active groups named `rowTree` and `dataSource`.
|
|
51
50
|
*/
|
|
52
51
|
export const useGridStrategyProcessing = apiRef => {
|
|
53
52
|
const availableStrategies = React.useRef(new Map());
|
|
@@ -491,7 +491,8 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
491
491
|
const widthByField = extractColumnWidths(apiRef, options, columns);
|
|
492
492
|
const newColumns = columns.map(column => _extends({}, column, {
|
|
493
493
|
width: widthByField[column.field],
|
|
494
|
-
computedWidth: widthByField[column.field]
|
|
494
|
+
computedWidth: widthByField[column.field],
|
|
495
|
+
flex: 0
|
|
495
496
|
}));
|
|
496
497
|
if (options.expand) {
|
|
497
498
|
const visibleColumns = state.orderedFields.map(field => state.lookup[field]).filter(c => state.columnVisibilityModel[c.field] !== false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { unstable_ownerDocument as ownerDocument, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback
|
|
3
|
+
import { unstable_ownerDocument as ownerDocument, unstable_useEnhancedEffect as useEnhancedEffect, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
4
4
|
import { throttle } from '@mui/x-internals/throttle';
|
|
5
5
|
import { useGridApiEventHandler, useGridApiOptionHandler } from "../../utils/useGridApiEventHandler.js";
|
|
6
6
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
@@ -66,28 +66,13 @@ export function useGridDimensions(apiRef, props) {
|
|
|
66
66
|
const rightPinnedWidth = pinnedColumns.right.reduce((w, col) => w + col.computedWidth, 0);
|
|
67
67
|
const [savedSize, setSavedSize] = React.useState();
|
|
68
68
|
const debouncedSetSavedSize = React.useMemo(() => throttle(setSavedSize, props.resizeThrottleMs), [props.resizeThrottleMs]);
|
|
69
|
-
|
|
69
|
+
React.useEffect(() => debouncedSetSavedSize.clear, [debouncedSetSavedSize]);
|
|
70
70
|
const getRootDimensions = () => apiRef.current.state.dimensions;
|
|
71
71
|
const setDimensions = useEventCallback(dimensions => {
|
|
72
72
|
apiRef.current.setState(state => _extends({}, state, {
|
|
73
73
|
dimensions
|
|
74
74
|
}));
|
|
75
75
|
});
|
|
76
|
-
const resize = React.useCallback(() => {
|
|
77
|
-
const element = apiRef.current.mainElementRef.current;
|
|
78
|
-
if (!element) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const computedStyle = ownerWindow(element).getComputedStyle(element);
|
|
82
|
-
const newSize = {
|
|
83
|
-
width: parseFloat(computedStyle.width) || 0,
|
|
84
|
-
height: parseFloat(computedStyle.height) || 0
|
|
85
|
-
};
|
|
86
|
-
if (!previousSize.current || !areElementSizesEqual(previousSize.current, newSize)) {
|
|
87
|
-
apiRef.current.publishEvent('resize', newSize);
|
|
88
|
-
previousSize.current = newSize;
|
|
89
|
-
}
|
|
90
|
-
}, [apiRef]);
|
|
91
76
|
const getViewportPageSize = React.useCallback(() => {
|
|
92
77
|
const dimensions = gridDimensionsSelector(apiRef.current.state);
|
|
93
78
|
if (!dimensions.isReady) {
|
|
@@ -198,7 +183,6 @@ export function useGridDimensions(apiRef, props) {
|
|
|
198
183
|
apiRef.current.updateRenderContext?.();
|
|
199
184
|
}, [apiRef, setDimensions, props.scrollbarSize, props.autoHeight, rowsMeta.currentPageTotalHeight, rowHeight, headerHeight, groupHeaderHeight, headerFilterHeight, columnsTotalWidth, headersTotalHeight, leftPinnedWidth, rightPinnedWidth]);
|
|
200
185
|
const apiPublic = {
|
|
201
|
-
resize,
|
|
202
186
|
getRootDimensions
|
|
203
187
|
};
|
|
204
188
|
const apiPrivate = {
|
|
@@ -238,7 +222,7 @@ export function useGridDimensions(apiRef, props) {
|
|
|
238
222
|
rootDimensionsRef.current = size;
|
|
239
223
|
|
|
240
224
|
// jsdom has no layout capabilities
|
|
241
|
-
const isJSDOM = /jsdom/.test(window.navigator.userAgent);
|
|
225
|
+
const isJSDOM = /jsdom|HappyDOM/.test(window.navigator.userAgent);
|
|
242
226
|
if (size.height === 0 && !errorShown.current && !props.autoHeight && !isJSDOM) {
|
|
243
227
|
logger.error(['The parent DOM element of the Data Grid has an empty height.', 'Please make sure that this element has an intrinsic height.', 'The grid displays with a height of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
|
|
244
228
|
errorShown.current = true;
|
|
@@ -11,7 +11,7 @@ import { GridEditModes, GridCellModes } from "../../../models/gridEditRowModel.j
|
|
|
11
11
|
import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
12
12
|
import { gridEditRowsStateSelector } from "./gridEditingSelectors.js";
|
|
13
13
|
import { isPrintableKey, isPasteShortcut } from "../../../utils/keyboardUtils.js";
|
|
14
|
-
import {
|
|
14
|
+
import { gridRowsLookupSelector } from "../rows/gridRowsSelector.js";
|
|
15
15
|
import { deepClone } from "../../../utils/utils.js";
|
|
16
16
|
import { GridCellEditStartReasons, GridCellEditStopReasons } from "../../../models/params/gridEditCellParams.js";
|
|
17
17
|
import { getDefaultCellValue } from "./utils.js";
|
|
@@ -442,7 +442,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
442
442
|
|
|
443
443
|
// Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
|
|
444
444
|
useEnhancedEffect(() => {
|
|
445
|
-
const
|
|
445
|
+
const rowsLookup = gridRowsLookupSelector(apiRef);
|
|
446
446
|
|
|
447
447
|
// Update the ref here because updateStateToStopCellEditMode may change it later
|
|
448
448
|
const copyOfPrevCellModes = prevCellModesModel.current;
|
|
@@ -451,7 +451,7 @@ export const useGridCellEditing = (apiRef, props) => {
|
|
|
451
451
|
Object.entries(cellModesModel).forEach(([id, fields]) => {
|
|
452
452
|
Object.entries(fields).forEach(([field, params]) => {
|
|
453
453
|
const prevMode = copyOfPrevCellModes[id]?.[field]?.mode || GridCellModes.View;
|
|
454
|
-
const originalId =
|
|
454
|
+
const originalId = apiRef.current.getRowId(rowsLookup[id]) ?? id;
|
|
455
455
|
if (params.mode === GridCellModes.Edit && prevMode === GridCellModes.View) {
|
|
456
456
|
updateStateToStartCellEditMode(_extends({
|
|
457
457
|
id: originalId,
|
|
@@ -12,7 +12,7 @@ import { useGridApiMethod } from "../../utils/useGridApiMethod.js";
|
|
|
12
12
|
import { gridEditRowsStateSelector } from "./gridEditingSelectors.js";
|
|
13
13
|
import { isPrintableKey, isPasteShortcut } from "../../../utils/keyboardUtils.js";
|
|
14
14
|
import { gridColumnFieldsSelector, gridVisibleColumnFieldsSelector } from "../columns/gridColumnsSelector.js";
|
|
15
|
-
import {
|
|
15
|
+
import { gridRowsLookupSelector } from "../rows/gridRowsSelector.js";
|
|
16
16
|
import { deepClone } from "../../../utils/utils.js";
|
|
17
17
|
import { GridRowEditStopReasons, GridRowEditStartReasons } from "../../../models/params/gridRowParams.js";
|
|
18
18
|
import { GRID_ACTIONS_COLUMN_TYPE } from "../../../colDef/index.js";
|
|
@@ -571,7 +571,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
571
571
|
|
|
572
572
|
// Run this effect synchronously so that the keyboard event can impact the yet-to-be-rendered input.
|
|
573
573
|
useEnhancedEffect(() => {
|
|
574
|
-
const
|
|
574
|
+
const rowsLookup = gridRowsLookupSelector(apiRef);
|
|
575
575
|
|
|
576
576
|
// Update the ref here because updateStateToStopRowEditMode may change it later
|
|
577
577
|
const copyOfPrevRowModesModel = prevRowModesModel.current;
|
|
@@ -583,7 +583,7 @@ export const useGridRowEditing = (apiRef, props) => {
|
|
|
583
583
|
mode: GridRowModes.View
|
|
584
584
|
};
|
|
585
585
|
const prevMode = copyOfPrevRowModesModel[id]?.mode || GridRowModes.View;
|
|
586
|
-
const originalId =
|
|
586
|
+
const originalId = apiRef.current.getRowId(rowsLookup[id]) ?? id;
|
|
587
587
|
if (params.mode === GridRowModes.Edit && prevMode === GridRowModes.View) {
|
|
588
588
|
updateStateToStartRowEditMode(_extends({
|
|
589
589
|
id: originalId
|
|
@@ -7,6 +7,7 @@ export * from "./density/index.js";
|
|
|
7
7
|
export * from "./editing/index.js";
|
|
8
8
|
export * from "./filter/index.js";
|
|
9
9
|
export * from "./focus/index.js";
|
|
10
|
+
export * from "./listView/index.js";
|
|
10
11
|
export * from "./pagination/index.js";
|
|
11
12
|
export * from "./preferencesPanel/index.js";
|
|
12
13
|
export * from "./rows/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./gridListViewSelectors.js";
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
1
3
|
import { useGridSelector } from "../../utils/index.js";
|
|
2
4
|
import { useGridApiContext } from "../../utils/useGridApiContext.js";
|
|
3
5
|
import { useGridRootProps } from "../../utils/useGridRootProps.js";
|
|
4
6
|
import { gridExpandedRowCountSelector } from "../filter/index.js";
|
|
5
7
|
import { gridRowCountSelector, gridRowsLoadingSelector } from "../rows/index.js";
|
|
8
|
+
import { GridOverlayWrapper } from "../../../components/base/GridOverlays.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
10
|
/**
|
|
7
11
|
* Uses the grid state to determine which overlay to display.
|
|
8
12
|
* Returns the active overlay type and the active loading overlay variant.
|
|
@@ -28,8 +32,22 @@ export const useGridOverlays = () => {
|
|
|
28
32
|
overlayType = 'loadingOverlay';
|
|
29
33
|
loadingOverlayVariant = rootProps.slotProps?.loadingOverlay?.[noRows ? 'noRowsVariant' : 'variant'] || null;
|
|
30
34
|
}
|
|
31
|
-
|
|
35
|
+
const overlaysProps = {
|
|
32
36
|
overlayType,
|
|
33
37
|
loadingOverlayVariant
|
|
34
38
|
};
|
|
39
|
+
const getOverlay = () => {
|
|
40
|
+
if (!overlayType) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const Overlay = rootProps.slots?.[overlayType];
|
|
44
|
+
const overlayProps = rootProps.slotProps?.[overlayType];
|
|
45
|
+
return /*#__PURE__*/_jsx(GridOverlayWrapper, _extends({}, overlaysProps, {
|
|
46
|
+
children: /*#__PURE__*/_jsx(Overlay, _extends({}, overlayProps))
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
getOverlay,
|
|
51
|
+
overlaysProps
|
|
52
|
+
};
|
|
35
53
|
};
|
|
@@ -248,11 +248,7 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
248
248
|
/*
|
|
249
249
|
* EVENTS
|
|
250
250
|
*/
|
|
251
|
-
const isFirstRender = React.useRef(true);
|
|
252
251
|
const removeOutdatedSelection = React.useCallback((sortModelUpdated = false) => {
|
|
253
|
-
if (isFirstRender.current) {
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
252
|
const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
|
|
257
253
|
const rowsLookup = gridRowsLookupSelector(apiRef);
|
|
258
254
|
const filteredRowsLookup = gridFilteredRowsLookupSelector(apiRef);
|
|
@@ -480,9 +476,4 @@ export const useGridRowSelection = (apiRef, props) => {
|
|
|
480
476
|
React.useEffect(() => {
|
|
481
477
|
runIfRowSelectionIsEnabled(removeOutdatedSelection);
|
|
482
478
|
}, [removeOutdatedSelection, runIfRowSelectionIsEnabled]);
|
|
483
|
-
React.useEffect(() => {
|
|
484
|
-
if (isFirstRender.current) {
|
|
485
|
-
isFirstRender.current = false;
|
|
486
|
-
}
|
|
487
|
-
}, []);
|
|
488
479
|
};
|
|
@@ -6,8 +6,8 @@ import { selectedIdsLookupSelector } from "./gridRowSelectionSelector.js";
|
|
|
6
6
|
import { gridRowTreeSelector } from "../rows/gridRowsSelector.js";
|
|
7
7
|
import { createSelector } from "../../../utils/createSelector.js";
|
|
8
8
|
export const ROW_SELECTION_PROPAGATION_DEFAULT = {
|
|
9
|
-
parents:
|
|
10
|
-
descendants:
|
|
9
|
+
parents: true,
|
|
10
|
+
descendants: true
|
|
11
11
|
};
|
|
12
12
|
function getGridRowGroupSelectableDescendants(apiRef, groupId) {
|
|
13
13
|
const rowTree = gridRowTreeSelector(apiRef);
|
|
@@ -6,7 +6,6 @@ export const gridTopLevelRowCountSelector = createSelector(gridRowsStateSelector
|
|
|
6
6
|
|
|
7
7
|
// TODO rows v6: Rename
|
|
8
8
|
export const gridRowsLookupSelector = createSelector(gridRowsStateSelector, rows => rows.dataRowIdToModelLookup);
|
|
9
|
-
export const gridRowsDataRowIdToIdLookupSelector = createSelector(gridRowsStateSelector, rows => rows.dataRowIdToIdLookup);
|
|
10
9
|
export const gridRowTreeSelector = createSelector(gridRowsStateSelector, rows => rows.tree);
|
|
11
10
|
export const gridRowGroupsToFetchSelector = createSelector(gridRowsStateSelector, rows => rows.groupsToFetch);
|
|
12
11
|
export const gridRowGroupingNameSelector = createSelector(gridRowsStateSelector, rows => rows.groupingName);
|
|
@@ -42,12 +42,10 @@ export const createRowsInternalCache = ({
|
|
|
42
42
|
rows: []
|
|
43
43
|
};
|
|
44
44
|
const dataRowIdToModelLookup = {};
|
|
45
|
-
const dataRowIdToIdLookup = {};
|
|
46
45
|
for (let i = 0; i < rows.length; i += 1) {
|
|
47
46
|
const model = rows[i];
|
|
48
47
|
const id = getRowIdFromRowModel(model, getRowId);
|
|
49
48
|
dataRowIdToModelLookup[id] = model;
|
|
50
|
-
dataRowIdToIdLookup[id] = id;
|
|
51
49
|
updates.rows.push(id);
|
|
52
50
|
}
|
|
53
51
|
return {
|
|
@@ -55,7 +53,6 @@ export const createRowsInternalCache = ({
|
|
|
55
53
|
loadingPropBeforePartialUpdates: loading,
|
|
56
54
|
rowCountPropBeforePartialUpdates: rowCount,
|
|
57
55
|
updates,
|
|
58
|
-
dataRowIdToIdLookup,
|
|
59
56
|
dataRowIdToModelLookup
|
|
60
57
|
};
|
|
61
58
|
};
|
|
@@ -87,7 +84,6 @@ export const getRowsStateFromCache = ({
|
|
|
87
84
|
previousTree,
|
|
88
85
|
previousTreeDepths,
|
|
89
86
|
updates: cache.updates,
|
|
90
|
-
dataRowIdToIdLookup: cache.dataRowIdToIdLookup,
|
|
91
87
|
dataRowIdToModelLookup: cache.dataRowIdToModelLookup,
|
|
92
88
|
previousGroupsToFetch
|
|
93
89
|
});
|
|
@@ -96,7 +92,6 @@ export const getRowsStateFromCache = ({
|
|
|
96
92
|
const groupingParamsWithHydrateRows = apiRef.current.unstable_applyPipeProcessors('hydrateRows', {
|
|
97
93
|
tree: unProcessedTree,
|
|
98
94
|
treeDepths: unProcessedTreeDepths,
|
|
99
|
-
dataRowIdToIdLookup: cache.dataRowIdToIdLookup,
|
|
100
95
|
dataRowIds: unProcessedDataRowIds,
|
|
101
96
|
dataRowIdToModelLookup: cache.dataRowIdToModelLookup
|
|
102
97
|
});
|
|
@@ -177,7 +172,6 @@ export const updateCacheWithNewRows = ({
|
|
|
177
172
|
groupKeys
|
|
178
173
|
};
|
|
179
174
|
const dataRowIdToModelLookup = _extends({}, previousCache.dataRowIdToModelLookup);
|
|
180
|
-
const dataRowIdToIdLookup = _extends({}, previousCache.dataRowIdToIdLookup);
|
|
181
175
|
const alreadyAppliedActionsToRemove = {
|
|
182
176
|
insert: {},
|
|
183
177
|
modify: {},
|
|
@@ -210,7 +204,6 @@ export const updateCacheWithNewRows = ({
|
|
|
210
204
|
// Remove the data row from the lookups and add it to the "delete" update.
|
|
211
205
|
partialUpdates.actions.remove.push(id);
|
|
212
206
|
delete dataRowIdToModelLookup[id];
|
|
213
|
-
delete dataRowIdToIdLookup[id];
|
|
214
207
|
return;
|
|
215
208
|
}
|
|
216
209
|
const oldRow = dataRowIdToModelLookup[id];
|
|
@@ -250,7 +243,6 @@ export const updateCacheWithNewRows = ({
|
|
|
250
243
|
|
|
251
244
|
// Update the data row lookups.
|
|
252
245
|
dataRowIdToModelLookup[id] = partialRow;
|
|
253
|
-
dataRowIdToIdLookup[id] = id;
|
|
254
246
|
});
|
|
255
247
|
const actionTypeWithActionsToRemove = Object.keys(alreadyAppliedActionsToRemove);
|
|
256
248
|
for (let i = 0; i < actionTypeWithActionsToRemove.length; i += 1) {
|
|
@@ -262,7 +254,6 @@ export const updateCacheWithNewRows = ({
|
|
|
262
254
|
}
|
|
263
255
|
return {
|
|
264
256
|
dataRowIdToModelLookup,
|
|
265
|
-
dataRowIdToIdLookup,
|
|
266
257
|
updates: partialUpdates,
|
|
267
258
|
rowsBeforePartialUpdates: previousCache.rowsBeforePartialUpdates,
|
|
268
259
|
loadingPropBeforePartialUpdates: previousCache.loadingPropBeforePartialUpdates,
|