1 | import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
2 | import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
3 | import PropTypes from 'prop-types';
|
4 | import React from 'react';
|
5 | import cn from 'classnames';
|
6 | import { prefix, splitBsPropsAndOmit, bsClass } from './utils/bootstrapUtils';
|
7 | import PanelCollapse from './PanelCollapse';
|
8 | var propTypes = {
|
9 | |
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | collapsible: PropTypes.bool.isRequired
|
21 | };
|
22 | var defaultProps = {
|
23 | collapsible: false
|
24 | };
|
25 | var contextTypes = {
|
26 | $bs_panel: PropTypes.shape({
|
27 | bsClass: PropTypes.string
|
28 | })
|
29 | };
|
30 |
|
31 | var PanelBody =
|
32 |
|
33 | function (_React$Component) {
|
34 | _inheritsLoose(PanelBody, _React$Component);
|
35 |
|
36 | function PanelBody() {
|
37 | return _React$Component.apply(this, arguments) || this;
|
38 | }
|
39 |
|
40 | var _proto = PanelBody.prototype;
|
41 |
|
42 | _proto.render = function render() {
|
43 | var _this$props = this.props,
|
44 | children = _this$props.children,
|
45 | className = _this$props.className,
|
46 | collapsible = _this$props.collapsible;
|
47 |
|
48 | var _ref = this.context.$bs_panel || {},
|
49 | _bsClass = _ref.bsClass;
|
50 |
|
51 | var _splitBsPropsAndOmit = splitBsPropsAndOmit(this.props, ['collapsible']),
|
52 | bsProps = _splitBsPropsAndOmit[0],
|
53 | elementProps = _splitBsPropsAndOmit[1];
|
54 |
|
55 | bsProps.bsClass = _bsClass || bsProps.bsClass;
|
56 | var body = React.createElement("div", _extends({}, elementProps, {
|
57 | className: cn(className, prefix(bsProps, 'body'))
|
58 | }), children);
|
59 |
|
60 | if (collapsible) {
|
61 | body = React.createElement(PanelCollapse, null, body);
|
62 | }
|
63 |
|
64 | return body;
|
65 | };
|
66 |
|
67 | return PanelBody;
|
68 | }(React.Component);
|
69 |
|
70 | PanelBody.propTypes = propTypes;
|
71 | PanelBody.defaultProps = defaultProps;
|
72 | PanelBody.contextTypes = contextTypes;
|
73 | export default bsClass('panel', PanelBody); |
\ | No newline at end of file |