@voicenter-team/voicenter-ui-plus 3.4.6 → 3.4.8
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 +65 -9
- package/library/assets/assets/sass/main.css +1 -1
- package/library/assets/components/VcChatComposer/VcChatComposer.css +1 -1
- package/library/assets/components/VcMessage/VcMessage.css +1 -1
- package/library/assets/components/VcMessage/VcMessageMeta.css +1 -0
- package/library/assets/components/VcMessage/content/VcMessageVideoBlock.css +1 -0
- package/library/assets/components/VcMessagesWrapper/VcMessagesWrapper.css +1 -1
- package/library/components/VcChatComposer/VcChatComposer.vue.mjs +38 -27
- package/library/components/VcChatComposer/richText.mjs +8 -0
- package/library/components/VcExcelUploader/VcExcelFileUploader.vue.mjs +1 -0
- package/library/components/VcExcelUploader/VcFileImportResultBindData.vue.mjs +1 -1
- package/library/components/VcMessage/VcMessage.vue.mjs +65 -40
- package/library/components/VcMessage/VcMessageMeta.vue.mjs +49 -0
- package/library/components/VcMessage/VcMessageMeta.vue3.mjs +5 -0
- package/library/components/VcMessage/content/VcMessageAudioBlock.vue.mjs +3 -9
- package/library/components/VcMessage/content/VcMessageImageBlock.vue.mjs +1 -1
- package/library/components/VcMessage/content/VcMessageVideoBlock.vue.mjs +60 -0
- package/library/components/VcMessage/content/VcMessageVideoBlock.vue3.mjs +5 -0
- package/library/components/VcMessage/content/formatDuration.mjs +10 -0
- package/library/components/VcMessage/content/messageContentComponents.mjs +8 -5
- package/library/components/VcMessagesWrapper/VcMessagesWrapper.vue.mjs +167 -63
- package/library/components/VcMessagesWrapper/VcMessagesWrapperRow.vue.mjs +83 -0
- package/library/components/VcMessagesWrapper/VcMessagesWrapperRow.vue2.mjs +4 -0
- package/library/localization/locales/en.json.mjs +8 -1
- package/library/style.css +8 -4
- package/library/style.css.br +0 -0
- package/library/style.css.gz +0 -0
- package/library/types/components/VcChatComposer/VcChatComposer.vue.d.ts +29 -2
- package/library/types/components/VcExcelUploader/VcExcelFileUploader.vue.d.ts +1 -2
- package/library/types/components/VcMessage/VcMessage.vue.d.ts +20 -2
- package/library/types/components/VcMessage/VcMessageMeta.vue.d.ts +24 -0
- package/library/types/components/VcMessage/content/VcMessageVideoBlock.vue.d.ts +24 -0
- package/library/types/components/VcMessage/content/formatDuration.d.ts +4 -0
- package/library/types/components/VcMessagesWrapper/VcMessagesWrapper.vue.d.ts +20 -2
- package/library/types/components/VcMessagesWrapper/VcMessagesWrapperRow.vue.d.ts +49 -0
- package/library/types/components/VcModal/VcConfirmModal.vue.d.ts +1 -1
- package/library/types/localization/locales/en.json.d.ts +8 -1
- package/library/types/types/VcChatComposer.types.d.ts +3 -2
- package/library/types/types/VcMessage.types.d.ts +48 -3
- package/library/types/types/VcMessagesWrapper.types.d.ts +30 -1
- package/package.json +1 -1
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import '../../assets/components/VcMessagesWrapper/VcMessagesWrapper.css';
|
|
2
|
-
import { defineComponent, ref, computed, watch, nextTick, onMounted, onBeforeUnmount, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, Fragment, renderList, toDisplayString,
|
|
2
|
+
import { defineComponent, ref, computed, watch, nextTick, onMounted, onBeforeUnmount, openBlock, createElementBlock, createElementVNode, renderSlot, createCommentVNode, Fragment, renderList, toDisplayString, createBlock } from "vue";
|
|
3
3
|
import dayjs from "dayjs";
|
|
4
|
-
import _sfc_main$1 from "
|
|
5
|
-
import '../../assets/components/VcMessage/VcMessage.css';/* empty css */
|
|
4
|
+
import _sfc_main$1 from "./VcMessagesWrapperRow.vue.mjs";
|
|
6
5
|
import { tVU } from "../../localization/index.mjs";
|
|
7
6
|
const _hoisted_1 = {
|
|
8
7
|
key: 0,
|
|
9
8
|
class: "vc-messages-wrapper__date"
|
|
10
9
|
};
|
|
11
10
|
const _hoisted_2 = { class: "vc-messages-wrapper__date-label" };
|
|
12
|
-
const _hoisted_3 =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
class: "vc-messages-wrapper__header"
|
|
11
|
+
const _hoisted_3 = {
|
|
12
|
+
key: 1,
|
|
13
|
+
class: "vc-messages-wrapper__unread"
|
|
16
14
|
};
|
|
17
|
-
const
|
|
18
|
-
const
|
|
15
|
+
const _hoisted_4 = { class: "vc-messages-wrapper__unread-label" };
|
|
16
|
+
const UNREAD_KEY = "unread-divider";
|
|
17
|
+
const SEEN_TOLERANCE = 2;
|
|
19
18
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
20
19
|
__name: "VcMessagesWrapper",
|
|
21
20
|
props: {
|
|
@@ -23,23 +22,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
23
22
|
options: { type: Function, default: void 0 },
|
|
24
23
|
additionalOptions: { type: Function, default: void 0 },
|
|
25
24
|
reactionEmojis: { default: void 0 },
|
|
25
|
+
unreadFromId: { default: void 0 },
|
|
26
26
|
scrollThreshold: { default: 50 },
|
|
27
27
|
dateFormat: { default: "dddd, MMM D" },
|
|
28
28
|
timeFormat: { default: "HH:mm" }
|
|
29
29
|
},
|
|
30
|
-
emits: ["reached-top", "reached-bottom", "option-click", "reply-click", "content-click", "reaction-toggle"],
|
|
30
|
+
emits: ["reached-top", "reached-bottom", "option-click", "reply-click", "content-click", "reaction-toggle", "seen"],
|
|
31
31
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
32
32
|
const props = __props;
|
|
33
33
|
const emit = __emit;
|
|
34
34
|
const containerRef = ref();
|
|
35
35
|
const listRef = ref();
|
|
36
|
+
const unreadLabel = computed(() => tVU.t("voicenterUi.messagesWrapper.newMessages"));
|
|
37
|
+
function isSameId(a, b) {
|
|
38
|
+
return String(a) === String(b);
|
|
39
|
+
}
|
|
36
40
|
const renderItems = computed(() => {
|
|
37
41
|
const items = [];
|
|
42
|
+
const { unreadFromId } = props;
|
|
38
43
|
let previous;
|
|
39
44
|
for (const message of props.messages) {
|
|
40
45
|
const createdAt = dayjs(message.createdAt);
|
|
41
46
|
const previousCreatedAt = previous ? dayjs(previous.createdAt) : void 0;
|
|
42
47
|
const isNewDay = !previousCreatedAt || !createdAt.isSame(previousCreatedAt, "day");
|
|
48
|
+
const isUnreadStart = unreadFromId !== void 0 && unreadFromId !== null && isSameId(message.id, unreadFromId);
|
|
43
49
|
if (isNewDay) {
|
|
44
50
|
items.push({
|
|
45
51
|
kind: "date",
|
|
@@ -48,7 +54,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
48
54
|
label: formatDateLabel(createdAt)
|
|
49
55
|
});
|
|
50
56
|
}
|
|
51
|
-
|
|
57
|
+
if (isUnreadStart) {
|
|
58
|
+
items.push({
|
|
59
|
+
kind: "unread",
|
|
60
|
+
key: UNREAD_KEY
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const isGroupStart = isNewDay || isUnreadStart || (previous == null ? void 0 : previous.sender.id) !== message.sender.id;
|
|
52
64
|
const isNewMinute = !previousCreatedAt || !createdAt.isSame(previousCreatedAt, "minute");
|
|
53
65
|
items.push({
|
|
54
66
|
kind: "message",
|
|
@@ -72,8 +84,26 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
72
84
|
}
|
|
73
85
|
return date.format(props.dateFormat);
|
|
74
86
|
}
|
|
75
|
-
|
|
76
|
-
|
|
87
|
+
function onOptionClick(event, message, option) {
|
|
88
|
+
emit("option-click", event, message, option);
|
|
89
|
+
}
|
|
90
|
+
function onReplyClick(message) {
|
|
91
|
+
var _a;
|
|
92
|
+
if (((_a = message.replyTo) == null ? void 0 : _a.id) !== void 0) {
|
|
93
|
+
scrollToMessage(message.replyTo.id);
|
|
94
|
+
}
|
|
95
|
+
emit("reply-click", message);
|
|
96
|
+
}
|
|
97
|
+
function onContentClick(message) {
|
|
98
|
+
emit("content-click", message);
|
|
99
|
+
}
|
|
100
|
+
function onReactionToggle(emoji, message) {
|
|
101
|
+
emit("reaction-toggle", emoji, message);
|
|
102
|
+
}
|
|
103
|
+
const lastEdges = {
|
|
104
|
+
top: false,
|
|
105
|
+
bottom: false
|
|
106
|
+
};
|
|
77
107
|
function getEdges() {
|
|
78
108
|
const el = containerRef.value;
|
|
79
109
|
if (!el) {
|
|
@@ -88,20 +118,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
88
118
|
};
|
|
89
119
|
}
|
|
90
120
|
function syncEdges() {
|
|
91
|
-
|
|
92
|
-
isAtTop = edges.top;
|
|
93
|
-
isAtBottom = edges.bottom;
|
|
121
|
+
Object.assign(lastEdges, getEdges());
|
|
94
122
|
}
|
|
95
123
|
function onScroll() {
|
|
96
124
|
const edges = getEdges();
|
|
97
|
-
if (edges.top && !
|
|
125
|
+
if (edges.top && !lastEdges.top) {
|
|
98
126
|
emit("reached-top");
|
|
99
127
|
}
|
|
100
|
-
if (edges.bottom && !
|
|
128
|
+
if (edges.bottom && !lastEdges.bottom) {
|
|
101
129
|
emit("reached-bottom");
|
|
102
130
|
}
|
|
103
|
-
|
|
104
|
-
|
|
131
|
+
Object.assign(lastEdges, edges);
|
|
132
|
+
scheduleSeenUpdate();
|
|
105
133
|
}
|
|
106
134
|
function scrollToBottom(behavior = "auto") {
|
|
107
135
|
const el = containerRef.value;
|
|
@@ -114,24 +142,100 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
114
142
|
});
|
|
115
143
|
syncEdges();
|
|
116
144
|
}
|
|
117
|
-
function
|
|
145
|
+
function scrollToElement(target, { behavior = "auto", block = "start", offset = 0 } = {}) {
|
|
146
|
+
const el = containerRef.value;
|
|
147
|
+
if (!el) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const containerTop = el.getBoundingClientRect().top + el.clientTop;
|
|
151
|
+
const { top, height } = target.getBoundingClientRect();
|
|
152
|
+
const elementTop = top - containerTop + el.scrollTop;
|
|
153
|
+
const positions = {
|
|
154
|
+
start: elementTop - offset,
|
|
155
|
+
center: elementTop - (el.clientHeight - height) / 2,
|
|
156
|
+
end: elementTop + height - el.clientHeight + offset
|
|
157
|
+
};
|
|
158
|
+
el.scrollTo({
|
|
159
|
+
top: positions[block],
|
|
160
|
+
behavior
|
|
161
|
+
});
|
|
162
|
+
if (behavior !== "smooth") {
|
|
163
|
+
syncEdges();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function findRow(id) {
|
|
118
167
|
var _a;
|
|
119
|
-
|
|
168
|
+
return Array.from(((_a = listRef.value) == null ? void 0 : _a.children) ?? []).find((child) => child instanceof HTMLElement && child.dataset.messageId !== void 0 && isSameId(child.dataset.messageId, id));
|
|
169
|
+
}
|
|
170
|
+
function scrollToMessage(id, options = {}) {
|
|
171
|
+
const target = findRow(id);
|
|
120
172
|
if (!target) {
|
|
121
173
|
return false;
|
|
122
174
|
}
|
|
123
|
-
target
|
|
175
|
+
scrollToElement(target, {
|
|
124
176
|
block: "center",
|
|
125
|
-
behavior
|
|
177
|
+
behavior: "smooth",
|
|
178
|
+
...options
|
|
126
179
|
});
|
|
127
180
|
return true;
|
|
128
181
|
}
|
|
129
|
-
function
|
|
182
|
+
function scrollToUnread(options = {}) {
|
|
130
183
|
var _a;
|
|
131
|
-
|
|
132
|
-
|
|
184
|
+
const target = (_a = listRef.value) == null ? void 0 : _a.querySelector(":scope > .vc-messages-wrapper__unread");
|
|
185
|
+
if (!target) {
|
|
186
|
+
return false;
|
|
133
187
|
}
|
|
134
|
-
|
|
188
|
+
scrollToElement(target, options);
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
function isAtBottom() {
|
|
192
|
+
return getEdges().bottom;
|
|
193
|
+
}
|
|
194
|
+
let lastSeenId;
|
|
195
|
+
let isSeenScheduled = false;
|
|
196
|
+
let seenFrame = 0;
|
|
197
|
+
function getMessageRows() {
|
|
198
|
+
var _a;
|
|
199
|
+
return Array.from(((_a = listRef.value) == null ? void 0 : _a.children) ?? []).filter((child) => child instanceof HTMLElement && child.dataset.messageId !== void 0);
|
|
200
|
+
}
|
|
201
|
+
function updateSeen() {
|
|
202
|
+
const el = containerRef.value;
|
|
203
|
+
if (!el || !el.clientHeight || document.visibilityState !== "visible") {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const rows = getMessageRows();
|
|
207
|
+
const visibleBottom = el.getBoundingClientRect().bottom + SEEN_TOLERANCE;
|
|
208
|
+
let low = 0;
|
|
209
|
+
let high = rows.length - 1;
|
|
210
|
+
let seenRow;
|
|
211
|
+
while (low <= high) {
|
|
212
|
+
const middle = Math.floor((low + high) / 2);
|
|
213
|
+
if (rows[middle].getBoundingClientRect().bottom <= visibleBottom) {
|
|
214
|
+
seenRow = rows[middle];
|
|
215
|
+
low = middle + 1;
|
|
216
|
+
} else {
|
|
217
|
+
high = middle - 1;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const seenId = seenRow == null ? void 0 : seenRow.dataset.messageId;
|
|
221
|
+
const seenIndex = seenId === void 0 ? -1 : props.messages.findIndex((message) => isSameId(message.id, seenId));
|
|
222
|
+
const previousId = lastSeenId;
|
|
223
|
+
const previousIndex = previousId === void 0 ? -1 : props.messages.findIndex((message) => isSameId(message.id, previousId));
|
|
224
|
+
if (seenIndex <= previousIndex) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
lastSeenId = props.messages[seenIndex].id;
|
|
228
|
+
emit("seen", props.messages[seenIndex]);
|
|
229
|
+
}
|
|
230
|
+
function scheduleSeenUpdate() {
|
|
231
|
+
if (isSeenScheduled) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
isSeenScheduled = true;
|
|
235
|
+
seenFrame = requestAnimationFrame(() => {
|
|
236
|
+
isSeenScheduled = false;
|
|
237
|
+
updateSeen();
|
|
238
|
+
});
|
|
135
239
|
}
|
|
136
240
|
watch(
|
|
137
241
|
() => {
|
|
@@ -154,26 +258,39 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
154
258
|
} else if (wasAtBottom) {
|
|
155
259
|
scrollToBottom();
|
|
156
260
|
}
|
|
261
|
+
scheduleSeenUpdate();
|
|
157
262
|
}
|
|
158
263
|
);
|
|
159
264
|
let resizeObserver;
|
|
160
265
|
onMounted(() => {
|
|
161
|
-
|
|
266
|
+
if (!scrollToUnread()) {
|
|
267
|
+
scrollToBottom();
|
|
268
|
+
}
|
|
162
269
|
resizeObserver = new ResizeObserver(() => {
|
|
163
|
-
if (
|
|
270
|
+
if (lastEdges.bottom) {
|
|
164
271
|
scrollToBottom();
|
|
165
272
|
}
|
|
273
|
+
scheduleSeenUpdate();
|
|
166
274
|
});
|
|
167
275
|
if (listRef.value) {
|
|
168
276
|
resizeObserver.observe(listRef.value);
|
|
169
277
|
}
|
|
278
|
+
if (containerRef.value) {
|
|
279
|
+
resizeObserver.observe(containerRef.value);
|
|
280
|
+
}
|
|
281
|
+
document.addEventListener("visibilitychange", scheduleSeenUpdate);
|
|
282
|
+
scheduleSeenUpdate();
|
|
170
283
|
});
|
|
171
284
|
onBeforeUnmount(() => {
|
|
172
285
|
resizeObserver == null ? void 0 : resizeObserver.disconnect();
|
|
286
|
+
document.removeEventListener("visibilitychange", scheduleSeenUpdate);
|
|
287
|
+
cancelAnimationFrame(seenFrame);
|
|
173
288
|
});
|
|
174
289
|
__expose({
|
|
175
290
|
scrollToBottom,
|
|
176
|
-
scrollToMessage
|
|
291
|
+
scrollToMessage,
|
|
292
|
+
scrollToUnread,
|
|
293
|
+
isAtBottom
|
|
177
294
|
});
|
|
178
295
|
return (_ctx, _cache) => {
|
|
179
296
|
return openBlock(), createElementBlock("div", {
|
|
@@ -189,7 +306,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
189
306
|
}, [
|
|
190
307
|
!__props.messages.length ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : createCommentVNode("", true),
|
|
191
308
|
(openBlock(true), createElementBlock(Fragment, null, renderList(renderItems.value, (item) => {
|
|
192
|
-
var _a, _b;
|
|
193
309
|
return openBlock(), createElementBlock(Fragment, {
|
|
194
310
|
key: item.key
|
|
195
311
|
}, [
|
|
@@ -200,37 +316,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
200
316
|
}, () => [
|
|
201
317
|
createElementVNode("span", _hoisted_2, toDisplayString(item.label), 1)
|
|
202
318
|
])
|
|
203
|
-
])) : (openBlock(), createElementBlock("div",
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
item.showTime
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
reactions: item.message.reactions,
|
|
223
|
-
"reaction-emojis": __props.reactionEmojis,
|
|
224
|
-
edited: item.message.isEdited,
|
|
225
|
-
deleted: item.message.isDeleted,
|
|
226
|
-
options: ((_a = __props.options) == null ? void 0 : _a.call(__props, item.message)) ?? [],
|
|
227
|
-
"additional-options": ((_b = __props.additionalOptions) == null ? void 0 : _b.call(__props, item.message)) ?? [],
|
|
228
|
-
onOptionClick: (event, option) => emit("option-click", event, item.message, option),
|
|
229
|
-
onReplyClick: ($event) => onReplyClick(item.message),
|
|
230
|
-
onContentClick: ($event) => emit("content-click", item.message),
|
|
231
|
-
onReactionToggle: ($event) => emit("reaction-toggle", $event, item.message)
|
|
232
|
-
}, null, 8, ["content", "align", "reply", "reactions", "reaction-emojis", "edited", "deleted", "options", "additional-options", "onOptionClick", "onReplyClick", "onContentClick", "onReactionToggle"])
|
|
233
|
-
], 10, _hoisted_3))
|
|
319
|
+
])) : item.kind === "unread" ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
320
|
+
renderSlot(_ctx.$slots, "unread-divider", { label: unreadLabel.value }, () => [
|
|
321
|
+
createElementVNode("span", _hoisted_4, toDisplayString(unreadLabel.value), 1)
|
|
322
|
+
])
|
|
323
|
+
])) : (openBlock(), createBlock(_sfc_main$1, {
|
|
324
|
+
key: 2,
|
|
325
|
+
message: item.message,
|
|
326
|
+
"is-group-start": item.isGroupStart,
|
|
327
|
+
"show-time": item.showTime,
|
|
328
|
+
time: item.time,
|
|
329
|
+
options: __props.options,
|
|
330
|
+
"additional-options": __props.additionalOptions,
|
|
331
|
+
"reaction-emojis": __props.reactionEmojis,
|
|
332
|
+
"header-slot": _ctx.$slots["message-header"],
|
|
333
|
+
onOptionClick,
|
|
334
|
+
onReplyClick,
|
|
335
|
+
onContentClick,
|
|
336
|
+
onReactionToggle
|
|
337
|
+
}, null, 8, ["message", "is-group-start", "show-time", "time", "options", "additional-options", "reaction-emojis", "header-slot"]))
|
|
234
338
|
], 64);
|
|
235
339
|
}), 128))
|
|
236
340
|
], 512)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, Fragment, createElementVNode, toDisplayString, createCommentVNode, createVNode, createSlots, withCtx } from "vue";
|
|
2
|
+
import _sfc_main$1 from "../VcMessage/VcMessage.vue.mjs";
|
|
3
|
+
import '../../assets/components/VcMessage/VcMessage.css';/* empty css */
|
|
4
|
+
const _hoisted_1 = ["data-message-id"];
|
|
5
|
+
const _hoisted_2 = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "vc-messages-wrapper__header"
|
|
8
|
+
};
|
|
9
|
+
const _hoisted_3 = { class: "vc-messages-wrapper__sender" };
|
|
10
|
+
const _hoisted_4 = { class: "vc-messages-wrapper__time" };
|
|
11
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "VcMessagesWrapperRow",
|
|
13
|
+
props: {
|
|
14
|
+
message: {},
|
|
15
|
+
isGroupStart: { type: Boolean },
|
|
16
|
+
showTime: { type: Boolean },
|
|
17
|
+
time: {},
|
|
18
|
+
options: { type: Function },
|
|
19
|
+
additionalOptions: { type: Function },
|
|
20
|
+
reactionEmojis: {},
|
|
21
|
+
headerSlot: { type: Function }
|
|
22
|
+
},
|
|
23
|
+
emits: ["option-click", "reply-click", "content-click", "reaction-toggle"],
|
|
24
|
+
setup(__props, { emit: __emit }) {
|
|
25
|
+
const EMPTY_OPTIONS = [];
|
|
26
|
+
const EMPTY_ADDITIONAL_OPTIONS = [];
|
|
27
|
+
const props = __props;
|
|
28
|
+
const emit = __emit;
|
|
29
|
+
const SlotOutlet = (outlet) => outlet.render(outlet.scope);
|
|
30
|
+
const messageOptions = computed(() => {
|
|
31
|
+
var _a;
|
|
32
|
+
return ((_a = props.options) == null ? void 0 : _a.call(props, props.message)) ?? EMPTY_OPTIONS;
|
|
33
|
+
});
|
|
34
|
+
const messageAdditionalOptions = computed(() => {
|
|
35
|
+
var _a;
|
|
36
|
+
return ((_a = props.additionalOptions) == null ? void 0 : _a.call(props, props.message)) ?? EMPTY_ADDITIONAL_OPTIONS;
|
|
37
|
+
});
|
|
38
|
+
return (_ctx, _cache) => {
|
|
39
|
+
return openBlock(), createElementBlock("div", {
|
|
40
|
+
"data-message-id": __props.message.id,
|
|
41
|
+
class: normalizeClass([[__props.message.class, { "is--own": __props.message.isOwn, "is--group-start": __props.isGroupStart }], "vc-messages-wrapper__row"])
|
|
42
|
+
}, [
|
|
43
|
+
__props.showTime ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
44
|
+
__props.isGroupStart ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
45
|
+
createElementVNode("span", _hoisted_3, toDisplayString(__props.message.sender.name), 1),
|
|
46
|
+
_cache[4] || (_cache[4] = createElementVNode("span", { class: "vc-messages-wrapper__dot" }, "·", -1))
|
|
47
|
+
], 64)) : createCommentVNode("", true),
|
|
48
|
+
createElementVNode("span", _hoisted_4, toDisplayString(__props.time), 1)
|
|
49
|
+
])) : createCommentVNode("", true),
|
|
50
|
+
createVNode(_sfc_main$1, {
|
|
51
|
+
content: __props.message.content,
|
|
52
|
+
align: __props.message.isOwn ? "end" : "start",
|
|
53
|
+
reply: __props.message.replyTo,
|
|
54
|
+
reactions: __props.message.reactions,
|
|
55
|
+
"reaction-emojis": __props.reactionEmojis,
|
|
56
|
+
edited: __props.message.isEdited,
|
|
57
|
+
deleted: __props.message.isDeleted,
|
|
58
|
+
status: __props.message.status,
|
|
59
|
+
options: messageOptions.value,
|
|
60
|
+
"additional-options": messageAdditionalOptions.value,
|
|
61
|
+
onOptionClick: _cache[0] || (_cache[0] = (event, option) => emit("option-click", event, __props.message, option)),
|
|
62
|
+
onReplyClick: _cache[1] || (_cache[1] = ($event) => emit("reply-click", __props.message)),
|
|
63
|
+
onContentClick: _cache[2] || (_cache[2] = ($event) => emit("content-click", __props.message)),
|
|
64
|
+
onReactionToggle: _cache[3] || (_cache[3] = ($event) => emit("reaction-toggle", $event, __props.message))
|
|
65
|
+
}, createSlots({ _: 2 }, [
|
|
66
|
+
__props.headerSlot ? {
|
|
67
|
+
name: "header",
|
|
68
|
+
fn: withCtx(() => [
|
|
69
|
+
createVNode(SlotOutlet, {
|
|
70
|
+
render: __props.headerSlot,
|
|
71
|
+
scope: { message: __props.message }
|
|
72
|
+
}, null, 8, ["render", "scope"])
|
|
73
|
+
]),
|
|
74
|
+
key: "0"
|
|
75
|
+
} : void 0
|
|
76
|
+
]), 1032, ["content", "align", "reply", "reactions", "reaction-emojis", "edited", "deleted", "status", "options", "additional-options"])
|
|
77
|
+
], 10, _hoisted_1);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
export {
|
|
82
|
+
_sfc_main as default
|
|
83
|
+
};
|
|
@@ -166,9 +166,15 @@ const enLocale = {
|
|
|
166
166
|
"voicenterUi.message.deleted": "This message was deleted",
|
|
167
167
|
"voicenterUi.message.image": "Photo",
|
|
168
168
|
"voicenterUi.message.audio": "Voice message",
|
|
169
|
+
"voicenterUi.message.video": "Video",
|
|
169
170
|
"voicenterUi.message.react": "React",
|
|
170
171
|
"voicenterUi.message.addReaction": "Add reaction",
|
|
171
172
|
"voicenterUi.message.reactionUsersMore": "and {count} more",
|
|
173
|
+
"voicenterUi.message.status.pending": "Sending",
|
|
174
|
+
"voicenterUi.message.status.sent": "Sent",
|
|
175
|
+
"voicenterUi.message.status.delivered": "Delivered",
|
|
176
|
+
"voicenterUi.message.status.read": "Read",
|
|
177
|
+
"voicenterUi.message.status.failed": "Not sent",
|
|
172
178
|
"voicenterUi.emojiPicker.trigger": "Emoji",
|
|
173
179
|
"voicenterUi.emojiPicker.recent": "Frequently used",
|
|
174
180
|
"voicenterUi.fileItem.uploadFailed": "Upload failed",
|
|
@@ -183,7 +189,8 @@ const enLocale = {
|
|
|
183
189
|
"voicenterUi.chatComposer.dropFiles": "Drop files to attach",
|
|
184
190
|
"voicenterUi.chatComposer.microphoneError": "The microphone is not available",
|
|
185
191
|
"voicenterUi.messagesWrapper.today": "Today",
|
|
186
|
-
"voicenterUi.messagesWrapper.yesterday": "Yesterday"
|
|
192
|
+
"voicenterUi.messagesWrapper.yesterday": "Yesterday",
|
|
193
|
+
"voicenterUi.messagesWrapper.newMessages": "New messages"
|
|
187
194
|
};
|
|
188
195
|
export {
|
|
189
196
|
enLocale as default
|