1 | import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
2 | import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
3 | import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
4 | import classNames from 'classnames';
|
5 | import React from 'react';
|
6 | import PropTypes from 'prop-types';
|
7 | import elementType from 'prop-types-extra/lib/elementType';
|
8 | import { bsClass, getClassSet, splitBsProps } from './utils/bootstrapUtils';
|
9 | import capitalize from './utils/capitalize';
|
10 | import { DEVICE_SIZES } from './utils/StyleConfig';
|
11 | var propTypes = {
|
12 | componentClass: elementType,
|
13 |
|
14 | |
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | visibleXsBlock: PropTypes.bool,
|
22 |
|
23 | |
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | visibleSmBlock: PropTypes.bool,
|
31 |
|
32 | |
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | visibleMdBlock: PropTypes.bool,
|
40 |
|
41 | |
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 | visibleLgBlock: PropTypes.bool
|
49 | };
|
50 | var defaultProps = {
|
51 | componentClass: 'div'
|
52 | };
|
53 |
|
54 | var Clearfix =
|
55 |
|
56 | function (_React$Component) {
|
57 | _inheritsLoose(Clearfix, _React$Component);
|
58 |
|
59 | function Clearfix() {
|
60 | return _React$Component.apply(this, arguments) || this;
|
61 | }
|
62 |
|
63 | var _proto = Clearfix.prototype;
|
64 |
|
65 | _proto.render = function render() {
|
66 | var _this$props = this.props,
|
67 | Component = _this$props.componentClass,
|
68 | className = _this$props.className,
|
69 | props = _objectWithoutPropertiesLoose(_this$props, ["componentClass", "className"]);
|
70 |
|
71 | var _splitBsProps = splitBsProps(props),
|
72 | bsProps = _splitBsProps[0],
|
73 | elementProps = _splitBsProps[1];
|
74 |
|
75 | var classes = getClassSet(bsProps);
|
76 | DEVICE_SIZES.forEach(function (size) {
|
77 | var propName = "visible" + capitalize(size) + "Block";
|
78 |
|
79 | if (elementProps[propName]) {
|
80 | classes["visible-" + size + "-block"] = true;
|
81 | }
|
82 |
|
83 | delete elementProps[propName];
|
84 | });
|
85 | return React.createElement(Component, _extends({}, elementProps, {
|
86 | className: classNames(className, classes)
|
87 | }));
|
88 | };
|
89 |
|
90 | return Clearfix;
|
91 | }(React.Component);
|
92 |
|
93 | Clearfix.propTypes = propTypes;
|
94 | Clearfix.defaultProps = defaultProps;
|
95 | export default bsClass('clearfix', Clearfix); |
\ | No newline at end of file |