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,
98 lines (97 loc) • 3.42 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const useZIndex = require("../../../../hooks/useZIndex.js");
const vTap = require("../../../../directives/vTap.js");
const _hoisted_1 = { class: "dialog-container" };
const _hoisted_2 = { class: "dialog-title" };
const _hoisted_3 = { class: "dialog-footer" };
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
__name: "DialogH5",
props: {
modelValue: { type: Boolean, default: false },
title: { default: "" },
confirmButton: { default: "" },
cancelButton: { default: "" },
closeOnClickModal: { type: Boolean, default: true },
appendToBody: { type: Boolean, default: false },
appendToRoomContainer: { type: Boolean, default: false },
modal: { type: Boolean, default: false }
},
emits: ["update:modelValue", "close", "confirm", "cancel"],
setup(__props, { emit: __emit }) {
const visible = Vue.ref(false);
const overlayContainerStyle = Vue.ref({});
const { nextZIndex } = useZIndex.default();
const dialogRef = Vue.ref();
const hasTitle = Vue.computed(() => props.title !== "");
const props = __props;
const emit = __emit;
Vue.watch(
() => props.modelValue,
(val) => {
visible.value = val;
}
);
Vue.watch(visible, (val) => {
var _a;
if (val) {
overlayContainerStyle.value = { zIndex: nextZIndex() };
if (props.appendToRoomContainer) {
(_a = document.getElementById("roomContainer")) == null ? void 0 : _a.appendChild(dialogRef.value);
}
}
});
function handleConfirm() {
emit("confirm");
}
function handleCancel() {
emit("cancel");
}
function handleClose() {
visible.value = false;
emit("update:modelValue", false);
emit("close");
}
function handleOverlayClick(event) {
if (!props.closeOnClickModal) {
return;
}
if (event.target !== event.currentTarget) {
return;
}
handleClose();
}
return (_ctx, _cache) => {
return Vue.withDirectives((Vue.openBlock(), Vue.createElementBlock("div", {
ref_key: "dialogRef",
ref: dialogRef,
class: Vue.normalizeClass(["overlay-container", [_ctx.modal && "overlay"]]),
style: Vue.normalizeStyle(overlayContainerStyle.value)
}, [
Vue.createElementVNode("div", _hoisted_1, [
Vue.createElementVNode("span", _hoisted_2, Vue.toDisplayString(props.title), 1),
Vue.createElementVNode("div", {
class: Vue.normalizeClass([hasTitle.value ? "dialog-content" : "dialog-content-notitle"])
}, [
Vue.renderSlot(_ctx.$slots, "default", {}, void 0, true)
], 2),
Vue.createElementVNode("div", _hoisted_3, [
Vue.createElementVNode("div", {
onClick: handleCancel,
class: "cancel-button"
}, Vue.toDisplayString(props.cancelButton), 1),
Vue.createElementVNode("div", {
onClick: handleConfirm,
class: "confirm-button"
}, Vue.toDisplayString(props.confirmButton), 1)
])
])
], 6)), [
[Vue.vShow, visible.value],
[Vue.unref(vTap.default), handleOverlayClick]
]);
};
}
});
exports.default = _sfc_main;