@mui/x-data-grid-premium 8.0.0-alpha.1 → 8.0.0-alpha.11
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 +2007 -230
- package/DataGridPremium/DataGridPremium.js +41 -40
- package/DataGridPremium/useDataGridPremiumComponent.d.ts +2 -2
- package/DataGridPremium/useDataGridPremiumComponent.js +6 -4
- package/DataGridPremium/useDataGridPremiumProps.js +5 -3
- package/README.md +1 -1
- package/components/GridAggregationHeader.js +6 -1
- package/components/GridColumnMenuAggregationItem.js +77 -49
- package/components/GridColumnMenuRowGroupItem.js +5 -11
- package/components/GridColumnMenuRowUngroupItem.js +10 -19
- package/components/GridDataSourceGroupingCriteriaCell.js +1 -2
- package/components/GridPremiumColumnMenu.d.ts +1 -1
- package/components/GridPremiumColumnMenu.js +5 -5
- package/components/promptControl/GridToolbarPromptControl.js +47 -36
- package/esm/DataGridPremium/DataGridPremium.js +43 -42
- package/esm/DataGridPremium/useDataGridPremiumComponent.js +7 -5
- package/esm/DataGridPremium/useDataGridPremiumProps.js +6 -4
- package/esm/components/GridAggregationHeader.js +6 -1
- package/esm/components/GridColumnMenuAggregationItem.js +75 -47
- package/esm/components/GridColumnMenuRowGroupItem.js +6 -11
- package/esm/components/GridColumnMenuRowUngroupItem.js +11 -19
- package/esm/components/GridDataSourceGroupingCriteriaCell.js +1 -2
- package/esm/components/GridPremiumColumnMenu.js +5 -5
- package/esm/components/promptControl/GridToolbarPromptControl.js +47 -36
- package/esm/hooks/features/aggregation/createAggregationLookup.js +52 -55
- package/esm/hooks/features/aggregation/gridAggregationUtils.js +18 -14
- package/esm/hooks/features/aggregation/index.js +0 -1
- package/esm/hooks/features/aggregation/useGridAggregation.js +22 -12
- package/esm/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
- package/esm/hooks/features/cellSelection/useGridCellSelection.js +17 -15
- package/esm/hooks/features/clipboard/useGridClipboardImport.js +1 -1
- package/esm/hooks/features/dataSource/cache.js +3 -0
- package/esm/hooks/features/dataSource/models.js +1 -0
- package/esm/hooks/features/dataSource/useGridDataSourcePremium.js +53 -0
- package/esm/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
- package/esm/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -3
- package/esm/hooks/features/rowGrouping/useGridRowGrouping.js +2 -2
- package/esm/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
- package/esm/hooks/utils/useGridAriaAttributes.js +1 -3
- package/esm/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
- package/esm/utils/releaseInfo.js +1 -1
- package/hooks/features/aggregation/createAggregationLookup.d.ts +7 -6
- package/hooks/features/aggregation/createAggregationLookup.js +52 -55
- package/hooks/features/aggregation/gridAggregationInterfaces.d.ts +18 -5
- package/hooks/features/aggregation/gridAggregationSelectors.d.ts +2 -2
- package/hooks/features/aggregation/gridAggregationUtils.d.ts +12 -13
- package/hooks/features/aggregation/gridAggregationUtils.js +18 -14
- package/hooks/features/aggregation/index.d.ts +1 -1
- package/hooks/features/aggregation/index.js +0 -12
- package/hooks/features/aggregation/useGridAggregation.d.ts +2 -2
- package/hooks/features/aggregation/useGridAggregation.js +22 -12
- package/hooks/features/aggregation/useGridAggregationPreProcessors.d.ts +2 -2
- package/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
- package/hooks/features/aggregation/wrapColumnWithAggregation.d.ts +3 -2
- package/hooks/features/cellSelection/gridCellSelectionInterfaces.d.ts +3 -3
- package/hooks/features/cellSelection/useGridCellSelection.d.ts +2 -2
- package/hooks/features/cellSelection/useGridCellSelection.js +15 -13
- package/hooks/features/clipboard/useGridClipboardImport.d.ts +2 -2
- package/hooks/features/clipboard/useGridClipboardImport.js +1 -1
- package/hooks/features/dataSource/cache.d.ts +2 -0
- package/hooks/features/dataSource/cache.js +9 -0
- package/hooks/features/dataSource/models.d.ts +47 -0
- package/hooks/features/dataSource/models.js +5 -0
- package/hooks/features/dataSource/useGridDataSourcePremium.d.ts +4 -0
- package/hooks/features/dataSource/useGridDataSourcePremium.js +62 -0
- package/hooks/features/export/serializer/excelSerializer.d.ts +3 -2
- package/hooks/features/export/useGridExcelExport.d.ts +2 -2
- package/hooks/features/rowGrouping/createGroupingColDef.d.ts +2 -2
- package/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
- package/hooks/features/rowGrouping/gridRowGroupingSelector.d.ts +2 -2
- package/hooks/features/rowGrouping/gridRowGroupingUtils.d.ts +4 -4
- package/hooks/features/rowGrouping/gridRowGroupingUtils.js +4 -2
- package/hooks/features/rowGrouping/useGridDataSourceRowGroupingPreProcessors.d.ts +2 -2
- package/hooks/features/rowGrouping/useGridRowGrouping.d.ts +2 -2
- package/hooks/features/rowGrouping/useGridRowGrouping.js +1 -1
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.d.ts +2 -2
- package/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
- package/hooks/utils/useGridApiContext.d.ts +3 -1
- package/hooks/utils/useGridApiRef.d.ts +3 -1
- package/hooks/utils/useGridAriaAttributes.js +1 -3
- package/hooks/utils/useGridPrivateApiContext.d.ts +1 -1
- package/hooks/utils/useKeepGroupedColumnsHidden.d.ts +2 -2
- package/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
- package/index.d.ts +2 -0
- package/index.js +1 -1
- package/models/dataGridPremiumProps.d.ts +8 -12
- package/models/gridApiPremium.d.ts +5 -3
- package/models/gridGroupingValueGetter.d.ts +2 -1
- package/models/gridPastedValueParser.d.ts +2 -1
- package/modern/DataGridPremium/DataGridPremium.js +43 -42
- package/modern/DataGridPremium/useDataGridPremiumComponent.js +7 -5
- package/modern/DataGridPremium/useDataGridPremiumProps.js +6 -4
- package/modern/components/GridAggregationHeader.js +6 -1
- package/modern/components/GridColumnMenuAggregationItem.js +75 -47
- package/modern/components/GridColumnMenuRowGroupItem.js +6 -11
- package/modern/components/GridColumnMenuRowUngroupItem.js +11 -19
- package/modern/components/GridDataSourceGroupingCriteriaCell.js +1 -2
- package/modern/components/GridPremiumColumnMenu.js +5 -5
- package/modern/components/promptControl/GridToolbarPromptControl.js +47 -36
- package/modern/hooks/features/aggregation/createAggregationLookup.js +52 -55
- package/modern/hooks/features/aggregation/gridAggregationUtils.js +18 -14
- package/modern/hooks/features/aggregation/index.js +0 -1
- package/modern/hooks/features/aggregation/useGridAggregation.js +22 -12
- package/modern/hooks/features/aggregation/useGridAggregationPreProcessors.js +8 -14
- package/modern/hooks/features/cellSelection/useGridCellSelection.js +17 -15
- package/modern/hooks/features/clipboard/useGridClipboardImport.js +1 -1
- package/modern/hooks/features/dataSource/cache.js +3 -0
- package/modern/hooks/features/dataSource/models.js +1 -0
- package/modern/hooks/features/dataSource/useGridDataSourcePremium.js +53 -0
- package/modern/hooks/features/rowGrouping/createGroupingColDef.js +5 -1
- package/modern/hooks/features/rowGrouping/gridRowGroupingUtils.js +5 -3
- package/modern/hooks/features/rowGrouping/useGridRowGrouping.js +2 -2
- package/modern/hooks/features/rowGrouping/useGridRowGroupingPreProcessors.js +9 -4
- package/modern/hooks/utils/useGridAriaAttributes.js +1 -3
- package/modern/hooks/utils/useKeepGroupedColumnsHidden.js +2 -2
- package/modern/index.js +1 -1
- package/modern/utils/releaseInfo.js +1 -1
- package/package.json +6 -6
- package/utils/releaseInfo.js +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridLazyLoader, useGridLazyLoaderPreProcessors, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization, useGridDataSourceTreeDataPreProcessors,
|
|
1
|
+
import { useGridInitialization, useGridInitializeState, useGridClipboard, useGridColumnMenu, useGridColumns, columnsStateInitializer, useGridDensity, useGridCsvExport, useGridPrintExport, useGridFilter, filterStateInitializer, useGridFocus, useGridKeyboardNavigation, useGridPagination, paginationStateInitializer, useGridPreferencesPanel, useGridEditing, editingStateInitializer, useGridRows, useGridRowsPreProcessors, rowsStateInitializer, useGridRowsMeta, useGridParamsApi, useGridRowSelection, useGridSorting, sortingStateInitializer, useGridScroll, useGridEvents, dimensionsStateInitializer, useGridDimensions, useGridStatePersistence, useGridRowSelectionPreProcessors, columnMenuStateInitializer, densityStateInitializer, focusStateInitializer, preferencePanelStateInitializer, rowsMetaStateInitializer, rowSelectionStateInitializer, useGridColumnReorder, columnReorderStateInitializer, useGridColumnResize, columnResizeStateInitializer, useGridTreeData, useGridTreeDataPreProcessors, useGridColumnPinning, columnPinningStateInitializer, useGridColumnPinningPreProcessors, useGridDetailPanel, detailPanelStateInitializer, useGridDetailPanelPreProcessors, useGridInfiniteLoader, useGridColumnSpanning, useGridRowReorder, useGridRowReorderPreProcessors, useGridRowPinning, useGridRowPinningPreProcessors, rowPinningStateInitializer, useGridColumnGrouping, columnGroupsStateInitializer, useGridLazyLoader, useGridLazyLoaderPreProcessors, useGridDataSourceLazyLoader, headerFilteringStateInitializer, useGridHeaderFiltering, virtualizationStateInitializer, useGridVirtualization, useGridDataSourceTreeDataPreProcessors, dataSourceStateInitializer, useGridRowSpanning, rowSpanningStateInitializer, useGridListView, listViewStateInitializer } from '@mui/x-data-grid-pro/internals';
|
|
2
|
+
import { useGridDataSourcePremium as useGridDataSource } from "../hooks/features/dataSource/useGridDataSourcePremium.js";
|
|
2
3
|
// Premium-only features
|
|
3
4
|
import { useGridAggregation, aggregationStateInitializer } from "../hooks/features/aggregation/useGridAggregation.js";
|
|
4
5
|
import { useGridAggregationPreProcessors } from "../hooks/features/aggregation/useGridAggregationPreProcessors.js";
|
|
@@ -32,7 +33,6 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
32
33
|
/**
|
|
33
34
|
* Register all state initializers here.
|
|
34
35
|
*/
|
|
35
|
-
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
|
|
36
36
|
useGridInitializeState(headerFilteringStateInitializer, apiRef, props);
|
|
37
37
|
useGridInitializeState(rowGroupingStateInitializer, apiRef, props);
|
|
38
38
|
useGridInitializeState(aggregationStateInitializer, apiRef, props);
|
|
@@ -42,6 +42,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
42
42
|
useGridInitializeState(columnPinningStateInitializer, apiRef, props);
|
|
43
43
|
useGridInitializeState(columnsStateInitializer, apiRef, props);
|
|
44
44
|
useGridInitializeState(rowPinningStateInitializer, apiRef, props);
|
|
45
|
+
useGridInitializeState(paginationStateInitializer, apiRef, props);
|
|
45
46
|
useGridInitializeState(rowsStateInitializer, apiRef, props);
|
|
46
47
|
useGridInitializeState(editingStateInitializer, apiRef, props);
|
|
47
48
|
useGridInitializeState(focusStateInitializer, apiRef, props);
|
|
@@ -52,17 +53,18 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
52
53
|
useGridInitializeState(densityStateInitializer, apiRef, props);
|
|
53
54
|
useGridInitializeState(columnReorderStateInitializer, apiRef, props);
|
|
54
55
|
useGridInitializeState(columnResizeStateInitializer, apiRef, props);
|
|
55
|
-
useGridInitializeState(paginationStateInitializer, apiRef, props);
|
|
56
|
-
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
57
56
|
useGridInitializeState(columnMenuStateInitializer, apiRef, props);
|
|
58
57
|
useGridInitializeState(columnGroupsStateInitializer, apiRef, props);
|
|
59
58
|
useGridInitializeState(virtualizationStateInitializer, apiRef, props);
|
|
60
59
|
useGridInitializeState(dataSourceStateInitializer, apiRef, props);
|
|
60
|
+
useGridInitializeState(dimensionsStateInitializer, apiRef, props);
|
|
61
|
+
useGridInitializeState(rowsMetaStateInitializer, apiRef, props);
|
|
61
62
|
useGridInitializeState(listViewStateInitializer, apiRef, props);
|
|
62
63
|
useGridRowGrouping(apiRef, props);
|
|
63
64
|
useGridHeaderFiltering(apiRef, props);
|
|
64
65
|
useGridTreeData(apiRef, props);
|
|
65
66
|
useGridAggregation(apiRef, props);
|
|
67
|
+
useGridDataSource(apiRef, props);
|
|
66
68
|
useGridKeyboardNavigation(apiRef, props);
|
|
67
69
|
useGridRowSelection(apiRef, props);
|
|
68
70
|
useGridCellSelection(apiRef, props);
|
|
@@ -90,6 +92,7 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
90
92
|
useGridScroll(apiRef, props);
|
|
91
93
|
useGridInfiniteLoader(apiRef, props);
|
|
92
94
|
useGridLazyLoader(apiRef, props);
|
|
95
|
+
useGridDataSourceLazyLoader(apiRef, props);
|
|
93
96
|
useGridColumnMenu(apiRef);
|
|
94
97
|
useGridCsvExport(apiRef, props);
|
|
95
98
|
useGridPrintExport(apiRef, props);
|
|
@@ -98,7 +101,6 @@ export const useDataGridPremiumComponent = (inputApiRef, props) => {
|
|
|
98
101
|
useGridDimensions(apiRef, props);
|
|
99
102
|
useGridEvents(apiRef, props);
|
|
100
103
|
useGridStatePersistence(apiRef);
|
|
101
|
-
useGridDataSource(apiRef, props);
|
|
102
104
|
useGridVirtualization(apiRef, props);
|
|
103
105
|
useGridListView(apiRef, props);
|
|
104
106
|
return apiRef;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useThemeProps } from '@mui/material/styles';
|
|
4
4
|
import { DATA_GRID_PRO_PROPS_DEFAULT_VALUES, GRID_DEFAULT_LOCALE_TEXT, GridSignature } from '@mui/x-data-grid-pro';
|
|
5
|
-
import { computeSlots
|
|
5
|
+
import { computeSlots } from '@mui/x-data-grid-pro/internals';
|
|
6
6
|
import { GRID_AGGREGATION_FUNCTIONS } from "../hooks/features/aggregation/index.js";
|
|
7
7
|
import { DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS } from "../constants/dataGridPremiumDefaultSlotsComponents.js";
|
|
8
8
|
const getDataGridPremiumForcedProps = themedProps => _extends({
|
|
@@ -34,18 +34,20 @@ export const DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES = _extends({}, DATA_GRID_PRO
|
|
|
34
34
|
});
|
|
35
35
|
const defaultSlots = DATA_GRID_PREMIUM_DEFAULT_SLOTS_COMPONENTS;
|
|
36
36
|
export const useDataGridPremiumProps = inProps => {
|
|
37
|
-
const themedProps =
|
|
37
|
+
const themedProps =
|
|
38
38
|
// eslint-disable-next-line material-ui/mui-name-matches-component-name
|
|
39
39
|
useThemeProps({
|
|
40
40
|
props: inProps,
|
|
41
41
|
name: 'MuiDataGrid'
|
|
42
|
-
})
|
|
42
|
+
});
|
|
43
43
|
const localeText = React.useMemo(() => _extends({}, GRID_DEFAULT_LOCALE_TEXT, themedProps.localeText), [themedProps.localeText]);
|
|
44
44
|
const slots = React.useMemo(() => computeSlots({
|
|
45
45
|
defaultSlots,
|
|
46
46
|
slots: themedProps.slots
|
|
47
47
|
}), [themedProps.slots]);
|
|
48
|
-
return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps
|
|
48
|
+
return React.useMemo(() => _extends({}, DATA_GRID_PREMIUM_PROPS_DEFAULT_VALUES, themedProps.unstable_dataSource ? {
|
|
49
|
+
aggregationFunctions: {}
|
|
50
|
+
} : {}, themedProps, {
|
|
49
51
|
localeText,
|
|
50
52
|
slots
|
|
51
53
|
}, getDataGridPremiumForcedProps(themedProps)), [themedProps, localeText, slots]);
|
|
@@ -12,7 +12,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
const GridAggregationHeaderRoot = styled('div', {
|
|
13
13
|
name: 'MuiDataGrid',
|
|
14
14
|
slot: 'AggregationColumnHeader',
|
|
15
|
-
overridesResolver: (
|
|
15
|
+
overridesResolver: (props, styles) => {
|
|
16
|
+
const {
|
|
17
|
+
ownerState
|
|
18
|
+
} = props;
|
|
19
|
+
return [styles.aggregationColumnHeader, ownerState.colDef.headerAlign === 'left' && styles['aggregationColumnHeader--alignLeft'], ownerState.colDef.headerAlign === 'center' && styles['aggregationColumnHeader--alignCenter'], ownerState.colDef.headerAlign === 'right' && styles['aggregationColumnHeader--alignRight']];
|
|
20
|
+
}
|
|
16
21
|
})({
|
|
17
22
|
display: 'flex',
|
|
18
23
|
flexDirection: 'column',
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
2
|
import _toPropertyKey from "@babel/runtime/helpers/esm/toPropertyKey";
|
|
3
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
+
const _excluded = ["native"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import { useGridSelector } from '@mui/x-data-grid-pro';
|
|
7
|
-
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
8
|
-
import ListItemText from '@mui/material/ListItemText';
|
|
9
8
|
import FormControl from '@mui/material/FormControl';
|
|
10
9
|
import InputLabel from '@mui/material/InputLabel';
|
|
11
10
|
import { unstable_useId as useId } from '@mui/utils';
|
|
@@ -14,18 +13,27 @@ import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
|
14
13
|
import { canColumnHaveAggregationFunction, getAggregationFunctionLabel, getAvailableAggregationFunctions } from "../hooks/features/aggregation/gridAggregationUtils.js";
|
|
15
14
|
import { gridAggregationModelSelector } from "../hooks/features/aggregation/gridAggregationSelectors.js";
|
|
16
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
import { createElement as _createElement } from "react";
|
|
17
17
|
function GridColumnMenuAggregationItem(props) {
|
|
18
18
|
const {
|
|
19
19
|
colDef
|
|
20
20
|
} = props;
|
|
21
21
|
const apiRef = useGridApiContext();
|
|
22
|
+
const inputRef = React.useRef(null);
|
|
22
23
|
const rootProps = useGridRootProps();
|
|
23
24
|
const id = useId();
|
|
24
25
|
const aggregationModel = useGridSelector(apiRef, gridAggregationModelSelector);
|
|
25
26
|
const availableAggregationFunctions = React.useMemo(() => getAvailableAggregationFunctions({
|
|
26
27
|
aggregationFunctions: rootProps.aggregationFunctions,
|
|
27
|
-
colDef
|
|
28
|
-
|
|
28
|
+
colDef,
|
|
29
|
+
isDataSource: !!rootProps.unstable_dataSource
|
|
30
|
+
}), [colDef, rootProps.aggregationFunctions, rootProps.unstable_dataSource]);
|
|
31
|
+
const _ref = rootProps.slotProps?.baseSelect || {},
|
|
32
|
+
{
|
|
33
|
+
native: isBaseSelectNative = false
|
|
34
|
+
} = _ref,
|
|
35
|
+
baseSelectProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
36
|
+
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
29
37
|
const selectedAggregationRule = React.useMemo(() => {
|
|
30
38
|
if (!colDef || !aggregationModel[colDef.field]) {
|
|
31
39
|
return '';
|
|
@@ -34,12 +42,13 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
34
42
|
if (canColumnHaveAggregationFunction({
|
|
35
43
|
colDef,
|
|
36
44
|
aggregationFunctionName,
|
|
37
|
-
aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName]
|
|
45
|
+
aggregationFunction: rootProps.aggregationFunctions[aggregationFunctionName],
|
|
46
|
+
isDataSource: !!rootProps.unstable_dataSource
|
|
38
47
|
})) {
|
|
39
48
|
return aggregationFunctionName;
|
|
40
49
|
}
|
|
41
50
|
return '';
|
|
42
|
-
}, [rootProps.aggregationFunctions, aggregationModel, colDef]);
|
|
51
|
+
}, [rootProps.aggregationFunctions, rootProps.unstable_dataSource, aggregationModel, colDef]);
|
|
43
52
|
const handleAggregationItemChange = event => {
|
|
44
53
|
const newAggregationItem = event.target?.value || undefined;
|
|
45
54
|
const currentModel = gridAggregationModelSelector(apiRef);
|
|
@@ -52,47 +61,66 @@ function GridColumnMenuAggregationItem(props) {
|
|
|
52
61
|
apiRef.current.hideColumnMenu();
|
|
53
62
|
};
|
|
54
63
|
const label = apiRef.current.getLocaleText('aggregationMenuItemHeader');
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
const handleMenuItemKeyDown = React.useCallback(event => {
|
|
65
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
66
|
+
inputRef.current.focus();
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
const handleSelectKeyDown = React.useCallback(event => {
|
|
70
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === ' ') {
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
}
|
|
73
|
+
}, []);
|
|
74
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
75
|
+
inert: true,
|
|
76
|
+
iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuAggregationIcon, {
|
|
77
|
+
fontSize: "small"
|
|
78
|
+
}),
|
|
79
|
+
onKeyDown: handleMenuItemKeyDown,
|
|
80
|
+
children: /*#__PURE__*/_jsxs(FormControl, {
|
|
81
|
+
size: "small",
|
|
82
|
+
fullWidth: true,
|
|
83
|
+
sx: {
|
|
84
|
+
minWidth: 150
|
|
85
|
+
},
|
|
86
|
+
children: [/*#__PURE__*/_jsx(InputLabel, {
|
|
87
|
+
id: `${id}-label`,
|
|
88
|
+
htmlFor: `${id}-input`,
|
|
89
|
+
children: label
|
|
90
|
+
}), /*#__PURE__*/_jsxs(rootProps.slots.baseSelect, _extends({
|
|
91
|
+
labelId: `${id}-label`,
|
|
92
|
+
inputRef: inputRef,
|
|
93
|
+
id: `${id}-input`,
|
|
94
|
+
value: selectedAggregationRule,
|
|
95
|
+
label: label,
|
|
96
|
+
color: "primary",
|
|
97
|
+
onChange: handleAggregationItemChange,
|
|
98
|
+
MenuProps: {
|
|
99
|
+
PaperProps: {
|
|
100
|
+
onKeyDown: handleSelectKeyDown
|
|
101
|
+
}
|
|
67
102
|
},
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
value:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
aggregationFunction: rootProps.aggregationFunctions[aggFunc]
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
}, aggFunc))]
|
|
93
|
-
})]
|
|
94
|
-
})
|
|
95
|
-
})]
|
|
103
|
+
onBlur: event => event.stopPropagation(),
|
|
104
|
+
native: isBaseSelectNative,
|
|
105
|
+
fullWidth: true
|
|
106
|
+
}, baseSelectProps, {
|
|
107
|
+
children: [/*#__PURE__*/_jsx(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
108
|
+
native: isBaseSelectNative,
|
|
109
|
+
value: "",
|
|
110
|
+
children: "..."
|
|
111
|
+
})), availableAggregationFunctions.map(aggFunc => /*#__PURE__*/_createElement(rootProps.slots.baseSelectOption, _extends({}, baseSelectOptionProps, {
|
|
112
|
+
key: aggFunc,
|
|
113
|
+
value: aggFunc,
|
|
114
|
+
native: isBaseSelectNative
|
|
115
|
+
}), getAggregationFunctionLabel({
|
|
116
|
+
apiRef,
|
|
117
|
+
aggregationRule: {
|
|
118
|
+
aggregationFunctionName: aggFunc,
|
|
119
|
+
aggregationFunction: rootProps.aggregationFunctions[aggFunc]
|
|
120
|
+
}
|
|
121
|
+
})))]
|
|
122
|
+
}))]
|
|
123
|
+
})
|
|
96
124
|
});
|
|
97
125
|
}
|
|
98
126
|
process.env.NODE_ENV !== "production" ? GridColumnMenuAggregationItem.propTypes = {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
3
|
-
import ListItemText from '@mui/material/ListItemText';
|
|
4
2
|
import { useGridSelector, gridColumnLookupSelector } from '@mui/x-data-grid-pro';
|
|
5
3
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
6
4
|
import { gridRowGroupingSanitizedModelSelector } from "../hooks/features/rowGrouping/gridRowGroupingSelector.js";
|
|
7
5
|
import { getRowGroupingCriteriaFromGroupingField, GRID_ROW_GROUPING_SINGLE_GROUPING_FIELD, isGroupingColumn } from "../hooks/features/rowGrouping/gridRowGroupingUtils.js";
|
|
8
6
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
9
|
-
import { jsx as _jsx
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
8
|
export function GridColumnMenuRowGroupItem(props) {
|
|
11
9
|
const {
|
|
12
10
|
colDef,
|
|
@@ -23,16 +21,13 @@ export function GridColumnMenuRowGroupItem(props) {
|
|
|
23
21
|
};
|
|
24
22
|
const groupedColumn = columnsLookup[field];
|
|
25
23
|
const name = groupedColumn.headerName ?? field;
|
|
26
|
-
return /*#__PURE__*/
|
|
24
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
27
25
|
onClick: ungroupColumn,
|
|
28
26
|
disabled: !groupedColumn.groupable,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
34
|
-
children: apiRef.current.getLocaleText('unGroupColumn')(name)
|
|
35
|
-
})]
|
|
27
|
+
iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
|
|
28
|
+
fontSize: "small"
|
|
29
|
+
}),
|
|
30
|
+
children: apiRef.current.getLocaleText('unGroupColumn')(name)
|
|
36
31
|
}, field);
|
|
37
32
|
};
|
|
38
33
|
if (!colDef || !isGroupingColumn(colDef.field)) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
3
|
-
import ListItemText from '@mui/material/ListItemText';
|
|
4
2
|
import { gridColumnLookupSelector, useGridSelector } from '@mui/x-data-grid-pro';
|
|
5
3
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
6
4
|
import { gridRowGroupingSanitizedModelSelector } from "../hooks/features/rowGrouping/gridRowGroupingSelector.js";
|
|
7
5
|
import { useGridRootProps } from "../hooks/utils/useGridRootProps.js";
|
|
8
|
-
import { jsx as _jsx
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
7
|
export function GridColumnMenuRowUngroupItem(props) {
|
|
10
8
|
const {
|
|
11
9
|
colDef,
|
|
@@ -28,25 +26,19 @@ export function GridColumnMenuRowUngroupItem(props) {
|
|
|
28
26
|
};
|
|
29
27
|
const name = columnsLookup[colDef.field].headerName ?? colDef.field;
|
|
30
28
|
if (rowGroupingModel.includes(colDef.field)) {
|
|
31
|
-
return /*#__PURE__*/
|
|
29
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
32
30
|
onClick: ungroupColumn,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
38
|
-
children: apiRef.current.getLocaleText('unGroupColumn')(name)
|
|
39
|
-
})]
|
|
31
|
+
iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuUngroupIcon, {
|
|
32
|
+
fontSize: "small"
|
|
33
|
+
}),
|
|
34
|
+
children: apiRef.current.getLocaleText('unGroupColumn')(name)
|
|
40
35
|
});
|
|
41
36
|
}
|
|
42
|
-
return /*#__PURE__*/
|
|
37
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, {
|
|
43
38
|
onClick: groupColumn,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
49
|
-
children: apiRef.current.getLocaleText('groupColumn')(name)
|
|
50
|
-
})]
|
|
39
|
+
iconStart: /*#__PURE__*/_jsx(rootProps.slots.columnMenuGroupIcon, {
|
|
40
|
+
fontSize: "small"
|
|
41
|
+
}),
|
|
42
|
+
children: apiRef.current.getLocaleText('groupColumn')(name)
|
|
51
43
|
});
|
|
52
44
|
}
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
4
4
|
import Box from '@mui/material/Box';
|
|
5
|
-
import CircularProgress from '@mui/material/CircularProgress';
|
|
6
5
|
import { useGridPrivateApiContext } from '@mui/x-data-grid-pro/internals';
|
|
7
6
|
import { useGridSelector, getDataGridUtilityClass } from '@mui/x-data-grid-pro';
|
|
8
7
|
import { useGridApiContext } from "../hooks/utils/useGridApiContext.js";
|
|
@@ -47,7 +46,7 @@ function GridGroupingCriteriaCellIcon(props) {
|
|
|
47
46
|
if (isDataLoading) {
|
|
48
47
|
return /*#__PURE__*/_jsx("div", {
|
|
49
48
|
className: classes.loadingContainer,
|
|
50
|
-
children: /*#__PURE__*/_jsx(
|
|
49
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseCircularProgress, {
|
|
51
50
|
size: "1rem",
|
|
52
51
|
color: "inherit"
|
|
53
52
|
})
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { GridGenericColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } from '@mui/x-data-grid-pro';
|
|
4
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
4
5
|
import { GridColumnMenuAggregationItem } from "./GridColumnMenuAggregationItem.js";
|
|
5
6
|
import { isGroupingColumn } from "../hooks/features/rowGrouping/index.js";
|
|
6
7
|
import { GridColumnMenuRowGroupItem } from "./GridColumnMenuRowGroupItem.js";
|
|
@@ -27,11 +28,10 @@ export const GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM = _extends({}, GRID_COLUMN_MENU
|
|
|
27
28
|
displayOrder: 27
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
|
-
export const GridPremiumColumnMenu =
|
|
31
|
-
return /*#__PURE__*/_jsx(GridGenericColumnMenu, _extends({
|
|
32
|
-
ref: ref
|
|
33
|
-
}, props, {
|
|
31
|
+
export const GridPremiumColumnMenu = forwardRef(function GridPremiumColumnMenuSimple(props, ref) {
|
|
32
|
+
return /*#__PURE__*/_jsx(GridGenericColumnMenu, _extends({}, props, {
|
|
34
33
|
defaultSlots: GRID_COLUMN_MENU_SLOTS_PREMIUM,
|
|
35
|
-
defaultSlotProps: GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM
|
|
34
|
+
defaultSlotProps: GRID_COLUMN_MENU_SLOT_PROPS_PREMIUM,
|
|
35
|
+
ref: ref
|
|
36
36
|
}));
|
|
37
37
|
});
|
|
@@ -10,9 +10,10 @@ import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
|
10
10
|
import { RecordButton, BrowserSpeechRecognition } from "./RecordButton.js";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
const supportsSpeechRecognition = !!BrowserSpeechRecognition;
|
|
13
|
-
const useUtilityClasses =
|
|
13
|
+
const useUtilityClasses = ownerState => {
|
|
14
14
|
const {
|
|
15
|
-
classes
|
|
15
|
+
classes,
|
|
16
|
+
recording
|
|
16
17
|
} = ownerState;
|
|
17
18
|
const slots = {
|
|
18
19
|
root: ['toolbarPromptControl', recording && 'toolbarPromptControl--recording'],
|
|
@@ -25,7 +26,12 @@ const useUtilityClasses = (ownerState, recording) => {
|
|
|
25
26
|
const GridToolbarPromptControlRoot = styled('div', {
|
|
26
27
|
name: 'MuiDataGrid',
|
|
27
28
|
slot: 'ToolbarPromptControl',
|
|
28
|
-
overridesResolver: (
|
|
29
|
+
overridesResolver: (props, styles) => {
|
|
30
|
+
const {
|
|
31
|
+
ownerState
|
|
32
|
+
} = props;
|
|
33
|
+
return [styles.toolbarPromptControl, ownerState.recording && styles['toolbarPromptControl--recording']];
|
|
34
|
+
}
|
|
29
35
|
})({
|
|
30
36
|
flex: 1,
|
|
31
37
|
display: 'flex',
|
|
@@ -71,7 +77,11 @@ function GridToolbarPromptControl(props) {
|
|
|
71
77
|
const [error, setError] = React.useState(null);
|
|
72
78
|
const [isRecording, setRecording] = React.useState(false);
|
|
73
79
|
const [query, setQuery] = React.useState('');
|
|
74
|
-
const
|
|
80
|
+
const ownerState = {
|
|
81
|
+
classes: rootProps.classes,
|
|
82
|
+
recording: isRecording
|
|
83
|
+
};
|
|
84
|
+
const classes = useUtilityClasses(ownerState);
|
|
75
85
|
const examplesFromData = React.useMemo(() => allowDataSampling ? sampleData(apiRef) : undefined, [apiRef, allowDataSampling]);
|
|
76
86
|
const processPrompt = React.useCallback(() => {
|
|
77
87
|
const context = generateContext(apiRef, examplesFromData);
|
|
@@ -145,10 +155,9 @@ function GridToolbarPromptControl(props) {
|
|
|
145
155
|
});
|
|
146
156
|
const placeholder = supportsSpeechRecognition ? apiRef.current.getLocaleText('toolbarPromptControlWithRecordingPlaceholder') : apiRef.current.getLocaleText('toolbarPromptControlPlaceholder');
|
|
147
157
|
return /*#__PURE__*/_jsx(GridToolbarPromptControlRoot, {
|
|
148
|
-
ownerState:
|
|
158
|
+
ownerState: ownerState,
|
|
149
159
|
className: classes.root,
|
|
150
160
|
children: /*#__PURE__*/_jsx(rootProps.slots.baseTextField, {
|
|
151
|
-
variant: "outlined",
|
|
152
161
|
placeholder: isRecording ? apiRef.current.getLocaleText('toolbarPromptControlRecordingPlaceholder') : placeholder,
|
|
153
162
|
"aria-label": apiRef.current.getLocaleText('toolbarPromptControlLabel'),
|
|
154
163
|
disabled: isLoading,
|
|
@@ -161,40 +170,42 @@ function GridToolbarPromptControl(props) {
|
|
|
161
170
|
onKeyDown: handleKeyDown,
|
|
162
171
|
error: !!error,
|
|
163
172
|
helperText: error,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
children: /*#__PURE__*/_jsx(
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
173
|
+
slotProps: {
|
|
174
|
+
input: {
|
|
175
|
+
startAdornment: supportsSpeechRecognition && /*#__PURE__*/_jsx(rootProps.slots.baseInputAdornment, {
|
|
176
|
+
position: "start",
|
|
177
|
+
children: /*#__PURE__*/_jsx(RecordButton, {
|
|
178
|
+
className: classes.recordButton,
|
|
179
|
+
lang: lang,
|
|
180
|
+
recording: isRecording,
|
|
181
|
+
setRecording: setRecording,
|
|
182
|
+
disabled: isLoading,
|
|
183
|
+
onUpdate: setQuery,
|
|
184
|
+
onDone: handleDone,
|
|
185
|
+
onError: setError
|
|
186
|
+
})
|
|
187
|
+
}),
|
|
188
|
+
endAdornment: /*#__PURE__*/_jsx(rootProps.slots.baseInputAdornment, {
|
|
189
|
+
position: "end",
|
|
190
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
191
|
+
title: apiRef.current.getLocaleText('toolbarPromptControlSendActionLabel'),
|
|
192
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
193
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, {
|
|
194
|
+
className: classes.sendButton,
|
|
195
|
+
disabled: isLoading || isRecording || query === '',
|
|
196
|
+
color: "primary",
|
|
197
|
+
onClick: processPrompt,
|
|
198
|
+
size: "small",
|
|
199
|
+
"aria-label": apiRef.current.getLocaleText('toolbarPromptControlSendActionAriaLabel'),
|
|
200
|
+
edge: "end",
|
|
201
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.toolbarPromptSendIcon, {
|
|
202
|
+
fontSize: "small"
|
|
203
|
+
})
|
|
193
204
|
})
|
|
194
205
|
})
|
|
195
206
|
})
|
|
196
207
|
})
|
|
197
|
-
}
|
|
208
|
+
}
|
|
198
209
|
}
|
|
199
210
|
})
|
|
200
211
|
});
|