@visactor/vseed 0.4.2 → 0.4.4

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 (310) hide show
  1. package/dist/cjs/index.cjs +646 -1
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/builder/builder/buildSpec.d.ts +1 -2
  4. package/dist/esm/builder/builder/buildSpec.js.map +1 -1
  5. package/dist/esm/builder/builder/builder.d.ts +54 -14290
  6. package/dist/esm/builder/builder/builder.js +10 -0
  7. package/dist/esm/builder/builder/builder.js.map +1 -1
  8. package/dist/esm/builder/builder/prepare.d.ts +12 -0
  9. package/dist/esm/builder/builder/prepare.js +269 -0
  10. package/dist/esm/builder/builder/prepare.js.map +1 -0
  11. package/dist/esm/builder/register/all.js +4 -1
  12. package/dist/esm/builder/register/all.js.map +1 -1
  13. package/dist/esm/builder/register/chartType/index.d.ts +3 -0
  14. package/dist/esm/builder/register/chartType/index.js +4 -1
  15. package/dist/esm/builder/register/chartType/raceDonut.d.ts +5 -0
  16. package/dist/esm/builder/register/chartType/raceDonut.js +9 -0
  17. package/dist/esm/builder/register/chartType/raceDonut.js.map +1 -0
  18. package/dist/esm/builder/register/chartType/raceLine.d.ts +5 -0
  19. package/dist/esm/builder/register/chartType/raceLine.js +9 -0
  20. package/dist/esm/builder/register/chartType/raceLine.js.map +1 -0
  21. package/dist/esm/builder/register/chartType/racePie.d.ts +5 -0
  22. package/dist/esm/builder/register/chartType/racePie.js +9 -0
  23. package/dist/esm/builder/register/chartType/racePie.js.map +1 -0
  24. package/dist/esm/dataReshape/constant.d.ts +1 -0
  25. package/dist/esm/dataReshape/constant.js +2 -1
  26. package/dist/esm/dataReshape/constant.js.map +1 -1
  27. package/dist/esm/dataSelector/selector.d.ts +71 -2
  28. package/dist/esm/dataSelector/selector.js +96 -32
  29. package/dist/esm/dataSelector/selector.js.map +1 -1
  30. package/dist/esm/pipeline/advanced/chart/pipeline/index.d.ts +3 -0
  31. package/dist/esm/pipeline/advanced/chart/pipeline/index.js +4 -1
  32. package/dist/esm/pipeline/advanced/chart/pipeline/raceDonut.d.ts +2 -0
  33. package/dist/esm/pipeline/advanced/chart/pipeline/raceDonut.js +33 -0
  34. package/dist/esm/pipeline/advanced/chart/pipeline/raceDonut.js.map +1 -0
  35. package/dist/esm/pipeline/advanced/chart/pipeline/raceLine.d.ts +2 -0
  36. package/dist/esm/pipeline/advanced/chart/pipeline/raceLine.js +36 -0
  37. package/dist/esm/pipeline/advanced/chart/pipeline/raceLine.js.map +1 -0
  38. package/dist/esm/pipeline/advanced/chart/pipeline/racePie.d.ts +2 -0
  39. package/dist/esm/pipeline/advanced/chart/pipeline/racePie.js +33 -0
  40. package/dist/esm/pipeline/advanced/chart/pipeline/racePie.js.map +1 -0
  41. package/dist/esm/pipeline/advanced/chart/pipes/default/defaultMeasures.js +2 -1
  42. package/dist/esm/pipeline/advanced/chart/pipes/default/defaultMeasures.js.map +1 -1
  43. package/dist/esm/pipeline/advanced/chart/pipes/encoding/index.d.ts +3 -0
  44. package/dist/esm/pipeline/advanced/chart/pipes/encoding/index.js +4 -1
  45. package/dist/esm/pipeline/advanced/chart/pipes/encoding/raceBar.js +0 -3
  46. package/dist/esm/pipeline/advanced/chart/pipes/encoding/raceBar.js.map +1 -1
  47. package/dist/esm/pipeline/advanced/chart/pipes/encoding/raceColumn.js +0 -3
  48. package/dist/esm/pipeline/advanced/chart/pipes/encoding/raceColumn.js.map +1 -1
  49. package/dist/esm/pipeline/advanced/chart/pipes/encoding/raceDonut.d.ts +3 -0
  50. package/dist/esm/pipeline/advanced/chart/pipes/encoding/raceDonut.js +74 -0
  51. package/dist/esm/pipeline/advanced/chart/pipes/encoding/raceDonut.js.map +1 -0
  52. package/dist/esm/pipeline/advanced/chart/pipes/encoding/raceLine.d.ts +3 -0
  53. package/dist/esm/pipeline/advanced/chart/pipes/encoding/raceLine.js +89 -0
  54. package/dist/esm/pipeline/advanced/chart/pipes/encoding/raceLine.js.map +1 -0
  55. package/dist/esm/pipeline/advanced/chart/pipes/encoding/racePie.d.ts +3 -0
  56. package/dist/esm/pipeline/advanced/chart/pipes/encoding/racePie.js +74 -0
  57. package/dist/esm/pipeline/advanced/chart/pipes/encoding/racePie.js.map +1 -0
  58. package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasures.js +2 -1
  59. package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasures.js.map +1 -1
  60. package/dist/esm/pipeline/spec/chart/pipeline/index.d.ts +3 -0
  61. package/dist/esm/pipeline/spec/chart/pipeline/index.js +4 -1
  62. package/dist/esm/pipeline/spec/chart/pipeline/raceBar.js +2 -2
  63. package/dist/esm/pipeline/spec/chart/pipeline/raceBar.js.map +1 -1
  64. package/dist/esm/pipeline/spec/chart/pipeline/raceColumn.js +2 -2
  65. package/dist/esm/pipeline/spec/chart/pipeline/raceColumn.js.map +1 -1
  66. package/dist/esm/pipeline/spec/chart/pipeline/raceDonut.d.ts +2 -0
  67. package/dist/esm/pipeline/spec/chart/pipeline/raceDonut.js +21 -0
  68. package/dist/esm/pipeline/spec/chart/pipeline/raceDonut.js.map +1 -0
  69. package/dist/esm/pipeline/spec/chart/pipeline/raceLine.d.ts +2 -0
  70. package/dist/esm/pipeline/spec/chart/pipeline/raceLine.js +25 -0
  71. package/dist/esm/pipeline/spec/chart/pipeline/raceLine.js.map +1 -0
  72. package/dist/esm/pipeline/spec/chart/pipeline/racePie.d.ts +2 -0
  73. package/dist/esm/pipeline/spec/chart/pipeline/racePie.js +21 -0
  74. package/dist/esm/pipeline/spec/chart/pipeline/racePie.js.map +1 -0
  75. package/dist/esm/pipeline/spec/chart/pipeline/raceScatter.js +2 -2
  76. package/dist/esm/pipeline/spec/chart/pipeline/raceScatter.js.map +1 -1
  77. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js +10 -4
  78. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js.map +1 -1
  79. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.d.ts +8 -2
  80. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js +13 -4
  81. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js.map +1 -1
  82. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js +8 -4
  83. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js.map +1 -1
  84. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js +10 -4
  85. package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js.map +1 -1
  86. package/dist/esm/pipeline/spec/chart/pipes/annotation/splitLine.js.map +1 -1
  87. package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.d.ts +9 -1
  88. package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.js +7 -1
  89. package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.js.map +1 -1
  90. package/dist/esm/pipeline/spec/chart/pipes/legend/boxLegend.js.map +1 -1
  91. package/dist/esm/pipeline/spec/chart/pipes/legend/heatmapColorLegend.js.map +1 -1
  92. package/dist/esm/pipeline/spec/chart/pipes/markStyle/barStyle.js +3 -2
  93. package/dist/esm/pipeline/spec/chart/pipes/markStyle/barStyle.js.map +1 -1
  94. package/dist/esm/pipeline/spec/chart/pipes/markStyle/lineStyle.js +5 -2
  95. package/dist/esm/pipeline/spec/chart/pipes/markStyle/lineStyle.js.map +1 -1
  96. package/dist/esm/pipeline/spec/chart/pipes/markStyle/pointState.js.map +1 -1
  97. package/dist/esm/pipeline/spec/chart/pipes/markStyle/pointStyle.js +3 -2
  98. package/dist/esm/pipeline/spec/chart/pipes/markStyle/pointStyle.js.map +1 -1
  99. package/dist/esm/pipeline/spec/chart/pipes/player/index.d.ts +5 -3
  100. package/dist/esm/pipeline/spec/chart/pipes/player/index.js +5 -3
  101. package/dist/esm/pipeline/spec/chart/pipes/player/isPlayer.d.ts +2 -2
  102. package/dist/esm/pipeline/spec/chart/pipes/player/isPlayer.js +8 -7
  103. package/dist/esm/pipeline/spec/chart/pipes/player/isPlayer.js.map +1 -1
  104. package/dist/esm/pipeline/spec/chart/pipes/player/{playerXY.d.ts → playerBar.d.ts} +1 -1
  105. package/dist/esm/pipeline/spec/chart/pipes/player/{playerYX.js → playerBar.js} +6 -7
  106. package/dist/esm/pipeline/spec/chart/pipes/player/playerBar.js.map +1 -0
  107. package/dist/esm/pipeline/spec/chart/pipes/player/playerColumn.d.ts +2 -0
  108. package/dist/esm/pipeline/spec/chart/pipes/player/{playerXY.js → playerColumn.js} +6 -7
  109. package/dist/esm/pipeline/spec/chart/pipes/player/playerColumn.js.map +1 -0
  110. package/dist/esm/pipeline/spec/chart/pipes/player/{playerYX.d.ts → playerLine.d.ts} +1 -1
  111. package/dist/esm/pipeline/spec/chart/pipes/player/playerLine.js +144 -0
  112. package/dist/esm/pipeline/spec/chart/pipes/player/playerLine.js.map +1 -0
  113. package/dist/esm/pipeline/spec/chart/pipes/player/{playerYY.d.ts → playerPie.d.ts} +1 -1
  114. package/dist/esm/pipeline/spec/chart/pipes/player/playerPie.js +174 -0
  115. package/dist/esm/pipeline/spec/chart/pipes/player/playerPie.js.map +1 -0
  116. package/dist/esm/pipeline/spec/chart/pipes/player/playerScatter.d.ts +2 -0
  117. package/dist/esm/pipeline/spec/chart/pipes/player/{playerYY.js → playerScatter.js} +7 -7
  118. package/dist/esm/pipeline/spec/chart/pipes/player/playerScatter.js.map +1 -0
  119. package/dist/esm/pipeline/spec/table/pipes/cellStyle/common.d.ts +4 -1
  120. package/dist/esm/pipeline/spec/table/pipes/cellStyle/common.js +12 -1
  121. package/dist/esm/pipeline/spec/table/pipes/cellStyle/common.js.map +1 -1
  122. package/dist/esm/pipeline/spec/table/pipes/cellStyle/pivot.js +6 -3
  123. package/dist/esm/pipeline/spec/table/pipes/cellStyle/pivot.js.map +1 -1
  124. package/dist/esm/pipeline/spec/table/pipes/cellStyle/table.js +7 -3
  125. package/dist/esm/pipeline/spec/table/pipes/cellStyle/table.js.map +1 -1
  126. package/dist/esm/pipeline/spec/table/pipes/corner/titleOnDimension.js.map +1 -1
  127. package/dist/esm/pipeline/utils/index.d.ts +1 -0
  128. package/dist/esm/pipeline/utils/index.js +1 -0
  129. package/dist/esm/pipeline/utils/sandbox/builtin-utils.d.ts +6 -0
  130. package/dist/esm/pipeline/utils/sandbox/builtin-utils.js +337 -0
  131. package/dist/esm/pipeline/utils/sandbox/builtin-utils.js.map +1 -0
  132. package/dist/esm/pipeline/utils/sandbox/execute.d.ts +73 -0
  133. package/dist/esm/pipeline/utils/sandbox/execute.js +716 -0
  134. package/dist/esm/pipeline/utils/sandbox/execute.js.map +1 -0
  135. package/dist/esm/pipeline/utils/sandbox/index.d.ts +7 -0
  136. package/dist/esm/pipeline/utils/sandbox/index.js +3 -0
  137. package/dist/esm/theme/dark/dark.js +10 -5
  138. package/dist/esm/theme/dark/dark.js.map +1 -1
  139. package/dist/esm/theme/dark/raceLine.d.ts +182 -0
  140. package/dist/esm/theme/dark/raceLine.js +39 -0
  141. package/dist/esm/theme/dark/raceLine.js.map +1 -0
  142. package/dist/esm/theme/dark/racePie.d.ts +157 -0
  143. package/dist/esm/theme/dark/racePie.js +18 -0
  144. package/dist/esm/theme/dark/racePie.js.map +1 -0
  145. package/dist/esm/theme/light/light.js +6 -1
  146. package/dist/esm/theme/light/light.js.map +1 -1
  147. package/dist/esm/theme/light/raceLine.d.ts +182 -0
  148. package/dist/esm/theme/light/raceLine.js +39 -0
  149. package/dist/esm/theme/light/raceLine.js.map +1 -0
  150. package/dist/esm/theme/light/racePie.d.ts +157 -0
  151. package/dist/esm/theme/light/racePie.js +18 -0
  152. package/dist/esm/theme/light/racePie.js.map +1 -0
  153. package/dist/esm/types/builder/builder.d.ts +1 -0
  154. package/dist/esm/types/builder/builder.js.map +1 -1
  155. package/dist/esm/types/chartType/area/zArea.d.ts +682 -18
  156. package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +682 -18
  157. package/dist/esm/types/chartType/bar/zBar.d.ts +362 -10
  158. package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +362 -10
  159. package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +362 -10
  160. package/dist/esm/types/chartType/boxPlot/zBoxPlot.d.ts +210 -14
  161. package/dist/esm/types/chartType/circlePacking/zCirclePacking.d.ts +2 -2
  162. package/dist/esm/types/chartType/column/zColumn.d.ts +363 -10
  163. package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +363 -10
  164. package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +362 -10
  165. package/dist/esm/types/chartType/donut/zDonut.d.ts +2 -2
  166. package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +842 -22
  167. package/dist/esm/types/chartType/funnel/zFunnel.d.ts +2 -2
  168. package/dist/esm/types/chartType/heatmap/zHeatmap.d.ts +2 -2
  169. package/dist/esm/types/chartType/histogram/zHistogram.d.ts +362 -10
  170. package/dist/esm/types/chartType/index.d.ts +7 -0
  171. package/dist/esm/types/chartType/index.js +3 -0
  172. package/dist/esm/types/chartType/line/zLine.d.ts +522 -14
  173. package/dist/esm/types/chartType/pie/zPie.d.ts +2 -2
  174. package/dist/esm/types/chartType/pivotTable/zPivotTable.d.ts +241 -4
  175. package/dist/esm/types/chartType/pivotTable/zPivotTable.js +1 -1
  176. package/dist/esm/types/chartType/pivotTable/zPivotTable.js.map +1 -1
  177. package/dist/esm/types/chartType/raceBar/raceBar.d.ts +2 -2
  178. package/dist/esm/types/chartType/raceBar/zRaceBar.d.ts +363 -10
  179. package/dist/esm/types/chartType/raceColumn/raceColumn.d.ts +106 -3
  180. package/dist/esm/types/chartType/raceColumn/zRaceColumn.d.ts +363 -10
  181. package/dist/esm/types/chartType/raceDonut/index.d.ts +2 -0
  182. package/dist/esm/types/chartType/raceDonut/index.js +1 -0
  183. package/dist/esm/types/chartType/raceDonut/raceDonut.d.ts +75 -0
  184. package/dist/esm/types/chartType/raceDonut/zRaceDonut.d.ts +387 -0
  185. package/dist/esm/types/chartType/raceDonut/zRaceDonut.js +23 -0
  186. package/dist/esm/types/chartType/raceDonut/zRaceDonut.js.map +1 -0
  187. package/dist/esm/types/chartType/raceLine/index.d.ts +2 -0
  188. package/dist/esm/types/chartType/raceLine/index.js +1 -0
  189. package/dist/esm/types/chartType/raceLine/raceLine.d.ts +122 -0
  190. package/dist/esm/types/chartType/raceLine/raceLine.js +0 -0
  191. package/dist/esm/types/chartType/raceLine/zRaceLine.d.ts +1904 -0
  192. package/dist/esm/types/chartType/raceLine/zRaceLine.js +35 -0
  193. package/dist/esm/types/chartType/raceLine/zRaceLine.js.map +1 -0
  194. package/dist/esm/types/chartType/racePie/index.d.ts +2 -0
  195. package/dist/esm/types/chartType/racePie/index.js +1 -0
  196. package/dist/esm/types/chartType/racePie/racePie.d.ts +75 -0
  197. package/dist/esm/types/chartType/racePie/racePie.js +0 -0
  198. package/dist/esm/types/chartType/racePie/zRacePie.d.ts +387 -0
  199. package/dist/esm/types/chartType/racePie/zRacePie.js +23 -0
  200. package/dist/esm/types/chartType/racePie/zRacePie.js.map +1 -0
  201. package/dist/esm/types/chartType/raceScatter/raceScatter.d.ts +84 -0
  202. package/dist/esm/types/chartType/raceScatter/zRaceScatter.d.ts +363 -10
  203. package/dist/esm/types/chartType/radar/zRadar.d.ts +2 -2
  204. package/dist/esm/types/chartType/rose/zRose.d.ts +2 -2
  205. package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +2 -2
  206. package/dist/esm/types/chartType/scatter/zScatter.d.ts +362 -10
  207. package/dist/esm/types/chartType/sunburst/sunburst.d.ts +1 -1
  208. package/dist/esm/types/chartType/sunburst/zSunburst.d.ts +2 -2
  209. package/dist/esm/types/chartType/table/zTable.d.ts +241 -4
  210. package/dist/esm/types/chartType/table/zTable.js +1 -1
  211. package/dist/esm/types/chartType/table/zTable.js.map +1 -1
  212. package/dist/esm/types/chartType/treeMap/zTreeMap.d.ts +2 -2
  213. package/dist/esm/types/dataSelector/selector.d.ts +594 -3
  214. package/dist/esm/types/dataSelector/selector.js +58 -2
  215. package/dist/esm/types/dataSelector/selector.js.map +1 -1
  216. package/dist/esm/types/properties/annotation/annotation.d.ts +200 -4
  217. package/dist/esm/types/properties/annotation/annotationHorizontalLine.d.ts +12 -0
  218. package/dist/esm/types/properties/annotation/annotationPoint.d.ts +19 -0
  219. package/dist/esm/types/properties/annotation/annotationVerticalLine.d.ts +12 -0
  220. package/dist/esm/types/properties/annotation/zAnnotationHorizontalLine.d.ts +10 -0
  221. package/dist/esm/types/properties/annotation/zAnnotationHorizontalLine.js +2 -0
  222. package/dist/esm/types/properties/annotation/zAnnotationHorizontalLine.js.map +1 -1
  223. package/dist/esm/types/properties/annotation/zAnnotationPoint.d.ts +80 -2
  224. package/dist/esm/types/properties/annotation/zAnnotationPoint.js +2 -1
  225. package/dist/esm/types/properties/annotation/zAnnotationPoint.js.map +1 -1
  226. package/dist/esm/types/properties/annotation/zAnnotationVerticalLine.d.ts +10 -0
  227. package/dist/esm/types/properties/annotation/zAnnotationVerticalLine.js +2 -0
  228. package/dist/esm/types/properties/annotation/zAnnotationVerticalLine.js.map +1 -1
  229. package/dist/esm/types/properties/cellStyle/bodyCellStyle.d.ts +105 -2
  230. package/dist/esm/types/properties/cellStyle/bodyCellStyle.js +2 -1
  231. package/dist/esm/types/properties/cellStyle/bodyCellStyle.js.map +1 -1
  232. package/dist/esm/types/properties/cellStyle/cellStyle.d.ts +83 -2
  233. package/dist/esm/types/properties/chartType/chartType.d.ts +4 -1
  234. package/dist/esm/types/properties/chartType/chartType.js +3 -0
  235. package/dist/esm/types/properties/chartType/chartType.js.map +1 -1
  236. package/dist/esm/types/properties/config/annotation/zAnnotation.d.ts +156 -0
  237. package/dist/esm/types/properties/config/area.d.ts +160 -4
  238. package/dist/esm/types/properties/config/bar.d.ts +240 -6
  239. package/dist/esm/types/properties/config/boxplot.d.ts +80 -2
  240. package/dist/esm/types/properties/config/circlePacking.d.ts +2 -2
  241. package/dist/esm/types/properties/config/column.d.ts +240 -6
  242. package/dist/esm/types/properties/config/config.d.ts +3576 -96
  243. package/dist/esm/types/properties/config/config.js +4 -1
  244. package/dist/esm/types/properties/config/config.js.map +1 -1
  245. package/dist/esm/types/properties/config/dualAxis.d.ts +80 -2
  246. package/dist/esm/types/properties/config/funnel.d.ts +2 -2
  247. package/dist/esm/types/properties/config/heatmap.d.ts +2 -2
  248. package/dist/esm/types/properties/config/histogram.d.ts +80 -2
  249. package/dist/esm/types/properties/config/label/zLabel.d.ts +2 -2
  250. package/dist/esm/types/properties/config/label/zPieLabel.d.ts +2 -2
  251. package/dist/esm/types/properties/config/line.d.ts +80 -2
  252. package/dist/esm/types/properties/config/pie.d.ts +6 -6
  253. package/dist/esm/types/properties/config/player/player.d.ts +2 -2
  254. package/dist/esm/types/properties/config/player/zPlayer.d.ts +1 -0
  255. package/dist/esm/types/properties/config/player/zPlayer.js +1 -0
  256. package/dist/esm/types/properties/config/player/zPlayer.js.map +1 -1
  257. package/dist/esm/types/properties/config/race.d.ts +2519 -50
  258. package/dist/esm/types/properties/config/race.js +10 -3
  259. package/dist/esm/types/properties/config/race.js.map +1 -1
  260. package/dist/esm/types/properties/config/rose.d.ts +4 -4
  261. package/dist/esm/types/properties/config/scatter.d.ts +80 -2
  262. package/dist/esm/types/properties/config/sunburst.d.ts +2 -2
  263. package/dist/esm/types/properties/config/treeMap.d.ts +2 -2
  264. package/dist/esm/types/properties/dimensions/index.d.ts +3 -0
  265. package/dist/esm/types/properties/dimensions/raceDonutDimension.d.ts +14 -0
  266. package/dist/esm/types/properties/dimensions/raceDonutDimension.js +0 -0
  267. package/dist/esm/types/properties/dimensions/raceLineDimension.d.ts +15 -0
  268. package/dist/esm/types/properties/dimensions/raceLineDimension.js +0 -0
  269. package/dist/esm/types/properties/dimensions/racePieDimension.d.ts +14 -0
  270. package/dist/esm/types/properties/dimensions/racePieDimension.js +0 -0
  271. package/dist/esm/types/properties/markStyle/areaStyle.d.ts +19 -0
  272. package/dist/esm/types/properties/markStyle/barStyle.d.ts +99 -2
  273. package/dist/esm/types/properties/markStyle/barStyle.js +2 -1
  274. package/dist/esm/types/properties/markStyle/barStyle.js.map +1 -1
  275. package/dist/esm/types/properties/markStyle/boxPlotStyle.d.ts +2 -2
  276. package/dist/esm/types/properties/markStyle/lineStyle.d.ts +99 -2
  277. package/dist/esm/types/properties/markStyle/lineStyle.js +2 -1
  278. package/dist/esm/types/properties/markStyle/lineStyle.js.map +1 -1
  279. package/dist/esm/types/properties/markStyle/markStyle.d.ts +648 -24
  280. package/dist/esm/types/properties/markStyle/outlierStyle.d.ts +2 -2
  281. package/dist/esm/types/properties/markStyle/pointStyle.d.ts +99 -2
  282. package/dist/esm/types/properties/markStyle/pointStyle.js +2 -1
  283. package/dist/esm/types/properties/markStyle/pointStyle.js.map +1 -1
  284. package/dist/esm/types/properties/markStyle/zAreaStyle.d.ts +80 -2
  285. package/dist/esm/types/properties/markStyle/zAreaStyle.js +2 -1
  286. package/dist/esm/types/properties/markStyle/zAreaStyle.js.map +1 -1
  287. package/dist/esm/types/properties/measures/hierarchyMeasure.d.ts +10 -0
  288. package/dist/esm/types/properties/measures/hierarchyMeasure.js +0 -0
  289. package/dist/esm/types/properties/measures/index.d.ts +4 -1
  290. package/dist/esm/types/properties/measures/raceDonutMeasure.d.ts +2 -0
  291. package/dist/esm/types/properties/measures/raceDonutMeasure.js +0 -0
  292. package/dist/esm/types/properties/measures/raceLineMeasure.d.ts +2 -0
  293. package/dist/esm/types/properties/measures/raceLineMeasure.js +0 -0
  294. package/dist/esm/types/properties/measures/racePieMeasure.d.ts +2 -0
  295. package/dist/esm/types/properties/measures/racePieMeasure.js +0 -0
  296. package/dist/esm/types/properties/theme/customTheme.d.ts +9495 -2535
  297. package/dist/esm/types/sandbox.d.ts +19 -0
  298. package/dist/esm/types/sandbox.js +0 -0
  299. package/dist/esm/types/vseed.d.ts +2 -2
  300. package/dist/esm/types/zVseed.d.ts +4 -25058
  301. package/dist/esm/types/zVseed.js +7 -4
  302. package/dist/esm/types/zVseed.js.map +1 -1
  303. package/dist/umd/index.js +4310 -1922
  304. package/dist/umd/index.js.map +1 -1
  305. package/package.json +1 -1
  306. package/dist/esm/pipeline/spec/chart/pipes/player/playerXY.js.map +0 -1
  307. package/dist/esm/pipeline/spec/chart/pipes/player/playerYX.js.map +0 -1
  308. package/dist/esm/pipeline/spec/chart/pipes/player/playerYY.js.map +0 -1
  309. package/dist/esm/types/properties/measures/hierarchyMeasures.d.ts +0 -4
  310. /package/dist/esm/types/{properties/measures/hierarchyMeasures.js → chartType/raceDonut/raceDonut.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipeline/raceScatter.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipeline/raceScatter.ts"],"sourcesContent":["import type { VChartSpecPipeline } from 'src/types'\nimport {\n initScatter,\n colorAdapter,\n color,\n linearColor,\n backgroundColor,\n progressive,\n brush,\n discreteLegend,\n colorLegend,\n verticalCrosshairLine,\n colorPointStyleFill,\n pointStyle,\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n playerYY,\n xLinear,\n yLinear,\n scatterSize,\n labelScatter,\n tooltipScatter,\n horizontalCrosshairLine,\n pointStateHover,\n annotationArea,\n linearRegressionLine,\n lowessRegressionLine,\n polynomialRegressionLine,\n logisticRegressionLine,\n} from '../pipes'\nconst raceScatter: VChartSpecPipeline = [\n initScatter,\n colorAdapter(color, linearColor),\n backgroundColor,\n playerYY,\n progressive,\n xLinear,\n yLinear,\n brush,\n scatterSize,\n labelScatter,\n tooltipScatter,\n colorAdapter(discreteLegend, colorLegend),\n verticalCrosshairLine,\n horizontalCrosshairLine,\n colorPointStyleFill(pointStyle),\n pointStateHover,\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n annotationArea,\n linearRegressionLine,\n lowessRegressionLine,\n polynomialRegressionLine,\n logisticRegressionLine,\n]\n\nexport const raceScatterSpecPipeline = raceScatter\n"],"names":["raceScatter","initScatter","colorAdapter","color","linearColor","backgroundColor","playerYY","progressive","xLinear","yLinear","brush","scatterSize","labelScatter","tooltipScatter","discreteLegend","colorLegend","verticalCrosshairLine","horizontalCrosshairLine","colorPointStyleFill","pointStyle","pointStateHover","annotationPoint","annotationVerticalLine","annotationHorizontalLine","annotationArea","linearRegressionLine","lowessRegressionLine","polynomialRegressionLine","logisticRegressionLine","raceScatterSpecPipeline"],"mappings":";AA+BA,MAAMA,cAAkC;IACtCC;IACAC,aAAaC,OAAOC;IACpBC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAX,aAAaY,gBAAgBC;IAC7BC;IACAC;IACAC,oBAAoBC;IACpBC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;CACD;AAEM,MAAMC,0BAA0B7B"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipeline/raceScatter.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipeline/raceScatter.ts"],"sourcesContent":["import type { VChartSpecPipeline } from 'src/types'\nimport {\n initScatter,\n colorAdapter,\n color,\n linearColor,\n backgroundColor,\n progressive,\n brush,\n discreteLegend,\n colorLegend,\n verticalCrosshairLine,\n colorPointStyleFill,\n pointStyle,\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n playerScatter,\n xLinear,\n yLinear,\n scatterSize,\n labelScatter,\n tooltipScatter,\n horizontalCrosshairLine,\n pointStateHover,\n annotationArea,\n linearRegressionLine,\n lowessRegressionLine,\n polynomialRegressionLine,\n logisticRegressionLine,\n datasetScatter,\n isPlayer,\n} from '../pipes'\nconst raceScatter: VChartSpecPipeline = [\n initScatter,\n colorAdapter(color, linearColor),\n backgroundColor,\n isPlayer(playerScatter, datasetScatter),\n progressive,\n xLinear,\n yLinear,\n brush,\n scatterSize,\n labelScatter,\n tooltipScatter,\n colorAdapter(discreteLegend, colorLegend),\n verticalCrosshairLine,\n horizontalCrosshairLine,\n colorPointStyleFill(pointStyle),\n pointStateHover,\n annotationPoint,\n annotationVerticalLine,\n annotationHorizontalLine,\n annotationArea,\n linearRegressionLine,\n lowessRegressionLine,\n polynomialRegressionLine,\n logisticRegressionLine,\n]\n\nexport const raceScatterSpecPipeline = raceScatter\n"],"names":["raceScatter","initScatter","colorAdapter","color","linearColor","backgroundColor","isPlayer","playerScatter","datasetScatter","progressive","xLinear","yLinear","brush","scatterSize","labelScatter","tooltipScatter","discreteLegend","colorLegend","verticalCrosshairLine","horizontalCrosshairLine","colorPointStyleFill","pointStyle","pointStateHover","annotationPoint","annotationVerticalLine","annotationHorizontalLine","annotationArea","linearRegressionLine","lowessRegressionLine","polynomialRegressionLine","logisticRegressionLine","raceScatterSpecPipeline"],"mappings":";AAiCA,MAAMA,cAAkC;IACtCC;IACAC,aAAaC,OAAOC;IACpBC;IACAC,SAASC,eAAeC;IACxBC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAb,aAAac,gBAAgBC;IAC7BC;IACAC;IACAC,oBAAoBC;IACpBC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;CACD;AAEM,MAAMC,0BAA0B/B"}
