@visactor/react-vchart 0.0.1-alpha.2 → 0.10.0-alpha.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 (348) hide show
  1. package/README.md +33 -5
  2. package/cjs/VChart.d.ts +4 -2
  3. package/cjs/VChart.js +11 -3
  4. package/cjs/VChart.js.map +1 -1
  5. package/cjs/VChartSimple.d.ts +6 -0
  6. package/cjs/VChartSimple.js +10 -0
  7. package/cjs/VChartSimple.js.map +1 -0
  8. package/cjs/charts/AreaChart.d.ts +7 -2
  9. package/cjs/charts/AreaChart.js +11 -2
  10. package/cjs/charts/AreaChart.js.map +1 -1
  11. package/cjs/charts/BarChart.d.ts +7 -2
  12. package/cjs/charts/BarChart.js +11 -2
  13. package/cjs/charts/BarChart.js.map +1 -1
  14. package/cjs/charts/BaseChart.d.ts +10 -6
  15. package/cjs/charts/BaseChart.js +57 -34
  16. package/cjs/charts/BaseChart.js.map +1 -1
  17. package/cjs/charts/BoxPlotChart.d.ts +6 -1
  18. package/cjs/charts/BoxPlotChart.js +11 -2
  19. package/cjs/charts/BoxPlotChart.js.map +1 -1
  20. package/cjs/charts/CircularProgressChart.d.ts +6 -1
  21. package/cjs/charts/CircularProgressChart.js +11 -2
  22. package/cjs/charts/CircularProgressChart.js.map +1 -1
  23. package/cjs/charts/CommonChart.d.ts +6 -1
  24. package/cjs/charts/CommonChart.js +11 -2
  25. package/cjs/charts/CommonChart.js.map +1 -1
  26. package/cjs/charts/FunnelChart.d.ts +6 -1
  27. package/cjs/charts/FunnelChart.js +11 -2
  28. package/cjs/charts/FunnelChart.js.map +1 -1
  29. package/cjs/charts/HistogramChart.d.ts +6 -1
  30. package/cjs/charts/HistogramChart.js +11 -2
  31. package/cjs/charts/HistogramChart.js.map +1 -1
  32. package/cjs/charts/LineChart.d.ts +7 -2
  33. package/cjs/charts/LineChart.js +11 -2
  34. package/cjs/charts/LineChart.js.map +1 -1
  35. package/cjs/charts/LinearProgressChart.d.ts +6 -1
  36. package/cjs/charts/LinearProgressChart.js +11 -2
  37. package/cjs/charts/LinearProgressChart.js.map +1 -1
  38. package/cjs/charts/MapChart.d.ts +7 -2
  39. package/cjs/charts/MapChart.js +11 -2
  40. package/cjs/charts/MapChart.js.map +1 -1
  41. package/cjs/charts/PieChart.d.ts +7 -2
  42. package/cjs/charts/PieChart.js +11 -2
  43. package/cjs/charts/PieChart.js.map +1 -1
  44. package/cjs/charts/RadarChart.d.ts +7 -2
  45. package/cjs/charts/RadarChart.js +11 -2
  46. package/cjs/charts/RadarChart.js.map +1 -1
  47. package/cjs/charts/RangeColumnChart.d.ts +7 -2
  48. package/cjs/charts/RangeColumnChart.js +11 -2
  49. package/cjs/charts/RangeColumnChart.js.map +1 -1
  50. package/cjs/charts/RoseChart.d.ts +7 -2
  51. package/cjs/charts/RoseChart.js +11 -3
  52. package/cjs/charts/RoseChart.js.map +1 -1
  53. package/cjs/charts/ScatterChart.d.ts +7 -2
  54. package/cjs/charts/ScatterChart.js +12 -2
  55. package/cjs/charts/ScatterChart.js.map +1 -1
  56. package/cjs/charts/SequenceChart.d.ts +7 -2
  57. package/cjs/charts/SequenceChart.js +11 -2
  58. package/cjs/charts/SequenceChart.js.map +1 -1
  59. package/cjs/charts/WordCloudChart.d.ts +7 -2
  60. package/cjs/charts/WordCloudChart.js +11 -2
  61. package/cjs/charts/WordCloudChart.js.map +1 -1
  62. package/cjs/charts/index.d.ts +18 -16
  63. package/cjs/charts/index.js +24 -146
  64. package/cjs/charts/index.js.map +1 -1
  65. package/cjs/components/Axis.d.ts +4 -5
  66. package/cjs/components/Axis.js.map +1 -1
  67. package/cjs/components/BaseComponent.d.ts +2 -1
  68. package/cjs/components/BaseComponent.js +14 -35
  69. package/cjs/components/BaseComponent.js.map +1 -1
  70. package/cjs/components/Brush.d.ts +5 -0
  71. package/cjs/components/Brush.js +10 -0
  72. package/cjs/components/Brush.js.map +1 -0
  73. package/cjs/components/Crosshair.d.ts +4 -0
  74. package/cjs/components/Crosshair.js +10 -0
  75. package/cjs/components/Crosshair.js.map +1 -0
  76. package/cjs/components/DataZoom.d.ts +5 -0
  77. package/cjs/components/DataZoom.js +10 -0
  78. package/cjs/components/DataZoom.js.map +1 -0
  79. package/cjs/components/Indicator.d.ts +4 -0
  80. package/cjs/components/Indicator.js +10 -0
  81. package/cjs/components/Indicator.js.map +1 -0
  82. package/cjs/components/Legend.d.ts +4 -8
  83. package/cjs/components/Legend.js.map +1 -1
  84. package/cjs/components/Mark.d.ts +4 -14
  85. package/cjs/components/Mark.js +2 -60
  86. package/cjs/components/Mark.js.map +1 -1
  87. package/cjs/components/MarkArea.d.ts +4 -0
  88. package/cjs/components/MarkArea.js +10 -0
  89. package/cjs/components/MarkArea.js.map +1 -0
  90. package/cjs/components/MarkLine.d.ts +4 -0
  91. package/cjs/components/MarkLine.js +10 -0
  92. package/cjs/components/MarkLine.js.map +1 -0
  93. package/cjs/components/MarkPoint.d.ts +4 -0
  94. package/cjs/components/MarkPoint.js +10 -0
  95. package/cjs/components/MarkPoint.js.map +1 -0
  96. package/cjs/components/Player.d.ts +5 -0
  97. package/cjs/components/Player.js +10 -0
  98. package/cjs/components/Player.js.map +1 -0
  99. package/cjs/components/Region.d.ts +4 -4
  100. package/cjs/components/Region.js +1 -2
  101. package/cjs/components/Region.js.map +1 -1
  102. package/cjs/components/ScrollBar.d.ts +5 -0
  103. package/cjs/components/ScrollBar.js +10 -0
  104. package/cjs/components/ScrollBar.js.map +1 -0
  105. package/cjs/components/Title.d.ts +4 -0
  106. package/cjs/components/Title.js +10 -0
  107. package/cjs/components/Title.js.map +1 -0
  108. package/cjs/components/Tooltip.d.ts +4 -0
  109. package/cjs/components/Tooltip.js +10 -0
  110. package/cjs/components/Tooltip.js.map +1 -0
  111. package/cjs/components/index.d.ts +11 -0
  112. package/cjs/components/index.js +8 -2
  113. package/cjs/components/index.js.map +1 -1
  114. package/cjs/constants.js +1 -1
  115. package/cjs/constants.js.map +1 -1
  116. package/cjs/containers/withContainer.d.ts +2 -2
  117. package/cjs/containers/withContainer.js.map +1 -1
  118. package/cjs/context/chart.d.ts +2 -3
  119. package/cjs/context/chart.js.map +1 -1
  120. package/cjs/context/stage.d.ts +2 -2
  121. package/cjs/context/stage.js.map +1 -1
  122. package/cjs/context/view.d.ts +2 -2
  123. package/cjs/context/view.js.map +1 -1
  124. package/cjs/eventsUtils.d.ts +148 -47
  125. package/cjs/eventsUtils.js +35 -5
  126. package/cjs/eventsUtils.js.map +1 -1
  127. package/cjs/index.d.ts +4 -3
  128. package/cjs/index.js +4 -19
  129. package/cjs/index.js.map +1 -1
  130. package/cjs/series/Area.d.ts +6 -5
  131. package/cjs/series/Area.js.map +1 -1
  132. package/cjs/series/Bar.d.ts +6 -5
  133. package/cjs/series/Bar.js.map +1 -1
  134. package/cjs/series/BaseSeries.d.ts +2 -1
  135. package/cjs/series/BaseSeries.js +22 -49
  136. package/cjs/series/BaseSeries.js.map +1 -1
  137. package/cjs/series/BoxPlot.d.ts +6 -5
  138. package/cjs/series/BoxPlot.js.map +1 -1
  139. package/cjs/series/CircularProgress.d.ts +6 -5
  140. package/cjs/series/CircularProgress.js.map +1 -1
  141. package/cjs/series/Dot.d.ts +6 -5
  142. package/cjs/series/Dot.js.map +1 -1
  143. package/cjs/series/Funnel.d.ts +6 -5
  144. package/cjs/series/Funnel.js.map +1 -1
  145. package/cjs/series/Line.d.ts +6 -5
  146. package/cjs/series/Line.js.map +1 -1
  147. package/cjs/series/LinearProgress.d.ts +6 -5
  148. package/cjs/series/LinearProgress.js +1 -2
  149. package/cjs/series/LinearProgress.js.map +1 -1
  150. package/cjs/series/Link.d.ts +6 -5
  151. package/cjs/series/Link.js.map +1 -1
  152. package/cjs/series/Map.d.ts +6 -5
  153. package/cjs/series/Map.js +2 -1
  154. package/cjs/series/Map.js.map +1 -1
  155. package/cjs/series/Pie.d.ts +6 -5
  156. package/cjs/series/Pie.js.map +1 -1
  157. package/cjs/series/Radar.d.ts +6 -5
  158. package/cjs/series/Radar.js.map +1 -1
  159. package/cjs/series/RangeColumn.d.ts +6 -5
  160. package/cjs/series/RangeColumn.js.map +1 -1
  161. package/cjs/series/Rose.d.ts +6 -5
  162. package/cjs/series/Rose.js.map +1 -1
  163. package/cjs/series/Scatter.d.ts +6 -5
  164. package/cjs/series/Scatter.js.map +1 -1
  165. package/cjs/series/Series.d.ts +6 -6
  166. package/cjs/series/Series.js +1 -1
  167. package/cjs/series/Series.js.map +1 -1
  168. package/cjs/series/WordCloud.d.ts +6 -5
  169. package/cjs/series/WordCloud.js +1 -1
  170. package/cjs/series/WordCloud.js.map +1 -1
  171. package/cjs/series/index.js +1 -1
  172. package/cjs/series/index.js.map +1 -1
  173. package/cjs/util.js +1 -1
  174. package/cjs/util.js.map +1 -1
  175. package/esm/VChart.d.ts +4 -2
  176. package/esm/VChart.js +7 -1
  177. package/esm/VChart.js.map +1 -1
  178. package/esm/VChartSimple.d.ts +6 -0
  179. package/esm/VChartSimple.js +4 -0
  180. package/esm/VChartSimple.js.map +1 -0
  181. package/esm/charts/AreaChart.d.ts +7 -2
  182. package/esm/charts/AreaChart.js +6 -1
  183. package/esm/charts/AreaChart.js.map +1 -1
  184. package/esm/charts/BarChart.d.ts +7 -2
  185. package/esm/charts/BarChart.js +6 -1
  186. package/esm/charts/BarChart.js.map +1 -1
  187. package/esm/charts/BaseChart.d.ts +10 -6
  188. package/esm/charts/BaseChart.js +56 -35
  189. package/esm/charts/BaseChart.js.map +1 -1
  190. package/esm/charts/BoxPlotChart.d.ts +6 -1
  191. package/esm/charts/BoxPlotChart.js +6 -1
  192. package/esm/charts/BoxPlotChart.js.map +1 -1
  193. package/esm/charts/CircularProgressChart.d.ts +6 -1
  194. package/esm/charts/CircularProgressChart.js +6 -1
  195. package/esm/charts/CircularProgressChart.js.map +1 -1
  196. package/esm/charts/CommonChart.d.ts +6 -1
  197. package/esm/charts/CommonChart.js +6 -1
  198. package/esm/charts/CommonChart.js.map +1 -1
  199. package/esm/charts/FunnelChart.d.ts +6 -1
  200. package/esm/charts/FunnelChart.js +6 -1
  201. package/esm/charts/FunnelChart.js.map +1 -1
  202. package/esm/charts/HistogramChart.d.ts +6 -1
  203. package/esm/charts/HistogramChart.js +6 -1
  204. package/esm/charts/HistogramChart.js.map +1 -1
  205. package/esm/charts/LineChart.d.ts +7 -2
  206. package/esm/charts/LineChart.js +6 -1
  207. package/esm/charts/LineChart.js.map +1 -1
  208. package/esm/charts/LinearProgressChart.d.ts +6 -1
  209. package/esm/charts/LinearProgressChart.js +6 -1
  210. package/esm/charts/LinearProgressChart.js.map +1 -1
  211. package/esm/charts/MapChart.d.ts +7 -2
  212. package/esm/charts/MapChart.js +6 -1
  213. package/esm/charts/MapChart.js.map +1 -1
  214. package/esm/charts/PieChart.d.ts +7 -2
  215. package/esm/charts/PieChart.js +6 -1
  216. package/esm/charts/PieChart.js.map +1 -1
  217. package/esm/charts/RadarChart.d.ts +7 -2
  218. package/esm/charts/RadarChart.js +6 -1
  219. package/esm/charts/RadarChart.js.map +1 -1
  220. package/esm/charts/RangeColumnChart.d.ts +7 -2
  221. package/esm/charts/RangeColumnChart.js +6 -1
  222. package/esm/charts/RangeColumnChart.js.map +1 -1
  223. package/esm/charts/RoseChart.d.ts +7 -2
  224. package/esm/charts/RoseChart.js +6 -2
  225. package/esm/charts/RoseChart.js.map +1 -1
  226. package/esm/charts/ScatterChart.d.ts +7 -2
  227. package/esm/charts/ScatterChart.js +7 -1
  228. package/esm/charts/ScatterChart.js.map +1 -1
  229. package/esm/charts/SequenceChart.d.ts +7 -2
  230. package/esm/charts/SequenceChart.js +6 -1
  231. package/esm/charts/SequenceChart.js.map +1 -1
  232. package/esm/charts/WordCloudChart.d.ts +7 -2
  233. package/esm/charts/WordCloudChart.js +6 -1
  234. package/esm/charts/WordCloudChart.js.map +1 -1
  235. package/esm/charts/index.d.ts +18 -16
  236. package/esm/charts/index.js +17 -17
  237. package/esm/charts/index.js.map +1 -1
  238. package/esm/components/Axis.d.ts +4 -5
  239. package/esm/components/Axis.js.map +1 -1
  240. package/esm/components/BaseComponent.d.ts +2 -1
  241. package/esm/components/BaseComponent.js +14 -35
  242. package/esm/components/BaseComponent.js.map +1 -1
  243. package/esm/components/Brush.d.ts +5 -0
  244. package/esm/components/Brush.js +6 -0
  245. package/esm/components/Brush.js.map +1 -0
  246. package/esm/components/Crosshair.d.ts +4 -0
  247. package/esm/components/Crosshair.js +4 -0
  248. package/esm/components/Crosshair.js.map +1 -0
  249. package/esm/components/DataZoom.d.ts +5 -0
  250. package/esm/components/DataZoom.js +6 -0
  251. package/esm/components/DataZoom.js.map +1 -0
  252. package/esm/components/Indicator.d.ts +4 -0
  253. package/esm/components/Indicator.js +4 -0
  254. package/esm/components/Indicator.js.map +1 -0
  255. package/esm/components/Legend.d.ts +4 -8
  256. package/esm/components/Legend.js.map +1 -1
  257. package/esm/components/Mark.d.ts +4 -14
  258. package/esm/components/Mark.js +2 -38
  259. package/esm/components/Mark.js.map +1 -1
  260. package/esm/components/MarkArea.d.ts +4 -0
  261. package/esm/components/MarkArea.js +4 -0
  262. package/esm/components/MarkArea.js.map +1 -0
  263. package/esm/components/MarkLine.d.ts +4 -0
  264. package/esm/components/MarkLine.js +4 -0
  265. package/esm/components/MarkLine.js.map +1 -0
  266. package/esm/components/MarkPoint.d.ts +4 -0
  267. package/esm/components/MarkPoint.js +4 -0
  268. package/esm/components/MarkPoint.js.map +1 -0
  269. package/esm/components/Player.d.ts +5 -0
  270. package/esm/components/Player.js +6 -0
  271. package/esm/components/Player.js.map +1 -0
  272. package/esm/components/Region.d.ts +4 -4
  273. package/esm/components/Region.js +1 -2
  274. package/esm/components/Region.js.map +1 -1
  275. package/esm/components/ScrollBar.d.ts +5 -0
  276. package/esm/components/ScrollBar.js +6 -0
  277. package/esm/components/ScrollBar.js.map +1 -0
  278. package/esm/components/Title.d.ts +4 -0
  279. package/esm/components/Title.js +4 -0
  280. package/esm/components/Title.js.map +1 -0
  281. package/esm/components/Tooltip.d.ts +4 -0
  282. package/esm/components/Tooltip.js +4 -0
  283. package/esm/components/Tooltip.js.map +1 -0
  284. package/esm/components/index.d.ts +11 -0
  285. package/esm/components/index.js +23 -1
  286. package/esm/components/index.js.map +1 -1
  287. package/esm/constants.js +1 -1
  288. package/esm/constants.js.map +1 -1
  289. package/esm/containers/withContainer.d.ts +2 -2
  290. package/esm/containers/withContainer.js.map +1 -1
  291. package/esm/context/chart.d.ts +2 -3
  292. package/esm/context/chart.js.map +1 -1
  293. package/esm/context/stage.d.ts +2 -2
  294. package/esm/context/stage.js.map +1 -1
  295. package/esm/context/view.d.ts +2 -2
  296. package/esm/context/view.js.map +1 -1
  297. package/esm/eventsUtils.d.ts +148 -47
  298. package/esm/eventsUtils.js +48 -4
  299. package/esm/eventsUtils.js.map +1 -1
  300. package/esm/index.d.ts +4 -3
  301. package/esm/index.js +4 -3
  302. package/esm/index.js.map +1 -1
  303. package/esm/series/Area.d.ts +6 -5
  304. package/esm/series/Area.js.map +1 -1
  305. package/esm/series/Bar.d.ts +6 -5
  306. package/esm/series/Bar.js.map +1 -1
  307. package/esm/series/BaseSeries.d.ts +2 -1
  308. package/esm/series/BaseSeries.js +22 -50
  309. package/esm/series/BaseSeries.js.map +1 -1
  310. package/esm/series/BoxPlot.d.ts +6 -5
  311. package/esm/series/BoxPlot.js.map +1 -1
  312. package/esm/series/CircularProgress.d.ts +6 -5
  313. package/esm/series/CircularProgress.js.map +1 -1
  314. package/esm/series/Dot.d.ts +6 -5
  315. package/esm/series/Dot.js.map +1 -1
  316. package/esm/series/Funnel.d.ts +6 -5
  317. package/esm/series/Funnel.js.map +1 -1
  318. package/esm/series/Line.d.ts +6 -5
  319. package/esm/series/Line.js.map +1 -1
  320. package/esm/series/LinearProgress.d.ts +6 -5
  321. package/esm/series/LinearProgress.js +1 -2
  322. package/esm/series/LinearProgress.js.map +1 -1
  323. package/esm/series/Link.d.ts +6 -5
  324. package/esm/series/Link.js.map +1 -1
  325. package/esm/series/Map.d.ts +6 -5
  326. package/esm/series/Map.js +2 -1
  327. package/esm/series/Map.js.map +1 -1
  328. package/esm/series/Pie.d.ts +6 -5
  329. package/esm/series/Pie.js.map +1 -1
  330. package/esm/series/Radar.d.ts +6 -5
  331. package/esm/series/Radar.js.map +1 -1
  332. package/esm/series/RangeColumn.d.ts +6 -5
  333. package/esm/series/RangeColumn.js.map +1 -1
  334. package/esm/series/Rose.d.ts +6 -5
  335. package/esm/series/Rose.js.map +1 -1
  336. package/esm/series/Scatter.d.ts +6 -5
  337. package/esm/series/Scatter.js.map +1 -1
  338. package/esm/series/Series.d.ts +6 -6
  339. package/esm/series/Series.js +1 -1
  340. package/esm/series/Series.js.map +1 -1
  341. package/esm/series/WordCloud.d.ts +6 -5
  342. package/esm/series/WordCloud.js +1 -1
  343. package/esm/series/WordCloud.js.map +1 -1
  344. package/esm/series/index.js +1 -1
  345. package/esm/series/index.js.map +1 -1
  346. package/esm/util.js +1 -1
  347. package/esm/util.js.map +1 -1
  348. package/package.json +11 -9
