@mui/x-data-grid 8.10.0 → 8.10.1
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 +96 -0
- package/components/GridRow.js +5 -5
- package/components/virtualization/GridVirtualScroller.js +3 -3
- package/esm/DataGrid/index.js +1 -1
- package/esm/components/GridRow.js +5 -5
- package/esm/components/virtualization/GridVirtualScroller.js +3 -3
- package/esm/hooks/core/useGridVirtualizer.js +64 -44
- package/esm/hooks/features/dataSource/cache.js +0 -3
- package/esm/hooks/features/dataSource/gridDataSourceError.js +16 -16
- package/esm/hooks/features/dataSource/utils.js +51 -52
- package/esm/hooks/features/dimensions/gridDimensionsApi.d.ts +2 -67
- package/esm/hooks/features/dimensions/useGridDimensions.js +20 -15
- package/esm/hooks/features/export/serializers/csvSerializer.js +2 -3
- package/esm/hooks/features/export/useGridPrintExport.js +3 -8
- package/esm/index.js +1 -1
- package/esm/internals/utils/cache.js +0 -1
- package/esm/models/api/gridApiCommon.d.ts +1 -1
- package/esm/models/gridRowSelectionManager.js +0 -2
- package/esm/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +5 -7
- package/esm/utils/cleanupTracking/TimerBasedCleanupTracking.js +2 -2
- package/hooks/core/useGridVirtualizer.js +62 -42
- package/hooks/features/dataSource/cache.js +0 -3
- package/hooks/features/dataSource/gridDataSourceError.js +16 -16
- package/hooks/features/dataSource/utils.js +51 -52
- package/hooks/features/dimensions/gridDimensionsApi.d.ts +2 -67
- package/hooks/features/dimensions/useGridDimensions.js +20 -15
- package/hooks/features/export/serializers/csvSerializer.js +2 -3
- package/hooks/features/export/useGridPrintExport.js +3 -8
- package/index.js +1 -1
- package/internals/utils/cache.js +0 -1
- package/models/api/gridApiCommon.d.ts +1 -1
- package/models/gridRowSelectionManager.js +0 -2
- package/package.json +15 -16
- package/utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking.js +5 -7
- package/utils/cleanupTracking/TimerBasedCleanupTracking.js +2 -2
|
@@ -11,7 +11,6 @@ exports.useGridDimensions = useGridDimensions;
|
|
|
11
11
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _store = require("@mui/x-internals/store");
|
|
14
|
-
var _xVirtualizer = require("@mui/x-virtualizer");
|
|
15
14
|
var _useGridEvent = require("../../utils/useGridEvent");
|
|
16
15
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
17
16
|
var _createSelector = require("../../../utils/createSelector");
|
|
@@ -66,8 +65,6 @@ const columnsTotalWidthSelector = (0, _createSelector.createSelector)(_columns.g
|
|
|
66
65
|
return (0, _roundToDecimalPlaces.roundToDecimalPlaces)(positions[colCount - 1] + visibleColumns[colCount - 1].computedWidth, 1);
|
|
67
66
|
});
|
|
68
67
|
function useGridDimensions(apiRef, props) {
|
|
69
|
-
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useResizeContainer');
|
|
70
|
-
const errorShown = React.useRef(false);
|
|
71
68
|
const virtualizer = apiRef.current.virtualizer;
|
|
72
69
|
const updateDimensions = virtualizer.api.updateDimensions;
|
|
73
70
|
const getViewportPageSize = virtualizer.api.getViewportPageSize;
|
|
@@ -84,20 +81,28 @@ function useGridDimensions(apiRef, props) {
|
|
|
84
81
|
const handleRootMount = root => {
|
|
85
82
|
setCSSVariables(root, (0, _gridDimensionsSelectors.gridDimensionsSelector)(apiRef));
|
|
86
83
|
};
|
|
87
|
-
const handleResize = size => {
|
|
88
|
-
if (size.height === 0 && !errorShown.current && !props.autoHeight && !_isJSDOM.isJSDOM) {
|
|
89
|
-
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'));
|
|
90
|
-
errorShown.current = true;
|
|
91
|
-
}
|
|
92
|
-
if (size.width === 0 && !errorShown.current && !_isJSDOM.isJSDOM) {
|
|
93
|
-
logger.error(['The parent DOM element of the Data Grid has an empty width.', 'Please make sure that this element has an intrinsic width.', 'The grid displays with a width of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
|
|
94
|
-
errorShown.current = true;
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
84
|
(0, _useGridEvent.useGridEventPriority)(apiRef, 'rootMount', handleRootMount);
|
|
98
|
-
(0, _useGridEvent.useGridEventPriority)(apiRef, 'resize', handleResize);
|
|
99
85
|
(0, _useGridEvent.useGridEventPriority)(apiRef, 'debouncedResize', props.onResize);
|
|
100
|
-
|
|
86
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
87
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
88
|
+
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useResizeContainer');
|
|
89
|
+
const errorShown = React.useRef(false);
|
|
90
|
+
(0, _useGridEvent.useGridEventPriority)(apiRef, 'resize', size => {
|
|
91
|
+
if (!getRootDimensions().isReady) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (size.height === 0 && !errorShown.current && !props.autoHeight && !_isJSDOM.isJSDOM) {
|
|
95
|
+
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'));
|
|
96
|
+
errorShown.current = true;
|
|
97
|
+
}
|
|
98
|
+
if (size.width === 0 && !errorShown.current && !_isJSDOM.isJSDOM) {
|
|
99
|
+
logger.error(['The parent DOM element of the Data Grid has an empty width.', 'Please make sure that this element has an intrinsic width.', 'The grid displays with a width of 0px.', '', 'More details: https://mui.com/r/x-data-grid-no-dimensions.'].join('\n'));
|
|
100
|
+
errorShown.current = true;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
/* eslint-enable react-hooks/rules-of-hooks */
|
|
104
|
+
}
|
|
105
|
+
(0, _store.useStoreEffect)(apiRef.current.store, s => s.dimensions, (previous, next) => {
|
|
101
106
|
if (apiRef.current.rootElementRef.current) {
|
|
102
107
|
setCSSVariables(apiRef.current.rootElementRef.current, next);
|
|
103
108
|
}
|
|
@@ -52,10 +52,9 @@ const serializeCellValue = (cellParams, options) => {
|
|
|
52
52
|
};
|
|
53
53
|
exports.serializeCellValue = serializeCellValue;
|
|
54
54
|
class CSVRow {
|
|
55
|
+
rowString = '';
|
|
56
|
+
isEmpty = true;
|
|
55
57
|
constructor(options) {
|
|
56
|
-
this.options = void 0;
|
|
57
|
-
this.rowString = '';
|
|
58
|
-
this.isEmpty = true;
|
|
59
58
|
this.options = options;
|
|
60
59
|
}
|
|
61
60
|
addValue(value) {
|
|
@@ -114,11 +114,11 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
114
114
|
|
|
115
115
|
// See https://support.google.com/chrome/thread/191619088?hl=en&msgid=193009642
|
|
116
116
|
gridClone.style.contain = 'size';
|
|
117
|
-
let gridToolbarElementHeight = gridRootElement.querySelector(`.${_gridClasses.gridClasses.
|
|
117
|
+
let gridToolbarElementHeight = gridRootElement.querySelector(`.${_gridClasses.gridClasses.toolbar}`)?.offsetHeight || 0;
|
|
118
118
|
let gridFooterElementHeight = gridRootElement.querySelector(`.${_gridClasses.gridClasses.footerContainer}`)?.offsetHeight || 0;
|
|
119
119
|
const gridFooterElement = gridClone.querySelector(`.${_gridClasses.gridClasses.footerContainer}`);
|
|
120
120
|
if (normalizeOptions.hideToolbar) {
|
|
121
|
-
gridClone.querySelector(`.${_gridClasses.gridClasses.
|
|
121
|
+
gridClone.querySelector(`.${_gridClasses.gridClasses.toolbar}`)?.remove();
|
|
122
122
|
gridToolbarElementHeight = 0;
|
|
123
123
|
}
|
|
124
124
|
if (normalizeOptions.hideFooter && gridFooterElement) {
|
|
@@ -216,12 +216,7 @@ const useGridPrintExport = (apiRef, props) => {
|
|
|
216
216
|
}));
|
|
217
217
|
}
|
|
218
218
|
previousVirtualizationState.current = apiRef.current.state.virtualization;
|
|
219
|
-
apiRef.current.
|
|
220
|
-
virtualization: (0, _extends2.default)({}, state.virtualization, {
|
|
221
|
-
enabled: false,
|
|
222
|
-
enabledForColumns: false
|
|
223
|
-
})
|
|
224
|
-
}));
|
|
219
|
+
apiRef.current.unstable_setVirtualization(false);
|
|
225
220
|
await updateGridColumnsForPrint(options?.fields, options?.allColumns, options?.includeCheckboxes);
|
|
226
221
|
updateGridRowsForPrint(options?.getRowsToExport ?? _utils.defaultGetRowsToExport);
|
|
227
222
|
await raf(); // wait for the state changes to take action
|
package/index.js
CHANGED
package/internals/utils/cache.js
CHANGED
|
@@ -31,7 +31,7 @@ import type { GridHeaderFilteringApi, GridHeaderFilteringPrivateApi } from "./gr
|
|
|
31
31
|
import type { DataGridProcessedProps } from "../props/DataGridProps.js";
|
|
32
32
|
import type { GridColumnResizeApi } from "../../hooks/features/columnResize/index.js";
|
|
33
33
|
import type { GridPivotingPrivateApiCommunity } from "../../hooks/features/pivoting/gridPivotingInterfaces.js";
|
|
34
|
-
export interface GridApiCommon<GridState extends GridStateCommunity =
|
|
34
|
+
export interface GridApiCommon<GridState extends GridStateCommunity = GridStateCommunity, GridInitialState extends GridInitialStateCommunity = GridInitialStateCommunity> extends GridCoreApi, GridPipeProcessingApi, GridDensityApi, GridDimensionsApi, GridRowApi, GridRowsMetaApi, GridEditingApi, GridParamsApi, GridColumnApi, GridRowSelectionApi, GridSortApi, GridPaginationApi, GridCsvExportApi, GridFocusApi, GridFilterApi, GridColumnMenuApi, GridPreferencesPanelApi, GridPrintExportApi, GridVirtualizationApi, GridLocaleTextApi, GridScrollApi, GridColumnSpanningApi, GridStateApi<GridState>, GridStatePersistenceApi<GridInitialState>, GridColumnGroupingApi, GridHeaderFilteringApi, GridColumnResizeApi {}
|
|
35
35
|
export interface GridPrivateOnlyApiCommon<Api extends GridApiCommon, PrivateApi extends GridPrivateApiCommon, Props extends DataGridProcessedProps> extends GridCorePrivateApi<Api, PrivateApi, Props>, GridStatePrivateApi<PrivateApi['state']>, GridPipeProcessingPrivateApi, GridStrategyProcessingApi, GridColumnSpanningPrivateApi, GridRowsMetaPrivateApi, GridDimensionsPrivateApi, GridEditingPrivateApi, GridLoggerApi, GridFocusPrivateApi, GridHeaderFilteringPrivateApi, GridVirtualizationPrivateApi, GridRowProPrivateApi, GridParamsPrivateApi, GridPivotingPrivateApiCommunity {
|
|
36
36
|
virtualizer: Virtualizer;
|
|
37
37
|
}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.createRowSelectionManager = void 0;
|
|
7
7
|
class IncludeManager {
|
|
8
8
|
constructor(model) {
|
|
9
|
-
this.data = void 0;
|
|
10
9
|
this.data = model.ids;
|
|
11
10
|
}
|
|
12
11
|
has(id) {
|
|
@@ -21,7 +20,6 @@ class IncludeManager {
|
|
|
21
20
|
}
|
|
22
21
|
class ExcludeManager {
|
|
23
22
|
constructor(model) {
|
|
24
|
-
this.data = void 0;
|
|
25
23
|
this.data = model.ids;
|
|
26
24
|
}
|
|
27
25
|
has(id) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid",
|
|
3
|
-
"version": "8.10.
|
|
3
|
+
"version": "8.10.1",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Community plan edition of the MUI X Data Grid components.",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@babel/runtime": "^7.28.2",
|
|
42
|
-
"@mui/utils": "^7.
|
|
42
|
+
"@mui/utils": "^7.3.1",
|
|
43
43
|
"clsx": "^2.1.1",
|
|
44
44
|
"prop-types": "^15.8.1",
|
|
45
45
|
"use-sync-external-store": "^1.5.0",
|
|
46
46
|
"@mui/x-internals": "8.10.0",
|
|
47
|
-
"@mui/x-virtualizer": "0.1.
|
|
47
|
+
"@mui/x-virtualizer": "0.1.2"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@emotion/react": "^11.9.0",
|
|
@@ -65,31 +65,30 @@
|
|
|
65
65
|
"engines": {
|
|
66
66
|
"node": ">=14.0.0"
|
|
67
67
|
},
|
|
68
|
-
"
|
|
68
|
+
"type": "commonjs",
|
|
69
|
+
"types": "./index.d.ts",
|
|
69
70
|
"exports": {
|
|
70
71
|
"./package.json": "./package.json",
|
|
71
72
|
".": {
|
|
72
|
-
"require": {
|
|
73
|
-
"types": "./index.d.ts",
|
|
74
|
-
"default": "./index.js"
|
|
75
|
-
},
|
|
76
73
|
"import": {
|
|
77
74
|
"types": "./esm/index.d.ts",
|
|
78
75
|
"default": "./esm/index.js"
|
|
76
|
+
},
|
|
77
|
+
"require": {
|
|
78
|
+
"types": "./index.d.ts",
|
|
79
|
+
"default": "./index.js"
|
|
79
80
|
}
|
|
80
81
|
},
|
|
81
82
|
"./*": {
|
|
82
|
-
"require": {
|
|
83
|
-
"types": "./*/index.d.ts",
|
|
84
|
-
"default": "./*/index.js"
|
|
85
|
-
},
|
|
86
83
|
"import": {
|
|
87
84
|
"types": "./esm/*/index.d.ts",
|
|
88
85
|
"default": "./esm/*/index.js"
|
|
86
|
+
},
|
|
87
|
+
"require": {
|
|
88
|
+
"types": "./*/index.d.ts",
|
|
89
|
+
"default": "./*/index.js"
|
|
89
90
|
}
|
|
90
91
|
},
|
|
91
|
-
"./esm": null
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
"types": "./index.d.ts"
|
|
92
|
+
"./esm": null
|
|
93
|
+
}
|
|
95
94
|
}
|
|
@@ -5,13 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.FinalizationRegistryBasedCleanupTracking = void 0;
|
|
7
7
|
class FinalizationRegistryBasedCleanupTracking {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
}
|
|
8
|
+
registry = new FinalizationRegistry(unsubscribe => {
|
|
9
|
+
if (typeof unsubscribe === 'function') {
|
|
10
|
+
unsubscribe();
|
|
11
|
+
}
|
|
12
|
+
});
|
|
15
13
|
register(object, unsubscribe, unregisterToken) {
|
|
16
14
|
this.registry.register(object, unsubscribe, unregisterToken);
|
|
17
15
|
}
|
|
@@ -7,9 +7,9 @@ exports.TimerBasedCleanupTracking = void 0;
|
|
|
7
7
|
// If no effect ran after this amount of time, we assume that the render was not committed by React
|
|
8
8
|
const CLEANUP_TIMER_LOOP_MILLIS = 1000;
|
|
9
9
|
class TimerBasedCleanupTracking {
|
|
10
|
+
timeouts = new Map();
|
|
11
|
+
cleanupTimeout = CLEANUP_TIMER_LOOP_MILLIS;
|
|
10
12
|
constructor(timeout = CLEANUP_TIMER_LOOP_MILLIS) {
|
|
11
|
-
this.timeouts = new Map();
|
|
12
|
-
this.cleanupTimeout = CLEANUP_TIMER_LOOP_MILLIS;
|
|
13
13
|
this.cleanupTimeout = timeout;
|
|
14
14
|
}
|
|
15
15
|
register(object, unsubscribe, unregisterToken) {
|