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) 6.26 kB
"use strict"; 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 environment = require("../../../../utils/environment.js"); const useZIndex = require("../../../../hooks/useZIndex.js"); const uikitBaseComponentVue3 = require("@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__ */ Vue.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 = Vue.ref(false); const overlayContentStyle = Vue.ref({}); const { nextZIndex } = useZIndex.default(); let timer = null; const props = __props; Vue.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); } Vue.onMounted(async () => { onOpen(); duration(); }); return (_ctx, _cache) => { return Vue.openBlock(), Vue.createBlock(Vue.Transition, { name: "tui-message-box-fade" }, { default: Vue.withCtx(() => [ Vue.withDirectives(Vue.createElementVNode("div", { style: Vue.normalizeStyle(overlayContentStyle.value), class: Vue.normalizeClass([["overlay"], "message-box-overlay"]), onClick: handleOverlayClick }, [ Vue.createElementVNode("div", { class: Vue.normalizeClass(Vue.unref(environment.isMobile) ? "tui-message-box-h5" : "tui-message-box") }, [ Vue.createElementVNode("div", _hoisted_1, [ Vue.createElementVNode("div", _hoisted_2, Vue.toDisplayString(_ctx.title), 1), Vue.createElementVNode("div", _hoisted_3, [ Vue.createVNode(SvgIcon.default, { size: 16, icon: CloseIcon.default, onClick: handleClose }) ]) ]), Vue.createElementVNode("div", _hoisted_4, [ Vue.createElementVNode("div", null, Vue.toDisplayString(_ctx.message), 1) ]), Vue.unref(environment.isMobile) ? (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_5, [ _ctx.cancelButtonText ? (Vue.openBlock(), Vue.createElementBlock("div", { key: 0, class: "button-container", onClick: _cache[0] || (_cache[0] = ($event) => handleClose("cancel")) }, [ Vue.createVNode(Vue.unref(uikitBaseComponentVue3.TUIButton), { type: "primary", style: { "min-width": "88px" } }, { default: Vue.withCtx(() => [ Vue.createTextVNode(Vue.toDisplayString(_ctx.cancelButtonText), 1) ]), _: 1 }) ])) : Vue.createCommentVNode("", true), Vue.createElementVNode("div", { class: "button-container", onClick: _cache[1] || (_cache[1] = ($event) => handleClose("confirm")) }, [ Vue.createVNode(Vue.unref(uikitBaseComponentVue3.TUIButton), { type: "primary", style: { "min-width": "88px" } }, { default: Vue.withCtx(() => [ Vue.createTextVNode(Vue.toDisplayString(_ctx.confirmButtonText), 1) ]), _: 1 }) ]) ])) : (Vue.openBlock(), Vue.createElementBlock("div", _hoisted_6, [ Vue.createVNode(Vue.unref(uikitBaseComponentVue3.TUIButton), { onClick: _cache[2] || (_cache[2] = ($event) => handleClose("confirm")), type: "primary", style: { "min-width": "88px" } }, { default: Vue.withCtx(() => [ Vue.createTextVNode(Vue.toDisplayString(_ctx.confirmButtonText), 1) ]), _: 1 }), _ctx.cancelButtonText ? (Vue.openBlock(), Vue.createBlock(Vue.unref(uikitBaseComponentVue3.TUIButton), { key: 0, onClick: _cache[3] || (_cache[3] = ($event) => handleClose("cancel")), style: { "min-width": "88px" } }, { default: Vue.withCtx(() => [ Vue.createTextVNode(Vue.toDisplayString(_ctx.cancelButtonText), 1) ]), _: 1 })) : Vue.createCommentVNode("", true) ])) ], 2) ], 4), [ [Vue.vShow, visible.value] ]) ]), _: 1 }); }; } }); exports.default = _sfc_main;