@mui/x-data-grid
Version:
The Community plan edition of the Data Grid components (MUI X).
67 lines • 2.58 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
const _excluded = ["className", "selectedRowCount"];
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { unstable_composeClasses as composeClasses } from '@mui/utils';
import { styled } from '@mui/system';
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
import { getDataGridUtilityClass } from '../constants/gridClasses';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
import { jsx as _jsx } from "react/jsx-runtime";
const useUtilityClasses = ownerState => {
const {
classes
} = ownerState;
const slots = {
root: ['selectedRowCount']
};
return composeClasses(slots, getDataGridUtilityClass, classes);
};
const GridSelectedRowCountRoot = styled('div', {
name: 'MuiDataGrid',
slot: 'SelectedRowCount',
overridesResolver: (props, styles) => styles.selectedRowCount
})(({
theme
}) => ({
alignItems: 'center',
display: 'flex',
margin: theme.spacing(0, 2),
visibility: 'hidden',
width: 0,
height: 0,
[theme.breakpoints.up('sm')]: {
visibility: 'visible',
width: 'auto',
height: 'auto'
}
}));
const GridSelectedRowCount = /*#__PURE__*/React.forwardRef(function GridSelectedRowCount(props, ref) {
const {
className,
selectedRowCount
} = props,
other = _objectWithoutPropertiesLoose(props, _excluded);
const apiRef = useGridApiContext();
const ownerState = useGridRootProps();
const classes = useUtilityClasses(ownerState);
const rowSelectedText = apiRef.current.getLocaleText('footerRowSelected')(selectedRowCount);
return /*#__PURE__*/_jsx(GridSelectedRowCountRoot, _extends({
ref: ref,
className: clsx(classes.root, className),
ownerState: ownerState
}, other, {
children: rowSelectedText
}));
});
process.env.NODE_ENV !== "production" ? GridSelectedRowCount.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "yarn proptypes" |
// ----------------------------------------------------------------------
selectedRowCount: PropTypes.number.isRequired,
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
} : void 0;
export { GridSelectedRowCount };