@ant-design/agentic-ui 2.29.48 → 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.
Files changed (38) hide show
  1. package/dist/Bubble/List/PureBubbleList.d.ts +1 -1
  2. package/dist/Bubble/List/PureBubbleList.js +9 -6
  3. package/dist/Bubble/MessagesContent/index.js +2 -2
  4. package/dist/ChatLayout/style.js +2 -1
  5. package/dist/Components/ActionItemBox/style.js +1 -1
  6. package/dist/Constants/mobile.d.ts +12 -2
  7. package/dist/Constants/mobile.js +8 -1
  8. package/dist/History/hooks/useHistory.js +33 -31
  9. package/dist/History/menu.js +4 -0
  10. package/dist/MarkdownEditor/BaseMarkdownEditor.js +1 -1
  11. package/dist/MarkdownEditor/editor/Editor.js +22 -0
  12. package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +36 -34
  13. package/dist/MarkdownEditor/editor/elements/Table/Table.js +19 -44
  14. package/dist/MarkdownEditor/editor/elements/Table/TableColgroup.d.ts +8 -0
  15. package/dist/MarkdownEditor/editor/elements/Table/TableColgroup.js +37 -0
  16. package/dist/MarkdownEditor/editor/elements/Table/utils/getTableColWidths.d.ts +12 -0
  17. package/dist/MarkdownEditor/editor/elements/Table/utils/getTableColWidths.js +186 -0
  18. package/dist/MarkdownEditor/editor/elements/Table/utils/useReadonlyTableColWidths.d.ts +13 -0
  19. package/dist/MarkdownEditor/editor/elements/Table/utils/useReadonlyTableColWidths.js +96 -0
  20. package/dist/MarkdownEditor/editor/parser/parse/parseTable.js +21 -0
  21. package/dist/MarkdownEditor/editor/plugins/withLinkAndMediaPlugin.js +28 -0
  22. package/dist/MarkdownEditor/editor/style.js +12 -12
  23. package/dist/MarkdownEditor/style.js +37 -37
  24. package/dist/MarkdownEditor/types.d.ts +29 -0
  25. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.d.ts +4 -4
  26. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +3 -3
  27. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/index.js +4 -24
  28. package/dist/MarkdownInputField/FileMapView/index.js +1 -1
  29. package/dist/MarkdownInputField/MarkdownInputField.js +20 -9
  30. package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +4 -3
  31. package/dist/MarkdownInputField/types/MarkdownInputFieldProps.d.ts +14 -1
  32. package/dist/Plugins/chart/ChartRender.js +78 -14
  33. package/dist/ThoughtChainList/index.js +17 -17
  34. package/dist/ToolUseBar/style.js +3 -0
  35. package/dist/Workspace/index.js +5 -1
  36. package/dist/index.d.ts +0 -1
  37. package/dist/index.js +1 -1
  38. package/package.json +1 -1
