@ant-design/agentic-ui 2.0.15 → 2.0.17

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 (58) hide show
  1. package/dist/Bubble/AIBubble.js +3 -0
  2. package/dist/Bubble/MessagesContent/MarkdownPreview.js +3 -1
  3. package/dist/Bubble/style.js +4 -1
  4. package/dist/Components/Loading/index.d.ts +2 -1
  5. package/dist/Components/Loading/index.js +3 -161
  6. package/dist/Components/lotties/LoadingLottie/index.d.ts +65 -0
  7. package/dist/Components/lotties/LoadingLottie/index.js +53 -0
  8. package/dist/Components/lotties/LoadingLottie/loading.json +1 -0
  9. package/dist/History/index.js +7 -2
  10. package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +11 -8
  11. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +16 -12
  12. package/dist/MarkdownEditor/editor/utils/dom.d.ts +1 -1
  13. package/dist/MarkdownEditor/editor/utils/index.d.ts +1 -1
  14. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +1 -1
  15. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +9 -8
  16. package/dist/MarkdownInputField/AttachmentButton/index.d.ts +2 -0
  17. package/dist/MarkdownInputField/AttachmentButton/style.js +3 -3
  18. package/dist/MarkdownInputField/Enlargement/index.js +9 -29
  19. package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +30 -27
  20. package/dist/MarkdownInputField/FileMapView/index.d.ts +4 -4
  21. package/dist/MarkdownInputField/FileMapView/index.js +20 -13
  22. package/dist/MarkdownInputField/FileUploadManager/index.js +2 -2
  23. package/dist/MarkdownInputField/MarkdownInputField.d.ts +9 -19
  24. package/dist/MarkdownInputField/MarkdownInputField.js +218 -250
  25. package/dist/MarkdownInputField/RefinePromptButton/index.js +8 -53
  26. package/dist/MarkdownInputField/style.js +54 -47
  27. package/dist/Plugins/chart/AreaChart/index.d.ts +2 -2
  28. package/dist/Plugins/chart/AreaChart/index.js +9 -29
  29. package/dist/Plugins/chart/BarChart/index.d.ts +8 -8
  30. package/dist/Plugins/chart/BarChart/index.js +9 -8
  31. package/dist/Plugins/chart/DonutChart/constants.d.ts +0 -1
  32. package/dist/Plugins/chart/DonutChart/constants.js +0 -14
  33. package/dist/Plugins/chart/DonutChart/index.js +51 -16
  34. package/dist/Plugins/chart/DonutChart/style.js +7 -0
  35. package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
  36. package/dist/Plugins/chart/FunnelChart/index.d.ts +8 -8
  37. package/dist/Plugins/chart/FunnelChart/index.js +85 -66
  38. package/dist/Plugins/chart/FunnelChart/style.js +12 -0
  39. package/dist/Plugins/chart/LineChart/index.d.ts +2 -2
  40. package/dist/Plugins/chart/LineChart/index.js +16 -19
  41. package/dist/Plugins/chart/RadarChart/index.d.ts +11 -5
  42. package/dist/Plugins/chart/RadarChart/index.js +35 -50
  43. package/dist/Plugins/chart/RadarChart/style.js +8 -0
  44. package/dist/Plugins/chart/ScatterChart/index.d.ts +23 -6
  45. package/dist/Plugins/chart/ScatterChart/index.js +58 -57
  46. package/dist/Plugins/chart/ScatterChart/style.js +8 -0
  47. package/dist/Plugins/chart/components/ChartContainer/style.js +7 -1
  48. package/dist/Plugins/chart/hooks/useChartStatistic.d.ts +0 -6
  49. package/dist/Plugins/chart/hooks/useChartStatistic.js +0 -16
  50. package/dist/Workspace/File/PreviewComponent.js +3 -2
  51. package/dist/Workspace/File/style.js +2 -1
  52. package/dist/Workspace/RealtimeFollow/style.js +1 -6
  53. package/dist/Workspace/style.js +2 -1
  54. package/package.json +1 -1
  55. package/dist/Components/Loading/style.d.ts +0 -5
  56. package/dist/Components/Loading/style.js +0 -46
  57. package/dist/MarkdownInputField/Enlargement/style.d.ts +0 -10
  58. package/dist/MarkdownInputField/Enlargement/style.js +0 -75
