@ant-design/agentic-ui 2.30.2 → 2.30.4

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 (55) hide show
  1. package/dist/Hooks/useLanguage.d.ts +3 -0
  2. package/dist/I18n/locales.d.ts +3 -0
  3. package/dist/I18n/locales.js +6 -0
  4. package/dist/MarkdownRenderer/CharacterQueue.js +9 -1
  5. package/dist/MarkdownRenderer/MarkdownRenderer.js +11 -3
  6. package/dist/MarkdownRenderer/types.d.ts +6 -0
  7. package/dist/MarkdownRenderer/useMarkdownToReact.js +3 -1
  8. package/dist/Plugins/chart/AreaChart/index.js +4 -3
  9. package/dist/Plugins/chart/BarChart/index.js +3 -3
  10. package/dist/Plugins/chart/BoxPlotChart/index.d.ts +65 -0
  11. package/dist/Plugins/chart/BoxPlotChart/index.js +665 -0
  12. package/dist/Plugins/chart/BoxPlotChart/style.d.ts +8 -0
  13. package/dist/Plugins/chart/BoxPlotChart/style.js +118 -0
  14. package/dist/Plugins/chart/ChartAttrToolBar/index.js +5 -16
  15. package/dist/Plugins/chart/ChartMark/Area.d.ts +2 -1
  16. package/dist/Plugins/chart/ChartMark/Area.js +5 -4
  17. package/dist/Plugins/chart/ChartMark/Bar.d.ts +2 -1
  18. package/dist/Plugins/chart/ChartMark/Bar.js +5 -4
  19. package/dist/Plugins/chart/ChartMark/Column.d.ts +2 -1
  20. package/dist/Plugins/chart/ChartMark/Column.js +5 -4
  21. package/dist/Plugins/chart/ChartMark/Line.d.ts +2 -1
  22. package/dist/Plugins/chart/ChartMark/Line.js +5 -4
  23. package/dist/Plugins/chart/ChartMark/Pie.d.ts +2 -1
  24. package/dist/Plugins/chart/ChartMark/Pie.js +5 -4
  25. package/dist/Plugins/chart/ChartRender.d.ts +1 -1
  26. package/dist/Plugins/chart/ChartRender.js +188 -12
  27. package/dist/Plugins/chart/DonutChart/Legend.d.ts +5 -3
  28. package/dist/Plugins/chart/DonutChart/Legend.js +30 -38
  29. package/dist/Plugins/chart/DonutChart/index.js +82 -23
  30. package/dist/Plugins/chart/DonutChart/plugins.d.ts +2 -2
  31. package/dist/Plugins/chart/DonutChart/plugins.js +5 -5
  32. package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
  33. package/dist/Plugins/chart/FunnelChart/index.js +24 -14
  34. package/dist/Plugins/chart/HistogramChart/index.d.ts +65 -0
  35. package/dist/Plugins/chart/HistogramChart/index.js +665 -0
  36. package/dist/Plugins/chart/HistogramChart/style.d.ts +8 -0
  37. package/dist/Plugins/chart/HistogramChart/style.js +118 -0
  38. package/dist/Plugins/chart/LineChart/index.js +4 -3
  39. package/dist/Plugins/chart/RadarChart/index.d.ts +2 -0
  40. package/dist/Plugins/chart/RadarChart/index.js +28 -26
  41. package/dist/Plugins/chart/ScatterChart/index.d.ts +2 -0
  42. package/dist/Plugins/chart/ScatterChart/index.js +43 -28
  43. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +1 -0
  44. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +14 -0
  45. package/dist/Plugins/chart/components/ChartContainer/ChartDarkAntdContext.d.ts +7 -0
  46. package/dist/Plugins/chart/components/ChartContainer/ChartDarkAntdContext.js +8 -0
  47. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +8 -2
  48. package/dist/Plugins/chart/components/ChartContainer/style.js +3 -3
  49. package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.d.ts +2 -0
  50. package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.js +23 -32
  51. package/dist/Plugins/chart/index.d.ts +4 -0
  52. package/dist/Plugins/chart/index.js +2 -0
  53. package/dist/Plugins/chart/loadChartRuntime.d.ts +4 -0
  54. package/dist/Plugins/chart/loadChartRuntime.js +5 -1
  55. package/package.json +2 -1
