@antv/gpt-vis 0.0.6 → 0.2.0

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 (272) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +92 -50
  3. package/README.zh-CN.md +138 -0
  4. package/dist/cjs/Area/index.d.ts +8 -2
  5. package/dist/cjs/Area/index.js +17 -16
  6. package/dist/cjs/Bar/index.d.ts +11 -0
  7. package/dist/cjs/Bar/index.js +65 -0
  8. package/dist/cjs/ChartCodeRender/Loading.d.ts +3 -0
  9. package/dist/cjs/ChartCodeRender/Loading.js +54 -0
  10. package/dist/cjs/ChartCodeRender/VisChart.d.ts +11 -0
  11. package/dist/cjs/ChartCodeRender/VisChart.js +84 -0
  12. package/dist/cjs/ChartCodeRender/index.d.ts +3 -4
  13. package/dist/cjs/ChartCodeRender/index.js +24 -68
  14. package/dist/cjs/ChartCodeRender/type.d.ts +9 -11
  15. package/dist/cjs/Column/index.d.ts +8 -2
  16. package/dist/cjs/Column/index.js +19 -27
  17. package/dist/cjs/ConfigProvider/context.d.ts +3 -0
  18. package/dist/cjs/ConfigProvider/context.js +41 -0
  19. package/dist/cjs/ConfigProvider/hooks/index.d.ts +1 -0
  20. package/dist/cjs/ConfigProvider/hooks/index.js +23 -0
  21. package/dist/cjs/ConfigProvider/hooks/useConfig.d.ts +13 -0
  22. package/dist/cjs/ConfigProvider/hooks/useConfig.js +108 -0
  23. package/dist/cjs/ConfigProvider/index.d.ts +2 -5
  24. package/dist/cjs/ConfigProvider/index.js +15 -9
  25. package/dist/cjs/DualAxes/index.d.ts +15 -0
  26. package/dist/cjs/DualAxes/index.js +71 -0
  27. package/dist/cjs/DualAxes/util.d.ts +9 -0
  28. package/dist/cjs/DualAxes/util.js +73 -0
  29. package/dist/cjs/FlowDiagram/index.d.ts +6 -0
  30. package/dist/cjs/FlowDiagram/index.js +100 -0
  31. package/dist/cjs/GPTVis/Lite.d.ts +10 -0
  32. package/dist/cjs/GPTVis/Lite.js +54 -0
  33. package/dist/cjs/GPTVis/index.d.ts +4 -8
  34. package/dist/cjs/GPTVis/index.js +4 -4
  35. package/dist/cjs/HeatMap/index.d.ts +7 -7
  36. package/dist/cjs/HeatMap/index.js +13 -26
  37. package/dist/cjs/Histogram/index.d.ts +10 -0
  38. package/dist/cjs/Histogram/index.js +51 -0
  39. package/dist/cjs/IndentedTree/index.d.ts +6 -0
  40. package/dist/cjs/IndentedTree/index.js +63 -0
  41. package/dist/cjs/Line/index.d.ts +8 -6
  42. package/dist/cjs/Line/index.js +15 -16
  43. package/dist/cjs/Map/data.json +305 -0
  44. package/dist/cjs/Map/index.d.ts +5 -0
  45. package/dist/cjs/Map/index.js +68 -0
  46. package/dist/cjs/MindMap/index.d.ts +6 -0
  47. package/dist/cjs/MindMap/index.js +64 -0
  48. package/dist/cjs/NetworkGraph/index.d.ts +6 -0
  49. package/dist/cjs/NetworkGraph/index.js +72 -0
  50. package/dist/cjs/OrganizationChart/index.d.ts +6 -0
  51. package/dist/cjs/OrganizationChart/index.js +93 -0
  52. package/dist/cjs/PathMap/index.d.ts +3 -9
  53. package/dist/cjs/PathMap/index.js +19 -109
  54. package/dist/cjs/Pie/index.d.ts +7 -5
  55. package/dist/cjs/Pie/index.js +17 -13
  56. package/dist/cjs/PinMap/index.d.ts +3 -9
  57. package/dist/cjs/PinMap/index.js +6 -85
  58. package/dist/cjs/Radar/index.d.ts +11 -0
  59. package/dist/cjs/Radar/index.js +84 -0
  60. package/dist/cjs/Scatter/index.d.ts +11 -0
  61. package/dist/cjs/Scatter/index.js +57 -0
  62. package/dist/cjs/Text/VisText.d.ts +4 -0
  63. package/dist/cjs/Text/VisText.js +74 -0
  64. package/dist/cjs/Text/config.d.ts +18 -0
  65. package/dist/cjs/Text/config.js +91 -0
  66. package/dist/cjs/Text/constants.d.ts +9 -0
  67. package/dist/cjs/Text/constants.js +37 -0
  68. package/dist/cjs/Text/custom-icons/index.d.ts +3 -0
  69. package/dist/cjs/Text/custom-icons/index.js +66 -0
  70. package/dist/cjs/Text/index.d.ts +3 -0
  71. package/dist/cjs/Text/index.js +42 -0
  72. package/dist/cjs/Text/mini-charts/hooks/getElementFontSize.d.ts +1 -0
  73. package/dist/cjs/Text/mini-charts/hooks/getElementFontSize.js +65 -0
  74. package/dist/cjs/Text/mini-charts/hooks/index.d.ts +1 -0
  75. package/dist/cjs/Text/mini-charts/hooks/index.js +29 -0
  76. package/dist/cjs/Text/mini-charts/hooks/useSvgWrapper.d.ts +5 -0
  77. package/dist/cjs/Text/mini-charts/hooks/useSvgWrapper.js +65 -0
  78. package/dist/cjs/Text/mini-charts/index.d.ts +2 -0
  79. package/dist/cjs/Text/mini-charts/index.js +25 -0
  80. package/dist/cjs/Text/mini-charts/line/SingleLineChart.d.ts +3 -0
  81. package/dist/cjs/Text/mini-charts/line/SingleLineChart.js +63 -0
  82. package/dist/cjs/Text/mini-charts/line/index.d.ts +1 -0
  83. package/dist/cjs/Text/mini-charts/line/index.js +29 -0
  84. package/dist/cjs/Text/mini-charts/line/scaleLinear.d.ts +4 -0
  85. package/dist/cjs/Text/mini-charts/line/scaleLinear.js +35 -0
  86. package/dist/cjs/Text/mini-charts/line/useLineCompute.d.ts +6 -0
  87. package/dist/cjs/Text/mini-charts/line/useLineCompute.js +103 -0
  88. package/dist/cjs/Text/mini-charts/proportion/getArcPath.d.ts +1 -0
  89. package/dist/cjs/Text/mini-charts/proportion/getArcPath.js +51 -0
  90. package/dist/cjs/Text/mini-charts/proportion/index.d.ts +3 -0
  91. package/dist/cjs/Text/mini-charts/proportion/index.js +72 -0
  92. package/dist/cjs/Text/types.d.ts +20 -0
  93. package/dist/cjs/Text/types.js +17 -0
  94. package/dist/cjs/Treemap/index.d.ts +11 -0
  95. package/dist/cjs/Treemap/index.js +73 -0
  96. package/dist/cjs/WordCloud/index.d.ts +4 -5
  97. package/dist/cjs/WordCloud/index.js +7 -15
  98. package/dist/cjs/constants/index.d.ts +1 -3
  99. package/dist/cjs/constants/index.js +4 -35
  100. package/dist/cjs/export.d.ts +28 -0
  101. package/dist/cjs/export.js +116 -0
  102. package/dist/cjs/index.d.ts +10 -11
  103. package/dist/cjs/index.js +9 -25
  104. package/dist/cjs/types/chart.d.ts +49 -14
  105. package/dist/cjs/types/chart.js +12 -0
  106. package/dist/cjs/types/config.d.ts +16 -0
  107. package/dist/cjs/types/index.d.ts +1 -1
  108. package/dist/cjs/types/index.js +0 -9
  109. package/dist/cjs/types/map.d.ts +242 -0
  110. package/dist/cjs/types/map.js +17 -0
  111. package/dist/cjs/utils/config.d.ts +5 -5
  112. package/dist/cjs/utils/config.js +41 -24
  113. package/dist/cjs/utils/graph.d.ts +18 -0
  114. package/dist/cjs/utils/graph.js +64 -0
  115. package/dist/cjs/utils/index.d.ts +1 -1
  116. package/dist/cjs/utils/index.js +3 -13
  117. package/dist/cjs/utils/map/context.d.ts +3 -0
  118. package/dist/cjs/utils/map/context.js +42 -0
  119. package/dist/cjs/utils/map/controls.d.ts +0 -0
  120. package/dist/cjs/utils/map/controls.js +0 -0
  121. package/dist/cjs/utils/map/index.d.ts +6 -0
  122. package/dist/cjs/utils/map/index.js +33 -0
  123. package/dist/cjs/utils/map/markers.d.ts +2 -0
  124. package/dist/cjs/utils/map/markers.js +88 -0
  125. package/dist/cjs/utils/map/polyline.d.ts +2 -0
  126. package/dist/cjs/utils/map/polyline.js +52 -0
  127. package/dist/cjs/utils/map/style.d.ts +45 -0
  128. package/dist/cjs/utils/map/style.js +112 -0
  129. package/dist/cjs/utils/map/util.d.ts +1 -0
  130. package/dist/cjs/utils/map/util.js +38 -0
  131. package/dist/cjs/utils/map/view.d.ts +3 -0
  132. package/dist/cjs/utils/map/view.js +93 -0
  133. package/dist/cjs/utils/plot.d.ts +4 -0
  134. package/dist/cjs/utils/plot.js +69 -0
  135. package/dist/cjs/version.d.ts +2 -0
  136. package/dist/cjs/version.js +25 -0
  137. package/dist/esm/Area/index.d.ts +8 -2
  138. package/dist/esm/Area/index.js +21 -27
  139. package/dist/esm/Bar/index.d.ts +11 -0
  140. package/dist/esm/Bar/index.js +35 -0
  141. package/dist/esm/ChartCodeRender/Loading.d.ts +3 -0
  142. package/dist/esm/ChartCodeRender/Loading.js +20 -0
  143. package/dist/esm/ChartCodeRender/VisChart.d.ts +11 -0
  144. package/dist/esm/ChartCodeRender/VisChart.js +65 -0
  145. package/dist/esm/ChartCodeRender/index.d.ts +3 -4
  146. package/dist/esm/ChartCodeRender/index.js +28 -84
  147. package/dist/esm/ChartCodeRender/type.d.ts +9 -11
  148. package/dist/esm/Column/index.d.ts +8 -2
  149. package/dist/esm/Column/index.js +22 -27
  150. package/dist/esm/ConfigProvider/context.d.ts +3 -0
  151. package/dist/esm/ConfigProvider/context.js +3 -0
  152. package/dist/esm/ConfigProvider/hooks/index.d.ts +1 -0
  153. package/dist/esm/ConfigProvider/hooks/index.js +1 -0
  154. package/dist/esm/ConfigProvider/hooks/useConfig.d.ts +13 -0
  155. package/dist/esm/ConfigProvider/hooks/useConfig.js +57 -0
  156. package/dist/esm/ConfigProvider/index.d.ts +2 -5
  157. package/dist/esm/ConfigProvider/index.js +9 -9
  158. package/dist/esm/DualAxes/index.d.ts +15 -0
  159. package/dist/esm/DualAxes/index.js +44 -0
  160. package/dist/esm/DualAxes/util.d.ts +9 -0
  161. package/dist/esm/DualAxes/util.js +61 -0
  162. package/dist/esm/FlowDiagram/index.d.ts +6 -0
  163. package/dist/esm/FlowDiagram/index.js +75 -0
  164. package/dist/esm/GPTVis/Lite.d.ts +10 -0
  165. package/dist/esm/GPTVis/Lite.js +18 -0
  166. package/dist/esm/GPTVis/index.d.ts +4 -8
  167. package/dist/esm/GPTVis/index.js +5 -5
  168. package/dist/esm/HeatMap/index.d.ts +7 -7
  169. package/dist/esm/HeatMap/index.js +19 -27
  170. package/dist/esm/Histogram/index.d.ts +10 -0
  171. package/dist/esm/Histogram/index.js +25 -0
  172. package/dist/esm/IndentedTree/index.d.ts +6 -0
  173. package/dist/esm/IndentedTree/index.js +47 -0
  174. package/dist/esm/Line/index.d.ts +8 -6
  175. package/dist/esm/Line/index.js +17 -23
  176. package/dist/esm/Map/data.json +305 -0
  177. package/dist/esm/Map/index.d.ts +5 -0
  178. package/dist/esm/Map/index.js +60 -0
  179. package/dist/esm/MindMap/index.d.ts +6 -0
  180. package/dist/esm/MindMap/index.js +48 -0
  181. package/dist/esm/NetworkGraph/index.d.ts +6 -0
  182. package/dist/esm/NetworkGraph/index.js +57 -0
  183. package/dist/esm/OrganizationChart/index.d.ts +6 -0
  184. package/dist/esm/OrganizationChart/index.js +64 -0
  185. package/dist/esm/PathMap/index.d.ts +3 -9
  186. package/dist/esm/PathMap/index.js +32 -129
  187. package/dist/esm/Pie/index.d.ts +7 -5
  188. package/dist/esm/Pie/index.js +24 -20
  189. package/dist/esm/PinMap/index.d.ts +3 -9
  190. package/dist/esm/PinMap/index.js +18 -104
  191. package/dist/esm/Radar/index.d.ts +11 -0
  192. package/dist/esm/Radar/index.js +54 -0
  193. package/dist/esm/Scatter/index.d.ts +11 -0
  194. package/dist/esm/Scatter/index.js +30 -0
  195. package/dist/esm/Text/VisText.d.ts +4 -0
  196. package/dist/esm/Text/VisText.js +38 -0
  197. package/dist/esm/Text/config.d.ts +18 -0
  198. package/dist/esm/Text/config.js +79 -0
  199. package/dist/esm/Text/constants.d.ts +9 -0
  200. package/dist/esm/Text/constants.js +9 -0
  201. package/dist/esm/Text/custom-icons/index.d.ts +3 -0
  202. package/dist/esm/Text/custom-icons/index.js +37 -0
  203. package/dist/esm/Text/index.d.ts +3 -0
  204. package/dist/esm/Text/index.js +2 -0
  205. package/dist/esm/Text/mini-charts/hooks/getElementFontSize.d.ts +1 -0
  206. package/dist/esm/Text/mini-charts/hooks/getElementFontSize.js +32 -0
  207. package/dist/esm/Text/mini-charts/hooks/index.d.ts +1 -0
  208. package/dist/esm/Text/mini-charts/hooks/index.js +1 -0
  209. package/dist/esm/Text/mini-charts/hooks/useSvgWrapper.d.ts +5 -0
  210. package/dist/esm/Text/mini-charts/hooks/useSvgWrapper.js +31 -0
  211. package/dist/esm/Text/mini-charts/index.d.ts +2 -0
  212. package/dist/esm/Text/mini-charts/index.js +2 -0
  213. package/dist/esm/Text/mini-charts/line/SingleLineChart.d.ts +3 -0
  214. package/dist/esm/Text/mini-charts/line/SingleLineChart.js +57 -0
  215. package/dist/esm/Text/mini-charts/line/index.d.ts +1 -0
  216. package/dist/esm/Text/mini-charts/line/index.js +1 -0
  217. package/dist/esm/Text/mini-charts/line/scaleLinear.d.ts +4 -0
  218. package/dist/esm/Text/mini-charts/line/scaleLinear.js +14 -0
  219. package/dist/esm/Text/mini-charts/line/useLineCompute.d.ts +6 -0
  220. package/dist/esm/Text/mini-charts/line/useLineCompute.js +106 -0
  221. package/dist/esm/Text/mini-charts/proportion/getArcPath.d.ts +1 -0
  222. package/dist/esm/Text/mini-charts/proportion/getArcPath.js +19 -0
  223. package/dist/esm/Text/mini-charts/proportion/index.d.ts +3 -0
  224. package/dist/esm/Text/mini-charts/proportion/index.js +60 -0
  225. package/dist/esm/Text/types.d.ts +20 -0
  226. package/dist/esm/Text/types.js +1 -0
  227. package/dist/esm/Treemap/index.d.ts +11 -0
  228. package/dist/esm/Treemap/index.js +52 -0
  229. package/dist/esm/WordCloud/index.d.ts +4 -5
  230. package/dist/esm/WordCloud/index.js +8 -18
  231. package/dist/esm/constants/index.d.ts +1 -3
  232. package/dist/esm/constants/index.js +5 -14
  233. package/dist/esm/export.d.ts +28 -0
  234. package/dist/esm/export.js +33 -0
  235. package/dist/esm/index.d.ts +10 -11
  236. package/dist/esm/index.js +9 -9
  237. package/dist/esm/types/chart.d.ts +49 -14
  238. package/dist/esm/types/chart.js +12 -0
  239. package/dist/esm/types/config.d.ts +16 -0
  240. package/dist/esm/types/index.d.ts +1 -1
  241. package/dist/esm/types/index.js +1 -1
  242. package/dist/esm/types/map.d.ts +242 -0
  243. package/dist/esm/types/map.js +1 -0
  244. package/dist/esm/utils/config.d.ts +5 -5
  245. package/dist/esm/utils/config.js +40 -18
  246. package/dist/esm/utils/graph.d.ts +18 -0
  247. package/dist/esm/utils/graph.js +49 -0
  248. package/dist/esm/utils/index.d.ts +1 -1
  249. package/dist/esm/utils/index.js +1 -1
  250. package/dist/esm/utils/map/context.d.ts +3 -0
  251. package/dist/esm/utils/map/context.js +34 -0
  252. package/dist/esm/utils/map/controls.d.ts +0 -0
  253. package/dist/esm/utils/map/controls.js +0 -0
  254. package/dist/esm/utils/map/index.d.ts +6 -0
  255. package/dist/esm/utils/map/index.js +6 -0
  256. package/dist/esm/utils/map/markers.d.ts +2 -0
  257. package/dist/esm/utils/map/markers.js +64 -0
  258. package/dist/esm/utils/map/polyline.d.ts +2 -0
  259. package/dist/esm/utils/map/polyline.js +26 -0
  260. package/dist/esm/utils/map/style.d.ts +45 -0
  261. package/dist/esm/utils/map/style.js +76 -0
  262. package/dist/esm/utils/map/util.d.ts +1 -0
  263. package/dist/esm/utils/map/util.js +11 -0
  264. package/dist/esm/utils/map/view.d.ts +3 -0
  265. package/dist/esm/utils/map/view.js +81 -0
  266. package/dist/esm/utils/plot.d.ts +4 -0
  267. package/dist/esm/utils/plot.js +65 -0
  268. package/dist/esm/version.d.ts +2 -0
  269. package/dist/esm/version.js +1 -0
  270. package/dist/umd/895.async.js +1 -0
  271. package/dist/umd/index.min.js +1 -0
  272. package/package.json +97 -58
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ /********** plot chart **********/
3
+ import { default as Area, type AreaProps } from './Area';
4
+ import { default as Bar, type BarProps } from './Bar';
5
+ import { default as Column, type ColumnProps } from './Column';
6
+ import { default as DualAxes, type DualAxesProps } from './DualAxes';
7
+ import { default as HeatMap, type HeatMapProps } from './HeatMap';
8
+ import { default as Histogram, type HistogramProps } from './Histogram';
9
+ import { default as Line, type LineProps } from './Line';
10
+ import { default as Pie, type PieProps } from './Pie';
11
+ import { default as Radar, type RadarProps } from './Radar';
12
+ import { default as Scatter, type ScatterProps } from './Scatter';
13
+ import { default as Treemap, type TreemapProps } from './Treemap';
14
+ import { default as WordCloud, type WordCloudProps } from './WordCloud';
15
+ /********** graph chart **********/
16
+ import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
17
+ import { default as MindMap, type MindMapProps } from './MindMap';
18
+ import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
19
+ import { default as PathMap, type PathMapProps } from './PathMap';
20
+ import { default as PinMap, type PinMapProps } from './PinMap';
21
+ export { default as IndentedTree, type IndentedTreeProps } from './IndentedTree';
22
+ export { default as OrganizationChart, type OrganizationChartProps } from './OrganizationChart';
23
+ /********** map chart **********/
24
+ export { default as Map, type MapProps } from './Map';
25
+ /********** NTV **********/
26
+ export { VisText, type VisTextProps } from './Text';
27
+ export { Area, Bar, Column, DualAxes, FlowDiagram, HeatMap, Histogram, Line, MindMap, NetworkGraph, PathMap, Pie, PinMap, Radar, Scatter, Treemap, WordCloud, type AreaProps, type BarProps, type ColumnProps, type DualAxesProps, type FlowDiagramProps, type HeatMapProps, type HistogramProps, type LineProps, type MindMapProps, type NetworkGraphProps, type PathMapProps, type PieProps, type PinMapProps, type RadarProps, type ScatterProps, type TreemapProps, type WordCloudProps, };
28
+ export declare const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>>;
@@ -0,0 +1,33 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ var _DEFAULT_CHART_COMPON;
3
+ /********** plot chart **********/
4
+ import { default as Area } from "./Area";
5
+ import { default as Bar } from "./Bar";
6
+ import { default as Column } from "./Column";
7
+ import { default as DualAxes } from "./DualAxes";
8
+ import { default as HeatMap } from "./HeatMap";
9
+ import { default as Histogram } from "./Histogram";
10
+ import { default as Line } from "./Line";
11
+ import { default as Pie } from "./Pie";
12
+ import { default as Radar } from "./Radar";
13
+ import { default as Scatter } from "./Scatter";
14
+ import { default as Treemap } from "./Treemap";
15
+ import { default as WordCloud } from "./WordCloud";
16
+
17
+ /********** graph chart **********/
18
+ import { default as FlowDiagram } from "./FlowDiagram";
19
+ import { default as MindMap } from "./MindMap";
20
+ import { default as NetworkGraph } from "./NetworkGraph";
21
+ import { default as PathMap } from "./PathMap";
22
+ import { default as PinMap } from "./PinMap";
23
+ import { ChartType } from "./types";
24
+ export { default as IndentedTree } from "./IndentedTree";
25
+ export { default as OrganizationChart } from "./OrganizationChart";
26
+
27
+ /********** map chart **********/
28
+ export { default as Map } from "./Map";
29
+
30
+ /********** NTV **********/
31
+ export { VisText } from "./Text";
32
+ export { Area, Bar, Column, DualAxes, FlowDiagram, HeatMap, Histogram, Line, MindMap, NetworkGraph, PathMap, Pie, PinMap, Radar, Scatter, Treemap, WordCloud };
33
+ export var DEFAULT_CHART_COMPONENTS = (_DEFAULT_CHART_COMPON = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_DEFAULT_CHART_COMPON, ChartType.Line, Line), ChartType.Column, Column), ChartType.Pie, Pie), ChartType.Bar, Bar), ChartType.Area, Area), ChartType.Scatter, Scatter), ChartType.PinMap, PinMap), ChartType.PathMap, PathMap), ChartType.HeatMap, HeatMap), ChartType.MindMap, MindMap), _defineProperty(_defineProperty(_DEFAULT_CHART_COMPON, ChartType.FlowDiagram, FlowDiagram), ChartType.NetworkGraph, NetworkGraph));
@@ -1,12 +1,11 @@
1
- export { default as Area, type AreaProps } from './Area';
2
- export { default as Column, type ColumnProps } from './Column';
3
- export { default as Line, type LineProps } from './Line';
4
- export { default as Pie, type PieProps } from './Pie';
5
- export { default as WordCloud, type WordCloudProps } from './WordCloud';
6
- export { default as HeatMap, type HeatMapProps } from './HeatMap';
7
- export { default as PathMap, type PathMapProps } from './PathMap';
8
- export { default as PinMap, type PinMapProps } from './PinMap';
9
- export { withChartCode, withDefaultChartCode } from './ChartCodeRender';
10
- export { default as ConfigProvider, type ConfigProviderProps, } from './ConfigProvider';
11
- export { default as GPTVis } from './GPTVis';
1
+ /********** export chart **********/
2
+ export * from './export';
3
+ /********** export types **********/
12
4
  export * from './types';
