listpage-next 0.0.200 → 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.
- package/dist/features/ChatClient/components/ChatContent/index.d.ts +1 -2
- package/dist/features/ChatClient/components/ChatContent/index.js +1 -26
- package/dist/features/ChatClient/components/ChatPage/ChatPage.js +26 -2
- package/dist/features/ChatClient/ui/ChatInput/index.js +8 -8
- package/dist/features/ChatClient/ui/ChatInput/styles.d.ts +3 -0
- package/dist/features/ChatClient/ui/ChatInput/styles.js +9 -1
- package/package.json +1 -1
|
@@ -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: (
|
|
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
|
-
|
|
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:
|
|
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,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useState } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { PauseCircleTwoTone } from "@ant-design/icons";
|
|
3
|
+
import { Divider, Dropdown } from "antd";
|
|
5
4
|
import { EditorContent } from "../EditorContent/index.js";
|
|
6
|
-
import { ChatInputBottom, ChatInputContent, ChatInputPanel, ExtraContainer } from "./styles.js";
|
|
5
|
+
import { ChatInputBottom, ChatInputContent, ChatInputPanel, ExtraContainer, SendButton } from "./styles.js";
|
|
7
6
|
import { useTrigger } from "./hooks/useTrigger.js";
|
|
8
7
|
import { IconSend } from "../../icons/IconSend.js";
|
|
9
8
|
const ChatInput = (props)=>{
|
|
@@ -53,21 +52,22 @@ const ChatInput = (props)=>{
|
|
|
53
52
|
size: "large",
|
|
54
53
|
type: "vertical"
|
|
55
54
|
}),
|
|
56
|
-
/*#__PURE__*/ jsx(
|
|
55
|
+
/*#__PURE__*/ jsx(SendButton, {
|
|
57
56
|
type: "primary",
|
|
58
57
|
shape: "circle",
|
|
59
58
|
variant: "filled",
|
|
60
59
|
onClick: handleClickSend,
|
|
61
60
|
onKeyDown: handleKeyDown,
|
|
62
61
|
disabled: !inputValue && !loading,
|
|
62
|
+
icon: /*#__PURE__*/ jsx(IconSend, {
|
|
63
|
+
size: 16
|
|
64
|
+
}),
|
|
65
|
+
loading: loading,
|
|
63
66
|
style: {
|
|
64
67
|
display: 'inline-flex',
|
|
65
68
|
alignItems: 'center',
|
|
66
69
|
justifyContent: 'center'
|
|
67
|
-
}
|
|
68
|
-
children: loading ? /*#__PURE__*/ jsx(PauseCircleTwoTone, {}) : /*#__PURE__*/ jsx(IconSend, {
|
|
69
|
-
size: 16
|
|
70
|
-
})
|
|
70
|
+
}
|
|
71
71
|
})
|
|
72
72
|
]
|
|
73
73
|
})
|
|
@@ -2,3 +2,6 @@ export declare const ChatInputPanel: import("styled-components/dist/types").ISty
|
|
|
2
2
|
export declare const ChatInputContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
3
|
export declare const ChatInputBottom: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
4
|
export declare const ExtraContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
+
export declare const SendButton: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("antd").ButtonProps & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>, never>> & string & Omit<import("react").ForwardRefExoticComponent<import("antd").ButtonProps & import("react").RefAttributes<HTMLAnchorElement | HTMLButtonElement>> & {
|
|
6
|
+
Group: import("react").FC<import("antd/es/button").ButtonGroupProps>;
|
|
7
|
+
}, keyof import("react").Component<any, {}, any>>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Button } from "antd";
|
|
1
2
|
import { styled } from "styled-components";
|
|
2
3
|
const ChatInputPanel = styled.div`
|
|
3
4
|
position: relative;
|
|
@@ -53,4 +54,11 @@ const ExtraContainer = styled.div`
|
|
|
53
54
|
align-items: center;
|
|
54
55
|
justify-content: center;
|
|
55
56
|
`;
|
|
56
|
-
|
|
57
|
+
const SendButton = styled(Button)`
|
|
58
|
+
.ant-btn-icon {
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
export { ChatInputBottom, ChatInputContent, ChatInputPanel, ExtraContainer, SendButton };
|