@ant-design/agentic-ui 2.28.0 → 2.28.1

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.
@@ -1,11 +1,3 @@
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
1
  function _define_property(obj, key, value) {
10
2
  if (key in obj) {
11
3
  Object.defineProperty(obj, key, {
@@ -19,33 +11,6 @@ function _define_property(obj, key, value) {
19
11
  }
20
12
  return obj;
21
13
  }
22
- function _iterable_to_array_limit(arr, i) {
23
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
24
- if (_i == null) return;
25
- var _arr = [];
26
- var _n = true;
27
- var _d = false;
28
- var _s, _e;
29
- try {
30
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
31
- _arr.push(_s.value);
32
- if (i && _arr.length === i) break;
33
- }
34
- } catch (err) {
35
- _d = true;
36
- _e = err;
37
- } finally{
38
- try {
39
- if (!_n && _i["return"] != null) _i["return"]();
40
- } finally{
41
- if (_d) throw _e;
42
- }
43
- }
44
- return _arr;
45
- }
46
- function _non_iterable_rest() {
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
- }
49
14
  function _object_spread(target) {
50
15
  for(var i = 1; i < arguments.length; i++){
51
16
  var source = arguments[i] != null ? arguments[i] : {};
@@ -85,20 +50,9 @@ function _object_spread_props(target, source) {
85
50
  }
86
51
  return target;
87
52
  }
88
- function _sliced_to_array(arr, i) {
89
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
90
- }
91
- function _unsupported_iterable_to_array(o, minLen) {
92
- if (!o) return;
93
- if (typeof o === "string") return _array_like_to_array(o, minLen);
94
- var n = Object.prototype.toString.call(o).slice(8, -1);
95
- if (n === "Object" && o.constructor) n = o.constructor.name;
96
- if (n === "Map" || n === "Set") return Array.from(n);
97
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
98
- }
99
- import { ConfigProvider, Skeleton } from "antd";
53
+ import { ConfigProvider } from "antd";
100
54
  import classNames from "classnames";
101
- import React, { useContext, useEffect, useMemo, useState } from "react";
55
+ import React, { useContext, useMemo } from "react";
102
56
  import { ReactEditor, useSlate } from "slate-react";
103
57
  import { useTableStyle } from "./style";
104
58
  import { SlateTable } from "./Table";
@@ -111,51 +65,52 @@ import { TablePropsProvider } from "./TableContext";
111
65
  var baseCls = getPrefixCls('agentic-md-editor-content-table');
112
66
  var editor = useSlate();
113
67
  var _useTableStyle = useTableStyle(baseCls, {}), wrapSSR = _useTableStyle.wrapSSR, hashId = _useTableStyle.hashId;
114
- var _useState = _sliced_to_array(useState(false), 2), showAsText = _useState[0], setShowAsText = _useState[1];
115
- var tableNode = props.element;
116
68
  var tablePath = useMemo(function() {
117
69
  return ReactEditor.findPath(editor, props.element);
118
70
  }, [
119
71
  props.element
120
72
  ]);
121
- // 如果 finished 为 false,设置 5 秒超时,超时后显示为文本
122
- useEffect(function() {
123
- if (tableNode.finished === false) {
124
- setShowAsText(false);
125
- var timer = setTimeout(function() {
126
- setShowAsText(true);
127
- }, 5000);
128
- return function() {
129
- clearTimeout(timer);
130
- };
131
- } else {
132
- setShowAsText(false);
133
- }
134
- }, [
135
- tableNode.finished
136
- ]);
137
- // 如果是不完整状态
138
- if (tableNode.finished === false) {
139
- // 如果 5 秒后仍未完成,显示为文本
140
- if (showAsText) {
141
- return /*#__PURE__*/ React.createElement("div", props.attributes, /*#__PURE__*/ React.createElement("div", {
142
- style: {
143
- padding: '8px 12px',
144
- border: '1px solid #d9d9d9',
145
- borderRadius: '4px',
146
- color: 'rgba(0, 0, 0, 0.65)',
147
- wordBreak: 'break-all'
148
- }
149
- }, "表格链接"), props.children);
150
- }
151
- // 5 秒内显示加载骨架屏
152
- return /*#__PURE__*/ React.createElement("div", props.attributes, /*#__PURE__*/ React.createElement(Skeleton, {
153
- active: true,
154
- paragraph: {
155
- rows: 3
156
- }
157
- }), props.children);
158
- }
73
+ // // 如果 finished 为 false,设置 5 秒超时,超时后显示为文本
74
+ // useEffect(() => {
75
+ // if (tableNode.finished === false) {
76
+ // setShowAsText(false);
77
+ // const timer = setTimeout(() => {
78
+ // setShowAsText(true);
79
+ // }, 5000);
80
+ // return () => {
81
+ // clearTimeout(timer);
82
+ // };
83
+ // } else {
84
+ // setShowAsText(false);
85
+ // }
86
+ // }, [tableNode.finished]);
87
+ // // 如果是不完整状态
88
+ // if (tableNode.finished === false) {
89
+ // // 如果 5 秒后仍未完成,显示为文本
90
+ // if (showAsText) {
91
+ // return (
92
+ // <div {...props.attributes}>
93
+ // <div
94
+ // style={{
95
+ // padding: '8px 12px',
96
+ // border: '1px solid #d9d9d9',
97
+ // borderRadius: '4px',
98
+ // color: 'rgba(0, 0, 0, 0.65)',
99
+ // wordBreak: 'break-all',
100
+ // }}
101
+ // ></div>
102
+ // {props.children}
103
+ // </div>
104
+ // );
105
+ // }
106
+ // // 5 秒内显示加载骨架屏
107
+ // return (
108
+ // <div {...props.attributes}>
109
+ // <Skeleton active paragraph={{ rows: 3 }} />
110
+ // {props.children}
111
+ // </div>
112
+ // );
113
+ // }
159
114
  return wrapSSR(/*#__PURE__*/ React.createElement(TablePropsProvider, {
160
115
  tablePath: tablePath,
161
116
  tableNode: props.element
@@ -148,7 +148,7 @@ var myRemark = {
148
148
  * @param parserConfig - 解析配置
149
149
  * @returns 返回表格或图表节点
150
150
  */ export var parseTableOrChart = function(table, preNode, plugins, parseNodes, parserConfig) {
151
- var _table_children, _tableHeader_children, _table_children_slice, _table_children1, _table_align, _chartConfig_, _config_at, _config_at1;
151
+ var _table_children, _tableHeader_children, _table_children_slice, _table_children1, _table_align;
152
152
  var keyMap = new Map();
153
153
  var config = (preNode === null || preNode === void 0 ? void 0 : preNode.type) === 'code' && (preNode === null || preNode === void 0 ? void 0 : preNode.language) === 'html' && (preNode === null || preNode === void 0 ? void 0 : preNode.otherProps) ? preNode === null || preNode === void 0 ? void 0 : preNode.otherProps : parserConfig || {};
154
154
  var tableHeader = table === null || table === void 0 ? void 0 : (_table_children = table.children) === null || _table_children === void 0 ? void 0 : _table_children.at(0);
@@ -233,7 +233,14 @@ var myRemark = {
233
233
  var chartConfig = Array.isArray(config === null || config === void 0 ? void 0 : config.config) ? config.config : (config === null || config === void 0 ? void 0 : config.config) || config;
234
234
  // 如果 chartConfig 是对象且键都是数字(如 {0: {...}}),转换为数组
235
235
  chartConfig = convertObjectToArray(chartConfig);
236
- var isChart = (chartConfig === null || chartConfig === void 0 ? void 0 : chartConfig.chartType) || Array.isArray(chartConfig) && (chartConfig === null || chartConfig === void 0 ? void 0 : (_chartConfig_ = chartConfig[0]) === null || _chartConfig_ === void 0 ? void 0 : _chartConfig_.chartType) || (config === null || config === void 0 ? void 0 : config.chartType) || (config === null || config === void 0 ? void 0 : (_config_at1 = config.at) === null || _config_at1 === void 0 ? void 0 : (_config_at = _config_at1.call(config, 0)) === null || _config_at === void 0 ? void 0 : _config_at.chartType);
236
+ // 获取 chartType,支持多种配置格式
237
+ var getChartType = function() {
238
+ var _chartConfig_, _config_at, _config_at1;
239
+ return (chartConfig === null || chartConfig === void 0 ? void 0 : chartConfig.chartType) || Array.isArray(chartConfig) && (chartConfig === null || chartConfig === void 0 ? void 0 : (_chartConfig_ = chartConfig[0]) === null || _chartConfig_ === void 0 ? void 0 : _chartConfig_.chartType) || (config === null || config === void 0 ? void 0 : config.chartType) || (config === null || config === void 0 ? void 0 : (_config_at1 = config.at) === null || _config_at1 === void 0 ? void 0 : (_config_at = _config_at1.call(config, 0)) === null || _config_at === void 0 ? void 0 : _config_at.chartType);
240
+ };
241
+ var chartType = getChartType();
242
+ // 如果 chartType 为 "table",将其视为不存在,按普通表格处理
243
+ var isChart = chartType && chartType !== 'table';
237
244
  // 计算合并单元格信息
238
245
  var mergeCells = (config === null || config === void 0 ? void 0 : config.mergeCells) || [];
239
246
  // 创建合并单元格映射,用于快速查找
@@ -319,6 +319,9 @@ import { useStyle } from "./style";
319
319
  line: {
320
320
  borderWidth: 3
321
321
  }
322
+ },
323
+ animation: {
324
+ duration: isMobile ? 200 : 400
322
325
  }
323
326
  };
324
327
  var handleDownload = function() {
@@ -807,6 +807,9 @@ var BarChart = function(param) {
807
807
  color: gridColor
808
808
  }
809
809
  }
810
+ },
811
+ animation: {
812
+ duration: isMobile ? 200 : 400
810
813
  }
811
814
  };
812
815
  // 合并外部传入的选项与默认选项
@@ -554,7 +554,7 @@ import { useStyle } from "./style";
554
554
  }
555
555
  },
556
556
  animation: {
557
- duration: isMobile ? 200 : 1000
557
+ duration: isMobile ? 200 : 400
558
558
  },
559
559
  interaction: {
560
560
  mode: 'point',
@@ -643,6 +643,9 @@ var FunnelChart = function(_param) {
643
643
  display: false
644
644
  }
645
645
  }
646
+ },
647
+ animation: {
648
+ duration: isMobile ? 200 : 400
646
649
  }
647
650
  };
648
651
  var handleDownload = function() {
@@ -334,6 +334,9 @@ var LineChart = function(_param) {
334
334
  line: {
335
335
  borderWidth: 3
336
336
  }
337
+ },
338
+ animation: {
339
+ duration: isMobile ? 200 : 400
337
340
  }
338
341
  };
339
342
  var handleDownload = function() {
@@ -525,6 +525,9 @@ var RadarChart = function(_param) {
525
525
  point: {
526
526
  hoverRadius: isMobile ? 4 : 6
527
527
  }
528
+ },
529
+ animation: {
530
+ duration: isMobile ? 200 : 400
528
531
  }
529
532
  };
530
533
  var handleDownload = function() {
@@ -576,6 +576,9 @@ var ScatterChart = function(_param) {
576
576
  point: {
577
577
  hoverRadius: isMobile ? 6 : 8
578
578
  }
579
+ },
580
+ animation: {
581
+ duration: isMobile ? 200 : 400
579
582
  }
580
583
  };
581
584
  var handleDownload = function() {
@@ -1,7 +1,54 @@
1
1
  /**
2
2
  * @fileoverview 思考块组件
3
3
  * 只读模式下渲染思考类型的代码块
4
- */ import React, { useContext } from "react";
4
+ */ function _array_like_to_array(arr, len) {
5
+ if (len == null || len > arr.length) len = arr.length;
6
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7
+ return arr2;
8
+ }
9
+ function _array_with_holes(arr) {
10
+ if (Array.isArray(arr)) return arr;
11
+ }
12
+ function _iterable_to_array_limit(arr, i) {
13
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
14
+ if (_i == null) return;
15
+ var _arr = [];
16
+ var _n = true;
17
+ var _d = false;
18
+ var _s, _e;
19
+ try {
20
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
21
+ _arr.push(_s.value);
22
+ if (i && _arr.length === i) break;
23
+ }
24
+ } catch (err) {
25
+ _d = true;
26
+ _e = err;
27
+ } finally{
28
+ try {
29
+ if (!_n && _i["return"] != null) _i["return"]();
30
+ } finally{
31
+ if (_d) throw _e;
32
+ }
33
+ }
34
+ return _arr;
35
+ }
36
+ function _non_iterable_rest() {
37
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
38
+ }
39
+ function _sliced_to_array(arr, i) {
40
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
41
+ }
42
+ function _unsupported_iterable_to_array(o, minLen) {
43
+ if (!o) return;
44
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
45
+ var n = Object.prototype.toString.call(o).slice(8, -1);
46
+ if (n === "Object" && o.constructor) n = o.constructor.name;
47
+ if (n === "Map" || n === "Set") return Array.from(n);
48
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
49
+ }
50
+ import { useMergedState } from "rc-util";
51
+ import React, { useContext, useEffect } from "react";
5
52
  import { MessagesContext } from "../../../Bubble/MessagesContent/BubbleContext";
6
53
  import { I18nContext } from "../../../I18n";
7
54
  import { EditorStoreContext } from "../../../MarkdownEditor/editor/store";
@@ -20,15 +67,28 @@ import { ToolUseBarThink } from "../../../ToolUseBarThink";
20
67
  };
