@progress/kendo-react-conversational-ui 14.5.0-develop.8 → 15.0.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/README.md +4 -4
- package/ai-prompt/AIPrompt.d.ts +6 -0
- package/ai-prompt/AIPrompt.js +1 -1
- package/ai-prompt/AIPrompt.mjs +40 -38
- package/ai-prompt/AIPromptContent.js +1 -1
- package/ai-prompt/AIPromptContent.mjs +5 -5
- package/ai-prompt/views/AIPromptOutputView.js +1 -1
- package/ai-prompt/views/AIPromptOutputView.mjs +6 -6
- package/chat/ChatPropsAndState.d.ts +17 -0
- package/chat/components/Chat.js +1 -1
- package/chat/components/Chat.mjs +222 -220
- package/chat/components/ChatMessage.js +1 -1
- package/chat/components/ChatMessage.mjs +133 -117
- package/chat/components/Header.js +1 -1
- package/chat/components/Header.mjs +1 -1
- package/chat/components/NewMessage.js +1 -1
- package/chat/components/NewMessage.mjs +49 -48
- package/chat/components/Notification.js +1 -1
- package/chat/components/Notification.mjs +1 -1
- package/chat/components/elements/FileBox.js +1 -1
- package/chat/components/elements/FileBox.mjs +10 -9
- package/chat/components/elements/PinnedMessage.js +1 -1
- package/chat/components/elements/PinnedMessage.mjs +14 -13
- package/chat/hooks/useEndlessScroll.js +1 -1
- package/chat/hooks/useEndlessScroll.mjs +103 -101
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/inline-ai-prompt/InlineAIPrompt.js +1 -1
- package/inline-ai-prompt/InlineAIPrompt.mjs +10 -10
- package/inline-ai-prompt/InlineAIPromptInput.js +1 -1
- package/inline-ai-prompt/InlineAIPromptInput.mjs +1 -1
- package/messages/index.d.ts +5 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +12 -10
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +17 -12
- package/prompt-box/FileBox.js +1 -1
- package/prompt-box/FileBox.mjs +21 -20
- package/prompt-box/PromptBox.js +1 -1
- package/prompt-box/PromptBox.mjs +148 -150
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as r from "react";
|
|
9
|
-
import { scrollToMessageById as
|
|
10
|
-
const
|
|
9
|
+
import { scrollToMessageById as nt } from "../utils.mjs";
|
|
10
|
+
const rt = 50, L = 100, ut = ({
|
|
11
11
|
scrollMode: W,
|
|
12
12
|
processedMessages: n,
|
|
13
13
|
total: Z,
|
|
14
|
-
pageSize:
|
|
14
|
+
pageSize: f = rt,
|
|
15
15
|
startIndex: j,
|
|
16
16
|
endIndex: K,
|
|
17
17
|
onLoadMoreMessages: u,
|
|
@@ -19,121 +19,123 @@ const nt = 50, L = 100, ct = ({
|
|
|
19
19
|
viewItemsWrapperRef: l,
|
|
20
20
|
authorId: v
|
|
21
21
|
}) => {
|
|
22
|
-
const k = r.useRef(!1),
|
|
22
|
+
const k = r.useRef(!1), m = W === "endless", i = Z != null ? Z : n.length, x = m && n.length === i && !k.current, h = m && (n.length < i || k.current);
|
|
23
23
|
h && (k.current = !0);
|
|
24
|
-
const [A,
|
|
25
|
-
N.current = A,
|
|
26
|
-
const o = r.useRef(!1), P = r.useRef(0), w = r.useRef(0),
|
|
27
|
-
|
|
28
|
-
const
|
|
24
|
+
const [A, B] = r.useState(-1), [T, D] = r.useState(-1), N = r.useRef(A), C = r.useRef(T);
|
|
25
|
+
N.current = A, C.current = T;
|
|
26
|
+
const o = r.useRef(!1), d = r.useRef(0), P = r.useRef(0), w = r.useRef(0), q = r.useRef(!1), I = r.useRef(i), _ = r.useRef(v);
|
|
27
|
+
_.current = v;
|
|
28
|
+
const $ = r.useRef(!1), G = r.useRef(null), U = r.useRef(!1), J = r.useRef(!1), Q = r.useRef(!0), V = r.useRef(i);
|
|
29
29
|
r.useEffect(() => {
|
|
30
|
-
if (
|
|
30
|
+
if (x) {
|
|
31
31
|
if (k.current) {
|
|
32
|
-
(A === -1 ||
|
|
32
|
+
(A === -1 || T === -1) && (B(0), D(n.length));
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
if (A === -1 ||
|
|
36
|
-
const t = Math.max(0, n.length -
|
|
37
|
-
|
|
38
|
-
} else if (
|
|
35
|
+
if (A === -1 || T === -1) {
|
|
36
|
+
const t = Math.max(0, n.length - f), c = n.length;
|
|
37
|
+
B(t), D(c);
|
|
38
|
+
} else if (T < n.length) {
|
|
39
39
|
const t = I.current;
|
|
40
|
-
if (
|
|
41
|
-
|
|
40
|
+
if (C.current >= t)
|
|
41
|
+
D(n.length);
|
|
42
42
|
else if (n.length > t && n.slice(t).some(
|
|
43
|
-
(
|
|
43
|
+
(e) => {
|
|
44
44
|
var H;
|
|
45
|
-
return ((H =
|
|
45
|
+
return ((H = e.author) == null ? void 0 : H.id) !== void 0 && String(e.author.id) === String(_.current);
|
|
46
46
|
}
|
|
47
47
|
)) {
|
|
48
|
-
const
|
|
49
|
-
|
|
48
|
+
const e = Math.max(0, n.length - f);
|
|
49
|
+
B(e), D(n.length), U.current = !0;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
I.current = i;
|
|
53
53
|
}
|
|
54
|
-
}, [
|
|
55
|
-
const O = j != null ? j : 0, R = K != null ? K : n.length,
|
|
54
|
+
}, [x, n.length, f, A, T, i]);
|
|
55
|
+
const O = j != null ? j : 0, R = K != null ? K : n.length, g = r.useCallback(() => {
|
|
56
56
|
const t = l.current;
|
|
57
|
-
t && (
|
|
58
|
-
}, [l]),
|
|
57
|
+
t && (d.current = t.scrollHeight, P.current = t.scrollTop, w.current = t.querySelectorAll("[data-message-id]").length);
|
|
58
|
+
}, [l]), y = r.useCallback(
|
|
59
59
|
(t) => {
|
|
60
|
-
var E,
|
|
61
|
-
const c = (E = l.current) == null ? void 0 : E.closest(".k-chat"),
|
|
62
|
-
|
|
60
|
+
var E, e, H;
|
|
61
|
+
const c = (E = l.current) == null ? void 0 : E.closest(".k-chat"), S = ((H = (e = l.current) == null ? void 0 : e.querySelector(".k-message-pinned")) == null ? void 0 : H.offsetHeight) || 0;
|
|
62
|
+
nt(t, c, S);
|
|
63
63
|
},
|
|
64
64
|
[l]
|
|
65
65
|
);
|
|
66
66
|
r.useLayoutEffect(() => {
|
|
67
|
-
if (!
|
|
67
|
+
if (!q.current)
|
|
68
68
|
return;
|
|
69
69
|
const t = l.current;
|
|
70
70
|
if (!t) {
|
|
71
|
-
|
|
71
|
+
q.current = !1;
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
if (t.querySelectorAll("[data-message-id]").length <= w.current)
|
|
75
|
+
return;
|
|
76
|
+
const S = t.scrollHeight - d.current;
|
|
77
|
+
S > 0 && (t.scrollTop = P.current + S), q.current = !1, o.current = !1;
|
|
76
78
|
}), r.useLayoutEffect(() => {
|
|
77
|
-
if (!
|
|
79
|
+
if (!U.current)
|
|
78
80
|
return;
|
|
79
81
|
const t = l.current;
|
|
80
82
|
if (!t) {
|
|
81
|
-
|
|
83
|
+
U.current = !1;
|
|
82
84
|
return;
|
|
83
85
|
}
|
|
84
|
-
|
|
86
|
+
T >= n.length && T > 0 && (U.current = !1, t.scrollTop = t.scrollHeight - t.clientHeight);
|
|
85
87
|
});
|
|
86
88
|
const z = r.useRef(!1);
|
|
87
89
|
r.useLayoutEffect(() => {
|
|
88
|
-
if (!
|
|
90
|
+
if (!m || z.current)
|
|
89
91
|
return;
|
|
90
92
|
const t = l.current;
|
|
91
93
|
t && t.querySelector("[data-message-id]") && (t.scrollTop = t.scrollHeight - t.clientHeight, z.current = !0);
|
|
92
94
|
}), r.useEffect(() => {
|
|
93
|
-
if (!
|
|
95
|
+
if (!m)
|
|
94
96
|
return;
|
|
95
97
|
const t = l.current;
|
|
96
98
|
if (!t)
|
|
97
99
|
return;
|
|
98
100
|
let c = t.scrollTop;
|
|
99
|
-
const
|
|
100
|
-
const { scrollTop: E, scrollHeight:
|
|
101
|
+
const S = () => {
|
|
102
|
+
const { scrollTop: E, scrollHeight: e, clientHeight: H } = t, Y = E < c, tt = E > c;
|
|
101
103
|
if (c = E, !o.current) {
|
|
102
104
|
if (Y && E <= L) {
|
|
103
|
-
if (
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
const b = Math.max(0,
|
|
107
|
-
|
|
105
|
+
if (x) {
|
|
106
|
+
const a = N.current;
|
|
107
|
+
if (a > 0) {
|
|
108
|
+
const b = Math.max(0, a - f);
|
|
109
|
+
q.current = !0, g(), B(b), u == null || u({ startIndex: b, endIndex: C.current });
|
|
108
110
|
}
|
|
109
111
|
} else if (h && O > 0) {
|
|
110
112
|
o.current = !0;
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
+
const a = Math.max(0, O - f);
|
|
114
|
+
q.current = !0, g(), u == null || u({ startIndex: a, endIndex: R });
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
|
-
if (
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
const b = Math.min(n.length,
|
|
120
|
-
J.current = !0,
|
|
117
|
+
if (tt && e - E - H <= L) {
|
|
118
|
+
if (x) {
|
|
119
|
+
const a = C.current;
|
|
120
|
+
if (a < n.length) {
|
|
121
|
+
const b = Math.min(n.length, a + f);
|
|
122
|
+
J.current = !0, D(b), u == null || u({ startIndex: N.current, endIndex: b });
|
|
121
123
|
}
|
|
122
124
|
} else if (h && R < i) {
|
|
123
125
|
o.current = !0, J.current = !0;
|
|
124
|
-
const
|
|
125
|
-
u == null || u({ startIndex: O, endIndex:
|
|
126
|
+
const a = Math.min(i, R + f);
|
|
127
|
+
u == null || u({ startIndex: O, endIndex: a });
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
}
|
|
129
131
|
};
|
|
130
|
-
return t.addEventListener("scroll",
|
|
132
|
+
return t.addEventListener("scroll", S, { passive: !0 }), () => t.removeEventListener("scroll", S);
|
|
131
133
|
}, [
|
|
134
|
+
m,
|
|
132
135
|
x,
|
|
133
|
-
S,
|
|
134
136
|
h,
|
|
135
137
|
l,
|
|
136
|
-
|
|
138
|
+
f,
|
|
137
139
|
n.length,
|
|
138
140
|
O,
|
|
139
141
|
R,
|
|
@@ -146,86 +148,86 @@ const nt = 50, L = 100, ct = ({
|
|
|
146
148
|
V.current = i, Q.current = t;
|
|
147
149
|
return;
|
|
148
150
|
}
|
|
149
|
-
const c = V.current,
|
|
150
|
-
if (V.current = i, Q.current = t, i > c && !
|
|
151
|
-
const
|
|
152
|
-
|
|
151
|
+
const c = V.current, S = Q.current;
|
|
152
|
+
if (V.current = i, Q.current = t, i > c && !S && t) {
|
|
153
|
+
const e = n[n.length - 1];
|
|
154
|
+
_.current !== void 0 && ((E = e == null ? void 0 : e.author) == null ? void 0 : E.id) !== void 0 && String(e.author.id) === String(_.current) && ($.current = !0, J.current = !0);
|
|
153
155
|
}
|
|
154
156
|
}, [h, i, R, n]), r.useEffect(() => {
|
|
155
|
-
!h ||
|
|
157
|
+
!h || !$.current || ($.current = !1, o.current = !1, requestAnimationFrame(() => {
|
|
156
158
|
const t = l.current;
|
|
157
159
|
t && (t.scrollTop = t.scrollHeight - t.clientHeight);
|
|
158
160
|
}));
|
|
159
161
|
}, [h, n, l]), r.useEffect(() => {
|
|
160
|
-
if (!h ||
|
|
162
|
+
if (!h || G.current === null)
|
|
161
163
|
return;
|
|
162
|
-
const t =
|
|
164
|
+
const t = G.current, c = l.current;
|
|
163
165
|
if (!c)
|
|
164
166
|
return;
|
|
165
|
-
c.querySelector(`[data-message-id="${t}"]`) && (
|
|
166
|
-
|
|
167
|
+
c.querySelector(`[data-message-id="${t}"]`) && (G.current = null, o.current = !1, requestAnimationFrame(() => {
|
|
168
|
+
y(t);
|
|
167
169
|
}));
|
|
168
|
-
}, [h, n, l,
|
|
169
|
-
h && o.current && !
|
|
170
|
+
}, [h, n, l, y]), r.useEffect(() => {
|
|
171
|
+
h && o.current && !q.current && (o.current = !1);
|
|
170
172
|
}, [h, O, R]);
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
const t = Math.max(0, A), c = Math.min(n.length,
|
|
173
|
+
const s = r.useMemo(() => {
|
|
174
|
+
if (x) {
|
|
175
|
+
const t = Math.max(0, A), c = Math.min(n.length, T);
|
|
174
176
|
if (t >= c) {
|
|
175
|
-
const
|
|
176
|
-
return n.slice(
|
|
177
|
+
const S = Math.max(0, n.length - f);
|
|
178
|
+
return n.slice(S);
|
|
177
179
|
}
|
|
178
180
|
return n.slice(t, c);
|
|
179
181
|
}
|
|
180
182
|
return n;
|
|
181
|
-
}, [
|
|
182
|
-
if (!
|
|
183
|
+
}, [x, n, A, T, f]), X = r.useMemo(() => m ? x ? T >= n.length : R >= i : !0, [m, x, T, n.length, R, i]), p = r.useCallback(() => {
|
|
184
|
+
if (!m || X) {
|
|
183
185
|
const t = l.current;
|
|
184
186
|
t && t.scrollTo({ top: t.scrollHeight - t.clientHeight, behavior: "smooth" });
|
|
185
187
|
return;
|
|
186
188
|
}
|
|
187
189
|
if (!o.current) {
|
|
188
|
-
if (
|
|
189
|
-
const t = Math.max(0, n.length -
|
|
190
|
-
|
|
190
|
+
if (x) {
|
|
191
|
+
const t = Math.max(0, n.length - f);
|
|
192
|
+
B(t), D(n.length), u == null || u({ startIndex: t, endIndex: n.length }), requestAnimationFrame(() => {
|
|
191
193
|
const c = l.current;
|
|
192
194
|
c && (c.scrollTop = c.scrollHeight - c.clientHeight);
|
|
193
195
|
});
|
|
194
196
|
} else if (h) {
|
|
195
|
-
|
|
196
|
-
const t = Math.max(0, i -
|
|
197
|
+
$.current = !0, q.current = !1, o.current = !0;
|
|
198
|
+
const t = Math.max(0, i - f);
|
|
197
199
|
u == null || u({ startIndex: t, endIndex: i });
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
202
|
}, [
|
|
203
|
+
m,
|
|
201
204
|
x,
|
|
202
|
-
S,
|
|
203
205
|
h,
|
|
204
206
|
X,
|
|
205
207
|
n.length,
|
|
206
|
-
|
|
208
|
+
f,
|
|
207
209
|
i,
|
|
208
210
|
u,
|
|
209
211
|
l
|
|
210
|
-
]),
|
|
212
|
+
]), M = r.useCallback(
|
|
211
213
|
(t) => {
|
|
212
|
-
if (!
|
|
213
|
-
|
|
214
|
-
else if (
|
|
214
|
+
if (!m)
|
|
215
|
+
y(t);
|
|
216
|
+
else if (x) {
|
|
215
217
|
const c = l.current;
|
|
216
218
|
if (c == null ? void 0 : c.querySelector(`[data-message-id="${t}"]`))
|
|
217
|
-
|
|
219
|
+
y(t);
|
|
218
220
|
else {
|
|
219
221
|
if (o.current)
|
|
220
222
|
return;
|
|
221
223
|
const E = n.findIndex(
|
|
222
|
-
(
|
|
224
|
+
(e) => e.id === t || String(e.id) === String(t)
|
|
223
225
|
);
|
|
224
226
|
if (E >= 0) {
|
|
225
|
-
const
|
|
226
|
-
o.current = !0,
|
|
227
|
+
const e = Math.floor(f / 2), H = Math.max(0, E - e), Y = Math.min(n.length, H + f);
|
|
228
|
+
o.current = !0, B(H), D(Y), requestAnimationFrame(() => {
|
|
227
229
|
requestAnimationFrame(() => {
|
|
228
|
-
|
|
230
|
+
y(t), o.current = !1;
|
|
229
231
|
});
|
|
230
232
|
});
|
|
231
233
|
}
|
|
@@ -233,35 +235,35 @@ const nt = 50, L = 100, ct = ({
|
|
|
233
235
|
} else if (h) {
|
|
234
236
|
const c = l.current;
|
|
235
237
|
if (c == null ? void 0 : c.querySelector(`[data-message-id="${t}"]`))
|
|
236
|
-
|
|
238
|
+
y(t);
|
|
237
239
|
else {
|
|
238
240
|
if (o.current)
|
|
239
241
|
return;
|
|
240
|
-
|
|
242
|
+
G.current = t, q.current = !1, o.current = !0;
|
|
241
243
|
}
|
|
242
244
|
}
|
|
243
245
|
F == null || F({ id: t });
|
|
244
246
|
},
|
|
245
247
|
[
|
|
248
|
+
m,
|
|
246
249
|
x,
|
|
247
|
-
S,
|
|
248
250
|
h,
|
|
249
251
|
l,
|
|
250
252
|
n,
|
|
251
|
-
|
|
253
|
+
f,
|
|
252
254
|
F,
|
|
253
|
-
|
|
255
|
+
y
|
|
254
256
|
]
|
|
255
257
|
);
|
|
256
258
|
return {
|
|
257
|
-
renderedMessages:
|
|
258
|
-
handleScrollToBottom:
|
|
259
|
-
handleReferencedMessageClick:
|
|
260
|
-
isEndless:
|
|
259
|
+
renderedMessages: s,
|
|
260
|
+
handleScrollToBottom: p,
|
|
261
|
+
handleReferencedMessageClick: M,
|
|
262
|
+
isEndless: m,
|
|
261
263
|
isOnLastBatch: X,
|
|
262
264
|
skipAutoScrollRef: J
|
|
263
265
|
};
|
|
264
266
|
};
|
|
265
267
|
export {
|
|
266
|
-
|
|
268
|
+
ut as useEndlessScroll
|
|
267
269
|
};
|