@mui/x-data-grid 8.0.0-beta.1 → 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 +94 -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/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/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/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/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/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/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/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/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/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
|
@@ -16,7 +16,7 @@ var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
|
16
16
|
var _useGridComponentRenderer = require("../../hooks/utils/useGridComponentRenderer");
|
|
17
17
|
var _QuickFilterContext = require("./QuickFilterContext");
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["render", "className"];
|
|
19
|
+
const _excluded = ["render", "className", "slotProps", "onKeyDown", "onChange"];
|
|
20
20
|
/**
|
|
21
21
|
* A component that takes user input and filters row data.
|
|
22
22
|
* It renders the `baseTextField` slot.
|
|
@@ -32,35 +32,61 @@ const _excluded = ["render", "className"];
|
|
|
32
32
|
const QuickFilterControl = exports.QuickFilterControl = (0, _forwardRef.forwardRef)(function QuickFilterControl(props, ref) {
|
|
33
33
|
const {
|
|
34
34
|
render,
|
|
35
|
-
className
|
|
35
|
+
className,
|
|
36
|
+
slotProps,
|
|
37
|
+
onKeyDown,
|
|
38
|
+
onChange
|
|
36
39
|
} = props,
|
|
37
40
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
38
41
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
39
42
|
const {
|
|
40
43
|
state,
|
|
44
|
+
controlId,
|
|
41
45
|
controlRef,
|
|
42
46
|
onValueChange,
|
|
47
|
+
onExpandedChange,
|
|
43
48
|
clearValue
|
|
44
49
|
} = (0, _QuickFilterContext.useQuickFilterContext)();
|
|
45
50
|
const resolvedClassName = typeof className === 'function' ? className(state) : className;
|
|
46
51
|
const handleRef = (0, _utils.unstable_useForkRef)(controlRef, ref);
|
|
47
52
|
const handleKeyDown = event => {
|
|
48
53
|
if (event.key === 'Escape') {
|
|
49
|
-
|
|
54
|
+
if (state.value === '') {
|
|
55
|
+
onExpandedChange(false);
|
|
56
|
+
} else {
|
|
57
|
+
clearValue();
|
|
58
|
+
}
|
|
50
59
|
}
|
|
51
|
-
|
|
60
|
+
onKeyDown?.(event);
|
|
61
|
+
};
|
|
62
|
+
const handleBlur = event => {
|
|
63
|
+
if (state.value === '') {
|
|
64
|
+
onExpandedChange(false);
|
|
65
|
+
}
|
|
66
|
+
slotProps?.htmlInput?.onBlur?.(event);
|
|
67
|
+
};
|
|
68
|
+
const handleChange = event => {
|
|
69
|
+
if (!state.expanded) {
|
|
70
|
+
onExpandedChange(true);
|
|
71
|
+
}
|
|
72
|
+
onValueChange(event);
|
|
73
|
+
onChange?.(event);
|
|
52
74
|
};
|
|
53
75
|
const element = (0, _useGridComponentRenderer.useGridComponentRenderer)(rootProps.slots.baseTextField, render, (0, _extends2.default)({}, rootProps.slotProps?.baseTextField, {
|
|
54
76
|
slotProps: (0, _extends2.default)({
|
|
55
77
|
htmlInput: (0, _extends2.default)({
|
|
56
|
-
role: 'searchbox'
|
|
57
|
-
|
|
58
|
-
|
|
78
|
+
role: 'searchbox',
|
|
79
|
+
id: controlId,
|
|
80
|
+
tabIndex: state.expanded ? undefined : -1
|
|
81
|
+
}, slotProps?.htmlInput, {
|
|
82
|
+
onBlur: handleBlur
|
|
83
|
+
})
|
|
84
|
+
}, slotProps),
|
|
59
85
|
value: state.value,
|
|
60
|
-
className: resolvedClassName
|
|
61
|
-
onChange: onValueChange,
|
|
62
|
-
onKeyDown: handleKeyDown
|
|
86
|
+
className: resolvedClassName
|
|
63
87
|
}, other, {
|
|
88
|
+
onChange: handleChange,
|
|
89
|
+
onKeyDown: handleKeyDown,
|
|
64
90
|
ref: handleRef
|
|
65
91
|
}), state);
|
|
66
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RenderProp } from "../../hooks/utils/useGridComponentRenderer.js";
|
|
3
|
+
import type { GridSlotProps } from '../../models';
|
|
4
|
+
import { QuickFilterState } from "./QuickFilterContext.js";
|
|
5
|
+
export type QuickFilterTriggerProps = Omit<GridSlotProps['baseButton'], 'className'> & {
|
|
6
|
+
/**
|
|
7
|
+
* A function to customize rendering of the component.
|
|
8
|
+
*/
|
|
9
|
+
render?: RenderProp<GridSlotProps['baseButton'], QuickFilterState>;
|
|
10
|
+
/**
|
|
11
|
+
* Override or extend the styles applied to the component.
|
|
12
|
+
*/
|
|
13
|
+
className?: string | ((state: QuickFilterState) => string);
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A button that expands/collapses the quick filter.
|
|
17
|
+
* It renders the `baseButton` slot.
|
|
18
|
+
*
|
|
19
|
+
* Demos:
|
|
20
|
+
*
|
|
21
|
+
* - [Quick Filter](https://mui.com/x/react-data-grid/components/quick-filter/)
|
|
22
|
+
*
|
|
23
|
+
* API:
|
|
24
|
+
*
|
|
25
|
+
* - [QuickFilterTrigger API](https://mui.com/x/api/data-grid/quick-filter-trigger/)
|
|
26
|
+
*/
|
|
27
|
+
declare const QuickFilterTrigger: React.ForwardRefExoticComponent<QuickFilterTriggerProps> | React.ForwardRefExoticComponent<Omit<QuickFilterTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
28
|
+
export { QuickFilterTrigger };
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.QuickFilterTrigger = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
14
|
+
var _utils = require("@mui/utils");
|
|
15
|
+
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
16
|
+
var _useGridComponentRenderer = require("../../hooks/utils/useGridComponentRenderer");
|
|
17
|
+
var _QuickFilterContext = require("./QuickFilterContext");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["render", "className", "onClick"];
|
|
20
|
+
/**
|
|
21
|
+
* A button that expands/collapses the quick filter.
|
|
22
|
+
* It renders the `baseButton` slot.
|
|
23
|
+
*
|
|
24
|
+
* Demos:
|
|
25
|
+
*
|
|
26
|
+
* - [Quick Filter](https://mui.com/x/react-data-grid/components/quick-filter/)
|
|
27
|
+
*
|
|
28
|
+
* API:
|
|
29
|
+
*
|
|
30
|
+
* - [QuickFilterTrigger API](https://mui.com/x/api/data-grid/quick-filter-trigger/)
|
|
31
|
+
*/
|
|
32
|
+
const QuickFilterTrigger = exports.QuickFilterTrigger = (0, _forwardRef.forwardRef)(function QuickFilterTrigger(props, ref) {
|
|
33
|
+
const {
|
|
34
|
+
render,
|
|
35
|
+
className,
|
|
36
|
+
onClick
|
|
37
|
+
} = props,
|
|
38
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
39
|
+
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
40
|
+
const {
|
|
41
|
+
state,
|
|
42
|
+
controlId,
|
|
43
|
+
onExpandedChange,
|
|
44
|
+
triggerRef
|
|
45
|
+
} = (0, _QuickFilterContext.useQuickFilterContext)();
|
|
46
|
+
const resolvedClassName = typeof className === 'function' ? className(state) : className;
|
|
47
|
+
const handleRef = (0, _utils.unstable_useForkRef)(triggerRef, ref);
|
|
48
|
+
const handleClick = event => {
|
|
49
|
+
onExpandedChange(!state.expanded);
|
|
50
|
+
onClick?.(event);
|
|
51
|
+
};
|
|
52
|
+
const element = (0, _useGridComponentRenderer.useGridComponentRenderer)(rootProps.slots.baseButton, render, (0, _extends2.default)({}, rootProps.slotProps?.baseButton, {
|
|
53
|
+
className: resolvedClassName,
|
|
54
|
+
'aria-controls': controlId,
|
|
55
|
+
'aria-expanded': state.expanded
|
|
56
|
+
}, other, {
|
|
57
|
+
onClick: handleClick,
|
|
58
|
+
ref: handleRef
|
|
59
|
+
}), state);
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
61
|
+
children: element
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
process.env.NODE_ENV !== "production" ? QuickFilterTrigger.propTypes = {
|
|
65
|
+
// ----------------------------- Warning --------------------------------
|
|
66
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
67
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
68
|
+
// ----------------------------------------------------------------------
|
|
69
|
+
/**
|
|
70
|
+
* A ref for imperative actions.
|
|
71
|
+
* It currently only supports `focusVisible()` action.
|
|
72
|
+
*/
|
|
73
|
+
action: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
74
|
+
current: _propTypes.default.shape({
|
|
75
|
+
focusVisible: _propTypes.default.func.isRequired
|
|
76
|
+
})
|
|
77
|
+
})]),
|
|
78
|
+
/**
|
|
79
|
+
* If `true`, the ripples are centered.
|
|
80
|
+
* They won't start at the cursor interaction position.
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
centerRipple: _propTypes.default.bool,
|
|
84
|
+
/**
|
|
85
|
+
* Override or extend the styles applied to the component.
|
|
86
|
+
*/
|
|
87
|
+
className: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
|
|
88
|
+
/**
|
|
89
|
+
* The color of the component.
|
|
90
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
91
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
92
|
+
* @default 'primary'
|
|
93
|
+
*/
|
|
94
|
+
color: _propTypes.default.oneOf(['error', 'info', 'inherit', 'primary', 'secondary', 'success', 'warning']),
|
|
95
|
+
component: _propTypes.default.elementType,
|
|
96
|
+
/**
|
|
97
|
+
* If `true`, the component is disabled.
|
|
98
|
+
*/
|
|
99
|
+
disabled: _propTypes.default.bool,
|
|
100
|
+
/**
|
|
101
|
+
* If `true`, no elevation is used.
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
disableElevation: _propTypes.default.bool,
|
|
105
|
+
/**
|
|
106
|
+
* If `true`, the keyboard focus ripple is disabled.
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
disableFocusRipple: _propTypes.default.bool,
|
|
110
|
+
/**
|
|
111
|
+
* If `true`, the ripple effect is disabled.
|
|
112
|
+
*
|
|
113
|
+
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
|
|
114
|
+
* to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
disableRipple: _propTypes.default.bool,
|
|
118
|
+
/**
|
|
119
|
+
* If `true`, the touch ripple effect is disabled.
|
|
120
|
+
* @default false
|
|
121
|
+
*/
|
|
122
|
+
disableTouchRipple: _propTypes.default.bool,
|
|
123
|
+
/**
|
|
124
|
+
* Element placed after the children.
|
|
125
|
+
*/
|
|
126
|
+
endIcon: _propTypes.default.node,
|
|
127
|
+
/**
|
|
128
|
+
* If `true`, the base button will have a keyboard focus ripple.
|
|
129
|
+
* @default false
|
|
130
|
+
*/
|
|
131
|
+
focusRipple: _propTypes.default.bool,
|
|
132
|
+
/**
|
|
133
|
+
* This prop can help identify which element has keyboard focus.
|
|
134
|
+
* The class name will be applied when the element gains the focus through keyboard interaction.
|
|
135
|
+
* It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
|
|
136
|
+
* The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
|
|
137
|
+
* A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
|
|
138
|
+
* if needed.
|
|
139
|
+
*/
|
|
140
|
+
focusVisibleClassName: _propTypes.default.string,
|
|
141
|
+
/**
|
|
142
|
+
* If `true`, the button will take up the full width of its container.
|
|
143
|
+
* @default false
|
|
144
|
+
*/
|
|
145
|
+
fullWidth: _propTypes.default.bool,
|
|
146
|
+
/**
|
|
147
|
+
* The URL to link to when the button is clicked.
|
|
148
|
+
* If defined, an `a` element will be used as the root node.
|
|
149
|
+
*/
|
|
150
|
+
href: _propTypes.default.string,
|
|
151
|
+
/**
|
|
152
|
+
* The component used to render a link when the `href` prop is provided.
|
|
153
|
+
* @default 'a'
|
|
154
|
+
*/
|
|
155
|
+
LinkComponent: _propTypes.default.elementType,
|
|
156
|
+
/**
|
|
157
|
+
* If `true`, the loading indicator is visible and the button is disabled.
|
|
158
|
+
* 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).
|
|
159
|
+
* @default null
|
|
160
|
+
*/
|
|
161
|
+
loading: _propTypes.default.bool,
|
|
162
|
+
/**
|
|
163
|
+
* Element placed before the children if the button is in loading state.
|
|
164
|
+
* The node should contain an element with `role="progressbar"` with an accessible name.
|
|
165
|
+
* By default, it renders a `CircularProgress` that is labeled by the button itself.
|
|
166
|
+
* @default <CircularProgress color="inherit" size={16} />
|
|
167
|
+
*/
|
|
168
|
+
loadingIndicator: _propTypes.default.node,
|
|
169
|
+
/**
|
|
170
|
+
* The loading indicator can be positioned on the start, end, or the center of the button.
|
|
171
|
+
* @default 'center'
|
|
172
|
+
*/
|
|
173
|
+
loadingPosition: _propTypes.default.oneOf(['center', 'end', 'start']),
|
|
174
|
+
/**
|
|
175
|
+
* Callback fired when the component is focused with a keyboard.
|
|
176
|
+
* We trigger a `onFocus` callback too.
|
|
177
|
+
*/
|
|
178
|
+
onFocusVisible: _propTypes.default.func,
|
|
179
|
+
/**
|
|
180
|
+
* A function to customize rendering of the component.
|
|
181
|
+
*/
|
|
182
|
+
render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
183
|
+
/**
|
|
184
|
+
* The size of the component.
|
|
185
|
+
* `small` is equivalent to the dense button styling.
|
|
186
|
+
*/
|
|
187
|
+
size: _propTypes.default.oneOf(['large', 'medium', 'small']),
|
|
188
|
+
/**
|
|
189
|
+
* Element placed before the children.
|
|
190
|
+
*/
|
|
191
|
+
startIcon: _propTypes.default.node,
|
|
192
|
+
style: _propTypes.default.object,
|
|
193
|
+
/**
|
|
194
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
195
|
+
*/
|
|
196
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
197
|
+
tabIndex: _propTypes.default.number,
|
|
198
|
+
/**
|
|
199
|
+
* Props applied to the `TouchRipple` element.
|
|
200
|
+
*/
|
|
201
|
+
TouchRippleProps: _propTypes.default.object,
|
|
202
|
+
/**
|
|
203
|
+
* A ref that points to the `TouchRipple` element.
|
|
204
|
+
*/
|
|
205
|
+
touchRippleRef: _propTypes.default.any,
|
|
206
|
+
/**
|
|
207
|
+
* The variant to use.
|
|
208
|
+
* @default 'text'
|
|
209
|
+
*/
|
|
210
|
+
variant: _propTypes.default.oneOf(['contained', 'outlined', 'text'])
|
|
211
|
+
} : void 0;
|
|
@@ -35,4 +35,15 @@ Object.keys(_QuickFilterClear).forEach(function (key) {
|
|
|
35
35
|
return _QuickFilterClear[key];
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
+
});
|
|
39
|
+
var _QuickFilterTrigger = require("./QuickFilterTrigger");
|
|
40
|
+
Object.keys(_QuickFilterTrigger).forEach(function (key) {
|
|
41
|
+
if (key === "default" || key === "__esModule") return;
|
|
42
|
+
if (key in exports && exports[key] === _QuickFilterTrigger[key]) return;
|
|
43
|
+
Object.defineProperty(exports, key, {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return _QuickFilterTrigger[key];
|
|
47
|
+
}
|
|
48
|
+
});
|
|
38
49
|
});
|
|
@@ -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>>;
|
|
@@ -11,8 +11,8 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _styles = require("@mui/material/styles");
|
|
13
13
|
var _utils = require("@mui/utils");
|
|
14
|
-
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
15
14
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
15
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
16
16
|
var _cssVariables = require("../../constants/cssVariables");
|
|
17
17
|
var _gridColumnsSelector = require("../../hooks/features/columns/gridColumnsSelector");
|
|
18
18
|
var _useGridSelector = require("../../hooks/utils/useGridSelector");
|
|
@@ -41,9 +41,6 @@ const GridToolbarFilterListRoot = (0, _styles.styled)('ul', {
|
|
|
41
41
|
margin: _cssVariables.vars.spacing(1, 1, 0.5),
|
|
42
42
|
padding: _cssVariables.vars.spacing(0, 1)
|
|
43
43
|
});
|
|
44
|
-
|
|
45
|
-
// FIXME(v8:romgrk): override slotProps
|
|
46
|
-
|
|
47
44
|
const GridToolbarFilterButton = exports.GridToolbarFilterButton = (0, _forwardRef.forwardRef)(function GridToolbarFilterButton(props, ref) {
|
|
48
45
|
const {
|
|
49
46
|
slotProps = {}
|
|
@@ -17,34 +17,69 @@ var _constants = require("../../constants");
|
|
|
17
17
|
var _useGridApiContext = require("../../hooks/utils/useGridApiContext");
|
|
18
18
|
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
19
19
|
var _quickFilter = require("../quickFilter");
|
|
20
|
+
var _toolbarV = require("../toolbarV8");
|
|
21
|
+
var _cssVariables = require("../../constants/cssVariables");
|
|
20
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
23
|
const _excluded = ["quickFilterParser", "quickFilterFormatter", "debounceMs", "className", "slotProps"],
|
|
22
|
-
_excluded2 = ["ref", "slotProps"];
|
|
24
|
+
_excluded2 = ["ref", "slotProps"];
|
|
23
25
|
const useUtilityClasses = ownerState => {
|
|
24
26
|
const {
|
|
25
27
|
classes
|
|
26
28
|
} = ownerState;
|
|
27
29
|
const slots = {
|
|
28
|
-
root: ['toolbarQuickFilter']
|
|
30
|
+
root: ['toolbarQuickFilter'],
|
|
31
|
+
trigger: ['toolbarQuickFilterTrigger'],
|
|
32
|
+
control: ['toolbarQuickFilterControl']
|
|
29
33
|
};
|
|
30
34
|
return (0, _composeClasses.default)(slots, _constants.getDataGridUtilityClass, classes);
|
|
31
35
|
};
|
|
36
|
+
const GridQuickFilterRoot = (0, _system.styled)('div', {
|
|
37
|
+
name: 'MuiDataGrid',
|
|
38
|
+
slot: 'ToolbarQuickFilter'
|
|
39
|
+
})({
|
|
40
|
+
display: 'grid',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
marginLeft: 'auto'
|
|
43
|
+
});
|
|
44
|
+
const GridQuickFilterTrigger = (0, _system.styled)(_toolbarV.ToolbarButton, {
|
|
45
|
+
name: 'MuiDataGrid',
|
|
46
|
+
slot: 'ToolbarQuickFilterTrigger'
|
|
47
|
+
})(({
|
|
48
|
+
ownerState
|
|
49
|
+
}) => ({
|
|
50
|
+
gridArea: '1 / 1',
|
|
51
|
+
width: 'min-content',
|
|
52
|
+
height: 'min-content',
|
|
53
|
+
zIndex: 1,
|
|
54
|
+
opacity: ownerState.expanded ? 0 : 1,
|
|
55
|
+
pointerEvents: ownerState.expanded ? 'none' : 'auto',
|
|
56
|
+
transition: _cssVariables.vars.transition(['opacity'])
|
|
57
|
+
}));
|
|
32
58
|
|
|
33
59
|
// TODO: Use NotRendered from /utils/assert
|
|
34
60
|
// Currently causes react-docgen to fail
|
|
35
|
-
const
|
|
61
|
+
const GridQuickFilterTextField = (0, _system.styled)(_props => {
|
|
36
62
|
throw new Error('Failed assertion: should not be rendered');
|
|
37
63
|
}, {
|
|
38
64
|
name: 'MuiDataGrid',
|
|
39
|
-
slot: '
|
|
40
|
-
})({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
65
|
+
slot: 'ToolbarQuickFilterControl'
|
|
66
|
+
})(({
|
|
67
|
+
ownerState
|
|
68
|
+
}) => ({
|
|
69
|
+
gridArea: '1 / 1',
|
|
70
|
+
overflowX: 'clip',
|
|
71
|
+
width: ownerState.expanded ? 260 : 'var(--trigger-width)',
|
|
72
|
+
opacity: ownerState.expanded ? 1 : 0,
|
|
73
|
+
transition: _cssVariables.vars.transition(['width', 'opacity'])
|
|
74
|
+
}));
|
|
44
75
|
function GridToolbarQuickFilter(props) {
|
|
45
76
|
const apiRef = (0, _useGridApiContext.useGridApiContext)();
|
|
46
77
|
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
47
|
-
const
|
|
78
|
+
const ownerState = {
|
|
79
|
+
classes: rootProps.classes,
|
|
80
|
+
expanded: false
|
|
81
|
+
};
|
|
82
|
+
const classes = useUtilityClasses(ownerState);
|
|
48
83
|
const {
|
|
49
84
|
quickFilterParser,
|
|
50
85
|
quickFilterFormatter,
|
|
@@ -57,40 +92,65 @@ function GridToolbarQuickFilter(props) {
|
|
|
57
92
|
parser: quickFilterParser,
|
|
58
93
|
formatter: quickFilterFormatter,
|
|
59
94
|
debounceMs: debounceMs,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
95
|
+
render: (quickFilterProps, state) => {
|
|
96
|
+
const currentOwnerState = (0, _extends2.default)({}, ownerState, {
|
|
97
|
+
expanded: state.expanded
|
|
98
|
+
});
|
|
99
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(GridQuickFilterRoot, (0, _extends2.default)({}, quickFilterProps, {
|
|
100
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
101
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_quickFilter.QuickFilterTrigger, {
|
|
102
|
+
render: triggerProps => /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseTooltip, {
|
|
103
|
+
title: apiRef.current.getLocaleText('toolbarQuickFilterLabel'),
|
|
104
|
+
enterDelay: 0 // Prevents tooltip lagging behind transitioning trigger element
|
|
105
|
+
,
|
|
106
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(GridQuickFilterTrigger, (0, _extends2.default)({
|
|
107
|
+
className: classes.trigger
|
|
108
|
+
}, triggerProps, {
|
|
109
|
+
ownerState: currentOwnerState,
|
|
110
|
+
color: "default",
|
|
111
|
+
"aria-disabled": state.expanded,
|
|
112
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.quickFilterIcon, {
|
|
77
113
|
fontSize: "small"
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
114
|
+
})
|
|
115
|
+
}))
|
|
116
|
+
})
|
|
117
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_quickFilter.QuickFilterControl, {
|
|
118
|
+
render: _ref => {
|
|
119
|
+
let {
|
|
120
|
+
ref,
|
|
121
|
+
slotProps: controlSlotProps
|
|
122
|
+
} = _ref,
|
|
123
|
+
controlProps = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded2);
|
|
124
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GridQuickFilterTextField, (0, _extends2.default)({
|
|
125
|
+
as: rootProps.slots.baseTextField,
|
|
126
|
+
className: classes.control,
|
|
127
|
+
ownerState: currentOwnerState,
|
|
128
|
+
inputRef: ref,
|
|
129
|
+
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterLabel'),
|
|
130
|
+
placeholder: apiRef.current.getLocaleText('toolbarQuickFilterPlaceholder'),
|
|
131
|
+
size: "small",
|
|
132
|
+
slotProps: (0, _extends2.default)({
|
|
133
|
+
input: (0, _extends2.default)({
|
|
134
|
+
startAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.quickFilterIcon, {
|
|
85
135
|
fontSize: "small"
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
136
|
+
}),
|
|
137
|
+
endAdornment: controlProps.value ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_quickFilter.QuickFilterClear, {
|
|
138
|
+
render: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.baseIconButton, {
|
|
139
|
+
size: "small",
|
|
140
|
+
edge: "end",
|
|
141
|
+
"aria-label": apiRef.current.getLocaleText('toolbarQuickFilterDeleteIconLabel'),
|
|
142
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(rootProps.slots.quickFilterClearIcon, {
|
|
143
|
+
fontSize: "small"
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
}) : null
|
|
147
|
+
}, controlSlotProps?.input)
|
|
148
|
+
}, controlSlotProps)
|
|
149
|
+
}, rootProps.slotProps?.baseTextField, controlProps, slotProps?.root, other));
|
|
150
|
+
}
|
|
151
|
+
})]
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
94
154
|
});
|
|
95
155
|
}
|
|
96
156
|
process.env.NODE_ENV !== "production" ? GridToolbarQuickFilter.propTypes = {
|