@agions/taroviz 1.11.5 → 2.0.3
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/CHANGELOG.md +245 -0
- package/README.md +31 -46
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/vendors.js +1 -1
- package/dist/cjs/vendors~echarts.js +1 -1
- package/dist/esm/index.js +1 -14270
- package/dist/esm/vendors.js +1 -16770
- package/dist/esm/vendors~echarts.js +1 -59417
- package/package.json +10 -15
- package/src/adapters/h5/index.ts +38 -38
- package/src/adapters/index.ts +32 -34
- package/src/adapters/types.ts +23 -55
- package/src/charts/boxplot/types.ts +2 -2
- package/src/charts/common/BaseChartWrapper.tsx +9 -7
- package/src/charts/createChartComponent.tsx +9 -21
- package/src/charts/createOptionChartComponent.tsx +32 -0
- package/src/charts/funnel/__tests__/index.test.tsx +99 -0
- package/src/charts/funnel/index.tsx +64 -0
- package/src/charts/funnel/types.ts +6 -0
- package/src/charts/graph/__tests__/index.test.tsx +116 -0
- package/src/charts/graph/index.tsx +70 -0
- package/src/charts/graph/types.ts +6 -0
- package/src/charts/heatmap/__tests__/index.test.tsx +139 -0
- package/src/charts/heatmap/index.tsx +107 -0
- package/src/charts/heatmap/types.ts +6 -0
- package/src/charts/index.ts +47 -57
- package/src/charts/liquid/__tests__/index.test.tsx +52 -0
- package/src/charts/liquid/index.tsx +7 -133
- package/src/charts/liquid/types.ts +6 -6
- package/src/charts/parallel/types.ts +3 -3
- package/src/charts/radar/__tests__/index.test.tsx +210 -0
- package/src/charts/radar/index.tsx +147 -0
- package/src/charts/radar/types.ts +13 -0
- package/src/charts/sankey/__tests__/index.test.tsx +124 -0
- package/src/charts/sankey/index.tsx +70 -0
- package/src/charts/sankey/types.ts +6 -0
- package/src/charts/tree/__tests__/index.test.tsx +71 -0
- package/src/charts/tree/index.tsx +1 -1
- package/src/charts/tree/types.ts +8 -8
- package/src/charts/types.ts +208 -106
- package/src/charts/wordcloud/__tests__/index.test.tsx +106 -0
- package/src/charts/wordcloud/index.tsx +79 -0
- package/src/charts/wordcloud/types.ts +6 -0
- package/src/components/DataFilter/index.tsx +7 -6
- package/src/core/animation/types.ts +6 -6
- package/src/core/components/Annotation.tsx +6 -6
- package/src/core/components/BaseChart.tsx +97 -133
- package/src/core/components/LazyChart.tsx +3 -8
- package/src/core/components/hooks/index.ts +6 -2
- package/src/core/components/hooks/usePerformance.ts +8 -2
- package/src/core/components/hooks/useVirtualScroll.ts +2 -1
- package/src/core/types/common.ts +2 -1
- package/src/core/types/platform.ts +1 -0
- package/src/core/utils/__tests__/deepClone.test.ts +317 -0
- package/src/core/utils/__tests__/index.test.ts +2 -1
- package/src/core/utils/chartInstances.ts +13 -0
- package/src/core/utils/common.ts +20 -36
- package/src/core/utils/deepClone.ts +114 -0
- package/src/core/utils/download.ts +22 -28
- package/src/core/utils/drillDown.ts +1 -0
- package/src/core/utils/events.ts +12 -0
- package/src/core/utils/export/ExportUtils.ts +2 -1
- package/src/core/utils/format.ts +44 -0
- package/src/core/utils/index.ts +18 -159
- package/src/core/utils/merge.ts +25 -0
- package/src/core/utils/performance/PerformanceAnalyzer.ts +3 -1
- package/src/core/utils/performance/hooks.ts +7 -0
- package/src/core/utils/performance/index.ts +2 -0
- package/src/{hooks → core/utils/performance}/useAnimation.ts +6 -5
- package/src/{hooks → core/utils/performance}/useDataZoom.ts +7 -2
- package/src/{hooks → core/utils/performance}/usePerformance.ts +39 -39
- package/src/{hooks → core/utils/performance}/usePerformanceHooks.ts +39 -39
- package/src/core/utils/runtime.ts +190 -0
- package/src/editor/components/ThemeSelector.tsx +3 -3
- package/src/hooks/chartConnectHelpers.ts +6 -0
- package/src/hooks/index.ts +54 -626
- package/src/hooks/types.ts +27 -0
- package/src/hooks/useChartAutoResize.ts +73 -0
- package/src/hooks/useChartConnect.ts +5 -1
- package/src/hooks/useChartDownload.ts +1 -1
- package/src/hooks/useChartHistory.ts +1 -3
- package/src/hooks/useChartInit.ts +59 -0
- package/src/hooks/useChartOptions.ts +259 -0
- package/src/hooks/useChartPerformance.ts +109 -0
- package/src/hooks/useChartSelection.ts +23 -12
- package/src/hooks/useChartTheme.ts +51 -0
- package/src/hooks/useDataTransform.ts +19 -4
- package/src/index.ts +5 -10
- package/src/react-dom.d.ts +3 -3
- package/src/themes/index.ts +30 -855
- package/src/themes/palettes/blue-green.ts +13 -0
- package/src/themes/palettes/chalk.ts +13 -0
- package/src/themes/palettes/cyber.ts +44 -0
- package/src/themes/palettes/dark.ts +52 -0
- package/src/themes/palettes/default.ts +52 -0
- package/src/themes/palettes/elegant.ts +34 -0
- package/src/themes/palettes/forest.ts +13 -0
- package/src/themes/palettes/glass.ts +49 -0
- package/src/themes/palettes/golden.ts +13 -0
- package/src/themes/palettes/neon.ts +43 -0
- package/src/themes/palettes/ocean.ts +39 -0
- package/src/themes/palettes/pastel.ts +37 -0
- package/src/themes/palettes/purple-passion.ts +13 -0
- package/src/themes/palettes/retro.ts +33 -0
- package/src/themes/palettes/sunset.ts +40 -0
- package/src/themes/palettes/walden.ts +13 -0
- package/src/themes/registry.ts +184 -0
- package/src/themes/types.ts +213 -0
- package/src/core/utils/codeGenerator/CodeGenerator.ts +0 -669
- package/src/core/utils/codeGenerator/index.ts +0 -13
- package/src/core/utils/codeGenerator/types.ts +0 -198
- package/src/core/utils/configGenerator/ConfigGenerator.ts +0 -583
- package/src/core/utils/configGenerator/index.ts +0 -13
- package/src/core/utils/configGenerator/types.ts +0 -449
- package/src/core/utils/debug/DebugPanel.tsx +0 -640
- package/src/core/utils/debug/debugger.ts +0 -322
- package/src/core/utils/debug/index.ts +0 -21
- package/src/core/utils/debug/types.ts +0 -142
|
@@ -63,7 +63,7 @@ export interface TransformOptions {
|
|
|
63
63
|
order: 'asc' | 'desc';
|
|
64
64
|
};
|
|
65
65
|
/** 过滤配置 */
|
|
66
|
-
filter?: (
|
|
66
|
+
filter?: (_item: Record<string, unknown>) => boolean;
|
|
67
67
|
/** 转换后的额外配置 */
|
|
68
68
|
extraConfig?: Partial<EChartsOption>;
|
|
69
69
|
}
|
|
@@ -109,6 +109,21 @@ export interface TimeSeriesTransformOptions {
|
|
|
109
109
|
// 数据转换 Hook
|
|
110
110
|
// ============================================================================
|
|
111
111
|
|
|
112
|
+
/**
|
|
113
|
+
* 使用图表数据变更
|
|
114
|
+
* @param data 数据源
|
|
115
|
+
* @param transformer 数据转换函数
|
|
116
|
+
* @returns 转换后的图表选项
|
|
117
|
+
*/
|
|
118
|
+
export function useChartData<T = unknown>(data: T | null, transformer: (data: T) => EChartsOption) {
|
|
119
|
+
return useMemo(() => {
|
|
120
|
+
if (!data || (Array.isArray(data) && data.length === 0)) {
|
|
121
|
+
return {};
|
|
122
|
+
}
|
|
123
|
+
return transformer(data);
|
|
124
|
+
}, [data, transformer]);
|
|
125
|
+
}
|
|
126
|
+
|
|
112
127
|
/**
|
|
113
128
|
* 使用数据转换
|
|
114
129
|
* @param options 转换选项
|
|
@@ -174,7 +189,7 @@ export function useTableTransform(options: TableTransformOptions): EChartsOption
|
|
|
174
189
|
name: colConfig?.label || key,
|
|
175
190
|
type: 'bar' as const,
|
|
176
191
|
data: values,
|
|
177
|
-
|
|
192
|
+
_itemStyle: colConfig?.color ? { color: colConfig.color } : undefined,
|
|
178
193
|
};
|
|
179
194
|
});
|
|
180
195
|
|
|
@@ -217,8 +232,8 @@ export function useTimeSeriesTransform(options: TimeSeriesTransformOptions): ECh
|
|
|
217
232
|
const groups = new Set(data.map((d) => String(d[groupField])));
|
|
218
233
|
const series = Array.from(groups).map((group) => {
|
|
219
234
|
const groupValues = categories.map((date) => {
|
|
220
|
-
const
|
|
221
|
-
return aggregateValues(
|
|
235
|
+
const _items = groupedData[date]?.filter((d) => String(d[groupField]) === group) || [];
|
|
236
|
+
return aggregateValues(_items, valueField, aggregation, fillMissing);
|
|
222
237
|
});
|
|
223
238
|
return { name: group, type: 'line', data: groupValues, smooth: true };
|
|
224
239
|
});
|
package/src/index.ts
CHANGED
|
@@ -42,9 +42,8 @@ export {
|
|
|
42
42
|
BarChart,
|
|
43
43
|
PieChart,
|
|
44
44
|
ScatterChart,
|
|
45
|
-
RadarChart,
|
|
45
|
+
RadarChartCustom as RadarChart,
|
|
46
46
|
HeatmapChart,
|
|
47
|
-
GaugeChart,
|
|
48
47
|
FunnelChart,
|
|
49
48
|
// 扩展图表
|
|
50
49
|
TreeMapChart,
|
|
@@ -52,14 +51,10 @@ export {
|
|
|
52
51
|
SankeyChart,
|
|
53
52
|
GraphChart,
|
|
54
53
|
WordCloudChart,
|
|
55
|
-
CandlestickChart,
|
|
56
54
|
// 特殊图表
|
|
57
55
|
BoxplotChart,
|
|
58
56
|
ParallelChart,
|
|
59
|
-
LiquidChart,
|
|
60
57
|
TreeChart,
|
|
61
|
-
// 版本信息
|
|
62
|
-
version,
|
|
63
58
|
// 类型
|
|
64
59
|
type BaseChartProps,
|
|
65
60
|
type LineChartProps,
|
|
@@ -68,17 +63,14 @@ export {
|
|
|
68
63
|
type ScatterChartProps,
|
|
69
64
|
type RadarChartProps,
|
|
70
65
|
type FunnelChartProps,
|
|
71
|
-
type GaugeChartProps,
|
|
72
66
|
type HeatmapChartProps,
|
|
73
67
|
type SunburstChartProps,
|
|
74
68
|
type TreeMapChartProps,
|
|
75
69
|
type SankeyChartProps,
|
|
76
70
|
type GraphChartProps,
|
|
77
71
|
type WordCloudChartProps,
|
|
78
|
-
type CandlestickChartProps,
|
|
79
72
|
type BoxplotChartProps,
|
|
80
73
|
type ParallelChartProps,
|
|
81
|
-
type LiquidChartProps,
|
|
82
74
|
type TreeChartProps,
|
|
83
75
|
} from './charts';
|
|
84
76
|
|
|
@@ -103,6 +95,10 @@ export { getAdapter, detectPlatform, getEnv } from './adapters';
|
|
|
103
95
|
export { default as H5Adapter } from './adapters/h5';
|
|
104
96
|
export { default as WeappAdapter } from './adapters/weapp';
|
|
105
97
|
|
|
98
|
+
// 统一运行时检测
|
|
99
|
+
export { detectRuntime, resetRuntimeCache } from './core/utils/runtime';
|
|
100
|
+
export type { RuntimeInfo, MiniAppType } from './core/utils/runtime';
|
|
101
|
+
|
|
106
102
|
// 主题系统
|
|
107
103
|
export type { BuiltinTheme, ThemeOptions } from './themes';
|
|
108
104
|
export {
|
|
@@ -192,7 +188,6 @@ export {
|
|
|
192
188
|
useTableTransform,
|
|
193
189
|
useTimeSeriesTransform,
|
|
194
190
|
// v1.7.0 新增 Hooks
|
|
195
|
-
useDataZoom,
|
|
196
191
|
useChartConnect,
|
|
197
192
|
useChartDownload,
|
|
198
193
|
} from './hooks';
|
package/src/react-dom.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare module 'react-dom' {
|
|
2
2
|
export function render(
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
_element: React.ReactElement<any, string | React.JSXElementConstructor<any>>,
|
|
4
|
+
_container: Element | null,
|
|
5
|
+
_callback?: () => void
|
|
6
6
|
): React.ReactInstance;
|
|
7
7
|
}
|