@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.
Files changed (97) hide show
  1. package/dist/index.js +1673 -996
  2. package/dist/index.prod.js +3 -3
  3. package/es/chat/index.d.ts +6 -1
  4. package/es/chat/index.js +3 -0
  5. package/es/chat/src/Chat.d.ts +19 -6
  6. package/es/chat/src/Chat.js +54 -14
  7. package/es/chat/src/ChatListItems.d.ts +7782 -0
  8. package/es/chat/src/ChatListItems.js +188 -0
  9. package/es/chat/src/ChatMessages.d.ts +7805 -0
  10. package/es/chat/src/ChatMessages.js +325 -0
  11. package/es/chat/src/ChatParts/ChatAttachment.js +4 -3
  12. package/es/chat/src/ChatParts/MainArea.d.ts +0 -2
  13. package/es/chat/src/ChatParts/MainArea.js +108 -229
  14. package/es/chat/src/ChatParts/Sidebar.js +16 -80
  15. package/es/chat/src/interface.d.ts +10 -1
  16. package/es/chat/src/styles/index.cssr.js +16 -16
  17. package/es/chat/styles/light.d.ts +1 -1
  18. package/es/chat/styles/light.js +15 -3
  19. package/es/locales/common/arDZ.js +2 -1
  20. package/es/locales/common/deDE.js +2 -1
  21. package/es/locales/common/enGB.js +2 -1
  22. package/es/locales/common/enUS.d.ts +1 -0
  23. package/es/locales/common/enUS.js +2 -1
  24. package/es/locales/common/eo.js +2 -1
  25. package/es/locales/common/esAR.js +2 -1
  26. package/es/locales/common/faIR.js +2 -1
  27. package/es/locales/common/frFR.js +2 -1
  28. package/es/locales/common/idID.js +2 -1
  29. package/es/locales/common/itIT.js +2 -1
  30. package/es/locales/common/jaJP.js +2 -1
  31. package/es/locales/common/koKR.js +2 -1
  32. package/es/locales/common/nbNO.js +2 -1
  33. package/es/locales/common/nlNL.js +2 -1
  34. package/es/locales/common/plPL.js +2 -1
  35. package/es/locales/common/ptBR.js +2 -1
  36. package/es/locales/common/ruRU.js +2 -1
  37. package/es/locales/common/skSK.js +2 -1
  38. package/es/locales/common/svSE.js +2 -1
  39. package/es/locales/common/thTH.js +2 -1
  40. package/es/locales/common/trTR.js +2 -1
  41. package/es/locales/common/ukUA.js +2 -1
  42. package/es/locales/common/viVN.js +2 -1
  43. package/es/locales/common/zhCN.js +2 -1
  44. package/es/locales/common/zhTW.js +2 -1
  45. package/es/version.d.ts +1 -1
  46. package/es/version.js +1 -1
  47. package/lib/chat/index.d.ts +6 -1
  48. package/lib/chat/index.js +9 -1
  49. package/lib/chat/src/Chat.d.ts +19 -6
  50. package/lib/chat/src/Chat.js +53 -13
  51. package/lib/chat/src/ChatListItems.d.ts +7782 -0
  52. package/lib/chat/src/ChatListItems.js +194 -0
  53. package/lib/chat/src/ChatMessages.d.ts +7805 -0
  54. package/lib/chat/src/ChatMessages.js +331 -0
  55. package/lib/chat/src/ChatParts/ChatAttachment.js +4 -3
  56. package/lib/chat/src/ChatParts/MainArea.d.ts +0 -2
  57. package/lib/chat/src/ChatParts/MainArea.js +107 -228
  58. package/lib/chat/src/ChatParts/Sidebar.js +17 -78
  59. package/lib/chat/src/interface.d.ts +10 -1
  60. package/lib/chat/src/styles/index.cssr.js +16 -16
  61. package/lib/chat/styles/light.d.ts +1 -1
  62. package/lib/chat/styles/light.js +15 -3
  63. package/lib/locales/common/arDZ.js +2 -1
  64. package/lib/locales/common/deDE.js +2 -1
  65. package/lib/locales/common/enGB.js +2 -1
  66. package/lib/locales/common/enUS.d.ts +1 -0
  67. package/lib/locales/common/enUS.js +2 -1
  68. package/lib/locales/common/eo.js +2 -1
  69. package/lib/locales/common/esAR.js +2 -1
  70. package/lib/locales/common/faIR.js +2 -1
  71. package/lib/locales/common/frFR.js +2 -1
  72. package/lib/locales/common/idID.js +2 -1
  73. package/lib/locales/common/itIT.js +2 -1
  74. package/lib/locales/common/jaJP.js +2 -1
  75. package/lib/locales/common/koKR.js +2 -1
  76. package/lib/locales/common/nbNO.js +2 -1
  77. package/lib/locales/common/nlNL.js +2 -1
  78. package/lib/locales/common/plPL.js +2 -1
  79. package/lib/locales/common/ptBR.js +2 -1
  80. package/lib/locales/common/ruRU.js +2 -1
  81. package/lib/locales/common/skSK.js +2 -1
  82. package/lib/locales/common/svSE.js +2 -1
  83. package/lib/locales/common/thTH.js +2 -1
  84. package/lib/locales/common/trTR.js +2 -1
  85. package/lib/locales/common/ukUA.js +2 -1
  86. package/lib/locales/common/viVN.js +2 -1
  87. package/lib/locales/common/zhCN.js +2 -1
  88. package/lib/locales/common/zhTW.js +2 -1
  89. package/lib/version.d.ts +1 -1
  90. package/lib/version.js +1 -1
  91. package/package.json +1 -1
  92. package/volar.d.ts +2 -0
  93. package/web-types.json +149 -1
  94. package/es/chat/src/ChatGlobalState.d.ts +0 -13
  95. package/es/chat/src/ChatGlobalState.js +0 -32
  96. package/lib/chat/src/ChatGlobalState.d.ts +0 -13
  97. package/lib/chat/src/ChatGlobalState.js +0 -36
@@ -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
- const selectedItem = (_a = props.chatItems) === null || _a === void 0 ? void 0 : _a.find((item) => item.id === chatId);
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, _utils_1.resolveSlot)($slots.sidebar, () => [
357
- (0, vue_1.h)(Sidebar_1.default, null, {
358
- sidebarHeaderMain: $slots.sidebarHeaderMain,
359
- sidebarHeaderActions: $slots.sidebarHeaderActions
360
- })
361
- ]),
362
- (0, _utils_1.resolveSlot)($slots.default, () => [
363
- (0, vue_1.h)(MainArea_1.default, null, {
364
- headerActions: $slots.headerActions
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
  });