@mui/x-data-grid-pro 5.6.0 → 5.6.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 +43 -0
- package/DataGridPro/DataGridPro.js +18 -4
- package/DataGridPro/useDataGridProComponent.js +20 -10
- package/DataGridPro/useDataGridProProps.js +2 -2
- package/components/DataGridProVirtualScroller.js +6 -17
- package/components/GridDetailPanelToggleCell.js +2 -1
- package/components/GridTreeDataGroupingCell.js +2 -1
- package/components/index.d.ts +1 -0
- package/components/index.js +2 -1
- package/hooks/features/columnReorder/useGridColumnReorder.d.ts +2 -0
- package/hooks/features/columnReorder/useGridColumnReorder.js +6 -7
- package/hooks/features/columnResize/useGridColumnResize.d.ts +2 -0
- package/hooks/features/columnResize/useGridColumnResize.js +7 -7
- package/hooks/features/detailPanel/useGridDetailPanel.d.ts +2 -0
- package/hooks/features/detailPanel/useGridDetailPanel.js +9 -9
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/legacy/DataGridPro/DataGridPro.js +18 -4
- package/legacy/DataGridPro/useDataGridProComponent.js +20 -10
- package/legacy/DataGridPro/useDataGridProProps.js +7 -2
- package/legacy/components/DataGridProVirtualScroller.js +6 -16
- package/legacy/components/GridDetailPanelToggleCell.js +2 -1
- package/legacy/components/GridTreeDataGroupingCell.js +2 -1
- package/legacy/components/index.js +2 -1
- package/legacy/hooks/features/columnReorder/useGridColumnReorder.js +8 -9
- package/legacy/hooks/features/columnResize/useGridColumnResize.js +9 -9
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +9 -9
- package/legacy/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/legacy/index.js +2 -1
- package/modern/DataGridPro/DataGridPro.js +18 -4
- package/modern/DataGridPro/useDataGridProComponent.js +20 -10
- package/modern/DataGridPro/useDataGridProProps.js +2 -2
- package/modern/components/DataGridProVirtualScroller.js +6 -17
- package/modern/components/GridDetailPanelToggleCell.js +2 -1
- package/modern/components/GridTreeDataGroupingCell.js +2 -1
- package/modern/components/index.js +2 -1
- package/modern/hooks/features/columnReorder/useGridColumnReorder.js +6 -7
- package/modern/hooks/features/columnResize/useGridColumnResize.js +7 -7
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +8 -8
- package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/modern/index.js +2 -1
- package/node/DataGridPro/DataGridPro.js +18 -4
- package/node/DataGridPro/useDataGridProComponent.js +16 -6
- package/node/DataGridPro/useDataGridProProps.js +2 -2
- package/node/components/DataGridProVirtualScroller.js +5 -16
- package/node/components/GridDetailPanelToggleCell.js +2 -1
- package/node/components/GridTreeDataGroupingCell.js +2 -1
- package/node/components/index.js +13 -0
- package/node/hooks/features/columnReorder/useGridColumnReorder.js +9 -8
- package/node/hooks/features/columnResize/useGridColumnResize.js +9 -6
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +12 -9
- package/node/hooks/features/infiniteLoader/useGridInfiniteLoader.js +1 -1
- package/node/index.js +15 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 5.6.1
|
|
7
|
+
|
|
8
|
+
_Mar 10, 2022_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 8 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- [DataGrid] Allow to add margins or borders between rows (#3848) @m4theushw
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
<DataGrid getRowSpacing={() => ({ top: 10, bottom: 10 })} />
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Check the [documentation](https://mui.com/components/data-grid/rows/#row-spacing) for more information.
|
|
19
|
+
|
|
20
|
+
### `@mui/x-data-grid@v5.6.1` / `@mui/x-data-grid-pro@v5.6.1`
|
|
21
|
+
|
|
22
|
+
#### Changes
|
|
23
|
+
|
|
24
|
+
- [DataGrid] Display column's filter icon if a filter is applied (#4120) @DanailH
|
|
25
|
+
- [DataGrid] Do not loop through rows to compute top level rows count when the tree is flat (#4081) @flaviendelangle
|
|
26
|
+
- [DataGrid] Rename API method (#4148) @m4theushw
|
|
27
|
+
- [DataGrid] Support extending built-in column types (#4114) @cherniavskii
|
|
28
|
+
- [DataGridPro] Re-export the components removed by mistake during bundle split (#4134) @flaviendelangle
|
|
29
|
+
|
|
30
|
+
### Docs
|
|
31
|
+
|
|
32
|
+
- [docs] Fix links to prevent duplicate search result (#4130) @siriwatknp
|
|
33
|
+
- [docs] Fix outdated links to `localeTextConstants.ts` (#4080) @patilvishal755
|
|
34
|
+
- [docs] Neglect e2e tests related to search (#4118) @siriwatknp
|
|
35
|
+
- [docs] Use regex instead of specific url in e2e-website-tests (#4121) @siriwatknp
|
|
36
|
+
|
|
37
|
+
### Core
|
|
38
|
+
|
|
39
|
+
- [core] Enforce `noImplicitAny` (#4084) @cherniavskii
|
|
40
|
+
- [core] Improve the Pro support issue template (#4082) @oliviertassinari
|
|
41
|
+
- [core] Initialize remaining states before feature hooks (#4036) @m4theushw
|
|
42
|
+
- [core] Merge `page` and `pageSize` state initializer into a single `pagination` state initializer (#4087) @flaviendelangle
|
|
43
|
+
- [core] Prepare `yarn docs:api:build` scripts for multi packages support (#4111) @flaviendelangle
|
|
44
|
+
- [core] Upgrade `@mui/monorepo` (#4149) @cherniavskii
|
|
45
|
+
- [core] Use `buildWarning` and `wrapWithWarningOnCall` for deprecated methods and wrong usages (#4056) @flaviendelangle
|
|
46
|
+
- [test] Make focus state out-of-sync warning opt-in (#4129) @m4theushw
|
|
47
|
+
- [test] Only test custom input keyboard event in edit mode (#4075) @alexfauquette
|
|
48
|
+
|
|
6
49
|
## 5.6.0
|
|
7
50
|
|
|
8
51
|
_Mar 4, 2022_
|
|
@@ -12,7 +12,7 @@ import { DataGridProColumnHeaders } from '../components/DataGridProColumnHeaders
|
|
|
12
12
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
let RELEASE_INFO = "
|
|
15
|
+
let RELEASE_INFO = "MTY0Njg2NjgwMDAwMA=="; // eslint-disable-next-line no-useless-concat
|
|
16
16
|
|
|
17
17
|
if (process.env.NODE_ENV !== 'production' && RELEASE_INFO === '__RELEASE' + '_INFO__') {
|
|
18
18
|
// eslint-disable-next-line no-underscore-dangle
|
|
@@ -275,7 +275,8 @@ DataGridProRaw.propTypes = {
|
|
|
275
275
|
*/
|
|
276
276
|
experimentalFeatures: PropTypes.shape({
|
|
277
277
|
preventCommitWhileValidating: PropTypes.bool,
|
|
278
|
-
rowGrouping: PropTypes.bool
|
|
278
|
+
rowGrouping: PropTypes.bool,
|
|
279
|
+
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
279
280
|
}),
|
|
280
281
|
|
|
281
282
|
/**
|
|
@@ -328,7 +329,7 @@ DataGridProRaw.propTypes = {
|
|
|
328
329
|
|
|
329
330
|
/**
|
|
330
331
|
* Function that applies CSS classes dynamically on rows.
|
|
331
|
-
* @param {
|
|
332
|
+
* @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
|
|
332
333
|
* @returns {string} The CSS class to apply to the row.
|
|
333
334
|
*/
|
|
334
335
|
getRowClassName: PropTypes.func,
|
|
@@ -345,6 +346,13 @@ DataGridProRaw.propTypes = {
|
|
|
345
346
|
*/
|
|
346
347
|
getRowId: PropTypes.func,
|
|
347
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Function that allows to specify the spacing between rows.
|
|
351
|
+
* @param {GridRowSpacingParams} params With all properties from [[GridRowSpacingParams]].
|
|
352
|
+
* @returns {GridRowSpacing} The row spacing values.
|
|
353
|
+
*/
|
|
354
|
+
getRowSpacing: PropTypes.func,
|
|
355
|
+
|
|
348
356
|
/**
|
|
349
357
|
* Determines the path of a row in the tree data.
|
|
350
358
|
* For instance, a row with the path ["A", "B"] is the child of the row with the path ["A"].
|
|
@@ -432,7 +440,7 @@ DataGridProRaw.propTypes = {
|
|
|
432
440
|
|
|
433
441
|
/**
|
|
434
442
|
* Set the locale text of the grid.
|
|
435
|
-
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/
|
|
443
|
+
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
|
|
436
444
|
*/
|
|
437
445
|
localeText: PropTypes.object,
|
|
438
446
|
|
|
@@ -814,6 +822,12 @@ DataGridProRaw.propTypes = {
|
|
|
814
822
|
*/
|
|
815
823
|
rows: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
816
824
|
|
|
825
|
+
/**
|
|
826
|
+
* Sets the type of space between rows added by `getRowSpacing`.
|
|
827
|
+
* @default "margin"
|
|
828
|
+
*/
|
|
829
|
+
rowSpacingType: PropTypes.oneOf(['border', 'margin']),
|
|
830
|
+
|
|
817
831
|
/**
|
|
818
832
|
* Select the pageSize dynamically using the component UI.
|
|
819
833
|
* @default [25, 50, 100]
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboard, useGridKeyboardNavigation, useGridPagination,
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboard, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, useGridRows, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, editingStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer } from '@mui/x-data-grid/internals';
|
|
2
2
|
// Pro-only features
|
|
3
3
|
import { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
|
|
4
|
-
import { useGridColumnReorder } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
5
|
-
import { useGridColumnResize } from '../hooks/features/columnResize/useGridColumnResize';
|
|
4
|
+
import { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
5
|
+
import { useGridColumnResize, columnResizeStateInitializer } from '../hooks/features/columnResize/useGridColumnResize';
|
|
6
6
|
import { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
|
|
7
7
|
import { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
|
|
8
8
|
import { useGridRowGrouping, rowGroupingStateInitializer } from '../hooks/features/rowGrouping/useGridRowGrouping';
|
|
9
9
|
import { useGridRowGroupingPreProcessors } from '../hooks/features/rowGrouping/useGridRowGroupingPreProcessors';
|
|
10
10
|
import { useGridColumnPinning, columnPinningStateInitializer } from '../hooks/features/columnPinning/useGridColumnPinning';
|
|
11
11
|
import { useGridColumnPinningPreProcessors } from '../hooks/features/columnPinning/useGridColumnPinningPreProcessors';
|
|
12
|
-
import { useGridDetailPanel } from '../hooks/features/detailPanel/useGridDetailPanel';
|
|
12
|
+
import { useGridDetailPanel, detailPanelStateInitializer } from '../hooks/features/detailPanel/useGridDetailPanel';
|
|
13
13
|
import { useGridDetailPanelCache } from '../hooks/features/detailPanel/useGridDetailPanelCache';
|
|
14
14
|
import { useGridDetailPanelPreProcessors } from '../hooks/features/detailPanel/useGridDetailPanelPreProcessors';
|
|
15
15
|
export const useDataGridProComponent = (inputApiRef, props) => {
|
|
@@ -28,18 +28,28 @@ export const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
28
28
|
* Register all state initializers here.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
useGridInitializeState(
|
|
32
|
-
useGridInitializeState(
|
|
33
|
-
useGridInitializeState(pageStateInitializer, apiRef, props);
|
|
34
|
-
useGridInitializeState(sortingStateInitializer, apiRef, props);
|
|
31
|
+
useGridInitializeState(selectionStateInitializer, apiRef, props);
|
|
32
|
+
useGridInitializeState(detailPanelStateInitializer, apiRef, props);
|
|
35
33
|
useGridInitializeState(columnPinningStateInitializer, apiRef, props);
|
|
36
|
-
useGridInitializeState(rowGroupingStateInitializer, apiRef, props);
|
|
34
|
+
useGridInitializeState(rowGroupingStateInitializer, apiRef, props); // FIXME Call in the same relative position that useGridRowGrouping is called
|
|
35
|
+
|
|
37
36
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
38
37
|
useGridRowGrouping(apiRef, props); // FIXME Needs to be called before the rows state initialization because it registers a rows group builder
|
|
39
38
|
|
|
40
39
|
useGridTreeData(apiRef, props); // FIXME Needs to be called before the rows state initialization because it registers a rows group builder
|
|
41
40
|
|
|
42
41
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
42
|
+
useGridInitializeState(editingStateInitializer, apiRef, props);
|
|
43
|
+
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
44
|
+
useGridInitializeState(sortingStateInitializer, apiRef, props);
|
|
45
|
+
useGridInitializeState(preferencePanelStateInitializer, apiRef, props);
|
|
46
|
+
useGridInitializeState(filterStateInitializer, apiRef, props);
|
|
47
|
+
useGridInitializeState(densityStateInitializer, apiRef, props);
|
|
48
|
+
useGridInitializeState(columnReorderStateInitializer, apiRef, props);
|
|
49
|
+
useGridInitializeState(columnResizeStateInitializer, apiRef, props);
|
|
50
|
+
useGridInitializeState(paginationStateInitializer, apiRef, props);
|
|
51
|
+
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
52
|
+
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
43
53
|
useGridSelection(apiRef, props);
|
|
44
54
|
useGridDetailPanel(apiRef, props);
|
|
45
55
|
useGridColumnPinning(apiRef, props);
|
|
@@ -50,7 +60,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
50
60
|
useGridEditing(apiRef, props);
|
|
51
61
|
useGridFocus(apiRef, props);
|
|
52
62
|
useGridSorting(apiRef, props);
|
|
53
|
-
useGridPreferencesPanel(apiRef
|
|
63
|
+
useGridPreferencesPanel(apiRef);
|
|
54
64
|
useGridFilter(apiRef, props);
|
|
55
65
|
useGridDensity(apiRef, props);
|
|
56
66
|
useGridColumnReorder(apiRef, props);
|
|
@@ -31,8 +31,8 @@ export const useDataGridProProps = inProps => {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
const mergedComponents = {};
|
|
34
|
-
Object.
|
|
35
|
-
mergedComponents[key] = overrides[key] === undefined ?
|
|
34
|
+
Object.entries(DATA_GRID_DEFAULT_SLOTS_COMPONENTS).forEach(([key, defaultComponent]) => {
|
|
35
|
+
mergedComponents[key] = overrides[key] === undefined ? defaultComponent : overrides[key];
|
|
36
36
|
});
|
|
37
37
|
return mergedComponents;
|
|
38
38
|
}, [themedProps.components]);
|
|
@@ -6,7 +6,7 @@ import { styled, alpha } from '@mui/material/styles';
|
|
|
6
6
|
import Box from '@mui/material/Box';
|
|
7
7
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
8
8
|
import { useGridSelector, getDataGridUtilityClass, gridClasses, gridVisibleColumnFieldsSelector, gridRowsMetaSelector, useGridApiEventHandler, GridEvents } from '@mui/x-data-grid';
|
|
9
|
-
import {
|
|
9
|
+
import { GridVirtualScroller, GridVirtualScrollerContent, GridVirtualScrollerRenderZone, useGridVirtualScroller } from '@mui/x-data-grid/internals';
|
|
10
10
|
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
|
|
11
11
|
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
12
12
|
import { gridPinnedColumnsSelector, GridPinnedPosition } from '../hooks/features/columnPinning';
|
|
@@ -115,7 +115,6 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
115
115
|
|
|
116
116
|
const apiRef = useGridApiContext();
|
|
117
117
|
const rootProps = useGridRootProps();
|
|
118
|
-
const currentPage = useCurrentPageRows(apiRef, rootProps);
|
|
119
118
|
const visibleColumnFields = useGridSelector(apiRef, gridVisibleColumnFieldsSelector);
|
|
120
119
|
const expandedRowIds = useGridSelector(apiRef, gridDetailPanelExpandedRowIdsSelector);
|
|
121
120
|
const detailPanelsContent = useGridSelector(apiRef, gridDetailPanelExpandedRowsContentCacheSelector);
|
|
@@ -191,18 +190,6 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
191
190
|
const pinnedColumnsStyle = {
|
|
192
191
|
minHeight: contentProps.style.minHeight
|
|
193
192
|
};
|
|
194
|
-
const rowsLookup = React.useMemo(() => {
|
|
195
|
-
if (rootProps.getDetailPanelContent == null) {
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return currentPage.rows.reduce((acc, {
|
|
200
|
-
id
|
|
201
|
-
}, index) => {
|
|
202
|
-
acc[id] = index;
|
|
203
|
-
return acc;
|
|
204
|
-
}, {});
|
|
205
|
-
}, [currentPage.rows, rootProps.getDetailPanelContent]);
|
|
206
193
|
|
|
207
194
|
const getDetailPanels = () => {
|
|
208
195
|
const panels = [];
|
|
@@ -218,12 +205,14 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
218
205
|
const id = uniqueExpandedRowIds[i];
|
|
219
206
|
const content = detailPanelsContent[id]; // Check if the id exists in the current page
|
|
220
207
|
|
|
221
|
-
const
|
|
208
|
+
const rowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(id);
|
|
209
|
+
const exists = rowIndex !== undefined;
|
|
222
210
|
|
|
223
211
|
if ( /*#__PURE__*/React.isValidElement(content) && exists) {
|
|
224
212
|
const height = detailPanelsHeights[id];
|
|
225
|
-
const
|
|
226
|
-
const
|
|
213
|
+
const sizes = apiRef.current.unstable_getRowInternalSizes(id);
|
|
214
|
+
const spacingTop = (sizes == null ? void 0 : sizes.spacingTop) || 0;
|
|
215
|
+
const top = rowsMeta.positions[rowIndex] + apiRef.current.unstable_getRowHeight(id) + spacingTop;
|
|
227
216
|
panels.push( /*#__PURE__*/_jsx(VirtualScrollerDetailPanel, {
|
|
228
217
|
style: {
|
|
229
218
|
top,
|
|
@@ -54,8 +54,9 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* GridApi that let you manipulate the grid.
|
|
57
|
+
* @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
|
|
57
58
|
*/
|
|
58
|
-
api: PropTypes.
|
|
59
|
+
api: PropTypes.any.isRequired,
|
|
59
60
|
|
|
60
61
|
/**
|
|
61
62
|
* The mode of the cell.
|
|
@@ -88,8 +88,9 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* GridApi that let you manipulate the grid.
|
|
91
|
+
* @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
|
|
91
92
|
*/
|
|
92
|
-
api: PropTypes.
|
|
93
|
+
api: PropTypes.any.isRequired,
|
|
93
94
|
|
|
94
95
|
/**
|
|
95
96
|
* The mode of the cell.
|
package/components/index.d.ts
CHANGED
package/components/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
// Only export the variable and types that should be publicly exposed and re-exported from `@mui/x-data-grid-pro`
|
|
2
2
|
export * from './GridTreeDataGroupingCell';
|
|
3
|
-
export * from './GridColumnPinningMenuItems';
|
|
3
|
+
export * from './GridColumnPinningMenuItems';
|
|
4
|
+
export * from './GridDetailPanelToggleCell';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { GridStateInitializer } from '@mui/x-data-grid/internals';
|
|
2
3
|
import { GridApiPro } from '../../../models/gridApiPro';
|
|
3
4
|
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
5
|
+
export declare const columnReorderStateInitializer: GridStateInitializer;
|
|
4
6
|
/**
|
|
5
7
|
* Only available in DataGridPro
|
|
6
8
|
* @requires useGridColumns (method)
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
4
4
|
import { useGridApiEventHandler, getDataGridUtilityClass, GridEvents, useGridLogger } from '@mui/x-data-grid';
|
|
5
|
-
import { useGridStateInit } from '@mui/x-data-grid/internals';
|
|
6
5
|
import { gridColumnReorderDragColSelector } from './columnReorderSelector';
|
|
7
6
|
const CURSOR_MOVE_DIRECTION_LEFT = 'left';
|
|
8
7
|
const CURSOR_MOVE_DIRECTION_RIGHT = 'right';
|
|
@@ -22,19 +21,19 @@ const useUtilityClasses = ownerState => {
|
|
|
22
21
|
};
|
|
23
22
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
24
23
|
};
|
|
24
|
+
|
|
25
|
+
export const columnReorderStateInitializer = state => _extends({}, state, {
|
|
26
|
+
columnReorder: {
|
|
27
|
+
dragCol: ''
|
|
28
|
+
}
|
|
29
|
+
});
|
|
25
30
|
/**
|
|
26
31
|
* Only available in DataGridPro
|
|
27
32
|
* @requires useGridColumns (method)
|
|
28
33
|
*/
|
|
29
34
|
|
|
30
|
-
|
|
31
35
|
export const useGridColumnReorder = (apiRef, props) => {
|
|
32
36
|
const logger = useGridLogger(apiRef, 'useGridColumnReorder');
|
|
33
|
-
useGridStateInit(apiRef, state => _extends({}, state, {
|
|
34
|
-
columnReorder: {
|
|
35
|
-
dragCol: ''
|
|
36
|
-
}
|
|
37
|
-
}));
|
|
38
37
|
const dragColNode = React.useRef(null);
|
|
39
38
|
const cursorPosition = React.useRef({
|
|
40
39
|
x: 0,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { GridStateInitializer } from '@mui/x-data-grid/internals';
|
|
2
3
|
import { GridApiPro } from '../../../models/gridApiPro';
|
|
3
4
|
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
5
|
+
export declare const columnResizeStateInitializer: GridStateInitializer;
|
|
4
6
|
/**
|
|
5
7
|
* Only available in DataGridPro
|
|
6
8
|
* @requires useGridColumns (method, event)
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { ownerDocument, useEventCallback } from '@mui/material/utils';
|
|
4
4
|
import { GridEvents, gridClasses, GridColumnHeaderSeparatorSides, useGridApiEventHandler, useGridApiOptionHandler, useGridNativeEventListener, useGridLogger } from '@mui/x-data-grid';
|
|
5
|
-
import {
|
|
5
|
+
import { clamp, findParentElementFromClassName } from '@mui/x-data-grid/internals';
|
|
6
6
|
import { findGridCellElementsFromCol, getFieldFromHeaderElem, findHeaderElementFromField } from '../../../utils/domUtils';
|
|
7
7
|
// TODO: remove support for Safari < 13.
|
|
8
8
|
// https://caniuse.com/#search=touch-action
|
|
@@ -73,20 +73,20 @@ function computeOffsetToSeparator(clickX, columnBounds, separatorSide) {
|
|
|
73
73
|
function getSeparatorSide(element) {
|
|
74
74
|
return element.classList.contains(gridClasses['columnSeparator--sideRight']) ? GridColumnHeaderSeparatorSides.Right : GridColumnHeaderSeparatorSides.Left;
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
export const columnResizeStateInitializer = state => _extends({}, state, {
|
|
78
|
+
columnResize: {
|
|
79
|
+
resizingColumnField: ''
|
|
80
|
+
}
|
|
81
|
+
});
|
|
76
82
|
/**
|
|
77
83
|
* Only available in DataGridPro
|
|
78
84
|
* @requires useGridColumns (method, event)
|
|
79
85
|
* TODO: improve experience for last column
|
|
80
86
|
*/
|
|
81
87
|
|
|
82
|
-
|
|
83
88
|
export const useGridColumnResize = (apiRef, props) => {
|
|
84
89
|
const logger = useGridLogger(apiRef, 'useGridColumnResize');
|
|
85
|
-
useGridStateInit(apiRef, state => _extends({}, state, {
|
|
86
|
-
columnResize: {
|
|
87
|
-
resizingColumnField: ''
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
90
|
const colDefRef = React.useRef();
|
|
91
91
|
const colElementRef = React.useRef();
|
|
92
92
|
const colCellElementsRef = React.useRef(); // To improve accessibility, the separator has padding on both sides.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { GridStateInitializer } from '@mui/x-data-grid/internals';
|
|
2
3
|
import { GridApiPro } from '../../../models/gridApiPro';
|
|
3
4
|
import { DataGridProProcessedProps } from '../../../models/dataGridProProps';
|
|
5
|
+
export declare const detailPanelStateInitializer: GridStateInitializer<Pick<DataGridProProcessedProps, 'initialState' | 'detailPanelExpandedRowIds'>>;
|
|
4
6
|
export declare const useGridDetailPanel: (apiRef: React.MutableRefObject<GridApiPro>, props: Pick<DataGridProProcessedProps, 'initialState' | 'getDetailPanelContent' | 'getDetailPanelHeight' | 'detailPanelExpandedRowIds' | 'onDetailPanelExpandedRowIdsChange' | 'pagination' | 'paginationMode'>) => void;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { GridEvents, useGridSelector, useGridApiEventHandler, useGridApiMethod } from '@mui/x-data-grid';
|
|
4
|
-
import {
|
|
4
|
+
import { useGridRegisterPreProcessor } from '@mui/x-data-grid/internals';
|
|
5
5
|
import { GRID_DETAIL_PANEL_TOGGLE_FIELD } from './gridDetailPanelToggleColDef';
|
|
6
6
|
import { gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridDetailPanelExpandedRowsHeightCacheSelector } from './gridDetailPanelSelector';
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
var _ref, _props$detailPanelExp, _props$initialState, _props$initialState$d;
|
|
7
|
+
export const detailPanelStateInitializer = (state, props) => {
|
|
8
|
+
var _ref, _props$detailPanelExp, _props$initialState, _props$initialState$d;
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
10
|
+
return _extends({}, state, {
|
|
11
|
+
detailPanel: {
|
|
12
|
+
expandedRowIds: (_ref = (_props$detailPanelExp = props.detailPanelExpandedRowIds) != null ? _props$detailPanelExp : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$d = _props$initialState.detailPanel) == null ? void 0 : _props$initialState$d.expandedRowIds) != null ? _ref : []
|
|
13
|
+
}
|
|
16
14
|
});
|
|
15
|
+
};
|
|
16
|
+
export const useGridDetailPanel = (apiRef, props) => {
|
|
17
17
|
const expandedRowIds = useGridSelector(apiRef, gridDetailPanelExpandedRowIdsSelector);
|
|
18
18
|
const contentCache = useGridSelector(apiRef, gridDetailPanelExpandedRowsContentCacheSelector);
|
|
19
19
|
const handleCellClick = React.useCallback((params, event) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useGridSelector, GridEvents, useGridApiEventHandler, useGridApiOptionHandler, gridVisibleColumnDefinitionsSelector, gridRowsMetaSelector } from '@mui/x-data-grid';
|
|
3
|
-
import {
|
|
3
|
+
import { useGridVisibleRows } from '@mui/x-data-grid/internals';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Only available in DataGridPro
|
|
@@ -10,7 +10,7 @@ import { useCurrentPageRows } from '@mui/x-data-grid/internals';
|
|
|
10
10
|
*/
|
|
11
11
|
export const useGridInfiniteLoader = (apiRef, props) => {
|
|
12
12
|
const visibleColumns = useGridSelector(apiRef, gridVisibleColumnDefinitionsSelector);
|
|
13
|
-
const currentPage =
|
|
13
|
+
const currentPage = useGridVisibleRows(apiRef, props);
|
|
14
14
|
const rowsMeta = useGridSelector(apiRef, gridRowsMetaSelector);
|
|
15
15
|
const contentHeight = Math.max(rowsMeta.currentPageTotalHeight, 1);
|
|
16
16
|
const isInScrollBottomArea = React.useRef(false);
|
package/index.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ export * from '@mui/x-data-grid/utils';
|
|
|
11
11
|
export * from './DataGridPro';
|
|
12
12
|
export * from './hooks';
|
|
13
13
|
export * from './models';
|
|
14
|
+
export * from './components';
|
|
14
15
|
export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
|
|
15
16
|
export type { GridApiRef, GridApi, GridInitialState, GridState } from './typeOverloads/reexports';
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license MUI v5.6.
|
|
1
|
+
/** @license MUI v5.6.1
|
|
2
2
|
*
|
|
3
3
|
* This source code is licensed under the MIT license found in the
|
|
4
4
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -16,4 +16,5 @@ export * from '@mui/x-data-grid/utils';
|
|
|
16
16
|
export * from './DataGridPro';
|
|
17
17
|
export * from './hooks';
|
|
18
18
|
export * from './models';
|
|
19
|
+
export * from './components';
|
|
19
20
|
export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
|
|
@@ -12,7 +12,7 @@ import { DataGridProColumnHeaders } from '../components/DataGridProColumnHeaders
|
|
|
12
12
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
var RELEASE_INFO = "
|
|
15
|
+
var RELEASE_INFO = "MTY0Njg2NjgwMDAwMA=="; // eslint-disable-next-line no-useless-concat
|
|
16
16
|
|
|
17
17
|
if (process.env.NODE_ENV !== 'production' && RELEASE_INFO === '__RELEASE' + '_INFO__') {
|
|
18
18
|
// eslint-disable-next-line no-underscore-dangle
|
|
@@ -275,7 +275,8 @@ DataGridProRaw.propTypes = {
|
|
|
275
275
|
*/
|
|
276
276
|
experimentalFeatures: PropTypes.shape({
|
|
277
277
|
preventCommitWhileValidating: PropTypes.bool,
|
|
278
|
-
rowGrouping: PropTypes.bool
|
|
278
|
+
rowGrouping: PropTypes.bool,
|
|
279
|
+
warnIfFocusStateIsNotSynced: PropTypes.bool
|
|
279
280
|
}),
|
|
280
281
|
|
|
281
282
|
/**
|
|
@@ -328,7 +329,7 @@ DataGridProRaw.propTypes = {
|
|
|
328
329
|
|
|
329
330
|
/**
|
|
330
331
|
* Function that applies CSS classes dynamically on rows.
|
|
331
|
-
* @param {
|
|
332
|
+
* @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
|
|
332
333
|
* @returns {string} The CSS class to apply to the row.
|
|
333
334
|
*/
|
|
334
335
|
getRowClassName: PropTypes.func,
|
|
@@ -345,6 +346,13 @@ DataGridProRaw.propTypes = {
|
|
|
345
346
|
*/
|
|
346
347
|
getRowId: PropTypes.func,
|
|
347
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Function that allows to specify the spacing between rows.
|
|
351
|
+
* @param {GridRowSpacingParams} params With all properties from [[GridRowSpacingParams]].
|
|
352
|
+
* @returns {GridRowSpacing} The row spacing values.
|
|
353
|
+
*/
|
|
354
|
+
getRowSpacing: PropTypes.func,
|
|
355
|
+
|
|
348
356
|
/**
|
|
349
357
|
* Determines the path of a row in the tree data.
|
|
350
358
|
* For instance, a row with the path ["A", "B"] is the child of the row with the path ["A"].
|
|
@@ -432,7 +440,7 @@ DataGridProRaw.propTypes = {
|
|
|
432
440
|
|
|
433
441
|
/**
|
|
434
442
|
* Set the locale text of the grid.
|
|
435
|
-
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/
|
|
443
|
+
* You can find all the translation keys supported in [the source](https://github.com/mui/mui-x/blob/HEAD/packages/grid/x-data-grid/src/constants/localeTextConstants.ts) in the GitHub repository.
|
|
436
444
|
*/
|
|
437
445
|
localeText: PropTypes.object,
|
|
438
446
|
|
|
@@ -814,6 +822,12 @@ DataGridProRaw.propTypes = {
|
|
|
814
822
|
*/
|
|
815
823
|
rows: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
816
824
|
|
|
825
|
+
/**
|
|
826
|
+
* Sets the type of space between rows added by `getRowSpacing`.
|
|
827
|
+
* @default "margin"
|
|
828
|
+
*/
|
|
829
|
+
rowSpacingType: PropTypes.oneOf(['border', 'margin']),
|
|
830
|
+
|
|
817
831
|
/**
|
|
818
832
|
* Select the pageSize dynamically using the component UI.
|
|
819
833
|
* @default [25, 50, 100]
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboard, useGridKeyboardNavigation, useGridPagination,
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboard, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, useGridRows, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, editingStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, selectionStateInitializer } from '@mui/x-data-grid/internals';
|
|
2
2
|
// Pro-only features
|
|
3
3
|
import { useGridInfiniteLoader } from '../hooks/features/infiniteLoader/useGridInfiniteLoader';
|
|
4
|
-
import { useGridColumnReorder } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
5
|
-
import { useGridColumnResize } from '../hooks/features/columnResize/useGridColumnResize';
|
|
4
|
+
import { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
5
|
+
import { useGridColumnResize, columnResizeStateInitializer } from '../hooks/features/columnResize/useGridColumnResize';
|
|
6
6
|
import { useGridTreeData } from '../hooks/features/treeData/useGridTreeData';
|
|
7
7
|
import { useGridTreeDataPreProcessors } from '../hooks/features/treeData/useGridTreeDataPreProcessors';
|
|
8
8
|
import { useGridRowGrouping, rowGroupingStateInitializer } from '../hooks/features/rowGrouping/useGridRowGrouping';
|
|
9
9
|
import { useGridRowGroupingPreProcessors } from '../hooks/features/rowGrouping/useGridRowGroupingPreProcessors';
|
|
10
10
|
import { useGridColumnPinning, columnPinningStateInitializer } from '../hooks/features/columnPinning/useGridColumnPinning';
|
|
11
11
|
import { useGridColumnPinningPreProcessors } from '../hooks/features/columnPinning/useGridColumnPinningPreProcessors';
|
|
12
|
-
import { useGridDetailPanel } from '../hooks/features/detailPanel/useGridDetailPanel';
|
|
12
|
+
import { useGridDetailPanel, detailPanelStateInitializer } from '../hooks/features/detailPanel/useGridDetailPanel';
|
|
13
13
|
import { useGridDetailPanelCache } from '../hooks/features/detailPanel/useGridDetailPanelCache';
|
|
14
14
|
import { useGridDetailPanelPreProcessors } from '../hooks/features/detailPanel/useGridDetailPanelPreProcessors';
|
|
15
15
|
export var useDataGridProComponent = function useDataGridProComponent(inputApiRef, props) {
|
|
@@ -28,18 +28,28 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
|
|
|
28
28
|
* Register all state initializers here.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
useGridInitializeState(
|
|
32
|
-
useGridInitializeState(
|
|
33
|
-
useGridInitializeState(pageStateInitializer, apiRef, props);
|
|
34
|
-
useGridInitializeState(sortingStateInitializer, apiRef, props);
|
|
31
|
+
useGridInitializeState(selectionStateInitializer, apiRef, props);
|
|
32
|
+
useGridInitializeState(detailPanelStateInitializer, apiRef, props);
|
|
35
33
|
useGridInitializeState(columnPinningStateInitializer, apiRef, props);
|
|
36
|
-
useGridInitializeState(rowGroupingStateInitializer, apiRef, props);
|
|
34
|
+
useGridInitializeState(rowGroupingStateInitializer, apiRef, props); // FIXME Call in the same relative position that useGridRowGrouping is called
|
|
35
|
+
|
|
37
36
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
38
37
|
useGridRowGrouping(apiRef, props); // FIXME Needs to be called before the rows state initialization because it registers a rows group builder
|
|
39
38
|
|
|
40
39
|
useGridTreeData(apiRef, props); // FIXME Needs to be called before the rows state initialization because it registers a rows group builder
|
|
41
40
|
|
|
42
41
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
42
|
+
useGridInitializeState(editingStateInitializer, apiRef, props);
|
|
43
|
+
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
44
|
+
useGridInitializeState(sortingStateInitializer, apiRef, props);
|
|
45
|
+
useGridInitializeState(preferencePanelStateInitializer, apiRef, props);
|
|
46
|
+
useGridInitializeState(filterStateInitializer, apiRef, props);
|
|
47
|
+
useGridInitializeState(densityStateInitializer, apiRef, props);
|
|
48
|
+
useGridInitializeState(columnReorderStateInitializer, apiRef, props);
|
|
49
|
+
useGridInitializeState(columnResizeStateInitializer, apiRef, props);
|
|
50
|
+
useGridInitializeState(paginationStateInitializer, apiRef, props);
|
|
51
|
+
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
52
|
+
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
43
53
|
useGridSelection(apiRef, props);
|
|
44
54
|
useGridDetailPanel(apiRef, props);
|
|
45
55
|
useGridColumnPinning(apiRef, props);
|
|
@@ -50,7 +60,7 @@ export var useDataGridProComponent = function useDataGridProComponent(inputApiRe
|
|
|
50
60
|
useGridEditing(apiRef, props);
|
|
51
61
|
useGridFocus(apiRef, props);
|
|
52
62
|
useGridSorting(apiRef, props);
|
|
53
|
-
useGridPreferencesPanel(apiRef
|
|
63
|
+
useGridPreferencesPanel(apiRef);
|
|
54
64
|
useGridFilter(apiRef, props);
|
|
55
65
|
useGridDensity(apiRef, props);
|
|
56
66
|
useGridColumnReorder(apiRef, props);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { useThemeProps } from '@mui/material/styles';
|
|
@@ -35,8 +36,12 @@ export var useDataGridProProps = function useDataGridProProps(inProps) {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
var mergedComponents = {};
|
|
38
|
-
Object.
|
|
39
|
-
|
|
39
|
+
Object.entries(DATA_GRID_DEFAULT_SLOTS_COMPONENTS).forEach(function (_ref) {
|
|
40
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
41
|
+
key = _ref2[0],
|
|
42
|
+
defaultComponent = _ref2[1];
|
|
43
|
+
|
|
44
|
+
mergedComponents[key] = overrides[key] === undefined ? defaultComponent : overrides[key];
|
|
40
45
|
});
|
|
41
46
|
return mergedComponents;
|
|
42
47
|
}, [themedProps.components]);
|