@ant-design/agentic-ui 2.30.31 → 2.31.0

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 (96) hide show
  1. package/dist/AILabel/index.d.ts +2 -0
  2. package/dist/AILabel/index.js +4 -2
  3. package/dist/AgentRunBar/Robot.js +0 -1
  4. package/dist/AgentRunBar/index.js +1 -0
  5. package/dist/AgenticLayout/index.js +1 -0
  6. package/dist/AnswerAlert/index.js +1 -0
  7. package/dist/BackTo/ScrollVisibleButton.d.ts +2 -0
  8. package/dist/BackTo/ScrollVisibleButton.js +4 -2
  9. package/dist/Bubble/List/PureBubbleList.js +2 -0
  10. package/dist/Bubble/style.js +0 -1
  11. package/dist/ChatBootPage/ButtonTab.js +1 -0
  12. package/dist/ChatBootPage/ButtonTabGroup.js +1 -0
  13. package/dist/ChatBootPage/CaseReply.js +1 -0
  14. package/dist/ChatBootPage/Title.js +1 -0
  15. package/dist/ChatLayout/index.js +1 -0
  16. package/dist/Components/ActionItemBox/ActionItemBox.js +1 -0
  17. package/dist/Components/Button/IconButton/index.js +1 -0
  18. package/dist/Components/Button/SwitchButton/index.js +1 -0
  19. package/dist/Components/Button/ToggleButton/index.js +1 -0
  20. package/dist/Components/GradientText/index.js +1 -0
  21. package/dist/Components/LayoutHeader/index.js +2 -1
  22. package/dist/Components/Loading/Loading.js +2 -0
  23. package/dist/Components/Robot/index.js +1 -0
  24. package/dist/Components/Robot/lotties/BlowingWindLottie/index.js +16 -3
  25. package/dist/Components/Robot/lotties/BouncingLottie/index.js +16 -3
  26. package/dist/Components/Robot/lotties/DazingLottie/index.js +16 -3
  27. package/dist/Components/Robot/lotties/PeekLottie/index.js +16 -3
  28. package/dist/Components/Robot/lotties/ThinkingLottie/index.js +16 -3
  29. package/dist/Components/SuggestionList/index.js +1 -0
  30. package/dist/Components/TextAnimate/index.js +1 -0
  31. package/dist/Components/TypingAnimation/index.js +2 -1
  32. package/dist/Components/VisualList/index.js +3 -0
  33. package/dist/Components/lotties/CreativeSparkLottie/index.js +16 -3
  34. package/dist/Components/lotties/DazingLottie/index.js +16 -3
  35. package/dist/Components/lotties/LoadingLottie/index.js +16 -3
  36. package/dist/Components/lotties/ThinkingLottie/index.js +16 -3
  37. package/dist/Components/lotties/ThreeThinkingLottie/index.d.ts +68 -0
  38. package/dist/Components/lotties/ThreeThinkingLottie/index.js +103 -0
  39. package/dist/Components/lotties/ThreeThinkingLottie/three-thinking.json +130 -0
  40. package/dist/Components/lotties/bubble-actions/Copy/index.js +12 -3
  41. package/dist/Components/lotties/bubble-actions/Dislike/index.js +12 -3
  42. package/dist/Components/lotties/bubble-actions/Like/index.js +12 -3
  43. package/dist/Components/lotties/bubble-actions/More/index.js +12 -3
  44. package/dist/Components/lotties/bubble-actions/Play/index.js +12 -3
  45. package/dist/Components/lotties/bubble-actions/Quote/index.js +12 -3
  46. package/dist/Components/lotties/bubble-actions/Refresh/index.js +12 -3
  47. package/dist/Components/lotties/bubble-actions/Share/index.js +12 -3
  48. package/dist/Components/lotties/index.d.ts +2 -0
  49. package/dist/Components/lotties/index.js +2 -0
  50. package/dist/Components/lotties/useAsyncLottieData.d.ts +9 -0
  51. package/dist/Components/lotties/useAsyncLottieData.js +83 -0
  52. package/dist/History/index.js +1 -0
  53. package/dist/Hooks/useLanguage.d.ts +1 -0
  54. package/dist/I18n/locales.d.ts +1 -0
  55. package/dist/I18n/locales.js +2 -0
  56. package/dist/Icons/animated/VoicePlayLottie/index.js +16 -3
  57. package/dist/Icons/animated/VoicingLottie/index.js +16 -3
  58. package/dist/MarkdownEditor/BaseMarkdownEditor.js +2 -0
  59. package/dist/MarkdownEditor/editor/elements/Paragraph/index.js +10 -10
  60. package/dist/MarkdownInputField/BorderBeamAnimation.d.ts +1 -1
  61. package/dist/MarkdownInputField/BorderBeamAnimation.js +6 -3
  62. package/dist/MarkdownRenderer/MarkdownRenderer.js +1 -0
  63. package/dist/Plugins/chart/AreaChart/index.js +10 -8
  64. package/dist/Plugins/chart/BarChart/index.js +10 -8
  65. package/dist/Plugins/chart/BoxPlotChart/index.d.ts +1 -1
  66. package/dist/Plugins/chart/BoxPlotChart/index.js +11 -8
  67. package/dist/Plugins/chart/DonutChart/index.js +14 -12
  68. package/dist/Plugins/chart/FunnelChart/index.js +10 -8
  69. package/dist/Plugins/chart/HistogramChart/index.d.ts +1 -1
  70. package/dist/Plugins/chart/HistogramChart/index.js +11 -8
  71. package/dist/Plugins/chart/LineChart/index.js +10 -8
  72. package/dist/Plugins/chart/RadarChart/index.js +14 -12
  73. package/dist/Plugins/chart/ScatterChart/index.js +14 -12
  74. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +13 -3
  75. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +21 -4
  76. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +2 -0
  77. package/dist/Plugins/chart/hooks/index.d.ts +2 -0
  78. package/dist/Plugins/chart/hooks/index.js +1 -0
  79. package/dist/Plugins/chart/hooks/useChartTheme.d.ts +1 -1
  80. package/dist/Plugins/chart/hooks/useChartTheme.js +1 -1
  81. package/dist/Plugins/chart/hooks/useDetectTheme.d.ts +45 -0
  82. package/dist/Plugins/chart/hooks/useDetectTheme.js +249 -0
  83. package/dist/Schema/SchemaEditor/index.js +1 -0
  84. package/dist/Schema/SchemaForm/index.js +1 -0
  85. package/dist/TaskList/TaskList.js +21 -4
  86. package/dist/TaskList/components/TaskListItem.js +2 -1
  87. package/dist/TaskList/style.js +1 -1
  88. package/dist/ThoughtChainList/index.js +1 -0
  89. package/dist/ThoughtChainList/style.js +14 -3
  90. package/dist/ToolUseBar/index.js +7 -6
  91. package/dist/ToolUseBarThink/style.js +0 -7
  92. package/dist/WelcomeMessage/index.js +1 -0
  93. package/dist/Workspace/File/FileComponent.js +15 -9
  94. package/dist/Workspace/File/FileTree/FileTreeComponent.js +6 -1
  95. package/dist/Workspace/File/PreviewComponent.js +23 -6
  96. package/package.json +3 -3
