@uzum-tech/ui 2.2.0 → 2.3.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.
- package/dist/index.js +1431 -721
- package/dist/index.mjs +1424 -722
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/chat/index.d.ts +2 -0
- package/es/chat/index.mjs +1 -0
- package/es/chat/src/Chat.d.ts +20800 -24
- package/es/chat/src/Chat.mjs +1 -1
- package/es/chat/src/ChatMainArea.d.ts +9749 -0
- package/es/chat/src/{ChatParts/MainArea.mjs → ChatMainArea.mjs} +409 -75
- package/es/chat/src/ChatMessages.d.ts +1 -33
- package/es/chat/src/ChatMessages.mjs +79 -167
- package/es/chat/src/interface.d.ts +16 -12
- package/es/chat/src/interface.mjs +7 -1
- package/es/chat/src/styles/index.cssr.mjs +4 -1
- package/es/components.d.ts +28782 -256
- package/es/components.mjs +6 -1
- package/es/config-provider/src/internal-interface.d.ts +4 -0
- package/es/message-bubble/index.d.ts +3 -0
- package/es/message-bubble/index.mjs +2 -0
- package/es/message-bubble/src/MessageBubble.d.ts +304 -0
- package/es/message-bubble/src/MessageBubble.mjs +336 -0
- package/es/message-bubble/src/interface.d.ts +204 -0
- package/es/message-bubble/src/interface.mjs +92 -0
- package/es/message-bubble/src/styles/index.cssr.d.ts +2 -0
- package/es/message-bubble/src/styles/index.cssr.mjs +133 -0
- package/es/message-bubble/styles/dark.d.ts +29 -0
- package/es/message-bubble/styles/dark.mjs +13 -0
- package/es/message-bubble/styles/index.d.ts +3 -0
- package/es/message-bubble/styles/index.mjs +2 -0
- package/es/message-bubble/styles/light.d.ts +49 -0
- package/es/message-bubble/styles/light.mjs +44 -0
- package/es/pagination/src/Pagination.d.ts +4 -0
- package/es/pagination/src/Pagination.mjs +8 -0
- package/es/pagination/src/interface.d.ts +2 -0
- package/es/pagination/src/interface.mjs +2 -0
- package/es/styles.d.ts +1 -0
- package/es/styles.mjs +1 -0
- package/es/themes/dark.mjs +2 -0
- package/es/themes/light.mjs +2 -0
- package/es/upload/src/Upload.d.ts +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/chat/index.d.ts +2 -0
- package/lib/chat/index.js +3 -1
- package/lib/chat/src/Chat.d.ts +20800 -24
- package/lib/chat/src/Chat.js +2 -2
- package/lib/chat/src/ChatMainArea.d.ts +9749 -0
- package/lib/chat/src/{ChatParts/MainArea.js → ChatMainArea.js} +299 -30
- package/lib/chat/src/ChatMessages.d.ts +1 -33
- package/lib/chat/src/ChatMessages.js +61 -158
- package/lib/chat/src/interface.d.ts +16 -12
- package/lib/chat/src/interface.js +7 -1
- package/lib/chat/src/styles/index.cssr.js +4 -1
- package/lib/components.d.ts +28782 -256
- package/lib/components.js +18 -8
- package/lib/config-provider/src/internal-interface.d.ts +4 -0
- package/lib/message-bubble/index.d.ts +3 -0
- package/lib/message-bubble/index.js +14 -0
- package/lib/message-bubble/src/MessageBubble.d.ts +304 -0
- package/lib/message-bubble/src/MessageBubble.js +276 -0
- package/lib/message-bubble/src/interface.d.ts +204 -0
- package/lib/message-bubble/src/interface.js +80 -0
- package/lib/message-bubble/src/styles/index.cssr.d.ts +2 -0
- package/lib/message-bubble/src/styles/index.cssr.js +138 -0
- package/lib/message-bubble/styles/dark.d.ts +29 -0
- package/lib/message-bubble/styles/dark.js +15 -0
- package/lib/message-bubble/styles/index.d.ts +3 -0
- package/lib/message-bubble/styles/index.js +10 -0
- package/lib/message-bubble/styles/light.d.ts +49 -0
- package/lib/message-bubble/styles/light.js +36 -0
- package/lib/pagination/src/Pagination.d.ts +4 -0
- package/lib/pagination/src/Pagination.js +6 -0
- package/lib/pagination/src/interface.d.ts +2 -0
- package/lib/pagination/src/interface.js +1 -1
- package/lib/styles.d.ts +1 -0
- package/lib/styles.js +84 -82
- package/lib/themes/dark.js +78 -76
- package/lib/themes/light.js +76 -74
- package/lib/upload/src/Upload.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +4 -4
- package/volar.d.ts +2 -0
- package/web-types.json +182 -1
- package/es/chat/src/ChatParts/MainArea.d.ts +0 -20
- package/lib/chat/src/ChatParts/MainArea.d.ts +0 -20
|
@@ -25,74 +25,341 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
25
25
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
|
-
import { computed, defineComponent, Fragment, h, inject, nextTick, ref, watch } from 'vue';
|
|
29
|
-
import { ArrowHookUpRight, AttachIcon, CloseIcon, PersonNote, SendFilled } from "
|
|
30
|
-
import { useLocale } from "
|
|
31
|
-
import { resolveSlot } from "
|
|
32
|
-
import { UButton } from "
|
|
33
|
-
import { UFlex } from "
|
|
34
|
-
import { UIcon } from "
|
|
35
|
-
import { UInput } from "
|
|
36
|
-
import { UList, UListItem } from "
|
|
37
|
-
import { USafeTopScrollbar } from "
|
|
38
|
-
import { UTooltip } from "
|
|
39
|
-
import { UText } from "
|
|
40
|
-
import { UUpload, UUploadTrigger } from "
|
|
41
|
-
import
|
|
42
|
-
import
|
|
28
|
+
import { computed, defineComponent, Fragment, h, inject, nextTick, onMounted, provide, ref, toRef, watch } from 'vue';
|
|
29
|
+
import { ArrowHookUpRight, AttachIcon, CloseIcon, PersonNote, SendFilled } from "../../_internal/icons/index.mjs";
|
|
30
|
+
import { useConfig, useLocale, useTheme, useThemeClass } from "../../_mixins/index.mjs";
|
|
31
|
+
import { resolveSlot } from "../../_utils/index.mjs";
|
|
32
|
+
import { UButton } from "../../button/index.mjs";
|
|
33
|
+
import { UFlex } from "../../flex/index.mjs";
|
|
34
|
+
import { UIcon } from "../../icon/index.mjs";
|
|
35
|
+
import { UInput } from "../../input/index.mjs";
|
|
36
|
+
import { UList, UListItem } from "../../list/index.mjs";
|
|
37
|
+
import { USafeTopScrollbar } from "../../safe-top-scrollbar/index.mjs";
|
|
38
|
+
import { UTooltip } from "../../tooltip/index.mjs";
|
|
39
|
+
import { UText } from "../../typography/index.mjs";
|
|
40
|
+
import { UUpload, UUploadTrigger } from "../../upload/index.mjs";
|
|
41
|
+
import { chatLight } from "../styles/index.mjs";
|
|
42
|
+
import UChatMessages from "./ChatMessages.mjs";
|
|
43
|
+
import { ChatBubbleActionKey, chatInjectionKey, ChatMessageType, MessageStatus } from "./interface.mjs";
|
|
44
|
+
import style from "./styles/index.cssr.mjs";
|
|
43
45
|
const SENDING_DELAY = 100;
|
|
46
|
+
export const chatMainAreaProps = Object.assign(Object.assign({}, useTheme.props), {
|
|
47
|
+
selectedChat: {
|
|
48
|
+
type: Object,
|
|
49
|
+
default: undefined
|
|
50
|
+
},
|
|
51
|
+
messages: {
|
|
52
|
+
type: Array,
|
|
53
|
+
default: () => []
|
|
54
|
+
},
|
|
55
|
+
typingChatIds: {
|
|
56
|
+
type: Array,
|
|
57
|
+
default: () => []
|
|
58
|
+
},
|
|
59
|
+
loading: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
loadingCount: {
|
|
64
|
+
type: Number,
|
|
65
|
+
default: 10
|
|
66
|
+
},
|
|
67
|
+
headerButtonProps: {
|
|
68
|
+
type: Object,
|
|
69
|
+
default: undefined
|
|
70
|
+
},
|
|
71
|
+
headerIconProps: {
|
|
72
|
+
type: Object,
|
|
73
|
+
default: undefined
|
|
74
|
+
},
|
|
75
|
+
headerShareButtonProps: {
|
|
76
|
+
type: Object,
|
|
77
|
+
default: undefined
|
|
78
|
+
},
|
|
79
|
+
headerProfileButtonProps: {
|
|
80
|
+
type: Object,
|
|
81
|
+
default: undefined
|
|
82
|
+
},
|
|
83
|
+
headerCloseButtonProps: {
|
|
84
|
+
type: Object,
|
|
85
|
+
default: undefined
|
|
86
|
+
},
|
|
87
|
+
headerShareIconProps: {
|
|
88
|
+
type: Object,
|
|
89
|
+
default: undefined
|
|
90
|
+
},
|
|
91
|
+
headerProfileIconProps: {
|
|
92
|
+
type: Object,
|
|
93
|
+
default: undefined
|
|
94
|
+
},
|
|
95
|
+
messageUploadProps: {
|
|
96
|
+
type: Object,
|
|
97
|
+
default: undefined
|
|
98
|
+
},
|
|
99
|
+
footerInputProps: {
|
|
100
|
+
type: Object,
|
|
101
|
+
default: undefined
|
|
102
|
+
},
|
|
103
|
+
footerButtonProps: {
|
|
104
|
+
type: Object,
|
|
105
|
+
default: undefined
|
|
106
|
+
},
|
|
107
|
+
footerUploadProps: {
|
|
108
|
+
type: Object,
|
|
109
|
+
default: undefined
|
|
110
|
+
},
|
|
111
|
+
footerIconProps: {
|
|
112
|
+
type: Object,
|
|
113
|
+
default: undefined
|
|
114
|
+
},
|
|
115
|
+
footerSuffixIconProps: {
|
|
116
|
+
type: Object,
|
|
117
|
+
default: undefined
|
|
118
|
+
},
|
|
119
|
+
showAttachButton: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
default: true
|
|
122
|
+
},
|
|
123
|
+
inputPlaceholder: {
|
|
124
|
+
type: String,
|
|
125
|
+
default: undefined
|
|
126
|
+
},
|
|
127
|
+
retryText: {
|
|
128
|
+
type: String,
|
|
129
|
+
default: undefined
|
|
130
|
+
},
|
|
131
|
+
typingText: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: undefined
|
|
134
|
+
},
|
|
135
|
+
closeButtonText: {
|
|
136
|
+
type: String,
|
|
137
|
+
default: undefined
|
|
138
|
+
},
|
|
139
|
+
shareButtonTooltip: {
|
|
140
|
+
type: String,
|
|
141
|
+
default: undefined
|
|
142
|
+
},
|
|
143
|
+
profileButtonTooltip: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: undefined
|
|
146
|
+
},
|
|
147
|
+
unreadNotificationText: {
|
|
148
|
+
type: String,
|
|
149
|
+
default: undefined
|
|
150
|
+
},
|
|
151
|
+
bubbleActions: {
|
|
152
|
+
type: Array,
|
|
153
|
+
default: undefined
|
|
154
|
+
},
|
|
155
|
+
onMessageSend: {
|
|
156
|
+
type: Function,
|
|
157
|
+
default: undefined
|
|
158
|
+
},
|
|
159
|
+
onMessageRetry: {
|
|
160
|
+
type: Function,
|
|
161
|
+
default: undefined
|
|
162
|
+
},
|
|
163
|
+
onFooterInputChange: {
|
|
164
|
+
type: Function,
|
|
165
|
+
default: undefined
|
|
166
|
+
},
|
|
167
|
+
onChatClose: {
|
|
168
|
+
type: Function,
|
|
169
|
+
default: undefined
|
|
170
|
+
},
|
|
171
|
+
onChatShare: {
|
|
172
|
+
type: Function,
|
|
173
|
+
default: undefined
|
|
174
|
+
},
|
|
175
|
+
onUserProfile: {
|
|
176
|
+
type: Function,
|
|
177
|
+
default: undefined
|
|
178
|
+
},
|
|
179
|
+
onAttachmentUpload: {
|
|
180
|
+
type: Function,
|
|
181
|
+
default: undefined
|
|
182
|
+
},
|
|
183
|
+
onAttachmentDownload: {
|
|
184
|
+
type: Function,
|
|
185
|
+
default: undefined
|
|
186
|
+
},
|
|
187
|
+
onMessagesScrollToTop: {
|
|
188
|
+
type: Function,
|
|
189
|
+
default: undefined
|
|
190
|
+
},
|
|
191
|
+
onMessagesScrollToBottom: {
|
|
192
|
+
type: Function,
|
|
193
|
+
default: undefined
|
|
194
|
+
}
|
|
195
|
+
});
|
|
44
196
|
export default defineComponent({
|
|
45
197
|
name: 'ChatMainArea',
|
|
46
|
-
|
|
198
|
+
props: chatMainAreaProps,
|
|
199
|
+
setup(props, {
|
|
47
200
|
slots
|
|
48
201
|
}) {
|
|
202
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16;
|
|
203
|
+
const UChat = inject(chatInjectionKey, null);
|
|
204
|
+
const isStandalone = !UChat;
|
|
205
|
+
const {
|
|
206
|
+
mergedClsPrefixRef
|
|
207
|
+
} = useConfig(props);
|
|
208
|
+
const mergedThemeRef = (_a = UChat === null || UChat === void 0 ? void 0 : UChat.mergedThemeRef) !== null && _a !== void 0 ? _a : useTheme('Chat', '-chat', style, chatLight, props, mergedClsPrefixRef);
|
|
49
209
|
const {
|
|
50
210
|
localeRef
|
|
51
211
|
} = useLocale('Chat');
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
212
|
+
const selectedChatRef = (_b = UChat === null || UChat === void 0 ? void 0 : UChat.selectedChatRef) !== null && _b !== void 0 ? _b : toRef(props, 'selectedChat');
|
|
213
|
+
const messagesRef = (_c = UChat === null || UChat === void 0 ? void 0 : UChat.messagesRef) !== null && _c !== void 0 ? _c : toRef(props, 'messages');
|
|
214
|
+
const typingChatIdsRef = (_d = UChat === null || UChat === void 0 ? void 0 : UChat.typingChatIdsRef) !== null && _d !== void 0 ? _d : toRef(props, 'typingChatIds');
|
|
215
|
+
const messagesLoadingRef = (_e = UChat === null || UChat === void 0 ? void 0 : UChat.messagesLoadingRef) !== null && _e !== void 0 ? _e : toRef(props, 'loading');
|
|
216
|
+
const messagesLoadingCountRef = (_f = UChat === null || UChat === void 0 ? void 0 : UChat.messagesLoadingCountRef) !== null && _f !== void 0 ? _f : toRef(props, 'loadingCount');
|
|
217
|
+
const headerButtonPropsRef = (_g = UChat === null || UChat === void 0 ? void 0 : UChat.headerButtonPropsRef) !== null && _g !== void 0 ? _g : toRef(props, 'headerButtonProps');
|
|
218
|
+
const headerIconPropsRef = (_h = UChat === null || UChat === void 0 ? void 0 : UChat.headerIconPropsRef) !== null && _h !== void 0 ? _h : toRef(props, 'headerIconProps');
|
|
219
|
+
const headerShareButtonPropsRef = (_j = UChat === null || UChat === void 0 ? void 0 : UChat.headerShareButtonPropsRef) !== null && _j !== void 0 ? _j : toRef(props, 'headerShareButtonProps');
|
|
220
|
+
const headerProfileButtonPropsRef = (_k = UChat === null || UChat === void 0 ? void 0 : UChat.headerProfileButtonPropsRef) !== null && _k !== void 0 ? _k : toRef(props, 'headerProfileButtonProps');
|
|
221
|
+
const headerCloseButtonPropsRef = (_l = UChat === null || UChat === void 0 ? void 0 : UChat.headerCloseButtonPropsRef) !== null && _l !== void 0 ? _l : toRef(props, 'headerCloseButtonProps');
|
|
222
|
+
const headerShareIconPropsRef = (_m = UChat === null || UChat === void 0 ? void 0 : UChat.headerShareIconPropsRef) !== null && _m !== void 0 ? _m : toRef(props, 'headerShareIconProps');
|
|
223
|
+
const headerProfileIconPropsRef = (_o = UChat === null || UChat === void 0 ? void 0 : UChat.headerProfileIconPropsRef) !== null && _o !== void 0 ? _o : toRef(props, 'headerProfileIconProps');
|
|
224
|
+
const messageUploadPropsRef = (_p = UChat === null || UChat === void 0 ? void 0 : UChat.messageUploadPropsRef) !== null && _p !== void 0 ? _p : toRef(props, 'messageUploadProps');
|
|
225
|
+
const footerInputPropsRef = (_q = UChat === null || UChat === void 0 ? void 0 : UChat.footerInputPropsRef) !== null && _q !== void 0 ? _q : toRef(props, 'footerInputProps');
|
|
226
|
+
const footerButtonPropsRef = (_r = UChat === null || UChat === void 0 ? void 0 : UChat.footerButtonPropsRef) !== null && _r !== void 0 ? _r : toRef(props, 'footerButtonProps');
|
|
227
|
+
const footerUploadPropsRef = (_s = UChat === null || UChat === void 0 ? void 0 : UChat.footerUploadPropsRef) !== null && _s !== void 0 ? _s : toRef(props, 'footerUploadProps');
|
|
228
|
+
const footerIconPropsRef = (_t = UChat === null || UChat === void 0 ? void 0 : UChat.footerIconPropsRef) !== null && _t !== void 0 ? _t : toRef(props, 'footerIconProps');
|
|
229
|
+
const footerSuffixIconPropsRef = (_u = UChat === null || UChat === void 0 ? void 0 : UChat.footerSuffixIconPropsRef) !== null && _u !== void 0 ? _u : toRef(props, 'footerSuffixIconProps');
|
|
230
|
+
const inputPlaceholderRef = (_v = UChat === null || UChat === void 0 ? void 0 : UChat.inputPlaceholderRef) !== null && _v !== void 0 ? _v : computed(() => {
|
|
231
|
+
var _a;
|
|
232
|
+
return (_a = props.inputPlaceholder) !== null && _a !== void 0 ? _a : localeRef.value.inputPlaceholder;
|
|
233
|
+
});
|
|
234
|
+
const retryTextRef = (_w = UChat === null || UChat === void 0 ? void 0 : UChat.retryTextRef) !== null && _w !== void 0 ? _w : computed(() => {
|
|
235
|
+
var _a;
|
|
236
|
+
return (_a = props.retryText) !== null && _a !== void 0 ? _a : localeRef.value.retryText;
|
|
237
|
+
});
|
|
238
|
+
const typingTextRef = (_x = UChat === null || UChat === void 0 ? void 0 : UChat.typingTextRef) !== null && _x !== void 0 ? _x : computed(() => {
|
|
239
|
+
var _a;
|
|
240
|
+
return (_a = props.typingText) !== null && _a !== void 0 ? _a : localeRef.value.typingText;
|
|
241
|
+
});
|
|
242
|
+
const closeButtonTextRef = (_y = UChat === null || UChat === void 0 ? void 0 : UChat.closeButtonTextRef) !== null && _y !== void 0 ? _y : computed(() => {
|
|
243
|
+
var _a;
|
|
244
|
+
return (_a = props.closeButtonText) !== null && _a !== void 0 ? _a : localeRef.value.closeButtonText;
|
|
245
|
+
});
|
|
246
|
+
const shareButtonTooltipRef = (_z = UChat === null || UChat === void 0 ? void 0 : UChat.shareButtonTooltipRef) !== null && _z !== void 0 ? _z : computed(() => {
|
|
247
|
+
var _a;
|
|
248
|
+
return (_a = props.shareButtonTooltip) !== null && _a !== void 0 ? _a : localeRef.value.shareButtonTooltip;
|
|
249
|
+
});
|
|
250
|
+
const profileButtonTooltipRef = (_0 = UChat === null || UChat === void 0 ? void 0 : UChat.profileButtonTooltipRef) !== null && _0 !== void 0 ? _0 : computed(() => {
|
|
251
|
+
var _a;
|
|
252
|
+
return (_a = props.profileButtonTooltip) !== null && _a !== void 0 ? _a : localeRef.value.profileButtonTooltip;
|
|
253
|
+
});
|
|
254
|
+
const unreadNotificationTextRef = (_1 = UChat === null || UChat === void 0 ? void 0 : UChat.unreadNotificationTextRef) !== null && _1 !== void 0 ? _1 : computed(() => {
|
|
255
|
+
var _a;
|
|
256
|
+
return (_a = props.unreadNotificationText) !== null && _a !== void 0 ? _a : localeRef.value.unreadNotificationText;
|
|
257
|
+
});
|
|
258
|
+
const notificationsShownSetRef = (_2 = UChat === null || UChat === void 0 ? void 0 : UChat.notificationsShownSetRef) !== null && _2 !== void 0 ? _2 : ref(new Set());
|
|
259
|
+
const unreadCountsBeforeReadRef = (_3 = UChat === null || UChat === void 0 ? void 0 : UChat.unreadCountsBeforeReadRef) !== null && _3 !== void 0 ? _3 : ref({});
|
|
260
|
+
const markNotificationShown = (_4 = UChat === null || UChat === void 0 ? void 0 : UChat.markNotificationShown) !== null && _4 !== void 0 ? _4 : chatId => {
|
|
261
|
+
notificationsShownSetRef.value.add(chatId);
|
|
262
|
+
notificationsShownSetRef.value = new Set(notificationsShownSetRef.value);
|
|
263
|
+
};
|
|
264
|
+
const editMessageIdRef = (_5 = UChat === null || UChat === void 0 ? void 0 : UChat.editMessageIdRef) !== null && _5 !== void 0 ? _5 : ref(null);
|
|
265
|
+
const startEditingMessageRef = (_6 = UChat === null || UChat === void 0 ? void 0 : UChat.startEditingMessage) !== null && _6 !== void 0 ? _6 : ref();
|
|
266
|
+
const bubbleActionsRef = (_7 = UChat === null || UChat === void 0 ? void 0 : UChat.bubbleActionsRef) !== null && _7 !== void 0 ? _7 : toRef(props, 'bubbleActions');
|
|
267
|
+
const handleMessageSend = (_8 = UChat === null || UChat === void 0 ? void 0 : UChat.handleMessageSend) !== null && _8 !== void 0 ? _8 : (content, attachments) => {
|
|
268
|
+
var _a;
|
|
269
|
+
return (_a = props.onMessageSend) === null || _a === void 0 ? void 0 : _a.call(props, content, attachments);
|
|
270
|
+
};
|
|
271
|
+
const handleMessageRetry = (_9 = UChat === null || UChat === void 0 ? void 0 : UChat.handleMessageRetry) !== null && _9 !== void 0 ? _9 : message => {
|
|
272
|
+
var _a;
|
|
273
|
+
return (_a = props.onMessageRetry) === null || _a === void 0 ? void 0 : _a.call(props, message);
|
|
274
|
+
};
|
|
275
|
+
const handleFooterInputChange = (_10 = UChat === null || UChat === void 0 ? void 0 : UChat.handleFooterInputChange) !== null && _10 !== void 0 ? _10 : (value, chatId) => {
|
|
276
|
+
var _a;
|
|
277
|
+
return (_a = props.onFooterInputChange) === null || _a === void 0 ? void 0 : _a.call(props, value, chatId);
|
|
278
|
+
};
|
|
279
|
+
const onAttachmentUpload = (_11 = UChat === null || UChat === void 0 ? void 0 : UChat.onAttachmentUpload) !== null && _11 !== void 0 ? _11 : toRef(props, 'onAttachmentUpload');
|
|
280
|
+
const onChatClose = (_12 = UChat === null || UChat === void 0 ? void 0 : UChat.onChatClose) !== null && _12 !== void 0 ? _12 : toRef(props, 'onChatClose');
|
|
281
|
+
const onChatShare = (_13 = UChat === null || UChat === void 0 ? void 0 : UChat.onChatShare) !== null && _13 !== void 0 ? _13 : toRef(props, 'onChatShare');
|
|
282
|
+
const onUserProfile = (_14 = UChat === null || UChat === void 0 ? void 0 : UChat.onUserProfile) !== null && _14 !== void 0 ? _14 : toRef(props, 'onUserProfile');
|
|
283
|
+
const onMessagesScrollToTop = (_15 = UChat === null || UChat === void 0 ? void 0 : UChat.onMessagesScrollToTop) !== null && _15 !== void 0 ? _15 : toRef(props, 'onMessagesScrollToTop');
|
|
284
|
+
const onMessagesScrollToBottom = (_16 = UChat === null || UChat === void 0 ? void 0 : UChat.onMessagesScrollToBottom) !== null && _16 !== void 0 ? _16 : toRef(props, 'onMessagesScrollToBottom');
|
|
285
|
+
const cssVarsRef = computed(() => {
|
|
286
|
+
const {
|
|
287
|
+
common: {
|
|
288
|
+
cubicBezierEaseInOut,
|
|
289
|
+
brandPrimary500,
|
|
290
|
+
staticGreen,
|
|
291
|
+
staticRed,
|
|
292
|
+
textPrimary,
|
|
293
|
+
textSecondary,
|
|
294
|
+
textTertiary
|
|
295
|
+
},
|
|
296
|
+
self: {
|
|
297
|
+
backgroundColor,
|
|
298
|
+
borderColor,
|
|
299
|
+
sidebarItemSubtitleColor,
|
|
300
|
+
mainBackgroundColor,
|
|
301
|
+
headerBackgroundColor,
|
|
302
|
+
headerBorderColor,
|
|
303
|
+
headerTitleColor,
|
|
304
|
+
messageBubbleBackgroundColorOwn,
|
|
305
|
+
messageBubbleBackgroundColorOther,
|
|
306
|
+
messageBubbleTextColorOwn,
|
|
307
|
+
messageBubbleTextColorOther,
|
|
308
|
+
messageTimeColor,
|
|
309
|
+
messageStatusColor,
|
|
310
|
+
attachmentBackgroundColorOwn,
|
|
311
|
+
attachmentBackgroundColorOther,
|
|
312
|
+
footerBackgroundColor,
|
|
313
|
+
footerBorderColor,
|
|
314
|
+
inputBackgroundColor,
|
|
315
|
+
inputBorderColor,
|
|
316
|
+
inputSuffixColor,
|
|
317
|
+
unreadNotificationBackgroundColor,
|
|
318
|
+
unreadNotificationTextColor,
|
|
319
|
+
typingIndicatorColor,
|
|
320
|
+
dateSeparatorColor,
|
|
321
|
+
dateSeparatorBackgroundColor,
|
|
322
|
+
borderRadius,
|
|
323
|
+
errorColor
|
|
324
|
+
}
|
|
325
|
+
} = mergedThemeRef.value;
|
|
326
|
+
return {
|
|
327
|
+
'--u-bezier': cubicBezierEaseInOut,
|
|
328
|
+
'--u-color-primary': brandPrimary500,
|
|
329
|
+
'--u-color-success': staticGreen,
|
|
330
|
+
'--u-color-error': errorColor || staticRed,
|
|
331
|
+
'--u-text-color-base': textPrimary,
|
|
332
|
+
'--u-text-color-secondary': textSecondary,
|
|
333
|
+
'--u-text-color-disabled': textTertiary,
|
|
334
|
+
'--u-background-color': backgroundColor,
|
|
335
|
+
'--u-border-color': borderColor,
|
|
336
|
+
'--u-sidebar-item-subtitle-color': sidebarItemSubtitleColor,
|
|
337
|
+
'--u-main-background-color': mainBackgroundColor,
|
|
338
|
+
'--u-header-background-color': headerBackgroundColor,
|
|
339
|
+
'--u-header-border-color': headerBorderColor,
|
|
340
|
+
'--u-header-title-color': headerTitleColor,
|
|
341
|
+
'--u-message-bubble-background-color-own': messageBubbleBackgroundColorOwn,
|
|
342
|
+
'--u-message-bubble-background-color-other': messageBubbleBackgroundColorOther,
|
|
343
|
+
'--u-message-bubble-text-color-own': messageBubbleTextColorOwn,
|
|
344
|
+
'--u-message-bubble-text-color-other': messageBubbleTextColorOther,
|
|
345
|
+
'--u-message-time-color': messageTimeColor,
|
|
346
|
+
'--u-message-status-color': messageStatusColor,
|
|
347
|
+
'--u-attachment-background-color-own': attachmentBackgroundColorOwn,
|
|
348
|
+
'--u-attachment-background-color-other': attachmentBackgroundColorOther,
|
|
349
|
+
'--u-footer-background-color': footerBackgroundColor,
|
|
350
|
+
'--u-footer-border-color': footerBorderColor,
|
|
351
|
+
'--u-input-background-color': inputBackgroundColor,
|
|
352
|
+
'--u-input-border-color': inputBorderColor,
|
|
353
|
+
'--u-input-suffix-color': inputSuffixColor,
|
|
354
|
+
'--u-unread-notification-background-color': unreadNotificationBackgroundColor,
|
|
355
|
+
'--u-unread-notification-text-color': unreadNotificationTextColor,
|
|
356
|
+
'--u-typing-indicator-color': typingIndicatorColor,
|
|
357
|
+
'--u-date-separator-color': dateSeparatorColor,
|
|
358
|
+
'--u-date-separator-background-color': dateSeparatorBackgroundColor,
|
|
359
|
+
'--u-border-radius': borderRadius
|
|
360
|
+
};
|
|
361
|
+
});
|
|
362
|
+
const themeClassHandle = useThemeClass('chat-main-area', computed(() => ''), cssVarsRef, props);
|
|
96
363
|
const messagesBodyRef = ref();
|
|
97
364
|
const inputRef = ref();
|
|
98
365
|
const inputValue = ref('');
|
|
@@ -166,6 +433,11 @@ export default defineComponent({
|
|
|
166
433
|
deep: true,
|
|
167
434
|
flush: 'post'
|
|
168
435
|
});
|
|
436
|
+
onMounted(() => {
|
|
437
|
+
void nextTick(() => {
|
|
438
|
+
scrollToBottom();
|
|
439
|
+
});
|
|
440
|
+
});
|
|
169
441
|
watch(unreadMessagesCount, (newCount, oldCount) => {
|
|
170
442
|
if (selectedChatRef.value && newCount === 0 && oldCount > 0) {
|
|
171
443
|
showNotificationManually.value = false;
|
|
@@ -213,24 +485,24 @@ export default defineComponent({
|
|
|
213
485
|
lastScrollTop.value = scrollTop;
|
|
214
486
|
};
|
|
215
487
|
function scrollToBottom() {
|
|
216
|
-
const
|
|
217
|
-
if (!
|
|
218
|
-
if ('$el' in
|
|
219
|
-
const scrollContainer =
|
|
488
|
+
const element = messagesBodyRef.value;
|
|
489
|
+
if (!element) return;
|
|
490
|
+
if ('$el' in element && element.$el instanceof HTMLElement) {
|
|
491
|
+
const scrollContainer = element.$el.querySelector('.u-scrollbar-content');
|
|
220
492
|
if (scrollContainer) {
|
|
221
493
|
scrollContainer.scrollTop = scrollContainer.scrollHeight;
|
|
222
494
|
return;
|
|
223
495
|
}
|
|
224
496
|
}
|
|
225
|
-
if ('scrollTo' in
|
|
226
|
-
|
|
497
|
+
if ('scrollTo' in element && typeof element.scrollTo === 'function') {
|
|
498
|
+
element.scrollTo({
|
|
227
499
|
top: 999999,
|
|
228
500
|
behavior: 'auto'
|
|
229
501
|
});
|
|
230
502
|
return;
|
|
231
503
|
}
|
|
232
|
-
if ('scrollTop' in
|
|
233
|
-
|
|
504
|
+
if ('scrollTop' in element && 'scrollHeight' in element) {
|
|
505
|
+
element.scrollTop = element.scrollHeight;
|
|
234
506
|
}
|
|
235
507
|
}
|
|
236
508
|
const toKeyString = value => {
|
|
@@ -556,7 +828,7 @@ export default defineComponent({
|
|
|
556
828
|
wrap: false,
|
|
557
829
|
class: `${mergedClsPrefixRef.value}-chat-main__input-container`
|
|
558
830
|
}, {
|
|
559
|
-
default: () => h(Fragment, null, h(UUploadTrigger, {
|
|
831
|
+
default: () => h(Fragment, null, props.showAttachButton && h(UUploadTrigger, {
|
|
560
832
|
abstract: true
|
|
561
833
|
}, {
|
|
562
834
|
default: ({
|
|
@@ -626,7 +898,60 @@ export default defineComponent({
|
|
|
626
898
|
})
|
|
627
899
|
}));
|
|
628
900
|
};
|
|
901
|
+
if (isStandalone) {
|
|
902
|
+
provide(chatInjectionKey, {
|
|
903
|
+
mergedClsPrefixRef,
|
|
904
|
+
mergedThemeRef,
|
|
905
|
+
selectedChatRef,
|
|
906
|
+
messagesRef,
|
|
907
|
+
typingChatIdsRef,
|
|
908
|
+
messagesLoadingRef,
|
|
909
|
+
messagesLoadingCountRef,
|
|
910
|
+
headerButtonPropsRef,
|
|
911
|
+
headerIconPropsRef,
|
|
912
|
+
headerShareButtonPropsRef,
|
|
913
|
+
headerProfileButtonPropsRef,
|
|
914
|
+
headerCloseButtonPropsRef,
|
|
915
|
+
headerShareIconPropsRef,
|
|
916
|
+
headerProfileIconPropsRef,
|
|
917
|
+
messageUploadPropsRef,
|
|
918
|
+
footerInputPropsRef,
|
|
919
|
+
footerButtonPropsRef,
|
|
920
|
+
footerUploadPropsRef,
|
|
921
|
+
footerIconPropsRef,
|
|
922
|
+
footerSuffixIconPropsRef,
|
|
923
|
+
inputPlaceholderRef,
|
|
924
|
+
retryTextRef,
|
|
925
|
+
typingTextRef,
|
|
926
|
+
closeButtonTextRef,
|
|
927
|
+
shareButtonTooltipRef,
|
|
928
|
+
profileButtonTooltipRef,
|
|
929
|
+
unreadNotificationTextRef,
|
|
930
|
+
notificationsShownSetRef,
|
|
931
|
+
unreadCountsBeforeReadRef,
|
|
932
|
+
markNotificationShown,
|
|
933
|
+
handleMessageSend,
|
|
934
|
+
handleMessageRetry,
|
|
935
|
+
handleFooterInputChange,
|
|
936
|
+
startEditingMessage: startEditingMessageRef,
|
|
937
|
+
editMessageIdRef,
|
|
938
|
+
bubbleActionsRef,
|
|
939
|
+
onAttachmentUpload,
|
|
940
|
+
onAttachmentDownload: toRef(props, 'onAttachmentDownload'),
|
|
941
|
+
onChatClose,
|
|
942
|
+
onChatShare,
|
|
943
|
+
onUserProfile,
|
|
944
|
+
onMessagesScrollToTop,
|
|
945
|
+
onMessagesScrollToBottom
|
|
946
|
+
});
|
|
947
|
+
}
|
|
629
948
|
return {
|
|
949
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
950
|
+
mergedTheme: mergedThemeRef,
|
|
951
|
+
cssVars: cssVarsRef,
|
|
952
|
+
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
953
|
+
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender,
|
|
954
|
+
isStandalone,
|
|
630
955
|
renderHeader,
|
|
631
956
|
renderMessages,
|
|
632
957
|
renderEditingBlock,
|
|
@@ -641,17 +966,26 @@ export default defineComponent({
|
|
|
641
966
|
};
|
|
642
967
|
},
|
|
643
968
|
render() {
|
|
969
|
+
var _a;
|
|
970
|
+
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
644
971
|
const {
|
|
645
|
-
|
|
646
|
-
} =
|
|
647
|
-
|
|
648
|
-
class: `${
|
|
649
|
-
}, this.renderHeader(), h(USafeTopScrollbar, {
|
|
972
|
+
mergedClsPrefix
|
|
973
|
+
} = this;
|
|
974
|
+
const mainArea = h("div", {
|
|
975
|
+
class: [`${mergedClsPrefix}-chat-main`, this.isStandalone && `${mergedClsPrefix}-chat-main--standalone`]
|
|
976
|
+
}, !this.isStandalone && this.renderHeader(), h(USafeTopScrollbar, {
|
|
650
977
|
ref: "messagesBodyRef",
|
|
651
|
-
class: `${
|
|
978
|
+
class: `${mergedClsPrefix}-chat-main__body`,
|
|
652
979
|
onScroll: this.handleMessagesScroll
|
|
653
980
|
}, {
|
|
654
981
|
default: () => this.renderMessages()
|
|
655
982
|
}), this.renderFooter());
|
|
983
|
+
if (!this.isStandalone) {
|
|
984
|
+
return mainArea;
|
|
985
|
+
}
|
|
986
|
+
return h("div", {
|
|
987
|
+
class: [`${mergedClsPrefix}-chat`, this.themeClass],
|
|
988
|
+
style: this.cssVars
|
|
989
|
+
}, mainArea);
|
|
656
990
|
}
|
|
657
991
|
});
|
|
@@ -7226,39 +7226,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
7226
7226
|
renderSkeletonMessage: (isOwn: boolean, index: number) => JSX.Element;
|
|
7227
7227
|
renderDateSeparator: (date: string) => JSX.Element;
|
|
7228
7228
|
renderUnreadNotification: () => JSX.Element;
|
|
7229
|
-
|
|
7230
|
-
contextMenuMessage: import("vue").Ref<ChatMessageData | undefined, ChatMessageData | undefined>;
|
|
7231
|
-
messageContextMenuOptions: import("vue").ComputedRef<import("../..").MenuOption[] | undefined>;
|
|
7232
|
-
handleContextMenuSelect: (key: string) => void;
|
|
7233
|
-
cssVars: import("vue").ComputedRef<{
|
|
7234
|
-
'--u-bezier': string;
|
|
7235
|
-
'--u-color-primary': string;
|
|
7236
|
-
'--u-color-success': string;
|
|
7237
|
-
'--u-color-error': string;
|
|
7238
|
-
'--u-text-color-base': string;
|
|
7239
|
-
'--u-text-color-secondary': string;
|
|
7240
|
-
'--u-text-color-disabled': string;
|
|
7241
|
-
'--u-background-color': string;
|
|
7242
|
-
'--u-border-color': string;
|
|
7243
|
-
'--u-main-background-color': string;
|
|
7244
|
-
'--u-header-background-color': string;
|
|
7245
|
-
'--u-header-border-color': string;
|
|
7246
|
-
'--u-header-title-color': string;
|
|
7247
|
-
'--u-message-bubble-background-color-own': string;
|
|
7248
|
-
'--u-message-bubble-background-color-other': string;
|
|
7249
|
-
'--u-message-bubble-text-color-own': string;
|
|
7250
|
-
'--u-message-bubble-text-color-other': string;
|
|
7251
|
-
'--u-message-time-color': string;
|
|
7252
|
-
'--u-message-status-color': string;
|
|
7253
|
-
'--u-attachment-background-color-own': string;
|
|
7254
|
-
'--u-attachment-background-color-other': string;
|
|
7255
|
-
'--u-unread-notification-background-color': string;
|
|
7256
|
-
'--u-unread-notification-text-color': string;
|
|
7257
|
-
'--u-typing-indicator-color': string;
|
|
7258
|
-
'--u-date-separator-color': string;
|
|
7259
|
-
'--u-date-separator-background-color': string;
|
|
7260
|
-
'--u-border-radius': string;
|
|
7261
|
-
}>;
|
|
7229
|
+
cssVars: import("vue").ComputedRef<Record<string, string>>;
|
|
7262
7230
|
themeClass: import("vue").Ref<string, string>;
|
|
7263
7231
|
onRender: () => void;
|
|
7264
7232
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|