@uzum-tech/ui 1.9.0 → 1.10.0

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 (249) hide show
  1. package/dist/index.js +5789 -1014
  2. package/dist/index.prod.js +12 -3
  3. package/es/_internal/scrollbar/src/Scrollbar.js +19 -38
  4. package/es/auto-complete/src/AutoComplete.d.ts +1 -1
  5. package/es/cascader/src/Cascader.d.ts +1 -1
  6. package/es/chat/index.d.ts +1 -1
  7. package/es/chat/src/Chat.d.ts +233 -11
  8. package/es/chat/src/Chat.js +73 -22
  9. package/es/chat/src/ChatParts/ChatAttachment.js +14 -12
  10. package/es/chat/src/ChatParts/MainArea.d.ts +1 -0
  11. package/es/chat/src/ChatParts/MainArea.js +95 -57
  12. package/es/chat/src/ChatParts/Sidebar.d.ts +920 -0
  13. package/es/chat/src/ChatParts/Sidebar.js +63 -12
  14. package/es/chat/src/interface.d.ts +24 -3
  15. package/es/chat/src/styles/index.cssr.js +13 -2
  16. package/es/components.d.ts +2 -0
  17. package/es/components.js +2 -0
  18. package/es/config-provider/src/internal-interface.d.ts +4 -0
  19. package/es/crop/index.d.ts +3 -0
  20. package/es/crop/index.js +1 -0
  21. package/es/crop/src/Crop.d.ts +222 -0
  22. package/es/crop/src/Crop.js +157 -0
  23. package/es/crop/src/interface.d.ts +6 -0
  24. package/es/crop/src/interface.js +7 -0
  25. package/es/crop/src/styles/index.cssr.d.ts +2 -0
  26. package/es/crop/src/styles/index.cssr.js +333 -0
  27. package/es/crop/styles/_common.d.ts +4 -0
  28. package/es/crop/styles/_common.js +3 -0
  29. package/es/crop/styles/dark.d.ts +3 -0
  30. package/es/crop/styles/dark.js +9 -0
  31. package/es/crop/styles/index.d.ts +3 -0
  32. package/es/crop/styles/index.js +2 -0
  33. package/es/crop/styles/light.d.ts +14 -0
  34. package/es/crop/styles/light.js +14 -0
  35. package/es/date-picker/src/DatePicker.d.ts +1308 -43
  36. package/es/date-picker/src/DatePicker.js +54 -29
  37. package/es/date-picker/src/interface.d.ts +1 -0
  38. package/es/date-picker/src/panel/date.d.ts +141 -0
  39. package/es/date-picker/src/panel/daterange.d.ts +141 -0
  40. package/es/date-picker/src/panel/datetime.d.ts +141 -0
  41. package/es/date-picker/src/panel/datetimerange.d.ts +141 -0
  42. package/es/date-picker/src/panel/panelMonth.d.ts +283 -1
  43. package/es/date-picker/src/panel/panelMonthContent.d.ts +141 -0
  44. package/es/date-picker/src/panel/panelYear.d.ts +283 -1
  45. package/es/date-picker/src/panel/panelYearContent.d.ts +141 -0
  46. package/es/date-picker/src/panel/use-calendar.d.ts +141 -0
  47. package/es/date-picker/src/panel/use-dual-calendar.d.ts +141 -0
  48. package/es/date-picker/src/panel/use-panel-common.d.ts +141 -0
  49. package/es/date-picker/styles/dark.js +3 -1
  50. package/es/date-picker/styles/light.d.ts +123 -0
  51. package/es/date-picker/styles/light.js +3 -1
  52. package/es/descriptions/src/Descriptions.d.ts +30 -0
  53. package/es/descriptions/src/Descriptions.js +18 -10
  54. package/es/dynamic-tags/src/DynamicTags.d.ts +30 -0
  55. package/es/dynamic-tags/styles/light.d.ts +3 -0
  56. package/es/infinite-scroll/src/InfiniteScroll.js +3 -6
  57. package/es/input/src/Input.d.ts +1 -1
  58. package/es/input-number/src/InputNumber.d.ts +1 -1
  59. package/es/legacy-transfer/src/Transfer.d.ts +1 -1
  60. package/es/locales/common/arDZ.js +2 -0
  61. package/es/locales/common/deDE.js +2 -0
  62. package/es/locales/common/enGB.js +2 -0
  63. package/es/locales/common/enUS.d.ts +2 -0
  64. package/es/locales/common/enUS.js +2 -0
  65. package/es/locales/common/eo.js +2 -0
  66. package/es/locales/common/esAR.js +2 -0
  67. package/es/locales/common/faIR.js +2 -0
  68. package/es/locales/common/frFR.js +2 -0
  69. package/es/locales/common/idID.js +2 -0
  70. package/es/locales/common/itIT.js +2 -0
  71. package/es/locales/common/jaJP.js +2 -0
  72. package/es/locales/common/koKR.js +2 -0
  73. package/es/locales/common/nbNO.js +2 -0
  74. package/es/locales/common/nlNL.js +2 -0
  75. package/es/locales/common/plPL.js +2 -0
  76. package/es/locales/common/ptBR.js +2 -0
  77. package/es/locales/common/ruRU.js +2 -0
  78. package/es/locales/common/skSK.js +2 -0
  79. package/es/locales/common/svSE.js +2 -0
  80. package/es/locales/common/thTH.js +2 -0
  81. package/es/locales/common/trTR.js +2 -0
  82. package/es/locales/common/ukUA.js +2 -0
  83. package/es/locales/common/viVN.js +2 -0
  84. package/es/locales/common/zhCN.js +2 -0
  85. package/es/locales/common/zhTW.js +2 -0
  86. package/es/modal-fullscreen/index.d.ts +2 -0
  87. package/es/modal-fullscreen/index.js +1 -0
  88. package/es/modal-fullscreen/src/ModalFull.d.ts +953 -0
  89. package/es/modal-fullscreen/src/ModalFull.js +250 -0
  90. package/es/modal-fullscreen/src/interface.d.ts +0 -0
  91. package/es/modal-fullscreen/src/interface.js +1 -0
  92. package/es/modal-fullscreen/src/styles/index.cssr.d.ts +2 -0
  93. package/es/modal-fullscreen/src/styles/index.cssr.js +85 -0
  94. package/es/modal-fullscreen/styles/_common.d.ts +12 -0
  95. package/es/modal-fullscreen/styles/_common.js +11 -0
  96. package/es/modal-fullscreen/styles/dark.d.ts +3 -0
  97. package/es/modal-fullscreen/styles/dark.js +14 -0
  98. package/es/modal-fullscreen/styles/index.d.ts +3 -0
  99. package/es/modal-fullscreen/styles/index.js +2 -0
  100. package/es/modal-fullscreen/styles/light.d.ts +100 -0
  101. package/es/modal-fullscreen/styles/light.js +19 -0
  102. package/es/rate/src/Rate.d.ts +1 -1
  103. package/es/select/src/Select.d.ts +1 -1
  104. package/es/slider/src/Slider.d.ts +1 -1
  105. package/es/switch/src/Switch.d.ts +1 -1
  106. package/es/tag/index.d.ts +2 -0
  107. package/es/tag/index.js +1 -0
  108. package/es/tag/src/Tag.d.ts +40 -0
  109. package/es/tag/src/Tag.js +3 -0
  110. package/es/tag/src/TagGroup.d.ts +644 -0
  111. package/es/tag/src/TagGroup.js +109 -0
  112. package/es/tag/src/styles/index.cssr.d.ts +1 -0
  113. package/es/tag/src/styles/index.cssr.js +8 -1
  114. package/es/tag/styles/light.d.ts +3 -0
  115. package/es/tag/styles/light.js +5 -0
  116. package/es/themes/dark.js +5 -1
  117. package/es/themes/light.js +5 -1
  118. package/es/time-picker/src/TimePicker.d.ts +1 -1
  119. package/es/transfer/src/Transfer.d.ts +1 -1
  120. package/es/tree-select/src/TreeSelect.d.ts +1 -1
  121. package/es/version.d.ts +1 -1
  122. package/es/version.js +1 -1
  123. package/es/virtual-list/index.d.ts +1 -1
  124. package/es/virtual-list/index.js +1 -1
  125. package/lib/_internal/scrollbar/src/Scrollbar.js +19 -38
  126. package/lib/auto-complete/src/AutoComplete.d.ts +1 -1
  127. package/lib/cascader/src/Cascader.d.ts +1 -1
  128. package/lib/chat/index.d.ts +1 -1
  129. package/lib/chat/src/Chat.d.ts +233 -11
  130. package/lib/chat/src/Chat.js +73 -22
  131. package/lib/chat/src/ChatParts/ChatAttachment.js +14 -12
  132. package/lib/chat/src/ChatParts/MainArea.d.ts +1 -0
  133. package/lib/chat/src/ChatParts/MainArea.js +94 -56
  134. package/lib/chat/src/ChatParts/Sidebar.d.ts +920 -0
  135. package/lib/chat/src/ChatParts/Sidebar.js +62 -11
  136. package/lib/chat/src/interface.d.ts +24 -3
  137. package/lib/chat/src/styles/index.cssr.js +13 -2
  138. package/lib/components.d.ts +2 -0
  139. package/lib/components.js +2 -0
  140. package/lib/config-provider/src/internal-interface.d.ts +4 -0
  141. package/lib/crop/index.d.ts +3 -0
  142. package/lib/crop/index.js +9 -0
  143. package/lib/crop/src/Crop.d.ts +222 -0
  144. package/lib/crop/src/Crop.js +163 -0
  145. package/lib/crop/src/interface.d.ts +6 -0
  146. package/lib/crop/src/interface.js +10 -0
  147. package/lib/crop/src/styles/index.cssr.d.ts +2 -0
  148. package/lib/crop/src/styles/index.cssr.js +338 -0
  149. package/lib/crop/styles/_common.d.ts +4 -0
  150. package/lib/crop/styles/_common.js +5 -0
  151. package/lib/crop/styles/dark.d.ts +3 -0
  152. package/lib/crop/styles/dark.js +11 -0
  153. package/lib/crop/styles/index.d.ts +3 -0
  154. package/lib/crop/styles/index.js +10 -0
  155. package/lib/crop/styles/light.d.ts +14 -0
  156. package/lib/crop/styles/light.js +21 -0
  157. package/lib/date-picker/src/DatePicker.d.ts +1308 -43
  158. package/lib/date-picker/src/DatePicker.js +53 -28
  159. package/lib/date-picker/src/interface.d.ts +1 -0
  160. package/lib/date-picker/src/panel/date.d.ts +141 -0
  161. package/lib/date-picker/src/panel/daterange.d.ts +141 -0
  162. package/lib/date-picker/src/panel/datetime.d.ts +141 -0
  163. package/lib/date-picker/src/panel/datetimerange.d.ts +141 -0
  164. package/lib/date-picker/src/panel/panelMonth.d.ts +283 -1
  165. package/lib/date-picker/src/panel/panelMonthContent.d.ts +141 -0
  166. package/lib/date-picker/src/panel/panelYear.d.ts +283 -1
  167. package/lib/date-picker/src/panel/panelYearContent.d.ts +141 -0
  168. package/lib/date-picker/src/panel/use-calendar.d.ts +141 -0
  169. package/lib/date-picker/src/panel/use-dual-calendar.d.ts +141 -0
  170. package/lib/date-picker/src/panel/use-panel-common.d.ts +141 -0
  171. package/lib/date-picker/styles/dark.js +3 -1
  172. package/lib/date-picker/styles/light.d.ts +123 -0
  173. package/lib/date-picker/styles/light.js +3 -1
  174. package/lib/descriptions/src/Descriptions.d.ts +30 -0
  175. package/lib/descriptions/src/Descriptions.js +18 -10
  176. package/lib/dynamic-tags/src/DynamicTags.d.ts +30 -0
  177. package/lib/dynamic-tags/styles/light.d.ts +3 -0
  178. package/lib/infinite-scroll/src/InfiniteScroll.js +3 -6
  179. package/lib/input/src/Input.d.ts +1 -1
  180. package/lib/input-number/src/InputNumber.d.ts +1 -1
  181. package/lib/legacy-transfer/src/Transfer.d.ts +1 -1
  182. package/lib/locales/common/arDZ.js +2 -0
  183. package/lib/locales/common/deDE.js +2 -0
  184. package/lib/locales/common/enGB.js +2 -0
  185. package/lib/locales/common/enUS.d.ts +2 -0
  186. package/lib/locales/common/enUS.js +2 -0
  187. package/lib/locales/common/eo.js +2 -0
  188. package/lib/locales/common/esAR.js +2 -0
  189. package/lib/locales/common/faIR.js +2 -0
  190. package/lib/locales/common/frFR.js +2 -0
  191. package/lib/locales/common/idID.js +2 -0
  192. package/lib/locales/common/itIT.js +2 -0
  193. package/lib/locales/common/jaJP.js +2 -0
  194. package/lib/locales/common/koKR.js +2 -0
  195. package/lib/locales/common/nbNO.js +2 -0
  196. package/lib/locales/common/nlNL.js +2 -0
  197. package/lib/locales/common/plPL.js +2 -0
  198. package/lib/locales/common/ptBR.js +2 -0
  199. package/lib/locales/common/ruRU.js +2 -0
  200. package/lib/locales/common/skSK.js +2 -0
  201. package/lib/locales/common/svSE.js +2 -0
  202. package/lib/locales/common/thTH.js +2 -0
  203. package/lib/locales/common/trTR.js +2 -0
  204. package/lib/locales/common/ukUA.js +2 -0
  205. package/lib/locales/common/viVN.js +2 -0
  206. package/lib/locales/common/zhCN.js +2 -0
  207. package/lib/locales/common/zhTW.js +2 -0
  208. package/lib/modal-fullscreen/index.d.ts +2 -0
  209. package/lib/modal-fullscreen/index.js +9 -0
  210. package/lib/modal-fullscreen/src/ModalFull.d.ts +953 -0
  211. package/lib/modal-fullscreen/src/ModalFull.js +256 -0
  212. package/lib/modal-fullscreen/src/interface.d.ts +0 -0
  213. package/lib/modal-fullscreen/src/interface.js +1 -0
  214. package/lib/modal-fullscreen/src/styles/index.cssr.d.ts +2 -0
  215. package/lib/modal-fullscreen/src/styles/index.cssr.js +90 -0
  216. package/lib/modal-fullscreen/styles/_common.d.ts +12 -0
  217. package/lib/modal-fullscreen/styles/_common.js +13 -0
  218. package/lib/modal-fullscreen/styles/dark.d.ts +3 -0
  219. package/lib/modal-fullscreen/styles/dark.js +16 -0
  220. package/lib/modal-fullscreen/styles/index.d.ts +3 -0
  221. package/lib/modal-fullscreen/styles/index.js +10 -0
  222. package/lib/modal-fullscreen/styles/light.d.ts +100 -0
  223. package/lib/modal-fullscreen/styles/light.js +26 -0
  224. package/lib/rate/src/Rate.d.ts +1 -1
  225. package/lib/select/src/Select.d.ts +1 -1
  226. package/lib/slider/src/Slider.d.ts +1 -1
  227. package/lib/switch/src/Switch.d.ts +1 -1
  228. package/lib/tag/index.d.ts +2 -0
  229. package/lib/tag/index.js +3 -1
  230. package/lib/tag/src/Tag.d.ts +40 -0
  231. package/lib/tag/src/Tag.js +3 -0
  232. package/lib/tag/src/TagGroup.d.ts +644 -0
  233. package/lib/tag/src/TagGroup.js +112 -0
  234. package/lib/tag/src/styles/index.cssr.d.ts +1 -0
  235. package/lib/tag/src/styles/index.cssr.js +9 -1
  236. package/lib/tag/styles/light.d.ts +3 -0
  237. package/lib/tag/styles/light.js +5 -0
  238. package/lib/themes/dark.js +5 -1
  239. package/lib/themes/light.js +5 -1
  240. package/lib/time-picker/src/TimePicker.d.ts +1 -1
  241. package/lib/transfer/src/Transfer.d.ts +1 -1
  242. package/lib/tree-select/src/TreeSelect.d.ts +1 -1
  243. package/lib/version.d.ts +1 -1
  244. package/lib/version.js +1 -1
  245. package/lib/virtual-list/index.d.ts +1 -1
  246. package/lib/virtual-list/index.js +2 -2
  247. package/package.json +4 -3
  248. package/volar.d.ts +4 -0
  249. package/web-types.json +472 -4
