@progress/kendo-vue-dialogs
Version:
136 lines (135 loc) • 4.04 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { defineComponent as M, h as n, createVNode as i } from "vue";
import { getTemplate as o } from "@progress/kendo-vue-common";
import { Button as l } from "@progress/kendo-vue-buttons";
import { provideLocalizationService as v } from "@progress/kendo-vue-intl";
import { windowStage as s } from "./StageEnum.mjs";
import { dialogsWindowMinimizeButton as r, messages as c, dialogsWindowMaximizeButton as u, dialogsWindowRestoreButton as d, dialogsWindowCloseButton as m } from "./messages/main.mjs";
import { windowMinimizeIcon as L, windowIcon as x, windowRestoreIcon as $, xIcon as j } from "@progress/kendo-svg-icons";
const K = /* @__PURE__ */ M({
name: "KendoWindowTitleBar",
props: {
id: String,
stage: String,
closeButton: [String, Function, Object, Boolean],
minimizeButton: [String, Function, Object, Boolean],
maximizeButton: [String, Function, Object, Boolean],
restoreButton: [String, Function, Object, Boolean],
title: String,
titleId: String,
titleRender: [String, Function, Object, Boolean],
onDoubleclick: Function,
onMinimizeclick: Function,
onFullscreenclick: Function,
onRestoreclick: Function,
onCloseclick: Function
},
inject: {
kendoLocalizationService: {
default: null
}
},
methods: {
onDoubleClick(t) {
this.$emit("doubleclick", t);
},
onMinimizeClick(t) {
this.$emit("minimizeclick", t);
},
onFullScreenClick(t) {
this.$emit("fullscreenclick", t);
},
onRestoreClick(t) {
this.$emit("restoreclick", t);
},
onCloseClick(t) {
this.$emit("closeclick", t);
}
},
render() {
const t = this.$props, {
stage: a,
title: g,
titleRender: w,
minimizeButton: k,
maximizeButton: p,
restoreButton: B,
closeButton: f
} = t, e = v(this);
let h = o.call(this, {
h: n,
template: w,
defaultRendering: g
});
const b = i(l, {
type: "button",
class: "k-window-titlebar-action",
icon: "window-minimize",
svgIcon: L,
fillMode: "flat",
onClick: this.onMinimizeClick,
"aria-label": e.toLanguageString(r, c[r])
}, null), C = o.call(this, {
h: n,
template: k,
defaultRendering: b
}), z = i(l, {
type: "button",
class: "k-window-titlebar-action",
icon: "window",
svgIcon: x,
fillMode: "flat",
onClick: this.onFullScreenClick,
"aria-label": e.toLanguageString(u, c[u])
}, null), S = o.call(this, {
h: n,
template: p,
defaultRendering: z
}), F = i(l, {
type: "button",
class: "k-window-titlebar-action",
icon: "window-restore",
svgIcon: $,
fillMode: "flat",
onClick: this.onRestoreClick,
"aria-label": e.toLanguageString(d, c[d])
}, null), R = o.call(this, {
h: n,
template: B,
defaultRendering: F
}), D = i(l, {
type: "button",
class: "k-window-titlebar-action",
icon: "x",
svgIcon: j,
fillMode: "flat",
onClick: this.onCloseClick,
"aria-label": e.toLanguageString(m, c[m])
}, null), I = o.call(this, {
h: n,
template: f,
defaultRendering: D
});
return i("div", {
class: "k-window-titlebar",
style: {
touchAction: "none"
},
onDblclick: this.onDoubleClick
}, [i("span", {
class: "k-window-title",
id: this.$props.titleId
}, [h]), i("div", {
class: "k-window-titlebar-actions"
}, [a === s.DEFAULT && C, a === s.DEFAULT && S, a !== s.DEFAULT && R, I])]);
}
});
export {
K as WindowTitleBar
};