@ant-design/agentic-ui 2.30.33 → 2.31.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.
Files changed (55) hide show
  1. package/dist/Components/Loading/style.js +16 -5
  2. package/dist/Components/Robot/lotties/BlowingWindLottie/index.js +16 -3
  3. package/dist/Components/Robot/lotties/BouncingLottie/index.js +16 -3
  4. package/dist/Components/Robot/lotties/DazingLottie/index.js +16 -3
  5. package/dist/Components/Robot/lotties/PeekLottie/index.js +16 -3
  6. package/dist/Components/Robot/lotties/ThinkingLottie/index.js +16 -3
  7. package/dist/Components/lotties/CreativeSparkLottie/index.js +16 -3
  8. package/dist/Components/lotties/DazingLottie/index.js +16 -3
  9. package/dist/Components/lotties/LoadingLottie/index.js +16 -3
  10. package/dist/Components/lotties/ThinkingLottie/index.js +16 -3
  11. package/dist/Components/lotties/ThreeThinkingLottie/index.js +7 -55
  12. package/dist/Components/lotties/bubble-actions/Copy/index.js +12 -3
  13. package/dist/Components/lotties/bubble-actions/Dislike/index.js +12 -3
  14. package/dist/Components/lotties/bubble-actions/Like/index.js +12 -3
  15. package/dist/Components/lotties/bubble-actions/More/index.js +12 -3
  16. package/dist/Components/lotties/bubble-actions/Play/index.js +12 -3
  17. package/dist/Components/lotties/bubble-actions/Quote/index.js +12 -3
  18. package/dist/Components/lotties/bubble-actions/Refresh/index.js +12 -3
  19. package/dist/Components/lotties/bubble-actions/Share/index.js +12 -3
  20. package/dist/Components/lotties/index.d.ts +1 -0
  21. package/dist/Components/lotties/index.js +1 -0
  22. package/dist/Components/lotties/useAsyncLottieData.d.ts +9 -0
  23. package/dist/Components/lotties/useAsyncLottieData.js +83 -0
  24. package/dist/Hooks/useLanguage.d.ts +1 -0
  25. package/dist/I18n/locales.d.ts +1 -0
  26. package/dist/I18n/locales.js +2 -0
  27. package/dist/Icons/animated/VoicePlayLottie/index.js +16 -3
  28. package/dist/Icons/animated/VoicingLottie/index.js +16 -3
  29. package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +10 -10
  30. package/dist/MarkdownEditor/style.js +7 -1
  31. package/dist/MarkdownInputField/BorderBeamAnimation.d.ts +1 -1
  32. package/dist/MarkdownInputField/BorderBeamAnimation.js +6 -3
  33. package/dist/Plugins/chart/AreaChart/index.js +10 -8
  34. package/dist/Plugins/chart/BarChart/index.js +10 -8
  35. package/dist/Plugins/chart/BoxPlotChart/index.d.ts +1 -1
  36. package/dist/Plugins/chart/BoxPlotChart/index.js +11 -8
  37. package/dist/Plugins/chart/DonutChart/index.js +14 -12
  38. package/dist/Plugins/chart/FunnelChart/index.js +10 -8
  39. package/dist/Plugins/chart/HistogramChart/index.d.ts +1 -1
  40. package/dist/Plugins/chart/HistogramChart/index.js +11 -8
  41. package/dist/Plugins/chart/LineChart/index.js +10 -8
  42. package/dist/Plugins/chart/RadarChart/index.js +14 -12
  43. package/dist/Plugins/chart/ScatterChart/index.js +14 -12
  44. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +4 -2
  45. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +2 -0
  46. package/dist/Plugins/chart/components/ChartToolBar/style.js +2 -2
  47. package/dist/Plugins/chart/hooks/useChartTheme.d.ts +1 -1
  48. package/dist/Plugins/chart/hooks/useChartTheme.js +1 -1
  49. package/dist/Plugins/chart/hooks/useDetectTheme.d.ts +7 -8
  50. package/dist/Plugins/chart/hooks/useDetectTheme.js +81 -54
  51. package/dist/ThoughtChainList/style.js +14 -3
  52. package/dist/Workspace/File/FileComponent.js +15 -9
  53. package/dist/Workspace/File/FileTree/FileTreeComponent.js +6 -1
  54. package/dist/Workspace/File/PreviewComponent.js +23 -6
  55. package/package.json +4 -4
@@ -50,9 +50,9 @@ function _object_spread_props(target, source) {
50
50
  }
51
51
  return target;
52
52
  }
53
- import React from "react";
53
+ import React, { useMemo } from "react";
54
54
  import AbstractLottie from "../Abstract";