@@ -22,6 +22,7 @@ var __async = (__this, __arguments, generator) => {
22
22
  // src/History/index.tsx
23
23
  import { History as HistoryIcon } from "@sofa-design/icons";
24
24
  import { ConfigProvider, Popover } from "antd";
25
+ import classNames from "classnames";
25
26
  import React, { useContext, useRef } from "react";
26
27
  import useClickAway from "../Hooks/useClickAway";
27
28
  import { ActionIconBox, BubbleConfigContext } from "../index";
@@ -125,7 +126,9 @@ var History = (props) => {
125
126
  {
126
127
  onLoadMore: handleLoadMore,
127
128
  type: props.type,
128
- className: `${menuPrefixCls}-load-more ${props.type === "task" ? "" : "chat"} ${hashId}`
129
+ className: classNames(`${menuPrefixCls}-load-more`, hashId, {
130
+ chat: props.type !== "task"
131
+ })
129
132
  }
130
133
  ))
131
134
  )
@@ -160,7 +163,9 @@ var History = (props) => {
160
163
  {
161
164
  onLoadMore: handleLoadMore,
162
165
  type: props.type,
163
- className: `${menuPrefixCls}-load-more ${hashId} ${props.type === "task" ? "" : "chat"}`
166
+ className: classNames(`${menuPrefixCls}-load-more`, hashId, {
167
+ chat: props.type !== "task"
168
+ })
164
169
  }
165
170
  ))
166
171
  },
@@ -123,7 +123,8 @@ var createDefaultDom = (domRef, baseCls, hashId, loading, selectedItems, childre
123
123
  }),
124
124
  onMouseEnter: () => handleMouseEnter(domRef),
125
125
  onMouseLeave: () => handleMouseLeave(domRef),
126
- title: placeholder
126
+ title: placeholder,
127
+ contentEditable: !hasItems
127
128
  },
128
129
  children,
