@mui/x-data-grid 7.22.1 → 8.0.0-alpha.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 +143 -92
- package/README.md +2 -2
- package/colDef/gridBooleanOperators.js +4 -6
- package/components/GridDetailPanels.js +0 -1
- package/components/GridPinnedRows.js +0 -1
- package/components/GridRow.d.ts +2 -2
- package/components/GridRow.js +3 -28
- package/components/base/GridOverlays.js +10 -8
- package/components/cell/GridActionsCell.js +1 -2
- package/components/cell/GridActionsCellItem.js +1 -2
- package/components/cell/GridCell.d.ts +41 -3
- package/components/cell/GridCell.js +1 -9
- package/components/cell/GridEditInputCell.js +0 -67
- package/components/containers/GridRootStyles.js +1 -0
- package/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
- package/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -4
- package/components/panel/GridPanel.d.ts +1 -1
- package/components/panel/filterPanel/GridFilterInputBoolean.d.ts +1 -0
- package/components/panel/filterPanel/GridFilterInputBoolean.js +14 -5
- package/components/toolbar/GridToolbar.d.ts +2 -2
- package/components/toolbar/GridToolbar.js +12 -4
- package/components/toolbar/GridToolbarColumnsButton.js +1 -1
- package/components/toolbar/GridToolbarDensitySelector.js +2 -4
- package/components/toolbar/GridToolbarExport.d.ts +2 -2
- package/components/toolbar/GridToolbarExport.js +9 -6
- package/components/toolbar/GridToolbarExportContainer.js +1 -2
- package/components/toolbar/index.d.ts +1 -1
- package/components/virtualization/GridVirtualScrollbar.js +6 -0
- package/hooks/features/columnResize/useGridColumnResize.js +4 -2
- package/hooks/features/editing/useGridCellEditing.js +23 -4
- package/hooks/features/editing/useGridRowEditing.js +23 -2
- package/hooks/features/export/useGridCsvExport.js +1 -1
- package/hooks/features/export/useGridPrintExport.js +1 -1
- package/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/hooks/features/rowSelection/useGridRowSelection.d.ts +1 -1
- package/hooks/features/rowSelection/useGridRowSelection.js +30 -16
- package/hooks/features/rows/gridRowsUtils.d.ts +1 -1
- package/hooks/features/rows/gridRowsUtils.js +1 -5
- package/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/hooks/utils/useGridSelector.d.ts +3 -2
- package/hooks/utils/useGridSelector.js +27 -2
- package/index.d.ts +0 -1
- package/index.js +1 -1
- package/locales/plPL.js +25 -28
- package/locales/trTR.js +2 -2
- package/material/index.js +4 -0
- package/models/gridSlotsComponent.d.ts +10 -0
- package/models/gridSlotsComponentsProps.d.ts +8 -0
- package/models/props/DataGridProps.d.ts +1 -1
- package/modern/colDef/gridBooleanOperators.js +4 -6
- package/modern/components/GridDetailPanels.js +0 -1
- package/modern/components/GridPinnedRows.js +0 -1
- package/modern/components/GridRow.js +3 -28
- package/modern/components/base/GridOverlays.js +10 -8
- package/modern/components/cell/GridActionsCell.js +1 -2
- package/modern/components/cell/GridActionsCellItem.js +1 -2
- package/modern/components/cell/GridCell.js +1 -9
- package/modern/components/cell/GridEditInputCell.js +0 -67
- package/modern/components/containers/GridRootStyles.js +1 -0
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
- package/modern/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -4
- package/modern/components/panel/filterPanel/GridFilterInputBoolean.js +14 -5
- package/modern/components/toolbar/GridToolbar.js +12 -4
- package/modern/components/toolbar/GridToolbarColumnsButton.js +1 -1
- package/modern/components/toolbar/GridToolbarDensitySelector.js +2 -4
- package/modern/components/toolbar/GridToolbarExport.js +9 -6
- package/modern/components/toolbar/GridToolbarExportContainer.js +1 -2
- package/modern/components/virtualization/GridVirtualScrollbar.js +6 -0
- package/modern/hooks/features/columnResize/useGridColumnResize.js +4 -2
- package/modern/hooks/features/editing/useGridCellEditing.js +23 -4
- package/modern/hooks/features/editing/useGridRowEditing.js +23 -2
- package/modern/hooks/features/export/useGridCsvExport.js +1 -1
- package/modern/hooks/features/export/useGridPrintExport.js +1 -1
- package/modern/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/modern/hooks/features/rowSelection/useGridRowSelection.js +30 -16
- package/modern/hooks/features/rows/gridRowsUtils.js +1 -5
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/modern/hooks/utils/useGridSelector.js +27 -2
- package/modern/index.js +1 -1
- package/modern/locales/plPL.js +25 -28
- package/modern/locales/trTR.js +2 -2
- package/modern/material/index.js +4 -0
- package/modern/utils/createSelector.js +11 -1
- package/modern/utils/utils.js +1 -3
- package/node/colDef/gridBooleanOperators.js +3 -5
- package/node/components/GridDetailPanels.js +0 -1
- package/node/components/GridPinnedRows.js +0 -1
- package/node/components/GridRow.js +3 -28
- package/node/components/base/GridOverlays.js +10 -8
- package/node/components/cell/GridActionsCell.js +1 -2
- package/node/components/cell/GridActionsCellItem.js +1 -2
- package/node/components/cell/GridCell.js +1 -9
- package/node/components/cell/GridEditInputCell.js +0 -67
- package/node/components/containers/GridRootStyles.js +1 -0
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuFilterItem.js +1 -2
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuHideItem.js +1 -2
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuManageItem.js +1 -2
- package/node/components/menu/columnMenu/menuItems/GridColumnMenuSortItem.js +3 -4
- package/node/components/panel/filterPanel/GridFilterInputBoolean.js +16 -5
- package/node/components/toolbar/GridToolbar.js +12 -4
- package/node/components/toolbar/GridToolbarColumnsButton.js +3 -3
- package/node/components/toolbar/GridToolbarDensitySelector.js +2 -4
- package/node/components/toolbar/GridToolbarExport.js +9 -6
- package/node/components/toolbar/GridToolbarExportContainer.js +1 -2
- package/node/components/virtualization/GridVirtualScrollbar.js +6 -0
- package/node/hooks/features/columnResize/useGridColumnResize.js +4 -2
- package/node/hooks/features/editing/useGridCellEditing.js +23 -4
- package/node/hooks/features/editing/useGridRowEditing.js +23 -2
- package/node/hooks/features/export/useGridCsvExport.js +2 -2
- package/node/hooks/features/export/useGridPrintExport.js +2 -2
- package/node/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/node/hooks/features/rowSelection/useGridRowSelection.js +29 -15
- package/node/hooks/features/rows/gridRowsUtils.js +2 -8
- package/node/hooks/features/virtualization/useGridVirtualScroller.js +4 -4
- package/node/hooks/utils/useGridSelector.js +29 -3
- package/node/index.js +1 -1
- package/node/locales/plPL.js +25 -28
- package/node/locales/trTR.js +2 -2
- package/node/material/index.js +4 -0
- package/node/utils/createSelector.js +11 -1
- package/node/utils/utils.js +1 -3
- package/package.json +3 -3
- package/utils/createSelector.d.ts +1 -1
- package/utils/createSelector.js +11 -1
- package/utils/utils.js +1 -3
|
@@ -14,7 +14,7 @@ export declare const gridPinnedColumnPositionLookup: {
|
|
|
14
14
|
0: undefined;
|
|
15
15
|
3: undefined;
|
|
16
16
|
};
|
|
17
|
-
export type GridCellProps = {
|
|
17
|
+
export type GridCellProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
18
18
|
align: GridAlignment;
|
|
19
19
|
className?: string;
|
|
20
20
|
colIndex: number;
|
|
@@ -32,12 +32,50 @@ export type GridCellProps = {
|
|
|
32
32
|
gridHasFiller: boolean;
|
|
33
33
|
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
34
34
|
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
35
|
+
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
|
35
36
|
onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|
|
37
|
+
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
|
36
38
|
onMouseUp?: React.MouseEventHandler<HTMLDivElement>;
|
|
39
|
+
onMouseOver?: React.MouseEventHandler<HTMLDivElement>;
|
|
40
|
+
onKeyUp?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
37
41
|
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
38
42
|
onDragEnter?: React.DragEventHandler<HTMLDivElement>;
|
|
39
43
|
onDragOver?: React.DragEventHandler<HTMLDivElement>;
|
|
40
|
-
|
|
44
|
+
onFocus?: React.FocusEventHandler<Element>;
|
|
45
|
+
children?: React.ReactNode;
|
|
46
|
+
style?: React.CSSProperties;
|
|
47
|
+
[x: `data-${string}`]: string;
|
|
41
48
|
};
|
|
42
|
-
declare const MemoizedGridCell: React.ForwardRefExoticComponent<
|
|
49
|
+
declare const MemoizedGridCell: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
50
|
+
[x: `data-${string}`]: string;
|
|
51
|
+
align: GridAlignment;
|
|
52
|
+
className?: string;
|
|
53
|
+
colIndex: number;
|
|
54
|
+
column: GridColDef;
|
|
55
|
+
rowId: GridRowId;
|
|
56
|
+
width: number;
|
|
57
|
+
colSpan?: number;
|
|
58
|
+
disableDragEvents?: boolean;
|
|
59
|
+
isNotVisible: boolean;
|
|
60
|
+
editCellState: GridEditCellProps<any> | null;
|
|
61
|
+
pinnedOffset: number;
|
|
62
|
+
pinnedPosition: PinnedPosition;
|
|
63
|
+
sectionIndex: number;
|
|
64
|
+
sectionLength: number;
|
|
65
|
+
gridHasFiller: boolean;
|
|
66
|
+
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
67
|
+
onDoubleClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
68
|
+
onMouseEnter?: React.MouseEventHandler<HTMLDivElement>;
|
|
69
|
+
onMouseDown?: React.MouseEventHandler<HTMLDivElement>;
|
|
70
|
+
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
|
71
|
+
onMouseUp?: React.MouseEventHandler<HTMLDivElement>;
|
|
72
|
+
onMouseOver?: React.MouseEventHandler<HTMLDivElement>;
|
|
73
|
+
onKeyUp?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
74
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
|
|
75
|
+
onDragEnter?: React.DragEventHandler<HTMLDivElement>;
|
|
76
|
+
onDragOver?: React.DragEventHandler<HTMLDivElement>;
|
|
77
|
+
onFocus?: React.FocusEventHandler<Element>;
|
|
78
|
+
children?: React.ReactNode;
|
|
79
|
+
style?: React.CSSProperties;
|
|
80
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
43
81
|
export { MemoizedGridCell as GridCell };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "
|
|
3
|
+
const _excluded = ["column", "rowId", "editCellState", "align", "children", "colIndex", "width", "className", "style", "colSpan", "disableDragEvents", "isNotVisible", "pinnedOffset", "pinnedPosition", "sectionIndex", "sectionLength", "gridHasFiller", "onClick", "onDoubleClick", "onMouseDown", "onMouseUp", "onMouseOver", "onKeyDown", "onKeyUp", "onDragEnter", "onDragOver"],
|
|
4
4
|
_excluded2 = ["changeReason", "unstable_updateValueOnRender"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -342,7 +342,6 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
342
342
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
343
343
|
// ----------------------------------------------------------------------
|
|
344
344
|
align: PropTypes.oneOf(['center', 'left', 'right']).isRequired,
|
|
345
|
-
className: PropTypes.string,
|
|
346
345
|
colIndex: PropTypes.number.isRequired,
|
|
347
346
|
colSpan: PropTypes.number,
|
|
348
347
|
column: PropTypes.object.isRequired,
|
|
@@ -355,13 +354,6 @@ process.env.NODE_ENV !== "production" ? GridCell.propTypes = {
|
|
|
355
354
|
}),
|
|
356
355
|
gridHasFiller: PropTypes.bool.isRequired,
|
|
357
356
|
isNotVisible: PropTypes.bool.isRequired,
|
|
358
|
-
onClick: PropTypes.func,
|
|
359
|
-
onDoubleClick: PropTypes.func,
|
|
360
|
-
onDragEnter: PropTypes.func,
|
|
361
|
-
onDragOver: PropTypes.func,
|
|
362
|
-
onKeyDown: PropTypes.func,
|
|
363
|
-
onMouseDown: PropTypes.func,
|
|
364
|
-
onMouseUp: PropTypes.func,
|
|
365
357
|
pinnedOffset: PropTypes.number.isRequired,
|
|
366
358
|
pinnedPosition: PropTypes.oneOf([0, 1, 2, 3]).isRequired,
|
|
367
359
|
rowId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
@@ -2,7 +2,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["id", "value", "formattedValue", "api", "field", "row", "rowNode", "colDef", "cellMode", "isEditable", "tabIndex", "hasFocus", "isValidating", "debounceMs", "isProcessingProps", "onValueChange"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import { unstable_composeClasses as composeClasses, unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
|
|
7
6
|
import { styled } from '@mui/material/styles';
|
|
8
7
|
import InputBase from '@mui/material/InputBase';
|
|
@@ -94,71 +93,5 @@ const GridEditInputCell = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
94
93
|
}) : undefined
|
|
95
94
|
}, other));
|
|
96
95
|
});
|
|
97
|
-
process.env.NODE_ENV !== "production" ? GridEditInputCell.propTypes = {
|
|
98
|
-
// ----------------------------- Warning --------------------------------
|
|
99
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
100
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
101
|
-
// ----------------------------------------------------------------------
|
|
102
|
-
/**
|
|
103
|
-
* GridApi that let you manipulate the grid.
|
|
104
|
-
*/
|
|
105
|
-
api: PropTypes.object.isRequired,
|
|
106
|
-
/**
|
|
107
|
-
* The mode of the cell.
|
|
108
|
-
*/
|
|
109
|
-
cellMode: PropTypes.oneOf(['edit', 'view']).isRequired,
|
|
110
|
-
changeReason: PropTypes.oneOf(['debouncedSetEditCellValue', 'setEditCellValue']),
|
|
111
|
-
/**
|
|
112
|
-
* The column of the row that the current cell belongs to.
|
|
113
|
-
*/
|
|
114
|
-
colDef: PropTypes.object.isRequired,
|
|
115
|
-
debounceMs: PropTypes.number,
|
|
116
|
-
/**
|
|
117
|
-
* The column field of the cell that triggered the event.
|
|
118
|
-
*/
|
|
119
|
-
field: PropTypes.string.isRequired,
|
|
120
|
-
/**
|
|
121
|
-
* The cell value formatted with the column valueFormatter.
|
|
122
|
-
*/
|
|
123
|
-
formattedValue: PropTypes.any,
|
|
124
|
-
/**
|
|
125
|
-
* If true, the cell is the active element.
|
|
126
|
-
*/
|
|
127
|
-
hasFocus: PropTypes.bool.isRequired,
|
|
128
|
-
/**
|
|
129
|
-
* The grid row id.
|
|
130
|
-
*/
|
|
131
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
132
|
-
/**
|
|
133
|
-
* If true, the cell is editable.
|
|
134
|
-
*/
|
|
135
|
-
isEditable: PropTypes.bool,
|
|
136
|
-
isProcessingProps: PropTypes.bool,
|
|
137
|
-
isValidating: PropTypes.bool,
|
|
138
|
-
/**
|
|
139
|
-
* Callback called when the value is changed by the user.
|
|
140
|
-
* @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback.
|
|
141
|
-
* @param {Date | null} newValue The value that is going to be passed to `apiRef.current.setEditCellValue`.
|
|
142
|
-
* @returns {Promise<void> | void} A promise to be awaited before calling `apiRef.current.setEditCellValue`
|
|
143
|
-
*/
|
|
144
|
-
onValueChange: PropTypes.func,
|
|
145
|
-
/**
|
|
146
|
-
* The row model of the row that the current cell belongs to.
|
|
147
|
-
*/
|
|
148
|
-
row: PropTypes.any.isRequired,
|
|
149
|
-
/**
|
|
150
|
-
* The node of the row that the current cell belongs to.
|
|
151
|
-
*/
|
|
152
|
-
rowNode: PropTypes.object.isRequired,
|
|
153
|
-
/**
|
|
154
|
-
* the tabIndex value.
|
|
155
|
-
*/
|
|
156
|
-
tabIndex: PropTypes.oneOf([-1, 0]).isRequired,
|
|
157
|
-
/**
|
|
158
|
-
* The cell value.
|
|
159
|
-
* If the column has `valueGetter`, use `params.row` to directly access the fields.
|
|
160
|
-
*/
|
|
161
|
-
value: PropTypes.any
|
|
162
|
-
} : void 0;
|
|
163
96
|
export { GridEditInputCell };
|
|
164
97
|
export const renderEditInputCell = params => /*#__PURE__*/_jsx(GridEditInputCell, _extends({}, params));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
4
3
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
5
4
|
import ListItemText from '@mui/material/ListItemText';
|
|
6
5
|
import { useGridApiContext } from "../../../../hooks/utils/useGridApiContext.js";
|
|
@@ -20,7 +19,7 @@ function GridColumnMenuFilterItem(props) {
|
|
|
20
19
|
if (rootProps.disableColumnFilter || !colDef.filterable) {
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
|
-
return /*#__PURE__*/_jsxs(
|
|
22
|
+
return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
24
23
|
onClick: showFilter,
|
|
25
24
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
26
25
|
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuFilterIcon, {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
4
3
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
5
4
|
import ListItemText from '@mui/material/ListItemText';
|
|
6
5
|
import { useGridApiContext } from "../../../../hooks/utils/useGridApiContext.js";
|
|
@@ -36,7 +35,7 @@ function GridColumnMenuHideItem(props) {
|
|
|
36
35
|
if (colDef.hideable === false) {
|
|
37
36
|
return null;
|
|
38
37
|
}
|
|
39
|
-
return /*#__PURE__*/_jsxs(
|
|
38
|
+
return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
40
39
|
onClick: toggleColumn,
|
|
41
40
|
disabled: disabled,
|
|
42
41
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
4
3
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
5
4
|
import ListItemText from '@mui/material/ListItemText';
|
|
6
5
|
import { GridPreferencePanelsValue } from "../../../../hooks/features/preferencesPanel/gridPreferencePanelsValue.js";
|
|
@@ -20,7 +19,7 @@ function GridColumnMenuManageItem(props) {
|
|
|
20
19
|
if (rootProps.disableColumnSelector) {
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
|
-
return /*#__PURE__*/_jsxs(
|
|
22
|
+
return /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
24
23
|
onClick: showColumns,
|
|
25
24
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
26
25
|
children: /*#__PURE__*/_jsx(rootProps.slots.columnMenuManageColumnsIcon, {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
4
3
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
5
4
|
import ListItemText from '@mui/material/ListItemText';
|
|
6
5
|
import { useGridSelector } from "../../../../hooks/utils/useGridSelector.js";
|
|
@@ -37,7 +36,7 @@ function GridColumnMenuSortItem(props) {
|
|
|
37
36
|
return typeof label === 'function' ? label(colDef) : label;
|
|
38
37
|
};
|
|
39
38
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
40
|
-
children: [sortingOrder.includes('asc') && sortDirection !== 'asc' ? /*#__PURE__*/_jsxs(
|
|
39
|
+
children: [sortingOrder.includes('asc') && sortDirection !== 'asc' ? /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
41
40
|
onClick: onSortMenuItemClick,
|
|
42
41
|
"data-value": "asc",
|
|
43
42
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
@@ -47,7 +46,7 @@ function GridColumnMenuSortItem(props) {
|
|
|
47
46
|
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
48
47
|
children: getLabel('columnMenuSortAsc')
|
|
49
48
|
})]
|
|
50
|
-
}) : null, sortingOrder.includes('desc') && sortDirection !== 'desc' ? /*#__PURE__*/_jsxs(
|
|
49
|
+
}) : null, sortingOrder.includes('desc') && sortDirection !== 'desc' ? /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
51
50
|
onClick: onSortMenuItemClick,
|
|
52
51
|
"data-value": "desc",
|
|
53
52
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
@@ -57,7 +56,7 @@ function GridColumnMenuSortItem(props) {
|
|
|
57
56
|
}), /*#__PURE__*/_jsx(ListItemText, {
|
|
58
57
|
children: getLabel('columnMenuSortDesc')
|
|
59
58
|
})]
|
|
60
|
-
}) : null, sortingOrder.includes(null) && sortDirection != null ? /*#__PURE__*/_jsxs(
|
|
59
|
+
}) : null, sortingOrder.includes(null) && sortDirection != null ? /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
61
60
|
onClick: onSortMenuItemClick,
|
|
62
61
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {}), /*#__PURE__*/_jsx(ListItemText, {
|
|
63
62
|
children: apiRef.current.getLocaleText('columnMenuUnsort')
|
|
@@ -16,7 +16,7 @@ export interface GridPanelProps extends Partial<React.ComponentProps<typeof Grid
|
|
|
16
16
|
open: boolean;
|
|
17
17
|
}
|
|
18
18
|
export declare const gridPanelClasses: Record<keyof GridPanelClasses, string>;
|
|
19
|
-
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<import("@mui/material").PopperProps & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "ref" | "suppressHydrationWarning" | "className" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "
|
|
19
|
+
declare const GridPanelRoot: import("@emotion/styled").StyledComponent<Pick<import("@mui/material").PopperProps & React.RefAttributes<HTMLDivElement>, "hidden" | "color" | "content" | "style" | "open" | "translate" | "container" | "transition" | "slot" | "title" | "ref" | "suppressHydrationWarning" | "className" | "id" | "lang" | "role" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "nonce" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "component" | "sx" | "components" | "componentsProps" | "placement" | "disablePortal" | "modifiers" | "anchorEl" | "keepMounted" | "popperOptions" | "popperRef" | "slotProps" | "slots"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
20
20
|
ownerState: OwnerState;
|
|
21
21
|
}, {}, {}>;
|
|
22
22
|
declare const GridPanel: React.ForwardRefExoticComponent<Omit<GridPanelProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -9,6 +9,7 @@ export type GridFilterInputBooleanProps = GridFilterInputValueProps & TextFieldP
|
|
|
9
9
|
*/
|
|
10
10
|
isFilterActive?: boolean;
|
|
11
11
|
};
|
|
12
|
+
export declare const sanitizeFilterItemValue: (value: any) => boolean | undefined;
|
|
12
13
|
declare function GridFilterInputBoolean(props: GridFilterInputBooleanProps): React.JSX.Element;
|
|
13
14
|
declare namespace GridFilterInputBoolean {
|
|
14
15
|
var propTypes: any;
|
|
@@ -7,6 +7,15 @@ import { refType, unstable_useId as useId } from '@mui/utils';
|
|
|
7
7
|
import { styled } from '@mui/material/styles';
|
|
8
8
|
import { useGridRootProps } from "../../../hooks/utils/useGridRootProps.js";
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
+
export const sanitizeFilterItemValue = value => {
|
|
11
|
+
if (String(value).toLowerCase() === 'true') {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (String(value).toLowerCase() === 'false') {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
};
|
|
10
19
|
const BooleanOperatorContainer = styled('div')({
|
|
11
20
|
display: 'flex',
|
|
12
21
|
alignItems: 'center',
|
|
@@ -27,7 +36,7 @@ function GridFilterInputBoolean(props) {
|
|
|
27
36
|
variant = 'standard'
|
|
28
37
|
} = props,
|
|
29
38
|
others = _objectWithoutPropertiesLoose(props, _excluded);
|
|
30
|
-
const [filterValueState, setFilterValueState] = React.useState(item.value
|
|
39
|
+
const [filterValueState, setFilterValueState] = React.useState(sanitizeFilterItemValue(item.value));
|
|
31
40
|
const rootProps = useGridRootProps();
|
|
32
41
|
const labelId = useId();
|
|
33
42
|
const selectId = useId();
|
|
@@ -35,14 +44,14 @@ function GridFilterInputBoolean(props) {
|
|
|
35
44
|
const isSelectNative = baseSelectProps.native ?? false;
|
|
36
45
|
const baseSelectOptionProps = rootProps.slotProps?.baseSelectOption || {};
|
|
37
46
|
const onFilterChange = React.useCallback(event => {
|
|
38
|
-
const value = event.target.value;
|
|
47
|
+
const value = sanitizeFilterItemValue(event.target.value);
|
|
39
48
|
setFilterValueState(value);
|
|
40
49
|
applyValue(_extends({}, item, {
|
|
41
|
-
value
|
|
50
|
+
value
|
|
42
51
|
}));
|
|
43
52
|
}, [applyValue, item]);
|
|
44
53
|
React.useEffect(() => {
|
|
45
|
-
setFilterValueState(item.value
|
|
54
|
+
setFilterValueState(sanitizeFilterItemValue(item.value));
|
|
46
55
|
}, [item.value]);
|
|
47
56
|
const label = labelProp ?? apiRef.current.getLocaleText('filterPanelInputLabel');
|
|
48
57
|
return /*#__PURE__*/_jsxs(BooleanOperatorContainer, {
|
|
@@ -57,7 +66,7 @@ function GridFilterInputBoolean(props) {
|
|
|
57
66
|
labelId: labelId,
|
|
58
67
|
id: selectId,
|
|
59
68
|
label: label,
|
|
60
|
-
value: filterValueState,
|
|
69
|
+
value: filterValueState === undefined ? '' : String(filterValueState),
|
|
61
70
|
onChange: onFilterChange,
|
|
62
71
|
variant: variant,
|
|
63
72
|
notched: variant === 'outlined' ? true : undefined,
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { GridToolbarContainerProps } from '../containers/GridToolbarContainer';
|
|
3
3
|
import { GridToolbarExportProps } from './GridToolbarExport';
|
|
4
4
|
import { GridToolbarQuickFilterProps } from './GridToolbarQuickFilter';
|
|
5
|
-
export interface GridToolbarProps extends GridToolbarContainerProps,
|
|
5
|
+
export interface GridToolbarProps extends GridToolbarContainerProps, GridToolbarExportProps {
|
|
6
6
|
/**
|
|
7
7
|
* Show the quick filter component.
|
|
8
8
|
* @default false
|
|
@@ -13,5 +13,5 @@ export interface GridToolbarProps extends GridToolbarContainerProps, Omit<GridTo
|
|
|
13
13
|
*/
|
|
14
14
|
quickFilterProps?: GridToolbarQuickFilterProps;
|
|
15
15
|
}
|
|
16
|
-
declare const GridToolbar: React.ForwardRefExoticComponent<
|
|
16
|
+
declare const GridToolbar: React.ForwardRefExoticComponent<GridToolbarProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
17
|
export { GridToolbar };
|
|
@@ -14,14 +14,15 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
const GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, ref) {
|
|
15
15
|
// TODO v7: think about where export option should be passed.
|
|
16
16
|
// from slotProps={{ toolbarExport: { ...exportOption } }} seems to be more appropriate
|
|
17
|
-
const
|
|
17
|
+
const _ref = props,
|
|
18
|
+
{
|
|
18
19
|
csvOptions,
|
|
19
20
|
printOptions,
|
|
20
21
|
excelOptions,
|
|
21
22
|
showQuickFilter = false,
|
|
22
23
|
quickFilterProps = {}
|
|
23
|
-
} =
|
|
24
|
-
other = _objectWithoutPropertiesLoose(
|
|
24
|
+
} = _ref,
|
|
25
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
25
26
|
const rootProps = useGridRootProps();
|
|
26
27
|
if (rootProps.disableColumnFilter && rootProps.disableColumnSelector && rootProps.disableDensitySelector && !showQuickFilter) {
|
|
27
28
|
return null;
|
|
@@ -32,7 +33,7 @@ const GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, re
|
|
|
32
33
|
children: [/*#__PURE__*/_jsx(GridToolbarColumnsButton, {}), /*#__PURE__*/_jsx(GridToolbarFilterButton, {}), /*#__PURE__*/_jsx(GridToolbarDensitySelector, {}), /*#__PURE__*/_jsx(GridToolbarExport, {
|
|
33
34
|
csvOptions: csvOptions,
|
|
34
35
|
printOptions: printOptions
|
|
35
|
-
//
|
|
36
|
+
// @ts-ignore
|
|
36
37
|
,
|
|
37
38
|
excelOptions: excelOptions
|
|
38
39
|
}), /*#__PURE__*/_jsx("div", {
|
|
@@ -47,6 +48,8 @@ process.env.NODE_ENV !== "production" ? GridToolbar.propTypes = {
|
|
|
47
48
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
48
49
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
49
50
|
// ----------------------------------------------------------------------
|
|
51
|
+
csvOptions: PropTypes.object,
|
|
52
|
+
printOptions: PropTypes.object,
|
|
50
53
|
/**
|
|
51
54
|
* Props passed to the quick filter component.
|
|
52
55
|
*/
|
|
@@ -56,6 +59,11 @@ process.env.NODE_ENV !== "production" ? GridToolbar.propTypes = {
|
|
|
56
59
|
* @default false
|
|
57
60
|
*/
|
|
58
61
|
showQuickFilter: PropTypes.bool,
|
|
62
|
+
/**
|
|
63
|
+
* The props used for each slot inside.
|
|
64
|
+
* @default {}
|
|
65
|
+
*/
|
|
66
|
+
slotProps: PropTypes.object,
|
|
59
67
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
60
68
|
} : void 0;
|
|
61
69
|
export { GridToolbar };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import
|
|
4
|
+
import useId from '@mui/utils/useId';
|
|
5
5
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
6
6
|
import { gridPreferencePanelStateSelector } from "../../hooks/features/preferencesPanel/gridPreferencePanelSelector.js";
|
|
7
7
|
import { GridPreferencePanelsValue } from "../../hooks/features/preferencesPanel/gridPreferencePanelsValue.js";
|
|
@@ -2,8 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { unstable_useId as useId, unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
5
|
-
import MenuList from '@mui/material/MenuList';
|
|
6
|
-
import MenuItem from '@mui/material/MenuItem';
|
|
7
5
|
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
8
6
|
import { gridDensitySelector } from "../../hooks/features/density/densitySelector.js";
|
|
9
7
|
import { isHideMenuKey } from "../../utils/keyboardUtils.js";
|
|
@@ -74,7 +72,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
74
72
|
if (rootProps.disableDensitySelector) {
|
|
75
73
|
return null;
|
|
76
74
|
}
|
|
77
|
-
const densityElements = densityOptions.map((option, index) => /*#__PURE__*/_jsxs(
|
|
75
|
+
const densityElements = densityOptions.map((option, index) => /*#__PURE__*/_jsxs(rootProps.slots.baseMenuItem, {
|
|
78
76
|
onClick: () => handleDensityUpdate(option.value),
|
|
79
77
|
selected: option.value === density,
|
|
80
78
|
children: [/*#__PURE__*/_jsx(ListItemIcon, {
|
|
@@ -105,7 +103,7 @@ const GridToolbarDensitySelector = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
105
103
|
target: buttonRef.current,
|
|
106
104
|
onClose: handleDensitySelectorClose,
|
|
107
105
|
position: "bottom-start",
|
|
108
|
-
children: /*#__PURE__*/_jsx(
|
|
106
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseMenuList, {
|
|
109
107
|
id: densityMenuId,
|
|
110
108
|
className: gridClasses.menuList,
|
|
111
109
|
"aria-labelledby": densityButtonId,
|
|
@@ -26,7 +26,7 @@ export interface GridToolbarExportProps {
|
|
|
26
26
|
button?: Partial<ButtonProps>;
|
|
27
27
|
tooltip?: Partial<TooltipProps>;
|
|
28
28
|
};
|
|
29
|
-
[
|
|
29
|
+
[x: `data-${string}`]: string;
|
|
30
30
|
}
|
|
31
31
|
declare function GridCsvExportMenuItem(props: GridCsvExportMenuItemProps): React.JSX.Element;
|
|
32
32
|
declare namespace GridCsvExportMenuItem {
|
|
@@ -36,5 +36,5 @@ declare function GridPrintExportMenuItem(props: GridPrintExportMenuItemProps): R
|
|
|
36
36
|
declare namespace GridPrintExportMenuItem {
|
|
37
37
|
var propTypes: any;
|
|
38
38
|
}
|
|
39
|
-
declare const GridToolbarExport: React.ForwardRefExoticComponent<
|
|
39
|
+
declare const GridToolbarExport: React.ForwardRefExoticComponent<GridToolbarExportProps & React.RefAttributes<HTMLButtonElement>>;
|
|
40
40
|
export { GridToolbarExport, GridCsvExportMenuItem, GridPrintExportMenuItem };
|
|
@@ -5,18 +5,19 @@ const _excluded = ["hideMenu", "options"],
|
|
|
5
5
|
_excluded3 = ["csvOptions", "printOptions", "excelOptions"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import
|
|
8
|
+
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
9
9
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
10
10
|
import { GridToolbarExportContainer } from "./GridToolbarExportContainer.js";
|
|
11
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
12
|
function GridCsvExportMenuItem(props) {
|
|
13
13
|
const apiRef = useGridApiContext();
|
|
14
|
+
const rootProps = useGridRootProps();
|
|
14
15
|
const {
|
|
15
16
|
hideMenu,
|
|
16
17
|
options
|
|
17
18
|
} = props,
|
|
18
19
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
19
|
-
return /*#__PURE__*/_jsx(
|
|
20
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({
|
|
20
21
|
onClick: () => {
|
|
21
22
|
apiRef.current.exportDataAsCsv(options);
|
|
22
23
|
hideMenu?.();
|
|
@@ -47,12 +48,13 @@ process.env.NODE_ENV !== "production" ? GridCsvExportMenuItem.propTypes = {
|
|
|
47
48
|
} : void 0;
|
|
48
49
|
function GridPrintExportMenuItem(props) {
|
|
49
50
|
const apiRef = useGridApiContext();
|
|
51
|
+
const rootProps = useGridRootProps();
|
|
50
52
|
const {
|
|
51
53
|
hideMenu,
|
|
52
54
|
options
|
|
53
55
|
} = props,
|
|
54
56
|
other = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
55
|
-
return /*#__PURE__*/_jsx(
|
|
57
|
+
return /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({
|
|
56
58
|
onClick: () => {
|
|
57
59
|
apiRef.current.exportDataAsPrint(options);
|
|
58
60
|
hideMenu?.();
|
|
@@ -82,12 +84,13 @@ process.env.NODE_ENV !== "production" ? GridPrintExportMenuItem.propTypes = {
|
|
|
82
84
|
})
|
|
83
85
|
} : void 0;
|
|
84
86
|
const GridToolbarExport = /*#__PURE__*/React.forwardRef(function GridToolbarExport(props, ref) {
|
|
85
|
-
const
|
|
87
|
+
const _ref = props,
|
|
88
|
+
{
|
|
86
89
|
csvOptions = {},
|
|
87
90
|
printOptions = {},
|
|
88
91
|
excelOptions
|
|
89
|
-
} =
|
|
90
|
-
other = _objectWithoutPropertiesLoose(
|
|
92
|
+
} = _ref,
|
|
93
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded3);
|
|
91
94
|
const apiRef = useGridApiContext();
|
|
92
95
|
const preProcessedButtons = apiRef.current.unstable_applyPipeProcessors('exportMenu', [], {
|
|
93
96
|
excelOptions,
|
|
@@ -2,7 +2,6 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { unstable_useId as useId, unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
5
|
-
import MenuList from '@mui/material/MenuList';
|
|
6
5
|
import { isHideMenuKey } from "../../utils/keyboardUtils.js";
|
|
7
6
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
8
7
|
import { GridMenu } from "../menu/GridMenu.js";
|
|
@@ -63,7 +62,7 @@ const GridToolbarExportContainer = /*#__PURE__*/React.forwardRef(function GridTo
|
|
|
63
62
|
target: buttonRef.current,
|
|
64
63
|
onClose: handleMenuClose,
|
|
65
64
|
position: "bottom-start",
|
|
66
|
-
children: /*#__PURE__*/_jsx(
|
|
65
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.baseMenuList, {
|
|
67
66
|
id: exportMenuId,
|
|
68
67
|
className: gridClasses.menuList,
|
|
69
68
|
"aria-labelledby": exportButtonId,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './GridToolbar';
|
|
2
2
|
export * from './GridToolbarColumnsButton';
|
|
3
3
|
export * from './GridToolbarDensitySelector';
|
|
4
|
-
export type { GridExportDisplayOptions, GridExportMenuItemProps, GridCsvExportMenuItemProps, GridPrintExportMenuItemProps, } from './GridToolbarExport';
|
|
4
|
+
export type { GridExportDisplayOptions, GridExportMenuItemProps, GridCsvExportMenuItemProps, GridPrintExportMenuItemProps, GridToolbarExportProps, } from './GridToolbarExport';
|
|
5
5
|
export { GridCsvExportMenuItem, GridPrintExportMenuItem, GridToolbarExport, } from './GridToolbarExport';
|
|
6
6
|
export * from './GridToolbarFilterButton';
|
|
7
7
|
export * from './GridToolbarExportContainer';
|
|
@@ -70,6 +70,9 @@ const GridVirtualScrollbar = /*#__PURE__*/React.forwardRef(function GridVirtualS
|
|
|
70
70
|
const onScrollerScroll = useEventCallback(() => {
|
|
71
71
|
const scroller = apiRef.current.virtualScrollerRef.current;
|
|
72
72
|
const scrollbar = scrollbarRef.current;
|
|
73
|
+
if (!scrollbar) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
73
76
|
if (scroller[propertyScroll] === lastPosition.current) {
|
|
74
77
|
return;
|
|
75
78
|
}
|
|
@@ -85,6 +88,9 @@ const GridVirtualScrollbar = /*#__PURE__*/React.forwardRef(function GridVirtualS
|
|
|
85
88
|
const onScrollbarScroll = useEventCallback(() => {
|
|
86
89
|
const scroller = apiRef.current.virtualScrollerRef.current;
|
|
87
90
|
const scrollbar = scrollbarRef.current;
|
|
91
|
+
if (!scrollbar) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
88
94
|
if (isLocked.current) {
|
|
89
95
|
isLocked.current = false;
|
|
90
96
|
return;
|
|
@@ -193,8 +193,10 @@ export const useGridColumnResize = (apiRef, props) => {
|
|
|
193
193
|
const prevWidth = refs.columnHeaderElement.offsetWidth;
|
|
194
194
|
const widthDiff = newWidth - prevWidth;
|
|
195
195
|
const columnWidthDiff = newWidth - refs.initialColWidth;
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
if (columnWidthDiff > 0) {
|
|
197
|
+
const newTotalWidth = refs.initialTotalWidth + columnWidthDiff;
|
|
198
|
+
apiRef.current.rootElementRef?.current?.style.setProperty('--DataGrid-rowWidth', `${newTotalWidth}px`);
|
|
199
|
+
}
|
|
198
200
|
refs.colDef.computedWidth = newWidth;
|
|
199
201
|
refs.colDef.width = newWidth;
|
|
200
202
|
refs.colDef.flex = 0;
|