@mui/x-data-grid 8.0.0-beta.0 → 8.0.0-beta.2
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 +171 -0
- package/DataGrid/DataGrid.js +2 -0
- package/components/GridRow.js +3 -8
- package/components/GridShadowScrollArea.js +43 -35
- package/components/cell/GridBooleanCell.d.ts +1 -2
- package/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/components/cell/GridEditSingleSelectCell.js +1 -1
- package/components/columnSelection/GridHeaderCheckbox.js +2 -2
- package/components/containers/GridToolbarContainer.js +5 -3
- package/components/quickFilter/QuickFilter.d.ts +26 -3
- package/components/quickFilter/QuickFilter.js +103 -19
- package/components/quickFilter/QuickFilterClear.js +10 -4
- package/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/components/quickFilter/QuickFilterControl.js +36 -10
- package/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/components/quickFilter/QuickFilterTrigger.js +211 -0
- package/components/quickFilter/index.d.ts +2 -1
- package/components/quickFilter/index.js +11 -0
- package/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/components/toolbar/GridToolbarQuickFilter.js +101 -41
- package/components/toolbarV8/GridToolbar.js +22 -19
- package/components/toolbarV8/Toolbar.d.ts +1 -1
- package/components/toolbarV8/Toolbar.js +76 -23
- package/components/toolbarV8/ToolbarButton.js +34 -14
- package/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/constants/gridClasses.d.ts +12 -0
- package/constants/gridClasses.js +1 -1
- package/esm/DataGrid/DataGrid.js +2 -0
- package/esm/components/GridRow.js +4 -9
- package/esm/components/GridShadowScrollArea.js +43 -35
- package/esm/components/cell/GridBooleanCell.d.ts +1 -2
- package/esm/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/esm/components/cell/GridEditSingleSelectCell.js +1 -1
- package/esm/components/columnSelection/GridHeaderCheckbox.js +2 -2
- package/esm/components/containers/GridToolbarContainer.js +5 -3
- package/esm/components/quickFilter/QuickFilter.d.ts +26 -3
- package/esm/components/quickFilter/QuickFilter.js +101 -17
- package/esm/components/quickFilter/QuickFilterClear.js +10 -4
- package/esm/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/esm/components/quickFilter/QuickFilterControl.js +36 -10
- package/esm/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/esm/components/quickFilter/QuickFilterTrigger.js +204 -0
- package/esm/components/quickFilter/index.d.ts +2 -1
- package/esm/components/quickFilter/index.js +2 -1
- package/esm/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/esm/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/esm/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/esm/components/toolbar/GridToolbarQuickFilter.js +102 -44
- package/esm/components/toolbarV8/GridToolbar.js +22 -19
- package/esm/components/toolbarV8/Toolbar.d.ts +1 -1
- package/esm/components/toolbarV8/Toolbar.js +75 -22
- package/esm/components/toolbarV8/ToolbarButton.js +34 -14
- package/esm/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/esm/constants/gridClasses.d.ts +12 -0
- package/esm/constants/gridClasses.js +1 -1
- package/esm/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/esm/hooks/features/columns/useGridColumns.js +0 -1
- package/esm/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/esm/hooks/features/editing/useGridRowEditing.js +1 -1
- package/esm/hooks/features/filter/useGridFilter.js +1 -1
- package/esm/hooks/features/pagination/useGridPaginationModel.js +1 -1
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
- package/esm/index.js +1 -1
- package/esm/locales/deDE.js +13 -13
- package/esm/material/index.js +1 -2
- package/esm/models/props/DataGridProps.d.ts +6 -2
- package/esm/utils/utils.d.ts +0 -27
- package/esm/utils/utils.js +0 -122
- package/hooks/features/columnGrouping/gridColumnGroupsUtils.js +2 -2
- package/hooks/features/columns/useGridColumns.js +0 -1
- package/hooks/features/dimensions/useGridDimensions.js +2 -2
- package/hooks/features/editing/useGridRowEditing.js +1 -1
- package/hooks/features/filter/useGridFilter.js +3 -3
- package/hooks/features/pagination/useGridPaginationModel.js +2 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +11 -0
- package/index.js +1 -1
- package/locales/deDE.js +13 -13
- package/material/index.js +1 -2
- package/models/props/DataGridProps.d.ts +6 -2
- package/modern/DataGrid/DataGrid.js +2 -0
- package/modern/components/GridRow.js +4 -9
- package/modern/components/GridShadowScrollArea.js +43 -35
- package/modern/components/cell/GridBooleanCell.d.ts +1 -2
- package/modern/components/cell/GridEditSingleSelectCell.d.ts +4 -4
- package/modern/components/cell/GridEditSingleSelectCell.js +1 -1
- package/modern/components/columnSelection/GridHeaderCheckbox.js +2 -2
- package/modern/components/containers/GridToolbarContainer.js +5 -3
- package/modern/components/quickFilter/QuickFilter.d.ts +26 -3
- package/modern/components/quickFilter/QuickFilter.js +101 -17
- package/modern/components/quickFilter/QuickFilterClear.js +10 -4
- package/modern/components/quickFilter/QuickFilterContext.d.ts +4 -1
- package/modern/components/quickFilter/QuickFilterControl.js +36 -10
- package/modern/components/quickFilter/QuickFilterTrigger.d.ts +28 -0
- package/modern/components/quickFilter/QuickFilterTrigger.js +204 -0
- package/modern/components/quickFilter/index.d.ts +2 -1
- package/modern/components/quickFilter/index.js +2 -1
- package/modern/components/toolbar/GridToolbarColumnsButton.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarDensitySelector.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarExport.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarExportContainer.d.ts +3 -4
- package/modern/components/toolbar/GridToolbarFilterButton.d.ts +4 -6
- package/modern/components/toolbar/GridToolbarFilterButton.js +1 -4
- package/modern/components/toolbar/GridToolbarQuickFilter.js +102 -44
- package/modern/components/toolbarV8/GridToolbar.js +22 -19
- package/modern/components/toolbarV8/Toolbar.d.ts +1 -1
- package/modern/components/toolbarV8/Toolbar.js +75 -22
- package/modern/components/toolbarV8/ToolbarButton.js +34 -14
- package/modern/components/toolbarV8/ToolbarContext.d.ts +4 -2
- package/modern/constants/gridClasses.d.ts +12 -0
- package/modern/constants/gridClasses.js +1 -1
- package/modern/hooks/features/columnGrouping/gridColumnGroupsUtils.js +1 -1
- package/modern/hooks/features/columns/useGridColumns.js +0 -1
- package/modern/hooks/features/dimensions/useGridDimensions.js +1 -1
- package/modern/hooks/features/editing/useGridRowEditing.js +1 -1
- package/modern/hooks/features/filter/useGridFilter.js +1 -1
- package/modern/hooks/features/pagination/useGridPaginationModel.js +1 -1
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +12 -1
- package/modern/index.js +1 -1
- package/modern/locales/deDE.js +13 -13
- package/modern/material/index.js +1 -2
- package/modern/models/props/DataGridProps.d.ts +6 -2
- package/modern/utils/utils.d.ts +0 -27
- package/modern/utils/utils.js +0 -122
- package/package.json +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/utils.d.ts +0 -27
- package/utils/utils.js +0 -123
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["render", "className", "onClick"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
7
|
+
import { unstable_useForkRef as useForkRef } from '@mui/utils';
|
|
8
|
+
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
9
|
+
import { useGridComponentRenderer } from "../../hooks/utils/useGridComponentRenderer.js";
|
|
10
|
+
import { useQuickFilterContext } from "./QuickFilterContext.js";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
/**
|
|
13
|
+
* A button that expands/collapses the quick filter.
|
|
14
|
+
* It renders the `baseButton` slot.
|
|
15
|
+
*
|
|
16
|
+
* Demos:
|
|
17
|
+
*
|
|
18
|
+
* - [Quick Filter](https://mui.com/x/react-data-grid/components/quick-filter/)
|
|
19
|
+
*
|
|
20
|
+
* API:
|
|
21
|
+
*
|
|
22
|
+
* - [QuickFilterTrigger API](https://mui.com/x/api/data-grid/quick-filter-trigger/)
|
|
23
|
+
*/
|
|
24
|
+
const QuickFilterTrigger = forwardRef(function QuickFilterTrigger(props, ref) {
|
|
25
|
+
const {
|
|
26
|
+
render,
|
|
27
|
+
className,
|
|
28
|
+
onClick
|
|
29
|
+
} = props,
|
|
30
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
31
|
+
const rootProps = useGridRootProps();
|
|
32
|
+
const {
|
|
33
|
+
state,
|
|
34
|
+
controlId,
|
|
35
|
+
onExpandedChange,
|
|
36
|
+
triggerRef
|
|
37
|
+
} = useQuickFilterContext();
|
|
38
|
+
const resolvedClassName = typeof className === 'function' ? className(state) : className;
|
|
39
|
+
const handleRef = useForkRef(triggerRef, ref);
|
|
40
|
+
const handleClick = event => {
|
|
41
|
+
onExpandedChange(!state.expanded);
|
|
42
|
+
onClick?.(event);
|
|
43
|
+
};
|
|
44
|
+
const element = useGridComponentRenderer(rootProps.slots.baseButton, render, _extends({}, rootProps.slotProps?.baseButton, {
|
|
45
|
+
className: resolvedClassName,
|
|
46
|
+
'aria-controls': controlId,
|
|
47
|
+
'aria-expanded': state.expanded
|
|
48
|
+
}, other, {
|
|
49
|
+
onClick: handleClick,
|
|
50
|
+
ref: handleRef
|
|
51
|
+
}), state);
|
|
52
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
53
|
+
children: element
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
process.env.NODE_ENV !== "production" ? QuickFilterTrigger.propTypes = {
|
|
57
|
+
// ----------------------------- Warning --------------------------------
|
|
58
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
59
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
60
|
+
// ----------------------------------------------------------------------
|
|
61
|
+
/**
|
|
62
|
+
* A ref for imperative actions.
|
|
63
|
+
* It currently only supports `focusVisible()` action.
|
|
64
|
+
*/
|
|
65
|
+
action: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
66
|
+
current: PropTypes.shape({
|
|
67
|
+
focusVisible: PropTypes.func.isRequired
|
|
68
|
+
})
|
|
69
|
+
})]),
|
|
70
|
+
/**
|
|
71
|
+
* If `true`, the ripples are centered.
|
|
72
|
+
* They won't start at the cursor interaction position.
|
|
73
|
+
* @default false
|
|
74
|
+
*/
|
|
75
|
+
centerRipple: PropTypes.bool,
|
|
76
|
+
/**
|
|
77
|
+
* Override or extend the styles applied to the component.
|
|
78
|
+
*/
|
|
79
|
+
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
80
|
+
/**
|
|
81
|
+
* The color of the component.
|
|
82
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
83
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
84
|
+
* @default 'primary'
|
|
85
|
+
*/
|
|
86
|
+
color: PropTypes.oneOf(['error', 'info', 'inherit', 'primary', 'secondary', 'success', 'warning']),
|
|
87
|
+
component: PropTypes.elementType,
|
|
88
|
+
/**
|
|
89
|
+
* If `true`, the component is disabled.
|
|
90
|
+
*/
|
|
91
|
+
disabled: PropTypes.bool,
|
|
92
|
+
/**
|
|
93
|
+
* If `true`, no elevation is used.
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
disableElevation: PropTypes.bool,
|
|
97
|
+
/**
|
|
98
|
+
* If `true`, the keyboard focus ripple is disabled.
|
|
99
|
+
* @default false
|
|
100
|
+
*/
|
|
101
|
+
disableFocusRipple: PropTypes.bool,
|
|
102
|
+
/**
|
|
103
|
+
* If `true`, the ripple effect is disabled.
|
|
104
|
+
*
|
|
105
|
+
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
|
|
106
|
+
* to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
disableRipple: PropTypes.bool,
|
|
110
|
+
/**
|
|
111
|
+
* If `true`, the touch ripple effect is disabled.
|
|
112
|
+
* @default false
|
|
113
|
+
*/
|
|
114
|
+
disableTouchRipple: PropTypes.bool,
|
|
115
|
+
/**
|
|
116
|
+
* Element placed after the children.
|
|
117
|
+
*/
|
|
118
|
+
endIcon: PropTypes.node,
|
|
119
|
+
/**
|
|
120
|
+
* If `true`, the base button will have a keyboard focus ripple.
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
focusRipple: PropTypes.bool,
|
|
124
|
+
/**
|
|
125
|
+
* This prop can help identify which element has keyboard focus.
|
|
126
|
+
* The class name will be applied when the element gains the focus through keyboard interaction.
|
|
127
|
+
* It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
|
|
128
|
+
* The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
|
|
129
|
+
* A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
|
|
130
|
+
* if needed.
|
|
131
|
+
*/
|
|
132
|
+
focusVisibleClassName: PropTypes.string,
|
|
133
|
+
/**
|
|
134
|
+
* If `true`, the button will take up the full width of its container.
|
|
135
|
+
* @default false
|
|
136
|
+
*/
|
|
137
|
+
fullWidth: PropTypes.bool,
|
|
138
|
+
/**
|
|
139
|
+
* The URL to link to when the button is clicked.
|
|
140
|
+
* If defined, an `a` element will be used as the root node.
|
|
141
|
+
*/
|
|
142
|
+
href: PropTypes.string,
|
|
143
|
+
/**
|
|
144
|
+
* The component used to render a link when the `href` prop is provided.
|
|
145
|
+
* @default 'a'
|
|
146
|
+
*/
|
|
147
|
+
LinkComponent: PropTypes.elementType,
|
|
148
|
+
/**
|
|
149
|
+
* If `true`, the loading indicator is visible and the button is disabled.
|
|
150
|
+
* If `true | false`, the loading wrapper is always rendered before the children to prevent [Google Translation Crash](https://github.com/mui/material-ui/issues/27853).
|
|
151
|
+
* @default null
|
|
152
|
+
*/
|
|
153
|
+
loading: PropTypes.bool,
|
|
154
|
+
/**
|
|
155
|
+
* Element placed before the children if the button is in loading state.
|
|
156
|
+
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
157
|
+
* By default, it renders a `CircularProgress` that is labeled by the button itself.
|
|
158
|
+
* @default <CircularProgress color="inherit" size={16} />
|
|
159
|
+
*/
|
|
160
|
+
loadingIndicator: PropTypes.node,
|
|
161
|
+
/**
|
|
162
|
+
* The loading indicator can be positioned on the start, end, or the center of the button.
|
|
163
|
+
* @default 'center'
|
|
164
|
+
*/
|
|
165
|
+
loadingPosition: PropTypes.oneOf(['center', 'end', 'start']),
|
|
166
|
+
/**
|
|
167
|
+
* Callback fired when the component is focused with a keyboard.
|
|
168
|
+
* We trigger a `onFocus` callback too.
|
|
169
|
+
*/
|
|
170
|
+
onFocusVisible: PropTypes.func,
|
|
171
|
+
/**
|
|
172
|
+
* A function to customize rendering of the component.
|
|
173
|
+
*/
|
|
174
|
+
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
175
|
+
/**
|
|
176
|
+
* The size of the component.
|
|
177
|
+
* `small` is equivalent to the dense button styling.
|
|
178
|
+
*/
|
|
179
|
+
size: PropTypes.oneOf(['large', 'medium', 'small']),
|
|
180
|
+
/**
|
|
181
|
+
* Element placed before the children.
|
|
182
|
+
*/
|
|
183
|
+
startIcon: PropTypes.node,
|
|
184
|
+
style: PropTypes.object,
|
|
185
|
+
/**
|
|
186
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
187
|
+
*/
|
|
188
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
189
|
+
tabIndex: PropTypes.number,
|
|
190
|
+
/**
|
|
191
|
+
* Props applied to the `TouchRipple` element.
|
|
192
|
+
*/
|
|
193
|
+
TouchRippleProps: PropTypes.object,
|
|
194
|
+
/**
|
|
195
|
+
* A ref that points to the `TouchRipple` element.
|
|
196
|
+
*/
|
|
197
|
+
touchRippleRef: PropTypes.any,
|
|
198
|
+
/**
|
|
199
|
+
* The variant to use.
|
|
200
|
+
* @default 'text'
|
|
201
|
+
*/
|
|
202
|
+
variant: PropTypes.oneOf(['contained', 'outlined', 'text'])
|
|
203
|
+
} : void 0;
|
|
204
|
+
export { QuickFilterTrigger };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { TooltipProps } from '@mui/material/Tooltip';
|
|
2
|
+
import type { GridSlotProps } from '../../models/gridSlotsComponentsProps';
|
|
4
3
|
interface GridToolbarColumnsButtonProps {
|
|
5
4
|
/**
|
|
6
5
|
* The props used for each slot inside.
|
|
7
6
|
* @default {}
|
|
8
7
|
*/
|
|
9
8
|
slotProps?: {
|
|
10
|
-
button?: Partial<
|
|
11
|
-
tooltip?: Partial<
|
|
9
|
+
button?: Partial<GridSlotProps['baseButton']>;
|
|
10
|
+
tooltip?: Partial<GridSlotProps['baseTooltip']>;
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
13
|
declare const GridToolbarColumnsButton: React.ForwardRefExoticComponent<GridToolbarColumnsButtonProps> | React.ForwardRefExoticComponent<GridToolbarColumnsButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { TooltipProps } from '@mui/material/Tooltip';
|
|
2
|
+
import type { GridSlotProps } from '../../models/gridSlotsComponentsProps';
|
|
4
3
|
interface GridToolbarDensitySelectorProps {
|
|
5
4
|
/**
|
|
6
5
|
* The props used for each slot inside.
|
|
7
6
|
* @default {}
|
|
8
7
|
*/
|
|
9
8
|
slotProps?: {
|
|
10
|
-
button?: Partial<
|
|
11
|
-
tooltip?: Partial<
|
|
9
|
+
button?: Partial<GridSlotProps['baseButton']>;
|
|
10
|
+
tooltip?: Partial<GridSlotProps['baseTooltip']>;
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
13
|
declare const GridToolbarDensitySelector: React.ForwardRefExoticComponent<GridToolbarDensitySelectorProps> | React.ForwardRefExoticComponent<GridToolbarDensitySelectorProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { TooltipProps } from '@mui/material/Tooltip';
|
|
2
|
+
import type { GridSlotProps } from '../../models/gridSlotsComponentsProps';
|
|
4
3
|
import { GridCsvExportOptions, GridPrintExportOptions } from "../../models/gridExport.js";
|
|
5
4
|
export interface GridExportDisplayOptions {
|
|
6
5
|
/**
|
|
@@ -23,8 +22,8 @@ export interface GridToolbarExportProps {
|
|
|
23
22
|
* @default {}
|
|
24
23
|
*/
|
|
25
24
|
slotProps?: {
|
|
26
|
-
button?: Partial<
|
|
27
|
-
tooltip?: Partial<
|
|
25
|
+
button?: Partial<GridSlotProps['baseButton']>;
|
|
26
|
+
tooltip?: Partial<GridSlotProps['baseTooltip']>;
|
|
28
27
|
};
|
|
29
28
|
[x: `data-${string}`]: string;
|
|
30
29
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { TooltipProps } from '@mui/material/Tooltip';
|
|
2
|
+
import type { GridSlotProps } from '../../models/gridSlotsComponentsProps';
|
|
4
3
|
interface GridToolbarExportContainerProps {
|
|
5
4
|
/**
|
|
6
5
|
* The props used for each slot inside.
|
|
7
6
|
* @default {}
|
|
8
7
|
*/
|
|
9
8
|
slotProps?: {
|
|
10
|
-
button?: Partial<
|
|
11
|
-
tooltip?: Partial<
|
|
9
|
+
button?: Partial<GridSlotProps['baseButton']>;
|
|
10
|
+
tooltip?: Partial<GridSlotProps['baseTooltip']>;
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
13
|
declare const GridToolbarExportContainer: React.ForwardRefExoticComponent<React.PropsWithChildren<GridToolbarExportContainerProps>> | React.ForwardRefExoticComponent<GridToolbarExportContainerProps & {
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { TooltipProps } from '@mui/material/Tooltip';
|
|
4
|
-
import { BadgeProps } from "../../models/gridBaseSlots.js";
|
|
2
|
+
import type { GridSlotProps } from '../../models/gridSlotsComponentsProps';
|
|
5
3
|
export interface GridToolbarFilterButtonProps {
|
|
6
4
|
/**
|
|
7
5
|
* The props used for each slot inside.
|
|
8
6
|
* @default {}
|
|
9
7
|
*/
|
|
10
8
|
slotProps?: {
|
|
11
|
-
button?: Partial<
|
|
12
|
-
tooltip?: Partial<
|
|
13
|
-
badge?: Partial<
|
|
9
|
+
button?: Partial<GridSlotProps['baseButton']>;
|
|
10
|
+
tooltip?: Partial<GridSlotProps['baseTooltip']>;
|
|
11
|
+
badge?: Partial<GridSlotProps['baseBadge']>;
|
|
14
12
|
};
|
|
15
13
|
}
|
|
16
14
|
declare const GridToolbarFilterButton: React.ForwardRefExoticComponent<GridToolbarFilterButtonProps> | React.ForwardRefExoticComponent<GridToolbarFilterButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
5
|
import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize, unstable_useId as useId } from '@mui/utils';
|
|
6
|
-
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
7
6
|
import useForkRef from '@mui/utils/useForkRef';
|
|
7
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
8
8
|
import { vars } from "../../constants/cssVariables.js";
|
|
9
9
|
import { gridColumnLookupSelector } from "../../hooks/features/columns/gridColumnsSelector.js";
|
|
10
10
|
import { useGridSelector } from "../../hooks/utils/useGridSelector.js";
|
|
@@ -33,9 +33,6 @@ const GridToolbarFilterListRoot = styled('ul', {
|
|
|
33
33
|
margin: vars.spacing(1, 1, 0.5),
|
|
34
34
|
padding: vars.spacing(0, 1)
|
|
35
35
|
});
|
|
36
|
-
|
|
37
|
-
// FIXME(v8:romgrk): override slotProps
|
|
38
|
-
|
|
39
36
|
const GridToolbarFilterButton = forwardRef(function GridToolbarFilterButton(props, ref) {
|
|
40
37
|
const {
|
|
41
38
|
slotProps = {}
|
|
@@ -7,38 +7,71 @@ import PropTypes from 'prop-types';
|
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
8
|
import { styled } from '@mui/system';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
|
-
// import { NotRendered } from '../../utils/assert';
|
|
11
|
-
|
|
12
10
|
import { getDataGridUtilityClass } from "../../constants/index.js";
|
|
13
11
|
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
14
12
|
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
15
|
-
import { QuickFilter, QuickFilterClear, QuickFilterControl } from "../quickFilter/index.js";
|
|
16
|
-
import {
|
|
13
|
+
import { QuickFilter, QuickFilterClear, QuickFilterControl, QuickFilterTrigger } from "../quickFilter/index.js";
|
|
14
|
+
import { ToolbarButton } from "../toolbarV8/index.js";
|
|
15
|
+
import { vars } from "../../constants/cssVariables.js";
|
|
16
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
const useUtilityClasses = ownerState => {
|
|
18
18
|
const {
|
|
19
19
|
classes
|
|
20
20
|
} = ownerState;
|
|
21
21
|
const slots = {
|
|
22
|
-
root: ['toolbarQuickFilter']
|
|
22
|
+
root: ['toolbarQuickFilter'],
|
|
23
|
+
trigger: ['toolbarQuickFilterTrigger'],
|
|
24
|
+
control: ['toolbarQuickFilterControl']
|
|
23
25
|
};
|
|
24
26
|
return composeClasses(slots, getDataGridUtilityClass, classes);
|
|
25
27
|
};
|
|
28
|
+
const GridQuickFilterRoot = styled('div', {
|
|
29
|
+
name: 'MuiDataGrid',
|
|
30
|
+
slot: 'ToolbarQuickFilter'
|
|
31
|
+
})({
|
|
32
|
+
display: 'grid',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
marginLeft: 'auto'
|
|
35
|
+
});
|
|
36
|
+
const GridQuickFilterTrigger = styled(ToolbarButton, {
|
|
37
|
+
name: 'MuiDataGrid',
|
|
38
|
+
slot: 'ToolbarQuickFilterTrigger'
|
|
39
|
+
})(({
|
|
40
|
+
ownerState
|
|
41
|
+
}) => ({
|
|
42
|
+
gridArea: '1 / 1',
|
|
43
|
+
width: 'min-content',
|
|
44
|
+
height: 'min-content',
|
|
45
|
+
zIndex: 1,
|
|
46
|
+
opacity: ownerState.expanded ? 0 : 1,
|
|
47
|
+
pointerEvents: ownerState.expanded ? 'none' : 'auto',
|
|
48
|
+
transition: vars.transition(['opacity'])
|
|
49
|
+
}));
|
|
26
50
|
|
|
27
51
|
// TODO: Use NotRendered from /utils/assert
|
|
28
52
|
// Currently causes react-docgen to fail
|
|
29
|
-
const
|
|
53
|
+
const GridQuickFilterTextField = styled(_props => {
|
|
30
54
|
throw new Error('Failed assertion: should not be rendered');
|
|
31
55
|
}, {
|
|
32
56
|
name: 'MuiDataGrid',
|
|
33
|
-
slot: '
|
|
34
|
-
})({
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
57
|
+
slot: 'ToolbarQuickFilterControl'
|
|
58
|
+
})(({
|
|
59
|
+
ownerState
|
|
60
|
+
}) => ({
|
|
61
|
+
gridArea: '1 / 1',
|
|
62
|
+
overflowX: 'clip',
|
|
63
|
+
width: ownerState.expanded ? 260 : 'var(--trigger-width)',
|
|
64
|
+
opacity: ownerState.expanded ? 1 : 0,
|
|
65
|
+
transition: vars.transition(['width', 'opacity'])
|
|
66
|
+
}));
|
|
38
67
|
function GridToolbarQuickFilter(props) {
|
|
39
68
|
const apiRef = useGridApiContext();
|
|
40
69
|
const rootProps = useGridRootProps();
|
|
41
|
-
const
|
|
70
|
+
const ownerState = {
|
|
71
|
+
classes: rootProps.classes,
|
|
72
|
+
expanded: false
|
|
73
|
+
};
|
|
74
|
+
const classes = useUtilityClasses(ownerState);
|
|
42
75
|
const {
|
|
43
76
|
quickFilterParser,
|
|
44
77
|
quickFilterFormatter,
|
|
@@ -51,40 +84,65 @@ function GridToolbarQuickFilter(props) {
|
|
|
51
84
|
parser: quickFilterParser,
|
|
52
85
|
formatter: quickFilterFormatter,
|
|
53
86
|
debounceMs: debounceMs,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
87
|
+
render: (quickFilterProps, state) => {
|
|
88
|
+
const currentOwnerState = _extends({}, ownerState, {
|
|
89
|
+
expanded: state.expanded
|
|
90
|
+
});
|
|
91
|
+
return /*#__PURE__*/_jsxs(GridQuickFilterRoot, _extends({}, quickFilterProps, {
|
|
92
|
+
className: clsx(classes.root, className),
|
|
93
|
+
children: [/*#__PURE__*/_jsx(QuickFilterTrigger, {
|
|
94
|
+
render: triggerProps => /*#__PURE__*/_jsx(rootProps.slots.baseTooltip, {
|
|
95
|
+
title: apiRef.current.getLocaleText('toolbarQuickFilterLabel'),
|
|
96
|
+
enterDelay: 0 // Prevents tooltip lagging behind transitioning trigger element
|
|
97
|
+
,
|
|
98
|
+
children: /*#__PURE__*/_jsx(GridQuickFilterTrigger, _extends({
|
|
99
|
+
className: classes.trigger
|
|
100
|
+
}, triggerProps, {
|
|
101
|
+
ownerState: currentOwnerState,
|
|
102
|
+
color: "default",
|
|
103
|
+
"aria-disabled": state.expanded,
|
|
104
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterIcon, {
|
|
71
105
|
fontSize: "small"
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
106
|
+
})
|
|
107
|
+
}))
|
|
108
|
+
})
|
|
109
|
+
}), /*#__PURE__*/_jsx(QuickFilterControl, {
|
|
110
|
+
render: _ref => {
|
|
111
|
+
let {
|
|
112
|
+
ref,
|
|
113
|
+
slotProps: controlSlotProps
|
|
114
|
+
} = _ref,
|
|
115
|
+
controlProps = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
116
|
+
return /*#__PURE__*/_jsx(GridQuickFilterTextField, _extends({
|
|
117
|
+
as: rootProps.slots.baseTextField,
|
|
118
|
+
className: classes.control,
|
|
119
|
+
ownerState: currentOwnerState,
|
|
120
|
+
inputRef: ref,
|
|
121
|
+
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterLabel'),
|
|
122
|
+
placeholder: apiRef.current.getLocaleText('toolbarQuickFilterPlaceholder'),
|
|
123
|
+
size: "small",
|
|
124
|
+
slotProps: _extends({
|
|
125
|
+
input: _extends({
|
|
126
|
+
startAdornment: /*#__PURE__*/_jsx(rootProps.slots.quickFilterIcon, {
|
|
79
127
|
fontSize: "small"
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
128
|
+
}),
|
|
129
|
+
endAdornment: controlProps.value ? /*#__PURE__*/_jsx(QuickFilterClear, {
|
|
130
|
+
render: /*#__PURE__*/_jsx(rootProps.slots.baseIconButton, {
|
|
131
|
+
size: "small",
|
|
132
|
+
edge: "end",
|
|
133
|
+
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterDeleteIconLabel'),
|
|
134
|
+
children: /*#__PURE__*/_jsx(rootProps.slots.quickFilterClearIcon, {
|
|
135
|
+
fontSize: "small"
|
|
136
|
+
})
|
|
137
|
+
})
|
|
138
|
+
}) : null
|
|
139
|
+
}, controlSlotProps?.input)
|
|
140
|
+
}, controlSlotProps)
|
|
141
|
+
}, rootProps.slotProps?.baseTextField, controlProps, slotProps?.root, other));
|
|
142
|
+
}
|
|
143
|
+
})]
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
88
146
|
});
|
|
89
147
|
}
|
|
90
148
|
process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
|
|
@@ -1,9 +1,9 @@
|
|
|
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 Menu from '@mui/material/Menu';
|
|
5
4
|
import useId from '@mui/utils/useId';
|
|
6
5
|
import { styled } from '@mui/system';
|
|
6
|
+
import { GridMenu } from "../menu/GridMenu.js";
|
|
7
7
|
import { Toolbar } from "./Toolbar.js";
|
|
8
8
|
import { ToolbarButton } from "./ToolbarButton.js";
|
|
9
9
|
import { FilterPanelTrigger } from "../filterPanel/index.js";
|
|
@@ -74,30 +74,33 @@ function GridToolbar(props) {
|
|
|
74
74
|
"aria-controls": exportMenuId,
|
|
75
75
|
"aria-haspopup": "true",
|
|
76
76
|
"aria-expanded": exportMenuOpen ? 'true' : undefined,
|
|
77
|
-
onClick: () => setExportMenuOpen(
|
|
77
|
+
onClick: () => setExportMenuOpen(!exportMenuOpen),
|
|
78
78
|
children: /*#__PURE__*/_jsx(rootProps.slots.exportIcon, {
|
|
79
79
|
fontSize: "small"
|
|
80
80
|
})
|
|
81
81
|
})
|
|
82
|
-
}), /*#__PURE__*/
|
|
83
|
-
|
|
84
|
-
anchorEl: exportMenuTriggerRef.current,
|
|
82
|
+
}), /*#__PURE__*/_jsx(GridMenu, {
|
|
83
|
+
target: exportMenuTriggerRef.current,
|
|
85
84
|
open: exportMenuOpen,
|
|
86
85
|
onClose: closeExportMenu,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
86
|
+
position: "bottom-start",
|
|
87
|
+
children: /*#__PURE__*/_jsxs(rootProps.slots.baseMenuList, _extends({
|
|
88
|
+
id: exportMenuId,
|
|
89
|
+
"aria-labelledby": exportMenuTriggerId,
|
|
90
|
+
autoFocusItem: true
|
|
91
|
+
}, rootProps.slotProps?.baseMenuList, {
|
|
92
|
+
children: [!printOptions?.disableToolbarButton && /*#__PURE__*/_jsx(ExportPrint, {
|
|
93
|
+
render: /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({}, rootProps.slotProps?.baseMenuItem)),
|
|
94
|
+
options: printOptions,
|
|
95
|
+
onClick: closeExportMenu,
|
|
96
|
+
children: apiRef.current.getLocaleText('toolbarExportPrint')
|
|
97
|
+
}), !csvOptions?.disableToolbarButton && /*#__PURE__*/_jsx(ExportCsv, {
|
|
98
|
+
render: /*#__PURE__*/_jsx(rootProps.slots.baseMenuItem, _extends({}, rootProps.slotProps?.baseMenuItem)),
|
|
99
|
+
options: csvOptions,
|
|
100
|
+
onClick: closeExportMenu,
|
|
101
|
+
children: apiRef.current.getLocaleText('toolbarExportCSV')
|
|
102
|
+
}), additionalExportMenuItems?.(closeExportMenu)]
|
|
103
|
+
}))
|
|
101
104
|
})]
|
|
102
105
|
}), showQuickFilter && /*#__PURE__*/_jsx(GridToolbarQuickFilter, _extends({}, quickFilterProps))]
|
|
103
106
|
});
|
|
@@ -8,7 +8,7 @@ export type ToolbarProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
8
8
|
render?: RenderProp<React.ComponentProps<typeof ToolbarRoot>>;
|
|
9
9
|
};
|
|
10
10
|
type OwnerState = DataGridProcessedProps;
|
|
11
|
-
declare const ToolbarRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/
|
|
11
|
+
declare const ToolbarRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme> & {
|
|
12
12
|
ownerState: OwnerState;
|
|
13
13
|
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
14
14
|
/**
|