@ant-design/agentic-ui 2.0.8 → 2.0.10

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.
@@ -144,10 +144,12 @@ var genStyle = (token, classNames) => {
144
144
  display: "flex",
145
145
  maxWidth: "min(860px,100%)",
146
146
  "&-left": {
147
- justifyContent: "flex-start"
147
+ justifyContent: "flex-start",
148
+ maxWidth: "min(860px,100%)"
148
149
  },
149
150
  "&-right": {
150
- justifyContent: "flex-end"
151
+ justifyContent: "flex-end",
152
+ maxWidth: "min(860px,100%)"
151
153
  }
152
154
  },
153
155
  "&-bubble-before": {
@@ -1,38 +1,5 @@
1
1
  import React from 'react';
2
2
  import { AttachmentFile } from '../types';
3
- /**
4
- * AttachmentFileIcon 组件 - 附件文件图标组件
5
- *
6
- * 该组件根据文件类型显示不同的图标或预览。如果是图片文件,则显示图片预览;
7
- * 如果是其他类型文件,则显示对应的文件图标。
8
- *
9
- * @component
10
- * @description 附件文件图标组件,根据文件类型显示图标或预览
11
- * @param {Object} props - 组件属性
12
- * @param {AttachmentFile} props.file - 附件文件对象
13
- * @param {string} [props.className] - 自定义CSS类名
14
- * @param {React.CSSProperties} [props.style] - 自定义样式
15
- *
16
- * @example
17
- * ```tsx
18
- * <AttachmentFileIcon
19
- * file={fileData}
20
- * className="custom-icon"
21
- * style={{ fontSize: '24px' }}
22
- * />
23
- * ```
24
- *
25
- * @returns {React.ReactElement} 渲染的文件图标或预览组件
26
- *
27
- * @remarks
28
- * - 支持图片文件预览显示
29
- * - 支持多种文件类型图标
30
- * - 自动识别文件类型
31
- * - 提供自定义样式支持
32
- * - 响应式布局
33
- * - 图片自适应显示
34
- * - 图标居中显示
35
- */
36
3
  export declare const AttachmentFileIcon: React.FC<{
37
4
  file: AttachmentFile;
38
5
  className: string;
@@ -4,9 +4,18 @@ import { Image } from "antd";
4
4
  import React from "react";
5
5
  import { getFileTypeIcon } from "../../../Workspace/File/utils";
6
6
  import { isImageFile } from "../utils";
7
+ var IMAGE_STYLE = {
8
+ width: "40px",
9
+ height: "40px",
10
+ overflow: "hidden"
11
+ };
12
+ var IMAGE_PREVIEW_CONFIG = {
13
+ mask: /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Eye, null)),
14
+ visible: false
15
+ };
7
16
  var AttachmentFileIcon = (props) => {
8
17
  var _a;
9
- const file = props.file;
18
+ const { file, className } = props;
10
19
  if (file.status === "uploading") {
11
20
  return /* @__PURE__ */ React.createElement(FileUploadingSpin, null);
12
21
  }
@@ -18,25 +27,15 @@ var AttachmentFileIcon = (props) => {
18
27
  Image,
19
28
  {
20
29
  src: file.url,
21
- style: {
22
- width: "40px",
23
- height: "40px",
24
- overflow: "hidden"
25
- },
26
- rootClassName: props.className,
27
- preview: {
28
- mask: /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Eye, null)),
29
- visible: false
30
- },
30
+ style: IMAGE_STYLE,
31
+ rootClassName: className,
32
+ preview: IMAGE_PREVIEW_CONFIG,
31
33
  alt: file.name
32
34
  }
33
35
  );
34
36
  }
35
- return getFileTypeIcon(
36
- (_a = file.type) == null ? void 0 : _a.split("/").at(-1),
37
- "",
38
- file.name
39
- );
37
+ const fileType = (_a = file.type) == null ? void 0 : _a.split("/").at(-1);
38
+ return getFileTypeIcon(fileType, "", file.name);
40
39
  };
