zent
Version:
一套前端设计语言和基于React的实现
43 lines (42 loc) • 2.35 kB
JavaScript
import { __assign, __extends } from "tslib";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { PureComponent } from 'react';
import classnames from 'classnames';
import Pagination from '../pagination';
import LitePagination from '../pagination/LitePagination';
import MiniPagination from '../pagination/MiniPagination';
var defaultPageInfo = {
current: 1,
pageSize: 10,
};
var Footer = (function (_super) {
__extends(Footer, _super);
function Footer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.handlePageChange = function (_a) {
var pageSize = _a.pageSize, current = _a.current;
var onPaginationChange = _this.props.onPaginationChange;
onPaginationChange && onPaginationChange(pageSize, current);
};
return _this;
}
Footer.prototype.hasPagination = function (props) {
var pageInfo = (props || this.props).pageInfo;
return pageInfo && Object.keys(pageInfo).length > 0;
};
Footer.prototype.getDefaultPagination = function (props) {
var pageInfo = (props || this.props).pageInfo;
return this.hasPagination(props)
? __assign(__assign({}, pageInfo), { current: pageInfo.current || defaultPageInfo.current, pageSize: pageInfo.pageSize || defaultPageInfo.pageSize }) : null;
};
Footer.prototype.render = function () {
var _a = this.props, prefix = _a.prefix, paginationType = _a.paginationType;
var curPageInfo = this.getDefaultPagination();
if (curPageInfo) {
return (_jsxs("div", __assign({ className: prefix + "-grid-tfoot", "data-zv": '10.0.17' }, { children: [this.props.batchComponents, _jsxs("div", __assign({ className: classnames(prefix + "-grid-tfoot-page"), "data-zv": '10.0.17' }, { children: [paginationType === 'default' && (_jsx(Pagination, __assign({}, curPageInfo, { onChange: this.handlePageChange }), void 0)), paginationType === 'lite' && (_jsx(LitePagination, __assign({}, curPageInfo, { onChange: this.handlePageChange }), void 0)), paginationType === 'mini' && (_jsx(MiniPagination, __assign({}, curPageInfo, { onChange: this.handlePageChange }), void 0))] }), void 0)] }), void 0));
}
return null;
};
return Footer;
}(PureComponent));
export default Footer;