5
+ /********** export GPTVis **********/
6
+ export { withChartCode, withDefaultChartCode } from './ChartCodeRender';
7
+ export type { CodeBlockComponent, WithChartCodeOptions } from './ChartCodeRender/type';
8
+ export { default as ConfigProvider, type ConfigProviderProps } from './ConfigProvider';
9
+ export { default as GPTVis, type GPTVisProps } from './GPTVis';
10
+ export { default as GPTVisLite, type GPTVisLiteProps } from './GPTVis/Lite';
11
+ export { default as version } from './version';
package/dist/esm/index.js CHANGED
@@ -1,12 +1,12 @@
1
- export { default as Area } from "./Area";
2
- export { default as Column } from "./Column";
3
- export { default as Line } from "./Line";
4
- export { default as Pie } from "./Pie";
5
- export { default as WordCloud } from "./WordCloud";
6
- export { default as HeatMap } from "./HeatMap";
7
- export { default as PathMap } from "./PathMap";
8
- export { default as PinMap } from "./PinMap";
1
+ /********** export chart **********/
2
+ export * from "./export";
3
+
4
+ /********** export types **********/
5
+ export * from "./types";
6
+
7
+ /********** export GPTVis **********/
9
8
  export { withChartCode, withDefaultChartCode } from "./ChartCodeRender";
