@antv/gpt-vis 0.0.5 → 0.1.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 (270) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -60
  3. package/README.zh-CN.md +93 -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 +21 -29
  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 +107 -0
  23. package/dist/cjs/ConfigProvider/index.d.ts +7 -0
  24. package/dist/cjs/ConfigProvider/index.js +43 -0
  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/index.d.ts +7 -7
  32. package/dist/cjs/GPTVis/index.js +4 -9
  33. package/dist/cjs/HeatMap/index.d.ts +7 -7
  34. package/dist/cjs/HeatMap/index.js +13 -36
  35. package/dist/cjs/Histogram/index.d.ts +10 -0
  36. package/dist/cjs/Histogram/index.js +51 -0
  37. package/dist/cjs/IndentedTree/index.d.ts +6 -0
  38. package/dist/cjs/IndentedTree/index.js +63 -0
  39. package/dist/cjs/Line/index.d.ts +8 -2
  40. package/dist/cjs/Line/index.js +15 -17
  41. package/dist/cjs/Map/data.json +305 -0
  42. package/dist/cjs/Map/index.d.ts +5 -0
  43. package/dist/cjs/Map/index.js +68 -0
  44. package/dist/cjs/MindMap/index.d.ts +6 -0
  45. package/dist/cjs/MindMap/index.js +64 -0
  46. package/dist/cjs/NetworkGraph/index.d.ts +6 -0
  47. package/dist/cjs/NetworkGraph/index.js +72 -0
  48. package/dist/cjs/OrganizationChart/index.d.ts +6 -0
  49. package/dist/cjs/OrganizationChart/index.js +93 -0
  50. package/dist/cjs/PathMap/index.d.ts +3 -9
  51. package/dist/cjs/PathMap/index.js +19 -111
  52. package/dist/cjs/Pie/index.d.ts +7 -5
  53. package/dist/cjs/Pie/index.js +17 -16
  54. package/dist/cjs/PinMap/index.d.ts +3 -9
  55. package/dist/cjs/PinMap/index.js +6 -87
  56. package/dist/cjs/Radar/index.d.ts +11 -0
  57. package/dist/cjs/Radar/index.js +84 -0
  58. package/dist/cjs/Scatter/index.d.ts +11 -0
  59. package/dist/cjs/Scatter/index.js +57 -0
  60. package/dist/cjs/Text/VisText.d.ts +4 -0
  61. package/dist/cjs/Text/VisText.js +71 -0
  62. package/dist/cjs/Text/config.d.ts +18 -0
  63. package/dist/cjs/Text/config.js +91 -0
  64. package/dist/cjs/Text/constants.d.ts +9 -0
  65. package/dist/cjs/Text/constants.js +37 -0
  66. package/dist/cjs/Text/custom-icons/index.d.ts +3 -0
  67. package/dist/cjs/Text/custom-icons/index.js +66 -0
  68. package/dist/cjs/Text/index.d.ts +3 -0
  69. package/dist/cjs/Text/index.js +42 -0
  70. package/dist/cjs/Text/mini-charts/hooks/getElementFontSize.d.ts +1 -0
  71. package/dist/cjs/Text/mini-charts/hooks/getElementFontSize.js +65 -0
  72. package/dist/cjs/Text/mini-charts/hooks/index.d.ts +1 -0
  73. package/dist/cjs/Text/mini-charts/hooks/index.js +29 -0
  74. package/dist/cjs/Text/mini-charts/hooks/useSvgWrapper.d.ts +5 -0
  75. package/dist/cjs/Text/mini-charts/hooks/useSvgWrapper.js +65 -0
  76. package/dist/cjs/Text/mini-charts/index.d.ts +2 -0
  77. package/dist/cjs/Text/mini-charts/index.js +25 -0
  78. package/dist/cjs/Text/mini-charts/line/SingleLineChart.d.ts +3 -0
  79. package/dist/cjs/Text/mini-charts/line/SingleLineChart.js +63 -0
  80. package/dist/cjs/Text/mini-charts/line/index.d.ts +1 -0
  81. package/dist/cjs/Text/mini-charts/line/index.js +29 -0
  82. package/dist/cjs/Text/mini-charts/line/scaleLinear.d.ts +4 -0
  83. package/dist/cjs/Text/mini-charts/line/scaleLinear.js +35 -0
  84. package/dist/cjs/Text/mini-charts/line/useLineCompute.d.ts +6 -0
  85. package/dist/cjs/Text/mini-charts/line/useLineCompute.js +103 -0
  86. package/dist/cjs/Text/mini-charts/proportion/getArcPath.d.ts +1 -0
  87. package/dist/cjs/Text/mini-charts/proportion/getArcPath.js +51 -0
  88. package/dist/cjs/Text/mini-charts/proportion/index.d.ts +3 -0
  89. package/dist/cjs/Text/mini-charts/proportion/index.js +72 -0
  90. package/dist/cjs/Text/types.d.ts +20 -0
  91. package/dist/cjs/Text/types.js +17 -0
  92. package/dist/cjs/Treemap/index.d.ts +11 -0
  93. package/dist/cjs/Treemap/index.js +73 -0
  94. package/dist/cjs/WordCloud/index.d.ts +4 -5
  95. package/dist/cjs/WordCloud/index.js +7 -15
  96. package/dist/cjs/constants/index.d.ts +2 -2
  97. package/dist/cjs/constants/index.js +8 -27
  98. package/dist/cjs/export.d.ts +25 -0
  99. package/dist/cjs/export.js +119 -0
  100. package/dist/cjs/index.d.ts +4 -11
  101. package/dist/cjs/index.js +5 -18
  102. package/dist/cjs/types/chart.d.ts +65 -0
  103. package/dist/cjs/types/chart.js +51 -0
  104. package/dist/cjs/types/config.d.ts +20 -0
  105. package/dist/cjs/types/config.js +17 -0
  106. package/dist/cjs/types/index.d.ts +2 -26
  107. package/dist/cjs/types/index.js +3 -19
  108. package/dist/cjs/types/map.d.ts +242 -0
  109. package/dist/cjs/types/map.js +17 -0
  110. package/dist/cjs/utils/config.d.ts +5 -0
  111. package/dist/cjs/utils/config.js +76 -0
  112. package/dist/cjs/utils/graph.d.ts +18 -0
  113. package/dist/cjs/utils/graph.js +64 -0
  114. package/dist/cjs/utils/index.d.ts +1 -0
  115. package/dist/cjs/utils/index.js +23 -0
  116. package/dist/cjs/utils/map/context.d.ts +3 -0
  117. package/dist/cjs/utils/map/context.js +42 -0
  118. package/dist/cjs/utils/map/controls.d.ts +0 -0
  119. package/dist/cjs/utils/map/controls.js +0 -0
  120. package/dist/cjs/utils/map/index.d.ts +6 -0
  121. package/dist/cjs/utils/map/index.js +33 -0
  122. package/dist/cjs/utils/map/markers.d.ts +2 -0
  123. package/dist/cjs/utils/map/markers.js +88 -0
  124. package/dist/cjs/utils/map/polyline.d.ts +2 -0
  125. package/dist/cjs/utils/map/polyline.js +52 -0
  126. package/dist/cjs/utils/map/style.d.ts +45 -0
  127. package/dist/cjs/utils/map/style.js +112 -0
  128. package/dist/cjs/utils/map/util.d.ts +1 -0
  129. package/dist/cjs/utils/map/util.js +38 -0
  130. package/dist/cjs/utils/map/view.d.ts +3 -0
  131. package/dist/cjs/utils/map/view.js +93 -0
  132. package/dist/cjs/utils/plot.d.ts +4 -0
  133. package/dist/cjs/utils/plot.js +69 -0
  134. package/dist/cjs/version.d.ts +2 -0
  135. package/dist/cjs/version.js +25 -0
  136. package/dist/esm/Area/index.d.ts +8 -2
  137. package/dist/esm/Area/index.js +21 -27
  138. package/dist/esm/Bar/index.d.ts +11 -0
  139. package/dist/esm/Bar/index.js +35 -0
  140. package/dist/esm/ChartCodeRender/Loading.d.ts +3 -0
  141. package/dist/esm/ChartCodeRender/Loading.js +20 -0
  142. package/dist/esm/ChartCodeRender/VisChart.d.ts +11 -0
  143. package/dist/esm/ChartCodeRender/VisChart.js +65 -0
  144. package/dist/esm/ChartCodeRender/index.d.ts +3 -4
  145. package/dist/esm/ChartCodeRender/index.js +28 -84
  146. package/dist/esm/ChartCodeRender/type.d.ts +9 -11
  147. package/dist/esm/Column/index.d.ts +8 -2
  148. package/dist/esm/Column/index.js +24 -29
  149. package/dist/esm/ConfigProvider/context.d.ts +3 -0
  150. package/dist/esm/ConfigProvider/context.js +3 -0
  151. package/dist/esm/ConfigProvider/hooks/index.d.ts +1 -0
  152. package/dist/esm/ConfigProvider/hooks/index.js +1 -0
  153. package/dist/esm/ConfigProvider/hooks/useConfig.d.ts +13 -0
  154. package/dist/esm/ConfigProvider/hooks/useConfig.js +55 -0
  155. package/dist/esm/ConfigProvider/index.d.ts +7 -0
  156. package/dist/esm/ConfigProvider/index.js +16 -0
  157. package/dist/esm/DualAxes/index.d.ts +15 -0
  158. package/dist/esm/DualAxes/index.js +44 -0
  159. package/dist/esm/DualAxes/util.d.ts +9 -0
  160. package/dist/esm/DualAxes/util.js +61 -0
  161. package/dist/esm/FlowDiagram/index.d.ts +6 -0
  162. package/dist/esm/FlowDiagram/index.js +75 -0
  163. package/dist/esm/GPTVis/index.d.ts +7 -7
  164. package/dist/esm/GPTVis/index.js +4 -4
  165. package/dist/esm/HeatMap/index.d.ts +7 -7
  166. package/dist/esm/HeatMap/index.js +21 -36
  167. package/dist/esm/Histogram/index.d.ts +10 -0
  168. package/dist/esm/Histogram/index.js +25 -0
  169. package/dist/esm/IndentedTree/index.d.ts +6 -0
  170. package/dist/esm/IndentedTree/index.js +47 -0
  171. package/dist/esm/Line/index.d.ts +8 -2
  172. package/dist/esm/Line/index.js +18 -25
  173. package/dist/esm/Map/data.json +305 -0
  174. package/dist/esm/Map/index.d.ts +5 -0
  175. package/dist/esm/Map/index.js +60 -0
  176. package/dist/esm/MindMap/index.d.ts +6 -0
  177. package/dist/esm/MindMap/index.js +48 -0
  178. package/dist/esm/NetworkGraph/index.d.ts +6 -0
  179. package/dist/esm/NetworkGraph/index.js +57 -0
  180. package/dist/esm/OrganizationChart/index.d.ts +6 -0
  181. package/dist/esm/OrganizationChart/index.js +64 -0
  182. package/dist/esm/PathMap/index.d.ts +3 -9
  183. package/dist/esm/PathMap/index.js +33 -135
  184. package/dist/esm/Pie/index.d.ts +7 -5
  185. package/dist/esm/Pie/index.js +24 -25
  186. package/dist/esm/PinMap/index.d.ts +3 -9
  187. package/dist/esm/PinMap/index.js +19 -110
  188. package/dist/esm/Radar/index.d.ts +11 -0
  189. package/dist/esm/Radar/index.js +54 -0
  190. package/dist/esm/Scatter/index.d.ts +11 -0
  191. package/dist/esm/Scatter/index.js +30 -0
  192. package/dist/esm/Text/VisText.d.ts +4 -0
  193. package/dist/esm/Text/VisText.js +34 -0
  194. package/dist/esm/Text/config.d.ts +18 -0
  195. package/dist/esm/Text/config.js +79 -0
  196. package/dist/esm/Text/constants.d.ts +9 -0
  197. package/dist/esm/Text/constants.js +9 -0
  198. package/dist/esm/Text/custom-icons/index.d.ts +3 -0
  199. package/dist/esm/Text/custom-icons/index.js +37 -0
  200. package/dist/esm/Text/index.d.ts +3 -0
  201. package/dist/esm/Text/index.js +2 -0
  202. package/dist/esm/Text/mini-charts/hooks/getElementFontSize.d.ts +1 -0
  203. package/dist/esm/Text/mini-charts/hooks/getElementFontSize.js +32 -0
  204. package/dist/esm/Text/mini-charts/hooks/index.d.ts +1 -0
  205. package/dist/esm/Text/mini-charts/hooks/index.js +1 -0
  206. package/dist/esm/Text/mini-charts/hooks/useSvgWrapper.d.ts +5 -0
  207. package/dist/esm/Text/mini-charts/hooks/useSvgWrapper.js +31 -0
  208. package/dist/esm/Text/mini-charts/index.d.ts +2 -0
  209. package/dist/esm/Text/mini-charts/index.js +2 -0
  210. package/dist/esm/Text/mini-charts/line/SingleLineChart.d.ts +3 -0
  211. package/dist/esm/Text/mini-charts/line/SingleLineChart.js +57 -0
  212. package/dist/esm/Text/mini-charts/line/index.d.ts +1 -0
  213. package/dist/esm/Text/mini-charts/line/index.js +1 -0
  214. package/dist/esm/Text/mini-charts/line/scaleLinear.d.ts +4 -0
  215. package/dist/esm/Text/mini-charts/line/scaleLinear.js +14 -0
  216. package/dist/esm/Text/mini-charts/line/useLineCompute.d.ts +6 -0
  217. package/dist/esm/Text/mini-charts/line/useLineCompute.js +106 -0
  218. package/dist/esm/Text/mini-charts/proportion/getArcPath.d.ts +1 -0
  219. package/dist/esm/Text/mini-charts/proportion/getArcPath.js +19 -0
  220. package/dist/esm/Text/mini-charts/proportion/index.d.ts +3 -0
  221. package/dist/esm/Text/mini-charts/proportion/index.js +60 -0
  222. package/dist/esm/Text/types.d.ts +20 -0
  223. package/dist/esm/Text/types.js +1 -0
  224. package/dist/esm/Treemap/index.d.ts +11 -0
  225. package/dist/esm/Treemap/index.js +52 -0
  226. package/dist/esm/WordCloud/index.d.ts +4 -5
  227. package/dist/esm/WordCloud/index.js +8 -18
  228. package/dist/esm/constants/index.d.ts +2 -2
  229. package/dist/esm/constants/index.js +9 -8
  230. package/dist/esm/export.d.ts +25 -0
  231. package/dist/esm/export.js +27 -0
  232. package/dist/esm/index.d.ts +4 -11
  233. package/dist/esm/index.js +2 -15
  234. package/dist/esm/types/chart.d.ts +65 -0
  235. package/dist/esm/types/chart.js +23 -0
  236. package/dist/esm/types/config.d.ts +20 -0
  237. package/dist/esm/types/config.js +1 -0
  238. package/dist/esm/types/index.d.ts +2 -26
  239. package/dist/esm/types/index.js +2 -11
  240. package/dist/esm/types/map.d.ts +242 -0
  241. package/dist/esm/types/map.js +1 -0
  242. package/dist/esm/utils/config.d.ts +5 -0
  243. package/dist/esm/utils/config.js +48 -0
  244. package/dist/esm/utils/graph.d.ts +18 -0
  245. package/dist/esm/utils/graph.js +49 -0
  246. package/dist/esm/utils/index.d.ts +1 -0
  247. package/dist/esm/utils/index.js +1 -0
  248. package/dist/esm/utils/map/context.d.ts +3 -0
  249. package/dist/esm/utils/map/context.js +34 -0
  250. package/dist/esm/utils/map/controls.d.ts +0 -0
  251. package/dist/esm/utils/map/controls.js +0 -0
  252. package/dist/esm/utils/map/index.d.ts +6 -0
  253. package/dist/esm/utils/map/index.js +6 -0
  254. package/dist/esm/utils/map/markers.d.ts +2 -0
  255. package/dist/esm/utils/map/markers.js +64 -0
  256. package/dist/esm/utils/map/polyline.d.ts +2 -0
  257. package/dist/esm/utils/map/polyline.js +26 -0
  258. package/dist/esm/utils/map/style.d.ts +45 -0
  259. package/dist/esm/utils/map/style.js +76 -0
  260. package/dist/esm/utils/map/util.d.ts +1 -0
  261. package/dist/esm/utils/map/util.js +11 -0
  262. package/dist/esm/utils/map/view.d.ts +3 -0
  263. package/dist/esm/utils/map/view.js +81 -0
  264. package/dist/esm/utils/plot.d.ts +4 -0
  265. package/dist/esm/utils/plot.js +65 -0
  266. package/dist/esm/version.d.ts +2 -0
  267. package/dist/esm/version.js +1 -0
  268. package/dist/umd/861.async.js +1 -0
  269. package/dist/umd/index.min.js +1 -0
  270. package/package.json +97 -59
