@mui/x-data-grid-pro 5.6.0 → 5.8.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 +187 -0
- package/DataGridPro/DataGridPro.d.ts +7 -1
- package/DataGridPro/DataGridPro.js +63 -20
- package/DataGridPro/useDataGridProComponent.js +29 -18
- package/DataGridPro/useDataGridProProps.d.ts +2 -1
- package/DataGridPro/useDataGridProProps.js +2 -2
- package/components/DataGridProColumnHeaders.js +10 -10
- package/components/DataGridProVirtualScroller.js +12 -23
- package/components/GridDetailPanelToggleCell.js +4 -3
- package/components/GridGroupingCriteriaCell.d.ts +2 -5
- package/components/GridGroupingCriteriaCell.js +2 -74
- package/components/GridTreeDataGroupingCell.js +4 -3
- package/components/index.d.ts +1 -0
- package/components/index.js +2 -1
- package/hooks/features/columnPinning/useGridColumnPinning.js +6 -6
- package/hooks/features/columnPinning/useGridColumnPinningPreProcessors.js +2 -2
- package/hooks/features/columnReorder/useGridColumnReorder.d.ts +2 -0
- package/hooks/features/columnReorder/useGridColumnReorder.js +7 -8
- 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 +10 -10
- package/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
- package/hooks/features/infiniteLoader/useGridInfiniteLoader.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 +46 -167
- 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 -82
- package/hooks/features/treeData/useGridTreeDataPreProcessors.d.ts +1 -1
- package/hooks/features/treeData/useGridTreeDataPreProcessors.js +73 -4
- package/index.d.ts +2 -1
- package/index.js +3 -2
- package/legacy/DataGridPro/DataGridPro.js +63 -20
- package/legacy/DataGridPro/useDataGridProComponent.js +29 -18
- package/legacy/DataGridPro/useDataGridProProps.js +7 -2
- package/legacy/components/DataGridProColumnHeaders.js +10 -10
- package/legacy/components/DataGridProVirtualScroller.js +12 -22
- package/legacy/components/GridDetailPanelToggleCell.js +4 -3
- package/legacy/components/GridGroupingCriteriaCell.js +2 -74
- package/legacy/components/GridTreeDataGroupingCell.js +4 -3
- package/legacy/components/index.js +2 -1
- 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 +9 -10
- package/legacy/hooks/features/columnResize/useGridColumnResize.js +9 -9
- package/legacy/hooks/features/detailPanel/useGridDetailPanel.js +10 -10
- package/legacy/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
- package/legacy/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +19 -2
- package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +48 -172
- 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 -90
- package/legacy/hooks/features/treeData/useGridTreeDataPreProcessors.js +85 -4
- package/legacy/index.js +3 -2
- 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 +63 -20
- package/modern/DataGridPro/useDataGridProComponent.js +27 -18
- package/modern/DataGridPro/useDataGridProProps.js +2 -2
- package/modern/components/DataGridProColumnHeaders.js +10 -10
- package/modern/components/DataGridProVirtualScroller.js +12 -23
- package/modern/components/GridDetailPanelToggleCell.js +4 -3
- package/modern/components/GridGroupingCriteriaCell.js +2 -74
- package/modern/components/GridTreeDataGroupingCell.js +4 -3
- package/modern/components/index.js +2 -1
- 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 +7 -8
- package/modern/hooks/features/columnResize/useGridColumnResize.js +7 -7
- package/modern/hooks/features/detailPanel/useGridDetailPanel.js +9 -9
- package/modern/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +2 -2
- package/modern/hooks/features/infiniteLoader/useGridInfiniteLoader.js +2 -2
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +18 -3
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +46 -167
- 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 -82
- package/modern/hooks/features/treeData/useGridTreeDataPreProcessors.js +73 -4
- package/modern/index.js +3 -2
- package/modern/utils/releaseInfo.js +15 -0
- package/node/DataGridPro/DataGridPro.js +61 -19
- package/node/DataGridPro/useDataGridProComponent.js +26 -15
- package/node/DataGridPro/useDataGridProProps.js +2 -2
- package/node/components/DataGridProColumnHeaders.js +10 -10
- package/node/components/DataGridProVirtualScroller.js +11 -22
- package/node/components/GridDetailPanelToggleCell.js +4 -3
- package/node/components/GridGroupingCriteriaCell.js +1 -72
- package/node/components/GridTreeDataGroupingCell.js +4 -3
- package/node/components/index.js +13 -0
- 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 +10 -9
- package/node/hooks/features/columnResize/useGridColumnResize.js +9 -6
- package/node/hooks/features/detailPanel/useGridDetailPanel.js +13 -10
- package/node/hooks/features/detailPanel/useGridDetailPanelPreProcessors.js +1 -1
- package/node/hooks/features/infiniteLoader/useGridInfiniteLoader.js +1 -1
- package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +24 -5
- package/node/hooks/features/rowGrouping/useGridRowGrouping.js +42 -165
- 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 -91
- package/node/hooks/features/treeData/useGridTreeDataPreProcessors.js +75 -3
- package/node/index.js +23 -9
- package/node/utils/releaseInfo.js +25 -0
- package/package.json +5 -4
- package/typeOverloads/modules.d.ts +6 -6
- package/typeOverloads/reexports.d.ts +1 -1
- 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
|
@@ -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 = "MTY0NjM0ODQwMDAwMA=="; // 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,8 +293,10 @@ 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
|
-
rowGrouping: _propTypes.default.bool
|
|
298
|
+
rowGrouping: _propTypes.default.bool,
|
|
299
|
+
warnIfFocusStateIsNotSynced: _propTypes.default.bool
|
|
304
300
|
}),
|
|
305
301
|
|
|
306
302
|
/**
|
|
@@ -353,7 +349,7 @@ DataGridProRaw.propTypes = {
|
|
|
353
349
|
|
|
354
350
|
/**
|
|
355
351
|
* Function that applies CSS classes dynamically on rows.
|
|
356
|
-
* @param {
|
|
352
|
+
* @param {GridRowClassNameParams} params With all properties from [[GridRowClassNameParams]].
|
|
357
353
|
* @returns {string} The CSS class to apply to the row.
|
|
358
354
|
*/
|
|
359
355
|
getRowClassName: _propTypes.default.func,
|
|
@@ -370,11 +366,19 @@ DataGridProRaw.propTypes = {
|
|
|
370
366
|
*/
|
|
371
367
|
getRowId: _propTypes.default.func,
|
|
372
368
|
|
|
369
|
+
/**
|
|
370
|
+
* Function that allows to specify the spacing between rows.
|
|
371
|
+
* @param {GridRowSpacingParams} params With all properties from [[GridRowSpacingParams]].
|
|
372
|
+
* @returns {GridRowSpacing} The row spacing values.
|
|
373
|
+
*/
|
|
374
|
+
getRowSpacing: _propTypes.default.func,
|
|
375
|
+
|
|
373
376
|
/**
|
|
374
377
|
* Determines the path of a row in the tree data.
|
|
375
378
|
* For instance, a row with the path ["A", "B"] is the child of the row with the path ["A"].
|
|
376
379
|
* Note that all paths must contain at least one element.
|
|
377
|
-
* @
|
|
380
|
+
* @template R
|
|
381
|
+
* @param {R} row The row from which we want the path.
|
|
378
382
|
* @returns {string[]} The path to the row.
|
|
379
383
|
*/
|
|
380
384
|
getTreeDataPath: _propTypes.default.func,
|
|
@@ -457,7 +461,7 @@ DataGridProRaw.propTypes = {
|
|
|
457
461
|
|
|
458
462
|
/**
|
|
459
463
|
* Set the locale text of the grid.
|
|
460
|
-
* 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/
|
|
464
|
+
* 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.
|
|
461
465
|
*/
|
|
462
466
|
localeText: _propTypes.default.object,
|
|
463
467
|
|
|
@@ -685,6 +689,28 @@ DataGridProRaw.propTypes = {
|
|
|
685
689
|
*/
|
|
686
690
|
onPinnedColumnsChange: _propTypes.default.func,
|
|
687
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
|
+
|
|
688
714
|
/**
|
|
689
715
|
* Callback fired when the grid is resized.
|
|
690
716
|
* @param {ElementSize} containerSize With all properties from [[ElementSize]].
|
|
@@ -804,6 +830,16 @@ DataGridProRaw.propTypes = {
|
|
|
804
830
|
right: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
805
831
|
}),
|
|
806
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
|
+
|
|
807
843
|
/**
|
|
808
844
|
* Number of extra rows to be rendered before/after the visible slice.
|
|
809
845
|
* @default 3
|
|
@@ -837,7 +873,13 @@ DataGridProRaw.propTypes = {
|
|
|
837
873
|
/**
|
|
838
874
|
* Set of rows of type [[GridRowsProp]].
|
|
839
875
|
*/
|
|
840
|
-
rows: _propTypes.default.
|
|
876
|
+
rows: _propTypes.default.array.isRequired,
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Sets the type of space between rows added by `getRowSpacing`.
|
|
880
|
+
* @default "margin"
|
|
881
|
+
*/
|
|
882
|
+
rowSpacingType: _propTypes.default.oneOf(['border', 'margin']),
|
|
841
883
|
|
|
842
884
|
/**
|
|
843
885
|
* Select the pageSize dynamically using the component UI.
|
|
@@ -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,35 @@ 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
|
|
|
51
|
-
(0, _internals.useGridInitializeState)(_internals.filterStateInitializer, apiRef, props);
|
|
52
|
-
(0, _internals.useGridInitializeState)(_internals.pageSizeStateInitializer, apiRef, props);
|
|
53
|
-
(0, _internals.useGridInitializeState)(_internals.pageStateInitializer, apiRef, props);
|
|
54
|
-
(0, _internals.useGridInitializeState)(_internals.sortingStateInitializer, apiRef, props);
|
|
55
|
-
(0, _internals.useGridInitializeState)(_useGridColumnPinning.columnPinningStateInitializer, apiRef, props);
|
|
56
55
|
(0, _internals.useGridInitializeState)(_useGridRowGrouping.rowGroupingStateInitializer, apiRef, props);
|
|
56
|
+
(0, _internals.useGridInitializeState)(_internals.selectionStateInitializer, apiRef, props);
|
|
57
|
+
(0, _internals.useGridInitializeState)(_useGridDetailPanel.detailPanelStateInitializer, apiRef, props);
|
|
58
|
+
(0, _internals.useGridInitializeState)(_useGridColumnPinning.columnPinningStateInitializer, apiRef, props);
|
|
57
59
|
(0, _internals.useGridInitializeState)(_internals.columnsStateInitializer, apiRef, props);
|
|
58
|
-
(0, _useGridRowGrouping.useGridRowGrouping)(apiRef, props); // FIXME Needs to be called before the rows state initialization because it registers a rows group builder
|
|
59
|
-
|
|
60
|
-
(0, _useGridTreeData.useGridTreeData)(apiRef, props); // FIXME Needs to be called before the rows state initialization because it registers a rows group builder
|
|
61
|
-
|
|
62
60
|
(0, _internals.useGridInitializeState)(_internals.rowsStateInitializer, apiRef, props);
|
|
61
|
+
(0, _internals.useGridInitializeState)((_props$experimentalFe = props.experimentalFeatures) != null && _props$experimentalFe.newEditingApi ? _internals.editingStateInitializer_new : _internals.editingStateInitializer_old, apiRef, props);
|
|
62
|
+
(0, _internals.useGridInitializeState)(_internals.focusStateInitializer, apiRef, props);
|
|
63
|
+
(0, _internals.useGridInitializeState)(_internals.sortingStateInitializer, apiRef, props);
|
|
64
|
+
(0, _internals.useGridInitializeState)(_internals.preferencePanelStateInitializer, apiRef, props);
|
|
65
|
+
(0, _internals.useGridInitializeState)(_internals.filterStateInitializer, apiRef, props);
|
|
66
|
+
(0, _internals.useGridInitializeState)(_internals.densityStateInitializer, apiRef, props);
|
|
67
|
+
(0, _internals.useGridInitializeState)(_useGridColumnReorder.columnReorderStateInitializer, apiRef, props);
|
|
68
|
+
(0, _internals.useGridInitializeState)(_useGridColumnResize.columnResizeStateInitializer, apiRef, props);
|
|
69
|
+
(0, _internals.useGridInitializeState)(_internals.paginationStateInitializer, apiRef, props);
|
|
70
|
+
(0, _internals.useGridInitializeState)(_internals.rowsMetaStateInitializer, apiRef, props);
|
|
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);
|
|
63
75
|
(0, _internals.useGridSelection)(apiRef, props);
|
|
64
76
|
(0, _useGridDetailPanel.useGridDetailPanel)(apiRef, props);
|
|
65
77
|
(0, _useGridColumnPinning.useGridColumnPinning)(apiRef, props);
|
|
@@ -67,10 +79,11 @@ const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
67
79
|
(0, _internals.useGridRows)(apiRef, props);
|
|
68
80
|
(0, _internals.useGridParamsApi)(apiRef);
|
|
69
81
|
(0, _useGridDetailPanelCache.useGridDetailPanelCache)(apiRef, props);
|
|
70
|
-
|
|
82
|
+
const useGridEditing = (_props$experimentalFe2 = props.experimentalFeatures) != null && _props$experimentalFe2.newEditingApi ? _internals.useGridEditing_new : _internals.useGridEditing_old;
|
|
83
|
+
useGridEditing(apiRef, props);
|
|
71
84
|
(0, _internals.useGridFocus)(apiRef, props);
|
|
72
85
|
(0, _internals.useGridSorting)(apiRef, props);
|
|
73
|
-
(0, _internals.useGridPreferencesPanel)(apiRef
|
|
86
|
+
(0, _internals.useGridPreferencesPanel)(apiRef);
|
|
74
87
|
(0, _internals.useGridFilter)(apiRef, props);
|
|
75
88
|
(0, _internals.useGridDensity)(apiRef, props);
|
|
76
89
|
(0, _useGridColumnReorder.useGridColumnReorder)(apiRef, props);
|
|
@@ -80,8 +93,6 @@ const useDataGridProComponent = (inputApiRef, props) => {
|
|
|
80
93
|
(0, _internals.useGridScroll)(apiRef, props);
|
|
81
94
|
(0, _useGridInfiniteLoader.useGridInfiniteLoader)(apiRef, props);
|
|
82
95
|
(0, _internals.useGridColumnMenu)(apiRef);
|
|
83
|
-
(0, _internals.useGridKeyboard)(apiRef);
|
|
84
|
-
(0, _internals.useGridKeyboardNavigation)(apiRef, props);
|
|
85
96
|
(0, _internals.useGridCsvExport)(apiRef);
|
|
86
97
|
(0, _internals.useGridPrintExport)(apiRef, props);
|
|
87
98
|
(0, _internals.useGridClipboard)(apiRef);
|
|
@@ -49,8 +49,8 @@ const useDataGridProProps = inProps => {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
const mergedComponents = {};
|
|
52
|
-
Object.
|
|
53
|
-
mergedComponents[key] = overrides[key] === undefined ?
|
|
52
|
+
Object.entries(_xDataGrid.DATA_GRID_DEFAULT_SLOTS_COMPONENTS).forEach(([key, defaultComponent]) => {
|
|
53
|
+
mergedComponents[key] = overrides[key] === undefined ? defaultComponent : overrides[key];
|
|
54
54
|
});
|
|
55
55
|
return mergedComponents;
|
|
56
56
|
}, [themedProps.components]);
|
|
@@ -159,7 +159,15 @@ const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
159
159
|
}, {
|
|
160
160
|
disableReorder: true
|
|
161
161
|
})
|
|
162
|
-
}),
|
|
162
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.GridColumnHeadersInner, (0, _extends2.default)({
|
|
163
|
+
isDragging: isDragging
|
|
164
|
+
}, getInnerProps(), {
|
|
165
|
+
children: getColumns({
|
|
166
|
+
renderContext,
|
|
167
|
+
minFirstColumn: leftPinnedColumns.length,
|
|
168
|
+
maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
|
|
169
|
+
})
|
|
170
|
+
})), rightRenderContext && /*#__PURE__*/(0, _jsxRuntime.jsx)(GridColumnHeadersPinnedColumnHeaders, {
|
|
163
171
|
ownerState: {
|
|
164
172
|
side: _columnPinning.GridPinnedPosition.right
|
|
165
173
|
},
|
|
@@ -175,15 +183,7 @@ const DataGridProColumnHeaders = /*#__PURE__*/React.forwardRef(function DataGrid
|
|
|
175
183
|
disableReorder: true,
|
|
176
184
|
separatorSide: _xDataGrid.GridColumnHeaderSeparatorSides.Left
|
|
177
185
|
})
|
|
178
|
-
})
|
|
179
|
-
isDragging: isDragging
|
|
180
|
-
}, getInnerProps(), {
|
|
181
|
-
children: getColumns({
|
|
182
|
-
renderContext,
|
|
183
|
-
minFirstColumn: leftPinnedColumns.length,
|
|
184
|
-
maxLastColumn: visibleColumnFields.length - rightPinnedColumns.length
|
|
185
|
-
})
|
|
186
|
-
}))]
|
|
186
|
+
})]
|
|
187
187
|
}));
|
|
188
188
|
});
|
|
189
189
|
exports.DataGridProColumnHeaders = DataGridProColumnHeaders;
|
|
@@ -142,7 +142,6 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
142
142
|
const other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
143
143
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
144
144
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
145
|
-
const currentPage = (0, _internals.useCurrentPageRows)(apiRef, rootProps);
|
|
146
145
|
const visibleColumnFields = (0, _xDataGrid.useGridSelector)(apiRef, _xDataGrid.gridVisibleColumnFieldsSelector);
|
|
147
146
|
const expandedRowIds = (0, _xDataGrid.useGridSelector)(apiRef, _detailPanel.gridDetailPanelExpandedRowIdsSelector);
|
|
148
147
|
const detailPanelsContent = (0, _xDataGrid.useGridSelector)(apiRef, _detailPanel.gridDetailPanelExpandedRowsContentCacheSelector);
|
|
@@ -218,18 +217,6 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
218
217
|
const pinnedColumnsStyle = {
|
|
219
218
|
minHeight: contentProps.style.minHeight
|
|
220
219
|
};
|
|
221
|
-
const rowsLookup = React.useMemo(() => {
|
|
222
|
-
if (rootProps.getDetailPanelContent == null) {
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
return currentPage.rows.reduce((acc, {
|
|
227
|
-
id
|
|
228
|
-
}, index) => {
|
|
229
|
-
acc[id] = index;
|
|
230
|
-
return acc;
|
|
231
|
-
}, {});
|
|
232
|
-
}, [currentPage.rows, rootProps.getDetailPanelContent]);
|
|
233
220
|
|
|
234
221
|
const getDetailPanels = () => {
|
|
235
222
|
const panels = [];
|
|
@@ -245,12 +232,14 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
245
232
|
const id = uniqueExpandedRowIds[i];
|
|
246
233
|
const content = detailPanelsContent[id]; // Check if the id exists in the current page
|
|
247
234
|
|
|
248
|
-
const
|
|
235
|
+
const rowIndex = apiRef.current.getRowIndexRelativeToVisibleRows(id);
|
|
236
|
+
const exists = rowIndex !== undefined;
|
|
249
237
|
|
|
250
238
|
if ( /*#__PURE__*/React.isValidElement(content) && exists) {
|
|
251
239
|
const height = detailPanelsHeights[id];
|
|
252
|
-
const
|
|
253
|
-
const
|
|
240
|
+
const sizes = apiRef.current.unstable_getRowInternalSizes(id);
|
|
241
|
+
const spacingTop = (sizes == null ? void 0 : sizes.spacingTop) || 0;
|
|
242
|
+
const top = rowsMeta.positions[rowIndex] + apiRef.current.unstable_getRowHeight(id) + spacingTop;
|
|
254
243
|
panels.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerDetailPanel, {
|
|
255
244
|
style: {
|
|
256
245
|
top,
|
|
@@ -281,7 +270,11 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
281
270
|
maxLastColumn: leftRenderContext.lastColumnIndex,
|
|
282
271
|
availableSpace: 0
|
|
283
272
|
})
|
|
284
|
-
}),
|
|
273
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_internals.GridVirtualScrollerRenderZone, (0, _extends2.default)({}, getRenderZoneProps(), {
|
|
274
|
+
children: getRows({
|
|
275
|
+
renderContext
|
|
276
|
+
})
|
|
277
|
+
})), rightRenderContext && /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerPinnedColumns, {
|
|
285
278
|
ref: rightColumns,
|
|
286
279
|
ownerState: {
|
|
287
280
|
side: _columnPinning.GridPinnedPosition.right
|
|
@@ -294,11 +287,7 @@ const DataGridProVirtualScroller = /*#__PURE__*/React.forwardRef(function DataGr
|
|
|
294
287
|
maxLastColumn: rightRenderContext.lastColumnIndex,
|
|
295
288
|
availableSpace: 0
|
|
296
289
|
})
|
|
297
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
298
|
-
children: getRows({
|
|
299
|
-
renderContext
|
|
300
|
-
})
|
|
301
|
-
})), detailPanels.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerDetailPanels, {
|
|
290
|
+
}), detailPanels.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(VirtualScrollerDetailPanels, {
|
|
302
291
|
className: classes.detailPanels,
|
|
303
292
|
children: detailPanels
|
|
304
293
|
})]
|
|
@@ -76,8 +76,9 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* GridApi that let you manipulate the grid.
|
|
79
|
+
* @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
|
|
79
80
|
*/
|
|
80
|
-
api: _propTypes.default.
|
|
81
|
+
api: _propTypes.default.any.isRequired,
|
|
81
82
|
|
|
82
83
|
/**
|
|
83
84
|
* The mode of the cell.
|
|
@@ -103,7 +104,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
103
104
|
* Get the cell value of a row and field.
|
|
104
105
|
* @param {GridRowId} id The row id.
|
|
105
106
|
* @param {string} field The field.
|
|
106
|
-
* @returns {
|
|
107
|
+
* @returns {any} The cell value.
|
|
107
108
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
108
109
|
*/
|
|
109
110
|
getValue: _propTypes.default.func.isRequired,
|
|
@@ -126,7 +127,7 @@ process.env.NODE_ENV !== "production" ? GridDetailPanelToggleCell.propTypes = {
|
|
|
126
127
|
/**
|
|
127
128
|
* The row model of the row that the current cell belongs to.
|
|
128
129
|
*/
|
|
129
|
-
row: _propTypes.default.
|
|
130
|
+
row: _propTypes.default.object.isRequired,
|
|
130
131
|
|
|
131
132
|
/**
|
|
132
133
|
* The node of the row that the current cell belongs to.
|
|
@@ -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;
|
|
@@ -110,8 +110,9 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* GridApi that let you manipulate the grid.
|
|
113
|
+
* @deprecated Use the `apiRef` returned by `useGridApiContext` or `useGridApiRef` (only available in `@mui/x-data-grid-pro`)
|
|
113
114
|
*/
|
|
114
|
-
api: _propTypes.default.
|
|
115
|
+
api: _propTypes.default.any.isRequired,
|
|
115
116
|
|
|
116
117
|
/**
|
|
117
118
|
* The mode of the cell.
|
|
@@ -137,7 +138,7 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
137
138
|
* Get the cell value of a row and field.
|
|
138
139
|
* @param {GridRowId} id The row id.
|
|
139
140
|
* @param {string} field The field.
|
|
140
|
-
* @returns {
|
|
141
|
+
* @returns {any} The cell value.
|
|
141
142
|
* @deprecated Use `params.row` to directly access the fields you want instead.
|
|
142
143
|
*/
|
|
143
144
|
getValue: _propTypes.default.func.isRequired,
|
|
@@ -161,7 +162,7 @@ process.env.NODE_ENV !== "production" ? GridTreeDataGroupingCell.propTypes = {
|
|
|
161
162
|
/**
|
|
162
163
|
* The row model of the row that the current cell belongs to.
|
|
163
164
|
*/
|
|
164
|
-
row: _propTypes.default.
|
|
165
|
+
row: _propTypes.default.object.isRequired,
|
|
165
166
|
|
|
166
167
|
/**
|
|
167
168
|
* The node of the row that the current cell belongs to.
|
package/node/components/index.js
CHANGED
|
@@ -28,4 +28,17 @@ Object.keys(_GridColumnPinningMenuItems).forEach(function (key) {
|
|
|
28
28
|
return _GridColumnPinningMenuItems[key];
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _GridDetailPanelToggleCell = require("./GridDetailPanelToggleCell");
|
|
34
|
+
|
|
35
|
+
Object.keys(_GridDetailPanelToggleCell).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _GridDetailPanelToggleCell[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _GridDetailPanelToggleCell[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
31
44
|
});
|
|
@@ -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;
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.useGridColumnReorder = void 0;
|
|
8
|
+
exports.useGridColumnReorder = exports.columnReorderStateInitializer = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -15,8 +15,6 @@ var _material = require("@mui/material");
|
|
|
15
15
|
|
|
16
16
|
var _xDataGrid = require("@mui/x-data-grid");
|
|
17
17
|
|
|
18
|
-
var _internals = require("@mui/x-data-grid/internals");
|
|
19
|
-
|
|
20
18
|
var _columnReorderSelector = require("./columnReorderSelector");
|
|
21
19
|
|
|
22
20
|
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); }
|
|
@@ -41,19 +39,22 @@ const useUtilityClasses = ownerState => {
|
|
|
41
39
|
};
|
|
42
40
|
return (0, _material.unstable_composeClasses)(slots, _xDataGrid.getDataGridUtilityClass, classes);
|
|
43
41
|
};
|
|
42
|
+
|
|
43
|
+
const columnReorderStateInitializer = state => (0, _extends2.default)({}, state, {
|
|
44
|
+
columnReorder: {
|
|
45
|
+
dragCol: ''
|
|
46
|
+
}
|
|
47
|
+
});
|
|
44
48
|
/**
|
|
45
49
|
* Only available in DataGridPro
|
|
46
50
|
* @requires useGridColumns (method)
|
|
47
51
|
*/
|
|
48
52
|
|
|
49
53
|
|
|
54
|
+
exports.columnReorderStateInitializer = columnReorderStateInitializer;
|
|
55
|
+
|
|
50
56
|
const useGridColumnReorder = (apiRef, props) => {
|
|
51
57
|
const logger = (0, _xDataGrid.useGridLogger)(apiRef, 'useGridColumnReorder');
|
|
52
|
-
(0, _internals.useGridStateInit)(apiRef, state => (0, _extends2.default)({}, state, {
|
|
53
|
-
columnReorder: {
|
|
54
|
-
dragCol: ''
|
|
55
|
-
}
|
|
56
|
-
}));
|
|
57
58
|
const dragColNode = React.useRef(null);
|
|
58
59
|
const cursorPosition = React.useRef({
|
|
59
60
|
x: 0,
|
|
@@ -136,7 +137,7 @@ const useGridColumnReorder = (apiRef, props) => {
|
|
|
136
137
|
canBeReordered = targetColIndex < visibleColumns.length - 1 && !visibleColumns[targetColIndex + 1].disableReorder;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
const canBeReorderedProcessed = apiRef.current.
|
|
140
|
+
const canBeReorderedProcessed = apiRef.current.unstable_applyPipeProcessors('canBeReordered', canBeReordered, {
|
|
140
141
|
targetIndex: targetColVisibleIndex
|
|
141
142
|
});
|
|
142
143
|
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.useGridColumnResize = void 0;
|
|
8
|
+
exports.useGridColumnResize = exports.columnResizeStateInitializer = void 0;
|
|
9
9
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
|
|
@@ -92,6 +92,12 @@ function computeOffsetToSeparator(clickX, columnBounds, separatorSide) {
|
|
|
92
92
|
function getSeparatorSide(element) {
|
|
93
93
|
return element.classList.contains(_xDataGrid.gridClasses['columnSeparator--sideRight']) ? _xDataGrid.GridColumnHeaderSeparatorSides.Right : _xDataGrid.GridColumnHeaderSeparatorSides.Left;
|
|
94
94
|
}
|
|
95
|
+
|
|
96
|
+
const columnResizeStateInitializer = state => (0, _extends2.default)({}, state, {
|
|
97
|
+
columnResize: {
|
|
98
|
+
resizingColumnField: ''
|
|
99
|
+
}
|
|
100
|
+
});
|
|
95
101
|
/**
|
|
96
102
|
* Only available in DataGridPro
|
|
97
103
|
* @requires useGridColumns (method, event)
|
|
@@ -99,13 +105,10 @@ function getSeparatorSide(element) {
|
|
|
99
105
|
*/
|
|
100
106
|
|
|
101
107
|
|
|
108
|
+
exports.columnResizeStateInitializer = columnResizeStateInitializer;
|
|
109
|
+
|
|
102
110
|
const useGridColumnResize = (apiRef, props) => {
|
|
103
111
|
const logger = (0, _xDataGrid.useGridLogger)(apiRef, 'useGridColumnResize');
|
|
104
|
-
(0, _internals.useGridStateInit)(apiRef, state => (0, _extends2.default)({}, state, {
|
|
105
|
-
columnResize: {
|
|
106
|
-
resizingColumnField: ''
|
|
107
|
-
}
|
|
108
|
-
}));
|
|
109
112
|
const colDefRef = React.useRef();
|
|
110
113
|
const colElementRef = React.useRef();
|
|
111
114
|
const colCellElementsRef = React.useRef(); // To improve accessibility, the separator has padding on both sides.
|