@mui/x-data-grid
Version:
The Community plan edition of the Data Grid components (MUI X).
40 lines • 2.69 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import * as React from 'react';
import PropTypes from 'prop-types';
import { useGridSelector } from '../hooks/utils/useGridSelector';
import { gridTopLevelRowCountSelector } from '../hooks/features/rows/gridRowsSelector';
import { selectedGridRowsCountSelector } from '../hooks/features/rowSelection/gridRowSelectionSelector';
import { gridFilteredTopLevelRowCountSelector } from '../hooks/features/filter/gridFilterSelector';
import { useGridApiContext } from '../hooks/utils/useGridApiContext';
import { GridSelectedRowCount } from './GridSelectedRowCount';
import { GridFooterContainer } from './containers/GridFooterContainer';
import { useGridRootProps } from '../hooks/utils/useGridRootProps';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const GridFooter = /*#__PURE__*/React.forwardRef(function GridFooter(props, ref) {
const apiRef = useGridApiContext();
const rootProps = useGridRootProps();
const totalTopLevelRowCount = useGridSelector(apiRef, gridTopLevelRowCountSelector);
const selectedRowCount = useGridSelector(apiRef, selectedGridRowsCountSelector);
const visibleTopLevelRowCount = useGridSelector(apiRef, gridFilteredTopLevelRowCountSelector);
const selectedRowCountElement = !rootProps.hideFooterSelectedRowCount && selectedRowCount > 0 ? /*#__PURE__*/_jsx(GridSelectedRowCount, {
selectedRowCount: selectedRowCount
}) : /*#__PURE__*/_jsx("div", {});
const rowCountElement = !rootProps.hideFooterRowCount && !rootProps.pagination ? /*#__PURE__*/_jsx(rootProps.slots.footerRowCount, _extends({}, rootProps.slotProps?.footerRowCount, {
rowCount: totalTopLevelRowCount,
visibleRowCount: visibleTopLevelRowCount
})) : null;
const paginationElement = rootProps.pagination && !rootProps.hideFooterPagination && rootProps.slots.pagination && /*#__PURE__*/_jsx(rootProps.slots.pagination, _extends({}, rootProps.slotProps?.pagination));
return /*#__PURE__*/_jsxs(GridFooterContainer, _extends({
ref: ref
}, props, {
children: [selectedRowCountElement, rowCountElement, paginationElement]
}));
});
process.env.NODE_ENV !== "production" ? GridFooter.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "yarn proptypes" |
// ----------------------------------------------------------------------
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
} : void 0;
export { GridFooter };