UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

70 lines (69 loc) • 2.25 kB
/** * DevExtreme (esm/__internal/ui/html_editor/ui/m_baseDialog.js) * Version: 26.1.6 * Build date: Fri Oct 16 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import $ from "../../../../core/renderer"; import { Deferred } from "../../../../core/utils/deferred"; import Popup from "../../../../ui/popup"; import { isSmallScreen } from "../utils/small_screen"; const DROPDOWN_EDITOR_OVERLAY_CLASS = "dx-dropdowneditor-overlay"; class BaseDialog { constructor($container, popupConfig) { this._$container = $container; this._popupConfig = popupConfig; this._renderPopup() } _escKeyHandler() { var _this$_popup; null === (_this$_popup = this._popup) || void 0 === _this$_popup || _this$_popup.hide() } _addEscapeHandler(e) { e.component.registerKeyHandler("escape", () => this._escKeyHandler()) } _renderPopup() { const $popupContainer = $("<div>").addClass(this._getPopupClass()).appendTo(this._$container); this._popup = new Popup($popupContainer.get(0), this._getPopupConfig()) } _getPopupConfig() { return { deferRendering: false, focusStateEnabled: false, fullScreen: isSmallScreen(), _wrapperClassExternal: `${this._getPopupClass()} dx-dropdowneditor-overlay`, contentTemplate: contentElem => { this._renderContent($(contentElem)) }, onInitialized: e => { this._popup = e.component; this._popup.on("hiding", () => this.onHiding()) } } } onHiding() { var _this$deferred; null === (_this$deferred = this.deferred) || void 0 === _this$deferred || _this$deferred.reject() } show(options) { if (this._popup.option("visible")) { return } this.deferred = Deferred(); this._popup.show(); return this.deferred.promise() } hide(options, event) { this._popup.hide() } popupOption() { return this._popup.option(...arguments) } } export default BaseDialog;