1 | import "core-js/modules/es7.object.get-own-property-descriptors";
|
2 | import "core-js/modules/es6.symbol";
|
3 | import "core-js/modules/web.dom.iterable";
|
4 | import "core-js/modules/es6.array.iterator";
|
5 | import "core-js/modules/es6.object.to-string";
|
6 | import "core-js/modules/es6.object.keys";
|
7 | import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
8 | import _extends from "@babel/runtime/helpers/extends";
|
9 | import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
10 | import _createClass from "@babel/runtime/helpers/createClass";
|
11 | import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
12 | import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
13 | import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
14 | import _inherits from "@babel/runtime/helpers/inherits";
|
15 |
|
16 | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
17 |
|
18 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
19 |
|
20 |
|
21 | import React, { Component } from 'react';
|
22 | import { findDOMNode } from 'react-dom';
|
23 | import './styles/all.css';
|
24 | import debounce from '@beisen/es6-promise-debounce';
|
25 | import getUid from './uid';
|
26 | import Draggable from 'react-draggable-3d';
|
27 | import { addResizeListener, removeResizeListener, decode } from '@beisen-platform/common-func';
|
28 | import CloseIcon from '@beisen-platform/react-icons/lib/icons/CusGuanbitanceng1.js';
|
29 | import { Helper } from '@beisen-platform/platform-base';
|
30 |
|
31 | var CommonPop =
|
32 |
|
33 | function (_Component) {
|
34 | _inherits(CommonPop, _Component);
|
35 |
|
36 | function CommonPop(props) {
|
37 | var _this;
|
38 |
|
39 | _classCallCheck(this, CommonPop);
|
40 |
|
41 | _this = _possibleConstructorReturn(this, _getPrototypeOf(CommonPop).call(this, props));
|
42 |
|
43 | _this.getCommonSize = function () {
|
44 | var myWidth, myHeight;
|
45 |
|
46 | if (typeof window.innerWidth == 'number') {
|
47 | myWidth = window.innerWidth;
|
48 | myHeight = window.innerHeight;
|
49 | } else {
|
50 | if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
|
51 | myWidth = document.documentElement.clientWidth;
|
52 | myHeight = document.documentElement.clientHeight;
|
53 | } else {
|
54 | if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
|
55 | myWidth = document.body.clientWidth;
|
56 | myHeight = document.body.clientHeight;
|
57 | }
|
58 | }
|
59 | }
|
60 |
|
61 | return {
|
62 | width: myWidth,
|
63 | height: myHeight
|
64 | };
|
65 | };
|
66 |
|
67 | _this.temp = function () {
|
68 | var self = _assertThisInitialized(_this);
|
69 |
|
70 | var selfDom;
|
71 |
|
72 | if (_this.PopWindow && !_this.PopWindow) {
|
73 | return;
|
74 | }
|
75 |
|
76 | try {
|
77 | selfDom = findDOMNode(_assertThisInitialized(_this));
|
78 | } catch (e) {
|
79 | return;
|
80 | }
|
81 |
|
82 | var headHeight = selfDom.querySelector(".modal-pop__header") ? selfDom.querySelector(".modal-pop__header").offsetHeight : 0;
|
83 | var footHeight = selfDom.querySelector(".modal-pop__footer") ? selfDom.querySelector(".modal-pop__footer").offsetHeight : 0;
|
84 | var contentHeight = selfDom.querySelector(".modal-pop__content").scrollHeight > 0 ? selfDom.querySelector(".modal-pop__content").scrollHeight : selfDom.querySelector(".modal-pop__content").offsetHeight;
|
85 |
|
86 | var allWidth = _this.getWidth();
|
87 |
|
88 | var allHeight = contentHeight + headHeight + footHeight;
|
89 | var winHeight = _this.windowSize.height;
|
90 | var widthScale = _this.state.popType == 'lookup' ? 0.8 : 0.9;
|
91 |
|
92 | if (allHeight > winHeight * widthScale) {
|
93 | allHeight = winHeight * widthScale;
|
94 | contentHeight = allHeight - headHeight - footHeight;
|
95 | }
|
96 |
|
97 | if (allHeight < 220) {
|
98 | allHeight = 220;
|
99 | }
|
100 |
|
101 | var node = findDOMNode(self.PopWindow);
|
102 | var _nodeSize = {
|
103 | width: allWidth,
|
104 | height: allHeight
|
105 | };
|
106 |
|
107 | var _marleft, _marTop;
|
108 |
|
109 | var userAgent = navigator.userAgent;
|
110 | _marleft = Math.ceil(_nodeSize.width) / 2 * -1;
|
111 | _marTop = Math.ceil(_nodeSize.height / 2) * -1;
|
112 |
|
113 | if (node) {
|
114 | node.style.marginLeft = _marleft - (_this.props.menuWidth || 0) + 'px';
|
115 | node.style.marginTop = userAgent.indexOf("Edge") > -1 && _this.props.isLookUpV2 ? -(window.innerHeight / 2 + allHeight / 2) + 'px' : _marTop + 'px';
|
116 | node.style.height = allHeight + "px";
|
117 | node.style.width = allWidth + "px";
|
118 | }
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | var innerDom = selfDom.querySelector(".modal-pop__inner");
|
133 |
|
134 | if (_this.props.innerPadding == '0 8%') {
|
135 | if (allWidth <= 833) {
|
136 | innerDom.style.padding = _this.props.innerPadding;
|
137 | } else {
|
138 | innerDom.style.padding = "";
|
139 | }
|
140 | }
|
141 |
|
142 | var _contentNode = findDOMNode(self.popContent);
|
143 |
|
144 | _contentNode.style.height = contentHeight + 'px';
|
145 | _this._lastSize = {
|
146 | height: _this.windowSize.height,
|
147 | width: _this.windowSize.width
|
148 | };
|
149 | };
|
150 |
|
151 | _this.resizePop = function () {
|
152 | _this.windowSize = _this.getCommonSize();
|
153 | if (_this._lastSize == _this.windowSize) return;
|
154 |
|
155 | _this.temp();
|
156 | };
|
157 |
|
158 | _this._addEvent = function (event_name, callback) {
|
159 | _this._removeEvent(event_name, callback);
|
160 |
|
161 | if (window.addEventListener) {
|
162 | window.addEventListener("on" + event_name, callback, false);
|
163 | window.addEventListener(event_name, callback, false);
|
164 | } else {
|
165 | if (window.attachEvent) {
|
166 | window.attachEvent("on" + event_name, callback);
|
167 | window.attachEvent(event_name, callback);
|
168 | document.body.attachEvent("on" + event_name, callback);
|
169 | document.body.attachEvent(event_name, callback);
|
170 | }
|
171 | }
|
172 | };
|
173 |
|
174 | _this._removeEvent = function (event_name, callback) {
|
175 | if (window.removeEventListener) {
|
176 | window.removeEventListener("on" + event_name, callback, false);
|
177 | window.removeEventListener(event_name, callback, false);
|
178 | } else {
|
179 | if (window.detachEvent) {
|
180 | window.detachEvent("on" + event_name, callback);
|
181 | window.detachEvent(event_name, callback);
|
182 | document.body.detachEvent("on" + event_name, callback);
|
183 | document.body.detachEvent(event_name, callback);
|
184 | }
|
185 | }
|
186 | };
|
187 |
|
188 | _this.handleDragStart = function () {
|
189 | var handleDragStart = _this.props.handleDragStart;
|
190 |
|
191 | _this.getDragBoundsOffset();
|
192 |
|
193 | _this.setState({
|
194 | dragStart: true
|
195 | });
|
196 |
|
197 | handleDragStart && handleDragStart();
|
198 | };
|
199 |
|
200 | _this.getDragBoundsOffset = function () {
|
201 | var node = findDOMNode(_this.PopWindow);
|
202 | var offset = node.getBoundingClientRect();
|
203 | var translateX = 0,
|
204 | translateY = 0;
|
205 | var styleStr = node.style.transform;
|
206 |
|
207 | if (styleStr) {
|
208 | var yStartIndex = styleStr.indexOf(',');
|
209 | var yLastIndex = styleStr.indexOf(')');
|
210 | var XStartIndex = styleStr.indexOf('(');
|
211 | var XLastIndex = styleStr.indexOf(',');
|
212 | translateX = parseInt(styleStr.substring(XStartIndex + 1, XLastIndex));
|
213 | translateY = parseInt(styleStr.substring(yStartIndex + 1, yLastIndex));
|
214 | }
|
215 |
|
216 | var leftMenu = 180;
|
217 |
|
218 | try {
|
219 | leftMenu = window.top.document.getElementById('__iTalent_pop_mask_menu').clientWidth;
|
220 | } catch (e) {}
|
221 |
|
222 | _this.dragBounds = {
|
223 | top: -offset.top + translateY,
|
224 | left: -offset.left + translateX,
|
225 | bottom: offset.bottom - offset.height - translateY,
|
226 | right: offset.right - offset.width - translateX + leftMenu
|
227 | };
|
228 | };
|
229 |
|
230 | _this.handleDraging = function () {
|
231 | var handleDraging = _this.props.handleDraging;
|
232 | handleDraging && handleDraging();
|
233 | };
|
234 |
|
235 | _this.handleDragStop = function () {
|
236 | var handleDragStop = _this.props.handleDragStop;
|
237 |
|
238 | _this.setState({
|
239 | dragStart: false
|
240 | });
|
241 |
|
242 | handleDragStop && handleDragStop();
|
243 | };
|
244 |
|
245 | _this.windowSize = _this.getCommonSize();
|
246 | _this.state = {
|
247 | top: -800,
|
248 | uid: getUid(),
|
249 | getValue: [],
|
250 | dragStart: false,
|
251 | hasShadow: false,
|
252 | customStyle: props && props.customStyle || {},
|
253 | subBtnShow: props.subBtnShow != undefined ? props.subBtnShow : true
|
254 | ,
|
255 | subBtnText: props.subBtnText || "确定"
|
256 | ,
|
257 | cloBtnShow: props.cloBtnShow != undefined ? props.cloBtnShow : true
|
258 | ,
|
259 | cloBtnText: props.cloBtnText || "取消"
|
260 | ,
|
261 | popType: props && props.popType || 'default'
|
262 | ,
|
263 | isLRAlign: props.isLRAlign != undefined ? props.isLRAlign : false
|
264 | ,
|
265 | subBtnStatus: props && props.subBtnDisabled || false,
|
266 | cloBtnStatus: props && props.cloBtnDisabled || false
|
267 | };
|
268 | _this.onClosePopUp = _this.onClosePopUp.bind(_assertThisInitialized(_this));
|
269 | _this.handelCancel = _this.handelCancel.bind(_assertThisInitialized(_this));
|
270 | _this.handelEnter = _this.handelEnter.bind(_assertThisInitialized(_this));
|
271 | _this.setBtnDisabled = _this.setBtnDisabled.bind(_assertThisInitialized(_this));
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 | _this.dragBounds = {
|
283 | left: 0,
|
284 | top: 0,
|
285 | bottom: 0,
|
286 | right: 0
|
287 | };
|
288 | return _this;
|
289 | }
|
290 |
|
291 | _createClass(CommonPop, [{
|
292 | key: "componentWillReceiveProps",
|
293 | value: function componentWillReceiveProps(nextProps) {
|
294 | this.setState({
|
295 | subBtnStatus: nextProps.subBtnDisabled
|
296 | });
|
297 | }
|
298 | }, {
|
299 | key: "componentDidMount",
|
300 | value: function componentDidMount() {
|
301 | var _this2 = this;
|
302 |
|
303 | var self = this;
|
304 | this.setPopSize = debounce(function () {
|
305 | self.resizePop();
|
306 | }, 300);
|
307 |
|
308 | self.PopWindow && (self.PopWindow.style.left = '50%');
|
309 | var mask = document.getElementById(this.state.uid);
|
310 |
|
311 | if (this.props.showMask && this.props.bodyMask && !mask) {
|
312 | this.container = document.body;
|
313 | this.wrapper = document.createElement('div');
|
314 | this.wrapper.className = 'modal-pop__mask';
|
315 | this.wrapper.id = this.state.uid;
|
316 | this.wrapper.style.zIndex = this.props.bodyMaskZIndex || 10000;
|
317 | this.wrapper.style.backgroundColor = "#03101A";
|
318 | this.wrapper.style.display = 'none';
|
319 | this.container.style.overflowY = 'hidden';
|
320 |
|
321 | this.container.appendChild(this.wrapper);
|
322 | }
|
323 |
|
324 | setTimeout(function () {
|
325 | var userAgent = navigator.userAgent;
|
326 |
|
327 | self.setState({
|
328 | top: "50%"
|
329 | });
|
330 |
|
331 | var dom = document.getElementById(self.state.uid);
|
332 | if (dom && dom.style) dom.style.display = "block";
|
333 | }, 300);
|
334 |
|
335 | self._addEvent('resize', self.setPopSize);
|
336 |
|
337 | var selfDom = findDOMNode(this);
|
338 |
|
339 | this.resizeListener = function () {
|
340 | _this2.popContent.style.height = selfDom.querySelector(".modal-pop__inner").offsetHeight + 'px';
|
341 |
|
342 | _this2.temp();
|
343 | };
|
344 |
|
345 |
|
346 | if (this.props.contentResizeListener) {
|
347 | setTimeout(function () {
|
348 | addResizeListener(selfDom.querySelector(".modal-pop__inner"), _this2.resizeListener);
|
349 | }, 3000);
|
350 | }
|
351 |
|
352 | this.props.onPopLoad && this.props.onPopLoad();
|
353 | }
|
354 | }, {
|
355 | key: "componentDidUpdate",
|
356 | value: function componentDidUpdate() {
|
357 | this.setPopSize();
|
358 | }
|
359 | }, {
|
360 | key: "componentWillMount",
|
361 | value: function componentWillMount() {
|
362 | this._removeEvent('resize', this.setPopSize);
|
363 | }
|
364 |
|
365 | }, {
|
366 | key: "ref_ResizePop",
|
367 | value: function ref_ResizePop() {
|
368 | this.temp();
|
369 | }
|
370 | }, {
|
371 | key: "componentWillUnmount",
|
372 | value: function componentWillUnmount() {
|
373 | var animation = this.props.animation;
|
374 | var selfDom = findDOMNode(this);
|
375 | if (this.intval) clearInterval(this.intval);
|
376 |
|
377 | this._removeEvent('resize', this.setPopSize);
|
378 |
|
379 | if (animation) {
|
380 | this.loadTimeout && clearTimeout(this.loadTimeout);
|
381 | this.loadTimeout = false;
|
382 | }
|
383 |
|
384 | if (this.props.bodyMask) {
|
385 | document.body.style.overflowY = 'auto';
|
386 | var dom = document.getElementById(this.state.uid);
|
387 |
|
388 | if (dom) {
|
389 | this.props.onBodyMaskRemoved && this.props.onBodyMaskRemoved();
|
390 |
|
391 | try {
|
392 | document.body.removeChild(dom);
|
393 | } catch (e) {
|
394 | console.warn(e);
|
395 | }
|
396 | }
|
397 | }
|
398 |
|
399 | if (this.props.contentResizeListener && this.resizeListener) {
|
400 | removeResizeListener(selfDom.querySelector(".modal-pop__inner"), this.resizeListener);
|
401 | }
|
402 | }
|
403 | }, {
|
404 | key: "handelEnter",
|
405 |
|
406 | value: function handelEnter(e) {
|
407 | var self = this;
|
408 | var _this$props = this.props,
|
409 | removeCommonPop = _this$props.removeCommonPop,
|
410 | submitPop = _this$props.submitPop,
|
411 | animation = _this$props.animation,
|
412 | subBtnDisabled = _this$props.subBtnDisabled,
|
413 | preSubmit = _this$props.preSubmit;
|
414 | if (subBtnDisabled || preSubmit && preSubmit()) return;
|
415 | if (this.intval) clearInterval(this.intval);
|
416 | if (animation) this.setState({
|
417 | top: -800
|
418 | });
|
419 |
|
420 | if (this.props.bodyMask) {
|
421 | var dom = document.getElementById(this.state.uid);
|
422 |
|
423 | if (dom) {
|
424 | this.props.onBodyMaskRemoved && this.props.onBodyMaskRemoved();
|
425 |
|
426 | try {
|
427 | document.body.removeChild(dom);
|
428 | } catch (e) {
|
429 | console.warn(e);
|
430 | }
|
431 | }
|
432 | }
|
433 |
|
434 | setTimeout(function () {
|
435 | removeCommonPop && removeCommonPop();
|
436 | submitPop && submitPop({
|
437 | target: e,
|
438 | value: self.state.getValue,
|
439 | status: "submit"
|
440 | });
|
441 | }, 300);
|
442 | }
|
443 | }, {
|
444 | key: "onClosePopUp",
|
445 | value: function onClosePopUp(e) {
|
446 | this.handelCancel(e);
|
447 | if (this.intval) clearInterval(this.intval);
|
448 | document.removeEventListener('click', this.onClosePopUp);
|
449 | }
|
450 | }, {
|
451 | key: "handleWheel",
|
452 | value: function handleWheel(e) {
|
453 | this.props.handleWheel && this.props.handleWheel(e);
|
454 | }
|
455 |
|
456 | }, {
|
457 | key: "handelCancel",
|
458 | value: function handelCancel(e) {
|
459 | var _this$props2 = this.props,
|
460 | removeCommonPop = _this$props2.removeCommonPop,
|
461 | closePop = _this$props2.closePop,
|
462 | animation = _this$props2.animation,
|
463 | cloBtnDisabled = _this$props2.cloBtnDisabled,
|
464 | preCancel = _this$props2.preCancel;
|
465 | if (cloBtnDisabled || preCancel && preCancel()) return;
|
466 | if (animation) this.setState({
|
467 | top: -800
|
468 | });
|
469 |
|
470 | if (this.props.bodyMask) {
|
471 | var dom = document.getElementById(this.state.uid);
|
472 |
|
473 | if (dom) {
|
474 | this.props.onBodyMaskRemoved && this.props.onBodyMaskRemoved();
|
475 |
|
476 | try {
|
477 | document.body.removeChild(dom);
|
478 | } catch (e) {
|
479 | console.warn(e);
|
480 | }
|
481 | }
|
482 | }
|
483 |
|
484 | setTimeout(function () {
|
485 | removeCommonPop && removeCommonPop();
|
486 | closePop && closePop({
|
487 | target: e,
|
488 | "status": "close"
|
489 | });
|
490 | }, 300);
|
491 | }
|
492 | }, {
|
493 | key: "getWidth",
|
494 | value: function getWidth() {
|
495 | var _this$props3 = this.props,
|
496 | simpleWidth = _this$props3.simpleWidth,
|
497 | bigSize = _this$props3.bigSize;
|
498 | var maxWidth, minWidth;
|
499 | var widthScale = this.state.popType == 'lookup' ? 0.55 : 0.60;
|
500 | var bzWidth = this.props.simpleEdition ? simpleWidth : this.windowSize.width * widthScale;
|
501 |
|
502 | if (this.state.popType == 'lookup') {
|
503 | if (bzWidth < 800) {
|
504 | bzWidth = 800;
|
505 | }
|
506 |
|
507 | if (bzWidth > 1000) {
|
508 | bzWidth = 1000;
|
509 | }
|
510 | } else {
|
511 | if (!bigSize) {
|
512 | maxWidth = 660;
|
513 | minWidth = 600;
|
514 | } else {
|
515 | maxWidth = 1000;
|
516 | minWidth = 700;
|
517 | }
|
518 |
|
519 | if (bzWidth > maxWidth) {
|
520 | bzWidth = maxWidth;
|
521 | } else if (bzWidth < minWidth) {
|
522 | bzWidth = minWidth;
|
523 | }
|
524 | }
|
525 |
|
526 | return bzWidth;
|
527 | }
|
528 | }, {
|
529 | key: "setBtnDisabled",
|
530 | value: function setBtnDisabled(status1, status2) {
|
531 | this.setState({
|
532 | cloBtnStatus: status1,
|
533 | subBtnStatus: status2
|
534 | });
|
535 | }
|
536 | }, {
|
537 | key: "render",
|
538 | value: function render() {
|
539 | var _this3 = this;
|
540 |
|
541 | var Header,
|
542 | Footer,
|
543 | content,
|
544 | Mask,
|
545 | self = this;
|
546 | var width = this.getWidth();
|
547 | var marginLeft = Math.ceil(width) / 2 * -1;
|
548 | var _this$props4 = this.props,
|
549 | hasHeader = _this$props4.hasHeader,
|
550 | hasFooter = _this$props4.hasFooter,
|
551 | hasRender = _this$props4.hasRender,
|
552 | title = _this$props4.title,
|
553 | dataType = _this$props4.dataType,
|
554 | data = _this$props4.data,
|
555 | hidden = _this$props4.hidden,
|
556 | animation = _this$props4.animation,
|
557 | showMask = _this$props4.showMask,
|
558 | bodyMask = _this$props4.bodyMask,
|
559 | simpleEdition = _this$props4.simpleEdition,
|
560 | simpleWidth = _this$props4.simpleWidth,
|
561 | dragDisabled = _this$props4.dragDisabled,
|
562 | grid = _this$props4.grid,
|
563 | showHeaderClose = _this$props4.showHeaderClose,
|
564 | bigSize = _this$props4.bigSize,
|
565 | innerPadding = _this$props4.innerPadding;
|
566 | var _this$state = this.state,
|
567 | customStyle = _this$state.customStyle,
|
568 | subBtnShow = _this$state.subBtnShow,
|
569 | subBtnText = _this$state.subBtnText,
|
570 | cloBtnShow = _this$state.cloBtnShow,
|
571 | cloBtnText = _this$state.cloBtnText,
|
572 | dragStart = _this$state.dragStart;
|
573 | var sty = simpleEdition ? {
|
574 | "top": this.state.top,
|
575 | width: simpleWidth + "px",
|
576 | height: "170px",
|
577 | marginTop: "-140px",
|
578 | marginLeft: marginLeft - (this.props.menuWidth || 0) + "px"
|
579 | } : {
|
580 | "top": this.state.top,
|
581 | width: width + "px",
|
582 | height: "170px",
|
583 | marginTop: "-140px",
|
584 | marginLeft: marginLeft - (this.props.menuWidth || 0) + "px"
|
585 | };
|
586 | var isIE = !!window.ActiveXObject || "ActiveXObject" in window;
|
587 | var innerStyle = {};
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 | if (hasHeader) {
|
599 | var headerSty = !dragDisabled ? {
|
600 | "cursor": "move"
|
601 | } : {};
|
602 | Header = React.createElement("div", {
|
603 | className: "modal-pop__header",
|
604 | style: headerSty
|
605 | }, React.createElement("div", {
|
606 | className: "modal-pop__title"
|
607 | }, decode(title)), showHeaderClose ? React.createElement("div", {
|
608 | className: "modal-pop_close icon-close",
|
609 | onClick: this.onClosePopUp
|
610 | }, React.createElement("div", {
|
611 | className: "modal-pop_close-hot"
|
612 | }), React.createElement(CloseIcon, null)) : "");
|
613 | }
|
614 |
|
615 | if (hasFooter) {
|
616 | Footer = React.createElement("div", {
|
617 | ref: function ref(popFooter) {
|
618 | return _this3.popFooter = popFooter;
|
619 | },
|
620 | className: "btn-group modal-pop__footer"
|
621 | }, this.props.footerContent, cloBtnShow ? React.createElement("button", {
|
622 | style: {
|
623 | "marginRight": subBtnShow ? "" : "20px"
|
624 | },
|
625 | className: "btn " + (subBtnShow ? 'btn_weaken' : 'btn_default') + (this.state.cloBtnStatus ? 'btn_w_disabled' : ''),
|
626 | onClick: this.state.cloBtnStatus ? null : this.onClosePopUp
|
627 | }, cloBtnText) : "", subBtnShow ? React.createElement("button", {
|
628 | className: "btn btn_default " + (this.state.subBtnStatus ? 'btn_d_disabled' : ''),
|
629 | onClick: this.state.subBtnStatus ? null : this.handelEnter
|
630 | }, subBtnText) : "");
|
631 | }
|
632 |
|
633 | if (dataType == "component" && this.props.PopComponent) {
|
634 | content = hasRender ? self.props.PopComponent : React.createElement(self.props.PopComponent, _extends({
|
635 | data: data
|
636 | }, data, {
|
637 | setBtnDisabled: this.setBtnDisabled
|
638 | }));
|
639 | } else {
|
640 | content = data;
|
641 | }
|
642 |
|
643 | if (showMask && !bodyMask) {
|
644 | Mask = React.createElement("div", {
|
645 | className: "modal-pop__mask",
|
646 | id: this.state.uid,
|
647 | style: {
|
648 | "backgroundColor": "#03101A",
|
649 | "display": "none"
|
650 | }
|
651 | });
|
652 | }
|
653 |
|
654 | if (hidden) {
|
655 | return React.createElement("div", null);
|
656 | } else if (!simpleEdition) {
|
657 | return React.createElement("div", {
|
658 | className: "modal-pop",
|
659 | style: customStyle
|
660 | }, React.createElement(Draggable, {
|
661 | handle: "popdrag",
|
662 | bounds: this.dragBounds,
|
663 | grid: grid,
|
664 | disabled: dragDisabled,
|
665 | onStart: this.handleDragStart,
|
666 | onDrag: this.handleDraging,
|
667 | onStop: this.handleDragStop
|
668 | }, React.createElement("div", {
|
669 | ref: function ref(PopWindow) {
|
670 | _this3.PopWindow = PopWindow;
|
671 | },
|
672 | className: "modal-pop__container modal-pop_is-open " + (isIE ? ' modal-pop_is-ie ' : '') + (animation && !dragStart ? 'a-modal-pop' : ''),
|
673 | style: sty
|
674 | }, React.createElement("popdrag", {
|
675 | className: "cursor"
|
676 | }, Header), React.createElement("div", {
|
677 | className: "modal-pop__content",
|
678 | style: _objectSpread({
|
679 | pointerEvents: dragStart ? "none" : "auto"
|
680 | }, this.props.contentStyle),
|
681 | ref: function ref(popContent) {
|
682 | return _this3.popContent = popContent;
|
683 | },
|
684 | onScroll: this.handleWheel.bind(this)
|
685 | }, React.createElement("div", {
|
686 | className: "modal-pop__inner",
|
687 | style: {
|
688 | padding: innerPadding
|
689 | }
|
690 | }, dragStart ? React.createElement("div", {
|
691 | className: "modal-pop_is-draging"
|
692 | }) : null, content)), Footer)), Mask);
|
693 | } else {
|
694 | return React.createElement("div", {
|
695 | className: "modal-pop simple-edition",
|
696 | style: customStyle
|
697 | }, React.createElement("div", {
|
698 | ref: function ref(PopWindow) {
|
699 | _this3.PopWindow = PopWindow;
|
700 | },
|
701 | className: "modal-pop__container modal-pop_is-open " + (animation || animation == undefined ? 'a-modal-pop' : ''),
|
702 | style: sty
|
703 | }, Header, React.createElement("div", {
|
704 | className: "modal-pop__content",
|
705 | ref: function ref(popContent) {
|
706 | return _this3.popContent = popContent;
|
707 | },
|
708 | onScroll: this.handleWheel.bind(this)
|
709 | }, React.createElement("div", {
|
710 | className: "modal-pop__inner",
|
711 | style: {
|
712 | padding: innerPadding
|
713 | }
|
714 | }, content)), Footer), Mask);
|
715 | }
|
716 | }
|
717 | }]);
|
718 |
|
719 | return CommonPop;
|
720 | }(Component);
|
721 |
|
722 | CommonPop.defaultProps = {
|
723 | bodyMask: false,
|
724 | showMask: true,
|
725 | dragDisabled: true,
|
726 | grid: [1, 1],
|
727 | animation: true,
|
728 | contentResizeListener: false,
|
729 | showHeaderClose: true,
|
730 | bigSize: false,
|
731 | innerPadding: '0 5% 0 4%'
|
732 | };
|
733 | export { CommonPop as default }; |
\ | No newline at end of file |