41
40
  export {
42
41
  AttachmentFileIcon
@@ -1,49 +1,6 @@
1
1
  import React from 'react';
2
2
  import { AttachmentFile } from '../types';
3
- /**
4
- * AttachmentFileListItem 组件 - 附件文件列表项组件
5
- *
6
- * 该组件用于显示单个附件文件项,包括文件图标、文件名、文件大小等信息。
7
- * 支持文件预览、下载、删除操作,提供动画效果和状态显示。
8
- *
9
- * @component
10
- * @description 附件文件列表项组件,显示单个文件信息
11
- * @param {Object} props - 组件属性
12
- * @param {AttachmentFile} props.file - 文件对象
13
- * @param {() => void} props.onDelete - 删除文件回调
14
- * @param {() => void} props.onPreview - 预览文件回调
15
- * @param {() => void} props.onDownload - 下载文件回调
16
- * @param {() => void} [props.onRetry] - 重试上传文件回调(文件上传失败时调用)
17
- * @param {string} [props.className] - 自定义CSS类名
18
- * @param {string} [props.prefixCls] - 前缀类名
19
- * @param {string} [props.hashId] - 哈希ID
20
- *
21
- * @example
22
- * ```tsx
23
- * <AttachmentFileListItem
24
- * file={fileData}
25
- * onDelete={() => handleDelete(fileData)}
26
- * onPreview={() => handlePreview(fileData)}
27
- * onDownload={() => handleDownload(fileData)}
28
- * onRetry={() => handleRetry(fileData)}
29
- * className="custom-file-item"
30
- * />
31
- * ```
32
- *
33
- * @returns {React.ReactElement} 渲染的附件文件列表项组件
34
- *
35
- * @remarks
36
- * - 显示文件图标、名称和大小
37
- * - 支持文件预览、下载、删除、重试操作
38
- * - 提供动画效果
39
- * - 显示文件状态(上传中、完成、错误)
40
- * - 支持自定义样式
41
- * - 文件名自动分割显示
42
- * - 文件大小格式化显示
43
- * - 响应式布局
44
- * - 文件上传失败时,点击文件名可重试上传
45
- */
46
- export declare const AttachmentFileListItem: React.FC<{
3
+ interface FileListItemProps {
47
4
  file: AttachmentFile;
48
5
  onDelete: () => void;
49
6
  onPreview: () => void;
@@ -52,4 +9,6 @@ export declare const AttachmentFileListItem: React.FC<{
52
9
  className?: string;
53
10
  prefixCls?: string;
54
11
  hashId?: string;
55
- }>;
12
+ }
13
+ export declare const AttachmentFileListItem: React.FC<FileListItemProps>;
14
+ export {};
@@ -6,158 +6,119 @@ import { motion } from "framer-motion";
6
6
  import React from "react";
7
7
  import { kbToSize } from "../utils";
8
8
  import { AttachmentFileIcon } from "./AttachmentFileIcon";
9
- var AttachmentFileListItem = (props) => {
10
- const file = props.file;
9
+ var getFileNameWithoutExtension = (fileName) => {
10
+ return fileName.split(".").slice(0, -1).join(".");
11
+ };
12
+ var getFileExtension = (fileName) => {
13
+ return fileName.split(".").slice(-1)[0];
14
+ };
15
+ var FileIcon = ({ file, prefixCls, hashId }) => {
16
+ const iconClassName = classNames(`${prefixCls}-file-icon`, hashId);
17
+ const status = file.status || "done";
18
+ const iconMap = {
19
+ uploading: /* @__PURE__ */ React.createElement("div", { className: classNames(`${prefixCls}-uploading-icon`, hashId) }, /* @__PURE__ */ React.createElement(FileUploadingSpin, null)),
20
+ error: /* @__PURE__ */ React.createElement("div", { className: classNames(`${prefixCls}-error-icon`, hashId) }, /* @__PURE__ */ React.createElement(FileFailed, null)),
21
+ done: /* @__PURE__ */ React.createElement(
22
+ AttachmentFileIcon,
23
+ {
24
+ file,
25
+ className: classNames(`${prefixCls}-file-icon-img`, hashId)
26
+ }
27
+ )
28
+ };
29
+ return /* @__PURE__ */ React.createElement("div", { className: iconClassName }, iconMap[status]);
30
+ };
31
+ var FileStatus = ({ file, prefixCls, hashId }) => {
32
+ const statusClassName = classNames(`${prefixCls}-file-size`, hashId);
33
+ if (file.status === "uploading") {
34
+ return /* @__PURE__ */ React.createElement("div", { className: statusClassName }, "上传中...");
35
+ }
36
+ if (file.status === "error") {
37
+ return /* @__PURE__ */ React.createElement(
38
+ "div",
39
+ {
40
+ className: classNames(statusClassName, `${prefixCls}-file-size-error`)
41
+ },
42
+ "上传失败"
43
+ );
44
+ }
45
+ const fileExtension = getFileExtension(file.name);
46
+ const fileSize = file.size ? kbToSize(file.size / 1024) : "";
47
+ const sizeItems = [fileExtension, fileSize].filter(Boolean);
48
+ return /* @__PURE__ */ React.createElement("div", { className: statusClassName }, sizeItems.map((item) => /* @__PURE__ */ React.createElement(
49
+ "span",
50
+ {
51
+ key: item,
52
+ className: classNames(`${prefixCls}-file-size-item`, hashId)
53
+ },
54
+ item
55
+ )));
56
+ };
57
+ var DeleteButton = ({ file, onClick, prefixCls, hashId }) => {
58
+ if (file.status === "uploading")
59
+ return null;
11
60
  return /* @__PURE__ */ React.createElement(
12
- Tooltip,
61
+ "div",
13
62
  {
14
- title: "点击重试",
15
- open: file.status !== "error" ? false : void 0
63
+ onClick,
64
+ className: classNames(`${prefixCls}-close-icon`, hashId)
16
65
  },
17
- /* @__PURE__ */ React.createElement(
18
- motion.div,
66
+ /* @__PURE__ */ React.createElement(X, { role: "img", "aria-label": "X" })
67
+ );
68
+ };
69
+ var AttachmentFileListItem = ({
70
+ file,
71
+ prefixCls,
72
+ hashId,
73
+ onPreview,
74
+ onRetry,
75
+ onDelete,
76
+ className
77
+ }) => {
78
+ const handleFileClick = () => {
79
+ if (file.status !== "done")
80
+ return;
81
+ onPreview == null ? void 0 : onPreview();
82
+ };
83
+ const handleRetryClick = () => {
84
+ if (file.status !== "error")
85
+ return;
86
+ onRetry == null ? void 0 : onRetry();
87
+ };
88
+ const handleDeleteClick = (e) => {
89
+ e.stopPropagation();
90
+ onDelete == null ? void 0 : onDelete();
91
+ };
92
+ return /* @__PURE__ */ React.createElement(Tooltip, { title: "点击重试", open: file.status === "error" || void 0 }, /* @__PURE__ */ React.createElement(
93
+ motion.div,
94
+ {
95
+ variants: {
96
+ hidden: { y: 20, opacity: 0 },
97
+ visible: { y: 0, opacity: 1 }
98
+ },
99
+ onClick: handleFileClick,
100
+ className,
101
+ exit: { opacity: 0, y: -20 }
102
+ },
103
+ /* @__PURE__ */ React.createElement(FileIcon, { file, prefixCls, hashId }),
104
+ /* @__PURE__ */ React.createElement("div", { className: classNames(`${prefixCls}-file-info`, hashId) }, /* @__PURE__ */ React.createElement(
105
+ "div",
19
106
  {
20
- variants: {
21
- hidden: { y: 20, opacity: 0 },
22
- visible: {
23
- y: 0,
24
- opacity: 1
25
- }
26
- },
27
- onClick: () => {
28
- var _a;
29
- if (file.status === "done") {
30
- (_a = props.onPreview) == null ? void 0 : _a.call(props);
31
- }
32
- },
33
- className: props.className,
34
- exit: { opacity: 0, y: -20 }
107
+ onClick: handleRetryClick,
108
+ className: classNames(`${prefixCls}-file-name`, hashId)
35
109
  },
36
- /* @__PURE__ */ React.createElement(
37
- "div",
38
- {
39
- className: classNames(`${props.prefixCls}-file-icon`, props.hashId)
40
- },
41
- file.status === "uploading" ? /* @__PURE__ */ React.createElement(
42
- "div",
43
- {
44
- className: classNames(
45
- `${props.prefixCls}-uploading-icon`,
46
- props.hashId
47
- )
48
- },
49
- /* @__PURE__ */ React.createElement(FileUploadingSpin, null)
50
- ) : null,
51
- file.status === "error" ? /* @__PURE__ */ React.createElement(
52
- "div",
53
- {
54
- className: classNames(
55
- `${props.prefixCls}-error-icon`,
56
- props.hashId
57
- )
58
- },
59
- /* @__PURE__ */ React.createElement(FileFailed, null)
60
- ) : null,
61
- file.status === "done" ? /* @__PURE__ */ React.createElement(
62
- AttachmentFileIcon,
63
- {
64
- file,
65
- className: classNames(
66
- `${props.prefixCls}-file-icon-img`,
67
- props.hashId
68
- )
69
- }
70
- ) : null
71
- ),
72
- /* @__PURE__ */ React.createElement(
73
- "div",
74
- {
75
- className: classNames(`${props.prefixCls}-file-info`, props.hashId)
76
- },
77
- /* @__PURE__ */ React.createElement(
78
- "div",
79
- {
80
- onClick: () => {
81
- var _a;
82
- if (file.status === "error") {
83
- (_a = props.onRetry) == null ? void 0 : _a.call(props);
84
- }
85
- },
86
- className: classNames(`${props.prefixCls}-file-name`, props.hashId)
87
- },
88
- /* @__PURE__ */ React.createElement(
89
- "span",
90
- {
91
- className: classNames(
92
- `${props.prefixCls}-file-name-text`,
93
- props.hashId
94
- )
95
- },
96
- file.name.split(".").slice(0, -1).join(".")
97
- )
98
- ),
99
- file.status === "uploading" ? /* @__PURE__ */ React.createElement(
100
- "div",
101
- {
102
- className: classNames(
103
- `${props.prefixCls}-file-size`,
104
- props.hashId
105
- )
106
- },
107
- "上传中..."
108
- ) : null,
109
- file.status === "done" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
110
- "div",
111
- {
112
- className: classNames(
113
- `${props.prefixCls}-file-size`,
114
- props.hashId
115
- )
116
- },
117
- [file.name.split(".").slice(-1), kbToSize(file.size / 1024)].filter(Boolean).map((item) => {
118
- return /* @__PURE__ */ React.createElement(
119
- "span",
120
- {
121
- key: (item == null ? void 0 : item.toString()) + "",
122
- className: classNames(
123
- `${props.prefixCls}-file-size-item`,
124
- props.hashId
125
- )
126
- },
127
- item
128
- );
129
- })
130
- )) : null,
131
- file.status === "error" ? /* @__PURE__ */ React.createElement(
132
- "div",
133
- {
134
- className: classNames(
135
- `${props.prefixCls}-file-size`,
136
- `${props.prefixCls}-file-size-error`,
137
- props.hashId
138
- )
139
- },
140
- "上传失败"
141
- ) : null
142
- ),
143
- file.status !== "uploading" ? /* @__PURE__ */ React.createElement(
144
- "div",
145
- {
146
- onClick: (e) => {
147
- var _a;
148
- e.stopPropagation();
149
- e.stopPropagation();
150
- (_a = props.onDelete) == null ? void 0 : _a.call(props);
151
- },
152
- className: classNames(
153
- `${props.prefixCls}-close-icon`,
154
- props.hashId
155
- )
156
- },
157
- /* @__PURE__ */ React.createElement(X, { role: "img", "aria-label": "X" })
158
- ) : null
110
+ /* @__PURE__ */ React.createElement("span", { className: classNames(`${prefixCls}-file-name-text`, hashId) }, getFileNameWithoutExtension(file.name))
111
+ ), /* @__PURE__ */ React.createElement(FileStatus, { file, prefixCls, hashId })),
112
+ /* @__PURE__ */ React.createElement(
113
+ DeleteButton,
114
+ {
115
+ file,
116
+ onClick: handleDeleteClick,
117
+ prefixCls,
118
+ hashId
119
+ }
159
120
  )
160
- );
121
+ ));
161
122
  };
162
123
  export {
163
124
  AttachmentFileListItem
@@ -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/MarkdownInputField/AttachmentButton/AttachmentFileList/index.tsx
2
22
  import { X } from "@sofa-design/icons";
3
23
  import { ConfigProvider, Image } from "antd";
@@ -8,45 +28,99 @@ import { ActionIconBox } from "../../../components/ActionIconBox";
8
28
  import { isImageFile } from "../utils";
9
29
  import { AttachmentFileListItem } from "./AttachmentFileListItem";
10
30
  import { useStyle } from "./style";
31
+ var ANIMATION_VARIANTS = {
32
+ visible: {
33
+ opacity: 1,
34
+ transition: {
35
+ when: "beforeChildren",
36
+ staggerChildren: 0.1
37
+ }
38
+ },
39
+ hidden: {
40
+ opacity: 0,
41
+ transition: {
42
+ when: "afterChildren"
43
+ }
44
+ }
45
+ };
46
+ var HIDDEN_STYLE = {
47
+ height: 0,
48
+ overflow: "hidden",
49
+ padding: 0
50
+ };
51
+ var CLEAR_BUTTON_STYLE = {
52
+ transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
53
+ };
54
+ var IMAGE_PREVIEW_STYLE = {
55
+ display: "none"
56
+ };
11
57
  var AttachmentFileList = (props) => {
12
- var _a, _b, _c, _d, _e;
58
+ const { fileMap, onDelete, onPreview, onDownload, onRetry, onClearFileMap } = props;
13
59
  const context = useContext(ConfigProvider.ConfigContext);
14
60
  const prefix = context == null ? void 0 : context.getPrefixCls("md-editor-attachment-list");
15
61
  const { wrapSSR, hashId } = useStyle(prefix);
16
62
  const [imgSrc, setImgSrc] = React.useState(void 0);
63
+ const fileList = Array.from((fileMap == null ? void 0 : fileMap.values()) || []);
64
+ const hasFiles = fileList.length > 0;
65
+ const isAnyUploading = fileList.some((file) => file.status === "uploading");
66
+ const handlePreview = (file) => {
67
+ if (onPreview) {
68
+ onPreview(file);
69
+ return;
70
+ }
71
+ if (isImageFile(file)) {
72
+ setImgSrc(file.previewUrl || file.url);
73
+ return;
74
+ }
75
+ if (typeof window === "undefined")
76
+ return;
77
+ window.open(file.previewUrl || file.url, "_blank");
78
+ };
79
+ const handlePreviewClose = (visible) => {
80
+ if (!visible) {
81
+ setImgSrc(void 0);
82
+ }
83
+ };
84
+ const getContainerStyle = () => {
85
+ return (fileMap == null ? void 0 : fileMap.size) ? {} : HIDDEN_STYLE;
86
+ };
87
+ const getClearButtonStyle = () => {
88
+ return __spreadProps(__spreadValues({}, CLEAR_BUTTON_STYLE), {
89
+ opacity: (fileMap == null ? void 0 : fileMap.size) ? 1 : 0
90
+ });
91
+ };
92
+ const renderClearButton = () => {
93
+ if (isAnyUploading)
94
+ return null;
95
+ return /* @__PURE__ */ React.createElement(
96
+ ActionIconBox,
97
+ {
98
+ style: getClearButtonStyle(),
99
+ onClick: onClearFileMap,
100
+ className: classNames(`${prefix}-close-icon`, hashId)
101
+ },
102
+ /* @__PURE__ */ React.createElement(X, null)
103
+ );
104
+ };
17
105
  return wrapSSR(
18
106
  /* @__PURE__ */ React.createElement(
19
107
  "div",
20
108
  {
21
109
  className: classNames(`${prefix}-container`, hashId, {
22
- [`${prefix}-container-empty`]: Array.from(((_a = props.fileMap) == null ? void 0 : _a.values()) || []).length === 0
110
+ [`${prefix}-container-empty`]: !hasFiles
23
111
  })
24
112
  },
25
113
  /* @__PURE__ */ React.createElement(
26
114
  motion.div,
27
115
  {
28
- variants: {
29
- visible: {
30
- opacity: 1,
31
- transition: {
32
- when: "beforeChildren",
33
- staggerChildren: 0.1
34
- }
35
- },
36
- hidden: {
37
- opacity: 0,
38
- transition: {
39
- when: "afterChildren"
40
- }
41
- }
42
- },
116
+ variants: ANIMATION_VARIANTS,
43
117
  whileInView: "visible",
44
118
  initial: "hidden",
45
119
  animate: "visible",
46
- style: ((_b = props.fileMap) == null ? void 0 : _b.size) ? {} : { height: 0, overflow: "hidden", padding: 0 },
120
+ style: getContainerStyle(),
47
121
  className: classNames(prefix, hashId)
48
122
  },
49
- /* @__PURE__ */ React.createElement(AnimatePresence, { initial: false }, Array.from(((_c = props.fileMap) == null ? void 0 : _c.values()) || []).map((file, index) => /* @__PURE__ */ React.createElement(
123
+ /* @__PURE__ */ React.createElement(AnimatePresence, { initial: false }, fileList.map((file, index) => /* @__PURE__ */ React.createElement(
50
124
  AttachmentFileListItem,
51
125
  {
52
126
  prefixCls: `${prefix}-item`,
@@ -54,31 +128,10 @@ var AttachmentFileList = (props) => {
54
128
  className: classNames(hashId, `${prefix}-item`),
55
129
  key: (file == null ? void 0 : file.uuid) || (file == null ? void 0 : file.name) || index,
56
130
  file,
57
- onDelete: () => {
58
- props.onDelete(file);
59
- },
60
- onPreview: () => {
61
- var _a2;
62
- if (props.onPreview) {
63
- (_a2 = props.onPreview) == null ? void 0 : _a2.call(props, file);
64
- return;
65
- }
66
- if (isImageFile(file)) {
67
- setImgSrc(file.previewUrl || file.url);
68
- return;
69
- }
70
- if (typeof window === "undefined")
71
- return;
72
- window.open(file.previewUrl || file.url, "_blank");
73
- },
74
- onDownload: () => {
75
- var _a2;
76
- return (_a2 = props.onDownload) == null ? void 0 : _a2.call(props, file);
77
- },
78
- onRetry: () => {
79
- var _a2;
80
- return (_a2 = props.onRetry) == null ? void 0 : _a2.call(props, file);
81
- }
131
+ onDelete: () => onDelete(file),
132
+ onPreview: () => handlePreview(file),
133
+ onDownload: () => onDownload == null ? void 0 : onDownload(file),
134
+ onRetry: () => onRetry == null ? void 0 : onRetry(file)
82
135
  }
83
136
  ))),
84
137
  /* @__PURE__ */ React.createElement(
@@ -87,37 +140,17 @@ var AttachmentFileList = (props) => {
87
140
  key: "preview",
88
141
  src: imgSrc,
89
142
  alt: "Preview",
90
- style: { display: "none" },
143
+ style: IMAGE_PREVIEW_STYLE,
91
144
  preview: {
92
145
  visible: !!imgSrc,
93
146
  scaleStep: 1,
94
147
  src: imgSrc,
95
- onVisibleChange: (value) => {
96
- if (!value) {
97
- setImgSrc(void 0);
98
- }
99
- }
148
+ onVisibleChange: handlePreviewClose
100
149
  }
101
150
  }
102
151
  )
103
152
  ),
104
- Array.from(((_d = props.fileMap) == null ? void 0 : _d.values()) || []).every(
105
- (file) => file.status !== "uploading"
106
- ) ? /* @__PURE__ */ React.createElement(
107
- ActionIconBox,
108
- {
109
- style: {
110
- opacity: ((_e = props.fileMap) == null ? void 0 : _e.size) ? 1 : 0,
111
- transition: "all 0.3s cubic-bezier(0.4, 0, 0.2, 1)"
112
- },
113
- onClick: () => {
114
- var _a2;
115
- (_a2 = props.onClearFileMap) == null ? void 0 : _a2.call(props);
116
- },
117
- className: classNames(`${`${prefix}`}-close-icon`, hashId)
118
- },
119
- /* @__PURE__ */ React.createElement(X, null)
120
- ) : null
153
+ renderClearButton()
121
154
  )
122
155
  );
123
156
  };