1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
|
3 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
4 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
5 | import _inherits from 'babel-runtime/helpers/inherits';
|
6 | import classNames from 'classnames';
|
7 | import React, { cloneElement } from 'react';
|
8 | import PropTypes from 'prop-types';
|
9 |
|
10 | import PagerItem from './PagerItem';
|
11 | import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
|
12 | import createChainedFunction from './utils/createChainedFunction';
|
13 | import ValidComponentChildren from './utils/ValidComponentChildren';
|
14 |
|
15 | var propTypes = {
|
16 | onSelect: PropTypes.func
|
17 | };
|
18 |
|
19 | var Pager = function (_React$Component) {
|
20 | _inherits(Pager, _React$Component);
|
21 |
|
22 | function Pager() {
|
23 | _classCallCheck(this, Pager);
|
24 |
|
25 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
26 | }
|
27 |
|
28 | Pager.prototype.render = function render() {
|
29 | var _props = this.props,
|
30 | onSelect = _props.onSelect,
|
31 | className = _props.className,
|
32 | children = _props.children,
|
33 | props = _objectWithoutProperties(_props, ['onSelect', 'className', 'children']);
|
34 |
|
35 | var _splitBsProps = splitBsProps(props),
|
36 | bsProps = _splitBsProps[0],
|
37 | elementProps = _splitBsProps[1];
|
38 |
|
39 | var classes = getClassSet(bsProps);
|
40 |
|
41 | return React.createElement(
|
42 | 'ul',
|
43 | _extends({}, elementProps, { className: classNames(className, classes) }),
|
44 | ValidComponentChildren.map(children, function (child) {
|
45 | return cloneElement(child, {
|
46 | onSelect: createChainedFunction(child.props.onSelect, onSelect)
|
47 | });
|
48 | })
|
49 | );
|
50 | };
|
51 |
|
52 | return Pager;
|
53 | }(React.Component);
|
54 |
|
55 | Pager.propTypes = propTypes;
|
56 |
|
57 | Pager.Item = PagerItem;
|
58 |
|
59 | export default bsClass('pager', Pager); |
\ | No newline at end of file |