listpage-next 0.0.201 → 0.0.202

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.
@@ -8,8 +8,7 @@ export interface ClientContentProps {
8
8
  title?: string;
9
9
  onTitleChange?: (title: string) => void;
10
10
  onClickNewConversation?: () => void;
11
- loading?: boolean;
12
11
  senderProps?: ClientContentBodyProps['senderProps'];
13
12
  bubbleProps?: ChatBubbleListProps;
14
13
  }
15
- export declare const ClientContent: ({ loading, ...props }: ClientContentProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const ClientContent: (props: ClientContentProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,8 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect } from "react";
3
- import { useRequest } from "ahooks";
4
2
  import { styled } from "styled-components";
5
3
  import { ClientContentBody } from "./ClientContentBody.js";
6
4
  import { ClientContentHeader } from "./ClientContentHeader.js";
7
- import { MessageProvider, useChatClientContext } from "../../context/index.js";
8
- import { PageLoading } from "../../../../components/PageLayout/index.js";
9
- const ClientContentComponent = (props)=>{
5
+ const ClientContent = (props)=>{
10
6
  const { extra, style, className, title, onTitleChange, onClickNewConversation, senderProps, bubbleProps } = props;
11
7
  return /*#__PURE__*/ jsxs(Container, {
12
8
  style: style,
@@ -25,27 +21,6 @@ const ClientContentComponent = (props)=>{
25
21
  ]
26
22
  });
27
23
  };
28
- const ClientContent = ({ loading, ...props })=>{
29
- const { request, bubbleListRef } = useChatClientContext();
30
- const { loading: loadingMessage, data } = useRequest(request.getMessages, {
31
- ready: !loading && Boolean(request.getMessages)
32
- });
33
- useEffect(()=>{
34
- if (!loadingMessage) setTimeout(()=>{
35
- bubbleListRef.current?.scrollToBottom();
36
- }, 500);
37
- }, [
38
- loadingMessage
39
- ]);
40
- if (loading || loadingMessage) return /*#__PURE__*/ jsx(PageLoading, {});
41
- return /*#__PURE__*/ jsx(MessageProvider, {
42
- request: request.chat,
43
- initialMessages: data || [],
44
- children: /*#__PURE__*/ jsx(ClientContentComponent, {
45
- ...props
46
- })
47
- });
48
- };
49
24
  const Container = styled.div`
50
25
  display: flex;
51
26
  flex-direction: column;
@@ -1,9 +1,12 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
3
+ import { useRequest } from "ahooks";
4
+ import { PageLoading } from "../../../../components/index.js";
2
5
  import { Sider } from "./Sider.js";
3
6
  import { Logo } from "../Logo/index.js";
4
7
  import { HistoryConversation } from "../HistoryConversation/index.js";
5
8
  import { NewConversationButton } from "../NewConversationButton/index.js";
6
- import { ChatClientProvider } from "../../context/index.js";
9
+ import { ChatClientProvider, MessageProvider, useChatClientContext } from "../../context/index.js";
7
10
  import { Content, Layout } from "./styles.js";
8
11
  const ChatPageComponent = (props)=>{
9
12
  const { logo, title, children, action } = props;
@@ -25,11 +28,32 @@ const ChatPageComponent = (props)=>{
25
28
  ]
26
29
  }),
27
30
  /*#__PURE__*/ jsx(Content, {
28
- children: children
31
+ children: /*#__PURE__*/ jsx(ChatContentContainer, {
32
+ children: children
33
+ })
29
34
  })
30
35
  ]
31
36
  });
32
37
  };
38
+ const ChatContentContainer = (props)=>{
39
+ const { request, bubbleListRef } = useChatClientContext();
40
+ const { loading: loadingMessage, data } = useRequest(request.getMessages, {
41
+ ready: Boolean(request.getMessages)
42
+ });
43
+ useEffect(()=>{
44
+ if (!loadingMessage) setTimeout(()=>{
45
+ bubbleListRef.current?.scrollToBottom();
46
+ }, 500);
47
+ }, [
48
+ loadingMessage
49
+ ]);
50
+ if (loadingMessage) return /*#__PURE__*/ jsx(PageLoading, {});
51
+ return /*#__PURE__*/ jsx(MessageProvider, {
52
+ request: request.chat,
53
+ initialMessages: data || [],
54
+ children: props.children
55
+ });
56
+ };
33
57
  const ChatPage = (props)=>/*#__PURE__*/ jsx(ChatClientProvider, {
34
58
  request: props.request,
35
59
  render: props.render,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "listpage-next",
3
- "version": "0.0.201",
3
+ "version": "0.0.202",
4
4
  "description": "A React component library for creating filter forms with Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",