@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,
195 lines (194 loc) • 7.86 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const Vue = require("vue");
const index = require("../../../locales/index.js");
const Button = require("../../common/base/Button.vue.js");
const index$1 = require("../../common/base/Dialog/index.vue.js");
const index$2 = require("../../common/base/Input/index.vue.js");
const SvgIcon = require("../../common/base/SvgIcon.vue.js");
const ArrowUpIcon = require("../../common/icons/ArrowUpIcon.vue.js");
const useMemberControlHooks = require("./useMemberControlHooks.js");
const useMemberItemHooks = require("../MemberItem/useMemberItemHooks.js");
const _hoisted_1 = { class: "member-control-container" };
const _hoisted_2 = ["onClick"];
const _hoisted_3 = { class: "operate-text" };
const _hoisted_4 = { class: "dialog-content" };
const _sfc_main = /* @__PURE__ */ Vue.defineComponent({
__name: "index",
props: {
userInfo: {},
showMemberControl: { type: Boolean }
},
setup(__props) {
const props = __props;
const { t } = index.useI18n();
const {
controlList,
handleCancelDialog,
handleAction,
isDialogVisible,
dialogData,
tempUserName
} = useMemberControlHooks.default(props);
const { isCanOperateMySelf } = useMemberItemHooks.default(props.userInfo);
const singleControl = Vue.computed(() => {
return isCanOperateMySelf.value ? null : controlList.value[0];
});
const moreControlList = Vue.computed(() => {
return isCanOperateMySelf.value ? controlList.value : controlList.value.slice(1);
});
const dropdownClass = Vue.ref("down");
const moreBtnRef = Vue.ref();
const operateListRef = Vue.ref();
const showMoreControl = Vue.ref(false);
Vue.watch(
() => props.showMemberControl,
(val) => {
if (!val) {
showMoreControl.value = false;
}
}
);
async function toggleClickMoreBtn() {
if (showMoreControl.value) {
showMoreControl.value = false;
} else {
await handleDropDownPosition();
showMoreControl.value = true;
}
}
async function handleDropDownPosition() {
var _a, _b, _c;
const { top, bottom } = (_a = moreBtnRef.value) == null ? void 0 : _a.getBoundingClientRect();
const { top: containerTop, bottom: containerBottom } = (_b = document.getElementById("memberListContainer")) == null ? void 0 : _b.getBoundingClientRect();
if (!containerBottom || !containerTop) {
return;
}
const bottomSize = containerBottom - bottom;
const topSize = top - containerTop;
let dropDownContainerHeight = 0;
if (!showMoreControl.value) {
operateListRef.value.style = "display:block;position:absolute;z-index:-1000";
await Vue.nextTick();
dropDownContainerHeight = operateListRef.value.offsetHeight;
operateListRef.value.style = "";
} else {
dropDownContainerHeight = (_c = operateListRef.value) == null ? void 0 : _c.offsetHeight;
}
if (topSize < dropDownContainerHeight) {
return;
}
if (bottomSize < dropDownContainerHeight) {
dropdownClass.value = "up";
}
}
return (_ctx, _cache) => {
return Vue.openBlock(), Vue.createElementBlock("div", _hoisted_1, [
singleControl.value ? (Vue.openBlock(), Vue.createBlock(Button.default, {
key: 0,
class: "button",
size: "default",
onClick: _cache[0] || (_cache[0] = ($event) => singleControl.value.func(props.userInfo))
}, {
default: Vue.withCtx(() => {
var _a;
return [
Vue.createTextVNode(Vue.toDisplayString((_a = singleControl.value) == null ? void 0 : _a.title), 1)
];
}),
_: 1
})) : Vue.createCommentVNode("", true),
Vue.createElementVNode("div", {
ref_key: "moreBtnRef",
ref: moreBtnRef,
class: "more-container"
}, [
Vue.createVNode(Button.default, {
class: "button",
type: "primary",
onClick: toggleClickMoreBtn
}, {
default: Vue.withCtx(() => [
Vue.createTextVNode(Vue.toDisplayString(Vue.unref(t)("More")) + " ", 1),
Vue.createVNode(SvgIcon.default, {
size: "12",
class: Vue.normalizeClass(["more-arrow", showMoreControl.value ? "up" : "down"]),
icon: ArrowUpIcon.default
}, null, 8, ["class"])
]),
_: 1
}),
Vue.withDirectives(Vue.createElementVNode("div", {
id: "operate-list",
ref_key: "operateListRef",
ref: operateListRef,
class: Vue.normalizeClass(["user-operate-list", dropdownClass.value])
}, [
(Vue.openBlock(true), Vue.createElementBlock(Vue.Fragment, null, Vue.renderList(moreControlList.value, (item) => {
return Vue.openBlock(), Vue.createElementBlock("div", {
key: item.key,
class: "user-operate-item",
onClick: ($event) => item.func(props.userInfo)
}, [
Vue.createVNode(SvgIcon.default, {
icon: item.icon
}, null, 8, ["icon"]),
Vue.createElementVNode("span", _hoisted_3, Vue.toDisplayString(item.title), 1)
], 8, _hoisted_2);
}), 128))
], 2), [
[Vue.vShow, showMoreControl.value]
])
], 512),
Vue.createVNode(index$1.default, {
modelValue: Vue.unref(isDialogVisible),
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => Vue.isRef(isDialogVisible) ? isDialogVisible.value = $event : null),
title: Vue.unref(dialogData).title,
modal: true,
width: "480px",
"before-close": Vue.unref(handleCancelDialog),
"close-on-click-modal": true,
"append-to-room-container": true
}, {
footer: Vue.withCtx(() => [
Vue.createVNode(Button.default, {
size: "default",
onClick: _cache[2] || (_cache[2] = ($event) => Vue.unref(handleAction)(props.userInfo)),
disabled: Vue.unref(dialogData).isConfirmButtonDisable
}, {
default: Vue.withCtx(() => [
Vue.createTextVNode(Vue.toDisplayString(Vue.unref(dialogData).confirmText), 1)
]),
_: 1
}, 8, ["disabled"]),
Vue.createVNode(Button.default, {
class: "cancel",
size: "default",
type: "primary",
onClick: Vue.unref(handleCancelDialog)
}, {
default: Vue.withCtx(() => [
Vue.createTextVNode(Vue.toDisplayString(Vue.unref(t)("Cancel")), 1)
]),
_: 1
}, 8, ["onClick"])
]),
default: Vue.withCtx(() => [
Vue.createElementVNode("div", _hoisted_4, [
Vue.createElementVNode("span", null, Vue.toDisplayString(Vue.unref(dialogData).content), 1),
Vue.unref(dialogData).showInput ? (Vue.openBlock(), Vue.createBlock(index$2.default, {
key: 0,
"model-value": Vue.unref(tempUserName),
onInput: _cache[1] || (_cache[1] = ($event) => tempUserName.value = $event),
class: "dialog-input",
placeholder: Vue.unref(t)("Please input user name")
}, null, 8, ["model-value", "placeholder"])) : Vue.createCommentVNode("", true)
])
]),
_: 1
}, 8, ["modelValue", "title", "before-close"])
]);
};
}
});
exports.default = _sfc_main;