1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _defineProperty from 'babel-runtime/helpers/defineProperty';
|
3 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
4 | import _createClass from 'babel-runtime/helpers/createClass';
|
5 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
6 | import _inherits from 'babel-runtime/helpers/inherits';
|
7 | var __rest = this && this.__rest || function (s, e) {
|
8 | var t = {};
|
9 | for (var p in s) {
|
10 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
11 | }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
12 | if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
|
13 | }return t;
|
14 | };
|
15 | import classnames from 'classnames';
|
16 | import React from 'react';
|
17 | import TouchFeedback from 'rmc-feedback';
|
18 |
|
19 | var Item = function (_React$Component) {
|
20 | _inherits(Item, _React$Component);
|
21 |
|
22 | function Item() {
|
23 | _classCallCheck(this, Item);
|
24 |
|
25 | return _possibleConstructorReturn(this, (Item.__proto__ || Object.getPrototypeOf(Item)).apply(this, arguments));
|
26 | }
|
27 |
|
28 | _createClass(Item, [{
|
29 | key: 'render',
|
30 | value: function render() {
|
31 | var _a = this.props,
|
32 | children = _a.children,
|
33 | className = _a.className,
|
34 | prefixCls = _a.prefixCls,
|
35 | icon = _a.icon,
|
36 | disabled = _a.disabled,
|
37 | firstItem = _a.firstItem,
|
38 | activeStyle = _a.activeStyle,
|
39 | restProps = __rest(_a, ["children", "className", "prefixCls", "icon", "disabled", "firstItem", "activeStyle"]);
|
40 | var cls = classnames(prefixCls + '-item', className, _defineProperty({}, prefixCls + '-item-disabled', disabled));
|
41 | var activeClass = prefixCls + '-item-active ';
|
42 | if (firstItem) {
|
43 | activeClass += prefixCls + '-item-fix-active-arrow';
|
44 | }
|
45 | return React.createElement(
|
46 | TouchFeedback,
|
47 | { disabled: disabled, activeClassName: activeClass, activeStyle: activeStyle },
|
48 | React.createElement(
|
49 | 'div',
|
50 | _extends({ className: cls }, restProps),
|
51 | React.createElement(
|
52 | 'div',
|
53 | { className: prefixCls + '-item-container' },
|
54 | icon ?
|
55 |
|
56 | React.createElement(
|
57 | 'span',
|
58 | { className: prefixCls + '-item-icon', 'aria-hidden': 'true' },
|
59 | icon
|
60 | ) : null,
|
61 | React.createElement(
|
62 | 'span',
|
63 | { className: prefixCls + '-item-content' },
|
64 | children
|
65 | )
|
66 | )
|
67 | )
|
68 | );
|
69 | }
|
70 | }]);
|
71 |
|
72 | return Item;
|
73 | }(React.Component);
|
74 |
|
75 | export default Item;
|
76 |
|
77 | Item.defaultProps = {
|
78 | prefixCls: 'am-popover',
|
79 | disabled: false
|
80 | };
|
81 | Item.myName = 'PopoverItem'; |
\ | No newline at end of file |