@mui/x-data-grid-pro 5.7.0 → 5.10.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 +241 -53
- package/DataGridPro/DataGridPro.d.ts +7 -1
- package/DataGridPro/DataGridPro.js +44 -6
- package/DataGridPro/useDataGridProComponent.js +8 -4
- package/DataGridPro/useDataGridProProps.d.ts +2 -1
- package/DataGridPro/useDataGridProProps.js +1 -0
- package/LICENSE +12 -0
- package/README.md +6 -4
- package/components/DataGridProColumnHeaders.js +0 -6
- package/components/DataGridProVirtualScroller.js +1 -3
- package/components/GridDetailPanelToggleCell.js +15 -4
- package/components/GridGroupingCriteriaCell.d.ts +2 -5
- package/components/GridGroupingCriteriaCell.js +2 -74
- package/components/GridRowReorderCell.d.ts +5 -0
- package/components/GridRowReorderCell.js +72 -0
- package/components/GridTreeDataGroupingCell.js +15 -4
- package/hooks/features/columnPinning/useGridColumnPinning.js +6 -6
- package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -2
- package/hooks/features/columnReorder/useGridColumnReorder.js +3 -3
- package/hooks/features/columnResize/useGridColumnResize.js +18 -6
- package/hooks/features/detailPanel/useGridDetailPanel.js +12 -4
- package/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
- package/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
- package/hooks/features/index.d.ts +1 -0
- package/hooks/features/index.js +1 -0
- package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +1 -1
- package/hooks/features/rowGrouping/useGridRowGrouping.js +6 -8
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/hooks/features/rowReorder/gridRowReorderColDef.d.ts +2 -0
- package/hooks/features/rowReorder/gridRowReorderColDef.js +18 -0
- package/hooks/features/rowReorder/index.d.ts +1 -0
- package/hooks/features/rowReorder/index.js +1 -0
- package/hooks/features/rowReorder/useGridRowReorder.d.ts +8 -0
- package/hooks/features/rowReorder/useGridRowReorder.js +111 -0
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.d.ts +4 -0
- package/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +51 -0
- package/hooks/features/treeData/useGridTreeData.js +0 -2
- package/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/legacy/DataGridPro/DataGridPro.js +44 -6
- package/legacy/DataGridPro/useDataGridProComponent.js +8 -4
- package/legacy/DataGridPro/useDataGridProProps.js +1 -0
- package/legacy/components/DataGridProColumnHeaders.js +0 -6
- package/legacy/components/DataGridProVirtualScroller.js +1 -3
- package/legacy/components/GridDetailPanelToggleCell.js +15 -4
- package/legacy/components/GridGroupingCriteriaCell.js +2 -74
- package/legacy/components/GridRowReorderCell.js +74 -0
- package/legacy/components/GridTreeDataGroupingCell.js +15 -4
- package/legacy/hooks/features/columnPinning/useGridColumnPinning.js +6 -6
- package/legacy/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -2
- package/legacy/hooks/features/columnReorder/useGridColumnReorder.js +3 -3
- package/legacy/hooks/features/columnResize/useGridColumnResize.js +18 -6
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +12 -4
- package/legacy/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
- package/legacy/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
- package/legacy/hooks/features/index.js +1 -0
- package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +6 -8
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/legacy/hooks/features/rowReorder/gridRowReorderColDef.js +20 -0
- package/legacy/hooks/features/rowReorder/index.js +1 -0
- package/legacy/hooks/features/rowReorder/useGridRowReorder.js +115 -0
- package/legacy/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +52 -0
- package/legacy/hooks/features/treeData/useGridTreeData.js +0 -2
- package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
- package/legacy/index.js +2 -2
- package/legacy/models/gridRowOrderChangeParams.js +1 -0
- package/legacy/models/index.js +1 -0
- package/legacy/utils/domUtils.js +30 -3
- package/legacy/utils/releaseInfo.js +1 -1
- package/models/dataGridProProps.d.ts +21 -8
- package/models/gridGroupingColDefOverride.d.ts +2 -2
- package/models/gridGroupingValueGetterParams.d.ts +1 -1
- package/models/gridRowOrderChangeParams.d.ts +18 -0
- package/models/gridRowOrderChangeParams.js +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/modern/DataGridPro/DataGridPro.js +44 -6
- package/modern/DataGridPro/useDataGridProComponent.js +8 -4
- package/modern/DataGridPro/useDataGridProProps.js +1 -0
- package/modern/components/DataGridProColumnHeaders.js +0 -6
- package/modern/components/DataGridProVirtualScroller.js +1 -3
- package/modern/components/GridDetailPanelToggleCell.js +15 -4
- package/modern/components/GridGroupingCriteriaCell.js +2 -74
- package/modern/components/GridRowReorderCell.js +72 -0
- package/modern/components/GridTreeDataGroupingCell.js +15 -4
- package/modern/hooks/features/columnPinning/useGridColumnPinning.js +6 -6
- package/modern/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -2
- package/modern/hooks/features/columnReorder/useGridColumnReorder.js +3 -3
- package/modern/hooks/features/columnResize/useGridColumnResize.js +18 -6
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +12 -4
- package/modern/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
- package/modern/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
- package/modern/hooks/features/index.js +1 -0
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +6 -8
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +2 -2
- package/modern/hooks/features/rowReorder/gridRowReorderColDef.js +18 -0
- package/modern/hooks/features/rowReorder/index.js +1 -0
- package/modern/hooks/features/rowReorder/useGridRowReorder.js +111 -0
- package/modern/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +51 -0
- package/modern/hooks/features/treeData/useGridTreeData.js +0 -2
- package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +2 -2
- package/modern/index.js +2 -2
- package/modern/models/gridRowOrderChangeParams.js +1 -0
- package/modern/models/index.js +1 -0
- package/modern/utils/domUtils.js +30 -3
- package/modern/utils/releaseInfo.js +1 -1
- package/node/DataGridPro/DataGridPro.js +44 -6
- package/node/DataGridPro/useDataGridProComponent.js +9 -3
- package/node/DataGridPro/useDataGridProProps.js +1 -0
- package/node/components/DataGridProColumnHeaders.js +0 -6
- package/node/components/DataGridProVirtualScroller.js +1 -3
- package/node/components/GridDetailPanelToggleCell.js +15 -4
- package/node/components/GridGroupingCriteriaCell.js +1 -72
- package/node/components/GridRowReorderCell.js +92 -0
- package/node/components/GridTreeDataGroupingCell.js +15 -4
- package/node/hooks/features/columnPinning/useGridColumnPinning.js +5 -5
- package/node/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +1 -1
- package/node/hooks/features/columnReorder/useGridColumnReorder.js +3 -3
- package/node/hooks/features/columnResize/useGridColumnResize.js +18 -6
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +11 -3
- package/node/hooks/features/detailPanel/useGridDetailPanelCache.js +1 -1
- package/node/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +1 -1
- package/node/hooks/features/index.js +13 -0
- package/node/hooks/features/rowGrouping/useGridRowGrouping.js +5 -7
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +1 -1
- package/node/hooks/features/rowReorder/gridRowReorderColDef.js +31 -0
- package/node/hooks/features/rowReorder/index.js +18 -0
- package/node/hooks/features/rowReorder/useGridRowReorder.js +126 -0
- package/node/hooks/features/rowReorder/useGridRowReorderPreProcessors.js +70 -0
- package/node/hooks/features/treeData/useGridTreeData.js +0 -2
- package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +1 -1
- package/node/index.js +9 -9
- package/node/models/gridRowOrderChangeParams.js +5 -0
- package/node/models/index.js +13 -0
- package/node/utils/domUtils.js +30 -3
- package/node/utils/releaseInfo.js +1 -1
- package/package.json +7 -7
- package/typeOverloads/modules.d.ts +10 -7
- package/typeOverloads/reexports.d.ts +1 -1
- package/utils/domUtils.d.ts +2 -1
- package/utils/domUtils.js +30 -3
- package/utils/releaseInfo.js +1 -1
|
@@ -353,7 +353,8 @@ DataGridProRaw.propTypes = {
|
|
|
353
353
|
* Determines the path of a row in the tree data.
|
|
354
354
|
* For instance, a row with the path ["A", "B"] is the child of the row with the path ["A"].
|
|
355
355
|
* Note that all paths must contain at least one element.
|
|
356
|
-
* @
|
|
356
|
+
* @template R
|
|
357
|
+
* @param {R} row The row from which we want the path.
|
|
357
358
|
* @returns {string[]} The path to the row.
|
|
358
359
|
*/
|
|
359
360
|
getTreeDataPath: PropTypes.func,
|
|
@@ -617,7 +618,7 @@ DataGridProRaw.propTypes = {
|
|
|
617
618
|
* @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
|
|
618
619
|
* @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
|
|
619
620
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
620
|
-
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/api/data-grid/grid-col-def/)
|
|
621
|
+
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/x/api/data-grid/grid-col-def/)
|
|
621
622
|
*/
|
|
622
623
|
onEditCellPropsChange: PropTypes.func,
|
|
623
624
|
|
|
@@ -664,6 +665,28 @@ DataGridProRaw.propTypes = {
|
|
|
664
665
|
*/
|
|
665
666
|
onPinnedColumnsChange: PropTypes.func,
|
|
666
667
|
|
|
668
|
+
/**
|
|
669
|
+
* Callback fired when the preferences panel is closed.
|
|
670
|
+
* @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
|
|
671
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
672
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
673
|
+
*/
|
|
674
|
+
onPreferencePanelClose: PropTypes.func,
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Callback fired when the preferences panel is opened.
|
|
678
|
+
* @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
|
|
679
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
680
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
681
|
+
*/
|
|
682
|
+
onPreferencePanelOpen: PropTypes.func,
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Callback called when `processRowUpdate` throws an error or rejects.
|
|
686
|
+
* @param {any} error The error thrown.
|
|
687
|
+
*/
|
|
688
|
+
onProcessRowUpdateError: PropTypes.func,
|
|
689
|
+
|
|
667
690
|
/**
|
|
668
691
|
* Callback fired when the grid is resized.
|
|
669
692
|
* @param {ElementSize} containerSize With all properties from [[ElementSize]].
|
|
@@ -717,6 +740,14 @@ DataGridProRaw.propTypes = {
|
|
|
717
740
|
*/
|
|
718
741
|
onRowGroupingModelChange: PropTypes.func,
|
|
719
742
|
|
|
743
|
+
/**
|
|
744
|
+
* Callback fired when a row is being reordered.
|
|
745
|
+
* @param {GridRowOrderChangeParams} params With all properties from [[GridRowOrderChangeParams]].
|
|
746
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
747
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
748
|
+
*/
|
|
749
|
+
onRowOrderChange: PropTypes.func,
|
|
750
|
+
|
|
720
751
|
/**
|
|
721
752
|
* Callback fired when scrolling to the bottom of the grid viewport.
|
|
722
753
|
* @param {GridRowScrollEndParams} params With all properties from [[GridRowScrollEndParams]].
|
|
@@ -786,9 +817,10 @@ DataGridProRaw.propTypes = {
|
|
|
786
817
|
/**
|
|
787
818
|
* Callback called before updating a row with new values in the row and cell editing.
|
|
788
819
|
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
789
|
-
* @
|
|
790
|
-
* @param {
|
|
791
|
-
* @
|
|
820
|
+
* @template R
|
|
821
|
+
* @param {R} newRow Row object with the new values.
|
|
822
|
+
* @param {R} oldRow Row object with the old values.
|
|
823
|
+
* @returns {Promise<R> | R} The final values to update the row.
|
|
792
824
|
*/
|
|
793
825
|
processRowUpdate: PropTypes.func,
|
|
794
826
|
|
|
@@ -822,10 +854,16 @@ DataGridProRaw.propTypes = {
|
|
|
822
854
|
*/
|
|
823
855
|
rowHeight: PropTypes.number,
|
|
824
856
|
|
|
857
|
+
/**
|
|
858
|
+
* If `true`, the reordering of rows is enabled.
|
|
859
|
+
* @default false
|
|
860
|
+
*/
|
|
861
|
+
rowReordering: PropTypes.bool,
|
|
862
|
+
|
|
825
863
|
/**
|
|
826
864
|
* Set of rows of type [[GridRowsProp]].
|
|
827
865
|
*/
|
|
828
|
-
rows: PropTypes.
|
|
866
|
+
rows: PropTypes.array.isRequired,
|
|
829
867
|
|
|
830
868
|
/**
|
|
831
869
|
* Sets the type of space between rows added by `getRowSpacing`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus,
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing_new, useGridEditing_old, editingStateInitializer_old, editingStateInitializer_new, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, useGridDimensions, useGridStatePersistence, useGridSelectionPreProcessors, useGridColumnSpanning, columnMenuStateInitializer, densityStateInitializer, 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
4
|
import { useGridColumnReorder, columnReorderStateInitializer } from '../hooks/features/columnReorder/useGridColumnReorder';
|
|
@@ -12,6 +12,8 @@ import { useGridColumnPinningPreProcessors } from '../hooks/features/columnPinni
|
|
|
12
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
|
+
import { useGridRowReorder } from '../hooks/features/rowReorder/useGridRowReorder';
|
|
16
|
+
import { useGridRowReorderPreProcessors } from '../hooks/features/rowReorder/useGridRowReorderPreProcessors';
|
|
15
17
|
export const useDataGridProComponent = (inputApiRef, props) => {
|
|
16
18
|
var _props$experimentalFe, _props$experimentalFe2;
|
|
17
19
|
|
|
@@ -21,6 +23,7 @@ export const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
21
23
|
*/
|
|
22
24
|
|
|
23
25
|
useGridSelectionPreProcessors(apiRef, props);
|
|
26
|
+
useGridRowReorderPreProcessors(apiRef, props);
|
|
24
27
|
useGridRowGroupingPreProcessors(apiRef, props);
|
|
25
28
|
useGridTreeDataPreProcessors(apiRef, props);
|
|
26
29
|
useGridDetailPanelPreProcessors(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
|
|
@@ -51,29 +54,30 @@ export const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
51
54
|
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
52
55
|
useGridRowGrouping(apiRef, props);
|
|
53
56
|
useGridTreeData(apiRef);
|
|
57
|
+
useGridKeyboardNavigation(apiRef, props);
|
|
54
58
|
useGridSelection(apiRef, props);
|
|
55
59
|
useGridDetailPanel(apiRef, props);
|
|
56
60
|
useGridColumnPinning(apiRef, props);
|
|
57
61
|
useGridColumns(apiRef, props);
|
|
58
62
|
useGridRows(apiRef, props);
|
|
59
63
|
useGridParamsApi(apiRef);
|
|
64
|
+
useGridColumnSpanning(apiRef);
|
|
60
65
|
useGridDetailPanelCache(apiRef, props);
|
|
61
66
|
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? useGridEditing_new : useGridEditing_old;
|
|
62
67
|
useGridEditing(apiRef, props);
|
|
63
68
|
useGridFocus(apiRef, props);
|
|
64
|
-
useGridSorting(apiRef, props);
|
|
65
69
|
useGridPreferencesPanel(apiRef);
|
|
66
70
|
useGridFilter(apiRef, props);
|
|
71
|
+
useGridSorting(apiRef, props);
|
|
67
72
|
useGridDensity(apiRef, props);
|
|
68
73
|
useGridColumnReorder(apiRef, props);
|
|
69
74
|
useGridColumnResize(apiRef, props);
|
|
70
75
|
useGridPagination(apiRef, props);
|
|
71
76
|
useGridRowsMeta(apiRef, props);
|
|
77
|
+
useGridRowReorder(apiRef, props);
|
|
72
78
|
useGridScroll(apiRef, props);
|
|
73
79
|
useGridInfiniteLoader(apiRef, props);
|
|
74
80
|
useGridColumnMenu(apiRef);
|
|
75
|
-
useGridKeyboard(apiRef);
|
|
76
|
-
useGridKeyboardNavigation(apiRef, props);
|
|
77
81
|
useGridCsvExport(apiRef);
|
|
78
82
|
useGridPrintExport(apiRef, props);
|
|
79
83
|
useGridClipboard(apiRef);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { GridValidRowModel } from '@mui/x-data-grid';
|
|
1
2
|
import { DataGridProProps, DataGridProProcessedProps, DataGridProPropsWithDefaultValue } from '../models/dataGridProProps';
|
|
2
3
|
/**
|
|
3
4
|
* The default values of `DataGridProPropsWithDefaultValue` to inject in the props of DataGridPro.
|
|
4
5
|
*/
|
|
5
6
|
export declare const DATA_GRID_PRO_PROPS_DEFAULT_VALUES: DataGridProPropsWithDefaultValue;
|
|
6
|
-
export declare const useDataGridProProps: (inProps: DataGridProProps) => DataGridProProcessedProps
|
|
7
|
+
export declare const useDataGridProProps: <R extends GridValidRowModel>(inProps: DataGridProProps<R>) => DataGridProProcessedProps<R>;
|
|
@@ -15,6 +15,7 @@ export const DATA_GRID_PRO_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PROPS_D
|
|
|
15
15
|
disableChildrenFiltering: false,
|
|
16
16
|
disableChildrenSorting: false,
|
|
17
17
|
rowGroupingColumnMode: 'single',
|
|
18
|
+
rowReordering: false,
|
|
18
19
|
getDetailPanelHeight: () => 500
|
|
19
20
|
});
|
|
20
21
|
export const useDataGridProProps = inProps => {
|
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Commercial License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Material-UI SAS
|
|
4
|
+
|
|
5
|
+
MUI X Pro (https://mui.com/pricing/) is commercial software. You must purchase
|
|
6
|
+
a license and agree to the End User License Agreement (EULA: https://mui.com/x/license/)
|
|
7
|
+
to be able to use the software.
|
|
8
|
+
|
|
9
|
+
Commercial licenses can be obtained at https://mui.com/store/items/material-ui-pro/.
|
|
10
|
+
You are free to install and try the software without a license key as long as it
|
|
11
|
+
is not used for the development of a feature intended for production use. You can
|
|
12
|
+
find more details under the "Evaluation (trial) licenses" section of the EULA.
|
package/README.md
CHANGED
|
@@ -15,15 +15,17 @@ npm install @mui/x-data-grid-pro
|
|
|
15
15
|
yarn add @mui/x-data-grid-pro
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
This component has
|
|
18
|
+
This component has the following peer dependencies that you will need to install as well.
|
|
19
19
|
|
|
20
20
|
```json
|
|
21
21
|
"peerDependencies": {
|
|
22
|
-
"@mui/material": "^5.
|
|
23
|
-
"
|
|
22
|
+
"@mui/material": "^5.2.8",
|
|
23
|
+
"@mui/system": "^5.2.8",
|
|
24
|
+
"react": "^17.0.2 || ^18.0.0",
|
|
25
|
+
"react-dom": "^17.0.2 || ^18.0.0"
|
|
24
26
|
},
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
## Documentation
|
|
28
30
|
|
|
29
|
-
[The documentation](https://mui.com/
|
|
31
|
+
[The documentation](https://mui.com/x/react-data-grid/)
|
|
@@ -93,7 +93,6 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
|
|
|
93
93
|
const {
|
|
94
94
|
isDragging,
|
|
95
95
|
renderContext,
|
|
96
|
-
updateInnerPosition,
|
|
97
96
|
getRootProps,
|
|
98
97
|
getInnerProps,
|
|
99
98
|
getColumns
|
|
@@ -107,11 +106,6 @@ export const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function D
|
|
|
107
106
|
classes: rootProps.classes
|
|
108
107
|
};
|
|
109
108
|
const classes = useUtilityClasses(ownerState);
|
|
110
|
-
React.useEffect(() => {
|
|
111
|
-
if (renderContext) {
|
|
112
|
-
updateInnerPosition(renderContext);
|
|
113
|
-
}
|
|
114
|
-
}, [renderContext, updateInnerPosition]);
|
|
115
109
|
const leftRenderContext = renderContext && leftPinnedColumns.length ? _extends({}, renderContext, {
|
|
116
110
|
firstColumnIndex: 0,
|
|
117
111
|
lastColumnIndex: leftPinnedColumns.length
|
|
@@ -175,9 +175,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
175
175
|
}, [renderContext, updateRenderZonePosition]);
|
|
176
176
|
useGridApiEventHandler(apiRef, GridEvents.columnWidthChange, refreshRenderZonePosition);
|
|
177
177
|
useGridApiEventHandler(apiRef, GridEvents.columnOrderChange, refreshRenderZonePosition);
|
|
178
|
-
|
|
179
|
-
refreshRenderZonePosition();
|
|
180
|
-
}, [refreshRenderZonePosition]);
|
|
178
|
+
useGridApiEventHandler(apiRef, GridEvents.rowOrderChange, refreshRenderZonePosition);
|
|
181
179
|
const leftRenderContext = renderContext && leftPinnedColumns.length > 0 ? _extends({}, renderContext, {
|
|
182
180
|
firstColumnIndex: 0,
|
|
183
181
|
lastColumnIndex: leftPinnedColumns.length
|
|
@@ -73,16 +73,27 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
73
73
|
*/
|
|
74
74
|
field: PropTypes.string.isRequired,
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* A ref allowing to set imperative focus.
|
|
78
|
+
* It can be passed to the element that should receive focus.
|
|
79
|
+
* @ignore - do not document.
|
|
80
|
+
*/
|
|
81
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
82
|
+
current: PropTypes.shape({
|
|
83
|
+
focus: PropTypes.func.isRequired
|
|
84
|
+
})
|
|
85
|
+
})]),
|
|
86
|
+
|
|
76
87
|
/**
|
|
77
88
|
* The cell value formatted with the column valueFormatter.
|
|
78
89
|
*/
|
|
79
|
-
formattedValue: PropTypes.any
|
|
90
|
+
formattedValue: PropTypes.any,
|
|
80
91
|
|
|
81
92
|
/**
|
|
82
93
|
* Get the cell value of a row and field.
|
|
83
94
|
* @param {GridRowId} id The row id.
|
|
84
95
|
* @param {string} field The field.
|
|
85
|
-
* @returns {
|
|
96
|
+
* @returns {any} The cell value.
|
|
86
97
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
87
98
|
*/
|
|
88
99
|
getValue: PropTypes.func.isRequired,
|
|
@@ -105,7 +116,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
105
116
|
/**
|
|
106
117
|
* The row model of the row that the current cell belongs to.
|
|
107
118
|
*/
|
|
108
|
-
row: PropTypes.
|
|
119
|
+
row: PropTypes.object.isRequired,
|
|
109
120
|
|
|
110
121
|
/**
|
|
111
122
|
* The node of the row that the current cell belongs to.
|
|
@@ -120,6 +131,6 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
120
131
|
/**
|
|
121
132
|
* The cell value, but if the column has valueGetter, use getValue.
|
|
122
133
|
*/
|
|
123
|
-
value: PropTypes.any
|
|
134
|
+
value: PropTypes.any
|
|
124
135
|
} : void 0;
|
|
125
136
|
export { GridDetailPanelToggleCell };
|
|
@@ -3,8 +3,5 @@ import { GridRenderCellParams } from '@mui/x-data-grid';
|
|
|
3
3
|
interface GridGroupingCriteriaCellProps extends GridRenderCellParams {
|
|
4
4
|
hideDescendantCount?: boolean;
|
|
5
5
|
}
|
|
6
|
-
declare const GridGroupingCriteriaCell:
|
|
7
|
-
|
|
8
|
-
propTypes: any;
|
|
9
|
-
};
|
|
10
|
-
export { GridGroupingCriteriaCell };
|
|
6
|
+
export declare const GridGroupingCriteriaCell: (props: GridGroupingCriteriaCellProps) => JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
4
3
|
import IconButton from '@mui/material/IconButton';
|
|
5
4
|
import Box from '@mui/material/Box';
|
|
@@ -20,7 +19,7 @@ const useUtilityClasses = ownerState => {
|
|
|
20
19
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
21
20
|
};
|
|
22
21
|
|
|
23
|
-
const GridGroupingCriteriaCell = props => {
|
|
22
|
+
export const GridGroupingCriteriaCell = props => {
|
|
24
23
|
var _filteredDescendantCo;
|
|
25
24
|
|
|
26
25
|
const {
|
|
@@ -76,75 +75,4 @@ const GridGroupingCriteriaCell = props => {
|
|
|
76
75
|
children: [formattedValue === undefined ? rowNode.groupingKey : formattedValue, !hideDescendantCount && filteredDescendantCount > 0 ? ` (${filteredDescendantCount})` : '']
|
|
77
76
|
})]
|
|
78
77
|
});
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
process.env.NODE_ENV !== "production" ? GridGroupingCriteriaCell.propTypes = {
|
|
82
|
-
// ----------------------------- Warning --------------------------------
|
|
83
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
84
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
85
|
-
// ----------------------------------------------------------------------
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* GridApi that let you manipulate the grid.
|
|
89
|
-
*/
|
|
90
|
-
api: PropTypes.any.isRequired,
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* The mode of the cell.
|
|
94
|
-
*/
|
|
95
|
-
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* The column of the row that the current cell belongs to.
|
|
99
|
-
*/
|
|
100
|
-
colDef: PropTypes.object.isRequired,
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* The column field of the cell that triggered the event.
|
|
104
|
-
*/
|
|
105
|
-
field: PropTypes.string.isRequired,
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* The cell value formatted with the column valueFormatter.
|
|
109
|
-
*/
|
|
110
|
-
formattedValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.object, PropTypes.string, PropTypes.bool]),
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Get the cell value of a row and field.
|
|
114
|
-
* @param {GridRowId} id The row id.
|
|
115
|
-
* @param {string} field The field.
|
|
116
|
-
* @returns {GridCellValue} The cell value.
|
|
117
|
-
*/
|
|
118
|
-
getValue: PropTypes.func.isRequired,
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* If true, the cell is the active element.
|
|
122
|
-
*/
|
|
123
|
-
hasFocus: PropTypes.bool.isRequired,
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* The grid row id.
|
|
127
|
-
*/
|
|
128
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* If true, the cell is editable.
|
|
132
|
-
*/
|
|
133
|
-
isEditable: PropTypes.bool,
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* The row model of the row that the current cell belongs to.
|
|
137
|
-
*/
|
|
138
|
-
row: PropTypes.object.isRequired,
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* the tabIndex value.
|
|
142
|
-
*/
|
|
143
|
-
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* The cell value, but if the column has valueGetter, use getValue.
|
|
147
|
-
*/
|
|
148
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.object, PropTypes.string, PropTypes.bool])
|
|
149
|
-
} : void 0;
|
|
150
|
-
export { GridGroupingCriteriaCell };
|
|
78
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { GridRenderCellParams } from '@mui/x-data-grid';
|
|
3
|
+
declare const GridRowReorderCell: (params: GridRenderCellParams) => JSX.Element;
|
|
4
|
+
export { GridRowReorderCell };
|
|
5
|
+
export declare const renderRowReorderCell: (params: GridRenderCellParams) => JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { unstable_composeClasses as composeClasses } from '@mui/material';
|
|
4
|
+
import { GridEvents, gridRowTreeDepthSelector, gridSortModelSelector, useGridApiContext, useGridSelector, getDataGridUtilityClass, gridEditRowsStateSelector } from '@mui/x-data-grid';
|
|
5
|
+
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
|
|
9
|
+
const useUtilityClasses = ownerState => {
|
|
10
|
+
const {
|
|
11
|
+
isDraggable,
|
|
12
|
+
classes
|
|
13
|
+
} = ownerState;
|
|
14
|
+
const slots = {
|
|
15
|
+
root: ['rowReorderCell', isDraggable && 'rowReorderCell--draggable'],
|
|
16
|
+
placeholder: ['rowReorderCellPlaceholder']
|
|
17
|
+
};
|
|
18
|
+
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const GridRowReorderCell = params => {
|
|
22
|
+
const apiRef = useGridApiContext();
|
|
23
|
+
const rootProps = useGridRootProps();
|
|
24
|
+
const sortModel = useGridSelector(apiRef, gridSortModelSelector);
|
|
25
|
+
const treeDepth = useGridSelector(apiRef, gridRowTreeDepthSelector);
|
|
26
|
+
const editRowsState = useGridSelector(apiRef, gridEditRowsStateSelector); // eslint-disable-next-line no-underscore-dangle
|
|
27
|
+
|
|
28
|
+
const cellValue = params.row.__reorder__ || params.id; // TODO: remove sortModel and treeDepth checks once row reorder is compatible
|
|
29
|
+
|
|
30
|
+
const isDraggable = !!rootProps.rowReordering && !sortModel.length && treeDepth === 1 && Object.keys(editRowsState).length === 0;
|
|
31
|
+
const ownerState = {
|
|
32
|
+
isDraggable,
|
|
33
|
+
classes: rootProps.classes
|
|
34
|
+
};
|
|
35
|
+
const classes = useUtilityClasses(ownerState);
|
|
36
|
+
const publish = React.useCallback((eventName, propHandler) => event => {
|
|
37
|
+
// Ignore portal
|
|
38
|
+
// The target is not an element when triggered by a Select inside the cell
|
|
39
|
+
// See https://github.com/mui/material-ui/issues/10534
|
|
40
|
+
if (event.target.nodeType === 1 && !event.currentTarget.contains(event.target)) {
|
|
41
|
+
return;
|
|
42
|
+
} // The row might have been deleted
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
if (!apiRef.current.getRow(params.row.id)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
apiRef.current.publishEvent(eventName, apiRef.current.getRowParams(params.row.id), event);
|
|
50
|
+
|
|
51
|
+
if (propHandler) {
|
|
52
|
+
propHandler(event);
|
|
53
|
+
}
|
|
54
|
+
}, [apiRef, params.row.id]);
|
|
55
|
+
const draggableEventHandlers = {
|
|
56
|
+
onDragStart: publish(GridEvents.rowDragStart),
|
|
57
|
+
onDragOver: publish(GridEvents.rowDragOver),
|
|
58
|
+
onDragEnd: publish(GridEvents.rowDragEnd)
|
|
59
|
+
};
|
|
60
|
+
return /*#__PURE__*/_jsxs("div", _extends({
|
|
61
|
+
className: classes.root,
|
|
62
|
+
draggable: isDraggable
|
|
63
|
+
}, draggableEventHandlers, {
|
|
64
|
+
children: [/*#__PURE__*/_jsx(rootProps.components.RowReorderIcon, {}), /*#__PURE__*/_jsx("div", {
|
|
65
|
+
className: classes.placeholder,
|
|
66
|
+
children: cellValue
|
|
67
|
+
})]
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { GridRowReorderCell };
|
|
72
|
+
export const renderRowReorderCell = params => /*#__PURE__*/_jsx(GridRowReorderCell, _extends({}, params));
|
|
@@ -107,16 +107,27 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
107
107
|
*/
|
|
108
108
|
field: PropTypes.string.isRequired,
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* A ref allowing to set imperative focus.
|
|
112
|
+
* It can be passed to the element that should receive focus.
|
|
113
|
+
* @ignore - do not document.
|
|
114
|
+
*/
|
|
115
|
+
focusElementRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
116
|
+
current: PropTypes.shape({
|
|
117
|
+
focus: PropTypes.func.isRequired
|
|
118
|
+
})
|
|
119
|
+
})]),
|
|
120
|
+
|
|
110
121
|
/**
|
|
111
122
|
* The cell value formatted with the column valueFormatter.
|
|
112
123
|
*/
|
|
113
|
-
formattedValue: PropTypes.any
|
|
124
|
+
formattedValue: PropTypes.any,
|
|
114
125
|
|
|
115
126
|
/**
|
|
116
127
|
* Get the cell value of a row and field.
|
|
117
128
|
* @param {GridRowId} id The row id.
|
|
118
129
|
* @param {string} field The field.
|
|
119
|
-
* @returns {
|
|
130
|
+
* @returns {any} The cell value.
|
|
120
131
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
121
132
|
*/
|
|
122
133
|
getValue: PropTypes.func.isRequired,
|
|
@@ -140,7 +151,7 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
140
151
|
/**
|
|
141
152
|
* The row model of the row that the current cell belongs to.
|
|
142
153
|
*/
|
|
143
|
-
row: PropTypes.
|
|
154
|
+
row: PropTypes.object.isRequired,
|
|
144
155
|
|
|
145
156
|
/**
|
|
146
157
|
* The node of the row that the current cell belongs to.
|
|
@@ -155,6 +166,6 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
155
166
|
/**
|
|
156
167
|
* The cell value, but if the column has valueGetter, use getValue.
|
|
157
168
|
*/
|
|
158
|
-
value: PropTypes.any
|
|
169
|
+
value: PropTypes.any
|
|
159
170
|
} : void 0;
|
|
160
171
|
export { GridTreeDataGroupingCell };
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import MuiDivider from '@mui/material/Divider';
|
|
4
4
|
import { useGridSelector, gridVisibleColumnDefinitionsSelector, gridColumnsTotalWidthSelector, gridColumnPositionsSelector, gridVisibleColumnFieldsSelector, gridClasses, GridEvents, useGridApiMethod, useGridApiEventHandler } from '@mui/x-data-grid';
|
|
5
|
-
import {
|
|
5
|
+
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
6
6
|
import { GridColumnPinningMenuItems } from '../../../components/GridColumnPinningMenuItems';
|
|
7
7
|
import { GridPinnedPosition } from './gridColumnPinningInterface';
|
|
8
8
|
import { gridPinnedColumnsSelector } from './gridColumnPinningSelector';
|
|
@@ -181,11 +181,11 @@ export const useGridColumnPinning = (apiRef, props) => {
|
|
|
181
181
|
|
|
182
182
|
return params;
|
|
183
183
|
}, [apiRef]);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
184
|
+
useGridRegisterPipeProcessor(apiRef, 'scrollToIndexes', calculateScrollLeft);
|
|
185
|
+
useGridRegisterPipeProcessor(apiRef, 'columnMenu', addColumnMenuButtons);
|
|
186
|
+
useGridRegisterPipeProcessor(apiRef, 'canBeReordered', checkIfCanBeReordered);
|
|
187
|
+
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
188
|
+
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
189
189
|
apiRef.current.unstable_updateControlState({
|
|
190
190
|
stateId: 'pinnedColumns',
|
|
191
191
|
propModel: props.pinnedColumns,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useGridRegisterPipeProcessor } from '@mui/x-data-grid/internals';
|
|
4
4
|
import { gridPinnedColumnsSelector } from './gridColumnPinningSelector';
|
|
5
5
|
import { columnPinningStateInitializer } from './useGridColumnPinning';
|
|
6
6
|
import { filterColumns } from '../../../components/DataGridProVirtualScroller';
|
|
@@ -41,5 +41,5 @@ export const useGridColumnPinningPreProcessors = (apiRef, props) => {
|
|
|
41
41
|
all: [...leftPinnedColumns, ...centerColumns, ...rightPinnedColumns]
|
|
42
42
|
});
|
|
43
43
|
}, [disableColumnPinning, pinnedColumns]);
|
|
44
|
-
|
|
44
|
+
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', reorderPinnedColumns);
|
|
45
45
|
};
|
|
@@ -50,7 +50,7 @@ export const useGridColumnReorder = (apiRef, props) => {
|
|
|
50
50
|
clearTimeout(removeDnDStylesTimeout.current);
|
|
51
51
|
};
|
|
52
52
|
}, []);
|
|
53
|
-
const
|
|
53
|
+
const handleDragStart = React.useCallback((params, event) => {
|
|
54
54
|
if (props.disableColumnReorder || params.colDef.disableReorder) {
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
@@ -116,7 +116,7 @@ export const useGridColumnReorder = (apiRef, props) => {
|
|
|
116
116
|
canBeReordered = targetColIndex < visibleColumns.length - 1 && !visibleColumns[targetColIndex + 1].disableReorder;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
const canBeReorderedProcessed = apiRef.current.
|
|
119
|
+
const canBeReorderedProcessed = apiRef.current.unstable_applyPipeProcessors('canBeReordered', canBeReordered, {
|
|
120
120
|
targetIndex: targetColVisibleIndex
|
|
121
121
|
});
|
|
122
122
|
|
|
@@ -156,7 +156,7 @@ export const useGridColumnReorder = (apiRef, props) => {
|
|
|
156
156
|
}));
|
|
157
157
|
apiRef.current.forceUpdate();
|
|
158
158
|
}, [props.disableColumnReorder, logger, apiRef]);
|
|
159
|
-
useGridApiEventHandler(apiRef, GridEvents.columnHeaderDragStart,
|
|
159
|
+
useGridApiEventHandler(apiRef, GridEvents.columnHeaderDragStart, handleDragStart);
|
|
160
160
|
useGridApiEventHandler(apiRef, GridEvents.columnHeaderDragEnter, handleDragEnter);
|
|
161
161
|
useGridApiEventHandler(apiRef, GridEvents.columnHeaderDragOver, handleDragOver);
|
|
162
162
|
useGridApiEventHandler(apiRef, GridEvents.columnHeaderDragEnd, handleDragEnd);
|
|
@@ -100,17 +100,29 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
100
100
|
|
|
101
101
|
const updateWidth = newWidth => {
|
|
102
102
|
logger.debug(`Updating width to ${newWidth} for col ${colDefRef.current.field}`);
|
|
103
|
+
const prevWidth = colElementRef.current.offsetWidth;
|
|
104
|
+
const widthDiff = newWidth - prevWidth;
|
|
103
105
|
colDefRef.current.computedWidth = newWidth;
|
|
104
106
|
colDefRef.current.width = newWidth;
|
|
105
|
-
colDefRef.current.flex =
|
|
107
|
+
colDefRef.current.flex = 0;
|
|
106
108
|
colElementRef.current.style.width = `${newWidth}px`;
|
|
107
109
|
colElementRef.current.style.minWidth = `${newWidth}px`;
|
|
108
110
|
colElementRef.current.style.maxWidth = `${newWidth}px`;
|
|
109
111
|
colCellElementsRef.current.forEach(element => {
|
|
110
112
|
const div = element;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
div.
|
|
113
|
+
let finalWidth;
|
|
114
|
+
|
|
115
|
+
if (div.getAttribute('aria-colspan') === '1') {
|
|
116
|
+
finalWidth = `${newWidth}px`;
|
|
117
|
+
} else {
|
|
118
|
+
// Cell with colspan > 1 cannot be just updated width new width.
|
|
119
|
+
// Instead, we add width diff to the current width.
|
|
120
|
+
finalWidth = `${div.offsetWidth + widthDiff}px`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
div.style.width = finalWidth;
|
|
124
|
+
div.style.minWidth = finalWidth;
|
|
125
|
+
div.style.maxWidth = finalWidth;
|
|
114
126
|
});
|
|
115
127
|
};
|
|
116
128
|
|
|
@@ -174,7 +186,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
174
186
|
}, event);
|
|
175
187
|
colDefRef.current = colDef;
|
|
176
188
|
colElementRef.current = (_apiRef$current$colum = apiRef.current.columnHeadersContainerElementRef) == null ? void 0 : _apiRef$current$colum.current.querySelector(`[data-field="${colDef.field}"]`);
|
|
177
|
-
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current);
|
|
189
|
+
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
|
|
178
190
|
const doc = ownerDocument(apiRef.current.rootElementRef.current);
|
|
179
191
|
doc.body.style.cursor = 'col-resize';
|
|
180
192
|
separatorSide.current = getSeparatorSide(event.currentTarget);
|
|
@@ -251,7 +263,7 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
251
263
|
}, event);
|
|
252
264
|
colDefRef.current = colDef;
|
|
253
265
|
colElementRef.current = findHeaderElementFromField((_apiRef$current$colum2 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum2.current, colDef.field);
|
|
254
|
-
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current);
|
|
266
|
+
colCellElementsRef.current = findGridCellElementsFromCol(colElementRef.current, apiRef.current);
|
|
255
267
|
separatorSide.current = getSeparatorSide(event.target);
|
|
256
268
|
initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
|
|
257
269
|
const doc = ownerDocument(event.currentTarget);
|