55
- import playAnimation from "./lottie.json";
55
+ import { useAsyncLottieData } from "../../useAsyncLottieData";
56
56
  /**
57
57
  * 播放操作动画组件
58
58
  *
@@ -92,8 +92,17 @@ import playAnimation from "./lottie.json";
92
92
  * @param props.size - 动画尺寸(宽度和高度),默认为 '1em'
93
93
  * @returns 渲染的播放操作动画组件
94
94
  */ export var PlayLottie = function PlayLottie(props) {
95
+ var loadJson = useMemo(function() {
96
+ return function() {
97
+ return import("./lottie.json");
98
+ };
99
+ }, []);
100
+ var animationData = useAsyncLottieData(loadJson);
101
+ if (animationData === null) {
102
+ return null;
103
+ }
95
104
  return /*#__PURE__*/ React.createElement(AbstractLottie, _object_spread_props(_object_spread({}, props), {
96
- animationData: playAnimation
105
+ animationData: animationData
97
106
  }));
98
107
  };
99
108
  export default PlayLottie;
@@ -50,9 +50,9 @@ function _object_spread_props(target, source) {
50
50
  }
51
51
  return target;
52
52
  }
53
- import React from "react";
53
+ import React, { useMemo } from "react";
54
54
  import AbstractLottie from "../Abstract";
55
- import quoteAnimation from "./lottie.json";
55
+ import { useAsyncLottieData } from "../../useAsyncLottieData";
56
56
  /**
57
57
  * 引用操作动画组件
58
58
  *
@@ -92,8 +92,17 @@ import quoteAnimation from "./lottie.json";
92
92
  * @param props.size - 动画尺寸(宽度和高度),默认为 '1em'
93
93
  * @returns 渲染的引用操作动画组件
94
94
  */ export var QuoteLottie = function QuoteLottie(props) {
95
+ var loadJson = useMemo(function() {
96
+ return function() {
97
+ return import("./lottie.json");
98
+ };
99
+ }, []);
100
+ var animationData = useAsyncLottieData(loadJson);
101
+ if (animationData === null) {
102
+ return null;
103
+ }
95
104
  return /*#__PURE__*/ React.createElement(AbstractLottie, _object_spread_props(_object_spread({}, props), {
96
- animationData: quoteAnimation
105
+ animationData: animationData
97
106
  }));
98
107
  };
99
108
  export default QuoteLottie;
@@ -50,9 +50,9 @@ function _object_spread_props(target, source) {
50
50
  }
51
51
  return target;
52
52
  }
53
- import React from "react";
53
+ import React, { useMemo } from "react";
54
54
  import AbstractLottie from "../Abstract";
55
- import refreshAnimation from "./lottie.json";
55
+ import { useAsyncLottieData } from "../../useAsyncLottieData";
56
56
  /**
57
57
  * 刷新操作动画组件
58
58
  *
@@ -92,8 +92,17 @@ import refreshAnimation from "./lottie.json";
92
92
  * @param props.size - 动画尺寸(宽度和高度),默认为 '1em'
93
93
  * @returns 渲染的刷新操作动画组件
94
94
  */ export var RefreshLottie = function RefreshLottie(props) {
95
+ var loadJson = useMemo(function() {
96
+ return function() {
97
+ return import("./lottie.json");
98
+ };
99
+ }, []);
100
+ var animationData = useAsyncLottieData(loadJson);
101
+ if (animationData === null) {
102
+ return null;
103
+ }
95
104
  return /*#__PURE__*/ React.createElement(AbstractLottie, _object_spread_props(_object_spread({}, props), {
96
- animationData: refreshAnimation
105
+ animationData: animationData
97
106
  }));
98
107
  };
99
108
  export default RefreshLottie;
@@ -50,9 +50,9 @@ function _object_spread_props(target, source) {
50
50
  }
51
51
  return target;
52
52
  }
53
- import React from "react";
53
+ import React, { useMemo } from "react";
54
54
  import AbstractLottie from "../Abstract";
55
- import shareAnimation from "./lottie.json";
55
+ import { useAsyncLottieData } from "../../useAsyncLottieData";
56
56
  /**
57
57
  * 分享操作动画组件
58
58
  *
@@ -92,8 +92,17 @@ import shareAnimation from "./lottie.json";
92
92
  * @param props.size - 动画尺寸(宽度和高度),默认为 '1em'
93
93
  * @returns 渲染的分享操作动画组件
94
94
  */ export var ShareLottie = function ShareLottie(props) {
95
+ var loadJson = useMemo(function() {
96
+ return function() {
97
+ return import("./lottie.json");
98
+ };
99
+ }, []);
100
+ var animationData = useAsyncLottieData(loadJson);
101
+ if (animationData === null) {
102
+ return null;
103
+ }
95
104
  return /*#__PURE__*/ React.createElement(AbstractLottie, _object_spread_props(_object_spread({}, props), {
96
- animationData: shareAnimation
105
+ animationData: animationData
97
106
  }));
98
107
  };
99
108
  export default ShareLottie;
@@ -1,4 +1,5 @@
1
1
  export * from './bubble-actions';
2
+ export * from './useAsyncLottieData';
2
3
  export * from './CreativeSparkLottie';
3
4
  export * from './DazingLottie';
4
5
  export * from './LoadingLottie';
@@ -1,4 +1,5 @@
1
1
  export * from "./bubble-actions";