@@ -1,5 +1,6 @@
1
1
  import { isArray, isNumber, isString } from "remeda";
2
2
  import { ANNOTATION_Z_INDEX } from "../../../../utils/constant.js";
3
+ import { resolveAnnotationValue } from "./utils.js";
3
4
  const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
4
5
  const { advancedVSeed, vseed } = context;
5
6
  const { annotation, config } = advancedVSeed;
@@ -18,7 +19,7 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
18
19
  insideEnd: 'insideEndTop'
19
20
  };
20
21
  const markLine = annotationHorizontalLineList.flatMap((annotationHorizontalLine)=>{
21
- const { yValue, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'right', textBaseline = 'bottom', lineColor = theme?.lineColor ?? '#212121', lineStyle = theme?.lineStyle ?? 'dashed', lineVisible = theme?.lineStyle ?? true, lineWidth = theme?.lineWidth ?? 1, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121', textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundPadding = theme?.textBackgroundPadding ?? 2 } = annotationHorizontalLine;
22
+ const { yValue, dynamicFilter, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'right', textBaseline = 'bottom', lineColor = theme?.lineColor ?? '#212121', lineStyle = theme?.lineStyle ?? 'dashed', lineVisible = theme?.lineStyle ?? true, lineWidth = theme?.lineWidth ?? 1, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121', textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundPadding = theme?.textBackgroundPadding ?? 2 } = annotationHorizontalLine;
22
23
  const generateOneMarkLine = (y)=>({
23
24
  y,
24
25
  autoRange: true,
@@ -88,9 +89,14 @@ const annotationHorizontalLine_annotationHorizontalLine = (spec, context)=>{
88
89
  }
89
90
  }
90
91
  });
91
- if (isArray(yValue) || isString(yValue) || isNumber(yValue)) {
92
- const yValueArr = Array.isArray(yValue) ? yValue : [
93
- yValue
92
+ const finalYValue = resolveAnnotationValue({
93
+ dynamicFilter,
94
+ fallback: dynamicFilter?.fallback,
95
+ defaultValue: yValue
96
+ });
97
+ if (isArray(finalYValue) || isString(finalYValue) || isNumber(finalYValue)) {
98
+ const yValueArr = Array.isArray(finalYValue) ? finalYValue : [
99
+ finalYValue
94
100
  ];
95
101
  return yValueArr.map(generateOneMarkLine);
96
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.ts"],"sourcesContent":["import type { ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\nimport { isArray, isNumber, isString } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\n\nexport const annotationHorizontalLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationHorizontalLine) {\n return spec\n }\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationHorizontalLine\n const { annotationHorizontalLine } = annotation\n const annotationHorizontalLineList = Array.isArray(annotationHorizontalLine)\n ? annotationHorizontalLine\n : [annotationHorizontalLine]\n\n const positionMap = {\n outsideStart: 'start',\n outsideEnd: 'end',\n outsideMiddle: 'middle',\n insideStart: 'insideStartTop',\n insideMiddle: 'insideMiddleTop',\n insideEnd: 'insideEndTop',\n }\n\n const markLine = annotationHorizontalLineList.flatMap((annotationHorizontalLine) => {\n const {\n yValue,\n text = '',\n textPosition = 'insideEnd',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'right',\n textBaseline = 'bottom',\n\n lineColor = theme?.lineColor ?? '#212121',\n lineStyle = theme?.lineStyle ?? 'dashed',\n lineVisible = theme?.lineStyle ?? true,\n lineWidth = theme?.lineWidth ?? 1,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121',\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n } = annotationHorizontalLine\n\n const generateOneMarkLine = (y: string | number) => {\n return {\n y,\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n line: {\n style: {\n visible: lineVisible,\n stroke: lineColor,\n lineWidth: lineWidth,\n lineDash: lineStyle === 'dashed' ? [5, 2] : lineStyle === 'dotted' ? [2, 5] : [0],\n },\n },\n label: {\n confine: true,\n text: text,\n position: (positionMap as any)[textPosition || 'insideEnd'],\n style: {\n opacity: 0.95,\n visible: true,\n dy: 4,\n stroke: textBackgroundColor,\n lineWidth: 1,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n dy: 4,\n cornerRadius: textBackgroundBorderRadius,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n fillOpacity: 1,\n },\n },\n },\n startSymbol: {\n visible: theme?.startSymbolVisible ?? true,\n symbolType: theme?.startSymbolType ?? 'triangleDown',\n size: 5 + (lineWidth || 1),\n style: {\n dx: 3,\n fill: lineColor,\n },\n },\n endSymbol: {\n visible: theme?.endSymbolVisible ?? false,\n symbolType: theme?.endSymbolType ?? 'arrow',\n size: 10 + (lineWidth || 1),\n style: {\n dx: -4,\n fill: lineColor,\n },\n },\n }\n }\n if (isArray(yValue) || isString(yValue) || isNumber(yValue)) {\n const yValueArr = Array.isArray(yValue) ? yValue : [yValue]\n return yValueArr.map(generateOneMarkLine)\n }\n\n return []\n }) as IMarkLineSpec[]\n const specMarkLine = ((spec as ILineChartSpec).markLine as IMarkLineSpec[]) || []\n const newMarkLine = [...specMarkLine, ...(markLine || [])]\n return {\n ...spec,\n markLine: newMarkLine,\n }\n}\n"],"names":["annotationHorizontalLine","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationHorizontalLineList","Array","positionMap","markLine","yValue","text","textPosition","textColor","textFontSize","textFontWeight","textAlign","textBaseline","lineColor","lineStyle","lineVisible","lineWidth","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundPadding","generateOneMarkLine","y","ANNOTATION_Z_INDEX","isArray","isString","isNumber","yValueArr","specMarkLine","newMarkLine"],"mappings":";;AAKO,MAAMA,oDAA2C,CAACC,MAAMC;IAC7D,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,CAACE,cAAc,CAACA,WAAW,wBAAwB,EACrD,OAAOJ;IAET,MAAMM,QAAQD,QAAQ,CAACF,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEJ,wBAAwB,EAAE,GAAGK;IACrC,MAAMG,+BAA+BC,MAAM,OAAO,CAACT,4BAC/CA,2BACA;QAACA;KAAyB;IAE9B,MAAMU,cAAc;QAClB,cAAc;QACd,YAAY;QACZ,eAAe;QACf,aAAa;QACb,cAAc;QACd,WAAW;IACb;IAEA,MAAMC,WAAWH,6BAA6B,OAAO,CAAC,CAACR;QACrD,MAAM,EACJY,MAAM,EACNC,OAAO,EAAE,EACTC,eAAe,WAAW,EAC1BC,YAAYR,OAAO,aAAa,SAAS,EACzCS,eAAeT,OAAO,gBAAgB,EAAE,EACxCU,iBAAiBV,OAAO,kBAAkB,GAAG,EAC7CW,YAAY,OAAO,EACnBC,eAAe,QAAQ,EAEvBC,YAAYb,OAAO,aAAa,SAAS,EACzCc,YAAYd,OAAO,aAAa,QAAQ,EACxCe,cAAcf,OAAO,aAAa,IAAI,EACtCgB,YAAYhB,OAAO,aAAa,CAAC,EAEjCiB,wBAAwBjB,OAAO,yBAAyB,IAAI,EAC5DkB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SAAS;YAC3D,MAAMwB,YAAY3B,MAAM,OAAO,CAACG,UAAUA,SAAS;gBAACA;aAAO;YAC3D,OAAOwB,UAAU,GAAG,CAACN;QACvB;QAEA,OAAO,EAAE;IACX;IACA,MAAMO,eAAiBpC,KAAwB,QAAQ,IAAwB,EAAE;IACjF,MAAMqC,cAAc;WAAID;WAAkB1B,YAAY,EAAE;KAAE;IAC1D,OAAO;QACL,GAAGV,IAAI;QACP,UAAUqC;IACZ;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.ts"],"sourcesContent":["import type { ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\nimport { isArray, isNumber, isString } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { resolveAnnotationValue } from './utils'\n\nexport const annotationHorizontalLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationHorizontalLine) {\n return spec\n }\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationHorizontalLine\n const { annotationHorizontalLine } = annotation\n const annotationHorizontalLineList = Array.isArray(annotationHorizontalLine)\n ? annotationHorizontalLine\n : [annotationHorizontalLine]\n\n const positionMap = {\n outsideStart: 'start',\n outsideEnd: 'end',\n outsideMiddle: 'middle',\n insideStart: 'insideStartTop',\n insideMiddle: 'insideMiddleTop',\n insideEnd: 'insideEndTop',\n }\n\n const markLine = annotationHorizontalLineList.flatMap((annotationHorizontalLine) => {\n const {\n yValue,\n dynamicFilter,\n text = '',\n textPosition = 'insideEnd',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'right',\n textBaseline = 'bottom',\n\n lineColor = theme?.lineColor ?? '#212121',\n lineStyle = theme?.lineStyle ?? 'dashed',\n lineVisible = theme?.lineStyle ?? true,\n lineWidth = theme?.lineWidth ?? 1,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121',\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n } = annotationHorizontalLine\n\n const generateOneMarkLine = (y: string | number) => {\n return {\n y,\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n line: {\n style: {\n visible: lineVisible,\n stroke: lineColor,\n lineWidth: lineWidth,\n lineDash: lineStyle === 'dashed' ? [5, 2] : lineStyle === 'dotted' ? [2, 5] : [0],\n },\n },\n label: {\n confine: true,\n text: text,\n position: (positionMap as any)[textPosition || 'insideEnd'],\n style: {\n opacity: 0.95,\n visible: true,\n dy: 4,\n stroke: textBackgroundColor,\n lineWidth: 1,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n dy: 4,\n cornerRadius: textBackgroundBorderRadius,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n fillOpacity: 1,\n },\n },\n },\n startSymbol: {\n visible: theme?.startSymbolVisible ?? true,\n symbolType: theme?.startSymbolType ?? 'triangleDown',\n size: 5 + (lineWidth || 1),\n style: {\n dx: 3,\n fill: lineColor,\n },\n },\n endSymbol: {\n visible: theme?.endSymbolVisible ?? false,\n symbolType: theme?.endSymbolType ?? 'arrow',\n size: 10 + (lineWidth || 1),\n style: {\n dx: -4,\n fill: lineColor,\n },\n },\n }\n }\n\n const finalYValue = resolveAnnotationValue({\n dynamicFilter,\n fallback: dynamicFilter?.fallback as string | number | undefined,\n defaultValue: yValue,\n })\n\n if (isArray(finalYValue) || isString(finalYValue) || isNumber(finalYValue)) {\n const yValueArr = Array.isArray(finalYValue) ? finalYValue : [finalYValue]\n return yValueArr.map(generateOneMarkLine)\n }\n\n return []\n }) as IMarkLineSpec[]\n const specMarkLine = ((spec as ILineChartSpec).markLine as IMarkLineSpec[]) || []\n const newMarkLine = [...specMarkLine, ...(markLine || [])]\n return {\n ...spec,\n markLine: newMarkLine,\n }\n}\n"],"names":["annotationHorizontalLine","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationHorizontalLineList","Array","positionMap","markLine","yValue","dynamicFilter","text","textPosition","textColor","textFontSize","textFontWeight","textAlign","textBaseline","lineColor","lineStyle","lineVisible","lineWidth","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundPadding","generateOneMarkLine","y","ANNOTATION_Z_INDEX","finalYValue","resolveAnnotationValue","isArray","isString","isNumber","yValueArr","specMarkLine","newMarkLine"],"mappings":";;;AAMO,MAAMA,oDAA2C,CAACC,MAAMC;IAC7D,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,CAACE,cAAc,CAACA,WAAW,wBAAwB,EACrD,OAAOJ;IAET,MAAMM,QAAQD,QAAQ,CAACF,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEJ,wBAAwB,EAAE,GAAGK;IACrC,MAAMG,+BAA+BC,MAAM,OAAO,CAACT,4BAC/CA,2BACA;QAACA;KAAyB;IAE9B,MAAMU,cAAc;QAClB,cAAc;QACd,YAAY;QACZ,eAAe;QACf,aAAa;QACb,cAAc;QACd,WAAW;IACb;IAEA,MAAMC,WAAWH,6BAA6B,OAAO,CAAC,CAACR;QACrD,MAAM,EACJY,MAAM,EACNC,aA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gBACF;gBACA,aAAa;oBACX,SAAStB,OAAO,sBAAsB;oBACtC,YAAYA,OAAO,mBAAmB;oBACtC,MAAM,IAAKiB,CAAAA,aAAa;oBACxB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;gBACA,WAAW;oBACT,SAASd,OAAO,oBAAoB;oBACpC,YAAYA,OAAO,iBAAiB;oBACpC,MAAM,KAAMiB,CAAAA,aAAa;oBACzB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;YACF;QAGF,MAAMa,cAAcC,uBAAuB;YACzCtB;YACA,UAAUA,eAAe;YACzB,cAAcD;QAChB;QAEA,IAAIwB,QAAQF,gBAAgBG,SAASH,gBAAgBI,SAASJ,cAAc;YAC1E,MAAMK,YAAY9B,MAAM,OAAO,CAACyB,eAAeA,cAAc;gBAACA;aAAY;YAC1E,OAAOK,UAAU,GAAG,CAACR;QACvB;QAEA,OAAO,EAAE;IACX;IACA,MAAMS,eAAiBvC,KAAwB,QAAQ,IAAwB,EAAE;IACjF,MAAMwC,cAAc;WAAID;WAAkB7B,YAAY,EAAE;KAAE;IAC1D,OAAO;QACL,GAAGV,IAAI;QACP,UAAUwC;IACZ;AACF"}
@@ -1,6 +1,12 @@
1
1
  import type { ISpec, IMarkPointSpec } from '@visactor/vchart';
2
- import type { Datum, Selector, Selectors, SpecPipelineContext, VChartSpecPipe } from '../../../../../types';
2
+ import type { ChartDynamicFilter, Datum, Selector, Selectors, SpecPipelineContext, VChartSpecPipe } from '../../../../../types';
3
3
  export declare const generateAnnotationPointPipe: (options: {
4
- findSelectedDatas?: (dataset: Datum[], selector: Selector | Selectors | undefined | null, spec: ISpec, context: SpecPipelineContext) => Datum[];
4
+ findSelectedDatas?: (options: {
5
+ dataset: Datum[];
6
+ selector: Selector | Selectors | undefined | null;
7
+ dynamicFilter?: ChartDynamicFilter;
8
+ spec: ISpec;
9
+ context: SpecPipelineContext;
10
+ }) => Datum[];
5
11
  generateMarkPoint?: (datum: Datum, spec: ISpec, context: SpecPipelineContext) => IMarkPointSpec[] | undefined;
6
12
  }) => VChartSpecPipe;
@@ -1,9 +1,12 @@
1
- import { selector } from "../../../../../dataSelector/index.js";
1
+ import { selector, selectorWithDynamicFilter } from "../../../../../dataSelector/index.js";
2
2
  import { isSubset } from "./utils.js";
3
3
  import { ANNOTATION_Z_INDEX } from "../../../../utils/constant.js";
4
4
  import { isBarLikeChart } from "../../../../utils/chatType.js";
5
5
  const generateAnnotationPointPipe = (options)=>{
6
- const findSelectedDatas = options.findSelectedDatas ?? ((dataset, s)=>dataset.filter((datum)=>selector(datum, s)));
6
+ const findSelectedDatas = options.findSelectedDatas ?? ((opts)=>{
7
+ const { dataset, selector: s, dynamicFilter } = opts;
8
+ return dataset.filter((datum)=>dynamicFilter ? selectorWithDynamicFilter(datum, dynamicFilter, s) : selector(datum, s));
9
+ });
7
10
  const generateMarkPoint = options.generateMarkPoint ?? ((datum)=>[
8
11
  {
9
12
  coordinate: (data, context)=>{
@@ -40,9 +43,15 @@ const generateAnnotationPointPipe = (options)=>{
40
43
  textBaseline: 'top'
41
44
  };
42
45
  const markPoint = annotationPointList.flatMap((annotationPoint)=>{
43
- const { selector: selectorPoint, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor = theme?.textBackgroundBorderColor, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundPadding = theme?.textBackgroundPadding ?? 2, textBackgroundVisible = theme?.textBackgroundVisible ?? true, offsetX = theme?.offsetX ?? 0, offsetY = theme?.offsetY ?? 0 } = annotationPoint;
46
+ const { selector: selectorPoint, dynamicFilter, text = '', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor = theme?.textBackgroundBorderColor, textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundPadding = theme?.textBackgroundPadding ?? 2, textBackgroundVisible = theme?.textBackgroundVisible ?? true, offsetX = theme?.offsetX ?? 0, offsetY = theme?.offsetY ?? 0 } = annotationPoint;
44
47
  const dataset = advancedVSeed.dataset.flat();
45
- const selectedData = selectorPoint ? findSelectedDatas(dataset, selectorPoint, spec, context) : [];
48
+ const selectedData = selectorPoint || dynamicFilter ? findSelectedDatas({
49
+ dataset,
50
+ selector: selectorPoint,
51
+ dynamicFilter,
52
+ spec,
53
+ context
54
+ }) : [];
46
55
  const dx = -10 - (isHorizontalBar ? textFontSize : 0);
47
56
  const dy = isHorizontalBar ? 0 : textFontSize;
48
57
  const markPointStyle = {
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPointCommon.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationPointCommon.ts"],"sourcesContent":["import type { ISpec, IMarkPointSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, Selector, Selectors, SpecPipelineContext, VChartSpecPipe, VSeed } from 'src/types'\nimport { isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { isBarLikeChart } from 'src/pipeline/utils/chatType'\nexport const generateAnnotationPointPipe = (options: {\n findSelectedDatas?: (\n dataset: Datum[],\n selector: Selector | Selectors | undefined | null,\n spec: ISpec,\n context: SpecPipelineContext,\n ) => Datum[]\n generateMarkPoint?: (datum: Datum, spec: ISpec, context: SpecPipelineContext) => IMarkPointSpec[] | undefined\n}) => {\n const findSelectedDatas = options.findSelectedDatas ?? ((dataset, s) => dataset.filter((datum) => selector(datum, s)))\n const generateMarkPoint =\n options.generateMarkPoint ??\n ((datum: Datum) => {\n return [\n {\n coordinate: (data: Datum[], context) => {\n const targetDatum = data.find((item) => isSubset(datum, item))\n if (context.getStack() === true) {\n const stackedDatum = { ...datum, ...targetDatum }\n return {\n ...stackedDatum,\n [context.getStackValueField()]: stackedDatum['__VCHART_STACK_END'],\n }\n }\n\n return targetDatum\n },\n },\n ]\n })\n\n return ((spec: ISpec, context: SpecPipelineContext) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationPoint) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationPoint\n const { annotationPoint } = annotation\n const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [annotationPoint]\n const isHorizontalBar = isBarLikeChart(advancedVSeed as VSeed)\n const defaultStyle = isHorizontalBar\n ? {\n textAlign: 'right',\n textBaseline: 'middle',\n }\n : {\n textAlign: 'center',\n textBaseline: 'top',\n }\n\n const markPoint = annotationPointList.flatMap((annotationPoint) => {\n const {\n selector: selectorPoint,\n text = '',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = defaultStyle.textAlign,\n textBaseline = defaultStyle.textBaseline,\n textBackgroundBorderColor = theme?.textBackgroundBorderColor,\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n offsetX = theme?.offsetX ?? 0,\n offsetY = theme?.offsetY ?? 0,\n } = annotationPoint\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData = selectorPoint ? findSelectedDatas(dataset, selectorPoint, spec, context) : []\n const dx = -10 - (isHorizontalBar ? (textFontSize as number) : 0) // 由于vchart tag实现问题,需要设置这个强制偏移量\n const dy = isHorizontalBar ? 0 : (textFontSize as number)\n const markPointStyle = {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n itemLine: {\n visible: false,\n },\n itemContent: {\n offsetY,\n offsetX,\n confine: true,\n text: {\n text: text,\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n cornerRadius: textBackgroundBorderRadius ?? 4,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n dx,\n dy,\n },\n },\n },\n style: {\n opacity: 0.95,\n visible: true,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n dx,\n dy,\n },\n },\n } as Partial<IMarkPointSpec>\n\n return selectedData.reduce((res: IMarkPointSpec[], datum) => {\n const marks = generateMarkPoint(datum, spec, context)\n\n if (marks && marks.length) {\n marks.forEach((mark) => {\n res.push({\n ...markPointStyle,\n ...mark,\n } as IMarkPointSpec)\n })\n }\n\n return res\n }, [])\n }) as unknown as IMarkPointSpec[]\n\n return {\n ...spec,\n markPoint,\n } as ISpec\n }) as VChartSpecPipe\n}\n"],"names":["generateAnnotationPointPipe","options","findSelectedDatas","dataset","s","datum","selector","generateMarkPoint","data","context","targetDatum","item","isSubset","stackedDatum","spec","advancedVSeed","vseed","annotation","config","theme","annotationPoint","annotationPointList","Array","isHorizontalBar","isBarLikeChart","defaultStyle","markPoint","selectorPoint","text","textColor","textFontSize","textFontWeight","textAlign","textBaseline","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundColor","textBackgroundPadding","textBackgroundVisible","offsetX","offsetY","selectedData","dx","dy","markPointStyle","ANNOTATION_Z_INDEX","res","marks","mark"],"mappings":";;;;AAMO,MAAMA,8BAA8B,CAAC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wBACP,GAAGF,cAAc;wBACjB,GAAGI,IAAI;oBACT;gBACF;gBAGF,OAAOF;YACT,GAAG,EAAE;QACP;QAEA,OAAO;YACL,GAAGjC,IAAI;YACPY;QACF;IACF;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPointCommon.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationPointCommon.ts"],"sourcesContent":["import type { ISpec, IMarkPointSpec } from '@visactor/vchart'\nimport { selector, selectorWithDynamicFilter } from '../../../../../dataSelector'\nimport type {\n ChartDynamicFilter,\n Datum,\n Selector,\n Selectors,\n SpecPipelineContext,\n VChartSpecPipe,\n VSeed,\n} from 'src/types'\nimport { isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { isBarLikeChart } from 'src/pipeline/utils/chatType'\nexport const generateAnnotationPointPipe = (options: {\n findSelectedDatas?: (options: {\n dataset: Datum[]\n selector: Selector | Selectors | undefined | null\n dynamicFilter?: ChartDynamicFilter\n spec: ISpec\n context: SpecPipelineContext\n }) => Datum[]\n generateMarkPoint?: (datum: Datum, spec: ISpec, context: SpecPipelineContext) => IMarkPointSpec[] | undefined\n}) => {\n const findSelectedDatas =\n options.findSelectedDatas ??\n ((opts) => {\n const { dataset, selector: s, dynamicFilter } = opts\n return dataset.filter((datum) => {\n return dynamicFilter ? selectorWithDynamicFilter(datum, dynamicFilter, s) : selector(datum, s)\n })\n })\n const generateMarkPoint =\n options.generateMarkPoint ??\n ((datum: Datum) => {\n return [\n {\n coordinate: (data: Datum[], context) => {\n const targetDatum = data.find((item) => isSubset(datum, item))\n if (context.getStack() === true) {\n const stackedDatum = { ...datum, ...targetDatum }\n return {\n ...stackedDatum,\n [context.getStackValueField()]: stackedDatum['__VCHART_STACK_END'],\n }\n }\n\n return targetDatum\n },\n },\n ]\n })\n\n return ((spec: ISpec, context: SpecPipelineContext) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationPoint) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationPoint\n const { annotationPoint } = annotation\n const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [annotationPoint]\n const isHorizontalBar = isBarLikeChart(advancedVSeed as VSeed)\n const defaultStyle = isHorizontalBar\n ? {\n textAlign: 'right',\n textBaseline: 'middle',\n }\n : {\n textAlign: 'center',\n textBaseline: 'top',\n }\n\n const markPoint = annotationPointList.flatMap((annotationPoint) => {\n const {\n selector: selectorPoint,\n dynamicFilter,\n text = '',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = defaultStyle.textAlign,\n textBaseline = defaultStyle.textBaseline,\n textBackgroundBorderColor = theme?.textBackgroundBorderColor,\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n offsetX = theme?.offsetX ?? 0,\n offsetY = theme?.offsetY ?? 0,\n } = annotationPoint\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData =\n selectorPoint || dynamicFilter\n ? findSelectedDatas({\n dataset,\n selector: selectorPoint,\n dynamicFilter,\n spec,\n context,\n })\n : []\n const dx = -10 - (isHorizontalBar ? (textFontSize as number) : 0) // 由于vchart tag实现问题,需要设置这个强制偏移量\n const dy = isHorizontalBar ? 0 : (textFontSize as number)\n const markPointStyle = {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n itemLine: {\n visible: false,\n },\n itemContent: {\n offsetY,\n offsetX,\n confine: true,\n text: {\n text: text,\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n cornerRadius: textBackgroundBorderRadius ?? 4,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n dx,\n dy,\n },\n },\n },\n style: {\n opacity: 0.95,\n visible: true,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n dx,\n dy,\n },\n },\n } as Partial<IMarkPointSpec>\n\n return selectedData.reduce((res: IMarkPointSpec[], datum) => {\n const marks = generateMarkPoint(datum, spec, context)\n\n if (marks && marks.length) {\n marks.forEach((mark) => {\n res.push({\n ...markPointStyle,\n ...mark,\n } as IMarkPointSpec)\n })\n }\n\n return res\n }, [])\n }) as unknown as IMarkPointSpec[]\n\n return {\n ...spec,\n markPoint,\n } as ISpec\n }) as VChartSpecPipe\n}\n"],"names":["generateAnnotationPointPipe","options","findSelectedDatas","opts","dataset","s","dynamicFilter","datum","selectorWithDynamicFilter","selector","generateMarkPoint","data","context","targetDatum","item","isSubset","stackedDatum","spec","advancedVSeed","vseed","annotation","config","theme","annotationPoint","annotationPointList","Array","isHorizontalBar","isBarLikeChart","defaultStyle","markPoint","selectorPoint","text","textColor","textFontSize","textFontWeight","textAlign","textBaseline","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundColor","textBackgroundPadding","textBackgroundVisible","offsetX","offsetY","selectedData","dx","dy","markPointStyle","ANNOTATION_Z_INDEX","res","marks","mark"],"mappings":";;;;AAcO,MAAMA,8BAA8B,CAACC;IAU1C,MAAMC,oBACJD,QAAQ,iBAAiB,IACvB,EAAAE;QACA,MAAM,EAAEC,OAAO,EAAE,UAAUC,CAAC,EAAEC,aAAa,EAAE,GAAGH;QAChD,OAAOC,QAAQ,MAAM,CAAC,CAACG,QACdD,gBAAgBE,0BAA0BD,OAAOD,eAAeD,KAAKI,SAASF,OAAOF;IAEhG;IACF,MAAMK,oBACJT,QAAQ,iBAAiB,IACvB,E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AAI;YACPY;QACF;IACF;AACF"}
@@ -1,17 +1,21 @@
1
- import { selector } from "../../../../../dataSelector/index.js";
1
+ import { selector, selectorWithDynamicFilter } from "../../../../../dataSelector/index.js";
2
2
  import { isSubset } from "./utils.js";
3
3
  import { flatReshapeMeasures } from "../../../../utils/index.js";
4
4
  import { MeasureId } from "../../../../../dataReshape/constant.js";
5
5
  import { pickWithout } from "@visactor/vutils";
6
6
  import { generateAnnotationPointPipe } from "./annotationPointCommon.js";
7
7
  const annotationPointOfDualAxis = generateAnnotationPointPipe({
8
- findSelectedDatas: (dataset, s, spec, context)=>dataset.reduce((res, d)=>{
8
+ findSelectedDatas: (options)=>{
9
+ const { dataset, selector: s, dynamicFilter, context } = options;
10
+ return dataset.reduce((res, d)=>{
9
11
  const { advancedVSeed } = context;
10
12
  const allMeasureIds = flatReshapeMeasures(advancedVSeed.reshapeMeasures ?? []).map((m)=>m.id);
11
13
  const pickedDatum = pickWithout(d, allMeasureIds.filter((id)=>id !== d[MeasureId]));
12
- if (selector(pickedDatum, s)) res.push(pickedDatum);
14
+ const shouldSelect = dynamicFilter ? selectorWithDynamicFilter(pickedDatum, dynamicFilter, s) : selector(pickedDatum, s);
15
+ if (shouldSelect) res.push(pickedDatum);
13
16
  return res;
14
- }, []),
17
+ }, []);
18
+ },
15
19
  generateMarkPoint: (datum, spec, context)=>{
16
20
  const { advancedVSeed } = context;
17
21
  const allMeasureIds = flatReshapeMeasures(advancedVSeed.reshapeMeasures ?? []).map((m)=>m.id);
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.ts"],"sourcesContent":["import type { IMarkPointSpec, ISpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, SpecPipelineContext, VChartSpecPipe } from 'src/types'\nimport { isSubset } from './utils'\nimport { flatReshapeMeasures } from 'src/pipeline/utils'\nimport { MeasureId } from 'src/dataReshape/constant'\nimport { pickWithout } from '@visactor/vutils'\nimport { generateAnnotationPointPipe } from './annotationPointCommon'\n\nexport const annotationPointOfDualAxis: VChartSpecPipe = generateAnnotationPointPipe({\n findSelectedDatas: (dataset, s, spec: ISpec, context: SpecPipelineContext) => {\n return dataset.reduce((res: Datum[], d: Datum) => {\n const { advancedVSeed } = context\n const allMeasureIds = flatReshapeMeasures(advancedVSeed.reshapeMeasures ?? []).map((m) => m.id)\n const pickedDatum = pickWithout(\n d,\n allMeasureIds.filter((id) => id !== d[MeasureId]),\n )\n\n if (selector(pickedDatum, s)) {\n res.push(pickedDatum)\n }\n\n return res\n }, [])\n },\n generateMarkPoint: (datum: Datum, spec: ISpec, context: SpecPipelineContext) => {\n const { advancedVSeed } = context\n const allMeasureIds = flatReshapeMeasures(advancedVSeed.reshapeMeasures ?? []).map((m) => m.id)\n return spec.series?.map((s: any, index: number) => {\n return {\n relativeSeriesIndex: index,\n coordinate: (data: Datum[]) => {\n return data.find((item) => {\n return isSubset(\n datum,\n item,\n allMeasureIds.filter((id) => id !== item[MeasureId]),\n )\n })\n },\n } as IMarkPointSpec\n })\n },\n})\n"],"names":["annotationPointOfDualAxis","generateAnnotationPointPipe","dataset","s","spec","context","res","d","advancedVSeed","allMeasureIds","flatReshapeMeasures","m","pickedDatum","pickWithout","id","MeasureId","selector","datum","index","data","item","isSubset"],"mappings":";;;;;;AASO,MAAMA,4BAA4CC,4BAA4B;IACnF,mBAAmB,CAACC,SAASC,GAAGC,MAAaC,UACpCH,QAAQ,MAAM,CAAC,CAACI,KAAcC;YACnC,MAAM,EAAEC,aAAa,EAAE,GAAGH;YAC1B,MAAMI,gBAAgBC,oBAAoBF,cAAc,eAAe,IAAI,EAAE,EAAE,GAAG,CAAC,CAACG,IAAMA,EAAE,EAAE;YAC9F,MAAMC,cAAcC,YAClBN,GACAE,cAAc,MAAM,CAAC,CAACK,KAAOA,OAAOP,CAAC,CAACQ,UAAU;YAGlD,IAAIC,SAASJ,aAAaT,IACxBG,IAAI,IAAI,CAACM;YAGX,OAAON;QACT,GAAG,EAAE;IAEP,mBAAmB,CAACW,OAAcb,MAAaC;QAC7C,MAAM,EAAEG,aAAa,EAAE,GAAGH;QAC1B,MAAMI,gBAAgBC,oBAAoBF,cAAc,eAAe,IAAI,EAAE,EAAE,GAAG,CAAC,CAACG,IAAMA,EAAE,EAAE;QAC9F,OAAOP,KAAK,MAAM,EAAE,IAAI,CAACD,GAAQe,QACxB;gBACL,qBAAqBA;gBACrB,YAAY,CAACC,OACJA,KAAK,IAAI,CAAC,CAACC,OACTC,SACLJ,OACAG,MACAX,cAAc,MAAM,CAAC,CAACK,KAAOA,OAAOM,IAAI,CAACL,UAAU;YAI3D;IAEJ;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.ts"],"sourcesContent":["import type { IMarkPointSpec, ISpec } from '@visactor/vchart'\nimport { selector, selectorWithDynamicFilter } from '../../../../../dataSelector'\nimport type { Datum, SpecPipelineContext, VChartSpecPipe } from 'src/types'\nimport { isSubset } from './utils'\nimport { flatReshapeMeasures } from 'src/pipeline/utils'\nimport { MeasureId } from 'src/dataReshape/constant'\nimport { pickWithout } from '@visactor/vutils'\nimport { generateAnnotationPointPipe } from './annotationPointCommon'\n\nexport const annotationPointOfDualAxis: VChartSpecPipe = generateAnnotationPointPipe({\n findSelectedDatas: (options) => {\n const { dataset, selector: s, dynamicFilter, context } = options\n return dataset.reduce((res: Datum[], d: Datum) => {\n const { advancedVSeed } = context\n const allMeasureIds = flatReshapeMeasures(advancedVSeed.reshapeMeasures ?? []).map((m) => m.id)\n const pickedDatum = pickWithout(\n d,\n allMeasureIds.filter((id) => id !== d[MeasureId]),\n )\n\n const shouldSelect = dynamicFilter\n ? selectorWithDynamicFilter(pickedDatum, dynamicFilter, s)\n : selector(pickedDatum, s)\n\n if (shouldSelect) {\n res.push(pickedDatum)\n }\n\n return res\n }, [])\n },\n generateMarkPoint: (datum: Datum, spec: ISpec, context: SpecPipelineContext) => {\n const { advancedVSeed } = context\n const allMeasureIds = flatReshapeMeasures(advancedVSeed.reshapeMeasures ?? []).map((m) => m.id)\n return spec.series?.map((s: any, index: number) => {\n return {\n relativeSeriesIndex: index,\n coordinate: (data: Datum[]) => {\n return data.find((item) => {\n return isSubset(\n datum,\n item,\n allMeasureIds.filter((id) => id !== item[MeasureId]),\n )\n })\n },\n } as IMarkPointSpec\n })\n },\n})\n"],"names":["annotationPointOfDualAxis","generateAnnotationPointPipe","options","dataset","s","dynamicFilter","context","res","d","advancedVSeed","allMeasureIds","flatReshapeMeasures","m","pickedDatum","pickWithout","id","MeasureId","shouldSelect","selectorWithDynamicFilter","selector","datum","spec","index","data","item","isSubset"],"mappings":";;;;;;AASO,MAAMA,4BAA4CC,4BAA4B;IACnF,mBAAmB,CAACC;QAClB,MAAM,EAAEC,OAAO,EAAE,UAAUC,CAAC,EAAEC,aAAa,EAAEC,OAAO,EAAE,GAAGJ;QACzD,OAAOC,QAAQ,MAAM,CAAC,CAACI,KAAcC;YACnC,MAAM,EAAEC,aAAa,EAAE,GAAGH;YAC1B,MAAMI,gBAAgBC,oBAAoBF,cAAc,eAAe,IAAI,EAAE,EAAE,GAAG,CAAC,CAACG,IAAMA,EAAE,EAAE;YAC9F,MAAMC,cAAcC,YAClBN,GACAE,cAAc,MAAM,CAAC,CAACK,KAAOA,OAAOP,CAAC,CAACQ,UAAU;YAGlD,MAAMC,eAAeZ,gBACjBa,0BAA0BL,aAAaR,eAAeD,KACtDe,SAASN,aAAaT;YAE1B,IAAIa,cACFV,IAAI,IAAI,CAACM;YAGX,OAAON;QACT,GAAG,EAAE;IACP;IACA,mBAAmB,CAACa,OAAcC,MAAaf;QAC7C,MAAM,EAAEG,aAAa,EAAE,GAAGH;QAC1B,MAAMI,gBAAgBC,oBAAoBF,cAAc,eAAe,IAAI,EAAE,EAAE,GAAG,CAAC,CAACG,IAAMA,EAAE,EAAE;QAC9F,OAAOS,KAAK,MAAM,EAAE,IAAI,CAACjB,GAAQkB,QACxB;gBACL,qBAAqBA;gBACrB,YAAY,CAACC,OACJA,KAAK,IAAI,CAAC,CAACC,OACTC,SACLL,OACAI,MACAd,cAAc,MAAM,CAAC,CAACK,KAAOA,OAAOS,IAAI,CAACR,UAAU;YAI3D;IAEJ;AACF"}
@@ -1,5 +1,6 @@
1
1
  import { isArray, isNumber, isString } from "remeda";
2
2
  import { ANNOTATION_Z_INDEX } from "../../../../utils/constant.js";
3
+ import { resolveAnnotationValue } from "./utils.js";
3
4
  const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
4
5
  const { advancedVSeed, vseed } = context;
5
6
  const { annotation, config } = advancedVSeed;
@@ -18,7 +19,7 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
18
19
  insideEnd: 'insideEndTop'
19
20
  };
20
21
  const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine)=>{
21
- const { xValue, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'center', textBaseline = 'top', lineColor = theme?.lineColor ?? '#212121', lineStyle = theme?.lineStyle ?? 'dashed', lineVisible = theme?.lineStyle ?? true, lineWidth = theme?.lineWidth ?? 1, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121', textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundPadding = theme?.textBackgroundPadding ?? 2 } = annotationVerticalLine;
22
+ const { xValue, dynamicFilter, text = '', textPosition = 'insideEnd', textColor = theme?.textColor ?? '#ffffff', textFontSize = theme?.textFontSize ?? 12, textFontWeight = theme?.textFontWeight ?? 400, textAlign = 'center', textBaseline = 'top', lineColor = theme?.lineColor ?? '#212121', lineStyle = theme?.lineStyle ?? 'dashed', lineVisible = theme?.lineStyle ?? true, lineWidth = theme?.lineWidth ?? 1, textBackgroundVisible = theme?.textBackgroundVisible ?? true, textBackgroundColor = theme?.textBackgroundColor ?? '#212121', textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121', textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4, textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1, textBackgroundPadding = theme?.textBackgroundPadding ?? 2 } = annotationVerticalLine;
22
23
  const generateOneMarkLine = (x)=>({
23
24
  x,
24
25
  autoRange: true,
@@ -89,9 +90,14 @@ const annotationVerticalLine_annotationVerticalLine = (spec, context)=>{
89
90
  }
90
91
  }
91
92
  });
92
- if (isArray(xValue) || isString(xValue) || isNumber(xValue)) {
93
- const xValueArr = Array.isArray(xValue) ? xValue : [
94
- xValue
93
+ const finalXValue = resolveAnnotationValue({
94
+ dynamicFilter,
95
+ fallback: dynamicFilter?.fallback,
96
+ defaultValue: xValue
97
+ });
98
+ if (isArray(finalXValue) || isString(finalXValue) || isNumber(finalXValue)) {
99
+ const xValueArr = Array.isArray(finalXValue) ? finalXValue : [
100
+ finalXValue
95
101
  ];
96
102
  return xValueArr.map(generateOneMarkLine);
97
103
  }
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.ts"],"sourcesContent":["import type { ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\nimport { isArray, isNumber, isString } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\n\nexport const annotationVerticalLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationVerticalLine) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationVerticalLine\n const { annotationVerticalLine } = annotation\n const annotationVerticalLineList = Array.isArray(annotationVerticalLine)\n ? annotationVerticalLine\n : [annotationVerticalLine]\n\n const positionMap = {\n outsideStart: 'start',\n outsideEnd: 'end',\n outsideMiddle: 'middle',\n insideStart: 'insideStartTop',\n insideMiddle: 'insideMiddleTop',\n insideEnd: 'insideEndTop',\n }\n const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine) => {\n const {\n xValue,\n text = '',\n textPosition = 'insideEnd',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'center',\n textBaseline = 'top',\n\n lineColor = theme?.lineColor ?? '#212121',\n lineStyle = theme?.lineStyle ?? 'dashed',\n lineVisible = theme?.lineStyle ?? true,\n lineWidth = theme?.lineWidth ?? 1,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121',\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n } = annotationVerticalLine\n\n const generateOneMarkLine = (x: number | string) => ({\n x,\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n line: {\n style: {\n visible: lineVisible,\n stroke: lineColor,\n lineStyle: lineStyle,\n lineWidth: lineWidth,\n lineDash: lineStyle === 'dashed' ? [5, 2] : lineStyle === 'dotted' ? [2, 5] : [0],\n },\n },\n label: {\n confine: true,\n text: text,\n position: (positionMap as any)[textPosition || 'insideEnd'],\n style: {\n opacity: 0.95,\n dx: 5,\n visible: true,\n stroke: textBackgroundColor,\n lineWidth: 1,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n dx: 5,\n cornerRadius: textBackgroundBorderRadius,\n fill: textBackgroundColor,\n fillOpacity: 1,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n },\n },\n },\n startSymbol: {\n visible: theme?.startSymbolVisible ?? true,\n symbolType: theme?.startSymbolType ?? 'triangleDown',\n size: 5 + (lineWidth || 1),\n style: {\n dy: -3,\n fill: lineColor,\n },\n },\n endSymbol: {\n visible: theme?.endSymbolVisible ?? false,\n symbolType: theme?.endSymbolType ?? 'arrow',\n size: 10 + (lineWidth || 1),\n style: {\n dy: 4,\n fill: lineColor,\n },\n },\n })\n\n if (isArray(xValue) || isString(xValue) || isNumber(xValue)) {\n const xValueArr = Array.isArray(xValue) ? xValue : [xValue]\n return xValueArr.map(generateOneMarkLine)\n }\n\n return []\n }) as IMarkLineSpec[]\n\n const specMarkLine = ((spec as ILineChartSpec).markLine as IMarkLineSpec[]) || []\n const newMarkLine = [...specMarkLine, ...(markLine || [])]\n\n return {\n ...spec,\n markLine: newMarkLine,\n }\n}\n"],"names":["annotationVerticalLine","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationVerticalLineList","Array","positionMap","markLine","xValue","text","textPosition","textColor","textFontSize","textFontWeight","textAlign","textBaseline","lineColor","lineStyle","lineVisible","lineWidth","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundPadding","generateOneMarkLine","x","ANNOTATION_Z_INDEX","isArray","isString","isNumber","xValueArr","specMarkLine","newMarkLine"],"mappings":";;AAKO,MAAMA,gDAAyC,CAACC,MAAMC;IAC3D,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,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oBACnF;gBACF;gBACA,OAAO;oBACL,SAAS;oBACT,MAAMR;oBACN,UAAWH,WAAmB,CAACI,gBAAgB,YAAY;oBAC3D,OAAO;wBACL,SAAS;wBACT,IAAI;wBACJ,SAAS;wBACT,QAAQW;wBACR,WAAW;wBACX,WAAWP;wBACX,cAAcC;wBACd,MAAMJ;wBACN,UAAUC;wBACV,YAAYC;oBACd;oBACA,iBAAiB;wBACf,SAASO;wBACT,SAASK;wBACT,OAAO;4BACL,SAAS;4BACT,IAAI;4BACJ,cAAcF;4BACd,MAAMF;4BACN,aAAa;4BACb,QAAQC;4BACR,WAAWE;wBACb;oBACF;gBACF;gBACA,aAAa;oBACX,SAASrB,OAAO,sBAAsB;oBACtC,YAAYA,OAAO,mBAAmB;oBACtC,MAAM,IAAKgB,CAAAA,aAAa;oBACxB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;gBACA,WAAW;oBACT,SAASb,OAAO,oBAAoB;oBACpC,YAAYA,OAAO,iBAAiB;oBACpC,MAAM,KAAMgB,CAAAA,aAAa;oBACzB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;YACF;QAEA,IAAIa,QAAQrB,WAAWsB,SAAStB,WAAWuB,SAASvB,SAAS;YAC3D,MAAMwB,YAAY3B,MAAM,OAAO,CAACG,UAAUA,SAAS;gBAACA;aAAO;YAC3D,OAAOwB,UAAU,GAAG,CAACN;QACvB;QAEA,OAAO,EAAE;IACX;IAEA,MAAMO,eAAiBpC,KAAwB,QAAQ,IAAwB,EAAE;IACjF,MAAMqC,cAAc;WAAID;WAAkB1B,YAAY,EAAE;KAAE;IAE1D,OAAO;QACL,GAAGV,IAAI;QACP,UAAUqC;IACZ;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.ts"],"sourcesContent":["import type { ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\nimport { isArray, isNumber, isString } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { resolveAnnotationValue } from './utils'\n\nexport const annotationVerticalLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationVerticalLine) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationVerticalLine\n const { annotationVerticalLine } = annotation\n const annotationVerticalLineList = Array.isArray(annotationVerticalLine)\n ? annotationVerticalLine\n : [annotationVerticalLine]\n\n const positionMap = {\n outsideStart: 'start',\n outsideEnd: 'end',\n outsideMiddle: 'middle',\n insideStart: 'insideStartTop',\n insideMiddle: 'insideMiddleTop',\n insideEnd: 'insideEndTop',\n }\n const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine) => {\n const {\n xValue,\n dynamicFilter,\n text = '',\n textPosition = 'insideEnd',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'center',\n textBaseline = 'top',\n\n lineColor = theme?.lineColor ?? '#212121',\n lineStyle = theme?.lineStyle ?? 'dashed',\n lineVisible = theme?.lineStyle ?? true,\n lineWidth = theme?.lineWidth ?? 1,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121',\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n } = annotationVerticalLine\n\n const generateOneMarkLine = (x: number | string) => ({\n x,\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n line: {\n style: {\n visible: lineVisible,\n stroke: lineColor,\n lineStyle: lineStyle,\n lineWidth: lineWidth,\n lineDash: lineStyle === 'dashed' ? [5, 2] : lineStyle === 'dotted' ? [2, 5] : [0],\n },\n },\n label: {\n confine: true,\n text: text,\n position: (positionMap as any)[textPosition || 'insideEnd'],\n style: {\n opacity: 0.95,\n dx: 5,\n visible: true,\n stroke: textBackgroundColor,\n lineWidth: 1,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n dx: 5,\n cornerRadius: textBackgroundBorderRadius,\n fill: textBackgroundColor,\n fillOpacity: 1,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n },\n },\n },\n startSymbol: {\n visible: theme?.startSymbolVisible ?? true,\n symbolType: theme?.startSymbolType ?? 'triangleDown',\n size: 5 + (lineWidth || 1),\n style: {\n dy: -3,\n fill: lineColor,\n },\n },\n endSymbol: {\n visible: theme?.endSymbolVisible ?? false,\n symbolType: theme?.endSymbolType ?? 'arrow',\n size: 10 + (lineWidth || 1),\n style: {\n dy: 4,\n fill: lineColor,\n },\n },\n })\n\n const finalXValue = resolveAnnotationValue({\n dynamicFilter,\n fallback: dynamicFilter?.fallback as string | number | undefined,\n defaultValue: xValue,\n })\n\n if (isArray(finalXValue) || isString(finalXValue) || isNumber(finalXValue)) {\n const xValueArr = Array.isArray(finalXValue) ? finalXValue : [finalXValue]\n return xValueArr.map(generateOneMarkLine)\n }\n\n return []\n }) as IMarkLineSpec[]\n\n const specMarkLine = ((spec as ILineChartSpec).markLine as IMarkLineSpec[]) || []\n const newMarkLine = [...specMarkLine, ...(markLine || [])]\n\n return {\n ...spec,\n markLine: newMarkLine,\n }\n}\n"],"names":["annotationVerticalLine","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationVerticalLineList","Array","positionMap","markLine","xValue","dynamicFilter","text","textPosition","textColor","textFontSize","textFontWeight","textAlign","textBaseline","lineColor","lineStyle","lineVisible","lineWidth","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundPadding","generateOneMarkLine","x","ANNOTATION_Z_INDEX","finalXValue","resolveAnnotationValue","isArray","isString","isNumber","xValueArr","specMarkLine","newMarkLine"],"mappings":";;;AAMO,MAAMA,gDAAyC,CAACC,MAAMC;IAC3D,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,CAACE,cAAc,CAACA,WAAW,sBAAsB,EACnD,OAAOJ;IAGT,MAAMM,QAAQD,QAAQ,CAACF,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEJ,sBAAsB,EAAE,GAAGK;IACnC,MAAMG,6BAA6BC,MAAM,OAAO,CAACT,0BAC7CA,yBACA;QAACA;KAAuB;IAE5B,MAAMU,cAAc;QAClB,cAAc;QACd,YAAY;QACZ,eAAe;QACf,aAAa;QACb,cAAc;QACd,WAAW;IACb;IACA,MAAMC,WAAWH,2BAA2B,OAAO,CAAC,CAACR;QACnD,MAAM,EACJY,MAAM,EACNC,aAAa,EACbC,OAAO,EAAE,EACTC,eAAe,WAAW,EAC1BC,YAAYT,OAAO,aAAa,SAAS,EACzCU,eAAeV,OAAO,gBAAgB,EAAE,EACxCW,iBAAiBX,OAAO,kBAAkB,GAAG,EAC7CY,YAAY,QAAQ,EACpBC,eAAe,KAAK,EAEpBC,YAAYd,OAAO,aAAa,SAAS,EACzCe,YAAYf,OAAO,aAAa,QAAQ,EACxCgB,cAAchB,OAAO,aAAa,IAAI,EACtCiB,YAAYjB,OAAO,aAAa,CAAC,EAEjCkB,wBAAwBlB,OAAO,yBAAyB,IAAI,EAC5DmB,sBAAsBnB,OAAO,uBAAuB,SAAS,EAC7DoB,4BAA4BpB,OAAO,6BAA6B,SAAS,EACzEqB,6BAA6BrB,OAAO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;YAC1E,MAAMK,YAAY9B,MAAM,OAAO,CAACyB,eAAeA,cAAc;gBAACA;aAAY;YAC1E,OAAOK,UAAU,GAAG,CAACR;QACvB;QAEA,OAAO,EAAE;IACX;IAEA,MAAMS,eAAiBvC,KAAwB,QAAQ,IAAwB,EAAE;IACjF,MAAMwC,cAAc;WAAID;WAAkB7B,YAAY,EAAE;KAAE;IAE1D,OAAO;QACL,GAAGV,IAAI;QACP,UAAUwC;IACZ;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/splitLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/splitLine.ts"],"sourcesContent":["import type { ICartesianSeries, IChart, ILineChartSpec, IVChart } from '@visactor/vchart'\nimport { array, clamper, Color as VUtilColor } from '@visactor/vutils'\nimport { isNullish, isNumber, isPlainObject } from 'remeda'\nimport type { AnnotationHorizontalLine, VChartSpecPipe, Color } from 'src/types'\n\ninterface SplitConfig {\n points: { x: number; y: number }[]\n splitCoordinate: number\n lineStroke: {\n gradient: string\n x0: number\n x1: number\n y0: number\n y1: number\n stops: {\n color: string\n offset: number\n }[]\n }\n areaFill: {\n gradient: string\n x0: number\n x1: number\n y0: number\n y1: number\n stops: {\n color: string\n offset: number\n }[]\n }\n}\n\nconst formatGradientStops = (stops: { color: string; offset: number }[]) => {\n const firstInvalidateIndex = stops.findIndex((stop) => stop.offset < 0 || stop.offset > 1)\n\n if (firstInvalidateIndex >= 0) {\n if (stops[firstInvalidateIndex].offset > 1) {\n const newStops = stops.slice(0, firstInvalidateIndex + 1)\n newStops[newStops.length - 1].offset = 1\n\n return newStops\n }\n const newStops = stops.slice(firstInvalidateIndex + 1)\n\n newStops[0].offset = 0\n return newStops\n }\n\n return stops\n}\n\nexport const splitLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { annotation, chartType, datasetReshapeInfo } = advancedVSeed\n\n if (!annotation || !annotation.annotationHorizontalLine) {\n return spec\n }\n const baseConfig = advancedVSeed.config[chartType] as { color: Color }\n\n const splitLineConfig = array(annotation.annotationHorizontalLine).find(\n (item) => !!(item as AnnotationHorizontalLine).splitLine,\n ) as AnnotationHorizontalLine | undefined\n\n const splitValue = +(splitLineConfig?.yValue as number | string)\n\n if (Number.isNaN(splitValue) || !isNumber(splitValue)) {\n return spec\n }\n const result = { ...spec } as Partial<ILineChartSpec>\n const colorTheme = baseConfig?.color ?? {}\n const colorConfig = {\n positiveColor: colorTheme.positiveColor || 'red',\n negativeColor: colorTheme.negativeColor || 'green',\n ...(isPlainObject(splitLineConfig?.splitLine) ? splitLineConfig?.splitLine : {}),\n }\n\n const groupMark = {\n type: 'group',\n name: 'annotationHorizontalLine-splitLine',\n zIndex: 300,\n style: {\n splitConfig: (datum: any, ctx: any) => {\n const vchart = ctx.vchart as IVChart\n const chart = vchart.getChart() as IChart\n const lineSeries = chart.getAllSeries().find((s) => s.type === 'line' || s.type === 'area') as ICartesianSeries\n\n if (!lineSeries) {\n return\n }\n const lineMark = lineSeries.getMarkInName('line') ?? lineSeries.getMarkInName('area')\n\n if (!lineMark) {\n return\n }\n const lineGraphics = lineMark.getGraphics()\n\n if (!lineGraphics || lineGraphics.length !== 1 || !lineGraphics[0]) {\n return\n }\n const points = ((lineGraphics[0].attribute as any).points ?? []) as { x: number; y: number }[]\n\n if ((lineGraphics[0].attribute as any).segments?.length) {\n ;((lineGraphics[0].attribute as any).segments as any[]).forEach(\n (seg: { points: { x: number; y: number }[] }) => {\n seg.points.forEach((pt: { x: number; y: number }) => {\n points.push({ x: pt.x, y: pt.y })\n })\n },\n )\n }\n\n if (!points || !points.length) {\n return\n }\n const scale = lineSeries.getYAxisHelper().getScale!(0)\n const splitCoordinate = scale.scale(splitValue)\n const minY = Math.min(...points.map((p) => p.y))\n const maxY = Math.max(...points.map((p) => p.y))\n const ratio = (splitCoordinate - minY) / (maxY - minY)\n\n const lineStroke = {\n gradient: 'linear',\n x0: 0,\n x1: 0,\n y0: 0,\n y1: 1,\n stops: formatGradientStops([\n {\n color: colorConfig.positiveColor,\n offset: 0,\n },\n {\n color: colorConfig.positiveColor,\n offset: ratio,\n },\n {\n color: colorConfig.negativeColor,\n offset: ratio + 0.0000001,\n },\n {\n color: colorConfig.negativeColor,\n offset: 1,\n },\n ]),\n }\n const areaFill = {\n gradient: 'linear',\n x0: 0,\n x1: 0,\n y0: 0,\n y1: 1,\n stops: formatGradientStops([\n {\n color: colorConfig.positiveColor,\n offset: 0,\n },\n {\n color: new VUtilColor(colorConfig.positiveColor).setOpacity(0).toRGBA(),\n offset: ratio,\n },\n {\n offset: ratio + 0.0000001,\n color: new VUtilColor(colorConfig.negativeColor).setOpacity(0).toRGBA(),\n },\n {\n color: colorConfig.negativeColor,\n offset: 1,\n },\n ]),\n }\n const attrs: any = {\n segments: null,\n points,\n }\n\n if (lineGraphics[0].type === 'area') {\n attrs.stroke = lineStroke\n attrs.fill = areaFill\n } else {\n attrs.stroke = lineStroke\n }\n\n lineGraphics[0].setAttributes(attrs as unknown as Record<string, any>)\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n lineGraphics[0].setFinalAttributes?.(attrs)\n const start = lineSeries.getRegion().getLayoutStartPoint()\n const range = scale.range() as number[]\n\n return {\n points: points.map((entry) => ({ x: entry.x + start.x, y: entry.y + start.y })),\n splitCoordinate: clamper(range[0], range[range.length - 1])(splitCoordinate as number) + start.y,\n areaFill,\n lineStroke,\n } as SplitConfig\n },\n },\n children: [\n {\n type: 'area',\n interactive: false,\n zIndex: 500,\n style: {\n fillOpacity: 0.5,\n points: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.splitConfig) {\n const { points, splitCoordinate } = parentNode.attribute.splitConfig as SplitConfig\n\n return points.map((entry: { x: number; y: number }) => {\n return {\n ...entry,\n y1: splitCoordinate,\n }\n })\n }\n\n return []\n },\n fill: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.splitConfig) {\n const { areaFill } = parentNode.attribute.splitConfig as SplitConfig\n\n return areaFill\n }\n\n return\n },\n },\n },\n ],\n }\n\n if (!result.customMark) {\n result.customMark = []\n }\n\n ;(result.customMark as any[]).push(groupMark)\n\n const seriesSpec =\n result.type === 'line' || result.type === 'area'\n ? result\n : result.series?.find((s) => s.type === 'line' || s.type === 'area')\n\n if (seriesSpec) {\n if (!seriesSpec.point) {\n seriesSpec.point = {}\n }\n if (!seriesSpec.line) {\n seriesSpec.line = {}\n }\n\n if (!seriesSpec.point.style) {\n seriesSpec.point.style = {}\n }\n if (!seriesSpec.line.style) {\n seriesSpec.line.style = {}\n }\n\n const measureValueKey = datasetReshapeInfo[0].foldInfo.measureValue\n\n seriesSpec.point.style.fill = (datum) => {\n return datum?.[measureValueKey] < splitValue ? colorConfig.negativeColor : colorConfig.positiveColor\n }\n seriesSpec.line.style.stroke = (datum) => {\n return datum?.[measureValueKey] < splitValue ? colorConfig.negativeColor : colorConfig.positiveColor\n }\n if (seriesSpec.label && (seriesSpec.label as any).visible && isNullish((seriesSpec.label as any).style?.fill)) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n ;(seriesSpec.label as any).style = {\n ...(seriesSpec.label as any).style,\n fill: (datum: any) => {\n return datum?.[measureValueKey] < splitValue ? colorConfig.negativeColor : colorConfig.positiveColor\n },\n }\n }\n }\n\n return result\n}\n"],"names":["formatGradientStops","stops","firstInvalidateIndex","stop","newStops","splitLine","spec","context","advancedVSeed","annotation","chartType","datasetReshapeInfo","baseConfig","splitLineConfig","array","item","splitValue","Number","isNumber","result","colorTheme","colorConfig","isPlainObject","groupMark","datum","ctx","vchart","chart","lineSeries","s","lineMark","lineGraphics","points","seg","pt","scale","splitCoordinate","minY","Math","p","maxY","ratio","lineStroke","areaFill","VUtilColor","attrs","start","range","entry","clamper","opt","parentNode","seriesSpec","measureValueKey","isNullish"],"mappings":";;AAgCA,MAAMA,sBAAsB,CAACC;IAC3B,MAAM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WAAW,KAAK,CAAC,KAAK,EACzBA,WAAW,KAAK,CAAC,KAAK,GAAG,CAAC;QAE5B,IAAI,CAACA,WAAW,IAAI,CAAC,KAAK,EACxBA,WAAW,IAAI,CAAC,KAAK,GAAG,CAAC;QAG3B,MAAMC,kBAAkB1C,kBAAkB,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY;QAEnEyC,WAAW,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC5B,QACtBA,OAAO,CAAC6B,gBAAgB,GAAGrC,aAAaK,YAAY,aAAa,GAAGA,YAAY,aAAa;QAEtG+B,WAAW,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC5B,QACvBA,OAAO,CAAC6B,gBAAgB,GAAGrC,aAAaK,YAAY,aAAa,GAAGA,YAAY,aAAa;QAEtG,IAAI+B,WAAW,KAAK,IAAKA,WAAW,KAAK,CAAS,OAAO,IAAIE,UAAWF,WAAW,KAAK,CAAS,KAAK,EAAE,OAEpGA,WAAW,KAAK,CAAS,KAAK,GAAG;YACjC,GAAIA,WAAW,KAAK,CAAS,KAAK;YAClC,MAAM,CAAC5B,QACEA,OAAO,CAAC6B,gBAAgB,GAAGrC,aAAaK,YAAY,aAAa,GAAGA,YAAY,aAAa;QAExG;IAEJ;IAEA,OAAOF;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/splitLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/splitLine.ts"],"sourcesContent":["import type { ICartesianSeries, IChart, ILineChartSpec, IVChart } from '@visactor/vchart'\nimport { array, clamper, Color as VUtilColor } from '@visactor/vutils'\nimport { isNullish, isNumber, isPlainObject } from 'remeda'\nimport type { AnnotationHorizontalLine, VChartSpecPipe, Color } from 'src/types'\n\ninterface SplitConfig {\n points: { x: number; y: number }[]\n splitCoordinate: number\n lineStroke: {\n gradient: string\n x0: number\n x1: number\n y0: number\n y1: number\n stops: {\n color: string\n offset: number\n }[]\n }\n areaFill: {\n gradient: string\n x0: number\n x1: number\n y0: number\n y1: number\n stops: {\n color: string\n offset: number\n }[]\n }\n}\n\nconst formatGradientStops = (stops: { color: string; offset: number }[]) => {\n const firstInvalidateIndex = stops.findIndex((stop) => stop.offset < 0 || stop.offset > 1)\n\n if (firstInvalidateIndex >= 0) {\n if (stops[firstInvalidateIndex].offset > 1) {\n const newStops = stops.slice(0, firstInvalidateIndex + 1)\n newStops[newStops.length - 1].offset = 1\n\n return newStops\n }\n const newStops = stops.slice(firstInvalidateIndex + 1)\n\n newStops[0].offset = 0\n return newStops\n }\n\n return stops\n}\n\nexport const splitLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { annotation, chartType, datasetReshapeInfo } = advancedVSeed\n\n if (!annotation || !annotation.annotationHorizontalLine) {\n return spec\n }\n const baseConfig = advancedVSeed.config[chartType] as { color: Color }\n\n const splitLineConfig = array(annotation.annotationHorizontalLine).find(\n (item) => !!(item as AnnotationHorizontalLine).splitLine,\n ) as AnnotationHorizontalLine | undefined\n\n const splitValue = +(splitLineConfig?.yValue as number | string)\n\n if (Number.isNaN(splitValue) || !isNumber(splitValue)) {\n return spec\n }\n const result = { ...spec } as Partial<ILineChartSpec>\n const colorTheme = baseConfig?.color ?? {}\n const colorConfig = {\n positiveColor: colorTheme.positiveColor || 'red',\n negativeColor: colorTheme.negativeColor || 'green',\n ...(isPlainObject(splitLineConfig?.splitLine) ? splitLineConfig?.splitLine : {}),\n }\n\n const groupMark = {\n type: 'group',\n name: 'annotationHorizontalLine-splitLine',\n zIndex: 300,\n style: {\n splitConfig: (datum: any, ctx: any) => {\n const vchart = ctx.vchart as IVChart\n const chart = vchart.getChart() as IChart\n const lineSeries = chart.getAllSeries().find((s) => s.type === 'line' || s.type === 'area') as ICartesianSeries\n\n if (!lineSeries) {\n return\n }\n const lineMark = lineSeries.getMarkInName('line') ?? lineSeries.getMarkInName('area')\n\n if (!lineMark) {\n return\n }\n const lineGraphics = lineMark.getGraphics()\n\n if (!lineGraphics || lineGraphics.length !== 1 || !lineGraphics[0]) {\n return\n }\n const points = ((lineGraphics[0].attribute as any).points ?? []) as { x: number; y: number }[]\n\n if ((lineGraphics[0].attribute as any).segments?.length) {\n ;((lineGraphics[0].attribute as any).segments as any[]).forEach(\n (seg: { points: { x: number; y: number }[] }) => {\n seg.points.forEach((pt: { x: number; y: number }) => {\n points.push({ x: pt.x, y: pt.y })\n })\n },\n )\n }\n\n if (!points || !points.length) {\n return\n }\n const scale = lineSeries.getYAxisHelper().getScale!(0)\n const splitCoordinate = scale.scale(splitValue)\n const minY = Math.min(...points.map((p) => p.y))\n const maxY = Math.max(...points.map((p) => p.y))\n const ratio = (splitCoordinate - minY) / (maxY - minY)\n\n const lineStroke = {\n gradient: 'linear',\n x0: 0,\n x1: 0,\n y0: 0,\n y1: 1,\n stops: formatGradientStops([\n {\n color: colorConfig.positiveColor,\n offset: 0,\n },\n {\n color: colorConfig.positiveColor,\n offset: ratio,\n },\n {\n color: colorConfig.negativeColor,\n offset: ratio + 0.0000001,\n },\n {\n color: colorConfig.negativeColor,\n offset: 1,\n },\n ]),\n }\n const areaFill = {\n gradient: 'linear',\n x0: 0,\n x1: 0,\n y0: 0,\n y1: 1,\n stops: formatGradientStops([\n {\n color: colorConfig.positiveColor,\n offset: 0,\n },\n {\n color: new VUtilColor(colorConfig.positiveColor).setOpacity(0).toRGBA(),\n offset: ratio,\n },\n {\n offset: ratio + 0.0000001,\n color: new VUtilColor(colorConfig.negativeColor).setOpacity(0).toRGBA(),\n },\n {\n color: colorConfig.negativeColor,\n offset: 1,\n },\n ]),\n }\n const attrs: any = {\n segments: null,\n points,\n }\n\n if (lineGraphics[0].type === 'area') {\n attrs.stroke = lineStroke\n attrs.fill = areaFill\n } else {\n attrs.stroke = lineStroke\n }\n\n lineGraphics[0].setAttributes(attrs as unknown as Record<string, any>)\n\n lineGraphics[0].setFinalAttributes?.(attrs)\n const start = lineSeries.getRegion().getLayoutStartPoint()\n const range = scale.range() as number[]\n\n return {\n points: points.map((entry) => ({ x: entry.x + start.x, y: entry.y + start.y })),\n splitCoordinate: clamper(range[0], range[range.length - 1])(splitCoordinate as number) + start.y,\n areaFill,\n lineStroke,\n } as SplitConfig\n },\n },\n children: [\n {\n type: 'area',\n interactive: false,\n zIndex: 500,\n style: {\n fillOpacity: 0.5,\n points: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.splitConfig) {\n const { points, splitCoordinate } = parentNode.attribute.splitConfig as SplitConfig\n\n return points.map((entry: { x: number; y: number }) => {\n return {\n ...entry,\n y1: splitCoordinate,\n }\n })\n }\n\n return []\n },\n fill: (datum: any, ctx: any, opt: any) => {\n const parentNode = opt.mark?._product?.parent\n\n if (parentNode?.attribute?.splitConfig) {\n const { areaFill } = parentNode.attribute.splitConfig as SplitConfig\n\n return areaFill\n }\n\n return\n },\n },\n },\n ],\n }\n\n if (!result.customMark) {\n result.customMark = []\n }\n\n ;(result.customMark as any[]).push(groupMark)\n\n const seriesSpec =\n result.type === 'line' || result.type === 'area'\n ? result\n : result.series?.find((s) => s.type === 'line' || s.type === 'area')\n\n if (seriesSpec) {\n if (!seriesSpec.point) {\n seriesSpec.point = {}\n }\n if (!seriesSpec.line) {\n seriesSpec.line = {}\n }\n\n if (!seriesSpec.point.style) {\n seriesSpec.point.style = {}\n }\n if (!seriesSpec.line.style) {\n seriesSpec.line.style = {}\n }\n\n const measureValueKey = datasetReshapeInfo[0].foldInfo.measureValue\n\n seriesSpec.point.style.fill = (datum) => {\n return datum?.[measureValueKey] < splitValue ? colorConfig.negativeColor : colorConfig.positiveColor\n }\n seriesSpec.line.style.stroke = (datum) => {\n return datum?.[measureValueKey] < splitValue ? colorConfig.negativeColor : colorConfig.positiveColor\n }\n if (seriesSpec.label && (seriesSpec.label as any).visible && isNullish((seriesSpec.label as any).style?.fill)) {\n ;(seriesSpec.label as any).style = {\n ...(seriesSpec.label as any).style,\n fill: (datum: any) => {\n return datum?.[measureValueKey] < splitValue ? colorConfig.negativeColor : colorConfig.positiveColor\n },\n }\n }\n }\n\n return result\n}\n"],"names":["formatGradientStops","stops","firstInvalidateIndex","stop","newStops","splitLine","spec","context","advancedVSeed","annotation","chartType","datasetReshapeInfo","baseConfig","splitLineConfig","array","item","splitValue","Number","isNumber","result","colorTheme","colorConfig","isPlainObject","groupMark","datum","ctx","vchart","chart","lineSeries","s","lineMark","lineGraphics","points","seg","pt","scale","splitCoordinate","minY","Math","p","maxY","ratio","lineStroke","areaFill","VUtilColor","attrs","start","range","entry","clamper","opt","parentNode","seriesSpec","measureValueKey","isNullish"],"mappings":";;AAgCA,MAAMA,sBAAsB,CAACC;IAC3B,MAAMC,uBAAuBD,MAAM,SAAS,CAAC,CAACE,OAASA,KAAK,MAAM,GAAG,KAAKA,KAAK,MAAM,GAAG;IAExF,IAAID,wBAAwB,GAAG;QAC7B,IAAID,KAAK,CAACC,qBAAqB,CAAC,MAAM,GAAG,GAAG;YAC1C,MAAME,WAAWH,MAAM,KAAK,CAAC,GAAGC,uBAAuB;YACvDE,QAAQ,CAACA,SAAS,MAAM,GAAG,EAAE,CAAC,MAAM,GAAG;YAEvC,OAAOA;QACT;QACA,MAAMA,WAAWH,MAAM,KAAK,CAACC,uBAAuB;QAEpDE,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG;QACrB,OAAOA;IACT;IAEA,OAAOH;AACT;AAEO,MAAMI,YAA4B,CAACC,MAAMC;IAC9C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,UAAU,EAAEC,SAAS,EAAEC,kBAAkB,EAAE,GAAGH;IAEtD,IAAI,CAACC,cAAc,CAACA,WAAW,wBAAwB,EACrD,OAAOH;IAET,MAAMM,aAAaJ,cAAc,MAAM,CAACE,UAAU;IAElD,MAAMG,kBAAkBC,MAAML,WAAW,wBAAwB,EAAE,IAAI,CACrE,CAACM,OAAS,CAAC,CAAEA,KAAkC,SAAS;IAG1D,MAAMC,aAAa,CAA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T"}
@@ -1,4 +1,4 @@
1
- import type { Datum } from '../../../../../types';
1
+ import type { Datum, ValueDynamicFilter } from '../../../../../types';
2
2
  export declare const isSubset: (sub: Datum, obj: Datum, excludeMeasuresIds?: string[]) => boolean;
3
3
  export declare const ANNOTATION_AREA_TEXT_STYLE_BY_POSITION: {
4
4
  top: {
@@ -34,3 +34,11 @@ export declare const ANNOTATION_AREA_TEXT_STYLE_BY_POSITION: {
34
34
  textBaseline: string;
35
35
  };
36
36
  };
37
+ /**
38
+ * 解析标注线的值,优先级:dynamicFilter (success=true) > fallback > defaultValue
39
+ */
40
+ export declare const resolveAnnotationValue: (options: {
41
+ dynamicFilter?: ValueDynamicFilter;
42
+ fallback?: string | number;
43
+ defaultValue?: any;
44
+ }) => (string | number) | (string | number)[] | undefined;
@@ -38,6 +38,12 @@ const ANNOTATION_AREA_TEXT_STYLE_BY_POSITION = {
38
38
  textBaseline: 'middle'
39
39
  }
40
40
  };
41
- export { ANNOTATION_AREA_TEXT_STYLE_BY_POSITION, isSubset };
41
+ const resolveAnnotationValue = (options)=>{
42
+ const { dynamicFilter, fallback, defaultValue } = options;
43
+ if (dynamicFilter?.result?.success && void 0 !== dynamicFilter.result.data) return dynamicFilter.result.data;
44
+ if (void 0 !== fallback) return fallback;
45
+ return defaultValue;
46
+ };
47
+ export { ANNOTATION_AREA_TEXT_STYLE_BY_POSITION, isSubset, resolveAnnotationValue };
42
48
 
43
49
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/annotation/utils.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/utils.ts"],"sourcesContent":["import type { Datum } from 'src/types'\n\nexport const isSubset = (sub: Datum, obj: Datum, excludeMeasuresIds?: string[]) => {\n return Object.entries(sub).every(([key, value]) => {\n if (excludeMeasuresIds && excludeMeasuresIds.includes(key)) {\n return false\n }\n\n if (typeof value === 'string') {\n return obj[key] === value\n }\n if (typeof value === 'number') {\n return obj[key] === value\n }\n return true\n })\n}\n\nexport const ANNOTATION_AREA_TEXT_STYLE_BY_POSITION = {\n top: {\n textAlign: 'center',\n textBaseline: 'top',\n },\n topRight: {\n textAlign: 'right',\n textBaseline: 'top',\n },\n topLeft: {\n textAlign: 'left',\n textBaseline: 'top',\n },\n bottom: {\n textAlign: 'center',\n textBaseline: 'bottom',\n },\n bottomLeft: {\n textAlign: 'left',\n textBaseline: 'bottom',\n },\n bottomRight: {\n textAlign: 'right',\n textBaseline: 'bottom',\n },\n left: {\n textAlign: 'left',\n textBaseline: 'middle',\n },\n right: {\n textAlign: 'right',\n textBaseline: 'middle',\n },\n}\n"],"names":["isSubset","sub","obj","excludeMeasuresIds","Object","key","value","ANNOTATION_AREA_TEXT_STYLE_BY_POSITION"],"mappings":"AAEO,MAAMA,WAAW,CAACC,KAAYC,KAAYC,qBACxCC,OAAO,OAAO,CAACH,KAAK,KAAK,CAAC,CAAC,CAACI,KAAKC,MAAM;QAC5C,IAAIH,sBAAsBA,mBAAmB,QAAQ,CAACE,MACpD,OAAO;QAGT,IAAI,AAAiB,YAAjB,OAAOC,OACT,OAAOJ,GAAG,CAACG,IAAI,KAAKC;QAEtB,IAAI,AAAiB,YAAjB,OAAOA,OACT,OAAOJ,GAAG,CAACG,IAAI,KAAKC;QAEtB,OAAO;IACT;AAGK,MAAMC,yCAAyC;IACpD,KAAK;QACH,WAAW;QACX,cAAc;IAChB;IACA,UAAU;QACR,WAAW;QACX,cAAc;IAChB;IACA,SAAS;QACP,WAAW;QACX,cAAc;IAChB;IACA,QAAQ;QACN,WAAW;QACX,cAAc;IAChB;IACA,YAAY;QACV,WAAW;QACX,cAAc;IAChB;IACA,aAAa;QACX,WAAW;QACX,cAAc;IAChB;IACA,MAAM;QACJ,WAAW;QACX,cAAc;IAChB;IACA,OAAO;QACL,WAAW;QACX,cAAc;IAChB;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/annotation/utils.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/utils.ts"],"sourcesContent":["import type { Datum, ValueDynamicFilter } from 'src/types'\n\nexport const isSubset = (sub: Datum, obj: Datum, excludeMeasuresIds?: string[]) => {\n return Object.entries(sub).every(([key, value]) => {\n if (excludeMeasuresIds && excludeMeasuresIds.includes(key)) {\n return false\n }\n\n if (typeof value === 'string') {\n return obj[key] === value\n }\n if (typeof value === 'number') {\n return obj[key] === value\n }\n return true\n })\n}\n\nexport const ANNOTATION_AREA_TEXT_STYLE_BY_POSITION = {\n top: {\n textAlign: 'center',\n textBaseline: 'top',\n },\n topRight: {\n textAlign: 'right',\n textBaseline: 'top',\n },\n topLeft: {\n textAlign: 'left',\n textBaseline: 'top',\n },\n bottom: {\n textAlign: 'center',\n textBaseline: 'bottom',\n },\n bottomLeft: {\n textAlign: 'left',\n textBaseline: 'bottom',\n },\n bottomRight: {\n textAlign: 'right',\n textBaseline: 'bottom',\n },\n left: {\n textAlign: 'left',\n textBaseline: 'middle',\n },\n right: {\n textAlign: 'right',\n textBaseline: 'middle',\n },\n}\n\n/**\n * 解析标注线的值,优先级:dynamicFilter (success=true) > fallback > defaultValue\n */\nexport const resolveAnnotationValue = (options: {\n dynamicFilter?: ValueDynamicFilter\n fallback?: string | number\n defaultValue?: any\n}): (string | number) | (string | number)[] | undefined => {\n const { dynamicFilter, fallback, defaultValue } = options\n\n // 优先使用 dynamicFilter\n if (dynamicFilter?.result?.success && dynamicFilter.result.data !== undefined) {\n return dynamicFilter.result.data\n }\n\n // 其次使用 fallback\n if (fallback !== undefined) {\n return fallback\n }\n\n // 最后使用原始的 defaultValue\n return defaultValue\n}\n"],"names":["isSubset","sub","obj","excludeMeasuresIds","Object","key","value","ANNOTATION_AREA_TEXT_STYLE_BY_POSITION","resolveAnnotationValue","options","dynamicFilter","fallback","defaultValue","undefined"],"mappings":"AAEO,MAAMA,WAAW,CAACC,KAAYC,KAAYC,qBACxCC,OAAO,OAAO,CAACH,KAAK,KAAK,CAAC,CAAC,CAACI,KAAKC,MAAM;QAC5C,IAAIH,sBAAsBA,mBAAmB,QAAQ,CAACE,MACpD,OAAO;QAGT,IAAI,AAAiB,YAAjB,OAAOC,OACT,OAAOJ,GAAG,CAACG,IAAI,KAAKC;QAEtB,IAAI,AAAiB,YAAjB,OAAOA,OACT,OAAOJ,GAAG,CAACG,IAAI,KAAKC;QAEtB,OAAO;IACT;AAGK,MAAMC,yCAAyC;IACpD,KAAK;QACH,WAAW;QACX,cAAc;IAChB;IACA,UAAU;QACR,WAAW;QACX,cAAc;IAChB;IACA,SAAS;QACP,WAAW;QACX,cAAc;IAChB;IACA,QAAQ;QACN,WAAW;QACX,cAAc;IAChB;IACA,YAAY;QACV,WAAW;QACX,cAAc;IAChB;IACA,aAAa;QACX,WAAW;QACX,cAAc;IAChB;IACA,MAAM;QACJ,WAAW;QACX,cAAc;IAChB;IACA,OAAO;QACL,WAAW;QACX,cAAc;IAChB;AACF;AAKO,MAAMC,yBAAyB,CAACC;IAKrC,MAAM,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAGH;IAGlD,IAAIC,eAAe,QAAQ,WAAWA,AAA8BG,WAA9BH,cAAc,MAAM,CAAC,IAAI,EAC7D,OAAOA,cAAc,MAAM,CAAC,IAAI;IAIlC,IAAIC,AAAaE,WAAbF,UACF,OAAOA;IAIT,OAAOC;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/legend/boxLegend.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/legend/boxLegend.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport type { VChartSpecPipe } from 'src/types'\nimport { discreteLegend } from './discreteLegend'\n\nexport const boxLegend: VChartSpecPipe = (spec, context) => {\n const normalLegend = discreteLegend(spec, context) as any\n normalLegend.legends = {\n ...normalLegend.legends,\n data: (data: any[]) => {\n return data.map((obj) => {\n obj.shape.fill = obj.shape.stroke\n return obj\n })\n },\n }\n return normalLegend\n}\n"],"names":["boxLegend","spec","context","normalLegend","discreteLegend","data","obj"],"mappings":";AAMO,MAAMA,YAA4B,CAACC,MAAMC;IAC9C,MAAMC,eAAeC,eAAeH,MAAMC;IAC1CC,aAAa,OAAO,GAAG;QACrB,GAAGA,aAAa,OAAO;QACvB,MAAM,CAACE,OACEA,KAAK,GAAG,CAAC,CAACC;gBACfA,IAAI,KAAK,CAAC,IAAI,GAAGA,IAAI,KAAK,CAAC,MAAM;gBACjC,OAAOA;YACT;IAEJ;IACA,OAAOH;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/legend/boxLegend.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/legend/boxLegend.ts"],"sourcesContent":["import type { VChartSpecPipe } from 'src/types'\nimport { discreteLegend } from './discreteLegend'\n\nexport const boxLegend: VChartSpecPipe = (spec, context) => {\n const normalLegend = discreteLegend(spec, context) as any\n normalLegend.legends = {\n ...normalLegend.legends,\n data: (data: any[]) => {\n return data.map((obj) => {\n obj.shape.fill = obj.shape.stroke\n return obj\n })\n },\n }\n return normalLegend\n}\n"],"names":["boxLegend","spec","context","normalLegend","discreteLegend","data","obj"],"mappings":";AAGO,MAAMA,YAA4B,CAACC,MAAMC;IAC9C,MAAMC,eAAeC,eAAeH,MAAMC;IAC1CC,aAAa,OAAO,GAAG;QACrB,GAAGA,aAAa,OAAO;QACvB,MAAM,CAACE,OACEA,KAAK,GAAG,CAAC,CAACC;gBACfA,IAAI,KAAK,CAAC,IAAI,GAAGA,IAAI,KAAK,CAAC,MAAM;gBACjC,OAAOA;YACT;IAEJ;IACA,OAAOH;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/legend/heatmapColorLegend.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/legend/heatmapColorLegend.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport type { VChartSpecPipe } from 'src/types'\nimport { colorLegend } from './colorLegend'\nimport type { Datum, IHeatmapChartSpec } from '@visactor/vchart'\nimport { DATUM_HIDE_KEY } from 'src/pipeline/utils/constant'\n\nexport const heatmapColorLegend: VChartSpecPipe = (spec, context) => {\n const result = colorLegend(spec, context) as IHeatmapChartSpec\n\n if (result.legends) {\n ;(result.legends as any).customFilter = (data: Datum[], range: number[], key: string) => {\n const min = Math.min(range[0], range[1])\n const max = Math.max(range[0], range[1])\n return (data ?? []).map((entry: Datum) => {\n const val = entry[key]\n const isHide = val - min < -1e-6 || val - max > 1e-6\n\n entry[DATUM_HIDE_KEY] = isHide\n\n return entry\n })\n }\n }\n\n return result\n}\n"],"names":["heatmapColorLegend","spec","context","result","colorLegend","data","range","key","min","Math","max","entry","val","isHide","DATUM_HIDE_KEY"],"mappings":";;AAMO,MAAMA,qBAAqC,CAACC,MAAMC;IACvD,MAAMC,SAASC,YAAYH,MAAMC;IAEjC,IAAIC,OAAO,OAAO,EACdA,OAAO,OAAO,CAAS,YAAY,GAAG,CAACE,MAAeC,OAAiBC;QACvE,MAAMC,MAAMC,KAAK,GAAG,CAACH,KAAK,CAAC,EAAE,EAAEA,KAAK,CAAC,EAAE;QACvC,MAAMI,MAAMD,KAAK,GAAG,CAACH,KAAK,CAAC,EAAE,EAAEA,KAAK,CAAC,EAAE;QACvC,OAAQD,AAAAA,CAAAA,QAAQ,EAAC,EAAG,GAAG,CAAC,CAACM;YACvB,MAAMC,MAAMD,KAAK,CAACJ,IAAI;YACtB,MAAMM,SAASD,MAAMJ,MAAM,aAASI,MAAMF,MAAM;YAEhDC,KAAK,CAACG,eAAe,GAAGD;YAExB,OAAOF;QACT;IACF;IAGF,OAAOR;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/legend/heatmapColorLegend.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/legend/heatmapColorLegend.ts"],"sourcesContent":["import type { VChartSpecPipe } from 'src/types'\nimport { colorLegend } from './colorLegend'\nimport type { Datum, IHeatmapChartSpec } from '@visactor/vchart'\nimport { DATUM_HIDE_KEY } from 'src/pipeline/utils/constant'\n\nexport const heatmapColorLegend: VChartSpecPipe = (spec, context) => {\n const result = colorLegend(spec, context) as IHeatmapChartSpec\n\n if (result.legends) {\n ;(result.legends as any).customFilter = (data: Datum[], range: number[], key: string) => {\n const min = Math.min(range[0], range[1])\n const max = Math.max(range[0], range[1])\n return (data ?? []).map((entry: Datum) => {\n const val = entry[key]\n const isHide = val - min < -1e-6 || val - max > 1e-6\n\n entry[DATUM_HIDE_KEY] = isHide\n\n return entry\n })\n }\n }\n\n return result\n}\n"],"names":["heatmapColorLegend","spec","context","result","colorLegend","data","range","key","min","Math","max","entry","val","isHide","DATUM_HIDE_KEY"],"mappings":";;AAKO,MAAMA,qBAAqC,CAACC,MAAMC;IACvD,MAAMC,SAASC,YAAYH,MAAMC;IAEjC,IAAIC,OAAO,OAAO,EACdA,OAAO,OAAO,CAAS,YAAY,GAAG,CAACE,MAAeC,OAAiBC;QACvE,MAAMC,MAAMC,KAAK,GAAG,CAACH,KAAK,CAAC,EAAE,EAAEA,KAAK,CAAC,EAAE;QACvC,MAAMI,MAAMD,KAAK,GAAG,CAACH,KAAK,CAAC,EAAE,EAAEA,KAAK,CAAC,EAAE;QACvC,OAAQD,AAAAA,CAAAA,QAAQ,EAAC,EAAG,GAAG,CAAC,CAACM;YACvB,MAAMC,MAAMD,KAAK,CAACJ,IAAI;YACtB,MAAMM,SAASD,MAAMJ,MAAM,aAASI,MAAMF,MAAM;YAEhDC,KAAK,CAACG,eAAe,GAAGD;YAExB,OAAOF;QACT;IACF;IAGF,OAAOR;AACT"}
@@ -1,4 +1,4 @@
1
- import { selector } from "../../../../../dataSelector/index.js";
1
+ import { selector, selectorWithDynamicFilter } from "../../../../../dataSelector/index.js";
2
2
  import { isEmpty, isNullish } from "remeda";
3
3
  const barStyle_barStyle = (spec, context)=>{
4
4
  const { advancedVSeed } = context;
@@ -41,7 +41,8 @@ const barStyle_barStyle = (spec, context)=>{
41
41
  [`custom${index + 1}`]: {
42
42
  level: index + 1,
43
43
  filter: (datum)=>{
44
- if (selector(datum, style.selector)) return true;
44
+ const shouldApply = style.dynamicFilter ? selectorWithDynamicFilter(datum, style.dynamicFilter, style.selector) : selector(datum, style.selector);
45
+ if (shouldApply) return true;
45
46
  return false;
46
47
  },
47
48
  style: {
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/markStyle/barStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/barStyle.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { BarStyle, Datum, VChartSpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\n\nexport const barStyle: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle, dataset = [] } = advancedVSeed\n const { barStyle } = markStyle\n\n const showStroke = dataset.length <= 100\n\n const result = {\n ...spec,\n bar: {\n style: {\n visible: true,\n fillOpacity: 1,\n lineWidth: showStroke ? 1 : 0,\n },\n state: {\n hover: {\n fillOpacity: 0.6,\n },\n },\n },\n } as IBarChartSpec\n\n if (isNullish(barStyle) || isEmpty(barStyle)) {\n return result\n }\n\n const barStyles = (Array.isArray(barStyle) ? barStyle : [barStyle]) as BarStyle[]\n\n const customMap = barStyles.reduce<object>((result, style, index) => {\n const {\n barBorderColor,\n barBorderStyle,\n barBorderWidth = 1,\n barColor,\n barColorOpacity,\n barBorderOpacity,\n barRadius,\n barVisible = true,\n } = style\n\n const lineDash = barBorderStyle === 'dashed' ? [5, 2] : barBorderStyle === 'dotted' ? [2, 5] : [0, 0]\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (datum: Datum) => {\n if (selector(datum, style.selector)) {\n return true\n }\n return false\n },\n style: {\n visible: barVisible,\n fill: barColor,\n fillOpacity: barColorOpacity,\n cornerRadius: barRadius,\n lineWidth: barBorderWidth,\n stroke: barBorderColor,\n strokeOpacity: barBorderOpacity,\n lineDash: lineDash,\n },\n },\n }\n }, {})\n\n result.bar!.state = {\n ...result.bar!.state,\n ...customMap,\n }\n\n return result\n}\n"],"names":["barStyle","spec","context","advancedVSeed","markStyle","dataset","showStroke","result","isNullish","isEmpty","barStyles","Array","customMap","style","index","barBorderColor","barBorderStyle","barBorderWidth","barColor","barColorOpacity","barBorderOpacity","barRadius","barVisible","lineDash","datum","selector"],"mappings":";;AAKO,MAAMA,oBAA2B,CAACC,MAAMC;IAC7C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAEC,UAAU,EAAE,EAAE,GAAGF;IACpC,MAAM,EAAEH,QAAQ,EAAE,GAAGI;IAErB,MAAME,aAAaD,QAAQ,MAAM,IAAI;IAErC,MAAME,SAAS;QACb,GAAGN,IAAI;QACP,KAAK;YACH,OAAO;gBACL,SAAS;gBACT,aAAa;gBACb,WAAWK,aAAa,IAAI;YAC9B;YACA,OAAO;gBACL,OAAO;oBACL,aAAa;gBACf;YACF;QACF;IACF;IAEA,IAAIE,UAAUR,aAAaS,QAAQT,WACjC,OAAOO;IAGT,MAAMG,YAAaC,MAAM,OAAO,CAACX,YAAYA,WAAW;QAACA;KAAS;IAElE,MAAMY,YAAYF,UAAU,MAAM,CAAS,CAACH,QAAQM,OAAOC;QACzD,MAAM,EACJC,cAAc,EACdC,cAAc,EACdC,iBAAiB,CAAC,EAClBC,QAAQ,EACRC,eAAe,EACfC,gBAAgB,EAChBC,SAAS,EACTC,aAAa,IAAI,EAClB,GAAGT;QAEJ,MAAMU,WAAWP,AAAmB,aAAnBA,iBAA8B;YAAC;YAAG;SAAE,GAAGA,AAAmB,aAAnBA,iBAA8B;YAAC;YAAG;SAAE,GAAG;YAAC;YAAG;SAAE;QACrG,OAAO;YACL,GAAGT,MAAM;YACT,CAAC,CAAC,MAAM,EAAEO,QAAQ,GAAG,CAAC,EAAE;gBAEtB,OAAOA,QAAQ;gBACf,QAAQ,CAACU;oBACP,IAAIC,SAASD,OAAOX,MAAM,QAAQ,GAChC,OAAO;oBAET,OAAO;gBACT;gBACA,OAAO;oBACL,SAASS;oBACT,MAAMJ;oBACN,aAAaC;oBACb,cAAcE;oBACd,WAAWJ;oBACX,QAAQF;oBACR,eAAeK;oBACf,UAAUG;gBACZ;YACF;QACF;IACF,GAAG,CAAC;IAEJhB,OAAO,GAAG,CAAE,KAAK,GAAG;QAClB,GAAGA,OAAO,GAAG,CAAE,KAAK;QACpB,GAAGK,SAAS;IACd;IAEA,OAAOL;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/markStyle/barStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/barStyle.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport { selector, selectorWithDynamicFilter } from '../../../../../dataSelector'\nimport type { BarStyle, Datum, VChartSpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\n\nexport const barStyle: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle, dataset = [] } = advancedVSeed\n const { barStyle } = markStyle\n\n const showStroke = dataset.length <= 100\n\n const result = {\n ...spec,\n bar: {\n style: {\n visible: true,\n fillOpacity: 1,\n lineWidth: showStroke ? 1 : 0,\n },\n state: {\n hover: {\n fillOpacity: 0.6,\n },\n },\n },\n } as IBarChartSpec\n\n if (isNullish(barStyle) || isEmpty(barStyle)) {\n return result\n }\n\n const barStyles = (Array.isArray(barStyle) ? barStyle : [barStyle]) as BarStyle[]\n\n const customMap = barStyles.reduce<object>((result, style, index) => {\n const {\n barBorderColor,\n barBorderStyle,\n barBorderWidth = 1,\n barColor,\n barColorOpacity,\n barBorderOpacity,\n barRadius,\n barVisible = true,\n } = style\n\n const lineDash = barBorderStyle === 'dashed' ? [5, 2] : barBorderStyle === 'dotted' ? [2, 5] : [0, 0]\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (datum: Datum) => {\n const shouldApply = style.dynamicFilter\n ? selectorWithDynamicFilter(datum, style.dynamicFilter, style.selector)\n : selector(datum, style.selector)\n if (shouldApply) {\n return true\n }\n return false\n },\n style: {\n visible: barVisible,\n fill: barColor,\n fillOpacity: barColorOpacity,\n cornerRadius: barRadius,\n lineWidth: barBorderWidth,\n stroke: barBorderColor,\n strokeOpacity: barBorderOpacity,\n lineDash: lineDash,\n },\n },\n }\n }, {})\n\n result.bar!.state = {\n ...result.bar!.state,\n ...customMap,\n }\n\n return result\n}\n"],"names":["barStyle","spec","context","advancedVSeed","markStyle","dataset","showStroke","result","isNullish","isEmpty","barStyles","Array","customMap","style","index","barBorderColor","barBorderStyle","barBorderWidth","barColor","barColorOpacity","barBorderOpacity","barRadius","barVisible","lineDash","datum","shouldApply","selectorWithDynamicFilter","selector"],"mappings":";;AAKO,MAAMA,oBAA2B,CAACC,MAAMC;IAC7C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAEC,UAAU,EAAE,EAAE,GAAGF;IACpC,MAAM,EAAEH,QAAQ,EAAE,GAAGI;IAErB,MAAME,aAAaD,QAAQ,MAAM,IAAI;IAErC,MAAME,SAAS;QACb,GAAGN,IAAI;QACP,KAAK;YACH,OAAO;gBACL,SAAS;gBACT,aAAa;gBACb,WAAWK,aAAa,IAAI;YAC9B;YACA,OAAO;gBACL,OAAO;oBACL,aAAa;gBACf;YACF;QACF;IACF;IAEA,IAAIE,UAAUR,aAAaS,QAAQT,WACjC,OAAOO;IAGT,MAAMG,YAAaC,MAAM,OAAO,CAACX,YAAYA,WAAW;QAACA;KAAS;IAElE,MAAMY,YAAYF,UAAU,MAAM,CAAS,CAACH,QAAQM,OAAOC;QACzD,MAAM,EACJC,cAAc,EACdC,cAAc,EACdC,iBAAiB,CAAC,EAClBC,QAAQ,EACRC,eAAe,EACfC,gBAAgB,EAChBC,SAAS,EACTC,aAAa,IAAI,EAClB,GAAGT;QAEJ,MAAMU,WAAWP,AAAmB,aAAnBA,iBAA8B;YAAC;YAAG;SAAE,GAAGA,AAAmB,aAAnBA,iBAA8B;YAAC;YAAG;SAAE,GAAG;YAAC;YAAG;SAAE;QACrG,OAAO;YACL,GAAGT,MAAM;YACT,CAAC,CAAC,MAAM,EAAEO,QAAQ,GAAG,CAAC,EAAE;gBAEtB,OAAOA,QAAQ;gBACf,QAAQ,CAACU;oBACP,MAAMC,cAAcZ,MAAM,aAAa,GACnCa,0BAA0BF,OAAOX,MAAM,aAAa,EAAEA,MAAM,QAAQ,IACpEc,SAASH,OAAOX,MAAM,QAAQ;oBAClC,IAAIY,aACF,OAAO;oBAET,OAAO;gBACT;gBACA,OAAO;oBACL,SAASH;oBACT,MAAMJ;oBACN,aAAaC;oBACb,cAAcE;oBACd,WAAWJ;oBACX,QAAQF;oBACR,eAAeK;oBACf,UAAUG;gBACZ;YACF;QACF;IACF,GAAG,CAAC;IAEJhB,OAAO,GAAG,CAAE,KAAK,GAAG;QAClB,GAAGA,OAAO,GAAG,CAAE,KAAK;QACpB,GAAGK,SAAS;IACd;IAEA,OAAOL;AACT"}
@@ -1,4 +1,4 @@
1
- import { selector } from "../../../../../dataSelector/index.js";
1
+ import { selector, selectorWithDynamicFilter } from "../../../../../dataSelector/index.js";
2
2
  import { isEmpty, isNullish } from "remeda";
3
3
  import { getCurveTension, getCurveType } from "./curve/index.js";
4
4
  const lineStyle_lineStyle = (spec, context)=>{
@@ -37,7 +37,10 @@ const lineStyle_lineStyle = (spec, context)=>{
37
37
  level: index + 1,
38
38
  filter: (_, node)=>{
39
39
  const lineData = node.renderNode.context.data;
40
- for (const d of lineData)if (selector(d, style.selector)) return true;
40
+ for (const d of lineData){
41
+ const shouldApply = style.dynamicFilter ? selectorWithDynamicFilter(d, style.dynamicFilter, style.selector) : selector(d, style.selector);
42
+ if (shouldApply) return true;
43
+ }
41
44
  return false;
42
45
  },
43
46
  style: {
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/markStyle/lineStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/lineStyle.ts"],"sourcesContent":["import type { IAreaChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, LineStyle, VChartSpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { getCurveTension, getCurveType } from './curve'\n\nexport const lineStyle: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle } = advancedVSeed\n const { lineStyle } = markStyle\n const result = {\n ...spec,\n line: {\n style: {},\n },\n } as IAreaChartSpec\n\n if (isNullish(lineStyle) || isEmpty(lineStyle)) {\n return result\n }\n\n const lineStyles = (Array.isArray(lineStyle) ? lineStyle : [lineStyle]) as LineStyle[]\n\n const customMap = lineStyles.reduce<object>((result, style, index) => {\n const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style\n\n const dashSegment = lineWidth * 2\n const dashGap = lineWidth\n\n const lineDash =\n lineStyle === 'dashed' ? [dashSegment, dashSegment] : lineStyle === 'dotted' ? [dashGap / 2, dashGap * 2] : [0, 0]\n\n const curveType = getCurveType(context.vseed, lineSmooth)\n const curveTension = getCurveTension(context.vseed, lineSmooth)\n\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (\n _: Datum,\n node: {\n renderNode: {\n context: {\n data: Datum[]\n }\n }\n },\n ) => {\n const lineData = node.renderNode.context.data\n for (const d of lineData) {\n if (selector(d, style.selector)) {\n return true\n }\n }\n return false\n },\n style: {\n visible: lineVisible,\n curveType: curveType,\n curveTension: curveTension,\n strokeOpacity: lineColorOpacity,\n stroke: lineColor,\n lineWidth: lineWidth,\n lineDash: lineDash,\n },\n },\n }\n }, {})\n\n return {\n ...result,\n line: {\n ...result.line,\n state: {\n ...customMap,\n },\n },\n }\n}\n"],"names":["lineStyle","spec","context","advancedVSeed","markStyle","result","isNullish","isEmpty","lineStyles","Array","customMap","style","index","lineColor","lineColorOpacity","lineSmooth","lineWidth","lineVisible","dashSegment","dashGap","lineDash","curveType","getCurveType","curveTension","getCurveTension","_","node","lineData","d","selector"],"mappings":";;;AAMO,MAAMA,sBAA4B,CAACC,MAAMC;IAC9C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEH,SAAS,EAAE,GAAGI;IACtB,MAAMC,SAAS;QACb,GAAGJ,IAAI;QACP,MAAM;YACJ,OAAO,CAAC;QACV;IACF;IAEA,IAAIK,UAAUN,cAAcO,QAAQP,YAClC,OAAOK;IAGT,MAAMG,aAAcC,MAAM,OAAO,CAACT,aAAaA,YAAY;QAACA;KAAU;IAEtE,MAAMU,YAAYF,WAAW,MAAM,CAAS,CAACH,QAAQM,OAAOC;QAC1D,MAAM,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,UAAU,EAAEf,SAAS,EAAEgB,YAAY,CAAC,EAAEC,cAAc,IAAI,EAAE,GAAGN;QAElG,MAAMO,cAAcF,AAAY,IAAZA;QACpB,MAAMG,UAAUH;QAEhB,MAAMI,WACJpB,AAAc,aAAdA,YAAyB;YAACkB;YAAaA;SAAY,GAAGlB,AAAc,aAAdA,YAAyB;YAACmB,UAAU;YAAa,IAAVA;SAAY,GAAG;YAAC;YAAG;SAAE;QAEpH,MAAME,YAAYC,aAAapB,QAAQ,KAAK,EAAEa;QAC9C,MAAMQ,eAAeC,gBAAgBtB,QAAQ,KAAK,EAAEa;QAEpD,OAAO;YACL,GAAGV,MAAM;YACT,CAAC,CAAC,MAAM,EAAEO,QAAQ,GAAG,CAAC,EAAE;gBAEtB,OAAOA,QAAQ;gBACf,QAAQ,CACNa,GACAC;oBAQA,MAAMC,WAAWD,KAAK,UAAU,CAAC,OAAO,CAAC,IAAI;oBAC7C,KAAK,MAAME,KAAKD,SACd,IAAIE,SAASD,GAAGjB,MAAM,QAAQ,GAC5B,OAAO;oBAGX,OAAO;gBACT;gBACA,OAAO;oBACL,SAASM;oBACT,WAAWI;oBACX,cAAcE;oBACd,eAAeT;oBACf,QAAQD;oBACR,WAAWG;oBACX,UAAUI;gBACZ;YACF;QACF;IACF,GAAG,CAAC;IAEJ,OAAO;QACL,GAAGf,MAAM;QACT,MAAM;YACJ,GAAGA,OAAO,IAAI;YACd,OAAO;gBACL,GAAGK,SAAS;YACd;QACF;IACF;AACF"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/markStyle/lineStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/lineStyle.ts"],"sourcesContent":["import type { IAreaChartSpec } from '@visactor/vchart'\nimport { selector, selectorWithDynamicFilter } from '../../../../../dataSelector'\nimport type { Datum, LineStyle, VChartSpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { getCurveTension, getCurveType } from './curve'\n\nexport const lineStyle: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle } = advancedVSeed\n const { lineStyle } = markStyle\n const result = {\n ...spec,\n line: {\n style: {},\n },\n } as IAreaChartSpec\n\n if (isNullish(lineStyle) || isEmpty(lineStyle)) {\n return result\n }\n\n const lineStyles = (Array.isArray(lineStyle) ? lineStyle : [lineStyle]) as LineStyle[]\n\n const customMap = lineStyles.reduce<object>((result, style, index) => {\n const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style\n\n const dashSegment = lineWidth * 2\n const dashGap = lineWidth\n\n const lineDash =\n lineStyle === 'dashed' ? [dashSegment, dashSegment] : lineStyle === 'dotted' ? [dashGap / 2, dashGap * 2] : [0, 0]\n\n const curveType = getCurveType(context.vseed, lineSmooth)\n const curveTension = getCurveTension(context.vseed, lineSmooth)\n\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (\n _: Datum,\n node: {\n renderNode: {\n context: {\n data: Datum[]\n }\n }\n },\n ) => {\n const lineData = node.renderNode.context.data\n for (const d of lineData) {\n const shouldApply = style.dynamicFilter\n ? selectorWithDynamicFilter(d, style.dynamicFilter, style.selector)\n : selector(d, style.selector)\n if (shouldApply) {\n return true\n }\n }\n return false\n },\n style: {\n visible: lineVisible,\n curveType: curveType,\n curveTension: curveTension,\n strokeOpacity: lineColorOpacity,\n stroke: lineColor,\n lineWidth: lineWidth,\n lineDash: lineDash,\n },\n },\n }\n }, {})\n\n return {\n ...result,\n line: {\n ...result.line,\n state: {\n ...customMap,\n },\n },\n }\n}\n"],"names":["lineStyle","spec","context","advancedVSeed","markStyle","result","isNullish","isEmpty","lineStyles","Array","customMap","style","index","lineColor","lineColorOpacity","lineSmooth","lineWidth","lineVisible","dashSegment","dashGap","lineDash","curveType","getCurveType","curveTension","getCurveTension","_","node","lineData","d","shouldApply","selectorWithDynamicFilter","selector"],"mappings":";;;AAMO,MAAMA,sBAA4B,CAACC,MAAMC;IAC9C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEH,SAAS,EAAE,GAAGI;IACtB,MAAMC,SAAS;QACb,GAAGJ,IAAI;QACP,MAAM;YACJ,OAAO,CAAC;QACV;IACF;IAEA,IAAIK,UAAUN,cAAcO,QAAQP,YAClC,OAAOK;IAGT,MAAMG,aAAcC,MAAM,OAAO,CAACT,aAAaA,YAAY;QAACA;KAAU;IAEtE,MAAMU,YAAYF,WAAW,MAAM,CAAS,CAACH,QAAQM,OAAOC;QAC1D,MAAM,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,UAAU,EAAEf,SAAS,EAAEgB,YAAY,CAAC,EAAEC,cAAc,IAAI,EAAE,GAAGN;QAElG,MAAMO,cAAcF,AAAY,IAAZA;QACpB,MAAMG,UAAUH;QAEhB,MAAMI,WACJpB,AAAc,aAAdA,YAAyB;YAACkB;YAAaA;SAAY,GAAGlB,AAAc,aAAdA,YAAyB;YAACmB,UAAU;YAAa,IAAVA;SAAY,GAAG;YAAC;YAAG;SAAE;QAEpH,MAAME,YAAYC,aAAapB,QAAQ,KAAK,EAAEa;QAC9C,MAAMQ,eAAeC,gBAAgBtB,QAAQ,KAAK,EAAEa;QAEpD,OAAO;YACL,GAAGV,MAAM;YACT,CAAC,CAAC,MAAM,EAAEO,QAAQ,GAAG,CAAC,EAAE;gBAEtB,OAAOA,QAAQ;gBACf,QAAQ,CACNa,GACAC;oBAQA,MAAMC,WAAWD,KAAK,UAAU,CAAC,OAAO,CAAC,IAAI;oBAC7C,KAAK,MAAME,KAAKD,SAAU;wBACxB,MAAME,cAAclB,MAAM,aAAa,GACnCmB,0BAA0BF,GAAGjB,MAAM,aAAa,EAAEA,MAAM,QAAQ,IAChEoB,SAASH,GAAGjB,MAAM,QAAQ;wBAC9B,IAAIkB,aACF,OAAO;oBAEX;oBACA,OAAO;gBACT;gBACA,OAAO;oBACL,SAASZ;oBACT,WAAWI;oBACX,cAAcE;oBACd,eAAeT;oBACf,QAAQD;oBACR,WAAWG;oBACX,UAAUI;gBACZ;YACF;QACF;IACF,GAAG,CAAC;IAEJ,OAAO;QACL,GAAGf,MAAM;QACT,MAAM;YACJ,GAAGA,OAAO,IAAI;YACd,OAAO;gBACL,GAAGK,SAAS;YACd;QACF;IACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline/spec/chart/pipes/markStyle/pointState.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/pointState.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-call */\nimport type { IScatterChartSpec } from '@visactor/vchart'\nimport type { Datum, VChartSpecPipe } from 'src/types'\n\nexport const pointStateDimensionHover: VChartSpecPipe = (spec) => {\n const point = (spec as IScatterChartSpec).point || {}\n const result = {\n ...spec,\n point: {\n ...point,\n state: {\n ...(point.state || {}),\n dimension_hover: {\n scaleX: 1.4,\n scaleY: 1.4,\n outerBorder: {\n lineWidth: 4,\n strokeOpacity: 0.25,\n distance: 2,\n },\n },\n },\n },\n } as IScatterChartSpec\n return result\n}\n\nexport const pointStateHover: VChartSpecPipe = (spec, context) => {\n const point = (spec as IScatterChartSpec).point || {}\n const { advancedVSeed } = context\n const { datasetReshapeInfo } = advancedVSeed\n const { unfoldInfo } = datasetReshapeInfo[0]\n const result = {\n ...spec,\n point: {\n ...point,\n state: {\n ...(point.state || {}),\n hover: {\n scaleX: 1.4,\n scaleY: 1.4,\n stroke: (datum: Datum, context: unknown) => {\n const field = unfoldInfo.encodingColorId\n const color = (context as any).seriesColor(datum[field] as string)\n return color\n },\n fillOpacity: 0.6,\n lineWidth: 1,\n },\n },\n },\n } as IScatterChartSpec\n return result\n}\n"],"names":["pointStateDimensionHover","spec","point","result","pointStateHover","context","advancedVSeed","datasetReshapeInfo","unfoldInfo","datum","field","color"],"mappings":"AAIO,MAAMA,2BAA2C,CAACC;IACvD,MAAMC,QAASD,KAA2B,KAAK,IAAI,CAAC;IACpD,MAAME,SAAS;QACb,GAAGF,IAAI;QACP,OAAO;YACL,GAAGC,KAAK;YACR,OAAO;gBACL,GAAIA,MAAM,KAAK,IAAI,CAAC,CAAC;gBACrB,iBAAiB;oBACf,QAAQ;oBACR,QAAQ;oBACR,aAAa;wBACX,WAAW;wBACX,eAAe;wBACf,UAAU;oBACZ;gBACF;YACF;QACF;IACF;IACA,OAAOC;AACT;AAEO,MAAMC,kBAAkC,CAACH,MAAMI;IACpD,MAAMH,QAASD,KAA2B,KAAK,IAAI,CAAC;IACpD,MAAM,EAAEK,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,kBAAkB,EAAE,GAAGD;IAC/B,MAAM,EAAEE,UAAU,EAAE,GAAGD,kBAAkB,CAAC,EAAE;IAC5C,MAAMJ,SAAS;QACb,GAAGF,IAAI;QACP,OAAO;YACL,GAAGC,KAAK;YACR,OAAO;gBACL,GAAIA,MAAM,KAAK,IAAI,CAAC,CAAC;gBACrB,OAAO;oBACL,QAAQ;oBACR,QAAQ;oBACR,QAAQ,CAACO,OAAcJ;wBACrB,MAAMK,QAAQF,WAAW,eAAe;wBACxC,MAAMG,QAASN,QAAgB,WAAW,CAACI,KAAK,CAACC,MAAM;wBACvD,OAAOC;oBACT;oBACA,aAAa;oBACb,WAAW;gBACb;YACF;QACF;IACF;IACA,OAAOR;AACT"}
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/markStyle/pointState.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/pointState.ts"],"sourcesContent":["import type { IScatterChartSpec } from '@visactor/vchart'\nimport type { Datum, VChartSpecPipe } from 'src/types'\n\nexport const pointStateDimensionHover: VChartSpecPipe = (spec) => {\n const point = (spec as IScatterChartSpec).point || {}\n const result = {\n ...spec,\n point: {\n ...point,\n state: {\n ...(point.state || {}),\n dimension_hover: {\n scaleX: 1.4,\n scaleY: 1.4,\n outerBorder: {\n lineWidth: 4,\n strokeOpacity: 0.25,\n distance: 2,\n },\n },\n },\n },\n } as IScatterChartSpec\n return result\n}\n\nexport const pointStateHover: VChartSpecPipe = (spec, context) => {\n const point = (spec as IScatterChartSpec).point || {}\n const { advancedVSeed } = context\n const { datasetReshapeInfo } = advancedVSeed\n const { unfoldInfo } = datasetReshapeInfo[0]\n const result = {\n ...spec,\n point: {\n ...point,\n state: {\n ...(point.state || {}),\n hover: {\n scaleX: 1.4,\n scaleY: 1.4,\n stroke: (datum: Datum, context: unknown) => {\n const field = unfoldInfo.encodingColorId\n const color = (context as any).seriesColor(datum[field] as string)\n return color\n },\n fillOpacity: 0.6,\n lineWidth: 1,\n },\n },\n },\n } as IScatterChartSpec\n return result\n}\n"],"names":["pointStateDimensionHover","spec","point","result","pointStateHover","context","advancedVSeed","datasetReshapeInfo","unfoldInfo","datum","field","color"],"mappings":"AAGO,MAAMA,2BAA2C,CAACC;IACvD,MAAMC,QAASD,KAA2B,KAAK,IAAI,CAAC;IACpD,MAAME,SAAS;QACb,GAAGF,IAAI;QACP,OAAO;YACL,GAAGC,KAAK;YACR,OAAO;gBACL,GAAIA,MAAM,KAAK,IAAI,CAAC,CAAC;gBACrB,iBAAiB;oBACf,QAAQ;oBACR,QAAQ;oBACR,aAAa;wBACX,WAAW;wBACX,eAAe;wBACf,UAAU;oBACZ;gBACF;YACF;QACF;IACF;IACA,OAAOC;AACT;AAEO,MAAMC,kBAAkC,CAACH,MAAMI;IACpD,MAAMH,QAASD,KAA2B,KAAK,IAAI,CAAC;IACpD,MAAM,EAAEK,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,kBAAkB,EAAE,GAAGD;IAC/B,MAAM,EAAEE,UAAU,EAAE,GAAGD,kBAAkB,CAAC,EAAE;IAC5C,MAAMJ,SAAS;QACb,GAAGF,IAAI;QACP,OAAO;YACL,GAAGC,KAAK;YACR,OAAO;gBACL,GAAIA,MAAM,KAAK,IAAI,CAAC,CAAC;gBACrB,OAAO;oBACL,QAAQ;oBACR,QAAQ;oBACR,QAAQ,CAACO,OAAcJ;wBACrB,MAAMK,QAAQF,WAAW,eAAe;wBACxC,MAAMG,QAASN,QAAgB,WAAW,CAACI,KAAK,CAACC,MAAM;wBACvD,OAAOC;oBACT;oBACA,aAAa;oBACb,WAAW;gBACb;YACF;QACF;IACF;IACA,OAAOR;AACT"}