@@ -71,6 +71,8 @@ export declare function useLanguage(): {
71
71
  radarChart: string;
72
72
  scatterChart: string;
73
73
  funnelChart: string;
74
+ boxplotChart: string;
75
+ histogramChart: string;
74
76
  configChart: string;
75
77
  updateChart: string;
76
78
  barChart: string;
@@ -168,6 +170,7 @@ export declare function useLanguage(): {
168
170
  runCode: string;
169
171
  rerender: string;
170
172
  download: string;
173
+ copyMarkdown: string;
171
174
  dragToMove: string;
172
175
  format: string;
173
176
  removeLink: string;
@@ -33,6 +33,8 @@ export declare const cnLabels: {
33
33
  radarChart: string;
34
34
  scatterChart: string;
35
35
  funnelChart: string;
36
+ boxplotChart: string;
37
+ histogramChart: string;
36
38
  configChart: string;
37
39
  updateChart: string;
38
40
  barChart: string;
@@ -130,6 +132,7 @@ export declare const cnLabels: {
130
132
  runCode: string;
131
133
  rerender: string;
132
134
  download: string;
135
+ copyMarkdown: string;
133
136
  dragToMove: string;
134
137
  format: string;
135
138
  removeLink: string;
@@ -32,6 +32,8 @@
32
32
  radarChart: '雷达图',
33
33
  scatterChart: '散点图',
34
34
  funnelChart: '漏斗图',
35
+ boxplotChart: '箱线图',
36
+ histogramChart: '直方图',
35
37
  configChart: '配置图表',
36
38
  updateChart: '更新',
37
39
  barChart: '条形图',
@@ -130,6 +132,7 @@
130
132
  runCode: '运行代码',
131
133
  rerender: '重新渲染',
132
134
  download: '下载',
135
+ copyMarkdown: '复制表格',
133
136
  dragToMove: '拖拽移动',
134
137
  format: '格式化',
135
138
  removeLink: '移除链接',
@@ -490,6 +493,8 @@
490
493
  radarChart: 'Radar Chart',
491
494
  scatterChart: 'Scatter Chart',
492
495
  funnelChart: 'Funnel Chart',
496
+ boxplotChart: 'Box Plot',
497
+ histogramChart: 'Histogram',
493
498
  barChart: 'Bar Chart',
494
499
  lineChart: 'Line Chart',
495
500
  columnChart: 'Column Chart',
@@ -552,6 +557,7 @@
552
557
  runCode: 'Run Code',
553
558
  rerender: 'Rerender',
554
559
  download: 'Download',
560
+ copyMarkdown: 'Copy Table',
555
561
  dragToMove: 'Drag to Move',
556
562
  format: 'Format',
557
563
  removeLink: 'Remove Link',
@@ -77,7 +77,8 @@ var DEFAULT_BACKGROUND_BATCH_MULTIPLIER = 10;
77
77
  speed: (_ref2 = options === null || options === void 0 ? void 0 : options.speed) !== null && _ref2 !== void 0 ? _ref2 : DEFAULT_SPEED,
78
78
  flushOnComplete: (_ref3 = options === null || options === void 0 ? void 0 : options.flushOnComplete) !== null && _ref3 !== void 0 ? _ref3 : true,
79
79
  backgroundInterval: (_ref4 = options === null || options === void 0 ? void 0 : options.backgroundInterval) !== null && _ref4 !== void 0 ? _ref4 : DEFAULT_BACKGROUND_INTERVAL,
80
- backgroundBatchMultiplier: (_ref5 = options === null || options === void 0 ? void 0 : options.backgroundBatchMultiplier) !== null && _ref5 !== void 0 ? _ref5 : DEFAULT_BACKGROUND_BATCH_MULTIPLIER
80
+ backgroundBatchMultiplier: (_ref5 = options === null || options === void 0 ? void 0 : options.backgroundBatchMultiplier) !== null && _ref5 !== void 0 ? _ref5 : DEFAULT_BACKGROUND_BATCH_MULTIPLIER,
81
+ animateTailChars: options === null || options === void 0 ? void 0 : options.animateTailChars
81
82
  };
82
83
  this.handleVisibilityChange = this.handleVisibilityChange.bind(this);
83
84
  if (typeof document !== 'undefined') {
@@ -94,6 +95,13 @@ var DEFAULT_BACKGROUND_BATCH_MULTIPLIER = 10;
94
95
  this.onFlush(content);
95
96
  return;
96
97
  }
98
+ // 仅对末尾 N 字做动画:立即展示前面内容
99
+ var tail = this.options.animateTailChars;
100
+ if (tail !== undefined && tail > 0 && content.length > tail) {
101
+ var staticLength = content.length - tail;
102
+ this.displayedLength = Math.max(this.displayedLength, staticLength);
103
+ this.onFlush(content.slice(0, this.displayedLength));
104
+ }
97
105
  this.ensureTicking();
98
106
  }
99
107
  },
@@ -263,7 +263,15 @@ var SCHEMA_LANGUAGES = new Set([
263
263
  }, [
264
264
  plugins
265
265
  ]);
266
- // 字符队列管理
266
+ // 字符队列管理:流式时仅对最后 50 字做动画,避免每段逐字输出
267
+ var resolvedQueueOptions = useMemo(function() {
268
+ return streaming ? _object_spread({
269
+ animateTailChars: 50
270
+ }, queueOptions) : queueOptions;
271
+ }, [
272
+ streaming,
273
+ queueOptions
274
+ ]);
267
275
  useEffect(function() {
268
276
  if (!streaming) {
269
277
  // 非流式:直接展示全部内容
@@ -273,14 +281,14 @@ var SCHEMA_LANGUAGES = new Set([
273
281
  if (!queueRef.current) {
274
282
  queueRef.current = new CharacterQueue(function(displayed) {
275
283
  return setDisplayedContent(displayed);
276
- }, queueOptions);
284
+ }, resolvedQueueOptions);
277
285
  }
278
286
  queueRef.current.push(content || '');
279
287
  return undefined;
280
288
  }, [
281
289
  content,
282
290
  streaming,
283
- queueOptions
291
+ resolvedQueueOptions
284
292
  ]);
285
293
  // 流式完成时 flush 所有剩余内容
286
294
  useEffect(function() {
@@ -6,6 +6,12 @@ export interface CharacterQueueOptions {
6
6
  charsPerFrame?: number;
7
7
  /** 是否启用打字动画,默认 true(流式时) */
8
8
  animate?: boolean;
9
+ /**
10
+ * 仅对末尾 N 个字符做动画,前面内容立即展示。
11
+ * 设为 50 时,每次 push 只对最后 50 字逐字输出,避免整段逐字动画。
12
+ * 默认 undefined 表示整段动画(原有行为)。
13
+ */
14
+ animateTailChars?: number;
9
15
  /** 动画速度因子,1.0 为标准速度 */
10
16
  speed?: number;
11
17
  /** 内容完成后立即 flush 全部剩余 */
@@ -1184,7 +1184,9 @@ export var useMarkdownToReact = function useMarkdownToReact(content, options) {
1184
1184
  var isLast = i === blocks.length - 1;
1185
1185
  // 用 index + 内容前 64 字符作 key,保持稳定性:
1186
1186
  // 相同位置 + 相同内容开头 → 相同 key → React 不 unmount
1187
- var stableKey = "b".concat(i, "-").concat(block.slice(0, 64));
1187
+ // 流式场景下,最后一个块内容频繁变化,若 key 随内容变会导致反复 unmount/remount,
1188
+ // ChartBlockRenderer 等会重复展示 Loading,故对末块使用稳定 key
1189
+ var stableKey = isLast && (options === null || options === void 0 ? void 0 : options.streaming) ? "b".concat(i, "-last") : "b".concat(i, "-").concat(block.slice(0, 64));
1188
1190
  if (!isLast) {
1189
1191
  var cached = cache.get(block);
1190
1192
  if (cached && cached.source === block) {
@@ -194,8 +194,8 @@ import { useStyle } from "./style";
194
194
  return gradient;
195
195
  },
196
196
  pointBackgroundColor: resolvedColor,
197
- pointBorderColor: '#fff',
198
- pointBorderWidth: 1,
197
+ pointBorderColor: isLight ? '#fff' : resolvedColor,
198
+ pointBorderWidth: isLight ? 1 : 0,
199
199
  borderWidth: 3,
200
200
  tension: 0,
201
201
  fill: true
@@ -209,7 +209,8 @@ import { useStyle } from "./style";
209
209
  filteredData,
210
210
  types,
211
211
  xValues,
212
- color
212
+ color,
213
+ isLight
213
214
  ]);
214
215
  var options = {
215
216
  responsive: true,
@@ -121,6 +121,7 @@ import { Bar } from "react-chartjs-2";
121
121
  import { ChartContainer, ChartFilter, ChartStatistic, ChartToolBar, downloadChart } from "../components";
122
122
  import { defaultColorList } from "../const";
123
123
  import { extractAndSortXValues, findDataPointByXValue, hexToRgba, resolveCssVariable, toNumber } from "../utils";
124
+ import { useChartTheme } from "../hooks";
124
125
  import { useStyle } from "./style";
125
126
  /**
126
127
  * @fileoverview 柱状图组件文件
@@ -511,9 +512,8 @@ var BarChart = function BarChart(param) {
511
512
  }, [
512
513
  filterLabels
513
514
  ]);
514
- var isLight = theme === 'light';
515
- var axisTextColor = isLight ? 'rgba(0, 25, 61, 0.3255)' : 'rgba(255, 255, 255, 0.8)';
516
- var gridColor = isLight ? 'rgba(0,0,0,0.08)' : 'rgba(255,255,255,0.2)';
515
+ // 使用 useChartTheme hook 获取主题相关颜色
516
+ var _useChartTheme = useChartTheme(theme), axisTextColor = _useChartTheme.axisTextColor, gridColor = _useChartTheme.gridColor, isLight = _useChartTheme.isLight;
517
517
  // 标签宽度计算函数
518
518
  var calculateLabelWidth = function calculateLabelWidth(text) {
519
519
  var fontSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 11;
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { ChartContainerProps } from '../components';
3
+ import { StatisticConfigType } from '../hooks/useChartStatistic';
4
+ import type { ChartClassNames, ChartStyles } from '../types/classNames';
5
+ /**
6
+ * 箱线图数据项接口
7
+ *
8
+ * 传入原始数据数组,组件自动计算统计值
9
+ */
10
+ export interface BoxPlotChartDataItem {
11
+ /** X轴标签 */
12
+ label: string;
13
+ /** 原始数据值数组 */
14
+ values: number[];
15
+ /** 数据系列(用于分组显示) */
16
+ type?: string;
17
+ /** 分类(用于筛选) */
18
+ category?: string;
19
+ /** 筛选标签 */
20
+ filterLabel?: string;
21
+ }
22
+ export interface BoxPlotChartProps extends ChartContainerProps {
23
+ /** 扁平化数据数组 */
24
+ data: BoxPlotChartDataItem[];
25
+ /** 图表标题 */
26
+ title?: string;
27
+ /** 图表宽度,默认600px */
28
+ width?: number | string;
29
+ /** 图表高度,默认400px */
30
+ height?: number | string;
31
+ /** 自定义CSS类名 */
32
+ className?: string;
33
+ /** 自定义CSS类名(支持对象格式,为每层DOM设置类名) */
34
+ classNames?: ChartClassNames;
35
+ /** 数据时间 */
36
+ dataTime?: string;
37
+ /** 图表主题 */
38
+ theme?: 'dark' | 'light';
39
+ /** 自定义主色 */
40
+ color?: string | string[];
41
+ /** 是否显示图例,默认true */
42
+ showLegend?: boolean;
43
+ /** 图例位置 */
44
+ legendPosition?: 'top' | 'left' | 'bottom' | 'right';
45
+ /** 是否显示网格线,默认true */
46
+ showGrid?: boolean;
47
+ /** X轴标签 */
48
+ xAxisLabel?: string;
49
+ /** Y轴标签 */
50
+ yAxisLabel?: string;
51
+ /** 是否显示异常点 */
52
+ showOutliers?: boolean;
53
+ /** 头部工具条额外按钮 */
54
+ toolbarExtra?: React.ReactNode;
55
+ /** 是否将过滤器渲染到工具栏 */
56
+ renderFilterInToolbar?: boolean;
57
+ /** ChartStatistic组件配置 */
58
+ statistic?: StatisticConfigType;
59
+ /** 是否显示加载状态 */
60
+ loading?: boolean;
61
+ /** 自定义样式对象 */
62
+ styles?: ChartStyles;
63
+ }
64
+ declare const BoxPlotChart: React.FC<BoxPlotChartProps>;
65
+ export default BoxPlotChart;