2
+ export * from "./useAsyncLottieData";
2
3
  export * from "./CreativeSparkLottie";
3
4
  export * from "./DazingLottie";
4
5
  export * from "./LoadingLottie";
@@ -0,0 +1,9 @@
1
+ type LottieJsonModule = {
2
+ default?: unknown;
3
+ } | unknown;
4
+ /**
5
+ * 通过动态 import 异步加载 Lottie JSON,避免与主包同步打包。
6
+ * @param load 稳定引用,例如 `useMemo(() => () => import('./x.json'), [])`
7
+ */
8
+ export declare const useAsyncLottieData: (load: () => Promise<LottieJsonModule>) => unknown | null;
9
+ export {};
@@ -0,0 +1,83 @@
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 _type_of(obj) {
40
+ "@swc/helpers - typeof";
41
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
42
+ }
43
+ function _unsupported_iterable_to_array(o, minLen) {
44
+ if (!o) return;
45
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
46
+ var n = Object.prototype.toString.call(o).slice(8, -1);
47
+ if (n === "Object" && o.constructor) n = o.constructor.name;
48
+ if (n === "Map" || n === "Set") return Array.from(n);
49
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
50
+ }
51
+ import { useEffect, useState } from "react";
52
+ var getDefaultExport = function getDefaultExport(mod) {
53
+ if (mod && (typeof mod === "undefined" ? "undefined" : _type_of(mod)) === 'object' && 'default' in mod && mod.default !== undefined) {
54
+ return mod.default;
55
+ }
56
+ return mod;
57
+ };
58
+ /**
59
+ * 通过动态 import 异步加载 Lottie JSON,避免与主包同步打包。
60
+ * @param load 稳定引用,例如 `useMemo(() => () => import('./x.json'), [])`
61
+ */ export var useAsyncLottieData = function useAsyncLottieData(load) {
62
+ var _useState = _sliced_to_array(useState(null), 2), data = _useState[0], setData = _useState[1];
63
+ useEffect(function() {
64
+ var cancelled = false;
65
+ void load().then(function(mod) {
66
+ if (cancelled) {
67
+ return;
68
+ }
69
+ setData(getDefaultExport(mod));
70
+ }).catch(function(error) {
71
+ if (!cancelled) {
72
+ // eslint-disable-next-line no-console
73
+ console.error('Failed to load Lottie JSON:', error);
74
+ }
75
+ });
76
+ return function() {
77
+ cancelled = true;
78
+ };
79
+ }, [
80
+ load
81
+ ]);
82
+ return data;
83
+ };
@@ -461,6 +461,7 @@ export declare function useLanguage(): {
461
461
  'fileType.config': string;
462
462
  'fileType.powerpoint': string;
463
463
  'workspace.file.unsupportedPreview': string;
464
+ 'workspace.file.unsupportedPreviewNoDownload': string;
464
465
  'workspace.file.downloadButton': string;
465
466
  'workspace.file.videoNotSupported': string;
466
467
  'workspace.file.audioNotSupported': string;
@@ -423,6 +423,7 @@ export declare const cnLabels: {
423
423
  'fileType.config': string;
424
424
  'fileType.powerpoint': string;
425
425
  'workspace.file.unsupportedPreview': string;
426
+ 'workspace.file.unsupportedPreviewNoDownload': string;
426
427
  'workspace.file.downloadButton': string;
427
428
  'workspace.file.videoNotSupported': string;
428
429
  'workspace.file.audioNotSupported': string;
@@ -454,6 +454,7 @@
454
454
  'fileType.powerpoint': 'PowerPoint 演示文稿',
455
455
  // PreviewComponent messages
456
456
  'workspace.file.unsupportedPreview': '此文件无法预览,请下载查看。',
457
+ 'workspace.file.unsupportedPreviewNoDownload': '此文件无法预览。',
457
458
  'workspace.file.downloadButton': '下载',
458
459
  'workspace.file.videoNotSupported': '您的浏览器不支持视频播放',
459
460
  'workspace.file.audioNotSupported': '您的浏览器不支持音频播放',
@@ -915,6 +916,7 @@
915
916
  'fileType.powerpoint': 'PowerPoint presentation',
916
917
  // PreviewComponent messages
917
918
  'workspace.file.unsupportedPreview': 'This file cannot be previewed, please download to view.',
919
+ 'workspace.file.unsupportedPreviewNoDownload': 'This file cannot be previewed.',
918
920
  'workspace.file.downloadButton': 'Download',
919
921
  'workspace.file.videoNotSupported': 'Your browser does not support video playback',
920
922
  'workspace.file.audioNotSupported': 'Your browser does not support audio playback',
@@ -27,8 +27,8 @@ function _object_spread(target) {
27
27
  return target;
28
28
  }
29
29
  import Lottie from "lottie-react";
30
- import React from "react";
31
- import voicePlay from "./voicePlay.json";
30
+ import React, { useMemo } from "react";
31
+ import { useAsyncLottieData } from "../../../Components/lotties/useAsyncLottieData";
32
32
  /**
33
33
  * VoicePlay 组件 - Lottie语音播放动画组件
34
34
  *
@@ -62,6 +62,12 @@ import voicePlay from "./voicePlay.json";
62
62
  * - 提供默认的语音播放动画
63
63
  */ export var VoicePlayLottie = function VoicePlayLottie(param) {
64
64
  var _param_autoplay = param.autoplay, autoplay = _param_autoplay === void 0 ? true : _param_autoplay, _param_loop = param.loop, loop = _param_loop === void 0 ? true : _param_loop, className = param.className, style = param.style, size = param.size;
65
+ var loadJson = useMemo(function() {
66
+ return function() {
67
+ return import("./voicePlay.json");
68
+ };
69
+ }, []);
70
+ var animationData = useAsyncLottieData(loadJson);
65
71
  var containerStyle = _object_spread({
66
72
  width: size,
67
73
  height: size,
@@ -69,10 +75,17 @@ import voicePlay from "./voicePlay.json";
69
75
  justifyContent: 'center',
70
76
  alignItems: 'center'
71
77
  }, style);
78
+ if (animationData === null) {
79
+ return /*#__PURE__*/ React.createElement("div", {
80
+ style: containerStyle,
81
+ className: className,
82
+ "aria-hidden": true
83
+ });
84
+ }
72
85
  return /*#__PURE__*/ React.createElement(Lottie, {
73
86
  style: containerStyle,
74
87
  className: className,
75
- animationData: voicePlay,
88
+ animationData: animationData,
76
89
  loop: loop,
77
90
  autoplay: autoplay
78
91
  });
@@ -27,8 +27,8 @@ function _object_spread(target) {
27
27
  return target;
28
28
  }
29
29
  import Lottie from "lottie-react";
30
- import React from "react";
31
- import voicingLottie from "./voicing.json";
30
+ import React, { useMemo } from "react";
31
+ import { useAsyncLottieData } from "../../../Components/lotties/useAsyncLottieData";
32
32
  /**
33
33
  * VoicingLottie 组件 - Lottie语音播报动画组件
34
34
  *
@@ -64,6 +64,12 @@ import voicingLottie from "./voicing.json";
64
64
  * - 提供默认的加载动画
65
65
  */ export var VoicingLottie = function VoicingLottie(param) {
66
66
  var _param_autoplay = param.autoplay, autoplay = _param_autoplay === void 0 ? true : _param_autoplay, _param_loop = param.loop, loop = _param_loop === void 0 ? true : _param_loop, className = param.className, style = param.style, size = param.size;
67
+ var loadJson = useMemo(function() {
68
+ return function() {
69
+ return import("./voicing.json");
70
+ };
71
+ }, []);
72
+ var animationData = useAsyncLottieData(loadJson);
67
73
  var containerStyle = _object_spread({
68
74
  width: size,
69
75
  height: size,
@@ -71,11 +77,18 @@ import voicingLottie from "./voicing.json";
71
77
  justifyContent: 'center',
72
78
  alignItems: 'center'
73
79
  }, style);
80
+ if (animationData === null) {
81
+ return /*#__PURE__*/ React.createElement("div", {
82
+ style: containerStyle,
83
+ className: className,
84
+ "aria-hidden": true
85
+ });
86
+ }
74
87
  return /*#__PURE__*/ React.createElement(Lottie, {
75
88
  style: containerStyle,
76
89
  className: className,
77
90
  "aria-hidden": "true",
78
- animationData: voicingLottie,
91
+ animationData: animationData,
79
92
  loop: loop,
80
93
  autoplay: autoplay
81
94
  });
@@ -119,17 +119,17 @@ export var Paragraph = function Paragraph(props) {
119
119
  useEffect(function() {
120
120
  var container = markdownContainerRef.current;
121
121
  if (!container) return;
122
- var observer = new MutationObserver(function() {
123
- setIsComposing(container.hasAttribute('data-composition'));
124
- });
125
- observer.observe(container, {
126
- attributes: true,
127
- attributeFilter: [
128
- 'data-composition'
129
- ]
130
- });
122
+ var onStart = function onStart() {
123
+ return setIsComposing(true);
124
+ };
125
+ var onEnd = function onEnd() {
126
+ return setIsComposing(false);
127
+ };
128
+ container.addEventListener('compositionstart', onStart);
129
+ container.addEventListener('compositionend', onEnd);
131
130
  return function() {
132
- return observer.disconnect();
131
+ container.removeEventListener('compositionstart', onStart);
132
+ container.removeEventListener('compositionend', onEnd);
133
133
  };
134
134
  }, [
135
135
  markdownContainerRef
@@ -108,8 +108,14 @@ var genTableStyle = function genTableStyle(token, mobileBreakpoint, mobilePaddin
108
108
  boxShadow: 'var(--shadow-control-base)',
109
109
  border: 'none',
110
110
  transform: 'translateX(50%)',
111
- transition: 'all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)'
111
+ transition: 'all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)',
112
+ color: 'var(--color-gray-text-default)'
112
113
  },
114
+ // Dark theme for table actions
115
+ '&-dark': _define_property({}, "".concat(tableCls, "-readonly-table-actions"), {
116
+ backgroundColor: 'var(--color-gray-bg-page-dark, #1f1f1f)',
117
+ color: 'rgba(255, 255, 255, 0.85)'
118
+ }),
113
119
  table: (_obj = {
114
120
  borderCollapse: 'separate',
115
121
  borderSpacing: 0,
@@ -6,7 +6,7 @@ export interface BorderBeamAnimationProps {
6
6
  borderRadius: number;
7
7
  /** 动画完成回调 */
8
8
  onAnimationComplete?: () => void;
9
- /** 渐变 ID,用于避免多个实例冲突 */
9
+ /** 渐变 ID,用于避免多个实例冲突(已废弃,组件内部自动生成唯一 ID) */
10
10
  gradientId?: string;
11
11
  /** 水平偏移量 */
12
12
  offsetX?: number;
@@ -80,12 +80,15 @@ import React, { useEffect, useRef, useState } from "react";
80
80
  * - 路径计算在组件内部完成
81
81
  * - 使用 ResizeObserver 自动获取容器尺寸
82
82
  */ export var BorderBeamAnimation = function BorderBeamAnimation(param) {
83
- var isVisible = param.isVisible, borderRadius = param.borderRadius, onAnimationComplete = param.onAnimationComplete, _param_gradientId = param.gradientId, gradientId = _param_gradientId === void 0 ? 'beam-gradient' : _param_gradientId, _param_offsetX = param.offsetX, offsetX = _param_offsetX === void 0 ? 1 : _param_offsetX, _param_offsetY = param.offsetY, offsetY = _param_offsetY === void 0 ? 0 : _param_offsetY;
83
+ var isVisible = param.isVisible, borderRadius = param.borderRadius, onAnimationComplete = param.onAnimationComplete, gradientIdProp = param.gradientId, _param_offsetX = param.offsetX, offsetX = _param_offsetX === void 0 ? 1 : _param_offsetX, _param_offsetY = param.offsetY, offsetY = _param_offsetY === void 0 ? 1 : _param_offsetY;
84
84
  var containerRef = useRef(null);
85
85
  var _useState = _sliced_to_array(useState({
86
86
  width: 0,
87
87
  height: 0
88
88
  }), 2), dimensions = _useState[0], setDimensions = _useState[1];
89
+ // 使用 React.useId 生成唯一渐变 ID,避免多实例冲突
90
+ var generatedId = React.useId();
91
+ var gradientId = gradientIdProp !== null && gradientIdProp !== void 0 ? gradientIdProp : "beam-gradient-".concat(generatedId);
89
92
  // 使用 ResizeObserver 监听容器尺寸变化
90
93
  useEffect(function() {
91
94
  var _containerRef_current, _containerRef_current1;
@@ -126,8 +129,8 @@ import React, { useEffect, useRef, useState } from "react";
126
129
  };
127
130
  }, []);
128
131
  var width = dimensions.width, height = dimensions.height;
129
- // Calculate SVG path based on dimensions
130
- var radius = 16;
132
+ // 使用 props 传入的 borderRadius,而非硬编码
133
+ var radius = borderRadius;
131
134
  var w = width;
132
135
  var h = height;
133
136
  // Outer path dimensions
@@ -81,7 +81,7 @@ import React, { useContext, useLayoutEffect, useMemo, useRef } from "react";
81
81
  import { Line } from "react-chartjs-2";
82
82
  import { ChartContainer, ChartFilter, ChartStatistic, ChartToolBar, downloadChart } from "../components";
83
83
  import { defaultColorList } from "../const";
84
- import { useChartDataFilter, useChartStatistics, useChartTheme, useResponsiveSize } from "../hooks";
84
+ import { useChartDataFilter, useChartStatistics, useChartTheme, useDetectTheme, useResponsiveSize } from "../hooks";
85
85
  import { extractAndSortXValues, findDataPointByXValue, hexToRgba, registerLineChartComponents, resolveCssVariable } from "../utils";
86
86
  import { useStyle } from "./style";
87
87
  /**
@@ -111,7 +111,7 @@ import { useStyle } from "./style";
111
111
  *
112
112
  * @since 1.0.0
113
113
  */ var AreaChart = function AreaChart(param) {
114
- var title = param.title, data = param.data, _param_width = param.width, width = _param_width === void 0 ? 600 : _param_width, _param_height = param.height, height = _param_height === void 0 ? 400 : _param_height, className = param.className, classNamesProp = param.classNames, style = param.style, stylesProp = param.styles, dataTime = param.dataTime, _param_theme = param.theme, theme = _param_theme === void 0 ? 'light' : _param_theme, color = param.color, _param_showLegend = param.showLegend, showLegend = _param_showLegend === void 0 ? true : _param_showLegend, _param_legendPosition = param.legendPosition, legendPosition = _param_legendPosition === void 0 ? 'bottom' : _param_legendPosition, _param_legendAlign = param.legendAlign, legendAlign = _param_legendAlign === void 0 ? 'start' : _param_legendAlign, _param_showGrid = param.showGrid, showGrid = _param_showGrid === void 0 ? true : _param_showGrid, _param_xPosition = param.xPosition, xPosition = _param_xPosition === void 0 ? 'bottom' : _param_xPosition, _param_yPosition = param.yPosition, yPosition = _param_yPosition === void 0 ? 'left' : _param_yPosition, _param_hiddenX = param.hiddenX, hiddenX = _param_hiddenX === void 0 ? false : _param_hiddenX, _param_hiddenY = param.hiddenY, hiddenY = _param_hiddenY === void 0 ? false : _param_hiddenY, toolbarExtra = param.toolbarExtra, _param_renderFilterInToolbar = param.renderFilterInToolbar, renderFilterInToolbar = _param_renderFilterInToolbar === void 0 ? false : _param_renderFilterInToolbar, statisticConfig = param.statistic, variant = param.variant, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading;
114
+ var title = param.title, data = param.data, _param_width = param.width, width = _param_width === void 0 ? 600 : _param_width, _param_height = param.height, height = _param_height === void 0 ? 400 : _param_height, className = param.className, classNamesProp = param.classNames, style = param.style, stylesProp = param.styles, dataTime = param.dataTime, theme = param.theme, color = param.color, _param_showLegend = param.showLegend, showLegend = _param_showLegend === void 0 ? true : _param_showLegend, _param_legendPosition = param.legendPosition, legendPosition = _param_legendPosition === void 0 ? 'bottom' : _param_legendPosition, _param_legendAlign = param.legendAlign, legendAlign = _param_legendAlign === void 0 ? 'start' : _param_legendAlign, _param_showGrid = param.showGrid, showGrid = _param_showGrid === void 0 ? true : _param_showGrid, _param_xPosition = param.xPosition, xPosition = _param_xPosition === void 0 ? 'bottom' : _param_xPosition, _param_yPosition = param.yPosition, yPosition = _param_yPosition === void 0 ? 'left' : _param_yPosition, _param_hiddenX = param.hiddenX, hiddenX = _param_hiddenX === void 0 ? false : _param_hiddenX, _param_hiddenY = param.hiddenY, hiddenY = _param_hiddenY === void 0 ? false : _param_hiddenY, toolbarExtra = param.toolbarExtra, _param_renderFilterInToolbar = param.renderFilterInToolbar, renderFilterInToolbar = _param_renderFilterInToolbar === void 0 ? false : _param_renderFilterInToolbar, statisticConfig = param.statistic, variant = param.variant, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading;
115
115
  useLayoutEffect(function() {
116
116
  registerLineChartComponents();
117
117
  }, []);
@@ -128,7 +128,9 @@ import { useStyle } from "./style";
128
128
  // 数据筛选
129
129
  var _useChartDataFilter = useChartDataFilter(data), filteredData = _useChartDataFilter.filteredData, filterOptions = _useChartDataFilter.filterOptions, filterLabels = _useChartDataFilter.filterLabels, selectedFilter = _useChartDataFilter.selectedFilter, setSelectedFilter = _useChartDataFilter.setSelectedFilter, selectedFilterLabel = _useChartDataFilter.selectedFilterLabel, setSelectedFilterLabel = _useChartDataFilter.setSelectedFilterLabel, filteredDataByFilterLabel = _useChartDataFilter.filteredDataByFilterLabel;
130
130
  // 主题颜色
131
- var _useChartTheme = useChartTheme(theme), axisTextColor = _useChartTheme.axisTextColor, gridColor = _useChartTheme.gridColor, isLight = _useChartTheme.isLight;
131
+ var detectedTheme = useDetectTheme();
132
+ var resolvedTheme = theme !== null && theme !== void 0 ? theme : detectedTheme;
133
+ var _useChartTheme = useChartTheme(resolvedTheme), axisTextColor = _useChartTheme.axisTextColor, gridColor = _useChartTheme.gridColor, isLight = _useChartTheme.isLight;
132
134
  // 从数据中提取唯一的类型
133
135
  var types = useMemo(function() {
134
136
  return _to_consumable_array(new Set(filteredData.map(function(item) {
@@ -344,13 +346,13 @@ import { useStyle } from "./style";
344
346
  return wrapSSR(/*#__PURE__*/ React.createElement(ChartContainer, {
345
347
  baseClassName: baseClassName,
346
348
  className: rootClassName,
347
- theme: theme,
349
+ theme: resolvedTheme,
348
350
  isMobile: isMobile,
349
351
  variant: variant,
350
352
  style: rootStyle
351
353
  }, /*#__PURE__*/ React.createElement(ChartToolBar, {
352
354
  title: title,
353
- theme: theme,
355
+ theme: resolvedTheme,
354
356
  onDownload: handleDownload,
355
357
  className: toolbarClassName,
356
358
  style: toolbarStyle,
@@ -366,7 +368,7 @@ import { useStyle } from "./style";
366
368
  selectedCustomSelection: selectedFilterLabel,
367
369
  onSelectionChange: setSelectedFilterLabel
368
370
  }), {
369
- theme: theme,
371
+ theme: resolvedTheme,
370
372
  variant: "compact"
371
373
  })) : undefined
372
374
  }), statistics && /*#__PURE__*/ React.createElement("div", {
@@ -375,7 +377,7 @@ import { useStyle } from "./style";
375
377
  return /*#__PURE__*/ React.createElement(ChartStatistic, _object_spread_props(_object_spread({
376
378
  key: index
377
379
  }, config), {
378
- theme: theme
380
+ theme: resolvedTheme
379
381
  }));
380
382
  })), !renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /*#__PURE__*/ React.createElement(ChartFilter, _object_spread_props(_object_spread({
381
383
  filterOptions: filterOptions,
@@ -386,7 +388,7 @@ import { useStyle } from "./style";
386
388
  selectedCustomSelection: selectedFilterLabel,
387
389
  onSelectionChange: setSelectedFilterLabel
388
390
  }), {
389
- theme: theme
391
+ theme: resolvedTheme
390
392
  })), /*#__PURE__*/ React.createElement("div", {
391
393
  className: "".concat(baseClassName, "-wrapper"),
392
394
  style: {
@@ -120,7 +120,7 @@ import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
120
120
  import { Bar } from "react-chartjs-2";
121
121
  import { ChartContainer, ChartFilter, ChartStatistic, ChartToolBar, downloadChart } from "../components";
122
122
  import { defaultColorList } from "../const";
123
- import { useChartTheme } from "../hooks";
123
+ import { useChartTheme, useDetectTheme } from "../hooks";
124
124
  import { extractAndSortXValues, findDataPointByXValue, hexToRgba, resolveCssVariable, toNumber } from "../utils";
125
125
  import { useStyle } from "./style";
126
126
  /**
@@ -137,7 +137,7 @@ import { useStyle } from "./style";
137
137
  var POSITIVE_COLOR_HEX = '#388BFF'; // rgba(56, 139, 255, 1)
138
138
  var NEGATIVE_COLOR_HEX = '#F78826'; // rgba(247, 136, 38, 1)
139
139
  var BarChart = function BarChart(param) {
140
- var title = param.title, data = param.data, _param_width = param.width, width = _param_width === void 0 ? 600 : _param_width, _param_height = param.height, height = _param_height === void 0 ? 400 : _param_height, className = param.className, classNames = param.classNames, style = param.style, styles = param.styles, dataTime = param.dataTime, _param_theme = param.theme, theme = _param_theme === void 0 ? 'light' : _param_theme, color = param.color, _param_showLegend = param.showLegend, showLegend = _param_showLegend === void 0 ? true : _param_showLegend, _param_legendPosition = param.legendPosition, legendPosition = _param_legendPosition === void 0 ? 'bottom' : _param_legendPosition, _param_legendAlign = param.legendAlign, legendAlign = _param_legendAlign === void 0 ? 'start' : _param_legendAlign, _param_showGrid = param.showGrid, showGrid = _param_showGrid === void 0 ? true : _param_showGrid, _param_xPosition = param.xPosition, xPosition = _param_xPosition === void 0 ? 'bottom' : _param_xPosition, _param_yPosition = param.yPosition, yPosition = _param_yPosition === void 0 ? 'left' : _param_yPosition, _param_hiddenX = param.hiddenX, hiddenX = _param_hiddenX === void 0 ? false : _param_hiddenX, _param_hiddenY = param.hiddenY, hiddenY = _param_hiddenY === void 0 ? false : _param_hiddenY, _param_stacked = param.stacked, stacked = _param_stacked === void 0 ? false : _param_stacked, _param_indexAxis = param.indexAxis, indexAxis = _param_indexAxis === void 0 ? 'x' : _param_indexAxis, maxBarThickness = param.maxBarThickness, toolbarExtra = param.toolbarExtra, _param_renderFilterInToolbar = param.renderFilterInToolbar, renderFilterInToolbar = _param_renderFilterInToolbar === void 0 ? false : _param_renderFilterInToolbar, statisticConfig = param.statistic, variant = param.variant, _param_showDataLabels = param.showDataLabels, showDataLabels = _param_showDataLabels === void 0 ? false : _param_showDataLabels, dataLabelFormatter = param.dataLabelFormatter, chartOptions = param.chartOptions, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading;
140
+ var title = param.title, data = param.data, _param_width = param.width, width = _param_width === void 0 ? 600 : _param_width, _param_height = param.height, height = _param_height === void 0 ? 400 : _param_height, className = param.className, classNames = param.classNames, style = param.style, styles = param.styles, dataTime = param.dataTime, theme = param.theme, color = param.color, _param_showLegend = param.showLegend, showLegend = _param_showLegend === void 0 ? true : _param_showLegend, _param_legendPosition = param.legendPosition, legendPosition = _param_legendPosition === void 0 ? 'bottom' : _param_legendPosition, _param_legendAlign = param.legendAlign, legendAlign = _param_legendAlign === void 0 ? 'start' : _param_legendAlign, _param_showGrid = param.showGrid, showGrid = _param_showGrid === void 0 ? true : _param_showGrid, _param_xPosition = param.xPosition, xPosition = _param_xPosition === void 0 ? 'bottom' : _param_xPosition, _param_yPosition = param.yPosition, yPosition = _param_yPosition === void 0 ? 'left' : _param_yPosition, _param_hiddenX = param.hiddenX, hiddenX = _param_hiddenX === void 0 ? false : _param_hiddenX, _param_hiddenY = param.hiddenY, hiddenY = _param_hiddenY === void 0 ? false : _param_hiddenY, _param_stacked = param.stacked, stacked = _param_stacked === void 0 ? false : _param_stacked, _param_indexAxis = param.indexAxis, indexAxis = _param_indexAxis === void 0 ? 'x' : _param_indexAxis, maxBarThickness = param.maxBarThickness, toolbarExtra = param.toolbarExtra, _param_renderFilterInToolbar = param.renderFilterInToolbar, renderFilterInToolbar = _param_renderFilterInToolbar === void 0 ? false : _param_renderFilterInToolbar, statisticConfig = param.statistic, variant = param.variant, _param_showDataLabels = param.showDataLabels, showDataLabels = _param_showDataLabels === void 0 ? false : _param_showDataLabels, dataLabelFormatter = param.dataLabelFormatter, chartOptions = param.chartOptions, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading;
141
141
  useMemo(function() {
142
142
  if (barChartComponentsRegistered) {
143
143
  return undefined;
@@ -512,8 +512,10 @@ var BarChart = function BarChart(param) {
512
512
  }, [
513
513
  filterLabels
514
514
  ]);
515
+ var detectedTheme = useDetectTheme();
516
+ var resolvedTheme = theme !== null && theme !== void 0 ? theme : detectedTheme;
515
517
  // 使用 useChartTheme hook 获取主题相关颜色
516
- var _useChartTheme = useChartTheme(theme), axisTextColor = _useChartTheme.axisTextColor, gridColor = _useChartTheme.gridColor, isLight = _useChartTheme.isLight;
518
+ var _useChartTheme = useChartTheme(resolvedTheme), axisTextColor = _useChartTheme.axisTextColor, gridColor = _useChartTheme.gridColor, isLight = _useChartTheme.isLight;
517
519
  // 标签宽度计算函数
518
520
  var calculateLabelWidth = function calculateLabelWidth(text) {
519
521
  var fontSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 11;
@@ -848,13 +850,13 @@ var BarChart = function BarChart(param) {
848
850
  return wrapSSR(/*#__PURE__*/ React.createElement(ChartContainer, {
849
851
  baseClassName: baseClassName,
850
852
  className: rootClassName,
851
- theme: theme,
853
+ theme: resolvedTheme,
852
854
  isMobile: isMobile,
853
855
  variant: variant,
854
856
  style: rootStyle
855
857
  }, /*#__PURE__*/ React.createElement(ChartToolBar, {
856
858
  title: title,
857
- theme: theme,
859
+ theme: resolvedTheme,
858
860
  onDownload: handleDownload,
859
861
  extra: toolbarExtra,
860
862
  dataTime: dataTime,
@@ -870,7 +872,7 @@ var BarChart = function BarChart(param) {
870
872
  selectedCustomSelection: selectedFilterLabel,
871
873
  onSelectionChange: setSelectedFilterLabel
872
874
  }), {
873
- theme: theme,
875
+ theme: resolvedTheme,
874
876
  variant: "compact",
875
877
  className: filterClassName,
876
878
  style: filterStyle
@@ -882,7 +884,7 @@ var BarChart = function BarChart(param) {
882
884
  return /*#__PURE__*/ React.createElement(ChartStatistic, _object_spread_props(_object_spread({
883
885
  key: index
884
886
  }, config), {
885
- theme: theme
887
+ theme: resolvedTheme
886
888
  }));
887
889
  })), !renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /*#__PURE__*/ React.createElement(ChartFilter, _object_spread_props(_object_spread({
888
890
  filterOptions: filterOptions,
@@ -893,7 +895,7 @@ var BarChart = function BarChart(param) {
893
895
  selectedCustomSelection: selectedFilterLabel,
894
896
  onSelectionChange: setSelectedFilterLabel
895
897
  }), {
896
- theme: theme,
898
+ theme: resolvedTheme,
897
899
  className: filterClassName,
898
900
  style: filterStyle
899
901
  })), /*#__PURE__*/ React.createElement("div", {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ChartContainerProps } from '../components';
3
- import { StatisticConfigType } from '../hooks/useChartStatistic';
3
+ import { StatisticConfigType } from '../hooks';
4
4
  import type { ChartClassNames, ChartStyles } from '../types/classNames';
5
5
  /**
6
6
  * 箱线图数据项接口