@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
|
@@ -5,21 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.chatMessagesProps = void 0;
|
|
7
7
|
const vue_1 = require("vue");
|
|
8
|
-
const icons_1 = require("../../_internal/icons");
|
|
9
8
|
const _mixins_1 = require("../../_mixins");
|
|
10
|
-
const
|
|
11
|
-
const icon_1 = require("../../icon");
|
|
9
|
+
const message_bubble_1 = require("../../message-bubble");
|
|
12
10
|
const skeleton_1 = require("../../skeleton");
|
|
13
11
|
const styles_1 = require("../styles");
|
|
14
|
-
const ChatAttachment_1 = __importDefault(require("./ChatParts/ChatAttachment"));
|
|
15
12
|
const interface_1 = require("./interface");
|
|
16
13
|
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
17
|
-
const statusIconMapper = {
|
|
18
|
-
[interface_1.MessageStatus.READ]: icons_1.CheckmarkDoneSharp,
|
|
19
|
-
[interface_1.MessageStatus.PENDING]: icons_1.MdTime,
|
|
20
|
-
[interface_1.MessageStatus.RETRY]: icons_1.Refresh,
|
|
21
|
-
[interface_1.MessageStatus.UNREAD]: icons_1.CheckmarkDoneSharp
|
|
22
|
-
};
|
|
23
14
|
exports.chatMessagesProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { messages: {
|
|
24
15
|
type: Array,
|
|
25
16
|
default: () => []
|
|
@@ -66,8 +57,6 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
66
57
|
const { mergedClsPrefixRef } = (0, _mixins_1.useConfig)(props);
|
|
67
58
|
const themeRef = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.mergedThemeRef) !== null && _a !== void 0 ? _a : (0, _mixins_1.useTheme)('Chat', '-chat', index_cssr_1.default, styles_1.chatLight, props, mergedClsPrefixRef);
|
|
68
59
|
const { localeRef } = (0, _mixins_1.useLocale)('Chat');
|
|
69
|
-
const contextMenuShow = (0, vue_1.ref)(false);
|
|
70
|
-
const contextMenuMessage = (0, vue_1.ref)();
|
|
71
60
|
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
72
61
|
const { common: { cubicBezierEaseInOut, brandPrimary500, staticGreen, staticRed, textPrimary, textSecondary, textTertiary }, self: { backgroundColor, borderColor, mainBackgroundColor, headerBackgroundColor, headerBorderColor, headerTitleColor, messageBubbleBackgroundColorOwn, messageBubbleBackgroundColorOther, messageBubbleTextColorOwn, messageBubbleTextColorOther, messageTimeColor, messageStatusColor, attachmentBackgroundColorOwn, attachmentBackgroundColorOther, unreadNotificationBackgroundColor, unreadNotificationTextColor, typingIndicatorColor, dateSeparatorColor, dateSeparatorBackgroundColor, borderRadius, errorColor } } = themeRef.value;
|
|
73
62
|
return {
|
|
@@ -112,49 +101,27 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
112
101
|
var _a;
|
|
113
102
|
(_a = props.onMessageRetry) === null || _a === void 0 ? void 0 : _a.call(props, message);
|
|
114
103
|
};
|
|
115
|
-
const
|
|
104
|
+
const getMessageBubbleActions = (message) => {
|
|
116
105
|
var _a;
|
|
117
|
-
const message = contextMenuMessage.value;
|
|
118
|
-
if (!message)
|
|
119
|
-
return;
|
|
120
106
|
const bubbleActions = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.bubbleActionsRef) === null || _a === void 0 ? void 0 : _a.value;
|
|
121
|
-
if (!bubbleActions || bubbleActions
|
|
122
|
-
return
|
|
123
|
-
}
|
|
124
|
-
const result = [];
|
|
125
|
-
for (const action of bubbleActions) {
|
|
126
|
-
if (action.visible && !action.visible(message)) {
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
const label = typeof action.label === 'function' ? action.label() : action.label;
|
|
130
|
-
result.push({
|
|
131
|
-
label,
|
|
132
|
-
key: String(action.key)
|
|
133
|
-
});
|
|
107
|
+
if (!(bubbleActions === null || bubbleActions === void 0 ? void 0 : bubbleActions.length)) {
|
|
108
|
+
return undefined;
|
|
134
109
|
}
|
|
135
|
-
return
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
110
|
+
return bubbleActions
|
|
111
|
+
.filter(action => !action.visible || action.visible(message))
|
|
112
|
+
.map((action) => ({
|
|
113
|
+
key: String(action.key),
|
|
114
|
+
label: action.label,
|
|
115
|
+
handler: () => {
|
|
116
|
+
var _a;
|
|
117
|
+
if (action.key === interface_1.ChatBubbleActionKey.EDIT) {
|
|
118
|
+
const startEditing = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.startEditingMessage) === null || _a === void 0 ? void 0 : _a.value;
|
|
119
|
+
startEditing === null || startEditing === void 0 ? void 0 : startEditing(message);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
action.handler(message);
|
|
146
123
|
}
|
|
147
|
-
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const bubbleActions = (_b = UChat === null || UChat === void 0 ? void 0 : UChat.bubbleActionsRef) === null || _b === void 0 ? void 0 : _b.value;
|
|
151
|
-
if (!bubbleActions)
|
|
152
|
-
return;
|
|
153
|
-
const action = bubbleActions.find((action) => action.key === key);
|
|
154
|
-
if (action) {
|
|
155
|
-
action.handler(message);
|
|
156
|
-
}
|
|
157
|
-
contextMenuShow.value = false;
|
|
124
|
+
}));
|
|
158
125
|
};
|
|
159
126
|
const renderDateSeparator = (date) => {
|
|
160
127
|
return ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-main__date-separator` },
|
|
@@ -163,112 +130,59 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
163
130
|
const renderUnreadNotification = () => {
|
|
164
131
|
var _a;
|
|
165
132
|
const count = (_a = props.unreadNotificationCount) !== null && _a !== void 0 ? _a : unreadMessagesCount.value;
|
|
166
|
-
return ((0, vue_1.h)(
|
|
167
|
-
(0, vue_1.h)("span", null,
|
|
168
|
-
count,
|
|
169
|
-
' ',
|
|
170
|
-
mergedUnreadNotificationTextRef.value)));
|
|
133
|
+
return ((0, vue_1.h)(message_bubble_1.UMessageBubble, { type: message_bubble_1.MessageBubbleType.SERVICE, serviceVariant: message_bubble_1.MessageBubbleServiceVariant.UNREAD, content: `${count} ${mergedUnreadNotificationTextRef.value}` }));
|
|
171
134
|
};
|
|
172
135
|
const renderMarkMessage = (message) => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
? 'event'
|
|
177
|
-
: 'divider';
|
|
178
|
-
return ((0, vue_1.h)("div", { key: message.id, class: [
|
|
179
|
-
`${mergedClsPrefixRef.value}-chat-main__mark`,
|
|
180
|
-
`${mergedClsPrefixRef.value}-chat-main__mark--${markTypeClass}`
|
|
181
|
-
] }, message.content && (0, vue_1.h)("span", null, message.content)));
|
|
136
|
+
var _a;
|
|
137
|
+
const serviceVariant = interface_1.markTypeToServiceVariantMap[(_a = message.markType) !== null && _a !== void 0 ? _a : interface_1.ChatMarkType.DIVIDER];
|
|
138
|
+
return ((0, vue_1.h)(message_bubble_1.UMessageBubble, { key: String(message.id), type: message_bubble_1.MessageBubbleType.SERVICE, serviceVariant: serviceVariant, content: message.content }));
|
|
182
139
|
};
|
|
183
140
|
const renderMessage = (message) => {
|
|
184
|
-
var _a, _b, _c;
|
|
185
|
-
const isOwn = message.isOwn;
|
|
186
141
|
const attachments = message.attachment
|
|
187
142
|
? Array.isArray(message.attachment)
|
|
188
143
|
? message.attachment
|
|
189
144
|
: [message.attachment]
|
|
190
145
|
: [];
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
146
|
+
const messageBubbleAttachments = attachments.map(attachment => ({
|
|
147
|
+
id: attachment.id,
|
|
148
|
+
name: attachment.name,
|
|
149
|
+
url: attachment.url,
|
|
150
|
+
size: attachment.size,
|
|
151
|
+
thumbnail: typeof attachment.thumbnail === 'string'
|
|
152
|
+
? attachment.thumbnail
|
|
153
|
+
: undefined,
|
|
154
|
+
preview: typeof attachment.preview === 'string'
|
|
155
|
+
? attachment.preview
|
|
156
|
+
: undefined,
|
|
157
|
+
status: attachment.status
|
|
158
|
+
? String(attachment.status)
|
|
159
|
+
: undefined,
|
|
160
|
+
percentage: attachment.percentage,
|
|
161
|
+
type: attachment.type
|
|
162
|
+
}));
|
|
163
|
+
const handleMessageBubbleRetry = () => {
|
|
164
|
+
handleMessageRetry(message);
|
|
165
|
+
};
|
|
166
|
+
const handleMessageBubbleAttachmentDownload = (attachment) => {
|
|
167
|
+
var _a;
|
|
168
|
+
const originalAttachment = attachments.find(item => String(item.id) === String(attachment.id));
|
|
169
|
+
if (originalAttachment && ((_a = UChat === null || UChat === void 0 ? void 0 : UChat.onAttachmentDownload) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
170
|
+
return UChat.onAttachmentDownload.value(originalAttachment);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
return ((0, vue_1.h)(message_bubble_1.UMessageBubble, { key: String(message.id), type: message_bubble_1.MessageBubbleType.MESSAGE, isOwn: Boolean(message.isOwn), content: message.content, timestamp: message.timestamp, title: message.title, status: message.status, attachments: messageBubbleAttachments, uploadProps: props.uploadProps, retryText: mergedRetryTextRef.value, actions: getMessageBubbleActions(message), onRetry: handleMessageBubbleRetry, onAttachmentDownload: handleMessageBubbleAttachmentDownload }, {
|
|
174
|
+
bubbleActions: slots.bubbleActions
|
|
175
|
+
? () => { var _a; return (_a = slots.bubbleActions) === null || _a === void 0 ? void 0 : _a.call(slots, message); }
|
|
176
|
+
: undefined,
|
|
177
|
+
messageStatus: slots.messageStatus
|
|
178
|
+
? () => { var _a; return (_a = slots.messageStatus) === null || _a === void 0 ? void 0 : _a.call(slots, message); }
|
|
179
|
+
: undefined,
|
|
180
|
+
messageAttachment: slots.messageAttachment
|
|
181
|
+
? () => { var _a; return (_a = slots.messageAttachment) === null || _a === void 0 ? void 0 : _a.call(slots, message); }
|
|
182
|
+
: undefined,
|
|
208
183
|
'upload-file-title': slots.messageAttachmentTitle,
|
|
209
184
|
'upload-file-subtitle': slots.messageAttachmentSubtitle
|
|
210
|
-
}))
|
|
211
|
-
const messageContent = ((0, vue_1.h)("div", { key: message.id, class: [
|
|
212
|
-
`${mergedClsPrefixRef.value}-chat-main__message`,
|
|
213
|
-
isOwn
|
|
214
|
-
? `${mergedClsPrefixRef.value}-chat-main__message--own`
|
|
215
|
-
: `${mergedClsPrefixRef.value}-chat-main__message--other`
|
|
216
|
-
] },
|
|
217
|
-
(0, vue_1.h)("div", { class: [
|
|
218
|
-
`${mergedClsPrefixRef.value}-chat-main__message-wrapper`,
|
|
219
|
-
isOwn
|
|
220
|
-
? `${mergedClsPrefixRef.value}-chat-main__message-wrapper--own`
|
|
221
|
-
: `${mergedClsPrefixRef.value}-chat-main__message-wrapper--other`
|
|
222
|
-
] },
|
|
223
|
-
hasBubbleActionsSlot ? ((0, vue_1.h)("div", { onContextmenu: (e) => {
|
|
224
|
-
e.preventDefault();
|
|
225
|
-
contextMenuShow.value = false;
|
|
226
|
-
void (0, vue_1.nextTick)().then(() => {
|
|
227
|
-
contextMenuShow.value = true;
|
|
228
|
-
contextMenuMessage.value = message;
|
|
229
|
-
});
|
|
230
|
-
} }, (_c = slots.bubbleActions) === null || _c === void 0 ? void 0 :
|
|
231
|
-
_c.call(slots, message),
|
|
232
|
-
messageBubbleContent)) : hasBubbleActionsConfig ? ((0, vue_1.h)(dropdown_1.UDropdown, { show: isContextMenuForThisMessage, onUpdateShow: (show) => {
|
|
233
|
-
var _a;
|
|
234
|
-
if (!show && ((_a = contextMenuMessage.value) === null || _a === void 0 ? void 0 : _a.id) === message.id) {
|
|
235
|
-
contextMenuShow.value = false;
|
|
236
|
-
}
|
|
237
|
-
}, onClickoutside: () => {
|
|
238
|
-
var _a;
|
|
239
|
-
if (((_a = contextMenuMessage.value) === null || _a === void 0 ? void 0 : _a.id) === message.id) {
|
|
240
|
-
contextMenuShow.value = false;
|
|
241
|
-
}
|
|
242
|
-
}, trigger: "manual", placement: "bottom-start", options: messageContextMenuOptions.value, onSelect: handleContextMenuSelect }, {
|
|
243
|
-
default: () => ((0, vue_1.h)("div", { onContextmenu: (event) => {
|
|
244
|
-
event.preventDefault();
|
|
245
|
-
contextMenuShow.value = false;
|
|
246
|
-
void (0, vue_1.nextTick)().then(() => {
|
|
247
|
-
contextMenuShow.value = true;
|
|
248
|
-
contextMenuMessage.value = message;
|
|
249
|
-
});
|
|
250
|
-
} }, messageBubbleContent))
|
|
251
|
-
})) : (messageBubbleContent),
|
|
252
|
-
(0, vue_1.h)("div", { class: [
|
|
253
|
-
`${mergedClsPrefixRef.value}-chat-main__message-meta`,
|
|
254
|
-
isOwn
|
|
255
|
-
? `${mergedClsPrefixRef.value}-chat-main__message-meta--own`
|
|
256
|
-
: `${mergedClsPrefixRef.value}-chat-main__message-meta--other`,
|
|
257
|
-
message.status === interface_1.MessageStatus.RETRY
|
|
258
|
-
&& `${mergedClsPrefixRef.value}-chat-main__message-meta--retry`
|
|
259
|
-
] }, message.status === interface_1.MessageStatus.RETRY ? ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-main__message-retry`, onClick: () => {
|
|
260
|
-
handleMessageRetry(message);
|
|
261
|
-
}, style: { cursor: 'pointer' } },
|
|
262
|
-
(0, vue_1.h)(icon_1.UIcon, { size: 16, component: statusIconMapper[interface_1.MessageStatus.RETRY], class: `${mergedClsPrefixRef.value}-chat-main__message-retry-icon`, theme: themeRef.value.peers.StatusIcon, themeOverrides: themeRef.value.peerOverrides.StatusIcon }),
|
|
263
|
-
(0, vue_1.h)("span", { class: `${mergedClsPrefixRef.value}-chat-main__message-retry-text` }, mergedRetryTextRef.value))) : ((0, vue_1.h)(vue_1.Fragment, null,
|
|
264
|
-
(0, vue_1.h)("span", { class: `${mergedClsPrefixRef.value}-chat-main__message-time` }, message.timestamp),
|
|
265
|
-
isOwn && message.status && ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-main__message-status` }, slots.messageStatus
|
|
266
|
-
? slots.messageStatus(message)
|
|
267
|
-
: statusIconMapper[message.status] && ((0, vue_1.h)(icon_1.UIcon, { size: 16, component: statusIconMapper[message.status], class: [
|
|
268
|
-
`${mergedClsPrefixRef.value}-chat-main__message-status-icon`,
|
|
269
|
-
`${mergedClsPrefixRef.value}-chat-main__message-status-icon--${String(message.status)}`
|
|
270
|
-
], theme: themeRef.value.peers.StatusIcon, themeOverrides: themeRef.value.peerOverrides.StatusIcon }))))))))));
|
|
271
|
-
return messageContent;
|
|
185
|
+
}));
|
|
272
186
|
};
|
|
273
187
|
const renderSkeletonMessage = (isOwn, index) => {
|
|
274
188
|
return ((0, vue_1.h)("div", { key: `skeleton-${index}`, class: [
|
|
@@ -302,10 +216,6 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
302
216
|
renderSkeletonMessage,
|
|
303
217
|
renderDateSeparator,
|
|
304
218
|
renderUnreadNotification,
|
|
305
|
-
contextMenuShow,
|
|
306
|
-
contextMenuMessage,
|
|
307
|
-
messageContextMenuOptions,
|
|
308
|
-
handleContextMenuSelect,
|
|
309
219
|
cssVars: cssVarsRef,
|
|
310
220
|
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
311
221
|
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
@@ -382,14 +292,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
382
292
|
padding: '0',
|
|
383
293
|
background: 'transparent'
|
|
384
294
|
} },
|
|
385
|
-
(0, vue_1.h)("div", { class: `${mergedClsPrefixRef}-chat-main__messages-container
|
|
386
|
-
const target = event.target;
|
|
387
|
-
const messagesContainer = event.currentTarget;
|
|
388
|
-
if (target === messagesContainer) {
|
|
389
|
-
event.preventDefault();
|
|
390
|
-
this.contextMenuShow = false;
|
|
391
|
-
}
|
|
392
|
-
} }, messagesWithDates.map((item) => {
|
|
295
|
+
(0, vue_1.h)("div", { class: `${mergedClsPrefixRef}-chat-main__messages-container` }, messagesWithDates.map((item) => {
|
|
393
296
|
var _a;
|
|
394
297
|
if (item.type === 'date-separator') {
|
|
395
298
|
return renderDateSeparator((_a = item.date) !== null && _a !== void 0 ? _a : '');
|
|
@@ -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,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.chatInjectionKey = exports.ChatBubbleActionKey = exports.ChatMarkType = exports.ChatAttachmentStatus = exports.ChatMessageType = exports.MessageStatus = void 0;
|
|
3
|
+
exports.markTypeToServiceVariantMap = exports.chatInjectionKey = exports.ChatBubbleActionKey = exports.ChatMarkType = exports.ChatAttachmentStatus = exports.ChatMessageType = exports.MessageStatus = void 0;
|
|
4
4
|
const _utils_1 = require("../../_utils");
|
|
5
|
+
const message_bubble_1 = require("../../message-bubble");
|
|
5
6
|
var MessageStatus;
|
|
6
7
|
(function (MessageStatus) {
|
|
7
8
|
MessageStatus["READ"] = "read";
|
|
@@ -36,3 +37,8 @@ var ChatBubbleActionKey;
|
|
|
36
37
|
ChatBubbleActionKey["DELETE"] = "delete";
|
|
37
38
|
})(ChatBubbleActionKey || (exports.ChatBubbleActionKey = ChatBubbleActionKey = {}));
|
|
38
39
|
exports.chatInjectionKey = (0, _utils_1.createInjectionKey)('chat');
|
|
40
|
+
exports.markTypeToServiceVariantMap = {
|
|
41
|
+
[ChatMarkType.SYSTEM]: message_bubble_1.MessageBubbleServiceVariant.SYSTEM,
|
|
42
|
+
[ChatMarkType.EVENT]: message_bubble_1.MessageBubbleServiceVariant.EVENT,
|
|
43
|
+
[ChatMarkType.DIVIDER]: message_bubble_1.MessageBubbleServiceVariant.DIVIDER
|
|
44
|
+
};
|
|
@@ -134,7 +134,10 @@ exports.default = (0, cssr_1.cB)('chat', `
|
|
|
134
134
|
height: 100%;
|
|
135
135
|
max-height: 100%;
|
|
136
136
|
min-height: 0;
|
|
137
|
-
`, [(0, cssr_1.
|
|
137
|
+
`, [(0, cssr_1.cM)('standalone', `
|
|
138
|
+
border: none;
|
|
139
|
+
border-radius: 0;
|
|
140
|
+
`), (0, cssr_1.cE)('header', `
|
|
138
141
|
border-bottom: 1px solid var(--u-border-color);
|
|
139
142
|
width: 100%;
|
|
140
143
|
padding: 24px 20px 10px 24px;
|