@ant-design/agentic-ui 2.30.15 → 2.30.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.
- package/dist/Bubble/AIBubble.js +3 -2
- package/dist/Bubble/ContentFilemapView.d.ts +2 -0
- package/dist/Bubble/ContentFilemapView.js +9 -6
- package/dist/Bubble/MessagesContent/index.js +7 -7
- package/dist/Bubble/UserBubble.js +2 -1
- package/dist/Hooks/useLanguage.d.ts +3 -1
- package/dist/I18n/locales.d.ts +3 -1
- package/dist/I18n/locales.js +6 -2
- package/dist/MarkdownInputField/FileMapView/index.js +1 -7
- package/dist/MarkdownInputField/FileMapView/style.js +1 -2
- package/dist/MarkdownInputField/MarkdownInputField.js +16 -5
- package/dist/MarkdownInputField/SendActions/index.js +2 -2
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +1 -0
- package/dist/MarkdownInputField/style.js +24 -1
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.d.ts +3 -3
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.js +1 -1
- package/dist/Plugins/chart/ChartRender.js +3 -1
- package/dist/Plugins/chart/DonutChart/index.js +1 -1
- package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +6 -2
- package/dist/Workspace/File/FileComponent.js +178 -103
- package/dist/Workspace/File/style.js +20 -0
- package/package.json +1 -2
package/dist/Bubble/AIBubble.js
CHANGED
|
@@ -274,7 +274,7 @@ var getTaskList = function getTaskList(originData) {
|
|
|
274
274
|
* ```
|
|
275
275
|
*/ export var AIBubble = /*#__PURE__*/ memo(function(props) {
|
|
276
276
|
var _ref, _messageDisplayKeyRef_current, _props_readonly;
|
|
277
|
-
var _props_originData, _props_originData1, _props_originData2, _props_originData3, _props_originData4, _props_originData5, _props_bubbleRenderConfig, _props_originData_fileMap, _props_originData6, _props_bubbleRenderConfig1, _props_styles, _props_bubbleRenderConfig2, _bubbleRenderConfig_render;
|
|
277
|
+
var _props_originData, _props_originData1, _props_originData2, _props_originData3, _props_originData4, _props_originData5, _props_bubbleRenderConfig, _props_originData_fileMap, _props_originData6, _props_markdownRenderConfig, _props_bubbleRenderConfig1, _props_styles, _props_bubbleRenderConfig2, _bubbleRenderConfig_render;
|
|
278
278
|
var onAvatarClick = props.onAvatarClick, className = props.className, style = props.style, bubbleRenderConfig = props.bubbleRenderConfig, classNames = props.classNames, styles = props.styles, originData = props.originData, preMessage = props.preMessage;
|
|
279
279
|
var _React_useState = _sliced_to_array(React.useState(false), 2), hidePadding = _React_useState[0], setHidePadding = _React_useState[1];
|
|
280
280
|
var messageDisplayKeyRef = useRef(null);
|
|
@@ -318,7 +318,7 @@ var getTaskList = function getTaskList(originData) {
|
|
|
318
318
|
}, [
|
|
319
319
|
rawContent
|
|
320
320
|
]), filemapBlocks = _useMemo.blocks, strippedContent = _useMemo.stripped;
|
|
321
|
-
var contentForDisplay = filemapBlocks.length > 0 ? strippedContent : rawContent;
|
|
321
|
+
var contentForDisplay = filemapBlocks.length > 0 ? strippedContent : typeof rawContent === 'string' ? rawContent : strippedContent;
|
|
322
322
|
var messageContent = /*#__PURE__*/ React.createElement(BubbleMessageDisplay, {
|
|
323
323
|
markdownRenderConfig: props.markdownRenderConfig,
|
|
324
324
|
docListProps: props.docListProps,
|
|
@@ -415,6 +415,7 @@ var getTaskList = function getTaskList(originData) {
|
|
|
415
415
|
blocks: filemapBlocks,
|
|
416
416
|
fileViewConfig: props.fileViewConfig,
|
|
417
417
|
fileViewEvents: props.fileViewEvents,
|
|
418
|
+
fileMapConfig: (_props_markdownRenderConfig = props.markdownRenderConfig) === null || _props_markdownRenderConfig === void 0 ? void 0 : _props_markdownRenderConfig.fileMapConfig,
|
|
418
419
|
placement: placement
|
|
419
420
|
}))));
|
|
420
421
|
if ((bubbleRenderConfig === null || bubbleRenderConfig === void 0 ? void 0 : bubbleRenderConfig.render) === false) return null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { FileMapConfig } from '../MarkdownRenderer/types';
|
|
2
3
|
import type { FilemapBlock } from './extractFilemapBlocks';
|
|
3
4
|
import type { BubbleProps } from './type';
|
|
4
5
|
/**
|
|
@@ -9,6 +10,7 @@ export declare const ContentFilemapView: React.FC<{
|
|
|
9
10
|
blocks: FilemapBlock[];
|
|
10
11
|
fileViewConfig?: BubbleProps['fileViewConfig'];
|
|
11
12
|
fileViewEvents?: BubbleProps['fileViewEvents'];
|
|
13
|
+
fileMapConfig?: FileMapConfig;
|
|
12
14
|
placement?: 'left' | 'right';
|
|
13
15
|
style?: React.CSSProperties;
|
|
14
16
|
}>;
|
|
@@ -15,16 +15,18 @@ var parseBody = function parseBody(body) {
|
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
17
|
var FilemapItem = function FilemapItem(param) {
|
|
18
|
-
var body = param.body, fileViewConfig = param.fileViewConfig, fileViewEvents = param.fileViewEvents, placement = param.placement;
|
|
18
|
+
var body = param.body, fileViewConfig = param.fileViewConfig, fileViewEvents = param.fileViewEvents, fileMapConfig = param.fileMapConfig, placement = param.placement;
|
|
19
|
+
var _ref, _ref1, _ref2;
|
|
19
20
|
var parsed = useMemo(function() {
|
|
20
21
|
return parseBody(body);
|
|
21
22
|
}, [
|
|
22
23
|
body
|
|
23
24
|
]);
|
|
24
25
|
var _useMemo = useMemo(function() {
|
|
25
|
-
return normalizeFileMapPropsFromJson(parsed);
|
|
26
|
+
return normalizeFileMapPropsFromJson(parsed, fileMapConfig === null || fileMapConfig === void 0 ? void 0 : fileMapConfig.normalizeFile);
|
|
26
27
|
}, [
|
|
27
|
-
parsed
|
|
28
|
+
parsed,
|
|
29
|
+
fileMapConfig === null || fileMapConfig === void 0 ? void 0 : fileMapConfig.normalizeFile
|
|
28
30
|
]), fileList = _useMemo.fileList, className = _useMemo.className;
|
|
29
31
|
var fileMap = useMemo(function() {
|
|
30
32
|
return new Map(fileList.map(function(f) {
|
|
@@ -65,9 +67,9 @@ var FilemapItem = function FilemapItem(param) {
|
|
|
65
67
|
className: className !== null && className !== void 0 ? className : fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.className,
|
|
66
68
|
style: fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.style,
|
|
67
69
|
placement: placement,
|
|
68
|
-
onPreview: events === null || events === void 0 ? void 0 : events.onPreview,
|
|
70
|
+
onPreview: (_ref = (_ref1 = events === null || events === void 0 ? void 0 : events.onPreview) !== null && _ref1 !== void 0 ? _ref1 : fileMapConfig === null || fileMapConfig === void 0 ? void 0 : fileMapConfig.onPreview) !== null && _ref !== void 0 ? _ref : defaultHandlers.onPreview,
|
|
69
71
|
onDownload: events === null || events === void 0 ? void 0 : events.onDownload,
|
|
70
|
-
itemRender: fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.itemRender,
|
|
72
|
+
itemRender: (_ref2 = fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.itemRender) !== null && _ref2 !== void 0 ? _ref2 : fileMapConfig === null || fileMapConfig === void 0 ? void 0 : fileMapConfig.itemRender,
|
|
71
73
|
maxDisplayCount: fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.maxDisplayCount,
|
|
72
74
|
showMoreButton: fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.showMoreButton,
|
|
73
75
|
customSlot: fileViewConfig === null || fileViewConfig === void 0 ? void 0 : fileViewConfig.customSlot,
|
|
@@ -78,7 +80,7 @@ var FilemapItem = function FilemapItem(param) {
|
|
|
78
80
|
* 将从 markdown content 中提取出的 agentic-ui-filemap 块渲染为 FileMapView 列表。
|
|
79
81
|
* 渲染在气泡内容框外部,避免图片被包在带样式的气泡背景里。
|
|
80
82
|
*/ export var ContentFilemapView = function ContentFilemapView(param) {
|
|
81
|
-
var blocks = param.blocks, fileViewConfig = param.fileViewConfig, fileViewEvents = param.fileViewEvents, placement = param.placement, style = param.style;
|
|
83
|
+
var blocks = param.blocks, fileViewConfig = param.fileViewConfig, fileViewEvents = param.fileViewEvents, fileMapConfig = param.fileMapConfig, placement = param.placement, style = param.style;
|
|
82
84
|
if (blocks.length === 0) return null;
|
|
83
85
|
return /*#__PURE__*/ React.createElement("div", {
|
|
84
86
|
style: style,
|
|
@@ -89,6 +91,7 @@ var FilemapItem = function FilemapItem(param) {
|
|
|
89
91
|
body: block.body,
|
|
90
92
|
fileViewConfig: fileViewConfig,
|
|
91
93
|
fileViewEvents: fileViewEvents,
|
|
94
|
+
fileMapConfig: fileMapConfig,
|
|
92
95
|
placement: placement
|
|
93
96
|
});
|
|
94
97
|
}));
|
|
@@ -370,7 +370,7 @@ var THINKING_DOT_INDICES = [
|
|
|
370
370
|
contentAfterDom
|
|
371
371
|
]);
|
|
372
372
|
var messageContent = useMemo(function() {
|
|
373
|
-
var _props_originData, _props_bubbleRenderConfig, _props_bubbleRenderConfig1, _props_bubbleRenderConfig2, _props_bubbleRenderConfig3, _props_bubbleRenderConfig_extraRender, _props_bubbleRenderConfig4, _props_originData_extra_tags_includes, _props_originData_extra_tags, _props_originData_extra, _props_originData1, _props_originData2, _props_originData_extra1, _props_originData3, _props_originData_extra2, _props_originData4, _props_originData5, _props_originData_extra3, _props_originData6, _props_docListProps, _props_originData7, _props_markdownRenderConfig, _props_originData8, _props_originData_extra4, _props_originData9
|
|
373
|
+
var _props_originData, _props_bubbleRenderConfig, _props_bubbleRenderConfig1, _props_bubbleRenderConfig2, _props_bubbleRenderConfig3, _props_bubbleRenderConfig_extraRender, _props_bubbleRenderConfig4, _props_originData_extra_tags_includes, _props_originData_extra_tags, _props_originData_extra, _props_originData1, _props_originData2, _props_originData_extra1, _props_originData3, _props_originData_extra2, _props_originData4, _props_originData5, _props_originData_extra3, _props_originData6, _props_docListProps, _props_originData7, _props_markdownRenderConfig, _props_originData8, _props_originData_extra4, _props_originData9;
|
|
374
374
|
if (content === LOADING_FLAT || !((_props_originData = props.originData) === null || _props_originData === void 0 ? void 0 : _props_originData.isFinished) && !content) {
|
|
375
375
|
var _context_thoughtChain;
|
|
376
376
|
if ((context === null || context === void 0 ? void 0 : (_context_thoughtChain = context.thoughtChain) === null || _context_thoughtChain === void 0 ? void 0 : _context_thoughtChain.alwaysRender) !== true) {
|
|
@@ -539,7 +539,7 @@ var THINKING_DOT_INDICES = [
|
|
|
539
539
|
}, beforeContent, content, afterContent, extra));
|
|
540
540
|
}
|
|
541
541
|
if (content === '...' || props.placement !== 'left' || (props === null || props === void 0 ? void 0 : (_props_originData1 = props.originData) === null || _props_originData1 === void 0 ? void 0 : (_props_originData_extra = _props_originData1.extra) === null || _props_originData_extra === void 0 ? void 0 : (_props_originData_extra_tags = _props_originData_extra.tags) === null || _props_originData_extra_tags === void 0 ? void 0 : (_props_originData_extra_tags_includes = _props_originData_extra_tags.includes) === null || _props_originData_extra_tags_includes === void 0 ? void 0 : _props_originData_extra_tags_includes.call(_props_originData_extra_tags, 'REJECT_TO_ANSWER')) || ((_props_originData2 = props.originData) === null || _props_originData2 === void 0 ? void 0 : _props_originData2.role) === 'bot') {
|
|
542
|
-
var
|
|
542
|
+
var _props_originData10;
|
|
543
543
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
544
544
|
className: classNames('agent-item-default-content', "".concat(baseChatCls, "-messages-content-message"), hashId),
|
|
545
545
|
"data-testid": "message-box-content",
|
|
@@ -550,14 +550,14 @@ var THINKING_DOT_INDICES = [
|
|
|
550
550
|
placement: props.placement,
|
|
551
551
|
markdownRenderConfig: props.markdownRenderConfig,
|
|
552
552
|
isFinished: true,
|
|
553
|
-
style: ((
|
|
553
|
+
style: ((_props_originData10 = props.originData) === null || _props_originData10 === void 0 ? void 0 : _props_originData10.role) === 'bot' ? {} : {
|
|
554
554
|
color: '#343A45'
|
|
555
555
|
} // 使用类名方式需要传递className,这里保留style以兼容现有API
|
|
556
556
|
,
|
|
557
557
|
extra: extra,
|
|
558
558
|
typing: false,
|
|
559
559
|
originData: props.originData,
|
|
560
|
-
content:
|
|
560
|
+
content: content
|
|
561
561
|
})));
|
|
562
562
|
}
|
|
563
563
|
// answerStatus= 'EXCEPTION'时 一定是异常情况
|
|
@@ -576,7 +576,7 @@ var THINKING_DOT_INDICES = [
|
|
|
576
576
|
var _item_output_chunks, _item_output;
|
|
577
577
|
return ((item === null || item === void 0 ? void 0 : (_item_output = item.output) === null || _item_output === void 0 ? void 0 : (_item_output_chunks = _item_output.chunks) === null || _item_output_chunks === void 0 ? void 0 : _item_output_chunks.length) || 0) > 0;
|
|
578
578
|
})) && ((_props_docListProps = props.docListProps) === null || _props_docListProps === void 0 ? void 0 : _props_docListProps.enable) !== false) {
|
|
579
|
-
var _props_docListProps1, _props_originData_extra5,
|
|
579
|
+
var _props_docListProps1, _props_originData_extra5, _props_originData11;
|
|
580
580
|
docInfoDom = /*#__PURE__*/ React.createElement(DocInfoList, _object_spread_props(_object_spread({
|
|
581
581
|
options: docInfoList.map(function(item) {
|
|
582
582
|
var _item_output;
|
|
@@ -585,7 +585,7 @@ var THINKING_DOT_INDICES = [
|
|
|
585
585
|
return item;
|
|
586
586
|
})
|
|
587
587
|
}, props.docListProps), {
|
|
588
|
-
reference_url_info_list: ((_props_docListProps1 = props.docListProps) === null || _props_docListProps1 === void 0 ? void 0 : _props_docListProps1.reference_url_info_list) || ((
|
|
588
|
+
reference_url_info_list: ((_props_docListProps1 = props.docListProps) === null || _props_docListProps1 === void 0 ? void 0 : _props_docListProps1.reference_url_info_list) || ((_props_originData11 = props.originData) === null || _props_originData11 === void 0 ? void 0 : (_props_originData_extra5 = _props_originData11.extra) === null || _props_originData_extra5 === void 0 ? void 0 : _props_originData_extra5.reference_url_info_list) || []
|
|
589
589
|
}));
|
|
590
590
|
}
|
|
591
591
|
return wrapSSR(/*#__PURE__*/ React.createElement(MarkdownPreview, {
|
|
@@ -664,7 +664,7 @@ var THINKING_DOT_INDICES = [
|
|
|
664
664
|
docListNode: docInfoDom,
|
|
665
665
|
extra: isExtraNull ? null : extra,
|
|
666
666
|
htmlRef: props.bubbleListRef,
|
|
667
|
-
content: ((_props_originData8 = props.originData) === null || _props_originData8 === void 0 ? void 0 : _props_originData8.isFinished) && (props === null || props === void 0 ? void 0 : (_props_originData9 = props.originData) === null || _props_originData9 === void 0 ? void 0 : (_props_originData_extra4 = _props_originData9.extra) === null || _props_originData_extra4 === void 0 ? void 0 : _props_originData_extra4.answerStatus) === 'EXCEPTION' ?
|
|
667
|
+
content: ((_props_originData8 = props.originData) === null || _props_originData8 === void 0 ? void 0 : _props_originData8.isFinished) && (props === null || props === void 0 ? void 0 : (_props_originData9 = props.originData) === null || _props_originData9 === void 0 ? void 0 : (_props_originData_extra4 = _props_originData9.extra) === null || _props_originData_extra4 === void 0 ? void 0 : _props_originData_extra4.answerStatus) === 'EXCEPTION' ? content || (locale === null || locale === void 0 ? void 0 : locale['chat.message.generateFailed']) || '生成回答失败,请重试' : content || '',
|
|
668
668
|
originData: props.originData
|
|
669
669
|
}));
|
|
670
670
|
}, [
|
|
@@ -149,7 +149,7 @@ var getContentStyle = function getContentStyle(standalone, customStyle) {
|
|
|
149
149
|
* ```
|
|
150
150
|
*/ export var UserBubble = /*#__PURE__*/ memo(function(props) {
|
|
151
151
|
var _props_readonly;
|
|
152
|
-
var _originData_fileMap, _props_bubbleRenderConfig, _props_styles, _props_bubbleRenderConfig1, _bubbleRenderConfig_render;
|
|
152
|
+
var _originData_fileMap, _props_markdownRenderConfig, _props_bubbleRenderConfig, _props_styles, _props_bubbleRenderConfig1, _bubbleRenderConfig_render;
|
|
153
153
|
var className = props.className, style = props.style, bubbleRenderConfig = props.bubbleRenderConfig, classNames = props.classNames, styles = props.styles, originData = props.originData, quote = props.quote;
|
|
154
154
|
var _React_useState = _sliced_to_array(React.useState(false), 2), hidePadding = _React_useState[0], setHidePadding = _React_useState[1];
|
|
155
155
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
@@ -257,6 +257,7 @@ var getContentStyle = function getContentStyle(standalone, customStyle) {
|
|
|
257
257
|
blocks: filemapBlocks,
|
|
258
258
|
fileViewConfig: props.fileViewConfig,
|
|
259
259
|
fileViewEvents: props.fileViewEvents,
|
|
260
|
+
fileMapConfig: (_props_markdownRenderConfig = props.markdownRenderConfig) === null || _props_markdownRenderConfig === void 0 ? void 0 : _props_markdownRenderConfig.fileMapConfig,
|
|
260
261
|
placement: placement,
|
|
261
262
|
style: {
|
|
262
263
|
alignSelf: 'flex-end'
|
|
@@ -307,6 +307,8 @@ export declare function useLanguage(): {
|
|
|
307
307
|
'workspace.fileProcessError': string;
|
|
308
308
|
'workspace.download': string;
|
|
309
309
|
'workspace.empty': string;
|
|
310
|
+
'workspace.file.showMore': string;
|
|
311
|
+
'workspace.file.showMoreFiles': string;
|
|
310
312
|
'workspace.title': string;
|
|
311
313
|
'workspace.searchPlaceholder': string;
|
|
312
314
|
'workspace.noResultsFor': string;
|
|
@@ -351,7 +353,6 @@ export declare function useLanguage(): {
|
|
|
351
353
|
'suggestion.followUp': string;
|
|
352
354
|
'input.fileUpload': string;
|
|
353
355
|
'input.attachmentListTitle': string;
|
|
354
|
-
'chat.fileMapTitle': string;
|
|
355
356
|
'input.voiceInput': string;
|
|
356
357
|
'input.voiceInputting': string;
|
|
357
358
|
'input.placeholder': string;
|
|
@@ -363,6 +364,7 @@ export declare function useLanguage(): {
|
|
|
363
364
|
'input.sendButtonTooltip.newline': string;
|
|
364
365
|
'input.sendButtonTooltip.send.mod': string;
|
|
365
366
|
'input.sendButtonTooltip.newline.mod': string;
|
|
367
|
+
'input.typing.hint': string;
|
|
366
368
|
'common.name': string;
|
|
367
369
|
'common.updateTime': string;
|
|
368
370
|
'common.type': string;
|
package/dist/I18n/locales.d.ts
CHANGED
|
@@ -269,6 +269,8 @@ export declare const cnLabels: {
|
|
|
269
269
|
'workspace.fileProcessError': string;
|
|
270
270
|
'workspace.download': string;
|
|
271
271
|
'workspace.empty': string;
|
|
272
|
+
'workspace.file.showMore': string;
|
|
273
|
+
'workspace.file.showMoreFiles': string;
|
|
272
274
|
'workspace.title': string;
|
|
273
275
|
'workspace.searchPlaceholder': string;
|
|
274
276
|
'workspace.noResultsFor': string;
|
|
@@ -313,7 +315,6 @@ export declare const cnLabels: {
|
|
|
313
315
|
'suggestion.followUp': string;
|
|
314
316
|
'input.fileUpload': string;
|
|
315
317
|
'input.attachmentListTitle': string;
|
|
316
|
-
'chat.fileMapTitle': string;
|
|
317
318
|
'input.voiceInput': string;
|
|
318
319
|
'input.voiceInputting': string;
|
|
319
320
|
'input.placeholder': string;
|
|
@@ -325,6 +326,7 @@ export declare const cnLabels: {
|
|
|
325
326
|
'input.sendButtonTooltip.newline': string;
|
|
326
327
|
'input.sendButtonTooltip.send.mod': string;
|
|
327
328
|
'input.sendButtonTooltip.newline.mod': string;
|
|
329
|
+
'input.typing.hint': string;
|
|
328
330
|
'common.name': string;
|
|
329
331
|
'common.updateTime': string;
|
|
330
332
|
'common.type': string;
|
package/dist/I18n/locales.js
CHANGED
|
@@ -281,6 +281,8 @@
|
|
|
281
281
|
'workspace.download': '下载',
|
|
282
282
|
// 新增:默认空态文案
|
|
283
283
|
'workspace.empty': '暂无数据',
|
|
284
|
+
'workspace.file.showMore': '查看更多(还有 ${count} 个)',
|
|
285
|
+
'workspace.file.showMoreFiles': '查看更多文件',
|
|
284
286
|
// 新增:Workspace 标题与搜索相关
|
|
285
287
|
'workspace.title': '工作空间',
|
|
286
288
|
'workspace.searchPlaceholder': '搜索文件名',
|
|
@@ -333,7 +335,6 @@
|
|
|
333
335
|
// MarkdownInputField related
|
|
334
336
|
'input.fileUpload': '文件上传',
|
|
335
337
|
'input.attachmentListTitle': '上传附件',
|
|
336
|
-
'chat.fileMapTitle': '结果文件',
|
|
337
338
|
'input.voiceInput': '语音输入',
|
|
338
339
|
'input.voiceInputting': '语音输入中,点击可停止。',
|
|
339
340
|
'input.placeholder': '请输入',
|
|
@@ -345,6 +346,7 @@
|
|
|
345
346
|
'input.sendButtonTooltip.newline': '按 Shift+Enter 键换行',
|
|
346
347
|
'input.sendButtonTooltip.send.mod': '按 Cmd/Ctrl+Enter 键发送',
|
|
347
348
|
'input.sendButtonTooltip.newline.mod': '按 Enter 键换行',
|
|
349
|
+
'input.typing.hint': 'AI 正在回复中,请稍候...',
|
|
348
350
|
// Other translations
|
|
349
351
|
'common.name': '名称',
|
|
350
352
|
'common.updateTime': '更新时间',
|
|
@@ -709,6 +711,8 @@
|
|
|
709
711
|
'workspace.download': 'Download',
|
|
710
712
|
// New: default empty text
|
|
711
713
|
'workspace.empty': 'No data',
|
|
714
|
+
'workspace.file.showMore': 'Show more (${count} remaining)',
|
|
715
|
+
'workspace.file.showMoreFiles': 'Show more files',
|
|
712
716
|
// New: Workspace title & search
|
|
713
717
|
'workspace.title': 'Workspace',
|
|
714
718
|
'workspace.searchPlaceholder': 'Search file name',
|
|
@@ -761,7 +765,6 @@
|
|
|
761
765
|
// MarkdownInputField related
|
|
762
766
|
'input.fileUpload': 'Upload attachments',
|
|
763
767
|
'input.attachmentListTitle': 'Uploaded attachments',
|
|
764
|
-
'chat.fileMapTitle': 'Result files',
|
|
765
768
|
'input.voiceInput': 'Voice input',
|
|
766
769
|
'input.voiceInputting': 'Voice input in progress, click to stop.',
|
|
767
770
|
'input.placeholder': 'Please input',
|
|
@@ -773,6 +776,7 @@
|
|
|
773
776
|
'input.sendButtonTooltip.newline': 'Press Shift+Enter for new line',
|
|
774
777
|
'input.sendButtonTooltip.send.mod': 'Press Cmd/Ctrl+Enter to send',
|
|
775
778
|
'input.sendButtonTooltip.newline.mod': 'Press Enter for new line',
|
|
779
|
+
'input.typing.hint': 'AI is replying, please wait...',
|
|
776
780
|
// Other translations
|
|
777
781
|
'common.name': 'Name',
|
|
778
782
|
'common.updateTime': 'Update Time',
|
|
@@ -190,7 +190,6 @@ 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 { I18nContext } from "../../I18n";
|
|
194
193
|
import { FileMetaPlaceholder } from "../AttachmentButton/AttachmentFileList/AttachmentFileIcon";
|
|
195
194
|
import { isFileMetaPlaceholderState, isImageFile, isVideoFile } from "../AttachmentButton/utils";
|
|
196
195
|
import { FileMapViewItem } from "./FileMapViewItem";
|
|
@@ -249,7 +248,6 @@ var getMediaPlaceholderStyle = function getMediaPlaceholderStyle(size) {
|
|
|
249
248
|
var _props_style;
|
|
250
249
|
var _props_placement = props.placement, placement = _props_placement === void 0 ? 'left' : _props_placement;
|
|
251
250
|
var context = useContext(ConfigProvider.ConfigContext);
|
|
252
|
-
var locale = useContext(I18nContext).locale;
|
|
253
251
|
var prefix = context === null || context === void 0 ? void 0 : context.getPrefixCls('agentic-md-editor-file-view-list');
|
|
254
252
|
var _useStyle = useStyle(prefix), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
255
253
|
var _useState = _sliced_to_array(useState(false), 2), showAllFiles = _useState[0], setShowAllFiles = _useState[1];
|
|
@@ -351,7 +349,6 @@ var getMediaPlaceholderStyle = function getMediaPlaceholderStyle(size) {
|
|
|
351
349
|
width: IMAGE_THUMBNAIL_SIZE,
|
|
352
350
|
height: IMAGE_THUMBNAIL_SIZE
|
|
353
351
|
});
|
|
354
|
-
var hasAnyFiles = fileList.length > 0;
|
|
355
352
|
var _obj;
|
|
356
353
|
return wrapSSR(/*#__PURE__*/ React.createElement("div", {
|
|
357
354
|
"data-testid": "file-view-list",
|
|
@@ -364,10 +361,7 @@ var getMediaPlaceholderStyle = function getMediaPlaceholderStyle(size) {
|
|
|
364
361
|
alignItems: placement === 'left' ? 'flex-start' : 'flex-end',
|
|
365
362
|
width: 'max-content'
|
|
366
363
|
}
|
|
367
|
-
},
|
|
368
|
-
className: classNames("".concat(prefix, "-title"), hashId),
|
|
369
|
-
"data-testid": "file-view-title"
|
|
370
|
-
}, (locale === null || locale === void 0 ? void 0 : locale['chat.fileMapTitle']) || '结果文件') : null, imgList.length > 0 && /*#__PURE__*/ React.createElement(motion.div, {
|
|
364
|
+
}, imgList.length > 0 && /*#__PURE__*/ React.createElement(motion.div, {
|
|
371
365
|
variants: {
|
|
372
366
|
visible: {
|
|
373
367
|
opacity: 1,
|
|
@@ -73,11 +73,10 @@ var genStyle = function genStyle(token) {
|
|
|
73
73
|
},
|
|
74
74
|
'&-vertical': {
|
|
75
75
|
display: 'flex',
|
|
76
|
-
flexDirection: 'row',
|
|
77
76
|
flexWrap: 'wrap',
|
|
78
77
|
alignItems: 'flex-start',
|
|
79
78
|
gap: 4,
|
|
80
|
-
padding:
|
|
79
|
+
padding: 2,
|
|
81
80
|
maxWidth: 'calc(285px * 3 + 4px * 2)',
|
|
82
81
|
'& > :only-child': {
|
|
83
82
|
marginTop: 8,
|
|
@@ -135,6 +135,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
135
135
|
import { ConfigProvider } from "antd";
|
|
136
136
|
import classNames from "clsx";
|
|
137
137
|
import React, { memo, useContext, useState } from "react";
|
|
138
|
+
import { TextLoading } from "../Components/lotties/TextLoading";
|
|
139
|
+
import { useLocale } from "../I18n";
|
|
138
140
|
import { BaseMarkdownEditor } from "../MarkdownEditor";
|
|
139
141
|
import { BorderBeamAnimation } from "./BorderBeamAnimation";
|
|
140
142
|
import { useFileUploadManager } from "./FileUploadManager";
|
|
@@ -167,7 +169,7 @@ import { useVoiceInputManager } from "./VoiceInputManager";
|
|
|
167
169
|
* @param {string} [props.placeholder] - 占位符文本
|
|
168
170
|
* @param {string} [props.triggerSendKey='Enter'] - 触发发送的快捷键(Enter 发送,Shift+Enter 换行)
|
|
169
171
|
* @param {boolean} [props.disabled] - 是否禁用
|
|
170
|
-
* @param {boolean} [props.typing] -
|
|
172
|
+
* @param {boolean} [props.typing] - AI 回复中等场景下为 true,输入区只读并显示提示
|
|
171
173
|
* @param {AttachmentProps} [props.attachment] - 附件配置
|
|
172
174
|
* @param {string[]} [props.bgColorList] - 背景颜色列表,推荐使用3-4种颜色
|
|
173
175
|
* @param {React.RefObject} [props.inputRef] - 输入框引用
|
|
@@ -213,6 +215,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
213
215
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
214
216
|
var baseCls = getPrefixCls('agentic-md-input-field');
|
|
215
217
|
var _useStyle = useStyle(baseCls, props.disableHoverAnimation), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
218
|
+
var locale = useLocale();
|
|
216
219
|
// 状态管理
|
|
217
220
|
var _useMarkdownInputFieldState = useMarkdownInputFieldState({
|
|
218
221
|
value: props.value,
|
|
@@ -305,6 +308,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
305
308
|
isHover: isHover,
|
|
306
309
|
isLoading: isLoading
|
|
307
310
|
});
|
|
311
|
+
var editorReadonly = isLoading || !!props.typing;
|
|
308
312
|
var sendActionsNode = useSendActionsNode({
|
|
309
313
|
props: {
|
|
310
314
|
attachment: attachment,
|
|
@@ -356,7 +360,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
356
360
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
357
361
|
ref: inputRef,
|
|
358
362
|
"data-testid": testId !== null && testId !== void 0 ? testId : MARKDOWN_INPUT_FIELD_TEST_IDS.ROOT,
|
|
359
|
-
className: classNames(baseCls, hashId, props.className, (_obj = {}, _define_property(_obj, "".concat(baseCls, "-disabled"), props.disabled), _define_property(_obj, "".concat(baseCls, "-skill-mode"), (_props_skillMode = props.skillMode) === null || _props_skillMode === void 0 ? void 0 : _props_skillMode.open), _define_property(_obj, "".concat(baseCls, "-typing"),
|
|
363
|
+
className: classNames(baseCls, hashId, props.className, (_obj = {}, _define_property(_obj, "".concat(baseCls, "-disabled"), props.disabled), _define_property(_obj, "".concat(baseCls, "-skill-mode"), (_props_skillMode = props.skillMode) === null || _props_skillMode === void 0 ? void 0 : _props_skillMode.open), _define_property(_obj, "".concat(baseCls, "-typing"), !!props.typing), _define_property(_obj, "".concat(baseCls, "-loading"), isLoading), _define_property(_obj, "".concat(baseCls, "-is-multi-row"), isMultiRowLayout), _define_property(_obj, "".concat(baseCls, "-enlarged"), isEnlarged), _define_property(_obj, "".concat(baseCls, "-focused"), isFocused), _define_property(_obj, "".concat(baseCls, "-has-tools-wrapper"), !!props.toolsRender), _obj)),
|
|
360
364
|
style: _object_spread_props(_object_spread({}, props.style, enlargedStyle), {
|
|
361
365
|
height: isEnlarged ? "".concat((_ref = (_props_enlargeable = props.enlargeable) === null || _props_enlargeable === void 0 ? void 0 : _props_enlargeable.height) !== null && _ref !== void 0 ? _ref : 980, "px") : "min(".concat(collapsedHeightPx, "px,100%)"),
|
|
362
366
|
borderRadius: borderRadius || 12,
|
|
@@ -397,7 +401,14 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
397
401
|
}), /*#__PURE__*/ React.createElement("div", {
|
|
398
402
|
className: classNames("".concat(baseCls, "-editor-content"), hashId),
|
|
399
403
|
"data-testid": MARKDOWN_INPUT_FIELD_TEST_IDS.EDITOR_CONTENT
|
|
400
|
-
}, attachmentList, /*#__PURE__*/ React.createElement(
|
|
404
|
+
}, attachmentList, (props.typing || isLoading) && !value && /*#__PURE__*/ React.createElement("div", {
|
|
405
|
+
className: classNames("".concat(baseCls, "-typing-hint"), hashId),
|
|
406
|
+
"aria-live": "polite",
|
|
407
|
+
"aria-label": locale['input.typing.hint']
|
|
408
|
+
}, /*#__PURE__*/ React.createElement(TextLoading, {
|
|
409
|
+
text: locale['input.typing.hint'],
|
|
410
|
+
fontSize: 13
|
|
411
|
+
})), /*#__PURE__*/ React.createElement(BaseMarkdownEditor, _object_spread({
|
|
401
412
|
editorRef: markdownEditorRef,
|
|
402
413
|
leafRender: props.leafRender,
|
|
403
414
|
style: {
|
|
@@ -412,7 +423,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
412
423
|
floatBar: {
|
|
413
424
|
enable: false
|
|
414
425
|
},
|
|
415
|
-
readonly:
|
|
426
|
+
readonly: editorReadonly,
|
|
416
427
|
contentStyle: {
|
|
417
428
|
alignItems: 'flex-start',
|
|
418
429
|
padding: 'var(--padding-3x)',
|
|
@@ -475,7 +486,7 @@ var MarkdownInputFieldComponent = function MarkdownInputFieldComponent(_0) {
|
|
|
475
486
|
onFileMapChange: setFileMap,
|
|
476
487
|
isHover: isHover,
|
|
477
488
|
isLoading: isLoading,
|
|
478
|
-
disabled: props.disabled,
|
|
489
|
+
disabled: props.disabled || !!props.typing,
|
|
479
490
|
fileUploadStatus: fileUploadStatus,
|
|
480
491
|
refinePrompt: props.refinePrompt,
|
|
481
492
|
editorRef: markdownEditorRef,
|
|
@@ -90,13 +90,13 @@ import { MARKDOWN_INPUT_FIELD_TEST_IDS } from "../testIds";
|
|
|
90
90
|
var _attachment_onFileMapChange;
|
|
91
91
|
attachment === null || attachment === void 0 ? void 0 : (_attachment_onFileMapChange = attachment.onFileMapChange) === null || _attachment_onFileMapChange === void 0 ? void 0 : _attachment_onFileMapChange.call(attachment, fileMap);
|
|
92
92
|
},
|
|
93
|
-
disabled: !fileUploadDone || (attachment === null || attachment === void 0 ? void 0 : attachment.disabled)
|
|
93
|
+
disabled: !fileUploadDone || (attachment === null || attachment === void 0 ? void 0 : attachment.disabled) || !!typing
|
|
94
94
|
})) : null,
|
|
95
95
|
voiceRecognizer ? /*#__PURE__*/ React.createElement(VoiceInputButton, {
|
|
96
96
|
key: "voice-input-button",
|
|
97
97
|
title: collapseSendActions && defaultActionsLen > 2 ? (locale === null || locale === void 0 ? void 0 : locale['input.voiceInput']) || '语音输入' : '',
|
|
98
98
|
recording: recording,
|
|
99
|
-
disabled: disabled,
|
|
99
|
+
disabled: disabled || !!typing,
|
|
100
100
|
onStart: onStartRecording || function() {
|
|
101
101
|
return Promise.resolve();
|
|
102
102
|
},
|
|
@@ -389,6 +389,7 @@ import { getFileListFromDataTransferItems } from "../FilePaste";
|
|
|
389
389
|
var handleContainerClick = useRefFunction(function(e) {
|
|
390
390
|
var _markdownEditorRef_current_markdownEditorRef, _markdownEditorRef_current;
|
|
391
391
|
if (props.disabled) return;
|
|
392
|
+
if (props.typing) return;
|
|
392
393
|
var editor = markdownEditorRef === null || markdownEditorRef === void 0 ? void 0 : (_markdownEditorRef_current = markdownEditorRef.current) === null || _markdownEditorRef_current === void 0 ? void 0 : (_markdownEditorRef_current_markdownEditorRef = _markdownEditorRef_current.markdownEditorRef) === null || _markdownEditorRef_current_markdownEditorRef === void 0 ? void 0 : _markdownEditorRef_current_markdownEditorRef.current;
|
|
393
394
|
if (!editor) return;
|
|
394
395
|
try {
|
|
@@ -198,7 +198,8 @@ var genStyle = function genStyle(token) {
|
|
|
198
198
|
maxHeight: 'inherit',
|
|
199
199
|
minHeight: 0,
|
|
200
200
|
borderRadius: 'inherit',
|
|
201
|
-
overflow: 'hidden'
|
|
201
|
+
overflow: 'hidden',
|
|
202
|
+
position: 'relative'
|
|
202
203
|
}, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
|
|
203
204
|
padding: "".concat(MOBILE_PADDING, " !important")
|
|
204
205
|
}),
|
|
@@ -215,6 +216,28 @@ var genStyle = function genStyle(token) {
|
|
|
215
216
|
'&-loading': {
|
|
216
217
|
cursor: 'not-allowed'
|
|
217
218
|
},
|
|
219
|
+
'&-typing': {
|
|
220
|
+
cursor: 'not-allowed'
|
|
221
|
+
},
|
|
222
|
+
'&-typing-hint': {
|
|
223
|
+
position: 'absolute',
|
|
224
|
+
left: 'var(--padding-3x)',
|
|
225
|
+
top: '50%',
|
|
226
|
+
transform: 'translateY(-50%)',
|
|
227
|
+
pointerEvents: 'none',
|
|
228
|
+
zIndex: 10,
|
|
229
|
+
display: 'flex',
|
|
230
|
+
alignItems: 'center',
|
|
231
|
+
gap: 6,
|
|
232
|
+
color: 'rgba(0,0,0,0.35)',
|
|
233
|
+
fontSize: 13,
|
|
234
|
+
userSelect: 'none'
|
|
235
|
+
},
|
|
236
|
+
'&-typing-hint-dots': {
|
|
237
|
+
display: 'inline-flex',
|
|
238
|
+
gap: 3,
|
|
239
|
+
alignItems: 'center'
|
|
240
|
+
},
|
|
218
241
|
'&-send-tools': {
|
|
219
242
|
boxSizing: 'border-box',
|
|
220
243
|
display: 'flex',
|
|
@@ -14,7 +14,7 @@ import type { CreateRecognizer } from '../VoiceInput';
|
|
|
14
14
|
* @property {React.CSSProperties} [style] - 应用于输入字段的内联样式
|
|
15
15
|
* @property {string} [className] - 应用于输入字段的 CSS 类名
|
|
16
16
|
* @property {boolean} [disabled] - 是否禁用输入字段
|
|
17
|
-
* @property {boolean} [typing] -
|
|
17
|
+
* @property {boolean} [typing] - AI 回复中等场景下为 true,输入区只读并显示提示
|
|
18
18
|
* @property {'Enter'} [triggerSendKey] - 触发发送操作的键盘快捷键(Enter 发送,Shift+Enter 换行)
|
|
19
19
|
* @property {function} [onSend] - 当内容发送时触发的异步回调函数
|
|
20
20
|
*/
|
|
@@ -51,8 +51,8 @@ export type MarkdownInputFieldProps = {
|
|
|
51
51
|
*/
|
|
52
52
|
disabled?: boolean;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @example typing={
|
|
54
|
+
* 为 true 时表示 AI 正在回复等场景:输入区只读、展示 typing 提示,且不可上传附件或语音输入。
|
|
55
|
+
* @example typing={isAssistantStreaming}
|
|
56
56
|
*/
|
|
57
57
|
typing?: boolean;
|
|
58
58
|
/**
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @property {React.CSSProperties} [style] - 应用于输入字段的内联样式
|
|
9
9
|
* @property {string} [className] - 应用于输入字段的 CSS 类名
|
|
10
10
|
* @property {boolean} [disabled] - 是否禁用输入字段
|
|
11
|
-
* @property {boolean} [typing] -
|
|
11
|
+
* @property {boolean} [typing] - AI 回复中等场景下为 true,输入区只读并显示提示
|
|
12
12
|
* @property {'Enter'} [triggerSendKey] - 触发发送操作的键盘快捷键(Enter 发送,Shift+Enter 换行)
|
|
13
13
|
* @property {function} [onSend] - 当内容发送时触发的异步回调函数
|
|
14
14
|
*/ export { };
|
|
@@ -408,6 +408,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
408
408
|
var i18n = useContext(I18nContext);
|
|
409
409
|
var DonutChart = runtime.DonutChart, FunnelChart = runtime.FunnelChart, AreaChart = runtime.AreaChart, BarChart = runtime.BarChart, BoxPlotChart = runtime.BoxPlotChart, HistogramChart = runtime.HistogramChart, LineChart = runtime.LineChart, RadarChart = runtime.RadarChart, ScatterChart = runtime.ScatterChart;
|
|
410
410
|
if (chartType === 'pie') {
|
|
411
|
+
var pieSize = (config === null || config === void 0 ? void 0 : config.height) || 400;
|
|
411
412
|
return /*#__PURE__*/ React.createElement(DonutChart, {
|
|
412
413
|
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-pie"),
|
|
413
414
|
data: convertDonutData,
|
|
@@ -417,7 +418,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
417
418
|
showLegend: true
|
|
418
419
|
}
|
|
419
420
|
],
|
|
420
|
-
|
|
421
|
+
width: pieSize,
|
|
422
|
+
height: pieSize,
|
|
421
423
|
title: title,
|
|
422
424
|
showToolbar: true,
|
|
423
425
|
dataTime: dataTime,
|
|
@@ -578,7 +578,7 @@ import { useStyle } from "./style";
|
|
|
578
578
|
'transparent'
|
|
579
579
|
] : resolvedVisibleBackgroundColors.slice(0, values.length),
|
|
580
580
|
hoverBorderColor: chartHoverBorderColor,
|
|
581
|
-
borderWidth: cfg.chartStyle === 'pie' ?
|
|
581
|
+
borderWidth: cfg.chartStyle === 'pie' ? 2 : isMobile ? 1 : 1,
|
|
582
582
|
spacing: isSingleValueMode ? 0 : cfg.chartStyle === 'pie' ? 0 : isDarkTheme ? isMobile ? 4 : 8 : isMobile ? 3 : 6,
|
|
583
583
|
borderRadius: cfg.chartStyle === 'pie' ? 0 : 4,
|
|
584
584
|
hoverOffset: function hoverOffset(ctx) {
|
|
@@ -308,6 +308,8 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
308
308
|
'workspace.fileProcessError': string;
|
|
309
309
|
'workspace.download': string;
|
|
310
310
|
'workspace.empty': string;
|
|
311
|
+
'workspace.file.showMore': string;
|
|
312
|
+
'workspace.file.showMoreFiles': string;
|
|
311
313
|
'workspace.title': string;
|
|
312
314
|
'workspace.searchPlaceholder': string;
|
|
313
315
|
'workspace.noResultsFor': string;
|
|
@@ -352,7 +354,6 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
352
354
|
'suggestion.followUp': string;
|
|
353
355
|
'input.fileUpload': string;
|
|
354
356
|
'input.attachmentListTitle': string;
|
|
355
|
-
'chat.fileMapTitle': string;
|
|
356
357
|
'input.voiceInput': string;
|
|
357
358
|
'input.voiceInputting': string;
|
|
358
359
|
'input.placeholder': string;
|
|
@@ -364,6 +365,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
364
365
|
'input.sendButtonTooltip.newline': string;
|
|
365
366
|
'input.sendButtonTooltip.send.mod': string;
|
|
366
367
|
'input.sendButtonTooltip.newline.mod': string;
|
|
368
|
+
'input.typing.hint': string;
|
|
367
369
|
'common.name': string;
|
|
368
370
|
'common.updateTime': string;
|
|
369
371
|
'common.type': string;
|
|
@@ -704,6 +706,8 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
704
706
|
'workspace.fileProcessError': string;
|
|
705
707
|
'workspace.download': string;
|
|
706
708
|
'workspace.empty': string;
|
|
709
|
+
'workspace.file.showMore': string;
|
|
710
|
+
'workspace.file.showMoreFiles': string;
|
|
707
711
|
'workspace.title': string;
|
|
708
712
|
'workspace.searchPlaceholder': string;
|
|
709
713
|
'workspace.noResultsFor': string;
|
|
@@ -748,7 +752,6 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
748
752
|
'suggestion.followUp': string;
|
|
749
753
|
'input.fileUpload': string;
|
|
750
754
|
'input.attachmentListTitle': string;
|
|
751
|
-
'chat.fileMapTitle': string;
|
|
752
755
|
'input.voiceInput': string;
|
|
753
756
|
'input.voiceInputting': string;
|
|
754
757
|
'input.placeholder': string;
|
|
@@ -760,6 +763,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
760
763
|
'input.sendButtonTooltip.newline': string;
|
|
761
764
|
'input.sendButtonTooltip.send.mod': string;
|
|
762
765
|
'input.sendButtonTooltip.newline.mod': string;
|
|
766
|
+
'input.typing.hint': string;
|
|
763
767
|
'common.name': string;
|
|
764
768
|
'common.updateTime': string;
|
|
765
769
|
'common.type': string;
|
|
@@ -241,13 +241,16 @@ import { Empty } from "antd";
|
|
|
241
241
|
import classNames from "clsx";
|
|
242
242
|
import { AnimatePresence, motion } from "framer-motion";
|
|
243
243
|
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
244
|
+
import { useRefFunction } from "../../Hooks/useRefFunction";
|
|
244
245
|
import { ActionIconBox } from "../../Components/ActionIconBox";
|
|
245
|
-
import { I18nContext } from "../../I18n";
|
|
246
|
+
import { I18nContext, compileTemplate } from "../../I18n";
|
|
246
247
|
import { formatFileSize, formatLastModified } from "../utils";
|
|
247
248
|
import { fileTypeProcessor, isImageFile } from "./FileTypeProcessor";
|
|
248
249
|
import { PreviewComponent } from "./PreviewComponent";
|
|
249
250
|
import { useFileStyle } from "./style";
|
|
250
251
|
import { generateUniqueId, getFileTypeIcon, getGroupIcon } from "./utils";
|
|
252
|
+
/** Initial number of files shown per group before "show more" */ var GROUP_INITIAL_PAGE_SIZE = 50;
|
|
253
|
+
/** Number of additional files revealed per "show more" click */ var GROUP_PAGE_SIZE_INCREMENT = 100;
|
|
251
254
|
// 通用的键盘事件处理函数
|
|
252
255
|
var handleKeyboardEvent = function handleKeyboardEvent(e, callback) {
|
|
253
256
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
@@ -373,11 +376,8 @@ var SearchInput = /*#__PURE__*/ React.memo(function(param) {
|
|
|
373
376
|
});
|
|
374
377
|
SearchInput.displayName = 'SearchInput';
|
|
375
378
|
// 文件项组件
|
|
376
|
-
var FileItemComponent =
|
|
377
|
-
var file = param.file, onClick = param.onClick, onDownload = param.onDownload, onPreview = param.onPreview, onShare = param.onShare, onLocate = param.onLocate, prefixCls = param.prefixCls, hashId = param.hashId, _param_bindDomId = param.bindDomId, bindDomId = _param_bindDomId === void 0 ? false : _param_bindDomId;
|
|
378
|
-
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
379
|
-
var locale = useContext(I18nContext).locale;
|
|
380
|
-
var finalPrefixCls = prefixCls || getPrefixCls('workspace-file');
|
|
379
|
+
var FileItemComponent = /*#__PURE__*/ React.memo(function(param) {
|
|
380
|
+
var file = param.file, onClick = param.onClick, onDownload = param.onDownload, onPreview = param.onPreview, onShare = param.onShare, onLocate = param.onLocate, prefixCls = param.prefixCls, hashId = param.hashId, locale = param.locale, _param_bindDomId = param.bindDomId, bindDomId = _param_bindDomId === void 0 ? false : _param_bindDomId;
|
|
381
381
|
// 确保文件有唯一ID
|
|
382
382
|
var fileWithId = ensureNodeWithId(file);
|
|
383
383
|
var fileTypeInfo = fileTypeProcessor.inferFileType(fileWithId);
|
|
@@ -447,7 +447,7 @@ var FileItemComponent = function FileItemComponent(param) {
|
|
|
447
447
|
onLocate === null || onLocate === void 0 ? void 0 : onLocate(fileWithId);
|
|
448
448
|
};
|
|
449
449
|
// 内置操作按钮
|
|
450
|
-
var actionBtnClass = classNames("".concat(
|
|
450
|
+
var actionBtnClass = classNames("".concat(prefixCls, "-item-action-btn"), hashId);
|
|
451
451
|
var builtinActions = {
|
|
452
452
|
preview: showPreviewButton ? /*#__PURE__*/ React.createElement(ActionIconBox, {
|
|
453
453
|
key: "preview",
|
|
@@ -489,55 +489,52 @@ var FileItemComponent = function FileItemComponent(param) {
|
|
|
489
489
|
// 自定义渲染上下文
|
|
490
490
|
var renderContext = {
|
|
491
491
|
file: fileWithId,
|
|
492
|
-
prefixCls:
|
|
493
|
-
hashId: hashId
|
|
492
|
+
prefixCls: prefixCls,
|
|
493
|
+
hashId: hashId,
|
|
494
494
|
disabled: isDisabled,
|
|
495
495
|
actions: builtinActions
|
|
496
496
|
};
|
|
497
497
|
return /*#__PURE__*/ React.createElement(AccessibleButton, {
|
|
498
498
|
icon: /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
|
|
499
|
-
className: classNames("".concat(
|
|
499
|
+
className: classNames("".concat(prefixCls, "-item-icon"), hashId)
|
|
500
500
|
}, getFileTypeIcon(fileTypeInfo.fileType, fileWithId.icon, fileWithId.name)), /*#__PURE__*/ React.createElement("div", {
|
|
501
|
-
className: classNames("".concat(
|
|
501
|
+
className: classNames("".concat(prefixCls, "-item-info"), hashId)
|
|
502
502
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
503
|
-
className: classNames("".concat(
|
|
503
|
+
className: classNames("".concat(prefixCls, "-item-name"), hashId)
|
|
504
504
|
}, fileWithId.renderName ? fileWithId.renderName(renderContext) : /*#__PURE__*/ React.createElement(Typography.Text, {
|
|
505
505
|
ellipsis: {
|
|
506
506
|
tooltip: fileWithId.name
|
|
507
507
|
}
|
|
508
508
|
}, fileWithId.name)), (fileWithId.renderDetails || fileTypeInfo.displayType || fileWithId.size || fileWithId.lastModified) && /*#__PURE__*/ React.createElement("div", {
|
|
509
|
-
className: classNames("".concat(
|
|
509
|
+
className: classNames("".concat(prefixCls, "-item-details"), hashId)
|
|
510
510
|
}, fileWithId.renderDetails ? fileWithId.renderDetails(renderContext) : /*#__PURE__*/ React.createElement(Typography.Text, {
|
|
511
511
|
type: "secondary",
|
|
512
512
|
ellipsis: true
|
|
513
513
|
}, fileTypeInfo.displayType && /*#__PURE__*/ React.createElement("span", {
|
|
514
|
-
className: classNames("".concat(
|
|
514
|
+
className: classNames("".concat(prefixCls, "-item-type"), hashId)
|
|
515
515
|
}, fileTypeInfo.displayType), fileWithId.size && /*#__PURE__*/ React.createElement(React.Fragment, null, fileTypeInfo.displayType && /*#__PURE__*/ React.createElement("span", {
|
|
516
|
-
className: classNames("".concat(
|
|
516
|
+
className: classNames("".concat(prefixCls, "-item-separator"), hashId)
|
|
517
517
|
}, "|"), /*#__PURE__*/ React.createElement("span", {
|
|
518
|
-
className: classNames("".concat(
|
|
518
|
+
className: classNames("".concat(prefixCls, "-item-size"), hashId)
|
|
519
519
|
}, formatFileSize(fileWithId.size))), fileWithId.lastModified && /*#__PURE__*/ React.createElement(React.Fragment, null, (fileTypeInfo.displayType || fileWithId.size) && /*#__PURE__*/ React.createElement("span", {
|
|
520
|
-
className: classNames("".concat(
|
|
520
|
+
className: classNames("".concat(prefixCls, "-item-separator"), hashId)
|
|
521
521
|
}, "|"), /*#__PURE__*/ React.createElement("span", {
|
|
522
|
-
className: classNames("".concat(
|
|
522
|
+
className: classNames("".concat(prefixCls, "-item-time"), hashId)
|
|
523
523
|
}, formatLastModified(fileWithId.lastModified)))))), /*#__PURE__*/ React.createElement("div", {
|
|
524
|
-
className: classNames("".concat(
|
|
524
|
+
className: classNames("".concat(prefixCls, "-item-actions"), hashId),
|
|
525
525
|
onClick: function onClick(e) {
|
|
526
526
|
return e.stopPropagation();
|
|
527
527
|
}
|
|
528
528
|
}, fileWithId.renderActions ? fileWithId.renderActions(renderContext) : !isDisabled ? /*#__PURE__*/ React.createElement(React.Fragment, null, builtinActions.preview, builtinActions.locate, builtinActions.share, builtinActions.download) : null)),
|
|
529
529
|
onClick: handleClick,
|
|
530
|
-
className: classNames("".concat(
|
|
530
|
+
className: classNames("".concat(prefixCls, "-item"), _define_property({}, "".concat(prefixCls, "-item-disabled"), isDisabled), hashId),
|
|
531
531
|
ariaLabel: "".concat((locale === null || locale === void 0 ? void 0 : locale['workspace.file']) || '文件', ":").concat(fileWithId.name),
|
|
532
532
|
id: bindDomId ? fileWithId.id : undefined
|
|
533
533
|
});
|
|
534
|
-
};
|
|
534
|
+
});
|
|
535
535
|
// 分组标题栏组件
|
|
536
|
-
var GroupHeader =
|
|
537
|
-
var group = param.group, onToggle = param.onToggle, onGroupDownload = param.onGroupDownload, prefixCls = param.prefixCls, hashId = param.hashId;
|
|
538
|
-
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
539
|
-
var locale = useContext(I18nContext).locale;
|
|
540
|
-
var finalPrefixCls = prefixCls || getPrefixCls('workspace-file');
|
|
536
|
+
var GroupHeader = /*#__PURE__*/ React.memo(function(param) {
|
|
537
|
+
var group = param.group, onToggle = param.onToggle, onGroupDownload = param.onGroupDownload, prefixCls = param.prefixCls, hashId = param.hashId, locale = param.locale;
|
|
541
538
|
var groupTypeInfo = fileTypeProcessor.inferFileType(group);
|
|
542
539
|
var groupType = group.type || groupTypeInfo.fileType;
|
|
543
540
|
var handleToggle = function handleToggle() {
|
|
@@ -565,35 +562,60 @@ var GroupHeader = function GroupHeader(param) {
|
|
|
565
562
|
}();
|
|
566
563
|
return /*#__PURE__*/ React.createElement(AccessibleButton, {
|
|
567
564
|
icon: /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
|
|
568
|
-
className: classNames("".concat(
|
|
565
|
+
className: classNames("".concat(prefixCls, "-group-header-left"), hashId)
|
|
569
566
|
}, /*#__PURE__*/ React.createElement(CollapseIcon, {
|
|
570
|
-
className: classNames("".concat(
|
|
567
|
+
className: classNames("".concat(prefixCls, "-group-toggle-icon"), hashId)
|
|
571
568
|
}), /*#__PURE__*/ React.createElement("div", {
|
|
572
|
-
className: classNames("".concat(
|
|
569
|
+
className: classNames("".concat(prefixCls, "-group-type-icon"), hashId)
|
|
573
570
|
}, groupIcon), /*#__PURE__*/ React.createElement("span", {
|
|
574
|
-
className: classNames("".concat(
|
|
571
|
+
className: classNames("".concat(prefixCls, "-group-type-name"), hashId)
|
|
575
572
|
}, group.name)), /*#__PURE__*/ React.createElement("div", {
|
|
576
|
-
className: classNames("".concat(
|
|
573
|
+
className: classNames("".concat(prefixCls, "-group-header-right"), hashId)
|
|
577
574
|
}, /*#__PURE__*/ React.createElement("span", {
|
|
578
|
-
className: classNames("".concat(
|
|
575
|
+
className: classNames("".concat(prefixCls, "-group-count"), hashId)
|
|
579
576
|
}, group.children.length), showDownloadButton && /*#__PURE__*/ React.createElement(ActionIconBox, {
|
|
580
577
|
title: (locale === null || locale === void 0 ? void 0 : locale['workspace.file.download']) || '下载',
|
|
581
578
|
onClick: handleDownload,
|
|
582
579
|
tooltipProps: {
|
|
583
580
|
mouseEnterDelay: 0.3
|
|
584
581
|
},
|
|
585
|
-
className: classNames("".concat(
|
|
582
|
+
className: classNames("".concat(prefixCls, "-group-action-btn"), hashId)
|
|
586
583
|
}, /*#__PURE__*/ React.createElement(DownloadIcon, null)))),
|
|
587
584
|
onClick: handleToggle,
|
|
588
|
-
className: classNames("".concat(
|
|
585
|
+
className: classNames("".concat(prefixCls, "-group-header"), hashId),
|
|
589
586
|
ariaLabel: "".concat(group.collapsed ? (locale === null || locale === void 0 ? void 0 : locale['workspace.expand']) || '展开' : (locale === null || locale === void 0 ? void 0 : locale['workspace.collapse']) || '收起').concat(group.name).concat((locale === null || locale === void 0 ? void 0 : locale['workspace.group']) || '分组')
|
|
590
587
|
});
|
|
591
|
-
};
|
|
588
|
+
});
|
|
592
589
|
// 文件分组组件
|
|
593
|
-
var FileGroupComponent =
|
|
594
|
-
var group = param.group, onToggle = param.onToggle, onGroupDownload = param.onGroupDownload, onDownload = param.onDownload, onFileClick = param.onFileClick, onPreview = param.onPreview, onShare = param.onShare, onLocate = param.onLocate, prefixCls = param.prefixCls, hashId = param.hashId, bindDomId = param.bindDomId;
|
|
595
|
-
var
|
|
596
|
-
|
|
590
|
+
var FileGroupComponent = /*#__PURE__*/ React.memo(function(param) {
|
|
591
|
+
var group = param.group, onToggle = param.onToggle, onGroupDownload = param.onGroupDownload, onDownload = param.onDownload, onFileClick = param.onFileClick, onPreview = param.onPreview, onShare = param.onShare, onLocate = param.onLocate, prefixCls = param.prefixCls, hashId = param.hashId, locale = param.locale, bindDomId = param.bindDomId;
|
|
592
|
+
var _useState = _sliced_to_array(useState(GROUP_INITIAL_PAGE_SIZE), 2), visibleCount = _useState[0], setVisibleCount = _useState[1];
|
|
593
|
+
// 分组数据变化时重置分页,避免切换数据源后一次性展示过多节点
|
|
594
|
+
useEffect(function() {
|
|
595
|
+
setVisibleCount(GROUP_INITIAL_PAGE_SIZE);
|
|
596
|
+
}, [
|
|
597
|
+
group.id,
|
|
598
|
+
group.children.length
|
|
599
|
+
]);
|
|
600
|
+
var totalCount = group.children.length;
|
|
601
|
+
var visibleFiles = group.children.slice(0, visibleCount);
|
|
602
|
+
var remainingCount = totalCount - visibleCount;
|
|
603
|
+
var hasMore = remainingCount > 0;
|
|
604
|
+
var handleShowMore = useRefFunction(function(e) {
|
|
605
|
+
e.stopPropagation();
|
|
606
|
+
setVisibleCount(function(prev) {
|
|
607
|
+
return prev + GROUP_PAGE_SIZE_INCREMENT;
|
|
608
|
+
});
|
|
609
|
+
});
|
|
610
|
+
var handleShowMoreKeyDown = useRefFunction(function(e) {
|
|
611
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
612
|
+
e.preventDefault();
|
|
613
|
+
e.stopPropagation();
|
|
614
|
+
setVisibleCount(function(prev) {
|
|
615
|
+
return prev + GROUP_PAGE_SIZE_INCREMENT;
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
});
|
|
597
619
|
var contentVariants = useMemo(function() {
|
|
598
620
|
return {
|
|
599
621
|
expanded: {
|
|
@@ -623,14 +645,18 @@ var FileGroupComponent = function FileGroupComponent(param) {
|
|
|
623
645
|
}
|
|
624
646
|
};
|
|
625
647
|
}, []);
|
|
648
|
+
var showMoreLabel = hasMore ? compileTemplate((locale === null || locale === void 0 ? void 0 : locale['workspace.file.showMore']) || '查看更多(还有 ${count} 个)', {
|
|
649
|
+
count: String(remainingCount)
|
|
650
|
+
}) : (locale === null || locale === void 0 ? void 0 : locale['workspace.file.showMoreFiles']) || '查看更多文件';
|
|
626
651
|
return /*#__PURE__*/ React.createElement("div", {
|
|
627
|
-
className: classNames("".concat(
|
|
652
|
+
className: classNames("".concat(prefixCls, "-container--group"), hashId)
|
|
628
653
|
}, /*#__PURE__*/ React.createElement(GroupHeader, {
|
|
629
654
|
group: group,
|
|
630
655
|
onToggle: onToggle,
|
|
631
656
|
onGroupDownload: onGroupDownload,
|
|
632
|
-
prefixCls:
|
|
633
|
-
hashId: hashId
|
|
657
|
+
prefixCls: prefixCls,
|
|
658
|
+
hashId: hashId,
|
|
659
|
+
locale: locale
|
|
634
660
|
}), /*#__PURE__*/ React.createElement(AnimatePresence, {
|
|
635
661
|
initial: false
|
|
636
662
|
}, !group.collapsed && /*#__PURE__*/ React.createElement(motion.div, {
|
|
@@ -640,8 +666,8 @@ var FileGroupComponent = function FileGroupComponent(param) {
|
|
|
640
666
|
animate: "expanded",
|
|
641
667
|
exit: "collapsed",
|
|
642
668
|
transition: contentTransition,
|
|
643
|
-
className: classNames("".concat(
|
|
644
|
-
},
|
|
669
|
+
className: classNames("".concat(prefixCls, "-group-content"), hashId)
|
|
670
|
+
}, visibleFiles.map(function(file) {
|
|
645
671
|
return /*#__PURE__*/ React.createElement(FileItemComponent, {
|
|
646
672
|
key: file.id,
|
|
647
673
|
file: file,
|
|
@@ -650,12 +676,20 @@ var FileGroupComponent = function FileGroupComponent(param) {
|
|
|
650
676
|
onPreview: onPreview,
|
|
651
677
|
onShare: onShare,
|
|
652
678
|
onLocate: onLocate,
|
|
653
|
-
prefixCls:
|
|
679
|
+
prefixCls: prefixCls,
|
|
654
680
|
hashId: hashId,
|
|
681
|
+
locale: locale,
|
|
655
682
|
bindDomId: !!bindDomId
|
|
656
683
|
});
|
|
657
|
-
})
|
|
658
|
-
|
|
684
|
+
}), hasMore && /*#__PURE__*/ React.createElement("div", {
|
|
685
|
+
role: "button",
|
|
686
|
+
tabIndex: 0,
|
|
687
|
+
className: classNames("".concat(prefixCls, "-show-more"), hashId),
|
|
688
|
+
onClick: handleShowMore,
|
|
689
|
+
onKeyDown: handleShowMoreKeyDown,
|
|
690
|
+
"aria-label": showMoreLabel
|
|
691
|
+
}, showMoreLabel))));
|
|
692
|
+
});
|
|
659
693
|
export var FileComponent = function FileComponent(param) {
|
|
660
694
|
var nodes = param.nodes, onGroupDownload = param.onGroupDownload, onDownload = param.onDownload, onShare = param.onShare, onFileClick = param.onFileClick, onLocate = param.onLocate, onToggleGroup = param.onToggleGroup, onGroupToggle = param.onGroupToggle, onPreview = param.onPreview, onBack = param.onBack, resetKey = param.resetKey, markdownEditorProps = param.markdownEditorProps, customActions = param.customActions, actionRef = param.actionRef, loading = param.loading, loadingRender = param.loadingRender, emptyRender = param.emptyRender, keyword = param.keyword, onChange = param.onChange, _param_showSearch = param.showSearch, showSearch = _param_showSearch === void 0 ? false : _param_showSearch, searchPlaceholder = param.searchPlaceholder, _param_bindDomId = param.bindDomId, bindDomId = _param_bindDomId === void 0 ? false : _param_bindDomId;
|
|
661
695
|
var _useState = _sliced_to_array(useState(null), 2), previewFile = _useState[0], setPreviewFile = _useState[1];
|
|
@@ -669,6 +703,15 @@ export var FileComponent = function FileComponent(param) {
|
|
|
669
703
|
}), 2), imagePreview = _useState4[0], setImagePreview = _useState4[1];
|
|
670
704
|
// 添加内部状态来管理分组的折叠状态
|
|
671
705
|
var _useState5 = _sliced_to_array(useState({}), 2), collapsedGroups = _useState5[0], setCollapsedGroups = _useState5[1];
|
|
706
|
+
// 扁平文件列表(非分组模式)分页状态
|
|
707
|
+
var _useState6 = _sliced_to_array(useState(GROUP_INITIAL_PAGE_SIZE), 2), flatVisibleCount = _useState6[0], setFlatVisibleCount = _useState6[1];
|
|
708
|
+
// nodes 或 keyword 变化时重置扁平列表分页,避免切换数据源后一次性渲染过多节点
|
|
709
|
+
useEffect(function() {
|
|
710
|
+
setFlatVisibleCount(GROUP_INITIAL_PAGE_SIZE);
|
|
711
|
+
}, [
|
|
712
|
+
nodes,
|
|
713
|
+
keyword
|
|
714
|
+
]);
|
|
672
715
|
// 追踪预览请求的序号,避免异步竞态
|
|
673
716
|
var previewRequestIdRef = useRef(0);
|
|
674
717
|
// 缓存节点 ID,避免每次渲染重新生成(使用 WeakMap 自动清理不再使用的节点)
|
|
@@ -680,7 +723,7 @@ export var FileComponent = function FileComponent(param) {
|
|
|
680
723
|
var prefixCls = getPrefixCls('workspace-file');
|
|
681
724
|
var _useFileStyle = useFileStyle(prefixCls), wrapSSR = _useFileStyle.wrapSSR, hashId = _useFileStyle.hashId;
|
|
682
725
|
// 确保节点有稳定的唯一 ID(使用缓存)
|
|
683
|
-
var ensureNodeWithStableId = function
|
|
726
|
+
var ensureNodeWithStableId = useRefFunction(function(node) {
|
|
684
727
|
if (node.id) return _object_spread({}, node);
|
|
685
728
|
// 尝试从缓存获取 ID
|
|
686
729
|
var cachedId = nodeIdCacheRef.current.get(node);
|
|
@@ -692,16 +735,16 @@ export var FileComponent = function FileComponent(param) {
|
|
|
692
735
|
return _object_spread_props(_object_spread({}, node), {
|
|
693
736
|
id: cachedId
|
|
694
737
|
});
|
|
695
|
-
};
|
|
738
|
+
});
|
|
696
739
|
// 返回列表(供预览页调用)
|
|
697
|
-
var handleBackToList = function
|
|
740
|
+
var handleBackToList = useRefFunction(function() {
|
|
698
741
|
// 使进行中的预览请求失效
|
|
699
742
|
previewRequestIdRef.current++;
|
|
700
743
|
setPreviewFile(null);
|
|
701
744
|
setCustomPreviewContent(null);
|
|
702
745
|
setCustomPreviewHeader(null);
|
|
703
746
|
setHeaderFileOverride(null);
|
|
704
|
-
};
|
|
747
|
+
});
|
|
705
748
|
// 监听 resetKey 变化,重置预览状态
|
|
706
749
|
useEffect(function() {
|
|
707
750
|
if (resetKey !== undefined && previewFile) {
|
|
@@ -756,7 +799,7 @@ export var FileComponent = function FileComponent(param) {
|
|
|
756
799
|
nodes
|
|
757
800
|
]);
|
|
758
801
|
// 处理分组折叠/展开
|
|
759
|
-
var handleToggleGroup = function
|
|
802
|
+
var handleToggleGroup = useRefFunction(function(groupId, type, collapsed) {
|
|
760
803
|
// 更新内部状态,使用 groupId 作为 key
|
|
761
804
|
setCollapsedGroups(function(prev) {
|
|
762
805
|
return _object_spread_props(_object_spread({}, prev), _define_property({}, groupId, collapsed));
|
|
@@ -767,9 +810,9 @@ export var FileComponent = function FileComponent(param) {
|
|
|
767
810
|
} else if (onToggleGroup) {
|
|
768
811
|
onToggleGroup(type, collapsed);
|
|
769
812
|
}
|
|
770
|
-
};
|
|
813
|
+
});
|
|
771
814
|
// 包装后的返回逻辑,允许外部拦截
|
|
772
|
-
var handleBack = function
|
|
815
|
+
var handleBack = useRefFunction(function() {
|
|
773
816
|
return _async_to_generator(function() {
|
|
774
817
|
var result, _;
|
|
775
818
|
return _ts_generator(this, function(_state) {
|
|
@@ -814,18 +857,18 @@ export var FileComponent = function FileComponent(param) {
|
|
|
814
857
|
}
|
|
815
858
|
});
|
|
816
859
|
})();
|
|
817
|
-
};
|
|
860
|
+
});
|
|
818
861
|
// 预览页面的下载(供预览页调用)
|
|
819
|
-
var handleDownloadInPreview = function
|
|
862
|
+
var handleDownloadInPreview = useRefFunction(function(file) {
|
|
820
863
|
// 优先使用用户传入的下载方法
|
|
821
864
|
if (onDownload) {
|
|
822
865
|
onDownload(file);
|
|
823
866
|
return;
|
|
824
867
|
}
|
|
825
868
|
handleFileDownload(file);
|
|
826
|
-
};
|
|
869
|
+
});
|
|
827
870
|
// 预览文件处理
|
|
828
|
-
var handlePreview = function
|
|
871
|
+
var handlePreview = useRefFunction(function(file) {
|
|
829
872
|
return _async_to_generator(function() {
|
|
830
873
|
var currentCallId, previewData, content, err, previewSrc;
|
|
831
874
|
return _ts_generator(this, function(_state) {
|
|
@@ -935,7 +978,7 @@ export var FileComponent = function FileComponent(param) {
|
|
|
935
978
|
}
|
|
936
979
|
});
|
|
937
980
|
})();
|
|
938
|
-
};
|
|
981
|
+
});
|
|
939
982
|
// 通过 actionRef 暴露可编程接口
|
|
940
983
|
React.useEffect(function() {
|
|
941
984
|
if (!actionRef) return;
|
|
@@ -963,7 +1006,7 @@ export var FileComponent = function FileComponent(param) {
|
|
|
963
1006
|
]);
|
|
964
1007
|
var hasKeyword = Boolean((keyword !== null && keyword !== void 0 ? keyword : '').trim());
|
|
965
1008
|
// 渲染搜索框组件 - 确保在所有情况下都保持一致
|
|
966
|
-
var renderSearchInput = function
|
|
1009
|
+
var renderSearchInput = useRefFunction(function() {
|
|
967
1010
|
if (!showSearch) return null;
|
|
968
1011
|
return /*#__PURE__*/ React.createElement(SearchInput, {
|
|
969
1012
|
keyword: keyword,
|
|
@@ -973,9 +1016,9 @@ export var FileComponent = function FileComponent(param) {
|
|
|
973
1016
|
hashId: hashId,
|
|
974
1017
|
locale: locale
|
|
975
1018
|
});
|
|
976
|
-
};
|
|
1019
|
+
});
|
|
977
1020
|
// 渲染空状态内容
|
|
978
|
-
var renderEmptyContent = function
|
|
1021
|
+
var renderEmptyContent = useRefFunction(function() {
|
|
979
1022
|
if (hasKeyword) {
|
|
980
1023
|
return /*#__PURE__*/ React.createElement(Typography.Text, {
|
|
981
1024
|
type: "secondary"
|
|
@@ -987,48 +1030,20 @@ export var FileComponent = function FileComponent(param) {
|
|
|
987
1030
|
return emptyRender !== null && emptyRender !== void 0 ? emptyRender : /*#__PURE__*/ React.createElement(Empty, {
|
|
988
1031
|
description: (locale === null || locale === void 0 ? void 0 : locale['workspace.empty']) || 'No data'
|
|
989
1032
|
});
|
|
990
|
-
};
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
visible: visible
|
|
1001
|
-
});
|
|
1002
|
-
});
|
|
1003
|
-
}
|
|
1033
|
+
});
|
|
1034
|
+
var handleFlatShowMore = useRefFunction(function() {
|
|
1035
|
+
setFlatVisibleCount(function(prev) {
|
|
1036
|
+
return prev + GROUP_PAGE_SIZE_INCREMENT;
|
|
1037
|
+
});
|
|
1038
|
+
});
|
|
1039
|
+
var handleFlatShowMoreKeyDown = useRefFunction(function(e) {
|
|
1040
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
1041
|
+
e.preventDefault();
|
|
1042
|
+
handleFlatShowMore();
|
|
1004
1043
|
}
|
|
1005
1044
|
});
|
|
1006
|
-
// 如果正在预览文件,显示预览组件
|
|
1007
|
-
if (previewFile) {
|
|
1008
|
-
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(PreviewComponent, {
|
|
1009
|
-
file: previewFile,
|
|
1010
|
-
onBack: handleBack,
|
|
1011
|
-
onDownload: handleDownloadInPreview,
|
|
1012
|
-
onShare: function onShare1(file, options) {
|
|
1013
|
-
if (onShare) {
|
|
1014
|
-
onShare(file, {
|
|
1015
|
-
anchorEl: options === null || options === void 0 ? void 0 : options.anchorEl,
|
|
1016
|
-
origin: 'preview'
|
|
1017
|
-
});
|
|
1018
|
-
} else {
|
|
1019
|
-
handleDefaultShare(file);
|
|
1020
|
-
}
|
|
1021
|
-
},
|
|
1022
|
-
onLocate: onLocate,
|
|
1023
|
-
customContent: customPreviewContent || undefined,
|
|
1024
|
-
customHeader: customPreviewHeader || undefined,
|
|
1025
|
-
customActions: typeof customActions === 'function' ? customActions(previewFile) : customActions,
|
|
1026
|
-
headerFileOverride: headerFileOverride || undefined,
|
|
1027
|
-
markdownEditorProps: markdownEditorProps
|
|
1028
|
-
}), ImagePreviewComponent);
|
|
1029
|
-
}
|
|
1030
1045
|
// 渲染文件内容
|
|
1031
|
-
var renderFileContent = function
|
|
1046
|
+
var renderFileContent = useRefFunction(function() {
|
|
1032
1047
|
if ((!nodes || nodes.length === 0) && !loading) {
|
|
1033
1048
|
return /*#__PURE__*/ React.createElement("div", {
|
|
1034
1049
|
className: classNames("".concat(prefixCls, "-empty"), hashId)
|
|
@@ -1039,7 +1054,14 @@ export var FileComponent = function FileComponent(param) {
|
|
|
1039
1054
|
className: classNames("".concat(prefixCls, "-empty"), hashId)
|
|
1040
1055
|
}, renderEmptyContent());
|
|
1041
1056
|
}
|
|
1042
|
-
|
|
1057
|
+
// Determine whether this is a purely flat list (no groups) so we can paginate
|
|
1058
|
+
var isFlat = safeNodes.every(function(n) {
|
|
1059
|
+
return !('children' in n);
|
|
1060
|
+
});
|
|
1061
|
+
var nodesToRender = isFlat ? safeNodes.slice(0, flatVisibleCount) : safeNodes;
|
|
1062
|
+
var flatRemaining = isFlat ? safeNodes.length - flatVisibleCount : 0;
|
|
1063
|
+
var flatHasMore = flatRemaining > 0;
|
|
1064
|
+
var items = nodesToRender.map(function(node) {
|
|
1043
1065
|
var nodeWithId = ensureNodeWithStableId(node);
|
|
1044
1066
|
if ('children' in nodeWithId) {
|
|
1045
1067
|
var _collapsedGroups_nodeWithId_id;
|
|
@@ -1061,6 +1083,7 @@ export var FileComponent = function FileComponent(param) {
|
|
|
1061
1083
|
onLocate: onLocate,
|
|
1062
1084
|
prefixCls: prefixCls,
|
|
1063
1085
|
hashId: hashId,
|
|
1086
|
+
locale: locale,
|
|
1064
1087
|
bindDomId: bindDomId
|
|
1065
1088
|
});
|
|
1066
1089
|
}
|
|
@@ -1075,10 +1098,62 @@ export var FileComponent = function FileComponent(param) {
|
|
|
1075
1098
|
onLocate: onLocate,
|
|
1076
1099
|
prefixCls: prefixCls,
|
|
1077
1100
|
hashId: hashId,
|
|
1101
|
+
locale: locale,
|
|
1078
1102
|
bindDomId: bindDomId
|
|
1079
1103
|
});
|
|
1080
1104
|
});
|
|
1081
|
-
|
|
1105
|
+
if (!flatHasMore) return items;
|
|
1106
|
+
var flatShowMoreLabel = compileTemplate((locale === null || locale === void 0 ? void 0 : locale['workspace.file.showMore']) || '查看更多(还有 ${count} 个)', {
|
|
1107
|
+
count: String(flatRemaining)
|
|
1108
|
+
});
|
|
1109
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, items, /*#__PURE__*/ React.createElement("div", {
|
|
1110
|
+
role: "button",
|
|
1111
|
+
tabIndex: 0,
|
|
1112
|
+
className: classNames("".concat(prefixCls, "-show-more"), hashId),
|
|
1113
|
+
onClick: handleFlatShowMore,
|
|
1114
|
+
onKeyDown: handleFlatShowMoreKeyDown,
|
|
1115
|
+
"aria-label": flatShowMoreLabel
|
|
1116
|
+
}, flatShowMoreLabel));
|
|
1117
|
+
});
|
|
1118
|
+
// 图片预览组件
|
|
1119
|
+
var ImagePreviewComponent = /*#__PURE__*/ React.createElement(Image, {
|
|
1120
|
+
className: classNames("".concat(prefixCls, "-hidden-image"), hashId),
|
|
1121
|
+
src: imagePreview.src,
|
|
1122
|
+
preview: {
|
|
1123
|
+
visible: imagePreview.visible,
|
|
1124
|
+
onVisibleChange: function onVisibleChange(visible) {
|
|
1125
|
+
setImagePreview(function(prev) {
|
|
1126
|
+
return _object_spread_props(_object_spread({}, prev), {
|
|
1127
|
+
visible: visible
|
|
1128
|
+
});
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
});
|
|
1133
|
+
// 如果正在预览文件,显示预览组件
|
|
1134
|
+
if (previewFile) {
|
|
1135
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(PreviewComponent, {
|
|
1136
|
+
file: previewFile,
|
|
1137
|
+
onBack: handleBack,
|
|
1138
|
+
onDownload: handleDownloadInPreview,
|
|
1139
|
+
onShare: function onShare1(file, options) {
|
|
1140
|
+
if (onShare) {
|
|
1141
|
+
onShare(file, {
|
|
1142
|
+
anchorEl: options === null || options === void 0 ? void 0 : options.anchorEl,
|
|
1143
|
+
origin: 'preview'
|
|
1144
|
+
});
|
|
1145
|
+
} else {
|
|
1146
|
+
handleDefaultShare(file);
|
|
1147
|
+
}
|
|
1148
|
+
},
|
|
1149
|
+
onLocate: onLocate,
|
|
1150
|
+
customContent: customPreviewContent || undefined,
|
|
1151
|
+
customHeader: customPreviewHeader || undefined,
|
|
1152
|
+
customActions: typeof customActions === 'function' ? customActions(previewFile) : customActions,
|
|
1153
|
+
headerFileOverride: headerFileOverride || undefined,
|
|
1154
|
+
markdownEditorProps: markdownEditorProps
|
|
1155
|
+
}), ImagePreviewComponent);
|
|
1156
|
+
}
|
|
1082
1157
|
// 统一的渲染逻辑 - 确保搜索框位置稳定
|
|
1083
1158
|
return wrapSSR(/*#__PURE__*/ React.createElement(React.Fragment, null, loading && loadingRender ? // 使用自定义loading渲染函数
|
|
1084
1159
|
/*#__PURE__*/ React.createElement("div", {
|
|
@@ -446,6 +446,26 @@ var genStyle = function genStyle(token) {
|
|
|
446
446
|
}), // 隐藏的图片预览组件
|
|
447
447
|
_define_property(_obj7, "".concat(token.componentCls, "-hidden-image"), {
|
|
448
448
|
display: 'none'
|
|
449
|
+
}), // 查看更多按钮
|
|
450
|
+
_define_property(_obj7, "".concat(token.componentCls, "-show-more"), {
|
|
451
|
+
display: 'flex',
|
|
452
|
+
alignItems: 'center',
|
|
453
|
+
justifyContent: 'center',
|
|
454
|
+
padding: '6px 0',
|
|
455
|
+
cursor: 'pointer',
|
|
456
|
+
color: 'var(--color-gray-text-secondary)',
|
|
457
|
+
font: 'var(--font-text-body-sm)',
|
|
458
|
+
letterSpacing: 'var(--letter-spacing-body-sm, normal)',
|
|
459
|
+
transition: 'color 0.2s ease',
|
|
460
|
+
userSelect: 'none',
|
|
461
|
+
'&:hover': {
|
|
462
|
+
color: 'var(--color-primary-control-fill-primary-active)'
|
|
463
|
+
},
|
|
464
|
+
svg: {
|
|
465
|
+
marginLeft: '4px',
|
|
466
|
+
width: '12px',
|
|
467
|
+
height: '12px'
|
|
468
|
+
}
|
|
449
469
|
}), _obj7;
|
|
450
470
|
};
|
|
451
471
|
export function useFileStyle(prefixCls) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant-design/agentic-ui",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.17",
|
|
4
4
|
"description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
|
|
5
5
|
"repository": "git@github.com:ant-design/agentic-ui.git",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
|
|
25
25
|
"lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
|
|
26
26
|
"prepare": "husky install && dumi setup",
|
|
27
|
-
"prepublishOnly": "npm run build && npm run test",
|
|
28
27
|
"prettier": "prettier --write \"{src,docs,test}/**/*.{js,jsx,ts,tsx,css,less,json,md}\"",
|
|
29
28
|
"preview": "pnpm dumi preview",
|
|
30
29
|
"report:demo": "node scripts/generateDemoReport.js",
|