30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
/* eslint react/prop-types: 0 */
|
|
import React from 'react';
|
|
import classNames from 'classnames';
|
|
|
|
var Pager = function Pager(props) {
|
|
var _classNames;
|
|
|
|
var prefixCls = "".concat(props.rootPrefixCls, "-item");
|
|
var cls = classNames(prefixCls, "".concat(prefixCls, "-").concat(props.page), (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-active"), props.active), _defineProperty(_classNames, props.className, !!props.className), _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), !props.page), _classNames));
|
|
|
|
var handleClick = function handleClick() {
|
|
props.onClick(props.page);
|
|
};
|
|
|
|
var handleKeyPress = function handleKeyPress(e) {
|
|
props.onKeyPress(e, props.onClick, props.page);
|
|
};
|
|
|
|
return /*#__PURE__*/React.createElement("li", {
|
|
title: props.showTitle ? props.page : null,
|
|
className: cls,
|
|
onClick: handleClick,
|
|
onKeyPress: handleKeyPress,
|
|
tabIndex: "0"
|
|
}, props.itemRender(props.page, 'page', /*#__PURE__*/React.createElement("a", null, props.page)));
|
|
};
|
|
|
|
export default Pager; |