@@ -0,0 +1,186 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_without_holes(arr) {
7
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
8
+ }
9
+ function _iterable_to_array(iter) {
10
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
11
+ }
12
+ function _non_iterable_spread() {
13
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
14
+ }
15
+ function _to_consumable_array(arr) {
16
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
17
+ }
18
+ function _type_of(obj) {
19
+ "@swc/helpers - typeof";
20
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
21
+ }
22
+ function _unsupported_iterable_to_array(o, minLen) {
23
+ if (!o) return;
24
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
25
+ var n = Object.prototype.toString.call(o).slice(8, -1);
26
+ if (n === "Object" && o.constructor) n = o.constructor.name;
27
+ if (n === "Map" || n === "Set") return Array.from(n);
28
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
29
+ }
30
+ import { Node } from "slate";
31
+ import stringWidth from "string-width";
32
+ import { TABLE_DEFAULT_COL_WIDTH, TABLE_COL_WIDTH_MIN_COLUMNS } from "../../../../../Constants/mobile";
33
+ var SMART_SAMPLE_ROWS = 5;
34
+ var SMART_CELL_PADDING = 28; // 20 基础内边距 + 8 数字等字符宽度补偿
35
+ var SMART_FONT = '14px sans-serif';
36
+ var CHAR_WIDTH_PX = 12;
37
+ var WORD_SPLIT = /[\s\u4e00-\u9fa5]/;
38
+ function getTableRows(element) {
39
+ return element.children.flatMap(function(node) {
40
+ return node.type === 'table-row' ? [
41
+ node
42
+ ] : 'children' in node ? node.children : [];
43
+ });
44
+ }
45
+ function getSampledCellTexts(element, columnCount, maxRows) {
46
+ return getTableRows(element).slice(0, maxRows).map(function(row) {
47
+ return Array.from({
48
+ length: columnCount
49
+ }, function(_, i) {
50
+ var _row_children;
51
+ var cell = (_row_children = row.children) === null || _row_children === void 0 ? void 0 : _row_children[i];
52
+ return cell && (typeof cell === "undefined" ? "undefined" : _type_of(cell)) === 'object' && 'children' in cell ? Node.string(cell) : '';
53
+ });
54
+ });
55
+ }
56
+ function createMeasureContext() {
57
+ if (typeof document === 'undefined') return null;
58
+ var ctx = document.createElement('canvas').getContext('2d');
59
+ if (!ctx) return null;
60
+ ctx.font = SMART_FONT;
61
+ return ctx;
62
+ }
63
+ function measureText(ctx, text, pad) {
64
+ return text === null || text === undefined ? pad : ctx.measureText(String(text)).width + pad;
65
+ }
66
+ function getColumnMetrics(grid, col, ctx, pad) {
67
+ var maxW = 0;
68
+ var minW = 0;
69
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
70
+ try {
71
+ for(var _iterator = grid[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
72
+ var row = _step.value;
73
+ var _Math;
74
+ var _row_col;
75
+ var cellText = (_row_col = row[col]) !== null && _row_col !== void 0 ? _row_col : '';
76
+ var full = measureText(ctx, cellText, pad);
77
+ var words = cellText.split(WORD_SPLIT).filter(Boolean);
78
+ var longest = words.length ? (_Math = Math).max.apply(_Math, _to_consumable_array(words.map(function(w) {
79
+ return measureText(ctx, w, pad);
80
+ }))) : measureText(ctx, cellText, pad);
81
+ maxW = Math.max(maxW, full);
82
+ minW = Math.max(minW, longest);
83
+ }
84
+ } catch (err) {
85
+ _didIteratorError = true;
86
+ _iteratorError = err;
87
+ } finally{
88
+ try {
89
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
90
+ _iterator.return();
91
+ }
92
+ } finally{
93
+ if (_didIteratorError) {
94
+ throw _iteratorError;
95
+ }
96
+ }
97
+ }
98
+ return {
99
+ maxW: maxW,
100
+ minW: minW
101
+ };
102
+ }
103
+ function getSmartColWidthsPx(grid, columnCount, containerWidth) {
104
+ if (columnCount <= TABLE_COL_WIDTH_MIN_COLUMNS || !grid.length || containerWidth <= 0) {
105
+ return null;
106
+ }
107
+ var ctx = createMeasureContext();
108
+ if (!ctx) return null;
109
+ var metrics = Array.from({
110
+ length: columnCount
111
+ }, function(_, i) {
112
+ return getColumnMetrics(grid, i, ctx, SMART_CELL_PADDING);
113
+ });
114
+ var totalMin = metrics.reduce(function(s, c) {
115
+ return s + c.minW;
116
+ }, 0);
117
+ if (totalMin >= containerWidth) return metrics.map(function(c) {
118
+ return c.minW;
119
+ });
120
+ var remaining = containerWidth - totalMin;
121
+ var totalFlex = metrics.reduce(function(s, c) {
122
+ return s + (c.maxW - c.minW);
123
+ }, 0) || 1;
124
+ return metrics.map(function(c) {
125
+ return Math.floor(c.minW + (c.maxW - c.minW) / totalFlex * remaining);
126
+ });
127
+ }
128
+ function getContentBasedColWidthsPx(element, columnCount) {
129
+ var rows = getTableRows(element);
130
+ return Array.from({
131
+ length: columnCount
132
+ }, function(_, colIndex) {
133
+ var maxPx = TABLE_DEFAULT_COL_WIDTH;
134
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
135
+ try {
136
+ for(var _iterator = rows[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
137
+ var row = _step.value;
138
+ var _row_children;
139
+ var cell = (_row_children = row.children) === null || _row_children === void 0 ? void 0 : _row_children[colIndex];
140
+ if (cell && (typeof cell === "undefined" ? "undefined" : _type_of(cell)) === 'object' && 'children' in cell) {
141
+ var w = stringWidth(Node.string(cell)) * CHAR_WIDTH_PX;
142
+ if (w > maxPx) maxPx = w;
143
+ }
144
+ }
145
+ } catch (err) {
146
+ _didIteratorError = true;
147
+ _iteratorError = err;
148
+ } finally{
149
+ try {
150
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
151
+ _iterator.return();
152
+ }
153
+ } finally{
154
+ if (_didIteratorError) {
155
+ throw _iteratorError;
156
+ }
157
+ }
158
+ }
159
+ return maxPx;
160
+ });
161
+ }
162
+ function pxToPercent(px) {
163
+ var total = px.reduce(function(a, b) {
164
+ return a + b;
165
+ }, 0);
166
+ return total <= 0 ? px.map(function() {
167
+ return '0%';
168
+ }) : px.map(function(w) {
169
+ return "".concat((w / total * 100).toFixed(2), "%");
170
+ });
171
+ }
172
+ /** 只读表格列宽:显式 colWidths > 智能算法(6+列) > 内容比例 > 平分 */ export function getReadonlyTableColWidths(input) {
173
+ var _otherProps_colWidths, _element_children, _element_children1;
174
+ var columnCount = input.columnCount, otherProps = input.otherProps, element = input.element, containerWidth = input.containerWidth;
175
+ if (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps_colWidths = otherProps.colWidths) === null || _otherProps_colWidths === void 0 ? void 0 : _otherProps_colWidths.length) return otherProps.colWidths;
176
+ if (columnCount === 0) return [];
177
+ var useSmart = (element === null || element === void 0 ? void 0 : (_element_children = element.children) === null || _element_children === void 0 ? void 0 : _element_children.length) && typeof containerWidth === 'number' && containerWidth > 0;
178
+ if (useSmart) {
179
+ var grid = getSampledCellTexts(element, columnCount, SMART_SAMPLE_ROWS);
180
+ var smart = getSmartColWidthsPx(grid, columnCount, containerWidth);
181
+ if (smart) return smart;
182
+ }
183
+ if (element === null || element === void 0 ? void 0 : (_element_children1 = element.children) === null || _element_children1 === void 0 ? void 0 : _element_children1.length) return pxToPercent(getContentBasedColWidthsPx(element, columnCount));
184
+ var pct = (100 / columnCount).toFixed(2);
185
+ return Array(columnCount).fill("".concat(pct, "%"));
186
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import type { TableNode } from '../../../types/Table';
3
+ import type { ColWidthValue } from './getTableColWidths';
4
+ export interface UseReadonlyTableColWidthsParams {
5
+ columnCount: number;
6
+ otherProps?: {
7
+ colWidths?: ColWidthValue[];
8
+ } | null;
9
+ containerRef: React.RefObject<HTMLDivElement | null>;
10
+ tableRef: React.RefObject<HTMLTableElement | null>;
11
+ element?: TableNode | null;
12
+ }
13
+ export declare function useReadonlyTableColWidths({ columnCount, otherProps, containerRef, tableRef, element, }: UseReadonlyTableColWidthsParams): ColWidthValue[];
@@ -0,0 +1,96 @@
1
+ function _array_like_to_array(arr, len) {
2
+ if (len == null || len > arr.length) len = arr.length;
3
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
4
+ return arr2;
5
+ }
6
+ function _array_with_holes(arr) {
7
+ if (Array.isArray(arr)) return arr;
8
+ }
9
+ function _iterable_to_array_limit(arr, i) {
10
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
11
+ if (_i == null) return;
12
+ var _arr = [];
13
+ var _n = true;
14
+ var _d = false;
15
+ var _s, _e;
16
+ try {
17
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
18
+ _arr.push(_s.value);
19
+ if (i && _arr.length === i) break;
20
+ }
21
+ } catch (err) {
22
+ _d = true;
23
+ _e = err;
24
+ } finally{
25
+ try {
26
+ if (!_n && _i["return"] != null) _i["return"]();
27
+ } finally{
28
+ if (_d) throw _e;
29
+ }
30
+ }
31
+ return _arr;
32
+ }
33
+ function _non_iterable_rest() {
34
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
35
+ }
36
+ function _sliced_to_array(arr, i) {
37
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
38
+ }
39
+ function _unsupported_iterable_to_array(o, minLen) {
40
+ if (!o) return;
41
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
42
+ var n = Object.prototype.toString.call(o).slice(8, -1);
43
+ if (n === "Object" && o.constructor) n = o.constructor.name;
44
+ if (n === "Map" || n === "Set") return Array.from(n);
45
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
46
+ }
47
+ import { useEffect, useMemo, useState } from "react";
48
+ import { TABLE_COL_WIDTH_MIN_COLUMNS } from "../../../../../Constants/mobile";
49
+ import { getReadonlyTableColWidths } from "./getTableColWidths";
50
+ export function useReadonlyTableColWidths(param) {
51
+ var columnCount = param.columnCount, otherProps = param.otherProps, containerRef = param.containerRef, tableRef = param.tableRef, element = param.element;
52
+ var _useState = _sliced_to_array(useState(false), 2), needsColWidths = _useState[0], setNeedsColWidths = _useState[1];
53
+ var _useState1 = _sliced_to_array(useState(0), 2), containerWidth = _useState1[0], setContainerWidth = _useState1[1];
54
+ var computed = useMemo(function() {
55
+ return getReadonlyTableColWidths({
56
+ columnCount: columnCount,
57
+ otherProps: otherProps,
58
+ element: element,
59
+ containerWidth: containerWidth || undefined
60
+ });
61
+ }, [
62
+ columnCount,
63
+ otherProps,
64
+ element,
65
+ containerWidth
66
+ ]);
67
+ useEffect(function() {
68
+ var container = containerRef.current;
69
+ var table = tableRef.current;
70
+ if (!container || !table || columnCount === 0) return;
71
+ var check = function check() {
72
+ var cw = container.clientWidth;
73
+ setContainerWidth(cw);
74
+ setNeedsColWidths(cw === 0 || table.scrollWidth > cw);
75
+ };
76
+ var ro = new ResizeObserver(check);
77
+ ro.observe(container);
78
+ check();
79
+ return function() {
80
+ return ro.disconnect();
81
+ };
82
+ }, [
83
+ columnCount
84
+ ]);
85
+ return useMemo(function() {
86
+ var _otherProps_colWidths;
87
+ if (otherProps === null || otherProps === void 0 ? void 0 : (_otherProps_colWidths = otherProps.colWidths) === null || _otherProps_colWidths === void 0 ? void 0 : _otherProps_colWidths.length) return otherProps.colWidths;
88
+ if (columnCount >= TABLE_COL_WIDTH_MIN_COLUMNS) return computed;
89
+ return needsColWidths ? computed : [];
90
+ }, [
91
+ otherProps === null || otherProps === void 0 ? void 0 : otherProps.colWidths,
92
+ needsColWidths,
93
+ computed,
94
+ columnCount
95
+ ]);
96
+ }
@@ -255,6 +255,27 @@ var myRemark = {
255
255
  var chartType = getChartType();
256
256
  // 如果 chartType 为 "table",将其视为不存在,按普通表格处理
257
257
  var isChart = chartType && chartType !== 'table';
258
+ // 图表的 x、y 必须在表格列中存在,否则降级为表格渲染
259
+ if (isChart && chartConfig) {
260
+ var columnKeys = new Set(columns.map(function(c) {
261
+ return c.dataIndex;
262
+ }));
263
+ var configsToValidate = Array.isArray(chartConfig) ? chartConfig : [
264
+ chartConfig
265
+ ];
266
+ var isChartConfigValid = function isChartConfigValid(cfg) {
267
+ if (!cfg || cfg.chartType === 'table') return true;
268
+ if (cfg.x && !columnKeys.has(cfg.x)) return false;
269
+ if (cfg.y && !columnKeys.has(cfg.y)) return false;
270
+ return true;
271
+ };
272
+ var allConfigsValid = configsToValidate.every(function(c) {
273
+ return isChartConfigValid(c);
274
+ });
275
+ if (!allConfigsValid) {
276
+ isChart = false;
277
+ }
278
+ }
258
279
  // 计算合并单元格信息
259
280
  var mergeCells = (config === null || config === void 0 ? void 0 : config.mergeCells) || [];
260
281
  // 创建合并单元格映射,用于快速查找
@@ -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,
@@ -417,15 +416,16 @@ var genStyle = function genStyle(token) {
417
416
  margin: '16px 0',
418
417
  maxWidth: '100%'
419
418
  }, _define_property(_obj1, "&".concat(token.componentCls, "-content-table-readonly-table"), {
420
- width: '100%'
421
- }), _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"), {
419
+ width: '100%',
420
+ minWidth: 'max-content'
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"), {
422
422
  border: 'none',
423
423
  borderRadius: 'none',
424
424
  'tr:not(.config-tr) td:not(.config-td)': {
425
425
  borderLeft: 'none'
426
426
  },
427
427
  'tr:not(.config-tr):last-child td:not(.config-td)': {
428
- borderBottom: '1px solid var(--table-border-color)'
428
+ borderBottom: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)'
429
429
  },
