@uzum-tech/ui 2.3.3 → 2.3.4
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 +287 -242
- package/dist/index.mjs +287 -242
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/chat/src/Chat.d.ts +363 -3120
- package/es/chat/src/Chat.mjs +13 -240
- package/es/chat/src/ChatListItems.d.ts +4 -4
- package/es/chat/src/ChatMainArea.d.ts +36 -10
- package/es/chat/src/ChatMainArea.mjs +49 -3
- package/es/chat/src/ChatMessages.d.ts +3 -3
- package/es/chat/src/interface.d.ts +2814 -2
- package/es/chat/src/interface.mjs +244 -1
- package/es/components.d.ts +251 -183
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/chat/src/Chat.d.ts +363 -3120
- package/lib/chat/src/Chat.js +15 -180
- package/lib/chat/src/ChatListItems.d.ts +4 -4
- package/lib/chat/src/ChatMainArea.d.ts +36 -10
- package/lib/chat/src/ChatMainArea.js +48 -3
- package/lib/chat/src/ChatMessages.d.ts +3 -3
- package/lib/chat/src/interface.d.ts +2814 -2
- package/lib/chat/src/interface.js +183 -1
- package/lib/components.d.ts +251 -183
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/web-types.json +9 -2
package/es/chat/src/Chat.mjs
CHANGED
|
@@ -5,254 +5,17 @@ import { UFlex } from "../../flex/index.mjs";
|
|
|
5
5
|
import { chatLight } from "../styles/index.mjs";
|
|
6
6
|
import ChatMainArea from "./ChatMainArea.mjs";
|
|
7
7
|
import ChatSidebar from "./ChatParts/Sidebar.mjs";
|
|
8
|
-
import { chatInjectionKey } from "./interface.mjs";
|
|
8
|
+
import { chatInjectionKey, chatProps } from "./interface.mjs";
|
|
9
9
|
import style from "./styles/index.cssr.mjs";
|
|
10
|
-
export const chatProps = Object.assign(Object.assign({}, useTheme.props), {
|
|
11
|
-
chatItems: {
|
|
12
|
-
type: Array,
|
|
13
|
-
default: () => []
|
|
14
|
-
},
|
|
15
|
-
selectedChatId: {
|
|
16
|
-
type: [String, Number],
|
|
17
|
-
default: undefined
|
|
18
|
-
},
|
|
19
|
-
messages: {
|
|
20
|
-
type: Array,
|
|
21
|
-
default: () => []
|
|
22
|
-
},
|
|
23
|
-
typingChatIds: {
|
|
24
|
-
type: Array,
|
|
25
|
-
default: () => []
|
|
26
|
-
},
|
|
27
|
-
disabled: {
|
|
28
|
-
type: Boolean,
|
|
29
|
-
default: false
|
|
30
|
-
},
|
|
31
|
-
listEmptyProps: {
|
|
32
|
-
type: Object,
|
|
33
|
-
default: undefined
|
|
34
|
-
},
|
|
35
|
-
listHeaderTitle: {
|
|
36
|
-
type: [String, Function],
|
|
37
|
-
default: 'Chats'
|
|
38
|
-
},
|
|
39
|
-
listHeaderActions: {
|
|
40
|
-
type: Array,
|
|
41
|
-
default: () => []
|
|
42
|
-
},
|
|
43
|
-
listHeaderButtonProps: {
|
|
44
|
-
type: Object,
|
|
45
|
-
default: undefined
|
|
46
|
-
},
|
|
47
|
-
listHeaderIconProps: {
|
|
48
|
-
type: Object,
|
|
49
|
-
default: undefined
|
|
50
|
-
},
|
|
51
|
-
listItemAvatarProps: {
|
|
52
|
-
type: Object,
|
|
53
|
-
default: undefined
|
|
54
|
-
},
|
|
55
|
-
listItemBadgeProps: {
|
|
56
|
-
type: Object,
|
|
57
|
-
default: undefined
|
|
58
|
-
},
|
|
59
|
-
headerTitle: {
|
|
60
|
-
type: [String, Function],
|
|
61
|
-
default: undefined
|
|
62
|
-
},
|
|
63
|
-
headerActions: {
|
|
64
|
-
type: Array,
|
|
65
|
-
default: () => []
|
|
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
|
-
messageSenderAvatarProps: {
|
|
96
|
-
type: Object,
|
|
97
|
-
default: undefined
|
|
98
|
-
},
|
|
99
|
-
messageUploadProps: {
|
|
100
|
-
type: Object,
|
|
101
|
-
default: undefined
|
|
102
|
-
},
|
|
103
|
-
messageButtonProps: {
|
|
104
|
-
type: Object,
|
|
105
|
-
default: undefined
|
|
106
|
-
},
|
|
107
|
-
footerInputProps: {
|
|
108
|
-
type: Object,
|
|
109
|
-
default: undefined
|
|
110
|
-
},
|
|
111
|
-
footerButtonProps: {
|
|
112
|
-
type: Object,
|
|
113
|
-
default: undefined
|
|
114
|
-
},
|
|
115
|
-
footerUploadProps: {
|
|
116
|
-
type: Object,
|
|
117
|
-
default: undefined
|
|
118
|
-
},
|
|
119
|
-
footerUploadTriggerProps: {
|
|
120
|
-
type: Object,
|
|
121
|
-
default: undefined
|
|
122
|
-
},
|
|
123
|
-
footerIconProps: {
|
|
124
|
-
type: Object,
|
|
125
|
-
default: undefined
|
|
126
|
-
},
|
|
127
|
-
footerSuffixIconProps: {
|
|
128
|
-
type: Object,
|
|
129
|
-
default: undefined
|
|
130
|
-
},
|
|
131
|
-
emptyProps: {
|
|
132
|
-
type: Object,
|
|
133
|
-
default: undefined
|
|
134
|
-
},
|
|
135
|
-
retryText: {
|
|
136
|
-
type: String,
|
|
137
|
-
default: undefined
|
|
138
|
-
},
|
|
139
|
-
typingText: {
|
|
140
|
-
type: String,
|
|
141
|
-
default: undefined
|
|
142
|
-
},
|
|
143
|
-
closeButtonText: {
|
|
144
|
-
type: String,
|
|
145
|
-
default: undefined
|
|
146
|
-
},
|
|
147
|
-
shareButtonTooltip: {
|
|
148
|
-
type: String,
|
|
149
|
-
default: undefined
|
|
150
|
-
},
|
|
151
|
-
profileButtonTooltip: {
|
|
152
|
-
type: String,
|
|
153
|
-
default: undefined
|
|
154
|
-
},
|
|
155
|
-
unreadNotificationText: {
|
|
156
|
-
type: String,
|
|
157
|
-
default: undefined
|
|
158
|
-
},
|
|
159
|
-
chatItemsLoading: {
|
|
160
|
-
type: Boolean,
|
|
161
|
-
default: false
|
|
162
|
-
},
|
|
163
|
-
chatItemsLoadingCount: {
|
|
164
|
-
type: Number,
|
|
165
|
-
default: 10
|
|
166
|
-
},
|
|
167
|
-
messagesLoading: {
|
|
168
|
-
type: Boolean,
|
|
169
|
-
default: false
|
|
170
|
-
},
|
|
171
|
-
messagesLoadingCount: {
|
|
172
|
-
type: Number,
|
|
173
|
-
default: 10
|
|
174
|
-
},
|
|
175
|
-
height: {
|
|
176
|
-
type: [String, Number],
|
|
177
|
-
default: 800
|
|
178
|
-
},
|
|
179
|
-
onChatSelect: {
|
|
180
|
-
type: Function,
|
|
181
|
-
default: undefined
|
|
182
|
-
},
|
|
183
|
-
onMessageRetry: {
|
|
184
|
-
type: Function,
|
|
185
|
-
default: undefined
|
|
186
|
-
},
|
|
187
|
-
bubbleActions: {
|
|
188
|
-
type: Array,
|
|
189
|
-
default: undefined
|
|
190
|
-
},
|
|
191
|
-
onChatClose: {
|
|
192
|
-
type: Function,
|
|
193
|
-
default: undefined
|
|
194
|
-
},
|
|
195
|
-
onChatShare: {
|
|
196
|
-
type: Function,
|
|
197
|
-
default: undefined
|
|
198
|
-
},
|
|
199
|
-
onUserProfile: {
|
|
200
|
-
type: Function,
|
|
201
|
-
default: undefined
|
|
202
|
-
},
|
|
203
|
-
onAttachmentUpload: {
|
|
204
|
-
type: Function,
|
|
205
|
-
default: undefined
|
|
206
|
-
},
|
|
207
|
-
onAttachmentDownload: {
|
|
208
|
-
type: Function,
|
|
209
|
-
default: undefined
|
|
210
|
-
},
|
|
211
|
-
onFilterChange: {
|
|
212
|
-
type: Function,
|
|
213
|
-
default: undefined
|
|
214
|
-
},
|
|
215
|
-
onFooterInputChange: {
|
|
216
|
-
type: Function,
|
|
217
|
-
default: undefined
|
|
218
|
-
},
|
|
219
|
-
onNetworkError: {
|
|
220
|
-
type: Function,
|
|
221
|
-
default: undefined
|
|
222
|
-
},
|
|
223
|
-
onUploadError: {
|
|
224
|
-
type: Function,
|
|
225
|
-
default: undefined
|
|
226
|
-
},
|
|
227
|
-
onSendError: {
|
|
228
|
-
type: Function,
|
|
229
|
-
default: undefined
|
|
230
|
-
},
|
|
231
|
-
onChatItemsScrollToTop: {
|
|
232
|
-
type: Function,
|
|
233
|
-
default: undefined
|
|
234
|
-
},
|
|
235
|
-
onChatItemsScrollToBottom: {
|
|
236
|
-
type: Function,
|
|
237
|
-
default: undefined
|
|
238
|
-
},
|
|
239
|
-
onMessagesScrollToTop: {
|
|
240
|
-
type: Function,
|
|
241
|
-
default: undefined
|
|
242
|
-
},
|
|
243
|
-
onMessagesScrollToBottom: {
|
|
244
|
-
type: Function,
|
|
245
|
-
default: undefined
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
10
|
export default defineComponent({
|
|
249
11
|
name: 'Chat',
|
|
250
12
|
props: chatProps,
|
|
251
|
-
emits: ['update:selectedChatId', 'message-send', 'message-retry', 'attachment-upload', 'mark-messages-read', 'filter-change', 'footer-input-change', 'network-error', 'upload-error', 'send-error', 'chat-items-scroll-to-top', 'chat-items-scroll-to-bottom', 'messages-scroll-to-top', 'messages-scroll-to-bottom'],
|
|
13
|
+
emits: ['update:selectedChatId', 'update:inputValue', 'message-send', 'message-retry', 'attachment-upload', 'mark-messages-read', 'filter-change', 'footer-input-change', 'network-error', 'upload-error', 'send-error', 'chat-items-scroll-to-top', 'chat-items-scroll-to-bottom', 'messages-scroll-to-top', 'messages-scroll-to-bottom'],
|
|
252
14
|
setup(props, {
|
|
253
15
|
emit,
|
|
254
16
|
expose
|
|
255
17
|
}) {
|
|
18
|
+
var _a;
|
|
256
19
|
const {
|
|
257
20
|
mergedClsPrefixRef
|
|
258
21
|
} = useConfig(props);
|
|
@@ -352,6 +115,14 @@ export default defineComponent({
|
|
|
352
115
|
const mergedSelectedChatIdRef = computed(() => {
|
|
353
116
|
return props.selectedChatId !== undefined ? props.selectedChatId : uncontrolledSelectedChatIdRef.value;
|
|
354
117
|
});
|
|
118
|
+
const uncontrolledInputValueRef = ref((_a = props.inputValue) !== null && _a !== void 0 ? _a : '');
|
|
119
|
+
const mergedInputValueRef = computed(() => {
|
|
120
|
+
return props.inputValue !== undefined ? props.inputValue : uncontrolledInputValueRef.value;
|
|
121
|
+
});
|
|
122
|
+
const handleInputValueChange = value => {
|
|
123
|
+
uncontrolledInputValueRef.value = value;
|
|
124
|
+
emit('update:inputValue', value);
|
|
125
|
+
};
|
|
355
126
|
const selectedChatRef = computed(() => {
|
|
356
127
|
var _a;
|
|
357
128
|
return (_a = props.chatItems) === null || _a === void 0 ? void 0 : _a.find(item => item.id === mergedSelectedChatIdRef.value);
|
|
@@ -469,6 +240,8 @@ export default defineComponent({
|
|
|
469
240
|
chatItemsRef: toRef(props, 'chatItems'),
|
|
470
241
|
selectedChatIdRef: mergedSelectedChatIdRef,
|
|
471
242
|
selectedChatRef,
|
|
243
|
+
inputValueRef: mergedInputValueRef,
|
|
244
|
+
handleInputValueChange,
|
|
472
245
|
messagesRef: filteredMessagesRef,
|
|
473
246
|
typingChatIdsRef: toRef(props, 'typingChatIds'),
|
|
474
247
|
chatItemsLoadingRef: toRef(props, 'chatItemsLoading'),
|
|
@@ -11609,13 +11609,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
11609
11609
|
readonly loading: boolean;
|
|
11610
11610
|
readonly typingText: string;
|
|
11611
11611
|
readonly emptyProps: Partial<EmptyProps>;
|
|
11612
|
-
readonly loadingCount: number;
|
|
11613
|
-
readonly typingChatIds: (string | number | symbol)[];
|
|
11614
|
-
readonly selectedChatId: string | number | symbol;
|
|
11615
11612
|
readonly chatItems: ChatListItemData[];
|
|
11613
|
+
readonly selectedChatId: string | number | symbol;
|
|
11614
|
+
readonly onChatSelect: (chatId: string | number | symbol) => void;
|
|
11615
|
+
readonly typingChatIds: (string | number | symbol)[];
|
|
11616
|
+
readonly loadingCount: number;
|
|
11616
11617
|
readonly avatarProps: Partial<AvatarProps>;
|
|
11617
11618
|
readonly badgeProps: Partial<BadgeProps>;
|
|
11618
|
-
readonly onChatSelect: (chatId: string | number | symbol) => void;
|
|
11619
11619
|
readonly notificationsShown: Set<string | number | symbol>;
|
|
11620
11620
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
11621
11621
|
export default _default;
|
|
@@ -10,6 +10,10 @@ export declare const chatMainAreaProps: {
|
|
|
10
10
|
readonly type: PropType<ChatListItemData>;
|
|
11
11
|
readonly default: undefined;
|
|
12
12
|
};
|
|
13
|
+
readonly inputValue: {
|
|
14
|
+
readonly type: StringConstructor;
|
|
15
|
+
readonly default: undefined;
|
|
16
|
+
};
|
|
13
17
|
readonly messages: {
|
|
14
18
|
readonly type: PropType<ChatMessageData[]>;
|
|
15
19
|
readonly default: () => never[];
|
|
@@ -126,6 +130,10 @@ export declare const chatMainAreaProps: {
|
|
|
126
130
|
readonly type: PropType<(value: string, chatId: ChatId) => void>;
|
|
127
131
|
readonly default: undefined;
|
|
128
132
|
};
|
|
133
|
+
readonly 'onUpdate:inputValue': {
|
|
134
|
+
readonly type: PropType<(value: string) => void>;
|
|
135
|
+
readonly default: undefined;
|
|
136
|
+
};
|
|
129
137
|
readonly onChatClose: {
|
|
130
138
|
readonly type: PropType<() => void>;
|
|
131
139
|
readonly default: undefined;
|
|
@@ -2726,6 +2734,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2726
2734
|
readonly type: PropType<ChatListItemData>;
|
|
2727
2735
|
readonly default: undefined;
|
|
2728
2736
|
};
|
|
2737
|
+
readonly inputValue: {
|
|
2738
|
+
readonly type: StringConstructor;
|
|
2739
|
+
readonly default: undefined;
|
|
2740
|
+
};
|
|
2729
2741
|
readonly messages: {
|
|
2730
2742
|
readonly type: PropType<ChatMessageData[]>;
|
|
2731
2743
|
readonly default: () => never[];
|
|
@@ -2842,6 +2854,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2842
2854
|
readonly type: PropType<(value: string, chatId: ChatId) => void>;
|
|
2843
2855
|
readonly default: undefined;
|
|
2844
2856
|
};
|
|
2857
|
+
readonly 'onUpdate:inputValue': {
|
|
2858
|
+
readonly type: PropType<(value: string) => void>;
|
|
2859
|
+
readonly default: undefined;
|
|
2860
|
+
};
|
|
2845
2861
|
readonly onChatClose: {
|
|
2846
2862
|
readonly type: PropType<() => void>;
|
|
2847
2863
|
readonly default: undefined;
|
|
@@ -9193,7 +9209,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
9193
9209
|
$el: HTMLElement;
|
|
9194
9210
|
} | undefined>;
|
|
9195
9211
|
inputRef: Ref<HTMLInputElement | undefined, HTMLInputElement | undefined>;
|
|
9196
|
-
inputValue:
|
|
9212
|
+
inputValue: import("vue").WritableComputedRef<string, string>;
|
|
9197
9213
|
handleSendMessage: () => Promise<void>;
|
|
9198
9214
|
handleMessagesScroll: (e: Event) => void;
|
|
9199
9215
|
scrollToBottom: () => void;
|
|
@@ -9203,6 +9219,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
9203
9219
|
readonly type: PropType<ChatListItemData>;
|
|
9204
9220
|
readonly default: undefined;
|
|
9205
9221
|
};
|
|
9222
|
+
readonly inputValue: {
|
|
9223
|
+
readonly type: StringConstructor;
|
|
9224
|
+
readonly default: undefined;
|
|
9225
|
+
};
|
|
9206
9226
|
readonly messages: {
|
|
9207
9227
|
readonly type: PropType<ChatMessageData[]>;
|
|
9208
9228
|
readonly default: () => never[];
|
|
@@ -9319,6 +9339,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
9319
9339
|
readonly type: PropType<(value: string, chatId: ChatId) => void>;
|
|
9320
9340
|
readonly default: undefined;
|
|
9321
9341
|
};
|
|
9342
|
+
readonly 'onUpdate:inputValue': {
|
|
9343
|
+
readonly type: PropType<(value: string) => void>;
|
|
9344
|
+
readonly default: undefined;
|
|
9345
|
+
};
|
|
9322
9346
|
readonly onChatClose: {
|
|
9323
9347
|
readonly type: PropType<() => void>;
|
|
9324
9348
|
readonly default: undefined;
|
|
@@ -11922,12 +11946,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
11922
11946
|
readonly profileButtonTooltip: string;
|
|
11923
11947
|
readonly unreadNotificationText: string;
|
|
11924
11948
|
readonly onAttachmentDownload: OnAttachmentDownload;
|
|
11925
|
-
readonly
|
|
11949
|
+
readonly inputValue: string;
|
|
11926
11950
|
readonly messages: ChatMessageData[];
|
|
11927
|
-
readonly loadingCount: number;
|
|
11928
|
-
readonly typingChatIds: (string | number | symbol)[];
|
|
11929
|
-
readonly onMessageRetry: (message: ChatMessageData) => void;
|
|
11930
|
-
readonly selectedChat: ChatListItemData;
|
|
11931
11951
|
readonly headerButtonProps: Partial<ButtonProps>;
|
|
11932
11952
|
readonly headerIconProps: Partial<IconProps>;
|
|
11933
11953
|
readonly headerShareButtonProps: Partial<ButtonProps>;
|
|
@@ -11941,14 +11961,20 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
11941
11961
|
readonly footerUploadProps: Partial<UploadProps>;
|
|
11942
11962
|
readonly footerIconProps: Partial<IconProps>;
|
|
11943
11963
|
readonly footerSuffixIconProps: Partial<IconProps>;
|
|
11944
|
-
readonly
|
|
11945
|
-
readonly
|
|
11946
|
-
readonly
|
|
11964
|
+
readonly onMessageRetry: (message: ChatMessageData) => void;
|
|
11965
|
+
readonly bubbleActions: ChatBubbleAction[];
|
|
11966
|
+
readonly onAttachmentUpload: OnAttachmentUpload;
|
|
11967
|
+
readonly typingChatIds: (string | number | symbol)[];
|
|
11947
11968
|
readonly onChatClose: () => void;
|
|
11948
11969
|
readonly onChatShare: () => void;
|
|
11949
11970
|
readonly onUserProfile: () => void;
|
|
11950
|
-
readonly
|
|
11971
|
+
readonly onFooterInputChange: (value: string, chatId: ChatId) => void;
|
|
11951
11972
|
readonly onMessagesScrollToTop: () => void;
|
|
11952
11973
|
readonly onMessagesScrollToBottom: () => void;
|
|
11974
|
+
readonly loadingCount: number;
|
|
11975
|
+
readonly selectedChat: ChatListItemData;
|
|
11976
|
+
readonly showAttachButton: boolean;
|
|
11977
|
+
readonly onMessageSend: OnMessageSend;
|
|
11978
|
+
readonly 'onUpdate:inputValue': (value: string) => void;
|
|
11953
11979
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
11954
11980
|
export default _default;
|
|
@@ -25,6 +25,14 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
|
|
|
25
25
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
29
|
+
var t = {};
|
|
30
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
31
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
32
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
33
|
+
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
28
36
|
import { computed, defineComponent, Fragment, h, inject, nextTick, onMounted, provide, ref, toRef, watch } from 'vue';
|
|
29
37
|
import { ArrowHookUpRight, AttachIcon, CloseIcon, PersonNote, SendFilled } from "../../_internal/icons/index.mjs";
|
|
30
38
|
import { useConfig, useLocale, useTheme, useThemeClass } from "../../_mixins/index.mjs";
|
|
@@ -48,6 +56,10 @@ export const chatMainAreaProps = Object.assign(Object.assign({}, useTheme.props)
|
|
|
48
56
|
type: Object,
|
|
49
57
|
default: undefined
|
|
50
58
|
},
|
|
59
|
+
inputValue: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: undefined
|
|
62
|
+
},
|
|
51
63
|
messages: {
|
|
52
64
|
type: Array,
|
|
53
65
|
default: () => []
|
|
@@ -164,6 +176,10 @@ export const chatMainAreaProps = Object.assign(Object.assign({}, useTheme.props)
|
|
|
164
176
|
type: Function,
|
|
165
177
|
default: undefined
|
|
166
178
|
},
|
|
179
|
+
'onUpdate:inputValue': {
|
|
180
|
+
type: Function,
|
|
181
|
+
default: undefined
|
|
182
|
+
},
|
|
167
183
|
onChatClose: {
|
|
168
184
|
type: Function,
|
|
169
185
|
default: undefined
|
|
@@ -199,7 +215,7 @@ export default defineComponent({
|
|
|
199
215
|
setup(props, {
|
|
200
216
|
slots
|
|
201
217
|
}) {
|
|
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;
|
|
218
|
+
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, _17, _18;
|
|
203
219
|
const UChat = inject(chatInjectionKey, null);
|
|
204
220
|
const isStandalone = !UChat;
|
|
205
221
|
const {
|
|
@@ -223,6 +239,15 @@ export default defineComponent({
|
|
|
223
239
|
const headerProfileIconPropsRef = (_o = UChat === null || UChat === void 0 ? void 0 : UChat.headerProfileIconPropsRef) !== null && _o !== void 0 ? _o : toRef(props, 'headerProfileIconProps');
|
|
224
240
|
const messageUploadPropsRef = (_p = UChat === null || UChat === void 0 ? void 0 : UChat.messageUploadPropsRef) !== null && _p !== void 0 ? _p : toRef(props, 'messageUploadProps');
|
|
225
241
|
const footerInputPropsRef = (_q = UChat === null || UChat === void 0 ? void 0 : UChat.footerInputPropsRef) !== null && _q !== void 0 ? _q : toRef(props, 'footerInputProps');
|
|
242
|
+
const safeFooterInputPropsRef = computed(() => {
|
|
243
|
+
var _a;
|
|
244
|
+
const _b = (_a = footerInputPropsRef.value) !== null && _a !== void 0 ? _a : {},
|
|
245
|
+
{
|
|
246
|
+
value
|
|
247
|
+
} = _b,
|
|
248
|
+
rest = __rest(_b, ["value"]);
|
|
249
|
+
return rest;
|
|
250
|
+
});
|
|
226
251
|
const footerButtonPropsRef = (_r = UChat === null || UChat === void 0 ? void 0 : UChat.footerButtonPropsRef) !== null && _r !== void 0 ? _r : toRef(props, 'footerButtonProps');
|
|
227
252
|
const footerUploadPropsRef = (_s = UChat === null || UChat === void 0 ? void 0 : UChat.footerUploadPropsRef) !== null && _s !== void 0 ? _s : toRef(props, 'footerUploadProps');
|
|
228
253
|
const footerIconPropsRef = (_t = UChat === null || UChat === void 0 ? void 0 : UChat.footerIconPropsRef) !== null && _t !== void 0 ? _t : toRef(props, 'footerIconProps');
|
|
@@ -362,7 +387,24 @@ export default defineComponent({
|
|
|
362
387
|
const themeClassHandle = useThemeClass('chat-main-area', computed(() => ''), cssVarsRef, props);
|
|
363
388
|
const messagesBodyRef = ref();
|
|
364
389
|
const inputRef = ref();
|
|
365
|
-
const
|
|
390
|
+
const uncontrolledInputValueRef = ref((_17 = props.inputValue) !== null && _17 !== void 0 ? _17 : '');
|
|
391
|
+
const handleInputValueChange = (_18 = UChat === null || UChat === void 0 ? void 0 : UChat.handleInputValueChange) !== null && _18 !== void 0 ? _18 : value => {
|
|
392
|
+
var _a;
|
|
393
|
+
uncontrolledInputValueRef.value = value;
|
|
394
|
+
(_a = props['onUpdate:inputValue']) === null || _a === void 0 ? void 0 : _a.call(props, value);
|
|
395
|
+
};
|
|
396
|
+
const inputValue = computed({
|
|
397
|
+
get: () => {
|
|
398
|
+
var _a;
|
|
399
|
+
if (UChat) {
|
|
400
|
+
return (_a = UChat.inputValueRef.value) !== null && _a !== void 0 ? _a : '';
|
|
401
|
+
}
|
|
402
|
+
return props.inputValue !== undefined ? props.inputValue : uncontrolledInputValueRef.value;
|
|
403
|
+
},
|
|
404
|
+
set: value => {
|
|
405
|
+
handleInputValueChange(value);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
366
408
|
const attachmentFileList = ref([]);
|
|
367
409
|
const uploadedAttachmentsMap = ref(new Map());
|
|
368
410
|
const lastScrollTop = ref(0);
|
|
@@ -875,13 +917,15 @@ export default defineComponent({
|
|
|
875
917
|
}
|
|
876
918
|
},
|
|
877
919
|
onKeydown: e => {
|
|
920
|
+
var _a, _b;
|
|
921
|
+
(_b = (_a = footerInputPropsRef.value) === null || _a === void 0 ? void 0 : _a.onKeydown) === null || _b === void 0 ? void 0 : _b.call(_a, e);
|
|
878
922
|
if (e.key === 'Enter' && !e.shiftKey) {
|
|
879
923
|
e.preventDefault();
|
|
880
924
|
e.stopPropagation();
|
|
881
925
|
void handleSendMessage();
|
|
882
926
|
}
|
|
883
927
|
}
|
|
884
|
-
},
|
|
928
|
+
}, safeFooterInputPropsRef.value), {
|
|
885
929
|
prefix: () => renderEditingBlock(),
|
|
886
930
|
suffix: () => h(UIcon, Object.assign({
|
|
887
931
|
size: 24,
|
|
@@ -904,6 +948,8 @@ export default defineComponent({
|
|
|
904
948
|
mergedClsPrefixRef,
|
|
905
949
|
mergedThemeRef,
|
|
906
950
|
selectedChatRef,
|
|
951
|
+
inputValueRef: inputValue,
|
|
952
|
+
handleInputValueChange,
|
|
907
953
|
messagesRef,
|
|
908
954
|
typingChatIdsRef,
|
|
909
955
|
messagesLoadingRef,
|
|
@@ -11604,12 +11604,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
11604
11604
|
readonly retryText: string;
|
|
11605
11605
|
readonly unreadNotificationText: string;
|
|
11606
11606
|
readonly uploadProps: Partial<UploadProps>;
|
|
11607
|
+
readonly selectedChatId: string | number | symbol;
|
|
11607
11608
|
readonly messages: ChatMessageData[];
|
|
11608
|
-
readonly
|
|
11609
|
+
readonly onMessageRetry: (message: ChatMessageData) => void;
|
|
11609
11610
|
readonly typingChatIds: (string | number | symbol)[];
|
|
11610
|
-
readonly
|
|
11611
|
+
readonly loadingCount: number;
|
|
11611
11612
|
readonly showUnreadNotification: boolean;
|
|
11612
11613
|
readonly unreadNotificationCount: number;
|
|
11613
|
-
readonly onMessageRetry: (message: ChatMessageData) => void;
|
|
11614
11614
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
11615
11615
|
export default _default;
|