@mui/x-data-grid 8.0.0-alpha.13 → 8.0.0-alpha.14
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 +131 -0
- package/colDef/gridActionsColDef.js +1 -1
- package/colDef/gridBooleanColDef.js +1 -1
- package/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/components/columnsManagement/GridColumnsManagement.js +1 -0
- package/components/columnsPanel/ColumnsPanelTrigger.d.ts +33 -0
- package/components/columnsPanel/ColumnsPanelTrigger.js +209 -0
- package/components/columnsPanel/index.d.ts +1 -0
- package/components/columnsPanel/index.js +16 -0
- package/components/export/ExportCsv.d.ts +30 -0
- package/components/export/ExportCsv.js +196 -0
- package/components/export/ExportPrint.d.ts +30 -0
- package/components/export/ExportPrint.js +196 -0
- package/components/export/index.d.ts +2 -0
- package/components/export/index.js +27 -0
- package/components/filterPanel/FilterPanelTrigger.d.ts +37 -0
- package/components/filterPanel/FilterPanelTrigger.js +212 -0
- package/components/filterPanel/index.d.ts +1 -0
- package/components/filterPanel/index.js +16 -0
- package/components/index.d.ts +6 -1
- package/components/index.js +60 -0
- package/components/quickFilter/QuickFilter.d.ts +41 -0
- package/components/quickFilter/QuickFilter.js +110 -0
- package/components/quickFilter/QuickFilterClear.d.ts +28 -0
- package/components/quickFilter/QuickFilterClear.js +161 -0
- package/components/quickFilter/QuickFilterContext.d.ts +13 -0
- package/components/quickFilter/QuickFilterContext.js +17 -0
- package/components/quickFilter/QuickFilterControl.d.ts +28 -0
- package/components/quickFilter/QuickFilterControl.js +104 -0
- package/components/quickFilter/index.d.ts +3 -0
- package/components/quickFilter/index.js +38 -0
- package/components/toolbar/GridToolbar.d.ts +1 -1
- package/components/toolbar/GridToolbar.js +2 -2
- package/components/toolbar/GridToolbarQuickFilter.js +54 -87
- package/components/toolbarV8/GridToolbar.d.ts +11 -0
- package/components/toolbarV8/GridToolbar.js +142 -0
- package/components/toolbarV8/Toolbar.d.ts +32 -0
- package/components/toolbarV8/Toolbar.js +132 -0
- package/components/toolbarV8/ToolbarButton.d.ts +23 -0
- package/components/toolbarV8/ToolbarButton.js +179 -0
- package/components/toolbarV8/ToolbarContext.d.ts +9 -0
- package/components/toolbarV8/ToolbarContext.js +17 -0
- package/components/toolbarV8/index.d.ts +2 -0
- package/components/toolbarV8/index.js +27 -0
- package/components/virtualization/GridVirtualScrollbar.js +7 -1
- package/constants/defaultGridSlotsComponents.js +2 -1
- package/constants/gridClasses.d.ts +4 -0
- package/esm/colDef/gridActionsColDef.js +1 -1
- package/esm/colDef/gridBooleanColDef.js +1 -1
- package/esm/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/esm/components/columnsManagement/GridColumnsManagement.js +1 -0
- package/esm/components/columnsPanel/ColumnsPanelTrigger.d.ts +33 -0
- package/esm/components/columnsPanel/ColumnsPanelTrigger.js +202 -0
- package/esm/components/columnsPanel/index.d.ts +1 -0
- package/esm/components/columnsPanel/index.js +1 -0
- package/esm/components/export/ExportCsv.d.ts +30 -0
- package/esm/components/export/ExportCsv.js +189 -0
- package/esm/components/export/ExportPrint.d.ts +30 -0
- package/esm/components/export/ExportPrint.js +189 -0
- package/esm/components/export/index.d.ts +2 -0
- package/esm/components/export/index.js +2 -0
- package/esm/components/filterPanel/FilterPanelTrigger.d.ts +37 -0
- package/esm/components/filterPanel/FilterPanelTrigger.js +205 -0
- package/esm/components/filterPanel/index.d.ts +1 -0
- package/esm/components/filterPanel/index.js +1 -0
- package/esm/components/index.d.ts +6 -1
- package/esm/components/index.js +6 -1
- package/esm/components/quickFilter/QuickFilter.d.ts +41 -0
- package/esm/components/quickFilter/QuickFilter.js +103 -0
- package/esm/components/quickFilter/QuickFilterClear.d.ts +28 -0
- package/esm/components/quickFilter/QuickFilterClear.js +154 -0
- package/esm/components/quickFilter/QuickFilterContext.d.ts +13 -0
- package/esm/components/quickFilter/QuickFilterContext.js +9 -0
- package/esm/components/quickFilter/QuickFilterControl.d.ts +28 -0
- package/esm/components/quickFilter/QuickFilterControl.js +97 -0
- package/esm/components/quickFilter/index.d.ts +3 -0
- package/esm/components/quickFilter/index.js +3 -0
- package/esm/components/toolbar/GridToolbar.d.ts +1 -1
- package/esm/components/toolbar/GridToolbar.js +2 -2
- package/esm/components/toolbar/GridToolbarQuickFilter.js +56 -87
- package/esm/components/toolbarV8/GridToolbar.d.ts +11 -0
- package/esm/components/toolbarV8/GridToolbar.js +135 -0
- package/esm/components/toolbarV8/Toolbar.d.ts +32 -0
- package/esm/components/toolbarV8/Toolbar.js +125 -0
- package/esm/components/toolbarV8/ToolbarButton.d.ts +23 -0
- package/esm/components/toolbarV8/ToolbarButton.js +172 -0
- package/esm/components/toolbarV8/ToolbarContext.d.ts +9 -0
- package/esm/components/toolbarV8/ToolbarContext.js +9 -0
- package/esm/components/toolbarV8/index.d.ts +2 -0
- package/esm/components/toolbarV8/index.js +2 -0
- package/esm/components/virtualization/GridVirtualScrollbar.js +7 -1
- package/esm/constants/defaultGridSlotsComponents.js +2 -1
- package/esm/constants/gridClasses.d.ts +4 -0
- package/esm/hooks/features/rows/useGridRowsMeta.js +8 -0
- package/esm/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -2
- package/esm/hooks/features/virtualization/useGridVirtualScroller.js +0 -2
- package/esm/hooks/utils/index.d.ts +2 -1
- package/esm/hooks/utils/useGridComponentRenderer.d.ts +12 -0
- package/esm/hooks/utils/useGridComponentRenderer.js +36 -0
- package/esm/index.js +1 -1
- package/esm/internals/demo/TailwindDemoContainer.d.ts +11 -0
- package/esm/internals/demo/TailwindDemoContainer.js +55 -0
- package/esm/internals/demo/index.d.ts +1 -0
- package/esm/internals/demo/index.js +1 -0
- package/esm/internals/index.d.ts +4 -0
- package/esm/internals/index.js +3 -0
- package/esm/material/icons/index.d.ts +3 -3
- package/esm/material/icons/index.js +6 -6
- package/esm/material/index.js +3 -3
- package/esm/models/gridBaseSlots.d.ts +5 -1
- package/esm/models/gridIconSlotsComponent.d.ts +1 -1
- package/esm/models/gridSlotsComponent.d.ts +1 -2
- package/hooks/features/rows/useGridRowsMeta.js +8 -0
- package/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -2
- package/hooks/features/virtualization/useGridVirtualScroller.js +0 -2
- package/hooks/utils/index.d.ts +2 -1
- package/hooks/utils/useGridComponentRenderer.d.ts +12 -0
- package/hooks/utils/useGridComponentRenderer.js +44 -0
- package/index.js +1 -1
- package/internals/demo/TailwindDemoContainer.d.ts +11 -0
- package/internals/demo/TailwindDemoContainer.js +63 -0
- package/internals/demo/index.d.ts +1 -0
- package/internals/demo/index.js +12 -0
- package/internals/index.d.ts +4 -0
- package/internals/index.js +28 -0
- package/material/icons/index.d.ts +3 -3
- package/material/icons/index.js +7 -7
- package/material/index.js +2 -2
- package/models/gridBaseSlots.d.ts +5 -1
- package/models/gridIconSlotsComponent.d.ts +1 -1
- package/models/gridSlotsComponent.d.ts +1 -2
- package/modern/colDef/gridActionsColDef.js +1 -1
- package/modern/colDef/gridBooleanColDef.js +1 -1
- package/modern/colDef/gridCheckboxSelectionColDef.js +1 -1
- package/modern/components/columnsManagement/GridColumnsManagement.js +1 -0
- package/modern/components/columnsPanel/ColumnsPanelTrigger.d.ts +33 -0
- package/modern/components/columnsPanel/ColumnsPanelTrigger.js +202 -0
- package/modern/components/columnsPanel/index.d.ts +1 -0
- package/modern/components/columnsPanel/index.js +1 -0
- package/modern/components/export/ExportCsv.d.ts +30 -0
- package/modern/components/export/ExportCsv.js +189 -0
- package/modern/components/export/ExportPrint.d.ts +30 -0
- package/modern/components/export/ExportPrint.js +189 -0
- package/modern/components/export/index.d.ts +2 -0
- package/modern/components/export/index.js +2 -0
- package/modern/components/filterPanel/FilterPanelTrigger.d.ts +37 -0
- package/modern/components/filterPanel/FilterPanelTrigger.js +205 -0
- package/modern/components/filterPanel/index.d.ts +1 -0
- package/modern/components/filterPanel/index.js +1 -0
- package/modern/components/index.d.ts +6 -1
- package/modern/components/index.js +6 -1
- package/modern/components/quickFilter/QuickFilter.d.ts +41 -0
- package/modern/components/quickFilter/QuickFilter.js +103 -0
- package/modern/components/quickFilter/QuickFilterClear.d.ts +28 -0
- package/modern/components/quickFilter/QuickFilterClear.js +154 -0
- package/modern/components/quickFilter/QuickFilterContext.d.ts +13 -0
- package/modern/components/quickFilter/QuickFilterContext.js +9 -0
- package/modern/components/quickFilter/QuickFilterControl.d.ts +28 -0
- package/modern/components/quickFilter/QuickFilterControl.js +97 -0
- package/modern/components/quickFilter/index.d.ts +3 -0
- package/modern/components/quickFilter/index.js +3 -0
- package/modern/components/toolbar/GridToolbar.d.ts +1 -1
- package/modern/components/toolbar/GridToolbar.js +2 -2
- package/modern/components/toolbar/GridToolbarQuickFilter.js +56 -87
- package/modern/components/toolbarV8/GridToolbar.d.ts +11 -0
- package/modern/components/toolbarV8/GridToolbar.js +135 -0
- package/modern/components/toolbarV8/Toolbar.d.ts +32 -0
- package/modern/components/toolbarV8/Toolbar.js +125 -0
- package/modern/components/toolbarV8/ToolbarButton.d.ts +23 -0
- package/modern/components/toolbarV8/ToolbarButton.js +172 -0
- package/modern/components/toolbarV8/ToolbarContext.d.ts +9 -0
- package/modern/components/toolbarV8/ToolbarContext.js +9 -0
- package/modern/components/toolbarV8/index.d.ts +2 -0
- package/modern/components/toolbarV8/index.js +2 -0
- package/modern/components/virtualization/GridVirtualScrollbar.js +7 -1
- package/modern/constants/defaultGridSlotsComponents.js +2 -1
- package/modern/constants/gridClasses.d.ts +4 -0
- package/modern/hooks/features/rows/useGridRowsMeta.js +8 -0
- package/modern/hooks/features/virtualization/useGridVirtualScroller.d.ts +0 -2
- package/modern/hooks/features/virtualization/useGridVirtualScroller.js +0 -2
- package/modern/hooks/utils/index.d.ts +2 -1
- package/modern/hooks/utils/useGridComponentRenderer.d.ts +12 -0
- package/modern/hooks/utils/useGridComponentRenderer.js +36 -0
- package/modern/index.js +1 -1
- package/modern/internals/demo/TailwindDemoContainer.d.ts +11 -0
- package/modern/internals/demo/TailwindDemoContainer.js +55 -0
- package/modern/internals/demo/index.d.ts +1 -0
- package/modern/internals/demo/index.js +1 -0
- package/modern/internals/index.d.ts +4 -0
- package/modern/internals/index.js +3 -0
- package/modern/material/icons/index.d.ts +3 -3
- package/modern/material/icons/index.js +6 -6
- package/modern/material/index.js +3 -3
- package/modern/models/gridBaseSlots.d.ts +5 -1
- package/modern/models/gridIconSlotsComponent.d.ts +1 -1
- package/modern/models/gridSlotsComponent.d.ts +1 -2
- package/package.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -0,0 +1,179 @@
|
|
|
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.ToolbarButton = 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 _utils = require("@mui/utils");
|
|
14
|
+
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
15
|
+
var _forwardRef = require("@mui/x-internals/forwardRef");
|
|
16
|
+
var _useGridRootProps = require("../../hooks/utils/useGridRootProps");
|
|
17
|
+
var _useGridComponentRenderer = require("../../hooks/utils/useGridComponentRenderer");
|
|
18
|
+
var _ToolbarContext = require("./ToolbarContext");
|
|
19
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
+
const _excluded = ["render"];
|
|
21
|
+
/**
|
|
22
|
+
* A button for performing actions from the toolbar.
|
|
23
|
+
* It renders the `baseIconButton` slot.
|
|
24
|
+
*
|
|
25
|
+
* Demos:
|
|
26
|
+
*
|
|
27
|
+
* - [Toolbar](https://mui.com/x/react-data-grid/components/toolbar/)
|
|
28
|
+
*
|
|
29
|
+
* API:
|
|
30
|
+
*
|
|
31
|
+
* - [ToolbarButton API](https://mui.com/x/api/data-grid/toolbar-button/)
|
|
32
|
+
*/
|
|
33
|
+
const ToolbarButton = exports.ToolbarButton = (0, _forwardRef.forwardRef)(function ToolbarButton(props, ref) {
|
|
34
|
+
const {
|
|
35
|
+
render
|
|
36
|
+
} = props,
|
|
37
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
38
|
+
const id = (0, _useId.default)();
|
|
39
|
+
const rootProps = (0, _useGridRootProps.useGridRootProps)();
|
|
40
|
+
const buttonRef = React.useRef(null);
|
|
41
|
+
const handleRef = (0, _utils.unstable_useForkRef)(buttonRef, ref);
|
|
42
|
+
const {
|
|
43
|
+
focusableItemId,
|
|
44
|
+
registerItem,
|
|
45
|
+
unregisterItem,
|
|
46
|
+
onItemKeyDown
|
|
47
|
+
} = (0, _ToolbarContext.useToolbarContext)();
|
|
48
|
+
React.useEffect(() => {
|
|
49
|
+
registerItem(id);
|
|
50
|
+
return () => unregisterItem(id);
|
|
51
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
|
+
}, []);
|
|
53
|
+
const isInitialFocus = React.useRef(true);
|
|
54
|
+
React.useEffect(() => {
|
|
55
|
+
// Do not focus the item on initial render
|
|
56
|
+
if (focusableItemId && isInitialFocus.current) {
|
|
57
|
+
isInitialFocus.current = false;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (focusableItemId === id) {
|
|
61
|
+
buttonRef.current?.focus();
|
|
62
|
+
}
|
|
63
|
+
}, [focusableItemId, id]);
|
|
64
|
+
const element = (0, _useGridComponentRenderer.useGridComponentRenderer)(rootProps.slots.baseIconButton, render, (0, _extends2.default)({}, rootProps.slotProps?.baseIconButton, {
|
|
65
|
+
tabIndex: focusableItemId === id ? 0 : -1,
|
|
66
|
+
onKeyDown: onItemKeyDown
|
|
67
|
+
}, other, {
|
|
68
|
+
ref: handleRef
|
|
69
|
+
}));
|
|
70
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
71
|
+
children: element
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
process.env.NODE_ENV !== "production" ? ToolbarButton.propTypes = {
|
|
75
|
+
// ----------------------------- Warning --------------------------------
|
|
76
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
77
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
78
|
+
// ----------------------------------------------------------------------
|
|
79
|
+
/**
|
|
80
|
+
* A ref for imperative actions.
|
|
81
|
+
* It currently only supports `focusVisible()` action.
|
|
82
|
+
*/
|
|
83
|
+
action: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.shape({
|
|
84
|
+
current: _propTypes.default.shape({
|
|
85
|
+
focusVisible: _propTypes.default.func.isRequired
|
|
86
|
+
})
|
|
87
|
+
})]),
|
|
88
|
+
/**
|
|
89
|
+
* If `true`, the ripples are centered.
|
|
90
|
+
* They won't start at the cursor interaction position.
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
centerRipple: _propTypes.default.bool,
|
|
94
|
+
className: _propTypes.default.string,
|
|
95
|
+
/**
|
|
96
|
+
* The color of the component.
|
|
97
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
98
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
99
|
+
*/
|
|
100
|
+
color: _propTypes.default.oneOf(['default', 'inherit', 'primary']),
|
|
101
|
+
component: _propTypes.default.elementType,
|
|
102
|
+
/**
|
|
103
|
+
* If `true`, the component is disabled.
|
|
104
|
+
*/
|
|
105
|
+
disabled: _propTypes.default.bool,
|
|
106
|
+
/**
|
|
107
|
+
* If `true`, the keyboard focus ripple is disabled.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
disableFocusRipple: _propTypes.default.bool,
|
|
111
|
+
/**
|
|
112
|
+
* If `true`, the ripple effect is disabled.
|
|
113
|
+
*
|
|
114
|
+
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
|
|
115
|
+
* to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
disableRipple: _propTypes.default.bool,
|
|
119
|
+
/**
|
|
120
|
+
* If `true`, the touch ripple effect is disabled.
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
disableTouchRipple: _propTypes.default.bool,
|
|
124
|
+
/**
|
|
125
|
+
* If given, uses a negative margin to counteract the padding on one
|
|
126
|
+
* side (this is often helpful for aligning the left or right
|
|
127
|
+
* side of the icon with content above or below, without ruining the border
|
|
128
|
+
* size and shape).
|
|
129
|
+
*/
|
|
130
|
+
edge: _propTypes.default.oneOf(['end', 'start', false]),
|
|
131
|
+
/**
|
|
132
|
+
* If `true`, the base button will have a keyboard focus ripple.
|
|
133
|
+
* @default false
|
|
134
|
+
*/
|
|
135
|
+
focusRipple: _propTypes.default.bool,
|
|
136
|
+
/**
|
|
137
|
+
* This prop can help identify which element has keyboard focus.
|
|
138
|
+
* The class name will be applied when the element gains the focus through keyboard interaction.
|
|
139
|
+
* It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
|
|
140
|
+
* The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
|
|
141
|
+
* A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
|
|
142
|
+
* if needed.
|
|
143
|
+
*/
|
|
144
|
+
focusVisibleClassName: _propTypes.default.string,
|
|
145
|
+
label: _propTypes.default.string,
|
|
146
|
+
/**
|
|
147
|
+
* The component used to render a link when the `href` prop is provided.
|
|
148
|
+
* @default 'a'
|
|
149
|
+
*/
|
|
150
|
+
LinkComponent: _propTypes.default.elementType,
|
|
151
|
+
/**
|
|
152
|
+
* Callback fired when the component is focused with a keyboard.
|
|
153
|
+
* We trigger a `onFocus` callback too.
|
|
154
|
+
*/
|
|
155
|
+
onFocusVisible: _propTypes.default.func,
|
|
156
|
+
/**
|
|
157
|
+
* A function to customize rendering of the component.
|
|
158
|
+
*/
|
|
159
|
+
render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
160
|
+
/**
|
|
161
|
+
* The size of the component.
|
|
162
|
+
* `small` is equivalent to the dense button styling.
|
|
163
|
+
*/
|
|
164
|
+
size: _propTypes.default.oneOf(['large', 'medium', 'small']),
|
|
165
|
+
style: _propTypes.default.object,
|
|
166
|
+
/**
|
|
167
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
168
|
+
*/
|
|
169
|
+
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]),
|
|
170
|
+
tabIndex: _propTypes.default.number,
|
|
171
|
+
/**
|
|
172
|
+
* Props applied to the `TouchRipple` element.
|
|
173
|
+
*/
|
|
174
|
+
TouchRippleProps: _propTypes.default.object,
|
|
175
|
+
/**
|
|
176
|
+
* A ref that points to the `TouchRipple` element.
|
|
177
|
+
*/
|
|
178
|
+
touchRippleRef: _propTypes.default.any
|
|
179
|
+
} : void 0;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface ToolbarContextValue {
|
|
3
|
+
focusableItemId: string | null;
|
|
4
|
+
registerItem: (itemId: string) => void;
|
|
5
|
+
unregisterItem: (itemId: string) => void;
|
|
6
|
+
onItemKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ToolbarContext: React.Context<ToolbarContextValue | undefined>;
|
|
9
|
+
export declare function useToolbarContext(): ToolbarContextValue;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ToolbarContext = void 0;
|
|
8
|
+
exports.useToolbarContext = useToolbarContext;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
const ToolbarContext = exports.ToolbarContext = /*#__PURE__*/React.createContext(undefined);
|
|
11
|
+
function useToolbarContext() {
|
|
12
|
+
const context = React.useContext(ToolbarContext);
|
|
13
|
+
if (context === undefined) {
|
|
14
|
+
throw new Error('MUI X: Missing context. Toolbar subcomponents must be placed within a <Toolbar /> component.');
|
|
15
|
+
}
|
|
16
|
+
return context;
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Toolbar = require("./Toolbar");
|
|
7
|
+
Object.keys(_Toolbar).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Toolbar[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Toolbar[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _ToolbarButton = require("./ToolbarButton");
|
|
18
|
+
Object.keys(_ToolbarButton).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _ToolbarButton[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _ToolbarButton[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -140,7 +140,13 @@ const GridVirtualScrollbar = exports.GridVirtualScrollbar = (0, _forwardRef.forw
|
|
|
140
140
|
top: 0
|
|
141
141
|
} : undefined,
|
|
142
142
|
tabIndex: -1,
|
|
143
|
-
"aria-hidden": "true"
|
|
143
|
+
"aria-hidden": "true"
|
|
144
|
+
// tabIndex does not prevent focus with a mouse click, throwing a console error
|
|
145
|
+
// https://github.com/mui/mui-x/issues/16706
|
|
146
|
+
,
|
|
147
|
+
onFocus: event => {
|
|
148
|
+
event.target.blur();
|
|
149
|
+
},
|
|
144
150
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
145
151
|
ref: contentRef,
|
|
146
152
|
className: classes.content
|
|
@@ -15,6 +15,7 @@ var _GridPinnedRows = require("../components/GridPinnedRows");
|
|
|
15
15
|
var _GridNoResultsOverlay = require("../components/GridNoResultsOverlay");
|
|
16
16
|
var _material = _interopRequireDefault(require("../material"));
|
|
17
17
|
var _GridBottomContainer = require("../components/virtualization/GridBottomContainer");
|
|
18
|
+
var _GridToolbar = require("../components/toolbarV8/GridToolbar");
|
|
18
19
|
// TODO: camelCase these key. It's a private helper now.
|
|
19
20
|
// Remove then need to call `uncapitalizeObjectKeys`.
|
|
20
21
|
const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = exports.DATA_GRID_DEFAULT_SLOTS_COMPONENTS = (0, _extends2.default)({}, _material.default, {
|
|
@@ -28,7 +29,7 @@ const DATA_GRID_DEFAULT_SLOTS_COMPONENTS = exports.DATA_GRID_DEFAULT_SLOTS_COMPO
|
|
|
28
29
|
bottomContainer: _GridBottomContainer.GridBottomContainer,
|
|
29
30
|
footer: _components.GridFooter,
|
|
30
31
|
footerRowCount: _components.GridRowCount,
|
|
31
|
-
toolbar:
|
|
32
|
+
toolbar: _GridToolbar.GridToolbar,
|
|
32
33
|
pinnedRows: _GridPinnedRows.GridPinnedRows,
|
|
33
34
|
loadingOverlay: _components.GridLoadingOverlay,
|
|
34
35
|
noResultsOverlay: _GridNoResultsOverlay.GridNoResultsOverlay,
|
|
@@ -594,6 +594,10 @@ export interface GridClasses {
|
|
|
594
594
|
* Styles applied to the sort icon element.
|
|
595
595
|
*/
|
|
596
596
|
sortIcon: string;
|
|
597
|
+
/**
|
|
598
|
+
* Styles applied to the toolbar root element.
|
|
599
|
+
*/
|
|
600
|
+
toolbar: string;
|
|
597
601
|
/**
|
|
598
602
|
* Styles applied to the shadow scroll area element.
|
|
599
603
|
* @ignore - do not document.
|
|
@@ -33,7 +33,7 @@ export const GRID_BOOLEAN_COL_DEF = _extends({}, GRID_STRING_COL_DEF, {
|
|
|
33
33
|
sortComparator: gridNumberComparator,
|
|
34
34
|
valueFormatter: gridBooleanFormatter,
|
|
35
35
|
filterOperators: getGridBooleanOperators(),
|
|
36
|
-
getApplyQuickFilterFn:
|
|
36
|
+
getApplyQuickFilterFn: () => null,
|
|
37
37
|
// @ts-ignore
|
|
38
38
|
aggregable: false,
|
|
39
39
|
// @ts-ignore
|
|
@@ -18,7 +18,7 @@ export const GRID_CHECKBOX_SELECTION_COL_DEF = _extends({}, GRID_BOOLEAN_COL_DEF
|
|
|
18
18
|
disableColumnMenu: true,
|
|
19
19
|
disableReorder: true,
|
|
20
20
|
disableExport: true,
|
|
21
|
-
getApplyQuickFilterFn:
|
|
21
|
+
getApplyQuickFilterFn: () => null,
|
|
22
22
|
display: 'flex',
|
|
23
23
|
valueGetter: (value, row, column, apiRef) => {
|
|
24
24
|
const rowId = gridRowIdSelector(apiRef, row);
|
|
@@ -246,6 +246,7 @@ process.env.NODE_ENV !== "production" ? GridColumnsManagement.propTypes = {
|
|
|
246
246
|
onChange: PropTypes.func,
|
|
247
247
|
onKeyDown: PropTypes.func,
|
|
248
248
|
placeholder: PropTypes.string,
|
|
249
|
+
role: PropTypes.string,
|
|
249
250
|
size: PropTypes.oneOf(['medium', 'small']),
|
|
250
251
|
slotProps: PropTypes.object,
|
|
251
252
|
style: PropTypes.object,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RenderProp } from "../../hooks/utils/useGridComponentRenderer.js";
|
|
3
|
+
import type { GridSlotProps } from '../../models';
|
|
4
|
+
export interface ColumnsPanelState {
|
|
5
|
+
/**
|
|
6
|
+
* If `true`, the columns panel is open.
|
|
7
|
+
*/
|
|
8
|
+
open: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type ColumnsPanelTriggerProps = Omit<GridSlotProps['baseButton'], 'className'> & {
|
|
11
|
+
/**
|
|
12
|
+
* A function to customize rendering of the component.
|
|
13
|
+
*/
|
|
14
|
+
render?: RenderProp<GridSlotProps['baseButton'], ColumnsPanelState>;
|
|
15
|
+
/**
|
|
16
|
+
* Override or extend the styles applied to the component.
|
|
17
|
+
*/
|
|
18
|
+
className?: string | ((state: ColumnsPanelState) => string);
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A button that opens and closes the columns panel.
|
|
22
|
+
* It renders the `baseButton` slot.
|
|
23
|
+
*
|
|
24
|
+
* Demos:
|
|
25
|
+
*
|
|
26
|
+
* - [Columns Panel](https://mui.com/x/react-data-grid/components/columns-panel/)
|
|
27
|
+
*
|
|
28
|
+
* API:
|
|
29
|
+
*
|
|
30
|
+
* - [ColumnsPanelTrigger API](https://mui.com/x/api/data-grid/columns-panel-trigger/)
|
|
31
|
+
*/
|
|
32
|
+
declare const ColumnsPanelTrigger: React.ForwardRefExoticComponent<ColumnsPanelTriggerProps> | React.ForwardRefExoticComponent<Omit<ColumnsPanelTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
33
|
+
export { ColumnsPanelTrigger };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["render", "className", "onClick", "onPointerUp"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import useId from '@mui/utils/useId';
|
|
7
|
+
import { forwardRef } from '@mui/x-internals/forwardRef';
|
|
8
|
+
import { useGridApiContext } from "../../hooks/utils/useGridApiContext.js";
|
|
9
|
+
import { gridPreferencePanelStateSelector, GridPreferencePanelsValue, useGridSelector } from "../../hooks/index.js";
|
|
10
|
+
import { useGridRootProps } from "../../hooks/utils/useGridRootProps.js";
|
|
11
|
+
import { useGridComponentRenderer } from "../../hooks/utils/useGridComponentRenderer.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
* A button that opens and closes the columns panel.
|
|
15
|
+
* It renders the `baseButton` slot.
|
|
16
|
+
*
|
|
17
|
+
* Demos:
|
|
18
|
+
*
|
|
19
|
+
* - [Columns Panel](https://mui.com/x/react-data-grid/components/columns-panel/)
|
|
20
|
+
*
|
|
21
|
+
* API:
|
|
22
|
+
*
|
|
23
|
+
* - [ColumnsPanelTrigger API](https://mui.com/x/api/data-grid/columns-panel-trigger/)
|
|
24
|
+
*/
|
|
25
|
+
const ColumnsPanelTrigger = forwardRef(function ColumnsPanelTrigger(props, ref) {
|
|
26
|
+
const {
|
|
27
|
+
render,
|
|
28
|
+
className,
|
|
29
|
+
onClick,
|
|
30
|
+
onPointerUp
|
|
31
|
+
} = props,
|
|
32
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
33
|
+
const rootProps = useGridRootProps();
|
|
34
|
+
const buttonId = useId();
|
|
35
|
+
const panelId = useId();
|
|
36
|
+
const apiRef = useGridApiContext();
|
|
37
|
+
const panelState = useGridSelector(apiRef, gridPreferencePanelStateSelector);
|
|
38
|
+
const open = panelState.open && panelState.openedPanelValue === GridPreferencePanelsValue.columns;
|
|
39
|
+
const state = {
|
|
40
|
+
open
|
|
41
|
+
};
|
|
42
|
+
const resolvedClassName = typeof className === 'function' ? className(state) : className;
|
|
43
|
+
const handleClick = event => {
|
|
44
|
+
if (open) {
|
|
45
|
+
apiRef.current.hidePreferences();
|
|
46
|
+
} else {
|
|
47
|
+
apiRef.current.showPreferences(GridPreferencePanelsValue.columns, panelId, buttonId);
|
|
48
|
+
}
|
|
49
|
+
onClick?.(event);
|
|
50
|
+
};
|
|
51
|
+
const handlePointerUp = event => {
|
|
52
|
+
if (open) {
|
|
53
|
+
event.stopPropagation();
|
|
54
|
+
}
|
|
55
|
+
onPointerUp?.(event);
|
|
56
|
+
};
|
|
57
|
+
const element = useGridComponentRenderer(rootProps.slots.baseButton, render, _extends({}, rootProps.slotProps?.baseButton, {
|
|
58
|
+
id: buttonId,
|
|
59
|
+
'aria-haspopup': 'true',
|
|
60
|
+
'aria-expanded': open ? 'true' : undefined,
|
|
61
|
+
'aria-controls': open ? panelId : undefined,
|
|
62
|
+
onClick: handleClick,
|
|
63
|
+
onPointerUp: handlePointerUp,
|
|
64
|
+
className: resolvedClassName
|
|
65
|
+
}, other, {
|
|
66
|
+
ref
|
|
67
|
+
}), state);
|
|
68
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
69
|
+
children: element
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
process.env.NODE_ENV !== "production" ? ColumnsPanelTrigger.propTypes = {
|
|
73
|
+
// ----------------------------- Warning --------------------------------
|
|
74
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
75
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
76
|
+
// ----------------------------------------------------------------------
|
|
77
|
+
/**
|
|
78
|
+
* A ref for imperative actions.
|
|
79
|
+
* It currently only supports `focusVisible()` action.
|
|
80
|
+
*/
|
|
81
|
+
action: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
82
|
+
current: PropTypes.shape({
|
|
83
|
+
focusVisible: PropTypes.func.isRequired
|
|
84
|
+
})
|
|
85
|
+
})]),
|
|
86
|
+
/**
|
|
87
|
+
* If `true`, the ripples are centered.
|
|
88
|
+
* They won't start at the cursor interaction position.
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
centerRipple: PropTypes.bool,
|
|
92
|
+
/**
|
|
93
|
+
* Override or extend the styles applied to the component.
|
|
94
|
+
*/
|
|
95
|
+
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
96
|
+
/**
|
|
97
|
+
* The color of the component.
|
|
98
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
99
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors).
|
|
100
|
+
* @default 'primary'
|
|
101
|
+
*/
|
|
102
|
+
color: PropTypes.oneOf(['error', 'info', 'inherit', 'primary', 'secondary', 'success', 'warning']),
|
|
103
|
+
component: PropTypes.elementType,
|
|
104
|
+
/**
|
|
105
|
+
* If `true`, the component is disabled.
|
|
106
|
+
*/
|
|
107
|
+
disabled: PropTypes.bool,
|
|
108
|
+
/**
|
|
109
|
+
* If `true`, no elevation is used.
|
|
110
|
+
* @default false
|
|
111
|
+
*/
|
|
112
|
+
disableElevation: PropTypes.bool,
|
|
113
|
+
/**
|
|
114
|
+
* If `true`, the keyboard focus ripple is disabled.
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
disableFocusRipple: PropTypes.bool,
|
|
118
|
+
/**
|
|
119
|
+
* If `true`, the ripple effect is disabled.
|
|
120
|
+
*
|
|
121
|
+
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
|
|
122
|
+
* to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
|
|
123
|
+
* @default false
|
|
124
|
+
*/
|
|
125
|
+
disableRipple: PropTypes.bool,
|
|
126
|
+
/**
|
|
127
|
+
* If `true`, the touch ripple effect is disabled.
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
disableTouchRipple: PropTypes.bool,
|
|
131
|
+
/**
|
|
132
|
+
* Element placed after the children.
|
|
133
|
+
*/
|
|
134
|
+
endIcon: PropTypes.node,
|
|
135
|
+
/**
|
|
136
|
+
* If `true`, the base button will have a keyboard focus ripple.
|
|
137
|
+
* @default false
|
|
138
|
+
*/
|
|
139
|
+
focusRipple: PropTypes.bool,
|
|
140
|
+
/**
|
|
141
|
+
* This prop can help identify which element has keyboard focus.
|
|
142
|
+
* The class name will be applied when the element gains the focus through keyboard interaction.
|
|
143
|
+
* It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
|
|
144
|
+
* The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
|
|
145
|
+
* A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
|
|
146
|
+
* if needed.
|
|
147
|
+
*/
|
|
148
|
+
focusVisibleClassName: PropTypes.string,
|
|
149
|
+
/**
|
|
150
|
+
* If `true`, the button will take up the full width of its container.
|
|
151
|
+
* @default false
|
|
152
|
+
*/
|
|
153
|
+
fullWidth: PropTypes.bool,
|
|
154
|
+
/**
|
|
155
|
+
* The URL to link to when the button is clicked.
|
|
156
|
+
* If defined, an `a` element will be used as the root node.
|
|
157
|
+
*/
|
|
158
|
+
href: PropTypes.string,
|
|
159
|
+
/**
|
|
160
|
+
* The component used to render a link when the `href` prop is provided.
|
|
161
|
+
* @default 'a'
|
|
162
|
+
*/
|
|
163
|
+
LinkComponent: PropTypes.elementType,
|
|
164
|
+
/**
|
|
165
|
+
* Callback fired when the component is focused with a keyboard.
|
|
166
|
+
* We trigger a `onFocus` callback too.
|
|
167
|
+
*/
|
|
168
|
+
onFocusVisible: PropTypes.func,
|
|
169
|
+
/**
|
|
170
|
+
* A function to customize rendering of the component.
|
|
171
|
+
*/
|
|
172
|
+
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
173
|
+
/**
|
|
174
|
+
* The size of the component.
|
|
175
|
+
* `small` is equivalent to the dense button styling.
|
|
176
|
+
*/
|
|
177
|
+
size: PropTypes.oneOf(['large', 'medium', 'small']),
|
|
178
|
+
/**
|
|
179
|
+
* Element placed before the children.
|
|
180
|
+
*/
|
|
181
|
+
startIcon: PropTypes.node,
|
|
182
|
+
style: PropTypes.object,
|
|
183
|
+
/**
|
|
184
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
185
|
+
*/
|
|
186
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
187
|
+
tabIndex: PropTypes.number,
|
|
188
|
+
/**
|
|
189
|
+
* Props applied to the `TouchRipple` element.
|
|
190
|
+
*/
|
|
191
|
+
TouchRippleProps: PropTypes.object,
|
|
192
|
+
/**
|
|
193
|
+
* A ref that points to the `TouchRipple` element.
|
|
194
|
+
*/
|
|
195
|
+
touchRippleRef: PropTypes.any,
|
|
196
|
+
/**
|
|
197
|
+
* The variant to use.
|
|
198
|
+
* @default 'text'
|
|
199
|
+
*/
|
|
200
|
+
variant: PropTypes.oneOf(['contained', 'outlined', 'text'])
|
|
201
|
+
} : void 0;
|
|
202
|
+
export { ColumnsPanelTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ColumnsPanelTrigger.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ColumnsPanelTrigger.js";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { RenderProp } from "../../hooks/utils/useGridComponentRenderer.js";
|
|
3
|
+
import { GridCsvExportOptions } from "../../models/gridExport.js";
|
|
4
|
+
import type { GridSlotProps } from '../../models';
|
|
5
|
+
export type ExportCsvProps = GridSlotProps['baseButton'] & {
|
|
6
|
+
/**
|
|
7
|
+
* A function to customize rendering of the component.
|
|
8
|
+
*/
|
|
9
|
+
render?: RenderProp<GridSlotProps['baseButton']>;
|
|
10
|
+
/**
|
|
11
|
+
* The options to apply on the CSV export.
|
|
12
|
+
* @demos
|
|
13
|
+
* - [CSV export](/x/react-data-grid/export/#csv-export)
|
|
14
|
+
*/
|
|
15
|
+
options?: GridCsvExportOptions;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* A button that triggers a CSV export.
|
|
19
|
+
* It renders the `baseButton` slot.
|
|
20
|
+
*
|
|
21
|
+
* Demos:
|
|
22
|
+
*
|
|
23
|
+
* - [Export](https://mui.com/x/react-data-grid/components/export/)
|
|
24
|
+
*
|
|
25
|
+
* API:
|
|
26
|
+
*
|
|
27
|
+
* - [ExportCsv API](https://mui.com/x/api/data-grid/export-csv/)
|
|
28
|
+
*/
|
|
29
|
+
declare const ExportCsv: React.ForwardRefExoticComponent<ExportCsvProps> | React.ForwardRefExoticComponent<Omit<ExportCsvProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
30
|
+
export { ExportCsv };
|