listpage-next 0.0.142 → 0.0.144
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/demos/demo11.js +14 -9
- package/dist/features/ChatClient/components/ChatContent/BubbleList.js +1 -0
- package/dist/features/ChatClient/components/ChatDialog/index.d.ts +1 -2
- package/dist/features/ChatClient/components/ChatDialog/index.js +16 -6
- package/dist/features/ChatClient/components/ChatDialog/styles.js +3 -1
- package/dist/features/ChatClient/components/ChatDialog/useExtra.js +9 -0
- package/package.json +1 -1
package/dist/demos/demo11.js
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
const Demo11 = ()=>/*#__PURE__*/ jsx(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { ChatDialog } from "../features/ChatClient/index.js";
|
|
3
|
+
const Demo11 = ()=>/*#__PURE__*/ jsx("div", {
|
|
4
|
+
style: {
|
|
5
|
+
width: 100
|
|
6
|
+
},
|
|
7
|
+
children: /*#__PURE__*/ jsx(ChatDialog, {
|
|
8
|
+
title: "测试",
|
|
9
|
+
style: {
|
|
10
|
+
width: 500,
|
|
11
|
+
height: 800
|
|
7
12
|
},
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
13
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
14
|
+
children: "?????"
|
|
15
|
+
})
|
|
16
|
+
})
|
|
12
17
|
});
|
|
13
18
|
export { Demo11 };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
export interface ChatDialogProps {
|
|
3
|
-
id?: string;
|
|
4
|
-
className?: string;
|
|
5
3
|
style?: CSSProperties;
|
|
6
4
|
children?: React.ReactNode;
|
|
7
5
|
title?: ReactNode;
|
|
6
|
+
draggable?: boolean;
|
|
8
7
|
onClose?: () => void;
|
|
9
8
|
onClear?: () => void;
|
|
10
9
|
extra?: (nodes: {
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useRef } from "react";
|
|
2
|
+
import { useMemo, useRef } from "react";
|
|
3
3
|
import { useExtra } from "./useExtra.js";
|
|
4
4
|
import { CardBody, CardExtra, CardHeader, CardTitle, Container } from "./styles.js";
|
|
5
|
+
import react_draggable from "react-draggable";
|
|
5
6
|
const ChatDialog = (props)=>{
|
|
6
|
-
const {
|
|
7
|
+
const { style, children, title, draggable = true } = props;
|
|
7
8
|
const containerRef = useRef(null);
|
|
9
|
+
const hanldeClassName = useMemo(()=>'dialog_' + Math.random().toString(36).slice(2), []);
|
|
8
10
|
const extra = useExtra({
|
|
9
11
|
containerRef,
|
|
10
12
|
extra: props.extra,
|
|
11
13
|
onClose: props.onClose,
|
|
12
14
|
onClear: props.onClear
|
|
13
15
|
});
|
|
14
|
-
|
|
15
|
-
ref: containerRef,
|
|
16
|
+
const inner = /*#__PURE__*/ jsxs(Container, {
|
|
16
17
|
style: style,
|
|
18
|
+
ref: containerRef,
|
|
17
19
|
children: [
|
|
18
20
|
/*#__PURE__*/ jsxs(CardHeader, {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
className: hanldeClassName,
|
|
22
|
+
style: {
|
|
23
|
+
cursor: draggable ? 'move' : 'pointer'
|
|
24
|
+
},
|
|
21
25
|
children: [
|
|
22
26
|
/*#__PURE__*/ jsx(CardTitle, {
|
|
23
27
|
children: title
|
|
@@ -32,5 +36,11 @@ const ChatDialog = (props)=>{
|
|
|
32
36
|
})
|
|
33
37
|
]
|
|
34
38
|
});
|
|
39
|
+
if (!draggable) return inner;
|
|
40
|
+
return /*#__PURE__*/ jsx(react_draggable, {
|
|
41
|
+
nodeRef: containerRef,
|
|
42
|
+
handle: `.${hanldeClassName}`,
|
|
43
|
+
children: inner
|
|
44
|
+
});
|
|
35
45
|
};
|
|
36
46
|
export { ChatDialog };
|
|
@@ -8,6 +8,9 @@ const Container = styled_components.div`
|
|
|
8
8
|
0 16px 96px 0 rgba(0, 0, 0, 0.08) !important;
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
background: #fff;
|
|
11
|
+
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
11
14
|
`;
|
|
12
15
|
const CardHeader = styled_components.div`
|
|
13
16
|
display: flex;
|
|
@@ -16,7 +19,6 @@ const CardHeader = styled_components.div`
|
|
|
16
19
|
border-bottom: 1px solid #eee;
|
|
17
20
|
align-items: center;
|
|
18
21
|
user-select: none;
|
|
19
|
-
cursor: move;
|
|
20
22
|
flex-shrink: 0;
|
|
21
23
|
flex-direction: row;
|
|
22
24
|
`;
|
|
@@ -14,15 +14,24 @@ function useExtra(options) {
|
|
|
14
14
|
icon: /*#__PURE__*/ jsx(CloseOutlined, {})
|
|
15
15
|
});
|
|
16
16
|
const fullScreenEle = isFullScreen ? /*#__PURE__*/ jsx(Button, {
|
|
17
|
+
style: {
|
|
18
|
+
border: 'none'
|
|
19
|
+
},
|
|
17
20
|
type: "text",
|
|
18
21
|
onClick: exitFullscreen,
|
|
19
22
|
icon: /*#__PURE__*/ jsx(FullscreenExitOutlined, {})
|
|
20
23
|
}) : /*#__PURE__*/ jsx(Button, {
|
|
21
24
|
type: "text",
|
|
25
|
+
style: {
|
|
26
|
+
border: 'none'
|
|
27
|
+
},
|
|
22
28
|
onClick: enterFullscreen,
|
|
23
29
|
icon: /*#__PURE__*/ jsx(FullscreenOutlined, {})
|
|
24
30
|
});
|
|
25
31
|
const clearMsgEle = /*#__PURE__*/ jsx(Button, {
|
|
32
|
+
style: {
|
|
33
|
+
border: 'none'
|
|
34
|
+
},
|
|
26
35
|
type: "text",
|
|
27
36
|
onClick: onClear,
|
|
28
37
|
icon: /*#__PURE__*/ jsx(ClearOutlined, {})
|