listpage-next 0.0.263 → 0.0.264
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/features/ChatClient/components/ChatContent/BubbleList.js +6 -1
- package/dist/features/ChatClient/context/useChatContext.d.ts +1 -0
- package/dist/features/ChatClient/context/useChatContext.js +2 -1
- package/dist/features/ChatClient/ui/Bubble/BubbleList.d.ts +4 -0
- package/dist/features/ChatClient/ui/Bubble/BubbleList.js +2 -4
- package/package.json +1 -1
|
@@ -23,10 +23,15 @@ const ChatBubbleList = (props)=>{
|
|
|
23
23
|
scrollToBottom,
|
|
24
24
|
scrollToBottomWhenAtBottom
|
|
25
25
|
}), [
|
|
26
|
-
scrollToBottom
|
|
26
|
+
scrollToBottom,
|
|
27
|
+
scrollToBottomWhenAtBottom
|
|
27
28
|
]);
|
|
28
29
|
return /*#__PURE__*/ jsx(BubbleList, {
|
|
29
30
|
styles: styles,
|
|
31
|
+
refs: {
|
|
32
|
+
bottomRef,
|
|
33
|
+
containerRef
|
|
34
|
+
},
|
|
30
35
|
messages: ctx.messages,
|
|
31
36
|
messageRender: (message)=>render.renderMessage(message, ctx)
|
|
32
37
|
});
|
|
@@ -9,5 +9,6 @@ export declare function useChatContext(): {
|
|
|
9
9
|
updateConversation: ((key: string, item: any) => void) | undefined;
|
|
10
10
|
appendConversation: ((item: any, index?: number) => void) | undefined;
|
|
11
11
|
scrollToBottom: () => void;
|
|
12
|
+
scrollToBottomWhenAtBottom: () => void;
|
|
12
13
|
};
|
|
13
14
|
export type ChatInstance = ReturnType<typeof useChatContext>;
|
|
@@ -14,7 +14,8 @@ function useChatContext() {
|
|
|
14
14
|
deleteConversation: deleteItem,
|
|
15
15
|
updateConversation: updateItem,
|
|
16
16
|
appendConversation: appendItem,
|
|
17
|
-
scrollToBottom: ()=>bubbleListRef.current?.scrollToBottom()
|
|
17
|
+
scrollToBottom: ()=>bubbleListRef.current?.scrollToBottom(),
|
|
18
|
+
scrollToBottomWhenAtBottom: ()=>bubbleListRef.current?.scrollToBottomWhenAtBottom()
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
export { useChatContext };
|
|
@@ -6,6 +6,10 @@ export interface BubbleListProps<MessageInfo extends BaseMessageInfo> {
|
|
|
6
6
|
bottomPlaceholder?: CSSProperties;
|
|
7
7
|
content?: CSSProperties;
|
|
8
8
|
};
|
|
9
|
+
refs: {
|
|
10
|
+
bottomRef: React.Ref<HTMLDivElement>;
|
|
11
|
+
containerRef: React.Ref<HTMLDivElement>;
|
|
12
|
+
};
|
|
9
13
|
loading?: boolean;
|
|
10
14
|
messages: Message<MessageInfo>[];
|
|
11
15
|
messageRender: (message: Message<MessageInfo>) => React.ReactNode;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useRef } from "react";
|
|
3
2
|
import { styled } from "styled-components";
|
|
4
3
|
import { PageLoading } from "../../../../components/PageLayout/index.js";
|
|
5
4
|
const BubbleList = (props)=>{
|
|
6
|
-
const { loading, styles, messages, messageRender } = props;
|
|
7
|
-
const bottomRef =
|
|
8
|
-
const containerRef = useRef(null);
|
|
5
|
+
const { loading, styles, messages, messageRender, refs } = props;
|
|
6
|
+
const { bottomRef, containerRef } = refs;
|
|
9
7
|
const content = [
|
|
10
8
|
/*#__PURE__*/ jsx("div", {
|
|
11
9
|
style: styles?.headerPlaceholder ?? {
|