430
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])': {
431
431
  borderTopLeftRadius: 'unset'
@@ -440,23 +440,23 @@ var genStyle = function genStyle(token) {
440
440
  borderBottomRightRadius: 'unset'
441
441
  }
442
442
  }), _define_property(_obj1, 'th.config-th,td.config-td', {
443
- borderBottom: '1px solid var(--table-border-color)',
444
- 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)'
445
445
  }), _define_property(_obj1, 'tr td.config-td:first-child', {
446
446
  borderLeft: 'none'
447
447
  }), _define_property(_obj1, 'th:not(.config-td)', {
448
- backgroundColor: 'var(--table-header-bg)',
449
- 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)',
450
450
  textWrap: 'nowrap',
451
451
  verticalAlign: 'top',
452
- padding: 'var(--table-cell-padding, 16px 12px)',
452
+ padding: 'var(--agentic-ui-table-cell-padding, 16px 12px)',
453
453
  textAlign: 'left',
454
454
  lineHeight: '24px',
455
455
  fontSize: '1em',
456
456
  fontWeight: 600,
457
457
  borderTop: 'none',
458
- minWidth: 'var(--table-cell-min-width)',
459
- 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)',
460
460
  whiteSpace: 'nowrap',
461
461
  overflow: 'hidden',
462
462
  textOverflow: 'ellipsis',
