@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.
Files changed (118) hide show
  1. package/CHANGELOG.md +245 -0
  2. package/README.md +31 -46
  3. package/dist/cjs/index.js +1 -1
  4. package/dist/cjs/vendors.js +1 -1
  5. package/dist/cjs/vendors~echarts.js +1 -1
  6. package/dist/esm/index.js +1 -14270
  7. package/dist/esm/vendors.js +1 -16770
  8. package/dist/esm/vendors~echarts.js +1 -59417
  9. package/package.json +10 -15
  10. package/src/adapters/h5/index.ts +38 -38
  11. package/src/adapters/index.ts +32 -34
  12. package/src/adapters/types.ts +23 -55
  13. package/src/charts/boxplot/types.ts +2 -2
  14. package/src/charts/common/BaseChartWrapper.tsx +9 -7
  15. package/src/charts/createChartComponent.tsx +9 -21
  16. package/src/charts/createOptionChartComponent.tsx +32 -0
  17. package/src/charts/funnel/__tests__/index.test.tsx +99 -0
  18. package/src/charts/funnel/index.tsx +64 -0
  19. package/src/charts/funnel/types.ts +6 -0
  20. package/src/charts/graph/__tests__/index.test.tsx +116 -0
  21. package/src/charts/graph/index.tsx +70 -0
  22. package/src/charts/graph/types.ts +6 -0
  23. package/src/charts/heatmap/__tests__/index.test.tsx +139 -0
  24. package/src/charts/heatmap/index.tsx +107 -0
  25. package/src/charts/heatmap/types.ts +6 -0
  26. package/src/charts/index.ts +47 -57
  27. package/src/charts/liquid/__tests__/index.test.tsx +52 -0
  28. package/src/charts/liquid/index.tsx +7 -133
  29. package/src/charts/liquid/types.ts +6 -6
  30. package/src/charts/parallel/types.ts +3 -3
  31. package/src/charts/radar/__tests__/index.test.tsx +210 -0
  32. package/src/charts/radar/index.tsx +147 -0
  33. package/src/charts/radar/types.ts +13 -0
  34. package/src/charts/sankey/__tests__/index.test.tsx +124 -0
  35. package/src/charts/sankey/index.tsx +70 -0
  36. package/src/charts/sankey/types.ts +6 -0
  37. package/src/charts/tree/__tests__/index.test.tsx +71 -0
  38. package/src/charts/tree/index.tsx +1 -1
  39. package/src/charts/tree/types.ts +8 -8
  40. package/src/charts/types.ts +208 -106
  41. package/src/charts/wordcloud/__tests__/index.test.tsx +106 -0
  42. package/src/charts/wordcloud/index.tsx +79 -0
  43. package/src/charts/wordcloud/types.ts +6 -0
  44. package/src/components/DataFilter/index.tsx +7 -6
  45. package/src/core/animation/types.ts +6 -6
  46. package/src/core/components/Annotation.tsx +6 -6
  47. package/src/core/components/BaseChart.tsx +97 -133
  48. package/src/core/components/LazyChart.tsx +3 -8
  49. package/src/core/components/hooks/index.ts +6 -2
  50. package/src/core/components/hooks/usePerformance.ts +8 -2
  51. package/src/core/components/hooks/useVirtualScroll.ts +2 -1
  52. package/src/core/types/common.ts +2 -1
  53. package/src/core/types/platform.ts +1 -0
  54. package/src/core/utils/__tests__/deepClone.test.ts +317 -0
  55. package/src/core/utils/__tests__/index.test.ts +2 -1
  56. package/src/core/utils/chartInstances.ts +13 -0
  57. package/src/core/utils/common.ts +20 -36
  58. package/src/core/utils/deepClone.ts +114 -0
  59. package/src/core/utils/download.ts +22 -28
  60. package/src/core/utils/drillDown.ts +1 -0
  61. package/src/core/utils/events.ts +12 -0
  62. package/src/core/utils/export/ExportUtils.ts +2 -1
  63. package/src/core/utils/format.ts +44 -0
  64. package/src/core/utils/index.ts +18 -159
  65. package/src/core/utils/merge.ts +25 -0
  66. package/src/core/utils/performance/PerformanceAnalyzer.ts +3 -1
  67. package/src/core/utils/performance/hooks.ts +7 -0
  68. package/src/core/utils/performance/index.ts +2 -0
  69. package/src/{hooks → core/utils/performance}/useAnimation.ts +6 -5
  70. package/src/{hooks → core/utils/performance}/useDataZoom.ts +7 -2
  71. package/src/{hooks → core/utils/performance}/usePerformance.ts +39 -39
  72. package/src/{hooks → core/utils/performance}/usePerformanceHooks.ts +39 -39
  73. package/src/core/utils/runtime.ts +190 -0
  74. package/src/editor/components/ThemeSelector.tsx +3 -3
  75. package/src/hooks/chartConnectHelpers.ts +6 -0
  76. package/src/hooks/index.ts +54 -626
  77. package/src/hooks/types.ts +27 -0
  78. package/src/hooks/useChartAutoResize.ts +73 -0
  79. package/src/hooks/useChartConnect.ts +5 -1
  80. package/src/hooks/useChartDownload.ts +1 -1
  81. package/src/hooks/useChartHistory.ts +1 -3
  82. package/src/hooks/useChartInit.ts +59 -0
  83. package/src/hooks/useChartOptions.ts +259 -0
  84. package/src/hooks/useChartPerformance.ts +109 -0
  85. package/src/hooks/useChartSelection.ts +23 -12
  86. package/src/hooks/useChartTheme.ts +51 -0
  87. package/src/hooks/useDataTransform.ts +19 -4
  88. package/src/index.ts +5 -10
  89. package/src/react-dom.d.ts +3 -3
  90. package/src/themes/index.ts +30 -855
  91. package/src/themes/palettes/blue-green.ts +13 -0
  92. package/src/themes/palettes/chalk.ts +13 -0
  93. package/src/themes/palettes/cyber.ts +44 -0
  94. package/src/themes/palettes/dark.ts +52 -0
  95. package/src/themes/palettes/default.ts +52 -0
  96. package/src/themes/palettes/elegant.ts +34 -0
  97. package/src/themes/palettes/forest.ts +13 -0
  98. package/src/themes/palettes/glass.ts +49 -0
  99. package/src/themes/palettes/golden.ts +13 -0
  100. package/src/themes/palettes/neon.ts +43 -0
  101. package/src/themes/palettes/ocean.ts +39 -0
  102. package/src/themes/palettes/pastel.ts +37 -0
  103. package/src/themes/palettes/purple-passion.ts +13 -0
  104. package/src/themes/palettes/retro.ts +33 -0
  105. package/src/themes/palettes/sunset.ts +40 -0
  106. package/src/themes/palettes/walden.ts +13 -0
  107. package/src/themes/registry.ts +184 -0
  108. package/src/themes/types.ts +213 -0
  109. package/src/core/utils/codeGenerator/CodeGenerator.ts +0 -669
  110. package/src/core/utils/codeGenerator/index.ts +0 -13
  111. package/src/core/utils/codeGenerator/types.ts +0 -198
  112. package/src/core/utils/configGenerator/ConfigGenerator.ts +0 -583
  113. package/src/core/utils/configGenerator/index.ts +0 -13
  114. package/src/core/utils/configGenerator/types.ts +0 -449
  115. package/src/core/utils/debug/DebugPanel.tsx +0 -640
  116. package/src/core/utils/debug/debugger.ts +0 -322
  117. package/src/core/utils/debug/index.ts +0 -21
  118. 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?: (item: Record<string, unknown>) => boolean;
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
- itemStyle: colConfig?.color ? { color: colConfig.color } : undefined,
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 items = groupedData[date]?.filter((d) => String(d[groupField]) === group) || [];
221
- return aggregateValues(items, valueField, aggregation, fillMissing);
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';
@@ -1,7 +1,7 @@
1
1
  declare module 'react-dom' {
2
2
  export function render(
3
- element: React.ReactElement<any, string | React.JSXElementConstructor<any>>,
4
- container: Element | null,
5
- callback?: () => void
3
+ _element: React.ReactElement<any, string | React.JSXElementConstructor<any>>,
4
+ _container: Element | null,
5
+ _callback?: () => void
6
6
  ): React.ReactInstance;
7
7
  }