@@ -1,27 +1,17 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
- import { WordCloud as WordCloudPlot } from '@ant-design/plots';
1
+ import { WordCloud as ADCWordCloud } from '@ant-design/plots';
4
2
  import React from 'react';
5
- var config = {
3
+ import { usePlotConfig } from "../ConfigProvider/hooks";
4
+ var defaultConfig = {
6
5
  autoFit: true,
7
6
  layout: {
8
7
  fontSize: [20, 100]
9
8
  },
10
- encode: {
11
- color: 'text'
12
- },
13
- legend: false
9
+ colorField: 'text',
10
+ legend: false,
11
+ tooltip: false
14
12
  };
15
13
  var WordCloud = function WordCloud(props) {
16
- var className = props.className,
17
- style = props.style,
18
- _props$data = props.data,
19
- data = _props$data === void 0 ? [] : _props$data;
20
- return /*#__PURE__*/React.createElement(WordCloudPlot, _extends({
21
- className: className,
22
- containerStyle: _objectSpread({}, style)
23
- }, config, {
24
- data: data
25
- }));
14
+ var config = usePlotConfig('WordCloud', defaultConfig, props);
15
+ return /*#__PURE__*/React.createElement(ADCWordCloud, config);
26
16
  };
27
17
  export default WordCloud;
@@ -1,2 +1,2 @@
1
- /// <reference types="react" />
2
- export declare const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>>;
1
+ import type { GlobalConfig } from '../types';
2
+ export declare const DEFAULT_GLOBAL_CONFIG: GlobalConfig;
@@ -1,8 +1,9 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import Area from "../Area";
3
- import Column from "../Column";
4
- import Line from "../Line";
5
- import Pie from "../Pie";
6
- import { ChartType } from "../types";
7
- import WordCloud from "../WordCloud";
8
- export var DEFAULT_CHART_COMPONENTS = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ChartType.Pie, Pie), ChartType.Area, Area), ChartType.Column, Column), ChartType.Line, Line), ChartType.WordCloud, WordCloud);
1
+ import { DEFAULT_VIS_TEXT_CONFIG } from "../Text";
2
+ export var DEFAULT_GLOBAL_CONFIG = {
3
+ map: {
4
+ style: 'light'
5
+ },
6
+ components: {
7
+ VisText: DEFAULT_VIS_TEXT_CONFIG
8
+ }
9
+ };
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { default as Area, type AreaProps } from './Area';
3
+ import { default as Bar, type BarProps } from './Bar';
4
+ import { default as Column, type ColumnProps } from './Column';
5
+ import { default as DualAxes, type DualAxesProps } from './DualAxes';
6
+ import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
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 MindMap, type MindMapProps } from './MindMap';
11
+ import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
12
+ import { default as PathMap, type PathMapProps } from './PathMap';
13
+ import { default as Pie, type PieProps } from './Pie';
14
+ import { default as PinMap, type PinMapProps } from './PinMap';
15
+ import { default as Radar, type RadarProps } from './Radar';
16
+ import { default as Scatter, type ScatterProps } from './Scatter';
17
+ import { default as Treemap, type TreemapProps } from './Treemap';
18
+ import { default as WordCloud, type WordCloudProps } from './WordCloud';
19
+ export { default as ConfigProvider, type ConfigProviderProps } from './ConfigProvider';
20
+ export { default as IndentedTree, type IndentedTreeProps } from './IndentedTree';
21
+ export { default as Map, type MapProps } from './Map';
22
+ export { default as OrganizationChart, type OrganizationChartProps } from './OrganizationChart';
23
+ 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, };
24
+ export { VisText, type VisTextProps } from './Text';
25
+ export declare const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>>;
@@ -0,0 +1,27 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ var _DEFAULT_CHART_COMPON;
3
+ import { default as Area } from "./Area";
4
+ import { default as Bar } from "./Bar";
5
+ import { default as Column } from "./Column";
6
+ import { default as DualAxes } from "./DualAxes";
7
+ import { default as FlowDiagram } from "./FlowDiagram";
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 MindMap } from "./MindMap";
12
+ import { default as NetworkGraph } from "./NetworkGraph";
13
+ import { default as PathMap } from "./PathMap";
14
+ import { default as Pie } from "./Pie";
15
+ import { default as PinMap } from "./PinMap";
16
+ import { default as Radar } from "./Radar";
17
+ import { default as Scatter } from "./Scatter";
18
+ import { default as Treemap } from "./Treemap";
19
+ import { ChartType } from "./types";
20
+ import { default as WordCloud } from "./WordCloud";
21
+ export { default as ConfigProvider } from "./ConfigProvider";
22
+ export { default as IndentedTree } from "./IndentedTree";
23
+ export { default as Map } from "./Map";
24
+ export { default as OrganizationChart } from "./OrganizationChart";
25
+ export { Area, Bar, Column, DualAxes, FlowDiagram, HeatMap, Histogram, Line, MindMap, NetworkGraph, PathMap, Pie, PinMap, Radar, Scatter, Treemap, WordCloud };
26
+ export { VisText } from "./Text";
27
+ 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,13 +1,6 @@
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';
1
+ export * from './export';
2
+ export { default as version } from './version';
6
3
  export { withChartCode, withDefaultChartCode } from './ChartCodeRender';
