UNPKG

roomkit-web-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,

165 lines (164 loc) 5.99 kB
import { defineComponent, ref, watch, onMounted, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeStyle, normalizeClass, unref, toDisplayString, createVNode, createElementBlock, createTextVNode, createCommentVNode, vShow } from "vue"; import SvgIcon from "../SvgIcon.vue.mjs"; import CloseIcon from "../../icons/CloseIcon.vue.mjs"; import { isMobile } from "../../../../utils/environment.mjs"; import useZIndex from "../../../../hooks/useZIndex.mjs"; import { TUIButton } from "@tencentcloud/uikit-base-component-vue3"; const _hoisted_1 = { class: "tui-message-box-header" }; const _hoisted_2 = { class: "tui-message-box-title" }; const _hoisted_3 = { class: "close" }; const _hoisted_4 = { class: "tui-message-box-body" }; const _hoisted_5 = { key: 0, class: "tui-message-box-footer" }; const _hoisted_6 = { key: 1, class: "tui-message-box-footer" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "index", props: { title: { default: "" }, message: { default: "" }, callback: { type: [Function, null], default: null }, duration: { default: Infinity }, cancelButtonText: { default: "" }, confirmButtonText: { default: "" }, remove: { type: Function, default: () => { } } }, emits: ["close"], setup(__props, { emit: __emit }) { const visible = ref(false); const overlayContentStyle = ref({}); const { nextZIndex } = useZIndex(); let timer = null; const props = __props; watch(visible, (val) => { if (val) { overlayContentStyle.value = { zIndex: nextZIndex() }; } }); const emit = __emit; function handleClose(action) { if (timer) { clearTimeout(timer); timer = null; } props.callback && props.callback(action); doClose(); } function doClose() { visible.value = false; props.remove(); emit("close"); } function handleOverlayClick(event) { if (event.target !== event.currentTarget) { return; } handleClose("close"); } function onOpen() { visible.value = true; } function duration() { if (props.duration === Infinity) return; timer = setTimeout(() => { handleClose("close"); }, props.duration); } onMounted(async () => { onOpen(); duration(); }); return (_ctx, _cache) => { return openBlock(), createBlock(Transition, { name: "tui-message-box-fade" }, { default: withCtx(() => [ withDirectives(createElementVNode("div", { style: normalizeStyle(overlayContentStyle.value), class: normalizeClass([["overlay"], "message-box-overlay"]), onClick: handleOverlayClick }, [ createElementVNode("div", { class: normalizeClass(unref(isMobile) ? "tui-message-box-h5" : "tui-message-box") }, [ createElementVNode("div", _hoisted_1, [ createElementVNode("div", _hoisted_2, toDisplayString(_ctx.title), 1), createElementVNode("div", _hoisted_3, [ createVNode(SvgIcon, { size: 16, icon: CloseIcon, onClick: handleClose }) ]) ]), createElementVNode("div", _hoisted_4, [ createElementVNode("div", null, toDisplayString(_ctx.message), 1) ]), unref(isMobile) ? (openBlock(), createElementBlock("div", _hoisted_5, [ _ctx.cancelButtonText ? (openBlock(), createElementBlock("div", { key: 0, class: "button-container", onClick: _cache[0] || (_cache[0] = ($event) => handleClose("cancel")) }, [ createVNode(unref(TUIButton), { type: "primary", style: { "min-width": "88px" } }, { default: withCtx(() => [ createTextVNode(toDisplayString(_ctx.cancelButtonText), 1) ]), _: 1 }) ])) : createCommentVNode("", true), createElementVNode("div", { class: "button-container", onClick: _cache[1] || (_cache[1] = ($event) => handleClose("confirm")) }, [ createVNode(unref(TUIButton), { type: "primary", style: { "min-width": "88px" } }, { default: withCtx(() => [ createTextVNode(toDisplayString(_ctx.confirmButtonText), 1) ]), _: 1 }) ]) ])) : (openBlock(), createElementBlock("div", _hoisted_6, [ createVNode(unref(TUIButton), { onClick: _cache[2] || (_cache[2] = ($event) => handleClose("confirm")), type: "primary", style: { "min-width": "88px" } }, { default: withCtx(() => [ createTextVNode(toDisplayString(_ctx.confirmButtonText), 1) ]), _: 1 }), _ctx.cancelButtonText ? (openBlock(), createBlock(unref(TUIButton), { key: 0, onClick: _cache[3] || (_cache[3] = ($event) => handleClose("cancel")), style: { "min-width": "88px" } }, { default: withCtx(() => [ createTextVNode(toDisplayString(_ctx.cancelButtonText), 1) ]), _: 1 })) : createCommentVNode("", true) ])) ], 2) ], 4), [ [vShow, visible.value] ]) ]), _: 1 }); }; } }); export { _sfc_main as default };