@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
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.chatListItemsProps = void 0;
7
+ const vue_1 = require("vue");
8
+ const interface_1 = require("./interface");
9
+ const empty_1 = require("../../empty");
10
+ const avatar_1 = require("../../avatar");
11
+ const list_1 = require("../../list");
12
+ const badge_1 = require("../../badge");
13
+ const icon_1 = require("../../icon");
14
+ const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
15
+ const styles_1 = require("../styles");
16
+ const _mixins_1 = require("../../_mixins");
17
+ const icons_1 = require("../../_internal/icons");
18
+ const statusIconMapper = {
19
+ [interface_1.MessageStatus.READ]: icons_1.CheckmarkDoneSharp,
20
+ [interface_1.MessageStatus.PENDING]: icons_1.MdTime,
21
+ [interface_1.MessageStatus.RETRY]: icons_1.Refresh,
22
+ [interface_1.MessageStatus.UNREAD]: icons_1.CheckmarkDoneSharp
23
+ };
24
+ exports.chatListItemsProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { chatItems: {
25
+ type: Array,
26
+ default: () => []
27
+ }, selectedChatId: {
28
+ type: [String, Number, Symbol],
29
+ default: undefined
30
+ }, typingChatIds: {
31
+ type: Array,
32
+ default: () => []
33
+ }, typingText: {
34
+ type: String,
35
+ default: undefined
36
+ }, loading: {
37
+ type: Boolean,
38
+ default: false
39
+ }, loadingCount: {
40
+ type: Number,
41
+ default: 10
42
+ }, emptyProps: {
43
+ type: Object,
44
+ default: undefined
45
+ }, avatarProps: {
46
+ type: Object,
47
+ default: undefined
48
+ }, badgeProps: {
49
+ type: Object,
50
+ default: undefined
51
+ }, onChatSelect: {
52
+ type: Function,
53
+ default: undefined
54
+ }, notificationsShown: {
55
+ type: Object,
56
+ default: () => new Set()
57
+ } });
58
+ exports.default = (0, vue_1.defineComponent)({
59
+ name: 'ChatListItems',
60
+ props: exports.chatListItemsProps,
61
+ setup(props, { slots }) {
62
+ var _a;
63
+ const UChat = (0, vue_1.inject)(interface_1.chatInjectionKey, null);
64
+ const { mergedClsPrefixRef } = (0, _mixins_1.useConfig)(props);
65
+ const themeRef = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.mergedThemeRef) !== null && _a !== void 0 ? _a : (0, _mixins_1.useTheme)('Chat', '-chat', index_cssr_1.default, styles_1.chatLight, props, mergedClsPrefixRef);
66
+ const { localeRef } = (0, _mixins_1.useLocale)('Chat');
67
+ const cssVarsRef = (0, vue_1.computed)(() => {
68
+ const { common: { cubicBezierEaseInOut, brandPrimary500, staticGreen, staticRed, textPrimary, textSecondary, textTertiary }, self: { backgroundColor, borderColor, sidebarBackgroundColor, sidebarBorderColor, sidebarItemBackgroundColor, sidebarItemBackgroundColorHover, sidebarItemBackgroundColorSelected, sidebarItemTextColor, sidebarItemTextColorSelected, sidebarItemSubtitleColor, sidebarItemTimeColor, unreadNotificationBackgroundColor, borderRadius } } = themeRef.value;
69
+ return {
70
+ '--u-bezier': cubicBezierEaseInOut,
71
+ '--u-color-primary': brandPrimary500,
72
+ '--u-color-success': staticGreen,
73
+ '--u-color-error': staticRed,
74
+ '--u-text-color-base': textPrimary,
75
+ '--u-text-color-secondary': textSecondary,
76
+ '--u-text-color-disabled': textTertiary,
77
+ '--u-background-color': backgroundColor,
78
+ '--u-border-color': borderColor,
79
+ '--u-sidebar-background-color': sidebarBackgroundColor,
80
+ '--u-sidebar-border-color': sidebarBorderColor,
81
+ '--u-sidebar-item-background-color': sidebarItemBackgroundColor,
82
+ '--u-sidebar-item-background-color-hover': sidebarItemBackgroundColorHover,
83
+ '--u-sidebar-item-background-color-selected': sidebarItemBackgroundColorSelected,
84
+ '--u-sidebar-item-text-color': sidebarItemTextColor,
85
+ '--u-sidebar-item-text-color-selected': sidebarItemTextColorSelected,
86
+ '--u-sidebar-item-subtitle-color': sidebarItemSubtitleColor,
87
+ '--u-sidebar-item-time-color': sidebarItemTimeColor,
88
+ '--u-unread-notification-background-color': unreadNotificationBackgroundColor,
89
+ '--u-border-radius': borderRadius
90
+ };
91
+ });
92
+ const themeClassHandle = (0, _mixins_1.useThemeClass)('chat-list-items', (0, vue_1.computed)(() => ''), cssVarsRef, props);
93
+ const mergedTypingTextRef = (0, vue_1.computed)(() => { var _a; return (_a = props.typingText) !== null && _a !== void 0 ? _a : localeRef.value.typingText; });
94
+ const handleChatSelect = (chatId) => {
95
+ var _a;
96
+ (_a = props.onChatSelect) === null || _a === void 0 ? void 0 : _a.call(props, chatId);
97
+ };
98
+ const renderChatItem = (item) => {
99
+ var _a, _b;
100
+ const isSelected = props.selectedChatId === item.id;
101
+ const isTyping = (_b = (_a = props.typingChatIds) === null || _a === void 0 ? void 0 : _a.includes(item.id)) !== null && _b !== void 0 ? _b : false;
102
+ return ((0, vue_1.h)(list_1.UListItem, { key: item.id, showIcon: false, onClick: () => {
103
+ handleChatSelect(item.id);
104
+ }, class: [
105
+ `${mergedClsPrefixRef.value}-chat-sidebar__item`,
106
+ isSelected &&
107
+ `${mergedClsPrefixRef.value}-chat-sidebar__item--selected`,
108
+ isTyping && `${mergedClsPrefixRef.value}-chat-sidebar__item--typing`
109
+ ] }, {
110
+ prefix: () => ((0, vue_1.h)(avatar_1.UAvatar, Object.assign({ size: "medium", src: typeof item.avatar === 'string' ? item.avatar : undefined }, props.avatarProps, { theme: themeRef.value.peers.Avatar, themeOverrides: themeRef.value.peerOverrides.Avatar }), {
111
+ default: () => {
112
+ var _a;
113
+ return typeof item.avatar === 'function'
114
+ ? item.avatar()
115
+ : typeof item.title === 'string'
116
+ ? (_a = item.title.charAt(0)) === null || _a === void 0 ? void 0 : _a.toUpperCase()
117
+ : '?';
118
+ }
119
+ })),
120
+ header: () => ((0, vue_1.h)("span", { class: `${mergedClsPrefixRef.value}-chat-sidebar__item-title` }, typeof item.title === 'function' ? item.title() : item.title)),
121
+ description: () => ((0, vue_1.h)("span", { class: [
122
+ `${mergedClsPrefixRef.value}-chat-sidebar__item-subtitle`,
123
+ isTyping && 'typing'
124
+ ], style: {
125
+ display: 'block',
126
+ overflow: 'hidden',
127
+ textOverflow: 'ellipsis',
128
+ whiteSpace: 'nowrap',
129
+ minWidth: 0,
130
+ maxWidth: '100%'
131
+ } }, isTyping
132
+ ? mergedTypingTextRef.value
133
+ : typeof item.subtitle === 'string'
134
+ ? item.subtitle
135
+ : typeof item.subtitle === 'function'
136
+ ? item.subtitle()
137
+ : item.subtitle)),
138
+ suffix: () => {
139
+ const displayUnreadCount = item.unreadCount || 0;
140
+ const hasUnreadIncoming = displayUnreadCount > 0;
141
+ const lastMessageIsOwn = item.lastMessageIsOwn;
142
+ return ((0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__item-indicators` },
143
+ (0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__item-time` }, item.datetime),
144
+ (0, vue_1.h)("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__item-status` },
145
+ lastMessageIsOwn &&
146
+ (slots.chatItemStatus ? (slots.chatItemStatus(item)) : item.messageStatus &&
147
+ statusIconMapper[item.messageStatus] ? ((0, vue_1.h)(icon_1.UIcon, { size: 16, component: statusIconMapper[item.messageStatus], class: [
148
+ `${mergedClsPrefixRef.value}-chat-sidebar__item-status-icon`,
149
+ `${mergedClsPrefixRef.value}-chat-sidebar__item-status-icon--${item.messageStatus}`
150
+ ], theme: themeRef.value.peers.Icon, themeOverrides: themeRef.value.peerOverrides.Icon })) : null),
151
+ !lastMessageIsOwn && hasUnreadIncoming && ((0, vue_1.h)(badge_1.UBadge, Object.assign({ value: displayUnreadCount }, props.badgeProps, { theme: themeRef.value.peers.Badge, themeOverrides: themeRef.value.peerOverrides.Badge }))))));
152
+ }
153
+ }));
154
+ };
155
+ return {
156
+ mergedClsPrefixRef,
157
+ mergedTheme: themeRef,
158
+ renderChatItem,
159
+ cssVars: cssVarsRef,
160
+ themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
161
+ onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
162
+ };
163
+ },
164
+ render() {
165
+ var _a;
166
+ (_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
167
+ const { mergedClsPrefixRef, renderChatItem } = this;
168
+ const content = (() => {
169
+ var _a;
170
+ if (this.loading) {
171
+ return ((0, vue_1.h)(list_1.UList, { loading: true, theme: this.mergedTheme.peers.List, themeOverrides: this.mergedTheme.peerOverrides.List }, {
172
+ default: () => Array.from({ length: this.loadingCount || 10 }).map((_, index) => ((0, vue_1.h)(list_1.UListItem, { key: index, avatar: { icon: icons_1.PersonOutline }, description: { text: 'Loading...' }, header: { text: 'Loading...' } })))
173
+ }));
174
+ }
175
+ if ((_a = this.chatItems) === null || _a === void 0 ? void 0 : _a.length) {
176
+ return ((0, vue_1.h)(list_1.UList, { showIcon: false, theme: this.mergedTheme.peers.List, themeOverrides: this.mergedTheme.peerOverrides.List }, {
177
+ default: () => { var _a; return (_a = this.chatItems) === null || _a === void 0 ? void 0 : _a.map((item) => renderChatItem(item)); }
178
+ }));
179
+ }
180
+ return ((0, vue_1.h)(empty_1.UEmpty, Object.assign({}, this.emptyProps, { theme: this.mergedTheme.peers.Empty, themeOverrides: this.mergedTheme.peerOverrides.Empty })));
181
+ })();
182
+ return ((0, vue_1.h)("div", { class: [`${mergedClsPrefixRef}-chat`, this.themeClass], style: this.cssVars },
183
+ (0, vue_1.h)("div", { class: `${mergedClsPrefixRef}-chat-sidebar`, style: {
184
+ border: 'none',
185
+ borderRadius: '0',
186
+ padding: '0',
187
+ maxWidth: '100%',
188
+ background: 'transparent'
189
+ } },
190
+ (0, vue_1.h)("div", { class: `${mergedClsPrefixRef}-chat-sidebar__content`, style: {
191
+ padding: '0'
192
+ } }, content))));
193
+ }
194
+ });