@mui/x-data-grid
Version:
The community edition of the data grid component (MUI X).
64 lines • 3.27 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["className", "csvOptions", "printOptions", "excelOptions", "showQuickFilter", "quickFilterProps"];
import * as React from 'react';
import PropTypes from 'prop-types';
import Box from '@mui/material/Box';
import { GridToolbarContainer } from '../containers/GridToolbarContainer';
import { GridToolbarColumnsButton } from './GridToolbarColumnsButton';
import { GridToolbarDensitySelector } from './GridToolbarDensitySelector';
import { GridToolbarFilterButton } from './GridToolbarFilterButton';
import { GridToolbarExport } from './GridToolbarExport';
import { useGridRootProps } from '../../hooks/utils/useGridRootProps';
import { GridToolbarQuickFilter } from './GridToolbarQuickFilter';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var GridToolbar = /*#__PURE__*/React.forwardRef(function GridToolbar(props, ref) {
// TODO v7: think about where export option should be passed.
// from slotProps={{ toolbarExport: { ...exportOption } }} seems to be more appropriate
var className = props.className,
csvOptions = props.csvOptions,
printOptions = props.printOptions,
excelOptions = props.excelOptions,
_props$showQuickFilte = props.showQuickFilter,
showQuickFilter = _props$showQuickFilte === void 0 ? false : _props$showQuickFilte,
_props$quickFilterPro = props.quickFilterProps,
quickFilterProps = _props$quickFilterPro === void 0 ? {} : _props$quickFilterPro,
other = _objectWithoutProperties(props, _excluded);
var rootProps = useGridRootProps();
if (rootProps.disableColumnFilter && rootProps.disableColumnSelector && rootProps.disableDensitySelector && !showQuickFilter) {
return null;
}
return /*#__PURE__*/_jsxs(GridToolbarContainer, _extends({
ref: ref
}, other, {
children: [/*#__PURE__*/_jsx(GridToolbarColumnsButton, {}), /*#__PURE__*/_jsx(GridToolbarFilterButton, {}), /*#__PURE__*/_jsx(GridToolbarDensitySelector, {}), /*#__PURE__*/_jsx(GridToolbarExport, {
csvOptions: csvOptions,
printOptions: printOptions
// TODO: remove the reference to excelOptions in community package
,
excelOptions: excelOptions
}), /*#__PURE__*/_jsx(Box, {
sx: {
flex: 1
}
}), showQuickFilter && /*#__PURE__*/_jsx(GridToolbarQuickFilter, _extends({}, quickFilterProps))]
}));
});
process.env.NODE_ENV !== "production" ? GridToolbar.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "yarn proptypes" |
// ----------------------------------------------------------------------
/**
* Props passed to the quick filter component.
*/
quickFilterProps: PropTypes.object,
/**
* Show the quick filter component.
* @default false
*/
showQuickFilter: PropTypes.bool,
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
} : void 0;
export { GridToolbar };