listpage-next 0.0.74 → 0.0.76
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/ClientContent/Content.d.ts +1 -2
- package/dist/features/ChatClient/components/ClientContent/Content.js +4 -1
- package/dist/features/ChatClient/components/ClientContent/Header.d.ts +0 -4
- package/dist/features/ChatClient/components/ClientContent/Header.js +9 -3
- package/dist/features/ChatClient/components/ClientContent/index.d.ts +2 -2
- package/dist/features/ChatClient/components/Layout/ChatPage.d.ts +2 -3
- package/dist/features/ChatClient/components/Layout/ChatPage.js +31 -29
- package/dist/features/ChatClient/components/Layout/Sider.d.ts +1 -7
- package/dist/features/ChatClient/components/Layout/Sider.js +22 -10
- package/dist/features/ChatClient/context/index.d.ts +11 -0
- package/dist/features/ChatClient/context/index.js +18 -0
- package/package.json +1 -1
- package/dist/features/ChatClient/components/Layout/useCollapsed.d.ts +0 -11
- package/dist/features/ChatClient/components/Layout/useCollapsed.js +0 -29
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties } from "react";
|
|
2
|
-
interface ContentProps {
|
|
2
|
+
export interface ContentProps {
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
styles?: {
|
|
5
5
|
topPlaceholder?: CSSProperties;
|
|
@@ -9,4 +9,3 @@ interface ContentProps {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const Content: (props: ContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export declare const ContentContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
12
|
-
export {};
|
|
@@ -3,11 +3,7 @@ export interface HeaderProps extends HeaderLeftProps {
|
|
|
3
3
|
}
|
|
4
4
|
export declare const Header: (props: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
interface HeaderLeftProps {
|
|
6
|
-
showActions?: boolean;
|
|
7
|
-
showTitle?: boolean;
|
|
8
|
-
onCollapsed?: () => any;
|
|
9
6
|
onClickNewConversation?: () => void;
|
|
10
|
-
disabledNewConversation?: boolean;
|
|
11
7
|
defaultTitle: string;
|
|
12
8
|
onTitleChange?: (title: string) => any;
|
|
13
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
2
3
|
import { EditOutlined, MenuUnfoldOutlined } from "@ant-design/icons";
|
|
3
4
|
import { Button, Divider, Input, Modal } from "antd";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
5
5
|
import { styled } from "styled-components";
|
|
6
|
+
import { useChatClientContext } from "../../context/index.js";
|
|
6
7
|
const Header = (props)=>{
|
|
7
8
|
const { extra, ...headerLeftProps } = props;
|
|
8
9
|
return /*#__PURE__*/ jsxs(HeaderContainer, {
|
|
@@ -17,9 +18,15 @@ const Header = (props)=>{
|
|
|
17
18
|
});
|
|
18
19
|
};
|
|
19
20
|
const HeaderLeft = (props)=>{
|
|
20
|
-
const {
|
|
21
|
+
const { onClickNewConversation, onTitleChange } = props;
|
|
22
|
+
const { collapsed, setCollapsed } = useChatClientContext();
|
|
21
23
|
const [open, setOpen] = useState(false);
|
|
22
24
|
const [title, setTitle] = useState(props.defaultTitle);
|
|
25
|
+
const onCollapsed = ()=>{
|
|
26
|
+
setCollapsed(!collapsed);
|
|
27
|
+
};
|
|
28
|
+
const showActions = !!collapsed;
|
|
29
|
+
const showTitle = !!title;
|
|
23
30
|
return /*#__PURE__*/ jsxs(Left, {
|
|
24
31
|
children: [
|
|
25
32
|
showActions && /*#__PURE__*/ jsxs(ActionContainer, {
|
|
@@ -32,7 +39,6 @@ const HeaderLeft = (props)=>{
|
|
|
32
39
|
}),
|
|
33
40
|
/*#__PURE__*/ jsx(Button, {
|
|
34
41
|
type: "primary",
|
|
35
|
-
disabled: disabledNewConversation,
|
|
36
42
|
iconPosition: "start",
|
|
37
43
|
onClick: onClickNewConversation,
|
|
38
44
|
shape: "round",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FooterProps } from "./Footer";
|
|
2
2
|
import { HeaderProps } from "./Header";
|
|
3
3
|
export interface ClientContentProps {
|
|
4
4
|
className?: string;
|
|
5
5
|
style?: React.CSSProperties;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
headerProps: HeaderProps;
|
|
8
|
-
footerProps?:
|
|
8
|
+
footerProps?: FooterProps;
|
|
9
9
|
loading?: boolean;
|
|
10
10
|
}
|
|
11
11
|
export declare const ClientContent: (props: ClientContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { InfiniteListProps } from "../../../../components/InfiniteList";
|
|
3
3
|
export interface ChatPageProps<T = any> {
|
|
4
4
|
logo?: string;
|
|
5
5
|
title?: string;
|
|
6
|
-
|
|
7
|
-
children?: React.ReactNode;
|
|
6
|
+
children?: ReactNode;
|
|
8
7
|
request: InfiniteListProps["request"];
|
|
9
8
|
onClickConversation?: (key: string, item: T) => void;
|
|
10
9
|
onClickNewConversation?: () => void;
|
|
@@ -3,37 +3,39 @@ import { Sider } from "./Sider.js";
|
|
|
3
3
|
import { Logo } from "../Logo/index.js";
|
|
4
4
|
import { HistoryConversation } from "../HistoryConversation/index.js";
|
|
5
5
|
import { NewConversation } from "../NewConversation/index.js";
|
|
6
|
+
import { ChatClientProvider } from "../../context/index.js";
|
|
6
7
|
import { Content, Layout } from "./styles.js";
|
|
7
8
|
const ChatPage = (props)=>{
|
|
8
|
-
const { logo, title, children,
|
|
9
|
-
return /*#__PURE__*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
9
|
+
const { logo, title, children, request, onClickConversation, onClickNewConversation, onClickMoreAgent, onRenameConversation, onDeleteConversation } = props;
|
|
10
|
+
return /*#__PURE__*/ jsx(ChatClientProvider, {
|
|
11
|
+
children: /*#__PURE__*/ jsxs(Layout, {
|
|
12
|
+
style: {
|
|
13
|
+
height: '100vh'
|
|
14
|
+
},
|
|
15
|
+
children: [
|
|
16
|
+
/*#__PURE__*/ jsxs(Sider, {
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ jsx(Logo, {
|
|
19
|
+
icon: logo,
|
|
20
|
+
title: title || '智能对话'
|
|
21
|
+
}),
|
|
22
|
+
/*#__PURE__*/ jsx(NewConversation, {
|
|
23
|
+
onClickNew: onClickNewConversation,
|
|
24
|
+
onClickMoreAgent: onClickMoreAgent
|
|
25
|
+
}),
|
|
26
|
+
/*#__PURE__*/ jsx(HistoryConversation, {
|
|
27
|
+
request: request,
|
|
28
|
+
onSelect: onClickConversation,
|
|
29
|
+
onRename: onRenameConversation,
|
|
30
|
+
onDelete: onDeleteConversation
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ jsx(Content, {
|
|
35
|
+
children: children
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
})
|
|
37
39
|
});
|
|
38
40
|
};
|
|
39
41
|
export { ChatPage };
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import { Ref } from "react";
|
|
2
1
|
export interface SiderProps {
|
|
3
2
|
children?: React.ReactNode;
|
|
4
3
|
}
|
|
5
|
-
export
|
|
6
|
-
setCollapsed: (collapsed: boolean) => void;
|
|
7
|
-
}>;
|
|
8
|
-
export declare const Sider: import("react").ForwardRefExoticComponent<SiderProps & import("react").RefAttributes<{
|
|
9
|
-
setCollapsed: (collapsed: boolean) => void;
|
|
10
|
-
}>>;
|
|
4
|
+
export declare const Sider: (props: SiderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Button } from "antd";
|
|
3
3
|
import { styled } from "styled-components";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons";
|
|
5
|
+
import { useChatClientContext } from "../../context/index.js";
|
|
6
|
+
const Sider = (props)=>{
|
|
6
7
|
const { children } = props;
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const { collapsed, setCollapsed } = useChatClientContext();
|
|
9
|
+
const icon = collapsed ? /*#__PURE__*/ jsx(MenuUnfoldOutlined, {}) : /*#__PURE__*/ jsx(MenuFoldOutlined, {});
|
|
10
|
+
const trigger = /*#__PURE__*/ jsx(Button, {
|
|
11
|
+
icon: icon,
|
|
12
|
+
type: "text",
|
|
13
|
+
size: "small",
|
|
14
|
+
onClick: ()=>setCollapsed(!collapsed),
|
|
15
|
+
style: {
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
right: 10,
|
|
18
|
+
top: 18
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const styles = collapsed ? {
|
|
22
|
+
width: 0,
|
|
23
|
+
borderRight: 'none'
|
|
24
|
+
} : {};
|
|
13
25
|
return /*#__PURE__*/ jsx(SiderContainer, {
|
|
14
26
|
style: styles,
|
|
15
27
|
children: /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -19,7 +31,7 @@ const Sider = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
19
31
|
]
|
|
20
32
|
})
|
|
21
33
|
});
|
|
22
|
-
}
|
|
34
|
+
};
|
|
23
35
|
const SiderContainer = styled.div`
|
|
24
36
|
width: 260px;
|
|
25
37
|
background: #f3f4f6;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
export interface ChatClientContextProps {
|
|
3
|
+
collapsed: boolean;
|
|
4
|
+
setCollapsed: (collapsed: boolean) => void;
|
|
5
|
+
}
|
|
6
|
+
export interface ChatClientProviderProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const ChatClientContext: import("react").Context<ChatClientContextProps>;
|
|
10
|
+
export declare const ChatClientProvider: (props: ChatClientProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function useChatClientContext(): ChatClientContextProps;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useState } from "react";
|
|
3
|
+
const ChatClientContext = /*#__PURE__*/ createContext({});
|
|
4
|
+
const ChatClientProvider = (props)=>{
|
|
5
|
+
const { children } = props;
|
|
6
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
7
|
+
return /*#__PURE__*/ jsx(ChatClientContext.Provider, {
|
|
8
|
+
value: {
|
|
9
|
+
collapsed,
|
|
10
|
+
setCollapsed
|
|
11
|
+
},
|
|
12
|
+
children: children
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
function useChatClientContext() {
|
|
16
|
+
return useContext(ChatClientContext);
|
|
17
|
+
}
|
|
18
|
+
export { ChatClientContext, ChatClientProvider, useChatClientContext };
|
package/package.json
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare function useCollapsed(): {
|
|
2
|
-
trigger: import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
styles: {
|
|
4
|
-
width: number;
|
|
5
|
-
borderRight: string;
|
|
6
|
-
} | {
|
|
7
|
-
width?: undefined;
|
|
8
|
-
borderRight?: undefined;
|
|
9
|
-
};
|
|
10
|
-
setCollapsed: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
11
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons";
|
|
3
|
-
import { Button } from "antd";
|
|
4
|
-
import { useState } from "react";
|
|
5
|
-
function useCollapsed() {
|
|
6
|
-
const [collapsed, setCollapsed] = useState(false);
|
|
7
|
-
const icon = collapsed ? /*#__PURE__*/ jsx(MenuUnfoldOutlined, {}) : /*#__PURE__*/ jsx(MenuFoldOutlined, {});
|
|
8
|
-
const trigger = /*#__PURE__*/ jsx(Button, {
|
|
9
|
-
icon: icon,
|
|
10
|
-
type: "text",
|
|
11
|
-
size: "small",
|
|
12
|
-
onClick: ()=>setCollapsed(!collapsed),
|
|
13
|
-
style: {
|
|
14
|
-
position: 'absolute',
|
|
15
|
-
right: 10,
|
|
16
|
-
top: 18
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const styles = collapsed ? {
|
|
20
|
-
width: 0,
|
|
21
|
-
borderRight: 'none'
|
|
22
|
-
} : {};
|
|
23
|
-
return {
|
|
24
|
-
trigger,
|
|
25
|
-
styles,
|
|
26
|
-
setCollapsed
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export { useCollapsed };
|