10
9
  export { default as ConfigProvider } from "./ConfigProvider";
11
10
  export { default as GPTVis } from "./GPTVis";
12
- export * from "./types";
11
+ export { default as GPTVisLite } from "./GPTVis/Lite";
12
+ export { default as version } from "./version";
@@ -1,30 +1,65 @@
1
1
  import type { LarkMapProps } from '@antv/larkmap';
2
- import type { CSSProperties } from 'react';
2
+ import type { CSSProperties, ReactNode } from 'react';
3
+ import type { Map } from './map';
3
4
  export type { LarkMapProps };
4
5
  export declare enum ChartType {
5
6
  Pie = "pie",
6
7
  Column = "column",
7
8
  Line = "line",
8
9
  Area = "area",
10
+ Scatter = "scatter",
11
+ Histogram = "histogram",
12
+ Treemap = "treemap",
13
+ Bar = "bar",
9
14
  WordCloud = "word-cloud",
15
+ DualAxes = "dual-axes",
16
+ Radar = "radar",
10
17
  PinMap = "pin-map",
11
18
  PathMap = "path-map",
12
- HeatMap = "heat-map"
19
+ HeatMap = "heat-map",
20
+ MindMap = "mind-map",
21
+ NetworkGraph = "network-graph",
22
+ FlowDiagram = "flow-diagram",
23
+ OrganizationChart = "organization-chart",
24
+ IndentedTree = "indented-tree",
25
+ VisText = "vis-text"
13
26
  }
