@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
|
@@ -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
|
+
});
|