@uzum-tech/ui 2.4.1 → 2.4.2
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 +82 -43
- package/dist/index.mjs +83 -44
- package/dist/index.prod.js +3 -3
- package/dist/index.prod.mjs +3 -3
- package/es/_utils/index.d.ts +1 -1
- package/es/_utils/index.mjs +1 -1
- package/es/_utils/markdown/constants.d.ts +1 -0
- package/es/_utils/markdown/constants.mjs +1 -0
- package/es/_utils/markdown/index.d.ts +1 -1
- package/es/_utils/markdown/index.mjs +1 -1
- package/es/_utils/markdown/render-markdown.d.ts +3 -0
- package/es/_utils/markdown/render-markdown.mjs +18 -3
- package/es/_utils/vue/index.d.ts +1 -0
- package/es/_utils/vue/index.mjs +1 -0
- package/es/_utils/vue/resolve-reactive.d.ts +3 -0
- package/es/_utils/vue/resolve-reactive.mjs +9 -0
- package/es/chat/src/ChatListItems.mjs +16 -11
- package/es/chat/src/ChatMainArea.mjs +2 -1
- package/es/chat/src/ChatMessages.d.ts +1 -1
- package/es/chat/src/ChatMessages.mjs +6 -5
- package/es/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.mjs +2 -1
- package/es/chat/src/ChatParts/ChatHeader/ChatHeader.mjs +3 -6
- package/es/chat/src/interface.d.ts +17 -34
- package/es/chat/tests/utils/constants.d.ts +12 -0
- package/es/chat/tests/utils/constants.mjs +12 -0
- package/es/chat/tests/utils/create-chat-item-mock.d.ts +2 -0
- package/es/chat/tests/utils/create-chat-item-mock.mjs +9 -0
- package/es/chat/tests/utils/create-chat-message-mock.d.ts +2 -0
- package/es/chat/tests/utils/create-chat-message-mock.mjs +13 -0
- package/es/components.d.ts +4 -4
- package/es/editor/src/Editor.mjs +14 -2
- package/es/message-bubble/src/MessageBubble.d.ts +10 -10
- package/es/message-bubble/src/MessageBubble.mjs +13 -17
- package/es/message-bubble/src/interface.d.ts +5 -5
- package/es/message-bubble/src/interface.mjs +3 -3
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/_utils/index.d.ts +1 -1
- package/lib/_utils/index.js +3 -1
- package/lib/_utils/markdown/constants.d.ts +1 -0
- package/lib/_utils/markdown/constants.js +2 -1
- package/lib/_utils/markdown/index.d.ts +1 -1
- package/lib/_utils/markdown/index.js +4 -1
- package/lib/_utils/markdown/render-markdown.d.ts +3 -0
- package/lib/_utils/markdown/render-markdown.js +20 -2
- package/lib/_utils/vue/index.d.ts +1 -0
- package/lib/_utils/vue/index.js +4 -1
- package/lib/_utils/vue/resolve-reactive.d.ts +3 -0
- package/lib/_utils/vue/resolve-reactive.js +17 -0
- package/lib/chat/src/ChatListItems.js +20 -17
- package/lib/chat/src/ChatMainArea.js +2 -2
- package/lib/chat/src/ChatMessages.d.ts +1 -1
- package/lib/chat/src/ChatMessages.js +6 -5
- package/lib/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.js +4 -1
- package/lib/chat/src/ChatParts/ChatHeader/ChatHeader.js +2 -2
- package/lib/chat/src/interface.d.ts +17 -34
- package/lib/chat/tests/utils/constants.d.ts +12 -0
- package/lib/chat/tests/utils/constants.js +15 -0
- package/lib/chat/tests/utils/create-chat-item-mock.d.ts +2 -0
- package/lib/chat/tests/utils/create-chat-item-mock.js +10 -0
- package/lib/chat/tests/utils/create-chat-message-mock.d.ts +2 -0
- package/lib/chat/tests/utils/create-chat-message-mock.js +14 -0
- package/lib/components.d.ts +4 -4
- package/lib/editor/src/Editor.d.ts +2 -2
- package/lib/editor/src/Editor.js +13 -1
- package/lib/message-bubble/src/MessageBubble.d.ts +10 -10
- package/lib/message-bubble/src/MessageBubble.js +15 -19
- package/lib/message-bubble/src/interface.d.ts +5 -5
- package/lib/message-bubble/src/interface.js +3 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/web-types.json +7 -7
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendMessageTest = exports.messageBubbleTest = exports.manyChatsTest = void 0;
|
|
4
|
+
exports.manyChatsTest = {
|
|
5
|
+
chatCount: 15,
|
|
6
|
+
messagesPerChat: 8,
|
|
7
|
+
runCount: 2
|
|
8
|
+
};
|
|
9
|
+
exports.messageBubbleTest = {
|
|
10
|
+
messageCount: 20
|
|
11
|
+
};
|
|
12
|
+
exports.sendMessageTest = {
|
|
13
|
+
messageToSendCount: 20,
|
|
14
|
+
sendingDelayMs: 150
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = createChatItemMock;
|
|
4
|
+
function createChatItemMock(length) {
|
|
5
|
+
return Array.from({ length }, (_, index) => ({
|
|
6
|
+
id: index + 1,
|
|
7
|
+
title: `**Чат ${index + 1}**`,
|
|
8
|
+
subtitle: `*последнее сообщение ${index + 1}*`
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = createChatMessageMock;
|
|
4
|
+
const ui_1 = require("@uzum-tech/ui");
|
|
5
|
+
function createChatMessageMock(chatId, length) {
|
|
6
|
+
return Array.from({ length }, (_, index) => ({
|
|
7
|
+
id: `${chatId}-${index}`,
|
|
8
|
+
type: ui_1.ChatMessageType.TEXT,
|
|
9
|
+
isOwn: index % 2 === 1,
|
|
10
|
+
content: `Сообщение **${index}** в чате ${chatId}\n\n- пункт\n- пункт`,
|
|
11
|
+
timestamp: '10:00',
|
|
12
|
+
status: ui_1.MessageStatus.READ
|
|
13
|
+
}));
|
|
14
|
+
}
|
package/lib/components.d.ts
CHANGED
|
@@ -71799,7 +71799,7 @@ export declare const UChatMessages: import("vue").DefineComponent<import("vue").
|
|
|
71799
71799
|
renderMessage: (message: import("./chat").ChatMessageData) => JSX.Element;
|
|
71800
71800
|
renderMarkMessage: (message: import("./chat").ChatMessageData) => JSX.Element;
|
|
71801
71801
|
renderSkeletonMessage: (isOwn: boolean, index: number) => JSX.Element;
|
|
71802
|
-
renderDateSeparator: (date:
|
|
71802
|
+
renderDateSeparator: (date: import("./chat").ChatMessageData["date"]) => JSX.Element;
|
|
71803
71803
|
renderUnreadNotification: () => JSX.Element;
|
|
71804
71804
|
cssVars: import("vue").ComputedRef<Record<string, string>>;
|
|
71805
71805
|
themeClass: import("vue").Ref<string, string>;
|
|
@@ -142858,7 +142858,7 @@ export declare const UMessageBubble: import("vue").DefineComponent<import("vue")
|
|
|
142858
142858
|
readonly default: undefined;
|
|
142859
142859
|
};
|
|
142860
142860
|
readonly timestamp: {
|
|
142861
|
-
readonly type: import("vue").PropType<string | number | Date | (() => import("vue").VNodeChild)>;
|
|
142861
|
+
readonly type: import("vue").PropType<import("vue").MaybeRefOrGetter<string | number | Date> | (() => import("vue").VNodeChild)>;
|
|
142862
142862
|
readonly default: undefined;
|
|
142863
142863
|
};
|
|
142864
142864
|
readonly status: {
|
|
@@ -143049,7 +143049,7 @@ export declare const UMessageBubble: import("vue").DefineComponent<import("vue")
|
|
|
143049
143049
|
readonly default: undefined;
|
|
143050
143050
|
};
|
|
143051
143051
|
readonly timestamp: {
|
|
143052
|
-
readonly type: import("vue").PropType<string | number | Date | (() => import("vue").VNodeChild)>;
|
|
143052
|
+
readonly type: import("vue").PropType<import("vue").MaybeRefOrGetter<string | number | Date> | (() => import("vue").VNodeChild)>;
|
|
143053
143053
|
readonly default: undefined;
|
|
143054
143054
|
};
|
|
143055
143055
|
readonly status: {
|
|
@@ -143208,7 +143208,7 @@ export declare const UMessageBubble: import("vue").DefineComponent<import("vue")
|
|
|
143208
143208
|
readonly markdown: boolean;
|
|
143209
143209
|
readonly markdownOptions: import("./message-bubble").MarkdownOptions;
|
|
143210
143210
|
readonly markdownProps: import("vue").HTMLAttributes;
|
|
143211
|
-
readonly timestamp: string | number | Date | (() => import("vue").VNodeChild);
|
|
143211
|
+
readonly timestamp: import("vue").MaybeRefOrGetter<string | number | Date> | (() => import("vue").VNodeChild);
|
|
143212
143212
|
readonly attachments: import("./message-bubble").MessageBubbleAttachment | import("./message-bubble").MessageBubbleAttachment[];
|
|
143213
143213
|
readonly uploadProps: Partial<import("./upload").UploadProps>;
|
|
143214
143214
|
readonly onAttachmentDownload: (attachment: import("./message-bubble").MessageBubbleAttachment) => Promise<void> | void;
|
|
@@ -8,7 +8,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
8
8
|
readonly default: "";
|
|
9
9
|
};
|
|
10
10
|
readonly placeholder: StringConstructor;
|
|
11
|
-
readonly markdownOptions: import("vue").PropType<import("
|
|
11
|
+
readonly markdownOptions: import("vue").PropType<import("../../_utils/markdown").MarkdownOptions>;
|
|
12
12
|
readonly toolbar: {
|
|
13
13
|
readonly type: import("vue").PropType<import("./interface").EditorToolbar>;
|
|
14
14
|
readonly default: true;
|
|
@@ -1971,7 +1971,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1971
1971
|
readonly default: "";
|
|
1972
1972
|
};
|
|
1973
1973
|
readonly placeholder: StringConstructor;
|
|
1974
|
-
readonly markdownOptions: import("vue").PropType<import("
|
|
1974
|
+
readonly markdownOptions: import("vue").PropType<import("../../_utils/markdown").MarkdownOptions>;
|
|
1975
1975
|
readonly toolbar: {
|
|
1976
1976
|
readonly type: import("vue").PropType<import("./interface").EditorToolbar>;
|
|
1977
1977
|
readonly default: true;
|
package/lib/editor/src/Editor.js
CHANGED
|
@@ -8,6 +8,7 @@ const vooks_1 = require("vooks");
|
|
|
8
8
|
const vue_1 = require("vue");
|
|
9
9
|
const _mixins_1 = require("../../_mixins");
|
|
10
10
|
const _utils_1 = require("../../_utils");
|
|
11
|
+
const markdown_1 = require("../../_utils/markdown");
|
|
11
12
|
const styles_1 = require("../styles");
|
|
12
13
|
const use_editor_css_vars_1 = __importDefault(require("./composables/use-editor-css-vars"));
|
|
13
14
|
const EditorContent_1 = __importDefault(require("./EditorParts/EditorContent/EditorContent"));
|
|
@@ -29,6 +30,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
29
30
|
const themeRef = (0, _mixins_1.useTheme)('Editor', '-editor', index_cssr_1.default, styles_1.editorLight, props, mergedClsPrefixRef);
|
|
30
31
|
const uncontrolledValueRef = (0, vue_1.ref)(props.defaultValue);
|
|
31
32
|
const mergedValueRef = (0, vooks_1.useMergedState)((0, vue_1.toRef)(props, 'value'), uncontrolledValueRef);
|
|
33
|
+
const parserRef = (0, vue_1.shallowRef)();
|
|
34
|
+
const parserKeyRef = (0, vue_1.shallowRef)();
|
|
32
35
|
const serializer = (0, serializer_1.createMarkdownSerializer)(props.markdownOptions);
|
|
33
36
|
const sourceMarkdownRef = (0, vue_1.ref)((_a = mergedValueRef.value) !== null && _a !== void 0 ? _a : '');
|
|
34
37
|
const loadedDocumentRef = (0, vue_1.ref)(null);
|
|
@@ -77,10 +80,19 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
77
80
|
if (props['onUpdate:value'])
|
|
78
81
|
(0, _utils_1.call)(props['onUpdate:value'], value);
|
|
79
82
|
}
|
|
83
|
+
function getParser(instance) {
|
|
84
|
+
const normalizedOptions = (0, markdown_1.normalizeOptions)(props.markdownOptions);
|
|
85
|
+
const key = (0, markdown_1.getMarkdownOptionsKey)(normalizedOptions);
|
|
86
|
+
if (!parserRef.value || parserKeyRef.value !== key) {
|
|
87
|
+
parserKeyRef.value = key;
|
|
88
|
+
parserRef.value = (0, parser_1.createMarkdownParser)(instance.schema, props.markdownOptions);
|
|
89
|
+
}
|
|
90
|
+
return parserRef.value;
|
|
91
|
+
}
|
|
80
92
|
function setMarkdown(markdown, instance = editorRef.value, addToHistory = true) {
|
|
81
93
|
if (!instance)
|
|
82
94
|
return;
|
|
83
|
-
const document = (
|
|
95
|
+
const document = getParser(instance).parse(markdown);
|
|
84
96
|
sourceMarkdownRef.value = markdown;
|
|
85
97
|
loadedDocumentRef.value = document;
|
|
86
98
|
instance
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SlotsType, VNodeChild } from 'vue';
|
|
2
|
-
import type { MessageBubbleAttachment, MessageBubbleMessagePayload,
|
|
2
|
+
import type { MessageBubbleAttachment, MessageBubbleMessagePayload, MessageBubbleSlots } from './interface';
|
|
3
3
|
import { MessageBubbleServiceVariant, MessageBubbleStatus, MessageBubbleType } from './interface';
|
|
4
4
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
5
5
|
readonly type: {
|
|
@@ -19,11 +19,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
19
19
|
readonly default: false;
|
|
20
20
|
};
|
|
21
21
|
readonly title: {
|
|
22
|
-
readonly type: import("vue").PropType<MessageBubbleRenderContent>;
|
|
22
|
+
readonly type: import("vue").PropType<import("./interface").MessageBubbleRenderContent>;
|
|
23
23
|
readonly default: undefined;
|
|
24
24
|
};
|
|
25
25
|
readonly content: {
|
|
26
|
-
readonly type: import("vue").PropType<MessageBubbleRenderContent>;
|
|
26
|
+
readonly type: import("vue").PropType<import("./interface").MessageBubbleRenderContent>;
|
|
27
27
|
readonly default: undefined;
|
|
28
28
|
};
|
|
29
29
|
readonly markdown: {
|
|
@@ -39,7 +39,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
39
39
|
readonly default: undefined;
|
|
40
40
|
};
|
|
41
41
|
readonly timestamp: {
|
|
42
|
-
readonly type: import("vue").PropType<string | number | Date | (() => VNodeChild)>;
|
|
42
|
+
readonly type: import("vue").PropType<import("vue").MaybeRefOrGetter<string | number | Date> | (() => VNodeChild)>;
|
|
43
43
|
readonly default: undefined;
|
|
44
44
|
};
|
|
45
45
|
readonly status: {
|
|
@@ -210,11 +210,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
210
210
|
readonly default: false;
|
|
211
211
|
};
|
|
212
212
|
readonly title: {
|
|
213
|
-
readonly type: import("vue").PropType<MessageBubbleRenderContent>;
|
|
213
|
+
readonly type: import("vue").PropType<import("./interface").MessageBubbleRenderContent>;
|
|
214
214
|
readonly default: undefined;
|
|
215
215
|
};
|
|
216
216
|
readonly content: {
|
|
217
|
-
readonly type: import("vue").PropType<MessageBubbleRenderContent>;
|
|
217
|
+
readonly type: import("vue").PropType<import("./interface").MessageBubbleRenderContent>;
|
|
218
218
|
readonly default: undefined;
|
|
219
219
|
};
|
|
220
220
|
readonly markdown: {
|
|
@@ -230,7 +230,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
230
230
|
readonly default: undefined;
|
|
231
231
|
};
|
|
232
232
|
readonly timestamp: {
|
|
233
|
-
readonly type: import("vue").PropType<string | number | Date | (() => VNodeChild)>;
|
|
233
|
+
readonly type: import("vue").PropType<import("vue").MaybeRefOrGetter<string | number | Date> | (() => VNodeChild)>;
|
|
234
234
|
readonly default: undefined;
|
|
235
235
|
};
|
|
236
236
|
readonly status: {
|
|
@@ -376,10 +376,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
376
376
|
}, any>;
|
|
377
377
|
}>>>;
|
|
378
378
|
}>> & Readonly<{}>, {
|
|
379
|
-
readonly title: MessageBubbleRenderContent;
|
|
379
|
+
readonly title: import("./interface").MessageBubbleRenderContent;
|
|
380
380
|
readonly retryText: string;
|
|
381
381
|
readonly type: MessageBubbleType;
|
|
382
|
-
readonly content: MessageBubbleRenderContent;
|
|
382
|
+
readonly content: import("./interface").MessageBubbleRenderContent;
|
|
383
383
|
readonly status: MessageBubbleStatus;
|
|
384
384
|
readonly actions: import("./interface").MessageBubbleAction[];
|
|
385
385
|
readonly onRetry: (message: MessageBubbleMessagePayload) => void;
|
|
@@ -389,7 +389,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
389
389
|
readonly markdown: boolean;
|
|
390
390
|
readonly markdownOptions: import("../../_utils/markdown").MarkdownOptions;
|
|
391
391
|
readonly markdownProps: import("vue").HTMLAttributes;
|
|
392
|
-
readonly timestamp: string | number | Date | (() => VNodeChild);
|
|
392
|
+
readonly timestamp: import("vue").MaybeRefOrGetter<string | number | Date> | (() => VNodeChild);
|
|
393
393
|
readonly attachments: MessageBubbleAttachment | MessageBubbleAttachment[];
|
|
394
394
|
readonly uploadProps: Partial<import("../../upload").UploadProps>;
|
|
395
395
|
readonly onAttachmentDownload: (attachment: MessageBubbleAttachment) => Promise<void> | void;
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const vue_1 = require("vue");
|
|
16
16
|
const _mixins_1 = require("../../_mixins");
|
|
17
|
+
const _utils_1 = require("../../_utils");
|
|
17
18
|
const markdown_1 = require("../../_utils/markdown");
|
|
18
19
|
const dropdown_1 = require("../../dropdown");
|
|
19
20
|
const icon_1 = require("../../icon");
|
|
@@ -47,8 +48,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
47
48
|
status: props.status,
|
|
48
49
|
attachments: normalizedAttachmentsRef.value
|
|
49
50
|
}));
|
|
51
|
+
const resolvedContentRef = (0, vue_1.computed)(() => (0, _utils_1.resolveReactiveContent)(props.content));
|
|
52
|
+
const resolvedTitleRef = (0, vue_1.computed)(() => (0, _utils_1.resolveReactiveContent)(props.title));
|
|
50
53
|
const markdownContent = (0, vue_1.computed)(() => {
|
|
51
|
-
const content =
|
|
54
|
+
const content = resolvedContentRef.value;
|
|
52
55
|
return props.markdown && typeof content === 'string' ? content : null;
|
|
53
56
|
});
|
|
54
57
|
const markdownActive = (0, vue_1.computed)(() => markdownContent.value !== null);
|
|
@@ -106,20 +109,11 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
106
109
|
}
|
|
107
110
|
result.push({
|
|
108
111
|
key: action.key,
|
|
109
|
-
label:
|
|
112
|
+
label: () => (0, _utils_1.resolveReactiveContent)(action.label)
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
115
|
return result;
|
|
113
116
|
});
|
|
114
|
-
const resolveRenderContent = (content) => {
|
|
115
|
-
if (typeof content === 'function') {
|
|
116
|
-
return content();
|
|
117
|
-
}
|
|
118
|
-
if (content instanceof Date) {
|
|
119
|
-
return content.toString();
|
|
120
|
-
}
|
|
121
|
-
return content;
|
|
122
|
-
};
|
|
123
117
|
const getThumbnailUrl = (attachment) => {
|
|
124
118
|
const url = [attachment.preview, attachment.thumbnail].find(value => typeof value === 'string');
|
|
125
119
|
return url !== null && url !== void 0 ? url : null;
|
|
@@ -210,12 +204,12 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
210
204
|
var _a, _b;
|
|
211
205
|
const hasBubbleActionsSlot = slots.bubbleActions !== undefined;
|
|
212
206
|
const hasBubbleActionsConfig = Boolean(props.actions && props.actions.length > 0);
|
|
213
|
-
const hasTitle = Boolean(
|
|
207
|
+
const hasTitle = Boolean(resolvedTitleRef.value || slots.title);
|
|
214
208
|
const afterContentSlot = slots.afterContent || slots['after-content'];
|
|
215
209
|
const hasAfterContent = Boolean(afterContentSlot);
|
|
216
210
|
const hasVisibleTextContent = markdownActive.value
|
|
217
211
|
? markdownHtmlRef.value !== null
|
|
218
|
-
: Boolean(
|
|
212
|
+
: Boolean(resolvedContentRef.value);
|
|
219
213
|
const hasContentInsideBubble = Boolean(hasVisibleTextContent
|
|
220
214
|
|| slots.default
|
|
221
215
|
|| hasAfterContent
|
|
@@ -227,16 +221,18 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
227
221
|
? `${mergedClsPrefixRef.value}-message-bubble__bubble--own`
|
|
228
222
|
: `${mergedClsPrefixRef.value}-message-bubble__bubble--other`
|
|
229
223
|
] },
|
|
230
|
-
hasTitle && ((0, vue_1.h)(typography_1.UText, { class: `${mergedClsPrefixRef.value}-message-bubble__title`, variant: "body-l-semi-bold" },
|
|
231
|
-
|
|
232
|
-
|
|
224
|
+
hasTitle && ((0, vue_1.h)(typography_1.UText, { class: `${mergedClsPrefixRef.value}-message-bubble__title`, variant: "body-l-semi-bold" }, {
|
|
225
|
+
default: () => slots.title
|
|
226
|
+
? slots.title(messagePayloadRef.value)
|
|
227
|
+
: resolvedTitleRef.value
|
|
228
|
+
})),
|
|
233
229
|
normalizedAttachmentsRef.value.length > 0 && renderAttachment(true),
|
|
234
230
|
(hasVisibleTextContent || slots.default)
|
|
235
231
|
&& (slots.default ? ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-message-bubble__text` }, slots.default(messagePayloadRef.value))) : markdownHtmlRef.value !== null ? ((0, vue_1.h)("div", Object.assign({}, props.markdownProps, { class: [
|
|
236
232
|
`${mergedClsPrefixRef.value}-message-bubble__text`,
|
|
237
233
|
`${mergedClsPrefixRef.value}-message-bubble__markdown`,
|
|
238
234
|
(_a = props.markdownProps) === null || _a === void 0 ? void 0 : _a.class
|
|
239
|
-
], innerHTML: markdownHtmlRef.value }))) : ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-message-bubble__text` },
|
|
235
|
+
], innerHTML: markdownHtmlRef.value }))) : ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-message-bubble__text` }, resolvedContentRef.value))),
|
|
240
236
|
hasAfterContent && ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-message-bubble__after-content` }, afterContentSlot === null || afterContentSlot === void 0 ? void 0 : afterContentSlot(messagePayloadRef.value))))) : normalizedAttachmentsRef.value.length === 1 ? (renderAttachment()) : null;
|
|
241
237
|
return ((0, vue_1.h)("div", { class: [
|
|
242
238
|
`${mergedClsPrefixRef.value}-message-bubble__message`,
|
|
@@ -279,7 +275,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
279
275
|
] }, props.status === interface_1.MessageBubbleStatus.RETRY ? ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-message-bubble__retry`, onClick: handleRetryClick },
|
|
280
276
|
(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 }),
|
|
281
277
|
(0, vue_1.h)("span", { class: `${mergedClsPrefixRef.value}-message-bubble__retry-text` }, mergedRetryTextRef.value))) : ((0, vue_1.h)(vue_1.Fragment, null,
|
|
282
|
-
(0, vue_1.h)("span", { class: `${mergedClsPrefixRef.value}-message-bubble__time` },
|
|
278
|
+
(0, vue_1.h)("span", { class: `${mergedClsPrefixRef.value}-message-bubble__time` }, (0, _utils_1.resolveReactiveContent)(props.timestamp)),
|
|
283
279
|
props.isOwn && props.status && ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-message-bubble__status` }, slots.messageStatus
|
|
284
280
|
? slots.messageStatus(messagePayloadRef.value)
|
|
285
281
|
: interface_1.statusIconMapper[props.status] && ((0, vue_1.h)(icon_1.UIcon, { size: 16, component: interface_1.statusIconMapper[props.status], class: [
|
|
@@ -303,7 +299,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
303
299
|
`${mergedClsPrefixRef.value}-message-bubble__markdown`,
|
|
304
300
|
(_a = props.markdownProps) === null || _a === void 0 ? void 0 : _a.class
|
|
305
301
|
], innerHTML: markdownHtmlRef.value })))
|
|
306
|
-
:
|
|
302
|
+
: resolvedContentRef.value && ((0, vue_1.h)("span", null, resolvedContentRef.value))));
|
|
307
303
|
};
|
|
308
304
|
return {
|
|
309
305
|
mergedClsPrefixRef,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Component, HTMLAttributes, PropType, VNodeChild } from 'vue';
|
|
1
|
+
import type { Component, HTMLAttributes, MaybeRefOrGetter, PropType, VNodeChild } from 'vue';
|
|
2
2
|
import type { ExtractPublicPropTypes } from '../../_utils';
|
|
3
3
|
import type { MarkdownOptions } from '../../_utils/markdown';
|
|
4
4
|
import type { UploadFileInfo, UploadProps } from '../../upload';
|
|
@@ -52,18 +52,18 @@ export interface MessageBubbleMessagePayload {
|
|
|
52
52
|
isOwn: boolean;
|
|
53
53
|
title?: MessageBubbleRenderContent;
|
|
54
54
|
content?: MessageBubbleRenderContent;
|
|
55
|
-
timestamp?: string | number | Date | (() => VNodeChild);
|
|
55
|
+
timestamp?: MaybeRefOrGetter<string | number | Date> | (() => VNodeChild);
|
|
56
56
|
status?: MessageBubbleStatus;
|
|
57
57
|
attachments: MessageBubbleAttachment[];
|
|
58
58
|
}
|
|
59
59
|
export interface MessageBubbleAction {
|
|
60
60
|
key: string;
|
|
61
|
-
label:
|
|
61
|
+
label: MessageBubbleRenderContent;
|
|
62
62
|
handler: (message: MessageBubbleMessagePayload) => void;
|
|
63
63
|
visible?: (message: MessageBubbleMessagePayload) => boolean;
|
|
64
64
|
}
|
|
65
65
|
export type MessageBubbleId = string | number | symbol;
|
|
66
|
-
export type MessageBubbleRenderContent = string | (() => VNodeChild);
|
|
66
|
+
export type MessageBubbleRenderContent = MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
67
67
|
export type MessageBubbleProps = ExtractPublicPropTypes<typeof messageBubbleProps>;
|
|
68
68
|
export declare const statusIconMapper: Partial<Record<MessageBubbleStatus, Component>>;
|
|
69
69
|
export declare const messageBubbleProps: {
|
|
@@ -104,7 +104,7 @@ export declare const messageBubbleProps: {
|
|
|
104
104
|
readonly default: undefined;
|
|
105
105
|
};
|
|
106
106
|
readonly timestamp: {
|
|
107
|
-
readonly type: PropType<string | number | Date | (() => VNodeChild)>;
|
|
107
|
+
readonly type: PropType<MaybeRefOrGetter<string | number | Date> | (() => VNodeChild)>;
|
|
108
108
|
readonly default: undefined;
|
|
109
109
|
};
|
|
110
110
|
readonly status: {
|
|
@@ -48,10 +48,10 @@ exports.messageBubbleProps = Object.assign(Object.assign({}, _mixins_1.useTheme.
|
|
|
48
48
|
type: Boolean,
|
|
49
49
|
default: false
|
|
50
50
|
}, title: {
|
|
51
|
-
type: [String, Function],
|
|
51
|
+
type: [String, Object, Function],
|
|
52
52
|
default: undefined
|
|
53
53
|
}, content: {
|
|
54
|
-
type: [String, Function],
|
|
54
|
+
type: [String, Object, Function],
|
|
55
55
|
default: undefined
|
|
56
56
|
}, markdown: {
|
|
57
57
|
type: Boolean,
|
|
@@ -63,7 +63,7 @@ exports.messageBubbleProps = Object.assign(Object.assign({}, _mixins_1.useTheme.
|
|
|
63
63
|
type: Object,
|
|
64
64
|
default: undefined
|
|
65
65
|
}, timestamp: {
|
|
66
|
-
type: [String, Number, Date, Function],
|
|
66
|
+
type: [String, Number, Date, Object, Function],
|
|
67
67
|
default: undefined
|
|
68
68
|
}, status: {
|
|
69
69
|
type: String,
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.4.
|
|
1
|
+
declare const _default: "2.4.2";
|
|
2
2
|
export default _default;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
package/web-types.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"framework": "vue",
|
|
4
4
|
"name": "@uzum-tech/ui",
|
|
5
|
-
"version": "2.4.
|
|
5
|
+
"version": "2.4.2",
|
|
6
6
|
"js-types-syntax": "typescript",
|
|
7
7
|
"contributions": {
|
|
8
8
|
"html": {
|
|
@@ -10877,22 +10877,22 @@
|
|
|
10877
10877
|
{
|
|
10878
10878
|
"name": "title",
|
|
10879
10879
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/message-bubble",
|
|
10880
|
-
"type": "string | (() => VNodeChild)",
|
|
10881
|
-
"description": "Optional title rendered above message content.",
|
|
10880
|
+
"type": "MaybeRefOrGetter<string> | (() => VNodeChild)",
|
|
10881
|
+
"description": "Optional title rendered above message content. Pass a `string` for static text, or a `ref`/`computed`/getter to re-render it when your app's locale changes. A getter may return arbitrary markup.",
|
|
10882
10882
|
"default": "undefined"
|
|
10883
10883
|
},
|
|
10884
10884
|
{
|
|
10885
10885
|
"name": "content",
|
|
10886
10886
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/message-bubble",
|
|
10887
|
-
"type": "string | (() => VNodeChild)",
|
|
10888
|
-
"description": "Message or service content.",
|
|
10887
|
+
"type": "MaybeRefOrGetter<string> | (() => VNodeChild)",
|
|
10888
|
+
"description": "Message or service content. Pass a `string` for static text, or a `ref`/`computed`/getter to re-render it when your app's locale changes. A getter may return arbitrary markup.",
|
|
10889
10889
|
"default": "undefined"
|
|
10890
10890
|
},
|
|
10891
10891
|
{
|
|
10892
10892
|
"name": "markdown",
|
|
10893
10893
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/message-bubble",
|
|
10894
10894
|
"type": "boolean",
|
|
10895
|
-
"description": "Render `content` (when
|
|
10895
|
+
"description": "Render `content` (when the resolved value is a string) as sanitized Markdown. Only a safe subset of syntax is supported — see the Markdown Support section below.",
|
|
10896
10896
|
"default": "false"
|
|
10897
10897
|
},
|
|
10898
10898
|
{
|
|
@@ -10912,7 +10912,7 @@
|
|
|
10912
10912
|
{
|
|
10913
10913
|
"name": "timestamp",
|
|
10914
10914
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/message-bubble",
|
|
10915
|
-
"type": "string | number | Date | (() => VNodeChild)",
|
|
10915
|
+
"type": "MaybeRefOrGetter<string | number | Date> | (() => VNodeChild)",
|
|
10916
10916
|
"description": "Message time.",
|
|
10917
10917
|
"default": "undefined"
|
|
10918
10918
|
},
|