@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.
- package/dist/Hooks/useLanguage.d.ts +3 -0
- package/dist/I18n/locales.d.ts +3 -0
- package/dist/I18n/locales.js +6 -0
- package/dist/MarkdownEditor/editor/parser/constants.d.ts +2 -1
- package/dist/MarkdownEditor/editor/parser/constants.js +86 -8
- package/dist/MarkdownEditor/editor/store.d.ts +1 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/components/ToolBarItem.js +6 -4
- package/dist/MarkdownRenderer/renderers/ChartRenderer.js +13 -4
- package/dist/MarkdownRenderer/useMarkdownToReact.js +35 -15
- package/dist/Plugins/chart/AreaChart/index.js +4 -3
- package/dist/Plugins/chart/BarChart/index.js +8 -8
- package/dist/Plugins/chart/BoxPlotChart/index.d.ts +65 -0
- package/dist/Plugins/chart/BoxPlotChart/index.js +665 -0
- package/dist/Plugins/chart/BoxPlotChart/style.d.ts +8 -0
- package/dist/Plugins/chart/BoxPlotChart/style.js +118 -0
- package/dist/Plugins/chart/ChartAttrToolBar/index.js +5 -16
- package/dist/Plugins/chart/ChartMark/Area.d.ts +2 -1
- package/dist/Plugins/chart/ChartMark/Area.js +5 -4
- package/dist/Plugins/chart/ChartMark/Bar.d.ts +2 -1
- package/dist/Plugins/chart/ChartMark/Bar.js +5 -4
- package/dist/Plugins/chart/ChartMark/Column.d.ts +2 -1
- package/dist/Plugins/chart/ChartMark/Column.js +5 -4
- package/dist/Plugins/chart/ChartMark/Line.d.ts +2 -1
- package/dist/Plugins/chart/ChartMark/Line.js +5 -4
- package/dist/Plugins/chart/ChartMark/Pie.d.ts +2 -1
- package/dist/Plugins/chart/ChartMark/Pie.js +5 -4
- package/dist/Plugins/chart/ChartRender.d.ts +1 -1
- package/dist/Plugins/chart/ChartRender.js +188 -12
- package/dist/Plugins/chart/DonutChart/Legend.d.ts +5 -3
- package/dist/Plugins/chart/DonutChart/Legend.js +30 -38
- package/dist/Plugins/chart/DonutChart/index.js +82 -23
- package/dist/Plugins/chart/DonutChart/plugins.d.ts +2 -2
- package/dist/Plugins/chart/DonutChart/plugins.js +5 -5
- package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
- package/dist/Plugins/chart/FunnelChart/index.js +24 -14
- package/dist/Plugins/chart/HistogramChart/index.d.ts +65 -0
- package/dist/Plugins/chart/HistogramChart/index.js +665 -0
- package/dist/Plugins/chart/HistogramChart/style.d.ts +8 -0
- package/dist/Plugins/chart/HistogramChart/style.js +118 -0
- package/dist/Plugins/chart/LineChart/index.js +4 -3
- package/dist/Plugins/chart/RadarChart/index.d.ts +2 -0
- package/dist/Plugins/chart/RadarChart/index.js +28 -26
- package/dist/Plugins/chart/ScatterChart/index.d.ts +2 -0
- package/dist/Plugins/chart/ScatterChart/index.js +43 -28
- package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +1 -0
- package/dist/Plugins/chart/components/ChartContainer/ChartContainer.js +14 -0
- package/dist/Plugins/chart/components/ChartContainer/ChartDarkAntdContext.d.ts +7 -0
- package/dist/Plugins/chart/components/ChartContainer/ChartDarkAntdContext.js +8 -0
- package/dist/Plugins/chart/components/ChartContainer/ChartErrorBoundary.d.ts +8 -2
- package/dist/Plugins/chart/components/ChartContainer/style.js +3 -3
- package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.d.ts +2 -0
- package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.js +23 -32
- package/dist/Plugins/chart/index.d.ts +4 -0
- package/dist/Plugins/chart/index.js +2 -0
- package/dist/Plugins/chart/loadChartRuntime.d.ts +4 -0
- package/dist/Plugins/chart/loadChartRuntime.js +5 -1
- package/dist/Plugins/chart/utils.d.ts +14 -0
- package/dist/Plugins/chart/utils.js +49 -2
- package/dist/Schema/SchemaEditor/index.js +12 -5
- package/package.json +7 -5
|
@@ -62,8 +62,10 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
62
62
|
}
|
|
63
63
|
return target;
|
|
64
64
|
}
|
|
65
|
+
import { ConfigProvider, theme as antdTheme } from "antd";
|
|
65
66
|
import classNames from "clsx";
|
|
66
67
|
import React from "react";
|
|
68
|
+
import { ChartDarkAntdProvidedContext, useChartDarkAntdProvided } from "./ChartDarkAntdContext";
|
|
67
69
|
import ChartErrorBoundary from "./ChartErrorBoundary";
|
|
68
70
|
import { useStyle } from "./style";
|
|
69
71
|
/**
|
|
@@ -134,6 +136,7 @@ import { useStyle } from "./style";
|
|
|
134
136
|
* - 统一的样式管理
|
|
135
137
|
* - 内置错误边界保护,防止图表错误影响整个应用
|
|
136
138
|
* - 错误边界默认启用,可通过配置禁用或自定义
|
|
139
|
+
* - `theme="dark"` 时在本容器内嵌套 Ant Design 暗色算法,工具栏/筛选等 antd 控件与画布暗色一致(嵌套容器不重复包裹)
|
|
137
140
|
*/ var ChartContainer = function ChartContainer(_0) {
|
|
138
141
|
var baseClassName = _0.baseClassName, className = _0.className, children = _0.children, style = _0.style, classNamesProp = _0.classNames, stylesProp = _0.styles, _0_theme = _0.theme, theme = _0_theme === void 0 ? 'light' : _0_theme, _0_variant = _0.variant, variant = _0_variant === void 0 ? 'default' : _0_variant, _0_isMobile = _0.isMobile, isMobile = _0_isMobile === void 0 ? false : _0_isMobile, _0_errorBoundary = _0.errorBoundary, errorBoundary = _0_errorBoundary === void 0 ? {
|
|
139
142
|
enabled: true
|
|
@@ -150,6 +153,8 @@ import { useStyle } from "./style";
|
|
|
150
153
|
"errorBoundary"
|
|
151
154
|
]);
|
|
152
155
|
var _useStyle = useStyle(baseClassName), wrapSSR = _useStyle.wrapSSR, hashId = _useStyle.hashId;
|
|
156
|
+
var ancestorDarkAntdProvided = useChartDarkAntdProvided();
|
|
157
|
+
var wrapDarkAntd = theme === 'dark' && !ancestorDarkAntdProvided;
|
|
153
158
|
// 构建动态类名
|
|
154
159
|
var combinedClassName = classNames(baseClassName, hashId, theme === 'light' && "".concat(baseClassName, "-light-theme"), theme === 'dark' && "".concat(baseClassName, "-dark-theme"), isMobile && "".concat(baseClassName, "-mobile"), !isMobile && "".concat(baseClassName, "-desktop"), variant === 'outline' && "".concat(baseClassName, "-outline"), variant === 'borderless' && "".concat(baseClassName, "-borderless"), className, classNamesProp === null || classNamesProp === void 0 ? void 0 : classNamesProp.root);
|
|
155
160
|
var combinedStyle = _object_spread({}, style, stylesProp === null || stylesProp === void 0 ? void 0 : stylesProp.root);
|
|
@@ -157,6 +162,15 @@ import { useStyle } from "./style";
|
|
|
157
162
|
className: combinedClassName,
|
|
158
163
|
style: combinedStyle
|
|
159
164
|
}, restProps), children);
|
|
165
|
+
if (wrapDarkAntd) {
|
|
166
|
+
containerContent = /*#__PURE__*/ React.createElement(ChartDarkAntdProvidedContext.Provider, {
|
|
167
|
+
value: true
|
|
168
|
+
}, /*#__PURE__*/ React.createElement(ConfigProvider, {
|
|
169
|
+
theme: {
|
|
170
|
+
algorithm: antdTheme.darkAlgorithm
|
|
171
|
+
}
|
|
172
|
+
}, containerContent));
|
|
173
|
+
}
|
|
160
174
|
// 如果启用了错误边界,则包装内容
|
|
161
175
|
if ((errorBoundary === null || errorBoundary === void 0 ? void 0 : errorBoundary.enabled) !== false) {
|
|
162
176
|
return wrapSSR(/*#__PURE__*/ React.createElement(ChartErrorBoundary, {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* 标记当前已在某层 ChartContainer 内为暗色图表挂载过 Ant Design 暗色 ConfigProvider,
|
|
4
|
+
* 嵌套 ChartContainer 不再重复包裹,避免多层 Provider。
|
|
5
|
+
*/
|
|
6
|
+
export declare const ChartDarkAntdProvidedContext: import("react").Context<boolean>;
|
|
7
|
+
export declare const useChartDarkAntdProvided: () => boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* 标记当前已在某层 ChartContainer 内为暗色图表挂载过 Ant Design 暗色 ConfigProvider,
|
|
4
|
+
* 嵌套 ChartContainer 不再重复包裹,避免多层 Provider。
|
|
5
|
+
*/ export var ChartDarkAntdProvidedContext = /*#__PURE__*/ createContext(false);
|
|
6
|
+
export var useChartDarkAntdProvided = function useChartDarkAntdProvided() {
|
|
7
|
+
return useContext(ChartDarkAntdProvidedContext);
|
|
8
|
+
};
|
|
@@ -72,6 +72,8 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
72
72
|
radarChart: string;
|
|
73
73
|
scatterChart: string;
|
|
74
74
|
funnelChart: string;
|
|
75
|
+
boxplotChart: string;
|
|
76
|
+
histogramChart: string;
|
|
75
77
|
configChart: string;
|
|
76
78
|
updateChart: string;
|
|
77
79
|
barChart: string;
|
|
@@ -104,7 +106,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
104
106
|
inProgressTask: string;
|
|
105
107
|
totalTimeUsed: string;
|
|
106
108
|
edit: string;
|
|
107
|
-
multipleKnowledgeBases: string;
|
|
109
|
+
multipleKnowledgeBases: string; /** 本轮错误是否已自动重试过,用于“自动重试一次” */
|
|
108
110
|
multipleTables: string;
|
|
109
111
|
multipleTools: string;
|
|
110
112
|
multipleData: string;
|
|
@@ -169,6 +171,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
169
171
|
runCode: string;
|
|
170
172
|
rerender: string;
|
|
171
173
|
download: string;
|
|
174
|
+
copyMarkdown: string;
|
|
172
175
|
dragToMove: string;
|
|
173
176
|
format: string;
|
|
174
177
|
removeLink: string;
|
|
@@ -462,6 +465,8 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
462
465
|
radarChart: string;
|
|
463
466
|
scatterChart: string;
|
|
464
467
|
funnelChart: string;
|
|
468
|
+
boxplotChart: string;
|
|
469
|
+
histogramChart: string;
|
|
465
470
|
configChart: string;
|
|
466
471
|
updateChart: string;
|
|
467
472
|
barChart: string;
|
|
@@ -494,7 +499,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
494
499
|
inProgressTask: string;
|
|
495
500
|
totalTimeUsed: string;
|
|
496
501
|
edit: string;
|
|
497
|
-
multipleKnowledgeBases: string;
|
|
502
|
+
multipleKnowledgeBases: string; /** 本轮错误是否已自动重试过,用于“自动重试一次” */
|
|
498
503
|
multipleTables: string;
|
|
499
504
|
multipleTools: string;
|
|
500
505
|
multipleData: string;
|
|
@@ -559,6 +564,7 @@ declare class ChartErrorBoundary extends React.Component<ChartErrorBoundaryProps
|
|
|
559
564
|
runCode: string;
|
|
560
565
|
rerender: string;
|
|
561
566
|
download: string;
|
|
567
|
+
copyMarkdown: string;
|
|
562
568
|
dragToMove: string;
|
|
563
569
|
format: string;
|
|
564
570
|
removeLink: string;
|
|
@@ -67,10 +67,10 @@ var genStyle = function genStyle(token) {
|
|
|
67
67
|
border: '1px solid #e8e8e8',
|
|
68
68
|
backgroundColor: '#fff'
|
|
69
69
|
},
|
|
70
|
-
//
|
|
70
|
+
// 深色主题:略浅于纯黑页面底,与雷达等图表的「卡片」层次一致
|
|
71
71
|
'&&-dark-theme': {
|
|
72
|
-
border: '
|
|
73
|
-
backgroundColor: '#
|
|
72
|
+
border: '1px solid rgba(255, 255, 255, 0.08)',
|
|
73
|
+
backgroundColor: '#1f1f1f'
|
|
74
74
|
},
|
|
75
75
|
// 移动端适配
|
|
76
76
|
'&&-mobile': {
|
|
@@ -51,8 +51,9 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
51
51
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
52
52
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
53
53
|
}
|
|
54
|
-
import { DownloadOutlined } from "@ant-design/icons";
|
|
54
|
+
import { CopyOutlined, DownloadOutlined } from "@ant-design/icons";
|
|
55
55
|
import { ConfigProvider, Tooltip } from "antd";
|
|
56
|
+
import clsx from "clsx";
|
|
56
57
|
import React, { useContext } from "react";
|
|
57
58
|
import { Loading } from "../../../../Components/Loading";
|
|
58
59
|
import { I18nContext } from "../../../../I18n";
|
|
@@ -81,9 +82,9 @@ import { useStyle } from "./style";
|
|
|
81
82
|
*
|
|
82
83
|
* @since 1.0.0
|
|
83
84
|
*/ var ChartToolBar = function ChartToolBar(param) {
|
|
84
|
-
var title = param.title, dataTime = param.dataTime, _param_className = param.className, className = _param_className === void 0 ? '' : _param_className, classNames = param.classNames, style = param.style, styles = param.styles, _param_theme = param.theme, theme = _param_theme === void 0 ? 'light' : _param_theme, onDownload = param.onDownload, extra = param.extra, filter = param.filter, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading;
|
|
85
|
+
var title = param.title, dataTime = param.dataTime, _param_className = param.className, className = _param_className === void 0 ? '' : _param_className, classNames = param.classNames, style = param.style, styles = param.styles, _param_theme = param.theme, theme = _param_theme === void 0 ? 'light' : _param_theme, onDownload = param.onDownload, onCopyMarkdown = param.onCopyMarkdown, extra = param.extra, filter = param.filter, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading;
|
|
85
86
|
var _Object;
|
|
86
|
-
var _i18n_locale, _i18n_locale1;
|
|
87
|
+
var _i18n_locale, _i18n_locale1, _i18n_locale2;
|
|
87
88
|
var getPrefixCls = useContext(ConfigProvider.ConfigContext).getPrefixCls;
|
|
88
89
|
var i18n = useContext(I18nContext);
|
|
89
90
|
var prefixCls = getPrefixCls('chart-toolbar');
|
|
@@ -93,16 +94,15 @@ import { useStyle } from "./style";
|
|
|
93
94
|
onDownload();
|
|
94
95
|
}
|
|
95
96
|
};
|
|
97
|
+
var handleCopyMarkdown = function handleCopyMarkdown() {
|
|
98
|
+
if (onCopyMarkdown) {
|
|
99
|
+
onCopyMarkdown();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
96
102
|
if (!title && !extra) {
|
|
97
103
|
return null;
|
|
98
104
|
}
|
|
99
|
-
var mergedClassName =
|
|
100
|
-
prefixCls,
|
|
101
|
-
"".concat(prefixCls, "-").concat(theme),
|
|
102
|
-
hashId,
|
|
103
|
-
className,
|
|
104
|
-
classNames
|
|
105
|
-
].filter(Boolean).join(' ');
|
|
105
|
+
var mergedClassName = clsx(prefixCls, "".concat(prefixCls, "-").concat(theme), hashId, className, classNames);
|
|
106
106
|
var mergedStyle = _object_spread({}, style, Array.isArray(styles) ? (_Object = Object).assign.apply(_Object, [
|
|
107
107
|
{}
|
|
108
108
|
].concat(_to_consumable_array(styles))) : styles || {});
|
|
@@ -110,10 +110,7 @@ import { useStyle } from "./style";
|
|
|
110
110
|
className: mergedClassName,
|
|
111
111
|
style: mergedStyle
|
|
112
112
|
}, /*#__PURE__*/ React.createElement("div", {
|
|
113
|
-
className:
|
|
114
|
-
"".concat(prefixCls, "-header-title"),
|
|
115
|
-
hashId
|
|
116
|
-
].filter(Boolean).join(' ')
|
|
113
|
+
className: clsx("".concat(prefixCls, "-header-title"), hashId)
|
|
117
114
|
}, title, loading && /*#__PURE__*/ React.createElement(Loading, {
|
|
118
115
|
style: {
|
|
119
116
|
fontSize: '14px',
|
|
@@ -121,28 +118,22 @@ import { useStyle } from "./style";
|
|
|
121
118
|
flexShrink: 0
|
|
122
119
|
}
|
|
123
120
|
})), /*#__PURE__*/ React.createElement("div", {
|
|
124
|
-
className:
|
|
125
|
-
"".concat(prefixCls, "-header-actions"),
|
|
126
|
-
hashId
|
|
127
|
-
].filter(Boolean).join(' ')
|
|
121
|
+
className: clsx("".concat(prefixCls, "-header-actions"), hashId)
|
|
128
122
|
}, dataTime ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(TimeIcon, {
|
|
129
|
-
className:
|
|
130
|
-
"".concat(prefixCls, "-time-icon"),
|
|
131
|
-
hashId
|
|
132
|
-
].filter(Boolean).join(' ')
|
|
123
|
+
className: clsx("".concat(prefixCls, "-time-icon"), hashId)
|
|
133
124
|
}), /*#__PURE__*/ React.createElement("span", {
|
|
134
|
-
className:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
},
|
|
125
|
+
className: clsx("".concat(prefixCls, "-data-time"), hashId)
|
|
126
|
+
}, (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.dataTime) || '数据时间', ": ", dataTime)) : null, filter, extra, onCopyMarkdown ? /*#__PURE__*/ React.createElement(Tooltip, {
|
|
127
|
+
mouseEnterDelay: 0.3,
|
|
128
|
+
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale1 = i18n.locale) === null || _i18n_locale1 === void 0 ? void 0 : _i18n_locale1.copyMarkdown) || '复制表格'
|
|
129
|
+
}, /*#__PURE__*/ React.createElement(CopyOutlined, {
|
|
130
|
+
className: clsx("".concat(prefixCls, "-copy-btn"), hashId),
|
|
131
|
+
onClick: handleCopyMarkdown
|
|
132
|
+
})) : null, onDownload ? /*#__PURE__*/ React.createElement(Tooltip, {
|
|
139
133
|
mouseEnterDelay: 0.3,
|
|
140
|
-
title: (i18n === null || i18n === void 0 ? void 0 : (
|
|
134
|
+
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale2 = i18n.locale) === null || _i18n_locale2 === void 0 ? void 0 : _i18n_locale2.download) || '下载'
|
|
141
135
|
}, /*#__PURE__*/ React.createElement(DownloadOutlined, {
|
|
142
|
-
className:
|
|
143
|
-
"".concat(prefixCls, "-download-btn"),
|
|
144
|
-
hashId
|
|
145
|
-
].filter(Boolean).join(' '),
|
|
136
|
+
className: clsx("".concat(prefixCls, "-download-btn"), hashId),
|
|
146
137
|
onClick: handleDownload
|
|
147
138
|
})) : null)));
|
|
148
139
|
};
|
|
@@ -19,17 +19,21 @@ export * from './ChartMark';
|
|
|
19
19
|
export { ChartRender } from './ChartRender';
|
|
20
20
|
export { default as AreaChart } from './AreaChart';
|
|
21
21
|
export { default as BarChart } from './BarChart';
|
|
22
|
+
export { default as BoxPlotChart } from './BoxPlotChart';
|
|
22
23
|
export { default as ChartStatistic } from './ChartStatistic';
|
|
23
24
|
export { default as DonutChart } from './DonutChart';
|
|
24
25
|
export { default as FunnelChart } from './FunnelChart';
|
|
26
|
+
export { default as HistogramChart } from './HistogramChart';
|
|
25
27
|
export { default as LineChart } from './LineChart';
|
|
26
28
|
export { default as RadarChart } from './RadarChart';
|
|
27
29
|
export { default as ScatterChart } from './ScatterChart';
|
|
28
30
|
export type { AreaChartConfigItem, AreaChartDataItem, AreaChartProps, } from './AreaChart';
|
|
29
31
|
export type { BarChartConfigItem, BarChartDataItem, BarChartProps, } from './BarChart';
|
|
32
|
+
export type { BoxPlotChartDataItem, BoxPlotChartProps, } from './BoxPlotChart';
|
|
30
33
|
export type { ChartStatisticClassNames, ChartStatisticProps, ChartStatisticStyles, } from './ChartStatistic';
|
|
31
34
|
export type { DonutChartConfig, DonutChartData, DonutChartProps, } from './DonutChart';
|
|
32
35
|
export type { FunnelChartDataItem, FunnelChartProps } from './FunnelChart';
|
|
36
|
+
export type { HistogramChartDataItem, HistogramChartProps, } from './HistogramChart';
|
|
33
37
|
export type { LineChartConfigItem, LineChartDataItem, LineChartProps, } from './LineChart';
|
|
34
38
|
export type { RadarChartDataItem } from './RadarChart';
|
|
35
39
|
export type { ScatterChartDataItem, ScatterChartProps } from './ScatterChart';
|
|
@@ -169,9 +169,11 @@ export { ChartRender } from "./ChartRender";
|
|
|
169
169
|
// 图表组件导出
|
|
170
170
|
export { default as AreaChart } from "./AreaChart";
|
|
171
171
|
export { default as BarChart } from "./BarChart";
|
|
172
|
+
export { default as BoxPlotChart } from "./BoxPlotChart";
|
|
172
173
|
export { default as ChartStatistic } from "./ChartStatistic";
|
|
173
174
|
export { default as DonutChart } from "./DonutChart";
|
|
174
175
|
export { default as FunnelChart } from "./FunnelChart";
|
|
176
|
+
export { default as HistogramChart } from "./HistogramChart";
|
|
175
177
|
export { default as LineChart } from "./LineChart";
|
|
176
178
|
export { default as RadarChart } from "./RadarChart";
|
|
177
179
|
export { default as ScatterChart } from "./ScatterChart";
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
type AreaChartComponent = typeof import('./AreaChart').default;
|
|
2
2
|
type BarChartComponent = typeof import('./BarChart').default;
|
|
3
|
+
type BoxPlotChartComponent = typeof import('./BoxPlotChart').default;
|
|
3
4
|
type DonutChartComponent = typeof import('./DonutChart').default;
|
|
4
5
|
type FunnelChartComponent = typeof import('./FunnelChart').default;
|
|
6
|
+
type HistogramChartComponent = typeof import('./HistogramChart').default;
|
|
5
7
|
type LineChartComponent = typeof import('./LineChart').default;
|
|
6
8
|
type RadarChartComponent = typeof import('./RadarChart').default;
|
|
7
9
|
type ScatterChartComponent = typeof import('./ScatterChart').default;
|
|
8
10
|
export interface ChartRuntime {
|
|
9
11
|
AreaChart: AreaChartComponent;
|
|
10
12
|
BarChart: BarChartComponent;
|
|
13
|
+
BoxPlotChart: BoxPlotChartComponent;
|
|
11
14
|
DonutChart: DonutChartComponent;
|
|
12
15
|
FunnelChart: FunnelChartComponent;
|
|
16
|
+
HistogramChart: HistogramChartComponent;
|
|
13
17
|
LineChart: LineChartComponent;
|
|
14
18
|
RadarChart: RadarChartComponent;
|
|
15
19
|
ScatterChart: ScatterChartComponent;
|
|
@@ -184,18 +184,22 @@ export var loadChartRuntime = function loadChartRuntime() {
|
|
|
184
184
|
runtimeLoader = Promise.all([
|
|
185
185
|
import(/* webpackChunkName: "chart-area" */ "./AreaChart"),
|
|
186
186
|
import(/* webpackChunkName: "chart-bar" */ "./BarChart"),
|
|
187
|
+
import(/* webpackChunkName: "chart-boxplot" */ "./BoxPlotChart"),
|
|
187
188
|
import(/* webpackChunkName: "chart-donut" */ "./DonutChart"),
|
|
188
189
|
import(/* webpackChunkName: "chart-funnel" */ "./FunnelChart"),
|
|
190
|
+
import(/* webpackChunkName: "chart-histogram" */ "./HistogramChart"),
|
|
189
191
|
import(/* webpackChunkName: "chart-line" */ "./LineChart"),
|
|
190
192
|
import(/* webpackChunkName: "chart-radar" */ "./RadarChart"),
|
|
191
193
|
import(/* webpackChunkName: "chart-scatter" */ "./ScatterChart")
|
|
192
194
|
]).then(function(param) {
|
|
193
|
-
var _param = _sliced_to_array(param,
|
|
195
|
+
var _param = _sliced_to_array(param, 9), areaModule = _param[0], barModule = _param[1], boxplotModule = _param[2], donutModule = _param[3], funnelModule = _param[4], histogramModule = _param[5], lineModule = _param[6], radarModule = _param[7], scatterModule = _param[8];
|
|
194
196
|
return {
|
|
195
197
|
AreaChart: areaModule.default,
|
|
196
198
|
BarChart: barModule.default,
|
|
199
|
+
BoxPlotChart: boxplotModule.default,
|
|
197
200
|
DonutChart: donutModule.default,
|
|
198
201
|
FunnelChart: funnelModule.default,
|
|
202
|
+
HistogramChart: histogramModule.default,
|
|
199
203
|
LineChart: lineModule.default,
|
|
200
204
|
RadarChart: radarModule.default,
|
|
201
205
|
ScatterChart: scatterModule.default
|
|
@@ -85,6 +85,19 @@ export interface ChartDataItem {
|
|
|
85
85
|
/** 筛选标签,用于数据筛选和过滤 */
|
|
86
86
|
filterLabel?: string;
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* 将含「亿元 / 万元 / 元」的人民币口语字符串转为数值(以「元」为数值单位)。
|
|
90
|
+
*
|
|
91
|
+
* - `533亿元` → `533 * 1e8`
|
|
92
|
+
* - `549万元` → `549 * 1e4`
|
|
93
|
+
* - `128.5元` → `128.5`
|
|
94
|
+
*
|
|
95
|
+
* 不含上述单位且无法识别为纯数字时返回 `null`,避免误解析如 `8%`。
|
|
96
|
+
*
|
|
97
|
+
* @param value - 原始单元格或字段值
|
|
98
|
+
* @returns 解析后的有限数字,无法解析则为 `null`
|
|
99
|
+
*/
|
|
100
|
+
export declare const parseChineseCurrencyToNumber: (value: unknown) => number | null;
|
|
88
101
|
/**
|
|
89
102
|
* 归一化 X 轴值
|
|
90
103
|
*
|
|
@@ -209,6 +222,7 @@ export declare const findDataPointByXValue: (data: ChartDataItem[], xValue: numb
|
|
|
209
222
|
*
|
|
210
223
|
* 安全地将任意值转换为数字类型,转换失败时返回默认值。
|
|
211
224
|
* 如果输入已经是有效的数字,直接返回;否则尝试转换。
|
|
225
|
+
* 字符串支持「亿元 / 万元 / 元」等人民币口语格式(见 `parseChineseCurrencyToNumber`)。
|
|
212
226
|
*
|
|
213
227
|
* @param {any} val - 要转换的值
|
|
214
228
|
* @param {number} fallback - 转换失败时的默认值
|
|
@@ -114,6 +114,45 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
114
114
|
};
|
|
115
115
|
return fn;
|
|
116
116
|
}
|
|
117
|
+
/** 1 亿(人民币口语单位)对应的「元」数量 */ var CHINESE_YI_TO_YUAN = 1e8;
|
|
118
|
+
/** 1 万对应的「元」数量 */ var CHINESE_WAN_TO_YUAN = 1e4;
|
|
119
|
+
/**
|
|
120
|
+
* 将含「亿元 / 万元 / 元」的人民币口语字符串转为数值(以「元」为数值单位)。
|
|
121
|
+
*
|
|
122
|
+
* - `533亿元` → `533 * 1e8`
|
|
123
|
+
* - `549万元` → `549 * 1e4`
|
|
124
|
+
* - `128.5元` → `128.5`
|
|
125
|
+
*
|
|
126
|
+
* 不含上述单位且无法识别为纯数字时返回 `null`,避免误解析如 `8%`。
|
|
127
|
+
*
|
|
128
|
+
* @param value - 原始单元格或字段值
|
|
129
|
+
* @returns 解析后的有限数字,无法解析则为 `null`
|
|
130
|
+
*/ export var parseChineseCurrencyToNumber = function parseChineseCurrencyToNumber(value) {
|
|
131
|
+
if (value === null || value === undefined) return null;
|
|
132
|
+
if (typeof value === 'number') {
|
|
133
|
+
return Number.isFinite(value) ? value : null;
|
|
134
|
+
}
|
|
135
|
+
if (typeof value !== 'string') return null;
|
|
136
|
+
var s = value.trim();
|
|
137
|
+
if (!s) return null;
|
|
138
|
+
s = s.replace(/,/g, '').replace(/,/g, '').replace(/[¥¥\s]/g, '');
|
|
139
|
+
var yi = s.match(/(-?\d+(?:\.\d+)?)\s*亿/);
|
|
140
|
+
if (yi) {
|
|
141
|
+
var n = parseFloat(yi[1]);
|
|
142
|
+
return Number.isFinite(n) ? n * CHINESE_YI_TO_YUAN : null;
|
|
143
|
+
}
|
|
144
|
+
var wan = s.match(/(-?\d+(?:\.\d+)?)\s*万/);
|
|
145
|
+
if (wan) {
|
|
146
|
+
var n1 = parseFloat(wan[1]);
|
|
147
|
+
return Number.isFinite(n1) ? n1 * CHINESE_WAN_TO_YUAN : null;
|
|
148
|
+
}
|
|
149
|
+
var yuan = s.match(/(-?\d+(?:\.\d+)?)\s*元/);
|
|
150
|
+
if (yuan) {
|
|
151
|
+
var n2 = parseFloat(yuan[1]);
|
|
152
|
+
return Number.isFinite(n2) ? n2 : null;
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
};
|
|
117
156
|
/**
|
|
118
157
|
* 归一化 X 轴值
|
|
119
158
|
*
|
|
@@ -138,7 +177,9 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
138
177
|
var s = String(value).trim();
|
|
139
178
|
if (s === '') return value;
|
|
140
179
|
var n = Number(s);
|
|
141
|
-
|
|
180
|
+
if (Number.isFinite(n)) return n;
|
|
181
|
+
var cn = parseChineseCurrencyToNumber(s);
|
|
182
|
+
return cn !== null ? cn : value;
|
|
142
183
|
};
|
|
143
184
|
/**
|
|
144
185
|
* 比较两个 X 轴值的大小
|
|
@@ -283,6 +324,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
283
324
|
*
|
|
284
325
|
* 安全地将任意值转换为数字类型,转换失败时返回默认值。
|
|
285
326
|
* 如果输入已经是有效的数字,直接返回;否则尝试转换。
|
|
327
|
+
* 字符串支持「亿元 / 万元 / 元」等人民币口语格式(见 `parseChineseCurrencyToNumber`)。
|
|
286
328
|
*
|
|
287
329
|
* @param {any} val - 要转换的值
|
|
288
330
|
* @param {number} fallback - 转换失败时的默认值
|
|
@@ -300,7 +342,12 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
300
342
|
*/ export var toNumber = function toNumber(val, fallback) {
|
|
301
343
|
if (typeof val === 'number' && !Number.isNaN(val)) return val;
|
|
302
344
|
var n = Number(val);
|
|
303
|
-
|
|
345
|
+
if (Number.isFinite(n)) return n;
|
|
346
|
+
if (typeof val === 'string') {
|
|
347
|
+
var cn = parseChineseCurrencyToNumber(val);
|
|
348
|
+
if (cn !== null && Number.isFinite(cn)) return cn;
|
|
349
|
+
}
|
|
350
|
+
return fallback;
|
|
304
351
|
};
|
|
305
352
|
/**
|
|
306
353
|
* 检查值是否不为空
|
|
@@ -104,7 +104,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
104
104
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
105
105
|
}
|
|
106
106
|
import { CircleDashed, Copy, Play } from "@sofa-design/icons";
|
|
107
|
-
import { Button, ConfigProvider } from "antd";
|
|
107
|
+
import { Button, ConfigProvider, message } from "antd";
|
|
108
108
|
import classNames from "clsx";
|
|
109
109
|
import copy from "copy-to-clipboard";
|
|
110
110
|
import React, { forwardRef, memo, useCallback, useContext, useImperativeHandle, useMemo, useState } from "react";
|
|
@@ -241,13 +241,20 @@ import { useStyle } from "./style";
|
|
|
241
241
|
setIsSchemaRendered(true);
|
|
242
242
|
}, []);
|
|
243
243
|
// 复制函数
|
|
244
|
-
var handleCopyContent = useCallback(function(content) {
|
|
244
|
+
var handleCopyContent = useCallback(function(content, type) {
|
|
245
245
|
if (!content || !content.trim()) {
|
|
246
|
+
message.warning(locale['schemaEditor.noContentToCopy']);
|
|
246
247
|
return;
|
|
247
248
|
}
|
|
248
249
|
try {
|
|
249
|
-
copy(content);
|
|
250
|
+
var ok = copy(content);
|
|
251
|
+
if (ok) {
|
|
252
|
+
message.success("".concat(type === 'html' ? 'HTML' : 'JSON').concat(locale['schemaEditor.copySuccess']));
|
|
253
|
+
} else {
|
|
254
|
+
message.error(locale['schemaEditor.copyFailed']);
|
|
255
|
+
}
|
|
250
256
|
} catch (error) {
|
|
257
|
+
message.error(locale['schemaEditor.copyFailed']);
|
|
251
258
|
console.error(locale['schemaEditor.copyFailed'], error);
|
|
252
259
|
}
|
|
253
260
|
}, [
|
|
@@ -255,14 +262,14 @@ import { useStyle } from "./style";
|
|
|
255
262
|
]);
|
|
256
263
|
// 处理复制HTML内容
|
|
257
264
|
var handleCopyHtml = useCallback(function() {
|
|
258
|
-
handleCopyContent(htmlContent);
|
|
265
|
+
handleCopyContent(htmlContent, 'html');
|
|
259
266
|
}, [
|
|
260
267
|
htmlContent,
|
|
261
268
|
handleCopyContent
|
|
262
269
|
]);
|
|
263
270
|
// 处理复制JSON内容
|
|
264
271
|
var handleCopyJson = useCallback(function() {
|
|
265
|
-
handleCopyContent(schemaString);
|
|
272
|
+
handleCopyContent(schemaString, 'json');
|
|
266
273
|
}, [
|
|
267
274
|
schemaString,
|
|
268
275
|
handleCopyContent
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ant-design/agentic-ui",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.3",
|
|
4
4
|
"description": "面向智能体的 UI 组件库,提供多步推理可视化、工具调用展示、任务执行协同等 Agentic UI 能力",
|
|
5
5
|
"repository": "git@github.com:ant-design/agentic-ui.git",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@juggle/resize-observer": "^3.4.0",
|
|
66
66
|
"@react-three/fiber": "^8.18.0",
|
|
67
67
|
"@schema-element-editor/host-sdk": "^2.2.1",
|
|
68
|
+
"@sgratzl/chartjs-chart-boxplot": "^4.4.5",
|
|
68
69
|
"@sofa-design/icons": "^1.6.2",
|
|
69
70
|
"@types/three": "^0.182.0",
|
|
70
71
|
"ace-builds": "^1.43.6",
|
|
@@ -152,9 +153,9 @@
|
|
|
152
153
|
"@types/styled-components": "^5.1.36",
|
|
153
154
|
"@types/uuid": "^10.0.0",
|
|
154
155
|
"@umijs/lint": "^4.6.25",
|
|
155
|
-
"@vitejs/plugin-react": "^
|
|
156
|
-
"@vitest/coverage-istanbul": "^
|
|
157
|
-
"@vitest/ui": "
|
|
156
|
+
"@vitejs/plugin-react": "^5.2.0",
|
|
157
|
+
"@vitest/coverage-istanbul": "^4.1.0",
|
|
158
|
+
"@vitest/ui": "^4.1.0",
|
|
158
159
|
"cross-env": "^7.0.3",
|
|
159
160
|
"dumi": "^2.4.21",
|
|
160
161
|
"dumi-theme-antd-style": "^0.31.1",
|
|
@@ -178,7 +179,8 @@
|
|
|
178
179
|
"sast": "^0.8.1",
|
|
179
180
|
"stylelint": "^14.16.1",
|
|
180
181
|
"typescript": "^5.9.3",
|
|
181
|
-
"
|
|
182
|
+
"vite": "^6.4.1",
|
|
183
|
+
"vitest": "^4.1.0"
|
|
182
184
|
},
|
|
183
185
|
"peerDependencies": {
|
|
184
186
|
"react": ">=16.9.0",
|