Pager.js
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _react = _interopRequireDefault(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
/* eslint react/prop-types: 0 */
var Pager = function Pager(props) {
var _classNames;
var prefixCls = "".concat(props.rootPrefixCls, "-item");
var cls = (0, _classnames.default)(prefixCls, "".concat(prefixCls, "-").concat(props.page), (_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-active"), props.active), (0, _defineProperty2.default)(_classNames, props.className, !!props.className), (0, _defineProperty2.default)(_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.default.createElement("li", {
title: props.showTitle ? props.page : null,
className: cls,
onClick: handleClick,
onKeyPress: handleKeyPress,
tabIndex: "0"
}, props.itemRender(props.page, 'page', /*#__PURE__*/_react.default.createElement("a", {
rel: "nofollow"
}, props.page)));
};
var _default = Pager;
exports.default = _default;