1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
3 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
4 | import _inherits from 'babel-runtime/helpers/inherits';
|
5 |
|
6 | var _class, _temp;
|
7 |
|
8 |
|
9 | import React from 'react';
|
10 | import PropTypes from 'prop-types';
|
11 | import classNames from 'classnames';
|
12 | import ConfigProvider from '../config-provider';
|
13 | import BulletHeader from './bullet-header';
|
14 | import CollapseContent from './collapse-content';
|
15 | import CardMedia from './media';
|
16 | import CardActions from './actions';
|
17 | import { obj } from '../util';
|
18 |
|
19 | var pickOthers = obj.pickOthers;
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | var Card = (_temp = _class = function (_React$Component) {
|
27 | _inherits(Card, _React$Component);
|
28 |
|
29 | function Card() {
|
30 | _classCallCheck(this, Card);
|
31 |
|
32 | return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
|
33 | }
|
34 |
|
35 | Card.prototype.render = function render() {
|
36 | var _classNames;
|
37 |
|
38 | var _props = this.props,
|
39 | prefix = _props.prefix,
|
40 | className = _props.className,
|
41 | title = _props.title,
|
42 | subTitle = _props.subTitle,
|
43 | extra = _props.extra,
|
44 | showTitleBullet = _props.showTitleBullet,
|
45 | showHeadDivider = _props.showHeadDivider,
|
46 | children = _props.children,
|
47 | rtl = _props.rtl,
|
48 | contentHeight = _props.contentHeight,
|
49 | free = _props.free,
|
50 | actions = _props.actions,
|
51 | hasBorder = _props.hasBorder,
|
52 | media = _props.media;
|
53 |
|
54 |
|
55 | var cardCls = classNames((_classNames = {}, _classNames[prefix + 'card'] = true, _classNames[prefix + 'card-free'] = free, _classNames[prefix + 'card-noborder'] = !hasBorder, _classNames[prefix + 'card-show-divider'] = showHeadDivider, _classNames[prefix + 'card-hide-divider'] = !showHeadDivider, _classNames), className);
|
56 |
|
57 | var others = pickOthers(Object.keys(Card.propTypes), this.props);
|
58 |
|
59 | others.dir = rtl ? 'rtl' : undefined;
|
60 |
|
61 | return React.createElement(
|
62 | 'div',
|
63 | _extends({}, others, { className: cardCls }),
|
64 | media && React.createElement(
|
65 | CardMedia,
|
66 | null,
|
67 | media
|
68 | ),
|
69 | React.createElement(BulletHeader, { title: title, subTitle: subTitle, extra: extra, showTitleBullet: showTitleBullet }),
|
70 | free ? children : React.createElement(
|
71 | CollapseContent,
|
72 | { contentHeight: contentHeight },
|
73 | children
|
74 | ),
|
75 | actions && React.createElement(
|
76 | CardActions,
|
77 | null,
|
78 | actions
|
79 | )
|
80 | );
|
81 | };
|
82 |
|
83 | return Card;
|
84 | }(React.Component), _class.displayName = 'Card', _class.propTypes = _extends({}, ConfigProvider.propTypes, {
|
85 | prefix: PropTypes.string,
|
86 | rtl: PropTypes.bool,
|
87 | |
88 |
|
89 |
|
90 | media: PropTypes.node,
|
91 | |
92 |
|
93 |
|
94 | title: PropTypes.node,
|
95 | |
96 |
|
97 |
|
98 | subTitle: PropTypes.node,
|
99 | |
100 |
|
101 |
|
102 | actions: PropTypes.node,
|
103 | |
104 |
|
105 |
|
106 | showTitleBullet: PropTypes.bool,
|
107 | |
108 |
|
109 |
|
110 | showHeadDivider: PropTypes.bool,
|
111 | |
112 |
|
113 |
|
114 | contentHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
115 | |
116 |
|
117 |
|
118 | extra: PropTypes.node,
|
119 | |
120 |
|
121 |
|
122 | free: PropTypes.bool,
|
123 | |
124 |
|
125 |
|
126 |
|
127 | hasBorder: PropTypes.bool,
|
128 | className: PropTypes.string,
|
129 | children: PropTypes.node
|
130 | }), _class.defaultProps = {
|
131 | prefix: 'next-',
|
132 | free: false,
|
133 | showTitleBullet: true,
|
134 | showHeadDivider: true,
|
135 | hasBorder: true,
|
136 | contentHeight: 120
|
137 | }, _temp);
|
138 | Card.displayName = 'Card';
|
139 | export { Card as default }; |
\ | No newline at end of file |