@uzum-tech/ui 1.7.2 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1673 -996
- package/dist/index.prod.js +3 -3
- package/es/chat/index.d.ts +6 -1
- package/es/chat/index.js +3 -0
- package/es/chat/src/Chat.d.ts +19 -6
- package/es/chat/src/Chat.js +54 -14
- package/es/chat/src/ChatListItems.d.ts +7782 -0
- package/es/chat/src/ChatListItems.js +188 -0
- package/es/chat/src/ChatMessages.d.ts +7805 -0
- package/es/chat/src/ChatMessages.js +325 -0
- package/es/chat/src/ChatParts/ChatAttachment.js +4 -3
- package/es/chat/src/ChatParts/MainArea.d.ts +0 -2
- package/es/chat/src/ChatParts/MainArea.js +108 -229
- package/es/chat/src/ChatParts/Sidebar.js +16 -80
- package/es/chat/src/interface.d.ts +10 -1
- package/es/chat/src/styles/index.cssr.js +16 -16
- package/es/chat/styles/light.d.ts +1 -1
- package/es/chat/styles/light.js +15 -3
- package/es/locales/common/arDZ.js +2 -1
- package/es/locales/common/deDE.js +2 -1
- package/es/locales/common/enGB.js +2 -1
- package/es/locales/common/enUS.d.ts +1 -0
- package/es/locales/common/enUS.js +2 -1
- package/es/locales/common/eo.js +2 -1
- package/es/locales/common/esAR.js +2 -1
- package/es/locales/common/faIR.js +2 -1
- package/es/locales/common/frFR.js +2 -1
- package/es/locales/common/idID.js +2 -1
- package/es/locales/common/itIT.js +2 -1
- package/es/locales/common/jaJP.js +2 -1
- package/es/locales/common/koKR.js +2 -1
- package/es/locales/common/nbNO.js +2 -1
- package/es/locales/common/nlNL.js +2 -1
- package/es/locales/common/plPL.js +2 -1
- package/es/locales/common/ptBR.js +2 -1
- package/es/locales/common/ruRU.js +2 -1
- package/es/locales/common/skSK.js +2 -1
- package/es/locales/common/svSE.js +2 -1
- package/es/locales/common/thTH.js +2 -1
- package/es/locales/common/trTR.js +2 -1
- package/es/locales/common/ukUA.js +2 -1
- package/es/locales/common/viVN.js +2 -1
- package/es/locales/common/zhCN.js +2 -1
- package/es/locales/common/zhTW.js +2 -1
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/chat/index.d.ts +6 -1
- package/lib/chat/index.js +9 -1
- package/lib/chat/src/Chat.d.ts +19 -6
- package/lib/chat/src/Chat.js +53 -13
- package/lib/chat/src/ChatListItems.d.ts +7782 -0
- package/lib/chat/src/ChatListItems.js +194 -0
- package/lib/chat/src/ChatMessages.d.ts +7805 -0
- package/lib/chat/src/ChatMessages.js +331 -0
- package/lib/chat/src/ChatParts/ChatAttachment.js +4 -3
- package/lib/chat/src/ChatParts/MainArea.d.ts +0 -2
- package/lib/chat/src/ChatParts/MainArea.js +107 -228
- package/lib/chat/src/ChatParts/Sidebar.js +17 -78
- package/lib/chat/src/interface.d.ts +10 -1
- package/lib/chat/src/styles/index.cssr.js +16 -16
- package/lib/chat/styles/light.d.ts +1 -1
- package/lib/chat/styles/light.js +15 -3
- package/lib/locales/common/arDZ.js +2 -1
- package/lib/locales/common/deDE.js +2 -1
- package/lib/locales/common/enGB.js +2 -1
- package/lib/locales/common/enUS.d.ts +1 -0
- package/lib/locales/common/enUS.js +2 -1
- package/lib/locales/common/eo.js +2 -1
- package/lib/locales/common/esAR.js +2 -1
- package/lib/locales/common/faIR.js +2 -1
- package/lib/locales/common/frFR.js +2 -1
- package/lib/locales/common/idID.js +2 -1
- package/lib/locales/common/itIT.js +2 -1
- package/lib/locales/common/jaJP.js +2 -1
- package/lib/locales/common/koKR.js +2 -1
- package/lib/locales/common/nbNO.js +2 -1
- package/lib/locales/common/nlNL.js +2 -1
- package/lib/locales/common/plPL.js +2 -1
- package/lib/locales/common/ptBR.js +2 -1
- package/lib/locales/common/ruRU.js +2 -1
- package/lib/locales/common/skSK.js +2 -1
- package/lib/locales/common/svSE.js +2 -1
- package/lib/locales/common/thTH.js +2 -1
- package/lib/locales/common/trTR.js +2 -1
- package/lib/locales/common/ukUA.js +2 -1
- package/lib/locales/common/viVN.js +2 -1
- package/lib/locales/common/zhCN.js +2 -1
- package/lib/locales/common/zhTW.js +2 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/volar.d.ts +2 -0
- package/web-types.json +149 -1
- package/es/chat/src/ChatGlobalState.d.ts +0 -13
- package/es/chat/src/ChatGlobalState.js +0 -32
- package/lib/chat/src/ChatGlobalState.d.ts +0 -13
- package/lib/chat/src/ChatGlobalState.js +0 -36
package/es/chat/index.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export { default as UChat } from './src/Chat';
|
|
2
|
-
export
|
|
2
|
+
export { default as UChatListItems } from './src/ChatListItems';
|
|
3
|
+
export { default as UChatMessages } from './src/ChatMessages';
|
|
4
|
+
export type { ChatId, ChatProps, ChatListItemProps, ChatMessageProps, ChatMarkProps, ChatHeaderProps, ChatFooterProps, ChatListHeaderProps, ChatSlots, ChatListItemSlots, ChatMessageSlots, ChatMarkSlots, ChatHeaderSlots, ChatFooterSlots, ChatListItemData, ChatMessageData, ChatAttachment, OnChatSelect, OnMessageSend, OnAttachmentUpload, OnFilterChange, OnLoadMoreChats, OnNetworkError, OnUploadError, OnSendError, ChatInst, ChatListInst, chatInjectionKey } from './src/interface';
|
|
5
|
+
export { MessageStatus, ChatMessageType, ChatMarkType } from './src/interface';
|
|
6
|
+
export type { ChatListItemsProps } from './src/ChatListItems';
|
|
7
|
+
export type { ChatMessagesProps } from './src/ChatMessages';
|
package/es/chat/index.js
CHANGED
package/es/chat/src/Chat.d.ts
CHANGED
|
@@ -115,6 +115,10 @@ export declare const chatProps: {
|
|
|
115
115
|
type: PropType<ChatPropsType["closeButtonText"]>;
|
|
116
116
|
default: undefined;
|
|
117
117
|
};
|
|
118
|
+
unreadNotificationText: {
|
|
119
|
+
type: PropType<ChatPropsType["unreadNotificationText"]>;
|
|
120
|
+
default: undefined;
|
|
121
|
+
};
|
|
118
122
|
chatItemsLoading: {
|
|
119
123
|
type: PropType<ChatPropsType["chatItemsLoading"]>;
|
|
120
124
|
default: boolean;
|
|
@@ -2241,6 +2245,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2241
2245
|
type: PropType<ChatPropsType["closeButtonText"]>;
|
|
2242
2246
|
default: undefined;
|
|
2243
2247
|
};
|
|
2248
|
+
unreadNotificationText: {
|
|
2249
|
+
type: PropType<ChatPropsType["unreadNotificationText"]>;
|
|
2250
|
+
default: undefined;
|
|
2251
|
+
};
|
|
2244
2252
|
chatItemsLoading: {
|
|
2245
2253
|
type: PropType<ChatPropsType["chatItemsLoading"]>;
|
|
2246
2254
|
default: boolean;
|
|
@@ -5285,6 +5293,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
5285
5293
|
type: PropType<ChatPropsType["closeButtonText"]>;
|
|
5286
5294
|
default: undefined;
|
|
5287
5295
|
};
|
|
5296
|
+
unreadNotificationText: {
|
|
5297
|
+
type: PropType<ChatPropsType["unreadNotificationText"]>;
|
|
5298
|
+
default: undefined;
|
|
5299
|
+
};
|
|
5288
5300
|
chatItemsLoading: {
|
|
5289
5301
|
type: PropType<ChatPropsType["chatItemsLoading"]>;
|
|
5290
5302
|
default: boolean;
|
|
@@ -7312,15 +7324,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7312
7324
|
typingText: string | undefined;
|
|
7313
7325
|
retryText: string | undefined;
|
|
7314
7326
|
closeButtonText: string | undefined;
|
|
7327
|
+
unreadNotificationText: string | undefined;
|
|
7315
7328
|
maxHeight: string | number;
|
|
7316
7329
|
emptyProps: Partial<Partial<import("../..").EmptyProps> | undefined>;
|
|
7330
|
+
chatItems: ChatListItemData[] | undefined;
|
|
7331
|
+
selectedChatId: import("./interface").ChatId | undefined;
|
|
7332
|
+
typingChatIds: (string | number | symbol)[];
|
|
7333
|
+
onChatSelect: import("./interface").OnChatSelect | undefined;
|
|
7334
|
+
messages: ChatMessageData[] | undefined;
|
|
7335
|
+
onMessageRetry: ((message: ChatMessageData) => void) | undefined;
|
|
7317
7336
|
onChatClose: () => void;
|
|
7318
7337
|
onChatShare: () => void;
|
|
7319
7338
|
onUserProfile: () => void;
|
|
7320
7339
|
headerActions: (() => import("vue").VNodeChild)[] | undefined;
|
|
7321
|
-
chatItems: ChatListItemData[] | undefined;
|
|
7322
|
-
selectedChatId: import("./interface").ChatId | undefined;
|
|
7323
|
-
messages: ChatMessageData[] | undefined;
|
|
7324
7340
|
listEmptyProps: Partial<Partial<import("../..").EmptyProps> | undefined>;
|
|
7325
7341
|
listHeaderTitle: string | (() => import("vue").VNodeChild) | undefined;
|
|
7326
7342
|
listHeaderActions: (() => import("vue").VNodeChild)[] | undefined;
|
|
@@ -7343,14 +7359,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
7343
7359
|
chatItemsLoadingCount: number | undefined;
|
|
7344
7360
|
messagesLoading: boolean | undefined;
|
|
7345
7361
|
messagesLoadingCount: number | undefined;
|
|
7346
|
-
onChatSelect: import("./interface").OnChatSelect | undefined;
|
|
7347
|
-
onMessageRetry: ((message: ChatMessageData) => void) | undefined;
|
|
7348
7362
|
onAttachmentUpload: import("./interface").OnAttachmentUpload | undefined;
|
|
7349
7363
|
onFilterChange: import("./interface").OnFilterChange | undefined;
|
|
7350
7364
|
onLoadMoreChats: import("./interface").OnLoadMoreChats | undefined;
|
|
7351
7365
|
onNetworkError: import("./interface").OnNetworkError | undefined;
|
|
7352
7366
|
onUploadError: import("./interface").OnUploadError | undefined;
|
|
7353
7367
|
onSendError: import("./interface").OnSendError | undefined;
|
|
7354
|
-
typingChatIds: (string | number | symbol)[];
|
|
7355
7368
|
}, {}>;
|
|
7356
7369
|
export default _default;
|
package/es/chat/src/Chat.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h, defineComponent, computed, provide, ref, toRef } from 'vue';
|
|
1
|
+
import { h, defineComponent, computed, provide, ref, watch, toRef, Fragment } from 'vue';
|
|
2
2
|
import { chatInjectionKey } from './interface';
|
|
3
3
|
import ChatSidebar from './ChatParts/Sidebar';
|
|
4
4
|
import ChatMainArea from './ChatParts/MainArea';
|
|
@@ -91,6 +91,9 @@ export const chatProps = Object.assign(Object.assign({}, useTheme.props), { chat
|
|
|
91
91
|
}, closeButtonText: {
|
|
92
92
|
type: String,
|
|
93
93
|
default: undefined
|
|
94
|
+
}, unreadNotificationText: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: undefined
|
|
94
97
|
}, chatItemsLoading: {
|
|
95
98
|
type: Boolean,
|
|
96
99
|
default: false
|
|
@@ -159,6 +162,11 @@ export default defineComponent({
|
|
|
159
162
|
const { mergedClsPrefixRef } = useConfig(props);
|
|
160
163
|
const themeRef = useTheme('Chat', '-chat', style, chatLight, props, mergedClsPrefixRef);
|
|
161
164
|
const { localeRef } = useLocale('Chat');
|
|
165
|
+
const notificationsShownSet = ref(new Set());
|
|
166
|
+
const markNotificationShown = (chatId) => {
|
|
167
|
+
notificationsShownSet.value.add(chatId);
|
|
168
|
+
notificationsShownSet.value = new Set(notificationsShownSet.value);
|
|
169
|
+
};
|
|
162
170
|
const cssVarsRef = computed(() => {
|
|
163
171
|
const { common: { cubicBezierEaseInOut }, self: { backgroundColor, borderColor, sidebarBackgroundColor, sidebarBorderColor, sidebarItemBackgroundColor, sidebarItemBackgroundColorHover, sidebarItemBackgroundColorSelected, sidebarItemTextColor, sidebarItemTextColorSelected, sidebarItemSubtitleColor, sidebarItemTimeColor, mainBackgroundColor, headerBackgroundColor, headerBorderColor, headerTitleColor, messageBubbleBackgroundColorOwn, messageBubbleBackgroundColorOther, messageBubbleTextColorOwn, messageBubbleTextColorOther, messageTimeColor, messageStatusColor, attachmentBackgroundColorOwn, attachmentBackgroundColorOther, footerBackgroundColor, footerBorderColor, inputBackgroundColor, inputBorderColor, unreadNotificationBackgroundColor, unreadNotificationTextColor, typingIndicatorColor, dateSeparatorColor, dateSeparatorBackgroundColor, borderRadius, errorColor } } = themeRef.value;
|
|
164
172
|
return {
|
|
@@ -226,11 +234,35 @@ export default defineComponent({
|
|
|
226
234
|
}
|
|
227
235
|
return [];
|
|
228
236
|
});
|
|
237
|
+
const lastUnreadCounts = ref({});
|
|
238
|
+
watch(() => props.chatItems, (chatItems) => {
|
|
239
|
+
if (!chatItems)
|
|
240
|
+
return;
|
|
241
|
+
chatItems.forEach((chatItem) => {
|
|
242
|
+
const chatId = chatItem.id;
|
|
243
|
+
const currentUnreadCount = chatItem.unreadCount || 0;
|
|
244
|
+
const lastUnreadCount = lastUnreadCounts.value[chatId] || 0;
|
|
245
|
+
if (currentUnreadCount > lastUnreadCount) {
|
|
246
|
+
const newSet = new Set(notificationsShownSet.value);
|
|
247
|
+
newSet.delete(chatId);
|
|
248
|
+
notificationsShownSet.value = newSet;
|
|
249
|
+
}
|
|
250
|
+
lastUnreadCounts.value[chatId] = currentUnreadCount;
|
|
251
|
+
});
|
|
252
|
+
}, { deep: true, immediate: true });
|
|
253
|
+
const unreadCountsBeforeRead = ref({});
|
|
229
254
|
const handleChatSelect = (chatId) => {
|
|
230
255
|
var _a, _b;
|
|
256
|
+
const previousChatId = uncontrolledSelectedChatIdRef.value;
|
|
257
|
+
if (previousChatId !== undefined && previousChatId !== chatId) {
|
|
258
|
+
emit('mark-messages-read', previousChatId);
|
|
259
|
+
}
|
|
260
|
+
const selectedItem = (_a = props.chatItems) === null || _a === void 0 ? void 0 : _a.find((item) => item.id === chatId);
|
|
261
|
+
const unreadCountBeforeRead = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.unreadCount) || 0;
|
|
262
|
+
unreadCountsBeforeRead.value[chatId] = unreadCountBeforeRead;
|
|
231
263
|
uncontrolledSelectedChatIdRef.value = chatId;
|
|
232
264
|
emit('update:selectedChatId', chatId);
|
|
233
|
-
|
|
265
|
+
emit('mark-messages-read', chatId);
|
|
234
266
|
if (selectedItem) {
|
|
235
267
|
(_b = props.onChatSelect) === null || _b === void 0 ? void 0 : _b.call(props, chatId, selectedItem);
|
|
236
268
|
}
|
|
@@ -282,8 +314,10 @@ export default defineComponent({
|
|
|
282
314
|
const mergedRetryTextRef = computed(() => { var _a; return (_a = props.retryText) !== null && _a !== void 0 ? _a : localeRef.value.retryText; });
|
|
283
315
|
const mergedTypingTextRef = computed(() => { var _a; return (_a = props.typingText) !== null && _a !== void 0 ? _a : localeRef.value.typingText; });
|
|
284
316
|
const mergedCloseButtonTextRef = computed(() => { var _a; return (_a = props.closeButtonText) !== null && _a !== void 0 ? _a : localeRef.value.closeButtonText; });
|
|
317
|
+
const mergedUnreadNotificationTextRef = computed(() => { var _a; return (_a = props.unreadNotificationText) !== null && _a !== void 0 ? _a : localeRef.value.unreadNotificationText; });
|
|
285
318
|
provide(chatInjectionKey, {
|
|
286
319
|
mergedClsPrefixRef,
|
|
320
|
+
mergedThemeRef: themeRef,
|
|
287
321
|
chatItemsRef: toRef(props, 'chatItems'),
|
|
288
322
|
selectedChatIdRef: mergedSelectedChatIdRef,
|
|
289
323
|
selectedChatRef,
|
|
@@ -313,6 +347,10 @@ export default defineComponent({
|
|
|
313
347
|
retryTextRef: mergedRetryTextRef,
|
|
314
348
|
typingTextRef: mergedTypingTextRef,
|
|
315
349
|
closeButtonTextRef: mergedCloseButtonTextRef,
|
|
350
|
+
unreadNotificationTextRef: mergedUnreadNotificationTextRef,
|
|
351
|
+
notificationsShownSetRef: notificationsShownSet,
|
|
352
|
+
unreadCountsBeforeReadRef: unreadCountsBeforeRead,
|
|
353
|
+
markNotificationShown,
|
|
316
354
|
handleChatSelect,
|
|
317
355
|
handleMessageSend,
|
|
318
356
|
handleMessageRetry,
|
|
@@ -346,17 +384,19 @@ export default defineComponent({
|
|
|
346
384
|
}
|
|
347
385
|
: {};
|
|
348
386
|
return (h("div", { class: [`${this.mergedClsPrefix}-chat`, this.themeClass], style: Object.assign(Object.assign({}, maxHeightStyle), this.cssVars) },
|
|
349
|
-
h(UFlex, { wrap: false, size: [20, 20], style: { width: '100%' } },
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
387
|
+
h(UFlex, { wrap: false, size: [20, 20], style: { width: '100%' } }, {
|
|
388
|
+
default: () => (h(Fragment, null,
|
|
389
|
+
resolveSlot($slots.sidebar, () => [
|
|
390
|
+
h(ChatSidebar, null, {
|
|
391
|
+
sidebarHeaderMain: $slots.sidebarHeaderMain,
|
|
392
|
+
sidebarHeaderActions: $slots.sidebarHeaderActions
|
|
393
|
+
})
|
|
394
|
+
]),
|
|
395
|
+
resolveSlot($slots.default, () => [
|
|
396
|
+
h(ChatMainArea, null, {
|
|
397
|
+
headerActions: $slots.headerActions
|
|
398
|
+
})
|
|
399
|
+
])))
|
|
400
|
+
})));
|
|
361
401
|
}
|
|
362
402
|
});
|