@ant-design/agentic-ui 2.0.18 → 2.0.21

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.
Files changed (43) hide show
  1. package/dist/Bubble/FileView.js +4 -3
  2. package/dist/Bubble/type.d.ts +2 -2
  3. package/dist/ChatBootPage/ButtonTabStyle.js +2 -2
  4. package/dist/ChatBootPage/CaseReply.d.ts +10 -2
  5. package/dist/ChatBootPage/CaseReply.js +20 -2
  6. package/dist/ChatBootPage/CaseReplyStyle.js +51 -9
  7. package/dist/Components/ActionIconBox/index.js +102 -46
  8. package/dist/Components/Button/ToggleButton/index.js +3 -3
  9. package/dist/Components/Button/ToggleButton/style.js +1 -1
  10. package/dist/Components/GradientText/index.d.ts +8 -0
  11. package/dist/Components/GradientText/index.js +32 -0
  12. package/dist/Components/GradientText/style.d.ts +5 -0
  13. package/dist/Components/GradientText/style.js +76 -0
  14. package/dist/Components/TextAnimate/index.d.ts +56 -0
  15. package/dist/Components/TextAnimate/index.js +388 -0
  16. package/dist/Components/TextAnimate/style.d.ts +5 -0
  17. package/dist/Components/TextAnimate/style.js +53 -0
  18. package/dist/Components/TypingAnimation/index.d.ts +19 -0
  19. package/dist/Components/TypingAnimation/index.js +182 -0
  20. package/dist/Components/TypingAnimation/style.d.ts +5 -0
  21. package/dist/Components/TypingAnimation/style.js +59 -0
  22. package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +1 -1
  23. package/dist/MarkdownEditor/editor/plugins/withMarkdown.js +42 -0
  24. package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.js +6 -32
  25. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +1 -1
  26. package/dist/MarkdownInputField/AttachmentButton/index.js +5 -3
  27. package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +1 -1
  28. package/dist/MarkdownInputField/FileMapView/FileMapViewItem.d.ts +2 -2
  29. package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +166 -152
  30. package/dist/MarkdownInputField/FileMapView/index.d.ts +5 -5
  31. package/dist/MarkdownInputField/FileMapView/index.js +48 -35
  32. package/dist/MarkdownInputField/FileMapView/style.js +17 -9
  33. package/dist/MarkdownInputField/MarkdownInputField.js +159 -209
  34. package/dist/MarkdownInputField/QuickActions/index.js +6 -0
  35. package/dist/MarkdownInputField/VoiceInput/index.js +2 -1
  36. package/dist/MarkdownInputField/style.js +4 -55
  37. package/dist/WelcomeMessage/index.d.ts +12 -2
  38. package/dist/WelcomeMessage/index.js +40 -4
  39. package/dist/WelcomeMessage/style.js +1 -0
  40. package/dist/Workspace/File/FileComponent.js +23 -1
  41. package/dist/index.d.ts +4 -1
  42. package/dist/index.js +4 -1
  43. package/package.json +4 -4
@@ -124,7 +124,7 @@ var createDefaultDom = (domRef, baseCls, hashId, loading, selectedItems, childre
124
124
  onMouseEnter: () => handleMouseEnter(domRef),
125
125
  onMouseLeave: () => handleMouseLeave(domRef),
126
126
  title: placeholder,
127
- contentEditable: !hasItems
127
+ contentEditable: !hasItems ? void 0 : false
128
128
  },
129
129
  children,
130
130
  hasItems && /* @__PURE__ */ React.createElement(
@@ -1,3 +1,23 @@
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
+
1
21
  // src/MarkdownEditor/editor/plugins/withMarkdown.ts
2
22
  import { Editor, Node, Path, Range, Transforms } from "slate";
3
23
  import { ReactEditor } from "slate-react";
@@ -206,6 +226,17 @@ var handleCodeTagOperation = (editor, operation, apply) => {
206
226
  });
207
227
  return true;
208
228
  }
229
+ if (currentNode.text === operation.text) {
230
+ Editor.withoutNormalizing(editor, () => {
231
+ Transforms.removeNodes(editor, { at: operation.path });
232
+ Transforms.insertNodes(
233
+ editor,
234
+ __spreadProps(__spreadValues({}, currentNode), { tag: true, code: true, text: " " }),
235
+ { at: operation.path, select: true }
236
+ );
237
+ });
238
+ return true;
239
+ }
209
240
  apply(operation);
210
241
  return true;
211
242
  }
@@ -219,6 +250,17 @@ var handleCodeTagOperation = (editor, operation, apply) => {
219
250
  return true;
220
251
  }
221
252
  }
253
+ if ((currentNode == null ? void 0 : currentNode.tag) && operation.text.trim().length > 0 && currentNode.text.trim().length === 0) {
254
+ Editor.withoutNormalizing(editor, () => {
255
+ Transforms.removeNodes(editor, { at: operation.path });
256
+ Transforms.insertNodes(
257
+ editor,
258
+ __spreadProps(__spreadValues({}, currentNode), { tag: true, code: true, text: operation.text }),
259
+ { at: operation.path, select: true }
260
+ );
261
+ });
262
+ return true;
263
+ }
222
264
  }
