UNPKG

@douyinfe/semi-ui

Version:

A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.

37 lines 1.53 kB
import _isFunction from "lodash/isFunction"; import _get from "lodash/get"; import React, { PureComponent, isValidElement } from 'react'; import PropTypes from 'prop-types'; import { cssClasses } from '@douyinfe/semi-foundation/lib/es/table/constants'; import Pagination from '../pagination'; export default class TablePagination extends PureComponent { render() { const { pagination, prefixCls, info, renderPagination } = this.props; const total = _get(pagination, 'total'); const customPagination = renderPagination && _isFunction(renderPagination) ? renderPagination(pagination) : null; return /*#__PURE__*/React.createElement("div", { className: `${prefixCls}-pagination-outer` }, /*#__PURE__*/isValidElement(customPagination) ? customPagination : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", { className: `${prefixCls}-pagination-info` }, info), /*#__PURE__*/React.createElement("span", { className: `${prefixCls}-pagination-wrapper` }, total > 0 ? /*#__PURE__*/React.createElement(Pagination, Object.assign({}, pagination, { key: _get(pagination, 'pageSize', 'pagination') })) : null)))); } } TablePagination.propTypes = { style: PropTypes.object, prefixCls: PropTypes.string, pagination: PropTypes.object, info: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), renderPagination: PropTypes.func }; TablePagination.defaultProps = { prefixCls: cssClasses.PREFIX };