listpage-next 0.0.224 → 0.0.226
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.
|
@@ -9,6 +9,7 @@ export interface SimplifyChatPageProps<SessionData = any, MessageInfo extends Ba
|
|
|
9
9
|
chatRef?: RefObject<ChatInstance>;
|
|
10
10
|
request: ChatRequest<SessionData, MessageInfo>;
|
|
11
11
|
render: ChatRender<MessageInfo>;
|
|
12
|
+
loading?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export declare const SimplifyChatPageComponent: <T = any>(props: SimplifyChatPageProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export declare const SimplifyChatPage: <T = any>(props: SimplifyChatPageProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,6 +3,7 @@ import { useImperativeHandle } from "react";
|
|
|
3
3
|
import { ChatClientProvider, MessageProvider } from "../../context/index.js";
|
|
4
4
|
import { useChatContext } from "../../context/useChatContext.js";
|
|
5
5
|
import { SimplifyClientContentBody } from "../ChatContent/ClientContentBody.js";
|
|
6
|
+
import { PageLoading } from "../../../../components/index.js";
|
|
6
7
|
const SimplifyChatPageComponent = (props)=>{
|
|
7
8
|
const { chatRef, senderProps } = props;
|
|
8
9
|
const context = useChatContext();
|
|
@@ -14,7 +15,9 @@ const SimplifyChatPageComponent = (props)=>{
|
|
|
14
15
|
style: props.style
|
|
15
16
|
});
|
|
16
17
|
};
|
|
17
|
-
const SimplifyChatPage = (props)
|
|
18
|
+
const SimplifyChatPage = (props)=>{
|
|
19
|
+
if (props.loading) return /*#__PURE__*/ jsx(PageLoading, {});
|
|
20
|
+
return /*#__PURE__*/ jsx(ChatClientProvider, {
|
|
18
21
|
request: props.request,
|
|
19
22
|
render: props.render,
|
|
20
23
|
children: /*#__PURE__*/ jsx(MessageProvider, {
|
|
@@ -25,4 +28,5 @@ const SimplifyChatPage = (props)=>/*#__PURE__*/ jsx(ChatClientProvider, {
|
|
|
25
28
|
})
|
|
26
29
|
})
|
|
27
30
|
});
|
|
31
|
+
};
|
|
28
32
|
export { SimplifyChatPage, SimplifyChatPageComponent };
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { HistoryOutlined } from "@ant-design/icons";
|
|
3
|
+
import { PageLoading } from "../../../../components/index.js";
|
|
3
4
|
import { useRequest } from "ahooks";
|
|
4
5
|
import { Button, Dropdown, Tooltip } from "antd";
|
|
6
|
+
import styled_components from "styled-components";
|
|
5
7
|
const ConversationDropdownMenu = (props)=>{
|
|
6
8
|
const { request, onSelect, activeKey } = props;
|
|
7
|
-
const { data, run: refresh } = useRequest(()=>request(), {
|
|
9
|
+
const { data, run: refresh, loading } = useRequest(()=>request(), {
|
|
8
10
|
manual: true
|
|
9
11
|
});
|
|
10
12
|
const menus = [
|
|
@@ -29,18 +31,15 @@ const ConversationDropdownMenu = (props)=>{
|
|
|
29
31
|
],
|
|
30
32
|
menu: {
|
|
31
33
|
items: menus,
|
|
32
|
-
activeKey
|
|
34
|
+
activeKey
|
|
33
35
|
},
|
|
34
36
|
popupRender: (originNode)=>{
|
|
35
|
-
if (!data?.list?.length)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
children: "暂无历史会话"
|
|
43
|
-
});
|
|
37
|
+
if (loading || !data?.list?.length) {
|
|
38
|
+
const content = loading ? /*#__PURE__*/ jsx(PageLoading, {}) : '暂无历史会话';
|
|
39
|
+
return /*#__PURE__*/ jsx(DefaultPanelContainer, {
|
|
40
|
+
children: content
|
|
41
|
+
});
|
|
42
|
+
}
|
|
44
43
|
return originNode;
|
|
45
44
|
},
|
|
46
45
|
children: /*#__PURE__*/ jsx(Button, {
|
|
@@ -53,4 +52,12 @@ const ConversationDropdownMenu = (props)=>{
|
|
|
53
52
|
})
|
|
54
53
|
});
|
|
55
54
|
};
|
|
55
|
+
const DefaultPanelContainer = styled_components.div`
|
|
56
|
+
padding: 12px 24px;
|
|
57
|
+
background: #fff;
|
|
58
|
+
color: rgba(0,0,0,0.88);
|
|
59
|
+
border-radius: 8px;
|
|
60
|
+
min-height: 100px;
|
|
61
|
+
min-width: 200px;
|
|
62
|
+
`;
|
|
56
63
|
export { ConversationDropdownMenu };
|