@ant-design/agentic-ui 2.0.15 → 2.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Bubble/AIBubble.js +3 -0
- package/dist/Bubble/MessagesContent/MarkdownPreview.js +3 -1
- package/dist/Bubble/style.js +4 -1
- package/dist/History/index.js +7 -2
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +11 -8
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +16 -12
- package/dist/MarkdownEditor/editor/utils/dom.d.ts +1 -1
- package/dist/MarkdownEditor/editor/utils/index.d.ts +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/style.js +9 -8
- package/dist/MarkdownInputField/AttachmentButton/index.d.ts +2 -0
- package/dist/MarkdownInputField/AttachmentButton/style.js +3 -3
- package/dist/MarkdownInputField/Enlargement/index.js +9 -29
- package/dist/MarkdownInputField/FileMapView/FileMapViewItem.js +30 -27
- package/dist/MarkdownInputField/FileMapView/index.d.ts +4 -4
- package/dist/MarkdownInputField/FileMapView/index.js +20 -13
- package/dist/MarkdownInputField/FileUploadManager/index.js +2 -2
- package/dist/MarkdownInputField/MarkdownInputField.d.ts +9 -19
- package/dist/MarkdownInputField/MarkdownInputField.js +154 -191
- package/dist/MarkdownInputField/RefinePromptButton/index.js +8 -53
- package/dist/MarkdownInputField/style.js +40 -45
- package/dist/Plugins/chart/AreaChart/index.d.ts +2 -2
- package/dist/Plugins/chart/AreaChart/index.js +9 -29
- package/dist/Plugins/chart/BarChart/index.d.ts +8 -8
- package/dist/Plugins/chart/BarChart/index.js +9 -8
- package/dist/Plugins/chart/DonutChart/constants.d.ts +0 -1
- package/dist/Plugins/chart/DonutChart/constants.js +0 -14
- package/dist/Plugins/chart/DonutChart/index.js +51 -16
- package/dist/Plugins/chart/DonutChart/style.js +7 -0
- package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
- package/dist/Plugins/chart/FunnelChart/index.d.ts +8 -8
- package/dist/Plugins/chart/FunnelChart/index.js +85 -66
- package/dist/Plugins/chart/FunnelChart/style.js +12 -0
- package/dist/Plugins/chart/LineChart/index.d.ts +2 -2
- package/dist/Plugins/chart/LineChart/index.js +16 -19
- package/dist/Plugins/chart/RadarChart/index.d.ts +11 -5
- package/dist/Plugins/chart/RadarChart/index.js +35 -50
- package/dist/Plugins/chart/RadarChart/style.js +8 -0
- package/dist/Plugins/chart/ScatterChart/index.d.ts +23 -6
- package/dist/Plugins/chart/ScatterChart/index.js +58 -57
- package/dist/Plugins/chart/ScatterChart/style.js +8 -0
- package/dist/Plugins/chart/components/ChartContainer/style.js +7 -1
- package/dist/Plugins/chart/hooks/useChartStatistic.d.ts +0 -6
- package/dist/Plugins/chart/hooks/useChartStatistic.js +0 -16
- package/dist/Workspace/File/PreviewComponent.js +3 -2
- package/dist/Workspace/File/style.js +2 -1
- package/dist/Workspace/RealtimeFollow/style.js +1 -6
- package/dist/Workspace/style.js +2 -1
- package/package.json +1 -1
- package/dist/MarkdownInputField/Enlargement/style.d.ts +0 -10
- package/dist/MarkdownInputField/Enlargement/style.js +0 -75
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
} from "../Hooks/useStyle";
|
|
27
27
|
var GLOW_BORDER_OFFSET = 2;
|
|
28
28
|
var GLOW_BORDER_TOTAL_OFFSET = GLOW_BORDER_OFFSET * 2;
|
|
29
|
-
var getGlowBorderOffset = () => `-${GLOW_BORDER_OFFSET}px`;
|
|
30
29
|
var DIRECT_RETURN_KEYWORDS = /* @__PURE__ */ new Set([
|
|
31
30
|
"auto",
|
|
32
31
|
"inherit",
|
|
@@ -66,13 +65,28 @@ var stopIconRotate = new Keyframes("stopIconRotate", {
|
|
|
66
65
|
transform: "rotate(360deg)"
|
|
67
66
|
}
|
|
68
67
|
});
|
|
68
|
+
var rotateFadeOnce = new Keyframes("rotateFadeOnce", {
|
|
69
|
+
"0%": {
|
|
70
|
+
"--mif-angle": "42deg",
|
|
71
|
+
opacity: 1
|
|
72
|
+
},
|
|
73
|
+
"100%": {
|
|
74
|
+
"--mif-angle": "calc(42deg + 1turn)",
|
|
75
|
+
opacity: 0
|
|
76
|
+
}
|
|
77
|
+
});
|
|
69
78
|
var genStyle = (token) => {
|
|
70
79
|
return {
|
|
80
|
+
// 声明 CSS 自定义属性 --mif-angle,使其可动画(需浏览器支持 @property)
|
|
81
|
+
"@property --mif-angle": {
|
|
82
|
+
syntax: '"<angle>"',
|
|
83
|
+
"initial-value": "0deg",
|
|
84
|
+
inherits: false
|
|
85
|
+
},
|
|
71
86
|
[token.componentCls]: {
|
|
72
87
|
width: "100%",
|
|
73
88
|
height: "100%",
|
|
74
89
|
display: "flex",
|
|
75
|
-
boxShadow: `0px 0px 1px 0px rgba(0, 19, 41, 0.05),0px 2px 7px 0px rgba(0, 19, 41, 0.05),0px 2px 5px -2px rgba(0, 19, 41, 0.06)`,
|
|
76
90
|
flexDirection: "column",
|
|
77
91
|
alignItems: "center",
|
|
78
92
|
justifyContent: "center",
|
|
@@ -81,40 +95,24 @@ var genStyle = (token) => {
|
|
|
81
95
|
minHeight: "48px",
|
|
82
96
|
maxWidth: 980,
|
|
83
97
|
backdropFilter: "blur(5.44px)",
|
|
98
|
+
boxShadow: "var(--shadow-control-lg)",
|
|
84
99
|
position: "relative",
|
|
85
|
-
transition: "all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)",
|
|
86
100
|
"> * ": {
|
|
87
101
|
boxSizing: "border-box"
|
|
88
102
|
},
|
|
89
103
|
"&:active,&.active": {
|
|
90
104
|
[`${token.componentCls}-background`]: {
|
|
91
|
-
opacity:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
105
|
+
opacity: 0,
|
|
106
|
+
height: "100%",
|
|
107
|
+
backgroundImage: "radial-gradient(127% 127% at 0% 0%, rgba(255, 255, 255, 0) 57%, #EEF0F5 84%),linear-gradient(var(--mif-angle), #D7B9FF 14%, #9BA0FF 57%, #09B1FF 98%)",
|
|
108
|
+
// 单一动画:一次性旋转并淡出
|
|
109
|
+
animationName: rotateFadeOnce,
|
|
110
|
+
animationDuration: "2.5s",
|
|
111
|
+
animationTimingFunction: "ease-in-out",
|
|
112
|
+
animationIterationCount: "1"
|
|
99
113
|
}
|
|
100
114
|
},
|
|
101
115
|
"&-enlarged": {
|
|
102
|
-
// 覆盖基础样式的限制
|
|
103
|
-
minHeight: "100%",
|
|
104
|
-
height: "100%",
|
|
105
|
-
width: "100%",
|
|
106
|
-
maxWidth: "none",
|
|
107
|
-
// 覆盖原来的 maxWidth: 980
|
|
108
|
-
alignItems: "stretch",
|
|
109
|
-
// 覆盖原来的 center
|
|
110
|
-
justifyContent: "flex-start",
|
|
111
|
-
// 覆盖原来的 center
|
|
112
|
-
display: "flex",
|
|
113
|
-
flexDirection: "column",
|
|
114
|
-
// 保持和普通状态相同的阴影效果
|
|
115
|
-
boxShadow: `0px 0px 1px 0px rgba(0, 19, 41, 0.05),0px 2px 7px 0px rgba(0, 19, 41, 0.05),0px 2px 5px -2px rgba(0, 19, 41, 0.06)`,
|
|
116
|
-
transition: "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
|
|
117
|
-
// 内部白色容器
|
|
118
116
|
"> div:last-child": {
|
|
119
117
|
flex: 1,
|
|
120
118
|
height: "100%",
|
|
@@ -127,8 +125,7 @@ var genStyle = (token) => {
|
|
|
127
125
|
minHeight: "100%",
|
|
128
126
|
maxHeight: "none",
|
|
129
127
|
overflow: "hidden",
|
|
130
|
-
width: "100%"
|
|
131
|
-
transition: "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)"
|
|
128
|
+
width: "100%"
|
|
132
129
|
},
|
|
133
130
|
[`${token.componentCls}-editor-content`]: {
|
|
134
131
|
flex: 1,
|
|
@@ -136,33 +133,33 @@ var genStyle = (token) => {
|
|
|
136
133
|
minHeight: "100%",
|
|
137
134
|
maxHeight: "none",
|
|
138
135
|
overflow: "auto",
|
|
139
|
-
width: "100%"
|
|
140
|
-
transition: "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)"
|
|
136
|
+
width: "100%"
|
|
141
137
|
},
|
|
142
138
|
[`${token.componentCls}-background`]: {
|
|
143
139
|
// 放大时保持和普通状态相同的背景效果
|
|
144
|
-
opacity: 1
|
|
145
|
-
backgroundColor: "rgba(0, 9, 50, 0.1)"
|
|
140
|
+
opacity: 1
|
|
146
141
|
}
|
|
147
142
|
},
|
|
148
143
|
"&-background": {
|
|
149
144
|
boxSizing: "border-box",
|
|
150
|
-
transition: "all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1)",
|
|
151
145
|
position: "absolute",
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
width: addGlowBorderOffset("100%"),
|
|
155
|
-
height: addGlowBorderOffset("100%"),
|
|
146
|
+
width: "calc(100% - 4px)",
|
|
147
|
+
height: "calc(100% - 4px)",
|
|
156
148
|
zIndex: 2,
|
|
157
|
-
backgroundColor: "
|
|
149
|
+
backgroundColor: "transparent",
|
|
158
150
|
pointerEvents: "none",
|
|
159
|
-
borderRadius: "inherit"
|
|
151
|
+
borderRadius: "inherit",
|
|
152
|
+
// 自定义属性控制线性渐变角度,默认与原始设计保持一致 42deg
|
|
153
|
+
"--mif-angle": "42deg",
|
|
154
|
+
// 提示浏览器该节点将频繁重绘背景图像
|
|
155
|
+
willChange: "background-image",
|
|
156
|
+
// 限定绘制范围,降低重绘影响
|
|
157
|
+
contain: "paint"
|
|
160
158
|
},
|
|
161
159
|
"&:focus": {
|
|
162
160
|
boxShadow: "none",
|
|
163
161
|
[`${token.componentCls}-background`]: {
|
|
164
|
-
opacity: 1
|
|
165
|
-
backgroundColor: "#1890ff"
|
|
162
|
+
opacity: 1
|
|
166
163
|
}
|
|
167
164
|
},
|
|
168
165
|
"&-editor": {
|
|
@@ -176,7 +173,6 @@ var genStyle = (token) => {
|
|
|
176
173
|
overflowY: "visible",
|
|
177
174
|
scrollbarColor: "var(--color-gray-text-tertiary) transparent",
|
|
178
175
|
scrollbarWidth: "thin",
|
|
179
|
-
transition: "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)",
|
|
180
176
|
"&&-disabled": {
|
|
181
177
|
backgroundColor: "rgba(0,0,0,0.04)",
|
|
182
178
|
cursor: "not-allowed"
|
|
@@ -191,8 +187,7 @@ var genStyle = (token) => {
|
|
|
191
187
|
maxHeight: "inherit",
|
|
192
188
|
scrollbarColor: "var(--color-gray-text-tertiary) transparent",
|
|
193
189
|
scrollbarWidth: "thin",
|
|
194
|
-
borderRadius: "inherit"
|
|
195
|
-
transition: "all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1)"
|
|
190
|
+
borderRadius: "inherit"
|
|
196
191
|
},
|
|
197
192
|
"&&-disabled": {
|
|
198
193
|
backgroundColor: "rgba(0,0,0,0.04)",
|
|
@@ -91,10 +91,10 @@ export interface AreaChartConfigItem {
|
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
93
|
export interface AreaChartProps extends ChartContainerProps {
|
|
94
|
-
/** 图表标题 */
|
|
95
|
-
title?: string;
|
|
96
94
|
/** 扁平化数据数组 */
|
|
97
95
|
data: AreaChartDataItem[];
|
|
96
|
+
/** 图表标题 */
|
|
97
|
+
title?: string;
|
|
98
98
|
/** 图表宽度,默认600px */
|
|
99
99
|
width?: number | string;
|
|
100
100
|
/** 图表高度,默认400px */
|
|
@@ -39,9 +39,7 @@ import {
|
|
|
39
39
|
ChartToolBar,
|
|
40
40
|
downloadChart
|
|
41
41
|
} from "../components";
|
|
42
|
-
import {
|
|
43
|
-
useChartStatistic
|
|
44
|
-
} from "../hooks/useChartStatistic";
|
|
42
|
+
import { defaultColorList } from "../const";
|
|
45
43
|
import {
|
|
46
44
|
extractAndSortXValues,
|
|
47
45
|
findDataPointByXValue
|
|
@@ -55,28 +53,6 @@ ChartJS.register(
|
|
|
55
53
|
Tooltip,
|
|
56
54
|
Legend
|
|
57
55
|
);
|
|
58
|
-
var defaultColors = [
|
|
59
|
-
"#1677ff",
|
|
60
|
-
// 蓝色
|
|
61
|
-
"#8954FC",
|
|
62
|
-
// 紫色
|
|
63
|
-
"#15e7e4",
|
|
64
|
-
// 青色
|
|
65
|
-
"#F45BB5",
|
|
66
|
-
// 粉色
|
|
67
|
-
"#00A6FF",
|
|
68
|
-
// 天蓝色
|
|
69
|
-
"#33E59B",
|
|
70
|
-
// 绿色
|
|
71
|
-
"#D666E4",
|
|
72
|
-
// 紫红色
|
|
73
|
-
"#6151FF",
|
|
74
|
-
// 靛蓝色
|
|
75
|
-
"#BF3C93",
|
|
76
|
-
// 深粉色
|
|
77
|
-
"#005EE0"
|
|
78
|
-
// 深蓝色
|
|
79
|
-
];
|
|
80
56
|
var hexToRgba = (hex, alpha) => {
|
|
81
57
|
const sanitized = hex.replace("#", "");
|
|
82
58
|
const isShort = sanitized.length === 3;
|
|
@@ -136,7 +112,11 @@ var AreaChart = ({
|
|
|
136
112
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
137
113
|
const baseClassName = context == null ? void 0 : context.getPrefixCls("area-chart-container");
|
|
138
114
|
const chartRef = useRef(null);
|
|
139
|
-
const
|
|
115
|
+
const statistics = useMemo(() => {
|
|
116
|
+
if (!statisticConfig)
|
|
117
|
+
return null;
|
|
118
|
+
return Array.isArray(statisticConfig) ? statisticConfig : [statisticConfig];
|
|
119
|
+
}, [statisticConfig]);
|
|
140
120
|
const categories = useMemo(() => {
|
|
141
121
|
const uniqueCategories = [
|
|
142
122
|
...new Set(safeData.map((item) => item.category))
|
|
@@ -191,7 +171,7 @@ var AreaChart = ({
|
|
|
191
171
|
const labels = xValues.map((x) => x.toString());
|
|
192
172
|
const datasets = types.map((type, index) => {
|
|
193
173
|
const provided = color;
|
|
194
|
-
const baseColor = Array.isArray(provided) ? provided[index % provided.length] ||
|
|
174
|
+
const baseColor = Array.isArray(provided) ? provided[index % provided.length] || defaultColorList[index % defaultColorList.length] : provided || defaultColorList[index % defaultColorList.length];
|
|
195
175
|
const typeData = xValues.map((x) => {
|
|
196
176
|
const dataPoint = findDataPointByXValue(filteredData, x, type);
|
|
197
177
|
const v = dataPoint == null ? void 0 : dataPoint.y;
|
|
@@ -379,7 +359,7 @@ var AreaChart = ({
|
|
|
379
359
|
) : void 0
|
|
380
360
|
}
|
|
381
361
|
),
|
|
382
|
-
|
|
362
|
+
statistics && /* @__PURE__ */ React.createElement("div", { className: `${baseClassName}-statistic-container` }, statistics.map((config, index) => /* @__PURE__ */ React.createElement(ChartStatistic, __spreadProps(__spreadValues({ key: index }, config), { theme })))),
|
|
383
363
|
!renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
|
|
384
364
|
ChartFilter,
|
|
385
365
|
__spreadProps(__spreadValues({
|
|
@@ -397,7 +377,7 @@ var AreaChart = ({
|
|
|
397
377
|
/* @__PURE__ */ React.createElement(
|
|
398
378
|
"div",
|
|
399
379
|
{
|
|
400
|
-
className:
|
|
380
|
+
className: `${baseClassName}-wrapper`,
|
|
401
381
|
style: { marginTop: "20px", height: responsiveHeight }
|
|
402
382
|
},
|
|
403
383
|
/* @__PURE__ */ React.createElement(Line, { ref: chartRef, data: processedData, options })
|
|
@@ -73,10 +73,10 @@ export interface BarChartConfigItem {
|
|
|
73
73
|
indexAxis?: 'x' | 'y';
|
|
74
74
|
}
|
|
75
75
|
export interface BarChartProps extends ChartContainerProps {
|
|
76
|
-
/** 图表标题 */
|
|
77
|
-
title?: string;
|
|
78
76
|
/** 扁平化数据数组 */
|
|
79
77
|
data: BarChartDataItem[];
|
|
78
|
+
/** 图表标题 */
|
|
79
|
+
title?: string;
|
|
80
80
|
/** 图表宽度,默认600px */
|
|
81
81
|
width?: number | string;
|
|
82
82
|
/** 图表高度,默认400px */
|
|
@@ -112,12 +112,6 @@ export interface BarChartProps extends ChartContainerProps {
|
|
|
112
112
|
stacked?: boolean;
|
|
113
113
|
/** 图表轴向,'x'为垂直柱状图,'y'为水平柱状图 */
|
|
114
114
|
indexAxis?: 'x' | 'y';
|
|
115
|
-
/** 头部工具条额外按钮 */
|
|
116
|
-
toolbarExtra?: React.ReactNode;
|
|
117
|
-
/** 是否将过滤器渲染到工具栏 */
|
|
118
|
-
renderFilterInToolbar?: boolean;
|
|
119
|
-
/** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
|
|
120
|
-
statistic?: StatisticConfigType;
|
|
121
115
|
/** 是否显示数据标签,默认false */
|
|
122
116
|
showDataLabels?: boolean;
|
|
123
117
|
/** 数据标签格式化函数 */
|
|
@@ -130,6 +124,12 @@ export interface BarChartProps extends ChartContainerProps {
|
|
|
130
124
|
}) => string;
|
|
131
125
|
/** 外部传入的 Chart.js 选项,会与默认选项合并 */
|
|
132
126
|
chartOptions?: Partial<ChartOptions<'bar'>>;
|
|
127
|
+
/** 头部工具条额外按钮 */
|
|
128
|
+
toolbarExtra?: React.ReactNode;
|
|
129
|
+
/** 是否将过滤器渲染到工具栏 */
|
|
130
|
+
renderFilterInToolbar?: boolean;
|
|
131
|
+
/** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
|
|
132
|
+
statistic?: StatisticConfigType;
|
|
133
133
|
}
|
|
134
134
|
declare const BarChart: React.FC<BarChartProps>;
|
|
135
135
|
export default BarChart;
|
|
@@ -38,15 +38,12 @@ import {
|
|
|
38
38
|
ChartToolBar,
|
|
39
39
|
downloadChart
|
|
40
40
|
} from "../components";
|
|
41
|
-
import {
|
|
42
|
-
useChartStatistic
|
|
43
|
-
} from "../hooks/useChartStatistic";
|
|
41
|
+
import { defaultColorList } from "../const";
|
|
44
42
|
import {
|
|
45
43
|
extractAndSortXValues,
|
|
46
44
|
findDataPointByXValue
|
|
47
45
|
} from "../utils";
|
|
48
46
|
ChartJS.register(CategoryScale, LinearScale, BarElement, Tooltip, Legend);
|
|
49
|
-
var defaultColors = ["#917EF7", "#2AD8FC", "#388BFF", "#718AB6", "#84DC18"];
|
|
50
47
|
var hexToRgba = (hex, alpha) => {
|
|
51
48
|
const sanitized = hex.replace("#", "");
|
|
52
49
|
const isShort = sanitized.length === 3;
|
|
@@ -113,7 +110,11 @@ var BarChart = ({
|
|
|
113
110
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
114
111
|
const baseClassName = context == null ? void 0 : context.getPrefixCls("bar-chart-container");
|
|
115
112
|
const chartRef = useRef(null);
|
|
116
|
-
const
|
|
113
|
+
const statistics = useMemo(() => {
|
|
114
|
+
if (!statisticConfig)
|
|
115
|
+
return null;
|
|
116
|
+
return Array.isArray(statisticConfig) ? statisticConfig : [statisticConfig];
|
|
117
|
+
}, [statisticConfig]);
|
|
117
118
|
const categories = useMemo(() => {
|
|
118
119
|
const uniqueCategories = [
|
|
119
120
|
...new Set(safeData.map((item) => item.category))
|
|
@@ -189,7 +190,7 @@ var BarChart = ({
|
|
|
189
190
|
const labels = xValues.map((x) => x.toString());
|
|
190
191
|
const datasets = types.map((type, index) => {
|
|
191
192
|
const provided = color;
|
|
192
|
-
const pickByIndex = (i) => Array.isArray(provided) ? provided[i] || provided[0] ||
|
|
193
|
+
const pickByIndex = (i) => Array.isArray(provided) ? provided[i] || provided[0] || defaultColorList[i % defaultColorList.length] : provided || defaultColorList[i % defaultColorList.length];
|
|
193
194
|
const baseColor = pickByIndex(index);
|
|
194
195
|
const typeData = xValues.map((x) => {
|
|
195
196
|
const dataPoint = findDataPointByXValue(filteredData, x, type);
|
|
@@ -652,7 +653,7 @@ var BarChart = ({
|
|
|
652
653
|
) : void 0
|
|
653
654
|
}
|
|
654
655
|
),
|
|
655
|
-
|
|
656
|
+
statistics && /* @__PURE__ */ React.createElement("div", { className: `${baseClassName}-statistic-container` }, statistics.map((config, index) => /* @__PURE__ */ React.createElement(ChartStatistic, __spreadProps(__spreadValues({ key: index }, config), { theme })))),
|
|
656
657
|
!renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
|
|
657
658
|
ChartFilter,
|
|
658
659
|
__spreadProps(__spreadValues({
|
|
@@ -670,7 +671,7 @@ var BarChart = ({
|
|
|
670
671
|
/* @__PURE__ */ React.createElement(
|
|
671
672
|
"div",
|
|
672
673
|
{
|
|
673
|
-
className:
|
|
674
|
+
className: `${baseClassName}-wrapper`,
|
|
674
675
|
style: { marginTop: "20px", height: responsiveHeight }
|
|
675
676
|
},
|
|
676
677
|
/* @__PURE__ */ React.createElement(
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
// src/Plugins/chart/DonutChart/constants.ts
|
|
2
|
-
var DEFAULT_COLORS = [
|
|
3
|
-
"#917EF7",
|
|
4
|
-
"#2AD8FC",
|
|
5
|
-
"#388BFF",
|
|
6
|
-
"#718AB6",
|
|
7
|
-
"#84DC18",
|
|
8
|
-
"#FACC15",
|
|
9
|
-
"#33E59B",
|
|
10
|
-
"#D666E4",
|
|
11
|
-
"#6151FF",
|
|
12
|
-
"#BF3C93",
|
|
13
|
-
"#005EE0"
|
|
14
|
-
];
|
|
15
2
|
var MOBILE_MAX_CHART_SIZE = 160;
|
|
16
3
|
var BASE_CLASS_NAME = "md-editor-donut-chart";
|
|
17
4
|
var SINGLE_MODE_DESKTOP_CUTOUT = "70%";
|
|
18
5
|
var SINGLE_MODE_MOBILE_CUTOUT = "65%";
|
|
19
6
|
export {
|
|
20
7
|
BASE_CLASS_NAME,
|
|
21
|
-
DEFAULT_COLORS,
|
|
22
8
|
MOBILE_MAX_CHART_SIZE,
|
|
23
9
|
SINGLE_MODE_DESKTOP_CUTOUT,
|
|
24
10
|
SINGLE_MODE_MOBILE_CUTOUT
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
Legend,
|
|
39
39
|
Tooltip
|
|
40
40
|
} from "chart.js";
|
|
41
|
+
import classNames from "classnames";
|
|
41
42
|
import React, { useContext, useMemo, useRef, useState } from "react";
|
|
42
43
|
import { Doughnut } from "react-chartjs-2";
|
|
43
44
|
import {
|
|
@@ -47,9 +48,8 @@ import {
|
|
|
47
48
|
ChartToolBar,
|
|
48
49
|
downloadChart
|
|
49
50
|
} from "../components";
|
|
50
|
-
import {
|
|
51
|
+
import { defaultColorList } from "../const";
|
|
51
52
|
import {
|
|
52
|
-
DEFAULT_COLORS,
|
|
53
53
|
SINGLE_MODE_DESKTOP_CUTOUT,
|
|
54
54
|
SINGLE_MODE_MOBILE_CUTOUT
|
|
55
55
|
} from "./constants";
|
|
@@ -80,6 +80,7 @@ var DonutChart = (_a) => {
|
|
|
80
80
|
enableAutoCategory = true,
|
|
81
81
|
singleMode = false,
|
|
82
82
|
toolbarExtra,
|
|
83
|
+
renderFilterInToolbar = false,
|
|
83
84
|
statistic: statisticConfig
|
|
84
85
|
} = _b, props = __objRest(_b, [
|
|
85
86
|
"data",
|
|
@@ -97,6 +98,7 @@ var DonutChart = (_a) => {
|
|
|
97
98
|
"enableAutoCategory",
|
|
98
99
|
"singleMode",
|
|
99
100
|
"toolbarExtra",
|
|
101
|
+
"renderFilterInToolbar",
|
|
100
102
|
"statistic"
|
|
101
103
|
]);
|
|
102
104
|
var _a2;
|
|
@@ -163,7 +165,11 @@ var DonutChart = (_a) => {
|
|
|
163
165
|
);
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
|
-
const
|
|
168
|
+
const statistics = useMemo(() => {
|
|
169
|
+
if (!statisticConfig)
|
|
170
|
+
return null;
|
|
171
|
+
return Array.isArray(statisticConfig) ? statisticConfig : [statisticConfig];
|
|
172
|
+
}, [statisticConfig]);
|
|
167
173
|
const handleDownload = () => {
|
|
168
174
|
var _a3, _b2;
|
|
169
175
|
if (onDownload) {
|
|
@@ -228,7 +234,7 @@ var DonutChart = (_a) => {
|
|
|
228
234
|
showLegend: false,
|
|
229
235
|
showTooltip: false,
|
|
230
236
|
backgroundColor: [
|
|
231
|
-
|
|
237
|
+
defaultColorList[i % defaultColorList.length],
|
|
232
238
|
"#F7F8F9"
|
|
233
239
|
]
|
|
234
240
|
})) : finalConfigs;
|
|
@@ -254,18 +260,47 @@ var DonutChart = (_a) => {
|
|
|
254
260
|
title,
|
|
255
261
|
onDownload: handleDownload,
|
|
256
262
|
extra: toolbarExtra,
|
|
257
|
-
dataTime
|
|
263
|
+
dataTime,
|
|
264
|
+
filter: renderFilterInToolbar && shouldShowFilter ? /* @__PURE__ */ React.createElement(
|
|
265
|
+
ChartFilter,
|
|
266
|
+
__spreadProps(__spreadValues({
|
|
267
|
+
filterOptions: finalFilterList.map((item) => {
|
|
268
|
+
return {
|
|
269
|
+
label: item || "",
|
|
270
|
+
value: item || ""
|
|
271
|
+
};
|
|
272
|
+
}),
|
|
273
|
+
selectedFilter: finalSelectedFilter || "",
|
|
274
|
+
onFilterChange: finalOnFilterChange
|
|
275
|
+
}, filterLabels && {
|
|
276
|
+
customOptions: filteredDataByFilterLabel,
|
|
277
|
+
selectedCustomSelection: selectedFilterLabel,
|
|
278
|
+
onSelectionChange: setSelectedFilterLabel
|
|
279
|
+
}), {
|
|
280
|
+
theme: chartFilterTheme,
|
|
281
|
+
variant: "compact"
|
|
282
|
+
})
|
|
283
|
+
) : void 0
|
|
258
284
|
}
|
|
259
285
|
),
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
286
|
+
statistics && /* @__PURE__ */ React.createElement(
|
|
287
|
+
"div",
|
|
288
|
+
{
|
|
289
|
+
className: classNames(
|
|
290
|
+
`${baseClassName}-statistic-container`,
|
|
291
|
+
hashId
|
|
292
|
+
)
|
|
293
|
+
},
|
|
294
|
+
statistics.map((config, index) => /* @__PURE__ */ React.createElement(
|
|
295
|
+
ChartStatistic,
|
|
296
|
+
__spreadProps(__spreadValues({
|
|
297
|
+
key: index
|
|
298
|
+
}, config), {
|
|
299
|
+
theme: chartFilterTheme
|
|
300
|
+
})
|
|
301
|
+
))
|
|
302
|
+
),
|
|
303
|
+
!renderFilterInToolbar && shouldShowFilter && /* @__PURE__ */ React.createElement(
|
|
269
304
|
ChartFilter,
|
|
270
305
|
__spreadProps(__spreadValues({
|
|
271
306
|
filterOptions: finalFilterList.map((item) => {
|
|
@@ -324,8 +359,8 @@ var DonutChart = (_a) => {
|
|
|
324
359
|
(sum, v) => sum + (Number.isFinite(v) ? v : 0),
|
|
325
360
|
0
|
|
326
361
|
);
|
|
327
|
-
const backgroundColors = cfg.backgroundColor ||
|
|
328
|
-
const mainColor = (_b2 = (_a3 = cfg.backgroundColor) == null ? void 0 : _a3[0]) != null ? _b2 :
|
|
362
|
+
const backgroundColors = cfg.backgroundColor || defaultColorList;
|
|
363
|
+
const mainColor = (_b2 = (_a3 = cfg.backgroundColor) == null ? void 0 : _a3[0]) != null ? _b2 : defaultColorList[idx % defaultColorList.length];
|
|
329
364
|
const chartJsData = {
|
|
330
365
|
labels,
|
|
331
366
|
datasets: [
|
|
@@ -152,6 +152,13 @@ var genStyle = (token) => {
|
|
|
152
152
|
marginTop: 1
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
|
+
"&-statistic-container": {
|
|
156
|
+
display: "flex",
|
|
157
|
+
gap: "16px",
|
|
158
|
+
marginBottom: "16px",
|
|
159
|
+
flexWrap: "wrap",
|
|
160
|
+
alignItems: "flex-start"
|
|
161
|
+
},
|
|
155
162
|
// 响应式网格调整
|
|
156
163
|
[`@media (max-width: 768px)`]: {
|
|
157
164
|
gap: 12,
|
|
@@ -42,6 +42,8 @@ export interface DonutChartProps extends ChartContainerProps {
|
|
|
42
42
|
singleMode?: boolean;
|
|
43
43
|
/** 头部工具条额外按钮 */
|
|
44
44
|
toolbarExtra?: React.ReactNode;
|
|
45
|
+
/** 是否将过滤器渲染到工具栏 */
|
|
46
|
+
renderFilterInToolbar?: boolean;
|
|
45
47
|
/** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
|
|
46
48
|
statistic?: StatisticConfigType;
|
|
47
49
|
}
|
|
@@ -16,12 +16,10 @@ export interface FunnelChartDataItem {
|
|
|
16
16
|
ratio?: number | string;
|
|
17
17
|
}
|
|
18
18
|
export interface FunnelChartProps extends ChartContainerProps {
|
|
19
|
-
/** 图表标题 */
|
|
20
|
-
title?: string;
|
|
21
19
|
/** 扁平化数据数组(x 为阶段名,y 为数值) */
|
|
22
20
|
data: FunnelChartDataItem[];
|
|
23
|
-
/**
|
|
24
|
-
|
|
21
|
+
/** 图表标题 */
|
|
22
|
+
title?: string;
|
|
25
23
|
/** 图表宽度,默认600px */
|
|
26
24
|
width?: number | string;
|
|
27
25
|
/** 图表高度,默认400px */
|
|
@@ -30,12 +28,12 @@ export interface FunnelChartProps extends ChartContainerProps {
|
|
|
30
28
|
className?: string;
|
|
31
29
|
/** 数据时间 */
|
|
32
30
|
dataTime?: string;
|
|
33
|
-
/**
|
|
31
|
+
/** 图表主题 */
|
|
34
32
|
theme?: 'dark' | 'light';
|
|
35
|
-
/**
|
|
33
|
+
/** 自定义主色 */
|
|
34
|
+
color?: string;
|
|
35
|
+
/** 是否显示图例,默认true */
|
|
36
36
|
showLegend?: boolean;
|
|
37
|
-
/** 统计数据组件配置 */
|
|
38
|
-
statistic?: StatisticConfigType;
|
|
39
37
|
/** 图例位置 */
|
|
40
38
|
legendPosition?: 'top' | 'left' | 'bottom' | 'right';
|
|
41
39
|
/** 图例水平对齐方式 */
|
|
@@ -46,6 +44,8 @@ export interface FunnelChartProps extends ChartContainerProps {
|
|
|
46
44
|
toolbarExtra?: React.ReactNode;
|
|
47
45
|
/** 是否将过滤器渲染到工具栏 */
|
|
48
46
|
renderFilterInToolbar?: boolean;
|
|
47
|
+
/** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
|
|
48
|
+
statistic?: StatisticConfigType;
|
|
49
49
|
typeNames?: {
|
|
50
50
|
rate?: string;
|
|
51
51
|
/** 类型名称,用于图例和数据集标签 */
|