@mui/x-data-grid-pro 7.0.0-beta.6 → 7.0.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 +311 -12
- package/DataGridPro/DataGridPro.js +18 -18
- package/DataGridPro/useDataGridProComponent.js +2 -3
- package/README.md +1 -1
- package/components/GridColumnHeaders.d.ts +1 -2
- package/components/GridColumnHeaders.js +7 -164
- package/components/headerFiltering/GridHeaderFilterCell.d.ts +8 -1
- package/components/headerFiltering/GridHeaderFilterCell.js +26 -9
- package/esm/DataGridPro/DataGridPro.js +18 -18
- package/esm/DataGridPro/useDataGridProComponent.js +1 -2
- package/esm/components/GridColumnHeaders.js +9 -166
- package/esm/components/GridDetailPanelToggleCell.js +1 -2
- package/esm/components/GridTreeDataGroupingCell.js +2 -3
- package/esm/components/headerFiltering/GridHeaderFilterCell.js +39 -26
- package/esm/components/headerFiltering/GridHeaderFilterClearButton.js +1 -2
- package/esm/components/headerFiltering/GridHeaderFilterMenu.js +1 -2
- package/esm/components/headerFiltering/GridHeaderFilterMenuContainer.js +1 -2
- package/esm/hooks/features/columnHeaders/useGridColumnHeaders.js +49 -16
- package/esm/hooks/features/columnPinning/useGridColumnPinning.js +7 -10
- package/esm/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -0
- package/esm/hooks/features/columnReorder/useGridColumnReorder.js +2 -4
- package/esm/hooks/features/detailPanel/useGridDetailPanel.js +5 -10
- package/esm/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -2
- package/esm/hooks/features/index.js +0 -1
- package/esm/hooks/features/infiniteLoader/useGridInfiniteLoader.js +6 -10
- package/esm/hooks/features/lazyLoader/useGridLazyLoader.js +3 -23
- package/esm/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -6
- package/esm/hooks/features/rowPinning/useGridRowPinning.js +3 -5
- package/esm/hooks/features/rowPinning/useGridRowPinningPreProcessors.js +5 -7
- package/esm/hooks/features/treeData/gridTreeDataGroupColDef.js +1 -1
- package/esm/hooks/features/treeData/gridTreeDataUtils.js +1 -2
- package/esm/hooks/features/treeData/useGridTreeDataPreProcessors.js +1 -2
- package/esm/internals/index.js +0 -1
- package/esm/utils/releaseInfo.js +1 -1
- package/esm/utils/tree/insertDataRowInTree.js +8 -9
- package/esm/utils/tree/removeDataRowFromTree.js +3 -3
- package/esm/utils/tree/sortRowTree.js +1 -1
- package/esm/utils/tree/updateRowTree.js +1 -1
- package/esm/utils/tree/utils.js +6 -9
- package/hooks/features/columnHeaders/useGridColumnHeaders.d.ts +3 -5
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +44 -11
- package/hooks/features/columnPinning/useGridColumnPinning.js +3 -3
- package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -0
- package/hooks/features/detailPanel/useGridDetailPanel.js +1 -1
- package/hooks/features/index.d.ts +0 -1
- package/hooks/features/index.js +0 -11
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/hooks/features/lazyLoader/useGridLazyLoader.d.ts +1 -1
- package/hooks/features/lazyLoader/useGridLazyLoader.js +1 -19
- package/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -5
- package/index.js +1 -1
- package/internals/index.d.ts +0 -1
- package/internals/index.js +0 -15
- package/models/dataGridProProps.d.ts +3 -36
- package/models/dataSource.d.ts +1 -1
- package/models/gridApiPro.d.ts +4 -4
- package/models/gridStatePro.d.ts +1 -2
- package/modern/DataGridPro/DataGridPro.js +18 -18
- package/modern/DataGridPro/useDataGridProComponent.js +1 -2
- package/modern/components/GridColumnHeaders.js +9 -166
- package/modern/components/headerFiltering/GridHeaderFilterCell.js +27 -10
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +46 -12
- package/modern/hooks/features/columnPinning/useGridColumnPinning.js +3 -3
- package/modern/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -0
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +1 -1
- package/modern/hooks/features/index.js +0 -1
- package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/modern/hooks/features/lazyLoader/useGridLazyLoader.js +1 -19
- package/modern/hooks/features/lazyLoader/useGridLazyLoaderPreProcessors.js +2 -5
- package/modern/index.js +1 -1
- package/modern/internals/index.js +0 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +6 -6
- package/typeOverloads/modules.d.ts +3 -3
- package/utils/releaseInfo.js +1 -1
- package/components/GridScrollArea.d.ts +0 -10
- package/components/GridScrollArea.js +0 -145
- package/esm/components/GridScrollArea.js +0 -137
- package/esm/hooks/features/columnResize/columnResizeSelector.js +0 -3
- package/esm/hooks/features/columnResize/columnResizeState.js +0 -1
- package/esm/hooks/features/columnResize/gridColumnResizeApi.js +0 -10
- package/esm/hooks/features/columnResize/index.js +0 -3
- package/esm/hooks/features/columnResize/useGridColumnResize.js +0 -547
- package/esm/utils/domUtils.js +0 -109
- package/hooks/features/columnResize/columnResizeSelector.d.ts +0 -3
- package/hooks/features/columnResize/columnResizeSelector.js +0 -10
- package/hooks/features/columnResize/columnResizeState.d.ts +0 -3
- package/hooks/features/columnResize/columnResizeState.js +0 -5
- package/hooks/features/columnResize/gridColumnResizeApi.d.ts +0 -44
- package/hooks/features/columnResize/gridColumnResizeApi.js +0 -16
- package/hooks/features/columnResize/index.d.ts +0 -3
- package/hooks/features/columnResize/index.js +0 -38
- package/hooks/features/columnResize/useGridColumnResize.d.ts +0 -10
- package/hooks/features/columnResize/useGridColumnResize.js +0 -548
- package/modern/components/GridScrollArea.js +0 -137
- package/modern/hooks/features/columnResize/columnResizeSelector.js +0 -3
- package/modern/hooks/features/columnResize/columnResizeState.js +0 -1
- package/modern/hooks/features/columnResize/gridColumnResizeApi.js +0 -10
- package/modern/hooks/features/columnResize/index.js +0 -3
- package/modern/hooks/features/columnResize/useGridColumnResize.js +0 -537
- package/modern/utils/domUtils.js +0 -107
- package/utils/domUtils.d.ts +0 -11
- package/utils/domUtils.js +0 -121
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { UseGridColumnHeadersProps, GetHeadersParams } from '@mui/x-data-grid/internals';
|
|
3
3
|
export declare const useGridColumnHeaders: (props: UseGridColumnHeadersProps) => {
|
|
4
|
-
|
|
5
|
-
renderContext: import("@mui/x-data-grid").GridRenderContext;
|
|
4
|
+
getColumnFiltersRow: () => React.JSX.Element | null;
|
|
6
5
|
getFillers: (params: GetHeadersParams | undefined, children: React.ReactNode, leftOverflow: number, borderTop?: boolean | undefined) => React.JSX.Element;
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
getColumnHeadersRow: () => React.JSX.Element;
|
|
7
|
+
getColumnGroupHeadersRows: () => React.JSX.Element[] | null;
|
|
9
8
|
isDragging: boolean;
|
|
10
9
|
getInnerProps: () => {
|
|
11
|
-
ref: ((instance: HTMLDivElement | null) => void) | null;
|
|
12
10
|
role: string;
|
|
13
11
|
};
|
|
14
12
|
};
|
|
@@ -13,7 +13,7 @@ var _internals = require("@mui/x-data-grid/internals");
|
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
14
|
var _useGridRootProps = require("../../utils/useGridRootProps");
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
const _excluded = ["getColumnsToRender"];
|
|
16
|
+
const _excluded = ["getColumnsToRender", "renderContext", "leftRenderContext", "rightRenderContext", "pinnedColumns", "visibleColumns", "getCellOffsetStyle"];
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
19
|
const useUtilityClasses = ownerState => {
|
|
@@ -39,7 +39,13 @@ const useGridColumnHeaders = props => {
|
|
|
39
39
|
hasOtherElementInTabSequence: hasOtherElementInTabSequence || columnHeaderFilterTabIndexState !== null
|
|
40
40
|
})),
|
|
41
41
|
{
|
|
42
|
-
getColumnsToRender
|
|
42
|
+
getColumnsToRender,
|
|
43
|
+
renderContext,
|
|
44
|
+
leftRenderContext,
|
|
45
|
+
rightRenderContext,
|
|
46
|
+
pinnedColumns,
|
|
47
|
+
visibleColumns,
|
|
48
|
+
getCellOffsetStyle
|
|
43
49
|
} = _useGridColumnHeaders,
|
|
44
50
|
otherProps = (0, _objectWithoutPropertiesLoose2.default)(_useGridColumnHeaders, _excluded);
|
|
45
51
|
const headerFiltersRef = React.useRef(null);
|
|
@@ -69,10 +75,7 @@ const useGridColumnHeaders = props => {
|
|
|
69
75
|
filterItemsCache[colDef.field] = defaultItem;
|
|
70
76
|
return defaultItem;
|
|
71
77
|
}, [filterModel]);
|
|
72
|
-
const getColumnFilters =
|
|
73
|
-
if (disableHeaderFiltering) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
78
|
+
const getColumnFilters = params => {
|
|
76
79
|
const {
|
|
77
80
|
renderedColumns,
|
|
78
81
|
firstColumnToRender
|
|
@@ -90,6 +93,12 @@ const useGridColumnHeaders = props => {
|
|
|
90
93
|
colDef
|
|
91
94
|
}) : colDef.headerClassName;
|
|
92
95
|
const item = getFilterItem(colDef);
|
|
96
|
+
const pinnedPosition = params?.position;
|
|
97
|
+
const style = getCellOffsetStyle({
|
|
98
|
+
pinnedPosition,
|
|
99
|
+
columnIndex,
|
|
100
|
+
computedWidth: colDef.computedWidth
|
|
101
|
+
});
|
|
93
102
|
filters.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.headerFilterCell, (0, _extends2.default)({
|
|
94
103
|
colIndex: columnIndex,
|
|
95
104
|
height: dimensions.headerHeight,
|
|
@@ -100,20 +109,44 @@ const useGridColumnHeaders = props => {
|
|
|
100
109
|
headerFilterMenuRef: headerFilterMenuRef,
|
|
101
110
|
headerClassName: headerClassName,
|
|
102
111
|
"data-field": colDef.field,
|
|
103
|
-
item: item
|
|
104
|
-
|
|
112
|
+
item: item,
|
|
113
|
+
pinnedPosition: pinnedPosition,
|
|
114
|
+
style: style,
|
|
115
|
+
indexInSection: i,
|
|
116
|
+
sectionLength: renderedColumns.length
|
|
117
|
+
}, rootProps.slotProps?.headerFilterCell), `${colDef.field}-filter`));
|
|
118
|
+
}
|
|
119
|
+
return otherProps.getFillers(params, filters, 0, true);
|
|
120
|
+
};
|
|
121
|
+
const getColumnFiltersRow = () => {
|
|
122
|
+
if (disableHeaderFiltering) {
|
|
123
|
+
return null;
|
|
105
124
|
}
|
|
106
|
-
return /*#__PURE__*/(0, _jsxRuntime.
|
|
125
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_internals.GridColumnHeaderRow, {
|
|
107
126
|
ref: headerFiltersRef,
|
|
108
127
|
className: classes.headerFilterRow,
|
|
109
128
|
role: "row",
|
|
110
129
|
"aria-rowindex": headerGroupingMaxDepth + 2,
|
|
111
130
|
ownerState: rootProps,
|
|
112
|
-
children:
|
|
131
|
+
children: [leftRenderContext && getColumnFilters({
|
|
132
|
+
position: _xDataGrid.GridPinnedColumnPosition.LEFT,
|
|
133
|
+
renderContext: leftRenderContext,
|
|
134
|
+
minFirstColumn: leftRenderContext.firstColumnIndex,
|
|
135
|
+
maxLastColumn: leftRenderContext.lastColumnIndex
|
|
136
|
+
}), getColumnFilters({
|
|
137
|
+
renderContext,
|
|
138
|
+
minFirstColumn: pinnedColumns.left.length,
|
|
139
|
+
maxLastColumn: visibleColumns.length - pinnedColumns.right.length
|
|
140
|
+
}), rightRenderContext && getColumnFilters({
|
|
141
|
+
position: _xDataGrid.GridPinnedColumnPosition.RIGHT,
|
|
142
|
+
renderContext: rightRenderContext,
|
|
143
|
+
minFirstColumn: rightRenderContext.firstColumnIndex,
|
|
144
|
+
maxLastColumn: rightRenderContext.lastColumnIndex
|
|
145
|
+
})]
|
|
113
146
|
});
|
|
114
147
|
};
|
|
115
148
|
return (0, _extends2.default)({}, otherProps, {
|
|
116
|
-
|
|
149
|
+
getColumnFiltersRow
|
|
117
150
|
});
|
|
118
151
|
};
|
|
119
152
|
exports.useGridColumnHeaders = useGridColumnHeaders;
|
|
@@ -188,16 +188,16 @@ const useGridColumnPinning = (apiRef, props) => {
|
|
|
188
188
|
* on must be moved to left or right to make room for it. The ^^^ below represents the column
|
|
189
189
|
* which gave space to receive X.
|
|
190
190
|
*
|
|
191
|
-
* | X | B | C | D | -> | B | C | D | X | (
|
|
191
|
+
* | X | B | C | D | -> | B | C | D | X | (for example X moved to after D, so delta=1)
|
|
192
192
|
* ^^^ ^^^
|
|
193
193
|
*
|
|
194
|
-
* | A | B | C | X | -> | X | A | B | C | (
|
|
194
|
+
* | A | B | C | X | -> | X | A | B | C | (for example X moved before A, so delta=-1)
|
|
195
195
|
* ^^^ ^^^
|
|
196
196
|
*
|
|
197
197
|
* If column P is pinned, it will not move to provide space. However, it will jump to the next
|
|
198
198
|
* non-pinned column.
|
|
199
199
|
*
|
|
200
|
-
* | X | B | P | D | -> | B | D | P | X | (
|
|
200
|
+
* | X | B | P | D | -> | B | D | P | X | (for example X moved to after D, with P pinned)
|
|
201
201
|
* ^^^ ^^^
|
|
202
202
|
*/
|
|
203
203
|
const siblingField = latestColumnFields[targetIndex - delta];
|
|
@@ -116,5 +116,7 @@ const useGridColumnPinningPreProcessors = (apiRef, props) => {
|
|
|
116
116
|
});
|
|
117
117
|
}, [apiRef, disableColumnPinning, pinnedColumns]);
|
|
118
118
|
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'hydrateColumns', reorderPinnedColumns);
|
|
119
|
+
const isColumnPinned = React.useCallback((initialValue, field) => apiRef.current.isColumnPinned(field), [apiRef]);
|
|
120
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'isColumnPinned', isColumnPinned);
|
|
119
121
|
};
|
|
120
122
|
exports.useGridColumnPinningPreProcessors = useGridColumnPinningPreProcessors;
|
|
@@ -188,7 +188,7 @@ const useGridDetailPanel = (apiRef, props) => {
|
|
|
188
188
|
}
|
|
189
189
|
updateCachesIfNeeded();
|
|
190
190
|
const heightCache = (0, _gridDetailPanelSelector.gridDetailPanelExpandedRowsHeightCacheSelector)(apiRef);
|
|
191
|
-
initialValue.detail = heightCache[row.id] ?? 0; // Fallback to zero because the cache might not be ready yet (
|
|
191
|
+
initialValue.detail = heightCache[row.id] ?? 0; // Fallback to zero because the cache might not be ready yet (for example page was changed)
|
|
192
192
|
return initialValue;
|
|
193
193
|
}, [apiRef, expandedRowIds, updateCachesIfNeeded]);
|
|
194
194
|
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'rowHeight', addDetailHeight);
|
package/hooks/features/index.js
CHANGED
|
@@ -25,17 +25,6 @@ Object.keys(_columnReorder).forEach(function (key) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
-
var _columnResize = require("./columnResize");
|
|
29
|
-
Object.keys(_columnResize).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _columnResize[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function () {
|
|
35
|
-
return _columnResize[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
28
|
var _rowReorder = require("./rowReorder");
|
|
40
29
|
Object.keys(_rowReorder).forEach(function (key) {
|
|
41
30
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -94,10 +94,10 @@ const useGridInfiniteLoader = (apiRef, props) => {
|
|
|
94
94
|
role: "presentation"
|
|
95
95
|
}, `trigger-${lastRowId}`);
|
|
96
96
|
}, [isEnabled, triggerRef]);
|
|
97
|
-
const
|
|
97
|
+
const infiniteLoaderPrivateApi = {
|
|
98
98
|
getInfiniteLoadingTriggerElement
|
|
99
99
|
};
|
|
100
|
-
(0, _xDataGrid.useGridApiMethod)(apiRef,
|
|
100
|
+
(0, _xDataGrid.useGridApiMethod)(apiRef, infiniteLoaderPrivateApi, 'private');
|
|
101
101
|
(0, _xDataGrid.useGridApiOptionHandler)(apiRef, 'rowsScrollEnd', props.onRowsScrollEnd);
|
|
102
102
|
};
|
|
103
103
|
exports.useGridInfiniteLoader = useGridInfiniteLoader;
|
|
@@ -7,4 +7,4 @@ import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
|
7
7
|
* @requires useGridDimensions (method) - can be after
|
|
8
8
|
* @requires useGridScroll (method
|
|
9
9
|
*/
|
|
10
|
-
export declare const useGridLazyLoader: (privateApiRef: React.MutableRefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, 'onFetchRows' | 'rowsLoadingMode' | 'pagination' | 'paginationMode' | '
|
|
10
|
+
export declare const useGridLazyLoader: (privateApiRef: React.MutableRefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, 'onFetchRows' | 'rowsLoadingMode' | 'pagination' | 'paginationMode' | 'experimentalFeatures'>) => void;
|
|
@@ -42,18 +42,6 @@ function findSkeletonRowsSection({
|
|
|
42
42
|
lastRowIndex
|
|
43
43
|
} : undefined;
|
|
44
44
|
}
|
|
45
|
-
function isLazyLoadingDisabled({
|
|
46
|
-
lazyLoadingFeatureFlag,
|
|
47
|
-
rowsLoadingMode
|
|
48
|
-
}) {
|
|
49
|
-
if (!lazyLoadingFeatureFlag) {
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
if (rowsLoadingMode !== 'server') {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
45
|
|
|
58
46
|
/**
|
|
59
47
|
* @requires useGridRows (state)
|
|
@@ -68,13 +56,7 @@ const useGridLazyLoader = (privateApiRef, props) => {
|
|
|
68
56
|
firstRowToRender: 0,
|
|
69
57
|
lastRowToRender: 0
|
|
70
58
|
});
|
|
71
|
-
const
|
|
72
|
-
lazyLoading
|
|
73
|
-
} = props.experimentalFeatures ?? {};
|
|
74
|
-
const isDisabled = isLazyLoadingDisabled({
|
|
75
|
-
lazyLoadingFeatureFlag: lazyLoading,
|
|
76
|
-
rowsLoadingMode: props.rowsLoadingMode
|
|
77
|
-
});
|
|
59
|
+
const isDisabled = props.rowsLoadingMode !== 'server';
|
|
78
60
|
const handleRenderedRowsIntervalChange = React.useCallback(params => {
|
|
79
61
|
if (isDisabled) {
|
|
80
62
|
return;
|
|
@@ -14,12 +14,9 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
14
14
|
const GRID_SKELETON_ROW_ROOT_ID = exports.GRID_SKELETON_ROW_ROOT_ID = 'auto-generated-skeleton-row-root';
|
|
15
15
|
const getSkeletonRowId = index => `${GRID_SKELETON_ROW_ROOT_ID}-${index}`;
|
|
16
16
|
const useGridLazyLoaderPreProcessors = (privateApiRef, props) => {
|
|
17
|
-
const {
|
|
18
|
-
lazyLoading
|
|
19
|
-
} = props.experimentalFeatures ?? {};
|
|
20
17
|
const addSkeletonRows = React.useCallback(groupingParams => {
|
|
21
18
|
const rootGroup = groupingParams.tree[_xDataGrid.GRID_ROOT_GROUP_ID];
|
|
22
|
-
if (
|
|
19
|
+
if (props.rowsLoadingMode !== 'server' || !props.rowCount || rootGroup.children.length >= props.rowCount) {
|
|
23
20
|
return groupingParams;
|
|
24
21
|
}
|
|
25
22
|
const tree = (0, _extends2.default)({}, groupingParams.tree);
|
|
@@ -41,7 +38,7 @@ const useGridLazyLoaderPreProcessors = (privateApiRef, props) => {
|
|
|
41
38
|
return (0, _extends2.default)({}, groupingParams, {
|
|
42
39
|
tree
|
|
43
40
|
});
|
|
44
|
-
}, [props.rowCount, props.rowsLoadingMode
|
|
41
|
+
}, [props.rowCount, props.rowsLoadingMode]);
|
|
45
42
|
(0, _internals.useGridRegisterPipeProcessor)(privateApiRef, 'hydrateRows', addSkeletonRows);
|
|
46
43
|
};
|
|
47
44
|
exports.useGridLazyLoaderPreProcessors = useGridLazyLoaderPreProcessors;
|
package/index.js
CHANGED
package/internals/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from '@mui/x-data-grid/internals';
|
|
|
2
2
|
export { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
3
3
|
export { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridProDefaultSlotsComponents';
|
|
4
4
|
export { useGridColumnHeaders } from '../hooks/features/columnHeaders/useGridColumnHeaders';
|
|
5
|
-
export { useGridColumnResize, columnResizeStateInitializer, } from '../hooks/features/columnResize/useGridColumnResize';
|
|
6
5
|
export { useGridColumnPinning, columnPinningStateInitializer, } from '../hooks/features/columnPinning/useGridColumnPinning';
|
|
7
6
|
export { useGridColumnPinningPreProcessors } from '../hooks/features/columnPinning/useGridColumnPinningPreProcessors';
|
|
8
7
|
export { useGridColumnReorder, columnReorderStateInitializer, } from '../hooks/features/columnReorder/useGridColumnReorder';
|
package/internals/index.js
CHANGED
|
@@ -7,8 +7,6 @@ var _exportNames = {
|
|
|
7
7
|
GridColumnHeaders: true,
|
|
8
8
|
DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS: true,
|
|
9
9
|
useGridColumnHeaders: true,
|
|
10
|
-
useGridColumnResize: true,
|
|
11
|
-
columnResizeStateInitializer: true,
|
|
12
10
|
useGridColumnPinning: true,
|
|
13
11
|
columnPinningStateInitializer: true,
|
|
14
12
|
useGridColumnPinningPreProcessors: true,
|
|
@@ -72,12 +70,6 @@ Object.defineProperty(exports, "columnReorderStateInitializer", {
|
|
|
72
70
|
return _useGridColumnReorder.columnReorderStateInitializer;
|
|
73
71
|
}
|
|
74
72
|
});
|
|
75
|
-
Object.defineProperty(exports, "columnResizeStateInitializer", {
|
|
76
|
-
enumerable: true,
|
|
77
|
-
get: function () {
|
|
78
|
-
return _useGridColumnResize.columnResizeStateInitializer;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
73
|
Object.defineProperty(exports, "createRowTree", {
|
|
82
74
|
enumerable: true,
|
|
83
75
|
get: function () {
|
|
@@ -150,12 +142,6 @@ Object.defineProperty(exports, "useGridColumnReorder", {
|
|
|
150
142
|
return _useGridColumnReorder.useGridColumnReorder;
|
|
151
143
|
}
|
|
152
144
|
});
|
|
153
|
-
Object.defineProperty(exports, "useGridColumnResize", {
|
|
154
|
-
enumerable: true,
|
|
155
|
-
get: function () {
|
|
156
|
-
return _useGridColumnResize.useGridColumnResize;
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
145
|
Object.defineProperty(exports, "useGridDetailPanel", {
|
|
160
146
|
enumerable: true,
|
|
161
147
|
get: function () {
|
|
@@ -237,7 +223,6 @@ Object.keys(_internals).forEach(function (key) {
|
|
|
237
223
|
var _GridColumnHeaders = require("../components/GridColumnHeaders");
|
|
238
224
|
var _dataGridProDefaultSlotsComponents = require("../constants/dataGridProDefaultSlotsComponents");
|
|
239
225
|
var _useGridColumnHeaders = require("../hooks/features/columnHeaders/useGridColumnHeaders");
|
|
240
|
-
var _useGridColumnResize = require("../hooks/features/columnResize/useGridColumnResize");
|
|
241
226
|
var _useGridColumnPinning = require("../hooks/features/columnPinning/useGridColumnPinning");
|
|
242
227
|
var _useGridColumnPinningPreProcessors = require("../hooks/features/columnPinning/useGridColumnPinningPreProcessors");
|
|
243
228
|
var _useGridColumnReorder = require("../hooks/features/columnReorder/useGridColumnReorder");
|
|
@@ -7,12 +7,7 @@ import { GridGroupingColDefOverride, GridGroupingColDefOverrideParams } from './
|
|
|
7
7
|
import { GridInitialStatePro } from './gridStatePro';
|
|
8
8
|
import { GridProSlotsComponent } from './gridProSlotsComponent';
|
|
9
9
|
import type { GridProSlotProps } from './gridProSlotProps';
|
|
10
|
-
import type { GridAutosizeOptions } from '../hooks';
|
|
11
10
|
export interface GridExperimentalProFeatures extends GridExperimentalFeatures {
|
|
12
|
-
/**
|
|
13
|
-
* Enables the data grid to lazy load rows while scrolling.
|
|
14
|
-
*/
|
|
15
|
-
lazyLoading: boolean;
|
|
16
11
|
}
|
|
17
12
|
interface DataGridProPropsWithComplexDefaultValueBeforeProcessing extends Omit<DataGridPropsWithComplexDefaultValueBeforeProcessing, 'components'> {
|
|
18
13
|
/**
|
|
@@ -23,7 +18,7 @@ interface DataGridProPropsWithComplexDefaultValueBeforeProcessing extends Omit<D
|
|
|
23
18
|
/**
|
|
24
19
|
* The props users can give to the `DataGridProProps` component.
|
|
25
20
|
*/
|
|
26
|
-
export interface DataGridProProps<R extends GridValidRowModel = any> extends Omit<Partial<DataGridProPropsWithDefaultValue
|
|
21
|
+
export interface DataGridProProps<R extends GridValidRowModel = any> extends Omit<Partial<DataGridProPropsWithDefaultValue<R>> & DataGridProPropsWithComplexDefaultValueBeforeProcessing & DataGridProPropsWithoutDefaultValue<R>, DataGridProForcedPropsKey> {
|
|
27
22
|
}
|
|
28
23
|
interface DataGridProPropsWithComplexDefaultValueAfterProcessing extends Omit<DataGridPropsWithComplexDefaultValueAfterProcessing, 'slots'> {
|
|
29
24
|
slots: GridProSlotsComponent;
|
|
@@ -31,7 +26,7 @@ interface DataGridProPropsWithComplexDefaultValueAfterProcessing extends Omit<Da
|
|
|
31
26
|
/**
|
|
32
27
|
* The props of the `DataGridPro` component after the pre-processing phase.
|
|
33
28
|
*/
|
|
34
|
-
export interface DataGridProProcessedProps<R extends GridValidRowModel = any> extends DataGridProPropsWithDefaultValue
|
|
29
|
+
export interface DataGridProProcessedProps<R extends GridValidRowModel = any> extends DataGridProPropsWithDefaultValue<R>, DataGridProPropsWithComplexDefaultValueAfterProcessing, Omit<DataGridProPropsWithoutDefaultValue<R>, 'componentsProps'> {
|
|
35
30
|
}
|
|
36
31
|
export type DataGridProForcedPropsKey = 'signature';
|
|
37
32
|
/**
|
|
@@ -39,7 +34,7 @@ export type DataGridProForcedPropsKey = 'signature';
|
|
|
39
34
|
* None of the entry of this interface should be optional, they all have default values and `DataGridProps` already applies a `Partial<DataGridSimpleOptions>` for the public interface
|
|
40
35
|
* The controlled model do not have a default value at the prop processing level, so they must be defined in `DataGridOtherProps`
|
|
41
36
|
*/
|
|
42
|
-
export interface DataGridProPropsWithDefaultValue extends DataGridPropsWithDefaultValues {
|
|
37
|
+
export interface DataGridProPropsWithDefaultValue<R extends GridValidRowModel = any> extends DataGridPropsWithDefaultValues<R> {
|
|
43
38
|
/**
|
|
44
39
|
* Set the area in `px` at the bottom of the grid viewport where onRowsScrollEnd is called.
|
|
45
40
|
* @default 80
|
|
@@ -63,16 +58,6 @@ export interface DataGridProPropsWithDefaultValue extends DataGridPropsWithDefau
|
|
|
63
58
|
* @returns {boolean} A boolean indicating if the group is expanded.
|
|
64
59
|
*/
|
|
65
60
|
isGroupExpandedByDefault?: (node: GridGroupNode) => boolean;
|
|
66
|
-
/**
|
|
67
|
-
* If `true`, columns are autosized after the datagrid is mounted.
|
|
68
|
-
* @default false
|
|
69
|
-
*/
|
|
70
|
-
autosizeOnMount: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* If `true`, column autosizing on header separator double-click is disabled.
|
|
73
|
-
* @default false
|
|
74
|
-
*/
|
|
75
|
-
disableAutosize: boolean;
|
|
76
61
|
/**
|
|
77
62
|
* If `true`, the column pinning is disabled.
|
|
78
63
|
* @default false
|
|
@@ -124,10 +109,6 @@ export interface DataGridProPropsWithoutDefaultValue<R extends GridValidRowModel
|
|
|
124
109
|
* The ref object that allows grid manipulation. Can be instantiated with `useGridApiRef()`.
|
|
125
110
|
*/
|
|
126
111
|
apiRef?: React.MutableRefObject<GridApiPro>;
|
|
127
|
-
/**
|
|
128
|
-
* The options for autosize when user-initiated.
|
|
129
|
-
*/
|
|
130
|
-
autosizeOptions?: GridAutosizeOptions;
|
|
131
112
|
/**
|
|
132
113
|
* The initial state of the DataGridPro.
|
|
133
114
|
* The data in it will be set in the state on initialization but will not be controlled.
|
|
@@ -148,20 +129,6 @@ export interface DataGridProPropsWithoutDefaultValue<R extends GridValidRowModel
|
|
|
148
129
|
* @returns {string[]} The path to the row.
|
|
149
130
|
*/
|
|
150
131
|
getTreeDataPath?: (row: R) => string[];
|
|
151
|
-
/**
|
|
152
|
-
* Callback fired while a column is being resized.
|
|
153
|
-
* @param {GridColumnResizeParams} params With all properties from [[GridColumnResizeParams]].
|
|
154
|
-
* @param {MuiEvent<React.MouseEvent>} event The event object.
|
|
155
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
156
|
-
*/
|
|
157
|
-
onColumnResize?: GridEventListener<'columnResize'>;
|
|
158
|
-
/**
|
|
159
|
-
* Callback fired when the width of a column is changed.
|
|
160
|
-
* @param {GridColumnResizeParams} params With all properties from [[GridColumnResizeParams]].
|
|
161
|
-
* @param {MuiEvent<React.MouseEvent>} event The event object.
|
|
162
|
-
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
163
|
-
*/
|
|
164
|
-
onColumnWidthChange?: GridEventListener<'columnWidthChange'>;
|
|
165
132
|
/**
|
|
166
133
|
* Callback fired when scrolling to the bottom of the grid viewport.
|
|
167
134
|
* @param {GridRowScrollEndParams} params With all properties from [[GridRowScrollEndParams]].
|
package/models/dataSource.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ interface GetRowsResponse {
|
|
|
29
29
|
rows: GridRowModel[];
|
|
30
30
|
/**
|
|
31
31
|
* To reflect updates in total `rowCount` (optional).
|
|
32
|
-
* Useful when the `rowCount` is inaccurate (
|
|
32
|
+
* Useful when the `rowCount` is inaccurate (for example when filtering) or not available upfront.
|
|
33
33
|
*/
|
|
34
34
|
rowCount?: number;
|
|
35
35
|
/**
|
package/models/gridApiPro.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { GridApiCommon, GridColumnReorderApi, GridRowMultiSelectionApi, GridRowProApi } from '@mui/x-data-grid';
|
|
2
|
-
import { GridPrivateOnlyApiCommon } from '@mui/x-data-grid/internals';
|
|
2
|
+
import { GridPrivateOnlyApiCommon, GridInfiniteLoaderPrivateApi } from '@mui/x-data-grid/internals';
|
|
3
3
|
import { GridInitialStatePro, GridStatePro } from './gridStatePro';
|
|
4
|
-
import type { GridColumnPinningApi,
|
|
4
|
+
import type { GridColumnPinningApi, GridDetailPanelApi, GridRowPinningApi, GridDetailPanelPrivateApi } from '../hooks';
|
|
5
5
|
import type { DataGridProProcessedProps } from './dataGridProProps';
|
|
6
6
|
/**
|
|
7
7
|
* The api of `DataGridPro`.
|
|
8
8
|
*/
|
|
9
|
-
export interface GridApiPro extends GridApiCommon<GridStatePro, GridInitialStatePro>, GridRowProApi, GridColumnPinningApi,
|
|
9
|
+
export interface GridApiPro extends GridApiCommon<GridStatePro, GridInitialStatePro>, GridRowProApi, GridColumnPinningApi, GridDetailPanelApi, GridRowPinningApi, GridRowMultiSelectionApi, GridColumnReorderApi {
|
|
10
10
|
}
|
|
11
|
-
export interface GridPrivateApiPro extends GridApiPro, GridPrivateOnlyApiCommon<GridApiPro, GridPrivateApiPro, DataGridProProcessedProps>, GridDetailPanelPrivateApi {
|
|
11
|
+
export interface GridPrivateApiPro extends GridApiPro, GridPrivateOnlyApiCommon<GridApiPro, GridPrivateApiPro, DataGridProProcessedProps>, GridDetailPanelPrivateApi, GridInfiniteLoaderPrivateApi {
|
|
12
12
|
}
|
package/models/gridStatePro.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { GridInitialState as GridInitialStateCommunity, GridState as GridStateCommunity, GridColumnPinningState, GridPinnedColumnFields } from '@mui/x-data-grid';
|
|
2
|
-
import type { GridDetailPanelState, GridDetailPanelInitialState, GridColumnReorderState
|
|
2
|
+
import type { GridDetailPanelState, GridDetailPanelInitialState, GridColumnReorderState } from '../hooks';
|
|
3
3
|
/**
|
|
4
4
|
* The state of `DataGridPro`.
|
|
5
5
|
*/
|
|
6
6
|
export interface GridStatePro extends GridStateCommunity {
|
|
7
7
|
columnReorder: GridColumnReorderState;
|
|
8
|
-
columnResize: GridColumnResizeState;
|
|
9
8
|
pinnedColumns: GridColumnPinningState;
|
|
10
9
|
detailPanel: GridDetailPanelState;
|
|
11
10
|
}
|
|
@@ -113,10 +113,10 @@ DataGridProRaw.propTypes = {
|
|
|
113
113
|
*/
|
|
114
114
|
clipboardCopyCellDelimiter: PropTypes.string,
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
117
|
-
* @default
|
|
116
|
+
* Column region in pixels to render before/after the viewport
|
|
117
|
+
* @default 150
|
|
118
118
|
*/
|
|
119
|
-
|
|
119
|
+
columnBufferPx: PropTypes.number,
|
|
120
120
|
columnGroupingModel: PropTypes.arrayOf(PropTypes.object),
|
|
121
121
|
/**
|
|
122
122
|
* Sets the height in pixel of the column headers in the Data Grid.
|
|
@@ -127,11 +127,6 @@ DataGridProRaw.propTypes = {
|
|
|
127
127
|
* Set of columns of type [[GridColDef]][].
|
|
128
128
|
*/
|
|
129
129
|
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
130
|
-
/**
|
|
131
|
-
* Number of rows from the `columnBuffer` that can be visible before a new slice is rendered.
|
|
132
|
-
* @default 3
|
|
133
|
-
*/
|
|
134
|
-
columnThreshold: PropTypes.number,
|
|
135
130
|
/**
|
|
136
131
|
* Set the column visibility model of the Data Grid.
|
|
137
132
|
* If defined, the Data Grid will ignore the `hide` property in [[GridColDef]].
|
|
@@ -248,7 +243,6 @@ DataGridProRaw.propTypes = {
|
|
|
248
243
|
* For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
|
|
249
244
|
*/
|
|
250
245
|
experimentalFeatures: PropTypes.shape({
|
|
251
|
-
lazyLoading: PropTypes.bool,
|
|
252
246
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
253
247
|
}),
|
|
254
248
|
/**
|
|
@@ -564,6 +558,11 @@ DataGridProRaw.propTypes = {
|
|
|
564
558
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
565
559
|
*/
|
|
566
560
|
onColumnWidthChange: PropTypes.func,
|
|
561
|
+
/**
|
|
562
|
+
* Callback fired when the density changes.
|
|
563
|
+
* @param {GridDensity} density New density value.
|
|
564
|
+
*/
|
|
565
|
+
onDensityChange: PropTypes.func,
|
|
567
566
|
/**
|
|
568
567
|
* Callback fired when the detail panel of a row is opened or closed.
|
|
569
568
|
* @param {GridRowId[]} ids The ids of the rows which have the detail panel open.
|
|
@@ -643,6 +642,11 @@ DataGridProRaw.propTypes = {
|
|
|
643
642
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
644
643
|
*/
|
|
645
644
|
onRowClick: PropTypes.func,
|
|
645
|
+
/**
|
|
646
|
+
* Callback fired when the row count has changed.
|
|
647
|
+
* @param {number} count Updated row count.
|
|
648
|
+
*/
|
|
649
|
+
onRowCountChange: PropTypes.func,
|
|
646
650
|
/**
|
|
647
651
|
* Callback fired when a double click event comes from a row container element.
|
|
648
652
|
* @param {GridRowParams} params With all properties from [[RowParams]].
|
|
@@ -749,10 +753,10 @@ DataGridProRaw.propTypes = {
|
|
|
749
753
|
*/
|
|
750
754
|
processRowUpdate: PropTypes.func,
|
|
751
755
|
/**
|
|
752
|
-
*
|
|
753
|
-
* @default
|
|
756
|
+
* Row region in pixels to render before/after the viewport
|
|
757
|
+
* @default 150
|
|
754
758
|
*/
|
|
755
|
-
|
|
759
|
+
rowBufferPx: PropTypes.number,
|
|
756
760
|
/**
|
|
757
761
|
* Set the total number of rows, if it is different from the length of the value `rows` prop.
|
|
758
762
|
* If some rows have children (for instance in the tree data), this number represents the amount of top level rows.
|
|
@@ -781,8 +785,9 @@ DataGridProRaw.propTypes = {
|
|
|
781
785
|
rowReordering: PropTypes.bool,
|
|
782
786
|
/**
|
|
783
787
|
* Set of rows of type [[GridRowsProp]].
|
|
788
|
+
* @default []
|
|
784
789
|
*/
|
|
785
|
-
rows: PropTypes.arrayOf(PropTypes.object)
|
|
790
|
+
rows: PropTypes.arrayOf(PropTypes.object),
|
|
786
791
|
/**
|
|
787
792
|
* If `false`, the row selection mode is disabled.
|
|
788
793
|
* @default true
|
|
@@ -804,11 +809,6 @@ DataGridProRaw.propTypes = {
|
|
|
804
809
|
* @default "margin"
|
|
805
810
|
*/
|
|
806
811
|
rowSpacingType: PropTypes.oneOf(['border', 'margin']),
|
|
807
|
-
/**
|
|
808
|
-
* Number of rows from the `rowBuffer` that can be visible before a new slice is rendered.
|
|
809
|
-
* @default 3
|
|
810
|
-
*/
|
|
811
|
-
rowThreshold: PropTypes.number,
|
|
812
812
|
/**
|
|
813
813
|
* Override the height/width of the Data Grid inner scrollbar.
|
|
814
814
|
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization } from '@mui/x-data-grid/internals';
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization, useGridColumnResize, columnResizeStateInitializer } from '@mui/x-data-grid/internals';
|
|
2
2
|
// Pro-only features
|
|
3
3
|
import { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
|
|
4
4
|
import { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
5
|
-
import { useGridColumnResize, columnResizeStateInitializer } from '../hooks/features/columnResize/useGridColumnResize';
|
|
6
5
|
import { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
|
|
7
6
|
import { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
|
|
8
7
|
import { useGridColumnPinning, columnPinningStateInitializer } from '../hooks/features/columnPinning/useGridColumnPinning';
|