yx-web-sdk 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +424 -0
- package/dist/AntdIcon-B0sjNvGu.mjs +307 -0
- package/dist/CloseOutlined-DDb89ei3.mjs +37 -0
- package/dist/_plugin-vue_export-helper-1tPrXgE0.mjs +10 -0
- package/dist/ait-person-popover/index.d.ts +3 -0
- package/dist/ait-person-popover/index.js +5 -0
- package/dist/ait-person-popover/index.vue.d.ts +39 -0
- package/dist/chat-card/index.d.ts +3 -0
- package/dist/chat-card/index.js +5 -0
- package/dist/chat-card/index.vue.d.ts +25 -0
- package/dist/chat-content/index.d.ts +3 -0
- package/dist/chat-content/index.js +5 -0
- package/dist/chat-content/index.vue.d.ts +51 -0
- package/dist/chat-page/index.d.ts +3 -0
- package/dist/chat-page/index.js +5 -0
- package/dist/chat-page/index.vue.d.ts +6 -0
- package/dist/chat-room/index.d.ts +3 -0
- package/dist/chat-room/index.js +5 -0
- package/dist/chat-room/index.vue.d.ts +9 -0
- package/dist/common-avatar/index.d.ts +3 -0
- package/dist/common-avatar/index.js +5 -0
- package/dist/common-avatar/index.vue.d.ts +17 -0
- package/dist/components/ait-person-popover/index.d.ts +3 -0
- package/dist/components/ait-person-popover/index.vue.d.ts +39 -0
- package/dist/components/chat-card/index.d.ts +3 -0
- package/dist/components/chat-card/index.vue.d.ts +25 -0
- package/dist/components/chat-content/composables/ait-person.d.ts +86 -0
- package/dist/components/chat-content/index.d.ts +3 -0
- package/dist/components/chat-content/index.vue.d.ts +51 -0
- package/dist/components/chat-page/index.d.ts +3 -0
- package/dist/components/chat-page/index.vue.d.ts +6 -0
- package/dist/components/chat-room/index.d.ts +3 -0
- package/dist/components/chat-room/index.vue.d.ts +9 -0
- package/dist/components/common-avatar/index.d.ts +3 -0
- package/dist/components/common-avatar/index.vue.d.ts +17 -0
- package/dist/components/icon-font/index.d.ts +47 -0
- package/dist/components/index-entry/index.d.ts +2 -0
- package/dist/components/index-entry/index.vue.d.ts +25 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/list.d.ts +2 -0
- package/dist/components/members-sidebar/index.d.ts +3 -0
- package/dist/components/members-sidebar/index.vue.d.ts +4 -0
- package/dist/components/notice-box/index.d.ts +3 -0
- package/dist/components/notice-box/index.vue.d.ts +13 -0
- package/dist/components/server-channel-sidebar/index.d.ts +3 -0
- package/dist/components/server-channel-sidebar/index.vue.d.ts +18 -0
- package/dist/global.css +39 -0
- package/dist/icon-font/index.d.ts +47 -0
- package/dist/icon-font/index.js +7 -0
- package/dist/index/style.css +199 -0
- package/dist/index/style2.css +175 -0
- package/dist/index/style3.css +36 -0
- package/dist/index/style4.css +168 -0
- package/dist/index/style5.css +147 -0
- package/dist/index/style6.css +43 -0
- package/dist/index/style7.css +491 -0
- package/dist/index/style8.css +19 -0
- package/dist/index-3sSWCzxu.mjs +225 -0
- package/dist/index-4m4OVlx8.mjs +611 -0
- package/dist/index-CFI0URc5.mjs +135 -0
- package/dist/index-Dg8Q3cli.mjs +1092 -0
- package/dist/index-entry/index.d.ts +2 -0
- package/dist/index-entry/index.js +271 -0
- package/dist/index-entry/index.vue.d.ts +25 -0
- package/dist/index-entry/style.css +51 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.vue_vue_type_script_setup_true_lang-DkMXpHkt.mjs +158 -0
- package/dist/index.vue_vue_type_style_index_0_lang-CfLKcYM9.mjs +102 -0
- package/dist/index.vue_vue_type_style_index_0_lang-CibeOmhP.mjs +407 -0
- package/dist/index.vue_vue_type_style_index_0_lang-CmfE8EVU.mjs +288 -0
- package/dist/index.vue_vue_type_style_index_0_lang-XiDTgYoZ.mjs +1012 -0
- package/dist/index.vue_vue_type_style_index_0_lang-Y-vyKHWz.mjs +36985 -0
- package/dist/members-sidebar/index.d.ts +3 -0
- package/dist/members-sidebar/index.js +5 -0
- package/dist/members-sidebar/index.vue.d.ts +4 -0
- package/dist/notice-box/index.d.ts +3 -0
- package/dist/notice-box/index.js +5 -0
- package/dist/notice-box/index.vue.d.ts +13 -0
- package/dist/plugin/index.d.ts +22 -0
- package/dist/resolver/index.d.ts +22 -0
- package/dist/resolver/index.es.js +36 -0
- package/dist/resolver/index.umd.js +40 -0
- package/dist/server-channel-sidebar/index.d.ts +3 -0
- package/dist/server-channel-sidebar/index.js +5 -0
- package/dist/server-channel-sidebar/index.vue.d.ts +18 -0
- package/dist/stores/channel.d.ts +114 -0
- package/dist/stores/global.d.ts +15 -0
- package/dist/stores/index.d.ts +7 -0
- package/dist/stores/qchat.d.ts +397 -0
- package/dist/stores/sdk.d.ts +48 -0
- package/dist/stores/server.d.ts +58 -0
- package/dist/stores/user.d.ts +9 -0
- package/dist/style.css +1359 -0
- package/dist/types/missing.d.ts +14 -0
- package/dist/utils/events.d.ts +7 -0
- package/dist/utils/index.d.ts +26 -0
- package/dist/utils/storage.d.ts +15 -0
- package/dist/yx-web-sdk.es.js +41593 -0
- package/dist/yx-web-sdk.umd.js +41590 -0
- package/package.json +191 -0
|
@@ -0,0 +1,1012 @@
|
|
|
1
|
+
import { ref, computed, watch, nextTick, defineComponent, openBlock, createElementBlock, createElementVNode, normalizeStyle, unref, normalizeClass, createBlock, createCommentVNode, createVNode, Fragment, renderList, toDisplayString, withCtx } from "vue";
|
|
2
|
+
import { useRouter } from "vue-router";
|
|
3
|
+
import { Input, Image, Popover, Button, Upload } from "ant-design-vue";
|
|
4
|
+
import { A as AitPersonPopover } from "./index-CFI0URc5.mjs";
|
|
5
|
+
import { L as LoadingOutlined, _ as _sfc_main$2 } from "./index.vue_vue_type_style_index_0_lang-CibeOmhP.mjs";
|
|
6
|
+
import { _ as _sfc_main$1 } from "./index.vue_vue_type_style_index_0_lang-CfLKcYM9.mjs";
|
|
7
|
+
import { b as useChannelStore, g as getImageMsgDisplaySize, f as filterStr } from "./index.vue_vue_type_style_index_0_lang-Y-vyKHWz.mjs";
|
|
8
|
+
import { useEventListener } from "@vueuse/core";
|
|
9
|
+
import { C as CloseOutlined } from "./CloseOutlined-DDb89ei3.mjs";
|
|
10
|
+
const MENTION_TAG_REG = /@[^@]+\s/g;
|
|
11
|
+
function getMentionSpans(text) {
|
|
12
|
+
const spans = [];
|
|
13
|
+
let m;
|
|
14
|
+
MENTION_TAG_REG.lastIndex = 0;
|
|
15
|
+
while ((m = MENTION_TAG_REG.exec(text)) !== null) {
|
|
16
|
+
spans.push({ start: m.index, end: m.index + m[0].length });
|
|
17
|
+
}
|
|
18
|
+
return spans;
|
|
19
|
+
}
|
|
20
|
+
function getMentionSpanAt(text, pos, key) {
|
|
21
|
+
const spans = getMentionSpans(text);
|
|
22
|
+
for (const span of spans) {
|
|
23
|
+
if (pos === span.end && key === "ArrowRight") continue;
|
|
24
|
+
if (pos >= span.start && pos <= span.end) return span;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
function parseMentionTagContent(content, members, myAccid, enableMentionEveryone = false) {
|
|
29
|
+
const trimmed = content.trim();
|
|
30
|
+
if (trimmed === "所有人" && enableMentionEveryone) return { type: "everyone" };
|
|
31
|
+
const match = trimmed.match(/^(.+?)\(([^)]+)\)$/);
|
|
32
|
+
if (match) {
|
|
33
|
+
const accid = match[2].trim();
|
|
34
|
+
if (members.some((m) => m.accid === accid)) return { type: "member", accids: [accid] };
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const list = members.filter((m) => m.accid !== myAccid);
|
|
38
|
+
const byNick = list.filter((m) => (m.nick || m.accid || "").trim() === trimmed);
|
|
39
|
+
if (byNick.length === 0) return null;
|
|
40
|
+
return { type: "member", accids: byNick.map((m) => m.accid).filter(Boolean) };
|
|
41
|
+
}
|
|
42
|
+
function parseMentionStateFromText(text, members, myAccid, enableMentionEveryone = true) {
|
|
43
|
+
const spans = getMentionSpans(text);
|
|
44
|
+
let hasEveryone = false;
|
|
45
|
+
const accidSet = /* @__PURE__ */ new Set();
|
|
46
|
+
const others = members.filter((m) => m.accid !== myAccid);
|
|
47
|
+
const allAccids = others.map((m) => m.accid).filter(Boolean);
|
|
48
|
+
for (const span of spans) {
|
|
49
|
+
const content = text.slice(span.start + 1, span.end - 1);
|
|
50
|
+
const parsed = parseMentionTagContent(content, members, myAccid, enableMentionEveryone);
|
|
51
|
+
if (!parsed) continue;
|
|
52
|
+
if (parsed.type === "everyone") {
|
|
53
|
+
hasEveryone = true;
|
|
54
|
+
allAccids.forEach((id) => accidSet.add(id));
|
|
55
|
+
} else {
|
|
56
|
+
parsed.accids.forEach((id) => accidSet.add(id));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
hasEveryone,
|
|
61
|
+
accids: [...accidSet]
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function useAitPerson(options) {
|
|
65
|
+
const { scrollRef, curText, cursorIndex, serverMembers, myAccid = "" } = options;
|
|
66
|
+
const enableMentionEveryone = false;
|
|
67
|
+
const showAitPersonPopover = ref(false);
|
|
68
|
+
const cursorRectRef = ref(null);
|
|
69
|
+
const aitPersonSelectedIndex = ref(-1);
|
|
70
|
+
const aitAtStartIndex = ref(0);
|
|
71
|
+
const textareaRef = ref(null);
|
|
72
|
+
const aitItemRefs = { current: {} };
|
|
73
|
+
const mentionAccids = computed(() => {
|
|
74
|
+
const { accids } = parseMentionStateFromText(
|
|
75
|
+
curText.value,
|
|
76
|
+
serverMembers.value,
|
|
77
|
+
myAccid,
|
|
78
|
+
enableMentionEveryone
|
|
79
|
+
);
|
|
80
|
+
return accids;
|
|
81
|
+
});
|
|
82
|
+
const scrollbarWidth = ref(0);
|
|
83
|
+
const aitAtPrefix = ref("");
|
|
84
|
+
const aitPopoverItems = computed(
|
|
85
|
+
() => serverMembers.value.filter((m) => m.accid !== myAccid)
|
|
86
|
+
);
|
|
87
|
+
const aitFilteredItems = computed(() => {
|
|
88
|
+
const prefix = aitAtPrefix.value.trim().toLowerCase();
|
|
89
|
+
if (!prefix) return aitPopoverItems.value;
|
|
90
|
+
return aitPopoverItems.value.filter((m) => {
|
|
91
|
+
const name = (m.nick || m.accid || "").toLowerCase();
|
|
92
|
+
return name.startsWith(prefix);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
const showEveryoneOption = computed(() => enableMentionEveryone);
|
|
96
|
+
const aitDisplayItems = computed(
|
|
97
|
+
() => showEveryoneOption.value ? aitPopoverItems.value : aitFilteredItems.value
|
|
98
|
+
);
|
|
99
|
+
const aitPopoverTotal = computed(
|
|
100
|
+
() => showEveryoneOption.value ? 1 + aitPopoverItems.value.length : aitFilteredItems.value.length
|
|
101
|
+
);
|
|
102
|
+
const resizeTarget = computed(() => showAitPersonPopover.value ? window : null);
|
|
103
|
+
useEventListener(resizeTarget, "resize", () => {
|
|
104
|
+
showAitPersonPopover.value = false;
|
|
105
|
+
});
|
|
106
|
+
watch(showAitPersonPopover, (visible) => {
|
|
107
|
+
if (!visible) cursorRectRef.value = null;
|
|
108
|
+
});
|
|
109
|
+
function getCursorCoordinates(textarea) {
|
|
110
|
+
const cursorPosition = textarea.selectionStart;
|
|
111
|
+
const rect = textarea.getBoundingClientRect();
|
|
112
|
+
const style = getComputedStyle(textarea);
|
|
113
|
+
const mirror = document.createElement("div");
|
|
114
|
+
mirror.style.cssText = [
|
|
115
|
+
"position: absolute",
|
|
116
|
+
"visibility: hidden",
|
|
117
|
+
"white-space: pre-wrap",
|
|
118
|
+
"word-wrap: break-word",
|
|
119
|
+
"overflow: hidden",
|
|
120
|
+
`width: ${textarea.offsetWidth}px`,
|
|
121
|
+
`min-height: ${textarea.offsetHeight}px`,
|
|
122
|
+
`font: ${style.font}`,
|
|
123
|
+
`font-size: ${style.fontSize}`,
|
|
124
|
+
`font-family: ${style.fontFamily}`,
|
|
125
|
+
`line-height: ${style.lineHeight}`,
|
|
126
|
+
`padding: ${style.padding}`,
|
|
127
|
+
`border: ${style.border}`,
|
|
128
|
+
`box-sizing: ${style.boxSizing}`,
|
|
129
|
+
`letter-spacing: ${style.letterSpacing}`
|
|
130
|
+
].join("; ");
|
|
131
|
+
mirror.style.left = `${rect.left}px`;
|
|
132
|
+
mirror.style.top = `${rect.top}px`;
|
|
133
|
+
document.body.appendChild(mirror);
|
|
134
|
+
const textBeforeCursor = textarea.value.substring(0, cursorPosition);
|
|
135
|
+
mirror.appendChild(document.createTextNode(textBeforeCursor));
|
|
136
|
+
const cursorSpan = document.createElement("span");
|
|
137
|
+
cursorSpan.textContent = "";
|
|
138
|
+
mirror.appendChild(cursorSpan);
|
|
139
|
+
mirror.scrollTop = textarea.scrollTop;
|
|
140
|
+
mirror.scrollLeft = textarea.scrollLeft;
|
|
141
|
+
const spanRect = cursorSpan.getBoundingClientRect();
|
|
142
|
+
document.body.removeChild(mirror);
|
|
143
|
+
return {
|
|
144
|
+
left: spanRect.left,
|
|
145
|
+
top: spanRect.top
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function aitPersonHandler(e) {
|
|
149
|
+
if (aitPopoverItems.value.length === 0) {
|
|
150
|
+
showAitPersonPopover.value = false;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const target = e.target;
|
|
154
|
+
const value = target.value;
|
|
155
|
+
const lastAtIndex = value.lastIndexOf("@");
|
|
156
|
+
if (lastAtIndex === -1) {
|
|
157
|
+
showAitPersonPopover.value = false;
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const prefix = value.slice(lastAtIndex + 1);
|
|
161
|
+
if (prefix.trim() === "") {
|
|
162
|
+
aitAtPrefix.value = "";
|
|
163
|
+
const coords = getCursorCoordinates(target);
|
|
164
|
+
if (coords) {
|
|
165
|
+
textareaRef.value = target;
|
|
166
|
+
aitAtStartIndex.value = lastAtIndex;
|
|
167
|
+
aitPersonSelectedIndex.value = 0;
|
|
168
|
+
cursorRectRef.value = coords;
|
|
169
|
+
showAitPersonPopover.value = true;
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
const prefixLower = prefix.trim().toLowerCase();
|
|
173
|
+
const filtered = aitPopoverItems.value.filter((m) => {
|
|
174
|
+
const name = (m.nick || m.accid || "").toLowerCase();
|
|
175
|
+
return name.startsWith(prefixLower);
|
|
176
|
+
});
|
|
177
|
+
if (filtered.length === 0) {
|
|
178
|
+
showAitPersonPopover.value = false;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
aitAtPrefix.value = prefix;
|
|
182
|
+
const coords = getCursorCoordinates(target);
|
|
183
|
+
if (coords) {
|
|
184
|
+
textareaRef.value = target;
|
|
185
|
+
aitAtStartIndex.value = lastAtIndex;
|
|
186
|
+
aitPersonSelectedIndex.value = 0;
|
|
187
|
+
cursorRectRef.value = coords;
|
|
188
|
+
showAitPersonPopover.value = true;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function setAitItemRef(el, index) {
|
|
193
|
+
aitItemRefs.current[index] = el || null;
|
|
194
|
+
}
|
|
195
|
+
function handleMentionCursorOrBackspace(e, target) {
|
|
196
|
+
const text = target.value;
|
|
197
|
+
const pos = target.selectionStart ?? 0;
|
|
198
|
+
const span = getMentionSpanAt(text, pos, e.key);
|
|
199
|
+
if (e.key === "ArrowRight") {
|
|
200
|
+
let jumpEnd = null;
|
|
201
|
+
if (span) {
|
|
202
|
+
if (pos === span.end) return false;
|
|
203
|
+
jumpEnd = span.end;
|
|
204
|
+
} else {
|
|
205
|
+
const spans = getMentionSpans(text);
|
|
206
|
+
const nextSpan = spans.find((s) => s.start === pos + 1);
|
|
207
|
+
if (nextSpan) jumpEnd = nextSpan.end;
|
|
208
|
+
}
|
|
209
|
+
if (jumpEnd !== null) {
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
target.selectionStart = jumpEnd;
|
|
212
|
+
target.selectionEnd = jumpEnd;
|
|
213
|
+
cursorIndex.value = jumpEnd;
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
if (!span) return false;
|
|
219
|
+
if (e.key === "ArrowLeft") {
|
|
220
|
+
if (pos === span.start) return false;
|
|
221
|
+
e.preventDefault();
|
|
222
|
+
target.selectionStart = span.start;
|
|
223
|
+
target.selectionEnd = span.start;
|
|
224
|
+
cursorIndex.value = span.start;
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
if (e.key === "Backspace") {
|
|
228
|
+
if (pos <= span.start) return false;
|
|
229
|
+
e.preventDefault();
|
|
230
|
+
const before = text.slice(0, span.start);
|
|
231
|
+
const after = text.slice(span.end);
|
|
232
|
+
const newText = before + after;
|
|
233
|
+
curText.value = newText;
|
|
234
|
+
target.value = newText;
|
|
235
|
+
target.selectionStart = span.start;
|
|
236
|
+
target.selectionEnd = span.start;
|
|
237
|
+
cursorIndex.value = span.start;
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
function handleMentionClick(e) {
|
|
243
|
+
const target = e.target;
|
|
244
|
+
if (!target || target.nodeName !== "TEXTAREA") return;
|
|
245
|
+
const text = target.value;
|
|
246
|
+
const pos = target.selectionStart ?? 0;
|
|
247
|
+
const span = getMentionSpanAt(text, pos);
|
|
248
|
+
if (!span) return;
|
|
249
|
+
if (pos >= span.end) return;
|
|
250
|
+
if (target.selectionStart === span.start && target.selectionEnd === span.end) return;
|
|
251
|
+
target.selectionStart = span.start;
|
|
252
|
+
target.selectionEnd = span.end;
|
|
253
|
+
cursorIndex.value = span.start;
|
|
254
|
+
}
|
|
255
|
+
function handleInputKeydown(e) {
|
|
256
|
+
const target = e.target;
|
|
257
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
258
|
+
showAitPersonPopover.value = false;
|
|
259
|
+
}
|
|
260
|
+
if (e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Backspace") {
|
|
261
|
+
if (handleMentionCursorOrBackspace(e, target)) return;
|
|
262
|
+
}
|
|
263
|
+
if (!showAitPersonPopover.value) return;
|
|
264
|
+
if (e.key !== "ArrowUp" && e.key !== "ArrowDown" && e.key !== "Enter" && e.key !== "Escape") return;
|
|
265
|
+
e.preventDefault();
|
|
266
|
+
handleAitKeydown(e);
|
|
267
|
+
}
|
|
268
|
+
function handleAitKeydown(e) {
|
|
269
|
+
const total = aitPopoverTotal.value;
|
|
270
|
+
if (total === 0) return;
|
|
271
|
+
const showEveryone = showEveryoneOption.value;
|
|
272
|
+
const listLen = showEveryone ? aitPopoverItems.value.length : aitFilteredItems.value.length;
|
|
273
|
+
if (e.key === "ArrowDown") {
|
|
274
|
+
const cur = aitPersonSelectedIndex.value;
|
|
275
|
+
if (showEveryone) {
|
|
276
|
+
aitPersonSelectedIndex.value = cur === -1 ? 0 : cur === listLen - 1 ? -1 : cur + 1;
|
|
277
|
+
} else {
|
|
278
|
+
aitPersonSelectedIndex.value = cur === listLen - 1 ? 0 : cur + 1;
|
|
279
|
+
}
|
|
280
|
+
nextTick(() => {
|
|
281
|
+
var _a;
|
|
282
|
+
return (_a = aitItemRefs.current[aitPersonSelectedIndex.value]) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
283
|
+
});
|
|
284
|
+
} else if (e.key === "ArrowUp") {
|
|
285
|
+
const cur = aitPersonSelectedIndex.value;
|
|
286
|
+
if (showEveryone) {
|
|
287
|
+
aitPersonSelectedIndex.value = cur === 0 ? -1 : cur === -1 ? listLen - 1 : cur - 1;
|
|
288
|
+
} else {
|
|
289
|
+
aitPersonSelectedIndex.value = cur === 0 ? listLen - 1 : cur - 1;
|
|
290
|
+
}
|
|
291
|
+
nextTick(() => {
|
|
292
|
+
var _a;
|
|
293
|
+
return (_a = aitItemRefs.current[aitPersonSelectedIndex.value]) == null ? void 0 : _a.scrollIntoView({ block: "nearest" });
|
|
294
|
+
});
|
|
295
|
+
} else if (e.key === "Enter") {
|
|
296
|
+
confirmAitSelection();
|
|
297
|
+
} else if (e.key === "Escape") {
|
|
298
|
+
closeAitPopover();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
function confirmAitSelection(clickIndex) {
|
|
302
|
+
const index = clickIndex ?? aitPersonSelectedIndex.value;
|
|
303
|
+
const showEveryone = showEveryoneOption.value;
|
|
304
|
+
const items = showEveryone ? aitPopoverItems.value : aitFilteredItems.value;
|
|
305
|
+
const maxIndex = items.length - 1;
|
|
306
|
+
if (index < (showEveryone ? -1 : 0) || index > maxIndex) return;
|
|
307
|
+
let insertText;
|
|
308
|
+
if (showEveryone && index === -1) {
|
|
309
|
+
insertText = "@所有人 ";
|
|
310
|
+
} else {
|
|
311
|
+
const member = items[index];
|
|
312
|
+
const nick = member.nick || member.accid || "";
|
|
313
|
+
const accid = member.accid;
|
|
314
|
+
const hasDuplicateNick = accid && aitPopoverItems.value.filter((m) => (m.nick || m.accid) === nick).length > 1;
|
|
315
|
+
const needDisambiguator = (hasDuplicateNick || nick === "所有人") && accid;
|
|
316
|
+
insertText = needDisambiguator ? `@${nick}(${accid}) ` : `@${nick} `;
|
|
317
|
+
}
|
|
318
|
+
const endIndex = textareaRef.value ? textareaRef.value.selectionStart : aitAtStartIndex.value + 1;
|
|
319
|
+
const before = curText.value.slice(0, aitAtStartIndex.value);
|
|
320
|
+
const after = curText.value.slice(endIndex);
|
|
321
|
+
curText.value = before + insertText + after;
|
|
322
|
+
cursorIndex.value = aitAtStartIndex.value + insertText.length;
|
|
323
|
+
showAitPersonPopover.value = false;
|
|
324
|
+
nextTick(() => {
|
|
325
|
+
var _a;
|
|
326
|
+
(_a = textareaRef.value) == null ? void 0 : _a.focus();
|
|
327
|
+
if (textareaRef.value) textareaRef.value.selectionStart = cursorIndex.value;
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
function closeAitPopover() {
|
|
331
|
+
showAitPersonPopover.value = false;
|
|
332
|
+
}
|
|
333
|
+
function getAccurateScrollbarWidth() {
|
|
334
|
+
var _a, _b;
|
|
335
|
+
if (!scrollRef.value) return;
|
|
336
|
+
if (scrollRef.value.scrollHeight > scrollRef.value.clientHeight) {
|
|
337
|
+
try {
|
|
338
|
+
const testDiv = document.createElement("div");
|
|
339
|
+
testDiv.style.cssText = `
|
|
340
|
+
position: absolute;
|
|
341
|
+
top: -999px;
|
|
342
|
+
left: -999px;
|
|
343
|
+
width: 100px;
|
|
344
|
+
height: 100px;
|
|
345
|
+
overflow-y: scroll;
|
|
346
|
+
visibility: hidden;
|
|
347
|
+
padding: 0;
|
|
348
|
+
margin: 0;
|
|
349
|
+
border: 0;
|
|
350
|
+
`;
|
|
351
|
+
(_a = scrollRef.value.parentElement) == null ? void 0 : _a.appendChild(testDiv);
|
|
352
|
+
const placeholderWidth = testDiv.offsetWidth - testDiv.clientWidth;
|
|
353
|
+
scrollbarWidth.value = placeholderWidth;
|
|
354
|
+
(_b = scrollRef.value.parentElement) == null ? void 0 : _b.removeChild(testDiv);
|
|
355
|
+
} catch (error) {
|
|
356
|
+
console.error(error);
|
|
357
|
+
}
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
scrollbarWidth.value = 0;
|
|
361
|
+
}
|
|
362
|
+
const aitPopoverItemsLength = computed(() => aitPopoverItems.value.length);
|
|
363
|
+
return {
|
|
364
|
+
showAitPersonPopover,
|
|
365
|
+
scrollbarWidth,
|
|
366
|
+
cursorRectRef,
|
|
367
|
+
aitPersonSelectedIndex,
|
|
368
|
+
aitPopoverItems,
|
|
369
|
+
/** 弹框内展示的成员列表(无前缀全量,有前缀为过滤结果) */
|
|
370
|
+
aitDisplayItems,
|
|
371
|
+
aitPopoverItemsLength,
|
|
372
|
+
mentionAccids,
|
|
373
|
+
setAitItemRef,
|
|
374
|
+
handleInputKeydown,
|
|
375
|
+
/** 点击时若落在 @用户 标签内则整段选中 */
|
|
376
|
+
handleMentionClick,
|
|
377
|
+
confirmAitSelection,
|
|
378
|
+
aitPersonHandler,
|
|
379
|
+
closeAitPopover,
|
|
380
|
+
getAccurateScrollbarWidth
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
const _hoisted_1 = { class: "yx-chatroomWrapper" };
|
|
384
|
+
const _hoisted_2 = {
|
|
385
|
+
key: 1,
|
|
386
|
+
class: "chatroomContentNoMore"
|
|
387
|
+
};
|
|
388
|
+
const _hoisted_3 = { key: 0 };
|
|
389
|
+
const _hoisted_4 = { key: 1 };
|
|
390
|
+
const _hoisted_5 = { key: 2 };
|
|
391
|
+
const _hoisted_6 = { class: "chatroomControllerContainer" };
|
|
392
|
+
const _hoisted_7 = { class: "chatroomControllerWrapper" };
|
|
393
|
+
const _hoisted_8 = {
|
|
394
|
+
key: 0,
|
|
395
|
+
class: "chatroomInputQuoteWrapper"
|
|
396
|
+
};
|
|
397
|
+
const _hoisted_9 = { class: "chatroomInputQuoteText" };
|
|
398
|
+
const _hoisted_10 = { class: "chatroomInputQuoteTextName" };
|
|
399
|
+
const _hoisted_11 = ["innerHTML"];
|
|
400
|
+
const _hoisted_12 = {
|
|
401
|
+
key: 0,
|
|
402
|
+
class: "chatroomInputQuoteWrapperImg"
|
|
403
|
+
};
|
|
404
|
+
const _hoisted_13 = { class: "chatroomInputWrapper" };
|
|
405
|
+
const _hoisted_14 = { class: "chatroomInputLeft" };
|
|
406
|
+
const _hoisted_15 = { style: { "width": "400px" } };
|
|
407
|
+
const _hoisted_16 = ["onClick"];
|
|
408
|
+
const _hoisted_17 = { class: "chatroomController" };
|
|
409
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
410
|
+
...{
|
|
411
|
+
name: "ChatContent"
|
|
412
|
+
},
|
|
413
|
+
__name: "index",
|
|
414
|
+
props: {
|
|
415
|
+
msgs: { default: () => [] },
|
|
416
|
+
channelName: { default: "频道名称" },
|
|
417
|
+
topic: { default: "频道主题" },
|
|
418
|
+
imgUploading: { type: Boolean, default: false },
|
|
419
|
+
fileUploading: { type: Boolean, default: false },
|
|
420
|
+
sendDisabled: { type: Boolean, default: false },
|
|
421
|
+
isNoMore: { type: Boolean, default: false },
|
|
422
|
+
myAccid: { default: "" },
|
|
423
|
+
myAvatar: { default: "" },
|
|
424
|
+
onLoadMore: { type: Function, default: () => Promise.resolve() }
|
|
425
|
+
},
|
|
426
|
+
emits: ["sendText", "sendImg", "sendFile", "resendText", "resendImg", "resendFile"],
|
|
427
|
+
setup(__props, { emit: __emit }) {
|
|
428
|
+
const router = useRouter();
|
|
429
|
+
const channelStore = useChannelStore();
|
|
430
|
+
const Textarea = Input.TextArea;
|
|
431
|
+
const props = __props;
|
|
432
|
+
const emit = __emit;
|
|
433
|
+
const quoteMsg = ref();
|
|
434
|
+
const curText = ref("");
|
|
435
|
+
const cursorIndex = ref(0);
|
|
436
|
+
const contentRef = ref();
|
|
437
|
+
const contentScrollLocked = ref(false);
|
|
438
|
+
const loadingMore = ref(false);
|
|
439
|
+
const serverMembers = computed(() => {
|
|
440
|
+
var _a;
|
|
441
|
+
return ((_a = channelStore.ChannelMembers) == null ? void 0 : _a.datas) || [];
|
|
442
|
+
});
|
|
443
|
+
const curChannel = computed(() => channelStore.currentChannel);
|
|
444
|
+
const {
|
|
445
|
+
showAitPersonPopover,
|
|
446
|
+
cursorRectRef,
|
|
447
|
+
aitPersonSelectedIndex,
|
|
448
|
+
aitDisplayItems,
|
|
449
|
+
aitPopoverItemsLength,
|
|
450
|
+
mentionAccids,
|
|
451
|
+
scrollbarWidth,
|
|
452
|
+
setAitItemRef,
|
|
453
|
+
handleInputKeydown,
|
|
454
|
+
handleMentionClick,
|
|
455
|
+
confirmAitSelection,
|
|
456
|
+
aitPersonHandler,
|
|
457
|
+
closeAitPopover,
|
|
458
|
+
getAccurateScrollbarWidth
|
|
459
|
+
} = useAitPerson({ scrollRef: contentRef, curText, cursorIndex, serverMembers, myAccid: props.myAccid });
|
|
460
|
+
const handleResendText = (msg) => {
|
|
461
|
+
emit("resendText", msg);
|
|
462
|
+
};
|
|
463
|
+
const handleResendImg = (msg) => {
|
|
464
|
+
emit("resendImg", msg);
|
|
465
|
+
};
|
|
466
|
+
const handleResendFile = (msg) => {
|
|
467
|
+
emit("resendFile", msg);
|
|
468
|
+
};
|
|
469
|
+
const onContextMenuSwitch = (bol) => {
|
|
470
|
+
contentScrollLocked.value = bol;
|
|
471
|
+
if (bol) {
|
|
472
|
+
getAccurateScrollbarWidth();
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
const handleQuote = (msg) => {
|
|
476
|
+
quoteMsg.value = msg;
|
|
477
|
+
};
|
|
478
|
+
const handleQuoteMsgClick = (msg) => {
|
|
479
|
+
const id = msg == null ? void 0 : msg.msgIdClient;
|
|
480
|
+
if (!id || !contentRef.value) return;
|
|
481
|
+
nextTick(() => {
|
|
482
|
+
var _a;
|
|
483
|
+
const el = (_a = contentRef.value) == null ? void 0 : _a.querySelector(`[data-msg-id-client="${id}"]`);
|
|
484
|
+
if (el) {
|
|
485
|
+
el.scrollIntoView({ behavior: "instant", block: "start" });
|
|
486
|
+
el.classList.add("yx-flash-a-moment");
|
|
487
|
+
el.addEventListener(
|
|
488
|
+
"animationend",
|
|
489
|
+
() => {
|
|
490
|
+
el.classList.remove("yx-flash-a-moment");
|
|
491
|
+
},
|
|
492
|
+
{ once: true }
|
|
493
|
+
);
|
|
494
|
+
} else {
|
|
495
|
+
console.log("position failed", id);
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
};
|
|
499
|
+
const handleDeleteQuoteMsg = () => {
|
|
500
|
+
quoteMsg.value = void 0;
|
|
501
|
+
};
|
|
502
|
+
watch(
|
|
503
|
+
() => props.msgs,
|
|
504
|
+
(value, oldValue) => {
|
|
505
|
+
nextTick(() => {
|
|
506
|
+
var _a, _b, _c;
|
|
507
|
+
console.log((_a = contentRef.value) == null ? void 0 : _a.scrollTop, (_b = contentRef.value) == null ? void 0 : _b.scrollHeight);
|
|
508
|
+
if (oldValue.length === 0 && value.length > 0 && contentRef.value) {
|
|
509
|
+
contentRef.value.scrollTop = ((_c = contentRef.value) == null ? void 0 : _c.scrollHeight) || 0;
|
|
510
|
+
}
|
|
511
|
+
if (contentRef.value && contentRef.value.scrollTop > contentRef.value.scrollHeight / 2) {
|
|
512
|
+
contentRef.value.scrollTop = contentRef.value.scrollHeight;
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
);
|
|
517
|
+
const stopWatch = watch(
|
|
518
|
+
() => props.msgs,
|
|
519
|
+
(value) => {
|
|
520
|
+
if (value && value.length) {
|
|
521
|
+
nextTick(() => {
|
|
522
|
+
var _a;
|
|
523
|
+
const query = router.currentRoute.value.query;
|
|
524
|
+
if (((_a = curChannel.value) == null ? void 0 : _a.channelId) === query.channel_id && query.msgIdClient) {
|
|
525
|
+
handleQuoteMsgClick({ msgIdClient: query.msgIdClient });
|
|
526
|
+
router.replace({ query: { ...query, msgIdClient: void 0 } });
|
|
527
|
+
}
|
|
528
|
+
stopWatch();
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
);
|
|
533
|
+
watch(
|
|
534
|
+
() => channelStore.currentChannel,
|
|
535
|
+
() => {
|
|
536
|
+
curText.value = "";
|
|
537
|
+
quoteMsg.value = void 0;
|
|
538
|
+
}
|
|
539
|
+
);
|
|
540
|
+
const inputPlaceholder = computed(
|
|
541
|
+
() => props.sendDisabled ? "您暂无发送消息权限" : `在 #${props.channelName} 中发送消息`
|
|
542
|
+
);
|
|
543
|
+
const handleInputBlur = (e) => {
|
|
544
|
+
const target = e.target;
|
|
545
|
+
cursorIndex.value = target.selectionStart || 0;
|
|
546
|
+
closeAitPopover();
|
|
547
|
+
};
|
|
548
|
+
const insertEmj = (index) => {
|
|
549
|
+
const insertVal = emjjData[index];
|
|
550
|
+
const curTextVal = curText.value.slice(0, cursorIndex.value) + insertVal + curText.value.slice(cursorIndex.value);
|
|
551
|
+
curText.value = curTextVal;
|
|
552
|
+
cursorIndex.value = cursorIndex.value + insertVal.length;
|
|
553
|
+
};
|
|
554
|
+
const inputChangeHandler = (e) => {
|
|
555
|
+
const target = e.target;
|
|
556
|
+
curText.value = target.value;
|
|
557
|
+
aitPersonHandler(e);
|
|
558
|
+
};
|
|
559
|
+
const pressEnterHandler = (e) => {
|
|
560
|
+
if (showAitPersonPopover.value) {
|
|
561
|
+
e.preventDefault();
|
|
562
|
+
confirmAitSelection();
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
if (!e.shiftKey) {
|
|
566
|
+
e.preventDefault();
|
|
567
|
+
const text = filterStr(curText.value.trim());
|
|
568
|
+
if (text) {
|
|
569
|
+
if (quoteMsg.value) {
|
|
570
|
+
sendReplyMessage();
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
emit("sendText", text, {
|
|
574
|
+
ext: {
|
|
575
|
+
quoteMsg: quoteMsg.value
|
|
576
|
+
},
|
|
577
|
+
mentionAccids: mentionAccids.value
|
|
578
|
+
});
|
|
579
|
+
curText.value = "";
|
|
580
|
+
quoteMsg.value = void 0;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
const handleSendText = () => {
|
|
585
|
+
const text = filterStr(curText.value.trim());
|
|
586
|
+
if (text) {
|
|
587
|
+
if (quoteMsg.value) {
|
|
588
|
+
sendReplyMessage();
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
emit("sendText", text, {
|
|
592
|
+
ext: {
|
|
593
|
+
mentionAccids: mentionAccids.value,
|
|
594
|
+
quoteMsg: quoteMsg.value
|
|
595
|
+
},
|
|
596
|
+
mentionAccids: mentionAccids.value
|
|
597
|
+
});
|
|
598
|
+
curText.value = "";
|
|
599
|
+
quoteMsg.value = void 0;
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
const sendReplyMessage = () => {
|
|
603
|
+
const text = filterStr(curText.value.trim());
|
|
604
|
+
channelStore.sendReplyMessage({
|
|
605
|
+
type: "text",
|
|
606
|
+
body: text,
|
|
607
|
+
mentionAccids: mentionAccids.value,
|
|
608
|
+
ext: {
|
|
609
|
+
quoteMsg: quoteMsg.value
|
|
610
|
+
// 备份引用消息
|
|
611
|
+
},
|
|
612
|
+
replyMessage: {
|
|
613
|
+
...quoteMsg.value
|
|
614
|
+
// 多余字段sdk会自动忽略
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
curText.value = "";
|
|
618
|
+
quoteMsg.value = void 0;
|
|
619
|
+
};
|
|
620
|
+
const scrollHandler = async (e) => {
|
|
621
|
+
var _a;
|
|
622
|
+
const target = e.target;
|
|
623
|
+
if (target.scrollTop === 0 && target.scrollHeight - target.clientHeight > 0 && !loadingMore.value && !props.isNoMore && props.msgs.length) {
|
|
624
|
+
const beforeScrollHeight = ((_a = contentRef.value) == null ? void 0 : _a.scrollHeight) || 0;
|
|
625
|
+
loadingMore.value = true;
|
|
626
|
+
await props.onLoadMore(props.msgs[0].time);
|
|
627
|
+
loadingMore.value = false;
|
|
628
|
+
channelStore.resetChannelUnReadCount();
|
|
629
|
+
nextTick(() => {
|
|
630
|
+
if (contentRef.value) {
|
|
631
|
+
const top = contentRef.value.scrollTop;
|
|
632
|
+
const increaseInScrollHeight = contentRef.value.scrollHeight - beforeScrollHeight;
|
|
633
|
+
contentRef.value.scrollTop = top + increaseInScrollHeight;
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
const uploadImgHandler = (file) => {
|
|
639
|
+
emit("sendImg", file);
|
|
640
|
+
};
|
|
641
|
+
const emjjData = [
|
|
642
|
+
"😀",
|
|
643
|
+
"😃",
|
|
644
|
+
"😄",
|
|
645
|
+
"😁",
|
|
646
|
+
"😆",
|
|
647
|
+
"😅",
|
|
648
|
+
"🤣",
|
|
649
|
+
"😂",
|
|
650
|
+
"🙂",
|
|
651
|
+
"🙃",
|
|
652
|
+
"😉",
|
|
653
|
+
"😊",
|
|
654
|
+
"😇",
|
|
655
|
+
"🥰",
|
|
656
|
+
"😍",
|
|
657
|
+
"🤩",
|
|
658
|
+
"😘",
|
|
659
|
+
"😗",
|
|
660
|
+
"☺️",
|
|
661
|
+
"☺",
|
|
662
|
+
"😚",
|
|
663
|
+
"😙",
|
|
664
|
+
"😋",
|
|
665
|
+
"😛",
|
|
666
|
+
"😜",
|
|
667
|
+
"🤪",
|
|
668
|
+
"😝",
|
|
669
|
+
"🤑",
|
|
670
|
+
"🤗",
|
|
671
|
+
"🤭",
|
|
672
|
+
"🤫",
|
|
673
|
+
"🤔",
|
|
674
|
+
"🤐",
|
|
675
|
+
"🤨",
|
|
676
|
+
"😐",
|
|
677
|
+
"😑",
|
|
678
|
+
"😶",
|
|
679
|
+
"😏",
|
|
680
|
+
"😒",
|
|
681
|
+
"🙄",
|
|
682
|
+
"😬",
|
|
683
|
+
"🤥",
|
|
684
|
+
"😌",
|
|
685
|
+
"😔",
|
|
686
|
+
"😪",
|
|
687
|
+
"🤤",
|
|
688
|
+
"😴",
|
|
689
|
+
"😷",
|
|
690
|
+
"🤒",
|
|
691
|
+
"🤕",
|
|
692
|
+
"🤢",
|
|
693
|
+
"🤮",
|
|
694
|
+
"🤧",
|
|
695
|
+
"🥵",
|
|
696
|
+
"🥶",
|
|
697
|
+
"🥴",
|
|
698
|
+
"😵",
|
|
699
|
+
"🤯",
|
|
700
|
+
"🤠",
|
|
701
|
+
"🥳",
|
|
702
|
+
"😎",
|
|
703
|
+
"🤓",
|
|
704
|
+
"🧐",
|
|
705
|
+
"😕",
|
|
706
|
+
"😟",
|
|
707
|
+
"🙁",
|
|
708
|
+
"☹️",
|
|
709
|
+
"😮",
|
|
710
|
+
"😯",
|
|
711
|
+
"😲",
|
|
712
|
+
"😳",
|
|
713
|
+
"🥺",
|
|
714
|
+
"😦",
|
|
715
|
+
"😧",
|
|
716
|
+
"😨",
|
|
717
|
+
"😰",
|
|
718
|
+
"😥",
|
|
719
|
+
"😢",
|
|
720
|
+
"😭",
|
|
721
|
+
"😱",
|
|
722
|
+
"😖",
|
|
723
|
+
"😣",
|
|
724
|
+
"😞",
|
|
725
|
+
"😓",
|
|
726
|
+
"😩",
|
|
727
|
+
"😫",
|
|
728
|
+
"😤",
|
|
729
|
+
"😡",
|
|
730
|
+
"😠",
|
|
731
|
+
"🤬",
|
|
732
|
+
"😈",
|
|
733
|
+
"👿",
|
|
734
|
+
"💀",
|
|
735
|
+
"☠️",
|
|
736
|
+
"☠",
|
|
737
|
+
"💩",
|
|
738
|
+
"🤡",
|
|
739
|
+
"👹",
|
|
740
|
+
"👺",
|
|
741
|
+
"👻",
|
|
742
|
+
"👽",
|
|
743
|
+
"👾",
|
|
744
|
+
"🤖",
|
|
745
|
+
"😺",
|
|
746
|
+
"😸",
|
|
747
|
+
"😹",
|
|
748
|
+
"😻",
|
|
749
|
+
"😼",
|
|
750
|
+
"😽",
|
|
751
|
+
"🙀",
|
|
752
|
+
"😿",
|
|
753
|
+
"😾",
|
|
754
|
+
"🙈",
|
|
755
|
+
"🙉",
|
|
756
|
+
"🙊",
|
|
757
|
+
"💋",
|
|
758
|
+
"💌",
|
|
759
|
+
"💘",
|
|
760
|
+
"💝",
|
|
761
|
+
"💖",
|
|
762
|
+
"💗",
|
|
763
|
+
"💓",
|
|
764
|
+
"💞",
|
|
765
|
+
"💕",
|
|
766
|
+
"💟",
|
|
767
|
+
"❣️",
|
|
768
|
+
"❣",
|
|
769
|
+
"💔",
|
|
770
|
+
"❤️",
|
|
771
|
+
"❤",
|
|
772
|
+
"🧡",
|
|
773
|
+
"💛",
|
|
774
|
+
"💚",
|
|
775
|
+
"💙",
|
|
776
|
+
"💜",
|
|
777
|
+
"🖤",
|
|
778
|
+
"💯",
|
|
779
|
+
"💢",
|
|
780
|
+
"💥",
|
|
781
|
+
"💫",
|
|
782
|
+
"💦",
|
|
783
|
+
"💨",
|
|
784
|
+
"🕳️",
|
|
785
|
+
"🕳",
|
|
786
|
+
"💣",
|
|
787
|
+
"💬",
|
|
788
|
+
"👁️🗨️",
|
|
789
|
+
"👁🗨️",
|
|
790
|
+
"👁️🗨",
|
|
791
|
+
"👁🗨",
|
|
792
|
+
"🗨️",
|
|
793
|
+
"🗨",
|
|
794
|
+
"🗯️",
|
|
795
|
+
"🗯",
|
|
796
|
+
"💭",
|
|
797
|
+
"💤",
|
|
798
|
+
"👋"
|
|
799
|
+
];
|
|
800
|
+
return (_ctx, _cache) => {
|
|
801
|
+
var _a, _b, _c, _d, _e, _f;
|
|
802
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
803
|
+
createElementVNode("div", {
|
|
804
|
+
ref_key: "contentRef",
|
|
805
|
+
ref: contentRef,
|
|
806
|
+
class: normalizeClass(["chatroomContent", { "is-scroll-locked": contentScrollLocked.value }]),
|
|
807
|
+
style: normalizeStyle({ "margin-right": contentScrollLocked.value && unref(scrollbarWidth) > 0 ? unref(scrollbarWidth) + "px" : "0px" }),
|
|
808
|
+
onScroll: scrollHandler
|
|
809
|
+
}, [
|
|
810
|
+
((_a = curChannel.value) == null ? void 0 : _a.ext) && __props.isNoMore ? (openBlock(), createBlock(_sfc_main$1, {
|
|
811
|
+
key: 0,
|
|
812
|
+
content: (_b = curChannel.value) == null ? void 0 : _b.ext,
|
|
813
|
+
style: normalizeStyle({ marginBottom: __props.msgs.length ? "1rem" : "0" })
|
|
814
|
+
}, null, 8, ["content", "style"])) : createCommentVNode("", true),
|
|
815
|
+
__props.msgs.length ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
816
|
+
__props.isNoMore ? (openBlock(), createElementBlock("div", _hoisted_3, "没有更多消息了~")) : loadingMore.value ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
817
|
+
createVNode(unref(LoadingOutlined)),
|
|
818
|
+
_cache[1] || (_cache[1] = createElementVNode("span", { style: { "margin-left": "10px" } }, "正在加载,请稍候", -1))
|
|
819
|
+
])) : createCommentVNode("", true)
|
|
820
|
+
])) : createCommentVNode("", true),
|
|
821
|
+
__props.msgs.length ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
822
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.msgs, (item) => {
|
|
823
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
824
|
+
key: item.msgIdClient,
|
|
825
|
+
msg: item,
|
|
826
|
+
"my-avatar": __props.myAvatar,
|
|
827
|
+
"my-accid": __props.myAccid,
|
|
828
|
+
onResendText: handleResendText,
|
|
829
|
+
onResendImg: handleResendImg,
|
|
830
|
+
onResendFile: handleResendFile,
|
|
831
|
+
onContextMenuSwitch,
|
|
832
|
+
onQuote: handleQuote,
|
|
833
|
+
onQuoteMsgClick: handleQuoteMsgClick
|
|
834
|
+
}, null, 8, ["msg", "my-avatar", "my-accid"]);
|
|
835
|
+
}), 128))
|
|
836
|
+
])) : (openBlock(), createElementBlock("div", {
|
|
837
|
+
key: 3,
|
|
838
|
+
class: "emptyChatroomContent",
|
|
839
|
+
style: normalizeStyle({ height: ((_c = curChannel.value) == null ? void 0 : _c.ext) ? "calc(100% - 48px)" : "100%" })
|
|
840
|
+
}, [
|
|
841
|
+
_cache[2] || (_cache[2] = createElementVNode("div", null, "欢迎来到", -1)),
|
|
842
|
+
createElementVNode("h1", null, "#" + toDisplayString(__props.channelName), 1)
|
|
843
|
+
], 4))
|
|
844
|
+
], 38),
|
|
845
|
+
createElementVNode("div", _hoisted_6, [
|
|
846
|
+
createElementVNode("div", _hoisted_7, [
|
|
847
|
+
quoteMsg.value ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
848
|
+
createVNode(unref(CloseOutlined), {
|
|
849
|
+
class: "chatroomInputQuoteDeleteBtn",
|
|
850
|
+
size: "12px",
|
|
851
|
+
onClick: handleDeleteQuoteMsg
|
|
852
|
+
}),
|
|
853
|
+
createElementVNode("div", _hoisted_9, [
|
|
854
|
+
createElementVNode("div", _hoisted_10, toDisplayString(quoteMsg.value.fromNick) + ":", 1),
|
|
855
|
+
((_d = quoteMsg.value) == null ? void 0 : _d.body) ? (openBlock(), createElementBlock("div", {
|
|
856
|
+
key: 0,
|
|
857
|
+
class: "chatroomInputQuoteTextBody",
|
|
858
|
+
innerHTML: (_e = quoteMsg.value) == null ? void 0 : _e.body
|
|
859
|
+
}, null, 8, _hoisted_11)) : createCommentVNode("", true)
|
|
860
|
+
]),
|
|
861
|
+
quoteMsg.value.type === "image" ? (openBlock(), createElementBlock("div", _hoisted_12, [
|
|
862
|
+
createVNode(unref(Image), {
|
|
863
|
+
preview: false,
|
|
864
|
+
class: "imgMsg quoteImg",
|
|
865
|
+
src: (_f = quoteMsg.value.attach) == null ? void 0 : _f.url,
|
|
866
|
+
width: unref(getImageMsgDisplaySize)(quoteMsg.value.attach).width,
|
|
867
|
+
height: unref(getImageMsgDisplaySize)(quoteMsg.value.attach).height
|
|
868
|
+
}, null, 8, ["src", "width", "height"])
|
|
869
|
+
])) : createCommentVNode("", true)
|
|
870
|
+
])) : createCommentVNode("", true),
|
|
871
|
+
createElementVNode("div", _hoisted_13, [
|
|
872
|
+
createElementVNode("div", _hoisted_14, [
|
|
873
|
+
createVNode(unref(Popover), { placement: "topLeft" }, {
|
|
874
|
+
content: withCtx(() => [
|
|
875
|
+
createElementVNode("div", _hoisted_15, [
|
|
876
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(emjjData, (value, i) => {
|
|
877
|
+
return createElementVNode("span", {
|
|
878
|
+
key: i,
|
|
879
|
+
style: { "font-size": "16px", "cursor": "pointer" },
|
|
880
|
+
onClick: ($event) => insertEmj(i)
|
|
881
|
+
}, toDisplayString(value), 9, _hoisted_16);
|
|
882
|
+
}), 64))
|
|
883
|
+
])
|
|
884
|
+
]),
|
|
885
|
+
default: withCtx(() => [
|
|
886
|
+
createVNode(unref(Button), {
|
|
887
|
+
class: "chatroomButtonSmile",
|
|
888
|
+
type: "text",
|
|
889
|
+
disabled: __props.sendDisabled
|
|
890
|
+
}, {
|
|
891
|
+
default: withCtx(() => [..._cache[3] || (_cache[3] = [
|
|
892
|
+
createElementVNode("svg", {
|
|
893
|
+
width: "21",
|
|
894
|
+
height: "21",
|
|
895
|
+
viewBox: "0 0 21 21",
|
|
896
|
+
fill: "var(--theme-head-title-link, #3B3E55)",
|
|
897
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
898
|
+
}, [
|
|
899
|
+
createElementVNode("path", {
|
|
900
|
+
d: "M10.5003 20.8699C7.69521 20.8699 5.05787 19.7847 3.07484 17.8152C1.09142 15.8434 -0.000386379 13.223 1.02571e-07 10.435C1.02571e-07 7.64729 1.09258 5.02656 3.07638 3.05551C5.05941 1.08524 7.69676 0 10.5022 0C13.3085 0 15.9454 1.08524 17.9292 3.05551C22.024 7.12515 22.0236 13.7452 17.9292 17.8133C15.945 19.7839 13.3065 20.8699 10.5003 20.8699ZM10.5022 1.36002C8.06198 1.36002 5.76899 2.30342 4.04374 4.01708C2.3185 5.73034 1.36853 8.01019 1.36853 10.435C1.36814 12.8601 2.31772 15.1396 4.0422 16.8536C5.76706 18.5665 8.06082 19.5111 10.5003 19.5111C12.9409 19.5111 15.2358 18.5657 16.9615 16.8517C20.5221 13.3139 20.5221 7.55608 16.9615 4.01708C15.2362 2.30342 12.9425 1.36002 10.5022 1.36002ZM6.76998 13.2829C6.76998 13.2829 8.00053 15.2374 10.4999 15.2374C12.9993 15.2374 14.6383 13.2829 14.6383 13.2829C14.6383 13.2829 15.5674 13.2799 15.567 14.26C15.567 14.26 13.9562 16.5402 10.4999 16.5402C7.0436 16.5402 5.91856 14.26 5.91856 14.26C5.91856 14.26 5.88455 13.2829 6.76998 13.2829ZM7.44825 7.07955C6.74022 7.07955 6.16204 7.65192 6.16204 8.35764C6.16204 9.06258 6.73983 9.63495 7.44825 9.63495C8.15976 9.63495 8.73446 9.06258 8.73446 8.35764C8.73446 7.65192 8.15976 7.07955 7.44825 7.07955ZM14.0381 7.07955C13.3289 7.07955 12.7527 7.65192 12.7527 8.35764C12.7527 9.06258 13.3289 9.63495 14.0381 9.63495C14.7489 9.63495 15.3243 9.06258 15.3243 8.35764C15.3243 7.65192 14.7489 7.07955 14.0381 7.07955Z",
|
|
901
|
+
fill: "#9198A1"
|
|
902
|
+
})
|
|
903
|
+
], -1)
|
|
904
|
+
])]),
|
|
905
|
+
_: 1
|
|
906
|
+
}, 8, ["disabled"])
|
|
907
|
+
]),
|
|
908
|
+
_: 1
|
|
909
|
+
})
|
|
910
|
+
]),
|
|
911
|
+
createVNode(unref(Textarea), {
|
|
912
|
+
id: "chatroomInputId",
|
|
913
|
+
value: curText.value,
|
|
914
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => curText.value = $event),
|
|
915
|
+
class: "chatroomInput",
|
|
916
|
+
placeholder: inputPlaceholder.value,
|
|
917
|
+
disabled: __props.sendDisabled,
|
|
918
|
+
"auto-size": { minRows: 1, maxRows: 4 },
|
|
919
|
+
onChange: inputChangeHandler,
|
|
920
|
+
onKeydown: unref(handleInputKeydown),
|
|
921
|
+
onClick: unref(handleMentionClick),
|
|
922
|
+
onPressEnter: pressEnterHandler,
|
|
923
|
+
onBlur: handleInputBlur
|
|
924
|
+
}, null, 8, ["value", "placeholder", "disabled", "onKeydown", "onClick"]),
|
|
925
|
+
createElementVNode("div", _hoisted_17, [
|
|
926
|
+
createVNode(unref(Upload), {
|
|
927
|
+
"before-upload": uploadImgHandler,
|
|
928
|
+
"show-upload-list": false,
|
|
929
|
+
accept: ".jpg,.png,.jpeg",
|
|
930
|
+
disabled: __props.sendDisabled
|
|
931
|
+
}, {
|
|
932
|
+
default: withCtx(() => [
|
|
933
|
+
createVNode(unref(Button), {
|
|
934
|
+
class: "chatroomButton",
|
|
935
|
+
type: "text",
|
|
936
|
+
loading: __props.imgUploading,
|
|
937
|
+
disabled: __props.sendDisabled
|
|
938
|
+
}, {
|
|
939
|
+
icon: withCtx(() => [..._cache[4] || (_cache[4] = [
|
|
940
|
+
createElementVNode("svg", {
|
|
941
|
+
width: "21",
|
|
942
|
+
height: "18",
|
|
943
|
+
viewBox: "0 0 21 18",
|
|
944
|
+
fill: "var(--theme-head-title-link, #3B3E55)",
|
|
945
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
946
|
+
}, [
|
|
947
|
+
createElementVNode("path", {
|
|
948
|
+
d: "M15.75 9C16.9926 9 18 7.99264 18 6.75C18 5.50736 16.9926 4.5 15.75 4.5C14.5074 4.5 13.5 5.50736 13.5 6.75C13.5 7.99264 14.5074 9 15.75 9Z",
|
|
949
|
+
fill: "#9198A1"
|
|
950
|
+
}),
|
|
951
|
+
createElementVNode("path", {
|
|
952
|
+
"fill-rule": "evenodd",
|
|
953
|
+
"clip-rule": "evenodd",
|
|
954
|
+
d: "M3 0C1.34315 0 0 1.34315 0 3V15C0 16.6569 1.34315 18 3 18H18C19.6569 18 21 16.6569 21 15V3C21 1.34315 19.6569 0 18 0H3ZM18 1.5H3C2.17157 1.5 1.5 2.17157 1.5 3V8.68934L6 4.18934L18.2838 16.4732C18.9765 16.3405 19.5 15.7314 19.5 15V3C19.5 2.17157 18.8284 1.5 18 1.5ZM1.5 15V10.8107L6 6.31066L16.1893 16.5H3C2.17157 16.5 1.5 15.8284 1.5 15Z",
|
|
955
|
+
fill: "#9198A1"
|
|
956
|
+
})
|
|
957
|
+
], -1)
|
|
958
|
+
])]),
|
|
959
|
+
_: 1
|
|
960
|
+
}, 8, ["loading", "disabled"])
|
|
961
|
+
]),
|
|
962
|
+
_: 1
|
|
963
|
+
}, 8, ["disabled"]),
|
|
964
|
+
_cache[6] || (_cache[6] = createElementVNode("span", { class: "lineSeparator" }, null, -1)),
|
|
965
|
+
createVNode(unref(Button), {
|
|
966
|
+
class: "chatroomButtonArrowUp",
|
|
967
|
+
type: "text",
|
|
968
|
+
disabled: __props.sendDisabled,
|
|
969
|
+
onClick: handleSendText
|
|
970
|
+
}, {
|
|
971
|
+
icon: withCtx(() => [..._cache[5] || (_cache[5] = [
|
|
972
|
+
createElementVNode("svg", {
|
|
973
|
+
width: "36",
|
|
974
|
+
height: "36",
|
|
975
|
+
viewBox: "0 0 36 36",
|
|
976
|
+
fill: "var(--theme-btn-primary, #000)",
|
|
977
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
978
|
+
}, [
|
|
979
|
+
createElementVNode("rect", {
|
|
980
|
+
width: "36",
|
|
981
|
+
height: "36",
|
|
982
|
+
rx: "18",
|
|
983
|
+
fill: "var(--theme-btn-primary, #000)"
|
|
984
|
+
}),
|
|
985
|
+
createElementVNode("path", {
|
|
986
|
+
d: "M25.4253 15.5288L24.3633 16.5894L18.75 10.9746V27.8774H17.25V10.9746L11.6367 16.5894L10.5747 15.5288L18 8.10352L25.4253 15.5288Z",
|
|
987
|
+
fill: "#F0F6FC"
|
|
988
|
+
})
|
|
989
|
+
], -1)
|
|
990
|
+
])]),
|
|
991
|
+
_: 1
|
|
992
|
+
}, 8, ["disabled"])
|
|
993
|
+
])
|
|
994
|
+
])
|
|
995
|
+
])
|
|
996
|
+
]),
|
|
997
|
+
createVNode(AitPersonPopover, {
|
|
998
|
+
visible: unref(showAitPersonPopover),
|
|
999
|
+
"cursor-rect": unref(cursorRectRef),
|
|
1000
|
+
items: unref(aitDisplayItems),
|
|
1001
|
+
"selected-index": unref(aitPersonSelectedIndex),
|
|
1002
|
+
"members-count": unref(aitPopoverItemsLength),
|
|
1003
|
+
"set-item-ref": unref(setAitItemRef),
|
|
1004
|
+
onSelect: unref(confirmAitSelection)
|
|
1005
|
+
}, null, 8, ["visible", "cursor-rect", "items", "selected-index", "members-count", "set-item-ref", "onSelect"])
|
|
1006
|
+
]);
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
1009
|
+
});
|
|
1010
|
+
export {
|
|
1011
|
+
_sfc_main as _
|
|
1012
|
+
};
|