@visactor/vseed 0.4.28 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/dist/cjs/index.cjs +2 -2
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/pipeline/advanced/chart/pipes/config/column.js +2 -1
  4. package/dist/esm/pipeline/advanced/chart/pipes/config/column.js.map +1 -1
  5. package/dist/esm/pipeline/advanced/chart/pipes/config/line.js +2 -1
  6. package/dist/esm/pipeline/advanced/chart/pipes/config/line.js.map +1 -1
  7. package/dist/esm/pipeline/advanced/chart/pipes/config/pie.js +2 -1
  8. package/dist/esm/pipeline/advanced/chart/pipes/config/pie.js.map +1 -1
  9. package/dist/esm/pipeline/advanced/chart/pipes/config/scatter.js +2 -1
  10. package/dist/esm/pipeline/advanced/chart/pipes/config/scatter.js.map +1 -1
  11. package/dist/esm/pipeline/spec/chart/pipeline/area.js +3 -1
  12. package/dist/esm/pipeline/spec/chart/pipeline/area.js.map +1 -1
  13. package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js +3 -1
  14. package/dist/esm/pipeline/spec/chart/pipeline/areaPercent.js.map +1 -1
  15. package/dist/esm/pipeline/spec/chart/pipeline/bar.js +3 -1
  16. package/dist/esm/pipeline/spec/chart/pipeline/bar.js.map +1 -1
  17. package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js +3 -1
  18. package/dist/esm/pipeline/spec/chart/pipeline/barParallel.js.map +1 -1
  19. package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js +3 -1
  20. package/dist/esm/pipeline/spec/chart/pipeline/barPercent.js.map +1 -1
  21. package/dist/esm/pipeline/spec/chart/pipeline/column.js +3 -1
  22. package/dist/esm/pipeline/spec/chart/pipeline/column.js.map +1 -1
  23. package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js +3 -1
  24. package/dist/esm/pipeline/spec/chart/pipeline/columnParallel.js.map +1 -1
  25. package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js +3 -1
  26. package/dist/esm/pipeline/spec/chart/pipeline/columnPercent.js.map +1 -1
  27. package/dist/esm/pipeline/spec/chart/pipeline/donut.js +3 -1
  28. package/dist/esm/pipeline/spec/chart/pipeline/donut.js.map +1 -1
  29. package/dist/esm/pipeline/spec/chart/pipeline/line.js +3 -1
  30. package/dist/esm/pipeline/spec/chart/pipeline/line.js.map +1 -1
  31. package/dist/esm/pipeline/spec/chart/pipeline/pie.js +3 -1
  32. package/dist/esm/pipeline/spec/chart/pipeline/pie.js.map +1 -1
  33. package/dist/esm/pipeline/spec/chart/pipeline/radar.js +3 -1
  34. package/dist/esm/pipeline/spec/chart/pipeline/radar.js.map +1 -1
  35. package/dist/esm/pipeline/spec/chart/pipeline/rose.js +3 -1
  36. package/dist/esm/pipeline/spec/chart/pipeline/rose.js.map +1 -1
  37. package/dist/esm/pipeline/spec/chart/pipeline/roseParallel.js +3 -1
  38. package/dist/esm/pipeline/spec/chart/pipeline/roseParallel.js.map +1 -1
  39. package/dist/esm/pipeline/spec/chart/pipeline/scatter.js +3 -1
  40. package/dist/esm/pipeline/spec/chart/pipeline/scatter.js.map +1 -1
  41. package/dist/esm/pipeline/spec/chart/pipes/animation/animation.d.ts +15 -0
  42. package/dist/esm/pipeline/spec/chart/pipes/animation/animation.js +94 -0
  43. package/dist/esm/pipeline/spec/chart/pipes/animation/animation.js.map +1 -0
  44. package/dist/esm/pipeline/spec/chart/pipes/animation/bar.d.ts +77 -0
  45. package/dist/esm/pipeline/spec/chart/pipes/animation/bar.js +88 -0
  46. package/dist/esm/pipeline/spec/chart/pipes/animation/bar.js.map +1 -0
  47. package/dist/esm/pipeline/spec/chart/pipes/animation/index.d.ts +2 -0
  48. package/dist/esm/pipeline/spec/chart/pipes/animation/index.js +2 -0
  49. package/dist/esm/pipeline/spec/chart/pipes/animation/lineOrArea.d.ts +254 -0
  50. package/dist/esm/pipeline/spec/chart/pipes/animation/lineOrArea.js +138 -0
  51. package/dist/esm/pipeline/spec/chart/pipes/animation/lineOrArea.js.map +1 -0
  52. package/dist/esm/pipeline/spec/chart/pipes/animation/pie.d.ts +71 -0
  53. package/dist/esm/pipeline/spec/chart/pipes/animation/pie.js +176 -0
  54. package/dist/esm/pipeline/spec/chart/pipes/animation/pie.js.map +1 -0
  55. package/dist/esm/pipeline/spec/chart/pipes/animation/radar.d.ts +131 -0
  56. package/dist/esm/pipeline/spec/chart/pipes/animation/radar.js +46 -0
  57. package/dist/esm/pipeline/spec/chart/pipes/animation/radar.js.map +1 -0
  58. package/dist/esm/pipeline/spec/chart/pipes/animation/scatter.d.ts +102 -0
  59. package/dist/esm/pipeline/spec/chart/pipes/animation/scatter.js +57 -0
  60. package/dist/esm/pipeline/spec/chart/pipes/animation/scatter.js.map +1 -0
  61. package/dist/esm/pipeline/spec/chart/pipes/animation/types.d.ts +130 -0
  62. package/dist/esm/pipeline/spec/chart/pipes/animation/types.js +19 -0
  63. package/dist/esm/pipeline/spec/chart/pipes/animation/types.js.map +1 -0
  64. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/bar.d.ts +11 -0
  65. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/bar.js +13 -0
  66. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/bar.js.map +1 -0
  67. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barColor.d.ts +52 -0
  68. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barColor.js +51 -0
  69. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barColor.js.map +1 -0
  70. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barGroup.d.ts +102 -0
  71. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barGroup.js +84 -0
  72. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barGroup.js.map +1 -0
  73. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barMotion.d.ts +66 -0
  74. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barMotion.js +72 -0
  75. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/barMotion.js.map +1 -0
  76. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.d.ts +86 -0
  77. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.js +60 -0
  78. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/index.js.map +1 -0
  79. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/lineOrArea.d.ts +29 -0
  80. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/lineOrArea.js +20 -0
  81. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/lineOrArea.js.map +1 -0
  82. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pie.d.ts +14 -0
  83. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pie.js +9 -0
  84. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/pie.js.map +1 -0
  85. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/scatter.d.ts +69 -0
  86. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/scatter.js +59 -0
  87. package/dist/esm/pipeline/spec/chart/pipes/animation/utils/scatter.js.map +1 -0
  88. package/dist/esm/pipeline/spec/chart/pipes/index.d.ts +1 -0
  89. package/dist/esm/pipeline/spec/chart/pipes/index.js +1 -0
  90. package/dist/esm/types/chartType/area/area.d.ts +6 -1
  91. package/dist/esm/types/chartType/area/zArea.d.ts +40 -0
  92. package/dist/esm/types/chartType/area/zArea.js +2 -1
  93. package/dist/esm/types/chartType/area/zArea.js.map +1 -1
  94. package/dist/esm/types/chartType/areaPercent/areaPercent.d.ts +6 -1
  95. package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +40 -0
  96. package/dist/esm/types/chartType/areaPercent/zAreaPercent.js +2 -1
  97. package/dist/esm/types/chartType/areaPercent/zAreaPercent.js.map +1 -1
  98. package/dist/esm/types/chartType/bar/bar.d.ts +6 -1
  99. package/dist/esm/types/chartType/bar/zBar.d.ts +40 -0
  100. package/dist/esm/types/chartType/bar/zBar.js +2 -1
  101. package/dist/esm/types/chartType/bar/zBar.js.map +1 -1
  102. package/dist/esm/types/chartType/barParallel/barParallel.d.ts +6 -1
  103. package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +40 -0
  104. package/dist/esm/types/chartType/barParallel/zBarParallel.js +2 -1
  105. package/dist/esm/types/chartType/barParallel/zBarParallel.js.map +1 -1
  106. package/dist/esm/types/chartType/barPercent/barPercent.d.ts +6 -1
  107. package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +40 -0
  108. package/dist/esm/types/chartType/barPercent/zBarPercent.js +2 -1
  109. package/dist/esm/types/chartType/barPercent/zBarPercent.js.map +1 -1
  110. package/dist/esm/types/chartType/column/column.d.ts +6 -1
  111. package/dist/esm/types/chartType/column/zColumn.d.ts +40 -0
  112. package/dist/esm/types/chartType/column/zColumn.js +2 -1
  113. package/dist/esm/types/chartType/column/zColumn.js.map +1 -1
  114. package/dist/esm/types/chartType/columnParallel/columnParallel.d.ts +6 -1
  115. package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +40 -0
  116. package/dist/esm/types/chartType/columnParallel/zColumnParallel.js +2 -1
  117. package/dist/esm/types/chartType/columnParallel/zColumnParallel.js.map +1 -1
  118. package/dist/esm/types/chartType/columnPercent/columnPercent.d.ts +6 -1
  119. package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +40 -0
  120. package/dist/esm/types/chartType/columnPercent/zColumnPercent.js +2 -1
  121. package/dist/esm/types/chartType/columnPercent/zColumnPercent.js.map +1 -1
  122. package/dist/esm/types/chartType/donut/donut.d.ts +6 -1
  123. package/dist/esm/types/chartType/donut/zDonut.d.ts +40 -0
  124. package/dist/esm/types/chartType/donut/zDonut.js +2 -1
  125. package/dist/esm/types/chartType/donut/zDonut.js.map +1 -1
  126. package/dist/esm/types/chartType/line/line.d.ts +6 -1
  127. package/dist/esm/types/chartType/line/zLine.d.ts +40 -0
  128. package/dist/esm/types/chartType/line/zLine.js +2 -1
  129. package/dist/esm/types/chartType/line/zLine.js.map +1 -1
  130. package/dist/esm/types/chartType/pie/pie.d.ts +6 -1
  131. package/dist/esm/types/chartType/pie/zPie.d.ts +40 -0
  132. package/dist/esm/types/chartType/pie/zPie.js +2 -1
  133. package/dist/esm/types/chartType/pie/zPie.js.map +1 -1
  134. package/dist/esm/types/chartType/radar/radar.d.ts +6 -1
  135. package/dist/esm/types/chartType/radar/zRadar.d.ts +40 -0
  136. package/dist/esm/types/chartType/radar/zRadar.js +2 -1
  137. package/dist/esm/types/chartType/radar/zRadar.js.map +1 -1
  138. package/dist/esm/types/chartType/rose/rose.d.ts +6 -1
  139. package/dist/esm/types/chartType/rose/zRose.d.ts +40 -0
  140. package/dist/esm/types/chartType/rose/zRose.js +2 -1
  141. package/dist/esm/types/chartType/rose/zRose.js.map +1 -1
  142. package/dist/esm/types/chartType/roseParallel/roseParallel.d.ts +6 -1
  143. package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +40 -0
  144. package/dist/esm/types/chartType/roseParallel/zRoseParallel.js +2 -1
  145. package/dist/esm/types/chartType/roseParallel/zRoseParallel.js.map +1 -1
  146. package/dist/esm/types/chartType/scatter/scatter.d.ts +6 -1
  147. package/dist/esm/types/chartType/scatter/zScatter.d.ts +40 -0
  148. package/dist/esm/types/chartType/scatter/zScatter.js +2 -1
  149. package/dist/esm/types/chartType/scatter/zScatter.js.map +1 -1
  150. package/dist/esm/types/properties/config/animation/animation.d.ts +72 -0
  151. package/dist/esm/types/properties/config/animation/animation.js +0 -0
  152. package/dist/esm/types/properties/config/animation/animationAtmosphere.d.ts +15 -0
  153. package/dist/esm/types/properties/config/animation/animationAtmosphere.js +0 -0
  154. package/dist/esm/types/properties/config/animation/animationConfig.d.ts +2 -0
  155. package/dist/esm/types/properties/config/animation/animationConfig.js +0 -0
  156. package/dist/esm/types/properties/config/animation/animationEffect.d.ts +72 -0
  157. package/dist/esm/types/properties/config/animation/animationEffect.js +0 -0
  158. package/dist/esm/types/properties/config/animation/animationLoop.d.ts +49 -0
  159. package/dist/esm/types/properties/config/animation/animationLoop.js +0 -0
  160. package/dist/esm/types/properties/config/animation/index.d.ts +6 -0
  161. package/dist/esm/types/properties/config/animation/index.js +1 -0
  162. package/dist/esm/types/properties/config/animation/zAnimation.d.ts +201 -0
  163. package/dist/esm/types/properties/config/animation/zAnimation.js +114 -0
  164. package/dist/esm/types/properties/config/animation/zAnimation.js.map +1 -0
  165. package/dist/esm/types/properties/config/area.d.ts +80 -0
  166. package/dist/esm/types/properties/config/area.js +3 -1
  167. package/dist/esm/types/properties/config/area.js.map +1 -1
  168. package/dist/esm/types/properties/config/bar.d.ts +120 -0
  169. package/dist/esm/types/properties/config/bar.js +3 -1
  170. package/dist/esm/types/properties/config/bar.js.map +1 -1
  171. package/dist/esm/types/properties/config/column.d.ts +120 -0
  172. package/dist/esm/types/properties/config/column.js +3 -1
  173. package/dist/esm/types/properties/config/column.js.map +1 -1
  174. package/dist/esm/types/properties/config/config.d.ts +840 -0
  175. package/dist/esm/types/properties/config/index.d.ts +1 -0
  176. package/dist/esm/types/properties/config/index.js +1 -0
  177. package/dist/esm/types/properties/config/line.d.ts +40 -0
  178. package/dist/esm/types/properties/config/line.js +3 -1
  179. package/dist/esm/types/properties/config/line.js.map +1 -1
  180. package/dist/esm/types/properties/config/pie.d.ts +120 -0
  181. package/dist/esm/types/properties/config/pie.js +6 -2
  182. package/dist/esm/types/properties/config/pie.js.map +1 -1
  183. package/dist/esm/types/properties/config/race.d.ts +240 -0
  184. package/dist/esm/types/properties/config/rose.d.ts +80 -0
  185. package/dist/esm/types/properties/config/rose.js +3 -1
  186. package/dist/esm/types/properties/config/rose.js.map +1 -1
  187. package/dist/esm/types/properties/config/scatter.d.ts +40 -0
  188. package/dist/esm/types/properties/config/scatter.js +3 -1
  189. package/dist/esm/types/properties/config/scatter.js.map +1 -1
  190. package/dist/esm/types/properties/theme/customTheme.d.ts +1680 -0
  191. package/dist/umd/index.js +4962 -613
  192. package/dist/umd/index.js.map +1 -1
  193. package/package.json +2 -2
