@ant-design/agentic-ui 2.30.2 → 2.30.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/Hooks/useLanguage.d.ts +3 -0
- package/dist/I18n/locales.d.ts +3 -0
- package/dist/I18n/locales.js +6 -0
- package/dist/MarkdownRenderer/CharacterQueue.js +9 -1
- package/dist/MarkdownRenderer/MarkdownRenderer.js +11 -3
- package/dist/MarkdownRenderer/types.d.ts +6 -0
- package/dist/MarkdownRenderer/useMarkdownToReact.js +3 -1
- package/dist/Plugins/chart/AreaChart/index.js +4 -3
- package/dist/Plugins/chart/BarChart/index.js +3 -3
- 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/package.json +2 -1
|
@@ -6,6 +6,9 @@ function _array_like_to_array(arr, len) {
|
|
|
6
6
|
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
|
+
}
|
|
9
12
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
10
13
|
try {
|
|
11
14
|
var info = gen[key](arg);
|
|
@@ -48,6 +51,9 @@ function _define_property(obj, key, value) {
|
|
|
48
51
|
}
|
|
49
52
|
return obj;
|
|
50
53
|
}
|
|
54
|
+
function _iterable_to_array(iter) {
|
|
55
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
56
|
+
}
|
|
51
57
|
function _iterable_to_array_limit(arr, i) {
|
|
52
58
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
53
59
|
if (_i == null) return;
|
|
@@ -75,6 +81,9 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
75
81
|
function _non_iterable_rest() {
|
|
76
82
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
77
83
|
}
|
|
84
|
+
function _non_iterable_spread() {
|
|
85
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
86
|
+
}
|
|
78
87
|
function _object_spread(target) {
|
|
79
88
|
for(var i = 1; i < arguments.length; i++){
|
|
80
89
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
@@ -117,6 +126,9 @@ function _object_spread_props(target, source) {
|
|
|
117
126
|
function _sliced_to_array(arr, i) {
|
|
118
127
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
119
128
|
}
|
|
129
|
+
function _to_consumable_array(arr) {
|
|
130
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
131
|
+
}
|
|
120
132
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
121
133
|
if (!o) return;
|
|
122
134
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -224,9 +236,10 @@ function _ts_generator(thisArg, body) {
|
|
|
224
236
|
};
|
|
225
237
|
}
|
|
226
238
|
}
|
|
227
|
-
import { DownOutlined, SettingOutlined } from "@ant-design/icons";
|
|
239
|
+
import { CopyOutlined, DownOutlined, SettingOutlined } from "@ant-design/icons";
|
|
228
240
|
import { ProForm, ProFormSelect } from "@ant-design/pro-components";
|
|
229
|
-
import { ConfigProvider, Descriptions, Dropdown, Popover, Table } from "antd";
|
|
241
|
+
import { ConfigProvider, Descriptions, Dropdown, message, Popover, Table } from "antd";
|
|
242
|
+
import copy from "copy-to-clipboard";
|
|
230
243
|
import React, { lazy, Suspense, useContext, useMemo, useState } from "react";
|
|
231
244
|
import { ActionIconBox } from "../../Components/ActionIconBox";
|
|
232
245
|
import { Loading } from "../../Components/Loading";
|
|
@@ -260,7 +273,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
260
273
|
*
|
|
261
274
|
* @since 1.0.0
|
|
262
275
|
*/ var getChartMap = function getChartMap(i18n) {
|
|
263
|
-
var _i18n_locale, _i18n_locale1, _i18n_locale2, _i18n_locale3, _i18n_locale4, _i18n_locale5, _i18n_locale6, _i18n_locale7, _i18n_locale8, _i18n_locale9, _i18n_locale10;
|
|
276
|
+
var _i18n_locale, _i18n_locale1, _i18n_locale2, _i18n_locale3, _i18n_locale4, _i18n_locale5, _i18n_locale6, _i18n_locale7, _i18n_locale8, _i18n_locale9, _i18n_locale10, _i18n_locale11, _i18n_locale12;
|
|
264
277
|
return {
|
|
265
278
|
pie: {
|
|
266
279
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.pieChart) || '饼图',
|
|
@@ -282,6 +295,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
282
295
|
'column',
|
|
283
296
|
'line',
|
|
284
297
|
'area',
|
|
298
|
+
'histogram',
|
|
299
|
+
'boxplot',
|
|
285
300
|
'table'
|
|
286
301
|
]
|
|
287
302
|
},
|
|
@@ -291,6 +306,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
291
306
|
'column',
|
|
292
307
|
'bar',
|
|
293
308
|
'area',
|
|
309
|
+
'histogram',
|
|
310
|
+
'boxplot',
|
|
294
311
|
'table'
|
|
295
312
|
]
|
|
296
313
|
},
|
|
@@ -300,6 +317,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
300
317
|
'bar',
|
|
301
318
|
'line',
|
|
302
319
|
'area',
|
|
320
|
+
'histogram',
|
|
321
|
+
'boxplot',
|
|
303
322
|
'table'
|
|
304
323
|
]
|
|
305
324
|
},
|
|
@@ -309,6 +328,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
309
328
|
'column',
|
|
310
329
|
'bar',
|
|
311
330
|
'line',
|
|
331
|
+
'histogram',
|
|
332
|
+
'boxplot',
|
|
312
333
|
'table'
|
|
313
334
|
]
|
|
314
335
|
},
|
|
@@ -321,6 +342,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
321
342
|
scatter: {
|
|
322
343
|
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale7 = i18n.locale) === null || _i18n_locale7 === void 0 ? void 0 : _i18n_locale7.scatterChart) || '散点图',
|
|
323
344
|
changeData: [
|
|
345
|
+
'histogram',
|
|
346
|
+
'boxplot',
|
|
324
347
|
'table'
|
|
325
348
|
]
|
|
326
349
|
},
|
|
@@ -330,8 +353,26 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
330
353
|
'table'
|
|
331
354
|
]
|
|
332
355
|
},
|
|
356
|
+
boxplot: {
|
|
357
|
+
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale9 = i18n.locale) === null || _i18n_locale9 === void 0 ? void 0 : _i18n_locale9.boxplotChart) || '箱线图',
|
|
358
|
+
changeData: [
|
|
359
|
+
'histogram',
|
|
360
|
+
'column',
|
|
361
|
+
'bar',
|
|
362
|
+
'table'
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
histogram: {
|
|
366
|
+
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale10 = i18n.locale) === null || _i18n_locale10 === void 0 ? void 0 : _i18n_locale10.histogramChart) || '直方图',
|
|
367
|
+
changeData: [
|
|
368
|
+
'boxplot',
|
|
369
|
+
'column',
|
|
370
|
+
'bar',
|
|
371
|
+
'table'
|
|
372
|
+
]
|
|
373
|
+
},
|
|
333
374
|
table: {
|
|
334
|
-
title: (i18n === null || i18n === void 0 ? void 0 : (
|
|
375
|
+
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale11 = i18n.locale) === null || _i18n_locale11 === void 0 ? void 0 : _i18n_locale11.table) || '表格',
|
|
335
376
|
changeData: [
|
|
336
377
|
'column',
|
|
337
378
|
'line',
|
|
@@ -341,11 +382,13 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
341
382
|
'bar',
|
|
342
383
|
'radar',
|
|
343
384
|
'scatter',
|
|
344
|
-
'funnel'
|
|
385
|
+
'funnel',
|
|
386
|
+
'boxplot',
|
|
387
|
+
'histogram'
|
|
345
388
|
]
|
|
346
389
|
},
|
|
347
390
|
descriptions: {
|
|
348
|
-
title: (i18n === null || i18n === void 0 ? void 0 : (
|
|
391
|
+
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale12 = i18n.locale) === null || _i18n_locale12 === void 0 ? void 0 : _i18n_locale12.descriptions) || '定义列表',
|
|
349
392
|
changeData: [
|
|
350
393
|
'column',
|
|
351
394
|
'line',
|
|
@@ -361,9 +404,9 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
361
404
|
* 图表运行时渲染器组件实现
|
|
362
405
|
* 负责使用已加载的 runtime 渲染图表
|
|
363
406
|
*/ var ChartRuntimeRendererImpl = function ChartRuntimeRendererImpl(param) {
|
|
364
|
-
var chartType = param.chartType, runtime = param.runtime, convertDonutData = param.convertDonutData, convertFlatData = param.convertFlatData, config = param.config, title = param.title, dataTime = param.dataTime, toolBar = param.toolBar, filterBy = param.filterBy, groupBy = param.groupBy, colorLegend = param.colorLegend, chartData = param.chartData, getFieldValue = param.getFieldValue, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading;
|
|
407
|
+
var chartType = param.chartType, runtime = param.runtime, convertDonutData = param.convertDonutData, convertFlatData = param.convertFlatData, config = param.config, title = param.title, dataTime = param.dataTime, toolBar = param.toolBar, filterBy = param.filterBy, groupBy = param.groupBy, colorLegend = param.colorLegend, chartData = param.chartData, getFieldValue = param.getFieldValue, getFieldValueSafely = param.getFieldValueSafely, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading;
|
|
365
408
|
var i18n = useContext(I18nContext);
|
|
366
|
-
var DonutChart = runtime.DonutChart, FunnelChart = runtime.FunnelChart, AreaChart = runtime.AreaChart, BarChart = runtime.BarChart, LineChart = runtime.LineChart, RadarChart = runtime.RadarChart, ScatterChart = runtime.ScatterChart;
|
|
409
|
+
var DonutChart = runtime.DonutChart, FunnelChart = runtime.FunnelChart, AreaChart = runtime.AreaChart, BarChart = runtime.BarChart, BoxPlotChart = runtime.BoxPlotChart, HistogramChart = runtime.HistogramChart, LineChart = runtime.LineChart, RadarChart = runtime.RadarChart, ScatterChart = runtime.ScatterChart;
|
|
367
410
|
if (chartType === 'pie') {
|
|
368
411
|
return /*#__PURE__*/ React.createElement(DonutChart, {
|
|
369
412
|
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-pie"),
|
|
@@ -558,6 +601,84 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
558
601
|
loading: loading
|
|
559
602
|
});
|
|
560
603
|
}
|
|
604
|
+
if (chartType === 'boxplot') {
|
|
605
|
+
// 箱线图数据转换:将原始数据按标签分组
|
|
606
|
+
var boxplotData = [];
|
|
607
|
+
var groupedByLabel = {};
|
|
608
|
+
(chartData || []).forEach(function(row) {
|
|
609
|
+
var label = getFieldValue(row, config === null || config === void 0 ? void 0 : config.x) || '默认';
|
|
610
|
+
var value = getFieldValueSafely(row, config === null || config === void 0 ? void 0 : config.y);
|
|
611
|
+
var type = getFieldValue(row, colorLegend);
|
|
612
|
+
var category = getFieldValue(row, groupBy);
|
|
613
|
+
// filterLabel 用于未来扩展,暂不使用
|
|
614
|
+
var key = "".concat(label, "_").concat(type || 'default');
|
|
615
|
+
if (!groupedByLabel[key]) {
|
|
616
|
+
groupedByLabel[key] = {
|
|
617
|
+
values: [],
|
|
618
|
+
type: type || undefined,
|
|
619
|
+
category: category || undefined
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
var numValue = typeof value === 'number' ? value : toNumber(value, Number.NaN);
|
|
623
|
+
if (Number.isFinite(numValue)) {
|
|
624
|
+
groupedByLabel[key].values.push(numValue);
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
Object.entries(groupedByLabel).forEach(function(param) {
|
|
628
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], data = _param[1];
|
|
629
|
+
var label = key.split('_')[0];
|
|
630
|
+
if (data.values.length > 0) {
|
|
631
|
+
boxplotData.push(_object_spread({
|
|
632
|
+
label: label,
|
|
633
|
+
values: data.values
|
|
634
|
+
}, data.type ? {
|
|
635
|
+
type: data.type
|
|
636
|
+
} : {}, data.category ? {
|
|
637
|
+
category: data.category
|
|
638
|
+
} : {}));
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
return /*#__PURE__*/ React.createElement(BoxPlotChart, {
|
|
642
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-boxplot"),
|
|
643
|
+
data: boxplotData,
|
|
644
|
+
height: (config === null || config === void 0 ? void 0 : config.height) || 400,
|
|
645
|
+
title: title || '',
|
|
646
|
+
dataTime: dataTime,
|
|
647
|
+
toolbarExtra: toolBar,
|
|
648
|
+
loading: loading
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
if (chartType === 'histogram') {
|
|
652
|
+
var _ref8;
|
|
653
|
+
var _config_rest10;
|
|
654
|
+
// 直方图数据转换:提取原始值
|
|
655
|
+
var histogramData = (chartData || []).map(function(row) {
|
|
656
|
+
var value = getFieldValueSafely(row, config === null || config === void 0 ? void 0 : config.y);
|
|
657
|
+
var type = getFieldValue(row, colorLegend);
|
|
658
|
+
var category = getFieldValue(row, groupBy);
|
|
659
|
+
var filterLabel = getFieldValue(row, filterBy);
|
|
660
|
+
var numValue = typeof value === 'number' ? value : toNumber(value, Number.NaN);
|
|
661
|
+
return _object_spread({
|
|
662
|
+
value: Number.isFinite(numValue) ? numValue : 0
|
|
663
|
+
}, type ? {
|
|
664
|
+
type: type
|
|
665
|
+
} : {}, category ? {
|
|
666
|
+
category: category
|
|
667
|
+
} : {}, filterLabel ? {
|
|
668
|
+
filterLabel: filterLabel
|
|
669
|
+
} : {});
|
|
670
|
+
});
|
|
671
|
+
return /*#__PURE__*/ React.createElement(HistogramChart, {
|
|
672
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-histogram"),
|
|
673
|
+
data: histogramData,
|
|
674
|
+
height: (config === null || config === void 0 ? void 0 : config.height) || 400,
|
|
675
|
+
title: title || '',
|
|
676
|
+
stacked: (_ref8 = config === null || config === void 0 ? void 0 : (_config_rest10 = config.rest) === null || _config_rest10 === void 0 ? void 0 : _config_rest10.stacked) !== null && _ref8 !== void 0 ? _ref8 : true,
|
|
677
|
+
dataTime: dataTime,
|
|
678
|
+
toolbarExtra: toolBar,
|
|
679
|
+
loading: loading
|
|
680
|
+
});
|
|
681
|
+
}
|
|
561
682
|
return null;
|
|
562
683
|
};
|
|
563
684
|
/**
|
|
@@ -887,9 +1008,53 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
887
1008
|
]);
|
|
888
1009
|
var chartConfigFormPrefixCls = (_getPrefixCls = getPrefixCls('agentic-chart-config-form')) !== null && _getPrefixCls !== void 0 ? _getPrefixCls : 'ant-agentic-chart-config-form';
|
|
889
1010
|
/**
|
|
1011
|
+
* 将表格数据转换为 Markdown 格式
|
|
1012
|
+
*/ var generateMarkdownTable = function generateMarkdownTable() {
|
|
1013
|
+
var columns = (config === null || config === void 0 ? void 0 : config.columns) || [];
|
|
1014
|
+
var data = chartData || [];
|
|
1015
|
+
if (columns.length === 0 || data.length === 0) {
|
|
1016
|
+
return '';
|
|
1017
|
+
}
|
|
1018
|
+
// 表头
|
|
1019
|
+
var headerRow = columns.filter(function(col) {
|
|
1020
|
+
return col === null || col === void 0 ? void 0 : col.title;
|
|
1021
|
+
}).map(function(col) {
|
|
1022
|
+
return col.title;
|
|
1023
|
+
}).join(' | ');
|
|
1024
|
+
// 分隔行
|
|
1025
|
+
var separatorRow = columns.filter(function(col) {
|
|
1026
|
+
return col === null || col === void 0 ? void 0 : col.title;
|
|
1027
|
+
}).map(function() {
|
|
1028
|
+
return '---';
|
|
1029
|
+
}).join(' | ');
|
|
1030
|
+
// 数据行
|
|
1031
|
+
var dataRows = data.map(function(row) {
|
|
1032
|
+
return columns.filter(function(col) {
|
|
1033
|
+
return col === null || col === void 0 ? void 0 : col.title;
|
|
1034
|
+
}).map(function(col) {
|
|
1035
|
+
var value = row[col.dataIndex];
|
|
1036
|
+
return value !== undefined && value !== null ? String(value) : '';
|
|
1037
|
+
}).join(' | ');
|
|
1038
|
+
});
|
|
1039
|
+
return [
|
|
1040
|
+
headerRow,
|
|
1041
|
+
separatorRow
|
|
1042
|
+
].concat(_to_consumable_array(dataRows)).join('\n');
|
|
1043
|
+
};
|
|
1044
|
+
/**
|
|
1045
|
+
* 复制表格 Markdown
|
|
1046
|
+
*/ var handleCopyMarkdown = function handleCopyMarkdown() {
|
|
1047
|
+
var markdown = generateMarkdownTable();
|
|
1048
|
+
if (markdown) {
|
|
1049
|
+
var _i18n_locale;
|
|
1050
|
+
copy(markdown);
|
|
1051
|
+
message.success((i18n === null || i18n === void 0 ? void 0 : (_i18n_locale = i18n.locale) === null || _i18n_locale === void 0 ? void 0 : _i18n_locale.copySuccess) || '复制成功');
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
/**
|
|
890
1055
|
* 图表配置
|
|
891
1056
|
*/ var toolBar = useMemo(function() {
|
|
892
|
-
var _ChartMap_chartType_changeData, _ChartMap_chartType, _ChartMap_chartType1, _i18n_locale, _i18n_locale1, _i18n_locale2, _config_columns_filter, _config_columns, _config_columns_filter1, _config_columns1, _i18n_locale3;
|
|
1057
|
+
var _ChartMap_chartType_changeData, _ChartMap_chartType, _ChartMap_chartType1, _i18n_locale, _i18n_locale1, _i18n_locale2, _config_columns_filter, _config_columns, _config_columns_filter1, _config_columns1, _i18n_locale3, _i18n_locale4;
|
|
893
1058
|
return [
|
|
894
1059
|
/*#__PURE__*/ React.createElement(Dropdown, {
|
|
895
1060
|
key: "dropdown",
|
|
@@ -1037,7 +1202,16 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
1037
1202
|
style: {
|
|
1038
1203
|
color: 'rgba(0, 25, 61, 0.3255)'
|
|
1039
1204
|
}
|
|
1040
|
-
})))
|
|
1205
|
+
}))),
|
|
1206
|
+
/*#__PURE__*/ React.createElement(ActionIconBox, {
|
|
1207
|
+
key: "copy-markdown",
|
|
1208
|
+
title: (i18n === null || i18n === void 0 ? void 0 : (_i18n_locale4 = i18n.locale) === null || _i18n_locale4 === void 0 ? void 0 : _i18n_locale4.copyMarkdown) || '复制表格'
|
|
1209
|
+
}, /*#__PURE__*/ React.createElement(CopyOutlined, {
|
|
1210
|
+
style: {
|
|
1211
|
+
color: 'rgba(0, 25, 61, 0.3255)'
|
|
1212
|
+
},
|
|
1213
|
+
onClick: handleCopyMarkdown
|
|
1214
|
+
}))
|
|
1041
1215
|
].filter(function(item) {
|
|
1042
1216
|
return !!item;
|
|
1043
1217
|
});
|
|
@@ -1050,7 +1224,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
1050
1224
|
onColumnLengthChange,
|
|
1051
1225
|
config,
|
|
1052
1226
|
props.config,
|
|
1053
|
-
chartConfigFormPrefixCls
|
|
1227
|
+
chartConfigFormPrefixCls,
|
|
1228
|
+
chartData
|
|
1054
1229
|
]);
|
|
1055
1230
|
var chartDom = useMemo(function() {
|
|
1056
1231
|
var _window;
|
|
@@ -1183,7 +1358,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
1183
1358
|
groupBy: groupBy,
|
|
1184
1359
|
colorLegend: colorLegend,
|
|
1185
1360
|
chartData: chartData,
|
|
1186
|
-
getFieldValue: getFieldValue
|
|
1361
|
+
getFieldValue: getFieldValue,
|
|
1362
|
+
getFieldValueSafely: getFieldValueSafely
|
|
1187
1363
|
}));
|
|
1188
1364
|
}
|
|
1189
1365
|
return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DonutChartData } from './types';
|
|
3
|
-
interface
|
|
3
|
+
export interface DonutLegendProps {
|
|
4
4
|
chartData: DonutChartData[];
|
|
5
5
|
backgroundColors: string[];
|
|
6
6
|
/** 按图索引维护的隐藏集合 */
|
|
@@ -12,6 +12,8 @@ interface LegendProps {
|
|
|
12
12
|
baseClassName: string;
|
|
13
13
|
hashId: string;
|
|
14
14
|
isMobile: boolean;
|
|
15
|
+
/** 与 ChartContainer / 图表 theme 一致,用于图例文字与分页按钮 */
|
|
16
|
+
theme?: 'light' | 'dark';
|
|
15
17
|
}
|
|
16
|
-
declare const
|
|
17
|
-
export default
|
|
18
|
+
declare const DonutChartLegend: React.FC<DonutLegendProps>;
|
|
19
|
+
export default DonutChartLegend;
|
|
@@ -72,12 +72,18 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
72
72
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
73
73
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
74
74
|
}
|
|
75
|
+
import clsx from "clsx";
|
|
75
76
|
import React, { useEffect, useState } from "react";
|
|
76
77
|
import { useLocale } from "../../../I18n";
|
|
77
78
|
/** 图例每页显示条数,超过则显示分页 */ var LEGEND_PAGE_SIZE = 12;
|
|
78
|
-
var
|
|
79
|
-
var chartData = param.chartData, backgroundColors = param.backgroundColors, hiddenDataIndicesByChart = param.hiddenDataIndicesByChart, chartIndex = param.chartIndex, onLegendItemClick = param.onLegendItemClick, total = param.total, baseClassName = param.baseClassName, hashId = param.hashId, isMobile = param.isMobile;
|
|
79
|
+
var DonutChartLegend = function DonutChartLegend(param) {
|
|
80
|
+
var chartData = param.chartData, backgroundColors = param.backgroundColors, hiddenDataIndicesByChart = param.hiddenDataIndicesByChart, chartIndex = param.chartIndex, onLegendItemClick = param.onLegendItemClick, total = param.total, baseClassName = param.baseClassName, hashId = param.hashId, isMobile = param.isMobile, _param_theme = param.theme, theme = _param_theme === void 0 ? 'light' : _param_theme;
|
|
80
81
|
var locale = useLocale();
|
|
82
|
+
var isDark = theme === 'dark';
|
|
83
|
+
var legendMutedColor = isDark ? 'rgba(255, 255, 255, 0.55)' : '#767E8B';
|
|
84
|
+
var legendStrongColor = isDark ? 'rgba(255, 255, 255, 0.88)' : '#343A45';
|
|
85
|
+
var paginationBorder = isDark ? '1px solid rgba(255, 255, 255, 0.2)' : '1px solid rgba(0,0,0,0.15)';
|
|
86
|
+
var paginationBg = isDark ? 'rgba(255, 255, 255, 0.08)' : '#fff';
|
|
81
87
|
var hiddenDataIndices = React.useMemo(function() {
|
|
82
88
|
return hiddenDataIndicesByChart[chartIndex] || new Set();
|
|
83
89
|
}, [
|
|
@@ -105,10 +111,7 @@ var Legend = function Legend(param) {
|
|
|
105
111
|
});
|
|
106
112
|
};
|
|
107
113
|
return /*#__PURE__*/ React.createElement("div", {
|
|
108
|
-
className:
|
|
109
|
-
"".concat(baseClassName, "-legend"),
|
|
110
|
-
hashId
|
|
111
|
-
].filter(Boolean).join(' '),
|
|
114
|
+
className: clsx("".concat(baseClassName, "-legend"), hashId),
|
|
112
115
|
style: _object_spread({
|
|
113
116
|
marginLeft: isMobile ? 0 : 12
|
|
114
117
|
}, isMobile ? {
|
|
@@ -131,10 +134,7 @@ var Legend = function Legend(param) {
|
|
|
131
134
|
var _obj;
|
|
132
135
|
return /*#__PURE__*/ React.createElement("div", {
|
|
133
136
|
key: dataIndex,
|
|
134
|
-
className:
|
|
135
|
-
"".concat(baseClassName, "-legend-item"),
|
|
136
|
-
hashId
|
|
137
|
-
].filter(Boolean).join(' '),
|
|
137
|
+
className: clsx("".concat(baseClassName, "-legend-item"), hashId),
|
|
138
138
|
style: {
|
|
139
139
|
cursor: 'pointer',
|
|
140
140
|
padding: isMobile ? '4px 0' : '6px 0',
|
|
@@ -155,27 +155,20 @@ var Legend = function Legend(param) {
|
|
|
155
155
|
role: "button",
|
|
156
156
|
"aria-label": "".concat(isHidden ? locale['chart.legend.show'] : locale['chart.legend.hide'], " ").concat(d.label)
|
|
157
157
|
}, /*#__PURE__*/ React.createElement("span", {
|
|
158
|
-
className:
|
|
159
|
-
"".concat(baseClassName, "-legend-color"),
|
|
160
|
-
hashId
|
|
161
|
-
].filter(Boolean).join(' '),
|
|
158
|
+
className: clsx("".concat(baseClassName, "-legend-color"), hashId),
|
|
162
159
|
style: (_obj = {}, _define_property(_obj, '--donut-legend-color', backgroundColors[dataIndex] || '#ccc'), _define_property(_obj, "width", isMobile ? 10 : 12), _define_property(_obj, "height", isMobile ? 10 : 12), _define_property(_obj, "borderRadius", 4), _define_property(_obj, "marginRight", isMobile ? 4 : 6), _obj)
|
|
163
160
|
}), /*#__PURE__*/ React.createElement("span", {
|
|
164
|
-
className:
|
|
165
|
-
"".concat(baseClassName, "-legend-label"),
|
|
166
|
-
hashId
|
|
167
|
-
].filter(Boolean).join(' '),
|
|
161
|
+
className: clsx("".concat(baseClassName, "-legend-label"), hashId),
|
|
168
162
|
style: {
|
|
163
|
+
color: legendMutedColor,
|
|
169
164
|
fontSize: isMobile ? 11 : 13,
|
|
170
165
|
flex: isMobile ? '0 1 auto' : 1,
|
|
171
166
|
minWidth: isMobile ? '60px' : 'auto'
|
|
172
167
|
}
|
|
173
168
|
}, d.label), /*#__PURE__*/ React.createElement("span", {
|
|
174
|
-
className:
|
|
175
|
-
"".concat(baseClassName, "-legend-value"),
|
|
176
|
-
hashId
|
|
177
|
-
].filter(Boolean).join(' '),
|
|
169
|
+
className: clsx("".concat(baseClassName, "-legend-value"), hashId),
|
|
178
170
|
style: {
|
|
171
|
+
color: legendStrongColor,
|
|
179
172
|
fontSize: isMobile ? 11 : 13,
|
|
180
173
|
fontWeight: isMobile ? 400 : 500,
|
|
181
174
|
marginLeft: isMobile ? 8 : 15,
|
|
@@ -184,11 +177,9 @@ var Legend = function Legend(param) {
|
|
|
184
177
|
alignItems: 'center'
|
|
185
178
|
}
|
|
186
179
|
}, /*#__PURE__*/ React.createElement("span", null, d.value), /*#__PURE__*/ React.createElement("span", {
|
|
187
|
-
className:
|
|
188
|
-
"".concat(baseClassName, "-legend-percent"),
|
|
189
|
-
hashId
|
|
190
|
-
].filter(Boolean).join(' '),
|
|
180
|
+
className: clsx("".concat(baseClassName, "-legend-percent"), hashId),
|
|
191
181
|
style: {
|
|
182
|
+
color: legendStrongColor,
|
|
192
183
|
fontSize: isMobile ? 10 : 12,
|
|
193
184
|
marginLeft: isMobile ? 6 : 8,
|
|
194
185
|
marginTop: 0
|
|
@@ -198,13 +189,12 @@ var Legend = function Legend(param) {
|
|
|
198
189
|
return total > 0 && Number.isFinite(v) ? (v / total * 100).toFixed(0) : '0';
|
|
199
190
|
}(), "%")));
|
|
200
191
|
})), totalPages > 1 && /*#__PURE__*/ React.createElement("div", {
|
|
201
|
-
className:
|
|
202
|
-
|
|
203
|
-
hashId
|
|
204
|
-
].filter(Boolean).join(' '),
|
|
205
|
-
style: isMobile ? {
|
|
192
|
+
className: clsx("".concat(baseClassName, "-legend-pagination"), hashId),
|
|
193
|
+
style: isMobile || isDark ? _object_spread({}, isMobile ? {
|
|
206
194
|
flexShrink: 0
|
|
207
|
-
} :
|
|
195
|
+
} : {}, isDark ? {
|
|
196
|
+
borderTopColor: 'rgba(255,255,255,0.12)'
|
|
197
|
+
} : {}) : undefined
|
|
208
198
|
}, /*#__PURE__*/ React.createElement("button", {
|
|
209
199
|
type: "button",
|
|
210
200
|
"aria-label": locale['chart.legend.prevPage'],
|
|
@@ -215,14 +205,15 @@ var Legend = function Legend(param) {
|
|
|
215
205
|
fontSize: 12,
|
|
216
206
|
cursor: currentPage <= 0 ? 'not-allowed' : 'pointer',
|
|
217
207
|
opacity: currentPage <= 0 ? 0.5 : 1,
|
|
218
|
-
border:
|
|
208
|
+
border: paginationBorder,
|
|
219
209
|
borderRadius: 4,
|
|
220
|
-
background:
|
|
210
|
+
background: paginationBg,
|
|
211
|
+
color: legendStrongColor
|
|
221
212
|
}
|
|
222
213
|
}, "<"), /*#__PURE__*/ React.createElement("span", {
|
|
223
214
|
style: {
|
|
224
215
|
fontSize: 12,
|
|
225
|
-
color:
|
|
216
|
+
color: legendMutedColor
|
|
226
217
|
}
|
|
227
218
|
}, currentPage + 1, "/", totalPages), /*#__PURE__*/ React.createElement("button", {
|
|
228
219
|
type: "button",
|
|
@@ -234,10 +225,11 @@ var Legend = function Legend(param) {
|
|
|
234
225
|
fontSize: 12,
|
|
235
226
|
cursor: currentPage >= totalPages - 1 ? 'not-allowed' : 'pointer',
|
|
236
227
|
opacity: currentPage >= totalPages - 1 ? 0.5 : 1,
|
|
237
|
-
border:
|
|
228
|
+
border: paginationBorder,
|
|
238
229
|
borderRadius: 4,
|
|
239
|
-
background:
|
|
230
|
+
background: paginationBg,
|
|
231
|
+
color: legendStrongColor
|
|
240
232
|
}
|
|
241
233
|
}, ">")));
|
|
242
234
|
};
|
|
243
|
-
export default
|
|
235
|
+
export default DonutChartLegend;
|