1 | import _extends from 'babel-runtime/helpers/extends';
|
2 | import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
|
3 | import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
|
4 | import _inherits from 'babel-runtime/helpers/inherits';
|
5 |
|
6 | var _class, _temp2;
|
7 |
|
8 | import React from 'react';
|
9 | import { findDOMNode } from 'react-dom';
|
10 | import PropTypes from 'prop-types';
|
11 | import FixedBody from '../fixed/body';
|
12 |
|
13 |
|
14 | var LockBody = (_temp2 = _class = function (_React$Component) {
|
15 | _inherits(LockBody, _React$Component);
|
16 |
|
17 | function LockBody() {
|
18 | var _temp, _this, _ret;
|
19 |
|
20 | _classCallCheck(this, LockBody);
|
21 |
|
22 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
23 | args[_key] = arguments[_key];
|
24 | }
|
25 |
|
26 | return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.onBodyScroll = function (event) {
|
27 | _this.context.onLockBodyScroll(event);
|
28 | }, _temp), _possibleConstructorReturn(_this, _ret);
|
29 | }
|
30 |
|
31 | LockBody.prototype.componentDidMount = function componentDidMount() {
|
32 | this.context.getLockNode('body', findDOMNode(this), this.context.lockType);
|
33 | };
|
34 |
|
35 | LockBody.prototype.render = function render() {
|
36 | var event = {
|
37 | onLockScroll: this.onBodyScroll
|
38 | };
|
39 | return React.createElement(FixedBody, _extends({}, this.props, event));
|
40 | };
|
41 |
|
42 | return LockBody;
|
43 | }(React.Component), _class.propTypes = _extends({}, FixedBody.propTypes), _class.contextTypes = _extends({}, FixedBody.contextTypes, {
|
44 | getLockNode: PropTypes.func,
|
45 | onLockBodyScroll: PropTypes.func,
|
46 | lockType: PropTypes.oneOf(['left', 'right'])
|
47 | }), _temp2);
|
48 | LockBody.displayName = 'LockBody';
|
49 | export { LockBody as default }; |
\ | No newline at end of file |