@@ -55,6 +55,21 @@ export const chatProps = Object.assign(Object.assign({}, useTheme.props), { chat
55
55
  }, headerIconProps: {
56
56
  type: Object,
57
57
  default: undefined
58
+ }, headerShareButtonProps: {
59
+ type: Object,
60
+ default: undefined
61
+ }, headerProfileButtonProps: {
62
+ type: Object,
63
+ default: undefined
64
+ }, headerCloseButtonProps: {
65
+ type: Object,
66
+ default: undefined
67
+ }, headerShareIconProps: {
68
+ type: Object,
69
+ default: undefined
70
+ }, headerProfileIconProps: {
71
+ type: Object,
72
+ default: undefined
58
73
  }, messageSenderAvatarProps: {
59
74
  type: Object,
60
75
  default: undefined
@@ -91,6 +106,12 @@ export const chatProps = Object.assign(Object.assign({}, useTheme.props), { chat
91
106
  }, closeButtonText: {
92
107
  type: String,
93
108
  default: undefined
109
+ }, shareButtonTooltip: {
110
+ type: String,
111
+ default: undefined
112
+ }, profileButtonTooltip: {
113
+ type: String,
114
+ default: undefined
94
115
  }, unreadNotificationText: {
95
116
  type: String,
96
117
  default: undefined
@@ -130,7 +151,7 @@ export const chatProps = Object.assign(Object.assign({}, useTheme.props), { chat
130
151
  }, onFilterChange: {
131
152
  type: Function,
132
153
  default: undefined
133
- }, onLoadMoreChats: {
154
+ }, onFooterInputChange: {
134
155
  type: Function,
135
156
  default: undefined
136
157
  }, onNetworkError: {
@@ -142,6 +163,18 @@ export const chatProps = Object.assign(Object.assign({}, useTheme.props), { chat
142
163
  }, onSendError: {
143
164
  type: Function,
144
165
  default: undefined
166
+ }, onChatItemsScrollToTop: {
167
+ type: Function,
168
+ default: undefined
169
+ }, onChatItemsScrollToBottom: {
170
+ type: Function,
171
+ default: undefined
172
+ }, onMessagesScrollToTop: {
173
+ type: Function,
174
+ default: undefined
175
+ }, onMessagesScrollToBottom: {
176
+ type: Function,
177
+ default: undefined
145
178
  } });
146
179
  export default defineComponent({
147
180
  name: 'Chat',
@@ -153,12 +186,16 @@ export default defineComponent({
153
186
  'attachment-upload',
154
187
  'mark-messages-read',
155
188
  'filter-change',
156
- 'load-more-chats',
189
+ 'footer-input-change',
157
190
  'network-error',
158
191
  'upload-error',
159
- 'send-error'
192
+ 'send-error',
193
+ 'chat-items-scroll-to-top',
194
+ 'chat-items-scroll-to-bottom',
195
+ 'messages-scroll-to-top',
196
+ 'messages-scroll-to-bottom'
160
197
  ],
161
- setup(props, { slots, emit }) {
198
+ setup(props, { slots, emit, expose }) {
162
199
  const { mergedClsPrefixRef } = useConfig(props);
163
200
  const themeRef = useTheme('Chat', '-chat', style, chatLight, props, mergedClsPrefixRef);
164
201
  const { localeRef } = useLocale('Chat');
@@ -271,37 +308,25 @@ export default defineComponent({
271
308
  emit('message-send', content, attachments);
272
309
  };
273
310
  const handleMessageRetry = (message) => {
274
- var _a;
275
311
  emit('message-retry', message);
276
- (_a = props.onMessageRetry) === null || _a === void 0 ? void 0 : _a.call(props, message);
277
312
  };
278
313
  const markMessagesAsRead = (chatId) => {
279
314
  emit('mark-messages-read', chatId);
280
315
  };
281
316
  const handleFilterChange = (filter) => {
282
- var _a;
283
317
  emit('filter-change', filter);
284
- (_a = props.onFilterChange) === null || _a === void 0 ? void 0 : _a.call(props, filter);
285
318
  };
286
- const handleLoadMoreChats = (offset, limit) => {
287
- var _a;
288
- emit('load-more-chats', { offset, limit });
289
- (_a = props.onLoadMoreChats) === null || _a === void 0 ? void 0 : _a.call(props, offset, limit);
319
+ const handleFooterInputChange = (value, chatId) => {
320
+ emit('footer-input-change', value, chatId);
290
321
  };
291
322
  const handleNetworkError = (error) => {
292
- var _a;
293
323
  emit('network-error', error);
294
- (_a = props.onNetworkError) === null || _a === void 0 ? void 0 : _a.call(props, error);
295
324
  };
296
325
  const handleUploadError = (error) => {
297
- var _a;
298
326
  emit('upload-error', error);
299
- (_a = props.onUploadError) === null || _a === void 0 ? void 0 : _a.call(props, error);
300
327
  };
301
328
  const handleSendError = (error) => {
302
- var _a;
303
329
  emit('send-error', error);
304
- (_a = props.onSendError) === null || _a === void 0 ? void 0 : _a.call(props, error);
305
330
  };
306
331
  const mergedInputPlaceholderRef = computed(() => {
307
332
  var _a;
@@ -314,6 +339,8 @@ export default defineComponent({
314
339
  const mergedRetryTextRef = computed(() => { var _a; return (_a = props.retryText) !== null && _a !== void 0 ? _a : localeRef.value.retryText; });
315
340
  const mergedTypingTextRef = computed(() => { var _a; return (_a = props.typingText) !== null && _a !== void 0 ? _a : localeRef.value.typingText; });
316
341
  const mergedCloseButtonTextRef = computed(() => { var _a; return (_a = props.closeButtonText) !== null && _a !== void 0 ? _a : localeRef.value.closeButtonText; });
342
+ const mergedShareButtonTooltipRef = computed(() => { var _a; return (_a = props.shareButtonTooltip) !== null && _a !== void 0 ? _a : localeRef.value.shareButtonTooltip; });
343
+ const mergedProfileButtonTooltipRef = computed(() => { var _a; return (_a = props.profileButtonTooltip) !== null && _a !== void 0 ? _a : localeRef.value.profileButtonTooltip; });
317
344
  const mergedUnreadNotificationTextRef = computed(() => { var _a; return (_a = props.unreadNotificationText) !== null && _a !== void 0 ? _a : localeRef.value.unreadNotificationText; });
318
345
  provide(chatInjectionKey, {
319
346
  mergedClsPrefixRef,
@@ -335,6 +362,11 @@ export default defineComponent({
335
362
  emptyPropsRef: toRef(props, 'emptyProps'),
336
363
  headerButtonPropsRef: toRef(props, 'headerButtonProps'),
337
364
  headerIconPropsRef: toRef(props, 'headerIconProps'),
365
+ headerShareButtonPropsRef: toRef(props, 'headerShareButtonProps'),
366
+ headerProfileButtonPropsRef: toRef(props, 'headerProfileButtonProps'),
367
+ headerCloseButtonPropsRef: toRef(props, 'headerCloseButtonProps'),
368
+ headerShareIconPropsRef: toRef(props, 'headerShareIconProps'),
369
+ headerProfileIconPropsRef: toRef(props, 'headerProfileIconProps'),
338
370
  messageSenderAvatarPropsRef: toRef(props, 'messageSenderAvatarProps'),
339
371
  messageUploadPropsRef: toRef(props, 'messageUploadProps'),
340
372
  messageButtonPropsRef: toRef(props, 'messageButtonProps'),
@@ -347,6 +379,8 @@ export default defineComponent({
347
379
  retryTextRef: mergedRetryTextRef,
348
380
  typingTextRef: mergedTypingTextRef,
349
381
  closeButtonTextRef: mergedCloseButtonTextRef,
382
+ shareButtonTooltipRef: mergedShareButtonTooltipRef,
383
+ profileButtonTooltipRef: mergedProfileButtonTooltipRef,
350
384
  unreadNotificationTextRef: mergedUnreadNotificationTextRef,
351
385
  notificationsShownSetRef: notificationsShownSet,
352
386
  unreadCountsBeforeReadRef: unreadCountsBeforeRead,
@@ -356,20 +390,37 @@ export default defineComponent({
356
390
  handleMessageRetry,
357
391
  markMessagesAsRead,
358
392
  handleFilterChange,
359
- handleLoadMoreChats,
393
+ handleFooterInputChange,
360
394
  handleNetworkError,
361
395
  handleUploadError,
362
396
  handleSendError,
363
397
  onChatClose: toRef(props, 'onChatClose'),
364
398
  onChatShare: toRef(props, 'onChatShare'),
365
- onUserProfile: toRef(props, 'onUserProfile')
399
+ onUserProfile: toRef(props, 'onUserProfile'),
400
+ onChatItemsScrollToTop: toRef(props, 'onChatItemsScrollToTop'),
401
+ onChatItemsScrollToBottom: toRef(props, 'onChatItemsScrollToBottom'),
402
+ onMessagesScrollToTop: toRef(props, 'onMessagesScrollToTop'),
403
+ onMessagesScrollToBottom: toRef(props, 'onMessagesScrollToBottom')
404
+ });
405
+ const mainAreaRef = ref(null);
406
+ const scrollToBottom = () => {
407
+ var _a;
408
+ (_a = mainAreaRef.value) === null || _a === void 0 ? void 0 : _a.scrollToBottom();
409
+ };
410
+ const sendMessage = (content, attachments) => {
411
+ handleMessageSend(content, attachments);
412
+ };
413
+ expose({
414
+ scrollToBottom,
415
+ sendMessage
366
416
  });
367
417
  return {
368
418
  mergedClsPrefix: mergedClsPrefixRef,
369
419
  mergedTheme: themeRef,
370
420
  cssVars: cssVarsRef,
371
421
  themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
372
- onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
422
+ onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender,
423
+ mainAreaRef
373
424
  };
374
425
  },
375
426
  render() {
@@ -392,7 +443,7 @@ export default defineComponent({
392
443
  ]),
393
444
  this.selectedChatId &&
394
445
  resolveSlot($slots.default, () => [
395
- h(ChatMainArea, null, {
446
+ h(ChatMainArea, { ref: "mainAreaRef" }, {
396
447
  headerActions: $slots.headerActions
397
448
  })
398
449
  ])))
@@ -21,21 +21,21 @@ export default defineComponent({
21
21
  }
22
22
  },
23
23
  setup(props, { slots }) {
24
- const getThumbnailUrl = (att) => {
25
- const url = [att.preview, att.thumbnail].find((value) => typeof value === 'string');
24
+ const getThumbnailUrl = (attachment) => {
25
+ const url = [attachment.preview, attachment.thumbnail].find((value) => typeof value === 'string');
26
26
  return url !== null && url !== void 0 ? url : null;
27
27
  };
28
28
  const renderAttachment = () => {
29
- const fileList = props.attachments.map((att, index) => {
29
+ const fileList = props.attachments.map((attachment, index) => {
30
30
  var _a, _b, _c;
31
31
  return ({
32
32
  id: `${String(props.message.id)}-attachment-${index}`,
33
- name: att.name,
34
- status: att.status || 'finished',
35
- percentage: (_a = att.percentage) !== null && _a !== void 0 ? _a : null,
36
- url: (_b = att.url) !== null && _b !== void 0 ? _b : null,
37
- thumbnailUrl: getThumbnailUrl(att),
38
- type: (_c = att.type) !== null && _c !== void 0 ? _c : null,
33
+ name: attachment.name,
34
+ status: attachment.status || 'finished',
35
+ percentage: (_a = attachment.percentage) !== null && _a !== void 0 ? _a : null,
36
+ url: (_b = attachment.url) !== null && _b !== void 0 ? _b : null,
37
+ thumbnailUrl: getThumbnailUrl(attachment),
38
+ type: (_c = attachment.type) !== null && _c !== void 0 ? _c : null,
39
39
  file: null,
40
40
  batchId: null
41
41
  });
@@ -47,7 +47,9 @@ export default defineComponent({
47
47
  gap: '2px',
48
48
  marginTop: '0'
49
49
  }
50
- : undefined, showRemoveButton: false, showDownloadButton: props.attachments.some((att) => att.status === 'finished'), showRetryButton: props.attachments.some((att) => att.status === 'error') }, props.uploadProps), {
50
+ : undefined, showRemoveButton: false, showDownloadButton: props.attachments.some((attachment) => attachment.status === 'finished' &&
51
+ attachment.url &&
52
+ attachment.url !== '#'), showRetryButton: props.attachments.some((attachment) => attachment.status === 'error') }, props.uploadProps), {
51
53
  default: () => (h(UUploadFileList, null, {
52
54
  'upload-file-title': slots['upload-file-title']
53
55
  ? ({ file }) => { var _a; return (_a = slots['upload-file-title']) === null || _a === void 0 ? void 0 : _a.call(slots, file); }
@@ -56,8 +58,8 @@ export default defineComponent({
56
58
  ? ({ file }) => { var _a; return (_a = slots['upload-file-subtitle']) === null || _a === void 0 ? void 0 : _a.call(slots, file); }
57
59
  : ({ file }) => {
58
60
  var _a;
59
- const att = props.attachments.find((a) => a.name === file.name);
60
- return (h("span", { style: { fontSize: '12px', color: '#999' } }, (att === null || att === void 0 ? void 0 : att.size) || ((_a = file.file) === null || _a === void 0 ? void 0 : _a.size)));
61
+ const attachment = props.attachments.find((attachment) => attachment.name === file.name);
62
+ return (h("span", { style: { fontSize: '12px', color: '#999' } }, (attachment === null || attachment === void 0 ? void 0 : attachment.size) || ((_a = file.file) === null || _a === void 0 ? void 0 : _a.size)));
61
63
  }
62
64
  }))
63
65
  }));
@@ -8,6 +8,7 @@ declare const _default: import("vue").DefineComponent<{}, {
8
8
  inputRef: import("vue").Ref<HTMLInputElement | undefined>;
9
9
  inputValue: import("vue").Ref<string>;
10
10
  handleSendMessage: () => Promise<void>;
11
+ handleMessagesScroll: (e: Event) => void;
11
12
  scrollToBottom: () => void;
12
13
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
13
14
  export default _default;
@@ -7,30 +7,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { h, defineComponent, inject, computed, ref, watch, nextTick, onMounted, Fragment } from 'vue';
10
+ import { h, defineComponent, inject, computed, ref, watch, nextTick, Fragment } from 'vue';
11
11
  import { MessageStatus, ChatMessageType, chatInjectionKey } from '../interface';
12
12
  import { UInput } from '../../../input';
13
13
  import { UButton } from '../../../button';
14
14
  import { UIcon } from '../../../icon';
15
15
  import { UScrollbar } from '../../../scrollbar';
16
+ import { UTooltip } from '../../../tooltip';
16
17
  import { UUpload, UUploadTrigger } from '../../../upload';
17
18
  import { UFlex } from '../../../flex';
18
19
  import { resolveSlot } from '../../../_utils';
19
20
  import { UText } from '../../../typography';
20
21
  import UChatMessages from '../ChatMessages';
21
22
  import { ArrowHookUpRight, PersonNote, AttachIcon } from '../../../_internal/icons';
22
- const SCROLL_DELAY = 50;
23
23
  const SENDING_DELAY = 100;
24
24
  export default defineComponent({
25
25
  name: 'ChatMainArea',
26
26
  setup(_, { slots }) {
27
- const { mergedClsPrefixRef, mergedThemeRef, selectedChatRef, messagesRef, typingChatIdsRef, messagesLoadingRef, messagesLoadingCountRef, headerButtonPropsRef, headerIconPropsRef, messageUploadPropsRef, footerInputPropsRef, footerButtonPropsRef, footerUploadPropsRef, footerIconPropsRef, inputPlaceholderRef, retryTextRef, typingTextRef, closeButtonTextRef, unreadNotificationTextRef, notificationsShownSetRef, unreadCountsBeforeReadRef, markNotificationShown, handleMessageSend, handleMessageRetry, onChatClose, onChatShare, onUserProfile
27
+ const { mergedClsPrefixRef, mergedThemeRef, selectedChatRef, messagesRef, typingChatIdsRef, messagesLoadingRef, messagesLoadingCountRef, headerButtonPropsRef, headerIconPropsRef, headerShareButtonPropsRef, headerProfileButtonPropsRef, headerCloseButtonPropsRef, headerShareIconPropsRef, headerProfileIconPropsRef, messageUploadPropsRef, footerInputPropsRef, footerButtonPropsRef, footerUploadPropsRef, footerIconPropsRef, inputPlaceholderRef, retryTextRef, typingTextRef, closeButtonTextRef, shareButtonTooltipRef, profileButtonTooltipRef, unreadNotificationTextRef, notificationsShownSetRef, unreadCountsBeforeReadRef, markNotificationShown, handleMessageSend, handleMessageRetry, handleFooterInputChange, onChatClose, onChatShare, onUserProfile, onMessagesScrollToTop, onMessagesScrollToBottom
28
28
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
29
29
  } = inject(chatInjectionKey);
30
30
  const messagesBodyRef = ref();
31
31
  const inputRef = ref();
32
32
  const inputValue = ref('');
33
33
  const attachmentFileList = ref([]);
34
+ const lastScrollTop = ref(0);
35
+ const scrollTopFired = ref(false);
36
+ const scrollBottomFired = ref(false);
34
37
  const unreadMessagesCount = computed(() => {
35
38
  if (!messagesRef.value)
36
39
  return 0;
@@ -41,12 +44,17 @@ export default defineComponent({
41
44
  const unreadCountOnOpen = ref(0);
42
45
  const chatInputs = ref({});
43
46
  const lastMessageId = ref(null);
47
+ const shouldScrollOnLoad = ref(false);
44
48
  watch(selectedChatRef, (newChat, oldChat) => {
45
49
  if (newChat && newChat.id !== (oldChat === null || oldChat === void 0 ? void 0 : oldChat.id)) {
46
50
  inputValue.value = chatInputs.value[newChat.id] || '';
47
51
  const unreadBeforeRead = unreadCountsBeforeReadRef.value[newChat.id] || 0;
48
52
  unreadCountOnOpen.value = unreadBeforeRead;
49
53
  lastMessageId.value = null;
54
+ lastScrollTop.value = 0;
55
+ scrollTopFired.value = false;
56
+ scrollBottomFired.value = false;
57
+ shouldScrollOnLoad.value = true;
50
58
  if (unreadBeforeRead > 0 &&
51
59
  !notificationsShownSetRef.value.has(newChat.id)) {
52
60
  hasUnreadMessages.value = true;
@@ -57,12 +65,6 @@ export default defineComponent({
57
65
  hasUnreadMessages.value = false;
58
66
  showNotificationManually.value = false;
59
67
  }
60
- void nextTick(() => {
61
- scrollToBottom();
62
- });
63
- setTimeout(() => {
64
- scrollToBottom();
65
- }, SCROLL_DELAY);
66
68
  }
67
69
  }, { immediate: true });
68
70
  watch(messagesRef, (newMessages) => {
@@ -72,19 +74,18 @@ export default defineComponent({
72
74
  }
73
75
  const currentLastMessage = newMessages[newMessages.length - 1];
74
76
  const currentLastId = currentLastMessage === null || currentLastMessage === void 0 ? void 0 : currentLastMessage.id;
75
- if (currentLastId !== lastMessageId.value &&
76
- lastMessageId.value !== null) {
77
+ const hasLastMessageChanged = currentLastId !== lastMessageId.value;
78
+ if (hasLastMessageChanged &&
79
+ currentLastMessage &&
80
+ !currentLastMessage.isOwn &&
81
+ currentLastMessage.status === MessageStatus.UNREAD) {
82
+ unreadCountOnOpen.value = unreadMessagesCount.value;
83
+ }
84
+ if (shouldScrollOnLoad.value && newMessages.length > 0) {
85
+ shouldScrollOnLoad.value = false;
77
86
  void nextTick(() => {
78
87
  scrollToBottom();
79
88
  });
80
- setTimeout(() => {
81
- scrollToBottom();
82
- }, SCROLL_DELAY);
83
- if (currentLastMessage &&
84
- !currentLastMessage.isOwn &&
85
- currentLastMessage.status === MessageStatus.UNREAD) {
86
- unreadCountOnOpen.value = unreadMessagesCount.value;
87
- }
88
89
  }
89
90
  lastMessageId.value = currentLastId !== null && currentLastId !== void 0 ? currentLastId : null;
90
91
  }, { deep: true, flush: 'post' });
@@ -97,17 +98,42 @@ export default defineComponent({
97
98
  notificationsShownSetRef.value = newSet;
98
99
  }
99
100
  });
101
+ watch(inputValue, (newValue) => {
102
+ if (selectedChatRef.value) {
103
+ handleFooterInputChange(newValue, selectedChatRef.value.id);
104
+ }
105
+ });
100
106
  const showUnreadNotification = computed(() => {
101
107
  return hasUnreadMessages.value && showNotificationManually.value;
102
108
  });
103
- onMounted(() => {
104
- void nextTick(() => {
105
- scrollToBottom();
106
- });
107
- setTimeout(() => {
108
- scrollToBottom();
109
- }, SCROLL_DELAY);
110
- });
109
+ const handleMessagesScroll = (e) => {
110
+ var _a, _b;
111
+ const target = e.target;
112
+ if (!target)
113
+ return;
114
+ const { scrollTop, scrollHeight, clientHeight } = target;
115
+ const threshold = 5;
116
+ const scrollDirection = scrollTop > lastScrollTop.value ? 'down' : 'up';
117
+ const nearTop = scrollTop <= threshold;
118
+ const nearBottom = scrollHeight - (scrollTop + clientHeight) <= threshold;
119
+ if (scrollTop > threshold) {
120
+ scrollTopFired.value = false;
121
+ }
122
+ if (scrollHeight - (scrollTop + clientHeight) > threshold) {
123
+ scrollBottomFired.value = false;
124
+ }
125
+ if (nearTop && scrollDirection === 'up' && !scrollTopFired.value) {
126
+ scrollTopFired.value = true;
127
+ (_a = onMessagesScrollToTop === null || onMessagesScrollToTop === void 0 ? void 0 : onMessagesScrollToTop.value) === null || _a === void 0 ? void 0 : _a.call(onMessagesScrollToTop);
128
+ }
129
+ if (nearBottom &&
130
+ scrollDirection === 'down' &&
131
+ !scrollBottomFired.value) {
132
+ scrollBottomFired.value = true;
133
+ (_b = onMessagesScrollToBottom === null || onMessagesScrollToBottom === void 0 ? void 0 : onMessagesScrollToBottom.value) === null || _b === void 0 ? void 0 : _b.call(onMessagesScrollToBottom);
134
+ }
135
+ lastScrollTop.value = scrollTop;
136
+ };
111
137
  const scrollToBottom = () => {
112
138
  const el = messagesBodyRef.value;
113
139
  if (!el)
@@ -129,27 +155,50 @@ export default defineComponent({
129
155
  };
130
156
  const renderHeader = () => {
131
157
  return (h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header` },
132
- h(UFlex, { justify: "space-between", align: "flex-start" }, {
158
+ h(UFlex, { justify: "space-between", align: "flex-start", wrap: false }, {
133
159
  default: () => (h(Fragment, null,
134
160
  h(UText, { variant: "heading-s-bold", class: `${mergedClsPrefixRef.value}-chat-main__header-title`, theme: mergedThemeRef.value.peers.Typography, themeOverrides: mergedThemeRef.value.peerOverrides.Typography }, {
135
- default: () => { var _a; return ((_a = selectedChatRef.value) === null || _a === void 0 ? void 0 : _a.title) || 'Select a chat'; }
161
+ default: () => { var _a, _b; return (_b = (_a = selectedChatRef.value) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : ''; }
136
162
  }),
137
163
  h(UFlex, { align: "center", size: "small", class: `${mergedClsPrefixRef.value}-chat-main__header-actions` }, {
138
- default: () => resolveSlot(slots.headerActions, () => [
139
- h(UButton, Object.assign({ secondary: true, circle: true, size: "large" }, headerButtonPropsRef.value, { theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides.Button, onClick: () => { var _a; return (_a = onChatShare === null || onChatShare === void 0 ? void 0 : onChatShare.value) === null || _a === void 0 ? void 0 : _a.call(onChatShare); } }), {
140
- default: () => (h(UIcon, Object.assign({ size: 20 }, headerIconPropsRef.value, { theme: mergedThemeRef.value.peers.Icon, themeOverrides: mergedThemeRef.value.peerOverrides.Icon }), {
141
- default: () => h(ArrowHookUpRight, null)
142
- }))
143
- }),
144
- h(UButton, Object.assign({ secondary: true, circle: true, size: "large" }, headerButtonPropsRef.value, { theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides.Button, onClick: () => { var _a; return (_a = onUserProfile === null || onUserProfile === void 0 ? void 0 : onUserProfile.value) === null || _a === void 0 ? void 0 : _a.call(onUserProfile); } }), {
145
- default: () => (h(UIcon, Object.assign({ size: 20 }, headerIconPropsRef.value, { theme: mergedThemeRef.value.peers.Icon, themeOverrides: mergedThemeRef.value.peerOverrides.Icon }), {
146
- default: () => h(PersonNote, null)
147
- }))
148
- }),
149
- h(UButton, Object.assign({ type: "primary", size: "large", round: true }, headerButtonPropsRef.value, { theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides.Button, onClick: () => { var _a; return (_a = onChatClose === null || onChatClose === void 0 ? void 0 : onChatClose.value) === null || _a === void 0 ? void 0 : _a.call(onChatClose); } }), {
150
- default: () => closeButtonTextRef.value
151
- })
152
- ])
164
+ default: () => resolveSlot(slots.headerActions, () => {
165
+ const shareButtonProps = Object.assign(Object.assign({}, headerButtonPropsRef.value), headerShareButtonPropsRef.value);
166
+ const profileButtonProps = Object.assign(Object.assign({}, headerButtonPropsRef.value), headerProfileButtonPropsRef.value);
167
+ const closeButtonProps = Object.assign(Object.assign({}, headerButtonPropsRef.value), headerCloseButtonPropsRef.value);
168
+ const shareIconProps = Object.assign(Object.assign({}, headerIconPropsRef.value), headerShareIconPropsRef.value);
169
+ const profileIconProps = Object.assign(Object.assign({}, headerIconPropsRef.value), headerProfileIconPropsRef.value);
170
+ const buttons = [];
171
+ if (shareButtonProps.disabled !== true) {
172
+ buttons.push(h(UTooltip, null, {
173
+ trigger: () => (h(UButton, Object.assign({ secondary: true, circle: true, size: "large" }, shareButtonProps, { theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides
174
+ .Button, onClick: () => { var _a; return (_a = onChatShare === null || onChatShare === void 0 ? void 0 : onChatShare.value) === null || _a === void 0 ? void 0 : _a.call(onChatShare); } }), {
175
+ default: () => (h(UIcon, Object.assign({ size: 20 }, shareIconProps, { theme: mergedThemeRef.value.peers.Icon, themeOverrides: mergedThemeRef.value.peerOverrides
176
+ .Icon }), {
177
+ default: () => (h(ArrowHookUpRight, null))
178
+ }))
179
+ })),
180
+ default: () => shareButtonTooltipRef.value
181
+ }));
182
+ }
183
+ if (profileButtonProps.disabled !== true) {
184
+ buttons.push(h(UTooltip, null, {
185
+ trigger: () => (h(UButton, Object.assign({ secondary: true, circle: true, size: "large" }, profileButtonProps, { theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides
186
+ .Button, onClick: () => { var _a; return (_a = onUserProfile === null || onUserProfile === void 0 ? void 0 : onUserProfile.value) === null || _a === void 0 ? void 0 : _a.call(onUserProfile); } }), {
187
+ default: () => (h(UIcon, Object.assign({ size: 20 }, profileIconProps, { theme: mergedThemeRef.value.peers.Icon, themeOverrides: mergedThemeRef.value.peerOverrides
188
+ .Icon }), {
189
+ default: () => h(PersonNote, null)
190
+ }))
191
+ })),
192
+ default: () => profileButtonTooltipRef.value
193
+ }));
194
+ }
195
+ if (closeButtonProps.disabled !== true) {
196
+ buttons.push(h(UButton, Object.assign({ type: "primary", size: "large", round: true }, closeButtonProps, { theme: mergedThemeRef.value.peers.Button, themeOverrides: mergedThemeRef.value.peerOverrides.Button, onClick: () => { var _a; return (_a = onChatClose === null || onChatClose === void 0 ? void 0 : onChatClose.value) === null || _a === void 0 ? void 0 : _a.call(onChatClose); } }), {
197
+ default: () => closeButtonTextRef.value
198
+ }));
199
+ }
200
+ return buttons;
201
+ })
153
202
  })))
154
203
  })));
155
204
  };
@@ -196,12 +245,6 @@ export default defineComponent({
196
245
  chatInputs.value[selectedChatRef.value.id] = '';
197
246
  hasUnreadMessages.value = false;
198
247
  showNotificationManually.value = false;
199
- void nextTick(() => {
200
- scrollToBottom();
201
- });
202
- setTimeout(() => {
203
- scrollToBottom();
204
- }, SCROLL_DELAY);
205
248
  }
206
249
  finally {
207
250
  setTimeout(() => {
@@ -241,12 +284,6 @@ export default defineComponent({
241
284
  handleMessageSend('', attachments);
242
285
  pendingFiles.value = [];
243
286
  attachmentFileList.value = [];
244
- void nextTick(() => {
245
- scrollToBottom();
246
- });
247
- setTimeout(() => {
248
- scrollToBottom();
249
- }, SCROLL_DELAY);
250
287
  }
251
288
  }, SENDING_DELAY);
252
289
  }
@@ -286,6 +323,7 @@ export default defineComponent({
286
323
  inputRef,
287
324
  inputValue,
288
325
  handleSendMessage,
326
+ handleMessagesScroll,
289
327
  scrollToBottom
290
328
  };
291
329
  },
@@ -294,7 +332,7 @@ export default defineComponent({
294
332
  const { mergedClsPrefixRef } = inject(chatInjectionKey);
295
333
  return (h("div", { class: `${mergedClsPrefixRef.value}-chat-main` },
296
334
  this.renderHeader(),
297
- h(UScrollbar, { ref: "messagesBodyRef", class: `${mergedClsPrefixRef.value}-chat-main__body` }, {
335
+ h(UScrollbar, { ref: "messagesBodyRef", class: `${mergedClsPrefixRef.value}-chat-main__body`, onScroll: this.handleMessagesScroll }, {
298
336
  default: () => this.renderMessages()
299
337
  }),
300
338
  this.renderFooter()));