@mui/x-data-grid-premium 5.11.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 +4052 -0
- package/DataGridPremium/DataGridPremium.d.ts +9 -0
- package/DataGridPremium/DataGridPremium.js +986 -0
- package/DataGridPremium/index.d.ts +2 -0
- package/DataGridPremium/index.js +2 -0
- package/DataGridPremium/package.json +6 -0
- package/DataGridPremium/useDataGridPremiumComponent.d.ts +4 -0
- package/DataGridPremium/useDataGridPremiumComponent.js +78 -0
- package/DataGridPremium/useDataGridPremiumProps.d.ts +6 -0
- package/DataGridPremium/useDataGridPremiumProps.js +37 -0
- package/LICENSE +12 -0
- package/README.md +31 -0
- package/components/GridExcelExportMenuItem.d.ts +9 -0
- package/components/GridExcelExportMenuItem.js +32 -0
- package/components/GridGroupingColumnLeafCell.d.ts +4 -0
- package/components/GridGroupingColumnLeafCell.js +22 -0
- package/components/GridGroupingCriteriaCell.d.ts +7 -0
- package/components/GridGroupingCriteriaCell.js +78 -0
- package/components/GridRowGroupableColumnMenuItems.d.ts +11 -0
- package/components/GridRowGroupableColumnMenuItems.js +63 -0
- package/components/GridRowGroupingColumnMenuItems.d.ts +11 -0
- package/components/GridRowGroupingColumnMenuItems.js +58 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/package.json +6 -0
- package/hooks/features/export/gridExcelExportInterface.d.ts +58 -0
- package/hooks/features/export/gridExcelExportInterface.js +1 -0
- package/hooks/features/export/index.d.ts +1 -0
- package/hooks/features/export/index.js +1 -0
- package/hooks/features/export/serializer/excelSerializer.d.ts +14 -0
- package/hooks/features/export/serializer/excelSerializer.js +218 -0
- package/hooks/features/export/useGridExcelExport.d.ts +10 -0
- package/hooks/features/export/useGridExcelExport.js +77 -0
- package/hooks/features/index.d.ts +2 -0
- package/hooks/features/index.js +3 -0
- package/hooks/features/rowGrouping/createGroupingColDef.d.ts +42 -0
- package/hooks/features/rowGrouping/createGroupingColDef.js +318 -0
- package/hooks/features/rowGrouping/gridRowGroupingInterfaces.d.ts +37 -0
- package/hooks/features/rowGrouping/gridRowGroupingInterfaces.js +1 -0
- package/hooks/features/rowGrouping/gridRowGroupingSelector.d.ts +4 -0
- package/hooks/features/rowGrouping/gridRowGroupingSelector.js +5 -0
- package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +27 -0
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +139 -0
- package/hooks/features/rowGrouping/index.d.ts +3 -0
- package/hooks/features/rowGrouping/index.js +3 -0
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +11 -0
- package/hooks/features/rowGrouping/useGridRowGrouping.js +200 -0
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +4 -0
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +201 -0
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +3 -0
- package/hooks/package.json +6 -0
- package/hooks/utils/index.d.ts +1 -0
- package/hooks/utils/index.js +1 -0
- package/hooks/utils/useGridApiContext.d.ts +4 -0
- package/hooks/utils/useGridApiContext.js +2 -0
- package/hooks/utils/useGridApiRef.d.ts +4 -0
- package/hooks/utils/useGridApiRef.js +2 -0
- package/hooks/utils/useGridRootProps.d.ts +2 -0
- package/hooks/utils/useGridRootProps.js +2 -0
- package/hooks/utils/useKeepGroupedColumnsHidden.d.ts +12 -0
- package/hooks/utils/useKeepGroupedColumnsHidden.js +50 -0
- package/index.d.ts +22 -0
- package/index.js +25 -0
- package/legacy/DataGridPremium/DataGridPremium.js +986 -0
- package/legacy/DataGridPremium/index.js +2 -0
- package/legacy/DataGridPremium/useDataGridPremiumComponent.js +78 -0
- package/legacy/DataGridPremium/useDataGridPremiumProps.js +46 -0
- package/legacy/components/GridExcelExportMenuItem.js +30 -0
- package/legacy/components/GridGroupingColumnLeafCell.js +20 -0
- package/legacy/components/GridGroupingCriteriaCell.js +74 -0
- package/legacy/components/GridRowGroupableColumnMenuItems.js +61 -0
- package/legacy/components/GridRowGroupingColumnMenuItems.js +56 -0
- package/legacy/components/index.js +1 -0
- package/legacy/hooks/features/export/gridExcelExportInterface.js +1 -0
- package/legacy/hooks/features/export/index.js +1 -0
- package/legacy/hooks/features/export/serializer/excelSerializer.js +260 -0
- package/legacy/hooks/features/export/useGridExcelExport.js +111 -0
- package/legacy/hooks/features/index.js +3 -0
- package/legacy/hooks/features/rowGrouping/createGroupingColDef.js +319 -0
- package/legacy/hooks/features/rowGrouping/gridRowGroupingInterfaces.js +1 -0
- package/legacy/hooks/features/rowGrouping/gridRowGroupingSelector.js +13 -0
- package/legacy/hooks/features/rowGrouping/gridRowGroupingUtils.js +147 -0
- package/legacy/hooks/features/rowGrouping/index.js +3 -0
- package/legacy/hooks/features/rowGrouping/useGridRowGrouping.js +206 -0
- package/legacy/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +215 -0
- package/legacy/hooks/index.js +3 -0
- package/legacy/hooks/utils/index.js +1 -0
- package/legacy/hooks/utils/useGridApiContext.js +2 -0
- package/legacy/hooks/utils/useGridApiRef.js +2 -0
- package/legacy/hooks/utils/useGridRootProps.js +2 -0
- package/legacy/hooks/utils/useKeepGroupedColumnsHidden.js +50 -0
- package/legacy/index.js +25 -0
- package/legacy/models/dataGridPremiumProps.js +1 -0
- package/legacy/models/gridApiPremium.js +1 -0
- package/legacy/models/gridGroupingValueGetterParams.js +1 -0
- package/legacy/models/gridStatePremium.js +1 -0
- package/legacy/models/index.js +1 -0
- package/legacy/typeOverloads/index.js +1 -0
- package/legacy/typeOverloads/modules.js +33 -0
- package/legacy/typeOverloads/reexports.js +6 -0
- package/legacy/utils/releaseInfo.js +15 -0
- package/models/dataGridPremiumProps.d.ts +64 -0
- package/models/dataGridPremiumProps.js +1 -0
- package/models/gridApiPremium.d.ts +13 -0
- package/models/gridApiPremium.js +1 -0
- package/models/gridGroupingValueGetterParams.d.ts +31 -0
- package/models/gridGroupingValueGetterParams.js +1 -0
- package/models/gridStatePremium.d.ts +14 -0
- package/models/gridStatePremium.js +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/models/package.json +6 -0
- package/modern/DataGridPremium/DataGridPremium.js +986 -0
- package/modern/DataGridPremium/index.js +2 -0
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +76 -0
- package/modern/DataGridPremium/useDataGridPremiumProps.js +37 -0
- package/modern/components/GridExcelExportMenuItem.js +32 -0
- package/modern/components/GridGroupingColumnLeafCell.js +20 -0
- package/modern/components/GridGroupingCriteriaCell.js +76 -0
- package/modern/components/GridRowGroupableColumnMenuItems.js +61 -0
- package/modern/components/GridRowGroupingColumnMenuItems.js +56 -0
- package/modern/components/index.js +1 -0
- package/modern/hooks/features/export/gridExcelExportInterface.js +1 -0
- package/modern/hooks/features/export/index.js +1 -0
- package/modern/hooks/features/export/serializer/excelSerializer.js +216 -0
- package/modern/hooks/features/export/useGridExcelExport.js +73 -0
- package/modern/hooks/features/index.js +3 -0
- package/modern/hooks/features/rowGrouping/createGroupingColDef.js +302 -0
- package/modern/hooks/features/rowGrouping/gridRowGroupingInterfaces.js +1 -0
- package/modern/hooks/features/rowGrouping/gridRowGroupingSelector.js +5 -0
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +137 -0
- package/modern/hooks/features/rowGrouping/index.js +3 -0
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +192 -0
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +201 -0
- package/modern/hooks/index.js +3 -0
- package/modern/hooks/utils/index.js +1 -0
- package/modern/hooks/utils/useGridApiContext.js +2 -0
- package/modern/hooks/utils/useGridApiRef.js +2 -0
- package/modern/hooks/utils/useGridRootProps.js +2 -0
- package/modern/hooks/utils/useKeepGroupedColumnsHidden.js +46 -0
- package/modern/index.js +25 -0
- package/modern/models/dataGridPremiumProps.js +1 -0
- package/modern/models/gridApiPremium.js +1 -0
- package/modern/models/gridGroupingValueGetterParams.js +1 -0
- package/modern/models/gridStatePremium.js +1 -0
- package/modern/models/index.js +1 -0
- package/modern/typeOverloads/index.js +1 -0
- package/modern/typeOverloads/modules.js +33 -0
- package/modern/typeOverloads/reexports.js +6 -0
- package/modern/utils/releaseInfo.js +15 -0
- package/node/DataGridPremium/DataGridPremium.js +1009 -0
- package/node/DataGridPremium/index.js +30 -0
- package/node/DataGridPremium/useDataGridPremiumComponent.js +91 -0
- package/node/DataGridPremium/useDataGridPremiumProps.js +57 -0
- package/node/components/GridExcelExportMenuItem.js +49 -0
- package/node/components/GridGroupingColumnLeafCell.js +38 -0
- package/node/components/GridGroupingCriteriaCell.js +99 -0
- package/node/components/GridRowGroupableColumnMenuItems.js +82 -0
- package/node/components/GridRowGroupingColumnMenuItems.js +78 -0
- package/node/components/index.js +18 -0
- package/node/hooks/features/export/gridExcelExportInterface.js +5 -0
- package/node/hooks/features/export/index.js +18 -0
- package/node/hooks/features/export/serializer/excelSerializer.js +233 -0
- package/node/hooks/features/export/useGridExcelExport.js +95 -0
- package/node/hooks/features/index.js +31 -0
- package/node/hooks/features/rowGrouping/createGroupingColDef.js +341 -0
- package/node/hooks/features/rowGrouping/gridRowGroupingInterfaces.js +5 -0
- package/node/hooks/features/rowGrouping/gridRowGroupingSelector.js +18 -0
- package/node/hooks/features/rowGrouping/gridRowGroupingUtils.js +172 -0
- package/node/hooks/features/rowGrouping/index.js +51 -0
- package/node/hooks/features/rowGrouping/useGridRowGrouping.js +228 -0
- package/node/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +223 -0
- package/node/hooks/index.js +31 -0
- package/node/hooks/utils/index.js +18 -0
- package/node/hooks/utils/useGridApiContext.js +11 -0
- package/node/hooks/utils/useGridApiRef.js +11 -0
- package/node/hooks/utils/useGridRootProps.js +11 -0
- package/node/hooks/utils/useKeepGroupedColumnsHidden.js +66 -0
- package/node/index.js +272 -0
- package/node/models/dataGridPremiumProps.js +5 -0
- package/node/models/gridApiPremium.js +5 -0
- package/node/models/gridGroupingValueGetterParams.js +5 -0
- package/node/models/gridStatePremium.js +5 -0
- package/node/models/index.js +18 -0
- package/node/typeOverloads/index.js +3 -0
- package/node/typeOverloads/modules.js +34 -0
- package/node/typeOverloads/reexports.js +29 -0
- package/node/utils/releaseInfo.js +25 -0
- package/package.json +63 -0
- package/typeOverloads/index.d.ts +1 -0
- package/typeOverloads/index.js +1 -0
- package/typeOverloads/modules.d.ts +0 -0
- package/typeOverloads/modules.js +33 -0
- package/typeOverloads/package.json +6 -0
- package/typeOverloads/reexports.d.ts +22 -0
- package/typeOverloads/reexports.js +6 -0
- package/utils/releaseInfo.d.ts +1 -0
- package/utils/releaseInfo.js +15 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import Divider from '@mui/material/Divider';
|
|
5
|
+
import { useGridApiEventHandler, useGridApiMethod, gridFilteredDescendantCountLookupSelector } from '@mui/x-data-grid-pro';
|
|
6
|
+
import { useGridRegisterPipeProcessor, isDeepEqual } from '@mui/x-data-grid-pro/internals';
|
|
7
|
+
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector, gridRowGroupingStateSelector } from './gridRowGroupingSelector';
|
|
8
|
+
import { getRowGroupingFieldFromGroupingCriteria, ROW_GROUPING_STRATEGY, isGroupingColumn, mergeStateWithRowGroupingModel, setStrategyAvailability } from './gridRowGroupingUtils';
|
|
9
|
+
import { GridRowGroupableColumnMenuItems } from '../../../components/GridRowGroupableColumnMenuItems';
|
|
10
|
+
import { GridRowGroupingColumnMenuItems } from '../../../components/GridRowGroupingColumnMenuItems';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
export var rowGroupingStateInitializer = function rowGroupingStateInitializer(state, props) {
|
|
13
|
+
var _ref, _props$rowGroupingMod, _props$initialState, _props$initialState$r;
|
|
14
|
+
|
|
15
|
+
return _extends({}, state, {
|
|
16
|
+
rowGrouping: {
|
|
17
|
+
model: (_ref = (_props$rowGroupingMod = props.rowGroupingModel) != null ? _props$rowGroupingMod : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$r = _props$initialState.rowGrouping) == null ? void 0 : _props$initialState$r.model) != null ? _ref : [],
|
|
18
|
+
unstable_sanitizedModelOnLastRowTreeCreation: []
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @requires useGridColumns (state, method) - can be after, async only
|
|
24
|
+
* @requires useGridRows (state, method) - can be after, async only
|
|
25
|
+
* @requires useGridParamsApi (method) - can be after, async only
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
export var useGridRowGrouping = function useGridRowGrouping(apiRef, props) {
|
|
29
|
+
apiRef.current.unstable_updateControlState({
|
|
30
|
+
stateId: 'rowGrouping',
|
|
31
|
+
propModel: props.rowGroupingModel,
|
|
32
|
+
propOnChange: props.onRowGroupingModelChange,
|
|
33
|
+
stateSelector: gridRowGroupingModelSelector,
|
|
34
|
+
changeEvent: 'rowGroupingModelChange'
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* API METHODS
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
var setRowGroupingModel = React.useCallback(function (model) {
|
|
41
|
+
var currentModel = gridRowGroupingModelSelector(apiRef);
|
|
42
|
+
|
|
43
|
+
if (currentModel !== model) {
|
|
44
|
+
apiRef.current.setState(mergeStateWithRowGroupingModel(model));
|
|
45
|
+
setStrategyAvailability(apiRef, props.disableRowGrouping);
|
|
46
|
+
apiRef.current.forceUpdate();
|
|
47
|
+
}
|
|
48
|
+
}, [apiRef, props.disableRowGrouping]);
|
|
49
|
+
var addRowGroupingCriteria = React.useCallback(function (field, groupingIndex) {
|
|
50
|
+
var currentModel = gridRowGroupingModelSelector(apiRef);
|
|
51
|
+
|
|
52
|
+
if (currentModel.includes(field)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var cleanGroupingIndex = groupingIndex != null ? groupingIndex : currentModel.length;
|
|
57
|
+
var updatedModel = [].concat(_toConsumableArray(currentModel.slice(0, cleanGroupingIndex)), [field], _toConsumableArray(currentModel.slice(cleanGroupingIndex)));
|
|
58
|
+
apiRef.current.setRowGroupingModel(updatedModel);
|
|
59
|
+
}, [apiRef]);
|
|
60
|
+
var removeRowGroupingCriteria = React.useCallback(function (field) {
|
|
61
|
+
var currentModel = gridRowGroupingModelSelector(apiRef);
|
|
62
|
+
|
|
63
|
+
if (!currentModel.includes(field)) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
apiRef.current.setRowGroupingModel(currentModel.filter(function (el) {
|
|
68
|
+
return el !== field;
|
|
69
|
+
}));
|
|
70
|
+
}, [apiRef]);
|
|
71
|
+
var setRowGroupingCriteriaIndex = React.useCallback(function (field, targetIndex) {
|
|
72
|
+
var currentModel = gridRowGroupingModelSelector(apiRef);
|
|
73
|
+
var currentTargetIndex = currentModel.indexOf(field);
|
|
74
|
+
|
|
75
|
+
if (currentTargetIndex === -1) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var updatedModel = _toConsumableArray(currentModel);
|
|
80
|
+
|
|
81
|
+
updatedModel.splice(targetIndex, 0, updatedModel.splice(currentTargetIndex, 1)[0]);
|
|
82
|
+
apiRef.current.setRowGroupingModel(updatedModel);
|
|
83
|
+
}, [apiRef]);
|
|
84
|
+
var rowGroupingApi = {
|
|
85
|
+
setRowGroupingModel: setRowGroupingModel,
|
|
86
|
+
addRowGroupingCriteria: addRowGroupingCriteria,
|
|
87
|
+
removeRowGroupingCriteria: removeRowGroupingCriteria,
|
|
88
|
+
setRowGroupingCriteriaIndex: setRowGroupingCriteriaIndex
|
|
89
|
+
};
|
|
90
|
+
useGridApiMethod(apiRef, rowGroupingApi, 'GridRowGroupingApi');
|
|
91
|
+
/**
|
|
92
|
+
* PRE-PROCESSING
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
var addColumnMenuButtons = React.useCallback(function (initialValue, columns) {
|
|
96
|
+
if (props.disableRowGrouping) {
|
|
97
|
+
return initialValue;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var menuItems;
|
|
101
|
+
|
|
102
|
+
if (isGroupingColumn(columns.field)) {
|
|
103
|
+
menuItems = /*#__PURE__*/_jsx(GridRowGroupingColumnMenuItems, {});
|
|
104
|
+
} else if (columns.groupable) {
|
|
105
|
+
menuItems = /*#__PURE__*/_jsx(GridRowGroupableColumnMenuItems, {});
|
|
106
|
+
} else {
|
|
107
|
+
menuItems = null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (menuItems == null) {
|
|
111
|
+
return initialValue;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return [].concat(_toConsumableArray(initialValue), [/*#__PURE__*/_jsx(Divider, {}), menuItems]);
|
|
115
|
+
}, [props.disableRowGrouping]);
|
|
116
|
+
var stateExportPreProcessing = React.useCallback(function (prevState) {
|
|
117
|
+
if (props.disableRowGrouping) {
|
|
118
|
+
return prevState;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var rowGroupingModelToExport = gridRowGroupingModelSelector(apiRef);
|
|
122
|
+
|
|
123
|
+
if (rowGroupingModelToExport.length === 0) {
|
|
124
|
+
return prevState;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return _extends({}, prevState, {
|
|
128
|
+
rowGrouping: {
|
|
129
|
+
model: rowGroupingModelToExport
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}, [apiRef, props.disableRowGrouping]);
|
|
133
|
+
var stateRestorePreProcessing = React.useCallback(function (params, context) {
|
|
134
|
+
var _context$stateToResto;
|
|
135
|
+
|
|
136
|
+
if (props.disableRowGrouping) {
|
|
137
|
+
return params;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
var rowGroupingModel = (_context$stateToResto = context.stateToRestore.rowGrouping) == null ? void 0 : _context$stateToResto.model;
|
|
141
|
+
|
|
142
|
+
if (rowGroupingModel != null) {
|
|
143
|
+
apiRef.current.setState(mergeStateWithRowGroupingModel(rowGroupingModel));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return params;
|
|
147
|
+
}, [apiRef, props.disableRowGrouping]);
|
|
148
|
+
useGridRegisterPipeProcessor(apiRef, 'columnMenu', addColumnMenuButtons);
|
|
149
|
+
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
150
|
+
useGridRegisterPipeProcessor(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
151
|
+
/**
|
|
152
|
+
* EVENTS
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
var handleCellKeyDown = React.useCallback(function (params, event) {
|
|
156
|
+
var cellParams = apiRef.current.getCellParams(params.id, params.field);
|
|
157
|
+
|
|
158
|
+
if (isGroupingColumn(cellParams.field) && event.key === ' ' && !event.shiftKey) {
|
|
159
|
+
var _gridFilteredDescenda;
|
|
160
|
+
|
|
161
|
+
event.stopPropagation();
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
var filteredDescendantCount = (_gridFilteredDescenda = gridFilteredDescendantCountLookupSelector(apiRef)[params.id]) != null ? _gridFilteredDescenda : 0;
|
|
164
|
+
var isOnGroupingCell = props.rowGroupingColumnMode === 'single' || getRowGroupingFieldFromGroupingCriteria(params.rowNode.groupingField) === params.field;
|
|
165
|
+
|
|
166
|
+
if (!isOnGroupingCell || filteredDescendantCount === 0) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
apiRef.current.setRowChildrenExpansion(params.id, !params.rowNode.childrenExpanded);
|
|
171
|
+
}
|
|
172
|
+
}, [apiRef, props.rowGroupingColumnMode]);
|
|
173
|
+
var checkGroupingColumnsModelDiff = React.useCallback(function () {
|
|
174
|
+
var rowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
|
|
175
|
+
var lastGroupingColumnsModelApplied = gridRowGroupingStateSelector(apiRef.current.state).unstable_sanitizedModelOnLastRowTreeCreation;
|
|
176
|
+
|
|
177
|
+
if (!isDeepEqual(lastGroupingColumnsModelApplied, rowGroupingModel)) {
|
|
178
|
+
apiRef.current.setState(function (state) {
|
|
179
|
+
return _extends({}, state, {
|
|
180
|
+
rowGrouping: _extends({}, state.rowGrouping, {
|
|
181
|
+
unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
apiRef.current.unstable_requestPipeProcessorsApplication('hydrateColumns');
|
|
186
|
+
setStrategyAvailability(apiRef, props.disableRowGrouping); // Refresh the row tree creation strategy processing
|
|
187
|
+
// TODO: Add a clean way to re-run a strategy processing without publishing a private event
|
|
188
|
+
|
|
189
|
+
if (apiRef.current.unstable_getActiveStrategy('rowTree') === ROW_GROUPING_STRATEGY) {
|
|
190
|
+
apiRef.current.publishEvent('activeStrategyProcessorChange', 'rowTreeCreation');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}, [apiRef, props.disableRowGrouping]);
|
|
194
|
+
useGridApiEventHandler(apiRef, 'cellKeyDown', handleCellKeyDown);
|
|
195
|
+
useGridApiEventHandler(apiRef, 'columnsChange', checkGroupingColumnsModelDiff);
|
|
196
|
+
useGridApiEventHandler(apiRef, 'rowGroupingModelChange', checkGroupingColumnsModelDiff);
|
|
197
|
+
/**
|
|
198
|
+
* EFFECTS
|
|
199
|
+
*/
|
|
200
|
+
|
|
201
|
+
React.useEffect(function () {
|
|
202
|
+
if (props.rowGroupingModel !== undefined) {
|
|
203
|
+
apiRef.current.setRowGroupingModel(props.rowGroupingModel);
|
|
204
|
+
}
|
|
205
|
+
}, [apiRef, props.rowGroupingModel]);
|
|
206
|
+
};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { gridColumnLookupSelector, gridRowIdsSelector, gridRowTreeSelector, useFirstRender } from '@mui/x-data-grid-pro';
|
|
5
|
+
import { useGridRegisterPipeProcessor, useGridRegisterStrategyProcessor, sortRowTree, buildRowTree } from '@mui/x-data-grid-pro/internals';
|
|
6
|
+
import { gridRowGroupingModelSelector, gridRowGroupingSanitizedModelSelector } from './gridRowGroupingSelector';
|
|
7
|
+
import { createGroupingColDefForAllGroupingCriteria, createGroupingColDefForOneGroupingCriteria } from './createGroupingColDef';
|
|
8
|
+
import { filterRowTreeFromGroupingColumns, getColDefOverrides, ROW_GROUPING_STRATEGY, isGroupingColumn, setStrategyAvailability } from './gridRowGroupingUtils';
|
|
9
|
+
export var useGridRowGroupingPreProcessors = function useGridRowGroupingPreProcessors(apiRef, props) {
|
|
10
|
+
var getGroupingColDefs = React.useCallback(function (columnsState) {
|
|
11
|
+
if (props.disableRowGrouping) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var groupingColDefProp = props.groupingColDef; // We can't use `gridGroupingRowsSanitizedModelSelector` here because the new columns are not in the state yet
|
|
16
|
+
|
|
17
|
+
var rowGroupingModel = gridRowGroupingModelSelector(apiRef).filter(function (field) {
|
|
18
|
+
return !!columnsState.lookup[field];
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
if (rowGroupingModel.length === 0) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
switch (props.rowGroupingColumnMode) {
|
|
26
|
+
case 'single':
|
|
27
|
+
{
|
|
28
|
+
return [createGroupingColDefForAllGroupingCriteria({
|
|
29
|
+
apiRef: apiRef,
|
|
30
|
+
rowGroupingModel: rowGroupingModel,
|
|
31
|
+
colDefOverride: getColDefOverrides(groupingColDefProp, rowGroupingModel),
|
|
32
|
+
columnsLookup: columnsState.lookup
|
|
33
|
+
})];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
case 'multiple':
|
|
37
|
+
{
|
|
38
|
+
return rowGroupingModel.map(function (groupingCriteria) {
|
|
39
|
+
return createGroupingColDefForOneGroupingCriteria({
|
|
40
|
+
groupingCriteria: groupingCriteria,
|
|
41
|
+
colDefOverride: getColDefOverrides(groupingColDefProp, [groupingCriteria]),
|
|
42
|
+
groupedByColDef: columnsState.lookup[groupingCriteria],
|
|
43
|
+
columnsLookup: columnsState.lookup
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
default:
|
|
49
|
+
{
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}, [apiRef, props.groupingColDef, props.rowGroupingColumnMode, props.disableRowGrouping]);
|
|
54
|
+
var updateGroupingColumn = React.useCallback(function (columnsState) {
|
|
55
|
+
var groupingColDefs = getGroupingColDefs(columnsState);
|
|
56
|
+
var newColumnFields = [];
|
|
57
|
+
var newColumnsLookup = {}; // We only keep the non-grouping columns
|
|
58
|
+
|
|
59
|
+
columnsState.all.forEach(function (field) {
|
|
60
|
+
if (!isGroupingColumn(field)) {
|
|
61
|
+
newColumnFields.push(field);
|
|
62
|
+
newColumnsLookup[field] = columnsState.lookup[field];
|
|
63
|
+
}
|
|
64
|
+
}); // We add the grouping column
|
|
65
|
+
|
|
66
|
+
groupingColDefs.forEach(function (groupingColDef) {
|
|
67
|
+
var matchingGroupingColDef = columnsState.lookup[groupingColDef.field];
|
|
68
|
+
|
|
69
|
+
if (matchingGroupingColDef) {
|
|
70
|
+
groupingColDef.width = matchingGroupingColDef.width;
|
|
71
|
+
groupingColDef.flex = matchingGroupingColDef.flex;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
newColumnsLookup[groupingColDef.field] = groupingColDef;
|
|
75
|
+
});
|
|
76
|
+
var startIndex = newColumnFields[0] === '__check__' ? 1 : 0;
|
|
77
|
+
newColumnFields = [].concat(_toConsumableArray(newColumnFields.slice(0, startIndex)), _toConsumableArray(groupingColDefs.map(function (colDef) {
|
|
78
|
+
return colDef.field;
|
|
79
|
+
})), _toConsumableArray(newColumnFields.slice(startIndex)));
|
|
80
|
+
columnsState.all = newColumnFields;
|
|
81
|
+
columnsState.lookup = newColumnsLookup;
|
|
82
|
+
return columnsState;
|
|
83
|
+
}, [getGroupingColDefs]);
|
|
84
|
+
var createRowTree = React.useCallback(function (params) {
|
|
85
|
+
var rowGroupingModel = gridRowGroupingSanitizedModelSelector(apiRef);
|
|
86
|
+
var columnsLookup = gridColumnLookupSelector(apiRef);
|
|
87
|
+
apiRef.current.setState(function (state) {
|
|
88
|
+
return _extends({}, state, {
|
|
89
|
+
rowGrouping: _extends({}, state.rowGrouping, {
|
|
90
|
+
unstable_sanitizedModelOnLastRowTreeCreation: rowGroupingModel
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var distinctValues = Object.fromEntries(rowGroupingModel.map(function (groupingField) {
|
|
95
|
+
return [groupingField, {
|
|
96
|
+
lookup: {},
|
|
97
|
+
list: []
|
|
98
|
+
}];
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
var getCellGroupingCriteria = function getCellGroupingCriteria(_ref) {
|
|
102
|
+
var row = _ref.row,
|
|
103
|
+
id = _ref.id,
|
|
104
|
+
colDef = _ref.colDef;
|
|
105
|
+
var key;
|
|
106
|
+
|
|
107
|
+
if (colDef.groupingValueGetter) {
|
|
108
|
+
var groupingValueGetterParams = {
|
|
109
|
+
colDef: colDef,
|
|
110
|
+
field: colDef.field,
|
|
111
|
+
value: row[colDef.field],
|
|
112
|
+
id: id,
|
|
113
|
+
row: row,
|
|
114
|
+
rowNode: {
|
|
115
|
+
isAutoGenerated: false,
|
|
116
|
+
id: id
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
key = colDef.groupingValueGetter(groupingValueGetterParams);
|
|
120
|
+
} else {
|
|
121
|
+
key = row[colDef.field];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
key: key,
|
|
126
|
+
field: colDef.field
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
params.ids.forEach(function (rowId) {
|
|
131
|
+
var row = params.idRowsLookup[rowId];
|
|
132
|
+
rowGroupingModel.forEach(function (groupingCriteria) {
|
|
133
|
+
var _getCellGroupingCrite = getCellGroupingCriteria({
|
|
134
|
+
row: row,
|
|
135
|
+
id: rowId,
|
|
136
|
+
colDef: columnsLookup[groupingCriteria]
|
|
137
|
+
}),
|
|
138
|
+
key = _getCellGroupingCrite.key;
|
|
139
|
+
|
|
140
|
+
var groupingFieldsDistinctKeys = distinctValues[groupingCriteria];
|
|
141
|
+
|
|
142
|
+
if (key != null && !groupingFieldsDistinctKeys.lookup[key.toString()]) {
|
|
143
|
+
groupingFieldsDistinctKeys.lookup[key.toString()] = true;
|
|
144
|
+
groupingFieldsDistinctKeys.list.push(key);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
var rows = params.ids.map(function (rowId) {
|
|
149
|
+
var row = params.idRowsLookup[rowId];
|
|
150
|
+
var parentPath = rowGroupingModel.map(function (groupingField) {
|
|
151
|
+
return getCellGroupingCriteria({
|
|
152
|
+
row: row,
|
|
153
|
+
id: rowId,
|
|
154
|
+
colDef: columnsLookup[groupingField]
|
|
155
|
+
});
|
|
156
|
+
}).filter(function (cell) {
|
|
157
|
+
return cell.key != null;
|
|
158
|
+
});
|
|
159
|
+
var leafGroupingCriteria = {
|
|
160
|
+
key: rowId.toString(),
|
|
161
|
+
field: null
|
|
162
|
+
};
|
|
163
|
+
return {
|
|
164
|
+
path: [].concat(_toConsumableArray(parentPath), [leafGroupingCriteria]),
|
|
165
|
+
id: rowId
|
|
166
|
+
};
|
|
167
|
+
});
|
|
168
|
+
return buildRowTree(_extends({}, params, {
|
|
169
|
+
rows: rows,
|
|
170
|
+
defaultGroupingExpansionDepth: props.defaultGroupingExpansionDepth,
|
|
171
|
+
isGroupExpandedByDefault: props.isGroupExpandedByDefault,
|
|
172
|
+
groupingName: ROW_GROUPING_STRATEGY
|
|
173
|
+
}));
|
|
174
|
+
}, [apiRef, props.defaultGroupingExpansionDepth, props.isGroupExpandedByDefault]);
|
|
175
|
+
var filterRows = React.useCallback(function (params) {
|
|
176
|
+
var rowTree = gridRowTreeSelector(apiRef);
|
|
177
|
+
return filterRowTreeFromGroupingColumns({
|
|
178
|
+
rowTree: rowTree,
|
|
179
|
+
isRowMatchingFilters: params.isRowMatchingFilters
|
|
180
|
+
});
|
|
181
|
+
}, [apiRef]);
|
|
182
|
+
var sortRows = React.useCallback(function (params) {
|
|
183
|
+
var rowTree = gridRowTreeSelector(apiRef);
|
|
184
|
+
var rowIds = gridRowIdsSelector(apiRef);
|
|
185
|
+
return sortRowTree({
|
|
186
|
+
rowTree: rowTree,
|
|
187
|
+
rowIds: rowIds,
|
|
188
|
+
sortRowList: params.sortRowList,
|
|
189
|
+
disableChildrenSorting: false
|
|
190
|
+
});
|
|
191
|
+
}, [apiRef]);
|
|
192
|
+
useGridRegisterPipeProcessor(apiRef, 'hydrateColumns', updateGroupingColumn);
|
|
193
|
+
useGridRegisterStrategyProcessor(apiRef, ROW_GROUPING_STRATEGY, 'rowTreeCreation', createRowTree);
|
|
194
|
+
useGridRegisterStrategyProcessor(apiRef, ROW_GROUPING_STRATEGY, 'filtering', filterRows);
|
|
195
|
+
useGridRegisterStrategyProcessor(apiRef, ROW_GROUPING_STRATEGY, 'sorting', sortRows);
|
|
196
|
+
/**
|
|
197
|
+
* 1ST RENDER
|
|
198
|
+
*/
|
|
199
|
+
|
|
200
|
+
useFirstRender(function () {
|
|
201
|
+
setStrategyAvailability(apiRef, props.disableRowGrouping);
|
|
202
|
+
});
|
|
203
|
+
/**
|
|
204
|
+
* EFFECTS
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
var isFirstRender = React.useRef(true);
|
|
208
|
+
React.useEffect(function () {
|
|
209
|
+
if (!isFirstRender.current) {
|
|
210
|
+
setStrategyAvailability(apiRef, props.disableRowGrouping);
|
|
211
|
+
} else {
|
|
212
|
+
isFirstRender.current = false;
|
|
213
|
+
}
|
|
214
|
+
}, [apiRef, props.disableRowGrouping]);
|
|
215
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useKeepGroupedColumnsHidden';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { gridColumnVisibilityModelSelector, GridEvents } from '@mui/x-data-grid-pro';
|
|
4
|
+
|
|
5
|
+
var updateColumnVisibilityModel = function updateColumnVisibilityModel(columnVisibilityModel, rowGroupingModel, prevRowGroupingModel) {
|
|
6
|
+
var newColumnVisibilityModel = _extends({}, columnVisibilityModel);
|
|
7
|
+
|
|
8
|
+
rowGroupingModel == null ? void 0 : rowGroupingModel.forEach(function (field) {
|
|
9
|
+
if (!(prevRowGroupingModel != null && prevRowGroupingModel.includes(field))) {
|
|
10
|
+
newColumnVisibilityModel[field] = false;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
prevRowGroupingModel == null ? void 0 : prevRowGroupingModel.forEach(function (field) {
|
|
14
|
+
if (!(rowGroupingModel != null && rowGroupingModel.includes(field))) {
|
|
15
|
+
newColumnVisibilityModel[field] = true;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return newColumnVisibilityModel;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Automatically hide columns when added to the row grouping model and stop hiding them when they are removed.
|
|
22
|
+
* Handles both the `props.initialState.rowGrouping.model` and `props.rowGroupingModel`
|
|
23
|
+
* Does not work when used with the `hide` property of `GridColDef`
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
export var useKeepGroupedColumnsHidden = function useKeepGroupedColumnsHidden(props) {
|
|
28
|
+
var _props$rowGroupingMod, _props$initialState, _props$initialState$r;
|
|
29
|
+
|
|
30
|
+
var initialProps = React.useRef(props);
|
|
31
|
+
var rowGroupingModel = React.useRef((_props$rowGroupingMod = props.rowGroupingModel) != null ? _props$rowGroupingMod : (_props$initialState = props.initialState) == null ? void 0 : (_props$initialState$r = _props$initialState.rowGrouping) == null ? void 0 : _props$initialState$r.model);
|
|
32
|
+
React.useEffect(function () {
|
|
33
|
+
props.apiRef.current.subscribeEvent(GridEvents.rowGroupingModelChange, function (newModel) {
|
|
34
|
+
var columnVisibilityModel = updateColumnVisibilityModel(gridColumnVisibilityModelSelector(props.apiRef), newModel, rowGroupingModel.current);
|
|
35
|
+
props.apiRef.current.setColumnVisibilityModel(columnVisibilityModel);
|
|
36
|
+
rowGroupingModel.current = newModel;
|
|
37
|
+
});
|
|
38
|
+
}, [props.apiRef]);
|
|
39
|
+
return React.useMemo(function () {
|
|
40
|
+
var _invariantInitialStat;
|
|
41
|
+
|
|
42
|
+
var invariantInitialState = initialProps.current.initialState;
|
|
43
|
+
var columnVisibilityModel = updateColumnVisibilityModel(invariantInitialState == null ? void 0 : (_invariantInitialStat = invariantInitialState.columns) == null ? void 0 : _invariantInitialStat.columnVisibilityModel, rowGroupingModel.current, undefined);
|
|
44
|
+
return _extends({}, invariantInitialState, {
|
|
45
|
+
columns: _extends({}, invariantInitialState == null ? void 0 : invariantInitialState.columns, {
|
|
46
|
+
columnVisibilityModel: columnVisibilityModel
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}, []);
|
|
50
|
+
};
|
package/legacy/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @license MUI v5.11.0
|
|
2
|
+
*
|
|
3
|
+
* This source code is licensed under the MIT license found in the
|
|
4
|
+
* LICENSE file in the root directory of this source tree.
|
|
5
|
+
*/
|
|
6
|
+
import './typeOverloads';
|
|
7
|
+
import '@mui/x-data-grid-pro/typeOverloads';
|
|
8
|
+
export { LicenseInfo } from '@mui/x-license-pro';
|
|
9
|
+
export * from '@mui/x-data-grid/components';
|
|
10
|
+
export * from '@mui/x-data-grid-pro/components';
|
|
11
|
+
export * from '@mui/x-data-grid/constants';
|
|
12
|
+
export * from '@mui/x-data-grid/hooks';
|
|
13
|
+
export * from '@mui/x-data-grid-pro/hooks';
|
|
14
|
+
export * from '@mui/x-data-grid/locales';
|
|
15
|
+
export * from '@mui/x-data-grid/models';
|
|
16
|
+
export * from '@mui/x-data-grid-pro/models';
|
|
17
|
+
export * from '@mui/x-data-grid/context';
|
|
18
|
+
export * from '@mui/x-data-grid/colDef';
|
|
19
|
+
export * from '@mui/x-data-grid/utils';
|
|
20
|
+
export * from '@mui/x-data-grid-pro/utils';
|
|
21
|
+
export * from './DataGridPremium';
|
|
22
|
+
export * from './hooks';
|
|
23
|
+
export * from './models';
|
|
24
|
+
export * from './components';
|
|
25
|
+
export { useGridApiContext, useGridApiRef, useGridRootProps } from './typeOverloads/reexports';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './gridGroupingValueGetterParams';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@mui/x-data-grid-pro/typeOverloads';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// import { GridKeyValue, GridValidRowModel } from '@mui/x-data-grid-pro';
|
|
2
|
+
// import type { GridControlledStateEventLookupPro } from '@mui/x-data-grid-pro/typeOverloads';
|
|
3
|
+
// import type { GridGroupingValueGetterParams } from '../models';
|
|
4
|
+
// import type { GridRowGroupingModel } from '../hooks';
|
|
5
|
+
//
|
|
6
|
+
// export interface GridControlledStateEventLookupPremium {
|
|
7
|
+
// /**
|
|
8
|
+
// * Fired when the row grouping model changes.
|
|
9
|
+
// */
|
|
10
|
+
// rowGroupingModelChange: { params: GridRowGroupingModel };
|
|
11
|
+
// }
|
|
12
|
+
//
|
|
13
|
+
// // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
|
+
// export interface GridColDefPremium<R extends GridValidRowModel = any, V = any, F = V> {
|
|
15
|
+
// /**
|
|
16
|
+
// * Function that transforms a complex cell value into a key that be used for grouping the rows.
|
|
17
|
+
// * @param {GridGroupingValueGetterParams} params Object containing parameters for the getter.
|
|
18
|
+
// * @returns {GridKeyValue | null | undefined} The cell key.
|
|
19
|
+
// */
|
|
20
|
+
// groupingValueGetter?: (
|
|
21
|
+
// params: GridGroupingValueGetterParams<V, R>,
|
|
22
|
+
// ) => GridKeyValue | null | undefined;
|
|
23
|
+
// }
|
|
24
|
+
//
|
|
25
|
+
// declare module '@mui/x-data-grid-pro' {
|
|
26
|
+
// export interface GridColDef<R extends GridValidRowModel = any, V = any, F = V>
|
|
27
|
+
// extends GridColDefPremium<R, V, F> {}
|
|
28
|
+
//
|
|
29
|
+
// // TODO: Remove explicit augmentation of pro package
|
|
30
|
+
// interface GridControlledStateEventLookup
|
|
31
|
+
// extends GridControlledStateEventLookupPro,
|
|
32
|
+
// GridControlledStateEventLookupPremium {}
|
|
33
|
+
// }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ponyfillGlobal } from '@mui/utils';
|
|
2
|
+
export var getReleaseInfo = function getReleaseInfo() {
|
|
3
|
+
var releaseInfo = "MTY1MjM5MjgwMDAwMA==";
|
|
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
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { GridCallbackDetails, GridValidRowModel } from '@mui/x-data-grid-pro';
|
|
3
|
+
import { GridExperimentalProFeatures, DataGridProPropsWithDefaultValue, DataGridProPropsWithoutDefaultValue, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPropsWithComplexDefaultValueBeforeProcessing } from '@mui/x-data-grid-pro/internals';
|
|
4
|
+
import type { GridRowGroupingModel } from '../hooks/features/rowGrouping';
|
|
5
|
+
import { GridInitialStatePremium } from './gridStatePremium';
|
|
6
|
+
import { GridApiPremium } from './gridApiPremium';
|
|
7
|
+
export interface GridExperimentalPremiumFeatures extends GridExperimentalProFeatures {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The props users can give to the `DataGridProProps` component.
|
|
11
|
+
*/
|
|
12
|
+
export interface DataGridPremiumProps<R extends GridValidRowModel = any> extends Omit<Partial<DataGridPremiumPropsWithDefaultValue> & DataGridPropsWithComplexDefaultValueBeforeProcessing & DataGridPremiumPropsWithoutDefaultValue<R>, DataGridPremiumForcedPropsKey> {
|
|
13
|
+
/**
|
|
14
|
+
* Features under development.
|
|
15
|
+
* 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.
|
|
16
|
+
*/
|
|
17
|
+
experimentalFeatures?: Partial<GridExperimentalPremiumFeatures>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The props of the `DataGridPremium` component after the pre-processing phase.
|
|
21
|
+
*/
|
|
22
|
+
export interface DataGridPremiumProcessedProps extends DataGridPremiumPropsWithDefaultValue, DataGridPropsWithComplexDefaultValueAfterProcessing, DataGridPremiumPropsWithoutDefaultValue {
|
|
23
|
+
}
|
|
24
|
+
export declare type DataGridPremiumForcedPropsKey = 'signature';
|
|
25
|
+
/**
|
|
26
|
+
* The `DataGridPremium` options with a default value overridable through props
|
|
27
|
+
* None of the entry of this interface should be optional, they all have default values and `DataGridProps` already applies a `Partial<DataGridSimpleOptions>` for the public interface
|
|
28
|
+
* The controlled model do not have a default value at the prop processing level, so they must be defined in `DataGridOtherProps`
|
|
29
|
+
*/
|
|
30
|
+
export interface DataGridPremiumPropsWithDefaultValue extends DataGridProPropsWithDefaultValue {
|
|
31
|
+
/**
|
|
32
|
+
* If `true`, the row grouping is disabled.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
disableRowGrouping: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* If `single`, all column we are grouping by will be represented in the same grouping the same column.
|
|
38
|
+
* If `multiple`, each column we are grouping by will be represented in its own column.
|
|
39
|
+
* @default 'single'
|
|
40
|
+
*/
|
|
41
|
+
rowGroupingColumnMode: 'single' | 'multiple';
|
|
42
|
+
}
|
|
43
|
+
export interface DataGridPremiumPropsWithoutDefaultValue<R extends GridValidRowModel = any> extends Omit<DataGridProPropsWithoutDefaultValue<R>, 'initialState' | 'apiRef'> {
|
|
44
|
+
/**
|
|
45
|
+
* The ref object that allows grid manipulation. Can be instantiated with [[useGridApiRef()]].
|
|
46
|
+
*/
|
|
47
|
+
apiRef?: React.MutableRefObject<GridApiPremium>;
|
|
48
|
+
/**
|
|
49
|
+
* The initial state of the DataGridPremium.
|
|
50
|
+
* The data in it will be set in the state on initialization but will not be controlled.
|
|
51
|
+
* If one of the data in `initialState` is also being controlled, then the control state wins.
|
|
52
|
+
*/
|
|
53
|
+
initialState?: GridInitialStatePremium;
|
|
54
|
+
/**
|
|
55
|
+
* Set the row grouping model of the grid.
|
|
56
|
+
*/
|
|
57
|
+
rowGroupingModel?: GridRowGroupingModel;
|
|
58
|
+
/**
|
|
59
|
+
* Callback fired when the row grouping model changes.
|
|
60
|
+
* @param {GridRowGroupingModel} model Columns used as grouping criteria.
|
|
61
|
+
* @param {GridCallbackDetails} details Additional details for this callback.
|
|
62
|
+
*/
|
|
63
|
+
onRowGroupingModelChange?: (model: GridRowGroupingModel, details: GridCallbackDetails) => void;
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|