This commit is contained in:
root
2025-11-13 19:52:28 +03:00
parent 8aeeb05b7d
commit 807dec3b6c
4646 changed files with 163445 additions and 626017 deletions

View File

@@ -259,6 +259,25 @@ this.BX = this.BX || {};
_this = babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(Popup).call(this));
_classPrivateMethodInitSpec(babelHelpers.assertThisInitialized(_this), _enableTargetScroll);
_classPrivateMethodInitSpec(babelHelpers.assertThisInitialized(_this), _disableTargetScroll);
babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "handleAutoHide", function (event) {
if (_this.isDestroyed()) {
return;
}
if (_this.autoHideHandler !== null) {
if (_this.autoHideHandler(event)) {
_this._tryCloseByEvent(event);
}
} else if (event.target !== _this.getPopupContainer() && !_this.getPopupContainer().contains(event.target)) {
_this._tryCloseByEvent(event);
}
});
babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "handleDocumentKeyUp", function (event) {
if (event.keyCode === 27) {
checkEscPressed(_this.getZindex(), function () {
_this.close();
});
}
});
_this.setEventNamespace('BX.Main.Popup');
var _arguments = Array.prototype.slice.call(arguments),
popupId = _arguments[0],
@@ -303,7 +322,6 @@ this.BX = this.BX || {};
_this.autoHide = params.autoHide === true;
_this.disableScroll = params.disableScroll === true || params.isScrollBlock === true;
_this.autoHideHandler = main_core.Type.isFunction(params.autoHideHandler) ? params.autoHideHandler : null;
_this.handleAutoHide = _this.handleAutoHide.bind(babelHelpers.assertThisInitialized(_this));
_this.handleOverlayClick = _this.handleOverlayClick.bind(babelHelpers.assertThisInitialized(_this));
_this.isAutoHideBinded = false;
_this.closeByEsc = params.closeByEsc === true;
@@ -324,7 +342,7 @@ this.BX = this.BX || {};
_this.contentBackground = null;
_this.borderRadius = null;
_this.contentBorderRadius = null;
_this.targetContainer = main_core.Type.isElementNode(params.targetContainer) ? params.targetContainer : document.body;
_this.setTargetContainer(params.targetContainer);
_this.dragOptions = {
cursor: '',
callback: function callback() {},
@@ -338,7 +356,6 @@ this.BX = this.BX || {};
_this.animationCloseEventType = null;
_this.handleDocumentMouseMove = _this.handleDocumentMouseMove.bind(babelHelpers.assertThisInitialized(_this));
_this.handleDocumentMouseUp = _this.handleDocumentMouseUp.bind(babelHelpers.assertThisInitialized(_this));
_this.handleDocumentKeyUp = _this.handleDocumentKeyUp.bind(babelHelpers.assertThisInitialized(_this));
_this.handleResizeWindow = _this.handleResizeWindow.bind(babelHelpers.assertThisInitialized(_this));
_this.handleResize = _this.handleResize.bind(babelHelpers.assertThisInitialized(_this));
_this.handleMove = _this.handleMove.bind(babelHelpers.assertThisInitialized(_this));
@@ -380,7 +397,7 @@ this.BX = this.BX || {};
* @private
*/
_this.popupContainer = main_core.Tag.render(_templateObject4 || (_templateObject4 = babelHelpers.taggedTemplateLiteral(["\n\t\t\t<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>\n\t\t"])), popupClassName, popupId, [_this.titleBar, _this.contentContainer, _this.closeIcon]);
_this.targetContainer.appendChild(_this.popupContainer);
_this.getTargetContainer().append(_this.popupContainer);
_this.zIndexComponent = main_core_zIndexManager.ZIndexManager.register(_this.popupContainer, params.zIndexOptions);
_this.buttonsContainer = null;
if (params.contentColor && main_core.Type.isStringFilled(params.contentColor)) {
@@ -985,6 +1002,23 @@ this.BX = this.BX || {};
this.designSystemContext = context;
}
}
}, {
key: "setTargetContainer",
value: function setTargetContainer(targetContainer) {
var newTargetContainer = main_core.Type.isElementNode(targetContainer) ? targetContainer : document.body;
if (newTargetContainer === this.targetContainer) {
return;
}
this.targetContainer = newTargetContainer;
if (this.getPopupContainer()) {
main_core_zIndexManager.ZIndexManager.unregister(this.getPopupContainer());
this.getTargetContainer().append(this.getPopupContainer());
main_core_zIndexManager.ZIndexManager.register(this.getPopupContainer());
}
if (this.overlay) {
main_core.Dom.append(this.overlay.element, this.getTargetContainer());
}
}
}, {
key: "getTargetContainer",
value: function getTargetContainer() {
@@ -1159,7 +1193,7 @@ this.BX = this.BX || {};
key: "bindClosingByEsc",
value: function bindClosingByEsc() {
if (this.closeByEsc && !this.isCloseByEscBinded) {
main_core.Event.bind(document, 'keyup', this.handleDocumentKeyUp);
main_core.Event.bind(this.targetContainer.ownerDocument, 'keyup', this.handleDocumentKeyUp, true);
this.isCloseByEscBinded = true;
}
}
@@ -1170,7 +1204,7 @@ this.BX = this.BX || {};
key: "unbindClosingByEsc",
value: function unbindClosingByEsc() {
if (this.isCloseByEscBinded) {
main_core.Event.unbind(document, 'keyup', this.handleDocumentKeyUp);
main_core.Event.unbind(this.targetContainer.ownerDocument, 'keyup', this.handleDocumentKeyUp, true);
this.isCloseByEscBinded = false;
}
}
@@ -1201,9 +1235,9 @@ this.BX = this.BX || {};
main_core.Event.bind(this.overlay.element, 'click', this.handleOverlayClick);
} else {
if (this.isCompatibleMode()) {
main_core.Event.bind(document, 'click', this.handleAutoHide);
main_core.Event.bind(this.targetContainer.ownerDocument, 'click', this.handleAutoHide);
} else {
document.addEventListener('click', this.handleAutoHide, true);
this.targetContainer.ownerDocument.addEventListener('click', this.handleAutoHide, true);
}
}
}
@@ -1223,9 +1257,9 @@ this.BX = this.BX || {};
main_core.Event.unbind(this.overlay.element, 'click', this.handleOverlayClick);
} else {
if (this.isCompatibleMode()) {
main_core.Event.unbind(document, 'click', this.handleAutoHide);
main_core.Event.unbind(this.targetContainer.ownerDocument, 'click', this.handleAutoHide);
} else {
document.removeEventListener('click', this.handleAutoHide, true);
this.targetContainer.ownerDocument.removeEventListener('click', this.handleAutoHide, true);
}
}
}
@@ -1234,24 +1268,10 @@ this.BX = this.BX || {};
* @private
*/
}, {
key: "handleAutoHide",
value: function handleAutoHide(event) {
if (this.isDestroyed()) {
return;
}
if (this.autoHideHandler !== null) {
if (this.autoHideHandler(event)) {
this._tryCloseByEvent(event);
}
} else if (event.target !== this.getPopupContainer() && !this.getPopupContainer().contains(event.target)) {
this._tryCloseByEvent(event);
}
}
key: "_tryCloseByEvent",
/**
* @private
*/
}, {
key: "_tryCloseByEvent",
value: function _tryCloseByEvent(event) {
var _this2 = this;
if (this.isCompatibleMode()) {
@@ -1289,7 +1309,7 @@ this.BX = this.BX || {};
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())
};
this.resizeOverlay();
main_core.Dom.append(this.overlay.element, this.targetContainer);
main_core.Dom.append(this.overlay.element, this.getTargetContainer());
this.getZIndexComponent().setOverlay(this.overlay.element);
}
if (main_core.Type.isNumber(params === null || params === void 0 ? void 0 : params.opacity) && params.opacity >= 0 && params.opacity <= 100) {
@@ -1553,7 +1573,8 @@ this.BX = this.BX || {};
}, {
key: "isShown",
value: function isShown() {
return !this.isDestroyed() && this.getPopupContainer().style.display === 'block';
var _this$getPopupContain;
return !this.isDestroyed() && ((_this$getPopupContain = this.getPopupContainer()) === null || _this$getPopupContain === void 0 ? void 0 : _this$getPopupContain.style.display) === 'block';
}
}, {
key: "destroy",
@@ -1753,20 +1774,10 @@ this.BX = this.BX || {};
* @private
*/
}, {
key: "handleDocumentKeyUp",
value: function handleDocumentKeyUp(event) {
var _this7 = this;
if (event.keyCode === 27) {
checkEscPressed(this.getZindex(), function () {
_this7.close();
});
}
}
key: "handleResizeWindow",
/**
* @private
*/
}, {
key: "handleResizeWindow",
value: function handleResizeWindow() {
if (this.isShown()) {
this.adjustPosition();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long