1this.BX = this.BX || {}; 2(function (exports,main_core_zIndexManager,main_core_events,main_core) { 3 'use strict'; 4 5 /** 6 * @memberOf BX.Main.Popup 7 * @deprecated use BX.UI.Button 8 */ 9 var Button = /*#__PURE__*/function () { 10 function Button(params) { 11 babelHelpers.classCallCheck(this, Button); 12 this.popupWindow = null; 13 this.params = params || {}; 14 this.text = this.params.text || ''; 15 this.id = this.params.id || ''; 16 this.className = this.params.className || ''; 17 this.events = this.params.events || {}; 18 this.contextEvents = {}; 19 20 for (var eventName in this.events) { 21 if (main_core.Type.isFunction(this.events[eventName])) { 22 this.contextEvents[eventName] = this.events[eventName].bind(this); 23 } 24 } 25 26 this.buttonNode = main_core.Dom.create('span', { 27 props: { 28 className: 'popup-window-button' + (this.className.length > 0 ? ' ' + this.className : ''), 29 id: this.id 30 }, 31 events: this.contextEvents, 32 text: this.text 33 }); 34 } 35 36 babelHelpers.createClass(Button, [{ 37 key: "render", 38 value: function render() { 39 return this.buttonNode; 40 } 41 }, { 42 key: "getId", 43 value: function getId() { 44 return this.id; 45 } 46 }, { 47 key: "getContainer", 48 value: function getContainer() { 49 return this.buttonNode; 50 } 51 }, { 52 key: "getName", 53 value: function getName() { 54 return this.text; 55 } 56 }, { 57 key: "setName", 58 value: function setName(name) { 59 this.text = name || ''; 60 61 if (this.buttonNode) { 62 main_core.Dom.clean(this.buttonNode); 63 main_core.Dom.adjust(this.buttonNode, { 64 text: this.text 65 }); 66 } 67 } 68 }, { 69 key: "setClassName", 70 value: function setClassName(className) { 71 if (this.buttonNode) { 72 if (main_core.Type.isString(this.className) && this.className !== '') { 73 main_core.Dom.removeClass(this.buttonNode, this.className); 74 } 75 76 main_core.Dom.addClass(this.buttonNode, className); 77 } 78 79 this.className = className; 80 } 81 }, { 82 key: "addClassName", 83 value: function addClassName(className) { 84 if (this.buttonNode) { 85 main_core.Dom.addClass(this.buttonNode, className); 86 this.className = this.buttonNode.className; 87 } 88 } 89 }, { 90 key: "removeClassName", 91 value: function removeClassName(className) { 92 if (this.buttonNode) { 93 main_core.Dom.removeClass(this.buttonNode, className); 94 this.className = this.buttonNode.className; 95 } 96 } 97 }]); 98 return Button; 99 }(); 100 101 var _left = new WeakMap(); 102 103 var _top = new WeakMap(); 104 105 var PositionEvent = /*#__PURE__*/function (_BaseEvent) { 106 babelHelpers.inherits(PositionEvent, _BaseEvent); 107 108 function PositionEvent() { 109 var _this; 110 111 babelHelpers.classCallCheck(this, PositionEvent); 112 _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PositionEvent).call(this)); 113 114 _left.set(babelHelpers.assertThisInitialized(_this), { 115 writable: true, 116 value: void 0 117 }); 118 119 _top.set(babelHelpers.assertThisInitialized(_this), { 120 writable: true, 121 value: void 0 122 }); 123 124 return _this; 125 } 126 127 babelHelpers.createClass(PositionEvent, [{ 128 key: "left", 129 get: function get() { 130 return babelHelpers.classPrivateFieldGet(this, _left); 131 }, 132 set: function set(value) { 133 if (main_core.Type.isNumber(value)) { 134 babelHelpers.classPrivateFieldSet(this, _left, value); 135 } 136 } 137 }, { 138 key: "top", 139 get: function get() { 140 return babelHelpers.classPrivateFieldGet(this, _top); 141 }, 142 set: function set(value) { 143 if (main_core.Type.isNumber(value)) { 144 babelHelpers.classPrivateFieldSet(this, _top, value); 145 } 146 } 147 }]); 148 return PositionEvent; 149 }(main_core_events.BaseEvent); 150 151 var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateOb
151ject8, _templateObject9; 152 var aliases = { 153 onPopupWindowInit: { 154 namespace: 'BX.Main.Popup', 155 eventName: 'onInit' 156 }, 157 onPopupWindowIsInitialized: { 158 namespace: 'BX.Main.Popup', 159 eventName: 'onAfterInit' 160 }, 161 onPopupFirstShow: { 162 namespace: 'BX.Main.Popup', 163 eventName: 'onFirstShow' 164 }, 165 onPopupShow: { 166 namespace: 'BX.Main.Popup', 167 eventName: 'onShow' 168 }, 169 onAfterPopupShow: { 170 namespace: 'BX.Main.Popup', 171 eventName: 'onAfterShow' 172 }, 173 onPopupClose: { 174 namespace: 'BX.Main.Popup', 175 eventName: 'onClose' 176 }, 177 onPopupAfterClose: { 178 namespace: 'BX.Main.Popup', 179 eventName: 'onAfterClose' 180 }, 181 onPopupDestroy: { 182 namespace: 'BX.Main.Popup', 183 eventName: 'onDestroy' 184 }, 185 onPopupFullscreenLeave: { 186 namespace: 'BX.Main.Popup', 187 eventName: 'onFullscreenLeave' 188 }, 189 onPopupFullscreenEnter: { 190 namespace: 'BX.Main.Popup', 191 eventName: 'onFullscreenEnter' 192 }, 193 onPopupDragStart: { 194 namespace: 'BX.Main.Popup', 195 eventName: 'onDragStart' 196 }, 197 onPopupDrag: { 198 namespace: 'BX.Main.Popup', 199 eventName: 'onDrag' 200 }, 201 onPopupDragEnd: { 202 namespace: 'BX.Main.Popup', 203 eventName: 'onDragEnd' 204 }, 205 onPopupResizeStart: { 206 namespace: 'BX.Main.Popup', 207 eventName: 'onResizeStart' 208 }, 209 onPopupResize: { 210 namespace: 'BX.Main.Popup', 211 eventName: 'onResize' 212 }, 213 onPopupResizeEnd: { 214 namespace: 'BX.Main.Popup', 215 eventName: 'onResizeEnd' 216 } 217 }; 218 main_core_events.EventEmitter.registerAliases(aliases); 219 /** 220 * @memberof BX.Main 221 */ 222 223 var Popup = /*#__PURE__*/function (_EventEmitter) { 224 babelHelpers.inherits(Popup, _EventEmitter); 225 babelHelpers.createClass(Popup, null, [{ 226 key: "setOptions", 227 228 /** 229 * @private 230 */ 231 232 /** 233 * @private 234 */ 235 value: function setOptions(options) { 236 if (!main_core.Type.isPlainObject(options)) { 237 return; 238 } 239 240 for (var option in options) { 241 this.options[option] = options[option]; 242 } 243 } 244 }, { 245 key: "getOption", 246 value: function getOption(option, defaultValue) { 247 if (!main_core.Type.isUndefined(this.options[option])) { 248 return this.options[option]; 249 } else if (!main_core.Type.isUndefined(defaultValue)) { 250 return defaultValue; 251 } else { 252 return this.defaultOptions[option]; 253 } 254 } 255 }]); 256 257 function Popup(options) { 258 var _this; 259 260 babelHelpers.classCallCheck(this, Popup); 261 _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Popup).call(this)); 262 263 _this.setEventNamespace('BX.Main.Popup'); 264 265 var _arguments = Array.prototype.slice.call(arguments), 266 popupId = _arguments[0], 267 bindElement = _arguments[1], 268 params = _arguments[2]; //compatible arguments 269 270 271 _this.compatibleMode = params && main_core.Type.isBoolean(params.compatibleMode) ? params.compatibleMode : true; 272 273 if (main_core.Type.isPlainObject(options) && !bindElement && !params) { 274 params = options; 275 popupId = options.id; 276 bindElement = options.bindElement; 277 _this.compatibleMode = false; 278 } 279 280 params = params || {}; 281 _this.params = params; 282 283 if (!main_core.Type.isStringFilled(popupId)) { 284 popupId = 'popup-window-' + main_core.Text.getRandom().toLowerCase(); 285 } 286 287 _this.emit('onInit', new main_core_events.BaseEvent({ 288 compatData: [popupId, bindElement, params] 289 })); 290 /** 291 * @private 292 */ 293 294 295 _this.uniquePopupId = popupId; 296 _this.params.zIndex = main_core.Type.isNumber(params.zIndex) ? parseInt(params.zIndex) : 0; 297 _this.params.zIndexAbsolute = main_core.Type.isNumber(params.zIndexAbsolute) ? parseInt(params.zIndexAbsolute) : 0; 298 _this.buttons = params.buttons && main_core.Type.isArray(params.buttons) ? params.buttons : []; 299 _this.offsetTop = Popup.getOption('offsetTop'); 300 _this.offsetLeft = Popup.getOption('offsetLeft'); 301 _this.firstShow = false; 302 _this.bordersWidth = 20; 303 _this.bindElementPos = null; 304 _this.closeIcon = null; 305 _this.resizeIcon = null; 306 _this.angle = null; 307 _this.angleArrowElement = null;
308 _this.overlay = null; 309 _this.titleBar = null; 310 _this.bindOptions = babelHelpers.typeof(params.bindOptions) === 'object' ? params.bindOptions : {}; 311 _this.autoHide = params.autoHide === true; 312 _this.autoHideHandler = main_core.Type.isFunction(params.autoHideHandler) ? params.autoHideHandler : null; 313 _this.handleAutoHide = _this.handleAutoHide.bind(babelHelpers.assertThisInitialized(_this)); 314 _this.handleOverlayClick = _this.handleOverlayClick.bind(babelHelpers.assertThisInitialized(_this)); 315 _this.isAutoHideBinded = false; 316 _this.closeByEsc = params.closeByEsc === true; 317 _this.isCloseByEscBinded = false; 318 _this.toFrontOnShow = true; 319 _this.cacheable = true; 320 _this.destroyed = false; 321 _this.width = null; 322 _this.height = null; 323 _this.minWidth = null; 324 _this.minHeight = null; 325 _this.maxWidth = null; 326 _this.maxHeight = null; 327 _this.padding = null; 328 _this.contentPadding = null; 329 _this.background = null; 330 _this.contentBackground = null; 331 _this.targetContainer = main_core.Type.isElementNode(params.targetContainer) ? params.targetContainer : document.body; 332 _this.dragOptions = { 333 cursor: '', 334 callback: function callback() {}, 335 eventName: '' 336 }; 337 _this.dragged = false; 338 _this.dragPageX = 0; 339 _this.dragPageY = 0; 340 _this.animationShowClassName = null; 341 _this.animationCloseClassName = null; 342 _this.animationCloseEventType = null; 343 _this.handleDocumentMouseMove = _this.handleDocumentMouseMove.bind(babelHelpers.assertThisInitialized(_this)); 344 _this.handleDocumentMouseUp = _this.handleDocumentMouseUp.bind(babelHelpers.assertThisInitialized(_this)); 345 _this.handleDocumentKeyUp = _this.handleDocumentKeyUp.bind(babelHelpers.assertThisInitialized(_this)); 346 _this.handleResizeWindow = _this.handleResizeWindow.bind(babelHelpers.assertThisInitialized(_this)); 347 _this.handleResize = _this.handleResize.bind(babelHelpers.assertThisInitialized(_this)); 348 _this.handleMove = _this.handleMove.bind(babelHelpers.assertThisInitialized(_this)); 349 _this.onTitleMouseDown = _this.onTitleMouseDown.bind(babelHelpers.assertThisInitialized(_this)); 350 _this.handleFullScreen = _this.handleFullScreen.bind(babelHelpers.assertThisInitialized(_this)); 351 352 _this.subscribeFromOptions(params.events); 353 354 var popupClassName = 'popup-window'; 355 356 if (params.titleBar) { 357 popupClassName += ' popup-window-with-titlebar'; 358 } 359 360 if (params.className && main_core.Type.isStringFilled(params.className)) { 361 popupClassName += ' ' + params.className; 362 } 363 364 if (params.darkMode) { 365 popupClassName += ' popup-window-dark'; 366 } 367 368 if (params.titleBar) { 369 _this.titleBar = main_core.Tag.render(_templateObject || (_templateObject = babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t<div class=\"popup-window-titlebar\" id=\"popup-window-titlebar-", "\"></div>\n\t\t\t"])), popupId); 370 } 371 372 if (params.closeIcon) { 373 var className = 'popup-window-close-icon' + (params.titleBar ? ' popup-window-titlebar-close-icon' : ''); 374 _this.closeIcon = main_core.Tag.render(_templateObject2 || (_templateObject2 = babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t<span class=\"", "\" onclick=\"", "\"></span>\n\t\t\t"])), className, _this.handleCloseIconClick.bind(babelHelpers.assertThisInitialized(_this))); 375 376 if (main_core.Type.isPlainObject(params.closeIcon)) { 377 main_core.Dom.style(_this.closeIcon, params.closeIcon); 378 } 379 } 380 /** 381 * @private 382 */ 383 384 385 _this.contentContainer = main_core.Tag.render(_templateObject3 || (_templateObject3 = babelHelpers.taggedTemplateLiteral(["<div id=\"popup-window-content-", "\" class=\"popup-window-content\"></div>"])), popupId); 386 /** 387 * @private 388 */ 389 390 _this.popupContainer = main_core.Tag.render(_templateObject4 || (_templateObject4 = babelHelpers.taggedTemplateLiteral(["<div\n\t\t\t\tclass=\"", "\"\n\t\t\t\tid=\"", "\"\n\t\t\t\tstyle=\"display: none; position: absolute; left: 0; top: 0;\"\n\t\t\t>", "</div>"])), popupClassName, popupId, [_this.titleBar, _this.contentContainer, _this.closeIcon]); 391 392 _this.targetContainer.appendChild(_this.popupContainer); 393 394 _this.zIndexComponent = main_core_zIndexManager.ZIndexManager.register(_this.popupContainer, params.zIndexOptions); 395 _this.buttonsContainer = null; 396 397 if (params.contentColor && main_core.Type.isStringFilled(params.contentColor)) { 398 if (params.contentColor === 'white' || params.contentColor === 'gray') { 399 popupClassName += ' popup-window-content-' + params.contentColor; 400 } 401 402 _this.setContentColor(params.contentColor); 403 } 404 405 if (params.angle) { 406 _this.setAngle(params.angle); 407 } 408 409 if (params.overlay) { 410 _this.setOverlay(params.overlay); 411 } 412 413 _this.setOffset(params); 414 415 _this.setBindElement(bindElement); 416 417 _this.setTitleBar(params.titleBar); 418 419 _this.setContent(params.content); 420 421 _this.setButtons(params.buttons); 422 423 _this.setWidth(params.width); 424 425 _this.setHeight(params.height); 426 427 _this.setMinWidth(params.minWidth); 428 429 _this.setMinHeight(params.minHeight); 430 431 _this.setMaxWidth(params.maxWidth); 432 433 _this.setMaxHeight(params.maxHeight); 434 435 _this.setResizeMode(params.resizable); 436 437 _this.setPadding(params.padding); 438 439 _this.setContentPadding(params.contentPadding); 440
441 _this.setBackground(params.background); 442 443 _this.setContentBackground(params.contentBackground); 444 445 _this.setAnimation(params.animation); 446 447 _this.setCacheable(params.cacheable); 448 449 _this.setToFrontOnShow(params.toFrontOnShow); // Compatibility 450 451 452 if (params.contentNoPaddings) { 453 _this.setContentPadding(0); 454 } 455 456 if (params.noAllPaddings) { 457 _this.setPadding(0); 458 459 _this.setContentPadding(0); 460 } 461 462 if (params.bindOnResize !== false) { 463 main_core.Event.bind(window, 'resize', _this.handleResizeWindow); 464 } 465 466 _this.emit('onAfterInit', new main_core_events.BaseEvent({ 467 compatData: [popupId, babelHelpers.assertThisInitialized(_this)] 468 })); 469 470 return _this; 471 } 472 /** 473 * @private 474 */ 475 476 477 babelHelpers.createClass(Popup, [{ 478 key: "subscribeFromOptions", 479 value: function subscribeFromOptions(events) { 480 babelHelpers.get(babelHelpers.getPrototypeOf(Popup.prototype), "subscribeFromOptions", this).call(this, events, aliases); 481 } 482 }, { 483 key: "getId", 484 value: function getId() { 485 return this.uniquePopupId; 486 } 487 }, { 488 key: "isCompatibleMode", 489 value: function isCompatibleMode() { 490 return this.compatibleMode; 491 } 492 }, { 493 key: "setContent", 494 value: function setContent(content) { 495 if (!this.contentContainer || !content) { 496 return; 497 } 498 499 if (main_core.Type.isElementNode(content)) { 500 main_core.Dom.clean(this.contentContainer); 501 var hasParent = main_core.Type.isDomNode(content.parentNode); 502 this.contentContainer.appendChild(content); 503 504 if (this.isCompatibleMode() || hasParent) { 505 content.style.display = 'block'; 506 } 507 } else if (main_core.Type.isString(content)) { 508 this.contentContainer.innerHTML = content; 509 } else { 510 this.contentContainer.innerHTML = ' '; 511 } 512 } 513 }, { 514 key: "setButtons", 515 value: function setButtons(buttons) { 516 this.buttons = buttons && main_core.Type.isArray(buttons) ? buttons : []; 517 518 if (this.buttonsContainer) { 519 main_core.Dom.remove(this.buttonsContainer); 520 } 521 522 var ButtonClass = main_core.Reflection.getClass('BX.UI.Button'); 523 524 if (this.buttons.length > 0 && this.contentContainer) { 525 var newButtons = []; 526 527 for (var i = 0; i < this.buttons.length; i++) { 528 var button = this.buttons[i]; 529 530 if (button instanceof Button) { 531 button.popupWindow = this; 532 newButtons.push(button.render()); 533 } else if (ButtonClass && button instanceof ButtonClass) { 534 button.setContext(this); 535 newButtons.push(button.render()); 536 } 537 } 538 539 this.buttonsContainer = this.contentContainer.parentNode.appendChild(main_core.Tag.render(_templateObject5 || (_templateObject5 = babelHelpers.taggedTemplateLiteral(["<div class=\"popup-window-buttons\">", "</div>"])), newButtons)); 540 } 541 } 542 }, { 543 key: "getButtons", 544 value: function getButtons() { 545 return this.buttons; 546 } 547 }, { 548 key: "getButton", 549 value: function getButton(id) { 550 for (var i = 0; i < this.buttons.length; i++) { 551 var button = this.buttons[i]; 552 553 if (button.getId() === id) { 554 return button; 555 } 556 } 557 558 return null; 559 } 560 }, { 561 key: "setBindElement", 562 value: function setBindElement(bindElement) { 563 if (bindElement === null) { 564 this.bindElement = null; 565 } else if (babelHelpers.typeof(bindElement) === 'object') { 566 if (main_core.Type.isDomNode(bindElement) || main_core.Type.isNumber(bindElement.top) && main_core.Type.isNumber(bindElement.left)) { 567 this.bindElement = bindElement; 568 } else if (main_core.Type.isNumber(bindElement.clientX) && main_core.Type.isNumber(bindElement.clientY)) { 569 this.bindElement = { 570 left: bindElement.pageX, 571 top: bindElement.pageY, 572 bottom: bindElement.pageY 573 }; 574 } 575 } 576 } 577 /** 578 * @private 579 */ 580 581 }, { 582 key: "getBindElementPos", 583 value: function getBindElementPos(bindElement) { 584 if (main_core.Type.isDomNode(bindElement)) { 585 if (this.isTargetDocumentBody()) { 586 return main_core.Dom.getPosition(bindElement); 587 } else { 588 return this.getPositionRelativeToTarget(bindElement); 589 } 590 } else if (bindElement && babelHelpers.typeof(bindElement) === 'object') { 591 if (!main_core.Type.isNumber(bindElement.bottom)) { 592 bindElement.bottom = bindElement.top; 593 } 594 595 return bindElement; 596 } else { 597 var windowSize = this.getWindowSize(); 598 var windowScroll = this.getWindowScroll(); 599 var popupWidth = this.getPopupContainer().offsetWidth; 600 var popupHeight = this.getPopupContainer().offsetHeight; 601 this.bindOptions.forceTop = true; 602 return { 603 left: windowSize.innerWidth / 2 - popupWidth / 2 + windowScroll.scrollLeft,
604 top: windowSize.innerHeight / 2 - popupHeight / 2 + windowScroll.scrollTop, 605 bottom: windowSize.innerHeight / 2 - popupHeight / 2 + windowScroll.scrollTop, 606 //for optimisation purposes 607 windowSize: windowSize, 608 windowScroll: windowScroll, 609 popupWidth: popupWidth, 610 popupHeight: popupHeight 611 }; 612 } 613 } 614 /** 615 * @internal 616 */ 617 618 }, { 619 key: "getPositionRelativeToTarget", 620 value: function getPositionRelativeToTarget(element) { 621 var offsetLeft = element.offsetLeft; 622 var offsetTop = element.offsetTop; 623 var offsetElement = element.offsetParent; 624 625 while (offsetElement && offsetElement !== this.getTargetContainer()) { 626 offsetLeft += offsetElement.offsetLeft; 627 offsetTop += offsetElement.offsetTop; 628 offsetElement = offsetElement.offsetParent; 629 } 630 631 var elementRect = element.getBoundingClientRect(); 632 return new DOMRect(offsetLeft, offsetTop, elementRect.width, elementRect.height); 633 } // private 634 635 }, { 636 key: "getWindowSize", 637 value: function getWindowSize() { 638 if (this.isTargetDocumentBody()) { 639 return { 640 innerWidth: window.innerWidth, 641 innerHeight: window.innerHeight 642 }; 643 } else { 644 return { 645 innerWidth: this.getTargetContainer().offsetWidth, 646 innerHeight: this.getTargetContainer().offsetHeight 647 }; 648 } 649 } // private 650 651 }, { 652 key: "getWindowScroll", 653 value: function getWindowScroll() { 654 if (this.isTargetDocumentBody()) { 655 return { 656 scrollLeft: window.pageXOffset, 657 scrollTop: window.pageYOffset 658 }; 659 } else { 660 return { 661 scrollLeft: this.getTargetContainer().scrollLeft, 662 scrollTop: this.getTargetContainer().scrollTop 663 }; 664 } 665 } 666 }, { 667 key: "setAngle", 668 value: function setAngle(params) { 669 if (params === false) { 670 if (this.angle !== null) { 671 main_core.Dom.remove(this.angle.element); 672 } 673 674 this.angle = null; 675 this.angleArrowElement = null; 676 return; 677 } 678 679 var className = 'popup-window-angly'; 680 681 if (this.angle === null) { 682 var position = this.bindOptions.position && this.bindOptions.position === 'top' ? 'bottom' : 'top'; 683 var angleMinLeft = Popup.getOption(position === 'top' ? 'angleMinTop' : 'angleMinBottom'); 684 var defaultOffset = main_core.Type.isNumber(params.offset) ? params.offset : 0; 685 var angleLeftOffset = Popup.getOption('angleLeftOffset', null); 686 687 if (defaultOffset > 0 && main_core.Type.isNumber(angleLeftOffset)) { 688 defaultOffset += angleLeftOffset - Popup.defaultOptions.angleLeftOffset; 689 } 690 691 this.angleArrowElement = main_core.Tag.render(_templateObject6 || (_templateObject6 = babelHelpers.taggedTemplateLiteral(["<div class=\"popup-window-angly--arrow\"></div>"]))); 692 693 if (this.background) { 694 this.angleArrowElement.style.background = this.background; 695 } 696 697 this.angle = { 698 element: main_core.Tag.render(_templateObject7 || (_templateObject7 = babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t\t<div class=\"", " ", "-", "\">\n\t\t\t\t\t\t", "\n\t\t\t\t\t</div>\n\t\t\t\t"])), className, className, position, this.angleArrowElement), 699 position: position, 700 offset: 0, 701 defaultOffset: Math.max(defaultOffset, angleMinLeft) //Math.max(Type.isNumber(params.offset) ? params.offset : 0, angleMinLeft) 702 703 }; 704 this.getPopupContainer().appendChild(this.angle.element); 705 } 706 707 if (babelHelpers.typeof(params) === 'object' && params.position && ['top', 'right', 'bottom', 'left', 'hide'].includes(params.position)) { 708 main_core.Dom.removeClass(this.angle.element, className + '-' + this.angle.position); 709 main_core.Dom.addClass(this.angle.element, className + '-' + params.position); 710 this.angle.position = params.position; 711 } 712 713 if (babelHelpers.typeof(params) === 'object' && main_core.Type.isNumber(params.offset)) { 714 var offset = params.offset; 715 var minOffset, maxOffset; 716 717 if (this.angle.position === 'top') { 718 minOffset = Popup.getOption('angleMinTop'); 719 maxOffset = this.getPopupContainer().offsetWidth - Popup.getOption('angleMaxTop'); 720 maxOffset = maxOffset < minOffset ? Math.max(minOffset, offset) : maxOffset; 721 this.angle.offset = Math.min(Math.max(minOffset, offset), maxOffset); 722 this.angle.element.style.left = this.angle.offset + 'px'; 723 this.angle.element.style.marginLeft = 0; 724 this.angle.element.style.removeProperty('top'); 725 } else if (this.angle.position === 'bottom') { 726 minOffset = Popup.getOption('angleMinBottom'); 727 maxOffset = this.getPopupContainer().offsetWidth - Popup.getOption('angleMaxBottom'); 728 maxOffset = maxOffset < minOffset ? Math.max(minOffset, offset) : maxOffset; 729 this.angle.offset = Math.min(Math.max(minOffset, offset), maxOffset); 730 this.angle.element.style.marginLeft = this.angle.offset + 'px'; 731 this.angle.element.style.left = 0; 732 this.angle.element.style.removeProperty('top'); 733 } else if (this.angle.position === 'right') { 734 minOffset = Popup.getOption('angleMinRight'); 735 maxOffset = this.getPopupContainer().offsetHeight - Popup.getOption('angleMaxRight'); 736 maxOffset = maxOffset < minOffset ? Math.max(minOffset, offset) : maxOffset; 737 this.angle.offset = Math.min(Math.max(minOffset, offset), maxOffset); 738 this.angle.element.style.top = this.angle.offset + 'px'; 739 this.angle.element.style.removeProperty('left'); 740 this.angle.element.style.removeProperty('margin-left'); 741 } else if (this.angle.position === 'left') { 742 minOffset = Popup.getOption('angleMinLeft'); 743 maxOffset = this.getPopupContainer().offsetHeight - Popup.getOption('angleMaxLeft'); 744 maxOffset = maxOffset < minOffset ? Math.max(minOffset, offset) : maxOffset; 745 this.angle.offset = Math.min(Math.max(minOffset, offset), maxOffset); 746 this.angle.element.style.top = this.angle.offset + 'px'; 747 this.angle.element.style.removeProperty('left'); 748 this.angle.element.style.removeProperty('margin-left'); 749 } 750 } 751 } 752 }, {
753 key: "getWidth", 754 value: function getWidth() { 755 return this.width; 756 } 757 }, { 758 key: "setWidth", 759 value: function setWidth(width) { 760 this.setWidthProperty('width', width); 761 } 762 }, { 763 key: "getHeight", 764 value: function getHeight() { 765 return this.height; 766 } 767 }, { 768 key: "setHeight", 769 value: function setHeight(height) { 770 this.setHeightProperty('height', height); 771 } 772 }, { 773 key: "getMinWidth", 774 value: function getMinWidth() { 775 return this.minWidth; 776 } 777 }, { 778 key: "setMinWidth", 779 value: function setMinWidth(width) { 780 this.setWidthProperty('minWidth', width); 781 } 782 }, { 783 key: "getMinHeight", 784 value: function getMinHeight() { 785 return this.minHeight; 786 } 787 }, { 788 key: "setMinHeight", 789 value: function setMinHeight(height) { 790 this.setHeightProperty('minHeight', height); 791 } 792 }, { 793 key: "getMaxWidth", 794 value: function getMaxWidth() { 795 return this.maxWidth; 796 } 797 }, { 798 key: "setMaxWidth", 799 value: function setMaxWidth(width) { 800 this.setWidthProperty('maxWidth', width); 801 } 802 }, { 803 key: "getMaxHeight", 804 value: function getMaxHeight() { 805 return this.maxHeight; 806 } 807 }, { 808 key: "setMaxHeight", 809 value: function setMaxHeight(height) { 810 this.setHeightProperty('maxHeight', height); 811 } 812 /** 813 * @private 814 */ 815 816 }, { 817 key: "setWidthProperty", 818 value: function setWidthProperty(property, width) { 819 var props = ['width', 'minWidth', 'maxWidth']; 820 821 if (props.indexOf(property) === -1) { 822 return; 823 } 824 825 if (main_core.Type.isNumber(width) && width >= 0) { 826 this[property] = width; 827 this.getResizableContainer().style[property] = width + 'px'; 828 this.getContentContainer().style.overflowX = 'auto'; 829 this.getPopupContainer().classList.add('popup-window-fixed-width'); 830 831 if (this.getTitleContainer() && main_core.Browser.isIE11()) { 832 this.getTitleContainer().style[property] = width + 'px'; 833 } 834 } else if (width === null || width === false) { 835 this[property] = null; 836 this.getResizableContainer().style.removeProperty(main_core.Text.toKebabCase(property)); 837 var hasOtherProps = props.some(function (prop) { 838 return this.getResizableContainer().style.getPropertyValue(main_core.Text.toKebabCase(prop)) !== ''; 839 }, this); 840 841 if (!hasOtherProps) { 842 this.getContentContainer().style.removeProperty('overflow-x'); 843 this.getPopupContainer().classList.remove('popup-window-fixed-width'); 844 } 845 846 if (this.getTitleContainer() && main_core.Browser.isIE11()) { 847 this.getTitleContainer().style.removeProperty(main_core.Text.toKebabCase(property)); 848 } 849 } 850 } 851 /** 852 * @private 853 */ 854 855 }, { 856 key: "setHeightProperty", 857 value: function setHeightProperty(property, height) { 858 var props = ['height', 'minHeight', 'maxHeight']; 859 860 if (props.indexOf(property) === -1) { 861 return; 862 } 863 864 if (main_core.Type.isNumber(height) && height >= 0) { 865 this[property] = height; 866 this.getResizableContainer().style[property] = height + 'px'; 867 this.getContentContainer().style.overflowY = 'auto'; 868 this.getPopupContainer().classList.add('popup-window-fixed-height'); 869 } else if (height === null || height === false) { 870 this[property] = null; 871 this.getResizableContainer().style.removeProperty(main_core.Text.toKebabCase(property)); 872 var hasOtherProps = props.some(function (prop) { 873 return this.getResizableContainer().style.getPropertyValue(main_core.Text.toKebabCase(prop)) !== ''; 874 }, this); 875 876 if (!hasOtherProps) { 877 this.getContentContainer().style.removeProperty('overflow-y'); 878 this.getPopupContainer().classList.remove('popup-window-fixed-height'); 879 } 880 } 881 } 882 }, { 883 key: "setPadding", 884 value: function setPadding(padding) { 885 if (main_core.Type.isNumber(padding) && padding >= 0) { 886 this.padding = padding; 887 this.getPopupContainer().style.padding = padding + 'px'; 888 } else if (padding === null) { 889 this.padding = null; 890 this.getPopupContainer().style.removeProperty('padding'); 891 } 892 } 893 }, { 894 key: "getPadding", 895 value: function getPadding() { 896 return this.padding; 897 } 898 }, { 899 key: "setContentPadding", 900 value: function setContentPadding(padding) { 901 if (main_core.Type.isNumber(padding) && padding >= 0) { 902 this.contentPadding = padding; 903 this.getContentContainer().style.padding = padding + 'px'; 904 } else if (padding === null) { 905 this.contentPadding = null; 906 this.getContentContainer().style.removeProperty('padding'); 907 } 908 } 909 }, { 910 key: "getContentPadding", 911 value: function getContentPadding() { 912 return this.contentPadding; 913 } 914 }, { 915 key: "setContentColor", 916 value: function setContentColor(color) { 917 if (main_core.Type.isString(color) && this.contentContainer) { 918 this.contentContainer.style.backgroundColor = color; 919 } else if (color === null) { 920 this.contentContainer.style.style.removeProperty('background-color'); 921 } 922 } 923 }, {
924 key: "setBackground", 925 value: function setBackground(background) { 926 if (main_core.Type.isStringFilled(background)) { 927 this.background = background; 928 this.getPopupContainer().style.background = background; 929 930 if (this.angleArrowElement) { 931 this.angleArrowElement.style.background = background; 932 } 933 } else if (background === null) { 934 this.background = null; 935 this.getPopupContainer().style.removeProperty('background'); 936 937 if (this.angleArrowElement) { 938 this.angleArrowElement.style.removeProperty('background'); 939 } 940 } 941 } 942 }, { 943 key: "getBackground", 944 value: function getBackground() { 945 return this.background; 946 } 947 }, { 948 key: "setContentBackground", 949 value: function setContentBackground(background) { 950 if (main_core.Type.isStringFilled(background)) { 951 this.contentBackground = background; 952 this.getContentContainer().style.background = background; 953 } else if (background === null) { 954 this.contentBackground = null; 955 this.getContentContainer().style.removeProperty('background'); 956 } 957 } 958 }, { 959 key: "getContentBackground", 960 value: function getContentBackground() { 961 return this.contentBackground; 962 } 963 }, { 964 key: "isDestroyed", 965 value: function isDestroyed() { 966 return this.destroyed; 967 } 968 }, { 969 key: "setCacheable", 970 value: function setCacheable(cacheable) { 971 this.cacheable = cacheable !== false; 972 } 973 }, { 974 key: "isCacheable", 975 value: function isCacheable() { 976 return this.cacheable; 977 } 978 }, { 979 key: "setToFrontOnShow", 980 value: function setToFrontOnShow(flag) { 981 this.toFrontOnShow = flag !== false; 982 } 983 }, { 984 key: "shouldFrontOnShow", 985 value: function shouldFrontOnShow() { 986 return this.toFrontOnShow; 987 } 988 }, { 989 key: "setResizeMode", 990 value: function setResizeMode(mode) { 991 if (mode === true || main_core.Type.isPlainObject(mode)) { 992 if (!this.resizeIcon) { 993 this.resizeIcon = main_core.Tag.render(_templateObject8 || (_templateObject8 = babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t\t<div class=\"popup-window-resize\" onmousedown=\"", "\"></div>\n\t\t\t\t"])), this.handleResizeMouseDown.bind(this)); 994 this.getPopupContainer().appendChild(this.resizeIcon); 995 } //Compatibility 996 997 998 this.setMinWidth(mode.minWidth); 999 this.setMinHeight(mode.minHeight); 1000 } else if (mode === false && this.resizeIcon) { 1001 main_core.Dom.remove(this.resizeIcon); 1002 this.resizeIcon = null; 1003 } 1004 } 1005 }, { 1006 key: "getTargetContainer", 1007 value: function getTargetContainer() { 1008 return this.targetContainer; 1009 } 1010 }, { 1011 key: "isTargetDocumentBody", 1012 value: function isTargetDocumentBody() { 1013 return this.getTargetContainer() === document.body; 1014 } 1015 }, { 1016 key: "getPopupContainer", 1017 value: function getPopupContainer() { 1018 return this.popupContainer; 1019 } 1020 }, { 1021 key: "getContentContainer", 1022 value: function getContentContainer() { 1023 return this.contentContainer; 1024 } 1025 }, { 1026 key: "getResizableContainer", 1027 value: function getResizableContainer() { 1028 return main_core.Browser.isIE11() ? this.getContentContainer() : this.getPopupContainer(); 1029 } 1030 }, { 1031 key: "getTitleContainer", 1032 value: function getTitleContainer() { 1033 return this.titleBar; 1034 } 1035 /** 1036 * @private 1037 */ 1038 1039 }, { 1040 key: "onTitleMouseDown", 1041 value: function onTitleMouseDown(event) { 1042 this._startDrag(event, { 1043 cursor: 'move', 1044 callback: this.handleMove, 1045 eventName: 'Drag' 1046 }); 1047 } 1048 /** 1049 * @private 1050 */ 1051 1052 }, { 1053 key: "handleResizeMouseDown", 1054 value: function handleResizeMouseDown(event) { 1055 this._startDrag(event, { 1056 cursor: 'nwse-resize', 1057 eventName: 'Resize', 1058 callback: this.handleResize 1059 }); 1060 1061 if (this.isTargetDocumentBody()) { 1062 this.resizeContentPos = main_core.Dom.getPosition(this.getResizableContainer()); 1063 this.resizeContentOffset = this.resizeContentPos.left - main_core.Dom.getPosition(this.getPopupContainer()).left; 1064 } else { 1065 this.resizeContentPos = this.getPositionRelativeToTarget(this.getResizableContainer()); 1066 this.resizeContentOffset = this.resizeContentPos.left - this.getPositionRelativeToTarget(this.getPopupContainer()).left; 1067 } 1068 1069 this.resizeContentPos.offsetX = 0; 1070 this.resizeContentPos.offsetY = 0; 1071 } 1072 /** 1073 * @private 1074 */ 1075 1076 }, { 1077 key: "handleResize", 1078 value: function handleResize(offsetX, offsetY, pageX, pageY) { 1079 this.resizeContentPos.offsetX += offsetX; 1080 this.resizeContentPos.offsetY += offsetY; 1081 var width = this.resizeContentPos.width + this.resizeContentPos.offsetX; 1082 var height = this.resizeContentPos.height + this.resizeContentPos.offsetY; 1083 var scrollWidth = this.isTargetDocumentBody() ? document.documentElement.scrollWidth : this.getTargetContainer().scrollWidth; 1084 1085 if (this.resizeContentPos.left + width + this.resizeContentOffset >= scrollWidth) { 1086 width = scrollWidth - this.resizeContentPos.left - this.resizeContentOffset; 1087 } 1088 1089 width = Math.max(width, this.getMinWidth()); 1090 height = Math.max(height, this.getMinHeight()); 1091 1092 if (this.getMaxWidth() !== null) { 1093 width = Math.min(width, this.getMaxWidth()); 1094 } 1095 1096 if (this.getMaxHeight() !== null) { 1097 height = Math.min(height, this.getMaxHeight()); 1098 } 1099 1100 this.setWidth(width); 1101 this.setHeight(height); 1102 } 1103 }, { 1104 key: "isTopAngle", 1105 value: function isTopAngle() { 1106 return this.angle !== null && this.angle.position === 'top'; 1107 } 1108 }, { 1109 key: "isBottomAngle", 1110 value: function isBottomAngle() { 1111 return this.angle !== null && this.angle.position === 'bottom'; 1112 } 1113 }, { 1114 key: "isTopOrBottomAngle", 1115 value: function isTopOrBottomAngle() { 1116 return this.angle !== null && (this.angle.position === 'top' || this.angle.position === 'bottom'); 1117 } 1118 /** 1119 * @private 1120 */ 1121 1122 }, { 1123 key: "getAngleHeight", 1124 value: function getAngleHeight() { 1125 return this.isTopOrBottomAngle() ? Popup.getOption('angleTopOffset') : 0; 1126 } 1127 }, { 1128 key: "setOffset", 1129 value: function setOffset(params) { 1130 if (!main_core.Type.isPlainObject(params)) { 1131 return; 1132 } 1133 1134 if (main_core.Type.isNumber(params.offsetLeft)) { 1135 this.offsetLeft = params.offsetLeft + Popup.getOption('offsetLeft'); 1136 } 1137 1138 if (main_core.Type.isNumber(params.offsetTop)) { 1139 this.offsetTop = params.offsetTop + Popup.getOption('offsetTop'); 1140 } 1141 } 1142 }, { 1143 key: "setTitleBar", 1144 value: function setTitleBar(params) { 1145 if (!this.titleBar) { 1146 return; 1147 } 1148 1149 if (babelHelpers.typeof(params) === 'object' && main_core.Type.isDomNode(params.content)) { 1150 this.titleBar.innerHTML = ''; 1151 this.titleBar.appendChild(params.content); 1152 } else if (typeof params === 'string') { 1153 this.titleBar.innerHTML = ''; 1154 this.titleBar.appendChild(main_core.Dom.create('span', { 1155 props: { 1156 className: 'popup-window-titlebar-text' 1157 }, 1158 text: params 1159 })); 1160 } 1161 1162 if (this.params.draggable) { 1163 this.titleBar.style.cursor = 'move'; 1164 main_core.Event.bind(this.titleBar, 'mousedown', this.onTitleMouseDown); 1165 } 1166 } 1167 }, { 1168 key: "setClosingByEsc", 1169 value: function setClosingByEsc(enable) { 1170 enable = main_core.Type.isBoolean(enable) ? enable : true; 1171 1172 if (enable) { 1173 this.closeByEsc = true; 1174 this.bindClosingByEsc(); 1175 } else { 1176 this.closeByEsc = false;
1177 this.unbindClosingByEsc(); 1178 } 1179 } 1180 /** 1181 * @private 1182 */ 1183 1184 }, { 1185 key: "bindClosingByEsc", 1186 value: function bindClosingByEsc() { 1187 if (this.closeByEsc && !this.isCloseByEscBinded) { 1188 main_core.Event.bind(document, 'keyup', this.handleDocumentKeyUp); 1189 this.isCloseByEscBinded = true; 1190 } 1191 } 1192 /** 1193 * @private 1194 */ 1195 1196 }, { 1197 key: "unbindClosingByEsc", 1198 value: function unbindClosingByEsc() { 1199 if (this.isCloseByEscBinded) { 1200 main_core.Event.unbind(document, 'keyup', this.handleDocumentKeyUp); 1201 this.isCloseByEscBinded = false; 1202 } 1203 } 1204 }, { 1205 key: "setAutoHide", 1206 value: function setAutoHide(enable) { 1207 enable = main_core.Type.isBoolean(enable) ? enable : true; 1208 1209 if (enable) { 1210 this.autoHide = true; 1211 this.bindAutoHide(); 1212 } else { 1213 this.autoHide = false; 1214 this.unbindAutoHide(); 1215 } 1216 } 1217 /** 1218 * @private 1219 */ 1220 1221 }, { 1222 key: "bindAutoHide", 1223 value: function bindAutoHide() { 1224 if (this.autoHide && !this.isAutoHideBinded && this.isShown()) { 1225 this.isAutoHideBinded = true; 1226 1227 if (this.isCompatibleMode()) { 1228 main_core.Event.bind(this.getPopupContainer(), 'click', this.handleContainerClick); 1229 } 1230 1231 if (this.overlay && this.overlay.element) { 1232 main_core.Event.bind(this.overlay.element, 'click', this.handleOverlayClick); 1233 } else { 1234 if (this.isCompatibleMode()) { 1235 main_core.Event.bind(document, 'click', this.handleAutoHide); 1236 } else { 1237 document.addEventListener('click', this.handleAutoHide, true); 1238 } 1239 } 1240 } 1241 } 1242 /** 1243 * @private 1244 */ 1245 1246 }, { 1247 key: "unbindAutoHide", 1248 value: function unbindAutoHide() { 1249 if (this.isAutoHideBinded) { 1250 this.isAutoHideBinded = false; 1251 1252 if (this.isCompatibleMode()) { 1253 main_core.Event.unbind(this.getPopupContainer(), 'click', this.handleContainerClick); 1254 } 1255 1256 if (this.overlay && this.overlay.element) { 1257 main_core.Event.unbind(this.overlay.element, 'click', this.handleOverlayClick); 1258 } else { 1259 if (this.isCompatibleMode()) { 1260 main_core.Event.unbind(document, 'click', this.handleAutoHide); 1261 } else { 1262 document.removeEventListener('click', this.handleAutoHide, true); 1263 } 1264 } 1265 } 1266 } 1267 /** 1268 * @private 1269 */ 1270 1271 }, { 1272 key: "handleAutoHide", 1273 value: function handleAutoHide(event) { 1274 if (this.isDestroyed()) { 1275 return; 1276 } 1277 1278 if (this.autoHideHandler !== null) { 1279 if (this.autoHideHandler(event)) { 1280 this._tryCloseByEvent(event); 1281 } 1282 } else if (event.target !== this.getPopupContainer() && !this.getPopupContainer().contains(event.target)) { 1283 this._tryCloseByEvent(event); 1284 } 1285 } 1286 /** 1287 * @private 1288 */ 1289 1290 }, { 1291 key: "_tryCloseByEvent", 1292 value: function _tryCloseByEvent(event) { 1293 var _this2 = this; 1294 1295 if (this.isCompatibleMode()) { 1296 this.tryCloseByEvent(event); 1297 } else { 1298 setTimeout(function () { 1299 _this2.tryCloseByEvent(event); 1300 }, 0); 1301 } 1302 } 1303 /** 1304 * @private 1305 */ 1306 1307 }, { 1308 key: "tryCloseByEvent", 1309 value: function tryCloseByEvent(event) { 1310 if (event.button === 0) { 1311 this.close(); 1312 } 1313 } 1314 /** 1315 * @private 1316 */ 1317 1318 }, { 1319 key: "handleOverlayClick", 1320 value: function handleOverlayClick(event) { 1321 this.tryCloseByEvent(event); 1322 event.stopPropagation(); 1323 } 1324 }, { 1325 key: "setOverlay", 1326 value: function setOverlay(params) { 1327 if (this.overlay === null) { 1328 this.overlay = { 1329 element: main_core.Tag.render(_templateObject9 || (_templateObject9 = babelHelpers.taggedTemplateLiteral(["\n\t\t\t\t\t<div class=\"popup-window-overlay\" id=\"popup-window-overlay-", "\"></div>\n\t\t\t\t"])), this.getId()) 1330 }; 1331 this.resizeOverlay(); 1332 this.targetContainer.appendChild(this.overlay.element); 1333 this.getZIndexComponent().setOverlay(this.overlay.element); 1334 } 1335 1336 if (params && main_core.Type.isNumber(params.opacity) && params.opacity >= 0 && params.opacity <= 100) { 1337 this.overlay.element.style.opacity = parseFloat(params.opacity / 100).toPrecision(3); 1338 } 1339 1340 if (params && params.backgroundColor) { 1341 this.overlay.element.style.backgroundColor = params.backgroundColor; 1342 } 1343 } 1344 }, { 1345 key: "removeOverlay", 1346 value: function removeOverlay() { 1347 if (this.overlay !== null && this.overlay.element !== null) { 1348 main_core.Dom.remove(this.overlay.element); 1349 this.getZIndexComponent().setOverlay(null); 1350 } 1351 1352 if (this.overlayTimeout) { 1353 clearInterval(this.overlayTimeout); 1354 this.overlayTimeout = null; 1355 } 1356
1357 this.overlay = null; 1358 } 1359 }, { 1360 key: "hideOverlay", 1361 value: function hideOverlay() { 1362 if (this.overlay !== null && this.overlay.element !== null) { 1363 if (this.overlayTimeout) { 1364 clearInterval(this.overlayTimeout); 1365 this.overlayTimeout = null; 1366 } 1367 1368 this.overlay.element.style.display = 'none'; 1369 } 1370 } 1371 }, { 1372 key: "showOverlay", 1373 value: function showOverlay() { 1374 var _this3 = this; 1375 1376 if (this.overlay !== null && this.overlay.element !== null) { 1377 this.overlay.element.style.display = 'block'; 1378 var popupHeight = this.getPopupContainer().offsetHeight; 1379 this.overlayTimeout = setInterval(function () { 1380 if (popupHeight !== _this3.getPopupContainer().offsetHeight) { 1381 _this3.resizeOverlay(); 1382 1383 popupHeight = _this3.getPopupContainer().offsetHeight; 1384 } 1385 }, 1000); 1386 } 1387 } 1388 }, { 1389 key: "resizeOverlay", 1390 value: function resizeOverlay() { 1391 if (this.overlay !== null && this.overlay.element !== null) { 1392 var scrollWidth; 1393 var scrollHeight; 1394 1395 if (this.isTargetDocumentBody()) { 1396 scrollWidth = document.documentElement.scrollWidth; 1397 scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight, document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight); 1398 } else { 1399 scrollWidth = this.getTargetContainer().scrollWidth; 1400 scrollHeight = this.getTargetContainer().scrollHeight; 1401 } 1402 1403 this.overlay.element.style.width = scrollWidth + 'px'; 1404 this.overlay.element.style.height = scrollHeight + 'px'; 1405 } 1406 } 1407 }, { 1408 key: "getZindex", 1409 value: function getZindex() { 1410 return this.getZIndexComponent().getZIndex(); 1411 } 1412 }, { 1413 key: "getZIndexComponent", 1414 value: function getZIndexComponent() { 1415 return this.zIndexComponent; 1416 } 1417 }, { 1418 key: "show", 1419 value: function show() { 1420 var _this4 = this; 1421 1422 if (this.isShown() || this.isDestroyed()) { 1423 return; 1424 } 1425 1426 this.emit('onBeforeShow'); 1427 this.showOverlay(); 1428 this.getPopupContainer().style.display = 'block'; 1429 1430 if (this.shouldFrontOnShow()) { 1431 this.bringToFront(); 1432 } 1433 1434 if (!this.firstShow) { 1435 this.emit('onFirstShow', new main_core_events.BaseEvent({ 1436 compatData: [this] 1437 })); 1438 this.firstShow = true; 1439 } 1440 1441 this.emit('onShow', new main_core_events.BaseEvent({ 1442 compatData: [this] 1443 })); 1444 this.adjustPosition(); 1445 this.animateOpening(function () { 1446 if (_this4.isDestroyed()) { 1447 return; 1448 } 1449 1450 main_core.Dom.removeClass(_this4.getPopupContainer(), _this4.animationShowClassName); 1451 1452 _this4.emit('onAfterShow', new main_core_events.BaseEvent({ 1453 compatData: [_this4] 1454 })); 1455 }); 1456 this.bindClosingByEsc(); 1457 1458 if (this.isCompatibleMode()) { 1459 setTimeout(function () { 1460 _this4.bindAutoHide(); 1461 }, 100); 1462 } else { 1463 this.bindAutoHide(); 1464 } 1465 } 1466 }, { 1467 key: "close", 1468 value: function close() { 1469 var _this5 = this; 1470 1471 if (this.isDestroyed() || !this.isShown()) { 1472 return; 1473 } 1474 1475 this.emit('onClose', new main_core_events.BaseEvent({ 1476 compatData: [this] 1477 })); 1478 1479 if (this.isDestroyed()) { 1480 return; 1481 } 1482 1483 this.animateClosing(function () { 1484 if (_this5.isDestroyed()) { 1485 return; 1486 } 1487 1488 _this5.hideOverlay(); 1489 1490 _this5.getPopupContainer().style.display = 'none'; 1491 main_core.Dom.removeClass(_this5.getPopupContainer(), _this5.animationCloseClassName); 1492 1493 _this5.unbindClosingByEsc(); 1494 1495 if (_this5.isCompatibleMode()) { 1496 setTimeout(function () { 1497 _this5.unbindAutoHide(); 1498 }, 0); 1499 } else { 1500 _this5.unbindAutoHide(); 1501 } 1502 1503 _this5.emit('onAfterClose', new main_core_events.BaseEvent({ 1504 compatData: [_this5] 1505 })); 1506 1507 if (!_this5.isCacheable()) { 1508 _this5.destroy(); 1509 } 1510 }); 1511 } 1512 }, { 1513 key: "bringToFront", 1514 value: function bringToFront() { 1515 if (this.isShown()) { 1516 main_core_zIndexManager.ZIndexManager.bringToFront(this.getPopupContainer()); 1517 } 1518 } 1519 }, { 1520 key: "toggle",
1521 value: function toggle() { 1522 this.isShown() ? this.close() : this.show(); 1523 } 1524 /** 1525 * 1526 * @private 1527 */ 1528 1529 }, { 1530 key: "animateOpening", 1531 value: function animateOpening(callback) { 1532 main_core.Dom.removeClass(this.getPopupContainer(), this.animationCloseClassName); 1533 1534 if (this.animationShowClassName !== null) { 1535 main_core.Dom.addClass(this.getPopupContainer(), this.animationShowClassName); 1536 1537 if (this.animationCloseEventType !== null) { 1538 var eventName = this.animationCloseEventType + 'end'; 1539 this.getPopupContainer().addEventListener(eventName, function handleTransitionEnd() { 1540 this.removeEventListener(eventName, handleTransitionEnd); 1541 callback(); 1542 }); 1543 } else { 1544 callback(); 1545 } 1546 } else { 1547 callback(); 1548 } 1549 } 1550 /** 1551 * @private 1552 */ 1553 1554 }, { 1555 key: "animateClosing", 1556 value: function animateClosing(callback) { 1557 main_core.Dom.removeClass(this.getPopupContainer(), this.animationShowClassName); 1558 1559 if (this.animationCloseClassName !== null) { 1560 main_core.Dom.addClass(this.getPopupContainer(), this.animationCloseClassName); 1561 1562 if (this.animationCloseEventType !== null) { 1563 var eventName = this.animationCloseEventType + 'end'; 1564 this.getPopupContainer().addEventListener(eventName, function handleTransitionEnd() { 1565 this.removeEventListener(eventName, handleTransitionEnd); 1566 callback(); 1567 }); 1568 } else { 1569 callback(); 1570 } 1571 } else { 1572 callback(); 1573 } 1574 } 1575 }, { 1576 key: "setAnimation", 1577 value: function setAnimation(options) { 1578 if (main_core.Type.isPlainObject(options)) { 1579 this.animationShowClassName = main_core.Type.isStringFilled(options.showClassName) ? options.showClassName : null; 1580 this.animationCloseClassName = main_core.Type.isStringFilled(options.closeClassName) ? options.closeClassName : null; 1581 this.animationCloseEventType = options.closeAnimationType === 'animation' || options.closeAnimationType === 'transition' ? options.closeAnimationType : null; 1582 } else if (main_core.Type.isStringFilled(options)) { 1583 var animationName = options; 1584 1585 if (animationName === 'fading') { 1586 this.animationShowClassName = 'popup-window-show-animation-opacity'; 1587 this.animationCloseClassName = 'popup-window-close-animation-opacity'; 1588 this.animationCloseEventType = 'animation'; 1589 } else if (animationName === 'fading-slide') { 1590 this.animationShowClassName = 'popup-window-show-animation-opacity-transform'; 1591 this.animationCloseClassName = 'popup-window-close-animation-opacity'; 1592 this.animationCloseEventType = 'animation'; 1593 } else if (animationName === 'scale') { 1594 this.animationShowClassName = 'popup-window-show-animation-scale'; 1595 this.animationCloseClassName = 'popup-window-close-animation-opacity'; 1596 this.animationCloseEventType = 'animation'; 1597 } 1598 } else if (options === false || options === null) { 1599 this.animationShowClassName = null; 1600 this.animationCloseClassName = null; 1601 this.animationCloseEventType = null; 1602 } 1603 } 1604 }, { 1605 key: "isShown", 1606 value: function isShown() { 1607 return !this.isDestroyed() && this.getPopupContainer().style.display === 'block'; 1608 } 1609 }, { 1610 key: "destroy", 1611 value: function destroy() { 1612 var _this6 = this; 1613 1614 if (this.destroyed) { 1615 return; 1616 } 1617 1618 this.destroyed = true; 1619 this.emit('onDestroy', new main_core_events.BaseEvent({ 1620 compatData: [this] 1621 })); 1622 this.unbindClosingByEsc(); 1623 1624 if (this.isCompatibleMode()) { 1625 setTimeout(function () { 1626 _this6.unbindAutoHide(); 1627 }, 0); 1628 } else { 1629 this.unbindAutoHide(); 1630 } 1631 1632 main_core.Event.unbindAll(this); 1633 main_core.Event.unbind(document, 'mousemove', this.handleDocumentMouseMove); 1634 main_core.Event.unbind(document, 'mouseup', this.handleDocumentMouseUp); 1635 main_core.Event.unbind(window, 'resize', this.handleResizeWindow); 1636 this.removeOverlay(); 1637 main_core_zIndexManager.ZIndexManager.unregister(this.popupContainer); 1638 this.zIndexComponent = null; 1639 main_core.Dom.remove(this.popupContainer); 1640 this.popupContainer = null; 1641 this.contentContainer = null; 1642 this.closeIcon = null; 1643 this.titleBar = null; 1644 this.buttonsContainer = null; 1645 this.angle = null; 1646 this.angleArrowElement = null; 1647 this.resizeIcon = null; 1648 } 1649 }, { 1650 key: "adjustPosition", 1651 value: function adjustPosition(bindOptions) { 1652 if (bindOptions && babelHelpers.typeof(bindOptions) === 'object') { 1653 this.bindOptions = bindOptions; 1654 } 1655 1656 var bindElementPos = this.getBindElementPos(this.bindElement); 1657 1658 if (!this.bindOptions.forceBindPosition && this.bindElementPos !== null && bindElementPos.top === this.bindElementPos.top && bindElementPos.left === this.bindElementPos.left) { 1659 return; 1660 } 1661 1662 this.bindElementPos = bindElementPos; 1663 var windowSize = bindElementPos.windowSize ? bindElementPos.windowSize : this.getWindowSize(); 1664 var windowScroll = bindElementPos.windowScroll ? bindElementPos.windowScroll : this.getWindowScroll(); 1665 var popupWidth = bindElementPos.popupWidth ? bindElementPos.popupWidth : this.popupContainer.offsetWidth; 1666 var popupHeight = bindElementPos.popupHeight ? bindElementPos.popupHeight : this.popupContainer.offsetHeight; 1667 var angleTopOffset = Popup.getOption('angleTopOffset'); 1668 var left = this.bindElementPos.left + this.offsetLeft - (this.isTopOrBottomAngle() ? Popup.getOption('angleLeftOffset') : 0); 1669 1670 if (!this.bindOptions.forceLeft && left + popupWidth + this.bordersWidth >= windowSize.innerWidth + windowScroll.scrollLeft && windowSize.innerWidth + windowScroll.scrollLeft - popupWidth - this.bordersWidth > 0) { 1671 var bindLeft = left; 1672 left = windowSize.innerWidth + windowScroll.scrollLeft - popupWidth - this.bordersWidth; 1673 1674 if (this.isTopOrBottomAngle()) { 1675 this.setAngle({ 1676 offset: bindLeft - left + this.angle.defaultOffset 1677 }); 1678 } 1679 } else if (this.isTopOrBottomAngle()) { 1680 this.setAngle({ 1681 offset: this.angle.defaultOffset + (left < 0 ? left : 0) 1682 }); 1683 } 1684 1685 if (left < 0) { 1686 left = 0; 1687 } 1688 1689 var top = 0; 1690 1691 if (this.bindOptions.position && this.bindOptions.position === 'top') { 1692 top = this.bindElementPos.top - popupHeight - this.offsetTop - (this.isBottomAngle() ? angleTopOffset : 0); 1693 1694 if (top < 0 || !this.bindOptions.forceTop && top < windowScroll.scrollTop) { 1695 top = this.bindElementPos.bottom + this.offsetTop; 1696 1697 if (this.angle !== null) { 1698 top += angleTopOffset; 1699 this.setAngle({ 1700 position: 'top' 1701 }); 1702 } 1703 } else if (this.isTopAngle()) { 1704 top = top - angleTopOffset + Popup.getOption('positionTopXOffset'); 1705 this.setAngle({ 1706 position: 'bottom' 1707 }); 1708 } else { 1709 top += Popup.getOption('positionTopXOffset'); 1710 } 1711 } else { 1712 top = this.bindElementPos.bottom + this.offsetTop + this.getAngleHeight(); 1713 1714 if (!this.bindOptions.forceTop && top + popupHeight >
1714 windowSize.innerHeight + windowScroll.scrollTop && this.bindElementPos.top - popupHeight - this.getAngleHeight() >= 0) //Can we place the PopupWindow above the bindElement? 1715 { 1716 //The PopupWindow doesn't place below the bindElement. We should place it above. 1717 top = this.bindElementPos.top - popupHeight; 1718 1719 if (this.isTopOrBottomAngle()) { 1720 top -= angleTopOffset; 1721 this.setAngle({ 1722 position: 'bottom' 1723 }); 1724 } 1725 1726 top += Popup.getOption('positionTopXOffset'); 1727 } else if (this.isBottomAngle()) { 1728 top += angleTopOffset; 1729 this.setAngle({ 1730 position: 'top' 1731 }); 1732 } 1733 } 1734 1735 if (top < 0) { 1736 top = 0; 1737 } 1738 1739 var event = new PositionEvent(); 1740 event.left = left; 1741 event.top = top; 1742 this.emit('onBeforeAdjustPosition', event); 1743 main_core.Dom.adjust(this.popupContainer, { 1744 style: { 1745 top: event.top + 'px', 1746 left: event.left + 'px' 1747 } 1748 }); 1749 } 1750 }, { 1751 key: "enterFullScreen", 1752 value: function enterFullScreen() { 1753 if (Popup.fullscreenStatus) { 1754 if (document.cancelFullScreen) { 1755 document.cancelFullScreen(); 1756 } else if (document.mozCancelFullScreen) { 1757 document.mozCancelFullScreen(); 1758 } else if (document.webkitCancelFullScreen) { 1759 document.webkitCancelFullScreen(); 1760 } 1761 } else { 1762 if (this.contentContainer.requestFullScreen) { 1763 this.contentContainer.requestFullScreen(); 1764 main_core.Event.bind(window, 'fullscreenchange', this.handleFullScreen); 1765 } else if (this.contentContainer.mozRequestFullScreen) { 1766 this.contentContainer.mozRequestFullScreen(); 1767 main_core.Event.bind(window, 'mozfullscreenchange', this.handleFullScreen); 1768 } else if (this.contentContainer.webkitRequestFullScreen) { 1769 this.contentContainer.webkitRequestFullScreen(); 1770 main_core.Event.bind(window, 'webkitfullscreenchange', this.handleFullScreen); 1771 } else { 1772 console.log('fullscreen mode is not supported'); 1773 } 1774 } 1775 } 1776 /** 1777 * @private 1778 */ 1779 1780 }, { 1781 key: "handleFullScreen", 1782 value: function handleFullScreen(event) { 1783 if (Popup.fullscreenStatus) { 1784 main_core.Event.unbind(window, 'fullscreenchange', this.handleFullScreen); 1785 main_core.Event.unbind(window, 'webkitfullscreenchange', this.handleFullScreen); 1786 main_core.Event.unbind(window, 'mozfullscreenchange', this.handleFullScreen); 1787 Popup.fullscreenStatus = false; 1788 1789 if (!this.isDestroyed()) { 1790 main_core.Dom.removeClass(this.contentContainer, 'popup-window-fullscreen'); 1791 this.emit('onFullscreenLeave'); 1792 this.adjustPosition(); 1793 } 1794 } else { 1795 Popup.fullscreenStatus = true; 1796 1797 if (!this.isDestroyed()) { 1798 main_core.Dom.addClass(this.contentContainer, 'popup-window-fullscreen'); 1799 this.emit('onFullscreenEnter'); 1800 this.adjustPosition(); 1801 } 1802 } 1803 } 1804 /** 1805 * @private 1806 */ 1807 1808 }, { 1809 key: "handleCloseIconClick", 1810 value: function handleCloseIconClick(event) { 1811 this.tryCloseByEvent(event); 1812 event.stopPropagation(); 1813 } 1814 /** 1815 * @private 1816 */ 1817 1818 }, { 1819 key: "handleContainerClick", 1820 value: function handleContainerClick(event) { 1821 event.stopPropagation(); 1822 } 1823 /** 1824 * @private 1825 */ 1826 1827 }, { 1828 key: "handleDocumentKeyUp", 1829 value: function handleDocumentKeyUp(event) { 1830 var _this7 = this; 1831 1832 if (event.keyCode === 27) { 1833 checkEscPressed(this.getZindex(), function () { 1834 _this7.close(); 1835 }); 1836 } 1837 } 1838 /** 1839 * @private 1840 */ 1841 1842 }, { 1843 key: "handleResizeWindow", 1844 value: function handleResizeWindow() { 1845 if (this.isShown()) { 1846 this.adjustPosition(); 1847 1848 if (this.overlay !== null) { 1849 this.resizeOverlay(); 1850 } 1851 } 1852 } 1853 /** 1854 * @private 1855 */ 1856 1857 }, { 1858 key: "handleMove", 1859 value: function handleMove(offsetX, offsetY, pageX, pageY) { 1860 var left = parseInt(this.popupContainer.style.left) + offsetX; 1861 var top = parseInt(this.popupContainer.style.top) + offsetY; 1862 1863 if (babelHelpers.typeof(this.params.draggable) === 'object' && this.params.draggable.restrict) { 1864 //Left side 1865 if (left < 0) { 1866 left = 0; 1867 } 1868 1869 var scrollWidth; 1870 var scrollHeight; 1871 1872 if (this.isTargetDocumentBody()) { 1873 scrollWidth = document.documentElement.scrollWidth; 1874 scrollHeight = document.documentElement.scrollHeight; 1875 } else { 1876 scrollWidth = this.getTargetContainer().scrollWidth; 1877 scrollHeight = this.getTargetContainer().scrollHeight; 1878 } //Right side 1879 1880 1881 var floatWidth = this.popupContainer.offsetWidth; 1882 var floatHeight = this.popupContainer.offsetHeight; 1883 1884 if (left > scrollWidth - floatWidth) { 1885 left = scrollWidth - floatWidth; 1886 } 1887 1888 if (top > scrollHeight - floatHeight) { 1889 top = scrollHeight - floatHeight; 1890 } //Top side 1891 1892 1893 if (top < 0) { 1894 top = 0; 1895 } 1896 } 1897 1898 this.popupContainer.style.left = left + 'px'; 1899 this.popupContainer.style.top = top + 'px'; 1900 } 1901 /** 1902 * @private 1903 */ 1904 1905 }, { 1906 key: "_startDrag", 1907 value: function _startDrag(event, options) { 1908 options = options || {}; 1909 1910 if (main_core.Type.isStringFilled(options.cursor)) { 1911 this.dragOptions.cursor = options.cursor; 1912 } 1913 1914 if (main_core.Type.isStringFilled(options.eventName)) { 1915 this.dragOptions.eventName = options.eventName; 1916 } 1917 1918 if (main_core.Type.isFunction(options.callback)) { 1919 this.dragOptions.callback = options.callback; 1920 } 1921 1922 this.dragPageX = event.pageX; 1923 this.dragPageY = event.pageY; 1924 this.dragged = false;
1925 main_core.Event.bind(document, 'mousemove', this.handleDocumentMouseMove); 1926 main_core.Event.bind(document, 'mouseup', this.handleDocumentMouseUp); 1927 1928 if (document.body.setCapture) { 1929 document.body.setCapture(); 1930 } 1931 1932 document.body.ondrag = function () { 1933 return false; 1934 }; 1935 1936 document.body.onselectstart = function () { 1937 return false; 1938 }; 1939 1940 document.body.style.cursor = this.dragOptions.cursor; 1941 document.body.style.MozUserSelect = 'none'; 1942 this.popupContainer.style.MozUserSelect = 'none'; 1943 1944 if (this.shouldFrontOnShow()) { 1945 this.bringToFront(); 1946 } 1947 1948 event.preventDefault(); 1949 } 1950 /** 1951 * @private 1952 */ 1953 1954 }, { 1955 key: "handleDocumentMouseMove", 1956 value: function handleDocumentMouseMove(event) { 1957 if (this.dragPageX === event.pageX && this.dragPageY === event.pageY) { 1958 return; 1959 } 1960 1961 this.dragOptions.callback(event.pageX - this.dragPageX, event.pageY - this.dragPageY, event.pageX, event.pageY); 1962 this.dragPageX = event.pageX; 1963 this.dragPageY = event.pageY; 1964 1965 if (!this.dragged) { 1966 this.emit("on".concat(this.dragOptions.eventName, "Start"), new main_core_events.BaseEvent({ 1967 compatData: [this] 1968 })); 1969 this.dragged = true; 1970 } 1971 1972 this.emit("on".concat(this.dragOptions.eventName), new main_core_events.BaseEvent({ 1973 compatData: [this] 1974 })); 1975 } 1976 /** 1977 * @private 1978 */ 1979 1980 }, { 1981 key: "handleDocumentMouseUp", 1982 value: function handleDocumentMouseUp(event) { 1983 if (document.body.releaseCapture) { 1984 document.body.releaseCapture(); 1985 } 1986 1987 main_core.Event.unbind(document, 'mousemove', this.handleDocumentMouseMove); 1988 main_core.Event.unbind(document, 'mouseup', this.handleDocumentMouseUp); 1989 document.body.ondrag = null; 1990 document.body.onselectstart = null; 1991 document.body.style.cursor = ''; 1992 document.body.style.MozUserSelect = ''; 1993 this.popupContainer.style.MozUserSelect = ''; 1994 this.emit("on".concat(this.dragOptions.eventName, "End"), new main_core_events.BaseEvent({ 1995 compatData: [this] 1996 })); 1997 this.dragged = false; 1998 event.preventDefault(); 1999 } 2000 }]); 2001 return Popup; 2002 }(main_core_events.EventEmitter); 2003 2004 babelHelpers.defineProperty(Popup, "options", {}); 2005 babelHelpers.defineProperty(Popup, "defaultOptions", { 2006 //left offset for popup about target 2007 angleLeftOffset: 40, 2008 //when popup position is 'top' offset distance between popup body and target node 2009 positionTopXOffset: -11, 2010 //offset distance between popup body and target node if use angle, sum with positionTopXOffset 2011 angleTopOffset: 10, 2012 popupZindex: 1000, 2013 popupOverlayZindex: 1100, 2014 angleMinLeft: 10, 2015 angleMaxLeft: 30, 2016 angleMinRight: 10, 2017 angleMaxRight: 30, 2018 angleMinBottom: 23, 2019 angleMaxBottom: 25, 2020 angleMinTop: 23, 2021 angleMaxTop: 25, 2022 offsetLeft: 0, 2023 offsetTop: 0 2024 }); 2025 var escCallbackIndex = -1; 2026 var escCallback = null; 2027 2028 function checkEscPressed(zIndex, callback) { 2029 if (zIndex === false) { 2030 if (escCallback && escCallback.length > 0) { 2031 for (var i = 0; i < escCallback.length; i++) { 2032 escCallback[i](); 2033 } 2034 2035 escCallback = null; 2036 escCallbackIndex = -1; 2037 } 2038 } else { 2039 if (escCallback === null) { 2040 escCallback = []; 2041 escCallbackIndex = -1; 2042 setTimeout(function () { 2043 checkEscPressed(false); 2044 }, 10); 2045 } 2046 2047 if (zIndex > escCallbackIndex) { 2048 escCallbackIndex = zIndex; 2049 escCallback = [callback]; 2050 } else if (zIndex === escCallbackIndex) { 2051 escCallback.push(callback); 2052 } 2053 } 2054 } 2055 2056 var PopupManager = /*#__PURE__*/function () { 2057 function PopupManager() { 2058 babelHelpers.classCallCheck(this, PopupManager); 2059 throw new Error('You cannot make an instance of PopupManager.'); 2060 } 2061 2062 babelHelpers.createClass(PopupManager, null, [{ 2063 key: "create", 2064 value: function create(options) { 2065 var _arguments = Array.prototype.slice.call(arguments), 2066 popupId = _arguments[0], 2067 bindElement = _arguments[1], 2068 params = _arguments[2]; //compatible arguments 2069 2070 2071 var id = popupId; 2072 var compatMode = true; 2073 2074 if (main_core.Type.isPlainObject(popupId) && !bindElement && !params) { 2075 compatMode = false;
2076 id = popupId.id; 2077 2078 if (!main_core.Type.isStringFilled(id)) { 2079 throw new Error('BX.Main.Popup.Manager: "id" parameter is required.'); 2080 } 2081 } 2082 2083 var popupWindow = this.getPopupById(id); 2084 2085 if (popupWindow === null) { 2086 popupWindow = compatMode ? new Popup(popupId, bindElement, params) : new Popup(options); 2087 popupWindow.subscribe('onShow', this.handlePopupShow); 2088 popupWindow.subscribe('onClose', this.handlePopupClose); 2089 } 2090 2091 return popupWindow; 2092 } 2093 /** 2094 * @private 2095 */ 2096 2097 }, { 2098 key: "handleOnAfterInit", 2099 value: function handleOnAfterInit(event) { 2100 event.getTarget().subscribeOnce('onDestroy', this.handlePopupDestroy); 2101 2102 this._popups.forEach(function (popup) { 2103 if (popup.getId() === event.getTarget().getId()) { 2104 console.error("Duplicate id (".concat(popup.getId(), ") for the BX.Main.Popup instance.")); 2105 } 2106 }); 2107 2108 this._popups.push(event.getTarget()); 2109 } 2110 /** 2111 * @private 2112 */ 2113 2114 }, { 2115 key: "handlePopupDestroy", 2116 value: function handlePopupDestroy(event) { 2117 this._popups = this._popups.filter(function (popup) { 2118 return popup !== event.getTarget(); 2119 }); 2120 } 2121 /** 2122 * @private 2123 */ 2124 2125 }, { 2126 key: "handlePopupShow", 2127 value: function handlePopupShow(event) { 2128 if (this._currentPopup !== null) { 2129 this._currentPopup.close(); 2130 } 2131 2132 this._currentPopup = event.getTarget(); 2133 } 2134 /** 2135 * @private 2136 */ 2137 2138 }, { 2139 key: "handlePopupClose", 2140 value: function handlePopupClose() { 2141 this._currentPopup = null; 2142 } 2143 }, { 2144 key: "getCurrentPopup", 2145 value: function getCurrentPopup() { 2146 return this._currentPopup; 2147 } 2148 }, { 2149 key: "isPopupExists", 2150 value: function isPopupExists(id) { 2151 return this.getPopupById(id) !== null; 2152 } 2153 }, { 2154 key: "isAnyPopupShown", 2155 value: function isAnyPopupShown() { 2156 for (var i = 0, length = this._popups.length; i < length; i++) { 2157 if (this._popups[i].isShown()) { 2158 return true; 2159 } 2160 } 2161 2162 return false; 2163 } 2164 }, { 2165 key: "getPopupById", 2166 value: function getPopupById(id) { 2167 for (var i = 0; i < this._popups.length; i++) { 2168 if (this._popups[i].getId() === id) { 2169 return this._popups[i]; 2170 } 2171 } 2172 2173 return null; 2174 } 2175 }, { 2176 key: "getMaxZIndex", 2177 value: function getMaxZIndex() { 2178 var zIndex = 0; 2179 this.getPopups().forEach(function (popup) { 2180 zIndex = Math.max(zIndex, popup.getZindex()); 2181 }); 2182 return zIndex; 2183 } 2184 }, { 2185 key: "getPopups", 2186 value: function getPopups() { 2187 return this._popups; 2188 } 2189 }]); 2190 return PopupManager; 2191 }(); 2192 2193 babelHelpers.defineProperty(PopupManager, "_popups", []); 2194 babelHelpers.defineProperty(PopupManager, "_currentPopup", null); 2195 PopupManager.handlePopupDestroy = PopupManager.handlePopupDestroy.bind(PopupManager); 2196 PopupManager.handlePopupShow = PopupManager.handlePopupShow.bind(PopupManager); 2197 PopupManager.handlePopupClose = PopupManager.handlePopupClose.bind(PopupManager); 2198 PopupManager.handleOnAfterInit = PopupManager.handleOnAfterInit.bind(PopupManager); 2199 main_core_events.EventEmitter.subscribe('BX.Main.Popup:onAfterInit', PopupManager.handleOnAfterInit); 2200 2201 var _templateObject$1; 2202 var aliases$1 = { 2203 onSubMenuShow: { 2204 namespace: 'BX.Main.Menu.Item', 2205 eventName: 'SubMenu:onShow' 2206 }, 2207 onSubMenuClose: { 2208 namespace: 'BX.Main.Menu.Item', 2209 eventName: 'SubMenu:onClose' 2210 } 2211 }; 2212 var reEscape = /[<>'"]/g; 2213 var escapeEntities = { 2214 '<': '<', 2215 '>': '>', 2216 "'": ''', 2217 '"': '"' 2218 }; 2219 2220 function encodeSafe(value) { 2221 if (main_core.Type.isString(value)) { 2222 return value.replace(reEscape, function (item) { 2223 return escapeEntities[item]; 2224 }); 2225 } 2226 2227 return value; 2228 } 2229 2230 main_core_events.EventEmitter.registerAliases(aliases$1); 2231 2232 var MenuItem = /*#__PURE__*/function (_EventEmitter) { 2233 babelHelpers.inherits(MenuItem, _EventEmitter); 2234 2235 function MenuItem(options) { 2236 var _this; 2237 2238 babelHelpers.classCallCheck(this, MenuItem); 2239 _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(MenuItem).call(this)); 2240 2241 _this.setEventNamespace('BX.Main.Menu.Item'); 2242 2243 options = options || {}; 2244 _this.options = options; 2245 _this.id = options.id || main_core.Text.getRandom(); 2246 _this.text = ''; 2247 _this.allowHtml = false;
2248 2249 if (main_core.Type.isStringFilled(options.html)) { 2250 _this.text = options.html; 2251 _this.allowHtml = true; 2252 } else if (main_core.Type.isStringFilled(options.text)) { 2253 _this.text = options.text; 2254 2255 if (_this.text.match(/<[^>]+>/)) { 2256 console.warn('BX.Main.MenuItem: use "html" option for the html item content.', _this.getText()); 2257 } 2258 } 2259 2260 _this.title = main_core.Type.isStringFilled(options.title) ? options.title : ''; 2261 _this.delimiter = options.delimiter === true; 2262 _this.href = main_core.Type.isStringFilled(options.href) ? options.href : null; 2263 _this.target = main_core.Type.isStringFilled(options.target) ? options.target : null; 2264 _this.dataset = main_core.Type.isPlainObject(options.dataset) ? options.dataset : null; 2265 _this.className = main_core.Type.isStringFilled(options.className) ? options.className : null; 2266 _this.menuShowDelay = main_core.Type.isNumber(options.menuShowDelay) ? options.menuShowDelay : 300; 2267 _this.subMenuOffsetX = main_core.Type.isNumber(options.subMenuOffsetX) ? options.subMenuOffsetX : 4; 2268 _this._items = main_core.Type.isArray(options.items) ? options.items : []; 2269 _this.disabled = options.disabled === true; 2270 _this.cacheable = options.cacheable === true; 2271 /** 2272 * 2273 * @type {function|string} 2274 */ 2275 2276 _this.onclick = main_core.Type.isStringFilled(options.onclick) || main_core.Type.isFunction(options.onclick) ? options.onclick : null; 2277 2278 _this.subscribeFromOptions(options.events, aliases$1); 2279 /** 2280 * 2281 * @type {Menu} 2282 */ 2283 2284 2285 _this.menuWindow = null; 2286 /** 2287 * 2288 * @type {Menu} 2289 */ 2290 2291 _this.subMenuWindow = null; 2292 /** 2293 * 2294 * @type {{item: HTMLElement, text: HTMLElement}} 2295 */ 2296 2297 _this.layout = { 2298 item: null, 2299 text: null 2300 }; 2301 2302 _this.getLayout(); //compatibility 2303 //compatibility 2304 //now use this.options 2305 2306 2307 _this.events = {}; 2308 _this.items = []; 2309 2310 for (var property in options) { 2311 if (options.hasOwnProperty(property) && typeof _this[property] === 'undefined') { 2312 _this[property] = options[property]; 2313 } 2314 } 2315 2316 return _this; 2317 } 2318 2319 babelHelpers.createClass(MenuItem, [{ 2320 key: "getLayout", 2321 value: function getLayout() { 2322 if (this.layout.item) { 2323 return this.layout; 2324 } 2325 2326 if (this.delimiter) { 2327 if (main_core.Type.isStringFilled(this.getText())) { 2328 this.layout.item = main_core.Dom.create('span', { 2329 props: { 2330 className: ['popup-window-delimiter-section', this.className ? this.className : ''].join(' ') 2331 }, 2332 children: [this.layout.text = main_core.Dom.create('span', { 2333 props: { 2334 className: 'popup-window-delimiter-text' 2335 }, 2336 html: this.allowHtml ? this.getText() : encodeSafe(this.getText()) 2337 })] 2338 }); 2339 } else { 2340 this.layout.item = main_core.Tag.render(_templateObject$1 || (_templateObject$1 = babelHelpers.taggedTemplateLiteral(["<span class=\"popup-window-delimiter\">"]))); 2341 } 2342 } else { 2343 this.layout.item = main_core.Dom.create(this.href ? 'a' : 'span', { 2344 props: { 2345 className: ['menu-popup-item', this.className ? this.className : 'menu-popup-no-icon', this.hasSubMenu() ? 'menu-popup-item-submenu' : ''].join(' ') 2346 }, 2347 attrs: { 2348 title: this.title, 2349 onclick: main_core.Type.isString(this.onclick) ? this.onclick : '', 2350 // compatibility 2351 target: this.target ? this.target : '' 2352 }, 2353 dataset: this.dataset, 2354 events: main_core.Type.isFunction(this.onclick) ? { 2355 click: this.onItemClick.bind(this) 2356 } : null, 2357 children: [main_core.Dom.create('span', { 2358 props: { 2359 className: 'menu-popup-item-icon' 2360 } 2361 }), this.layout.text = main_core.Dom.create('span', { 2362 props: { 2363 className: 'menu-popup-item-text' 2364 }, 2365 html: this.allowHtml ? this.getText() : encodeSafe(this.getText()) 2366 })] 2367 }); 2368 2369 if (this.href) { 2370 this.layout.item.href = this.href; 2371 } 2372 2373 if (this.isDisabled()) { 2374 this.disable(); 2375 } 2376 2377 main_core.Event.bind(this.layout.item, 'mouseenter', this.onItemMouseEnter.bind(this)); 2378 main_core.Event.bind(this.layout.item, 'mouseleave', this.onItemMouseLeave.bind(this)); 2379 } 2380 2381 return this.layout; 2382 } 2383 }, { 2384 key: "getContainer", 2385 value: function getContainer() { 2386 return this.getLayout().item; 2387 } 2388 }, { 2389 key: "getTextContainer", 2390 value: function getTextContainer() { 2391 return this.getLayout().text; 2392 } 2393 }, { 2394 key: "getText", 2395 value: function getText() { 2396 return this.text; 2397 } 2398 }, { 2399 key: "setText", 2400 value: function setText(text) { 2401 if (main_core.Type.isString(text)) { 2402 this.text = text; 2403 this.getTextContainer().innerHTML = text; 2404 } 2405 } 2406 }, { 2407 key: "hasSubMenu", 2408 value: function hasSubMenu() { 2409 return this.subMenuWindow !== null || this._items.length; 2410 } 2411 }, { 2412 key: "showSubMenu", 2413 value: function showSubMenu() { 2414 this.addSubMenu(this._items); 2415 2416 if (this.subMenuWindow) { 2417 main_core.Dom.addClass(this.layout.item, 'menu-popup-item-open'); 2418 this.closeSiblings(); 2419 this.closeChildren(); 2420 var popupWindow = this.subMenuWindow.getPopupWindow(); 2421 2422 if (!popupWindow.isShown()) {
2423 this.emit('SubMenu:onShow'); 2424 popupWindow.show(); 2425 } 2426 2427 this.adjustSubMenu(); 2428 } 2429 } 2430 }, { 2431 key: "addSubMenu", 2432 value: function addSubMenu(items) { 2433 if (this.subMenuWindow !== null || !main_core.Type.isArray(items) || !items.length) { 2434 return; 2435 } 2436 2437 var rootMenuWindow = this.getMenuWindow().getRootMenuWindow() || this.getMenuWindow(); 2438 var rootOptions = Object.assign({}, rootMenuWindow.params); 2439 delete rootOptions.events; 2440 var subMenuOptions = main_core.Type.isPlainObject(rootMenuWindow.params.subMenuOptions) ? rootMenuWindow.params.subMenuOptions : {}; 2441 var options = Object.assign({}, rootOptions, subMenuOptions); //Override root menu options 2442 2443 options.autoHide = false; 2444 options.menuShowDelay = this.menuShowDelay; 2445 options.cacheable = this.isCacheable(); 2446 options.targetContainer = this.getMenuWindow().getPopupWindow().getTargetContainer(); 2447 options.bindOptions = { 2448 forceTop: true, 2449 forceLeft: true, 2450 forceBindPosition: true 2451 }; 2452 delete options.angle; 2453 delete options.overlay; 2454 this.subMenuWindow = new Menu('popup-submenu-' + this.id, this.layout.item, items, options); 2455 this.subMenuWindow.setParentMenuWindow(this.getMenuWindow()); 2456 this.subMenuWindow.setParentMenuItem(this); 2457 this.subMenuWindow.getPopupWindow().subscribe('onDestroy', this.handleSubMenuDestroy.bind(this)); 2458 main_core.Dom.addClass(this.layout.item, 'menu-popup-item-submenu'); 2459 return this.subMenuWindow; 2460 } 2461 }, { 2462 key: "closeSubMenu", 2463 value: function closeSubMenu() { 2464 this.clearSubMenuTimeout(); 2465 2466 if (this.subMenuWindow) { 2467 main_core.Dom.removeClass(this.layout.item, 'menu-popup-item-open'); 2468 this.closeChildren(); 2469 var popup = this.subMenuWindow.getPopupWindow(); 2470 2471 if (popup.isShown()) { 2472 this.emit('SubMenu:onClose'); 2473 } 2474 2475 this.subMenuWindow.close(); 2476 } 2477 } 2478 }, { 2479 key: "closeSiblings", 2480 value: function closeSiblings() { 2481 var siblings = this.menuWindow.getMenuItems(); 2482 2483 for (var i = 0; i < siblings.length; i++) { 2484 if (siblings[i] !== this) { 2485 siblings[i].closeSubMenu(); 2486 } 2487 } 2488 } 2489 }, { 2490 key: "closeChildren", 2491 value: function closeChildren() { 2492 if (this.subMenuWindow) { 2493 var children = this.subMenuWindow.getMenuItems(); 2494 2495 for (var i = 0; i < children.length; i++) { 2496 children[i].closeSubMenu(); 2497 } 2498 } 2499 } 2500 }, { 2501 key: "destroySubMenu", 2502 value: function destroySubMenu() { 2503 if (this.subMenuWindow) { 2504 main_core.Dom.removeClass(this.layout.item, 'menu-popup-item-open menu-popup-item-submenu'); 2505 this.destroyChildren(); 2506 this.subMenuWindow.destroy(); 2507 this.subMenuWindow = null; 2508 this._items = []; 2509 } 2510 } 2511 }, { 2512 key: "destroyChildren", 2513 value: function destroyChildren() { 2514 if (this.subMenuWindow) { 2515 var children = this.subMenuWindow.getMenuItems(); 2516 2517 for (var i = 0; i < children.length; i++) { 2518 children[i].destroySubMenu(); 2519 } 2520 } 2521 } 2522 }, { 2523 key: "adjustSubMenu", 2524 value: function adjustSubMenu() { 2525 if (!this.subMenuWindow || !this.layout.item) { 2526 return; 2527 } 2528 2529 var popupWindow = this.subMenuWindow.getPopupWindow(); 2530 var itemRect = this.getBoundingClientRect(); 2531 var offsetLeft = itemRect.width + this.subMenuOffsetX; 2532 var offsetTop = itemRect.height + this.getPopupPadding(); 2533 var angleOffset = itemRect.height / 2 - this.getPopupPadding(); 2534 var anglePosition = 'left'; 2535 var popupWidth = popupWindow.getPopupContainer().offsetWidth; 2536 var popupHeight = popupWindow.getPopupContainer().offsetHeight; 2537 var popupBottom = itemRect.top + popupHeight; 2538 var targetContainer = this.getMenuWindow().getPopupWindow().getTargetContainer(); 2539 var isGlobalContext = this.getMenuWindow().getPopupWindow().isTargetDocumentBody(); 2540 var clientWidth = isGlobalContext ? document.documentElement.clientWidth : targetContainer.offsetWidth; 2541 var clientHeight = isGlobalContext ? document.documentElement.clientHeight : targetContainer.offsetHeight; // let's try to fit a submenu to the browser viewport 2542 2543 var exceeded = popupBottom - clientHeight; 2544 2545 if (exceeded > 0) {
2546 var roundOffset = Math.ceil(exceeded / itemRect.height) * itemRect.height; 2547 2548 if (roundOffset > itemRect.top) { 2549 // it cannot be higher than the browser viewport. 2550 roundOffset -= Math.ceil((roundOffset - itemRect.top) / itemRect.height) * itemRect.height; 2551 } 2552 2553 if (itemRect.bottom > popupBottom - roundOffset) { 2554 // let's sync bottom boundaries. 2555 roundOffset -= itemRect.bottom - (popupBottom - roundOffset) + this.getPopupPadding(); 2556 } 2557 2558 offsetTop += roundOffset; 2559 angleOffset += roundOffset; 2560 } 2561 2562 if (itemRect.left + offsetLeft + popupWidth > clientWidth) { 2563 var left = itemRect.left - popupWidth - this.subMenuOffsetX; 2564 2565 if (left > 0) { 2566 offsetLeft = -popupWidth - this.subMenuOffsetX; 2567 anglePosition = 'right'; 2568 } 2569 } 2570 2571 popupWindow.setBindElement(this.layout.item); 2572 popupWindow.setOffset({ 2573 offsetLeft: offsetLeft, 2574 offsetTop: -offsetTop 2575 }); 2576 popupWindow.setAngle({ 2577 position: anglePosition, 2578 offset: angleOffset 2579 }); 2580 popupWindow.adjustPosition(); 2581 } 2582 }, { 2583 key: "getBoundingClientRect", 2584 value: function getBoundingClientRect() { 2585 var popup = this.getMenuWindow().getPopupWindow(); 2586 2587 if (popup.isTargetDocumentBody()) { 2588 return this.layout.item.getBoundingClientRect(); 2589 } else { 2590 var rect = popup.getPositionRelativeToTarget(this.layout.item); 2591 var targetContainer = this.getMenuWindow().getPopupWindow().getTargetContainer(); 2592 return new DOMRect(rect.left - targetContainer.scrollLeft, rect.top - targetContainer.scrollTop, rect.width, rect.height); 2593 } 2594 } 2595 }, { 2596 key: "getPopupPadding", 2597 value: function getPopupPadding() { 2598 if (!main_core.Type.isNumber(this.popupPadding)) { 2599 if (this.subMenuWindow) { 2600 var menuContainer = this.subMenuWindow.layout.menuContainer; 2601 this.popupPadding = parseInt(main_core.Dom.style(menuContainer, 'paddingTop'), 10); 2602 } else { 2603 this.popupPadding = 0; 2604 } 2605 } 2606 2607 return this.popupPadding; 2608 } 2609 }, { 2610 key: "getSubMenu", 2611 value: function getSubMenu() { 2612 return this.subMenuWindow; 2613 } 2614 }, { 2615 key: "getId", 2616 value: function getId() { 2617 return this.id; 2618 } 2619 }, { 2620 key: "setMenuWindow", 2621 value: function setMenuWindow(menu) { 2622 this.menuWindow = menu; 2623 } 2624 }, { 2625 key: "getMenuWindow", 2626 value: function getMenuWindow() { 2627 return this.menuWindow; 2628 } 2629 }, { 2630 key: "getMenuShowDelay", 2631 value: function getMenuShowDelay() { 2632 return this.menuShowDelay; 2633 } 2634 }, { 2635 key: "enable", 2636 value: function enable() { 2637 this.disabled = false; 2638 this.getContainer().classList.remove('menu-popup-item-disabled'); 2639 } 2640 }, { 2641 key: "disable", 2642 value: function disable() { 2643 this.disabled = true; 2644 this.closeSubMenu(); 2645 this.getContainer().classList.add('menu-popup-item-disabled'); 2646 } 2647 }, { 2648 key: "isDisabled", 2649 value: function isDisabled() { 2650 return this.disabled; 2651 } 2652 }, { 2653 key: "setCacheable", 2654 value: function setCacheable(cacheable) { 2655 this.cacheable = cacheable !== false; 2656 } 2657 }, { 2658 key: "isCacheable", 2659 value: function isCacheable() { 2660 return this.cacheable; 2661 } 2662 /** 2663 * @private 2664 */ 2665 2666 }, { 2667 key: "onItemClick", 2668 value: function onItemClick(event) { 2669 this.onclick.call(this.menuWindow, event, this); //compatibility 2670 } 2671 /** 2672 * @private 2673 */ 2674 2675 }, { 2676 key: "onItemMouseEnter", 2677 value: function onItemMouseEnter(mouseEvent) { 2678 if (this.isDisabled()) { 2679 return; 2680 } 2681 2682 var event = new main_core_events.BaseEvent({ 2683 data: { 2684 mouseEvent: mouseEvent 2685 } 2686 }); 2687 main_core_events.EventEmitter.emit(this, 'onMouseEnter', event, { 2688 thisArg: this 2689 }); 2690 2691 if (event.isDefaultPrevented()) { 2692 return; 2693 } 2694 2695 this.clearSubMenuTimeout(); 2696 2697 if (this.hasSubMenu()) { 2698 this.subMenuTimeout = setTimeout(function () { 2699 this.showSubMenu(); 2700 }.bind(this), this.menuShowDelay); 2701 } else { 2702 this.subMenuTimeout = setTimeout(function () { 2703 this.closeSiblings(); 2704 }.bind(this), this.menuShowDelay); 2705 } 2706 } 2707 /** 2708 * @private 2709 */ 2710 2711 }, { 2712 key: "onItemMouseLeave", 2713 value: function onItemMouseLeave(mouseEvent) { 2714 if (this.isDisabled()) { 2715 return; 2716 } 2717 2718 var event = new main_core_events.BaseEvent({ 2719 data: { 2720 mouseEvent: mouseEvent 2721 } 2722 }); 2723 main_core_events.EventEmitter.emit(this, 'onMouseLeave', event, { 2724 thisArg: this 2725 }); 2726 2727 if (event.isDefaultPrevented()) { 2728 return; 2729 } 2730 2731 this.clearSubMenuTimeout(); 2732 } 2733 /** 2734 * @private 2735 */ 2736 2737 }, { 2738 key: "clearSubMenuTimeout", 2739 value: function clearSubMenuTimeout() { 2740 if (this.subMenuTimeout) { 2741 clearTimeout(this.subMenuTimeout); 2742 } 2743 2744 this.subMenuTimeout = null; 2745 } 2746 /** 2747 * @private 2748 */ 2749 2750 }, { 2751 key: "handleSubMenuDestroy", 2752 value: function handleSubMenuDestroy() { 2753 this.subMenuWindow = null; 2754 } 2755 }]);
2756 return MenuItem; 2757 }(main_core_events.EventEmitter); 2758 2759 var _templateObject$2, _templateObject2$1; 2760 2761 /** 2762 * @memberof BX.Main 2763 */ 2764 var Menu = /*#__PURE__*/function () { 2765 function Menu(options) { 2766 babelHelpers.classCallCheck(this, Menu); 2767 2768 var _arguments = Array.prototype.slice.call(arguments), 2769 id = _arguments[0], 2770 bindElement = _arguments[1], 2771 menuItems = _arguments[2], 2772 params = _arguments[3]; 2773 2774 if (main_core.Type.isPlainObject(options) && !bindElement && !menuItems && !params) { 2775 params = options; 2776 params.compatibleMode = false; 2777 id = options.id; 2778 bindElement = options.bindElement; 2779 menuItems = options.items; 2780 2781 if (!main_core.Type.isStringFilled(id)) { 2782 id = 'menu-popup-' + main_core.Text.getRandom(); 2783 } 2784 } 2785 2786 this.id = id; 2787 this.bindElement = bindElement; 2788 /** 2789 * 2790 * @type {MenuItem[]} 2791 */ 2792 2793 this.menuItems = []; 2794 this.itemsContainer = null; 2795 this.params = params && babelHelpers.typeof(params) === 'object' ? params : {}; 2796 this.parentMenuWindow = null; 2797 this.parentMenuItem = null; 2798 2799 if (menuItems && main_core.Type.isArray(menuItems)) { 2800 for (var i = 0; i < menuItems.length; i++) { 2801 this.addMenuItemInternal(menuItems[i], null); 2802 } 2803 } 2804 2805 this.layout = { 2806 menuContainer: null, 2807 itemsContainer: null 2808 }; 2809 this.popupWindow = this.__createPopup(); 2810 } 2811 /** 2812 * @private 2813 */ 2814 2815 2816 babelHelpers.createClass(Menu, [{ 2817 key: "__createPopup", 2818 value: function __createPopup() { 2819 var domItems = []; 2820 2821 for (var i = 0; i < this.menuItems.length; i++) { 2822 var item = this.menuItems[i]; 2823 var itemLayout = item.getLayout(); 2824 domItems.push(itemLayout.item); 2825 } 2826 2827 var defaults = { 2828 closeByEsc: false, 2829 angle: false, 2830 autoHide: true, 2831 offsetTop: 1, 2832 offsetLeft: 0, 2833 animation: 'fading' 2834 }; 2835 var options = Object.assign(defaults, this.params); //Override user params 2836 2837 options.noAllPaddings = true; 2838 options.darkMode = false; 2839 options.autoHideHandler = this.handleAutoHide.bind(this); 2840 this.layout.itemsContainer = main_core.Tag.render(_templateObject$2 || (_templateObject$2 = babelHelpers.taggedTemplateLiteral(["\n\t\t\t<div class=\"menu-popup-items\">", "</div>\n\t\t"])), domItems); 2841 this.layout.menuContainer = main_core.Tag.render(_templateObject2$1 || (_templateObject2$1 = babelHelpers.taggedTemplateLiteral(["\n\t\t\t<div class=\"menu-popup\">", "</div>\n\t\t"])), this.layout.itemsContainer); 2842 this.itemsContainer = this.layout.itemsContainer; 2843 options.content = this.layout.menuContainer; //Make internal event handlers first in the queue. 2844 2845 options.events = { 2846 onClose: this.handlePopupClose.bind(this), 2847 onDestroy: this.handlePopupDestroy.bind(this) 2848 }; 2849 var id = options.compatibleMode === false ? this.getId() : 'menu-popup-' + this.getId(); 2850 var popup = new Popup(id, this.bindElement, options); 2851 2852 if (this.params && this.params.events) { 2853 popup.subscribeFromOptions(this.params.events); 2854 } 2855 2856 return popup; 2857 } 2858 }, { 2859 key: "getPopupWindow", 2860 value: function getPopupWindow() { 2861 return this.popupWindow; 2862 } 2863 }, { 2864 key: "show", 2865 value: function show() { 2866 this.getPopupWindow().show(); 2867 } 2868 }, { 2869 key: "close", 2870 value: function close() { 2871 this.getPopupWindow().close(); 2872 } 2873 }, { 2874 key: "destroy", 2875 value: function destroy() { 2876 this.getPopupWindow().destroy(); 2877 } 2878 }, { 2879 key: "toggle", 2880 value: function toggle() { 2881 if (this.getPopupWindow().isShown()) { 2882 this.close(); 2883 } else { 2884 this.show(); 2885 } 2886 } 2887 }, { 2888 key: "getId", 2889 value: function getId() { 2890 return this.id; 2891 } 2892 /** 2893 * @private 2894 */ 2895 2896 }, { 2897 key: "handlePopupClose", 2898 value: function handlePopupClose() { 2899 for (var i = 0; i < this.menuItems.length; i++) { 2900 var item = this.menuItems[i]; 2901 item.closeSubMenu(); 2902 } 2903 } 2904 /** 2905 * @private 2906 */ 2907 2908 }, { 2909 key: "handlePopupDestroy", 2910 value: function handlePopupDestroy() { 2911 for (var i = 0; i < this.menuItems.length; i++) { 2912 var item = this.menuItems[i]; 2913 item.destroySubMenu(); 2914 } 2915 } 2916 /** 2917 * @private 2918 */ 2919 2920 }, { 2921 key: "handleAutoHide", 2922 value: function handleAutoHide(event) { 2923 return !this.containsTarget(event.target); 2924 } 2925 /** 2926 * @private 2927 */ 2928 2929 }, { 2930 key: "containsTarget", 2931 value: function containsTarget(target) { 2932 var el = this.getPopupWindow().getPopupContainer(); 2933 2934 if (this.getPopupWindow().isShown() && (target === el || el.contains(target))) { 2935 return true; 2936 } 2937 2938 return this.getMenuItems().some(function (item) { 2939 return item.getSubMenu() && item.getSubMenu().containsTarget(target); 2940 }); 2941 } 2942 }, { 2943 key: "setParentMenuWindow", 2944 value: function setParentMenuWindow(parentMenu) { 2945 if (parentMenu instanceof Menu) { 2946 this.parentMenuWindow = parentMenu; 2947 } 2948 } 2949 }, { 2950 key: "getParentMenuWindow", 2951 value: function getParentMenuWindow() { 2952 return this.parentMenuWindow; 2953 } 2954 }, {
2955 key: "getRootMenuWindow", 2956 value: function getRootMenuWindow() { 2957 var root = null; 2958 var parent = this.getParentMenuWindow(); 2959 2960 while (parent !== null) { 2961 root = parent; 2962 parent = parent.getParentMenuWindow(); 2963 } 2964 2965 return root; 2966 } 2967 }, { 2968 key: "setParentMenuItem", 2969 value: function setParentMenuItem(parentItem) { 2970 if (parentItem instanceof MenuItem) { 2971 this.parentMenuItem = parentItem; 2972 } 2973 } 2974 }, { 2975 key: "getParentMenuItem", 2976 value: function getParentMenuItem() { 2977 return this.parentMenuItem; 2978 } 2979 }, { 2980 key: "addMenuItem", 2981 value: function addMenuItem(menuItemJson, targetItemId) { 2982 var menuItem = this.addMenuItemInternal(menuItemJson, targetItemId); 2983 2984 if (!menuItem) { 2985 return null; 2986 } 2987 2988 var itemLayout = menuItem.getLayout(); 2989 var targetItem = this.getMenuItem(targetItemId); 2990 2991 if (targetItem !== null) { 2992 var targetLayout = targetItem.getLayout(); 2993 this.itemsContainer.insertBefore(itemLayout.item, targetLayout.item); 2994 } else { 2995 this.itemsContainer.appendChild(itemLayout.item); 2996 } 2997 2998 return menuItem; 2999 } 3000 /** 3001 * @private 3002 */ 3003 3004 }, { 3005 key: "addMenuItemInternal", 3006 value: function addMenuItemInternal(menuItemJson, targetItemId) { 3007 if (!menuItemJson || !menuItemJson.delimiter && !main_core.Type.isStringFilled(menuItemJson.text) && !main_core.Type.isStringFilled(menuItemJson.html) || menuItemJson.id && this.getMenuItem(menuItemJson.id) !== null) { 3008 return null; 3009 } 3010 3011 if (main_core.Type.isNumber(this.params.menuShowDelay)) { 3012 menuItemJson.menuShowDelay = this.params.menuShowDelay; 3013 } 3014 3015 var menuItem = new MenuItem(menuItemJson); 3016 menuItem.setMenuWindow(this); 3017 var position = this.getMenuItemPosition(targetItemId); 3018 3019 if (position >= 0) { 3020 this.menuItems.splice(position, 0, menuItem); 3021 } else { 3022 this.menuItems.push(menuItem); 3023 } 3024 3025 return menuItem; 3026 } 3027 }, { 3028 key: "removeMenuItem", 3029 value: function removeMenuItem(itemId) { 3030 var item = this.getMenuItem(itemId); 3031 3032 if (!item) { 3033 return; 3034 } 3035 3036 for (var position = 0; position < this.menuItems.length; position++) { 3037 if (this.menuItems[position] === item) { 3038 item.destroySubMenu(); 3039 this.menuItems.splice(position, 1); 3040 break; 3041 } 3042 } 3043 3044 if (!this.menuItems.length) { 3045 var menuWindow = item.getMenuWindow(); 3046 3047 if (menuWindow) { 3048 var parentMenuItem = menuWindow.getParentMenuItem(); 3049 3050 if (parentMenuItem) { 3051 parentMenuItem.destroySubMenu(); 3052 } else { 3053 menuWindow.destroy(); 3054 } 3055 } 3056 } 3057 3058 item.layout.item.parentNode.removeChild(item.layout.item); 3059 item.layout = { 3060 item: null, 3061 text: null 3062 }; 3063 } 3064 }, { 3065 key: "getMenuItem", 3066 value: function getMenuItem(itemId) { 3067 for (var i = 0; i < this.menuItems.length; i++) { 3068 if (this.menuItems[i].id && this.menuItems[i].id === itemId) { 3069 return this.menuItems[i]; 3070 } 3071 } 3072 3073 return null; 3074 } 3075 }, { 3076 key: "getMenuItems", 3077 value: function getMenuItems() { 3078 return this.menuItems; 3079 } 3080 }, { 3081 key: "getMenuItemPosition", 3082 value: function getMenuItemPosition(itemId) { 3083 if (itemId) { 3084 for (var i = 0; i < this.menuItems.length; i++) { 3085 if (this.menuItems[i].id && this.menuItems[i].id === itemId) { 3086 return i; 3087 } 3088 } 3089 } 3090 3091 return -1; 3092 } 3093 }, { 3094 key: "getMenuContainer", 3095 value: function getMenuContainer() { 3096 return this.getPopupWindow().getPopupContainer(); 3097 } 3098 }]); 3099 return Menu; 3100 }(); 3101 3102 var MenuManager = /*#__PURE__*/function () { 3103 /** 3104 * @private 3105 */ 3106 3107 /** 3108 * @private 3109 */ 3110 function MenuManager() { 3111 babelHelpers.classCallCheck(this, MenuManager); 3112 throw new Error('You cannot make an instance of MenuManager.'); 3113 } 3114 3115 babelHelpers.createClass(MenuManager, null, [{ 3116 key: "show", 3117 value: function show() { 3118 if (this.currentItem !== null) { 3119 this.currentItem.popupWindow.close(); 3120 } 3121 3122 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 3123 args[_key] = arguments[_key]; 3124 } 3125 3126 this.currentItem = this.create.apply(this, args); 3127 this.currentItem.popupWindow.show(); 3128 } 3129 }, { 3130 key: "create", 3131 value: function create(options) { 3132 var menuId = null; //Compatibility 3133 3134 var bindElement = arguments[1]; 3135 var menuItems = arguments[2]; 3136 var params = arguments[3]; 3137 3138 if (main_core.Type.isPlainObject(options) && !bindElement && !menuItems && !params) { 3139 menuId = options.id; 3140 3141 if (!main_core.Type.isStringFilled(menuId)) { 3142 throw new Error('BX.Main.Menu.create: "id" parameter is required.'); 3143 } 3144 } else { 3145 menuId = options; 3146 } 3147 3148 if (!this.Data[menuId]) { 3149 var menu = new Menu(options, bindElement, menuItems, params); 3150 menu.getPopupWindow().subscribe('onDestroy', function () { 3151 MenuManager.destroy(menuId); 3152 }); 3153 this.Data[menuId] = menu; 3154 } 3155 3156 return this.Data[menuId]; 3157 } 3158 }, { 3159 key: "getCurrentMenu", 3160 value: function getCurrentMenu() { 3161 return this.currentItem; 3162 } 3163 }, { 3164 key: "getMenuById", 3165 value: function getMenuById(id) { 3166 return this.Data[id] ? this.Data[id] : null; 3167 } 3168 /** 3169 * compatibility 3170 * @private 3171 */ 3172 3173 }, { 3174 key: "onPopupDestroy", 3175 value: function onPopupDestroy(popupMenuWindow) { 3176 this.destroy(popupMenuWindow.id); 3177 } 3178 }, {
3179 key: "destroy", 3180 value: function destroy(id) { 3181 var menu = this.getMenuById(id); 3182 3183 if (menu) { 3184 if (this.currentItem === menu) { 3185 this.currentItem = null; 3186 } 3187 3188 delete this.Data[id]; 3189 menu.getPopupWindow().destroy(); 3190 } 3191 } 3192 }]); 3193 return MenuManager; 3194 }(); 3195 3196 babelHelpers.defineProperty(MenuManager, "Data", {}); 3197 babelHelpers.defineProperty(MenuManager, "currentItem", null); 3198 3199 /** 3200 * @deprecated use Popup class instead: import { Popup } from 'main.popup' 3201 */ 3202 3203 var PopupWindow = /*#__PURE__*/function (_Popup) { 3204 babelHelpers.inherits(PopupWindow, _Popup); 3205 3206 function PopupWindow() { 3207 babelHelpers.classCallCheck(this, PopupWindow); 3208 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupWindow).apply(this, arguments)); 3209 } 3210 3211 return PopupWindow; 3212 }(Popup); 3213 3214 /** 3215 * @deprecated use BX.UI.Button 3216 */ 3217 3218 var PopupWindowButton = /*#__PURE__*/function (_Button) { 3219 babelHelpers.inherits(PopupWindowButton, _Button); 3220 3221 function PopupWindowButton() { 3222 babelHelpers.classCallCheck(this, PopupWindowButton); 3223 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupWindowButton).apply(this, arguments)); 3224 } 3225 3226 return PopupWindowButton; 3227 }(Button); 3228 3229 /** 3230 * @deprecated use BX.UI.Button 3231 */ 3232 3233 var ButtonLink = /*#__PURE__*/function (_Button) { 3234 babelHelpers.inherits(ButtonLink, _Button); 3235 3236 function ButtonLink(params) { 3237 var _this; 3238 3239 babelHelpers.classCallCheck(this, ButtonLink); 3240 _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(ButtonLink).call(this, params)); 3241 _this.buttonNode = main_core.Dom.create('span', { 3242 props: { 3243 className: 'popup-window-button popup-window-button-link' + (_this.className.length > 0 ? ' ' + _this.className : ''), 3244 id: _this.id 3245 }, 3246 text: _this.text, 3247 events: _this.contextEvents 3248 }); 3249 return _this; 3250 } 3251 3252 return ButtonLink; 3253 }(Button); 3254 3255 /** 3256 * @deprecated use BX.UI.Button 3257 */ 3258 3259 var PopupWindowButtonLink = /*#__PURE__*/function (_ButtonLink) { 3260 babelHelpers.inherits(PopupWindowButtonLink, _ButtonLink); 3261 3262 function PopupWindowButtonLink() { 3263 babelHelpers.classCallCheck(this, PopupWindowButtonLink); 3264 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupWindowButtonLink).apply(this, arguments)); 3265 } 3266 3267 return PopupWindowButtonLink; 3268 }(ButtonLink); 3269 3270 /** 3271 * @deprecated use BX.UI.Button 3272 */ 3273 3274 var CustomButton = /*#__PURE__*/function (_Button) { 3275 babelHelpers.inherits(CustomButton, _Button); 3276 3277 function CustomButton(params) { 3278 var _this; 3279 3280 babelHelpers.classCallCheck(this, CustomButton); 3281 _this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(CustomButton).call(this, params)); 3282 _this.buttonNode = main_core.Dom.create('span', { 3283 props: { 3284 className: _this.className.length > 0 ? _this.className : '', 3285 id: _this.id 3286 }, 3287 events: _this.contextEvents, 3288 text: _this.text 3289 }); 3290 return _this; 3291 } 3292 3293 return CustomButton; 3294 }(Button); 3295 3296 /** 3297 * @deprecated use BX.UI.Button 3298 */ 3299 3300 var PopupWindowCustomButton = /*#__PURE__*/function (_CustomButton) { 3301 babelHelpers.inherits(PopupWindowCustomButton, _CustomButton); 3302 3303 function PopupWindowCustomButton() { 3304 babelHelpers.classCallCheck(this, PopupWindowCustomButton); 3305 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupWindowCustomButton).apply(this, arguments)); 3306 } 3307 3308 return PopupWindowCustomButton; 3309 }(CustomButton); 3310 3311 /** 3312 * @deprecated use Menu class instead: import { Menu } from 'main.popup' 3313 */ 3314 3315 var PopupMenuWindow = /*#__PURE__*/function (_Menu) { 3316 babelHelpers.inherits(PopupMenuWindow, _Menu); 3317 3318 function PopupMenuWindow() { 3319 babelHelpers.classCallCheck(this, PopupMenuWindow); 3320 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupMenuWindow).apply(this, arguments)); 3321 } 3322 3323 return PopupMenuWindow; 3324 }(Menu); 3325 3326 /** 3327 * @deprecated use Menu.Item class instead: import { MenuItem } from 'main.popup' 3328 */ 3329 3330 var PopupMenuItem = /*#__PURE__*/function (_MenuItem) { 3331 babelHelpers.inherits(PopupMenuItem, _MenuItem); 3332 3333 function PopupMenuItem() { 3334 babelHelpers.classCallCheck(this, PopupMenuItem); 3335 return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(PopupMenuItem).apply(this, arguments)); 3336 } 3337 3338 return PopupMenuItem; 3339 }(MenuItem); 3340 3341 /** 3342 * @deprecated 3343 */ 3344 3345 var InputPopup = /*#__PURE__*/function () { 3346 function InputPopup(params) { 3347 babelHelpers.classCallCheck(this, InputPopup); 3348 this.id = params.id || 'bx-inp-popup-' + Math.round(Math.random() * 1000000); 3349 this.handler = params.handler || false; 3350 this.values = params.values || false; 3351 this.pInput = params.input; 3352 this.bValues = !!this.values; 3353 this.defaultValue = params.defaultValue || ''; 3354 this.openTitle = params.openTitle || ''; 3355 this.className = params.className || ''; 3356 this.noMRclassName = params.noMRclassName || 'ec-no-rm'; 3357 this.emptyClassName = params.noMRclassName || 'ec-label'; 3358 3359 var _this = this; 3360 3361 this.curInd = false;
3362 3363 if (this.bValues) { 3364 this.pInput.onfocus = this.pInput.onclick = function (e) { 3365 if (this.value == _this.defaultValue) { 3366 this.value = ''; 3367 this.className = _this.className; 3368 } 3369 3370 _this.ShowPopup(); 3371 3372 return e.preventDefault(); 3373 }; 3374 3375 this.pInput.onblur = function () { 3376 if (_this.bShowed) { 3377 setTimeout(function () { 3378 _this.ClosePopup(true); 3379 }, 200); 3380 } 3381 3382 _this.OnChange(); 3383 }; 3384 } else { 3385 this.pInput.className = this.noMRclassName; 3386 this.pInput.onblur = this.OnChange.bind(this); 3387 } 3388 } 3389 3390 babelHelpers.createClass(InputPopup, [{ 3391 key: "ShowPopup", 3392 value: function ShowPopup() { 3393 if (this.bShowed) { 3394 return; 3395 } 3396 3397 var _this = this; 3398 3399 if (!this.oPopup) { 3400 var pWnd = main_core.Dom.create('DIV', { 3401 props: { 3402 className: 'bxecpl-loc-popup ' + this.className 3403 } 3404 }); 3405 3406 for (var i = 0, l = this.values.length; i < l; i++) { 3407 var pRow = pWnd.appendChild(main_core.Dom.create('DIV', { 3408 props: { 3409 id: 'bxecmr_' + i 3410 }, 3411 text: this.values[i].NAME, 3412 events: { 3413 mouseover: function mouseover() { 3414 main_core.Dom.addClass(this, 'bxecplloc-over'); 3415 }, 3416 mouseout: function mouseout() { 3417 main_core.Dom.removeClass(this, 'bxecplloc-over'); 3418 }, 3419 click: function click() { 3420 var ind = this.id.substr('bxecmr_'.length); 3421 _this.pInput.value = _this.values[ind].NAME; 3422 _this.curInd = ind; 3423 3424 _this.OnChange(); 3425 3426 _this.ClosePopup(true); 3427 } 3428 } 3429 })); 3430 3431 if (this.values[i].DESCRIPTION) { 3432 pRow.title = this.values[i].DESCRIPTION; 3433 } 3434 3435 if (this.values[i].CLASS_NAME) { 3436 main_core.Dom.addClass(pRow, this.values[i].CLASS_NAME); 3437 } 3438 3439 if (this.values[i].URL) { 3440 pRow.appendChild(main_core.Dom.create('a', { 3441 props: { 3442 href: this.values[i].URL, 3443 className: 'bxecplloc-view', 3444 target: '_blank', 3445 title: this.openTitle 3446 } 3447 })); 3448 } 3449 } 3450 3451 this.oPopup = new Popup(this.id, this.pInput, { 3452 autoHide: true, 3453 offsetTop: 1, 3454 offsetLeft: 0, 3455 lightShadow: true, 3456 closeByEsc: true, 3457 content: pWnd, 3458 events: { 3459 onClose: this.ClosePopup.bind(this) 3460 } 3461 }); 3462 } 3463 3464 this.oPopup.show(); 3465 this.pInput.select(); 3466 this.bShowed = true; 3467 main_core_events.EventEmitter.emit(this, 'onInputPopupShow', new main_core_events.BaseEvent({ 3468 compatData: [this] 3469 })); 3470 } 3471 }, { 3472 key: "ClosePopup", 3473 value: function ClosePopup(bClosePopup) { 3474 this.bShowed = false; 3475 3476 if (this.pInput.value === '') { 3477 this.OnChange(); 3478 } 3479 3480 main_core_events.EventEmitter.emit(this, 'onInputPopupClose', new main_core_events.BaseEvent({ 3481 compatData: [this] 3482 })); 3483 3484 if (bClosePopup === true) { 3485 this.oPopup.close(); 3486 } 3487 } 3488 }, { 3489 key: "OnChange", 3490 value: function OnChange() { 3491 var val = this.pInput.value; 3492 3493 if (this.bValues) { 3494 if (this.pInput.value == '' || this.pInput.value == this.defaultValue) { 3495 this.pInput.value = this.defaultValue; 3496 this.pInput.className = this.emptyClassName; 3497 val = ''; 3498 } else { 3499 this.pInput.className = ''; 3500 } 3501 } 3502 3503 if (isNaN(parseInt(this.curInd)) || this.curInd !== false && val != this.values[this.curInd].NAME) { 3504 this.curInd = false; 3505 } else { 3506 this.curInd = parseInt(this.curInd); 3507 } 3508
3509 main_core_events.EventEmitter.emit(this, 'onInputPopupChanged', new main_core_events.BaseEvent({ 3510 compatData: [this, this.curInd, val] 3511 })); 3512 3513 if (this.handler && typeof this.handler == 'function') { 3514 this.handler({ 3515 ind: this.curInd, 3516 value: val 3517 }); 3518 } 3519 } 3520 }, { 3521 key: "Set", 3522 value: function Set(ind, val, bOnChange) { 3523 this.curInd = ind; 3524 3525 if (this.curInd !== false) { 3526 this.pInput.value = this.values[this.curInd].NAME; 3527 } else { 3528 this.pInput.value = val; 3529 } 3530 3531 if (bOnChange !== false) { 3532 this.OnChange(); 3533 } 3534 } 3535 }, { 3536 key: "Get", 3537 value: function Get(ind) { 3538 var id = false; 3539 3540 if (typeof ind == 'undefined') { 3541 ind = this.curInd; 3542 } 3543 3544 if (ind !== false && this.values[ind]) { 3545 id = this.values[ind].ID; 3546 } 3547 3548 return id; 3549 } 3550 }, { 3551 key: "GetIndex", 3552 value: function GetIndex(id) { 3553 for (var i = 0, l = this.values.length; i < l; i++) { 3554 if (this.values[i].ID == id) { 3555 return i; 3556 } 3557 } 3558 3559 return false; 3560 } 3561 }, { 3562 key: "Deactivate", 3563 value: function Deactivate(bDeactivate) { 3564 if (this.pInput.value == '' || this.pInput.value == this.defaultValue) { 3565 if (bDeactivate) { 3566 this.pInput.value = ''; 3567 this.pInput.className = this.noMRclassName; 3568 } else if (this.oEC.bUseMR) { 3569 this.pInput.value = this.defaultValue; 3570 this.pInput.className = this.emptyClassName; 3571 } 3572 } 3573 3574 this.pInput.disabled = bDeactivate; 3575 } 3576 }]); 3577 return InputPopup; 3578 }(); 3579 3580 /* 3581 3582 //ES6 3583 import { Popup, PopupManager } from 'main.popup'; 3584 const popup = new Popup(); 3585 PopupManager.create(); 3586 3587 //ES5 3588 var popup = new BX.Main.Popup(); 3589 BX.Main.PopupManager.create(); 3590 3591 //ES6 3592 import { Menu, MenuItem, MenuManager } from 'main.popup'; 3593 const menu = new Menu(); 3594 const item = new MenuItem(); 3595 MenuManager.create(); 3596 3597 //ES5 3598 var menu = new BX.Main.Menu(); 3599 var item = new BX.Main.MenuItem(); 3600 BX.Main.MenuManager.create(); 3601 3602 */ 3603 var BX = main_core.Reflection.namespace('BX'); 3604 /** @deprecated use BX.Main.Popup or import { Popup } from 'main.popup' */ 3605 3606 BX.PopupWindow = Popup; 3607 /** @deprecated use BX.Main.PopupManager or import { PopupManager } from 'main.popup' */ 3608 3609 BX.PopupWindowManager = PopupManager; 3610 /** @deprecated use BX.Main.Menu or import { Menu } from 'main.popup' */ 3611 3612 BX.PopupMenuWindow = Menu; 3613 /** @deprecated use BX.Main.MenuManager or import { MenuManager } from 'main.popup' */ 3614 3615 BX.PopupMenu = MenuManager; 3616 /** @deprecated use BX.Main.MenuItem or import { MenuItem } from 'main.popup' */ 3617 3618 BX.PopupMenuItem = MenuItem; 3619 /** @deprecated use BX.UI.Button */ 3620 3621 BX.PopupWindowButton = Button; 3622 /** @deprecated use BX.UI.Button */ 3623 3624 BX.PopupWindowButtonLink = ButtonLink; 3625 /** @deprecated use BX.UI.Button */ 3626 3627 BX.PopupWindowCustomButton = CustomButton; 3628 /** @deprecated use another API */ 3629 3630 window.BXInputPopup = InputPopup; 3631 3632 exports.Popup = Popup; 3633 exports.Menu = Menu; 3634 exports.MenuItem = MenuItem; 3635 exports.PopupManager = PopupManager; 3636 exports.MenuManager = MenuManager; 3637 exports.PopupWindow = PopupWindow; 3638 exports.PopupMenuWindow = PopupMenuWindow; 3639 exports.PopupMenuItem = PopupMenuItem; 3640 exports.PopupWindowManager = PopupManager; 3641 exports.PopupMenu = MenuManager; 3642 exports.PopupWindowButton = PopupWindowButton; 3643 exports.PopupWindowButtonLink = PopupWindowButtonLink; 3644 exports.PopupWindowCustomButton = PopupWindowCustomButton; 3645 3646}((this.BX.Main = this.BX.Main || {}),BX,BX.Event,BX)); 3647//# sourceMappingURL=main.popup.bundle.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.