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, _temp2;
|
8 |
|
9 | import React from 'react';
|
10 | import PropTypes from 'prop-types';
|
11 | import classnames from 'classnames';
|
12 | import Affix from '../../affix';
|
13 |
|
14 |
|
15 | var StickHeader = (_temp2 = _class = function (_React$Component) {
|
16 | _inherits(StickHeader, _React$Component);
|
17 |
|
18 | function StickHeader() {
|
19 | var _temp, _this, _ret;
|
20 |
|
21 | _classCallCheck(this, StickHeader);
|
22 |
|
23 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
24 | args[_key] = arguments[_key];
|
25 | }
|
26 |
|
27 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.getAffixRef = function (ref) {
|
28 | _this.props.affixRef && _this.props.affixRef(ref);
|
29 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
30 | }
|
31 |
|
32 | StickHeader.prototype.render = function render() {
|
33 | var _classnames;
|
34 |
|
35 | var prefix = this.props.prefix;
|
36 | var _context = this.context,
|
37 | Header = _context.Header,
|
38 | offsetTop = _context.offsetTop,
|
39 | affixProps = _context.affixProps;
|
40 |
|
41 |
|
42 | var newAffixProps = affixProps || {};
|
43 |
|
44 | var className = newAffixProps.className,
|
45 | others = _objectWithoutProperties(newAffixProps, ['className']);
|
46 |
|
47 | var cls = classnames((_classnames = {}, _classnames[prefix + 'table-affix'] = true, _classnames.className = className, _classnames));
|
48 |
|
49 | return React.createElement(
|
50 | Affix,
|
51 | _extends({
|
52 | ref: this.getAffixRef
|
53 | }, others, {
|
54 | className: cls,
|
55 | offsetTop: offsetTop
|
56 | }),
|
57 | React.createElement(Header, this.props)
|
58 | );
|
59 | };
|
60 |
|
61 | return StickHeader;
|
62 | }(React.Component), _class.propTypes = {
|
63 | prefix: PropTypes.string
|
64 | }, _class.contextTypes = {
|
65 | Header: PropTypes.any,
|
66 | offsetTop: PropTypes.number,
|
67 | affixProps: PropTypes.object
|
68 | }, _temp2);
|
69 | StickHeader.displayName = 'StickHeader';
|
70 | export { StickHeader as default }; |
\ | No newline at end of file |