@mui/x-data-grid 6.0.2 → 6.0.4
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 +119 -5
- package/components/GridPagination.d.ts +2 -2
- package/components/GridRow.js +1 -1
- package/components/columnHeaders/GridColumnHeaderSeparator.js +3 -3
- package/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
- package/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
- package/components/menu/columnMenu/GridColumnMenu.d.ts +5 -5
- package/components/menu/columnMenu/GridColumnMenu.js +30 -30
- package/components/menu/columnMenu/GridColumnMenuProps.d.ts +1 -1
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/components/reexportable.d.ts +1 -1
- package/components/reexportable.js +1 -1
- package/hooks/features/columnHeaders/useGridColumnHeaders.js +7 -1
- package/hooks/features/columnMenu/columnMenuInterfaces.d.ts +11 -11
- package/hooks/features/columnMenu/{useGridColumnMenuComponents.d.ts → useGridColumnMenuSlots.d.ts} +4 -4
- package/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +21 -26
- package/hooks/features/columns/useGridColumns.js +1 -1
- package/hooks/features/filter/useGridFilter.js +1 -1
- package/hooks/features/preferencesPanel/gridPreferencePanelsValue.js +3 -3
- package/hooks/features/sorting/useGridSorting.js +1 -1
- package/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/hooks/utils/useGridApiEventHandler.js +3 -3
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/legacy/components/GridRow.js +1 -1
- package/legacy/components/columnHeaders/GridColumnHeaderSeparator.js +3 -3
- package/legacy/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
- package/legacy/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
- package/legacy/components/menu/columnMenu/GridColumnMenu.js +32 -32
- package/legacy/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/legacy/components/reexportable.js +1 -1
- package/legacy/hooks/features/columnHeaders/useGridColumnHeaders.js +7 -1
- package/legacy/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +25 -30
- package/legacy/hooks/features/columns/useGridColumns.js +1 -1
- package/legacy/hooks/features/filter/useGridFilter.js +1 -1
- package/legacy/hooks/features/preferencesPanel/gridPreferencePanelsValue.js +3 -3
- package/legacy/hooks/features/sorting/useGridSorting.js +1 -1
- package/legacy/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/legacy/hooks/utils/useGridApiEventHandler.js +3 -3
- package/legacy/index.js +2 -2
- package/legacy/locales/bgBG.js +9 -12
- package/legacy/locales/daDK.js +16 -21
- package/legacy/locales/esES.js +1 -1
- package/legacy/locales/faIR.js +2 -2
- package/legacy/locales/nbNO.js +10 -12
- package/legacy/locales/nlNL.js +7 -9
- package/legacy/locales/svSE.js +2 -2
- package/legacy/models/gridEditRowModel.js +9 -9
- package/legacy/models/gridFilterItem.js +3 -3
- package/legacy/models/params/gridEditCellParams.js +10 -10
- package/legacy/models/params/gridRowParams.js +9 -9
- package/locales/bgBG.js +9 -12
- package/locales/daDK.js +16 -21
- package/locales/esES.js +1 -1
- package/locales/faIR.js +2 -2
- package/locales/nbNO.js +10 -12
- package/locales/nlNL.js +7 -9
- package/locales/svSE.js +2 -2
- package/models/gridEditRowModel.js +9 -9
- package/models/gridFilterItem.js +3 -3
- package/models/params/gridEditCellParams.js +10 -10
- package/models/params/gridRowParams.js +9 -9
- package/modern/components/GridRow.js +1 -1
- package/modern/components/columnHeaders/GridColumnHeaderSeparator.js +3 -3
- package/modern/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
- package/modern/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
- package/modern/components/menu/columnMenu/GridColumnMenu.js +30 -30
- package/modern/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/modern/components/reexportable.js +1 -1
- package/modern/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -1
- package/modern/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +21 -26
- package/modern/hooks/features/columns/useGridColumns.js +1 -1
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/preferencesPanel/gridPreferencePanelsValue.js +3 -3
- package/modern/hooks/features/sorting/useGridSorting.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/modern/hooks/utils/useGridApiEventHandler.js +3 -3
- package/modern/index.js +2 -2
- package/modern/locales/bgBG.js +9 -12
- package/modern/locales/daDK.js +16 -21
- package/modern/locales/esES.js +1 -1
- package/modern/locales/faIR.js +2 -2
- package/modern/locales/nbNO.js +10 -12
- package/modern/locales/nlNL.js +7 -9
- package/modern/locales/svSE.js +2 -2
- package/modern/models/gridEditRowModel.js +9 -9
- package/modern/models/gridFilterItem.js +3 -3
- package/modern/models/params/gridEditCellParams.js +10 -10
- package/modern/models/params/gridRowParams.js +9 -9
- package/node/components/GridRow.js +1 -1
- package/node/components/columnHeaders/GridColumnHeaderSeparator.js +4 -4
- package/node/components/columnHeaders/GridColumnHeaderTitle.js +5 -5
- package/node/components/menu/columnMenu/GridColumnHeaderMenu.js +4 -2
- package/node/components/menu/columnMenu/GridColumnMenu.js +33 -33
- package/node/components/panel/filterPanel/GridFilterPanel.js +1 -1
- package/node/components/reexportable.js +4 -4
- package/node/hooks/features/columnHeaders/useGridColumnHeaders.js +6 -1
- package/node/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js} +22 -27
- package/node/hooks/features/columns/useGridColumns.js +1 -1
- package/node/hooks/features/filter/useGridFilter.js +1 -1
- package/node/hooks/features/preferencesPanel/gridPreferencePanelsValue.js +4 -4
- package/node/hooks/features/sorting/useGridSorting.js +1 -1
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +1 -1
- package/node/hooks/utils/useGridApiEventHandler.js +4 -4
- package/node/index.js +7 -7
- package/node/locales/bgBG.js +9 -12
- package/node/locales/daDK.js +16 -21
- package/node/locales/esES.js +1 -1
- package/node/locales/faIR.js +2 -2
- package/node/locales/nbNO.js +10 -12
- package/node/locales/nlNL.js +7 -9
- package/node/locales/svSE.js +2 -2
- package/node/models/gridEditRowModel.js +12 -12
- package/node/models/gridFilterItem.js +4 -4
- package/node/models/params/gridEditCellParams.js +12 -12
- package/node/models/params/gridRowParams.js +11 -11
- package/package.json +2 -2
package/hooks/features/columnMenu/{useGridColumnMenuComponents.js → useGridColumnMenuSlots.js}
RENAMED
|
@@ -4,44 +4,39 @@ const _excluded = ["displayOrder"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import Divider from '@mui/material/Divider';
|
|
6
6
|
import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
|
|
7
|
-
const
|
|
8
|
-
const camelCase = pascalCase.split('');
|
|
9
|
-
camelCase[0] = camelCase[0].toLowerCase();
|
|
10
|
-
return camelCase.join('');
|
|
11
|
-
};
|
|
12
|
-
const useGridColumnMenuComponents = props => {
|
|
7
|
+
const useGridColumnMenuSlots = props => {
|
|
13
8
|
const apiRef = useGridPrivateApiContext();
|
|
14
9
|
const {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
defaultSlots,
|
|
11
|
+
defaultSlotProps,
|
|
12
|
+
slots = {},
|
|
13
|
+
slotProps = {},
|
|
19
14
|
hideMenu,
|
|
20
15
|
colDef,
|
|
21
16
|
addDividers = true
|
|
22
17
|
} = props;
|
|
23
|
-
const processedComponents = React.useMemo(() => _extends({},
|
|
24
|
-
const
|
|
25
|
-
if (!
|
|
26
|
-
return
|
|
18
|
+
const processedComponents = React.useMemo(() => _extends({}, defaultSlots, slots), [defaultSlots, slots]);
|
|
19
|
+
const processedSlotProps = React.useMemo(() => {
|
|
20
|
+
if (!slotProps || Object.keys(slotProps).length === 0) {
|
|
21
|
+
return defaultSlotProps;
|
|
27
22
|
}
|
|
28
|
-
const mergedProps = _extends({},
|
|
29
|
-
Object.entries(
|
|
30
|
-
mergedProps[key] = _extends({},
|
|
23
|
+
const mergedProps = _extends({}, slotProps);
|
|
24
|
+
Object.entries(defaultSlotProps).forEach(([key, currentSlotProps]) => {
|
|
25
|
+
mergedProps[key] = _extends({}, currentSlotProps, slotProps[key] || {});
|
|
31
26
|
});
|
|
32
27
|
return mergedProps;
|
|
33
|
-
}, [
|
|
28
|
+
}, [defaultSlotProps, slotProps]);
|
|
34
29
|
const defaultItems = apiRef.current.unstable_applyPipeProcessors('columnMenu', [], props.colDef);
|
|
35
30
|
const userItems = React.useMemo(() => {
|
|
36
|
-
const defaultComponentKeys = Object.keys(
|
|
37
|
-
return Object.keys(
|
|
38
|
-
}, [
|
|
31
|
+
const defaultComponentKeys = Object.keys(defaultSlots);
|
|
32
|
+
return Object.keys(slots).filter(key => !defaultComponentKeys.includes(key));
|
|
33
|
+
}, [slots, defaultSlots]);
|
|
39
34
|
return React.useMemo(() => {
|
|
40
35
|
const uniqueItems = Array.from(new Set([...defaultItems, ...userItems]));
|
|
41
36
|
const cleansedItems = uniqueItems.filter(key => processedComponents[key] != null);
|
|
42
37
|
const sorted = cleansedItems.sort((a, b) => {
|
|
43
|
-
const leftItemProps =
|
|
44
|
-
const rightItemProps =
|
|
38
|
+
const leftItemProps = processedSlotProps[a];
|
|
39
|
+
const rightItemProps = processedSlotProps[b];
|
|
45
40
|
const leftDisplayOrder = Number.isFinite(leftItemProps == null ? void 0 : leftItemProps.displayOrder) ? leftItemProps.displayOrder : 100;
|
|
46
41
|
const rightDisplayOrder = Number.isFinite(rightItemProps == null ? void 0 : rightItemProps.displayOrder) ? rightItemProps.displayOrder : 100;
|
|
47
42
|
return leftDisplayOrder - rightDisplayOrder;
|
|
@@ -51,13 +46,13 @@ const useGridColumnMenuComponents = props => {
|
|
|
51
46
|
colDef,
|
|
52
47
|
onClick: hideMenu
|
|
53
48
|
};
|
|
54
|
-
const processedComponentProps =
|
|
49
|
+
const processedComponentProps = processedSlotProps[key];
|
|
55
50
|
if (processedComponentProps) {
|
|
56
51
|
const customProps = _objectWithoutPropertiesLoose(processedComponentProps, _excluded);
|
|
57
52
|
itemProps = _extends({}, itemProps, customProps);
|
|
58
53
|
}
|
|
59
54
|
return addDividers && index !== sorted.length - 1 ? [...acc, [processedComponents[key], itemProps], [Divider, {}]] : [...acc, [processedComponents[key], itemProps]];
|
|
60
55
|
}, []);
|
|
61
|
-
}, [addDividers, colDef, defaultItems, hideMenu, processedComponents,
|
|
56
|
+
}, [addDividers, colDef, defaultItems, hideMenu, processedComponents, processedSlotProps, userItems]);
|
|
62
57
|
};
|
|
63
|
-
export {
|
|
58
|
+
export { useGridColumnMenuSlots };
|
|
@@ -232,7 +232,7 @@ export function useGridColumns(apiRef, props) {
|
|
|
232
232
|
if (props.disableColumnSelector) {
|
|
233
233
|
return columnMenuItems;
|
|
234
234
|
}
|
|
235
|
-
return [...columnMenuItems, '
|
|
235
|
+
return [...columnMenuItems, 'columnMenuColumnsItem'];
|
|
236
236
|
}, [props.disableColumnSelector]);
|
|
237
237
|
useGridRegisterPipeProcessor(apiRef, 'columnMenu', addColumnMenuItems);
|
|
238
238
|
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
@@ -59,7 +59,7 @@ export const useGridFilter = (apiRef, props) => {
|
|
|
59
59
|
if (colDef == null || colDef.filterable === false || props.disableColumnFilter) {
|
|
60
60
|
return columnMenuItems;
|
|
61
61
|
}
|
|
62
|
-
return [...columnMenuItems, '
|
|
62
|
+
return [...columnMenuItems, 'columnMenuFilterItem'];
|
|
63
63
|
}, [props.disableColumnFilter]);
|
|
64
64
|
|
|
65
65
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var GridPreferencePanelsValue
|
|
2
|
-
(function (GridPreferencePanelsValue) {
|
|
1
|
+
var GridPreferencePanelsValue = /*#__PURE__*/function (GridPreferencePanelsValue) {
|
|
3
2
|
GridPreferencePanelsValue["filters"] = "filters";
|
|
4
3
|
GridPreferencePanelsValue["columns"] = "columns";
|
|
5
|
-
|
|
4
|
+
return GridPreferencePanelsValue;
|
|
5
|
+
}(GridPreferencePanelsValue || {});
|
|
6
6
|
export { GridPreferencePanelsValue };
|
|
@@ -74,7 +74,7 @@ export const useGridSorting = (apiRef, props) => {
|
|
|
74
74
|
}
|
|
75
75
|
const sortingOrder = colDef.sortingOrder || props.sortingOrder;
|
|
76
76
|
if (sortingOrder.some(item => !!item)) {
|
|
77
|
-
return [...columnMenuItems, '
|
|
77
|
+
return [...columnMenuItems, 'columnMenuSortItem'];
|
|
78
78
|
}
|
|
79
79
|
return columnMenuItems;
|
|
80
80
|
}, [props.sortingOrder]);
|
|
@@ -429,7 +429,7 @@ export const useGridVirtualScroller = props => {
|
|
|
429
429
|
prevRootRowStyle.current = rootRowStyle;
|
|
430
430
|
return rows;
|
|
431
431
|
};
|
|
432
|
-
const needsHorizontalScrollbar = containerDimensions.width && columnsTotalWidth
|
|
432
|
+
const needsHorizontalScrollbar = containerDimensions.width && columnsTotalWidth >= containerDimensions.width;
|
|
433
433
|
const contentSize = React.useMemo(() => {
|
|
434
434
|
// In cases where the columns exceed the available width,
|
|
435
435
|
// the horizontal scrollbar should be shown even when there're no rows.
|
|
@@ -5,11 +5,11 @@ import { FinalizationRegistryBasedCleanupTracking } from '../../utils/cleanupTra
|
|
|
5
5
|
* Signal to the underlying logic what version of the public component API
|
|
6
6
|
* of the data grid is exposed.
|
|
7
7
|
*/
|
|
8
|
-
var GridSignature
|
|
9
|
-
(function (GridSignature) {
|
|
8
|
+
var GridSignature = /*#__PURE__*/function (GridSignature) {
|
|
10
9
|
GridSignature["DataGrid"] = "DataGrid";
|
|
11
10
|
GridSignature["DataGridPro"] = "DataGridPro";
|
|
12
|
-
|
|
11
|
+
return GridSignature;
|
|
12
|
+
}(GridSignature || {});
|
|
13
13
|
// We use class to make it easier to detect in heap snapshots by name
|
|
14
14
|
class ObjectToBeRetainedByReact {}
|
|
15
15
|
|
package/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export { GridColumnHeaders } from './components/GridColumnHeaders';
|
|
|
19
19
|
/**
|
|
20
20
|
* Reexportable components.
|
|
21
21
|
*/
|
|
22
|
-
export { GridColumnMenu,
|
|
22
|
+
export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS, } from './components/reexportable';
|
|
23
23
|
/**
|
|
24
24
|
* The full grid API.
|
|
25
25
|
* @demos
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-data-grid v6.0.
|
|
2
|
+
* @mui/x-data-grid v6.0.4
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -22,7 +22,7 @@ export { GridColumnHeaders } from './components/GridColumnHeaders';
|
|
|
22
22
|
/**
|
|
23
23
|
* Reexportable components.
|
|
24
24
|
*/
|
|
25
|
-
export { GridColumnMenu,
|
|
25
|
+
export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } from './components/reexportable';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* The full grid API.
|
|
@@ -47,7 +47,7 @@ function EmptyCell(_ref) {
|
|
|
47
47
|
width: width
|
|
48
48
|
};
|
|
49
49
|
return /*#__PURE__*/_jsx("div", {
|
|
50
|
-
className: "
|
|
50
|
+
className: "".concat(gridClasses.cell, " ").concat(gridClasses.withBorderColor),
|
|
51
51
|
style: style
|
|
52
52
|
}); // TODO change to .MuiDataGrid-emptyCell or .MuiDataGrid-rowFiller
|
|
53
53
|
}
|
|
@@ -7,11 +7,11 @@ import { unstable_composeClasses as composeClasses, unstable_capitalize as capit
|
|
|
7
7
|
import { getDataGridUtilityClass } from '../../constants/gridClasses';
|
|
8
8
|
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
var GridColumnHeaderSeparatorSides
|
|
11
|
-
(function (GridColumnHeaderSeparatorSides) {
|
|
10
|
+
var GridColumnHeaderSeparatorSides = /*#__PURE__*/function (GridColumnHeaderSeparatorSides) {
|
|
12
11
|
GridColumnHeaderSeparatorSides["Left"] = "left";
|
|
13
12
|
GridColumnHeaderSeparatorSides["Right"] = "right";
|
|
14
|
-
|
|
13
|
+
return GridColumnHeaderSeparatorSides;
|
|
14
|
+
}(GridColumnHeaderSeparatorSides || {});
|
|
15
15
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
16
16
|
var resizable = ownerState.resizable,
|
|
17
17
|
resizing = ownerState.resizing,
|
|
@@ -45,16 +45,15 @@ var ColumnHeaderInnerTitle = /*#__PURE__*/React.forwardRef(function ColumnHeader
|
|
|
45
45
|
function GridColumnHeaderTitle(props) {
|
|
46
46
|
var _rootProps$slotProps;
|
|
47
47
|
var label = props.label,
|
|
48
|
-
description = props.description
|
|
49
|
-
columnWidth = props.columnWidth;
|
|
48
|
+
description = props.description;
|
|
50
49
|
var rootProps = useGridRootProps();
|
|
51
50
|
var titleRef = React.useRef(null);
|
|
52
51
|
var _React$useState = React.useState(''),
|
|
53
52
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
54
53
|
tooltip = _React$useState2[0],
|
|
55
54
|
setTooltip = _React$useState2[1];
|
|
56
|
-
React.
|
|
57
|
-
if (!description && titleRef && titleRef.current) {
|
|
55
|
+
var handleMouseOver = React.useCallback(function () {
|
|
56
|
+
if (!description && titleRef != null && titleRef.current) {
|
|
58
57
|
var isOver = isOverflown(titleRef.current);
|
|
59
58
|
if (isOver) {
|
|
60
59
|
setTooltip(label);
|
|
@@ -62,11 +61,12 @@ function GridColumnHeaderTitle(props) {
|
|
|
62
61
|
setTooltip('');
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
|
-
}, [
|
|
64
|
+
}, [description, label]);
|
|
66
65
|
return /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, _extends({
|
|
67
66
|
title: description || tooltip
|
|
68
67
|
}, (_rootProps$slotProps = rootProps.slotProps) == null ? void 0 : _rootProps$slotProps.baseTooltip, {
|
|
69
68
|
children: /*#__PURE__*/_jsx(ColumnHeaderInnerTitle, {
|
|
69
|
+
onMouseOver: handleMouseOver,
|
|
70
70
|
ref: titleRef,
|
|
71
71
|
children: label
|
|
72
72
|
})
|
|
@@ -19,8 +19,10 @@ function GridColumnHeaderMenu(_ref) {
|
|
|
19
19
|
var hideMenu = React.useCallback(function (event) {
|
|
20
20
|
// Prevent triggering the sorting
|
|
21
21
|
event.stopPropagation();
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
if (!(target != null && target.contains(event.target))) {
|
|
23
|
+
apiRef.current.hideColumnMenu();
|
|
24
|
+
}
|
|
25
|
+
}, [apiRef, target]);
|
|
24
26
|
if (!target) {
|
|
25
27
|
return null;
|
|
26
28
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["
|
|
4
|
+
var _excluded = ["defaultSlots", "defaultSlotProps", "slots", "slotProps"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import {
|
|
7
|
+
import { useGridColumnMenuSlots } from '../../../hooks/features/columnMenu/useGridColumnMenuSlots';
|
|
8
8
|
import { GridColumnMenuContainer } from './GridColumnMenuContainer';
|
|
9
9
|
import { GridColumnMenuColumnsItem } from './menuItems/GridColumnMenuColumnsItem';
|
|
10
10
|
import { GridColumnMenuFilterItem } from './menuItems/GridColumnMenuFilterItem';
|
|
11
11
|
import { GridColumnMenuSortItem } from './menuItems/GridColumnMenuSortItem';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
export var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export var GRID_COLUMN_MENU_SLOTS = {
|
|
14
|
+
columnMenuSortItem: GridColumnMenuSortItem,
|
|
15
|
+
columnMenuFilterItem: GridColumnMenuFilterItem,
|
|
16
|
+
columnMenuColumnsItem: GridColumnMenuColumnsItem
|
|
17
17
|
};
|
|
18
|
-
export var
|
|
18
|
+
export var GRID_COLUMN_MENU_SLOT_PROPS = {
|
|
19
19
|
columnMenuSortItem: {
|
|
20
20
|
displayOrder: 10
|
|
21
21
|
},
|
|
@@ -27,33 +27,33 @@ export var GRID_COLUMN_MENU_COMPONENTS_PROPS = {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
var GridGenericColumnMenu = /*#__PURE__*/React.forwardRef(function GridGenericColumnMenu(props, ref) {
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
var defaultSlots = props.defaultSlots,
|
|
31
|
+
defaultSlotProps = props.defaultSlotProps,
|
|
32
|
+
slots = props.slots,
|
|
33
|
+
slotProps = props.slotProps,
|
|
34
34
|
other = _objectWithoutProperties(props, _excluded);
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
var orderedSlots = useGridColumnMenuSlots(_extends({}, other, {
|
|
36
|
+
defaultSlots: defaultSlots,
|
|
37
|
+
defaultSlotProps: defaultSlotProps,
|
|
38
|
+
slots: slots,
|
|
39
|
+
slotProps: slotProps
|
|
40
40
|
}));
|
|
41
41
|
return /*#__PURE__*/_jsx(GridColumnMenuContainer, _extends({
|
|
42
42
|
ref: ref
|
|
43
43
|
}, other, {
|
|
44
|
-
children:
|
|
44
|
+
children: orderedSlots.map(function (_ref, index) {
|
|
45
45
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
46
46
|
Component = _ref2[0],
|
|
47
|
-
|
|
48
|
-
return /*#__PURE__*/_jsx(Component, _extends({},
|
|
47
|
+
otherProps = _ref2[1];
|
|
48
|
+
return /*#__PURE__*/_jsx(Component, _extends({}, otherProps), index);
|
|
49
49
|
})
|
|
50
50
|
}));
|
|
51
51
|
});
|
|
52
52
|
var GridColumnMenu = /*#__PURE__*/React.forwardRef(function GridColumnMenu(props, ref) {
|
|
53
53
|
return /*#__PURE__*/_jsx(GridGenericColumnMenu, _extends({}, props, {
|
|
54
54
|
ref: ref,
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
defaultSlots: GRID_COLUMN_MENU_SLOTS,
|
|
56
|
+
defaultSlotProps: GRID_COLUMN_MENU_SLOT_PROPS
|
|
57
57
|
}));
|
|
58
58
|
});
|
|
59
59
|
process.env.NODE_ENV !== "production" ? GridColumnMenu.propTypes = {
|
|
@@ -62,20 +62,20 @@ process.env.NODE_ENV !== "production" ? GridColumnMenu.propTypes = {
|
|
|
62
62
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
63
63
|
// ----------------------------------------------------------------------
|
|
64
64
|
colDef: PropTypes.object.isRequired,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*/
|
|
70
|
-
components: PropTypes.object,
|
|
65
|
+
hideMenu: PropTypes.func.isRequired,
|
|
66
|
+
id: PropTypes.string,
|
|
67
|
+
labelledby: PropTypes.string,
|
|
68
|
+
open: PropTypes.bool.isRequired,
|
|
71
69
|
/**
|
|
72
70
|
* Could be used to pass new props or override props specific to a column menu component
|
|
73
71
|
* e.g. `displayOrder`
|
|
74
72
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
slotProps: PropTypes.object,
|
|
74
|
+
/**
|
|
75
|
+
* `slots` could be used to add new and (or) override default column menu items
|
|
76
|
+
* If you register a nee component you must pass it's `displayOrder` in `slotProps`
|
|
77
|
+
* or it will be placed in the end of the list
|
|
78
|
+
*/
|
|
79
|
+
slots: PropTypes.object
|
|
80
80
|
} : void 0;
|
|
81
81
|
export { GridColumnMenu, GridGenericColumnMenu };
|
|
@@ -156,7 +156,7 @@ var GridFilterPanel = /*#__PURE__*/React.forwardRef(function GridFilterPanel(pro
|
|
|
156
156
|
columnsSort: columnsSort
|
|
157
157
|
}, filterFormProps), item.id == null ? index : item.id);
|
|
158
158
|
})
|
|
159
|
-
}), !rootProps.disableMultipleColumnsFiltering && !disableAddFilterButton &&
|
|
159
|
+
}), !rootProps.disableMultipleColumnsFiltering && !(disableAddFilterButton && disableRemoveAllButton) ? /*#__PURE__*/_jsxs(GridPanelFooter, {
|
|
160
160
|
children: [!disableAddFilterButton ? /*#__PURE__*/_jsx(rootProps.slots.baseButton, _extends({
|
|
161
161
|
onClick: addNewFilter,
|
|
162
162
|
startIcon: /*#__PURE__*/_jsx(rootProps.slots.filterPanelAddIcon, {})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { GridColumnMenu,
|
|
1
|
+
export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } from './menu/columnMenu/GridColumnMenu';
|
|
@@ -283,7 +283,13 @@ export var useGridColumnHeaders = function useGridColumnHeaders(props) {
|
|
|
283
283
|
}).filter(function (groupStructure) {
|
|
284
284
|
return groupStructure.columnFields.length > 0;
|
|
285
285
|
});
|
|
286
|
-
var
|
|
286
|
+
var firstVisibleColumnIndex = visibleColumnGroupHeader[0].columnFields.indexOf(firstColumnFieldToRender);
|
|
287
|
+
var hiddenGroupColumns = visibleColumnGroupHeader[0].columnFields.slice(0, firstVisibleColumnIndex);
|
|
288
|
+
var leftOverflow = hiddenGroupColumns.reduce(function (acc, field) {
|
|
289
|
+
var _column$computedWidth;
|
|
290
|
+
var column = apiRef.current.getColumn(field);
|
|
291
|
+
return acc + ((_column$computedWidth = column.computedWidth) != null ? _column$computedWidth : 0);
|
|
292
|
+
}, 0);
|
|
287
293
|
var columnIndex = firstColumnToRender;
|
|
288
294
|
var elements = visibleColumnGroupHeader.map(function (_ref6) {
|
|
289
295
|
var groupId = _ref6.groupId,
|
|
@@ -6,54 +6,49 @@ var _excluded = ["displayOrder"];
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import Divider from '@mui/material/Divider';
|
|
8
8
|
import { useGridPrivateApiContext } from '../../utils/useGridPrivateApiContext';
|
|
9
|
-
var
|
|
10
|
-
var camelCase = pascalCase.split('');
|
|
11
|
-
camelCase[0] = camelCase[0].toLowerCase();
|
|
12
|
-
return camelCase.join('');
|
|
13
|
-
};
|
|
14
|
-
var useGridColumnMenuComponents = function useGridColumnMenuComponents(props) {
|
|
9
|
+
var useGridColumnMenuSlots = function useGridColumnMenuSlots(props) {
|
|
15
10
|
var apiRef = useGridPrivateApiContext();
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
_props$
|
|
19
|
-
|
|
20
|
-
_props$
|
|
21
|
-
|
|
11
|
+
var defaultSlots = props.defaultSlots,
|
|
12
|
+
defaultSlotProps = props.defaultSlotProps,
|
|
13
|
+
_props$slots = props.slots,
|
|
14
|
+
slots = _props$slots === void 0 ? {} : _props$slots,
|
|
15
|
+
_props$slotProps = props.slotProps,
|
|
16
|
+
slotProps = _props$slotProps === void 0 ? {} : _props$slotProps,
|
|
22
17
|
hideMenu = props.hideMenu,
|
|
23
18
|
colDef = props.colDef,
|
|
24
19
|
_props$addDividers = props.addDividers,
|
|
25
20
|
addDividers = _props$addDividers === void 0 ? true : _props$addDividers;
|
|
26
21
|
var processedComponents = React.useMemo(function () {
|
|
27
|
-
return _extends({},
|
|
28
|
-
}, [
|
|
29
|
-
var
|
|
30
|
-
if (!
|
|
31
|
-
return
|
|
22
|
+
return _extends({}, defaultSlots, slots);
|
|
23
|
+
}, [defaultSlots, slots]);
|
|
24
|
+
var processedSlotProps = React.useMemo(function () {
|
|
25
|
+
if (!slotProps || Object.keys(slotProps).length === 0) {
|
|
26
|
+
return defaultSlotProps;
|
|
32
27
|
}
|
|
33
|
-
var mergedProps = _extends({},
|
|
34
|
-
Object.entries(
|
|
28
|
+
var mergedProps = _extends({}, slotProps);
|
|
29
|
+
Object.entries(defaultSlotProps).forEach(function (_ref) {
|
|
35
30
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
36
31
|
key = _ref2[0],
|
|
37
|
-
|
|
38
|
-
mergedProps[key] = _extends({},
|
|
32
|
+
currentSlotProps = _ref2[1];
|
|
33
|
+
mergedProps[key] = _extends({}, currentSlotProps, slotProps[key] || {});
|
|
39
34
|
});
|
|
40
35
|
return mergedProps;
|
|
41
|
-
}, [
|
|
36
|
+
}, [defaultSlotProps, slotProps]);
|
|
42
37
|
var defaultItems = apiRef.current.unstable_applyPipeProcessors('columnMenu', [], props.colDef);
|
|
43
38
|
var userItems = React.useMemo(function () {
|
|
44
|
-
var defaultComponentKeys = Object.keys(
|
|
45
|
-
return Object.keys(
|
|
39
|
+
var defaultComponentKeys = Object.keys(defaultSlots);
|
|
40
|
+
return Object.keys(slots).filter(function (key) {
|
|
46
41
|
return !defaultComponentKeys.includes(key);
|
|
47
42
|
});
|
|
48
|
-
}, [
|
|
43
|
+
}, [slots, defaultSlots]);
|
|
49
44
|
return React.useMemo(function () {
|
|
50
45
|
var uniqueItems = Array.from(new Set([].concat(_toConsumableArray(defaultItems), _toConsumableArray(userItems))));
|
|
51
46
|
var cleansedItems = uniqueItems.filter(function (key) {
|
|
52
47
|
return processedComponents[key] != null;
|
|
53
48
|
});
|
|
54
49
|
var sorted = cleansedItems.sort(function (a, b) {
|
|
55
|
-
var leftItemProps =
|
|
56
|
-
var rightItemProps =
|
|
50
|
+
var leftItemProps = processedSlotProps[a];
|
|
51
|
+
var rightItemProps = processedSlotProps[b];
|
|
57
52
|
var leftDisplayOrder = Number.isFinite(leftItemProps == null ? void 0 : leftItemProps.displayOrder) ? leftItemProps.displayOrder : 100;
|
|
58
53
|
var rightDisplayOrder = Number.isFinite(rightItemProps == null ? void 0 : rightItemProps.displayOrder) ? rightItemProps.displayOrder : 100;
|
|
59
54
|
return leftDisplayOrder - rightDisplayOrder;
|
|
@@ -63,7 +58,7 @@ var useGridColumnMenuComponents = function useGridColumnMenuComponents(props) {
|
|
|
63
58
|
colDef: colDef,
|
|
64
59
|
onClick: hideMenu
|
|
65
60
|
};
|
|
66
|
-
var processedComponentProps =
|
|
61
|
+
var processedComponentProps = processedSlotProps[key];
|
|
67
62
|
if (processedComponentProps) {
|
|
68
63
|
var displayOrder = processedComponentProps.displayOrder,
|
|
69
64
|
customProps = _objectWithoutProperties(processedComponentProps, _excluded);
|
|
@@ -71,6 +66,6 @@ var useGridColumnMenuComponents = function useGridColumnMenuComponents(props) {
|
|
|
71
66
|
}
|
|
72
67
|
return addDividers && index !== sorted.length - 1 ? [].concat(_toConsumableArray(acc), [[processedComponents[key], itemProps], [Divider, {}]]) : [].concat(_toConsumableArray(acc), [[processedComponents[key], itemProps]]);
|
|
73
68
|
}, []);
|
|
74
|
-
}, [addDividers, colDef, defaultItems, hideMenu, processedComponents,
|
|
69
|
+
}, [addDividers, colDef, defaultItems, hideMenu, processedComponents, processedSlotProps, userItems]);
|
|
75
70
|
};
|
|
76
|
-
export {
|
|
71
|
+
export { useGridColumnMenuSlots };
|
|
@@ -245,7 +245,7 @@ export function useGridColumns(apiRef, props) {
|
|
|
245
245
|
if (props.disableColumnSelector) {
|
|
246
246
|
return columnMenuItems;
|
|
247
247
|
}
|
|
248
|
-
return [].concat(_toConsumableArray(columnMenuItems), ['
|
|
248
|
+
return [].concat(_toConsumableArray(columnMenuItems), ['columnMenuColumnsItem']);
|
|
249
249
|
}, [props.disableColumnSelector]);
|
|
250
250
|
useGridRegisterPipeProcessor(apiRef, 'columnMenu', addColumnMenuItems);
|
|
251
251
|
useGridRegisterPipeProcessor(apiRef, 'exportState', stateExportPreProcessing);
|
|
@@ -60,7 +60,7 @@ export var useGridFilter = function useGridFilter(apiRef, props) {
|
|
|
60
60
|
if (colDef == null || colDef.filterable === false || props.disableColumnFilter) {
|
|
61
61
|
return columnMenuItems;
|
|
62
62
|
}
|
|
63
|
-
return [].concat(_toConsumableArray(columnMenuItems), ['
|
|
63
|
+
return [].concat(_toConsumableArray(columnMenuItems), ['columnMenuFilterItem']);
|
|
64
64
|
}, [props.disableColumnFilter]);
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var GridPreferencePanelsValue
|
|
2
|
-
(function (GridPreferencePanelsValue) {
|
|
1
|
+
var GridPreferencePanelsValue = /*#__PURE__*/function (GridPreferencePanelsValue) {
|
|
3
2
|
GridPreferencePanelsValue["filters"] = "filters";
|
|
4
3
|
GridPreferencePanelsValue["columns"] = "columns";
|
|
5
|
-
|
|
4
|
+
return GridPreferencePanelsValue;
|
|
5
|
+
}(GridPreferencePanelsValue || {});
|
|
6
6
|
export { GridPreferencePanelsValue };
|
|
@@ -81,7 +81,7 @@ export var useGridSorting = function useGridSorting(apiRef, props) {
|
|
|
81
81
|
if (sortingOrder.some(function (item) {
|
|
82
82
|
return !!item;
|
|
83
83
|
})) {
|
|
84
|
-
return [].concat(_toConsumableArray(columnMenuItems), ['
|
|
84
|
+
return [].concat(_toConsumableArray(columnMenuItems), ['columnMenuSortItem']);
|
|
85
85
|
}
|
|
86
86
|
return columnMenuItems;
|
|
87
87
|
}, [props.sortingOrder]);
|
|
@@ -450,7 +450,7 @@ export var useGridVirtualScroller = function useGridVirtualScroller(props) {
|
|
|
450
450
|
prevRootRowStyle.current = rootRowStyle;
|
|
451
451
|
return rows;
|
|
452
452
|
};
|
|
453
|
-
var needsHorizontalScrollbar = containerDimensions.width && columnsTotalWidth
|
|
453
|
+
var needsHorizontalScrollbar = containerDimensions.width && columnsTotalWidth >= containerDimensions.width;
|
|
454
454
|
var contentSize = React.useMemo(function () {
|
|
455
455
|
// In cases where the columns exceed the available width,
|
|
456
456
|
// the horizontal scrollbar should be shown even when there're no rows.
|
|
@@ -8,11 +8,11 @@ import { FinalizationRegistryBasedCleanupTracking } from '../../utils/cleanupTra
|
|
|
8
8
|
* Signal to the underlying logic what version of the public component API
|
|
9
9
|
* of the data grid is exposed.
|
|
10
10
|
*/
|
|
11
|
-
var GridSignature
|
|
12
|
-
(function (GridSignature) {
|
|
11
|
+
var GridSignature = /*#__PURE__*/function (GridSignature) {
|
|
13
12
|
GridSignature["DataGrid"] = "DataGrid";
|
|
14
13
|
GridSignature["DataGridPro"] = "DataGridPro";
|
|
15
|
-
|
|
14
|
+
return GridSignature;
|
|
15
|
+
}(GridSignature || {});
|
|
16
16
|
// We use class to make it easier to detect in heap snapshots by name
|
|
17
17
|
var ObjectToBeRetainedByReact = /*#__PURE__*/_createClass(function ObjectToBeRetainedByReact() {
|
|
18
18
|
_classCallCheck(this, ObjectToBeRetainedByReact);
|
package/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-data-grid v6.0.
|
|
2
|
+
* @mui/x-data-grid v6.0.4
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -22,7 +22,7 @@ export { GridColumnHeaders } from './components/GridColumnHeaders';
|
|
|
22
22
|
/**
|
|
23
23
|
* Reexportable components.
|
|
24
24
|
*/
|
|
25
|
-
export { GridColumnMenu,
|
|
25
|
+
export { GridColumnMenu, GRID_COLUMN_MENU_SLOTS, GRID_COLUMN_MENU_SLOT_PROPS } from './components/reexportable';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* The full grid API.
|
package/legacy/locales/bgBG.js
CHANGED
|
@@ -22,17 +22,15 @@ var bgBGGrid = {
|
|
|
22
22
|
return "".concat(count, " \u0430\u043A\u0442\u0438\u0432\u043D\u0438 \u0444\u0438\u043B\u0442\u0440\u0438");
|
|
23
23
|
},
|
|
24
24
|
// Quick filter toolbar field
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
toolbarQuickFilterPlaceholder: 'Търси…',
|
|
26
|
+
toolbarQuickFilterLabel: 'Търсене',
|
|
27
|
+
toolbarQuickFilterDeleteIconLabel: 'Изчисти',
|
|
29
28
|
// Export selector toolbar button text
|
|
30
29
|
toolbarExport: 'Изтегли',
|
|
31
30
|
toolbarExportLabel: 'Изтегли',
|
|
32
31
|
toolbarExportCSV: 'Изтегли като CSV',
|
|
33
32
|
toolbarExportPrint: 'Принтиране',
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
toolbarExportExcel: 'Изтегли като Excel',
|
|
36
34
|
// Columns panel text
|
|
37
35
|
columnsPanelTextFieldLabel: 'Намери колона',
|
|
38
36
|
columnsPanelTextFieldPlaceholder: 'Заглавие на колона',
|
|
@@ -41,9 +39,9 @@ var bgBGGrid = {
|
|
|
41
39
|
columnsPanelHideAllButton: 'Скрий Всички',
|
|
42
40
|
// Filter panel text
|
|
43
41
|
filterPanelAddFilter: 'Добави Филтър',
|
|
44
|
-
|
|
42
|
+
filterPanelRemoveAll: 'Премахни всички',
|
|
45
43
|
filterPanelDeleteIconLabel: 'Изтрий',
|
|
46
|
-
|
|
44
|
+
filterPanelLogicOperator: 'Логически оператор',
|
|
47
45
|
filterPanelOperator: 'Оператори',
|
|
48
46
|
filterPanelOperatorAnd: 'И',
|
|
49
47
|
filterPanelOperatorOr: 'Или',
|
|
@@ -71,7 +69,7 @@ var bgBGGrid = {
|
|
|
71
69
|
// Column menu text
|
|
72
70
|
columnMenuLabel: 'Меню',
|
|
73
71
|
columnMenuShowColumns: 'Покажи колоните',
|
|
74
|
-
|
|
72
|
+
columnMenuManageColumns: 'Управление на колони',
|
|
75
73
|
columnMenuFilter: 'Филтри',
|
|
76
74
|
columnMenuHideColumn: 'Скрий',
|
|
77
75
|
columnMenuUnsort: 'Отмени сортирането',
|
|
@@ -123,10 +121,9 @@ var bgBGGrid = {
|
|
|
123
121
|
// Master/detail
|
|
124
122
|
// detailPanelToggle: 'Detail panel toggle',
|
|
125
123
|
expandDetailPanel: 'Разгъване',
|
|
126
|
-
collapseDetailPanel: 'Свиване'
|
|
127
|
-
|
|
124
|
+
collapseDetailPanel: 'Свиване',
|
|
128
125
|
// Row reordering text
|
|
129
|
-
|
|
126
|
+
rowReorderingHeaderName: 'Подредба на редове'
|
|
130
127
|
|
|
131
128
|
// Aggregation
|
|
132
129
|
// aggregationMenuItemHeader: 'Aggregation',
|