7
- export { default as GPTVis } from './GPTVis';
8
- /**
9
- * @deprecated
10
- * 请使用 GPTVis
11
- */
12
- export { default as MarkdownVis } from './GPTVis';
4
+ export type { CodeBlockComponent, WithChartCodeOptions } from './ChartCodeRender/type';
5
+ export { default as GPTVis, type GPTVisProps } from './GPTVis';
13
6
  export * from './types';
package/dist/esm/index.js CHANGED
@@ -1,18 +1,5 @@
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
-
7
- // export { default as HeatMap, type HeatMapProps } from './HeatMap';
8
- // export { default as PathMap, type PathMapProps } from './PathMap';
9
- // export { default as PinMap, type PinMapProps } from './PinMap';
10
-
1
+ export * from "./export";
2
+ export { default as version } from "./version";
11
3
  export { withChartCode, withDefaultChartCode } from "./ChartCodeRender";
12
4
  export { default as GPTVis } from "./GPTVis";
13
- /**
14
- * @deprecated
15
- * 请使用 GPTVis
16
- */
17
- export { default as MarkdownVis } from "./GPTVis";
18
5
  export * from "./types";
@@ -0,0 +1,65 @@
1
+ import type { LarkMapProps } from '@antv/larkmap';
2
+ import type { CSSProperties, ReactNode } from 'react';
3
+ import type { Map } from './map';
4
+ export type { LarkMapProps };
5
+ export declare enum ChartType {
6
+ Pie = "pie",
7
+ Column = "column",
8
+ Line = "line",
9
+ Area = "area",
10
+ Scatter = "scatter",
11
+ Histogram = "histogram",
12
+ Treemap = "treemap",
13
+ Bar = "bar",
14
+ WordCloud = "word-cloud",
15
+ DualAxes = "dual-axes",
16
+ Radar = "radar",
17
+ PinMap = "pin-map",
18
+ PathMap = "path-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"
26
+ }
27
+ export type Charts = keyof typeof ChartType;
28
+ export interface BaseChartProps {
29
+ containerStyle?: CSSProperties;
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[];
56
+ }
57
+ export interface TreeGraphData {
58
+ name: string;
59
+ children?: TreeGraphData[];
60
+ [key: string]: any;
61
+ }
62
+ export interface GraphProps extends BaseGraphProps<GraphData> {
63
+ }
64
+ export interface TreeGraphProps extends BaseGraphProps<TreeGraphData> {
65
+ }
@@ -0,0 +1,23 @@
1
+ export var ChartType = /*#__PURE__*/function (ChartType) {
2
+ ChartType["Pie"] = "pie";
3
+ ChartType["Column"] = "column";
4
+ ChartType["Line"] = "line";
5
+ ChartType["Area"] = "area";
6
+ ChartType["Scatter"] = "scatter";
7
+ ChartType["Histogram"] = "histogram";
8
+ ChartType["Treemap"] = "treemap";
9
+ ChartType["Bar"] = "bar";
10
+ ChartType["WordCloud"] = "word-cloud";
11
+ ChartType["DualAxes"] = "dual-axes";
12
+ ChartType["Radar"] = "radar";
13
+ ChartType["PinMap"] = "pin-map";
14
+ ChartType["PathMap"] = "path-map";
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";
22
+ return ChartType;
23
+ }({});
@@ -0,0 +1,20 @@
1
+ import type { G2 } from '@ant-design/plots';
2
+ import type { Charts } from './chart';
3
+ type PlotGlobalConfig = {
4
+ theme?: G2.Theme;
5
+ [key: string]: any;
6
+ };
7
+ type MapGlobalConfig = {
8
+ style?: 'normal' | 'light' | 'dark' | string;
9
+ token?: string;
10
+ enableZoom?: boolean;
11
+ enableRotate?: boolean;
12
+ [key: string]: any;
13
+ };
14
+ type ComponentsGlobalConfig = Partial<Record<Charts, Record<string, any>>>;
15
+ export type GlobalConfig = {
16
+ plot?: PlotGlobalConfig;
17
+ map?: MapGlobalConfig;
18
+ components?: ComponentsGlobalConfig;
19
+ };
20
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,26 +1,2 @@
1
- import { type CSSProperties } from 'react';
2
- export declare enum ChartType {
3
- Pie = "pie",
4
- Column = "column",
5
- Line = "line",
6
- Area = "area",
7
- WordCloud = "word-cloud",
8
- PinMap = "pin-map",
9
- PathMap = "path-map",
10
- HeatMap = "heat-map"
11
- }
12
- export interface BaseChartProps<T> {
13
- data: T[];
14
- style?: CSSProperties;
15
- className?: string;
16
- }
17
- export interface XYAxis {
18
- x: string | number;
19
- y: number;
20
- [key: string]: string | number;
21
- }
22
- export interface StackableChartProps extends BaseChartProps<XYAxis> {
23
- xField?: string;
24
- yField?: string;
25
- stackField?: string;
26
- }
1
+ export * from './chart';
2
+ export type { GlobalConfig } from './config';
@@ -1,11 +1,2 @@
1
- export var ChartType = /*#__PURE__*/function (ChartType) {
2
- ChartType["Pie"] = "pie";
3
- ChartType["Column"] = "column";
4
- ChartType["Line"] = "line";
5
- ChartType["Area"] = "area";
6
- ChartType["WordCloud"] = "word-cloud";
7
- ChartType["PinMap"] = "pin-map";
8
- ChartType["PathMap"] = "path-map";
9
- ChartType["HeatMap"] = "heat-map";
10
- return ChartType;
11
- }({});
1
+ export * from "./chart";
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 {};
@@ -0,0 +1,5 @@
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
+ };
@@ -0,0 +1,48 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ import { isPlainObject, mergeWith } from 'lodash';
3
+ import { DEFAULT_GLOBAL_CONFIG } from "../constants";
4
+ export var mergeGlobalConfig = function mergeGlobalConfig(config) {
5
+ var globalConfig = mergeWith({}, DEFAULT_GLOBAL_CONFIG, config, function (objValue) {
6
+ if (Array.isArray(objValue)) {
7
+ return objValue;
8
+ }
9
+ });
10
+ return globalConfig;
11
+ };
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
+ };