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 |
|
7 | var _class, _temp;
|
8 |
|
9 | import React, { Component } from 'react';
|
10 | import PropTypes from 'prop-types';
|
11 | import Tag from './tag';
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | var Closeable = (_temp = _class = function (_Component) {
|
17 | _inherits(Closeable, _Component);
|
18 |
|
19 | function Closeable() {
|
20 | _classCallCheck(this, Closeable);
|
21 |
|
22 | return _possibleConstructorReturn(this, _Component.apply(this, arguments));
|
23 | }
|
24 |
|
25 | Closeable.prototype.render = function render() {
|
26 | var _props = this.props,
|
27 | disabled = _props.disabled,
|
28 | className = _props.className,
|
29 | closeArea = _props.closeArea,
|
30 | onClose = _props.onClose,
|
31 | afterClose = _props.afterClose,
|
32 | onClick = _props.onClick,
|
33 | type = _props.type,
|
34 | size = _props.size,
|
35 | children = _props.children,
|
36 | rtl = _props.rtl,
|
37 | others = _objectWithoutProperties(_props, ['disabled', 'className', 'closeArea', 'onClose', 'afterClose', 'onClick', 'type', 'size', 'children', 'rtl']);
|
38 |
|
39 | return React.createElement(
|
40 | Tag,
|
41 | _extends({}, others, {
|
42 | rtl: rtl,
|
43 | disabled: disabled,
|
44 | className: className,
|
45 | closeArea: closeArea,
|
46 | onClose: onClose,
|
47 | afterClose: afterClose,
|
48 | onClick: onClick,
|
49 | type: type,
|
50 | size: size,
|
51 | closable: true
|
52 | }),
|
53 | children
|
54 | );
|
55 | };
|
56 |
|
57 | return Closeable;
|
58 | }(Component), _class.propTypes = {
|
59 | disabled: PropTypes.bool,
|
60 | className: PropTypes.any,
|
61 | |
62 |
|
63 |
|
64 |
|
65 | closeArea: PropTypes.oneOf(['tag', 'tail']),
|
66 | |
67 |
|
68 |
|
69 |
|
70 |
|
71 | onClose: PropTypes.func,
|
72 | |
73 |
|
74 |
|
75 | afterClose: PropTypes.func,
|
76 | |
77 |
|
78 |
|
79 | onClick: PropTypes.func,
|
80 | type: PropTypes.oneOf(['normal', 'primary']),
|
81 | |
82 |
|
83 |
|
84 | size: PropTypes.oneOf(['small', 'medium', 'large']),
|
85 | children: PropTypes.any,
|
86 | rtl: PropTypes.bool
|
87 | }, _class.defaultProps = {
|
88 | disabled: false,
|
89 | type: 'normal'
|
90 | }, _temp);
|
91 | Closeable.displayName = 'Closeable';
|
92 |
|
93 |
|
94 | export default Closeable; |
\ | No newline at end of file |