@mui/x-data-grid-premium 8.15.0 → 8.17.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 +207 -0
- package/DataGridPremium/DataGridPremium.js +3 -1
- package/DataGridPremium/useDataGridPremiumComponent.js +1 -1
- package/components/GridAggregationHeader.d.ts +1 -2
- package/components/GridAggregationHeader.js +0 -2
- package/components/GridBottomContainer.d.ts +1 -1
- package/components/GridDataSourceGroupingCriteriaCell.d.ts +1 -2
- package/components/GridEmptyPivotOverlay.d.ts +2 -3
- package/components/GridEmptyPivotOverlay.js +0 -2
- package/components/GridExcelExportMenuItem.d.ts +1 -2
- package/components/GridExcelExportMenuItem.js +0 -2
- package/components/GridFooterCell.d.ts +1 -2
- package/components/GridFooterCell.js +0 -2
- package/components/GridGroupingColumnFooterCell.d.ts +1 -2
- package/components/GridGroupingColumnFooterCell.js +0 -2
- package/components/GridGroupingColumnLeafCell.d.ts +1 -2
- package/components/GridGroupingColumnLeafCell.js +0 -2
- package/components/GridGroupingCriteriaCell.d.ts +1 -2
- package/components/GridPremiumColumnMenu.d.ts +2 -3
- package/components/GridPremiumColumnMenu.js +0 -2
- package/components/GridPremiumToolbar.d.ts +1 -2
- package/components/aiAssistantPanel/GridAiAssistantPanel.d.ts +1 -2
- package/components/aiAssistantPanel/GridAiAssistantPanelConversation.d.ts +1 -2
- package/components/aiAssistantPanel/GridAiAssistantPanelConversationsMenu.d.ts +1 -2
- package/components/aiAssistantPanel/GridAiAssistantPanelSuggestions.d.ts +1 -2
- package/components/aiAssistantPanel/GridAiAssistantPanelSuggestions.js +0 -2
- package/components/chartsPanel/GridChartsPanel.d.ts +1 -2
- package/components/chartsPanel/chart/GridChartsPanelChart.d.ts +1 -2
- package/components/chartsPanel/chart/GridChartsPanelChart.js +0 -2
- package/components/chartsPanel/customize/GridChartsPanelCustomize.d.ts +1 -2
- package/components/chartsPanel/data/GridChartsPanelData.d.ts +1 -2
- package/components/chartsPanel/data/GridChartsPanelDataBody.d.ts +1 -2
- package/components/chartsPanel/data/GridChartsPanelDataField.d.ts +2 -2
- package/components/chartsPanel/data/GridChartsPanelDataFieldMenu.d.ts +1 -2
- package/components/chartsPanel/data/GridChartsPanelDataHeader.d.ts +1 -2
- package/components/chartsPanel/data/GridChartsPanelDataSearch.d.ts +1 -2
- package/components/collapsible/Collapsible.d.ts +1 -1
- package/components/collapsible/CollapsiblePanel.d.ts +1 -1
- package/components/collapsible/CollapsibleTrigger.d.ts +1 -1
- package/components/columnMenu/menuItems/GridColumnMenuAggregationItem.d.ts +1 -2
- package/components/columnMenu/menuItems/GridColumnMenuChartsItem.d.ts +1 -2
- package/components/columnMenu/menuItems/GridColumnMenuManagePanelItem.d.ts +1 -2
- package/components/columnMenu/menuItems/GridColumnMenuPivotItem.d.ts +1 -2
- package/components/columnMenu/menuItems/GridColumnMenuRowGroupItem.d.ts +1 -2
- package/components/columnMenu/menuItems/GridColumnMenuRowUngroupItem.d.ts +1 -2
- package/components/pivotPanel/GridPivotPanel.d.ts +1 -2
- package/components/pivotPanel/GridPivotPanelBody.d.ts +1 -2
- package/components/pivotPanel/GridPivotPanelField.d.ts +1 -1
- package/components/pivotPanel/GridPivotPanelFieldMenu.d.ts +1 -2
- package/components/pivotPanel/GridPivotPanelHeader.d.ts +1 -2
- package/components/pivotPanel/GridPivotPanelSearch.d.ts +1 -2
- package/components/prompt/GridPrompt.d.ts +1 -2
- package/components/promptField/GridPromptField.d.ts +1 -2
- package/components/promptField/GridPromptField.js +0 -2
- package/components/resizablePanel/ResizablePanel.d.ts +1 -1
- package/components/resizablePanel/ResizablePanelHandle.d.ts +1 -1
- package/components/sidebar/Sidebar.d.ts +1 -1
- package/components/sidebar/SidebarHeader.d.ts +1 -1
- package/context/GridChartsIntegrationContextProvider.d.ts +1 -1
- package/context/GridChartsRendererProxy.d.ts +1 -1
- package/esm/DataGridPremium/DataGridPremium.js +3 -1
- package/esm/DataGridPremium/useDataGridPremiumComponent.js +1 -1
- package/esm/components/GridAggregationHeader.d.ts +1 -2
- package/esm/components/GridAggregationHeader.js +0 -1
- package/esm/components/GridBottomContainer.d.ts +1 -1
- package/esm/components/GridDataSourceGroupingCriteriaCell.d.ts +1 -2
- package/esm/components/GridEmptyPivotOverlay.d.ts +2 -3
- package/esm/components/GridEmptyPivotOverlay.js +0 -1
- package/esm/components/GridExcelExportMenuItem.d.ts +1 -2
- package/esm/components/GridExcelExportMenuItem.js +0 -1
- package/esm/components/GridFooterCell.d.ts +1 -2
- package/esm/components/GridFooterCell.js +0 -1
- package/esm/components/GridGroupingColumnFooterCell.d.ts +1 -2
- package/esm/components/GridGroupingColumnFooterCell.js +0 -1
- package/esm/components/GridGroupingColumnLeafCell.d.ts +1 -2
- package/esm/components/GridGroupingColumnLeafCell.js +0 -1
- package/esm/components/GridGroupingCriteriaCell.d.ts +1 -2
- package/esm/components/GridPremiumColumnMenu.d.ts +2 -3
- package/esm/components/GridPremiumColumnMenu.js +0 -1
- package/esm/components/GridPremiumToolbar.d.ts +1 -2
- package/esm/components/aiAssistantPanel/GridAiAssistantPanel.d.ts +1 -2
- package/esm/components/aiAssistantPanel/GridAiAssistantPanelConversation.d.ts +1 -2
- package/esm/components/aiAssistantPanel/GridAiAssistantPanelConversationsMenu.d.ts +1 -2
- package/esm/components/aiAssistantPanel/GridAiAssistantPanelSuggestions.d.ts +1 -2
- package/esm/components/aiAssistantPanel/GridAiAssistantPanelSuggestions.js +0 -1
- package/esm/components/chartsPanel/GridChartsPanel.d.ts +1 -2
- package/esm/components/chartsPanel/chart/GridChartsPanelChart.d.ts +1 -2
- package/esm/components/chartsPanel/chart/GridChartsPanelChart.js +0 -1
- package/esm/components/chartsPanel/customize/GridChartsPanelCustomize.d.ts +1 -2
- package/esm/components/chartsPanel/data/GridChartsPanelData.d.ts +1 -2
- package/esm/components/chartsPanel/data/GridChartsPanelDataBody.d.ts +1 -2
- package/esm/components/chartsPanel/data/GridChartsPanelDataField.d.ts +2 -2
- package/esm/components/chartsPanel/data/GridChartsPanelDataFieldMenu.d.ts +1 -2
- package/esm/components/chartsPanel/data/GridChartsPanelDataHeader.d.ts +1 -2
- package/esm/components/chartsPanel/data/GridChartsPanelDataSearch.d.ts +1 -2
- package/esm/components/collapsible/Collapsible.d.ts +1 -1
- package/esm/components/collapsible/CollapsiblePanel.d.ts +1 -1
- package/esm/components/collapsible/CollapsibleTrigger.d.ts +1 -1
- package/esm/components/columnMenu/menuItems/GridColumnMenuAggregationItem.d.ts +1 -2
- package/esm/components/columnMenu/menuItems/GridColumnMenuChartsItem.d.ts +1 -2
- package/esm/components/columnMenu/menuItems/GridColumnMenuManagePanelItem.d.ts +1 -2
- package/esm/components/columnMenu/menuItems/GridColumnMenuPivotItem.d.ts +1 -2
- package/esm/components/columnMenu/menuItems/GridColumnMenuRowGroupItem.d.ts +1 -2
- package/esm/components/columnMenu/menuItems/GridColumnMenuRowUngroupItem.d.ts +1 -2
- package/esm/components/pivotPanel/GridPivotPanel.d.ts +1 -2
- package/esm/components/pivotPanel/GridPivotPanelBody.d.ts +1 -2
- package/esm/components/pivotPanel/GridPivotPanelField.d.ts +1 -1
- package/esm/components/pivotPanel/GridPivotPanelFieldMenu.d.ts +1 -2
- package/esm/components/pivotPanel/GridPivotPanelHeader.d.ts +1 -2
- package/esm/components/pivotPanel/GridPivotPanelSearch.d.ts +1 -2
- package/esm/components/prompt/GridPrompt.d.ts +1 -2
- package/esm/components/promptField/GridPromptField.d.ts +1 -2
- package/esm/components/promptField/GridPromptField.js +0 -1
- package/esm/components/resizablePanel/ResizablePanel.d.ts +1 -1
- package/esm/components/resizablePanel/ResizablePanelHandle.d.ts +1 -1
- package/esm/components/sidebar/Sidebar.d.ts +1 -1
- package/esm/components/sidebar/SidebarHeader.d.ts +1 -1
- package/esm/context/GridChartsIntegrationContextProvider.d.ts +1 -1
- package/esm/context/GridChartsRendererProxy.d.ts +1 -1
- package/esm/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +0 -1
- package/esm/hooks/features/aggregation/wrapColumnWithAggregation.js +0 -1
- package/esm/hooks/features/chartsIntegration/gridChartsIntegrationSelectors.d.ts +6 -0
- package/esm/hooks/features/chartsIntegration/gridChartsIntegrationSelectors.js +1 -0
- package/esm/hooks/features/chartsIntegration/useGridChartsIntegration.d.ts +1 -1
- package/esm/hooks/features/chartsIntegration/useGridChartsIntegration.js +74 -11
- package/esm/hooks/features/dataSource/useGridDataSourcePremium.js +20 -4
- package/esm/hooks/features/dataSource/utils.d.ts +3 -2
- package/esm/hooks/features/dataSource/utils.js +13 -1
- package/esm/hooks/features/editing/useGridCellEditable.d.ts +8 -0
- package/esm/hooks/features/editing/useGridCellEditable.js +35 -0
- package/esm/hooks/features/rowGrouping/createGroupingColDef.js +3 -4
- package/esm/index.js +1 -1
- package/esm/material/icons.d.ts +0 -1
- package/esm/material/icons.js +0 -1
- package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +0 -1
- package/hooks/features/aggregation/wrapColumnWithAggregation.js +0 -2
- package/hooks/features/chartsIntegration/gridChartsIntegrationSelectors.d.ts +6 -0
- package/hooks/features/chartsIntegration/gridChartsIntegrationSelectors.js +2 -1
- package/hooks/features/chartsIntegration/useGridChartsIntegration.d.ts +1 -1
- package/hooks/features/chartsIntegration/useGridChartsIntegration.js +73 -10
- package/hooks/features/dataSource/useGridDataSourcePremium.js +17 -1
- package/hooks/features/dataSource/utils.d.ts +3 -2
- package/hooks/features/dataSource/utils.js +15 -2
- package/hooks/features/editing/useGridCellEditable.d.ts +8 -0
- package/hooks/features/editing/useGridCellEditable.js +41 -0
- package/hooks/features/rowGrouping/createGroupingColDef.js +3 -5
- package/index.js +1 -1
- package/material/icons.d.ts +0 -1
- package/material/icons.js +0 -2
- package/package.json +6 -6
|
@@ -158,19 +158,21 @@ const useGridChartsIntegration = (apiRef, props) => {
|
|
|
158
158
|
if (!pivotActive && visibleValues.current[activeChartId] && rowGroupingModel.length > 0) {
|
|
159
159
|
// with row grouping add the aggregation model to the newly added value dataset
|
|
160
160
|
const aggregatedFields = Object.keys(aggregationModel);
|
|
161
|
+
const aggregationsToAdd = {};
|
|
161
162
|
visibleValues.current[activeChartId].forEach(item => {
|
|
162
163
|
const hasAggregation = aggregatedFields.includes(item.field);
|
|
163
164
|
if (!hasAggregation) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
})[0]
|
|
171
|
-
}));
|
|
165
|
+
// use the first available aggregation function
|
|
166
|
+
aggregationsToAdd[item.field] = (0, _gridAggregationUtils.getAvailableAggregationFunctions)({
|
|
167
|
+
aggregationFunctions: props.aggregationFunctions,
|
|
168
|
+
colDef: item,
|
|
169
|
+
isDataSource: !!props.dataSource
|
|
170
|
+
})[0];
|
|
172
171
|
}
|
|
173
172
|
});
|
|
173
|
+
if (Object.keys(aggregationsToAdd).length > 0) {
|
|
174
|
+
apiRef.current.setAggregationModel((0, _extends2.default)({}, aggregationModel, aggregationsToAdd));
|
|
175
|
+
}
|
|
174
176
|
}
|
|
175
177
|
}, [apiRef, props.aggregationFunctions, props.dataSource, activeChartId, pivotActive, aggregationModel]);
|
|
176
178
|
const handleRowDataUpdate = React.useCallback(chartIds => {
|
|
@@ -304,8 +306,8 @@ const useGridChartsIntegration = (apiRef, props) => {
|
|
|
304
306
|
}
|
|
305
307
|
});
|
|
306
308
|
updateOtherModels();
|
|
307
|
-
|
|
308
|
-
}, [apiRef, chartStateLookup, pivotActive, pivotModel,
|
|
309
|
+
debouncedHandleRowDataUpdate(chartIds);
|
|
310
|
+
}, [apiRef, chartStateLookup, pivotActive, pivotModel, debouncedHandleRowDataUpdate, updateOtherModels]);
|
|
309
311
|
const debouncedHandleColumnDataUpdate = React.useMemo(() => (0, _debounce.default)(handleColumnDataUpdate, 0), [handleColumnDataUpdate]);
|
|
310
312
|
const setChartsPanelOpen = React.useCallback(callback => {
|
|
311
313
|
if (!isChartsIntegrationAvailable) {
|
|
@@ -504,6 +506,67 @@ const useGridChartsIntegration = (apiRef, props) => {
|
|
|
504
506
|
(0, _internals.useGridEvent)(apiRef, 'pivotModeChange', (0, _internals.runIf)(isChartsIntegrationAvailable, () => debouncedHandleColumnDataUpdate(syncedChartIds)));
|
|
505
507
|
(0, _internals.useGridEvent)(apiRef, 'filteredRowsSet', (0, _internals.runIf)(isChartsIntegrationAvailable, () => debouncedHandleRowDataUpdate(syncedChartIds)));
|
|
506
508
|
(0, _internals.useGridEvent)(apiRef, 'sortedRowsSet', (0, _internals.runIf)(isChartsIntegrationAvailable, () => debouncedHandleRowDataUpdate(syncedChartIds)));
|
|
509
|
+
const stateExportPreProcessing = React.useCallback((prevState, exportContext) => {
|
|
510
|
+
if (!props.chartsIntegration || !props.experimentalFeatures?.charts) {
|
|
511
|
+
return prevState;
|
|
512
|
+
}
|
|
513
|
+
const currentActiveChartId = (0, _gridChartsIntegrationSelectors.gridChartsIntegrationActiveChartIdSelector)(apiRef);
|
|
514
|
+
const chartsLookup = (0, _gridChartsIntegrationSelectors.gridChartsIntegrationChartsLookupSelector)(apiRef);
|
|
515
|
+
const integrationContextToExport = Object.fromEntries(Object.entries(chartStateLookup).map(([chartId, chartState]) => [chartId,
|
|
516
|
+
// keep only the state that is controlled by the user, drop the data and labels
|
|
517
|
+
{
|
|
518
|
+
synced: chartState.synced,
|
|
519
|
+
type: chartState.type,
|
|
520
|
+
configuration: chartState.configuration
|
|
521
|
+
}]));
|
|
522
|
+
const shouldExportChartState =
|
|
523
|
+
// Always export if the `exportOnlyDirtyModels` property is not activated
|
|
524
|
+
!exportContext.exportOnlyDirtyModels ||
|
|
525
|
+
// Always export if the chart state has been initialized
|
|
526
|
+
props.initialState?.chartsIntegration != null ||
|
|
527
|
+
// Export if the chart model or context is not empty
|
|
528
|
+
Object.keys(chartsLookup).length > 0 || Object.keys(integrationContextToExport).length > 0;
|
|
529
|
+
if (!shouldExportChartState) {
|
|
530
|
+
return prevState;
|
|
531
|
+
}
|
|
532
|
+
const chartStateToExport = {
|
|
533
|
+
activeChartId: currentActiveChartId,
|
|
534
|
+
charts: chartsLookup,
|
|
535
|
+
// add a custom prop to keep the integration context in the exported state
|
|
536
|
+
integrationContext: integrationContextToExport
|
|
537
|
+
};
|
|
538
|
+
return (0, _extends2.default)({}, prevState, {
|
|
539
|
+
chartsIntegration: chartStateToExport
|
|
540
|
+
});
|
|
541
|
+
}, [apiRef, chartStateLookup, props.chartsIntegration, props.experimentalFeatures?.charts, props.initialState?.chartsIntegration]);
|
|
542
|
+
const stateRestorePreProcessing = React.useCallback((params, restoreContext) => {
|
|
543
|
+
const chartsRestoreState = restoreContext.stateToRestore.chartsIntegration;
|
|
544
|
+
if (!chartsRestoreState) {
|
|
545
|
+
return params;
|
|
546
|
+
}
|
|
547
|
+
const {
|
|
548
|
+
activeChartId: activeChartIdToRestore,
|
|
549
|
+
charts: chartsToRestore,
|
|
550
|
+
integrationContext
|
|
551
|
+
} = chartsRestoreState;
|
|
552
|
+
if (activeChartIdToRestore === undefined || chartsToRestore === undefined || Object.keys(chartsToRestore).length === 0) {
|
|
553
|
+
return params;
|
|
554
|
+
}
|
|
555
|
+
apiRef.current.setState((0, _extends2.default)({}, apiRef.current.state, {
|
|
556
|
+
chartsIntegration: {
|
|
557
|
+
activeChartId: activeChartIdToRestore,
|
|
558
|
+
charts: chartsToRestore
|
|
559
|
+
}
|
|
560
|
+
}));
|
|
561
|
+
|
|
562
|
+
// restore the integration context for each chart
|
|
563
|
+
Object.entries(integrationContext).forEach(([chartId, chartContextState]) => {
|
|
564
|
+
setChartState(chartId, chartContextState);
|
|
565
|
+
});
|
|
566
|
+
return params;
|
|
567
|
+
}, [apiRef, setChartState]);
|
|
568
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'exportState', stateExportPreProcessing);
|
|
569
|
+
(0, _internals.useGridRegisterPipeProcessor)(apiRef, 'restoreState', stateRestorePreProcessing);
|
|
507
570
|
React.useEffect(() => {
|
|
508
571
|
if (!activeChartId && availableChartIds.length > 0) {
|
|
509
572
|
setActiveChartId(availableChartIds[0]);
|
|
@@ -9,11 +9,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
exports.useGridDataSourcePremium = void 0;
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
|
|
12
13
|
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
13
14
|
var _internals = require("@mui/x-data-grid-pro/internals");
|
|
14
15
|
var _gridPivotingSelectors = require("../pivoting/gridPivotingSelectors");
|
|
15
16
|
var _utils = require("./utils");
|
|
16
17
|
var _gridRowGroupingSelector = require("../rowGrouping/gridRowGroupingSelector");
|
|
18
|
+
var _gridAggregationSelectors = require("../aggregation/gridAggregationSelectors");
|
|
17
19
|
function getKeyPremium(params) {
|
|
18
20
|
return JSON.stringify([params.filterModel, params.sortModel, params.groupKeys, params.groupFields, params.start, params.end, params.pivotModel ? {} : params.aggregationModel, params.pivotModel]);
|
|
19
21
|
}
|
|
@@ -23,18 +25,32 @@ const options = {
|
|
|
23
25
|
}
|
|
24
26
|
};
|
|
25
27
|
const useGridDataSourcePremium = (apiRef, props) => {
|
|
28
|
+
const aggregationModel = (0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef);
|
|
26
29
|
const groupingModelSize = (0, _gridRowGroupingSelector.gridRowGroupingSanitizedModelSelector)(apiRef).length;
|
|
27
30
|
const setStrategyAvailability = React.useCallback(() => {
|
|
28
31
|
const targetStrategy = props.treeData || !props.disableRowGrouping && groupingModelSize > 0 ? _internals.DataSourceRowsUpdateStrategy.GroupedData : _internals.DataSourceRowsUpdateStrategy.Default;
|
|
29
32
|
apiRef.current.setStrategyAvailability(_internals.GridStrategyGroup.DataSource, targetStrategy, props.dataSource && !props.lazyLoading ? () => true : () => false);
|
|
30
33
|
}, [apiRef, props.dataSource, props.lazyLoading, props.treeData, props.disableRowGrouping, groupingModelSize]);
|
|
34
|
+
const handleEditRowWithAggregation = React.useCallback((params, updatedRow) => {
|
|
35
|
+
const rowTree = (0, _xDataGridPro.gridRowTreeSelector)(apiRef);
|
|
36
|
+
if (updatedRow && !(0, _isDeepEqual.isDeepEqual)(updatedRow, params.previousRow)) {
|
|
37
|
+
// Reset the outdated cache, only if the row is _actually_ updated
|
|
38
|
+
apiRef.current.dataSource.cache.clear();
|
|
39
|
+
}
|
|
40
|
+
const groupKeys = (0, _internals.getGroupKeys)(rowTree, params.rowId);
|
|
41
|
+
apiRef.current.updateNestedRows([updatedRow], groupKeys);
|
|
42
|
+
// To refresh the aggregation values of all parent rows and the footer row, recursively re-fetch all parent levels
|
|
43
|
+
(0, _utils.fetchParents)(rowTree, params.rowId, apiRef.current.dataSource.fetchRows);
|
|
44
|
+
}, [apiRef]);
|
|
31
45
|
const {
|
|
32
46
|
api,
|
|
33
47
|
debouncedFetchRows,
|
|
34
48
|
flatTreeStrategyProcessor,
|
|
35
49
|
groupedDataStrategyProcessor,
|
|
36
50
|
events
|
|
37
|
-
} = (0, _internals.useGridDataSourceBasePro)(apiRef, props,
|
|
51
|
+
} = (0, _internals.useGridDataSourceBasePro)(apiRef, props, (0, _extends2.default)({}, !props.disableAggregation && Object.keys(aggregationModel).length > 0 ? {
|
|
52
|
+
handleEditRow: handleEditRowWithAggregation
|
|
53
|
+
} : {}, options));
|
|
38
54
|
const aggregateRowRef = React.useRef({});
|
|
39
55
|
const initialColumns = (0, _internals.gridPivotInitialColumnsSelector)(apiRef);
|
|
40
56
|
const pivotActive = (0, _internals.gridPivotActiveSelector)(apiRef);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RefObject } from '@mui/x-internals/types';
|
|
2
|
-
import { GridColDef } from '@mui/x-data-grid-pro';
|
|
2
|
+
import { GridColDef, GridRowId, GridRowTreeConfig } from '@mui/x-data-grid-pro';
|
|
3
3
|
import type { GridPrivateApiPremium } from "../../../models/gridApiPremium.js";
|
|
4
4
|
import type { GridPivotingDynamicPropsOverrides, PivotingColDefCallback, GridPivotModel } from "../pivoting/gridPivotingInterfaces.js";
|
|
5
5
|
import type { GridGetRowsResponsePivotColumn } from "./models.js";
|
|
6
|
-
export declare const getPropsOverrides: (pivotColumns: GridGetRowsResponsePivotColumn[], pivotingColDef: PivotingColDefCallback, pivotModel: GridPivotModel, initialColumns: Map<string, GridColDef>, apiRef: RefObject<GridPrivateApiPremium>) => GridPivotingDynamicPropsOverrides;
|
|
6
|
+
export declare const getPropsOverrides: (pivotColumns: GridGetRowsResponsePivotColumn[], pivotingColDef: PivotingColDefCallback, pivotModel: GridPivotModel, initialColumns: Map<string, GridColDef>, apiRef: RefObject<GridPrivateApiPremium>) => GridPivotingDynamicPropsOverrides;
|
|
7
|
+
export declare const fetchParents: (rowTree: GridRowTreeConfig, rowId: GridRowId, fetchHandler: (id?: GridRowId) => Promise<void>) => Promise<void[]>;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.getPropsOverrides = void 0;
|
|
7
|
+
exports.getPropsOverrides = exports.fetchParents = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
10
10
|
const getPropsOverrides = (pivotColumns, pivotingColDef, pivotModel, initialColumns, apiRef) => {
|
|
@@ -145,4 +145,17 @@ const getPropsOverrides = (pivotColumns, pivotingColDef, pivotModel, initialColu
|
|
|
145
145
|
aggregationModel
|
|
146
146
|
};
|
|
147
147
|
};
|
|
148
|
-
exports.getPropsOverrides = getPropsOverrides;
|
|
148
|
+
exports.getPropsOverrides = getPropsOverrides;
|
|
149
|
+
const fetchParents = (rowTree, rowId, fetchHandler) => {
|
|
150
|
+
const parents = [];
|
|
151
|
+
|
|
152
|
+
// collect all parents ids
|
|
153
|
+
let currentId = rowId;
|
|
154
|
+
while (currentId !== undefined && currentId !== _xDataGridPro.GRID_ROOT_GROUP_ID) {
|
|
155
|
+
const parentId = rowTree[currentId].parent;
|
|
156
|
+
parents.push(parentId);
|
|
157
|
+
currentId = parentId;
|
|
158
|
+
}
|
|
159
|
+
return Promise.all(parents.reverse().map(fetchHandler));
|
|
160
|
+
};
|
|
161
|
+
exports.fetchParents = fetchParents;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RefObject } from '@mui/x-internals/types';
|
|
2
|
+
import { CellEditableConditionFn } from '@mui/x-data-grid-pro/internals';
|
|
3
|
+
import { GridPrivateApiPremium } from "../../../models/gridApiPremium.js";
|
|
4
|
+
import { DataGridPremiumProcessedProps } from "../../../models/dataGridPremiumProps.js";
|
|
5
|
+
/**
|
|
6
|
+
* Implementation of the cell editable condition hook of the Data Grid Premium
|
|
7
|
+
*/
|
|
8
|
+
export declare const useIsCellEditable: (apiRef: RefObject<GridPrivateApiPremium>, props: DataGridPremiumProcessedProps) => CellEditableConditionFn;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.useIsCellEditable = void 0;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _internals = require("@mui/x-data-grid-pro/internals");
|
|
11
|
+
var _gridAggregationSelectors = require("../aggregation/gridAggregationSelectors");
|
|
12
|
+
/**
|
|
13
|
+
* Implementation of the cell editable condition hook of the Data Grid Premium
|
|
14
|
+
*/
|
|
15
|
+
const useIsCellEditable = (apiRef, props) => {
|
|
16
|
+
const isCellEditableCommunity = (0, _internals.useIsCellEditable)();
|
|
17
|
+
return React.useCallback(params => {
|
|
18
|
+
const isCellEditable = isCellEditableCommunity(params);
|
|
19
|
+
|
|
20
|
+
// If the cell is not editable by the community hook, return false immediately
|
|
21
|
+
if (!isCellEditable) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// If the data source is not used or aggregation is disabled or both tree data and row grouping are disabled, return the community hook result
|
|
26
|
+
if (!props.dataSource || props.disableAggregation || !props.treeData && props.disableRowGrouping) {
|
|
27
|
+
return isCellEditable;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// If the cell is not a part of the aggregation model, return the community hook result
|
|
31
|
+
const aggregationModelFields = Object.keys((0, _gridAggregationSelectors.gridAggregationModelSelector)(apiRef));
|
|
32
|
+
if (!aggregationModelFields.includes(params.field)) {
|
|
33
|
+
return isCellEditable;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// The cell is a part of the aggregation model and it is retrieved from the server-side data.
|
|
37
|
+
// Allow editing only for the non-grouped rows.
|
|
38
|
+
return params.rowNode.type !== 'group';
|
|
39
|
+
}, [apiRef, props.dataSource, props.treeData, props.disableAggregation, props.disableRowGrouping, isCellEditableCommunity]);
|
|
40
|
+
};
|
|
41
|
+
exports.useIsCellEditable = useIsCellEditable;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.createGroupingColDefForOneGroupingCriteria = exports.createGroupingColDefForAllGroupingCriteria = void 0;
|
|
9
8
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
var React = _interopRequireWildcard(require("react"));
|
|
12
10
|
var _xDataGridPro = require("@mui/x-data-grid-pro");
|
|
13
11
|
var _internals = require("@mui/x-data-grid-pro/internals");
|
|
14
12
|
var _GridGroupingColumnFooterCell = require("../../../components/GridGroupingColumnFooterCell");
|
|
@@ -92,12 +90,12 @@ function getGroupingCriteriaProperties(groupedByColDef, rowGroupingColumnMode, r
|
|
|
92
90
|
const rowId = (0, _xDataGridPro.gridRowIdSelector)(apiRef, row);
|
|
93
91
|
const rowNode = (0, _xDataGridPro.gridRowNodeSelector)(apiRef, rowId);
|
|
94
92
|
if (rowNode?.type === 'group') {
|
|
95
|
-
const originalColDef = columnsLookup[rowNode.groupingField];
|
|
96
|
-
if (originalColDef
|
|
93
|
+
const originalColDef = rowNode.groupingField ? columnsLookup[rowNode.groupingField] : null;
|
|
94
|
+
if (originalColDef?.type === 'singleSelect') {
|
|
97
95
|
// the default valueFormatter of a singleSelect colDef won't work with the grouping column values
|
|
98
96
|
return value;
|
|
99
97
|
}
|
|
100
|
-
const columnValueFormatter = originalColDef
|
|
98
|
+
const columnValueFormatter = originalColDef?.valueFormatter;
|
|
101
99
|
if (typeof columnValueFormatter === 'function') {
|
|
102
100
|
return columnValueFormatter(value, row, column, apiRef);
|
|
103
101
|
}
|
package/index.js
CHANGED
package/material/icons.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
export declare const GridWorkspacesIcon: (props: import("@mui/x-data-grid").GridBaseIconProps) => React.ReactNode;
|
|
3
2
|
export declare const GridGroupWorkIcon: (props: import("@mui/x-data-grid").GridBaseIconProps) => React.ReactNode;
|
|
4
3
|
export declare const GridFunctionsIcon: (props: import("@mui/x-data-grid").GridBaseIconProps) => React.ReactNode;
|
package/material/icons.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.GridWorkspacesIcon = exports.GridSyncIcon = exports.GridSyncDisabledIcon = exports.GridSendIcon = exports.GridRerunIcon = exports.GridPromptIcon = exports.GridPivotIcon = exports.GridMoveToTopIcon = exports.GridMoveToBottomIcon = exports.GridMicOffIcon = exports.GridMicIcon = exports.GridHistoryIcon = exports.GridGroupWorkIcon = exports.GridFunctionsIcon = exports.GridExpandLessIcon = exports.GridChartsIcon = exports.GridAssistantIcon = void 0;
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
7
|
var _internals = require("@mui/x-data-grid/internals");
|
|
10
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
9
|
const GridWorkspacesIcon = exports.GridWorkspacesIcon = (0, _internals.createSvgIcon)(/*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-data-grid-premium",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.17.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Premium plan edition of the MUI X Data Grid Components.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.28.4",
|
|
37
37
|
"@mui/utils": "^7.3.3",
|
|
38
|
-
"@mui/x-internal-exceljs-fork": "^4.4.
|
|
38
|
+
"@mui/x-internal-exceljs-fork": "^4.4.2",
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
|
-
"@mui/x-
|
|
42
|
-
"@mui/x-data-grid": "8.
|
|
43
|
-
"@mui/x-
|
|
44
|
-
"@mui/x-license": "8.
|
|
41
|
+
"@mui/x-data-grid": "8.17.0",
|
|
42
|
+
"@mui/x-data-grid-pro": "8.17.0",
|
|
43
|
+
"@mui/x-internals": "8.17.0",
|
|
44
|
+
"@mui/x-license": "8.17.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@emotion/react": "^11.9.0",
|