@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/lib/chat/src/Chat.js
CHANGED
|
@@ -97,6 +97,9 @@ exports.chatProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), {
|
|
|
97
97
|
}, closeButtonText: {
|
|
98
98
|
type: String,
|
|
99
99
|
default: undefined
|
|
100
|
+
}, unreadNotificationText: {
|
|
101
|
+
type: String,
|
|
102
|
+
default: undefined
|
|
100
103
|
}, chatItemsLoading: {
|
|
101
104
|
type: Boolean,
|
|
102
105
|
default: false
|
|
@@ -165,6 +168,11 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
165
168
|
const { mergedClsPrefixRef } = (0, _mixins_1.useConfig)(props);
|
|
166
169
|
const themeRef = (0, _mixins_1.useTheme)('Chat', '-chat', index_cssr_1.default, styles_1.chatLight, props, mergedClsPrefixRef);
|
|
167
170
|
const { localeRef } = (0, _mixins_1.useLocale)('Chat');
|
|
171
|
+
const notificationsShownSet = (0, vue_1.ref)(new Set());
|
|
172
|
+
const markNotificationShown = (chatId) => {
|
|
173
|
+
notificationsShownSet.value.add(chatId);
|
|
174
|
+
notificationsShownSet.value = new Set(notificationsShownSet.value);
|
|
175
|
+
};
|
|
168
176
|
const cssVarsRef = (0, vue_1.computed)(() => {
|
|
169
177
|
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;
|
|
170
178
|
return {
|
|
@@ -232,11 +240,35 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
232
240
|
}
|
|
233
241
|
return [];
|
|
234
242
|
});
|
|
243
|
+
const lastUnreadCounts = (0, vue_1.ref)({});
|
|
244
|
+
(0, vue_1.watch)(() => props.chatItems, (chatItems) => {
|
|
245
|
+
if (!chatItems)
|
|
246
|
+
return;
|
|
247
|
+
chatItems.forEach((chatItem) => {
|
|
248
|
+
const chatId = chatItem.id;
|
|
249
|
+
const currentUnreadCount = chatItem.unreadCount || 0;
|
|
250
|
+
const lastUnreadCount = lastUnreadCounts.value[chatId] || 0;
|
|
251
|
+
if (currentUnreadCount > lastUnreadCount) {
|
|
252
|
+
const newSet = new Set(notificationsShownSet.value);
|
|
253
|
+
newSet.delete(chatId);
|
|
254
|
+
notificationsShownSet.value = newSet;
|
|
255
|
+
}
|
|
256
|
+
lastUnreadCounts.value[chatId] = currentUnreadCount;
|
|
257
|
+
});
|
|
258
|
+
}, { deep: true, immediate: true });
|
|
259
|
+
const unreadCountsBeforeRead = (0, vue_1.ref)({});
|
|
235
260
|
const handleChatSelect = (chatId) => {
|
|
236
261
|
var _a, _b;
|
|
262
|
+
const previousChatId = uncontrolledSelectedChatIdRef.value;
|
|
263
|
+
if (previousChatId !== undefined && previousChatId !== chatId) {
|
|
264
|
+
emit('mark-messages-read', previousChatId);
|
|
265
|
+
}
|
|
266
|
+
const selectedItem = (_a = props.chatItems) === null || _a === void 0 ? void 0 : _a.find((item) => item.id === chatId);
|
|
267
|
+
const unreadCountBeforeRead = (selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.unreadCount) || 0;
|
|
268
|
+
unreadCountsBeforeRead.value[chatId] = unreadCountBeforeRead;
|
|
237
269
|
uncontrolledSelectedChatIdRef.value = chatId;
|
|
238
270
|
emit('update:selectedChatId', chatId);
|
|
239
|
-
|
|
271
|
+
emit('mark-messages-read', chatId);
|
|
240
272
|
if (selectedItem) {
|
|
241
273
|
(_b = props.onChatSelect) === null || _b === void 0 ? void 0 : _b.call(props, chatId, selectedItem);
|
|
242
274
|
}
|
|
@@ -288,8 +320,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
288
320
|
const mergedRetryTextRef = (0, vue_1.computed)(() => { var _a; return (_a = props.retryText) !== null && _a !== void 0 ? _a : localeRef.value.retryText; });
|
|
289
321
|
const mergedTypingTextRef = (0, vue_1.computed)(() => { var _a; return (_a = props.typingText) !== null && _a !== void 0 ? _a : localeRef.value.typingText; });
|
|
290
322
|
const mergedCloseButtonTextRef = (0, vue_1.computed)(() => { var _a; return (_a = props.closeButtonText) !== null && _a !== void 0 ? _a : localeRef.value.closeButtonText; });
|
|
323
|
+
const mergedUnreadNotificationTextRef = (0, vue_1.computed)(() => { var _a; return (_a = props.unreadNotificationText) !== null && _a !== void 0 ? _a : localeRef.value.unreadNotificationText; });
|
|
291
324
|
(0, vue_1.provide)(interface_1.chatInjectionKey, {
|
|
292
325
|
mergedClsPrefixRef,
|
|
326
|
+
mergedThemeRef: themeRef,
|
|
293
327
|
chatItemsRef: (0, vue_1.toRef)(props, 'chatItems'),
|
|
294
328
|
selectedChatIdRef: mergedSelectedChatIdRef,
|
|
295
329
|
selectedChatRef,
|
|
@@ -319,6 +353,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
319
353
|
retryTextRef: mergedRetryTextRef,
|
|
320
354
|
typingTextRef: mergedTypingTextRef,
|
|
321
355
|
closeButtonTextRef: mergedCloseButtonTextRef,
|
|
356
|
+
unreadNotificationTextRef: mergedUnreadNotificationTextRef,
|
|
357
|
+
notificationsShownSetRef: notificationsShownSet,
|
|
358
|
+
unreadCountsBeforeReadRef: unreadCountsBeforeRead,
|
|
359
|
+
markNotificationShown,
|
|
322
360
|
handleChatSelect,
|
|
323
361
|
handleMessageSend,
|
|
324
362
|
handleMessageRetry,
|
|
@@ -352,17 +390,19 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
352
390
|
}
|
|
353
391
|
: {};
|
|
354
392
|
return ((0, vue_1.h)("div", { class: [`${this.mergedClsPrefix}-chat`, this.themeClass], style: Object.assign(Object.assign({}, maxHeightStyle), this.cssVars) },
|
|
355
|
-
(0, vue_1.h)(flex_1.UFlex, { wrap: false, size: [20, 20], style: { width: '100%' } },
|
|
356
|
-
(0,
|
|
357
|
-
(0,
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
(0,
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
393
|
+
(0, vue_1.h)(flex_1.UFlex, { wrap: false, size: [20, 20], style: { width: '100%' } }, {
|
|
394
|
+
default: () => ((0, vue_1.h)(vue_1.Fragment, null,
|
|
395
|
+
(0, _utils_1.resolveSlot)($slots.sidebar, () => [
|
|
396
|
+
(0, vue_1.h)(Sidebar_1.default, null, {
|
|
397
|
+
sidebarHeaderMain: $slots.sidebarHeaderMain,
|
|
398
|
+
sidebarHeaderActions: $slots.sidebarHeaderActions
|
|
399
|
+
})
|
|
400
|
+
]),
|
|
401
|
+
(0, _utils_1.resolveSlot)($slots.default, () => [
|
|
402
|
+
(0, vue_1.h)(MainArea_1.default, null, {
|
|
403
|
+
headerActions: $slots.headerActions
|
|
404
|
+
})
|
|
405
|
+
])))
|
|
406
|
+
})));
|
|
367
407
|
}
|
|
368
408
|
});
|