devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
137 lines (135 loc) • 4.79 kB
JavaScript
/**
* DevExtreme (cjs/__internal/ui/diagram/ui.diagram.dialogs.js)
* Version: 25.2.7
* Build date: Tue May 05 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _message = _interopRequireDefault(require("../../../common/core/localization/message"));
var _renderer = _interopRequireDefault(require("../../../core/renderer"));
var _extend = require("../../../core/utils/extend");
var _widget = _interopRequireDefault(require("../../core/widget/widget"));
var _m_popup = _interopRequireDefault(require("../../ui/popup/m_popup"));
function _interopRequireDefault(e) {
return e && e.__esModule ? e : {
default: e
}
}
class DiagramDialog extends _widget.default {
_init() {
super._init();
this._command = void 0;
this._isShown = false;
this._createOnGetContentOption();
this._createOnHiddenOption()
}
_initMarkup() {
super._initMarkup();
const {
command: command,
title: title,
maxWidth: maxWidth,
height: height,
toolbarItems: toolbarItems
} = this.option();
this._command = command;
this._$popupElement = (0, _renderer.default)("<div>").appendTo(this.$element());
this._popup = this._createComponent(this._$popupElement, _m_popup.default, {
title: title,
maxWidth: maxWidth,
height: height,
toolbarItems: toolbarItems,
onHidden: this._onHiddenAction
})
}
_clean() {
var _this$_$popupElement;
delete this._popup;
null === (_this$_$popupElement = this._$popupElement) || void 0 === _this$_$popupElement || _this$_$popupElement.remove()
}
_getDefaultOptions() {
return (0, _extend.extend)(super._getDefaultOptions(), {
title: "",
maxWidth: 500,
height: "auto",
toolbarItems: this._getToolbarItems()
})
}
_getToolbarItems() {
return [this._getOkToolbarItem(), this._getCancelToolbarItem()]
}
_getOkToolbarItem() {
return {
widget: "dxButton",
location: "after",
toolbar: "bottom",
options: {
text: _message.default.format("dxDiagram-dialogButtonOK"),
onClick: () => {
this._command.execute(this._commandParameter);
this._hide()
}
}
}
}
_getCancelToolbarItem() {
return {
widget: "dxButton",
location: "after",
toolbar: "bottom",
options: {
text: _message.default.format("dxDiagram-dialogButtonCancel"),
onClick: this._hide.bind(this)
}
}
}
_optionChanged(args) {
var _this$_popup;
switch (args.name) {
case "title":
case "maxWidth":
case "height":
case "toolbarItems":
null === (_this$_popup = this._popup) || void 0 === _this$_popup || _this$_popup.option(args.name, args.value);
break;
case "command":
this._command = args.value;
break;
case "onGetContent":
this._createOnGetContentOption();
break;
case "onHidden":
this._createOnHiddenOption();
break;
default:
super._optionChanged(args)
}
}
_createOnGetContentOption() {
this._onGetContentAction = this._createActionByOption("onGetContent")
}
_createOnHiddenOption() {
this._onHiddenAction = this._createActionByOption("onHidden")
}
_hide() {
var _this$_popup2;
null === (_this$_popup2 = this._popup) || void 0 === _this$_popup2 || _this$_popup2.hide();
this._isShown = false
}
_show() {
var _this$_popup3, _this$_popup4;
null === (_this$_popup3 = this._popup) || void 0 === _this$_popup3 || null === (_this$_popup3 = _this$_popup3.$content()) || void 0 === _this$_popup3 || _this$_popup3.empty().append(this._onGetContentAction());
null === (_this$_popup4 = this._popup) || void 0 === _this$_popup4 || _this$_popup4.show();
this._isShown = true
}
isVisible() {
return this._isShown
}
}
var _default = exports.default = DiagramDialog;