@ant-design/agentic-ui 2.0.18 → 2.0.20
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/Bubble/FileView.js +1 -1
- package/dist/Bubble/type.d.ts +2 -2
- package/dist/ChatBootPage/ButtonTabStyle.js +2 -2
- package/dist/ChatBootPage/CaseReply.d.ts +10 -2
- package/dist/ChatBootPage/CaseReply.js +20 -2
- package/dist/ChatBootPage/CaseReplyStyle.js +51 -9
- package/dist/Components/ActionIconBox/index.js +102 -46
- package/dist/Components/Button/ToggleButton/index.js +3 -3
- package/dist/Components/Button/ToggleButton/style.js +1 -1
- package/dist/Components/GradientText/index.d.ts +8 -0
- package/dist/Components/GradientText/index.js +32 -0
- package/dist/Components/GradientText/style.d.ts +5 -0
- package/dist/Components/GradientText/style.js +76 -0
- package/dist/Components/TextAnimate/index.d.ts +56 -0
- package/dist/Components/TextAnimate/index.js +388 -0
- package/dist/Components/TextAnimate/style.d.ts +5 -0
- package/dist/Components/TextAnimate/style.js +53 -0
- package/dist/Components/TypingAnimation/index.d.ts +19 -0
- package/dist/Components/TypingAnimation/index.js +182 -0
- package/dist/Components/TypingAnimation/style.d.ts +5 -0
- package/dist/Components/TypingAnimation/style.js +59 -0
- package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.js +6 -32
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/index.js +5 -3
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.d.ts +2 -2
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +166 -152
- package/dist/MarkdownInputField/FileMapView/index.d.ts +3 -3
- package/dist/MarkdownInputField/FileMapView/index.js +12 -26
- package/dist/MarkdownInputField/FileMapView/style.js +8 -3
- package/dist/MarkdownInputField/MarkdownInputField.js +5 -32
- package/dist/MarkdownInputField/QuickActions/index.js +6 -0
- package/dist/MarkdownInputField/VoiceInput/index.js +2 -1
- package/dist/MarkdownInputField/style.js +3 -9
- package/dist/WelcomeMessage/index.d.ts +12 -2
- package/dist/WelcomeMessage/index.js +40 -4
- package/dist/WelcomeMessage/style.js +1 -0
- package/dist/Workspace/File/FileComponent.js +23 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/package.json +4 -4
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
|
|
21
1
|
// src/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.tsx
|
|
22
2
|
import {
|
|
23
3
|
AudioOutlined,
|
|
@@ -38,13 +18,6 @@ var CONTENT_STYLE = {
|
|
|
38
18
|
lineHeight: "1.5em",
|
|
39
19
|
maxWidth: 275
|
|
40
20
|
};
|
|
41
|
-
var TOOLTIP_CONFIG = {
|
|
42
|
-
arrow: false,
|
|
43
|
-
mouseEnterDelay: 0.3,
|
|
44
|
-
mouseLeaveDelay: 0.1,
|
|
45
|
-
trigger: "hover",
|
|
46
|
-
placement: "topRight"
|
|
47
|
-
};
|
|
48
21
|
var SupportedFileFormats = {
|
|
49
22
|
image: {
|
|
50
23
|
icon: /* @__PURE__ */ React.createElement(FileImageOutlined, null),
|
|
@@ -98,14 +71,15 @@ var AttachmentSupportedFormatsContent = ({ supportedFormat }) => {
|
|
|
98
71
|
return /* @__PURE__ */ React.createElement(FormatContent, { format });
|
|
99
72
|
};
|
|
100
73
|
var AttachmentButtonPopover = ({ children, supportedFormat }) => {
|
|
101
|
-
if (!supportedFormat)
|
|
102
|
-
return null;
|
|
103
74
|
return /* @__PURE__ */ React.createElement(
|
|
104
75
|
Tooltip,
|
|
105
|
-
|
|
76
|
+
{
|
|
77
|
+
arrow: false,
|
|
78
|
+
mouseEnterDelay: 2,
|
|
79
|
+
trigger: ["hover", "click"],
|
|
106
80
|
title: /* @__PURE__ */ React.createElement(AttachmentSupportedFormatsContent, { supportedFormat })
|
|
107
|
-
}
|
|
108
|
-
children
|
|
81
|
+
},
|
|
82
|
+
/* @__PURE__ */ React.createElement("span", null, children)
|
|
109
83
|
);
|
|
110
84
|
};
|
|
111
85
|
var AttachmentButtonPopover_default = AttachmentButtonPopover;
|
|
@@ -90,7 +90,7 @@ var genStyle = (token) => {
|
|
|
90
90
|
background: "var(--color-gray-bg-card-white)",
|
|
91
91
|
boxSizing: "border-box",
|
|
92
92
|
boxShadow: "var(--shadow-control-base)",
|
|
93
|
-
borderRadius: "var(--radius-
|
|
93
|
+
borderRadius: "var(--radius-base)",
|
|
94
94
|
border: "none",
|
|
95
95
|
overflow: "hidden",
|
|
96
96
|
img: {
|
|
@@ -200,7 +200,7 @@ var BUTTON_TITLE_STYLE = {
|
|
|
200
200
|
};
|
|
201
201
|
var ButtonContent = ({ title }) => {
|
|
202
202
|
if (!title)
|
|
203
|
-
return /* @__PURE__ */ React.createElement(Paperclip, null);
|
|
203
|
+
return /* @__PURE__ */ React.createElement("div", { style: BUTTON_WITH_TITLE_STYLE }, /* @__PURE__ */ React.createElement(Paperclip, null));
|
|
204
204
|
return /* @__PURE__ */ React.createElement("div", { style: BUTTON_WITH_TITLE_STYLE }, /* @__PURE__ */ React.createElement(Paperclip, null), /* @__PURE__ */ React.createElement("div", { style: BUTTON_TITLE_STYLE }, title));
|
|
205
205
|
};
|
|
206
206
|
var AttachmentButton = ({ disabled, uploadImage, title, supportedFormat, render }) => {
|
|
@@ -208,13 +208,15 @@ var AttachmentButton = ({ disabled, uploadImage, title, supportedFormat, render
|
|
|
208
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
|
-
const content = /* @__PURE__ */ React.createElement(ButtonContent, { title });
|
|
212
211
|
const handleClick = () => {
|
|
213
212
|
if (disabled)
|
|
214
213
|
return;
|
|
215
214
|
uploadImage == null ? void 0 : uploadImage();
|
|
216
215
|
};
|
|
217
|
-
const wrapper = render ? render({
|
|
216
|
+
const wrapper = render ? render({
|
|
217
|
+
children: /* @__PURE__ */ React.createElement(ButtonContent, { title }),
|
|
218
|
+
supportedFormat: format
|
|
219
|
+
}) : /* @__PURE__ */ React.createElement(AttachmentButtonPopover, { supportedFormat: format }, /* @__PURE__ */ React.createElement(ButtonContent, { title }));
|
|
218
220
|
return wrapSSR(
|
|
219
221
|
/* @__PURE__ */ React.createElement(
|
|
220
222
|
"div",
|
|
@@ -38,8 +38,8 @@ import { AttachmentFile } from '../AttachmentButton/types';
|
|
|
38
38
|
*/
|
|
39
39
|
export declare const FileMapViewItem: React.FC<{
|
|
40
40
|
file: AttachmentFile;
|
|
41
|
-
onPreview
|
|
42
|
-
onDownload
|
|
41
|
+
onPreview?: () => void;
|
|
42
|
+
onDownload?: () => void;
|
|
43
43
|
renderMoreAction?: (file: AttachmentFile) => React.ReactNode;
|
|
44
44
|
customSlot?: React.ReactNode | ((file: AttachmentFile) => React.ReactNode);
|
|
45
45
|
className?: string;
|
|
@@ -1,209 +1,223 @@
|
|
|
1
1
|
// src/MarkdownInputField/FileMapView/FileMapViewItem.tsx
|
|
2
|
-
import {
|
|
3
|
-
import { Download, Eye } from "@sofa-design/icons";
|
|
2
|
+
import { Download, EllipsisVertical, Eye } from "@sofa-design/icons";
|
|
4
3
|
import { Tooltip } from "antd";
|
|
5
4
|
import classNames from "classnames";
|
|
6
5
|
import dayjs from "dayjs";
|
|
7
6
|
import { motion } from "framer-motion";
|
|
8
|
-
import React, { useContext
|
|
7
|
+
import React, { useContext } from "react";
|
|
9
8
|
import { ActionIconBox } from "../../Components/ActionIconBox";
|
|
10
9
|
import { I18nContext } from "../../I18n";
|
|
11
10
|
import { AttachmentFileIcon } from "../AttachmentButton/AttachmentFileList/AttachmentFileIcon";
|
|
12
11
|
import { kbToSize } from "../AttachmentButton/utils";
|
|
13
12
|
var FileMapViewItem = (props) => {
|
|
13
|
+
var _a;
|
|
14
14
|
const file = props.file;
|
|
15
15
|
const { locale } = useContext(I18nContext);
|
|
16
16
|
const [hovered, setHovered] = React.useState(false);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const handleMouseEnter = () => setHovered(true);
|
|
18
|
+
const handleMouseLeave = () => setHovered(false);
|
|
19
|
+
const fileName = (_a = file == null ? void 0 : file.name) != null ? _a : "";
|
|
20
|
+
const lastDotIndex = fileName.lastIndexOf(".");
|
|
21
|
+
const displayName = lastDotIndex > 0 ? fileName.slice(0, lastDotIndex) : fileName;
|
|
22
|
+
const displayExtension = lastDotIndex > 0 && lastDotIndex < fileName.length - 1 ? fileName.slice(lastDotIndex + 1) : "";
|
|
23
|
+
return /* @__PURE__ */ React.createElement(
|
|
24
|
+
Tooltip,
|
|
25
|
+
{
|
|
26
|
+
title: /* @__PURE__ */ React.createElement("div", null, locale == null ? void 0 : locale.clickToPreview),
|
|
27
|
+
placement: "topLeft",
|
|
28
|
+
arrow: false
|
|
29
|
+
},
|
|
30
|
+
/* @__PURE__ */ React.createElement(
|
|
31
|
+
motion.div,
|
|
20
32
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
onMouseEnter: handleMouseEnter,
|
|
34
|
+
onMouseLeave: handleMouseLeave,
|
|
35
|
+
onClick: () => {
|
|
36
|
+
var _a2;
|
|
37
|
+
if (file.status === "error")
|
|
38
|
+
return;
|
|
39
|
+
if (props.onPreview) {
|
|
40
|
+
(_a2 = props.onPreview) == null ? void 0 : _a2.call(props);
|
|
41
|
+
} else {
|
|
42
|
+
if (typeof window === "undefined")
|
|
43
|
+
return;
|
|
44
|
+
window.open(file.previewUrl || file.url, "_blank");
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
variants: {
|
|
48
|
+
hidden: { x: 20, opacity: 0 },
|
|
49
|
+
visible: { x: 0, opacity: 1 },
|
|
50
|
+
exit: { x: -20, opacity: 0 }
|
|
51
|
+
},
|
|
52
|
+
exit: { opacity: 0, x: -20 },
|
|
53
|
+
className: props.className,
|
|
54
|
+
"data-testid": "file-item"
|
|
24
55
|
},
|
|
25
56
|
/* @__PURE__ */ React.createElement(
|
|
26
|
-
|
|
57
|
+
"div",
|
|
27
58
|
{
|
|
28
|
-
|
|
29
|
-
onMouseLeave: () => setHovered(false),
|
|
30
|
-
onClick: () => {
|
|
31
|
-
var _a;
|
|
32
|
-
if (file.status === "error")
|
|
33
|
-
return;
|
|
34
|
-
(_a = props.onPreview) == null ? void 0 : _a.call(props);
|
|
35
|
-
},
|
|
36
|
-
variants: {
|
|
37
|
-
hidden: { x: 20, opacity: 0 },
|
|
38
|
-
visible: { x: 0, opacity: 1 },
|
|
39
|
-
exit: { x: -20, opacity: 0 }
|
|
40
|
-
},
|
|
41
|
-
exit: { opacity: 0, x: -20 },
|
|
42
|
-
className: props.className,
|
|
43
|
-
"data-testid": "file-item"
|
|
59
|
+
className: classNames(`${props.prefixCls}-file-icon`, props.hashId)
|
|
44
60
|
},
|
|
45
61
|
/* @__PURE__ */ React.createElement(
|
|
46
|
-
|
|
62
|
+
AttachmentFileIcon,
|
|
47
63
|
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
60
|
-
|
|
64
|
+
file,
|
|
65
|
+
className: classNames(
|
|
66
|
+
`${props.prefixCls}-file-icon-img`,
|
|
67
|
+
props.hashId
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ React.createElement(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
className: classNames(`${props.prefixCls}-file-info`, props.hashId)
|
|
76
|
+
},
|
|
61
77
|
/* @__PURE__ */ React.createElement(
|
|
62
78
|
"div",
|
|
63
79
|
{
|
|
64
|
-
className: classNames(`${props.prefixCls}-file-
|
|
80
|
+
className: classNames(`${props.prefixCls}-file-name`, props.hashId)
|
|
65
81
|
},
|
|
66
82
|
/* @__PURE__ */ React.createElement(
|
|
67
|
-
"
|
|
83
|
+
"span",
|
|
68
84
|
{
|
|
69
85
|
className: classNames(
|
|
70
|
-
`${props.prefixCls}-file-name`,
|
|
86
|
+
`${props.prefixCls}-file-name-text`,
|
|
71
87
|
props.hashId
|
|
72
|
-
)
|
|
88
|
+
),
|
|
89
|
+
title: file == null ? void 0 : file.name
|
|
73
90
|
},
|
|
74
|
-
|
|
75
|
-
"span",
|
|
76
|
-
{
|
|
77
|
-
className: classNames(
|
|
78
|
-
`${props.prefixCls}-file-name-text`,
|
|
79
|
-
props.hashId
|
|
80
|
-
),
|
|
81
|
-
title: file == null ? void 0 : file.name
|
|
82
|
-
},
|
|
83
|
-
file == null ? void 0 : file.name.split(".").slice(0, -1).join(".")
|
|
84
|
-
)
|
|
85
|
-
),
|
|
86
|
-
/* @__PURE__ */ React.createElement(
|
|
87
|
-
"div",
|
|
88
|
-
{
|
|
89
|
-
className: classNames(
|
|
90
|
-
`${props.prefixCls}-file-name-extension-container`,
|
|
91
|
-
props.hashId
|
|
92
|
-
)
|
|
93
|
-
},
|
|
94
|
-
/* @__PURE__ */ React.createElement(
|
|
95
|
-
"span",
|
|
96
|
-
{
|
|
97
|
-
className: classNames(
|
|
98
|
-
`${props.prefixCls}-file-name-extension`,
|
|
99
|
-
props.hashId
|
|
100
|
-
)
|
|
101
|
-
},
|
|
102
|
-
file == null ? void 0 : file.name.split(".").slice(-1)
|
|
103
|
-
),
|
|
104
|
-
/* @__PURE__ */ React.createElement(
|
|
105
|
-
"span",
|
|
106
|
-
{
|
|
107
|
-
className: classNames(
|
|
108
|
-
`${props.prefixCls}-separator`,
|
|
109
|
-
props.hashId
|
|
110
|
-
)
|
|
111
|
-
},
|
|
112
|
-
"|"
|
|
113
|
-
),
|
|
114
|
-
/* @__PURE__ */ React.createElement(
|
|
115
|
-
"div",
|
|
116
|
-
{
|
|
117
|
-
className: classNames(
|
|
118
|
-
`${props.prefixCls}-file-size`,
|
|
119
|
-
props.hashId
|
|
120
|
-
)
|
|
121
|
-
},
|
|
122
|
-
kbToSize(file.size / 1024)
|
|
123
|
-
),
|
|
124
|
-
/* @__PURE__ */ React.createElement(
|
|
125
|
-
"span",
|
|
126
|
-
{
|
|
127
|
-
className: classNames(
|
|
128
|
-
`${props.prefixCls}-separator`,
|
|
129
|
-
props.hashId
|
|
130
|
-
)
|
|
131
|
-
},
|
|
132
|
-
"|"
|
|
133
|
-
),
|
|
134
|
-
/* @__PURE__ */ React.createElement("div", null, (file == null ? void 0 : file.lastModified) ? dayjs(file == null ? void 0 : file.lastModified).format("HH:mm") : "")
|
|
91
|
+
displayName
|
|
135
92
|
)
|
|
136
93
|
),
|
|
137
|
-
|
|
94
|
+
/* @__PURE__ */ React.createElement(
|
|
138
95
|
"div",
|
|
139
96
|
{
|
|
140
97
|
className: classNames(
|
|
141
|
-
`${props.prefixCls}-
|
|
98
|
+
`${props.prefixCls}-file-name-extension-container`,
|
|
142
99
|
props.hashId
|
|
143
100
|
)
|
|
144
101
|
},
|
|
145
|
-
|
|
146
|
-
|
|
102
|
+
/* @__PURE__ */ React.createElement(
|
|
103
|
+
"span",
|
|
147
104
|
{
|
|
148
|
-
title: "更多",
|
|
149
|
-
onClick: (e) => {
|
|
150
|
-
e.stopPropagation();
|
|
151
|
-
},
|
|
152
105
|
className: classNames(
|
|
153
|
-
`${props.prefixCls}-
|
|
106
|
+
`${props.prefixCls}-file-name-extension`,
|
|
154
107
|
props.hashId
|
|
155
108
|
)
|
|
156
109
|
},
|
|
157
|
-
|
|
158
|
-
)
|
|
159
|
-
|
|
110
|
+
displayExtension
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ React.createElement(
|
|
113
|
+
"span",
|
|
160
114
|
{
|
|
161
|
-
title: (locale == null ? void 0 : locale.preview) || "预览",
|
|
162
|
-
onClick: (e) => {
|
|
163
|
-
var _a;
|
|
164
|
-
e.stopPropagation();
|
|
165
|
-
(_a = props.onPreview) == null ? void 0 : _a.call(props);
|
|
166
|
-
},
|
|
167
115
|
className: classNames(
|
|
168
|
-
`${props.prefixCls}-
|
|
116
|
+
`${props.prefixCls}-separator`,
|
|
169
117
|
props.hashId
|
|
170
118
|
)
|
|
171
119
|
},
|
|
172
|
-
|
|
173
|
-
),
|
|
174
|
-
|
|
120
|
+
"|"
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ React.createElement(
|
|
123
|
+
"div",
|
|
175
124
|
{
|
|
176
|
-
title: (locale == null ? void 0 : locale.download) || "下载",
|
|
177
|
-
onClick: (e) => {
|
|
178
|
-
var _a;
|
|
179
|
-
e.stopPropagation();
|
|
180
|
-
(_a = props.onDownload) == null ? void 0 : _a.call(props);
|
|
181
|
-
},
|
|
182
125
|
className: classNames(
|
|
183
|
-
`${props.prefixCls}-
|
|
126
|
+
`${props.prefixCls}-file-size`,
|
|
184
127
|
props.hashId
|
|
185
128
|
)
|
|
186
129
|
},
|
|
187
|
-
|
|
188
|
-
),
|
|
189
|
-
|
|
130
|
+
kbToSize(file.size / 1024)
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ React.createElement(
|
|
133
|
+
"span",
|
|
190
134
|
{
|
|
191
|
-
title: "更多操作",
|
|
192
|
-
onClick: (e) => {
|
|
193
|
-
e.stopPropagation();
|
|
194
|
-
},
|
|
195
135
|
className: classNames(
|
|
196
|
-
`${props.prefixCls}-
|
|
136
|
+
`${props.prefixCls}-separator`,
|
|
197
137
|
props.hashId
|
|
198
138
|
)
|
|
199
139
|
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
140
|
+
"|"
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ React.createElement("div", null, (file == null ? void 0 : file.lastModified) ? dayjs(file == null ? void 0 : file.lastModified).format("HH:mm") : "")
|
|
143
|
+
)
|
|
144
|
+
),
|
|
145
|
+
hovered ? /* @__PURE__ */ React.createElement(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
className: classNames(
|
|
149
|
+
`${props.prefixCls}-action-bar`,
|
|
150
|
+
props.hashId
|
|
151
|
+
)
|
|
152
|
+
},
|
|
153
|
+
props.customSlot ? /* @__PURE__ */ React.createElement(
|
|
154
|
+
ActionIconBox,
|
|
155
|
+
{
|
|
156
|
+
title: "更多",
|
|
157
|
+
onClick: (e) => {
|
|
158
|
+
e.stopPropagation();
|
|
159
|
+
},
|
|
160
|
+
className: classNames(
|
|
161
|
+
`${props.prefixCls}-action-btn`,
|
|
162
|
+
props.hashId
|
|
163
|
+
)
|
|
164
|
+
},
|
|
165
|
+
typeof props.customSlot === "function" ? props.customSlot(file) : props.customSlot
|
|
166
|
+
) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
167
|
+
ActionIconBox,
|
|
168
|
+
{
|
|
169
|
+
title: (locale == null ? void 0 : locale.preview) || "预览",
|
|
170
|
+
onClick: (e) => {
|
|
171
|
+
var _a2;
|
|
172
|
+
e.stopPropagation();
|
|
173
|
+
if (props.onPreview) {
|
|
174
|
+
(_a2 = props.onPreview) == null ? void 0 : _a2.call(props);
|
|
175
|
+
} else {
|
|
176
|
+
if (typeof window === "undefined")
|
|
177
|
+
return;
|
|
178
|
+
window.open(file.previewUrl || file.url, "_blank");
|
|
204
179
|
}
|
|
180
|
+
},
|
|
181
|
+
className: classNames(
|
|
182
|
+
`${props.prefixCls}-action-btn`,
|
|
183
|
+
props.hashId
|
|
205
184
|
)
|
|
206
|
-
|
|
185
|
+
},
|
|
186
|
+
/* @__PURE__ */ React.createElement(Eye, { color: "var(--color-gray-text-secondary)" })
|
|
187
|
+
), props.onDownload && /* @__PURE__ */ React.createElement(
|
|
188
|
+
ActionIconBox,
|
|
189
|
+
{
|
|
190
|
+
title: (locale == null ? void 0 : locale.download) || "下载",
|
|
191
|
+
onClick: (e) => {
|
|
192
|
+
var _a2;
|
|
193
|
+
e.stopPropagation();
|
|
194
|
+
(_a2 = props.onDownload) == null ? void 0 : _a2.call(props);
|
|
195
|
+
},
|
|
196
|
+
className: classNames(
|
|
197
|
+
`${props.prefixCls}-action-btn`,
|
|
198
|
+
props.hashId
|
|
199
|
+
)
|
|
200
|
+
},
|
|
201
|
+
/* @__PURE__ */ React.createElement(Download, { color: "var(--color-gray-text-secondary)" })
|
|
202
|
+
), props.renderMoreAction && /* @__PURE__ */ React.createElement(
|
|
203
|
+
ActionIconBox,
|
|
204
|
+
{
|
|
205
|
+
title: "更多操作",
|
|
206
|
+
onClick: (e) => {
|
|
207
|
+
e.stopPropagation();
|
|
208
|
+
},
|
|
209
|
+
className: classNames(
|
|
210
|
+
`${props.prefixCls}-action-btn`,
|
|
211
|
+
props.hashId
|
|
212
|
+
)
|
|
213
|
+
},
|
|
214
|
+
/* @__PURE__ */ React.createElement(
|
|
215
|
+
EllipsisVertical,
|
|
216
|
+
{
|
|
217
|
+
style: { color: "var(--color-gray-text-secondary)" }
|
|
218
|
+
}
|
|
219
|
+
),
|
|
220
|
+
/* @__PURE__ */ React.createElement(
|
|
207
221
|
"div",
|
|
208
222
|
{
|
|
209
223
|
className: classNames(
|
|
@@ -212,11 +226,11 @@ var FileMapViewItem = (props) => {
|
|
|
212
226
|
)
|
|
213
227
|
},
|
|
214
228
|
props.renderMoreAction(file)
|
|
215
|
-
)
|
|
216
|
-
)
|
|
217
|
-
)
|
|
218
|
-
)
|
|
219
|
-
|
|
229
|
+
)
|
|
230
|
+
))
|
|
231
|
+
) : null
|
|
232
|
+
)
|
|
233
|
+
);
|
|
220
234
|
};
|
|
221
235
|
export {
|
|
222
236
|
FileMapViewItem
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AttachmentFile } from '../AttachmentButton/types';
|
|
3
3
|
export type FileMapViewProps = {
|
|
4
|
+
/** 是否显示"查看更多"按钮 */
|
|
5
|
+
showMoreButton?: boolean;
|
|
4
6
|
/** 文件映射表 */
|
|
5
7
|
fileMap?: Map<string, AttachmentFile>;
|
|
6
8
|
/** 预览文件回调 */
|
|
@@ -17,10 +19,8 @@ export type FileMapViewProps = {
|
|
|
17
19
|
style?: React.CSSProperties;
|
|
18
20
|
/** 自定义根容器类名 */
|
|
19
21
|
className?: string;
|
|
20
|
-
/** 最多展示的非图片文件数量,传入则开启溢出控制并在超出时显示"查看所有文件"
|
|
22
|
+
/** 最多展示的非图片文件数量,传入则开启溢出控制并在超出时显示"查看所有文件"按钮,不传则展示所有文件且不显示按钮 */
|
|
21
23
|
maxDisplayCount?: number;
|
|
22
|
-
/** 是否显示"查看全部"按钮,当为 false 时忽略 maxDisplayCount 限制,显示所有文件 */
|
|
23
|
-
showMoreButton?: boolean;
|
|
24
24
|
placement?: 'left' | 'right';
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
@@ -8,12 +8,11 @@ import { isImageFile } from "../AttachmentButton/utils";
|
|
|
8
8
|
import { FileMapViewItem } from "./FileMapViewItem";
|
|
9
9
|
import { useStyle } from "./style";
|
|
10
10
|
var FileMapView = (props) => {
|
|
11
|
-
var _a
|
|
11
|
+
var _a;
|
|
12
12
|
const { placement = "left", showMoreButton = true } = props;
|
|
13
13
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
14
14
|
const prefix = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-file-view-list");
|
|
15
15
|
const { wrapSSR, hashId } = useStyle(prefix);
|
|
16
|
-
const maxDisplayCount = (_a = props.maxDisplayCount) != null ? _a : 3;
|
|
17
16
|
const fileList = useMemo(() => {
|
|
18
17
|
var _a2;
|
|
19
18
|
if (!props.fileMap) {
|
|
@@ -21,25 +20,18 @@ var FileMapView = (props) => {
|
|
|
21
20
|
}
|
|
22
21
|
return Array.from(((_a2 = props.fileMap) == null ? void 0 : _a2.values()) || []);
|
|
23
22
|
}, [props.fileMap]);
|
|
24
|
-
const
|
|
23
|
+
const imgList = useMemo(() => {
|
|
25
24
|
return fileList.filter((file) => isImageFile(file));
|
|
26
25
|
}, [fileList]);
|
|
27
26
|
const allNoImageFiles = useMemo(() => {
|
|
28
27
|
return fileList.filter((file) => !isImageFile(file));
|
|
29
28
|
}, [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
29
|
const noImageFileList = useMemo(() => {
|
|
37
|
-
if (
|
|
30
|
+
if (props.maxDisplayCount === void 0) {
|
|
38
31
|
return allNoImageFiles;
|
|
39
32
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, [allNoImageFiles, maxDisplayCount, imgList.length, showMoreButton]);
|
|
33
|
+
return allNoImageFiles.slice(0, Math.max(0, props.maxDisplayCount));
|
|
34
|
+
}, [allNoImageFiles, props.maxDisplayCount]);
|
|
43
35
|
return wrapSSR(
|
|
44
36
|
/* @__PURE__ */ React.createElement(
|
|
45
37
|
"div",
|
|
@@ -138,20 +130,14 @@ var FileMapView = (props) => {
|
|
|
138
130
|
FileMapViewItem,
|
|
139
131
|
{
|
|
140
132
|
style: { width: (_a2 = props.style) == null ? void 0 : _a2.width },
|
|
141
|
-
onPreview: () => {
|
|
133
|
+
onPreview: props.onPreview ? () => {
|
|
142
134
|
var _a3;
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
if (typeof window === "undefined")
|
|
148
|
-
return;
|
|
149
|
-
window.open(file.previewUrl || file.url, "_blank");
|
|
150
|
-
},
|
|
151
|
-
onDownload: () => {
|
|
135
|
+
(_a3 = props.onPreview) == null ? void 0 : _a3.call(props, file);
|
|
136
|
+
} : void 0,
|
|
137
|
+
onDownload: props.onDownload ? () => {
|
|
152
138
|
var _a3;
|
|
153
139
|
(_a3 = props.onDownload) == null ? void 0 : _a3.call(props, file);
|
|
154
|
-
},
|
|
140
|
+
} : void 0,
|
|
155
141
|
renderMoreAction: props.renderMoreAction,
|
|
156
142
|
customSlot: props.customSlot,
|
|
157
143
|
key: (file == null ? void 0 : file.uuid) || (file == null ? void 0 : file.name) || index,
|
|
@@ -162,10 +148,10 @@ var FileMapView = (props) => {
|
|
|
162
148
|
}
|
|
163
149
|
);
|
|
164
150
|
}),
|
|
165
|
-
showMoreButton && maxDisplayCount !== void 0 &&
|
|
151
|
+
showMoreButton && props.maxDisplayCount !== void 0 && allNoImageFiles.length > props.maxDisplayCount ? /* @__PURE__ */ React.createElement(
|
|
166
152
|
"div",
|
|
167
153
|
{
|
|
168
|
-
style: { width: (
|
|
154
|
+
style: { width: (_a = props.style) == null ? void 0 : _a.width },
|
|
169
155
|
className: classNames(hashId, `${prefix}-more-file-container`),
|
|
170
156
|
onClick: () => {
|
|
171
157
|
var _a2;
|
|
@@ -199,7 +199,7 @@ var genStyle = (token) => {
|
|
|
199
199
|
background: "var(--color-gray-bg-card-white)",
|
|
200
200
|
boxSizing: "border-box",
|
|
201
201
|
boxShadow: "var(--shadow-control-base)",
|
|
202
|
-
borderRadius: "var(--radius-
|
|
202
|
+
borderRadius: "var(--radius-base)",
|
|
203
203
|
border: "none",
|
|
204
204
|
overflow: "hidden",
|
|
205
205
|
img: {
|
|
@@ -235,15 +235,20 @@ var genStyle = (token) => {
|
|
|
235
235
|
lineHeight: "18px",
|
|
236
236
|
fontFamily: token.fontFamily,
|
|
237
237
|
gap: -1,
|
|
238
|
+
display: "flex",
|
|
239
|
+
overflow: "hidden",
|
|
238
240
|
"&-text": {
|
|
239
241
|
maxWidth: "160px",
|
|
240
|
-
whiteSpace: "nowrap",
|
|
242
|
+
whiteSpace: "nowrap !important",
|
|
243
|
+
wordWrap: "normal",
|
|
244
|
+
wordBreak: "keep-all",
|
|
241
245
|
width: "100%",
|
|
242
246
|
overflow: "hidden",
|
|
243
247
|
display: "inline-block",
|
|
244
248
|
textOverflow: "ellipsis",
|
|
245
249
|
height: 18,
|
|
246
|
-
lineHeight: 1
|
|
250
|
+
lineHeight: 1,
|
|
251
|
+
verticalAlign: "top"
|
|
247
252
|
}
|
|
248
253
|
},
|
|
249
254
|
"&-file-name-extension-container": {
|