@ant-design/agentic-ui 2.29.49 → 2.29.53
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/List/PureBubbleList.d.ts +1 -1
- package/dist/Bubble/List/PureBubbleList.js +9 -6
- package/dist/Bubble/MessagesContent/index.js +2 -2
- package/dist/Constants/mobile.d.ts +1 -1
- package/dist/Constants/mobile.js +1 -1
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +1 -1
- package/dist/MarkdownEditor/editor/Editor.js +22 -0
- package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +20 -4
- package/dist/MarkdownEditor/editor/elements/Table/Table.js +5 -4
- package/dist/MarkdownEditor/editor/plugins/withLinkAndMediaPlugin.js +28 -0
- package/dist/MarkdownEditor/editor/style.js +12 -12
- package/dist/MarkdownEditor/editor/utils/dom.js +9 -1
- package/dist/MarkdownEditor/editor/utils/media.js +17 -7
- package/dist/MarkdownEditor/style.js +35 -36
- package/dist/MarkdownEditor/types.d.ts +29 -0
- package/dist/MarkdownInputField/AttachmentButton/AttachmentButtonPopover.js +4 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileIcon.d.ts +6 -0
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileIcon.js +56 -2
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.d.ts +4 -4
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +27 -6
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/index.js +4 -24
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +12 -5
- package/dist/MarkdownInputField/AttachmentButton/types.d.ts +1 -0
- package/dist/MarkdownInputField/AttachmentButton/utils.d.ts +8 -0
- package/dist/MarkdownInputField/AttachmentButton/utils.js +7 -1
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +22 -3
- package/dist/MarkdownInputField/FileMapView/index.js +13 -0
- package/dist/MarkdownInputField/FileMapView/style.js +22 -14
- package/dist/MarkdownInputField/MarkdownInputField.js +20 -9
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +6 -4
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.d.ts +14 -1
- package/dist/Plugins/chart/ChartStatistic/index.d.ts +32 -5
- package/dist/Plugins/chart/ChartStatistic/index.js +35 -74
- package/dist/Plugins/chart/ChartStatistic/style.js +20 -2
- package/dist/Plugins/chart/index.d.ts +1 -1
- package/dist/ThoughtChainList/index.js +17 -17
- package/dist/ToolUseBar/style.js +3 -0
- package/dist/ToolUseBarThink/index.js +6 -3
- package/dist/ToolUseBarThink/style.js +1 -0
- package/dist/Workspace/RealtimeFollow/index.d.ts +4 -0
- package/dist/Workspace/RealtimeFollow/index.js +2 -2
- package/dist/Workspace/index.js +5 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/package.json +1 -2
|
@@ -97,10 +97,10 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
97
97
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
98
98
|
}
|
|
99
99
|
import { Eye, FileFailed, FileUploadingSpin, Play } from "@sofa-design/icons";
|
|
100
|
-
import { Image } from "antd";
|
|
100
|
+
import { Image, Tooltip } from "antd";
|
|
101
101
|
import React, { useEffect, useState } from "react";
|
|
102
102
|
import { getFileTypeIcon } from "../../../Workspace/File/utils";
|
|
103
|
-
import { isImageFile, isVideoFile } from "../utils";
|
|
103
|
+
import { isImageFile, isVideoFile, kbToSize } from "../utils";
|
|
104
104
|
var VideoThumbnail = function VideoThumbnail(param) {
|
|
105
105
|
var src = param.src, className = param.className, style = param.style;
|
|
106
106
|
return /*#__PURE__*/ React.createElement("div", {
|
|
@@ -200,6 +200,60 @@ var VideoThumbnail = function VideoThumbnail(param) {
|
|
|
200
200
|
height: '40px',
|
|
201
201
|
overflow: 'hidden'
|
|
202
202
|
};
|
|
203
|
+
/** 无 url/previewUrl 时展示文件大小与格式的占位块(内容未拿到) */ export var FileMetaPlaceholder = function FileMetaPlaceholder(param) {
|
|
204
|
+
var file = param.file, className = param.className, style = param.style;
|
|
205
|
+
var _ref, _file_size, _ref1, _ref2, _rawFormat_split_pop;
|
|
206
|
+
var _file_uploadResponse, _file_uploadResponse1;
|
|
207
|
+
var sizeBytes = (_ref = (_file_size = file.size) !== null && _file_size !== void 0 ? _file_size : (_file_uploadResponse = file.uploadResponse) === null || _file_uploadResponse === void 0 ? void 0 : _file_uploadResponse.fileSize) !== null && _ref !== void 0 ? _ref : 0;
|
|
208
|
+
var sizeText = sizeBytes > 0 ? kbToSize(sizeBytes / 1024) : '';
|
|
209
|
+
var extFromName = file.name ? file.name.split('.').pop() || '' : '';
|
|
210
|
+
var rawFormat = (_ref1 = (_ref2 = (_file_uploadResponse1 = file.uploadResponse) === null || _file_uploadResponse1 === void 0 ? void 0 : _file_uploadResponse1.fileType) !== null && _ref2 !== void 0 ? _ref2 : file.type) !== null && _ref1 !== void 0 ? _ref1 : extFromName;
|
|
211
|
+
var formatSuffix = rawFormat.includes('/') ? ((_rawFormat_split_pop = rawFormat.split('/').pop()) !== null && _rawFormat_split_pop !== void 0 ? _rawFormat_split_pop : '').toUpperCase() : rawFormat.toUpperCase();
|
|
212
|
+
var formatText = formatSuffix || '-';
|
|
213
|
+
return /*#__PURE__*/ React.createElement(Tooltip, {
|
|
214
|
+
title: file.name
|
|
215
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
216
|
+
className: className,
|
|
217
|
+
style: _object_spread({
|
|
218
|
+
height: 48,
|
|
219
|
+
boxSizing: 'border-box',
|
|
220
|
+
display: 'flex',
|
|
221
|
+
justifyContent: 'center',
|
|
222
|
+
borderRadius: 'var(--radius-base, 4px)',
|
|
223
|
+
background: 'var(--color-fill-quaternary, rgba(0,0,0,0.04))',
|
|
224
|
+
fontSize: 10,
|
|
225
|
+
color: 'var(--color-text-tertiary, rgba(0,0,0,0.45))',
|
|
226
|
+
lineHeight: 1.2,
|
|
227
|
+
overflow: 'hidden',
|
|
228
|
+
flex: 1,
|
|
229
|
+
minWidth: 80,
|
|
230
|
+
padding: 'var(--padding-1x) var(--padding-2x)',
|
|
231
|
+
flexDirection: 'column'
|
|
232
|
+
}, style)
|
|
233
|
+
}, formatText && /*#__PURE__*/ React.createElement("span", {
|
|
234
|
+
style: {
|
|
235
|
+
lineClamp: 1,
|
|
236
|
+
lineHeight: '20px',
|
|
237
|
+
height: '20px',
|
|
238
|
+
boxSizing: 'border-box',
|
|
239
|
+
overflow: 'hidden',
|
|
240
|
+
textOverflow: 'ellipsis',
|
|
241
|
+
minWidth: 0,
|
|
242
|
+
maxWidth: '100%'
|
|
243
|
+
}
|
|
244
|
+
}, formatText), sizeText && /*#__PURE__*/ React.createElement("span", {
|
|
245
|
+
style: {
|
|
246
|
+
lineClamp: 1,
|
|
247
|
+
overflow: 'hidden',
|
|
248
|
+
textOverflow: 'ellipsis',
|
|
249
|
+
minWidth: 0,
|
|
250
|
+
boxSizing: 'border-box',
|
|
251
|
+
lineHeight: '20px',
|
|
252
|
+
height: '20px',
|
|
253
|
+
maxWidth: '100%'
|
|
254
|
+
}
|
|
255
|
+
}, sizeText)));
|
|
256
|
+
};
|
|
203
257
|
var IMAGE_PREVIEW_CONFIG = {
|
|
204
258
|
mask: /*#__PURE__*/ React.createElement("div", null, /*#__PURE__*/ React.createElement(Eye, null)),
|
|
205
259
|
visible: false
|
package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import { AttachmentFile } from '../types';
|
|
3
3
|
interface FileListItemProps {
|
|
4
4
|
file: AttachmentFile;
|
|
5
|
-
onDelete: () => void;
|
|
6
|
-
onPreview:
|
|
7
|
-
onDownload:
|
|
8
|
-
onRetry?: () => void;
|
|
5
|
+
onDelete: (file: AttachmentFile) => void;
|
|
6
|
+
onPreview?: (file: AttachmentFile) => void;
|
|
7
|
+
onDownload?: (file: AttachmentFile) => void;
|
|
8
|
+
onRetry?: (file: AttachmentFile) => void;
|
|
9
9
|
className?: string;
|
|
10
10
|
prefixCls?: string;
|
|
11
11
|
hashId?: string;
|
package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
|
+
function _define_property(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
1
14
|
import { FileFailed, FileUploadingSpin, X } from "@sofa-design/icons";
|
|
2
15
|
import { Tooltip } from "antd";
|
|
3
16
|
import classNames from "clsx";
|
|
4
17
|
import { motion } from "framer-motion";
|
|
5
18
|
import React, { useContext } from "react";
|
|
6
19
|
import { I18nContext } from "../../../I18n";
|
|
7
|
-
import { kbToSize } from "../utils";
|
|
8
|
-
import { AttachmentFileIcon } from "./AttachmentFileIcon";
|
|
20
|
+
import { isFileMetaPlaceholderState, kbToSize } from "../utils";
|
|
21
|
+
import { AttachmentFileIcon, FileMetaPlaceholder } from "./AttachmentFileIcon";
|
|
9
22
|
var getFileNameWithoutExtension = function getFileNameWithoutExtension(fileName) {
|
|
10
23
|
return fileName.split('.').slice(0, -1).join('.');
|
|
11
24
|
};
|
|
@@ -95,23 +108,31 @@ export var AttachmentFileListItem = function AttachmentFileListItem(param) {
|
|
|
95
108
|
var canDelete = file.status !== 'uploading';
|
|
96
109
|
var handleFileClick = function handleFileClick() {
|
|
97
110
|
if (!isDoneStatus) return;
|
|
98
|
-
onPreview === null || onPreview === void 0 ? void 0 : onPreview();
|
|
111
|
+
onPreview === null || onPreview === void 0 ? void 0 : onPreview(file);
|
|
99
112
|
};
|
|
100
113
|
var handleRetryClick = function handleRetryClick() {
|
|
101
114
|
if (!isErrorStatus) return;
|
|
102
|
-
onRetry === null || onRetry === void 0 ? void 0 : onRetry();
|
|
115
|
+
onRetry === null || onRetry === void 0 ? void 0 : onRetry(file);
|
|
103
116
|
};
|
|
104
117
|
var handleDeleteClick = function handleDeleteClick(e) {
|
|
105
118
|
e.stopPropagation();
|
|
106
|
-
onDelete
|
|
119
|
+
onDelete(file);
|
|
107
120
|
};
|
|
121
|
+
// 有 status 但无 url/previewUrl:文件内容未拿到,展示大小与格式占位块
|
|
122
|
+
if (file.status !== undefined && file.status !== null && !file.url && !file.previewUrl) {
|
|
123
|
+
return /*#__PURE__*/ React.createElement(FileMetaPlaceholder, {
|
|
124
|
+
file: file,
|
|
125
|
+
className: className
|
|
126
|
+
});
|
|
127
|
+
}
|
|
108
128
|
return /*#__PURE__*/ React.createElement(Tooltip, {
|
|
109
129
|
title: (locale === null || locale === void 0 ? void 0 : locale.clickToRetry) || '点击重试',
|
|
110
130
|
open: isErrorStatus ? undefined : false
|
|
111
131
|
}, /*#__PURE__*/ React.createElement(motion.div, {
|
|
112
132
|
variants: ANIMATION_VARIANTS,
|
|
113
133
|
onClick: handleFileClick,
|
|
114
|
-
className: className,
|
|
134
|
+
className: classNames(className, _define_property({}, "".concat(prefixCls, "-meta-placeholder"), isFileMetaPlaceholderState(file))),
|
|
135
|
+
"data-testid": "file-item",
|
|
115
136
|
exit: ANIMATION_VARIANTS.exit
|
|
116
137
|
}, /*#__PURE__*/ React.createElement(FileIcon, {
|
|
117
138
|
file: file,
|
|
@@ -138,26 +138,6 @@ export var AttachmentFileList = function AttachmentFileList(param) {
|
|
|
138
138
|
var handlePreviewClose = function handlePreviewClose(visible) {
|
|
139
139
|
if (!visible) setImgSrc(undefined);
|
|
140
140
|
};
|
|
141
|
-
var handleDelete = function handleDelete(file) {
|
|
142
|
-
return function() {
|
|
143
|
-
return onDelete(file);
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
var handlePreviewFile = function handlePreviewFile(file) {
|
|
147
|
-
return function() {
|
|
148
|
-
return handlePreview(file);
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
var handleDownload = function handleDownload(file) {
|
|
152
|
-
return function() {
|
|
153
|
-
return onDownload === null || onDownload === void 0 ? void 0 : onDownload(file);
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
var handleRetry = function handleRetry(file) {
|
|
157
|
-
return function() {
|
|
158
|
-
return onRetry === null || onRetry === void 0 ? void 0 : onRetry(file);
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
141
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
162
142
|
className: classNames("".concat(prefix, "-container"), hashId, _define_property({}, "".concat(prefix, "-container-empty"), !hasFiles))
|
|
163
143
|
}, /*#__PURE__*/ React.createElement(motion.div, {
|
|
@@ -176,10 +156,10 @@ export var AttachmentFileList = function AttachmentFileList(param) {
|
|
|
176
156
|
className: classNames(hashId, "".concat(prefix, "-item")),
|
|
177
157
|
key: getFileKey(file, index),
|
|
178
158
|
file: file,
|
|
179
|
-
onDelete:
|
|
180
|
-
onPreview:
|
|
181
|
-
onDownload:
|
|
182
|
-
onRetry:
|
|
159
|
+
onDelete: onDelete,
|
|
160
|
+
onPreview: onPreview !== null && onPreview !== void 0 ? onPreview : handlePreview,
|
|
161
|
+
onDownload: onDownload,
|
|
162
|
+
onRetry: onRetry
|
|
183
163
|
});
|
|
184
164
|
})), /*#__PURE__*/ React.createElement(Image, {
|
|
185
165
|
key: "preview",
|
|
@@ -52,8 +52,8 @@ function _object_spread_props(target, source) {
|
|
|
52
52
|
}
|
|
53
53
|
import { resetComponent, useEditorStyleRegister } from "../../../Hooks/useStyle";
|
|
54
54
|
var genStyle = function genStyle(token) {
|
|
55
|
-
var _obj;
|
|
56
|
-
return
|
|
55
|
+
var _obj, _obj1;
|
|
56
|
+
return _obj1 = {}, _define_property(_obj1, "".concat(token.componentCls), {
|
|
57
57
|
maxWidth: '100%',
|
|
58
58
|
display: 'flex',
|
|
59
59
|
flexDirection: 'row',
|
|
@@ -251,15 +251,22 @@ var genStyle = function genStyle(token) {
|
|
|
251
251
|
fontSize: '40px',
|
|
252
252
|
display: 'flex'
|
|
253
253
|
}
|
|
254
|
-
}
|
|
255
|
-
|
|
254
|
+
},
|
|
255
|
+
'&-item-meta-placeholder': (_obj = {
|
|
256
|
+
background: 'var(--color-fill-quaternary, rgba(0,0,0,0.04))'
|
|
257
|
+
}, _define_property(_obj, "".concat(token.componentCls, "-item-file-name-text"), {
|
|
258
|
+
color: 'var(--color-text-tertiary, rgba(0,0,0,0.45))'
|
|
259
|
+
}), _define_property(_obj, "".concat(token.componentCls, "-item-file-size"), {
|
|
260
|
+
color: 'var(--color-text-tertiary, rgba(0,0,0,0.45))'
|
|
261
|
+
}), _obj)
|
|
262
|
+
}), _define_property(_obj1, "".concat(token.componentCls, "-container"), {
|
|
256
263
|
position: 'relative',
|
|
257
264
|
background: 'var(--color-gray-bg-page)',
|
|
258
265
|
borderBottom: '1px solid rgba(0, 16, 64, 0.0627)',
|
|
259
266
|
'&-empty': {
|
|
260
267
|
border: 'none'
|
|
261
268
|
}
|
|
262
|
-
}),
|
|
269
|
+
}), _obj1;
|
|
263
270
|
};
|
|
264
271
|
/**
|
|
265
272
|
* @param prefixCls
|
|
@@ -37,6 +37,14 @@ export declare const isVideoFile: (file: File) => boolean;
|
|
|
37
37
|
* 检查文件是否为可展示的媒体类型(图片或视频)
|
|
38
38
|
*/
|
|
39
39
|
export declare const isMediaFile: (file: File) => boolean;
|
|
40
|
+
/**
|
|
41
|
+
* 是否为「仅元信息占位」状态:有 status 但无 url/previewUrl,内容未拿到时整行以 FileMetaPlaceholder 风格展示
|
|
42
|
+
*/
|
|
43
|
+
export declare const isFileMetaPlaceholderState: (file: File & {
|
|
44
|
+
status?: string;
|
|
45
|
+
url?: string;
|
|
46
|
+
previewUrl?: string;
|
|
47
|
+
}) => boolean;
|
|
40
48
|
/**
|
|
41
49
|
* 获取设备品牌
|
|
42
50
|
*
|
|
@@ -42,8 +42,9 @@
|
|
|
42
42
|
* @param {File} file - 要检查的文件
|
|
43
43
|
* @returns {boolean} 是否为图片文件
|
|
44
44
|
*/ export var isImageFile = function isImageFile(file) {
|
|
45
|
+
var _file_type;
|
|
45
46
|
// 首先检查 MIME 类型
|
|
46
|
-
if (file.type.startsWith('image/')) {
|
|
47
|
+
if (file === null || file === void 0 ? void 0 : (_file_type = file.type) === null || _file_type === void 0 ? void 0 : _file_type.startsWith('image/')) {
|
|
47
48
|
return true;
|
|
48
49
|
}
|
|
49
50
|
// 如果 MIME 类型不可用或不准确,检查文件扩展名
|
|
@@ -106,6 +107,11 @@ var hasVideoExtension = function hasVideoExtension(pathOrName) {
|
|
|
106
107
|
*/ export var isMediaFile = function isMediaFile(file) {
|
|
107
108
|
return isImageFile(file) || isVideoFile(file);
|
|
108
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* 是否为「仅元信息占位」状态:有 status 但无 url/previewUrl,内容未拿到时整行以 FileMetaPlaceholder 风格展示
|
|
112
|
+
*/ export var isFileMetaPlaceholderState = function isFileMetaPlaceholderState(file) {
|
|
113
|
+
return file.status !== undefined && file.status !== null && !file.url && !file.previewUrl;
|
|
114
|
+
};
|
|
109
115
|
/**
|
|
110
116
|
* 设备品牌匹配列表
|
|
111
117
|
*/ var UA_MATCH_LIST = [
|
|
@@ -6,6 +6,19 @@ function _array_like_to_array(arr, len) {
|
|
|
6
6
|
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
+
function _define_property(obj, key, value) {
|
|
10
|
+
if (key in obj) {
|
|
11
|
+
Object.defineProperty(obj, key, {
|
|
12
|
+
value: value,
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true
|
|
16
|
+
});
|
|
17
|
+
} else {
|
|
18
|
+
obj[key] = value;
|
|
19
|
+
}
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
|
9
22
|
function _iterable_to_array_limit(arr, i) {
|
|
10
23
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
11
24
|
if (_i == null) return;
|
|
@@ -52,8 +65,8 @@ import { motion } from "framer-motion";
|
|
|
52
65
|
import React, { useContext } from "react";
|
|
53
66
|
import { ActionIconBox } from "../../Components/ActionIconBox";
|
|
54
67
|
import { I18nContext } from "../../I18n";
|
|
55
|
-
import { AttachmentFileIcon } from "../AttachmentButton/AttachmentFileList/AttachmentFileIcon";
|
|
56
|
-
import { kbToSize } from "../AttachmentButton/utils";
|
|
68
|
+
import { AttachmentFileIcon, FileMetaPlaceholder } from "../AttachmentButton/AttachmentFileList/AttachmentFileIcon";
|
|
69
|
+
import { isFileMetaPlaceholderState, kbToSize } from "../AttachmentButton/utils";
|
|
57
70
|
/**
|
|
58
71
|
* FileMapViewItem 组件 - 文件映射视图项组件
|
|
59
72
|
*
|
|
@@ -104,6 +117,12 @@ import { kbToSize } from "../AttachmentButton/utils";
|
|
|
104
117
|
var lastDotIndex = fileName.lastIndexOf('.');
|
|
105
118
|
var displayName = lastDotIndex > 0 ? fileName.slice(0, lastDotIndex) : fileName;
|
|
106
119
|
var displayExtension = lastDotIndex > 0 && lastDotIndex < fileName.length - 1 ? fileName.slice(lastDotIndex + 1) : '';
|
|
120
|
+
// 有 status 但无 url/previewUrl:文件内容未拿到,展示大小与格式占位块
|
|
121
|
+
if (file.status !== undefined && file.status !== null && !file.url && !file.previewUrl) {
|
|
122
|
+
return /*#__PURE__*/ React.createElement(FileMetaPlaceholder, {
|
|
123
|
+
file: file
|
|
124
|
+
});
|
|
125
|
+
}
|
|
107
126
|
return /*#__PURE__*/ React.createElement(Tooltip, {
|
|
108
127
|
title: /*#__PURE__*/ React.createElement("div", null, locale === null || locale === void 0 ? void 0 : locale.clickToPreview),
|
|
109
128
|
placement: "topLeft",
|
|
@@ -140,7 +159,7 @@ import { kbToSize } from "../AttachmentButton/utils";
|
|
|
140
159
|
opacity: 0,
|
|
141
160
|
x: -20
|
|
142
161
|
},
|
|
143
|
-
className: props.className,
|
|
162
|
+
className: classNames(props.className, _define_property({}, "".concat(props.prefixCls, "-meta-placeholder"), isFileMetaPlaceholderState(file))),
|
|
144
163
|
"data-testid": "file-item"
|
|
145
164
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
146
165
|
className: classNames("".concat(props.prefixCls, "-file-icon"), props.hashId)
|
|
@@ -190,6 +190,7 @@ import { ConfigProvider, Image, Modal } from "antd";
|
|
|
190
190
|
import classNames from "clsx";
|
|
191
191
|
import { motion } from "framer-motion";
|
|
192
192
|
import React, { useContext, useMemo, useState } from "react";
|
|
193
|
+
import { FileMetaPlaceholder } from "../AttachmentButton/AttachmentFileList/AttachmentFileIcon";
|
|
193
194
|
import { isImageFile, isVideoFile } from "../AttachmentButton/utils";
|
|
194
195
|
import { FileMapViewItem } from "./FileMapViewItem";
|
|
195
196
|
import { useStyle } from "./style";
|
|
@@ -365,6 +366,12 @@ import { useStyle } from "./style";
|
|
|
365
366
|
style: props.style,
|
|
366
367
|
className: classNames(prefix, hashId, props.className, "".concat(prefix, "-").concat(placement), (_obj = {}, _define_property(_obj, "".concat(prefix, "-image-list-view"), imgList.length > 1), _define_property(_obj, "".concat(prefix, "-image-list-view-").concat(placement), imgList.length > 1), _obj))
|
|
367
368
|
}, /*#__PURE__*/ React.createElement(Image.PreviewGroup, null, imgList.map(function(file, index) {
|
|
369
|
+
if (file.status !== undefined && file.status !== null && !file.url && !file.previewUrl) {
|
|
370
|
+
return /*#__PURE__*/ React.createElement(FileMetaPlaceholder, {
|
|
371
|
+
file: file,
|
|
372
|
+
key: file.uuid || file.name || index
|
|
373
|
+
});
|
|
374
|
+
}
|
|
368
375
|
return /*#__PURE__*/ React.createElement(Image, {
|
|
369
376
|
rootClassName: classNames("".concat(prefix, "-image"), hashId),
|
|
370
377
|
width: 124,
|
|
@@ -396,6 +403,12 @@ import { useStyle } from "./style";
|
|
|
396
403
|
width: 124,
|
|
397
404
|
height: 124
|
|
398
405
|
};
|
|
406
|
+
if (file.status !== undefined && file.status !== null && !file.url && !file.previewUrl) {
|
|
407
|
+
return /*#__PURE__*/ React.createElement(FileMetaPlaceholder, {
|
|
408
|
+
file: file,
|
|
409
|
+
key: file.uuid || file.name || index
|
|
410
|
+
});
|
|
411
|
+
}
|
|
399
412
|
return /*#__PURE__*/ React.createElement("div", {
|
|
400
413
|
role: "button",
|
|
401
414
|
tabIndex: 0,
|
|
@@ -52,8 +52,8 @@ function _object_spread_props(target, source) {
|
|
|
52
52
|
}
|
|
53
53
|
import { resetComponent, useEditorStyleRegister } from "../../Hooks/useStyle";
|
|
54
54
|
var genStyle = function genStyle(token) {
|
|
55
|
-
var _obj;
|
|
56
|
-
return _define_property({}, "".concat(token.componentCls), (
|
|
55
|
+
var _obj, _obj1;
|
|
56
|
+
return _define_property({}, "".concat(token.componentCls), (_obj1 = {
|
|
57
57
|
maxWidth: '100%',
|
|
58
58
|
display: 'flex',
|
|
59
59
|
minWidth: '0px',
|
|
@@ -112,11 +112,11 @@ var genStyle = function genStyle(token) {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
}, _define_property(
|
|
115
|
+
}, _define_property(_obj1, "".concat(token.antCls, "-image-mask"), {
|
|
116
116
|
borderRadius: 'var(--radius-card-base)'
|
|
117
|
-
}), _define_property(
|
|
117
|
+
}), _define_property(_obj1, "img", {
|
|
118
118
|
objectFit: 'cover'
|
|
119
|
-
}), _define_property(
|
|
119
|
+
}), _define_property(_obj1, '&-image', {
|
|
120
120
|
opacity: 1,
|
|
121
121
|
background: 'var(--color-gray-bg-card-white)',
|
|
122
122
|
boxSizing: 'border-box',
|
|
@@ -137,7 +137,7 @@ var genStyle = function genStyle(token) {
|
|
|
137
137
|
transition: 'transform 0.3s'
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
}), _define_property(
|
|
140
|
+
}), _define_property(_obj1, '&-video-row', {
|
|
141
141
|
display: 'flex',
|
|
142
142
|
flexWrap: 'wrap',
|
|
143
143
|
gap: 8,
|
|
@@ -145,7 +145,7 @@ var genStyle = function genStyle(token) {
|
|
|
145
145
|
'&-right': {
|
|
146
146
|
alignSelf: 'flex-end'
|
|
147
147
|
}
|
|
148
|
-
}), _define_property(
|
|
148
|
+
}), _define_property(_obj1, '&-video-thumb', {
|
|
149
149
|
position: 'relative',
|
|
150
150
|
cursor: 'pointer',
|
|
151
151
|
opacity: 1,
|
|
@@ -167,7 +167,7 @@ var genStyle = function genStyle(token) {
|
|
|
167
167
|
'& video': {
|
|
168
168
|
transition: 'transform 0.3s'
|
|
169
169
|
}
|
|
170
|
-
}), _define_property(
|
|
170
|
+
}), _define_property(_obj1, '&-video-play-overlay', {
|
|
171
171
|
position: 'absolute',
|
|
172
172
|
inset: 0,
|
|
173
173
|
display: 'flex',
|
|
@@ -182,11 +182,11 @@ var genStyle = function genStyle(token) {
|
|
|
182
182
|
height: 48,
|
|
183
183
|
color: '#fff'
|
|
184
184
|
}
|
|
185
|
-
}), _define_property(
|
|
185
|
+
}), _define_property(_obj1, '&-image-list-view', {
|
|
186
186
|
background: 'var(--color-gray-bg-tip)',
|
|
187
187
|
padding: '4px',
|
|
188
188
|
borderRadius: 'var(--radius-card-base)'
|
|
189
|
-
}), _define_property(
|
|
189
|
+
}), _define_property(_obj1, '&-more-file-container', {
|
|
190
190
|
width: '285px',
|
|
191
191
|
height: '56px',
|
|
192
192
|
borderRadius: 'var(--radius-card-base)',
|
|
@@ -201,13 +201,13 @@ var genStyle = function genStyle(token) {
|
|
|
201
201
|
'&:hover': {
|
|
202
202
|
boxShadow: 'var(--shadow-control-lg)'
|
|
203
203
|
}
|
|
204
|
-
}), _define_property(
|
|
204
|
+
}), _define_property(_obj1, '&-more-file-icon', {
|
|
205
205
|
width: '16px',
|
|
206
206
|
height: '16px'
|
|
207
|
-
}), _define_property(
|
|
207
|
+
}), _define_property(_obj1, '&-more-file-name', {
|
|
208
208
|
font: 'var(--font-size-h6)',
|
|
209
209
|
color: 'var(--color-gray-text-secondary)'
|
|
210
|
-
}), _define_property(
|
|
210
|
+
}), _define_property(_obj1, '&-item', {
|
|
211
211
|
width: '285px',
|
|
212
212
|
height: '56px',
|
|
213
213
|
borderRadius: 'var(--radius-card-base)',
|
|
@@ -333,7 +333,15 @@ var genStyle = function genStyle(token) {
|
|
|
333
333
|
color: 'var(--color-gray-text-light)',
|
|
334
334
|
fontSize: '12px'
|
|
335
335
|
}
|
|
336
|
-
}), _obj
|
|
336
|
+
}), _define_property(_obj1, '&-item-meta-placeholder', (_obj = {
|
|
337
|
+
background: 'var(--color-fill-quaternary, rgba(0,0,0,0.04))'
|
|
338
|
+
}, _define_property(_obj, "".concat(token.componentCls, "-item-file-name-text"), {
|
|
339
|
+
color: 'var(--color-text-tertiary, rgba(0,0,0,0.45))'
|
|
340
|
+
}), _define_property(_obj, "".concat(token.componentCls, "-item-file-size"), {
|
|
341
|
+
color: 'var(--color-text-tertiary, rgba(0,0,0,0.45))'
|
|
342
|
+
}), _define_property(_obj, "".concat(token.componentCls, "-item-file-name-extension-container"), {
|
|
343
|
+
color: 'var(--color-text-tertiary, rgba(0,0,0,0.45))'
|
|
344
|
+
}), _obj)), _obj1));
|
|
337
345
|
};
|
|
338
346
|
/**
|
|
339
347
|
* Probubble
|
|
@@ -192,7 +192,10 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
192
192
|
* - 支持快捷键发送消息
|
|
193
193
|
* - 支持自动完成功能
|
|
194
194
|
* - 支持自定义渲染配置
|
|
195
|
-
*/ var
|
|
195
|
+
*/ var DEFAULT_ATTACHMENT = {
|
|
196
|
+
enable: false
|
|
197
|
+
};
|
|
198
|
+
var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
196
199
|
var tagInputProps = _0.tagInputProps, markdownProps = _0.markdownProps, _0_borderRadius = _0.borderRadius, borderRadius = _0_borderRadius === void 0 ? 16 : _0_borderRadius, onBlur = _0.onBlur, onFocus = _0.onFocus, _0_isShowTopOperatingArea = _0.isShowTopOperatingArea, isShowTopOperatingArea = _0_isShowTopOperatingArea === void 0 ? false : _0_isShowTopOperatingArea, props = _object_without_properties(_0, [
|
|
197
200
|
"tagInputProps",
|
|
198
201
|
"markdownProps",
|
|
@@ -203,6 +206,8 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
203
206
|
]);
|
|
204
207
|
var _ref;
|
|
205
208
|
var _props_skillMode, _props_enlargeable, _props_refinePrompt, _props_enlargeable1, _props_enlargeable2;
|
|
209
|
+
// 默认关闭文件上传,需显式传入 attachment.enable: true 开启
|
|
210
|
+
var attachment = _object_spread({}, DEFAULT_ATTACHMENT, props.attachment);
|
|
206
211
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
207
212
|
var baseCls = getPrefixCls('agentic-md-input-field');
|
|
208
213
|
var _useStyle = useStyle(baseCls, props.disableHoverAnimation), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
@@ -210,7 +215,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
210
215
|
var _useMarkdownInputFieldState = useMarkdownInputFieldState({
|
|
211
216
|
value: props.value,
|
|
212
217
|
onChange: props.onChange,
|
|
213
|
-
attachment:
|
|
218
|
+
attachment: attachment
|
|
214
219
|
}), isHover = _useMarkdownInputFieldState.isHover, setHover = _useMarkdownInputFieldState.setHover, isLoading = _useMarkdownInputFieldState.isLoading, setIsLoading = _useMarkdownInputFieldState.setIsLoading, isEnlarged = _useMarkdownInputFieldState.isEnlarged, setIsEnlarged = _useMarkdownInputFieldState.setIsEnlarged, value = _useMarkdownInputFieldState.value, setValue = _useMarkdownInputFieldState.setValue, fileMap = _useMarkdownInputFieldState.fileMap, setFileMap = _useMarkdownInputFieldState.setFileMap;
|
|
215
220
|
// 边框光束动画状态
|
|
216
221
|
var _useState = _sliced_to_array(useState(false), 2), isFocused = _useState[0], setIsFocused = _useState[1];
|
|
@@ -230,7 +235,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
230
235
|
toolsRender: props.toolsRender,
|
|
231
236
|
maxHeight: props.maxHeight,
|
|
232
237
|
style: props.style,
|
|
233
|
-
attachment:
|
|
238
|
+
attachment: attachment,
|
|
234
239
|
isEnlarged: isEnlarged,
|
|
235
240
|
rightPadding: rightPadding,
|
|
236
241
|
topRightPadding: topRightPadding,
|
|
@@ -247,7 +252,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
247
252
|
}, value), markdownEditorRef = _useMarkdownInputFieldRefs.markdownEditorRef, quickActionsRef = _useMarkdownInputFieldRefs.quickActionsRef, actionsRef = _useMarkdownInputFieldRefs.actionsRef, isSendingRef = _useMarkdownInputFieldRefs.isSendingRef;
|
|
248
253
|
// 文件上传管理
|
|
249
254
|
var _useFileUploadManager = useFileUploadManager({
|
|
250
|
-
attachment:
|
|
255
|
+
attachment: attachment,
|
|
251
256
|
fileMap: fileMap,
|
|
252
257
|
onFileMapChange: setFileMap
|
|
253
258
|
}), fileUploadDone = _useFileUploadManager.fileUploadDone, supportedFormat = _useFileUploadManager.supportedFormat, uploadImage = _useFileUploadManager.uploadImage, updateAttachmentFiles = _useFileUploadManager.updateAttachmentFiles, handleFileRemoval = _useFileUploadManager.handleFileRemoval, handleFileRetry = _useFileUploadManager.handleFileRetry;
|
|
@@ -266,7 +271,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
266
271
|
onSend: props.onSend,
|
|
267
272
|
allowEmptySubmit: props.allowEmptySubmit,
|
|
268
273
|
markdownProps: markdownProps,
|
|
269
|
-
attachment:
|
|
274
|
+
attachment: attachment,
|
|
270
275
|
triggerSendKey: props.triggerSendKey
|
|
271
276
|
},
|
|
272
277
|
markdownEditorRef: markdownEditorRef,
|
|
@@ -285,7 +290,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
285
290
|
}), handleEnlargeClick = _useMarkdownInputFieldHandlers.handleEnlargeClick, sendMessage = _useMarkdownInputFieldHandlers.sendMessage, handlePaste = _useMarkdownInputFieldHandlers.handlePaste, handleKeyDown = _useMarkdownInputFieldHandlers.handleKeyDown, activeInput = _useMarkdownInputFieldHandlers.activeInput;
|
|
286
291
|
// 渲染辅助
|
|
287
292
|
var attachmentList = useAttachmentList({
|
|
288
|
-
attachment:
|
|
293
|
+
attachment: attachment,
|
|
289
294
|
fileMap: fileMap,
|
|
290
295
|
handleFileRemoval: handleFileRemoval,
|
|
291
296
|
handleFileRetry: handleFileRetry,
|
|
@@ -299,7 +304,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
299
304
|
});
|
|
300
305
|
var sendActionsNode = useSendActionsNode({
|
|
301
306
|
props: {
|
|
302
|
-
attachment:
|
|
307
|
+
attachment: attachment,
|
|
303
308
|
voiceRecognizer: props.voiceRecognizer,
|
|
304
309
|
value: value,
|
|
305
310
|
disabled: props.disabled,
|
|
@@ -447,7 +452,12 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
447
452
|
},
|
|
448
453
|
titlePlaceholderContent: props.placeholder,
|
|
449
454
|
toc: false,
|
|
450
|
-
pasteConfig:
|
|
455
|
+
pasteConfig: _object_spread({
|
|
456
|
+
allowedTypes: [
|
|
457
|
+
'text/plain'
|
|
458
|
+
],
|
|
459
|
+
plainTextOnly: true
|
|
460
|
+
}, props.pasteConfig)
|
|
451
461
|
}, markdownProps), (props === null || props === void 0 ? void 0 : props.quickActionRender) || ((_props_refinePrompt = props.refinePrompt) === null || _props_refinePrompt === void 0 ? void 0 : _props_refinePrompt.enable) || ((_props_enlargeable1 = props.enlargeable) === null || _props_enlargeable1 === void 0 ? void 0 : _props_enlargeable1.enable) ? /*#__PURE__*/ React.createElement(QuickActions, {
|
|
452
462
|
ref: quickActionsRef,
|
|
453
463
|
value: value,
|
|
@@ -483,7 +493,8 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
483
493
|
}, props.toolsRender(_object_spread_props(_object_spread({
|
|
484
494
|
value: value,
|
|
485
495
|
fileMap: fileMap,
|
|
486
|
-
onFileMapChange: setFileMap
|
|
496
|
+
onFileMapChange: setFileMap,
|
|
497
|
+
attachment: attachment
|
|
487
498
|
}, props), {
|
|
488
499
|
isHover: isHover,
|
|
489
500
|
isLoading: isLoading,
|
|
@@ -284,16 +284,17 @@ import { getFileListFromDataTransferItems } from "../FilePaste";
|
|
|
284
284
|
});
|
|
285
285
|
})();
|
|
286
286
|
});
|
|
287
|
-
//
|
|
287
|
+
// 图片粘贴上传(仅在 attachment.enable 时生效,默认关闭)
|
|
288
288
|
var handlePaste = useRefFunction(function(e) {
|
|
289
289
|
return _async_to_generator(function() {
|
|
290
290
|
var _props_markdownProps, attachmentConfig, imageFiles;
|
|
291
291
|
return _ts_generator(this, function(_state) {
|
|
292
292
|
switch(_state.label){
|
|
293
293
|
case 0:
|
|
294
|
-
// 优先使用 props.attachment,如果没有则使用 markdownProps?.attachment
|
|
295
294
|
attachmentConfig = props.attachment || ((_props_markdownProps = props.markdownProps) === null || _props_markdownProps === void 0 ? void 0 : _props_markdownProps.attachment);
|
|
296
|
-
|
|
295
|
+
if (!(attachmentConfig === null || attachmentConfig === void 0 ? void 0 : attachmentConfig.enable)) return [
|
|
296
|
+
2
|
|
297
|
+
];
|
|
297
298
|
if (!(attachmentConfig === null || attachmentConfig === void 0 ? void 0 : attachmentConfig.upload) && !(attachmentConfig === null || attachmentConfig === void 0 ? void 0 : attachmentConfig.uploadWithResponse)) {
|
|
298
299
|
return [
|
|
299
300
|
2
|
|
@@ -305,7 +306,8 @@ import { getFileListFromDataTransferItems } from "../FilePaste";
|
|
|
305
306
|
];
|
|
306
307
|
case 1:
|
|
307
308
|
imageFiles = _state.sent().filter(function(file) {
|
|
308
|
-
|
|
309
|
+
var _file_type;
|
|
310
|
+
return file === null || file === void 0 ? void 0 : (_file_type = file.type) === null || _file_type === void 0 ? void 0 : _file_type.startsWith('image/');
|
|
309
311
|
});
|
|
310
312
|
// 如果没有图片文件,直接返回
|
|
311
313
|
if (imageFiles.length === 0) {
|
|
@@ -105,6 +105,7 @@ export type MarkdownInputFieldProps = {
|
|
|
105
105
|
/**
|
|
106
106
|
* 附件配置
|
|
107
107
|
* @description 配置附件功能,可以启用或禁用附件上传,并自定义附件按钮的属性
|
|
108
|
+
* @default { enable: false } 默认关闭文件上传
|
|
108
109
|
* @example
|
|
109
110
|
* ```tsx
|
|
110
111
|
* <BubbleChat
|
|
@@ -120,7 +121,14 @@ export type MarkdownInputFieldProps = {
|
|
|
120
121
|
* />
|
|
121
122
|
* ```
|
|
122
123
|
*/
|
|
124
|
+
/**
|
|
125
|
+
* 附件配置,默认 enable 为 false,需显式开启文件上传
|
|
126
|
+
*/
|
|
123
127
|
attachment?: {
|
|
128
|
+
/**
|
|
129
|
+
* 是否启用文件上传(包含粘贴图片上传)
|
|
130
|
+
* @default false
|
|
131
|
+
*/
|
|
124
132
|
enable?: boolean;
|
|
125
133
|
} & AttachmentButtonProps;
|
|
126
134
|
/**
|
|
@@ -284,9 +292,14 @@ export type MarkdownInputFieldProps = {
|
|
|
284
292
|
enabled?: boolean;
|
|
285
293
|
/**
|
|
286
294
|
* 允许的粘贴内容类型
|
|
287
|
-
*
|
|
295
|
+
* MarkdownInputField 默认为 ['text/plain'],仅粘贴纯文本
|
|
288
296
|
*/
|
|
289
297
|
allowedTypes?: Array<'application/x-slate-md-fragment' | 'text/html' | 'Files' | 'text/markdown' | 'text/plain'>;
|
|
298
|
+
/**
|
|
299
|
+
* 是否仅插入纯文本,不处理 HTML、链接、Markdown 解析等
|
|
300
|
+
* MarkdownInputField 默认为 true
|
|
301
|
+
*/
|
|
302
|
+
plainTextOnly?: boolean;
|
|
290
303
|
};
|
|
291
304
|
/**
|
|
292
305
|
* 技能模式配置
|