14
- export interface BaseChartProps<T> {
15
- data: T[];
16
- style?: CSSProperties;
27
+ export type Charts = keyof typeof ChartType;
28
+ export interface BaseChartProps {
29
+ containerStyle?: CSSProperties;
17
30
  className?: string;
31
+ children?: ReactNode;
32
+ }
33
+ export interface BasePlotProps<T> extends BaseChartProps {
34
+ data: T[];
35
+ axisXTitle?: string;
36
+ axisYTitle?: string;
37
+ }
38
+ export interface BaseMapProps<T> extends BaseChartProps, Map {
39
+ data: T[];
40
+ token?: string;
41
+ }
42
+ export interface BaseGraphProps<T> extends BaseChartProps {
43
+ data: T;
44
+ }
45
+ interface GraphNode {
46
+ name: string;
47
+ }
48
+ interface GraphEdge {
49
+ source: string;
50
+ target: string;
51
+ name?: string;
52
+ }
53
+ export interface GraphData {
54
+ nodes: GraphNode[];
55
+ edges: GraphEdge[];
18
56
  }
19
- export interface XYAxis {
20
- x: string | number;
21
- y: number;
22
- [key: string]: string | number;
57
+ export interface TreeGraphData {
58
+ name: string;
59
+ children?: TreeGraphData[];
60
+ [key: string]: any;
23
61
  }
24
- export interface StackableChartProps extends BaseChartProps<XYAxis> {
25
- xField?: string;
26
- yField?: string;
27
- stackField?: string;
62
+ export interface GraphProps extends BaseGraphProps<GraphData> {
28
63
  }
29
- export interface BaseMapProps<T> extends BaseChartProps<T>, LarkMapProps {
64
+ export interface TreeGraphProps extends BaseGraphProps<TreeGraphData> {
30
65
  }
@@ -3,9 +3,21 @@ export var ChartType = /*#__PURE__*/function (ChartType) {
3
3
  ChartType["Column"] = "column";
4
4
  ChartType["Line"] = "line";
5
5
  ChartType["Area"] = "area";
6
+ ChartType["Scatter"] = "scatter";
7
+ ChartType["Histogram"] = "histogram";
8
+ ChartType["Treemap"] = "treemap";
9
+ ChartType["Bar"] = "bar";
6
10
  ChartType["WordCloud"] = "word-cloud";
11
+ ChartType["DualAxes"] = "dual-axes";
12
+ ChartType["Radar"] = "radar";
7
13
  ChartType["PinMap"] = "pin-map";
8
14
  ChartType["PathMap"] = "path-map";
9
15
  ChartType["HeatMap"] = "heat-map";
16
+ ChartType["MindMap"] = "mind-map";
17
+ ChartType["NetworkGraph"] = "network-graph";
18
+ ChartType["FlowDiagram"] = "flow-diagram";
19
+ ChartType["OrganizationChart"] = "organization-chart";
20
+ ChartType["IndentedTree"] = "indented-tree";
21
+ ChartType["VisText"] = "vis-text";
10
22
  return ChartType;
11
23
  }({});
@@ -1,9 +1,25 @@
1
+ import type { GraphOptions as ADCGraphOptions } from '@ant-design/graphs';
2
+ import type { G2 } from '@ant-design/plots';
3
+ import type { Charts } from './chart';
4
+ type PlotGlobalConfig = {
5
+ theme?: G2.Theme;
6
+ [key: string]: any;
7
+ };
8
+ type GraphGlobalConfig = ADCGraphOptions & {
9
+ [key: string]: any;
10
+ };
1
11
  type MapGlobalConfig = {
2
12
  style?: 'normal' | 'light' | 'dark' | string;
3
13
  token?: string;
14
+ enableZoom?: boolean;
15
+ enableRotate?: boolean;
4
16
  [key: string]: any;
5
17
  };
18
+ type ComponentsGlobalConfig = Partial<Record<Charts, Record<string, any>>>;
6
19
  export type GlobalConfig = {
20
+ plot?: PlotGlobalConfig;
21
+ graph?: GraphGlobalConfig;
7
22
  map?: MapGlobalConfig;
23
+ components?: ComponentsGlobalConfig;
8
24
  };
9
25
  export {};
@@ -1,2 +1,2 @@
1
1
  export * from './chart';
2
- export { GlobalConfig } from './config';
2
+ export type { GlobalConfig } from './config';
@@ -1,2 +1,2 @@
1
1
  export * from "./chart";
2
- export { GlobalConfig } from "./config";
2
+ export {};
@@ -0,0 +1,242 @@
1
+ type AsyncCall<T = {
2
+ [k: string | number | symbol]: any;
3
+ }, Success = any, Fail = any, Complete = any> = (params: T & {
4
+ success: (params: Success) => void;
5
+ fail: (params: Fail) => void;
6
+ complete?: (params: Complete) => void;
7
+ }) => void;
8
+ /**
9
+ * 地图组件上下文对象
10
+ *
11
+ * @see https://opendocs.alipay.com/mini/api/mapcontext
12
+ */
13
+ export interface MapContext {
14
+ /**
15
+ * 设置地图底图类型
16
+ *
17
+ * @see https://opendocs.alipay.com/mini/api/setmaptype
18
+ */
19
+ setMapType: AsyncCall<{
20
+ mapType: 0 | 1 | 2 | 3 | 4;
21
+ }>;
22
+ /**
23
+ * 平移缩放到指定区域
24
+ *
25
+ * @see https://opendocs.alipay.com/mini/api/includepoints
26
+ */
27
+ includePoints: AsyncCall<{
28
+ points: Array<{
29
+ longitude: number;
30
+ latitude: number;
31
+ }>;
32
+ padding?: [number, number, number, number];
33
+ }>;
34
+ }
35
+ export interface MapInstance {
36
+ getContext: () => MapContext;
37
+ }
38
+ /**
39
+ * 经纬度坐标点
40
+ */
41
+ export interface LngLat {
42
+ longitude: number;
43
+ latitude: number;
44
+ }
45
+ /**
46
+ * 标记点
47
+ *
48
+ * 更多属性信息查看 @see https://opendocs.alipay.com/mini/component/map#markers
49
+ */
50
+ export interface Marker extends LngLat {
51
+ id: string;
52
+ iconPath?: string;
53
+ width?: number;
54
+ height?: number;
55
+ alpha?: number;
56
+ anchorX?: number;
57
+ anchorY?: number;
58
+ label?: {
59
+ content?: string;
60
+ color?: string;
61
+ fontSize?: number;
62
+ borderRadius?: number;
63
+ bgColor?: string;
64
+ padding?: number;
65
+ };
66
+ }
67
+ /**
68
+ * 折线
69
+ *
70
+ * 更多属性信息查看 @see https://opendocs.alipay.com/mini/component/map#polyline
71
+ */
72
+ export interface Polyline {
73
+ points: LngLat[];
74
+ width?: number;
75
+ color?: string;
76
+ dottedLine?: boolean;
77
+ iconPath?: string;
78
+ iconWidth?: number;
79
+ colorList?: string[];
80
+ }
81
+ /**
82
+ * 面
83
+ *
84
+ * @see https://opendocs.alipay.com/mini/component/map?pathHash=c9886630#polygon
85
+ */
86
+ export interface Polygon {
87
+ points: LngLat[];
88
+ color?: string;
89
+ fillColor?: string;
90
+ width?: number;
91
+ }
92
+ /**
93
+ * @see https://opendocs.alipay.com/mini/component/map
94
+ */
95
+ export interface Map {
96
+ id?: string;
97
+ /**
98
+ * @title 地图类型
99
+ * @description 底图的样式
100
+ *
101
+ * - 0 标准地图
102
+ * - 1 卫星地图
103
+ * - 2 夜视地图
104
+ * - 3 导航地图
105
+ * - 4 公交地图
106
+ */
107
+ mapType?: 0 | 1 | 2 | 3 | 4 | string;
108
+ /**
109
+ * @title 展示实时定位点
110
+ * @description 展示用户当前带箭头的实时定位点
111
+ */
112
+ showLocation?: boolean;
113
+ /**
114
+ * @title 中心纬度
115
+ * @description
116
+ */
117
+ latitude?: number;
118
+ /**
119
+ * @title 中心经度
120
+ * @description
121
+ */
122
+ longitude?: number;
123
+ /**
124
+ * @title 缩放级别
125
+ * @description 取值范围为 5-18
126
+ * @default "16"
127
+ */
128
+ scale?: number;
129
+ /**
130
+ * @title 倾斜角度
131
+ * @description 范围 0 ~ 40 , 关于 z 轴的倾
132
+ * @default "0"
133
+ */
134
+ skew?: number;
135
+ /**
136
+ * @title 顺时针旋转的角度
137
+ * @description 范围 0 ~ 360
138
+ * @default "0"
139
+ */
140
+ rotate?: number;
141
+ /**
142
+ * @title 视野范围
143
+ * @description 视野将进行小范围延伸包含传入的坐标
144
+ */
145
+ includePoints?: LngLat[];
146
+ /**
147
+ * @title 视野边界
148
+ * @description 视野在地图 padding 范围内展示
149
+ */
150
+ includePadding?: {
151
+ left: number;
152
+ right: number;
153
+ top: number;
154
+ bottom: number;
155
+ };
156
+ /**
157
+ * @title 是否启用缩放
158
+ * @description 缩放交互开关
159
+ * @default true
160
+ */
161
+ enableZoom?: boolean;
162
+ /**
163
+ * @title 是否启用拖动
164
+ * @description 拖动交互开关
165
+ * @default true
166
+ */
167
+ enableScroll?: boolean;
168
+ /**
169
+ * @title 是否启用旋转
170
+ * @description 旋转交互开关
171
+ * @default true
172
+ */
173
+ enableRotate?: boolean;
174
+ /**
175
+ * @title 标记点
176
+ * @description 可在地图上展示多个标记点
177
+ */
178
+ markers?: Marker[];
179
+ /**
180
+ * @title 折线
181
+ * @description 可在地图上展示多个折线
182
+ */
183
+ polyline?: Polyline[];
184
+ /**
185
+ * @title 面
186
+ * @description 可在地图上展示多个面
187
+ */
188
+ polygon?: Polygon[];
189
+ /**
190
+ * @title 地图视野变化事件
191
+ * @description 拖动/旋转/缩放地图时触发
192
+ */
193
+ onRegionChange?: (event: {
194
+ type: 'begin' | 'end';
195
+ latitude: number;
196
+ longitude: number;
197
+ scale: number;
198
+ skew: number;
199
+ rotate: number;
200
+ causedBy: 'update' | 'gesture';
201
+ }) => void;
202
+ /**
203
+ * @title 地图点击事件
204
+ * @description 点击地图时触发
205
+ */
206
+ onTap?: (event: {
207
+ latitude: number;
208
+ longitude: number;
209
+ }) => void;
210
+ /**
211
+ * @title 标记点击事件
212
+ * @description 点击标记及其标签时触发
213
+ */
214
+ onMarkerTap?: (event: {
215
+ markerId: string;
216
+ latitude: number;
217
+ longitude: number;
218
+ }) => void;
219
+ /**
220
+ * @title 地图初始化完成事件
221
+ * @description 地图初始化完成即将开始渲染第一帧时触发
222
+ */
223
+ onInitComplete?: () => void;
224
+ }
225
+ export interface MarkerData extends Omit<Marker, 'id' | 'label'> {
226
+ id?: string;
227
+ label?: string | Marker['label'];
228
+ }
229
+ export interface PinMap extends Map {
230
+ data?: MarkerData[];
231
+ markerStyle?: Partial<Marker>;
232
+ }
233
+ export interface RouteData {
234
+ markers?: MarkerData[];
235
+ path?: Polyline;
236
+ }
237
+ export interface PathMap extends Map {
238
+ data?: RouteData[];
239
+ markerStyle?: Partial<Marker>;
240
+ pathStyle?: Partial<Polyline>;
241
+ }
242
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
- import type { LarkMapProps } from '../types';
2
- import { GlobalConfig } from '../types';
3
- export declare const setGlobalConfig: (config: GlobalConfig) => void;
4
- export declare const getGlobalConfig: () => GlobalConfig;
5
- export declare const getMapConfig: (props: LarkMapProps) => LarkMapProps;
1
+ import type { GlobalConfig } from '../types';
2
+ export declare const mergeGlobalConfig: (config: GlobalConfig) => GlobalConfig;
3
+ export declare function mergeGraphOptions(...options: Record<string, any>[]): {
4
+ [x: string]: any;
5
+ };
@@ -1,26 +1,48 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import { mergeWith } from 'lodash';
2
+ import { isPlainObject, mergeWith } from 'lodash';
3
3
  import { DEFAULT_GLOBAL_CONFIG } from "../constants";
4
- var globalConfig = DEFAULT_GLOBAL_CONFIG;
5
- export var setGlobalConfig = function setGlobalConfig(config) {
6
- globalConfig = mergeWith(globalConfig, config, function (objValue) {
4
+ export var mergeGlobalConfig = function mergeGlobalConfig(config) {
5
+ var globalConfig = mergeWith({}, DEFAULT_GLOBAL_CONFIG, config, function (objValue) {
7
6
  if (Array.isArray(objValue)) {
8
7
  return objValue;
9
8
  }
10
9
  });
11
- };
12
- export var getGlobalConfig = function getGlobalConfig() {
13
10
  return globalConfig;
14
11
  };
15
- export var getMapConfig = function getMapConfig(props) {
16
- var _getGlobalConfig = getGlobalConfig(),
17
- mapConfig = _getGlobalConfig.map;
18
- var config = _objectSpread(_objectSpread({}, props), {}, {
19
- mapOptions: _objectSpread(_objectSpread({
20
- center: [120.210792, 30.246026],
21
- zoom: 12,
22
- maxZoom: 18
23
- }, mapConfig), props.mapOptions)
24
- });
25
- return config;
26
- };
12
+ function mergeGraphFunctions(key, currValue, prevValue) {
13
+ if (['plugins', 'behaviors', 'transforms'].includes(key)) {
14
+ return function (prev) {
15
+ return currValue(prev);
16
+ };
17
+ } else {
18
+ return function (datum) {
19
+ // @ts-ignore this refers to the graph instance
20
+ var value = currValue.call(this, datum);
21
+ if (isPlainObject(value)) return mergeGraphOptions(prevValue, value);
22
+ return value;
23
+ };
24
+ }
25
+ }
26
+ export function mergeGraphOptions() {
27
+ if (arguments.length === 0) return {};
28
+ var merged = _objectSpread({}, arguments.length <= 0 ? undefined : arguments[0]);
29
+ for (var i = 1; i < arguments.length; i++) {
30
+ var currentOptions = i < 0 || arguments.length <= i ? undefined : arguments[i];
31
+ for (var key in currentOptions) {
32
+ if (currentOptions.hasOwnProperty(key)) {
33
+ var currValue = currentOptions[key];
34
+ var prevValue = merged[key];
35
+ if (['component', 'data'].includes(key)) {
36
+ merged[key] = currValue;
37
+ } else if (typeof currValue === 'function') {
38
+ merged[key] = mergeGraphFunctions(key, currValue, prevValue);
39
+ } else if (isPlainObject(currValue) && isPlainObject(prevValue)) {
40
+ merged[key] = mergeGraphOptions(prevValue, currValue);
41
+ } else {
42
+ merged[key] = currValue;
43
+ }
44
+ }
45
+ }
46
+ }
47
+ return merged;
48
+ }
@@ -0,0 +1,18 @@
1
+ import { G6 } from '@ant-design/graphs';
2
+ import type { GraphData, TreeGraphData } from '../types';
3
+ export declare function visTreeData2GraphData(data: TreeGraphData): G6.GraphData;
4
+ export declare function visGraphData2GraphData(data: GraphData): {
5
+ nodes: {
6
+ id: string;
7
+ style: {
8
+ labelText: string;
9
+ };
10
+ }[];
11
+ edges: {
12
+ source: string;
13
+ target: string;
14
+ style: {
15
+ labelText: string | undefined;
16
+ };
17
+ }[];
18
+ };
@@ -0,0 +1,49 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["children"];
4
+ // FIXME: 全量导入 G6 模块
5
+ import { G6 } from '@ant-design/graphs';
6
+ var treeToGraphData = G6.treeToGraphData;
7
+ export function visTreeData2GraphData(data) {
8
+ return treeToGraphData(data, {
9
+ getNodeData: function getNodeData(datum, depth) {
10
+ datum.id = datum.name;
11
+ datum.depth = depth;
12
+ if (!datum.children) return datum;
13
+ var children = datum.children,
14
+ restDatum = _objectWithoutProperties(datum, _excluded);
15
+ return _objectSpread(_objectSpread({}, restDatum), {}, {
16
+ children: children.map(function (child) {
17
+ return child.name;
18
+ })
19
+ });
20
+ },
21
+ getEdgeData: function getEdgeData(source, target) {
22
+ return {
23
+ source: source.name,
24
+ target: target.name
25
+ };
26
+ }
27
+ });
28
+ }
29
+ export function visGraphData2GraphData(data) {
30
+ return {
31
+ nodes: data.nodes.map(function (node) {
32
+ return {
33
+ id: node.name,
34
+ style: {
35
+ labelText: node.name
36
+ }
37
+ };
38
+ }),
39
+ edges: data.edges.map(function (edge) {
40
+ return {
41
+ source: edge.source,
42
+ target: edge.target,
43
+ style: {
44
+ labelText: edge.name
45
+ }
46
+ };
47
+ })
48
+ };
49
+ }
@@ -1 +1 @@
1
- export { getGlobalConfig, getMapConfig, setGlobalConfig } from './config';
1
+ export * from './map';
@@ -1 +1 @@
1
- export { getGlobalConfig, getMapConfig, setGlobalConfig } from "./config";
1
+ export * from "./map";
@@ -0,0 +1,3 @@
1
+ import type { Scene } from '@antv/l7';
2
+ import type { Map } from '../../types/map';
3
+ export declare function setMapContext(props: Map, scene: Scene): Promise<void[]> | undefined;