@ant-design/agentic-ui 2.0.2 → 2.0.4
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/ChatBoot/ButtonTabGroup.js +18 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/plugins/chart/AreaChart/index.d.ts +2 -0
- package/dist/plugins/chart/AreaChart/index.js +18 -2
- package/dist/plugins/chart/BarChart/index.d.ts +5 -0
- package/dist/plugins/chart/BarChart/index.js +111 -6
- package/dist/plugins/chart/FunnelChart/index.d.ts +2 -0
- package/dist/plugins/chart/FunnelChart/index.js +19 -2
- package/dist/plugins/chart/LineChart/index.d.ts +2 -0
- package/dist/plugins/chart/LineChart/index.js +19 -2
- package/dist/plugins/chart/RadarChart/index.d.ts +2 -0
- package/dist/plugins/chart/RadarChart/index.js +19 -2
- package/dist/plugins/chart/ScatterChart/index.d.ts +2 -0
- package/dist/plugins/chart/ScatterChart/index.js +19 -2
- package/dist/plugins/chart/components/ChartFilter/ChartFilter.d.ts +1 -0
- package/dist/plugins/chart/components/ChartFilter/ChartFilter.js +3 -1
- package/dist/plugins/chart/components/ChartFilter/style.js +5 -0
- package/dist/plugins/chart/components/ChartToolBar/ChartToolBar.d.ts +1 -0
- package/dist/plugins/chart/components/ChartToolBar/ChartToolBar.js +3 -2
- package/package.json +1 -1
|
@@ -25,18 +25,26 @@ var ButtonTabGroup = ({
|
|
|
25
25
|
onChange == null ? void 0 : onChange(key);
|
|
26
26
|
};
|
|
27
27
|
return wrapSSR(
|
|
28
|
-
/* @__PURE__ */ React.createElement(
|
|
29
|
-
|
|
28
|
+
/* @__PURE__ */ React.createElement(
|
|
29
|
+
"div",
|
|
30
30
|
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onIconClick: item.onIconClick,
|
|
35
|
-
icon: item.icon,
|
|
36
|
-
className: item.disabled ? `${prefixCls}-item-disabled` : ""
|
|
31
|
+
className: `${prefixCls} ${className || ""} ${hashId}`,
|
|
32
|
+
role: "group",
|
|
33
|
+
"aria-label": "Tab group"
|
|
37
34
|
},
|
|
38
|
-
item.
|
|
39
|
-
|
|
35
|
+
items.map((item) => /* @__PURE__ */ React.createElement(
|
|
36
|
+
ButtonTab,
|
|
37
|
+
{
|
|
38
|
+
key: item.key,
|
|
39
|
+
selected: currentActiveKey === item.key,
|
|
40
|
+
onClick: () => handleTabClick(item.key, item.disabled),
|
|
41
|
+
onIconClick: item.onIconClick,
|
|
42
|
+
icon: item.icon,
|
|
43
|
+
className: item.disabled ? `${prefixCls}-item-disabled` : ""
|
|
44
|
+
},
|
|
45
|
+
item.label
|
|
46
|
+
))
|
|
47
|
+
)
|
|
40
48
|
);
|
|
41
49
|
};
|
|
42
50
|
var ButtonTabGroup_default = ButtonTabGroup;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export * from './AgentRunBar';
|
|
|
4
4
|
export * from './Bubble';
|
|
5
5
|
export * from './Bubble/List';
|
|
6
6
|
export * from './Bubble/type';
|
|
7
|
-
export * from './ChatLayout';
|
|
8
7
|
export * from './ChatBoot';
|
|
8
|
+
export * from './ChatLayout';
|
|
9
9
|
export * from './components/ActionIconBox';
|
|
10
10
|
export * from './components/Button';
|
|
11
11
|
export * from './components/LayoutHeader';
|
package/dist/index.js
CHANGED
|
@@ -4,8 +4,8 @@ export * from "./AgentRunBar";
|
|
|
4
4
|
export * from "./Bubble";
|
|
5
5
|
export * from "./Bubble/List";
|
|
6
6
|
export * from "./Bubble/type";
|
|
7
|
-
export * from "./ChatLayout";
|
|
8
7
|
export * from "./ChatBoot";
|
|
8
|
+
export * from "./ChatLayout";
|
|
9
9
|
export * from "./components/ActionIconBox";
|
|
10
10
|
export * from "./components/Button";
|
|
11
11
|
export * from "./components/LayoutHeader";
|
|
@@ -57,6 +57,8 @@ export interface AreaChartProps extends ChartContainerProps {
|
|
|
57
57
|
hiddenY?: boolean;
|
|
58
58
|
/** 头部工具条额外按钮 */
|
|
59
59
|
toolbarExtra?: React.ReactNode;
|
|
60
|
+
/** 是否将过滤器渲染到工具栏 */
|
|
61
|
+
renderFilterInToolbar?: boolean;
|
|
60
62
|
/** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
|
|
61
63
|
statistic?: StatisticConfigType;
|
|
62
64
|
}
|
|
@@ -103,6 +103,7 @@ var AreaChart = ({
|
|
|
103
103
|
hiddenX = false,
|
|
104
104
|
hiddenY = false,
|
|
105
105
|
toolbarExtra,
|
|
106
|
+
renderFilterInToolbar = false,
|
|
106
107
|
statistic: statisticConfig,
|
|
107
108
|
variant
|
|
108
109
|
}) => {
|
|
@@ -350,11 +351,26 @@ var AreaChart = ({
|
|
|
350
351
|
theme,
|
|
351
352
|
onDownload: handleDownload,
|
|
352
353
|
extra: toolbarExtra,
|
|
353
|
-
dataTime
|
|
354
|
+
dataTime,
|
|
355
|
+
filter: renderFilterInToolbar && filterOptions && filterOptions.length > 1 ? /* @__PURE__ */ React.createElement(
|
|
356
|
+
ChartFilter,
|
|
357
|
+
__spreadProps(__spreadValues({
|
|
358
|
+
filterOptions,
|
|
359
|
+
selectedFilter,
|
|
360
|
+
onFilterChange: setSelectedFilter
|
|
361
|
+
}, filterLabels && {
|
|
362
|
+
customOptions: filteredDataByFilterLabel,
|
|
363
|
+
selectedCustomSelection: selectedFilterLabel,
|
|
364
|
+
onSelectionChange: setSelectedFilterLabel
|
|
365
|
+
}), {
|
|
366
|
+
theme,
|
|
367
|
+
variant: "compact"
|
|
368
|
+
})
|
|
369
|
+
) : void 0
|
|
354
370
|
}
|
|
355
371
|
),
|
|
356
372
|
statisticComponentConfigs && /* @__PURE__ */ React.createElement("div", { className: "chart-statistic-container" }, statisticComponentConfigs.map((config, index) => /* @__PURE__ */ React.createElement(ChartStatistic, __spreadProps(__spreadValues({ key: index }, config), { theme })))),
|
|
357
|
-
/* @__PURE__ */ React.createElement(
|
|
373
|
+
!renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
|
|
358
374
|
ChartFilter,
|
|
359
375
|
__spreadProps(__spreadValues({
|
|
360
376
|
filterOptions,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChartOptions } from 'chart.js';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { ChartContainerProps } from '../components';
|
|
3
4
|
import { StatisticConfigType } from '../hooks/useChartStatistic';
|
|
@@ -66,6 +67,8 @@ export interface BarChartProps extends ChartContainerProps {
|
|
|
66
67
|
indexAxis?: 'x' | 'y';
|
|
67
68
|
/** 头部工具条额外按钮 */
|
|
68
69
|
toolbarExtra?: React.ReactNode;
|
|
70
|
+
/** 是否将过滤器渲染到工具栏 */
|
|
71
|
+
renderFilterInToolbar?: boolean;
|
|
69
72
|
/** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
|
|
70
73
|
statistic?: StatisticConfigType;
|
|
71
74
|
/** 是否显示数据标签,默认false */
|
|
@@ -78,6 +81,8 @@ export interface BarChartProps extends ChartContainerProps {
|
|
|
78
81
|
dataIndex: number;
|
|
79
82
|
datasetIndex: number;
|
|
80
83
|
}) => string;
|
|
84
|
+
/** 外部传入的 Chart.js 选项,会与默认选项合并 */
|
|
85
|
+
chartOptions?: Partial<ChartOptions<'bar'>>;
|
|
81
86
|
}
|
|
82
87
|
declare const BarChart: React.FC<BarChartProps>;
|
|
83
88
|
export default BarChart;
|
|
@@ -87,10 +87,12 @@ var BarChart = ({
|
|
|
87
87
|
stacked = false,
|
|
88
88
|
indexAxis = "x",
|
|
89
89
|
toolbarExtra,
|
|
90
|
+
renderFilterInToolbar = false,
|
|
90
91
|
statistic: statisticConfig,
|
|
91
92
|
variant,
|
|
92
93
|
showDataLabels = false,
|
|
93
|
-
dataLabelFormatter
|
|
94
|
+
dataLabelFormatter,
|
|
95
|
+
chartOptions
|
|
94
96
|
}) => {
|
|
95
97
|
const safeData = Array.isArray(data) ? data : [];
|
|
96
98
|
const [windowWidth, setWindowWidth] = useState(
|
|
@@ -350,10 +352,93 @@ var BarChart = ({
|
|
|
350
352
|
const isLight = theme === "light";
|
|
351
353
|
const axisTextColor = isLight ? "rgba(0, 25, 61, 0.3255)" : "rgba(255, 255, 255, 0.8)";
|
|
352
354
|
const gridColor = isLight ? "rgba(0,0,0,0.08)" : "rgba(255,255,255,0.2)";
|
|
353
|
-
const
|
|
355
|
+
const calculateLabelWidth = (text, fontSize = 11) => {
|
|
356
|
+
const canvas = document.createElement("canvas");
|
|
357
|
+
const context2 = canvas.getContext("2d");
|
|
358
|
+
if (!context2)
|
|
359
|
+
return text.length * fontSize * 0.6;
|
|
360
|
+
context2.font = `${fontSize}px Arial, sans-serif`;
|
|
361
|
+
const metrics = context2.measureText(text);
|
|
362
|
+
return metrics.width;
|
|
363
|
+
};
|
|
364
|
+
const calculateMaxLabelWidth = useMemo(() => {
|
|
365
|
+
if (!showDataLabels || !filteredData.length)
|
|
366
|
+
return 0;
|
|
367
|
+
const fontSize = isMobile ? 10 : 11;
|
|
368
|
+
let maxWidth = 0;
|
|
369
|
+
filteredData.forEach((item) => {
|
|
370
|
+
const value = typeof item.y === "number" ? item.y : Number(item.y);
|
|
371
|
+
if (Number.isFinite(value)) {
|
|
372
|
+
let labelText = "";
|
|
373
|
+
if (dataLabelFormatter) {
|
|
374
|
+
labelText = dataLabelFormatter({
|
|
375
|
+
value,
|
|
376
|
+
label: String(item.x),
|
|
377
|
+
datasetLabel: String(item.type || "默认"),
|
|
378
|
+
dataIndex: 0,
|
|
379
|
+
datasetIndex: 0
|
|
380
|
+
});
|
|
381
|
+
} else {
|
|
382
|
+
labelText = value.toLocaleString();
|
|
383
|
+
}
|
|
384
|
+
const width2 = calculateLabelWidth(labelText, fontSize);
|
|
385
|
+
maxWidth = Math.max(maxWidth, width2);
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
return maxWidth;
|
|
389
|
+
}, [filteredData, showDataLabels, dataLabelFormatter, isMobile]);
|
|
390
|
+
const calculateDynamicPadding = useMemo(() => {
|
|
391
|
+
if (!showDataLabels || calculateMaxLabelWidth === 0)
|
|
392
|
+
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
393
|
+
const basePadding = 8;
|
|
394
|
+
const labelPadding = Math.ceil(calculateMaxLabelWidth);
|
|
395
|
+
if (indexAxis === "y") {
|
|
396
|
+
return {
|
|
397
|
+
top: basePadding,
|
|
398
|
+
right: Math.max(basePadding, labelPadding),
|
|
399
|
+
bottom: basePadding,
|
|
400
|
+
left: basePadding
|
|
401
|
+
};
|
|
402
|
+
} else {
|
|
403
|
+
return {
|
|
404
|
+
top: Math.max(basePadding, labelPadding),
|
|
405
|
+
right: basePadding,
|
|
406
|
+
bottom: basePadding,
|
|
407
|
+
left: basePadding
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
}, [showDataLabels, calculateMaxLabelWidth, indexAxis]);
|
|
411
|
+
const deepMerge = (target, source) => {
|
|
412
|
+
var _a;
|
|
413
|
+
if (!source || typeof source !== "object")
|
|
414
|
+
return source;
|
|
415
|
+
if (!target || typeof target !== "object")
|
|
416
|
+
return source;
|
|
417
|
+
const result = __spreadValues({}, target);
|
|
418
|
+
for (const key in source) {
|
|
419
|
+
if (source.hasOwnProperty(key)) {
|
|
420
|
+
if (typeof source[key] === "object" && source[key] !== null && !Array.isArray(source[key])) {
|
|
421
|
+
if (key === "layout" && source[key].padding && ((_a = target.layout) == null ? void 0 : _a.padding)) {
|
|
422
|
+
result[key] = __spreadProps(__spreadValues(__spreadValues({}, target[key]), source[key]), {
|
|
423
|
+
padding: __spreadValues(__spreadValues({}, target[key].padding), source[key].padding)
|
|
424
|
+
});
|
|
425
|
+
} else {
|
|
426
|
+
result[key] = deepMerge(target[key] || {}, source[key]);
|
|
427
|
+
}
|
|
428
|
+
} else {
|
|
429
|
+
result[key] = source[key];
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return result;
|
|
434
|
+
};
|
|
435
|
+
const defaultOptions = {
|
|
354
436
|
responsive: true,
|
|
355
437
|
maintainAspectRatio: false,
|
|
356
438
|
indexAxis,
|
|
439
|
+
layout: {
|
|
440
|
+
padding: calculateDynamicPadding
|
|
441
|
+
},
|
|
357
442
|
plugins: __spreadValues({
|
|
358
443
|
legend: {
|
|
359
444
|
display: showLegend,
|
|
@@ -387,7 +472,9 @@ var BarChart = ({
|
|
|
387
472
|
const dsIndex = context2.datasetIndex;
|
|
388
473
|
const dIndex = context2.dataIndex;
|
|
389
474
|
const currentStack = (_b = (_a = chart.data.datasets) == null ? void 0 : _a[dsIndex]) == null ? void 0 : _b.stack;
|
|
390
|
-
const currentValue = Number(
|
|
475
|
+
const currentValue = Number(
|
|
476
|
+
(_f = (_e = (_d = (_c = chart.data.datasets) == null ? void 0 : _c[dsIndex]) == null ? void 0 : _d.data) == null ? void 0 : _e[dIndex]) != null ? _f : 0
|
|
477
|
+
);
|
|
391
478
|
const sameStackIndexes = chart.data.datasets.map((_, i) => i).filter((i) => {
|
|
392
479
|
var _a2, _b2, _c2;
|
|
393
480
|
const ds = (_a2 = chart.data.datasets) == null ? void 0 : _a2[i];
|
|
@@ -423,7 +510,9 @@ var BarChart = ({
|
|
|
423
510
|
if (stacked) {
|
|
424
511
|
const chart = context2.chart;
|
|
425
512
|
const datasets = chart.data.datasets;
|
|
426
|
-
const currentValue = Number(
|
|
513
|
+
const currentValue = Number(
|
|
514
|
+
(_d = (_c = (_b = datasets == null ? void 0 : datasets[datasetIndex]) == null ? void 0 : _b.data) == null ? void 0 : _c[dataIndex]) != null ? _d : 0
|
|
515
|
+
);
|
|
427
516
|
const currentStack = (_e = datasets == null ? void 0 : datasets[datasetIndex]) == null ? void 0 : _e.stack;
|
|
428
517
|
let total = 0;
|
|
429
518
|
datasets.forEach((dataset, i) => {
|
|
@@ -521,6 +610,7 @@ var BarChart = ({
|
|
|
521
610
|
}
|
|
522
611
|
}
|
|
523
612
|
};
|
|
613
|
+
const options = chartOptions ? deepMerge(defaultOptions, chartOptions) : defaultOptions;
|
|
524
614
|
const handleDownload = () => {
|
|
525
615
|
downloadChart(chartRef.current, "bar-chart");
|
|
526
616
|
};
|
|
@@ -544,11 +634,26 @@ var BarChart = ({
|
|
|
544
634
|
theme,
|
|
545
635
|
onDownload: handleDownload,
|
|
546
636
|
extra: toolbarExtra,
|
|
547
|
-
dataTime
|
|
637
|
+
dataTime,
|
|
638
|
+
filter: renderFilterInToolbar && filterOptions && filterOptions.length > 1 ? /* @__PURE__ */ React.createElement(
|
|
639
|
+
ChartFilter,
|
|
640
|
+
__spreadProps(__spreadValues({
|
|
641
|
+
filterOptions,
|
|
642
|
+
selectedFilter,
|
|
643
|
+
onFilterChange: setSelectedFilter
|
|
644
|
+
}, filterLabels && {
|
|
645
|
+
customOptions: filteredDataByFilterLabel,
|
|
646
|
+
selectedCustomSelection: selectedFilterLabel,
|
|
647
|
+
onSelectionChange: setSelectedFilterLabel
|
|
648
|
+
}), {
|
|
649
|
+
theme,
|
|
650
|
+
variant: "compact"
|
|
651
|
+
})
|
|
652
|
+
) : void 0
|
|
548
653
|
}
|
|
549
654
|
),
|
|
550
655
|
statisticComponentConfigs && /* @__PURE__ */ React.createElement("div", { className: "chart-statistic-container" }, statisticComponentConfigs.map((config, index) => /* @__PURE__ */ React.createElement(ChartStatistic, __spreadProps(__spreadValues({ key: index }, config), { theme })))),
|
|
551
|
-
/* @__PURE__ */ React.createElement(
|
|
656
|
+
!renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
|
|
552
657
|
ChartFilter,
|
|
553
658
|
__spreadProps(__spreadValues({
|
|
554
659
|
filterOptions,
|
|
@@ -44,6 +44,8 @@ export interface FunnelChartProps extends ChartContainerProps {
|
|
|
44
44
|
showPercent?: boolean;
|
|
45
45
|
/** 头部工具条额外按钮 */
|
|
46
46
|
toolbarExtra?: React.ReactNode;
|
|
47
|
+
/** 是否将过滤器渲染到工具栏 */
|
|
48
|
+
renderFilterInToolbar?: boolean;
|
|
47
49
|
typeNames?: {
|
|
48
50
|
rate?: string;
|
|
49
51
|
/** 类型名称,用于图例和数据集标签 */
|
|
@@ -70,6 +70,7 @@ var FunnelChart = (_a) => {
|
|
|
70
70
|
legendAlign = "start",
|
|
71
71
|
showPercent = true,
|
|
72
72
|
toolbarExtra,
|
|
73
|
+
renderFilterInToolbar = false,
|
|
73
74
|
typeNames,
|
|
74
75
|
statistic
|
|
75
76
|
} = _b, props = __objRest(_b, [
|
|
@@ -86,6 +87,7 @@ var FunnelChart = (_a) => {
|
|
|
86
87
|
"legendAlign",
|
|
87
88
|
"showPercent",
|
|
88
89
|
"toolbarExtra",
|
|
90
|
+
"renderFilterInToolbar",
|
|
89
91
|
"typeNames",
|
|
90
92
|
"statistic"
|
|
91
93
|
]);
|
|
@@ -552,10 +554,25 @@ var FunnelChart = (_a) => {
|
|
|
552
554
|
theme,
|
|
553
555
|
onDownload: handleDownload,
|
|
554
556
|
dataTime,
|
|
555
|
-
extra: toolbarExtra
|
|
557
|
+
extra: toolbarExtra,
|
|
558
|
+
filter: renderFilterInToolbar && filterOptions && filterOptions.length > 1 ? /* @__PURE__ */ React.createElement(
|
|
559
|
+
ChartFilter,
|
|
560
|
+
__spreadProps(__spreadValues({
|
|
561
|
+
filterOptions,
|
|
562
|
+
selectedFilter,
|
|
563
|
+
onFilterChange: setSelectedFilter
|
|
564
|
+
}, customOptions && {
|
|
565
|
+
customOptions,
|
|
566
|
+
selectedCustomSelection: selectedFilterLabel,
|
|
567
|
+
onSelectionChange: setSelectedFilterLabel
|
|
568
|
+
}), {
|
|
569
|
+
theme,
|
|
570
|
+
variant: "compact"
|
|
571
|
+
})
|
|
572
|
+
) : void 0
|
|
556
573
|
}
|
|
557
574
|
),
|
|
558
|
-
/* @__PURE__ */ React.createElement(
|
|
575
|
+
!renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
|
|
559
576
|
ChartFilter,
|
|
560
577
|
__spreadProps(__spreadValues({
|
|
561
578
|
filterOptions,
|
|
@@ -57,6 +57,8 @@ export interface LineChartProps extends ChartContainerProps {
|
|
|
57
57
|
hiddenY?: boolean;
|
|
58
58
|
/** 头部工具条额外按钮 */
|
|
59
59
|
toolbarExtra?: React.ReactNode;
|
|
60
|
+
/** 是否将过滤器渲染到工具栏 */
|
|
61
|
+
renderFilterInToolbar?: boolean;
|
|
60
62
|
/** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
|
|
61
63
|
statistic?: StatisticConfigType;
|
|
62
64
|
}
|
|
@@ -98,6 +98,7 @@ var LineChart = (_a) => {
|
|
|
98
98
|
hiddenX = false,
|
|
99
99
|
hiddenY = false,
|
|
100
100
|
toolbarExtra,
|
|
101
|
+
renderFilterInToolbar = false,
|
|
101
102
|
statistic: statisticConfig
|
|
102
103
|
} = _b, props = __objRest(_b, [
|
|
103
104
|
"title",
|
|
@@ -117,6 +118,7 @@ var LineChart = (_a) => {
|
|
|
117
118
|
"hiddenX",
|
|
118
119
|
"hiddenY",
|
|
119
120
|
"toolbarExtra",
|
|
121
|
+
"renderFilterInToolbar",
|
|
120
122
|
"statistic"
|
|
121
123
|
]);
|
|
122
124
|
const safeData = Array.isArray(data) ? data : [];
|
|
@@ -352,11 +354,26 @@ var LineChart = (_a) => {
|
|
|
352
354
|
theme,
|
|
353
355
|
onDownload: handleDownload,
|
|
354
356
|
extra: toolbarExtra,
|
|
355
|
-
dataTime
|
|
357
|
+
dataTime,
|
|
358
|
+
filter: renderFilterInToolbar && filterOptions && filterOptions.length > 1 ? /* @__PURE__ */ React.createElement(
|
|
359
|
+
ChartFilter,
|
|
360
|
+
__spreadProps(__spreadValues({
|
|
361
|
+
filterOptions,
|
|
362
|
+
selectedFilter,
|
|
363
|
+
onFilterChange: setSelectedFilter
|
|
364
|
+
}, filterLabels && {
|
|
365
|
+
customOptions: filteredDataByFilterLabel,
|
|
366
|
+
selectedCustomSelection: selectedFilterLabel,
|
|
367
|
+
onSelectionChange: setSelectedFilterLabel
|
|
368
|
+
}), {
|
|
369
|
+
theme,
|
|
370
|
+
variant: "compact"
|
|
371
|
+
})
|
|
372
|
+
) : void 0
|
|
356
373
|
}
|
|
357
374
|
),
|
|
358
375
|
statisticComponentConfigs && /* @__PURE__ */ React.createElement("div", { className: "chart-statistic-container" }, statisticComponentConfigs.map((config, index) => /* @__PURE__ */ React.createElement(ChartStatistic, __spreadProps(__spreadValues({ key: index }, config), { theme })))),
|
|
359
|
-
/* @__PURE__ */ React.createElement(
|
|
376
|
+
!renderFilterInToolbar && filterOptions && filterOptions.length > 1 && /* @__PURE__ */ React.createElement(
|
|
360
377
|
ChartFilter,
|
|
361
378
|
__spreadProps(__spreadValues({
|
|
362
379
|
filterOptions,
|
|
@@ -15,6 +15,8 @@ interface RadarChartProps extends ChartContainerProps {
|
|
|
15
15
|
height?: number | string;
|
|
16
16
|
className?: string;
|
|
17
17
|
toolbarExtra?: React.ReactNode;
|
|
18
|
+
/** 是否将过滤器渲染到工具栏 */
|
|
19
|
+
renderFilterInToolbar?: boolean;
|
|
18
20
|
dataTime?: string;
|
|
19
21
|
borderColor?: string;
|
|
20
22
|
backgroundColor?: string;
|
|
@@ -93,6 +93,7 @@ var RadarChart = (_a) => {
|
|
|
93
93
|
height = 400,
|
|
94
94
|
className,
|
|
95
95
|
toolbarExtra,
|
|
96
|
+
renderFilterInToolbar = false,
|
|
96
97
|
dataTime,
|
|
97
98
|
borderColor,
|
|
98
99
|
backgroundColor,
|
|
@@ -106,6 +107,7 @@ var RadarChart = (_a) => {
|
|
|
106
107
|
"height",
|
|
107
108
|
"className",
|
|
108
109
|
"toolbarExtra",
|
|
110
|
+
"renderFilterInToolbar",
|
|
109
111
|
"dataTime",
|
|
110
112
|
"borderColor",
|
|
111
113
|
"backgroundColor",
|
|
@@ -531,10 +533,25 @@ var RadarChart = (_a) => {
|
|
|
531
533
|
title: title || "雷达图",
|
|
532
534
|
onDownload: handleDownload,
|
|
533
535
|
extra: toolbarExtra,
|
|
534
|
-
dataTime
|
|
536
|
+
dataTime,
|
|
537
|
+
filter: renderFilterInToolbar && filterEnum.length > 0 ? /* @__PURE__ */ React.createElement(
|
|
538
|
+
ChartFilter,
|
|
539
|
+
__spreadProps(__spreadValues({
|
|
540
|
+
filterOptions: filterEnum,
|
|
541
|
+
selectedFilter,
|
|
542
|
+
onFilterChange: setSelectedFilter
|
|
543
|
+
}, filterLabels && {
|
|
544
|
+
customOptions: filteredDataByFilterLabel,
|
|
545
|
+
selectedCustomSelection: selectedFilterLabel,
|
|
546
|
+
onSelectionChange: setSelectedFilterLabel
|
|
547
|
+
}), {
|
|
548
|
+
theme: currentConfig.theme,
|
|
549
|
+
variant: "compact"
|
|
550
|
+
})
|
|
551
|
+
) : void 0
|
|
535
552
|
}
|
|
536
553
|
),
|
|
537
|
-
filterEnum.length > 0 && /* @__PURE__ */ React.createElement(
|
|
554
|
+
!renderFilterInToolbar && filterEnum.length > 0 && /* @__PURE__ */ React.createElement(
|
|
538
555
|
ChartFilter,
|
|
539
556
|
__spreadProps(__spreadValues({
|
|
540
557
|
filterOptions: filterEnum,
|
|
@@ -15,6 +15,8 @@ export interface ScatterChartProps extends ChartContainerProps {
|
|
|
15
15
|
height?: number | string;
|
|
16
16
|
className?: string;
|
|
17
17
|
toolbarExtra?: React.ReactNode;
|
|
18
|
+
/** 是否将过滤器渲染到工具栏 */
|
|
19
|
+
renderFilterInToolbar?: boolean;
|
|
18
20
|
dataTime?: string;
|
|
19
21
|
xUnit?: string;
|
|
20
22
|
yUnit?: string;
|
|
@@ -75,6 +75,7 @@ var ScatterChart = (_a) => {
|
|
|
75
75
|
className,
|
|
76
76
|
title,
|
|
77
77
|
toolbarExtra,
|
|
78
|
+
renderFilterInToolbar = false,
|
|
78
79
|
dataTime,
|
|
79
80
|
xUnit = "月",
|
|
80
81
|
yUnit,
|
|
@@ -93,6 +94,7 @@ var ScatterChart = (_a) => {
|
|
|
93
94
|
"className",
|
|
94
95
|
"title",
|
|
95
96
|
"toolbarExtra",
|
|
97
|
+
"renderFilterInToolbar",
|
|
96
98
|
"dataTime",
|
|
97
99
|
"xUnit",
|
|
98
100
|
"yUnit",
|
|
@@ -567,10 +569,25 @@ var ScatterChart = (_a) => {
|
|
|
567
569
|
title: title || "散点图",
|
|
568
570
|
onDownload: handleDownload,
|
|
569
571
|
extra: toolbarExtra,
|
|
570
|
-
dataTime
|
|
572
|
+
dataTime,
|
|
573
|
+
filter: renderFilterInToolbar && filterEnum.length > 0 ? /* @__PURE__ */ React.createElement(
|
|
574
|
+
ChartFilter,
|
|
575
|
+
__spreadProps(__spreadValues({
|
|
576
|
+
filterOptions: filterEnum,
|
|
577
|
+
selectedFilter,
|
|
578
|
+
onFilterChange: setSelectedFilter
|
|
579
|
+
}, filterLabels && {
|
|
580
|
+
customOptions: filteredDataByFilterLabel,
|
|
581
|
+
selectedCustomSelection: selectedFilterLabel,
|
|
582
|
+
onSelectionChange: setSelectedFilterLabel
|
|
583
|
+
}), {
|
|
584
|
+
theme: currentConfig.theme,
|
|
585
|
+
variant: "compact"
|
|
586
|
+
})
|
|
587
|
+
) : void 0
|
|
571
588
|
}
|
|
572
589
|
),
|
|
573
|
-
filterEnum.length > 0 && /* @__PURE__ */ React.createElement(
|
|
590
|
+
!renderFilterInToolbar && filterEnum.length > 0 && /* @__PURE__ */ React.createElement(
|
|
574
591
|
ChartFilter,
|
|
575
592
|
__spreadProps(__spreadValues({
|
|
576
593
|
filterOptions: filterEnum,
|
|
@@ -16,6 +16,7 @@ export interface ChartFilterProps {
|
|
|
16
16
|
onSelectionChange?: (region: string) => void;
|
|
17
17
|
className?: string;
|
|
18
18
|
theme?: 'light' | 'dark';
|
|
19
|
+
variant?: 'default' | 'compact';
|
|
19
20
|
}
|
|
20
21
|
declare const ChartFilter: React.FC<ChartFilterProps>;
|
|
21
22
|
export default ChartFilter;
|
|
@@ -13,7 +13,8 @@ var ChartFilter = ({
|
|
|
13
13
|
selectedCustomSelection,
|
|
14
14
|
onSelectionChange,
|
|
15
15
|
className = "",
|
|
16
|
-
theme = "light"
|
|
16
|
+
theme = "light",
|
|
17
|
+
variant = "default"
|
|
17
18
|
}) => {
|
|
18
19
|
var _a, _b;
|
|
19
20
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
@@ -40,6 +41,7 @@ var ChartFilter = ({
|
|
|
40
41
|
className: classNames(
|
|
41
42
|
prefixCls,
|
|
42
43
|
`${prefixCls}-${theme}`,
|
|
44
|
+
`${prefixCls}-${variant}`,
|
|
43
45
|
hashId,
|
|
44
46
|
className
|
|
45
47
|
)
|
|
@@ -12,7 +12,8 @@ var ChartToolBar = ({
|
|
|
12
12
|
className = "",
|
|
13
13
|
theme = "light",
|
|
14
14
|
onDownload,
|
|
15
|
-
extra
|
|
15
|
+
extra,
|
|
16
|
+
filter
|
|
16
17
|
}) => {
|
|
17
18
|
var _a, _b;
|
|
18
19
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
@@ -44,7 +45,7 @@ var ChartToolBar = ({
|
|
|
44
45
|
{
|
|
45
46
|
className: classNames(`${prefixCls}-time-icon`, hashId)
|
|
46
47
|
}
|
|
47
|
-
), /* @__PURE__ */ React.createElement("span", { className: classNames(`${prefixCls}-data-time`, hashId) }, ((_a = i18n == null ? void 0 : i18n.locale) == null ? void 0 : _a.dataTime) || "数据时间", ": ", dataTime)) : null, extra, handleDownload ? /* @__PURE__ */ React.createElement(
|
|
48
|
+
), /* @__PURE__ */ React.createElement("span", { className: classNames(`${prefixCls}-data-time`, hashId) }, ((_a = i18n == null ? void 0 : i18n.locale) == null ? void 0 : _a.dataTime) || "数据时间", ": ", dataTime)) : null, filter, extra, handleDownload ? /* @__PURE__ */ React.createElement(
|
|
48
49
|
Tooltip,
|
|
49
50
|
{
|
|
50
51
|
mouseEnterDelay: 0.3,
|