@ant-design/agentic-ui 2.0.14 → 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/BackTo/BackBottom.d.ts +56 -0
- package/dist/BackTo/BackTop.d.ts +39 -2
- package/dist/BackTo/index.d.ts +20 -0
- package/dist/Bubble/AIBubble.js +4 -1
- package/dist/Bubble/List/index.js +1 -1
- package/dist/Bubble/MessagesContent/MarkdownPreview.js +3 -1
- package/dist/Bubble/UserBubble.js +1 -1
- package/dist/Bubble/index.d.ts +6 -0
- package/dist/Bubble/style.js +5 -2
- package/dist/ChatBootPage/CaseReply.js +1 -1
- package/dist/ChatBootPage/Title.js +1 -1
- package/dist/ChatBootPage/index.d.ts +6 -0
- package/dist/Components/ActionIconBox/index.js +1 -1
- package/dist/Components/ActionItemBox/ActionItemBox.js +1 -1
- package/dist/Components/ActionItemBox/index.d.ts +6 -0
- package/dist/Components/Button/index.d.ts +6 -0
- package/dist/History/components/HistoryItem.js +2 -2
- package/dist/History/components/NewChatComponent.js +1 -1
- package/dist/History/components/SearchComponent.d.ts +2 -0
- package/dist/History/components/SearchComponent.js +17 -3
- package/dist/History/index.d.ts +4 -0
- package/dist/History/index.js +17 -11
- package/dist/History/menu.d.ts +2 -0
- package/dist/History/menu.js +18 -5
- package/dist/History/style.js +1 -1
- package/dist/History/types/index.d.ts +6 -0
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +1 -1
- package/dist/MarkdownEditor/editor/components/CommentList/index.js +1 -1
- package/dist/MarkdownEditor/editor/components/ContributorAvatar/index.js +1 -1
- package/dist/MarkdownEditor/editor/components/fntTag/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Comment/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/FootnoteDefinition.js +1 -1
- package/dist/MarkdownEditor/editor/elements/FootnoteReference.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Head.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Image/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/LinkCard/index.js +2 -2
- package/dist/MarkdownEditor/editor/elements/List/List.js +1 -1
- package/dist/MarkdownEditor/editor/elements/List/ListItem.js +1 -1
- package/dist/MarkdownEditor/editor/elements/List/style.js +2 -2
- package/dist/MarkdownEditor/editor/elements/Media.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Paragraph.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/Table.js +5 -3
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndex/index.js +3 -1
- package/dist/MarkdownEditor/editor/elements/Table/TableCellIndexSpacer/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/TableRowIndex/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/Table/Td/index.js +1 -1
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.d.ts +0 -22
- package/dist/MarkdownEditor/editor/elements/TagPopup/index.js +176 -124
- package/dist/MarkdownEditor/editor/elements/index.js +1 -1
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +16 -12
- package/dist/MarkdownEditor/editor/style.js +6 -6
- package/dist/MarkdownEditor/editor/tools/DragHandle.js +2 -2
- package/dist/MarkdownEditor/editor/tools/ToolBar/ToolBar.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/AttachmentFileListItem.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/AttachmentFileList/index.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/index.js +1 -1
- package/dist/MarkdownInputField/AttachmentButton/style.js +3 -3
- package/dist/MarkdownInputField/AttachmentButton/utils.d.ts +8 -0
- package/dist/MarkdownInputField/AttachmentButton/utils.js +10 -3
- package/dist/MarkdownInputField/BeforeToolContainer/BeforeToolContainer.js +1 -1
- 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 +25 -15
- package/dist/MarkdownInputField/FileUploadManager/index.js +2 -2
- package/dist/MarkdownInputField/MarkdownInputField.d.ts +9 -19
- package/dist/MarkdownInputField/MarkdownInputField.js +155 -192
- package/dist/MarkdownInputField/QuickActions/index.js +4 -8
- package/dist/MarkdownInputField/RefinePromptButton/index.js +9 -54
- package/dist/MarkdownInputField/SendActions/index.js +1 -1
- package/dist/MarkdownInputField/SendButton/index.js +1 -1
- package/dist/MarkdownInputField/SkillModeBar/index.js +1 -1
- package/dist/MarkdownInputField/TopOperatingArea/index.js +1 -1
- package/dist/MarkdownInputField/VoiceInput/index.js +1 -1
- 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/Plugins/chart/index.js +2 -2
- package/dist/Plugins/index.d.ts +6 -0
- package/dist/Plugins/mermaid/index.js +1 -1
- package/dist/Quote/index.js +1 -1
- package/dist/Schema/index.d.ts +6 -0
- package/dist/ThoughtChainList/DotAni/index.css +1 -1
- package/dist/ThoughtChainList/DotAni/index.js +2 -2
- package/dist/ToolUseBar/ToolUseBarThink.js +1 -1
- package/dist/ToolUseBar/index.js +1 -1
- package/dist/WelcomeMessage/index.d.ts +42 -0
- package/dist/WelcomeMessage/index.js +1 -1
- package/dist/Workspace/File/PreviewComponent.js +3 -2
- package/dist/Workspace/File/style.js +2 -1
- package/dist/Workspace/RealtimeFollow/style.js +2 -7
- package/dist/Workspace/Task/index.js +1 -1
- 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
|
@@ -40,6 +40,7 @@ import {
|
|
|
40
40
|
LinearScale,
|
|
41
41
|
Tooltip
|
|
42
42
|
} from "chart.js";
|
|
43
|
+
import classNames from "classnames";
|
|
43
44
|
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
44
45
|
import { Bar } from "react-chartjs-2";
|
|
45
46
|
import ChartStatistic from "../ChartStatistic";
|
|
@@ -49,12 +50,10 @@ import {
|
|
|
49
50
|
ChartToolBar,
|
|
50
51
|
downloadChart
|
|
51
52
|
} from "../components";
|
|
52
|
-
import {
|
|
53
|
-
useChartStatistic
|
|
54
|
-
} from "../hooks/useChartStatistic";
|
|
53
|
+
import { defaultColorList } from "../const";
|
|
55
54
|
import { findDataPointByXValue, isXValueEqual, toNumber } from "../utils";
|
|
55
|
+
import { useStyle } from "./style";
|
|
56
56
|
ChartJS.register(CategoryScale, LinearScale, BarElement, Tooltip, Legend);
|
|
57
|
-
var defaultColors = "#1890ff";
|
|
58
57
|
var FunnelChart = (_a) => {
|
|
59
58
|
var _b = _a, {
|
|
60
59
|
title,
|
|
@@ -72,7 +71,7 @@ var FunnelChart = (_a) => {
|
|
|
72
71
|
toolbarExtra,
|
|
73
72
|
renderFilterInToolbar = false,
|
|
74
73
|
typeNames,
|
|
75
|
-
statistic
|
|
74
|
+
statistic: statisticConfig
|
|
76
75
|
} = _b, props = __objRest(_b, [
|
|
77
76
|
"title",
|
|
78
77
|
"data",
|
|
@@ -92,7 +91,11 @@ var FunnelChart = (_a) => {
|
|
|
92
91
|
"statistic"
|
|
93
92
|
]);
|
|
94
93
|
const safeData = Array.isArray(data) ? data : [];
|
|
95
|
-
const
|
|
94
|
+
const statistics = useMemo(() => {
|
|
95
|
+
if (!statisticConfig)
|
|
96
|
+
return null;
|
|
97
|
+
return Array.isArray(statisticConfig) ? statisticConfig : [statisticConfig];
|
|
98
|
+
}, [statisticConfig]);
|
|
96
99
|
const [windowWidth, setWindowWidth] = useState(
|
|
97
100
|
typeof window !== "undefined" ? window.innerWidth : 768
|
|
98
101
|
);
|
|
@@ -107,6 +110,7 @@ var FunnelChart = (_a) => {
|
|
|
107
110
|
}, []);
|
|
108
111
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
109
112
|
const baseClassName = context == null ? void 0 : context.getPrefixCls("funnel-chart-container");
|
|
113
|
+
const { hashId, wrapSSR } = useStyle(baseClassName);
|
|
110
114
|
const chartRef = useRef(null);
|
|
111
115
|
const [showTrapezoid, setShowTrapezoid] = useState(true);
|
|
112
116
|
const [pluginToggleKey, setPluginToggleKey] = useState(0);
|
|
@@ -167,7 +171,7 @@ var FunnelChart = (_a) => {
|
|
|
167
171
|
return chartHeight;
|
|
168
172
|
}, [height, chartHeight]);
|
|
169
173
|
const processedData = useMemo(() => {
|
|
170
|
-
const baseColor = color ||
|
|
174
|
+
const baseColor = color || defaultColorList[0];
|
|
171
175
|
const labels = stages.map((x) => x.toString());
|
|
172
176
|
const values = stages.map((x) => {
|
|
173
177
|
const dp = findDataPointByXValue(filteredData, x);
|
|
@@ -535,68 +539,83 @@ var FunnelChart = (_a) => {
|
|
|
535
539
|
}
|
|
536
540
|
};
|
|
537
541
|
}, [isMobile, axisTextColor]);
|
|
538
|
-
return
|
|
539
|
-
ChartContainer,
|
|
540
|
-
{
|
|
541
|
-
baseClassName,
|
|
542
|
-
className,
|
|
543
|
-
theme,
|
|
544
|
-
isMobile,
|
|
545
|
-
variant: props.variant,
|
|
546
|
-
style: {
|
|
547
|
-
width: responsiveWidth
|
|
548
|
-
}
|
|
549
|
-
},
|
|
542
|
+
return wrapSSR(
|
|
550
543
|
/* @__PURE__ */ React.createElement(
|
|
551
|
-
|
|
544
|
+
ChartContainer,
|
|
552
545
|
{
|
|
553
|
-
|
|
546
|
+
baseClassName,
|
|
547
|
+
className,
|
|
554
548
|
theme,
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
549
|
+
isMobile,
|
|
550
|
+
variant: props.variant,
|
|
551
|
+
style: {
|
|
552
|
+
width: responsiveWidth
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
/* @__PURE__ */ React.createElement(
|
|
556
|
+
ChartToolBar,
|
|
557
|
+
{
|
|
558
|
+
title,
|
|
559
|
+
theme,
|
|
560
|
+
onDownload: handleDownload,
|
|
561
|
+
dataTime,
|
|
562
|
+
extra: toolbarExtra,
|
|
563
|
+
filter: renderFilterInToolbar && filterOptions && filterOptions.length > 1 ? /* @__PURE__ */ React.createElement(
|
|
564
|
+
ChartFilter,
|
|
565
|
+
__spreadProps(__spreadValues({
|
|
566
|
+
filterOptions,
|
|
567
|
+
selectedFilter,
|
|
568
|
+
onFilterChange: setSelectedFilter
|
|
569
|
+
}, customOptions && {
|
|
570
|
+
customOptions,
|
|
571
|
+
selectedCustomSelection: selectedFilterLabel,
|
|
572
|
+
onSelectionChange: setSelectedFilterLabel
|
|
573
|
+
}), {
|
|
574
|
+
theme,
|
|
575
|
+
variant: "compact"
|
|
576
|
+
})
|
|
577
|
+
) : void 0
|
|
578
|
+
}
|
|
579
|
+
),
|
|
580
|
+
!renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
|
|
581
|
+
ChartFilter,
|
|
582
|
+
__spreadProps(__spreadValues({
|
|
583
|
+
filterOptions,
|
|
584
|
+
selectedFilter,
|
|
585
|
+
onFilterChange: setSelectedFilter
|
|
586
|
+
}, customOptions && {
|
|
587
|
+
customOptions,
|
|
588
|
+
selectedCustomSelection: selectedFilterLabel,
|
|
589
|
+
onSelectionChange: setSelectedFilterLabel
|
|
590
|
+
}), {
|
|
591
|
+
theme
|
|
592
|
+
})
|
|
593
|
+
),
|
|
594
|
+
statistics && /* @__PURE__ */ React.createElement(
|
|
595
|
+
"div",
|
|
596
|
+
{
|
|
597
|
+
className: classNames(`${baseClassName}-statistic-container`, hashId)
|
|
598
|
+
},
|
|
599
|
+
statistics.map((config, index) => /* @__PURE__ */ React.createElement(ChartStatistic, __spreadProps(__spreadValues({ key: index }, config), { theme })))
|
|
600
|
+
),
|
|
601
|
+
/* @__PURE__ */ React.createElement(
|
|
602
|
+
"div",
|
|
603
|
+
{
|
|
604
|
+
className: classNames(`${baseClassName}-wrapper`, hashId),
|
|
605
|
+
style: { height: finalHeight }
|
|
606
|
+
},
|
|
607
|
+
/* @__PURE__ */ React.createElement(
|
|
608
|
+
Bar,
|
|
609
|
+
{
|
|
610
|
+
key: `funnel-${pluginToggleKey}`,
|
|
611
|
+
ref: chartRef,
|
|
612
|
+
data: processedData,
|
|
613
|
+
options,
|
|
614
|
+
plugins: [trapezoidPlugin, rightLabelPlugin]
|
|
615
|
+
}
|
|
616
|
+
)
|
|
617
|
+
)
|
|
618
|
+
)
|
|
600
619
|
);
|
|
601
620
|
};
|
|
602
621
|
var FunnelChart_default = FunnelChart;
|
|
@@ -38,6 +38,18 @@ var genStyle = (token) => {
|
|
|
38
38
|
maxWidth: "100% !important",
|
|
39
39
|
maxHeight: "100% !important"
|
|
40
40
|
},
|
|
41
|
+
"&-statistic-container": {
|
|
42
|
+
display: "flex",
|
|
43
|
+
gap: "16px",
|
|
44
|
+
marginBottom: "16px",
|
|
45
|
+
flexWrap: "wrap",
|
|
46
|
+
alignItems: "flex-start"
|
|
47
|
+
},
|
|
48
|
+
"&-wrapper": {
|
|
49
|
+
position: "relative",
|
|
50
|
+
width: "100%",
|
|
51
|
+
height: "100%"
|
|
52
|
+
},
|
|
41
53
|
"@media (max-width: 768px)": {
|
|
42
54
|
".chart-wrapper": {
|
|
43
55
|
height: "calc(100% - 100px)",
|
|
@@ -23,10 +23,10 @@ export interface LineChartConfigItem {
|
|
|
23
23
|
yAxisStep?: number;
|
|
24
24
|
}
|
|
25
25
|
export interface LineChartProps extends ChartContainerProps {
|
|
26
|
-
/** 图表标题 */
|
|
27
|
-
title?: string;
|
|
28
26
|
/** 扁平化数据数组 */
|
|
29
27
|
data: LineChartDataItem[];
|
|
28
|
+
/** 图表标题 */
|
|
29
|
+
title?: string;
|
|
30
30
|
/** 图表宽度,默认600px */
|
|
31
31
|
width?: number | string;
|
|
32
32
|
/** 图表高度,默认400px */
|
|
@@ -51,9 +51,7 @@ import {
|
|
|
51
51
|
ChartToolBar,
|
|
52
52
|
downloadChart
|
|
53
53
|
} from "../components";
|
|
54
|
-
import {
|
|
55
|
-
useChartStatistic
|
|
56
|
-
} from "../hooks/useChartStatistic";
|
|
54
|
+
import { defaultColorList } from "../const";
|
|
57
55
|
import {
|
|
58
56
|
extractAndSortXValues,
|
|
59
57
|
findDataPointByXValue
|
|
@@ -67,18 +65,6 @@ ChartJS.register(
|
|
|
67
65
|
Tooltip,
|
|
68
66
|
Legend
|
|
69
67
|
);
|
|
70
|
-
var defaultColors = [
|
|
71
|
-
"#1677ff",
|
|
72
|
-
"#8954FC",
|
|
73
|
-
"#15e7e4",
|
|
74
|
-
"#F45BB5",
|
|
75
|
-
"#00A6FF",
|
|
76
|
-
"#33E59B",
|
|
77
|
-
"#D666E4",
|
|
78
|
-
"#6151FF",
|
|
79
|
-
"#BF3C93",
|
|
80
|
-
"#005EE0"
|
|
81
|
-
];
|
|
82
68
|
var LineChart = (_a) => {
|
|
83
69
|
var _b = _a, {
|
|
84
70
|
title,
|
|
@@ -140,7 +126,11 @@ var LineChart = (_a) => {
|
|
|
140
126
|
const context = useContext(ConfigProvider.ConfigContext);
|
|
141
127
|
const baseClassName = context == null ? void 0 : context.getPrefixCls("line-chart-container");
|
|
142
128
|
const chartRef = useRef(null);
|
|
143
|
-
const
|
|
129
|
+
const statistics = useMemo(() => {
|
|
130
|
+
if (!statisticConfig)
|
|
131
|
+
return null;
|
|
132
|
+
return Array.isArray(statisticConfig) ? statisticConfig : [statisticConfig];
|
|
133
|
+
}, [statisticConfig]);
|
|
144
134
|
const categories = useMemo(() => {
|
|
145
135
|
const uniqueCategories = [
|
|
146
136
|
...new Set(safeData.map((item) => item.category))
|
|
@@ -195,7 +185,7 @@ var LineChart = (_a) => {
|
|
|
195
185
|
const labels = xValues.map((x) => x.toString());
|
|
196
186
|
const datasets = types.map((type, index) => {
|
|
197
187
|
const provided = color;
|
|
198
|
-
const baseColor = Array.isArray(provided) ? provided[index % provided.length] ||
|
|
188
|
+
const baseColor = Array.isArray(provided) ? provided[index % provided.length] || defaultColorList[index % defaultColorList.length] : provided || defaultColorList[index % defaultColorList.length];
|
|
199
189
|
const typeData = xValues.map((x) => {
|
|
200
190
|
const dataPoint = findDataPointByXValue(filteredData, x, type);
|
|
201
191
|
const v = dataPoint == null ? void 0 : dataPoint.y;
|
|
@@ -372,7 +362,7 @@ var LineChart = (_a) => {
|
|
|
372
362
|
) : void 0
|
|
373
363
|
}
|
|
374
364
|
),
|
|
375
|
-
|
|
365
|
+
statistics && /* @__PURE__ */ React.createElement("div", { className: `${baseClassName}-statistic-container` }, statistics.map((config, index) => /* @__PURE__ */ React.createElement(ChartStatistic, __spreadProps(__spreadValues({ key: index }, config), { theme })))),
|
|
376
366
|
!renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
|
|
377
367
|
ChartFilter,
|
|
378
368
|
__spreadProps(__spreadValues({
|
|
@@ -387,7 +377,14 @@ var LineChart = (_a) => {
|
|
|
387
377
|
theme
|
|
388
378
|
})
|
|
389
379
|
),
|
|
390
|
-
/* @__PURE__ */ React.createElement(
|
|
380
|
+
/* @__PURE__ */ React.createElement(
|
|
381
|
+
"div",
|
|
382
|
+
{
|
|
383
|
+
className: `${baseClassName}-wrapper`,
|
|
384
|
+
style: { height: responsiveHeight }
|
|
385
|
+
},
|
|
386
|
+
/* @__PURE__ */ React.createElement(Line, { ref: chartRef, data: processedData, options })
|
|
387
|
+
)
|
|
391
388
|
);
|
|
392
389
|
};
|
|
393
390
|
var LineChart_default = LineChart;
|
|
@@ -9,19 +9,25 @@ export interface RadarChartDataItem {
|
|
|
9
9
|
filterLabel?: string;
|
|
10
10
|
}
|
|
11
11
|
interface RadarChartProps extends ChartContainerProps {
|
|
12
|
+
/** 扁平化数据数组 */
|
|
12
13
|
data: RadarChartDataItem[];
|
|
14
|
+
/** 图表标题 */
|
|
13
15
|
title?: string;
|
|
16
|
+
/** 图表宽度,默认600px */
|
|
14
17
|
width?: number | string;
|
|
18
|
+
/** 图表高度,默认400px */
|
|
15
19
|
height?: number | string;
|
|
20
|
+
/** 自定义CSS类名 */
|
|
16
21
|
className?: string;
|
|
22
|
+
/** 数据时间 */
|
|
23
|
+
dataTime?: string;
|
|
24
|
+
/** 自定义主色(可选),支持 string 或 string[];数组按序对应各数据序列 */
|
|
25
|
+
color?: string | string[];
|
|
26
|
+
/** 头部工具条额外按钮 */
|
|
17
27
|
toolbarExtra?: React.ReactNode;
|
|
18
28
|
/** 是否将过滤器渲染到工具栏 */
|
|
19
29
|
renderFilterInToolbar?: boolean;
|
|
20
|
-
|
|
21
|
-
borderColor?: string;
|
|
22
|
-
backgroundColor?: string;
|
|
23
|
-
pointBackgroundColor?: string;
|
|
24
|
-
/** 统计数据组件配置 */
|
|
30
|
+
/** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
|
|
25
31
|
statistic?: StatisticConfigType;
|
|
26
32
|
/** 图例文字最大宽度(像素),超出则显示省略号,默认80px */
|
|
27
33
|
textMaxWidth?: number;
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
Tooltip
|
|
43
43
|
} from "chart.js";
|
|
44
44
|
import classNames from "classnames";
|
|
45
|
-
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
45
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
46
46
|
import { Radar } from "react-chartjs-2";
|
|
47
47
|
import ChartStatistic from "../ChartStatistic";
|
|
48
48
|
import {
|
|
@@ -51,9 +51,7 @@ import {
|
|
|
51
51
|
ChartToolBar,
|
|
52
52
|
downloadChart
|
|
53
53
|
} from "../components";
|
|
54
|
-
import {
|
|
55
|
-
useChartStatistic
|
|
56
|
-
} from "../hooks/useChartStatistic";
|
|
54
|
+
import { defaultColorList } from "../const";
|
|
57
55
|
import { useStyle } from "./style";
|
|
58
56
|
ChartJS.register(
|
|
59
57
|
RadialLinearScale,
|
|
@@ -63,28 +61,6 @@ ChartJS.register(
|
|
|
63
61
|
Tooltip,
|
|
64
62
|
Legend
|
|
65
63
|
);
|
|
66
|
-
var defaultColors = [
|
|
67
|
-
"#388BFF",
|
|
68
|
-
// 第一个颜色:蓝色
|
|
69
|
-
"#917EF7",
|
|
70
|
-
// 第二个颜色:紫色
|
|
71
|
-
"#2AD8FC",
|
|
72
|
-
// 第三个颜色:青色
|
|
73
|
-
"#F45BB5",
|
|
74
|
-
// 粉色
|
|
75
|
-
"#00A6FF",
|
|
76
|
-
// 天蓝色
|
|
77
|
-
"#33E59B",
|
|
78
|
-
// 绿色
|
|
79
|
-
"#D666E4",
|
|
80
|
-
// 紫红色
|
|
81
|
-
"#6151FF",
|
|
82
|
-
// 靛蓝色
|
|
83
|
-
"#BF3C93",
|
|
84
|
-
// 玫红色
|
|
85
|
-
"#005EE0"
|
|
86
|
-
// 深蓝色
|
|
87
|
-
];
|
|
88
64
|
var RadarChart = (_a) => {
|
|
89
65
|
var _b = _a, {
|
|
90
66
|
data,
|
|
@@ -95,10 +71,8 @@ var RadarChart = (_a) => {
|
|
|
95
71
|
toolbarExtra,
|
|
96
72
|
renderFilterInToolbar = false,
|
|
97
73
|
dataTime,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
pointBackgroundColor,
|
|
101
|
-
statistic,
|
|
74
|
+
color,
|
|
75
|
+
statistic: statisticConfig,
|
|
102
76
|
textMaxWidth = 80
|
|
103
77
|
} = _b, props = __objRest(_b, [
|
|
104
78
|
"data",
|
|
@@ -109,16 +83,18 @@ var RadarChart = (_a) => {
|
|
|
109
83
|
"toolbarExtra",
|
|
110
84
|
"renderFilterInToolbar",
|
|
111
85
|
"dataTime",
|
|
112
|
-
"
|
|
113
|
-
"backgroundColor",
|
|
114
|
-
"pointBackgroundColor",
|
|
86
|
+
"color",
|
|
115
87
|
"statistic",
|
|
116
88
|
"textMaxWidth"
|
|
117
89
|
]);
|
|
118
90
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
119
91
|
const prefixCls = getPrefixCls("radar-chart");
|
|
120
92
|
const { wrapSSR, hashId } = useStyle(prefixCls);
|
|
121
|
-
const
|
|
93
|
+
const statistics = useMemo(() => {
|
|
94
|
+
if (!statisticConfig)
|
|
95
|
+
return null;
|
|
96
|
+
return Array.isArray(statisticConfig) ? statisticConfig : [statisticConfig];
|
|
97
|
+
}, [statisticConfig]);
|
|
122
98
|
const [windowWidth, setWindowWidth] = useState(
|
|
123
99
|
typeof window !== "undefined" ? window.innerWidth : 768
|
|
124
100
|
);
|
|
@@ -246,15 +222,18 @@ var RadarChart = (_a) => {
|
|
|
246
222
|
}
|
|
247
223
|
return 0;
|
|
248
224
|
});
|
|
249
|
-
const
|
|
250
|
-
const
|
|
225
|
+
const providedColor = color;
|
|
226
|
+
const baseColor = Array.isArray(providedColor) ? providedColor[index % providedColor.length] : providedColor;
|
|
227
|
+
const safeIndex = Math.max(0, index % defaultColorList.length);
|
|
228
|
+
const safeDefaultColor = defaultColorList[safeIndex] || "#1677ff";
|
|
229
|
+
const finalColor = baseColor || safeDefaultColor;
|
|
251
230
|
return {
|
|
252
231
|
label: type || "默认",
|
|
253
232
|
data: scores,
|
|
254
|
-
borderColor:
|
|
255
|
-
backgroundColor:
|
|
233
|
+
borderColor: finalColor,
|
|
234
|
+
backgroundColor: `${finalColor}20`,
|
|
256
235
|
borderWidth: isMobile ? 1.5 : 2,
|
|
257
|
-
pointBackgroundColor:
|
|
236
|
+
pointBackgroundColor: finalColor,
|
|
258
237
|
pointBorderColor: "#fff",
|
|
259
238
|
pointBorderWidth: isMobile ? 1 : 2,
|
|
260
239
|
pointRadius: isMobile ? 3 : 4,
|
|
@@ -281,10 +260,10 @@ var RadarChart = (_a) => {
|
|
|
281
260
|
{
|
|
282
261
|
label: "默认",
|
|
283
262
|
data: [0],
|
|
284
|
-
borderColor:
|
|
285
|
-
backgroundColor: `${
|
|
263
|
+
borderColor: defaultColorList[0] || "#1677ff",
|
|
264
|
+
backgroundColor: `${defaultColorList[0] || "#1677ff"}20`,
|
|
286
265
|
borderWidth: isMobile ? 1.5 : 2,
|
|
287
|
-
pointBackgroundColor:
|
|
266
|
+
pointBackgroundColor: defaultColorList[0] || "#1677ff",
|
|
288
267
|
pointBorderColor: "#fff",
|
|
289
268
|
pointBorderWidth: isMobile ? 1 : 2,
|
|
290
269
|
pointRadius: isMobile ? 3 : 4,
|
|
@@ -565,14 +544,20 @@ var RadarChart = (_a) => {
|
|
|
565
544
|
theme: currentConfig.theme
|
|
566
545
|
})
|
|
567
546
|
),
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
},
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
547
|
+
statistics && /* @__PURE__ */ React.createElement(
|
|
548
|
+
"div",
|
|
549
|
+
{
|
|
550
|
+
className: classNames(`${prefixCls}-statistic-container`, hashId)
|
|
551
|
+
},
|
|
552
|
+
statistics.map((config, index) => /* @__PURE__ */ React.createElement(
|
|
553
|
+
ChartStatistic,
|
|
554
|
+
__spreadProps(__spreadValues({
|
|
555
|
+
key: index
|
|
556
|
+
}, config), {
|
|
557
|
+
theme: currentConfig.theme
|
|
558
|
+
})
|
|
559
|
+
))
|
|
560
|
+
),
|
|
576
561
|
/* @__PURE__ */ React.createElement("div", { className: classNames(`${prefixCls}-chart-wrapper`, hashId) }, /* @__PURE__ */ React.createElement(Radar, { ref: chartRef, data: processedData, options }))
|
|
577
562
|
)
|
|
578
563
|
);
|
|
@@ -39,6 +39,14 @@ var genStyle = (token) => {
|
|
|
39
39
|
overflow: "hidden"
|
|
40
40
|
// 防止内容溢出
|
|
41
41
|
},
|
|
42
|
+
// 统计数据容器样式
|
|
43
|
+
[`${token.componentCls}-statistic-container`]: {
|
|
44
|
+
display: "flex",
|
|
45
|
+
gap: "16px",
|
|
46
|
+
marginBottom: "16px",
|
|
47
|
+
flexWrap: "wrap",
|
|
48
|
+
alignItems: "flex-start"
|
|
49
|
+
},
|
|
42
50
|
// 确保图表不会超出容器边界
|
|
43
51
|
canvas: {
|
|
44
52
|
maxWidth: "100% !important",
|
|
@@ -9,26 +9,43 @@ export interface ScatterChartDataItem {
|
|
|
9
9
|
filterLabel?: string;
|
|
10
10
|
}
|
|
11
11
|
export interface ScatterChartProps extends ChartContainerProps {
|
|
12
|
+
/** 扁平化数据数组 */
|
|
12
13
|
data: ScatterChartDataItem[];
|
|
14
|
+
/** 图表标题 */
|
|
13
15
|
title?: string;
|
|
16
|
+
/** 图表宽度,默认600px */
|
|
14
17
|
width?: number | string;
|
|
18
|
+
/** 图表高度,默认400px */
|
|
15
19
|
height?: number | string;
|
|
20
|
+
/** 自定义CSS类名 */
|
|
16
21
|
className?: string;
|
|
22
|
+
/** 数据时间 */
|
|
23
|
+
dataTime?: string;
|
|
24
|
+
/** 自定义主色(可选),支持 string 或 string[];数组按序对应各数据序列 */
|
|
25
|
+
color?: string | string[];
|
|
26
|
+
/** 头部工具条额外按钮 */
|
|
17
27
|
toolbarExtra?: React.ReactNode;
|
|
18
28
|
/** 是否将过滤器渲染到工具栏 */
|
|
19
29
|
renderFilterInToolbar?: boolean;
|
|
20
|
-
|
|
30
|
+
/** X轴单位 */
|
|
21
31
|
xUnit?: string;
|
|
32
|
+
/** Y轴单位 */
|
|
22
33
|
yUnit?: string;
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
/** X轴标签 */
|
|
35
|
+
xAxisLabel?: string;
|
|
36
|
+
/** Y轴标签 */
|
|
37
|
+
yAxisLabel?: string;
|
|
38
|
+
/** X轴位置 */
|
|
39
|
+
xPosition?: 'top' | 'bottom';
|
|
40
|
+
/** Y轴位置 */
|
|
41
|
+
yPosition?: 'left' | 'right';
|
|
25
42
|
/** 是否隐藏X轴,默认false */
|
|
26
43
|
hiddenX?: boolean;
|
|
27
44
|
/** 是否隐藏Y轴,默认false */
|
|
28
45
|
hiddenY?: boolean;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/**
|
|
46
|
+
/** 是否显示网格线,默认true */
|
|
47
|
+
showGrid?: boolean;
|
|
48
|
+
/** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
|
|
32
49
|
statistic?: StatisticConfigType;
|
|
33
50
|
/** 图例文字最大宽度(像素),超出则显示省略号,默认80px */
|
|
34
51
|
textMaxWidth?: number;
|