listpage-next 0.0.169 → 0.0.171
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/components/PageLayout/components/PageContent/index.d.ts +5 -0
- package/dist/components/PageLayout/components/PageContent/index.js +15 -0
- package/dist/components/PageLayout/components/PageHeader/index.d.ts +5 -0
- package/dist/components/PageLayout/components/PageHeader/index.js +5 -0
- package/dist/components/PageLayout/components/PageLayout/index.d.ts +10 -0
- package/dist/components/PageLayout/components/PageLayout/index.js +44 -0
- package/dist/components/{Page/components/Loading → PageLayout/components/PageLoading}/index.js +16 -6
- package/dist/components/{Page/context/page.d.ts → PageLayout/components/PageProvider/index.d.ts} +4 -4
- package/dist/components/{Page/context/page.js → PageLayout/components/PageProvider/index.js} +6 -3
- package/dist/components/PageLayout/components/PageSider/index.d.ts +7 -0
- package/dist/components/PageLayout/components/PageSider/index.js +43 -0
- package/dist/components/PageLayout/index.d.ts +4 -0
- package/dist/components/PageLayout/index.js +4 -0
- package/dist/context/index.d.ts +1 -1
- package/dist/demos/demo2.js +2 -2
- package/dist/demos/demo5.js +1 -1
- package/dist/features/ChatClient/components/ChatContent/index.js +1 -1
- package/dist/features/ChatClient/components/HistoryConversation/index.d.ts +3 -9
- package/dist/features/ChatClient/components/HistoryConversation/index.js +20 -73
- package/dist/features/ChatClient/components/HistoryConversation/styles.d.ts +0 -5
- package/dist/features/ChatClient/components/HistoryConversation/styles.js +17 -45
- package/dist/features/ChatClient/ui/Bubble/BubbleList.d.ts +2 -0
- package/dist/features/ChatClient/ui/Bubble/BubbleList.js +22 -15
- package/dist/features/ChatClient/ui/ConversationList/index.d.ts +21 -0
- package/dist/features/ChatClient/ui/ConversationList/index.js +85 -0
- package/dist/features/ChatClient/ui/ConversationList/styles.d.ts +5 -0
- package/dist/features/ChatClient/ui/ConversationList/styles.js +30 -0
- package/dist/features/ChatClient/ui/index.d.ts +1 -0
- package/dist/features/ChatClient/ui/index.js +1 -0
- package/dist/features/ListPage/components/DataTable/index.d.ts +4 -0
- package/dist/{components/Page/components/ListPage/DataTable.js → features/ListPage/components/DataTable/index.js} +3 -3
- package/dist/features/ListPage/components/DataTable/renders/index.d.ts +7 -0
- package/dist/features/ListPage/components/DataTable/renders/index.js +13 -0
- package/dist/features/ListPage/components/DataTable/renders/link.d.ts +2 -0
- package/dist/features/ListPage/components/DataTable/renders/link.js +27 -0
- package/dist/features/ListPage/components/DataTable/renders/switch.d.ts +2 -0
- package/dist/features/ListPage/components/DataTable/renders/switch.js +10 -0
- package/dist/features/ListPage/components/DataTable/renders/tag.d.ts +2 -0
- package/dist/features/ListPage/components/DataTable/renders/tag.js +7 -0
- package/dist/features/ListPage/components/DataTable/renders/text.d.ts +2 -0
- package/dist/features/ListPage/components/DataTable/renders/text.js +10 -0
- package/dist/features/ListPage/components/DataTable/renders/time.d.ts +2 -0
- package/dist/features/ListPage/components/DataTable/renders/time.js +15 -0
- package/dist/features/ListPage/components/DataTable/types.d.ts +34 -0
- package/dist/features/ListPage/components/DataTable/types.js +0 -0
- package/dist/features/ListPage/components/DataTable/utils/render.d.ts +2 -0
- package/dist/features/ListPage/components/DataTable/utils/render.js +25 -0
- package/dist/features/ListPage/components/ListPageContainer/index.d.ts +17 -0
- package/dist/{components/Page/components/ListPage/v2.js → features/ListPage/components/ListPageContainer/index.js} +10 -24
- package/dist/features/ListPage/context/context.d.ts +4 -0
- package/dist/features/ListPage/context/context.js +22 -0
- package/dist/features/ListPage/context/index.d.ts +2 -0
- package/dist/features/ListPage/context/index.js +3 -0
- package/dist/features/ListPage/context/store.d.ts +37 -0
- package/dist/{components/Page/context/listpage.js → features/ListPage/context/store.js} +2 -42
- package/dist/features/ListPage/context/types.d.ts +12 -0
- package/dist/features/ListPage/context/types.js +0 -0
- package/dist/features/ListPage/hooks/useColumns.d.ts +3 -0
- package/dist/features/ListPage/hooks/useColumns.js +20 -0
- package/dist/{components/Page → features/ListPage}/hooks/useFloat.js +1 -1
- package/dist/features/ListPage/hooks/useHeader.d.ts +2 -0
- package/dist/{components/Page → features/ListPage}/hooks/useHeader.js +2 -2
- package/dist/{components/Page → features/ListPage}/hooks/usePagination.js +2 -2
- package/dist/{components/Page → features/ListPage}/hooks/useSelectionTools.js +1 -1
- package/dist/features/ListPage/index.d.ts +3 -0
- package/dist/features/ListPage/index.js +4 -0
- package/dist/{components/Page/components → features}/ListPage/styles.d.ts +3 -1
- package/dist/{components/Page/components → features}/ListPage/styles.js +15 -2
- package/dist/features/ListPage/types.d.ts +33 -0
- package/dist/features/ListPage/types.js +0 -0
- package/dist/features/ListPage/utils/index.d.ts +10 -0
- package/dist/features/ListPage/utils/index.js +23 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -2
- package/dist/components/Page/components/ListPage/DataTable.d.ts +0 -20
- package/dist/components/Page/components/ListPage/index.d.ts +0 -16
- package/dist/components/Page/components/ListPage/index.js +0 -51
- package/dist/components/Page/components/ListPage/v2.d.ts +0 -43
- package/dist/components/Page/components/PageContainer/index.d.ts +0 -10
- package/dist/components/Page/components/PageContainer/index.js +0 -82
- package/dist/components/Page/context/listpage.d.ts +0 -80
- package/dist/components/Page/hooks/useColumns.d.ts +0 -3
- package/dist/components/Page/hooks/useColumns.js +0 -10
- package/dist/components/Page/hooks/useHeader.d.ts +0 -7
- package/dist/components/Page/index.d.ts +0 -8
- package/dist/components/Page/index.js +0 -7
- /package/dist/components/{Page/components/Loading → PageLayout/components/PageLoading}/index.d.ts +0 -0
- /package/dist/{components/Page → features/ListPage}/hooks/useFloat.d.ts +0 -0
- /package/dist/{components/Page → features/ListPage}/hooks/usePagination.d.ts +0 -0
- /package/dist/{components/Page → features/ListPage}/hooks/useSelectionTools.d.ts +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Layout } from "antd";
|
|
3
|
+
import { styled } from "styled-components";
|
|
4
|
+
const { Content } = Layout;
|
|
5
|
+
const PageContent = (props)=>{
|
|
6
|
+
const { children } = props;
|
|
7
|
+
return /*#__PURE__*/ jsx(ContentStyled, {
|
|
8
|
+
children: children
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
const ContentStyled = styled(Content)`
|
|
12
|
+
background-color: #fff;
|
|
13
|
+
overflow: auto;
|
|
14
|
+
`;
|
|
15
|
+
export { PageContent };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SiderProps } from 'antd';
|
|
2
|
+
export interface PageLayoutProps {
|
|
3
|
+
sider?: React.ReactNode;
|
|
4
|
+
header?: React.ReactNode;
|
|
5
|
+
content?: React.ReactNode;
|
|
6
|
+
logo?: React.ReactNode;
|
|
7
|
+
defaultCollapsed?: boolean;
|
|
8
|
+
siderProps?: Omit<SiderProps, 'collapsed' | 'onCollapse'>;
|
|
9
|
+
}
|
|
10
|
+
export declare const PageLayout: (props: PageLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Layout } from "antd";
|
|
3
|
+
import { styled } from "styled-components";
|
|
4
|
+
import { PageSider } from "../PageSider/index.js";
|
|
5
|
+
import { PageHeader } from "../PageHeader/index.js";
|
|
6
|
+
import { PageContent } from "../PageContent/index.js";
|
|
7
|
+
import { PageProvider, usePageContext } from "../PageProvider/index.js";
|
|
8
|
+
const PageLayoutComponent = (props)=>{
|
|
9
|
+
const { siderProps, sider, header, content, logo } = props;
|
|
10
|
+
const { collapsed, setCollapsed } = usePageContext();
|
|
11
|
+
return /*#__PURE__*/ jsxs(LayoutStyled, {
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ jsx(PageSider, {
|
|
14
|
+
...siderProps,
|
|
15
|
+
logo: logo,
|
|
16
|
+
collapsed: collapsed,
|
|
17
|
+
onCollapse: setCollapsed,
|
|
18
|
+
children: sider
|
|
19
|
+
}),
|
|
20
|
+
/*#__PURE__*/ jsxs(Layout, {
|
|
21
|
+
hasSider: false,
|
|
22
|
+
children: [
|
|
23
|
+
/*#__PURE__*/ jsx(PageHeader, {
|
|
24
|
+
children: header
|
|
25
|
+
}),
|
|
26
|
+
/*#__PURE__*/ jsx(PageContent, {
|
|
27
|
+
children: content
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const PageLayout = (props)=>/*#__PURE__*/ jsx(PageProvider, {
|
|
35
|
+
defaultCollapsed: props.defaultCollapsed,
|
|
36
|
+
children: /*#__PURE__*/ jsx(PageLayoutComponent, {
|
|
37
|
+
...props
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
const LayoutStyled = styled(Layout)`
|
|
41
|
+
height: 100vh;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
`;
|
|
44
|
+
export { PageLayout };
|
package/dist/components/{Page/components/Loading → PageLayout/components/PageLoading}/index.js
RENAMED
|
@@ -15,7 +15,7 @@ const PageLoading = styled_components.div`
|
|
|
15
15
|
&::after {
|
|
16
16
|
animation: LoadingAnimation 1.5s linear infinite;
|
|
17
17
|
border-radius: 5px;
|
|
18
|
-
content:
|
|
18
|
+
content: '';
|
|
19
19
|
height: 10px;
|
|
20
20
|
left: 50%;
|
|
21
21
|
position: absolute;
|
|
@@ -28,27 +28,37 @@ const PageLoading = styled_components.div`
|
|
|
28
28
|
|
|
29
29
|
@keyframes LoadingAnimation {
|
|
30
30
|
0% {
|
|
31
|
-
box-shadow:
|
|
31
|
+
box-shadow:
|
|
32
|
+
-16px 20px 0 -5px #b89dfe,
|
|
33
|
+
0 20px 0 0 #2e6ee7,
|
|
32
34
|
16px 20px 0 2px #b89dfe;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
25% {
|
|
36
|
-
box-shadow:
|
|
38
|
+
box-shadow:
|
|
39
|
+
-16px 20px 0 0 #b89dfe,
|
|
40
|
+
0 20px 0 2px #2e6ee7,
|
|
37
41
|
16px 20px 0 0 #b89dfe;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
50% {
|
|
41
|
-
box-shadow:
|
|
45
|
+
box-shadow:
|
|
46
|
+
-16px 20px 0 2px #b89dfe,
|
|
47
|
+
0 20px 0 0 #2e6ee7,
|
|
42
48
|
16px 20px 0 -5px #b89dfe;
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
75% {
|
|
46
|
-
box-shadow:
|
|
52
|
+
box-shadow:
|
|
53
|
+
-16px 20px 0 0 #b89dfe,
|
|
54
|
+
0 20px 0 -5px #2e6ee7,
|
|
47
55
|
16px 20px 0 0 #b89dfe;
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
to {
|
|
51
|
-
box-shadow:
|
|
59
|
+
box-shadow:
|
|
60
|
+
-16px 20px 0 -5px #b89dfe,
|
|
61
|
+
0 20px 0 0 #2e6ee7,
|
|
52
62
|
16px 20px 0 2px #b89dfe;
|
|
53
63
|
}
|
|
54
64
|
}
|
package/dist/components/{Page/context/page.d.ts → PageLayout/components/PageProvider/index.d.ts}
RENAMED
|
@@ -2,11 +2,11 @@ export declare const PageContext: import("react").Context<{
|
|
|
2
2
|
collapsed: boolean;
|
|
3
3
|
setCollapsed: (collapsed: boolean) => void;
|
|
4
4
|
}>;
|
|
5
|
-
export
|
|
5
|
+
export interface PageProviderProps {
|
|
6
6
|
children: React.ReactNode;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
defaultCollapsed?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const PageProvider: ({ children, defaultCollapsed, }: PageProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
export declare const usePageContext: () => {
|
|
11
11
|
collapsed: boolean;
|
|
12
12
|
setCollapsed: (collapsed: boolean) => void;
|
package/dist/components/{Page/context/page.js → PageLayout/components/PageProvider/index.js}
RENAMED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
2
|
+
import { createContext, useContext, useState } from "react";
|
|
3
3
|
const PageContext = /*#__PURE__*/ createContext({
|
|
4
4
|
collapsed: false,
|
|
5
5
|
setCollapsed: ()=>{}
|
|
6
6
|
});
|
|
7
|
-
const
|
|
7
|
+
const PageProvider = ({ children, defaultCollapsed = false })=>{
|
|
8
|
+
const [collapsed, setCollapsed] = useState(defaultCollapsed);
|
|
9
|
+
return /*#__PURE__*/ jsx(PageContext.Provider, {
|
|
8
10
|
value: {
|
|
9
11
|
collapsed,
|
|
10
12
|
setCollapsed
|
|
11
13
|
},
|
|
12
14
|
children: children
|
|
13
15
|
});
|
|
16
|
+
};
|
|
14
17
|
const usePageContext = ()=>useContext(PageContext);
|
|
15
|
-
export { PageContext,
|
|
18
|
+
export { PageContext, PageProvider, usePageContext };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SiderProps } from 'antd';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface PageSiderProps extends Omit<SiderProps, 'children'> {
|
|
4
|
+
logo?: ReactNode;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const PageSider: (props: PageSiderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from "styled-components";
|
|
3
|
+
import { Layout } from "antd";
|
|
4
|
+
const PageSider = (props)=>{
|
|
5
|
+
const { logo, children, ...siderProps } = props;
|
|
6
|
+
return /*#__PURE__*/ jsx(SiderStyled, {
|
|
7
|
+
trigger: null,
|
|
8
|
+
width: 256,
|
|
9
|
+
collapsedWidth: 80,
|
|
10
|
+
breakpoint: "lg",
|
|
11
|
+
collapsible: true,
|
|
12
|
+
...siderProps,
|
|
13
|
+
children: /*#__PURE__*/ jsxs(SiderContent, {
|
|
14
|
+
children: [
|
|
15
|
+
logo && /*#__PURE__*/ jsx(LogoContentWrapper, {
|
|
16
|
+
children: logo
|
|
17
|
+
}),
|
|
18
|
+
/*#__PURE__*/ jsx(SiderContentWrapper, {
|
|
19
|
+
children: children
|
|
20
|
+
})
|
|
21
|
+
]
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const SiderStyled = styled(Layout.Sider)`
|
|
26
|
+
background-color: #fff;
|
|
27
|
+
border-right: 1px solid #e5e5e5;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
`;
|
|
31
|
+
const SiderContent = styled.div`
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
`;
|
|
36
|
+
const SiderContentWrapper = styled.div`
|
|
37
|
+
flex: 1;
|
|
38
|
+
overflow: auto;
|
|
39
|
+
`;
|
|
40
|
+
const LogoContentWrapper = styled.div`
|
|
41
|
+
flex: 0;
|
|
42
|
+
`;
|
|
43
|
+
export { PageSider };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { PageLoading } from "./components/PageLoading/index.js";
|
|
2
|
+
import { PageLayout } from "./components/PageLayout/index.js";
|
|
3
|
+
import { PageContext, usePageContext } from "./components/PageProvider/index.js";
|
|
4
|
+
export { PageContext, PageLayout, PageLoading, usePageContext };
|
package/dist/context/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FloatContext, FloatProvider, useFloatContext
|
|
1
|
+
export { FloatContext, FloatProvider, useFloatContext } from './float';
|
package/dist/demos/demo2.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { PageLayout } from "../components/PageLayout/index.js";
|
|
3
3
|
const Demo2 = ()=>{
|
|
4
4
|
const sider = /*#__PURE__*/ jsx("div", {
|
|
5
5
|
children: "侧边栏"
|
|
@@ -10,7 +10,7 @@ const Demo2 = ()=>{
|
|
|
10
10
|
const header = /*#__PURE__*/ jsx("div", {
|
|
11
11
|
children: "顶部"
|
|
12
12
|
});
|
|
13
|
-
return /*#__PURE__*/ jsx(
|
|
13
|
+
return /*#__PURE__*/ jsx(PageLayout, {
|
|
14
14
|
sider: sider,
|
|
15
15
|
content: content,
|
|
16
16
|
header: header
|
package/dist/demos/demo5.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, DatePicker, Input, Select, Space, Switch } from "antd";
|
|
3
|
-
import { ListPage } from "../
|
|
3
|
+
import { ListPage } from "../features/ListPage/index.js";
|
|
4
4
|
const columns = [
|
|
5
5
|
{
|
|
6
6
|
key: 'enable',
|
|
@@ -5,7 +5,7 @@ import { styled } from "styled-components";
|
|
|
5
5
|
import { ClientContentBody } from "./ClientContentBody.js";
|
|
6
6
|
import { ClientContentHeader } from "./ClientContentHeader.js";
|
|
7
7
|
import { MessageProvider, useChatClientContext } from "../../context/index.js";
|
|
8
|
-
import { PageLoading } from "../../../../components/
|
|
8
|
+
import { PageLoading } from "../../../../components/PageLayout/index.js";
|
|
9
9
|
const ClientContentComponent = (props)=>{
|
|
10
10
|
const { extra, style, header, sender, className, title, onTitleChange, onClickNewConversation, senderProps, bubbleProps } = props;
|
|
11
11
|
return /*#__PURE__*/ jsxs(Container, {
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
export interface HistoryConversationProps
|
|
1
|
+
export interface HistoryConversationProps {
|
|
2
2
|
rowKey?: string;
|
|
3
|
-
|
|
3
|
+
defaultActiveKey?: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const HistoryConversation:
|
|
6
|
-
type ItemData = {
|
|
7
|
-
icon?: React.ReactNode;
|
|
8
|
-
title: string;
|
|
9
|
-
key: string;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
5
|
+
export declare const HistoryConversation: (props: HistoryConversationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,87 +1,34 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useRef } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { Button, Tooltip } from "antd";
|
|
4
4
|
import { useHover } from "ahooks";
|
|
5
|
-
import { ClockCircleOutlined
|
|
6
|
-
import { InfiniteList } from "../../../../components/InfiniteList/index.js";
|
|
5
|
+
import { ClockCircleOutlined } from "@ant-design/icons";
|
|
7
6
|
import { useChatClientContext } from "../../context/index.js";
|
|
8
|
-
import {
|
|
7
|
+
import { ConversationList } from "../../ui/ConversationList/index.js";
|
|
8
|
+
import { HeaderContainer, HeaderTitle, HistoryConversationContainer } from "./styles.js";
|
|
9
9
|
const HistoryConversation = (props)=>{
|
|
10
|
-
const { rowKey =
|
|
10
|
+
const { rowKey = 'id', defaultActiveKey } = props;
|
|
11
11
|
const { showUpdateTitleModal, conversationListRef, action, request } = useChatClientContext();
|
|
12
12
|
const { onClickConversation, onRenameConversation, onDeleteConversation } = action ?? {};
|
|
13
13
|
return /*#__PURE__*/ jsxs(HistoryConversationContainer, {
|
|
14
14
|
children: [
|
|
15
15
|
/*#__PURE__*/ jsx(Header, {}),
|
|
16
|
-
/*#__PURE__*/ jsx(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const newItem = {
|
|
31
|
-
...item,
|
|
32
|
-
title: newTitle
|
|
33
|
-
};
|
|
34
|
-
await onRenameConversation?.(key, newItem);
|
|
35
|
-
actions.updateItem(key, newItem);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
key: 'delete',
|
|
41
|
-
danger: true,
|
|
42
|
-
label: '删除',
|
|
43
|
-
onClick: async ()=>{
|
|
44
|
-
await onDeleteConversation?.(key, item);
|
|
45
|
-
actions.deleteItem(key);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
];
|
|
49
|
-
return /*#__PURE__*/ jsxs(ListItemContainer, {
|
|
50
|
-
isHover: activeKey === key ? true : void 0,
|
|
51
|
-
onClick: ()=>onClickConversation?.(key, item),
|
|
52
|
-
children: [
|
|
53
|
-
/*#__PURE__*/ jsx(Avatar, {
|
|
54
|
-
size: 20,
|
|
55
|
-
icon: item.icon || /*#__PURE__*/ jsx(MessageOutlined, {})
|
|
56
|
-
}),
|
|
57
|
-
/*#__PURE__*/ jsx(ListText, {
|
|
58
|
-
children: /*#__PURE__*/ jsx(Typography.Text, {
|
|
59
|
-
ellipsis: {
|
|
60
|
-
tooltip: {
|
|
61
|
-
title: item.title,
|
|
62
|
-
placement: 'right'
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
children: item.title
|
|
66
|
-
})
|
|
67
|
-
}),
|
|
68
|
-
/*#__PURE__*/ jsx("div", {
|
|
69
|
-
onClick: (e)=>e.stopPropagation(),
|
|
70
|
-
children: /*#__PURE__*/ jsx(Dropdown, {
|
|
71
|
-
menu: {
|
|
72
|
-
items
|
|
73
|
-
},
|
|
74
|
-
children: /*#__PURE__*/ jsx(Button, {
|
|
75
|
-
type: "text",
|
|
76
|
-
size: "small",
|
|
77
|
-
icon: /*#__PURE__*/ jsx(MoreOutlined, {})
|
|
78
|
-
})
|
|
79
|
-
})
|
|
80
|
-
})
|
|
81
|
-
]
|
|
16
|
+
/*#__PURE__*/ jsx(ConversationList, {
|
|
17
|
+
rowKey: rowKey,
|
|
18
|
+
defaultActiveKey: defaultActiveKey,
|
|
19
|
+
request: request.getConversations,
|
|
20
|
+
ref: conversationListRef,
|
|
21
|
+
onSelectConversation: (data)=>onClickConversation?.(data[rowKey], data),
|
|
22
|
+
onDeleteConversation: (data)=>{
|
|
23
|
+
onDeleteConversation?.(data[rowKey], data);
|
|
24
|
+
},
|
|
25
|
+
onRenameConversation: (data)=>new Promise((resolve)=>{
|
|
26
|
+
showUpdateTitleModal(data.title, async (newTitle)=>{
|
|
27
|
+
data.title = newTitle;
|
|
28
|
+
await onRenameConversation?.(data[rowKey], data);
|
|
29
|
+
resolve(data);
|
|
82
30
|
});
|
|
83
|
-
}
|
|
84
|
-
})
|
|
31
|
+
})
|
|
85
32
|
})
|
|
86
33
|
]
|
|
87
34
|
});
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
export declare const HistoryConversationContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
2
|
export declare const HeaderContainer: 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 HeaderTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
-
export declare const ListContainer: 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 ListItemContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
6
|
-
isHover?: boolean;
|
|
7
|
-
}>> & string;
|
|
8
|
-
export declare const ListText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -1,52 +1,24 @@
|
|
|
1
1
|
import styled_components from "styled-components";
|
|
2
2
|
const HistoryConversationContainer = styled_components.div`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
flex: 1;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
6
|
`;
|
|
7
7
|
const HeaderContainer = styled_components.div`
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
align-items: center;
|
|
11
|
+
padding: 8px 6px;
|
|
12
12
|
`;
|
|
13
13
|
const HeaderTitle = styled_components.div`
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
align-items: center;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex: 1 1;
|
|
17
|
+
font-size: 12px;
|
|
18
|
+
font-weight: 600;
|
|
19
|
+
min-width: 0;
|
|
20
|
+
color: #0000004d;
|
|
21
|
+
line-height: 20px;
|
|
22
|
+
height: 20px;
|
|
23
23
|
`;
|
|
24
|
-
|
|
25
|
-
flex: 1;
|
|
26
|
-
overflow: hidden;
|
|
27
|
-
padding: 0 2px;
|
|
28
|
-
`;
|
|
29
|
-
const ListItemContainer = styled_components.div`
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
padding: 8px 4px;
|
|
33
|
-
border-radius: 8px;
|
|
34
|
-
cursor: pointer;
|
|
35
|
-
gap: 4px;
|
|
36
|
-
|
|
37
|
-
background-color: ${(props)=>props.isHover ? "#0000000a" : "transparent"};
|
|
38
|
-
|
|
39
|
-
&:hover {
|
|
40
|
-
background-color: #0000000a;
|
|
41
|
-
}
|
|
42
|
-
`;
|
|
43
|
-
const ListText = styled_components.div`
|
|
44
|
-
flex: 1;
|
|
45
|
-
|
|
46
|
-
overflow: hidden;
|
|
47
|
-
text-overflow: ellipsis;
|
|
48
|
-
white-space: nowrap;
|
|
49
|
-
word-break: break-all;
|
|
50
|
-
word-wrap: break-word;
|
|
51
|
-
`;
|
|
52
|
-
export { HeaderContainer, HeaderTitle, HistoryConversationContainer, ListContainer, ListItemContainer, ListText };
|
|
24
|
+
export { HeaderContainer, HeaderTitle, HistoryConversationContainer };
|
|
@@ -2,9 +2,11 @@ import { CSSProperties } from 'react';
|
|
|
2
2
|
import { BaseMessageInfo, Message } from '../../context';
|
|
3
3
|
export interface BubbleListProps<MessageInfo extends BaseMessageInfo> {
|
|
4
4
|
styles?: {
|
|
5
|
+
headerPlaceholder?: CSSProperties;
|
|
5
6
|
bottomPlaceholder?: CSSProperties;
|
|
6
7
|
content?: CSSProperties;
|
|
7
8
|
};
|
|
9
|
+
loading?: boolean;
|
|
8
10
|
messages: Message<MessageInfo>[];
|
|
9
11
|
messageRender: (message: Message<MessageInfo>) => React.ReactNode;
|
|
10
12
|
}
|
|
@@ -1,24 +1,31 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef } from "react";
|
|
3
3
|
import { styled } from "styled-components";
|
|
4
|
+
import { PageLoading } from "../../../../components/PageLayout/index.js";
|
|
4
5
|
const BubbleList = (props)=>{
|
|
5
|
-
const { styles, messages, messageRender } = props;
|
|
6
|
+
const { loading, styles, messages, messageRender } = props;
|
|
6
7
|
const bottomRef = useRef(null);
|
|
7
8
|
const containerRef = useRef(null);
|
|
8
|
-
|
|
9
|
+
const content = [
|
|
10
|
+
/*#__PURE__*/ jsx("div", {
|
|
11
|
+
style: styles?.headerPlaceholder ?? {
|
|
12
|
+
height: 4
|
|
13
|
+
}
|
|
14
|
+
}, "header"),
|
|
15
|
+
/*#__PURE__*/ jsx("div", {
|
|
16
|
+
style: styles?.content,
|
|
17
|
+
children: (messages ?? []).map(messageRender)
|
|
18
|
+
}, "content"),
|
|
19
|
+
/*#__PURE__*/ jsx("div", {
|
|
20
|
+
ref: bottomRef,
|
|
21
|
+
style: styles?.bottomPlaceholder ?? {
|
|
22
|
+
height: 60
|
|
23
|
+
}
|
|
24
|
+
}, "footer")
|
|
25
|
+
];
|
|
26
|
+
return /*#__PURE__*/ jsx(ContentContainer, {
|
|
9
27
|
ref: containerRef,
|
|
10
|
-
children:
|
|
11
|
-
/*#__PURE__*/ jsx("div", {
|
|
12
|
-
style: styles?.content,
|
|
13
|
-
children: (messages ?? []).map(messageRender)
|
|
14
|
-
}),
|
|
15
|
-
/*#__PURE__*/ jsx("div", {
|
|
16
|
-
ref: bottomRef,
|
|
17
|
-
style: styles?.bottomPlaceholder ?? {
|
|
18
|
-
height: 60
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
]
|
|
28
|
+
children: loading ? /*#__PURE__*/ jsx(PageLoading, {}) : content
|
|
22
29
|
});
|
|
23
30
|
};
|
|
24
31
|
const ContentContainer = styled.div`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ItemType } from 'antd/es/menu/interface';
|
|
2
|
+
import { InfiniteListProps, InfiniteListRef, RenderActions } from '../../../../components/InfiniteList';
|
|
3
|
+
export interface ConverstionListProps<T = any> {
|
|
4
|
+
rowKey: string;
|
|
5
|
+
ref?: InfiniteListRef<T>;
|
|
6
|
+
defaultActiveKey?: string;
|
|
7
|
+
request: InfiniteListProps<T>['request'];
|
|
8
|
+
menus?: (Omit<ItemType, 'onClick'> & {
|
|
9
|
+
onClick?: (item: T, index: number, actions: RenderActions<Record<string, any>>) => void;
|
|
10
|
+
})[];
|
|
11
|
+
onSelectConversation?: (data: T) => void;
|
|
12
|
+
onDeleteConversation?: (data: T) => void;
|
|
13
|
+
onRenameConversation?: (data: T) => T;
|
|
14
|
+
}
|
|
15
|
+
type ItemData = {
|
|
16
|
+
icon?: React.ReactNode;
|
|
17
|
+
title: string;
|
|
18
|
+
key: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const ConversationList: <T extends ItemData = any>(props: ConverstionListProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|