@uzum-tech/ui 2.2.0 → 2.3.0
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/dist/index.js +1431 -721
- package/dist/index.mjs +1424 -722
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/chat/index.d.ts +2 -0
- package/es/chat/index.mjs +1 -0
- package/es/chat/src/Chat.d.ts +20800 -24
- package/es/chat/src/Chat.mjs +1 -1
- package/es/chat/src/ChatMainArea.d.ts +9749 -0
- package/es/chat/src/{ChatParts/MainArea.mjs → ChatMainArea.mjs} +409 -75
- package/es/chat/src/ChatMessages.d.ts +1 -33
- package/es/chat/src/ChatMessages.mjs +79 -167
- package/es/chat/src/interface.d.ts +16 -12
- package/es/chat/src/interface.mjs +7 -1
- package/es/chat/src/styles/index.cssr.mjs +4 -1
- package/es/components.d.ts +28782 -256
- package/es/components.mjs +6 -1
- package/es/config-provider/src/internal-interface.d.ts +4 -0
- package/es/message-bubble/index.d.ts +3 -0
- package/es/message-bubble/index.mjs +2 -0
- package/es/message-bubble/src/MessageBubble.d.ts +304 -0
- package/es/message-bubble/src/MessageBubble.mjs +336 -0
- package/es/message-bubble/src/interface.d.ts +204 -0
- package/es/message-bubble/src/interface.mjs +92 -0
- package/es/message-bubble/src/styles/index.cssr.d.ts +2 -0
- package/es/message-bubble/src/styles/index.cssr.mjs +133 -0
- package/es/message-bubble/styles/dark.d.ts +29 -0
- package/es/message-bubble/styles/dark.mjs +13 -0
- package/es/message-bubble/styles/index.d.ts +3 -0
- package/es/message-bubble/styles/index.mjs +2 -0
- package/es/message-bubble/styles/light.d.ts +49 -0
- package/es/message-bubble/styles/light.mjs +44 -0
- package/es/pagination/src/Pagination.d.ts +4 -0
- package/es/pagination/src/Pagination.mjs +8 -0
- package/es/pagination/src/interface.d.ts +2 -0
- package/es/pagination/src/interface.mjs +2 -0
- package/es/styles.d.ts +1 -0
- package/es/styles.mjs +1 -0
- package/es/themes/dark.mjs +2 -0
- package/es/themes/light.mjs +2 -0
- package/es/upload/src/Upload.d.ts +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/chat/index.d.ts +2 -0
- package/lib/chat/index.js +3 -1
- package/lib/chat/src/Chat.d.ts +20800 -24
- package/lib/chat/src/Chat.js +2 -2
- package/lib/chat/src/ChatMainArea.d.ts +9749 -0
- package/lib/chat/src/{ChatParts/MainArea.js → ChatMainArea.js} +299 -30
- package/lib/chat/src/ChatMessages.d.ts +1 -33
- package/lib/chat/src/ChatMessages.js +61 -158
- package/lib/chat/src/interface.d.ts +16 -12
- package/lib/chat/src/interface.js +7 -1
- package/lib/chat/src/styles/index.cssr.js +4 -1
- package/lib/components.d.ts +28782 -256
- package/lib/components.js +18 -8
- package/lib/config-provider/src/internal-interface.d.ts +4 -0
- package/lib/message-bubble/index.d.ts +3 -0
- package/lib/message-bubble/index.js +14 -0
- package/lib/message-bubble/src/MessageBubble.d.ts +304 -0
- package/lib/message-bubble/src/MessageBubble.js +276 -0
- package/lib/message-bubble/src/interface.d.ts +204 -0
- package/lib/message-bubble/src/interface.js +80 -0
- package/lib/message-bubble/src/styles/index.cssr.d.ts +2 -0
- package/lib/message-bubble/src/styles/index.cssr.js +138 -0
- package/lib/message-bubble/styles/dark.d.ts +29 -0
- package/lib/message-bubble/styles/dark.js +15 -0
- package/lib/message-bubble/styles/index.d.ts +3 -0
- package/lib/message-bubble/styles/index.js +10 -0
- package/lib/message-bubble/styles/light.d.ts +49 -0
- package/lib/message-bubble/styles/light.js +36 -0
- package/lib/pagination/src/Pagination.d.ts +4 -0
- package/lib/pagination/src/Pagination.js +6 -0
- package/lib/pagination/src/interface.d.ts +2 -0
- package/lib/pagination/src/interface.js +1 -1
- package/lib/styles.d.ts +1 -0
- package/lib/styles.js +84 -82
- package/lib/themes/dark.js +78 -76
- package/lib/themes/light.js +76 -74
- package/lib/upload/src/Upload.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +4 -4
- package/volar.d.ts +2 -0
- package/web-types.json +182 -1
- package/es/chat/src/ChatParts/MainArea.d.ts +0 -20
- package/lib/chat/src/ChatParts/MainArea.d.ts +0 -20
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import { computed, defineComponent,
|
|
2
|
-
import { CheckmarkDoneSharp, MdTime, Refresh } from "../../_internal/icons/index.mjs";
|
|
1
|
+
import { computed, defineComponent, h, inject } from 'vue';
|
|
3
2
|
import { useConfig, useLocale, useTheme, useThemeClass } from "../../_mixins/index.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { UIcon } from "../../icon/index.mjs";
|
|
3
|
+
import { MessageBubbleServiceVariant, MessageBubbleType, UMessageBubble } from "../../message-bubble/index.mjs";
|
|
6
4
|
import { USkeleton } from "../../skeleton/index.mjs";
|
|
7
5
|
import { chatLight } from "../styles/index.mjs";
|
|
8
|
-
import
|
|
9
|
-
import { ChatBubbleActionKey, chatInjectionKey, ChatMarkType, ChatMessageType, MessageStatus } from "./interface.mjs";
|
|
6
|
+
import { ChatBubbleActionKey, chatInjectionKey, ChatMarkType, ChatMessageType, markTypeToServiceVariantMap, MessageStatus } from "./interface.mjs";
|
|
10
7
|
import style from "./styles/index.cssr.mjs";
|
|
11
|
-
const statusIconMapper = {
|
|
12
|
-
[MessageStatus.READ]: CheckmarkDoneSharp,
|
|
13
|
-
[MessageStatus.PENDING]: MdTime,
|
|
14
|
-
[MessageStatus.RETRY]: Refresh,
|
|
15
|
-
[MessageStatus.UNREAD]: CheckmarkDoneSharp
|
|
16
|
-
};
|
|
17
8
|
export const chatMessagesProps = Object.assign(Object.assign({}, useTheme.props), {
|
|
18
9
|
messages: {
|
|
19
10
|
type: Array,
|
|
@@ -79,8 +70,6 @@ export default defineComponent({
|
|
|
79
70
|
const {
|
|
80
71
|
localeRef
|
|
81
72
|
} = useLocale('Chat');
|
|
82
|
-
const contextMenuShow = ref(false);
|
|
83
|
-
const contextMenuMessage = ref();
|
|
84
73
|
const cssVarsRef = computed(() => {
|
|
85
74
|
const {
|
|
86
75
|
common: {
|
|
@@ -163,46 +152,25 @@ export default defineComponent({
|
|
|
163
152
|
var _a;
|
|
164
153
|
(_a = props.onMessageRetry) === null || _a === void 0 ? void 0 : _a.call(props, message);
|
|
165
154
|
};
|
|
166
|
-
const
|
|
155
|
+
const getMessageBubbleActions = message => {
|
|
167
156
|
var _a;
|
|
168
|
-
const message = contextMenuMessage.value;
|
|
169
|
-
if (!message) return;
|
|
170
157
|
const bubbleActions = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.bubbleActionsRef) === null || _a === void 0 ? void 0 : _a.value;
|
|
171
|
-
if (!bubbleActions || bubbleActions
|
|
172
|
-
return
|
|
158
|
+
if (!(bubbleActions === null || bubbleActions === void 0 ? void 0 : bubbleActions.length)) {
|
|
159
|
+
return undefined;
|
|
173
160
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return result;
|
|
186
|
-
});
|
|
187
|
-
const handleContextMenuSelect = key => {
|
|
188
|
-
var _a, _b;
|
|
189
|
-
const message = contextMenuMessage.value;
|
|
190
|
-
if (!message) return;
|
|
191
|
-
if (key === ChatBubbleActionKey.EDIT) {
|
|
192
|
-
const startEditing = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.startEditingMessage) === null || _a === void 0 ? void 0 : _a.value;
|
|
193
|
-
if (startEditing) {
|
|
194
|
-
startEditing(message);
|
|
161
|
+
return bubbleActions.filter(action => !action.visible || action.visible(message)).map(action => ({
|
|
162
|
+
key: String(action.key),
|
|
163
|
+
label: action.label,
|
|
164
|
+
handler: () => {
|
|
165
|
+
var _a;
|
|
166
|
+
if (action.key === ChatBubbleActionKey.EDIT) {
|
|
167
|
+
const startEditing = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.startEditingMessage) === null || _a === void 0 ? void 0 : _a.value;
|
|
168
|
+
startEditing === null || startEditing === void 0 ? void 0 : startEditing(message);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
action.handler(message);
|
|
195
172
|
}
|
|
196
|
-
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const bubbleActions = (_b = UChat === null || UChat === void 0 ? void 0 : UChat.bubbleActionsRef) === null || _b === void 0 ? void 0 : _b.value;
|
|
200
|
-
if (!bubbleActions) return;
|
|
201
|
-
const action = bubbleActions.find(action => action.key === key);
|
|
202
|
-
if (action) {
|
|
203
|
-
action.handler(message);
|
|
204
|
-
}
|
|
205
|
-
contextMenuShow.value = false;
|
|
173
|
+
}));
|
|
206
174
|
};
|
|
207
175
|
const renderDateSeparator = date => {
|
|
208
176
|
return h("div", {
|
|
@@ -212,119 +180,75 @@ export default defineComponent({
|
|
|
212
180
|
const renderUnreadNotification = () => {
|
|
213
181
|
var _a;
|
|
214
182
|
const count = (_a = props.unreadNotificationCount) !== null && _a !== void 0 ? _a : unreadMessagesCount.value;
|
|
215
|
-
return h(
|
|
216
|
-
|
|
217
|
-
|
|
183
|
+
return h(UMessageBubble, {
|
|
184
|
+
type: MessageBubbleType.SERVICE,
|
|
185
|
+
serviceVariant: MessageBubbleServiceVariant.UNREAD,
|
|
186
|
+
content: `${count} ${mergedUnreadNotificationTextRef.value}`
|
|
187
|
+
});
|
|
218
188
|
};
|
|
219
189
|
const renderMarkMessage = message => {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
190
|
+
var _a;
|
|
191
|
+
const serviceVariant = markTypeToServiceVariantMap[(_a = message.markType) !== null && _a !== void 0 ? _a : ChatMarkType.DIVIDER];
|
|
192
|
+
return h(UMessageBubble, {
|
|
193
|
+
key: String(message.id),
|
|
194
|
+
type: MessageBubbleType.SERVICE,
|
|
195
|
+
serviceVariant: serviceVariant,
|
|
196
|
+
content: message.content
|
|
197
|
+
});
|
|
225
198
|
};
|
|
226
199
|
const renderMessage = message => {
|
|
227
|
-
var _a, _b, _c;
|
|
228
|
-
const isOwn = message.isOwn;
|
|
229
200
|
const attachments = message.attachment ? Array.isArray(message.attachment) ? message.attachment : [message.attachment] : [];
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
201
|
+
const messageBubbleAttachments = attachments.map(attachment => ({
|
|
202
|
+
id: attachment.id,
|
|
203
|
+
name: attachment.name,
|
|
204
|
+
url: attachment.url,
|
|
205
|
+
size: attachment.size,
|
|
206
|
+
thumbnail: typeof attachment.thumbnail === 'string' ? attachment.thumbnail : undefined,
|
|
207
|
+
preview: typeof attachment.preview === 'string' ? attachment.preview : undefined,
|
|
208
|
+
status: attachment.status ? String(attachment.status) : undefined,
|
|
209
|
+
percentage: attachment.percentage,
|
|
210
|
+
type: attachment.type
|
|
211
|
+
}));
|
|
212
|
+
const handleMessageBubbleRetry = () => {
|
|
213
|
+
handleMessageRetry(message);
|
|
214
|
+
};
|
|
215
|
+
const handleMessageBubbleAttachmentDownload = attachment => {
|
|
216
|
+
var _a;
|
|
217
|
+
const originalAttachment = attachments.find(item => String(item.id) === String(attachment.id));
|
|
218
|
+
if (originalAttachment && ((_a = UChat === null || UChat === void 0 ? void 0 : UChat.onAttachmentDownload) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
219
|
+
return UChat.onAttachmentDownload.value(originalAttachment);
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
return h(UMessageBubble, {
|
|
223
|
+
key: String(message.id),
|
|
224
|
+
type: MessageBubbleType.MESSAGE,
|
|
225
|
+
isOwn: Boolean(message.isOwn),
|
|
226
|
+
content: message.content,
|
|
227
|
+
timestamp: message.timestamp,
|
|
228
|
+
title: message.title,
|
|
229
|
+
status: message.status,
|
|
230
|
+
attachments: messageBubbleAttachments,
|
|
238
231
|
uploadProps: props.uploadProps,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
'upload-file-subtitle': slots.messageAttachmentSubtitle
|
|
244
|
-
}), message.content && h("div", {
|
|
245
|
-
class: `${mergedClsPrefixRef.value}-chat-main__message-text`
|
|
246
|
-
}, message.content)) : attachments.length === 1 ? h(ChatAttachmentComponent, {
|
|
247
|
-
message: message,
|
|
248
|
-
attachments: attachments,
|
|
249
|
-
uploadProps: props.uploadProps
|
|
232
|
+
retryText: mergedRetryTextRef.value,
|
|
233
|
+
actions: getMessageBubbleActions(message),
|
|
234
|
+
onRetry: handleMessageBubbleRetry,
|
|
235
|
+
onAttachmentDownload: handleMessageBubbleAttachmentDownload
|
|
250
236
|
}, {
|
|
251
|
-
|
|
252
|
-
'upload-file-title': slots.messageAttachmentTitle,
|
|
253
|
-
'upload-file-subtitle': slots.messageAttachmentSubtitle
|
|
254
|
-
}) : null;
|
|
255
|
-
const messageContent = h("div", {
|
|
256
|
-
key: message.id,
|
|
257
|
-
class: [`${mergedClsPrefixRef.value}-chat-main__message`, isOwn ? `${mergedClsPrefixRef.value}-chat-main__message--own` : `${mergedClsPrefixRef.value}-chat-main__message--other`]
|
|
258
|
-
}, h("div", {
|
|
259
|
-
class: [`${mergedClsPrefixRef.value}-chat-main__message-wrapper`, isOwn ? `${mergedClsPrefixRef.value}-chat-main__message-wrapper--own` : `${mergedClsPrefixRef.value}-chat-main__message-wrapper--other`]
|
|
260
|
-
}, hasBubbleActionsSlot ? h("div", {
|
|
261
|
-
onContextmenu: e => {
|
|
262
|
-
e.preventDefault();
|
|
263
|
-
contextMenuShow.value = false;
|
|
264
|
-
void nextTick().then(() => {
|
|
265
|
-
contextMenuShow.value = true;
|
|
266
|
-
contextMenuMessage.value = message;
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
}, (_c = slots.bubbleActions) === null || _c === void 0 ? void 0 : _c.call(slots, message), messageBubbleContent) : hasBubbleActionsConfig ? h(UDropdown, {
|
|
270
|
-
show: isContextMenuForThisMessage,
|
|
271
|
-
onUpdateShow: show => {
|
|
237
|
+
bubbleActions: slots.bubbleActions ? () => {
|
|
272
238
|
var _a;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
},
|
|
277
|
-
onClickoutside: () => {
|
|
239
|
+
return (_a = slots.bubbleActions) === null || _a === void 0 ? void 0 : _a.call(slots, message);
|
|
240
|
+
} : undefined,
|
|
241
|
+
messageStatus: slots.messageStatus ? () => {
|
|
278
242
|
var _a;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
288
|
-
default: () => h("div", {
|
|
289
|
-
onContextmenu: event => {
|
|
290
|
-
event.preventDefault();
|
|
291
|
-
contextMenuShow.value = false;
|
|
292
|
-
void nextTick().then(() => {
|
|
293
|
-
contextMenuShow.value = true;
|
|
294
|
-
contextMenuMessage.value = message;
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
}, messageBubbleContent)
|
|
298
|
-
}) : messageBubbleContent, h("div", {
|
|
299
|
-
class: [`${mergedClsPrefixRef.value}-chat-main__message-meta`, isOwn ? `${mergedClsPrefixRef.value}-chat-main__message-meta--own` : `${mergedClsPrefixRef.value}-chat-main__message-meta--other`, message.status === MessageStatus.RETRY && `${mergedClsPrefixRef.value}-chat-main__message-meta--retry`]
|
|
300
|
-
}, message.status === MessageStatus.RETRY ? h("div", {
|
|
301
|
-
class: `${mergedClsPrefixRef.value}-chat-main__message-retry`,
|
|
302
|
-
onClick: () => {
|
|
303
|
-
handleMessageRetry(message);
|
|
304
|
-
},
|
|
305
|
-
style: {
|
|
306
|
-
cursor: 'pointer'
|
|
307
|
-
}
|
|
308
|
-
}, h(UIcon, {
|
|
309
|
-
size: 16,
|
|
310
|
-
component: statusIconMapper[MessageStatus.RETRY],
|
|
311
|
-
class: `${mergedClsPrefixRef.value}-chat-main__message-retry-icon`,
|
|
312
|
-
theme: themeRef.value.peers.StatusIcon,
|
|
313
|
-
themeOverrides: themeRef.value.peerOverrides.StatusIcon
|
|
314
|
-
}), h("span", {
|
|
315
|
-
class: `${mergedClsPrefixRef.value}-chat-main__message-retry-text`
|
|
316
|
-
}, mergedRetryTextRef.value)) : h(Fragment, null, h("span", {
|
|
317
|
-
class: `${mergedClsPrefixRef.value}-chat-main__message-time`
|
|
318
|
-
}, message.timestamp), isOwn && message.status && h("div", {
|
|
319
|
-
class: `${mergedClsPrefixRef.value}-chat-main__message-status`
|
|
320
|
-
}, slots.messageStatus ? slots.messageStatus(message) : statusIconMapper[message.status] && h(UIcon, {
|
|
321
|
-
size: 16,
|
|
322
|
-
component: statusIconMapper[message.status],
|
|
323
|
-
class: [`${mergedClsPrefixRef.value}-chat-main__message-status-icon`, `${mergedClsPrefixRef.value}-chat-main__message-status-icon--${String(message.status)}`],
|
|
324
|
-
theme: themeRef.value.peers.StatusIcon,
|
|
325
|
-
themeOverrides: themeRef.value.peerOverrides.StatusIcon
|
|
326
|
-
}))))));
|
|
327
|
-
return messageContent;
|
|
243
|
+
return (_a = slots.messageStatus) === null || _a === void 0 ? void 0 : _a.call(slots, message);
|
|
244
|
+
} : undefined,
|
|
245
|
+
messageAttachment: slots.messageAttachment ? () => {
|
|
246
|
+
var _a;
|
|
247
|
+
return (_a = slots.messageAttachment) === null || _a === void 0 ? void 0 : _a.call(slots, message);
|
|
248
|
+
} : undefined,
|
|
249
|
+
'upload-file-title': slots.messageAttachmentTitle,
|
|
250
|
+
'upload-file-subtitle': slots.messageAttachmentSubtitle
|
|
251
|
+
});
|
|
328
252
|
};
|
|
329
253
|
const renderSkeletonMessage = (isOwn, index) => {
|
|
330
254
|
return h("div", {
|
|
@@ -359,10 +283,6 @@ export default defineComponent({
|
|
|
359
283
|
renderSkeletonMessage,
|
|
360
284
|
renderDateSeparator,
|
|
361
285
|
renderUnreadNotification,
|
|
362
|
-
contextMenuShow,
|
|
363
|
-
contextMenuMessage,
|
|
364
|
-
messageContextMenuOptions,
|
|
365
|
-
handleContextMenuSelect,
|
|
366
286
|
cssVars: cssVarsRef,
|
|
367
287
|
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
368
288
|
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
@@ -458,15 +378,7 @@ export default defineComponent({
|
|
|
458
378
|
background: 'transparent'
|
|
459
379
|
}
|
|
460
380
|
}, h("div", {
|
|
461
|
-
class: `${mergedClsPrefixRef}-chat-main__messages-container
|
|
462
|
-
onContextmenu: event => {
|
|
463
|
-
const target = event.target;
|
|
464
|
-
const messagesContainer = event.currentTarget;
|
|
465
|
-
if (target === messagesContainer) {
|
|
466
|
-
event.preventDefault();
|
|
467
|
-
this.contextMenuShow = false;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
381
|
+
class: `${mergedClsPrefixRef}-chat-main__messages-container`
|
|
470
382
|
}, messagesWithDates.map(item => {
|
|
471
383
|
var _a;
|
|
472
384
|
if (item.type === 'date-separator') {
|
|
@@ -9,6 +9,7 @@ import type { InputProps } from '../../input';
|
|
|
9
9
|
import type { UploadProps } from '../../upload';
|
|
10
10
|
import type { OnChangePayload } from '../../upload/src/interface';
|
|
11
11
|
import type { ChatTheme } from '../styles';
|
|
12
|
+
import { MessageBubbleServiceVariant } from '../../message-bubble';
|
|
12
13
|
export declare enum MessageStatus {
|
|
13
14
|
READ = "read",
|
|
14
15
|
UNREAD = "unread",
|
|
@@ -84,6 +85,7 @@ export interface ChatMessageData {
|
|
|
84
85
|
senderAvatar?: string | (() => VNodeChild);
|
|
85
86
|
senderName?: string | (() => VNodeChild);
|
|
86
87
|
markType?: ChatMarkType;
|
|
88
|
+
title?: string | (() => VNodeChild);
|
|
87
89
|
}
|
|
88
90
|
export interface ChatMessageProps {
|
|
89
91
|
id: ChatId;
|
|
@@ -97,6 +99,7 @@ export interface ChatMessageProps {
|
|
|
97
99
|
senderAvatar?: string | (() => VNodeChild);
|
|
98
100
|
senderName?: string | (() => VNodeChild);
|
|
99
101
|
disabled?: boolean;
|
|
102
|
+
title?: string | (() => VNodeChild);
|
|
100
103
|
}
|
|
101
104
|
export interface ChatListItemProps {
|
|
102
105
|
id: ChatId;
|
|
@@ -245,6 +248,18 @@ export interface ChatFooterProps {
|
|
|
245
248
|
actions?: Array<() => VNodeChild>;
|
|
246
249
|
inputProps?: Partial<InputProps>;
|
|
247
250
|
}
|
|
251
|
+
export interface ChatInst {
|
|
252
|
+
scrollToBottom: () => void;
|
|
253
|
+
scrollToMessage: (key: ChatId) => void;
|
|
254
|
+
sendMessage: (content: string, attachments?: ChatAttachment[]) => void;
|
|
255
|
+
}
|
|
256
|
+
export interface ChatListInst {
|
|
257
|
+
selectChat: (key: ChatId) => void;
|
|
258
|
+
updateItem: (key: ChatId, item: Partial<ChatListItemData>) => void;
|
|
259
|
+
addItem: (item: ChatListItemData) => void;
|
|
260
|
+
removeItem: (key: ChatId) => void;
|
|
261
|
+
}
|
|
262
|
+
export type HandleOnChangeType = ((data: OnChangePayload) => void) | undefined;
|
|
248
263
|
export type OnChatSelect = (key: ChatId, item: ChatListItemData) => void;
|
|
249
264
|
export type OnMessageSend = (content: string, attachments?: ChatAttachment[]) => void;
|
|
250
265
|
export type OnAttachmentUpload = (file: File) => Promise<ChatAttachment>;
|
|
@@ -265,17 +280,6 @@ export type OnSendError = (error: {
|
|
|
265
280
|
message: string;
|
|
266
281
|
content: string;
|
|
267
282
|
}) => void;
|
|
268
|
-
export interface ChatInst {
|
|
269
|
-
scrollToBottom: () => void;
|
|
270
|
-
scrollToMessage: (key: ChatId) => void;
|
|
271
|
-
sendMessage: (content: string, attachments?: ChatAttachment[]) => void;
|
|
272
|
-
}
|
|
273
|
-
export interface ChatListInst {
|
|
274
|
-
selectChat: (key: ChatId) => void;
|
|
275
|
-
updateItem: (key: ChatId, item: Partial<ChatListItemData>) => void;
|
|
276
|
-
addItem: (item: ChatListItemData) => void;
|
|
277
|
-
removeItem: (key: ChatId) => void;
|
|
278
|
-
}
|
|
279
283
|
export declare const chatInjectionKey: InjectionKey<{
|
|
280
284
|
mergedClsPrefixRef: Ref<string>;
|
|
281
285
|
mergedThemeRef: Ref<MergedTheme<ChatTheme>>;
|
|
@@ -354,4 +358,4 @@ export declare const chatInjectionKey: InjectionKey<{
|
|
|
354
358
|
headerShareIconPropsRef: Ref<Partial<IconProps> | undefined>;
|
|
355
359
|
headerProfileIconPropsRef: Ref<Partial<IconProps> | undefined>;
|
|
356
360
|
}>;
|
|
357
|
-
export
|
|
361
|
+
export declare const markTypeToServiceVariantMap: Record<ChatMarkType, MessageBubbleServiceVariant>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createInjectionKey } from "../../_utils/index.mjs";
|
|
2
|
+
import { MessageBubbleServiceVariant } from "../../message-bubble/index.mjs";
|
|
2
3
|
export var MessageStatus;
|
|
3
4
|
(function (MessageStatus) {
|
|
4
5
|
MessageStatus["READ"] = "read";
|
|
@@ -32,4 +33,9 @@ export var ChatBubbleActionKey;
|
|
|
32
33
|
ChatBubbleActionKey["COPY"] = "copy";
|
|
33
34
|
ChatBubbleActionKey["DELETE"] = "delete";
|
|
34
35
|
})(ChatBubbleActionKey || (ChatBubbleActionKey = {}));
|
|
35
|
-
export const chatInjectionKey = createInjectionKey('chat');
|
|
36
|
+
export const chatInjectionKey = createInjectionKey('chat');
|
|
37
|
+
export const markTypeToServiceVariantMap = {
|
|
38
|
+
[ChatMarkType.SYSTEM]: MessageBubbleServiceVariant.SYSTEM,
|
|
39
|
+
[ChatMarkType.EVENT]: MessageBubbleServiceVariant.EVENT,
|
|
40
|
+
[ChatMarkType.DIVIDER]: MessageBubbleServiceVariant.DIVIDER
|
|
41
|
+
};
|
|
@@ -129,7 +129,10 @@ export default cB('chat', `
|
|
|
129
129
|
height: 100%;
|
|
130
130
|
max-height: 100%;
|
|
131
131
|
min-height: 0;
|
|
132
|
-
`, [
|
|
132
|
+
`, [cM('standalone', `
|
|
133
|
+
border: none;
|
|
134
|
+
border-radius: 0;
|
|
135
|
+
`), cE('header', `
|
|
133
136
|
border-bottom: 1px solid var(--u-border-color);
|
|
134
137
|
width: 100%;
|
|
135
138
|
padding: 24px 20px 10px 24px;
|