@ant-design/agentic-ui 2.0.14 → 2.0.16
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/BackTo/BackBottom.d.ts +56 -0
- package/dist/BackTo/BackTop.d.ts +39 -2
- package/dist/BackTo/index.d.ts +20 -0
- package/dist/Bubble/AIBubble.js +4 -1
- package/dist/Bubble/List/index.js +1 -1
- package/dist/Bubble/MessagesContent/MarkdownPreview.js +3 -1
- package/dist/Bubble/UserBubble.js +1 -1
- package/dist/Bubble/index.d.ts +6 -0
- package/dist/Bubble/style.js +5 -2
- package/dist/ChatBootPage/CaseReply.js +1 -1
- package/dist/ChatBootPage/Title.js +1 -1
- package/dist/ChatBootPage/index.d.ts +6 -0
- package/dist/Components/ActionIconBox/index.js +1 -1
- package/dist/Components/ActionItemBox/ActionItemBox.js +1 -1
- package/dist/Components/ActionItemBox/index.d.ts +6 -0
- package/dist/Components/Button/index.d.ts +6 -0
- package/dist/History/components/HistoryItem.js +2 -2
- package/dist/History/components/NewChatComponent.js +1 -1
- package/dist/History/components/SearchComponent.d.ts +2 -0
- package/dist/History/components/SearchComponent.js +17 -3
- package/dist/History/index.d.ts +4 -0
- package/dist/History/index.js +17 -11
- package/dist/History/menu.d.ts +2 -0
- package/dist/History/menu.js +18 -5
- package/dist/History/style.js +1 -1
- package/dist/History/types/index.d.ts +6 -0
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +1 -1
- package/dist/MarkdownEditor/editor/components/CommentList/index.js +1 -1
- package/dist/MarkdownEditor/editor/components/ContributorAvatar/index.js +1 -1
- package/dist/MarkdownEditor/editor/components/fntTag/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Comment/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition.js +1 -1
- package/dist/MarkdownEditor/editor/elements/FootnoteReference.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Head.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Image/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +2 -2
- package/dist/MarkdownEditor/editor/elements/List/List.js +1 -1
- package/dist/MarkdownEditor/editor/elements/List/ListItem.js +1 -1
- package/dist/MarkdownEditor/editor/elements/List/style.js +2 -2
- package/dist/MarkdownEditor/editor/elements/Media.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Paragraph.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/Table.js +5 -3
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndex/index.js +3 -1
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndexSpacer/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/TableRowIndex/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/Td/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.d.ts +0 -22
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +176 -124
- package/dist/MarkdownEditor/editor/elements/index.js +1 -1
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +16 -12
- package/dist/MarkdownEditor/editor/style.js +6 -6
- package/dist/MarkdownEditor/editor/tools/DragHandle.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/ToolBar.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/index.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +9 -8
- package/dist/MarkdownInputField/AttachmentButton/index.d.ts +2 -0
- package/dist/MarkdownInputField/AttachmentButton/index.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/style.js +3 -3
- package/dist/MarkdownInputField/AttachmentButton/utils.d.ts +8 -0
- package/dist/MarkdownInputField/AttachmentButton/utils.js +10 -3
- package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +1 -1
- package/dist/MarkdownInputField/Enlargement/index.js +9 -29
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +30 -27
- package/dist/MarkdownInputField/FileMapView/index.d.ts +4 -4
- package/dist/MarkdownInputField/FileMapView/index.js +25 -15
- package/dist/MarkdownInputField/FileUploadManager/index.js +2 -2
- package/dist/MarkdownInputField/MarkdownInputField.d.ts +9 -19
- package/dist/MarkdownInputField/MarkdownInputField.js +155 -192
- package/dist/MarkdownInputField/QuickActions/index.js +4 -8
- package/dist/MarkdownInputField/RefinePromptButton/index.js +9 -54
- package/dist/MarkdownInputField/SendActions/index.js +1 -1
- package/dist/MarkdownInputField/SendButton/index.js +1 -1
- package/dist/MarkdownInputField/SkillModeBar/index.js +1 -1
- package/dist/MarkdownInputField/TopOperatingArea/index.js +1 -1
- package/dist/MarkdownInputField/VoiceInput/index.js +1 -1
- package/dist/MarkdownInputField/style.js +40 -45
- package/dist/Plugins/chart/AreaChart/index.d.ts +2 -2
- package/dist/Plugins/chart/AreaChart/index.js +9 -29
- package/dist/Plugins/chart/BarChart/index.d.ts +8 -8
- package/dist/Plugins/chart/BarChart/index.js +9 -8
- package/dist/Plugins/chart/DonutChart/constants.d.ts +0 -1
- package/dist/Plugins/chart/DonutChart/constants.js +0 -14
- package/dist/Plugins/chart/DonutChart/index.js +51 -16
- package/dist/Plugins/chart/DonutChart/style.js +7 -0
- package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
- package/dist/Plugins/chart/FunnelChart/index.d.ts +8 -8
- package/dist/Plugins/chart/FunnelChart/index.js +85 -66
- package/dist/Plugins/chart/FunnelChart/style.js +12 -0
- package/dist/Plugins/chart/LineChart/index.d.ts +2 -2
- package/dist/Plugins/chart/LineChart/index.js +16 -19
- package/dist/Plugins/chart/RadarChart/index.d.ts +11 -5
- package/dist/Plugins/chart/RadarChart/index.js +35 -50
- package/dist/Plugins/chart/RadarChart/style.js +8 -0
- package/dist/Plugins/chart/ScatterChart/index.d.ts +23 -6
- package/dist/Plugins/chart/ScatterChart/index.js +58 -57
- package/dist/Plugins/chart/ScatterChart/style.js +8 -0
- package/dist/Plugins/chart/components/ChartContainer/style.js +7 -1
- package/dist/Plugins/chart/hooks/useChartStatistic.d.ts +0 -6
- package/dist/Plugins/chart/hooks/useChartStatistic.js +0 -16
- package/dist/Plugins/chart/index.js +2 -2
- package/dist/Plugins/index.d.ts +6 -0
- package/dist/Plugins/mermaid/index.js +1 -1
- package/dist/Quote/index.js +1 -1
- package/dist/Schema/index.d.ts +6 -0
- package/dist/ThoughtChainList/DotAni/index.css +1 -1
- package/dist/ThoughtChainList/DotAni/index.js +2 -2
- package/dist/ToolUseBar/ToolUseBarThink.js +1 -1
- package/dist/ToolUseBar/index.js +1 -1
- package/dist/WelcomeMessage/index.d.ts +42 -0
- package/dist/WelcomeMessage/index.js +1 -1
- package/dist/Workspace/File/PreviewComponent.js +3 -2
- package/dist/Workspace/File/style.js +2 -1
- package/dist/Workspace/RealtimeFollow/style.js +2 -7
- package/dist/Workspace/Task/index.js +1 -1
- package/dist/Workspace/style.js +2 -1
- package/package.json +1 -1
- package/dist/MarkdownInputField/Enlargement/style.d.ts +0 -10
- package/dist/MarkdownInputField/Enlargement/style.js +0 -75
|
@@ -38,7 +38,7 @@ var blinkCaret = new Keyframes("blink-caret", {
|
|
|
38
38
|
var genStyle = (token) => {
|
|
39
39
|
return {
|
|
40
40
|
// 拖拽手柄样式
|
|
41
|
-
".ant-md-editor-drag-handle": {
|
|
41
|
+
".ant-agentic-md-editor-drag-handle": {
|
|
42
42
|
position: "absolute",
|
|
43
43
|
display: "flex",
|
|
44
44
|
userSelect: "none",
|
|
@@ -51,7 +51,7 @@ var genStyle = (token) => {
|
|
|
51
51
|
top: "calc(3px + 0.75em - 14px)"
|
|
52
52
|
},
|
|
53
53
|
// 拖拽图标样式
|
|
54
|
-
".ant-md-editor-drag-icon": {
|
|
54
|
+
".ant-agentic-md-editor-drag-icon": {
|
|
55
55
|
display: "flex",
|
|
56
56
|
alignItems: "center",
|
|
57
57
|
borderRadius: "18px",
|
|
@@ -64,7 +64,7 @@ var genStyle = (token) => {
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
// 拖拽元素悬浮效果
|
|
67
|
-
".ant-md-editor-drag-el:hover > .ant-md-editor-drag-handle": {
|
|
67
|
+
".ant-agentic-md-editor-drag-el:hover > .ant-agentic-md-editor-drag-handle": {
|
|
68
68
|
opacity: 1
|
|
69
69
|
},
|
|
70
70
|
// 可调整大小组件样式
|
|
@@ -114,7 +114,7 @@ var genStyle = (token) => {
|
|
|
114
114
|
transitionDuration: "200ms"
|
|
115
115
|
},
|
|
116
116
|
// 隐藏样式
|
|
117
|
-
".ant-md-editor-hidden": {
|
|
117
|
+
".ant-agentic-md-editor-hidden": {
|
|
118
118
|
display: "none"
|
|
119
119
|
},
|
|
120
120
|
// KaTeX容器样式
|
|
@@ -228,7 +228,7 @@ var genStyle = (token) => {
|
|
|
228
228
|
"h1,h2,h3,h4,h5,h6": {
|
|
229
229
|
position: "relative",
|
|
230
230
|
textWrap: "balance",
|
|
231
|
-
".ant-md-editor-drag-handle": {
|
|
231
|
+
".ant-agentic-md-editor-drag-handle": {
|
|
232
232
|
top: "calc(3px + 0.05em) !important"
|
|
233
233
|
}
|
|
234
234
|
},
|
|
@@ -453,7 +453,7 @@ var genStyle = (token) => {
|
|
|
453
453
|
margin: "var(--margin-8x) 0"
|
|
454
454
|
},
|
|
455
455
|
// 打字机效果样式
|
|
456
|
-
".ant-md-editor-content .typewriter:last-of-type > *:last-of-type span[data-slate-leaf]:last-of-type span[data-slate-string]": {
|
|
456
|
+
".ant-agentic-md-editor-content .typewriter:last-of-type > *:last-of-type span[data-slate-leaf]:last-of-type span[data-slate-string]": {
|
|
457
457
|
borderRight: "0.15em solid var(--color-primary-control-fill-primary)",
|
|
458
458
|
animationName: `${typing.getName()}, ${blinkCaret.getName()}`,
|
|
459
459
|
animationDuration: "3.5s, 0.5s",
|
|
@@ -33,7 +33,7 @@ var DragHandle = (props) => {
|
|
|
33
33
|
return /* @__PURE__ */ React.createElement(Tooltip, { title: "拖拽移动" }, /* @__PURE__ */ React.createElement(
|
|
34
34
|
"span",
|
|
35
35
|
{
|
|
36
|
-
className: "ant-md-editor-drag-handle",
|
|
36
|
+
className: "ant-agentic-md-editor-drag-handle",
|
|
37
37
|
"data-testid": "drag-handle",
|
|
38
38
|
style: __spreadValues({}, props.style),
|
|
39
39
|
contentEditable: false,
|
|
@@ -53,7 +53,7 @@ var DragHandle = (props) => {
|
|
|
53
53
|
store.draggedElement = parent;
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
-
/* @__PURE__ */ React.createElement("div", { className: "ant-md-editor-drag-icon" }, /* @__PURE__ */ React.createElement(HolderOutlined, null))
|
|
56
|
+
/* @__PURE__ */ React.createElement("div", { className: "ant-agentic-md-editor-drag-icon" }, /* @__PURE__ */ React.createElement(HolderOutlined, null))
|
|
57
57
|
));
|
|
58
58
|
};
|
|
59
59
|
export {
|
|
@@ -23,7 +23,7 @@ import { BaseToolBar } from "./BaseBar";
|
|
|
23
23
|
import { useStyle } from "./toolBarStyle";
|
|
24
24
|
var ToolBar = (props) => {
|
|
25
25
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
26
|
-
const baseClassName = context == null ? void 0 : context.getPrefixCls(`md-editor-toolbar`);
|
|
26
|
+
const baseClassName = context == null ? void 0 : context.getPrefixCls(`agentic-md-editor-toolbar`);
|
|
27
27
|
const { wrapSSR, hashId } = useStyle(baseClassName);
|
|
28
28
|
return wrapSSR(
|
|
29
29
|
/* @__PURE__ */ React.createElement(
|
package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js
CHANGED
|
@@ -105,7 +105,7 @@ var AttachmentFileListItem = ({
|
|
|
105
105
|
e.stopPropagation();
|
|
106
106
|
onDelete == null ? void 0 : onDelete();
|
|
107
107
|
};
|
|
108
|
-
return /* @__PURE__ */ React.createElement(Tooltip, { title: "点击重试", open: isErrorStatus
|
|
108
|
+
return /* @__PURE__ */ React.createElement(Tooltip, { title: "点击重试", open: isErrorStatus ? void 0 : false }, /* @__PURE__ */ React.createElement(
|
|
109
109
|
motion.div,
|
|
110
110
|
{
|
|
111
111
|
variants: ANIMATION_VARIANTS,
|
|
@@ -62,7 +62,7 @@ var AttachmentFileList = ({
|
|
|
62
62
|
onClearFileMap
|
|
63
63
|
}) => {
|
|
64
64
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
65
|
-
const prefix = context == null ? void 0 : context.getPrefixCls("md-editor-attachment-list");
|
|
65
|
+
const prefix = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-attachment-list");
|
|
66
66
|
const { wrapSSR, hashId } = useStyle(prefix);
|
|
67
67
|
const [imgSrc, setImgSrc] = React.useState(void 0);
|
|
68
68
|
const fileList = Array.from((fileMap == null ? void 0 : fileMap.values()) || []);
|
|
@@ -66,7 +66,7 @@ var genStyle = (token) => {
|
|
|
66
66
|
background: "var(--color-gray-bg-card-white)",
|
|
67
67
|
boxShadow: "var(--shadow-control-base)",
|
|
68
68
|
boxSizing: "border-box",
|
|
69
|
-
padding: "var(--padding-
|
|
69
|
+
padding: "var(--padding-1x)",
|
|
70
70
|
display: "flex",
|
|
71
71
|
flexDirection: "row",
|
|
72
72
|
alignItems: "center",
|
|
@@ -116,22 +116,23 @@ var genStyle = (token) => {
|
|
|
116
116
|
display: "flex",
|
|
117
117
|
flexDirection: "column",
|
|
118
118
|
justifyContent: "space-between",
|
|
119
|
-
gap: "var(--margin-0-5x)"
|
|
119
|
+
gap: "var(--margin-0-5x)",
|
|
120
|
+
flex: 1,
|
|
121
|
+
minWidth: 0
|
|
120
122
|
},
|
|
121
123
|
"&-file-name": {
|
|
122
124
|
display: "flex",
|
|
123
|
-
width: "
|
|
125
|
+
width: "100%",
|
|
124
126
|
alignItems: "center",
|
|
125
127
|
lineHeight: "var(--line-height-xs)",
|
|
126
128
|
fontFamily: token.fontFamily,
|
|
127
|
-
gap: -1,
|
|
128
129
|
"&-text": {
|
|
129
130
|
font: "var(--font-text-body-emphasized-sm)",
|
|
130
131
|
letterSpacing: "var(--letter-spacing-body-emphasized-sm, normal)",
|
|
131
132
|
color: "var(--color-gray-text-default)",
|
|
132
|
-
maxWidth: "
|
|
133
|
+
maxWidth: "112px",
|
|
134
|
+
width: "100%",
|
|
133
135
|
whiteSpace: "nowrap",
|
|
134
|
-
width: "max-content",
|
|
135
136
|
overflow: "hidden",
|
|
136
137
|
display: "-webkit-box",
|
|
137
138
|
"-webkit-line-clamp": "1",
|
|
@@ -171,9 +172,9 @@ var genStyle = (token) => {
|
|
|
171
172
|
backgroundColor: "var(--color-gray-text-default)",
|
|
172
173
|
fontSize: "var(--font-size-sm)",
|
|
173
174
|
position: "absolute",
|
|
174
|
-
top:
|
|
175
|
+
top: 2,
|
|
175
176
|
borderRadius: "50%",
|
|
176
|
-
right:
|
|
177
|
+
right: 2,
|
|
177
178
|
color: "var(--color-gray-contrast)",
|
|
178
179
|
display: "none",
|
|
179
180
|
justifyContent: "center",
|
|
@@ -205,7 +205,7 @@ var ButtonContent = ({ title }) => {
|
|
|
205
205
|
};
|
|
206
206
|
var AttachmentButton = ({ disabled, uploadImage, title, supportedFormat, render }) => {
|
|
207
207
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
208
|
-
const prefix = context == null ? void 0 : context.getPrefixCls("md-editor-attachment-button");
|
|
208
|
+
const prefix = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-attachment-button");
|
|
209
209
|
const { wrapSSR, hashId } = useStyle(prefix);
|
|
210
210
|
const format = supportedFormat || SupportedFileFormats.image;
|
|
211
211
|
const content = /* @__PURE__ */ React.createElement(ButtonContent, { title });
|
|
@@ -69,7 +69,7 @@ var genStyle = (token) => {
|
|
|
69
69
|
display: "flex",
|
|
70
70
|
width: "112px",
|
|
71
71
|
"&-text": {
|
|
72
|
-
maxWidth: "
|
|
72
|
+
maxWidth: "98px",
|
|
73
73
|
overflow: "hidden",
|
|
74
74
|
textOverflow: "ellipsis",
|
|
75
75
|
WebkitLineClamp: 1,
|
|
@@ -92,9 +92,9 @@ var genStyle = (token) => {
|
|
|
92
92
|
background: "#353E5C",
|
|
93
93
|
fontSize: 12,
|
|
94
94
|
position: "absolute",
|
|
95
|
-
top:
|
|
95
|
+
top: 2,
|
|
96
96
|
borderRadius: "50%",
|
|
97
|
-
right:
|
|
97
|
+
right: 2,
|
|
98
98
|
color: "#FFFFFF",
|
|
99
99
|
display: "flex",
|
|
100
100
|
justifyContent: "center",
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 将KB转换为可读的文件大小格式
|
|
3
|
+
* 支持从字节(B)到TB的所有单位,最小单位为B
|
|
3
4
|
*
|
|
4
5
|
* @param {number} kb - 文件大小(KB)
|
|
5
6
|
* @returns {string} 格式化后的文件大小字符串
|
|
6
7
|
*
|
|
7
8
|
* @example
|
|
9
|
+
* kbToSize(1073741824) // "1 TB"
|
|
10
|
+
* kbToSize(1048576) // "1 GB"
|
|
8
11
|
* kbToSize(1024) // "1 MB"
|
|
9
12
|
* kbToSize(512) // "512 KB"
|
|
13
|
+
* kbToSize(1) // "1 KB"
|
|
14
|
+
* kbToSize(0.5) // "512 B"
|
|
15
|
+
* kbToSize(0.1) // "102.4 B"
|
|
16
|
+
* kbToSize(0.0001) // "0.1 B"
|
|
17
|
+
* kbToSize(0) // "0 B"
|
|
10
18
|
*/
|
|
11
19
|
export declare const kbToSize: (kb: number) => string;
|
|
12
20
|
/**
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
// src/MarkdownInputField/AttachmentButton/utils.ts
|
|
2
2
|
var kbToSize = (kb) => {
|
|
3
|
-
const sizes = ["KB", "MB", "GB", "TB"];
|
|
4
|
-
const
|
|
5
|
-
|
|
3
|
+
const sizes = ["B", "KB", "MB", "GB", "TB"];
|
|
4
|
+
const bytes = kb * 1024;
|
|
5
|
+
if (bytes <= 0) {
|
|
6
|
+
return "0 B";
|
|
7
|
+
}
|
|
8
|
+
if (bytes < 1024) {
|
|
9
|
+
return parseFloat(bytes.toFixed(2)) + " " + sizes[0];
|
|
10
|
+
}
|
|
11
|
+
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
|
12
|
+
return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + " " + sizes[i];
|
|
6
13
|
};
|
|
7
14
|
var isImageFile = (file) => {
|
|
8
15
|
return file.type.startsWith("image/");
|
|
@@ -100,7 +100,7 @@ var DraggablePopupItem = React.memo((props) => {
|
|
|
100
100
|
DraggablePopupItem.displayName = "DraggablePopupItem";
|
|
101
101
|
var ActionItemContainer = (props) => {
|
|
102
102
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
103
|
-
const basePrefixCls = getPrefixCls("
|
|
103
|
+
const basePrefixCls = getPrefixCls("agentic-chat-action-item-box");
|
|
104
104
|
const { wrapSSR, hashId } = useStyle(basePrefixCls);
|
|
105
105
|
const containerRef = useRef(null);
|
|
106
106
|
const scrollRef = useRef(null);
|
|
@@ -1,38 +1,18 @@
|
|
|
1
1
|
// src/MarkdownInputField/Enlargement/index.tsx
|
|
2
2
|
import { ExpandAlt, FoldAlt } from "@sofa-design/icons";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import React, { useContext } from "react";
|
|
6
|
-
import { useStyle } from "./style";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { ActionIconBox } from "../../Components/ActionIconBox";
|
|
7
5
|
var Enlargement = ({
|
|
8
6
|
isEnlarged = false,
|
|
9
7
|
onEnlargeClick
|
|
10
8
|
}) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
className: classNames(`${baseCls}-icon`, hashId, {
|
|
19
|
-
enlarged: isEnlarged
|
|
20
|
-
}),
|
|
21
|
-
role: "button",
|
|
22
|
-
tabIndex: 0,
|
|
23
|
-
"aria-label": isEnlarged ? "缩小" : "放大",
|
|
24
|
-
"aria-pressed": !!isEnlarged,
|
|
25
|
-
onClick: onEnlargeClick,
|
|
26
|
-
onKeyDown: (e) => {
|
|
27
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
28
|
-
e.preventDefault();
|
|
29
|
-
onEnlargeClick == null ? void 0 : onEnlargeClick();
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
title: isEnlarged ? "缩小" : "放大"
|
|
33
|
-
},
|
|
34
|
-
isEnlarged ? /* @__PURE__ */ React.createElement(FoldAlt, null) : /* @__PURE__ */ React.createElement(ExpandAlt, null)
|
|
35
|
-
))
|
|
9
|
+
return /* @__PURE__ */ React.createElement(
|
|
10
|
+
ActionIconBox,
|
|
11
|
+
{
|
|
12
|
+
title: isEnlarged ? "缩小" : "放大",
|
|
13
|
+
onClick: onEnlargeClick
|
|
14
|
+
},
|
|
15
|
+
isEnlarged ? /* @__PURE__ */ React.createElement(FoldAlt, null) : /* @__PURE__ */ React.createElement(ExpandAlt, null)
|
|
36
16
|
);
|
|
37
17
|
};
|
|
38
18
|
var Enlargement_default = Enlargement;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// src/MarkdownInputField/FileMapView/FileMapViewItem.tsx
|
|
2
|
-
import {
|
|
2
|
+
import { EllipsisOutlined } from "@ant-design/icons";
|
|
3
|
+
import { Download, Eye } from "@sofa-design/icons";
|
|
3
4
|
import { Tooltip } from "antd";
|
|
4
5
|
import classNames from "classnames";
|
|
5
6
|
import dayjs from "dayjs";
|
|
6
7
|
import { motion } from "framer-motion";
|
|
7
8
|
import React, { useContext, useMemo } from "react";
|
|
9
|
+
import { ActionIconBox } from "../../Components/ActionIconBox";
|
|
8
10
|
import { I18nContext } from "../../I18n";
|
|
9
11
|
import { AttachmentFileIcon } from "../AttachmentButton/AttachmentFileList/AttachmentFileIcon";
|
|
10
12
|
import { kbToSize } from "../AttachmentButton/utils";
|
|
@@ -141,9 +143,12 @@ var FileMapViewItem = (props) => {
|
|
|
141
143
|
)
|
|
142
144
|
},
|
|
143
145
|
props.customSlot ? /* @__PURE__ */ React.createElement(
|
|
144
|
-
|
|
146
|
+
ActionIconBox,
|
|
145
147
|
{
|
|
146
|
-
|
|
148
|
+
title: "更多",
|
|
149
|
+
onClick: (e) => {
|
|
150
|
+
e.stopPropagation();
|
|
151
|
+
},
|
|
147
152
|
className: classNames(
|
|
148
153
|
`${props.prefixCls}-action-btn`,
|
|
149
154
|
props.hashId
|
|
@@ -151,8 +156,9 @@ var FileMapViewItem = (props) => {
|
|
|
151
156
|
},
|
|
152
157
|
typeof props.customSlot === "function" ? props.customSlot(file) : props.customSlot
|
|
153
158
|
) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
154
|
-
|
|
159
|
+
ActionIconBox,
|
|
155
160
|
{
|
|
161
|
+
title: (locale == null ? void 0 : locale.preview) || "预览",
|
|
156
162
|
onClick: (e) => {
|
|
157
163
|
var _a;
|
|
158
164
|
e.stopPropagation();
|
|
@@ -165,8 +171,9 @@ var FileMapViewItem = (props) => {
|
|
|
165
171
|
},
|
|
166
172
|
/* @__PURE__ */ React.createElement(Eye, { color: "var(--color-gray-text-secondary)" })
|
|
167
173
|
), /* @__PURE__ */ React.createElement(
|
|
168
|
-
|
|
174
|
+
ActionIconBox,
|
|
169
175
|
{
|
|
176
|
+
title: (locale == null ? void 0 : locale.download) || "下载",
|
|
170
177
|
onClick: (e) => {
|
|
171
178
|
var _a;
|
|
172
179
|
e.stopPropagation();
|
|
@@ -178,38 +185,34 @@ var FileMapViewItem = (props) => {
|
|
|
178
185
|
)
|
|
179
186
|
},
|
|
180
187
|
/* @__PURE__ */ React.createElement(Download, { color: "var(--color-gray-text-secondary)" })
|
|
181
|
-
), props.renderMoreAction ? /* @__PURE__ */ React.createElement(
|
|
182
|
-
|
|
188
|
+
), props.renderMoreAction ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
189
|
+
ActionIconBox,
|
|
183
190
|
{
|
|
191
|
+
title: "更多操作",
|
|
184
192
|
onClick: (e) => {
|
|
185
193
|
e.stopPropagation();
|
|
186
194
|
},
|
|
187
|
-
onKeyDown: (e) => {
|
|
188
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
189
|
-
e.preventDefault();
|
|
190
|
-
e.stopPropagation();
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
role: "button",
|
|
194
|
-
tabIndex: 0,
|
|
195
|
-
"aria-label": "更多操作",
|
|
196
195
|
className: classNames(
|
|
197
196
|
`${props.prefixCls}-action-btn`,
|
|
198
197
|
props.hashId
|
|
199
198
|
)
|
|
200
199
|
},
|
|
201
|
-
/* @__PURE__ */ React.createElement(
|
|
202
|
-
|
|
203
|
-
"div",
|
|
200
|
+
/* @__PURE__ */ React.createElement(
|
|
201
|
+
EllipsisOutlined,
|
|
204
202
|
{
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
203
|
+
style: { color: "var(--color-gray-text-secondary)" }
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
), props.renderMoreAction ? /* @__PURE__ */ React.createElement(
|
|
207
|
+
"div",
|
|
208
|
+
{
|
|
209
|
+
className: classNames(
|
|
210
|
+
`${props.prefixCls}-more-custom`,
|
|
211
|
+
props.hashId
|
|
212
|
+
)
|
|
213
|
+
},
|
|
214
|
+
props.renderMoreAction(file)
|
|
215
|
+
) : null) : null)
|
|
213
216
|
) : null
|
|
214
217
|
)
|
|
215
218
|
);
|
|
@@ -7,7 +7,7 @@ export type FileMapViewProps = {
|
|
|
7
7
|
onPreview?: (file: AttachmentFile) => void;
|
|
8
8
|
/** 下载文件回调 */
|
|
9
9
|
onDownload?: (file: AttachmentFile) => void;
|
|
10
|
-
/**
|
|
10
|
+
/** 点击"查看所有文件"回调,携带当前所有文件列表 */
|
|
11
11
|
onViewAll?: (files: AttachmentFile[]) => void;
|
|
12
12
|
/** 自定义更多操作 DOM(优先于 onMore,传入则展示该 DOM,不传则不展示更多按钮) */
|
|
13
13
|
renderMoreAction?: (file: AttachmentFile) => React.ReactNode;
|
|
@@ -17,11 +17,11 @@ export type FileMapViewProps = {
|
|
|
17
17
|
style?: React.CSSProperties;
|
|
18
18
|
/** 自定义根容器类名 */
|
|
19
19
|
className?: string;
|
|
20
|
-
/**
|
|
20
|
+
/** 最多展示的非图片文件数量,传入则开启溢出控制并在超出时显示"查看所有文件"按钮,不传则使用默认值3 */
|
|
21
21
|
maxDisplayCount?: number;
|
|
22
|
-
|
|
23
|
-
/** 是否展示“查看此任务中的所有文件”按钮(默认展示) */
|
|
22
|
+
/** 是否显示"查看全部"按钮,当为 false 时忽略 maxDisplayCount 限制,显示所有文件 */
|
|
24
23
|
showMoreButton?: boolean;
|
|
24
|
+
placement?: 'left' | 'right';
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
27
|
* FileMapView 组件 - 文件映射视图组件
|
|
@@ -9,11 +9,11 @@ import { FileMapViewItem } from "./FileMapViewItem";
|
|
|
9
9
|
import { useStyle } from "./style";
|
|
10
10
|
var FileMapView = (props) => {
|
|
11
11
|
var _a, _b;
|
|
12
|
-
const { placement = "left" } = props;
|
|
12
|
+
const { placement = "left", showMoreButton = true } = props;
|
|
13
13
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
14
|
-
const prefix = context == null ? void 0 : context.getPrefixCls("md-editor-file-view-list");
|
|
14
|
+
const prefix = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-file-view-list");
|
|
15
15
|
const { wrapSSR, hashId } = useStyle(prefix);
|
|
16
|
-
const
|
|
16
|
+
const maxDisplayCount = (_a = props.maxDisplayCount) != null ? _a : 3;
|
|
17
17
|
const fileList = useMemo(() => {
|
|
18
18
|
var _a2;
|
|
19
19
|
if (!props.fileMap) {
|
|
@@ -21,18 +21,25 @@ var FileMapView = (props) => {
|
|
|
21
21
|
}
|
|
22
22
|
return Array.from(((_a2 = props.fileMap) == null ? void 0 : _a2.values()) || []);
|
|
23
23
|
}, [props.fileMap]);
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
return fileList;
|
|
27
|
-
}
|
|
28
|
-
return fileList.slice(0, Math.max(0, maxCount));
|
|
29
|
-
}, [fileList, maxCount, props.showMoreButton]);
|
|
30
|
-
const imgList = useMemo(() => {
|
|
31
|
-
return limitedFiles.filter((file) => isImageFile(file));
|
|
24
|
+
const allImgFiles = useMemo(() => {
|
|
25
|
+
return fileList.filter((file) => isImageFile(file));
|
|
32
26
|
}, [fileList]);
|
|
33
|
-
const
|
|
34
|
-
return
|
|
27
|
+
const allNoImageFiles = useMemo(() => {
|
|
28
|
+
return fileList.filter((file) => !isImageFile(file));
|
|
35
29
|
}, [fileList]);
|
|
30
|
+
const imgList = useMemo(() => {
|
|
31
|
+
if (!showMoreButton) {
|
|
32
|
+
return allImgFiles;
|
|
33
|
+
}
|
|
34
|
+
return allImgFiles.slice(0, Math.max(0, maxDisplayCount));
|
|
35
|
+
}, [allImgFiles, maxDisplayCount, showMoreButton]);
|
|
36
|
+
const noImageFileList = useMemo(() => {
|
|
37
|
+
if (!showMoreButton) {
|
|
38
|
+
return allNoImageFiles;
|
|
39
|
+
}
|
|
40
|
+
const remainingCount = Math.max(0, maxDisplayCount - imgList.length);
|
|
41
|
+
return allNoImageFiles.slice(0, remainingCount);
|
|
42
|
+
}, [allNoImageFiles, maxDisplayCount, imgList.length, showMoreButton]);
|
|
36
43
|
return wrapSSR(
|
|
37
44
|
/* @__PURE__ */ React.createElement(
|
|
38
45
|
"div",
|
|
@@ -41,7 +48,10 @@ var FileMapView = (props) => {
|
|
|
41
48
|
display: "flex",
|
|
42
49
|
flexDirection: "column",
|
|
43
50
|
gap: 4,
|
|
44
|
-
|
|
51
|
+
maxWidth: "100%",
|
|
52
|
+
minWidth: 0,
|
|
53
|
+
alignItems: placement === "left" ? "flex-start" : "flex-end",
|
|
54
|
+
width: "max-content"
|
|
45
55
|
}
|
|
46
56
|
},
|
|
47
57
|
/* @__PURE__ */ React.createElement(
|
|
@@ -152,7 +162,7 @@ var FileMapView = (props) => {
|
|
|
152
162
|
}
|
|
153
163
|
);
|
|
154
164
|
}),
|
|
155
|
-
|
|
165
|
+
showMoreButton && maxDisplayCount !== void 0 && fileList.length > maxDisplayCount ? /* @__PURE__ */ React.createElement(
|
|
156
166
|
"div",
|
|
157
167
|
{
|
|
158
168
|
style: { width: (_b = props.style) == null ? void 0 : _b.width },
|
|
@@ -61,7 +61,7 @@ var useFileUploadManager = ({
|
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
63
|
const uploadImage = useRefFunction(() => __async(void 0, null, function* () {
|
|
64
|
-
var _a;
|
|
64
|
+
var _a, _b;
|
|
65
65
|
let isUploading = false;
|
|
66
66
|
for (const file of (fileMap == null ? void 0 : fileMap.values()) || []) {
|
|
67
67
|
if (file.status === "uploading") {
|
|
@@ -76,7 +76,7 @@ var useFileUploadManager = ({
|
|
|
76
76
|
input.id = "uploadImage_" + Math.random();
|
|
77
77
|
input.type = "file";
|
|
78
78
|
input.accept = ((_a = supportedFormat == null ? void 0 : supportedFormat.extensions) == null ? void 0 : _a.join(",")) || "image/*";
|
|
79
|
-
input.multiple =
|
|
79
|
+
input.multiple = (_b = attachment == null ? void 0 : attachment.allowMultiple) != null ? _b : true;
|
|
80
80
|
input.style.display = "none";
|
|
81
81
|
input.onchange = (e) => __async(void 0, null, function* () {
|
|
82
82
|
if (input.dataset.readonly) {
|
|
@@ -209,29 +209,19 @@ export type MarkdownInputFieldProps = {
|
|
|
209
209
|
onRefine: (input: string) => Promise<string>;
|
|
210
210
|
};
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
213
|
-
* @description
|
|
214
|
-
* @default false
|
|
215
|
-
* @example
|
|
216
|
-
* ```tsx
|
|
217
|
-
* <MarkdownInputField
|
|
218
|
-
* enlargeable={true} // 支持放大功能
|
|
219
|
-
* />
|
|
220
|
-
* ```
|
|
221
|
-
*/
|
|
222
|
-
enlargeable?: boolean;
|
|
223
|
-
/**
|
|
224
|
-
* 目标容器的 ref,用于放大功能
|
|
225
|
-
* @description 当点击放大按钮时,输入框将撑满到此容器高度,距离顶部48px
|
|
212
|
+
* 放大功能配置
|
|
213
|
+
* @description 仅保留对象形态:{ enable: boolean }
|
|
214
|
+
* @default { enable: false }
|
|
226
215
|
* @example
|
|
227
216
|
* ```tsx
|
|
228
|
-
*
|
|
229
|
-
* <MarkdownInputField
|
|
230
|
-
* enlargeTargetRef={containerRef}
|
|
231
|
-
* />
|
|
217
|
+
* <MarkdownInputField enlargeable={{ enable: true }} />
|
|
232
218
|
* ```
|
|
233
219
|
*/
|
|
234
|
-
|
|
220
|
+
enlargeable?: {
|
|
221
|
+
enable?: boolean;
|
|
222
|
+
/** 放大状态下的目标高度(px),默认 980 */
|
|
223
|
+
height?: number;
|
|
224
|
+
};
|
|
235
225
|
/**
|
|
236
226
|
* Markdown 编辑器实例的引用
|
|
237
227
|
* @description 用于获取编辑器实例,可以通过该实例调用编辑器的方法
|