1 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
2 | import _createClass from 'babel-runtime/helpers/createClass';
|
3 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
4 | import _inherits from 'babel-runtime/helpers/inherits';
|
5 | var __rest = this && this.__rest || function (s, e) {
|
6 | var t = {};
|
7 | for (var p in s) {
|
8 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
9 | }if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
10 | if (e.indexOf(p[i]) < 0) t[p[i]] = s[p[i]];
|
11 | }return t;
|
12 | };
|
13 | import classnames from 'classnames';
|
14 | import RcCheckbox from 'rc-checkbox';
|
15 | import React from 'react';
|
16 |
|
17 | var Checkbox = function (_React$Component) {
|
18 | _inherits(Checkbox, _React$Component);
|
19 |
|
20 | function Checkbox() {
|
21 | _classCallCheck(this, Checkbox);
|
22 |
|
23 | return _possibleConstructorReturn(this, (Checkbox.__proto__ || Object.getPrototypeOf(Checkbox)).apply(this, arguments));
|
24 | }
|
25 |
|
26 | _createClass(Checkbox, [{
|
27 | key: 'render',
|
28 | value: function render() {
|
29 | var _a = this.props,
|
30 | className = _a.className,
|
31 | style = _a.style,
|
32 | restProps = __rest(_a, ["className", "style"]);var prefixCls = restProps.prefixCls,
|
33 | children = restProps.children;
|
34 |
|
35 | var wrapCls = classnames(prefixCls + '-wrapper', className);
|
36 |
|
37 | if ('class' in restProps) {
|
38 |
|
39 | delete restProps['class'];
|
40 | }
|
41 | var mark = React.createElement(
|
42 | 'label',
|
43 | { className: wrapCls, style: style },
|
44 | React.createElement(RcCheckbox, restProps),
|
45 | children
|
46 | );
|
47 | if (this.props.wrapLabel) {
|
48 | return mark;
|
49 | }
|
50 | return React.createElement(RcCheckbox, this.props);
|
51 | }
|
52 | }]);
|
53 |
|
54 | return Checkbox;
|
55 | }(React.Component);
|
56 |
|
57 | export default Checkbox;
|
58 |
|
59 | Checkbox.defaultProps = {
|
60 | prefixCls: 'am-checkbox',
|
61 | wrapLabel: true
|
62 | }; |
\ | No newline at end of file |