129
130
  hasItems && /* @__PURE__ */ React.createElement(
@@ -143,7 +144,7 @@ var getRenderDom = (tagRender, props, defaultDom, onSelect, currentNodePath) =>
143
144
  __spreadProps(__spreadValues({}, props), {
144
145
  text: props.text,
145
146
  onSelect: (value, tagNode) => {
146
- onSelect == null ? void 0 : onSelect(value, currentNodePath.current || [], tagNode);
147
+ onSelect == null ? void 0 : onSelect((value == null ? void 0 : value.trim()) || "", currentNodePath.current || [], tagNode);
147
148
  }
148
149
  }),
149
150
  defaultDom
@@ -159,7 +160,7 @@ var handlePanelClick = (suggestionConnext, props, onSelect, currentNodePath) =>
159
160
  if (suggestionConnext == null ? void 0 : suggestionConnext.onSelectRef) {
160
161
  suggestionConnext.onSelectRef.current = (newValue) => {
161
162
  var _a2;
162
- onSelect == null ? void 0 : onSelect(newValue, currentNodePath.current || []);
163
+ onSelect == null ? void 0 : onSelect((newValue == null ? void 0 : newValue.trim()) || "", currentNodePath.current || []);
163
164
  (_a2 = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _a2.call(suggestionConnext, false);
164
165
  };
165
166
  }
@@ -190,7 +191,9 @@ var TagPopup = (props) => {
190
191
  const domRef = useRef(null);
191
192
  const suggestionConnext = useContext(SuggestionConnext);
192
193
  const antdContext = useContext(ConfigProvider.ConfigContext);
193
- const baseCls = antdContext == null ? void 0 : antdContext.getPrefixCls("agentic-md-editor-tag-popup-input");
194
+ const baseCls = antdContext == null ? void 0 : antdContext.getPrefixCls(
195
+ "agentic-md-editor-tag-popup-input"
196
+ );
194
197
  const { wrapSSR, hashId } = useStyle(baseCls);
195
198
  const currentNodePath = useRef();
196
199
  useEffect(() => {
@@ -220,7 +223,7 @@ var TagPopup = (props) => {
220
223
  (_a = props.onChange) == null ? void 0 : _a.call(props, props.text || "", __spreadProps(__spreadValues({}, props), {
221
224
  text: props.text,
222
225
  onSelect: (value) => {
223
- onSelect == null ? void 0 : onSelect(value, currentNodePath.current || []);
226
+ onSelect == null ? void 0 : onSelect((value == null ? void 0 : value.trim()) || "", currentNodePath.current || []);
224
227
  }
225
228
  }));
226
229
  }, [props.text, suggestionConnext.open]);
@@ -280,9 +283,9 @@ var TagPopup = (props) => {
280
283
  menu: {
281
284
  items: selectedItems,
282
285
  onClick: (e) => {
283
- var _a;
284
- onSelect == null ? void 0 : onSelect(e.key, currentNodePath.current || []);
285
- (_a = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _a.call(suggestionConnext, false);
286
+ var _a, _b;
287
+ onSelect == null ? void 0 : onSelect(((_a = e.key) == null ? void 0 : _a.trim()) || "", currentNodePath.current || []);
288
+ (_b = suggestionConnext == null ? void 0 : suggestionConnext.setOpen) == null ? void 0 : _b.call(suggestionConnext, false);
286
289
  }
287
290
  }
288
291
  },
@@ -148,7 +148,7 @@ var findImageElement = (str) => {
148
148
  const muted = str.match(/muted/);
149
149
  const poster = str.match(/poster="([^"\n]+)"/);
150
150
  return {
151
- url: decodeURIComponent(videoWithSourceMatch[1]),
151
+ url: videoWithSourceMatch[1],
152
152
  height: height ? +height[1] : void 0,
153
153
  width: width ? +width[1] : void 0,
154
154
  align: align == null ? void 0 : align[1],
@@ -522,17 +522,21 @@ var processInlineHtml = (currentElement, htmlTag) => {
522
522
  } else if (mediaElement.tagName === "iframe") {
523
523
  mediaType = "iframe";
524
524
  }
525
- return EditorUtils.createMediaNode(mediaElement == null ? void 0 : mediaElement.url, mediaType, {
526
- align: mediaElement.align,
527
- alt: mediaElement.alt,
528
- height: mediaElement == null ? void 0 : mediaElement.height,
529
- width: mediaElement == null ? void 0 : mediaElement.width,
530
- controls: mediaElement == null ? void 0 : mediaElement.controls,
531
- autoplay: mediaElement == null ? void 0 : mediaElement.autoplay,
532
- loop: mediaElement == null ? void 0 : mediaElement.loop,
533
- muted: mediaElement == null ? void 0 : mediaElement.muted,
534
- poster: mediaElement == null ? void 0 : mediaElement.poster
535
- });
525
+ return EditorUtils.createMediaNode(
526
+ decodeURIComponentUrl((mediaElement == null ? void 0 : mediaElement.url) || ""),
527
+ mediaType,
528
+ {
529
+ align: mediaElement.align,
530
+ alt: mediaElement.alt,
531
+ height: mediaElement == null ? void 0 : mediaElement.height,
532
+ width: mediaElement == null ? void 0 : mediaElement.width,
533
+ controls: mediaElement == null ? void 0 : mediaElement.controls,
534
+ autoplay: mediaElement == null ? void 0 : mediaElement.autoplay,
535
+ loop: mediaElement == null ? void 0 : mediaElement.loop,
536
+ muted: mediaElement == null ? void 0 : mediaElement.muted,
537
+ poster: mediaElement == null ? void 0 : mediaElement.poster
538
+ }
539
+ );
536
540
  } else {
537
541
  return { text: currentElement.value };
538
542
  }
@@ -25,7 +25,7 @@ export declare const slugify: (str: string) => string;
25
25
  * @param name - The name of the file.
26
26
  * @returns The media type of the file.
27
27
  */
28
- export declare const getMediaType: (name?: string, alt?: string) => "document" | "image" | "audio" | "video" | "markdown" | "other" | "attachment";
28
+ export declare const getMediaType: (name?: string, alt?: string) => "document" | "image" | "other" | "audio" | "video" | "markdown" | "attachment";
29
29
  /**
30
30
  * Retrieves the bounding rectangle of the current selection.
31
31
  * @returns The bounding rectangle of the selection, or null if no selection exists.
@@ -13,7 +13,7 @@ type ModalEvent<K extends keyof HookAPI> = {
13
13
  type: K;
14
14
  params: Parameters<HookAPI[K]>[0];
15
15
  };
16
- export declare const modal$: Subject<ModalEvent<"info" | "error" | "warning" | "confirm" | "success">>;
16
+ export declare const modal$: Subject<ModalEvent<"warning" | "info" | "error" | "success" | "confirm">>;
17
17
  export declare const encodeHtml: (str: string) => string;
18
18
  export { isMarkdown } from './isMarkdown';
19
19
  export declare function debounce(func: {
@@ -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 || void 0 }, /* @__PURE__ */ React.createElement(
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,
@@ -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-2x)",
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: "112px",
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: "102px",
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: -6,
175
+ top: 2,
175
176
  borderRadius: "50%",
176
- right: -6,
177
+ right: 2,
177
178
  color: "var(--color-gray-contrast)",
178
179
  display: "none",
179
180
  justifyContent: "center",
@@ -36,6 +36,8 @@ export type AttachmentButtonProps = {
36
36
  maxFileCount?: number;
37
37
  /** 最小文件数量 */
38
38
  minFileCount?: number;
39
+ /** 是否允许一次选择多个文件(默认:true) */
40
+ allowMultiple?: boolean;
39
41
  };
40
42
  /**
41
43
  * 文件上传配置
@@ -69,7 +69,7 @@ var genStyle = (token) => {
69
69
  display: "flex",
70
70
  width: "112px",
71
71
  "&-text": {
72
- maxWidth: "92px",
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: -6,
95
+ top: 2,
96
96
  borderRadius: "50%",
97
- right: -6,
97
+ right: 2,
98
98
  color: "#FFFFFF",
99
99
  display: "flex",
100
100
  justifyContent: "center",
@@ -1,38 +1,18 @@
1
1
  // src/MarkdownInputField/Enlargement/index.tsx
2
2
  import { ExpandAlt, FoldAlt } from "@sofa-design/icons";
3
- import { ConfigProvider } from "antd";
4
- import classNames from "classnames";
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
- const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
12
- const baseCls = getPrefixCls("agentic-md-enlargement");
13
- const { wrapSSR, hashId } = useStyle(baseCls);
14
- return wrapSSR(
15
- /* @__PURE__ */ React.createElement("div", { className: classNames(baseCls, hashId) }, /* @__PURE__ */ React.createElement(
16
- "div",
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 { Download, EllipsisVertical, Eye } from "@sofa-design/icons";
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
- "div",
146
+ ActionIconBox,
145
147
  {
146
- onClick: (e) => e.stopPropagation(),
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
- "div",
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
- "div",
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
- "div",
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(EllipsisVertical, { color: "var(--color-gray-text-secondary)" }),
202
- props.renderMoreAction ? /* @__PURE__ */ React.createElement(
203
- "div",
200
+ /* @__PURE__ */ React.createElement(
201
+ EllipsisOutlined,
204
202
  {
205
- className: classNames(
206
- `${props.prefixCls}-more-custom`,
207
- props.hashId
208
- )
209
- },
210
- props.renderMoreAction(file)
211
- ) : null
212
- ) : null)
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
- /** 最多展示的文件数量,默认展示 3 */
20
+ /** 最多展示的非图片文件数量,传入则开启溢出控制并在超出时显示"查看所有文件"按钮,不传则使用默认值3 */
21
21
  maxDisplayCount?: number;
22
- placement?: 'left' | 'right';
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
14
  const prefix = context == null ? void 0 : context.getPrefixCls("agentic-md-editor-file-view-list");
15
15
  const { wrapSSR, hashId } = useStyle(prefix);
16
- const maxCount = (_a = props.maxDisplayCount) != null ? _a : 3;
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 limitedFiles = useMemo(() => {
25
- if (props.showMoreButton === false) {
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 noImageFileList = useMemo(() => {
34
- return limitedFiles.filter((file) => !isImageFile(file));
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",
@@ -155,7 +162,7 @@ var FileMapView = (props) => {
155
162
  }
156
163
  );
157
164
  }),
158
- props.showMoreButton !== false && fileList.length > maxCount ? /* @__PURE__ */ React.createElement(
165
+ showMoreButton && maxDisplayCount !== void 0 && fileList.length > maxDisplayCount ? /* @__PURE__ */ React.createElement(
159
166
  "div",
160
167
  {
161
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 = false;
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
- * const containerRef = useRef<HTMLDivElement>(null);
229
- * <MarkdownInputField
230
- * enlargeTargetRef={containerRef}
231
- * />
217
+ * <MarkdownInputField enlargeable={{ enable: true }} />
232
218
  * ```
233
219
  */
234
- enlargeTargetRef?: React.RefObject<HTMLElement>;
220
+ enlargeable?: {
221
+ enable?: boolean;
222
+ /** 放大状态下的目标高度(px),默认 980 */
223
+ height?: number;
224
+ };
235
225
  /**
236
226
  * Markdown 编辑器实例的引用
237
227
  * @description 用于获取编辑器实例,可以通过该实例调用编辑器的方法