@@ -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
+ };
@@ -274,6 +274,7 @@ export * from "./utils";
274
274
  if (props.standalone) {
275
275
  var _props_agent3, _props_agent4, _props_agent5, _props_agent6, _props_agent7, _props_slots_beforeHistoryList, _props_slots;
276
276
  return wrapSSR(/*#__PURE__*/ React.createElement("div", {
277
+ "data-testid": "history-standalone",
277
278
  style: {
278
279
  display: 'flex',
279
280
  flexDirection: 'column',
@@ -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
  });
@@ -394,6 +394,7 @@ var I18nBoundary = function I18nBoundary(param) {
394
394
  }, /*#__PURE__*/ React.createElement("div", {
395
395
  id: props.id ? String(props.id) || undefined : undefined,
396
396
  className: classNames(baseClassName, 'markdown-editor', hashId, props.className, (_obj = {}, _define_property(_obj, "".concat(baseClassName, "-readonly"), true), _define_property(_obj, "".concat(baseClassName, "-report"), props.reportMode), _define_property(_obj, "".concat(baseClassName, "-slide"), props.slideMode), _obj)),
397
+ "data-testid": "markdown-editor",
397
398
  style: _object_spread({
398
399
  width: width || '100%',
399
400
  height: height || 'auto'
@@ -453,6 +454,7 @@ var I18nBoundary = function I18nBoundary(param) {
453
454
  }, /*#__PURE__*/ React.createElement("div", {
454
455
  id: props.id ? String(props.id) || undefined : undefined,
455
456
  className: classNames(baseClassName, 'markdown-editor', hashId, props.className, (_obj1 = {}, _define_property(_obj1, "".concat(baseClassName, "-readonly"), readonly), _define_property(_obj1, "".concat(baseClassName, "-edit"), !readonly), _define_property(_obj1, "".concat(baseClassName, "-report"), props.reportMode), _define_property(_obj1, "".concat(baseClassName, "-slide"), props.slideMode), _obj1)),
457
+ "data-testid": "markdown-editor",
456
458
  style: _object_spread({
457
459
  width: width || '100%',
458
460
  height: height || 'auto'
@@ -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
@@ -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
@@ -369,6 +369,7 @@ var SCHEMA_LANGUAGES = new Set([
369
369
  return wrapVarSSR(wrapSSR(wrapContentSSR(/*#__PURE__*/ React.createElement("div", {
370
370
  ref: containerRef,
371
371
  className: clsx(prefixCls, "".concat(prefixCls, "-readonly"), hashId, className),
372
+ "data-testid": "markdown-renderer",
372
373
  style: style
373
374
  }, /*#__PURE__*/ React.createElement("div", {
374
375
  className: clsx("".concat(prefixCls, "-container"), hashId),
@@ -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
  * 箱线图数据项接口
@@ -153,6 +153,7 @@ import { Chart } from "react-chartjs-2";
153
153
  import ChartStatistic from "../ChartStatistic";
154
154
  import { ChartContainer, ChartFilter, ChartToolBar, downloadChart } from "../components";
155
155
  import { defaultColorList } from "../const";
156
+ import { useDetectTheme } from "../hooks";
156
157
  import { hexToRgba, resolveCssVariable } from "../utils";
157
158
  import { useStyle } from "./style";
158
159
  var boxPlotChartComponentsRegistered = false;
@@ -223,7 +224,7 @@ var boxPlotChartComponentsRegistered = false;
223
224
  };
224
225
  }
225
226
  var BoxPlotChart = function BoxPlotChart(_0) {
226
- var title = _0.title, data = _0.data, _0_width = _0.width, width = _0_width === void 0 ? 600 : _0_width, _0_height = _0.height, height = _0_height === void 0 ? 400 : _0_height, className = _0.className, classNamesProp = _0.classNames, style = _0.style, styles = _0.styles, dataTime = _0.dataTime, _0_theme = _0.theme, theme = _0_theme === void 0 ? 'light' : _0_theme, color = _0.color, _0_showLegend = _0.showLegend, showLegend = _0_showLegend === void 0 ? true : _0_showLegend, _0_legendPosition = _0.legendPosition, legendPosition = _0_legendPosition === void 0 ? 'bottom' : _0_legendPosition, _0_showGrid = _0.showGrid, showGrid = _0_showGrid === void 0 ? true : _0_showGrid, xAxisLabel = _0.xAxisLabel, yAxisLabel = _0.yAxisLabel, _0_showOutliers = _0.showOutliers, showOutliers = _0_showOutliers === void 0 ? true : _0_showOutliers, toolbarExtra = _0.toolbarExtra, _0_renderFilterInToolbar = _0.renderFilterInToolbar, renderFilterInToolbar = _0_renderFilterInToolbar === void 0 ? false : _0_renderFilterInToolbar, statisticConfig = _0.statistic, _0_loading = _0.loading, loading = _0_loading === void 0 ? false : _0_loading, props = _object_without_properties(_0, [
227
+ var title = _0.title, data = _0.data, _0_width = _0.width, width = _0_width === void 0 ? 600 : _0_width, _0_height = _0.height, height = _0_height === void 0 ? 400 : _0_height, className = _0.className, classNamesProp = _0.classNames, style = _0.style, styles = _0.styles, dataTime = _0.dataTime, theme = _0.theme, color = _0.color, _0_showLegend = _0.showLegend, showLegend = _0_showLegend === void 0 ? true : _0_showLegend, _0_legendPosition = _0.legendPosition, legendPosition = _0_legendPosition === void 0 ? 'bottom' : _0_legendPosition, _0_showGrid = _0.showGrid, showGrid = _0_showGrid === void 0 ? true : _0_showGrid, xAxisLabel = _0.xAxisLabel, yAxisLabel = _0.yAxisLabel, _0_showOutliers = _0.showOutliers, showOutliers = _0_showOutliers === void 0 ? true : _0_showOutliers, toolbarExtra = _0.toolbarExtra, _0_renderFilterInToolbar = _0.renderFilterInToolbar, renderFilterInToolbar = _0_renderFilterInToolbar === void 0 ? false : _0_renderFilterInToolbar, statisticConfig = _0.statistic, _0_loading = _0.loading, loading = _0_loading === void 0 ? false : _0_loading, props = _object_without_properties(_0, [
227
228
  "title",
228
229
  "data",
229
230
  "width",
@@ -445,7 +446,9 @@ var BoxPlotChart = function BoxPlotChart(_0) {
445
446
  color,
446
447
  showOutliers
447
448
  ]);
448
- var isLight = theme === 'light';
449
+ var detectedTheme = useDetectTheme();
450
+ var resolvedTheme = theme !== null && theme !== void 0 ? theme : detectedTheme;
451
+ var isLight = resolvedTheme === 'light';
449
452
  var axisTextColor = isLight ? 'rgba(0, 25, 61, 0.3255)' : 'rgba(255, 255, 255, 0.8)';
450
453
  var gridColor = isLight ? 'rgba(0,0,0,0.08)' : 'rgba(255,255,255,0.2)';
451
454
  // 图表配置选项
@@ -576,7 +579,7 @@ var BoxPlotChart = function BoxPlotChart(_0) {
576
579
  if (safeData.length === 0 || labels.length === 0) {
577
580
  return wrapSSR(/*#__PURE__*/ React.createElement(ChartContainer, {
578
581
  baseClassName: classNames("".concat(prefixCls, "-container"), hashId),
579
- theme: theme,
582
+ theme: resolvedTheme,
580
583
  className: classNames(classNamesProp === null || classNamesProp === void 0 ? void 0 : classNamesProp.root, className),
581
584
  isMobile: isMobile,
582
585
  variant: props.variant,
@@ -604,7 +607,7 @@ var BoxPlotChart = function BoxPlotChart(_0) {
604
607
  }
605
608
  return wrapSSR(/*#__PURE__*/ React.createElement(ChartContainer, {
606
609
  baseClassName: classNames("".concat(prefixCls, "-container"), hashId),
607
- theme: theme,
610
+ theme: resolvedTheme,
608
611
  className: classNames(classNamesProp === null || classNamesProp === void 0 ? void 0 : classNamesProp.root, className),
609
612
  isMobile: isMobile,
610
613
  variant: props.variant,
@@ -614,7 +617,7 @@ var BoxPlotChart = function BoxPlotChart(_0) {
614
617
  }, style, styles === null || styles === void 0 ? void 0 : styles.root)
615
618
  }, /*#__PURE__*/ React.createElement(ChartToolBar, {
616
619
  title: title || '箱线图',
617
- theme: theme,
620
+ theme: resolvedTheme,
618
621
  onDownload: handleDownload,
619
622
  extra: toolbarExtra,
620
623
  dataTime: dataTime,
@@ -628,7 +631,7 @@ var BoxPlotChart = function BoxPlotChart(_0) {
628
631
  selectedCustomSelection: selectedFilterLabel,
629
632
  onSelectionChange: setSelectedFilterLabel
630
633
  }), {
631
- theme: theme,
634
+ theme: resolvedTheme,
632
635
  variant: "compact"
633
636
  })) : undefined
634
637
  }), statistics && /*#__PURE__*/ React.createElement("div", {
@@ -638,7 +641,7 @@ var BoxPlotChart = function BoxPlotChart(_0) {
638
641
  return /*#__PURE__*/ React.createElement(ChartStatistic, _object_spread_props(_object_spread({
639
642
  key: index
640
643
  }, config), {
641
- theme: theme
644
+ theme: resolvedTheme
642
645
  }));
643
646
  })), !renderFilterInToolbar && filterOptions.length > 1 && /*#__PURE__*/ React.createElement(ChartFilter, _object_spread_props(_object_spread({
644
647
  filterOptions: filterOptions,
@@ -649,7 +652,7 @@ var BoxPlotChart = function BoxPlotChart(_0) {
649
652
  selectedCustomSelection: selectedFilterLabel,
650
653
  onSelectionChange: setSelectedFilterLabel
651
654
  }), {
652
- theme: theme
655
+ theme: resolvedTheme
653
656
  })), /*#__PURE__*/ React.createElement("div", {
654
657
  className: classNames(classNamesProp === null || classNamesProp === void 0 ? void 0 : classNamesProp.wrapper, "".concat(prefixCls, "-wrapper")),
655
658
  style: _object_spread({