acud
Version:
acg react 组件库
39 lines • 1.41 kB
JavaScript
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
/**
* @file pagination/rc-pagination/Pager
* @author chenyaqiu
*/
import React from 'react';
import classNames from 'classnames';
;
var Pager = function Pager(_ref) {
var onClick = _ref.onClick,
page = _ref.page,
rootPrefixCls = _ref.rootPrefixCls,
active = _ref.active,
className = _ref.className,
onKeyPress = _ref.onKeyPress,
showTitle = _ref.showTitle,
disabled = _ref.disabled,
itemRender = _ref.itemRender;
var prefixCls = "".concat(rootPrefixCls, "-item");
var cls = classNames(prefixCls, "".concat(prefixCls, "-").concat(page), _defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-active"), active), className, !!className), "".concat(prefixCls, "-disabled"), !page));
var handleClick = React.useCallback(function () {
onClick(page);
}, [onClick, page]);
var handleKeyPress = React.useCallback(function (e) {
onKeyPress(e, onClick, page);
}, [onKeyPress, onClick, page]);
return /*#__PURE__*/React.createElement("li", {
title: showTitle ? page.toString() : '',
className: cls,
onClick: handleClick,
onKeyPress: handleKeyPress,
tabIndex: 0,
"aria-disabled": disabled
}, itemRender(page, 'page', /*#__PURE__*/React.createElement("a", {
rel: "nofollow",
"aria-disabled": disabled
}, page)));
};
export default Pager;