1 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
2 |
|
3 | var _class, _temp;
|
4 |
|
5 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
6 |
|
7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
8 |
|
9 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
10 |
|
11 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
12 |
|
13 | import React, { Component } from 'react';
|
14 | import PropTypes from 'prop-types';
|
15 |
|
16 | var Notice = (_temp = _class = function (_Component) {
|
17 | _inherits(Notice, _Component);
|
18 |
|
19 | function Notice(props) {
|
20 | _classCallCheck(this, Notice);
|
21 |
|
22 | return _possibleConstructorReturn(this, _Component.call(this, props));
|
23 | }
|
24 |
|
25 | Notice.prototype.render = function render() {
|
26 | var _this2 = this;
|
27 |
|
28 | var _props = this.props,
|
29 | className = _props.className,
|
30 | style = _props.style,
|
31 | wrapperParams = _props.wrapperParams,
|
32 | icon = _props.icon,
|
33 | caption = _props.caption,
|
34 | captionParams = _props.captionParams,
|
35 | sndcaption = _props.sndcaption,
|
36 | sndcaptionParams = _props.sndcaptionParams,
|
37 | children = _props.children,
|
38 | others = _objectWithoutProperties(_props, ['className', 'style', 'wrapperParams', 'icon', 'caption', 'captionParams', 'sndcaption', 'sndcaptionParams', 'children']);
|
39 |
|
40 | return React.createElement(
|
41 | 'div',
|
42 | _extends({ ref: function ref(el) {
|
43 | _this2.$el = el;
|
44 | }, className: 'notice' + (className ? ' ' + className : ''), style: style }, others),
|
45 | React.createElement(
|
46 | 'div',
|
47 | _extends({}, wrapperParams, { className: 'notice-wrapper' + (wrapperParams.className ? ' ' + wrapperParams.className : '') }),
|
48 | icon ? icon : React.createElement('i', { className: 'icon notice-icon notice-icon-nodata' }),
|
49 | caption && React.createElement(
|
50 | 'div',
|
51 | _extends({}, captionParams, { className: 'notice-caption' + (captionParams.className ? ' ' + captionParams.className : '') }),
|
52 | caption
|
53 | ),
|
54 | sndcaption && React.createElement(
|
55 | 'div',
|
56 | _extends({}, sndcaptionParams, { className: 'notice-sndcaption' + (sndcaptionParams.className ? ' ' + sndcaptionParams.className : '') }),
|
57 | sndcaption
|
58 | ),
|
59 | children
|
60 | )
|
61 | );
|
62 | };
|
63 |
|
64 | return Notice;
|
65 | }(Component), _class.defaultProps = {
|
66 | wrapperParams: {},
|
67 | caption: '暂无数据',
|
68 | captionParams: {},
|
69 | sndcaptionParams: {}
|
70 | }, _temp);
|
71 | export { Notice as default };
|
72 | Notice.propTypes = process.env.NODE_ENV !== "production" ? {
|
73 | className: PropTypes.string,
|
74 | style: PropTypes.object,
|
75 |
|
76 | wrapperParams: PropTypes.object,
|
77 |
|
78 | icon: PropTypes.node,
|
79 |
|
80 | caption: PropTypes.node,
|
81 | captionParams: PropTypes.object,
|
82 | sndcaption: PropTypes.node,
|
83 | sndcaptionParams: PropTypes.object,
|
84 |
|
85 | children: PropTypes.node
|
86 | } : {}; |
\ | No newline at end of file |