1 | var _class, _temp;
|
2 |
|
3 | 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; }
|
4 |
|
5 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
6 |
|
7 | 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; }
|
8 |
|
9 | 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; }
|
10 |
|
11 | import React, { Component } from 'react';
|
12 | import PropTypes from 'prop-types';
|
13 | import Page from './../Page';
|
14 | import Instance from './instance.js';
|
15 |
|
16 | var PagePull = (_temp = _class = function (_Component) {
|
17 | _inherits(PagePull, _Component);
|
18 |
|
19 | function PagePull(props, context) {
|
20 | _classCallCheck(this, PagePull);
|
21 |
|
22 | var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
23 |
|
24 | _this.componentDidMount = function () {
|
25 | var instance = new Instance(_this.$el, {
|
26 | drag: true,
|
27 | transition: _this.props.transition || 'push',
|
28 | onShowedLeft: _this.props.onShowedLeft,
|
29 | onShowedRight: _this.props.onShowedRight
|
30 | });
|
31 | _this.instance = instance;
|
32 | };
|
33 |
|
34 | return _this;
|
35 | }
|
36 |
|
37 | PagePull.prototype.render = function render() {
|
38 | var _this2 = this;
|
39 |
|
40 | var _props = this.props,
|
41 | lSide = _props.lSide,
|
42 | lSideStyle = _props.lSideStyle,
|
43 | lSideClassName = _props.lSideClassName,
|
44 | rSide = _props.rSide,
|
45 | rSideStyle = _props.rSideStyle,
|
46 | rSideClassName = _props.rSideClassName,
|
47 | drag = _props.drag,
|
48 | children = _props.children,
|
49 | transition = _props.transition,
|
50 | others = _objectWithoutProperties(_props, ['lSide', 'lSideStyle', 'lSideClassName', 'rSide', 'rSideStyle', 'rSideClassName', 'drag', 'children', 'transition']);
|
51 |
|
52 | return React.createElement(
|
53 | 'div',
|
54 | { className: 'page-pull', ref: function ref(el) {
|
55 | _this2.$el = el;
|
56 | } },
|
57 | React.createElement(
|
58 | Page,
|
59 | others,
|
60 | children,
|
61 | React.createElement('div', { className: 'mask' })
|
62 | ),
|
63 | lSide && React.createElement(
|
64 | 'aside',
|
65 | { className: 'page-side-left' + (lSideClassName ? ' ' + lSideClassName : ''), style: lSideStyle, 'data-transition': transition, ref: function ref(el) {
|
66 | _this2.$lSide = el;
|
67 | } },
|
68 | lSide
|
69 | ),
|
70 | rSide && React.createElement(
|
71 | 'aside',
|
72 | { className: 'page-side-right' + (rSideClassName ? ' ' + rSideClassName : ''), style: rSideStyle, 'data-transition': transition, ref: function ref(el) {
|
73 | _this2.$rSide = el;
|
74 | } },
|
75 | rSide
|
76 | )
|
77 | );
|
78 | };
|
79 |
|
80 | return PagePull;
|
81 | }(Component), _class.defaultProps = {
|
82 | drag: true,
|
83 | transition: 'push'
|
84 | }, _temp);
|
85 | export { PagePull as default };
|
86 | PagePull.propTypes = process.env.NODE_ENV !== "production" ? {
|
87 |
|
88 | children: PropTypes.node,
|
89 |
|
90 | drag: PropTypes.bool,
|
91 | lSide: PropTypes.node,
|
92 | lSideStyle: PropTypes.object,
|
93 | lSideClassName: PropTypes.string,
|
94 | rSide: PropTypes.node,
|
95 | rSideStyle: PropTypes.object,
|
96 | rSideClassName: PropTypes.string,
|
97 | transition: PropTypes.string,
|
98 | onShowedLeft: PropTypes.func,
|
99 | onShowedRight: PropTypes.func
|
100 | } : {}; |
\ | No newline at end of file |