1 | import _extends from "@babel/runtime/helpers/extends";
|
2 | import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
3 | import _createClass from "@babel/runtime/helpers/createClass";
|
4 | import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
5 | import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
6 | import _inherits from "@babel/runtime/helpers/inherits";
|
7 | import React, { Component } from "react";
|
8 | import PopLayer from "./PopLayer";
|
9 | import CommonMount from "@beisen-platform/common-mount";
|
10 |
|
11 | var PopLayerWithMask =
|
12 |
|
13 | function (_Component) {
|
14 | _inherits(PopLayerWithMask, _Component);
|
15 |
|
16 | function PopLayerWithMask(props) {
|
17 | var _this;
|
18 |
|
19 | _classCallCheck(this, PopLayerWithMask);
|
20 |
|
21 | _this = _possibleConstructorReturn(this, _getPrototypeOf(PopLayerWithMask).call(this, props));
|
22 |
|
23 | _this.onClose = function () {
|
24 | var _this$props;
|
25 |
|
26 | _this.commonMount.unmountBox();
|
27 |
|
28 | _this.props.showHide && (_this$props = _this.props).showHide.apply(_this$props, arguments);
|
29 | };
|
30 |
|
31 | _this.popLayerCenterMountContainerId = 'pop-layer__center_mount_container';
|
32 | _this.commonMount = new CommonMount({
|
33 | containerId: _this.popLayerCenterMountContainerId,
|
34 | follow: false,
|
35 |
|
36 | fixed: true
|
37 |
|
38 | });
|
39 | return _this;
|
40 | }
|
41 |
|
42 | _createClass(PopLayerWithMask, [{
|
43 | key: "componentDidMount",
|
44 | value: function componentDidMount() {
|
45 | var popLayer = React.createElement(PopLayer, _extends({}, this.props, {
|
46 | showHide: this.onClose
|
47 | }));
|
48 | this.renderCenterConfirm(popLayer);
|
49 | }
|
50 | }, {
|
51 | key: "componentDidUpdate",
|
52 | value: function componentDidUpdate() {
|
53 | if (!this.props.hidden) {
|
54 | var popLayer = React.createElement(PopLayer, _extends({}, this.props, {
|
55 | showHide: this.onClose
|
56 | }));
|
57 | this.renderCenterConfirm(popLayer);
|
58 | }
|
59 | }
|
60 | }, {
|
61 | key: "renderCenterConfirm",
|
62 | value: function renderCenterConfirm(content) {
|
63 | this.commonMount.renderDom('pop-layer__center-mask', content, null, [document.body, {}]);
|
64 | this.isConfirmPopLayerRendered = true;
|
65 | }
|
66 | }, {
|
67 | key: "render",
|
68 | value: function render() {
|
69 | return null;
|
70 | }
|
71 | }]);
|
72 |
|
73 | return PopLayerWithMask;
|
74 | }(Component);
|
75 |
|
76 | export { PopLayerWithMask as default }; |
\ | No newline at end of file |