@ant-design/agentic-ui 2.30.1 → 2.30.3

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 (60) hide show
  1. package/dist/Hooks/useLanguage.d.ts +3 -0
  2. package/dist/I18n/locales.d.ts +3 -0
  3. package/dist/I18n/locales.js +6 -0
  4. package/dist/MarkdownEditor/editor/parser/constants.d.ts +2 -1
  5. package/dist/MarkdownEditor/editor/parser/constants.js +86 -8
  6. package/dist/MarkdownEditor/editor/store.d.ts +1 -2
  7. package/dist/MarkdownEditor/editor/tools/ToolBar/components/ToolBarItem.js +6 -4
  8. package/dist/MarkdownRenderer/renderers/ChartRenderer.js +13 -4
  9. package/dist/MarkdownRenderer/useMarkdownToReact.js +35 -15
  10. package/dist/Plugins/chart/AreaChart/index.js +4 -3
  11. package/dist/Plugins/chart/BarChart/index.js +8 -8
  12. package/dist/Plugins/chart/BoxPlotChart/index.d.ts +65 -0
  13. package/dist/Plugins/chart/BoxPlotChart/index.js +665 -0
  14. package/dist/Plugins/chart/BoxPlotChart/style.d.ts +8 -0
  15. package/dist/Plugins/chart/BoxPlotChart/style.js +118 -0
  16. package/dist/Plugins/chart/ChartAttrToolBar/index.js +5 -16
  17. package/dist/Plugins/chart/ChartMark/Area.d.ts +2 -1
  18. package/dist/Plugins/chart/ChartMark/Area.js +5 -4
  19. package/dist/Plugins/chart/ChartMark/Bar.d.ts +2 -1
  20. package/dist/Plugins/chart/ChartMark/Bar.js +5 -4
  21. package/dist/Plugins/chart/ChartMark/Column.d.ts +2 -1
  22. package/dist/Plugins/chart/ChartMark/Column.js +5 -4
  23. package/dist/Plugins/chart/ChartMark/Line.d.ts +2 -1
  24. package/dist/Plugins/chart/ChartMark/Line.js +5 -4
  25. package/dist/Plugins/chart/ChartMark/Pie.d.ts +2 -1
  26. package/dist/Plugins/chart/ChartMark/Pie.js +5 -4
  27. package/dist/Plugins/chart/ChartRender.d.ts +1 -1
  28. package/dist/Plugins/chart/ChartRender.js +188 -12
  29. package/dist/Plugins/chart/DonutChart/Legend.d.ts +5 -3
  30. package/dist/Plugins/chart/DonutChart/Legend.js +30 -38
  31. package/dist/Plugins/chart/DonutChart/index.js +82 -23
  32. package/dist/Plugins/chart/DonutChart/plugins.d.ts +2 -2
  33. package/dist/Plugins/chart/DonutChart/plugins.js +5 -5
  34. package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
  35. package/dist/Plugins/chart/FunnelChart/index.js +24 -14
  36. package/dist/Plugins/chart/HistogramChart/index.d.ts +65 -0
  37. package/dist/Plugins/chart/HistogramChart/index.js +665 -0
  38. package/dist/Plugins/chart/HistogramChart/style.d.ts +8 -0
  39. package/dist/Plugins/chart/HistogramChart/style.js +118 -0
  40. package/dist/Plugins/chart/LineChart/index.js +4 -3
  41. package/dist/Plugins/chart/RadarChart/index.d.ts +2 -0
  42. package/dist/Plugins/chart/RadarChart/index.js +28 -26
  43. package/dist/Plugins/chart/ScatterChart/index.d.ts +2 -0
  44. package/dist/Plugins/chart/ScatterChart/index.js +43 -28
  45. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +1 -0
  46. package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +14 -0
  47. package/dist/Plugins/chart/components/ChartContainer/ChartDarkAntdContext.d.ts +7 -0
  48. package/dist/Plugins/chart/components/ChartContainer/ChartDarkAntdContext.js +8 -0
  49. package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +8 -2
  50. package/dist/Plugins/chart/components/ChartContainer/style.js +3 -3
  51. package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.d.ts +2 -0
  52. package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.js +23 -32
  53. package/dist/Plugins/chart/index.d.ts +4 -0
  54. package/dist/Plugins/chart/index.js +2 -0
  55. package/dist/Plugins/chart/loadChartRuntime.d.ts +4 -0
  56. package/dist/Plugins/chart/loadChartRuntime.js +5 -1
  57. package/dist/Plugins/chart/utils.d.ts +14 -0
  58. package/dist/Plugins/chart/utils.js +49 -2
  59. package/dist/Schema/SchemaEditor/index.js +12 -5
  60. package/package.json +7 -5
