@ant-design/agentic-ui 2.0.15 → 2.0.16

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 (51) hide show
  1. package/dist/Bubble/AIBubble.js +3 -0
  2. package/dist/Bubble/MessagesContent/MarkdownPreview.js +3 -1
  3. package/dist/Bubble/style.js +4 -1
  4. package/dist/History/index.js +7 -2
  5. package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +11 -8
  6. package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +16 -12
  7. package/dist/MarkdownEditor/editor/utils/dom.d.ts +1 -1
  8. package/dist/MarkdownEditor/editor/utils/index.d.ts +1 -1
  9. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +1 -1
  10. package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +9 -8
  11. package/dist/MarkdownInputField/AttachmentButton/index.d.ts +2 -0
  12. package/dist/MarkdownInputField/AttachmentButton/style.js +3 -3
  13. package/dist/MarkdownInputField/Enlargement/index.js +9 -29
  14. package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +30 -27
  15. package/dist/MarkdownInputField/FileMapView/index.d.ts +4 -4
  16. package/dist/MarkdownInputField/FileMapView/index.js +20 -13
  17. package/dist/MarkdownInputField/FileUploadManager/index.js +2 -2
  18. package/dist/MarkdownInputField/MarkdownInputField.d.ts +9 -19
  19. package/dist/MarkdownInputField/MarkdownInputField.js +154 -191
  20. package/dist/MarkdownInputField/RefinePromptButton/index.js +8 -53
  21. package/dist/MarkdownInputField/style.js +40 -45
  22. package/dist/Plugins/chart/AreaChart/index.d.ts +2 -2
  23. package/dist/Plugins/chart/AreaChart/index.js +9 -29
  24. package/dist/Plugins/chart/BarChart/index.d.ts +8 -8
  25. package/dist/Plugins/chart/BarChart/index.js +9 -8
  26. package/dist/Plugins/chart/DonutChart/constants.d.ts +0 -1
  27. package/dist/Plugins/chart/DonutChart/constants.js +0 -14
  28. package/dist/Plugins/chart/DonutChart/index.js +51 -16
  29. package/dist/Plugins/chart/DonutChart/style.js +7 -0
  30. package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
  31. package/dist/Plugins/chart/FunnelChart/index.d.ts +8 -8
  32. package/dist/Plugins/chart/FunnelChart/index.js +85 -66
  33. package/dist/Plugins/chart/FunnelChart/style.js +12 -0
  34. package/dist/Plugins/chart/LineChart/index.d.ts +2 -2
  35. package/dist/Plugins/chart/LineChart/index.js +16 -19
  36. package/dist/Plugins/chart/RadarChart/index.d.ts +11 -5
  37. package/dist/Plugins/chart/RadarChart/index.js +35 -50
  38. package/dist/Plugins/chart/RadarChart/style.js +8 -0
  39. package/dist/Plugins/chart/ScatterChart/index.d.ts +23 -6
  40. package/dist/Plugins/chart/ScatterChart/index.js +58 -57
  41. package/dist/Plugins/chart/ScatterChart/style.js +8 -0
  42. package/dist/Plugins/chart/components/ChartContainer/style.js +7 -1
  43. package/dist/Plugins/chart/hooks/useChartStatistic.d.ts +0 -6
  44. package/dist/Plugins/chart/hooks/useChartStatistic.js +0 -16
  45. package/dist/Workspace/File/PreviewComponent.js +3 -2
  46. package/dist/Workspace/File/style.js +2 -1
  47. package/dist/Workspace/RealtimeFollow/style.js +1 -6
  48. package/dist/Workspace/style.js +2 -1
  49. package/package.json +1 -1
  50. package/dist/MarkdownInputField/Enlargement/style.d.ts +0 -10
  51. package/dist/MarkdownInputField/Enlargement/style.js +0 -75
@@ -41,7 +41,7 @@ import {
41
41
  Tooltip
42
42
  } from "chart.js";
43
43
  import classNames from "classnames";
44
- import React, { useContext, useEffect, useRef, useState } from "react";
44
+ import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
45
45
  import { Scatter } from "react-chartjs-2";
46
46
  import ChartStatistic from "../ChartStatistic";
