@ant-design/agentic-ui 2.16.0 → 2.16.1
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/MarkdownEditor/editor/elements/Code.js +11 -6
- package/dist/MarkdownEditor/editor/elements/Table/ReadonlyTableComponent.js +15 -3
- package/dist/MarkdownEditor/editor/elements/Table/SimpleTable.js +17 -2
- package/dist/MarkdownEditor/editor/elements/Table/Table.js +131 -5
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.d.ts +100 -1
- package/dist/MarkdownEditor/editor/parser/parserMarkdownToSlateNode.js +781 -240
- package/dist/MarkdownEditor/editor/types/Table.d.ts +1 -0
- package/dist/MarkdownEditor/editor/utils/findMatchingClose.d.ts +36 -0
- package/dist/MarkdownEditor/editor/utils/findMatchingClose.js +158 -0
- package/dist/MarkdownEditor/editor/utils/markdownToHtml.d.ts +41 -2
- package/dist/MarkdownEditor/editor/utils/markdownToHtml.js +159 -7
- package/dist/Plugins/chart/AreaChart/index.d.ts +12 -0
- package/dist/Plugins/chart/AreaChart/index.js +14 -188
- package/dist/Plugins/chart/BarChart/index.d.ts +2 -0
- package/dist/Plugins/chart/BarChart/index.js +3 -12
- package/dist/Plugins/chart/ChartMark/Container.js +5 -2
- package/dist/Plugins/chart/ChartRender.d.ts +1 -0
- package/dist/Plugins/chart/ChartRender.js +104 -43
- package/dist/Plugins/chart/DonutChart/index.js +4 -2
- package/dist/Plugins/chart/DonutChart/types.d.ts +2 -0
- package/dist/Plugins/chart/FunnelChart/index.d.ts +2 -0
- package/dist/Plugins/chart/FunnelChart/index.js +4 -2
- package/dist/Plugins/chart/LineChart/index.d.ts +2 -0
- package/dist/Plugins/chart/LineChart/index.js +17 -162
- package/dist/Plugins/chart/RadarChart/index.d.ts +2 -0
- package/dist/Plugins/chart/RadarChart/index.js +8 -4
- package/dist/Plugins/chart/ScatterChart/index.d.ts +2 -0
- package/dist/Plugins/chart/ScatterChart/index.js +8 -4
- package/dist/Plugins/chart/components/ChartContainer/ChartContainer.d.ts +1 -0
- package/dist/Plugins/chart/components/ChartFilter/ChartFilter.d.ts +1 -1
- package/dist/Plugins/chart/components/ChartFilter/ChartFilter.js +210 -16
- package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.d.ts +2 -0
- package/dist/Plugins/chart/components/ChartToolBar/ChartToolBar.js +9 -2
- package/dist/Plugins/chart/components/ChartToolBar/style.js +3 -1
- package/dist/Plugins/chart/hooks/index.d.ts +10 -0
- package/dist/Plugins/chart/hooks/index.js +8 -0
- package/dist/Plugins/chart/hooks/useChartDataFilter.d.ts +46 -0
- package/dist/Plugins/chart/hooks/useChartDataFilter.js +182 -0
- package/dist/Plugins/chart/hooks/useChartStatistics.d.ts +17 -0
- package/dist/Plugins/chart/hooks/useChartStatistics.js +25 -0
- package/dist/Plugins/chart/hooks/useChartTheme.d.ts +20 -0
- package/dist/Plugins/chart/hooks/useChartTheme.js +30 -0
- package/dist/Plugins/chart/hooks/useResponsiveSize.d.ts +23 -0
- package/dist/Plugins/chart/hooks/useResponsiveSize.js +94 -0
- package/dist/Plugins/chart/index.js +92 -8
- package/dist/Plugins/chart/utils/registerChart.d.ts +35 -0
- package/dist/Plugins/chart/utils/registerChart.js +54 -0
- package/dist/Plugins/chart/utils.d.ts +19 -0
- package/dist/Plugins/chart/utils.js +27 -0
- package/dist/Plugins/code/components/CodeRenderer.js +53 -2
- package/dist/Plugins/code/components/CodeToolbar.js +22 -3
- package/dist/Plugins/mermaid/Mermaid.js +66 -66
- package/package.json +1 -1
|
@@ -341,11 +341,11 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
341
341
|
* 图表运行时渲染器组件实现
|
|
342
342
|
* 负责使用已加载的 runtime 渲染图表
|
|
343
343
|
*/ var ChartRuntimeRendererImpl = function(param) {
|
|
344
|
-
var chartType = param.chartType, runtime = param.runtime, convertDonutData = param.convertDonutData, convertFlatData = param.convertFlatData, config = param.config,
|
|
344
|
+
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;
|
|
345
345
|
var DonutChart = runtime.DonutChart, FunnelChart = runtime.FunnelChart, AreaChart = runtime.AreaChart, BarChart = runtime.BarChart, LineChart = runtime.LineChart, RadarChart = runtime.RadarChart, ScatterChart = runtime.ScatterChart;
|
|
346
346
|
if (chartType === 'pie') {
|
|
347
347
|
return /*#__PURE__*/ React.createElement(DonutChart, {
|
|
348
|
-
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-pie
|
|
348
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-pie"),
|
|
349
349
|
data: convertDonutData,
|
|
350
350
|
configs: [
|
|
351
351
|
{
|
|
@@ -357,12 +357,13 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
357
357
|
title: title,
|
|
358
358
|
showToolbar: true,
|
|
359
359
|
dataTime: dataTime,
|
|
360
|
-
toolbarExtra: toolBar
|
|
360
|
+
toolbarExtra: toolBar,
|
|
361
|
+
loading: loading
|
|
361
362
|
});
|
|
362
363
|
}
|
|
363
364
|
if (chartType === 'donut') {
|
|
364
365
|
return /*#__PURE__*/ React.createElement(DonutChart, {
|
|
365
|
-
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-donut
|
|
366
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-donut"),
|
|
366
367
|
data: convertDonutData,
|
|
367
368
|
configs: [
|
|
368
369
|
{
|
|
@@ -374,14 +375,15 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
374
375
|
title: title,
|
|
375
376
|
showToolbar: true,
|
|
376
377
|
dataTime: dataTime,
|
|
377
|
-
toolbarExtra: toolBar
|
|
378
|
+
toolbarExtra: toolBar,
|
|
379
|
+
loading: loading
|
|
378
380
|
});
|
|
379
381
|
}
|
|
380
382
|
if (chartType === 'bar') {
|
|
381
383
|
var _config_rest, _config_rest1, _config_rest2;
|
|
382
384
|
var _config_rest_showLegend, _config_rest_showGrid;
|
|
383
385
|
return /*#__PURE__*/ React.createElement(BarChart, {
|
|
384
|
-
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-bar
|
|
386
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-bar"),
|
|
385
387
|
data: convertFlatData,
|
|
386
388
|
height: (config === null || config === void 0 ? void 0 : config.height) || 400,
|
|
387
389
|
title: title || '',
|
|
@@ -390,28 +392,30 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
390
392
|
showLegend: (_config_rest_showLegend = config === null || config === void 0 ? void 0 : (_config_rest1 = config.rest) === null || _config_rest1 === void 0 ? void 0 : _config_rest1.showLegend) !== null && _config_rest_showLegend !== void 0 ? _config_rest_showLegend : true,
|
|
391
393
|
showGrid: (_config_rest_showGrid = config === null || config === void 0 ? void 0 : (_config_rest2 = config.rest) === null || _config_rest2 === void 0 ? void 0 : _config_rest2.showGrid) !== null && _config_rest_showGrid !== void 0 ? _config_rest_showGrid : true,
|
|
392
394
|
dataTime: dataTime,
|
|
393
|
-
toolbarExtra: toolBar
|
|
395
|
+
toolbarExtra: toolBar,
|
|
396
|
+
loading: loading
|
|
394
397
|
});
|
|
395
398
|
}
|
|
396
399
|
if (chartType === 'line') {
|
|
397
400
|
var _config_rest3, _config_rest4;
|
|
398
401
|
var _config_rest_showLegend1, _config_rest_showGrid1;
|
|
399
402
|
return /*#__PURE__*/ React.createElement(LineChart, {
|
|
400
|
-
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-line
|
|
403
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-line"),
|
|
401
404
|
data: convertFlatData,
|
|
402
405
|
height: (config === null || config === void 0 ? void 0 : config.height) || 400,
|
|
403
406
|
title: title || '',
|
|
404
407
|
showLegend: (_config_rest_showLegend1 = config === null || config === void 0 ? void 0 : (_config_rest3 = config.rest) === null || _config_rest3 === void 0 ? void 0 : _config_rest3.showLegend) !== null && _config_rest_showLegend1 !== void 0 ? _config_rest_showLegend1 : true,
|
|
405
408
|
showGrid: (_config_rest_showGrid1 = config === null || config === void 0 ? void 0 : (_config_rest4 = config.rest) === null || _config_rest4 === void 0 ? void 0 : _config_rest4.showGrid) !== null && _config_rest_showGrid1 !== void 0 ? _config_rest_showGrid1 : true,
|
|
406
409
|
dataTime: dataTime,
|
|
407
|
-
toolbarExtra: toolBar
|
|
410
|
+
toolbarExtra: toolBar,
|
|
411
|
+
loading: loading
|
|
408
412
|
});
|
|
409
413
|
}
|
|
410
414
|
if (chartType === 'column') {
|
|
411
415
|
var _config_rest5, _config_rest6, _config_rest7;
|
|
412
416
|
var _config_rest_showLegend2, _config_rest_showGrid2;
|
|
413
417
|
return /*#__PURE__*/ React.createElement(BarChart, {
|
|
414
|
-
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-column
|
|
418
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-column"),
|
|
415
419
|
data: convertFlatData,
|
|
416
420
|
height: (config === null || config === void 0 ? void 0 : config.height) || 400,
|
|
417
421
|
title: title || '',
|
|
@@ -420,21 +424,23 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
420
424
|
showLegend: (_config_rest_showLegend2 = config === null || config === void 0 ? void 0 : (_config_rest6 = config.rest) === null || _config_rest6 === void 0 ? void 0 : _config_rest6.showLegend) !== null && _config_rest_showLegend2 !== void 0 ? _config_rest_showLegend2 : true,
|
|
421
425
|
showGrid: (_config_rest_showGrid2 = config === null || config === void 0 ? void 0 : (_config_rest7 = config.rest) === null || _config_rest7 === void 0 ? void 0 : _config_rest7.showGrid) !== null && _config_rest_showGrid2 !== void 0 ? _config_rest_showGrid2 : true,
|
|
422
426
|
dataTime: dataTime,
|
|
423
|
-
toolbarExtra: toolBar
|
|
427
|
+
toolbarExtra: toolBar,
|
|
428
|
+
loading: loading
|
|
424
429
|
});
|
|
425
430
|
}
|
|
426
431
|
if (chartType === 'area') {
|
|
427
432
|
var _config_rest8, _config_rest9;
|
|
428
433
|
var _config_rest_showLegend3, _config_rest_showGrid3;
|
|
429
434
|
return /*#__PURE__*/ React.createElement(AreaChart, {
|
|
430
|
-
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-area
|
|
435
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-area"),
|
|
431
436
|
data: convertFlatData,
|
|
432
437
|
height: (config === null || config === void 0 ? void 0 : config.height) || 400,
|
|
433
438
|
title: title || '',
|
|
434
439
|
showLegend: (_config_rest_showLegend3 = config === null || config === void 0 ? void 0 : (_config_rest8 = config.rest) === null || _config_rest8 === void 0 ? void 0 : _config_rest8.showLegend) !== null && _config_rest_showLegend3 !== void 0 ? _config_rest_showLegend3 : true,
|
|
435
440
|
showGrid: (_config_rest_showGrid3 = config === null || config === void 0 ? void 0 : (_config_rest9 = config.rest) === null || _config_rest9 === void 0 ? void 0 : _config_rest9.showGrid) !== null && _config_rest_showGrid3 !== void 0 ? _config_rest_showGrid3 : true,
|
|
436
441
|
dataTime: dataTime,
|
|
437
|
-
toolbarExtra: toolBar
|
|
442
|
+
toolbarExtra: toolBar,
|
|
443
|
+
loading: loading
|
|
438
444
|
});
|
|
439
445
|
}
|
|
440
446
|
if (chartType === 'radar') {
|
|
@@ -442,10 +448,12 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
442
448
|
var filterLabel = getFieldValue(row, filterBy);
|
|
443
449
|
var category = getFieldValue(row, groupBy);
|
|
444
450
|
var type = getFieldValue(row, colorLegend);
|
|
445
|
-
|
|
451
|
+
// 使用 getFieldValue 获取 x 和 y 值,支持字段名规范化
|
|
452
|
+
var xValue = getFieldValue(row, config === null || config === void 0 ? void 0 : config.x);
|
|
453
|
+
var yValue = getFieldValue(row, config === null || config === void 0 ? void 0 : config.y);
|
|
446
454
|
return _object_spread({
|
|
447
|
-
label:
|
|
448
|
-
score:
|
|
455
|
+
label: xValue ? String(xValue) : String(i + 1),
|
|
456
|
+
score: yValue ? Number(yValue) : undefined
|
|
449
457
|
}, category ? {
|
|
450
458
|
category: category
|
|
451
459
|
} : {}, type ? {
|
|
@@ -455,12 +463,13 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
455
463
|
} : {});
|
|
456
464
|
});
|
|
457
465
|
return /*#__PURE__*/ React.createElement(RadarChart, {
|
|
458
|
-
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-radar
|
|
466
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-radar"),
|
|
459
467
|
data: radarData,
|
|
460
468
|
height: (config === null || config === void 0 ? void 0 : config.height) || 400,
|
|
461
469
|
title: title || '',
|
|
462
470
|
dataTime: dataTime,
|
|
463
|
-
toolbarExtra: toolBar
|
|
471
|
+
toolbarExtra: toolBar,
|
|
472
|
+
loading: loading
|
|
464
473
|
});
|
|
465
474
|
}
|
|
466
475
|
if (chartType === 'scatter') {
|
|
@@ -468,9 +477,12 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
468
477
|
var filterLabel = getFieldValue(row, filterBy);
|
|
469
478
|
var category = getFieldValue(row, groupBy);
|
|
470
479
|
var type = getFieldValue(row, colorLegend);
|
|
480
|
+
// 使用 getFieldValue 获取 x 和 y 值,支持字段名规范化
|
|
481
|
+
var xValue = getFieldValue(row, config === null || config === void 0 ? void 0 : config.x);
|
|
482
|
+
var yValue = getFieldValue(row, config === null || config === void 0 ? void 0 : config.y);
|
|
471
483
|
return _object_spread({
|
|
472
|
-
x:
|
|
473
|
-
y:
|
|
484
|
+
x: xValue ? Number(xValue) : 0,
|
|
485
|
+
y: yValue ? Number(yValue) : 0
|
|
474
486
|
}, category ? {
|
|
475
487
|
category: category
|
|
476
488
|
} : {}, type ? {
|
|
@@ -480,12 +492,13 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
480
492
|
} : {});
|
|
481
493
|
});
|
|
482
494
|
return /*#__PURE__*/ React.createElement(ScatterChart, {
|
|
483
|
-
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-scatter
|
|
495
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-scatter"),
|
|
484
496
|
data: scatterData,
|
|
485
497
|
height: (config === null || config === void 0 ? void 0 : config.height) || 400,
|
|
486
498
|
title: title || '',
|
|
487
499
|
dataTime: dataTime,
|
|
488
|
-
toolbarExtra: toolBar
|
|
500
|
+
toolbarExtra: toolBar,
|
|
501
|
+
loading: loading
|
|
489
502
|
});
|
|
490
503
|
}
|
|
491
504
|
if (chartType === 'funnel') {
|
|
@@ -493,10 +506,12 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
493
506
|
var filterLabel = getFieldValue(row, filterBy);
|
|
494
507
|
var category = getFieldValue(row, groupBy);
|
|
495
508
|
var type = getFieldValue(row, colorLegend);
|
|
496
|
-
|
|
509
|
+
// 使用 getFieldValue 获取 x 和 y 值,支持字段名规范化
|
|
510
|
+
var xValue = getFieldValue(row, config === null || config === void 0 ? void 0 : config.x);
|
|
511
|
+
var yValue = getFieldValue(row, config === null || config === void 0 ? void 0 : config.y);
|
|
497
512
|
return _object_spread({
|
|
498
|
-
x:
|
|
499
|
-
y:
|
|
513
|
+
x: xValue ? String(xValue) : String(i + 1),
|
|
514
|
+
y: yValue ? toNumber(yValue, 0) : 0
|
|
500
515
|
}, (row === null || row === void 0 ? void 0 : row.ratio) !== undefined ? {
|
|
501
516
|
ratio: row.ratio
|
|
502
517
|
} : {}, category ? {
|
|
@@ -508,7 +523,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
508
523
|
} : {});
|
|
509
524
|
});
|
|
510
525
|
return /*#__PURE__*/ React.createElement(FunnelChart, {
|
|
511
|
-
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-funnel
|
|
526
|
+
key: "".concat(config === null || config === void 0 ? void 0 : config.index, "-funnel"),
|
|
512
527
|
data: funnelData,
|
|
513
528
|
height: (config === null || config === void 0 ? void 0 : config.height) || 400,
|
|
514
529
|
title: title || '',
|
|
@@ -517,7 +532,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
517
532
|
rate: '转化率',
|
|
518
533
|
name: colorLegend || '转化'
|
|
519
534
|
},
|
|
520
|
-
toolbarExtra: toolBar
|
|
535
|
+
toolbarExtra: toolBar,
|
|
536
|
+
loading: loading
|
|
521
537
|
});
|
|
522
538
|
}
|
|
523
539
|
return null;
|
|
@@ -625,11 +641,11 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
625
641
|
* - 使用 React.lazy 和 Suspense 实现代码分割
|
|
626
642
|
*/ export var ChartRender = function(props) {
|
|
627
643
|
var // 对于 rest 对象,使用浅比较
|
|
628
|
-
_config_rest, _config_rest1, _config_rest2;
|
|
644
|
+
_config_rest, _config_rest1, _config_rest2, _config_rest3, _config_rest4, _config_rest5;
|
|
629
645
|
var _useState = _sliced_to_array(useState(function() {
|
|
630
646
|
return props.chartType;
|
|
631
647
|
}), 2), chartType = _useState[0], setChartType = _useState[1];
|
|
632
|
-
var chartData = props.chartData, isChartList = props.isChartList, onColumnLengthChange = props.onColumnLengthChange, columnLength = props.columnLength, title = props.title, dataTime = props.dataTime, groupBy = props.groupBy, filterBy = props.filterBy, colorLegend = props.colorLegend;
|
|
648
|
+
var chartData = props.chartData, isChartList = props.isChartList, onColumnLengthChange = props.onColumnLengthChange, columnLength = props.columnLength, title = props.title, dataTime = props.dataTime, groupBy = props.groupBy, filterBy = props.filterBy, colorLegend = props.colorLegend, _props_loading = props.loading, loading = _props_loading === void 0 ? false : _props_loading;
|
|
633
649
|
var i18n = useContext(I18nContext);
|
|
634
650
|
var _useState1 = _sliced_to_array(useState(function() {
|
|
635
651
|
return props.config;
|
|
@@ -649,11 +665,12 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
649
665
|
chartData
|
|
650
666
|
]);
|
|
651
667
|
// 防抖更新 renderKey,避免流式数据频繁更新导致的性能问题
|
|
668
|
+
// 增加延迟时间以减少抖动
|
|
652
669
|
var debouncedUpdateRenderKeyRef = React.useRef(debounce(function() {
|
|
653
670
|
setRenderKey(function(k) {
|
|
654
671
|
return k + 1;
|
|
655
672
|
});
|
|
656
|
-
},
|
|
673
|
+
}, 800));
|
|
657
674
|
var renderDescriptionsFallback = React.useMemo(function() {
|
|
658
675
|
var _config_columns;
|
|
659
676
|
var columnCount = (config === null || config === void 0 ? void 0 : (_config_columns = config.columns) === null || _config_columns === void 0 ? void 0 : _config_columns.length) || 0;
|
|
@@ -693,9 +710,39 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
693
710
|
});
|
|
694
711
|
return map;
|
|
695
712
|
};
|
|
713
|
+
/**
|
|
714
|
+
* 规范化字段名,统一处理转义字符
|
|
715
|
+
* 将 `index\_value` 转换为 `index_value`,确保字段名一致
|
|
716
|
+
*/ var normalizeFieldName = function(fieldName) {
|
|
717
|
+
if (!fieldName) return fieldName;
|
|
718
|
+
// 移除转义字符:将 `\_` 转换为 `_`,`\\` 转换为 `\`
|
|
719
|
+
return fieldName.replace(/\\_/g, '_').replace(/\\\\/g, '\\').replace(/\\(?=")/g, '') // 移除转义的双引号
|
|
720
|
+
.trim();
|
|
721
|
+
};
|
|
722
|
+
/**
|
|
723
|
+
* 安全地获取字段值,如果字段名不匹配,也尝试规范化后的字段名
|
|
724
|
+
*/ var getFieldValueSafely = function(row, field) {
|
|
725
|
+
if (!field) return undefined;
|
|
726
|
+
// 先尝试直接访问
|
|
727
|
+
if (row[field] !== undefined) {
|
|
728
|
+
return row[field];
|
|
729
|
+
}
|
|
730
|
+
// 如果直接访问失败,尝试规范化后的字段名
|
|
731
|
+
var normalizedField = normalizeFieldName(field);
|
|
732
|
+
if (normalizedField !== field && row[normalizedField] !== undefined) {
|
|
733
|
+
return row[normalizedField];
|
|
734
|
+
}
|
|
735
|
+
// 也尝试反向:如果字段名已经是规范化的,尝试带转义字符的版本
|
|
736
|
+
var escapedField = field.replace(/_/g, '\\_');
|
|
737
|
+
if (escapedField !== field && row[escapedField] !== undefined) {
|
|
738
|
+
return row[escapedField];
|
|
739
|
+
}
|
|
740
|
+
return undefined;
|
|
741
|
+
};
|
|
696
742
|
var getFieldValue = function(row, field) {
|
|
697
|
-
|
|
698
|
-
|
|
743
|
+
var value = getFieldValueSafely(row, field);
|
|
744
|
+
if (field && isNotEmpty(value)) {
|
|
745
|
+
return String(value);
|
|
699
746
|
}
|
|
700
747
|
return undefined;
|
|
701
748
|
};
|
|
@@ -703,8 +750,8 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
703
750
|
var _getAxisTitles = getAxisTitles(), xTitle = _getAxisTitles.xTitle, yTitle = _getAxisTitles.yTitle;
|
|
704
751
|
var xIndexer = buildXIndexer();
|
|
705
752
|
return (chartData || []).map(function(row, i) {
|
|
706
|
-
var rawX = row
|
|
707
|
-
var rawY = row
|
|
753
|
+
var rawX = getFieldValueSafely(row, config === null || config === void 0 ? void 0 : config.x);
|
|
754
|
+
var rawY = getFieldValueSafely(row, config === null || config === void 0 ? void 0 : config.y);
|
|
708
755
|
var category = getFieldValue(row, groupBy);
|
|
709
756
|
var type = getFieldValue(row, colorLegend);
|
|
710
757
|
var filterLabel = getFieldValue(row, filterBy);
|
|
@@ -742,9 +789,9 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
742
789
|
var convertDonutData = useMemo(function() {
|
|
743
790
|
return (chartData || []).map(function(row) {
|
|
744
791
|
var category = getFieldValue(row, groupBy);
|
|
745
|
-
var
|
|
746
|
-
var label = String((
|
|
747
|
-
var value = toNumber(row
|
|
792
|
+
var _getFieldValueSafely;
|
|
793
|
+
var label = String((_getFieldValueSafely = getFieldValueSafely(row, config === null || config === void 0 ? void 0 : config.x)) !== null && _getFieldValueSafely !== void 0 ? _getFieldValueSafely : '');
|
|
794
|
+
var value = toNumber(getFieldValueSafely(row, config === null || config === void 0 ? void 0 : config.y), 0);
|
|
748
795
|
var filterLabel = getFieldValue(row, filterBy);
|
|
749
796
|
return _object_spread({
|
|
750
797
|
label: label,
|
|
@@ -806,7 +853,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
806
853
|
]);
|
|
807
854
|
/**
|
|
808
855
|
* 图表配置
|
|
809
|
-
*/ var
|
|
856
|
+
*/ var toolBar = useMemo(function() {
|
|
810
857
|
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;
|
|
811
858
|
return [
|
|
812
859
|
/*#__PURE__*/ React.createElement(Dropdown, {
|
|
@@ -842,7 +889,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
842
889
|
}
|
|
843
890
|
}))),
|
|
844
891
|
isChartList ? /*#__PURE__*/ React.createElement(Dropdown, {
|
|
845
|
-
key: "dropdown",
|
|
892
|
+
key: "dropdown-column",
|
|
846
893
|
menu: {
|
|
847
894
|
items: new Array(4).fill(0).map(function(_, i) {
|
|
848
895
|
return {
|
|
@@ -956,8 +1003,16 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
956
1003
|
].filter(function(item) {
|
|
957
1004
|
return !!item;
|
|
958
1005
|
});
|
|
959
|
-
}
|
|
960
|
-
|
|
1006
|
+
}, [
|
|
1007
|
+
chartType,
|
|
1008
|
+
ChartMap,
|
|
1009
|
+
i18n === null || i18n === void 0 ? void 0 : i18n.locale,
|
|
1010
|
+
isChartList,
|
|
1011
|
+
columnLength,
|
|
1012
|
+
onColumnLengthChange,
|
|
1013
|
+
config,
|
|
1014
|
+
props.config
|
|
1015
|
+
]);
|
|
961
1016
|
var chartDom = useMemo(function() {
|
|
962
1017
|
var _window;
|
|
963
1018
|
if (typeof window === 'undefined') return null;
|
|
@@ -1027,6 +1082,7 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
1027
1082
|
height: (config === null || config === void 0 ? void 0 : config.height) || 240
|
|
1028
1083
|
})
|
|
1029
1084
|
}, /*#__PURE__*/ React.createElement(ChartRuntimeRenderer, {
|
|
1085
|
+
loading: loading,
|
|
1030
1086
|
chartType: chartType,
|
|
1031
1087
|
convertDonutData: convertDonutData,
|
|
1032
1088
|
convertFlatData: convertFlatData,
|
|
@@ -1056,7 +1112,6 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
1056
1112
|
config === null || config === void 0 ? void 0 : config.y,
|
|
1057
1113
|
config === null || config === void 0 ? void 0 : config.height,
|
|
1058
1114
|
config === null || config === void 0 ? void 0 : config.index,
|
|
1059
|
-
renderKey,
|
|
1060
1115
|
toolBar,
|
|
1061
1116
|
convertDonutData,
|
|
1062
1117
|
convertFlatData,
|
|
@@ -1067,7 +1122,13 @@ import { debounce, getDataHash, isConfigEqual, isNotEmpty, toNumber } from "./ut
|
|
|
1067
1122
|
colorLegend,
|
|
1068
1123
|
isIntersecting,
|
|
1069
1124
|
shouldLoadRuntime,
|
|
1070
|
-
renderDescriptionsFallback
|
|
1125
|
+
renderDescriptionsFallback,
|
|
1126
|
+
chartData,
|
|
1127
|
+
config === null || config === void 0 ? void 0 : config.columns,
|
|
1128
|
+
config === null || config === void 0 ? void 0 : (_config_rest3 = config.rest) === null || _config_rest3 === void 0 ? void 0 : _config_rest3.stacked,
|
|
1129
|
+
config === null || config === void 0 ? void 0 : (_config_rest4 = config.rest) === null || _config_rest4 === void 0 ? void 0 : _config_rest4.showLegend,
|
|
1130
|
+
config === null || config === void 0 ? void 0 : (_config_rest5 = config.rest) === null || _config_rest5 === void 0 ? void 0 : _config_rest5.showGrid,
|
|
1131
|
+
loading
|
|
1071
1132
|
]);
|
|
1072
1133
|
return /*#__PURE__*/ React.createElement("div", {
|
|
1073
1134
|
ref: containerRef,
|
|
@@ -185,7 +185,7 @@ import { useStyle } from "./style";
|
|
|
185
185
|
*
|
|
186
186
|
* @since 1.0.0
|
|
187
187
|
*/ var DonutChart = function(_param) {
|
|
188
|
-
var data = _param.data, configs = _param.configs, _param_width = _param.width, width = _param_width === void 0 ? 200 : _param_width, _param_height = _param.height, height = _param_height === void 0 ? 200 : _param_height, className = _param.className, title = _param.title, _param_showToolbar = _param.showToolbar, showToolbar = _param_showToolbar === void 0 ? true : _param_showToolbar, onDownload = _param.onDownload, dataTime = _param.dataTime, filterList = _param.filterList, selectedFilter = _param.selectedFilter, onFilterChange = _param.onFilterChange, _param_enableAutoCategory = _param.enableAutoCategory, enableAutoCategory = _param_enableAutoCategory === void 0 ? true : _param_enableAutoCategory, _param_singleMode = _param.singleMode, singleMode = _param_singleMode === void 0 ? false : _param_singleMode, toolbarExtra = _param.toolbarExtra, _param_renderFilterInToolbar = _param.renderFilterInToolbar, renderFilterInToolbar = _param_renderFilterInToolbar === void 0 ? false : _param_renderFilterInToolbar, statisticConfig = _param.statistic, props = _object_without_properties(_param, [
|
|
188
|
+
var data = _param.data, configs = _param.configs, _param_width = _param.width, width = _param_width === void 0 ? 200 : _param_width, _param_height = _param.height, height = _param_height === void 0 ? 200 : _param_height, className = _param.className, title = _param.title, _param_showToolbar = _param.showToolbar, showToolbar = _param_showToolbar === void 0 ? true : _param_showToolbar, onDownload = _param.onDownload, dataTime = _param.dataTime, filterList = _param.filterList, selectedFilter = _param.selectedFilter, onFilterChange = _param.onFilterChange, _param_enableAutoCategory = _param.enableAutoCategory, enableAutoCategory = _param_enableAutoCategory === void 0 ? true : _param_enableAutoCategory, _param_singleMode = _param.singleMode, singleMode = _param_singleMode === void 0 ? false : _param_singleMode, toolbarExtra = _param.toolbarExtra, _param_renderFilterInToolbar = _param.renderFilterInToolbar, renderFilterInToolbar = _param_renderFilterInToolbar === void 0 ? false : _param_renderFilterInToolbar, statisticConfig = _param.statistic, _param_loading = _param.loading, loading = _param_loading === void 0 ? false : _param_loading, props = _object_without_properties(_param, [
|
|
189
189
|
"data",
|
|
190
190
|
"configs",
|
|
191
191
|
"width",
|
|
@@ -202,7 +202,8 @@ import { useStyle } from "./style";
|
|
|
202
202
|
"singleMode",
|
|
203
203
|
"toolbarExtra",
|
|
204
204
|
"renderFilterInToolbar",
|
|
205
|
-
"statistic"
|
|
205
|
+
"statistic",
|
|
206
|
+
"loading"
|
|
206
207
|
]);
|
|
207
208
|
var _finalConfigs_;
|
|
208
209
|
useMemo(function() {
|
|
@@ -382,6 +383,7 @@ import { useStyle } from "./style";
|
|
|
382
383
|
onDownload: handleDownload,
|
|
383
384
|
extra: toolbarExtra,
|
|
384
385
|
dataTime: dataTime,
|
|
386
|
+
loading: loading,
|
|
385
387
|
filter: renderFilterInToolbar && shouldShowFilter ? /*#__PURE__*/ React.createElement(ChartFilter, _object_spread_props(_object_spread({
|
|
386
388
|
filterOptions: finalFilterList.map(function(item) {
|
|
387
389
|
return {
|
|
@@ -147,7 +147,7 @@ import { findDataPointByXValue, isXValueEqual, toNumber } from "../utils";
|
|
|
147
147
|
import { useStyle } from "./style";
|
|
148
148
|
var funnelChartComponentsRegistered = false;
|
|
149
149
|
var FunnelChart = function(_param) {
|
|
150
|
-
var title = _param.title, data = _param.data, color = _param.color, _param_width = _param.width, width = _param_width === void 0 ? 600 : _param_width, _param_height = _param.height, height = _param_height === void 0 ? 400 : _param_height, className = _param.className, dataTime = _param.dataTime, _param_theme = _param.theme, theme = _param_theme === void 0 ? 'light' : _param_theme, _param_showLegend = _param.showLegend, showLegend = _param_showLegend === void 0 ? true : _param_showLegend, _param_legendPosition = _param.legendPosition, legendPosition = _param_legendPosition === void 0 ? 'bottom' : _param_legendPosition, _param_legendAlign = _param.legendAlign, legendAlign = _param_legendAlign === void 0 ? 'start' : _param_legendAlign, _param_showPercent = _param.showPercent, showPercent = _param_showPercent === void 0 ? true : _param_showPercent, toolbarExtra = _param.toolbarExtra, _param_renderFilterInToolbar = _param.renderFilterInToolbar, renderFilterInToolbar = _param_renderFilterInToolbar === void 0 ? false : _param_renderFilterInToolbar, _param_bottomLayerMinWidth = _param.bottomLayerMinWidth, bottomLayerMinWidth = _param_bottomLayerMinWidth === void 0 ? 0 : _param_bottomLayerMinWidth, typeNames = _param.typeNames, statisticConfig = _param.statistic, props = _object_without_properties(_param, [
|
|
150
|
+
var title = _param.title, data = _param.data, color = _param.color, _param_width = _param.width, width = _param_width === void 0 ? 600 : _param_width, _param_height = _param.height, height = _param_height === void 0 ? 400 : _param_height, className = _param.className, dataTime = _param.dataTime, _param_theme = _param.theme, theme = _param_theme === void 0 ? 'light' : _param_theme, _param_showLegend = _param.showLegend, showLegend = _param_showLegend === void 0 ? true : _param_showLegend, _param_legendPosition = _param.legendPosition, legendPosition = _param_legendPosition === void 0 ? 'bottom' : _param_legendPosition, _param_legendAlign = _param.legendAlign, legendAlign = _param_legendAlign === void 0 ? 'start' : _param_legendAlign, _param_showPercent = _param.showPercent, showPercent = _param_showPercent === void 0 ? true : _param_showPercent, toolbarExtra = _param.toolbarExtra, _param_renderFilterInToolbar = _param.renderFilterInToolbar, renderFilterInToolbar = _param_renderFilterInToolbar === void 0 ? false : _param_renderFilterInToolbar, _param_bottomLayerMinWidth = _param.bottomLayerMinWidth, bottomLayerMinWidth = _param_bottomLayerMinWidth === void 0 ? 0 : _param_bottomLayerMinWidth, typeNames = _param.typeNames, statisticConfig = _param.statistic, _param_loading = _param.loading, loading = _param_loading === void 0 ? false : _param_loading, props = _object_without_properties(_param, [
|
|
151
151
|
"title",
|
|
152
152
|
"data",
|
|
153
153
|
"color",
|
|
@@ -164,7 +164,8 @@ var FunnelChart = function(_param) {
|
|
|
164
164
|
"renderFilterInToolbar",
|
|
165
165
|
"bottomLayerMinWidth",
|
|
166
166
|
"typeNames",
|
|
167
|
-
"statistic"
|
|
167
|
+
"statistic",
|
|
168
|
+
"loading"
|
|
168
169
|
]);
|
|
169
170
|
useMemo(function() {
|
|
170
171
|
if (funnelChartComponentsRegistered) {
|
|
@@ -823,6 +824,7 @@ var FunnelChart = function(_param) {
|
|
|
823
824
|
onDownload: handleDownload,
|
|
824
825
|
dataTime: dataTime,
|
|
825
826
|
extra: toolbarExtra,
|
|
827
|
+
loading: loading,
|
|
826
828
|
filter: renderFilterInToolbar && filterOptions && filterOptions.length > 1 ? /*#__PURE__*/ React.createElement(ChartFilter, _object_spread_props(_object_spread({
|
|
827
829
|
filterOptions: filterOptions,
|
|
828
830
|
selectedFilter: selectedFilter,
|
|
@@ -61,6 +61,8 @@ export interface LineChartProps extends ChartContainerProps {
|
|
|
61
61
|
renderFilterInToolbar?: boolean;
|
|
62
62
|
/** ChartStatistic组件配置:object表示单个配置,array表示多个配置 */
|
|
63
63
|
statistic?: StatisticConfigType;
|
|
64
|
+
/** 是否显示加载状态(当图表未闭合时显示) */
|
|
65
|
+
loading?: boolean;
|
|
64
66
|
}
|
|
65
67
|
declare const LineChart: React.FC<LineChartProps>;
|
|
66
68
|
export default LineChart;
|