@uzum-tech/ui 2.4.0 → 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 +173 -76
- package/dist/index.mjs +174 -77
- 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/ChatAttachmentButton/ChatAttachmentButton.mjs +1 -2
- package/es/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.mjs +2 -1
- package/es/chat/src/ChatParts/ChatHeader/ChatHeader.mjs +3 -6
- package/es/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.mjs +2 -1
- package/es/chat/src/interface.d.ts +17 -34
- package/es/chat/src/styles/index.cssr.mjs +11 -12
- package/es/chat/styles/light.mjs +2 -1
- 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 +87 -4
- package/es/config-provider/src/ConfigProvider.mjs +6 -2
- package/es/editor/index.d.ts +1 -1
- package/es/editor/src/Editor.d.ts +26 -0
- package/es/editor/src/Editor.mjs +25 -3
- package/es/editor/src/EditorParts/EditorContent/EditorContent.d.ts +24 -0
- package/es/editor/src/EditorParts/EditorContent/interface.d.ts +12 -0
- package/es/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +24 -0
- package/es/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.mjs +2 -0
- package/es/editor/src/EditorParts/EditorToolbar/interface.d.ts +12 -0
- package/es/editor/src/EditorParts/SendButton/SendButton.mjs +3 -1
- package/es/editor/src/composables/use-editor-css-vars.mjs +8 -0
- package/es/editor/src/extensions.d.ts +1 -1
- package/es/editor/src/extensions.mjs +8 -2
- package/es/editor/src/interface.d.ts +19 -1
- package/es/editor/src/interface.mjs +1 -0
- package/es/editor/src/styles/index.cssr.mjs +14 -2
- package/es/editor/styles/dark.d.ts +4 -0
- package/es/editor/styles/light.d.ts +8 -0
- package/es/editor/styles/light.mjs +4 -0
- package/es/locales/common/enUS.d.ts +1 -0
- package/es/locales/common/enUS.mjs +1 -0
- package/es/locales/common/ruRU.mjs +6 -7
- package/es/locales/common/uzUZ.mjs +1 -0
- package/es/locales/common/zhCN.mjs +1 -0
- package/es/locales/utils/date-locale.d.ts +2 -0
- package/es/locales/utils/date-locale.mjs +8 -0
- package/es/message-bubble/src/MessageBubble.d.ts +19 -10
- package/es/message-bubble/src/MessageBubble.mjs +21 -24
- package/es/message-bubble/src/interface.d.ts +9 -5
- package/es/message-bubble/src/interface.mjs +7 -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/ChatAttachmentButton/ChatAttachmentButton.js +2 -2
- package/lib/chat/src/ChatParts/ChatEditingBlock/ChatEditingBlock.js +4 -1
- package/lib/chat/src/ChatParts/ChatHeader/ChatHeader.js +2 -2
- package/lib/chat/src/ChatParts/ChatLegacyInput/ChatLegacyInput.js +2 -2
- package/lib/chat/src/interface.d.ts +17 -34
- package/lib/chat/src/styles/index.cssr.js +11 -12
- package/lib/chat/styles/light.js +3 -1
- 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 +87 -4
- package/lib/config-provider/src/ConfigProvider.js +7 -4
- package/lib/editor/index.d.ts +1 -1
- package/lib/editor/src/Editor.d.ts +28 -2
- package/lib/editor/src/Editor.js +22 -2
- package/lib/editor/src/EditorParts/EditorContent/EditorContent.d.ts +24 -0
- package/lib/editor/src/EditorParts/EditorContent/interface.d.ts +12 -0
- package/lib/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +24 -0
- package/lib/editor/src/EditorParts/EditorToolbar/composables/use-editor-toolbar-customization.js +1 -1
- package/lib/editor/src/EditorParts/EditorToolbar/interface.d.ts +12 -0
- package/lib/editor/src/EditorParts/SendButton/SendButton.js +1 -1
- package/lib/editor/src/composables/use-editor-css-vars.js +5 -1
- package/lib/editor/src/extensions.d.ts +1 -1
- package/lib/editor/src/extensions.js +8 -3
- package/lib/editor/src/interface.d.ts +19 -1
- package/lib/editor/src/interface.js +1 -1
- package/lib/editor/src/styles/index.cssr.js +14 -2
- package/lib/editor/styles/dark.d.ts +4 -0
- package/lib/editor/styles/light.d.ts +8 -0
- package/lib/editor/styles/light.js +4 -0
- package/lib/locales/common/enUS.d.ts +1 -0
- package/lib/locales/common/enUS.js +1 -0
- package/lib/locales/common/ruRU.js +6 -7
- package/lib/locales/common/uzUZ.js +1 -0
- package/lib/locales/common/zhCN.js +1 -0
- package/lib/locales/utils/date-locale.d.ts +2 -0
- package/lib/locales/utils/date-locale.js +14 -0
- package/lib/message-bubble/src/MessageBubble.d.ts +19 -10
- package/lib/message-bubble/src/MessageBubble.js +26 -25
- package/lib/message-bubble/src/interface.d.ts +9 -5
- package/lib/message-bubble/src/interface.js +6 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/web-types.json +26 -9
package/es/_utils/index.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ export type * from './ts/ts';
|
|
|
11
11
|
export * from './types';
|
|
12
12
|
export { getTitleAttribute, isArrayShallowEqual, largerSize, smallerSize, throwError, warn, warnOnce } from './uzum';
|
|
13
13
|
export type { ExtractInternalPropTypes, ExtractPublicPropTypes, Mutable } from './uzum';
|
|
14
|
-
export { call, createDataKey, createInjectionKey, createRefSetter, flatten, getFirstSlotVNode, getFirstSlotVNodeWithTypedProps, getSlot, getVNodeChildren, isNodeVShowFalse, isSlotEmpty, keep, keysOf, mergeEventHandlers, omit, render, resolveSlot, resolveSlotWithProps, resolveSlotWithTypedProps, resolveWrappedSlot, resolveWrappedSlotWithProps, Wrapper } from './vue';
|
|
14
|
+
export { call, createDataKey, createInjectionKey, createRefSetter, flatten, getFirstSlotVNode, getFirstSlotVNodeWithTypedProps, getSlot, getVNodeChildren, isNodeVShowFalse, isSlotEmpty, keep, keysOf, mergeEventHandlers, omit, render, resolveReactiveContent, resolveReactiveText, resolveSlot, resolveSlotWithProps, resolveSlotWithTypedProps, resolveWrappedSlot, resolveWrappedSlotWithProps, Wrapper } from './vue';
|
|
15
15
|
export type { MaybeArray } from './vue';
|
package/es/_utils/index.mjs
CHANGED
|
@@ -9,4 +9,4 @@ export * from "./inject/index.mjs";
|
|
|
9
9
|
export { createStylesWithSingleColor } from "./themes/index.mjs";
|
|
10
10
|
export * from "./types/index.mjs";
|
|
11
11
|
export { getTitleAttribute, isArrayShallowEqual, largerSize, smallerSize, throwError, warn, warnOnce } from "./uzum/index.mjs";
|
|
12
|
-
export { call, createDataKey, createInjectionKey, createRefSetter, flatten, getFirstSlotVNode, getFirstSlotVNodeWithTypedProps, getSlot, getVNodeChildren, isNodeVShowFalse, isSlotEmpty, keep, keysOf, mergeEventHandlers, omit, render, resolveSlot, resolveSlotWithProps, resolveSlotWithTypedProps, resolveWrappedSlot, resolveWrappedSlotWithProps, Wrapper } from "./vue/index.mjs";
|
|
12
|
+
export { call, createDataKey, createInjectionKey, createRefSetter, flatten, getFirstSlotVNode, getFirstSlotVNodeWithTypedProps, getSlot, getVNodeChildren, isNodeVShowFalse, isSlotEmpty, keep, keysOf, mergeEventHandlers, omit, render, resolveReactiveContent, resolveReactiveText, resolveSlot, resolveSlotWithProps, resolveSlotWithTypedProps, resolveWrappedSlot, resolveWrappedSlotWithProps, Wrapper } from "./vue/index.mjs";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export const MARKDOWN_OPTIONS_KEYS_SEPARATOR = '|';
|
|
1
2
|
export const HTML_COMMENT_REGEX = /<!--[\s\S]*?-->/g;
|
|
2
3
|
export const HTML_CDATA_REGEX = /<!\[CDATA\[[\s\S]*?\]\]>/g;
|
|
3
4
|
export const HTML_RAW_BLOCK_REGEX = /<(script|style|iframe|object|embed|template|svg|math|noscript)\b[^>]*>[\s\S]*?<\/\1\s*>/gi;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createMarkdownRenderer } from './create-markdown-renderer';
|
|
2
2
|
export type { MarkdownFeature, MarkdownOptions, NormalizedMarkdownOptions } from './interface';
|
|
3
|
-
export { normalizeOptions, renderMarkdown, sanitizeMarkdown } from './render-markdown';
|
|
3
|
+
export { clearMarkdownRendererCache, getMarkdownOptionsKey, getMarkdownRendererCacheSize, normalizeOptions, renderMarkdown, sanitizeMarkdown } from './render-markdown';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { createMarkdownRenderer } from "./create-markdown-renderer.mjs";
|
|
2
|
-
export { normalizeOptions, renderMarkdown, sanitizeMarkdown } from "./render-markdown.mjs";
|
|
2
|
+
export { clearMarkdownRendererCache, getMarkdownOptionsKey, getMarkdownRendererCacheSize, normalizeOptions, renderMarkdown, sanitizeMarkdown } from "./render-markdown.mjs";
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { MarkdownOptions, NormalizedMarkdownOptions } from './interface';
|
|
2
2
|
export declare function normalizeOptions(options?: MarkdownOptions): NormalizedMarkdownOptions;
|
|
3
|
+
export declare function getMarkdownRendererCacheSize(): number;
|
|
4
|
+
export declare function clearMarkdownRendererCache(): void;
|
|
5
|
+
export declare function getMarkdownOptionsKey(options: NormalizedMarkdownOptions): string;
|
|
3
6
|
export declare function renderMarkdown(content: string, options?: MarkdownOptions): string;
|
|
4
7
|
export declare function sanitizeMarkdown(content: string, options?: MarkdownOptions): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ALL_MARKDOWN_FEATURES, ANY_HTML_TAG_REGEX, HTML_ENTITY_REPLACEMENTS, MAX_HEADING_LEVEL, WHITESPACE_REGEX } from "./constants.mjs";
|
|
1
|
+
import { ALL_MARKDOWN_FEATURES, ANY_HTML_TAG_REGEX, HTML_ENTITY_REPLACEMENTS, MARKDOWN_OPTIONS_KEYS_SEPARATOR, MAX_HEADING_LEVEL, WHITESPACE_REGEX } from "./constants.mjs";
|
|
2
2
|
import { createMarkdownRenderer } from "./create-markdown-renderer.mjs";
|
|
3
3
|
const rendererCache = new Map();
|
|
4
4
|
export function normalizeOptions(options) {
|
|
@@ -9,12 +9,27 @@ export function normalizeOptions(options) {
|
|
|
9
9
|
breaks: (_c = options === null || options === void 0 ? void 0 : options.breaks) !== null && _c !== void 0 ? _c : true
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
+
export function getMarkdownRendererCacheSize() {
|
|
13
|
+
return rendererCache.size;
|
|
14
|
+
}
|
|
15
|
+
export function clearMarkdownRendererCache() {
|
|
16
|
+
rendererCache.clear();
|
|
17
|
+
}
|
|
18
|
+
export function getMarkdownOptionsKey(options) {
|
|
19
|
+
const tags = {
|
|
20
|
+
features: [...new Set(options.features)].sort().join(','),
|
|
21
|
+
maxHeadingLevel: String(options.maxHeadingLevel),
|
|
22
|
+
breaks: options.breaks ? '1' : '0'
|
|
23
|
+
};
|
|
24
|
+
return [tags.features, tags.maxHeadingLevel, tags.breaks].join(MARKDOWN_OPTIONS_KEYS_SEPARATOR);
|
|
25
|
+
}
|
|
12
26
|
function getMarkdownRenderer(options) {
|
|
13
27
|
const normalizedOptions = normalizeOptions(options);
|
|
14
|
-
const
|
|
28
|
+
const key = getMarkdownOptionsKey(normalizedOptions);
|
|
29
|
+
const instance = rendererCache.get(key);
|
|
15
30
|
if (!instance) {
|
|
16
31
|
const renderer = createMarkdownRenderer(normalizedOptions);
|
|
17
|
-
rendererCache.set(
|
|
32
|
+
rendererCache.set(key, renderer);
|
|
18
33
|
return renderer;
|
|
19
34
|
}
|
|
20
35
|
return instance;
|
package/es/_utils/vue/index.d.ts
CHANGED
|
@@ -13,5 +13,6 @@ export { keysOf } from './keysOf';
|
|
|
13
13
|
export { mergeEventHandlers } from './merge-handlers';
|
|
14
14
|
export { omit } from './omit';
|
|
15
15
|
export { render } from './render';
|
|
16
|
+
export { resolveReactiveContent, resolveReactiveText } from './resolve-reactive';
|
|
16
17
|
export { isSlotEmpty, resolveSlot, resolveSlotWithProps, resolveSlotWithTypedProps, resolveWrappedSlot, resolveWrappedSlotWithProps } from './resolve-slot';
|
|
17
18
|
export { Wrapper } from './wrapper';
|
package/es/_utils/vue/index.mjs
CHANGED
|
@@ -12,5 +12,6 @@ export { keysOf } from "./keysOf.mjs";
|
|
|
12
12
|
export { mergeEventHandlers } from "./merge-handlers.mjs";
|
|
13
13
|
export { omit } from "./omit.mjs";
|
|
14
14
|
export { render } from "./render.mjs";
|
|
15
|
+
export { resolveReactiveContent, resolveReactiveText } from "./resolve-reactive.mjs";
|
|
15
16
|
export { isSlotEmpty, resolveSlot, resolveSlotWithProps, resolveSlotWithTypedProps, resolveWrappedSlot, resolveWrappedSlotWithProps } from "./resolve-slot.mjs";
|
|
16
17
|
export { Wrapper } from "./wrapper.mjs";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MaybeRefOrGetter, VNodeChild } from 'vue';
|
|
2
|
+
export declare function resolveReactiveContent(content?: MaybeRefOrGetter<string | number | Date> | (() => VNodeChild)): VNodeChild;
|
|
3
|
+
export declare function resolveReactiveText(content?: MaybeRefOrGetter<string | number | Date> | (() => VNodeChild)): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isRef } from 'vue';
|
|
2
|
+
export function resolveReactiveContent(content) {
|
|
3
|
+
const value = isRef(content) ? content.value : typeof content === 'function' ? content() : content;
|
|
4
|
+
return value instanceof Date ? value.toString() : value;
|
|
5
|
+
}
|
|
6
|
+
export function resolveReactiveText(content) {
|
|
7
|
+
const value = resolveReactiveContent(content);
|
|
8
|
+
return typeof value === 'string' ? value : '';
|
|
9
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, defineComponent, Fragment, h, inject } from 'vue';
|
|
2
2
|
import { CheckmarkDoneSharp, MdTime, PersonOutline, Refresh } from "../../_internal/icons/index.mjs";
|
|
3
3
|
import { useConfig, useLocale, useTheme, useThemeClass } from "../../_mixins/index.mjs";
|
|
4
|
+
import { resolveReactiveContent, resolveReactiveText } from "../../_utils/index.mjs";
|
|
4
5
|
import { sanitizeMarkdown } from "../../_utils/markdown/index.mjs";
|
|
5
6
|
import { UAvatar } from "../../avatar/index.mjs";
|
|
6
7
|
import { UBadge } from "../../badge/index.mjs";
|
|
@@ -150,14 +151,9 @@ export default defineComponent({
|
|
|
150
151
|
var _a, _b;
|
|
151
152
|
const isSelected = props.selectedChatId === item.id;
|
|
152
153
|
const isTyping = (_b = (_a = props.typingChatIds) === null || _a === void 0 ? void 0 : _a.includes(item.id)) !== null && _b !== void 0 ? _b : false;
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
subtitle
|
|
157
|
-
} = item;
|
|
158
|
-
const keyId = toKeyString(id);
|
|
159
|
-
const keyTitle = toKeyString(title);
|
|
160
|
-
const keySubtitle = toKeyString(subtitle);
|
|
154
|
+
const keyId = toKeyString(item.id);
|
|
155
|
+
const keyTitle = resolveReactiveText(item.title);
|
|
156
|
+
const keySubtitle = resolveReactiveText(item.subtitle);
|
|
161
157
|
return h(UListItem, {
|
|
162
158
|
key: `${keyId}-${keyTitle}-${keySubtitle}`,
|
|
163
159
|
showIcon: false,
|
|
@@ -182,13 +178,22 @@ export default defineComponent({
|
|
|
182
178
|
class: `${mergedClsPrefixRef.value}-chat-sidebar__item-title`,
|
|
183
179
|
variant: "body-l-medium"
|
|
184
180
|
}, {
|
|
185
|
-
default: () =>
|
|
181
|
+
default: () => {
|
|
182
|
+
const title = resolveReactiveContent(item.title);
|
|
183
|
+
return typeof title === 'string' ? sanitizeMarkdown(title) : title;
|
|
184
|
+
}
|
|
186
185
|
}),
|
|
187
186
|
description: () => h(UText, {
|
|
188
187
|
class: [`${mergedClsPrefixRef.value}-chat-sidebar__item-subtitle`, isTyping && 'typing'],
|
|
189
188
|
variant: "body-m-medium"
|
|
190
189
|
}, {
|
|
191
|
-
default: () =>
|
|
190
|
+
default: () => {
|
|
191
|
+
if (isTyping) {
|
|
192
|
+
return mergedTypingTextRef.value;
|
|
193
|
+
}
|
|
194
|
+
const subTitle = resolveReactiveContent(item.subtitle);
|
|
195
|
+
return typeof subTitle === 'string' ? sanitizeMarkdown(subTitle) : subTitle;
|
|
196
|
+
}
|
|
192
197
|
}),
|
|
193
198
|
suffix: () => {
|
|
194
199
|
const displayUnreadCount = item.unreadCount || 0;
|
|
@@ -198,7 +203,7 @@ export default defineComponent({
|
|
|
198
203
|
class: `${mergedClsPrefixRef.value}-chat-sidebar__item-indicators`
|
|
199
204
|
}, slots.chatItemSuffix ? slots.chatItemSuffix(item) : h(Fragment, null, h("div", {
|
|
200
205
|
class: `${mergedClsPrefixRef.value}-chat-sidebar__item-time`
|
|
201
|
-
}, item.datetime), h("div", {
|
|
206
|
+
}, resolveReactiveContent(item.datetime)), h("div", {
|
|
202
207
|
class: `${mergedClsPrefixRef.value}-chat-sidebar__item-status`
|
|
203
208
|
}, lastMessageIsOwn && (slots.chatItemStatus ? slots.chatItemStatus(item) : item.messageStatus && statusIconMapper[item.messageStatus] ? h(UIcon, {
|
|
204
209
|
size: 16,
|
|
@@ -27,6 +27,7 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
27
27
|
};
|
|
28
28
|
import { computed, defineComponent, h, inject, nextTick, onMounted, provide, ref, toRef, watch } from 'vue';
|
|
29
29
|
import { useConfig, useLocale, useTheme, useThemeClass } from "../../_mixins/index.mjs";
|
|
30
|
+
import { resolveReactiveText } from "../../_utils/index.mjs";
|
|
30
31
|
import { renderMarkdown } from "../../_utils/markdown/index.mjs";
|
|
31
32
|
import { USafeTopScrollbar } from "../../safe-top-scrollbar/index.mjs";
|
|
32
33
|
import { chatLight } from "../styles/index.mjs";
|
|
@@ -541,7 +542,7 @@ export default defineComponent({
|
|
|
541
542
|
if (editMessageIdRef) {
|
|
542
543
|
editMessageIdRef.value = message.id;
|
|
543
544
|
}
|
|
544
|
-
inputValue.value =
|
|
545
|
+
inputValue.value = resolveReactiveText(message.content);
|
|
545
546
|
attachmentFileList.value = [];
|
|
546
547
|
uploadedAttachmentsMap.value.clear();
|
|
547
548
|
};
|
|
@@ -9158,7 +9158,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
9158
9158
|
renderMessage: (message: ChatMessageData) => JSX.Element;
|
|
9159
9159
|
renderMarkMessage: (message: ChatMessageData) => JSX.Element;
|
|
9160
9160
|
renderSkeletonMessage: (isOwn: boolean, index: number) => JSX.Element;
|
|
9161
|
-
renderDateSeparator: (date:
|
|
9161
|
+
renderDateSeparator: (date: ChatMessageData["date"]) => JSX.Element;
|
|
9162
9162
|
renderUnreadNotification: () => JSX.Element;
|
|
9163
9163
|
cssVars: import("vue").ComputedRef<Record<string, string>>;
|
|
9164
9164
|
themeClass: import("vue").Ref<string, string>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { computed, defineComponent, h, inject } from 'vue';
|
|
2
2
|
import { useConfig, useLocale, useTheme, useThemeClass } from "../../_mixins/index.mjs";
|
|
3
|
+
import { resolveReactiveContent, resolveReactiveText } from "../../_utils/index.mjs";
|
|
3
4
|
import { MessageBubbleServiceVariant, MessageBubbleType, UMessageBubble } from "../../message-bubble/index.mjs";
|
|
4
5
|
import { USkeleton } from "../../skeleton/index.mjs";
|
|
5
6
|
import { chatLight } from "../styles/index.mjs";
|
|
@@ -207,7 +208,7 @@ export default defineComponent({
|
|
|
207
208
|
const renderDateSeparator = date => {
|
|
208
209
|
return h("div", {
|
|
209
210
|
class: `${mergedClsPrefixRef.value}-chat-main__date-separator`
|
|
210
|
-
}, h("span", null, date));
|
|
211
|
+
}, h("span", null, resolveReactiveContent(date)));
|
|
211
212
|
};
|
|
212
213
|
const renderUnreadNotification = () => {
|
|
213
214
|
var _a;
|
|
@@ -371,14 +372,14 @@ export default defineComponent({
|
|
|
371
372
|
let currentDate = '';
|
|
372
373
|
let unreadNotificationInserted = false;
|
|
373
374
|
(_b = this.messages) === null || _b === void 0 ? void 0 : _b.forEach((message, index) => {
|
|
374
|
-
const
|
|
375
|
-
if (
|
|
375
|
+
const messageDateText = resolveReactiveText(message.date);
|
|
376
|
+
if (messageDateText !== currentDate) {
|
|
376
377
|
messagesWithDates.push({
|
|
377
378
|
type: 'date-separator',
|
|
378
|
-
date:
|
|
379
|
+
date: message.date,
|
|
379
380
|
id: `date-${String(index)}`
|
|
380
381
|
});
|
|
381
|
-
currentDate =
|
|
382
|
+
currentDate = messageDateText;
|
|
382
383
|
}
|
|
383
384
|
if (!unreadNotificationInserted && !message.isOwn && message.status === MessageStatus.UNREAD && this.showUnreadNotification) {
|
|
384
385
|
messagesWithDates.push({
|
|
@@ -51,7 +51,6 @@ export default defineComponent({
|
|
|
51
51
|
handleClick
|
|
52
52
|
}) => h(UButton, Object.assign({
|
|
53
53
|
secondary: true,
|
|
54
|
-
size: "large",
|
|
55
54
|
class: `${mergedClsPrefix}-chat-main__attach-btn`,
|
|
56
55
|
disabled: this.mergedDisabled,
|
|
57
56
|
theme: mergedTheme.peers.Button,
|
|
@@ -59,7 +58,7 @@ export default defineComponent({
|
|
|
59
58
|
onClick: handleClick
|
|
60
59
|
}, this.mergedButtonProps), {
|
|
61
60
|
default: () => h(UIcon, Object.assign({
|
|
62
|
-
size:
|
|
61
|
+
size: 20,
|
|
63
62
|
theme: mergedTheme.peers.FooterAttachIcon,
|
|
64
63
|
themeOverrides: mergedTheme.peerOverrides.FooterAttachIcon
|
|
65
64
|
}, this.mergedIconProps), {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { computed, defineComponent, h, inject } from 'vue';
|
|
2
2
|
import { CloseIcon } from "../../../../_internal/icons/index.mjs";
|
|
3
3
|
import { useConfig, useLocale, useTheme } from "../../../../_mixins/index.mjs";
|
|
4
|
+
import { resolveReactiveText } from "../../../../_utils/index.mjs";
|
|
4
5
|
import { UButton } from "../../../../button/index.mjs";
|
|
5
6
|
import { UIcon } from "../../../../icon/index.mjs";
|
|
6
7
|
import { UList, UListItem } from "../../../../list/index.mjs";
|
|
@@ -54,7 +55,7 @@ export default defineComponent({
|
|
|
54
55
|
text: this.mergedTitle
|
|
55
56
|
},
|
|
56
57
|
description: {
|
|
57
|
-
text: ((_a = this.message) === null || _a === void 0 ? void 0 : _a.content)
|
|
58
|
+
text: resolveReactiveText((_a = this.message) === null || _a === void 0 ? void 0 : _a.content)
|
|
58
59
|
}
|
|
59
60
|
}, {
|
|
60
61
|
suffix: () => h(UButton, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, defineComponent, h, inject } from 'vue';
|
|
2
2
|
import { ArrowHookUpRight, PersonNote } from "../../../../_internal/icons/index.mjs";
|
|
3
3
|
import { useConfig, useLocale, useTheme } from "../../../../_mixins/index.mjs";
|
|
4
|
-
import { resolveSlot } from "../../../../_utils/index.mjs";
|
|
4
|
+
import { resolveReactiveContent, resolveReactiveText, resolveSlot } from "../../../../_utils/index.mjs";
|
|
5
5
|
import { UButton } from "../../../../button/index.mjs";
|
|
6
6
|
import { UFlex } from "../../../../flex/index.mjs";
|
|
7
7
|
import { UIcon } from "../../../../icon/index.mjs";
|
|
@@ -131,7 +131,7 @@ export default defineComponent({
|
|
|
131
131
|
selectedChat
|
|
132
132
|
} = this;
|
|
133
133
|
const keyId = this.toKeyString(selectedChat === null || selectedChat === void 0 ? void 0 : selectedChat.id);
|
|
134
|
-
const keyTitle =
|
|
134
|
+
const keyTitle = resolveReactiveText(selectedChat === null || selectedChat === void 0 ? void 0 : selectedChat.title);
|
|
135
135
|
const renderDefaultActions = () => [h(UTooltip, null, {
|
|
136
136
|
trigger: () => h(UButton, Object.assign({
|
|
137
137
|
secondary: true,
|
|
@@ -196,10 +196,7 @@ export default defineComponent({
|
|
|
196
196
|
theme: mergedTheme.peers.Typography,
|
|
197
197
|
themeOverrides: mergedTheme.peerOverrides.Typography
|
|
198
198
|
}, {
|
|
199
|
-
default: () =>
|
|
200
|
-
var _a;
|
|
201
|
-
return (_a = selectedChat === null || selectedChat === void 0 ? void 0 : selectedChat.title) !== null && _a !== void 0 ? _a : '';
|
|
202
|
-
}
|
|
199
|
+
default: () => resolveReactiveContent(selectedChat === null || selectedChat === void 0 ? void 0 : selectedChat.title)
|
|
203
200
|
}), this.typing && h(UText, {
|
|
204
201
|
class: [`${mergedClsPrefix}-chat-main__header-subtitle`, 'typing'],
|
|
205
202
|
variant: "body-m-medium"
|
|
@@ -101,6 +101,7 @@ export default defineComponent({
|
|
|
101
101
|
} = this;
|
|
102
102
|
return h(UInput, Object.assign({
|
|
103
103
|
ref: "inputInstRef",
|
|
104
|
+
size: "small",
|
|
104
105
|
value: this.value,
|
|
105
106
|
placeholder: this.mergedPlaceholder,
|
|
106
107
|
class: `${mergedClsPrefix}-chat-main__input`,
|
|
@@ -116,7 +117,7 @@ export default defineComponent({
|
|
|
116
117
|
}, this.safeInputProps), {
|
|
117
118
|
prefix: this.$slots.prefix,
|
|
118
119
|
suffix: () => h(UIcon, Object.assign({
|
|
119
|
-
size:
|
|
120
|
+
size: 20,
|
|
120
121
|
class: `${mergedClsPrefix}-chat-main__input-suffix`,
|
|
121
122
|
theme: mergedTheme.peers.FooterSuffixIcon,
|
|
122
123
|
themeOverrides: mergedTheme.peerOverrides.FooterSuffixIcon,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNodeChild } from 'vue';
|
|
1
|
+
import type { ExtractPublicPropTypes, InjectionKey, MaybeRefOrGetter, PropType, Ref, VNodeChild } from 'vue';
|
|
2
2
|
import type { MergedTheme } from '../../_mixins';
|
|
3
3
|
import type { MarkdownOptions } from '../../_utils/markdown';
|
|
4
4
|
import type { AvatarProps } from '../../avatar';
|
|
@@ -43,9 +43,9 @@ export type ChatId = string | number | symbol;
|
|
|
43
43
|
export interface ChatListItemData {
|
|
44
44
|
id: ChatId;
|
|
45
45
|
disabled?: boolean;
|
|
46
|
-
title?: string | (() => VNodeChild);
|
|
47
|
-
subtitle?: string | (() => VNodeChild);
|
|
48
|
-
datetime?: string | number | Date | (() => VNodeChild);
|
|
46
|
+
title?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
47
|
+
subtitle?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
48
|
+
datetime?: MaybeRefOrGetter<string | number | Date> | (() => VNodeChild);
|
|
49
49
|
unreadCount?: number;
|
|
50
50
|
messageStatus?: MessageStatus;
|
|
51
51
|
lastMessageIsOwn?: boolean;
|
|
@@ -56,59 +56,42 @@ export interface ChatMessageMark {
|
|
|
56
56
|
id: ChatId;
|
|
57
57
|
type: ChatMessageType.MARK;
|
|
58
58
|
}
|
|
59
|
-
export interface ChatMessageText {
|
|
60
|
-
id: ChatId;
|
|
61
|
-
type: ChatMessageType.TEXT;
|
|
62
|
-
isOwn: boolean;
|
|
63
|
-
content: string | (() => VNodeChild);
|
|
64
|
-
timestamp?: string | number | Date | (() => VNodeChild);
|
|
65
|
-
status?: MessageStatus;
|
|
66
|
-
}
|
|
67
|
-
export interface ChatMessageFile {
|
|
68
|
-
id: ChatId;
|
|
69
|
-
type: ChatMessageType.FILE;
|
|
70
|
-
isOwn: boolean;
|
|
71
|
-
content?: string | (() => VNodeChild);
|
|
72
|
-
timestamp?: string | number | Date | (() => VNodeChild);
|
|
73
|
-
status?: MessageStatus;
|
|
74
|
-
attachments: ChatAttachment[];
|
|
75
|
-
}
|
|
76
59
|
export interface ChatMessageData {
|
|
77
60
|
id: ChatId;
|
|
78
61
|
type?: ChatMessageType;
|
|
79
62
|
isOwn?: boolean;
|
|
80
|
-
content?: string;
|
|
81
|
-
timestamp?: string | number | Date | (() => VNodeChild);
|
|
63
|
+
content?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
64
|
+
timestamp?: MaybeRefOrGetter<string | number | Date> | (() => VNodeChild);
|
|
82
65
|
status?: MessageStatus;
|
|
83
|
-
date?: string;
|
|
66
|
+
date?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
84
67
|
attachment?: ChatAttachment[];
|
|
85
68
|
uploadProps?: Partial<UploadProps>;
|
|
86
69
|
senderAvatar?: string | (() => VNodeChild);
|
|
87
|
-
senderName?: string | (() => VNodeChild);
|
|
70
|
+
senderName?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
88
71
|
markType?: ChatMarkType;
|
|
89
|
-
title?: string | (() => VNodeChild);
|
|
72
|
+
title?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
90
73
|
markdown?: boolean;
|
|
91
74
|
}
|
|
92
75
|
export interface ChatMessageProps {
|
|
93
76
|
id: ChatId;
|
|
94
77
|
type?: ChatMessageType;
|
|
95
78
|
isOwn?: boolean;
|
|
96
|
-
content?: string;
|
|
97
|
-
timestamp?: string | number | Date | (() => VNodeChild);
|
|
79
|
+
content?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
80
|
+
timestamp?: MaybeRefOrGetter<string | number | Date> | (() => VNodeChild);
|
|
98
81
|
status?: MessageStatus;
|
|
99
82
|
attachment?: ChatAttachment[];
|
|
100
83
|
uploadProps?: Partial<UploadProps>;
|
|
101
84
|
senderAvatar?: string | (() => VNodeChild);
|
|
102
|
-
senderName?: string | (() => VNodeChild);
|
|
85
|
+
senderName?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
103
86
|
disabled?: boolean;
|
|
104
|
-
title?: string | (() => VNodeChild);
|
|
87
|
+
title?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
105
88
|
}
|
|
106
89
|
export interface ChatListItemProps {
|
|
107
90
|
id: ChatId;
|
|
108
91
|
disabled?: boolean;
|
|
109
|
-
title?: string | (() => VNodeChild);
|
|
110
|
-
subtitle?: string | (() => VNodeChild);
|
|
111
|
-
datetime?: string | number | Date | (() => VNodeChild);
|
|
92
|
+
title?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
93
|
+
subtitle?: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
94
|
+
datetime?: MaybeRefOrGetter<string | number | Date> | (() => VNodeChild);
|
|
112
95
|
unreadCount?: number;
|
|
113
96
|
messageStatus?: MessageStatus;
|
|
114
97
|
lastMessageIsOwn?: boolean;
|
|
@@ -232,7 +215,7 @@ export interface ChatMessageSlots {
|
|
|
232
215
|
}
|
|
233
216
|
export interface ChatBubbleAction {
|
|
234
217
|
key: ChatBubbleActionKey | string;
|
|
235
|
-
label: string | (() => VNodeChild);
|
|
218
|
+
label: MaybeRefOrGetter<string> | (() => VNodeChild);
|
|
236
219
|
handler: (message: ChatMessageData) => void;
|
|
237
220
|
visible?: (message: ChatMessageData) => boolean;
|
|
238
221
|
}
|
|
@@ -335,6 +335,7 @@ export default cB('chat', `
|
|
|
335
335
|
padding: 16px 0px;
|
|
336
336
|
`), cE('input', `
|
|
337
337
|
flex: 1;
|
|
338
|
+
--u-chat-input-padding-vertical: calc((var(--u-height) - var(--u-line-height-textarea)) / 2);
|
|
338
339
|
`, [c('.u-input-wrapper', `
|
|
339
340
|
flex-wrap: wrap;
|
|
340
341
|
padding: 0 4px;
|
|
@@ -342,34 +343,32 @@ export default cB('chat', `
|
|
|
342
343
|
`, [c('.u-input__prefix', `
|
|
343
344
|
width: 100%;
|
|
344
345
|
margin: 0;
|
|
345
|
-
margin-top: 4px;
|
|
346
346
|
white-space: wrap;
|
|
347
|
-
`, [c('
|
|
347
|
+
`, [c('&:has(*)', `
|
|
348
|
+
margin-top: 4px;
|
|
349
|
+
`), c('ul', `
|
|
348
350
|
border-top-left-radius: 12px;
|
|
349
351
|
border-top-right-radius: 12px;
|
|
350
352
|
`), c('li', `
|
|
351
353
|
padding: 12px;
|
|
352
|
-
`)]), c('.u-input__textarea-el', `
|
|
353
|
-
padding-top:
|
|
354
|
-
padding-
|
|
355
|
-
|
|
356
|
-
`), c('.u-input__placeholder', `
|
|
357
|
-
padding-top: 12px;
|
|
354
|
+
`)]), c('.u-input__textarea-el, .u-input__textarea-mirror, .u-input__placeholder', `
|
|
355
|
+
padding-top: var(--u-chat-input-padding-vertical);
|
|
356
|
+
padding-bottom: var(--u-chat-input-padding-vertical);
|
|
357
|
+
`), c('.u-input__textarea-el, .u-input__placeholder', `
|
|
358
358
|
padding-left: 12px;
|
|
359
359
|
padding-right: 48px;
|
|
360
360
|
`)])]), cE('editing-block', `
|
|
361
361
|
width: 100%;
|
|
362
362
|
`), cE('input-suffix', `
|
|
363
363
|
position: absolute;
|
|
364
|
-
right:
|
|
365
|
-
bottom:
|
|
364
|
+
right: 8px;
|
|
365
|
+
bottom: 10px;
|
|
366
366
|
color: var(--u-input-suffix-color) !important;
|
|
367
367
|
cursor: pointer;
|
|
368
|
-
margin-right: 4px;
|
|
369
368
|
`), cE('attach-btn', `
|
|
370
369
|
margin-left: 4px;
|
|
371
370
|
flex-shrink: 0;
|
|
372
|
-
padding: 0
|
|
371
|
+
padding: 0 10px;
|
|
373
372
|
`)]), c('*', `
|
|
374
373
|
box-sizing: border-box;
|
|
375
374
|
`), c('.u-list-item .u-list-item__text', `
|
package/es/chat/styles/light.mjs
CHANGED
|
@@ -21,7 +21,6 @@ const chatInputLight = Object.assign(Object.assign({}, inputLight), {
|
|
|
21
21
|
return Object.assign(Object.assign({}, originalInputSelf), {
|
|
22
22
|
color: elementsTertiary,
|
|
23
23
|
colorFocus: elementsTertiary,
|
|
24
|
-
heightMedium: '45px',
|
|
25
24
|
border: 'none',
|
|
26
25
|
borderFocus: 'none',
|
|
27
26
|
borderHover: 'none',
|
|
@@ -117,6 +116,8 @@ export function createSendButtonThemeOverrides(themeVars) {
|
|
|
117
116
|
colorPressed: 'transparent',
|
|
118
117
|
colorFocus: 'transparent',
|
|
119
118
|
colorDisabled: 'transparent',
|
|
119
|
+
rippleColor: themeVars.sendButtonRippleColor,
|
|
120
|
+
waveOpacity: themeVars.sendButtonWaveOpacity,
|
|
120
121
|
textColor: themeVars.sendButtonColor,
|
|
121
122
|
textColorHover: themeVars.sendButtonColor,
|
|
122
123
|
textColorPressed: themeVars.sendButtonColor,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const manyChatsTest: {
|
|
2
|
+
readonly chatCount: 15;
|
|
3
|
+
readonly messagesPerChat: 8;
|
|
4
|
+
readonly runCount: 2;
|
|
5
|
+
};
|
|
6
|
+
export declare const messageBubbleTest: {
|
|
7
|
+
readonly messageCount: 20;
|
|
8
|
+
};
|
|
9
|
+
export declare const sendMessageTest: {
|
|
10
|
+
readonly messageToSendCount: 20;
|
|
11
|
+
readonly sendingDelayMs: 150;
|
|
12
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChatMessageType, MessageStatus } from '@uzum-tech/ui';
|
|
2
|
+
export default function createChatMessageMock(chatId, length) {
|
|
3
|
+
return Array.from({
|
|
4
|
+
length
|
|
5
|
+
}, (_, index) => ({
|
|
6
|
+
id: `${chatId}-${index}`,
|
|
7
|
+
type: ChatMessageType.TEXT,
|
|
8
|
+
isOwn: index % 2 === 1,
|
|
9
|
+
content: `Сообщение **${index}** в чате ${chatId}\n\n- пункт\n- пункт`,
|
|
10
|
+
timestamp: '10:00',
|
|
11
|
+
status: MessageStatus.READ
|
|
12
|
+
}));
|
|
13
|
+
}
|