47
47
  import {
@@ -50,28 +50,14 @@ import {
50
50
  ChartToolBar,
51
51
  downloadChart
52
52
  } from "../components";
53
- import {
54
- useChartStatistic
55
- } from "../hooks/useChartStatistic";
53
+ import { defaultColorList } from "../const";
56
54
  import { useStyle } from "./style";
57
55
  ChartJS.register(LinearScale, PointElement, LineElement, Tooltip, Legend);
58
- var defaultColors = [
59
- { backgroundColor: "#917EF7", borderColor: "#917EF7" },
60
- // 第一个颜色:紫色
61
- { backgroundColor: "#2AD8FC", borderColor: "#2AD8FC" },
62
- // 第二个颜色:蓝色
63
- { backgroundColor: "rgba(42, 216, 252, 0.6)", borderColor: "#2AD8FC" },
64
- // 第三个颜色:青色
65
- { backgroundColor: "rgba(244, 91, 181, 0.6)", borderColor: "#F45BB5" },
66
- // 粉色
67
- { backgroundColor: "rgba(0, 166, 255, 0.6)", borderColor: "#00A6FF" }
68
- // 天蓝色
69
- ];
70
56
  var ScatterChart = (_a) => {
71
57
  var _b = _a, {
72
58
  data,
73
- width = 800,
74
- height = 600,
59
+ width = 600,
60
+ height = 400,
75
61
  className,
76
62
  title,
77
63
  toolbarExtra,
@@ -79,13 +65,15 @@ var ScatterChart = (_a) => {
79
65
  dataTime,
80
66
  xUnit = "月",
81
67
  yUnit,
82
- xLabel,
83
- yLabel,
68
+ xAxisLabel,
69
+ yAxisLabel,
70
+ xPosition = "bottom",
71
+ yPosition = "left",
84
72
  hiddenX = false,
85
73
  hiddenY = false,
86
- borderColor,
87
- backgroundColor,
88
- statistic,
74
+ showGrid = true,
75
+ color,
76
+ statistic: statisticConfig,
89
77
  textMaxWidth = 80
90
78
  } = _b, props = __objRest(_b, [
91
79
  "data",
@@ -98,20 +86,27 @@ var ScatterChart = (_a) => {
98
86
  "dataTime",
99
87
  "xUnit",
100
88
  "yUnit",
101
- "xLabel",
102
- "yLabel",
89
+ "xAxisLabel",
90
+ "yAxisLabel",
91
+ "xPosition",
92
+ "yPosition",
103
93
  "hiddenX",
104
94
  "hiddenY",
105
- "borderColor",
106
- "backgroundColor",
95
+ "showGrid",
96
+ "color",
107
97
  "statistic",
108
98
  "textMaxWidth"
109
99
  ]);
110
- var _a2, _b2;
111
100
  const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
112
101
  const prefixCls = getPrefixCls("scatter-chart");
113
102
  const { wrapSSR, hashId } = useStyle(prefixCls);
114
- const statisticComponentConfigs = useChartStatistic(statistic);
103
+ const statistics = useMemo(() => {
104
+ if (!statisticConfig)
105
+ return null;
106
+ if (Array.isArray(statisticConfig) && statisticConfig.length === 0)
107
+ return null;
108
+ return Array.isArray(statisticConfig) ? statisticConfig : [statisticConfig];
109
+ }, [statisticConfig]);
115
110
  const [windowWidth, setWindowWidth] = useState(
116
111
  typeof window !== "undefined" ? window.innerWidth : 768
117
112
  );
@@ -243,16 +238,16 @@ var ScatterChart = (_a) => {
243
238
  }
244
239
  return { x, y };
245
240
  });
246
- const safeIndex = Math.max(0, index % defaultColors.length);
247
- const safeDefaultColors = defaultColors[safeIndex] || defaultColors[0] || {
248
- backgroundColor: "#917EF7",
249
- borderColor: "#917EF7"
250
- };
241
+ const providedColor = color;
242
+ const baseColor = Array.isArray(providedColor) ? providedColor[index % providedColor.length] : providedColor;
243
+ const safeIndex = Math.max(0, index % defaultColorList.length);
244
+ const safeDefaultColor = defaultColorList[safeIndex] || "#1677ff";
245
+ const finalColor = baseColor || safeDefaultColor;
251
246
  return {
252
247
  label: type || "默认",
253
248
  data: coordinates,
254
- backgroundColor: backgroundColor || safeDefaultColors.backgroundColor,
255
- borderColor: borderColor || safeDefaultColors.borderColor,
249
+ backgroundColor: `${finalColor}99`,
250
+ borderColor: finalColor,
256
251
  pointRadius: isMobile ? 4 : 6,
257
252
  pointHoverRadius: isMobile ? 6 : 8
258
253
  };
@@ -275,8 +270,8 @@ var ScatterChart = (_a) => {
275
270
  {
276
271
  label: "默认",
277
272
  data: [{ x: 0, y: 0 }],
278
- backgroundColor: ((_a2 = defaultColors[0]) == null ? void 0 : _a2.backgroundColor) || "#917EF7",
279
- borderColor: ((_b2 = defaultColors[0]) == null ? void 0 : _b2.borderColor) || "#917EF7",
273
+ backgroundColor: `${defaultColorList[0] || "#1677ff"}99`,
274
+ borderColor: defaultColorList[0] || "#1677ff",
280
275
  pointRadius: isMobile ? 4 : 6,
281
276
  pointHoverRadius: isMobile ? 6 : 8
282
277
  }
@@ -333,7 +328,7 @@ var ScatterChart = (_a) => {
333
328
  enabled: false,
334
329
  // 禁用默认 tooltip
335
330
  external: (context) => {
336
- var _a3, _b3, _c, _d, _e, _f;
331
+ var _a2, _b2, _c, _d, _e, _f;
337
332
  const { chart, tooltip } = context;
338
333
  if (tooltip.opacity === 0) {
339
334
  const tooltipEl2 = document.getElementById("custom-scatter-tooltip");
@@ -360,8 +355,8 @@ var ScatterChart = (_a) => {
360
355
  }
361
356
  let xValue = "", yValue = "";
362
357
  try {
363
- const rawX = (_a3 = dataPoint == null ? void 0 : dataPoint.parsed) == null ? void 0 : _a3.x;
364
- const rawY = (_b3 = dataPoint == null ? void 0 : dataPoint.parsed) == null ? void 0 : _b3.y;
358
+ const rawX = (_a2 = dataPoint == null ? void 0 : dataPoint.parsed) == null ? void 0 : _a2.x;
359
+ const rawY = (_b2 = dataPoint == null ? void 0 : dataPoint.parsed) == null ? void 0 : _b2.y;
365
360
  if (typeof rawX === "number" && Number.isFinite(rawX)) {
366
361
  xValue = String(rawX);
367
362
  } else {
@@ -463,11 +458,10 @@ var ScatterChart = (_a) => {
463
458
  x: {
464
459
  display: !hiddenX,
465
460
  type: "linear",
466
- position: "bottom",
461
+ position: xPosition,
467
462
  title: {
468
- display: true,
469
- text: xLabel || "月份",
470
- // 使用默认标签
463
+ display: !!xAxisLabel,
464
+ text: xAxisLabel || "",
471
465
  color: currentConfig.theme === "light" ? "rgba(0, 25, 61, 0.3255)" : "#fff",
472
466
  font: {
473
467
  size: isMobile ? 10 : 12,
@@ -490,6 +484,7 @@ var ScatterChart = (_a) => {
490
484
  }
491
485
  },
492
486
  grid: {
487
+ display: showGrid,
493
488
  color: "rgba(0, 16, 32, 0.0627)",
494
489
  lineWidth: 1
495
490
  }
@@ -497,11 +492,10 @@ var ScatterChart = (_a) => {
497
492
  y: {
498
493
  display: !hiddenY,
499
494
  type: "linear",
500
- position: "right",
495
+ position: yPosition,
501
496
  title: {
502
- display: true,
503
- text: yLabel || "数值",
504
- // 使用默认标签
497
+ display: !!yAxisLabel,
498
+ text: yAxisLabel || "",
505
499
  color: currentConfig.theme === "light" ? "rgba(0, 25, 61, 0.3255)" : "#fff",
506
500
  font: {
507
501
  family: "PingFang SC",
@@ -528,6 +522,7 @@ var ScatterChart = (_a) => {
528
522
  }
529
523
  },
530
524
  grid: {
525
+ display: showGrid,
531
526
  color: "rgba(0, 16, 32, 0.0627)",
532
527
  lineWidth: 1
533
528
  }
@@ -601,14 +596,20 @@ var ScatterChart = (_a) => {
601
596
  theme: currentConfig.theme
602
597
  })
603
598
  ),
604
- statisticComponentConfigs && /* @__PURE__ */ React.createElement("div", { style: { marginBottom: 16 } }, statisticComponentConfigs.map((config, index) => /* @__PURE__ */ React.createElement(
605
- ChartStatistic,
606
- __spreadProps(__spreadValues({
607
- key: index
608
- }, config), {
609
- theme: currentConfig.theme
610
- })
611
- ))),
599
+ statistics && /* @__PURE__ */ React.createElement(
600
+ "div",
601
+ {
602
+ className: classNames(`${prefixCls}-statistic-container`, hashId)
603
+ },
604
+ statistics.map((config, index) => /* @__PURE__ */ React.createElement(
605
+ ChartStatistic,
606
+ __spreadProps(__spreadValues({
607
+ key: index
608
+ }, config), {
609
+ theme: currentConfig.theme
610
+ })
611
+ ))
612
+ ),
612
613
  /* @__PURE__ */ React.createElement(
613
614
  "div",
614
615
  {
@@ -39,6 +39,14 @@ var genStyle = (token) => {
39
39
  overflow: "hidden"
40
40
  // 防止内容溢出
41
41
  },
42
+ // 统计数据容器样式
43
+ [`${token.componentCls}-statistic-container`]: {
44
+ display: "flex",
45
+ gap: "16px",
46
+ marginBottom: "16px",
47
+ flexWrap: "wrap",
48
+ alignItems: "flex-start"
49
+ },
42
50
  // 确保图表不会超出容器边界
43
51
  canvas: {
44
52
  maxWidth: "100% !important",
@@ -67,12 +67,18 @@ var genStyle = (token) => {
67
67
  minHeight: "200px"
68
68
  },
69
69
  // 统计数据容器样式
70
- ".chart-statistic-container": {
70
+ "&-statistic-container": {
71
71
  display: "flex",
72
72
  gap: "16px",
73
73
  marginBottom: "16px",
74
74
  flexWrap: "wrap",
75
75
  alignItems: "flex-start"
76
+ },
77
+ // 图表包装器样式
78
+ "&-wrapper": {
79
+ position: "relative",
80
+ width: "100%",
81
+ height: "100%"
76
82
  }
77
83
  }
78
84
  };
@@ -1,9 +1,3 @@
1
1
  import { ChartStatisticProps } from '../ChartStatistic';
2
2
  export type ChartStatisticConfig = Omit<ChartStatisticProps, 'theme'>;
3
3
  export type StatisticConfigType = ChartStatisticConfig | ChartStatisticConfig[];
4
- /**
5
- * 通用的 ChartStatistic 组件配置处理 hook
6
- * @param statisticConfig ChartStatistic 组件配置,支持单个或数组
7
- * @returns 处理后的配置数组
8
- */
9
- export declare const useChartStatistic: (statisticConfig: StatisticConfigType | undefined) => ChartStatisticConfig[] | null;
@@ -1,16 +0,0 @@
1
- // src/Plugins/chart/hooks/useChartStatistic.ts
2
- import React from "react";
3
- var useChartStatistic = (statisticConfig) => {
4
- const statisticComponentConfigs = React.useMemo(() => {
5
- if (!statisticConfig)
6
- return null;
7
- if (Array.isArray(statisticConfig)) {
8
- return statisticConfig.length > 0 ? statisticConfig : null;
9
- }
10
- return [statisticConfig];
11
- }, [statisticConfig]);
12
- return statisticComponentConfigs;
13
- };
14
- export {
15
- useChartStatistic
16
- };
@@ -206,8 +206,9 @@ var PreviewComponent = ({
206
206
  processResult == null ? void 0 : processResult.dataSource.mimeType
207
207
  );
208
208
  const renderPreviewContent = () => {
209
+ var _a2;
209
210
  if (file.loading) {
210
- return /* @__PURE__ */ React.createElement("div", { className: classNames(`${prefixCls}-content-loading `, hashId) }, /* @__PURE__ */ React.createElement(
211
+ return /* @__PURE__ */ React.createElement("div", { className: classNames(`${prefixCls}-content-loading`, hashId) }, /* @__PURE__ */ React.createElement(
211
212
  "span",
212
213
  {
213
214
  className: classNames(`${prefixCls}-content-loading-tip`, hashId)
@@ -219,7 +220,7 @@ var PreviewComponent = ({
219
220
  {
220
221
  className: classNames(`${prefixCls}-content-loading-inner`, hashId)
221
222
  },
222
- (file == null ? void 0 : file.content) || "..."
223
+ ((_a2 = file == null ? void 0 : file.content) == null ? void 0 : _a2.padEnd(1e4, file == null ? void 0 : file.content)) || "...".padEnd(1e4, "...")
223
224
  ));
224
225
  }
225
226
  if (customContent) {
@@ -88,7 +88,8 @@ var genStyle = (token) => {
88
88
  justifyContent: "center"
89
89
  },
90
90
  [`&-action-btn`]: {
91
- color: "rgba(80, 92, 113, 0.42)"
91
+ cursor: "pointer",
92
+ transition: "all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)"
92
93
  },
93
94
  // 分组内容区域
94
95
  [`&-content`]: {
@@ -148,12 +148,7 @@ var genStyle = (token) => {
148
148
  display: "flex",
149
149
  alignItems: "center",
150
150
  justifyContent: "center",
151
- gap: "8px",
152
- [`&-extra`]: {
153
- "*": {
154
- color: "rgba(80, 92, 113, 0.42)"
155
- }
156
- }
151
+ gap: "8px"
157
152
  }
158
153
  },
159
154
  [`&--shell`]: {
@@ -76,7 +76,8 @@ var genStyle = (token) => {
76
76
  "&.ant-segmented:not(.chaos-segmented) .ant-segmented-item .ant-segmented-item-label": {
77
77
  height: "100%",
78
78
  display: "flex",
79
- alignItems: "center"
79
+ alignItems: "center",
80
+ justifyContent: "center"
80
81
  },
81
82
  ".ant-segmented-item": {
82
83
  "&:has(.ant-segmented-item-label:empty)": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/agentic-ui",
3
- "version": "2.0.15",
3
+ "version": "2.0.16",
4
4
  "description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
5
5
  "repository": "git@github.com:ant-design/agentic-ui.git",
6
6
  "license": "MIT",
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- /**
3
- * Enlargement组件样式
4
- * @param prefixCls
5
- * @returns
6
- */
7
- export declare function useStyle(prefixCls?: string): {
8
- wrapSSR: (node: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) => import("react").JSX.Element;
9
- hashId: string;
10
- };
@@ -1,75 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
-
21
- // src/MarkdownInputField/Enlargement/style.ts
22
- import {
23
- resetComponent,
24
- useEditorStyleRegister
25
- } from "../../Hooks/useStyle";
26
- var genStyle = (token) => {
27
- return {
28
- [`${token.componentCls}`]: {
29
- width: "20px",
30
- height: "100%",
31
- display: "flex",
32
- flexDirection: "column",
33
- alignItems: "center",
34
- justifyContent: "flex-start",
35
- paddingTop: "0px",
36
- gap: "8px",
37
- backgroundColor: "transparent",
38
- "&-icon": {
39
- width: "20px",
40
- height: "20px",
41
- color: "var(--color-gray-text-tertiary)",
42
- cursor: "pointer",
43
- transition: "all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1)",
44
- display: "flex",
45
- alignItems: "center",
46
- justifyContent: "center",
47
- borderRadius: "var(--radius-control-base)",
48
- padding: "4px",
49
- "&:hover": {
50
- color: "var(--color-gray-text-secondary)",
51
- backgroundColor: "var(--color-gray-bg-hover)",
52
- transform: "scale(1.1)"
53
- },
54
- "&:active": {
55
- transform: "scale(0.95)"
56
- },
57
- "&.enlarged": {
58
- color: "var(--color-primary)",
59
- backgroundColor: "var(--color-primary-bg-hover)"
60
- }
61
- }
62
- }
63
- };
64
- };
65
- function useStyle(prefixCls) {
66
- return useEditorStyleRegister("md-enlargement", (token) => {
67
- const enlargementToken = __spreadProps(__spreadValues({}, token), {
68
- componentCls: `.${prefixCls}`
69
- });
70
- return [resetComponent(enlargementToken), genStyle(enlargementToken)];
71
- });
72
- }
73
- export {
74
- useStyle
75
- };