@tencentcloud/roomkit-electron-vue3
Version:
<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,
145 lines (144 loc) • 5.16 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const SvgIcon = require("../SvgIcon.vue.js");
const CloseIcon = require("../../icons/CloseIcon.vue.js");
const utils = require("../../../../utils/utils.js");
const useZIndex = require("../../../../hooks/useZIndex.js");
const _hoisted_1 = { key: 0 };
const _hoisted_2 = { class: "tui-dialog-header" };
const _hoisted_3 = { class: "tui-dialog-header-title" };
const _hoisted_4 = { class: "tui-dialog-header-title-content" };
const _hoisted_5 = {
key: 1,
class: "close"
};
const _hoisted_6 = { class: "tui-dialog-content" };
const _hoisted_7 = {
key: 0,
class: "tui-dialog-footer"
};
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
__name: "index",
props: {
title: { default: "" },
modelValue: { type: Boolean, default: false },
modal: { type: Boolean, default: false },
width: { default: void 0 },
beforeClose: { type: [Function, null], default: null },
closeOnClickModal: { type: Boolean, default: true },
showClose: { type: Boolean, default: true },
appendToBody: { type: Boolean, default: false },
appendToRoomContainer: { type: Boolean, default: false },
confirmButton: { default: "" },
cancelButton: { default: "" },
titleIcon: { default: null }
},
emits: ["update:modelValue", "close", "confirm", "cancel"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const { nextZIndex } = useZIndex.default();
const teleportDisable = Vue.computed(
() => !props.appendToBody && !props.appendToRoomContainer
);
const targetName = Vue.computed(() => {
if (props.appendToRoomContainer) {
return "#roomContainer";
}
return "body";
});
const overlayContainerStyle = Vue.ref({});
const visible = Vue.ref(false);
const dialogRef = Vue.ref();
const drawerContainerStyle = Vue.computed(() => {
let style = "";
if (props.width) {
style += `--tui-dialog-width: ${utils.addSuffix(props.width)}`;
}
return style;
});
Vue.watch(
() => props.modelValue,
(val) => {
visible.value = val;
},
{
immediate: true
}
);
Vue.watch(visible, (val) => {
if (val) {
overlayContainerStyle.value = { zIndex: nextZIndex() };
}
});
function doClose() {
visible.value = false;
emit("close");
emit("update:modelValue", false);
}
function handleClose() {
if (props.beforeClose) {
props.beforeClose(doClose);
} else {
doClose();
}
}
function handleOverlayClick(event) {
if (!props.closeOnClickModal) {
return;
}
if (event.target !== event.currentTarget) {
return;
}
handleClose();
}
return (_ctx, _cache) => {
return visible.value ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
(Vue.openBlock(), Vue.createBlock(Vue.Teleport, {
to: targetName.value,
disabled: teleportDisable.value
}, [
Vue.createElementVNode("div", {
ref_key: "dialogRef",
ref: dialogRef,
class: Vue.normalizeClass(["overlay-container", [_ctx.modal && "overlay"]]),
style: Vue.normalizeStyle(overlayContainerStyle.value),
onClick: handleOverlayClick
}, [
Vue.createElementVNode("div", {
class: "tui-dialog-container",
style: Vue.normalizeStyle(drawerContainerStyle.value)
}, [
Vue.createElementVNode("div", _hoisted_2, [
Vue.createElementVNode("div", _hoisted_3, [
Vue.createVNode(SvgIcon.default, { icon: _ctx.titleIcon }, null, 8, ["icon"]),
Vue.createElementVNode("div", _hoisted_4, Vue.toDisplayString(_ctx.title), 1)
]),
_ctx.$slots.title ? Vue.renderSlot(_ctx.$slots, "title", { key: 0 }, void 0, true) : Vue.createCommentVNode("", true),
_ctx.showClose ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_5, [
Vue.createVNode(SvgIcon.default, {
size: 16,
onClick: handleClose
}, {
default: Vue.withCtx(() => [
Vue.createVNode(CloseIcon.default)
]),
_: 1
})
])) : Vue.createCommentVNode("", true)
]),
Vue.createElementVNode("div", _hoisted_6, [
Vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
]),
_ctx.$slots.footer ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_7, [
Vue.renderSlot(_ctx.$slots, "footer", {}, void 0, true)
])) : Vue.createCommentVNode("", true)
], 4)
], 6)
], 8, ["to", "disabled"]))
])) : Vue.createCommentVNode("", true);
};
}
});
exports.default = _sfc_main;