@mui/x-data-grid 7.19.0 → 7.21.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 +224 -43
- package/DataGrid/DataGrid.js +8 -0
- package/DataGrid/index.d.ts +0 -1
- package/DataGrid/index.js +1 -2
- package/DataGrid/useDataGridComponent.js +4 -1
- package/DataGrid/useDataGridProps.d.ts +1 -5
- package/DataGrid/useDataGridProps.js +3 -62
- package/components/GridPagination.js +1 -0
- package/components/GridRow.js +25 -36
- package/components/base/GridOverlays.js +8 -0
- package/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/components/containers/GridRootStyles.js +1 -0
- package/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/components/toolbar/GridToolbarExport.d.ts +9 -3
- package/components/toolbar/GridToolbarExport.js +55 -3
- package/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/components/virtualization/GridVirtualScroller.js +2 -2
- package/constants/dataGridPropsDefaultValues.d.ts +5 -0
- package/constants/dataGridPropsDefaultValues.js +60 -0
- package/hooks/core/pipeProcessing/gridPipeProcessingApi.d.ts +2 -1
- package/hooks/core/useGridRefs.js +4 -0
- package/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/hooks/features/columns/gridColumnsUtils.d.ts +1 -1
- package/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/hooks/features/dimensions/useGridDimensions.js +6 -4
- package/hooks/features/editing/useGridCellEditing.js +3 -1
- package/hooks/features/editing/useGridRowEditing.js +3 -1
- package/hooks/features/events/useGridEvents.d.ts +1 -1
- package/hooks/features/events/useGridEvents.js +1 -0
- package/hooks/features/filter/gridFilterUtils.js +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.d.ts +1 -1
- package/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -5
- package/hooks/features/listView/gridListViewSelectors.d.ts +5 -0
- package/hooks/features/listView/gridListViewSelectors.js +4 -0
- package/hooks/features/listView/useGridListView.d.ts +10 -0
- package/hooks/features/listView/useGridListView.js +54 -0
- package/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/hooks/features/rowSelection/utils.js +6 -6
- package/hooks/features/rows/gridRowsMetaInterfaces.d.ts +16 -0
- package/hooks/features/rows/gridRowsMetaInterfaces.js +1 -0
- package/hooks/features/rows/gridRowsUtils.d.ts +3 -0
- package/hooks/features/rows/gridRowsUtils.js +15 -2
- package/hooks/features/rows/useGridParamsApi.d.ts +2 -1
- package/hooks/features/rows/useGridParamsApi.js +4 -3
- package/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/hooks/features/rows/useGridRowsMeta.js +135 -154
- package/hooks/features/scroll/useGridScroll.d.ts +1 -1
- package/hooks/features/scroll/useGridScroll.js +10 -5
- package/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +25 -11
- package/hooks/utils/useGridApiContext.js +1 -1
- package/hooks/utils/useGridApiEventHandler.d.ts +1 -1
- package/hooks/utils/useGridApiEventHandler.js +1 -1
- package/hooks/utils/useGridApiMethod.js +2 -1
- package/hooks/utils/useGridConfiguration.js +1 -1
- package/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/index.d.ts +3 -2
- package/index.js +4 -3
- package/internals/index.d.ts +2 -1
- package/internals/index.js +2 -1
- package/joy/icons.js +0 -1
- package/locales/jaJP.js +4 -4
- package/models/api/gridApiCommunity.d.ts +1 -1
- package/models/api/gridCoreApi.d.ts +9 -1
- package/models/api/gridFilterApi.d.ts +1 -1
- package/models/api/gridRowsMetaApi.d.ts +15 -14
- package/models/colDef/gridColDef.d.ts +6 -0
- package/models/colDef/index.d.ts +1 -1
- package/models/events/gridEventLookup.d.ts +7 -0
- package/models/gridApiCaches.d.ts +2 -0
- package/models/gridStateCommunity.d.ts +4 -2
- package/models/props/DataGridProps.d.ts +37 -17
- package/modern/DataGrid/DataGrid.js +8 -0
- package/modern/DataGrid/index.js +1 -2
- package/modern/DataGrid/useDataGridComponent.js +4 -1
- package/modern/DataGrid/useDataGridProps.js +3 -62
- package/modern/components/GridPagination.js +1 -0
- package/modern/components/GridRow.js +25 -36
- package/modern/components/base/GridOverlays.js +8 -0
- package/modern/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/modern/components/toolbar/GridToolbarExport.js +55 -3
- package/modern/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/modern/components/virtualization/GridVirtualScroller.js +2 -2
- package/modern/constants/dataGridPropsDefaultValues.js +60 -0
- package/modern/hooks/core/useGridRefs.js +4 -0
- package/modern/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/modern/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/modern/hooks/features/dimensions/useGridDimensions.js +6 -4
- package/modern/hooks/features/editing/useGridCellEditing.js +3 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +3 -1
- package/modern/hooks/features/events/useGridEvents.js +1 -0
- package/modern/hooks/features/filter/gridFilterUtils.js +1 -1
- package/modern/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -5
- package/modern/hooks/features/listView/gridListViewSelectors.js +4 -0
- package/modern/hooks/features/listView/useGridListView.js +54 -0
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/modern/hooks/features/rowSelection/utils.js +6 -6
- package/modern/hooks/features/rows/gridRowsMetaInterfaces.js +1 -0
- package/modern/hooks/features/rows/gridRowsUtils.js +15 -2
- package/modern/hooks/features/rows/useGridParamsApi.js +4 -3
- package/modern/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/modern/hooks/features/rows/useGridRowsMeta.js +135 -154
- package/modern/hooks/features/scroll/useGridScroll.js +10 -5
- package/modern/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +25 -11
- package/modern/hooks/utils/useGridApiContext.js +1 -1
- package/modern/hooks/utils/useGridApiEventHandler.js +1 -1
- package/modern/hooks/utils/useGridApiMethod.js +2 -1
- package/modern/hooks/utils/useGridConfiguration.js +1 -1
- package/modern/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/modern/index.js +4 -3
- package/modern/internals/index.js +2 -1
- package/modern/joy/icons.js +0 -1
- package/modern/locales/jaJP.js +4 -4
- package/modern/utils/ResizeObserver.js +10 -0
- package/modern/utils/domUtils.js +1 -1
- package/modern/utils/keyboardUtils.js +12 -4
- package/node/DataGrid/DataGrid.js +8 -0
- package/node/DataGrid/index.js +1 -12
- package/node/DataGrid/useDataGridComponent.js +4 -1
- package/node/DataGrid/useDataGridProps.js +6 -65
- package/node/components/GridPagination.js +1 -0
- package/node/components/GridRow.js +25 -36
- package/node/components/base/GridOverlays.js +8 -0
- package/node/components/columnHeaders/GridColumnHeaderItem.js +1 -0
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/menu/columnMenu/GridColumnMenu.js +32 -0
- package/node/components/toolbar/GridToolbarExport.js +52 -0
- package/node/components/virtualization/GridVirtualScrollbar.js +4 -0
- package/node/components/virtualization/GridVirtualScroller.js +2 -2
- package/node/constants/dataGridPropsDefaultValues.js +66 -0
- package/node/hooks/core/useGridRefs.js +4 -0
- package/node/hooks/features/clipboard/useGridClipboard.js +2 -1
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +3 -1
- package/node/hooks/features/columns/gridColumnsUtils.js +3 -0
- package/node/hooks/features/dimensions/useGridDimensions.js +5 -3
- package/node/hooks/features/editing/useGridCellEditing.js +3 -1
- package/node/hooks/features/editing/useGridRowEditing.js +3 -1
- package/node/hooks/features/events/useGridEvents.js +1 -0
- package/node/hooks/features/filter/gridFilterUtils.js +1 -1
- package/node/hooks/features/keyboardNavigation/useGridKeyboardNavigation.js +9 -5
- package/node/hooks/features/listView/gridListViewSelectors.js +11 -0
- package/node/hooks/features/listView/useGridListView.js +64 -0
- package/node/hooks/features/rowSelection/useGridRowSelection.js +11 -2
- package/node/hooks/features/rowSelection/utils.js +6 -6
- package/node/hooks/features/rows/gridRowsMetaInterfaces.js +5 -0
- package/node/hooks/features/rows/gridRowsUtils.js +17 -3
- package/node/hooks/features/rows/useGridParamsApi.js +4 -3
- package/node/hooks/features/rows/useGridRowSpanning.js +1 -1
- package/node/hooks/features/rows/useGridRowsMeta.js +136 -154
- package/node/hooks/features/scroll/useGridScroll.js +10 -5
- package/node/hooks/features/sorting/gridSortingUtils.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +25 -11
- package/node/hooks/utils/useGridApiContext.js +1 -1
- package/node/hooks/utils/useGridApiEventHandler.js +1 -1
- package/node/hooks/utils/useGridApiMethod.js +3 -1
- package/node/hooks/utils/useGridConfiguration.js +1 -1
- package/node/hooks/utils/useGridPrivateApiContext.js +1 -1
- package/node/index.js +13 -1
- package/node/internals/index.js +22 -0
- package/node/joy/icons.js +0 -1
- package/node/locales/jaJP.js +4 -4
- package/node/utils/ResizeObserver.js +16 -0
- package/node/utils/domUtils.js +1 -1
- package/node/utils/keyboardUtils.js +15 -5
- package/package.json +4 -4
- package/utils/ResizeObserver.d.ts +4 -0
- package/utils/ResizeObserver.js +10 -0
- package/utils/domUtils.js +1 -1
- package/utils/keyboardUtils.d.ts +1 -0
- package/utils/keyboardUtils.js +12 -4
|
@@ -8,8 +8,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useGridRowsMeta = exports.rowsMetaStateInitializer = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var
|
|
11
|
+
var _useLazyRef = _interopRequireDefault(require("@mui/utils/useLazyRef"));
|
|
12
|
+
var _ResizeObserver = require("../../../utils/ResizeObserver");
|
|
12
13
|
var _useGridVisibleRows = require("../../utils/useGridVisibleRows");
|
|
14
|
+
var _utils = require("../../../utils/utils");
|
|
13
15
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
14
16
|
var _useGridSelector = require("../../utils/useGridSelector");
|
|
15
17
|
var _densitySelector = require("../density/densitySelector");
|
|
@@ -18,139 +20,121 @@ var _gridPaginationSelector = require("../pagination/gridPaginationSelector");
|
|
|
18
20
|
var _gridSortingSelector = require("../sorting/gridSortingSelector");
|
|
19
21
|
var _pipeProcessing = require("../../core/pipeProcessing");
|
|
20
22
|
var _gridRowsSelector = require("./gridRowsSelector");
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
+
var _gridDimensionsSelectors = require("../dimensions/gridDimensionsSelectors");
|
|
24
|
+
var _gridRowsUtils = require("./gridRowsUtils");
|
|
25
|
+
/* eslint-disable no-underscore-dangle */
|
|
23
26
|
|
|
24
|
-
const rowsMetaStateInitializer = state
|
|
25
|
-
rowsMeta
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return rowHeightProp;
|
|
35
|
-
}
|
|
36
|
-
if (process.env.NODE_ENV !== 'production' && !warnedOnceInvalidRowHeight && typeof rowHeightProp !== 'undefined' && rowHeightProp !== null) {
|
|
37
|
-
console.warn(warningMessage);
|
|
38
|
-
warnedOnceInvalidRowHeight = true;
|
|
39
|
-
}
|
|
40
|
-
return defaultRowHeight;
|
|
27
|
+
const rowsMetaStateInitializer = (state, props, apiRef) => {
|
|
28
|
+
apiRef.current.caches.rowsMeta = {
|
|
29
|
+
heights: new Map()
|
|
30
|
+
};
|
|
31
|
+
return (0, _extends2.default)({}, state, {
|
|
32
|
+
rowsMeta: {
|
|
33
|
+
currentPageTotalHeight: 0,
|
|
34
|
+
positions: []
|
|
35
|
+
}
|
|
36
|
+
});
|
|
41
37
|
};
|
|
42
|
-
const rowHeightWarning = [`MUI X: The \`rowHeight\` prop should be a number greater than 0.`, `The default value will be used instead.`].join('\n');
|
|
43
|
-
const getRowHeightWarning = [`MUI X: The \`getRowHeight\` prop should return a number greater than 0 or 'auto'.`, `The default value will be used instead.`].join('\n');
|
|
44
38
|
|
|
45
39
|
/**
|
|
46
40
|
* @requires useGridPageSize (method)
|
|
47
41
|
* @requires useGridPage (method)
|
|
48
42
|
*/
|
|
43
|
+
exports.rowsMetaStateInitializer = rowsMetaStateInitializer;
|
|
49
44
|
const useGridRowsMeta = (apiRef, props) => {
|
|
50
45
|
const {
|
|
51
46
|
getRowHeight: getRowHeightProp,
|
|
52
47
|
getRowSpacing,
|
|
53
48
|
getEstimatedRowHeight
|
|
54
49
|
} = props;
|
|
55
|
-
const
|
|
56
|
-
|
|
57
|
-
// Inspired by https://github.com/bvaughn/react-virtualized/blob/master/source/Grid/utils/CellSizeAndPositionManager.js
|
|
50
|
+
const heightCache = apiRef.current.caches.rowsMeta.heights;
|
|
58
51
|
const lastMeasuredRowIndex = React.useRef(-1);
|
|
59
52
|
const hasRowWithAutoHeight = React.useRef(false);
|
|
53
|
+
const isHeightMetaValid = React.useRef(false);
|
|
60
54
|
const densityFactor = (0, _useGridSelector.useGridSelector)(apiRef, _densitySelector.gridDensityFactorSelector);
|
|
61
55
|
const filterModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridFilterSelector.gridFilterModelSelector);
|
|
62
56
|
const paginationState = (0, _useGridSelector.useGridSelector)(apiRef, _gridPaginationSelector.gridPaginationSelector);
|
|
63
57
|
const sortModel = (0, _useGridSelector.useGridSelector)(apiRef, _gridSortingSelector.gridSortModelSelector);
|
|
64
58
|
const currentPage = (0, _useGridVisibleRows.useGridVisibleRows)(apiRef, props);
|
|
65
59
|
const pinnedRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridPinnedRowsSelector);
|
|
66
|
-
const
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
60
|
+
const rowHeight = (0, _useGridSelector.useGridSelector)(apiRef, () => (0, _gridDimensionsSelectors.gridDimensionsSelector)(apiRef.current.state).rowHeight);
|
|
61
|
+
const getRowHeightEntry = rowId => {
|
|
62
|
+
let entry = heightCache.get(rowId);
|
|
63
|
+
if (entry === undefined) {
|
|
64
|
+
entry = {
|
|
65
|
+
content: rowHeight,
|
|
66
|
+
spacingTop: 0,
|
|
67
|
+
spacingBottom: 0,
|
|
68
|
+
detail: 0,
|
|
69
|
+
autoHeight: false,
|
|
70
|
+
needsFirstMeasurement: true
|
|
71
|
+
};
|
|
72
|
+
heightCache.set(rowId, entry);
|
|
73
|
+
}
|
|
74
|
+
return entry;
|
|
75
|
+
};
|
|
76
|
+
const processHeightEntry = React.useCallback(row => {
|
|
77
|
+
// HACK: rowHeight trails behind the most up-to-date value just enough to
|
|
78
|
+
// mess the initial rowsMeta hydration :/
|
|
79
|
+
const baseRowHeight = (0, _gridDimensionsSelectors.gridDimensionsSelector)(apiRef.current.state).rowHeight;
|
|
80
|
+
(0, _utils.eslintUseValue)(rowHeight);
|
|
81
|
+
const entry = apiRef.current.getRowHeightEntry(row.id);
|
|
82
|
+
if (!getRowHeightProp) {
|
|
83
|
+
entry.content = baseRowHeight;
|
|
84
|
+
entry.needsFirstMeasurement = false;
|
|
85
|
+
} else {
|
|
86
|
+
const rowHeightFromUser = getRowHeightProp((0, _extends2.default)({}, row, {
|
|
87
|
+
densityFactor
|
|
88
|
+
}));
|
|
89
|
+
if (rowHeightFromUser === 'auto') {
|
|
90
|
+
if (entry.needsFirstMeasurement) {
|
|
91
|
+
const estimatedRowHeight = getEstimatedRowHeight ? getEstimatedRowHeight((0, _extends2.default)({}, row, {
|
|
92
|
+
densityFactor
|
|
93
|
+
})) : baseRowHeight;
|
|
100
94
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
} else {
|
|
104
|
-
baseRowHeight = existingBaseRowHeight;
|
|
105
|
-
}
|
|
106
|
-
hasRowWithAutoHeight.current = true;
|
|
107
|
-
rowsHeightLookup.current[row.id].autoHeight = true;
|
|
108
|
-
} else {
|
|
109
|
-
// Default back to base rowHeight if getRowHeight returns invalid value.
|
|
110
|
-
baseRowHeight = getValidRowHeight(rowHeightFromUser, rowHeight, getRowHeightWarning);
|
|
111
|
-
rowsHeightLookup.current[row.id].needsFirstMeasurement = false;
|
|
112
|
-
rowsHeightLookup.current[row.id].autoHeight = false;
|
|
95
|
+
// If the row was not measured yet use the estimated row height
|
|
96
|
+
entry.content = estimatedRowHeight ?? baseRowHeight;
|
|
113
97
|
}
|
|
98
|
+
hasRowWithAutoHeight.current = true;
|
|
99
|
+
entry.autoHeight = true;
|
|
114
100
|
} else {
|
|
115
|
-
|
|
101
|
+
// Default back to base rowHeight if getRowHeight returns invalid value.
|
|
102
|
+
entry.content = (0, _gridRowsUtils.getValidRowHeight)(rowHeightFromUser, baseRowHeight, _gridRowsUtils.getRowHeightWarning);
|
|
103
|
+
entry.needsFirstMeasurement = false;
|
|
104
|
+
entry.autoHeight = false;
|
|
116
105
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
106
|
+
}
|
|
107
|
+
if (getRowSpacing) {
|
|
108
|
+
const indexRelativeToCurrentPage = apiRef.current.getRowIndexRelativeToVisibleRows(row.id);
|
|
109
|
+
const spacing = getRowSpacing((0, _extends2.default)({}, row, {
|
|
110
|
+
isFirstVisible: indexRelativeToCurrentPage === 0,
|
|
111
|
+
isLastVisible: indexRelativeToCurrentPage === currentPage.rows.length - 1,
|
|
112
|
+
indexRelativeToCurrentPage
|
|
113
|
+
}));
|
|
114
|
+
entry.spacingTop = spacing.top ?? 0;
|
|
115
|
+
entry.spacingBottom = spacing.bottom ?? 0;
|
|
116
|
+
} else {
|
|
117
|
+
entry.spacingTop = 0;
|
|
118
|
+
entry.spacingBottom = 0;
|
|
119
|
+
}
|
|
120
|
+
apiRef.current.unstable_applyPipeProcessors('rowHeight', entry, row);
|
|
121
|
+
return entry;
|
|
122
|
+
}, [apiRef, currentPage.rows.length, getRowHeightProp, getEstimatedRowHeight, rowHeight, getRowSpacing, densityFactor]);
|
|
123
|
+
const hydrateRowsMeta = React.useCallback(() => {
|
|
124
|
+
hasRowWithAutoHeight.current = false;
|
|
125
|
+
pinnedRows.top.forEach(processHeightEntry);
|
|
126
|
+
pinnedRows.bottom.forEach(processHeightEntry);
|
|
134
127
|
const positions = [];
|
|
135
128
|
const currentPageTotalHeight = currentPage.rows.reduce((acc, row) => {
|
|
136
129
|
positions.push(acc);
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
for (const key in processedSizes) {
|
|
141
|
-
const value = processedSizes[key];
|
|
142
|
-
if (key !== 'baseCenter') {
|
|
143
|
-
otherSizes += value;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return acc + processedSizes.baseCenter + otherSizes;
|
|
130
|
+
const entry = processHeightEntry(row);
|
|
131
|
+
const total = entry.content + entry.spacingTop + entry.spacingBottom + entry.detail;
|
|
132
|
+
return acc + total;
|
|
147
133
|
}, 0);
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
calculateRowProcessedSizes(row);
|
|
153
|
-
});
|
|
134
|
+
if (!hasRowWithAutoHeight.current) {
|
|
135
|
+
// No row has height=auto, so all rows are already measured
|
|
136
|
+
lastMeasuredRowIndex.current = Infinity;
|
|
137
|
+
}
|
|
154
138
|
apiRef.current.setState(state => {
|
|
155
139
|
return (0, _extends2.default)({}, state, {
|
|
156
140
|
rowsMeta: {
|
|
@@ -159,70 +143,68 @@ const useGridRowsMeta = (apiRef, props) => {
|
|
|
159
143
|
}
|
|
160
144
|
});
|
|
161
145
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}, [hydrateRowsMeta]);
|
|
179
|
-
const debouncedHydrateRowsMeta = React.useMemo(() => (0, _utils.unstable_debounce)(hydrateRowsMeta, props.rowPositionsDebounceMs), [hydrateRowsMeta, props.rowPositionsDebounceMs]);
|
|
180
|
-
const storeMeasuredRowHeight = React.useCallback((id, height) => {
|
|
181
|
-
if (!rowsHeightLookup.current[id] || !rowsHeightLookup.current[id].autoHeight) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Only trigger hydration if the value is different, otherwise we trigger a loop
|
|
186
|
-
const needsHydration = rowsHeightLookup.current[id].sizes.baseCenter !== height;
|
|
187
|
-
rowsHeightLookup.current[id].needsFirstMeasurement = false;
|
|
188
|
-
rowsHeightLookup.current[id].sizes.baseCenter = height;
|
|
189
|
-
if (needsHydration) {
|
|
190
|
-
debouncedHydrateRowsMeta();
|
|
191
|
-
}
|
|
192
|
-
}, [debouncedHydrateRowsMeta]);
|
|
193
|
-
const rowHasAutoHeight = React.useCallback(id => {
|
|
194
|
-
return rowsHeightLookup.current[id]?.autoHeight || false;
|
|
195
|
-
}, []);
|
|
196
|
-
const getLastMeasuredRowIndex = React.useCallback(() => {
|
|
146
|
+
isHeightMetaValid.current = true;
|
|
147
|
+
}, [apiRef, pinnedRows, currentPage.rows, processHeightEntry]);
|
|
148
|
+
const getRowHeight = rowId => {
|
|
149
|
+
return heightCache.get(rowId)?.content ?? rowHeight;
|
|
150
|
+
};
|
|
151
|
+
const storeRowHeightMeasurement = (id, height) => {
|
|
152
|
+
const entry = apiRef.current.getRowHeightEntry(id);
|
|
153
|
+
const didChange = entry.content !== height;
|
|
154
|
+
entry.needsFirstMeasurement = false;
|
|
155
|
+
entry.content = height;
|
|
156
|
+
isHeightMetaValid.current && (isHeightMetaValid.current = !didChange);
|
|
157
|
+
};
|
|
158
|
+
const rowHasAutoHeight = id => {
|
|
159
|
+
return heightCache.get(id)?.autoHeight ?? false;
|
|
160
|
+
};
|
|
161
|
+
const getLastMeasuredRowIndex = () => {
|
|
197
162
|
return lastMeasuredRowIndex.current;
|
|
198
|
-
}
|
|
199
|
-
const setLastMeasuredRowIndex =
|
|
163
|
+
};
|
|
164
|
+
const setLastMeasuredRowIndex = index => {
|
|
200
165
|
if (hasRowWithAutoHeight.current && index > lastMeasuredRowIndex.current) {
|
|
201
166
|
lastMeasuredRowIndex.current = index;
|
|
202
167
|
}
|
|
203
|
-
}
|
|
204
|
-
const resetRowHeights =
|
|
205
|
-
|
|
168
|
+
};
|
|
169
|
+
const resetRowHeights = () => {
|
|
170
|
+
heightCache.clear();
|
|
206
171
|
hydrateRowsMeta();
|
|
207
|
-
}
|
|
172
|
+
};
|
|
173
|
+
const resizeObserver = (0, _useLazyRef.default)(() => new _ResizeObserver.ResizeObserver(entries => {
|
|
174
|
+
for (let i = 0; i < entries.length; i += 1) {
|
|
175
|
+
const entry = entries[i];
|
|
176
|
+
const height = entry.borderBoxSize && entry.borderBoxSize.length > 0 ? entry.borderBoxSize[0].blockSize : entry.contentRect.height;
|
|
177
|
+
const rowId = entry.target.__mui_id;
|
|
178
|
+
apiRef.current.unstable_storeRowHeightMeasurement(rowId, height);
|
|
179
|
+
}
|
|
180
|
+
if (!isHeightMetaValid.current) {
|
|
181
|
+
apiRef.current.requestPipeProcessorsApplication('rowHeight');
|
|
182
|
+
}
|
|
183
|
+
})).current;
|
|
184
|
+
const observeRowHeight = (element, rowId) => {
|
|
185
|
+
element.__mui_id = rowId;
|
|
186
|
+
resizeObserver.observe(element);
|
|
187
|
+
return () => resizeObserver.unobserve(element);
|
|
188
|
+
};
|
|
189
|
+
(0, _pipeProcessing.useGridRegisterPipeApplier)(apiRef, 'rowHeight', hydrateRowsMeta);
|
|
208
190
|
|
|
209
191
|
// The effect is used to build the rows meta data - currentPageTotalHeight and positions.
|
|
210
192
|
// Because of variable row height this is needed for the virtualization
|
|
211
193
|
React.useEffect(() => {
|
|
212
194
|
hydrateRowsMeta();
|
|
213
|
-
}, [
|
|
214
|
-
(0, _pipeProcessing.useGridRegisterPipeApplier)(apiRef, 'rowHeight', hydrateRowsMeta);
|
|
195
|
+
}, [filterModel, paginationState, sortModel, hydrateRowsMeta]);
|
|
215
196
|
const rowsMetaApi = {
|
|
216
|
-
unstable_setLastMeasuredRowIndex: setLastMeasuredRowIndex,
|
|
217
197
|
unstable_getRowHeight: getRowHeight,
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
unstable_storeRowHeightMeasurement: storeMeasuredRowHeight,
|
|
198
|
+
unstable_setLastMeasuredRowIndex: setLastMeasuredRowIndex,
|
|
199
|
+
unstable_storeRowHeightMeasurement: storeRowHeightMeasurement,
|
|
221
200
|
resetRowHeights
|
|
222
201
|
};
|
|
223
202
|
const rowsMetaPrivateApi = {
|
|
224
|
-
|
|
225
|
-
|
|
203
|
+
hydrateRowsMeta,
|
|
204
|
+
observeRowHeight,
|
|
205
|
+
rowHasAutoHeight,
|
|
206
|
+
getRowHeightEntry,
|
|
207
|
+
getLastMeasuredRowIndex
|
|
226
208
|
};
|
|
227
209
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, rowsMetaApi, 'public');
|
|
228
210
|
(0, _useGridApiMethod.useGridApiMethod)(apiRef, rowsMetaPrivateApi, 'private');
|
|
@@ -16,6 +16,7 @@ var _gridRowsMetaSelector = require("../rows/gridRowsMetaSelector");
|
|
|
16
16
|
var _useGridApiMethod = require("../../utils/useGridApiMethod");
|
|
17
17
|
var _gridFilterSelector = require("../filter/gridFilterSelector");
|
|
18
18
|
var _dimensions = require("../dimensions");
|
|
19
|
+
var _gridListViewSelectors = require("../listView/gridListViewSelectors");
|
|
19
20
|
// Logic copied from https://www.w3.org/TR/wai-aria-practices/examples/listbox/js/listbox.js
|
|
20
21
|
// Similar to https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
21
22
|
function scrollIntoView(dimensions) {
|
|
@@ -53,11 +54,13 @@ const useGridScroll = (apiRef, props) => {
|
|
|
53
54
|
const logger = (0, _useGridLogger.useGridLogger)(apiRef, 'useGridScroll');
|
|
54
55
|
const colRef = apiRef.current.columnHeadersContainerRef;
|
|
55
56
|
const virtualScrollerRef = apiRef.current.virtualScrollerRef;
|
|
57
|
+
const virtualScrollbarHorizontalRef = apiRef.current.virtualScrollbarHorizontalRef;
|
|
58
|
+
const virtualScrollbarVerticalRef = apiRef.current.virtualScrollbarVerticalRef;
|
|
56
59
|
const visibleSortedRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridFilterSelector.gridExpandedSortedRowEntriesSelector);
|
|
57
60
|
const scrollToIndexes = React.useCallback(params => {
|
|
58
61
|
const dimensions = (0, _dimensions.gridDimensionsSelector)(apiRef.current.state);
|
|
59
62
|
const totalRowCount = (0, _gridRowsSelector.gridRowCountSelector)(apiRef);
|
|
60
|
-
const visibleColumns = (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef);
|
|
63
|
+
const visibleColumns = props.unstable_listView ? [(0, _gridListViewSelectors.gridListColumnSelector)(apiRef.current.state)] : (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef);
|
|
61
64
|
const scrollToHeader = params.rowIndex == null;
|
|
62
65
|
if (!scrollToHeader && totalRowCount === 0 || visibleColumns.length === 0) {
|
|
63
66
|
return false;
|
|
@@ -104,20 +107,22 @@ const useGridScroll = (apiRef, props) => {
|
|
|
104
107
|
return true;
|
|
105
108
|
}
|
|
106
109
|
return false;
|
|
107
|
-
}, [logger, apiRef, virtualScrollerRef, props.pagination, visibleSortedRows]);
|
|
110
|
+
}, [logger, apiRef, virtualScrollerRef, props.pagination, visibleSortedRows, props.unstable_listView]);
|
|
108
111
|
const scroll = React.useCallback(params => {
|
|
109
|
-
if (virtualScrollerRef.current && params.left !== undefined && colRef.current) {
|
|
112
|
+
if (virtualScrollerRef.current && virtualScrollbarHorizontalRef.current && params.left !== undefined && colRef.current) {
|
|
110
113
|
const direction = isRtl ? -1 : 1;
|
|
111
114
|
colRef.current.scrollLeft = params.left;
|
|
112
115
|
virtualScrollerRef.current.scrollLeft = direction * params.left;
|
|
116
|
+
virtualScrollbarHorizontalRef.current.scrollLeft = direction * params.left;
|
|
113
117
|
logger.debug(`Scrolling left: ${params.left}`);
|
|
114
118
|
}
|
|
115
|
-
if (virtualScrollerRef.current && params.top !== undefined) {
|
|
119
|
+
if (virtualScrollerRef.current && virtualScrollbarVerticalRef.current && params.top !== undefined) {
|
|
116
120
|
virtualScrollerRef.current.scrollTop = params.top;
|
|
121
|
+
virtualScrollbarVerticalRef.current.scrollTop = params.top;
|
|
117
122
|
logger.debug(`Scrolling top: ${params.top}`);
|
|
118
123
|
}
|
|
119
124
|
logger.debug(`Scrolling, updating container, and viewport`);
|
|
120
|
-
}, [virtualScrollerRef, isRtl, colRef, logger]);
|
|
125
|
+
}, [virtualScrollerRef, virtualScrollbarHorizontalRef, virtualScrollbarVerticalRef, isRtl, colRef, logger]);
|
|
121
126
|
const getScrollPosition = React.useCallback(() => {
|
|
122
127
|
if (!virtualScrollerRef?.current) {
|
|
123
128
|
return {
|
|
@@ -10,7 +10,7 @@ var _warning = require("@mui/x-internals/warning");
|
|
|
10
10
|
const sanitizeSortModel = (model, disableMultipleColumnsSorting) => {
|
|
11
11
|
if (disableMultipleColumnsSorting && model.length > 1) {
|
|
12
12
|
if (process.env.NODE_ENV !== 'production') {
|
|
13
|
-
(0, _warning.warnOnce)(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the
|
|
13
|
+
(0, _warning.warnOnce)(['MUI X: The `sortModel` can only contain a single item when the `disableMultipleColumnsSorting` prop is set to `true`.', 'If you are using the community version of the Data Grid, this prop is always `true`.'], 'error');
|
|
14
14
|
}
|
|
15
15
|
return [model[0]];
|
|
16
16
|
}
|
|
@@ -36,6 +36,7 @@ var _gridRowsUtils = require("../rows/gridRowsUtils");
|
|
|
36
36
|
var _gridVirtualizationSelectors = require("./gridVirtualizationSelectors");
|
|
37
37
|
var _useGridVirtualization = require("./useGridVirtualization");
|
|
38
38
|
var _gridRowSpanningSelectors = require("../rows/gridRowSpanningSelectors");
|
|
39
|
+
var _gridListViewSelectors = require("../listView/gridListViewSelectors");
|
|
39
40
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
40
41
|
const MINIMUM_COLUMN_WIDTH = 50;
|
|
41
42
|
var ScrollDirection = /*#__PURE__*/function (ScrollDirection) {
|
|
@@ -66,13 +67,20 @@ try {
|
|
|
66
67
|
const useGridVirtualScroller = () => {
|
|
67
68
|
const apiRef = (0, _useGridPrivateApiContext.useGridPrivateApiContext)();
|
|
68
69
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
69
|
-
const
|
|
70
|
+
const {
|
|
71
|
+
unstable_listView: listView
|
|
72
|
+
} = rootProps;
|
|
73
|
+
const visibleColumns = (0, _useGridSelector.useGridSelector)(apiRef, () => listView ? [(0, _gridListViewSelectors.gridListColumnSelector)(apiRef.current.state)] : (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef));
|
|
70
74
|
const enabledForRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationRowEnabledSelector) && !isJSDOM;
|
|
71
75
|
const enabledForColumns = (0, _useGridSelector.useGridSelector)(apiRef, _gridVirtualizationSelectors.gridVirtualizationColumnEnabledSelector) && !isJSDOM;
|
|
72
76
|
const dimensions = (0, _useGridSelector.useGridSelector)(apiRef, _gridDimensionsSelectors.gridDimensionsSelector);
|
|
73
77
|
const outerSize = dimensions.viewportOuterSize;
|
|
74
78
|
const pinnedRows = (0, _useGridSelector.useGridSelector)(apiRef, _gridRowsSelector.gridPinnedRowsSelector);
|
|
75
|
-
const
|
|
79
|
+
const pinnedColumnDefinitions = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridVisiblePinnedColumnDefinitionsSelector);
|
|
80
|
+
const pinnedColumns = listView ? {
|
|
81
|
+
left: [],
|
|
82
|
+
right: []
|
|
83
|
+
} : pinnedColumnDefinitions;
|
|
76
84
|
const hasBottomPinnedRows = pinnedRows.bottom.length > 0;
|
|
77
85
|
const [panels, setPanels] = React.useState(EMPTY_DETAIL_PANELS);
|
|
78
86
|
const isRtl = (0, _RtlProvider.useRtl)();
|
|
@@ -84,8 +92,8 @@ const useGridVirtualScroller = () => {
|
|
|
84
92
|
const gridRootRef = apiRef.current.rootElementRef;
|
|
85
93
|
const mainRef = apiRef.current.mainElementRef;
|
|
86
94
|
const scrollerRef = apiRef.current.virtualScrollerRef;
|
|
87
|
-
const scrollbarVerticalRef =
|
|
88
|
-
const scrollbarHorizontalRef =
|
|
95
|
+
const scrollbarVerticalRef = apiRef.current.virtualScrollbarVerticalRef;
|
|
96
|
+
const scrollbarHorizontalRef = apiRef.current.virtualScrollbarHorizontalRef;
|
|
89
97
|
const contentHeight = dimensions.contentSize.height;
|
|
90
98
|
const columnsTotalWidth = dimensions.columnsTotalWidth;
|
|
91
99
|
const hasColSpan = (0, _useGridSelector.useGridSelector)(apiRef, _gridColumnsSelector.gridHasColSpanSelector);
|
|
@@ -139,7 +147,7 @@ const useGridVirtualScroller = () => {
|
|
|
139
147
|
}
|
|
140
148
|
previousContextScrollPosition.current = scrollPosition.current;
|
|
141
149
|
}, [apiRef, dimensions.isReady]);
|
|
142
|
-
const triggerUpdateRenderContext = () => {
|
|
150
|
+
const triggerUpdateRenderContext = (0, _utils.unstable_useEventCallback)(() => {
|
|
143
151
|
const newScroll = {
|
|
144
152
|
top: scrollerRef.current.scrollTop,
|
|
145
153
|
left: scrollerRef.current.scrollLeft
|
|
@@ -187,7 +195,7 @@ const useGridVirtualScroller = () => {
|
|
|
187
195
|
});
|
|
188
196
|
scrollTimeout.start(1000, triggerUpdateRenderContext);
|
|
189
197
|
return nextRenderContext;
|
|
190
|
-
};
|
|
198
|
+
});
|
|
191
199
|
const forceUpdateRenderContext = () => {
|
|
192
200
|
const inputs = inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns);
|
|
193
201
|
const nextRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
|
|
@@ -373,11 +381,11 @@ const useGridVirtualScroller = () => {
|
|
|
373
381
|
});
|
|
374
382
|
return rows;
|
|
375
383
|
};
|
|
376
|
-
const needsHorizontalScrollbar = outerSize.width && columnsTotalWidth
|
|
384
|
+
const needsHorizontalScrollbar = outerSize.width && columnsTotalWidth > outerSize.width;
|
|
377
385
|
const scrollerStyle = React.useMemo(() => ({
|
|
378
|
-
overflowX: !needsHorizontalScrollbar ? 'hidden' : undefined,
|
|
386
|
+
overflowX: !needsHorizontalScrollbar || listView ? 'hidden' : undefined,
|
|
379
387
|
overflowY: rootProps.autoHeight ? 'hidden' : undefined
|
|
380
|
-
}), [needsHorizontalScrollbar, rootProps.autoHeight]);
|
|
388
|
+
}), [needsHorizontalScrollbar, rootProps.autoHeight, listView]);
|
|
381
389
|
const contentSize = React.useMemo(() => {
|
|
382
390
|
const size = {
|
|
383
391
|
width: needsHorizontalScrollbar ? columnsTotalWidth : 'auto',
|
|
@@ -404,6 +412,11 @@ const useGridVirtualScroller = () => {
|
|
|
404
412
|
scrollerRef.current.scrollTop = 0;
|
|
405
413
|
}
|
|
406
414
|
}, [enabledForColumns, enabledForRows, gridRootRef, scrollerRef]);
|
|
415
|
+
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
416
|
+
if (listView) {
|
|
417
|
+
scrollerRef.current.scrollLeft = 0;
|
|
418
|
+
}
|
|
419
|
+
}, [listView, scrollerRef]);
|
|
407
420
|
(0, _useRunOnce.useRunOnce)(outerSize.width !== 0, () => {
|
|
408
421
|
const inputs = inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns);
|
|
409
422
|
const initialRenderContext = computeRenderContext(inputs, scrollPosition.current, scrollCache);
|
|
@@ -459,7 +472,7 @@ exports.useGridVirtualScroller = useGridVirtualScroller;
|
|
|
459
472
|
function inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns) {
|
|
460
473
|
const dimensions = (0, _gridDimensionsSelectors.gridDimensionsSelector)(apiRef.current.state);
|
|
461
474
|
const currentPage = (0, _useGridVisibleRows.getVisibleRows)(apiRef, rootProps);
|
|
462
|
-
const visibleColumns = (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef);
|
|
475
|
+
const visibleColumns = rootProps.unstable_listView ? [(0, _gridListViewSelectors.gridListColumnSelector)(apiRef.current.state)] : (0, _gridColumnsSelector.gridVisibleColumnDefinitionsSelector)(apiRef);
|
|
463
476
|
const hiddenCellsOriginMap = (0, _gridRowSpanningSelectors.gridRowSpanningHiddenCellsOriginMapSelector)(apiRef);
|
|
464
477
|
const lastRowId = apiRef.current.state.rows.dataRowIds.at(-1);
|
|
465
478
|
const lastColumn = visibleColumns.at(-1);
|
|
@@ -482,7 +495,8 @@ function inputsSelector(apiRef, rootProps, enabledForRows, enabledForColumns) {
|
|
|
482
495
|
range: currentPage.range,
|
|
483
496
|
pinnedColumns: (0, _gridColumnsSelector.gridVisiblePinnedColumnDefinitionsSelector)(apiRef),
|
|
484
497
|
visibleColumns,
|
|
485
|
-
hiddenCellsOriginMap
|
|
498
|
+
hiddenCellsOriginMap,
|
|
499
|
+
listView: rootProps.unstable_listView ?? false
|
|
486
500
|
};
|
|
487
501
|
}
|
|
488
502
|
function computeRenderContext(inputs, scrollPosition, scrollCache) {
|
|
@@ -10,7 +10,7 @@ var _GridApiContext = require("../../components/GridApiContext");
|
|
|
10
10
|
function useGridApiContext() {
|
|
11
11
|
const apiRef = React.useContext(_GridApiContext.GridApiContext);
|
|
12
12
|
if (apiRef === undefined) {
|
|
13
|
-
throw new Error(['MUI X: Could not find the
|
|
13
|
+
throw new Error(['MUI X: Could not find the Data Grid context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the Data Grid.'].join('\n'));
|
|
14
14
|
}
|
|
15
15
|
return apiRef;
|
|
16
16
|
}
|
|
@@ -13,7 +13,7 @@ var _TimerBasedCleanupTracking = require("../../utils/cleanupTracking/TimerBased
|
|
|
13
13
|
var _FinalizationRegistryBasedCleanupTracking = require("../../utils/cleanupTracking/FinalizationRegistryBasedCleanupTracking");
|
|
14
14
|
/**
|
|
15
15
|
* Signal to the underlying logic what version of the public component API
|
|
16
|
-
* of the
|
|
16
|
+
* of the Data Grid is exposed.
|
|
17
17
|
*/
|
|
18
18
|
var GridSignature = exports.GridSignature = /*#__PURE__*/function (GridSignature) {
|
|
19
19
|
GridSignature["DataGrid"] = "DataGrid";
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.useGridApiMethod = useGridApiMethod;
|
|
8
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
9
11
|
function useGridApiMethod(privateApiRef, apiMethods, visibility) {
|
|
10
12
|
const isFirstRender = React.useRef(true);
|
|
11
|
-
|
|
13
|
+
(0, _useEnhancedEffect.default)(() => {
|
|
12
14
|
isFirstRender.current = false;
|
|
13
15
|
privateApiRef.current.register(visibility, apiMethods);
|
|
14
16
|
}, [privateApiRef, visibility, apiMethods]);
|
|
@@ -10,7 +10,7 @@ var _GridConfigurationContext = require("../../components/GridConfigurationConte
|
|
|
10
10
|
const useGridConfiguration = () => {
|
|
11
11
|
const configuration = React.useContext(_GridConfigurationContext.GridConfigurationContext);
|
|
12
12
|
if (configuration === undefined) {
|
|
13
|
-
throw new Error(['MUI X: Could not find the
|
|
13
|
+
throw new Error(['MUI X: Could not find the Data Grid configuration context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the Data Grid.'].join('\n'));
|
|
14
14
|
}
|
|
15
15
|
return configuration;
|
|
16
16
|
};
|
|
@@ -14,7 +14,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
14
14
|
function useGridPrivateApiContext() {
|
|
15
15
|
const privateApiRef = React.useContext(GridPrivateApiContext);
|
|
16
16
|
if (privateApiRef === undefined) {
|
|
17
|
-
throw new Error(['MUI X: Could not find the
|
|
17
|
+
throw new Error(['MUI X: Could not find the Data Grid private context.', 'It looks like you rendered your component outside of a DataGrid, DataGridPro or DataGridPremium parent component.', 'This can also happen if you are bundling multiple versions of the Data Grid.'].join('\n'));
|
|
18
18
|
}
|
|
19
19
|
return privateApiRef;
|
|
20
20
|
}
|
package/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-data-grid v7.
|
|
2
|
+
* @mui/x-data-grid v7.21.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -100,6 +100,18 @@ Object.keys(_constants).forEach(function (key) {
|
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
|
+
var _dataGridPropsDefaultValues = require("./constants/dataGridPropsDefaultValues");
|
|
104
|
+
Object.keys(_dataGridPropsDefaultValues).forEach(function (key) {
|
|
105
|
+
if (key === "default" || key === "__esModule") return;
|
|
106
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
107
|
+
if (key in exports && exports[key] === _dataGridPropsDefaultValues[key]) return;
|
|
108
|
+
Object.defineProperty(exports, key, {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _dataGridPropsDefaultValues[key];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
103
115
|
var _hooks = require("./hooks");
|
|
104
116
|
Object.keys(_hooks).forEach(function (key) {
|
|
105
117
|
if (key === "default" || key === "__esModule") return;
|