21
68
  export function ThinkBlock(param) {
22
69
  var element = param.element;
23
- var _editorProps_codeProps;
70
+ var _editorProps_codeProps, _editorProps_codeProps1;
24
71
  var locale = useContext(I18nContext).locale;
25
72
  var editorProps = (useContext(EditorStoreContext) || {}).editorProps;
26
73
  var message = useContext(MessagesContext).message;
74
+ // 获取当前 Bubble 的 isFinished 状态
75
+ var bubbleIsFinished = message === null || message === void 0 ? void 0 : message.isFinished;
76
+ var _useMergedState = _sliced_to_array(useMergedState(function() {
77
+ return bubbleIsFinished ? undefined : false;
78
+ }, {
79
+ value: editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_codeProps = editorProps.codeProps) === null || _editorProps_codeProps === void 0 ? void 0 : _editorProps_codeProps.alwaysExpandedDeepThink,
80
+ defaultValue: editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_codeProps1 = editorProps.codeProps) === null || _editorProps_codeProps1 === void 0 ? void 0 : _editorProps_codeProps1.alwaysExpandedDeepThink
81
+ }), 2), expanded = _useMergedState[0], setExpanded = _useMergedState[1];
82
+ useEffect(function() {
83
+ if (bubbleIsFinished) {
84
+ setExpanded(true);
85
+ }
86
+ }, [
87
+ bubbleIsFinished
88
+ ]);
27
89
  var rawContent = (element === null || element === void 0 ? void 0 : element.value) !== null && (element === null || element === void 0 ? void 0 : element.value) !== undefined ? String(element.value).trim() : '';
