@uzum-tech/ui 2.2.1 → 2.3.1
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 +1359 -625
- package/dist/index.mjs +1352 -626
- 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 +22008 -158
- package/es/chat/src/Chat.mjs +1 -1
- package/es/chat/src/ChatListItems.d.ts +360 -0
- package/es/chat/src/ChatMainArea.d.ts +10109 -0
- package/es/chat/src/{ChatParts/MainArea.mjs → ChatMainArea.mjs} +410 -75
- package/es/chat/src/ChatMessages.d.ts +361 -33
- package/es/chat/src/ChatMessages.mjs +106 -167
- package/es/chat/src/ChatParts/Sidebar.d.ts +78 -0
- package/es/chat/src/interface.d.ts +17 -12
- package/es/chat/src/interface.mjs +7 -1
- package/es/chat/src/styles/index.cssr.mjs +4 -1
- package/es/chat/styles/dark.d.ts +27 -0
- package/es/chat/styles/dark.mjs +2 -0
- package/es/chat/styles/light.d.ts +27 -0
- package/es/chat/styles/light.mjs +2 -0
- package/es/components.d.ts +30865 -513
- 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 +340 -0
- package/es/message-bubble/src/interface.d.ts +206 -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 +131 -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/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 +22008 -158
- package/lib/chat/src/Chat.js +2 -2
- package/lib/chat/src/ChatListItems.d.ts +360 -0
- package/lib/chat/src/ChatMainArea.d.ts +10109 -0
- package/lib/chat/src/{ChatParts/MainArea.js → ChatMainArea.js} +300 -30
- package/lib/chat/src/ChatMessages.d.ts +361 -33
- package/lib/chat/src/ChatMessages.js +68 -158
- package/lib/chat/src/ChatParts/Sidebar.d.ts +78 -0
- package/lib/chat/src/interface.d.ts +17 -12
- package/lib/chat/src/interface.js +7 -1
- package/lib/chat/src/styles/index.cssr.js +4 -1
- package/lib/chat/styles/dark.d.ts +27 -0
- package/lib/chat/styles/dark.js +6 -4
- package/lib/chat/styles/light.d.ts +27 -0
- package/lib/chat/styles/light.js +6 -4
- package/lib/components.d.ts +30865 -513
- 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 +280 -0
- package/lib/message-bubble/src/interface.d.ts +206 -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 +136 -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/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 +2 -2
- package/volar.d.ts +2 -0
- package/web-types.json +177 -14
- 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,10 @@ 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
|
|
70
|
-
|
|
60
|
+
const messageBubbleThemeOverridesRef = (0, vue_1.computed)(() => {
|
|
61
|
+
const { self, peerOverrides } = themeRef.value;
|
|
62
|
+
return Object.assign({ messageBubbleBackgroundColorOwn: self.messageBubbleBackgroundColorOwn, messageBubbleBackgroundColorOther: self.messageBubbleBackgroundColorOther, messageBubbleTextColorOwn: self.messageBubbleTextColorOwn, messageBubbleTextColorOther: self.messageBubbleTextColorOther, messageTimeColor: self.messageTimeColor, attachmentBackgroundColorOwn: self.attachmentBackgroundColorOwn, attachmentBackgroundColorOther: self.attachmentBackgroundColorOther, unreadNotificationBackgroundColor: self.unreadNotificationBackgroundColor, unreadNotificationTextColor: self.unreadNotificationTextColor }, peerOverrides.MessageBubble);
|
|
63
|
+
});
|
|
71
64
|
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
72
65
|
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
66
|
return {
|
|
@@ -112,49 +105,27 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
112
105
|
var _a;
|
|
113
106
|
(_a = props.onMessageRetry) === null || _a === void 0 ? void 0 : _a.call(props, message);
|
|
114
107
|
};
|
|
115
|
-
const
|
|
108
|
+
const getMessageBubbleActions = (message) => {
|
|
116
109
|
var _a;
|
|
117
|
-
const message = contextMenuMessage.value;
|
|
118
|
-
if (!message)
|
|
119
|
-
return;
|
|
120
110
|
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
|
|
111
|
+
if (!(bubbleActions === null || bubbleActions === void 0 ? void 0 : bubbleActions.length)) {
|
|
112
|
+
return undefined;
|
|
123
113
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const handleContextMenuSelect = (key) => {
|
|
138
|
-
var _a, _b;
|
|
139
|
-
const message = contextMenuMessage.value;
|
|
140
|
-
if (!message)
|
|
141
|
-
return;
|
|
142
|
-
if (key === interface_1.ChatBubbleActionKey.EDIT) {
|
|
143
|
-
const startEditing = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.startEditingMessage) === null || _a === void 0 ? void 0 : _a.value;
|
|
144
|
-
if (startEditing) {
|
|
145
|
-
startEditing(message);
|
|
114
|
+
return bubbleActions
|
|
115
|
+
.filter(action => !action.visible || action.visible(message))
|
|
116
|
+
.map((action) => ({
|
|
117
|
+
key: String(action.key),
|
|
118
|
+
label: action.label,
|
|
119
|
+
handler: () => {
|
|
120
|
+
var _a;
|
|
121
|
+
if (action.key === interface_1.ChatBubbleActionKey.EDIT) {
|
|
122
|
+
const startEditing = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.startEditingMessage) === null || _a === void 0 ? void 0 : _a.value;
|
|
123
|
+
startEditing === null || startEditing === void 0 ? void 0 : startEditing(message);
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
action.handler(message);
|
|
146
127
|
}
|
|
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;
|
|
128
|
+
}));
|
|
158
129
|
};
|
|
159
130
|
const renderDateSeparator = (date) => {
|
|
160
131
|
return ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-main__date-separator` },
|
|
@@ -163,112 +134,62 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
163
134
|
const renderUnreadNotification = () => {
|
|
164
135
|
var _a;
|
|
165
136
|
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)));
|
|
137
|
+
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}`, theme: themeRef.value.peers.MessageBubble, themeOverrides: messageBubbleThemeOverridesRef.value }));
|
|
171
138
|
};
|
|
172
139
|
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)));
|
|
140
|
+
var _a;
|
|
141
|
+
const serviceVariant = interface_1.markTypeToServiceVariantMap[(_a = message.markType) !== null && _a !== void 0 ? _a : interface_1.ChatMarkType.DIVIDER];
|
|
142
|
+
return ((0, vue_1.h)(message_bubble_1.UMessageBubble, { key: String(message.id), type: message_bubble_1.MessageBubbleType.SERVICE, serviceVariant: serviceVariant, content: message.content, theme: themeRef.value.peers.MessageBubble, themeOverrides: messageBubbleThemeOverridesRef.value }));
|
|
182
143
|
};
|
|
183
144
|
const renderMessage = (message) => {
|
|
184
|
-
var _a, _b, _c;
|
|
185
|
-
const isOwn = message.isOwn;
|
|
186
145
|
const attachments = message.attachment
|
|
187
146
|
? Array.isArray(message.attachment)
|
|
188
147
|
? message.attachment
|
|
189
148
|
: [message.attachment]
|
|
190
149
|
: [];
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
150
|
+
const messageBubbleAttachments = attachments.map(attachment => ({
|
|
151
|
+
id: attachment.id,
|
|
152
|
+
name: attachment.name,
|
|
153
|
+
url: attachment.url,
|
|
154
|
+
size: attachment.size,
|
|
155
|
+
thumbnail: typeof attachment.thumbnail === 'string'
|
|
156
|
+
? attachment.thumbnail
|
|
157
|
+
: undefined,
|
|
158
|
+
preview: typeof attachment.preview === 'string'
|
|
159
|
+
? attachment.preview
|
|
160
|
+
: undefined,
|
|
161
|
+
status: attachment.status
|
|
162
|
+
? String(attachment.status)
|
|
163
|
+
: undefined,
|
|
164
|
+
percentage: attachment.percentage,
|
|
165
|
+
type: attachment.type
|
|
166
|
+
}));
|
|
167
|
+
const handleMessageBubbleRetry = () => {
|
|
168
|
+
handleMessageRetry(message);
|
|
169
|
+
};
|
|
170
|
+
const handleMessageBubbleAttachmentDownload = (attachment) => {
|
|
171
|
+
var _a;
|
|
172
|
+
const originalAttachment = attachments.find(item => String(item.id) === String(attachment.id));
|
|
173
|
+
if (originalAttachment && ((_a = UChat === null || UChat === void 0 ? void 0 : UChat.onAttachmentDownload) === null || _a === void 0 ? void 0 : _a.value)) {
|
|
174
|
+
return UChat.onAttachmentDownload.value(originalAttachment);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
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, theme: themeRef.value.peers.MessageBubble, themeOverrides: messageBubbleThemeOverridesRef.value }, {
|
|
178
|
+
bubbleActions: slots.bubbleActions
|
|
179
|
+
? () => { var _a; return (_a = slots.bubbleActions) === null || _a === void 0 ? void 0 : _a.call(slots, message); }
|
|
180
|
+
: undefined,
|
|
181
|
+
messageStatus: slots.messageStatus
|
|
182
|
+
? () => { var _a; return (_a = slots.messageStatus) === null || _a === void 0 ? void 0 : _a.call(slots, message); }
|
|
183
|
+
: undefined,
|
|
184
|
+
messageAttachment: slots.messageAttachment
|
|
185
|
+
? () => { var _a; return (_a = slots.messageAttachment) === null || _a === void 0 ? void 0 : _a.call(slots, message); }
|
|
186
|
+
: undefined,
|
|
187
|
+
afterContent: slots.messageAfterContent
|
|
188
|
+
? () => { var _a; return (_a = slots.messageAfterContent) === null || _a === void 0 ? void 0 : _a.call(slots, message); }
|
|
189
|
+
: undefined,
|
|
208
190
|
'upload-file-title': slots.messageAttachmentTitle,
|
|
209
191
|
'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;
|
|
192
|
+
}));
|
|
272
193
|
};
|
|
273
194
|
const renderSkeletonMessage = (isOwn, index) => {
|
|
274
195
|
return ((0, vue_1.h)("div", { key: `skeleton-${index}`, class: [
|
|
@@ -302,10 +223,6 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
302
223
|
renderSkeletonMessage,
|
|
303
224
|
renderDateSeparator,
|
|
304
225
|
renderUnreadNotification,
|
|
305
|
-
contextMenuShow,
|
|
306
|
-
contextMenuMessage,
|
|
307
|
-
messageContextMenuOptions,
|
|
308
|
-
handleContextMenuSelect,
|
|
309
226
|
cssVars: cssVarsRef,
|
|
310
227
|
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
311
228
|
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
@@ -382,14 +299,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
382
299
|
padding: '0',
|
|
383
300
|
background: 'transparent'
|
|
384
301
|
} },
|
|
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) => {
|
|
302
|
+
(0, vue_1.h)("div", { class: `${mergedClsPrefixRef}-chat-main__messages-container` }, messagesWithDates.map((item) => {
|
|
393
303
|
var _a;
|
|
394
304
|
if (item.type === 'date-separator') {
|
|
395
305
|
return renderDateSeparator((_a = item.date) !== null && _a !== void 0 ? _a : '');
|
|
@@ -677,6 +677,33 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
677
677
|
codeColor: string;
|
|
678
678
|
codeBorder: string;
|
|
679
679
|
}, any>;
|
|
680
|
+
MessageBubble: import("../../../_mixins").Theme<"MessageBubble", {
|
|
681
|
+
messageBubbleBackgroundColorOwn: string;
|
|
682
|
+
messageBubbleBackgroundColorOther: string;
|
|
683
|
+
messageBubbleTextColorOwn: string;
|
|
684
|
+
messageBubbleTextColorOther: string;
|
|
685
|
+
messageTimeColor: string;
|
|
686
|
+
messageStatusReadColor: string;
|
|
687
|
+
messageStatusSuccessColor: string;
|
|
688
|
+
attachmentBackgroundColorOwn: string;
|
|
689
|
+
attachmentBackgroundColorOther: string;
|
|
690
|
+
messageErrorColor: string;
|
|
691
|
+
messageBorderRadius: string;
|
|
692
|
+
unreadNotificationBackgroundColor: string;
|
|
693
|
+
unreadNotificationTextColor: string;
|
|
694
|
+
serviceMessageTextColor: string;
|
|
695
|
+
serviceMessageBackgroundColor: string;
|
|
696
|
+
messageTitleColor: string;
|
|
697
|
+
}, {
|
|
698
|
+
StatusIcon: import("../../../_mixins").Theme<"Icon", {
|
|
699
|
+
color: string;
|
|
700
|
+
opacity1Depth: string;
|
|
701
|
+
opacity2Depth: string;
|
|
702
|
+
opacity3Depth: string;
|
|
703
|
+
opacity4Depth: string;
|
|
704
|
+
opacity5Depth: string;
|
|
705
|
+
}, any>;
|
|
706
|
+
}>;
|
|
680
707
|
StatusIcon: import("../../../_mixins").Theme<"Icon", {
|
|
681
708
|
color: string;
|
|
682
709
|
opacity1Depth: string;
|
|
@@ -946,6 +973,18 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
946
973
|
[x: string]: any;
|
|
947
974
|
} | undefined;
|
|
948
975
|
} | undefined;
|
|
976
|
+
MessageBubble?: {
|
|
977
|
+
peers?: {
|
|
978
|
+
StatusIcon?: import("../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../_mixins").Theme<"Icon", {
|
|
979
|
+
color: string;
|
|
980
|
+
opacity1Depth: string;
|
|
981
|
+
opacity2Depth: string;
|
|
982
|
+
opacity3Depth: string;
|
|
983
|
+
opacity4Depth: string;
|
|
984
|
+
opacity5Depth: string;
|
|
985
|
+
}, any>> | undefined;
|
|
986
|
+
} | undefined;
|
|
987
|
+
} | undefined;
|
|
949
988
|
StatusIcon?: {
|
|
950
989
|
peers?: {
|
|
951
990
|
[x: string]: any;
|
|
@@ -1639,6 +1678,33 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
1639
1678
|
codeColor: string;
|
|
1640
1679
|
codeBorder: string;
|
|
1641
1680
|
}, any>;
|
|
1681
|
+
MessageBubble: import("../../../_mixins").Theme<"MessageBubble", {
|
|
1682
|
+
messageBubbleBackgroundColorOwn: string;
|
|
1683
|
+
messageBubbleBackgroundColorOther: string;
|
|
1684
|
+
messageBubbleTextColorOwn: string;
|
|
1685
|
+
messageBubbleTextColorOther: string;
|
|
1686
|
+
messageTimeColor: string;
|
|
1687
|
+
messageStatusReadColor: string;
|
|
1688
|
+
messageStatusSuccessColor: string;
|
|
1689
|
+
attachmentBackgroundColorOwn: string;
|
|
1690
|
+
attachmentBackgroundColorOther: string;
|
|
1691
|
+
messageErrorColor: string;
|
|
1692
|
+
messageBorderRadius: string;
|
|
1693
|
+
unreadNotificationBackgroundColor: string;
|
|
1694
|
+
unreadNotificationTextColor: string;
|
|
1695
|
+
serviceMessageTextColor: string;
|
|
1696
|
+
serviceMessageBackgroundColor: string;
|
|
1697
|
+
messageTitleColor: string;
|
|
1698
|
+
}, {
|
|
1699
|
+
StatusIcon: import("../../../_mixins").Theme<"Icon", {
|
|
1700
|
+
color: string;
|
|
1701
|
+
opacity1Depth: string;
|
|
1702
|
+
opacity2Depth: string;
|
|
1703
|
+
opacity3Depth: string;
|
|
1704
|
+
opacity4Depth: string;
|
|
1705
|
+
opacity5Depth: string;
|
|
1706
|
+
}, any>;
|
|
1707
|
+
}>;
|
|
1642
1708
|
StatusIcon: import("../../../_mixins").Theme<"Icon", {
|
|
1643
1709
|
color: string;
|
|
1644
1710
|
opacity1Depth: string;
|
|
@@ -1908,6 +1974,18 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
1908
1974
|
[x: string]: any;
|
|
1909
1975
|
} | undefined;
|
|
1910
1976
|
} | undefined;
|
|
1977
|
+
MessageBubble?: {
|
|
1978
|
+
peers?: {
|
|
1979
|
+
StatusIcon?: import("../../../_mixins/use-theme").ExtractThemeOverrides<import("../../../_mixins").Theme<"Icon", {
|
|
1980
|
+
color: string;
|
|
1981
|
+
opacity1Depth: string;
|
|
1982
|
+
opacity2Depth: string;
|
|
1983
|
+
opacity3Depth: string;
|
|
1984
|
+
opacity4Depth: string;
|
|
1985
|
+
opacity5Depth: string;
|
|
1986
|
+
}, any>> | undefined;
|
|
1987
|
+
} | undefined;
|
|
1988
|
+
} | undefined;
|
|
1911
1989
|
StatusIcon?: {
|
|
1912
1990
|
peers?: {
|
|
1913
1991
|
[x: string]: any;
|
|
@@ -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;
|
|
@@ -201,6 +204,7 @@ export interface ChatSlots {
|
|
|
201
204
|
chatItemSuffix?: (item: ChatListItemData) => VNodeChild;
|
|
202
205
|
messageStatus?: (message: ChatMessageData) => VNodeChild;
|
|
203
206
|
messageContent?: (message: ChatMessageData) => VNodeChild;
|
|
207
|
+
messageAfterContent?: (message: ChatMessageData) => VNodeChild;
|
|
204
208
|
messageTimestamp?: (message: ChatMessageData) => VNodeChild;
|
|
205
209
|
messageAttachment?: (message: ChatMessageData) => VNodeChild;
|
|
206
210
|
messageAttachmentTitle?: (file: any) => VNodeChild;
|
|
@@ -245,6 +249,18 @@ export interface ChatFooterProps {
|
|
|
245
249
|
actions?: Array<() => VNodeChild>;
|
|
246
250
|
inputProps?: Partial<InputProps>;
|
|
247
251
|
}
|
|
252
|
+
export interface ChatInst {
|
|
253
|
+
scrollToBottom: () => void;
|
|
254
|
+
scrollToMessage: (key: ChatId) => void;
|
|
255
|
+
sendMessage: (content: string, attachments?: ChatAttachment[]) => void;
|
|
256
|
+
}
|
|
257
|
+
export interface ChatListInst {
|
|
258
|
+
selectChat: (key: ChatId) => void;
|
|
259
|
+
updateItem: (key: ChatId, item: Partial<ChatListItemData>) => void;
|
|
260
|
+
addItem: (item: ChatListItemData) => void;
|
|
261
|
+
removeItem: (key: ChatId) => void;
|
|
262
|
+
}
|
|
263
|
+
export type HandleOnChangeType = ((data: OnChangePayload) => void) | undefined;
|
|
248
264
|
export type OnChatSelect = (key: ChatId, item: ChatListItemData) => void;
|
|
249
265
|
export type OnMessageSend = (content: string, attachments?: ChatAttachment[]) => void;
|
|
250
266
|
export type OnAttachmentUpload = (file: File) => Promise<ChatAttachment>;
|
|
@@ -265,17 +281,6 @@ export type OnSendError = (error: {
|
|
|
265
281
|
message: string;
|
|
266
282
|
content: string;
|
|
267
283
|
}) => 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
284
|
export declare const chatInjectionKey: InjectionKey<{
|
|
280
285
|
mergedClsPrefixRef: Ref<string>;
|
|
281
286
|
mergedThemeRef: Ref<MergedTheme<ChatTheme>>;
|
|
@@ -354,4 +359,4 @@ export declare const chatInjectionKey: InjectionKey<{
|
|
|
354
359
|
headerShareIconPropsRef: Ref<Partial<IconProps> | undefined>;
|
|
355
360
|
headerProfileIconPropsRef: Ref<Partial<IconProps> | undefined>;
|
|
356
361
|
}>;
|
|
357
|
-
export
|
|
362
|
+
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;
|
|
@@ -662,6 +662,33 @@ declare const chatDark: import("../../_mixins").Theme<"Chat", {
|
|
|
662
662
|
codeColor: string;
|
|
663
663
|
codeBorder: string;
|
|
664
664
|
}, any>;
|
|
665
|
+
MessageBubble: import("../../_mixins").Theme<"MessageBubble", {
|
|
666
|
+
messageBubbleBackgroundColorOwn: string;
|
|
667
|
+
messageBubbleBackgroundColorOther: string;
|
|
668
|
+
messageBubbleTextColorOwn: string;
|
|
669
|
+
messageBubbleTextColorOther: string;
|
|
670
|
+
messageTimeColor: string;
|
|
671
|
+
messageStatusReadColor: string;
|
|
672
|
+
messageStatusSuccessColor: string;
|
|
673
|
+
attachmentBackgroundColorOwn: string;
|
|
674
|
+
attachmentBackgroundColorOther: string;
|
|
675
|
+
messageErrorColor: string;
|
|
676
|
+
messageBorderRadius: string;
|
|
677
|
+
unreadNotificationBackgroundColor: string;
|
|
678
|
+
unreadNotificationTextColor: string;
|
|
679
|
+
serviceMessageTextColor: string;
|
|
680
|
+
serviceMessageBackgroundColor: string;
|
|
681
|
+
messageTitleColor: string;
|
|
682
|
+
}, {
|
|
683
|
+
StatusIcon: import("../../_mixins").Theme<"Icon", {
|
|
684
|
+
color: string;
|
|
685
|
+
opacity1Depth: string;
|
|
686
|
+
opacity2Depth: string;
|
|
687
|
+
opacity3Depth: string;
|
|
688
|
+
opacity4Depth: string;
|
|
689
|
+
opacity5Depth: string;
|
|
690
|
+
}, any>;
|
|
691
|
+
}>;
|
|
665
692
|
StatusIcon: import("../../_mixins").Theme<"Icon", {
|
|
666
693
|
color: string;
|
|
667
694
|
opacity1Depth: string;
|
package/lib/chat/styles/dark.js
CHANGED
|
@@ -9,8 +9,9 @@ const styles_4 = require("../../empty/styles");
|
|
|
9
9
|
const styles_5 = require("../../icon/styles");
|
|
10
10
|
const styles_6 = require("../../input/styles");
|
|
11
11
|
const styles_7 = require("../../list/styles");
|
|
12
|
-
const styles_8 = require("../../
|
|
13
|
-
const styles_9 = require("../../
|
|
12
|
+
const styles_8 = require("../../message-bubble/styles");
|
|
13
|
+
const styles_9 = require("../../select/styles");
|
|
14
|
+
const styles_10 = require("../../typography/styles");
|
|
14
15
|
const light_1 = require("./light");
|
|
15
16
|
const chatDark = (0, _mixins_1.createTheme)({
|
|
16
17
|
name: 'Chat',
|
|
@@ -18,12 +19,13 @@ const chatDark = (0, _mixins_1.createTheme)({
|
|
|
18
19
|
peers: {
|
|
19
20
|
Input: styles_6.inputDark,
|
|
20
21
|
Empty: styles_4.emptyDark,
|
|
21
|
-
Select:
|
|
22
|
+
Select: styles_9.selectDark,
|
|
22
23
|
Avatar: styles_1.avatarDark,
|
|
23
24
|
Badge: styles_2.badgeDark,
|
|
24
25
|
Button: styles_3.buttonDark,
|
|
25
26
|
List: styles_7.listDark,
|
|
26
|
-
Typography:
|
|
27
|
+
Typography: styles_10.typographyDark,
|
|
28
|
+
MessageBubble: styles_8.messageBubbleDark,
|
|
27
29
|
StatusIcon: styles_5.iconDark,
|
|
28
30
|
FooterAttachIcon: styles_5.iconDark,
|
|
29
31
|
FooterSuffixIcon: styles_5.iconDark,
|
|
@@ -700,6 +700,33 @@ declare const chatLight: import("../../_mixins").Theme<"Chat", {
|
|
|
700
700
|
codeColor: string;
|
|
701
701
|
codeBorder: string;
|
|
702
702
|
}, any>;
|
|
703
|
+
MessageBubble: import("../../_mixins").Theme<"MessageBubble", {
|
|
704
|
+
messageBubbleBackgroundColorOwn: string;
|
|
705
|
+
messageBubbleBackgroundColorOther: string;
|
|
706
|
+
messageBubbleTextColorOwn: string;
|
|
707
|
+
messageBubbleTextColorOther: string;
|
|
708
|
+
messageTimeColor: string;
|
|
709
|
+
messageStatusReadColor: string;
|
|
710
|
+
messageStatusSuccessColor: string;
|
|
711
|
+
attachmentBackgroundColorOwn: string;
|
|
712
|
+
attachmentBackgroundColorOther: string;
|
|
713
|
+
messageErrorColor: string;
|
|
714
|
+
messageBorderRadius: string;
|
|
715
|
+
unreadNotificationBackgroundColor: string;
|
|
716
|
+
unreadNotificationTextColor: string;
|
|
717
|
+
serviceMessageTextColor: string;
|
|
718
|
+
serviceMessageBackgroundColor: string;
|
|
719
|
+
messageTitleColor: string;
|
|
720
|
+
}, {
|
|
721
|
+
StatusIcon: import("../../_mixins").Theme<"Icon", {
|
|
722
|
+
color: string;
|
|
723
|
+
opacity1Depth: string;
|
|
724
|
+
opacity2Depth: string;
|
|
725
|
+
opacity3Depth: string;
|
|
726
|
+
opacity4Depth: string;
|
|
727
|
+
opacity5Depth: string;
|
|
728
|
+
}, any>;
|
|
729
|
+
}>;
|
|
703
730
|
StatusIcon: import("../../_mixins").Theme<"Icon", {
|
|
704
731
|
color: string;
|
|
705
732
|
opacity1Depth: string;
|
package/lib/chat/styles/light.js
CHANGED
|
@@ -12,8 +12,9 @@ const styles_5 = require("../../icon/styles");
|
|
|
12
12
|
const styles_6 = require("../../input/styles");
|
|
13
13
|
const light_2 = require("../../input/styles/light");
|
|
14
14
|
const styles_7 = require("../../list/styles");
|
|
15
|
-
const styles_8 = require("../../
|
|
16
|
-
const styles_9 = require("../../
|
|
15
|
+
const styles_8 = require("../../message-bubble/styles");
|
|
16
|
+
const styles_9 = require("../../select/styles");
|
|
17
|
+
const styles_10 = require("../../typography/styles");
|
|
17
18
|
const chatInputLight = Object.assign(Object.assign({}, styles_6.inputLight), { self(vars) {
|
|
18
19
|
const originalInputSelf = (0, light_2.self)(vars);
|
|
19
20
|
const { elementsTertiary } = vars;
|
|
@@ -70,12 +71,13 @@ const chatLight = (0, _mixins_1.createTheme)({
|
|
|
70
71
|
peers: {
|
|
71
72
|
Input: chatInputLight,
|
|
72
73
|
Empty: styles_4.emptyLight,
|
|
73
|
-
Select:
|
|
74
|
+
Select: styles_9.selectLight,
|
|
74
75
|
Avatar: styles_1.avatarLight,
|
|
75
76
|
Badge: chatBadgeLight,
|
|
76
77
|
Button: styles_3.buttonLight,
|
|
77
78
|
List: styles_7.listLight,
|
|
78
|
-
Typography:
|
|
79
|
+
Typography: styles_10.typographyLight,
|
|
80
|
+
MessageBubble: styles_8.messageBubbleLight,
|
|
79
81
|
StatusIcon: styles_5.iconLight,
|
|
80
82
|
FooterAttachIcon: styles_5.iconLight,
|
|
81
83
|
FooterSuffixIcon: styles_5.iconLight,
|