@@ -464,13 +464,13 @@ var genStyle = function genStyle(token) {
464
464
  background: 'inherit'
465
465
  }), _define_property(_obj1, 'td:not(.config-td)', {
466
466
  verticalAlign: 'top',
467
- padding: 'var(--table-cell-padding, 16px 12px)',
467
+ padding: 'var(--agentic-ui-table-cell-padding, 16px 12px)',
468
468
  textAlign: 'left',
469
469
  position: 'relative',
470
470
  lineHeight: '24px',
471
471
  fontSize: '1em',
472
- minWidth: 'var(--table-cell-min-width)',
473
- 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)',
474
474
  whiteSpace: 'nowrap',
475
475
  overflow: 'hidden',
476
476
  textOverflow: 'ellipsis',
@@ -486,8 +486,8 @@ var genStyle = function genStyle(token) {
486
486
  borderTop: 'none'
487
487
  },
488
488
  'td:not(.config-td)': {
489
- borderBottom: '1px solid var(--table-border-color)',
490
- 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)',
491
491
  '&:first-child': {
492
492
  fontSize: '1em',
493
493
  lineHeight: '24px',
@@ -501,32 +501,32 @@ var genStyle = function genStyle(token) {
501
501
  borderBottom: 'none'
502
502
  }
503
503
  }), _define_property(_obj1, 'tbody tr:not(.config-tr):hover', {
504
- background: 'linear-gradient(var(--table-hover-bg), var(--table-hover-bg)), linear-gradient(white, white)'
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))'
505
505
  }), // 表格圆角处理
