@mui/x-data-grid-pro 5.6.1 → 5.9.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 +275 -53
- package/DataGridPro/DataGridPro.d.ts +7 -1
- package/DataGridPro/DataGridPro.js +47 -18
- package/DataGridPro/useDataGridProComponent.js +15 -13
- package/DataGridPro/useDataGridProProps.d.ts +2 -1
- package/LICENSE +12 -0
- package/README.md +1 -1
- package/components/DataGridProColumnHeaders.js +10 -16
- package/components/DataGridProVirtualScroller.js +6 -9
- package/components/GridDetailPanelToggleCell.js +15 -4
- package/components/GridGroupingCriteriaCell.d.ts +2 -5
- package/components/GridGroupingCriteriaCell.js +2 -74
- 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 +1 -1
- 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/rowGrouping/gridRowGroupingInterfaces.d.ts +6 -0
- package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +5 -2
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +18 -3
- package/hooks/features/rowGrouping/useGridRowGrouping.js +45 -168
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +1 -1
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +131 -4
- package/hooks/features/treeData/gridTreeDataUtils.d.ts +1 -0
- package/hooks/features/treeData/gridTreeDataUtils.js +2 -0
- package/hooks/features/treeData/useGridTreeData.d.ts +1 -5
- package/hooks/features/treeData/useGridTreeData.js +3 -84
- package/hooks/features/treeData/useGridTreeDataPreProcessors.d.ts +1 -1
- package/hooks/features/treeData/useGridTreeDataPreProcessors.js +73 -4
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/legacy/DataGridPro/DataGridPro.js +47 -18
- package/legacy/DataGridPro/useDataGridProComponent.js +15 -13
- package/legacy/components/DataGridProColumnHeaders.js +10 -16
- package/legacy/components/DataGridProVirtualScroller.js +6 -9
- package/legacy/components/GridDetailPanelToggleCell.js +15 -4
- package/legacy/components/GridGroupingCriteriaCell.js +2 -74
- 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 +1 -1
- 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/rowGrouping/gridRowGroupingUtils.js +19 -2
- package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +47 -173
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +138 -4
- package/legacy/hooks/features/treeData/gridTreeDataUtils.js +2 -0
- package/legacy/hooks/features/treeData/useGridTreeData.js +3 -92
- package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +85 -4
- package/legacy/index.js +2 -2
- package/legacy/utils/domUtils.js +30 -3
- package/legacy/utils/releaseInfo.js +15 -0
- package/models/dataGridProProps.d.ts +9 -8
- package/models/gridGroupingColDefOverride.d.ts +2 -2
- package/models/gridGroupingValueGetterParams.d.ts +1 -1
- package/modern/DataGridPro/DataGridPro.js +47 -18
- package/modern/DataGridPro/useDataGridProComponent.js +13 -13
- package/modern/components/DataGridProColumnHeaders.js +10 -16
- package/modern/components/DataGridProVirtualScroller.js +6 -9
- package/modern/components/GridDetailPanelToggleCell.js +15 -4
- package/modern/components/GridGroupingCriteriaCell.js +2 -74
- 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 +1 -1
- 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/rowGrouping/gridRowGroupingUtils.js +18 -3
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +45 -168
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +131 -4
- package/modern/hooks/features/treeData/gridTreeDataUtils.js +2 -0
- package/modern/hooks/features/treeData/useGridTreeData.js +3 -84
- package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +73 -4
- package/modern/index.js +2 -2
- package/modern/utils/domUtils.js +30 -3
- package/modern/utils/releaseInfo.js +15 -0
- package/node/DataGridPro/DataGridPro.js +45 -17
- package/node/DataGridPro/useDataGridProComponent.js +15 -13
- package/node/components/DataGridProColumnHeaders.js +10 -16
- package/node/components/DataGridProVirtualScroller.js +6 -9
- package/node/components/GridDetailPanelToggleCell.js +15 -4
- package/node/components/GridGroupingCriteriaCell.js +1 -72
- 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 +1 -1
- 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/rowGrouping/gridRowGroupingUtils.js +24 -5
- package/node/hooks/features/rowGrouping/useGridRowGrouping.js +41 -166
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +134 -1
- package/node/hooks/features/treeData/gridTreeDataUtils.js +5 -2
- package/node/hooks/features/treeData/useGridTreeData.js +2 -93
- package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +75 -3
- package/node/index.js +9 -9
- package/node/utils/domUtils.js +30 -3
- package/node/utils/releaseInfo.js +25 -0
- package/package.json +7 -7
- package/typeOverloads/modules.d.ts +6 -6
- package/typeOverloads/reexports.d.ts +1 -1
- package/utils/domUtils.d.ts +2 -1
- package/utils/domUtils.js +30 -3
- package/utils/releaseInfo.d.ts +1 -0
- package/utils/releaseInfo.js +15 -0
- package/utils/tree/buildRowTree.d.ts +3 -3
- package/components/Watermark.d.ts +0 -2
- package/components/Watermark.js +0 -43
- package/legacy/components/Watermark.js +0 -43
- package/modern/components/Watermark.js +0 -43
- package/node/components/Watermark.js +0 -56
package/modern/utils/domUtils.js
CHANGED
|
@@ -6,14 +6,41 @@ export function getFieldFromHeaderElem(colCellEl) {
|
|
|
6
6
|
export function findHeaderElementFromField(elem, field) {
|
|
7
7
|
return elem.querySelector(`[data-field="${field}"]`);
|
|
8
8
|
}
|
|
9
|
-
export function findGridCellElementsFromCol(col) {
|
|
10
|
-
const field = col.getAttribute('data-field');
|
|
9
|
+
export function findGridCellElementsFromCol(col, api) {
|
|
11
10
|
const root = findParentElementFromClassName(col, 'MuiDataGrid-root');
|
|
12
11
|
|
|
13
12
|
if (!root) {
|
|
14
13
|
throw new Error('MUI: The root element is not found.');
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
const
|
|
16
|
+
const ariaColIndex = col.getAttribute('aria-colindex');
|
|
17
|
+
|
|
18
|
+
if (!ariaColIndex) {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const colIndex = Number(ariaColIndex) - 1;
|
|
23
|
+
const cells = [];
|
|
24
|
+
const renderedRowElements = root.querySelectorAll(`.${gridClasses.row}`);
|
|
25
|
+
renderedRowElements.forEach(rowElement => {
|
|
26
|
+
const rowId = rowElement.getAttribute('data-id');
|
|
27
|
+
|
|
28
|
+
if (!rowId) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let columnIndex = colIndex;
|
|
33
|
+
const cellColSpanInfo = api.unstable_getCellColSpanInfo(rowId, colIndex);
|
|
34
|
+
|
|
35
|
+
if (cellColSpanInfo && cellColSpanInfo.spannedByColSpan) {
|
|
36
|
+
columnIndex = cellColSpanInfo.leftVisibleCellIndex;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const cell = rowElement.querySelector(`[data-colindex="${columnIndex}"]`);
|
|
40
|
+
|
|
41
|
+
if (cell) {
|
|
42
|
+
cells.push(cell);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
18
45
|
return cells;
|
|
19
46
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ponyfillGlobal } from '@mui/utils';
|
|
2
|
+
export const getReleaseInfo = () => {
|
|
3
|
+
const releaseInfo = "MTY0OTg4NzIwMDAwMA==";
|
|
4
|
+
|
|
5
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
6
|
+
// A simple hack to set the value in the test environment (has no build step).
|
|
7
|
+
// eslint-disable-next-line no-useless-concat
|
|
8
|
+
if (releaseInfo === '__RELEASE' + '_INFO__') {
|
|
9
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
10
|
+
return ponyfillGlobal.__MUI_RELEASE_INFO__;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return releaseInfo;
|
|
15
|
+
};
|
|
@@ -19,34 +19,25 @@ var _xDataGrid = require("@mui/x-data-grid");
|
|
|
19
19
|
|
|
20
20
|
var _useDataGridProComponent = require("./useDataGridProComponent");
|
|
21
21
|
|
|
22
|
-
var _Watermark = require("../components/Watermark");
|
|
23
|
-
|
|
24
22
|
var _useDataGridProProps = require("./useDataGridProProps");
|
|
25
23
|
|
|
26
24
|
var _DataGridProVirtualScroller = require("../components/DataGridProVirtualScroller");
|
|
27
25
|
|
|
28
26
|
var _DataGridProColumnHeaders = require("../components/DataGridProColumnHeaders");
|
|
29
27
|
|
|
28
|
+
var _releaseInfo = require("../utils/releaseInfo");
|
|
29
|
+
|
|
30
30
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
31
|
|
|
32
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
33
33
|
|
|
34
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
// automatically when a new version is published on npm.
|
|
38
|
-
let RELEASE_INFO = "MTY0Njg2NjgwMDAwMA=="; // eslint-disable-next-line no-useless-concat
|
|
39
|
-
|
|
40
|
-
if (process.env.NODE_ENV !== 'production' && RELEASE_INFO === '__RELEASE' + '_INFO__') {
|
|
41
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
42
|
-
RELEASE_INFO = _utils.ponyfillGlobal.__MUI_RELEASE_INFO__;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
_xLicensePro.LicenseInfo.setReleaseInfo(RELEASE_INFO);
|
|
46
|
-
|
|
36
|
+
const releaseInfo = (0, _releaseInfo.getReleaseInfo)();
|
|
47
37
|
const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProps, ref) {
|
|
48
38
|
const props = (0, _useDataGridProProps.useDataGridProProps)(inProps);
|
|
49
39
|
const apiRef = (0, _useDataGridProComponent.useDataGridProComponent)(props.apiRef, props);
|
|
40
|
+
(0, _xLicensePro.useLicenseVerifier)('x-data-grid-pro', releaseInfo);
|
|
50
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGrid.GridContextProvider, {
|
|
51
42
|
apiRef: apiRef,
|
|
52
43
|
props: props,
|
|
@@ -59,7 +50,10 @@ const DataGridProRaw = /*#__PURE__*/React.forwardRef(function DataGridPro(inProp
|
|
|
59
50
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGrid.GridHeaderPlaceholder, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGrid.GridBody, {
|
|
60
51
|
ColumnHeadersComponent: _DataGridProColumnHeaders.DataGridProColumnHeaders,
|
|
61
52
|
VirtualScrollerComponent: _DataGridProVirtualScroller.DataGridProVirtualScroller,
|
|
62
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
53
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_xLicensePro.Watermark, {
|
|
54
|
+
packageName: "x-data-grid-pro",
|
|
55
|
+
releaseInfo: releaseInfo
|
|
56
|
+
})
|
|
63
57
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_xDataGrid.GridFooterPlaceholder, {})]
|
|
64
58
|
})
|
|
65
59
|
})
|
|
@@ -299,6 +293,7 @@ DataGridProRaw.propTypes = {
|
|
|
299
293
|
* For each feature, if the flag is not explicitly set to `true`, the feature will be fully disabled and any property / method call will not have any effect.
|
|
300
294
|
*/
|
|
301
295
|
experimentalFeatures: _propTypes.default.shape({
|
|
296
|
+
newEditingApi: _propTypes.default.bool,
|
|
302
297
|
preventCommitWhileValidating: _propTypes.default.bool,
|
|
303
298
|
rowGrouping: _propTypes.default.bool,
|
|
304
299
|
warnIfFocusStateIsNotSynced: _propTypes.default.bool
|
|
@@ -382,7 +377,8 @@ DataGridProRaw.propTypes = {
|
|
|
382
377
|
* Determines the path of a row in the tree data.
|
|
383
378
|
* For instance, a row with the path ["A", "B"] is the child of the row with the path ["A"].
|
|
384
379
|
* Note that all paths must contain at least one element.
|
|
385
|
-
* @
|
|
380
|
+
* @template R
|
|
381
|
+
* @param {R} row The row from which we want the path.
|
|
386
382
|
* @returns {string[]} The path to the row.
|
|
387
383
|
*/
|
|
388
384
|
getTreeDataPath: _propTypes.default.func,
|
|
@@ -646,7 +642,7 @@ DataGridProRaw.propTypes = {
|
|
|
646
642
|
* @param {GridEditCellPropsParams} params With all properties from [[GridEditCellPropsParams]].
|
|
647
643
|
* @param {MuiEvent<React.SyntheticEvent>} event The event that caused this prop to be called.
|
|
648
644
|
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
649
|
-
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/api/data-grid/grid-col-def/)
|
|
645
|
+
* @deprecated use `preProcessEditCellProps` from the [`GridColDef`](/x/api/data-grid/grid-col-def/)
|
|
650
646
|
*/
|
|
651
647
|
onEditCellPropsChange: _propTypes.default.func,
|
|
652
648
|
|
|
@@ -693,6 +689,28 @@ DataGridProRaw.propTypes = {
|
|
|
693
689
|
*/
|
|
694
690
|
onPinnedColumnsChange: _propTypes.default.func,
|
|
695
691
|
|
|
692
|
+
/**
|
|
693
|
+
* Callback fired when the preferences panel is closed.
|
|
694
|
+
* @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
|
|
695
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
696
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
697
|
+
*/
|
|
698
|
+
onPreferencePanelClose: _propTypes.default.func,
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Callback fired when the preferences panel is opened.
|
|
702
|
+
* @param {GridPreferencePanelParams} params With all properties from [[GridPreferencePanelParams]].
|
|
703
|
+
* @param {MuiEvent<{}>} event The event object.
|
|
704
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
705
|
+
*/
|
|
706
|
+
onPreferencePanelOpen: _propTypes.default.func,
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Callback called when `processRowUpdate` throws an error or rejects.
|
|
710
|
+
* @param {any} error The error thrown.
|
|
711
|
+
*/
|
|
712
|
+
onProcessRowUpdateError: _propTypes.default.func,
|
|
713
|
+
|
|
696
714
|
/**
|
|
697
715
|
* Callback fired when the grid is resized.
|
|
698
716
|
* @param {ElementSize} containerSize With all properties from [[ElementSize]].
|
|
@@ -812,6 +830,16 @@ DataGridProRaw.propTypes = {
|
|
|
812
830
|
right: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
813
831
|
}),
|
|
814
832
|
|
|
833
|
+
/**
|
|
834
|
+
* Callback called before updating a row with new values in the row and cell editing.
|
|
835
|
+
* Only applied if `props.experimentalFeatures.newEditingApi: true`.
|
|
836
|
+
* @template R
|
|
837
|
+
* @param {R} newRow Row object with the new values.
|
|
838
|
+
* @param {R} oldRow Row object with the old values.
|
|
839
|
+
* @returns {Promise<R> | R} The final values to update the row.
|
|
840
|
+
*/
|
|
841
|
+
processRowUpdate: _propTypes.default.func,
|
|
842
|
+
|
|
815
843
|
/**
|
|
816
844
|
* Number of extra rows to be rendered before/after the visible slice.
|
|
817
845
|
* @default 3
|
|
@@ -845,7 +873,7 @@ DataGridProRaw.propTypes = {
|
|
|
845
873
|
/**
|
|
846
874
|
* Set of rows of type [[GridRowsProp]].
|
|
847
875
|
*/
|
|
848
|
-
rows: _propTypes.default.
|
|
876
|
+
rows: _propTypes.default.array.isRequired,
|
|
849
877
|
|
|
850
878
|
/**
|
|
851
879
|
* Sets the type of space between rows added by `getRowSpacing`.
|
|
@@ -33,6 +33,8 @@ var _useGridDetailPanelPreProcessors = require("../hooks/features/detailPanel/us
|
|
|
33
33
|
|
|
34
34
|
// Pro-only features
|
|
35
35
|
const useDataGridProComponent = (inputApiRef, props) => {
|
|
36
|
+
var _props$experimentalFe, _props$experimentalFe2;
|
|
37
|
+
|
|
36
38
|
const apiRef = (0, _internals.useGridInitialization)(inputApiRef, props);
|
|
37
39
|
/**
|
|
38
40
|
* Register all pre-processors called during state initialization here.
|
|
@@ -41,25 +43,22 @@ const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
41
43
|
(0, _internals.useGridSelectionPreProcessors)(apiRef, props);
|
|
42
44
|
(0, _useGridRowGroupingPreProcessors.useGridRowGroupingPreProcessors)(apiRef, props);
|
|
43
45
|
(0, _useGridTreeDataPreProcessors.useGridTreeDataPreProcessors)(apiRef, props);
|
|
44
|
-
(0, _useGridDetailPanelPreProcessors.useGridDetailPanelPreProcessors)(apiRef, props);
|
|
45
|
-
|
|
46
|
+
(0, _useGridDetailPanelPreProcessors.useGridDetailPanelPreProcessors)(apiRef, props); // The column pinning `hydrateColumns` pre-processor must be after every other `hydrateColumns` pre-processors
|
|
47
|
+
// Because it changes the order of the columns.
|
|
46
48
|
|
|
49
|
+
(0, _useGridColumnPinningPreProcessors.useGridColumnPinningPreProcessors)(apiRef, props);
|
|
50
|
+
(0, _internals.useGridRowsPreProcessors)(apiRef);
|
|
47
51
|
/**
|
|
48
52
|
* Register all state initializers here.
|
|
49
53
|
*/
|
|
50
54
|
|
|
55
|
+
(0, _internals.useGridInitializeState)(_useGridRowGrouping.rowGroupingStateInitializer, apiRef, props);
|
|
51
56
|
(0, _internals.useGridInitializeState)(_internals.selectionStateInitializer, apiRef, props);
|
|
52
57
|
(0, _internals.useGridInitializeState)(_useGridDetailPanel.detailPanelStateInitializer, apiRef, props);
|
|
53
58
|
(0, _internals.useGridInitializeState)(_useGridColumnPinning.columnPinningStateInitializer, apiRef, props);
|
|
54
|
-
(0, _internals.useGridInitializeState)(_useGridRowGrouping.rowGroupingStateInitializer, apiRef, props); // FIXME Call in the same relative position that useGridRowGrouping is called
|
|
55
|
-
|
|
56
59
|
(0, _internals.useGridInitializeState)(_internals.columnsStateInitializer, apiRef, props);
|
|
57
|
-
(0, _useGridRowGrouping.useGridRowGrouping)(apiRef, props); // FIXME Needs to be called before the rows state initialization because it registers a rows group builder
|
|
58
|
-
|
|
59
|
-
(0, _useGridTreeData.useGridTreeData)(apiRef, props); // FIXME Needs to be called before the rows state initialization because it registers a rows group builder
|
|
60
|
-
|
|
61
60
|
(0, _internals.useGridInitializeState)(_internals.rowsStateInitializer, apiRef, props);
|
|
62
|
-
(0, _internals.useGridInitializeState)(_internals.
|
|
61
|
+
(0, _internals.useGridInitializeState)((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? _internals.editingStateInitializer_new : _internals.editingStateInitializer_old, apiRef, props);
|
|
63
62
|
(0, _internals.useGridInitializeState)(_internals.focusStateInitializer, apiRef, props);
|
|
64
63
|
(0, _internals.useGridInitializeState)(_internals.sortingStateInitializer, apiRef, props);
|
|
65
64
|
(0, _internals.useGridInitializeState)(_internals.preferencePanelStateInitializer, apiRef, props);
|
|
@@ -70,18 +69,23 @@ const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
70
69
|
(0, _internals.useGridInitializeState)(_internals.paginationStateInitializer, apiRef, props);
|
|
71
70
|
(0, _internals.useGridInitializeState)(_internals.rowsMetaStateInitializer, apiRef, props);
|
|
72
71
|
(0, _internals.useGridInitializeState)(_internals.columnMenuStateInitializer, apiRef, props);
|
|
72
|
+
(0, _useGridRowGrouping.useGridRowGrouping)(apiRef, props);
|
|
73
|
+
(0, _useGridTreeData.useGridTreeData)(apiRef);
|
|
74
|
+
(0, _internals.useGridKeyboardNavigation)(apiRef, props);
|
|
73
75
|
(0, _internals.useGridSelection)(apiRef, props);
|
|
74
76
|
(0, _useGridDetailPanel.useGridDetailPanel)(apiRef, props);
|
|
75
77
|
(0, _useGridColumnPinning.useGridColumnPinning)(apiRef, props);
|
|
76
78
|
(0, _internals.useGridColumns)(apiRef, props);
|
|
77
79
|
(0, _internals.useGridRows)(apiRef, props);
|
|
78
80
|
(0, _internals.useGridParamsApi)(apiRef);
|
|
81
|
+
(0, _internals.useGridColumnSpanning)(apiRef);
|
|
79
82
|
(0, _useGridDetailPanelCache.useGridDetailPanelCache)(apiRef, props);
|
|
80
|
-
|
|
83
|
+
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? _internals.useGridEditing_new : _internals.useGridEditing_old;
|
|
84
|
+
useGridEditing(apiRef, props);
|
|
81
85
|
(0, _internals.useGridFocus)(apiRef, props);
|
|
82
|
-
(0, _internals.useGridSorting)(apiRef, props);
|
|
83
86
|
(0, _internals.useGridPreferencesPanel)(apiRef);
|
|
84
87
|
(0, _internals.useGridFilter)(apiRef, props);
|
|
88
|
+
(0, _internals.useGridSorting)(apiRef, props);
|
|
85
89
|
(0, _internals.useGridDensity)(apiRef, props);
|
|
86
90
|
(0, _useGridColumnReorder.useGridColumnReorder)(apiRef, props);
|
|
87
91
|
(0, _useGridColumnResize.useGridColumnResize)(apiRef, props);
|
|
@@ -90,8 +94,6 @@ const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
90
94
|
(0, _internals.useGridScroll)(apiRef, props);
|
|
91
95
|
(0, _useGridInfiniteLoader.useGridInfiniteLoader)(apiRef, props);
|
|
92
96
|
(0, _internals.useGridColumnMenu)(apiRef);
|
|
93
|
-
(0, _internals.useGridKeyboard)(apiRef);
|
|
94
|
-
(0, _internals.useGridKeyboardNavigation)(apiRef, props);
|
|
95
97
|
(0, _internals.useGridCsvExport)(apiRef);
|
|
96
98
|
(0, _internals.useGridPrintExport)(apiRef, props);
|
|
97
99
|
(0, _internals.useGridClipboard)(apiRef);
|
|
@@ -116,7 +116,6 @@ const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
116
116
|
const {
|
|
117
117
|
isDragging,
|
|
118
118
|
renderContext,
|
|
119
|
-
updateInnerPosition,
|
|
120
119
|
getRootProps,
|
|
121
120
|
getInnerProps,
|
|
122
121
|
getColumns
|
|
@@ -130,11 +129,6 @@ const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
130
129
|
classes: rootProps.classes
|
|
131
130
|
};
|
|
132
131
|
const classes = useUtilityClasses(ownerState);
|
|
133
|
-
React.useEffect(() => {
|
|
134
|
-
if (renderContext) {
|
|
135
|
-
updateInnerPosition(renderContext);
|
|
136
|
-
}
|
|
137
|
-
}, [renderContext, updateInnerPosition]);
|
|
138
132
|
const leftRenderContext = renderContext && leftPinnedColumns.length ? (0, _extends2.default)({}, renderContext, {
|
|
139
133
|
firstColumnIndex: 0,
|
|
140
134
|
lastColumnIndex: leftPinnedColumns.length
|
|
@@ -159,7 +153,15 @@ const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
159
153
|
}, {
|
|
160
154
|
disableReorder: true
|
|
161
155
|
})
|
|
162
|
-
}),
|
|
156
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.GridColumnHeadersInner, (0, _extends2.default)({
|
|
157
|
+
isDragging: isDragging
|
|
158
|
+
}, getInnerProps(), {
|
|
159
|
+
children: getColumns({
|
|
160
|
+
renderContext,
|
|
161
|
+
minFirstColumn: leftPinnedColumns.length,
|
|
162
|
+
maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
|
|
163
|
+
})
|
|
164
|
+
})), rightRenderContext && /*#__PURE__*/(0, _jsxRuntime.jsx)(GridColumnHeadersPinnedColumnHeaders, {
|
|
163
165
|
ownerState: {
|
|
164
166
|
side: _columnPinning.GridPinnedPosition.right
|
|
165
167
|
},
|
|
@@ -175,15 +177,7 @@ const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
175
177
|
disableReorder: true,
|
|
176
178
|
separatorSide: _xDataGrid.GridColumnHeaderSeparatorSides.Left
|
|
177
179
|
})
|
|
178
|
-
})
|
|
179
|
-
isDragging: isDragging
|
|
180
|
-
}, getInnerProps(), {
|
|
181
|
-
children: getColumns({
|
|
182
|
-
renderContext,
|
|
183
|
-
minFirstColumn: leftPinnedColumns.length,
|
|
184
|
-
maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
|
|
185
|
-
})
|
|
186
|
-
}))]
|
|
180
|
+
})]
|
|
187
181
|
}));
|
|
188
182
|
});
|
|
189
183
|
exports.DataGridProColumnHeaders = DataGridProColumnHeaders;
|
|
@@ -202,9 +202,6 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
202
202
|
}, [renderContext, updateRenderZonePosition]);
|
|
203
203
|
(0, _xDataGrid.useGridApiEventHandler)(apiRef, _xDataGrid.GridEvents.columnWidthChange, refreshRenderZonePosition);
|
|
204
204
|
(0, _xDataGrid.useGridApiEventHandler)(apiRef, _xDataGrid.GridEvents.columnOrderChange, refreshRenderZonePosition);
|
|
205
|
-
React.useEffect(() => {
|
|
206
|
-
refreshRenderZonePosition();
|
|
207
|
-
}, [refreshRenderZonePosition]);
|
|
208
205
|
const leftRenderContext = renderContext && leftPinnedColumns.length > 0 ? (0, _extends2.default)({}, renderContext, {
|
|
209
206
|
firstColumnIndex: 0,
|
|
210
207
|
lastColumnIndex: leftPinnedColumns.length
|
|
@@ -270,7 +267,11 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
270
267
|
maxLastColumn: leftRenderContext.lastColumnIndex,
|
|
271
268
|
availableSpace: 0
|
|
272
269
|
})
|
|
273
|
-
}),
|
|
270
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.GridVirtualScrollerRenderZone, (0, _extends2.default)({}, getRenderZoneProps(), {
|
|
271
|
+
children: getRows({
|
|
272
|
+
renderContext
|
|
273
|
+
})
|
|
274
|
+
})), rightRenderContext && /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerPinnedColumns, {
|
|
274
275
|
ref: rightColumns,
|
|
275
276
|
ownerState: {
|
|
276
277
|
side: _columnPinning.GridPinnedPosition.right
|
|
@@ -283,11 +284,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
283
284
|
maxLastColumn: rightRenderContext.lastColumnIndex,
|
|
284
285
|
availableSpace: 0
|
|
285
286
|
})
|
|
286
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
287
|
-
children: getRows({
|
|
288
|
-
renderContext
|
|
289
|
-
})
|
|
290
|
-
})), detailPanels.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerDetailPanels, {
|
|
287
|
+
}), detailPanels.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerDetailPanels, {
|
|
291
288
|
className: classes.detailPanels,
|
|
292
289
|
children: detailPanels
|
|
293
290
|
})]
|
|
@@ -95,16 +95,27 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
95
95
|
*/
|
|
96
96
|
field: _propTypes.default.string.isRequired,
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* A ref allowing to set imperative focus.
|
|
100
|
+
* It can be passed to the element that should receive focus.
|
|
101
|
+
* @ignore - do not document.
|
|
102
|
+
*/
|
|
103
|
+
focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
104
|
+
current: _propTypes.default.shape({
|
|
105
|
+
focus: _propTypes.default.func.isRequired
|
|
106
|
+
})
|
|
107
|
+
})]),
|
|
108
|
+
|
|
98
109
|
/**
|
|
99
110
|
* The cell value formatted with the column valueFormatter.
|
|
100
111
|
*/
|
|
101
|
-
formattedValue: _propTypes.default.any
|
|
112
|
+
formattedValue: _propTypes.default.any,
|
|
102
113
|
|
|
103
114
|
/**
|
|
104
115
|
* Get the cell value of a row and field.
|
|
105
116
|
* @param {GridRowId} id The row id.
|
|
106
117
|
* @param {string} field The field.
|
|
107
|
-
* @returns {
|
|
118
|
+
* @returns {any} The cell value.
|
|
108
119
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
109
120
|
*/
|
|
110
121
|
getValue: _propTypes.default.func.isRequired,
|
|
@@ -127,7 +138,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
127
138
|
/**
|
|
128
139
|
* The row model of the row that the current cell belongs to.
|
|
129
140
|
*/
|
|
130
|
-
row: _propTypes.default.
|
|
141
|
+
row: _propTypes.default.object.isRequired,
|
|
131
142
|
|
|
132
143
|
/**
|
|
133
144
|
* The node of the row that the current cell belongs to.
|
|
@@ -142,5 +153,5 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
142
153
|
/**
|
|
143
154
|
* The cell value, but if the column has valueGetter, use getValue.
|
|
144
155
|
*/
|
|
145
|
-
value: _propTypes.default.any
|
|
156
|
+
value: _propTypes.default.any
|
|
146
157
|
} : void 0;
|
|
@@ -9,8 +9,6 @@ exports.GridGroupingCriteriaCell = void 0;
|
|
|
9
9
|
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
12
|
var _material = require("@mui/material");
|
|
15
13
|
|
|
16
14
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
@@ -98,73 +96,4 @@ const GridGroupingCriteriaCell = props => {
|
|
|
98
96
|
});
|
|
99
97
|
};
|
|
100
98
|
|
|
101
|
-
exports.GridGroupingCriteriaCell = GridGroupingCriteriaCell;
|
|
102
|
-
process.env.NODE_ENV !== "production" ? GridGroupingCriteriaCell.propTypes = {
|
|
103
|
-
// ----------------------------- Warning --------------------------------
|
|
104
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
105
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
106
|
-
// ----------------------------------------------------------------------
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* GridApi that let you manipulate the grid.
|
|
110
|
-
*/
|
|
111
|
-
api: _propTypes.default.any.isRequired,
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* The mode of the cell.
|
|
115
|
-
*/
|
|
116
|
-
cellMode: _propTypes.default.oneOf(['edit', 'view']).isRequired,
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* The column of the row that the current cell belongs to.
|
|
120
|
-
*/
|
|
121
|
-
colDef: _propTypes.default.object.isRequired,
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* The column field of the cell that triggered the event.
|
|
125
|
-
*/
|
|
126
|
-
field: _propTypes.default.string.isRequired,
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* The cell value formatted with the column valueFormatter.
|
|
130
|
-
*/
|
|
131
|
-
formattedValue: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string, _propTypes.default.bool]),
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Get the cell value of a row and field.
|
|
135
|
-
* @param {GridRowId} id The row id.
|
|
136
|
-
* @param {string} field The field.
|
|
137
|
-
* @returns {GridCellValue} The cell value.
|
|
138
|
-
*/
|
|
139
|
-
getValue: _propTypes.default.func.isRequired,
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* If true, the cell is the active element.
|
|
143
|
-
*/
|
|
144
|
-
hasFocus: _propTypes.default.bool.isRequired,
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* The grid row id.
|
|
148
|
-
*/
|
|
149
|
-
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* If true, the cell is editable.
|
|
153
|
-
*/
|
|
154
|
-
isEditable: _propTypes.default.bool,
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* The row model of the row that the current cell belongs to.
|
|
158
|
-
*/
|
|
159
|
-
row: _propTypes.default.object.isRequired,
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* the tabIndex value.
|
|
163
|
-
*/
|
|
164
|
-
tabIndex: _propTypes.default.oneOf([-1, 0]).isRequired,
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* The cell value, but if the column has valueGetter, use getValue.
|
|
168
|
-
*/
|
|
169
|
-
value: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.object, _propTypes.default.string, _propTypes.default.bool])
|
|
170
|
-
} : void 0;
|
|
99
|
+
exports.GridGroupingCriteriaCell = GridGroupingCriteriaCell;
|
|
@@ -129,16 +129,27 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
129
129
|
*/
|
|
130
130
|
field: _propTypes.default.string.isRequired,
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* A ref allowing to set imperative focus.
|
|
134
|
+
* It can be passed to the element that should receive focus.
|
|
135
|
+
* @ignore - do not document.
|
|
136
|
+
*/
|
|
137
|
+
focusElementRef: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
138
|
+
current: _propTypes.default.shape({
|
|
139
|
+
focus: _propTypes.default.func.isRequired
|
|
140
|
+
})
|
|
141
|
+
})]),
|
|
142
|
+
|
|
132
143
|
/**
|
|
133
144
|
* The cell value formatted with the column valueFormatter.
|
|
134
145
|
*/
|
|
135
|
-
formattedValue: _propTypes.default.any
|
|
146
|
+
formattedValue: _propTypes.default.any,
|
|
136
147
|
|
|
137
148
|
/**
|
|
138
149
|
* Get the cell value of a row and field.
|
|
139
150
|
* @param {GridRowId} id The row id.
|
|
140
151
|
* @param {string} field The field.
|
|
141
|
-
* @returns {
|
|
152
|
+
* @returns {any} The cell value.
|
|
142
153
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
143
154
|
*/
|
|
144
155
|
getValue: _propTypes.default.func.isRequired,
|
|
@@ -162,7 +173,7 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
162
173
|
/**
|
|
163
174
|
* The row model of the row that the current cell belongs to.
|
|
164
175
|
*/
|
|
165
|
-
row: _propTypes.default.
|
|
176
|
+
row: _propTypes.default.object.isRequired,
|
|
166
177
|
|
|
167
178
|
/**
|
|
168
179
|
* The node of the row that the current cell belongs to.
|
|
@@ -177,5 +188,5 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
177
188
|
/**
|
|
178
189
|
* The cell value, but if the column has valueGetter, use getValue.
|
|
179
190
|
*/
|
|
180
|
-
value: _propTypes.default.any
|
|
191
|
+
value: _propTypes.default.any
|
|
181
192
|
} : void 0;
|
|
@@ -205,11 +205,11 @@ const useGridColumnPinning = (apiRef, props) => {
|
|
|
205
205
|
|
|
206
206
|
return params;
|
|
207
207
|
}, [apiRef]);
|
|
208
|
-
(0, _internals.
|
|
209
|
-
(0, _internals.
|
|
210
|
-
(0, _internals.
|
|
211
|
-
(0, _internals.
|
|
212
|
-
(0, _internals.
|
|
208
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'scrollToIndexes', calculateScrollLeft);
|
|
209
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'columnMenu', addColumnMenuButtons);
|
|
210
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'canBeReordered', checkIfCanBeReordered);
|
|
211
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'exportState', stateExportPreProcessing);
|
|
212
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
213
213
|
apiRef.current.unstable_updateControlState({
|
|
214
214
|
stateId: 'pinnedColumns',
|
|
215
215
|
propModel: props.pinnedColumns,
|
|
@@ -60,7 +60,7 @@ const useGridColumnPinningPreProcessors = (apiRef, props) => {
|
|
|
60
60
|
all: [...leftPinnedColumns, ...centerColumns, ...rightPinnedColumns]
|
|
61
61
|
});
|
|
62
62
|
}, [disableColumnPinning, pinnedColumns]);
|
|
63
|
-
(0, _internals.
|
|
63
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'hydrateColumns', reorderPinnedColumns);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
exports.useGridColumnPinningPreProcessors = useGridColumnPinningPreProcessors;
|
|
@@ -137,7 +137,7 @@ const useGridColumnReorder = (apiRef, props) => {
|
|
|
137
137
|
canBeReordered = targetColIndex < visibleColumns.length - 1 && !visibleColumns[targetColIndex + 1].disableReorder;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
const canBeReorderedProcessed = apiRef.current.
|
|
140
|
+
const canBeReorderedProcessed = apiRef.current.unstable_applyPipeProcessors('canBeReordered', canBeReordered, {
|
|
141
141
|
targetIndex: targetColVisibleIndex
|
|
142
142
|
});
|
|
143
143
|
|
|
@@ -122,17 +122,29 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
122
122
|
|
|
123
123
|
const updateWidth = newWidth => {
|
|
124
124
|
logger.debug(`Updating width to ${newWidth} for col ${colDefRef.current.field}`);
|
|
125
|
+
const prevWidth = colElementRef.current.offsetWidth;
|
|
126
|
+
const widthDiff = newWidth - prevWidth;
|
|
125
127
|
colDefRef.current.computedWidth = newWidth;
|
|
126
128
|
colDefRef.current.width = newWidth;
|
|
127
|
-
colDefRef.current.flex =
|
|
129
|
+
colDefRef.current.flex = 0;
|
|
128
130
|
colElementRef.current.style.width = `${newWidth}px`;
|
|
129
131
|
colElementRef.current.style.minWidth = `${newWidth}px`;
|
|
130
132
|
colElementRef.current.style.maxWidth = `${newWidth}px`;
|
|
131
133
|
colCellElementsRef.current.forEach(element => {
|
|
132
134
|
const div = element;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
div.
|
|
135
|
+
let finalWidth;
|
|
136
|
+
|
|
137
|
+
if (div.getAttribute('aria-colspan') === '1') {
|
|
138
|
+
finalWidth = `${newWidth}px`;
|
|
139
|
+
} else {
|
|
140
|
+
// Cell with colspan > 1 cannot be just updated width new width.
|
|
141
|
+
// Instead, we add width diff to the current width.
|
|
142
|
+
finalWidth = `${div.offsetWidth + widthDiff}px`;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
div.style.width = finalWidth;
|
|
146
|
+
div.style.minWidth = finalWidth;
|
|
147
|
+
div.style.maxWidth = finalWidth;
|
|
136
148
|
});
|
|
137
149
|
};
|
|
138
150
|
|
|
@@ -196,7 +208,7 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
196
208
|
}, event);
|
|
197
209
|
colDefRef.current = colDef;
|
|
198
210
|
colElementRef.current = (_apiRef$current$colum = apiRef.current.columnHeadersContainerElementRef) == null ? void 0 : _apiRef$current$colum.current.querySelector(`[data-field="${colDef.field}"]`);
|
|
199
|
-
colCellElementsRef.current = (0, _domUtils.findGridCellElementsFromCol)(colElementRef.current);
|
|
211
|
+
colCellElementsRef.current = (0, _domUtils.findGridCellElementsFromCol)(colElementRef.current, apiRef.current);
|
|
200
212
|
const doc = (0, _utils.ownerDocument)(apiRef.current.rootElementRef.current);
|
|
201
213
|
doc.body.style.cursor = 'col-resize';
|
|
202
214
|
separatorSide.current = getSeparatorSide(event.currentTarget);
|
|
@@ -273,7 +285,7 @@ const useGridColumnResize = (apiRef, props) => {
|
|
|
273
285
|
}, event);
|
|
274
286
|
colDefRef.current = colDef;
|
|
275
287
|
colElementRef.current = (0, _domUtils.findHeaderElementFromField)((_apiRef$current$colum2 = apiRef.current.columnHeadersElementRef) == null ? void 0 : _apiRef$current$colum2.current, colDef.field);
|
|
276
|
-
colCellElementsRef.current = (0, _domUtils.findGridCellElementsFromCol)(colElementRef.current);
|
|
288
|
+
colCellElementsRef.current = (0, _domUtils.findGridCellElementsFromCol)(colElementRef.current, apiRef.current);
|
|
277
289
|
separatorSide.current = getSeparatorSide(event.target);
|
|
278
290
|
initialOffsetToSeparator.current = computeOffsetToSeparator(touch.clientX, colElementRef.current.getBoundingClientRect(), separatorSide.current);
|
|
279
291
|
const doc = (0, _utils.ownerDocument)(event.currentTarget);
|
|
@@ -57,11 +57,19 @@ const useGridDetailPanel = (apiRef, props) => {
|
|
|
57
57
|
apiRef.current.toggleDetailPanel(params.id);
|
|
58
58
|
}, [apiRef, contentCache, props.getDetailPanelContent]);
|
|
59
59
|
const handleCellKeyDown = React.useCallback((params, event) => {
|
|
60
|
-
if (
|
|
60
|
+
if (props.getDetailPanelContent == null) {
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
if ((event.ctrlKey || event.metaKey) && event.key === 'Enter') {
|
|
65
|
+
// TODO v6: only support Space on the detail toggle
|
|
66
|
+
apiRef.current.toggleDetailPanel(params.id);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (params.field === _gridDetailPanelToggleColDef.GRID_DETAIL_PANEL_TOGGLE_FIELD && event.key === ' ') {
|
|
71
|
+
apiRef.current.toggleDetailPanel(params.id);
|
|
72
|
+
}
|
|
65
73
|
}, [apiRef, props.getDetailPanelContent]);
|
|
66
74
|
(0, _xDataGrid.useGridApiEventHandler)(apiRef, _xDataGrid.GridEvents.cellClick, handleCellClick);
|
|
67
75
|
(0, _xDataGrid.useGridApiEventHandler)(apiRef, _xDataGrid.GridEvents.cellKeyDown, handleCellKeyDown);
|
|
@@ -80,7 +88,7 @@ const useGridDetailPanel = (apiRef, props) => {
|
|
|
80
88
|
|
|
81
89
|
});
|
|
82
90
|
}, [apiRef, expandedRowIds]);
|
|
83
|
-
(0, _internals.
|
|
91
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'rowHeight', addDetailHeight);
|
|
84
92
|
apiRef.current.unstable_updateControlState({
|
|
85
93
|
stateId: 'detailPanels',
|
|
86
94
|
propModel: props.detailPanelExpandedRowIds,
|