UNPKG

@tencentcloud/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,

106 lines (105 loc) 3.78 kB
"use strict"; Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); const Vue = require("vue"); const uikitBaseComponentVue3 = require("@tencentcloud/uikit-base-component-vue3"); const utils = require("../../../utils/utils.js"); const _hoisted_1 = { class: "drawer-header" }; const _hoisted_2 = { class: "drawer-header-title" }; const _hoisted_3 = { class: "drawer-content" }; const _sfc_main = /* @__PURE__ */ Vue.defineComponent({ __name: "Drawer", props: { title: { default: "" }, modelValue: { type: Boolean, default: false }, modal: { type: Boolean, default: false }, size: { default: "400" }, beforeClose: { type: Function, default: void 0 }, appendToBody: { type: Boolean, default: false }, appendToRoomContainer: { type: Boolean, default: false }, closeOnClickModal: { type: Boolean, default: true } }, emits: ["update:modelValue"], setup(__props, { emit: __emit }) { const props = __props; const emit = __emit; const drawerRef = Vue.ref(); const visible = Vue.ref(false); const drawerContainerStyle = Vue.computed(() => `width: ${utils.addSuffix(props.size)}`); Vue.watch( () => props.modelValue, (val) => { visible.value = val; } ); Vue.watch(visible, (val) => { var _a; if (val) { if (props.appendToBody) { document.body.appendChild(drawerRef.value); } else if (props.appendToRoomContainer) { (_a = document.getElementById("roomContainer")) == null ? void 0 : _a.appendChild(drawerRef.value); } } }); function doClose() { visible.value = false; emit("update:modelValue", false); } function handleClose() { if (props.beforeClose) { props.beforeClose(doClose); } else { doClose(); } } let mouseDownInCurrentTarget = false; let mouseUpInCurrentTarget = false; function handleOverlayMouseUp(event) { mouseUpInCurrentTarget = event.target === event.currentTarget; } function handleOverlayMouseDown(event) { mouseDownInCurrentTarget = event.target === event.currentTarget; } function handleOverlayClick() { if (!props.closeOnClickModal) { return; } if (mouseDownInCurrentTarget && mouseUpInCurrentTarget) { handleClose(); mouseDownInCurrentTarget = false; mouseUpInCurrentTarget = false; } } return (_ctx, _cache) => { return visible.value ? (Vue.openBlock(), Vue.createElementBlock("div", { key: 0, ref_key: "drawerRef", ref: drawerRef, class: Vue.normalizeClass(["overlay-container", [_ctx.modal && "overlay"]]), onMouseup: handleOverlayMouseUp, onMousedown: handleOverlayMouseDown, onClick: handleOverlayClick }, [ Vue.createElementVNode("div", { class: "drawer-container", style: Vue.normalizeStyle(drawerContainerStyle.value) }, [ Vue.createElementVNode("div", _hoisted_1, [ Vue.createElementVNode("div", _hoisted_2, Vue.toDisplayString(_ctx.title), 1), _ctx.$slots.title ? Vue.renderSlot(_ctx.$slots, "title", { key: 0 }, void 0, true) : Vue.createCommentVNode("", true), Vue.createElementVNode("div", { class: "close", onClick: handleClose }, [ Vue.createVNode(Vue.unref(uikitBaseComponentVue3.IconClose)) ]) ]), Vue.createElementVNode("div", _hoisted_3, [ Vue.renderSlot(_ctx.$slots, "default", {}, void 0, true) ]) ], 4) ], 34)) : Vue.createCommentVNode("", true); }; } }); exports.default = _sfc_main;