@progress/kendo-react-conversational-ui 14.3.3-develop.1 → 14.4.0-develop.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/ai-prompt/AIPromptContent.js +1 -1
- package/ai-prompt/AIPromptContent.mjs +2 -2
- package/ai-prompt/views/AIPromptOutputView.js +1 -1
- package/ai-prompt/views/AIPromptOutputView.mjs +63 -36
- package/chat/ChatPropsAndState.d.ts +65 -0
- package/chat/Events.d.ts +19 -0
- package/chat/components/Chat.js +1 -1
- package/chat/components/Chat.mjs +373 -314
- package/chat/components/ChatContext.d.ts +2 -0
- package/chat/components/ChatMessage.js +1 -1
- package/chat/components/ChatMessage.mjs +174 -175
- package/chat/components/elements/PinnedMessage.d.ts +1 -0
- package/chat/components/elements/PinnedMessage.js +1 -1
- package/chat/components/elements/PinnedMessage.mjs +17 -21
- package/chat/hooks/useEndlessScroll.d.ts +49 -0
- package/chat/hooks/useEndlessScroll.js +8 -0
- package/chat/hooks/useEndlessScroll.mjs +267 -0
- package/chat/utils/scroll.d.ts +5 -2
- package/chat/utils/scroll.js +1 -1
- package/chat/utils/scroll.mjs +89 -83
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +11 -11
package/chat/components/Chat.mjs
CHANGED
|
@@ -5,181 +5,218 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { validatePackage as
|
|
8
|
+
import { validatePackage as Dt, getLicenseMessage as Ot, Keys as F, classNames as Ge, WatermarkOverlay as Pt } from "@progress/kendo-react-common";
|
|
9
9
|
import o from "prop-types";
|
|
10
10
|
import * as t from "react";
|
|
11
|
-
import { FloatingActionButton as
|
|
12
|
-
import { arrowDownOutlineIcon as
|
|
13
|
-
import { convertMsgsToViewItems as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import { ChatMessage as
|
|
24
|
-
import { packageMetadata as
|
|
25
|
-
import { ariaLabelMessageList as
|
|
26
|
-
import { useLocalization as
|
|
27
|
-
import { isStandardMessageFormat as
|
|
28
|
-
import {
|
|
29
|
-
import { resolveMessageSettings as
|
|
30
|
-
|
|
11
|
+
import { FloatingActionButton as Ut } from "@progress/kendo-react-buttons";
|
|
12
|
+
import { arrowDownOutlineIcon as jt } from "@progress/kendo-svg-icons";
|
|
13
|
+
import { convertMsgsToViewItems as Vt } from "../ViewItem.mjs";
|
|
14
|
+
import qt from "./ActionGroup.mjs";
|
|
15
|
+
import zt from "./AttachmentGroup.mjs";
|
|
16
|
+
import Wt from "./DateMarker.mjs";
|
|
17
|
+
import Gt from "./MessageGroup.mjs";
|
|
18
|
+
import Ht from "./NewMessage.mjs";
|
|
19
|
+
import Kt from "./Header.mjs";
|
|
20
|
+
import $t from "./elements/PinnedMessage.mjs";
|
|
21
|
+
import Jt from "./Notification.mjs";
|
|
22
|
+
import Qt from "./ChatContext.mjs";
|
|
23
|
+
import { ChatMessage as Xt } from "./ChatMessage.mjs";
|
|
24
|
+
import { packageMetadata as He } from "../../package-metadata.mjs";
|
|
25
|
+
import { ariaLabelMessageList as Ke, messages as L, scrollToBottom as w, chatCopyNotification as $e } from "../../messages/index.mjs";
|
|
26
|
+
import { useLocalization as Yt } from "@progress/kendo-react-intl";
|
|
27
|
+
import { isStandardMessageFormat as Zt, mapDataArrayToMessages as _t } from "../utils/fieldMapping.mjs";
|
|
28
|
+
import { useMessageAutoScroll as es, useHasScrollbar as ts } from "../utils/scroll.mjs";
|
|
29
|
+
import { resolveMessageSettings as ss } from "../utils/messageSettings.mjs";
|
|
30
|
+
import { useEndlessScroll as os } from "../hooks/useEndlessScroll.mjs";
|
|
31
|
+
const Je = t.forwardRef((Qe, b) => {
|
|
31
32
|
const {
|
|
32
|
-
messages:
|
|
33
|
-
messageTemplate:
|
|
34
|
-
messageContentTemplate:
|
|
35
|
-
attachmentTemplate:
|
|
36
|
-
width:
|
|
37
|
-
height:
|
|
38
|
-
onSendMessage:
|
|
39
|
-
onSuggestionClick:
|
|
40
|
-
onInputValueChange:
|
|
41
|
-
onActionExecute:
|
|
42
|
-
dir:
|
|
43
|
-
messageBox:
|
|
44
|
-
placeholder:
|
|
45
|
-
className:
|
|
46
|
-
style:
|
|
47
|
-
message:
|
|
48
|
-
authorId:
|
|
49
|
-
suggestions:
|
|
50
|
-
suggestionTemplate:
|
|
51
|
-
suggestionsLayout:
|
|
52
|
-
quickActionsLayout:
|
|
53
|
-
inputValue:
|
|
54
|
-
headerTemplate:
|
|
55
|
-
noDataTemplate:
|
|
56
|
-
timestampTemplate:
|
|
57
|
-
statusTemplate:
|
|
58
|
-
userStatusTemplate:
|
|
59
|
-
allowMessageCollapse:
|
|
60
|
-
messageToolbarActions:
|
|
61
|
-
messageContextMenuActions:
|
|
62
|
-
fileActions:
|
|
63
|
-
onUnpin:
|
|
64
|
-
messageWidthMode:
|
|
65
|
-
showAvatar:
|
|
66
|
-
showUsername:
|
|
67
|
-
timestampVisibility:
|
|
68
|
-
authorMessageSettings:
|
|
69
|
-
receiverMessageSettings:
|
|
70
|
-
onToolbarAction:
|
|
71
|
-
onContextMenuAction:
|
|
72
|
-
onFileAction:
|
|
73
|
-
onDownload:
|
|
74
|
-
speechToTextConfig:
|
|
75
|
-
uploadConfig:
|
|
76
|
-
sendButtonConfig:
|
|
77
|
-
messageFilesLayout:
|
|
78
|
-
scrollToBottomButton:
|
|
79
|
-
autoScrollThreshold:
|
|
80
|
-
textField:
|
|
81
|
-
statusField:
|
|
82
|
-
authorIdField:
|
|
83
|
-
authorNameField:
|
|
84
|
-
authorImageUrlField:
|
|
85
|
-
authorImageAltTextField:
|
|
86
|
-
idField:
|
|
87
|
-
timestampField:
|
|
88
|
-
filesField:
|
|
89
|
-
attachmentsField:
|
|
90
|
-
replyToIdField:
|
|
91
|
-
isDeletedField:
|
|
92
|
-
isPinnedField:
|
|
93
|
-
typingField:
|
|
94
|
-
suggestedActionsField:
|
|
95
|
-
isFailedField:
|
|
96
|
-
onResendMessage:
|
|
97
|
-
messageBoxSettings:
|
|
98
|
-
loading:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
33
|
+
messages: f = [],
|
|
34
|
+
messageTemplate: W,
|
|
35
|
+
messageContentTemplate: G,
|
|
36
|
+
attachmentTemplate: B,
|
|
37
|
+
width: Xe,
|
|
38
|
+
height: Ye,
|
|
39
|
+
onSendMessage: C,
|
|
40
|
+
onSuggestionClick: H,
|
|
41
|
+
onInputValueChange: K,
|
|
42
|
+
onActionExecute: I,
|
|
43
|
+
dir: p,
|
|
44
|
+
messageBox: Ze,
|
|
45
|
+
placeholder: _e,
|
|
46
|
+
className: $,
|
|
47
|
+
style: et,
|
|
48
|
+
message: J = Xt,
|
|
49
|
+
authorId: a,
|
|
50
|
+
suggestions: tt,
|
|
51
|
+
suggestionTemplate: st,
|
|
52
|
+
suggestionsLayout: ot = "scroll",
|
|
53
|
+
quickActionsLayout: Q = "scroll",
|
|
54
|
+
inputValue: nt,
|
|
55
|
+
headerTemplate: h,
|
|
56
|
+
noDataTemplate: M,
|
|
57
|
+
timestampTemplate: X,
|
|
58
|
+
statusTemplate: Y,
|
|
59
|
+
userStatusTemplate: Z,
|
|
60
|
+
allowMessageCollapse: _,
|
|
61
|
+
messageToolbarActions: ee,
|
|
62
|
+
messageContextMenuActions: te,
|
|
63
|
+
fileActions: v,
|
|
64
|
+
onUnpin: at,
|
|
65
|
+
messageWidthMode: se,
|
|
66
|
+
showAvatar: oe,
|
|
67
|
+
showUsername: ne,
|
|
68
|
+
timestampVisibility: ae,
|
|
69
|
+
authorMessageSettings: re,
|
|
70
|
+
receiverMessageSettings: le,
|
|
71
|
+
onToolbarAction: ie,
|
|
72
|
+
onContextMenuAction: ce,
|
|
73
|
+
onFileAction: ue,
|
|
74
|
+
onDownload: me,
|
|
75
|
+
speechToTextConfig: de,
|
|
76
|
+
uploadConfig: ge,
|
|
77
|
+
sendButtonConfig: rt,
|
|
78
|
+
messageFilesLayout: fe,
|
|
79
|
+
scrollToBottomButton: N = !0,
|
|
80
|
+
autoScrollThreshold: lt,
|
|
81
|
+
textField: pe,
|
|
82
|
+
statusField: he,
|
|
83
|
+
authorIdField: Me,
|
|
84
|
+
authorNameField: ye,
|
|
85
|
+
authorImageUrlField: Ce,
|
|
86
|
+
authorImageAltTextField: Se,
|
|
87
|
+
idField: Te,
|
|
88
|
+
timestampField: ke,
|
|
89
|
+
filesField: be,
|
|
90
|
+
attachmentsField: ve,
|
|
91
|
+
replyToIdField: Ee,
|
|
92
|
+
isDeletedField: xe,
|
|
93
|
+
isPinnedField: Re,
|
|
94
|
+
typingField: Ae,
|
|
95
|
+
suggestedActionsField: Fe,
|
|
96
|
+
isFailedField: Le,
|
|
97
|
+
onResendMessage: we,
|
|
98
|
+
messageBoxSettings: it,
|
|
99
|
+
loading: ct,
|
|
100
|
+
scrollMode: ut,
|
|
101
|
+
total: mt,
|
|
102
|
+
pageSize: dt,
|
|
103
|
+
startIndex: gt,
|
|
104
|
+
endIndex: ft,
|
|
105
|
+
onLoadMore: pt,
|
|
106
|
+
pinnedMessages: D,
|
|
107
|
+
repliedToMessages: Be,
|
|
108
|
+
onReferencedMessageClick: ht,
|
|
109
|
+
...Mt
|
|
110
|
+
} = Qe, [u, O] = t.useState(null), [P, yt] = t.useState(!1), [Ct, Ie] = t.useState(!1), [Ne, De] = t.useState(null), [m, Oe] = t.useState(null), [St, Pe] = t.useState(!1), U = t.useRef(null), Ue = t.useRef(null), i = t.useRef(null), je = t.useRef(null), j = t.useRef(void 0), V = t.useRef(!1), q = t.useRef(null), Ve = t.useRef(""), c = t.useMemo(() => {
|
|
111
|
+
if (!f || f.length === 0)
|
|
102
112
|
return [];
|
|
103
113
|
const s = {
|
|
104
|
-
textField:
|
|
105
|
-
statusField:
|
|
106
|
-
authorIdField:
|
|
107
|
-
authorNameField:
|
|
108
|
-
authorImageUrlField:
|
|
109
|
-
authorImageAltTextField:
|
|
110
|
-
idField:
|
|
111
|
-
timestampField:
|
|
112
|
-
filesField:
|
|
113
|
-
attachmentsField:
|
|
114
|
-
replyToIdField:
|
|
115
|
-
isDeletedField:
|
|
116
|
-
isPinnedField:
|
|
117
|
-
typingField:
|
|
118
|
-
suggestedActionsField:
|
|
119
|
-
isFailedField:
|
|
114
|
+
textField: pe,
|
|
115
|
+
statusField: he,
|
|
116
|
+
authorIdField: Me,
|
|
117
|
+
authorNameField: ye,
|
|
118
|
+
authorImageUrlField: Ce,
|
|
119
|
+
authorImageAltTextField: Se,
|
|
120
|
+
idField: Te,
|
|
121
|
+
timestampField: ke,
|
|
122
|
+
filesField: be,
|
|
123
|
+
attachmentsField: ve,
|
|
124
|
+
replyToIdField: Ee,
|
|
125
|
+
isDeletedField: xe,
|
|
126
|
+
isPinnedField: Re,
|
|
127
|
+
typingField: Ae,
|
|
128
|
+
suggestedActionsField: Fe,
|
|
129
|
+
isFailedField: Le
|
|
120
130
|
};
|
|
121
|
-
return !Object.values(s).some((n) => n !== void 0) &&
|
|
131
|
+
return !Object.values(s).some((n) => n !== void 0) && Zt(f[0]) ? f.map((n) => ({
|
|
122
132
|
...n,
|
|
123
133
|
timestamp: n.timestamp ? new Date(n.timestamp) : n.timestamp
|
|
124
|
-
})) :
|
|
134
|
+
})) : _t(f, s);
|
|
125
135
|
}, [
|
|
126
|
-
|
|
127
|
-
le,
|
|
128
|
-
ie,
|
|
129
|
-
ce,
|
|
130
|
-
ue,
|
|
131
|
-
me,
|
|
132
|
-
ge,
|
|
136
|
+
f,
|
|
133
137
|
pe,
|
|
134
|
-
de,
|
|
135
|
-
fe,
|
|
136
138
|
he,
|
|
139
|
+
Me,
|
|
137
140
|
ye,
|
|
138
141
|
Ce,
|
|
139
|
-
Te,
|
|
140
142
|
Se,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
+
Te,
|
|
144
|
+
ke,
|
|
145
|
+
be,
|
|
146
|
+
ve,
|
|
147
|
+
Ee,
|
|
148
|
+
xe,
|
|
149
|
+
Re,
|
|
150
|
+
Ae,
|
|
151
|
+
Fe,
|
|
152
|
+
Le
|
|
143
153
|
]);
|
|
144
154
|
t.useEffect(() => {
|
|
145
|
-
if (
|
|
146
|
-
|
|
155
|
+
if (a === Ve.current && q.current) {
|
|
156
|
+
Oe(q.current);
|
|
147
157
|
return;
|
|
148
158
|
}
|
|
149
|
-
if (
|
|
150
|
-
const s =
|
|
151
|
-
(n) => n.author && (n.author.id ===
|
|
152
|
-
), e = (s == null ? void 0 : s.author) || { id:
|
|
153
|
-
|
|
159
|
+
if (a && c.length > 0) {
|
|
160
|
+
const s = c.find(
|
|
161
|
+
(n) => n.author && (n.author.id === a || n.author.id === String(a))
|
|
162
|
+
), e = (s == null ? void 0 : s.author) || { id: a };
|
|
163
|
+
q.current = e, Ve.current = a, Oe(e);
|
|
154
164
|
}
|
|
155
|
-
}, [
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
}, [a, c]);
|
|
166
|
+
const {
|
|
167
|
+
renderedMessages: d,
|
|
168
|
+
handleScrollToBottom: Tt,
|
|
169
|
+
handleReferencedMessageClick: z,
|
|
170
|
+
isEndless: kt,
|
|
171
|
+
isOnLastBatch: qe,
|
|
172
|
+
skipAutoScrollRef: bt
|
|
173
|
+
} = os({
|
|
174
|
+
scrollMode: ut,
|
|
175
|
+
processedMessages: c,
|
|
176
|
+
total: mt,
|
|
177
|
+
pageSize: dt,
|
|
178
|
+
startIndex: gt,
|
|
179
|
+
endIndex: ft,
|
|
180
|
+
onLoadMore: pt,
|
|
181
|
+
onReferencedMessageClick: ht,
|
|
182
|
+
viewItemsWrapperRef: i,
|
|
183
|
+
authorId: a
|
|
184
|
+
}), g = t.useMemo(() => d.length > 0 ? Vt(d) : [], [d]), vt = t.useMemo(() => !Dt(He, { component: "Chat" }), []), Et = Ot(He), ze = t.useMemo(() => {
|
|
185
|
+
if (D)
|
|
186
|
+
return D.find((e) => e.isPinned);
|
|
187
|
+
const s = c.find((e) => e.isPinned);
|
|
188
|
+
if (s)
|
|
189
|
+
return s;
|
|
190
|
+
}, [c, D]), E = Yt();
|
|
191
|
+
es({
|
|
192
|
+
viewItemsWrapperRef: i,
|
|
193
|
+
isKeyboardNavigationActiveRef: V,
|
|
194
|
+
processedMessages: d,
|
|
195
|
+
authorId: a,
|
|
196
|
+
autoScrollThreshold: lt,
|
|
197
|
+
isEndless: kt,
|
|
198
|
+
isOnLastBatch: qe,
|
|
199
|
+
skipAutoScrollRef: bt
|
|
163
200
|
});
|
|
164
|
-
const
|
|
165
|
-
clearTimeout(
|
|
166
|
-
}, []),
|
|
167
|
-
|
|
168
|
-
|
|
201
|
+
const xt = ts({ elementRef: i }), Rt = t.useCallback(() => {
|
|
202
|
+
clearTimeout(j.current);
|
|
203
|
+
}, []), At = t.useCallback(() => {
|
|
204
|
+
j.current = window.setTimeout(() => {
|
|
205
|
+
O(null);
|
|
169
206
|
}, 0);
|
|
170
|
-
}, []),
|
|
171
|
-
|
|
172
|
-
}, []),
|
|
207
|
+
}, []), x = t.useCallback((s) => {
|
|
208
|
+
O(s);
|
|
209
|
+
}, []), Ft = t.useCallback(
|
|
173
210
|
(s) => {
|
|
174
211
|
let e = null;
|
|
175
212
|
const n = u !== null ? u : g.lastSelectionIndex;
|
|
176
|
-
s.keyCode ===
|
|
213
|
+
s.keyCode === F.up ? n === null ? e = 0 : n > 0 && (e = n - 1) : s.keyCode === F.down ? n === null ? e = 0 : n < g.lastSelectionIndex && (e = n + 1) : s.keyCode === F.home ? e = 0 : s.keyCode === F.end && (e = g.lastSelectionIndex), e !== null && (O(e), V.current = !0, s.preventDefault());
|
|
177
214
|
},
|
|
178
215
|
[u, g]
|
|
179
|
-
),
|
|
216
|
+
), We = t.useCallback(
|
|
180
217
|
(s, e, n) => {
|
|
181
|
-
var
|
|
182
|
-
if (
|
|
218
|
+
var l;
|
|
219
|
+
if (I && I({
|
|
183
220
|
action: { value: s.value, title: s.title, type: s.type },
|
|
184
221
|
syntheticEvent: e,
|
|
185
222
|
nativeEvent: e.nativeEvent,
|
|
@@ -187,7 +224,7 @@ const He = t.forwardRef((je, T) => {
|
|
|
187
224
|
}), !e.isDefaultPrevented()) {
|
|
188
225
|
switch (s.type) {
|
|
189
226
|
case "reply":
|
|
190
|
-
|
|
227
|
+
C && C({
|
|
191
228
|
message: {
|
|
192
229
|
id: "",
|
|
193
230
|
author: m,
|
|
@@ -206,49 +243,47 @@ const He = t.forwardRef((je, T) => {
|
|
|
206
243
|
window.open(s.value);
|
|
207
244
|
break;
|
|
208
245
|
}
|
|
209
|
-
(
|
|
246
|
+
(l = je.current) == null || l.focusInput();
|
|
210
247
|
}
|
|
211
248
|
},
|
|
212
|
-
[
|
|
213
|
-
),
|
|
214
|
-
l.current && (l.current.scrollTop = l.current.scrollHeight - l.current.clientHeight);
|
|
215
|
-
}, []), dt = t.useCallback(() => Ue("k-chat", V, { "k-rtl": R }), [V, R]), ft = t.useCallback(() => {
|
|
249
|
+
[I, C, m]
|
|
250
|
+
), Lt = t.useCallback(() => Ge("k-chat", $, { "k-rtl": P }), [$, P]), wt = t.useCallback(() => {
|
|
216
251
|
const s = g.length - 1;
|
|
217
252
|
return g.map((e, n) => {
|
|
218
|
-
var
|
|
253
|
+
var l, y, S, T, k, R;
|
|
219
254
|
if (e.type === "date-marker")
|
|
220
|
-
return /* @__PURE__ */ t.createElement(
|
|
255
|
+
return /* @__PURE__ */ t.createElement(Wt, { item: e, key: e.trackBy, timestampTemplate: X });
|
|
221
256
|
if (e.type === "message-group") {
|
|
222
|
-
const
|
|
223
|
-
allowMessageCollapse:
|
|
224
|
-
messageWidthMode:
|
|
225
|
-
showAvatar:
|
|
226
|
-
showUsername:
|
|
227
|
-
messageTemplate:
|
|
228
|
-
messageContentTemplate:
|
|
229
|
-
messageToolbarActions:
|
|
230
|
-
messageContextMenuActions:
|
|
231
|
-
fileActions:
|
|
232
|
-
}, r =
|
|
233
|
-
(
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
257
|
+
const A = {
|
|
258
|
+
allowMessageCollapse: _,
|
|
259
|
+
messageWidthMode: se,
|
|
260
|
+
showAvatar: oe,
|
|
261
|
+
showUsername: ne,
|
|
262
|
+
messageTemplate: W,
|
|
263
|
+
messageContentTemplate: G,
|
|
264
|
+
messageToolbarActions: ee,
|
|
265
|
+
messageContextMenuActions: te,
|
|
266
|
+
fileActions: v
|
|
267
|
+
}, r = ss(
|
|
268
|
+
(l = e == null ? void 0 : e.messages) == null ? void 0 : l[0],
|
|
269
|
+
a,
|
|
270
|
+
A,
|
|
271
|
+
re,
|
|
272
|
+
le
|
|
238
273
|
);
|
|
239
274
|
return /* @__PURE__ */ t.createElement(
|
|
240
|
-
|
|
275
|
+
Gt,
|
|
241
276
|
{
|
|
242
277
|
group: e,
|
|
243
278
|
itemTemplate: r.messageTemplate,
|
|
244
279
|
contentTemplate: r.messageContentTemplate,
|
|
245
|
-
attachmentTemplate:
|
|
280
|
+
attachmentTemplate: B,
|
|
246
281
|
user: m,
|
|
247
282
|
selectedItemIndex: u,
|
|
248
|
-
onRequestSelection:
|
|
283
|
+
onRequestSelection: x,
|
|
249
284
|
isLastGroup: n === s,
|
|
250
|
-
key: e.messages[0].selectionIndex,
|
|
251
|
-
message:
|
|
285
|
+
key: (y = e.messages[0].id) != null ? y : e.messages[0].selectionIndex,
|
|
286
|
+
message: J,
|
|
252
287
|
allowMessageCollapse: r.allowMessageCollapse,
|
|
253
288
|
messageToolbarActions: r.messageToolbarActions,
|
|
254
289
|
messageContextMenuActions: r.messageContextMenuActions,
|
|
@@ -261,27 +296,27 @@ const He = t.forwardRef((je, T) => {
|
|
|
261
296
|
} else {
|
|
262
297
|
if (e.type === "attachment-group")
|
|
263
298
|
return /* @__PURE__ */ t.createElement(
|
|
264
|
-
|
|
299
|
+
zt,
|
|
265
300
|
{
|
|
266
301
|
group: e,
|
|
267
|
-
itemTemplate:
|
|
268
|
-
onRequestSelection:
|
|
302
|
+
itemTemplate: B,
|
|
303
|
+
onRequestSelection: x,
|
|
269
304
|
selected: e.selectionIndex === u,
|
|
270
305
|
isLastGroup: n === s,
|
|
271
|
-
key: e.selectionIndex
|
|
306
|
+
key: `att-${(T = (S = e.trackBy) == null ? void 0 : S.id) != null ? T : e.selectionIndex}`
|
|
272
307
|
}
|
|
273
308
|
);
|
|
274
309
|
if (e.type === "action-group")
|
|
275
310
|
return /* @__PURE__ */ t.createElement(
|
|
276
|
-
|
|
311
|
+
qt,
|
|
277
312
|
{
|
|
278
313
|
group: e,
|
|
279
|
-
onActionExecute:
|
|
280
|
-
onRequestSelection:
|
|
314
|
+
onActionExecute: We,
|
|
315
|
+
onRequestSelection: x,
|
|
281
316
|
selected: e.selectionIndex === u,
|
|
282
|
-
key: e.selectionIndex
|
|
283
|
-
quickActionsLayout:
|
|
284
|
-
dir:
|
|
317
|
+
key: `act-${(R = (k = e.trackBy) == null ? void 0 : k.id) != null ? R : e.selectionIndex}`,
|
|
318
|
+
quickActionsLayout: Q,
|
|
319
|
+
dir: p
|
|
285
320
|
}
|
|
286
321
|
);
|
|
287
322
|
}
|
|
@@ -289,162 +324,177 @@ const He = t.forwardRef((je, T) => {
|
|
|
289
324
|
});
|
|
290
325
|
}, [
|
|
291
326
|
g,
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
327
|
+
X,
|
|
328
|
+
W,
|
|
329
|
+
G,
|
|
330
|
+
B,
|
|
296
331
|
m,
|
|
297
332
|
u,
|
|
298
|
-
|
|
299
|
-
q,
|
|
300
|
-
z,
|
|
301
|
-
K,
|
|
302
|
-
$,
|
|
303
|
-
S,
|
|
333
|
+
x,
|
|
304
334
|
J,
|
|
305
|
-
Q,
|
|
306
|
-
X,
|
|
307
|
-
i,
|
|
308
|
-
Z,
|
|
309
335
|
_,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
336
|
+
ee,
|
|
337
|
+
te,
|
|
338
|
+
v,
|
|
339
|
+
se,
|
|
340
|
+
oe,
|
|
341
|
+
ne,
|
|
342
|
+
a,
|
|
343
|
+
re,
|
|
344
|
+
le,
|
|
345
|
+
We,
|
|
346
|
+
Q,
|
|
347
|
+
p
|
|
348
|
+
]), Bt = t.useCallback(() => h ? typeof h == "function" ? h() : h : null, [h]), It = t.useCallback(() => M ? typeof M == "function" ? M() : M : null, [M]);
|
|
314
349
|
t.useEffect(() => {
|
|
315
|
-
const s =
|
|
316
|
-
|
|
317
|
-
}, [
|
|
318
|
-
clearTimeout(
|
|
350
|
+
const s = p !== void 0 ? p === "rtl" : U.current && getComputedStyle(U.current).direction === "rtl";
|
|
351
|
+
yt(!!s);
|
|
352
|
+
}, [p]), t.useEffect(() => () => {
|
|
353
|
+
clearTimeout(j.current);
|
|
319
354
|
}, []), t.useEffect(() => {
|
|
320
|
-
if (!
|
|
355
|
+
if (!N || !i.current)
|
|
321
356
|
return;
|
|
322
357
|
let s, e;
|
|
323
358
|
const n = () => {
|
|
324
359
|
s = void 0;
|
|
325
|
-
const
|
|
326
|
-
if (!
|
|
360
|
+
const T = i.current;
|
|
361
|
+
if (!T)
|
|
327
362
|
return;
|
|
328
|
-
const { scrollHeight:
|
|
329
|
-
!(
|
|
330
|
-
e = void 0,
|
|
363
|
+
const { scrollHeight: k, scrollTop: R, clientHeight: A } = T;
|
|
364
|
+
!(k > A) || k - R - A <= 100 ? (e !== void 0 && (clearTimeout(e), e = void 0), Pe(!1)) : e != null || (e = setTimeout(() => {
|
|
365
|
+
e = void 0, Pe(!0);
|
|
331
366
|
}, 300));
|
|
332
|
-
},
|
|
367
|
+
}, l = () => {
|
|
333
368
|
s === void 0 && (s = requestAnimationFrame(n));
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
const
|
|
337
|
-
return
|
|
338
|
-
|
|
369
|
+
}, y = i.current;
|
|
370
|
+
y.addEventListener("scroll", l, { passive: !0 });
|
|
371
|
+
const S = new MutationObserver(l);
|
|
372
|
+
return S.observe(y, { childList: !0, subtree: !0, characterData: !0 }), () => {
|
|
373
|
+
y.removeEventListener("scroll", l), S.disconnect(), s !== void 0 && cancelAnimationFrame(s), e !== void 0 && clearTimeout(e);
|
|
339
374
|
};
|
|
340
|
-
}, [
|
|
341
|
-
const
|
|
342
|
-
replyToMessage:
|
|
343
|
-
setReplyToMessage:
|
|
344
|
-
messages:
|
|
375
|
+
}, [N]);
|
|
376
|
+
const Nt = t.useMemo(() => ({
|
|
377
|
+
replyToMessage: Ne,
|
|
378
|
+
setReplyToMessage: De,
|
|
379
|
+
messages: c,
|
|
380
|
+
repliedToMessages: Be,
|
|
345
381
|
user: m,
|
|
346
|
-
internalScrollContainerRef:
|
|
347
|
-
messageListScrollContainerRef:
|
|
348
|
-
onToolbarAction:
|
|
349
|
-
onContextMenuAction:
|
|
350
|
-
onFileAction:
|
|
351
|
-
setShowCopyNotification:
|
|
352
|
-
onDownload:
|
|
353
|
-
onResendMessage:
|
|
354
|
-
fileActions:
|
|
355
|
-
speechToTextConfig:
|
|
356
|
-
uploadConfig:
|
|
357
|
-
statusTemplate:
|
|
358
|
-
userStatusTemplate:
|
|
359
|
-
messageFilesLayout:
|
|
360
|
-
timestampVisibility:
|
|
382
|
+
internalScrollContainerRef: Ue,
|
|
383
|
+
messageListScrollContainerRef: i,
|
|
384
|
+
onToolbarAction: ie,
|
|
385
|
+
onContextMenuAction: ce,
|
|
386
|
+
onFileAction: ue,
|
|
387
|
+
setShowCopyNotification: Ie,
|
|
388
|
+
onDownload: me,
|
|
389
|
+
onResendMessage: we,
|
|
390
|
+
fileActions: v,
|
|
391
|
+
speechToTextConfig: de,
|
|
392
|
+
uploadConfig: ge,
|
|
393
|
+
statusTemplate: Y,
|
|
394
|
+
userStatusTemplate: Z,
|
|
395
|
+
messageFilesLayout: fe,
|
|
396
|
+
timestampVisibility: ae,
|
|
397
|
+
onReferencedMessageClick: z
|
|
361
398
|
}), [
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
399
|
+
Ne,
|
|
400
|
+
De,
|
|
401
|
+
c,
|
|
402
|
+
Be,
|
|
365
403
|
m,
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
404
|
+
ie,
|
|
405
|
+
ce,
|
|
406
|
+
ue,
|
|
407
|
+
Ie,
|
|
408
|
+
me,
|
|
409
|
+
we,
|
|
410
|
+
v,
|
|
411
|
+
de,
|
|
412
|
+
ge,
|
|
413
|
+
Y,
|
|
414
|
+
Z,
|
|
415
|
+
fe,
|
|
374
416
|
ae,
|
|
375
|
-
|
|
376
|
-
G,
|
|
377
|
-
re,
|
|
378
|
-
Y
|
|
417
|
+
z
|
|
379
418
|
]);
|
|
380
|
-
return /* @__PURE__ */ t.createElement(
|
|
419
|
+
return /* @__PURE__ */ t.createElement(Qt.Provider, { value: Nt }, /* @__PURE__ */ t.createElement(
|
|
381
420
|
"div",
|
|
382
421
|
{
|
|
383
422
|
style: {
|
|
384
|
-
width:
|
|
385
|
-
height:
|
|
423
|
+
width: Xe,
|
|
424
|
+
height: Ye,
|
|
386
425
|
position: "relative",
|
|
387
426
|
overflow: "hidden",
|
|
388
|
-
|
|
427
|
+
...et
|
|
389
428
|
},
|
|
390
|
-
onKeyDown:
|
|
391
|
-
className:
|
|
429
|
+
onKeyDown: Ft,
|
|
430
|
+
className: Lt(),
|
|
392
431
|
ref: (s) => {
|
|
393
|
-
|
|
432
|
+
U.current = s, Ue.current = s, typeof b == "function" ? b(s) : b && (b.current = s);
|
|
394
433
|
},
|
|
395
|
-
...
|
|
434
|
+
...Mt
|
|
396
435
|
},
|
|
397
|
-
|
|
436
|
+
h !== void 0 && /* @__PURE__ */ t.createElement(Kt, null, Bt()),
|
|
398
437
|
/* @__PURE__ */ t.createElement(
|
|
399
438
|
"div",
|
|
400
439
|
{
|
|
401
440
|
className: "k-message-list",
|
|
402
|
-
onBlur:
|
|
403
|
-
onFocus:
|
|
441
|
+
onBlur: At,
|
|
442
|
+
onFocus: Rt,
|
|
404
443
|
role: "log",
|
|
405
|
-
"aria-label":
|
|
406
|
-
|
|
407
|
-
|
|
444
|
+
"aria-label": E.toLanguageString(
|
|
445
|
+
Ke,
|
|
446
|
+
L[Ke]
|
|
408
447
|
),
|
|
409
448
|
"aria-live": "polite",
|
|
410
|
-
ref:
|
|
449
|
+
ref: i,
|
|
450
|
+
style: {
|
|
451
|
+
scrollBehavior: "auto"
|
|
452
|
+
}
|
|
411
453
|
},
|
|
412
|
-
|
|
454
|
+
ze && /* @__PURE__ */ t.createElement(
|
|
455
|
+
$t,
|
|
456
|
+
{
|
|
457
|
+
message: ze,
|
|
458
|
+
onUnpin: at,
|
|
459
|
+
user: m,
|
|
460
|
+
onReferencedMessageClick: z
|
|
461
|
+
}
|
|
462
|
+
),
|
|
413
463
|
/* @__PURE__ */ t.createElement(
|
|
414
464
|
"div",
|
|
415
465
|
{
|
|
416
|
-
className:
|
|
417
|
-
"k-message-list-content-empty":
|
|
466
|
+
className: Ge("k-message-list-content", {
|
|
467
|
+
"k-message-list-content-empty": d.length === 0
|
|
418
468
|
})
|
|
419
469
|
},
|
|
420
|
-
|
|
421
|
-
|
|
470
|
+
d.length === 0 && M !== void 0 && It(),
|
|
471
|
+
d.length > 0 && wt()
|
|
422
472
|
),
|
|
423
|
-
|
|
424
|
-
|
|
473
|
+
N && (St || !qe) && /* @__PURE__ */ t.createElement("div", { className: "k-chat-scroll-to-bottom-container" }, /* @__PURE__ */ t.createElement(
|
|
474
|
+
Ut,
|
|
425
475
|
{
|
|
426
|
-
svgIcon:
|
|
476
|
+
svgIcon: jt,
|
|
427
477
|
size: "small",
|
|
428
478
|
themeColor: "light",
|
|
429
479
|
rounded: "full",
|
|
430
|
-
onClick:
|
|
431
|
-
"aria-label":
|
|
432
|
-
|
|
433
|
-
|
|
480
|
+
onClick: Tt,
|
|
481
|
+
"aria-label": E.toLanguageString(
|
|
482
|
+
w,
|
|
483
|
+
L[w]
|
|
434
484
|
),
|
|
435
|
-
title:
|
|
436
|
-
|
|
437
|
-
|
|
485
|
+
title: E.toLanguageString(
|
|
486
|
+
w,
|
|
487
|
+
L[w]
|
|
438
488
|
)
|
|
439
489
|
}
|
|
440
490
|
))
|
|
441
491
|
),
|
|
442
|
-
|
|
492
|
+
xt && /* @__PURE__ */ t.createElement("div", { className: "k-separator" }),
|
|
443
493
|
/* @__PURE__ */ t.createElement(
|
|
444
|
-
|
|
494
|
+
Ht,
|
|
445
495
|
{
|
|
446
496
|
onSendMessage: (s, e) => {
|
|
447
|
-
|
|
497
|
+
C && C({
|
|
448
498
|
message: s,
|
|
449
499
|
syntheticEvent: e,
|
|
450
500
|
nativeEvent: e.nativeEvent,
|
|
@@ -452,43 +502,43 @@ const He = t.forwardRef((je, T) => {
|
|
|
452
502
|
});
|
|
453
503
|
},
|
|
454
504
|
onSuggestionClick: (s) => {
|
|
455
|
-
|
|
505
|
+
H && H(s);
|
|
456
506
|
},
|
|
457
|
-
isDirectionRightToLeft:
|
|
458
|
-
ref:
|
|
459
|
-
placeholder:
|
|
460
|
-
MessageBox:
|
|
461
|
-
suggestions:
|
|
462
|
-
suggestionTemplate:
|
|
463
|
-
inputValue:
|
|
507
|
+
isDirectionRightToLeft: P,
|
|
508
|
+
ref: je,
|
|
509
|
+
placeholder: _e,
|
|
510
|
+
MessageBox: Ze,
|
|
511
|
+
suggestions: tt,
|
|
512
|
+
suggestionTemplate: st,
|
|
513
|
+
inputValue: nt,
|
|
464
514
|
onInputValueChange: (s) => {
|
|
465
|
-
|
|
515
|
+
K && K(s);
|
|
466
516
|
},
|
|
467
517
|
onInputClick: () => {
|
|
468
|
-
|
|
518
|
+
V.current = !1;
|
|
469
519
|
},
|
|
470
|
-
sendButtonConfig:
|
|
471
|
-
suggestionsLayout:
|
|
472
|
-
dir:
|
|
473
|
-
messageBoxSettings:
|
|
474
|
-
loading:
|
|
520
|
+
sendButtonConfig: rt,
|
|
521
|
+
suggestionsLayout: ot,
|
|
522
|
+
dir: p,
|
|
523
|
+
messageBoxSettings: it,
|
|
524
|
+
loading: ct
|
|
475
525
|
}
|
|
476
526
|
),
|
|
477
527
|
/* @__PURE__ */ t.createElement(
|
|
478
|
-
|
|
528
|
+
Jt,
|
|
479
529
|
{
|
|
480
|
-
show:
|
|
481
|
-
text:
|
|
482
|
-
|
|
483
|
-
|
|
530
|
+
show: Ct,
|
|
531
|
+
text: E.toLanguageString(
|
|
532
|
+
$e,
|
|
533
|
+
L[$e]
|
|
484
534
|
)
|
|
485
535
|
}
|
|
486
536
|
),
|
|
487
|
-
|
|
537
|
+
vt && /* @__PURE__ */ t.createElement(Pt, { message: Et })
|
|
488
538
|
));
|
|
489
539
|
});
|
|
490
|
-
|
|
491
|
-
|
|
540
|
+
Je.displayName = "Chat";
|
|
541
|
+
Je.propTypes = {
|
|
492
542
|
messages: o.arrayOf(o.object),
|
|
493
543
|
user: o.object,
|
|
494
544
|
messageTemplate: o.any,
|
|
@@ -508,8 +558,17 @@ He.propTypes = {
|
|
|
508
558
|
showAvatar: o.bool,
|
|
509
559
|
showUsername: o.bool,
|
|
510
560
|
authorMessageSettings: o.object,
|
|
511
|
-
receiverMessageSettings: o.object
|
|
561
|
+
receiverMessageSettings: o.object,
|
|
562
|
+
scrollMode: o.oneOf(["scrollable", "endless"]),
|
|
563
|
+
total: o.number,
|
|
564
|
+
pageSize: o.number,
|
|
565
|
+
startIndex: o.number,
|
|
566
|
+
endIndex: o.number,
|
|
567
|
+
onLoadMore: o.func,
|
|
568
|
+
pinnedMessages: o.arrayOf(o.object),
|
|
569
|
+
repliedToMessages: o.arrayOf(o.object),
|
|
570
|
+
onReferencedMessageClick: o.func
|
|
512
571
|
};
|
|
513
572
|
export {
|
|
514
|
-
|
|
573
|
+
Je as Chat
|
|
515
574
|
};
|