@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
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const vue_1 = require("vue");
|
|
16
|
+
const _mixins_1 = require("../../_mixins");
|
|
17
|
+
const dropdown_1 = require("../../dropdown");
|
|
18
|
+
const icon_1 = require("../../icon");
|
|
19
|
+
const typography_1 = require("../../typography");
|
|
20
|
+
const upload_1 = require("../../upload");
|
|
21
|
+
const styles_1 = require("../styles");
|
|
22
|
+
const interface_1 = require("./interface");
|
|
23
|
+
const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
|
|
24
|
+
exports.default = (0, vue_1.defineComponent)({
|
|
25
|
+
name: 'MessageBubble',
|
|
26
|
+
props: interface_1.messageBubbleProps,
|
|
27
|
+
slots: Object,
|
|
28
|
+
setup(props, { slots }) {
|
|
29
|
+
const { mergedClsPrefixRef, inlineThemeDisabled } = (0, _mixins_1.useConfig)(props);
|
|
30
|
+
const themeRef = (0, _mixins_1.useTheme)('MessageBubble', '-message-bubble', index_cssr_1.default, styles_1.messageBubbleLight, props, mergedClsPrefixRef);
|
|
31
|
+
const contextMenuShow = (0, vue_1.ref)(false);
|
|
32
|
+
const mergedRetryTextRef = (0, vue_1.computed)(() => { var _a; return (_a = props.retryText) !== null && _a !== void 0 ? _a : 'Retry'; });
|
|
33
|
+
const normalizedAttachmentsRef = (0, vue_1.computed)(() => {
|
|
34
|
+
if (!props.attachments)
|
|
35
|
+
return [];
|
|
36
|
+
return Array.isArray(props.attachments)
|
|
37
|
+
? props.attachments
|
|
38
|
+
: [props.attachments];
|
|
39
|
+
});
|
|
40
|
+
const messagePayloadRef = (0, vue_1.computed)(() => ({
|
|
41
|
+
id: props.id,
|
|
42
|
+
isOwn: props.isOwn,
|
|
43
|
+
title: props.title,
|
|
44
|
+
content: props.content,
|
|
45
|
+
timestamp: props.timestamp,
|
|
46
|
+
status: props.status,
|
|
47
|
+
attachments: normalizedAttachmentsRef.value
|
|
48
|
+
}));
|
|
49
|
+
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
50
|
+
const { common: { cubicBezierEaseInOut }, self: { messageBubbleBackgroundColorOwn, messageBubbleBackgroundColorOther, messageBubbleTextColorOwn, messageBubbleTextColorOther, messageTimeColor, messageStatusReadColor, messageStatusSuccessColor, attachmentBackgroundColorOwn, attachmentBackgroundColorOther, messageErrorColor, messageBorderRadius, unreadNotificationBackgroundColor, unreadNotificationTextColor, serviceMessageTextColor, serviceMessageBackgroundColor, messageTitleColor } } = themeRef.value;
|
|
51
|
+
return {
|
|
52
|
+
'--u-bezier': cubicBezierEaseInOut,
|
|
53
|
+
'--u-message-bubble-background-color-own': messageBubbleBackgroundColorOwn,
|
|
54
|
+
'--u-message-bubble-background-color-other': messageBubbleBackgroundColorOther,
|
|
55
|
+
'--u-message-bubble-text-color-own': messageBubbleTextColorOwn,
|
|
56
|
+
'--u-message-bubble-text-color-other': messageBubbleTextColorOther,
|
|
57
|
+
'--u-message-bubble-time-color': messageTimeColor,
|
|
58
|
+
'--u-message-bubble-status-read-color': messageStatusReadColor,
|
|
59
|
+
'--u-message-bubble-status-success-color': messageStatusSuccessColor,
|
|
60
|
+
'--u-message-bubble-attachment-background-color-own': attachmentBackgroundColorOwn,
|
|
61
|
+
'--u-message-bubble-attachment-background-color-other': attachmentBackgroundColorOther,
|
|
62
|
+
'--u-message-bubble-error-color': messageErrorColor,
|
|
63
|
+
'--u-message-bubble-border-radius': messageBorderRadius,
|
|
64
|
+
'--u-message-bubble-unread-background-color': unreadNotificationBackgroundColor,
|
|
65
|
+
'--u-message-bubble-unread-text-color': unreadNotificationTextColor,
|
|
66
|
+
'--u-message-bubble-service-text-color': serviceMessageTextColor,
|
|
67
|
+
'--u-message-bubble-service-background-color': serviceMessageBackgroundColor,
|
|
68
|
+
'--u-message-bubble-title-color': messageTitleColor
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
const themeClassHandle = inlineThemeDisabled
|
|
72
|
+
? (0, _mixins_1.useThemeClass)('message-bubble', undefined, cssVarsRef, props)
|
|
73
|
+
: undefined;
|
|
74
|
+
const messageContextMenuOptions = (0, vue_1.computed)(() => {
|
|
75
|
+
if (!props.actions || props.actions.length === 0) {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
78
|
+
const result = [];
|
|
79
|
+
for (const action of props.actions) {
|
|
80
|
+
if (action.visible && !action.visible(messagePayloadRef.value)) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
result.push({
|
|
84
|
+
key: action.key,
|
|
85
|
+
label: typeof action.label === 'function' ? action.label() : action.label
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return result;
|
|
89
|
+
});
|
|
90
|
+
const resolveRenderContent = (content) => {
|
|
91
|
+
if (typeof content === 'function') {
|
|
92
|
+
return content();
|
|
93
|
+
}
|
|
94
|
+
if (content instanceof Date) {
|
|
95
|
+
return content.toString();
|
|
96
|
+
}
|
|
97
|
+
return content;
|
|
98
|
+
};
|
|
99
|
+
const getThumbnailUrl = (attachment) => {
|
|
100
|
+
const url = [attachment.preview, attachment.thumbnail].find(value => typeof value === 'string');
|
|
101
|
+
return url !== null && url !== void 0 ? url : null;
|
|
102
|
+
};
|
|
103
|
+
const handleAttachmentDownload = (file) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
if (props.onAttachmentDownload) {
|
|
105
|
+
const attachment = normalizedAttachmentsRef.value.find(item => item.name === file.name);
|
|
106
|
+
if (attachment) {
|
|
107
|
+
try {
|
|
108
|
+
yield props.onAttachmentDownload(attachment);
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
catch (_a) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return true;
|
|
117
|
+
});
|
|
118
|
+
const handleRetryClick = () => {
|
|
119
|
+
var _a;
|
|
120
|
+
(_a = props.onRetry) === null || _a === void 0 ? void 0 : _a.call(props, messagePayloadRef.value);
|
|
121
|
+
};
|
|
122
|
+
const handleContextMenuSelect = (key) => {
|
|
123
|
+
if (!props.actions || props.actions.length === 0) {
|
|
124
|
+
contextMenuShow.value = false;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const action = props.actions.find(action => action.key === key);
|
|
128
|
+
if (action) {
|
|
129
|
+
action.handler(messagePayloadRef.value);
|
|
130
|
+
}
|
|
131
|
+
contextMenuShow.value = false;
|
|
132
|
+
};
|
|
133
|
+
const renderAttachment = (withPadding = false) => {
|
|
134
|
+
if (slots.messageAttachment) {
|
|
135
|
+
return slots.messageAttachment(messagePayloadRef.value);
|
|
136
|
+
}
|
|
137
|
+
const fileList = normalizedAttachmentsRef.value.map(attachment => {
|
|
138
|
+
var _a, _b, _c;
|
|
139
|
+
return ({
|
|
140
|
+
id: String(attachment.id),
|
|
141
|
+
name: attachment.name,
|
|
142
|
+
status: attachment.status || interface_1.MessageBubbleAttachmentStatus.FINISHED,
|
|
143
|
+
percentage: (_a = attachment.percentage) !== null && _a !== void 0 ? _a : null,
|
|
144
|
+
url: (_b = attachment.url) !== null && _b !== void 0 ? _b : null,
|
|
145
|
+
thumbnailUrl: getThumbnailUrl(attachment),
|
|
146
|
+
type: (_c = attachment.type) !== null && _c !== void 0 ? _c : null,
|
|
147
|
+
file: null,
|
|
148
|
+
batchId: null
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
const uploadComponent = ((0, vue_1.h)(upload_1.UUpload, Object.assign({ abstract: true, fileList: fileList, fileListStyle: withPadding
|
|
152
|
+
? {
|
|
153
|
+
display: 'flex',
|
|
154
|
+
flexDirection: 'column',
|
|
155
|
+
gap: '2px',
|
|
156
|
+
marginTop: '0'
|
|
157
|
+
}
|
|
158
|
+
: undefined, showRemoveButton: false, showDownloadButton: normalizedAttachmentsRef.value.some(attachment => attachment.status === interface_1.MessageBubbleAttachmentStatus.FINISHED
|
|
159
|
+
&& attachment.url
|
|
160
|
+
&& attachment.url !== '#'), showRetryButton: normalizedAttachmentsRef.value.some(attachment => attachment.status === interface_1.MessageBubbleAttachmentStatus.ERROR), onDownload: handleAttachmentDownload }, props.uploadProps), {
|
|
161
|
+
default: () => ((0, vue_1.h)(upload_1.UUploadFileList, null, {
|
|
162
|
+
'upload-file-title': slots['upload-file-title']
|
|
163
|
+
? ({ file }) => { var _a; return (_a = slots['upload-file-title']) === null || _a === void 0 ? void 0 : _a.call(slots, file); }
|
|
164
|
+
: undefined,
|
|
165
|
+
'upload-file-subtitle': slots['upload-file-subtitle']
|
|
166
|
+
? ({ file }) => { var _a; return (_a = slots['upload-file-subtitle']) === null || _a === void 0 ? void 0 : _a.call(slots, file); }
|
|
167
|
+
: ({ file }) => {
|
|
168
|
+
var _a;
|
|
169
|
+
const attachment = normalizedAttachmentsRef.value.find(item => item.name === file.name);
|
|
170
|
+
return ((0, vue_1.h)("span", { style: { fontSize: '12px', color: '#999' } }, (attachment === null || attachment === void 0 ? void 0 : attachment.size) || ((_a = file.file) === null || _a === void 0 ? void 0 : _a.size)));
|
|
171
|
+
}
|
|
172
|
+
}))
|
|
173
|
+
}));
|
|
174
|
+
if (withPadding) {
|
|
175
|
+
return (0, vue_1.h)("div", { style: { padding: '2px' } }, uploadComponent);
|
|
176
|
+
}
|
|
177
|
+
return uploadComponent;
|
|
178
|
+
};
|
|
179
|
+
const renderMessage = () => {
|
|
180
|
+
var _a;
|
|
181
|
+
const hasBubbleActionsSlot = slots.bubbleActions !== undefined;
|
|
182
|
+
const hasBubbleActionsConfig = Boolean(props.actions && props.actions.length > 0);
|
|
183
|
+
const hasTitle = Boolean(props.title || slots.title);
|
|
184
|
+
const hasContentInsideBubble = Boolean(props.content
|
|
185
|
+
|| slots.default
|
|
186
|
+
|| hasTitle
|
|
187
|
+
|| normalizedAttachmentsRef.value.length > 1);
|
|
188
|
+
const messageBubbleContent = hasContentInsideBubble ? ((0, vue_1.h)("div", { class: [
|
|
189
|
+
`${mergedClsPrefixRef.value}-message-bubble__bubble`,
|
|
190
|
+
props.isOwn
|
|
191
|
+
? `${mergedClsPrefixRef.value}-message-bubble__bubble--own`
|
|
192
|
+
: `${mergedClsPrefixRef.value}-message-bubble__bubble--other`
|
|
193
|
+
] },
|
|
194
|
+
hasTitle && ((0, vue_1.h)(typography_1.UText, { class: `${mergedClsPrefixRef.value}-message-bubble__title`, variant: "body-l-semi-bold" }, slots.title
|
|
195
|
+
? slots.title(messagePayloadRef.value)
|
|
196
|
+
: resolveRenderContent(props.title))),
|
|
197
|
+
normalizedAttachmentsRef.value.length > 0 && renderAttachment(true),
|
|
198
|
+
(props.content || slots.default) && ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-message-bubble__text` }, slots.default
|
|
199
|
+
? slots.default(messagePayloadRef.value)
|
|
200
|
+
: resolveRenderContent(props.content))))) : normalizedAttachmentsRef.value.length === 1 ? (renderAttachment()) : null;
|
|
201
|
+
return ((0, vue_1.h)("div", { class: [
|
|
202
|
+
`${mergedClsPrefixRef.value}-message-bubble__message`,
|
|
203
|
+
props.isOwn
|
|
204
|
+
? `${mergedClsPrefixRef.value}-message-bubble__message--own`
|
|
205
|
+
: `${mergedClsPrefixRef.value}-message-bubble__message--other`
|
|
206
|
+
] },
|
|
207
|
+
(0, vue_1.h)("div", { class: [
|
|
208
|
+
`${mergedClsPrefixRef.value}-message-bubble__message-wrapper`,
|
|
209
|
+
props.isOwn
|
|
210
|
+
? `${mergedClsPrefixRef.value}-message-bubble__message-wrapper--own`
|
|
211
|
+
: `${mergedClsPrefixRef.value}-message-bubble__message-wrapper--other`
|
|
212
|
+
] },
|
|
213
|
+
hasBubbleActionsSlot ? ((0, vue_1.h)("div", { onContextmenu: (event) => {
|
|
214
|
+
event.preventDefault();
|
|
215
|
+
contextMenuShow.value = false;
|
|
216
|
+
void (0, vue_1.nextTick)().then(() => {
|
|
217
|
+
contextMenuShow.value = true;
|
|
218
|
+
});
|
|
219
|
+
} }, (_a = slots.bubbleActions) === null || _a === void 0 ? void 0 :
|
|
220
|
+
_a.call(slots, messagePayloadRef.value),
|
|
221
|
+
messageBubbleContent)) : hasBubbleActionsConfig ? ((0, vue_1.h)(dropdown_1.UDropdown, { show: contextMenuShow.value, trigger: "manual", placement: "bottom-start", options: messageContextMenuOptions.value, onSelect: handleContextMenuSelect, onUpdateShow: (show) => {
|
|
222
|
+
contextMenuShow.value = show;
|
|
223
|
+
}, onClickoutside: () => {
|
|
224
|
+
contextMenuShow.value = false;
|
|
225
|
+
} }, {
|
|
226
|
+
default: () => ((0, vue_1.h)("div", { onContextmenu: (event) => {
|
|
227
|
+
event.preventDefault();
|
|
228
|
+
contextMenuShow.value = false;
|
|
229
|
+
void (0, vue_1.nextTick)().then(() => {
|
|
230
|
+
contextMenuShow.value = true;
|
|
231
|
+
});
|
|
232
|
+
} }, messageBubbleContent))
|
|
233
|
+
})) : (messageBubbleContent),
|
|
234
|
+
(0, vue_1.h)("div", { class: [
|
|
235
|
+
`${mergedClsPrefixRef.value}-message-bubble__meta`,
|
|
236
|
+
props.isOwn
|
|
237
|
+
? `${mergedClsPrefixRef.value}-message-bubble__meta--own`
|
|
238
|
+
: `${mergedClsPrefixRef.value}-message-bubble__meta--other`
|
|
239
|
+
] }, props.status === interface_1.MessageBubbleStatus.RETRY ? ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-message-bubble__retry`, onClick: handleRetryClick },
|
|
240
|
+
(0, vue_1.h)(icon_1.UIcon, { size: 16, component: interface_1.statusIconMapper[interface_1.MessageBubbleStatus.RETRY], class: `${mergedClsPrefixRef.value}-message-bubble__retry-icon`, theme: themeRef.value.peers.StatusIcon, themeOverrides: themeRef.value.peerOverrides.StatusIcon }),
|
|
241
|
+
(0, vue_1.h)("span", { class: `${mergedClsPrefixRef.value}-message-bubble__retry-text` }, mergedRetryTextRef.value))) : ((0, vue_1.h)(vue_1.Fragment, null,
|
|
242
|
+
(0, vue_1.h)("span", { class: `${mergedClsPrefixRef.value}-message-bubble__time` }, resolveRenderContent(props.timestamp)),
|
|
243
|
+
props.isOwn && props.status && ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-message-bubble__status` }, slots.messageStatus
|
|
244
|
+
? slots.messageStatus(messagePayloadRef.value)
|
|
245
|
+
: interface_1.statusIconMapper[props.status] && ((0, vue_1.h)(icon_1.UIcon, { size: 16, component: interface_1.statusIconMapper[props.status], class: [
|
|
246
|
+
`${mergedClsPrefixRef.value}-message-bubble__status-icon`,
|
|
247
|
+
`${mergedClsPrefixRef.value}-message-bubble__status-icon--${String(props.status)}`
|
|
248
|
+
], theme: themeRef.value.peers.StatusIcon, themeOverrides: themeRef.value.peerOverrides.StatusIcon }))))))))));
|
|
249
|
+
};
|
|
250
|
+
const renderService = () => {
|
|
251
|
+
if (slots.service) {
|
|
252
|
+
return slots.service(props.serviceVariant);
|
|
253
|
+
}
|
|
254
|
+
return ((0, vue_1.h)("div", { class: [
|
|
255
|
+
`${mergedClsPrefixRef.value}-message-bubble__service`,
|
|
256
|
+
`${mergedClsPrefixRef.value}-message-bubble__service--${props.serviceVariant}`
|
|
257
|
+
] }, props.content && (0, vue_1.h)("span", null, resolveRenderContent(props.content))));
|
|
258
|
+
};
|
|
259
|
+
return {
|
|
260
|
+
mergedClsPrefixRef,
|
|
261
|
+
inlineThemeDisabled,
|
|
262
|
+
cssVars: cssVarsRef,
|
|
263
|
+
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
264
|
+
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender,
|
|
265
|
+
renderMessage,
|
|
266
|
+
renderService
|
|
267
|
+
};
|
|
268
|
+
},
|
|
269
|
+
render() {
|
|
270
|
+
var _a;
|
|
271
|
+
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
272
|
+
return ((0, vue_1.h)("div", { class: [`${this.mergedClsPrefixRef}-message-bubble`, this.themeClass], style: this.inlineThemeDisabled ? undefined : this.cssVars }, this.type === interface_1.MessageBubbleType.SERVICE
|
|
273
|
+
? this.renderService()
|
|
274
|
+
: this.renderMessage()));
|
|
275
|
+
}
|
|
276
|
+
});
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { Component, PropType, VNodeChild } from 'vue';
|
|
2
|
+
import type { ExtractPublicPropTypes } from '../../_utils';
|
|
3
|
+
import type { UploadFileInfo, UploadProps } from '../../upload';
|
|
4
|
+
export declare enum MessageBubbleType {
|
|
5
|
+
MESSAGE = "message",
|
|
6
|
+
SERVICE = "service"
|
|
7
|
+
}
|
|
8
|
+
export declare enum MessageBubbleServiceVariant {
|
|
9
|
+
UNREAD = "unread",
|
|
10
|
+
SYSTEM = "system",
|
|
11
|
+
EVENT = "event",
|
|
12
|
+
DIVIDER = "divider"
|
|
13
|
+
}
|
|
14
|
+
export declare enum MessageBubbleStatus {
|
|
15
|
+
READ = "read",
|
|
16
|
+
UNREAD = "unread",
|
|
17
|
+
PENDING = "pending",
|
|
18
|
+
RETRY = "retry"
|
|
19
|
+
}
|
|
20
|
+
export declare enum MessageBubbleAttachmentStatus {
|
|
21
|
+
PENDING = "pending",
|
|
22
|
+
UPLOADING = "uploading",
|
|
23
|
+
FINISHED = "finished",
|
|
24
|
+
ERROR = "error"
|
|
25
|
+
}
|
|
26
|
+
export interface MessageBubbleSlots {
|
|
27
|
+
default?: (message: MessageBubbleMessagePayload) => VNodeChild;
|
|
28
|
+
title?: (message: MessageBubbleMessagePayload) => VNodeChild;
|
|
29
|
+
service?: (variant: MessageBubbleServiceVariant) => VNodeChild;
|
|
30
|
+
messageStatus?: (message: MessageBubbleMessagePayload) => VNodeChild;
|
|
31
|
+
bubbleActions?: (message: MessageBubbleMessagePayload) => VNodeChild;
|
|
32
|
+
messageAttachment?: (message: MessageBubbleMessagePayload) => VNodeChild;
|
|
33
|
+
'upload-file-title'?: (file: UploadFileInfo) => VNodeChild;
|
|
34
|
+
'upload-file-subtitle'?: (file: UploadFileInfo) => VNodeChild;
|
|
35
|
+
}
|
|
36
|
+
export interface MessageBubbleAttachment {
|
|
37
|
+
id: MessageBubbleId;
|
|
38
|
+
name: string;
|
|
39
|
+
url?: string;
|
|
40
|
+
size?: number | string;
|
|
41
|
+
thumbnail?: string;
|
|
42
|
+
preview?: string;
|
|
43
|
+
status?: MessageBubbleAttachmentStatus;
|
|
44
|
+
percentage?: number;
|
|
45
|
+
type?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface MessageBubbleMessagePayload {
|
|
48
|
+
id?: MessageBubbleId;
|
|
49
|
+
isOwn: boolean;
|
|
50
|
+
title?: MessageBubbleRenderContent;
|
|
51
|
+
content?: MessageBubbleRenderContent;
|
|
52
|
+
timestamp?: string | number | Date | (() => VNodeChild);
|
|
53
|
+
status?: MessageBubbleStatus;
|
|
54
|
+
attachments: MessageBubbleAttachment[];
|
|
55
|
+
}
|
|
56
|
+
export interface MessageBubbleAction {
|
|
57
|
+
key: string;
|
|
58
|
+
label: string | (() => VNodeChild);
|
|
59
|
+
handler: (message: MessageBubbleMessagePayload) => void;
|
|
60
|
+
visible?: (message: MessageBubbleMessagePayload) => boolean;
|
|
61
|
+
}
|
|
62
|
+
export type MessageBubbleId = string | number | symbol;
|
|
63
|
+
export type MessageBubbleRenderContent = string | (() => VNodeChild);
|
|
64
|
+
export type MessageBubbleProps = ExtractPublicPropTypes<typeof messageBubbleProps>;
|
|
65
|
+
export declare const statusIconMapper: Partial<Record<MessageBubbleStatus, Component>>;
|
|
66
|
+
export declare const messageBubbleProps: {
|
|
67
|
+
readonly type: {
|
|
68
|
+
readonly type: PropType<MessageBubbleType>;
|
|
69
|
+
readonly default: MessageBubbleType.MESSAGE;
|
|
70
|
+
};
|
|
71
|
+
readonly serviceVariant: {
|
|
72
|
+
readonly type: PropType<MessageBubbleServiceVariant>;
|
|
73
|
+
readonly default: MessageBubbleServiceVariant.SYSTEM;
|
|
74
|
+
};
|
|
75
|
+
readonly id: {
|
|
76
|
+
readonly type: PropType<MessageBubbleId>;
|
|
77
|
+
readonly default: undefined;
|
|
78
|
+
};
|
|
79
|
+
readonly isOwn: {
|
|
80
|
+
readonly type: BooleanConstructor;
|
|
81
|
+
readonly default: false;
|
|
82
|
+
};
|
|
83
|
+
readonly title: {
|
|
84
|
+
readonly type: PropType<MessageBubbleRenderContent>;
|
|
85
|
+
readonly default: undefined;
|
|
86
|
+
};
|
|
87
|
+
readonly content: {
|
|
88
|
+
readonly type: PropType<MessageBubbleRenderContent>;
|
|
89
|
+
readonly default: undefined;
|
|
90
|
+
};
|
|
91
|
+
readonly timestamp: {
|
|
92
|
+
readonly type: PropType<string | number | Date | (() => VNodeChild)>;
|
|
93
|
+
readonly default: undefined;
|
|
94
|
+
};
|
|
95
|
+
readonly status: {
|
|
96
|
+
readonly type: PropType<MessageBubbleStatus>;
|
|
97
|
+
readonly default: undefined;
|
|
98
|
+
};
|
|
99
|
+
readonly attachments: {
|
|
100
|
+
readonly type: PropType<MessageBubbleAttachment[] | MessageBubbleAttachment>;
|
|
101
|
+
readonly default: undefined;
|
|
102
|
+
};
|
|
103
|
+
readonly uploadProps: {
|
|
104
|
+
readonly type: PropType<Partial<UploadProps>>;
|
|
105
|
+
readonly default: undefined;
|
|
106
|
+
};
|
|
107
|
+
readonly actions: {
|
|
108
|
+
readonly type: PropType<MessageBubbleAction[]>;
|
|
109
|
+
readonly default: undefined;
|
|
110
|
+
};
|
|
111
|
+
readonly retryText: {
|
|
112
|
+
readonly type: StringConstructor;
|
|
113
|
+
readonly default: undefined;
|
|
114
|
+
};
|
|
115
|
+
readonly onRetry: {
|
|
116
|
+
readonly type: PropType<(message: MessageBubbleMessagePayload) => void>;
|
|
117
|
+
readonly default: undefined;
|
|
118
|
+
};
|
|
119
|
+
readonly onAttachmentDownload: {
|
|
120
|
+
readonly type: PropType<(attachment: MessageBubbleAttachment) => Promise<void> | void>;
|
|
121
|
+
readonly default: undefined;
|
|
122
|
+
};
|
|
123
|
+
readonly theme: PropType<import("../../_mixins").Theme<"MessageBubble", {
|
|
124
|
+
messageBubbleBackgroundColorOwn: string;
|
|
125
|
+
messageBubbleBackgroundColorOther: string;
|
|
126
|
+
messageBubbleTextColorOwn: string;
|
|
127
|
+
messageBubbleTextColorOther: string;
|
|
128
|
+
messageTimeColor: string;
|
|
129
|
+
messageStatusReadColor: string;
|
|
130
|
+
messageStatusSuccessColor: string;
|
|
131
|
+
attachmentBackgroundColorOwn: string;
|
|
132
|
+
attachmentBackgroundColorOther: string;
|
|
133
|
+
messageErrorColor: string;
|
|
134
|
+
messageBorderRadius: string;
|
|
135
|
+
unreadNotificationBackgroundColor: string;
|
|
136
|
+
unreadNotificationTextColor: string;
|
|
137
|
+
serviceMessageTextColor: string;
|
|
138
|
+
serviceMessageBackgroundColor: string;
|
|
139
|
+
messageTitleColor: string;
|
|
140
|
+
}, {
|
|
141
|
+
StatusIcon: import("../../_mixins").Theme<"Icon", {
|
|
142
|
+
color: string;
|
|
143
|
+
opacity1Depth: string;
|
|
144
|
+
opacity2Depth: string;
|
|
145
|
+
opacity3Depth: string;
|
|
146
|
+
opacity4Depth: string;
|
|
147
|
+
opacity5Depth: string;
|
|
148
|
+
}, any>;
|
|
149
|
+
}>>;
|
|
150
|
+
readonly themeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"MessageBubble", {
|
|
151
|
+
messageBubbleBackgroundColorOwn: string;
|
|
152
|
+
messageBubbleBackgroundColorOther: string;
|
|
153
|
+
messageBubbleTextColorOwn: string;
|
|
154
|
+
messageBubbleTextColorOther: string;
|
|
155
|
+
messageTimeColor: string;
|
|
156
|
+
messageStatusReadColor: string;
|
|
157
|
+
messageStatusSuccessColor: string;
|
|
158
|
+
attachmentBackgroundColorOwn: string;
|
|
159
|
+
attachmentBackgroundColorOther: string;
|
|
160
|
+
messageErrorColor: string;
|
|
161
|
+
messageBorderRadius: string;
|
|
162
|
+
unreadNotificationBackgroundColor: string;
|
|
163
|
+
unreadNotificationTextColor: string;
|
|
164
|
+
serviceMessageTextColor: string;
|
|
165
|
+
serviceMessageBackgroundColor: string;
|
|
166
|
+
messageTitleColor: string;
|
|
167
|
+
}, {
|
|
168
|
+
StatusIcon: import("../../_mixins").Theme<"Icon", {
|
|
169
|
+
color: string;
|
|
170
|
+
opacity1Depth: string;
|
|
171
|
+
opacity2Depth: string;
|
|
172
|
+
opacity3Depth: string;
|
|
173
|
+
opacity4Depth: string;
|
|
174
|
+
opacity5Depth: string;
|
|
175
|
+
}, any>;
|
|
176
|
+
}>>>;
|
|
177
|
+
readonly builtinThemeOverrides: PropType<import("../../_mixins/use-theme").ExtractThemeOverrides<import("../../_mixins").Theme<"MessageBubble", {
|
|
178
|
+
messageBubbleBackgroundColorOwn: string;
|
|
179
|
+
messageBubbleBackgroundColorOther: string;
|
|
180
|
+
messageBubbleTextColorOwn: string;
|
|
181
|
+
messageBubbleTextColorOther: string;
|
|
182
|
+
messageTimeColor: string;
|
|
183
|
+
messageStatusReadColor: string;
|
|
184
|
+
messageStatusSuccessColor: string;
|
|
185
|
+
attachmentBackgroundColorOwn: string;
|
|
186
|
+
attachmentBackgroundColorOther: string;
|
|
187
|
+
messageErrorColor: string;
|
|
188
|
+
messageBorderRadius: string;
|
|
189
|
+
unreadNotificationBackgroundColor: string;
|
|
190
|
+
unreadNotificationTextColor: string;
|
|
191
|
+
serviceMessageTextColor: string;
|
|
192
|
+
serviceMessageBackgroundColor: string;
|
|
193
|
+
messageTitleColor: string;
|
|
194
|
+
}, {
|
|
195
|
+
StatusIcon: import("../../_mixins").Theme<"Icon", {
|
|
196
|
+
color: string;
|
|
197
|
+
opacity1Depth: string;
|
|
198
|
+
opacity2Depth: string;
|
|
199
|
+
opacity3Depth: string;
|
|
200
|
+
opacity4Depth: string;
|
|
201
|
+
opacity5Depth: string;
|
|
202
|
+
}, any>;
|
|
203
|
+
}>>>;
|
|
204
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.messageBubbleProps = exports.statusIconMapper = exports.MessageBubbleAttachmentStatus = exports.MessageBubbleStatus = exports.MessageBubbleServiceVariant = exports.MessageBubbleType = void 0;
|
|
4
|
+
const icons_1 = require("../../_internal/icons");
|
|
5
|
+
const _mixins_1 = require("../../_mixins");
|
|
6
|
+
var MessageBubbleType;
|
|
7
|
+
(function (MessageBubbleType) {
|
|
8
|
+
MessageBubbleType["MESSAGE"] = "message";
|
|
9
|
+
MessageBubbleType["SERVICE"] = "service";
|
|
10
|
+
})(MessageBubbleType || (exports.MessageBubbleType = MessageBubbleType = {}));
|
|
11
|
+
var MessageBubbleServiceVariant;
|
|
12
|
+
(function (MessageBubbleServiceVariant) {
|
|
13
|
+
MessageBubbleServiceVariant["UNREAD"] = "unread";
|
|
14
|
+
MessageBubbleServiceVariant["SYSTEM"] = "system";
|
|
15
|
+
MessageBubbleServiceVariant["EVENT"] = "event";
|
|
16
|
+
MessageBubbleServiceVariant["DIVIDER"] = "divider";
|
|
17
|
+
})(MessageBubbleServiceVariant || (exports.MessageBubbleServiceVariant = MessageBubbleServiceVariant = {}));
|
|
18
|
+
var MessageBubbleStatus;
|
|
19
|
+
(function (MessageBubbleStatus) {
|
|
20
|
+
MessageBubbleStatus["READ"] = "read";
|
|
21
|
+
MessageBubbleStatus["UNREAD"] = "unread";
|
|
22
|
+
MessageBubbleStatus["PENDING"] = "pending";
|
|
23
|
+
MessageBubbleStatus["RETRY"] = "retry";
|
|
24
|
+
})(MessageBubbleStatus || (exports.MessageBubbleStatus = MessageBubbleStatus = {}));
|
|
25
|
+
var MessageBubbleAttachmentStatus;
|
|
26
|
+
(function (MessageBubbleAttachmentStatus) {
|
|
27
|
+
MessageBubbleAttachmentStatus["PENDING"] = "pending";
|
|
28
|
+
MessageBubbleAttachmentStatus["UPLOADING"] = "uploading";
|
|
29
|
+
MessageBubbleAttachmentStatus["FINISHED"] = "finished";
|
|
30
|
+
MessageBubbleAttachmentStatus["ERROR"] = "error";
|
|
31
|
+
})(MessageBubbleAttachmentStatus || (exports.MessageBubbleAttachmentStatus = MessageBubbleAttachmentStatus = {}));
|
|
32
|
+
exports.statusIconMapper = {
|
|
33
|
+
[MessageBubbleStatus.READ]: icons_1.CheckmarkDoneSharp,
|
|
34
|
+
[MessageBubbleStatus.PENDING]: icons_1.MdTime,
|
|
35
|
+
[MessageBubbleStatus.RETRY]: icons_1.Refresh,
|
|
36
|
+
[MessageBubbleStatus.UNREAD]: icons_1.CheckmarkDoneSharp
|
|
37
|
+
};
|
|
38
|
+
exports.messageBubbleProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { type: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: MessageBubbleType.MESSAGE
|
|
41
|
+
}, serviceVariant: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: MessageBubbleServiceVariant.SYSTEM
|
|
44
|
+
}, id: {
|
|
45
|
+
type: [String, Number, Symbol],
|
|
46
|
+
default: undefined
|
|
47
|
+
}, isOwn: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
}, title: {
|
|
51
|
+
type: [String, Function],
|
|
52
|
+
default: undefined
|
|
53
|
+
}, content: {
|
|
54
|
+
type: [String, Function],
|
|
55
|
+
default: undefined
|
|
56
|
+
}, timestamp: {
|
|
57
|
+
type: [String, Number, Date, Function],
|
|
58
|
+
default: undefined
|
|
59
|
+
}, status: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: undefined
|
|
62
|
+
}, attachments: {
|
|
63
|
+
type: [Array, Object],
|
|
64
|
+
default: undefined
|
|
65
|
+
}, uploadProps: {
|
|
66
|
+
type: Object,
|
|
67
|
+
default: undefined
|
|
68
|
+
}, actions: {
|
|
69
|
+
type: Array,
|
|
70
|
+
default: undefined
|
|
71
|
+
}, retryText: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: undefined
|
|
74
|
+
}, onRetry: {
|
|
75
|
+
type: Function,
|
|
76
|
+
default: undefined
|
|
77
|
+
}, onAttachmentDownload: {
|
|
78
|
+
type: Function,
|
|
79
|
+
default: undefined
|
|
80
|
+
} });
|