28
90
  // 恢复内容中被转义的代码块
29
91
  var content = restoreCodeBlocks(rawContent);
30
- // 获取当前 Bubble 的 isFinished 状态
31
- var bubbleIsFinished = message === null || message === void 0 ? void 0 : message.isFinished;
32
92
  // 判断是否正在加载:内容以...结尾 或者 bubble 还未完成
33
93
  var isLoading = content.endsWith('...');
34
94
  var toolNameText = isLoading ? (locale === null || locale === void 0 ? void 0 : locale['think.deepThinkingInProgress']) || '深度思考...' : (locale === null || locale === void 0 ? void 0 : locale['think.deepThinking']) || '深度思考';
@@ -41,7 +101,8 @@ export function ThinkBlock(param) {
41
101
  marginTop: 8
42
102
  }
43
103
  },
44
- expanded: (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_codeProps = editorProps.codeProps) === null || _editorProps_codeProps === void 0 ? void 0 : _editorProps_codeProps.alwaysExpandedDeepThink) ? true : bubbleIsFinished ? false : undefined,
104
+ expanded: expanded,
105
+ onExpandedChange: setExpanded,
45
106
  toolName: toolNameText,
46
107
  thinkContent: content,
47
108
  status: isLoading ? 'loading' : 'success'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.28.0",
3
+ "version": "2.28.1",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",