package/cjs/util.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["util.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAuF;AACvF,kDAAyC;AACzC,uCAAsC;AAEtC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEJ,MAAM,GAAG,GAAG,CAAC,MAAe,EAAE,EAAE;IACrC,IAAI,MAAM,EAAE;QACV,OAAO,GAAG,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC;KAC5B;IAED,OAAO,GAAG,EAAE,EAAE,EAAE,CAAC;AACnB,CAAC,CAAC;AANW,QAAA,GAAG,OAMd;AAOK,MAAM,cAAc,GAAG,CAAC,IAAS,EAAE,EAAE;IAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,CAAC;KACX;IACD,OAAO,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC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aAAN,MAAM,uBAAN,MAAM,CAAG,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B","file":"util.js","sourcesContent":["import { isNil, isArray, isString, isFunction, isPlainObject } from '@visactor/vutils';\nimport React, { ReactNode } from 'react';\nimport { isFragment } from 'react-is';\n\nlet id = 0;\n\nexport const uid = (prefix?: string) => {\n if (prefix) {\n return `${prefix}-${id++}`;\n }\n\n return `${id++}`;\n};\n\n/**\n * Get the display name of a component\n * @param {Object} Comp Specified Component\n * @return {String} Display name of Component\n */\nexport const getDisplayName = (Comp: any) => {\n if (typeof Comp === 'string') {\n return Comp;\n }\n if (!Comp) {\n return '';\n }\n return Comp.displayName || Comp.name;\n};\n\nexport const typeOfComponent = (component: any, customTypeKey = '__TYPE'): string => {\n return (\n (component?.props && component.props[customTypeKey]) ||\n (typeof component?.type === 'string' && component.type) ||\n (component?.type &&\n typeof component.type === 'symbol' &&\n component.type.toString() === 'Symbol(react.fragment)' &&\n 'react.fragment') ||\n (typeof component?.type === 'function' && component.type) ||\n (typeof component?.type === 'object' &&\n component.type.$$typeof.toString() === 'Symbol(react.forward_ref)' &&\n 'react.forward_ref') ||\n (typeof component === 'string' && 'string') ||\n (typeof component === 'function' && 'function') ||\n undefined\n );\n};\n\nexport const toArray = <T = ReactNode, TC = ReactNode>(children: T): TC[] => {\n let result: TC[] = [];\n\n React.Children.forEach(children, child => {\n if (isNil(child)) return;\n\n if (isFragment(child)) {\n result = result.concat(toArray(child.props.children));\n } else {\n result.push(child as unknown as TC);\n }\n });\n\n return result;\n};\n\n/*\n * Find and return all matched children by type. `type` can be a React element class or\n * string\n */\nexport const findAllByType = <T extends React.ReactNode, TC = unknown>(\n children: React.ReactNode,\n type: TC | TC[]\n): T[] => {\n const result: T[] = [];\n let types: string[] = [];\n\n if (isArray(type)) {\n types = type.map(t => getDisplayName(t));\n } else {\n types = [getDisplayName(type)];\n }\n\n toArray(children).forEach(child => {\n const childType = getDisplayName(typeOfComponent(child));\n\n if (types.indexOf(childType) !== -1) {\n result.push(child as T);\n }\n });\n\n return result;\n};\n/*\n * Return the first matched child by type, return null otherwise.\n * `type` can be a React element class or string.\n */\nexport const findChildByType = <T extends React.ReactNode, TC = unknown>(children: React.ReactNode, type: TC): T => {\n const result = findAllByType<T, TC>(children, type);\n\n return result?.[0];\n};\n"]}
1
+ {"version":3,"sources":["../src/util.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAuF;AACvF,kDAAyC;AACzC,uCAAsC;AAEtC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEJ,MAAM,GAAG,GAAG,CAAC,MAAe,EAAE,EAAE;IACrC,IAAI,MAAM,EAAE;QACV,OAAO,GAAG,MAAM,IAAI,EAAE,EAAE,EAAE,CAAC;KAC5B;IAED,OAAO,GAAG,EAAE,EAAE,EAAE,CAAC;AACnB,CAAC,CAAC;AANW,QAAA,GAAG,OAMd;AAOK,MAAM,cAAc,GAAG,CAAC,IAAS,EAAE,EAAE;IAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC5B,OAAO,IAAI,CAAC;KACb;IACD,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,EAAE,CAAC;KACX;IACD,OAAO,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC;AACvC,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AAEK,MAAM,eAAe,GAAG,CAAC,SAAc,EAAE,aAAa,GAAG,QAAQ,EAAU,EAAE;IAClF,OAAO,CACL,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,KAAI,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACpD,CAAC,OAAO,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,CAAA,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,CAAC;QACvD,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI;YACd,OAAO,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K,GAAa,EAAE,CAAC;IAEzB,IAAI,IAAA,gBAAO,EAAC,IAAI,CAAC,EAAE;QACjB,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,sBAAc,EAAC,CAAC,CAAC,CAAC,CAAC;KAC1C;SAAM;QACL,KAAK,GAAG,CAAC,IAAA,sBAAc,EAAC,IAAI,CAAC,CAAC,CAAC;KAChC;IAED,IAAA,eAAO,EAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QAChC,MAAM,SAAS,GAAG,IAAA,sBAAc,EAAC,IAAA,uBAAe,EAAC,KAAK,CAAC,CAAC,CAAC;QAEzD,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;YACnC,MAAM,CAAC,IAAI,CAAC,KAAU,CAAC,CAAC;SACzB;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAtBW,QAAA,aAAa,iBAsBxB;AAKK,MAAM,eAAe,GAAG,CAA0C,QAAyB,EAAE,IAAQ,EAAK,EAAE;IACjH,MAAM,MAAM,GAAG,IAAA,qBAAa,EAAQ,QAAQ,EAAE,IAAI,CAAC,CAAC;IAEpD,OAAO,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,CAAC,CAAC,CAAC;AACrB,CAAC,CAAC;AAJW,QAAA,eAAe,mBAI1B","file":"util.js","sourcesContent":["import { isNil, isArray, isString, isFunction, isPlainObject } from '@visactor/vutils';\nimport React, { ReactNode } from 'react';\nimport { isFragment } from 'react-is';\n\nlet id = 0;\n\nexport const uid = (prefix?: string) => {\n if (prefix) {\n return `${prefix}-${id++}`;\n }\n\n return `${id++}`;\n};\n\n/**\n * Get the display name of a component\n * @param {Object} Comp Specified Component\n * @return {String} Display name of Component\n */\nexport const getDisplayName = (Comp: any) => {\n if (typeof Comp === 'string') {\n return Comp;\n }\n if (!Comp) {\n return '';\n }\n return Comp.displayName || Comp.name;\n};\n\nexport const typeOfComponent = (component: any, customTypeKey = '__TYPE'): string => {\n return (\n (component?.props && component.props[customTypeKey]) ||\n (typeof component?.type === 'string' && component.type) ||\n (component?.type &&\n typeof component.type === 'symbol' &&\n component.type.toString() === 'Symbol(react.fragment)' &&\n 'react.fragment') ||\n (typeof component?.type === 'function' && component.type) ||\n (typeof component?.type === 'object' &&\n component.type.$$typeof.toString() === 'Symbol(react.forward_ref)' &&\n 'react.forward_ref') ||\n (typeof component === 'string' && 'string') ||\n (typeof component === 'function' && 'function') ||\n undefined\n );\n};\n\nexport const toArray = <T = ReactNode, TC = ReactNode>(children: T): TC[] => {\n let result: TC[] = [];\n\n React.Children.forEach(children, child => {\n if (isNil(child)) return;\n\n if (isFragment(child)) {\n result = result.concat(toArray(child.props.children));\n } else {\n result.push(child as unknown as TC);\n }\n });\n\n return result;\n};\n\n/*\n * Find and return all matched children by type. `type` can be a React element class or\n * string\n */\nexport const findAllByType = <T extends React.ReactNode, TC = unknown>(\n children: React.ReactNode,\n type: TC | TC[]\n): T[] => {\n const result: T[] = [];\n let types: string[] = [];\n\n if (isArray(type)) {\n types = type.map(t => getDisplayName(t));\n } else {\n types = [getDisplayName(type)];\n }\n\n toArray(children).forEach(child => {\n const childType = getDisplayName(typeOfComponent(child));\n\n if (types.indexOf(childType) !== -1) {\n result.push(child as T);\n }\n });\n\n return result;\n};\n/*\n * Return the first matched child by type, return null otherwise.\n * `type` can be a React element class or string.\n */\nexport const findChildByType = <T extends React.ReactNode, TC = unknown>(children: React.ReactNode, type: TC): T => {\n const result = findAllByType<T, TC>(children, type);\n\n return result?.[0];\n};\n"]}
package/esm/VChart.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  import { BaseChartProps } from './charts/BaseChart';
2
- export type VChartProps = Omit<BaseChartProps, 'container'>;
3
- export declare const VChart: import("react").ForwardRefExoticComponent<import("./containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
2
+ import VChartCore from '@visactor/vchart';
3
+ export { VChartCore };
4
+ export type VChartProps = Omit<BaseChartProps, 'container' | 'data' | 'width' | 'height' | 'type'>;
5
+ export declare const VChart: import("react").ForwardRefExoticComponent<VChartProps & import("./containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
package/esm/VChart.js CHANGED
@@ -1,3 +1,9 @@
1
1
  import { createChart } from "./charts/BaseChart";
2
2
 
3
- export const VChart = createChart("VChart");
3
+ import VChartCore from "@visactor/vchart";
4
+
5
+ export { VChartCore };
6
+
7
+ export const VChart = createChart("VChart", {
8
+ vchartConstrouctor: VChartCore
9
+ });
package/esm/VChart.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["VChart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIjE,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,CAAc,QAAQ,CAAC,CAAC","file":"VChart.js","sourcesContent":["import { BaseChartProps, createChart } from './charts/BaseChart';\n\nexport type VChartProps = Omit<BaseChartProps, 'container'>;\n\nexport const VChart = createChart<VChartProps>('VChart');\n"]}
1
+ {"version":3,"sources":["../src/VChart.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,CAAC;AAItB,MAAM,CAAC,MAAM,MAAM,GAAG,WAAW,CAAc,QAAQ,EAAE;IACvD,kBAAkB,EAAE,UAAU;CAC/B,CAAC,CAAC","file":"VChart.js","sourcesContent":["import { BaseChartProps, createChart } from './charts/BaseChart';\nimport type { IVChartConstructor } from '@visactor/vchart';\nimport VChartCore from '@visactor/vchart';\nexport { VChartCore };\n\nexport type VChartProps = Omit<BaseChartProps, 'container' | 'data' | 'width' | 'height' | 'type'>;\n\nexport const VChart = createChart<VChartProps>('VChart', {\n vchartConstrouctor: VChartCore\n});\n"]}
@@ -0,0 +1,6 @@
1
+ import type { IVChartConstructor } from '@visactor/vchart';
2
+ import { BaseChartProps } from './charts/BaseChart';
3
+ export type VChartSimpleProps = Omit<BaseChartProps, 'container' | 'data' | 'width' | 'height' | 'vchartConstrouctor'>;
4
+ export declare const VChartSimple: import("react").ForwardRefExoticComponent<VChartSimpleProps & {
5
+ vchartConstrouctor: IVChartConstructor;
6
+ } & import("./containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
@@ -0,0 +1,4 @@
1
+ import { createChart } from "./charts/BaseChart";
2
+
3
+ export const VChartSimple = createChart("VChartSimple");
4
+ //# sourceMappingURL=VChartSimple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/VChartSimple.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIjE,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAiE,cAAc,CAAC,CAAC","file":"VChartSimple.js","sourcesContent":["import type { IVChartConstructor } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './charts/BaseChart';\n\nexport type VChartSimpleProps = Omit<BaseChartProps, 'container' | 'data' | 'width' | 'height' | 'vchartConstrouctor'>;\n\nexport const VChartSimple = createChart<VChartSimpleProps & { vchartConstrouctor: IVChartConstructor }>('VChartSimple');\n"]}
@@ -1,5 +1,10 @@
1
- import { IAreaChartSpec } from '@visactor/vchart';
1
+ import React from 'react';
2
+ import type { IAreaChartSpec } from '@visactor/vchart';
2
3
  import { BaseChartProps } from './BaseChart';
3
4
  export interface AreaChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<IAreaChartSpec, 'type'> {
4
5
  }
5
- export declare const AreaChart: import("react").ForwardRefExoticComponent<import("../containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
6
+ export declare const AreaChart: React.ForwardRefExoticComponent<AreaChartProps & {
7
+ children?: React.ReactNode;
8
+ } & {
9
+ type: 'area';
10
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -1,4 +1,9 @@
1
+ import { default as VChart } from "@visactor/vchart";
2
+
1
3
  import { createChart } from "./BaseChart";
2
4
 
3
- export const AreaChart = createChart("AreaChart", "area");
5
+ export const AreaChart = createChart("AreaChart", {
6
+ type: "area",
7
+ vchartConstrouctor: VChart
8
+ });
4
9
  //# sourceMappingURL=AreaChart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/AreaChart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAiB,WAAW,EAAE,MAAM,CAAC,CAAC","file":"AreaChart.js","sourcesContent":["import { IAreaChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface AreaChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IAreaChartSpec, 'type'> {}\n\nexport const AreaChart = createChart<AreaChartProps>('AreaChart', 'area');\n"]}
1
+ {"version":3,"sources":["../src/charts/AreaChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAA6D,WAAW,EAAE;IAC5G,IAAI,EAAE,MAAM;IACZ,kBAAkB,EAAE,MAAM;CAC3B,CAAC,CAAC","file":"AreaChart.js","sourcesContent":["import React from 'react';\nimport type { IAreaChartSpec } from '@visactor/vchart';\nimport { default as VChart } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface AreaChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IAreaChartSpec, 'type'> {}\n\nexport const AreaChart = createChart<React.PropsWithChildren<AreaChartProps> & { type: 'area' }>('AreaChart', {\n type: 'area',\n vchartConstrouctor: VChart\n});\n"]}
@@ -1,5 +1,10 @@
1
- import { IBarChartSpec } from '@visactor/vchart';
1
+ import React from 'react';
2
+ import type { IBarChartSpec } from '@visactor/vchart';
2
3
  import { BaseChartProps } from './BaseChart';
3
4
  export interface BarChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<IBarChartSpec, 'type'> {
4
5
  }
5
- export declare const BarChart: import("react").ForwardRefExoticComponent<import("../containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
6
+ export declare const BarChart: React.ForwardRefExoticComponent<BarChartProps & {
7
+ children?: React.ReactNode;
8
+ } & {
9
+ type: 'bar';
10
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -1,4 +1,9 @@
1
+ import { default as VChart } from "@visactor/vchart";
2
+
1
3
  import { createChart } from "./BaseChart";
2
4
 
3
- export const BarChart = createChart("BarChart", "bar");
5
+ export const BarChart = createChart("BarChart", {
6
+ type: "bar",
7
+ vchartConstrouctor: VChart
8
+ });
4
9
  //# sourceMappingURL=BarChart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/BarChart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ1D,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAgB,UAAU,EAAE,KAAK,CAAC,CAAC","file":"BarChart.js","sourcesContent":["import { IBarChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface BarChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IBarChartSpec, 'type'> {\n //\n}\n\nexport const BarChart = createChart<BarChartProps>('BarChart', 'bar');\n"]}
1
+ {"version":3,"sources":["../src/charts/BarChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAQ1D,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAA2D,UAAU,EAAE;IACxG,IAAI,EAAE,KAAK;IACX,kBAAkB,EAAE,MAAM;CAC3B,CAAC,CAAC","file":"BarChart.js","sourcesContent":["import React from 'react';\nimport type { IBarChartSpec } from '@visactor/vchart';\nimport { default as VChart } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface BarChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IBarChartSpec, 'type'> {\n //\n}\n\nexport const BarChart = createChart<React.PropsWithChildren<BarChartProps> & { type: 'bar' }>('BarChart', {\n type: 'bar',\n vchartConstrouctor: VChart\n});\n"]}
@@ -1,18 +1,22 @@
1
- import VChart, { IData, IInitOption } from '@visactor/vchart';
1
+ import type { IVChart, IData, IInitOption, ISpec, IVChartConstructor } from '@visactor/vchart';
2
2
  import React from 'react';
3
3
  import { ContainerProps } from '../containers/withContainer';
4
- import { EventsProps } from '../eventsUtils';
4
+ import { EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps, DimensionEventProps, HierarchyEventProps, ChartLifeCycleEventProps } from '../eventsUtils';
5
5
  export type ChartOptions = Omit<IInitOption, 'dom'>;
6
- export interface BaseChartProps extends EventsProps {
6
+ export interface BaseChartProps extends EventsProps, LegendEventProps, ScrollBarEventProps, BrushEventProps, DataZoomEventProps, PlayerEventProps, DimensionEventProps, HierarchyEventProps, ChartLifeCycleEventProps {
7
+ vchartConstrouctor?: IVChartConstructor;
7
8
  type?: string;
8
9
  container?: HTMLDivElement;
9
- spec?: any;
10
+ spec?: ISpec;
10
11
  data?: IData;
11
12
  width?: number;
12
13
  height?: number;
13
14
  options?: ChartOptions;
14
- onReady?: (instance: VChart, isInitial: boolean) => void;
15
+ skipFunctionDiff?: boolean;
16
+ onReady?: (instance: IVChart, isInitial: boolean) => void;
17
+ onError?: (err: Error) => void;
18
+ useSyncRender?: boolean;
15
19
  }
16
20
  type Props = React.PropsWithChildren<BaseChartProps>;
17
- export declare const createChart: <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => React.ForwardRefExoticComponent<ContainerProps & React.RefAttributes<any>>;
21
+ export declare const createChart: <T extends Props>(componentName: string, defaultProps?: Partial<T>, callback?: (props: T, defaultProps?: Partial<T>) => T) => React.ForwardRefExoticComponent<React.PropsWithoutRef<T & ContainerProps> & React.RefAttributes<any>>;
18
22
  export {};
@@ -1,5 +1,3 @@
1
- import VChart from "@visactor/vchart";
2
-
3
1
  import React, { useState, useEffect, useRef, useImperativeHandle } from "react";
4
2
 
5
3
  import withContainer from "../containers/withContainer";
@@ -16,60 +14,83 @@ import { REACT_PRIVATE_PROPS } from "../constants";
16
14
 
17
15
  import { bindEventsToChart, CHART_EVENTS_KEYS, CHART_EVENTS } from "../eventsUtils";
18
16
 
19
- const notSpecKeys = [ ...REACT_PRIVATE_PROPS, ...CHART_EVENTS_KEYS, "spec", "container", "options" ], BaseChart = React.forwardRef(((props, ref) => {
20
- const [updateId, setUpdateId] = useState(0), chartContext = useRef({
21
- specFromChildren: {}
22
- });
23
- useImperativeHandle(ref, (() => chartContext.current.chart));
24
- const hasSpec = !!props.spec, [view, setView] = useState(null), isUnmount = useRef(!1), prevSpec = useRef(pickWithout(props, notSpecKeys)), eventsBinded = React.useRef(null), parseSpec = props => hasSpec && props.spec ? props.spec : Object.assign(Object.assign({}, prevSpec.current), chartContext.current.specFromChildren), handleChartRender = () => {
25
- const newView = chartContext.current.chart.getCompiler().getVGrammarView();
26
- newView === view || isUnmount.current || (setUpdateId(updateId + 1), props.onReady && props.onReady(chartContext.current.chart, 0 === updateId)),
27
- setView(newView);
17
+ const notSpecKeys = [ ...REACT_PRIVATE_PROPS, ...CHART_EVENTS_KEYS, "vchartConstrouctor", "useSyncRender", "skipFunctionDiff", "onError", "onReady", "spec", "container", "options" ], parseSpecFromChildren = props => {
18
+ const specFromChildren = {};
19
+ return toArray(props.children).map((child => {
20
+ const parseSpec = child && child.type && child.type.parseSpec;
21
+ if (parseSpec && child.props) {
22
+ const specResult = parseSpec(child.props);
23
+ specResult.isSingle ? specFromChildren[specResult.specName] = specResult.spec : (specFromChildren[specResult.specName] || (specFromChildren[specResult.specName] = []),
24
+ specFromChildren[specResult.specName].push(specResult.spec));
25
+ }
26
+ })), specFromChildren;
27
+ }, BaseChart = React.forwardRef(((props, ref) => {
28
+ const [updateId, setUpdateId] = useState(0), chartContext = useRef({});
29
+ useImperativeHandle(ref, (() => {
30
+ var _a;
31
+ return null === (_a = chartContext.current) || void 0 === _a ? void 0 : _a.chart;
32
+ }));
33
+ const hasSpec = !!props.spec, [view, setView] = useState(null), isUnmount = useRef(!1), prevSpec = useRef(pickWithout(props, notSpecKeys)), specFromChildren = useRef(null), eventsBinded = React.useRef(null), skipFunctionDiff = !!props.skipFunctionDiff, parseSpec = props => hasSpec && props.spec ? props.spec : Object.assign(Object.assign({}, prevSpec.current), specFromChildren.current), handleChartRender = () => {
34
+ if (!isUnmount.current) {
35
+ if (!chartContext.current || !chartContext.current.chart) return;
36
+ bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);
37
+ const newView = chartContext.current.chart.getCompiler().getVGrammarView();
38
+ setUpdateId(updateId + 1), props.onReady && props.onReady(chartContext.current.chart, 0 === updateId),
39
+ setView(newView);
40
+ }
28
41
  };
29
42
  return useEffect((() => {
30
- if (!chartContext.current.chart) return (props => {
31
- const cs = new VChart(parseSpec(props), Object.assign(Object.assign({}, props.options), {
43
+ var _a;
44
+ const newSpecFromChildren = hasSpec ? null : parseSpecFromChildren(props);
45
+ if (!(null === (_a = chartContext.current) || void 0 === _a ? void 0 : _a.chart)) return hasSpec || (specFromChildren.current = newSpecFromChildren),
46
+ (props => {
47
+ const cs = new props.vchartConstrouctor(parseSpec(props), Object.assign(Object.assign({}, props.options), {
48
+ onError: props.onError,
32
49
  autoFit: !0,
33
- mode: "desktop-browser",
34
50
  dom: props.container
35
51
  }));
36
52
  chartContext.current = Object.assign(Object.assign({}, chartContext.current), {
37
53
  chart: cs
38
54
  });
39
- })(props), chartContext.current.chart && chartContext.current.chart.renderAsync().then(handleChartRender),
40
- bindEventsToChart(chartContext.current.chart, props, null, CHART_EVENTS), chartContext.current = Object.assign(Object.assign({}, chartContext.current), {
41
- isChildrenUpdated: !1
42
- }), void (eventsBinded.current = props);
43
- if (bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS),
44
- hasSpec) return void (isEqual(eventsBinded.current.spec, props.spec) || chartContext.current.chart.updateSpec(parseSpec(props)).then(handleChartRender));
55
+ })(props), chartContext.current.chart && (chartContext.current.chart.renderSync({
56
+ reuse: !1
57
+ }), handleChartRender()), bindEventsToChart(chartContext.current.chart, props, null, CHART_EVENTS),
58
+ void (eventsBinded.current = props);
59
+ if (hasSpec) return void (isEqual(eventsBinded.current.spec, props.spec, {
60
+ skipFunction: skipFunctionDiff
61
+ }) || (eventsBinded.current = props, chartContext.current.chart.updateSpecSync(parseSpec(props), void 0, {
62
+ morph: !1,
63
+ enableExitAnimation: !1
64
+ }), handleChartRender()));
45
65
  const newSpec = pickWithout(props, notSpecKeys);
46
- isEqual(newSpec, prevSpec.current) && !chartContext.current.isChildrenUpdated || (prevSpec.current = newSpec,
47
- chartContext.current.chart.updateSpec(parseSpec(props)).then(handleChartRender)),
48
- chartContext.current = Object.assign(Object.assign({}, chartContext.current), {
49
- isChildrenUpdated: !1
50
- });
66
+ isEqual(newSpec, prevSpec.current, {
67
+ skipFunction: skipFunctionDiff
68
+ }) && isEqual(newSpecFromChildren, specFromChildren.current) || (prevSpec.current = newSpec,
69
+ specFromChildren.current = newSpecFromChildren, chartContext.current.chart.updateSpecSync(parseSpec(props), void 0, {
70
+ morph: !1,
71
+ enableExitAnimation: !1
72
+ }), handleChartRender());
51
73
  }), [ props ]), useEffect((() => () => {
52
- chartContext && (chartContext.current.chart && chartContext.current.chart.release(),
53
- chartContext.current = null), isUnmount.current = !0;
74
+ chartContext && chartContext.current && chartContext.current.chart && (chartContext.current.chart.release(),
75
+ chartContext.current.chart = null), isUnmount.current = !0;
54
76
  }), []), React.createElement(RootChartContext.Provider, {
55
77
  value: chartContext.current
56
78
  }, React.createElement(ViewContext.Provider, {
57
79
  value: view
58
80
  }, toArray(props.children).map(((child, index) => {
59
- var _a, _b, _c;
81
+ if ("string" == typeof child) return;
82
+ const childId = `${child && child.type && (child.type.displayName || child.type.name)}-${index}`;
60
83
  return React.createElement(React.Fragment, {
61
- key: null !== (_c = null !== (_b = null === (_a = null == child ? void 0 : child.props) || void 0 === _a ? void 0 : _a.id) && void 0 !== _b ? _b : null == child ? void 0 : child.id) && void 0 !== _c ? _c : `child-${index}`
84
+ key: childId
62
85
  }, React.cloneElement(child, {
63
- updateId: updateId
86
+ updateId: updateId,
87
+ componentId: childId
64
88
  }));
65
89
  }))));
66
90
  }));
67
91
 
68
- export const createChart = (componentName, type, callback) => {
69
- const Com = withContainer(BaseChart, componentName, (props => (props.type = type,
70
- callback ? callback(props) : type ? Object.assign(Object.assign({}, props), {
71
- type: type
72
- }) : props)));
92
+ export const createChart = (componentName, defaultProps, callback) => {
93
+ const Com = withContainer(BaseChart, componentName, (props => callback ? callback(props, defaultProps) : defaultProps ? Object.assign(props, defaultProps) : props));
73
94
  return Com.displayName = componentName, Com;
74
95
  };
75
96
  //# sourceMappingURL=BaseChart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/BaseChart.tsx"],"names":[],"mappings":"AAAA,OAAO,MAA8B,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,aAAiC,MAAM,6BAA6B,CAAC;AAC5E,OAAO,gBAAsC,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,WAAW,MAAM,iBAAiB,CAAC;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cesContent":["import VChart, { IData, IInitOption } from '@visactor/vchart';\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react';\nimport withContainer, { ContainerProps } from '../containers/withContainer';\nimport RootChartContext, { ChartContextType } from '../context/chart';\nimport type { IView } from '@visactor/vgrammar';\nimport { isEqual, pickWithout } from '@visactor/vutils';\nimport ViewContext from '../context/view';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport { IMarkElement } from '../components';\nimport { bindEventsToChart, EventsProps, CHART_EVENTS_KEYS, CHART_EVENTS } from '../eventsUtils';\n\nexport type ChartOptions = Omit<IInitOption, 'dom'>;\n\nexport interface BaseChartProps extends EventsProps {\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /**\n * used only by <VChart />\n */\n spec?: any;\n /** 数据 */\n data?: IData;\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n /** 图表配置 */\n options?: ChartOptions;\n\n /** 图表渲染完成事件 */\n onReady?: (instance: VChart, isInitial: boolean) => void;\n}\n\ntype Props = React.PropsWithChildren<BaseChartProps>;\n\nconst notSpecKeys = [...REACT_PRIVATE_PROPS, ...CHART_EVENTS_KEYS, 'spec', 'container', 'options'];\n\nconst BaseChart: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const chartContext = useRef<ChartContextType>({\n specFromChildren: {}\n });\n\n useImperativeHandle(ref, () => chartContext.current.chart);\n\n const hasSpec = !!props.spec;\n const [view, setView] = useState<IView>(null);\n const isUnmount = useRef<boolean>(false);\n const prevSpec = useRef(pickWithout(props, notSpecKeys));\n const eventsBinded = React.useRef<BaseChartProps>(null);\n\n const parseSpec = (props: Props) => {\n if (hasSpec && props.spec) {\n return props.spec;\n }\n\n return {\n ...prevSpec.current,\n ...chartContext.current.specFromChildren\n };\n };\n\n const createChart = (props: Props) => {\n const cs = new VChart(parseSpec(props), {\n ...props.options,\n autoFit: true,\n mode: 'desktop-browser',\n dom: props.container\n });\n chartContext.current = { ...chartContext.current, chart: cs };\n };\n\n const handleChartRender = () => {\n const newView = chartContext.current.chart.getCompiler().getVGrammarView();\n if (newView !== view && !isUnmount.current) {\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(chartContext.current.chart, updateId === 0);\n }\n }\n setView(newView);\n };\n\n const renderChart = () => {\n if (chartContext.current.chart) {\n // eslint-disable-next-line promise/catch-or-return\n chartContext.current.chart.renderAsync().then(handleChartRender);\n }\n };\n\n useEffect(() => {\n if (!chartContext.current.chart) {\n createChart(props);\n renderChart();\n bindEventsToChart(chartContext.current.chart, props, null, CHART_EVENTS);\n chartContext.current = {\n ...chartContext.current,\n isChildrenUpdated: false\n };\n eventsBinded.current = props;\n return;\n }\n\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n\n if (hasSpec) {\n if (!isEqual(eventsBinded.current.spec, props.spec)) {\n // eslint-disable-next-line promise/catch-or-return\n chartContext.current.chart.updateSpec(parseSpec(props)).then(handleChartRender);\n }\n return;\n }\n\n const newSpec = pickWithout(props, notSpecKeys);\n\n if (!isEqual(newSpec, prevSpec.current) || chartContext.current.isChildrenUpdated) {\n prevSpec.current = newSpec;\n // eslint-disable-next-line promise/catch-or-return\n chartContext.current.chart.updateSpec(parseSpec(props)).then(handleChartRender);\n }\n chartContext.current = {\n ...chartContext.current,\n isChildrenUpdated: false\n };\n }, [props]);\n\n useEffect(() => {\n return () => {\n if (chartContext) {\n if (chartContext.current.chart) {\n chartContext.current.chart.release();\n }\n chartContext.current = null;\n }\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootChartContext.Provider value={chartContext.current}>\n <ViewContext.Provider value={view}>\n {toArray(props.children).map((child, index) => {\n return (\n <React.Fragment key={(child as any)?.props?.id ?? (child as any)?.id ?? `child-${index}`}>\n {React.cloneElement(child as IMarkElement, {\n updateId: updateId\n })}\n </React.Fragment>\n );\n })}\n </ViewContext.Provider>\n </RootChartContext.Provider>\n );\n});\n\nexport const createChart = <T extends Props>(componentName: string, type?: string, callback?: (props: T) => T) => {\n const Com = withContainer<ContainerProps, T>(BaseChart as any, componentName, (props: any) => {\n props.type = type;\n\n if (callback) {\n return callback(props);\n }\n\n if (type) {\n return { ...props, type };\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
1
+ {"version":3,"sources":["../src/charts/BaseChart.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,aAAiC,MAAM,6BAA6B,CAAC;AAC5E,OAAO,gBAAsC,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,iBAAiB,EAEjB,iBAAiB,EACjB,YAAY,EASb,MAAM,gBAAgB,CAAC;AA+CxB,MAAM,WAAW,GAAG;IAClB,GAAG,mBAAmB;IACtB,GAAG,iBAAiB;IACpB,oBAAoB;IACpB,eAAe;IACf,kBAAkB;IAClB,SAAS;IACT,SAAS;IACT,MAAM;IACN,WAAW;IACX,SAAS;CACV,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,KAAY,EAAE,EAAE;IAC7C,MAAM,gBAAgB,GAAsD,EAAE,CAAC;IAE/E,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;QAClC,MAAM,SAAS,GAAG,KAAK,IAAK,KAAa,CAAC,IAAI,IAAK,KAAa,CAAC,IAAI,CAAC,SAAS,CAAC;QAEhF,IAAI,SAAS,IAAK,KAAa,CAAC,KAAK,EAAE;YACrC,MAAM,UAAU,GAAG,SAA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;gBAC7B,OAAO;aACR;YAED,MAAM,aAAa,GACjB,KAAK,IAAK,KAAa,CAAC,IAAI,IAAI,CAAE,KAAa,CAAC,IAAI,CAAC,WAAW,IAAK,KAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChG,MAAM,OAAO,GAAG,GAAG,aAAa,IAAI,KAAK,EAAE,CAAC;YAE5C,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,OAAO,IACzB,KAAK,CAAC,YAAY,CAAC,KAAkE,EAAE;gBACtF,QAAQ,EAAE,QAAQ;gBAClB,WAAW,EAAE,OAAO;aACrB,CAAC,CACa,CAClB,CAAC;QACJ,CAAC,CAAC,CACmB,CACG,CAC7B,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,aAAqB,EACrB,YAAyB,EACzB,QAAqD,EACrD,EAAE;IACF,MAAM,GAAG,GAAG,aAAa,CAAoB,SAAgB,EAAE,aAAa,EAAE,CAAC,KAAQ,EAAE,EAAE;QACzF,IAAI,QAAQ,EAAE;YACZ,OAAO,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;SACtC;QAED,IAAI,YAAY,EAAE;YAChB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC;SAC3C;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,WAAW,GAAG,aAAa,CAAC;IAChC,OAAO,GAAG,CAAC;AACb,CAAC,CAAC","file":"BaseChart.js","sourcesContent":["import type { IVChart, IData, IInitOption, ISpec, IVChartConstructor } from '@visactor/vchart';\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react';\nimport withContainer, { ContainerProps } from '../containers/withContainer';\nimport RootChartContext, { ChartContextType } from '../context/chart';\nimport type { IView } from '@visactor/vgrammar-core';\nimport { isEqual, pickWithout } from '@visactor/vutils';\nimport ViewContext from '../context/view';\nimport { toArray } from '../util';\nimport { REACT_PRIVATE_PROPS } from '../constants';\nimport {\n bindEventsToChart,\n EventsProps,\n CHART_EVENTS_KEYS,\n CHART_EVENTS,\n LegendEventProps,\n ScrollBarEventProps,\n BrushEventProps,\n DataZoomEventProps,\n PlayerEventProps,\n DimensionEventProps,\n HierarchyEventProps,\n ChartLifeCycleEventProps\n} from '../eventsUtils';\n\nexport type ChartOptions = Omit<IInitOption, 'dom'>;\n\nexport interface BaseChartProps\n extends EventsProps,\n LegendEventProps,\n ScrollBarEventProps,\n BrushEventProps,\n DataZoomEventProps,\n PlayerEventProps,\n DimensionEventProps,\n HierarchyEventProps,\n ChartLifeCycleEventProps {\n vchartConstrouctor?: IVChartConstructor;\n type?: string;\n /** 上层container */\n container?: HTMLDivElement;\n /**\n * used only by <VChart />\n */\n spec?: ISpec;\n /** 数据 */\n data?: IData;\n /** 画布宽度 */\n width?: number;\n /** 画布高度 */\n height?: number;\n /** 图表配置 */\n options?: ChartOptions;\n /** skip function diff when component update */\n skipFunctionDiff?: boolean;\n /** 图表渲染完成事件 */\n onReady?: (instance: IVChart, isInitial: boolean) => void;\n /** throw error when chart run into an error */\n onError?: (err: Error) => void;\n /**\n * use sync render\n *\n * @since 1.8.3\n * @deprecated 1.9.0\n **/\n useSyncRender?: boolean;\n}\n\ntype Props = React.PropsWithChildren<BaseChartProps>;\n\nconst notSpecKeys = [\n ...REACT_PRIVATE_PROPS,\n ...CHART_EVENTS_KEYS,\n 'vchartConstrouctor',\n 'useSyncRender',\n 'skipFunctionDiff',\n 'onError',\n 'onReady',\n 'spec',\n 'container',\n 'options'\n];\n\nconst parseSpecFromChildren = (props: Props) => {\n const specFromChildren: Omit<ISpec, 'type' | 'data' | 'width' | 'height'> = {};\n\n toArray(props.children).map(child => {\n const parseSpec = child && (child as any).type && (child as any).type.parseSpec;\n\n if (parseSpec && (child as any).props) {\n const specResult = parseSpec((child as any).props);\n\n if (specResult.isSingle) {\n specFromChildren[specResult.specName] = specResult.spec;\n } else {\n if (!specFromChildren[specResult.specName]) {\n specFromChildren[specResult.specName] = [];\n }\n\n specFromChildren[specResult.specName].push(specResult.spec);\n }\n }\n });\n\n return specFromChildren;\n};\n\nconst BaseChart: React.FC<Props> = React.forwardRef((props, ref) => {\n const [updateId, setUpdateId] = useState<number>(0);\n const chartContext = useRef<ChartContextType>({});\n useImperativeHandle(ref, () => chartContext.current?.chart);\n const hasSpec = !!props.spec;\n const [view, setView] = useState<IView>(null);\n const isUnmount = useRef<boolean>(false);\n const prevSpec = useRef(pickWithout(props, notSpecKeys));\n const specFromChildren = useRef<Omit<ISpec, 'type' | 'data' | 'width' | 'height'>>(null);\n const eventsBinded = React.useRef<BaseChartProps>(null);\n const skipFunctionDiff = !!props.skipFunctionDiff;\n\n const parseSpec = (props: Props) => {\n if (hasSpec && props.spec) {\n return props.spec;\n }\n\n return {\n ...prevSpec.current,\n ...specFromChildren.current\n } as ISpec;\n };\n\n const createChart = (props: Props) => {\n const cs = new props.vchartConstrouctor(parseSpec(props), {\n ...props.options,\n onError: props.onError,\n autoFit: true,\n dom: props.container\n });\n chartContext.current = { ...chartContext.current, chart: cs };\n };\n\n const handleChartRender = () => {\n // rebind events after render\n if (!isUnmount.current) {\n if (!chartContext.current || !chartContext.current.chart) {\n return;\n }\n\n bindEventsToChart(chartContext.current.chart, props, eventsBinded.current, CHART_EVENTS);\n\n const newView = chartContext.current.chart.getCompiler().getVGrammarView();\n\n setUpdateId(updateId + 1);\n if (props.onReady) {\n props.onReady(chartContext.current.chart, updateId === 0);\n }\n setView(newView);\n }\n };\n\n const renderChart = () => {\n if (chartContext.current.chart) {\n chartContext.current.chart.renderSync({\n reuse: false\n });\n handleChartRender();\n }\n };\n\n useEffect(() => {\n const newSpecFromChildren = hasSpec ? null : parseSpecFromChildren(props);\n\n if (!chartContext.current?.chart) {\n if (!hasSpec) {\n specFromChildren.current = newSpecFromChildren;\n }\n\n createChart(props);\n renderChart();\n bindEventsToChart(chartContext.current.chart, props, null, CHART_EVENTS);\n eventsBinded.current = props;\n return;\n }\n\n if (hasSpec) {\n if (!isEqual(eventsBinded.current.spec, props.spec, { skipFunction: skipFunctionDiff })) {\n eventsBinded.current = props;\n chartContext.current.chart.updateSpecSync(parseSpec(props), undefined, {\n morph: false,\n enableExitAnimation: false\n });\n handleChartRender();\n }\n return;\n }\n\n const newSpec = pickWithout(props, notSpecKeys);\n\n if (\n !isEqual(newSpec, prevSpec.current, { skipFunction: skipFunctionDiff }) ||\n !isEqual(newSpecFromChildren, specFromChildren.current)\n ) {\n prevSpec.current = newSpec;\n specFromChildren.current = newSpecFromChildren;\n\n chartContext.current.chart.updateSpecSync(parseSpec(props), undefined, {\n morph: false,\n enableExitAnimation: false\n });\n handleChartRender();\n }\n }, [props]);\n\n useEffect(() => {\n return () => {\n if (chartContext) {\n if (chartContext.current && chartContext.current.chart) {\n chartContext.current.chart.release();\n chartContext.current.chart = null;\n }\n }\n isUnmount.current = true;\n };\n }, []);\n\n return (\n <RootChartContext.Provider value={chartContext.current}>\n <ViewContext.Provider value={view}>\n {toArray(props.children).map((child, index) => {\n if (typeof child === 'string') {\n return;\n }\n\n const componentName =\n child && (child as any).type && ((child as any).type.displayName || (child as any).type.name);\n const childId = `${componentName}-${index}`;\n\n return (\n <React.Fragment key={childId}>\n {React.cloneElement(child as React.ReactElement<any, React.JSXElementConstructor<any>>, {\n updateId: updateId,\n componentId: childId\n })}\n </React.Fragment>\n );\n })}\n </ViewContext.Provider>\n </RootChartContext.Provider>\n );\n});\n\nexport const createChart = <T extends Props>(\n componentName: string,\n defaultProps?: Partial<T>,\n callback?: (props: T, defaultProps?: Partial<T>) => T\n) => {\n const Com = withContainer<ContainerProps, T>(BaseChart as any, componentName, (props: T) => {\n if (callback) {\n return callback(props, defaultProps);\n }\n\n if (defaultProps) {\n return Object.assign(props, defaultProps);\n }\n return props;\n });\n Com.displayName = componentName;\n return Com;\n};\n"]}
@@ -1,5 +1,10 @@
1
+ import React from 'react';
1
2
  import { IBoxPlotChartSpec } from '@visactor/vchart';
2
3
  import { BaseChartProps } from './BaseChart';
3
4
  export interface BoxPlotChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<IBoxPlotChartSpec, 'type'> {
4
5
  }
5
- export declare const BoxPlotChart: import("react").ForwardRefExoticComponent<import("../containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
6
+ export declare const BoxPlotChart: React.ForwardRefExoticComponent<BoxPlotChartProps & {
7
+ children?: React.ReactNode;
8
+ } & {
9
+ type: 'boxPlot';
10
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -1,4 +1,9 @@
1
+ import { default as VChart } from "@visactor/vchart";
2
+
1
3
  import { createChart } from "./BaseChart";
2
4
 
3
- export const BoxPlotChart = createChart("BoxPlotChart", "boxPlot");
5
+ export const BoxPlotChart = createChart("BoxPlotChart", {
6
+ type: "boxPlot",
7
+ vchartConstrouctor: VChart
8
+ });
4
9
  //# sourceMappingURL=BoxPlotChart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/BoxPlotChart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAoB,cAAc,EAAE,SAAS,CAAC,CAAC","file":"BoxPlotChart.js","sourcesContent":["import { IBoxPlotChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface BoxPlotChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IBoxPlotChartSpec, 'type'> {}\n\nexport const BoxPlotChart = createChart<BoxPlotChartProps>('BoxPlotChart', 'boxPlot');\n"]}
1
+ {"version":3,"sources":["../src/charts/BoxPlotChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CACrC,cAAc,EACd;IACE,IAAI,EAAE,SAAS;IACf,kBAAkB,EAAE,MAAM;CAC3B,CACF,CAAC","file":"BoxPlotChart.js","sourcesContent":["import React from 'react';\nimport { IBoxPlotChartSpec } from '@visactor/vchart';\nimport { default as VChart } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface BoxPlotChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IBoxPlotChartSpec, 'type'> {}\n\nexport const BoxPlotChart = createChart<React.PropsWithChildren<BoxPlotChartProps> & { type: 'boxPlot' }>(\n 'BoxPlotChart',\n {\n type: 'boxPlot',\n vchartConstrouctor: VChart\n }\n);\n"]}
@@ -1,5 +1,10 @@
1
+ import React from 'react';
1
2
  import { ICircularProgressChartSpec } from '@visactor/vchart';
2
3
  import { BaseChartProps } from './BaseChart';
3
4
  export interface CircularProgressChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<ICircularProgressChartSpec, 'type'> {
4
5
  }
5
- export declare const CircularProgressChart: import("react").ForwardRefExoticComponent<import("../containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
6
+ export declare const CircularProgressChart: React.ForwardRefExoticComponent<CircularProgressChartProps & {
7
+ children?: React.ReactNode;
8
+ } & {
9
+ type: 'circularProgress';
10
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -1,4 +1,9 @@
1
+ import { default as VChart } from "@visactor/vchart";
2
+
1
3
  import { createChart } from "./BaseChart";
2
4
 
3
- export const CircularProgressChart = createChart("CircularProgressChart", "circularProgress");
5
+ export const CircularProgressChart = createChart("CircularProgressChart", {
6
+ type: "circularProgress",
7
+ vchartConstrouctor: VChart
8
+ });
4
9
  //# sourceMappingURL=CircularProgressChart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/CircularProgressChart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAC9C,uBAAuB,EACvB,kBAAkB,CACnB,CAAC","file":"CircularProgressChart.js","sourcesContent":["import { ICircularProgressChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface CircularProgressChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<ICircularProgressChartSpec, 'type'> {}\n\nexport const CircularProgressChart = createChart<CircularProgressChartProps>(\n 'CircularProgressChart',\n 'circularProgress'\n);\n"]}
1
+ {"version":3,"sources":["../src/charts/CircularProgressChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAE9C,uBAAuB,EAAE;IACzB,IAAI,EAAE,kBAAkB;IACxB,kBAAkB,EAAE,MAAM;CAC3B,CAAC,CAAC","file":"CircularProgressChart.js","sourcesContent":["import React from 'react';\nimport { ICircularProgressChartSpec } from '@visactor/vchart';\nimport { default as VChart } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface CircularProgressChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<ICircularProgressChartSpec, 'type'> {}\n\nexport const CircularProgressChart = createChart<\n React.PropsWithChildren<CircularProgressChartProps> & { type: 'circularProgress' }\n>('CircularProgressChart', {\n type: 'circularProgress',\n vchartConstrouctor: VChart\n});\n"]}
@@ -1,5 +1,10 @@
1
+ import React from 'react';
1
2
  import { ICommonChartSpec } from '@visactor/vchart';
2
3
  import { BaseChartProps } from './BaseChart';
3
4
  export interface CommonChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<ICommonChartSpec, 'type'> {
4
5
  }
5
- export declare const CommonChart: import("react").ForwardRefExoticComponent<import("../containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
6
+ export declare const CommonChart: React.ForwardRefExoticComponent<CommonChartProps & {
7
+ children?: React.ReactNode;
8
+ } & {
9
+ type: 'common';
10
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -1,4 +1,9 @@
1
+ import { default as VChart } from "@visactor/vchart";
2
+
1
3
  import { createChart } from "./BaseChart";
2
4
 
3
- export const CommonChart = createChart("CommonChart", "common");
5
+ export const CommonChart = createChart("CommonChart", {
6
+ type: "common",
7
+ vchartConstrouctor: VChart
8
+ });
4
9
  //# sourceMappingURL=CommonChart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/CommonChart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAmB,aAAa,EAAE,QAAQ,CAAC,CAAC","file":"CommonChart.js","sourcesContent":["import { ICommonChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface CommonChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<ICommonChartSpec, 'type'> {}\n\nexport const CommonChart = createChart<CommonChartProps>('CommonChart', 'common');\n"]}
1
+ {"version":3,"sources":["../src/charts/CommonChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAiE,aAAa,EAAE;IACpH,IAAI,EAAE,QAAQ;IACd,kBAAkB,EAAE,MAAM;CAC3B,CAAC,CAAC","file":"CommonChart.js","sourcesContent":["import React from 'react';\nimport { ICommonChartSpec } from '@visactor/vchart';\nimport { default as VChart } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface CommonChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<ICommonChartSpec, 'type'> {}\n\nexport const CommonChart = createChart<React.PropsWithChildren<CommonChartProps> & { type: 'common' }>('CommonChart', {\n type: 'common',\n vchartConstrouctor: VChart\n});\n"]}
@@ -1,5 +1,10 @@
1
+ import React from 'react';
1
2
  import { IFunnelChartSpec } from '@visactor/vchart';
2
3
  import { BaseChartProps } from './BaseChart';
3
4
  export interface FunnelChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<IFunnelChartSpec, 'type'> {
4
5
  }
5
- export declare const FunnelChart: import("react").ForwardRefExoticComponent<import("../containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
6
+ export declare const FunnelChart: React.ForwardRefExoticComponent<FunnelChartProps & {
7
+ children?: React.ReactNode;
8
+ } & {
9
+ type: 'funnel';
10
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -1,4 +1,9 @@
1
+ import { default as VChart } from "@visactor/vchart";
2
+
1
3
  import { createChart } from "./BaseChart";
2
4
 
3
- export const FunnelChart = createChart("FunnelChart", "funnel");
5
+ export const FunnelChart = createChart("FunnelChart", {
6
+ type: "funnel",
7
+ vchartConstrouctor: VChart
8
+ });
4
9
  //# sourceMappingURL=FunnelChart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/FunnelChart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAmB,aAAa,EAAE,QAAQ,CAAC,CAAC","file":"FunnelChart.js","sourcesContent":["import { IFunnelChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface FunnelChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IFunnelChartSpec, 'type'> {}\n\nexport const FunnelChart = createChart<FunnelChartProps>('FunnelChart', 'funnel');\n"]}
1
+ {"version":3,"sources":["../src/charts/FunnelChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAiE,aAAa,EAAE;IACpH,IAAI,EAAE,QAAQ;IACd,kBAAkB,EAAE,MAAM;CAC3B,CAAC,CAAC","file":"FunnelChart.js","sourcesContent":["import React from 'react';\nimport { IFunnelChartSpec } from '@visactor/vchart';\nimport { default as VChart } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface FunnelChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IFunnelChartSpec, 'type'> {}\n\nexport const FunnelChart = createChart<React.PropsWithChildren<FunnelChartProps> & { type: 'funnel' }>('FunnelChart', {\n type: 'funnel',\n vchartConstrouctor: VChart\n});\n"]}
@@ -1,5 +1,10 @@
1
+ import React from 'react';
1
2
  import { IHistogramChartSpec } from '@visactor/vchart';
2
3
  import { BaseChartProps } from './BaseChart';
3
4
  export interface HistogramChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<IHistogramChartSpec, 'type'> {
4
5
  }
5
- export declare const HistogramChart: import("react").ForwardRefExoticComponent<import("../containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
6
+ export declare const HistogramChart: React.ForwardRefExoticComponent<HistogramChartProps & {
7
+ children?: React.ReactNode;
8
+ } & {
9
+ type: 'histogram';
10
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -1,4 +1,9 @@
1
+ import { default as VChart } from "@visactor/vchart";
2
+
1
3
  import { createChart } from "./BaseChart";
2
4
 
3
- export const HistogramChart = createChart("HistogramChart", "histogram");
5
+ export const HistogramChart = createChart("HistogramChart", {
6
+ type: "histogram",
7
+ vchartConstrouctor: VChart
8
+ });
4
9
  //# sourceMappingURL=HistogramChart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/HistogramChart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CAAsB,gBAAgB,EAAE,WAAW,CAAC,CAAC","file":"HistogramChart.js","sourcesContent":["import { IHistogramChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface HistogramChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IHistogramChartSpec, 'type'> {}\n\nexport const HistogramChart = createChart<HistogramChartProps>('HistogramChart', 'histogram');\n"]}
1
+ {"version":3,"sources":["../src/charts/HistogramChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CACvC,gBAAgB,EAChB;IACE,IAAI,EAAE,WAAW;IACjB,kBAAkB,EAAE,MAAM;CAC3B,CACF,CAAC","file":"HistogramChart.js","sourcesContent":["import React from 'react';\nimport { IHistogramChartSpec } from '@visactor/vchart';\nimport { default as VChart } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface HistogramChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<IHistogramChartSpec, 'type'> {}\n\nexport const HistogramChart = createChart<React.PropsWithChildren<HistogramChartProps> & { type: 'histogram' }>(\n 'HistogramChart',\n {\n type: 'histogram',\n vchartConstrouctor: VChart\n }\n);\n"]}
@@ -1,5 +1,10 @@
1
- import { ILineChartSpec } from '@visactor/vchart';
1
+ import React from 'react';
2
+ import type { ILineChartSpec } from '@visactor/vchart';
2
3
  import { BaseChartProps } from './BaseChart';
3
4
  export interface LineChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<ILineChartSpec, 'type'> {
4
5
  }
5
- export declare const LineChart: import("react").ForwardRefExoticComponent<import("../containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
6
+ export declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & {
7
+ children?: React.ReactNode;
8
+ } & {
9
+ type: 'line';
10
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -1,4 +1,9 @@
1
+ import { default as VChart } from "@visactor/vchart";
2
+
1
3
  import { createChart } from "./BaseChart";
2
4
 
3
- export const LineChart = createChart("LineChart", "line");
5
+ export const LineChart = createChart("LineChart", {
6
+ type: "line",
7
+ vchartConstrouctor: VChart
8
+ });
4
9
  //# sourceMappingURL=LineChart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/LineChart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAiB,WAAW,EAAE,MAAM,CAAC,CAAC","file":"LineChart.js","sourcesContent":["import { ILineChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface LineChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<ILineChartSpec, 'type'> {}\n\nexport const LineChart = createChart<LineChartProps>('LineChart', 'line');\n"]}
1
+ {"version":3,"sources":["../src/charts/LineChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAA6D,WAAW,EAAE;IAC5G,IAAI,EAAE,MAAM;IACZ,kBAAkB,EAAE,MAAM;CAC3B,CAAC,CAAC","file":"LineChart.js","sourcesContent":["import React from 'react';\nimport type { ILineChartSpec } from '@visactor/vchart';\nimport { default as VChart } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface LineChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<ILineChartSpec, 'type'> {}\n\nexport const LineChart = createChart<React.PropsWithChildren<LineChartProps> & { type: 'line' }>('LineChart', {\n type: 'line',\n vchartConstrouctor: VChart\n});\n"]}
@@ -1,5 +1,10 @@
1
+ import React from 'react';
1
2
  import { ILinearProgressChartSpec } from '@visactor/vchart';
2
3
  import { BaseChartProps } from './BaseChart';
3
4
  export interface LinearProgressChartProps extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>, Omit<ILinearProgressChartSpec, 'type'> {
4
5
  }
5
- export declare const LinearProgressChart: import("react").ForwardRefExoticComponent<import("../containers/withContainer").ContainerProps & import("react").RefAttributes<any>>;
6
+ export declare const LinearProgressChart: React.ForwardRefExoticComponent<LinearProgressChartProps & {
7
+ children?: React.ReactNode;
8
+ } & {
9
+ type: 'linearProgress';
10
+ } & import("../containers/withContainer").ContainerProps & React.RefAttributes<any>>;
@@ -1,4 +1,9 @@
1
+ import { default as VChart } from "@visactor/vchart";
2
+
1
3
  import { createChart } from "./BaseChart";
2
4
 
3
- export const LinearProgressChart = createChart("LinearProgressChart", "linearProgress");
5
+ export const LinearProgressChart = createChart("LinearProgressChart", {
6
+ type: "linearProgress",
7
+ vchartConstrouctor: VChart
8
+ });
4
9
  //# sourceMappingURL=LinearProgressChart.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["charts/LinearProgressChart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAA2B,qBAAqB,EAAE,gBAAgB,CAAC,CAAC","file":"LinearProgressChart.js","sourcesContent":["import { ILinearProgressChartSpec } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface LinearProgressChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<ILinearProgressChartSpec, 'type'> {}\n\nexport const LinearProgressChart = createChart<LinearProgressChartProps>('LinearProgressChart', 'linearProgress');\n"]}
1
+ {"version":3,"sources":["../src/charts/LinearProgressChart.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAM1D,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAE5C,qBAAqB,EAAE;IACvB,IAAI,EAAE,gBAAgB;IACtB,kBAAkB,EAAE,MAAM;CAC3B,CAAC,CAAC","file":"LinearProgressChart.js","sourcesContent":["import React from 'react';\nimport { ILinearProgressChartSpec } from '@visactor/vchart';\nimport { default as VChart } from '@visactor/vchart';\nimport { BaseChartProps, createChart } from './BaseChart';\n\nexport interface LinearProgressChartProps\n extends Omit<BaseChartProps, 'spec' | 'container' | 'type'>,\n Omit<ILinearProgressChartSpec, 'type'> {}\n\nexport const LinearProgressChart = createChart<\n React.PropsWithChildren<LinearProgressChartProps> & { type: 'linearProgress' }\n>('LinearProgressChart', {\n type: 'linearProgress',\n vchartConstrouctor: VChart\n});\n"]}