506
506
  _define_property(_obj1, 'th:not(.config-td), td:not(.config-td)', {
507
507
  borderRadius: '0'
508
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])', {
509
- borderTopLeftRadius: 'var(--table-border-radius)'
509
+ borderTopLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)'
510
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])', {
511
- borderTopRightRadius: 'var(--table-border-radius)'
511
+ borderTopRightRadius: 'var(--agentic-ui-table-border-radius, 8px)'
512
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])', {
513
- borderBottomLeftRadius: 'var(--table-border-radius)'
513
+ borderBottomLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)'
514
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])', {
515
- borderBottomRightRadius: 'var(--table-border-radius)'
515
+ borderBottomRightRadius: 'var(--agentic-ui-table-border-radius, 8px)'
516
516
  }), // 处理合并单元格的圆角
517
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', {
518
- borderTopLeftRadius: 'var(--table-border-radius)'
518
+ borderTopLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)'
519
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', {
520
- borderTopRightRadius: 'var(--table-border-radius)'
520
+ borderTopRightRadius: 'var(--agentic-ui-table-border-radius, 8px)'
521
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', {
522
- borderBottomLeftRadius: 'var(--table-border-radius)'
522
+ borderBottomLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)'
523
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', {
524
- borderBottomRightRadius: 'var(--table-border-radius)'
524
+ borderBottomRightRadius: 'var(--agentic-ui-table-border-radius, 8px)'
525
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', {
526
- borderRadius: 'var(--table-border-radius)'
526
+ borderRadius: 'var(--agentic-ui-table-border-radius, 8px)'
527
527
  }), _define_property(_obj1, 'th:not(.config-td)[rowspan]:first-child:last-child, td:not(.config-td)[rowspan]:first-child:last-child', {
528
- borderTopLeftRadius: 'var(--table-border-radius)',
529
- borderBottomLeftRadius: 'var(--table-border-radius)'
528
+ borderTopLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)',
529
+ borderBottomLeftRadius: 'var(--agentic-ui-table-border-radius, 8px)'
530
530
  }), _define_property(_obj1, "@media (max-width: ".concat(MOBILE_BREAKPOINT, ")"), {
531
531
  'th:not(.config-td), td:not(.config-td)': {
532
532
  padding: "".concat(MOBILE_PADDING)
@@ -596,7 +596,7 @@ var genStyle = function genStyle(token) {
596
596
  zIndex: 1000,
597
597
  justifyContent: 'center',
598
598
  fontSize: 12,
599
- border: '1px solid var(--table-border-color)',
599
+ border: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)',
600
600
  width: '20px',
601
601
  height: '20px',
602
602
  cursor: 'pointer',
@@ -650,7 +650,7 @@ var genStyle = function genStyle(token) {
650
650
  alignItems: 'center',
651
651
  justifyContent: 'center',
652
652
  fontSize: 12,
653
- border: '1px solid var(--table-border-color)',
653
+ border: '1px solid var(--agentic-ui-table-border-color, #E7E9E8)',
654
654
  width: '20px',
655
655
  height: '20px',
656
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 配置:语法高亮与模板面板(输入 `{}` 触发)
@@ -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: () => void;
7
- onDownload: () => void;
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;