@mui/x-data-grid-pro 6.0.0-beta.5 → 6.0.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 +175 -36
- package/DataGridPro/DataGridPro.js +12 -10
- package/components/DataGridProVirtualScroller.js +2 -2
- package/components/GridColumnHeaders.d.ts +9 -0
- package/components/{DataGridProColumnHeaders.js → GridColumnHeaders.js} +93 -10
- package/components/index.d.ts +1 -1
- package/components/index.js +1 -1
- package/constants/dataGridProDefaultSlotsComponents.d.ts +1 -2
- package/constants/dataGridProDefaultSlotsComponents.js +5 -7
- package/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +1 -1
- package/hooks/features/rowPinning/useGridRowPinning.d.ts +1 -1
- package/hooks/features/rowPinning/useGridRowPinning.js +2 -10
- package/index.d.ts +1 -0
- package/index.js +3 -2
- package/internals/index.d.ts +1 -1
- package/internals/index.js +1 -1
- package/legacy/DataGridPro/DataGridPro.js +12 -10
- package/legacy/components/DataGridProVirtualScroller.js +2 -2
- package/legacy/components/{DataGridProColumnHeaders.js → GridColumnHeaders.js} +95 -9
- package/legacy/components/index.js +1 -1
- package/legacy/constants/dataGridProDefaultSlotsComponents.js +5 -7
- package/legacy/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +1 -1
- package/legacy/hooks/features/rowPinning/useGridRowPinning.js +2 -10
- package/legacy/index.js +3 -2
- package/legacy/internals/index.js +1 -1
- package/legacy/material/index.js +8 -0
- package/legacy/utils/releaseInfo.js +1 -1
- package/material/index.d.ts +6 -0
- package/material/index.js +8 -0
- package/material/package.json +6 -0
- package/models/dataGridProProps.d.ts +2 -6
- package/modern/DataGridPro/DataGridPro.js +12 -10
- package/modern/components/DataGridProVirtualScroller.js +2 -2
- package/modern/components/{DataGridProColumnHeaders.js → GridColumnHeaders.js} +93 -10
- package/modern/components/index.js +1 -1
- package/modern/constants/dataGridProDefaultSlotsComponents.js +5 -7
- package/modern/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +1 -1
- package/modern/hooks/features/rowPinning/useGridRowPinning.js +1 -7
- package/modern/index.js +3 -2
- package/modern/internals/index.js +1 -1
- package/modern/material/index.js +8 -0
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPro/DataGridPro.js +11 -9
- package/node/components/DataGridProVirtualScroller.js +2 -2
- package/node/components/{DataGridProColumnHeaders.js → GridColumnHeaders.js} +90 -8
- package/node/components/index.js +1 -1
- package/node/constants/dataGridProDefaultSlotsComponents.js +6 -9
- package/node/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +1 -1
- package/node/hooks/features/rowPinning/useGridRowPinning.js +1 -7
- package/node/index.js +11 -3
- package/node/internals/index.js +6 -6
- package/node/material/index.js +16 -0
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +3 -3
- package/utils/releaseInfo.js +1 -1
- package/components/DataGridProColumnHeaders.d.ts +0 -6
- /package/legacy/{components → material}/icons.js +0 -0
- /package/{components → material}/icons.d.ts +0 -0
- /package/{components → material}/icons.js +0 -0
- /package/modern/{components → material}/icons.js +0 -0
- /package/node/{components → material}/icons.js +0 -0
package/components/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { GridProSlotsComponent
|
|
2
|
-
export declare const DEFAULT_GRID_PRO_ICON_SLOTS_COMPONENTS: GridProIconSlotsComponent;
|
|
1
|
+
import type { GridProSlotsComponent } from '../models';
|
|
3
2
|
export declare const DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS: GridProSlotsComponent;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '@mui/x-data-grid/internals';
|
|
3
|
-
import { GridPushPinRightIcon, GridPushPinLeftIcon } from '../components';
|
|
4
3
|
import { GridProColumnMenu } from '../components/GridProColumnMenu';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
ColumnMenu: GridProColumnMenu
|
|
4
|
+
import { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
5
|
+
import materialSlots from '../material';
|
|
6
|
+
export const DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS = _extends({}, DATA_GRID_DEFAULT_SLOTS_COMPONENTS, materialSlots, {
|
|
7
|
+
ColumnMenu: GridProColumnMenu,
|
|
8
|
+
ColumnHeaders: GridColumnHeaders
|
|
11
9
|
});
|
|
@@ -20,7 +20,7 @@ export const useGridDetailPanelPreProcessors = (privateApiRef, props) => {
|
|
|
20
20
|
return columnsState;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
//
|
|
23
|
+
// Otherwise, add the toggle column at the beginning
|
|
24
24
|
columnsState.orderedFields = [GRID_DETAIL_PANEL_TOGGLE_FIELD, ...columnsState.orderedFields];
|
|
25
25
|
columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD] = _extends({}, GRID_DETAIL_PANEL_TOGGLE_COL_DEF, {
|
|
26
26
|
headerName: privateApiRef.current.getLocaleText('detailPanelToggle')
|
|
@@ -3,4 +3,4 @@ import { GridStateInitializer } from '@mui/x-data-grid/internals';
|
|
|
3
3
|
import { GridPrivateApiPro } from '../../../models/gridApiPro';
|
|
4
4
|
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
5
5
|
export declare const rowPinningStateInitializer: GridStateInitializer<Pick<DataGridProProcessedProps, 'pinnedRows' | 'getRowId' | 'experimentalFeatures'>>;
|
|
6
|
-
export declare const useGridRowPinning: (apiRef: React.MutableRefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, 'pinnedRows' | 'getRowId'
|
|
6
|
+
export declare const useGridRowPinning: (apiRef: React.MutableRefObject<GridPrivateApiPro>, props: Pick<DataGridProProcessedProps, 'pinnedRows' | 'getRowId'>) => void;
|
|
@@ -22,10 +22,7 @@ function createPinnedRowsInternalCache(pinnedRows, getRowId) {
|
|
|
22
22
|
return cache;
|
|
23
23
|
}
|
|
24
24
|
export const rowPinningStateInitializer = (state, props, apiRef) => {
|
|
25
|
-
var
|
|
26
|
-
if (!((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.rowPinning)) {
|
|
27
|
-
return state;
|
|
28
|
-
}
|
|
25
|
+
var _state$rows;
|
|
29
26
|
apiRef.current.caches.pinnedRows = createPinnedRowsInternalCache(props.pinnedRows, props.getRowId);
|
|
30
27
|
return _extends({}, state, {
|
|
31
28
|
rows: _extends({}, state.rows, {
|
|
@@ -39,15 +36,10 @@ export const rowPinningStateInitializer = (state, props, apiRef) => {
|
|
|
39
36
|
});
|
|
40
37
|
};
|
|
41
38
|
export const useGridRowPinning = (apiRef, props) => {
|
|
42
|
-
var _props$experimentalFe3;
|
|
43
39
|
const setPinnedRows = React.useCallback(newPinnedRows => {
|
|
44
|
-
var _props$experimentalFe2;
|
|
45
|
-
if (!((_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.rowPinning)) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
40
|
apiRef.current.caches.pinnedRows = createPinnedRowsInternalCache(newPinnedRows, props.getRowId);
|
|
49
41
|
apiRef.current.requestPipeProcessorsApplication('hydrateRows');
|
|
50
|
-
}, [apiRef,
|
|
42
|
+
}, [apiRef, props.getRowId]);
|
|
51
43
|
useGridApiMethod(apiRef, {
|
|
52
44
|
unstable_setPinnedRows: setPinnedRows
|
|
53
45
|
}, 'public');
|
package/index.d.ts
CHANGED
|
@@ -18,3 +18,4 @@ export type { DataGridProProps, GridExperimentalProFeatures } from './models/dat
|
|
|
18
18
|
export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
|
|
19
19
|
export type { GridApi, GridInitialState, GridState } from './typeOverloads/reexports';
|
|
20
20
|
export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS, } from './components/reexports';
|
|
21
|
+
export { GridColumnHeaders } from './components/GridColumnHeaders';
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-data-grid-pro v6.0.
|
|
2
|
+
* @mui/x-data-grid-pro v6.0.1
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
@@ -21,4 +21,5 @@ export * from './models';
|
|
|
21
21
|
export * from './components';
|
|
22
22
|
export * from './utils';
|
|
23
23
|
export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
|
|
24
|
-
export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS } from './components/reexports';
|
|
24
|
+
export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS } from './components/reexports';
|
|
25
|
+
export { GridColumnHeaders } from './components/GridColumnHeaders';
|
package/internals/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@mui/x-data-grid/internals';
|
|
2
2
|
export { DataGridProVirtualScroller } from '../components/DataGridProVirtualScroller';
|
|
3
|
-
export {
|
|
3
|
+
export { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
4
4
|
export { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridProDefaultSlotsComponents';
|
|
5
5
|
export { useGridColumnResize, columnResizeStateInitializer, } from '../hooks/features/columnResize/useGridColumnResize';
|
|
6
6
|
export { useGridColumnPinning, columnPinningStateInitializer, } from '../hooks/features/columnPinning/useGridColumnPinning';
|
package/internals/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@mui/x-data-grid/internals';
|
|
2
2
|
export { DataGridProVirtualScroller } from '../components/DataGridProVirtualScroller';
|
|
3
|
-
export {
|
|
3
|
+
export { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
4
4
|
export { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridProDefaultSlotsComponents';
|
|
5
5
|
export { useGridColumnResize, columnResizeStateInitializer } from '../hooks/features/columnResize/useGridColumnResize';
|
|
6
6
|
export { useGridColumnPinning, columnPinningStateInitializer } from '../hooks/features/columnPinning/useGridColumnPinning';
|
|
@@ -2,12 +2,12 @@ import * as React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
|
|
4
4
|
import { chainPropTypes } from '@mui/utils';
|
|
5
|
-
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider } from '@mui/x-data-grid';
|
|
5
|
+
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider, useGridSelector } from '@mui/x-data-grid';
|
|
6
6
|
import { useDataGridProComponent } from './useDataGridProComponent';
|
|
7
7
|
import { useDataGridProProps } from './useDataGridProProps';
|
|
8
8
|
import { DataGridProVirtualScroller } from '../components/DataGridProVirtualScroller';
|
|
9
|
-
import { DataGridProColumnHeaders } from '../components/DataGridProColumnHeaders';
|
|
10
9
|
import { getReleaseInfo } from '../utils/releaseInfo';
|
|
10
|
+
import { gridPinnedColumnsSelector } from '../hooks/features/columnPinning/gridColumnPinningSelector';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
var releaseInfo = getReleaseInfo();
|
|
@@ -15,6 +15,7 @@ var DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProps,
|
|
|
15
15
|
var props = useDataGridProProps(inProps);
|
|
16
16
|
var privateApiRef = useDataGridProComponent(props.apiRef, props);
|
|
17
17
|
useLicenseVerifier('x-data-grid-pro', releaseInfo);
|
|
18
|
+
var pinnedColumns = useGridSelector(privateApiRef, gridPinnedColumnsSelector);
|
|
18
19
|
return /*#__PURE__*/_jsx(GridContextProvider, {
|
|
19
20
|
privateApiRef: privateApiRef,
|
|
20
21
|
props: props,
|
|
@@ -24,8 +25,10 @@ var DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProps,
|
|
|
24
25
|
sx: props.sx,
|
|
25
26
|
ref: ref,
|
|
26
27
|
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
|
|
27
|
-
ColumnHeadersComponent: DataGridProColumnHeaders,
|
|
28
28
|
VirtualScrollerComponent: DataGridProVirtualScroller,
|
|
29
|
+
ColumnHeadersProps: {
|
|
30
|
+
pinnedColumns: pinnedColumns
|
|
31
|
+
},
|
|
29
32
|
children: /*#__PURE__*/_jsx(Watermark, {
|
|
30
33
|
packageName: "x-data-grid-pro",
|
|
31
34
|
releaseInfo: releaseInfo
|
|
@@ -114,12 +117,12 @@ DataGridProRaw.propTypes = {
|
|
|
114
117
|
*/
|
|
115
118
|
columnVisibilityModel: PropTypes.object,
|
|
116
119
|
/**
|
|
117
|
-
*
|
|
120
|
+
* Overridable components.
|
|
118
121
|
* @deprecated Use the `slots` prop instead.
|
|
119
122
|
*/
|
|
120
123
|
components: PropTypes.object,
|
|
121
124
|
/**
|
|
122
|
-
*
|
|
125
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
123
126
|
* @deprecated Use the `slotProps` prop instead.
|
|
124
127
|
*/
|
|
125
128
|
componentsProps: PropTypes.object,
|
|
@@ -220,7 +223,6 @@ DataGridProRaw.propTypes = {
|
|
|
220
223
|
experimentalFeatures: PropTypes.shape({
|
|
221
224
|
columnGrouping: PropTypes.bool,
|
|
222
225
|
lazyLoading: PropTypes.bool,
|
|
223
|
-
rowPinning: PropTypes.bool,
|
|
224
226
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
225
227
|
}),
|
|
226
228
|
/**
|
|
@@ -437,7 +439,7 @@ DataGridProRaw.propTypes = {
|
|
|
437
439
|
onCellKeyDown: PropTypes.func,
|
|
438
440
|
/**
|
|
439
441
|
* Callback fired when the `cellModesModel` prop changes.
|
|
440
|
-
* @param {GridCellModesModel} cellModesModel Object
|
|
442
|
+
* @param {GridCellModesModel} cellModesModel Object containing which cells are in "edit" mode.
|
|
441
443
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
442
444
|
*/
|
|
443
445
|
onCellModesModelChange: PropTypes.func,
|
|
@@ -616,7 +618,7 @@ DataGridProRaw.propTypes = {
|
|
|
616
618
|
onRowEditStop: PropTypes.func,
|
|
617
619
|
/**
|
|
618
620
|
* Callback fired when the `rowModesModel` prop changes.
|
|
619
|
-
* @param {GridRowModesModel} rowModesModel Object
|
|
621
|
+
* @param {GridRowModesModel} rowModesModel Object containing which rows are in "edit" mode.
|
|
620
622
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
621
623
|
*/
|
|
622
624
|
onRowModesModelChange: PropTypes.func,
|
|
@@ -774,11 +776,11 @@ DataGridProRaw.propTypes = {
|
|
|
774
776
|
*/
|
|
775
777
|
showColumnVerticalBorder: PropTypes.bool,
|
|
776
778
|
/**
|
|
777
|
-
*
|
|
779
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
778
780
|
*/
|
|
779
781
|
slotProps: PropTypes.object,
|
|
780
782
|
/**
|
|
781
|
-
*
|
|
783
|
+
* Overridable components.
|
|
782
784
|
*/
|
|
783
785
|
slots: PropTypes.object,
|
|
784
786
|
/**
|
|
@@ -181,7 +181,7 @@ var DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
181
181
|
bottomPinnedRowsRenderZoneRef.current.style.transform = "translate3d(".concat(left, "px, 0px, 0px)");
|
|
182
182
|
}
|
|
183
183
|
}, []);
|
|
184
|
-
var getRowProps = function
|
|
184
|
+
var getRowProps = React.useCallback(function (id) {
|
|
185
185
|
if (!expandedRowIds.includes(id)) {
|
|
186
186
|
return null;
|
|
187
187
|
}
|
|
@@ -191,7 +191,7 @@ var DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
191
191
|
marginBottom: height
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
|
-
};
|
|
194
|
+
}, [detailPanelsHeights, expandedRowIds]);
|
|
195
195
|
var pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector);
|
|
196
196
|
var _filterColumns = filterColumns(pinnedColumns, visibleColumnFields, theme.direction === 'rtl'),
|
|
197
197
|
_filterColumns2 = _slicedToArray(_filterColumns, 2),
|
|
@@ -2,15 +2,16 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
5
|
-
var _excluded = ["style", "className", "innerRef"];
|
|
5
|
+
var _excluded = ["style", "className", "innerRef", "visibleColumns", "sortColumnLookup", "filterColumnLookup", "columnPositions", "columnHeaderTabIndexState", "columnGroupHeaderTabIndexState", "columnHeaderFocus", "columnGroupHeaderFocus", "densityFactor", "headerGroupingMaxDepth", "columnMenuState", "columnVisibility", "columnGroupsHeaderStructure", "hasOtherElementInTabSequence", "pinnedColumns"];
|
|
6
6
|
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
7
8
|
import { unstable_composeClasses as composeClasses, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
8
9
|
import { styled, alpha, useTheme } from '@mui/material/styles';
|
|
9
|
-
import { getDataGridUtilityClass, gridClasses,
|
|
10
|
-
import {
|
|
10
|
+
import { getDataGridUtilityClass, gridClasses, useGridApiEventHandler, GridColumnHeaderSeparatorSides } from '@mui/x-data-grid';
|
|
11
|
+
import { GridBaseColumnHeaders, GridColumnHeadersInner, useGridColumnHeaders } from '@mui/x-data-grid/internals';
|
|
11
12
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
12
13
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
13
|
-
import {
|
|
14
|
+
import { GridPinnedPosition } from '../hooks/features/columnPinning';
|
|
14
15
|
import { filterColumns } from './DataGridProVirtualScroller';
|
|
15
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -65,14 +66,35 @@ var GridColumnHeadersPinnedColumnHeaders = styled('div', {
|
|
|
65
66
|
borderLeftStyle: 'solid'
|
|
66
67
|
});
|
|
67
68
|
});
|
|
68
|
-
|
|
69
|
+
GridColumnHeadersPinnedColumnHeaders.propTypes = {
|
|
70
|
+
// ----------------------------- Warning --------------------------------
|
|
71
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
72
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
73
|
+
// ----------------------------------------------------------------------
|
|
74
|
+
ownerState: PropTypes.object.isRequired
|
|
75
|
+
};
|
|
76
|
+
var GridColumnHeaders = /*#__PURE__*/React.forwardRef(function GridColumnHeaders(props, ref) {
|
|
69
77
|
var style = props.style,
|
|
70
78
|
className = props.className,
|
|
71
79
|
innerRef = props.innerRef,
|
|
80
|
+
visibleColumns = props.visibleColumns,
|
|
81
|
+
sortColumnLookup = props.sortColumnLookup,
|
|
82
|
+
filterColumnLookup = props.filterColumnLookup,
|
|
83
|
+
columnPositions = props.columnPositions,
|
|
84
|
+
columnHeaderTabIndexState = props.columnHeaderTabIndexState,
|
|
85
|
+
columnGroupHeaderTabIndexState = props.columnGroupHeaderTabIndexState,
|
|
86
|
+
columnHeaderFocus = props.columnHeaderFocus,
|
|
87
|
+
columnGroupHeaderFocus = props.columnGroupHeaderFocus,
|
|
88
|
+
densityFactor = props.densityFactor,
|
|
89
|
+
headerGroupingMaxDepth = props.headerGroupingMaxDepth,
|
|
90
|
+
columnMenuState = props.columnMenuState,
|
|
91
|
+
columnVisibility = props.columnVisibility,
|
|
92
|
+
columnGroupsHeaderStructure = props.columnGroupsHeaderStructure,
|
|
93
|
+
hasOtherElementInTabSequence = props.hasOtherElementInTabSequence,
|
|
94
|
+
pinnedColumns = props.pinnedColumns,
|
|
72
95
|
other = _objectWithoutProperties(props, _excluded);
|
|
73
96
|
var rootProps = useGridRootProps();
|
|
74
97
|
var apiRef = useGridApiContext();
|
|
75
|
-
var visibleColumnFields = useGridSelector(apiRef, gridVisibleColumnFieldsSelector);
|
|
76
98
|
var _React$useState = React.useState(0),
|
|
77
99
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
78
100
|
scrollbarSize = _React$useState2[0],
|
|
@@ -89,13 +111,32 @@ export var DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function Dat
|
|
|
89
111
|
}
|
|
90
112
|
});
|
|
91
113
|
useGridApiEventHandler(apiRef, 'virtualScrollerContentSizeChange', handleContentSizeChange);
|
|
92
|
-
var
|
|
114
|
+
var visibleColumnFields = React.useMemo(function () {
|
|
115
|
+
return visibleColumns.map(function (_ref4) {
|
|
116
|
+
var field = _ref4.field;
|
|
117
|
+
return field;
|
|
118
|
+
});
|
|
119
|
+
}, [visibleColumns]);
|
|
93
120
|
var _filterColumns = filterColumns(pinnedColumns, visibleColumnFields, theme.direction === 'rtl'),
|
|
94
121
|
_filterColumns2 = _slicedToArray(_filterColumns, 2),
|
|
95
122
|
leftPinnedColumns = _filterColumns2[0],
|
|
96
123
|
rightPinnedColumns = _filterColumns2[1];
|
|
97
124
|
var _useGridColumnHeaders = useGridColumnHeaders({
|
|
98
125
|
innerRef: innerRef,
|
|
126
|
+
visibleColumns: visibleColumns,
|
|
127
|
+
sortColumnLookup: sortColumnLookup,
|
|
128
|
+
filterColumnLookup: filterColumnLookup,
|
|
129
|
+
columnPositions: columnPositions,
|
|
130
|
+
columnHeaderTabIndexState: columnHeaderTabIndexState,
|
|
131
|
+
hasOtherElementInTabSequence: hasOtherElementInTabSequence,
|
|
132
|
+
columnGroupHeaderTabIndexState: columnGroupHeaderTabIndexState,
|
|
133
|
+
columnHeaderFocus: columnHeaderFocus,
|
|
134
|
+
columnGroupHeaderFocus: columnGroupHeaderFocus,
|
|
135
|
+
densityFactor: densityFactor,
|
|
136
|
+
headerGroupingMaxDepth: headerGroupingMaxDepth,
|
|
137
|
+
columnMenuState: columnMenuState,
|
|
138
|
+
columnVisibility: columnVisibility,
|
|
139
|
+
columnGroupsHeaderStructure: columnGroupsHeaderStructure,
|
|
99
140
|
minColumnIndex: leftPinnedColumns.length
|
|
100
141
|
}),
|
|
101
142
|
isDragging = _useGridColumnHeaders.isDragging,
|
|
@@ -122,7 +163,7 @@ export var DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function Dat
|
|
|
122
163
|
var pinnedColumnHeadersProps = {
|
|
123
164
|
role: innerProps.role
|
|
124
165
|
};
|
|
125
|
-
return /*#__PURE__*/_jsxs(
|
|
166
|
+
return /*#__PURE__*/_jsxs(GridBaseColumnHeaders, _extends({
|
|
126
167
|
ref: ref,
|
|
127
168
|
className: className
|
|
128
169
|
}, getRootProps(other), {
|
|
@@ -180,4 +221,49 @@ export var DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function Dat
|
|
|
180
221
|
})]
|
|
181
222
|
}))]
|
|
182
223
|
}));
|
|
183
|
-
});
|
|
224
|
+
});
|
|
225
|
+
process.env.NODE_ENV !== "production" ? GridColumnHeaders.propTypes = {
|
|
226
|
+
// ----------------------------- Warning --------------------------------
|
|
227
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
228
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
229
|
+
// ----------------------------------------------------------------------
|
|
230
|
+
columnGroupHeaderFocus: PropTypes.shape({
|
|
231
|
+
depth: PropTypes.number.isRequired,
|
|
232
|
+
field: PropTypes.string.isRequired
|
|
233
|
+
}),
|
|
234
|
+
columnGroupHeaderTabIndexState: PropTypes.shape({
|
|
235
|
+
depth: PropTypes.number.isRequired,
|
|
236
|
+
field: PropTypes.string.isRequired
|
|
237
|
+
}),
|
|
238
|
+
columnGroupsHeaderStructure: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.shape({
|
|
239
|
+
columnFields: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
240
|
+
groupId: PropTypes.string
|
|
241
|
+
}))).isRequired,
|
|
242
|
+
columnHeaderFocus: PropTypes.shape({
|
|
243
|
+
field: PropTypes.string.isRequired
|
|
244
|
+
}),
|
|
245
|
+
columnHeaderTabIndexState: PropTypes.shape({
|
|
246
|
+
field: PropTypes.string.isRequired
|
|
247
|
+
}),
|
|
248
|
+
columnMenuState: PropTypes.shape({
|
|
249
|
+
field: PropTypes.string,
|
|
250
|
+
open: PropTypes.bool.isRequired
|
|
251
|
+
}).isRequired,
|
|
252
|
+
columnPositions: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
253
|
+
columnVisibility: PropTypes.object.isRequired,
|
|
254
|
+
densityFactor: PropTypes.number.isRequired,
|
|
255
|
+
filterColumnLookup: PropTypes.object.isRequired,
|
|
256
|
+
hasOtherElementInTabSequence: PropTypes.bool.isRequired,
|
|
257
|
+
headerGroupingMaxDepth: PropTypes.number.isRequired,
|
|
258
|
+
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
259
|
+
current: PropTypes.object
|
|
260
|
+
})]),
|
|
261
|
+
minColumnIndex: PropTypes.number,
|
|
262
|
+
pinnedColumns: PropTypes.shape({
|
|
263
|
+
left: PropTypes.arrayOf(PropTypes.string),
|
|
264
|
+
right: PropTypes.arrayOf(PropTypes.string)
|
|
265
|
+
}).isRequired,
|
|
266
|
+
sortColumnLookup: PropTypes.object.isRequired,
|
|
267
|
+
visibleColumns: PropTypes.arrayOf(PropTypes.object).isRequired
|
|
268
|
+
} : void 0;
|
|
269
|
+
export { GridColumnHeaders };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { DATA_GRID_DEFAULT_SLOTS_COMPONENTS } from '@mui/x-data-grid/internals';
|
|
3
|
-
import { GridPushPinRightIcon, GridPushPinLeftIcon } from '../components';
|
|
4
3
|
import { GridProColumnMenu } from '../components/GridProColumnMenu';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
ColumnMenu: GridProColumnMenu
|
|
4
|
+
import { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
5
|
+
import materialSlots from '../material';
|
|
6
|
+
export var DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS = _extends({}, DATA_GRID_DEFAULT_SLOTS_COMPONENTS, materialSlots, {
|
|
7
|
+
ColumnMenu: GridProColumnMenu,
|
|
8
|
+
ColumnHeaders: GridColumnHeaders
|
|
11
9
|
});
|
|
@@ -23,7 +23,7 @@ export var useGridDetailPanelPreProcessors = function useGridDetailPanelPreProce
|
|
|
23
23
|
return columnsState;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
//
|
|
26
|
+
// Otherwise, add the toggle column at the beginning
|
|
27
27
|
columnsState.orderedFields = [GRID_DETAIL_PANEL_TOGGLE_FIELD].concat(_toConsumableArray(columnsState.orderedFields));
|
|
28
28
|
columnsState.lookup[GRID_DETAIL_PANEL_TOGGLE_FIELD] = _extends({}, GRID_DETAIL_PANEL_TOGGLE_COL_DEF, {
|
|
29
29
|
headerName: privateApiRef.current.getLocaleText('detailPanelToggle')
|
|
@@ -22,10 +22,7 @@ function createPinnedRowsInternalCache(pinnedRows, getRowId) {
|
|
|
22
22
|
return cache;
|
|
23
23
|
}
|
|
24
24
|
export var rowPinningStateInitializer = function rowPinningStateInitializer(state, props, apiRef) {
|
|
25
|
-
var
|
|
26
|
-
if (!((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.rowPinning)) {
|
|
27
|
-
return state;
|
|
28
|
-
}
|
|
25
|
+
var _state$rows;
|
|
29
26
|
apiRef.current.caches.pinnedRows = createPinnedRowsInternalCache(props.pinnedRows, props.getRowId);
|
|
30
27
|
return _extends({}, state, {
|
|
31
28
|
rows: _extends({}, state.rows, {
|
|
@@ -39,15 +36,10 @@ export var rowPinningStateInitializer = function rowPinningStateInitializer(stat
|
|
|
39
36
|
});
|
|
40
37
|
};
|
|
41
38
|
export var useGridRowPinning = function useGridRowPinning(apiRef, props) {
|
|
42
|
-
var _props$experimentalFe3;
|
|
43
39
|
var setPinnedRows = React.useCallback(function (newPinnedRows) {
|
|
44
|
-
var _props$experimentalFe2;
|
|
45
|
-
if (!((_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.rowPinning)) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
40
|
apiRef.current.caches.pinnedRows = createPinnedRowsInternalCache(newPinnedRows, props.getRowId);
|
|
49
41
|
apiRef.current.requestPipeProcessorsApplication('hydrateRows');
|
|
50
|
-
}, [apiRef,
|
|
42
|
+
}, [apiRef, props.getRowId]);
|
|
51
43
|
useGridApiMethod(apiRef, {
|
|
52
44
|
unstable_setPinnedRows: setPinnedRows
|
|
53
45
|
}, 'public');
|
package/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-data-grid-pro v6.0.
|
|
2
|
+
* @mui/x-data-grid-pro v6.0.1
|
|
3
3
|
*
|
|
4
4
|
* @license MUI X Commercial
|
|
5
5
|
* This source code is licensed under the commercial license found in the
|
|
@@ -21,4 +21,5 @@ export * from './models';
|
|
|
21
21
|
export * from './components';
|
|
22
22
|
export * from './utils';
|
|
23
23
|
export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
|
|
24
|
-
export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS } from './components/reexports';
|
|
24
|
+
export { GridColumnMenu, GRID_COLUMN_MENU_COMPONENTS, GRID_COLUMN_MENU_COMPONENTS_PROPS } from './components/reexports';
|
|
25
|
+
export { GridColumnHeaders } from './components/GridColumnHeaders';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from '@mui/x-data-grid/internals';
|
|
2
2
|
export { DataGridProVirtualScroller } from '../components/DataGridProVirtualScroller';
|
|
3
|
-
export {
|
|
3
|
+
export { GridColumnHeaders } from '../components/GridColumnHeaders';
|
|
4
4
|
export { DATA_GRID_PRO_DEFAULT_SLOTS_COMPONENTS } from '../constants/dataGridProDefaultSlotsComponents';
|
|
5
5
|
export { useGridColumnResize, columnResizeStateInitializer } from '../hooks/features/columnResize/useGridColumnResize';
|
|
6
6
|
export { useGridColumnPinning, columnPinningStateInitializer } from '../hooks/features/columnPinning/useGridColumnPinning';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { GridPushPinRightIcon, GridPushPinLeftIcon } from './icons';
|
|
3
|
+
var iconSlots = {
|
|
4
|
+
ColumnMenuPinRightIcon: GridPushPinRightIcon,
|
|
5
|
+
ColumnMenuPinLeftIcon: GridPushPinLeftIcon
|
|
6
|
+
};
|
|
7
|
+
var materialSlots = _extends({}, iconSlots);
|
|
8
|
+
export default materialSlots;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export var getReleaseInfo = function getReleaseInfo() {
|
|
3
|
-
var releaseInfo = "
|
|
3
|
+
var releaseInfo = "MTY3ODMwMjAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { GridPushPinRightIcon, GridPushPinLeftIcon } from './icons';
|
|
3
|
+
const iconSlots = {
|
|
4
|
+
ColumnMenuPinRightIcon: GridPushPinRightIcon,
|
|
5
|
+
ColumnMenuPinLeftIcon: GridPushPinLeftIcon
|
|
6
|
+
};
|
|
7
|
+
const materialSlots = _extends({}, iconSlots);
|
|
8
|
+
export default materialSlots;
|
|
@@ -12,19 +12,15 @@ export interface GridExperimentalProFeatures extends GridExperimentalFeatures {
|
|
|
12
12
|
* Enables the data grid to lazy load rows while scrolling.
|
|
13
13
|
*/
|
|
14
14
|
lazyLoading: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Enables the ability for rows to be pinned in data grid.
|
|
17
|
-
*/
|
|
18
|
-
rowPinning: boolean;
|
|
19
15
|
}
|
|
20
16
|
interface DataGridProPropsWithComplexDefaultValueBeforeProcessing extends Omit<DataGridPropsWithComplexDefaultValueBeforeProcessing, 'components'> {
|
|
21
17
|
/**
|
|
22
|
-
*
|
|
18
|
+
* Overridable components.
|
|
23
19
|
* @deprecated Use the `slots` prop instead.
|
|
24
20
|
*/
|
|
25
21
|
components?: Partial<GridProSlotsComponent>;
|
|
26
22
|
/**
|
|
27
|
-
*
|
|
23
|
+
* Overridable components.
|
|
28
24
|
*/
|
|
29
25
|
slots?: Partial<UncapitalizedGridProSlotsComponent>;
|
|
30
26
|
}
|
|
@@ -2,12 +2,12 @@ import * as React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { useLicenseVerifier, Watermark } from '@mui/x-license-pro';
|
|
4
4
|
import { chainPropTypes } from '@mui/utils';
|
|
5
|
-
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider } from '@mui/x-data-grid';
|
|
5
|
+
import { GridBody, GridFooterPlaceholder, GridHeader, GridRoot, GridContextProvider, useGridSelector } from '@mui/x-data-grid';
|
|
6
6
|
import { useDataGridProComponent } from './useDataGridProComponent';
|
|
7
7
|
import { useDataGridProProps } from './useDataGridProProps';
|
|
8
8
|
import { DataGridProVirtualScroller } from '../components/DataGridProVirtualScroller';
|
|
9
|
-
import { DataGridProColumnHeaders } from '../components/DataGridProColumnHeaders';
|
|
10
9
|
import { getReleaseInfo } from '../utils/releaseInfo';
|
|
10
|
+
import { gridPinnedColumnsSelector } from '../hooks/features/columnPinning/gridColumnPinningSelector';
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
const releaseInfo = getReleaseInfo();
|
|
@@ -15,6 +15,7 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
|
|
|
15
15
|
const props = useDataGridProProps(inProps);
|
|
16
16
|
const privateApiRef = useDataGridProComponent(props.apiRef, props);
|
|
17
17
|
useLicenseVerifier('x-data-grid-pro', releaseInfo);
|
|
18
|
+
const pinnedColumns = useGridSelector(privateApiRef, gridPinnedColumnsSelector);
|
|
18
19
|
return /*#__PURE__*/_jsx(GridContextProvider, {
|
|
19
20
|
privateApiRef: privateApiRef,
|
|
20
21
|
props: props,
|
|
@@ -24,8 +25,10 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
|
|
|
24
25
|
sx: props.sx,
|
|
25
26
|
ref: ref,
|
|
26
27
|
children: [/*#__PURE__*/_jsx(GridHeader, {}), /*#__PURE__*/_jsx(GridBody, {
|
|
27
|
-
ColumnHeadersComponent: DataGridProColumnHeaders,
|
|
28
28
|
VirtualScrollerComponent: DataGridProVirtualScroller,
|
|
29
|
+
ColumnHeadersProps: {
|
|
30
|
+
pinnedColumns
|
|
31
|
+
},
|
|
29
32
|
children: /*#__PURE__*/_jsx(Watermark, {
|
|
30
33
|
packageName: "x-data-grid-pro",
|
|
31
34
|
releaseInfo: releaseInfo
|
|
@@ -114,12 +117,12 @@ DataGridProRaw.propTypes = {
|
|
|
114
117
|
*/
|
|
115
118
|
columnVisibilityModel: PropTypes.object,
|
|
116
119
|
/**
|
|
117
|
-
*
|
|
120
|
+
* Overridable components.
|
|
118
121
|
* @deprecated Use the `slots` prop instead.
|
|
119
122
|
*/
|
|
120
123
|
components: PropTypes.object,
|
|
121
124
|
/**
|
|
122
|
-
*
|
|
125
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
123
126
|
* @deprecated Use the `slotProps` prop instead.
|
|
124
127
|
*/
|
|
125
128
|
componentsProps: PropTypes.object,
|
|
@@ -220,7 +223,6 @@ DataGridProRaw.propTypes = {
|
|
|
220
223
|
experimentalFeatures: PropTypes.shape({
|
|
221
224
|
columnGrouping: PropTypes.bool,
|
|
222
225
|
lazyLoading: PropTypes.bool,
|
|
223
|
-
rowPinning: PropTypes.bool,
|
|
224
226
|
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
225
227
|
}),
|
|
226
228
|
/**
|
|
@@ -437,7 +439,7 @@ DataGridProRaw.propTypes = {
|
|
|
437
439
|
onCellKeyDown: PropTypes.func,
|
|
438
440
|
/**
|
|
439
441
|
* Callback fired when the `cellModesModel` prop changes.
|
|
440
|
-
* @param {GridCellModesModel} cellModesModel Object
|
|
442
|
+
* @param {GridCellModesModel} cellModesModel Object containing which cells are in "edit" mode.
|
|
441
443
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
442
444
|
*/
|
|
443
445
|
onCellModesModelChange: PropTypes.func,
|
|
@@ -616,7 +618,7 @@ DataGridProRaw.propTypes = {
|
|
|
616
618
|
onRowEditStop: PropTypes.func,
|
|
617
619
|
/**
|
|
618
620
|
* Callback fired when the `rowModesModel` prop changes.
|
|
619
|
-
* @param {GridRowModesModel} rowModesModel Object
|
|
621
|
+
* @param {GridRowModesModel} rowModesModel Object containing which rows are in "edit" mode.
|
|
620
622
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
621
623
|
*/
|
|
622
624
|
onRowModesModelChange: PropTypes.func,
|
|
@@ -774,11 +776,11 @@ DataGridProRaw.propTypes = {
|
|
|
774
776
|
*/
|
|
775
777
|
showColumnVerticalBorder: PropTypes.bool,
|
|
776
778
|
/**
|
|
777
|
-
*
|
|
779
|
+
* Overridable components props dynamically passed to the component at rendering.
|
|
778
780
|
*/
|
|
779
781
|
slotProps: PropTypes.object,
|
|
780
782
|
/**
|
|
781
|
-
*
|
|
783
|
+
* Overridable components.
|
|
782
784
|
*/
|
|
783
785
|
slots: PropTypes.object,
|
|
784
786
|
/**
|
|
@@ -176,7 +176,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
176
176
|
bottomPinnedRowsRenderZoneRef.current.style.transform = `translate3d(${left}px, 0px, 0px)`;
|
|
177
177
|
}
|
|
178
178
|
}, []);
|
|
179
|
-
const getRowProps = id => {
|
|
179
|
+
const getRowProps = React.useCallback(id => {
|
|
180
180
|
if (!expandedRowIds.includes(id)) {
|
|
181
181
|
return null;
|
|
182
182
|
}
|
|
@@ -186,7 +186,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
186
186
|
marginBottom: height
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
|
-
};
|
|
189
|
+
}, [detailPanelsHeights, expandedRowIds]);
|
|
190
190
|
const pinnedColumns = useGridSelector(apiRef, gridPinnedColumnsSelector);
|
|
191
191
|
const [leftPinnedColumns, rightPinnedColumns] = filterColumns(pinnedColumns, visibleColumnFields, theme.direction === 'rtl');
|
|
192
192
|
const pinnedRows = useGridSelector(apiRef, gridPinnedRowsSelector);
|