@mui/x-data-grid 6.14.0 → 6.16.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 +167 -0
- package/DataGrid/useDataGridComponent.js +43 -40
- package/components/DataGridVirtualScroller.d.ts +1 -4
- package/components/DataGridVirtualScroller.js +3 -5
- package/components/GridRow.js +4 -2
- package/components/base/GridBody.d.ts +0 -1
- package/components/base/GridBody.js +2 -22
- package/components/cell/GridActionsCell.js +2 -2
- package/components/cell/GridActionsCellItem.d.ts +6 -0
- package/components/cell/GridCell.js +4 -2
- package/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/components/menu/GridMenu.d.ts +1 -2
- package/components/menu/GridMenu.js +21 -5
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +11 -8
- package/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/components/toolbar/GridToolbarDensitySelector.js +2 -7
- package/components/toolbar/GridToolbarExportContainer.js +1 -9
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -3
- package/hooks/features/export/useGridPrintExport.js +37 -7
- package/hooks/features/filter/gridFilterUtils.js +10 -6
- package/hooks/features/focus/useGridFocus.js +0 -1
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +2 -1
- package/hooks/features/virtualization/gridVirtualizationSelectors.d.ts +16 -0
- package/hooks/features/virtualization/gridVirtualizationSelectors.js +18 -0
- package/hooks/features/virtualization/index.d.ts +2 -0
- package/hooks/features/virtualization/index.js +2 -0
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +53 -36
- package/hooks/features/virtualization/useGridVirtualization.d.ts +12 -0
- package/hooks/features/virtualization/useGridVirtualization.js +47 -0
- package/index.js +1 -1
- package/internals/index.d.ts +4 -0
- package/internals/index.js +4 -0
- package/legacy/DataGrid/useDataGridComponent.js +43 -40
- package/legacy/components/DataGridVirtualScroller.js +2 -4
- package/legacy/components/GridRow.js +4 -2
- package/legacy/components/base/GridBody.js +2 -26
- package/legacy/components/cell/GridActionsCell.js +2 -2
- package/legacy/components/cell/GridCell.js +4 -2
- package/legacy/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/legacy/components/menu/GridMenu.js +21 -5
- package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +11 -8
- package/legacy/components/panel/filterPanel/GridFilterInputBoolean.js +2 -1
- package/legacy/components/panel/filterPanel/GridFilterInputSingleSelect.js +2 -1
- package/legacy/components/toolbar/GridToolbarDensitySelector.js +2 -7
- package/legacy/components/toolbar/GridToolbarExportContainer.js +1 -9
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -3
- package/legacy/hooks/features/export/useGridPrintExport.js +44 -12
- package/legacy/hooks/features/filter/gridFilterUtils.js +10 -6
- package/legacy/hooks/features/focus/useGridFocus.js +0 -1
- package/legacy/hooks/features/index.js +2 -1
- package/legacy/hooks/features/virtualization/gridVirtualizationSelectors.js +24 -0
- package/legacy/hooks/features/virtualization/index.js +2 -0
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +61 -39
- package/legacy/hooks/features/virtualization/useGridVirtualization.js +51 -0
- package/legacy/index.js +1 -1
- package/legacy/internals/index.js +4 -0
- package/legacy/locales/ruRU.js +26 -28
- package/legacy/models/api/index.js +1 -2
- package/legacy/utils/createControllablePromise.js +11 -0
- package/locales/ruRU.js +26 -28
- package/models/api/gridApiCommon.d.ts +3 -4
- package/models/api/gridVirtualizationApi.d.ts +20 -0
- package/models/api/index.d.ts +1 -2
- package/models/api/index.js +1 -2
- package/models/events/gridEventLookup.d.ts +8 -0
- package/models/gridExport.d.ts +17 -4
- package/models/gridStateCommunity.d.ts +2 -1
- package/models/index.d.ts +1 -1
- package/modern/DataGrid/useDataGridComponent.js +43 -40
- package/modern/components/DataGridVirtualScroller.js +3 -5
- package/modern/components/GridRow.js +4 -2
- package/modern/components/base/GridBody.js +2 -22
- package/modern/components/cell/GridActionsCell.js +2 -2
- package/modern/components/cell/GridCell.js +4 -2
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/modern/components/menu/GridMenu.js +20 -5
- package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +11 -8
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/modern/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -7
- package/modern/components/toolbar/GridToolbarExportContainer.js +1 -9
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -3
- package/modern/hooks/features/export/useGridPrintExport.js +37 -7
- package/modern/hooks/features/filter/gridFilterUtils.js +10 -6
- package/modern/hooks/features/focus/useGridFocus.js +0 -1
- package/modern/hooks/features/index.js +2 -1
- package/modern/hooks/features/virtualization/gridVirtualizationSelectors.js +18 -0
- package/modern/hooks/features/virtualization/index.js +2 -0
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +52 -36
- package/modern/hooks/features/virtualization/useGridVirtualization.js +47 -0
- package/modern/index.js +1 -1
- package/modern/internals/index.js +4 -0
- package/modern/locales/ruRU.js +26 -28
- package/modern/models/api/index.js +1 -2
- package/modern/utils/createControllablePromise.js +11 -0
- package/node/DataGrid/useDataGridComponent.js +43 -40
- package/node/components/DataGridVirtualScroller.js +3 -5
- package/node/components/GridRow.js +4 -2
- package/node/components/base/GridBody.js +2 -22
- package/node/components/cell/GridActionsCell.js +2 -2
- package/node/components/cell/GridCell.js +4 -2
- package/node/components/columnHeaders/GridColumnHeaderItem.js +2 -1
- package/node/components/menu/GridMenu.js +19 -4
- package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +10 -7
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +1 -1
- package/node/components/panel/filterPanel/GridFilterInputSingleSelect.js +1 -1
- package/node/components/toolbar/GridToolbarDensitySelector.js +2 -7
- package/node/components/toolbar/GridToolbarExportContainer.js +1 -9
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +8 -5
- package/node/hooks/features/export/useGridPrintExport.js +37 -7
- package/node/hooks/features/filter/gridFilterUtils.js +9 -6
- package/node/hooks/features/focus/useGridFocus.js +0 -1
- package/node/hooks/features/index.js +11 -0
- package/node/hooks/features/virtualization/gridVirtualizationSelectors.js +27 -0
- package/node/hooks/features/virtualization/index.js +27 -0
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +51 -37
- package/node/hooks/features/virtualization/useGridVirtualization.js +58 -0
- package/node/index.js +1 -1
- package/node/internals/index.js +44 -0
- package/node/locales/ruRU.js +26 -28
- package/node/models/api/index.js +4 -15
- package/node/utils/createControllablePromise.js +17 -0
- package/package.json +1 -1
- package/utils/createControllablePromise.d.ts +5 -0
- package/utils/createControllablePromise.js +11 -0
- package/models/api/gridDisableVirtualizationApi.d.ts +0 -15
- package/models/api/gridVirtualScrollerApi.d.ts +0 -8
- package/models/api/gridVirtualScrollerApi.js +0 -1
- package/modern/models/api/gridDisableVirtualizationApi.js +0 -1
- package/modern/models/api/gridVirtualScrollerApi.js +0 -1
- package/node/models/api/gridVirtualScrollerApi.js +0 -5
- /package/legacy/models/api/{gridDisableVirtualizationApi.js → gridVirtualizationApi.js} +0 -0
- /package/{legacy/models/api/gridVirtualScrollerApi.js → models/api/gridVirtualizationApi.js} +0 -0
- /package/{models/api/gridDisableVirtualizationApi.js → modern/models/api/gridVirtualizationApi.js} +0 -0
- /package/node/models/api/{gridDisableVirtualizationApi.js → gridVirtualizationApi.js} +0 -0
package/internals/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { useGridColumnMenu, columnMenuStateInitializer } from '../hooks/features
|
|
|
16
16
|
export { useGridColumns, columnsStateInitializer } from '../hooks/features/columns/useGridColumns';
|
|
17
17
|
export { getTotalHeaderHeight } from '../hooks/features/columns/gridColumnsUtils';
|
|
18
18
|
export { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
|
|
19
|
+
export { gridColumnsStateSelector } from '../hooks/features/columns/gridColumnsSelector';
|
|
19
20
|
export { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
20
21
|
export { useGridDensity, densityStateInitializer } from '../hooks/features/density/useGridDensity';
|
|
21
22
|
export { useGridCsvExport } from '../hooks/features/export/useGridCsvExport';
|
|
@@ -46,10 +47,12 @@ export { useGridEvents } from '../hooks/features/events/useGridEvents';
|
|
|
46
47
|
export { useGridDimensions } from '../hooks/features/dimensions/useGridDimensions';
|
|
47
48
|
export { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
48
49
|
export { useGridVirtualScroller, getRenderableIndexes } from '../hooks/features/virtualization/useGridVirtualScroller';
|
|
50
|
+
export * from '../hooks/features/virtualization';
|
|
49
51
|
export { useTimeout } from '../hooks/utils/useTimeout';
|
|
50
52
|
export { useGridVisibleRows, getVisibleRows } from '../hooks/utils/useGridVisibleRows';
|
|
51
53
|
export { useGridInitializeState } from '../hooks/utils/useGridInitializeState';
|
|
52
54
|
export { getColumnsToExport, defaultGetRowsToExport } from '../hooks/features/export/utils';
|
|
55
|
+
export * from '../utils/createControllablePromise';
|
|
53
56
|
export { createSelector, createSelectorMemoized, unstable_resetCreateSelectorCache } from '../utils/createSelector';
|
|
54
57
|
export { findParentElementFromClassName, getActiveElement } from '../utils/domUtils';
|
|
55
58
|
export { isNavigationKey } from '../utils/keyboardUtils';
|
|
@@ -57,6 +60,7 @@ export { clamp, isDeepEqual, isNumber, isFunction, isObject } from '../utils/uti
|
|
|
57
60
|
export { buildWarning } from '../utils/warning';
|
|
58
61
|
export { exportAs } from '../utils/exportAs';
|
|
59
62
|
export { useGridPrivateApiContext } from '../hooks/utils/useGridPrivateApiContext';
|
|
63
|
+
export * from '../hooks/utils/useOnMount';
|
|
60
64
|
export { serializeCellValue } from '../hooks/features/export/serializers/csvSerializer';
|
|
61
65
|
export * from '../colDef/utils';
|
|
62
66
|
export * from './utils';
|
|
@@ -25,53 +25,56 @@ import { rowsMetaStateInitializer, useGridRowsMeta } from '../hooks/features/row
|
|
|
25
25
|
import { useGridStatePersistence } from '../hooks/features/statePersistence/useGridStatePersistence';
|
|
26
26
|
import { useGridColumnSpanning } from '../hooks/features/columns/useGridColumnSpanning';
|
|
27
27
|
import { useGridColumnGrouping, columnGroupsStateInitializer } from '../hooks/features/columnGrouping/useGridColumnGrouping';
|
|
28
|
+
import { useGridVirtualization, virtualizationStateInitializer } from '../hooks/features/virtualization';
|
|
28
29
|
export var useDataGridComponent = function useDataGridComponent(inputApiRef, props) {
|
|
29
|
-
var
|
|
30
|
+
var apiRef = useGridInitialization(inputApiRef, props);
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Register all pre-processors called during state initialization here.
|
|
33
34
|
*/
|
|
34
|
-
useGridRowSelectionPreProcessors(
|
|
35
|
-
useGridRowsPreProcessors(
|
|
35
|
+
useGridRowSelectionPreProcessors(apiRef, props);
|
|
36
|
+
useGridRowsPreProcessors(apiRef);
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
39
|
* Register all state initializers here.
|
|
39
40
|
*/
|
|
40
|
-
useGridInitializeState(rowSelectionStateInitializer,
|
|
41
|
-
useGridInitializeState(columnsStateInitializer,
|
|
42
|
-
useGridInitializeState(rowsStateInitializer,
|
|
43
|
-
useGridInitializeState(editingStateInitializer,
|
|
44
|
-
useGridInitializeState(focusStateInitializer,
|
|
45
|
-
useGridInitializeState(sortingStateInitializer,
|
|
46
|
-
useGridInitializeState(preferencePanelStateInitializer,
|
|
47
|
-
useGridInitializeState(filterStateInitializer,
|
|
48
|
-
useGridInitializeState(densityStateInitializer,
|
|
49
|
-
useGridInitializeState(paginationStateInitializer,
|
|
50
|
-
useGridInitializeState(rowsMetaStateInitializer,
|
|
51
|
-
useGridInitializeState(columnMenuStateInitializer,
|
|
52
|
-
useGridInitializeState(columnGroupsStateInitializer,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
41
|
+
useGridInitializeState(rowSelectionStateInitializer, apiRef, props);
|
|
42
|
+
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
43
|
+
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
44
|
+
useGridInitializeState(editingStateInitializer, apiRef, props);
|
|
45
|
+
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
46
|
+
useGridInitializeState(sortingStateInitializer, apiRef, props);
|
|
47
|
+
useGridInitializeState(preferencePanelStateInitializer, apiRef, props);
|
|
48
|
+
useGridInitializeState(filterStateInitializer, apiRef, props);
|
|
49
|
+
useGridInitializeState(densityStateInitializer, apiRef, props);
|
|
50
|
+
useGridInitializeState(paginationStateInitializer, apiRef, props);
|
|
51
|
+
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
52
|
+
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
53
|
+
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
54
|
+
useGridInitializeState(virtualizationStateInitializer, apiRef, props);
|
|
55
|
+
useGridKeyboardNavigation(apiRef, props);
|
|
56
|
+
useGridRowSelection(apiRef, props);
|
|
57
|
+
useGridColumns(apiRef, props);
|
|
58
|
+
useGridRows(apiRef, props);
|
|
59
|
+
useGridParamsApi(apiRef, props);
|
|
60
|
+
useGridColumnSpanning(apiRef);
|
|
61
|
+
useGridColumnGrouping(apiRef, props);
|
|
62
|
+
useGridEditing(apiRef, props);
|
|
63
|
+
useGridFocus(apiRef, props);
|
|
64
|
+
useGridPreferencesPanel(apiRef, props);
|
|
65
|
+
useGridFilter(apiRef, props);
|
|
66
|
+
useGridSorting(apiRef, props);
|
|
67
|
+
useGridDensity(apiRef, props);
|
|
68
|
+
useGridPagination(apiRef, props);
|
|
69
|
+
useGridRowsMeta(apiRef, props);
|
|
70
|
+
useGridScroll(apiRef, props);
|
|
71
|
+
useGridColumnMenu(apiRef);
|
|
72
|
+
useGridCsvExport(apiRef, props);
|
|
73
|
+
useGridPrintExport(apiRef, props);
|
|
74
|
+
useGridClipboard(apiRef, props);
|
|
75
|
+
useGridDimensions(apiRef, props);
|
|
76
|
+
useGridEvents(apiRef, props);
|
|
77
|
+
useGridStatePersistence(apiRef);
|
|
78
|
+
useGridVirtualization(apiRef, props);
|
|
79
|
+
return apiRef;
|
|
77
80
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className"
|
|
3
|
+
var _excluded = ["className"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { GridVirtualScroller } from './virtualization/GridVirtualScroller';
|
|
6
6
|
import { GridVirtualScrollerContent } from './virtualization/GridVirtualScrollerContent';
|
|
@@ -11,11 +11,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
var DataGridVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGridVirtualScroller(props, ref) {
|
|
13
13
|
var className = props.className,
|
|
14
|
-
disableVirtualization = props.disableVirtualization,
|
|
15
14
|
other = _objectWithoutProperties(props, _excluded);
|
|
16
15
|
var _useGridVirtualScroll = useGridVirtualScroller({
|
|
17
|
-
ref: ref
|
|
18
|
-
disableVirtualization: disableVirtualization
|
|
16
|
+
ref: ref
|
|
19
17
|
}),
|
|
20
18
|
getRootProps = _useGridVirtualScroll.getRootProps,
|
|
21
19
|
getContentProps = _useGridVirtualScroll.getContentProps,
|
|
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["selected", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCellColumnIndexNotInRange", "isNotVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
5
|
+
var _excluded = ["selected", "hovered", "rowId", "row", "index", "style", "position", "rowHeight", "className", "visibleColumns", "renderedColumns", "containerWidth", "firstColumnToRender", "lastColumnToRender", "isLastVisible", "focusedCellColumnIndexNotInRange", "isNotVisible", "focusedCell", "tabbableCell", "onClick", "onDoubleClick", "onMouseEnter", "onMouseLeave"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -55,6 +55,7 @@ function EmptyCell(_ref) {
|
|
|
55
55
|
|
|
56
56
|
var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
57
57
|
var selected = props.selected,
|
|
58
|
+
hovered = props.hovered,
|
|
58
59
|
rowId = props.rowId,
|
|
59
60
|
row = props.row,
|
|
60
61
|
index = props.index,
|
|
@@ -92,6 +93,7 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
92
93
|
|
|
93
94
|
var ownerState = {
|
|
94
95
|
selected: selected,
|
|
96
|
+
hovered: hovered,
|
|
95
97
|
isLastVisible: isLastVisible,
|
|
96
98
|
classes: rootProps.classes,
|
|
97
99
|
editing: apiRef.current.getRowMode(rowId) === GridRowModes.Edit,
|
|
@@ -333,7 +335,7 @@ var GridRow = /*#__PURE__*/React.forwardRef(function GridRow(props, refProp) {
|
|
|
333
335
|
"data-id": rowId,
|
|
334
336
|
"data-rowindex": index,
|
|
335
337
|
role: "row",
|
|
336
|
-
className: clsx.apply(void 0, _toConsumableArray(rowClassNames).concat([classes.root, className])),
|
|
338
|
+
className: clsx.apply(void 0, _toConsumableArray(rowClassNames).concat([classes.root, className, hovered && 'Mui-hovered'])),
|
|
337
339
|
"aria-rowindex": ariaRowIndex,
|
|
338
340
|
"aria-selected": selected,
|
|
339
341
|
style: style
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
@@ -38,10 +37,6 @@ function GridBody(props) {
|
|
|
38
37
|
var columnVisibility = useGridSelector(apiRef, gridColumnVisibilityModelSelector);
|
|
39
38
|
var columnGroupsHeaderStructure = useGridSelector(apiRef, gridColumnGroupsHeaderStructureSelector);
|
|
40
39
|
var hasOtherElementInTabSequence = !(columnGroupHeaderTabIndexState === null && columnHeaderTabIndexState === null && cellTabIndexState === null);
|
|
41
|
-
var _React$useState = React.useState(rootProps.disableVirtualization),
|
|
42
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
43
|
-
isVirtualizationDisabled = _React$useState2[0],
|
|
44
|
-
setIsVirtualizationDisabled = _React$useState2[1];
|
|
45
40
|
useEnhancedEffect(function () {
|
|
46
41
|
apiRef.current.computeSizeAndPublishResizeEvent();
|
|
47
42
|
var elementToObserve = rootRef.current;
|
|
@@ -51,7 +46,7 @@ function GridBody(props) {
|
|
|
51
46
|
var animationFrame;
|
|
52
47
|
var observer = new ResizeObserver(function () {
|
|
53
48
|
// See https://github.com/mui/mui-x/issues/8733
|
|
54
|
-
animationFrame =
|
|
49
|
+
animationFrame = requestAnimationFrame(function () {
|
|
55
50
|
apiRef.current.computeSizeAndPublishResizeEvent();
|
|
56
51
|
});
|
|
57
52
|
});
|
|
@@ -67,24 +62,6 @@ function GridBody(props) {
|
|
|
67
62
|
}
|
|
68
63
|
};
|
|
69
64
|
}, [apiRef]);
|
|
70
|
-
var disableVirtualization = React.useCallback(function () {
|
|
71
|
-
setIsVirtualizationDisabled(true);
|
|
72
|
-
}, []);
|
|
73
|
-
var enableVirtualization = React.useCallback(function () {
|
|
74
|
-
setIsVirtualizationDisabled(false);
|
|
75
|
-
}, []);
|
|
76
|
-
React.useEffect(function () {
|
|
77
|
-
setIsVirtualizationDisabled(rootProps.disableVirtualization);
|
|
78
|
-
}, [rootProps.disableVirtualization]);
|
|
79
|
-
|
|
80
|
-
// The `useGridApiMethod` hook can't be used here, because it only installs the
|
|
81
|
-
// method if it doesn't exist yet. Once installed, it's never updated again.
|
|
82
|
-
// This break the methods above, since their closure comes from the first time
|
|
83
|
-
// they were installed. Which means that calling `setIsVirtualizationDisabled`
|
|
84
|
-
// will trigger a re-render, but it won't update the state. That can be solved
|
|
85
|
-
// by migrating the virtualization status to the global state.
|
|
86
|
-
apiRef.current.unstable_disableVirtualization = disableVirtualization;
|
|
87
|
-
apiRef.current.unstable_enableVirtualization = enableVirtualization;
|
|
88
65
|
var columnHeadersRef = React.useRef(null);
|
|
89
66
|
var columnsContainerRef = React.useRef(null);
|
|
90
67
|
var virtualScrollerRef = React.useRef(null);
|
|
@@ -121,8 +98,7 @@ function GridBody(props) {
|
|
|
121
98
|
// If this event is published while dimensions haven't been computed,
|
|
122
99
|
// the `onFetchRows` prop won't be called during mount.
|
|
123
100
|
, {
|
|
124
|
-
ref: virtualScrollerRef
|
|
125
|
-
disableVirtualization: isVirtualizationDisabled
|
|
101
|
+
ref: virtualScrollerRef
|
|
126
102
|
}), children]
|
|
127
103
|
});
|
|
128
104
|
}
|
|
@@ -196,11 +196,11 @@ function GridActionsCell(props) {
|
|
|
196
196
|
fontSize: "small"
|
|
197
197
|
})
|
|
198
198
|
})), menuButtons.length > 0 && /*#__PURE__*/_jsx(GridMenu, {
|
|
199
|
-
onClickAway: hideMenu,
|
|
200
|
-
onClick: hideMenu,
|
|
201
199
|
open: open,
|
|
202
200
|
target: buttonRef.current,
|
|
203
201
|
position: position,
|
|
202
|
+
onClose: hideMenu,
|
|
203
|
+
onClick: hideMenu,
|
|
204
204
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
205
205
|
id: menuId,
|
|
206
206
|
className: gridClasses.menuList,
|
|
@@ -233,7 +233,8 @@ var GridCell = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
233
233
|
return {
|
|
234
234
|
padding: 0,
|
|
235
235
|
opacity: 0,
|
|
236
|
-
width: 0
|
|
236
|
+
width: 0,
|
|
237
|
+
border: 0
|
|
237
238
|
};
|
|
238
239
|
}
|
|
239
240
|
var cellStyle = {
|
|
@@ -503,7 +504,8 @@ var GridCellV7 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
503
504
|
return {
|
|
504
505
|
padding: 0,
|
|
505
506
|
opacity: 0,
|
|
506
|
-
width: 0
|
|
507
|
+
width: 0,
|
|
508
|
+
border: 0
|
|
507
509
|
};
|
|
508
510
|
}
|
|
509
511
|
var cellStyle = {
|
|
@@ -104,7 +104,8 @@ function GridColumnHeaderItem(props) {
|
|
|
104
104
|
}, [isDraggable, publish]);
|
|
105
105
|
var columnHeaderSeparatorProps = React.useMemo(function () {
|
|
106
106
|
return {
|
|
107
|
-
onMouseDown: publish('columnSeparatorMouseDown')
|
|
107
|
+
onMouseDown: publish('columnSeparatorMouseDown'),
|
|
108
|
+
onDoubleClick: publish('columnSeparatorDoubleClick')
|
|
108
109
|
};
|
|
109
110
|
}, [publish]);
|
|
110
111
|
React.useEffect(function () {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
|
-
var _excluded = ["open", "target", "
|
|
4
|
+
var _excluded = ["open", "target", "onClose", "children", "position", "className", "onExited"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
9
|
-
import { unstable_composeClasses as composeClasses, HTMLElementType } from '@mui/utils';
|
|
9
|
+
import { unstable_composeClasses as composeClasses, unstable_useEnhancedEffect as useEnhancedEffect, HTMLElementType } from '@mui/utils';
|
|
10
10
|
import Grow from '@mui/material/Grow';
|
|
11
11
|
import Paper from '@mui/material/Paper';
|
|
12
12
|
import Popper from '@mui/material/Popper';
|
|
@@ -44,7 +44,7 @@ function GridMenu(props) {
|
|
|
44
44
|
var _rootProps$slotProps;
|
|
45
45
|
var open = props.open,
|
|
46
46
|
target = props.target,
|
|
47
|
-
|
|
47
|
+
onClose = props.onClose,
|
|
48
48
|
_children = props.children,
|
|
49
49
|
position = props.position,
|
|
50
50
|
className = props.className,
|
|
@@ -53,6 +53,16 @@ function GridMenu(props) {
|
|
|
53
53
|
var apiRef = useGridApiContext();
|
|
54
54
|
var rootProps = useGridRootProps();
|
|
55
55
|
var classes = useUtilityClasses(rootProps);
|
|
56
|
+
var savedFocusRef = React.useRef(null);
|
|
57
|
+
useEnhancedEffect(function () {
|
|
58
|
+
if (open) {
|
|
59
|
+
savedFocusRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
60
|
+
} else {
|
|
61
|
+
var _savedFocusRef$curren, _savedFocusRef$curren2;
|
|
62
|
+
(_savedFocusRef$curren = savedFocusRef.current) == null || (_savedFocusRef$curren2 = _savedFocusRef$curren.focus) == null || _savedFocusRef$curren2.call(_savedFocusRef$curren);
|
|
63
|
+
savedFocusRef.current = null;
|
|
64
|
+
}
|
|
65
|
+
}, [open]);
|
|
56
66
|
React.useEffect(function () {
|
|
57
67
|
// Emit menuOpen or menuClose events
|
|
58
68
|
var eventName = open ? 'menuOpen' : 'menuClose';
|
|
@@ -70,6 +80,12 @@ function GridMenu(props) {
|
|
|
70
80
|
}
|
|
71
81
|
};
|
|
72
82
|
};
|
|
83
|
+
var handleClickAway = function handleClickAway(event) {
|
|
84
|
+
if (event.target && (target === event.target || target != null && target.contains(event.target))) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
onClose(event);
|
|
88
|
+
};
|
|
73
89
|
return /*#__PURE__*/_jsx(GridMenuRoot, _extends({
|
|
74
90
|
as: rootProps.slots.basePopper,
|
|
75
91
|
className: clsx(className, classes.root),
|
|
@@ -83,7 +99,7 @@ function GridMenu(props) {
|
|
|
83
99
|
var TransitionProps = _ref3.TransitionProps,
|
|
84
100
|
placement = _ref3.placement;
|
|
85
101
|
return /*#__PURE__*/_jsx(ClickAwayListener, {
|
|
86
|
-
onClickAway:
|
|
102
|
+
onClickAway: handleClickAway,
|
|
87
103
|
mouseEvent: "onMouseDown",
|
|
88
104
|
children: /*#__PURE__*/_jsx(Grow, _extends({}, TransitionProps, {
|
|
89
105
|
style: {
|
|
@@ -104,7 +120,7 @@ process.env.NODE_ENV !== "production" ? GridMenu.propTypes = {
|
|
|
104
120
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
105
121
|
// ----------------------------------------------------------------------
|
|
106
122
|
children: PropTypes.node,
|
|
107
|
-
|
|
123
|
+
onClose: PropTypes.func.isRequired,
|
|
108
124
|
onExited: PropTypes.func,
|
|
109
125
|
/**
|
|
110
126
|
* If `true`, the component is shown.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import { HTMLElementType } from '@mui/utils';
|
|
4
|
+
import { unstable_useEventCallback as useEventCallback, HTMLElementType } from '@mui/utils';
|
|
5
5
|
import { useGridApiContext } from '../../../hooks/utils/useGridApiContext';
|
|
6
6
|
import { GridMenu } from '../GridMenu';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -16,13 +16,16 @@ function GridColumnHeaderMenu(_ref) {
|
|
|
16
16
|
onExited = _ref.onExited;
|
|
17
17
|
var apiRef = useGridApiContext();
|
|
18
18
|
var colDef = apiRef.current.getColumn(field);
|
|
19
|
-
var hideMenu =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
var hideMenu = useEventCallback(function (event) {
|
|
20
|
+
if (event) {
|
|
21
|
+
// Prevent triggering the sorting
|
|
22
|
+
event.stopPropagation();
|
|
23
|
+
if (target != null && target.contains(event.target)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
apiRef.current.hideColumnMenu();
|
|
28
|
+
});
|
|
26
29
|
if (!target || !colDef) {
|
|
27
30
|
return null;
|
|
28
31
|
}
|
|
@@ -30,7 +33,7 @@ function GridColumnHeaderMenu(_ref) {
|
|
|
30
33
|
placement: "bottom-".concat(colDef.align === 'right' ? 'start' : 'end'),
|
|
31
34
|
open: open,
|
|
32
35
|
target: target,
|
|
33
|
-
|
|
36
|
+
onClose: hideMenu,
|
|
34
37
|
onExited: onExited,
|
|
35
38
|
children: /*#__PURE__*/_jsx(ContentComponent, _extends({
|
|
36
39
|
colDef: colDef,
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
-
var _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "isFilterActive", "clearButton", "tabIndex", "label"];
|
|
5
|
+
var _excluded = ["item", "applyValue", "apiRef", "focusElementRef", "isFilterActive", "clearButton", "tabIndex", "label", "InputLabelProps"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { refType, unstable_useId as useId } from '@mui/utils';
|
|
@@ -27,6 +27,7 @@ function GridFilterInputBoolean(props) {
|
|
|
27
27
|
clearButton = props.clearButton,
|
|
28
28
|
tabIndex = props.tabIndex,
|
|
29
29
|
labelProp = props.label,
|
|
30
|
+
InputLabelProps = props.InputLabelProps,
|
|
30
31
|
others = _objectWithoutProperties(props, _excluded);
|
|
31
32
|
var _React$useState = React.useState(item.value || ''),
|
|
32
33
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
5
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
6
|
-
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue", "placeholder", "tabIndex", "label", "isFilterActive", "clearButton"];
|
|
6
|
+
var _excluded = ["item", "applyValue", "type", "apiRef", "focusElementRef", "getOptionLabel", "getOptionValue", "placeholder", "tabIndex", "label", "isFilterActive", "clearButton", "InputLabelProps"];
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import { unstable_useId as useId } from '@mui/utils';
|
|
@@ -56,6 +56,7 @@ function GridFilterInputSingleSelect(props) {
|
|
|
56
56
|
labelProp = props.label,
|
|
57
57
|
isFilterActive = props.isFilterActive,
|
|
58
58
|
clearButton = props.clearButton,
|
|
59
|
+
InputLabelProps = props.InputLabelProps,
|
|
59
60
|
others = _objectWithoutProperties(props, _excluded);
|
|
60
61
|
var _React$useState = React.useState((_item$value = item.value) != null ? _item$value : ''),
|
|
61
62
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -60,12 +60,7 @@ export var GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function G
|
|
|
60
60
|
});
|
|
61
61
|
onClick == null || onClick(event);
|
|
62
62
|
};
|
|
63
|
-
var
|
|
64
|
-
var _buttonRef$current;
|
|
65
|
-
if (buttonRef.current === event.target || // if user clicked on the icon
|
|
66
|
-
(_buttonRef$current = buttonRef.current) != null && _buttonRef$current.contains(event.target)) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
63
|
+
var handleDensitySelectorClose = function handleDensitySelectorClose() {
|
|
69
64
|
setOpen(false);
|
|
70
65
|
};
|
|
71
66
|
var handleDensityUpdate = function handleDensityUpdate(newDensity) {
|
|
@@ -113,7 +108,7 @@ export var GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function G
|
|
|
113
108
|
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
114
109
|
open: open,
|
|
115
110
|
target: buttonRef.current,
|
|
116
|
-
|
|
111
|
+
onClose: handleDensitySelectorClose,
|
|
117
112
|
position: "bottom-start",
|
|
118
113
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
119
114
|
id: densityMenuId,
|
|
@@ -44,14 +44,6 @@ export var GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function G
|
|
|
44
44
|
handleMenuClose();
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
var handleMenuClickAway = function handleMenuClickAway(event) {
|
|
48
|
-
var _buttonRef$current;
|
|
49
|
-
if (buttonRef.current === event.target || // if user clicked on the icon
|
|
50
|
-
(_buttonRef$current = buttonRef.current) != null && _buttonRef$current.contains(event.target)) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
setOpen(false);
|
|
54
|
-
};
|
|
55
47
|
if (children == null) {
|
|
56
48
|
return null;
|
|
57
49
|
}
|
|
@@ -72,7 +64,7 @@ export var GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function G
|
|
|
72
64
|
})), /*#__PURE__*/_jsx(GridMenu, {
|
|
73
65
|
open: open,
|
|
74
66
|
target: buttonRef.current,
|
|
75
|
-
|
|
67
|
+
onClose: handleMenuClose,
|
|
76
68
|
position: "bottom-start",
|
|
77
69
|
children: /*#__PURE__*/_jsx(MenuList, {
|
|
78
70
|
id: exportMenuId,
|
|
@@ -3,8 +3,9 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import * as ReactDOM from 'react-dom';
|
|
5
5
|
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
6
|
-
import { styled, useTheme } from '@mui/
|
|
6
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
7
7
|
import { defaultMemoize } from 'reselect';
|
|
8
|
+
import { useGridSelector } from '../../utils';
|
|
8
9
|
import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
|
|
9
10
|
import { useGridRootProps } from '../../utils/useGridRootProps';
|
|
10
11
|
import { useGridApiEventHandler } from '../../utils/useGridApiEventHandler';
|
|
@@ -12,6 +13,7 @@ import { GridColumnHeaderItem } from '../../../components/columnHeaders/GridColu
|
|
|
12
13
|
import { getFirstColumnIndexToRender, getTotalHeaderHeight } from '../columns/gridColumnsUtils';
|
|
13
14
|
import { useGridVisibleRows } from '../../utils/useGridVisibleRows';
|
|
14
15
|
import { areRenderContextsEqual, getRenderableIndexes } from '../virtualization/useGridVirtualScroller';
|
|
16
|
+
import { gridVirtualizationColumnEnabledSelector } from '../virtualization';
|
|
15
17
|
import { GridColumnGroupHeader } from '../../../components/columnHeaders/GridColumnGroupHeader';
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
var GridColumnHeaderRow = styled('div', {
|
|
@@ -56,6 +58,7 @@ export var useGridColumnHeaders = function useGridColumnHeaders(props) {
|
|
|
56
58
|
resizeCol = _React$useState4[0],
|
|
57
59
|
setResizeCol = _React$useState4[1];
|
|
58
60
|
var apiRef = useGridPrivateApiContext();
|
|
61
|
+
var hasVirtualization = useGridSelector(apiRef, gridVirtualizationColumnEnabledSelector);
|
|
59
62
|
var rootProps = useGridRootProps();
|
|
60
63
|
var innerRef = React.useRef(null);
|
|
61
64
|
var handleInnerRef = useForkRef(innerRefProp, innerRef);
|
|
@@ -197,7 +200,7 @@ export var useGridColumnHeaders = function useGridColumnHeaders(props) {
|
|
|
197
200
|
_getRenderableIndexes4 = _slicedToArray(_getRenderableIndexes3, 2),
|
|
198
201
|
firstRowToRender = _getRenderableIndexes4[0],
|
|
199
202
|
lastRowToRender = _getRenderableIndexes4[1];
|
|
200
|
-
var firstColumnToRender = getFirstColumnIndexToRenderRef.current({
|
|
203
|
+
var firstColumnToRender = !hasVirtualization ? 0 : getFirstColumnIndexToRenderRef.current({
|
|
201
204
|
firstColumnIndex: nextRenderContext.firstColumnIndex,
|
|
202
205
|
minColumnIndex: minFirstColumn,
|
|
203
206
|
columnBuffer: rootProps.columnBuffer,
|
|
@@ -206,7 +209,7 @@ export var useGridColumnHeaders = function useGridColumnHeaders(props) {
|
|
|
206
209
|
lastRowToRender: lastRowToRender,
|
|
207
210
|
visibleRows: currentPage.rows
|
|
208
211
|
});
|
|
209
|
-
var lastColumnToRender = Math.min(nextRenderContext.lastColumnIndex + rootProps.columnBuffer, maxLastColumn);
|
|
212
|
+
var lastColumnToRender = !hasVirtualization ? maxLastColumn : Math.min(nextRenderContext.lastColumnIndex + rootProps.columnBuffer, maxLastColumn);
|
|
210
213
|
var renderedColumns = visibleColumns.slice(firstColumnToRender, lastColumnToRender);
|
|
211
214
|
return {
|
|
212
215
|
renderedColumns: renderedColumns,
|