223
265
  if (operation.type === "split_node") {
224
266
  const node = Node.get(editor, operation.path);
@@ -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
- __spreadProps(__spreadValues({}, TOOLTIP_CONFIG), {
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-card-base)",
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({ children: content, supportedFormat: format }) : /* @__PURE__ */ React.createElement(AttachmentButtonPopover, { supportedFormat: format }, content);
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",
@@ -372,7 +372,7 @@ var ActionItemContainer = (props) => {
372
372
  trigger: "click",
373
373
  placement: "topRight",
374
374
  arrow: false,
375
- overlayInnerStyle: POPOVER_OVERLAY_STYLE,
375
+ styles: { body: POPOVER_OVERLAY_STYLE },
376
376
  overlayClassName: classNames(
377
377
  `${basePrefixCls}-overflow-popover`,
378
378
  hashId
@@ -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: () => void;
42
- onDownload: () => void;
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 { EllipsisOutlined } from "@ant-design/icons";
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, useMemo } from "react";
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
- return useMemo(() => {
18
- return /* @__PURE__ */ React.createElement(
19
- Tooltip,
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
- title: /* @__PURE__ */ React.createElement("div", null, locale == null ? void 0 : locale.clickToPreview),
22
- placement: "topLeft",
23
- arrow: false
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
- motion.div,
57
+ "div",
27
58
  {
28
- onMouseEnter: () => setHovered(true),
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
- "div",
62
+ AttachmentFileIcon,
47
63
  {
48
- className: classNames(`${props.prefixCls}-file-icon`, props.hashId)
49
- },
50
- /* @__PURE__ */ React.createElement(
51
- AttachmentFileIcon,
52
- {
53
- file,
54
- className: classNames(
55
- `${props.prefixCls}-file-icon-img`,
56
- props.hashId
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-info`, props.hashId)
80
+ className: classNames(`${props.prefixCls}-file-name`, props.hashId)
65
81
  },
66
82
  /* @__PURE__ */ React.createElement(
67
- "div",
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
- /* @__PURE__ */ React.createElement(
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
- hovered ? /* @__PURE__ */ React.createElement(
94
+ /* @__PURE__ */ React.createElement(
138
95
  "div",
139
96
  {
140
97
  className: classNames(
141
- `${props.prefixCls}-action-bar`,
98
+ `${props.prefixCls}-file-name-extension-container`,
142
99
  props.hashId
143
100
  )
144
101
  },
145
- props.customSlot ? /* @__PURE__ */ React.createElement(
146
- ActionIconBox,
102
+ /* @__PURE__ */ React.createElement(
103
+ "span",
147
104
  {
148
- title: "更多",
149
- onClick: (e) => {
150
- e.stopPropagation();
151
- },
152
105
  className: classNames(
153
- `${props.prefixCls}-action-btn`,
106
+ `${props.prefixCls}-file-name-extension`,
154
107
  props.hashId
155
108
  )
156
109
  },
157
- typeof props.customSlot === "function" ? props.customSlot(file) : props.customSlot
158
- ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
159
- ActionIconBox,
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}-action-btn`,
116
+ `${props.prefixCls}-separator`,
169
117
  props.hashId
170
118
  )
171
119
  },
172
- /* @__PURE__ */ React.createElement(Eye, { color: "var(--color-gray-text-secondary)" })
173
- ), /* @__PURE__ */ React.createElement(
174
- ActionIconBox,
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}-action-btn`,
126
+ `${props.prefixCls}-file-size`,
184
127
  props.hashId
185
128
  )
186
129
  },
187
- /* @__PURE__ */ React.createElement(Download, { color: "var(--color-gray-text-secondary)" })
188
- ), props.renderMoreAction ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
189
- ActionIconBox,
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}-action-btn`,
136
+ `${props.prefixCls}-separator`,
197
137
  props.hashId
198
138
  )
199
139
  },
200
- /* @__PURE__ */ React.createElement(
201
- EllipsisOutlined,
202
- {
203
- style: { color: "var(--color-gray-text-secondary)" }
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
- ), props.renderMoreAction ? /* @__PURE__ */ React.createElement(
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
- ) : null) : null)
216
- ) : null
217
- )
218
- );
219
- }, [file, file.status, hovered, props.onPreview, props.onDownload]);
229
+ )
230
+ ))
231
+ ) : null
232
+ )
233
+ );
220
234
  };
221
235
  export {
222
236
  FileMapViewItem
@@ -1,14 +1,16 @@
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
  /** 预览文件回调 */
7
9
  onPreview?: (file: AttachmentFile) => void;
8
10
  /** 下载文件回调 */
9
11
  onDownload?: (file: AttachmentFile) => void;
10
- /** 点击"查看所有文件"回调,携带当前所有文件列表 */
11
- onViewAll?: (files: AttachmentFile[]) => void;
12
+ /** 点击"查看所有文件"回调,携带当前所有文件列表。返回 true 时组件内部展开所有文件,返回 false 时由外部处理 */
13
+ onViewAll?: (files: AttachmentFile[]) => boolean | Promise<boolean>;
12
14
  /** 自定义更多操作 DOM(优先于 onMore,传入则展示该 DOM,不传则不展示更多按钮) */
13
15
  renderMoreAction?: (file: AttachmentFile) => React.ReactNode;
14
16
  /** 自定义悬浮动作区 slot(传入则覆盖默认『预览/下载/更多』动作区) */
@@ -17,10 +19,8 @@ export type FileMapViewProps = {
17
19
  style?: React.CSSProperties;
18
20
  /** 自定义根容器类名 */
19
21
  className?: string;
20
- /** 最多展示的非图片文件数量,传入则开启溢出控制并在超出时显示"查看所有文件"按钮,不传则使用默认值3 */
22
+ /** 最多展示的非图片文件数量,传入则开启溢出控制并在超出时显示"查看所有文件"按钮,不传则展示所有文件且不显示按钮 */
21
23
  maxDisplayCount?: number;
22
- /** 是否显示"查看全部"按钮,当为 false 时忽略 maxDisplayCount 限制,显示所有文件 */
23
- showMoreButton?: boolean;
24
24
  placement?: 'left' | 'right';
25
25
  };
26
26
  /**