@ant-design/agentic-ui 2.29.49 → 2.29.52
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/style.js +35 -36
- package/dist/MarkdownEditor/types.d.ts +29 -0
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.d.ts +4 -4
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +3 -3
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/index.js +4 -24
- package/dist/MarkdownInputField/MarkdownInputField.js +20 -9
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +4 -3
- package/dist/MarkdownInputField/types/MarkdownInputFieldProps.d.ts +14 -1
- package/dist/ThoughtChainList/index.js +17 -17
- package/dist/ToolUseBar/style.js +3 -0
- 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
|
@@ -79,5 +79,5 @@ export interface PureBubbleListProps {
|
|
|
79
79
|
shouldLazyLoad?: (index: number, total: number) => boolean;
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
export declare const PureBubbleList: React.
|
|
82
|
+
export declare const PureBubbleList: React.NamedExoticComponent<PureBubbleListProps>;
|
|
83
83
|
export default PureBubbleList;
|
|
@@ -61,7 +61,7 @@ import { BubbleConfigContext } from "../BubbleConfigProvide";
|
|
|
61
61
|
import { LOADING_FLAT } from "../MessagesContent";
|
|
62
62
|
import { PureAIBubble, PureUserBubble } from "../PureBubble";
|
|
63
63
|
import { useStyle } from "./style";
|
|
64
|
-
export var PureBubbleList =
|
|
64
|
+
export var PureBubbleList = /*#__PURE__*/ React.memo(function(props) {
|
|
65
65
|
var bubbleList = props.bubbleList, bubbleListRef = props.bubbleListRef, bubbleRenderConfig = props.bubbleRenderConfig, className = props.className, classNames = props.classNames, docListProps = props.docListProps, isLoading = props.isLoading, markdownRenderConfig = props.markdownRenderConfig, onAvatarClick = props.onAvatarClick, onCancelLike = props.onCancelLike, onLikeCancel = props.onLikeCancel, onDisLike = props.onDisLike, onDislike = props.onDislike, onDoubleClick = props.onDoubleClick, onLike = props.onLike, onReply = props.onReply, onScroll = props.onScroll, onTouchMove = props.onTouchMove, onWheel = props.onWheel, shouldShowCopy = props.shouldShowCopy, shouldShowVoice = props.shouldShowVoice, style = props.style, styles = props.styles, userMeta = props.userMeta, assistantMeta = props.assistantMeta;
|
|
66
66
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
67
67
|
var compact = (useContext(BubbleConfigContext) || {}).compact;
|
|
@@ -72,7 +72,7 @@ export var PureBubbleList = function PureBubbleList(props) {
|
|
|
72
72
|
props.style
|
|
73
73
|
];
|
|
74
74
|
}, [
|
|
75
|
-
|
|
75
|
+
props.style
|
|
76
76
|
]);
|
|
77
77
|
// 为 loading 项生成唯一的 key,使用 ref 缓存以确保稳定性
|
|
78
78
|
var loadingKeysRef = useRef(new Map());
|
|
@@ -84,8 +84,10 @@ export var PureBubbleList = function PureBubbleList(props) {
|
|
|
84
84
|
var placement = item.role === 'user' ? 'right' : 'left';
|
|
85
85
|
var BubbleComponent = placement === 'right' ? PureUserBubble : PureAIBubble;
|
|
86
86
|
var isLast = index === bubbleList.length - 1;
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
var originDataWithFlags = _object_spread_props(_object_spread({}, item), {
|
|
88
|
+
isLatest: isLast,
|
|
89
|
+
isLast: isLast
|
|
90
|
+
});
|
|
89
91
|
// 如果 id 是 LOADING_FLAT,使用 uuid 作为 key
|
|
90
92
|
// 使用 index 和 createAt 的组合作为缓存 key,确保同一项在重新渲染时保持相同的 key
|
|
91
93
|
var itemKey = item.id;
|
|
@@ -103,7 +105,7 @@ export var PureBubbleList = function PureBubbleList(props) {
|
|
|
103
105
|
preMessage: bubbleList[index - 1],
|
|
104
106
|
id: item.id,
|
|
105
107
|
style: _object_spread({}, styles === null || styles === void 0 ? void 0 : styles.bubbleListItemStyle),
|
|
106
|
-
originData:
|
|
108
|
+
originData: originDataWithFlags,
|
|
107
109
|
placement: placement,
|
|
108
110
|
time: item.updateAt || item.createAt,
|
|
109
111
|
deps: deps,
|
|
@@ -188,5 +190,6 @@ export var PureBubbleList = function PureBubbleList(props) {
|
|
|
188
190
|
return onTouchMove === null || onTouchMove === void 0 ? void 0 : onTouchMove(event, (bubbleListRef === null || bubbleListRef === void 0 ? void 0 : bubbleListRef.current) || null);
|
|
189
191
|
}
|
|
190
192
|
}, listDom));
|
|
191
|
-
};
|
|
193
|
+
});
|
|
194
|
+
PureBubbleList.displayName = 'PureBubbleList';
|
|
192
195
|
export default PureBubbleList;
|
|
@@ -363,7 +363,7 @@ export var LOADING_FLAT = '...';
|
|
|
363
363
|
(_props_originData4 = props.originData) === null || _props_originData4 === void 0 ? void 0 : _props_originData4.isLast,
|
|
364
364
|
contentAfterDom
|
|
365
365
|
]);
|
|
366
|
-
var
|
|
366
|
+
var messageContent = useMemo(function() {
|
|
367
367
|
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_originData9, _props_originData10;
|
|
368
368
|
if (content === LOADING_FLAT || !((_props_originData = props.originData) === null || _props_originData === void 0 ? void 0 : _props_originData.isFinished) && !content) {
|
|
369
369
|
var _context_thoughtChain;
|
|
@@ -649,5 +649,5 @@ export var LOADING_FLAT = '...';
|
|
|
649
649
|
(_props_bubbleRenderConfig2 = props.bubbleRenderConfig) === null || _props_bubbleRenderConfig2 === void 0 ? void 0 : _props_bubbleRenderConfig2.beforeMessageRender,
|
|
650
650
|
(_props_bubbleRenderConfig3 = props.bubbleRenderConfig) === null || _props_bubbleRenderConfig3 === void 0 ? void 0 : _props_bubbleRenderConfig3.afterMessageRender
|
|
651
651
|
]);
|
|
652
|
-
return
|
|
652
|
+
return messageContent;
|
|
653
653
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export declare const TABLE_COL_WIDTH_MIN_COLUMNS = 5;
|
|
7
7
|
/** 编辑模式表格:列数 >= 此值时才计算并渲染 data col 元素,否则仅渲染行号列 */
|
|
8
8
|
export declare const TABLE_EDIT_COL_WIDTH_MIN_COLUMNS = 3;
|
|
9
|
-
/** 表格默认列宽 (px),与 style.ts 中 --table-cell-min-width (120px) 保持一致 */
|
|
9
|
+
/** 表格默认列宽 (px),与 style.ts 中 --agentic-ui-table-cell-min-width (120px) 保持一致 */
|
|
10
10
|
export declare const TABLE_DEFAULT_COL_WIDTH = 120;
|
|
11
11
|
/** 表格最后一列最小宽度 (px),弹性列用于吸收剩余空间 */
|
|
12
12
|
export declare const TABLE_LAST_COL_MIN_WIDTH = 80;
|
package/dist/Constants/mobile.js
CHANGED
|
@@ -8,7 +8,7 @@ var MOBILE_TABLE_MIN_CELL_WIDTH = 96;
|
|
|
8
8
|
* - 列数 >= 5:使用 TABLE_DEFAULT_COL_WIDTH 固定宽度
|
|
9
9
|
*/ export var TABLE_COL_WIDTH_MIN_COLUMNS = 5;
|
|
10
10
|
/** 编辑模式表格:列数 >= 此值时才计算并渲染 data col 元素,否则仅渲染行号列 */ export var TABLE_EDIT_COL_WIDTH_MIN_COLUMNS = 3;
|
|
11
|
-
/** 表格默认列宽 (px),与 style.ts 中 --table-cell-min-width (120px) 保持一致 */ export var TABLE_DEFAULT_COL_WIDTH = 120;
|
|
11
|
+
/** 表格默认列宽 (px),与 style.ts 中 --agentic-ui-table-cell-min-width (120px) 保持一致 */ export var TABLE_DEFAULT_COL_WIDTH = 120;
|
|
12
12
|
/** 表格最后一列最小宽度 (px),弹性列用于吸收剩余空间 */ export var TABLE_LAST_COL_MIN_WIDTH = 80;
|
|
13
13
|
export var MOBILE_PADDING = "clamp(".concat(MOBILE_PADDING_MIN, ", ").concat(MOBILE_PADDING_SCALE, ", ").concat(MOBILE_PADDING_MAX, ")");
|
|
14
14
|
export var MOBILE_BREAKPOINT = '768px';
|
|
@@ -461,7 +461,7 @@ var I18nBoundary = function I18nBoundary(param) {
|
|
|
461
461
|
style: _object_spread({
|
|
462
462
|
height: !readonly && (toolBar === null || toolBar === void 0 ? void 0 : toolBar.enable) ? "calc(100% - 56px)" : '100%'
|
|
463
463
|
}, (contentStyle === null || contentStyle === void 0 ? void 0 : contentStyle.padding) !== undefined ? {
|
|
464
|
-
'--content-padding': "".concat(typeof contentStyle.padding === 'number' ? "".concat(contentStyle.padding, "px") : contentStyle.padding),
|
|
464
|
+
'--agentic-ui-content-padding': "".concat(typeof contentStyle.padding === 'number' ? "".concat(contentStyle.padding, "px") : contentStyle.padding),
|
|
465
465
|
padding: contentStyle.padding
|
|
466
466
|
} : {}, contentStyle),
|
|
467
467
|
ref: function ref(dom) {
|
|
@@ -874,6 +874,28 @@ var defaultAllowedTypes = [
|
|
|
874
874
|
2
|
|
875
875
|
];
|
|
876
876
|
selection = markdownEditorRef.current.selection;
|
|
877
|
+
// plainTextOnly 时仅插入纯文本,不做 HTML/Markdown/链接解析
|
|
878
|
+
if (pasteConfig === null || pasteConfig === void 0 ? void 0 : pasteConfig.plainTextOnly) {
|
|
879
|
+
if (selection) {
|
|
880
|
+
Transforms.insertText(markdownEditorRef.current, text1, {
|
|
881
|
+
at: selection
|
|
882
|
+
});
|
|
883
|
+
} else {
|
|
884
|
+
Transforms.insertNodes(markdownEditorRef.current, [
|
|
885
|
+
{
|
|
886
|
+
type: 'paragraph',
|
|
887
|
+
children: [
|
|
888
|
+
{
|
|
889
|
+
text: text1
|
|
890
|
+
}
|
|
891
|
+
]
|
|
892
|
+
}
|
|
893
|
+
]);
|
|
894
|
+
}
|
|
895
|
+
return [
|
|
896
|
+
2
|
|
897
|
+
];
|
|
898
|
+
}
|
|
877
899
|
// 如果是表格或者代码块,直接插入文本
|
|
878
900
|
if (shouldInsertTextDirectly(markdownEditorRef.current, selection)) {
|
|
879
901
|
Transforms.insertText(markdownEditorRef.current, text1);
|
|
@@ -46,6 +46,21 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
46
46
|
function _non_iterable_rest() {
|
|
47
47
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
48
|
}
|
|
49
|
+
function _object_spread(target) {
|
|
50
|
+
for(var i = 1; i < arguments.length; i++){
|
|
51
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
52
|
+
var ownKeys = Object.keys(source);
|
|
53
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
54
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
55
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
ownKeys.forEach(function(key) {
|
|
59
|
+
_define_property(target, key, source[key]);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return target;
|
|
63
|
+
}
|
|
49
64
|
function _sliced_to_array(arr, i) {
|
|
50
65
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
51
66
|
}
|
|
@@ -81,7 +96,7 @@ import { useReadonlyTableColWidths } from "./utils/useReadonlyTableColWidths";
|
|
|
81
96
|
download: 'csv',
|
|
82
97
|
fullScreen: 'modal',
|
|
83
98
|
copy: 'md'
|
|
84
|
-
} : _ref_actions;
|
|
99
|
+
} : _ref_actions, tableCssVariables = _ref.cssVariables;
|
|
85
100
|
var tableTargetRef = useRef(null);
|
|
86
101
|
var containerRef = useRef(null);
|
|
87
102
|
var modelTargetRef = useRef(null);
|
|
@@ -172,7 +187,8 @@ import { useReadonlyTableColWidths } from "./utils/useReadonlyTableColWidths";
|
|
|
172
187
|
]);
|
|
173
188
|
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("div", {
|
|
174
189
|
ref: containerRef,
|
|
175
|
-
className: classNames(baseCls)
|
|
190
|
+
className: classNames(baseCls),
|
|
191
|
+
style: tableCssVariables
|
|
176
192
|
}, tableDom), popoverContent, previewOpen && /*#__PURE__*/ React.createElement(Modal, {
|
|
177
193
|
title: (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_tableConfig = editorProps.tableConfig) === null || _editorProps_tableConfig === void 0 ? void 0 : _editorProps_tableConfig.previewTitle) || (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.previewTable) || '预览表格',
|
|
178
194
|
open: previewOpen,
|
|
@@ -189,12 +205,12 @@ import { useReadonlyTableColWidths } from "./utils/useReadonlyTableColWidths";
|
|
|
189
205
|
}
|
|
190
206
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
191
207
|
className: classNames(baseCls, getPrefixCls('agentic-md-editor-content')),
|
|
192
|
-
style: {
|
|
208
|
+
style: _object_spread({
|
|
193
209
|
flex: 1,
|
|
194
210
|
minWidth: 0,
|
|
195
211
|
overflow: 'auto',
|
|
196
212
|
width: 'calc(80vw - 64px)'
|
|
197
|
-
},
|
|
213
|
+
}, tableCssVariables),
|
|
198
214
|
ref: modelTargetRef,
|
|
199
215
|
onMouseDown: function onMouseDown(e) {
|
|
200
216
|
e.preventDefault();
|
|
@@ -185,8 +185,9 @@ import useScrollShadow from "./useScrollShadow";
|
|
|
185
185
|
var children = _0.children, props = _object_without_properties(_0, [
|
|
186
186
|
"children"
|
|
187
187
|
]);
|
|
188
|
-
var _props_element_children__children, _props_element_children_, _props_element_children, _props_element, _props_element_otherProps, _props_element1, _props_element_children1, _props_element2;
|
|
189
|
-
var _useEditorStore = useEditorStore(), readonly = _useEditorStore.readonly, markdownContainerRef = _useEditorStore.markdownContainerRef;
|
|
188
|
+
var _editorProps_tableConfig, _props_element_children__children, _props_element_children_, _props_element_children, _props_element, _props_element_otherProps, _props_element1, _props_element_children1, _props_element2;
|
|
189
|
+
var _useEditorStore = useEditorStore(), readonly = _useEditorStore.readonly, markdownContainerRef = _useEditorStore.markdownContainerRef, editorProps = _useEditorStore.editorProps;
|
|
190
|
+
var tableCssVariables = editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_tableConfig = editorProps.tableConfig) === null || _editorProps_tableConfig === void 0 ? void 0 : _editorProps_tableConfig.cssVariables;
|
|
190
191
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
191
192
|
var tablePath = useContext(TablePropsContext).tablePath;
|
|
192
193
|
var baseCls = getPrefixCls('agentic-md-editor-content-table');
|
|
@@ -341,9 +342,9 @@ import useScrollShadow from "./useScrollShadow";
|
|
|
341
342
|
return /*#__PURE__*/ React.createElement("div", {
|
|
342
343
|
className: classNames(baseCls),
|
|
343
344
|
ref: tableRef,
|
|
344
|
-
style: _object_spread_props(_object_spread({}, boxShadowStyle), {
|
|
345
|
+
style: _object_spread(_object_spread_props(_object_spread({}, boxShadowStyle), {
|
|
345
346
|
position: 'relative'
|
|
346
|
-
}),
|
|
347
|
+
}), tableCssVariables),
|
|
347
348
|
onDragStart: function onDragStart(e) {
|
|
348
349
|
// 阻止拖拽开始时的文字选择
|
|
349
350
|
e.preventDefault();
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { Node, Path, Transforms } from "slate";
|
|
2
|
+
import { Text } from "slate";
|
|
3
|
+
/**
|
|
4
|
+
* 连续空格跳出链接的阈值(输入第二个空格时跳出 data-url)
|
|
5
|
+
*/ var SPACES_TO_EXIT_LINK = 2;
|
|
2
6
|
/**
|
|
3
7
|
* 处理链接卡片和媒体相关节点的操作
|
|
4
8
|
*
|
|
@@ -10,8 +14,32 @@ import { Node, Path, Transforms } from "slate";
|
|
|
10
14
|
* 处理以下链接和媒体相关操作:
|
|
11
15
|
* - 拆分链接卡片或媒体节点 (split_node)
|
|
12
16
|
* - 删除链接卡片内的节点 (remove_node)
|
|
17
|
+
* - 链接内连续输入两个空格时跳出链接 (insert_text)
|
|
13
18
|
*/ var handleLinkAndMediaOperation = function handleLinkAndMediaOperation(editor, operation) {
|
|
14
19
|
var _operation_properties, _operation_properties1;
|
|
20
|
+
if (operation.type === 'insert_text' && /^\s+$/.test(operation.text)) {
|
|
21
|
+
var currentNode = Node.get(editor, operation.path);
|
|
22
|
+
if (Text.isText(currentNode) && (currentNode === null || currentNode === void 0 ? void 0 : currentNode.url)) {
|
|
23
|
+
var _ref, _operation_offset, _ref1;
|
|
24
|
+
var _editor_selection_anchor, _editor_selection, _textAfterInsert_match_, _textAfterInsert_match;
|
|
25
|
+
var text = currentNode.text || '';
|
|
26
|
+
var offset = (_ref = (_operation_offset = operation.offset) !== null && _operation_offset !== void 0 ? _operation_offset : (_editor_selection = editor.selection) === null || _editor_selection === void 0 ? void 0 : (_editor_selection_anchor = _editor_selection.anchor) === null || _editor_selection_anchor === void 0 ? void 0 : _editor_selection_anchor.offset) !== null && _ref !== void 0 ? _ref : 0;
|
|
27
|
+
var isAtEnd = offset >= text.length;
|
|
28
|
+
var textAfterInsert = text.slice(0, offset) + operation.text;
|
|
29
|
+
var trailingSpaces = (_ref1 = (_textAfterInsert_match = textAfterInsert.match(/\s*$/)) === null || _textAfterInsert_match === void 0 ? void 0 : (_textAfterInsert_match_ = _textAfterInsert_match[0]) === null || _textAfterInsert_match_ === void 0 ? void 0 : _textAfterInsert_match_.length) !== null && _ref1 !== void 0 ? _ref1 : 0;
|
|
30
|
+
if (isAtEnd && trailingSpaces >= SPACES_TO_EXIT_LINK) {
|
|
31
|
+
Transforms.insertNodes(editor, [
|
|
32
|
+
{
|
|
33
|
+
text: operation.text
|
|
34
|
+
}
|
|
35
|
+
], {
|
|
36
|
+
at: Path.next(operation.path),
|
|
37
|
+
select: true
|
|
38
|
+
});
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
15
43
|
if (operation.type === 'split_node' && (((_operation_properties = operation.properties) === null || _operation_properties === void 0 ? void 0 : _operation_properties.type) === 'link-card' || ((_operation_properties1 = operation.properties) === null || _operation_properties1 === void 0 ? void 0 : _operation_properties1.type) === 'media')) {
|
|
16
44
|
var node = Node.get(editor, operation.path);
|
|
17
45
|
if ([
|
|
@@ -55,19 +55,19 @@ import { resetComponent, useEditorStyleRegister } from "../../Hooks/useStyle";
|
|
|
55
55
|
import "./code.css";
|
|
56
56
|
// 导入统一的标签样式配置
|
|
57
57
|
import { TAG_STYLES } from "./tagStyles";
|
|
58
|
-
var COMMENT_HIGHLIGHT_COLOR = 'var(--agentic-comment-highlight-color, rgba(21, 0, 255, 0.15))';
|
|
58
|
+
var COMMENT_HIGHLIGHT_COLOR = 'var(--agentic-ui-comment-highlight-color, rgba(21, 0, 255, 0.15))';
|
|
59
59
|
/** Jinja 语法高亮 CSS 变量名,在 .ant-agentic-md-editor-content 上覆盖即可定制 */ var JINJA_CSS_VAR = {
|
|
60
|
-
variable: '--agentic-md-editor-color-jinja-variable',
|
|
61
|
-
tag: '--agentic-md-editor-color-jinja-tag',
|
|
62
|
-
comment: '--agentic-md-editor-color-jinja-comment',
|
|
63
|
-
keyword: '--agentic-md-editor-color-jinja-keyword',
|
|
64
|
-
string: '--agentic-md-editor-color-jinja-string',
|
|
65
|
-
number: '--agentic-md-editor-color-jinja-number',
|
|
66
|
-
filter: '--agentic-md-editor-color-jinja-filter',
|
|
67
|
-
variableName: '--agentic-md-editor-color-jinja-variable-name',
|
|
68
|
-
placeholder: '--agentic-md-editor-color-jinja-placeholder',
|
|
69
|
-
placeholderBg: '--agentic-md-editor-color-jinja-placeholder-bg',
|
|
70
|
-
delimiter: '--agentic-md-editor-color-jinja-delimiter'
|
|
60
|
+
variable: '--agentic-ui-md-editor-color-jinja-variable',
|
|
61
|
+
tag: '--agentic-ui-md-editor-color-jinja-tag',
|
|
62
|
+
comment: '--agentic-ui-md-editor-color-jinja-comment',
|
|
63
|
+
keyword: '--agentic-ui-md-editor-color-jinja-keyword',
|
|
64
|
+
string: '--agentic-ui-md-editor-color-jinja-string',
|
|
65
|
+
number: '--agentic-ui-md-editor-color-jinja-number',
|
|
66
|
+
filter: '--agentic-ui-md-editor-color-jinja-filter',
|
|
67
|
+
variableName: '--agentic-ui-md-editor-color-jinja-variable-name',
|
|
68
|
+
placeholder: '--agentic-ui-md-editor-color-jinja-placeholder',
|
|
69
|
+
placeholderBg: '--agentic-ui-md-editor-color-jinja-placeholder-bg',
|
|
70
|
+
delimiter: '--agentic-ui-md-editor-color-jinja-delimiter'
|
|
71
71
|
};
|
|
72
72
|
var genStyle = function genStyle(token) {
|
|
73
73
|
var _obj, _obj1;
|
|
@@ -101,14 +101,14 @@ var genStyle = function genStyle(token) {
|
|
|
101
101
|
'&-container': _define_property({
|
|
102
102
|
// 默认 padding,可以通过 contentStyle 覆盖
|
|
103
103
|
// 使用 CSS 变量,允许通过内联样式覆盖
|
|
104
|
-
padding: 'var(--content-padding, 4px 20px)',
|
|
104
|
+
padding: 'var(--agentic-ui-content-padding, 4px 20px)',
|
|
105
105
|
overflow: 'auto',
|
|
106
106
|
display: 'flex',
|
|
107
107
|
position: 'relative',
|
|
108
108
|
gap: 24,
|
|
109
109
|
outline: 'none'
|
|
110
110
|
}, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
|
|
111
|
-
padding: 'var(--content-padding, 4px 4px)'
|
|
111
|
+
padding: 'var(--agentic-ui-content-padding, 4px 4px)'
|
|
112
112
|
}),
|
|
113
113
|
'&-content': {},
|
|
114
114
|
'&-focus': {
|
|
@@ -365,18 +365,17 @@ var genStyle = function genStyle(token) {
|
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
}), // --- Table ---
|
|
368
|
+
// 表格样式使用 CSS 变量 + fallback,支持通过父级 style 或 ConfigProvider 覆盖:
|
|
369
|
+
// --agentic-ui-table-border-radius, --agentic-ui-table-border-color,
|
|
370
|
+
// --agentic-ui-table-header-bg, --agentic-ui-table-hover-bg,
|
|
371
|
+
// --agentic-ui-table-cell-bg, --agentic-ui-table-cell-min-width,
|
|
372
|
+
// --agentic-ui-table-cell-padding
|
|
368
373
|
_define_property(_obj2, "".concat(token.componentCls, "-content-table"), {
|
|
369
374
|
width: '100%',
|
|
370
375
|
overflow: 'auto',
|
|
371
376
|
flex: 1,
|
|
372
377
|
minWidth: 0,
|
|
373
378
|
position: 'relative',
|
|
374
|
-
'--table-border-radius': '8px',
|
|
375
|
-
'--table-border-color': '#E7E9E8',
|
|
376
|
-
'--table-header-bg': '#f7f7f9',
|
|
377
|
-
'--table-odd-row-bg': 'rgba(35,35,38,.04)',
|
|
378
|
-
'--table-hover-bg': 'rgba(0, 0, 0, 0.04)',
|
|
379
|
-
'--table-cell-min-width': '120px',
|
|
380
379
|
'&-container': _define_property({
|
|
381
380
|
display: 'flex',
|
|
382
381
|
gap: 1,
|
|
@@ -419,14 +418,14 @@ var genStyle = function genStyle(token) {
|
|
|
419
418
|
}, _define_property(_obj1, "&".concat(token.componentCls, "-content-table-readonly-table"), {
|
|
420
419
|
width: '100%',
|
|
421
420
|
minWidth: 'max-content'
|
|
422
|
-
}), _define_property(_obj1, "position", 'relative'), _define_property(_obj1, "fontVariant", 'tabular-nums'), _define_property(_obj1, "borderRadius", 'var(--table-border-radius)'), _define_property(_obj1, "border", '1px solid var(--table-border-color)'), _define_property(_obj1, "&".concat(token.componentCls, "-content-table-readonly-pure"), {
|
|
421
|
+
}), _define_property(_obj1, "position", 'relative'), _define_property(_obj1, "fontVariant", 'tabular-nums'), _define_property(_obj1, "borderRadius", 'var(--agentic-ui-table-border-radius, 8px)'), _define_property(_obj1, "border", '1px solid var(--agentic-ui-table-border-color, #E7E9E8)'), _define_property(_obj1, "&".concat(token.componentCls, "-content-table-readonly-pure"), {
|
|
423
422
|
border: 'none',
|
|
424
423
|
borderRadius: 'none',
|
|
425
424
|
'tr:not(.config-tr) td:not(.config-td)': {
|
|
426
425
|
borderLeft: 'none'
|
|
427
426
|
},
|
|
428
427
|
'tr:not(.config-tr):last-child td:not(.config-td)': {
|
|
429
|
-
borderBottom: '1px solid var(--table-border-color)'
|
|
428
|
+
borderBottom: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)'
|
|
430
429
|
},
|
|
431
430
|
'tr:not(.config-tr):first-child th:first-child:not(.config-td):not([colspan]):not([rowspan]), tr:not(.config-tr):first-child td:first-child:not(.config-td):not([colspan]):not([rowspan])': {
|
|
432
431
|
borderTopLeftRadius: 'unset'
|
|
@@ -441,23 +440,23 @@ var genStyle = function genStyle(token) {
|
|
|
441
440
|
borderBottomRightRadius: 'unset'
|
|
442
441
|
}
|
|
443
442
|
}), _define_property(_obj1, 'th.config-th,td.config-td', {
|
|
444
|
-
borderBottom: '1px solid var(--table-border-color)',
|
|
445
|
-
borderLeft: '1px solid var(--table-border-color)'
|
|
443
|
+
borderBottom: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)',
|
|
444
|
+
borderLeft: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)'
|
|
446
445
|
}), _define_property(_obj1, 'tr td.config-td:first-child', {
|
|
447
446
|
borderLeft: 'none'
|
|
448
447
|
}), _define_property(_obj1, 'th:not(.config-td)', {
|
|
449
|
-
backgroundColor: 'var(--table-header-bg)',
|
|
450
|
-
borderBottom: '1px solid var(--table-border-color)',
|
|
448
|
+
backgroundColor: 'var(--agentic-ui-table-header-bg, #f7f7f9)',
|
|
449
|
+
borderBottom: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)',
|
|
451
450
|
textWrap: 'nowrap',
|
|
452
451
|
verticalAlign: 'top',
|
|
453
|
-
padding: 'var(--table-cell-padding, 16px 12px)',
|
|
452
|
+
padding: 'var(--agentic-ui-table-cell-padding, 16px 12px)',
|
|
454
453
|
textAlign: 'left',
|
|
455
454
|
lineHeight: '24px',
|
|
456
455
|
fontSize: '1em',
|
|
457
456
|
fontWeight: 600,
|
|
458
457
|
borderTop: 'none',
|
|
459
|
-
minWidth: 'var(--table-cell-min-width)',
|
|
460
|
-
width: 'var(--table-cell-min-width)',
|
|
458
|
+
minWidth: 'var(--agentic-ui-table-cell-min-width, 120px)',
|
|
459
|
+
width: 'var(--agentic-ui-table-cell-min-width, 120px)',
|
|
461
460
|
whiteSpace: 'nowrap',
|
|
462
461
|
overflow: 'hidden',
|
|
463
462
|
textOverflow: 'ellipsis',
|
|
@@ -465,13 +464,13 @@ var genStyle = function genStyle(token) {
|
|
|
465
464
|
background: 'inherit'
|
|
466
465
|
}), _define_property(_obj1, 'td:not(.config-td)', {
|
|
467
466
|
verticalAlign: 'top',
|
|
468
|
-
padding: 'var(--table-cell-padding, 16px 12px)',
|
|
467
|
+
padding: 'var(--agentic-ui-table-cell-padding, 16px 12px)',
|
|
469
468
|
textAlign: 'left',
|
|
470
469
|
position: 'relative',
|
|
471
470
|
lineHeight: '24px',
|
|
472
471
|
fontSize: '1em',
|
|
473
|
-
minWidth: 'var(--table-cell-min-width)',
|
|
474
|
-
width: 'var(--table-cell-min-width)',
|
|
472
|
+
minWidth: 'var(--agentic-ui-table-cell-min-width, 120px)',
|
|
473
|
+
width: 'var(--agentic-ui-table-cell-min-width, 120px)',
|
|
475
474
|
whiteSpace: 'nowrap',
|
|
476
475
|
overflow: 'hidden',
|
|
477
476
|
textOverflow: 'ellipsis',
|
|
@@ -487,8 +486,8 @@ var genStyle = function genStyle(token) {
|
|
|
487
486
|
borderTop: 'none'
|
|
488
487
|
},
|
|
489
488
|
'td:not(.config-td)': {
|
|
490
|
-
borderBottom: '1px solid var(--table-border-color)',
|
|
491
|
-
borderLeft: '1px solid var(--table-border-color)',
|
|
489
|
+
borderBottom: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)',
|
|
490
|
+
borderLeft: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)',
|
|
492
491
|
'&:first-child': {
|
|
493
492
|
fontSize: '1em',
|
|
494
493
|
lineHeight: '24px',
|
|
@@ -502,32 +501,32 @@ var genStyle = function genStyle(token) {
|
|
|
502
501
|
borderBottom: 'none'
|
|
503
502
|
}
|
|
504
503
|
}), _define_property(_obj1, 'tbody tr:not(.config-tr):hover', {
|
|
505
|
-
background: 'linear-gradient(var(--table-hover-bg), var(--table-hover-bg)), linear-gradient(
|
|
504
|
+
background: 'linear-gradient(var(--agentic-ui-table-hover-bg, rgba(0, 0, 0, 0.04)), var(--agentic-ui-table-hover-bg, rgba(0, 0, 0, 0.04))), linear-gradient(var(--agentic-ui-table-cell-bg, #ffffff), var(--agentic-ui-table-cell-bg, #ffffff))'
|
|
506
505
|
}), // 表格圆角处理
|
|
507
506
|
_define_property(_obj1, 'th:not(.config-td), td:not(.config-td)', {
|
|
508
507
|
borderRadius: '0'
|
|
509
508
|
}), _define_property(_obj1, 'tr:not(.config-tr):first-child th:first-child:not(.config-td):not([colspan]):not([rowspan]), tr:not(.config-tr):first-child td:first-child:not(.config-td):not([colspan]):not([rowspan])', {
|
|
510
|
-
borderTopLeftRadius: 'var(--table-border-radius)'
|
|
509
|
+
borderTopLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)'
|
|
511
510
|
}), _define_property(_obj1, 'tr:not(.config-tr):first-child th:last-child:not(.config-td):not([colspan]):not([rowspan]), tr:not(.config-tr):first-child td:last-child:not(.config-td):not([colspan]):not([rowspan])', {
|
|
512
|
-
borderTopRightRadius: 'var(--table-border-radius)'
|
|
511
|
+
borderTopRightRadius: 'var(--agentic-ui-table-border-radius, 8px)'
|
|
513
512
|
}), _define_property(_obj1, 'tr:not(.config-tr):last-child td:first-child:not(.config-td):not([colspan]):not([rowspan]), tr:not(.config-tr):last-child th:first-child:not(.config-td):not([colspan]):not([rowspan])', {
|
|
514
|
-
borderBottomLeftRadius: 'var(--table-border-radius)'
|
|
513
|
+
borderBottomLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)'
|
|
515
514
|
}), _define_property(_obj1, 'tr:not(.config-tr):last-child td:last-child:not(.config-td):not([colspan]):not([rowspan]), tr:not(.config-tr):last-child th:last-child:not(.config-td):not([colspan]):not([rowspan])', {
|
|
516
|
-
borderBottomRightRadius: 'var(--table-border-radius)'
|
|
515
|
+
borderBottomRightRadius: 'var(--agentic-ui-table-border-radius, 8px)'
|
|
517
516
|
}), // 处理合并单元格的圆角
|
|
518
517
|
_define_property(_obj1, 'tr:not(.config-tr):first-child th:not(.config-td)[colspan]:first-child, tr:not(.config-tr):first-child td:not(.config-td)[colspan]:first-child,tr:not(.config-tr):first-child th:not(.config-td)[rowspan]:first-child, tr:not(.config-tr):first-child td:not(.config-td)[rowspan]:first-child', {
|
|
519
|
-
borderTopLeftRadius: 'var(--table-border-radius)'
|
|
518
|
+
borderTopLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)'
|
|
520
519
|
}), _define_property(_obj1, 'tr:not(.config-tr):first-child th:not(.config-td)[colspan]:last-child, tr:not(.config-tr):first-child td:not(.config-td)[colspan]:last-child,tr:not(.config-tr):first-child th:not(.config-td)[rowspan]:last-child, tr:not(.config-tr):first-child td:not(.config-td)[rowspan]:last-child', {
|
|
521
|
-
borderTopRightRadius: 'var(--table-border-radius)'
|
|
520
|
+
borderTopRightRadius: 'var(--agentic-ui-table-border-radius, 8px)'
|
|
522
521
|
}), _define_property(_obj1, 'tr:not(.config-tr):last-child td:not(.config-td)[colspan]:first-child, tr:not(.config-tr):last-child th:not(.config-td)[colspan]:first-child,tr:not(.config-tr):last-child td:not(.config-td)[rowspan]:first-child, tr:not(.config-tr):last-child th:not(.config-td)[rowspan]:first-child', {
|
|
523
|
-
borderBottomLeftRadius: 'var(--table-border-radius)'
|
|
522
|
+
borderBottomLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)'
|
|
524
523
|
}), _define_property(_obj1, 'tr:not(.config-tr):last-child td:not(.config-td)[colspan]:last-child, tr:not(.config-tr):last-child th:not(.config-td)[colspan]:last-child,tr:not(.config-tr):last-child td:not(.config-td)[rowspan]:last-child, tr:not(.config-tr):last-child th:not(.config-td)[rowspan]:last-child', {
|
|
525
|
-
borderBottomRightRadius: 'var(--table-border-radius)'
|
|
524
|
+
borderBottomRightRadius: 'var(--agentic-ui-table-border-radius, 8px)'
|
|
526
525
|
}), _define_property(_obj1, 'tr:not(.config-tr):first-child:last-child th:not(.config-td)[colspan]:first-child:last-child, tr:not(.config-tr):first-child:last-child td:not(.config-td)[colspan]:first-child:last-child', {
|
|
527
|
-
borderRadius: 'var(--table-border-radius)'
|
|
526
|
+
borderRadius: 'var(--agentic-ui-table-border-radius, 8px)'
|
|
528
527
|
}), _define_property(_obj1, 'th:not(.config-td)[rowspan]:first-child:last-child, td:not(.config-td)[rowspan]:first-child:last-child', {
|
|
529
|
-
borderTopLeftRadius: 'var(--table-border-radius)',
|
|
530
|
-
borderBottomLeftRadius: 'var(--table-border-radius)'
|
|
528
|
+
borderTopLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)',
|
|
529
|
+
borderBottomLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)'
|
|
531
530
|
}), _define_property(_obj1, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
|
|
532
531
|
'th:not(.config-td), td:not(.config-td)': {
|
|
533
532
|
padding: "".concat(MOBILE_PADDING)
|
|
@@ -597,7 +596,7 @@ var genStyle = function genStyle(token) {
|
|
|
597
596
|
zIndex: 1000,
|
|
598
597
|
justifyContent: 'center',
|
|
599
598
|
fontSize: 12,
|
|
600
|
-
border: '1px solid var(--table-border-color)',
|
|
599
|
+
border: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)',
|
|
601
600
|
width: '20px',
|
|
602
601
|
height: '20px',
|
|
603
602
|
cursor: 'pointer',
|
|
@@ -651,7 +650,7 @@ var genStyle = function genStyle(token) {
|
|
|
651
650
|
alignItems: 'center',
|
|
652
651
|
justifyContent: 'center',
|
|
653
652
|
fontSize: 12,
|
|
654
|
-
border: '1px solid var(--table-border-color)',
|
|
653
|
+
border: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)',
|
|
655
654
|
width: '20px',
|
|
656
655
|
height: '20px',
|
|
657
656
|
cursor: 'pointer',
|
|
@@ -337,10 +337,20 @@ export type MarkdownEditorProps = {
|
|
|
337
337
|
};
|
|
338
338
|
/**
|
|
339
339
|
* 样式
|
|
340
|
+
* @description 支持通过 CSS 变量自定义表格等渲染样式,可覆盖的变量包括:
|
|
341
|
+
* - `--agentic-ui-table-border-radius` 表格圆角,默认 8px
|
|
342
|
+
* - `--agentic-ui-table-border-color` 表格边框颜色,默认 #E7E9E8
|
|
343
|
+
* - `--agentic-ui-table-header-bg` 表头背景色,默认 #f7f7f9
|
|
344
|
+
* - `--agentic-ui-table-hover-bg` 行悬停背景色,默认 rgba(0,0,0,0.04)
|
|
345
|
+
* - `--agentic-ui-table-cell-bg` 单元格背景色,默认 #ffffff
|
|
346
|
+
* - `--agentic-ui-table-cell-min-width` 单元格最小宽度,默认 120px
|
|
347
|
+
* - `--agentic-ui-table-cell-padding` 单元格内边距,默认 16px 12px
|
|
348
|
+
* @example style={{ ['--agentic-ui-table-border-color']: '#ddd', ['--agentic-ui-table-header-bg']: '#f0f0f0' } as React.CSSProperties}
|
|
340
349
|
*/
|
|
341
350
|
style?: React.CSSProperties;
|
|
342
351
|
/**
|
|
343
352
|
* 内容样式
|
|
353
|
+
* @description 支持 `--agentic-ui-content-padding` 等 CSS 变量
|
|
344
354
|
*/
|
|
345
355
|
contentStyle?: React.CSSProperties;
|
|
346
356
|
/**
|
|
@@ -363,6 +373,20 @@ export type MarkdownEditorProps = {
|
|
|
363
373
|
};
|
|
364
374
|
pure?: boolean;
|
|
365
375
|
previewTitle?: string;
|
|
376
|
+
/**
|
|
377
|
+
* 表格 CSS 变量覆盖,支持通过配置自定义表格样式
|
|
378
|
+
* @example
|
|
379
|
+
* ```tsx
|
|
380
|
+
* tableConfig={{
|
|
381
|
+
* cssVariables: {
|
|
382
|
+
* '--agentic-ui-table-border-color': '#d9d9d9',
|
|
383
|
+
* '--agentic-ui-table-header-bg': '#fafafa',
|
|
384
|
+
* '--agentic-ui-table-cell-min-width': '150px',
|
|
385
|
+
* },
|
|
386
|
+
* }}
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
cssVariables?: Record<`--${string}`, string>;
|
|
366
390
|
};
|
|
367
391
|
/**
|
|
368
392
|
* 粘贴配置
|
|
@@ -370,6 +394,11 @@ export type MarkdownEditorProps = {
|
|
|
370
394
|
pasteConfig?: {
|
|
371
395
|
enabled?: boolean;
|
|
372
396
|
allowedTypes?: string[];
|
|
397
|
+
/**
|
|
398
|
+
* 仅插入纯文本,不解析 HTML/Markdown/链接等
|
|
399
|
+
* @default false
|
|
400
|
+
*/
|
|
401
|
+
plainTextOnly?: boolean;
|
|
373
402
|
};
|
|
374
403
|
/**
|
|
375
404
|
* Jinja 配置:语法高亮与模板面板(输入 `{}` 触发)
|
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
|
@@ -95,15 +95,15 @@ export var AttachmentFileListItem = function AttachmentFileListItem(param) {
|
|
|
95
95
|
var canDelete = file.status !== 'uploading';
|
|
96
96
|
var handleFileClick = function handleFileClick() {
|
|
97
97
|
if (!isDoneStatus) return;
|
|
98
|
-
onPreview === null || onPreview === void 0 ? void 0 : onPreview();
|
|
98
|
+
onPreview === null || onPreview === void 0 ? void 0 : onPreview(file);
|
|
99
99
|
};
|
|
100
100
|
var handleRetryClick = function handleRetryClick() {
|
|
101
101
|
if (!isErrorStatus) return;
|
|
102
|
-
onRetry === null || onRetry === void 0 ? void 0 : onRetry();
|
|
102
|
+
onRetry === null || onRetry === void 0 ? void 0 : onRetry(file);
|
|
103
103
|
};
|
|
104
104
|
var handleDeleteClick = function handleDeleteClick(e) {
|
|
105
105
|
e.stopPropagation();
|
|
106
|
-
onDelete
|
|
106
|
+
onDelete(file);
|
|
107
107
|
};
|
|
108
108
|
return /*#__PURE__*/ React.createElement(Tooltip, {
|
|
109
109
|
title: (locale === null || locale === void 0 ? void 0 : locale.clickToRetry) || '点击重试',
|
|
@@ -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",
|
|
@@ -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
|
|
@@ -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
|
* 技能模式配置
|
|
@@ -290,6 +290,17 @@ var ThoughtChainContent = /*#__PURE__*/ React.memo(function(_0) {
|
|
|
290
290
|
bubble === null || bubble === void 0 ? void 0 : bubble.isFinished,
|
|
291
291
|
collapse
|
|
292
292
|
]);
|
|
293
|
+
var mergedMarkdownProps = useMemo(function() {
|
|
294
|
+
return merge(markdownRenderProps || {}, {
|
|
295
|
+
codeProps: {
|
|
296
|
+
showLineNumbers: false,
|
|
297
|
+
showGutter: false,
|
|
298
|
+
fontSize: 12
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
}, [
|
|
302
|
+
markdownRenderProps
|
|
303
|
+
]);
|
|
293
304
|
var _obj;
|
|
294
305
|
return /*#__PURE__*/ React.createElement(motion.div, {
|
|
295
306
|
className: classNames("".concat(prefixCls, "-content"), (_obj = {}, _define_property(_obj, "".concat(prefixCls, "-content-collapse"), collapse), _define_property(_obj, "".concat(prefixCls, "-content-compact"), compact), _obj), hashId),
|
|
@@ -328,13 +339,7 @@ var ThoughtChainContent = /*#__PURE__*/ React.memo(function(_0) {
|
|
|
328
339
|
key: "".concat(instanceId, "-").concat(item.runId || 'no-runid', "-").concat(index)
|
|
329
340
|
}, /*#__PURE__*/ React.createElement(ThoughtChainListItem, {
|
|
330
341
|
index: index,
|
|
331
|
-
markdownRenderProps:
|
|
332
|
-
codeProps: {
|
|
333
|
-
showLineNumbers: false,
|
|
334
|
-
showGutter: false,
|
|
335
|
-
fontSize: 12
|
|
336
|
-
}
|
|
337
|
-
}),
|
|
342
|
+
markdownRenderProps: mergedMarkdownProps,
|
|
338
343
|
bubble: bubble,
|
|
339
344
|
thoughtChainListItem: item,
|
|
340
345
|
hashId: hashId,
|
|
@@ -415,10 +420,10 @@ var ThoughtChainContent = /*#__PURE__*/ React.memo(function(_0) {
|
|
|
415
420
|
]);
|
|
416
421
|
// memo 化的回调函数
|
|
417
422
|
var handleCollapseToggle = React.useCallback(function() {
|
|
418
|
-
setCollapse(
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
]);
|
|
423
|
+
setCollapse(function(prev) {
|
|
424
|
+
return !prev;
|
|
425
|
+
});
|
|
426
|
+
}, []);
|
|
422
427
|
var handleDocMetaClose = React.useCallback(function() {
|
|
423
428
|
setDocMeta(null);
|
|
424
429
|
onDocMetaClick === null || onDocMetaClick === void 0 ? void 0 : onDocMetaClick(null);
|
|
@@ -442,12 +447,7 @@ var ThoughtChainContent = /*#__PURE__*/ React.memo(function(_0) {
|
|
|
442
447
|
}
|
|
443
448
|
if (!loading && (bubble === null || bubble === void 0 ? void 0 : bubble.isFinished)) {
|
|
444
449
|
if (time > 0) {
|
|
445
|
-
|
|
446
|
-
return "".concat(locale === null || locale === void 0 ? void 0 : locale.taskComplete, ", ").concat(locale === null || locale === void 0 ? void 0 : locale.totalTimeUsed, " ").concat(time.toFixed(2), "s");
|
|
447
|
-
}
|
|
448
|
-
return /*#__PURE__*/ React.createElement(FlipText, {
|
|
449
|
-
word: "".concat(locale === null || locale === void 0 ? void 0 : locale.taskComplete, ", ").concat(locale === null || locale === void 0 ? void 0 : locale.totalTimeUsed, " ").concat(time.toFixed(2), "s")
|
|
450
|
-
});
|
|
450
|
+
return "".concat(locale === null || locale === void 0 ? void 0 : locale.taskComplete, ", ").concat(locale === null || locale === void 0 ? void 0 : locale.totalTimeUsed, " ").concat(time.toFixed(2), "s");
|
|
451
451
|
}
|
|
452
452
|
return /*#__PURE__*/ React.createElement(FlipText, {
|
|
453
453
|
word: locale === null || locale === void 0 ? void 0 : locale.taskComplete
|
package/dist/ToolUseBar/style.js
CHANGED
|
@@ -53,6 +53,7 @@ function _object_spread_props(target, source) {
|
|
|
53
53
|
import { useEditorStyleRegister } from "../Hooks/useStyle";
|
|
54
54
|
var genStyle = function genStyle(token) {
|
|
55
55
|
return _define_property({}, token.componentCls, {
|
|
56
|
+
maxWidth: '100%',
|
|
56
57
|
'&-no-animation': {
|
|
57
58
|
'& *': {
|
|
58
59
|
transition: 'none !important'
|
|
@@ -262,6 +263,8 @@ var genStyle = function genStyle(token) {
|
|
|
262
263
|
fontWeight: 'normal',
|
|
263
264
|
lineHeight: '20px',
|
|
264
265
|
flex: 1,
|
|
266
|
+
minWidth: 0,
|
|
267
|
+
maxWidth: 320,
|
|
265
268
|
display: '-webkit-box',
|
|
266
269
|
WebkitLineClamp: 1,
|
|
267
270
|
WebkitBoxOrient: 'vertical',
|
package/dist/Workspace/index.js
CHANGED
|
@@ -189,7 +189,11 @@ var COMPONENT_MAP = new Map([
|
|
|
189
189
|
var _useState = _sliced_to_array(useState(0), 2), segmentedKey = _useState[0], setSegmentedKey = _useState[1];
|
|
190
190
|
var _useState1 = _sliced_to_array(useState(0), 2), resetKey = _useState1[0], setResetKey = _useState1[1];
|
|
191
191
|
var displayTitle = title !== null && title !== void 0 ? title : (locale === null || locale === void 0 ? void 0 : locale['workspace.title']) || 'Workspace';
|
|
192
|
-
var defaultConfig =
|
|
192
|
+
var defaultConfig = useMemo(function() {
|
|
193
|
+
return DEFAULT_CONFIG(locale);
|
|
194
|
+
}, [
|
|
195
|
+
locale
|
|
196
|
+
]);
|
|
193
197
|
var _useState2 = _sliced_to_array(useState(''), 2), internalActiveTab = _useState2[0], setInternalActiveTab = _useState2[1];
|
|
194
198
|
var availableTabs = useMemo(function() {
|
|
195
199
|
var tabs = [];
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 2. 需要向外暴露的内部工具 / 类型,先在各组件 index 中 re-export,再由此处统一引用
|
|
7
7
|
* 3. 第三方类型不直接 re-export,使用自定义类型包装
|
|
8
8
|
* 4. 按功能分区,便于维护
|
|
9
|
-
*/
|
|
9
|
+
*/ // ─── Slate 类型 re-export(唯一的第三方类型例外) ───────────────────────────
|
|
10
10
|
// ─── 通用类型 ────────────────────────────────────────────────────────────────
|
|
11
11
|
export * from "./Types";
|
|
12
12
|
// ─── 布局组件 ────────────────────────────────────────────────────────────────
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant-design/agentic-ui",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.52",
|
|
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",
|