@@ -0,0 +1,51 @@
1
+ import tinycolor2 from "tinycolor2";
2
+ const isGradient = (color)=>color.includes('deg');
3
+ const splitLinearColor = (str)=>str.split(', ');
4
+ const transformColor2Gradient = (colorStr)=>{
5
+ const [degStr, startColor, endColor] = splitLinearColor(colorStr);
6
+ const deg = +degStr.slice(0, -3);
7
+ const endX = Math.cos(deg / 180 * Math.PI);
8
+ const endY = Math.sin(deg / 180 * Math.PI);
9
+ return {
10
+ gradient: 'linear',
11
+ x0: endX < 0 ? Math.abs(endX) : 0,
12
+ x1: endX > 0 ? endX : 0,
13
+ y1: endY < 0 ? Math.abs(endY) : 0,
14
+ y0: endY > 0 ? endY : 0,
15
+ stops: [
16
+ {
17
+ offset: 0,
18
+ color: startColor
19
+ },
20
+ {
21
+ offset: 1,
22
+ color: endColor
23
+ }
24
+ ]
25
+ };
26
+ };
27
+ const transform2VChartColor = (colorStr)=>{
28
+ if (!colorStr) return colorStr;
29
+ return isGradient(colorStr) ? transformColor2Gradient(colorStr) : colorStr;
30
+ };
31
+ const fillColorToStrokeColor = (color)=>tinycolor2(color).lighten(10).toRgbString();
32
+ const atmosphereColorToFill = (color, isGradientChart, isHorizontal)=>{
33
+ if (isGradient(color)) return transformColor2Gradient(color);
34
+ if (!isGradientChart) return color;
35
+ const deg = isHorizontal ? 90 : 0;
36
+ const start = tinycolor2(color).setAlpha(0.2).toRgbString();
37
+ const end = tinycolor2(color).setAlpha(1).toRgbString();
38
+ return transformColor2Gradient(`${deg}deg, ${start}, ${end}`);
39
+ };
40
+ const atmosphereColorToStroke = (color, isGradientChart, isHorizontal)=>{
41
+ if (isGradient(color)) return transformColor2Gradient(color);
42
+ if (!isGradientChart) return color;
43
+ const deg = isHorizontal ? 90 : 0;
44
+ const base = fillColorToStrokeColor(color);
45
+ const start = tinycolor2(base).setAlpha(0.2).toRgbString();
46
+ const end = tinycolor2(base).setAlpha(1).toRgbString();
47
+ return transformColor2Gradient(`${deg}deg, ${start}, ${end}`);
48
+ };
49
+ export { atmosphereColorToFill, atmosphereColorToStroke, transform2VChartColor };
50
+
51
+ //# sourceMappingURL=barColor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/barColor.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/barColor.ts"],"sourcesContent":["import tinycolor from 'tinycolor2'\n\nconst isGradient = (color: string) => color.includes('deg')\nconst splitLinearColor = (str: string) => str.split(', ')\n\n/**\n * @description 将 DSL 中的线性渐变字符串转换为 VChart gradient 对象。\n * @param colorStr DSL 线性渐变字符串。\n * @returns VChart gradient 对象。\n */\nconst transformColor2Gradient = (colorStr: string) => {\n const [degStr, startColor, endColor] = splitLinearColor(colorStr)\n const deg = +degStr.slice(0, -3)\n const endX = Math.cos((deg / 180) * Math.PI)\n const endY = Math.sin((deg / 180) * Math.PI)\n\n return {\n gradient: 'linear',\n x0: endX < 0 ? Math.abs(endX) : 0,\n x1: endX > 0 ? endX : 0,\n y1: endY < 0 ? Math.abs(endY) : 0,\n y0: endY > 0 ? endY : 0,\n stops: [\n { offset: 0, color: startColor },\n { offset: 1, color: endColor },\n ],\n }\n}\n\n/**\n * @description 将普通色值或 DSL 渐变色统一转换为 VChart 可消费的颜色配置。\n * @param colorStr 普通色值或 DSL 渐变色。\n * @returns VChart 可消费的颜色配置。\n */\nexport const transform2VChartColor = (colorStr?: string) => {\n if (!colorStr) return colorStr\n return isGradient(colorStr) ? transformColor2Gradient(colorStr) : colorStr\n}\n\n/**\n * @description 从填充色推导更亮的描边色,用于柱图氛围高亮。\n * @param color 填充色。\n * @returns 推导后的描边色。\n */\nconst fillColorToStrokeColor = (color: string) => {\n return tinycolor(color).lighten(10).toRgbString()\n}\n\n/**\n * @description 生成柱图氛围高亮的填充色;渐变柱图会补齐透明度渐变。\n * @param color 高亮色。\n * @param isGradientChart 当前图表是否使用渐变填充。\n * @param isHorizontal 是否为横向柱图。\n * @returns 柱图氛围高亮填充色。\n */\nexport const atmosphereColorToFill = (color: string, isGradientChart: boolean, isHorizontal: boolean) => {\n if (isGradient(color)) return transformColor2Gradient(color)\n if (!isGradientChart) return color\n\n const deg = isHorizontal ? 90 : 0\n const start = tinycolor(color).setAlpha(0.2).toRgbString()\n const end = tinycolor(color).setAlpha(1).toRgbString()\n return transformColor2Gradient(`${deg}deg, ${start}, ${end}`)\n}\n\n/**\n * @description 生成柱图氛围高亮的描边色;渐变柱图会补齐透明度渐变。\n * @param color 高亮色。\n * @param isGradientChart 当前图表是否使用渐变填充。\n * @param isHorizontal 是否为横向柱图。\n * @returns 柱图氛围高亮描边色。\n */\nexport const atmosphereColorToStroke = (color: string, isGradientChart: boolean, isHorizontal: boolean) => {\n if (isGradient(color)) return transformColor2Gradient(color)\n if (!isGradientChart) return color\n\n const deg = isHorizontal ? 90 : 0\n const base = fillColorToStrokeColor(color)\n const start = tinycolor(base).setAlpha(0.2).toRgbString()\n const end = tinycolor(base).setAlpha(1).toRgbString()\n return transformColor2Gradient(`${deg}deg, ${start}, ${end}`)\n}\n"],"names":["isGradient","color","splitLinearColor","str","transformColor2Gradient","colorStr","degStr","startColor","endColor","deg","endX","Math","endY","transform2VChartColor","fillColorToStrokeColor","tinycolor","atmosphereColorToFill","isGradientChart","isHorizontal","start","end","atmosphereColorToStroke","base"],"mappings":";AAEA,MAAMA,aAAa,CAACC,QAAkBA,MAAM,QAAQ,CAAC;AACrD,MAAMC,mBAAmB,CAACC,MAAgBA,IAAI,KAAK,CAAC;AAOpD,MAAMC,0BAA0B,CAACC;IAC/B,MAAM,CAACC,QAAQC,YAAYC,SAAS,GAAGN,iBAAiBG;IACxD,MAAMI,MAAM,CAACH,OAAO,KAAK,CAAC,GAAG;IAC7B,MAAMI,OAAOC,KAAK,GAAG,CAAEF,MAAM,MAAOE,KAAK,EAAE;IAC3C,MAAMC,OAAOD,KAAK,GAAG,CAAEF,MAAM,MAAOE,KAAK,EAAE;IAE3C,OAAO;QACL,UAAU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 @@
1
+ import type { EffectConfig } from '../types';
2
+ /**
3
+ * @description 从 spec 数据中统计类目分组数量,用于计算分组高亮总时长。
4
+ * @param spec 当前 VChart spec。
5
+ * @returns 类目分组数量。
6
+ */
7
+ export declare const getGroupCountFromSpec: (spec: any) => {
8
+ groupCount: number;
9
+ };
10
+ /**
11
+ * @description 生成柱图分组高亮循环动画配置。
12
+ * @param startTime 动画开始时间,单位毫秒。
13
+ * @param config 高亮动画配置,包含颜色和缓动。
14
+ * @param duration 分组高亮总时长,单位秒。
15
+ * @param interval 每轮循环间隔,单位秒。
16
+ * @param atmosphereDuration 氛围动画占用时长,单位秒。
17
+ * @param isHorizontal 是否为横向柱图。
18
+ * @param spec 当前 VChart spec。
19
+ * @returns 柱图分组高亮循环动画配置。
20
+ */
21
+ export declare const groupHighLightBar: (startTime: number, config: EffectConfig<any>, duration: number, interval: number, atmosphereDuration: number, isHorizontal: boolean, spec: any) => {
22
+ loop: boolean;
23
+ startTime: number;
24
+ controlOptions: {
25
+ immediatelyApply: boolean;
26
+ };
27
+ timeSlices: ({
28
+ effects: {
29
+ channel: {
30
+ fill: {
31
+ to: string | {
32
+ gradient: string;
33
+ x0: number;
34
+ x1: number;
35
+ y1: number;
36
+ y0: number;
37
+ stops: {
38
+ offset: number;
39
+ color: string;
40
+ }[];
41
+ };
42
+ from?: undefined;
43
+ };
44
+ stroke: {
45
+ to: string | {
46
+ gradient: string;
47
+ x0: number;
48
+ x1: number;
49
+ y1: number;
50
+ y0: number;
51
+ stops: {
52
+ offset: number;
53
+ color: string;
54
+ }[];
55
+ };
56
+ from?: undefined;
57
+ };
58
+ };
59
+ easing: string | undefined;
60
+ };
61
+ delay: (datum: any, _element: any, _ctx: any, context: any) => number;
62
+ duration: (_datum: any, _element: any, _ctx: any, context: any) => number;
63
+ delayAfter?: undefined;
64
+ } | {
65
+ effects: {
66
+ channel: {
67
+ fill: {
68
+ from: string | {
69
+ gradient: string;
70
+ x0: number;
71
+ x1: number;
72
+ y1: number;
73
+ y0: number;
74
+ stops: {
75
+ offset: number;
76
+ color: string;
77
+ }[];
78
+ };
79
+ to: (...p: any[]) => any;
80
+ };
81
+ stroke: {
82
+ from: string | {
83
+ gradient: string;
84
+ x0: number;
85
+ x1: number;
86
+ y1: number;
87
+ y0: number;
88
+ stops: {
89
+ offset: number;
90
+ color: string;
91
+ }[];
92
+ };
93
+ to: (...p: any[]) => any;
94
+ };
95
+ };
96
+ easing: string | undefined;
97
+ };
98
+ delayAfter: (datum: any, _element: any, _ctx: any, context: any) => number;
99
+ duration: (_datum: any, _element: any, _ctx: any, context: any) => number;
100
+ delay?: undefined;
101
+ })[];
102
+ }[];
@@ -0,0 +1,84 @@
1
+ import { array } from "@visactor/vutils";
2
+ import { atmosphereColorToFill, atmosphereColorToStroke } from "./barColor.js";
3
+ const getGroupCountFromSpec = (spec)=>{
4
+ const field = 'horizontal' === spec.direction ? array(spec.yField)[0] : array(spec.xField)[0];
5
+ const groupCount = new Set((spec.data?.[0]?.values ?? []).map((row)=>row[field])).size;
6
+ return {
7
+ groupCount
8
+ };
9
+ };
10
+ const getGroupInfo = (chartInstance, datum)=>{
11
+ const series = chartInstance.getChart().getAllSeries()[0];
12
+ const indexField = 'horizontal' === series.direction ? series.fieldY[0] : series.fieldX[0];
13
+ const indexValue = datum?.[indexField];
14
+ const scale = 'horizontal' === series.direction ? series.scaleY : series.scaleX;
15
+ const index = (scale?.domain?.() ?? []).indexOf(indexValue) || 0;
16
+ const count = (scale?.domain?.() ?? []).length ?? 1;
17
+ return {
18
+ index,
19
+ count
20
+ };
21
+ };
22
+ const getSliceDuration = (totalDuration)=>(_datum, _element, _ctx, context)=>{
23
+ const { count } = getGroupInfo(context.vchart, _datum);
24
+ return 0 === count ? 1000 : totalDuration / count / 2;
25
+ };
26
+ const groupHighLightBar = (startTime, config, duration, interval, atmosphereDuration, isHorizontal, spec)=>{
27
+ const totalDuration = 1000 * duration;
28
+ const color = config.color ?? '#4A90E2';
29
+ const isGradientChart = spec?.bar?.style?.fill?.gradient === 'linear';
30
+ const fillColor = atmosphereColorToFill(color, isGradientChart, isHorizontal);
31
+ const strokeColor = atmosphereColorToStroke(color, isGradientChart, isHorizontal);
32
+ return [
33
+ {
34
+ loop: true,
35
+ startTime,
36
+ controlOptions: {
37
+ immediatelyApply: false
38
+ },
39
+ timeSlices: [
40
+ {
41
+ effects: {
42
+ channel: {
43
+ fill: {
44
+ to: fillColor
45
+ },
46
+ stroke: {
47
+ to: strokeColor
48
+ }
49
+ },
50
+ easing: config.ease
51
+ },
52
+ delay: (datum, _element, _ctx, context)=>{
53
+ const { count, index } = getGroupInfo(context.vchart, datum);
54
+ return 0 === count ? 0 : index * totalDuration / count;
55
+ },
56
+ duration: getSliceDuration(totalDuration)
57
+ },
58
+ {
59
+ effects: {
60
+ channel: {
61
+ fill: {
62
+ from: fillColor,
63
+ to: (...p)=>p[1].attribute.fill
64
+ },
65
+ stroke: {
66
+ from: strokeColor,
67
+ to: (...p)=>p[1].attribute.fill
68
+ }
69
+ },
70
+ easing: config.ease
71
+ },
72
+ delayAfter: (datum, _element, _ctx, context)=>{
73
+ const { count, index } = getGroupInfo(context.vchart, datum);
74
+ return 0 === count ? 0 : (interval + atmosphereDuration) * 1000 + (count - index - 1) * totalDuration / count;
75
+ },
76
+ duration: getSliceDuration(totalDuration)
77
+ }
78
+ ]
79
+ }
80
+ ];
81
+ };
82
+ export { getGroupCountFromSpec, groupHighLightBar };
83
+
84
+ //# sourceMappingURL=barGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/barGroup.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/barGroup.ts"],"sourcesContent":["import { array } from '@visactor/vutils'\nimport type { EffectConfig } from '../types'\nimport { atmosphereColorToFill, atmosphereColorToStroke } from './barColor'\n\n/**\n * @description 从 spec 数据中统计类目分组数量,用于计算分组高亮总时长。\n * @param spec 当前 VChart spec。\n * @returns 类目分组数量。\n */\nexport const getGroupCountFromSpec = (spec: any) => {\n const field = spec.direction === 'horizontal' ? array(spec.yField)[0] : array(spec.xField)[0]\n const groupCount = new Set((spec.data?.[0]?.values ?? []).map((row: any) => row[field])).size\n return { groupCount }\n}\n\n/**\n * @description 获取当前 datum 在类目轴 domain 中的位置和总数。\n * @param chartInstance VChart 实例。\n * @param datum 当前数据项。\n * @returns 当前数据项索引和类目总数。\n */\nconst getGroupInfo = (chartInstance: any, datum: any) => {\n const series = chartInstance.getChart().getAllSeries()[0]\n const indexField = series.direction === 'horizontal' ? series.fieldY[0] : series.fieldX[0]\n const indexValue = datum?.[indexField]\n const scale = series.direction === 'horizontal' ? series.scaleY : series.scaleX\n const index = (scale?.domain?.() ?? []).indexOf(indexValue) || 0\n const count = (scale?.domain?.() ?? []).length ?? 1\n return { index, count }\n}\n\n/**\n * @description 生成单个高亮片段的动态时长函数,使每个类目均分总时长。\n * @param totalDuration 分组高亮总时长,单位毫秒。\n * @returns timeSlice duration 回调函数。\n */\nconst getSliceDuration = (totalDuration: number) => (_datum: any, _element: any, _ctx: any, context: any) => {\n const { count } = getGroupInfo(context.vchart, _datum)\n return count === 0 ? 1000 : totalDuration / count / 2\n}\n\n/**\n * @description 生成柱图分组高亮循环动画配置。\n * @param startTime 动画开始时间,单位毫秒。\n * @param config 高亮动画配置,包含颜色和缓动。\n * @param duration 分组高亮总时长,单位秒。\n * @param interval 每轮循环间隔,单位秒。\n * @param atmosphereDuration 氛围动画占用时长,单位秒。\n * @param isHorizontal 是否为横向柱图。\n * @param spec 当前 VChart spec。\n * @returns 柱图分组高亮循环动画配置。\n */\nexport const groupHighLightBar = (\n startTime: number,\n config: EffectConfig<any>,\n duration: number,\n interval: number,\n atmosphereDuration: number,\n isHorizontal: boolean,\n spec: any,\n) => {\n const totalDuration = duration * 1000\n const color = config.color ?? '#4A90E2'\n const isGradientChart = spec?.bar?.style?.fill?.gradient === 'linear'\n const fillColor = atmosphereColorToFill(color, isGradientChart, isHorizontal)\n const strokeColor = atmosphereColorToStroke(color, isGradientChart, isHorizontal)\n\n return [\n {\n loop: true,\n startTime,\n controlOptions: { immediatelyApply: false },\n timeSlices: [\n {\n effects: { channel: { fill: { to: fillColor }, stroke: { to: strokeColor } }, easing: config.ease },\n delay: (datum: any, _element: any, _ctx: any, context: any) => {\n const { count, index } = getGroupInfo(context.vchart, datum)\n return count === 0 ? 0 : (index * totalDuration) / count\n },\n duration: getSliceDuration(totalDuration),\n },\n {\n effects: {\n channel: {\n fill: { from: fillColor, to: (...p: any[]) => p[1].attribute.fill },\n stroke: { from: strokeColor, to: (...p: any[]) => p[1].attribute.fill },\n },\n easing: config.ease,\n },\n delayAfter: (datum: any, _element: any, _ctx: any, context: any) => {\n const { count, index } = getGroupInfo(context.vchart, datum)\n return count === 0\n ? 0\n : (interval + atmosphereDuration) * 1000 + ((count - index - 1) * totalDuration) / count\n },\n duration: getSliceDuration(totalDuration),\n },\n ],\n },\n ]\n}\n"],"names":["getGroupCountFromSpec","spec","field","array","groupCount","Set","row","getGroupInfo","chartInstance","datum","series","indexField","indexValue","scale","index","count","getSliceDuration","totalDuration","_datum","_element","_ctx","context","groupHighLightBar","startTime","config","duration","interval","atmosphereDuration","isHorizontal","color","isGradientChart","fillColor","atmosphereColorToFill","strokeColor","atmosphereColorToStroke","p"],"mappings":";;AASO,MAAMA,wBAAwB,CAACC;IACpC,MAAMC,QAAQD,AAAmB,iBAAnBA,KAAK,SAAS,GAAoBE,MAAMF,KAAK,MAAM,CAAC,CAAC,EAAE,GAAGE,MAAMF,KAAK,MAAM,CAAC,CAAC,EAAE;IAC7F,MAAMG,aAAa,IAAIC,IAAKJ,AAAAA,CAAAA,KAAK,IAAI,EAAE,CAAC,EAAE,EAAE,UAAU,EAAC,EAAG,GAAG,CAAC,CAACK,MAAaA,GAAG,CAACJ,MAAM,GAAG,IAAI;IAC7F,OAAO;QAAEE;IAAW;AACtB;AAQA,MAAMG,eAAe,CAACC,eAAoBC;IACxC,MAAMC,SAASF,cAAc,Q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,EAAEN,KAAK,EAAED,KAAK,EAAE,GAAGP,aAAac,QAAQ,MAAM,EAAEZ;wBACtD,OAAOM,AAAU,MAAVA,QAAc,IAAKD,QAAQG,gBAAiBF;oBACrD;oBACA,UAAUC,iBAAiBC;gBAC7B;gBACA;oBACE,SAAS;wBACP,SAAS;4BACP,MAAM;gCAAE,MAAMc;gCAAW,IAAI,CAAC,GAAGI,IAAaA,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI;4BAAC;4BAClE,QAAQ;gCAAE,MAAMF;gCAAa,IAAI,CAAC,GAAGE,IAAaA,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI;4BAAC;wBACxE;wBACA,QAAQX,OAAO,IAAI;oBACrB;oBACA,YAAY,CAACf,OAAYU,UAAeC,MAAWC;wBACjD,MAAM,EAAEN,KAAK,EAAED,KAAK,EAAE,GAAGP,aAAac,QAAQ,MAAM,EAAEZ;wBACtD,OAAOM,AAAU,MAAVA,QACH,IACCW,AAAAA,CAAAA,WAAWC,kBAAiB,IAAK,OAASZ,AAAAA,CAAAA,QAAQD,QAAQ,KAAKG,gBAAiBF;oBACvF;oBACA,UAAUC,iBAAiBC;gBAC7B;aACD;QACH;KACD;AACH"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @description 判断当前柱图类型是否为横向柱图。
3
+ * @param chartType 图表类型。
4
+ * @returns 是否为横向柱图。
5
+ */
6
+ export declare const isHorizontalBar: (chartType: string) => boolean;
7
+ /**
8
+ * @description 生成柱图增长入场动画配置。
9
+ * @param chartType 图表类型。
10
+ * @returns 柱图增长入场动画配置。
11
+ */
12
+ export declare const growBar: (chartType: string) => {
13
+ type: string;
14
+ oneByOne: boolean;
15
+ options: (_datum: any, _element: any, _opt: any, context: any) => {
16
+ overall: any;
17
+ orient?: undefined;
18
+ } | {
19
+ orient: string;
20
+ overall: any;
21
+ };
22
+ controlOptions: {
23
+ immediatelyApply: boolean;
24
+ };
25
+ };
26
+ /**
27
+ * @description 生成柱图逐个淡入的动画配置。
28
+ * @returns 柱图淡入动画配置。
29
+ */
30
+ export declare const fadeInBar: () => {
31
+ type: string;
32
+ oneByOne: boolean;
33
+ };
34
+ /**
35
+ * @description 生成柱图从画布外移入的动画配置。
36
+ * @param chartType 图表类型。
37
+ * @param spec 当前 VChart spec。
38
+ * @param isUpdate 是否为 update 阶段动画。
39
+ * @returns 柱图移入动画配置。
40
+ */
41
+ export declare const moveInBar: (chartType: string, spec?: any, isUpdate?: boolean) => {
42
+ type: string;
43
+ options: {
44
+ excludeChannels: string[];
45
+ direction: string;
46
+ orient: string;
47
+ point: (_datum: any, element: any, opt: any) => {
48
+ [x: string]: any;
49
+ };
50
+ };
51
+ };
52
+ /**
53
+ * @description 生成柱图移出画布的动画配置。
54
+ * @param chartType 图表类型。
55
+ * @returns 柱图移出动画配置。
56
+ */
57
+ export declare const moveOutBar: (chartType: string) => {
58
+ type: string;
59
+ options: {
60
+ direction: string;
61
+ orient: string;
62
+ point: (_datum: any, element: any, opt: any) => {
63
+ [x: string]: any;
64
+ };
65
+ };
66
+ };
@@ -0,0 +1,72 @@
1
+ import { ChartTypeEnum } from "../../../../../utils/index.js";
2
+ const horizontalTypes = [
3
+ ChartTypeEnum.Bar,
4
+ ChartTypeEnum.BarParallel,
5
+ ChartTypeEnum.BarPercent
6
+ ];
7
+ const isHorizontalBar = (chartType)=>horizontalTypes.includes(chartType);
8
+ const getBarGrowOptions = (isHorizontal)=>(_datum, _element, _opt, context)=>{
9
+ const overall = context.vchart.getChart().getComponentsByType('cartesianAxis-linear')[0]._scale.range()[0];
10
+ return isHorizontal ? {
11
+ overall
12
+ } : {
13
+ orient: 'negative',
14
+ overall
15
+ };
16
+ };
17
+ const growBar = (chartType)=>{
18
+ const isHorizontal = isHorizontalBar(chartType);
19
+ return {
20
+ type: isHorizontal ? 'growWidthIn' : 'growHeightIn',
21
+ oneByOne: false,
22
+ options: getBarGrowOptions(isHorizontal),
23
+ controlOptions: {
24
+ immediatelyApply: true
25
+ }
26
+ };
27
+ };
28
+ const fadeInBar = ()=>({
29
+ type: 'fadeIn',
30
+ oneByOne: true
31
+ });
32
+ const setRandomDataKey = (spec)=>{
33
+ if (!spec?.data?.[0]?.values) return;
34
+ const dataKey = 'dataKey';
35
+ spec.data[0].values.forEach((datum)=>datum[dataKey] = Math.random());
36
+ spec.dataKey = dataKey;
37
+ if ('common' === spec.type && Array.isArray(spec.series)) spec.series.forEach((series)=>series.dataKey = dataKey);
38
+ };
39
+ const getBarMoveOptions = (chartType, orient)=>{
40
+ const direction = isHorizontalBar(chartType) ? 'y' : 'x';
41
+ const size = 'x' === direction ? 'width' : 'height';
42
+ const offsetSign = 'in' === orient ? 1 : -1;
43
+ return {
44
+ direction,
45
+ orient: 'negative',
46
+ point: (_datum, element, opt)=>({
47
+ [direction]: element.getGraphicAttribute(direction) + offsetSign * opt[size]
48
+ })
49
+ };
50
+ };
51
+ const moveInBar = (chartType, spec, isUpdate = false)=>{
52
+ if (!isUpdate && spec) setRandomDataKey(spec);
53
+ const excludeChannels = isHorizontalBar(chartType) ? [
54
+ 'x'
55
+ ] : [
56
+ 'y'
57
+ ];
58
+ return {
59
+ type: 'moveIn',
60
+ options: {
61
+ ...getBarMoveOptions(chartType, 'in'),
62
+ excludeChannels
63
+ }
64
+ };
65
+ };
66
+ const moveOutBar = (chartType)=>({
67
+ type: 'moveOut',
68
+ options: getBarMoveOptions(chartType, 'out')
69
+ });
70
+ export { fadeInBar, growBar, isHorizontalBar, moveInBar, moveOutBar };
71
+
72
+ //# sourceMappingURL=barMotion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/barMotion.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/barMotion.ts"],"sourcesContent":["import { ChartTypeEnum } from 'src/pipeline/utils'\n\nconst horizontalTypes = [ChartTypeEnum.Bar, ChartTypeEnum.BarParallel, ChartTypeEnum.BarPercent]\n\n/**\n * @description 判断当前柱图类型是否为横向柱图。\n * @param chartType 图表类型。\n * @returns 是否为横向柱图。\n */\nexport const isHorizontalBar = (chartType: string): boolean => horizontalTypes.includes(chartType as any)\n\n/**\n * @description 生成柱图增长动画的 options,横向按宽度增长,纵向按高度反向增长。\n * @param isHorizontal 是否为横向柱图。\n * @returns 柱图增长动画 options 生成函数。\n */\nconst getBarGrowOptions = (isHorizontal: boolean) => (_datum: any, _element: any, _opt: any, context: any) => {\n const overall = context.vchart.getChart().getComponentsByType('cartesianAxis-linear')[0]._scale.range()[0]\n return isHorizontal ? { overall } : { orient: 'negative', overall }\n}\n\n/**\n * @description 生成柱图增长入场动画配置。\n * @param chartType 图表类型。\n * @returns 柱图增长入场动画配置。\n */\nexport const growBar = (chartType: string) => {\n const isHorizontal = isHorizontalBar(chartType)\n return {\n type: isHorizontal ? 'growWidthIn' : 'growHeightIn',\n oneByOne: false,\n options: getBarGrowOptions(isHorizontal),\n controlOptions: { immediatelyApply: true },\n }\n}\n\n/**\n * @description 生成柱图逐个淡入的动画配置。\n * @returns 柱图淡入动画配置。\n */\nexport const fadeInBar = () => ({ type: 'fadeIn', oneByOne: true })\n\n/**\n * @description 为柱图数据补充随机 dataKey,确保每根柱子按独立图元执行动画。\n * @param spec 当前 VChart spec。\n * @returns 无返回值,直接修改 spec。\n */\nconst setRandomDataKey = (spec: any) => {\n if (!spec?.data?.[0]?.values) return\n const dataKey = 'dataKey'\n spec.data[0].values.forEach((datum: any) => (datum[dataKey] = Math.random()))\n spec.dataKey = dataKey\n if (spec.type === 'common' && Array.isArray(spec.series)) {\n spec.series.forEach((series: any) => (series.dataKey = dataKey))\n }\n}\n\n/**\n * @description 生成柱图移入/移出的方向、位移点和通道配置。\n * @param chartType 图表类型。\n * @param orient 移动方向,in 表示移入,out 表示移出。\n * @returns 柱图移动动画 options。\n */\nconst getBarMoveOptions = (chartType: string, orient: 'in' | 'out') => {\n const direction = isHorizontalBar(chartType) ? 'y' : 'x'\n const size = direction === 'x' ? 'width' : 'height'\n const offsetSign = orient === 'in' ? 1 : -1\n\n return {\n direction,\n orient: 'negative',\n point: (_datum: any, element: any, opt: any) => ({\n [direction]: element.getGraphicAttribute(direction) + offsetSign * opt[size],\n }),\n }\n}\n\n/**\n * @description 生成柱图从画布外移入的动画配置。\n * @param chartType 图表类型。\n * @param spec 当前 VChart spec。\n * @param isUpdate 是否为 update 阶段动画。\n * @returns 柱图移入动画配置。\n */\nexport const moveInBar = (chartType: string, spec?: any, isUpdate = false) => {\n if (!isUpdate && spec) setRandomDataKey(spec)\n const excludeChannels = isHorizontalBar(chartType) ? ['x'] : ['y']\n return { type: 'moveIn', options: { ...getBarMoveOptions(chartType, 'in'), excludeChannels } }\n}\n\n/**\n * @description 生成柱图移出画布的动画配置。\n * @param chartType 图表类型。\n * @returns 柱图移出动画配置。\n */\nexport const moveOutBar = (chartType: string) => ({ type: 'moveOut', options: getBarMoveOptions(chartType, 'out') })\n"],"names":["horizontalTypes","ChartTypeEnum","isHorizontalBar","chartType","getBarGrowOptions","isHorizontal","_datum","_element","_opt","context","overall","growBar","fadeInBar","setRandomDataKey","spec","dataKey","datum","Math","Array","series","getBarMoveOptions","orient","direction","size","offsetSign","element","opt","moveInBar","isUpdate","excludeChannels","moveOutBar"],"mappings":";AAEA,MAAMA,kBAAkB;IAACC,cAAc,GAAG;IAAEA,cAAc,WAAW;IAAEA,cAAc,UAAU;CAAC;AAOzF,MAAMC,kBAAkB,CAACC,YAA+BH,gBAAgB,QAAQ,CAACG;AAOxF,MAAMC,oBAAoB,CAACC,eAA0B,CAACC,QAAaC,UAAeC,MAAWC;QAC3F,MAAMC,UAAUD,QAAQ,MAAM,CAAC,QAAQ,GAAG,mBAAmB,CAAC,uBAAuB,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE;QAC1G,OAAOJ,eAAe;YAAEK;QAAQ,IAAI;YAAE,QAAQ;YAAYA;QAAQ;IACpE;AAOO,MAAMC,UAAU,CAACR;IACtB,MAAME,eAAeH,gBAA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E,MAAM;QAAW,SAASiB,kBAAkBjB,WAAW;IAAO"}
@@ -0,0 +1,86 @@
1
+ import { type AnimationEffect, type AnimationEffectConfig } from '../types';
2
+ export declare const EFFECT_NONE: "none";
3
+ /**
4
+ * @description 将秒转换为 VChart 动画使用的毫秒。
5
+ * @param seconds 秒数。
6
+ * @returns 毫秒数。
7
+ */
8
+ export declare const toMs: (seconds?: number) => number;
9
+ /**
10
+ * @description 获取配置中的首个动画效果;未配置时返回 none。
11
+ * @param config 动画效果配置。
12
+ * @returns 首个动画效果。
13
+ */
14
+ export declare const getPrimaryEffect: (config?: AnimationEffectConfig) => AnimationEffect;
15
+ /**
16
+ * @description 判断通用动画配置是否开启且首个效果不是 none。
17
+ * @param config 动画效果配置。
18
+ * @returns 是否允许执行动画。
19
+ */
20
+ export declare const allowAnimation: (config?: AnimationEffectConfig) => boolean;
21
+ /**
22
+ * @description 判断折线/面积动画是否开启;这类图表以最后一个效果作为有效性判断。
23
+ * @param config 动画效果配置。
24
+ * @returns 是否允许执行折线/面积动画。
25
+ */
26
+ export declare const allowLineOrAreaAnimation: (config?: AnimationEffectConfig) => boolean;
27
+ /**
28
+ * @description 获取图元最终属性,优先读取动画后的 finalAttribute。
29
+ * @param mark VChart 图元对象。
30
+ * @returns 图元最终属性。
31
+ */
32
+ export declare const getFinalAttribute: (mark: any) => Record<string, any>;
33
+ /**
34
+ * @description 生成点图元氛围动画配置,复用于折线、面积、散点和雷达图。
35
+ * @param effect 氛围动画效果。
36
+ * @returns 点图元氛围动画配置。
37
+ */
38
+ export declare const atmospherePoint: (effect?: AnimationEffect) => {
39
+ channel?: undefined;
40
+ } | {
41
+ channel: {
42
+ scaleX: {
43
+ from: number;
44
+ to: number;
45
+ };
46
+ scaleY: {
47
+ from: number;
48
+ to: number;
49
+ };
50
+ fillOpacity?: undefined;
51
+ strokeOpacity?: undefined;
52
+ outerBorder?: undefined;
53
+ };
54
+ } | {
55
+ channel: {
56
+ fillOpacity: {
57
+ from: number;
58
+ to: number;
59
+ };
60
+ strokeOpacity: {
61
+ from: number;
62
+ to: number;
63
+ };
64
+ scaleX?: undefined;
65
+ scaleY?: undefined;
66
+ outerBorder?: undefined;
67
+ };
68
+ } | {
69
+ channel: {
70
+ outerBorder: {
71
+ from: {
72
+ distance: number;
73
+ strokeOpacity: number;
74
+ };
75
+ to: (...args: any[]) => {
76
+ distance: number;
77
+ strokeOpacity: number;
78
+ stroke: any;
79
+ };
80
+ };
81
+ scaleX?: undefined;
82
+ scaleY?: undefined;
83
+ fillOpacity?: undefined;
84
+ strokeOpacity?: undefined;
85
+ };
86
+ };
@@ -0,0 +1,60 @@
1
+ import { VScreenAnimationType } from "../types.js";
2
+ const EFFECT_NONE = VScreenAnimationType.none;
3
+ const toMs = (seconds)=>(seconds ?? 0) * 1000;
4
+ const getPrimaryEffect = (config)=>config?.effects?.[0] ?? EFFECT_NONE;
5
+ const allowAnimation = (config)=>{
6
+ if (!config?.enable) return false;
7
+ return getPrimaryEffect(config) !== EFFECT_NONE;
8
+ };
9
+ const allowLineOrAreaAnimation = (config)=>{
10
+ if (!config?.enable) return false;
11
+ const effects = config.effects ?? [];
12
+ const effect = effects[effects.length - 1] ?? EFFECT_NONE;
13
+ return effect !== EFFECT_NONE;
14
+ };
15
+ const getFinalAttribute = (mark)=>mark?.finalAttribute ?? mark?.attribute ?? {};
16
+ const atmospherePoint = (effect)=>{
17
+ if (effect === EFFECT_NONE) return {};
18
+ if ('breath' === effect) return {
19
+ channel: {
20
+ scaleX: {
21
+ from: 0.8,
22
+ to: 1.2
23
+ },
24
+ scaleY: {
25
+ from: 0.8,
26
+ to: 1.2
27
+ }
28
+ }
29
+ };
30
+ if ('reveal' === effect) return {
31
+ channel: {
32
+ fillOpacity: {
33
+ from: 0.6,
34
+ to: 1
35
+ },
36
+ strokeOpacity: {
37
+ from: 0.6,
38
+ to: 1
39
+ }
40
+ }
41
+ };
42
+ return {
43
+ channel: {
44
+ outerBorder: {
45
+ from: {
46
+ distance: 0,
47
+ strokeOpacity: 1
48
+ },
49
+ to: (...args)=>({
50
+ distance: 16,
51
+ strokeOpacity: 1e-8,
52
+ stroke: args[1]?.attribute?.fill
53
+ })
54
+ }
55
+ }
56
+ };
57
+ };
58
+ export { EFFECT_NONE, allowAnimation, allowLineOrAreaAnimation, atmospherePoint, getFinalAttribute, getPrimaryEffect, toMs };
59
+
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/index.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/index.ts"],"sourcesContent":["import { VScreenAnimationType, type AnimationEffect, type AnimationEffectConfig } from '../types'\n\nexport const EFFECT_NONE = VScreenAnimationType.none\n\n/**\n * @description 将秒转换为 VChart 动画使用的毫秒。\n * @param seconds 秒数。\n * @returns 毫秒数。\n */\nexport const toMs = (seconds?: number): number => (seconds ?? 0) * 1000\n\n/**\n * @description 获取配置中的首个动画效果;未配置时返回 none。\n * @param config 动画效果配置。\n * @returns 首个动画效果。\n */\nexport const getPrimaryEffect = (config?: AnimationEffectConfig): AnimationEffect => config?.effects?.[0] ?? EFFECT_NONE\n\n/**\n * @description 判断通用动画配置是否开启且首个效果不是 none。\n * @param config 动画效果配置。\n * @returns 是否允许执行动画。\n */\nexport const allowAnimation = (config?: AnimationEffectConfig): boolean => {\n if (!config?.enable) {\n return false\n }\n return getPrimaryEffect(config) !== EFFECT_NONE\n}\n\n/**\n * @description 判断折线/面积动画是否开启;这类图表以最后一个效果作为有效性判断。\n * @param config 动画效果配置。\n * @returns 是否允许执行折线/面积动画。\n */\nexport const allowLineOrAreaAnimation = (config?: AnimationEffectConfig): boolean => {\n if (!config?.enable) {\n return false\n }\n const effects = config.effects ?? []\n const effect = effects[effects.length - 1] ?? EFFECT_NONE\n return effect !== EFFECT_NONE\n}\n\n/**\n * @description 获取图元最终属性,优先读取动画后的 finalAttribute。\n * @param mark VChart 图元对象。\n * @returns 图元最终属性。\n */\nexport const getFinalAttribute = (mark: any): Record<string, any> => {\n return mark?.finalAttribute ?? mark?.attribute ?? {}\n}\n\n/**\n * @description 生成点图元氛围动画配置,复用于折线、面积、散点和雷达图。\n * @param effect 氛围动画效果。\n * @returns 点图元氛围动画配置。\n */\nexport const atmospherePoint = (effect?: AnimationEffect) => {\n if (effect === EFFECT_NONE) {\n return {}\n }\n if (effect === 'breath') {\n return {\n channel: {\n scaleX: { from: 0.8, to: 1.2 },\n scaleY: { from: 0.8, to: 1.2 },\n },\n }\n }\n if (effect === 'reveal') {\n return {\n channel: {\n fillOpacity: { from: 0.6, to: 1 },\n strokeOpacity: { from: 0.6, to: 1 },\n },\n }\n }\n return {\n channel: {\n outerBorder: {\n from: { distance: 0, strokeOpacity: 1 },\n // 波纹描边沿用图元填充色,避免自定义配色下出现突兀色值。\n to: (...args: any[]) => ({\n distance: 16,\n strokeOpacity: 1e-8,\n stroke: args[1]?.attribute?.fill,\n }),\n },\n },\n }\n}\n"],"names":["EFFECT_NONE","VScreenAnimationType","toMs","seconds","getPrimaryEffect","config","allowAnimation","allowLineOrAreaAnimation","effects","effect","getFinalAttribute","mark","atmospherePoint","args"],"mappings":";AAEO,MAAMA,cAAcC,qBAAqB,IAAI;AAO7C,MAAMC,OAAO,CAACC,UAA8BA,AAAAA,CAAAA,WAAW,KAAK;AAO5D,MAAMC,mBAAmB,CAACC,SAAoDA,QAAQ,SAAS,CAAC,EAAE,IAAIL;AAOtG,MAAMM,iBAAiB,CAACD;IAC7B,IAAI,CAACA,QAAQ,QACX,OAAO;IAET,OAAOD,iBAAiBC,YAAYL;AACtC;AAOO,MAAMO,2BAA2B,CAACF;IACvC,IAAI,CAACA,QAAQ,QACX,OAAO;IAET,MAAMG,UAAUH,OAAO,OAAO,IAAI,EAAE;IACpC,MAAMI,SAASD,OAAO,CAACA,QAAQ,MAAM,GAAG,EAAE,IAAIR;IAC9C,OAAOS,WAAWT;AACpB;AAOO,MAAMU,oBAAoB,CAACC,OACzBA,MAAM,kBAAkBA,MAAM,aAAa,CAAC;AAQ9C,MAAMC,kBAAkB,CAACH;IAC9B,IAAIA,WAAWT,aACb,OAAO,CAAC;IAEV,IAAIS,AAAW,aAAXA,QACF,OAAO;QACL,SAAS;YACP,QAAQ;gBAAE,MAAM;gBAAK,IAAI;YAAI;YAC7B,QAAQ;gBAAE,MAAM;gBAAK,IAAI;YAAI;QAC/B;IACF;IAEF,IAAIA,AAAW,aAAXA,QACF,OAAO;QACL,SAAS;YACP,aAAa;gBAAE,MAAM;gBAAK,IAAI;YAAE;YAChC,eAAe;gBAAE,MAAM;gBAAK,IAAI;YAAE;QACpC;IACF;IAEF,OAAO;QACL,SAAS;YACP,aAAa;gBACX,MAAM;oBAAE,UAAU;oBAAG,eAAe;gBAAE;gBAEtC,IAAI,CAAC,GAAGI,OAAiB;wBACvB,UAAU;wBACV,eAAe;wBACf,QAAQA,IAAI,CAAC,EAAE,EAAE,WAAW;oBAC9B;YACF;QACF;IACF;AACF"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @description 生成折线/面积路径从顶部增长进入的动画配置。
3
+ * @returns 折线/面积路径增长动画配置。
4
+ */
5
+ export declare const growthTopLine: () => {
6
+ type: string;
7
+ options: {
8
+ orient: string;
9
+ };
10
+ };
11
+ /**
12
+ * @description 生成折线/面积点图元从顶部移入的动画配置。
13
+ * @returns 折线/面积点图元移入动画配置。
14
+ */
15
+ export declare const growthTopPoint: () => {
16
+ type: string;
17
+ options: {
18
+ direction: string;
19
+ orient: string;
20
+ };
21
+ };
22
+ /**
23
+ * @description 生成曲线整体裁剪进入的动画配置,用于 load 效果。
24
+ * @returns 曲线整体裁剪进入的动画配置。
25
+ */
26
+ export declare const clipInLine: () => {
27
+ type: string;
28
+ oneByOne: boolean;
29
+ };
@@ -0,0 +1,20 @@
1
+ const growthTopLine = ()=>({
2
+ type: 'growPointsYIn',
3
+ options: {
4
+ orient: 'negative'
5
+ }
6
+ });
7
+ const growthTopPoint = ()=>({
8
+ type: 'moveIn',
9
+ options: {
10
+ direction: 'y',
11
+ orient: 'negative'
12
+ }
13
+ });
14
+ const clipInLine = ()=>({
15
+ type: 'clipIn',
16
+ oneByOne: false
17
+ });
18
+ export { clipInLine, growthTopLine, growthTopPoint };
19
+
20
+ //# sourceMappingURL=lineOrArea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline/spec/chart/pipes/animation/utils/lineOrArea.js","sources":["../../../../../../../../src/pipeline/spec/chart/pipes/animation/utils/lineOrArea.ts"],"sourcesContent":["/**\n * @description 生成折线/面积路径从顶部增长进入的动画配置。\n * @returns 折线/面积路径增长动画配置。\n */\nexport const growthTopLine = () => ({ type: 'growPointsYIn', options: { orient: 'negative' } })\n\n/**\n * @description 生成折线/面积点图元从顶部移入的动画配置。\n * @returns 折线/面积点图元移入动画配置。\n */\nexport const growthTopPoint = () => ({ type: 'moveIn', options: { direction: 'y', orient: 'negative' } })\n\n/**\n * @description 生成曲线整体裁剪进入的动画配置,用于 load 效果。\n * @returns 曲线整体裁剪进入的动画配置。\n */\nexport const clipInLine = () => ({ type: 'clipIn', oneByOne: false })\n"],"names":["growthTopLine","growthTopPoint","clipInLine"],"mappings":"AAIO,MAAMA,gBAAgB,IAAO;QAAE,MAAM;QAAiB,SAAS;YAAE,QAAQ;QAAW;IAAE;AAMtF,MAAMC,iBAAiB,IAAO;QAAE,MAAM;QAAU,SAAS;YAAE,WAAW;YAAK,QAAQ;QAAW;IAAE;AAMhG,MAAMC,aAAa,IAAO;QAAE,MAAM;QAAU,UAAU;IAAM"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @description 生成饼图/玫瑰图按角度展开的入场动画配置。
3
+ * @returns 饼图/玫瑰图角度展开动画配置。
4
+ */
5
+ export declare const radialPie: () => {
6
+ type: string;
7
+ };
8
+ /**
9
+ * @description 生成饼图/玫瑰图按半径展开的入场动画配置。
10
+ * @returns 饼图/玫瑰图半径展开动画配置。
11
+ */
12
+ export declare const scalePie: () => {
13
+ type: string;
14
+ };
@@ -0,0 +1,9 @@
1
+ const radialPie = ()=>({
2
+ type: 'growAngleIn'
3
+ });
4
+ const scalePie = ()=>({
5
+ type: 'growRadiusIn'
6
+ });
7
+ export { radialPie, scalePie };
8
+
9
+ //# sourceMappingURL=pie.js.map