@@ -71,6 +71,8 @@ export declare function useLanguage(): {
71
71
  radarChart: string;
72
72
  scatterChart: string;
73
73
  funnelChart: string;
74
+ boxplotChart: string;
75
+ histogramChart: string;
74
76
  configChart: string;
75
77
  updateChart: string;
76
78
  barChart: string;
@@ -168,6 +170,7 @@ export declare function useLanguage(): {
168
170
  runCode: string;
169
171
  rerender: string;
170
172
  download: string;
173
+ copyMarkdown: string;
171
174
  dragToMove: string;
172
175
  format: string;
173
176
  removeLink: string;
@@ -33,6 +33,8 @@ export declare const cnLabels: {
33
33
  radarChart: string;
34
34
  scatterChart: string;
35
35
  funnelChart: string;
36
+ boxplotChart: string;
37
+ histogramChart: string;
36
38
  configChart: string;
37
39
  updateChart: string;
38
40
  barChart: string;
@@ -130,6 +132,7 @@ export declare const cnLabels: {
130
132
  runCode: string;
131
133
  rerender: string;
132
134
  download: string;
135
+ copyMarkdown: string;
133
136
  dragToMove: string;
134
137
  format: string;
135
138
  removeLink: string;
@@ -32,6 +32,8 @@
32
32
  radarChart: '雷达图',
33
33
  scatterChart: '散点图',
34
34
  funnelChart: '漏斗图',
35
+ boxplotChart: '箱线图',
36
+ histogramChart: '直方图',
35
37
  configChart: '配置图表',
36
38
  updateChart: '更新',
37
39
  barChart: '条形图',
@@ -130,6 +132,7 @@
130
132
  runCode: '运行代码',
131
133
  rerender: '重新渲染',
132
134
  download: '下载',
135
+ copyMarkdown: '复制表格',
133
136
  dragToMove: '拖拽移动',
134
137
  format: '格式化',
135
138
  removeLink: '移除链接',
@@ -490,6 +493,8 @@
490
493
  radarChart: 'Radar Chart',
491
494
  scatterChart: 'Scatter Chart',
492
495
  funnelChart: 'Funnel Chart',
496
+ boxplotChart: 'Box Plot',
497
+ histogramChart: 'Histogram',
493
498
  barChart: 'Bar Chart',
494
499
  lineChart: 'Line Chart',
495
500
  columnChart: 'Column Chart',
@@ -552,6 +557,7 @@
552
557
  runCode: 'Run Code',
553
558
  rerender: 'Rerender',
554
559
  download: 'Download',
560
+ copyMarkdown: 'Copy Table',
555
561
  dragToMove: 'Drag to Move',
556
562
  format: 'Format',
557
563
  removeLink: 'Remove Link',
@@ -6,7 +6,8 @@ export declare const JINJA_DOLLAR_PLACEHOLDER = "\uE01A";
6
6
  /**
7
7
  * 保护时间格式(如 02:20:31)不被 remark-directive 误解析为 textDirective。
8
8
  * remark-directive 会将 ":20"、":31" 等解析为指令,导致 "Cannot handle unknown node textDirective"。
9
- * 在数字与冒号间插入零宽空格 \u200B 以阻断误解析。
9
+ * 使用反斜杠转义冒号(remark-directive 推荐:\:port 可防止 :port 被解析为指令)。
10
+ * 围栏代码块与行内反引号内不处理:该处为字面量,不应出现 `\:` 污染。
10
11
  * 须在 remark-directive 解析前执行。
11
12
  */
12
13
  export declare function preprocessProtectTimeFromDirective(markdown: string): string;
@@ -3,18 +3,96 @@
3
3
  * 在 markdown 解析前替换,渲染与序列化时还原为 $。
4
4
  */ export var JINJA_DOLLAR_PLACEHOLDER = '\uE01A';
5
5
  /** URL 协议占位符,用于保护时间格式预处理时不影响 https:// 等 */ var URL_PROTOCOL_PLACEHOLDER = '\uE01B\uE01B';
6
+ /** CommonMark:最多 3 个前导空白后接至少 3 个 backtick 的围栏行 */ var FENCE_DELIMITER_LINE = /^[\t \uFEFF]{0,3}`{3,}/;
7
+ function protectLineFromDirectiveTime(markdownLine) {
8
+ var withProtocolProtected = markdownLine.replace(/:\/\//g, URL_PROTOCOL_PLACEHOLDER);
9
+ var withTimeProtected = withProtocolProtected.replace(/:(\d)/g, function(_, d) {
10
+ return "\\:".concat(d);
11
+ });
12
+ return withTimeProtected.replace(/\uE01B\uE01B/g, '://');
13
+ }
14
+ /**
15
+ * CommonMark 行内代码:起始与结束为等长反引号串,结束串后不得紧跟反引号(避免与更长串混淆)。
16
+ */ function findInlineCodeClose(line, contentStart, openCount) {
17
+ for(var pos = contentStart; pos < line.length; pos++){
18
+ if (line[pos] !== '`') continue;
19
+ var k = 0;
20
+ while(k < openCount && pos + k < line.length && line[pos + k] === '`'){
21
+ k++;
22
+ }
23
+ if (k !== openCount) continue;
24
+ if (pos + openCount < line.length && line[pos + openCount] === '`') continue;
25
+ return pos;
26
+ }
27
+ return -1;
28
+ }
29
+ /** 围栏外单行:跳过行内反引号包裹片段,仅对其余文本做 directive 时间保护 */ function protectLineOutsideInlineCode(markdownLine) {
30
+ var result = '';
31
+ var i = 0;
32
+ while(i < markdownLine.length){
33
+ if (markdownLine[i] !== '`') {
34
+ var next = markdownLine.indexOf('`', i);
35
+ if (next === -1) {
36
+ result += protectLineFromDirectiveTime(markdownLine.slice(i));
37
+ break;
38
+ }
39
+ result += protectLineFromDirectiveTime(markdownLine.slice(i, next));
40
+ i = next;
41
+ continue;
42
+ }
43
+ var blockStart = i;
44
+ var openCount = 0;
45
+ while(i < markdownLine.length && markdownLine[i] === '`'){
46
+ openCount++;
47
+ i++;
48
+ }
49
+ var contentStart = i;
50
+ var closePos = findInlineCodeClose(markdownLine, contentStart, openCount);
51
+ if (closePos === -1) {
52
+ result += markdownLine.slice(blockStart);
53
+ break;
54
+ }
55
+ var blockEnd = closePos + openCount;
56
+ result += markdownLine.slice(blockStart, blockEnd);
57
+ i = blockEnd;
58
+ }
59
+ return result;
60
+ }
6
61
  /**
7
62
  * 保护时间格式(如 02:20:31)不被 remark-directive 误解析为 textDirective。
8
63
  * remark-directive 会将 ":20"、":31" 等解析为指令,导致 "Cannot handle unknown node textDirective"。
9
- * 在数字与冒号间插入零宽空格 \u200B 以阻断误解析。
64
+ * 使用反斜杠转义冒号(remark-directive 推荐:\:port 可防止 :port 被解析为指令)。
65
+ * 围栏代码块与行内反引号内不处理:该处为字面量,不应出现 `\:` 污染。
10
66
  * 须在 remark-directive 解析前执行。
11
67
  */ export function preprocessProtectTimeFromDirective(markdown) {
12
68
  if (!markdown || markdown.length === 0) return markdown;
13
- var withProtocolProtected = markdown.replace(/:\/\//g, URL_PROTOCOL_PLACEHOLDER);
14
- // 使用反斜杠转义冒号,阻止 ":20"、":31" 等被 remark-directive 解析为 textDirective
15
- // remark-directive 官方推荐:\:port 可防止 :port 被解析为指令
16
- var withTimeProtected = withProtocolProtected.replace(/:(\d)/g, function(_, d) {
17
- return "\\:".concat(d);
18
- });
19
- return withTimeProtected.replace(/\uE01B\uE01B/g, '://');
69
+ var lines = markdown.split('\n');
70
+ var inFence = false;
71
+ var out = [];
72
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
73
+ try {
74
+ for(var _iterator = lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
75
+ var line = _step.value;
76
+ if (FENCE_DELIMITER_LINE.test(line)) {
77
+ inFence = !inFence;
78
+ out.push(line);
79
+ continue;
80
+ }
81
+ out.push(inFence ? line : protectLineOutsideInlineCode(line));
82
+ }
83
+ } catch (err) {
84
+ _didIteratorError = true;
85
+ _iteratorError = err;
86
+ } finally{
87
+ try {
88
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
89
+ _iterator.return();
90
+ }
91
+ } finally{
92
+ if (_didIteratorError) {
93
+ throw _iteratorError;
94
+ }
95
+ }
96
+ }
97
+ return out.join('\n');
20
98
  }
@@ -3,7 +3,6 @@ import { Subject } from 'rxjs';
3
3
  import { BaseEditor, Node, NodeMatch, Path, RangeMode, Selection } from 'slate';
4
4
  import { HistoryEditor } from 'slate-history';
5
5
  import { ReactEditor } from 'slate-react';
6
- import { T } from 'vitest/dist/chunks/environment.LoooBwUu.js';
7
6
  import { FootnoteDefinitionNode } from '../el';
8
7
  import type { MarkdownEditorPlugin } from '../plugin';
9
8
  import { CommentDataType, MarkdownEditorProps } from '../types';
@@ -236,7 +235,7 @@ export declare class EditorStore {
236
235
  */
237
236
  removeNodes: (options?: {
238
237
  at?: Location;
239
- match?: NodeMatch<T>;
238
+ match?: NodeMatch<Node>;
240
239
  mode?: RangeMode;
241
240
  hanging?: boolean;
242
241
  voids?: boolean;
@@ -15,9 +15,7 @@ export var ToolBarItem = /*#__PURE__*/ React.memo(function(param) {
15
15
  }, [
16
16
  onMouseDown
17
17
  ]);
18
- return /*#__PURE__*/ React.createElement(Tooltip, {
19
- title: title
20
- }, /*#__PURE__*/ React.createElement("div", {
18
+ var content = /*#__PURE__*/ React.createElement("div", {
21
19
  role: role,
22
20
  className: className,
23
21
  style: style,
@@ -25,6 +23,10 @@ export var ToolBarItem = /*#__PURE__*/ React.memo(function(param) {
25
23
  onMouseDown: handleMouseDown,
26
24
  onMouseEnter: onMouseEnter,
27
25
  tabIndex: tabIndex
28
- }, children || icon));
26
+ }, children || icon);
27
+ // 仅在有 title 时使用 Tooltip,避免 rc-resize-observer 的 findDOMNode 弃用警告
28
+ return title ? /*#__PURE__*/ React.createElement(Tooltip, {
29
+ title: title
30
+ }, content) : content;
29
31
  });
30
32
  ToolBarItem.displayName = 'ToolBarItem';
@@ -142,6 +142,7 @@ import React, { useEffect, useMemo, useRef, useState } from "react";
142
142
  import { ErrorBoundary } from "react-error-boundary";
143
143
  import { Loading } from "../../Components/Loading";
144
144
  import { ChartRender } from "../../Plugins/chart/ChartRender";
145
+ import { parseChineseCurrencyToNumber } from "../../Plugins/chart/utils";
145
146
  var extractTextContent = function extractTextContent1(children) {
146
147
  var _children_props;
147
148
  if (typeof children === 'string') return children;
@@ -366,13 +367,21 @@ var extractTextContent = function extractTextContent1(children) {
366
367
  var row = _object_spread_props(_object_spread({}, rowData), {
367
368
  column_list: Object.keys(rowData)
368
369
  });
370
+ var coerceChartAxisCell = function coerceChartAxisCell(raw) {
371
+ if (typeof raw === 'number' && Number.isFinite(raw)) return raw;
372
+ var n = Number(raw);
373
+ if (Number.isFinite(n)) return n;
374
+ if (typeof raw === 'string') {
375
+ var cn = parseChineseCurrencyToNumber(raw);
376
+ if (cn !== null) return cn;
377
+ }
378
+ return raw;
379
+ };
369
380
  if (x && row[x] !== undefined) {
370
- var num = Number(row[x]);
371
- if (!isNaN(num)) row[x] = num;
381
+ row[x] = coerceChartAxisCell(row[x]);
372
382
  }
373
383
  if (y && row[y] !== undefined) {
374
- var num1 = Number(row[y]);
375
- if (!isNaN(num1)) row[y] = num1;
384
+ row[y] = coerceChartAxisCell(row[y]);
376
385
  }
377
386
  return row;
378
387
  });
@@ -138,6 +138,7 @@ import { JINJA_DOLLAR_PLACEHOLDER } from "../MarkdownEditor/editor/parser/consta
138
138
  import { remarkDirectiveContainer } from "../MarkdownEditor/editor/parser/remarkDirectiveContainer";
139
139
  import { convertParagraphToImage, fixStrongWithSpecialChars, protectJinjaDollarInText } from "../MarkdownEditor/editor/parser/remarkParse";
140
140
  import { REMARK_REHYPE_DIRECTIVE_HANDLERS } from "../MarkdownEditor/editor/utils/markdownToHtml";
141
+ import { parseChineseCurrencyToNumber } from "../Plugins/chart/utils";
141
142
  import { ToolUseBarThink } from "../ToolUseBarThink";
142
143
  import AnimationText from "./AnimationText";
143
144
  var INLINE_MATH_WITH_SINGLE_DOLLAR = {
@@ -177,8 +178,17 @@ var extractCellText = function extractCellText1(cell) {
177
178
  row.children.forEach(function(cell, j) {
178
179
  if (j < columns.length) {
179
180
  var val = extractCellText(cell);
180
- var num = Number(val);
181
- record[columns[j].dataIndex] = isNaN(num) || val === '' ? val : num;
181
+ if (val === '') {
182
+ record[columns[j].dataIndex] = val;
183
+ } else {
184
+ var num = Number(val);
185
+ if (Number.isFinite(num)) {
186
+ record[columns[j].dataIndex] = num;
187
+ } else {
188
+ var cn = parseChineseCurrencyToNumber(val);
189
+ record[columns[j].dataIndex] = cn !== null ? cn : val;
190
+ }
191
+ }
182
192
  }
183
193
  });
184
194
  dataSource.push(record);
@@ -356,14 +366,13 @@ var createHastProcessor = function createHastProcessor(extraRemarkPlugins, confi
356
366
  };
357
367
  var extractLanguageFromClassName = function extractLanguageFromClassName(className) {
358
368
  if (!className) return undefined;
359
- var classes = Array.isArray(className) ? className : [
360
- className
361
- ];
369
+ var flat = typeof className === 'string' ? className : className.map(String).join(' ');
370
+ var classes = flat.split(/\s+/).filter(Boolean);
362
371
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
363
372
  try {
364
373
  for(var _iterator = classes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
365
374
  var cls = _step.value;
366
- var match = String(cls).match(/^language-(.+)$/);
375
+ var match = cls.match(/^language-(.+)$/);
367
376
  if (match) return match[1];
368
377
  }
369
378
  } catch (err) {
@@ -766,13 +775,15 @@ var extractLanguageFromClassName = function extractLanguageFromClassName(classNa
766
775
  }));
767
776
  },
768
777
  code: function code(props) {
769
- var _node = props.node, children = props.children, rest = _object_without_properties(props, [
778
+ var _node = props.node, children = props.children, className = props.className, rest = _object_without_properties(props, [
770
779
  "node",
771
- "children"
780
+ "children",
781
+ "className"
772
782
  ]);
783
+ var fenceLang = extractLanguageFromClassName(className);
773
784
  return jsx('code', _object_spread_props(_object_spread({}, rest), {
774
- 'data-testid': 'markdown-inline-code',
775
- className: "".concat(contentCls, "-inline-code"),
785
+ 'data-testid': fenceLang ? 'markdown-fenced-code' : 'markdown-inline-code',
786
+ className: fenceLang ? className : "".concat(contentCls, "-inline-code"),
776
787
  children: children
777
788
  }));
778
789
  },
@@ -822,19 +833,24 @@ var extractLanguageFromClassName = function extractLanguageFromClassName(classNa
822
833
  // ================================================================
823
834
  // 代码块 pre > code → 路由到自定义渲染器
824
835
  pre: function pre(props) {
825
- var _node = props.node, children = props.children, rest = _object_without_properties(props, [
836
+ var _hastPreNode_children_, _hastPreNode_children, _hastPreNode_children__properties;
837
+ var hastPreNode = props.node, children = props.children, rest = _object_without_properties(props, [
826
838
  "node",
827
839
  "children"
828
840
  ]);
829
841
  var codeChild = Array.isArray(children) ? children[0] : children;
830
842
  var codeProps = (codeChild === null || codeChild === void 0 ? void 0 : codeChild.props) || {};
843
+ var codeHastClass = (hastPreNode === null || hastPreNode === void 0 ? void 0 : (_hastPreNode_children = hastPreNode.children) === null || _hastPreNode_children === void 0 ? void 0 : (_hastPreNode_children_ = _hastPreNode_children[0]) === null || _hastPreNode_children_ === void 0 ? void 0 : _hastPreNode_children_.type) === 'element' && hastPreNode.children[0].tagName === 'code' ? (_hastPreNode_children__properties = hastPreNode.children[0].properties) === null || _hastPreNode_children__properties === void 0 ? void 0 : _hastPreNode_children__properties.className : undefined;
831
844
  var language = extractLanguageFromClassName(codeProps.className);
845
+ if (!language) {
846
+ language = extractLanguageFromClassName(codeHastClass);
847
+ }
832
848
  var CodeBlockComponent = userComponents.__codeBlock || userComponents.code;
833
849
  if (CodeBlockComponent) {
834
850
  return jsx(CodeBlockComponent, _object_spread_props(_object_spread({}, rest), {
835
851
  language: language,
836
852
  children: codeProps.children,
837
- node: _node
853
+ node: hastPreNode
838
854
  }));
839
855
  }
840
856
  return jsxs('pre', _object_spread_props(_object_spread({}, rest), {
@@ -1056,7 +1072,8 @@ var extractLanguageFromClassName = function extractLanguageFromClassName(classNa
1056
1072
  Fragment: Fragment,
1057
1073
  jsx: jsx,
1058
1074
  jsxs: jsxs,
1059
- components: components
1075
+ components: components,
1076
+ passNode: true
1060
1077
  });
1061
1078
  } catch (unused) {
1062
1079
  return null;
@@ -1167,7 +1184,9 @@ export var useMarkdownToReact = function useMarkdownToReact(content, options) {
1167
1184
  var isLast = i === blocks.length - 1;
1168
1185
  // 用 index + 内容前 64 字符作 key,保持稳定性:
1169
1186
  // 相同位置 + 相同内容开头 → 相同 key → React 不 unmount
1170
- var stableKey = "b".concat(i, "-").concat(block.slice(0, 64));
1187
+ // 流式场景下,最后一个块内容频繁变化,若 key 随内容变会导致反复 unmount/remount,
1188
+ // ChartBlockRenderer 等会重复展示 Loading,故对末块使用稳定 key
1189
+ var stableKey = isLast && (options === null || options === void 0 ? void 0 : options.streaming) ? "b".concat(i, "-last") : "b".concat(i, "-").concat(block.slice(0, 64));
1171
1190
  if (!isLast) {
1172
1191
  var cached = cache.get(block);
1173
1192
  if (cached && cached.source === block) {
@@ -1232,7 +1251,8 @@ export var useMarkdownToReact = function useMarkdownToReact(content, options) {
1232
1251
  Fragment: Fragment,
1233
1252
  jsx: jsx,
1234
1253
  jsxs: jsxs,
1235
- components: allComponents
1254
+ components: allComponents,
1255
+ passNode: true
1236
1256
  });
1237
1257
  } catch (error) {
1238
1258
  console.error('Failed to render markdown:', error);
@@ -194,8 +194,8 @@ import { useStyle } from "./style";
194
194
  return gradient;
195
195
  },
196
196
  pointBackgroundColor: resolvedColor,
197
- pointBorderColor: '#fff',
198
- pointBorderWidth: 1,
197
+ pointBorderColor: isLight ? '#fff' : resolvedColor,
198
+ pointBorderWidth: isLight ? 1 : 0,
199
199
  borderWidth: 3,
200
200
  tension: 0,
201
201
  fill: true
@@ -209,7 +209,8 @@ import { useStyle } from "./style";
209
209
  filteredData,
210
210
  types,
211
211
  xValues,
212
- color
212
+ color,
213
+ isLight
213
214
  ]);
214
215
  var options = {
215
216
  responsive: true,
@@ -120,7 +120,8 @@ 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 { extractAndSortXValues, findDataPointByXValue, hexToRgba, resolveCssVariable } from "../utils";
123
+ import { extractAndSortXValues, findDataPointByXValue, hexToRgba, resolveCssVariable, toNumber } from "../utils";
124
+ import { useChartTheme } from "../hooks";
124
125
  import { useStyle } from "./style";
125
126
  /**
126
127
  * @fileoverview 柱状图组件文件
@@ -279,7 +280,7 @@ var BarChart = function BarChart(param) {
279
280
  // 是否是正负柱图(同一批次同时存在正值与负值)
280
281
  var hasPositive = useMemo(function() {
281
282
  return filteredData.some(function(item) {
282
- var v = typeof item.y === 'number' ? item.y : Number(item.y);
283
+ var v = typeof item.y === 'number' ? item.y : toNumber(item.y, Number.NaN);
283
284
  return Number.isFinite(v) && v > 0;
284
285
  });
285
286
  }, [
@@ -287,7 +288,7 @@ var BarChart = function BarChart(param) {
287
288
  ]);
288
289
  var hasNegative = useMemo(function() {
289
290
  return filteredData.some(function(item) {
290
- var v = typeof item.y === 'number' ? item.y : Number(item.y);
291
+ var v = typeof item.y === 'number' ? item.y : toNumber(item.y, Number.NaN);
291
292
  return Number.isFinite(v) && v < 0;
292
293
  });
293
294
  }, [
@@ -316,7 +317,7 @@ var BarChart = function BarChart(param) {
316
317
  var typeData = xValues.map(function(x) {
317
318
  var dataPoint = findDataPointByXValue(filteredData, x, type);
318
319
  var v = dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.y;
319
- var n = typeof v === 'number' ? v : Number(v);
320
+ var n = typeof v === 'number' ? v : toNumber(v, Number.NaN);
320
321
  return Number.isFinite(n) ? n : null;
321
322
  });
322
323
  return _object_spread_props(_object_spread({
@@ -511,9 +512,8 @@ var BarChart = function BarChart(param) {
511
512
  }, [
512
513
  filterLabels
513
514
  ]);
514
- var isLight = theme === 'light';
515
- var axisTextColor = isLight ? 'rgba(0, 25, 61, 0.3255)' : 'rgba(255, 255, 255, 0.8)';
516
- var gridColor = isLight ? 'rgba(0,0,0,0.08)' : 'rgba(255,255,255,0.2)';
515
+ // 使用 useChartTheme hook 获取主题相关颜色
516
+ var _useChartTheme = useChartTheme(theme), axisTextColor = _useChartTheme.axisTextColor, gridColor = _useChartTheme.gridColor, isLight = _useChartTheme.isLight;
517
517
  // 标签宽度计算函数
518
518
  var calculateLabelWidth = function calculateLabelWidth(text) {
519
519
  var fontSize = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 11;
@@ -537,7 +537,7 @@ var BarChart = function BarChart(param) {
537
537
  var maxWidth = 0;
538
538
  // 遍历所有数据点,计算标签文本的最大宽度
539
539
  filteredData.forEach(function(item) {
540
- var value = typeof item.y === 'number' ? item.y : Number(item.y);
540
+ var value = typeof item.y === 'number' ? item.y : toNumber(item.y, Number.NaN);
541
541
  if (Number.isFinite(value)) {
542
542
  var labelText = '';
543
543
  if (dataLabelFormatter) {
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import { ChartContainerProps } from '../components';
3
+ import { StatisticConfigType } from '../hooks/useChartStatistic';
4
+ import type { ChartClassNames, ChartStyles } from '../types/classNames';
5
+ /**
6
+ * 箱线图数据项接口
7
+ *
8
+ * 传入原始数据数组,组件自动计算统计值
9
+ */
10
+ export interface BoxPlotChartDataItem {
11
+ /** X轴标签 */
12
+ label: string;
13
+ /** 原始数据值数组 */
14
+ values: number[];
15
+ /** 数据系列(用于分组显示) */
16
+ type?: string;
17
+ /** 分类(用于筛选) */
18
+ category?: string;
19
+ /** 筛选标签 */
20
+ filterLabel?: string;
21
+ }
22
+ export interface BoxPlotChartProps extends ChartContainerProps {
23
+ /** 扁平化数据数组 */
24
+ data: BoxPlotChartDataItem[];
25
+ /** 图表标题 */
26
+ title?: string;
27
+ /** 图表宽度,默认600px */
28
+ width?: number | string;
29
+ /** 图表高度,默认400px */
30
+ height?: number | string;
31
+ /** 自定义CSS类名 */
32
+ className?: string;
33
+ /** 自定义CSS类名(支持对象格式,为每层DOM设置类名) */
34
+ classNames?: ChartClassNames;
35
+ /** 数据时间 */
36
+ dataTime?: string;
37
+ /** 图表主题 */
38
+ theme?: 'dark' | 'light';
39
+ /** 自定义主色 */
40
+ color?: string | string[];
41
+ /** 是否显示图例,默认true */
42
+ showLegend?: boolean;
43
+ /** 图例位置 */
44
+ legendPosition?: 'top' | 'left' | 'bottom' | 'right';
45
+ /** 是否显示网格线,默认true */
46
+ showGrid?: boolean;
47
+ /** X轴标签 */
48
+ xAxisLabel?: string;
49
+ /** Y轴标签 */
50
+ yAxisLabel?: string;
51
+ /** 是否显示异常点 */
52
+ showOutliers?: boolean;
53
+ /** 头部工具条额外按钮 */
54
+ toolbarExtra?: React.ReactNode;
55
+ /** 是否将过滤器渲染到工具栏 */
56
+ renderFilterInToolbar?: boolean;
57
+ /** ChartStatistic组件配置 */
58
+ statistic?: StatisticConfigType;
59
+ /** 是否显示加载状态 */
60
+ loading?: boolean;
61
+ /** 自定义样式对象 */
62
+ styles?: ChartStyles;
63
+ }
64
+ declare const BoxPlotChart: React.FC<BoxPlotChartProps>;
65
+ export default BoxPlotChart;